@sema-agent/client-core 0.94.0 → 0.95.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/CHANGELOG.md +341 -0
- package/README.md +70 -47
- package/dist/adapt/arms.js +5 -6
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.js +2 -2
- package/dist/adapt/wireShapes.js +3 -8
- package/dist/adapter/activeRunSelfHeal.d.ts +8 -3
- package/dist/adapter/activeRunSelfHeal.js +20 -12
- package/dist/adapter/downstream/eventToSdkMessage.js +24 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -3
- package/dist/adapter/runStream.js +2 -1
- package/dist/adapter/types.d.ts +7 -0
- package/dist/adapter/types.js +15 -0
- package/dist/agentSession/backgroundView.js +5 -1
- package/dist/agentSession/engineAgentRegistryRead.js +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +3 -2
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +2 -6
- package/dist/atMostOnce.d.ts +8 -0
- package/dist/atMostOnce.js +36 -0
- package/dist/attachmentSeatCapability.d.ts +0 -1
- package/dist/attachmentSeatCapability.js +0 -3
- package/dist/attachmentsWireCaps.js +11 -6
- package/dist/bashExitReading.d.ts +10 -0
- package/dist/bashExitReading.js +12 -0
- package/dist/callerCwdCapability.d.ts +0 -1
- package/dist/callerCwdCapability.js +2 -7
- package/dist/centerWiringCapability.d.ts +1 -3
- package/dist/centerWiringCapability.js +18 -21
- package/dist/classifierStatus.js +4 -4
- package/dist/cloudConfigWireCaps.js +43 -21
- package/dist/compensations.js +1 -1
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +4 -1
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +41 -13
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +7 -16
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +313 -11
- package/dist/engineAgentAbsence.d.ts +2 -2
- package/dist/engineAgentPanelStore.d.ts +8 -18
- package/dist/engineAgentPanelStore.js +19 -537
- package/dist/engineCapReader.d.ts +6 -6
- package/dist/engineCapReader.js +30 -43
- package/dist/engineCapsCache.d.ts +7 -2
- package/dist/engineCapsCache.js +64 -26
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +14 -3
- package/dist/engineErrorCodes.js +31 -10
- package/dist/engineIdentity.js +2 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +2 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +69 -52
- package/dist/fleet/fleetProjection.d.ts +0 -3
- package/dist/fleet/fleetProjection.js +9 -16
- package/dist/fleetAgentPanelProjection.d.ts +4 -17
- package/dist/fleetAgentPanelProjection.js +7 -197
- package/dist/fleetAgentRowLike.d.ts +16 -0
- package/dist/fleetAgentRowLike.js +1 -0
- package/dist/gateOutcome.js +30 -18
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -0
- package/dist/headlessPermissionModeWire.d.ts +1 -1
- package/dist/headlessPermissionModeWire.js +1 -1
- package/dist/headlessReconnectWire.js +49 -20
- package/dist/hitl/allowRuleShadow.d.ts +1 -1
- package/dist/hitl/allowRuleShadow.js +49 -8
- package/dist/hitl/approvalCompleteParked.d.ts +1 -0
- package/dist/hitl/approvalCompleteParked.js +14 -0
- package/dist/hitl/approvalEndingCause.d.ts +5 -0
- package/dist/hitl/approvalEndingCause.js +61 -0
- package/dist/hitl/approvalHolds.d.ts +12 -2
- package/dist/hitl/approvalHolds.js +53 -2
- package/dist/hitl/approvalsFeed.js +23 -11
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +26 -1
- package/dist/hitl/automaticAnswerVerdict.js +2 -2
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +43 -0
- package/dist/hitl/decisionRefusal.d.ts +4 -0
- package/dist/hitl/decisionRefusal.js +26 -1
- package/dist/hitl/frameRouter.js +26 -43
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +12 -1
- package/dist/hitl/hitlBridge.js +68 -53
- package/dist/hitl/hitlHostSurface.js +3 -11
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +3 -7
- package/dist/hitl/parkResolver.js +50 -26
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +56 -30
- package/dist/hitl/replayedApproval.d.ts +8 -0
- package/dist/hitl/replayedApproval.js +125 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/toolApprovalWire.d.ts +24 -4
- package/dist/hitl/toolApprovalWire.js +115 -38
- package/dist/hooksWireCaps.js +38 -6
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +25 -0
- package/dist/index.d.ts +30 -11
- package/dist/index.js +20 -8
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -0
- package/dist/limitsWire.js +49 -3
- package/dist/liveModelCatalog.d.ts +95 -0
- package/dist/liveModelCatalog.js +297 -32
- package/dist/mcpEngineLeg.d.ts +25 -0
- package/dist/mcpEngineLeg.js +71 -15
- package/dist/mcpPanel.js +2 -1
- package/dist/mcpProbeCapability.d.ts +0 -1
- package/dist/mcpProbeCapability.js +2 -6
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +2 -6
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +2 -6
- package/dist/memoryVerbsWire.d.ts +1 -1
- package/dist/memoryVerbsWire.js +4 -0
- package/dist/model/liveCatalogShape.d.ts +14 -0
- package/dist/model/liveCatalogShape.js +71 -0
- package/dist/model/modelSupplyRules.d.ts +1 -0
- package/dist/model/modelSupplyRules.js +30 -9
- package/dist/model/modelsPolicy.d.ts +21 -0
- package/dist/model/modelsPolicy.js +90 -0
- package/dist/modelIdentityResolvability.d.ts +1 -1
- package/dist/modelIdentityResolvability.js +5 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -1
- package/dist/outputStyleSeatCapability.js +2 -7
- package/dist/ownKey.d.ts +6 -0
- package/dist/ownKey.js +48 -0
- package/dist/panelReduce.d.ts +114 -0
- package/dist/panelReduce.js +1135 -0
- package/dist/panelStateHolder.d.ts +17 -0
- package/dist/panelStateHolder.js +201 -0
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +2 -6
- package/dist/permissionsAllowGrantCapability.d.ts +0 -1
- package/dist/permissionsAllowGrantCapability.js +3 -9
- package/dist/permissionsDeclaration.d.ts +6 -0
- package/dist/permissionsDeclaration.js +45 -0
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +126 -15
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +15 -7
- package/dist/rewindEngineAction.d.ts +21 -0
- package/dist/rewindEngineAction.js +36 -0
- package/dist/rewindWireCaps.d.ts +2 -1
- package/dist/rewindWireCaps.js +1 -0
- package/dist/runTerminal.d.ts +0 -11
- package/dist/runTerminal.js +4 -27
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -1
- package/dist/sealedKeyCapability.js +3 -9
- package/dist/seatContract.d.ts +54 -25
- package/dist/seatContract.js +394 -171
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +11 -0
- package/dist/sessionMemoryErase.d.ts +1 -1
- package/dist/sessionMemoryErase.js +6 -1
- package/dist/sessionMemoryStatus.js +3 -2
- package/dist/sessionPolicyCapability.d.ts +0 -1
- package/dist/sessionPolicyCapability.js +2 -6
- package/dist/sessionReadRedactionCapability.d.ts +0 -1
- package/dist/sessionReadRedactionCapability.js +2 -7
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +2 -6
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +2 -6
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +9 -14
- package/dist/steerPriorityCapability.d.ts +0 -1
- package/dist/steerPriorityCapability.js +3 -9
- package/dist/storePostureCapability.d.ts +1 -1
- package/dist/storePostureCapability.js +16 -16
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/engineCompactWire.js +13 -38
- package/dist/subagent/engineDelegatedPrompt.js +10 -6
- package/dist/subagent/engineSubagentOutput.d.ts +0 -1
- package/dist/subagent/engineSubagentOutput.js +5 -20
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +3 -3
- package/dist/supportFloor.js +2 -5
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolResult.d.ts +5 -0
- package/dist/toolResult.js +88 -36
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +311 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +2 -6
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +42 -2
- package/dist/wireRefusalCopy.js +2 -18
- package/dist/workflowClient.js +7 -11
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +2 -6
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +5 -10
- package/docs/INTEGRATION-CLIENTS.md +1033 -26
- package/package.json +5 -5
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/panelRunningHistory.d.ts +0 -22
- package/dist/panelRunningHistory.js +0 -82
- package/dist/registryConflict.d.ts +0 -3
- package/dist/registryConflict.js +0 -44
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
4
|
+
import { ownDataField } from './ownKey.js';
|
|
4
5
|
export function projectExecutionLaneCapability(caps) {
|
|
5
6
|
try {
|
|
6
7
|
if (caps === null || typeof caps !== 'object')
|
|
7
8
|
return undefined;
|
|
8
9
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
9
10
|
return undefined;
|
|
10
|
-
|
|
11
|
-
return { kind: 'not_reported' };
|
|
12
|
-
const lane = caps.executionLane;
|
|
11
|
+
const lane = ownDataField(caps, 'executionLane');
|
|
13
12
|
if (lane === undefined)
|
|
14
13
|
return { kind: 'not_reported' };
|
|
15
|
-
return projectExecutionLaneObject(lane
|
|
14
|
+
return projectExecutionLaneObject(lane);
|
|
16
15
|
}
|
|
17
16
|
catch {
|
|
18
17
|
return undefined;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
function projectExecutionLaneObject(lane
|
|
20
|
+
function projectExecutionLaneObject(lane) {
|
|
22
21
|
if (lane === null || typeof lane !== 'object' || Array.isArray(lane))
|
|
23
22
|
return undefined;
|
|
24
|
-
const provider = lane
|
|
25
|
-
const toolsOnThisHost = lane
|
|
23
|
+
const provider = ownDataField(lane, 'provider');
|
|
24
|
+
const toolsOnThisHost = ownDataField(lane, 'toolsOnThisHost');
|
|
26
25
|
if (typeof provider !== 'string' || provider === '')
|
|
27
26
|
return undefined;
|
|
28
27
|
if (typeof toolsOnThisHost !== 'boolean')
|
|
@@ -30,26 +29,24 @@ function projectExecutionLaneObject(lane, newGeneration) {
|
|
|
30
29
|
let isolated;
|
|
31
30
|
let isolatedThrew = false;
|
|
32
31
|
try {
|
|
33
|
-
isolated =
|
|
32
|
+
isolated = ownDataField(lane, 'isolated');
|
|
34
33
|
}
|
|
35
34
|
catch {
|
|
36
35
|
isolatedThrew = true;
|
|
37
36
|
}
|
|
38
37
|
if (!isolatedThrew && typeof isolated === 'boolean')
|
|
39
38
|
return { kind: 'present', view: { provider, toolsOnThisHost, isolated } };
|
|
40
|
-
const isolatedAbsent = isolatedThrew || isolated !== undefined ? 'unreadable' :
|
|
39
|
+
const isolatedAbsent = isolatedThrew || isolated !== undefined ? 'unreadable' : toolsOnThisHost ? 'unreadable' : 'no_hands';
|
|
41
40
|
return { kind: 'present', view: { provider, toolsOnThisHost, isolatedAbsent } };
|
|
42
41
|
}
|
|
43
42
|
export function projectExecutionLaneWiring(wiring) {
|
|
44
43
|
try {
|
|
45
44
|
if (wiring === null || typeof wiring !== 'object' || Array.isArray(wiring))
|
|
46
45
|
return undefined;
|
|
47
|
-
|
|
48
|
-
return { kind: 'not_reported' };
|
|
49
|
-
const lane = wiring.executionLane;
|
|
46
|
+
const lane = ownDataField(wiring, 'executionLane');
|
|
50
47
|
if (lane === undefined)
|
|
51
48
|
return { kind: 'not_reported' };
|
|
52
|
-
return projectExecutionLaneObject(lane
|
|
49
|
+
return projectExecutionLaneObject(lane);
|
|
53
50
|
}
|
|
54
51
|
catch {
|
|
55
52
|
return undefined;
|
|
@@ -66,12 +63,13 @@ export function noteEngineCapsForExecutionLane(baseUrl, caps, opts) {
|
|
|
66
63
|
export function observedExecutionLane(baseUrl = engineWireTarget()?.baseUrl) {
|
|
67
64
|
return reader.observed(baseUrl);
|
|
68
65
|
}
|
|
69
|
-
export function toolsRunHereFromExecutionLane(reading
|
|
70
|
-
|
|
71
|
-
return reading.view.toolsOnThisHost;
|
|
72
|
-
|
|
66
|
+
export function toolsRunHereFromExecutionLane(reading) {
|
|
67
|
+
try {
|
|
68
|
+
return reading.kind === 'present' && reading.view.toolsOnThisHost === true;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
73
71
|
return false;
|
|
74
|
-
|
|
72
|
+
}
|
|
75
73
|
}
|
|
76
74
|
export function noOsSandboxOnThisHost(reading) {
|
|
77
75
|
if (typeof reading !== 'object' || reading === null)
|
|
@@ -105,7 +103,7 @@ export function executionLaneDoctorDetail(reading) {
|
|
|
105
103
|
'this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)');
|
|
106
104
|
case 'not_reported':
|
|
107
105
|
return ('execution lane not reported by this engine; ' +
|
|
108
|
-
'this does not say where tools run, so
|
|
106
|
+
'this does not say where tools run, so skill baseDir is not sent until the engine reports it');
|
|
109
107
|
case 'present': {
|
|
110
108
|
const lane = capForDisplay(reading.view.provider, LANE_DETAIL_MAX);
|
|
111
109
|
if (reading.view.toolsOnThisHost) {
|
|
@@ -118,9 +116,6 @@ export function executionLaneDoctorDetail(reading) {
|
|
|
118
116
|
}
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
|
-
export function forgetExecutionLaneReading(baseUrl) {
|
|
122
|
-
reader.forget(baseUrl);
|
|
123
|
-
}
|
|
124
119
|
export function __resetExecutionLaneReadingsForTests() {
|
|
125
120
|
reader.__resetForTests();
|
|
126
121
|
}
|
|
@@ -17,5 +17,4 @@ export declare function fileHistoryDeclarationField(reading: FileHistoryCaptureR
|
|
|
17
17
|
fileHistory: 'disabled';
|
|
18
18
|
} | Record<string, never>;
|
|
19
19
|
export declare function fileHistoryCaptureDoctorDetail(reading: FileHistoryCaptureReading): string;
|
|
20
|
-
export declare function forgetFileHistoryCaptureReading(baseUrl: string | undefined): void;
|
|
21
20
|
export declare function __resetFileHistoryCaptureReadingsForTests(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
3
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
4
|
+
import { ownDataField } from './ownKey.js';
|
|
4
5
|
import { FILE_HISTORY_DISABLED } from './request/taskRequest.js';
|
|
5
6
|
export function projectFileHistoryCaptureCapability(caps) {
|
|
6
7
|
try {
|
|
7
8
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
8
9
|
return undefined;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = caps.fileHistoryCapture;
|
|
10
|
+
const v = ownDataField(caps, 'fileHistoryCapture');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'string' || v.length === 0)
|
|
@@ -84,9 +83,6 @@ export function fileHistoryCaptureDoctorDetail(reading) {
|
|
|
84
83
|
return unobserved;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
export function forgetFileHistoryCaptureReading(baseUrl) {
|
|
88
|
-
reader.forget(baseUrl);
|
|
89
|
-
}
|
|
90
86
|
export function __resetFileHistoryCaptureReadingsForTests() {
|
|
91
87
|
reader.__resetForTests();
|
|
92
88
|
}
|
|
@@ -4,7 +4,7 @@ export type FileHistoryDeclarationFact = 'sent' | 'not_sent' | 'unknown';
|
|
|
4
4
|
export declare const FILE_HISTORY_LEG_VERDICTS: readonly ["not_honored", "honored", "not_declared", "unknown"];
|
|
5
5
|
export type FileHistoryLegNoticeVerdict = (typeof FILE_HISTORY_LEG_VERDICTS)[number];
|
|
6
6
|
export interface FileHistoryLegNoticeInput {
|
|
7
|
-
readonly
|
|
7
|
+
readonly assemblyCapability: FileHistoryCaptureReading;
|
|
8
8
|
readonly declaration: FileHistoryDeclarationFact;
|
|
9
9
|
readonly captureOffByUser: boolean;
|
|
10
10
|
readonly legWord: string | undefined;
|
|
@@ -22,10 +22,11 @@ export type OutboundBodyField = {
|
|
|
22
22
|
};
|
|
23
23
|
export declare function readOutboundBodyField(body: object | null | undefined, key: string): OutboundBodyField;
|
|
24
24
|
export interface FileHistoryDeclarationLedger {
|
|
25
|
-
declared(requestKey: string, fact: FileHistoryDeclarationFact): boolean;
|
|
25
|
+
declared(requestKey: string, fact: FileHistoryDeclarationFact, capabilityAtAssembly?: FileHistoryCaptureReading): boolean;
|
|
26
26
|
boundToRun(requestKey: string, runId: string, event: AgentEvent): boolean;
|
|
27
27
|
declarationOf(runId: string): FileHistoryDeclarationFact;
|
|
28
28
|
declaredLegCwd(requestKey: string, cwd: string | undefined): boolean;
|
|
29
29
|
legCwdOf(runId: string): string | undefined;
|
|
30
|
+
capabilityAtAssemblyOf(runId: string): FileHistoryCaptureReading;
|
|
30
31
|
}
|
|
31
32
|
export declare function createFileHistoryDeclarationLedger(): FileHistoryDeclarationLedger;
|
|
@@ -16,7 +16,7 @@ export function fileHistoryLegNoticeVerdict(input) {
|
|
|
16
16
|
let offByUser;
|
|
17
17
|
let legWord;
|
|
18
18
|
try {
|
|
19
|
-
capability = ownRead(input, '
|
|
19
|
+
capability = ownRead(input, 'assemblyCapability');
|
|
20
20
|
declaration = declarationOfInput(ownRead(input, 'declaration'));
|
|
21
21
|
offByUser = ownRead(input, 'captureOffByUser') === true;
|
|
22
22
|
legWord = ownRead(input, 'legWord');
|
|
@@ -82,10 +82,35 @@ export function readOutboundBodyField(body, key) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
const idOk = (v) => typeof v === 'string' && v.length > 0;
|
|
85
|
+
function canonReading(r) {
|
|
86
|
+
try {
|
|
87
|
+
if (typeof r !== 'object' || r === null)
|
|
88
|
+
return 'unobserved';
|
|
89
|
+
const kind = r.kind;
|
|
90
|
+
if (kind === 'not_reported')
|
|
91
|
+
return 'not_reported';
|
|
92
|
+
if (kind === 'present') {
|
|
93
|
+
const word = r.word;
|
|
94
|
+
return typeof word === 'string' && word.length > 0 ? `present:${word}` : 'unobserved';
|
|
95
|
+
}
|
|
96
|
+
return 'unobserved';
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return 'unobserved';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function readingOfCanon(c) {
|
|
103
|
+
if (c === 'not_reported')
|
|
104
|
+
return { kind: 'not_reported' };
|
|
105
|
+
if (c.startsWith('present:'))
|
|
106
|
+
return { kind: 'present', word: c.slice('present:'.length) };
|
|
107
|
+
return { kind: 'unobserved' };
|
|
108
|
+
}
|
|
85
109
|
export function createFileHistoryDeclarationLedger() {
|
|
86
110
|
const factsByKey = new Map();
|
|
87
111
|
const cwdsByKey = new Map();
|
|
88
112
|
const keysByRun = new Map();
|
|
113
|
+
const readingsByKey = new Map();
|
|
89
114
|
return Object.freeze({
|
|
90
115
|
declaredLegCwd(requestKey, cwd) {
|
|
91
116
|
if (!idOk(requestKey) || !idOk(cwd))
|
|
@@ -114,15 +139,39 @@ export function createFileHistoryDeclarationLedger() {
|
|
|
114
139
|
}
|
|
115
140
|
return agreed;
|
|
116
141
|
},
|
|
117
|
-
declared(requestKey, fact) {
|
|
142
|
+
declared(requestKey, fact, capabilityAtAssembly) {
|
|
118
143
|
if (!idOk(requestKey) || (fact !== 'sent' && fact !== 'not_sent'))
|
|
119
144
|
return false;
|
|
120
145
|
let set = factsByKey.get(requestKey);
|
|
121
146
|
if (set === undefined)
|
|
122
147
|
factsByKey.set(requestKey, (set = new Set()));
|
|
123
148
|
set.add(fact);
|
|
149
|
+
if (capabilityAtAssembly !== undefined) {
|
|
150
|
+
let rs = readingsByKey.get(requestKey);
|
|
151
|
+
if (rs === undefined)
|
|
152
|
+
readingsByKey.set(requestKey, (rs = new Set()));
|
|
153
|
+
rs.add(canonReading(capabilityAtAssembly));
|
|
154
|
+
}
|
|
124
155
|
return true;
|
|
125
156
|
},
|
|
157
|
+
capabilityAtAssemblyOf(runId) {
|
|
158
|
+
if (!idOk(runId))
|
|
159
|
+
return { kind: 'unobserved' };
|
|
160
|
+
const keys = keysByRun.get(runId);
|
|
161
|
+
if (keys === undefined)
|
|
162
|
+
return { kind: 'unobserved' };
|
|
163
|
+
let agreed;
|
|
164
|
+
for (const k of keys) {
|
|
165
|
+
const rs = readingsByKey.get(k);
|
|
166
|
+
if (rs === undefined || rs.size !== 1)
|
|
167
|
+
return { kind: 'unobserved' };
|
|
168
|
+
const [only] = rs;
|
|
169
|
+
if (only === undefined || (agreed !== undefined && agreed !== only))
|
|
170
|
+
return { kind: 'unobserved' };
|
|
171
|
+
agreed = only;
|
|
172
|
+
}
|
|
173
|
+
return agreed === undefined ? { kind: 'unobserved' } : readingOfCanon(agreed);
|
|
174
|
+
},
|
|
126
175
|
boundToRun(requestKey, runId, event) {
|
|
127
176
|
if (!idOk(requestKey) || !idOk(runId) || !frameProvesDelivery(event))
|
|
128
177
|
return false;
|
|
@@ -18,6 +18,8 @@ export declare function readEngineActiveBgTasks(): EngineActiveBgReading;
|
|
|
18
18
|
export declare function readEngineActiveBgTasksFor(sessionKey: string): EngineActiveBgReading;
|
|
19
19
|
export declare function clearAllRetainedFleetRows(): void;
|
|
20
20
|
export declare function clearAllRetainedFleetRowsFor(sessionKey: string): void;
|
|
21
|
+
export declare function forgetSettledTerminalRow(id: string): boolean;
|
|
22
|
+
export declare function forgetSettledTerminalRowFor(sessionKey: string, id: string): boolean;
|
|
21
23
|
export declare function __resetFleetLedgerRegistryForTests(): void;
|
|
22
24
|
export declare function fleetStreamOptions(): {
|
|
23
25
|
session?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hostLog } from '../host.js';
|
|
2
|
+
import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
|
|
2
3
|
import { engineWireDebugEnabled } from '../engineWireTarget.js';
|
|
3
4
|
import { engineSessionParam, engineSessionParamFor } from '../engineSessionParam.js';
|
|
4
5
|
import { enqueueBgChildNotification, isOwnWorkflowRun } from '../notifications.js';
|
|
@@ -7,8 +8,10 @@ import { rowIdTail } from '../workflow.js';
|
|
|
7
8
|
import { recordEngineTranscriptId } from '../subagent/engineDelegatedPrompt.js';
|
|
8
9
|
import { recordFleetRowAgentType } from './fleetRowAgentType.js';
|
|
9
10
|
import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
10
|
-
import {
|
|
11
|
+
import { isSdkFleetTaskTerminal, isSdkFleetTaskTerminalNotSuccess } from '../terminalStatuses.js';
|
|
12
|
+
import { projectTasks, projectWorkflows, wireCycleSeq, wireParentId, } from './fleetProjection.js';
|
|
11
13
|
import { isInStreamDrainingEnd } from '../wireErrorTriage.js';
|
|
14
|
+
import { cycleSeqOrder, cycleSeqValue } from '../cycleOrder.js';
|
|
12
15
|
export const TERMINAL_RETAIN_MS = 60_000;
|
|
13
16
|
const liveBgViews = new Map();
|
|
14
17
|
function viewsFor(sessionKey) {
|
|
@@ -59,6 +62,16 @@ export function clearAllRetainedFleetRowsFor(sessionKey) {
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
}
|
|
65
|
+
export function forgetSettledTerminalRow(id) {
|
|
66
|
+
return forgetSettledTerminalRowFor(DEFAULT_SESSION_KEY, id);
|
|
67
|
+
}
|
|
68
|
+
export function forgetSettledTerminalRowFor(sessionKey, id) {
|
|
69
|
+
let forgotten = false;
|
|
70
|
+
for (const view of viewsFor(sessionKey))
|
|
71
|
+
if (view.forgetSettledTerminal(id))
|
|
72
|
+
forgotten = true;
|
|
73
|
+
return forgotten;
|
|
74
|
+
}
|
|
62
75
|
export function __resetFleetLedgerRegistryForTests() {
|
|
63
76
|
liveBgViews.clear();
|
|
64
77
|
}
|
|
@@ -88,7 +101,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
88
101
|
if (gen === undefined || tail.length === 0)
|
|
89
102
|
return;
|
|
90
103
|
const prior = cycleWatermark.get(tail);
|
|
91
|
-
if (prior !== undefined && prior
|
|
104
|
+
if (prior !== undefined && cycleSeqOrder(prior, gen) !== 'before')
|
|
92
105
|
return;
|
|
93
106
|
cycleWatermark.delete(tail);
|
|
94
107
|
if (cycleWatermark.size >= CYCLE_WATERMARK_MAX) {
|
|
@@ -130,10 +143,24 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
130
143
|
...(retired ? { retiredByNotification: true } : {}),
|
|
131
144
|
};
|
|
132
145
|
};
|
|
146
|
+
function forgetSettledTerminalRowOf(id) {
|
|
147
|
+
const live = taskMap.get(id);
|
|
148
|
+
if (live !== undefined && !isSdkFleetTaskTerminal(live.status))
|
|
149
|
+
return false;
|
|
150
|
+
const pooled = retained.get(id);
|
|
151
|
+
if (pooled?.retiredByNotification === true)
|
|
152
|
+
return false;
|
|
153
|
+
if (live === undefined && pooled === undefined)
|
|
154
|
+
return false;
|
|
155
|
+
taskMap.delete(id);
|
|
156
|
+
rowMeta.delete(id);
|
|
157
|
+
retained.delete(id);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
133
160
|
const bgView = {
|
|
134
161
|
read: () => {
|
|
135
162
|
const rows = [...taskMap.values()]
|
|
136
|
-
.filter(r => !
|
|
163
|
+
.filter(r => !isSdkFleetTaskTerminal(r.status))
|
|
137
164
|
.map(r => toBgTask(r, false));
|
|
138
165
|
const nowMs = nowFn();
|
|
139
166
|
for (const [id, r] of retained) {
|
|
@@ -151,6 +178,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
151
178
|
clearRetained: () => {
|
|
152
179
|
retained.clear();
|
|
153
180
|
},
|
|
181
|
+
forgetSettledTerminal: id => forgetSettledTerminalRowOf(id),
|
|
154
182
|
};
|
|
155
183
|
{
|
|
156
184
|
let views = liveBgViews.get(sessionKey);
|
|
@@ -179,7 +207,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
179
207
|
for (const row of frame.tasks) {
|
|
180
208
|
taskMap.set(row.id, row);
|
|
181
209
|
rowMeta.set(row.id, { receivedAtMs });
|
|
182
|
-
if (!
|
|
210
|
+
if (!isSdkFleetTaskTerminal(row.status)) {
|
|
183
211
|
const tail = rowIdTail(row.id);
|
|
184
212
|
for (const id of [...retained.keys()]) {
|
|
185
213
|
if (rowIdTail(id) === tail)
|
|
@@ -224,7 +252,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
224
252
|
recordEngineTranscriptId(rowIdTail(row.id), row.transcriptId);
|
|
225
253
|
}
|
|
226
254
|
recordFleetRowAgentType(rowIdTail(row.id), row.agentType);
|
|
227
|
-
if (
|
|
255
|
+
if (isSdkFleetTaskTerminal(row.status)) {
|
|
228
256
|
retained.set(row.id, { row, expireAt: receivedAtMs + TERMINAL_RETAIN_MS });
|
|
229
257
|
const tailT = rowIdTail(row.id);
|
|
230
258
|
for (const id of [...retained.keys()]) {
|
|
@@ -245,33 +273,32 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
245
273
|
}
|
|
246
274
|
case 'task_remove': {
|
|
247
275
|
const fr = frame;
|
|
248
|
-
const removedGen =
|
|
276
|
+
const removedGen = cycleSeqValue(fr.cycleSeq);
|
|
249
277
|
const held = taskMap.get(frame.id);
|
|
250
278
|
const heldGen = held !== undefined ? wireCycleSeq(held) : undefined;
|
|
251
|
-
const stale = removedGen
|
|
279
|
+
const stale = cycleSeqOrder(removedGen, heldGen) === 'before';
|
|
280
|
+
const reason = typeof fr.removeReason === 'string' && fr.removeReason.length > 0 ? fr.removeReason : undefined;
|
|
252
281
|
if (!stale) {
|
|
253
282
|
taskMap.delete(frame.id);
|
|
254
283
|
rowMeta.delete(frame.id);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
...(removedGen !== undefined ? { cycleSeq: removedGen } : {}),
|
|
263
|
-
...(stale ? { stale: true } : {}),
|
|
264
|
-
...(held === undefined ? { unknownRow: true } : {}),
|
|
265
|
-
});
|
|
266
|
-
if (out && typeof out.then === 'function') {
|
|
267
|
-
void Promise.resolve(out).catch((e) => {
|
|
268
|
-
hostLog('debug', `[fleet-frame] onTaskRemoved hook rejected: ${String(e).slice(0, 160)}`);
|
|
269
|
-
});
|
|
284
|
+
if (reason === undefined) {
|
|
285
|
+
const pooled = retained.get(frame.id);
|
|
286
|
+
if (pooled !== undefined &&
|
|
287
|
+
pooled.row.status === 'killed' &&
|
|
288
|
+
cycleSeqOrder(removedGen, wireCycleSeq(pooled.row)) !== 'before' &&
|
|
289
|
+
forgetSettledTerminalRowOf(frame.id)) {
|
|
290
|
+
debug(`[fleet-frame] settled-level task_remove evicted the stopped row(id=${frame.id})`);
|
|
270
291
|
}
|
|
271
292
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
293
|
+
}
|
|
294
|
+
if (hooks.onTaskRemoved !== undefined) {
|
|
295
|
+
invokeHostCallbackIsolated('[fleet-frame] onTaskRemoved hook', () => hooks.onTaskRemoved?.({
|
|
296
|
+
id: frame.id,
|
|
297
|
+
...(reason !== undefined ? { removeReason: reason } : {}),
|
|
298
|
+
...(removedGen !== undefined ? { cycleSeq: removedGen } : {}),
|
|
299
|
+
...(stale ? { stale: true } : {}),
|
|
300
|
+
...(held === undefined ? { unknownRow: true } : {}),
|
|
301
|
+
}));
|
|
275
302
|
}
|
|
276
303
|
break;
|
|
277
304
|
}
|
|
@@ -345,29 +372,30 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
345
372
|
? 'own_parent'
|
|
346
373
|
: 'absent_parent');
|
|
347
374
|
debug(`[fleet-frame] bg_notification taskId=${n.taskId} status=${n.status} seq=${n.seq ?? '-'} accept=${evidence}`);
|
|
375
|
+
const notifTail = rowIdTail(n.taskId);
|
|
348
376
|
const rowIds = [];
|
|
349
377
|
for (const id of taskMap.keys()) {
|
|
350
|
-
if (
|
|
378
|
+
if (rowIdTail(id) === notifTail)
|
|
351
379
|
rowIds.push(id);
|
|
352
380
|
}
|
|
353
|
-
if (
|
|
381
|
+
if (isSdkFleetTaskTerminal(n.status)) {
|
|
354
382
|
if (typeof n.parentTaskId === 'string' && n.parentTaskId) {
|
|
355
383
|
recordBgParentRun(n.taskId, n.parentTaskId, ing?.session, ing?.sessionKey);
|
|
356
384
|
}
|
|
357
385
|
if (typeof n.transcriptId === 'string' && n.transcriptId.length > 0) {
|
|
358
386
|
recordEngineTranscriptId(n.taskId, n.transcriptId);
|
|
359
387
|
}
|
|
360
|
-
const isWashGreen = (prior, next) => next === 'completed' && (prior
|
|
388
|
+
const isWashGreen = (prior, next) => next === 'completed' && isSdkFleetTaskTerminalNotSuccess(prior);
|
|
361
389
|
const coerced = n.status;
|
|
362
390
|
const nowMs = nowFn();
|
|
363
391
|
const writtenIds = new Set();
|
|
364
392
|
let applied = false;
|
|
365
393
|
let washBlocked = false;
|
|
366
394
|
let staleBlocked = false;
|
|
367
|
-
const notifSeq =
|
|
395
|
+
const notifSeq = cycleSeqValue(n.seq);
|
|
368
396
|
{
|
|
369
397
|
const mark = cycleWatermark.get(n.taskId);
|
|
370
|
-
if (notifSeq
|
|
398
|
+
if (cycleSeqOrder(notifSeq, mark) === 'before') {
|
|
371
399
|
staleBlocked = true;
|
|
372
400
|
debug(`[fleet-frame] bg_notification stale-cycle ignored(watermark=${mark} notif-seq=${notifSeq})`);
|
|
373
401
|
}
|
|
@@ -377,13 +405,13 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
377
405
|
if (!known)
|
|
378
406
|
continue;
|
|
379
407
|
const heldGen = wireCycleSeq(known);
|
|
380
|
-
if (notifSeq
|
|
408
|
+
if (cycleSeqOrder(notifSeq, heldGen) === 'before') {
|
|
381
409
|
staleBlocked = true;
|
|
382
410
|
debug(`[fleet-frame] bg_notification stale-cycle ignored(row=${id} row-cycle=${heldGen} notif-seq=${notifSeq})`);
|
|
383
411
|
continue;
|
|
384
412
|
}
|
|
385
413
|
const rowStatus = known.status ?? '';
|
|
386
|
-
if (
|
|
414
|
+
if (isSdkFleetTaskTerminal(rowStatus)) {
|
|
387
415
|
if (isWashGreen(rowStatus, n.status)) {
|
|
388
416
|
washBlocked = true;
|
|
389
417
|
debug(`[fleet-frame] bg_notification WASH-GREEN blocked(row=${id} row-status=${rowStatus} notif=${n.status})`);
|
|
@@ -423,10 +451,10 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
423
451
|
for (const [id, entry] of retained) {
|
|
424
452
|
if (writtenIds.has(id))
|
|
425
453
|
continue;
|
|
426
|
-
if (
|
|
454
|
+
if (rowIdTail(id) !== notifTail)
|
|
427
455
|
continue;
|
|
428
456
|
const retainedGen = wireCycleSeq(entry.row);
|
|
429
|
-
if (notifSeq
|
|
457
|
+
if (cycleSeqOrder(notifSeq, retainedGen) === 'before') {
|
|
430
458
|
staleBlocked = true;
|
|
431
459
|
debug(`[fleet-frame] bg_notification stale-cycle ignored(retained=${id} row-cycle=${retainedGen} notif-seq=${notifSeq})`);
|
|
432
460
|
continue;
|
|
@@ -455,12 +483,11 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
455
483
|
const prior = getBgTerminalFacts(n.taskId);
|
|
456
484
|
if (prior === undefined)
|
|
457
485
|
return true;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
486
|
+
const order = cycleSeqOrder(notifSeq, prior.cycleSeq);
|
|
487
|
+
if (order === 'before')
|
|
488
|
+
return false;
|
|
489
|
+
if (order === 'after')
|
|
490
|
+
return true;
|
|
464
491
|
return !isWashGreen(prior.status, n.status);
|
|
465
492
|
})()));
|
|
466
493
|
if (factsAccepted)
|
|
@@ -487,17 +514,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
487
514
|
debug(`[fleet-frame] bg_notification state-plane rejected as wash-green echo(taskId=${n.taskId} notif=${n.status})—— 通知面照常入队`);
|
|
488
515
|
}
|
|
489
516
|
}
|
|
490
|
-
|
|
491
|
-
const out = hooks.onBgNotificationAccepted?.(n, rowIds, evidence);
|
|
492
|
-
if (out && typeof out.then === 'function') {
|
|
493
|
-
void Promise.resolve(out).catch((e) => {
|
|
494
|
-
hostLog('debug', `[fleet-frame] onBgNotificationAccepted hook rejected: ${String(e).slice(0, 160)}`);
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
catch (e) {
|
|
499
|
-
hostLog('debug', `[fleet-frame] onBgNotificationAccepted hook threw: ${String(e).slice(0, 160)}`);
|
|
500
|
-
}
|
|
517
|
+
invokeHostCallbackIsolated('[fleet-frame] onBgNotificationAccepted hook', () => hooks.onBgNotificationAccepted?.(n, rowIds, evidence));
|
|
501
518
|
enqueueBgChildNotification({
|
|
502
519
|
taskId: n.taskId,
|
|
503
520
|
status: n.status,
|
|
@@ -508,7 +525,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
|
|
|
508
525
|
function project(nowMs, opts) {
|
|
509
526
|
const viewingTaskId = opts.viewingTaskId;
|
|
510
527
|
const liveRows = [...taskMap.values()].map(r => {
|
|
511
|
-
if (
|
|
528
|
+
if (isSdkFleetTaskTerminal(r.status))
|
|
512
529
|
return r;
|
|
513
530
|
const started = r.startedAt;
|
|
514
531
|
if (typeof started === 'number' && started > 0 && started <= nowMs) {
|
|
@@ -10,7 +10,6 @@ export interface FleetTaskView {
|
|
|
10
10
|
elapsedMs?: number;
|
|
11
11
|
tokens?: number;
|
|
12
12
|
tokenDir: 'down' | 'up';
|
|
13
|
-
queuedCount?: number;
|
|
14
13
|
awaitingPlanApproval: boolean;
|
|
15
14
|
descendantCount: number;
|
|
16
15
|
viewed: boolean;
|
|
@@ -51,9 +50,7 @@ export interface FleetWorkflowView {
|
|
|
51
50
|
tokens?: number;
|
|
52
51
|
failedCount?: number;
|
|
53
52
|
startedCount?: number;
|
|
54
|
-
errorCode?: string;
|
|
55
53
|
}
|
|
56
|
-
export declare const TERMINAL_FLEET_TASK_STATUSES: ReadonlySet<string>;
|
|
57
54
|
export declare function coerceTaskStatus(s: string): FleetTaskStatus;
|
|
58
55
|
export declare function coerceWorkflowStatus(s: string | undefined): FleetTaskStatus;
|
|
59
56
|
export declare const CONTROL_TOOL_VERBS: ReadonlySet<string>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { collapseLabel, escapeDisplayControlChars, taskDescFromName } from '../fleetTaskDesc.js';
|
|
2
2
|
import { rowIdTail } from '../workflow.js';
|
|
3
|
+
import { cycleSeqValue } from '../cycleOrder.js';
|
|
3
4
|
import { frozenSet } from '../frozenSet.js';
|
|
4
5
|
import { CORE_RESERVED_AGENT_NAMES } from '../generated/engineFactTables.js';
|
|
5
|
-
export const TERMINAL_FLEET_TASK_STATUSES = frozenSet([
|
|
6
|
-
'completed',
|
|
7
|
-
'failed',
|
|
8
|
-
'killed',
|
|
9
|
-
]);
|
|
10
6
|
export function coerceTaskStatus(s) {
|
|
11
7
|
switch (s) {
|
|
12
8
|
case 'queued':
|
|
@@ -130,8 +126,7 @@ function wireStoppedBy(r) {
|
|
|
130
126
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
131
127
|
}
|
|
132
128
|
export function wireCycleSeq(r) {
|
|
133
|
-
|
|
134
|
-
return typeof v === 'number' && Number.isInteger(v) && v > 0 ? v : undefined;
|
|
129
|
+
return cycleSeqValue(r.cycleSeq);
|
|
135
130
|
}
|
|
136
131
|
function wireRetiredBy(r) {
|
|
137
132
|
const v = r.retiredBy;
|
|
@@ -182,7 +177,6 @@ export function projectTasks(allRows, opts) {
|
|
|
182
177
|
...wireNumberKey('elapsedMs', wireDuration(r.elapsedMs)),
|
|
183
178
|
...wireNumberKey('tokens', wireCount(r.tokens)),
|
|
184
179
|
tokenDir: 'down',
|
|
185
|
-
...wireNumberKey('queuedCount', wireCount(r.queuedCount)),
|
|
186
180
|
awaitingPlanApproval: r.awaitingPlanApproval ?? false,
|
|
187
181
|
descendantCount: childCount.get(r.id) ?? 0,
|
|
188
182
|
viewed: viewingTaskId !== undefined && rowIdTail(r.id) === viewingTaskId,
|
|
@@ -213,7 +207,6 @@ function wireNumberKey(key, v) {
|
|
|
213
207
|
export function projectWorkflows(rows) {
|
|
214
208
|
return rows.map(r => {
|
|
215
209
|
const startedCount = wireStartedCount(r);
|
|
216
|
-
const errorCode = wireErrorCode(r);
|
|
217
210
|
return {
|
|
218
211
|
id: r.id,
|
|
219
212
|
name: collapseLabel(r.name ?? '') || 'Dynamic workflow',
|
|
@@ -225,14 +218,9 @@ export function projectWorkflows(rows) {
|
|
|
225
218
|
...wireNumberKey('tokens', wireCount(r.tokens)),
|
|
226
219
|
...wireNumberKey('failedCount', wireCount(r.failedCount)),
|
|
227
220
|
...(startedCount !== undefined ? { startedCount } : {}),
|
|
228
|
-
...(errorCode !== undefined ? { errorCode } : {}),
|
|
229
221
|
};
|
|
230
222
|
});
|
|
231
223
|
}
|
|
232
|
-
function wireErrorCode(r) {
|
|
233
|
-
const v = r.errorCode;
|
|
234
|
-
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
235
|
-
}
|
|
236
224
|
const FLEET_TASK_VIEW_KEY_TUPLE = [
|
|
237
225
|
'id',
|
|
238
226
|
'name',
|
|
@@ -243,7 +231,6 @@ const FLEET_TASK_VIEW_KEY_TUPLE = [
|
|
|
243
231
|
'elapsedMs',
|
|
244
232
|
'tokens',
|
|
245
233
|
'tokenDir',
|
|
246
|
-
'queuedCount',
|
|
247
234
|
'awaitingPlanApproval',
|
|
248
235
|
'descendantCount',
|
|
249
236
|
'viewed',
|
|
@@ -271,7 +258,6 @@ const FLEET_WORKFLOW_VIEW_KEY_TUPLE = [
|
|
|
271
258
|
'tokens',
|
|
272
259
|
'failedCount',
|
|
273
260
|
'startedCount',
|
|
274
|
-
'errorCode',
|
|
275
261
|
];
|
|
276
262
|
export const FLEET_WORKFLOW_VIEW_KEYS = FLEET_WORKFLOW_VIEW_KEY_TUPLE;
|
|
277
263
|
const FLEET_TASK_ROW_WIRE_KEY_TUPLE = [
|
|
@@ -337,6 +323,13 @@ export const FLEET_TASK_ROW_KEYS_NOT_PROJECTED = {
|
|
|
337
323
|
owner: 'client-core 规范重构轮',
|
|
338
324
|
reason: '同 agentType:两位在本层合成一个身份 label,分开带出去等于把 187 的 tjl 规则推给每个消费端各写一遍。',
|
|
339
325
|
},
|
|
326
|
+
queuedCount: {
|
|
327
|
+
kind: 'by-design',
|
|
328
|
+
owner: 'client-core 0.95.0 CC-388',
|
|
329
|
+
reason: '幻影键:sdk 行型仍声明它,但任何 server 版本都不发(生产侧已整只删除,零生产者,契约里也从没列过)。' +
|
|
330
|
+
'投影一个永远缺席的可选位 = 假线索(读者以为「队列深度已经报了」),所以视图上不留位。' +
|
|
331
|
+
'sdk 在下一个 major 删掉这条声明的同批,本条与 `FLEET_TASK_ROW_WIRE_KEYS` 的 `queuedCount` 一起删;真要队列深度 = 带生产者的新键,不是复活这一个。',
|
|
332
|
+
},
|
|
340
333
|
workflowRunId: {
|
|
341
334
|
kind: 'by-design',
|
|
342
335
|
owner: 'client-core 规范重构轮',
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
status?: string;
|
|
6
|
-
tokens?: number;
|
|
7
|
-
toolUses?: number;
|
|
8
|
-
transcriptId?: string;
|
|
9
|
-
currentTool?: {
|
|
10
|
-
toolName: string;
|
|
11
|
-
target?: string;
|
|
12
|
-
};
|
|
13
|
-
startedAt?: number;
|
|
14
|
-
cycleSeq?: number;
|
|
15
|
-
parentToolCallId?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare const ABSENT_SETTLE_MS = 30000;
|
|
1
|
+
import { ABSENT_SETTLE_MS } from './panelReduce.js';
|
|
2
|
+
import type { FleetAgentRowLike } from './fleetAgentRowLike.js';
|
|
3
|
+
export type { FleetAgentRowLike };
|
|
4
|
+
export { ABSENT_SETTLE_MS };
|
|
18
5
|
export declare function resetFleetAgentPanelProjection(): void;
|
|
19
6
|
export declare function resetFleetAgentPanelProjectionFor(sessionKey: string): void;
|
|
20
7
|
export declare function fleetAgentProjectionSize(): number;
|