-
Notifications
You must be signed in to change notification settings - Fork 7
Framework update — Phase 1 (detect + install, no handoff) #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2232863
feat(config): add framework-update fields to agent normalize
jaylfc 9be7398
feat(frameworks): manifest update metadata + validator
jaylfc f54624e
fix(frameworks): remove hallucinated framework entries (ironclaw/molt…
jaylfc e0b78c6
feat(app): validate framework manifests at startup
jaylfc e55c05d
feat(releases): parser + fetch helper for GitHub Releases
jaylfc 1373700
feat(auto_update): hourly framework releases poll
jaylfc c44d565
feat(containers): snapshot_list and snapshot_delete helpers
jaylfc 3f71a69
feat(framework-update): prune old pre-update snapshots
jaylfc 2d6431f
feat(framework-update): bootstrap-ping wait with 500ms polling
jaylfc 859f2f0
feat(framework-update): start_update orchestration
jaylfc 9ad098a
feat(openclaw): bootstrap handler bumps bootstrap_last_seen_at
jaylfc dc0c932
feat(framework): GET /api/agents/{slug}/framework endpoint
jaylfc ec21e44
feat(framework): POST /api/agents/{slug}/framework/update
jaylfc 6a8449d
feat(framework): GET /api/frameworks/latest with refresh
jaylfc 656d332
feat(agent-image): bake taos-framework-update.sh into base image
jaylfc 664d0ed
feat(app): probe installed framework version on startup
jaylfc fbbcf1c
feat(desktop): framework-api client
jaylfc aee9423
feat(agent-settings): Framework tab with installed/latest + update bu…
jaylfc 52d562f
feat(agents): sidebar dot on out-of-date agents
jaylfc 8c892cc
feat(store): affected-agent pill on framework cards
jaylfc 5ac3d5f
test(e2e): framework tab skeletons
jaylfc d72df0d
test(e2e): store pill + sidebar dot skeletons
jaylfc 3ccd512
build: rebuild desktop bundle for framework-update feature
jaylfc 4f682ce
fix(frameworks): restore picoclaw/nanoclaw and other real frameworks …
jaylfc a668127
fix(framework-tab): pin update request to confirmed tag, handle null …
jaylfc aed638b
feat(scripts): per-framework install scripts with embedded SSE bridges
jaylfc 264d98e
fix(scripts): hermes uses 'gateway run' + api_key in config.yaml; ope…
jaylfc 2dbd284
fix(chat): group-chat replies — bridges thread channel_id; bridge_ses…
jaylfc f49d5bd
fix(scripts): hermes — use os.environ for MODEL/LLM_KEY in python her…
jaylfc 05ffa16
fix(chat): route fork-side replies via trace_id when channel_id missing
jaylfc ad6c13d
feat(frameworks): promote hermes alpha → beta
jaylfc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import { useEffect, useState } from "react"; | ||
| import { fetchFrameworkState, FrameworkState, startFrameworkUpdate } from "@/lib/framework-api"; | ||
|
|
||
| export function FrameworkTab({ agent, onUpdated }: { agent: { name: string }; onUpdated: () => void }) { | ||
| const [state, setState] = useState<FrameworkState | null>(null); | ||
| const [err, setErr] = useState<string | null>(null); | ||
| const [confirming, setConfirming] = useState(false); | ||
| const [submitting, setSubmitting] = useState(false); | ||
| const [elapsed, setElapsed] = useState(0); | ||
|
|
||
| async function load() { | ||
| try { setState(await fetchFrameworkState(agent.name)); setErr(null); } | ||
| catch (e: any) { setErr(String(e)); } | ||
| } | ||
|
|
||
| useEffect(() => { load(); }, [agent.name]); | ||
|
|
||
| useEffect(() => { | ||
| if (state?.update_status !== "updating") return; | ||
| const id = setInterval(() => { load(); }, 2000); | ||
| return () => clearInterval(id); | ||
| }, [state?.update_status]); | ||
|
|
||
| useEffect(() => { | ||
| if (state?.update_status !== "updating" || !state.update_started_at) { setElapsed(0); return; } | ||
| const tick = () => setElapsed(Math.floor(Date.now() / 1000) - (state.update_started_at ?? 0)); | ||
| tick(); | ||
| const id = setInterval(tick, 1000); | ||
| return () => clearInterval(id); | ||
| }, [state?.update_status, state?.update_started_at]); | ||
|
|
||
| async function doUpdate() { | ||
| setSubmitting(true); | ||
| try { | ||
| // Pin the request to the exact tag the user just confirmed so the | ||
| // backend can't drift to a newer release if its cache advances mid-click. | ||
| await startFrameworkUpdate(agent.name, state?.latest?.tag); | ||
| // Optimistically flip to "updating" so the polling effect arms even | ||
| // if a racing load() reads an idle status before the backend writes. | ||
| setState((prev) => prev ? { ...prev, update_status: "updating", update_started_at: Math.floor(Date.now() / 1000) } : prev); | ||
| await load(); | ||
| onUpdated(); | ||
| } catch (e: any) { setErr(String(e)); } | ||
| finally { setSubmitting(false); setConfirming(false); } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
|
|
||
| if (err) return <div className="p-4 text-sm text-red-400">Error: {err}</div>; | ||
| if (!state) return <div className="p-4 text-sm opacity-60">Loading…</div>; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-4 p-4"> | ||
| <div className="text-sm">This agent runs <b>{state.framework}</b></div> | ||
| <dl className="grid grid-cols-[120px_1fr] gap-y-1 text-sm"> | ||
| <dt className="opacity-60">Installed</dt> | ||
| <dd><code>{state.installed.tag ?? "(unknown)"}</code> · <code>{state.installed.sha ?? "—"}</code></dd> | ||
| <dt className="opacity-60">Latest</dt> | ||
| <dd> | ||
| {state.latest | ||
| ? <><code>{state.latest.tag}</code> · <code>{state.latest.sha}</code> | ||
| {state.latest.published_at && <span className="opacity-60 ml-2">published {state.latest.published_at}</span>}</> | ||
| : <span className="opacity-60">(not available)</span>} | ||
| </dd> | ||
| </dl> | ||
|
|
||
| {state.update_available && state.update_status === "idle" && ( | ||
| <div className="flex items-center gap-2"> | ||
| <span className="bg-yellow-700/30 text-yellow-200 px-2 py-0.5 rounded text-xs">Update available</span> | ||
| <button onClick={() => setConfirming(true)} disabled={submitting} | ||
| className="bg-blue-600 px-3 py-1.5 rounded text-sm"> | ||
| Update Framework | ||
| </button> | ||
| </div> | ||
| )} | ||
|
|
||
| {!state.update_available && state.update_status === "idle" && state.latest && ( | ||
| <div className="text-sm text-green-400">✓ You're on the latest version</div> | ||
| )} | ||
|
|
||
| {state.update_status === "updating" && ( | ||
| <div className="bg-white/5 border border-white/10 rounded px-3 py-2 text-sm"> | ||
| Updating {state.framework}… started {elapsed}s ago. | ||
| </div> | ||
| )} | ||
|
|
||
| {state.update_status === "failed" && ( | ||
| <div className="bg-red-950/40 border border-red-800 rounded px-3 py-2 text-sm"> | ||
| <div>Update failed: {state.last_error}</div> | ||
| {state.last_snapshot && ( | ||
| <div className="opacity-70 mt-1">Snapshot retained: <code>{state.last_snapshot}</code></div> | ||
| )} | ||
| </div> | ||
| )} | ||
|
|
||
| {confirming && ( | ||
| <div className="fixed inset-0 bg-black/60 flex items-center justify-center z-50"> | ||
| <div className="bg-shell-bg border border-white/10 rounded p-4 max-w-sm"> | ||
| <p className="text-sm mb-3"> | ||
| Update {agent.name}'s {state.framework} to <code>{state.latest?.tag ?? "latest"}</code>? | ||
| The agent will go offline for up to 2 minutes. Messages will queue. | ||
| </p> | ||
| <div className="flex justify-end gap-2"> | ||
| <button onClick={() => setConfirming(false)} className="opacity-60 text-sm">Cancel</button> | ||
| <button onClick={doUpdate} disabled={submitting} className="bg-blue-600 px-3 py-1.5 rounded text-sm"> | ||
| {submitting ? "Starting…" : "Update"} | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| )} | ||
|
|
||
| <div className="mt-auto pt-4 text-xs opacity-50">Switch framework — coming soon</div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| export type FrameworkVersion = { tag: string | null; sha: string | null }; | ||
| export type LatestVersion = { tag: string; sha: string; published_at?: string }; | ||
|
|
||
| export interface FrameworkState { | ||
| framework: string; | ||
| installed: FrameworkVersion; | ||
| latest: LatestVersion | null; | ||
| update_available: boolean; | ||
| update_status: "idle" | "updating" | "failed"; | ||
| update_started_at: number | null; | ||
| last_error: string | null; | ||
| last_snapshot: string | null; | ||
| } | ||
|
|
||
| export async function fetchFrameworkState(slug: string): Promise<FrameworkState> { | ||
| const r = await fetch(`/api/agents/${encodeURIComponent(slug)}/framework`); | ||
| if (!r.ok) throw new Error(`framework fetch ${r.status}`); | ||
| return r.json(); | ||
| } | ||
|
|
||
| export async function startFrameworkUpdate(slug: string, targetVersion?: string): Promise<void> { | ||
| const r = await fetch(`/api/agents/${encodeURIComponent(slug)}/framework/update`, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify(targetVersion ? { target_version: targetVersion } : {}), | ||
| }); | ||
| if (!r.ok) { | ||
| const body = await r.json().catch(() => ({})); | ||
| throw new Error(body.error || `update start ${r.status}`); | ||
| } | ||
| } | ||
|
|
||
| export async function fetchLatestFrameworks(refresh = false): Promise<Record<string, LatestVersion>> { | ||
| const r = await fetch(`/api/frameworks/latest${refresh ? "?refresh=true" : ""}`); | ||
| if (!r.ok) throw new Error(`latest frameworks ${r.status}`); | ||
| return r.json(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: jaylfc/tinyagentos
Length of output: 82
🏁 Script executed:
Repository: jaylfc/tinyagentos
Length of output: 2184
🏁 Script executed:
Repository: jaylfc/tinyagentos
Length of output: 2734
🏁 Script executed:
Repository: jaylfc/tinyagentos
Length of output: 3063
Add
agent.nameto the polling effect dependency array to prevent stale requests from previous agents.The polling effect (lines 18-22) depends only on
state?.update_statusand will continue running even when the agent changes. If the user switches agents whileupdate_status === "updating", the old agent's polling interval persists and competes with the new agent's load request. Whichever response finishes last will overwrite the current state, potentially showing stale data from the previous agent.Add
agent.nameto the dependency array so the interval cleans up when the agent changes:🤖 Prompt for AI Agents