@excitedjs/agent-runtime-claude-code 0.5.0-beta.168 → 0.5.0-beta.175
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 +43 -1
- package/dist/args.d.ts +2 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +5 -0
- package/dist/args.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +5 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +10 -4
- package/dist/provider.js.map +1 -1
- package/dist/rpc.d.ts +79 -6
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +329 -57
- package/dist/rpc.js.map +1 -1
- package/dist/runtime-deps.d.ts +30 -0
- package/dist/runtime-deps.d.ts.map +1 -0
- package/dist/runtime-deps.js +2 -0
- package/dist/runtime-deps.js.map +1 -0
- package/dist/runtime-session.d.ts +13 -0
- package/dist/runtime-session.d.ts.map +1 -0
- package/dist/runtime-session.js +41 -0
- package/dist/runtime-session.js.map +1 -0
- package/dist/runtime-submissions.d.ts +34 -0
- package/dist/runtime-submissions.d.ts.map +1 -0
- package/dist/runtime-submissions.js +200 -0
- package/dist/runtime-submissions.js.map +1 -0
- package/dist/runtime.d.ts +33 -131
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +286 -268
- package/dist/runtime.js.map +1 -1
- package/dist/skill-adapter.d.ts +11 -1
- package/dist/skill-adapter.d.ts.map +1 -1
- package/dist/skill-adapter.js +60 -7
- package/dist/skill-adapter.js.map +1 -1
- package/dist/skill-materializer.d.ts +6 -0
- package/dist/skill-materializer.d.ts.map +1 -0
- package/dist/skill-materializer.js +45 -0
- package/dist/skill-materializer.js.map +1 -0
- package/dist/source-reservation.d.ts +6 -0
- package/dist/source-reservation.d.ts.map +1 -0
- package/dist/source-reservation.js +48 -0
- package/dist/source-reservation.js.map +1 -0
- package/dist/stream.d.ts +3 -1
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +48 -1
- package/dist/stream.js.map +1 -1
- package/dist/supervisor.d.ts.map +1 -1
- package/dist/supervisor.js +68 -14
- package/dist/supervisor.js.map +1 -1
- package/dist/transcript/budget.d.ts +8 -0
- package/dist/transcript/budget.d.ts.map +1 -0
- package/dist/transcript/budget.js +9 -0
- package/dist/transcript/budget.js.map +1 -0
- package/dist/transcript/completion.d.ts +8 -0
- package/dist/transcript/completion.d.ts.map +1 -0
- package/dist/transcript/completion.js +57 -0
- package/dist/transcript/completion.js.map +1 -0
- package/dist/transcript/cursor.d.ts +25 -0
- package/dist/transcript/cursor.d.ts.map +1 -0
- package/dist/transcript/cursor.js +62 -0
- package/dist/transcript/cursor.js.map +1 -0
- package/dist/transcript/error.d.ts +9 -0
- package/dist/transcript/error.d.ts.map +1 -0
- package/dist/transcript/error.js +9 -0
- package/dist/transcript/error.js.map +1 -0
- package/dist/transcript/native-hash.d.ts +2 -0
- package/dist/transcript/native-hash.d.ts.map +1 -0
- package/dist/transcript/native-hash.js +79 -0
- package/dist/transcript/native-hash.js.map +1 -0
- package/dist/transcript/opened-file.d.ts +13 -0
- package/dist/transcript/opened-file.d.ts.map +1 -0
- package/dist/transcript/opened-file.js +110 -0
- package/dist/transcript/opened-file.js.map +1 -0
- package/dist/transcript/parallel-tools.d.ts +6 -0
- package/dist/transcript/parallel-tools.d.ts.map +1 -0
- package/dist/transcript/parallel-tools.js +123 -0
- package/dist/transcript/parallel-tools.js.map +1 -0
- package/dist/transcript/path.d.ts +25 -0
- package/dist/transcript/path.d.ts.map +1 -0
- package/dist/transcript/path.js +253 -0
- package/dist/transcript/path.js.map +1 -0
- package/dist/transcript/reader.d.ts +7 -0
- package/dist/transcript/reader.d.ts.map +1 -0
- package/dist/transcript/reader.js +476 -0
- package/dist/transcript/reader.js.map +1 -0
- package/dist/transcript/rewrites.d.ts +5 -0
- package/dist/transcript/rewrites.d.ts.map +1 -0
- package/dist/transcript/rewrites.js +65 -0
- package/dist/transcript/rewrites.js.map +1 -0
- package/dist/types.d.ts +33 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -9,7 +9,8 @@ It implements the public `AgentRuntimeProvider` contract from
|
|
|
9
9
|
stream-json child: process supervision, the stream-json wire protocol (line
|
|
10
10
|
framing, turn aggregation, control-request replies), per-turn idle-deadline
|
|
11
11
|
handling, MCP config translation (`--mcp-config`), teammate completion delivery
|
|
12
|
-
as a plain user turn, and Claude Code
|
|
12
|
+
as a plain user turn, bounded native transcript pagination, and Claude Code
|
|
13
|
+
doctor diagnostics.
|
|
13
14
|
|
|
14
15
|
## Boundary
|
|
15
16
|
|
|
@@ -30,3 +31,44 @@ context onto the neutral one and supplies the host contracts. The package also
|
|
|
30
31
|
default-exports a generic provider-loader factory, so
|
|
31
32
|
`loadExternalAgentRuntimeProviders({ refs: ['builtin:claude-code'] })` can load it
|
|
32
33
|
through the same package-loader path as external `npm:` providers.
|
|
34
|
+
|
|
35
|
+
## Turn lifecycle
|
|
36
|
+
|
|
37
|
+
The public runtime boundary returns one `RuntimeSubmission` handle per accepted
|
|
38
|
+
send, settled by an immutable provider-owned `RuntimeCompletion` created at each
|
|
39
|
+
real native result boundary. Inputs merged before session creation and supported
|
|
40
|
+
live steering settle with the same completion object; queued sends settle with
|
|
41
|
+
distinct completions in native order. Command UUIDs are private wire aliases;
|
|
42
|
+
when `msg_lifecycle_v1` is available, all aliases must reach a terminal command
|
|
43
|
+
state and a final result must be captured before the object settles. Live steer
|
|
44
|
+
fails loudly without that capability. Runtime stop fences queued session work,
|
|
45
|
+
terminates the supervised process group with absence proof, and resolves every
|
|
46
|
+
unsettled public object as stopped.
|
|
47
|
+
|
|
48
|
+
Source deduplication is provider-private. A source is reserved while its native
|
|
49
|
+
admission is in flight, committed only after acceptance or an ambiguous
|
|
50
|
+
post-write failure, and released after a proven pre-write failure. Concurrent
|
|
51
|
+
uses of the same reserved source share the same admission outcome. Accordingly,
|
|
52
|
+
`failed` means the command was proven not written, while `ambiguous` means a
|
|
53
|
+
native write may have been accepted and must not be retried automatically.
|
|
54
|
+
Runtime stop synchronously fences new input, releases pending capability/write
|
|
55
|
+
waiters, and drains all already-started admission calls before it resolves.
|
|
56
|
+
|
|
57
|
+
## Native sessions and transcripts
|
|
58
|
+
|
|
59
|
+
For a fresh runtime this package generates the native UUID before launch,
|
|
60
|
+
passes it through Claude Code's `--session-id`, and deterministically derives
|
|
61
|
+
the native transcript under
|
|
62
|
+
`<CLAUDE_CONFIG_DIR-or-~/.claude>/projects/<project>/<session-id>.jsonl`.
|
|
63
|
+
The validated canonical path is persisted with the checkpoint before admission
|
|
64
|
+
can be reported. Resume keeps the authoritative native session id and can
|
|
65
|
+
rediscover a moved transcript across Claude Code project directories. No
|
|
66
|
+
SessionStart Hook, callback process, placeholder file, or auxiliary IPC bridge
|
|
67
|
+
is used to discover `transcript_path`.
|
|
68
|
+
|
|
69
|
+
`readTranscript` is a cold bounded read that never starts a Claude process. It
|
|
70
|
+
applies native rewrite lineage, returns completed provider-neutral
|
|
71
|
+
message/tool blocks in chronological order, and owns opaque cursors, query and
|
|
72
|
+
rewrite mismatch detection, payload redaction/truncation, and the fixed host
|
|
73
|
+
output budget. Native command/session IDs and filesystem paths never appear in
|
|
74
|
+
transcript pages.
|
package/dist/args.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface ClaudeCodeResidentArgsInput {
|
|
|
18
18
|
mcpConfigJson: string;
|
|
19
19
|
/** Resume an existing Claude Code session, when one is known (spawn-time). */
|
|
20
20
|
resumeSessionId?: string | null;
|
|
21
|
+
/** Pin a fresh native session id before the first turn is admitted. */
|
|
22
|
+
freshSessionId?: string | null;
|
|
21
23
|
/**
|
|
22
24
|
* Launcher-supplied ordered dispatcher/role system-prompt content. Claude Code
|
|
23
25
|
* applies it as an APPEND via one native `--append-system-prompt` argument.
|
package/dist/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAa9D,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,0BAA0B,CAAC;IACnC,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,gFAAgF;IAChF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAC1C,MAAM,EAAE,CAGV;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CASpB;AAiBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAa9D,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,0BAA0B,CAAC;IACnC,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,gFAAgF;IAChF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAC1C,MAAM,EAAE,CAGV;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CASpB;AAiBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAuDnF"}
|
package/dist/args.js
CHANGED
|
@@ -100,6 +100,11 @@ export function claudeCodeResidentArgs(input) {
|
|
|
100
100
|
input.resumeSessionId !== '') {
|
|
101
101
|
args.push('--resume', input.resumeSessionId);
|
|
102
102
|
}
|
|
103
|
+
else if (input.freshSessionId !== undefined &&
|
|
104
|
+
input.freshSessionId !== null &&
|
|
105
|
+
input.freshSessionId !== '') {
|
|
106
|
+
args.push('--session-id', input.freshSessionId);
|
|
107
|
+
}
|
|
103
108
|
// Structured output: `--json-schema` is a spawn-time CLI flag, so it can only
|
|
104
109
|
// be set from the create context (never per-turn). When present, every turn's
|
|
105
110
|
// final assistant message must conform to this schema; Claude Code validates
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;GAKG;AACH,MAAM,kCA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K,SAAS,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;IAC3D,CAAC;IACD,IACE,KAAK,CAAC,eAAe,KAAK,SAAS;QACnC,KAAK,CAAC,eAAe,KAAK,IAAI;QAC9B,KAAK,CAAC,eAAe,KAAK,EAAE,EAC5B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;SAAM,IACL,KAAK,CAAC,cAAc,KAAK,SAAS;QAClC,KAAK,CAAC,cAAc,KAAK,IAAI;QAC7B,KAAK,CAAC,cAAc,KAAK,EAAE,EAC3B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;IACD,8EAA8E;IAC9E,8EAA8E;IAC9E,6EAA6E;IAC7E,0EAA0E;IAC1E,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* `@excitedjs/dreamux` core.
|
|
6
6
|
*/
|
|
7
7
|
export { default, createClaudeCodeAgentRuntimeProvider, dispatcherClaudeCodeConfig, CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES, type ClaudeCodeAgentRuntimeProviderOptions, type ClaudeCodeProviderFactoryContext, } from './provider.js';
|
|
8
|
-
export { ClaudeCodeRuntime,
|
|
8
|
+
export { ClaudeCodeRuntime, } from './runtime.js';
|
|
9
|
+
export type { ClaudeCodeRuntimeDeps } from './runtime-deps.js';
|
|
9
10
|
export { createDefaultClaudeCodeSession, type ClaudeCodeSession, type ClaudeCodeSessionFactory, type ClaudeCodeSessionSpec, type TurnOutcome, type TurnSubmitOptions, } from './supervisor.js';
|
|
10
11
|
export { ClaudeCodeStreamRpc, type ClaudeCodeStreamRpcOptions, } from './rpc.js';
|
|
11
12
|
export { LineBuffer, TurnAggregator, assistantText, parseLine, buildUserMessage, buildRemoteControlEnable, buildCanUseToolAllow, buildControlAck, } from './stream.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,oCAAoC,EACpC,0BAA0B,EAC1B,sCAAsC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,GACtC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,oCAAoC,EACpC,0BAA0B,EAC1B,sCAAsC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,GACtC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EACL,8BAA8B,EAC9B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,2BAA2B,GACjC,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,0BAA0B,EAC/B,8BAA8B,EAC9B,iCAAiC,EACjC,uBAAuB,EACvB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,oCAAoC,EACpC,0BAA0B,EAC1B,sCAAsC,GAGvC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,oCAAoC,EACpC,0BAA0B,EAC1B,sCAAsC,GAGvC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,8BAA8B,GAM/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,GAEpB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAE7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAE1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,8BAA8B,EAC9B,iCAAiC,EACjC,uBAAuB,EACvB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAErE,qFAAqF;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClaudeCodeRuntimeDeps } from './runtime-deps.js';
|
|
1
2
|
import { dispatcherClaudeCodeConfig, type DispatcherClaudeCodeConfig } from './config.js';
|
|
2
3
|
import { type ClaudeCodeSessionFactory } from './supervisor.js';
|
|
3
4
|
import type { AgentRuntimeCapabilities, AgentRuntimeProvider, AgentRuntimeProviderDescriptor, AgentRuntimeProviderFactory, ProviderDescriptor, ProviderFactoryContext } from '@excitedjs/dreamux-types';
|
|
@@ -20,6 +21,10 @@ export interface ClaudeCodeAgentRuntimeProviderOptions {
|
|
|
20
21
|
resolveBinPath?: (bin: string) => string;
|
|
21
22
|
/** Override the resident-session factory (tests inject a fake). */
|
|
22
23
|
sessionFactory?: ClaudeCodeSessionFactory;
|
|
24
|
+
/** Override native session UUID generation for deterministic tests. */
|
|
25
|
+
generateSessionId?: ClaudeCodeRuntimeDeps['generateSessionId'];
|
|
26
|
+
/** Override native transcript path resolution for deterministic tests. */
|
|
27
|
+
resolveTranscriptPath?: ClaudeCodeRuntimeDeps['resolveTranscriptPath'];
|
|
23
28
|
}
|
|
24
29
|
export declare const CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES: AgentRuntimeCapabilities;
|
|
25
30
|
/**
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAEL,0BAA0B,EAE1B,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EACV,wBAAwB,EAGxB,oBAAoB,EACpB,8BAA8B,EAC9B,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AASlC;;;;;;GAMG;AACH,MAAM,WAAW,qCAAqC;IACpD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,mEAAmE;IACnE,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;IAC/D,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,sCAAsC,EAAE,wBAGpD,CAAC;AAyBF;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,GAAE,qCAA0C,GAClD,oBAAoB,CAAC,0BAA0B,CAAC,CA+ElD;AAED,gFAAgF;AAChF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAC1C,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,qCAAqC,EAAE,2BAA2B,CAAC,0BAA0B,CAEvB,CAAC;AAE7E,eAAe,qCAAqC,CAAC"}
|
package/dist/provider.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ClaudeCodeRuntime
|
|
1
|
+
import { ClaudeCodeRuntime } from './runtime.js';
|
|
2
2
|
import { DEFAULT_CLAUDE_CODE_BIN, dispatcherClaudeCodeConfig, readDispatcherClaudeCodeConfig, } from './config.js';
|
|
3
3
|
import { createDefaultClaudeCodeSession, } from './supervisor.js';
|
|
4
4
|
import { BUILTIN_CLAUDE_CODE_PROVIDER_REF } from './provider-ref.js';
|
|
5
5
|
import { claudeCodeAgentRuntimeDiagnostic } from './diagnostic.js';
|
|
6
|
+
import { readClaudeTranscript } from './transcript/reader.js';
|
|
6
7
|
function normalizedSystemPromptAppend(append) {
|
|
7
8
|
const normalized = (append ?? []).filter((prompt) => prompt !== '');
|
|
8
9
|
return normalized.length > 0 ? normalized : undefined;
|
|
@@ -58,6 +59,7 @@ export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
|
58
59
|
readConfig(rawConfig, context) {
|
|
59
60
|
return readDispatcherClaudeCodeConfig(rawConfig, context.file, context.prefix);
|
|
60
61
|
},
|
|
62
|
+
readTranscript: readClaudeTranscript,
|
|
61
63
|
createRuntime(context) {
|
|
62
64
|
if (context.state === undefined) {
|
|
63
65
|
throw new Error('claude-code runtime requires a state sink in the create context');
|
|
@@ -70,6 +72,7 @@ export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
|
70
72
|
config: context.config,
|
|
71
73
|
cwd: context.cwd,
|
|
72
74
|
state: context.state,
|
|
75
|
+
activitySink: context.activitySink,
|
|
73
76
|
paths: context.paths,
|
|
74
77
|
mcpServers: context.mcpServers,
|
|
75
78
|
sessionFactory,
|
|
@@ -84,12 +87,15 @@ export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
|
84
87
|
? { disableFeatures: context.disableFeatures }
|
|
85
88
|
: {}),
|
|
86
89
|
outputSchema: context.outputSchema,
|
|
90
|
+
...(options.generateSessionId !== undefined
|
|
91
|
+
? { generateSessionId: options.generateSessionId }
|
|
92
|
+
: {}),
|
|
93
|
+
...(options.resolveTranscriptPath !== undefined
|
|
94
|
+
? { resolveTranscriptPath: options.resolveTranscriptPath }
|
|
95
|
+
: {}),
|
|
87
96
|
...(systemPromptAppend !== undefined
|
|
88
97
|
? { systemPromptAppend }
|
|
89
98
|
: {}),
|
|
90
|
-
...(context.onTurnSettled !== undefined
|
|
91
|
-
? { onTurnSettled: context.onTurnSettled }
|
|
92
|
-
: {}),
|
|
93
99
|
...(context.logger !== undefined ? { logger: context.logger } : {}),
|
|
94
100
|
};
|
|
95
101
|
return new ClaudeCodeRuntime(context.identity, deps);
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,GAE/B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,8BAA8B,GAE/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAY9D,SAAS,4BAA4B,CACnC,MAAqC;IAErC,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;IACpE,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAA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
1
|
/**
|
|
2
2
|
* Claude Code stream-json turn RPC.
|
|
3
3
|
*
|
|
4
|
-
* The supervisor owns the child process. This class owns one in-flight
|
|
5
|
-
* stdout line demux,
|
|
4
|
+
* The supervisor owns the child process. This class owns one in-flight command
|
|
5
|
+
* group, stdout line demux, command drainage, and defensive control replies.
|
|
6
|
+
*
|
|
7
|
+
* One resident CLI execution window can span several submitted commands: a
|
|
8
|
+
* live steer is written while the CLI is already running. How the CLI answers them is
|
|
9
|
+
* not fixed, which is what makes settlement subtle (probed against a live
|
|
10
|
+
* 2.1.231 resident session):
|
|
11
|
+
*
|
|
12
|
+
* - **Commands fold.** A message that arrives while the in-flight turn is
|
|
13
|
+
* inside a tool call is absorbed into that turn at the next query-loop
|
|
14
|
+
* boundary. Several commands then share ONE `result` (3 → 1 observed), and
|
|
15
|
+
* a folded command's uuid never appears on any `result`. Folding does not
|
|
16
|
+
* depend on `priority`.
|
|
17
|
+
* - **Or they do not.** A command that arrives between turns runs on its own
|
|
18
|
+
* and gets its own `result`.
|
|
19
|
+
* - **`result.user_message_uuid` is not a completion ledger.** It is present
|
|
20
|
+
* only sometimes, is not reliably the first-submitted uuid of a fold, and
|
|
21
|
+
* is absent entirely on the `error_during_execution` artifact a
|
|
22
|
+
* `priority: 'now'` interrupt produces.
|
|
23
|
+
* - **`command_lifecycle` is the attribution signal.** Started commands identify
|
|
24
|
+
* the submissions represented by the next native `result`; terminal states
|
|
25
|
+
* drain the resident execution window. Its ordering against `result` is not
|
|
26
|
+
* stable.
|
|
27
|
+
*
|
|
28
|
+
* Every valid `result` is forwarded immediately as its own native completion
|
|
29
|
+
* boundary. Lifecycle terminality only decides when the command group has
|
|
30
|
+
* drained and the resident session may accept a new initial command; it never
|
|
31
|
+
* aggregates several results into one completion.
|
|
6
32
|
*/
|
|
7
33
|
import type { Writable } from 'node:stream';
|
|
8
|
-
import type {
|
|
34
|
+
import type { TurnSubmitOptions } from './types.js';
|
|
35
|
+
/** Provider-private admission classification; never crosses the neutral API. */
|
|
36
|
+
export declare class ClaudeSteerAdmissionError extends Error {
|
|
37
|
+
readonly admission: 'failed' | 'ambiguous';
|
|
38
|
+
constructor(admission: 'failed' | 'ambiguous', message: string, options?: ErrorOptions);
|
|
39
|
+
}
|
|
9
40
|
export interface ClaudeCodeStreamRpcOptions {
|
|
10
41
|
turnTimeoutMs: number;
|
|
11
42
|
log?: (level: 'info' | 'warn' | 'error', msg: string, err?: unknown) => void;
|
|
12
43
|
reapOnTimeout: () => void;
|
|
13
44
|
onRemoteControlUrl?: (url: string) => void;
|
|
45
|
+
onProtocolEvent?: import('./types.js').ClaudeCodeSessionSpec['onProtocolEvent'];
|
|
14
46
|
}
|
|
15
47
|
export declare class ClaudeCodeStreamRpc {
|
|
16
48
|
private readonly stdin;
|
|
17
49
|
private readonly options;
|
|
18
50
|
private readonly lineBuf;
|
|
19
51
|
private pending;
|
|
52
|
+
private lifecycleSupported;
|
|
20
53
|
private remoteControlRequestId;
|
|
21
54
|
constructor(stdin: Writable, options: ClaudeCodeStreamRpcOptions);
|
|
22
|
-
submitTurn(prompt: string, options?: TurnSubmitOptions): Promise<
|
|
23
|
-
steerTurn(prompt: string, options?: TurnSubmitOptions): Promise<void>;
|
|
55
|
+
submitTurn(prompt: string, options?: TurnSubmitOptions, commandUuid?: string): Promise<void>;
|
|
56
|
+
steerTurn(prompt: string, options?: TurnSubmitOptions, commandUuid?: string): Promise<void>;
|
|
57
|
+
private writeSteer;
|
|
24
58
|
onStdoutChunk(chunk: string): void;
|
|
25
59
|
failPending(err: Error): void;
|
|
26
60
|
enableRemoteControl(): void;
|
|
@@ -29,6 +63,40 @@ export declare class ClaudeCodeStreamRpc {
|
|
|
29
63
|
* returning it so the caller can resolve or reject it exactly once.
|
|
30
64
|
*/
|
|
31
65
|
private settlePending;
|
|
66
|
+
/**
|
|
67
|
+
* Mark a submitted command as producing nothing further, then re-check
|
|
68
|
+
* settlement. `abnormalReason` is `null` for the normal ending (`completed`)
|
|
69
|
+
* and a short phrase for a command that never ran — those are logged,
|
|
70
|
+
* because the CLI gives no other trace of a command it declined.
|
|
71
|
+
*
|
|
72
|
+
* A command ending abnormally never fails the turn by itself: the probe
|
|
73
|
+
* shows a `cancelled` command coexisting with another that answers normally
|
|
74
|
+
* (that is exactly what a `priority: 'now'` interrupt looks like), so
|
|
75
|
+
* rejecting on `cancelled` — as the pre-#342 code did — is wrong.
|
|
76
|
+
*/
|
|
77
|
+
private markCommandTerminal;
|
|
78
|
+
/**
|
|
79
|
+
* The drainage gate: every submitted command has reached a terminal
|
|
80
|
+
* lifecycle state AND at least one valid `result` has been seen. Result
|
|
81
|
+
* identity and settlement have already been forwarded one-by-one.
|
|
82
|
+
*
|
|
83
|
+
* Two escapes, both anti-hang:
|
|
84
|
+
*
|
|
85
|
+
* - no lifecycle signal at all (`msg_lifecycle_v1` absent, so no
|
|
86
|
+
* `command_lifecycle` will ever arrive) — the `result` is then the only
|
|
87
|
+
* terminal event there is, so settle on it;
|
|
88
|
+
* - every command terminal, none of them ever ran, and no result — nothing
|
|
89
|
+
* can answer this turn, so fail it loudly. The idle deadline is not an
|
|
90
|
+
* acceptable backstop here: it reaps the resident child, and any inbound
|
|
91
|
+
* line re-arms it, so a healthy session could be killed long after the
|
|
92
|
+
* turn became unanswerable.
|
|
93
|
+
*
|
|
94
|
+
* When a command *did* run but no result has arrived yet, this waits: the
|
|
95
|
+
* probe shows terminal lifecycle states arriving both before and after the
|
|
96
|
+
* result they belong to, so "terminal, therefore no result is coming" is not
|
|
97
|
+
* a sound inference.
|
|
98
|
+
*/
|
|
99
|
+
private settleIfReady;
|
|
32
100
|
/**
|
|
33
101
|
* (Re)arm the per-turn idle deadline. `turnTimeoutMs` is a *max-idle* window,
|
|
34
102
|
* not a total-turn cap: any inbound stream line for this turn pushes it out
|
|
@@ -38,7 +106,12 @@ export declare class ClaudeCodeStreamRpc {
|
|
|
38
106
|
*/
|
|
39
107
|
private armIdleTimer;
|
|
40
108
|
private onLine;
|
|
41
|
-
private
|
|
109
|
+
private decideLifecycleSupport;
|
|
110
|
+
private flushCapabilityWaiters;
|
|
111
|
+
private rejectCapabilityWaiters;
|
|
112
|
+
private resolveWriteWaiter;
|
|
113
|
+
private rejectWriteWaiter;
|
|
114
|
+
private rejectWriteWaiters;
|
|
42
115
|
private onControlRequest;
|
|
43
116
|
private onControlResponse;
|
|
44
117
|
}
|
package/dist/rpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAY5C,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmDhE,gFAAgF;AAChF,qBAAa,yBAA0B,SAAQ,KAAK;IAEhD,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,WAAW;gBAAjC,SAAS,EAAE,QAAQ,GAAG,WAAW,EAC1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY;CAKzB;AAED,MAAM,WAAW,0BAA0B;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7E,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,eAAe,CAAC,EAAE,OAAO,YAAY,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;CACjF;AAED,qBAAa,mBAAmB;IAO5B,OAAO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