@mininglamp-oss/octo-runtime 1.1.12 → 1.1.13
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 +1 -1
- package/apps/cli/dist/adapters.d.ts +19 -1
- package/apps/cli/dist/adapters.js +153 -23
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/codex.d.ts +5 -0
- package/apps/cli/dist/codex.js +36 -0
- package/apps/cli/dist/kernel.d.ts +4 -0
- package/apps/cli/dist/kernel.js +84 -0
- package/apps/cli/dist/main.js +8 -7
- package/apps/cli/dist/manifest.json +33 -22
- package/apps/cli/dist/output.d.ts +1 -0
- package/apps/cli/dist/output.js +8 -4
- package/apps/cli/dist/playboard.js +21 -12
- package/apps/cli/dist/provider-launch.d.ts +28 -0
- package/apps/cli/dist/provider-launch.js +52 -0
- package/apps/cli/dist/providers.d.ts +182 -0
- package/apps/cli/dist/providers.js +34 -0
- package/dist/public/adapter-sdk.d.ts +2 -0
- package/dist/public/adapter-sdk.js +2 -0
- package/dist/public/protocol.d.ts +1 -1
- package/dist/public/protocol.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +15 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +24 -28
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +22 -29
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +60 -43
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +29 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +32 -26
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +104 -216
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +12 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +23 -30
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +48 -26
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +15 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +15 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +27 -29
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +109 -178
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +15 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +15 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +49 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +256 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -12
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +116 -58
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +153 -23
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
- package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +173 -1295
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +26 -54
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -5
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -267
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +17 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +102 -396
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +6 -15
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +33 -178
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -28
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +34 -37
- package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +173 -1295
- package/dist/public/codex.d.ts +0 -1
- package/dist/public/codex.js +0 -1
- package/dist/public/dsh.d.ts +0 -2
- package/dist/public/dsh.js +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
- /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
- /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
|
@@ -3,4 +3,35 @@
|
|
|
3
3
|
* Generated by scripts/gen-types.mjs from schema/protocol.schema.json.
|
|
4
4
|
* Do not edit directly; update the schema and run `pnpm gen`.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export const KERNEL_IPC_VERSION = 2;
|
|
7
|
+
export const RUN_PROTOCOL_ERRORS = [
|
|
8
|
+
"PROTOCOL_MODE_INVALID",
|
|
9
|
+
"PROTOCOL_MODE_UNSUPPORTED",
|
|
10
|
+
"EXECUTION_PROTOCOL_MISMATCH",
|
|
11
|
+
"EXECUTION_IDENTITY_CONFLICT",
|
|
12
|
+
"NATIVE_METHOD_UNSUPPORTED",
|
|
13
|
+
"NATIVE_RESPONSE_INVALID",
|
|
14
|
+
"INTERACTION_NOT_ACTIVE",
|
|
15
|
+
"INVALID_QUESTION_RESPONSE",
|
|
16
|
+
"ASYNC_ANSWER_REJECTED",
|
|
17
|
+
"OPERATION_OUTCOME_UNKNOWN",
|
|
18
|
+
"HOST_EXECUTION_FAILED",
|
|
19
|
+
"HOST_ENDED_WITHOUT_TERMINAL",
|
|
20
|
+
"WORKDIR_REQUIRED",
|
|
21
|
+
"WORKDIR_INVALID",
|
|
22
|
+
"WORKDIR_NOT_FOUND",
|
|
23
|
+
"WORKDIR_NOT_DIRECTORY",
|
|
24
|
+
"WORKDIR_UNAVAILABLE",
|
|
25
|
+
"PROVIDER_MESSAGE_TOO_LARGE",
|
|
26
|
+
"HOST_FRAME_TOO_LARGE",
|
|
27
|
+
"STREAM_QUEUE_ITEM_TOO_LARGE",
|
|
28
|
+
"STREAM_QUEUE_BYTES_EXCEEDED",
|
|
29
|
+
"STREAM_QUEUE_ITEMS_EXCEEDED",
|
|
30
|
+
"STREAM_GAP",
|
|
31
|
+
"STREAM_EXPIRED",
|
|
32
|
+
"REMOTE_NATIVE_UNSUPPORTED",
|
|
33
|
+
"HOST_FRAME_INVALID",
|
|
34
|
+
"HOST_CONTROL_INVALID",
|
|
35
|
+
"HOST_RECEIPT_INVALID",
|
|
36
|
+
"PROTOCOL_SUPPORT_INVALID"
|
|
37
|
+
];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { KERNEL_IPC_VERSION } from "./generated/protocol-types.js";
|
|
1
2
|
export type { HostedAdapterMetadata } from "./adapter-metadata.js";
|
|
2
3
|
export { assertAsyncQuestions, assertQuestionRequest, assertQuestionResponse, questionAnswerText } from "./questions.js";
|
|
3
4
|
export type { AsyncUserInputQuestion, AsyncQuestionReplySnapshot, QuestionRequest, QuestionResponse } from "./generated/protocol-types.js";
|
|
@@ -8,21 +9,19 @@ export { assertKernelStatus, assertServiceProcessSnapshot } from "./service-proc
|
|
|
8
9
|
export * from "./run-protocol.js";
|
|
9
10
|
export type { KernelLookupKey, KernelRunRef, KernelRunSnapshot, KernelStatus, ServiceProcessSnapshot } from "./generated/protocol-types.js";
|
|
10
11
|
export * from "./invoke-input.js";
|
|
11
|
-
export * from "./model-context.js";
|
|
12
|
-
export * from "./execution-plan.js";
|
|
13
12
|
export { contextHash } from "./context-hash.js";
|
|
14
13
|
export { assertJsonValue } from "./context.js";
|
|
15
14
|
export type { ToolAuthorization, IssuedToolAuthorization } from "./generated/protocol-types.js";
|
|
16
15
|
export { PROVIDER_DIAGNOSTIC_MAX_BYTES } from "./experience.js";
|
|
17
16
|
export { IMAGE_INPUT_LIMITS, IMAGE_INPUT_MIME_TYPES, assertModelInputParts, providerInputParts, hasImageInput, modelPartsFromInput } from "./multimodal.js";
|
|
18
|
-
export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp,
|
|
17
|
+
export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, canonicalContext, contextItem, mergeContext } from "./context.js";
|
|
19
18
|
export { RUNTIME_SELECTION_SCHEMA, assertResolvedRuntimeSelection } from "./runtime-selection.js";
|
|
20
19
|
export { CONTEXT_TYPE_CATALOG, contextTypeDefinition, findContextTypeDefinition } from "./context-catalog.js";
|
|
21
20
|
export type { ContextTypeDefinition } from "./context-catalog.js";
|
|
22
21
|
export { assertContextConfiguration, resolveContextConfiguration } from "./context-configuration.js";
|
|
23
22
|
export { assertNotificationMessage } from "./notification.js";
|
|
24
|
-
import type { ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload,
|
|
25
|
-
export type { AgentSource, NotificationMessage, ModelInputPart, ApprovalMode, ApprovalRequest, ApprovalOperation, ApprovalDisplayDetails, ContextItem, ContextInlinePayload, ContextReferencesPayload, ContextInlineEntry, ContextReferenceEntry, ContextEnvelope, ContextConfiguration, ContextPreparationReceipt, RunContextProjection, ContextAdapterPayload, ContextModelPayload, ContextActmodePayload, ExecutionEvidence, ContextReasoningPayload, ContextWorkspacePayload, ContextLimitsPayload, ContextEnvsPayload, ContextRuntimeSelectionPayload, ContextApprovalPolicyPayload,
|
|
23
|
+
import type { ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, InvokeRequestWire, RuntimeLimits, MessageChannel, MessageExposure, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepFinishedPayload, ModelStepStartedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureEnvelope } from "./generated/protocol-types.js";
|
|
24
|
+
export type { AgentSource, NotificationMessage, ModelInputPart, ApprovalMode, ApprovalRequest, ApprovalOperation, ApprovalDisplayDetails, ContextItem, ContextInlinePayload, ContextReferencesPayload, ContextInlineEntry, ContextReferenceEntry, ContextEnvelope, ContextConfiguration, ContextPreparationReceipt, RunContextProjection, ContextAdapterPayload, ContextModelPayload, ContextActmodePayload, ExecutionEvidence, ContextReasoningPayload, ContextWorkspacePayload, ContextLimitsPayload, ContextEnvsPayload, ContextRuntimeSelectionPayload, ContextApprovalPolicyPayload, ResolvedRuntimeSelection, MessageChannel, MessageExposure, MessageProvenance, ProviderSession, RuntimeLimits, ActivityInfo, ActivitySubject, ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepStartedPayload, ModelStepFinishedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureAction, FailureSource, FailureCause, FailureEnvelope, McpStdioServer, McpStreamableHttpServer, McpServer, McpServers, RunIdentity, InvokeRequestWire } from "./generated/protocol-types.js";
|
|
26
25
|
export { FAILURE_CATALOG, classifyFailure, isCodexLocalFailureReason, isCodexLocalFailure, failureMessage, failurePayload, isFailureEnvelope, type FailureClassificationContext, type FailureDomain, type PublicFailureCode } from "./failure.js";
|
|
27
26
|
import type { RunIdentity } from "./generated/protocol-types.js";
|
|
28
27
|
/**
|
|
@@ -73,18 +72,10 @@ export interface InteractionResponse {
|
|
|
73
72
|
outcome: InteractionResponseOutcome;
|
|
74
73
|
value?: unknown;
|
|
75
74
|
}
|
|
76
|
-
/**
|
|
75
|
+
/** Exact caller-provided text for the provider turn. */
|
|
77
76
|
export declare function providerInputText(request: InvokeRequest): string;
|
|
78
|
-
/** Inject trusted instructions only when starting a provider session, including a fresh restart. */
|
|
79
|
-
export declare function initialControlInstructions(request: InvokeRequest, freshSession?: boolean): string;
|
|
80
77
|
/** Exact alternate input for a provider that could not resume its session. */
|
|
81
78
|
export declare function freshFallbackInputText(request: InvokeRequest): string;
|
|
82
|
-
/** Runtime validation at the Agent Work plugin boundary; JSON schema remains the wire source of truth. */
|
|
83
|
-
export declare function assertChannelScope(value: unknown): asserts value is ChannelScope;
|
|
84
|
-
export declare function assertChannelMessageFact(value: unknown): asserts value is ChannelMessageFact;
|
|
85
|
-
export declare function assertChannelContextAppend(value: unknown): asserts value is ChannelContextAppend;
|
|
86
|
-
export declare function assertContextSyncResult(value: unknown): asserts value is ContextSyncResult;
|
|
87
|
-
export declare function assertChannelContextDescriptor(value: unknown): asserts value is ChannelContextDescriptor;
|
|
88
79
|
/**
|
|
89
80
|
* The event record written to the Store.
|
|
90
81
|
* `seq` is monotonic only within a single run; consumers should order and
|
|
@@ -115,7 +106,7 @@ export declare function assertApprovalRequest(value: unknown): asserts value is
|
|
|
115
106
|
export declare function assertInteractionResponse(value: unknown): asserts value is InteractionResponse;
|
|
116
107
|
/** Validate a structured failure at the dynamic adapter boundary. */
|
|
117
108
|
export declare function assertFailureEnvelope(value: unknown): asserts value is FailureEnvelope;
|
|
118
|
-
/**
|
|
109
|
+
/** 校验内部调用的身份、内容与信封结构;不改写输入,配置和目录语义由消费它的 Adapter 校验。 */
|
|
119
110
|
export declare function assertInvokeRequest(request: unknown): asserts request is InvokeRequest;
|
|
120
111
|
export declare function assertRuntimeLimits(value: unknown): asserts value is RuntimeLimits;
|
|
121
112
|
/** Type guard: whether an event ends the current Run. */
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
export { KERNEL_IPC_VERSION } from "./generated/protocol-types.js";
|
|
2
3
|
import { assertAsyncQuestions, assertQuestionRequest } from "./questions.js";
|
|
3
4
|
export { assertAsyncQuestions, assertQuestionRequest, assertQuestionResponse, questionAnswerText } from "./questions.js";
|
|
4
|
-
import { assertSessionName } from "./invoke-input.js";
|
|
5
|
+
import { assertAgentEnv, assertSessionName } from "./invoke-input.js";
|
|
5
6
|
export { assertJsonByteLimit } from "./json-size.js";
|
|
6
7
|
export { INVOKE_REQUEST_MAX_BYTES, assertInvokeRequestSize } from "./invoke-size.js";
|
|
7
8
|
export * from "./stream-limits.js";
|
|
8
9
|
export { assertKernelStatus, assertServiceProcessSnapshot } from "./service-processes.js";
|
|
9
10
|
export * from "./run-protocol.js";
|
|
10
11
|
export * from "./invoke-input.js";
|
|
11
|
-
export * from "./model-context.js";
|
|
12
|
-
export * from "./execution-plan.js";
|
|
13
12
|
export { contextHash } from "./context-hash.js";
|
|
14
13
|
export { assertJsonValue } from "./context.js";
|
|
15
14
|
import { assertExperiencePayload } from "./experience.js";
|
|
16
15
|
export { PROVIDER_DIAGNOSTIC_MAX_BYTES } from "./experience.js";
|
|
17
16
|
import { assertModelInputParts, assertImageRecoveryParts, hasImageInput } from "./multimodal.js";
|
|
18
17
|
export { IMAGE_INPUT_LIMITS, IMAGE_INPUT_MIME_TYPES, assertModelInputParts, providerInputParts, hasImageInput, modelPartsFromInput } from "./multimodal.js";
|
|
19
|
-
import {
|
|
20
|
-
export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp,
|
|
18
|
+
import { assertApprovalMode, assertContextEnvs, assertJsonValue, MAX_RUN_TIMEOUT_MS } from "./context.js";
|
|
19
|
+
export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, canonicalContext, contextItem, mergeContext } from "./context.js";
|
|
21
20
|
export { RUNTIME_SELECTION_SCHEMA, assertResolvedRuntimeSelection } from "./runtime-selection.js";
|
|
22
21
|
export { CONTEXT_TYPE_CATALOG, contextTypeDefinition, findContextTypeDefinition } from "./context-catalog.js";
|
|
23
22
|
export { assertContextConfiguration, resolveContextConfiguration } from "./context-configuration.js";
|
|
@@ -85,146 +84,16 @@ export const INTERACTION_RESPONSE_OUTCOMES = [
|
|
|
85
84
|
"answered",
|
|
86
85
|
"cancelled"
|
|
87
86
|
];
|
|
88
|
-
/**
|
|
87
|
+
/** Exact caller-provided text for the provider turn. */
|
|
89
88
|
export function providerInputText(request) {
|
|
90
89
|
return request.modelInput;
|
|
91
90
|
}
|
|
92
|
-
/** Inject trusted instructions only when starting a provider session, including a fresh restart. */
|
|
93
|
-
export function initialControlInstructions(request, freshSession = !request.providerSession?.sessionId) {
|
|
94
|
-
return freshSession ? request.controlInstructions : "";
|
|
95
|
-
}
|
|
96
91
|
/** Exact alternate input for a provider that could not resume its session. */
|
|
97
92
|
export function freshFallbackInputText(request) {
|
|
98
93
|
if (request.freshFallbackImagesUnavailable)
|
|
99
94
|
throw new TypeError("ARTIFACT_UNAVAILABLE: historical images cannot be restored");
|
|
100
95
|
return request.freshFallbackModelInput ?? providerInputText(request);
|
|
101
96
|
}
|
|
102
|
-
/** Runtime validation at the Agent Work plugin boundary; JSON schema remains the wire source of truth. */
|
|
103
|
-
export function assertChannelScope(value) {
|
|
104
|
-
if (!isRecord(value))
|
|
105
|
-
throw new TypeError("channel context scope must be an object");
|
|
106
|
-
for (const key of ["tenant_id", "endpoint_id", "channel", "bot_id", "conversation_id"]) {
|
|
107
|
-
if (typeof value[key] !== "string" || value[key].length === 0) {
|
|
108
|
-
throw new TypeError(`channel context scope.${key} must be a non-empty string`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (!(typeof value.account_id === "string" || value.account_id === null)) {
|
|
112
|
-
throw new TypeError("channel context scope.account_id must be a string or null");
|
|
113
|
-
}
|
|
114
|
-
if (value.thread_id !== undefined &&
|
|
115
|
-
value.thread_id !== null &&
|
|
116
|
-
typeof value.thread_id !== "string") {
|
|
117
|
-
throw new TypeError("channel context scope.thread_id must be a string, null, or omitted");
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
export function assertChannelMessageFact(value) {
|
|
121
|
-
if (!isRecord(value))
|
|
122
|
-
throw new TypeError("channel context fact must be an object");
|
|
123
|
-
if (typeof value.message_id !== "string" || value.message_id.length === 0) {
|
|
124
|
-
throw new TypeError("channel context fact.message_id must be a non-empty string");
|
|
125
|
-
}
|
|
126
|
-
if (value.message_seq !== undefined &&
|
|
127
|
-
(!Number.isSafeInteger(value.message_seq) || Number(value.message_seq) < 0)) {
|
|
128
|
-
throw new TypeError("channel context fact.message_seq must be a non-negative safe integer when present");
|
|
129
|
-
}
|
|
130
|
-
const sender = value.sender;
|
|
131
|
-
if (!isRecord(sender) || typeof sender.id !== "string" || sender.id.length === 0) {
|
|
132
|
-
throw new TypeError("channel context fact.sender.id must be a non-empty string");
|
|
133
|
-
}
|
|
134
|
-
if (typeof sender.kind !== "string" || sender.kind.length === 0) {
|
|
135
|
-
throw new TypeError("channel context fact.sender.kind must be a non-empty string");
|
|
136
|
-
}
|
|
137
|
-
if (sender.label !== undefined && typeof sender.label !== "string") {
|
|
138
|
-
throw new TypeError("channel context fact.sender.label must be a string when present");
|
|
139
|
-
}
|
|
140
|
-
if (!Number.isSafeInteger(value.occurred_at_ms) || Number(value.occurred_at_ms) <= 0) {
|
|
141
|
-
throw new TypeError("channel context fact.occurred_at_ms must be a positive safe integer");
|
|
142
|
-
}
|
|
143
|
-
if (!Array.isArray(value.parts) ||
|
|
144
|
-
value.parts.length === 0 ||
|
|
145
|
-
value.parts.some((part) => !isRecord(part) ||
|
|
146
|
-
typeof part.type !== "string" ||
|
|
147
|
-
part.type.length === 0 ||
|
|
148
|
-
(part.text !== undefined && typeof part.text !== "string"))) {
|
|
149
|
-
throw new TypeError("channel context fact.parts must contain at least one typed object");
|
|
150
|
-
}
|
|
151
|
-
if (value.flags !== undefined &&
|
|
152
|
-
(!isRecord(value.flags) ||
|
|
153
|
-
(value.flags.self !== undefined && typeof value.flags.self !== "boolean") ||
|
|
154
|
-
(value.flags.control !== undefined && typeof value.flags.control !== "boolean"))) {
|
|
155
|
-
throw new TypeError("channel context fact.flags must contain optional boolean self/control values");
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
export function assertChannelContextAppend(value) {
|
|
159
|
-
if (!isRecord(value))
|
|
160
|
-
throw new TypeError("channel context append must be an object");
|
|
161
|
-
if (typeof value.agent_id !== "string" ||
|
|
162
|
-
value.agent_id.length < 1 ||
|
|
163
|
-
value.agent_id.length > 96) {
|
|
164
|
-
throw new TypeError("channel context append.agent_id must contain 1..96 characters");
|
|
165
|
-
}
|
|
166
|
-
assertChannelScope(value.scope);
|
|
167
|
-
if (!Array.isArray(value.facts) || value.facts.length < 1 || value.facts.length > 100) {
|
|
168
|
-
throw new TypeError("channel context append.facts must contain 1..100 facts");
|
|
169
|
-
}
|
|
170
|
-
for (const fact of value.facts)
|
|
171
|
-
assertChannelMessageFact(fact);
|
|
172
|
-
if (value.gap_after_seq !== undefined &&
|
|
173
|
-
(!Number.isSafeInteger(value.gap_after_seq) || Number(value.gap_after_seq) < 0)) {
|
|
174
|
-
throw new TypeError("channel context append.gap_after_seq must be a non-negative safe integer when present");
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
export function assertContextSyncResult(value) {
|
|
178
|
-
if (!isRecord(value))
|
|
179
|
-
throw new TypeError("context sync result must be an object");
|
|
180
|
-
assertChannelScope(value.scope);
|
|
181
|
-
if (!Array.isArray(value.facts) || value.facts.length > 100) {
|
|
182
|
-
throw new TypeError("context sync result.facts must contain at most 100 facts");
|
|
183
|
-
}
|
|
184
|
-
for (const fact of value.facts)
|
|
185
|
-
assertChannelMessageFact(fact);
|
|
186
|
-
const result = value;
|
|
187
|
-
if (typeof result.request_id !== "string" || result.request_id.length === 0) {
|
|
188
|
-
throw new TypeError("context sync result.request_id must be a non-empty string");
|
|
189
|
-
}
|
|
190
|
-
if (!["complete", "partial", "unavailable"].includes(result.completeness)) {
|
|
191
|
-
throw new TypeError("context sync result.completeness is invalid");
|
|
192
|
-
}
|
|
193
|
-
if (result.completeness === "unavailable" && result.facts.length !== 0) {
|
|
194
|
-
throw new TypeError("unavailable context sync result must not contain facts");
|
|
195
|
-
}
|
|
196
|
-
if (result.through_seq !== undefined &&
|
|
197
|
-
(!Number.isSafeInteger(result.through_seq) || Number(result.through_seq) < 0)) {
|
|
198
|
-
throw new TypeError("context sync result.through_seq must be a non-negative safe integer when present");
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
export function assertChannelContextDescriptor(value) {
|
|
202
|
-
if (!isRecord(value))
|
|
203
|
-
throw new TypeError("channel context descriptor must be an object");
|
|
204
|
-
assertChannelScope(value.scope);
|
|
205
|
-
if (typeof value.consumer_key !== "string" || value.consumer_key.length === 0) {
|
|
206
|
-
throw new TypeError("channel context descriptor.consumer_key must be a non-empty string");
|
|
207
|
-
}
|
|
208
|
-
if (!Number.isSafeInteger(value.session_generation) || Number(value.session_generation) < 1) {
|
|
209
|
-
throw new TypeError("channel context descriptor.session_generation must be a positive safe integer");
|
|
210
|
-
}
|
|
211
|
-
if (typeof value.trigger_message_id !== "string" || value.trigger_message_id.length === 0) {
|
|
212
|
-
throw new TypeError("channel context descriptor.trigger_message_id must be a non-empty string");
|
|
213
|
-
}
|
|
214
|
-
assertChannelMessageFact(value.trigger_fact);
|
|
215
|
-
if (value.trigger_fact.message_id !== value.trigger_message_id) {
|
|
216
|
-
throw new TypeError("channel context descriptor trigger_fact.message_id must match trigger_message_id");
|
|
217
|
-
}
|
|
218
|
-
if (value.trigger_seq !== undefined &&
|
|
219
|
-
(!Number.isSafeInteger(value.trigger_seq) || Number(value.trigger_seq) < 0)) {
|
|
220
|
-
throw new TypeError("channel context descriptor.trigger_seq must be a non-negative safe integer when present");
|
|
221
|
-
}
|
|
222
|
-
const hasTriggerSeq = value.trigger_seq !== undefined;
|
|
223
|
-
const factHasTriggerSeq = value.trigger_fact.message_seq !== undefined;
|
|
224
|
-
if (hasTriggerSeq !== factHasTriggerSeq || value.trigger_fact.message_seq !== value.trigger_seq) {
|
|
225
|
-
throw new TypeError("channel context descriptor trigger_fact.message_seq must match trigger_seq");
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
97
|
export const TERMINAL_EVENTS = new Set(TERMINAL_EVENT_TYPES);
|
|
229
98
|
export const EVENT_TYPES = new Set(CANONICAL_EVENT_TYPES);
|
|
230
99
|
export const MESSAGE_EXPOSURES = new Set([
|
|
@@ -552,63 +421,49 @@ export function assertFailureEnvelope(value) {
|
|
|
552
421
|
throw new TypeError("failure.cause must contain reasonCode");
|
|
553
422
|
}
|
|
554
423
|
}
|
|
555
|
-
/**
|
|
424
|
+
/** 校验内部调用的身份、内容与信封结构;不改写输入,配置和目录语义由消费它的 Adapter 校验。 */
|
|
556
425
|
export function assertInvokeRequest(request) {
|
|
557
426
|
if (!isRecord(request))
|
|
558
427
|
throw new TypeError("InvokeRequest must be an object");
|
|
428
|
+
if ("controlInstructions" in request)
|
|
429
|
+
throw new TypeError("CONTROL_INSTRUCTIONS_REMOVED: controlInstructions was removed; provide application prompts in inputs.parts");
|
|
559
430
|
if (request.sessionName !== undefined)
|
|
560
431
|
assertSessionName(request.sessionName);
|
|
561
432
|
if (request.protocolVersion !== PROTOCOL_VERSION)
|
|
562
433
|
throw new TypeError("InvokeRequest.protocolVersion must be 2");
|
|
563
434
|
if ("appendInstructions" in request)
|
|
564
435
|
throw new TypeError("LEGACY_RUN_CONTRACT_REJECTED");
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
436
|
+
const allowed = new Set([
|
|
437
|
+
"protocolVersion",
|
|
438
|
+
"invocationId",
|
|
439
|
+
"agentSessionId",
|
|
440
|
+
"runId",
|
|
441
|
+
"sessionName",
|
|
442
|
+
"sessionGeneration",
|
|
443
|
+
"providerEpoch",
|
|
444
|
+
"continuityMode",
|
|
445
|
+
"prompt",
|
|
446
|
+
"modelInput",
|
|
447
|
+
"modelInputParts",
|
|
448
|
+
"freshFallbackModelInput",
|
|
449
|
+
"freshFallbackModelInputParts",
|
|
450
|
+
"freshFallbackImagesUnavailable",
|
|
451
|
+
"runMetadata",
|
|
452
|
+
"agentEnv",
|
|
453
|
+
"providerSession",
|
|
454
|
+
"signal",
|
|
455
|
+
"executionEnvOverrides"
|
|
456
|
+
]);
|
|
457
|
+
if (Object.keys(request).some((key) => !allowed.has(key)))
|
|
458
|
+
throw new TypeError("InvokeRequest contains an unknown field");
|
|
459
|
+
assertAgentEnv(request.agentEnv);
|
|
460
|
+
if (request.executionEnvOverrides !== undefined)
|
|
568
461
|
assertContextEnvs(request.executionEnvOverrides);
|
|
569
|
-
if (Buffer.byteLength(JSON.stringify(request.executionEnvOverrides)) > 65_536)
|
|
570
|
-
throw new TypeError("EXECUTION_ENV_TOO_LARGE");
|
|
571
|
-
}
|
|
572
|
-
assertApprovalMode(request.approvalMode);
|
|
573
|
-
const modelChoices = contextItem(request.context, "octo.execution", "model")?.payload;
|
|
574
|
-
const approvalPolicy = contextItem(request.context, "octo.security", "approval_policy")?.payload;
|
|
575
|
-
if (approvalPolicy && approvalPolicy.mode !== request.approvalMode)
|
|
576
|
-
throw new TypeError("CONTEXT_PLAN_MISMATCH");
|
|
577
|
-
const agentConfig = request.agentConfig;
|
|
578
|
-
if (isRecord(agentConfig) &&
|
|
579
|
-
["autoApprove", "dangerouslyBypassPermissions", "permissionMode"].some((key) => key in agentConfig)) {
|
|
580
|
-
throw new TypeError("LEGACY_PERMISSION_CONFIG_REJECTED");
|
|
581
|
-
}
|
|
582
|
-
if (isRecord(agentConfig) && "thinking" in agentConfig)
|
|
583
|
-
throw new TypeError("LEGACY_REASONING_CONFIG_REJECTED");
|
|
584
|
-
for (const selection of [
|
|
585
|
-
{ name: "selection", property: "id", config: "model" },
|
|
586
|
-
{ name: "reasoning", property: "effort", config: "effort" }
|
|
587
|
-
]) {
|
|
588
|
-
const selected = modelChoices?.[selection.name];
|
|
589
|
-
if (selected &&
|
|
590
|
-
selected[selection.property] !==
|
|
591
|
-
(isRecord(agentConfig) ? agentConfig[selection.config] : undefined))
|
|
592
|
-
throw new TypeError("CONTEXT_PLAN_MISMATCH");
|
|
593
|
-
}
|
|
594
|
-
const workspace = contextItem(request.context, "octo.execution", "workspace")?.payload;
|
|
595
|
-
if (workspace?.mode === "fixed" && workspace.path !== request.workdir)
|
|
596
|
-
throw new TypeError("CONTEXT_PLAN_MISMATCH");
|
|
597
|
-
if (["skills", "skillRoots", "providerStateDir", "mcpServers"].some((key) => Object.hasOwn(request, key)))
|
|
598
|
-
throw new TypeError("LOCAL_PLUGIN_CONFIGURATION_REQUIRED");
|
|
599
|
-
if (typeof request.controlInstructions !== "string")
|
|
600
|
-
throw new TypeError("InvokeRequest.controlInstructions must be a string");
|
|
601
|
-
if (request.runtimeLimits !== undefined)
|
|
602
|
-
assertRuntimeLimits(request.runtimeLimits);
|
|
603
462
|
for (const key of ["invocationId", "agentSessionId", "runId", "prompt"]) {
|
|
604
463
|
if (typeof request[key] !== "string" || request[key].length === 0) {
|
|
605
464
|
throw new TypeError(`InvokeRequest.${key} must be a non-empty string`);
|
|
606
465
|
}
|
|
607
466
|
}
|
|
608
|
-
const providerWorkspace = contextItem(request.context, "octo.execution", "adapter")?.payload.type === "openclaw";
|
|
609
|
-
if (typeof request.workdir !== "string" ||
|
|
610
|
-
(!request.workdir && request.agentSource !== "preset" && !providerWorkspace))
|
|
611
|
-
throw new TypeError("InvokeRequest.workdir is required for provisioned execution");
|
|
612
467
|
if (typeof request.modelInput !== "string" || request.modelInput.length === 0) {
|
|
613
468
|
throw new TypeError("InvokeRequest.modelInput must be a non-empty string");
|
|
614
469
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CanonicalEvent, type ContextEnvelope, type ContextEnvsPayload, type HostFrame, type InvokeRequest, type ModelInputPart, type ProviderSession } from "./index.js";
|
|
2
2
|
import type { StreamLimitPolicy } from "./stream-limits.js";
|
|
3
3
|
/**
|
|
4
4
|
* Public JSON invocation contract shared by CLI, SDK and channels.
|
|
@@ -27,7 +27,7 @@ export declare class InvokeInput {
|
|
|
27
27
|
providerEpoch?: number;
|
|
28
28
|
/** Display-safe description; defaults to the textual summary of inputs. */
|
|
29
29
|
prompt?: string;
|
|
30
|
-
/**
|
|
30
|
+
/** 显式值替换纯文本 inputs 的 Provider 正文;有图片时保留原有有序 parts。 */
|
|
31
31
|
modelInput?: string;
|
|
32
32
|
/** JSON metadata for tracing/business identity; not model text or authorization evidence. */
|
|
33
33
|
runMetadata?: Record<string, unknown>;
|
|
@@ -35,9 +35,9 @@ export declare class InvokeInput {
|
|
|
35
35
|
providerSession?: ProviderSession;
|
|
36
36
|
/** Fresh/continue intent; defaults to continue with providerSession, fresh otherwise. */
|
|
37
37
|
continuityMode?: "fresh" | "continue";
|
|
38
|
-
/**
|
|
38
|
+
/** 调用方完整恢复文本;无显式恢复 parts 时优先于主输入,不自动补历史。 */
|
|
39
39
|
freshFallbackModelInput?: string;
|
|
40
|
-
/**
|
|
40
|
+
/** 显式恢复 parts 优先于恢复文本和主输入;须保留当前图片及其顺序。 */
|
|
41
41
|
freshFallbackModelInputParts?: ModelInputPart[];
|
|
42
42
|
/** Explicitly fail fresh fallback when historical image bytes cannot be supplied. */
|
|
43
43
|
freshFallbackImagesUnavailable?: boolean;
|
|
@@ -45,20 +45,7 @@ export declare class InvokeInput {
|
|
|
45
45
|
static check(value: unknown): InvokeInput;
|
|
46
46
|
}
|
|
47
47
|
/** 可复用执行配置;信封格式保持 v3,业务材料必须由调用方放入 inputs。 */
|
|
48
|
-
export
|
|
49
|
-
/** Agent ownership: preset for OpenClaw by default, provisioned otherwise. */
|
|
50
|
-
agentSource?: AgentSource;
|
|
51
|
-
/** Provider cwd; defaults to the resolved workspace (local cwd when omitted). */
|
|
52
|
-
workdir?: string;
|
|
53
|
-
/** Trusted instructions, separate from model business context; derived if omitted. */
|
|
54
|
-
controlInstructions?: string;
|
|
55
|
-
/** Execution approval policy, normally resolved from contexts; defaults to ask. */
|
|
56
|
-
approvalMode?: ApprovalMode;
|
|
57
|
-
/** Full provider configuration, including providerOptions; context selections must agree. */
|
|
58
|
-
agentConfig?: AgentConfig;
|
|
59
|
-
/** Complete timeout/enforcement settings; execution defaults apply when omitted. */
|
|
60
|
-
runtimeLimits?: RuntimeLimits;
|
|
61
|
-
}
|
|
48
|
+
export type AgentEnv = ContextEnvelope;
|
|
62
49
|
/** 高级调用的内容与追踪信息;不包含执行环境、会话参数或本地 signal。 */
|
|
63
50
|
export type InvocationContent = Omit<InvokeInput, "inputs" | "agentEnv" | "sessionId" | "providerSession"> & {
|
|
64
51
|
parts: ModelInputPart[];
|
|
@@ -67,6 +54,8 @@ export type InvocationInputs = ModelInputPart[] | InvocationContent;
|
|
|
67
54
|
/** Local ingress execution settings, outside caller-owned JSON and Context. */
|
|
68
55
|
export interface InvokeEnvironment {
|
|
69
56
|
signal?: AbortSignal;
|
|
57
|
+
/** 宿主连接配置独立于调用方信封,仅由目标 Adapter 消费。 */
|
|
58
|
+
providerOptions?: Record<string, string>;
|
|
70
59
|
/** Trusted per-invocation values; forwarded privately across the Host process boundary. */
|
|
71
60
|
executionEnvOverrides?: ContextEnvsPayload;
|
|
72
61
|
/** Trusted transport and replay budgets; never sourced from caller Context. */
|
|
@@ -92,7 +81,7 @@ export declare function identifyInvokeInput(input: InvokeInput): {
|
|
|
92
81
|
providerEpoch?: number;
|
|
93
82
|
/** Display-safe description; defaults to the textual summary of inputs. */
|
|
94
83
|
prompt?: string;
|
|
95
|
-
/**
|
|
84
|
+
/** 显式值替换纯文本 inputs 的 Provider 正文;有图片时保留原有有序 parts。 */
|
|
96
85
|
modelInput?: string;
|
|
97
86
|
/** JSON metadata for tracing/business identity; not model text or authorization evidence. */
|
|
98
87
|
runMetadata?: Record<string, unknown>;
|
|
@@ -100,9 +89,9 @@ export declare function identifyInvokeInput(input: InvokeInput): {
|
|
|
100
89
|
providerSession?: ProviderSession;
|
|
101
90
|
/** Fresh/continue intent; defaults to continue with providerSession, fresh otherwise. */
|
|
102
91
|
continuityMode?: "fresh" | "continue";
|
|
103
|
-
/**
|
|
92
|
+
/** 调用方完整恢复文本;无显式恢复 parts 时优先于主输入,不自动补历史。 */
|
|
104
93
|
freshFallbackModelInput?: string;
|
|
105
|
-
/**
|
|
94
|
+
/** 显式恢复 parts 优先于恢复文本和主输入;须保留当前图片及其顺序。 */
|
|
106
95
|
freshFallbackModelInputParts?: ModelInputPart[];
|
|
107
96
|
/** Explicitly fail fresh fallback when historical image bytes cannot be supplied. */
|
|
108
97
|
freshFallbackImagesUnavailable?: boolean;
|
|
@@ -123,5 +112,5 @@ export declare function assertInvokeInput(value: unknown): asserts value is Invo
|
|
|
123
112
|
export declare function assertSessionName(value: unknown): asserts value is string;
|
|
124
113
|
/** Lossless field reorganization of a validated prepared execution, excluding its local signal. */
|
|
125
114
|
export declare function invocationInput(request: InvokeRequest, protocol_mode?: "native" | "canonical", adapterType?: string): InvokeInput;
|
|
126
|
-
/**
|
|
115
|
+
/** 公共层只校验信封;共性与私有 payload 由消费它的 Adapter 校验。 */
|
|
127
116
|
export declare function assertAgentEnv(value: unknown): asserts value is AgentEnv;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assertContextEnvelope, assertModelInputParts } from "./index.js";
|
|
2
2
|
import { assertJsonValue } from "./context.js";
|
|
3
3
|
import { canonicalEvents } from "./run-protocol.js";
|
|
4
4
|
import { assertJsonByteLimit } from "./json-size.js";
|
|
@@ -39,11 +39,40 @@ export function createInputInvoke(source) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
export function assertInvokeInput(value) {
|
|
42
|
+
if (value &&
|
|
43
|
+
typeof value === "object" &&
|
|
44
|
+
("controlInstructions" in value ||
|
|
45
|
+
("agentEnv" in value &&
|
|
46
|
+
value.agentEnv &&
|
|
47
|
+
typeof value.agentEnv === "object" &&
|
|
48
|
+
"controlInstructions" in value.agentEnv)))
|
|
49
|
+
throw new TypeError("CONTROL_INSTRUCTIONS_REMOVED: controlInstructions was removed; provide application prompts in inputs.parts");
|
|
42
50
|
assertJsonByteLimit(value instanceof InvokeInput ? { ...value } : value, INVOKE_REQUEST_MAX_BYTES, "INVOKE_REQUEST_TOO_LARGE");
|
|
43
51
|
assertJsonValue(value);
|
|
44
52
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
45
53
|
throw new TypeError("InvokeInput must be a JSON object");
|
|
46
54
|
const input = value;
|
|
55
|
+
const allowed = new Set([
|
|
56
|
+
"inputs",
|
|
57
|
+
"agentEnv",
|
|
58
|
+
"sessionId",
|
|
59
|
+
"sessionName",
|
|
60
|
+
"protocol_mode",
|
|
61
|
+
"invocationId",
|
|
62
|
+
"runId",
|
|
63
|
+
"sessionGeneration",
|
|
64
|
+
"providerEpoch",
|
|
65
|
+
"prompt",
|
|
66
|
+
"modelInput",
|
|
67
|
+
"runMetadata",
|
|
68
|
+
"providerSession",
|
|
69
|
+
"continuityMode",
|
|
70
|
+
"freshFallbackModelInput",
|
|
71
|
+
"freshFallbackModelInputParts",
|
|
72
|
+
"freshFallbackImagesUnavailable"
|
|
73
|
+
]);
|
|
74
|
+
if (Object.keys(input).some((key) => !allowed.has(key)))
|
|
75
|
+
throw new TypeError("InvokeInput contains an unknown field; use AgentEnv items for execution settings");
|
|
47
76
|
if ([
|
|
48
77
|
"protocolMode",
|
|
49
78
|
"adapterType",
|
|
@@ -52,9 +81,7 @@ export function assertInvokeInput(value) {
|
|
|
52
81
|
"contexts",
|
|
53
82
|
"agentSource",
|
|
54
83
|
"workdir",
|
|
55
|
-
"controlInstructions",
|
|
56
84
|
"approvalMode",
|
|
57
|
-
"agentConfig",
|
|
58
85
|
"runtimeLimits"
|
|
59
86
|
].some((key) => Object.hasOwn(input, key)))
|
|
60
87
|
throw new TypeError("InvokeInput requires the unified JSON contract, not a prepared request wrapper");
|
|
@@ -127,11 +154,11 @@ export function assertSessionName(value) {
|
|
|
127
154
|
}
|
|
128
155
|
/** Lossless field reorganization of a validated prepared execution, excluding its local signal. */
|
|
129
156
|
export function invocationInput(request, protocol_mode = "native", adapterType) {
|
|
130
|
-
const { protocolVersion: _version, signal: _signal, executionEnvOverrides: _executionEnvOverrides, agentSessionId,
|
|
157
|
+
const { protocolVersion: _version, signal: _signal, executionEnvOverrides: _executionEnvOverrides, agentSessionId, agentEnv, modelInputParts, ...fields } = request;
|
|
131
158
|
void _version;
|
|
132
159
|
void _signal;
|
|
133
160
|
void _executionEnvOverrides;
|
|
134
|
-
const contexts = structuredClone(
|
|
161
|
+
const contexts = structuredClone(agentEnv);
|
|
135
162
|
if (adapterType) {
|
|
136
163
|
const adapter = contexts.items.find((item) => item.namespace === "octo.execution" && item.name === "adapter");
|
|
137
164
|
if (adapter && adapter.payload.type !== adapterType)
|
|
@@ -140,87 +167,20 @@ export function invocationInput(request, protocol_mode = "native", adapterType)
|
|
|
140
167
|
contexts.items.push({
|
|
141
168
|
namespace: "octo.execution",
|
|
142
169
|
name: "adapter",
|
|
143
|
-
payload: {
|
|
144
|
-
type: adapterType,
|
|
145
|
-
...(adapterType === "openclaw"
|
|
146
|
-
? { provider_agent_id: request.agentConfig.providerAgentId ?? "main" }
|
|
147
|
-
: {})
|
|
148
|
-
}
|
|
170
|
+
payload: { type: adapterType }
|
|
149
171
|
});
|
|
150
172
|
}
|
|
151
173
|
return InvokeInput.check({
|
|
152
174
|
...fields,
|
|
153
175
|
sessionId: agentSessionId,
|
|
154
|
-
agentEnv:
|
|
155
|
-
...contexts,
|
|
156
|
-
agentSource,
|
|
157
|
-
workdir,
|
|
158
|
-
controlInstructions,
|
|
159
|
-
approvalMode,
|
|
160
|
-
agentConfig,
|
|
161
|
-
runtimeLimits
|
|
162
|
-
}).filter(([, value]) => value !== undefined)),
|
|
176
|
+
agentEnv: contexts,
|
|
163
177
|
protocol_mode,
|
|
164
178
|
inputs: modelInputParts ?? [{ type: "text", text: request.modelInput }]
|
|
165
179
|
});
|
|
166
180
|
}
|
|
167
|
-
/**
|
|
181
|
+
/** 公共层只校验信封;共性与私有 payload 由消费它的 Adapter 校验。 */
|
|
168
182
|
export function assertAgentEnv(value) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
throw new TypeError("agentEnv must be an execution envelope");
|
|
173
|
-
const env = value;
|
|
174
|
-
assertContextEnvelope({ schema: env.schema, items: env.items });
|
|
175
|
-
const allowed = new Set([
|
|
176
|
-
"schema",
|
|
177
|
-
"items",
|
|
178
|
-
"agentSource",
|
|
179
|
-
"workdir",
|
|
180
|
-
"controlInstructions",
|
|
181
|
-
"approvalMode",
|
|
182
|
-
"agentConfig",
|
|
183
|
-
"runtimeLimits"
|
|
184
|
-
]);
|
|
185
|
-
if (Object.keys(env).some((key) => !allowed.has(key)))
|
|
186
|
-
throw new TypeError("agentEnv contains an unknown execution setting");
|
|
187
|
-
for (const item of env.items)
|
|
188
|
-
if (!(item.namespace === "octo.execution" ||
|
|
189
|
-
(item.namespace === "octo.security" && item.name === "approval_policy") ||
|
|
190
|
-
(item.namespace === "octo.control" && item.name === "instructions")))
|
|
191
|
-
throw new TypeError("agentEnv cannot contain business context; prepare inputs in the application");
|
|
192
|
-
for (const key of ["workdir", "controlInstructions"])
|
|
193
|
-
if (env[key] !== undefined && typeof env[key] !== "string")
|
|
194
|
-
throw new TypeError(`agentEnv.${key} must be a string`);
|
|
195
|
-
if (env.agentSource !== undefined)
|
|
196
|
-
assertAgentSource(env.agentSource);
|
|
197
|
-
if (env.approvalMode !== undefined)
|
|
198
|
-
assertApprovalMode(env.approvalMode);
|
|
199
|
-
if (env.runtimeLimits !== undefined)
|
|
200
|
-
assertRuntimeLimits(env.runtimeLimits);
|
|
201
|
-
if (env.agentConfig !== undefined &&
|
|
202
|
-
(!env.agentConfig || typeof env.agentConfig !== "object" || Array.isArray(env.agentConfig)))
|
|
203
|
-
throw new TypeError("agentEnv.agentConfig must be a JSON object");
|
|
204
|
-
if (env.agentConfig) {
|
|
205
|
-
const config = env.agentConfig;
|
|
206
|
-
for (const key of [
|
|
207
|
-
"workdir",
|
|
208
|
-
"model",
|
|
209
|
-
"sandbox",
|
|
210
|
-
"providerAgentId",
|
|
211
|
-
"effort",
|
|
212
|
-
"openclawConfigPath",
|
|
213
|
-
"openclawStateDir"
|
|
214
|
-
])
|
|
215
|
-
if (config[key] !== undefined && typeof config[key] !== "string")
|
|
216
|
-
throw new TypeError(`agentConfig.${key} must be a string`);
|
|
217
|
-
if (config.timeoutSeconds !== undefined &&
|
|
218
|
-
(typeof config.timeoutSeconds !== "number" || config.timeoutSeconds <= 0))
|
|
219
|
-
throw new TypeError("agentConfig.timeoutSeconds must be positive");
|
|
220
|
-
if (config.providerOptions !== undefined &&
|
|
221
|
-
(!config.providerOptions ||
|
|
222
|
-
typeof config.providerOptions !== "object" ||
|
|
223
|
-
Array.isArray(config.providerOptions)))
|
|
224
|
-
throw new TypeError("agentConfig.providerOptions must be a JSON object");
|
|
225
|
-
}
|
|
183
|
+
if (value && typeof value === "object" && "controlInstructions" in value)
|
|
184
|
+
throw new TypeError("CONTROL_INSTRUCTIONS_REMOVED: controlInstructions was removed; provide application prompts in inputs.parts");
|
|
185
|
+
assertContextEnvelope(value);
|
|
226
186
|
}
|
|
@@ -63,6 +63,12 @@ export function providerInputParts(request, freshFallback = false) {
|
|
|
63
63
|
if (freshFallback && request.freshFallbackImagesUnavailable)
|
|
64
64
|
throw new TypeError("ARTIFACT_UNAVAILABLE: historical images cannot be restored");
|
|
65
65
|
assertImageRecoveryParts(request);
|
|
66
|
+
// 显式恢复文本属于调用方完整输入;不能被 Core 保留的当前轮 parts 覆盖。
|
|
67
|
+
// 图片恢复已由上面的检查保证,禁止用纯文本悄悄丢弃当前图片。
|
|
68
|
+
if (freshFallback &&
|
|
69
|
+
request.freshFallbackModelInputParts === undefined &&
|
|
70
|
+
request.freshFallbackModelInput !== undefined)
|
|
71
|
+
return [{ type: "text", text: request.freshFallbackModelInput }];
|
|
66
72
|
const parts = freshFallback
|
|
67
73
|
? (request.freshFallbackModelInputParts ?? request.modelInputParts)
|
|
68
74
|
: request.modelInputParts;
|