🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
feat(ai-team): unify ChatGPT workspace navigation (#3549)
rUv45dcdc76a144
diff --git a/plugins/ruflo-ai-team/.claude-plugin/plugin.json b/plugins/ruflo-ai-team/.claude-plugin/plugin.jsonindex f0de17f1b7..7d686aa969 100644--- a/plugins/ruflo-ai-team/.claude-plugin/plugin.json+++ b/plugins/ruflo-ai-team/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "ruflo-ai-team","description": "Give Claude a tenant-isolated AI team that divides work, coordinates progress, recalls approved context, and returns evidence-backed results.",- "version": "0.1.2",+ "version": "0.1.3","author": { "name": "ruvnet", "url": "https://github.com/ruvnet" },"homepage": "https://team.ruv.io","privacyPolicyUrl": "https://team.ruv.io/privacy",diff --git a/plugins/ruflo-ai-team/README.md b/plugins/ruflo-ai-team/README.mdindex 3e5af469ad..19d0499317 100644--- a/plugins/ruflo-ai-team/README.md+++ b/plugins/ruflo-ai-team/README.md@@ -13,7 +13,7 @@ The public v0.1 surface coordinates work; it does not silently send messages, de- Stored task, memory, and evidence content is provenance-labelled and nonce-fenced as untrusted data.- Fourteen focused tools, two prompts, a template resource, and a ChatGPT MCP Apps board.-The read-only `team_board` tool renders a compact ruOS-style desktop workspace in ChatGPT, with team/run metrics and task status. Its public HTML resource contains no tenant data; the tool requires `team:read`. The rail is visual context, not clickable navigation. `run_complete` requires `team:run` and refuses to complete a run until it has at least one task and every task is complete.+The read-only `team_board` tool opens one compact ruOS-style workspace in ChatGPT. Its Teams, Runs, and Tasks rail navigates inside the same card; selecting a run or pressing Refresh calls the same scoped tool through the MCP Apps bridge without asking ChatGPT to render another board. Its public HTML resource contains no tenant data; the tool requires `team:read`. Other tools remain data-only. Historical chat cards are immutable, so open a fresh chat after refreshing tools to see the current UI. `run_complete` requires `team:run` and refuses to complete a run until it has at least one task and every task is complete.Memory search reports `lexical-degraded` unless a compatible native RuVector binding passes the startup probe. The pinned `@ruvector/core` 0.1.32 package with its 0.1.30 optional native binding fails that probe in local validation with a dimension mismatch. Do not set `RUFLO_AI_TEAM_VECTOR=native` in production until a compatible binary is verified.diff --git a/plugins/ruflo-ai-team/RELEASE_NOTES.md b/plugins/ruflo-ai-team/RELEASE_NOTES.mdindex 04a8baf0de..bbb2e9c413 100644--- a/plugins/ruflo-ai-team/RELEASE_NOTES.md+++ b/plugins/ruflo-ai-team/RELEASE_NOTES.md@@ -1,3 +1,9 @@+# 0.1.3 — One navigable workspace++- Made the single ChatGPT MCP Apps board a navigable hub for teams, runs, and tasks, with in-card refresh and run selection through the MCP Apps bridge.+- Added tenant-scoped run summaries to the board response. Other MCP tools remain data-only and do not create separate UI surfaces.+- Versioned the UI resource as `ui://ruflo-ai-team/board-v3.html` so a refreshed ChatGPT installation fetches the new component.+# 0.1.2 — Desktop-style team workspace- Reworked the ChatGPT board into a compact ruOS-inspired desktop with window chrome, workspace rail, status indicators, run metrics, task rows, and responsive narrow-width layout.diff --git a/plugins/ruflo-ai-team/deploy/cloud-run.yaml b/plugins/ruflo-ai-team/deploy/cloud-run.yamlindex 8d08b69c8d..ce65d2631d 100644--- a/plugins/ruflo-ai-team/deploy/cloud-run.yaml+++ b/plugins/ruflo-ai-team/deploy/cloud-run.yaml@@ -13,7 +13,7 @@ spec:timeoutSeconds: 60serviceAccountName: ruflo-ai-team@PROJECT_ID.iam.gserviceaccount.comcontainers:- - image: REGION-docker.pkg.dev/PROJECT_ID/ruflo/ruflo-ai-team:0.1.2+ - image: REGION-docker.pkg.dev/PROJECT_ID/ruflo/ruflo-ai-team:0.1.3ports: [{ containerPort: 8080 }]resources:limits: { cpu: "1", memory: 1Gi }diff --git a/plugins/ruflo-ai-team/package-lock.json b/plugins/ruflo-ai-team/package-lock.jsonindex 7ea9cdc2e4..28e5829f04 100644--- a/plugins/ruflo-ai-team/package-lock.json+++ b/plugins/ruflo-ai-team/package-lock.json@@ -1,12 +1,12 @@{"name": "@ruflo/ai-team-service",- "version": "0.1.2",+ "version": "0.1.3","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@ruflo/ai-team-service",- "version": "0.1.2",+ "version": "0.1.3","license": "MIT","dependencies": {"@google-cloud/firestore": "^9.2.0",diff --git a/plugins/ruflo-ai-team/package.json b/plugins/ruflo-ai-team/package.jsonindex 6e79f17ea0..117ad85d8d 100644--- a/plugins/ruflo-ai-team/package.json+++ b/plugins/ruflo-ai-team/package.json@@ -1,6 +1,6 @@{"name": "@ruflo/ai-team-service",- "version": "0.1.2",+ "version": "0.1.3","private": true,"type": "module","description": "Multi-tenant MCP control plane and Claude plugin for coordinated AI teams.",diff --git a/plugins/ruflo-ai-team/src/server.mjs b/plugins/ruflo-ai-team/src/server.mjsindex aab93a9248..ae48e30bf3 100644--- a/plugins/ruflo-ai-team/src/server.mjs+++ b/plugins/ruflo-ai-team/src/server.mjs@@ -11,7 +11,7 @@ import { fenced, scanStoredText } from './untrusted.mjs';import { privacyPage, supportPage, termsPage } from './public-pages.mjs';export const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;-const TEAM_BOARD_URI = 'ui://ruflo-ai-team/board-v2.html';+const TEAM_BOARD_URI = 'ui://ruflo-ai-team/board-v3.html';const TEAM_BOARD_HTML = readFileSync(new URL('../ui/team-board.html', import.meta.url), 'utf8');const MAX_BODY = 512 * 1024;const TOOL_SCOPES = Object.freeze({@@ -58,16 +58,17 @@ export async function createAiTeamService({ store, vectorMemory, verifyToken, pomcp.tool('team_get', 'Reads one AI team owned by the authenticated tenant. Requires team:read. Foreign and missing IDs both return not_found.', { teamId: z.string() }, READ('Get AI team'), scoped(SCOPES.read, async ({ teamId }) => { const value=await store.getTeam(auth.tenantId,teamId); return value?text(value):notFound(); }));mcp.registerTool('team_board', {title: 'Show AI team board',- description: 'Renders a private, read-only ChatGPT board of your teams, or one run and its tasks. Requires team:read. Use after data tools when a visual summary helps. No actions are executed.',+ description: 'Opens one private, read-only ChatGPT workspace for teams, runs, and tasks. Requires team:read. The user can navigate and refresh inside this one widget; avoid calling it repeatedly in the same chat. No actions are executed.',inputSchema: { runId: z.string().optional() },annotations: READ('Show AI team board'),_meta: { ui: { resourceUri: TEAM_BOARD_URI }, 'openai/outputTemplate': TEAM_BOARD_URI },}, scoped(SCOPES.read, async ({ runId }) => {const teams = await store.listTeams(auth.tenantId);+ const runs = await store.listRuns(auth.tenantId);const run = runId ? await store.getRun(auth.tenantId, runId) : null;if (runId && !run) return notFound();const tasks = run ? await store.listTasks(auth.tenantId, runId) : [];- const board = { teams: teams.map(({ id, name, status }) => ({ id, name, status })), run: run && { id: run.id, objective: run.objective, status: run.status, budgetUnits: run.budgetUnits, spentUnits: run.spentUnits }, tasks: tasks.map(({ id, title, status }) => ({ id, title, status })) };+ const board = { teams: teams.map(({ id, name, status }) => ({ id, name, status })), runs: runs.slice(0, 100).map(({ id, teamId, objective, status, budgetUnits, spentUnits }) => ({ id, teamId, objective: objective.slice(0, 160), status, budgetUnits, spentUnits })), run: run && { id: run.id, objective: run.objective, status: run.status, budgetUnits: run.budgetUnits, spentUnits: run.spentUnits }, tasks: tasks.map(({ id, title, status }) => ({ id, title, status })) };return { ...text(board), structuredContent: board };}));mcp.tool('team_update', 'Updates the name, objective, roles, or status of an existing tenant-local team. Requires team:write. It does not run agents or perform external actions.', {diff --git a/plugins/ruflo-ai-team/src/store.mjs b/plugins/ruflo-ai-team/src/store.mjsindex 02e1fc3d5b..616817555f 100644--- a/plugins/ruflo-ai-team/src/store.mjs+++ b/plugins/ruflo-ai-team/src/store.mjs@@ -27,6 +27,7 @@ export class InMemoryStore {bucket.runs.set(id, value); this.#audit(bucket, actor, 'run.created', id); return clone(value);}async getRun(tenantId, id) { const value = this.#bucket(tenantId).runs.get(id); return value ? clone(value) : null; }+ async listRuns(tenantId) { return [...this.#bucket(tenantId).runs.values()].map(clone); }async updateRun(tenantId, id, patch, actor = '-') {const bucket = this.#bucket(tenantId); const current = bucket.runs.get(id); if (!current) return null;const value = { ...current, ...patch, id, updatedAt: now() }; bucket.runs.set(id, value); this.#audit(bucket, actor, `run.${value.status}`, id); return clone(value);@@ -82,6 +83,7 @@ export class FirestoreStore {async updateTeam(t,id,p,a='-') { const c=await this.#get(t,'teams',id); if(!c)return null; const v={...c,...p,id,updatedAt:now()}; await this.#put(t,'teams',v); await this.#audit(t,a,'team.updated',id); return v; }async createRun(t,i,a='-') { if(!await this.#get(t,'teams',i.teamId))return null; const v={id:`run_${randomUUID()}`,teamId:i.teamId,objective:i.objective,budgetUnits:i.budgetUnits,spentUnits:0,status:'planned',createdAt:now(),updatedAt:now()}; await this.#put(t,'runs',v); await this.#audit(t,a,'run.created',v.id); return v; }async getRun(t,id) { return this.#get(t,'runs',id); }+ async listRuns(t) { return this.#list(t,'runs',100); }async updateRun(t,id,p,a='-') { const c=await this.#get(t,'runs',id); if(!c)return null; const v={...c,...p,id,updatedAt:now()}; await this.#put(t,'runs',v); await this.#audit(t,a,`run.${v.status}`,id); return v; }async createTask(t,i,a='-') { const run=await this.#get(t,'runs',i.runId); if(!run||run.status==='complete')return null; const v={id:`task_${randomUUID()}`,runId:i.runId,title:i.title,description:i.description,assigneeRole:i.assigneeRole,status:'open',result:null,createdAt:now(),updatedAt:now()}; await this.#put(t,'tasks',v); await this.#audit(t,a,'task.created',v.id); return v; }async listTasks(t,runId) { const snap=await this.#tenant(t).collection('tasks').where('runId','==',runId).limit(200).get(); return snap.docs.map(d=>d.data()); }diff --git a/plugins/ruflo-ai-team/test/service.node.mjs b/plugins/ruflo-ai-team/test/service.node.mjsindex 652a372e48..b1a31eb6fc 100644--- a/plugins/ruflo-ai-team/test/service.node.mjs+++ b/plugins/ruflo-ai-team/test/service.node.mjs@@ -75,15 +75,17 @@ test('scope checks return HTTP 403 rather than model-level permission errors', atest('board resource is public but contains no tenant data; board tool remains scoped', async (t) => {const f=await fixture(); t.after(()=>f.server.close());- const uri='ui://ruflo-ai-team/board-v2.html';+ const uri='ui://ruflo-ai-team/board-v3.html';const listed=await rpc(f.base,{jsonrpc:'2.0',id:1,method:'tools/list',params:{}});assert.equal(listed.body.result.tools.find(x=>x.name==='team_board')._meta.ui.resourceUri,uri);+ assert.deepEqual(listed.body.result.tools.filter(x=>x._meta?.ui?.resourceUri).map(x=>x.name),['team_board']);const resource=await rpc(f.base,{jsonrpc:'2.0',id:2,method:'resources/read',params:{uri}});assert.equal(resource.status,200);assert.equal(resource.body.result.contents[0].mimeType,'text/html;profile=mcp-app');assert.doesNotMatch(resource.body.result.contents[0].text,/Bearer |tenant_id|api.key/i);assert.equal((await call(f.base,'team_board',{},null)).status,401);- assert.deepEqual((await call(f.base,'team_board',{},'alpha:all')).body.result.structuredContent.teams,[]);+ const board=(await call(f.base,'team_board',{},'alpha:all')).body.result.structuredContent;+ assert.deepEqual(board.teams,[]); assert.deepEqual(board.runs,[]);});test('run completion requires all tasks complete and preserves tenant isolation', async (t) => {@@ -97,6 +99,8 @@ test('run completion requires all tasks complete and preserves tenant isolation'assert.equal(value(await call(f.base,'run_complete',{runId:run.id},'beta:all')).error,'not_found');assert.equal(value(await call(f.base,'run_complete',{runId:run.id},'alpha:all')).status,'complete');assert.equal(value(await call(f.base,'run_complete',{runId:run.id},'alpha:all')).status,'complete');+ assert.equal((await call(f.base,'team_board',{},'alpha:all')).body.result.structuredContent.runs[0].id,run.id);+ assert.deepEqual((await call(f.base,'team_board',{},'beta:all')).body.result.structuredContent.runs,[]);assert.equal(value(await call(f.base,'task_create',{runId:run.id,title:'Late',description:'No',assigneeRole:'verifier'},'alpha:all')).error,'not_found');assert.equal(value(await call(f.base,'task_update',{taskId:task.id,status:'open'},'alpha:all')).error,'not_found');assert.equal(value(await call(f.base,'team_board',{runId:run.id},'alpha:all')).run.status,'complete');diff --git a/plugins/ruflo-ai-team/ui/team-board.html b/plugins/ruflo-ai-team/ui/team-board.htmlindex 2e6585b2a7..924be4d7d0 100644--- a/plugins/ruflo-ai-team/ui/team-board.html+++ b/plugins/ruflo-ai-team/ui/team-board.html@@ -14,15 +14,15 @@.connection{white-space:nowrap;font-size:11px;color:#b7edcf}.connection::before{content:"";display:inline-block;width:7px;height:7px;margin-right:7px;border-radius:50%;background:#48e9a2;box-shadow:0 0 10px #48e9a2}.workspace{display:grid;grid-template-columns:75px minmax(0,1fr);min-height:325px;background-image:radial-gradient(#91dce111 1px,transparent 1px);background-size:18px 18px}.rail{display:flex;flex-direction:column;align-items:center;gap:14px;padding:18px 6px;background:#081317d9;border-right:1px solid var(--line)}- .rail-item{display:grid;justify-items:center;gap:5px;color:var(--muted);font-size:10px;text-align:center}.rail-icon{display:grid;place-items:center;width:38px;height:38px;border:1px solid #315158;border-radius:12px;background:#13262a;color:var(--aqua);font:700 17px var(--font)}.rail-item.active .rail-icon{border-color:var(--aqua);box-shadow:0 0 16px #26e9d52a;background:#173337}+ .rail-item{display:grid;justify-items:center;gap:5px;padding:0;border:0;background:none;color:var(--muted);font:10px var(--font);text-align:center;cursor:pointer}.rail-icon{display:grid;place-items:center;width:38px;height:38px;border:1px solid #315158;border-radius:12px;background:#13262a;color:var(--aqua);font:700 17px var(--font)}.rail-item[aria-pressed="true"] .rail-icon{border-color:var(--aqua);box-shadow:0 0 16px #26e9d52a;background:#173337}.rail-item:focus-visible,.row-button:focus-visible,.refresh:focus-visible{outline:2px solid var(--aqua);outline-offset:3px}.window{align-self:start;min-width:0;margin:15px;border:1px solid #33545a;border-radius:13px;overflow:hidden;background:#0b171ddf;box-shadow:0 16px 28px #0007}- .windowbar{display:flex;align-items:center;gap:9px;min-height:34px;padding:7px 11px;border-bottom:1px solid var(--line);background:linear-gradient(90deg,#142a2f,#18232b)}+ .windowbar{display:flex;align-items:center;gap:9px;min-height:34px;padding:7px 11px;border-bottom:1px solid var(--line);background:linear-gradient(90deg,#142a2f,#18232b)}.refresh{margin-left:auto;padding:3px 7px;border:1px solid #315158;border-radius:6px;background:#102429;color:var(--aqua);font:10px ui-monospace,monospace;cursor:pointer}.refresh:disabled{opacity:.55;cursor:wait}.lights{display:flex;gap:5px}.lights i{display:block;width:7px;height:7px;border-radius:50%;background:#ff567c}.lights i:nth-child(2){background:#ffd16b}.lights i:nth-child(3){background:#43dfa2}.windowbar strong{font-size:11px;font-weight:650;letter-spacing:.04em}.windowbar span{margin-left:auto;color:var(--muted);font:10px ui-monospace,monospace}.content{padding:14px}.eyebrow{margin:0 0 3px;color:var(--aqua);font:10px ui-monospace,monospace;letter-spacing:.14em;text-transform:uppercase}.heading{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:12px}.heading h1{margin:0;font-size:19px;line-height:1.15}.heading p{margin:5px 0 0;color:var(--muted);font-size:11px;overflow-wrap:anywhere}.status{flex:none;display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border:1px solid #3d6b70;border-radius:20px;color:#9bf5e5;font:10px ui-monospace,monospace;text-transform:uppercase}.status[hidden]{display:none}.status::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--aqua)}.status[data-state="complete"]{color:#abf0ca;border-color:#386753}.status[data-state="complete"]::before{background:#4de59a}.status[data-state="blocked"]{color:#ffd17b;border-color:#786038}.status[data-state="blocked"]::before{background:#ffd17b}.metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0 0 15px}.metric{min-width:0;padding:10px;border:1px solid #24434a;border-radius:10px;background:linear-gradient(150deg,#122b30,#101e25)}.metric small{display:block;color:var(--muted);font-size:10px}.metric strong{display:block;margin-top:3px;font:700 18px ui-monospace,monospace;white-space:nowrap}.metric:nth-child(2) strong{color:var(--aqua)}.section-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.section-head h2{margin:0;color:#b9e6e2;font-size:11px;letter-spacing:.12em;text-transform:uppercase}.section-head span{color:var(--muted);font:10px ui-monospace,monospace}- .rows{display:grid;gap:7px}.row{display:flex;align-items:center;gap:9px;min-width:0;padding:9px 10px;border:1px solid #25444a;border-radius:9px;background:#11242a}.glyph{display:grid;place-items:center;flex:none;width:27px;height:27px;border-radius:8px;background:#1b3940;color:var(--aqua);font-weight:700}.row-copy{min-width:0;flex:1}.row-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:600}.row-copy small{display:block;color:var(--muted);font-size:10px;text-transform:uppercase}.row .state{color:var(--aqua);font:10px ui-monospace,monospace;text-transform:uppercase;white-space:nowrap}.row .state[data-state="complete"]{color:#73e4a3}.row .state[data-state="blocked"]{color:#ffd17b}+ .rows{display:grid;gap:7px}.row{display:flex;align-items:center;gap:9px;min-width:0;width:100%;padding:9px 10px;border:1px solid #25444a;border-radius:9px;background:#11242a;color:var(--ink);text-align:left;font:inherit}.row-button{cursor:pointer}.row-button:hover{border-color:var(--aqua);background:#173137}.glyph{display:grid;place-items:center;flex:none;width:27px;height:27px;border-radius:8px;background:#1b3940;color:var(--aqua);font-weight:700}.row-copy{min-width:0;flex:1}.row-copy strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:600}.row-copy small{display:block;color:var(--muted);font-size:10px;text-transform:uppercase}.row .state{color:var(--aqua);font:10px ui-monospace,monospace;text-transform:uppercase;white-space:nowrap}.row .state[data-state="complete"]{color:#73e4a3}.row .state[data-state="blocked"]{color:#ffd17b}.empty{padding:16px;border:1px dashed #315158;border-radius:9px;color:var(--muted);text-align:center}.footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 12px;border-top:1px solid var(--line);background:#081317;color:var(--muted);font:10px ui-monospace,monospace}.footer b{color:var(--aqua);font-weight:500}@media(max-width:490px){.workspace{grid-template-columns:48px minmax(0,1fr)}.rail{gap:10px;padding:12px 4px}.rail-icon{width:32px;height:32px;font-size:14px}.rail-item{font-size:0}.window{margin:9px}.content{padding:11px}.metrics{gap:5px}.metric{padding:8px}.metric strong{font-size:15px}.heading h1{font-size:16px}.connection{font-size:0}.connection::before{margin:0}}</style>@@ -31,8 +31,8 @@<div class="desktop" aria-label="RuFlo AI Team workspace"><header class="topbar"><div class="mark" aria-hidden="true">r</div><div class="brand"><strong>RuFlo AI Team</strong><small>Private coordination workspace</small></div><span class="connection">Tenant-scoped</span></header><div class="workspace">- <aside class="rail" aria-label="Workspace sections"><div class="rail-item active"><span class="rail-icon" aria-hidden="true">◈</span><span>Teams</span></div><div class="rail-item"><span class="rail-icon" aria-hidden="true">≡</span><span>Tasks</span></div><div class="rail-item"><span class="rail-icon" aria-hidden="true">◉</span><span>Evidence</span></div></aside>- <main class="window"><div class="windowbar"><div class="lights" aria-hidden="true"><i></i><i></i><i></i></div><strong>TEAM CONTROL</strong><span>READ ONLY</span></div>+ <aside class="rail" aria-label="Workspace sections"><button class="rail-item" type="button" data-view="teams" aria-pressed="true"><span class="rail-icon" aria-hidden="true">◈</span><span>Teams</span></button><button class="rail-item" type="button" data-view="runs" aria-pressed="false"><span class="rail-icon" aria-hidden="true">≡</span><span>Runs</span></button><button class="rail-item" type="button" data-view="tasks" aria-pressed="false"><span class="rail-icon" aria-hidden="true">✓</span><span>Tasks</span></button></aside>+ <main class="window"><div class="windowbar"><div class="lights" aria-hidden="true"><i></i><i></i><i></i></div><strong>TEAM CONTROL</strong><button id="refresh" class="refresh" type="button" aria-label="Refresh workspace in this card">↻ Refresh</button><span>READ ONLY</span></div><div class="content"><p class="eyebrow">Workspace overview</p><div class="heading"><div><h1 id="title">Your teams</h1><p id="subtitle">Live coordination records from your account</p></div><span id="run-status" class="status" hidden></span></div><div id="metrics" class="metrics"></div><div class="section-head"><h2 id="list-heading">Teams</h2><span id="list-count"></span></div><div id="rows" class="rows" aria-live="polite"><div class="empty">Loading team status…</div></div></div>@@ -43,24 +43,37 @@<script type="module">const byId=(id)=>document.getElementById(id);const element=(tag,value,className)=>{const node=document.createElement(tag);node.textContent=String(value??'');if(className)node.className=className;return node};- function render(data){- if(!data||typeof data!=='object')return;- const teams=Array.isArray(data.teams)?data.teams:[];- const tasks=Array.isArray(data.tasks)?data.tasks:[];- const run=data.run;- byId('title').textContent=run?'Run workspace':'Your teams';- byId('subtitle').textContent=run?run.objective:'Live coordination records from your account';- const status=byId('run-status');status.hidden=!run;+ let workspace={teams:[],runs:[],run:null,tasks:[]};+ let view='teams',selectedTeamId=null,selectedRunId=null;+ function render(){+ const teams=workspace.teams;+ const runs=selectedTeamId?workspace.runs.filter(run=>run.teamId===selectedTeamId):workspace.runs;+ const run=workspace.run;+ const tasks=workspace.tasks;+ for(const button of document.querySelectorAll('[data-view]'))button.setAttribute('aria-pressed',String(button.dataset.view===view));+ byId('title').textContent=view==='teams'?'Your teams':view==='runs'?'Team runs':'Run tasks';+ byId('subtitle').textContent=view==='tasks'?(run?.objective??'Choose a run to see its tasks.'):view==='runs'?(selectedTeamId?'Runs for the selected team':'Private, budgeted coordination runs'):'Live coordination records from your account';+ const status=byId('run-status');status.hidden=view!=='tasks'||!run;if(run){status.textContent=run.status??'unknown';status.dataset.state=run.status??'';}const metrics=byId('metrics');metrics.replaceChildren();- const values=run?[['Tasks',tasks.length],['Complete',tasks.filter(task=>task.status==='complete').length],['Units',`${run.spentUnits??0} / ${run.budgetUnits??0}`]]:[['Teams',teams.length],['Active',teams.filter(team=>team.status==='active').length],['Complete',teams.filter(team=>team.status==='complete').length]];+ const values=view==='tasks'?[['Tasks',tasks.length],['Complete',tasks.filter(task=>task.status==='complete').length],['Units',`${run?.spentUnits??0} / ${run?.budgetUnits??0}`]]:view==='runs'?[['Runs',runs.length],['Complete',runs.filter(item=>item.status==='complete').length],['Planned',runs.filter(item=>item.status==='planned').length]]:[['Teams',teams.length],['Active',teams.filter(team=>team.status==='active').length],['Complete',teams.filter(team=>team.status==='complete').length]];for(const [label,value] of values){const card=element('div','', 'metric');card.append(element('small',label),element('strong',value));metrics.append(card);}- const items=run?tasks:teams;byId('list-heading').textContent=run?'Run tasks':'Teams';byId('list-count').textContent=`${items.length} ${items.length===1?'item':'items'}`;+ const items=view==='teams'?teams:view==='runs'?runs:tasks;+ byId('list-heading').textContent=view==='teams'?'Teams':view==='runs'?'Runs':'Tasks';byId('list-count').textContent=`${items.length} ${items.length===1?'item':'items'}`;const rows=byId('rows');rows.replaceChildren();- if(!items.length){rows.append(element('div',run?'No tasks recorded for this run.':'No teams yet. Ask ChatGPT to create one.','empty'));return;}- for(const item of items){const row=element('div','', 'row');const copy=element('div','', 'row-copy');copy.append(element('strong',run?item.title:item.name),element('small',run?'Task':'AI team'));const state=element('span',item.status??'unknown','state');state.dataset.state=item.status??'';row.append(element('span',run?(item.status==='complete'?'✓':'•'):'◈','glyph'),copy,state);rows.append(row);}+ if(!items.length){rows.append(element('div',view==='teams'?'No teams yet. Ask ChatGPT to create one.':view==='runs'?'No runs for this team yet.':run?'No tasks recorded for this run.':'Select a run to see tasks.','empty'));return;}+ for(const item of items){+ const clickable=view!=='tasks';const row=element(clickable?'button':'div','',clickable?'row row-button':'row');+ if(clickable)row.type='button';+ const copy=element('div','', 'row-copy');copy.append(element('strong',view==='teams'?item.name:view==='runs'?item.objective:item.title),element('small',view==='teams'?'AI team':view==='runs'?'Coordination run':'Task'));+ const state=element('span',item.status??'unknown','state');state.dataset.state=item.status??'';+ row.append(element('span',item.status==='complete'?'✓':view==='teams'?'◈':'•','glyph'),copy,state);+ if(view==='teams')row.addEventListener('click',()=>{selectedTeamId=item.id;view='runs';render();});+ if(view==='runs')row.addEventListener('click',()=>loadRun(item.id));+ rows.append(row);+ }}- function update(result){const data=result?.structuredContent??result;if(data?.teams)render(data);}+ function update(result){const data=result?.structuredContent??result;if(!Array.isArray(data?.teams)||!Array.isArray(data?.runs))return;workspace={teams:data.teams,runs:data.runs,run:data.run??null,tasks:Array.isArray(data.tasks)?data.tasks:[]};if(data.run){if(!selectedRunId)view='tasks';selectedRunId=data.run.id;}render();}let id=0;const pending=new Map();window.addEventListener('message',event=>{if(event.source!==window.parent||event.data?.jsonrpc!=='2.0')return;@@ -69,9 +82,23 @@if(msg.method==='ui/notifications/tool-result')update(msg.params);});const request=(method,params)=>new Promise((resolve,reject)=>{const next=++id;pending.set(next,{resolve,reject});window.parent.postMessage({jsonrpc:'2.0',id:next,method,params},'*')});- request('ui/initialize',{appInfo:{name:'ruflo-ai-team-board',version:'1.0.2'},appCapabilities:{},protocolVersion:'2026-01-26'})+ const bridgeReady=request('ui/initialize',{appInfo:{name:'ruflo-ai-team-board',version:'1.0.3'},appCapabilities:{},protocolVersion:'2026-01-26'}).then(()=>window.parent.postMessage({jsonrpc:'2.0',method:'ui/notifications/initialized',params:{}},'*')).catch(()=>{byId('rows').textContent='The ChatGPT view could not initialize. Team tools remain available in chat.'});+ async function refresh(runId=selectedRunId){+ const button=byId('refresh');button.disabled=true;+ try{await bridgeReady;const result=await request('tools/call',{name:'team_board',arguments:runId?{runId}:{}});update(result);}+ catch{byId('rows').textContent='Could not refresh this workspace. Ask ChatGPT to check the connection.';}+ finally{button.disabled=false;}+ }+ async function loadRun(runId){selectedRunId=runId;workspace.run=null;workspace.tasks=[];view='tasks';render();await refresh(runId);}+ document.querySelector('.rail').addEventListener('click',event=>{+ const button=event.target.closest('[data-view]');if(!button)return;+ view=button.dataset.view;+ if(view==='tasks'&&!workspace.run&&workspace.runs.length){loadRun(workspace.runs[0].id);return;}+ render();+ });+ byId('refresh').addEventListener('click',()=>refresh());if(window.openai?.toolOutput)update(window.openai.toolOutput);</script></body>