experimental-ash 0.24.2 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/docs/public/typescript-api.md +0 -12
- package/dist/src/channel/adapter.d.ts +5 -18
- package/dist/src/channel/adapter.js +2 -8
- package/dist/src/channel/cross-channel-receive.d.ts +10 -1
- package/dist/src/channel/cross-channel-receive.js +21 -3
- package/dist/src/channel/routes.d.ts +2 -1
- package/dist/src/channel/routes.js +6 -3
- package/dist/src/channel/schedule.js +2 -2
- package/dist/src/channel/types.d.ts +1 -1
- package/dist/src/chunks/{client-DLHAGI2g.js → client-BShLWzR6.js} +3 -3
- package/dist/src/chunks/compile-agent-75wLLW-E.js +5 -0
- package/dist/src/chunks/dev-authored-source-watcher-DqoJsDup.js +1 -0
- package/dist/src/chunks/host-JVy7fewA.js +70 -0
- package/dist/src/chunks/paths-DNjq5JOy.js +85 -0
- package/dist/src/chunks/{token-D98SQdvs.js → token-BOkIxJeV.js} +1 -1
- package/dist/src/chunks/types-CjIyrcYo.js +1 -0
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +0 -5
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/repl.d.ts +1 -1
- package/dist/src/cli/dev/repl.js +3 -3
- package/dist/src/cli/run.d.ts +0 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/message-reducer.js +13 -25
- package/dist/src/client/message-response.d.ts +2 -1
- package/dist/src/client/open-stream.d.ts +3 -3
- package/dist/src/client/open-stream.js +1 -2
- package/dist/src/client/session.d.ts +2 -1
- package/dist/src/client/session.js +0 -3
- package/dist/src/client/types.d.ts +3 -2
- package/dist/src/compiler/artifacts.d.ts +7 -10
- package/dist/src/compiler/artifacts.js +3 -3
- package/dist/src/compiler/manifest.d.ts +6 -15
- package/dist/src/compiler/manifest.js +3 -3
- package/dist/src/compiler/normalize-agent-config.js +12 -10
- package/dist/src/compiler/normalize-manifest.js +3 -2
- package/dist/src/context/container.d.ts +1 -16
- package/dist/src/context/container.js +1 -24
- package/dist/src/context/hook-lifecycle.d.ts +2 -7
- package/dist/src/context/hook-lifecycle.js +0 -6
- package/dist/src/context/provider.d.ts +1 -11
- package/dist/src/context/providers/sandbox.js +4 -1
- package/dist/src/context/run-step.d.ts +2 -4
- package/dist/src/context/run-step.js +4 -17
- package/dist/src/context/seed-keys.d.ts +1 -1
- package/dist/src/discover/connections.d.ts +2 -1
- package/dist/src/discover/diagnostics.d.ts +0 -8
- package/dist/src/discover/diagnostics.js +4 -16
- package/dist/src/discover/discover-agent.d.ts +3 -13
- package/dist/src/discover/discover-agent.js +1 -11
- package/dist/src/discover/discover-subagent.d.ts +3 -2
- package/dist/src/discover/discover-subagent.js +1 -1
- package/dist/src/discover/filesystem.d.ts +0 -37
- package/dist/src/discover/filesystem.js +0 -115
- package/dist/src/discover/grammar.d.ts +10 -20
- package/dist/src/discover/grammar.js +11 -33
- package/dist/src/discover/lib.d.ts +3 -2
- package/dist/src/discover/manifest.d.ts +3 -3
- package/dist/src/discover/markdown.d.ts +2 -1
- package/dist/src/discover/sandbox.d.ts +2 -1
- package/dist/src/discover/schedules.d.ts +3 -2
- package/dist/src/discover/schedules.js +1 -1
- package/dist/src/discover/skills.d.ts +3 -2
- package/dist/src/discover/skills.js +1 -1
- package/dist/src/discover/slots.d.ts +3 -2
- package/dist/src/evals/cli/eval.d.ts +0 -6
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/loaders/index.d.ts +2 -22
- package/dist/src/evals/loaders/index.js +1 -1
- package/dist/src/evals/reporters/index.d.ts +2 -14
- package/dist/src/evals/reporters/index.js +1 -1
- package/dist/src/evals/runner/discover.d.ts +0 -6
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-case.d.ts +2 -1
- package/dist/src/evals/runner/execute-suite.d.ts +2 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/resolve-git-metadata.d.ts +3 -3
- package/dist/src/evals/scorers/autoevals-client.d.ts +2 -2
- package/dist/src/execution/connection-auth-steps.d.ts +1 -5
- package/dist/src/execution/connection-auth-steps.js +4 -5
- package/dist/src/execution/node-step.d.ts +1 -1
- package/dist/src/execution/skills/instructions.d.ts +2 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +1 -1
- package/dist/src/execution/subagent-tool.d.ts +0 -8
- package/dist/src/execution/subagent-tool.js +9 -16
- package/dist/src/execution/tool-compaction.js +0 -2
- package/dist/src/execution/turn-workflow.d.ts +1 -1
- package/dist/src/execution/turn-workflow.js +2 -2
- package/dist/src/execution/web-fetch/tool.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +17 -1
- package/dist/src/execution/workflow-steps.js +5 -6
- package/dist/src/harness/action-result-helpers.d.ts +0 -12
- package/dist/src/harness/action-result-helpers.js +1 -1
- package/dist/src/harness/emission.d.ts +2 -2
- package/dist/src/harness/execute-tool.d.ts +2 -1
- package/dist/src/harness/input-requests.d.ts +2 -1
- package/dist/src/harness/prompt-cache.d.ts +1 -9
- package/dist/src/harness/prompt-cache.js +0 -12
- package/dist/src/harness/runtime-actions.d.ts +2 -11
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +3 -2
- package/dist/src/harness/step-hooks.js +3 -7
- package/dist/src/harness/tool-loop.js +0 -2
- package/dist/src/harness/types.d.ts +1 -1
- package/dist/src/internal/application/package.js +2 -2
- package/dist/src/internal/application/runtime-compiled-artifacts-source.js +0 -1
- package/dist/src/internal/attachments/errors.d.ts +8 -2
- package/dist/src/internal/attachments/url-refs.d.ts +0 -1
- package/dist/src/internal/attachments/url-refs.js +1 -1
- package/dist/src/internal/authored-definition/channel.d.ts +0 -5
- package/dist/src/internal/authored-definition/channel.js +1 -10
- package/dist/src/internal/authored-definition/sandbox.d.ts +2 -1
- package/dist/src/internal/authored-definition/schema-backed.d.ts +3 -2
- package/dist/src/internal/authored-module-loader.d.ts +0 -6
- package/dist/src/internal/authored-module-loader.js +0 -9
- package/dist/src/internal/authored-module.d.ts +0 -4
- package/dist/src/internal/authored-module.js +0 -10
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +2 -10
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/{public → internal}/helpers/markdown.d.ts +2 -23
- package/dist/src/{public → internal}/helpers/markdown.js +1 -1
- package/dist/src/internal/logging.d.ts +2 -8
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +2 -2
- package/dist/src/internal/nitro/routes/channel-dispatch.js +2 -2
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +0 -1
- package/dist/src/internal/node-esm-compat-banner.d.ts +1 -1
- package/dist/src/internal/runtime-registry.d.ts +2 -1
- package/dist/src/{protocol → internal}/vercel-agent-summary.d.ts +1 -1
- package/dist/src/protocol/message.d.ts +0 -34
- package/dist/src/protocol/message.js +0 -30
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/slack/api.d.ts +1 -7
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/connections.d.ts +2 -6
- package/dist/src/public/channels/slack/hitl.d.ts +3 -2
- package/dist/src/public/channels/slack/inbound.d.ts +0 -35
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/defineChannel.d.ts +1 -1
- package/dist/src/public/definitions/defineChannel.js +1 -1
- package/dist/src/public/definitions/instructions.d.ts +0 -11
- package/dist/src/public/definitions/instructions.js +0 -5
- package/dist/src/public/definitions/tool.d.ts +3 -7
- package/dist/src/public/definitions/tool.js +1 -1
- package/dist/src/public/instructions/index.d.ts +1 -5
- package/dist/src/public/instructions/index.js +1 -3
- package/dist/src/public/tool-result-narrowing.d.ts +2 -1
- package/dist/src/react/use-ash-agent.d.ts +2 -1
- package/dist/src/react/use-ash-agent.js +1 -5
- package/dist/src/runtime/actions/types.d.ts +8 -50
- package/dist/src/runtime/actions/types.js +5 -21
- package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +2 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/channels/registry.js +3 -8
- package/dist/src/runtime/compiled-artifacts-source.d.ts +4 -11
- package/dist/src/runtime/compiled-artifacts-source.js +3 -7
- package/dist/src/runtime/connections/authorization-tokens.d.ts +1 -14
- package/dist/src/runtime/connections/authorization-tokens.js +2 -28
- package/dist/src/runtime/connections/principal-context.d.ts +3 -2
- package/dist/src/runtime/connections/validate-authorization.d.ts +0 -11
- package/dist/src/runtime/connections/validate-authorization.js +0 -16
- package/dist/src/runtime/framework-channels/index.d.ts +0 -1
- package/dist/src/runtime/framework-channels/index.js +1 -1
- package/dist/src/runtime/framework-tools/index.d.ts +2 -1
- package/dist/src/runtime/framework-tools/index.js +2 -1
- package/dist/src/runtime/framework-tools/skill.d.ts +0 -13
- package/dist/src/runtime/framework-tools/skill.js +1 -1
- package/dist/src/runtime/governance/auth/token-claims.d.ts +1 -16
- package/dist/src/runtime/governance/auth/token-claims.js +3 -3
- package/dist/src/runtime/governance/auth/types.d.ts +0 -4
- package/dist/src/runtime/governance/network/ip-allow-list.d.ts +0 -17
- package/dist/src/runtime/governance/network/ip-allow-list.js +0 -39
- package/dist/src/runtime/hooks/registry.d.ts +7 -4
- package/dist/src/runtime/hooks/registry.js +4 -2
- package/dist/src/runtime/loaders/bundled-artifacts.d.ts +0 -5
- package/dist/src/runtime/loaders/bundled-artifacts.js +0 -7
- package/dist/src/runtime/loaders/compile-metadata.d.ts +3 -10
- package/dist/src/runtime/loaders/compile-metadata.js +6 -8
- package/dist/src/runtime/loaders/manifest.d.ts +2 -2
- package/dist/src/runtime/loaders/manifest.js +4 -5
- package/dist/src/runtime/loaders/module-map.d.ts +2 -2
- package/dist/src/runtime/loaders/module-map.js +3 -4
- package/dist/src/runtime/prompt/compose.d.ts +2 -1
- package/dist/src/runtime/resolve-agent-graph.d.ts +2 -15
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/sandbox/keys.d.ts +2 -1
- package/dist/src/runtime/sandbox/registry.d.ts +3 -3
- package/dist/src/runtime/schedules/resolve-schedule.d.ts +3 -12
- package/dist/src/runtime/schedules/resolve-schedule.js +1 -1
- package/dist/src/runtime/sessions/auth.d.ts +2 -13
- package/dist/src/runtime/sessions/auth.js +1 -11
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/sessions/runtime-session.d.ts +0 -6
- package/dist/src/runtime/sessions/runtime-session.js +0 -13
- package/dist/src/runtime/sessions/turn.d.ts +2 -2
- package/dist/src/runtime/subagents/registry.d.ts +2 -5
- package/dist/src/runtime/subagents/registry.js +0 -6
- package/dist/src/runtime/tools/registry.d.ts +2 -1
- package/dist/src/runtime/tools/registry.js +1 -4
- package/dist/src/runtime/types.d.ts +4 -3
- package/dist/src/runtime/workspace/seed-files.d.ts +2 -1
- package/dist/src/services/dev-client/request-headers.d.ts +37 -8
- package/dist/src/services/dev-client/request-headers.js +71 -46
- package/dist/src/services/dev-client/stream.d.ts +0 -19
- package/dist/src/services/dev-client/stream.js +0 -37
- package/dist/src/services/dev-client/url.d.ts +3 -7
- package/dist/src/services/dev-client/url.js +4 -10
- package/dist/src/services/dev-client.d.ts +0 -12
- package/dist/src/services/dev-client.js +6 -92
- package/dist/src/shared/agent-definition.d.ts +1 -1
- package/dist/src/shared/json.d.ts +0 -4
- package/dist/src/shared/json.js +0 -38
- package/dist/src/shared/skill-definition.d.ts +0 -2
- package/package.json +1 -6
- package/dist/src/chunks/dev-authored-source-watcher-CBID_Dwh.js +0 -1
- package/dist/src/chunks/host-zBy9FyyX.js +0 -70
- package/dist/src/chunks/package-HUaeub_D.js +0 -1
- package/dist/src/chunks/paths-CebY5GCi.js +0 -89
- package/dist/src/chunks/types-DDA2QUED.js +0 -1
- package/dist/src/compiler/resource-files.d.ts +0 -19
- package/dist/src/compiler/resource-files.js +0 -28
- package/dist/src/execution/subagent-invocation.d.ts +0 -19
- package/dist/src/execution/subagent-invocation.js +0 -17
- package/dist/src/execution/task-mode.d.ts +0 -9
- package/dist/src/execution/task-mode.js +0 -12
- package/dist/src/execution/types.d.ts +0 -20
- package/dist/src/execution/types.js +0 -1
- package/dist/src/internal/logical-paths.d.ts +0 -13
- package/dist/src/internal/logical-paths.js +0 -25
- package/dist/src/runtime/sessions/messages.d.ts +0 -140
- package/dist/src/runtime/sessions/messages.js +0 -170
- package/dist/src/runtime/standard-schema.d.ts +0 -27
- package/dist/src/runtime/standard-schema.js +0 -64
- package/dist/src/services/dev-client/live-stream.d.ts +0 -35
- package/dist/src/services/dev-client/live-stream.js +0 -157
- package/dist/src/services/dev-client/send-message.d.ts +0 -24
- package/dist/src/services/dev-client/send-message.js +0 -185
- package/dist/src/services/dev-client/session.d.ts +0 -54
- package/dist/src/services/dev-client/session.js +0 -52
- package/dist/src/services/host.d.ts +0 -14
- package/dist/src/services/host.js +0 -13
- /package/dist/src/{package-name.d.ts → internal/package-name.d.ts} +0 -0
- /package/dist/src/{package-name.js → internal/package-name.js} +0 -0
- /package/dist/src/{protocol → internal}/vercel-agent-summary.js +0 -0
- /package/dist/src/{run-mode.d.ts → shared/run-mode.d.ts} +0 -0
- /package/dist/src/{run-mode.js → shared/run-mode.js} +0 -0
|
@@ -82,7 +82,7 @@ function reduceMessageData(data, event) {
|
|
|
82
82
|
state: "input-available",
|
|
83
83
|
stepIndex: event.data.stepIndex,
|
|
84
84
|
toolCallId: action.callId,
|
|
85
|
-
toolMetadata: createToolMetadata(descriptor
|
|
85
|
+
toolMetadata: createToolMetadata(descriptor),
|
|
86
86
|
toolName: descriptor.toolName,
|
|
87
87
|
type: "dynamic-tool",
|
|
88
88
|
}));
|
|
@@ -101,7 +101,7 @@ function reduceMessageData(data, event) {
|
|
|
101
101
|
state: "approval-requested",
|
|
102
102
|
stepIndex: event.data.stepIndex,
|
|
103
103
|
toolCallId: request.action.callId,
|
|
104
|
-
toolMetadata: createToolMetadata(descriptor,
|
|
104
|
+
toolMetadata: createToolMetadata(descriptor, {
|
|
105
105
|
inputRequest: toMessageInputRequest(request),
|
|
106
106
|
}),
|
|
107
107
|
toolName: descriptor.toolName,
|
|
@@ -116,7 +116,7 @@ function reduceMessageData(data, event) {
|
|
|
116
116
|
const denied = event.data.error?.code === "TOOL_EXECUTION_DENIED";
|
|
117
117
|
const failed = event.data.status === "failed" && !denied;
|
|
118
118
|
const approvalId = existing?.approval?.id ?? event.data.result.callId;
|
|
119
|
-
const toolMetadata = mergeToolMetadata(existing?.toolMetadata, createToolMetadata(descriptor
|
|
119
|
+
const toolMetadata = mergeToolMetadata(existing?.toolMetadata, createToolMetadata(descriptor));
|
|
120
120
|
const resultPartBase = {
|
|
121
121
|
input: existing?.input,
|
|
122
122
|
stepIndex: event.data.stepIndex,
|
|
@@ -349,7 +349,7 @@ function toMessageInputRequest(request) {
|
|
|
349
349
|
requestId: request.requestId,
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
|
-
function createToolMetadata(descriptor,
|
|
352
|
+
function createToolMetadata(descriptor, extra) {
|
|
353
353
|
return {
|
|
354
354
|
ash: {
|
|
355
355
|
inputRequest: extra?.inputRequest,
|
|
@@ -388,26 +388,20 @@ function normalizeActionRequest(action) {
|
|
|
388
388
|
case "load-skill":
|
|
389
389
|
return {
|
|
390
390
|
kind: "load-skill",
|
|
391
|
-
name:
|
|
391
|
+
name: "load_skill",
|
|
392
392
|
toolName: "ash:load-skill",
|
|
393
393
|
};
|
|
394
394
|
case "tool-call":
|
|
395
395
|
return {
|
|
396
396
|
kind: "tool-call",
|
|
397
|
-
name: action.toolName
|
|
398
|
-
toolName: action.toolName
|
|
397
|
+
name: action.toolName,
|
|
398
|
+
toolName: action.toolName,
|
|
399
399
|
};
|
|
400
400
|
case "subagent-call":
|
|
401
401
|
return {
|
|
402
402
|
kind: "subagent-call",
|
|
403
|
-
name: action.subagentName
|
|
404
|
-
toolName: `ash:subagent:${action.subagentName
|
|
405
|
-
};
|
|
406
|
-
default:
|
|
407
|
-
return {
|
|
408
|
-
kind: "unknown",
|
|
409
|
-
name: action.toolName ?? action.subagentName ?? action.name ?? action.kind,
|
|
410
|
-
toolName: action.toolName ?? action.subagentName ?? action.name ?? action.kind,
|
|
403
|
+
name: action.subagentName,
|
|
404
|
+
toolName: `ash:subagent:${action.subagentName}`,
|
|
411
405
|
};
|
|
412
406
|
}
|
|
413
407
|
}
|
|
@@ -422,20 +416,14 @@ function normalizeActionResult(result) {
|
|
|
422
416
|
case "tool-result":
|
|
423
417
|
return {
|
|
424
418
|
kind: "tool-call",
|
|
425
|
-
name: result.toolName
|
|
426
|
-
toolName: result.toolName
|
|
419
|
+
name: result.toolName,
|
|
420
|
+
toolName: result.toolName,
|
|
427
421
|
};
|
|
428
422
|
case "subagent-result":
|
|
429
423
|
return {
|
|
430
424
|
kind: "subagent-call",
|
|
431
|
-
name: result.subagentName
|
|
432
|
-
toolName: `ash:subagent:${result.subagentName
|
|
433
|
-
};
|
|
434
|
-
default:
|
|
435
|
-
return {
|
|
436
|
-
kind: "unknown",
|
|
437
|
-
name: result.toolName ?? result.subagentName ?? result.name ?? result.kind,
|
|
438
|
-
toolName: result.toolName ?? result.subagentName ?? result.name ?? result.kind,
|
|
425
|
+
name: result.subagentName,
|
|
426
|
+
toolName: `ash:subagent:${result.subagentName}`,
|
|
439
427
|
};
|
|
440
428
|
}
|
|
441
429
|
}
|
|
@@ -3,7 +3,7 @@ import type { MessageResult } from "#client/types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Internal configuration passed to construct a {@link MessageResponse}.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
interface MessageResponseInput {
|
|
7
7
|
readonly continuationToken?: string;
|
|
8
8
|
readonly createStream: () => AsyncGenerator<HandleMessageStreamEvent>;
|
|
9
9
|
readonly sessionId: string;
|
|
@@ -40,3 +40,4 @@ export declare class MessageResponse implements AsyncIterable<HandleMessageStrea
|
|
|
40
40
|
*/
|
|
41
41
|
[Symbol.asyncIterator](): AsyncIterator<HandleMessageStreamEvent>;
|
|
42
42
|
}
|
|
43
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Internal configuration for opening a durable event stream.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
interface OpenStreamInput {
|
|
6
6
|
readonly host: string;
|
|
7
7
|
readonly maxReconnectAttempts: number;
|
|
8
8
|
readonly resolveHeaders: () => Promise<Headers>;
|
|
@@ -12,7 +12,7 @@ export interface OpenStreamInput {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Opens a durable NDJSON event stream with automatic reconnection on socket
|
|
15
|
-
* disconnection. Used by
|
|
16
|
-
* {@link ClientSession.openStream}.
|
|
15
|
+
* disconnection. Used by {@link ClientSession.openStream}.
|
|
17
16
|
*/
|
|
18
17
|
export declare function openStreamIterable(input: OpenStreamInput): AsyncGenerator<HandleMessageStreamEvent>;
|
|
18
|
+
export {};
|
|
@@ -4,8 +4,7 @@ import { isStreamDisconnectError, readNdjsonStream } from "#client/ndjson.js";
|
|
|
4
4
|
import { createClientUrl } from "#client/url.js";
|
|
5
5
|
/**
|
|
6
6
|
* Opens a durable NDJSON event stream with automatic reconnection on socket
|
|
7
|
-
* disconnection. Used by
|
|
8
|
-
* {@link ClientSession.openStream}.
|
|
7
|
+
* disconnection. Used by {@link ClientSession.openStream}.
|
|
9
8
|
*/
|
|
10
9
|
export async function* openStreamIterable(input) {
|
|
11
10
|
let startIndex = input.startIndex;
|
|
@@ -5,7 +5,7 @@ import type { OpenStreamOptions, SendMessageOptions, SendTurnInput, SessionState
|
|
|
5
5
|
* Internal interface that a {@link ClientSession} uses to access client-level
|
|
6
6
|
* configuration without depending on the full {@link Client} class.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
interface SessionContext {
|
|
9
9
|
readonly host: string;
|
|
10
10
|
readonly maxReconnectAttempts: number;
|
|
11
11
|
resolveHeaders(perRequest?: Readonly<Record<string, string>>): Promise<Headers>;
|
|
@@ -53,3 +53,4 @@ export declare class ClientSession {
|
|
|
53
53
|
*/
|
|
54
54
|
openStream(options?: OpenStreamOptions): AsyncIterable<HandleMessageStreamEvent>;
|
|
55
55
|
}
|
|
56
|
+
export {};
|
|
@@ -115,9 +115,10 @@ export interface MessageResult {
|
|
|
115
115
|
*/
|
|
116
116
|
readonly events: HandleMessageStreamEvent[];
|
|
117
117
|
/**
|
|
118
|
-
* The session ID for this turn
|
|
118
|
+
* The session ID for this turn. Always populated; the post-turn handler
|
|
119
|
+
* rejects responses that do not assign a session id.
|
|
119
120
|
*/
|
|
120
|
-
readonly sessionId: string
|
|
121
|
+
readonly sessionId: string;
|
|
121
122
|
/**
|
|
122
123
|
* How the turn ended.
|
|
123
124
|
*
|
|
@@ -4,11 +4,11 @@ import type { CompiledAgentManifest } from "#compiler/manifest.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Stable diagnostics artifact kind emitted by the compiler.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare const DISCOVERY_DIAGNOSTICS_ARTIFACT_KIND = "ash-discovery-diagnostics";
|
|
8
8
|
/**
|
|
9
9
|
* Current diagnostics artifact schema version.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
declare const DISCOVERY_DIAGNOSTICS_ARTIFACT_VERSION = 1;
|
|
12
12
|
/**
|
|
13
13
|
* Stable compile metadata artifact kind emitted by the compiler.
|
|
14
14
|
*/
|
|
@@ -33,7 +33,7 @@ export interface CompilerArtifactPaths {
|
|
|
33
33
|
/**
|
|
34
34
|
* Machine-readable discovery diagnostics artifact written by the compiler.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
interface DiscoveryDiagnosticsArtifact {
|
|
37
37
|
diagnostics: DiscoverDiagnostic[];
|
|
38
38
|
kind: typeof DISCOVERY_DIAGNOSTICS_ARTIFACT_KIND;
|
|
39
39
|
summary: DiscoverDiagnosticsSummary;
|
|
@@ -42,7 +42,7 @@ export interface DiscoveryDiagnosticsArtifact {
|
|
|
42
42
|
/**
|
|
43
43
|
* One artifact digest recorded in compile metadata.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
interface CompileArtifactDigest {
|
|
46
46
|
path: string;
|
|
47
47
|
sha256: string;
|
|
48
48
|
}
|
|
@@ -70,7 +70,7 @@ export interface CompileMetadata {
|
|
|
70
70
|
/**
|
|
71
71
|
* Input for writing compiler-owned discovery artifacts.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
interface WriteCompilerArtifactsInput {
|
|
74
74
|
appRoot: string;
|
|
75
75
|
diagnostics: readonly DiscoverDiagnostic[];
|
|
76
76
|
manifest: AgentSourceManifest;
|
|
@@ -78,7 +78,7 @@ export interface WriteCompilerArtifactsInput {
|
|
|
78
78
|
/**
|
|
79
79
|
* Result of writing compiler-owned artifacts.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
interface WriteCompilerArtifactsResult {
|
|
82
82
|
compiledManifest: CompiledAgentManifest;
|
|
83
83
|
diagnosticsArtifact: DiscoveryDiagnosticsArtifact;
|
|
84
84
|
metadata: CompileMetadata;
|
|
@@ -89,10 +89,6 @@ export interface WriteCompilerArtifactsResult {
|
|
|
89
89
|
* Resolves the compiler-owned artifact paths for one application root.
|
|
90
90
|
*/
|
|
91
91
|
export declare function resolveCompilerArtifactPaths(appRoot: string): CompilerArtifactPaths;
|
|
92
|
-
/**
|
|
93
|
-
* Creates the diagnostics artifact written alongside the source manifest.
|
|
94
|
-
*/
|
|
95
|
-
export declare function createDiscoveryDiagnosticsArtifact(diagnostics: readonly DiscoverDiagnostic[]): DiscoveryDiagnosticsArtifact;
|
|
96
92
|
/**
|
|
97
93
|
* Creates deterministic compile metadata from already-serialized artifact
|
|
98
94
|
* payloads.
|
|
@@ -109,3 +105,4 @@ export declare function createCompileMetadata(input: {
|
|
|
109
105
|
* Writes the compiler-owned discovery artifacts under `.ash/`.
|
|
110
106
|
*/
|
|
111
107
|
export declare function writeCompilerArtifacts(input: WriteCompilerArtifactsInput): Promise<WriteCompilerArtifactsResult>;
|
|
108
|
+
export {};
|
|
@@ -10,11 +10,11 @@ import { materializeWorkspaceResources } from "#compiler/workspace-resources.js"
|
|
|
10
10
|
/**
|
|
11
11
|
* Stable diagnostics artifact kind emitted by the compiler.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
const DISCOVERY_DIAGNOSTICS_ARTIFACT_KIND = "ash-discovery-diagnostics";
|
|
14
14
|
/**
|
|
15
15
|
* Current diagnostics artifact schema version.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
const DISCOVERY_DIAGNOSTICS_ARTIFACT_VERSION = 1;
|
|
18
18
|
/**
|
|
19
19
|
* Stable compile metadata artifact kind emitted by the compiler.
|
|
20
20
|
*/
|
|
@@ -44,7 +44,7 @@ export function resolveCompilerArtifactPaths(appRoot) {
|
|
|
44
44
|
/**
|
|
45
45
|
* Creates the diagnostics artifact written alongside the source manifest.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
function createDiscoveryDiagnosticsArtifact(diagnostics) {
|
|
48
48
|
return {
|
|
49
49
|
diagnostics: [...diagnostics],
|
|
50
50
|
kind: DISCOVERY_DIAGNOSTICS_ARTIFACT_KIND,
|
|
@@ -4,8 +4,8 @@ import { type CompiledRemoteAgentNode } from "#compiler/remote-agent-node.js";
|
|
|
4
4
|
import type { ChannelMethod } from "#public/definitions/channel.js";
|
|
5
5
|
import type { Node } from "#shared/node.js";
|
|
6
6
|
import type { MarkdownSourceRef, ModuleSourceRef, SkillPackageSourceRef } from "#shared/source-ref.js";
|
|
7
|
-
import type {
|
|
8
|
-
import type { InternalAgentDefinition, InternalAgentModelDefinition
|
|
7
|
+
import type { NamedSkillDefinition } from "#shared/skill-definition.js";
|
|
8
|
+
import type { InternalAgentDefinition, InternalAgentModelDefinition } from "#shared/agent-definition.js";
|
|
9
9
|
import type { InternalToolDefinition } from "#shared/tool-definition.js";
|
|
10
10
|
/**
|
|
11
11
|
* Stable manifest kind emitted by the compiler for runtime loading.
|
|
@@ -50,7 +50,7 @@ export interface CompiledChannelDefinition {
|
|
|
50
50
|
* Disabled compiled channel entry — marker that an authored file at this
|
|
51
51
|
* slug exported `disableRoute()` to remove the matching framework default.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
interface DisabledCompiledChannelEntry {
|
|
54
54
|
readonly kind: "disabled";
|
|
55
55
|
readonly name: string;
|
|
56
56
|
readonly logicalPath: string;
|
|
@@ -59,15 +59,6 @@ export interface DisabledCompiledChannelEntry {
|
|
|
59
59
|
* Serializable runtime model reference preserved in the compiled manifest.
|
|
60
60
|
*/
|
|
61
61
|
export type CompiledRuntimeModelReference = InternalAgentModelDefinition;
|
|
62
|
-
/**
|
|
63
|
-
* Normalized hosted-build configuration preserved in the compiled manifest.
|
|
64
|
-
*/
|
|
65
|
-
export type CompiledAgentBuildDefinition = AgentBuildDefinition;
|
|
66
|
-
/**
|
|
67
|
-
* Normalized authored compaction configuration preserved in the compiled
|
|
68
|
-
* manifest.
|
|
69
|
-
*/
|
|
70
|
-
export type CompiledAgentCompactionDefinition = InternalAgentCompactionDefinition;
|
|
71
62
|
/**
|
|
72
63
|
* Normalized additive agent configuration preserved in the compiled manifest.
|
|
73
64
|
*/
|
|
@@ -80,7 +71,7 @@ export type CompiledInstructions = z.infer<typeof compiledInstructionsSchema>;
|
|
|
80
71
|
/**
|
|
81
72
|
* Normalized authored skill preserved in the compiled manifest.
|
|
82
73
|
*/
|
|
83
|
-
export type CompiledSkillDefinition =
|
|
74
|
+
export type CompiledSkillDefinition = NamedSkillDefinition & (Omit<MarkdownSourceRef<undefined>, "definition"> | ModuleSourceRef | SkillPackageSourceRef);
|
|
84
75
|
/**
|
|
85
76
|
* Normalized authored schedule preserved in the compiled manifest.
|
|
86
77
|
*/
|
|
@@ -95,7 +86,7 @@ export type CompiledSandboxDefinition = z.infer<typeof compiledSandboxDefinition
|
|
|
95
86
|
* Corresponds to the `agent/sandbox/workspace/` directory discovered on
|
|
96
87
|
* disk. Mounted into the live sandbox cwd at session bootstrap.
|
|
97
88
|
*/
|
|
98
|
-
|
|
89
|
+
type CompiledSandboxWorkspace = z.infer<typeof compiledSandboxWorkspaceSchema>;
|
|
99
90
|
/**
|
|
100
91
|
* Byte-free descriptor for the compiled workspace resource tree owned by one
|
|
101
92
|
* graph node.
|
|
@@ -200,7 +191,7 @@ declare const compiledConnectionDefinitionSchema: z.ZodObject<{
|
|
|
200
191
|
/**
|
|
201
192
|
* Zod schema for one non-recursive compiled authored agent payload.
|
|
202
193
|
*/
|
|
203
|
-
|
|
194
|
+
declare const compiledAgentNodeManifestSchema: z.ZodObject<{
|
|
204
195
|
agentRoot: z.ZodString;
|
|
205
196
|
appRoot: z.ZodString;
|
|
206
197
|
channels: z.ZodArray<z.ZodType<CompiledChannelEntry, unknown, z.core.$ZodTypeInternals<CompiledChannelEntry, unknown>>>;
|
|
@@ -26,8 +26,8 @@ const channelMethodSchema = z.union([
|
|
|
26
26
|
z.literal("GET"),
|
|
27
27
|
z.literal("POST"),
|
|
28
28
|
z.literal("PUT"),
|
|
29
|
-
z.literal("DELETE"),
|
|
30
29
|
z.literal("PATCH"),
|
|
30
|
+
z.literal("DELETE"),
|
|
31
31
|
]);
|
|
32
32
|
const compiledChannelDefinitionSchema = z
|
|
33
33
|
.object({
|
|
@@ -58,7 +58,7 @@ const compiledRuntimeModelReferenceSchema = z
|
|
|
58
58
|
contextWindowTokens: z.number().int().positive().optional(),
|
|
59
59
|
id: z.string(),
|
|
60
60
|
source: moduleSourceRefSchema.optional(),
|
|
61
|
-
providerOptions: jsonObjectSchema.optional(),
|
|
61
|
+
providerOptions: z.record(z.string(), jsonObjectSchema).optional(),
|
|
62
62
|
})
|
|
63
63
|
.strict();
|
|
64
64
|
const compiledAgentBuildDefinitionSchema = z
|
|
@@ -209,7 +209,7 @@ const compiledHookDefinitionSchema = z
|
|
|
209
209
|
/**
|
|
210
210
|
* Zod schema for one non-recursive compiled authored agent payload.
|
|
211
211
|
*/
|
|
212
|
-
|
|
212
|
+
const compiledAgentNodeManifestSchema = z
|
|
213
213
|
.object({
|
|
214
214
|
agentRoot: z.string(),
|
|
215
215
|
appRoot: z.string(),
|
|
@@ -33,7 +33,6 @@ export async function compileAgentConfig(manifest, context) {
|
|
|
33
33
|
const model = await normalizeAuthoredModelReference({
|
|
34
34
|
modelCatalog: context.modelCatalog,
|
|
35
35
|
purpose: "the primary compaction trigger model",
|
|
36
|
-
requireContextWindowTokens: true,
|
|
37
36
|
contextWindowTokens: definition.modelContextWindowTokens,
|
|
38
37
|
providerOptions: definition.modelOptions?.providerOptions,
|
|
39
38
|
source: manifest.configModule,
|
|
@@ -66,7 +65,6 @@ export async function compileAgentConfig(manifest, context) {
|
|
|
66
65
|
compaction.model = await normalizeAuthoredModelReference({
|
|
67
66
|
modelCatalog: context.modelCatalog,
|
|
68
67
|
purpose: "the compaction summary model",
|
|
69
|
-
requireContextWindowTokens: true,
|
|
70
68
|
contextWindowTokens: definition.compaction.modelContextWindowTokens,
|
|
71
69
|
providerOptions: definition.modelOptions?.providerOptions,
|
|
72
70
|
source: manifest.configModule,
|
|
@@ -82,7 +80,7 @@ async function normalizeAuthoredModelReference(input) {
|
|
|
82
80
|
if (typeof input.value === "string") {
|
|
83
81
|
return await withCompiledRuntimeModelLimits({
|
|
84
82
|
id: formatLanguageModelGatewayId(input.value),
|
|
85
|
-
providerOptions:
|
|
83
|
+
providerOptions: parseProviderOptionsRecord(input.providerOptions),
|
|
86
84
|
}, input);
|
|
87
85
|
}
|
|
88
86
|
const source = input.source;
|
|
@@ -111,7 +109,7 @@ async function normalizeAuthoredModelReference(input) {
|
|
|
111
109
|
logicalPath: source.logicalPath,
|
|
112
110
|
sourceId: source.sourceId,
|
|
113
111
|
},
|
|
114
|
-
providerOptions:
|
|
112
|
+
providerOptions: parseProviderOptionsRecord(input.providerOptions),
|
|
115
113
|
};
|
|
116
114
|
if (input.contextWindowTokens === undefined) {
|
|
117
115
|
const providerResult = await input.modelCatalog.getByProviderModelId(languageModel.provider, languageModel.modelId);
|
|
@@ -137,15 +135,9 @@ async function withCompiledRuntimeModelLimits(model, input) {
|
|
|
137
135
|
limits = await input.modelCatalog.getModelLimits(model.id);
|
|
138
136
|
}
|
|
139
137
|
catch (error) {
|
|
140
|
-
if (!input.requireContextWindowTokens) {
|
|
141
|
-
return model;
|
|
142
|
-
}
|
|
143
138
|
throw new Error(`Failed to load AI Gateway model metadata for ${input.purpose} "${model.id}". ${toErrorMessage(error)}`);
|
|
144
139
|
}
|
|
145
140
|
if (limits === null) {
|
|
146
|
-
if (!input.requireContextWindowTokens) {
|
|
147
|
-
return model;
|
|
148
|
-
}
|
|
149
141
|
throw new Error(`Cannot compile agent compaction because ${input.purpose} "${model.id}" does not have known AI Gateway context window metadata.`);
|
|
150
142
|
}
|
|
151
143
|
return {
|
|
@@ -153,3 +145,13 @@ async function withCompiledRuntimeModelLimits(model, input) {
|
|
|
153
145
|
contextWindowTokens: limits.contextWindowTokens,
|
|
154
146
|
};
|
|
155
147
|
}
|
|
148
|
+
function parseProviderOptionsRecord(value) {
|
|
149
|
+
if (value === undefined) {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
const normalized = {};
|
|
153
|
+
for (const [provider, entry] of Object.entries(value)) {
|
|
154
|
+
normalized[provider] = parseJsonObject(entry);
|
|
155
|
+
}
|
|
156
|
+
return normalized;
|
|
157
|
+
}
|
|
@@ -47,8 +47,9 @@ async function compileAgentNodeManifest(manifest, context) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const compiledChannelResults = await Promise.all(manifest.channels.map((channelSource) => compileChannelDefinition(manifest.agentRoot, channelSource)));
|
|
50
|
-
// compileChannelDefinition returns
|
|
51
|
-
// or an array of entries
|
|
50
|
+
// compileChannelDefinition returns one entry for a disabled-channel
|
|
51
|
+
// sentinel or an array of entries (one per route) for an authored
|
|
52
|
+
// CompiledChannel. Flatten so the manifest holds a single channel list.
|
|
52
53
|
const compiledChannels = compiledChannelResults.flat();
|
|
53
54
|
return createCompiledAgentNodeManifest({
|
|
54
55
|
agentRoot: manifest.agentRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { type ContextAccessor, type ContextKey
|
|
2
|
+
import { type ContextAccessor, type ContextKey } from "#context/key.js";
|
|
3
3
|
/**
|
|
4
4
|
* Keyed value container that backs one Ash execution scope.
|
|
5
5
|
*
|
|
@@ -58,18 +58,3 @@ export declare const contextStorage: AsyncLocalStorage<AshContext>;
|
|
|
58
58
|
* Returns the active context, throwing when called outside a managed scope.
|
|
59
59
|
*/
|
|
60
60
|
export declare function loadContext(): AshContext;
|
|
61
|
-
/**
|
|
62
|
-
* Narrows a {@link ContextContainer} to the {@link ContextAccessor}
|
|
63
|
-
* interface. Used by runtime entry points to pass the context to channel
|
|
64
|
-
* `onDeliver` callbacks without exposing implementation details.
|
|
65
|
-
*/
|
|
66
|
-
export declare function toContextAccessor(ctx: ContextContainer): ContextAccessor;
|
|
67
|
-
/**
|
|
68
|
-
* Narrows a context implementation to a read-only {@link ContextReader}
|
|
69
|
-
* facade.
|
|
70
|
-
*
|
|
71
|
-
* Used by route-time APIs such as Slack interactions where authored code
|
|
72
|
-
* should be able to inspect durable context but must not receive mutable
|
|
73
|
-
* context methods that imply writes will persist.
|
|
74
|
-
*/
|
|
75
|
-
export declare function toContextReader(ctx: ContextReader): ContextReader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { resolveKey
|
|
2
|
+
import { resolveKey } from "#context/key.js";
|
|
3
3
|
const ASH_CONTEXT_STORAGE_KEY = Symbol.for("experimental-ash.context-storage");
|
|
4
4
|
/**
|
|
5
5
|
* Default mutable implementation of {@link AshContext}.
|
|
@@ -87,26 +87,3 @@ export function loadContext() {
|
|
|
87
87
|
}
|
|
88
88
|
return ctx;
|
|
89
89
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Narrows a {@link ContextContainer} to the {@link ContextAccessor}
|
|
92
|
-
* interface. Used by runtime entry points to pass the context to channel
|
|
93
|
-
* `onDeliver` callbacks without exposing implementation details.
|
|
94
|
-
*/
|
|
95
|
-
export function toContextAccessor(ctx) {
|
|
96
|
-
return ctx;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Narrows a context implementation to a read-only {@link ContextReader}
|
|
100
|
-
* facade.
|
|
101
|
-
*
|
|
102
|
-
* Used by route-time APIs such as Slack interactions where authored code
|
|
103
|
-
* should be able to inspect durable context but must not receive mutable
|
|
104
|
-
* context methods that imply writes will persist.
|
|
105
|
-
*/
|
|
106
|
-
export function toContextReader(ctx) {
|
|
107
|
-
return {
|
|
108
|
-
get: ctx.get.bind(ctx),
|
|
109
|
-
has: ctx.has.bind(ctx),
|
|
110
|
-
require: ctx.require.bind(ctx),
|
|
111
|
-
};
|
|
112
|
-
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HarnessEmitFn, HarnessSession, StepInput, StepResult } from "../harness/types.js";
|
|
2
2
|
import type { HandleMessageStreamEvent, RuntimeIdentity } from "../protocol/message.js";
|
|
3
|
-
import type { RunMode } from "
|
|
3
|
+
import type { RunMode } from "#shared/run-mode.js";
|
|
4
4
|
import type { RuntimeHookRegistry } from "../runtime/hooks/registry.js";
|
|
5
|
-
import {
|
|
5
|
+
import type { ContextContainer } from "./container.js";
|
|
6
6
|
/**
|
|
7
7
|
* Outcome of dispatching the per-turn hook lifecycle.
|
|
8
8
|
*
|
|
@@ -103,8 +103,3 @@ export declare function dispatchStreamEventHooks(input: {
|
|
|
103
103
|
* Caller must already be inside the active ALS scope.
|
|
104
104
|
*/
|
|
105
105
|
export declare function runHookLifecycleStep(input: DispatchHookLifecycleInput, body: (session: HarnessSession, input: StepInput) => Promise<StepResult>): Promise<StepResult>;
|
|
106
|
-
/**
|
|
107
|
-
* Re-export for tests and tooling that need to drive a hook stage from
|
|
108
|
-
* outside the dispatcher.
|
|
109
|
-
*/
|
|
110
|
-
export { contextStorage };
|
|
@@ -4,7 +4,6 @@ import { createLogger } from "../internal/logging.js";
|
|
|
4
4
|
import { toErrorMessage } from "../shared/errors.js";
|
|
5
5
|
import { normalizeSkillPackage, writeSkillPackageToSandbox, } from "../shared/skill-package.js";
|
|
6
6
|
import { formatAvailableSkillsSection } from "#execution/skills/instructions.js";
|
|
7
|
-
import { contextStorage } from "./container.js";
|
|
8
7
|
import { BundleKey, ChannelKey, ContinuationTokenKey, SandboxKey, SessionIdKey, SessionPreparedKey, } from "./keys.js";
|
|
9
8
|
const log = createLogger("hooks.lifecycle");
|
|
10
9
|
/**
|
|
@@ -241,8 +240,3 @@ export async function runHookLifecycleStep(input, body) {
|
|
|
241
240
|
}
|
|
242
241
|
return body(outcome.nextSession, outcome.input);
|
|
243
242
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Re-export for tests and tooling that need to drive a hook stage from
|
|
246
|
-
* outside the dispatcher.
|
|
247
|
-
*/
|
|
248
|
-
export { contextStorage };
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import type { HarnessSession } from "#harness/types.js";
|
|
2
2
|
import type { ContextContainer } from "#context/container.js";
|
|
3
|
-
import type { ContextKey
|
|
3
|
+
import type { ContextKey } from "#context/key.js";
|
|
4
4
|
export type { ContextReader } from "#context/key.js";
|
|
5
|
-
/**
|
|
6
|
-
* Public derive-only provider that rebuilds one virtual value each step.
|
|
7
|
-
*
|
|
8
|
-
* Provider output is available through `require(key)` for the current
|
|
9
|
-
* step and is never serialized.
|
|
10
|
-
*/
|
|
11
|
-
export interface ContextProvider<T> {
|
|
12
|
-
readonly key: ContextKey<T>;
|
|
13
|
-
create(ctx: ContextReader): T | undefined | Promise<T | undefined>;
|
|
14
|
-
}
|
|
15
5
|
/**
|
|
16
6
|
* Value returned by a framework provider's `create` method.
|
|
17
7
|
*
|
|
@@ -22,7 +22,7 @@ export const sandboxProvider = {
|
|
|
22
22
|
state: session.sandboxState ?? null,
|
|
23
23
|
tags: {
|
|
24
24
|
agent: resolveTagAgentName({ bundle, node }),
|
|
25
|
-
channel:
|
|
25
|
+
channel: resolveTagChannelKind(ctx.get(ChannelKey)),
|
|
26
26
|
sessionId,
|
|
27
27
|
},
|
|
28
28
|
}),
|
|
@@ -41,3 +41,6 @@ function resolveTagAgentName(input) {
|
|
|
41
41
|
partialNode.nodeId ??
|
|
42
42
|
"unknown");
|
|
43
43
|
}
|
|
44
|
+
function resolveTagChannelKind(channel) {
|
|
45
|
+
return channel === undefined ? "unknown" : getAdapterKind(channel);
|
|
46
|
+
}
|
|
@@ -5,10 +5,8 @@ import { type ContextContainer } from "#context/container.js";
|
|
|
5
5
|
*
|
|
6
6
|
* 1. Clears all previous step-local provider values.
|
|
7
7
|
* 2. Builds framework virtual providers in dependency order.
|
|
8
|
-
* 3.
|
|
9
|
-
*
|
|
10
|
-
* 4. Runs `callback` inside the ALS scope so authored code can read context.
|
|
11
|
-
* 5. After the step, runs framework provider commit hooks to persist
|
|
8
|
+
* 3. Runs `callback` inside the ALS scope so authored code can read context.
|
|
9
|
+
* 4. After the step, runs framework provider commit hooks to persist
|
|
12
10
|
* provider-owned session data (for example sandbox snapshots).
|
|
13
11
|
*/
|
|
14
12
|
export declare function runStep(ctx: ContextContainer, harnessSession: HarnessSession, callback: (session: HarnessSession) => Promise<StepResult>): Promise<StepResult>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getAdapterContextProviders } from "#channel/adapter.js";
|
|
2
1
|
import { contextStorage } from "#context/container.js";
|
|
3
|
-
import { ChannelKey } from "#context/keys.js";
|
|
4
2
|
import { connectionProvider } from "#context/providers/connection.js";
|
|
5
3
|
import { sandboxProvider } from "#context/providers/sandbox.js";
|
|
6
4
|
import { sessionProvider } from "#context/providers/session.js";
|
|
@@ -20,10 +18,8 @@ const frameworkProviders = [
|
|
|
20
18
|
*
|
|
21
19
|
* 1. Clears all previous step-local provider values.
|
|
22
20
|
* 2. Builds framework virtual providers in dependency order.
|
|
23
|
-
* 3.
|
|
24
|
-
*
|
|
25
|
-
* 4. Runs `callback` inside the ALS scope so authored code can read context.
|
|
26
|
-
* 5. After the step, runs framework provider commit hooks to persist
|
|
21
|
+
* 3. Runs `callback` inside the ALS scope so authored code can read context.
|
|
22
|
+
* 4. After the step, runs framework provider commit hooks to persist
|
|
27
23
|
* provider-owned session data (for example sandbox snapshots).
|
|
28
24
|
*/
|
|
29
25
|
export async function runStep(ctx, harnessSession, callback) {
|
|
@@ -39,18 +35,9 @@ export async function runStep(ctx, harnessSession, callback) {
|
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
// 2.
|
|
43
|
-
const adapter = ctx.require(ChannelKey);
|
|
44
|
-
const adapterProviders = getAdapterContextProviders(adapter);
|
|
45
|
-
for (const provider of adapterProviders) {
|
|
46
|
-
const value = await provider.create(ctx);
|
|
47
|
-
if (value !== undefined) {
|
|
48
|
-
ctx.setVirtualContext(provider.key, value);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// 3. Run callback inside ALS scope
|
|
38
|
+
// 2. Run callback inside ALS scope
|
|
52
39
|
const stepResult = await contextStorage.run(ctx, () => callback(session));
|
|
53
|
-
//
|
|
40
|
+
// 3. Commit framework providers
|
|
54
41
|
let committed = stepResult.session;
|
|
55
42
|
for (const provider of frameworkProviders) {
|
|
56
43
|
if (provider.commit && ctx.has(provider.key)) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `context/keys.ts` which re-exports everything from this module.
|
|
11
11
|
*/
|
|
12
12
|
import type { SessionAuthContext, SessionCapabilities, SessionParent } from "#channel/types.js";
|
|
13
|
-
import type { RunMode } from "#run-mode.js";
|
|
13
|
+
import type { RunMode } from "#shared/run-mode.js";
|
|
14
14
|
import { ContextKey } from "#context/key.js";
|
|
15
15
|
export declare const AuthKey: ContextKey<SessionAuthContext | null>;
|
|
16
16
|
export declare const InitiatorAuthKey: ContextKey<SessionAuthContext | null>;
|
|
@@ -19,7 +19,7 @@ export declare const DISCOVER_CONNECTION_FOLDER_EMPTY = "discover/connection-fol
|
|
|
19
19
|
/**
|
|
20
20
|
* Result of discovering authored connection sources from a single agent root.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
interface DiscoverConnectionSourcesResult {
|
|
23
23
|
connections: ConnectionSourceRef[];
|
|
24
24
|
diagnostics: DiscoverDiagnostic[];
|
|
25
25
|
}
|
|
@@ -31,3 +31,4 @@ export declare function discoverConnectionSources(input: {
|
|
|
31
31
|
rootPath: string;
|
|
32
32
|
source: ProjectSource;
|
|
33
33
|
}): Promise<DiscoverConnectionSourcesResult>;
|
|
34
|
+
export {};
|