@shawnowen/comet-mcp 2.3.1 → 2.4.1

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.
Files changed (85) hide show
  1. package/README.md +86 -19
  2. package/dist/alert-dispatcher.d.ts +23 -0
  3. package/dist/alert-dispatcher.js +101 -0
  4. package/dist/bound-session.d.ts +23 -0
  5. package/dist/bound-session.js +119 -0
  6. package/dist/bridge-config.d.ts +6 -0
  7. package/dist/bridge-config.js +78 -0
  8. package/dist/cdp-client.d.ts +40 -4
  9. package/dist/cdp-client.js +502 -155
  10. package/dist/comet-ai.d.ts +15 -0
  11. package/dist/comet-ai.js +114 -38
  12. package/dist/delegate-binding.d.ts +19 -0
  13. package/dist/delegate-binding.js +73 -0
  14. package/dist/discovery/capability-entry.d.ts +215 -0
  15. package/dist/discovery/capability-entry.js +13 -0
  16. package/dist/discovery/description-template.d.ts +40 -0
  17. package/dist/discovery/description-template.js +61 -0
  18. package/dist/discovery/golden-queries.fixture.d.ts +22 -0
  19. package/dist/discovery/golden-queries.fixture.js +137 -0
  20. package/dist/discovery/mcp-source.d.ts +38 -0
  21. package/dist/discovery/mcp-source.js +70 -0
  22. package/dist/discovery/metadata-completeness.d.ts +48 -0
  23. package/dist/discovery/metadata-completeness.js +83 -0
  24. package/dist/discovery/registry.d.ts +35 -0
  25. package/dist/discovery/registry.js +35 -0
  26. package/dist/discovery/safety.d.ts +44 -0
  27. package/dist/discovery/safety.js +59 -0
  28. package/dist/discovery/schema-validator.d.ts +36 -0
  29. package/dist/discovery/schema-validator.js +257 -0
  30. package/dist/discovery/source-error.d.ts +47 -0
  31. package/dist/discovery/source-error.js +95 -0
  32. package/dist/discovery/tool-meta.d.ts +41 -0
  33. package/dist/discovery/tool-meta.js +229 -0
  34. package/dist/discovery/virtual-tools.d.ts +20 -0
  35. package/dist/discovery/virtual-tools.js +69 -0
  36. package/dist/http-server.js +2067 -47
  37. package/dist/index.js +3163 -710
  38. package/dist/observer.d.ts +47 -0
  39. package/dist/observer.js +516 -0
  40. package/dist/session-registry.d.ts +57 -0
  41. package/dist/session-registry.js +500 -0
  42. package/dist/sidecar-artifacts.d.ts +49 -0
  43. package/dist/sidecar-artifacts.js +146 -0
  44. package/dist/snapshot-capture.d.ts +3 -0
  45. package/dist/snapshot-capture.js +91 -0
  46. package/dist/tab-group-archive.js +3 -1
  47. package/dist/tab-groups.d.ts +7 -0
  48. package/dist/tab-groups.js +21 -3
  49. package/dist/task-thread-aggregator.d.ts +34 -0
  50. package/dist/task-thread-aggregator.js +480 -0
  51. package/dist/task-thread-canonical.d.ts +142 -0
  52. package/dist/task-thread-canonical.js +116 -0
  53. package/dist/types.d.ts +237 -0
  54. package/dist/window-bindings.d.ts +112 -0
  55. package/dist/window-bindings.js +476 -0
  56. package/extension/background.js +1556 -300
  57. package/extension/icons/icon.svg +9 -0
  58. package/extension/icons/icon128.png +0 -0
  59. package/extension/icons/icon16.png +0 -0
  60. package/extension/icons/icon48.png +0 -0
  61. package/extension/manifest.json +19 -4
  62. package/extension/session-logic.js +2383 -0
  63. package/extension/session-manager.html +299 -0
  64. package/extension/sidepanel.css +5323 -528
  65. package/extension/sidepanel.html +282 -2
  66. package/extension/sidepanel.js +10075 -951
  67. package/extension/window-policy.js +162 -0
  68. package/package.json +10 -7
  69. package/vendor/lifecycle-mcp-adapter.mjs +103 -0
  70. package/vendor/lifecycle-metadata.mjs +252 -0
  71. package/vendor/readiness-report.mjs +742 -0
  72. package/dist/cdp-client.d.ts.map +0 -1
  73. package/dist/cdp-client.js.map +0 -1
  74. package/dist/comet-ai.d.ts.map +0 -1
  75. package/dist/comet-ai.js.map +0 -1
  76. package/dist/http-server.d.ts.map +0 -1
  77. package/dist/http-server.js.map +0 -1
  78. package/dist/index.d.ts.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/tab-group-archive.d.ts.map +0 -1
  81. package/dist/tab-group-archive.js.map +0 -1
  82. package/dist/tab-groups.d.ts.map +0 -1
  83. package/dist/tab-groups.js.map +0 -1
  84. package/dist/types.d.ts.map +0 -1
  85. package/dist/types.js.map +0 -1
@@ -0,0 +1,229 @@
1
+ /**
2
+ * tool-meta.ts
3
+ * Discovery metadata catalog for the 25 native Comet MCP tools (Spec 042, T024).
4
+ *
5
+ * Each entry provides the discovery-layer fields that are NOT present in the
6
+ * existing TOOLS array in index.ts: canonicalId, safety, preconditions,
7
+ * intentKeywords, and a description following the R10 template.
8
+ *
9
+ * AUTHORITATIVE SOURCES:
10
+ * - Safety classes: docs/TOOL-SAFETY-REFERENCE.md
11
+ * - Preconditions: same doc, safety class descriptions
12
+ *
13
+ * This file is the single source of truth for native-tool discovery metadata.
14
+ * When a new tool is added to TOOLS in index.ts, add a matching entry here.
15
+ */
16
+ // CDP session precondition (reused across SESSION tools)
17
+ const CDP_SESSION = {
18
+ kind: "cdp_session",
19
+ note: "Requires an active Comet CDP session — call comet_connect first",
20
+ };
21
+ /**
22
+ * Discovery metadata for the 25 native MCP tools.
23
+ * Order matches the TOOLS array in index.ts for readability.
24
+ */
25
+ export const TOOL_META = [
26
+ {
27
+ toolName: "comet_connect",
28
+ canonicalId: "comet-connect",
29
+ safety: "SESSION",
30
+ preconditions: [],
31
+ intentKeywords: ["connect", "start session", "browser", "tab group", "agent session", "open browser"],
32
+ description: "Connect to the Comet browser and create a new tab group for this agent session. Source: mcp. Safety: SESSION.",
33
+ },
34
+ {
35
+ toolName: "comet_ask",
36
+ canonicalId: "comet-ask",
37
+ safety: "SESSION",
38
+ preconditions: [CDP_SESSION],
39
+ intentKeywords: ["ask", "prompt", "perplexity", "research", "ai", "question", "sidecar"],
40
+ description: "Send a prompt to Comet/Perplexity AI and wait for the complete response. Source: mcp. Safety: SESSION.",
41
+ },
42
+ {
43
+ toolName: "comet_poll",
44
+ canonicalId: "comet-poll",
45
+ safety: "SESSION",
46
+ preconditions: [CDP_SESSION],
47
+ intentKeywords: ["poll", "status", "progress", "monitor", "check", "agentic task"],
48
+ description: "Check agent status and progress in the current session. Source: mcp. Safety: SESSION.",
49
+ },
50
+ {
51
+ toolName: "comet_stop",
52
+ canonicalId: "comet-stop",
53
+ safety: "CAUTION",
54
+ preconditions: [CDP_SESSION],
55
+ intentKeywords: ["stop", "cancel", "abort", "terminate", "halt"],
56
+ description: "Stop the current agent task if it is going off track. CAUTION: terminates the running task — only use on YOUR OWN session. Source: mcp. Safety: CAUTION.",
57
+ },
58
+ {
59
+ toolName: "comet_screenshot",
60
+ canonicalId: "comet-screenshot",
61
+ safety: "SESSION",
62
+ preconditions: [CDP_SESSION],
63
+ intentKeywords: ["screenshot", "capture", "image", "png", "visual", "photo"],
64
+ description: "Capture a screenshot of the current page in this agent's tab. Source: mcp. Safety: SESSION.",
65
+ },
66
+ {
67
+ toolName: "comet_mode",
68
+ canonicalId: "comet-mode",
69
+ safety: "SESSION",
70
+ preconditions: [CDP_SESSION],
71
+ intentKeywords: ["mode", "perplexity mode", "search mode", "focus", "writing", "coding"],
72
+ description: "Get or set the Perplexity search mode in this agent's tab. Source: mcp. Safety: SESSION.",
73
+ },
74
+ {
75
+ toolName: "comet_tab_groups",
76
+ canonicalId: "comet-tab-groups",
77
+ safety: "SESSION",
78
+ preconditions: [CDP_SESSION],
79
+ intentKeywords: ["tab group", "tabs", "list groups", "create group", "archive", "restore", "save group"],
80
+ description: "Manage Chrome tab groups — list, create, update, archive, restore, and delete groups. Source: mcp. Safety: SESSION.",
81
+ },
82
+ {
83
+ toolName: "comet_shortcut",
84
+ canonicalId: "comet-shortcut",
85
+ safety: "SESSION",
86
+ preconditions: [CDP_SESSION],
87
+ intentKeywords: ["shortcut", "query shortcut", "quick command", "template", "macro"],
88
+ description: "Trigger a query shortcut in this agent's Perplexity tab. Source: mcp. Safety: SESSION.",
89
+ },
90
+ {
91
+ toolName: "comet_read_page",
92
+ canonicalId: "comet-read-page",
93
+ safety: "SESSION",
94
+ preconditions: [CDP_SESSION],
95
+ intentKeywords: ["read page", "extract text", "page content", "dom tree", "accessibility tree", "markdown"],
96
+ description: "Extract text, links, or DOM tree from the current page in this agent's tab. Source: mcp. Safety: SESSION.",
97
+ },
98
+ {
99
+ toolName: "comet_interact",
100
+ canonicalId: "comet-interact",
101
+ safety: "SESSION",
102
+ preconditions: [CDP_SESSION],
103
+ intentKeywords: ["interact", "click", "type", "fill form", "input", "button", "element", "action"],
104
+ description: "Execute click, type, scroll, and fill-form actions on the current page. Source: mcp. Safety: SESSION.",
105
+ },
106
+ {
107
+ toolName: "comet_navigate",
108
+ canonicalId: "comet-navigate",
109
+ safety: "SESSION",
110
+ preconditions: [CDP_SESSION],
111
+ intentKeywords: ["navigate", "go to", "open url", "browse", "load page", "visit"],
112
+ description: "Navigate this agent's tab to a specified URL. Source: mcp. Safety: SESSION.",
113
+ },
114
+ {
115
+ toolName: "comet_wait_for_idle",
116
+ canonicalId: "comet-wait-for-idle",
117
+ safety: "SESSION",
118
+ preconditions: [CDP_SESSION],
119
+ intentKeywords: ["wait", "idle", "network idle", "page load", "settle", "ready"],
120
+ description: "Wait for this agent's tab to finish loading and reach a network-idle state. Source: mcp. Safety: SESSION.",
121
+ },
122
+ {
123
+ toolName: "comet_lifecycle_start",
124
+ canonicalId: "comet-lifecycle-start",
125
+ safety: "SESSION",
126
+ preconditions: [{ kind: "task_thread", note: "A task thread ID must be registered before calling" }],
127
+ intentKeywords: ["lifecycle start", "start task", "begin run", "dispatch agent", "register lifecycle"],
128
+ description: "Register the start of a lifecycle run for a task thread with the Command Center. Source: mcp. Safety: SESSION.",
129
+ },
130
+ {
131
+ toolName: "comet_lifecycle_complete",
132
+ canonicalId: "comet-lifecycle-complete",
133
+ safety: "SESSION",
134
+ preconditions: [{ kind: "task_thread", note: "A started lifecycle run must exist for the task thread" }],
135
+ intentKeywords: ["lifecycle complete", "finish task", "complete run", "mark done", "task success"],
136
+ description: "Mark a lifecycle run as successfully completed with the Command Center. Source: mcp. Safety: SESSION.",
137
+ },
138
+ {
139
+ toolName: "comet_lifecycle_abort",
140
+ canonicalId: "comet-lifecycle-abort",
141
+ safety: "SESSION",
142
+ preconditions: [{ kind: "task_thread", note: "A started lifecycle run must exist for the task thread" }],
143
+ intentKeywords: ["lifecycle abort", "abort task", "cancel run", "task failed", "terminate lifecycle"],
144
+ description: "Abort a lifecycle run and record the reason with the Command Center. Source: mcp. Safety: SESSION.",
145
+ },
146
+ {
147
+ toolName: "comet_lifecycle_update",
148
+ canonicalId: "comet-lifecycle-update",
149
+ safety: "SESSION",
150
+ preconditions: [{ kind: "task_thread", note: "A started lifecycle run must exist for the task thread" }],
151
+ intentKeywords: ["lifecycle update", "update status", "progress update", "task status update"],
152
+ description: "Send a status update or progress event for an active lifecycle run. Source: mcp. Safety: SESSION.",
153
+ },
154
+ {
155
+ toolName: "comet_task_status",
156
+ canonicalId: "comet-task-status",
157
+ safety: "SAFE",
158
+ preconditions: [],
159
+ intentKeywords: ["task status", "task thread", "orchestrator", "equabot", "agent status", "running tasks"],
160
+ description: "Get the current status of Equabot task threads and orchestrator agents. Source: mcp. Safety: SAFE.",
161
+ },
162
+ {
163
+ toolName: "comet_delegate",
164
+ canonicalId: "comet-delegate",
165
+ safety: "CAUTION",
166
+ preconditions: [{ kind: "task_group", note: "COMET_TASK_GROUP must be set for the calling agent" }],
167
+ intentKeywords: ["delegate", "spawn agent", "sub-agent", "dispatch task", "equabot", "multi-agent"],
168
+ description: "Delegate a task to an Equabot sub-agent. CAUTION: spawns a new agent process — ensure you own the task thread before delegating. Source: mcp. Safety: CAUTION.",
169
+ },
170
+ {
171
+ toolName: "comet_observe",
172
+ canonicalId: "comet-observe",
173
+ safety: "SAFE",
174
+ preconditions: [],
175
+ intentKeywords: ["observe", "snapshot", "health check", "agents", "tab groups", "browser status", "overview"],
176
+ description: "Observe the browser environment — health, snapshot, status, or detail view of tab groups and agents. Source: mcp. Safety: SAFE.",
177
+ },
178
+ {
179
+ toolName: "comet_peek",
180
+ canonicalId: "comet-peek",
181
+ safety: "SAFE",
182
+ preconditions: [],
183
+ intentKeywords: ["peek", "inspect tab", "tab info", "read other tab", "screenshot other", "cross-agent observe"],
184
+ description: "Peek at any browser tab — get info, screenshot, or page text without affecting the tab. Source: mcp. Safety: SAFE.",
185
+ },
186
+ {
187
+ toolName: "comet_pdf",
188
+ canonicalId: "comet-pdf",
189
+ safety: "SESSION",
190
+ preconditions: [CDP_SESSION],
191
+ intentKeywords: ["pdf", "print", "save page", "generate pdf", "document", "export"],
192
+ description: "Generate a PDF of the current page in this agent's tab. Source: mcp. Safety: SESSION.",
193
+ },
194
+ {
195
+ toolName: "comet_scrape",
196
+ canonicalId: "comet-scrape",
197
+ safety: "SESSION",
198
+ preconditions: [CDP_SESSION],
199
+ intentKeywords: ["scrape", "extract", "structured data", "table", "list", "parse page", "data extraction"],
200
+ description: "Extract structured data (tables, lists, forms) from the current page. Source: mcp. Safety: SESSION.",
201
+ },
202
+ {
203
+ toolName: "comet_network",
204
+ canonicalId: "comet-network",
205
+ safety: "SESSION",
206
+ preconditions: [CDP_SESSION],
207
+ intentKeywords: ["network", "requests", "api calls", "xhr", "fetch", "capture traffic", "network log"],
208
+ description: "Capture and inspect network requests from the current page. Source: mcp. Safety: SESSION.",
209
+ },
210
+ {
211
+ toolName: "comet_automate",
212
+ canonicalId: "comet-automate",
213
+ safety: "SESSION",
214
+ preconditions: [CDP_SESSION],
215
+ intentKeywords: ["automate", "workflow", "multi-step", "automation", "sequence", "playbook"],
216
+ description: "Run a multi-step automation workflow in this agent's tab following a defined playbook. Source: mcp. Safety: SESSION.",
217
+ },
218
+ {
219
+ toolName: "comet_domain",
220
+ canonicalId: "comet-domain",
221
+ safety: "SESSION",
222
+ preconditions: [CDP_SESSION],
223
+ intentKeywords: ["domain", "quickbooks", "mercury", "github", "google", "salt", "auth", "login"],
224
+ description: "Route to a domain-specific playbook for authenticated sites (QBO, Mercury, GitHub, Google, SALT). Source: mcp. Safety: SESSION.",
225
+ },
226
+ ];
227
+ /** Lookup map: toolName → ToolMeta */
228
+ export const TOOL_META_MAP = new Map(TOOL_META.map((m) => [m.toolName, m]));
229
+ //# sourceMappingURL=tool-meta.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * virtual-tools.ts
3
+ * Virtual MCP tool emitter for the Comet Discovery Layer (Spec 042, T011/T022/T034/T035/T045).
4
+ *
5
+ * T011: Stub (proved the integration point compiled).
6
+ * T022: Emit pass-through McpToolDefinition for recommended native entries.
7
+ * T034: Inject description-template output into the description field.
8
+ * T035: Append preconditions block to each tool description.
9
+ * T045: Handle plugin guide + extension dispatch (US3, future).
10
+ */
11
+ import type { CapabilityEntry, McpToolDefinition } from "./capability-entry.js";
12
+ /**
13
+ * Emit McpToolDefinition objects for every non-humanOnly recommended entry.
14
+ *
15
+ * T022: native pass-through — uses the original argsSchema so the tool
16
+ * contract is byte-identical to the pre-discovery registration (FR-009).
17
+ * T045: plugin guide and extension dispatch (not yet implemented).
18
+ */
19
+ export declare function emitVirtualTools(entries: CapabilityEntry[]): McpToolDefinition[];
20
+ //# sourceMappingURL=virtual-tools.d.ts.map
@@ -0,0 +1,69 @@
1
+ /**
2
+ * virtual-tools.ts
3
+ * Virtual MCP tool emitter for the Comet Discovery Layer (Spec 042, T011/T022/T034/T035/T045).
4
+ *
5
+ * T011: Stub (proved the integration point compiled).
6
+ * T022: Emit pass-through McpToolDefinition for recommended native entries.
7
+ * T034: Inject description-template output into the description field.
8
+ * T035: Append preconditions block to each tool description.
9
+ * T045: Handle plugin guide + extension dispatch (US3, future).
10
+ */
11
+ import { CAUTION_MULTI_AGENT_CLAUSE } from "./description-template.js";
12
+ // ── Precondition → human-readable bullet ─────────────────────────────────────
13
+ function preconditionText(p) {
14
+ switch (p.kind) {
15
+ case "cdp_session": return p.note;
16
+ case "profile": return `Requires --profile ${p.value}`;
17
+ case "task_group": return p.note;
18
+ case "task_thread": return p.note;
19
+ case "free": return p.note;
20
+ }
21
+ }
22
+ function buildPreconditionsBlock(preconditions) {
23
+ if (preconditions.length === 0)
24
+ return "";
25
+ const bullets = preconditions.map((p) => `- ${preconditionText(p)}`).join("\n");
26
+ return `\n\nPreconditions:\n${bullets}`;
27
+ }
28
+ // ── Description builder ───────────────────────────────────────────────────────
29
+ function buildDescription(entry) {
30
+ let desc = entry.description;
31
+ // For CAUTION tools, ensure the canonical multi-agent clause is present.
32
+ // (It should already be in tool-meta.ts descriptions, but this is a safety net.)
33
+ if (entry.safety === "CAUTION" && !desc.includes("CAUTION:")) {
34
+ desc += " " + CAUTION_MULTI_AGENT_CLAUSE;
35
+ }
36
+ // T035: append preconditions block
37
+ desc += buildPreconditionsBlock(entry.preconditions);
38
+ return desc.slice(0, 1000); // hard cap for MCP clients
39
+ }
40
+ // ── Main emitter ──────────────────────────────────────────────────────────────
41
+ /**
42
+ * Emit McpToolDefinition objects for every non-humanOnly recommended entry.
43
+ *
44
+ * T022: native pass-through — uses the original argsSchema so the tool
45
+ * contract is byte-identical to the pre-discovery registration (FR-009).
46
+ * T045: plugin guide and extension dispatch (not yet implemented).
47
+ */
48
+ export function emitVirtualTools(entries) {
49
+ const tools = [];
50
+ for (const entry of entries) {
51
+ // Skip human-only entries — they have no agent-reachable entry point
52
+ if (entry.humanOnly)
53
+ continue;
54
+ // Only emit the recommended entry per group (suppressed entries are not tools)
55
+ if (!entry.recommended)
56
+ continue;
57
+ if (entry.invocation.kind === "native") {
58
+ // T022: pass-through — same name and args schema as the native tool (FR-009)
59
+ tools.push({
60
+ name: entry.name,
61
+ description: buildDescription(entry),
62
+ inputSchema: entry.argsSchema,
63
+ });
64
+ }
65
+ // TODO T045: "guide" and "cdp"/"filesystem"/"cli" invocation kinds
66
+ }
67
+ return tools;
68
+ }
69
+ //# sourceMappingURL=virtual-tools.js.map