@cotal-ai/connector-claude-code 0.10.1 → 0.11.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.
- package/README.md +69 -2
- package/dist/extension.d.ts.map +1 -1
- package/dist/extension.js +14 -1
- package/dist/extension.js.map +1 -1
- package/dist/hook.cjs +7638 -7
- package/dist/mcp.cjs +8433 -202
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,5 +7,72 @@ real `claude` session into a Cotal mesh peer. A thin client over
|
|
|
7
7
|
**Tier:** `extensions/`. Peer-depends [`@cotal-ai/core`](../../packages/core); self-registers on
|
|
8
8
|
import.
|
|
9
9
|
|
|
10
|
-
See [docs/claude
|
|
11
|
-
|
|
10
|
+
See [docs/connect-claude.md](../../docs/connect-claude.md) for the integration guide, and the
|
|
11
|
+
[root AGENTS.md](../../AGENTS.md) for the tier rules.
|
|
12
|
+
|
|
13
|
+
## Claude Code hook reference
|
|
14
|
+
|
|
15
|
+
The full set of Claude Code hook events, grouped by lifecycle — this is Claude *product*
|
|
16
|
+
surface, kept here with the adapter rather than in the protocol docs. Source:
|
|
17
|
+
[code.claude.com/docs/en/hooks](https://code.claude.com/docs/en/hooks) (Claude Code
|
|
18
|
+
2.1.16x, 31 events). The connector consumes the subset mapped in
|
|
19
|
+
[docs/connect-claude.md](../../docs/connect-claude.md) (presence mapping + message
|
|
20
|
+
delivery); the rest are listed for completeness.
|
|
21
|
+
|
|
22
|
+
### Once per session
|
|
23
|
+
| Event | Fires when | Matchers |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `SessionStart` | a session begins or resumes | `startup`, `resume`, `clear`, `compact` |
|
|
26
|
+
| `Setup` | started with `--init-only`, or `--init`/`--maintenance` in `-p` | `init`, `maintenance` |
|
|
27
|
+
| `SessionEnd` | a session terminates | `clear`, `resume`, `logout`, `prompt_input_exit`, `bypass_permissions_disabled`, `other` |
|
|
28
|
+
|
|
29
|
+
### Once per turn
|
|
30
|
+
| Event | Fires when | Matchers |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `UserPromptSubmit` | user submits a prompt, before Claude processes it | (none) |
|
|
33
|
+
| `UserPromptExpansion` | a typed command expands into a prompt | command name |
|
|
34
|
+
| `Stop` | Claude finishes responding | (none) |
|
|
35
|
+
| `StopFailure` | turn ends due to an API error | `rate_limit`, `authentication_failed`, `oauth_org_not_allowed`, `billing_error`, `invalid_request`, `model_not_found`, `server_error`, `max_output_tokens`, `unknown` |
|
|
36
|
+
|
|
37
|
+
### Per tool call (agentic loop)
|
|
38
|
+
| Event | Fires when | Matchers |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `PreToolUse` | before a tool call executes (can block) | tool name |
|
|
41
|
+
| `PermissionRequest` | a permission dialog appears | tool name |
|
|
42
|
+
| `PermissionDenied` | a tool call denied by auto-mode classifier | tool name |
|
|
43
|
+
| `PostToolUse` | after a tool call succeeds | tool name |
|
|
44
|
+
| `PostToolUseFailure` | after a tool call fails | tool name |
|
|
45
|
+
| `PostToolBatch` | after a parallel tool batch resolves, before next model call | (none) |
|
|
46
|
+
| `SubagentStart` | a subagent is spawned | agent type |
|
|
47
|
+
| `SubagentStop` | a subagent finishes | agent type |
|
|
48
|
+
| `TaskCreated` | a task is created via `TaskCreate` | (none) |
|
|
49
|
+
| `TaskCompleted` | a task is marked completed | (none) |
|
|
50
|
+
| `TeammateIdle` | an agent-team teammate is about to go idle | (none) |
|
|
51
|
+
|
|
52
|
+
### Compaction
|
|
53
|
+
| Event | Fires when | Matchers |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `PreCompact` | before context compaction | `manual`, `auto` |
|
|
56
|
+
| `PostCompact` | after compaction completes | `manual`, `auto` |
|
|
57
|
+
|
|
58
|
+
### Async / background
|
|
59
|
+
| Event | Fires when | Matchers |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `CwdChanged` | working directory changes | (none) |
|
|
62
|
+
| `FileChanged` | a watched file changes on disk | literal filenames |
|
|
63
|
+
| `ConfigChange` | a config file changes mid-session | `user_settings`, `project_settings`, `local_settings`, `policy_settings`, `skills` |
|
|
64
|
+
| `InstructionsLoaded` | CLAUDE.md / `.claude/rules/*.md` loaded into context | `session_start`, `nested_traversal`, `path_glob_match`, `include`, `compact` |
|
|
65
|
+
| `Notification` | Claude Code emits a notification | `permission_prompt`, `idle_prompt`, `auth_success`, `elicitation_dialog`, `elicitation_complete`, `elicitation_response` |
|
|
66
|
+
| `MessageDisplay` | while assistant message text is displayed (display-only) | (none) |
|
|
67
|
+
|
|
68
|
+
### Worktree
|
|
69
|
+
| Event | Fires when | Matchers |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `WorktreeCreate` | a worktree is created (`--worktree` / `isolation: "worktree"`) | (none) |
|
|
72
|
+
| `WorktreeRemove` | a worktree is removed | (none) |
|
|
73
|
+
|
|
74
|
+
### MCP elicitation
|
|
75
|
+
| Event | Fires when | Matchers |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `Elicitation` | an MCP server requests user input during a tool call | MCP server name |
|
|
78
|
+
| `ElicitationResult` | after the user responds, before it is sent to the server | MCP server name |
|
package/dist/extension.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2D,KAAK,SAAS,EAAoC,MAAM,gBAAgB,CAAC;AAoB3I;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2D,KAAK,SAAS,EAAoC,MAAM,gBAAgB,CAAC;AAoB3I;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAmI7B,CAAC"}
|
package/dist/extension.js
CHANGED
|
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
|
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { hardenPrivate, loadAgentFile, registry, writeSecretFile } from "@cotal-ai/core";
|
|
6
|
-
import { aclEnv, controlEndpoint, launchEnv, mcpServerEnvKeys, transcriptChannel } from "@cotal-ai/connector-core";
|
|
6
|
+
import { aclEnv, connectorLaunchOptions, controlEndpoint, launchEnv, mcpServerEnvKeys, transcriptChannel, userAuthEnv } from "@cotal-ai/connector-core";
|
|
7
7
|
/** Name the cotal MCP server is registered under via --mcp-config (see buildLaunch). */
|
|
8
8
|
const MCP_SERVER_NAME = "cotal";
|
|
9
9
|
/** Channel ref for `--dangerously-load-development-channels`, which turns on the cotal MCP server's
|
|
@@ -49,6 +49,7 @@ export const claudeConnector = {
|
|
|
49
49
|
const env = {
|
|
50
50
|
...launchEnv({ mcpKeys: mcpServerEnvKeys(shared) }),
|
|
51
51
|
...aclEnv(opts),
|
|
52
|
+
...userAuthEnv(opts),
|
|
52
53
|
COTAL_SPACE: opts.space,
|
|
53
54
|
COTAL_NAME: opts.name,
|
|
54
55
|
// Force the connector to emit channel wake-nudges: Claude doesn't advertise the
|
|
@@ -136,6 +137,18 @@ export const claudeConnector = {
|
|
|
136
137
|
// above still applies, so the forked context runs under the current mesh persona.
|
|
137
138
|
if (opts.resume)
|
|
138
139
|
args.push("--resume", opts.resume, "--fork-session");
|
|
140
|
+
// Opaque connector options → native `claude` flags, RAW passthrough: `key=value` renders
|
|
141
|
+
// `--key value`, and an empty value (`--opt foo=`) renders a bare boolean `--foo`. No allow-list,
|
|
142
|
+
// no deny-list — the spawn capability is the trust boundary (see connectorLaunchOptions), not the
|
|
143
|
+
// flag set. An operator can already run `claude` with any flag directly, and a peer's cotal_spawn
|
|
144
|
+
// is gated by the spawn capability itself; every `claude` flag is forwarded verbatim.
|
|
145
|
+
for (const [k, v] of connectorLaunchOptions("claude", opts.launchOptions)) {
|
|
146
|
+
const val = String(v);
|
|
147
|
+
if (val === "")
|
|
148
|
+
args.push(`--${k}`);
|
|
149
|
+
else
|
|
150
|
+
args.push(`--${k}`, val);
|
|
151
|
+
}
|
|
139
152
|
return {
|
|
140
153
|
command: "claude",
|
|
141
154
|
args,
|
package/dist/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAoD,MAAM,gBAAgB,CAAC;AAC3I,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAoD,MAAM,gBAAgB,CAAC;AAC3I,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAExJ,wFAAwF;AACxF,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC;;;;;+EAK+E;AAC/E,MAAM,WAAW,GAAG,UAAU,eAAe,EAAE,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