@canonmsg/agent-sdk 11.2.0 → 12.0.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 (188) hide show
  1. package/README.md +171 -536
  2. package/dist/chunks/chunk-6VK4UZHJ.js +2806 -0
  3. package/dist/chunks/chunk-FPQFTTND.js +4899 -0
  4. package/dist/chunks/chunk-OLJ7H4E2.js +14705 -0
  5. package/dist/chunks/mls-crypto-NZDNSPAO.js +10 -0
  6. package/dist/cli.js +198 -0
  7. package/dist/drivers/claude.d.ts +36 -0
  8. package/dist/drivers/code.d.ts +18 -0
  9. package/dist/drivers/codex.d.ts +37 -0
  10. package/dist/index.d.ts +12 -25
  11. package/dist/index.js +69 -13
  12. package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
  13. package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
  14. package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
  15. package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
  16. package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
  17. package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
  18. package/dist/internal/backend-contracts/artifactActions.d.ts +159 -0
  19. package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
  20. package/dist/internal/backend-contracts/communication.d.ts +131 -0
  21. package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
  22. package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
  23. package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
  24. package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
  25. package/dist/internal/backend-contracts/endpoint.d.ts +103 -0
  26. package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +37 -0
  27. package/dist/internal/backend-contracts/environment.d.ts +20 -0
  28. package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
  29. package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
  30. package/dist/internal/backend-contracts/index.d.ts +48 -0
  31. package/dist/internal/backend-contracts/media-url.d.ts +6 -0
  32. package/dist/internal/backend-contracts/media.d.ts +51 -0
  33. package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
  34. package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
  35. package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
  36. package/dist/internal/backend-contracts/message.d.ts +86 -0
  37. package/dist/internal/backend-contracts/messageText.d.ts +6 -0
  38. package/dist/internal/backend-contracts/mlsDevApplication.d.ts +73 -0
  39. package/dist/internal/backend-contracts/mlsDevCredential.d.ts +75 -0
  40. package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
  41. package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +51 -0
  42. package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +74 -0
  43. package/dist/internal/backend-contracts/mlsDevGroup.d.ts +197 -0
  44. package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +47 -0
  45. package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
  46. package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
  47. package/dist/internal/backend-contracts/moderation.d.ts +7 -0
  48. package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
  49. package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
  50. package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
  51. package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
  52. package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
  53. package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
  54. package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
  55. package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
  56. package/dist/internal/backend-contracts/verbContract.d.ts +848 -0
  57. package/dist/internal/backend-contracts/verbSchemas.d.ts +1707 -0
  58. package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
  59. package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
  60. package/dist/internal/backend-contracts/workSessions.d.ts +205 -0
  61. package/dist/internal/core/agent-profiles.d.ts +69 -0
  62. package/dist/internal/core/agent-resolver.d.ts +49 -0
  63. package/dist/internal/core/agent-session.d.ts +12 -0
  64. package/dist/internal/core/approval-format.d.ts +26 -0
  65. package/dist/internal/core/approval-manager.d.ts +43 -0
  66. package/dist/internal/core/approval-types.d.ts +74 -0
  67. package/dist/internal/core/artifacts.d.ts +262 -0
  68. package/dist/internal/core/attached-native-session.d.ts +174 -0
  69. package/dist/internal/core/attached-session-file-store.d.ts +3 -0
  70. package/dist/internal/core/base-url.d.ts +1 -0
  71. package/dist/internal/core/cli-metadata.d.ts +13 -0
  72. package/dist/internal/core/client.d.ts +486 -0
  73. package/dist/internal/core/completed-output-journal.d.ts +39 -0
  74. package/dist/internal/core/constants.d.ts +4 -0
  75. package/dist/internal/core/control-poller.d.ts +221 -0
  76. package/dist/internal/core/endpoint-client.d.ts +43 -0
  77. package/dist/internal/core/exclusive-json-file-store.d.ts +7 -0
  78. package/dist/internal/core/execution-environment-mode.d.ts +8 -0
  79. package/dist/internal/core/execution-environment.d.ts +55 -0
  80. package/dist/internal/core/gifs.d.ts +35 -0
  81. package/dist/internal/core/group-context.d.ts +25 -0
  82. package/dist/internal/core/host-runtime.d.ts +257 -0
  83. package/dist/internal/core/inbound-frame.d.ts +64 -0
  84. package/dist/internal/core/index.d.ts +107 -0
  85. package/dist/internal/core/local-runtime-catalog.d.ts +131 -0
  86. package/dist/internal/core/message-format.d.ts +13 -0
  87. package/dist/internal/core/native-session-interaction.d.ts +44 -0
  88. package/dist/internal/core/node-media.d.ts +6 -0
  89. package/dist/internal/core/policy.d.ts +2 -0
  90. package/dist/internal/core/provenance.d.ts +31 -0
  91. package/dist/internal/core/registration-cli.d.ts +40 -0
  92. package/dist/internal/core/registration-profile.d.ts +10 -0
  93. package/dist/internal/core/registration-session.d.ts +55 -0
  94. package/dist/internal/core/registration.d.ts +21 -0
  95. package/dist/internal/core/retry.d.ts +122 -0
  96. package/dist/internal/core/rtdb-rest.d.ts +145 -0
  97. package/dist/internal/core/runtime-cards.d.ts +331 -0
  98. package/dist/internal/core/runtime-descriptor.d.ts +75 -0
  99. package/dist/internal/core/runtime-endpoints.d.ts +26 -0
  100. package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
  101. package/dist/internal/core/runtime-presentation.d.ts +35 -0
  102. package/dist/internal/core/runtime-request-manager.d.ts +284 -0
  103. package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
  104. package/dist/internal/core/self-context.d.ts +61 -0
  105. package/dist/internal/core/silent-turn.d.ts +86 -0
  106. package/dist/internal/core/stream.d.ts +77 -0
  107. package/dist/internal/core/turn-output-controller.d.ts +69 -0
  108. package/dist/internal/core/turn-protocol.d.ts +33 -0
  109. package/dist/internal/core/turn-verbosity.d.ts +97 -0
  110. package/dist/internal/core/types.d.ts +1075 -0
  111. package/dist/internal/core/typing-status-publisher.d.ts +14 -0
  112. package/dist/internal/core/unified-diff.d.ts +35 -0
  113. package/dist/internal/core/work-session-provider.d.ts +29 -0
  114. package/dist/internal/core/workspace-discovery.d.ts +17 -0
  115. package/dist/internal/endpoint/artifact-images.d.ts +60 -0
  116. package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
  117. package/dist/internal/endpoint/artifact-views.d.ts +113 -0
  118. package/dist/internal/endpoint/artifacts.d.ts +75 -0
  119. package/dist/internal/endpoint/delivery.d.ts +47 -0
  120. package/dist/internal/endpoint/engine.d.ts +219 -0
  121. package/dist/internal/endpoint/ephemeral.d.ts +8 -0
  122. package/dist/internal/endpoint/events.d.ts +32 -0
  123. package/dist/internal/endpoint/external-inbound.d.ts +36 -0
  124. package/dist/internal/endpoint/handoff.d.ts +50 -0
  125. package/dist/internal/endpoint/history.d.ts +22 -0
  126. package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
  127. package/dist/internal/endpoint/inbound.d.ts +29 -0
  128. package/dist/internal/endpoint/index.d.ts +32 -0
  129. package/dist/internal/endpoint/media.d.ts +172 -0
  130. package/dist/internal/endpoint/migration.d.ts +50 -0
  131. package/dist/internal/endpoint/mls-crypto.d.ts +25 -0
  132. package/dist/internal/endpoint/mls-dev-client.d.ts +44 -0
  133. package/dist/internal/endpoint/mls-dev-device.d.ts +67 -0
  134. package/dist/internal/endpoint/mls-dev-groups.d.ts +114 -0
  135. package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +33 -0
  136. package/dist/internal/endpoint/mls-dev-key-packages.d.ts +42 -0
  137. package/dist/internal/endpoint/mls-dev-transport.d.ts +37 -0
  138. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +24 -0
  139. package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
  140. package/dist/internal/endpoint/node.d.ts +7 -0
  141. package/dist/internal/endpoint/observe-query.d.ts +17 -0
  142. package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
  143. package/dist/internal/endpoint/queue.d.ts +22 -0
  144. package/dist/internal/endpoint/recovery.d.ts +27 -0
  145. package/dist/internal/endpoint/retention.d.ts +7 -0
  146. package/dist/internal/endpoint/store.d.ts +22 -0
  147. package/dist/internal/endpoint/sync.d.ts +33 -0
  148. package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
  149. package/dist/internal/endpoint/transport.d.ts +58 -0
  150. package/dist/media.d.ts +1 -1
  151. package/dist/media.js +42 -541
  152. package/dist/runner/runner.d.ts +37 -0
  153. package/dist/runner/types.d.ts +168 -0
  154. package/package.json +18 -5
  155. package/dist/attached-session.d.ts +0 -58
  156. package/dist/attached-session.js +0 -638
  157. package/dist/bounded-file-read.d.ts +0 -14
  158. package/dist/bounded-file-read.js +0 -34
  159. package/dist/canon-agent.d.ts +0 -238
  160. package/dist/canon-agent.js +0 -2534
  161. package/dist/debouncer.d.ts +0 -18
  162. package/dist/debouncer.js +0 -133
  163. package/dist/inbound-handoff.d.ts +0 -6
  164. package/dist/inbound-handoff.js +0 -17
  165. package/dist/managed-session-host.d.ts +0 -27
  166. package/dist/managed-session-host.js +0 -195
  167. package/dist/managed-session-setup.d.ts +0 -99
  168. package/dist/managed-session-setup.js +0 -234
  169. package/dist/realtime.d.ts +0 -62
  170. package/dist/realtime.js +0 -193
  171. package/dist/runtime-card.d.ts +0 -48
  172. package/dist/runtime-card.js +0 -64
  173. package/dist/session-manager.d.ts +0 -77
  174. package/dist/session-manager.js +0 -285
  175. package/dist/turn-streaming-request.d.ts +0 -17
  176. package/dist/turn-streaming-request.js +0 -22
  177. package/dist/turn-verbosity-option.d.ts +0 -33
  178. package/dist/turn-verbosity-option.js +0 -23
  179. package/dist/types.d.ts +0 -387
  180. package/dist/types.js +0 -1
  181. package/dist/work-session-coordination.d.ts +0 -21
  182. package/dist/work-session-coordination.js +0 -53
  183. package/dist/work-session-host.d.ts +0 -31
  184. package/dist/work-session-host.js +0 -617
  185. package/dist/work-session-interactions.d.ts +0 -12
  186. package/dist/work-session-interactions.js +0 -173
  187. package/dist/work-session-state.d.ts +0 -36
  188. package/dist/work-session-state.js +0 -62
@@ -0,0 +1,64 @@
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;
@@ -0,0 +1,107 @@
1
+ export { createNodeMlsDevCustody, NodeMlsDevCustodyError, type NodeMlsDevCustody, type NodeMlsDevCustodyOptions } from '../endpoint/node.js';
2
+ export { createPortableNodeMlsDevCustody, type PortableNodeMlsDevCustody, type PortableNodeMlsDevCustodyOptions } from '../endpoint/node.js';
3
+ export { parseMlsDevClientConfiguration, type MlsDevClientConfiguration } from '../endpoint/mls-crypto.js';
4
+ export { createAttachedNativeSession } from './attached-native-session.js';
5
+ export type { CanonClientEndpointOptions, CanonEndpoint, CanonMlsDevOptions, CanonMlsDevCustody } from './endpoint-client.js';
6
+ export type { EndpointInboundHandoff, EndpointInboundHandoffPhase, EndpointInboundStartResult, EndpointContentMode, MlsDevVerifiedMessageBinding, MlsDevCurrentAudience } from '../endpoint/index.js';
7
+ export { createNodeEndpointMediaBytes } from './node-media.js';
8
+ export { resolveConversationPolicyScope } from '../backend-contracts/index.js';
9
+ export { createFileAttachedSessionStore } from './attached-session-file-store.js';
10
+ export type { AttachedNativeSession, AttachedNativeSessionAdapter, AttachedNativeSessionOptions, AttachedSessionBinding, AttachedSessionInput, AttachedSessionJournal, AttachedSessionMessagePart, AttachedSessionOrigin, AttachedSessionPublisher, AttachedSessionState, AttachedSessionStore, AttachedSessionSubmitResult, NativeSessionEvent, NativeSessionItem, NativeSessionSnapshot, NativeSubmissionResult, } from './attached-native-session.js';
11
+ export { AGENT_CAPABILITIES, CLAUDE_PERMISSION_MODE_OPTIONS, } from './types.js';
12
+ export type { AgentOrigin, AgentOriginDeclaration, AddMemberResult, AgentCapabilities, AgentClientType, CanonControlAvailability, CanonControlDescriptor, CanonControlLiveBehavior, CanonControlSelectionPolicy, CanonControlValue, CanonRuntimeCardCapabilities, CanonRuntimeRichCardCapability, CanonRuntimeVoiceCapabilities, CanonRuntimeVoiceMode, CanonContact, CanonGroupContext, CanonGroupContextMode, CanonKnownRecentParticipant, CanonMembershipChange, CanonResolveAdmissionResult, ConversationUpdatedPayload, ContactAddedPayload, ContactCardPayload, ContactRemovedPayload, ContactSource, ResolvedAdmissionState, ResolvedAdmissionTargetSummary, ResolvedTargetAdmissionPayload, ResolveAdmissionTargetInput, CanonMessage, CanonRuntimeProvenance, CanonTurnDispatch, CanonConversation, CanonConversationsPage, CanonConversationsPageOptions, CanonMessagesPage, CanonVoiceSession, CanonVoiceSessionMode, CanonVoiceSessionParticipant, CanonVoiceSessionStatus, CanonVoiceSessionToken, AgentContext, CanonStreamEvent, AgentSessionSnapshot, ResolvedAdmission, MediaAttachment, MediaAttachmentKind, VideoProcessingStatus, VideoProcessingErrorCode, MessageCreatedPayload, MessageUpdatedPayload, TypingPayload, PresencePayload, RuntimeUpdatedPayload, RuntimeControlEventKind, RuntimeControlEventPayload, TurnUpdatedPayload, ParticipationSuppressedPayload, VoiceSessionEventPayload, SendMessageOptions, CreateGroupOptions, CreateGroupResult, CreateVoiceSessionOptions, JoinVoiceSessionOptions, RegistrationInput, RegistrationResult, RegistrationStatus, UpdateAgentProfileOptions, SetRuntimeTurnOptions, StreamingStatus, SetStreamingOptions, SessionState, AgentRuntime, CanonRuntimeDescriptor, CanonRuntimeActionAvailability, CanonRuntimeActionCategory, CanonRuntimeActionDescriptor, CanonRuntimeActionDispatch, CanonRuntimeActionPlacement, CanonRuntimeCommandArgumentChoice, CanonRuntimeCommandArgumentDescriptor, CanonRuntimeCommandArgumentKind, CanonRuntimeCommandDescriptor, CanonRuntimeDetailTier, CanonRuntimeExecutionMetadata, CanonRuntimePresentationField, CanonRuntimePresentationHint, CanonRuntimePresentationPolicy, CanonRuntimePresentationPreset, CanonRuntimeVisibility, CanonRuntimeActivityItem, CanonRuntimeActivityKind, CanonRuntimeActivityStatus, CanonRuntimeFact, CanonRuntimeFactGroup, CanonRuntimeInventory, CanonRuntimeInventoryEntry, CanonRuntimePrimitiveId, CanonRuntimeStreamingMode, CanonRuntimeStatusItem, CanonRuntimeSurfaceMode, CanonRuntimeTurnModeActivation, CanonRuntimeTurnModeDescriptor, CanonRuntimeTurnModeScope, CanonUnifiedDiff, CanonUnifiedDiffFile, CanonUnifiedDiffFileStatus, CanonWorkspaceRootMetadata, ModelOption, PermissionModeOption, RuntimeInfoPayload, RuntimeControlError, RuntimeControlState, RuntimeControlValueSource, TurnOutputBlock, TurnOutputBlockKind, TurnOutputBlockStatus, WorkspaceOption, WorkspaceOptionSource, } from './types.js';
13
+ export type { CanonGifMetadata, CanonGifResult, CanonGifSearchOptions, CanonGifSearchResponse, GifProvider, } from './gifs.js';
14
+ export { buildGifAttachment, buildGifMetadata, } from './gifs.js';
15
+ export { DEFAULT_FIRST_PARTY_RUNTIME_PRESENTATION, RUNTIME_PRESENTATION_FIELDS, buildRuntimePresentationPolicy, isRuntimePresentationField, isRuntimePresentationFieldHidden, redactAgentRuntimeForConversation, redactAgentSessionSnapshotForConversation, redactRuntimeActivityItemForConversation, redactRuntimeInfoForConversation, redactSessionStateForConversation, } from './runtime-presentation.js';
16
+ export { buildRuntimeProvenance, resolveRuntimeProvenance, } from './provenance.js';
17
+ export type { CanonSelfContext, CanonSelfContextType, SelfContextPromptRenderOptions, } from './self-context.js';
18
+ export { buildSelfContextPromptLines, normalizeSelfContexts, resolveMessageActiveSelfContextId, selectActiveSelfContexts, selectInboundSelfContexts, } from './self-context.js';
19
+ export { buildConfiguredWorkspaceOptionsWithRoots, buildPublicWorkspaceRoots, buildWorkspaceRootId, } from './workspace-discovery.js';
20
+ export type { ConfiguredWorkspaceRoot, } from './workspace-discovery.js';
21
+ export { CanonClient, CanonApiError } from './client.js';
22
+ export type { EndpointOperation as CanonMessageOperation } from '../endpoint/index.js';
23
+ export type { ResumableMediaUploadResult, ResumableMediaUploadSession, } from './client.js';
24
+ export { buildAgentSessionSnapshot } from './agent-session.js';
25
+ export { EFFORT_OPTIONS, EXECUTION_MODE_CONTROL_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, buildFirstPartyCodingRuntimeDescriptor, buildRuntimeWorkspaceControlOptions, normalizeRuntimeCommandAlias, normalizeRuntimeCommandAliases, normalizeRuntimeCommandDescriptors, } from './runtime-descriptor.js';
26
+ export { CanonStream, CanonStreamError } from './stream.js';
27
+ export type { CanonStreamErrorPayload, ReplayExpiredPayload, StreamHandler } from './stream.js';
28
+ export { createRuntimeHeartbeat } from './runtime-heartbeat.js';
29
+ export type { RuntimeHeartbeat, RuntimeHeartbeatOperation, RuntimeHeartbeatOptions, } from './runtime-heartbeat.js';
30
+ export type { ParticipationStyle, AgentBehaviorSettings, ParticipationPolicy, ResolvedAgentBehaviorPolicy, ParticipationHistoryMessage, ParticipationHistorySnapshot, ParticipationDecisionInput, ParticipationDecision, } from './policy.js';
31
+ export { buildParticipationHistorySnapshot, DEFAULT_DIRECT_MAX_CONSECUTIVE_AGENT_TURNS, DEFAULT_GROUP_MAX_CONSECUTIVE_AGENT_TURNS, DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, evaluateParticipationPolicy, getDefaultParticipationPolicy, resolveAgentBehaviorPolicy, } from './policy.js';
32
+ export { DEFAULT_RUNTIME_CAPABILITIES, ACTIVE_TURN_STALE_THRESHOLD_MS, HOST_ADMISSION_ACTION_CAPABILITIES, HOST_ADMISSION_ACTIONS_DISABLED, FINAL_MESSAGE_HANDOFF_MS, WAITING_INPUT_STALE_THRESHOLD_MS, getTurnStateStaleThresholdMs, isTurnOpen, isTurnStateStale, normalizeTurnMetadata, normalizeTurnState, resolveTurnMessageSemantics, shouldPromoteConversationMessage, shouldTriggerAgentTurn, } from './turn-protocol.js';
33
+ export type { DeliveryIntent, TurnMessageSemantics, InboundDisposition, TurnLifecycleState, RuntimeCapabilities, HostAdmissionActionCapabilities, TurnState, TurnMetadata, TriggerDecision, } from './turn-protocol.js';
34
+ export { resumeRegistration } from './registration-session.js';
35
+ export type { RegistrationSession, RegistrationCredentials, RegistrationStore, RegistrationProgress, ResumeRegistrationOptions } from './registration-session.js';
36
+ export { ensureAgentProfile } from './registration-profile.js';
37
+ export type { EnsureAgentProfileOptions } from './registration-profile.js';
38
+ export { registerRegistrationCli, runRegistrationCli } from './registration-cli.js';
39
+ export type { RegistrationCliOptions } from './registration-cli.js';
40
+ export { ackRegistrationApproval, registerAndWaitForApproval, submitRegistrationRequest, waitForRegistrationApproval, } from './registration.js';
41
+ export { RuntimeRequestManager, RuntimeRequestCancelledError, runtimeInputDescriptor, runtimeCardDescriptor, runtimePlanDescriptor, } from './runtime-request-manager.js';
42
+ export type { RuntimeRequestKind, RuntimeRequestContext, RuntimeRequestOptions, RuntimeResolveReason, RuntimeConsumeOutcome, RuntimeOutcomeMessage, RuntimeRequestCallInput, RuntimeRequestPreflightInput, RuntimeRequestPushInput, RuntimeRequestPushMatch, KindDescriptor, RuntimeInputRequestPayload, RuntimeInputRequestResult, RuntimeCardRequestPayload, RuntimeCardRequestResult, RuntimePlanRequestPayload, RuntimePlanRequestResult, } from './runtime-request-manager.js';
43
+ export { ApprovalManager } from './approval-manager.js';
44
+ export { generateApprovalId, buildApprovalRequest, buildApprovalReply, buildApprovalOutcome, redactSecrets, } from './approval-format.js';
45
+ export { DEFAULT_APPROVAL_CONFIG, parseApprovalRequestMetadata, parseApprovalReplyMetadata, parseSessionRule, } from './approval-types.js';
46
+ export type { ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalNativeRequestMetadata, ApprovalRisk, ApprovalReplyMetadata, ApprovalOutcomeMetadata, SessionRule, ApprovalResult, ApprovalConfig, } from './approval-types.js';
47
+ export { UNIFIED_DIFF_MAX_FILE_BYTES, UNIFIED_DIFF_MAX_FILES, UNIFIED_DIFF_MAX_TOTAL_BYTES, isSensitiveDiffPath, normalizeCanonUnifiedDiff, sanitizeUnifiedDiffForSharing, truncateUnifiedDiff, } from './unified-diff.js';
48
+ export type { TruncateUnifiedDiffOptions } from './unified-diff.js';
49
+ export { decodeStoredRuntimeCard } from '../backend-contracts/index.js';
50
+ export { RUNTIME_CARD_SCHEMA_V1, RUNTIME_CARD_LIMITS, RUNTIME_CARD_FIELD_TYPES, RUNTIME_CARD_LINE_ITEM_COLUMN_TYPES, buildRuntimeCardOutcome, buildRuntimeCardPreview, buildRuntimeCardReply, buildRuntimeCardRequest, buildRuntimeInputOutcome, buildRuntimeInputReply, buildRuntimeInputRequest, parseRuntimeCardOutcomeMetadata, parseRuntimeCardReplyMetadata, parseRuntimeCardRequestMetadata, parseRuntimeCardV1, parseRuntimeInputOutcomeMetadata, parseRuntimeInputReplyMetadata, parseRuntimeInputRequestMetadata, resolveQuestionAllowOther, validateRuntimeCardFieldValues, } from './runtime-cards.js';
51
+ export type { PlanApprovalDecision, PlanApprovalMetadata, PlanApprovalReplyMetadata, RuntimeCardAction, RuntimeCardActionsBlock, RuntimeCardBlock, RuntimeCardBlockKind, RuntimeCardCalloutBlock, RuntimeCardChartBlock, RuntimeCardChartPoint, RuntimeCardChartSeries, RuntimeCardDetailsBlock, RuntimeCardDetailsRow, RuntimeCardField, RuntimeCardFieldChoice, RuntimeCardFieldType, RuntimeCardKnownBlockKind, RuntimeCardLineItemColumn, RuntimeCardLineItemColumnType, RuntimeCardListBlock, RuntimeCardListItem, RuntimeCardMediaKind, RuntimeCardMediaPreviewBlock, RuntimeCardMediaPreviewMedia, RuntimeCardMetric, RuntimeCardMetricGridBlock, RuntimeCardNativeMetadata, RuntimeCardOutcomeMetadata, RuntimeCardPreview, RuntimeCardReplyMetadata, RuntimeCardReplyStatus, RuntimeCardRequestMetadata, RuntimeCardResolutionStatus, RuntimeCardSchemaV1, RuntimeCardSummaryBlock, RuntimeCardTableBlock, RuntimeCardTone, RuntimeCardUnknownBlock, RuntimeCardV1, RuntimeInputAnswers, RuntimeInputChoice, RuntimeInputKind, RuntimeInputNativeMetadata, RuntimeInputOutcomeMetadata, RuntimeInputQuestion, RuntimeInputReplyMetadata, RuntimeInputReplyStatus, RuntimeInputRequestMetadata, RuntimeInputResolutionStatus, } from './runtime-cards.js';
52
+ export { DEFAULT_TURN_TRAIL_MAX_BLOCKS, DEFAULT_TURN_TRAIL_METADATA_BUDGET_BYTES, buildBoundedTurnTrail, createTurnOutputController, } from './turn-output-controller.js';
53
+ export type { BuildBoundedTurnTrailOptions, TurnOutputController, TurnOutputBlockInput, TurnOutputControllerOptions, TurnOutputMode, TurnOutputSnapshot, } from './turn-output-controller.js';
54
+ export { DEFAULT_SILENT_TURN_PRECEDENCE, NO_REPLY_ACK_NOTE, NO_REPLY_REASON_SENTINEL, isSilentTurnSuppressed, reportNoReplyOutcome, resolveSilentTurnDelivery, } from './silent-turn.js';
55
+ export type { NoReplyReportClient, SilentTurnPrecedence } from './silent-turn.js';
56
+ export { DEFAULT_TURN_VERBOSITY_BY_CONVERSATION_TYPE, QUIET_SUPPRESSES_TURN_TRAIL, normalizeTurnVerbosityConversationType, parseTurnVerbosityConfig, resolveTurnVerbosity, shouldPublishTurnTrail, } from './turn-verbosity.js';
57
+ export type { TurnVerbosity, TurnVerbosityConfig, TurnVerbosityConversationType, } from './turn-verbosity.js';
58
+ export { clearPendingRegistration, getOrCreatePendingRegistration, loadPendingRegistrations, loadProfiles, savePendingRegistrations, saveProfiles, updatePendingRegistration, upsertAgentProfile, isProfileLocked, acquireLock, releaseLock, isProcessAlive, CANON_DIR, AGENTS_PATH, LOCKS_DIR, } from './agent-profiles.js';
59
+ export type { AgentProfile, AgentProfileInput, PendingRegistration, ProfileLockHandle, } from './agent-profiles.js';
60
+ export { resolveCanonAgent, resolveCanonProfile, verifyResolvedAgentEnvironment, getActiveProfile, getActiveProfileLock, } from './agent-resolver.js';
61
+ export type { ResolvedAgent } from './agent-resolver.js';
62
+ export { RUNTIMES_DIR, buildLocalRuntimeId, clearRuntimeSessionState, describeProfileLock, heartbeatLocalRuntimeEntry, listLocalRuntimeEntries, loadRuntimeSessionState, markLocalRuntimeStopped, readLocalRuntimeEntry, resetCodexRuntimeSessionState, resetRuntimeSessionState, resolveLocalRuntimeSessionState, saveRuntimeSessionState, upsertLocalRuntimeEntry, } from './local-runtime-catalog.js';
63
+ export type { LocalRuntimeCatalogEntry, LocalRuntimeKind, LocalRuntimeResumeField, LocalRuntimeReviveCapability, LocalRuntimeSessionResolution, LocalRuntimeSessionState, LocalRuntimeStatus, } from './local-runtime-catalog.js';
64
+ export { buildConfiguredWorkspaceOptions, buildConversationEnvironmentKey, buildConversationWorktreeSpec, buildPublicWorkspaceOptions, buildWorkspaceOptionId, EXECUTION_ENVIRONMENT_MODES, isEnabledFlag, isExecutionEnvironmentMode, normalizeOptionalString, resolveConfiguredWorkspaceCwd, ExecutionEnvironmentError, prepareConversationEnvironment, releaseConversationEnvironment, } from './execution-environment.js';
65
+ export type { ConfiguredWorkspaceOption, ExecutionEnvironmentMode, PreparedExecutionEnvironment, } from './execution-environment.js';
66
+ export { initRTDBAuth, } from './rtdb-rest.js';
67
+ export type { AgentSessionSnapshotPatch, RTDBClientHandle, RuntimeActivityPayloadData, RuntimeInfoPayloadData, SessionStatePayload, TurnStatePayload, } from './rtdb-rest.js';
68
+ export { CANON_TURN_CONTEXT_SCHEMA_V2, buildCanonReplyContextLines, buildCanonTurnContextV2, buildHydratedInboundContext, hydrateCanonReplyContext, createConversationMetadataLoader, decideAutoReply, publishHostAgentRuntime, publishHostSessionSnapshots, renderCanonHostInboundContent, renderCanonTurnBriefPrompt, resolveCanonReplyContext, } from './host-runtime.js';
69
+ export type { CanonTurnContextAttachmentV2, CanonTurnContextBehaviorV2, CanonTurnContextContactCardV2, CanonTurnContextParticipationV2, CanonTurnContextProvenanceV2, CanonTurnContextReplyContextV2, CanonTurnContextV2, } from './host-runtime.js';
70
+ export type { CanonReplyContext, AutoReplyDecision, HostInboundParticipantContext, } from './host-runtime.js';
71
+ export { CANON_INBOUND_FRAME_SCHEMA_V1, buildCanonInboundFrameV1, renderCodingHostInboundPrompt, renderOpenClawSystemPrompt, } from './inbound-frame.js';
72
+ export type { CanonInboundFrameShapeV1, CanonInboundFrameV1, CanonInboundPromptOptions, } from './inbound-frame.js';
73
+ export { buildCanonGroupContext, buildCanonKnownRecentParticipants, buildCompactGroupContextLines, diffCanonMemberIds, } from './group-context.js';
74
+ export { createRuntimeStatePublisher, } from './runtime-state-publisher.js';
75
+ export type { RuntimeStatePublisher, RuntimeStatePublisherOptions, RuntimeStreamingPayload, ClearRuntimeActivityOptions, } from './runtime-state-publisher.js';
76
+ export { createTypingStatusPublisher, } from './typing-status-publisher.js';
77
+ export type { TypingPresenceStatus, TypingStatusPublisher, TypingStatusPublisherOptions, } from './typing-status-publisher.js';
78
+ export { buildChunkedMessagePartMetadata, CANON_MESSAGE_TEXT_MAX_BYTES, ChunkedSendMessageError, DEFAULT_CHUNKED_MESSAGE_TEXT_MAX_BYTES, sendMessageWithRetryChunked, isCanonMessageIdConflict, isPendingCanonOperation, isChunkedSendMessageError, isRetryableCanonDeliveryError, sendMessageWithRetry, splitTextByUtf8Bytes, utf8ByteLength, } from './retry.js';
79
+ export type { ChunkedMessagePartMetadataInput, ChunkedSendMessageResult, SendMessageChunkingOptions, SendMessageRetryOptions, } from './retry.js';
80
+ export { formatCanonMessageAsText } from './message-format.js';
81
+ export { DEFAULT_BASE_URL, DEFAULT_STREAM_URL, DEFAULT_RTDB_URL, FIREBASE_WEB_API_KEY } from './constants.js';
82
+ export { CANON_RUNTIME_ENDPOINT_DEFAULTS, DEFAULT_CANON_ENVIRONMENT_ID, DEFAULT_CANON_RUNTIME_ENDPOINTS, getCanonRuntimeEndpointDefaults, requireCanonRuntimeEndpointDefaults, resolveCanonRuntimeConnection, verifyCanonRuntimeConnection, } from './runtime-endpoints.js';
83
+ export type { CanonRuntimeConnection, CanonRuntimeConnectionOptions, CanonRuntimeEndpointDefaults, } from './runtime-endpoints.js';
84
+ export { CANON_ENVIRONMENT_CONTRACTS, getCanonEnvironmentContract, } from '../backend-contracts/index.js';
85
+ export type { CanonEnvironmentContract, CanonEnvironmentId, CanonEnvironmentName, } from '../backend-contracts/index.js';
86
+ export { resolveCanonBaseUrl } from './base-url.js';
87
+ export { handleCliMetadataRequest, isDirectExecution, readCliPackageVersion, runCli, } from './cli-metadata.js';
88
+ export type { CliMetadata, RunCliMetadataOptions, } from './cli-metadata.js';
89
+ export { ControlChannelPoller, type ControlChannelKey, type ControlChannelPollerOptions, type ControlChannelRTDB, type ControlHandlerResult, type ControlPollerCadence, type ControlPollerError, type ControlPrimitiveEvent, type ControlPrimitiveHandlerConfig, type ControlSignalEvent, type ControlSignalHandlerConfig, type ControlSignalType } from './control-poller.js';
90
+ export { CANON_VERB_NAMES, CANON_VERB_NAMESPACE, CANON_VERBS_SCHEMA_ID, CANON_VERBS_SCHEMA_VERSION, CANON_VERB_WIRE_SCHEMA_ID, CANON_VERB_WIRE_SCHEMA_VERSION, CANON_CARD_SCHEMA_ID, VERB_LIMITS, VERB_RATE_LIMITS, VERB_WIRE_ENVELOPE_FIELDS, canonVerbToolName, findVerbByteLimitViolations, findVerbWireEnvelopeViolations, getVerbInputSchema, getVerbResultSchema, mergeVerbWireToIntent, normalizeVerbNativeMetadata, projectVerbIntentToWire, type CanonVerbName, type CanonVerbWireEnvelope, type CanonVerbWireRequest, type CanonVerbWireResponse, type CanonVerbJsonSchema, type GetVerbSchemaOptions, type SendToInput, type SendToResult, type VerbMessageOptions, type VerbNativeMetadata, type VerbWireAccepted, type VerbWireBody, } from '../backend-contracts/index.js';
91
+ export { DEFAULT_DISCOVER_AGENTS_LIMIT, MAX_DISCOVER_AGENTS_LIMIT, MAX_DISCOVER_AGENTS_QUERY_LENGTH, type CanonAgentDirectoryEntry, type DiscoverAgentsInput, type DiscoverAgentsResult, } from '../backend-contracts/index.js';
92
+ export { parseDirectConversationSelection, readCommunicationRule, type CommunicateInput, type CommunicateResult, type CommunicationRule, type DirectConversationSelection, type StartDirectInput, type StartDirectResult, } from '../backend-contracts/index.js';
93
+ export { canonMediaDownloadUrl, sanitizeDownloadFileName, buildMediaContentDisposition, getStoredFileExtension } from '../backend-contracts/index.js';
94
+ export type { NativeSessionInteractionBridge, NativeSessionInteractionRequest, NativeSessionInteractionResult } from './native-session-interaction.js';
95
+ export { NativeWorkSessionCreateError } from './work-session-provider.js';
96
+ export type { NativeWorkSessionProvider, NativeWorkSessionCreated, NativeWorkSessionCreateContext } from './work-session-provider.js';
97
+ export * from './exclusive-json-file-store.js';
98
+ export * from './completed-output-journal.js';
99
+ export type { WorkSessionChoice, WorkSessionModelChoice, WorkSessionSettings, WorkSessionSelection, WorkSessionLoadedSession, WorkSessionCatalog, WorkSessionRuntimeIdentity, WorkSessionRuntimeLease, WorkSessionRuntimeRegistration, WorkSessionBinding, WorkSessionRuntimeState, WorkSessionCatalogResult, RequestWorkSessionInput, WorkSessionRequestStatus, WorkSessionRequest, WorkSessionCompletion, WorkSessionRuntimeAuth, WorkSessionClaimInput, WorkSessionClaimResult, CompleteWorkSessionInput, WorkSessionHeartbeatInput, ReleaseWorkSessionBindingInput, GetWorkSessionRequestInput, WorkSessionReportInput, WorkSessionDetailFields, WorkSessionDetailField, } from '../backend-contracts/index.js';
100
+ export { ARTIFACT_IMAGE_MIME_TYPES, ArtifactMemory, CanonArtifactError, artifactCommandId, artifactRequestUuid, createConversationArtifacts, sniffArtifactImageType, summarizeArtifactReferences, } from './artifacts.js';
101
+ export type { ArtifactAddImageInput, ArtifactAddImageResult, ArtifactConflictView, ArtifactCreateInput, ArtifactGenerateImageInput, ArtifactGenerateImageResult, ArtifactIdDerivation, ArtifactInputValue, ArtifactList, ArtifactListItem, ArtifactRoomHost, ArtifactUpdateAction, ArtifactUpdateResult, ArtifactWriteView, CanonArtifactErrorCode, CanonConversationArtifacts, } from './artifacts.js';
102
+ export { ARTIFACT_CONTEXT_PROTOCOL, ARTIFACT_FORM_FIELD_TYPES, ARTIFACT_ID_PATTERN, ARTIFACT_KEY_PATTERN, ARTIFACT_KINDS, ARTIFACT_LIMITS, ARTIFACT_PROTOCOL_VERSION, artifactActivityText, isCanonArtifactEnvironmentEnabled, parseArtifactContext, readArtifactContext, } from '../backend-contracts/index.js';
103
+ export { ARTIFACT_ACTION_SEMANTICS, ARTIFACT_TOOL_NAMES, ARTIFACT_UPDATE_ACTION_TYPES, ArtifactValidationError, artifactActionSchemas, artifactToolInputSchemas, parseArtifactAddImageAction, parseArtifactCreateAction, parseArtifactCreateToolInput, parseArtifactGenerateImageAction, parseArtifactImageRegion, parseArtifactImageSource, parseArtifactUpdateAction, } from '../backend-contracts/index.js';
104
+ export type { ArtifactActionSchemas, ArtifactActionValue, ArtifactAddImageAction, ArtifactCellAction, ArtifactCreateAction, ArtifactCreateToolInput, ArtifactGenerateImageAction, ArtifactImageSource, ArtifactJsonSchema, ArtifactRowAction, ArtifactToolName, } from '../backend-contracts/index.js';
105
+ export type { ArtifactAsset, ArtifactChessPlayers, ArtifactCommand, ArtifactContext, ArtifactDefinition, ArtifactDomainOutcome, ArtifactFormColumn, ArtifactFormField, ArtifactFormFieldRemoval, ArtifactFormFieldType, ArtifactFormRow, ArtifactFormTable, ArtifactFormValue, ArtifactImageVariant, ArtifactJson, ArtifactKind, ArtifactReadResult, ArtifactReference, ArtifactReferenceOrigin, ArtifactSelection, ArtifactSnapshot, } from '../backend-contracts/index.js';
106
+ export { ArtifactRejectedError, describeArtifact, summarizeArtifact, isTerminalImageGenerationError } from '../endpoint/index.js';
107
+ export type { ArtifactChessMoveView, ArtifactChessView, ArtifactConflict, ArtifactFormChangeView, ArtifactFormFieldView, ArtifactFormView, ArtifactImageRegion, ArtifactImageVariantView, ArtifactImageView, ArtifactLibrary, ArtifactPrincipalView, ArtifactView, } from '../endpoint/index.js';
@@ -0,0 +1,131 @@
1
+ import type { AgentClientType, ExecutionEnvironmentMode } from './types.js';
2
+ import type { WorkSessionSettings } from '../backend-contracts/index.js';
3
+ export type LocalRuntimeKind = AgentClientType | 'sdk';
4
+ export type LocalRuntimeStatus = 'running' | 'offline' | 'stale' | 'manual' | 'embedded';
5
+ export type LocalRuntimeReviveCapability = 'revivable' | 'manual' | 'embedded' | 'missing-profile';
6
+ export interface LocalRuntimeSessionState {
7
+ conversationId: string;
8
+ workspaceId?: string;
9
+ baseCwd: string;
10
+ executionMode?: ExecutionEnvironmentMode;
11
+ codexPolicyFingerprint?: string;
12
+ /** Identifies fingerprints created from deployer-owned local runtime policy. */
13
+ codexPolicyFingerprintFormat?: 'local-v1';
14
+ /**
15
+ * Confirmed owner setup, saved before the first native turn. Runtime-neutral
16
+ * despite its name: every managed coding host (Codex, Claude Code) stores its
17
+ * setup here. The key keeps its original name so existing records and older
18
+ * hosts stay compatible.
19
+ */
20
+ codexManagedSetup?: {
21
+ requestId: string;
22
+ settings: WorkSessionSettings;
23
+ };
24
+ /**
25
+ * Explicit local reset fences older native session mappings (any resume
26
+ * field) from adoption. Runtime-neutral; see `codexManagedSetup` on the name.
27
+ */
28
+ codexThreadResetAt?: string;
29
+ /** Local ownership fence; older records without these fields remain importable. */
30
+ ownerId?: string;
31
+ ownershipVersion?: number;
32
+ threadId?: string;
33
+ claudeSessionId?: string;
34
+ hermesSessionId?: string;
35
+ lastInboundMessageId?: string;
36
+ updatedAt: string;
37
+ }
38
+ export interface LocalRuntimeCatalogEntry {
39
+ id: string;
40
+ runtime: LocalRuntimeKind;
41
+ profile: string | null;
42
+ agentId?: string;
43
+ agentName?: string;
44
+ cwd: string;
45
+ baseCwd?: string;
46
+ workspaceRoots?: string[];
47
+ workspaces?: string[];
48
+ launchCommand: string[];
49
+ pid?: number;
50
+ status: LocalRuntimeStatus;
51
+ reviveCapability: LocalRuntimeReviveCapability;
52
+ surfaceMode?: 'host' | 'channel' | 'embedded';
53
+ lastStartedAt?: string;
54
+ lastHeartbeatAt?: string;
55
+ lastStoppedAt?: string;
56
+ lastAuthError?: string;
57
+ lastError?: string;
58
+ sessions?: Record<string, LocalRuntimeSessionState>;
59
+ }
60
+ export type LocalRuntimeResumeField = 'threadId' | 'claudeSessionId' | 'hermesSessionId';
61
+ export type LocalRuntimeSessionResolution = {
62
+ status: 'new';
63
+ } | {
64
+ status: 'exact' | 'adopted';
65
+ state: LocalRuntimeSessionState;
66
+ } | {
67
+ status: 'configuration_required';
68
+ reason: 'ambiguous_mapping' | 'invalid_mapping_timestamp' | 'workspace_unavailable' | 'execution_mode_unavailable';
69
+ message: string;
70
+ };
71
+ export declare const RUNTIMES_DIR: string;
72
+ export declare function buildLocalRuntimeId(input: {
73
+ runtime: LocalRuntimeKind;
74
+ profile?: string | null;
75
+ cwd: string;
76
+ launchCommand?: string[];
77
+ }): string;
78
+ export declare function readLocalRuntimeEntry(id: string): LocalRuntimeCatalogEntry | null;
79
+ export declare function upsertLocalRuntimeEntry(entry: LocalRuntimeCatalogEntry): LocalRuntimeCatalogEntry;
80
+ export declare function heartbeatLocalRuntimeEntry(id: string, patch?: Partial<LocalRuntimeCatalogEntry>): LocalRuntimeCatalogEntry | null;
81
+ export declare function markLocalRuntimeStopped(id: string, patch?: Partial<LocalRuntimeCatalogEntry>): LocalRuntimeCatalogEntry | null;
82
+ export declare function listLocalRuntimeEntries(options?: {
83
+ runtime?: LocalRuntimeKind;
84
+ }): LocalRuntimeCatalogEntry[];
85
+ export declare function loadRuntimeSessionState(runtimeId: string, input: {
86
+ conversationId: string;
87
+ baseCwd: string;
88
+ executionMode?: ExecutionEnvironmentMode;
89
+ workspaceId?: string;
90
+ }): LocalRuntimeSessionState | null;
91
+ /**
92
+ * Resolve the durable local thread/session for a Canon conversation.
93
+ *
94
+ * The current tuple always wins. A changed local default may otherwise point
95
+ * the host at a fresh tuple and accidentally fork a conversation's runtime
96
+ * history, so the unique newest resumable tuple may be adopted when the host
97
+ * can still recreate its workspace and execution mode. Legacy runtime IDs are
98
+ * considered only for the same local agent/profile/surface, and conflicting
99
+ * historical mappings fail closed instead of donating an arbitrary thread.
100
+ */
101
+ export declare function resolveLocalRuntimeSessionState(runtimeId: string, input: {
102
+ conversationId: string;
103
+ baseCwd: string;
104
+ executionMode?: ExecutionEnvironmentMode;
105
+ workspaceId?: string;
106
+ resumeField: LocalRuntimeResumeField;
107
+ configuredBaseCwds: readonly string[];
108
+ availableExecutionModes: readonly ExecutionEnvironmentMode[];
109
+ }): LocalRuntimeSessionResolution;
110
+ export declare function saveRuntimeSessionState(runtimeId: string, input: Omit<LocalRuntimeSessionState, 'updatedAt'>): LocalRuntimeSessionState;
111
+ /**
112
+ * Atomically discard a conversation's native session IDs (any runtime) while
113
+ * retaining its confirmed setup, ownership and inbound cursor, and fence older
114
+ * mappings from being adopted again.
115
+ */
116
+ export declare function resetRuntimeSessionState(runtimeId: string, input: {
117
+ conversationId: string;
118
+ baseCwd: string;
119
+ executionMode: ExecutionEnvironmentMode;
120
+ }): LocalRuntimeSessionState;
121
+ /** @deprecated Runtime-neutral now; use {@link resetRuntimeSessionState}. */
122
+ export declare const resetCodexRuntimeSessionState: typeof resetRuntimeSessionState;
123
+ export declare function clearRuntimeSessionState(runtimeId: string, input: {
124
+ conversationId: string;
125
+ baseCwd?: string;
126
+ executionMode?: ExecutionEnvironmentMode;
127
+ workspaceId?: string;
128
+ preserveInboundCursor?: boolean;
129
+ preserveCodexManagedSetup?: boolean;
130
+ }): void;
131
+ export declare function describeProfileLock(profile: string): string;
@@ -0,0 +1,13 @@
1
+ import type { CanonMessage } from './types.js';
2
+ /**
3
+ * Project a CanonMessage to a single text representation suitable as a
4
+ * baseline for plugins that feed messages to an LLM as plain text.
5
+ *
6
+ * Plugins that compose richer prompts (placeholders, capability hints,
7
+ * native vision input) layer on top of this — the goal here is only to
8
+ * guarantee that no contentType is ever silently dropped to an empty
9
+ * string. Adding a new contentType to CanonMessage and forgetting to
10
+ * handle it here surfaces in this file's tests, not as a silent
11
+ * regression in every consumer plugin.
12
+ */
13
+ export declare function formatCanonMessageAsText(message: Pick<CanonMessage, 'contentType' | 'text' | 'attachments' | 'contactCard' | 'interaction'>): string;
@@ -0,0 +1,44 @@
1
+ import type { ApprovalNativeRequestMetadata, ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRisk } from './approval-types.js';
2
+ import type { CanonUnifiedDiff } from './types.js';
3
+ import type { RuntimeInputRequestPayload } from './runtime-request-manager.js';
4
+ import type { RuntimeInputAnswers } from './runtime-cards.js';
5
+ interface NativeInteractionIdentity {
6
+ /** Provider-scoped request identity, used to correlate cancellation and replies. */
7
+ nativeRequestId: string;
8
+ nativeSessionId: string;
9
+ turnId?: string;
10
+ }
11
+ export type NativeSessionInteractionRequest = NativeInteractionIdentity & ({
12
+ kind: 'approval';
13
+ approval: {
14
+ toolName: string;
15
+ toolInput: Record<string, unknown>;
16
+ toolSummary: string;
17
+ category?: ApprovalRequestCategory;
18
+ risk?: ApprovalRisk;
19
+ riskLevel?: 'normal' | 'destructive';
20
+ native?: ApprovalNativeRequestMetadata;
21
+ details?: ApprovalRequestDetail[];
22
+ diff?: CanonUnifiedDiff;
23
+ };
24
+ } | {
25
+ kind: 'input';
26
+ input: Omit<RuntimeInputRequestPayload, 'responseUserId' | 'turnId'>;
27
+ });
28
+ export type NativeSessionInteractionResult = {
29
+ kind: 'approval';
30
+ decision: 'allow' | 'deny';
31
+ } | {
32
+ kind: 'input';
33
+ answers: RuntimeInputAnswers;
34
+ } | {
35
+ kind: 'cancelled';
36
+ };
37
+ /** The host owns the Canon audience, owner responder, request IDs and deadlines. */
38
+ export interface NativeSessionInteractionBridge {
39
+ /** Abort when a native client answers first, the observer closes, or the request is cleared. */
40
+ request(request: NativeSessionInteractionRequest, options: {
41
+ signal: AbortSignal;
42
+ }): Promise<NativeSessionInteractionResult>;
43
+ }
44
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { EndpointMediaBytes } from '../endpoint/index.js';
2
+ /** Filesystem bytes adapter only; upload dependencies and retry belong to the engine. */
3
+ export declare function createNodeEndpointMediaBytes(options: {
4
+ directory: string;
5
+ fetch?: typeof fetch;
6
+ }): EndpointMediaBytes<string>;
@@ -0,0 +1,2 @@
1
+ export { buildParticipationHistorySnapshot, DEFAULT_DIRECT_MAX_CONSECUTIVE_AGENT_TURNS, evaluateParticipationPolicy, getDefaultParticipationPolicy, resolveAgentBehaviorPolicy, DEFAULT_GROUP_MAX_CONSECUTIVE_AGENT_TURNS, PARTICIPATION_HISTORY_FETCH_LIMIT as DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, } from "../backend-contracts/index.js";
2
+ export type { ParticipationStyle, PolicyConversationType, ParticipationPolicy, ParticipationDecision, ParticipationDecisionInput, ParticipationHistoryMessage, ParticipationHistorySnapshot, AgentBehaviorSettingsInput as AgentBehaviorSettings, ResolvedAgentBehaviorPolicyRecord as ResolvedAgentBehaviorPolicy, } from "../backend-contracts/index.js";
@@ -0,0 +1,31 @@
1
+ import type { CanonConversation, CanonMessage, CanonRuntimeProvenance } from './types.js';
2
+ import type { CanonSelfContext } from './self-context.js';
3
+ export declare function buildRuntimeProvenance(input: {
4
+ conversationId: string;
5
+ conversationType?: CanonConversation['type'] | 'unknown' | string | null;
6
+ memberCount?: number | null;
7
+ senderId: string;
8
+ senderName?: string | null;
9
+ senderType?: CanonMessage['senderType'] | string | null;
10
+ isOwner?: boolean | null;
11
+ agentId?: string | null;
12
+ mentions?: readonly string[] | null;
13
+ mentionedAgent?: boolean | null;
14
+ activeSelfContextId?: string | null;
15
+ selfContexts?: readonly CanonSelfContext[] | null;
16
+ }): CanonRuntimeProvenance;
17
+ export declare function resolveRuntimeProvenance(input: {
18
+ provenance?: CanonRuntimeProvenance | null;
19
+ conversationId: string;
20
+ conversationType?: CanonConversation['type'] | 'unknown' | string | null;
21
+ memberCount?: number | null;
22
+ senderId: string;
23
+ senderName?: string | null;
24
+ senderType?: CanonMessage['senderType'] | string | null;
25
+ isOwner?: boolean | null;
26
+ agentId?: string | null;
27
+ mentions?: readonly string[] | null;
28
+ mentionedAgent?: boolean | null;
29
+ activeSelfContextId?: string | null;
30
+ selfContexts?: readonly CanonSelfContext[] | null;
31
+ }): CanonRuntimeProvenance;
@@ -0,0 +1,40 @@
1
+ import { type AgentOriginDeclaration } from '../backend-contracts/index.js';
2
+ import type { AgentClientType } from './types.js';
3
+ export interface RegistrationCliOptions {
4
+ /**
5
+ * `import.meta.url` of the plugin's own CLI entry module. Required so
6
+ * direct-execution detection and `--version` resolve against the plugin
7
+ * package, not @canonmsg/core.
8
+ */
9
+ moduleUrl: string;
10
+ clientType: AgentClientType;
11
+ /** Optional self-reported public source; callers may override it with CLI flags. */
12
+ origin?: AgentOriginDeclaration;
13
+ /** Published bin name, e.g. `canon-register`. */
14
+ cliName: string;
15
+ /** Host bin the operator starts after approval, e.g. `canon-claude`. */
16
+ hostBinName: string;
17
+ developerInfo: string;
18
+ help: string;
19
+ /** Full usage line printed when a required flag is missing. */
20
+ usage: string;
21
+ /** Noun used in the "Registering <label> ..." progress line. */
22
+ registeringLabel: string;
23
+ /**
24
+ * Optional host-specific instructions printed after approval. When omitted,
25
+ * Canon emits the conventional local host-binary startup guidance.
26
+ */
27
+ approvedInstructions?: (profileName: string) => readonly string[];
28
+ }
29
+ /**
30
+ * Shared orchestration for the per-plugin registration CLIs
31
+ * (`canon-register`, `canon-codex-register`). Every string that differs
32
+ * between plugins is a parameter so each CLI's stdout/stderr stays exactly
33
+ * what it was before consolidation.
34
+ */
35
+ export declare function runRegistrationCli(options: RegistrationCliOptions): Promise<void>;
36
+ /**
37
+ * Entry-point wrapper: runs {@link runRegistrationCli} under the shared
38
+ * `runCli` harness (direct-execution guard, `--help` / `--version`).
39
+ */
40
+ export declare function registerRegistrationCli(options: RegistrationCliOptions): void;
@@ -0,0 +1,10 @@
1
+ import { type RegistrationProgress, type ResumeRegistrationOptions } from './registration-session.js';
2
+ export interface EnsureAgentProfileOptions extends Omit<ResumeRegistrationOptions, 'store' | 'input'> {
3
+ /** The local profile store owns its stable localRegistrationId. */
4
+ input: Omit<ResumeRegistrationOptions['input'], 'localRegistrationId'>;
5
+ profile: string;
6
+ /** Explicitly request a new registration even if a usable local credential exists. */
7
+ reconnect?: boolean;
8
+ }
9
+ /** Reuse an environment-bound local profile, or resume its owner-approved registration. */
10
+ export declare function ensureAgentProfile(options: EnsureAgentProfileOptions): Promise<RegistrationProgress>;
@@ -0,0 +1,55 @@
1
+ import { type CanonRuntimeConnectionOptions } from './runtime-endpoints.js';
2
+ import type { RegistrationInput, RegistrationStatus } from './types.js';
3
+ /** Persisted alongside the provider's configuration; never expose the poll token to a model. */
4
+ export interface RegistrationSession {
5
+ localRegistrationId: string;
6
+ environmentId: string;
7
+ baseUrl: string;
8
+ streamUrl: string;
9
+ rtdbUrl: string;
10
+ firebaseApiKey: string;
11
+ ownerPhone?: string;
12
+ requestedAgentId?: string;
13
+ requestId?: string;
14
+ pollToken?: string;
15
+ /** Written only after saveCredentials succeeds. Survives an interrupted ACK. */
16
+ credentialAgentId?: string;
17
+ }
18
+ export interface RegistrationCredentials {
19
+ apiKey: string;
20
+ agentId: string;
21
+ agentName: string;
22
+ }
23
+ type Awaitable<T> = T | Promise<T>;
24
+ /**
25
+ * Each write must resolve after durable persistence. Credential reads must use
26
+ * the pending session's environment binding. Serialize callers for one store;
27
+ * this coordinator does not acquire a provider's cross-process lock.
28
+ */
29
+ export interface RegistrationStore {
30
+ load(): Awaitable<RegistrationSession | undefined>;
31
+ save(session: RegistrationSession): Awaitable<void>;
32
+ loadCredentials(): Awaitable<RegistrationCredentials | undefined>;
33
+ saveCredentials(credentials: RegistrationCredentials): Awaitable<void>;
34
+ clear(): Awaitable<void>;
35
+ }
36
+ export type RegistrationProgress = ({
37
+ status: 'approved';
38
+ } & RegistrationCredentials) | {
39
+ status: 'pending' | 'rejected' | 'credential-expired' | 'credential-delivered';
40
+ requestId: string;
41
+ };
42
+ export interface ResumeRegistrationOptions {
43
+ connection: CanonRuntimeConnectionOptions;
44
+ input: Omit<RegistrationInput, 'baseUrl'>;
45
+ store: RegistrationStore;
46
+ /** Zero (default) checks once, for episodic runtimes. Waiting deadlines return pending. */
47
+ waitMs?: number;
48
+ pollIntervalMs?: number;
49
+ signal?: AbortSignal;
50
+ onSubmitted?: (requestId: string) => Awaitable<void>;
51
+ onPollUpdate?: (status: RegistrationStatus) => Awaitable<void>;
52
+ }
53
+ /** Resume the exact request, save its credential, then acknowledge delivery. */
54
+ export declare function resumeRegistration(options: ResumeRegistrationOptions): Promise<RegistrationProgress>;
55
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { RegistrationInput, RegistrationResult, RegistrationStatus } from './types.js';
2
+ /**
3
+ * Registers a new Canon agent and polls for owner approval.
4
+ *
5
+ * Flow:
6
+ * 1. POST /agents/register -> returns requestId
7
+ * 2. Poll GET /agents/status/:requestId until approved/rejected/timeout
8
+ * 3. On approval, returns the API key
9
+ */
10
+ export declare function registerAndWaitForApproval(input: RegistrationInput, callbacks?: {
11
+ onSubmitted?: (requestId: string, pollToken?: string) => void | Promise<void>;
12
+ onPollUpdate?: (status: RegistrationStatus) => void | Promise<void>;
13
+ }): Promise<RegistrationResult>;
14
+ export declare function submitRegistrationRequest(input: RegistrationInput): Promise<{
15
+ requestId: string;
16
+ pollToken?: string;
17
+ }>;
18
+ export declare function waitForRegistrationApproval(baseUrl: string | undefined, requestId: string, pollToken?: string, callbacks?: {
19
+ onPollUpdate?: (status: RegistrationStatus) => void | Promise<void>;
20
+ }): Promise<RegistrationResult>;
21
+ export declare function ackRegistrationApproval(baseUrl: string | undefined, requestId: string, pollToken?: string): Promise<void>;