@agentproto/apps 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/bin/sync.d.ts +23 -0
- package/dist/bin/sync.d.ts.map +1 -0
- package/dist/bin/sync.mjs +944 -0
- package/dist/bin/sync.mjs.map +1 -0
- package/dist/code-team/index.d.ts.map +1 -1
- package/dist/code-team.mjs +4 -0
- package/dist/code-team.mjs.map +1 -1
- package/dist/content-team/index.d.ts.map +1 -1
- package/dist/content-team.mjs +4 -0
- package/dist/content-team.mjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +676 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mail-triage/index.d.ts.map +1 -1
- package/dist/mail-triage/ui.d.ts +15 -0
- package/dist/mail-triage/ui.d.ts.map +1 -0
- package/dist/mail-triage.mjs +348 -1
- package/dist/mail-triage.mjs.map +1 -1
- package/dist/media-viewer/agents/cataloger.d.ts +3 -0
- package/dist/media-viewer/agents/cataloger.d.ts.map +1 -0
- package/dist/media-viewer/index.d.ts +13 -0
- package/dist/media-viewer/index.d.ts.map +1 -0
- package/dist/media-viewer/ui.d.ts +14 -0
- package/dist/media-viewer/ui.d.ts.map +1 -0
- package/dist/media-viewer/workflows/scan-media.d.ts +2 -0
- package/dist/media-viewer/workflows/scan-media.d.ts.map +1 -0
- package/dist/media-viewer.mjs +332 -0
- package/dist/media-viewer.mjs.map +1 -0
- package/package.json +10 -2
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/code-team/agents/implementer.ts","../src/code-team/agents/reviewer.ts","../src/code-team/agents/fixer.ts","../src/code-team/workflows/deliver-change.ts","../src/code-team/index.ts","../src/content-team/agents/researcher.ts","../src/content-team/agents/writer.ts","../src/content-team/agents/editor.ts","../src/content-team/agents/illustrator.ts","../src/content-team/workflows/produce-content.ts","../src/content-team/workflows/produce-cover.ts","../src/content-team/index.ts","../src/mail-triage/agents/triager.ts","../src/mail-triage/workflows/triage-inbox.ts","../src/mail-triage/index.ts"],"names":["defineAgent","defineWorkflow","defineApp"],"mappings":";;;;;;;;;AAIO,IAAM,WAAA,GAA0B;AAAA,EACrC,OAAO,WAAA,CAAY;AAAA,IACjB,MAAA,EAAQ,UAAA;AAAA,IACR,EAAA,EAAI,yBAAA;AAAA,IACJ,WAAA,EAAa,uCAAA;AAAA,IACb,KAAA,EAAO,iBAAA;AAAA,IACP,UAAA,EAAY,CAAC,gCAAA,EAAkC,6BAA6B,CAAA;AAAA,IAC5E,OAAO,CAAC,UAAA,EAAY,WAAA,EAAa,YAAA,EAAc,aAAa,aAAa,CAAA;AAAA,IACzE,SAAA,EAAW,CAAC,EAAE,GAAA,EAAK,kBAAkB;AAAA,GACtC,CAAA;AAAA,EACD,IAAA,EACE;AAGJ,CAAA;ACdO,IAAM,QAAA,GAAuB;AAAA,EAClC,OAAOA,WAAAA,CAAY;AAAA,IACjB,MAAA,EAAQ,UAAA;AAAA,IACR,EAAA,EAAI,sBAAA;AAAA,IACJ,WAAA,EAAa,wCAAA;AAAA,IACb,KAAA,EAAO,iBAAA;AAAA,IACP,UAAA,EAAY,CAAC,sBAAA,EAAwB,kBAAA,EAAoB,uBAAuB,CAAA;AAAA;AAAA;AAAA,IAGhF,KAAA,EAAO,CAAC,UAAA,EAAY,WAAA,EAAa,aAAa,CAAA;AAAA,IAC9C,SAAA,EAAW,CAAC,EAAE,GAAA,EAAK,kBAAkB;AAAA,GACtC,CAAA;AAAA,EACD,IAAA,EACE;AAEJ,CAAA;ACfO,IAAM,KAAA,GAAoB;AAAA,EAC/B,OAAOA,WAAAA,CAAY;AAAA,IACjB,MAAA,EAAQ,UAAA;AAAA,IACR,EAAA,EAAI,mBAAA;AAAA,IACJ,WAAA,EAAa,2DAAA;AAAA,IACb,KAAA,EAAO,iBAAA;AAAA,IACP,UAAA,EAAY,CAA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AAA;AAAA,MACJ,IAAA,EAAM,OAAA;AAAA,MACN,KAAA,EAAO,EAAE,GAAA,EAAK,qBAAA,EAAsB;AAAA,MACpC,MAAA,EACE;AAAA;AAIJ;AAEJ,CAAC,CAAA;;;ACVM,IAAM,aAAwBC,SAAAA,CAAU;AAAA,EAC7C,MAAA,EAAQ,CAAC,OAAO,CAAA;AAAA,EAChB,SAAA,EAAW,CAAC,WAAW;AACzB,CAAC","file":"index.mjs","sourcesContent":["import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Writes the requested change. */\nexport const implementer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/implementer\",\n description: \"Implements the requested code change.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Change only what the task asks\", \"Match the surrounding style\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You implement the requested change. Read the task and the surrounding code \" +\n \"first, make the smallest correct change that satisfies it, then run the \" +\n \"tests. Do not touch anything the task didn't ask for.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Reviews the diff; reports only. */\nexport const reviewer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/reviewer\",\n description: \"Reviews the diff and reports findings.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Report findings only\", \"Never edit files\", \"Never run gh pr merge\"],\n // Read-only + run_command (to inspect the diff / run tests). No write/edit\n // tools — the \"never edit files\" boundary is enforced by capability too.\n tools: [\"list_dir\", \"read_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You are a rigorous reviewer. Read the diff, and report each real issue as \" +\n \"`file:line — why`. Change nothing; you only report.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Applies the reviewer's findings, precisely and minimally. */\nexport const fixer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/fixer\",\n description: \"Applies the reviewer's findings, precisely and minimally.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Apply only the listed findings\", \"No unrelated refactors\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You apply the reviewer's findings. Address each listed finding exactly, add \" +\n \"nothing extra, and re-run the tests when done.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/**\n * The one workflow the code team delivers a change through. Every team agent\n * references it; the app-kit attachment invariant keeps that honest.\n *\n * Three declarative `kind:\"agent\"` steps — implementer → reviewer → fixer —\n * one per team agent, each `agent.ref` resolving (at compile time, against\n * this app's own install record) to that agent's emitted AGENT.md. This\n * replaces an earlier `ToolStep`-based draft (`apply_patch`/`read_diff`/\n * `run_tests`) that dispatched daemon-side, where those tool ids don't\n * exist — the daemon has no `apply_patch` tool, only live agent sessions\n * that can edit files. Agent steps are the adoption fix (WP-B4): each step\n * spawns the named team agent as a real session and lets it act.\n */\nexport const deliverChange = defineWorkflow({\n id: \"deliver-change\",\n name: \"Deliver a code change\",\n description: \"Implement the change, review the diff, apply fixes, verify.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n {\n id: \"implement\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/implementer\" },\n prompt: \"Implement the requested change.\",\n },\n {\n id: \"review\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/reviewer\" },\n prompt:\n \"Review the diff the implementer just produced. Report every real issue as `file:line — why`.\",\n },\n {\n id: \"fix\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/fixer\" },\n prompt: \"Apply the reviewer's findings, then re-run the tests.\",\n },\n ],\n})\n","/**\n * `code-team` — a ready-made agentproto app: a small team that ships a code\n * change. Three agents (implementer → reviewer → fixer) bound to one delivery\n * workflow, declared with `@agentproto/app-kit`.\n *\n * Generic on purpose — `@agentproto/…` ids, no product dependency, no home\n * workspace. A host imports it and uses any subset of its agents/workflows:\n * in-process via `codeTeam.toMastraAgents(...)`, or on disk via\n * `codeTeam.emit(dir)`.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { implementer } from \"./agents/implementer.js\"\nimport { reviewer } from \"./agents/reviewer.js\"\nimport { fixer } from \"./agents/fixer.js\"\nimport { deliverChange } from \"./workflows/deliver-change.js\"\n\nexport const codeTeam: AppHandle = defineApp({\n agents: [implementer, reviewer, fixer],\n workflows: [deliverChange],\n})\n\nexport { implementer, reviewer, fixer, deliverChange }\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Gathers sources for the piece. */\nexport const researcher: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/researcher\",\n description: \"Reads the provided sources and summarizes them for the writer.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Cite every claim\", \"Prefer primary sources\"],\n tools: [\"list_dir\", \"read_file\", \"run_command\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You read the source material already in the workspace (list_dir, then \" +\n \"read_file the sources), extract the key facts, and hand the writer a tight \" +\n \"brief with a citation for every claim. Use run_command only to fetch a URL \" +\n \"already named in the task; do not invent sources.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Drafts the piece from the brief. */\nexport const writer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/writer\",\n description: \"Drafts the piece from the researcher's brief.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Stay on the brief\", \"One idea per paragraph\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You draft the piece from the brief and its sources. Lead with the point, \" +\n \"keep one idea per paragraph, and don't invent facts the brief doesn't have.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Tightens the draft. */\nexport const editor: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/editor\",\n description: \"Edits the draft for voice, clarity, and length.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Preserve the writer's meaning\", \"Cut, don't pad\"],\n tools: [\"read_file\", \"edit_file\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You edit the draft. Tighten the voice, cut fluff, fix clarity — without \" +\n \"changing what the writer meant. Leave it shorter than you found it.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Art-directs the cover illustration for each article. */\nexport const illustrator: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/illustrator\",\n description: \"Art-directs the cover illustration for each article.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"One cover per article\", \"Text-free prompts only\"],\n tools: [\"read_file\", \"write_file\", \"run_command\"],\n workflows: [{ ref: \"produce-cover\" }],\n }),\n body:\n \"You art-direct a single cover illustration for the article. \" +\n \"Read the article (read_file) to extract the one visual idea that best \" +\n \"represents the piece, then write the art direction (write_file) as a \" +\n \"clean, text-free image prompt. Keep the visual discipline tight: bold \" +\n \"flat shapes, limited risograph-style palettes, strong negative space, and \" +\n \"a single focal subject. Never include text, lettering, logos, watermarks, \" +\n \"or UI chrome in the prompt. Produce exactly one cover per article; if the \" +\n \"article calls for a literal diagram or chart, fall back to a precise \" +\n \"gpt-image-1 style description and treat the diagram itself as the image \" +\n \"subject. Use run_command only to inspect generated assets or move files \" +\n \"during the upload step.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** The one workflow the content team produces a piece through. Every team\n * agent references it (app-kit attachment invariant). */\nexport const produceContent = defineWorkflow({\n id: \"produce-content\",\n name: \"Produce a piece of content\",\n description: \"Read the sources, draft the piece, edit it, then commit it.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n // Concrete workspace tools (fs + exec), so the workflow describes a process\n // a standard runtime can actually run — not abstract tools nothing provides.\n steps: [\n { id: \"research\", kind: \"tool\", tool: \"read_file\" },\n { id: \"draft\", kind: \"tool\", tool: \"write_file\" },\n { id: \"edit\", kind: \"tool\", tool: \"edit_file\" },\n { id: \"publish\", kind: \"tool\", tool: \"run_command\" },\n ],\n})\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** The one workflow the illustrator uses to produce a cover. */\nexport const produceCover = defineWorkflow({\n id: \"produce-cover\",\n name: \"Produce a cover illustration\",\n description:\n \"Read the article, derive the cover concept, generate the base image, \" +\n \"clean it up, and upload the final cover.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n { id: \"concept-from-article\", kind: \"tool\", tool: \"content.cover-concept\" },\n { id: \"base-gen\", kind: \"tool\", tool: \"content.cover-base-gen\" },\n { id: \"cleanup\", kind: \"tool\", tool: \"content.cover-cleanup\" },\n { id: \"upload\", kind: \"tool\", tool: \"content.cover-upload\" },\n ],\n})\n","/**\n * `content-team` — a ready-made agentproto app: a small team that produces a\n * piece of content. Three agents (researcher → writer → editor) bound to one\n * production workflow, declared with `@agentproto/app-kit`.\n *\n * Generic on purpose — `@agentproto/…` ids, no product dependency. A host\n * imports it and uses any subset of its agents/workflows.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { researcher } from \"./agents/researcher.js\"\nimport { writer } from \"./agents/writer.js\"\nimport { editor } from \"./agents/editor.js\"\nimport { illustrator } from \"./agents/illustrator.js\"\nimport { produceContent } from \"./workflows/produce-content.js\"\nimport { produceCover } from \"./workflows/produce-cover.js\"\n\nexport const contentTeam: AppHandle = defineApp({\n agents: [researcher, writer, editor, illustrator],\n workflows: [produceContent, produceCover],\n})\n\nexport { researcher, writer, editor, illustrator, produceContent, produceCover }\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Triages your inbox — finds unread mail, categorizes, labels, archives. */\nexport const triager: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/triager\",\n description: \"Triages your inbox — finds unread mail, categorizes, labels, archives.\",\n model: \"claude-sonnet-5\",\n boundaries: [\n \"Always show the triage plan before applying\",\n \"Never delete — only archive, label, or mark read\",\n \"Ask before applying bulk actions on more than 20 messages\",\n ],\n tools: [\n \"mailbox_list\",\n \"mailbox_search\",\n \"mailbox_list_threads\",\n \"mailbox_get_thread\",\n \"mailbox_labels_list\",\n \"mailbox_label_create\",\n \"mailbox_triage_plan\",\n \"mailbox_triage_apply\",\n ],\n workflows: [{ ref: \"triage-inbox\" }],\n }),\n body:\n \"You scan the inbox for unread messages using mailbox_search. Categorize them \" +\n \"(urgent, needs-reply, newsletter, notification, spam). Create a triage plan: \" +\n \"label each category, archive newsletters+notifications, keep urgent+needs-reply \" +\n \"in inbox. Show the plan before applying. Use mailbox_triage_plan to build the \" +\n \"plan and mailbox_triage_apply to execute it after user confirmation.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** Single-agent workflow: triage the inbox. */\nexport const triageInbox = defineWorkflow({\n id: \"triage-inbox\",\n name: \"Triage Inbox\",\n description: \"Scan inbox, categorize unread messages, create and apply triage plan.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n {\n id: \"triage\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/triager\" },\n prompt:\n \"Scan the inbox for unread messages. Categorize them (urgent, needs-reply, \" +\n \"newsletter, notification, spam). Create a triage plan: label each category, \" +\n \"archive newsletters+notifications, keep urgent+needs-reply in inbox. \" +\n \"Show me the plan before applying.\",\n },\n ],\n})\n","/**\n * `mail-triage` — a single-agent agentproto app for email triage.\n *\n * One agent (triager) scans inbox, categorizes unread mail, and applies\n * triage actions (label, archive). Proves the APP primitive works end-to-end\n * with a simple, useful real-world task.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { triager } from \"./agents/triager.js\"\nimport { triageInbox } from \"./workflows/triage-inbox.js\"\n\nexport const mailTriage: AppHandle = defineApp({\n agents: [triager],\n workflows: [triageInbox],\n})\n\nexport { triager, triageInbox }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/code-team/agents/implementer.ts","../src/code-team/agents/reviewer.ts","../src/code-team/agents/fixer.ts","../src/code-team/workflows/deliver-change.ts","../src/code-team/index.ts","../src/content-team/agents/researcher.ts","../src/content-team/agents/writer.ts","../src/content-team/agents/editor.ts","../src/content-team/agents/illustrator.ts","../src/content-team/workflows/produce-content.ts","../src/content-team/workflows/produce-cover.ts","../src/content-team/index.ts","../src/mail-triage/agents/triager.ts","../src/mail-triage/workflows/triage-inbox.ts","../src/mail-triage/ui.ts","../src/mail-triage/index.ts","../src/media-viewer/agents/cataloger.ts","../src/media-viewer/workflows/scan-media.ts","../src/media-viewer/ui.ts","../src/media-viewer/index.ts"],"names":["defineAgent","defineWorkflow","defineApp","APP_ID"],"mappings":";;;;;;;;;AAIO,IAAM,WAAA,GAA0B;AAAA,EACrC,OAAO,WAAA,CAAY;AAAA,IACjB,MAAA,EAAQ,UAAA;AAAA,IACR,EAAA,EAAI,yBAAA;AAAA,IACJ,WAAA,EAAa,uCAAA;AAAA,IACb,KAAA,EAAO,iBAAA;AAAA,IACP,UAAA,EAAY,CAAC,gCAAA,EAAkC,6BAA6B,CAAA;AAAA,IAC5E,OAAO,CAAC,UAAA,EAAY,WAAA,EAAa,YAAA,EAAc,aAAa,aAAa,CAAA;AAAA,IACzE,SAAA,EAAW,CAAC,EAAE,GAAA,EAAK,kBAAkB;AAAA,GACtC,CAAA;AAAA,EACD,IAAA,EACE;AAGJ,CAAA;ACdO,IAAM,QAAA,GAAuB;AAAA,EAClC,OAAOA,WAAAA,CAAY;AAAA,IACjB,MAAA,EAAQ,UAAA;A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AA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAA,CAAA;;;AC1D9B,IAAM,cAAyBD,SAAAA,CAAU;AAAA,EAC9C,EAAA,EAAI,0BAAA;AAAA,EACJ,IAAA,EAAM,cAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,iEAAA;AAAA,EACb,MAAA,EAAQ,CAAC,SAAS,CAAA;AAAA,EAClB,SAAA,EAAW,CAAC,SAAS,CAAA;AAAA,EACrB,EAAA,EAAI;AAAA,IACF,IAAA,EAAM,iBAAA;AAAA,IACN,KAAA,EAAO,cAAA;AAAA,IACP,KAAA,EAAO,CAAC,GAAG,kBAAkB;AAAA;AAEjC,CAAC","file":"index.mjs","sourcesContent":["import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Writes the requested change. */\nexport const implementer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/implementer\",\n description: \"Implements the requested code change.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Change only what the task asks\", \"Match the surrounding style\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You implement the requested change. Read the task and the surrounding code \" +\n \"first, make the smallest correct change that satisfies it, then run the \" +\n \"tests. Do not touch anything the task didn't ask for.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Reviews the diff; reports only. */\nexport const reviewer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/reviewer\",\n description: \"Reviews the diff and reports findings.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Report findings only\", \"Never edit files\", \"Never run gh pr merge\"],\n // Read-only + run_command (to inspect the diff / run tests). No write/edit\n // tools — the \"never edit files\" boundary is enforced by capability too.\n tools: [\"list_dir\", \"read_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You are a rigorous reviewer. Read the diff, and report each real issue as \" +\n \"`file:line — why`. Change nothing; you only report.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Applies the reviewer's findings, precisely and minimally. */\nexport const fixer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/fixer\",\n description: \"Applies the reviewer's findings, precisely and minimally.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Apply only the listed findings\", \"No unrelated refactors\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\", \"run_command\"],\n workflows: [{ ref: \"deliver-change\" }],\n }),\n body:\n \"You apply the reviewer's findings. Address each listed finding exactly, add \" +\n \"nothing extra, and re-run the tests when done.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/**\n * The one workflow the code team delivers a change through. Every team agent\n * references it; the app-kit attachment invariant keeps that honest.\n *\n * Three declarative `kind:\"agent\"` steps — implementer → reviewer → fixer —\n * one per team agent, each `agent.ref` resolving (at compile time, against\n * this app's own install record) to that agent's emitted AGENT.md. This\n * replaces an earlier `ToolStep`-based draft (`apply_patch`/`read_diff`/\n * `run_tests`) that dispatched daemon-side, where those tool ids don't\n * exist — the daemon has no `apply_patch` tool, only live agent sessions\n * that can edit files. Agent steps are the adoption fix (WP-B4): each step\n * spawns the named team agent as a real session and lets it act.\n */\nexport const deliverChange = defineWorkflow({\n id: \"deliver-change\",\n name: \"Deliver a code change\",\n description: \"Implement the change, review the diff, apply fixes, verify.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n {\n id: \"implement\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/implementer\" },\n prompt: \"Implement the requested change.\",\n },\n {\n id: \"review\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/reviewer\" },\n prompt:\n \"Review the diff the implementer just produced. Report every real issue as `file:line — why`.\",\n },\n {\n id: \"fix\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/fixer\" },\n prompt: \"Apply the reviewer's findings, then re-run the tests.\",\n },\n ],\n})\n","/**\n * `code-team` — a ready-made agentproto app: a small team that ships a code\n * change. Three agents (implementer → reviewer → fixer) bound to one delivery\n * workflow, declared with `@agentproto/app-kit`.\n *\n * Generic on purpose — `@agentproto/…` ids, no product dependency, no home\n * workspace. A host imports it and uses any subset of its agents/workflows:\n * in-process via `codeTeam.toMastraAgents(...)`, or on disk via\n * `codeTeam.emit(dir)`.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { implementer } from \"./agents/implementer.js\"\nimport { reviewer } from \"./agents/reviewer.js\"\nimport { fixer } from \"./agents/fixer.js\"\nimport { deliverChange } from \"./workflows/deliver-change.js\"\n\nexport const codeTeam: AppHandle = defineApp({\n id: \"@agentproto/code-team\",\n name: \"Code Team\",\n version: \"0.1.0\",\n description: \"Implement, review, and fix code changes.\",\n agents: [implementer, reviewer, fixer],\n workflows: [deliverChange],\n})\n\nexport { implementer, reviewer, fixer, deliverChange }\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Gathers sources for the piece. */\nexport const researcher: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/researcher\",\n description: \"Reads the provided sources and summarizes them for the writer.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Cite every claim\", \"Prefer primary sources\"],\n tools: [\"list_dir\", \"read_file\", \"run_command\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You read the source material already in the workspace (list_dir, then \" +\n \"read_file the sources), extract the key facts, and hand the writer a tight \" +\n \"brief with a citation for every claim. Use run_command only to fetch a URL \" +\n \"already named in the task; do not invent sources.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Drafts the piece from the brief. */\nexport const writer: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/writer\",\n description: \"Drafts the piece from the researcher's brief.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Stay on the brief\", \"One idea per paragraph\"],\n tools: [\"list_dir\", \"read_file\", \"write_file\", \"edit_file\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You draft the piece from the brief and its sources. Lead with the point, \" +\n \"keep one idea per paragraph, and don't invent facts the brief doesn't have.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Tightens the draft. */\nexport const editor: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/editor\",\n description: \"Edits the draft for voice, clarity, and length.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"Preserve the writer's meaning\", \"Cut, don't pad\"],\n tools: [\"read_file\", \"edit_file\"],\n workflows: [{ ref: \"produce-content\" }],\n }),\n body:\n \"You edit the draft. Tighten the voice, cut fluff, fix clarity — without \" +\n \"changing what the writer meant. Leave it shorter than you found it.\",\n}\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Art-directs the cover illustration for each article. */\nexport const illustrator: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/illustrator\",\n description: \"Art-directs the cover illustration for each article.\",\n model: \"claude-sonnet-5\",\n boundaries: [\"One cover per article\", \"Text-free prompts only\"],\n tools: [\"read_file\", \"write_file\", \"run_command\"],\n workflows: [{ ref: \"produce-cover\" }],\n }),\n body:\n \"You art-direct a single cover illustration for the article. \" +\n \"Read the article (read_file) to extract the one visual idea that best \" +\n \"represents the piece, then write the art direction (write_file) as a \" +\n \"clean, text-free image prompt. Keep the visual discipline tight: bold \" +\n \"flat shapes, limited risograph-style palettes, strong negative space, and \" +\n \"a single focal subject. Never include text, lettering, logos, watermarks, \" +\n \"or UI chrome in the prompt. Produce exactly one cover per article; if the \" +\n \"article calls for a literal diagram or chart, fall back to a precise \" +\n \"gpt-image-1 style description and treat the diagram itself as the image \" +\n \"subject. Use run_command only to inspect generated assets or move files \" +\n \"during the upload step.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** The one workflow the content team produces a piece through. Every team\n * agent references it (app-kit attachment invariant). */\nexport const produceContent = defineWorkflow({\n id: \"produce-content\",\n name: \"Produce a piece of content\",\n description: \"Read the sources, draft the piece, edit it, then commit it.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n // Concrete workspace tools (fs + exec), so the workflow describes a process\n // a standard runtime can actually run — not abstract tools nothing provides.\n steps: [\n { id: \"research\", kind: \"tool\", tool: \"read_file\" },\n { id: \"draft\", kind: \"tool\", tool: \"write_file\" },\n { id: \"edit\", kind: \"tool\", tool: \"edit_file\" },\n { id: \"publish\", kind: \"tool\", tool: \"run_command\" },\n ],\n})\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** The one workflow the illustrator uses to produce a cover. */\nexport const produceCover = defineWorkflow({\n id: \"produce-cover\",\n name: \"Produce a cover illustration\",\n description:\n \"Read the article, derive the cover concept, generate the base image, \" +\n \"clean it up, and upload the final cover.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n { id: \"concept-from-article\", kind: \"tool\", tool: \"content.cover-concept\" },\n { id: \"base-gen\", kind: \"tool\", tool: \"content.cover-base-gen\" },\n { id: \"cleanup\", kind: \"tool\", tool: \"content.cover-cleanup\" },\n { id: \"upload\", kind: \"tool\", tool: \"content.cover-upload\" },\n ],\n})\n","/**\n * `content-team` — a ready-made agentproto app: a small team that produces a\n * piece of content. Three agents (researcher → writer → editor) bound to one\n * production workflow, declared with `@agentproto/app-kit`.\n *\n * Generic on purpose — `@agentproto/…` ids, no product dependency. A host\n * imports it and uses any subset of its agents/workflows.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { researcher } from \"./agents/researcher.js\"\nimport { writer } from \"./agents/writer.js\"\nimport { editor } from \"./agents/editor.js\"\nimport { illustrator } from \"./agents/illustrator.js\"\nimport { produceContent } from \"./workflows/produce-content.js\"\nimport { produceCover } from \"./workflows/produce-cover.js\"\n\nexport const contentTeam: AppHandle = defineApp({\n id: \"@agentproto/content-team\",\n name: \"Content Team\",\n version: \"0.1.0\",\n description: \"Research, draft, edit, and illustrate content.\",\n agents: [researcher, writer, editor, illustrator],\n workflows: [produceContent, produceCover],\n})\n\nexport { researcher, writer, editor, illustrator, produceContent, produceCover }\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\n/** Triages your inbox — finds unread mail, categorizes, labels, archives. */\nexport const triager: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/triager\",\n description: \"Triages your inbox — finds unread mail, categorizes, labels, archives.\",\n model: \"claude-sonnet-5\",\n boundaries: [\n \"Always show the triage plan before applying\",\n \"Never delete — only archive, label, or mark read\",\n \"Ask before applying bulk actions on more than 20 messages\",\n ],\n tools: [\n \"mailbox_list\",\n \"mailbox_search\",\n \"mailbox_list_threads\",\n \"mailbox_get_thread\",\n \"mailbox_labels_list\",\n \"mailbox_label_create\",\n \"mailbox_triage_plan\",\n \"mailbox_triage_apply\",\n ],\n workflows: [{ ref: \"triage-inbox\" }],\n }),\n body:\n \"You scan the inbox for unread messages using mailbox_search. Categorize them \" +\n \"(urgent, needs-reply, newsletter, notification, spam). Create a triage plan: \" +\n \"label each category, archive newsletters+notifications, keep urgent+needs-reply \" +\n \"in inbox. Show the plan before applying. Use mailbox_triage_plan to build the \" +\n \"plan and mailbox_triage_apply to execute it after user confirmation.\",\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\n/** Single-agent workflow: triage the inbox. */\nexport const triageInbox = defineWorkflow({\n id: \"triage-inbox\",\n name: \"Triage Inbox\",\n description: \"Scan inbox, categorize unread messages, create and apply triage plan.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n {\n id: \"triage\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/triager\" },\n prompt:\n \"Scan the inbox for unread messages. Categorize them (urgent, needs-reply, \" +\n \"newsletter, notification, spam). Create a triage plan: label each category, \" +\n \"archive newsletters+notifications, keep urgent+needs-reply in inbox. \" +\n \"Show me the plan before applying.\",\n },\n ],\n})\n","/**\n * Mail Triage — a self-contained MCP App dashboard for `mail-triage`.\n *\n * Talks to the daemon only through the `window.McpApp.connect()` bridge\n * (never a direct `fetch`): every action round-trips through the app's own\n * `app_tool_call` gateway tool, `{ appId, tool, args }`. Mailbox access goes\n * through the imported `agentpush` MCP server (`imported:agentpush/<tool>`\n * ids); running the triager agent itself goes through the daemon's own\n * `app_run` / `app_status` / `agent_output` — a second path alongside the\n * deterministic plan/apply tools, so the panel can either drive the mailbox\n * tools directly or hand the whole job to the agent and watch it work.\n */\n\nexport const MAIL_TRIAGE_TOOLS = [\n \"imported:agentpush/mailbox_list\",\n \"imported:agentpush/mailbox_search\",\n \"imported:agentpush/mailbox_triage_plan\",\n \"imported:agentpush/mailbox_triage_apply\",\n \"app_run\",\n \"app_status\",\n \"agent_output\",\n] as const\n\nconst APP_ID = \"@agentproto/mail-triage\"\nconst AGENT_ID = \"@agentproto/triager\"\nconst CATEGORIES = [\"urgent\", \"needs-reply\", \"newsletter\", \"notification\"]\n\nexport const MAIL_TRIAGE_HTML = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Mail Triage</title>\n<style>\n*{box-sizing:border-box;margin:0;padding:0}\n:root{\n --bg:#0d1117;--bg2:#161b22;--bg3:#21262d;--border:#30363d;\n --text:#e6edf3;--text2:#8b949e;\n --green:#3fb950;--yellow:#d29922;--red:#f85149;--blue:#58a6ff;--purple:#bc8cff;\n}\nhtml,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;font-size:13px;background:var(--bg);color:var(--text)}\n#app{display:flex;flex-direction:column;height:100%;overflow-y:auto}\n#toolbar{padding:10px 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg2);flex-shrink:0}\n#toolbar .title{font-size:13px;font-weight:600;flex:1}\nselect,input[type=text]{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:5px 8px;border-radius:4px;font-size:12px;font-family:inherit}\n.abtn{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:5px 10px;border-radius:4px;cursor:pointer;font-size:12px;font-family:inherit}\n.abtn:hover{background:var(--border)}\n.abtn:disabled{opacity:.4;cursor:default}\n.abtn.primary{background:var(--blue);border-color:var(--blue);color:#04101c}\n.abtn.primary:hover{opacity:.9}\n#content{padding:14px;display:flex;flex-direction:column;gap:16px}\nsection{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:12px}\nsection h3{font-size:11px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em;margin-bottom:10px}\n#summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}\n.tile{background:var(--bg3);border:1px solid var(--border);border-radius:6px;padding:10px;text-align:center}\n.tile .count{font-size:22px;font-weight:700}\n.tile .label{font-size:11px;color:var(--text2);text-transform:capitalize}\n.tile.urgent .count{color:var(--red)}\n.tile.needs-reply .count{color:var(--yellow)}\n.tile.newsletter .count{color:var(--blue)}\n.tile.notification .count{color:var(--purple)}\n#plan-list,#search-results,#log{max-height:260px;overflow-y:auto;font-size:12px}\n.plan-item{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid var(--border)}\n.plan-item .subj{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.plan-item .tag{color:var(--text2);font-size:11px;white-space:nowrap}\n#log{font-family:Menlo,Monaco,monospace;white-space:pre-wrap;word-break:break-word;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:8px}\n.searchbar{display:flex;gap:8px;margin-bottom:8px}\n.searchbar input{flex:1}\n.actions{display:flex;gap:8px;margin-top:10px}\n#status{padding:6px 14px;font-size:11px;color:var(--text2);border-top:1px solid var(--border);background:var(--bg2);flex-shrink:0}\n.empty{color:var(--text2);padding:8px 0}\n</style>\n</head>\n<body>\n<div id=\"app\">\n <div id=\"toolbar\">\n <span class=\"title\">Mail Triage</span>\n <select id=\"mailbox-select\"></select>\n <button class=\"abtn\" id=\"refresh-btn\">Refresh</button>\n </div>\n <div id=\"content\">\n <section>\n <h3>Inbox summary</h3>\n <div id=\"summary\"></div>\n </section>\n\n <section>\n <h3>Search</h3>\n <div class=\"searchbar\">\n <input type=\"text\" id=\"search-input\" placeholder=\"e.g. is:unread\">\n <button class=\"abtn\" id=\"search-btn\">Search</button>\n </div>\n <div id=\"search-results\"><div class=\"empty\">No search run yet.</div></div>\n </section>\n\n <section>\n <h3>Triage plan</h3>\n <div class=\"actions\">\n <button class=\"abtn primary\" id=\"triage-btn\">Triage</button>\n <button class=\"abtn\" id=\"apply-btn\" disabled>Apply</button>\n </div>\n <div id=\"plan-list\" style=\"margin-top:10px\"><div class=\"empty\">No plan yet — click Triage.</div></div>\n </section>\n\n <section>\n <h3>Triager agent</h3>\n <div class=\"actions\">\n <button class=\"abtn\" id=\"run-agent-btn\">Run Triager Agent</button>\n </div>\n <div id=\"log\" style=\"margin-top:10px\"><div class=\"empty\">Agent has not run yet.</div></div>\n </section>\n </div>\n <div id=\"status\">Connecting…</div>\n</div>\n<script>\nvar APP_ID = ${JSON.stringify(APP_ID)};\nvar AGENT_ID = ${JSON.stringify(AGENT_ID)};\nvar CATEGORIES = ${JSON.stringify(CATEGORIES)};\nvar callTool = null;\nvar currentPlan = null;\nvar pollHandle = null;\n\nfunction setStatus(msg) {\n document.getElementById(\"status\").textContent = msg;\n}\n\n// See media-viewer/ui.ts for why this loop exists: app_tool_call wraps its\n// dispatch result in at least one more {content:[{type:\"text\",text:...}]}\n// shell than the underlying tool returned.\nfunction unwrapText(result) {\n var cur = result;\n for (var i = 0; i < 4; i++) {\n if (typeof cur === \"string\") {\n try {\n cur = JSON.parse(cur);\n continue;\n } catch (e) {\n return cur;\n }\n }\n if (cur && Array.isArray(cur.content) && cur.content[0] && typeof cur.content[0].text === \"string\") {\n cur = cur.content[0].text;\n continue;\n }\n break;\n }\n return cur;\n}\n\nfunction callApp(tool, args) {\n return callTool(\"app_tool_call\", { appId: APP_ID, tool: tool, args: args || {} }).then(unwrapText);\n}\n\nfunction asList(value, keys) {\n if (Array.isArray(value)) return value;\n if (value && typeof value === \"object\") {\n for (var i = 0; i < keys.length; i++) {\n if (Array.isArray(value[keys[i]])) return value[keys[i]];\n }\n }\n return [];\n}\n\nfunction renderSummary(counts) {\n var el = document.getElementById(\"summary\");\n el.innerHTML = \"\";\n CATEGORIES.forEach(function (cat) {\n var tile = document.createElement(\"div\");\n tile.className = \"tile \" + cat;\n var count = counts && counts[cat] !== undefined ? counts[cat] : \"–\";\n tile.innerHTML = '<div class=\"count\"></div><div class=\"label\"></div>';\n tile.querySelector(\".count\").textContent = String(count);\n tile.querySelector(\".label\").textContent = cat.replace(\"-\", \" \");\n el.appendChild(tile);\n });\n}\n\nfunction loadMailboxes() {\n setStatus(\"Loading mailboxes\\\\u2026\");\n return callApp(\"imported:agentpush/mailbox_list\", {})\n .then(function (result) {\n var mailboxes = asList(result, [\"mailboxes\", \"items\"]);\n var select = document.getElementById(\"mailbox-select\");\n select.innerHTML = \"\";\n if (mailboxes.length === 0) {\n var opt = document.createElement(\"option\");\n opt.textContent = \"inbox\";\n opt.value = \"inbox\";\n select.appendChild(opt);\n } else {\n mailboxes.forEach(function (mb) {\n var name = typeof mb === \"string\" ? mb : mb.name || mb.id || JSON.stringify(mb);\n var opt = document.createElement(\"option\");\n opt.value = name;\n opt.textContent = name;\n select.appendChild(opt);\n });\n }\n setStatus(\"Ready\");\n })\n .catch(function (err) {\n setStatus(\"Error loading mailboxes: \" + err.message);\n });\n}\n\nfunction renderSearchResults(items) {\n var el = document.getElementById(\"search-results\");\n el.innerHTML = \"\";\n if (items.length === 0) {\n el.innerHTML = '<div class=\"empty\">No results.</div>';\n return;\n }\n items.forEach(function (item) {\n var row = document.createElement(\"div\");\n row.className = \"plan-item\";\n var subj = typeof item === \"string\" ? item : item.subject || item.title || JSON.stringify(item);\n var from = item && item.from ? item.from : \"\";\n row.innerHTML = '<span class=\"subj\"></span><span class=\"tag\"></span>';\n row.querySelector(\".subj\").textContent = subj;\n row.querySelector(\".tag\").textContent = from;\n el.appendChild(row);\n });\n}\n\nfunction renderPlan(plan) {\n var items = asList(plan, [\"actions\", \"items\", \"plan\"]);\n var el = document.getElementById(\"plan-list\");\n el.innerHTML = \"\";\n if (items.length === 0) {\n el.innerHTML = '<div class=\"empty\">Plan is empty.</div>';\n return;\n }\n var counts = {};\n items.forEach(function (item) {\n var cat = (item && (item.category || item.tag)) || \"notification\";\n counts[cat] = (counts[cat] || 0) + 1;\n var row = document.createElement(\"div\");\n row.className = \"plan-item\";\n var subj = (item && (item.subject || item.title)) || JSON.stringify(item);\n var action = (item && (item.action || item.category)) || \"\";\n row.innerHTML = '<span class=\"subj\"></span><span class=\"tag\"></span>';\n row.querySelector(\".subj\").textContent = subj;\n row.querySelector(\".tag\").textContent = action;\n el.appendChild(row);\n });\n renderSummary(counts);\n}\n\ndocument.getElementById(\"refresh-btn\").addEventListener(\"click\", loadMailboxes);\n\ndocument.getElementById(\"search-btn\").addEventListener(\"click\", function () {\n var query = document.getElementById(\"search-input\").value;\n var mailbox = document.getElementById(\"mailbox-select\").value;\n setStatus(\"Searching\\\\u2026\");\n callApp(\"imported:agentpush/mailbox_search\", { mailbox: mailbox, query: query })\n .then(function (result) {\n renderSearchResults(asList(result, [\"messages\", \"items\", \"results\"]));\n setStatus(\"Ready\");\n })\n .catch(function (err) {\n setStatus(\"Search failed: \" + err.message);\n });\n});\n\ndocument.getElementById(\"triage-btn\").addEventListener(\"click\", function () {\n var mailbox = document.getElementById(\"mailbox-select\").value;\n setStatus(\"Building triage plan\\\\u2026\");\n document.getElementById(\"apply-btn\").disabled = true;\n callApp(\"imported:agentpush/mailbox_triage_plan\", { mailbox: mailbox })\n .then(function (plan) {\n currentPlan = plan;\n renderPlan(plan);\n document.getElementById(\"apply-btn\").disabled = false;\n setStatus(\"Plan ready \\\\u2014 review, then Apply.\");\n })\n .catch(function (err) {\n setStatus(\"Triage plan failed: \" + err.message);\n });\n});\n\ndocument.getElementById(\"apply-btn\").addEventListener(\"click\", function () {\n if (!currentPlan) return;\n setStatus(\"Applying triage plan\\\\u2026\");\n callApp(\"imported:agentpush/mailbox_triage_apply\", { plan: currentPlan })\n .then(function () {\n setStatus(\"Plan applied.\");\n document.getElementById(\"apply-btn\").disabled = true;\n })\n .catch(function (err) {\n setStatus(\"Apply failed: \" + err.message);\n });\n});\n\nfunction appendLog(text) {\n var el = document.getElementById(\"log\");\n if (el.querySelector(\".empty\")) el.innerHTML = \"\";\n el.textContent += (el.textContent ? \"\\\\n\" : \"\") + text;\n el.scrollTop = el.scrollHeight;\n}\n\nfunction pollAgentRun(appRunId) {\n if (pollHandle) clearTimeout(pollHandle);\n callApp(\"app_status\", { appRunId: appRunId })\n .then(function (status) {\n var sessions = (status && status.sessions) || [];\n var sessionId = sessions[0] && sessions[0].sessionId;\n var tail = sessionId\n ? callApp(\"agent_output\", { sessionId: sessionId, lastN: 200, clean: true })\n : Promise.resolve(\"\");\n return tail.then(function (output) {\n if (output) appendLog(typeof output === \"string\" ? output : JSON.stringify(output));\n var done = status && (status.status === \"ended\" || status.status === \"done\" || status.endedAt);\n if (!done) {\n pollHandle = setTimeout(function () { pollAgentRun(appRunId); }, 2000);\n } else {\n setStatus(\"Agent run finished.\");\n }\n });\n })\n .catch(function (err) {\n setStatus(\"Agent status failed: \" + err.message);\n });\n}\n\ndocument.getElementById(\"run-agent-btn\").addEventListener(\"click\", function () {\n document.getElementById(\"log\").innerHTML = \"\";\n setStatus(\"Starting triager agent\\\\u2026\");\n callApp(\"app_run\", { appId: APP_ID, agents: [AGENT_ID], prompt: \"Triage my inbox.\" })\n .then(function (run) {\n appendLog(\"Started app run \" + (run && run.appRunId));\n pollAgentRun(run.appRunId);\n })\n .catch(function (err) {\n setStatus(\"Run failed: \" + err.message);\n });\n});\n\nwindow.McpApp.connect()\n .then(function (bridge) {\n callTool = bridge.callTool;\n return loadMailboxes();\n })\n .catch(function (err) {\n setStatus(\"Standalone mode \\\\u2014 no host bridge (\" + err.message + \")\");\n renderSummary(null);\n });\n\nrenderSummary(null);\n</script>\n</body>\n</html>`\n","/**\n * `mail-triage` — a single-agent agentproto app for email triage.\n *\n * One agent (triager) scans inbox, categorizes unread mail, and applies\n * triage actions (label, archive). Proves the APP primitive works end-to-end\n * with a simple, useful real-world task.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { triager } from \"./agents/triager.js\"\nimport { triageInbox } from \"./workflows/triage-inbox.js\"\nimport { MAIL_TRIAGE_HTML, MAIL_TRIAGE_TOOLS } from \"./ui.js\"\n\nexport const mailTriage: AppHandle = defineApp({\n id: \"@agentproto/mail-triage\",\n name: \"Mail Triage\",\n version: \"0.1.0\",\n description: \"Triage your inbox — categorize, label, archive.\",\n agents: [triager],\n workflows: [triageInbox],\n ui: {\n html: MAIL_TRIAGE_HTML,\n title: \"Mail Triage\",\n tools: [...MAIL_TRIAGE_TOOLS],\n },\n})\n\nexport { triager, triageInbox }\n","import { defineAgent } from \"@agentproto/agent\"\nimport type { AgentEntry } from \"@agentproto/app-kit\"\n\nexport const cataloger: AgentEntry = {\n agent: defineAgent({\n schema: \"agent/v1\",\n id: \"@agentproto/media-cataloger\",\n description:\n \"Scans a folder for media files (images, video, audio), collects metadata, and produces a structured catalog.\",\n model: \"claude-sonnet-5\",\n boundaries: [\n \"Read-only — never modify, rename, move, or delete files\",\n \"Only catalog files with recognized media extensions\",\n \"Report exact file sizes and paths, never estimate\",\n ],\n tools: [\"list_dir\", \"read_file\", \"file_info\"],\n workflows: [{ ref: \"scan-media\" }],\n }),\n body: [\n \"You scan a workspace folder for media files and produce a structured JSON catalog.\",\n \"\",\n \"Walk the target directory recursively using list_dir. For each file, check the\",\n \"extension against known media types:\",\n \"- Images: .jpg, .jpeg, .png, .gif, .webp, .svg, .bmp, .ico, .avif\",\n \"- Video: .mp4, .webm, .mov, .avi, .mkv\",\n \"- Audio: .mp3, .wav, .ogg, .flac, .aac, .m4a\",\n \"\",\n \"For each media file found, use file_info to get size and modification date.\",\n \"\",\n \"Output a JSON object with this shape:\",\n \"```json\",\n '{',\n ' \"folder\": \"<scanned path>\",',\n ' \"scannedAt\": \"<ISO timestamp>\",',\n ' \"summary\": { \"total\": N, \"images\": N, \"video\": N, \"audio\": N, \"totalSizeBytes\": N },',\n ' \"files\": [',\n ' {',\n ' \"path\": \"relative/path.jpg\",',\n ' \"name\": \"file.jpg\",',\n ' \"type\": \"image\",',\n ' \"extension\": \".jpg\",',\n ' \"sizeBytes\": 123456,',\n ' \"modifiedAt\": \"2026-08-01T12:00:00Z\"',\n \" }\",\n \" ]\",\n \"}\",\n \"```\",\n \"\",\n \"Sort files by type (images first, then video, then audio), then by name.\",\n ].join(\"\\n\"),\n}\n","import { defineWorkflow } from \"@agentproto/workflow\"\n\nexport const scanMedia = defineWorkflow({\n id: \"scan-media\",\n name: \"Scan Media\",\n description:\n \"Scan a folder for media files, collect metadata, and produce a structured catalog.\",\n version: \"0.1.0\",\n inputs: {},\n outputs: {},\n steps: [\n {\n id: \"catalog\",\n kind: \"agent\",\n agent: { ref: \"@agentproto/media-cataloger\" },\n prompt:\n \"Scan the workspace root folder for media files (images, video, audio). \" +\n \"Walk all subdirectories recursively. For each media file, collect its path, \" +\n \"name, type, extension, size, and modification date. Output the full catalog \" +\n \"as a single JSON object.\",\n },\n ],\n})\n","/**\n * Media Viewer — a self-contained MCP App gallery widget for `media-viewer`.\n *\n * Talks to the daemon only through the `window.McpApp.connect()` bridge\n * (never a direct `fetch`): every action round-trips through the app's own\n * `app_tool_call` gateway tool, `{ appId, tool, args }`. `app_tool_call`\n * double-wraps its dispatch result (it returns a text-result whose `text` is\n * the JSON-stringified inner tool result, itself an MCP content array) — see\n * `unwrapText` below, which peels that apart regardless of how many layers\n * the host's bridge already stripped.\n */\n\nexport const MEDIA_VIEWER_TOOLS = [\"directory_list\", \"file_info\", \"file_read\"] as const\n\nconst APP_ID = \"@agentproto/media-viewer\"\n\nexport const MEDIA_VIEWER_HTML = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Media Viewer</title>\n<style>\n*{box-sizing:border-box;margin:0;padding:0}\n:root{\n --bg:#0d1117;--bg2:#161b22;--bg3:#21262d;--border:#30363d;\n --text:#e6edf3;--text2:#8b949e;\n --green:#3fb950;--yellow:#d29922;--red:#f85149;--blue:#58a6ff;--purple:#bc8cff;\n}\nhtml,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif;font-size:13px;background:var(--bg);color:var(--text)}\n#app{display:flex;flex-direction:column;height:100%}\n#toolbar{padding:10px 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px;background:var(--bg2);flex-shrink:0}\n#toolbar .title{font-size:13px;font-weight:600;flex:1}\n#breadcrumb{font-size:12px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.abtn{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:5px 10px;border-radius:4px;cursor:pointer;font-size:12px;font-family:inherit}\n.abtn:hover{background:var(--border)}\n#body{flex:1;display:flex;overflow:hidden}\n#grid-wrap{flex:1;overflow-y:auto;padding:14px}\n#grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}\n.cell{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 6px;border:1px solid var(--border);border-radius:6px;background:var(--bg2);cursor:pointer;text-align:center}\n.cell:hover{background:var(--bg3);border-color:var(--blue)}\n.cell.selected{border-color:var(--blue);background:var(--bg3)}\n.icon{font-size:28px;line-height:1}\n.name{font-size:11px;color:var(--text);word-break:break-word;max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}\n#empty{color:var(--text2);padding:24px;text-align:center}\n#details{width:280px;border-left:1px solid var(--border);background:var(--bg2);padding:14px;overflow-y:auto;flex-shrink:0}\n#details h3{font-size:12px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}\n#details .row{display:flex;justify-content:space-between;gap:8px;padding:4px 0;border-bottom:1px solid var(--border);font-size:12px}\n#details .row span:first-child{color:var(--text2)}\n#preview{margin-top:10px;padding:8px;background:var(--bg);border:1px solid var(--border);border-radius:4px;font-family:Menlo,Monaco,monospace;font-size:11px;white-space:pre-wrap;word-break:break-all;max-height:240px;overflow-y:auto}\n#status{padding:6px 14px;font-size:11px;color:var(--text2);border-top:1px solid var(--border);background:var(--bg2);flex-shrink:0}\n</style>\n</head>\n<body>\n<div id=\"app\">\n <div id=\"toolbar\">\n <button class=\"abtn\" id=\"up-btn\" title=\"Up one level\">↑</button>\n <span class=\"title\">Media Viewer</span>\n <span id=\"breadcrumb\">.</span>\n <button class=\"abtn\" id=\"refresh-btn\">Refresh</button>\n </div>\n <div id=\"body\">\n <div id=\"grid-wrap\">\n <div id=\"grid\"></div>\n <div id=\"empty\" style=\"display:none\">No files in this folder.</div>\n </div>\n <div id=\"details\" style=\"display:none\"></div>\n </div>\n <div id=\"status\">Connecting…</div>\n</div>\n<script>\nvar APP_ID = ${JSON.stringify(APP_ID)};\nvar currentPath = \".\";\nvar entries = [];\nvar callTool = null;\n\nfunction setStatus(msg) {\n document.getElementById(\"status\").textContent = msg;\n}\n\n// app_tool_call wraps its dispatch result at least once (its own\n// text-result body is the JSON-stringified inner MCP tool result); peel\n// back through nested {content:[{type:\"text\",text:...}]} shells until the\n// payload stops looking like one, so this works whichever layer the host's\n// own bridge already unwrapped.\nfunction unwrapText(result) {\n var cur = result;\n for (var i = 0; i < 4; i++) {\n if (typeof cur === \"string\") {\n try {\n cur = JSON.parse(cur);\n continue;\n } catch (e) {\n return cur;\n }\n }\n if (cur && Array.isArray(cur.content) && cur.content[0] && typeof cur.content[0].text === \"string\") {\n cur = cur.content[0].text;\n continue;\n }\n break;\n }\n return cur;\n}\n\nfunction callApp(tool, args) {\n return callTool(\"app_tool_call\", { appId: APP_ID, tool: tool, args: args || {} }).then(unwrapText);\n}\n\nfunction parseDirectoryListing(raw) {\n var text = typeof raw === \"string\" ? raw : \"\";\n return text\n .split(\"\\\\n\")\n .map(function (line) { return line.trim(); })\n .filter(function (line) { return line.length > 0; })\n .map(function (line) {\n var isDir = line.indexOf(\"[DIR]\") === 0;\n var name = line.replace(/^\\\\[(FILE|DIR)\\\\]\\\\s*/, \"\");\n return { name: name, isDir: isDir };\n });\n}\n\nfunction iconFor(entry) {\n if (entry.isDir) return \"\\\\uD83D\\\\uDCC1\";\n var ext = (entry.name.split(\".\").pop() || \"\").toLowerCase();\n if ([\"jpg\", \"jpeg\", \"png\", \"gif\", \"webp\", \"svg\", \"bmp\", \"ico\", \"avif\"].indexOf(ext) !== -1) return \"\\\\uD83D\\\\uDDBC\\\\uFE0F\";\n if ([\"mp4\", \"webm\", \"mov\", \"avi\", \"mkv\"].indexOf(ext) !== -1) return \"\\\\uD83C\\\\uDFA5\";\n if ([\"mp3\", \"wav\", \"ogg\", \"flac\", \"aac\", \"m4a\"].indexOf(ext) !== -1) return \"\\\\uD83C\\\\uDFB5\";\n return \"\\\\uD83D\\\\uDCC4\";\n}\n\nfunction joinPath(base, name) {\n if (base === \".\" || base === \"\") return name;\n return base.replace(/\\\\/+$/, \"\") + \"/\" + name;\n}\n\nfunction parentPath(path) {\n if (path === \".\" || path.indexOf(\"/\") === -1) return \".\";\n return path.slice(0, path.lastIndexOf(\"/\")) || \".\";\n}\n\nfunction renderGrid() {\n document.getElementById(\"breadcrumb\").textContent = currentPath;\n var grid = document.getElementById(\"grid\");\n var empty = document.getElementById(\"empty\");\n grid.innerHTML = \"\";\n if (entries.length === 0) {\n empty.style.display = \"block\";\n return;\n }\n empty.style.display = \"none\";\n entries.forEach(function (entry, idx) {\n var cell = document.createElement(\"div\");\n cell.className = \"cell\";\n cell.dataset.idx = String(idx);\n cell.innerHTML = '<div class=\"icon\">' + iconFor(entry) + '</div><div class=\"name\"></div>';\n cell.querySelector(\".name\").textContent = entry.name;\n cell.addEventListener(\"click\", function () { onSelect(entry, cell); });\n grid.appendChild(cell);\n });\n}\n\nfunction onSelect(entry, cell) {\n Array.prototype.forEach.call(document.querySelectorAll(\".cell\"), function (c) {\n c.classList.remove(\"selected\");\n });\n cell.classList.add(\"selected\");\n if (entry.isDir) {\n loadDirectory(joinPath(currentPath, entry.name));\n return;\n }\n showFileDetails(joinPath(currentPath, entry.name));\n}\n\nfunction showFileDetails(path) {\n var details = document.getElementById(\"details\");\n details.style.display = \"block\";\n details.innerHTML = \"<h3>Loading…</h3>\";\n setStatus(\"Reading \" + path + \"\\\\u2026\");\n callApp(\"file_info\", { path: path })\n .then(function (info) {\n var rows = \"\";\n if (info && typeof info === \"object\") {\n [\"name\", \"type\", \"size\", \"modified\"].forEach(function (key) {\n if (info[key] !== undefined) {\n rows += '<div class=\"row\"><span>' + key + '</span><span></span></div>';\n }\n });\n }\n details.innerHTML = \"<h3>Details</h3>\" + rows + '<div id=\"preview\">Loading preview…</div>';\n var rowEls = details.querySelectorAll(\".row span:last-child\");\n var keys = [\"name\", \"type\", \"size\", \"modified\"].filter(function (key) {\n return info && info[key] !== undefined;\n });\n keys.forEach(function (key, i) {\n rowEls[i].textContent = String(info[key]);\n });\n return callApp(\"file_read\", { path: path });\n })\n .then(function (content) {\n var pre = document.getElementById(\"preview\");\n if (!pre) return;\n var text = typeof content === \"string\" ? content : JSON.stringify(content);\n pre.textContent = text.length > 2000 ? text.slice(0, 2000) + \"\\\\u2026 (truncated)\" : (text || \"(empty file)\");\n setStatus(\"Ready \\\\u00b7 \" + currentPath);\n })\n .catch(function (err) {\n var pre = document.getElementById(\"preview\");\n if (pre) pre.textContent = \"Preview unavailable (\" + err.message + \")\";\n setStatus(\"Ready \\\\u00b7 \" + currentPath);\n });\n}\n\nfunction loadDirectory(path) {\n document.getElementById(\"details\").style.display = \"none\";\n setStatus(\"Loading \" + path + \"\\\\u2026\");\n return callApp(\"directory_list\", { path: path })\n .then(function (raw) {\n currentPath = path;\n entries = parseDirectoryListing(raw).sort(function (a, b) {\n if (a.isDir !== b.isDir) return a.isDir ? -1 : 1;\n return a.name.localeCompare(b.name);\n });\n renderGrid();\n setStatus(\"Ready \\\\u00b7 \" + entries.length + \" entries \\\\u00b7 \" + path);\n })\n .catch(function (err) {\n entries = [];\n renderGrid();\n setStatus(\"Error: \" + err.message);\n });\n}\n\ndocument.getElementById(\"up-btn\").addEventListener(\"click\", function () {\n loadDirectory(parentPath(currentPath));\n});\ndocument.getElementById(\"refresh-btn\").addEventListener(\"click\", function () {\n loadDirectory(currentPath);\n});\n\nwindow.McpApp.connect()\n .then(function (bridge) {\n callTool = bridge.callTool;\n return loadDirectory(\".\");\n })\n .catch(function (err) {\n setStatus(\"Standalone mode \\\\u2014 no host bridge (\" + err.message + \")\");\n entries = [];\n renderGrid();\n });\n</script>\n</body>\n</html>`\n","/**\n * `media-viewer` — a single-agent agentproto app for media cataloging.\n *\n * One agent (cataloger) scans a workspace folder for images, video, and audio\n * files, collects metadata, and produces a structured JSON catalog. Paired\n * with a Cowork McpApp gallery widget for visual browsing.\n */\n\nimport { defineApp, type AppHandle } from \"@agentproto/app-kit\"\nimport { cataloger } from \"./agents/cataloger.js\"\nimport { scanMedia } from \"./workflows/scan-media.js\"\nimport { MEDIA_VIEWER_HTML, MEDIA_VIEWER_TOOLS } from \"./ui.js\"\n\nexport const mediaViewer: AppHandle = defineApp({\n id: \"@agentproto/media-viewer\",\n name: \"Media Viewer\",\n version: \"0.1.0\",\n description: \"Scan a folder for images, video, and audio — gallery view.\",\n agents: [cataloger],\n workflows: [scanMedia],\n ui: {\n html: MEDIA_VIEWER_HTML,\n title: \"Media Viewer\",\n tools: [...MEDIA_VIEWER_TOOLS],\n },\n})\n\nexport { cataloger, scanMedia }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mail-triage/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mail-triage/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAGzD,eAAO,MAAM,UAAU,EAAE,SAYvB,CAAA;AAEF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mail Triage — a self-contained MCP App dashboard for `mail-triage`.
|
|
3
|
+
*
|
|
4
|
+
* Talks to the daemon only through the `window.McpApp.connect()` bridge
|
|
5
|
+
* (never a direct `fetch`): every action round-trips through the app's own
|
|
6
|
+
* `app_tool_call` gateway tool, `{ appId, tool, args }`. Mailbox access goes
|
|
7
|
+
* through the imported `agentpush` MCP server (`imported:agentpush/<tool>`
|
|
8
|
+
* ids); running the triager agent itself goes through the daemon's own
|
|
9
|
+
* `app_run` / `app_status` / `agent_output` — a second path alongside the
|
|
10
|
+
* deterministic plan/apply tools, so the panel can either drive the mailbox
|
|
11
|
+
* tools directly or hand the whole job to the agent and watch it work.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MAIL_TRIAGE_TOOLS: readonly ["imported:agentpush/mailbox_list", "imported:agentpush/mailbox_search", "imported:agentpush/mailbox_triage_plan", "imported:agentpush/mailbox_triage_apply", "app_run", "app_status", "agent_output"];
|
|
14
|
+
export declare const MAIL_TRIAGE_HTML: string;
|
|
15
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/mail-triage/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,iBAAiB,iNAQpB,CAAA;AAMV,eAAO,MAAM,gBAAgB,QAmUrB,CAAA"}
|
package/dist/mail-triage.mjs
CHANGED
|
@@ -49,10 +49,357 @@ var triageInbox = defineWorkflow({
|
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
// src/mail-triage/ui.ts
|
|
53
|
+
var MAIL_TRIAGE_TOOLS = [
|
|
54
|
+
"imported:agentpush/mailbox_list",
|
|
55
|
+
"imported:agentpush/mailbox_search",
|
|
56
|
+
"imported:agentpush/mailbox_triage_plan",
|
|
57
|
+
"imported:agentpush/mailbox_triage_apply",
|
|
58
|
+
"app_run",
|
|
59
|
+
"app_status",
|
|
60
|
+
"agent_output"
|
|
61
|
+
];
|
|
62
|
+
var APP_ID = "@agentproto/mail-triage";
|
|
63
|
+
var AGENT_ID = "@agentproto/triager";
|
|
64
|
+
var CATEGORIES = ["urgent", "needs-reply", "newsletter", "notification"];
|
|
65
|
+
var MAIL_TRIAGE_HTML = `<!DOCTYPE html>
|
|
66
|
+
<html lang="en">
|
|
67
|
+
<head>
|
|
68
|
+
<meta charset="UTF-8">
|
|
69
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
70
|
+
<title>Mail Triage</title>
|
|
71
|
+
<style>
|
|
72
|
+
*{box-sizing:border-box;margin:0;padding:0}
|
|
73
|
+
:root{
|
|
74
|
+
--bg:#0d1117;--bg2:#161b22;--bg3:#21262d;--border:#30363d;
|
|
75
|
+
--text:#e6edf3;--text2:#8b949e;
|
|
76
|
+
--green:#3fb950;--yellow:#d29922;--red:#f85149;--blue:#58a6ff;--purple:#bc8cff;
|
|
77
|
+
}
|
|
78
|
+
html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:13px;background:var(--bg);color:var(--text)}
|
|
79
|
+
#app{display:flex;flex-direction:column;height:100%;overflow-y:auto}
|
|
80
|
+
#toolbar{padding:10px 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px;background:var(--bg2);flex-shrink:0}
|
|
81
|
+
#toolbar .title{font-size:13px;font-weight:600;flex:1}
|
|
82
|
+
select,input[type=text]{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:5px 8px;border-radius:4px;font-size:12px;font-family:inherit}
|
|
83
|
+
.abtn{background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:5px 10px;border-radius:4px;cursor:pointer;font-size:12px;font-family:inherit}
|
|
84
|
+
.abtn:hover{background:var(--border)}
|
|
85
|
+
.abtn:disabled{opacity:.4;cursor:default}
|
|
86
|
+
.abtn.primary{background:var(--blue);border-color:var(--blue);color:#04101c}
|
|
87
|
+
.abtn.primary:hover{opacity:.9}
|
|
88
|
+
#content{padding:14px;display:flex;flex-direction:column;gap:16px}
|
|
89
|
+
section{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:12px}
|
|
90
|
+
section h3{font-size:11px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em;margin-bottom:10px}
|
|
91
|
+
#summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}
|
|
92
|
+
.tile{background:var(--bg3);border:1px solid var(--border);border-radius:6px;padding:10px;text-align:center}
|
|
93
|
+
.tile .count{font-size:22px;font-weight:700}
|
|
94
|
+
.tile .label{font-size:11px;color:var(--text2);text-transform:capitalize}
|
|
95
|
+
.tile.urgent .count{color:var(--red)}
|
|
96
|
+
.tile.needs-reply .count{color:var(--yellow)}
|
|
97
|
+
.tile.newsletter .count{color:var(--blue)}
|
|
98
|
+
.tile.notification .count{color:var(--purple)}
|
|
99
|
+
#plan-list,#search-results,#log{max-height:260px;overflow-y:auto;font-size:12px}
|
|
100
|
+
.plan-item{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid var(--border)}
|
|
101
|
+
.plan-item .subj{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
102
|
+
.plan-item .tag{color:var(--text2);font-size:11px;white-space:nowrap}
|
|
103
|
+
#log{font-family:Menlo,Monaco,monospace;white-space:pre-wrap;word-break:break-word;background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:8px}
|
|
104
|
+
.searchbar{display:flex;gap:8px;margin-bottom:8px}
|
|
105
|
+
.searchbar input{flex:1}
|
|
106
|
+
.actions{display:flex;gap:8px;margin-top:10px}
|
|
107
|
+
#status{padding:6px 14px;font-size:11px;color:var(--text2);border-top:1px solid var(--border);background:var(--bg2);flex-shrink:0}
|
|
108
|
+
.empty{color:var(--text2);padding:8px 0}
|
|
109
|
+
</style>
|
|
110
|
+
</head>
|
|
111
|
+
<body>
|
|
112
|
+
<div id="app">
|
|
113
|
+
<div id="toolbar">
|
|
114
|
+
<span class="title">Mail Triage</span>
|
|
115
|
+
<select id="mailbox-select"></select>
|
|
116
|
+
<button class="abtn" id="refresh-btn">Refresh</button>
|
|
117
|
+
</div>
|
|
118
|
+
<div id="content">
|
|
119
|
+
<section>
|
|
120
|
+
<h3>Inbox summary</h3>
|
|
121
|
+
<div id="summary"></div>
|
|
122
|
+
</section>
|
|
123
|
+
|
|
124
|
+
<section>
|
|
125
|
+
<h3>Search</h3>
|
|
126
|
+
<div class="searchbar">
|
|
127
|
+
<input type="text" id="search-input" placeholder="e.g. is:unread">
|
|
128
|
+
<button class="abtn" id="search-btn">Search</button>
|
|
129
|
+
</div>
|
|
130
|
+
<div id="search-results"><div class="empty">No search run yet.</div></div>
|
|
131
|
+
</section>
|
|
132
|
+
|
|
133
|
+
<section>
|
|
134
|
+
<h3>Triage plan</h3>
|
|
135
|
+
<div class="actions">
|
|
136
|
+
<button class="abtn primary" id="triage-btn">Triage</button>
|
|
137
|
+
<button class="abtn" id="apply-btn" disabled>Apply</button>
|
|
138
|
+
</div>
|
|
139
|
+
<div id="plan-list" style="margin-top:10px"><div class="empty">No plan yet \u2014 click Triage.</div></div>
|
|
140
|
+
</section>
|
|
141
|
+
|
|
142
|
+
<section>
|
|
143
|
+
<h3>Triager agent</h3>
|
|
144
|
+
<div class="actions">
|
|
145
|
+
<button class="abtn" id="run-agent-btn">Run Triager Agent</button>
|
|
146
|
+
</div>
|
|
147
|
+
<div id="log" style="margin-top:10px"><div class="empty">Agent has not run yet.</div></div>
|
|
148
|
+
</section>
|
|
149
|
+
</div>
|
|
150
|
+
<div id="status">Connecting…</div>
|
|
151
|
+
</div>
|
|
152
|
+
<script>
|
|
153
|
+
var APP_ID = ${JSON.stringify(APP_ID)};
|
|
154
|
+
var AGENT_ID = ${JSON.stringify(AGENT_ID)};
|
|
155
|
+
var CATEGORIES = ${JSON.stringify(CATEGORIES)};
|
|
156
|
+
var callTool = null;
|
|
157
|
+
var currentPlan = null;
|
|
158
|
+
var pollHandle = null;
|
|
159
|
+
|
|
160
|
+
function setStatus(msg) {
|
|
161
|
+
document.getElementById("status").textContent = msg;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// See media-viewer/ui.ts for why this loop exists: app_tool_call wraps its
|
|
165
|
+
// dispatch result in at least one more {content:[{type:"text",text:...}]}
|
|
166
|
+
// shell than the underlying tool returned.
|
|
167
|
+
function unwrapText(result) {
|
|
168
|
+
var cur = result;
|
|
169
|
+
for (var i = 0; i < 4; i++) {
|
|
170
|
+
if (typeof cur === "string") {
|
|
171
|
+
try {
|
|
172
|
+
cur = JSON.parse(cur);
|
|
173
|
+
continue;
|
|
174
|
+
} catch (e) {
|
|
175
|
+
return cur;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (cur && Array.isArray(cur.content) && cur.content[0] && typeof cur.content[0].text === "string") {
|
|
179
|
+
cur = cur.content[0].text;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
return cur;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function callApp(tool, args) {
|
|
188
|
+
return callTool("app_tool_call", { appId: APP_ID, tool: tool, args: args || {} }).then(unwrapText);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function asList(value, keys) {
|
|
192
|
+
if (Array.isArray(value)) return value;
|
|
193
|
+
if (value && typeof value === "object") {
|
|
194
|
+
for (var i = 0; i < keys.length; i++) {
|
|
195
|
+
if (Array.isArray(value[keys[i]])) return value[keys[i]];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function renderSummary(counts) {
|
|
202
|
+
var el = document.getElementById("summary");
|
|
203
|
+
el.innerHTML = "";
|
|
204
|
+
CATEGORIES.forEach(function (cat) {
|
|
205
|
+
var tile = document.createElement("div");
|
|
206
|
+
tile.className = "tile " + cat;
|
|
207
|
+
var count = counts && counts[cat] !== undefined ? counts[cat] : "\u2013";
|
|
208
|
+
tile.innerHTML = '<div class="count"></div><div class="label"></div>';
|
|
209
|
+
tile.querySelector(".count").textContent = String(count);
|
|
210
|
+
tile.querySelector(".label").textContent = cat.replace("-", " ");
|
|
211
|
+
el.appendChild(tile);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function loadMailboxes() {
|
|
216
|
+
setStatus("Loading mailboxes\\u2026");
|
|
217
|
+
return callApp("imported:agentpush/mailbox_list", {})
|
|
218
|
+
.then(function (result) {
|
|
219
|
+
var mailboxes = asList(result, ["mailboxes", "items"]);
|
|
220
|
+
var select = document.getElementById("mailbox-select");
|
|
221
|
+
select.innerHTML = "";
|
|
222
|
+
if (mailboxes.length === 0) {
|
|
223
|
+
var opt = document.createElement("option");
|
|
224
|
+
opt.textContent = "inbox";
|
|
225
|
+
opt.value = "inbox";
|
|
226
|
+
select.appendChild(opt);
|
|
227
|
+
} else {
|
|
228
|
+
mailboxes.forEach(function (mb) {
|
|
229
|
+
var name = typeof mb === "string" ? mb : mb.name || mb.id || JSON.stringify(mb);
|
|
230
|
+
var opt = document.createElement("option");
|
|
231
|
+
opt.value = name;
|
|
232
|
+
opt.textContent = name;
|
|
233
|
+
select.appendChild(opt);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
setStatus("Ready");
|
|
237
|
+
})
|
|
238
|
+
.catch(function (err) {
|
|
239
|
+
setStatus("Error loading mailboxes: " + err.message);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function renderSearchResults(items) {
|
|
244
|
+
var el = document.getElementById("search-results");
|
|
245
|
+
el.innerHTML = "";
|
|
246
|
+
if (items.length === 0) {
|
|
247
|
+
el.innerHTML = '<div class="empty">No results.</div>';
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
items.forEach(function (item) {
|
|
251
|
+
var row = document.createElement("div");
|
|
252
|
+
row.className = "plan-item";
|
|
253
|
+
var subj = typeof item === "string" ? item : item.subject || item.title || JSON.stringify(item);
|
|
254
|
+
var from = item && item.from ? item.from : "";
|
|
255
|
+
row.innerHTML = '<span class="subj"></span><span class="tag"></span>';
|
|
256
|
+
row.querySelector(".subj").textContent = subj;
|
|
257
|
+
row.querySelector(".tag").textContent = from;
|
|
258
|
+
el.appendChild(row);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function renderPlan(plan) {
|
|
263
|
+
var items = asList(plan, ["actions", "items", "plan"]);
|
|
264
|
+
var el = document.getElementById("plan-list");
|
|
265
|
+
el.innerHTML = "";
|
|
266
|
+
if (items.length === 0) {
|
|
267
|
+
el.innerHTML = '<div class="empty">Plan is empty.</div>';
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
var counts = {};
|
|
271
|
+
items.forEach(function (item) {
|
|
272
|
+
var cat = (item && (item.category || item.tag)) || "notification";
|
|
273
|
+
counts[cat] = (counts[cat] || 0) + 1;
|
|
274
|
+
var row = document.createElement("div");
|
|
275
|
+
row.className = "plan-item";
|
|
276
|
+
var subj = (item && (item.subject || item.title)) || JSON.stringify(item);
|
|
277
|
+
var action = (item && (item.action || item.category)) || "";
|
|
278
|
+
row.innerHTML = '<span class="subj"></span><span class="tag"></span>';
|
|
279
|
+
row.querySelector(".subj").textContent = subj;
|
|
280
|
+
row.querySelector(".tag").textContent = action;
|
|
281
|
+
el.appendChild(row);
|
|
282
|
+
});
|
|
283
|
+
renderSummary(counts);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
document.getElementById("refresh-btn").addEventListener("click", loadMailboxes);
|
|
287
|
+
|
|
288
|
+
document.getElementById("search-btn").addEventListener("click", function () {
|
|
289
|
+
var query = document.getElementById("search-input").value;
|
|
290
|
+
var mailbox = document.getElementById("mailbox-select").value;
|
|
291
|
+
setStatus("Searching\\u2026");
|
|
292
|
+
callApp("imported:agentpush/mailbox_search", { mailbox: mailbox, query: query })
|
|
293
|
+
.then(function (result) {
|
|
294
|
+
renderSearchResults(asList(result, ["messages", "items", "results"]));
|
|
295
|
+
setStatus("Ready");
|
|
296
|
+
})
|
|
297
|
+
.catch(function (err) {
|
|
298
|
+
setStatus("Search failed: " + err.message);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
document.getElementById("triage-btn").addEventListener("click", function () {
|
|
303
|
+
var mailbox = document.getElementById("mailbox-select").value;
|
|
304
|
+
setStatus("Building triage plan\\u2026");
|
|
305
|
+
document.getElementById("apply-btn").disabled = true;
|
|
306
|
+
callApp("imported:agentpush/mailbox_triage_plan", { mailbox: mailbox })
|
|
307
|
+
.then(function (plan) {
|
|
308
|
+
currentPlan = plan;
|
|
309
|
+
renderPlan(plan);
|
|
310
|
+
document.getElementById("apply-btn").disabled = false;
|
|
311
|
+
setStatus("Plan ready \\u2014 review, then Apply.");
|
|
312
|
+
})
|
|
313
|
+
.catch(function (err) {
|
|
314
|
+
setStatus("Triage plan failed: " + err.message);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
document.getElementById("apply-btn").addEventListener("click", function () {
|
|
319
|
+
if (!currentPlan) return;
|
|
320
|
+
setStatus("Applying triage plan\\u2026");
|
|
321
|
+
callApp("imported:agentpush/mailbox_triage_apply", { plan: currentPlan })
|
|
322
|
+
.then(function () {
|
|
323
|
+
setStatus("Plan applied.");
|
|
324
|
+
document.getElementById("apply-btn").disabled = true;
|
|
325
|
+
})
|
|
326
|
+
.catch(function (err) {
|
|
327
|
+
setStatus("Apply failed: " + err.message);
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
function appendLog(text) {
|
|
332
|
+
var el = document.getElementById("log");
|
|
333
|
+
if (el.querySelector(".empty")) el.innerHTML = "";
|
|
334
|
+
el.textContent += (el.textContent ? "\\n" : "") + text;
|
|
335
|
+
el.scrollTop = el.scrollHeight;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function pollAgentRun(appRunId) {
|
|
339
|
+
if (pollHandle) clearTimeout(pollHandle);
|
|
340
|
+
callApp("app_status", { appRunId: appRunId })
|
|
341
|
+
.then(function (status) {
|
|
342
|
+
var sessions = (status && status.sessions) || [];
|
|
343
|
+
var sessionId = sessions[0] && sessions[0].sessionId;
|
|
344
|
+
var tail = sessionId
|
|
345
|
+
? callApp("agent_output", { sessionId: sessionId, lastN: 200, clean: true })
|
|
346
|
+
: Promise.resolve("");
|
|
347
|
+
return tail.then(function (output) {
|
|
348
|
+
if (output) appendLog(typeof output === "string" ? output : JSON.stringify(output));
|
|
349
|
+
var done = status && (status.status === "ended" || status.status === "done" || status.endedAt);
|
|
350
|
+
if (!done) {
|
|
351
|
+
pollHandle = setTimeout(function () { pollAgentRun(appRunId); }, 2000);
|
|
352
|
+
} else {
|
|
353
|
+
setStatus("Agent run finished.");
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
})
|
|
357
|
+
.catch(function (err) {
|
|
358
|
+
setStatus("Agent status failed: " + err.message);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
document.getElementById("run-agent-btn").addEventListener("click", function () {
|
|
363
|
+
document.getElementById("log").innerHTML = "";
|
|
364
|
+
setStatus("Starting triager agent\\u2026");
|
|
365
|
+
callApp("app_run", { appId: APP_ID, agents: [AGENT_ID], prompt: "Triage my inbox." })
|
|
366
|
+
.then(function (run) {
|
|
367
|
+
appendLog("Started app run " + (run && run.appRunId));
|
|
368
|
+
pollAgentRun(run.appRunId);
|
|
369
|
+
})
|
|
370
|
+
.catch(function (err) {
|
|
371
|
+
setStatus("Run failed: " + err.message);
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
window.McpApp.connect()
|
|
376
|
+
.then(function (bridge) {
|
|
377
|
+
callTool = bridge.callTool;
|
|
378
|
+
return loadMailboxes();
|
|
379
|
+
})
|
|
380
|
+
.catch(function (err) {
|
|
381
|
+
setStatus("Standalone mode \\u2014 no host bridge (" + err.message + ")");
|
|
382
|
+
renderSummary(null);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
renderSummary(null);
|
|
386
|
+
</script>
|
|
387
|
+
</body>
|
|
388
|
+
</html>`;
|
|
389
|
+
|
|
52
390
|
// src/mail-triage/index.ts
|
|
53
391
|
var mailTriage = defineApp({
|
|
392
|
+
id: "@agentproto/mail-triage",
|
|
393
|
+
name: "Mail Triage",
|
|
394
|
+
version: "0.1.0",
|
|
395
|
+
description: "Triage your inbox \u2014 categorize, label, archive.",
|
|
54
396
|
agents: [triager],
|
|
55
|
-
workflows: [triageInbox]
|
|
397
|
+
workflows: [triageInbox],
|
|
398
|
+
ui: {
|
|
399
|
+
html: MAIL_TRIAGE_HTML,
|
|
400
|
+
title: "Mail Triage",
|
|
401
|
+
tools: [...MAIL_TRIAGE_TOOLS]
|
|
402
|
+
}
|
|
56
403
|
});
|
|
57
404
|
|
|
58
405
|
export { mailTriage, triageInbox, triager };
|