maka-agent 0.2.0-dev.15.20260902 → 0.2.0-dev.16.20260903
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/cli-core.js +0 -1
- package/dist/pi-transcript.js +48 -0
- package/dist/pi-tui-form-interaction.js +497 -0
- package/dist/pi-tui-pickers.js +256 -55
- package/dist/pi-tui-runner.js +215 -12
- package/dist/runtime-host-cli.js +17 -42
- package/dist/runtime-host-lifecycle-transaction.js +31 -13
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -1
- package/dist/runtime-host-onboarding.js +3 -1
- package/dist/runtime-host-openrc-service.js +469 -0
- package/dist/runtime-host-run-command.js +6 -2
- package/dist/runtime-host-service-command.js +3 -3
- package/dist/runtime-host-service-management-command.js +43 -15
- package/dist/runtime-host-session-channel.js +3 -0
- package/dist/runtime-host-session-driver.js +21 -6
- package/dist/runtime-host-setup-command.js +30 -31
- package/dist/tui-context-refresh.js +103 -0
- package/dist/tui-copy-catalog.js +73 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
- package/node_modules/@maka/core/dist/chat-model-choice.js +4 -0
- package/node_modules/@maka/core/dist/computer-use.js +27 -92
- package/node_modules/@maka/core/dist/interaction.js +577 -3
- package/node_modules/@maka/core/dist/llm-connections.js +4 -0
- package/node_modules/@maka/core/dist/local-memory.js +2 -2
- package/node_modules/@maka/core/dist/model-call-usage-projection.js +3 -0
- package/node_modules/@maka/core/dist/model-metadata.js +26 -7
- package/node_modules/@maka/core/dist/model-thinking.js +17 -0
- package/node_modules/@maka/core/dist/provider-registry.js +1 -0
- package/node_modules/@maka/core/dist/runtime-event.js +23 -1
- package/node_modules/@maka/core/dist/scheduled-task.js +4 -0
- package/node_modules/@maka/core/dist/session.js +95 -2
- package/node_modules/@maka/core/dist/text-sanitize.js +19 -0
- package/node_modules/@maka/core/dist/usage-ledger-merge.js +3 -0
- package/node_modules/@maka/core/dist/usage-record-schema.js +11 -5
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +75 -9
- package/node_modules/@maka/core/dist/workhub-session-resolver.js +50 -0
- package/node_modules/@maka/core/package.json +2 -0
- package/node_modules/@maka/eval/dist/harbor-external-subject.js +2 -1
- package/node_modules/@maka/eval/dist/harness-executor.js +3 -2
- package/node_modules/@maka/eval/dist/install-preflight.js +39 -10
- package/node_modules/@maka/eval/dist/process-termination.js +83 -0
- package/node_modules/@maka/mcp/dist/sep-2243.js +3 -3
- package/node_modules/@maka/runtime/dist/agent-run.js +6 -3
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +332 -118
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction-contract.js +6 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +171 -341
- package/node_modules/@maka/runtime/dist/bots/telegram-bridge.js +3 -26
- package/node_modules/@maka/runtime/dist/bundled-skill-catalog.generated.js +1 -1
- package/node_modules/@maka/runtime/dist/computer-use-codec.js +1 -141
- package/node_modules/@maka/runtime/dist/computer-use-tools.js +23 -105
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +20 -26
- package/node_modules/@maka/runtime/dist/context-budget.js +18 -20
- package/node_modules/@maka/runtime/dist/conversation-copy.js +23 -19
- package/node_modules/@maka/runtime/dist/cua-frame-state.js +1 -69
- package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +267 -0
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +6 -9
- package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +67 -23
- package/node_modules/@maka/runtime/dist/history-compact-summary-validation.js +11 -18
- package/node_modules/@maka/runtime/dist/history-compaction.js +66 -73
- package/node_modules/@maka/runtime/dist/interaction-authority.js +69 -0
- package/node_modules/@maka/runtime/dist/mcp-tools.js +13 -1
- package/node_modules/@maka/runtime/dist/memory-extraction.js +11 -11
- package/node_modules/@maka/runtime/dist/model-adapter.js +24 -6
- package/node_modules/@maka/runtime/dist/model-factory.js +14 -5
- package/node_modules/@maka/runtime/dist/oauth-provider-contracts.js +28 -1
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +7 -6
- package/node_modules/@maka/runtime/dist/opencode-session-header.js +29 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +11 -1
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +12 -11
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +51 -13
- package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +3 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +26 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +1 -0
- package/node_modules/@maka/runtime/dist/session-projection-helpers.js +16 -1
- package/node_modules/@maka/runtime/dist/stream-graph-projection.js +6 -0
- package/node_modules/@maka/runtime/dist/stream-graph-read-model.js +5 -0
- package/node_modules/@maka/runtime/dist/stream-usage-fallback-fetch.js +74 -0
- package/node_modules/@maka/runtime/dist/subscription-credentials.js +51 -4
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +47 -3
- package/node_modules/@maka/runtime/dist/system-prompt/main-session-prompt.js +20 -1
- package/node_modules/@maka/runtime/dist/test-connection.js +18 -11
- package/node_modules/@maka/runtime/dist/tool-runtime.js +183 -0
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +14 -0
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +84 -1
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +68 -51
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/owner-connection-code.js +8 -5
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +342 -36
- package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +60 -4
- package/node_modules/@maka/runtime-host/dist/peer-mesh/index.js +3 -3
- package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +1 -1
- package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +48 -60
- package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +847 -431
- package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +33 -74
- package/node_modules/@maka/runtime-host/dist/peer-mesh/store.js +82 -69
- package/node_modules/@maka/runtime-host/dist/peer-reachability/index.js +21 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/model.js +202 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/owner.js +119 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +245 -0
- package/node_modules/@maka/runtime-host/dist/protocol/agent-graph.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +68 -0
- package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +15 -8
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +7 -23
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +47 -1
- package/node_modules/@maka/runtime-host/dist/protocol/oauth.js +25 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/peer-mesh.js +14 -31
- package/node_modules/@maka/runtime-host/dist/protocol/scheduled-task.js +19 -6
- package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +36 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-revision.js +11 -2
- package/node_modules/@maka/runtime-host/dist/protocol/usage-pricing.js +16 -2
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +51 -2
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +35 -2
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +12 -10
- package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +163 -30
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +38 -14
- package/node_modules/@maka/runtime-host/dist/server/daily-review-coordinator.js +45 -22
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +78 -20
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +4 -2
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-service.js +49 -28
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +3 -6
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +130 -27
- package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +30 -1
- package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -4
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +16 -3
- package/node_modules/@maka/runtime-host/dist/server/oauth-coordinator.js +66 -3
- package/node_modules/@maka/runtime-host/dist/server/oauth-execution-authority.js +20 -3
- package/node_modules/@maka/runtime-host/dist/server/peer-listener.js +8 -21
- package/node_modules/@maka/runtime-host/dist/server/peer-mesh-authority.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +6 -3
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +72 -12
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +48 -18
- package/node_modules/@maka/runtime-host/dist/server/session-turn-access-request-coordinator.js +43 -26
- package/node_modules/@maka/runtime-host/dist/server/usage-pricing-coordinator.js +15 -1
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +229 -4
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +146 -8
- package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +32 -6
- package/node_modules/@maka/runtime-host/package.json +1 -0
- package/node_modules/@maka/storage/dist/agent-run-store.js +18 -5
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +14 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +5 -0
- package/node_modules/@maka/storage/dist/interaction-store.js +13 -1
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +9 -3
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +49 -19
- package/node_modules/@maka/storage/dist/runtime-policy/oauth-login-receipt-document.js +3 -1
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +13 -5
- package/node_modules/@maka/storage/dist/session-copy-cleanup.js +4 -2
- package/node_modules/@maka/storage/dist/session-store.js +39 -6
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +16 -9
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +30 -3
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +117 -0
- package/node_modules/@maka/storage/dist/sqlite-usage-store.js +29 -6
- package/node_modules/@maka/storage/dist/usage-stores.js +3 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const OAUTH_PRESENTATION_SERVICE_ID = 'oauth_presentation';
|
|
|
24
24
|
export const OAUTH_PRESENTATION_SERVICE_VERSION = '1';
|
|
25
25
|
export const OAUTH_PRESENTATION_URL_MAX_LENGTH = 8_192;
|
|
26
26
|
export const OAUTH_PRESENTATION_STATE_HINT_MAX_LENGTH = 1_024;
|
|
27
|
-
export const OAUTH_LOGIN_PROVIDERS = ['openai-codex', 'xai-oauth'];
|
|
27
|
+
export const OAUTH_LOGIN_PROVIDERS = ['openai-codex', 'xai-oauth', 'github-copilot'];
|
|
28
28
|
export const OAUTH_LOGIN_PHASES = [
|
|
29
29
|
'awaiting_authorization',
|
|
30
30
|
'exchanging',
|
|
@@ -82,6 +82,13 @@ export const OAUTH_OPERATION_SPECS = {
|
|
|
82
82
|
decodeOutput: decodeOAuthLoginProjection,
|
|
83
83
|
assertOutputForInput: assertOAuthAttemptOutput,
|
|
84
84
|
}),
|
|
85
|
+
'oauth.enrollment.query': defineOperation({
|
|
86
|
+
mode: 'query',
|
|
87
|
+
availability: 'ready',
|
|
88
|
+
errors: COMMON_ERRORS,
|
|
89
|
+
decodeInput: decodeOAuthEnrollmentQueryInput,
|
|
90
|
+
decodeOutput: decodeOAuthEnrollmentProjection,
|
|
91
|
+
}),
|
|
85
92
|
};
|
|
86
93
|
export function decodeOAuthLoginStartInput(value) {
|
|
87
94
|
const input = requireExactRecord(value, 'OAuth login start input', ['attemptId', 'target']);
|
|
@@ -94,6 +101,23 @@ export function decodeOAuthLoginAttemptInput(value) {
|
|
|
94
101
|
const input = requireExactRecord(value, 'OAuth login attempt input', ['attemptId']);
|
|
95
102
|
return { attemptId: requireEntityId(input.attemptId, 'attemptId') };
|
|
96
103
|
}
|
|
104
|
+
export function decodeOAuthEnrollmentQueryInput(value) {
|
|
105
|
+
const input = requireExactRecord(value, 'OAuth enrollment query input', ['provider']);
|
|
106
|
+
return { provider: oauthLoginProvider(input.provider) };
|
|
107
|
+
}
|
|
108
|
+
export function decodeOAuthEnrollmentProjection(value) {
|
|
109
|
+
const projection = requireExactRecord(value, 'OAuth enrollment projection', [
|
|
110
|
+
'provider',
|
|
111
|
+
'enabled',
|
|
112
|
+
]);
|
|
113
|
+
if (typeof projection.enabled !== 'boolean') {
|
|
114
|
+
throw invalidProtocolFrame('Invalid OAuth enrollment projection');
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
provider: oauthLoginProvider(projection.provider),
|
|
118
|
+
enabled: projection.enabled,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
97
121
|
export function decodeOAuthLoginProjection(value) {
|
|
98
122
|
const projection = requireRecord(value, 'OAuth login projection');
|
|
99
123
|
const phase = oauthLoginPhase(projection.phase);
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
import { assertExactKeys, requireCount, requireExactRecord, requireRecord, requireString, } from './codec.js';
|
|
20
20
|
import { defineOperation } from './operation-spec.js';
|
|
21
21
|
import { canonicalPeerMeshDisplayName } from '../peer-mesh/display-name.js';
|
|
22
|
-
import { PEER_MESH_MAX_MEMBERS, PEER_MESH_MAX_MESHES
|
|
22
|
+
import { PEER_MESH_MAX_MEMBERS, PEER_MESH_MAX_MESHES } from '../peer-mesh/limits.js';
|
|
23
|
+
import { decodeSignedPeerReachabilityLease, } from '../peer-reachability/model.js';
|
|
23
24
|
const PEER_ID_MAX_BYTES = 256;
|
|
24
25
|
const MESH_ID_MAX_BYTES = 128;
|
|
25
|
-
const MESH_ADDRESS_MAX_LENGTH = 1024;
|
|
26
26
|
const MUTATION_ERRORS = [
|
|
27
27
|
'invalid_request',
|
|
28
28
|
'operation_unavailable',
|
|
@@ -146,9 +146,7 @@ export function decodePeerMeshInvitation(value) {
|
|
|
146
146
|
'authorityPublicKey',
|
|
147
147
|
'secret',
|
|
148
148
|
'expiresAt',
|
|
149
|
-
'
|
|
150
|
-
'routeHints',
|
|
151
|
-
'coordinationRelays',
|
|
149
|
+
'reachability',
|
|
152
150
|
]);
|
|
153
151
|
if (record.version !== 1)
|
|
154
152
|
throw new Error('Unsupported Peer Mesh invitation version');
|
|
@@ -158,28 +156,9 @@ export function decodePeerMeshInvitation(value) {
|
|
|
158
156
|
authorityPublicKey: requireString(record.authorityPublicKey, 'Peer Mesh authority public key', PEER_ID_MAX_BYTES),
|
|
159
157
|
secret: requireString(record.secret, 'Peer Mesh invitation secret', 64),
|
|
160
158
|
expiresAt: requireCount(record.expiresAt, 'Peer Mesh invitation expiry'),
|
|
161
|
-
|
|
162
|
-
routeHints: requireMeshAddresses(record.routeHints, 'Peer Mesh route hints'),
|
|
163
|
-
coordinationRelays: requireMeshAddresses(record.coordinationRelays, 'Peer Mesh coordination relays'),
|
|
159
|
+
reachability: decodeSignedPeerReachabilityLease(record.reachability),
|
|
164
160
|
};
|
|
165
161
|
}
|
|
166
|
-
function requireMeshToken(value, label) {
|
|
167
|
-
const result = requireString(value, label, PEER_ID_MAX_BYTES);
|
|
168
|
-
if (/\s|[\u0000-\u001f\u007f]/u.test(result))
|
|
169
|
-
throw new Error(`Invalid ${label}`);
|
|
170
|
-
return result;
|
|
171
|
-
}
|
|
172
|
-
function requireMeshAddresses(value, label) {
|
|
173
|
-
if (!Array.isArray(value) || value.length > PEER_MESH_MAX_ROUTE_HINTS) {
|
|
174
|
-
throw new Error(`Invalid ${label}`);
|
|
175
|
-
}
|
|
176
|
-
const addresses = value.map((address) => requireString(address, label, MESH_ADDRESS_MAX_LENGTH));
|
|
177
|
-
if (addresses.some((address) => !address.startsWith('/') || /\s|[\u0000-\u001f\u007f]/u.test(address)) ||
|
|
178
|
-
new Set(addresses).size !== addresses.length) {
|
|
179
|
-
throw new Error(`Invalid ${label}`);
|
|
180
|
-
}
|
|
181
|
-
return Object.freeze(addresses);
|
|
182
|
-
}
|
|
183
162
|
function decodePeerMeshRemoveInput(value) {
|
|
184
163
|
const record = requireExactRecord(value, 'Peer Mesh remove input', ['meshId', 'peerId']);
|
|
185
164
|
return {
|
|
@@ -223,7 +202,9 @@ export function decodePeerMeshQueryResult(value) {
|
|
|
223
202
|
localPeerId: requireString(localPeerId, 'Peer Mesh localPeerId', PEER_ID_MAX_BYTES),
|
|
224
203
|
...(record.localDisplayName === undefined
|
|
225
204
|
? {}
|
|
226
|
-
: {
|
|
205
|
+
: {
|
|
206
|
+
localDisplayName: canonicalPeerMeshDisplayName(record.localDisplayName),
|
|
207
|
+
}),
|
|
227
208
|
transit: decodePeerMeshTransitProjection(record.transit),
|
|
228
209
|
}),
|
|
229
210
|
meshes: Object.freeze(record.meshes.map(decodePeerMeshProjection)),
|
|
@@ -300,10 +281,10 @@ function decodePeerMeshMemberProjection(value) {
|
|
|
300
281
|
...(record.expiresAt === undefined ? [] : ['expiresAt']),
|
|
301
282
|
]);
|
|
302
283
|
if (record.state !== 'local' &&
|
|
303
|
-
record.state !== '
|
|
304
|
-
record.state !== '
|
|
305
|
-
record.state !== '
|
|
306
|
-
record.state !== '
|
|
284
|
+
record.state !== 'connecting' &&
|
|
285
|
+
record.state !== 'reachable' &&
|
|
286
|
+
record.state !== 'reconnecting' &&
|
|
287
|
+
record.state !== 'needs_repair') {
|
|
307
288
|
throw new Error('Invalid Peer Mesh member route state');
|
|
308
289
|
}
|
|
309
290
|
if (record.endpointKind !== undefined &&
|
|
@@ -320,7 +301,9 @@ function decodePeerMeshMemberProjection(value) {
|
|
|
320
301
|
state: record.state,
|
|
321
302
|
...(record.expiresAt === undefined
|
|
322
303
|
? {}
|
|
323
|
-
: {
|
|
304
|
+
: {
|
|
305
|
+
expiresAt: requireCount(record.expiresAt, 'Peer Mesh member route expiry'),
|
|
306
|
+
}),
|
|
324
307
|
};
|
|
325
308
|
}
|
|
326
309
|
export function decodePeerMeshInvitationResult(value) {
|
|
@@ -244,7 +244,7 @@ function decodeCreateInput(value) {
|
|
|
244
244
|
title: boundedText(input.title, 'ScheduledTask title', SCHEDULED_TASK_TITLE_MAX_CHARS, true),
|
|
245
245
|
intentBody: boundedText(input.intentBody, 'ScheduledTask intent body', SCHEDULED_TASK_INTENT_MAX_CHARS),
|
|
246
246
|
schedule: decodeSchedule(input.schedule),
|
|
247
|
-
effect: decodeEffect(input.effect),
|
|
247
|
+
effect: decodeEffect(input.effect, { requireConnectionId: true }),
|
|
248
248
|
...(Object.hasOwn(input, 'maxFires')
|
|
249
249
|
? { maxFires: nullablePositiveCount(input.maxFires, 'ScheduledTask maxFires') }
|
|
250
250
|
: {}),
|
|
@@ -269,7 +269,9 @@ function decodeUpdateInput(value) {
|
|
|
269
269
|
}
|
|
270
270
|
: {}),
|
|
271
271
|
...(Object.hasOwn(patch, 'schedule') ? { schedule: decodeSchedule(patch.schedule) } : {}),
|
|
272
|
-
...(Object.hasOwn(patch, 'effect')
|
|
272
|
+
...(Object.hasOwn(patch, 'effect')
|
|
273
|
+
? { effect: decodeEffect(patch.effect, { requireConnectionId: true }) }
|
|
274
|
+
: {}),
|
|
273
275
|
...(Object.hasOwn(patch, 'maxFires')
|
|
274
276
|
? { maxFires: nullablePositiveCount(patch.maxFires, 'ScheduledTask maxFires') }
|
|
275
277
|
: {}),
|
|
@@ -332,7 +334,7 @@ function decodeSchedule(value) {
|
|
|
332
334
|
}
|
|
333
335
|
throw invalidProtocolFrame('Invalid ScheduledTask schedule');
|
|
334
336
|
}
|
|
335
|
-
function decodeEffect(value) {
|
|
337
|
+
function decodeEffect(value, options = {}) {
|
|
336
338
|
const effect = requireRecord(value, 'ScheduledTask effect');
|
|
337
339
|
if (effect.kind === 'notify') {
|
|
338
340
|
if (effect.channel === 'local') {
|
|
@@ -363,7 +365,10 @@ function decodeEffect(value) {
|
|
|
363
365
|
'kind',
|
|
364
366
|
'execution',
|
|
365
367
|
]);
|
|
366
|
-
return {
|
|
368
|
+
return {
|
|
369
|
+
kind: 'agent_run',
|
|
370
|
+
execution: decodeExecution(exact.execution, options.requireConnectionId === true),
|
|
371
|
+
};
|
|
367
372
|
}
|
|
368
373
|
if (effect.kind === 'session_resume') {
|
|
369
374
|
const exact = requireExactRecord(effect, 'ScheduledTask Session resume effect', [
|
|
@@ -377,7 +382,7 @@ function decodeEffect(value) {
|
|
|
377
382
|
}
|
|
378
383
|
throw invalidProtocolFrame('Invalid ScheduledTask effect');
|
|
379
384
|
}
|
|
380
|
-
function decodeExecution(value) {
|
|
385
|
+
function decodeExecution(value, requireConnectionId = false) {
|
|
381
386
|
// `backend` left the template (#3306), but templates frozen by older builds
|
|
382
387
|
// still carry it and this is a closed shape: the key must stay tolerated on
|
|
383
388
|
// the way in, and it never lands on the decoded value.
|
|
@@ -388,7 +393,10 @@ function decodeExecution(value) {
|
|
|
388
393
|
'permissionMode',
|
|
389
394
|
'collaborationMode',
|
|
390
395
|
'orchestrationMode',
|
|
391
|
-
], ['projectId', 'thinkingLevel', 'backend']);
|
|
396
|
+
], ['projectId', 'thinkingLevel', 'backend', 'llmConnectionId']);
|
|
397
|
+
if (requireConnectionId && !Object.hasOwn(execution, 'llmConnectionId')) {
|
|
398
|
+
throw invalidProtocolFrame('ScheduledTask execution requires Connection id');
|
|
399
|
+
}
|
|
392
400
|
if (!isPermissionMode(execution.permissionMode)) {
|
|
393
401
|
throw invalidProtocolFrame('Invalid ScheduledTask permission mode');
|
|
394
402
|
}
|
|
@@ -411,6 +419,11 @@ function decodeExecution(value) {
|
|
|
411
419
|
...(Object.hasOwn(execution, 'projectId')
|
|
412
420
|
? { projectId: execution.projectId }
|
|
413
421
|
: {}),
|
|
422
|
+
...(Object.hasOwn(execution, 'llmConnectionId')
|
|
423
|
+
? {
|
|
424
|
+
llmConnectionId: requireEntityId(execution.llmConnectionId, 'ScheduledTask Connection id'),
|
|
425
|
+
}
|
|
426
|
+
: {}),
|
|
414
427
|
llmConnectionSlug: boundedText(execution.llmConnectionSlug, 'ScheduledTask connection slug', 256, true),
|
|
415
428
|
model: boundedText(execution.model, 'ScheduledTask model', 512, true),
|
|
416
429
|
...(Object.hasOwn(execution, 'thinkingLevel')
|
|
@@ -82,6 +82,13 @@ export const SESSION_COLLABORATION_OPERATION_SPECS = {
|
|
|
82
82
|
decodeInput: decodeCollaborationTurnRequestAcknowledgeInput,
|
|
83
83
|
decodeOutput: decodeCollaborationTurnRequestAcknowledgeResult,
|
|
84
84
|
}),
|
|
85
|
+
'collaboration.turn-request.withdraw': defineOperation({
|
|
86
|
+
mode: 'command',
|
|
87
|
+
availability: 'ready',
|
|
88
|
+
errors: COLLABORATION_ERRORS,
|
|
89
|
+
decodeInput: decodeCollaborationTurnRequestWithdrawInput,
|
|
90
|
+
decodeOutput: decodeCollaborationTurnRequestWithdrawResult,
|
|
91
|
+
}),
|
|
85
92
|
'collaboration.turn-request.decide': defineOperation({
|
|
86
93
|
mode: 'command',
|
|
87
94
|
availability: 'ready',
|
|
@@ -248,6 +255,21 @@ function decodeCollaborationTurnRequestAcknowledgeResult(value) {
|
|
|
248
255
|
}
|
|
249
256
|
return { acknowledged: record.acknowledged };
|
|
250
257
|
}
|
|
258
|
+
function decodeCollaborationTurnRequestWithdrawInput(value) {
|
|
259
|
+
const record = requireExactRecord(value, 'collaboration Turn request withdrawal input', [
|
|
260
|
+
'requestId',
|
|
261
|
+
]);
|
|
262
|
+
return { requestId: requireId(record.requestId, 'requestId') };
|
|
263
|
+
}
|
|
264
|
+
function decodeCollaborationTurnRequestWithdrawResult(value) {
|
|
265
|
+
const record = requireExactRecord(value, 'collaboration Turn request withdrawal result', [
|
|
266
|
+
'withdrawn',
|
|
267
|
+
]);
|
|
268
|
+
if (typeof record.withdrawn !== 'boolean') {
|
|
269
|
+
throw invalidProtocolFrame('Invalid collaboration Turn request withdrawal result');
|
|
270
|
+
}
|
|
271
|
+
return { withdrawn: record.withdrawn };
|
|
272
|
+
}
|
|
251
273
|
function decodeCollaborationTurnRequestDecideInput(value) {
|
|
252
274
|
const record = requireExactRecord(value, 'collaboration Turn request decision', [
|
|
253
275
|
'requestId',
|
|
@@ -292,7 +314,20 @@ export function decodeSessionTurnAccessRequest(value) {
|
|
|
292
314
|
};
|
|
293
315
|
}
|
|
294
316
|
function decodeSessionTurnRequestIntent(value) {
|
|
295
|
-
const
|
|
317
|
+
const candidate = requireRecord(value, 'Session Turn request intent');
|
|
318
|
+
if (!Object.hasOwn(candidate, 'content')) {
|
|
319
|
+
const record = requireExactRecord(value, 'Session Turn regenerate request intent', [
|
|
320
|
+
'sessionId',
|
|
321
|
+
'turnId',
|
|
322
|
+
'sourceTurnId',
|
|
323
|
+
]);
|
|
324
|
+
return {
|
|
325
|
+
sessionId: requireEntityId(record.sessionId, 'sessionId'),
|
|
326
|
+
turnId: requireEntityId(record.turnId, 'turnId'),
|
|
327
|
+
sourceTurnId: requireEntityId(record.sourceTurnId, 'sourceTurnId'),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const record = requireExactRecord(value, 'Session Turn start request intent', [
|
|
296
331
|
'sessionId',
|
|
297
332
|
'turnId',
|
|
298
333
|
'content',
|
|
@@ -67,6 +67,9 @@ function decodeSessionRevisionCopyInput(value) {
|
|
|
67
67
|
if (input.intent !== undefined) {
|
|
68
68
|
throw invalidProtocolFrame('Session revision copy does not support an intent');
|
|
69
69
|
}
|
|
70
|
+
// A revision never carries an intent, so the shared decoder above already
|
|
71
|
+
// rejected a missing `sourceTurnId` (an empty copy requires the
|
|
72
|
+
// side_conversation intent); reaching here guarantees a turn boundary.
|
|
70
73
|
return input;
|
|
71
74
|
}
|
|
72
75
|
function decodeSessionRevisionAbandonInput(value) {
|
|
@@ -87,7 +90,7 @@ function decodeSessionRevisionAbandonResult(value) {
|
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
92
|
export function decodeSessionConversationCopyInput(value) {
|
|
90
|
-
const input = requireShapedRecord(value, 'Session conversation-copy input', ['sourceSessionId', 'targetSessionId', '
|
|
93
|
+
const input = requireShapedRecord(value, 'Session conversation-copy input', ['sourceSessionId', 'targetSessionId', 'expectedSourceRevision'], ['sourceTurnId', 'intent']);
|
|
91
94
|
const sourceSessionId = requireEntityId(input.sourceSessionId, 'sourceSessionId');
|
|
92
95
|
const targetSessionId = requireEntityId(input.targetSessionId, 'targetSessionId');
|
|
93
96
|
if (sourceSessionId === targetSessionId) {
|
|
@@ -96,10 +99,16 @@ export function decodeSessionConversationCopyInput(value) {
|
|
|
96
99
|
if (input.intent !== undefined && input.intent !== 'side_conversation') {
|
|
97
100
|
throw invalidProtocolFrame('Invalid Session conversation-copy intent');
|
|
98
101
|
}
|
|
102
|
+
const sourceTurnId = input.sourceTurnId === undefined
|
|
103
|
+
? undefined
|
|
104
|
+
: requireEntityId(input.sourceTurnId, 'sourceTurnId');
|
|
105
|
+
if (sourceTurnId === undefined && input.intent !== 'side_conversation') {
|
|
106
|
+
throw invalidProtocolFrame('An empty conversation copy requires the side_conversation intent');
|
|
107
|
+
}
|
|
99
108
|
return {
|
|
100
109
|
sourceSessionId,
|
|
101
110
|
targetSessionId,
|
|
102
|
-
sourceTurnId:
|
|
111
|
+
...(sourceTurnId === undefined ? {} : { sourceTurnId }),
|
|
103
112
|
expectedSourceRevision: positiveRevision(input.expectedSourceRevision, 'expected source Session revision'),
|
|
104
113
|
...(input.intent === 'side_conversation' ? { intent: input.intent } : {}),
|
|
105
114
|
};
|
|
@@ -543,7 +543,8 @@ function decodeUsagePagePosition(result, itemCount) {
|
|
|
543
543
|
return { offset, total, nextOffset };
|
|
544
544
|
}
|
|
545
545
|
function decodeUsageSummary(value) {
|
|
546
|
-
const summary =
|
|
546
|
+
const summary = requireRecord(value, 'usage summary');
|
|
547
|
+
assertOptionalExactKeys(summary, 'usage summary', [
|
|
547
548
|
'range',
|
|
548
549
|
'totalRequests',
|
|
549
550
|
'totalCostUsd',
|
|
@@ -551,7 +552,8 @@ function decodeUsageSummary(value) {
|
|
|
551
552
|
'cacheHitRequests',
|
|
552
553
|
'cacheCreateRequests',
|
|
553
554
|
'errorRequests',
|
|
554
|
-
|
|
555
|
+
'totalDurationMs',
|
|
556
|
+
], ['toolUsage']);
|
|
555
557
|
const range = requireExactRecord(summary.range, 'usage summary range', ['from', 'to']);
|
|
556
558
|
const tokens = requireExactRecord(summary.totalTokens, 'usage summary tokens', [
|
|
557
559
|
'input',
|
|
@@ -581,6 +583,18 @@ function decodeUsageSummary(value) {
|
|
|
581
583
|
cacheHitRequests: requireCount(summary.cacheHitRequests, 'usage cache hit requests'),
|
|
582
584
|
cacheCreateRequests: requireCount(summary.cacheCreateRequests, 'usage cache create requests'),
|
|
583
585
|
errorRequests: requireCount(summary.errorRequests, 'usage error requests'),
|
|
586
|
+
totalDurationMs: requireCount(summary.totalDurationMs, 'usage total duration'),
|
|
587
|
+
// Optional for a data reason, not a version one: tool rows that predate
|
|
588
|
+
// connection attribution cannot answer a `connectionSlug` filter, so the
|
|
589
|
+
// Host omits the split for that query rather than send an unscoped total.
|
|
590
|
+
...(summary.toolUsage !== undefined ? { toolUsage: decodeToolUsage(summary.toolUsage) } : {}),
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function decodeToolUsage(value) {
|
|
594
|
+
const toolUsage = requireExactRecord(value, 'usage tool usage', ['requests', 'durationMs']);
|
|
595
|
+
return {
|
|
596
|
+
requests: requireCount(toolUsage.requests, 'usage tool requests'),
|
|
597
|
+
durationMs: requireCount(toolUsage.durationMs, 'usage tool duration'),
|
|
584
598
|
};
|
|
585
599
|
}
|
|
586
600
|
/**
|
|
@@ -171,6 +171,9 @@ export function decodeWorkHubCoordinationActInput(value) {
|
|
|
171
171
|
}
|
|
172
172
|
if (proposal.disposition === 'replace') {
|
|
173
173
|
const confirmation = decodeWorkHubCoordinationDestructiveConfirmation(input.confirmation);
|
|
174
|
+
if (confirmation.kind !== 'user_correction') {
|
|
175
|
+
throw invalidProtocolFrame('Invalid WorkHub replacement confirmation');
|
|
176
|
+
}
|
|
174
177
|
if (proposal.target.disposition === 'delegate_existing') {
|
|
175
178
|
if (input.candidateSetId === undefined || input.create !== undefined) {
|
|
176
179
|
throw invalidProtocolFrame('Invalid WorkHub replacement context');
|
|
@@ -190,6 +193,15 @@ export function decodeWorkHubCoordinationActInput(value) {
|
|
|
190
193
|
confirmation,
|
|
191
194
|
};
|
|
192
195
|
}
|
|
196
|
+
if (proposal.disposition === 'stop_work') {
|
|
197
|
+
const confirmation = decodeWorkHubCoordinationDestructiveConfirmation(input.confirmation);
|
|
198
|
+
if (confirmation.kind !== 'user_stop' ||
|
|
199
|
+
input.candidateSetId !== undefined ||
|
|
200
|
+
input.create !== undefined) {
|
|
201
|
+
throw invalidProtocolFrame('Invalid WorkHub stop context');
|
|
202
|
+
}
|
|
203
|
+
return { ...base, confirmation };
|
|
204
|
+
}
|
|
193
205
|
if (input.candidateSetId !== undefined ||
|
|
194
206
|
input.create !== undefined ||
|
|
195
207
|
input.confirmation !== undefined) {
|
|
@@ -238,6 +250,30 @@ export function decodeWorkHubCoordinationActResult(value) {
|
|
|
238
250
|
...(exact.steered === true ? { steered: true } : {}),
|
|
239
251
|
};
|
|
240
252
|
}
|
|
253
|
+
if (result.disposition === 'stop_work') {
|
|
254
|
+
const exact = requireShapedRecord(result, 'WorkHub Coordination stop result', ['disposition', 'outcome', 'targetSessionId'], ['targetTurnId']);
|
|
255
|
+
if (exact.outcome !== 'cancelled_pending' &&
|
|
256
|
+
exact.outcome !== 'stop_delivered' &&
|
|
257
|
+
exact.outcome !== 'already_terminal' &&
|
|
258
|
+
exact.outcome !== 'not_owned') {
|
|
259
|
+
throw invalidProtocolFrame('Invalid WorkHub stop outcome');
|
|
260
|
+
}
|
|
261
|
+
if (((exact.outcome === 'stop_delivered' || exact.outcome === 'not_owned') &&
|
|
262
|
+
exact.targetTurnId === undefined) ||
|
|
263
|
+
(exact.outcome === 'cancelled_pending' && exact.targetTurnId !== undefined)) {
|
|
264
|
+
throw invalidProtocolFrame('Invalid WorkHub stop target Turn');
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
disposition: 'stop_work',
|
|
268
|
+
outcome: exact.outcome,
|
|
269
|
+
targetSessionId: requireEntityId(exact.targetSessionId, 'WorkHub target Session id'),
|
|
270
|
+
...(exact.targetTurnId === undefined
|
|
271
|
+
? {}
|
|
272
|
+
: {
|
|
273
|
+
targetTurnId: requireEntityId(exact.targetTurnId, 'WorkHub target Turn id'),
|
|
274
|
+
}),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
241
277
|
throw invalidProtocolFrame('Invalid WorkHub Coordination action disposition');
|
|
242
278
|
}
|
|
243
279
|
function decodeWorkHubCoordinationCandidate(value) {
|
|
@@ -331,8 +367,21 @@ function decodeWorkHubCoordinationProposal(value) {
|
|
|
331
367
|
}
|
|
332
368
|
throw invalidProtocolFrame('Invalid WorkHub replacement target');
|
|
333
369
|
}
|
|
370
|
+
if (proposal.disposition === 'stop_work') {
|
|
371
|
+
const exact = requireExactRecord(proposal, 'WorkHub stop proposal', ['disposition', 'expects']);
|
|
372
|
+
return {
|
|
373
|
+
disposition: 'stop_work',
|
|
374
|
+
expects: decodeWorkHubCoordinationStopPreconditions(exact.expects),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
334
377
|
throw invalidProtocolFrame('Invalid WorkHub Coordination proposal disposition');
|
|
335
378
|
}
|
|
379
|
+
function decodeWorkHubCoordinationStopPreconditions(value) {
|
|
380
|
+
const expects = requireExactRecord(value, 'WorkHub stop preconditions', ['targetSessionId']);
|
|
381
|
+
return {
|
|
382
|
+
targetSessionId: requireEntityId(expects.targetSessionId, 'WorkHub target Session id'),
|
|
383
|
+
};
|
|
384
|
+
}
|
|
336
385
|
function decodeWorkHubCoordinationCreateContext(value) {
|
|
337
386
|
const context = requireExactRecord(value, 'WorkHub creation context', ['workspace']);
|
|
338
387
|
return {
|
|
@@ -341,10 +390,10 @@ function decodeWorkHubCoordinationCreateContext(value) {
|
|
|
341
390
|
}
|
|
342
391
|
function decodeWorkHubCoordinationDestructiveConfirmation(value) {
|
|
343
392
|
const confirmation = requireExactRecord(value, 'WorkHub destructive confirmation', ['kind']);
|
|
344
|
-
if (confirmation.kind !== 'user_correction') {
|
|
393
|
+
if (confirmation.kind !== 'user_correction' && confirmation.kind !== 'user_stop') {
|
|
345
394
|
throw invalidProtocolFrame('Invalid WorkHub destructive confirmation');
|
|
346
395
|
}
|
|
347
|
-
return { kind:
|
|
396
|
+
return { kind: confirmation.kind };
|
|
348
397
|
}
|
|
349
398
|
function candidateSetId(value) {
|
|
350
399
|
const id = requireUtf8String(value, 'WorkHub candidate set id', CANDIDATE_SET_ID_MAX_BYTES);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
|
20
20
|
import { join } from 'node:path';
|
|
21
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
21
22
|
import { runtimeHostAccessCredentialHash } from '../access-credential-identity.js';
|
|
22
23
|
import { encodeCollaborationInvitationCode, } from '../protocol/index.js';
|
|
23
24
|
import { createRuntimeHostConnectionAuthority, } from './connection-authority.js';
|
|
@@ -186,11 +187,21 @@ class FileRuntimeHostAccessAuthority {
|
|
|
186
187
|
request.intent.sessionId === input.intent.sessionId &&
|
|
187
188
|
request.intent.turnId === input.intent.turnId);
|
|
188
189
|
if (existing) {
|
|
189
|
-
if (existing.intent
|
|
190
|
-
throw new RuntimeHostAccessInputError('A Turn access request already uses this Turn identity with different
|
|
190
|
+
if (!isDeepStrictEqual(existing.intent, input.intent)) {
|
|
191
|
+
throw new RuntimeHostAccessInputError('A Turn access request already uses this Turn identity with a different intent');
|
|
191
192
|
}
|
|
192
193
|
return existing;
|
|
193
194
|
}
|
|
195
|
+
if (!('content' in input.intent)) {
|
|
196
|
+
const { sessionId, sourceTurnId } = input.intent;
|
|
197
|
+
const equivalentActive = retainedRequests.find((request) => request.principalId === principalId &&
|
|
198
|
+
isActiveTurnAccessRequest(request) &&
|
|
199
|
+
!('content' in request.intent) &&
|
|
200
|
+
request.intent.sessionId === sessionId &&
|
|
201
|
+
request.intent.sourceTurnId === sourceTurnId);
|
|
202
|
+
if (equivalentActive)
|
|
203
|
+
return equivalentActive;
|
|
204
|
+
}
|
|
194
205
|
if (retainedRequests.filter(isActiveTurnAccessRequest).length >= TURN_ACCESS_REQUEST_ACTIVE_MAX) {
|
|
195
206
|
throw new RuntimeHostAccessInputError('Too many Turn access requests are awaiting an Owner decision or admission');
|
|
196
207
|
}
|
|
@@ -234,6 +245,15 @@ class FileRuntimeHostAccessAuthority {
|
|
|
234
245
|
return { acknowledged: true };
|
|
235
246
|
});
|
|
236
247
|
}
|
|
248
|
+
withdrawTurnAccessRequest(principalId, input) {
|
|
249
|
+
return this.#mutate(async () => {
|
|
250
|
+
const current = this.#file.turnAccessRequests.find((request) => request.requestId === input.requestId && request.principalId === principalId);
|
|
251
|
+
if (!current || current.state.kind !== 'pending')
|
|
252
|
+
return { withdrawn: false };
|
|
253
|
+
await this.#commit(createAccessCredentialFile(this.#file.credentials, this.#file.sessionGrants, this.#file.turnAccessRequests.filter((request) => request !== current)));
|
|
254
|
+
return { withdrawn: true };
|
|
255
|
+
});
|
|
256
|
+
}
|
|
237
257
|
decideTurnAccessRequest(principalId, input) {
|
|
238
258
|
return this.#mutate(async () => {
|
|
239
259
|
const current = this.#file.turnAccessRequests.find((request) => request.requestId === input.requestId);
|
|
@@ -882,6 +902,19 @@ export async function acknowledgeCollaborationTurnRequest(authority, principalId
|
|
|
882
902
|
return accessPersistenceFailure(error, 'Turn access acknowledgement outcome is unknown', 'Turn access request could not be acknowledged');
|
|
883
903
|
}
|
|
884
904
|
}
|
|
905
|
+
export async function withdrawCollaborationTurnRequest(authority, principalId, input) {
|
|
906
|
+
if (!authority)
|
|
907
|
+
return collaborationUnavailable('collaboration.turn-request.withdraw');
|
|
908
|
+
try {
|
|
909
|
+
return {
|
|
910
|
+
ok: true,
|
|
911
|
+
result: await authority.withdrawTurnAccessRequest(principalId, input),
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
catch (error) {
|
|
915
|
+
return accessPersistenceFailure(error, 'Turn access withdrawal outcome is unknown', 'Turn access request could not be withdrawn');
|
|
916
|
+
}
|
|
917
|
+
}
|
|
885
918
|
export async function decideCollaborationTurnRequest(authority, principalId, input) {
|
|
886
919
|
if (!authority)
|
|
887
920
|
return collaborationUnavailable('collaboration.turn-request.decide');
|
|
@@ -56,6 +56,7 @@ export const SESSION_GUEST_OPERATION_GRANTS = Object.freeze([
|
|
|
56
56
|
'collaboration.turn-request.create',
|
|
57
57
|
'collaboration.turn-request.acknowledge',
|
|
58
58
|
'collaboration.turn-request.query',
|
|
59
|
+
'collaboration.turn-request.withdraw',
|
|
59
60
|
'runtime.resource.query',
|
|
60
61
|
'session.shared.query',
|
|
61
62
|
'subscription.open',
|
|
@@ -514,13 +514,16 @@ export class HostClientCapabilityCoordinator {
|
|
|
514
514
|
this.#deleteProviderIfUnused(provider);
|
|
515
515
|
}
|
|
516
516
|
releaseConnection(connectionId) {
|
|
517
|
-
this.#invocations.releaseConnection(connectionId);
|
|
517
|
+
const invocationCleanup = this.#invocations.releaseConnection(connectionId);
|
|
518
518
|
const connection = this.#connections.get(connectionId);
|
|
519
519
|
if (!connection)
|
|
520
|
-
return
|
|
520
|
+
return invocationCleanup;
|
|
521
521
|
let task;
|
|
522
|
-
task =
|
|
523
|
-
|
|
522
|
+
task = Promise.all([
|
|
523
|
+
invocationCleanup,
|
|
524
|
+
this.#activation.runMutation(() => this.#releaseConnectionState(connection)),
|
|
525
|
+
])
|
|
526
|
+
.then(() => undefined)
|
|
524
527
|
.finally(() => this.#pendingConnectionReleases.delete(task));
|
|
525
528
|
this.#pendingConnectionReleases.add(task);
|
|
526
529
|
void task.catch(() => undefined);
|
|
@@ -556,9 +559,8 @@ export class HostClientCapabilityCoordinator {
|
|
|
556
559
|
}
|
|
557
560
|
async close() {
|
|
558
561
|
this.beginDrain();
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
+
const releases = [...this.#connections.keys()].map((connectionId) => this.releaseConnection(connectionId));
|
|
563
|
+
await Promise.allSettled(releases);
|
|
562
564
|
await Promise.allSettled([...this.#pendingConnectionReleases]);
|
|
563
565
|
this.#invocations.close();
|
|
564
566
|
this.#sessions.clear();
|
|
@@ -738,7 +740,7 @@ export class HostClientCapabilityCoordinator {
|
|
|
738
740
|
const target = managedClientCapabilityGrantTarget(selectedBinding.contractId, dynamicBinding.registration, dynamicBinding.tool, evidence);
|
|
739
741
|
if (!target) {
|
|
740
742
|
return {
|
|
741
|
-
execute: ({ emitProgress } = {}) => prepared.admit(emitProgress),
|
|
743
|
+
execute: ({ emitProgress, requestInteraction } = {}) => prepared.admit(emitProgress, requestInteraction),
|
|
742
744
|
cancel: () => prepared.cancel(),
|
|
743
745
|
};
|
|
744
746
|
}
|
|
@@ -760,7 +762,7 @@ export class HostClientCapabilityCoordinator {
|
|
|
760
762
|
}
|
|
761
763
|
}
|
|
762
764
|
return {
|
|
763
|
-
execute: ({ emitProgress } = {}) => prepared.admit(emitProgress),
|
|
765
|
+
execute: ({ emitProgress, requestInteraction } = {}) => prepared.admit(emitProgress, requestInteraction),
|
|
764
766
|
cancel: () => prepared.cancel(),
|
|
765
767
|
};
|
|
766
768
|
}
|
|
@@ -771,7 +773,7 @@ export class HostClientCapabilityCoordinator {
|
|
|
771
773
|
},
|
|
772
774
|
callTool: (binding, args, options) => {
|
|
773
775
|
const { dynamicBinding } = resolveBinding(binding);
|
|
774
|
-
return this.#invocations.invoke(dynamicBinding.registration, dynamicBinding.tool, args, options.context, options.signal, options.timeoutMs ?? DEFAULT_CALL_TIMEOUT_MS, options.emitProgress);
|
|
776
|
+
return this.#invocations.invoke(dynamicBinding.registration, dynamicBinding.tool, args, options.context, options.signal, options.timeoutMs ?? DEFAULT_CALL_TIMEOUT_MS, options.emitProgress, options.requestInteraction);
|
|
775
777
|
},
|
|
776
778
|
};
|
|
777
779
|
}
|