@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
package/dist/wireErrorTriage.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readErrorNumber, readErrorString, readErrorStringList } from './wireFailureShape.js';
|
|
2
2
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
3
|
+
import { readOwnDataValue } from './ownKey.js';
|
|
3
4
|
import { fleetLeaseUnavailableFromError } from './wireRefusalCopy.js';
|
|
4
5
|
import { DRAINING_ERROR_CODE, isCorruptSessionCode, RESUME_AT_ERROR_CODE_PREFIX, RESUME_POLICY_FOLD_CODE, RESUME_RETRY_LATER_CODES, RESUME_USAGE_WINDOW_EXHAUSTED, SCENARIO_NOT_ALLOWED_ERROR_CODE, } from './engineErrorCodes.js';
|
|
5
6
|
export const WIRE_NETWORK_ERROR_PATTERN = /fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|EHOSTUNREACH|ENETUNREACH|EPIPE|socket hang up|UND_ERR|terminated|other side closed/i;
|
|
@@ -87,6 +88,40 @@ export function drainingRetryDelayMs(err, attempt, opts) {
|
|
|
87
88
|
const ladder = opts?.ladder && opts.ladder.length > 0 ? opts.ladder : [1_000, 2_000, 4_000];
|
|
88
89
|
return ladder[Math.min(attempt, ladder.length - 1)] ?? 1_000;
|
|
89
90
|
}
|
|
91
|
+
export function isInStreamDrainingEnd(frame) {
|
|
92
|
+
try {
|
|
93
|
+
if (typeof frame !== 'object' || frame === null)
|
|
94
|
+
return false;
|
|
95
|
+
if (typeof readOwnDataValue(frame, 'status') === 'number')
|
|
96
|
+
return false;
|
|
97
|
+
const typeSlot = Object.getOwnPropertyDescriptor(frame, 'type');
|
|
98
|
+
const outerType = typeSlot !== undefined && Object.hasOwn(typeSlot, 'value') ? typeSlot.value : undefined;
|
|
99
|
+
if (outerType === 'error')
|
|
100
|
+
return readOwnDataValue(frame, 'errorCode') === DRAINING_ERROR_CODE;
|
|
101
|
+
if (typeSlot !== undefined && outerType !== 'unknown')
|
|
102
|
+
return false;
|
|
103
|
+
if (readOwnDataValue(frame, 'event') !== 'error')
|
|
104
|
+
return false;
|
|
105
|
+
const data = readOwnDataValue(frame, 'data');
|
|
106
|
+
if (typeof data !== 'object' || data === null)
|
|
107
|
+
return false;
|
|
108
|
+
const dataType = readOwnDataValue(data, 'type');
|
|
109
|
+
if (dataType !== undefined && dataType !== 'error')
|
|
110
|
+
return false;
|
|
111
|
+
return readOwnDataValue(data, 'errorCode') === DRAINING_ERROR_CODE;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export const STREAM_DRAINING_RECONNECT_MAX = 3;
|
|
118
|
+
export function streamDrainingDecision(frame, attempt, opts) {
|
|
119
|
+
if (!isInStreamDrainingEnd(frame))
|
|
120
|
+
return { giveUp: 'not_draining_end' };
|
|
121
|
+
if (!Number.isSafeInteger(attempt) || attempt < 0 || attempt >= STREAM_DRAINING_RECONNECT_MAX)
|
|
122
|
+
return { giveUp: 'attempts_exhausted' };
|
|
123
|
+
return { reconnectAfterMs: drainingRetryDelayMs(null, attempt, opts?.ladder !== undefined ? { ladder: opts.ladder } : undefined) };
|
|
124
|
+
}
|
|
90
125
|
export function scenarioDenyFromError(err) {
|
|
91
126
|
if (typeof err !== 'object' || err === null)
|
|
92
127
|
return null;
|
|
@@ -8,11 +8,21 @@ interface WireFailureShape {
|
|
|
8
8
|
bodyVerdict?: string;
|
|
9
9
|
bodyCurrentName?: string;
|
|
10
10
|
message: string;
|
|
11
|
+
ownMessage?: string;
|
|
11
12
|
}
|
|
13
|
+
export declare const THROWN_SLOT_UNREADABLE: unique symbol;
|
|
14
|
+
export declare function readThrownSlot(o: unknown, key: string, own?: boolean): unknown;
|
|
15
|
+
export declare function thrownIsInstanceOf<C extends abstract new (...args: never[]) => unknown>(e: unknown, cls: C): e is InstanceType<C>;
|
|
12
16
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
13
17
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
14
18
|
export declare function readErrorString(o: object, key: string): string | undefined;
|
|
15
19
|
export declare function readErrorStringList(o: object, key: string): readonly string[] | undefined;
|
|
16
20
|
export declare function readErrorStrictStringList(o: object, key: string): readonly string[] | undefined;
|
|
17
21
|
export declare function wireFailureShapeOf(e: unknown): WireFailureShape;
|
|
22
|
+
export declare const WIRE_FAILURE_UNRENDERABLE_TEXT = "the call failed with an error this client could not render";
|
|
23
|
+
export declare function wireFailureTextsOf(e: unknown): {
|
|
24
|
+
reason: string;
|
|
25
|
+
log: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function readRefusalField(o: object): string | undefined;
|
|
18
28
|
export {};
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
export const THROWN_SLOT_UNREADABLE = Symbol('thrown-slot-unreadable');
|
|
2
|
+
export function readThrownSlot(o, key, own = false) {
|
|
2
3
|
try {
|
|
4
|
+
if (own && !Object.hasOwn(o, key))
|
|
5
|
+
return undefined;
|
|
3
6
|
return o[key];
|
|
4
7
|
}
|
|
5
8
|
catch {
|
|
6
|
-
return
|
|
9
|
+
return THROWN_SLOT_UNREADABLE;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function readGuarded(o, key) {
|
|
13
|
+
const v = readThrownSlot(o, key);
|
|
14
|
+
return v === THROWN_SLOT_UNREADABLE ? undefined : v;
|
|
15
|
+
}
|
|
16
|
+
export function thrownIsInstanceOf(e, cls) {
|
|
17
|
+
try {
|
|
18
|
+
return e instanceof cls;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
7
22
|
}
|
|
8
23
|
}
|
|
9
24
|
function readErrorSlot(obj, key, accept) {
|
|
@@ -97,7 +112,14 @@ export function wireFailureShapeOf(e) {
|
|
|
97
112
|
catch {
|
|
98
113
|
extraUnreadable = true;
|
|
99
114
|
}
|
|
100
|
-
|
|
115
|
+
let extraObj;
|
|
116
|
+
try {
|
|
117
|
+
extraObj = typeof extra === 'object' && extra !== null && !Array.isArray(extra) ? extra : undefined;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
extraObj = undefined;
|
|
121
|
+
extraUnreadable = true;
|
|
122
|
+
}
|
|
101
123
|
let committedPresent = false;
|
|
102
124
|
let committedRaw;
|
|
103
125
|
if (extraObj !== undefined) {
|
|
@@ -133,12 +155,13 @@ export function wireFailureShapeOf(e) {
|
|
|
133
155
|
const bodyName = ownString('name');
|
|
134
156
|
const bodyVerdict = ownString('verdict');
|
|
135
157
|
const bodyCurrentName = ownString('currentName');
|
|
158
|
+
const ownMessage = typeof rawMessage === 'string' && rawMessage !== '' ? rawMessage : undefined;
|
|
136
159
|
let message;
|
|
137
160
|
try {
|
|
138
|
-
message =
|
|
161
|
+
message = ownMessage !== undefined ? ownMessage : String(e);
|
|
139
162
|
}
|
|
140
163
|
catch {
|
|
141
|
-
message =
|
|
164
|
+
message = WIRE_FAILURE_UNRENDERABLE_TEXT;
|
|
142
165
|
}
|
|
143
166
|
const sec = typeof retryAfterMs === 'number' && Number.isFinite(retryAfterMs) && retryAfterMs >= 0
|
|
144
167
|
? Math.ceil(retryAfterMs / 1000)
|
|
@@ -160,5 +183,49 @@ export function wireFailureShapeOf(e) {
|
|
|
160
183
|
...(bodyVerdict !== undefined ? { bodyVerdict } : {}),
|
|
161
184
|
...(bodyCurrentName !== undefined ? { bodyCurrentName } : {}),
|
|
162
185
|
message,
|
|
186
|
+
...(ownMessage !== undefined ? { ownMessage } : {}),
|
|
163
187
|
};
|
|
164
188
|
}
|
|
189
|
+
export const WIRE_FAILURE_UNRENDERABLE_TEXT = 'the call failed with an error this client could not render';
|
|
190
|
+
export function wireFailureTextsOf(e) {
|
|
191
|
+
const { ownMessage } = wireFailureShapeOf(e);
|
|
192
|
+
let log;
|
|
193
|
+
try {
|
|
194
|
+
log = String(e).slice(0, 300);
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
log = '<unprintable thrown value>';
|
|
198
|
+
}
|
|
199
|
+
if (ownMessage !== undefined)
|
|
200
|
+
return { reason: ownMessage, log };
|
|
201
|
+
if (typeof e === 'string')
|
|
202
|
+
return { reason: e !== '' ? e : WIRE_FAILURE_UNRENDERABLE_TEXT, log };
|
|
203
|
+
if (typeof e === 'number' || typeof e === 'boolean' || typeof e === 'bigint')
|
|
204
|
+
return { reason: String(e), log };
|
|
205
|
+
return { reason: WIRE_FAILURE_UNRENDERABLE_TEXT, log };
|
|
206
|
+
}
|
|
207
|
+
export function readRefusalField(o) {
|
|
208
|
+
const str = (rec) => {
|
|
209
|
+
let v;
|
|
210
|
+
try {
|
|
211
|
+
v = rec.field;
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
217
|
+
};
|
|
218
|
+
let extra;
|
|
219
|
+
try {
|
|
220
|
+
extra = o.extra;
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
extra = undefined;
|
|
224
|
+
}
|
|
225
|
+
if (typeof extra === 'object' && extra !== null && !Array.isArray(extra)) {
|
|
226
|
+
const fromExtra = str(extra);
|
|
227
|
+
if (fromExtra !== undefined)
|
|
228
|
+
return fromExtra;
|
|
229
|
+
}
|
|
230
|
+
return str(o);
|
|
231
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FLEET_LEASE_UNAVAILABLE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
|
|
1
|
+
import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
|
|
2
2
|
import type { TaskRequestLike } from './request/taskRequest.js';
|
|
3
3
|
export declare const CONFLICT_APPROVAL_SETTLED = "conflict.approval_settled";
|
|
4
4
|
export declare const CONFLICT_RUN_NOT_RUNNING = "conflict.run_not_running";
|
|
@@ -83,3 +83,8 @@ export interface HookMatcherRefusal {
|
|
|
83
83
|
readonly canonical: string;
|
|
84
84
|
}
|
|
85
85
|
export declare function hookMatcherRefusalFromError(err: unknown): HookMatcherRefusal | undefined;
|
|
86
|
+
export interface AutonomyLaneRefusalDetail {
|
|
87
|
+
readonly code: typeof REQUEST_AUTONOMY_LANE_REFUSED;
|
|
88
|
+
}
|
|
89
|
+
export declare function autonomyLaneRefusalFromError(err: unknown): AutonomyLaneRefusalDetail | null;
|
|
90
|
+
export declare function autonomyLaneRefusalContent(): string;
|
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList } from './wireFailureShape.js';
|
|
1
|
+
import { readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField } from './wireFailureShape.js';
|
|
2
2
|
import { readOwnNonEmptyString } from './ownKey.js';
|
|
3
|
-
import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_FIELD_CONFLICT, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
|
|
3
|
+
import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
6
6
|
import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
|
|
@@ -11,24 +11,31 @@ function readStringField(o, key) {
|
|
|
11
11
|
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
12
12
|
}
|
|
13
13
|
export function cancelConflictFromError(err) {
|
|
14
|
+
let o;
|
|
14
15
|
try {
|
|
15
16
|
if (err === null || typeof err !== 'object')
|
|
16
17
|
return null;
|
|
17
|
-
|
|
18
|
+
o = err;
|
|
18
19
|
const rawStatus = o.status ?? o.statusCode;
|
|
19
20
|
const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
|
|
20
21
|
if (!is409)
|
|
21
22
|
return null;
|
|
22
|
-
const code = readStringField(o, 'errorCode');
|
|
23
|
-
if (code === CONFLICT_APPROVAL_SETTLED)
|
|
24
|
-
return { kind: 'approval_settled', code };
|
|
25
|
-
if (code === CONFLICT_RUN_NOT_RUNNING)
|
|
26
|
-
return { kind: 'run_not_running', code };
|
|
27
|
-
return { kind: 'unrecognized', ...(code !== undefined ? { code } : {}) };
|
|
28
23
|
}
|
|
29
24
|
catch {
|
|
30
25
|
return null;
|
|
31
26
|
}
|
|
27
|
+
let code;
|
|
28
|
+
try {
|
|
29
|
+
code = readStringField(o, 'errorCode');
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
code = undefined;
|
|
33
|
+
}
|
|
34
|
+
if (code === CONFLICT_APPROVAL_SETTLED)
|
|
35
|
+
return { kind: 'approval_settled', code };
|
|
36
|
+
if (code === CONFLICT_RUN_NOT_RUNNING)
|
|
37
|
+
return { kind: 'run_not_running', code };
|
|
38
|
+
return { kind: 'unrecognized', ...(code !== undefined ? { code } : {}) };
|
|
32
39
|
}
|
|
33
40
|
export function cancelConflictContent(detail) {
|
|
34
41
|
switch (detail.kind) {
|
|
@@ -177,23 +184,7 @@ export function scenarioAssignmentUnknownFromError(err) {
|
|
|
177
184
|
const SETTLED_BY_NOT_IN_PROOF = 'settled_by_not_in_proof';
|
|
178
185
|
const DECIDED_BY_NOT_IN_PROOF = 'decided_by_not_in_proof';
|
|
179
186
|
const RETIRED_DECISION_KEY = 'settledBy';
|
|
180
|
-
const RESUME_OUTCOME_INVALID = 'resume_outcome_invalid';
|
|
181
187
|
const APPROVAL_NON_BINDING_FIELDS = new Set(['hostDecision', 'approver']);
|
|
182
|
-
function readRefusalField(o) {
|
|
183
|
-
let extra;
|
|
184
|
-
try {
|
|
185
|
-
extra = o.extra;
|
|
186
|
-
}
|
|
187
|
-
catch {
|
|
188
|
-
extra = undefined;
|
|
189
|
-
}
|
|
190
|
-
if (typeof extra === 'object' && extra !== null && !Array.isArray(extra)) {
|
|
191
|
-
const fromExtra = readStringField(extra, 'field');
|
|
192
|
-
if (fromExtra !== undefined)
|
|
193
|
-
return fromExtra;
|
|
194
|
-
}
|
|
195
|
-
return readStringField(o, 'field');
|
|
196
|
-
}
|
|
197
188
|
export function denyAttributionRefusalFromError(err, sentAttributionKey) {
|
|
198
189
|
try {
|
|
199
190
|
if (err === null || typeof err !== 'object')
|
|
@@ -619,3 +610,10 @@ export function hookMatcherRefusalFromError(err) {
|
|
|
619
610
|
return undefined;
|
|
620
611
|
}
|
|
621
612
|
}
|
|
613
|
+
export function autonomyLaneRefusalFromError(err) {
|
|
614
|
+
return effectiveWireErrorCode(err) === REQUEST_AUTONOMY_LANE_REFUSED ? { code: REQUEST_AUTONOMY_LANE_REFUSED } : null;
|
|
615
|
+
}
|
|
616
|
+
export function autonomyLaneRefusalContent() {
|
|
617
|
+
return ('The engine did not start this leader run: this deployment runs in plan-only autonomy, and a leader run has no way to have its plan reviewed, ' +
|
|
618
|
+
'so nothing was started · Submit the work as a regular run instead, or ask whoever operates the engine to change its autonomy setting');
|
|
619
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CallerCwdReading } from './callerCwdCapability.js';
|
|
2
|
+
export declare function legCwdOfBody(body: object | null | undefined, callerCwd: CallerCwdReading | undefined): string | undefined;
|
|
3
|
+
export interface InstructionsAttributionInput {
|
|
4
|
+
legCwd: string | undefined;
|
|
5
|
+
currentCwd: string;
|
|
6
|
+
realPathOf: (path: string) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare function engineSelectedInstructionsFile(view: {
|
|
9
|
+
readonly selected: readonly string[];
|
|
10
|
+
} | null | undefined, input: InstructionsAttributionInput): string | undefined;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { callerCwdAdmitted } from './callerCwdCapability.js';
|
|
2
|
+
import { displayUntrusted } from './displayUntrusted.js';
|
|
3
|
+
import { readOutboundBodyField } from './fileHistoryLegNotice.js';
|
|
4
|
+
export function legCwdOfBody(body, callerCwd) {
|
|
5
|
+
if (!callerCwdAdmitted(callerCwd))
|
|
6
|
+
return undefined;
|
|
7
|
+
const r = readOutboundBodyField(body, 'cwd');
|
|
8
|
+
return r.kind === 'value' && typeof r.value === 'string' && r.value.length > 0 ? r.value : undefined;
|
|
9
|
+
}
|
|
10
|
+
function realOf(realPathOf, path) {
|
|
11
|
+
try {
|
|
12
|
+
if (typeof realPathOf !== 'function')
|
|
13
|
+
return undefined;
|
|
14
|
+
const r = realPathOf(path);
|
|
15
|
+
return typeof r === 'string' && r.length > 0 ? r : undefined;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function safeRelativeMember(member) {
|
|
22
|
+
if (typeof member !== 'string' || member.length === 0)
|
|
23
|
+
return false;
|
|
24
|
+
if (displayUntrusted(member) !== member)
|
|
25
|
+
return false;
|
|
26
|
+
if (member.includes('\\') || member.startsWith('/') || /^[A-Za-z]:/.test(member))
|
|
27
|
+
return false;
|
|
28
|
+
return member.split('/').every((seg) => seg !== '' && seg !== '..');
|
|
29
|
+
}
|
|
30
|
+
function isSep(path, c) {
|
|
31
|
+
return c === '/' || (!path.startsWith('/') && c === '\\');
|
|
32
|
+
}
|
|
33
|
+
function trimSeps(path) {
|
|
34
|
+
let end = path.length;
|
|
35
|
+
while (end > 0 && isSep(path, path.charAt(end - 1)))
|
|
36
|
+
end--;
|
|
37
|
+
return path.slice(0, end);
|
|
38
|
+
}
|
|
39
|
+
function strictlyWithin(child, dir) {
|
|
40
|
+
const trimmed = trimSeps(dir);
|
|
41
|
+
if (!child.startsWith(trimmed) || child.length <= trimmed.length)
|
|
42
|
+
return false;
|
|
43
|
+
return isSep(dir, child.charAt(trimmed.length));
|
|
44
|
+
}
|
|
45
|
+
export function engineSelectedInstructionsFile(view, input) {
|
|
46
|
+
try {
|
|
47
|
+
if (view === null || typeof view !== 'object' || input === null || typeof input !== 'object')
|
|
48
|
+
return undefined;
|
|
49
|
+
const { legCwd, currentCwd, realPathOf } = input;
|
|
50
|
+
if (typeof legCwd !== 'string' || legCwd.length === 0 || legCwd !== currentCwd)
|
|
51
|
+
return undefined;
|
|
52
|
+
const selected = view.selected;
|
|
53
|
+
if (!Array.isArray(selected) || selected.length === 0)
|
|
54
|
+
return undefined;
|
|
55
|
+
const member = selected[0];
|
|
56
|
+
if (!safeRelativeMember(member))
|
|
57
|
+
return undefined;
|
|
58
|
+
const realDir = realOf(realPathOf, currentCwd);
|
|
59
|
+
const realFile = realOf(realPathOf, `${trimSeps(currentCwd)}/${member}`);
|
|
60
|
+
if (realDir === undefined || realFile === undefined || !strictlyWithin(realFile, realDir))
|
|
61
|
+
return undefined;
|
|
62
|
+
return member;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
package/dist/workflowClient.js
CHANGED
|
@@ -5,6 +5,7 @@ import { makeEngineWireClient } from './engineWireSdk.js';
|
|
|
5
5
|
import { engineWireDebugEnabled } from './engineWireTarget.js';
|
|
6
6
|
import { hostLog } from './host.js';
|
|
7
7
|
import { isReadCredentialRefusal } from './readCredentialRefusal.js';
|
|
8
|
+
import { createStreamDrainingLegs } from './streamDrainingLegs.js';
|
|
8
9
|
function coerceRunStatus(s) {
|
|
9
10
|
switch (s) {
|
|
10
11
|
case 'completed':
|
|
@@ -584,6 +585,7 @@ async function consumeWorkflowActivity(l, cfg) {
|
|
|
584
585
|
emitActivityTick(l);
|
|
585
586
|
return;
|
|
586
587
|
}
|
|
588
|
+
const drains = createStreamDrainingLegs();
|
|
587
589
|
while (!l.closed && !l.abort.signal.aborted) {
|
|
588
590
|
let sawFrame = false;
|
|
589
591
|
let threw = false;
|
|
@@ -597,6 +599,8 @@ async function consumeWorkflowActivity(l, cfg) {
|
|
|
597
599
|
return;
|
|
598
600
|
sawFrame = true;
|
|
599
601
|
l.connected = true;
|
|
602
|
+
if (drains.see(frame))
|
|
603
|
+
continue;
|
|
600
604
|
try {
|
|
601
605
|
foldWorkflowActivityFrame(l, frame);
|
|
602
606
|
}
|
|
@@ -615,6 +619,7 @@ async function consumeWorkflowActivity(l, cfg) {
|
|
|
615
619
|
}
|
|
616
620
|
}
|
|
617
621
|
l.connected = false;
|
|
622
|
+
const drained = drains.legEnded(threw ? 'threw' : 'returned');
|
|
618
623
|
if (!sawFrame && !threw) {
|
|
619
624
|
l.closed = true;
|
|
620
625
|
l.closedReason = 'terminal';
|
|
@@ -632,9 +637,21 @@ async function consumeWorkflowActivity(l, cfg) {
|
|
|
632
637
|
return;
|
|
633
638
|
}
|
|
634
639
|
}
|
|
640
|
+
let waitMs = WORKFLOW_ACTIVITY_RECONNECT_MS;
|
|
641
|
+
if (drained !== undefined) {
|
|
642
|
+
const decision = drained;
|
|
643
|
+
if ('giveUp' in decision) {
|
|
644
|
+
l.closed = true;
|
|
645
|
+
l.closedReason = 'error';
|
|
646
|
+
l.lastError = 'the engine kept ending this stream because it is going down (drain end frames)';
|
|
647
|
+
emitActivityTick(l);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
waitMs = decision.reconnectAfterMs;
|
|
651
|
+
}
|
|
635
652
|
emitActivityTick(l);
|
|
636
653
|
if (!l.closed && !l.abort.signal.aborted) {
|
|
637
|
-
await abortableSleep(
|
|
654
|
+
await abortableSleep(waitMs, l.abort.signal);
|
|
638
655
|
}
|
|
639
656
|
}
|
|
640
657
|
emitActivityTick(l);
|
|
@@ -777,8 +794,8 @@ export function createLiveWorkflowSource(config) {
|
|
|
777
794
|
connected = false;
|
|
778
795
|
unauthorized = isReadCredentialRefusal(err);
|
|
779
796
|
if (err instanceof APIError) {
|
|
780
|
-
code = err.status;
|
|
781
797
|
degraded = err.status === 501 || err.status === 404;
|
|
798
|
+
code = degraded ? err.status : null;
|
|
782
799
|
lastError = `${err.status} ${err.message}`;
|
|
783
800
|
}
|
|
784
801
|
else {
|
|
@@ -14,5 +14,4 @@ export declare function noteEngineCapsForWorkflowsJournal(baseUrl: string, caps:
|
|
|
14
14
|
export declare function observedWorkflowsJournal(baseUrl?: string | undefined): WorkflowsJournalReading;
|
|
15
15
|
export declare function workflowsJournalAvailable(reading: WorkflowsJournalReading): 'yes' | 'no' | 'unknown';
|
|
16
16
|
export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading): string;
|
|
17
|
-
export declare function forgetWorkflowsJournalReading(baseUrl: string | undefined): void;
|
|
18
17
|
export declare function __resetWorkflowsJournalReadingsForTests(): void;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
export function projectWorkflowsJournalCapability(caps) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
try {
|
|
6
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
7
|
+
return undefined;
|
|
8
|
+
const v = ownDataField(caps, 'workflowsJournal');
|
|
9
|
+
if (v === undefined)
|
|
10
|
+
return { kind: 'not_reported' };
|
|
11
|
+
if (typeof v !== 'boolean')
|
|
12
|
+
return undefined;
|
|
13
|
+
return v ? { kind: 'present' } : { kind: 'absent' };
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
12
16
|
return undefined;
|
|
13
|
-
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
const reader = createEngineCapReader({
|
|
16
20
|
name: 'workflowsJournal',
|
|
@@ -42,9 +46,6 @@ export function workflowsJournalDoctorDetail(reading) {
|
|
|
42
46
|
return 'workflow journal on — a workflow’s execution journal can be read';
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
export function forgetWorkflowsJournalReading(baseUrl) {
|
|
46
|
-
reader.forget(baseUrl);
|
|
47
|
-
}
|
|
48
49
|
export function __resetWorkflowsJournalReadingsForTests() {
|
|
49
50
|
reader.__resetForTests();
|
|
50
51
|
}
|
|
@@ -28,5 +28,4 @@ export declare function noteEngineCapsForWriteProtection(baseUrl: string, caps:
|
|
|
28
28
|
export declare function observedWriteProtection(baseUrl?: string | undefined): WriteProtectionReading;
|
|
29
29
|
export declare function writeProtectionDoctorDetail(reading: WriteProtectionReading): string;
|
|
30
30
|
export declare function writeProtectionPostureDetail(posture: WriteProtectionPostureView): string;
|
|
31
|
-
export declare function forgetWriteProtectionReading(baseUrl: string | undefined): void;
|
|
32
31
|
export declare function __resetWriteProtectionReadingsForTests(): void;
|
|
@@ -1,31 +1,34 @@
|
|
|
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
|
export function projectWriteProtectionCapability(caps) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
try {
|
|
7
|
+
if (caps === null || typeof caps !== 'object')
|
|
8
|
+
return undefined;
|
|
9
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
10
|
+
return undefined;
|
|
11
|
+
const wp = ownDataField(caps, 'writeProtection');
|
|
12
|
+
if (wp === null)
|
|
13
|
+
return { kind: 'none' };
|
|
14
|
+
if (wp === undefined)
|
|
15
|
+
return { kind: 'not_reported' };
|
|
16
|
+
if (typeof wp !== 'object' || Array.isArray(wp))
|
|
17
|
+
return undefined;
|
|
18
|
+
const armed = ownDataField(wp, 'armed');
|
|
19
|
+
const replaced = ownDataField(wp, 'replaced');
|
|
20
|
+
const rows = ownDataField(wp, 'rows');
|
|
21
|
+
if (typeof armed !== 'boolean')
|
|
22
|
+
return undefined;
|
|
23
|
+
if (typeof replaced !== 'boolean')
|
|
24
|
+
return undefined;
|
|
25
|
+
if (typeof rows !== 'number' || !Number.isInteger(rows) || rows < 0)
|
|
26
|
+
return undefined;
|
|
27
|
+
return { kind: 'present', view: { armed, rows, replaced } };
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
27
30
|
return undefined;
|
|
28
|
-
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
export function projectWriteProtectionPosture(wiring) {
|
|
31
34
|
if (wiring === null || typeof wiring !== 'object')
|
|
@@ -109,9 +112,6 @@ export function writeProtectionPostureDetail(posture) {
|
|
|
109
112
|
: '';
|
|
110
113
|
return `source ${source} · ${String(posture.rows.length)} ${posture.rows.length === 1 ? 'name' : 'names'}: ${shown}${more}${dropped}`;
|
|
111
114
|
}
|
|
112
|
-
export function forgetWriteProtectionReading(baseUrl) {
|
|
113
|
-
reader.forget(baseUrl);
|
|
114
|
-
}
|
|
115
115
|
export function __resetWriteProtectionReadingsForTests() {
|
|
116
116
|
reader.__resetForTests();
|
|
117
117
|
}
|