@canonmsg/agent-sdk 11.2.1 → 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.
- package/README.md +248 -523
- package/dist/chunks/chunk-7N6OPPW4.js +5430 -0
- package/dist/chunks/chunk-N722GWCP.js +4897 -0
- package/dist/chunks/chunk-QZ4PPRQW.js +14247 -0
- package/dist/chunks/mls-crypto-LMNQZOS6.js +10 -0
- package/dist/cli.js +572 -0
- package/dist/drivers/claude.d.ts +42 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +46 -0
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +20 -25
- package/dist/index.js +91 -13
- package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
- package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
- package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
- package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
- package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
- package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
- package/dist/internal/backend-contracts/artifactActions.d.ts +8 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
- package/dist/internal/backend-contracts/communication.d.ts +146 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
- package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
- package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
- package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +120 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +48 -0
- package/dist/internal/backend-contracts/environment.d.ts +20 -0
- package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
- package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
- package/dist/internal/backend-contracts/index.d.ts +54 -0
- package/dist/internal/backend-contracts/media-url.d.ts +20 -0
- package/dist/internal/backend-contracts/media.d.ts +51 -0
- package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
- package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
- package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
- package/dist/internal/backend-contracts/message.d.ts +86 -0
- package/dist/internal/backend-contracts/messageText.d.ts +6 -0
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +161 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +78 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +52 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +321 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
- package/dist/internal/backend-contracts/moderation.d.ts +7 -0
- package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
- package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
- package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
- package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
- package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
- package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +856 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1717 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/core/agent-profiles.d.ts +65 -0
- package/dist/internal/core/approval-format.d.ts +22 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +73 -0
- package/dist/internal/core/base-url.d.ts +1 -0
- package/dist/internal/core/cli-metadata.d.ts +13 -0
- package/dist/internal/core/client.d.ts +432 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +1 -0
- package/dist/internal/core/endpoint-client.d.ts +56 -0
- package/dist/internal/core/execution-environment-mode.d.ts +6 -0
- package/dist/internal/core/gifs.d.ts +29 -0
- package/dist/internal/core/host-runtime.d.ts +53 -0
- package/dist/internal/core/index.d.ts +68 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/registration-profile.d.ts +10 -0
- package/dist/internal/core/registration-session.d.ts +55 -0
- package/dist/internal/core/registration.d.ts +5 -0
- package/dist/internal/core/retry.d.ts +113 -0
- package/dist/internal/core/rtdb-rest.d.ts +141 -0
- package/dist/internal/core/runtime-cards.d.ts +286 -0
- package/dist/internal/core/runtime-descriptor.d.ts +16 -0
- package/dist/internal/core/runtime-endpoints.d.ts +26 -0
- package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
- package/dist/internal/core/runtime-presentation.d.ts +9 -0
- package/dist/internal/core/runtime-request-manager.d.ts +283 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +22 -0
- package/dist/internal/core/silent-turn.d.ts +49 -0
- package/dist/internal/core/stream.d.ts +78 -0
- package/dist/internal/core/turn-protocol.d.ts +28 -0
- package/dist/internal/core/turn-verbosity.d.ts +85 -0
- package/dist/internal/core/types.d.ts +964 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/endpoint/artifact-images.d.ts +60 -0
- package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
- package/dist/internal/endpoint/artifact-views.d.ts +113 -0
- package/dist/internal/endpoint/artifacts.d.ts +75 -0
- package/dist/internal/endpoint/delivery.d.ts +47 -0
- package/dist/internal/endpoint/engine.d.ts +249 -0
- package/dist/internal/endpoint/ephemeral.d.ts +8 -0
- package/dist/internal/endpoint/events.d.ts +32 -0
- package/dist/internal/endpoint/external-inbound.d.ts +36 -0
- package/dist/internal/endpoint/handoff.d.ts +50 -0
- package/dist/internal/endpoint/history.d.ts +22 -0
- package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
- package/dist/internal/endpoint/inbound.d.ts +29 -0
- package/dist/internal/endpoint/index.d.ts +32 -0
- package/dist/internal/endpoint/media.d.ts +177 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +32 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +52 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +69 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +174 -0
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +46 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +62 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +38 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +29 -0
- package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
- package/dist/internal/endpoint/node.d.ts +7 -0
- package/dist/internal/endpoint/observe-query.d.ts +17 -0
- package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
- package/dist/internal/endpoint/queue.d.ts +22 -0
- package/dist/internal/endpoint/recovery.d.ts +27 -0
- package/dist/internal/endpoint/retention.d.ts +7 -0
- package/dist/internal/endpoint/store.d.ts +22 -0
- package/dist/internal/endpoint/sync.d.ts +33 -0
- package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
- package/dist/internal/endpoint/transport.d.ts +63 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/errands.d.ts +118 -0
- package/dist/runner/mls.d.ts +97 -0
- package/dist/runner/relay.d.ts +87 -0
- package/dist/runner/runner.d.ts +98 -0
- package/dist/runner/types.d.ts +215 -0
- package/package.json +18 -5
- package/dist/attached-session.d.ts +0 -58
- package/dist/attached-session.js +0 -638
- package/dist/bounded-file-read.d.ts +0 -14
- package/dist/bounded-file-read.js +0 -34
- package/dist/canon-agent.d.ts +0 -236
- package/dist/canon-agent.js +0 -2531
- package/dist/debouncer.d.ts +0 -18
- package/dist/debouncer.js +0 -133
- package/dist/inbound-handoff.d.ts +0 -6
- package/dist/inbound-handoff.js +0 -17
- package/dist/managed-session-host.d.ts +0 -27
- package/dist/managed-session-host.js +0 -195
- package/dist/managed-session-setup.d.ts +0 -99
- package/dist/managed-session-setup.js +0 -234
- package/dist/realtime.d.ts +0 -62
- package/dist/realtime.js +0 -193
- package/dist/runtime-card.d.ts +0 -48
- package/dist/runtime-card.js +0 -64
- package/dist/session-manager.d.ts +0 -77
- package/dist/session-manager.js +0 -285
- package/dist/turn-streaming-request.d.ts +0 -17
- package/dist/turn-streaming-request.js +0 -22
- package/dist/turn-verbosity-option.d.ts +0 -33
- package/dist/turn-verbosity-option.js +0 -23
- package/dist/types.d.ts +0 -387
- package/dist/types.js +0 -1
- package/dist/work-session-coordination.d.ts +0 -21
- package/dist/work-session-coordination.js +0 -53
- package/dist/work-session-host.d.ts +0 -31
- package/dist/work-session-host.js +0 -617
- package/dist/work-session-interactions.d.ts +0 -12
- package/dist/work-session-interactions.js +0 -173
- package/dist/work-session-state.d.ts +0 -36
- package/dist/work-session-state.js +0 -62
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CanonMessage } from './types.js';
|
|
2
|
+
import type { ArtifactContext } from '../backend-contracts/index.js';
|
|
3
|
+
type HostInboundMessage = {
|
|
4
|
+
id?: string | null;
|
|
5
|
+
senderId?: string | null;
|
|
6
|
+
senderName?: string | null;
|
|
7
|
+
text?: string | null;
|
|
8
|
+
contentType?: CanonMessage['contentType'] | null;
|
|
9
|
+
attachments?: CanonMessage['attachments'];
|
|
10
|
+
senderType?: CanonMessage['senderType'];
|
|
11
|
+
mentions?: string[] | null;
|
|
12
|
+
contactCard?: CanonMessage['contactCard'];
|
|
13
|
+
replyTo?: string | null;
|
|
14
|
+
replyToPosition?: number | null;
|
|
15
|
+
deleted?: boolean | null;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
export interface CanonReplyContext {
|
|
19
|
+
/** Earlier message’s references remain quoted context, never the active selection. */
|
|
20
|
+
artifactContext?: ArtifactContext;
|
|
21
|
+
messageId: string;
|
|
22
|
+
senderId?: string | null;
|
|
23
|
+
senderName?: string | null;
|
|
24
|
+
senderType?: CanonMessage['senderType'] | null;
|
|
25
|
+
text?: string | null;
|
|
26
|
+
contentType?: CanonMessage['contentType'] | null;
|
|
27
|
+
attachments?: CanonMessage['attachments'];
|
|
28
|
+
contactCard?: CanonMessage['contactCard'];
|
|
29
|
+
body: string;
|
|
30
|
+
replyToPosition?: number | null;
|
|
31
|
+
found: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Render the **text portion** of an inbound Canon message. Images are
|
|
35
|
+
* referenced by short placeholders — their actual bytes are delivered to the
|
|
36
|
+
* host as native vision/media inputs (Codex `-i <file>`, Anthropic image
|
|
37
|
+
* blocks). URLs are intentionally *not* inlined, since the harness never
|
|
38
|
+
* needs to refetch and earlier `[Image: <url>]` inlining caused vision
|
|
39
|
+
* models to see a string about an image instead of the image itself.
|
|
40
|
+
*
|
|
41
|
+
* `materialized` may be passed so non-image attachments can reference a
|
|
42
|
+
* local path the agent can Read. Without it we fall back to an unadorned
|
|
43
|
+
* placeholder; the vision path still works because image args carry the
|
|
44
|
+
* file path directly.
|
|
45
|
+
*/
|
|
46
|
+
export declare function renderCanonHostInboundContent(message: HostInboundMessage, materialized?: ReadonlyArray<{
|
|
47
|
+
kind: 'image' | 'audio' | 'video' | 'file';
|
|
48
|
+
path: string;
|
|
49
|
+
fileName?: string;
|
|
50
|
+
durationMs?: number;
|
|
51
|
+
index: number;
|
|
52
|
+
}>): string;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
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 type { CanonClientEndpointOptions, CanonEndpoint, CanonMlsDevOptions, CanonMlsDevCustody } from './endpoint-client.js';
|
|
5
|
+
export type { EndpointInboundHandoff, EndpointInboundHandoffPhase, EndpointInboundStartResult, EndpointContentMode, MlsDevVerifiedMessageBinding, MlsDevCurrentAudience } from '../endpoint/index.js';
|
|
6
|
+
export { createNodeEndpointMediaBytes } from './node-media.js';
|
|
7
|
+
export { resolveConversationPolicyScope } from '../backend-contracts/index.js';
|
|
8
|
+
export { CLAUDE_PERMISSION_MODE_OPTIONS, } from './types.js';
|
|
9
|
+
export type { AgentOrigin, AgentOriginDeclaration, AddMemberResult, AgentClientType, CanonControlAvailability, CanonControlDescriptor, CanonControlLiveBehavior, CanonControlSelectionPolicy, CanonControlValue, CanonRuntimeCardCapabilities, CanonRuntimeRichCardCapability, CanonRuntimeVoiceCapabilities, CanonRuntimeVoiceMode, CanonContact, CanonMembershipChange, CanonResolveAdmissionResult, ConversationUpdatedPayload, ContactAddedPayload, ContactCardPayload, ContactRemovedPayload, ContactSource, ResolvedAdmissionState, ResolvedAdmissionTargetSummary, ResolvedTargetAdmissionPayload, ResolveAdmissionTargetInput, CanonMessage, CanonRuntimeProvenance, CanonTurnDispatch, CanonConversation, CanonConversationsPage, CanonConversationsPageOptions, CanonMessagesPage, CanonVoiceSession, CanonVoiceSessionMode, CanonVoiceSessionParticipant, CanonVoiceSessionStatus, CanonVoiceSessionToken, AgentContext, AgentSessionSnapshot, MediaAttachment, MediaAttachmentKind, VideoProcessingStatus, VideoProcessingErrorCode, MessageCreatedPayload, MessageUpdatedPayload, TypingPayload, PresencePayload, RuntimeUpdatedPayload, RuntimeControlEventKind, RuntimeControlEventPayload, TurnUpdatedPayload, ParticipationSuppressedPayload, VoiceSessionEventPayload, SendMessageOptions, CreateGroupOptions, CreateGroupResult, CreateVoiceSessionOptions, JoinVoiceSessionOptions, RegistrationInput, RegistrationStatus, 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';
|
|
10
|
+
export type { CanonGifMetadata, CanonGifResult, CanonGifSearchResponse, GifProvider, } from './gifs.js';
|
|
11
|
+
export { buildGifAttachment, buildGifMetadata, } from './gifs.js';
|
|
12
|
+
export { isRuntimePresentationFieldHidden, redactAgentSessionSnapshotForConversation, redactRuntimeActivityItemForConversation, redactRuntimeInfoForConversation, } from './runtime-presentation.js';
|
|
13
|
+
export type { CanonSelfContext, CanonSelfContextType, } from './self-context.js';
|
|
14
|
+
export { CanonClient, CanonApiError } from './client.js';
|
|
15
|
+
export type { EndpointOperation as CanonMessageOperation } from '../endpoint/index.js';
|
|
16
|
+
export type { ResumableMediaUploadResult, ResumableMediaUploadSession, } from './client.js';
|
|
17
|
+
export { EXECUTION_MODE_CONTROL_OPTIONS, RUNTIME_NEW_SESSION_ACTION, RUNTIME_STOP_ACTION, RUNTIME_STOP_AND_DROP_ACTION, normalizeRuntimeCommandAlias, normalizeRuntimeCommandAliases, normalizeRuntimeCommandDescriptors, } from './runtime-descriptor.js';
|
|
18
|
+
export { CanonStream, CanonStreamError } from './stream.js';
|
|
19
|
+
export type { CanonStreamErrorPayload, ReplayExpiredPayload, StreamHandler } from './stream.js';
|
|
20
|
+
export { createRuntimeHeartbeat } from './runtime-heartbeat.js';
|
|
21
|
+
export type { RuntimeHeartbeat, RuntimeHeartbeatOperation, RuntimeHeartbeatOptions, } from './runtime-heartbeat.js';
|
|
22
|
+
export type { ParticipationStyle, AgentBehaviorSettings, ParticipationPolicy, ResolvedAgentBehaviorPolicy, ParticipationHistoryMessage, ParticipationHistorySnapshot, ParticipationDecisionInput, ParticipationDecision, } from './policy.js';
|
|
23
|
+
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';
|
|
24
|
+
export { ACTIVE_TURN_STALE_THRESHOLD_MS, WAITING_INPUT_STALE_THRESHOLD_MS, getTurnStateStaleThresholdMs, isTurnOpen, isTurnStateStale, normalizeTurnMetadata, resolveTurnMessageSemantics, shouldPromoteConversationMessage, shouldTriggerAgentTurn, } from './turn-protocol.js';
|
|
25
|
+
export type { DeliveryIntent, TurnMessageSemantics, InboundDisposition, TurnLifecycleState, RuntimeCapabilities, HostAdmissionActionCapabilities, TurnState, TurnMetadata, TriggerDecision, } from './turn-protocol.js';
|
|
26
|
+
export { resumeRegistration } from './registration-session.js';
|
|
27
|
+
export type { RegistrationSession, RegistrationCredentials, RegistrationStore, RegistrationProgress, ResumeRegistrationOptions } from './registration-session.js';
|
|
28
|
+
export { ensureAgentProfile } from './registration-profile.js';
|
|
29
|
+
export type { EnsureAgentProfileOptions } from './registration-profile.js';
|
|
30
|
+
export { submitRegistrationRequest, } from './registration.js';
|
|
31
|
+
export { RuntimeRequestManager, RuntimeRequestCancelledError, runtimeInputDescriptor, runtimeCardDescriptor, runtimePlanDescriptor, } from './runtime-request-manager.js';
|
|
32
|
+
export type { RuntimeRequestKind, RuntimeRequestContext, RuntimeRequestOptions, RuntimeConsumeOutcome, RuntimeOutcomeMessage, RuntimeRequestCallInput, RuntimeRequestPreflightInput, RuntimeRequestPushInput, RuntimeRequestPushMatch, KindDescriptor, RuntimeInputRequestPayload, RuntimeInputRequestResult, RuntimeCardRequestPayload, RuntimeCardRequestResult, RuntimePlanRequestPayload, RuntimePlanRequestResult, } from './runtime-request-manager.js';
|
|
33
|
+
export { ApprovalManager } from './approval-manager.js';
|
|
34
|
+
export { generateApprovalId, buildApprovalRequest, buildApprovalOutcome, redactSecrets, } from './approval-format.js';
|
|
35
|
+
export { DEFAULT_APPROVAL_CONFIG, parseApprovalReplyMetadata, parseSessionRule, } from './approval-types.js';
|
|
36
|
+
export type { ApprovalRequestCategory, ApprovalRequestDetail, ApprovalRequestMetadata, ApprovalNativeRequestMetadata, ApprovalRisk, ApprovalReplyMetadata, ApprovalOutcomeMetadata, SessionRule, ApprovalResult, ApprovalConfig, } from './approval-types.js';
|
|
37
|
+
export { UNIFIED_DIFF_MAX_FILE_BYTES, UNIFIED_DIFF_MAX_FILES, UNIFIED_DIFF_MAX_TOTAL_BYTES, isSensitiveDiffPath, normalizeCanonUnifiedDiff, sanitizeUnifiedDiffForSharing, truncateUnifiedDiff, } from './unified-diff.js';
|
|
38
|
+
export type { TruncateUnifiedDiffOptions } from './unified-diff.js';
|
|
39
|
+
export { decodeStoredRuntimeCard } from '../backend-contracts/index.js';
|
|
40
|
+
export { RUNTIME_CARD_SCHEMA_V1, RUNTIME_CARD_LIMITS, RUNTIME_CARD_FIELD_TYPES, RUNTIME_CARD_LINE_ITEM_COLUMN_TYPES, buildRuntimeCardOutcome, buildRuntimeCardPreview, buildRuntimeInputOutcome, parseRuntimeCardV1, validateRuntimeCardFieldValues, } from './runtime-cards.js';
|
|
41
|
+
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';
|
|
42
|
+
export { NO_REPLY_ACK_NOTE, NO_REPLY_REASON_SENTINEL, reportNoReplyOutcome, } from './silent-turn.js';
|
|
43
|
+
export type { NoReplyReportClient } from './silent-turn.js';
|
|
44
|
+
export { DEFAULT_TURN_VERBOSITY_BY_CONVERSATION_TYPE, normalizeTurnVerbosityConversationType, parseTurnVerbosityConfig, resolveTurnVerbosity, } from './turn-verbosity.js';
|
|
45
|
+
export type { TurnVerbosity, TurnVerbosityConfig, TurnVerbosityConversationType, } from './turn-verbosity.js';
|
|
46
|
+
export { clearPendingRegistration, loadPendingRegistrations, loadProfiles, savePendingRegistrations, saveProfiles, upsertAgentProfile, isProfileLocked, acquireLock, releaseLock, isProcessAlive, CANON_DIR, AGENTS_PATH, LOCKS_DIR, } from './agent-profiles.js';
|
|
47
|
+
export type { AgentProfile, AgentProfileInput, PendingRegistration, ProfileLockHandle, } from './agent-profiles.js';
|
|
48
|
+
export { initRTDBAuth, } from './rtdb-rest.js';
|
|
49
|
+
export type { AgentSessionSnapshotPatch, RTDBClientHandle, RuntimeActivityPayloadData, RuntimeInfoPayloadData, SessionStatePayload, TurnStatePayload, } from './rtdb-rest.js';
|
|
50
|
+
export { renderCanonHostInboundContent, } from './host-runtime.js';
|
|
51
|
+
export type { CanonReplyContext, } from './host-runtime.js';
|
|
52
|
+
export { createRuntimeStatePublisher, } from './runtime-state-publisher.js';
|
|
53
|
+
export type { RuntimeStatePublisher, RuntimeStatePublisherOptions, RuntimeStreamingPayload, ClearRuntimeActivityOptions, } from './runtime-state-publisher.js';
|
|
54
|
+
export { buildChunkedMessagePartMetadata, CANON_MESSAGE_TEXT_MAX_BYTES, ChunkedSendMessageError, DEFAULT_CHUNKED_MESSAGE_TEXT_MAX_BYTES, sendMessageWithRetryChunked, isPendingCanonOperation, isChunkedSendMessageError, isRetryableCanonDeliveryError, sendMessageWithRetry, splitTextByUtf8Bytes, utf8ByteLength, } from './retry.js';
|
|
55
|
+
export type { ChunkedMessagePartMetadataInput, ChunkedSendMessageResult, SendMessageChunkingOptions, SendMessageRetryOptions, } from './retry.js';
|
|
56
|
+
export { DEFAULT_BASE_URL } from './constants.js';
|
|
57
|
+
export { CANON_RUNTIME_ENDPOINT_DEFAULTS, DEFAULT_CANON_ENVIRONMENT_ID, DEFAULT_CANON_RUNTIME_ENDPOINTS, getCanonRuntimeEndpointDefaults, requireCanonRuntimeEndpointDefaults, resolveCanonRuntimeConnection, verifyCanonRuntimeConnection, } from './runtime-endpoints.js';
|
|
58
|
+
export type { CanonRuntimeConnection, CanonRuntimeConnectionOptions, CanonRuntimeEndpointDefaults, } from './runtime-endpoints.js';
|
|
59
|
+
export { CANON_ENVIRONMENT_CONTRACTS, getCanonEnvironmentContract, } from '../backend-contracts/index.js';
|
|
60
|
+
export type { CanonEnvironmentContract, CanonEnvironmentId, CanonEnvironmentName, } from '../backend-contracts/index.js';
|
|
61
|
+
export { resolveCanonBaseUrl } from './base-url.js';
|
|
62
|
+
export { handleCliMetadataRequest, isDirectExecution, readCliPackageVersion, runCli, } from './cli-metadata.js';
|
|
63
|
+
export type { CliMetadata, RunCliMetadataOptions, } from './cli-metadata.js';
|
|
64
|
+
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, getVerbResultSchema, mergeVerbWireToIntent, normalizeVerbNativeMetadata, projectVerbIntentToWire, type CanonVerbName, type CanonVerbWireEnvelope, type CanonVerbWireRequest, type CanonVerbWireResponse, type CanonVerbJsonSchema, type SendToInput, type SendToResult, type VerbMessageOptions, type VerbNativeMetadata, type VerbWireAccepted, type VerbWireBody, } from '../backend-contracts/index.js';
|
|
65
|
+
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';
|
|
66
|
+
export { parseDirectConversationSelection, readCommunicationRule, type CommunicateInput, type CommunicateResult, type CommunicationRule, type DirectConversationSelection, type StartDirectInput, type StartDirectResult, } from '../backend-contracts/index.js';
|
|
67
|
+
export { canonMediaDownloadUrl, sanitizeDownloadFileName, buildMediaContentDisposition, getStoredFileExtension } from '../backend-contracts/index.js';
|
|
68
|
+
export * from './completed-output-journal.js';
|
|
@@ -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,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,113 @@
|
|
|
1
|
+
import type { SendMessageOptions } from './types.js';
|
|
2
|
+
import { type CanonClient } from './client.js';
|
|
3
|
+
export interface SendMessageRetryOptions {
|
|
4
|
+
/** Stable replacement recorded by the product after a conclusive rejection. */
|
|
5
|
+
operationId?: string;
|
|
6
|
+
replacesOperationId?: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
maxAttempts?: number;
|
|
10
|
+
baseDelayMs?: number;
|
|
11
|
+
maxDelayMs?: number;
|
|
12
|
+
sleep?: (ms: number) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const CANON_MESSAGE_TEXT_MAX_BYTES: number;
|
|
15
|
+
export declare const DEFAULT_CHUNKED_MESSAGE_TEXT_MAX_BYTES = 3800;
|
|
16
|
+
export interface SendMessageChunkingOptions {
|
|
17
|
+
maxTextBytes?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Opt in to resumable chunked delivery.
|
|
20
|
+
*
|
|
21
|
+
* With it on, a mid-sequence failure throws a `ChunkedSendMessageError`
|
|
22
|
+
* carrying the ids of the parts that ARE durable, so a later attempt can pick
|
|
23
|
+
* up the tail. Off by default so callers that do not resume keep today's
|
|
24
|
+
* behaviour: the raw send error, unwrapped.
|
|
25
|
+
*
|
|
26
|
+
* Implied by a non-empty `deliveredMessageIds` — passing progress back IS
|
|
27
|
+
* opting in.
|
|
28
|
+
*/
|
|
29
|
+
resumable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Ids of the parts an earlier attempt already made durable, in part order.
|
|
32
|
+
* Those parts are skipped and their ids are carried into the result, so a
|
|
33
|
+
* resumed send still reports the whole answer.
|
|
34
|
+
*/
|
|
35
|
+
deliveredMessageIds?: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export interface ChunkedSendMessageResult {
|
|
38
|
+
messageIds: string[];
|
|
39
|
+
}
|
|
40
|
+
/** Pending delivery is visible, but cannot truthfully produce a failure notice. */
|
|
41
|
+
export declare function isPendingCanonOperation(error: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A chunked send that stopped part-way, with the progress needed to resume it.
|
|
44
|
+
*
|
|
45
|
+
* Parts 1..`deliveredMessageIds.length` are durable in Canon; only the tail is
|
|
46
|
+
* missing. Handing `deliveredMessageIds` back to `sendMessageWithRetryChunked`
|
|
47
|
+
* restarts at the next part instead of re-sending the answer's head — which the
|
|
48
|
+
* server would reject or duplicate, and which the reader has already seen.
|
|
49
|
+
*/
|
|
50
|
+
export declare class ChunkedSendMessageError extends Error {
|
|
51
|
+
/** Ids of the parts that are durable in Canon, in part order. */
|
|
52
|
+
readonly deliveredMessageIds: string[];
|
|
53
|
+
/** The part the send stopped on (1-based). */
|
|
54
|
+
readonly failedPart: number;
|
|
55
|
+
/** How many parts the text splits into in total. */
|
|
56
|
+
readonly totalParts: number;
|
|
57
|
+
/** The underlying send failure — what callers should classify. */
|
|
58
|
+
readonly cause: unknown;
|
|
59
|
+
constructor(input: {
|
|
60
|
+
cause: unknown;
|
|
61
|
+
deliveredMessageIds: readonly string[];
|
|
62
|
+
failedPart: number;
|
|
63
|
+
totalParts: number;
|
|
64
|
+
});
|
|
65
|
+
/** How many parts are durable — a resume starts at the next one. */
|
|
66
|
+
get deliveredParts(): number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Structural check as well as `instanceof`, so progress survives a caller that
|
|
70
|
+
* ended up with a second copy of this module (a workspace package resolved to
|
|
71
|
+
* both `dist` and source, say) instead of silently degrading to "no progress".
|
|
72
|
+
*/
|
|
73
|
+
export declare function isChunkedSendMessageError(error: unknown): error is ChunkedSendMessageError;
|
|
74
|
+
export declare function isRetryableCanonDeliveryError(error: unknown): boolean;
|
|
75
|
+
export declare function sendMessageWithRetry(client: CanonClient, conversationId: string, text: string, options?: SendMessageOptions, retryOptions?: SendMessageRetryOptions): Promise<{
|
|
76
|
+
messageId: string;
|
|
77
|
+
}>;
|
|
78
|
+
export declare function utf8ByteLength(value: string): number;
|
|
79
|
+
export declare function splitTextByUtf8Bytes(text: string, maxBytes?: number): string[];
|
|
80
|
+
export declare function chunkMessageId(baseMessageId: string | undefined, index: number): string | undefined;
|
|
81
|
+
export interface ChunkedMessagePartMetadataInput {
|
|
82
|
+
/** Stable group id shared by every part, normally the unsuffixed message id. */
|
|
83
|
+
groupId?: string;
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
index: number;
|
|
86
|
+
count: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build metadata for one visible part of a logically single message.
|
|
90
|
+
*
|
|
91
|
+
* Earlier parts are progress-only and cannot trigger replies or notifications.
|
|
92
|
+
* The last part preserves the caller's terminal semantics while removing
|
|
93
|
+
* streamed text from the trail, because that text is already visible in the
|
|
94
|
+
* preceding message parts.
|
|
95
|
+
*/
|
|
96
|
+
export declare function buildChunkedMessagePartMetadata(input: ChunkedMessagePartMetadataInput): Record<string, unknown>;
|
|
97
|
+
/**
|
|
98
|
+
* Send `text` as one message, or as an ordered sequence of `-part-N` messages
|
|
99
|
+
* when it exceeds the byte budget.
|
|
100
|
+
*
|
|
101
|
+
* Sequential by construction, so a failure leaves parts 1..k durable and the
|
|
102
|
+
* tail unsent. Callers that opt into `resumable` get that progress back (see
|
|
103
|
+
* `ChunkedSendMessageError`) and can hand it to a later attempt, which then
|
|
104
|
+
* picks up at part k+1. The split is a pure function of the text and the byte
|
|
105
|
+
* budget, so part N of a resumed attempt is byte-identical to part N of the
|
|
106
|
+
* attempt that delivered it — which is what makes the `-part-N` ids a safe
|
|
107
|
+
* resume cursor.
|
|
108
|
+
*
|
|
109
|
+
* A byte-identical replay succeeds at the server. Any idempotency conflict
|
|
110
|
+
* therefore means the stored part differs and is always reported; treating it
|
|
111
|
+
* as delivered would stitch two different answers together.
|
|
112
|
+
*/
|
|
113
|
+
export declare function sendMessageWithRetryChunked(client: CanonClient, conversationId: string, text: string, options?: SendMessageOptions, retryOptions?: SendMessageRetryOptions, chunkingOptions?: SendMessageChunkingOptions): Promise<ChunkedSendMessageResult>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility-shaped runtime state handle backed exclusively by the shared
|
|
3
|
+
* endpoint. Paths are parsed locally into fixed typed projections; no database
|
|
4
|
+
* path or Firebase credential is sent to the server.
|
|
5
|
+
*/
|
|
6
|
+
import type { CanonClient } from './client.js';
|
|
7
|
+
import type { DeliveryIntent, RuntimeCapabilities, TurnLifecycleState } from './turn-protocol.js';
|
|
8
|
+
import type { CanonControlValue, CanonRuntimeActivityItem, ModelOption, RuntimeControlError, RuntimeControlState, RuntimeInfoPayload } from './types.js';
|
|
9
|
+
export interface SessionStatePayload {
|
|
10
|
+
lastError?: string;
|
|
11
|
+
hostMode?: boolean;
|
|
12
|
+
clientType?: string;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
/** Runtimes that cannot report a context window (e.g. Codex) publish totalTokens only. */
|
|
15
|
+
contextUsage?: {
|
|
16
|
+
percentage?: number;
|
|
17
|
+
totalTokens: number;
|
|
18
|
+
maxTokens?: number;
|
|
19
|
+
};
|
|
20
|
+
updatedAt: {
|
|
21
|
+
'.sv': 'timestamp';
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface TurnStatePayload {
|
|
25
|
+
turnId?: string | null;
|
|
26
|
+
state: TurnLifecycleState;
|
|
27
|
+
queueDepth: number;
|
|
28
|
+
currentSpeakerId?: string | null;
|
|
29
|
+
lastAcceptedIntent?: DeliveryIntent | null;
|
|
30
|
+
activeMessageIds?: string[];
|
|
31
|
+
capabilities?: RuntimeCapabilities;
|
|
32
|
+
openedAt?: number | {
|
|
33
|
+
'.sv': 'timestamp';
|
|
34
|
+
};
|
|
35
|
+
turnUpdatedAt?: number | {
|
|
36
|
+
'.sv': 'timestamp';
|
|
37
|
+
} | null;
|
|
38
|
+
completedAt?: number | {
|
|
39
|
+
'.sv': 'timestamp';
|
|
40
|
+
} | null;
|
|
41
|
+
updatedAt: {
|
|
42
|
+
'.sv': 'timestamp';
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface AgentSessionSnapshotPatch {
|
|
46
|
+
clientType?: string;
|
|
47
|
+
hostMode?: boolean;
|
|
48
|
+
model?: string | null;
|
|
49
|
+
modelOptions?: ModelOption[] | null;
|
|
50
|
+
permissionMode?: string | null;
|
|
51
|
+
permissionModeOptions?: Array<{
|
|
52
|
+
value: string;
|
|
53
|
+
label: string;
|
|
54
|
+
}> | null;
|
|
55
|
+
effort?: string | null;
|
|
56
|
+
runtimeControlValues?: Record<string, CanonControlValue> | null;
|
|
57
|
+
controlState?: Record<string, RuntimeControlState> | null;
|
|
58
|
+
runtimeControlErrors?: Record<string, RuntimeControlError> | null;
|
|
59
|
+
workspaceId?: string | null;
|
|
60
|
+
workspaceOptions?: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
}> | null;
|
|
64
|
+
executionMode?: 'worktree' | 'locked' | null;
|
|
65
|
+
availableExecutionModes?: Array<'worktree' | 'locked'> | null;
|
|
66
|
+
executionBranch?: string | null;
|
|
67
|
+
resolvedCwd?: string | null;
|
|
68
|
+
worktreePath?: string | null;
|
|
69
|
+
executionFallbackReason?: string | null;
|
|
70
|
+
state?: null;
|
|
71
|
+
turnState?: TurnLifecycleState | null;
|
|
72
|
+
turnId?: string | null;
|
|
73
|
+
turnOpenedAt?: number | {
|
|
74
|
+
'.sv': 'timestamp';
|
|
75
|
+
} | null;
|
|
76
|
+
turnUpdatedAt?: number | {
|
|
77
|
+
'.sv': 'timestamp';
|
|
78
|
+
} | null;
|
|
79
|
+
supportsQueue?: boolean | null;
|
|
80
|
+
supportsInputInterrupt?: boolean | null;
|
|
81
|
+
queueDepth?: number;
|
|
82
|
+
waitingForInput?: boolean;
|
|
83
|
+
contextUsage?: {
|
|
84
|
+
percentage?: number;
|
|
85
|
+
totalTokens: number;
|
|
86
|
+
maxTokens?: number;
|
|
87
|
+
} | null;
|
|
88
|
+
lastError?: string | null;
|
|
89
|
+
configurationStatus?: 'ready' | 'configuration_required' | null;
|
|
90
|
+
lastHeartbeatAt?: number | {
|
|
91
|
+
'.sv': 'timestamp';
|
|
92
|
+
};
|
|
93
|
+
updatedAt?: {
|
|
94
|
+
'.sv': 'timestamp';
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Canon stores only operational conversation state. Runtime configuration is
|
|
99
|
+
* owned by the adapter and its local session factory, even when an older host
|
|
100
|
+
* still supplies those fields to this compatibility-shaped API.
|
|
101
|
+
*/
|
|
102
|
+
export declare function sanitizeAgentSessionSnapshotPatch(snapshot: Omit<AgentSessionSnapshotPatch, 'updatedAt'>): Omit<AgentSessionSnapshotPatch, 'updatedAt'>;
|
|
103
|
+
export interface RuntimeInfoPayloadData extends Omit<RuntimeInfoPayload, 'updatedAt'> {
|
|
104
|
+
updatedAt: {
|
|
105
|
+
'.sv': 'timestamp';
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export interface RuntimeActivityPayloadData extends Omit<CanonRuntimeActivityItem, 'updatedAt'> {
|
|
109
|
+
updatedAt: number | {
|
|
110
|
+
'.sv': 'timestamp';
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Retained only for callers upgrading from the old RTDB helper. */
|
|
114
|
+
interface RTDBAuthOptions {
|
|
115
|
+
rtdbUrl?: string;
|
|
116
|
+
firebaseApiKey?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface RTDBClientHandle {
|
|
119
|
+
read(path: string): Promise<unknown>;
|
|
120
|
+
write(path: string, data: unknown): Promise<void>;
|
|
121
|
+
patch(path: string, data: unknown): Promise<void>;
|
|
122
|
+
remove(path: string): Promise<void>;
|
|
123
|
+
writeSessionState(conversationId: string, agentId: string, state: Omit<SessionStatePayload, 'updatedAt'>): Promise<void>;
|
|
124
|
+
clearSessionState(conversationId: string, agentId: string): Promise<void>;
|
|
125
|
+
writeTurnState(conversationId: string, agentId: string, state: Omit<TurnStatePayload, 'updatedAt'>): Promise<void>;
|
|
126
|
+
clearTurnState(conversationId: string, agentId: string): Promise<void>;
|
|
127
|
+
patchAgentSessionSnapshot(conversationId: string, agentId: string, snapshot: Omit<AgentSessionSnapshotPatch, 'updatedAt'>): Promise<void>;
|
|
128
|
+
writeRuntimeInfo(conversationId: string, agentId: string, payload: Omit<RuntimeInfoPayload, 'updatedAt'>): Promise<void>;
|
|
129
|
+
patchRuntimeInfo(conversationId: string, agentId: string, payload: Partial<Omit<RuntimeInfoPayload, 'updatedAt'>>): Promise<void>;
|
|
130
|
+
clearRuntimeInfo(conversationId: string, agentId: string): Promise<void>;
|
|
131
|
+
readRuntimeActivity(conversationId: string, agentId: string): Promise<Record<string, CanonRuntimeActivityItem>>;
|
|
132
|
+
writeRuntimeActivity(conversationId: string, agentId: string, item: CanonRuntimeActivityItem): Promise<void>;
|
|
133
|
+
removeRuntimeActivityItem(conversationId: string, agentId: string, itemId: string): Promise<void>;
|
|
134
|
+
clearRuntimeActivity(conversationId: string, agentId: string): Promise<void>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Existing adapters keep this scoped handle while all runtime traffic uses
|
|
138
|
+
* their CanonClient endpoint. Legacy Firebase options have no effect.
|
|
139
|
+
*/
|
|
140
|
+
export declare function initRTDBAuth(client: CanonClient, _options?: RTDBAuthOptions): RTDBClientHandle;
|
|
141
|
+
export {};
|