maka-agent 0.2.0-dev.52.20260926 → 0.2.0-dev.53.20260927
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/activation-command.js +11 -3
- package/dist/pi-tui-mcp-status.js +73 -5
- package/dist/pi-tui-runner.js +1 -1
- package/dist/runtime-host-run-command.js +39 -6
- package/dist/runtime-host-run-mcp.js +161 -0
- package/dist/runtime-host-session-driver.js +22 -2
- package/dist/tui-copy-catalog.js +6 -0
- package/dist/tui-mcp-control.js +11 -2
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/attachments.js +7 -0
- package/node_modules/@maka/core/dist/events.js +11 -0
- package/node_modules/@maka/core/dist/provider-registry.js +11 -2
- package/node_modules/@maka/core/dist/turn-origin.js +6 -0
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +1 -5
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +80 -24
- package/node_modules/@maka/runtime/dist/bots/proxied-fetch.js +5 -4
- package/node_modules/@maka/runtime/dist/computer-use-tools.js +136 -100
- package/node_modules/@maka/runtime/dist/context-budget-helpers.js +4 -0
- package/node_modules/@maka/runtime/dist/conversation-copy.js +51 -205
- package/node_modules/@maka/runtime/dist/edit-replace.js +7 -7
- package/node_modules/@maka/runtime/dist/filesystem-executor.js +4 -20
- package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +17 -28
- package/node_modules/@maka/runtime/dist/format-json.js +39 -0
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +1 -6
- package/node_modules/@maka/runtime/dist/image-file.js +22 -14
- package/node_modules/@maka/runtime/dist/model-adapter.js +18 -2
- package/node_modules/@maka/runtime/dist/model-history.js +201 -3
- package/node_modules/@maka/runtime/dist/network/abortable-connector.js +55 -0
- package/node_modules/@maka/runtime/dist/network/proxy-dispatcher.js +72 -37
- package/node_modules/@maka/runtime/dist/network/proxy-test.js +1 -1
- package/node_modules/@maka/runtime/dist/network/scoped-fetch-transport.js +7 -2
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +1 -3
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +36 -8
- package/node_modules/@maka/runtime/dist/recovery-resolver.js +1 -91
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +44 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +54 -58
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +84 -2
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +63 -51
- package/node_modules/@maka/runtime/dist/workspace-executor.js +5 -6
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +27 -6
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +4 -1
- package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +9 -9
- package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +9 -1
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +12 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +28 -6
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +12 -2
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +10 -7
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +10 -2
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/interactive-turn-coordinator.js +4 -1
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -2
- package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +6 -5
- package/node_modules/@maka/runtime-host/dist/server/safe-boundary-resume-policy.js +27 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +5 -3
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +7 -2
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +11 -141
- package/node_modules/@maka/runtime-host/dist/server/session-revision-graph-references.js +46 -75
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +18 -2
- package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +33 -3
- package/node_modules/@maka/runtime-host/dist/transport/framed-byte-stream-transport.js +39 -5
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +7 -1
- package/node_modules/@maka/storage/dist/artifact-store.js +1 -5
- package/node_modules/@maka/storage/dist/artifact-stores.js +0 -3
- package/node_modules/@maka/storage/dist/atomic-file-write.js +1 -0
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +107 -57
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +227 -19
- package/node_modules/@maka/storage/dist/external-session-importer.js +1 -1
- package/node_modules/@maka/storage/dist/mcp-config-store.js +22 -3
- package/node_modules/@maka/storage/dist/settings-store.js +281 -13
- package/package.json +1 -1
|
@@ -25,6 +25,10 @@ import { SESSION_COLLABORATION_OPERATION_SPECS } from '../protocol/session-colla
|
|
|
25
25
|
import { PEER_MESH_OPERATION_SPECS } from '../protocol/peer-mesh.js';
|
|
26
26
|
import { boundedFailureDiagnostic } from './failure-diagnostic.js';
|
|
27
27
|
import { createPeerMeshOperationHandlers } from './peer-mesh-authority.js';
|
|
28
|
+
/** Host-owned operations have no Client Capability initiating connection. */
|
|
29
|
+
export function capabilityInitiatingConnectionId(context) {
|
|
30
|
+
return context.principal === 'runtime_host' ? '' : context.connectionId;
|
|
31
|
+
}
|
|
28
32
|
/**
|
|
29
33
|
* The spec objects a Runtime Host serves from its own core — operations that
|
|
30
34
|
* never route to a domain coordinator. Declared once here so both the type
|
|
@@ -32,6 +32,7 @@ import { RuntimeOwnerCleanupError } from '@maka/runtime/runtime-kernel';
|
|
|
32
32
|
import { parseSkillInvocationTokens, } from '@maka/runtime/skill-invocation';
|
|
33
33
|
import { skillInvocationInlineReferences } from '@maka/runtime/skill-invocation-receipt';
|
|
34
34
|
import { authenticateExecutionStoresWriter, isSessionNotFoundError, normalizeRootTurnAdmissionPayload, } from '@maka/storage/execution-stores';
|
|
35
|
+
import { capabilityInitiatingConnectionId, } from './operation-dispatcher.js';
|
|
35
36
|
import { hostedExecutionRunProfile } from './hosted-execution-tool-profile.js';
|
|
36
37
|
import { runtimeHostExecutionUnavailableReason, runtimeHostExternalTurnUnavailableReason, runtimeHostSafeBoundaryContinuationUnavailableReason, WORKHUB_COORDINATION_EXECUTION_UNAVAILABLE_REASON, } from './host-session-availability.js';
|
|
37
38
|
import { completedHostedExecutionAdmission } from './hosted-execution-authority.js';
|
|
@@ -1425,7 +1426,7 @@ export class RootTurnCoordinator {
|
|
|
1425
1426
|
const isWorkHubV2 = request.execution.kind === 'workhub_coordination' &&
|
|
1426
1427
|
header.toolProfile === 'workhub-coordination-v2';
|
|
1427
1428
|
const workHubBinding = isWorkHubV2
|
|
1428
|
-
? await this.clientCapabilities?.bindSession(request.sessionId, context
|
|
1429
|
+
? await this.clientCapabilities?.bindSession(request.sessionId, capabilityInitiatingConnectionId(context), hostedExecutionRunProfile(header.toolProfile).toolNames.filter((name) => name.startsWith('mcp__')))
|
|
1429
1430
|
: undefined;
|
|
1430
1431
|
const binding = isWorkHubV2
|
|
1431
1432
|
? workHubBinding
|
|
@@ -1434,7 +1435,7 @@ export class RootTurnCoordinator {
|
|
|
1434
1435
|
? undefined
|
|
1435
1436
|
: prepared.commitCapabilityBinding
|
|
1436
1437
|
? await prepared.commitCapabilityBinding()
|
|
1437
|
-
: await this.clientCapabilities?.bindSession(request.sessionId, context
|
|
1438
|
+
: await this.clientCapabilities?.bindSession(request.sessionId, capabilityInitiatingConnectionId(context));
|
|
1438
1439
|
if (binding && !binding.ok) {
|
|
1439
1440
|
return completedStart(operationConflict(binding.message));
|
|
1440
1441
|
}
|
|
@@ -1541,7 +1542,7 @@ export class RootTurnCoordinator {
|
|
|
1541
1542
|
result: parkedTurnResumePlan(input.sessionId, 'session_busy'),
|
|
1542
1543
|
};
|
|
1543
1544
|
}
|
|
1544
|
-
const preview = await this.previewCapabilityBinding(input.sessionId, context
|
|
1545
|
+
const preview = await this.previewCapabilityBinding(input.sessionId, capabilityInitiatingConnectionId(context), () => this.planTurnResume(input));
|
|
1545
1546
|
return preview.ok
|
|
1546
1547
|
? { ok: true, result: preview.value }
|
|
1547
1548
|
: {
|
|
@@ -1620,7 +1621,7 @@ export class RootTurnCoordinator {
|
|
|
1620
1621
|
}
|
|
1621
1622
|
throw new RuntimeMessageAuthorityInvariantError(`Non-terminal continuation Turn ${existing.turnId} became replayable`);
|
|
1622
1623
|
}
|
|
1623
|
-
const preview = await this.previewCapabilityBinding(input.sessionId, context
|
|
1624
|
+
const preview = await this.previewCapabilityBinding(input.sessionId, capabilityInitiatingConnectionId(context), () => this.reconstructAdmittedContinuation(existing));
|
|
1624
1625
|
if (!preview.ok) {
|
|
1625
1626
|
return {
|
|
1626
1627
|
kind: 'complete',
|
|
@@ -1695,7 +1696,7 @@ export class RootTurnCoordinator {
|
|
|
1695
1696
|
outcome: sessionBusy('Root Turn reservation is no longer current'),
|
|
1696
1697
|
};
|
|
1697
1698
|
}
|
|
1698
|
-
const preview = await this.previewCapabilityBinding(input.sessionId, context
|
|
1699
|
+
const preview = await this.previewCapabilityBinding(input.sessionId, capabilityInitiatingConnectionId(context), () => this.manager.planAuthoritativeSafeBoundaryContinuation(input.sessionId, {
|
|
1699
1700
|
sourceRunId: input.sourceRunId,
|
|
1700
1701
|
expectedRuntimeEventHighWater: input.sourceRuntimeEventHighWater,
|
|
1701
1702
|
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveSafeBoundaryResumePolicy(value) {
|
|
20
|
+
if (value === undefined || value === '') {
|
|
21
|
+
return { interactive: true, automated: false };
|
|
22
|
+
}
|
|
23
|
+
if (value === '1' || value === 'true') {
|
|
24
|
+
return { interactive: true, automated: true };
|
|
25
|
+
}
|
|
26
|
+
return { interactive: false, automated: false };
|
|
27
|
+
}
|
|
@@ -303,7 +303,7 @@ export class HostSessionCatalogCoordinator {
|
|
|
303
303
|
ok: true,
|
|
304
304
|
result: {
|
|
305
305
|
session: record
|
|
306
|
-
? projectSharedSessionCatalogRecord(record, projectCatalogLiveRunState(this.#manager.runningTurnIds(record.header.id)))
|
|
306
|
+
? projectSharedSessionCatalogRecord(record, projectCatalogLiveRunState(this.#manager.runningTurnIds(record.header.id), this.#manager.sessionRunEpoch(record.header.id), this.#manager.sessionHostGeneration()))
|
|
307
307
|
: null,
|
|
308
308
|
},
|
|
309
309
|
};
|
|
@@ -316,7 +316,7 @@ export class HostSessionCatalogCoordinator {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
#projectCatalogQueryRecord(record) {
|
|
319
|
-
return projectSessionCatalogRecord(record, projectCatalogLiveRunState(this.#manager.runningTurnIds(record.header.id)));
|
|
319
|
+
return projectSessionCatalogRecord(record, projectCatalogLiveRunState(this.#manager.runningTurnIds(record.header.id), this.#manager.sessionRunEpoch(record.header.id), this.#manager.sessionHostGeneration()));
|
|
320
320
|
}
|
|
321
321
|
async #queryExecutionBoundary(input) {
|
|
322
322
|
try {
|
|
@@ -1195,13 +1195,15 @@ function projectSharedSessionCatalogRecord(record, liveRunState) {
|
|
|
1195
1195
|
};
|
|
1196
1196
|
return decodeSharedSessionCatalogProjection(shared);
|
|
1197
1197
|
}
|
|
1198
|
-
function projectCatalogLiveRunState(runningTurnIds) {
|
|
1198
|
+
function projectCatalogLiveRunState(runningTurnIds, runEpoch, hostGeneration) {
|
|
1199
1199
|
const uniqueRunningTurnIds = [...new Set(runningTurnIds)];
|
|
1200
1200
|
if (uniqueRunningTurnIds.length > SESSION_CATALOG_RUNNING_TURN_MAX_ITEMS)
|
|
1201
1201
|
return undefined;
|
|
1202
1202
|
return {
|
|
1203
1203
|
schemaVersion: SESSION_CATALOG_LIVE_RUN_STATE_SCHEMA_VERSION,
|
|
1204
1204
|
runningTurnIds: uniqueRunningTurnIds,
|
|
1205
|
+
runEpoch,
|
|
1206
|
+
...(hostGeneration === undefined ? {} : { hostGeneration }),
|
|
1205
1207
|
};
|
|
1206
1208
|
}
|
|
1207
1209
|
function projectCatalogLabels(labels) {
|
|
@@ -21,6 +21,7 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
21
21
|
import { projectToolArgsPreview } from '@maka/core/tool-quiet-preview';
|
|
22
22
|
import { resolveReadInput } from '@maka/runtime/read-page';
|
|
23
23
|
import { decodeRuntimeResourceRef, encodeProtocolMessage, RUNTIME_HOST_MAX_MESSAGE_BYTES, SESSION_LIVE_DELTA_MAX_BYTES, SESSION_RUNTIME_RESOURCE_PTY_DATA_MAX_BYTES, SESSION_RUNTIME_RESOURCE_CHANGES_MAX, SESSION_SUBSCRIPTION_FRAME_MAX_BYTES, SUBSCRIPTION_OPEN_RESULT_MAX_BYTES, SESSION_TOOL_ARGS_PREVIEW_MAX_BYTES, SESSION_TOOL_INTENT_MAX_BYTES, SESSION_TOOL_NAME_MAX_BYTES, } from '../protocol/index.js';
|
|
24
|
+
import { boundedFailureDiagnostic } from './failure-diagnostic.js';
|
|
24
25
|
import { createSessionContinuitySnapshot, } from './canonical-session-projection.js';
|
|
25
26
|
import { createSessionTranscriptBootstrap, readSessionTranscriptPage, TranscriptPageRequestError, updateSubscriberTranscriptHighWater, } from './session-transcript-pager.js';
|
|
26
27
|
import { projectSharedSessionMessageContent } from './shared-session-transcript.js';
|
|
@@ -696,8 +697,8 @@ export class SessionContinuityCoordinator {
|
|
|
696
697
|
transcriptBootstrap = created.bootstrap;
|
|
697
698
|
}
|
|
698
699
|
catch (error) {
|
|
699
|
-
//
|
|
700
|
-
|
|
700
|
+
// Record the cause before the publication-failure hook can drain the Host.
|
|
701
|
+
console.error(`[runtime-host] subscription.open transcript bootstrap failed: ${boundedFailureDiagnostic(error)}`);
|
|
701
702
|
this.onPublicationFailure(error);
|
|
702
703
|
return {
|
|
703
704
|
ok: false,
|
|
@@ -838,6 +839,10 @@ export class SessionContinuityCoordinator {
|
|
|
838
839
|
error: { code: 'invalid_request', message: error.message },
|
|
839
840
|
};
|
|
840
841
|
}
|
|
842
|
+
// The client can only retry, but a transcript page that failed for any
|
|
843
|
+
// other reason is a Host-side defect: the generic outcome the caller
|
|
844
|
+
// receives carries none of the cause, so record it here or it is lost.
|
|
845
|
+
console.error(`[runtime-host] session.transcript.page failed: ${boundedFailureDiagnostic(error)}`);
|
|
841
846
|
return {
|
|
842
847
|
ok: false,
|
|
843
848
|
error: { code: 'persistence_failed', message: 'Session transcript is unavailable' },
|
|
@@ -20,14 +20,12 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
20
20
|
import { SIDE_CONVERSATION_SESSION_LABEL } from '@maka/core/side-conversation';
|
|
21
21
|
import { isWorkHubCoordinationSessionId, isWorkHubCoordinationSessionTarget, sessionRevisionFamilyId, } from '@maka/core/session';
|
|
22
22
|
import { runtimeHostConversationCopyUnavailableReason } from './host-session-availability.js';
|
|
23
|
-
import {
|
|
24
|
-
import { isArchivedToolResultPlaceholder } from '@maka/runtime/context-budget';
|
|
25
|
-
import { decodeModelProjectionTransition, MODEL_PROJECTION_TRANSITION_EVENT_TYPE, } from '@maka/core/model-projection-transition';
|
|
23
|
+
import { cloneConversationRuntimeLedger, collectConversationCopyLinkedChildReferences, collectConversationCopySessionContextRefIds, collectConversationCopySessionFileRefs, createConversationCopySlice, prepareConversationRuntimeLedgerCopy, } from '@maka/runtime/conversation-copy';
|
|
26
24
|
import { authenticateInteractiveArtifactStoreWriter, } from '@maka/storage/artifact-stores';
|
|
27
25
|
import { authenticateExecutionStoresWriter, isSessionNotFoundError, } from '@maka/storage/execution-stores';
|
|
28
26
|
import { authenticateInteractiveSessionTodoWriter, } from '@maka/storage/session-todo-authority';
|
|
29
27
|
import { projectSessionCatalogRecord } from './session-catalog-coordinator.js';
|
|
30
|
-
import {
|
|
28
|
+
import { linkedChildCopyAdmissionSessionIds, prepareLinkedChildCopyReferences, } from './session-revision-graph-references.js';
|
|
31
29
|
import { conversationCopyCommitFailureDiagnostic, conversationCopyCommitFailureMessage, } from './session-revision-diagnostics.js';
|
|
32
30
|
import { purgeSessionSidecars } from './session-sidecar-purge.js';
|
|
33
31
|
const CONVERSATION_COPY_ADMISSION_PASSES = 2;
|
|
@@ -258,21 +256,17 @@ export class HostSessionRevisionCoordinator {
|
|
|
258
256
|
return copyFailure('operation_conflict', 'Archived Session revision families cannot create active revisions');
|
|
259
257
|
}
|
|
260
258
|
const copyTurnIds = plan.copyTurnIds;
|
|
261
|
-
const
|
|
262
|
-
if (!archivePreflight.ok)
|
|
263
|
-
return archivePreflight.outcome;
|
|
259
|
+
const runtimeEvents = plan.runs.flatMap((run) => run.runtimeEvents);
|
|
264
260
|
const linkedChildRequests = collectConversationCopyLinkedChildReferences({
|
|
265
261
|
messages: slice.messages,
|
|
266
|
-
runtimeEvents
|
|
267
|
-
archivedResults: archivePreflight.serializedResults,
|
|
262
|
+
runtimeEvents,
|
|
268
263
|
});
|
|
269
264
|
const referencedSessionFileIds = collectConversationCopySessionFileRefs({
|
|
270
265
|
sourceSessionId: input.sourceSessionId,
|
|
271
266
|
messages: slice.messages,
|
|
272
|
-
runtimeEvents
|
|
273
|
-
archivedResults: archivePreflight.serializedResults,
|
|
267
|
+
runtimeEvents,
|
|
274
268
|
});
|
|
275
|
-
const missingGraphChildSessionIds =
|
|
269
|
+
const missingGraphChildSessionIds = linkedChildCopyAdmissionSessionIds({
|
|
276
270
|
sourceSessionId: input.sourceSessionId,
|
|
277
271
|
sessionHeaders,
|
|
278
272
|
copyTurnIds,
|
|
@@ -281,7 +275,7 @@ export class HostSessionRevisionCoordinator {
|
|
|
281
275
|
if (missingGraphChildSessionIds.length > 0) {
|
|
282
276
|
return { kind: 'retry_admission', sessionIds: missingGraphChildSessionIds };
|
|
283
277
|
}
|
|
284
|
-
const linkedReferences = await
|
|
278
|
+
const linkedReferences = await prepareLinkedChildCopyReferences({
|
|
285
279
|
kind,
|
|
286
280
|
sourceSessionId: input.sourceSessionId,
|
|
287
281
|
sourceHeader,
|
|
@@ -297,10 +291,6 @@ export class HostSessionRevisionCoordinator {
|
|
|
297
291
|
if (!linkedReferences.ok) {
|
|
298
292
|
return copyFailure(linkedReferences.code, linkedReferences.message);
|
|
299
293
|
}
|
|
300
|
-
if (kind !== 'side_conversation' &&
|
|
301
|
-
archivePreflight.serializedResults.some((serializedResult) => archivedToolResultContainsConversationOwnedReferences(serializedResult, input.sourceSessionId, linkedReferences.references))) {
|
|
302
|
-
return copyFailure('operation_unavailable', 'Session conversation copy cannot preserve owned references inside archived tool results');
|
|
303
|
-
}
|
|
304
294
|
let createInput;
|
|
305
295
|
try {
|
|
306
296
|
createInput = await this.#createInput(kind, input, requestFingerprint, sourceHeader);
|
|
@@ -335,15 +325,10 @@ export class HostSessionRevisionCoordinator {
|
|
|
335
325
|
copyFailure('commit_outcome_unknown', 'Target Session publication state is unknown'));
|
|
336
326
|
}
|
|
337
327
|
try {
|
|
338
|
-
const archivedSnapshotResults = new Map(archivePreflight.results
|
|
339
|
-
.filter(({ serializedResult }) => archivedToolResultContainsLinkedChildReferences(serializedResult) ||
|
|
340
|
-
archivedToolResultContainsConversationOwnedReferences(serializedResult, input.sourceSessionId, linkedReferences.references))
|
|
341
|
-
.map(({ descriptor, serializedResult }) => [descriptor.artifactId, serializedResult]));
|
|
342
328
|
const sourceContextRefIds = collectConversationCopySessionContextRefIds({
|
|
343
329
|
sourceSessionId: input.sourceSessionId,
|
|
344
330
|
messages: slice.messages,
|
|
345
|
-
runtimeEvents
|
|
346
|
-
archivedResults: archivePreflight.serializedResults,
|
|
331
|
+
runtimeEvents,
|
|
347
332
|
});
|
|
348
333
|
if (sourceContextRefIds.length > 0 && !this.options.contextOffload) {
|
|
349
334
|
throw new Error('Session context copy authority is unavailable');
|
|
@@ -368,12 +353,9 @@ export class HostSessionRevisionCoordinator {
|
|
|
368
353
|
...(referencedSessionFileIds.size > 0
|
|
369
354
|
? { includeArtifactIds: [...referencedSessionFileIds] }
|
|
370
355
|
: {}),
|
|
371
|
-
...(
|
|
372
|
-
? { excludeArtifactIds: [...archivedSnapshotResults.keys()] }
|
|
373
|
-
: {}),
|
|
374
|
-
...(kind === 'side_conversation' && linkedReferences.references.size > 0
|
|
356
|
+
...(linkedReferences.snapshots.size > 0
|
|
375
357
|
? {
|
|
376
|
-
linkedArtifacts: [...linkedReferences.
|
|
358
|
+
linkedArtifacts: [...linkedReferences.snapshots].map(([sessionId, references]) => ({
|
|
377
359
|
sessionId,
|
|
378
360
|
artifactIds: [...references.artifactIds],
|
|
379
361
|
})),
|
|
@@ -381,23 +363,12 @@ export class HostSessionRevisionCoordinator {
|
|
|
381
363
|
: {}),
|
|
382
364
|
});
|
|
383
365
|
const references = {
|
|
384
|
-
mode: 'exact',
|
|
385
366
|
sourceSessionId: input.sourceSessionId,
|
|
386
367
|
targetSessionId: input.targetSessionId,
|
|
387
368
|
artifactIds: artifactCopy.artifactIds,
|
|
388
369
|
relativePaths: artifactCopy.relativePaths,
|
|
389
370
|
contextRefs: new Map(contextCopy.copied.map(({ sourceRefId, targetRefId }) => [sourceRefId, targetRefId])),
|
|
390
|
-
|
|
391
|
-
? {
|
|
392
|
-
mode: 'snapshot',
|
|
393
|
-
archivedResults: archivedSnapshotResults,
|
|
394
|
-
}
|
|
395
|
-
: linkedReferences.references.size > 0
|
|
396
|
-
? {
|
|
397
|
-
mode: 'preserve_validated',
|
|
398
|
-
references: linkedReferences.references,
|
|
399
|
-
}
|
|
400
|
-
: { mode: 'reject' },
|
|
371
|
+
sharedChildren: linkedReferences.shared,
|
|
401
372
|
};
|
|
402
373
|
const runtimeCopy = await cloneConversationRuntimeLedger({
|
|
403
374
|
plan,
|
|
@@ -437,37 +408,6 @@ export class HostSessionRevisionCoordinator {
|
|
|
437
408
|
return this.#rollbackIncompleteCopy(kind, input, requestFingerprint, conversationCopyCommitFailureMessage(error));
|
|
438
409
|
}
|
|
439
410
|
}
|
|
440
|
-
async #readArchivedToolResults(sourceSessionId, sourceEvents, copiedMessages, copyTurnIds, operationalEvents) {
|
|
441
|
-
const archives = collectArchivedToolResultPlaceholders(sourceEvents, copiedMessages, copyTurnIds, operationalEvents);
|
|
442
|
-
if (!archives) {
|
|
443
|
-
return {
|
|
444
|
-
ok: false,
|
|
445
|
-
outcome: copyFailure('persistence_failed', 'Archived tool result metadata is invalid'),
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
const results = [];
|
|
449
|
-
for (const archive of archives) {
|
|
450
|
-
const read = await this.#artifacts
|
|
451
|
-
.readTextInSession(sourceSessionId, archive.artifactId, {
|
|
452
|
-
maxBytes: archive.originalBytes,
|
|
453
|
-
})
|
|
454
|
-
.catch(() => null);
|
|
455
|
-
if (!read?.ok ||
|
|
456
|
-
Buffer.byteLength(read.text, 'utf8') !== archive.originalBytes ||
|
|
457
|
-
createHash('sha256').update(read.text).digest('hex') !== archive.bodySha256) {
|
|
458
|
-
return {
|
|
459
|
-
ok: false,
|
|
460
|
-
outcome: copyFailure('persistence_failed', 'Archived tool result is unavailable or corrupt'),
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
results.push({ descriptor: archive, serializedResult: read.text });
|
|
464
|
-
}
|
|
465
|
-
return {
|
|
466
|
-
ok: true,
|
|
467
|
-
results,
|
|
468
|
-
serializedResults: results.map(({ serializedResult }) => serializedResult),
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
411
|
async #createInput(kind, input, requestFingerprint, source) {
|
|
472
412
|
const derivesFromCoordination = isWorkHubCoordinationSessionTarget(source) && isEmptySideConversation(kind, input);
|
|
473
413
|
const common = {
|
|
@@ -648,76 +588,6 @@ function isEmptySideConversation(kind, input) {
|
|
|
648
588
|
function persistedConversationCopyKind(kind) {
|
|
649
589
|
return kind === 'revision' ? 'revision' : 'branch';
|
|
650
590
|
}
|
|
651
|
-
function collectArchivedToolResultPlaceholders(events, messages, copyTurnIds, operationalEvents) {
|
|
652
|
-
const retainedTurnIds = new Set(copyTurnIds);
|
|
653
|
-
const archives = new Map();
|
|
654
|
-
const add = (value) => {
|
|
655
|
-
if (!isRecord(value) || value.kind !== 'maka.archived_tool_result')
|
|
656
|
-
return true;
|
|
657
|
-
if (!isArchivedToolResultPlaceholder(value))
|
|
658
|
-
return false;
|
|
659
|
-
if (value.rewriteVersion === 2)
|
|
660
|
-
return true;
|
|
661
|
-
addDescriptor(value);
|
|
662
|
-
return true;
|
|
663
|
-
};
|
|
664
|
-
const addDescriptor = (descriptor) => {
|
|
665
|
-
const key = `${descriptor.artifactId}:${descriptor.bodySha256}:${descriptor.originalBytes}`;
|
|
666
|
-
if (!archives.has(key))
|
|
667
|
-
archives.set(key, descriptor);
|
|
668
|
-
};
|
|
669
|
-
for (const event of events) {
|
|
670
|
-
if (retainedTurnIds.has(event.turnId) && event.content?.kind === 'function_response') {
|
|
671
|
-
if (!add(event.content.result))
|
|
672
|
-
return null;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
// A pruned result's body is now named by its durable transition rather than
|
|
676
|
-
// by the RuntimeEvent, so the copy must reach the ledger to find it. Missing
|
|
677
|
-
// this is not a cosmetic gap: the target Session would carry a placeholder
|
|
678
|
-
// pointing at an artifact that was never copied.
|
|
679
|
-
for (const event of operationalEvents) {
|
|
680
|
-
if (event.type !== MODEL_PROJECTION_TRANSITION_EVENT_TYPE)
|
|
681
|
-
continue;
|
|
682
|
-
let transition;
|
|
683
|
-
try {
|
|
684
|
-
transition = decodeModelProjectionTransition(event.data?.transition, event.sessionId);
|
|
685
|
-
}
|
|
686
|
-
catch {
|
|
687
|
-
return null;
|
|
688
|
-
}
|
|
689
|
-
if (transition.replacement.kind !== 'json')
|
|
690
|
-
return null;
|
|
691
|
-
if (!add(transition.replacement.value))
|
|
692
|
-
return null;
|
|
693
|
-
}
|
|
694
|
-
for (const message of messages) {
|
|
695
|
-
if (message.type !== 'tool_result')
|
|
696
|
-
continue;
|
|
697
|
-
if (message.content.kind === 'json') {
|
|
698
|
-
if (!add(message.content.value))
|
|
699
|
-
return null;
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
if (message.content.kind === 'archived_tool_result') {
|
|
703
|
-
if (message.content.rewriteVersion === 2 && message.content.resourceRef)
|
|
704
|
-
continue;
|
|
705
|
-
if (!message.content.artifactId && !message.content.bodySha256)
|
|
706
|
-
continue;
|
|
707
|
-
if (!message.content.artifactId || !message.content.bodySha256)
|
|
708
|
-
return null;
|
|
709
|
-
addDescriptor({
|
|
710
|
-
artifactId: message.content.artifactId,
|
|
711
|
-
bodySha256: message.content.bodySha256,
|
|
712
|
-
originalBytes: message.content.originalBytes,
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
return [...archives.values()];
|
|
717
|
-
}
|
|
718
|
-
function isRecord(value) {
|
|
719
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
720
|
-
}
|
|
721
591
|
function copySuccess(result) {
|
|
722
592
|
return { ok: true, result };
|
|
723
593
|
}
|
|
@@ -19,14 +19,17 @@
|
|
|
19
19
|
import { runtimeInvocationOutcome, } from '@maka/core/runtime-invocation';
|
|
20
20
|
import { sessionRevisionFamilyId } from '@maka/core/session';
|
|
21
21
|
/**
|
|
22
|
-
* Validate
|
|
22
|
+
* Validate the terminal linked child results a conversation copy retains and
|
|
23
|
+
* split them into the children the copy keeps sharing and the ones it copies
|
|
24
|
+
* as snapshots.
|
|
23
25
|
*
|
|
24
|
-
* A
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* A copy may share a child only when the copy's own lifecycle keeps that child
|
|
27
|
+
* alive. Agent Graph children retire with their root's revision family, so a
|
|
28
|
+
* revision shares them. An ordinary subagent is an independent Session that can
|
|
29
|
+
* be removed on its own, and a branch or side conversation has its own
|
|
30
|
+
* lifecycle, so every other retained child is copied as a snapshot.
|
|
28
31
|
*/
|
|
29
|
-
export async function
|
|
32
|
+
export async function prepareLinkedChildCopyReferences(input, dependencies) {
|
|
30
33
|
const requests = input.requests;
|
|
31
34
|
const retainedTurnIds = new Set(input.copyTurnIds);
|
|
32
35
|
const sourceFamilyId = sessionRevisionFamilyId(input.sourceHeader);
|
|
@@ -35,35 +38,25 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
35
38
|
.map((header) => header.id));
|
|
36
39
|
const directChildren = input.sessionHeaders.filter((header) => header.subagentParent?.parentSessionId === input.sourceSessionId &&
|
|
37
40
|
retainedTurnIds.has(header.subagentParent.spawnedBy.parentTurnId));
|
|
38
|
-
if (input.kind === 'branch' && (requests.length > 0 || directChildren.length > 0)) {
|
|
39
|
-
return failure('operation_unavailable', 'Ordinary branches cannot share linked child Session ownership with their source');
|
|
40
|
-
}
|
|
41
|
-
if (input.kind === 'branch') {
|
|
42
|
-
return { ok: true, references: new Map() };
|
|
43
|
-
}
|
|
44
41
|
const requestedChildIds = new Set(requests.map((request) => request.childSessionId));
|
|
45
42
|
const unrepresentedChildren = directChildren.filter((child) => !requestedChildIds.has(child.id));
|
|
46
|
-
if (
|
|
47
|
-
unrepresentedChildren.some((child) => dependencies.isSessionActive(child.id))) {
|
|
43
|
+
if (unrepresentedChildren.some((child) => dependencies.isSessionActive(child.id))) {
|
|
48
44
|
return failure('session_busy', 'A retained linked child is still active');
|
|
49
45
|
}
|
|
50
46
|
const headersById = new Map(input.sessionHeaders.map((header) => [header.id, header]));
|
|
51
47
|
const referencedGraphs = new Map();
|
|
52
|
-
const
|
|
48
|
+
for (const header of [
|
|
49
|
+
...requests.map((request) => headersById.get(request.childSessionId)),
|
|
50
|
+
...directChildren,
|
|
51
|
+
]) {
|
|
53
52
|
const parent = header?.subagentParent;
|
|
54
53
|
if (!parent?.graph)
|
|
55
|
-
|
|
54
|
+
continue;
|
|
56
55
|
const graphIds = referencedGraphs.get(parent.parentSessionId) ?? new Set();
|
|
57
56
|
graphIds.add(parent.graph.graphId);
|
|
58
57
|
referencedGraphs.set(parent.parentSessionId, graphIds);
|
|
59
|
-
};
|
|
60
|
-
for (const request of requests)
|
|
61
|
-
retainGraph(headersById.get(request.childSessionId));
|
|
62
|
-
if (input.kind === 'side_conversation') {
|
|
63
|
-
for (const child of directChildren)
|
|
64
|
-
retainGraph(child);
|
|
65
58
|
}
|
|
66
|
-
|
|
59
|
+
if (input.kind === 'revision') {
|
|
67
60
|
try {
|
|
68
61
|
if ((await dependencies.graph.readSessionState(input.sourceSessionId)) === 'live') {
|
|
69
62
|
return failure('session_busy', 'A retained Agent Graph is not terminal');
|
|
@@ -72,48 +65,28 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
72
65
|
catch {
|
|
73
66
|
return failure('operation_unavailable', 'Retained Agent Graph state is unavailable');
|
|
74
67
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
if (state === 'absent') {
|
|
91
|
-
return failure('operation_unavailable', 'Retained Agent Graph control state is unavailable');
|
|
92
|
-
}
|
|
68
|
+
}
|
|
69
|
+
for (const [rootSessionId, graphIds] of referencedGraphs) {
|
|
70
|
+
for (const graphId of graphIds) {
|
|
71
|
+
let state;
|
|
72
|
+
try {
|
|
73
|
+
state = await dependencies.graph.readGraphState(rootSessionId, graphId);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return failure('operation_unavailable', 'Retained Agent Graph state is unavailable');
|
|
77
|
+
}
|
|
78
|
+
if (state === 'live')
|
|
79
|
+
return failure('session_busy', 'A retained Agent Graph is not terminal');
|
|
80
|
+
if (state === 'absent') {
|
|
81
|
+
return failure('operation_unavailable', 'Retained Agent Graph control state is unavailable');
|
|
93
82
|
}
|
|
94
83
|
}
|
|
95
|
-
return undefined;
|
|
96
|
-
};
|
|
97
|
-
if (input.kind === 'side_conversation') {
|
|
98
|
-
const graphFailure = await retainedExactGraphFailure();
|
|
99
|
-
if (graphFailure)
|
|
100
|
-
return graphFailure;
|
|
101
84
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
return failure('operation_unavailable', input.kind === 'side_conversation'
|
|
105
|
-
? 'Side Conversation requires a terminal result for every retained linked child'
|
|
106
|
-
: 'Session revision requires a terminal result for every retained Agent Graph child');
|
|
107
|
-
}
|
|
108
|
-
if (input.kind === 'revision') {
|
|
109
|
-
const graphFailure = await retainedSessionGraphFailure();
|
|
110
|
-
if (graphFailure)
|
|
111
|
-
return graphFailure;
|
|
112
|
-
const exactGraphFailure = await retainedExactGraphFailure();
|
|
113
|
-
if (exactGraphFailure)
|
|
114
|
-
return exactGraphFailure;
|
|
85
|
+
if (unrepresentedChildren.length > 0) {
|
|
86
|
+
return failure('operation_unavailable', 'Conversation copy requires a terminal result for every retained linked child');
|
|
115
87
|
}
|
|
116
|
-
const
|
|
88
|
+
const shared = new Map();
|
|
89
|
+
const snapshots = new Map();
|
|
117
90
|
const runsByChildSession = new Map();
|
|
118
91
|
for (const request of requests) {
|
|
119
92
|
const childSessionId = request.childSessionId;
|
|
@@ -122,17 +95,14 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
122
95
|
if (!child ||
|
|
123
96
|
!parent ||
|
|
124
97
|
!familySessionIds.has(parent.parentSessionId) ||
|
|
125
|
-
(input.kind === 'revision' && !parent.graph) ||
|
|
126
|
-
(parent.graph !== undefined &&
|
|
127
|
-
!referencedGraphs.get(parent.parentSessionId)?.has(parent.graph.graphId)) ||
|
|
128
98
|
!retainedTurnIds.has(parent.spawnedBy.parentTurnId)) {
|
|
129
|
-
return failure('operation_unavailable', 'Linked child reference does not belong to the
|
|
99
|
+
return failure('operation_unavailable', 'Linked child reference does not belong to the source revision family');
|
|
130
100
|
}
|
|
131
101
|
if (dependencies.isSessionActive(childSessionId)) {
|
|
132
|
-
return failure('session_busy', 'A retained
|
|
102
|
+
return failure('session_busy', 'A retained linked child is still active');
|
|
133
103
|
}
|
|
134
104
|
if (!isTerminalRunStatus(request.status)) {
|
|
135
|
-
return failure('session_busy', 'A retained
|
|
105
|
+
return failure('session_busy', 'A retained linked child result is not terminal');
|
|
136
106
|
}
|
|
137
107
|
let runsById = runsByChildSession.get(childSessionId);
|
|
138
108
|
if (!runsById) {
|
|
@@ -141,28 +111,28 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
141
111
|
runs = await dependencies.runtimeEventStore.listSessionInvocations(childSessionId);
|
|
142
112
|
}
|
|
143
113
|
catch {
|
|
144
|
-
return failure('operation_unavailable', 'Retained
|
|
114
|
+
return failure('operation_unavailable', 'Retained linked child lineage is unavailable');
|
|
145
115
|
}
|
|
146
116
|
if (runs.some((run) => runtimeInvocationOutcome(run) === undefined)) {
|
|
147
|
-
return failure('session_busy', 'A retained
|
|
117
|
+
return failure('session_busy', 'A retained linked child is not terminal');
|
|
148
118
|
}
|
|
149
119
|
runsById = new Map(runs.map((run) => [run.runId, run]));
|
|
150
120
|
runsByChildSession.set(childSessionId, runsById);
|
|
151
121
|
}
|
|
152
122
|
if (!request.runId || !request.turnId) {
|
|
153
|
-
return failure('operation_unavailable', 'Retained
|
|
123
|
+
return failure('operation_unavailable', 'Retained linked child result lacks a Run anchor');
|
|
154
124
|
}
|
|
155
125
|
const currentRun = runsById.get(request.runId);
|
|
156
126
|
if (!currentRun ||
|
|
157
127
|
currentRun.sessionId !== childSessionId ||
|
|
158
128
|
currentRun.turnId !== request.turnId ||
|
|
159
129
|
!linkedResultStatusMatchesRun(request, currentRun)) {
|
|
160
|
-
return failure('operation_unavailable', 'Retained
|
|
130
|
+
return failure('operation_unavailable', 'Retained linked child run reference is unavailable');
|
|
161
131
|
}
|
|
162
132
|
const lineage = traceChildRunLineage(currentRun, runsById, childSessionId);
|
|
163
133
|
if (!lineage ||
|
|
164
134
|
(request.resumedFromRunId !== undefined && !lineage.runIds.has(request.resumedFromRunId))) {
|
|
165
|
-
return failure('operation_unavailable', 'Retained
|
|
135
|
+
return failure('operation_unavailable', 'Retained linked child run reference is unavailable');
|
|
166
136
|
}
|
|
167
137
|
// A child result names every Artifact its turn held, and the ledger that
|
|
168
138
|
// records it can never be rewritten -- so an id in it outlives whatever it
|
|
@@ -179,9 +149,10 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
179
149
|
continue;
|
|
180
150
|
if (artifact.record.sessionId !== childSessionId ||
|
|
181
151
|
!lineage.turnIds.has(artifact.record.turnId)) {
|
|
182
|
-
return failure('operation_unavailable', 'Retained
|
|
152
|
+
return failure('operation_unavailable', 'Retained linked child Artifact is unavailable');
|
|
183
153
|
}
|
|
184
154
|
}
|
|
155
|
+
const references = input.kind === 'revision' && parent.graph ? shared : snapshots;
|
|
185
156
|
const accepted = references.get(childSessionId) ?? {
|
|
186
157
|
runIds: new Set(),
|
|
187
158
|
artifactIds: new Set(),
|
|
@@ -193,9 +164,9 @@ export async function prepareAgentGraphRevisionReferences(input, dependencies) {
|
|
|
193
164
|
accepted.artifactIds.add(artifactId);
|
|
194
165
|
references.set(childSessionId, accepted);
|
|
195
166
|
}
|
|
196
|
-
return { ok: true,
|
|
167
|
+
return { ok: true, shared, snapshots };
|
|
197
168
|
}
|
|
198
|
-
export function
|
|
169
|
+
export function linkedChildCopyAdmissionSessionIds(input) {
|
|
199
170
|
const retainedTurnIds = new Set(input.copyTurnIds);
|
|
200
171
|
const sessionIds = new Set(input.requests.map((request) => request.childSessionId));
|
|
201
172
|
for (const header of input.sessionHeaders) {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { DURABLE_TOOL_RESULT_PROJECTION_MAX_BYTES } from '@maka/core/durable-tool-result-projection';
|
|
20
20
|
import { WORKHUB_COORDINATION_SESSION_ID } from '@maka/core/session';
|
|
21
21
|
import { createRuntimeEventStoredMessageProjector, projectTranscriptToolResult, isHardRuntimeEventReadModelDiagnostic, projectRuntimeEventUserMessage, } from '@maka/runtime/runtime-event-read-model';
|
|
22
|
+
import { RuntimeReadModelError } from '@maka/runtime/runtime-read-model';
|
|
22
23
|
import { foldTurnContribution } from '@maka/storage/session-message-projection';
|
|
23
24
|
const PERMISSION_OUTCOME_READ_CONCURRENCY = 8;
|
|
24
25
|
/** One event can emit content, a permission, usage, and terminal/notice rows. */
|
|
@@ -74,8 +75,23 @@ function createDurableLedgerTranscriptReader(input) {
|
|
|
74
75
|
/** One Turn's rows, each at the sequence its own event sits at. */
|
|
75
76
|
const projectTurn = async (turn) => {
|
|
76
77
|
const projected = await turn.projection.finish(input.canonicalPermissionOutcomes);
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const hardDiagnostics = projected.diagnostics.filter(isHardRuntimeEventReadModelDiagnostic);
|
|
79
|
+
if (hardDiagnostics.length > 0) {
|
|
80
|
+
// Host diagnostics format the Error stack, so keep the failure's location
|
|
81
|
+
// and reasons in its message without serializing raw diagnostic detail.
|
|
82
|
+
throw new RuntimeReadModelError(`Durable RuntimeEvent transcript projection is incomplete: ${JSON.stringify({
|
|
83
|
+
sessionId: turn.invocation.sessionId,
|
|
84
|
+
invocationId: turn.invocation.invocationId,
|
|
85
|
+
runId: turn.invocation.runId,
|
|
86
|
+
turnId: turn.invocation.turnId,
|
|
87
|
+
diagnostics: hardDiagnostics.map(({ code, eventId, runId, turnId, message }) => ({
|
|
88
|
+
code,
|
|
89
|
+
eventId,
|
|
90
|
+
runId,
|
|
91
|
+
turnId,
|
|
92
|
+
message,
|
|
93
|
+
})),
|
|
94
|
+
})}`, hardDiagnostics);
|
|
79
95
|
}
|
|
80
96
|
const admission = turn.invocation.sessionId === WORKHUB_COORDINATION_SESSION_ID
|
|
81
97
|
? await input.stores.agentRunStore.readRootTurnAdmission(turn.invocation.sessionId, turn.invocation.turnId)
|