@excitedjs/agent-runtime-claude-code 0.6.0-beta.179 → 0.6.0-beta.183
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/dist/activity/budget.d.ts +8 -0
- package/dist/activity/budget.d.ts.map +1 -0
- package/dist/activity/budget.js +9 -0
- package/dist/activity/budget.js.map +1 -0
- package/dist/{transcript → activity}/cursor.d.ts +2 -2
- package/dist/activity/cursor.d.ts.map +1 -0
- package/dist/{transcript → activity}/cursor.js +11 -11
- package/dist/activity/cursor.js.map +1 -0
- package/dist/activity/error.d.ts +16 -0
- package/dist/activity/error.d.ts.map +1 -0
- package/dist/activity/error.js +22 -0
- package/dist/activity/error.js.map +1 -0
- package/dist/activity/native-hash.d.ts.map +1 -0
- package/dist/activity/native-hash.js.map +1 -0
- package/dist/{transcript → activity}/opened-file.d.ts +3 -3
- package/dist/activity/opened-file.d.ts.map +1 -0
- package/dist/{transcript → activity}/opened-file.js +16 -16
- package/dist/activity/opened-file.js.map +1 -0
- package/dist/activity/parallel-tools.d.ts +6 -0
- package/dist/activity/parallel-tools.d.ts.map +1 -0
- package/dist/activity/parallel-tools.js.map +1 -0
- package/dist/activity/path.d.ts +25 -0
- package/dist/activity/path.d.ts.map +1 -0
- package/dist/{transcript → activity}/path.js +32 -32
- package/dist/activity/path.js.map +1 -0
- package/dist/activity/reader.d.ts +16 -0
- package/dist/activity/reader.d.ts.map +1 -0
- package/dist/{transcript → activity}/reader.js +120 -161
- package/dist/activity/reader.js.map +1 -0
- package/dist/activity/rewrites.d.ts.map +1 -0
- package/dist/activity/rewrites.js.map +1 -0
- package/dist/admission-classify.d.ts +7 -0
- package/dist/admission-classify.d.ts.map +1 -0
- package/dist/admission-classify.js +17 -0
- package/dist/admission-classify.js.map +1 -0
- package/dist/diagnostic.d.ts +2 -2
- package/dist/diagnostic.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-config.d.ts +1 -0
- package/dist/mcp-config.d.ts.map +1 -1
- package/dist/mcp-config.js +5 -0
- package/dist/mcp-config.js.map +1 -1
- package/dist/provider.d.ts +28 -40
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +32 -61
- package/dist/provider.js.map +1 -1
- package/dist/runtime-deps.d.ts +7 -11
- package/dist/runtime-deps.d.ts.map +1 -1
- package/dist/runtime-session.d.ts +0 -9
- package/dist/runtime-session.d.ts.map +1 -1
- package/dist/runtime-session.js +0 -14
- package/dist/runtime-session.js.map +1 -1
- package/dist/runtime-submissions.d.ts +3 -4
- package/dist/runtime-submissions.d.ts.map +1 -1
- package/dist/runtime-submissions.js +0 -3
- package/dist/runtime-submissions.js.map +1 -1
- package/dist/runtime.d.ts +67 -34
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +175 -166
- package/dist/runtime.js.map +1 -1
- package/package.json +3 -3
- package/dist/source-reservation.d.ts +0 -6
- package/dist/source-reservation.d.ts.map +0 -1
- package/dist/source-reservation.js +0 -48
- package/dist/source-reservation.js.map +0 -1
- package/dist/transcript/budget.d.ts +0 -8
- package/dist/transcript/budget.d.ts.map +0 -1
- package/dist/transcript/budget.js +0 -9
- package/dist/transcript/budget.js.map +0 -1
- package/dist/transcript/completion.d.ts +0 -8
- package/dist/transcript/completion.d.ts.map +0 -1
- package/dist/transcript/completion.js +0 -57
- package/dist/transcript/completion.js.map +0 -1
- package/dist/transcript/cursor.d.ts.map +0 -1
- package/dist/transcript/cursor.js.map +0 -1
- package/dist/transcript/error.d.ts +0 -9
- package/dist/transcript/error.d.ts.map +0 -1
- package/dist/transcript/error.js +0 -9
- package/dist/transcript/error.js.map +0 -1
- package/dist/transcript/native-hash.d.ts.map +0 -1
- package/dist/transcript/native-hash.js.map +0 -1
- package/dist/transcript/opened-file.d.ts.map +0 -1
- package/dist/transcript/opened-file.js.map +0 -1
- package/dist/transcript/parallel-tools.d.ts +0 -6
- package/dist/transcript/parallel-tools.d.ts.map +0 -1
- package/dist/transcript/parallel-tools.js.map +0 -1
- package/dist/transcript/path.d.ts +0 -25
- package/dist/transcript/path.d.ts.map +0 -1
- package/dist/transcript/path.js.map +0 -1
- package/dist/transcript/reader.d.ts +0 -7
- package/dist/transcript/reader.d.ts.map +0 -1
- package/dist/transcript/reader.js.map +0 -1
- package/dist/transcript/rewrites.d.ts.map +0 -1
- package/dist/transcript/rewrites.js.map +0 -1
- /package/dist/{transcript → activity}/native-hash.d.ts +0 -0
- /package/dist/{transcript → activity}/native-hash.js +0 -0
- /package/dist/{transcript → activity}/parallel-tools.js +0 -0
- /package/dist/{transcript → activity}/rewrites.d.ts +0 -0
- /package/dist/{transcript → activity}/rewrites.js +0 -0
package/dist/provider.d.ts
CHANGED
|
@@ -1,66 +1,54 @@
|
|
|
1
1
|
import type { ClaudeCodeRuntimeDeps } from './runtime-deps.js';
|
|
2
2
|
import { dispatcherClaudeCodeConfig, type DispatcherClaudeCodeConfig } from './config.js';
|
|
3
3
|
import { type ClaudeCodeSessionFactory } from './supervisor.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AgentRuntimeProvider, AgentRuntimeProviderCapabilities, AgentRuntimeProviderFactory, AgentRuntimeSessionRef } from '@excitedjs/dreamux-types';
|
|
5
5
|
/**
|
|
6
|
-
* Construction options for the built-in Claude Code provider. Env injection
|
|
6
|
+
* Construction options for the built-in Claude Code provider. Env injection
|
|
7
7
|
* arrives on the NEUTRAL create context (`context.injectEnv`), not as a factory
|
|
8
|
-
* hook
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* hook, and registration identity is Core's: the provider carries no
|
|
9
|
+
* descriptor. What remains here are the test/host seams (the resident-session
|
|
10
|
+
* factory, an optional host bin resolver) that let core and tests wire behavior
|
|
11
|
+
* without changing the provider.
|
|
11
12
|
*/
|
|
12
13
|
export interface ClaudeCodeAgentRuntimeProviderOptions {
|
|
13
|
-
/**
|
|
14
|
-
* The registry descriptor for `builtin:claude-code`. Defaults to a minimal
|
|
15
|
-
* one. Accepted wide (`ProviderDescriptor`) so a host that resolved it from
|
|
16
|
-
* its registry need not pre-narrow the kind; the factory validates it is an
|
|
17
|
-
* `agentRuntime` descriptor.
|
|
18
|
-
*/
|
|
19
|
-
descriptor?: ProviderDescriptor;
|
|
20
14
|
/** Optional host-level bin resolver (default: identity on the config bin). */
|
|
21
15
|
resolveBinPath?: (bin: string) => string;
|
|
22
16
|
/** Override the resident-session factory (tests inject a fake). */
|
|
23
17
|
sessionFactory?: ClaudeCodeSessionFactory;
|
|
24
18
|
/** Override native session UUID generation for deterministic tests. */
|
|
25
19
|
generateSessionId?: ClaudeCodeRuntimeDeps['generateSessionId'];
|
|
26
|
-
/** Override native transcript path resolution for deterministic tests. */
|
|
27
|
-
resolveTranscriptPath?: ClaudeCodeRuntimeDeps['resolveTranscriptPath'];
|
|
28
20
|
}
|
|
29
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Provider-static selection metadata. Recovery, session-bound structured
|
|
23
|
+
* output, and recent Activity reads are mandatory provider behavior, so none of
|
|
24
|
+
* them is advertised here.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES: AgentRuntimeProviderCapabilities;
|
|
30
27
|
/**
|
|
31
28
|
* Create the built-in Claude Code `AgentRuntimeProvider`. It implements the
|
|
32
|
-
* neutral `@excitedjs/dreamux-types` contract: `
|
|
33
|
-
* runtime config, `
|
|
34
|
-
* builds a {@link ClaudeCodeRuntime} from the
|
|
35
|
-
* host-supplied options.
|
|
29
|
+
* neutral `@excitedjs/dreamux-types` contract: `config.read` parses Claude Code
|
|
30
|
+
* runtime config, `readRecentActivity` serves neutral Activity Records for any
|
|
31
|
+
* session, and `createRuntime` builds a {@link ClaudeCodeRuntime} from the
|
|
32
|
+
* neutral create context plus the host-supplied options.
|
|
33
|
+
*
|
|
34
|
+
* Claude Code resumes from its native session id alone, so its session identity
|
|
35
|
+
* is the base {@link AgentRuntimeSessionRef}.
|
|
36
36
|
*/
|
|
37
|
-
export declare function createClaudeCodeAgentRuntimeProvider(options?: ClaudeCodeAgentRuntimeProviderOptions): AgentRuntimeProvider<DispatcherClaudeCodeConfig>;
|
|
37
|
+
export declare function createClaudeCodeAgentRuntimeProvider(options?: ClaudeCodeAgentRuntimeProviderOptions): AgentRuntimeProvider<DispatcherClaudeCodeConfig, AgentRuntimeSessionRef>;
|
|
38
38
|
/** Re-export the typed accessor for a runtime's resolved claude-code config. */
|
|
39
39
|
export { dispatcherClaudeCodeConfig };
|
|
40
|
-
/**
|
|
41
|
-
* The context Dreamux core's generic provider package-loader passes to this
|
|
42
|
-
* package's factory export. A back-compat alias of the public
|
|
43
|
-
* {@link ProviderFactoryContext}, narrowed to the Agent Runtime descriptor kind
|
|
44
|
-
* so the factory assigns `descriptor` without a cast.
|
|
45
|
-
*/
|
|
46
|
-
export type ClaudeCodeProviderFactoryContext = ProviderFactoryContext<AgentRuntimeProviderDescriptor>;
|
|
47
40
|
/**
|
|
48
41
|
* Default export — the factory Dreamux core's generic provider-loader selects
|
|
49
42
|
* for the `builtin:claude-code` ref (it imports this package and calls the
|
|
50
|
-
* default export with `{ ref
|
|
51
|
-
*
|
|
52
|
-
* and `process.env` base env.
|
|
43
|
+
* default export with `{ ref }`). It returns a provider on package defaults:
|
|
44
|
+
* the real resident-session factory and an identity bin resolver.
|
|
53
45
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* path context, and any role-gated skill sources; MCP shims receive an explicit
|
|
60
|
-
* dreamux bin path). This default export keeps the package a
|
|
61
|
-
* first-class, loadable `AgentRuntimeProvider` for the generic loader and for
|
|
62
|
-
* external embedders.
|
|
46
|
+
* This is the production path. Core drives the loaded provider through the
|
|
47
|
+
* neutral facade alone — it holds no adapter for this package — and supplies
|
|
48
|
+
* every host contract (state lease, path context, skill sources, MCP servers)
|
|
49
|
+
* through the neutral create context. The options argument of
|
|
50
|
+
* {@link createClaudeCodeAgentRuntimeProvider} exists for embedders and tests.
|
|
63
51
|
*/
|
|
64
|
-
declare const claudeCodeAgentRuntimeProviderFactory: AgentRuntimeProviderFactory<DispatcherClaudeCodeConfig>;
|
|
52
|
+
declare const claudeCodeAgentRuntimeProviderFactory: AgentRuntimeProviderFactory<DispatcherClaudeCodeConfig, AgentRuntimeSessionRef>;
|
|
65
53
|
export default claudeCodeAgentRuntimeProviderFactory;
|
|
66
54
|
//# sourceMappingURL=provider.d.ts.map
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAGzB,OAAO,KAAK,EAGV,oBAAoB,EACpB,gCAAgC,EAChC,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AASlC;;;;;;;GAOG;AACH,MAAM,WAAW,qCAAqC;IACpD,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;CAChE;AAED;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,EAAE,gCACvC,CAAC;AAEf;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,GAAE,qCAA0C,GAClD,oBAAoB,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAmE1E;AAED,gFAAgF;AAChF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,qCAAqC,EAAE,2BAA2B,CACtE,0BAA0B,EAC1B,sBAAsB,CACwB,CAAC;AAEjD,eAAe,qCAAqC,CAAC"}
|
package/dist/provider.js
CHANGED
|
@@ -1,49 +1,32 @@
|
|
|
1
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
|
-
import { BUILTIN_CLAUDE_CODE_PROVIDER_REF } from './provider-ref.js';
|
|
5
4
|
import { claudeCodeAgentRuntimeDiagnostic } from './diagnostic.js';
|
|
6
|
-
import {
|
|
5
|
+
import { readClaudeRecentActivity } from './activity/reader.js';
|
|
7
6
|
function normalizedSystemPromptAppend(append) {
|
|
8
7
|
const normalized = (append ?? []).filter((prompt) => prompt !== '');
|
|
9
8
|
return normalized.length > 0 ? normalized : undefined;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
kind: 'agentRuntime',
|
|
18
|
-
ref: {
|
|
19
|
-
source: 'builtin',
|
|
20
|
-
id: 'claude-code',
|
|
21
|
-
raw: BUILTIN_CLAUDE_CODE_PROVIDER_REF,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
/** Validate + narrow a seed descriptor to the Agent Runtime kind. */
|
|
25
|
-
function asAgentRuntimeDescriptor(descriptor) {
|
|
26
|
-
if (descriptor.kind !== 'agentRuntime') {
|
|
27
|
-
throw new Error(`@excitedjs/agent-runtime-claude-code: descriptor.kind must be ` +
|
|
28
|
-
`'agentRuntime' (got ${JSON.stringify(descriptor.kind)})`);
|
|
29
|
-
}
|
|
30
|
-
return { ...descriptor, kind: descriptor.kind };
|
|
31
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* Provider-static selection metadata. Recovery, session-bound structured
|
|
12
|
+
* output, and recent Activity reads are mandatory provider behavior, so none of
|
|
13
|
+
* them is advertised here.
|
|
14
|
+
*/
|
|
15
|
+
export const CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES = { tags: [] };
|
|
32
16
|
/**
|
|
33
17
|
* Create the built-in Claude Code `AgentRuntimeProvider`. It implements the
|
|
34
|
-
* neutral `@excitedjs/dreamux-types` contract: `
|
|
35
|
-
* runtime config, `
|
|
36
|
-
* builds a {@link ClaudeCodeRuntime} from the
|
|
37
|
-
* host-supplied options.
|
|
18
|
+
* neutral `@excitedjs/dreamux-types` contract: `config.read` parses Claude Code
|
|
19
|
+
* runtime config, `readRecentActivity` serves neutral Activity Records for any
|
|
20
|
+
* session, and `createRuntime` builds a {@link ClaudeCodeRuntime} from the
|
|
21
|
+
* neutral create context plus the host-supplied options.
|
|
22
|
+
*
|
|
23
|
+
* Claude Code resumes from its native session id alone, so its session identity
|
|
24
|
+
* is the base {@link AgentRuntimeSessionRef}.
|
|
38
25
|
*/
|
|
39
26
|
export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
40
27
|
const sessionFactory = options.sessionFactory ?? createDefaultClaudeCodeSession;
|
|
41
28
|
const resolveBinPath = options.resolveBinPath ?? ((bin) => bin);
|
|
42
29
|
return {
|
|
43
|
-
ref: BUILTIN_CLAUDE_CODE_PROVIDER_REF,
|
|
44
|
-
descriptor: options.descriptor === undefined
|
|
45
|
-
? DEFAULT_CLAUDE_CODE_DESCRIPTOR
|
|
46
|
-
: asAgentRuntimeDescriptor(options.descriptor),
|
|
47
30
|
getCapabilities: () => CLAUDE_CODE_AGENT_RUNTIME_CAPABILITIES,
|
|
48
31
|
diagnostic: claudeCodeAgentRuntimeDiagnostic,
|
|
49
32
|
onboard: {
|
|
@@ -56,23 +39,19 @@ export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
|
56
39
|
return { bin };
|
|
57
40
|
},
|
|
58
41
|
},
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
config: {
|
|
43
|
+
read(rawConfig, context) {
|
|
44
|
+
return readDispatcherClaudeCodeConfig(rawConfig, context.file, context.prefix);
|
|
45
|
+
},
|
|
61
46
|
},
|
|
62
|
-
|
|
63
|
-
createRuntime(context) {
|
|
64
|
-
if (context.state === undefined) {
|
|
65
|
-
throw new Error('claude-code runtime requires a state sink in the create context');
|
|
66
|
-
}
|
|
67
|
-
if (context.paths === undefined) {
|
|
68
|
-
throw new Error('claude-code runtime requires a path context in the create context');
|
|
69
|
-
}
|
|
47
|
+
readRecentActivity: (query, context) => readClaudeRecentActivity(query, context),
|
|
48
|
+
async createRuntime(context) {
|
|
70
49
|
const systemPromptAppend = normalizedSystemPromptAppend(context.systemPrompt?.append);
|
|
71
50
|
const deps = {
|
|
72
51
|
config: context.config,
|
|
73
52
|
cwd: context.cwd,
|
|
74
53
|
state: context.state,
|
|
75
|
-
activitySink: context.
|
|
54
|
+
activitySink: context.activity ?? (() => undefined),
|
|
76
55
|
paths: context.paths,
|
|
77
56
|
mcpServers: context.mcpServers,
|
|
78
57
|
sessionFactory,
|
|
@@ -83,16 +62,13 @@ export function createClaudeCodeAgentRuntimeProvider(options = {}) {
|
|
|
83
62
|
...(context.skillSources !== undefined
|
|
84
63
|
? { skillSources: context.skillSources }
|
|
85
64
|
: {}),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
65
|
+
// Neutral seam name in, provider-native name out: `disableFeatures` is
|
|
66
|
+
// this package's own internal wording and stops at the adapter.
|
|
67
|
+
disableFeatures: context.disabledFeatures,
|
|
89
68
|
outputSchema: context.outputSchema,
|
|
90
69
|
...(options.generateSessionId !== undefined
|
|
91
70
|
? { generateSessionId: options.generateSessionId }
|
|
92
71
|
: {}),
|
|
93
|
-
...(options.resolveTranscriptPath !== undefined
|
|
94
|
-
? { resolveTranscriptPath: options.resolveTranscriptPath }
|
|
95
|
-
: {}),
|
|
96
72
|
...(systemPromptAppend !== undefined
|
|
97
73
|
? { systemPromptAppend }
|
|
98
74
|
: {}),
|
|
@@ -107,20 +83,15 @@ export { dispatcherClaudeCodeConfig };
|
|
|
107
83
|
/**
|
|
108
84
|
* Default export — the factory Dreamux core's generic provider-loader selects
|
|
109
85
|
* for the `builtin:claude-code` ref (it imports this package and calls the
|
|
110
|
-
* default export with `{ ref
|
|
111
|
-
*
|
|
112
|
-
* and `process.env` base env.
|
|
86
|
+
* default export with `{ ref }`). It returns a provider on package defaults:
|
|
87
|
+
* the real resident-session factory and an identity bin resolver.
|
|
113
88
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* path context, and any role-gated skill sources; MCP shims receive an explicit
|
|
120
|
-
* dreamux bin path). This default export keeps the package a
|
|
121
|
-
* first-class, loadable `AgentRuntimeProvider` for the generic loader and for
|
|
122
|
-
* external embedders.
|
|
89
|
+
* This is the production path. Core drives the loaded provider through the
|
|
90
|
+
* neutral facade alone — it holds no adapter for this package — and supplies
|
|
91
|
+
* every host contract (state lease, path context, skill sources, MCP servers)
|
|
92
|
+
* through the neutral create context. The options argument of
|
|
93
|
+
* {@link createClaudeCodeAgentRuntimeProvider} exists for embedders and tests.
|
|
123
94
|
*/
|
|
124
|
-
const claudeCodeAgentRuntimeProviderFactory = (
|
|
95
|
+
const claudeCodeAgentRuntimeProviderFactory = () => createClaudeCodeAgentRuntimeProvider();
|
|
125
96
|
export default claudeCodeAgentRuntimeProviderFactory;
|
|
126
97
|
//# sourceMappingURL=provider.js.map
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,iBAAiB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAUhE,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,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAmBD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GACjD,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAM,UAAU,oCAAoC,CAClD,UAAiD,EAAE;IAEnD,MAAM,cAAc,GAClB,OAAO,CAAC,cAAc,IAA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C,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;oBAClC,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS;oBACpC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE;oBACxC,CAAC,CAAC,EAAE,CAAC;gBACP,uEAAuE;gBACvE,gEAAgE;gBAChE,eAAe,EAAE,OAAO,CAAC,gBAAgB;gBACzC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,GAAG,CAAC,OAAO,CAAC,iBAAiB,KAAK,SAAS;oBACzC,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;oBAClD,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,kBAAkB,KAAK,SAAS;oBAClC,CAAC,CAAC,EAAE,kBAAkB,EAAE;oBACxB,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE,CAAC;YACF,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,qCAAqC,GAGvC,GAAG,EAAE,CAAC,oCAAoC,EAAE,CAAC;AAEjD,eAAe,qCAAqC,CAAC"}
|
package/dist/runtime-deps.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { AgentRuntimeMcpServer, AgentRuntimePathContext, AgentRuntimeSkillSource,
|
|
1
|
+
import type { AgentRuntimeActivitySink, AgentRuntimeMcpServer, AgentRuntimePathContext, AgentRuntimeSessionRef, AgentRuntimeSkillSource, AgentRuntimeStateSink, DreamuxLogger } from '@excitedjs/dreamux-types';
|
|
2
2
|
import type { DispatcherClaudeCodeConfig } from './config.js';
|
|
3
3
|
import type { ClaudeCodeSessionFactory } from './supervisor.js';
|
|
4
4
|
/** Neutral host capabilities required by one resident Claude Code runtime. */
|
|
5
5
|
export interface ClaudeCodeRuntimeDeps {
|
|
6
6
|
config: DispatcherClaudeCodeConfig;
|
|
7
7
|
cwd: string;
|
|
8
|
-
state:
|
|
8
|
+
state: AgentRuntimeStateSink<AgentRuntimeSessionRef>;
|
|
9
9
|
paths: AgentRuntimePathContext;
|
|
10
10
|
mcpServers: readonly AgentRuntimeMcpServer[];
|
|
11
11
|
sessionFactory: ClaudeCodeSessionFactory;
|
|
@@ -14,17 +14,13 @@ export interface ClaudeCodeRuntimeDeps {
|
|
|
14
14
|
systemPromptAppend?: readonly string[];
|
|
15
15
|
skillSources?: readonly AgentRuntimeSkillSource[];
|
|
16
16
|
disableFeatures?: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* The session-bound output schema, applied at spawn via `--json-schema`. It is
|
|
19
|
+
* fixed for the life of this runtime; no submission can change it.
|
|
20
|
+
*/
|
|
17
21
|
outputSchema?: Record<string, unknown>;
|
|
18
22
|
generateSessionId?: () => string;
|
|
19
|
-
resolveTranscriptPath?: (input: {
|
|
20
|
-
sessionId: string;
|
|
21
|
-
cwd: string;
|
|
22
|
-
locator: string | null;
|
|
23
|
-
env: NodeJS.ProcessEnv;
|
|
24
|
-
resume: boolean;
|
|
25
|
-
}) => Promise<string>;
|
|
26
|
-
sourceIdDedupeWindow?: number;
|
|
27
23
|
logger?: DreamuxLogger;
|
|
28
|
-
activitySink:
|
|
24
|
+
activitySink: AgentRuntimeActivitySink;
|
|
29
25
|
}
|
|
30
26
|
//# sourceMappingURL=runtime-deps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-deps.d.ts","sourceRoot":"","sources":["../src/runtime-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"runtime-deps.d.ts","sourceRoot":"","sources":["../src/runtime-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,0BAA0B,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;IACrD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,UAAU,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC7C,cAAc,EAAE,wBAAwB,CAAC;IACzC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAClD,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,wBAAwB,CAAC;CACxC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { TurnOutcome } from './supervisor.js';
|
|
2
|
-
export interface ResolveRuntimeTranscriptPathInput {
|
|
3
|
-
sessionId: string;
|
|
4
|
-
cwd: string;
|
|
5
|
-
locator: string | null;
|
|
6
|
-
env: NodeJS.ProcessEnv;
|
|
7
|
-
resume: boolean;
|
|
8
|
-
override?: (input: Omit<ResolveRuntimeTranscriptPathInput, 'override'>) => Promise<string>;
|
|
9
|
-
}
|
|
10
2
|
export declare function buildClaudeProcessEnv(injectEnv: Record<string, string> | undefined, extraEnv: Record<string, string>): NodeJS.ProcessEnv;
|
|
11
|
-
export declare function resolveRuntimeTranscriptPath(input: ResolveRuntimeTranscriptPathInput): Promise<string>;
|
|
12
3
|
export declare function resultTextFromTurnOutcome(outcome: TurnOutcome, expectedSessionId: string | null, requiresStructuredOutput: boolean): string | null;
|
|
13
4
|
//# sourceMappingURL=runtime-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-session.d.ts","sourceRoot":"","sources":["../src/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-session.d.ts","sourceRoot":"","sources":["../src/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,MAAM,CAAC,UAAU,CAMnB;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,WAAW,EACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,wBAAwB,EAAE,OAAO,GAChC,MAAM,GAAG,IAAI,CA0Bf"}
|
package/dist/runtime-session.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { deriveClaudeTranscriptPath, locateClaudeTranscript, } from './transcript/path.js';
|
|
2
1
|
export function buildClaudeProcessEnv(injectEnv, extraEnv) {
|
|
3
2
|
return {
|
|
4
3
|
...globalThis.process.env,
|
|
@@ -6,19 +5,6 @@ export function buildClaudeProcessEnv(injectEnv, extraEnv) {
|
|
|
6
5
|
...extraEnv,
|
|
7
6
|
};
|
|
8
7
|
}
|
|
9
|
-
export function resolveRuntimeTranscriptPath(input) {
|
|
10
|
-
const { override, ...pathInput } = input;
|
|
11
|
-
if (override !== undefined)
|
|
12
|
-
return override(pathInput);
|
|
13
|
-
return input.resume
|
|
14
|
-
? locateClaudeTranscript({
|
|
15
|
-
sessionId: input.sessionId,
|
|
16
|
-
cwd: input.cwd,
|
|
17
|
-
locator: input.locator,
|
|
18
|
-
env: input.env,
|
|
19
|
-
}).then((located) => located.path)
|
|
20
|
-
: deriveClaudeTranscriptPath(input.sessionId, input.cwd, input.env);
|
|
21
|
-
}
|
|
22
8
|
export function resultTextFromTurnOutcome(outcome, expectedSessionId, requiresStructuredOutput) {
|
|
23
9
|
if (outcome.sessionId !== null &&
|
|
24
10
|
outcome.sessionId !== '' &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-session.js","sourceRoot":"","sources":["../src/runtime-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-session.js","sourceRoot":"","sources":["../src/runtime-session.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CACnC,SAA6C,EAC7C,QAAgC;IAEhC,OAAO;QACL,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG;QACzB,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;QACpB,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAoB,EACpB,iBAAgC,EAChC,wBAAiC;IAEjC,IACE,OAAO,CAAC,SAAS,KAAK,IAAI;QAC1B,OAAO,CAAC,SAAS,KAAK,EAAE;QACxB,OAAO,CAAC,SAAS,KAAK,iBAAiB,EACvC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GACd,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/D,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,yCAAyC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,wBAAwB,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,qDAAqD;YACnD,uBAAuB,CAC1B,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClaudeCodeSession } from './supervisor.js';
|
|
2
|
-
import type { ClaudeProtocolEvent
|
|
3
|
-
import type { JsonValue,
|
|
2
|
+
import type { ClaudeProtocolEvent } from './types.js';
|
|
3
|
+
import type { JsonValue, AgentRuntimeActivitySink, RuntimeSubmission, RuntimeSubmissionSettlement } from '@excitedjs/dreamux-types';
|
|
4
4
|
export interface SubmissionDeferred {
|
|
5
5
|
submission: RuntimeSubmission;
|
|
6
6
|
settle: (settlement: RuntimeSubmissionSettlement) => boolean;
|
|
@@ -21,12 +21,11 @@ export interface ActiveTurn {
|
|
|
21
21
|
rejectSession: (error: Error) => void;
|
|
22
22
|
steerQueue: Promise<void>;
|
|
23
23
|
generation: number;
|
|
24
|
-
submitOptions?: TurnSubmitOptions;
|
|
25
24
|
}
|
|
26
25
|
export interface ProtocolEventContext {
|
|
27
26
|
threadId: string | null;
|
|
28
27
|
outputSchemaEnabled: boolean;
|
|
29
|
-
activitySink:
|
|
28
|
+
activitySink: AgentRuntimeActivitySink;
|
|
30
29
|
log: (level: 'info' | 'warn' | 'error', message: string, error?: unknown) => void;
|
|
31
30
|
}
|
|
32
31
|
export declare function createRuntimeSubmission(): SubmissionDeferred;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-submissions.d.ts","sourceRoot":"","sources":["../src/runtime-submissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAe,
|
|
1
|
+
{"version":3,"file":"runtime-submissions.d.ts","sourceRoot":"","sources":["../src/runtime-submissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EACV,SAAS,EAET,wBAAwB,EAExB,iBAAiB,EACjB,2BAA2B,EAE5B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,OAAO,CAAC;CAC9D;AAED,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAClE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzC,cAAc,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,YAAY,EAAE,wBAAwB,CAAC;IACvC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACnF;AAED,wBAAgB,uBAAuB,IAAI,kBAAkB,CAiB5D;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CAkBN"}
|
|
@@ -63,7 +63,6 @@ function completeStartedGroup(active, outcome, context) {
|
|
|
63
63
|
if (outcome.isError) {
|
|
64
64
|
completion = Object.freeze({
|
|
65
65
|
status: 'failed',
|
|
66
|
-
displaySubmission: representative.submission,
|
|
67
66
|
error: new Error(outcome.errors.join('; ') || outcome.subtype || 'claude turn failed'),
|
|
68
67
|
});
|
|
69
68
|
}
|
|
@@ -71,7 +70,6 @@ function completeStartedGroup(active, outcome, context) {
|
|
|
71
70
|
try {
|
|
72
71
|
completion = Object.freeze({
|
|
73
72
|
status: 'completed',
|
|
74
|
-
displaySubmission: representative.submission,
|
|
75
73
|
resultText: resultTextFromTurnOutcome(outcome, context.threadId, context.outputSchemaEnabled),
|
|
76
74
|
truncated: false,
|
|
77
75
|
});
|
|
@@ -79,7 +77,6 @@ function completeStartedGroup(active, outcome, context) {
|
|
|
79
77
|
catch (error) {
|
|
80
78
|
completion = Object.freeze({
|
|
81
79
|
status: 'failed',
|
|
82
|
-
displaySubmission: representative.submission,
|
|
83
80
|
error: asError(error),
|
|
84
81
|
});
|
|
85
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-submissions.js","sourceRoot":"","sources":["../src/runtime-submissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-submissions.js","sourceRoot":"","sources":["../src/runtime-submissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAwCjE,MAAM,UAAU,uBAAuB;IACrC,IAAI,OAA2D,CAAC;IAChE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,OAAO,EAAE,IAAI,OAAO,CAA8B,CAAC,KAAK,EAAE,EAAE;YAC1D,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC,CAAC;KACH,CAAC,CAAC;IACH,OAAO;QACL,UAAU;QACV,MAAM,CAAC,UAAU;YACf,IAAI,OAAO;gBAAE,OAAO,KAAK,CAAC;YAC1B,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,CAAC,UAAU,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,MAAkB,EAClB,KAA0B,EAC1B,OAA6B;IAE7B,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACvC,IACE,KAAK,CAAC,KAAK,KAAK,SAAS;YACzB,MAAM,CAAC,WAAW,CAAC,GAAG,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AAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAc,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/** Resident Claude Code AgentRuntime using stream-json stdio. */
|
|
2
2
|
import type { ClaudeCodeRuntimeDeps } from './runtime-deps.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AgentRuntime, AgentRuntimeIdentity, AgentRuntimeSessionRef, AgentRuntimeStartOutcome, AgentRuntimeSubmissionInput, RuntimeAdmission } from '@excitedjs/dreamux-types';
|
|
4
4
|
/**
|
|
5
5
|
* The Claude Code agent runtime for one dispatcher. A single resident
|
|
6
6
|
* stream-json child serves every turn. Turns run serially (one at a time) and
|
|
7
|
-
* `
|
|
7
|
+
* `submit` returns after the message is accepted — not after the turn
|
|
8
8
|
* completes — matching the Codex runtime's submit-then-serialize contract.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ClaudeCodeRuntime implements AgentRuntime {
|
|
11
11
|
private readonly deps;
|
|
12
|
-
readonly providerRef = "builtin:claude-code";
|
|
13
12
|
private readonly dispatcherId;
|
|
14
13
|
private readonly config;
|
|
15
14
|
private readonly bin;
|
|
@@ -20,17 +19,16 @@ export declare class ClaudeCodeRuntime implements AgentRuntime {
|
|
|
20
19
|
private readonly logger;
|
|
21
20
|
private status;
|
|
22
21
|
private threadId;
|
|
23
|
-
private transcriptLocator;
|
|
24
22
|
private resumeOnNextSpawn;
|
|
25
|
-
private resumed;
|
|
23
|
+
private readonly resumed;
|
|
24
|
+
/**
|
|
25
|
+
* The provider-local fatal path for authoritative state writes. Any failure
|
|
26
|
+
* to persist — a revoked lease or a plain write failure — fences input and
|
|
27
|
+
* tears the resident child down; the runtime never continues on a state
|
|
28
|
+
* record it could not update.
|
|
29
|
+
*/
|
|
30
|
+
private readonly fence;
|
|
26
31
|
private stopped;
|
|
27
|
-
private readonly seen;
|
|
28
|
-
private readonly seenOrder;
|
|
29
|
-
private readonly seenTextInputIds;
|
|
30
|
-
private readonly seenTextInputIdOrder;
|
|
31
|
-
private readonly sourceIdDedupeWindow;
|
|
32
|
-
private readonly pendingChannelSources;
|
|
33
|
-
private readonly pendingTextSources;
|
|
34
32
|
private readonly pendingAdmissions;
|
|
35
33
|
private queue;
|
|
36
34
|
private session;
|
|
@@ -40,32 +38,35 @@ export declare class ClaudeCodeRuntime implements AgentRuntime {
|
|
|
40
38
|
private generation;
|
|
41
39
|
private activeTurn;
|
|
42
40
|
private queuedTurnCount;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
transcript_locator?: string | null;
|
|
51
|
-
} | null;
|
|
52
|
-
wasCheckpointResumed(): boolean;
|
|
53
|
-
getContext(): Promise<null>;
|
|
54
|
-
resume(): Promise<void>;
|
|
55
|
-
start(): Promise<void>;
|
|
41
|
+
constructor(identity: AgentRuntimeIdentity<AgentRuntimeSessionRef>, deps: ClaudeCodeRuntimeDeps);
|
|
42
|
+
start(): Promise<AgentRuntimeStartOutcome>;
|
|
43
|
+
/**
|
|
44
|
+
* Recovery is continuous by contract: when a prior session exists the child is
|
|
45
|
+
* always spawned with `--resume`, and a failed resume propagates out of
|
|
46
|
+
* `start` rather than silently becoming a fresh session.
|
|
47
|
+
*/
|
|
56
48
|
private startRuntime;
|
|
49
|
+
private startOutcome;
|
|
57
50
|
stop(): Promise<void>;
|
|
51
|
+
/** Single-flight the stop task, releasing the slot so a failure can retry. */
|
|
52
|
+
private track;
|
|
53
|
+
/**
|
|
54
|
+
* Converge a stop that arrived after the fence already started the fatal
|
|
55
|
+
* teardown. A teardown that succeeded left the runtime stopped; one that
|
|
56
|
+
* failed retained the resident session, so this retries against that retained
|
|
57
|
+
* authority and rejects if the retry fails too.
|
|
58
|
+
*/
|
|
59
|
+
private stopAfterFatalTeardown;
|
|
58
60
|
private stopRuntime;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Admit one already-rendered submission. The runtime holds no source ledger:
|
|
63
|
+
* the text is the complete model-facing message, and deduplication is Core's,
|
|
64
|
+
* ahead of this call.
|
|
65
|
+
*/
|
|
66
|
+
submit(input: AgentRuntimeSubmissionInput): Promise<RuntimeAdmission>;
|
|
65
67
|
private acceptInput;
|
|
66
68
|
private trackAdmission;
|
|
67
69
|
private drainAdmissions;
|
|
68
|
-
waitIdle(): Promise<void>;
|
|
69
70
|
private runActiveTurnOnQueue;
|
|
70
71
|
private runActiveTurn;
|
|
71
72
|
private steerActiveTurn;
|
|
@@ -74,15 +75,47 @@ export declare class ClaudeCodeRuntime implements AgentRuntime {
|
|
|
74
75
|
private stopUnsettled;
|
|
75
76
|
private recordQueuedTurnStart;
|
|
76
77
|
private recordQueuedTurnEnd;
|
|
77
|
-
private resolveIdleWaitersIfIdle;
|
|
78
78
|
/** Ensure a live resident session exists, resuming after a child exit. */
|
|
79
79
|
private ensureSession;
|
|
80
80
|
private createSession;
|
|
81
|
-
private resolveTranscriptPath;
|
|
82
81
|
/** React to an unexpected resident-child exit: degrade and drop the session. */
|
|
83
82
|
private onSessionExit;
|
|
84
83
|
private onProtocolEvent;
|
|
85
84
|
private assertGeneration;
|
|
85
|
+
/**
|
|
86
|
+
* The fence's native teardown. Deliberately not `stop()`: `stop()` publishes
|
|
87
|
+
* `stopping`/`stopped` through the very sink that just proved unusable, so it
|
|
88
|
+
* would only produce a second failure. This closes the resident child and
|
|
89
|
+
* settles in-flight work, and nothing else.
|
|
90
|
+
*
|
|
91
|
+
* It runs synchronously up to its first await, so `stopped` and the bumped
|
|
92
|
+
* generation fence input immediately — a submit arriving after the fatal
|
|
93
|
+
* write is already refused.
|
|
94
|
+
*/
|
|
95
|
+
private terminateForFence;
|
|
96
|
+
private publishStatus;
|
|
97
|
+
/**
|
|
98
|
+
* Persist a status the caller's own outcome does not depend on, but whose
|
|
99
|
+
* ordering does: `stop` must not resolve before its terminal write lands,
|
|
100
|
+
* because Core keeps this generation's lease valid exactly until stop
|
|
101
|
+
* settles and a detached write would race the revocation that follows.
|
|
102
|
+
*
|
|
103
|
+
* The error is not rethrown. The fence has already made it terminal, and
|
|
104
|
+
* these callers report something else — whether the child terminated, or the
|
|
105
|
+
* original start failure — which a state-write failure does not change.
|
|
106
|
+
*/
|
|
107
|
+
private settleStatus;
|
|
108
|
+
/**
|
|
109
|
+
* Record a status on the background paths (turn failure, child exit).
|
|
110
|
+
*
|
|
111
|
+
* Core's durable state is the authority; this field is only the runtime's own
|
|
112
|
+
* lifecycle guard, and it is updated first so the guard stays correct even as
|
|
113
|
+
* the fence closes. The write itself is detached: it
|
|
114
|
+
* must not surface as an unhandled rejection on the shared event loop (#85),
|
|
115
|
+
* and a failure is already terminal through the fence, so there is nothing
|
|
116
|
+
* left for this caller to do about it. The start path awaits `publishStatus`
|
|
117
|
+
* instead, because the ready state must be durable before `start` resolves.
|
|
118
|
+
*/
|
|
86
119
|
private setStatus;
|
|
87
120
|
private log;
|
|
88
121
|
}
|