@margay/ccl-core 1.5.0-alpha.4 → 1.5.1-alpha.2

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 (61) hide show
  1. package/dist/cli.js +69586 -64065
  2. package/dist/sdk/background.d.ts +48 -0
  3. package/dist/sdk/background.js +87 -0
  4. package/dist/sdk/backgroundRunTypes.d.ts +101 -0
  5. package/dist/sdk/backgroundRunTypes.js +1 -0
  6. package/dist/sdk/commandAdapter.d.ts +77 -0
  7. package/dist/sdk/commandAdapter.js +180 -0
  8. package/dist/sdk/commandProcess.d.ts +27 -0
  9. package/dist/sdk/commandProcess.js +130 -0
  10. package/dist/sdk/executionGuidance.d.ts +7 -0
  11. package/dist/sdk/executionGuidance.js +37 -0
  12. package/dist/sdk/index.d.ts +13 -0
  13. package/dist/sdk/index.js +9 -0
  14. package/dist/sdk/mcpServer.d.ts +9 -5
  15. package/dist/sdk/mcpServer.js +51 -9
  16. package/dist/sdk/operations/command.d.ts +24 -0
  17. package/dist/sdk/operations/command.js +48 -0
  18. package/dist/sdk/operations/host.d.ts +3 -0
  19. package/dist/sdk/operations/host.js +376 -0
  20. package/dist/sdk/operations/json.d.ts +6 -0
  21. package/dist/sdk/operations/json.js +24 -0
  22. package/dist/sdk/operations/reference.d.ts +15 -0
  23. package/dist/sdk/operations/reference.js +19 -0
  24. package/dist/sdk/operations/store.d.ts +26 -0
  25. package/dist/sdk/operations/store.js +300 -0
  26. package/dist/sdk/operations/types.d.ts +171 -0
  27. package/dist/sdk/operations/types.js +8 -0
  28. package/dist/sdk/pendingApprovalIdentity.d.ts +35 -0
  29. package/dist/sdk/pendingApprovalIdentity.js +27 -0
  30. package/dist/sdk/permissionDelegation.d.ts +19 -0
  31. package/dist/sdk/permissionDelegation.js +11 -0
  32. package/dist/sdk/query.d.ts +2 -1
  33. package/dist/sdk/query.js +133 -30
  34. package/dist/sdk/queryLifecycle.d.ts +19 -0
  35. package/dist/sdk/queryLifecycle.js +93 -0
  36. package/dist/sdk/queryLifecycleTypes.d.ts +160 -0
  37. package/dist/sdk/queryLifecycleTypes.js +47 -0
  38. package/dist/sdk/scheduledOccurrenceTypes.d.ts +103 -0
  39. package/dist/sdk/scheduledOccurrenceTypes.js +12 -0
  40. package/dist/sdk/types.d.ts +17 -2
  41. package/docs/background-runs.md +229 -0
  42. package/docs/command-tool-recovery.md +62 -0
  43. package/docs/dev-quickstart.md +29 -7
  44. package/docs/error-recovery-usage.md +18 -0
  45. package/docs/hook-input-provenance.md +77 -0
  46. package/docs/index.md +2 -0
  47. package/docs/mcp-tool-recovery.md +82 -0
  48. package/docs/releases/1.5.0-alpha.5.md +26 -0
  49. package/docs/releases/1.5.0-alpha.6.md +15 -0
  50. package/docs/releases/1.5.1-alpha.1.md +11 -0
  51. package/docs/releases/1.5.1-alpha.2.md +17 -0
  52. package/docs/releases/1.5.1-alpha.md +22 -0
  53. package/docs/runtime-resources.md +6 -3
  54. package/examples/background-runs/agents/background-reviewer.md +6 -0
  55. package/examples/background-runs/agents/background-worker.md +6 -0
  56. package/examples/background-runs/worker-reviewer.mjs +42 -0
  57. package/examples/command-recovery/durable-server.mjs +44 -0
  58. package/examples/command-recovery/receipt-command.mjs +40 -0
  59. package/package.json +16 -2
  60. package/sdk/API.md +146 -0
  61. package/sdk/README.md +6 -0
@@ -0,0 +1,37 @@
1
+ // Main and read-only agents share the boundary between using a capability and
2
+ // investigating its implementation. Tool availability and permissions stay local.
3
+ export const TOOL_EXECUTION_GUIDANCE = `Start from the requested outcome and the paths, tool descriptions, and usage instructions already supplied. When an available tool or CLI has enough information to perform the requested operation, call it through an authorized tool directly. Using a documented command does not itself require reading its implementation or requesting help first. Consult targeted help or source when required details are missing, an actual result needs diagnosis, or the task asks you to inspect or change the implementation.
4
+
5
+ You can request multiple tool calls in a single response. Group necessary calls when their inputs are already known and they have no result dependencies or conflicting side effects. The host determines which calls can execute concurrently. If a call needs an earlier result, or the operations could interfere, wait for the earlier result before requesting the dependent call. After a batch returns, use its results together to determine what remains unresolved. Do not add unnecessary calls just to form a batch, or repeat a completed lookup unless missing information, changed state, or necessary verification warrants it.
6
+
7
+ For investigation or design, gather the evidence needed to support the requested conclusions. A successful query may leave relevant documentation or implementation questions unresolved. Distinguish facts established by the evidence, information you have not checked, and absence confirmed within a checked scope. A field missing from a query response does not establish that documentation or another capability does not exist. Report unresolved information as unknown when further investigation is outside the requested scope.
8
+
9
+ Keep exploration focused on the questions needed for the requested outcome; a lookup or execution task is not automatically a codebase investigation. Once that outcome and its necessary verification are complete, report them without extending the search to unrelated files or capabilities.`;
10
+ /**
11
+ * Shared CLI/SDK execution guidance for the tools exposed by the caller.
12
+ * Pure text assembly: does not load tools, grant permissions, or alter persona.
13
+ * Pass canonical tool names from the effective pool, not display aliases.
14
+ */
15
+ export function getExecutionGuidance(toolNames) {
16
+ const enabled = new Set(toolNames);
17
+ const fileGuidance = [];
18
+ for (const [name, operation] of [
19
+ ['Read', 'ordinary file reads'],
20
+ ['Edit', 'targeted file edits'],
21
+ ['Write', 'creating or replacing file contents'],
22
+ ['Glob', 'finding paths by filename pattern'],
23
+ ['Grep', 'searching file contents'],
24
+ ]) {
25
+ if (enabled.has(name))
26
+ fileGuidance.push(`For ${operation}, prefer ${name} when suitable.`);
27
+ }
28
+ if (enabled.has('Bash')) {
29
+ fileGuidance.push(`Use Bash for scripts, builds, tests, conversions, system commands, and metadata queries such as file permissions or directory sizes that the dedicated tools do not provide. For tasks combining inspection and execution, keep ordinary reads and searches in the available, suitable file tools; combining commands is not by itself a reason to use Bash for them. When a dedicated tool is unavailable or unsuitable, use an authorized equivalent. Keep file access and writes within the user's scope.`);
30
+ }
31
+ return [
32
+ ` - Use tools actually available in this session. Prefer a relevant dedicated tool when provided; examples elsewhere do not make an absent tool available. If neither the dedicated tool nor an authorized alternative is available, explain the missing capability.`,
33
+ ` - ${TOOL_EXECUTION_GUIDANCE}`,
34
+ ` - A permission denial is not a missing tool. Do not switch tools to bypass a denied operation; resolve the authorization or explain the limitation.`,
35
+ ...fileGuidance.map(item => ` - ${item}`),
36
+ ].join('\n');
37
+ }
@@ -9,6 +9,8 @@ export { buildCliArgs, buildCliEnv, decideFailClosed, getSessionUsage, prepareSk
9
9
  export { query, queryHandleWithTransport } from './queryHandle.js';
10
10
  export { createSession, Session, type SessionOptions, type SessionControls, type Turn, type TurnResult, type InputMetadata } from './session.js';
11
11
  export type { InputProvenance } from './inputProvenance.js';
12
+ export { readQueryLifecycle, type QueryLifecycleRead } from './queryLifecycle.js';
13
+ export type { QueryLifecycleRecord, QueryLifecycleObservation, QueryLifecycleWrite } from './queryLifecycleTypes.js';
12
14
  export { RuntimeResourcesSchema, RuntimeResourceSchema, type RuntimeResources, type RuntimeResource } from './runtimeResources.js';
13
15
  export { createSdkMcpServer, tool, SdkMcpRegistry, type SdkMcpToolDefinition, type McpSdkServerConfigWithInstance, } from './mcpServer.js';
14
16
  export { defaultStoreDir, fileSessionStore } from './store.js';
@@ -16,3 +18,14 @@ export { spawnCliTransport } from './transport.js';
16
18
  export type { RecoveryDiagnostic } from './errorDiagnostics.js';
17
19
  export type { GatewayRequestPhase, GatewayRequestProgress } from './requestProgress.js';
18
20
  export type { AccumulatedUsage, CanUseToolContext, CanUseToolFn, CanUseToolResult, InitializationResult, LifecycleHooks, PendingApproval, PendingDecision, ProviderConfig, Query, QueryOptions, SDKEvent, SDKUserMessage, SessionStore, SessionLifecycleEvent, Transport, Usage, WireMessage, } from './types.js';
21
+ export { getExecutionGuidance } from './executionGuidance.js';
22
+ export { createBackgroundClient, BackgroundClientError, type BackgroundClientOptions } from './background.js';
23
+ export type { BackgroundRun, BackgroundRunSpec, BackgroundRunLookup, BackgroundRunSelector, BackgroundRunEvent, BackgroundRunEvents, BackgroundRunAction, BackgroundRunApproval, BackgroundPermission, BackgroundRunSource } from './backgroundRunTypes.js';
24
+ export { runCommandProcess, type CommandProcessInput, type CommandProcessResult } from './commandProcess.js';
25
+ export { createCommandAdapter, type CommandAdapter, type CommandAdapterSpec, type CommandDefinition, type CommandOperation, type CommandOutcome, type CommandExecution, type JsonValue } from './commandAdapter.js';
26
+ export { createOperationHost } from './operations/host.js';
27
+ export type { OperationReference } from './operations/reference.js';
28
+ export { createDurableCommandAdapter, type DurableCommandAdapterSpec } from './operations/command.js';
29
+ export { OperationError, type OperationHost, type OperationHostOptions, type OperationState, type OperationView, type OperationEvent, type OperationAdapter, type OperationBinding, type OperationCapabilities, type OperationContext, type OperationInvocation, type OperationAdapterResult, type OperationPermissionRequest, type OperationPermissionDecision } from './operations/types.js';
30
+ export { pendingApprovalIdentity, type PendingApprovalIdentity } from './pendingApprovalIdentity.js';
31
+ export type { ScheduledOccurrence, OccurrenceCancelRequest, OccurrenceApprovalRequest, OccurrenceApprovalReceipt, OccurrenceLookup, OccurrenceEvents, OccurrenceEvent, OccurrenceExecution } from './scheduledOccurrenceTypes.js';
package/dist/sdk/index.js CHANGED
@@ -8,7 +8,16 @@
8
8
  export { buildCliArgs, buildCliEnv, decideFailClosed, getSessionUsage, prepareSkillsWrappers, queryWithTransport, resumeWithDecision, } from './query.js';
9
9
  export { query, queryHandleWithTransport } from './queryHandle.js';
10
10
  export { createSession, Session } from './session.js';
11
+ export { readQueryLifecycle } from './queryLifecycle.js';
11
12
  export { RuntimeResourcesSchema, RuntimeResourceSchema } from './runtimeResources.js';
12
13
  export { createSdkMcpServer, tool, SdkMcpRegistry, } from './mcpServer.js';
13
14
  export { defaultStoreDir, fileSessionStore } from './store.js';
14
15
  export { spawnCliTransport } from './transport.js';
16
+ export { getExecutionGuidance } from './executionGuidance.js';
17
+ export { createBackgroundClient, BackgroundClientError } from './background.js';
18
+ export { runCommandProcess } from './commandProcess.js';
19
+ export { createCommandAdapter } from './commandAdapter.js';
20
+ export { createOperationHost } from './operations/host.js';
21
+ export { createDurableCommandAdapter } from './operations/command.js';
22
+ export { OperationError } from './operations/types.js';
23
+ export { pendingApprovalIdentity } from './pendingApprovalIdentity.js';
@@ -1,3 +1,5 @@
1
+ import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
2
+ import type { ServerRequest, ServerNotification } from '@modelcontextprotocol/sdk/types.js';
1
3
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
4
  import { type JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
3
5
  import { type ZodRawShape } from 'zod/v4';
@@ -5,9 +7,12 @@ export type SdkMcpToolDefinition = {
5
7
  name: string;
6
8
  description: string;
7
9
  inputSchema: ZodRawShape;
8
- handler: (args: Record<string, unknown>, extra: unknown) => Promise<unknown> | unknown;
10
+ handler: (args: Record<string, unknown>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => Promise<unknown> | unknown;
9
11
  annotations?: Record<string, unknown>;
12
+ /** Additional discovery terms, forwarded as MCP anthropic/searchHint metadata. */
10
13
  searchHint?: string;
14
+ /** Opt into supplying this tool's schema on the first request; does not grant permission. */
15
+ alwaysLoad?: boolean;
11
16
  };
12
17
  export type McpSdkServerConfigWithInstance = {
13
18
  name: string;
@@ -18,10 +23,7 @@ export type McpSdkServerConfigWithInstance = {
18
23
  [key: string]: unknown;
19
24
  };
20
25
  /** Define one in-process tool (Claude-Agent-SDK-compatible signature). */
21
- export declare function tool(name: string, description: string, inputSchema: ZodRawShape, handler: SdkMcpToolDefinition['handler'], extras?: {
22
- annotations?: Record<string, unknown>;
23
- searchHint?: string;
24
- }): SdkMcpToolDefinition;
26
+ export declare function tool(name: string, description: string, inputSchema: ZodRawShape, handler: SdkMcpToolDefinition['handler'], extras?: Pick<SdkMcpToolDefinition, 'annotations' | 'searchHint' | 'alwaysLoad'>): SdkMcpToolDefinition;
25
27
  /**
26
28
  * Build an in-process MCP server from host-defined JS tools. Returns a config carrying the live
27
29
  * `@modelcontextprotocol/sdk` Server; pass it to `query({ sdkMcpServers: [createSdkMcpServer(...)] })`.
@@ -41,6 +43,8 @@ export declare class SdkMcpRegistry {
41
43
  private readonly reply;
42
44
  private readonly transports;
43
45
  private readonly pending;
46
+ private readonly inbound;
47
+ private fail;
44
48
  private constructor();
45
49
  /** Connect every server's instance to a control transport. */
46
50
  static create(configs: McpSdkServerConfigWithInstance[], reply: (requestId: string, mcpResponse: JSONRPCMessage | undefined) => void): Promise<SdkMcpRegistry>;
@@ -2,6 +2,7 @@
2
2
  // the spawned CLI subprocess calls them over the control protocol (`mcp_message`). This file is
3
3
  // SELF-CONTAINED: tsconfig.sdk.json compiles only `sdk/**` (rootDir:sdk), so it may import ONLY
4
4
  // node_modules (never ../services or ../utils). The pass-through transport is therefore inlined.
5
+ import { randomUUID } from 'node:crypto';
5
6
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
7
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
7
8
  import { z } from 'zod/v4';
@@ -32,14 +33,20 @@ export function createSdkMcpServer(options) {
32
33
  description: t.description,
33
34
  inputSchema: z.toJSONSchema(z.object(t.inputSchema)),
34
35
  ...(t.annotations ? { annotations: t.annotations } : {}),
36
+ ...(t.searchHint !== undefined || t.alwaysLoad !== undefined ? {
37
+ _meta: {
38
+ ...(t.searchHint !== undefined ? { 'anthropic/searchHint': t.searchHint } : {}),
39
+ ...(t.alwaysLoad !== undefined ? { 'anthropic/alwaysLoad': t.alwaysLoad } : {}),
40
+ },
41
+ } : {}),
35
42
  })),
36
43
  }));
37
- server.setRequestHandler(CallToolRequestSchema, async ({ params }) => {
44
+ server.setRequestHandler(CallToolRequestSchema, async ({ params }, extra) => {
38
45
  const t = tools.find(x => x.name === params.name);
39
46
  if (!t) {
40
47
  throw new Error(`SDK MCP tool '${params.name}' not found on server '${options.name}'`);
41
48
  }
42
- const out = await t.handler((params.arguments ?? {}), {});
49
+ const out = await t.handler((params.arguments ?? {}), extra);
43
50
  return toCallToolResult(out);
44
51
  });
45
52
  return { name: options.name, version: options.version, tools, instance: server };
@@ -80,6 +87,15 @@ export class SdkMcpRegistry {
80
87
  reply;
81
88
  transports = new Map();
82
89
  pending = new Map();
90
+ inbound = new Map();
91
+ fail(internalId, message) {
92
+ const entry = this.pending.get(internalId);
93
+ if (!entry)
94
+ return;
95
+ this.pending.delete(internalId);
96
+ this.inbound.delete(JSON.stringify([entry.server, entry.originalId]));
97
+ this.reply(entry.requestId, { jsonrpc: '2.0', id: entry.originalId, error: { code: -32000, message } });
98
+ }
83
99
  constructor(reply) {
84
100
  this.reply = reply;
85
101
  }
@@ -91,10 +107,11 @@ export class SdkMcpRegistry {
91
107
  continue;
92
108
  const transport = new SdkControlServerTransport(message => {
93
109
  const id = messageId(message);
94
- if (id !== undefined && reg.pending.has(id)) {
95
- const requestId = reg.pending.get(id);
110
+ const entry = typeof id === 'string' ? reg.pending.get(id) : undefined;
111
+ if (entry && entry.server === cfg.name) {
96
112
  reg.pending.delete(id);
97
- reg.reply(requestId, message);
113
+ reg.inbound.delete(JSON.stringify([cfg.name, entry.originalId]));
114
+ reg.reply(entry.requestId, { ...message, id: entry.originalId });
98
115
  }
99
116
  });
100
117
  await cfg.instance.connect(transport);
@@ -121,14 +138,39 @@ export class SdkMcpRegistry {
121
138
  return;
122
139
  }
123
140
  const id = messageId(message);
124
- if (id !== undefined)
125
- this.pending.set(id, requestId);
126
- transport.onmessage?.(message);
127
- if (id === undefined)
141
+ if (id !== undefined) {
142
+ const key = JSON.stringify([serverName, id]);
143
+ if (this.inbound.has(key)) {
144
+ this.reply(requestId, { jsonrpc: '2.0', id, error: { code: -32600, message: 'Duplicate active SDK MCP request id' } });
145
+ return;
146
+ }
147
+ // Private transport ids isolate servers, late responses and original id=0 cancellation
148
+ // (some MCP SDK versions incorrectly treat numeric zero as absent).
149
+ const internalId = randomUUID();
150
+ this.inbound.set(key, internalId);
151
+ this.pending.set(internalId, { requestId, server: serverName, originalId: id });
152
+ transport.onmessage?.({ ...message, id: internalId });
153
+ }
154
+ else {
155
+ if ('method' in message && message.method === 'notifications/cancelled') {
156
+ const originalId = message.params?.requestId;
157
+ const internalId = this.inbound.get(JSON.stringify([serverName, originalId]));
158
+ if (internalId) {
159
+ transport.onmessage?.({ ...message, params: { ...message.params, requestId: internalId } });
160
+ // The MCP server suppresses its response after cancellation; release the control waiter.
161
+ this.fail(internalId, 'SDK MCP request cancelled; effects may be unknown');
162
+ }
163
+ }
164
+ else
165
+ transport.onmessage?.(message);
128
166
  this.reply(requestId, undefined);
167
+ }
129
168
  }
130
169
  async close() {
131
170
  for (const t of this.transports.values())
132
171
  await t.close();
172
+ for (const id of this.pending.keys())
173
+ this.fail(id, 'SDK MCP transport closed; effects may be unknown');
174
+ this.transports.clear();
133
175
  }
134
176
  }
@@ -0,0 +1,24 @@
1
+ import type { JsonValue } from '../commandAdapter.js';
2
+ import { type CommandDefinition } from '../commandAdapter.js';
3
+ import type { OperationAdapter, OperationContext } from './types.js';
4
+ export type DurableCommandAdapterSpec = {
5
+ adapterId: string;
6
+ adapterVersion: string;
7
+ targetIdentity: string;
8
+ execute: CommandDefinition;
9
+ query?: CommandDefinition;
10
+ /** Only these host-declared environment entries may rotate without changing definition identity. */
11
+ credentialEnv?: readonly string[];
12
+ credentialRef?: string;
13
+ verificationRef?: JsonValue;
14
+ idempotency?: {
15
+ scope: string;
16
+ retentionMs: number;
17
+ };
18
+ verifyIdentity: (operation: OperationContext, signal: AbortSignal) => Promise<{
19
+ targetIdentity: string;
20
+ adapterVersion: string;
21
+ } | null>;
22
+ };
23
+ /** Register a fixed command with the durable host; credentials are resolved by its trusted resolver. */
24
+ export declare function createDurableCommandAdapter(spec: DurableCommandAdapterSpec): OperationAdapter;
@@ -0,0 +1,48 @@
1
+ import { createCommandAdapter, restoreCommandOperation } from '../commandAdapter.js';
2
+ import { resolve } from 'node:path';
3
+ import { operationClone, operationDigest, asOperationJson } from './json.js';
4
+ /** Register a fixed command with the durable host; credentials are resolved by its trusted resolver. */
5
+ export function createDurableCommandAdapter(spec) {
6
+ const credentialEnv = [...new Set(spec.credentialEnv ?? [])].sort();
7
+ if (credentialEnv.length && !spec.credentialRef)
8
+ throw new Error('Rotating command credentials require a stable credentialRef');
9
+ const execute = operationClone({ ...spec.execute, cwd: resolve(spec.execute.cwd ?? process.cwd()), inheritEnv: spec.execute.inheritEnv ?? false });
10
+ const query = spec.query ? operationClone({ ...spec.query, cwd: resolve(spec.query.cwd ?? process.cwd()), inheritEnv: spec.query.inheritEnv ?? false }) : undefined;
11
+ const definition = (command) => {
12
+ if (!command)
13
+ return null;
14
+ const env = command.inheritEnv ? { ...process.env, ...command.env } : { ...command.env };
15
+ return { ...command, env: Object.fromEntries(Object.entries(env).filter(([key]) => !credentialEnv.includes(key))) };
16
+ };
17
+ const binding = { adapterId: spec.adapterId, adapterVersion: spec.adapterVersion, targetIdentity: spec.targetIdentity,
18
+ definitionDigest: operationDigest({ execute: definition(execute), query: definition(query), credentialEnv,
19
+ credentialRef: spec.credentialRef ?? null, verificationRef: spec.verificationRef ?? null, idempotency: spec.idempotency ?? null }) };
20
+ const capabilities = { replay: spec.idempotency ? 'idempotent' : 'never', query: !!query,
21
+ ...(spec.idempotency ? { idempotency: operationClone(spec.idempotency) } : {}) };
22
+ const verifyIdentity = spec.verifyIdentity;
23
+ async function invoke(invocation, kind) {
24
+ const original = invocation.operation;
25
+ const adapter = createCommandAdapter({ ...binding, execute, query, idempotency: capabilities.idempotency,
26
+ verifyIdentity: async () => {
27
+ const identity = await verifyIdentity(original, invocation.signal);
28
+ return identity?.targetIdentity === binding.targetIdentity && identity?.adapterVersion === binding.adapterVersion;
29
+ } });
30
+ const record = { operationId: original.operationId, requestKey: original.requestKey,
31
+ adapterId: binding.adapterId, adapterVersion: binding.adapterVersion, targetIdentity: binding.targetIdentity,
32
+ bindingDigest: original.binding.definitionDigest, inputDigest: original.inputDigest, input: original.input, createdAt: original.createdAt };
33
+ const operation = restoreCommandOperation(adapter, record, invocation.previouslyDispatched || kind === 'query');
34
+ const execution = kind === 'query'
35
+ ? await adapter.queryOutcome(operation, { signal: invocation.signal })
36
+ : invocation.previouslyDispatched
37
+ ? await adapter.retry(operation, { signal: invocation.signal, authorize: async () => true })
38
+ : await adapter.execute(operation, { signal: invocation.signal });
39
+ return { outcome: execution.outcome, result: asOperationJson(execution.outcome),
40
+ process: execution.process ? asOperationJson(execution.process) : null,
41
+ ...(execution.process ? { dispatch: execution.process.dispatch } : {}) };
42
+ }
43
+ return {
44
+ binding, capabilities, verifyIdentity,
45
+ execute: invocation => invoke(invocation, 'execute'),
46
+ ...(query ? { queryOutcome: (invocation) => invoke(invocation, 'query') } : {}),
47
+ };
48
+ }
@@ -0,0 +1,3 @@
1
+ import { type OperationHost, type OperationHostOptions } from './types.js';
2
+ /** Shared lifecycle core for SDK hosts and CCL's CLI/tool entry points. */
3
+ export declare function createOperationHost(options: OperationHostOptions): OperationHost;