@canonmsg/core 0.7.5 → 0.8.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/dist/agent-session.js +8 -0
- package/dist/browser.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/rtdb-rest.d.ts +21 -0
- package/dist/rtdb-rest.js +44 -0
- package/dist/types.d.ts +100 -2
- package/package.json +1 -1
package/dist/agent-session.js
CHANGED
|
@@ -39,6 +39,9 @@ export function buildAgentSessionSnapshot(input) {
|
|
|
39
39
|
?? input.sessionConfig?.permissionMode
|
|
40
40
|
?? input.runtime?.defaultPermissionMode,
|
|
41
41
|
permissionModeOptions: input.runtime?.availablePermissionModes ?? [],
|
|
42
|
+
effort: input.sessionState?.effort ?? input.sessionConfig?.effort,
|
|
43
|
+
runtimeControlValues: input.sessionState?.runtimeControlValues
|
|
44
|
+
?? input.sessionConfig?.runtimeControlValues,
|
|
42
45
|
workspaceId: input.sessionConfig?.workspaceId
|
|
43
46
|
?? input.runtime?.defaultWorkspaceId
|
|
44
47
|
?? workspaceOptions[0]?.id,
|
|
@@ -49,8 +52,13 @@ export function buildAgentSessionSnapshot(input) {
|
|
|
49
52
|
?? input.runtime?.availableExecutionModes
|
|
50
53
|
?? [],
|
|
51
54
|
executionBranch: input.sessionState?.executionBranch,
|
|
55
|
+
resolvedWorkspaceLabel: undefined,
|
|
56
|
+
resolvedCwd: input.sessionState?.cwd,
|
|
57
|
+
worktreePath: input.sessionState?.worktreePath,
|
|
58
|
+
executionFallbackReason: input.sessionState?.executionFallbackReason,
|
|
52
59
|
state: input.sessionState?.state,
|
|
53
60
|
turnState: input.turnState?.state,
|
|
61
|
+
supportsQueue: input.turnState?.capabilities?.supportsQueue,
|
|
54
62
|
queueDepth: input.turnState?.queueDepth ?? 0,
|
|
55
63
|
waitingForInput: input.turnState?.state === 'waiting_input'
|
|
56
64
|
|| input.sessionState?.state === 'requires_action',
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AGENT_CAPABILITIES, CLAUDE_PERMISSION_MODE_OPTIONS, } from './types.js';
|
|
2
2
|
export { resolveCanonBaseUrl } from './base-url.js';
|
|
3
3
|
export { DEFAULT_BASE_URL, DEFAULT_STREAM_URL, DEFAULT_RTDB_URL, FIREBASE_WEB_API_KEY } from './constants.js';
|
|
4
|
-
export type { AgentCapabilities, AgentClientType, AgentSessionSnapshot, AgentSessionWorkSessionSummary, AgentRuntime, CanonContactRequest, CanonContactRequestStatus, ContactApprovedPayload, ContactRequestPayload, CanonStreamEvent, CreateContactRequestResult, MediaAttachment, MediaAttachmentKind, ModelOption, PermissionModeOption, RuntimeUpdatedPayload, ResolvedAdmission, SessionConfig, TurnUpdatedPayload, WorkspaceOption, } from './types.js';
|
|
4
|
+
export type { AgentCapabilities, AgentClientType, AgentSessionSnapshot, AgentSessionWorkSessionSummary, AgentRuntime, CanonControlAvailability, CanonControlDescriptor, CanonControlLiveBehavior, CanonControlSelectionPolicy, CanonControlValue, CanonContactRequest, CanonContactRequestStatus, ContactApprovedPayload, ContactRequestPayload, CanonStreamEvent, CreateContactRequestResult, MediaAttachment, MediaAttachmentKind, ModelOption, PermissionModeOption, CanonRuntimeDescriptor, CanonRuntimeExecutionMetadata, CanonRuntimeInventory, CanonRuntimeInventoryEntry, CanonRuntimeStreamingMode, CanonRuntimeStatusItem, CanonRuntimeSurfaceMode, CanonWorkspaceRootMetadata, RuntimeUpdatedPayload, RuntimeInfoPayload, ResolvedAdmission, SessionConfig, TurnUpdatedPayload, WorkspaceOption, } from './types.js';
|
|
5
5
|
export { EXECUTION_ENVIRONMENT_MODES, isExecutionEnvironmentMode, } from './execution-environment-mode.js';
|
|
6
6
|
export type { ExecutionEnvironmentMode } from './execution-environment-mode.js';
|
|
7
7
|
export type { CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, CreateWorkSessionOptions, SendLinkedMessageOptions, SendLinkedMessageResult, UpdateWorkSessionConversationOptions, WorkSessionPromptRenderOptions, } from './work-session.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AGENT_CAPABILITIES, CLAUDE_PERMISSION_MODE_OPTIONS, } from './types.js';
|
|
2
|
-
export type { AgentCapabilities, AgentClientType, CanonContactRequest, CanonContactRequestStatus, ContactApprovedPayload, ContactRequestPayload, CanonMessage, CanonConversation, CanonMessagesPage, CreateContactRequestResult, AgentContext, CanonStreamEvent, AgentSessionSnapshot, AgentSessionWorkSessionSummary, ResolvedAdmission, MediaAttachment, MediaAttachmentKind, MessageCreatedPayload, TypingPayload, PresencePayload, RuntimeUpdatedPayload, TurnUpdatedPayload, SendMessageOptions, CreateConversationOptions, RegistrationInput, RegistrationResult, RegistrationStatus, StreamingStatus, SetStreamingOptions, SessionControl, SessionState, SessionConfig, AgentRuntime, ModelOption, PermissionModeOption, WorkspaceOption, } from './types.js';
|
|
2
|
+
export type { AgentCapabilities, AgentClientType, CanonControlAvailability, CanonControlDescriptor, CanonControlLiveBehavior, CanonControlSelectionPolicy, CanonControlValue, CanonContactRequest, CanonContactRequestStatus, ContactApprovedPayload, ContactRequestPayload, CanonMessage, CanonConversation, CanonMessagesPage, CreateContactRequestResult, AgentContext, CanonStreamEvent, AgentSessionSnapshot, AgentSessionWorkSessionSummary, ResolvedAdmission, MediaAttachment, MediaAttachmentKind, MessageCreatedPayload, TypingPayload, PresencePayload, RuntimeUpdatedPayload, TurnUpdatedPayload, SendMessageOptions, CreateConversationOptions, RegistrationInput, RegistrationResult, RegistrationStatus, StreamingStatus, SetStreamingOptions, SessionControl, SessionState, SessionConfig, AgentRuntime, CanonRuntimeDescriptor, CanonRuntimeExecutionMetadata, CanonRuntimeInventory, CanonRuntimeInventoryEntry, CanonRuntimeStreamingMode, CanonRuntimeStatusItem, CanonRuntimeSurfaceMode, CanonWorkspaceRootMetadata, ModelOption, PermissionModeOption, RuntimeInfoPayload, WorkspaceOption, } from './types.js';
|
|
3
3
|
export type { CanonResolvedWorkSession, CanonWorkSession, CanonWorkSessionContext, CanonWorkSessionConversationRole, CreateWorkSessionOptions, CanonWorkSessionDisclosureMode, CanonWorkSessionParticipant, CanonWorkSessionStatus, SendLinkedMessageOptions, SendLinkedMessageResult, UpdateWorkSessionConversationOptions, WorkSessionPromptRenderOptions, } from './work-session.js';
|
|
4
4
|
export { buildWorkSessionPromptLines, buildWorkSessionsPromptLines, mergeWorkSessionContexts, } from './work-session.js';
|
|
5
5
|
export { CanonClient, CanonApiError } from './client.js';
|
|
@@ -25,7 +25,7 @@ export { resolveCanonAgent, resolveCanonProfile, getActiveProfile } from './agen
|
|
|
25
25
|
export type { ResolvedAgent } from './agent-resolver.js';
|
|
26
26
|
export { buildConfiguredWorkspaceOptions, buildConversationEnvironmentKey, buildConversationWorktreeSpec, buildPublicWorkspaceOptions, buildWorkspaceOptionId, EXECUTION_ENVIRONMENT_MODES, isEnabledFlag, isExecutionEnvironmentMode, normalizeOptionalString, readSessionWorkspaceConfig, resolveConfiguredWorkspaceCwd, ExecutionEnvironmentError, prepareConversationEnvironment, releaseConversationEnvironment, } from './execution-environment.js';
|
|
27
27
|
export type { ConfiguredWorkspaceOption, ExecutionEnvironmentMode, PreparedExecutionEnvironment, SessionWorkspaceConfig, } from './execution-environment.js';
|
|
28
|
-
export { initRTDBAuth, rtdbWrite, rtdbRead, patchAgentSessionSnapshot, writeSessionState, clearSessionState, writeTurnState, clearTurnState, } from './rtdb-rest.js';
|
|
29
|
-
export type { AgentSessionSnapshotPatch, SessionStatePayload, TurnStatePayload, } from './rtdb-rest.js';
|
|
28
|
+
export { initRTDBAuth, rtdbWrite, rtdbRead, patchAgentSessionSnapshot, patchRuntimeInfo, writeRuntimeInfo, clearRuntimeInfo, writeSessionState, clearSessionState, writeTurnState, clearTurnState, } from './rtdb-rest.js';
|
|
29
|
+
export type { AgentSessionSnapshotPatch, RuntimeInfoPayloadData, SessionStatePayload, TurnStatePayload, } from './rtdb-rest.js';
|
|
30
30
|
export { DEFAULT_BASE_URL, DEFAULT_STREAM_URL, DEFAULT_RTDB_URL, FIREBASE_WEB_API_KEY } from './constants.js';
|
|
31
31
|
export { resolveCanonBaseUrl } from './base-url.js';
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { resolveCanonAgent, resolveCanonProfile, getActiveProfile } from './agen
|
|
|
25
25
|
// Execution environments for host-mode coding sessions
|
|
26
26
|
export { buildConfiguredWorkspaceOptions, buildConversationEnvironmentKey, buildConversationWorktreeSpec, buildPublicWorkspaceOptions, buildWorkspaceOptionId, EXECUTION_ENVIRONMENT_MODES, isEnabledFlag, isExecutionEnvironmentMode, normalizeOptionalString, readSessionWorkspaceConfig, resolveConfiguredWorkspaceCwd, ExecutionEnvironmentError, prepareConversationEnvironment, releaseConversationEnvironment, } from './execution-environment.js';
|
|
27
27
|
// RTDB REST helpers (token exchange, session state, generic read/write)
|
|
28
|
-
export { initRTDBAuth, rtdbWrite, rtdbRead, patchAgentSessionSnapshot, writeSessionState, clearSessionState, writeTurnState, clearTurnState, } from './rtdb-rest.js';
|
|
28
|
+
export { initRTDBAuth, rtdbWrite, rtdbRead, patchAgentSessionSnapshot, patchRuntimeInfo, writeRuntimeInfo, clearRuntimeInfo, writeSessionState, clearSessionState, writeTurnState, clearTurnState, } from './rtdb-rest.js';
|
|
29
29
|
// Constants
|
|
30
30
|
export { DEFAULT_BASE_URL, DEFAULT_STREAM_URL, DEFAULT_RTDB_URL, FIREBASE_WEB_API_KEY } from './constants.js';
|
|
31
31
|
// Base URL resolver
|
package/dist/rtdb-rest.d.ts
CHANGED
|
@@ -7,14 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { CanonClient } from './client.js';
|
|
9
9
|
import type { DeliveryIntent, RuntimeCapabilities, TurnLifecycleState } from './turn-protocol.js';
|
|
10
|
+
import type { CanonControlValue, RuntimeInfoPayload } from './types.js';
|
|
10
11
|
export interface SessionStatePayload {
|
|
11
12
|
lastError?: string;
|
|
12
13
|
model?: string;
|
|
13
14
|
permissionMode?: string;
|
|
14
15
|
effort?: string;
|
|
16
|
+
runtimeControlValues?: Record<string, CanonControlValue>;
|
|
15
17
|
cwd?: string;
|
|
16
18
|
executionMode?: 'worktree' | 'locked';
|
|
17
19
|
executionBranch?: string;
|
|
20
|
+
worktreePath?: string;
|
|
21
|
+
executionFallbackReason?: string;
|
|
18
22
|
hostMode?: boolean;
|
|
19
23
|
clientType?: string;
|
|
20
24
|
isActive: boolean;
|
|
@@ -63,6 +67,8 @@ export interface AgentSessionSnapshotPatch {
|
|
|
63
67
|
value: string;
|
|
64
68
|
label: string;
|
|
65
69
|
}> | null;
|
|
70
|
+
effort?: string | null;
|
|
71
|
+
runtimeControlValues?: Record<string, CanonControlValue> | null;
|
|
66
72
|
workspaceId?: string | null;
|
|
67
73
|
workspaceOptions?: Array<{
|
|
68
74
|
id: string;
|
|
@@ -71,8 +77,12 @@ export interface AgentSessionSnapshotPatch {
|
|
|
71
77
|
executionMode?: 'worktree' | 'locked' | null;
|
|
72
78
|
availableExecutionModes?: Array<'worktree' | 'locked'> | null;
|
|
73
79
|
executionBranch?: string | null;
|
|
80
|
+
resolvedCwd?: string | null;
|
|
81
|
+
worktreePath?: string | null;
|
|
82
|
+
executionFallbackReason?: string | null;
|
|
74
83
|
state?: 'idle' | 'running' | 'requires_action' | null;
|
|
75
84
|
turnState?: TurnLifecycleState | null;
|
|
85
|
+
supportsQueue?: boolean | null;
|
|
76
86
|
queueDepth?: number;
|
|
77
87
|
waitingForInput?: boolean;
|
|
78
88
|
contextUsage?: {
|
|
@@ -95,6 +105,11 @@ export interface AgentSessionSnapshotPatch {
|
|
|
95
105
|
'.sv': 'timestamp';
|
|
96
106
|
};
|
|
97
107
|
}
|
|
108
|
+
export interface RuntimeInfoPayloadData extends Omit<RuntimeInfoPayload, 'updatedAt'> {
|
|
109
|
+
updatedAt: {
|
|
110
|
+
'.sv': 'timestamp';
|
|
111
|
+
};
|
|
112
|
+
}
|
|
98
113
|
interface RTDBAuthOptions {
|
|
99
114
|
rtdbUrl?: string;
|
|
100
115
|
firebaseApiKey?: string;
|
|
@@ -109,6 +124,9 @@ interface RTDBClientHandle {
|
|
|
109
124
|
writeTurnState(conversationId: string, agentId: string, state: Omit<TurnStatePayload, 'updatedAt'>): Promise<void>;
|
|
110
125
|
clearTurnState(conversationId: string, agentId: string): Promise<void>;
|
|
111
126
|
patchAgentSessionSnapshot(conversationId: string, agentId: string, snapshot: Omit<AgentSessionSnapshotPatch, 'updatedAt'>): Promise<void>;
|
|
127
|
+
writeRuntimeInfo(conversationId: string, agentId: string, payload: Omit<RuntimeInfoPayload, 'updatedAt'>): Promise<void>;
|
|
128
|
+
patchRuntimeInfo(conversationId: string, agentId: string, payload: Partial<Omit<RuntimeInfoPayload, 'updatedAt'>>): Promise<void>;
|
|
129
|
+
clearRuntimeInfo(conversationId: string, agentId: string): Promise<void>;
|
|
112
130
|
}
|
|
113
131
|
/**
|
|
114
132
|
* Initializes the default RTDB helper and returns a scoped client for callers
|
|
@@ -131,4 +149,7 @@ export declare function clearSessionState(conversationId: string, agentId: strin
|
|
|
131
149
|
export declare function writeTurnState(conversationId: string, agentId: string, state: Omit<TurnStatePayload, 'updatedAt'>): Promise<void>;
|
|
132
150
|
export declare function clearTurnState(conversationId: string, agentId: string): Promise<void>;
|
|
133
151
|
export declare function patchAgentSessionSnapshot(conversationId: string, agentId: string, snapshot: Omit<AgentSessionSnapshotPatch, 'updatedAt'>): Promise<void>;
|
|
152
|
+
export declare function writeRuntimeInfo(conversationId: string, agentId: string, payload: Omit<RuntimeInfoPayload, 'updatedAt'>): Promise<void>;
|
|
153
|
+
export declare function patchRuntimeInfo(conversationId: string, agentId: string, payload: Partial<Omit<RuntimeInfoPayload, 'updatedAt'>>): Promise<void>;
|
|
154
|
+
export declare function clearRuntimeInfo(conversationId: string, agentId: string): Promise<void>;
|
|
134
155
|
export {};
|
package/dist/rtdb-rest.js
CHANGED
|
@@ -18,6 +18,9 @@ function normalizeRTDBPath(path) {
|
|
|
18
18
|
function buildAgentSessionPath(conversationId, agentId) {
|
|
19
19
|
return `/agent-session/${conversationId}/${agentId}`;
|
|
20
20
|
}
|
|
21
|
+
function buildRuntimeInfoPath(conversationId, agentId) {
|
|
22
|
+
return `/runtime-info/${conversationId}/${agentId}`;
|
|
23
|
+
}
|
|
21
24
|
function createRTDBClientHandle(client, options) {
|
|
22
25
|
const rtdbBase = normalizeRTDBBase(options?.rtdbUrl || DEFAULT_RTDB_BASE);
|
|
23
26
|
const firebaseApiKey = options?.firebaseApiKey || DEFAULT_FIREBASE_API_KEY;
|
|
@@ -137,9 +140,18 @@ function createRTDBClientHandle(client, options) {
|
|
|
137
140
|
...(typeof state.hostMode === 'boolean' ? { hostMode: state.hostMode } : {}),
|
|
138
141
|
...(state.model !== undefined ? { model: state.model } : {}),
|
|
139
142
|
...(state.permissionMode !== undefined ? { permissionMode: state.permissionMode } : {}),
|
|
143
|
+
...(state.effort !== undefined ? { effort: state.effort } : {}),
|
|
144
|
+
...(state.runtimeControlValues !== undefined
|
|
145
|
+
? { runtimeControlValues: state.runtimeControlValues }
|
|
146
|
+
: {}),
|
|
140
147
|
...(state.availableModels !== undefined ? { modelOptions: state.availableModels } : {}),
|
|
148
|
+
...(state.cwd !== undefined ? { resolvedCwd: state.cwd } : {}),
|
|
141
149
|
...(state.executionMode !== undefined ? { executionMode: state.executionMode } : {}),
|
|
142
150
|
...(state.executionBranch !== undefined ? { executionBranch: state.executionBranch } : {}),
|
|
151
|
+
...(state.worktreePath !== undefined ? { worktreePath: state.worktreePath } : {}),
|
|
152
|
+
...(state.executionFallbackReason !== undefined
|
|
153
|
+
? { executionFallbackReason: state.executionFallbackReason }
|
|
154
|
+
: {}),
|
|
143
155
|
...(state.state !== undefined ? { state: state.state } : {}),
|
|
144
156
|
waitingForInput: state.state === 'requires_action',
|
|
145
157
|
...(state.contextUsage !== undefined ? { contextUsage: state.contextUsage } : {}),
|
|
@@ -160,6 +172,8 @@ function createRTDBClientHandle(client, options) {
|
|
|
160
172
|
lastError: null,
|
|
161
173
|
executionBranch: null,
|
|
162
174
|
contextUsage: null,
|
|
175
|
+
worktreePath: null,
|
|
176
|
+
executionFallbackReason: null,
|
|
163
177
|
updatedAt: { '.sv': 'timestamp' },
|
|
164
178
|
});
|
|
165
179
|
}
|
|
@@ -174,6 +188,9 @@ function createRTDBClientHandle(client, options) {
|
|
|
174
188
|
});
|
|
175
189
|
await patch(buildAgentSessionPath(conversationId, agentId), {
|
|
176
190
|
turnState: state.state,
|
|
191
|
+
...(state.capabilities?.supportsQueue !== undefined
|
|
192
|
+
? { supportsQueue: state.capabilities.supportsQueue }
|
|
193
|
+
: {}),
|
|
177
194
|
queueDepth: state.queueDepth,
|
|
178
195
|
waitingForInput: state.state === 'waiting_input',
|
|
179
196
|
lastHeartbeatAt: { '.sv': 'timestamp' },
|
|
@@ -205,6 +222,21 @@ function createRTDBClientHandle(client, options) {
|
|
|
205
222
|
updatedAt: { '.sv': 'timestamp' },
|
|
206
223
|
});
|
|
207
224
|
}
|
|
225
|
+
async function writeRuntimeInfoImpl(conversationId, agentId, payload) {
|
|
226
|
+
await write(buildRuntimeInfoPath(conversationId, agentId), {
|
|
227
|
+
...payload,
|
|
228
|
+
updatedAt: { '.sv': 'timestamp' },
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
async function patchRuntimeInfoImpl(conversationId, agentId, payload) {
|
|
232
|
+
await patch(buildRuntimeInfoPath(conversationId, agentId), {
|
|
233
|
+
...payload,
|
|
234
|
+
updatedAt: { '.sv': 'timestamp' },
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
async function clearRuntimeInfoImpl(conversationId, agentId) {
|
|
238
|
+
await remove(buildRuntimeInfoPath(conversationId, agentId));
|
|
239
|
+
}
|
|
208
240
|
return {
|
|
209
241
|
read,
|
|
210
242
|
write,
|
|
@@ -215,6 +247,9 @@ function createRTDBClientHandle(client, options) {
|
|
|
215
247
|
writeTurnState: writeTurnStateImpl,
|
|
216
248
|
clearTurnState: clearTurnStateImpl,
|
|
217
249
|
patchAgentSessionSnapshot: patchAgentSessionSnapshotImpl,
|
|
250
|
+
writeRuntimeInfo: writeRuntimeInfoImpl,
|
|
251
|
+
patchRuntimeInfo: patchRuntimeInfoImpl,
|
|
252
|
+
clearRuntimeInfo: clearRuntimeInfoImpl,
|
|
218
253
|
};
|
|
219
254
|
}
|
|
220
255
|
/**
|
|
@@ -260,3 +295,12 @@ export async function clearTurnState(conversationId, agentId) {
|
|
|
260
295
|
export async function patchAgentSessionSnapshot(conversationId, agentId, snapshot) {
|
|
261
296
|
await getDefaultRTDBClient()?.patchAgentSessionSnapshot(conversationId, agentId, snapshot);
|
|
262
297
|
}
|
|
298
|
+
export async function writeRuntimeInfo(conversationId, agentId, payload) {
|
|
299
|
+
await getDefaultRTDBClient()?.writeRuntimeInfo(conversationId, agentId, payload);
|
|
300
|
+
}
|
|
301
|
+
export async function patchRuntimeInfo(conversationId, agentId, payload) {
|
|
302
|
+
await getDefaultRTDBClient()?.patchRuntimeInfo(conversationId, agentId, payload);
|
|
303
|
+
}
|
|
304
|
+
export async function clearRuntimeInfo(conversationId, agentId) {
|
|
305
|
+
await getDefaultRTDBClient()?.clearRuntimeInfo(conversationId, agentId);
|
|
306
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -132,11 +132,92 @@ export interface AgentCapabilities {
|
|
|
132
132
|
export interface ModelOption {
|
|
133
133
|
value: string;
|
|
134
134
|
label: string;
|
|
135
|
+
description?: string;
|
|
135
136
|
}
|
|
136
137
|
export interface WorkspaceOption {
|
|
137
138
|
id: string;
|
|
138
139
|
label: string;
|
|
139
140
|
}
|
|
141
|
+
export interface CanonWorkspaceRootMetadata {
|
|
142
|
+
id: string;
|
|
143
|
+
label: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
defaultRelativePath?: string | null;
|
|
146
|
+
}
|
|
147
|
+
export type CanonControlValue = string;
|
|
148
|
+
export type CanonControlAvailability = 'setup' | 'live' | 'setup_and_live';
|
|
149
|
+
export type CanonControlLiveBehavior = 'immediate' | 'next_turn' | 'none';
|
|
150
|
+
export type CanonControlSelectionPolicy = 'inherit' | 'required_explicit';
|
|
151
|
+
export type CanonRuntimeStreamingMode = 'none' | 'status' | 'snapshot' | 'block' | 'delta';
|
|
152
|
+
export type CanonRuntimeSurfaceMode = 'host' | 'channel' | 'limited_channel' | 'operator';
|
|
153
|
+
export type CanonRuntimeInventoryStatus = 'ready' | 'auth_needed' | 'unknown' | 'configured' | 'running' | 'error';
|
|
154
|
+
export type CanonRuntimeStatusTone = 'default' | 'success' | 'warning' | 'danger';
|
|
155
|
+
export interface CanonControlDescriptor {
|
|
156
|
+
id: string;
|
|
157
|
+
label: string;
|
|
158
|
+
options?: ReadonlyArray<ModelOption>;
|
|
159
|
+
defaultValue?: CanonControlValue | null;
|
|
160
|
+
availability: CanonControlAvailability;
|
|
161
|
+
liveBehavior: CanonControlLiveBehavior;
|
|
162
|
+
selectionPolicy: CanonControlSelectionPolicy;
|
|
163
|
+
description?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface CanonRuntimeDescriptor {
|
|
166
|
+
coreControls: ReadonlyArray<CanonControlDescriptor>;
|
|
167
|
+
runtimeControls?: ReadonlyArray<CanonControlDescriptor>;
|
|
168
|
+
/**
|
|
169
|
+
* Optional setup-time local roots advertised by a runtime. These are
|
|
170
|
+
* metadata only for now; existing session config still selects concrete
|
|
171
|
+
* workspace IDs until root-relative directory selection lands.
|
|
172
|
+
*/
|
|
173
|
+
workspaceRoots?: ReadonlyArray<CanonWorkspaceRootMetadata>;
|
|
174
|
+
writableRoots?: ReadonlyArray<CanonWorkspaceRootMetadata>;
|
|
175
|
+
supportsInterrupt?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Fidelity of live text exposed through Canon's streaming bubble path.
|
|
178
|
+
* `delta` means token/content deltas, `block` means chunked live previews,
|
|
179
|
+
* `snapshot` means completed assistant-message snapshots, and `status`
|
|
180
|
+
* means activity/tool state without live assistant text.
|
|
181
|
+
*/
|
|
182
|
+
streamingTextMode?: CanonRuntimeStreamingMode;
|
|
183
|
+
}
|
|
184
|
+
export interface CanonRuntimeExecutionMetadata {
|
|
185
|
+
resolvedWorkspaceLabel?: string | null;
|
|
186
|
+
resolvedCwd?: string | null;
|
|
187
|
+
workspaceRootId?: string | null;
|
|
188
|
+
workspaceRelativePath?: string | null;
|
|
189
|
+
executionMode?: ExecutionEnvironmentMode | null;
|
|
190
|
+
executionBranch?: string | null;
|
|
191
|
+
worktreePath?: string | null;
|
|
192
|
+
fallbackReason?: string | null;
|
|
193
|
+
}
|
|
194
|
+
export interface CanonRuntimeStatusItem {
|
|
195
|
+
id: string;
|
|
196
|
+
label: string;
|
|
197
|
+
value: string;
|
|
198
|
+
tone?: CanonRuntimeStatusTone;
|
|
199
|
+
}
|
|
200
|
+
export interface CanonRuntimeInventoryEntry {
|
|
201
|
+
id: string;
|
|
202
|
+
label: string;
|
|
203
|
+
status?: CanonRuntimeInventoryStatus;
|
|
204
|
+
description?: string;
|
|
205
|
+
}
|
|
206
|
+
export interface CanonRuntimeInventory {
|
|
207
|
+
id: string;
|
|
208
|
+
label: string;
|
|
209
|
+
entries: ReadonlyArray<CanonRuntimeInventoryEntry>;
|
|
210
|
+
}
|
|
211
|
+
export interface RuntimeInfoPayload {
|
|
212
|
+
descriptor: CanonRuntimeDescriptor;
|
|
213
|
+
surfaceMode?: CanonRuntimeSurfaceMode;
|
|
214
|
+
surfaceLabel?: string;
|
|
215
|
+
statusItems?: ReadonlyArray<CanonRuntimeStatusItem>;
|
|
216
|
+
inventories?: ReadonlyArray<CanonRuntimeInventory>;
|
|
217
|
+
execution?: CanonRuntimeExecutionMetadata | null;
|
|
218
|
+
notes?: ReadonlyArray<string>;
|
|
219
|
+
updatedAt?: number;
|
|
220
|
+
}
|
|
140
221
|
/** Capability map keyed by clientType. Add new agent types here. */
|
|
141
222
|
export declare const AGENT_CAPABILITIES: Record<AgentClientType, AgentCapabilities>;
|
|
142
223
|
/** Trusted agent identity & access context, provided by the server */
|
|
@@ -193,6 +274,7 @@ export interface RuntimeUpdatedPayload {
|
|
|
193
274
|
conversationId: string;
|
|
194
275
|
agentId: string;
|
|
195
276
|
runtime: AgentRuntime | null;
|
|
277
|
+
runtimeInfo?: RuntimeInfoPayload | null;
|
|
196
278
|
sessionState: SessionState | null;
|
|
197
279
|
sessionConfig: SessionConfig | null;
|
|
198
280
|
}
|
|
@@ -265,8 +347,9 @@ export interface SetStreamingOptions {
|
|
|
265
347
|
/** Written by Canon app to /control/{convoId}/{agentId}/session in RTDB */
|
|
266
348
|
export interface SessionControl {
|
|
267
349
|
model?: string;
|
|
268
|
-
permissionMode?:
|
|
269
|
-
effort?:
|
|
350
|
+
permissionMode?: string;
|
|
351
|
+
effort?: string;
|
|
352
|
+
runtimeControlValues?: Record<string, CanonControlValue>;
|
|
270
353
|
updatedAt: number;
|
|
271
354
|
updatedBy: string;
|
|
272
355
|
}
|
|
@@ -276,9 +359,12 @@ export interface SessionState {
|
|
|
276
359
|
model?: string;
|
|
277
360
|
permissionMode?: string;
|
|
278
361
|
effort?: string;
|
|
362
|
+
runtimeControlValues?: Record<string, CanonControlValue>;
|
|
279
363
|
cwd?: string;
|
|
280
364
|
executionMode?: 'worktree' | 'locked';
|
|
281
365
|
executionBranch?: string;
|
|
366
|
+
worktreePath?: string;
|
|
367
|
+
executionFallbackReason?: string;
|
|
282
368
|
clientType?: AgentClientType;
|
|
283
369
|
/** True when the agent is running under the host wrapper (host.ts) which can apply control signals */
|
|
284
370
|
hostMode?: boolean;
|
|
@@ -297,6 +383,8 @@ export interface SessionConfig {
|
|
|
297
383
|
hostMode?: boolean;
|
|
298
384
|
model?: string;
|
|
299
385
|
permissionMode?: string;
|
|
386
|
+
effort?: string;
|
|
387
|
+
runtimeControlValues?: Record<string, CanonControlValue>;
|
|
300
388
|
workspaceId?: string;
|
|
301
389
|
/**
|
|
302
390
|
* Explicitly selected execution mode. Sessions created before this field
|
|
@@ -335,6 +423,7 @@ export interface AgentRuntime {
|
|
|
335
423
|
defaultModel?: string;
|
|
336
424
|
defaultPermissionMode?: string;
|
|
337
425
|
availablePermissionModes?: PermissionModeOption[];
|
|
426
|
+
runtimeDescriptor?: CanonRuntimeDescriptor;
|
|
338
427
|
defaultWorkspaceId?: string;
|
|
339
428
|
/**
|
|
340
429
|
* Execution modes the host will accept. The runtime advertises this so the
|
|
@@ -367,13 +456,22 @@ export interface AgentSessionSnapshot {
|
|
|
367
456
|
modelOptions?: ModelOption[];
|
|
368
457
|
permissionMode?: string;
|
|
369
458
|
permissionModeOptions?: PermissionModeOption[];
|
|
459
|
+
effort?: string;
|
|
460
|
+
runtimeControlValues?: Record<string, CanonControlValue>;
|
|
461
|
+
runtimeDescriptor?: CanonRuntimeDescriptor | null;
|
|
462
|
+
runtimeInfo?: RuntimeInfoPayload | null;
|
|
370
463
|
workspaceId?: string;
|
|
371
464
|
workspaceOptions?: WorkspaceOption[];
|
|
372
465
|
executionMode?: ExecutionEnvironmentMode;
|
|
373
466
|
availableExecutionModes?: ExecutionEnvironmentMode[];
|
|
374
467
|
executionBranch?: string;
|
|
468
|
+
resolvedWorkspaceLabel?: string | null;
|
|
469
|
+
resolvedCwd?: string | null;
|
|
470
|
+
worktreePath?: string | null;
|
|
471
|
+
executionFallbackReason?: string | null;
|
|
375
472
|
state?: SessionState['state'];
|
|
376
473
|
turnState?: TurnLifecycleState;
|
|
474
|
+
supportsQueue?: boolean;
|
|
377
475
|
queueDepth: number;
|
|
378
476
|
waitingForInput: boolean;
|
|
379
477
|
contextUsage?: SessionState['contextUsage'];
|