qlogicagent 2.3.0 → 2.5.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.
Files changed (68) hide show
  1. package/dist/agent.js +6 -6
  2. package/dist/cli.js +209 -208
  3. package/dist/index.js +234 -233
  4. package/dist/orchestration.js +2 -2
  5. package/dist/protocol.js +1 -0
  6. package/dist/types/agent/tunable-defaults.d.ts +7 -0
  7. package/dist/types/agent/types.d.ts +24 -100
  8. package/dist/types/cli/stdio-server.d.ts +11 -0
  9. package/dist/types/cli/tool-bootstrap.d.ts +6 -0
  10. package/dist/types/contracts/index.d.ts +2 -3
  11. package/dist/types/llm/provider-def.d.ts +3 -0
  12. package/dist/types/llm/transport.d.ts +25 -25
  13. package/dist/types/llm/transports/anthropic-messages.d.ts +2 -2
  14. package/dist/types/llm/transports/gemini-generatecontent.d.ts +2 -2
  15. package/dist/types/llm/transports/openai-chat.d.ts +2 -2
  16. package/dist/types/llm/transports/openai-responses.d.ts +9 -9
  17. package/dist/types/llm/transports/volcengine-responses.d.ts +11 -11
  18. package/dist/types/orchestration/agent-instance.d.ts +15 -0
  19. package/dist/types/orchestration/solo-evaluator.d.ts +13 -0
  20. package/dist/types/orchestration/solo-persistence.d.ts +38 -0
  21. package/dist/types/orchestration/tool-loop/tool-choice-policy.d.ts +1 -1
  22. package/dist/types/protocol/methods.d.ts +173 -53
  23. package/dist/types/protocol/notifications.d.ts +4 -514
  24. package/dist/types/protocol/wire/acp-protocol.d.ts +411 -0
  25. package/dist/types/protocol/wire/agent-events.d.ts +32 -0
  26. package/dist/types/protocol/wire/agent-methods.d.ts +587 -0
  27. package/dist/types/protocol/wire/agent-rpc.d.ts +97 -0
  28. package/dist/types/protocol/wire/capability-manifest.d.ts +111 -0
  29. package/dist/types/protocol/wire/capability-transport.d.ts +207 -0
  30. package/dist/types/protocol/wire/channel-ingress.d.ts +29 -0
  31. package/dist/types/protocol/wire/channel.d.ts +89 -0
  32. package/dist/types/protocol/wire/chat-types.d.ts +87 -0
  33. package/dist/types/protocol/wire/checkpoint-runtime.d.ts +61 -0
  34. package/dist/types/protocol/wire/checkpoint.d.ts +72 -0
  35. package/dist/types/protocol/wire/execution.d.ts +391 -0
  36. package/dist/types/protocol/wire/gateway-rpc.d.ts +314 -0
  37. package/dist/types/protocol/wire/gateway.d.ts +62 -0
  38. package/dist/types/protocol/wire/hook-protocol.d.ts +37 -0
  39. package/dist/types/protocol/wire/index.d.ts +25 -0
  40. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +80 -0
  41. package/dist/types/protocol/wire/notification-payloads.d.ts +581 -0
  42. package/dist/types/protocol/wire/provider-runtime-contract.d.ts +66 -0
  43. package/dist/types/protocol/wire/provider-runtime-core.d.ts +147 -0
  44. package/dist/types/protocol/wire/provider-runtime-io.d.ts +20 -0
  45. package/dist/types/protocol/wire/resource-manifest.d.ts +68 -0
  46. package/dist/types/protocol/wire/session.d.ts +32 -0
  47. package/dist/types/protocol/wire/thread-protocol.d.ts +157 -0
  48. package/dist/types/protocol/wire/transport.d.ts +57 -0
  49. package/dist/types/protocol/wire/turn.d.ts +208 -0
  50. package/dist/types/protocol/wire/web-capability.d.ts +51 -0
  51. package/dist/types/runtime/hooks/memory-hooks.d.ts +2 -2
  52. package/dist/types/runtime/infra/acp-types.d.ts +3 -142
  53. package/dist/types/runtime/infra/token-budget.d.ts +3 -3
  54. package/dist/types/runtime/session/index.d.ts +1 -1
  55. package/dist/types/runtime/session/session-memory.d.ts +46 -0
  56. package/dist/types/runtime/session/session-persistence.d.ts +34 -8
  57. package/dist/types/runtime/session/session-state.d.ts +4 -4
  58. package/dist/types/skills/memory/memory-tool.d.ts +1 -1
  59. package/dist/types/skills/memory/qmemory-adapter.d.ts +2 -2
  60. package/dist/types/skills/memory/qmemory-http-client.d.ts +16 -0
  61. package/dist/types/skills/permissions/hook-runner.d.ts +4 -4
  62. package/dist/types/skills/permissions/permission-classifier.d.ts +2 -2
  63. package/dist/types/skills/tools/project-switch-tool.d.ts +24 -0
  64. package/dist/types/skills/tools.d.ts +5 -5
  65. package/dist/types/transport/acp-event-emitter.d.ts +1 -1
  66. package/dist/types/transport/acp-server.d.ts +17 -10
  67. package/package.json +14 -4
  68. package/dist/types/runtime/execution/remote-agent.d.ts +0 -63
@@ -0,0 +1,111 @@
1
+ import type { WebActionScope, WebApprovalDefault, WebCapabilityDescriptorContract, WebCapabilityFamily, WebCapabilityId, WebDegradationTarget, WebEscalationReason, WebExecutionMode, WebPolicyRiskClass, WebRetryPolicy, WebStatefulness, WebTaskMode } from "./web-capability.js";
2
+ import type { ApprovalRequiredToolContract } from "./session.js";
3
+ export declare const CAPABILITY_MANIFEST_DIFF_SECTIONS: readonly ["gatewayVersion", "toolNamespaces", "workspaceIds", "installedCapabilities", "enabledCapabilities", "features", "approvalMode", "toolManifests", "skillManifests", "pluginManifests", "mcpManifests", "approvalPolicy", "workspaceSummaries"];
4
+ export type CapabilityManifestDiffSection = (typeof CAPABILITY_MANIFEST_DIFF_SECTIONS)[number];
5
+ export type CapabilityManifestApprovalMode = "user-confirm" | "pre-authorized";
6
+ export type CapabilityToolManifestContract = WebCapabilityDescriptorContract & {
7
+ name: string;
8
+ label: string;
9
+ description: string;
10
+ source: "core" | "plugin";
11
+ capabilityId?: WebCapabilityId;
12
+ capabilityFamily?: WebCapabilityFamily;
13
+ taskMode?: WebTaskMode;
14
+ executionMode?: WebExecutionMode;
15
+ statefulness?: WebStatefulness;
16
+ approvalDefault?: WebApprovalDefault;
17
+ policyRiskClass?: WebPolicyRiskClass;
18
+ allowedActionScopes?: WebActionScope[];
19
+ degradationTarget?: WebDegradationTarget;
20
+ upgradeTargets?: WebCapabilityId[];
21
+ escalationReasons?: WebEscalationReason[];
22
+ retryPolicy?: WebRetryPolicy;
23
+ [key: string]: unknown;
24
+ };
25
+ export type CapabilitySkillManifestContract = {
26
+ name: string;
27
+ description: string;
28
+ source: string;
29
+ eligible: boolean;
30
+ disabled: boolean;
31
+ [key: string]: unknown;
32
+ };
33
+ export type CapabilityPluginManifestContract = {
34
+ id: string;
35
+ name: string;
36
+ enabled: boolean;
37
+ status: "loaded" | "disabled" | "error";
38
+ [key: string]: unknown;
39
+ };
40
+ export type CapabilityMcpManifestContract = {
41
+ id: string;
42
+ name: string;
43
+ enabled: boolean;
44
+ status: "connected" | "disconnected" | "error";
45
+ [key: string]: unknown;
46
+ };
47
+ export interface CapabilityManifestApprovalPolicyContract {
48
+ mode: CapabilityManifestApprovalMode;
49
+ execApprovalsConfigured: boolean;
50
+ }
51
+ export interface CapabilityWorkspaceSummaryContract {
52
+ id: string;
53
+ role?: string;
54
+ }
55
+ export interface CapabilityManifestSnapshotContract {
56
+ snapshotVersion: string;
57
+ updatedAt: string;
58
+ syncMode?: "full" | "diff";
59
+ baseSnapshotVersion?: string;
60
+ changedSections?: CapabilityManifestDiffSection[];
61
+ gatewayVersion?: string;
62
+ toolNamespaces: string[];
63
+ workspaceIds: string[];
64
+ installedCapabilities?: string[];
65
+ enabledCapabilities?: string[];
66
+ features?: string[];
67
+ approvalMode?: CapabilityManifestApprovalMode;
68
+ toolManifests?: CapabilityToolManifestContract[];
69
+ skillManifests?: CapabilitySkillManifestContract[];
70
+ pluginManifests?: CapabilityPluginManifestContract[];
71
+ mcpManifests?: CapabilityMcpManifestContract[];
72
+ approvalPolicy?: CapabilityManifestApprovalPolicyContract;
73
+ workspaceSummaries?: CapabilityWorkspaceSummaryContract[];
74
+ }
75
+ export interface HostCapabilitySnapshotContract extends CapabilityManifestSnapshotContract {
76
+ installedCapabilities?: string[];
77
+ enabledCapabilities?: string[];
78
+ }
79
+ export type ToolEligibilityStatus = "installed-disabled" | "installed-awaiting-approval" | "installed-ineligible-context" | "enabled-eligible" | "blocked-by-policy" | "unreachable-runtime";
80
+ export type ToolEligibilityReasonCode = "host_disabled" | "approval_required" | "policy_blocked" | "context_mismatch" | "runtime_unreachable" | "not_installed";
81
+ export type ToolEligibilityResolvedSource = "host-capability" | "plugin-manifest" | "mcp-manifest" | "policy" | "runtime-context";
82
+ export interface RuntimeToolEligibilityContract {
83
+ toolName: string;
84
+ status: ToolEligibilityStatus;
85
+ approvalRequired: boolean;
86
+ reasonCodes: ToolEligibilityReasonCode[];
87
+ eligibilityReason?: ToolEligibilityReasonCode;
88
+ policyBlocked?: boolean;
89
+ contextEligible?: boolean;
90
+ resolvedSource?: ToolEligibilityResolvedSource;
91
+ hostLocalOnly?: boolean;
92
+ }
93
+ export interface RuntimeCapabilityViewContract {
94
+ snapshotVersion: string;
95
+ installedCapabilities: string[];
96
+ enabledCapabilities: string[];
97
+ eligibleTools: RuntimeToolEligibilityContract[];
98
+ ineligibleTools: RuntimeToolEligibilityContract[];
99
+ approvalRequiredTools?: ApprovalRequiredToolContract[];
100
+ }
101
+ export declare function cloneCapabilityManifestSnapshot<T extends CapabilityManifestSnapshotContract>(snapshot: T): T;
102
+ export declare function mergeCapabilityManifestSnapshot(params: {
103
+ previous?: CapabilityManifestSnapshotContract | null;
104
+ update: CapabilityManifestSnapshotContract;
105
+ }): CapabilityManifestSnapshotContract;
106
+ export declare function deriveCapabilityToolNamespaces(toolManifests: ReadonlyArray<Pick<CapabilityToolManifestContract, "name">>): string[];
107
+ export declare function deriveCapabilityWorkspaceIds(workspaceSummaries: ReadonlyArray<Pick<CapabilityWorkspaceSummaryContract, "id">>): string[];
108
+ export declare function createCapabilityManifestDiffPayload<T extends CapabilityManifestSnapshotContract>(params: {
109
+ previous?: T | null;
110
+ current: T;
111
+ }): T | null;
@@ -0,0 +1,207 @@
1
+ import type { ProxyKeySource } from "./transport.js";
2
+ import type { MemoryContextBlock } from "./memory-provider-lifecycle.js";
3
+ import type { WebCapabilityFamily, WebTaskMode, WebExecutionMode, WebStatefulness, WebPolicyRiskClass } from "./web-capability.js";
4
+ export interface TransportCapabilitySummaryContract {
5
+ snapshotVersion: string;
6
+ installedCapabilities: string[];
7
+ enabledCapabilities: string[];
8
+ eligibleToolCount?: number;
9
+ ineligibleToolCount?: number;
10
+ }
11
+ export interface TransportApprovalRequiredToolHintEntry {
12
+ toolName: string;
13
+ reasonCodes?: string[];
14
+ }
15
+ export interface TransportToolEligibilitySummaryEntry {
16
+ toolName: string;
17
+ status: string;
18
+ approvalRequired: boolean;
19
+ reasonCodes?: string[];
20
+ eligibilityReason?: string;
21
+ policyBlocked?: boolean;
22
+ contextEligible?: boolean;
23
+ resolvedSource?: string;
24
+ }
25
+ export interface CapabilityInstallStateSummary {
26
+ installedCapabilities: string[];
27
+ enabledCapabilities: string[];
28
+ }
29
+ export interface CapabilityPolicyHintEntry {
30
+ code: string;
31
+ scope?: string;
32
+ message?: string;
33
+ }
34
+ export interface AgentTurnRequestSpec {
35
+ modality?: "text" | "image" | "video" | "audio" | "music";
36
+ params?: Record<string, unknown>;
37
+ }
38
+ export interface AgentTurnLocalContext {
39
+ capabilitySnapshotVersion?: string;
40
+ toolNamespaces?: string[];
41
+ workspaceIds?: string[];
42
+ capabilitySummary?: TransportCapabilitySummaryContract;
43
+ approvalRequiredToolHint?: TransportApprovalRequiredToolHintEntry[];
44
+ eligibleToolSummary?: TransportToolEligibilitySummaryEntry[];
45
+ ineligibleToolSummary?: TransportToolEligibilitySummaryEntry[];
46
+ memoryContextBlocks?: MemoryContextBlock[];
47
+ }
48
+ export interface AgentTurnClientHints {
49
+ uiSurface?: string;
50
+ locale?: string;
51
+ }
52
+ export interface AgentTurnAttachment {
53
+ id?: string;
54
+ type?: string;
55
+ mimeType?: string;
56
+ url?: string;
57
+ name?: string;
58
+ }
59
+ export interface AgentTurnConversation {
60
+ messages: unknown[];
61
+ attachments?: AgentTurnAttachment[];
62
+ summary?: string;
63
+ }
64
+ export interface AgentTurnExperience {
65
+ mode?: string;
66
+ modelAlias?: string;
67
+ stream?: boolean;
68
+ responseFormat?: string;
69
+ keySource?: ProxyKeySource;
70
+ }
71
+ export interface ToolExecutionStepContext {
72
+ stepIndex?: number;
73
+ stepTotal?: number;
74
+ stepSummary?: string;
75
+ selectedCapabilityId?: string;
76
+ selectedCapabilityFamily?: WebCapabilityFamily;
77
+ selectedTaskMode?: WebTaskMode;
78
+ displayRiskLabel?: string;
79
+ displayFallbackLabel?: string;
80
+ displayBlockedLabel?: string;
81
+ decisionReasonCode?: string;
82
+ fallbackPlanRef?: string;
83
+ }
84
+ export interface ToolInvokeApprovalDescriptor extends ToolExecutionStepContext {
85
+ mode?: "user-confirm" | "pre-authorized";
86
+ reason?: string;
87
+ }
88
+ export interface CapabilityToolManifestEntry {
89
+ name: string;
90
+ label: string;
91
+ description: string;
92
+ source: "core" | "plugin";
93
+ category?: "core" | "media" | "browser" | "session" | "system" | "think";
94
+ groupId?: string;
95
+ pluginId?: string;
96
+ optional?: boolean;
97
+ defaultProfiles?: string[];
98
+ requiredParameters?: string[];
99
+ parametersSummary?: string;
100
+ riskLevel?: "low" | "medium" | "high";
101
+ approvalMode?: "user-confirm" | "pre-authorized";
102
+ requiresApproval?: boolean;
103
+ parallelSafe?: boolean;
104
+ serialOnly?: boolean;
105
+ recoverable?: boolean;
106
+ resultMode?: "final";
107
+ capabilityId?: string;
108
+ capabilityFamily?: WebCapabilityFamily;
109
+ taskMode?: WebTaskMode;
110
+ executionMode?: WebExecutionMode;
111
+ statefulness?: WebStatefulness;
112
+ approvalDefault?: "required" | "conditional" | "none";
113
+ policyRiskClass?: WebPolicyRiskClass;
114
+ requiresRuntimeBackend?: boolean;
115
+ requiresHostBridge?: boolean;
116
+ supportsRenderBackend?: boolean;
117
+ supportsLoginState?: boolean;
118
+ supportsPersistentProfile?: boolean;
119
+ supportsSharedSessionReuse?: boolean;
120
+ supportsTransactionality?: "read-only" | "state-changing";
121
+ allowedActionScopes?: string[];
122
+ degradationTarget?: string;
123
+ upgradeTargets?: string[];
124
+ fallbackChain?: string[];
125
+ escalationReasons?: string[];
126
+ auditRequired?: boolean;
127
+ requiresUserVisibleStep?: boolean;
128
+ retryPolicy?: "none" | "same-capability-once" | "degrade-only";
129
+ repairAfterDenied?: boolean;
130
+ repairAfterUnavailable?: boolean;
131
+ displayRiskLabel?: string;
132
+ displayBlockedLabel?: string;
133
+ displayFallbackLabel?: string;
134
+ }
135
+ export interface CapabilitySkillManifestEntry {
136
+ name: string;
137
+ description: string;
138
+ source: string;
139
+ eligible: boolean;
140
+ disabled: boolean;
141
+ category?: string;
142
+ installable?: boolean;
143
+ }
144
+ export interface CapabilityPluginManifestEntry {
145
+ id: string;
146
+ name: string;
147
+ version?: string;
148
+ description?: string;
149
+ kind?: string;
150
+ origin?: string;
151
+ enabled: boolean;
152
+ status: "loaded" | "disabled" | "error";
153
+ error?: string;
154
+ hasConfigSchema?: boolean;
155
+ capabilityFlags?: string[];
156
+ }
157
+ export interface CapabilityMcpManifestEntry {
158
+ id: string;
159
+ name: string;
160
+ enabled: boolean;
161
+ status: "connected" | "disconnected" | "error";
162
+ serverKind?: string;
163
+ tools?: string[];
164
+ }
165
+ export interface CapabilityApprovalPolicy {
166
+ mode: "user-confirm" | "pre-authorized";
167
+ execApprovalsConfigured: boolean;
168
+ }
169
+ export interface CapabilityWorkspaceSummary {
170
+ id: string;
171
+ role?: string;
172
+ }
173
+ export interface CapabilitySyncPayload {
174
+ snapshotVersion: string;
175
+ updatedAt: string;
176
+ syncMode?: "full" | "diff";
177
+ baseSnapshotVersion?: string;
178
+ changedSections?: string[];
179
+ gatewayVersion?: string;
180
+ toolNamespaces: string[];
181
+ workspaceIds: string[];
182
+ installedCapabilities?: string[];
183
+ enabledCapabilities?: string[];
184
+ features?: string[];
185
+ approvalMode?: "user-confirm" | "pre-authorized";
186
+ toolManifests?: CapabilityToolManifestEntry[];
187
+ skillManifests?: CapabilitySkillManifestEntry[];
188
+ pluginManifests?: CapabilityPluginManifestEntry[];
189
+ mcpManifests?: CapabilityMcpManifestEntry[];
190
+ approvalPolicy?: CapabilityApprovalPolicy;
191
+ policyHints?: CapabilityPolicyHintEntry[];
192
+ workspaceSummaries?: CapabilityWorkspaceSummary[];
193
+ }
194
+ export interface CapabilitySyncMsg extends CapabilitySyncPayload {
195
+ type: "capability.sync";
196
+ id: string;
197
+ }
198
+ export interface CapabilitySyncAckPayload {
199
+ success: true;
200
+ snapshotVersion: string;
201
+ receivedAt: string;
202
+ }
203
+ export interface CapabilitySyncAckMsg {
204
+ type: "capability.sync.ack";
205
+ id: string;
206
+ payload: CapabilitySyncAckPayload;
207
+ }
@@ -0,0 +1,29 @@
1
+ export type GatewayChannelExecutionIngressSource = "channel-ingress";
2
+ export type GatewayChannelExecutionEgressKind = "partial" | "final" | "approval" | "error" | "artifact" | "control";
3
+ export interface GatewayChannelExecutionIngressBindingContract {
4
+ requestId: string;
5
+ gatewayTargetRef: string;
6
+ channelRequestId: string;
7
+ replyTargetRef: string;
8
+ channelType: string;
9
+ channelConversationId: string;
10
+ channelUserId: string;
11
+ dedupeKey: string;
12
+ receivedAt: string;
13
+ source: GatewayChannelExecutionIngressSource;
14
+ }
15
+ export interface GatewayChannelExecutionEgressContract {
16
+ requestId: string;
17
+ replyTargetRef: string;
18
+ channelRequestId?: string;
19
+ sessionId?: string;
20
+ turnId?: string;
21
+ executionId?: string;
22
+ rootExecutionId?: string;
23
+ parentExecutionId?: string;
24
+ sidechainId?: string;
25
+ attemptId?: string;
26
+ envelopeKind: GatewayChannelExecutionEgressKind;
27
+ emittedAt: string;
28
+ terminal: boolean;
29
+ }
@@ -0,0 +1,89 @@
1
+ export type NormalizedChannelType = "telegram" | "slack" | "whatsapp" | "discord" | "wechat" | "custom";
2
+ export type NormalizedChannelMessagePartType = "text" | "image" | "audio" | "video" | "file" | "location" | "event" | "custom";
3
+ export type NormalizedChannelRetryBackoffPolicy = "fixed" | "exponential" | "provider-managed";
4
+ export type NormalizedChannelIdempotencyScope = "reply-target" | "conversation" | "channel-request";
5
+ export type NormalizedChannelDeliveryStatus = "pending" | "delivered" | "retrying" | "failed" | "expired" | "cancelled";
6
+ export interface NormalizedChannelMessagePart {
7
+ partType: NormalizedChannelMessagePartType;
8
+ text?: string;
9
+ mimeType?: string;
10
+ assetRef?: string;
11
+ sizeBytes?: number;
12
+ data?: Record<string, unknown>;
13
+ }
14
+ export interface NormalizedChannelAttachment {
15
+ attachmentId: string;
16
+ mimeType?: string;
17
+ filename?: string;
18
+ downloadUrl?: string;
19
+ assetRef?: string;
20
+ sizeBytes?: number;
21
+ }
22
+ export interface NormalizedChannelExecutionHints {
23
+ intent?: string;
24
+ locale?: string;
25
+ expectsReply?: boolean;
26
+ data?: Record<string, unknown>;
27
+ }
28
+ export interface NormalizedChannelDeliveryPolicy {
29
+ allowEdit?: boolean;
30
+ allowReplyThread?: boolean;
31
+ maxRetryCount?: number;
32
+ retryBackoffPolicy?: NormalizedChannelRetryBackoffPolicy;
33
+ idempotencyScope?: NormalizedChannelIdempotencyScope;
34
+ }
35
+ export interface NormalizedChannelInboundRequest {
36
+ channelRequestId: string;
37
+ channelType: NormalizedChannelType;
38
+ channelTenantId?: string;
39
+ channelConversationId: string;
40
+ channelUserId: string;
41
+ receivedAt: string;
42
+ dedupeKey: string;
43
+ gatewayTargetRef: string;
44
+ replyTargetRef: string;
45
+ messageParts: NormalizedChannelMessagePart[];
46
+ attachments?: NormalizedChannelAttachment[];
47
+ executionHints?: NormalizedChannelExecutionHints;
48
+ }
49
+ export interface NormalizedChannelReplyTarget {
50
+ replyTargetRef: string;
51
+ channelType: NormalizedChannelType;
52
+ channelTenantId?: string;
53
+ channelConversationId: string;
54
+ channelMessageRef?: string;
55
+ recipientRef: string;
56
+ threadRef?: string;
57
+ expiresAt?: string;
58
+ deliveryPolicy?: NormalizedChannelDeliveryPolicy;
59
+ data?: Record<string, unknown>;
60
+ }
61
+ export interface NormalizedChannelReplyRequest {
62
+ deliveryAttemptId: string;
63
+ replyTargetRef: string;
64
+ channelType: NormalizedChannelType;
65
+ channelTenantId?: string;
66
+ channelConversationId: string;
67
+ recipientRef: string;
68
+ threadRef?: string;
69
+ replyToMessageId: string;
70
+ gatewayId: string;
71
+ text?: string;
72
+ mediaUrl?: string;
73
+ mediaUrls?: string[];
74
+ fileName?: string;
75
+ mimeType?: string;
76
+ data?: Record<string, unknown>;
77
+ }
78
+ export interface NormalizedChannelDeliveryOutcome {
79
+ deliveryAttemptId: string;
80
+ replyTargetRef: string;
81
+ deliveryStatus: NormalizedChannelDeliveryStatus;
82
+ providerMessageRef?: string;
83
+ providerErrorCode?: string;
84
+ providerErrorMessage?: string;
85
+ attemptedAt: string;
86
+ ackedAt?: string;
87
+ retryCount: number;
88
+ nextRetryAt?: string;
89
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Chat Wire Types — fundamental data types that cross the JSON-RPC boundary.
3
+ *
4
+ * These types appear in RPC method params/results (thread.turn, session.resume, etc.)
5
+ * and are needed by every consumer that interacts with the agent.
6
+ */
7
+ export type ChatMessageRole = "system" | "user" | "assistant" | "tool";
8
+ /** Thinking block from Anthropic Messages API (DeepSeek, Claude, etc.) */
9
+ export interface ThinkingBlock {
10
+ thinking: string;
11
+ signature: string;
12
+ }
13
+ /** Tool call within an assistant message. */
14
+ export interface ToolCallMessage {
15
+ id: string;
16
+ type: "function";
17
+ function: {
18
+ name: string;
19
+ arguments: string;
20
+ };
21
+ }
22
+ /**
23
+ * Chat message — the fundamental unit of conversation over JSON-RPC.
24
+ *
25
+ * Used in `thread.turn` params (user sends messages to agent)
26
+ * and `session.resume` result (agent returns conversation history).
27
+ */
28
+ export interface ChatMessage {
29
+ role: ChatMessageRole;
30
+ content: string | null;
31
+ /** For assistant messages with tool calls. */
32
+ tool_calls?: ToolCallMessage[];
33
+ /** For tool result messages. */
34
+ tool_call_id?: string;
35
+ /** For tool result messages — tool name. */
36
+ name?: string;
37
+ /** Anthropic thinking blocks — must be passed back to API in subsequent requests. */
38
+ thinkingBlocks?: ThinkingBlock[];
39
+ /** Image URLs for vision-capable models. */
40
+ imageUrls?: string[];
41
+ /** Image detail level: 'auto' | 'low' | 'high' | 'xhigh'. */
42
+ imageDetail?: "auto" | "low" | "high" | "xhigh";
43
+ /** Max image pixels budget (Volcengine image_pixel_limit). */
44
+ imagePixelLimit?: {
45
+ minPixels?: number;
46
+ maxPixels?: number;
47
+ };
48
+ /** Video URLs for video-understanding models. */
49
+ videoUrls?: string[];
50
+ /** Per-video fps for video understanding (0.2-5, default 1). */
51
+ videoFps?: number;
52
+ /** Audio format hint: 'mp3' | 'wav' | 'aac' | 'm4a'. */
53
+ audioFormat?: "mp3" | "wav" | "aac" | "m4a";
54
+ /** Audio URLs for audio-understanding models. */
55
+ audioUrls?: string[];
56
+ /** Pre-uploaded file IDs for document/media understanding. */
57
+ fileIds?: Array<{
58
+ id: string;
59
+ mimeType?: string;
60
+ size?: number;
61
+ }>;
62
+ }
63
+ /**
64
+ * Tool definition — wire format as sent over JSON-RPC.
65
+ *
66
+ * Used in `thread.turn` params (host provides available tools)
67
+ * and `tools.list` result (agent reports its tool inventory).
68
+ */
69
+ export interface ToolDefinition {
70
+ type: "function";
71
+ function: {
72
+ name: string;
73
+ description: string;
74
+ parameters?: Record<string, unknown>;
75
+ };
76
+ /** Tool scheduling metadata from host manifest (optional). */
77
+ meta?: {
78
+ serialOnly?: boolean;
79
+ parallelSafe?: boolean;
80
+ /** If true, host should request user approval before execution. */
81
+ requiresApproval?: boolean;
82
+ /** Tool is read-only / safe — skip approval even in strict mode. */
83
+ isReadOnly?: boolean;
84
+ /** Tool can cause irreversible side-effects — force approval in default mode. */
85
+ isDangerous?: boolean;
86
+ };
87
+ }
@@ -0,0 +1,61 @@
1
+ import type { MutationCheckpointContract, MutationCheckpointSnapshotEntryContract, MutationCheckpointPhase, MutationCheckpointRestoreAckContract, MutationCheckpointRestoreContract, MutationCheckpointRollbackResultContract } from "./checkpoint.js";
2
+ type MutationCheckpointStartParams = {
3
+ runId: string;
4
+ toolCallId: string;
5
+ sessionId?: string;
6
+ toolName: string;
7
+ actionFingerprint?: string;
8
+ args?: Record<string, unknown>;
9
+ };
10
+ type MutationCheckpointFinishParams = {
11
+ runId: string;
12
+ toolCallId: string;
13
+ phase: Extract<MutationCheckpointPhase, "captured" | "failed" | "restored">;
14
+ error?: string;
15
+ };
16
+ interface PersistedMutationCheckpointEntry {
17
+ relativePath: string;
18
+ kind: MutationCheckpointSnapshotEntryContract["kind"];
19
+ sourcePath: string;
20
+ snapshotPath?: string;
21
+ snapshotSha256?: string;
22
+ }
23
+ interface PersistedMutationCheckpointRecord extends MutationCheckpointContract {
24
+ workspaceRoot: string;
25
+ snapshotDir: string;
26
+ entries: PersistedMutationCheckpointEntry[];
27
+ restoreHistory: MutationCheckpointRestoreContract[];
28
+ }
29
+ type MutationCheckpointRestoreOutcome = {
30
+ restoreAck: MutationCheckpointRestoreAckContract;
31
+ restored: MutationCheckpointRestoreContract;
32
+ rollbackResult: MutationCheckpointRollbackResultContract;
33
+ };
34
+ type MutationCheckpointRuntimeRecord = Pick<PersistedMutationCheckpointRecord, "checkpointId" | "sessionId" | "workingDirectory" | "pathHints" | "snapshotSha256" | "snapshotEntryCount">;
35
+ export interface MutationCheckpointRuntimeManager {
36
+ getCheckpointIdForToolCall(params: {
37
+ runId: string;
38
+ toolCallId: string;
39
+ }): string | null;
40
+ noteCheckpointStart(params: MutationCheckpointStartParams): Promise<MutationCheckpointContract>;
41
+ noteCheckpointFinished(params: MutationCheckpointFinishParams): MutationCheckpointContract | null;
42
+ restoreCheckpoint(params: {
43
+ checkpointId: string;
44
+ reason?: string;
45
+ restoreId?: string;
46
+ }): Promise<{
47
+ record: MutationCheckpointRuntimeRecord | null;
48
+ outcome: MutationCheckpointRestoreOutcome;
49
+ } | null>;
50
+ }
51
+ export interface MutationCheckpointRuntimeManagerDeps {
52
+ writeJsonAtomic: (filePath: string, data: unknown, options: {
53
+ trailingNewline: boolean;
54
+ }) => Promise<void>;
55
+ resolveWorkspaceRoot: (workspaceDir?: string) => string;
56
+ currentWorkingDirectory?: () => string;
57
+ checkpointStateDir?: string;
58
+ now?: () => number;
59
+ }
60
+ export declare function createMutationCheckpointRuntimeManager(deps: MutationCheckpointRuntimeManagerDeps): MutationCheckpointRuntimeManager;
61
+ export {};
@@ -0,0 +1,72 @@
1
+ export declare const MUTATION_CHECKPOINT_PHASE_VALUES: readonly ["pending", "captured", "failed", "restored"];
2
+ export type MutationCheckpointPhase = (typeof MUTATION_CHECKPOINT_PHASE_VALUES)[number];
3
+ export declare const MUTATION_CHECKPOINT_ENTRY_KIND_VALUES: readonly ["file", "directory", "missing"];
4
+ export type MutationCheckpointEntryKind = (typeof MUTATION_CHECKPOINT_ENTRY_KIND_VALUES)[number];
5
+ export declare const MUTATION_CHECKPOINT_BACKEND_VALUES: readonly ["metadata-only", "workspace-copy", "shadow-git"];
6
+ export type MutationCheckpointBackend = (typeof MUTATION_CHECKPOINT_BACKEND_VALUES)[number];
7
+ export interface MutationCheckpointSnapshotEntryContract {
8
+ relativePath: string;
9
+ kind: MutationCheckpointEntryKind;
10
+ snapshotSha256?: string;
11
+ }
12
+ export interface MutationCheckpointContract {
13
+ checkpointId: string;
14
+ runId: string;
15
+ toolCallId?: string;
16
+ sessionId?: string;
17
+ toolName: string;
18
+ actionFingerprint?: string;
19
+ dedupeKey: string;
20
+ workingDirectory: string;
21
+ pathHints: string[];
22
+ backend: MutationCheckpointBackend;
23
+ phase: MutationCheckpointPhase;
24
+ snapshotSha256: string;
25
+ snapshotEntryCount: number;
26
+ snapshotEntries: MutationCheckpointSnapshotEntryContract[];
27
+ createdAtMs: number;
28
+ updatedAtMs: number;
29
+ error?: string;
30
+ }
31
+ export interface MutationCheckpointRestoreContract {
32
+ restoreId: string;
33
+ checkpointId: string;
34
+ runId?: string;
35
+ sessionId?: string;
36
+ executionId?: string;
37
+ rootExecutionId?: string;
38
+ parentExecutionId?: string;
39
+ sidechainId?: string;
40
+ attemptId?: string;
41
+ restoredAtMs: number;
42
+ reason?: string;
43
+ }
44
+ export interface MutationCheckpointRestoreAckContract {
45
+ restoreId: string;
46
+ checkpointId: string;
47
+ runId?: string;
48
+ sessionId?: string;
49
+ executionId?: string;
50
+ rootExecutionId?: string;
51
+ parentExecutionId?: string;
52
+ sidechainId?: string;
53
+ attemptId?: string;
54
+ requestedAtMs: number;
55
+ ackedAtMs: number;
56
+ accepted: boolean;
57
+ reason?: string;
58
+ }
59
+ export interface MutationCheckpointRollbackResultContract {
60
+ restoreId: string;
61
+ checkpointId: string;
62
+ rollbackCheckpointId: string;
63
+ runId?: string;
64
+ sessionId?: string;
65
+ executionId?: string;
66
+ rootExecutionId?: string;
67
+ parentExecutionId?: string;
68
+ sidechainId?: string;
69
+ attemptId?: string;
70
+ completedAtMs: number;
71
+ reason?: string;
72
+ }