@canonmsg/agent-sdk 12.0.0 → 12.1.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 (99) hide show
  1. package/README.md +97 -7
  2. package/dist/chunks/{chunk-FPQFTTND.js → chunk-7N6OPPW4.js} +1616 -1085
  3. package/dist/chunks/chunk-N722GWCP.js +4897 -0
  4. package/dist/chunks/{chunk-OLJ7H4E2.js → chunk-QZ4PPRQW.js} +6462 -6920
  5. package/dist/chunks/{mls-crypto-NZDNSPAO.js → mls-crypto-LMNQZOS6.js} +3 -3
  6. package/dist/cli.js +403 -29
  7. package/dist/drivers/claude.d.ts +8 -2
  8. package/dist/drivers/codex.d.ts +11 -2
  9. package/dist/drivers/connector.d.ts +34 -0
  10. package/dist/index.d.ts +10 -2
  11. package/dist/index.js +26 -4
  12. package/dist/internal/backend-contracts/artifactActions.d.ts +0 -151
  13. package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
  14. package/dist/internal/backend-contracts/communication.d.ts +15 -0
  15. package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
  16. package/dist/internal/backend-contracts/endpoint.d.ts +17 -0
  17. package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +15 -4
  18. package/dist/internal/backend-contracts/index.d.ts +7 -1
  19. package/dist/internal/backend-contracts/media-url.d.ts +14 -0
  20. package/dist/internal/backend-contracts/message.d.ts +1 -1
  21. package/dist/internal/backend-contracts/mlsDevApplication.d.ts +90 -2
  22. package/dist/internal/backend-contracts/mlsDevCredential.d.ts +5 -2
  23. package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +2 -1
  24. package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +3 -2
  25. package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
  26. package/dist/internal/backend-contracts/mlsDevGroup.d.ts +129 -5
  27. package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +6 -2
  28. package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
  29. package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
  30. package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
  31. package/dist/internal/backend-contracts/runtimeCardFields.d.ts +2 -2
  32. package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
  33. package/dist/internal/backend-contracts/verbContract.d.ts +15 -7
  34. package/dist/internal/backend-contracts/verbSchemas.d.ts +35 -25
  35. package/dist/internal/core/agent-profiles.d.ts +0 -4
  36. package/dist/internal/core/approval-format.d.ts +1 -5
  37. package/dist/internal/core/approval-types.d.ts +1 -2
  38. package/dist/internal/core/client.d.ts +2 -56
  39. package/dist/internal/core/constants.d.ts +0 -3
  40. package/dist/internal/core/endpoint-client.d.ts +14 -1
  41. package/dist/internal/core/execution-environment-mode.d.ts +0 -2
  42. package/dist/internal/core/gifs.d.ts +0 -6
  43. package/dist/internal/core/host-runtime.d.ts +2 -206
  44. package/dist/internal/core/index.d.ts +21 -60
  45. package/dist/internal/core/registration.d.ts +1 -17
  46. package/dist/internal/core/retry.d.ts +0 -9
  47. package/dist/internal/core/rtdb-rest.d.ts +0 -4
  48. package/dist/internal/core/runtime-cards.d.ts +0 -45
  49. package/dist/internal/core/runtime-descriptor.d.ts +1 -60
  50. package/dist/internal/core/runtime-presentation.d.ts +1 -27
  51. package/dist/internal/core/runtime-request-manager.d.ts +0 -1
  52. package/dist/internal/core/self-context.d.ts +0 -39
  53. package/dist/internal/core/silent-turn.d.ts +1 -38
  54. package/dist/internal/core/stream.d.ts +2 -1
  55. package/dist/internal/core/turn-protocol.d.ts +0 -5
  56. package/dist/internal/core/turn-verbosity.d.ts +0 -12
  57. package/dist/internal/core/types.d.ts +0 -111
  58. package/dist/internal/endpoint/engine.d.ts +31 -1
  59. package/dist/internal/endpoint/index.d.ts +1 -1
  60. package/dist/internal/endpoint/media.d.ts +5 -0
  61. package/dist/internal/endpoint/mls-crypto.d.ts +12 -5
  62. package/dist/internal/endpoint/mls-dev-client.d.ts +9 -1
  63. package/dist/internal/endpoint/mls-dev-device.d.ts +2 -0
  64. package/dist/internal/endpoint/mls-dev-groups.d.ts +65 -5
  65. package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
  66. package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +13 -0
  67. package/dist/internal/endpoint/mls-dev-key-packages.d.ts +23 -3
  68. package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
  69. package/dist/internal/endpoint/mls-dev-transport.d.ts +2 -1
  70. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
  71. package/dist/internal/endpoint/transport.d.ts +6 -1
  72. package/dist/media.js +2 -2
  73. package/dist/runner/errands.d.ts +118 -0
  74. package/dist/runner/mls.d.ts +97 -0
  75. package/dist/runner/relay.d.ts +87 -0
  76. package/dist/runner/runner.d.ts +61 -0
  77. package/dist/runner/types.d.ts +51 -4
  78. package/package.json +1 -1
  79. package/dist/chunks/chunk-6VK4UZHJ.js +0 -2806
  80. package/dist/internal/backend-contracts/workSessions.d.ts +0 -205
  81. package/dist/internal/core/agent-resolver.d.ts +0 -49
  82. package/dist/internal/core/agent-session.d.ts +0 -12
  83. package/dist/internal/core/artifacts.d.ts +0 -262
  84. package/dist/internal/core/attached-native-session.d.ts +0 -174
  85. package/dist/internal/core/attached-session-file-store.d.ts +0 -3
  86. package/dist/internal/core/control-poller.d.ts +0 -221
  87. package/dist/internal/core/exclusive-json-file-store.d.ts +0 -7
  88. package/dist/internal/core/execution-environment.d.ts +0 -55
  89. package/dist/internal/core/group-context.d.ts +0 -25
  90. package/dist/internal/core/inbound-frame.d.ts +0 -64
  91. package/dist/internal/core/local-runtime-catalog.d.ts +0 -131
  92. package/dist/internal/core/message-format.d.ts +0 -13
  93. package/dist/internal/core/native-session-interaction.d.ts +0 -44
  94. package/dist/internal/core/provenance.d.ts +0 -31
  95. package/dist/internal/core/registration-cli.d.ts +0 -40
  96. package/dist/internal/core/turn-output-controller.d.ts +0 -69
  97. package/dist/internal/core/typing-status-publisher.d.ts +0 -14
  98. package/dist/internal/core/work-session-provider.d.ts +0 -29
  99. package/dist/internal/core/workspace-discovery.d.ts +0 -17
@@ -1,174 +0,0 @@
1
- import type { EndpointInboundStartResult } from '../endpoint/index.js';
2
- import type { SendMessageOptions } from './types.js';
3
- export interface AttachedSessionBinding {
4
- environmentId: string;
5
- agentId: string;
6
- conversationId: string;
7
- provider: string;
8
- /** Exact provider thread/session ID, not a session-tree root. */
9
- nativeSessionId: string;
10
- }
11
- export interface NativeSessionItem {
12
- itemId: string;
13
- turnId: string;
14
- role: 'user' | 'assistant';
15
- text: string;
16
- }
17
- export type NativeSessionEvent = {
18
- type: 'item';
19
- nativeSessionId: string;
20
- item: NativeSessionItem;
21
- } | {
22
- type: 'turn';
23
- nativeSessionId: string;
24
- turnId: string;
25
- state: 'running' | 'completed' | 'failed' | 'interrupted';
26
- } | {
27
- type: 'disconnected';
28
- nativeSessionId: string;
29
- reason: string;
30
- };
31
- export interface NativeSessionSnapshot {
32
- nativeSessionId: string;
33
- /** Completed user/assistant items, in native transcript order. */
34
- items: NativeSessionItem[];
35
- /** Existing user/assistant IDs, including partial items; used only to establish a private history boundary. */
36
- baselineItemIds?: Array<{
37
- itemId: string;
38
- turnId: string;
39
- }>;
40
- activeTurnId: string | null;
41
- }
42
- export type NativeSubmissionResult = {
43
- status: 'accepted';
44
- turnId: string;
45
- mode: 'started_or_appended' | 'appended';
46
- } | {
47
- status: 'not_submitted';
48
- reason: string;
49
- };
50
- export interface AttachedNativeSessionAdapter {
51
- subscribe(listener: (event: NativeSessionEvent) => void): Promise<void>;
52
- /** Must include all completed items since the attachment baseline. */
53
- inspect(): Promise<NativeSessionSnapshot>;
54
- /** Throw when acceptance is uncertain. Never silently retry native input. */
55
- submit(text: string): Promise<NativeSubmissionResult>;
56
- /** Detach this observer/connection; leave the native runner alive. */
57
- close(): Promise<void>;
58
- }
59
- /** Provenance only. Shared native turns always require proactive authority. */
60
- export type AttachedSessionOrigin = {
61
- kind: 'local';
62
- } | {
63
- kind: 'shared';
64
- sourceMessageIds: string[];
65
- };
66
- export interface AttachedSessionMessagePart {
67
- messageId: string;
68
- text: string;
69
- options: Omit<SendMessageOptions, 'messageId'>;
70
- }
71
- export interface AttachedSessionPublisher {
72
- prepare(input: {
73
- binding: AttachedSessionBinding;
74
- item: NativeSessionItem;
75
- origin: AttachedSessionOrigin;
76
- }): AttachedSessionMessagePart[];
77
- /** Reject on any unacknowledged result. Replays receive identical parts. */
78
- send(part: AttachedSessionMessagePart): Promise<void>;
79
- }
80
- export interface AttachedSessionInput {
81
- messageId: string;
82
- text: string;
83
- /** Retained with the request, never borrowed for native output. */
84
- replyAuthority?: SendMessageOptions['replyAuthority'];
85
- }
86
- export type AttachedSessionSubmitResult = {
87
- status: 'accepted';
88
- turnId: string;
89
- mode: 'started_or_appended' | 'appended';
90
- replayed: boolean;
91
- } | {
92
- status: 'busy';
93
- } | {
94
- status: 'deferred';
95
- } | {
96
- status: 'not_submitted';
97
- reason: string;
98
- } | {
99
- status: 'uncertain';
100
- messageId: string;
101
- };
102
- interface StoredSubmission extends AttachedSessionInput {
103
- nativeText: string;
104
- status: 'submitting' | 'accepted' | 'uncertain' | 'not_submitted' | 'busy';
105
- turnId?: string;
106
- mode?: 'started_or_appended' | 'appended';
107
- reason?: string;
108
- echoedItemKey?: string;
109
- }
110
- export interface AttachedSessionJournal {
111
- version: 1;
112
- binding: AttachedSessionBinding;
113
- baselineEstablished: boolean;
114
- /** Intentional detach skips subsequent native work on the next attachment. */
115
- detached?: boolean;
116
- seenItemKeys: string[];
117
- bufferedItems: NativeSessionItem[];
118
- submissions: Record<string, StoredSubmission>;
119
- canonBaselineMessageIds?: string[];
120
- canonBaselineCreatedAt?: string | null;
121
- skippedCanonMessageIds: string[];
122
- outbox: Array<{
123
- key: string;
124
- parts: AttachedSessionMessagePart[];
125
- nextPart: number;
126
- }>;
127
- }
128
- /**
129
- * The store must hold an exclusive journal writer lock until close(). The host
130
- * separately enforces one active Canon audience per native session, even when
131
- * different accounts/bindings use different journal files.
132
- */
133
- export interface AttachedSessionStore {
134
- load(): Promise<AttachedSessionJournal | null>;
135
- save(journal: AttachedSessionJournal): Promise<void>;
136
- close(): Promise<void>;
137
- }
138
- export interface AttachedSessionState {
139
- status: 'stopped' | 'starting' | 'ready' | 'disconnected' | 'uncertain';
140
- activeTurnId: string | null;
141
- pendingPublicationCount: number;
142
- pendingSourceMessageId: string | null;
143
- }
144
- export interface AttachedNativeSessionOptions {
145
- /** Caller validates admission and exclusively owns this native audience route. */
146
- binding: AttachedSessionBinding;
147
- store: AttachedSessionStore;
148
- adapter: AttachedNativeSessionAdapter;
149
- publisher: AttachedSessionPublisher;
150
- /** Hold durable publications until the audience route is ready. Call flush after activation. */
151
- isPublicationReady?: () => boolean;
152
- /** Last durable execution fence, immediately before invoking the provider. */
153
- beforeNativeSubmit?: (input: AttachedSessionInput) => Promise<boolean>;
154
- /** Own the atomic execution handoff; invoke submit only after durable admission. */
155
- submitNative?: (input: AttachedSessionInput, submit: () => Promise<NativeSubmissionResult>) => Promise<EndpointInboundStartResult<NativeSubmissionResult>>;
156
- onState?: (state: AttachedSessionState) => void;
157
- onError?: (error: unknown, operation: string) => void;
158
- }
159
- export interface AttachedNativeSession {
160
- start(): Promise<void>;
161
- submit(input: AttachedSessionInput): Promise<AttachedSessionSubmitResult>;
162
- reconcile(): Promise<void>;
163
- flush(): Promise<void>;
164
- stop(): Promise<void>;
165
- getState(): AttachedSessionState;
166
- initializeCanonBaseline(messageIds: readonly string[], createdAt?: string | null): Promise<boolean>;
167
- isBeforeCanonBaseline(messageId: string, createdAt: string): boolean;
168
- hasCanonMessage(messageId: string): boolean;
169
- recordSkippedCanonMessage(messageId: string, reason?: string): Promise<void>;
170
- }
171
- export declare function validateAttachedSessionJournal(value: unknown, binding: AttachedSessionBinding): asserts value is AttachedSessionJournal;
172
- /** A single observer, durable outbox and one pending input RPC. No execution queue. */
173
- export declare function createAttachedNativeSession(options: AttachedNativeSessionOptions): AttachedNativeSession;
174
- export {};
@@ -1,3 +0,0 @@
1
- import type { AttachedSessionStore } from './attached-native-session.js';
2
- /** Lazy exclusive lock plus private atomic snapshots. No process/ratchet state is shared. */
3
- export declare function createFileAttachedSessionStore(path: string): AttachedSessionStore;
@@ -1,221 +0,0 @@
1
- /**
2
- * Shared RTDB `/control/{conversationId}/{agentId}` channel poller.
3
- *
4
- * Four hosts historically implemented this loop independently (agent-sdk,
5
- * claude-code-plugin, codex-plugin, openclaw-plugin) with duplicated
6
- * constants and drifting semantics. This class covers the union of their
7
- * behaviors via configuration so each host can migrate onto one engine:
8
- *
9
- * - Keys: `signal` (all) and `primitive` (sdk/openclaw), always read in that
10
- * order.
11
- * - Cadence: live endpoint hints with a one-minute reconciliation fallback;
12
- * disconnected/legacy handles use fixed interval (agent-sdk) or active/idle delays + jitter
13
- * (claude/codex/openclaw), with the activity probe sampled either at cycle
14
- * start (claude/codex) or after the poll completes (openclaw).
15
- * - Dedupe: endpoint revision identity (legacy handles use timestamp), primed
16
- * either eagerly via {@link ControlChannelPoller.baseline} (sdk/claude/codex)
17
- * or lazily against the poller start time (openclaw).
18
- * - Consume: shared endpoint handles acknowledge the observed revision; whether a node is consumed
19
- * after a handler error is configurable per key, and primitive dedupe
20
- * entries may be released only on successful consume (agent-sdk).
21
- *
22
- * Normalizations shared by every profile (pinned by the characterization
23
- * tests as the new contract):
24
- * - Single-flight polling via setTimeout chaining — no overlapping cycles,
25
- * even where the legacy host used a flat setInterval.
26
- * - stop()/start() during an in-flight poll can never double-schedule.
27
- * - A null agent id skips the cycle but keeps the cadence alive.
28
- * - No added backoff on errors: the next cycle runs at the normal cadence.
29
- *
30
- * The poller uses the scoped runtime handle backed by its CanonClient endpoint.
31
- * Passing the observed value into consume prevents a newer control request
32
- * from being deleted after an older native handler completes.
33
- */
34
- export type ControlSignalType = 'interrupt' | 'stop_and_drop' | 'new_session';
35
- export type ControlChannelKey = 'signal' | 'primitive';
36
- /** Minimal scoped RTDB surface; `RTDBClientHandle` satisfies it. */
37
- export interface ControlChannelRTDB {
38
- read(path: string): Promise<unknown>;
39
- write(path: string, data: unknown): Promise<void>;
40
- /** Shared endpoint handles bind consumption to the exact observed revision. */
41
- consume?(path: string, observed: unknown): Promise<void>;
42
- observedRevision?(path: string, observed: unknown): string | undefined;
43
- /** Shared endpoint hints; legacy handles retain their configured polling cadence. */
44
- observeControls?(changed: (conversationId?: string) => void, connected: (value: boolean) => void): () => void;
45
- }
46
- export interface ControlSignalEvent {
47
- conversationId: string;
48
- type: ControlSignalType;
49
- updatedAt: number;
50
- raw: Record<string, unknown>;
51
- }
52
- export interface ControlPrimitiveEvent {
53
- conversationId: string;
54
- requestId: string;
55
- updatedAt: number;
56
- value: Record<string, unknown>;
57
- }
58
- /**
59
- * Handlers may return `{ consume: false }` to leave the RTDB node in place
60
- * while still marking it seen — it will not be re-dispatched for this
61
- * revision. Returning `{ defer: true }` means "not mine yet": the node
62
- * is left in place AND stays unseen, so it is re-dispatched on the next cycle
63
- * — this is how a runtime that registers a handler after polling has started
64
- * still receives signals observed during the gap. Returning nothing consumes
65
- * the node after a successful handle. A throw never defers: the node is
66
- * marked seen (and consumed per `consumeOnError`) so a crashing handler
67
- * cannot spin on the same request.
68
- */
69
- export type ControlHandlerResult = {
70
- consume?: boolean;
71
- defer?: boolean;
72
- } | void;
73
- export interface ControlSignalHandlerConfig {
74
- handle(event: ControlSignalEvent): Promise<ControlHandlerResult> | ControlHandlerResult;
75
- /**
76
- * Consume the signal node even when the handler throws.
77
- * agent-sdk/openclaw: true. claude/codex hosts: false (default).
78
- */
79
- consumeOnError?: boolean;
80
- }
81
- export interface ControlPrimitiveHandlerConfig {
82
- handle(event: ControlPrimitiveEvent): Promise<ControlHandlerResult> | ControlHandlerResult;
83
- /** Both primitive hosts consume requests even when the handler throws (default true). */
84
- consumeOnError?: boolean;
85
- /**
86
- * `sequential` handles object entries oldest-first by `updatedAt` (agent-sdk);
87
- * `parallel` handles all entries concurrently and unsorted (openclaw).
88
- * Default: `sequential`.
89
- */
90
- ordering?: 'sequential' | 'parallel';
91
- /** Dedupe entry TTL; omitted means entries are remembered forever (openclaw). */
92
- dedupeTtlMs?: number;
93
- /** Oldest dedupe entries are evicted beyond this cap (agent-sdk: 1000). */
94
- dedupeMaxEntries?: number;
95
- /**
96
- * Release the dedupe entry once the request node is successfully consumed,
97
- * so a lingering node (failed consume) stays suppressed until TTL expiry
98
- * while cleared requests free their slot immediately (agent-sdk). Default false.
99
- */
100
- releaseDedupeOnConsume?: boolean;
101
- /**
102
- * Consume entries whose value is not a plain object instead of leaving them
103
- * untouched. openclaw: true (normalize-fail → consume); agent-sdk: false.
104
- */
105
- consumeInvalidEntries?: boolean;
106
- /**
107
- * Skip (but still consume) requests stamped before the poller started
108
- * (openclaw replay guard). Default false.
109
- */
110
- skipStaleBeforeStart?: boolean;
111
- }
112
- export type ControlPollerCadence = {
113
- /** Flat interval between cycle completions (agent-sdk: 2000ms). */
114
- kind: 'fixed';
115
- intervalMs: number;
116
- } | {
117
- /** Active/idle delays + jitter (claude/codex/openclaw: 2000/10000 + [0,1000)). */
118
- kind: 'adaptive';
119
- activeMs: number;
120
- idleMs: number;
121
- jitterMs: number;
122
- hasActiveWork: () => boolean;
123
- /**
124
- * When the activity probe is sampled for the post-cycle delay:
125
- * claude/codex sample before the poll runs (`cycle-start`, default);
126
- * openclaw samples after the poll completes (`cycle-end`).
127
- */
128
- activitySample?: 'cycle-start' | 'cycle-end';
129
- };
130
- export interface ControlPollerError {
131
- scope: 'read' | 'consume' | 'handler' | 'poll';
132
- key?: ControlChannelKey;
133
- conversationId?: string;
134
- requestId?: string;
135
- error: unknown;
136
- }
137
- export interface ControlChannelPollerOptions {
138
- /** Scoped RTDB handle — the poller never touches the module-global default client. */
139
- rtdb: ControlChannelRTDB;
140
- /** Static agent id, or a getter for hosts whose id can become unavailable. */
141
- agentId: string | (() => string | null);
142
- /** Live conversation scope, snapshotted at the start of every cycle. */
143
- conversationIds: () => Iterable<string>;
144
- cadence: ControlPollerCadence;
145
- /**
146
- * Run the first cycle immediately on start (claude/codex/openclaw).
147
- * `false` waits one cadence delay first (agent-sdk setInterval semantics).
148
- * Default true.
149
- */
150
- pollOnStart?: boolean;
151
- /**
152
- * `sequential` polls conversations one at a time (claude/codex);
153
- * `parallel` polls them concurrently (agent-sdk/openclaw). Default `sequential`.
154
- */
155
- conversationConcurrency?: 'sequential' | 'parallel';
156
- /**
157
- * Lazily prime signal dedupe against the poller start time on first
158
- * sighting instead of requiring an eager {@link ControlChannelPoller.baseline}
159
- * pass (openclaw). Default false.
160
- */
161
- lazyBaselineFromStart?: boolean;
162
- handlers: {
163
- signal?: ControlSignalHandlerConfig;
164
- primitive?: ControlPrimitiveHandlerConfig;
165
- };
166
- onError?: (error: ControlPollerError) => void;
167
- /** Injectable jitter source (default Math.random). */
168
- random?: () => number;
169
- /** Injectable clock (default Date.now). */
170
- now?: () => number;
171
- }
172
- export declare class ControlChannelPoller {
173
- private readonly options;
174
- private timer;
175
- private running;
176
- private startedAt;
177
- private connected;
178
- private unsubscribe?;
179
- private cycleActive;
180
- private readonly cycleRetryRooms;
181
- private readonly retryAt;
182
- private fullRefresh;
183
- private nextFullRefreshAt;
184
- private readonly changedRooms;
185
- private readonly lastSeenSignal;
186
- private readonly lastSeenSignalRevision;
187
- private readonly primitiveDedupe;
188
- constructor(options: ControlChannelPollerOptions);
189
- start(): void;
190
- stop(): void;
191
- isRunning(): boolean;
192
- /**
193
- * Eagerly prime signal dedupe from the current RTDB node without
194
- * handling them (agent-sdk at connect; claude/codex at session creation).
195
- */
196
- baseline(conversationIds: Iterable<string>): Promise<void>;
197
- /** Run one full poll cycle across the current conversation scope. */
198
- pollOnce(): Promise<void>;
199
- private pollRooms;
200
- private wake;
201
- private schedule;
202
- private runCycle;
203
- private sampleActivity;
204
- private nextDelayMs;
205
- private pollConversation;
206
- private pollSignalKey;
207
- private pollPrimitiveKey;
208
- private processPrimitiveEntry;
209
- private dispatch;
210
- private readKey;
211
- private consumeKey;
212
- private baselineKey;
213
- private maybeLazyBaseline;
214
- private prunePrimitiveDedupe;
215
- private releasePrimitiveDedupe;
216
- private controlBasePath;
217
- private resolveAgentId;
218
- private reportError;
219
- private random;
220
- private now;
221
- }
@@ -1,7 +0,0 @@
1
- export interface ExclusiveJsonFileStore<T> {
2
- load(): Promise<T | null>;
3
- save(value: T): Promise<void>;
4
- close(): Promise<void>;
5
- }
6
- /** Private atomic snapshots guarded by one recoverable process lock. */
7
- export declare function createExclusiveJsonFileStore<T>(path: string, name?: string): ExclusiveJsonFileStore<T>;
@@ -1,55 +0,0 @@
1
- import type { WorkspaceOption, WorkspaceOptionSource } from './types.js';
2
- import { EXECUTION_ENVIRONMENT_MODES, isExecutionEnvironmentMode, type ExecutionEnvironmentMode } from './execution-environment-mode.js';
3
- export { EXECUTION_ENVIRONMENT_MODES, isExecutionEnvironmentMode };
4
- export type { ExecutionEnvironmentMode };
5
- export interface PreparedExecutionEnvironment {
6
- cwd: string;
7
- baseCwd: string;
8
- mode: ExecutionEnvironmentMode;
9
- repoRoot?: string;
10
- branch?: string;
11
- worktreePath?: string;
12
- lockPath?: string;
13
- reason?: string;
14
- }
15
- export declare class ExecutionEnvironmentError extends Error {
16
- readonly userMessage: string;
17
- constructor(message: string, userMessage?: string);
18
- }
19
- interface WorkspaceResolverOption {
20
- id: string;
21
- cwd: string;
22
- }
23
- export interface ConfiguredWorkspaceOption extends WorkspaceResolverOption {
24
- label: string;
25
- description?: string;
26
- workspaceRootId?: string;
27
- workspaceRelativePath?: string;
28
- source?: WorkspaceOptionSource;
29
- }
30
- export declare function normalizeOptionalString(value: unknown): string | undefined;
31
- export declare function isEnabledFlag(value: unknown): boolean;
32
- export declare function buildConversationEnvironmentKey(conversationId: string, workspaceCwd: string): string;
33
- export declare function buildWorkspaceOptionId(workspaceCwd: string): string;
34
- export declare function buildConfiguredWorkspaceOptions(primaryCwd: string, configured: string[]): ConfiguredWorkspaceOption[];
35
- export declare function buildPublicWorkspaceOptions(workspaceOptions: Array<Pick<ConfiguredWorkspaceOption, 'id' | 'label'> & Partial<Pick<ConfiguredWorkspaceOption, 'description' | 'workspaceRootId' | 'workspaceRelativePath' | 'source'>>>): WorkspaceOption[];
36
- export declare function resolveConfiguredWorkspaceCwd(input: {
37
- workspaceOptions: WorkspaceResolverOption[];
38
- workspaceId?: string;
39
- defaultCwd: string;
40
- }): string;
41
- export declare function buildConversationWorktreeSpec(input: {
42
- agentId: string;
43
- conversationId: string;
44
- workspaceCwd: string;
45
- }): {
46
- branch: string;
47
- worktreePath: string;
48
- };
49
- export declare function prepareConversationEnvironment(input: {
50
- agentId: string;
51
- conversationId: string;
52
- workspaceCwd: string;
53
- allowWorktrees?: boolean;
54
- }): PreparedExecutionEnvironment;
55
- export declare function releaseConversationEnvironment(environment: Pick<PreparedExecutionEnvironment, 'lockPath'>): void;
@@ -1,25 +0,0 @@
1
- import type { CanonConversation, CanonGroupContext, CanonGroupContextMode, CanonKnownRecentParticipant, CanonMembershipChange, CanonMessage } from './types.js';
2
- type MessageLike = {
3
- senderId?: string | null;
4
- senderName?: string | null;
5
- senderType?: CanonMessage['senderType'];
6
- isOwner?: boolean;
7
- createdAt?: string | null;
8
- };
9
- export declare function diffCanonMemberIds(previousMemberIds: unknown[], nextMemberIds: unknown[]): CanonMembershipChange | null;
10
- export declare function buildCanonKnownRecentParticipants(input: {
11
- messages: MessageLike[];
12
- agentId: string;
13
- ownerId?: string | null;
14
- maxParticipants?: number;
15
- }): CanonKnownRecentParticipant[];
16
- export declare function buildCanonGroupContext(input: {
17
- conversation: CanonConversation | null | undefined;
18
- messages: MessageLike[];
19
- agentId: string;
20
- ownerId?: string | null;
21
- ownerName?: string | null;
22
- membershipChange?: CanonMembershipChange | null;
23
- }): CanonGroupContext | undefined;
24
- export declare function buildCompactGroupContextLines(groupContext: CanonGroupContext, mode: CanonGroupContextMode): string[];
25
- export {};
@@ -1,64 +0,0 @@
1
- import type { CanonGroupContext, CanonGroupContextMode } from './types.js';
2
- import type { CanonTurnContextReplyContextV2, CanonTurnContextV2 } from './host-runtime.js';
3
- import { type CanonSelfContext } from './self-context.js';
4
- export declare const CANON_INBOUND_FRAME_SCHEMA_V1: "canon.inbound_frame.v1";
5
- export type CanonInboundFrameShapeV1 = 'direct_owner' | 'direct_human' | 'direct_agent' | 'group' | 'unknown';
6
- export interface CanonInboundFrameV1 {
7
- schema: typeof CANON_INBOUND_FRAME_SCHEMA_V1;
8
- shape: CanonInboundFrameShapeV1;
9
- sender: {
10
- name: string;
11
- type: 'human' | 'ai_agent';
12
- isOwner: boolean;
13
- };
14
- conversation: {
15
- type: CanonTurnContextV2['conversation']['type'];
16
- memberCount: number | null;
17
- };
18
- addressed: boolean;
19
- message: {
20
- text: string;
21
- contentType: CanonTurnContextV2['message']['contentType'];
22
- artifactContext?: CanonTurnContextV2['message']['artifactContext'];
23
- artifactSummaries?: CanonTurnContextV2['message']['artifactSummaries'];
24
- };
25
- replyContext: CanonTurnContextReplyContextV2 | null;
26
- groupContext: CanonGroupContext | null;
27
- groupContextMode: CanonGroupContextMode | undefined;
28
- /** V1 projection retained for callers that construct or inspect frames. */
29
- selfContexts: string[];
30
- /** Structured private notes enable exact reply attribution when present. */
31
- selfContextDetails?: CanonSelfContext[];
32
- activeSelfContextId?: string | null;
33
- behaviorInstructions: string[];
34
- /**
35
- * Resolved consecutive-agent-turn cap for this conversation, or `null` when
36
- * the room is uncapped. Groups resolve to a default backstop; direct
37
- * conversations stay uncapped.
38
- */
39
- maxConsecutiveAgentTurns: number | null;
40
- }
41
- export interface CanonInboundPromptOptions {
42
- /**
43
- * What the model sees for the `no_reply` verb on this runtime — e.g.
44
- * `mcp__canon__no_reply` on the Claude host. It stands for the affordance,
45
- * not just its name: omit it on a runtime that cannot end a turn without
46
- * posting, and the group guidance drops the whole "otherwise stay silent"
47
- * clause rather than asking for something the model cannot do.
48
- */
49
- noReplyToolName?: string;
50
- /**
51
- * The shared-work tools as the model sees them on this runtime (e.g.
52
- * `mcp__canon__artifact_read`). Omit on a runtime without them: the
53
- * references are still described, without tool hints. `generate` names the
54
- * image tool in the hint to edit the version a person saw.
55
- */
56
- artifactToolNames?: {
57
- read: string;
58
- update: string;
59
- generate?: string;
60
- };
61
- }
62
- export declare function buildCanonInboundFrameV1(context: CanonTurnContextV2): CanonInboundFrameV1;
63
- export declare function renderCodingHostInboundPrompt(frame: CanonInboundFrameV1, options?: CanonInboundPromptOptions): string;
64
- export declare function renderOpenClawSystemPrompt(frame: CanonInboundFrameV1, options?: CanonInboundPromptOptions): string | undefined;