@sema-agent/client-core 0.94.0 → 0.96.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 +521 -0
- package/README.md +104 -57
- package/dist/adapt/arms.js +12 -7
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +18 -5
- package/dist/adapt/wireShapes.js +5 -24
- package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
- package/dist/adapter/activeRunSelfHeal.js +50 -16
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
- package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
- package/dist/adapter/runStream.js +30 -46
- 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 +7 -5
- package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/agentsWireCaps.js +13 -2
- 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 -5
- package/dist/callerCwdCapability.js +2 -13
- package/dist/centerWiringCapability.d.ts +1 -7
- package/dist/centerWiringCapability.js +18 -27
- package/dist/classifierStatus.js +4 -4
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +3 -3
- package/dist/cloudConfigWireCaps.js +85 -43
- package/dist/compensations.js +1 -1
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +7 -2
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +39 -14
- 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 +8 -3
- package/dist/displayUntrusted.js +661 -63
- 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 +13 -2
- package/dist/engineCapsCache.js +276 -44
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +28 -4
- package/dist/engineErrorCodes.js +68 -25
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +57 -3
- package/dist/engineWireSdk.js +2 -2
- package/dist/engineWordRenames.d.ts +8 -0
- package/dist/engineWordRenames.js +13 -0
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +14 -1
- package/dist/fileHistoryCaptureCapability.js +72 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +3 -0
- package/dist/fleet/fleetLedger.js +153 -122
- package/dist/fleet/fleetProjection.d.ts +1 -3
- package/dist/fleet/fleetProjection.js +19 -19
- 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/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +87 -18
- package/dist/gateVocabulary.d.ts +7 -2
- package/dist/gateVocabulary.js +5 -1
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +13 -0
- package/dist/generated/settingsSchemaFns.js +75 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -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 +7 -0
- package/dist/hitl/approvalEndingCause.js +71 -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/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +15 -10
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +41 -0
- package/dist/hitl/decisionRefusal.d.ts +12 -0
- package/dist/hitl/decisionRefusal.js +63 -4
- package/dist/hitl/frameRouter.d.ts +0 -1
- package/dist/hitl/frameRouter.js +32 -57
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +17 -2
- package/dist/hitl/hitlBridge.js +91 -55
- 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/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +4 -7
- package/dist/hitl/parkResolver.js +12 -34
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +3 -2
- package/dist/hitl/planReviewWire.js +154 -50
- package/dist/hitl/replayedApproval.d.ts +9 -0
- package/dist/hitl/replayedApproval.js +139 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/sessionPolicyDeliverable.js +8 -6
- package/dist/hitl/standingRows.d.ts +18 -0
- package/dist/hitl/standingRows.js +127 -0
- package/dist/hitl/toolApprovalWire.d.ts +39 -7
- package/dist/hitl/toolApprovalWire.js +351 -61
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +40 -8
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +2 -0
- package/dist/hostCallbackGuard.js +31 -0
- package/dist/index.d.ts +48 -17
- package/dist/index.js +36 -15
- 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 -5
- package/dist/mcpProbeCapability.js +2 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -5
- package/dist/memoryComplianceCapability.js +2 -12
- package/dist/memoryOriginCapability.d.ts +0 -5
- package/dist/memoryOriginCapability.js +2 -12
- package/dist/memorySpecWire.js +2 -2
- 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 +2 -2
- package/dist/modelIdentityResolvability.js +14 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -2
- package/dist/outputStyleSeatCapability.js +2 -10
- package/dist/ownKey.d.ts +8 -0
- package/dist/ownKey.js +66 -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/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -5
- package/dist/permissionModesCapability.js +5 -16
- package/dist/permissionRuleIssue.js +0 -3
- 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 +8 -0
- package/dist/permissionsDeclaration.js +101 -41
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -17
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +127 -32
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +5 -14
- package/dist/rewindArchiveCapability.js +18 -61
- package/dist/rewindArchiveReading.d.ts +15 -0
- package/dist/rewindArchiveReading.js +56 -0
- 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/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +15 -12
- package/dist/runTerminal.js +60 -35
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -5
- package/dist/sealedKeyCapability.js +3 -15
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +125 -34
- package/dist/seatContract.js +583 -179
- 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 -5
- package/dist/sessionReadRedactionCapability.js +2 -13
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
- package/dist/sessionSyncFileHistoryCapability.js +2 -9
- package/dist/skillToolListsCapability.d.ts +0 -2
- package/dist/skillToolListsCapability.js +2 -9
- 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 -2
- package/dist/steerPriorityCapability.js +3 -12
- package/dist/storePostureCapability.d.ts +1 -5
- package/dist/storePostureCapability.js +16 -22
- 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/engineSubagentSteer.js +7 -5
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +7 -18
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +15 -14
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +6 -1
- package/dist/toolResult.js +90 -37
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +335 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -2
- package/dist/userInvokedSkillsCapability.js +2 -9
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +34 -5
- package/dist/wireFailureShape.d.ts +23 -2
- package/dist/wireFailureShape.js +88 -43
- 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 +2279 -27
- 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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export const CREDENTIAL_ATTACH_WORDS = Object.freeze(['local-sidecar', 'service-token', 'registry', 'none']);
|
|
2
|
+
const TARGET_KIND_WORDS = ['local-managed', 'loopback-pin', 'remote', 'unresolved'];
|
|
3
|
+
const TARGET_PROVENANCE_WORDS = ['managed', 'connect-pin', 'manual', 'none'];
|
|
4
|
+
const CONSENT_WORDS = ['granted', 'absent', 'n/a'];
|
|
5
|
+
const SIDECAR_OWNERSHIP_WORDS = ['verified', 'mismatch'];
|
|
6
|
+
function said(word) {
|
|
7
|
+
const r = { kind: 'word', word };
|
|
8
|
+
return Object.freeze(r);
|
|
9
|
+
}
|
|
10
|
+
function unreadable(reason) {
|
|
11
|
+
const r = { kind: 'unreadable', reason };
|
|
12
|
+
return Object.freeze(r);
|
|
13
|
+
}
|
|
14
|
+
function ownData(holder, key) {
|
|
15
|
+
try {
|
|
16
|
+
if (typeof holder !== 'object' || holder === null)
|
|
17
|
+
return undefined;
|
|
18
|
+
const d = Object.getOwnPropertyDescriptor(holder, key);
|
|
19
|
+
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function ownBool(holder, key) {
|
|
26
|
+
const v = ownData(holder, key);
|
|
27
|
+
return typeof v === 'boolean' ? v : undefined;
|
|
28
|
+
}
|
|
29
|
+
function ownWord(holder, key, closed) {
|
|
30
|
+
const v = ownData(holder, key);
|
|
31
|
+
return typeof v === 'string' ? closed.find((w) => w === v) : undefined;
|
|
32
|
+
}
|
|
33
|
+
function decide(facts) {
|
|
34
|
+
if (typeof facts !== 'object' || facts === null || Array.isArray(facts))
|
|
35
|
+
return unreadable('facts');
|
|
36
|
+
const kind = ownWord(facts, 'kind', TARGET_KIND_WORDS);
|
|
37
|
+
if (kind === undefined)
|
|
38
|
+
return unreadable('kind');
|
|
39
|
+
if (kind === 'unresolved')
|
|
40
|
+
return said('none');
|
|
41
|
+
if (kind === 'local-managed') {
|
|
42
|
+
const owned = ownWord(facts, 'sidecarOwnership', SIDECAR_OWNERSHIP_WORDS);
|
|
43
|
+
if (owned === undefined)
|
|
44
|
+
return unreadable('sidecarOwnership');
|
|
45
|
+
return said(owned === 'verified' ? 'local-sidecar' : 'none');
|
|
46
|
+
}
|
|
47
|
+
const tokenAtFirstWrite = ownBool(facts, 'serviceTokenAtFirstWrite');
|
|
48
|
+
if (tokenAtFirstWrite === undefined)
|
|
49
|
+
return unreadable('serviceTokenAtFirstWrite');
|
|
50
|
+
if (tokenAtFirstWrite)
|
|
51
|
+
return said('service-token');
|
|
52
|
+
const loggedIn = ownBool(facts, 'loggedIn');
|
|
53
|
+
if (loggedIn === undefined)
|
|
54
|
+
return unreadable('loggedIn');
|
|
55
|
+
if (!loggedIn)
|
|
56
|
+
return said('none');
|
|
57
|
+
const provenance = ownWord(facts, 'provenance', TARGET_PROVENANCE_WORDS);
|
|
58
|
+
if (provenance === undefined)
|
|
59
|
+
return unreadable('provenance');
|
|
60
|
+
if (provenance !== 'connect-pin')
|
|
61
|
+
return said('none');
|
|
62
|
+
if (kind === 'remote')
|
|
63
|
+
return said('registry');
|
|
64
|
+
const consent = ownWord(facts, 'consent', CONSENT_WORDS);
|
|
65
|
+
if (consent === undefined || consent === 'n/a')
|
|
66
|
+
return unreadable('consent');
|
|
67
|
+
return said(consent === 'granted' ? 'registry' : 'none');
|
|
68
|
+
}
|
|
69
|
+
export function credentialProvenance(facts) {
|
|
70
|
+
try {
|
|
71
|
+
return decide(facts);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return unreadable('facts');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EngineAgentPanelCycleIdentity {
|
|
2
|
+
readonly cycleSeq?: number;
|
|
3
|
+
readonly startedAt?: number;
|
|
4
|
+
}
|
|
5
|
+
export type CycleOrder = 'before' | 'after' | 'same' | 'unknown';
|
|
6
|
+
export declare function cycleSeqValue(v: unknown): number | undefined;
|
|
7
|
+
export declare function cycleSeqOf(v: EngineAgentPanelCycleIdentity | null | undefined): number | undefined;
|
|
8
|
+
export declare function startedAtOf(v: EngineAgentPanelCycleIdentity | null | undefined): number | undefined;
|
|
9
|
+
export declare function cycleOrder(a: EngineAgentPanelCycleIdentity | null | undefined, b: EngineAgentPanelCycleIdentity | null | undefined): CycleOrder;
|
|
10
|
+
export declare function cycleSeqOrder(a: number | undefined, b: number | undefined): CycleOrder;
|
|
11
|
+
export declare function cycleOf(v: EngineAgentPanelCycleIdentity | null | undefined): EngineAgentPanelCycleIdentity;
|
|
12
|
+
export declare function cycleEmpty(v: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
13
|
+
export declare function cycleKeysChanged(prev: EngineAgentPanelCycleIdentity | null | undefined, next: EngineAgentPanelCycleIdentity | null | undefined): boolean;
|
|
14
|
+
export declare function carryCycle(frame: EngineAgentPanelCycleIdentity, prev: EngineAgentPanelCycleIdentity | undefined, carry: boolean): EngineAgentPanelCycleIdentity;
|
|
15
|
+
export declare function mergeCycle(prefer: EngineAgentPanelCycleIdentity, fallback: EngineAgentPanelCycleIdentity | undefined): EngineAgentPanelCycleIdentity;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function cycleSeqValue(v) {
|
|
2
|
+
return typeof v === 'number' && Number.isInteger(v) && v >= 1 ? v : undefined;
|
|
3
|
+
}
|
|
4
|
+
export function cycleSeqOf(v) {
|
|
5
|
+
return cycleSeqValue(v?.cycleSeq);
|
|
6
|
+
}
|
|
7
|
+
export function startedAtOf(v) {
|
|
8
|
+
const n = v?.startedAt;
|
|
9
|
+
return typeof n === 'number' && Number.isFinite(n) && n > 0 ? n : undefined;
|
|
10
|
+
}
|
|
11
|
+
export function cycleOrder(a, b) {
|
|
12
|
+
const ac = cycleSeqOf(a);
|
|
13
|
+
const bc = cycleSeqOf(b);
|
|
14
|
+
if (ac !== undefined && bc !== undefined)
|
|
15
|
+
return ac < bc ? 'before' : ac > bc ? 'after' : 'same';
|
|
16
|
+
const as = startedAtOf(a);
|
|
17
|
+
const bs = startedAtOf(b);
|
|
18
|
+
if (as !== undefined && bs !== undefined)
|
|
19
|
+
return as < bs ? 'before' : as > bs ? 'after' : 'same';
|
|
20
|
+
return 'unknown';
|
|
21
|
+
}
|
|
22
|
+
export function cycleSeqOrder(a, b) {
|
|
23
|
+
return cycleOrder(a === undefined ? undefined : { cycleSeq: a }, b === undefined ? undefined : { cycleSeq: b });
|
|
24
|
+
}
|
|
25
|
+
export function cycleOf(v) {
|
|
26
|
+
const c = cycleSeqOf(v);
|
|
27
|
+
const s = startedAtOf(v);
|
|
28
|
+
return { ...(c !== undefined ? { cycleSeq: c } : {}), ...(s !== undefined ? { startedAt: s } : {}) };
|
|
29
|
+
}
|
|
30
|
+
export function cycleEmpty(v) {
|
|
31
|
+
return cycleSeqOf(v) === undefined && startedAtOf(v) === undefined;
|
|
32
|
+
}
|
|
33
|
+
export function cycleKeysChanged(prev, next) {
|
|
34
|
+
const nc = cycleSeqOf(next);
|
|
35
|
+
const ns = startedAtOf(next);
|
|
36
|
+
return (nc !== undefined && nc !== cycleSeqOf(prev)) || (ns !== undefined && ns !== startedAtOf(prev));
|
|
37
|
+
}
|
|
38
|
+
export function carryCycle(frame, prev, carry) {
|
|
39
|
+
const c = cycleSeqOf(frame) ?? (carry ? cycleSeqOf(prev) : undefined);
|
|
40
|
+
const s = startedAtOf(frame) ?? (carry ? startedAtOf(prev) : undefined);
|
|
41
|
+
return { ...(c !== undefined ? { cycleSeq: c } : {}), ...(s !== undefined ? { startedAt: s } : {}) };
|
|
42
|
+
}
|
|
43
|
+
export function mergeCycle(prefer, fallback) {
|
|
44
|
+
return carryCycle(prefer, fallback, true);
|
|
45
|
+
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { corruptStoredRowContent, corruptStoredRowWhere } from './wireErrorTriage.js';
|
|
1
|
+
import { corruptStoredRowContent, corruptStoredRowWhere, scenarioDenyFromError, scenarioNotAllowedContent } from './wireErrorTriage.js';
|
|
2
2
|
import { checkpointUnsupportedVersionContent, checkpointUnsupportedVersionFromError, parkedResumeStartupContent, parkedResumeStartupFromError, resumePolicyBlockContent, resumePolicyBlockFromError, } from './resumeRefusalCopy.js';
|
|
3
3
|
import { askGoneContent, askGoneFromError, decideParkMovedContent, decideParkMovedFromError } from './decideReceipt.js';
|
|
4
4
|
import { settingsPermissionBucketRefusalContent, settingsPermissionBucketRefusalFromError } from './wireRefusalCopy.js';
|
|
5
|
+
import { DECISION_ANSWER_INVALID_CONTENT, decisionConflictOf } from './hitl/decisionConflict.js';
|
|
5
6
|
export function decideFailureNote(err, decision) {
|
|
6
7
|
const where = corruptStoredRowWhere(err);
|
|
7
8
|
const fold = resumePolicyBlockFromError(err);
|
|
8
9
|
const startup = parkedResumeStartupFromError(err, decision);
|
|
9
10
|
const moved = decideParkMovedFromError(err);
|
|
10
11
|
const bucket = settingsPermissionBucketRefusalFromError(err);
|
|
12
|
+
const scenario = scenarioDenyFromError(err);
|
|
11
13
|
const unsupported = checkpointUnsupportedVersionFromError(err);
|
|
12
14
|
const gone = askGoneFromError(err);
|
|
15
|
+
const answerInvalid = decisionConflictOf(err) === 'answer_invalid';
|
|
13
16
|
return ((where === undefined ? '' : ` — ${corruptStoredRowContent(where)}`) +
|
|
14
17
|
(fold === null ? '' : ` — ${resumePolicyBlockContent(fold)}`) +
|
|
15
18
|
(bucket === null ? '' : ` — ${settingsPermissionBucketRefusalContent(bucket)}`) +
|
|
19
|
+
(scenario === null ? '' : ` — ${scenarioNotAllowedContent(scenario, undefined, 'resumed_work')}`) +
|
|
16
20
|
(startup === null ? '' : ` — ${parkedResumeStartupContent(startup)}`) +
|
|
17
21
|
(moved === null ? '' : ` — ${decideParkMovedContent(moved)}`) +
|
|
18
22
|
(unsupported === null ? '' : ` — ${checkpointUnsupportedVersionContent(unsupported)}`) +
|
|
19
|
-
(gone === null ? '' : ` — ${askGoneContent(gone)}`)
|
|
23
|
+
(gone === null ? '' : ` — ${askGoneContent(gone)}`) +
|
|
24
|
+
(answerInvalid ? ` — ${DECISION_ANSWER_INVALID_CONTENT}` : ''));
|
|
20
25
|
}
|
package/dist/decideReceipt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type GateOutcomeView } from './gateOutcome.js';
|
|
2
2
|
import { type ResumeReopenDetail } from './hitl/suspendedReopen.js';
|
|
3
3
|
import { type CrashConvergedRow } from './hitl/crashConverged.js';
|
|
4
|
+
import type { AskRowEndingCause } from '@sema-agent/sdk';
|
|
4
5
|
export interface DecideReceiptView {
|
|
5
6
|
status?: string;
|
|
6
7
|
taskId?: string;
|
|
@@ -33,7 +34,7 @@ export declare function decideParkMovedContent(detail: Pick<DecideParkMovedDetai
|
|
|
33
34
|
export interface AskGoneDetail {
|
|
34
35
|
code: 'gone.ask';
|
|
35
36
|
state?: 'VOID' | 'DENIED';
|
|
36
|
-
|
|
37
|
+
endingCause?: AskRowEndingCause;
|
|
37
38
|
holderGone?: CrashConvergedRow['cause'];
|
|
38
39
|
}
|
|
39
40
|
export declare function askGoneFromError(e: unknown): AskGoneDetail | null;
|
package/dist/decideReceipt.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { gateOutcomeOf } from './gateOutcome.js';
|
|
2
2
|
import { resumeReopenFromError } from './hitl/suspendedReopen.js';
|
|
3
|
-
import { ASK_GONE,
|
|
3
|
+
import { ASK_GONE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, isDecideParkMovedCode, } from './engineErrorCodes.js';
|
|
4
4
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
5
|
-
import { readErrorString, readErrorStrictStringList } from './wireFailureShape.js';
|
|
5
|
+
import { readErrorString, readErrorStrictStringList, readThrownExtra } from './wireFailureShape.js';
|
|
6
6
|
import { isCrashConvergedCause } from './hitl/crashConverged.js';
|
|
7
|
+
import { askRowEndingCauseFor } from './hitl/approvalEndingCause.js';
|
|
7
8
|
const STATUS_RESUMING = 'resuming';
|
|
8
9
|
function str(v) {
|
|
9
10
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
@@ -132,6 +133,35 @@ export function decideParkMovedContent(detail) {
|
|
|
132
133
|
const extra = code === DECIDE_CLAIM_LOST ? '; if this approval is still listed, wait a little before deciding it again' : '';
|
|
133
134
|
return `${what} · This decision was not applied — fetch the pending approvals again and decide from what is pending now${extra}`;
|
|
134
135
|
}
|
|
136
|
+
function askGoneRawCause(e) {
|
|
137
|
+
let top;
|
|
138
|
+
try {
|
|
139
|
+
top = e.endingCause;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
top = undefined;
|
|
143
|
+
}
|
|
144
|
+
if (typeof top === 'string')
|
|
145
|
+
return top;
|
|
146
|
+
const reading = readThrownExtra(e);
|
|
147
|
+
if (reading.state === 'unreadable')
|
|
148
|
+
return undefined;
|
|
149
|
+
if (reading.state === 'object') {
|
|
150
|
+
const extra = reading.value;
|
|
151
|
+
let hasCause = false;
|
|
152
|
+
let word;
|
|
153
|
+
try {
|
|
154
|
+
hasCause = Object.hasOwn(extra, 'cause');
|
|
155
|
+
word = hasCause ? extra.cause : undefined;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
if (hasCause)
|
|
161
|
+
return word;
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
135
165
|
export function askGoneFromError(e) {
|
|
136
166
|
if (typeof e !== 'object' || e === null)
|
|
137
167
|
return null;
|
|
@@ -139,37 +169,32 @@ export function askGoneFromError(e) {
|
|
|
139
169
|
return null;
|
|
140
170
|
const rawState = readErrorString(e, 'state');
|
|
141
171
|
const state = rawState === 'VOID' || rawState === 'DENIED' ? rawState : undefined;
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
? undefined
|
|
145
|
-
: state === 'DENIED'
|
|
146
|
-
? rawReason === ASK_GONE_DENIED_WORD ? rawReason : undefined
|
|
147
|
-
: state === 'VOID' ? rawReason : undefined;
|
|
148
|
-
const holderGone = state === 'VOID' && isCrashConvergedCause(deniedReason) ? deniedReason : undefined;
|
|
172
|
+
const endingCause = askRowEndingCauseFor(state, askGoneRawCause(e));
|
|
173
|
+
const holderGone = state === 'VOID' && isCrashConvergedCause(endingCause) ? endingCause : undefined;
|
|
149
174
|
return {
|
|
150
175
|
code: ASK_GONE,
|
|
151
176
|
...(state !== undefined ? { state } : {}),
|
|
152
|
-
...(
|
|
177
|
+
...(endingCause !== undefined ? { endingCause } : {}),
|
|
153
178
|
...(holderGone !== undefined ? { holderGone } : {}),
|
|
154
179
|
};
|
|
155
180
|
}
|
|
156
181
|
export function askGoneContent(detail) {
|
|
157
182
|
let state;
|
|
158
|
-
let
|
|
183
|
+
let endingCause;
|
|
159
184
|
let holderGone;
|
|
160
185
|
try {
|
|
161
186
|
state = detail.state;
|
|
162
|
-
|
|
187
|
+
endingCause = detail.endingCause;
|
|
163
188
|
holderGone = detail.holderGone;
|
|
164
189
|
}
|
|
165
190
|
catch {
|
|
166
191
|
state = undefined;
|
|
167
|
-
|
|
192
|
+
endingCause = undefined;
|
|
168
193
|
holderGone = undefined;
|
|
169
194
|
}
|
|
170
195
|
const st = state === 'VOID' || state === 'DENIED' ? state : undefined;
|
|
171
196
|
const safety = 'Your answer was not applied and nothing was run on it';
|
|
172
|
-
if (st === 'VOID' && (isCrashConvergedCause(holderGone) || isCrashConvergedCause(
|
|
197
|
+
if (st === 'VOID' && (isCrashConvergedCause(holderGone) || isCrashConvergedCause(endingCause))) {
|
|
173
198
|
return [
|
|
174
199
|
'The engine run that was waiting for this answer ended before the answer arrived',
|
|
175
200
|
safety,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DECLARED_SUPPORT_FLOOR: Readonly<Record<"server" | "core" | "sdk", string>>;
|
|
@@ -20,5 +20,4 @@ export declare function observedDeviceExecutorManagement(baseUrl?: string | unde
|
|
|
20
20
|
export declare function deviceManagementVerbsAvailable(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
21
21
|
export declare function deviceLaneOpen(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
22
22
|
export declare function deviceExecutorManagementDoctorDetail(reading: DeviceExecutorManagementReading): string;
|
|
23
|
-
export declare function forgetDeviceExecutorManagementReading(baseUrl: string | undefined): void;
|
|
24
23
|
export declare function __resetDeviceExecutorManagementReadingsForTests(): void;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
4
|
-
function ownRead(o, key) {
|
|
5
|
-
return Object.hasOwn(o, key) ? o[key] : undefined;
|
|
6
|
-
}
|
|
7
5
|
export function projectDeviceExecutorManagementCapability(caps) {
|
|
8
6
|
try {
|
|
9
7
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
10
8
|
return undefined;
|
|
11
|
-
const
|
|
12
|
-
if (!Object.hasOwn(c, 'deviceExecutor'))
|
|
13
|
-
return { kind: 'not_reported', why: 'capability_absent' };
|
|
14
|
-
const d = c.deviceExecutor;
|
|
9
|
+
const d = ownDataField(caps, 'deviceExecutor');
|
|
15
10
|
if (d === undefined)
|
|
16
11
|
return { kind: 'not_reported', why: 'capability_absent' };
|
|
17
12
|
if (d === false)
|
|
18
13
|
return { kind: 'lane_absent' };
|
|
19
14
|
if (d === null || typeof d !== 'object' || Array.isArray(d))
|
|
20
15
|
return undefined;
|
|
21
|
-
|
|
22
|
-
if (ownRead(o, 'enabled') !== true)
|
|
16
|
+
if (ownDataField(d, 'enabled') !== true)
|
|
23
17
|
return undefined;
|
|
24
|
-
const mgmt =
|
|
18
|
+
const mgmt = ownDataField(d, 'management');
|
|
25
19
|
let management;
|
|
26
20
|
if (mgmt === undefined)
|
|
27
21
|
management = 'absent';
|
|
@@ -31,9 +25,9 @@ export function projectDeviceExecutorManagementCapability(caps) {
|
|
|
31
25
|
management = 'present-false';
|
|
32
26
|
else
|
|
33
27
|
return undefined;
|
|
34
|
-
const pv =
|
|
35
|
-
const mi =
|
|
36
|
-
const ws =
|
|
28
|
+
const pv = ownDataField(d, 'protocolVersion');
|
|
29
|
+
const mi = ownDataField(d, 'maxInflightPerDevice');
|
|
30
|
+
const ws = ownDataField(d, 'wsPath');
|
|
37
31
|
return {
|
|
38
32
|
kind: 'present',
|
|
39
33
|
management,
|
|
@@ -108,9 +102,6 @@ export function deviceExecutorManagementDoctorDetail(reading) {
|
|
|
108
102
|
}
|
|
109
103
|
}
|
|
110
104
|
}
|
|
111
|
-
export function forgetDeviceExecutorManagementReading(baseUrl) {
|
|
112
|
-
reader.forget(baseUrl);
|
|
113
|
-
}
|
|
114
105
|
export function __resetDeviceExecutorManagementReadingsForTests() {
|
|
115
106
|
reader.__resetForTests();
|
|
116
107
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { AgentClient } from '@sema-agent/sdk';
|
|
2
|
+
export type DeviceListVerb = Pick<AgentClient['devices'], 'list'>;
|
|
3
|
+
export type DeviceSessionBindingVerb = Pick<AgentClient['devices'], 'sessionBinding'>;
|
|
4
|
+
export type DeviceRebindVerb = Pick<AgentClient['devices'], 'rebind'>;
|
|
5
|
+
export interface DeviceRosterRow {
|
|
6
|
+
readonly deviceId: string;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly status: 'online' | 'offline' | 'unknown';
|
|
9
|
+
readonly lastSeenAt?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DeviceBindingReading {
|
|
12
|
+
readonly deviceId: string;
|
|
13
|
+
readonly rev: number;
|
|
14
|
+
readonly boundAt?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DeviceRefused {
|
|
17
|
+
readonly kind: 'refused';
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly errorCode?: string;
|
|
20
|
+
readonly message?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DeviceLaneAbsent {
|
|
23
|
+
readonly kind: 'lane-absent';
|
|
24
|
+
readonly runStoreOnly?: true;
|
|
25
|
+
}
|
|
26
|
+
export interface DeviceTransport {
|
|
27
|
+
readonly kind: 'transport';
|
|
28
|
+
readonly detail?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DeviceUnreadable {
|
|
31
|
+
readonly kind: 'unreadable';
|
|
32
|
+
readonly why: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DeviceUnarmed {
|
|
35
|
+
readonly kind: 'unarmed';
|
|
36
|
+
}
|
|
37
|
+
export type DeviceListOutcome = {
|
|
38
|
+
readonly kind: 'ok';
|
|
39
|
+
readonly devices: readonly DeviceRosterRow[];
|
|
40
|
+
readonly dropped: number;
|
|
41
|
+
} | DeviceUnreadable | DeviceLaneAbsent | DeviceRefused | DeviceTransport | DeviceUnarmed;
|
|
42
|
+
export type DeviceSessionBindingOutcome = {
|
|
43
|
+
readonly kind: 'ok';
|
|
44
|
+
readonly rootSessionId: string;
|
|
45
|
+
readonly boundDevice: DeviceBindingReading;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'not-found';
|
|
48
|
+
} | DeviceUnreadable | DeviceLaneAbsent | DeviceRefused | DeviceTransport | DeviceUnarmed;
|
|
49
|
+
export interface DeviceRebindInput {
|
|
50
|
+
readonly rootSessionId: string;
|
|
51
|
+
readonly toDeviceId: string;
|
|
52
|
+
readonly expectedRev: number;
|
|
53
|
+
readonly fromDeviceId: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DeviceRebindUnconfirmed {
|
|
56
|
+
readonly kind: 'unconfirmed';
|
|
57
|
+
readonly why: 'accepted-unreadable' | 'transport' | 'server-error';
|
|
58
|
+
readonly detail?: string;
|
|
59
|
+
readonly mayStillBeRunning: boolean;
|
|
60
|
+
}
|
|
61
|
+
export type DeviceRebindOutcome = {
|
|
62
|
+
readonly kind: 'ok';
|
|
63
|
+
readonly deviceId: string;
|
|
64
|
+
readonly rev: number;
|
|
65
|
+
readonly workspaceCarryover?: 'none';
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: 'active-run';
|
|
68
|
+
readonly activeTaskId?: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: 'rev-conflict';
|
|
71
|
+
readonly currentRev?: number;
|
|
72
|
+
} | {
|
|
73
|
+
readonly kind: 'not-found';
|
|
74
|
+
} | DeviceRebindUnconfirmed | DeviceLaneAbsent | DeviceRefused | DeviceUnarmed;
|
|
75
|
+
export type DeviceRebindReconcileVerdict = 'landed' | 'already-there' | 'unchanged' | 'unknown';
|
|
76
|
+
export declare function listDevices(devices: DeviceListVerb | null | undefined, opts?: {
|
|
77
|
+
readonly signal?: AbortSignal | undefined;
|
|
78
|
+
}): Promise<DeviceListOutcome>;
|
|
79
|
+
export declare function readSessionBinding(devices: DeviceSessionBindingVerb | null | undefined, rootSessionId: string, opts?: {
|
|
80
|
+
readonly signal?: AbortSignal | undefined;
|
|
81
|
+
}): Promise<DeviceSessionBindingOutcome>;
|
|
82
|
+
export declare function rebindSession(devices: DeviceRebindVerb | null | undefined, req: DeviceRebindInput, opts?: {
|
|
83
|
+
readonly signal?: AbortSignal | undefined;
|
|
84
|
+
}): Promise<DeviceRebindOutcome>;
|
|
85
|
+
export declare function reconcileRebindOutcome(before: DeviceBindingReading, toDeviceId: string, after: DeviceBindingReading | null, opts: {
|
|
86
|
+
readonly serverMayStillBeRunning: boolean;
|
|
87
|
+
}): DeviceRebindReconcileVerdict;
|
|
88
|
+
export declare function rebindProvesRequestNotApplied(outcome: DeviceRebindOutcome): boolean;
|