@sema-agent/client-core 0.93.1 → 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 +554 -0
- package/README.md +89 -55
- package/dist/adapt/arms.js +13 -11
- 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 +13 -6
- 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 +5 -3
- package/dist/agentsWireCaps.d.ts +17 -0
- package/dist/agentsWireCaps.js +111 -1
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalReachWire.d.ts +18 -0
- package/dist/approvalReachWire.js +58 -0
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +15 -14
- 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 +15 -0
- package/dist/callerCwdCapability.js +42 -0
- 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/controlRouter.js +3 -10
- package/dist/coreValuePorts.d.ts +64 -1
- package/dist/coreValuePorts.js +30 -0
- 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/detachWire.d.ts +1 -4
- package/dist/detachWire.js +1 -1
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +36 -40
- package/dist/deviceFlowPolling.d.ts +5 -0
- package/dist/deviceFlowPolling.js +28 -0
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +963 -30
- 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 +19 -4
- package/dist/engineErrorCodes.js +39 -21
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +22 -2
- package/dist/engineNoticeCodes.js +73 -6
- package/dist/engineRefusedToolName.d.ts +1 -0
- package/dist/engineRefusedToolName.js +8 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +28 -28
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +13 -12
- package/dist/fileHistoryLegNotice.d.ts +14 -2
- package/dist/fileHistoryLegNotice.js +101 -15
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +74 -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.d.ts +2 -1
- package/dist/gateOutcome.js +33 -18
- package/dist/gateVocabulary.js +1 -1
- package/dist/generated/engineAskFaceTables.d.ts +3 -0
- package/dist/generated/engineAskFaceTables.js +12 -0
- package/dist/generated/engineFactTables.d.ts +4 -2
- package/dist/generated/engineFactTables.js +13 -0
- package/dist/generated/engineNoticeTables.d.ts +5 -0
- package/dist/generated/engineNoticeTables.js +7 -0
- package/dist/generated/sdkFactTables.d.ts +5 -0
- package/dist/generated/sdkFactTables.js +34 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +3 -0
- package/dist/headlessPermissionModeWire.d.ts +2 -2
- package/dist/headlessPermissionModeWire.js +11 -21
- 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 +46 -0
- package/dist/hitl/approvalHolds.js +140 -0
- package/dist/hitl/approvalOutcomeNote.js +2 -1
- package/dist/hitl/approvalResolution.js +9 -1
- package/dist/hitl/approvalsFeed.js +23 -6
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +29 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +8 -2
- package/dist/hitl/automaticAnswerVerdict.js +71 -23
- 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 +23 -0
- package/dist/hitl/decisionRefusal.js +88 -0
- package/dist/hitl/frameRouter.d.ts +10 -0
- package/dist/hitl/frameRouter.js +71 -32
- package/dist/hitl/gateLedger.d.ts +8 -0
- package/dist/hitl/gateLedger.js +38 -0
- package/dist/hitl/hitlBridge.d.ts +14 -3
- package/dist/hitl/hitlBridge.js +75 -62
- package/dist/hitl/hitlHostSurface.d.ts +3 -0
- package/dist/hitl/hitlHostSurface.js +17 -15
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.js +2 -1
- package/dist/hitl/noAllowCause.d.ts +9 -0
- package/dist/hitl/noAllowCause.js +26 -0
- 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 +55 -28
- package/dist/hitl/parkRowBirthWait.js +2 -1
- package/dist/hitl/persistedRulesWire.d.ts +6 -1
- package/dist/hitl/persistedRulesWire.js +16 -4
- package/dist/hitl/planReviewWire.d.ts +2 -3
- package/dist/hitl/planReviewWire.js +86 -39
- 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/sessionPolicyDeliverable.d.ts +1 -1
- package/dist/hitl/sessionPolicyDeliverable.js +3 -8
- package/dist/hitl/sessionPolicyWire.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +50 -5
- package/dist/hitl/toolApprovalWire.js +368 -56
- 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/humanTurnRead.d.ts +15 -1
- package/dist/humanTurnRead.js +28 -2
- package/dist/index.d.ts +45 -14
- package/dist/index.js +33 -12
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -1
- package/dist/limitsWire.js +51 -13
- package/dist/liveModelCatalog.d.ts +109 -0
- package/dist/liveModelCatalog.js +344 -18
- 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 +13 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +20 -10
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +14 -13
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +14 -13
- 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 +4 -2
- package/dist/modelIdentityResolvability.js +25 -5
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +15 -0
- package/dist/outputStyleSeatCapability.js +42 -0
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +58 -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 +15 -14
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- package/dist/permissionRuleIssue.js +1 -1
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +15 -14
- package/dist/permissionsAllowGrantCapability.d.ts +2 -1
- package/dist/permissionsAllowGrantCapability.js +35 -19
- package/dist/permissionsDeclaration.d.ts +16 -1
- package/dist/permissionsDeclaration.js +142 -15
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +1 -0
- package/dist/protocolSegment.js +13 -1
- package/dist/request/taskRequest.d.ts +11 -3
- package/dist/request/taskRequest.js +13 -1
- package/dist/resultFrameKeys.d.ts +4 -0
- package/dist/resultFrameKeys.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +132 -31
- package/dist/retryStatus.js +6 -4
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +28 -15
- 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/{hitl/rosterMountedNames.d.ts → rosterMountedNames.d.ts} +1 -1
- package/dist/runCancelContext.js +2 -1
- 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 +19 -20
- package/dist/seatContract.d.ts +85 -28
- package/dist/seatContract.js +512 -148
- 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 +14 -13
- package/dist/sessionReadRedactionCapability.d.ts +15 -0
- package/dist/sessionReadRedactionCapability.js +42 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +13 -12
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +13 -12
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +21 -21
- package/dist/steerPriorityCapability.d.ts +0 -1
- package/dist/steerPriorityCapability.js +18 -19
- 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/agentStateDetail.d.ts +1 -0
- package/dist/subagent/agentStateDetail.js +41 -0
- package/dist/subagent/engineCompactWire.d.ts +15 -0
- package/dist/subagent/engineCompactWire.js +82 -45
- 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/taskRequestWords.d.ts +2 -4
- package/dist/taskRequestWords.js +3 -2
- 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/userAttachmentEnvelope.d.ts +22 -1
- package/dist/userAttachmentEnvelope.js +90 -2
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +13 -12
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +20 -19
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +11 -0
- package/dist/wireErrorTriage.js +35 -0
- package/dist/wireFailureShape.d.ts +10 -0
- package/dist/wireFailureShape.js +72 -5
- package/dist/wireRefusalCopy.d.ts +6 -1
- package/dist/wireRefusalCopy.js +23 -25
- package/dist/wiringInstructionsAttribution.d.ts +10 -0
- package/dist/wiringInstructionsAttribution.js +67 -0
- package/dist/workflowClient.js +19 -2
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +13 -12
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +26 -26
- package/docs/INTEGRATION-CLIENTS.md +1733 -52
- package/package.json +5 -5
- package/dist/askSurvivesStandingAnswer.d.ts +0 -13
- package/dist/askSurvivesStandingAnswer.js +0 -53
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/hitl/askSurvivesPosture.d.ts +0 -20
- package/dist/hitl/askSurvivesPosture.js +0 -48
- 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
- /package/dist/{hitl/rosterMountedNames.js → rosterMountedNames.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readErrorNumber, readErrorString } from './wireFailureShape.js';
|
|
2
2
|
import { readOwnDataNonEmptyString } from './ownKey.js';
|
|
3
|
-
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, RESUME_SESSION_NOT_FOUND, REQUEST_FIELD_CONFLICT, CHECKPOINT_UNSUPPORTED_VERSION, refusalSaysStillPending, } from './engineErrorCodes.js';
|
|
3
|
+
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, RESUME_SESSION_NOT_FOUND, REQUEST_FIELD_CONFLICT, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED, refusalSaysStillPending, refusalRetriableReading, } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
|
+
import { engineVersionTier } from './supportFloor.js';
|
|
5
6
|
import { resumeRetryLaterFromError } from './wireErrorTriage.js';
|
|
6
7
|
export const RESUME_REFUSAL_CODES = Object.freeze([
|
|
7
8
|
RESUME_PLACEMENT_MISMATCH,
|
|
@@ -87,10 +88,9 @@ export function resumePolicyBlockContent(detail) {
|
|
|
87
88
|
].join(' · ');
|
|
88
89
|
}
|
|
89
90
|
export { resumeReopenFromError, resumeReopenContent } from './hitl/suspendedReopen.js';
|
|
90
|
-
const RESUME_SESSION_NOT_FOUND_TAIL = `(${RESUME_SESSION_NOT_FOUND})`;
|
|
91
91
|
const REQUIRE_EXISTING_BY_STATUS = new Map([
|
|
92
|
-
[404, Object.freeze({ form: 'session_not_found', code: RESUME_SESSION_NOT_FOUND
|
|
93
|
-
[422, Object.freeze({ form: 'session_id_missing', code: REQUEST_FIELD_CONFLICT
|
|
92
|
+
[404, Object.freeze({ form: 'session_not_found', code: RESUME_SESSION_NOT_FOUND })],
|
|
93
|
+
[422, Object.freeze({ form: 'session_id_missing', code: REQUEST_FIELD_CONFLICT })],
|
|
94
94
|
]);
|
|
95
95
|
export function requireExistingSessionRefusalFromError(err) {
|
|
96
96
|
if (typeof err !== 'object' || err === null)
|
|
@@ -101,15 +101,7 @@ export function requireExistingSessionRefusalFromError(err) {
|
|
|
101
101
|
const byStatus = typeof status === 'number' ? REQUIRE_EXISTING_BY_STATUS.get(status) : undefined;
|
|
102
102
|
if (byStatus === undefined)
|
|
103
103
|
return null;
|
|
104
|
-
|
|
105
|
-
if (code === byStatus.code)
|
|
106
|
-
return Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form });
|
|
107
|
-
if (code !== byStatus.coarse)
|
|
108
|
-
return null;
|
|
109
|
-
const message = o['message'];
|
|
110
|
-
return typeof message === 'string' && message.endsWith(RESUME_SESSION_NOT_FOUND_TAIL)
|
|
111
|
-
? Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form })
|
|
112
|
-
: null;
|
|
104
|
+
return o['errorCode'] === byStatus.code ? Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form }) : null;
|
|
113
105
|
}
|
|
114
106
|
catch {
|
|
115
107
|
return null;
|
|
@@ -149,13 +141,13 @@ export function resumeContextUnavailableFromError(err) {
|
|
|
149
141
|
}
|
|
150
142
|
export function resumeContextUnavailableContent(d) {
|
|
151
143
|
const sec = d.staleAfterSec;
|
|
152
|
-
const retention = typeof sec === 'number' && Number.isSafeInteger(sec) && sec >= 1 ? `(
|
|
144
|
+
const retention = typeof sec === 'number' && Number.isSafeInteger(sec) && sec >= 1 ? ` (this deployment keeps conversations for ${sec} seconds)` : '';
|
|
153
145
|
const third = (d.runId !== undefined
|
|
154
|
-
? '
|
|
155
|
-
: '
|
|
146
|
+
? "The error carries this run's id: use it to recover the run yourself, then decide again; raising the conversation retention time only prevents this from happening again and cannot rescue this one"
|
|
147
|
+
: 'The error carries no run id: go back to the run list, find this run and recover it yourself, then decide again; raising the conversation retention time only prevents this from happening again and cannot rescue this one') + retention;
|
|
156
148
|
return [
|
|
157
|
-
'
|
|
158
|
-
'
|
|
149
|
+
'This approval has nowhere to be delivered: the conversation that started this run has no usable context to continue it right now',
|
|
150
|
+
'Nothing was decided and your decision was not consumed; this card is still waiting',
|
|
159
151
|
third,
|
|
160
152
|
].join(' · ');
|
|
161
153
|
}
|
|
@@ -167,17 +159,7 @@ function parkedResumeStartupCauseWord(err) {
|
|
|
167
159
|
catch {
|
|
168
160
|
named = undefined;
|
|
169
161
|
}
|
|
170
|
-
|
|
171
|
-
return named;
|
|
172
|
-
try {
|
|
173
|
-
const extra = err.extra;
|
|
174
|
-
if (typeof extra !== 'object' || extra === null || Array.isArray(extra))
|
|
175
|
-
return undefined;
|
|
176
|
-
return readOwnDataNonEmptyString(extra, 'cause');
|
|
177
|
-
}
|
|
178
|
-
catch {
|
|
179
|
-
return undefined;
|
|
180
|
-
}
|
|
162
|
+
return named;
|
|
181
163
|
}
|
|
182
164
|
export function parkedResumeStartupFromError(err, decision) {
|
|
183
165
|
if (typeof err !== 'object' || err === null)
|
|
@@ -231,7 +213,15 @@ export function checkpointUnsupportedVersionFromError(err) {
|
|
|
231
213
|
}
|
|
232
214
|
if (code !== CHECKPOINT_UNSUPPORTED_VERSION || !refusalSaysStillPending(err))
|
|
233
215
|
return null;
|
|
234
|
-
|
|
216
|
+
const writerVersion = readErrorString(err, 'writerVersion');
|
|
217
|
+
const readerVersion = readErrorString(err, 'readerVersion');
|
|
218
|
+
const versions = writerVersion !== undefined && writerVersion !== '' && readerVersion !== undefined && readerVersion !== '' ? { writerVersion, readerVersion } : {};
|
|
219
|
+
return { code: CHECKPOINT_UNSUPPORTED_VERSION, retriable: true, ...versions };
|
|
220
|
+
}
|
|
221
|
+
function writerEngineIsNewer(writer, reader) {
|
|
222
|
+
if (engineVersionTier(writer) === 'unknown' || engineVersionTier(reader) !== 'engine')
|
|
223
|
+
return false;
|
|
224
|
+
return engineVersionTier(reader, writer) === 'legacy';
|
|
235
225
|
}
|
|
236
226
|
function checkpointUnsupportedHasRun(kind) {
|
|
237
227
|
switch (kind) {
|
|
@@ -250,7 +240,23 @@ const CHECKPOINT_UNSUPPORTED_WHAT = 'This server cannot continue this parked wor
|
|
|
250
240
|
const CHECKPOINT_UNSUPPORTED_STILL_WAITING = 'Nothing was decided or resumed and the parked work is still waiting, but sending the same request again will not by itself continue it';
|
|
251
241
|
const CHECKPOINT_UNSUPPORTED_DRAIN = " — whoever operates this deployment can find such parked work before an upgrade with the server's pre-upgrade drain check";
|
|
252
242
|
export function checkpointUnsupportedVersionContent(detail, ctx) {
|
|
253
|
-
|
|
243
|
+
let writer;
|
|
244
|
+
let reader;
|
|
245
|
+
try {
|
|
246
|
+
writer = detail.writerVersion;
|
|
247
|
+
reader = detail.readerVersion;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
writer = undefined;
|
|
251
|
+
reader = undefined;
|
|
252
|
+
}
|
|
253
|
+
if (writerEngineIsNewer(writer, reader)) {
|
|
254
|
+
return [
|
|
255
|
+
`This parked work was stored by a newer engine version (${String(writer)}) than this engine (${String(reader)})`,
|
|
256
|
+
CHECKPOINT_UNSUPPORTED_STILL_WAITING,
|
|
257
|
+
`Continue it on an engine at version ${String(writer)} or newer`,
|
|
258
|
+
].join(' · ');
|
|
259
|
+
}
|
|
254
260
|
let kind;
|
|
255
261
|
let runId;
|
|
256
262
|
try {
|
|
@@ -276,3 +282,98 @@ export function checkpointUnsupportedVersionContent(detail, ctx) {
|
|
|
276
282
|
}
|
|
277
283
|
return [CHECKPOINT_UNSUPPORTED_WHAT, CHECKPOINT_UNSUPPORTED_STILL_WAITING, outlet + CHECKPOINT_UNSUPPORTED_DRAIN].join(' · ');
|
|
278
284
|
}
|
|
285
|
+
const REFUSED_PARK_CODES = new Set([CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED]);
|
|
286
|
+
const REFUSED_PARK_FIELD_TOKEN = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
287
|
+
export function refusedParkFromError(failure) {
|
|
288
|
+
if (typeof failure !== 'object' || failure === null)
|
|
289
|
+
return null;
|
|
290
|
+
let code;
|
|
291
|
+
let status;
|
|
292
|
+
try {
|
|
293
|
+
code = failure.errorCode;
|
|
294
|
+
status = failure.status;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if (typeof code !== 'string' || !REFUSED_PARK_CODES.has(code))
|
|
300
|
+
return null;
|
|
301
|
+
if (status !== undefined && status !== 409)
|
|
302
|
+
return null;
|
|
303
|
+
const reading = refusalRetriableReading(failure);
|
|
304
|
+
const stillPending = reading === true ? true : status === 409 && reading === false ? false : undefined;
|
|
305
|
+
const rawField = code === CHECKPOINT_CONFIG_REFUSED ? readErrorString(failure, 'field') : undefined;
|
|
306
|
+
const field = rawField !== undefined && REFUSED_PARK_FIELD_TOKEN.test(rawField) ? rawField : undefined;
|
|
307
|
+
return Object.freeze({
|
|
308
|
+
code: code,
|
|
309
|
+
...(field !== undefined ? { field } : {}),
|
|
310
|
+
...(stillPending !== undefined ? { stillPending } : {}),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function refusedParkShownRunId(runId) {
|
|
314
|
+
return typeof runId === 'string' && /^[A-Za-z0-9._:-]{1,128}$/.test(runId) ? runId : undefined;
|
|
315
|
+
}
|
|
316
|
+
function refusedParkWhy(code, field) {
|
|
317
|
+
switch (code) {
|
|
318
|
+
case CHECKPOINT_WALLTIME_AXIS_RETIRED:
|
|
319
|
+
return 'its run carries a wall-clock time allowance, which this engine version no longer enforces';
|
|
320
|
+
case CHECKPOINT_CONFIG_REFUSED:
|
|
321
|
+
return field === 'inheritedGate'
|
|
322
|
+
? 'the permission-mode setting it was parked with can no longer be read'
|
|
323
|
+
: 'the engine refuses the task configuration it was parked with';
|
|
324
|
+
default:
|
|
325
|
+
return 'it was parked under conditions this engine version does not support (for example, by an earlier engine version)';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
export function refusedParkContent(input) {
|
|
329
|
+
let what;
|
|
330
|
+
let lane;
|
|
331
|
+
let runId;
|
|
332
|
+
let rawCode;
|
|
333
|
+
let field;
|
|
334
|
+
let stillPending;
|
|
335
|
+
try {
|
|
336
|
+
what = input.what;
|
|
337
|
+
lane = input.lane;
|
|
338
|
+
runId = input.runId;
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
what = lane = runId = undefined;
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const facts = input.facts;
|
|
345
|
+
rawCode = facts.code;
|
|
346
|
+
field = facts.field;
|
|
347
|
+
stillPending = facts.stillPending;
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
rawCode = field = stillPending = undefined;
|
|
351
|
+
}
|
|
352
|
+
const code = rawCode === CHECKPOINT_WALLTIME_AXIS_RETIRED || rawCode === CHECKPOINT_CONFIG_REFUSED ? rawCode : CHECKPOINT_UNSUPPORTED_VERSION;
|
|
353
|
+
const shownWhat = typeof what === 'string' && what !== '' ? capForDisplay(what, 40) : 'parked step';
|
|
354
|
+
const why = refusedParkWhy(code, typeof field === 'string' ? field : undefined);
|
|
355
|
+
const shownRun = refusedParkShownRunId(runId);
|
|
356
|
+
const head = `This ${shownWhat} cannot be resumed by this engine version: ${why}. The same refusal comes back every time, so ` +
|
|
357
|
+
`answering it again will not help (nothing was decided and nothing was resumed).`;
|
|
358
|
+
const configMayReturn = code === CHECKPOINT_CONFIG_REFUSED && field !== 'inheritedGate' ? ' If that configuration is restored, the same answer can go through again.' : '';
|
|
359
|
+
if (lane === 'print') {
|
|
360
|
+
if (stillPending === false) {
|
|
361
|
+
return `${head} The engine ended that run (${code}); submit the work again as a new task.`;
|
|
362
|
+
}
|
|
363
|
+
const cancel = `POST /v1/runs/${shownRun ?? '<run id>'}/cancel`;
|
|
364
|
+
return `${head}${configMayReturn} The parked run still holds this session (${code}): cancel it (${cancel}), then submit the work again as a new task.`;
|
|
365
|
+
}
|
|
366
|
+
if (stillPending === false) {
|
|
367
|
+
return `${head} The engine ended that parked run, so this conversation is free: send the work again as a new message.`;
|
|
368
|
+
}
|
|
369
|
+
return `${head}${configMayReturn} The parked run keeps this conversation busy until it is cancelled.`;
|
|
370
|
+
}
|
|
371
|
+
export function refusedParkBlockedContent(taskId, lane = 'interactive') {
|
|
372
|
+
const runId = refusedParkShownRunId(taskId);
|
|
373
|
+
const head = `sema will not put the card for run ${runId ?? '<unknown>'} back on screen by itself: this engine version refuses to resume it.`;
|
|
374
|
+
if (lane === 'print') {
|
|
375
|
+
return `${head} Cancel the run (POST /v1/runs/${runId ?? '<run id>'}/cancel) and submit the work again as a new task.`;
|
|
376
|
+
}
|
|
377
|
+
return (`${head} To free this conversation, send a message to bring the card back and answer it — sema then offers to cancel ` +
|
|
378
|
+
`that run, after which you can send the work again as a new message.`);
|
|
379
|
+
}
|
package/dist/retryStatus.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { displayUntrusted } from './displayUntrusted.js';
|
|
1
2
|
export const BRAIN_STATUS_PHASES = [
|
|
2
3
|
'rate_limited',
|
|
3
4
|
'retrying',
|
|
@@ -40,6 +41,7 @@ export function mapBrainStatusToRetry(p, nowMs) {
|
|
|
40
41
|
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
41
42
|
};
|
|
42
43
|
const stalledDetail = typeof p.detail === 'string' && p.detail.length > 0 ? { detail: p.detail } : {};
|
|
44
|
+
const shown = (absent) => (typeof p.detail === 'string' ? displayUntrusted(p.detail) : absent);
|
|
43
45
|
const extra = { ...counts, ...cause, ...producerTiming, ...failureStatus, ...waitProgress };
|
|
44
46
|
switch (p.phase) {
|
|
45
47
|
case 'recovered':
|
|
@@ -47,20 +49,20 @@ export function mapBrainStatusToRetry(p, nowMs) {
|
|
|
47
49
|
case 'reconnecting':
|
|
48
50
|
return { kind: 'stalled', deadline, ...extra, ...stalledDetail };
|
|
49
51
|
case 'rate_limited':
|
|
50
|
-
return { kind: 'error', deadline, ...extra, error: { formatted:
|
|
52
|
+
return { kind: 'error', deadline, ...extra, error: { formatted: shown(''), rateLimits: null } };
|
|
51
53
|
case 'circuit_open':
|
|
52
54
|
return {
|
|
53
55
|
kind: 'error',
|
|
54
56
|
deadline,
|
|
55
57
|
...extra,
|
|
56
|
-
error: { formatted:
|
|
58
|
+
error: { formatted: shown('Service temporarily unavailable'), isNetworkDown: true },
|
|
57
59
|
};
|
|
58
60
|
case 'gave_up':
|
|
59
|
-
return { kind: 'error', deadline, terminal: true, ...extra, error: { formatted:
|
|
61
|
+
return { kind: 'error', deadline, terminal: true, ...extra, error: { formatted: shown('') } };
|
|
60
62
|
case 'waiting_first_token':
|
|
61
63
|
return { kind: 'waiting', deadline, ...extra, error: { formatted: '' } };
|
|
62
64
|
case 'retrying':
|
|
63
|
-
return { kind: 'error', deadline, ...extra, error: { formatted:
|
|
65
|
+
return { kind: 'error', deadline, ...extra, error: { formatted: shown('') } };
|
|
64
66
|
default:
|
|
65
67
|
return { kind: 'error', deadline, ...extra, error: { formatted: '' } };
|
|
66
68
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RewindMode } from './rewindWireCaps.js';
|
|
1
2
|
export type RewindArchiveBit = 'on' | 'off' | 'not_reported' | 'malformed';
|
|
2
3
|
export type RewindArchiveReading = {
|
|
3
4
|
kind: 'unobserved';
|
|
@@ -18,7 +19,7 @@ export declare function observedRewindArchive(baseUrl?: string | undefined): Rew
|
|
|
18
19
|
export declare function rewindCodeArchiveAvailability(reading: RewindArchiveReading, mode: RewindArchiveMode): RewindCodeArchive;
|
|
19
20
|
export declare function rewindArchiveDoctorDetail(reading: RewindArchiveReading, mode: RewindArchiveMode): string;
|
|
20
21
|
export declare function rewindConversationAvailability(reading: RewindArchiveReading): RewindCodeArchive;
|
|
22
|
+
export declare function engineRewindRefusedNow(option: RewindMode, reading?: RewindArchiveReading): boolean;
|
|
21
23
|
export declare function rewindConversationDoctorDetail(reading: RewindArchiveReading): string;
|
|
22
24
|
export declare function rewindRestoreFilesEpochDetail(reading: RewindArchiveReading): string;
|
|
23
|
-
export declare function forgetRewindArchiveReading(baseUrl: string | undefined): void;
|
|
24
25
|
export declare function __resetRewindArchiveReadingsForTests(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
import { _wireConversationRewindJudge } from './toolHistoryMismatch.js';
|
|
4
5
|
const CAPS_KEYS = {
|
|
5
6
|
conversationAnchor: 'resumeAt',
|
|
@@ -10,9 +11,7 @@ const CAPS_KEYS = {
|
|
|
10
11
|
const _capsKeyPin = true;
|
|
11
12
|
void _capsKeyPin;
|
|
12
13
|
function bitOf(caps, key) {
|
|
13
|
-
|
|
14
|
-
return 'not_reported';
|
|
15
|
-
const v = caps[key];
|
|
14
|
+
const v = ownDataField(caps, key);
|
|
16
15
|
if (v === undefined)
|
|
17
16
|
return 'not_reported';
|
|
18
17
|
if (v === true)
|
|
@@ -22,15 +21,20 @@ function bitOf(caps, key) {
|
|
|
22
21
|
return 'malformed';
|
|
23
22
|
}
|
|
24
23
|
export function projectRewindArchiveCapability(caps) {
|
|
25
|
-
|
|
24
|
+
try {
|
|
25
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
26
|
+
return undefined;
|
|
27
|
+
return {
|
|
28
|
+
kind: 'present',
|
|
29
|
+
conversationAnchor: bitOf(caps, CAPS_KEYS.conversationAnchor),
|
|
30
|
+
forkRestore: bitOf(caps, CAPS_KEYS.forkRestore),
|
|
31
|
+
codeOnly: bitOf(caps, CAPS_KEYS.codeOnly),
|
|
32
|
+
restoreFilesEpoch: bitOf(caps, CAPS_KEYS.restoreFilesEpoch),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
26
36
|
return undefined;
|
|
27
|
-
|
|
28
|
-
kind: 'present',
|
|
29
|
-
conversationAnchor: bitOf(caps, CAPS_KEYS.conversationAnchor),
|
|
30
|
-
forkRestore: bitOf(caps, CAPS_KEYS.forkRestore),
|
|
31
|
-
codeOnly: bitOf(caps, CAPS_KEYS.codeOnly),
|
|
32
|
-
restoreFilesEpoch: bitOf(caps, CAPS_KEYS.restoreFilesEpoch),
|
|
33
|
-
};
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
const reader = createEngineCapReader({
|
|
36
40
|
name: 'rewindArchive',
|
|
@@ -38,12 +42,12 @@ const reader = createEngineCapReader({
|
|
|
38
42
|
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
39
43
|
});
|
|
40
44
|
export function noteEngineCapsForRewindArchive(baseUrl, caps, opts) {
|
|
41
|
-
_wireConversationRewindJudge(conversationRewindJudge);
|
|
42
45
|
reader.note(baseUrl, caps, opts);
|
|
43
46
|
}
|
|
44
47
|
function conversationRewindJudge(engineBaseUrl) {
|
|
45
48
|
return rewindConversationAvailability(observedRewindArchive(engineBaseUrl));
|
|
46
49
|
}
|
|
50
|
+
_wireConversationRewindJudge(conversationRewindJudge);
|
|
47
51
|
export function observedRewindArchive(baseUrl = engineWireTarget()?.baseUrl) {
|
|
48
52
|
return reader.observed(baseUrl);
|
|
49
53
|
}
|
|
@@ -91,6 +95,18 @@ export function rewindConversationAvailability(reading) {
|
|
|
91
95
|
return 'unavailable';
|
|
92
96
|
return 'unknown';
|
|
93
97
|
}
|
|
98
|
+
export function engineRewindRefusedNow(option, reading = observedRewindArchive()) {
|
|
99
|
+
switch (option) {
|
|
100
|
+
case 'both':
|
|
101
|
+
return rewindCodeArchiveAvailability(reading, 'both') === 'unavailable';
|
|
102
|
+
case 'code':
|
|
103
|
+
return rewindCodeArchiveAvailability(reading, 'code') === 'unavailable';
|
|
104
|
+
case 'conversation':
|
|
105
|
+
return rewindConversationAvailability(reading) === 'unavailable';
|
|
106
|
+
default:
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
94
110
|
export function rewindConversationDoctorDetail(reading) {
|
|
95
111
|
const lane = 'rewind to a message';
|
|
96
112
|
if (reading.kind !== 'present') {
|
|
@@ -122,9 +138,6 @@ export function rewindRestoreFilesEpochDetail(reading) {
|
|
|
122
138
|
return 'the restore-files epoch bit is reported in an unreadable shape, so a rewind with code restore built from this reading leaves the key out and moves the conversation only';
|
|
123
139
|
}
|
|
124
140
|
}
|
|
125
|
-
export function forgetRewindArchiveReading(baseUrl) {
|
|
126
|
-
reader.forget(baseUrl);
|
|
127
|
-
}
|
|
128
141
|
export function __resetRewindArchiveReadingsForTests() {
|
|
129
142
|
reader.__resetForTests();
|
|
130
143
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RewindArchiveReading } from './rewindArchiveCapability.js';
|
|
2
|
+
import { type RewindMode, type SeamRewindSpec } from './rewindWireCaps.js';
|
|
3
|
+
export type RewindRestoreOption = RewindMode | 'summarize' | 'summarize_up_to' | 'nevermind';
|
|
4
|
+
export type RewindTargetPosition = 'root' | 'after-root' | 'unknown';
|
|
5
|
+
export interface RewindTargetResolution {
|
|
6
|
+
readonly position: RewindTargetPosition;
|
|
7
|
+
readonly targetEntryId?: string;
|
|
8
|
+
readonly anchorUnresolved?: true;
|
|
9
|
+
}
|
|
10
|
+
export type RewindEngineNoneReason = 'not-an-engine-rewind' | 'no-engine-turn-to-rewind' | 'unresolved';
|
|
11
|
+
export type RewindEngineAction = {
|
|
12
|
+
readonly kind: 'none';
|
|
13
|
+
readonly reason: RewindEngineNoneReason;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'arm';
|
|
16
|
+
readonly spec: SeamRewindSpec;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'reopen';
|
|
19
|
+
};
|
|
20
|
+
export declare function decideRewindEngineAction(option: RewindRestoreOption, resolved: RewindTargetResolution, reading?: RewindArchiveReading): RewindEngineAction;
|
|
21
|
+
export declare function previewEngineRewind(option: RewindRestoreOption, resolved: RewindTargetResolution, reading?: RewindArchiveReading): RewindEngineAction['kind'];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { observedRewindArchive } from './rewindArchiveCapability.js';
|
|
2
|
+
import { REWIND_MODES, rewindSpecForMode } from './rewindWireCaps.js';
|
|
3
|
+
import { readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
4
|
+
function modeOfOption(option) {
|
|
5
|
+
return REWIND_MODES.includes(option) ? option : undefined;
|
|
6
|
+
}
|
|
7
|
+
function carriesResumeAt(mode) {
|
|
8
|
+
return rewindSpecForMode(mode, 'x').resumeAt !== undefined;
|
|
9
|
+
}
|
|
10
|
+
function positionOf(resolved) {
|
|
11
|
+
const p = readOwnDataValue(resolved, 'position');
|
|
12
|
+
return p === 'root' || p === 'after-root' ? p : 'unknown';
|
|
13
|
+
}
|
|
14
|
+
export function decideRewindEngineAction(option, resolved, reading = observedRewindArchive()) {
|
|
15
|
+
const mode = modeOfOption(option);
|
|
16
|
+
if (mode === undefined)
|
|
17
|
+
return { kind: 'none', reason: 'not-an-engine-rewind' };
|
|
18
|
+
const position = positionOf(resolved);
|
|
19
|
+
const targetEntryId = readOwnDataNonEmptyString(resolved, 'targetEntryId');
|
|
20
|
+
if (!carriesResumeAt(mode)) {
|
|
21
|
+
if (targetEntryId !== undefined)
|
|
22
|
+
return { kind: 'arm', spec: rewindSpecForMode(mode, targetEntryId, reading) };
|
|
23
|
+
const unresolved = position === 'unknown' || readOwnDataValue(resolved, 'anchorUnresolved') === true;
|
|
24
|
+
return { kind: 'none', reason: unresolved ? 'unresolved' : 'no-engine-turn-to-rewind' };
|
|
25
|
+
}
|
|
26
|
+
if (position === 'root')
|
|
27
|
+
return { kind: 'reopen' };
|
|
28
|
+
if (position === 'unknown')
|
|
29
|
+
return { kind: 'none', reason: 'unresolved' };
|
|
30
|
+
return targetEntryId !== undefined
|
|
31
|
+
? { kind: 'arm', spec: rewindSpecForMode(mode, targetEntryId, reading) }
|
|
32
|
+
: { kind: 'none', reason: 'no-engine-turn-to-rewind' };
|
|
33
|
+
}
|
|
34
|
+
export function previewEngineRewind(option, resolved, reading = observedRewindArchive()) {
|
|
35
|
+
return decideRewindEngineAction(option, resolved, reading).kind;
|
|
36
|
+
}
|
package/dist/rewindWireCaps.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface SeamRewindSpec {
|
|
|
5
5
|
restoreFiles?: boolean;
|
|
6
6
|
rewindFilesTo?: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export declare const REWIND_MODES: readonly ["both", "conversation", "code"];
|
|
9
|
+
export type RewindMode = (typeof REWIND_MODES)[number];
|
|
9
10
|
export declare function rewindSpecForMode(mode: RewindMode, targetEntryId: string, reading?: RewindArchiveReading): SeamRewindSpec;
|
|
10
11
|
export declare function projectRewind(pending: SeamRewindSpec | undefined): SeamRewindSpec;
|
package/dist/rewindWireCaps.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ToolRosterView } from '
|
|
1
|
+
import type { ToolRosterView } from './toolRoster.js';
|
|
2
2
|
export declare function rosterMountedNames(roster: ToolRosterView | null | undefined): ReadonlySet<string> | 'absent' | 'unreadable';
|
package/dist/runCancelContext.js
CHANGED
|
@@ -34,6 +34,7 @@ export function readRunCancelContext(record) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
import { readRunTerminal } from './runTerminal.js';
|
|
37
|
+
import { SDK_ABORT_CAUSES } from './generated/sdkFactTables.js';
|
|
37
38
|
export const RUN_CANCELLED_CODE = 'cancelled';
|
|
38
39
|
const LIVE_STATUSES = new Set(['running', 'queued', 'suspended', 'needs_review']);
|
|
39
40
|
export function classifyRunAbortCause(record) {
|
|
@@ -56,7 +57,7 @@ export function classifyRunAbortCause(record) {
|
|
|
56
57
|
return { kind: 'run_still_live', status };
|
|
57
58
|
return { kind: 'unknown', ...(read !== null ? { terminal: read.kind } : {}) };
|
|
58
59
|
}
|
|
59
|
-
export const ABORT_CAUSES =
|
|
60
|
+
export const ABORT_CAUSES = SDK_ABORT_CAUSES;
|
|
60
61
|
function ownDataOf(o, key) {
|
|
61
62
|
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
62
63
|
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
package/dist/runTerminal.d.ts
CHANGED
|
@@ -60,14 +60,3 @@ export declare function runTerminalGateKind(read: RunTerminalRead | null): strin
|
|
|
60
60
|
export declare function runTerminalGateToolName(read: RunTerminalRead | null): string | undefined;
|
|
61
61
|
export declare function runTerminalCode(read: RunTerminalRead | null): string | undefined;
|
|
62
62
|
export declare function isReviewPark(read: RunTerminalRead | null): boolean;
|
|
63
|
-
export declare const TERMINAL_CAUSE_KINDS: readonly ["completed", "failed", "blocked", "paused"];
|
|
64
|
-
export type TerminalCauseKind = (typeof TERMINAL_CAUSE_KINDS)[number];
|
|
65
|
-
export declare function isTerminalCauseKind(kind: unknown): kind is TerminalCauseKind;
|
|
66
|
-
export declare const RUN_TERMINAL_NOT_SUCCESS_STATUSES: readonly ["failed", "killed", "blocked"];
|
|
67
|
-
export type RunTerminalNotSuccessStatus = (typeof RUN_TERMINAL_NOT_SUCCESS_STATUSES)[number];
|
|
68
|
-
export declare function isTerminalNotSuccess(status: unknown): status is RunTerminalNotSuccessStatus;
|
|
69
|
-
export declare const RUN_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "blocked"];
|
|
70
|
-
export type RunTerminalStatus = (typeof RUN_TERMINAL_STATUSES)[number];
|
|
71
|
-
export declare function isTerminalStatus(status: unknown): status is RunTerminalStatus;
|
|
72
|
-
export declare const TASK_NOTIFICATION_TERMINAL_STATUSES: readonly string[];
|
|
73
|
-
export declare function isTaskNotificationTerminalStatus(status: string | undefined): boolean;
|
package/dist/runTerminal.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CORE_PROMPT_BLOCK_CAUSES
|
|
1
|
+
import { CORE_PROMPT_BLOCK_CAUSES } from './generated/engineFactTables.js';
|
|
2
|
+
import { isSdkRunParked } from './terminalStatuses.js';
|
|
2
3
|
export const PROMPT_BLOCK_CAUSES = CORE_PROMPT_BLOCK_CAUSES;
|
|
3
4
|
const PROMPT_BLOCKED_BY_HOOK_DETAIL_KIND = 'prompt_blocked_by_hook';
|
|
4
5
|
function str(v) {
|
|
@@ -69,7 +70,6 @@ function blockedDetailOf(cause) {
|
|
|
69
70
|
return undefined;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
const FLAT_PAUSED_STATUSES = ['suspended', 'needs_review'];
|
|
73
73
|
export function readRunTerminal(result) {
|
|
74
74
|
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
75
75
|
return null;
|
|
@@ -83,7 +83,7 @@ export function readRunTerminal(result) {
|
|
|
83
83
|
if (kind === undefined)
|
|
84
84
|
return { kind: 'unknown', plane: 'cause' };
|
|
85
85
|
const parkWord = str(r.status);
|
|
86
|
-
if (
|
|
86
|
+
if (isSdkRunParked(parkWord)) {
|
|
87
87
|
return { kind: 'paused', plane: 'cause', flatStatus: parkWord, ...(kind === 'paused' ? (pauseOf(c) ?? {}) : {}) };
|
|
88
88
|
}
|
|
89
89
|
switch (kind) {
|
|
@@ -138,7 +138,7 @@ export function readRunTerminal(result) {
|
|
|
138
138
|
...(code !== undefined ? { code } : {}),
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
if (
|
|
141
|
+
if (isSdkRunParked(status)) {
|
|
142
142
|
const gate = gateOf(r.checkpointGate);
|
|
143
143
|
const checkpointId = str(r.checkpointId);
|
|
144
144
|
const restoreMode = str(r.workspaceRestoreMode);
|
|
@@ -183,26 +183,3 @@ export function isReviewPark(read) {
|
|
|
183
183
|
return true;
|
|
184
184
|
return read !== null && read.kind === 'paused' && read.flatStatus === FLAT_REVIEW_STATUS;
|
|
185
185
|
}
|
|
186
|
-
export const TERMINAL_CAUSE_KINDS = CORE_TERMINAL_CAUSE_KINDS;
|
|
187
|
-
export function isTerminalCauseKind(kind) {
|
|
188
|
-
return typeof kind === 'string' && TERMINAL_CAUSE_KINDS.includes(kind);
|
|
189
|
-
}
|
|
190
|
-
export const RUN_TERMINAL_NOT_SUCCESS_STATUSES = Object.freeze([
|
|
191
|
-
'failed',
|
|
192
|
-
'killed',
|
|
193
|
-
'blocked',
|
|
194
|
-
]);
|
|
195
|
-
export function isTerminalNotSuccess(status) {
|
|
196
|
-
return typeof status === 'string' && RUN_TERMINAL_NOT_SUCCESS_STATUSES.includes(status);
|
|
197
|
-
}
|
|
198
|
-
export const RUN_TERMINAL_STATUSES = Object.freeze([
|
|
199
|
-
'completed',
|
|
200
|
-
...RUN_TERMINAL_NOT_SUCCESS_STATUSES,
|
|
201
|
-
]);
|
|
202
|
-
export function isTerminalStatus(status) {
|
|
203
|
-
return typeof status === 'string' && RUN_TERMINAL_STATUSES.includes(status);
|
|
204
|
-
}
|
|
205
|
-
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'killed', 'cancelled']);
|
|
206
|
-
export function isTaskNotificationTerminalStatus(status) {
|
|
207
|
-
return status !== undefined && TASK_NOTIFICATION_TERMINAL_STATUSES.includes(status);
|
|
208
|
-
}
|
|
@@ -3,5 +3,6 @@ export { getMeConfig, getScopeConfigDraft, getEffective } from '@sema-agent/sdk/
|
|
|
3
3
|
export { probeRegistryHealth, postFeedback } from '@sema-agent/sdk/registry';
|
|
4
4
|
export { REGISTRY_AUTH_PATHS, skillContentAddress } from '@sema-agent/sdk/registry';
|
|
5
5
|
export { requestDeviceCode, pollUntilApproved, refreshTokens, listScopes, switchScope } from '@sema-agent/sdk/registry';
|
|
6
|
+
export { classifyRegistryConflict } from '@sema-agent/sdk/registry';
|
|
6
7
|
export { RegistryApiError, OAuthFlowError } from '@sema-agent/sdk/registry';
|
|
7
|
-
export type { RegistryTokens, TokenProvider, } from '@sema-agent/sdk/registry';
|
|
8
|
+
export type { RegistryConflictClass, RegistryTokens, TokenProvider, } from '@sema-agent/sdk/registry';
|
|
@@ -3,4 +3,5 @@ export { getMeConfig, getScopeConfigDraft, getEffective } from '@sema-agent/sdk/
|
|
|
3
3
|
export { probeRegistryHealth, postFeedback } from '@sema-agent/sdk/registry';
|
|
4
4
|
export { REGISTRY_AUTH_PATHS, skillContentAddress } from '@sema-agent/sdk/registry';
|
|
5
5
|
export { requestDeviceCode, pollUntilApproved, refreshTokens, listScopes, switchScope } from '@sema-agent/sdk/registry';
|
|
6
|
+
export { classifyRegistryConflict } from '@sema-agent/sdk/registry';
|
|
6
7
|
export { RegistryApiError, OAuthFlowError } from '@sema-agent/sdk/registry';
|
|
@@ -13,5 +13,4 @@ export declare function noteEngineCapsForSealedKey(baseUrl: string, caps: unknow
|
|
|
13
13
|
generation?: number;
|
|
14
14
|
}): void;
|
|
15
15
|
export declare function observedSealedKey(baseUrl?: string | undefined): SealedKeyReading;
|
|
16
|
-
export declare function forgetSealedKeyReading(baseUrl: string | undefined): void;
|
|
17
16
|
export declare function __resetSealedKeyReadingsForTests(): void;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
function ownNonEmpty(seg, key) {
|
|
4
|
-
|
|
5
|
-
return undefined;
|
|
6
|
-
const v = seg[key];
|
|
5
|
+
const v = ownDataField(seg, key);
|
|
7
6
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
8
7
|
}
|
|
9
8
|
export function projectSealedKeyCapability(caps) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
try {
|
|
10
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
11
|
+
return undefined;
|
|
12
|
+
const seg = ownDataField(caps, 'sealedKey');
|
|
13
|
+
if (seg === undefined)
|
|
14
|
+
return { kind: 'not_reported' };
|
|
15
|
+
if (seg === null || typeof seg !== 'object' || Array.isArray(seg))
|
|
16
|
+
return undefined;
|
|
17
|
+
const alg = ownNonEmpty(seg, 'alg');
|
|
18
|
+
const publicKeyId = ownNonEmpty(seg, 'publicKeyId');
|
|
19
|
+
const publicKey = ownNonEmpty(seg, 'publicKey');
|
|
20
|
+
if (alg === undefined || publicKeyId === undefined || publicKey === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
return { kind: 'present', alg, publicKeyId, publicKey };
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
18
25
|
return undefined;
|
|
19
|
-
|
|
20
|
-
const publicKeyId = ownNonEmpty(seg, 'publicKeyId');
|
|
21
|
-
const publicKey = ownNonEmpty(seg, 'publicKey');
|
|
22
|
-
if (alg === undefined || publicKeyId === undefined || publicKey === undefined)
|
|
23
|
-
return undefined;
|
|
24
|
-
return { kind: 'present', alg, publicKeyId, publicKey };
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
const reader = createEngineCapReader({
|
|
27
29
|
name: 'sealedKey',
|
|
@@ -34,9 +36,6 @@ export function noteEngineCapsForSealedKey(baseUrl, caps, opts) {
|
|
|
34
36
|
export function observedSealedKey(baseUrl = engineWireTarget()?.baseUrl) {
|
|
35
37
|
return reader.observed(baseUrl);
|
|
36
38
|
}
|
|
37
|
-
export function forgetSealedKeyReading(baseUrl) {
|
|
38
|
-
reader.forget(baseUrl);
|
|
39
|
-
}
|
|
40
39
|
export function __resetSealedKeyReadingsForTests() {
|
|
41
40
|
reader.__resetForTests();
|
|
42
41
|
}
|