🌊 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): add ChatGPT team board and run completion (#3545)
rUvda315a834c96
diff --git a/plugins/ruflo-ai-team/.claude-plugin/plugin.json b/plugins/ruflo-ai-team/.claude-plugin/plugin.jsonindex 5090d4afee..aa3eeeb252 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.0",+ "version": "0.1.1","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/Dockerfile b/plugins/ruflo-ai-team/Dockerfileindex e2bd001f30..d4eb079721 100644--- a/plugins/ruflo-ai-team/Dockerfile+++ b/plugins/ruflo-ai-team/Dockerfile@@ -3,6 +3,7 @@ WORKDIR /appCOPY package.json package-lock.json ./RUN npm ci --omit=dev --no-audit --no-fundCOPY src ./src+COPY ui ./uiENV PORT=8080 NODE_ENV=production RUFLO_AI_TEAM_STORE=firestoreEXPOSE 8080USER nodediff --git a/plugins/ruflo-ai-team/README.md b/plugins/ruflo-ai-team/README.mdindex b9f9ccf426..08fb51f0fe 100644--- a/plugins/ruflo-ai-team/README.md+++ b/plugins/ruflo-ai-team/README.md@@ -11,7 +11,11 @@ The public v0.1 surface coordinates work; it does not silently send messages, de- Firestore is canonical storage; an in-memory store is used for tests and local development.- The default vector backend is the bounded, tenant-scoped `lexical-degraded` fallback. Set `RUFLO_AI_TEAM_VECTOR=native` only after the exact `@ruvector/core` binary passes the startup self-test; an unavailable or incompatible binding falls back explicitly and never claims semantic search.- Stored task, memory, and evidence content is provenance-labelled and nonce-fenced as untrusted data.-- Twelve focused tools, two prompts, and one public template resource.+- Fourteen focused tools, two prompts, a template resource, and a ChatGPT MCP Apps board.++The read-only `team_board` tool renders a ruOS-inspired, tenant-scoped team/run card in ChatGPT. Its public HTML resource contains no tenant data; the tool requires `team:read`. `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.## Local verificationdiff --git a/plugins/ruflo-ai-team/RELEASE_NOTES.md b/plugins/ruflo-ai-team/RELEASE_NOTES.mdindex 91e1acd312..adabd167c3 100644--- a/plugins/ruflo-ai-team/RELEASE_NOTES.md+++ b/plugins/ruflo-ai-team/RELEASE_NOTES.md@@ -1,3 +1,9 @@+# 0.1.1 — ChatGPT team board and run completion++- Added a read-only ChatGPT team board with ruOS-inspired styling through an MCP Apps HTML resource. Tenant data is returned only by the OAuth-scoped `team_board` tool.+- Added `run_complete`, guarded by `team:run` and completion of all tasks, so evidence exports can show a completed run.+- Kept the RuVector fallback explicit while the pinned native binding fails its dimension self-test; native search is not claimed as verified.+# 0.1.0 — Initial review candidate- New multi-tenant RuFlo AI Team MCP service, separate from RuFlo Federation.diff --git a/plugins/ruflo-ai-team/deploy/cloud-run.yaml b/plugins/ruflo-ai-team/deploy/cloud-run.yamlindex c94d99c1ca..a5c1621ae5 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.0+ - image: REGION-docker.pkg.dev/PROJECT_ID/ruflo/ruflo-ai-team:0.1.1ports: [{ 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 93c6c2d1d9..18acf49ea2 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.0",+ "version": "0.1.1","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@ruflo/ai-team-service",- "version": "0.1.0",+ "version": "0.1.1","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 ff92e32c37..b5f67bbfec 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.0",+ "version": "0.1.1","private": true,"type": "module","description": "Multi-tenant MCP control plane and Claude plugin for coordinated AI teams.",diff --git a/plugins/ruflo-ai-team/scripts/smoke.mjs b/plugins/ruflo-ai-team/scripts/smoke.mjsindex cddf2014fa..6f1acdd2e7 100644--- a/plugins/ruflo-ai-team/scripts/smoke.mjs+++ b/plugins/ruflo-ai-team/scripts/smoke.mjs@@ -13,6 +13,6 @@ check('six skills',readdirSync(new URL('skills/',root),{withFileTypes:true}).filcheck('four agents',readdirSync(new URL('agents/',root)).filter((name)=>name.endsWith('.md')).length===4);check('four commands',readdirSync(new URL('commands/',root)).filter((name)=>name.endsWith('.md')).length===4);const server=read('src/server.mjs');-check('twelve MCP tools',(server.match(/mcp\.tool\('/g)||[]).length===12);+check('fourteen MCP tools',(server.match(/mcp\.tool\('/g)||[]).length+(server.match(/mcp\.registerTool\('/g)||[]).length===14);check('explicit annotation factories',server.includes('readOnlyHint: true')&&server.includes('readOnlyHint: false')&&server.includes('destructiveHint: false')&&server.includes('idempotentHint:')&&server.includes('openWorldHint: false'));console.log(`smoke ok: ${checks.length} checks`);diff --git a/plugins/ruflo-ai-team/src/server.mjs b/plugins/ruflo-ai-team/src/server.mjsindex eede5aa37f..86fb1e48b4 100644--- a/plugins/ruflo-ai-team/src/server.mjs+++ b/plugins/ruflo-ai-team/src/server.mjs@@ -11,9 +11,11 @@ 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-v1.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({- team_templates_list: SCOPES.read, team_list: SCOPES.read, team_get: SCOPES.read,+ team_templates_list: SCOPES.read, team_list: SCOPES.read, team_get: SCOPES.read, team_board: SCOPES.read,task_list: SCOPES.read, memory_search: SCOPES.read, evidence_export: SCOPES.read,team_create: SCOPES.write, team_update: SCOPES.write, run_create: SCOPES.run,task_create: SCOPES.write, task_update: SCOPES.write, memory_remember: SCOPES.write,@@ -54,12 +56,34 @@ export async function createAiTeamService({ store, vectorMemory, verifyToken, po}));mcp.tool('team_list', 'Lists AI teams owned by the authenticated tenant. Requires team:read. Returns no other tenant data.', {}, READ('List AI teams'), scoped(SCOPES.read, async () => text({ teams: await store.listTeams(auth.tenantId) })));mcp.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.',+ 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 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 })) };+ 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.', {teamId:z.string(), name:z.string().min(1).max(100).optional(), objective:z.string().min(1).max(5000).optional(), roles:z.array(z.string().min(1).max(60)).max(8).optional(), status:z.enum(['active','paused','complete']).optional(),}, WRITE('Update AI team', true), scoped(SCOPES.write, async ({teamId,...patch}) => { const value=await store.updateTeam(auth.tenantId,teamId,patch,auth.subjectHash); return value?text(value):notFound(); }));mcp.tool('run_create', 'Creates a budgeted coordination run for an existing team. Requires team:run. This records the run but does not contact external systems or spend provider credits.', {teamId:z.string(), objective:z.string().min(1).max(5000), budgetUnits:z.number().int().min(1).max(100).default(25),}, WRITE('Create team run'), scoped(SCOPES.run, async (a) => { const value=await store.createRun(auth.tenantId,a,auth.subjectHash); return value?text(value):notFound(); }));+ mcp.tool('run_complete', 'Marks a tenant-local coordination run complete only when it has at least one task and every task is complete. Requires team:run. Does not execute agents or external actions.', { runId: z.string() }, WRITE('Complete team run', true), scoped(SCOPES.run, async ({ runId }) => {+ const run = await store.getRun(auth.tenantId, runId);+ if (!run) return notFound();+ if (run.status === 'complete') return text(run);+ const tasks = await store.listTasks(auth.tenantId, runId);+ if (!tasks.length || tasks.some((task) => task.status !== 'complete')) return text({ error: 'tasks_incomplete' });+ return text(await store.updateRun(auth.tenantId, runId, { status: 'complete' }, auth.subjectHash));+ }));mcp.tool('task_create', 'Adds a bounded task to a tenant-local run. Requires team:write. It records coordination state only and does not execute the task.', {runId:z.string(), title:z.string().min(1).max(160), description:z.string().min(1).max(8000), assigneeRole:z.string().min(1).max(60),}, WRITE('Create team task'), scoped(SCOPES.write, async (a) => { const value=await store.createTask(auth.tenantId,a,auth.subjectHash); return value?text(value):notFound(); }));@@ -76,6 +100,7 @@ export async function createAiTeamService({ store, vectorMemory, verifyToken, pomcp.tool('evidence_export', 'Builds a read-only evidence bundle for one tenant-local run, including team metadata, tasks, and privacy-minimized audit events. Requires team:read. It does not publish or share the bundle.', {runId:z.string()}, READ('Export run evidence'), scoped(SCOPES.read, async ({runId}) => { const value=await store.evidence(auth.tenantId,runId); return value?text(fenced(value,'tenant run evidence')):notFound(); }));mcp.resource('team-templates','ruv://team/templates',async()=>({contents:[{uri:'ruv://team/templates',mimeType:'application/json',text:JSON.stringify(TEAM_TEMPLATES)}]}));+ mcp.registerResource('team-board', TEAM_BOARD_URI, { mimeType: 'text/html;profile=mcp-app' }, async () => ({ contents: [{ uri: TEAM_BOARD_URI, mimeType: 'text/html;profile=mcp-app', text: TEAM_BOARD_HTML, _meta: { ui: { prefersBorder: true, csp: { connectDomains: [], resourceDomains: [] } } } }] }));mcp.prompt('plan-ai-team','Plan an AI team without starting work',{goal:z.string(),templateId:z.string().optional()},async({goal,templateId})=>({messages:[{role:'user',content:{type:'text',text:`Plan a bounded AI team for this goal: ${goal}\nPreferred template: ${templateId||'choose the safest fit'}. Show roles, tasks, budget, risks, and acceptance criteria. Do not start a run.`}}]}));mcp.prompt('review-team-result','Review a run using evidence rather than agent assertions',{runId:z.string()},async({runId})=>({messages:[{role:'user',content:{type:'text',text:`Review RuFlo AI Team run ${runId}. Retrieve its evidence bundle, distinguish verified evidence from stored assertions, report uncertainty, budget use, and unresolved work.`}}]}));return mcp;@@ -95,12 +120,13 @@ export async function createAiTeamService({ store, vectorMemory, verifyToken, poif(url.pathname!=='/mcp'||req.method!=='POST')return res.writeHead(404).end('not found');let parsed; try{parsed=JSON.parse(await readBody(req)||'{}');}catch{return res.writeHead(400,{'content-type':'application/json'}).end('{"error":"invalid_request"}');}const called=parsed?.method==='tools/call'?parsed?.params?.name:null;- const needsAuth=called||parsed?.method==='resources/read';+ const publicUiRead=parsed?.method==='resources/read'&&parsed?.params?.uri===TEAM_BOARD_URI;+ const needsAuth=called||(parsed?.method==='resources/read'&&!publicUiRead);// Discovery is public even when a client sends an expired or legacy-audience// bearer. Never downgrade a protected call or an unknown method.const publicDiscovery=new Set(['initialize','ping','tools/list','resources/list','prompts/list']);let auth=await authenticate(req,authConfig,verifyToken);- if(auth.mode==='denied'&&publicDiscovery.has(parsed?.method))auth={mode:'anonymous',scopes:[]};+ if(auth.mode==='denied'&&(publicDiscovery.has(parsed?.method)||publicUiRead))auth={mode:'anonymous',scopes:[]};if(auth.mode==='denied')return res.writeHead(401,{'content-type':'application/json','www-authenticate':challengeHeader(metadataUrl,{error:auth.error,description:auth.description,scope:SCOPES.read})}).end(JSON.stringify({error:auth.error,error_description:auth.description}));if(needsAuth&&auth.mode!=='oauth'){const scope=called?TOOL_SCOPES[called]:SCOPES.read;return res.writeHead(401,{'content-type':'application/json','www-authenticate':challengeHeader(metadataUrl,{error:'invalid_token',description:'OAuth authorization is required for tenant data',scope})}).end(JSON.stringify({error:'invalid_token'}));}if(called&&TOOL_SCOPES[called]&&!hasScope(auth,TOOL_SCOPES[called]))return res.writeHead(403,{'content-type':'application/json','www-authenticate':challengeHeader(metadataUrl,{error:'insufficient_scope',description:`${TOOL_SCOPES[called]} is required`,scope:TOOL_SCOPES[called]})}).end(JSON.stringify({error:'insufficient_scope'}));diff --git a/plugins/ruflo-ai-team/src/store.mjs b/plugins/ruflo-ai-team/src/store.mjsindex 046add0676..02e1fc3d5b 100644--- a/plugins/ruflo-ai-team/src/store.mjs+++ b/plugins/ruflo-ai-team/src/store.mjs@@ -32,13 +32,13 @@ export class InMemoryStore {const value = { ...current, ...patch, id, updatedAt: now() }; bucket.runs.set(id, value); this.#audit(bucket, actor, `run.${value.status}`, id); return clone(value);}async createTask(tenantId, input, actor = '-') {- const bucket = this.#bucket(tenantId); const run = bucket.runs.get(input.runId); if (!run) return null;+ const bucket = this.#bucket(tenantId); const run = bucket.runs.get(input.runId); if (!run || run.status === 'complete') return null;const id = `task_${randomUUID()}`; const value = { id, runId: input.runId, title: input.title, description: input.description, assigneeRole: input.assigneeRole, status: 'open', result: null, createdAt: now(), updatedAt: now() };bucket.tasks.set(id, value); this.#audit(bucket, actor, 'task.created', id); return clone(value);}async listTasks(tenantId, runId) { return [...this.#bucket(tenantId).tasks.values()].filter((x) => x.runId === runId).map(clone); }async updateTask(tenantId, id, patch, actor = '-') {- const bucket = this.#bucket(tenantId); const current = bucket.tasks.get(id); if (!current) return null;+ const bucket = this.#bucket(tenantId); const current = bucket.tasks.get(id); if (!current || bucket.runs.get(current.runId)?.status === 'complete') return null;const value = { ...current, ...patch, id, updatedAt: now() }; bucket.tasks.set(id, value); this.#audit(bucket, actor, 'task.updated', id); return clone(value);}async remember(tenantId, input, actor = '-') {@@ -83,9 +83,9 @@ export class FirestoreStore {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 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='-') { if(!await this.#get(t,'runs',i.runId))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 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()); }- async updateTask(t,id,p,a='-') { const c=await this.#get(t,'tasks',id); if(!c)return null; const v={...c,...p,id,updatedAt:now()}; await this.#put(t,'tasks',v); await this.#audit(t,a,'task.updated',id); return v; }+ async updateTask(t,id,p,a='-') { const c=await this.#get(t,'tasks',id); if(!c||(await this.#get(t,'runs',c.runId))?.status==='complete')return null; const v={...c,...p,id,updatedAt:now()}; await this.#put(t,'tasks',v); await this.#audit(t,a,'task.updated',id); return v; }async remember(t,i,a='-') { const timestamp=now(); const v={id:i.key||`mem_${randomUUID()}`,teamId:i.teamId,runId:i.runId||null,text:i.text,tags:i.tags||[],provenance:i.provenance||'user',actorHash:a,contentHash:createHash('sha256').update(i.text).digest('hex'),safetyStatus:i.safetyStatus||'accepted',embeddingModel:'feature-hash-256',embeddingVersion:'1',createdAt:timestamp,updatedAt:timestamp}; await this.#put(t,'memories',v); await this.#audit(t,a,'memory.remembered',v.id); return v; }async listMemories(t,{teamId}={}) { let query=this.#tenant(t).collection('memories'); if(teamId)query=query.where('teamId','==',teamId); const snap=await query.limit(1000).get(); return snap.docs.map(d=>d.data()); }async usage(t) { const [teams,runs,tasks,memories]=await Promise.all(['teams','runs','tasks','memories'].map(k=>this.#list(t,k))); return {teams:teams.length,runs:runs.length,tasks:tasks.length,memories:memories.length,limits:{teams:1,agentsPerTeam:3,monthlyTasks:100,runBudgetUnits:100}}; }diff --git a/plugins/ruflo-ai-team/test/service.node.mjs b/plugins/ruflo-ai-team/test/service.node.mjsindex 92e291554a..57bb7a9db9 100644--- a/plugins/ruflo-ai-team/test/service.node.mjs+++ b/plugins/ruflo-ai-team/test/service.node.mjs@@ -40,7 +40,7 @@ test('health, OAuth metadata, and legal pages are public', async (t) => {test('tools/list is open but tenant calls challenge with RFC 9728 metadata', async (t) => {const f=await fixture(); t.after(()=>f.server.close());const listed=await rpc(f.base,{jsonrpc:'2.0',id:1,method:'tools/list',params:{}});- assert.equal(listed.status,200); assert.equal(listed.body.result.tools.length,12);+ assert.equal(listed.status,200); assert.equal(listed.body.result.tools.length,14);const deniedCall=await call(f.base,'team_list',{},null);assert.equal(deniedCall.status,401); assert.match(deniedCall.wwwAuth,/oauth-protected-resource\/mcp/); assert.match(deniedCall.wwwAuth,/team:read/);});@@ -49,7 +49,7 @@ test('legacy client-audience bearer tokens cannot access or mask discovery', asyconst f=await fixture(); t.after(()=>f.server.close());const listed=await rpc(f.base,{jsonrpc:'2.0',id:1,method:'tools/list',params:{}},'legacy:all');assert.equal(listed.status,200);- assert.equal(listed.body.result.tools.length,12);+ assert.equal(listed.body.result.tools.length,14);const deniedCall=await call(f.base,'team_list',{},'legacy:all');assert.equal(deniedCall.status,401);assert.match(deniedCall.wwwAuth,/invalid_token/);@@ -59,7 +59,7 @@ test('every tool has explicit annotations and no secret-bearing input field', asconst f=await fixture(); t.after(()=>f.server.close());const listed=await rpc(f.base,{jsonrpc:'2.0',id:1,method:'tools/list',params:{}});const names=listed.body.result.tools.map(x=>x.name).sort();- assert.deepEqual(names,['evidence_export','memory_remember','memory_search','run_create','task_create','task_list','task_update','team_create','team_get','team_list','team_templates_list','team_update']);+ assert.deepEqual(names,['evidence_export','memory_remember','memory_search','run_complete','run_create','task_create','task_list','task_update','team_board','team_create','team_get','team_list','team_templates_list','team_update']);for(const tool of listed.body.result.tools){assert.ok(tool.annotations?.title);for(const hint of ['readOnlyHint','destructiveHint','idempotentHint','openWorldHint'])assert.equal(typeof tool.annotations[hint],'boolean',`${tool.name}.${hint}`);@@ -73,6 +73,35 @@ test('scope checks return HTTP 403 rather than model-level permission errors', aassert.equal(response.status,403); assert.match(response.wwwAuth,/insufficient_scope/); assert.match(response.wwwAuth,/team:write/);});+test('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-v1.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);+ 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,[]);+});++test('run completion requires all tasks complete and preserves tenant isolation', async (t) => {+ const f=await fixture(); t.after(()=>f.server.close());+ const team=value(await call(f.base,'team_create',{name:'A',objective:'test'},'alpha:all'));+ const run=value(await call(f.base,'run_create',{teamId:team.id,objective:'finish',budgetUnits:5},'alpha:all'));+ assert.equal(value(await call(f.base,'run_complete',{runId:run.id},'alpha:all')).error,'tasks_incomplete');+ const task=value(await call(f.base,'task_create',{runId:run.id,title:'Verify',description:'Complete fixture',assigneeRole:'verifier'},'alpha:all'));+ assert.equal(value(await call(f.base,'run_complete',{runId:run.id},'alpha:all')).error,'tasks_incomplete');+ await call(f.base,'task_update',{taskId:task.id,status:'complete'},'alpha:all');+ 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(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');+});+test('tenant isolation hides foreign team and run identifiers', async (t) => {const f=await fixture(); t.after(()=>f.server.close());const created=value(await call(f.base,'team_create',{name:'Alpha',objective:'Private alpha objective'},'alpha:all'));diff --git a/plugins/ruflo-ai-team/ui/team-board.html b/plugins/ruflo-ai-team/ui/team-board.htmlnew file mode 100644index 0000000000..8d9c36b6af--- /dev/null+++ b/plugins/ruflo-ai-team/ui/team-board.html@@ -0,0 +1,56 @@+<!doctype html>+<html lang="en">+<head>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width,initial-scale=1">+ <title>RuFlo AI Team</title>+ <style>+ :root{color-scheme:dark;--ink:#eafcff;--muted:#91a8ad;--aqua:#26e9d5;--pink:#ff3b91;--panel:#0a171b}+ *{box-sizing:border-box}body{margin:0;padding:12px;background:#050b0e;color:var(--ink);font:14px/1.4 ui-sans-serif,system-ui,sans-serif}+ main{max-width:720px;margin:auto;border:1px solid #1b3439;border-radius:16px;overflow:hidden;background:var(--panel)}+ header{display:flex;align-items:center;gap:12px;padding:14px;background:linear-gradient(100deg,#0c2023,#11161e 58%,#22101c);border-bottom:1px solid #214048}+ .mark{display:grid;place-items:center;width:34px;height:34px;border-radius:11px;background:radial-gradient(circle at 35% 30%,#67fff2,var(--aqua) 38%,#087f86 72%,#071014);color:#041012;font-weight:900}+ h1{margin:0;font-size:16px}small,.muted{color:var(--muted)}section{padding:14px}h2{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--aqua)}+ .grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.metric,.row{border:1px solid #204048;border-radius:10px;background:#102429;padding:10px}+ .metric strong{display:block;font-size:19px}.row{margin-top:8px}.row strong{display:block;overflow-wrap:anywhere}.pill{display:inline-block;margin-top:5px;color:var(--aqua);font-size:12px}+ ul{list-style:none;margin:0;padding:0}.task{border-top:1px solid #204048;padding:9px 0}.task:first-child{border-top:0}+ @media(max-width:480px){.grid{grid-template-columns:1fr 1fr}}+ </style>+</head>+<body>+<main aria-label="RuFlo AI Team board">+ <header><span class="mark" aria-hidden="true">r</span><div><h1>RuFlo AI Team</h1><small>Private coordination board</small></div></header>+ <section><div id="summary" class="grid"></div><div id="details" aria-live="polite" class="muted">Loading team status…</div></section>+</main>+<script type="module">+ const summary=document.querySelector('#summary'),details=document.querySelector('#details');+ const node=(tag,value,className)=>{const el=document.createElement(tag);el.textContent=String(value??'');if(className)el.className=className;return el};+ function render(data){+ if(!data||typeof data!=='object')return;+ summary.replaceChildren();details.replaceChildren();+ for(const [label,value] of [['Teams',data.teams?.length??0],['Tasks complete',data.tasks?.filter(x=>x.status==='complete').length??0],['Budget used',`${data.run?.spentUnits??0} / ${data.run?.budgetUnits??0}`]]){+ const card=node('div','', 'metric');card.append(node('small',label),node('strong',value));summary.append(card);+ }+ if(data.run){details.append(node('h2','Run'),node('div',data.run.objective,'row'),node('span',`Status: ${data.run.status}`,'pill'));}+ const heading=node('h2',data.run?'Tasks':'Teams');details.append(heading);+ const items=data.run?data.tasks:data.teams;+ if(!items?.length){details.append(node('p','Nothing to show yet.','muted'));return;}+ for(const item of items){const row=node('div','', 'row');row.append(node('strong',data.run?item.title:item.name),node('span',item.status,'pill'));details.append(row);}+ if(data.vectorBackend)details.append(node('p',`Memory search: ${data.vectorBackend}${data.degraded?' (degraded)':''}`,'muted'));+ }+ function update(result){const data=result?.structuredContent??result;if(data?.teams)render(data);}+ let id=0;const pending=new Map();+ window.addEventListener('message',event=>{+ if(event.source!==window.parent||event.data?.jsonrpc!=='2.0')return;+ const msg=event.data;+ if(typeof msg.id==='number'&&pending.has(msg.id)){const request=pending.get(msg.id);pending.delete(msg.id);msg.error?request.reject(msg.error):request.resolve(msg.result);}+ 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.0'},appCapabilities:{},protocolVersion:'2026-01-26'})+ .then(()=>window.parent.postMessage({jsonrpc:'2.0',method:'ui/notifications/initialized',params:{}},'*'))+ .catch(()=>{details.textContent='The ChatGPT view could not initialize. Team tools remain available in chat.'});+ if(window.openai?.toolOutput)update(window.openai.toolOutput);+</script>+</body>+</html>