@sema-agent/client-core 0.97.1 → 0.99.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 +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +8 -0
- package/dist/frameBinding.js +35 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
package/dist/controlRouter.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { TaskRequest, RunReceipt, CancelAck, Scenario, SteerPriority } from '@sema-agent/sdk';
|
|
1
|
+
import type { TaskRequest, RunReceipt, CancelAck, Scenario, SteerPriority, AssistantTaskStatus } from '@sema-agent/sdk';
|
|
2
2
|
import { type SteerPriorityReading } from './steerPriorityCapability.js';
|
|
3
|
+
import { type PreemptOutcome } from './preemptWire.js';
|
|
4
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
5
|
export interface RunsResourceLike {
|
|
4
6
|
create(req: TaskRequest, opts?: {
|
|
5
7
|
idempotencyKey?: string | null;
|
|
@@ -12,8 +14,14 @@ export interface RunsResourceLike {
|
|
|
12
14
|
signal?: AbortSignal;
|
|
13
15
|
}): Promise<CancelAck>;
|
|
14
16
|
}
|
|
17
|
+
export interface AssistantPreemptLike {
|
|
18
|
+
preempt(taskId: string, opts?: {
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}): Promise<AssistantTaskStatus>;
|
|
21
|
+
}
|
|
15
22
|
export interface ControlClientLike {
|
|
16
23
|
runs: RunsResourceLike;
|
|
24
|
+
assistant?: AssistantPreemptLike;
|
|
17
25
|
}
|
|
18
26
|
export type ControlSafetyCode = 'not_running' | 'invalid_content' | 'queue_full' | 'duplicate_input_id' | 'ambiguous_target' | 'still_running' | 'blocked_by_hook' | 'ledger_unavailable' | 'steering_other' | 'cancel_lost_race' | 'cancel_run_not_running' | 'not_found' | 'priority_not_applied' | 'steer_input_invalid';
|
|
19
27
|
export declare class ControlSafetyError extends Error {
|
|
@@ -31,6 +39,10 @@ export interface ControlRouterSteerOptions {
|
|
|
31
39
|
priority?: SteerPriority;
|
|
32
40
|
steerPriority?: SteerPriorityReading;
|
|
33
41
|
}
|
|
42
|
+
export interface PreemptOptions {
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
onUnavailable?: 'cancel' | 'report';
|
|
45
|
+
}
|
|
34
46
|
export interface ControlRouterOptions {
|
|
35
47
|
sessionId?: string;
|
|
36
48
|
jobId?: string;
|
|
@@ -55,6 +67,8 @@ export declare class ControlRouter {
|
|
|
55
67
|
cancel(opts?: {
|
|
56
68
|
signal?: AbortSignal;
|
|
57
69
|
}): Promise<CancelAck>;
|
|
70
|
+
private cancelRun;
|
|
71
|
+
preempt(opts?: PreemptOptions): Promise<PreemptOutcome>;
|
|
58
72
|
}
|
|
59
73
|
export interface ErrCodes {
|
|
60
74
|
code?: string | undefined;
|
|
@@ -62,6 +76,7 @@ export interface ErrCodes {
|
|
|
62
76
|
status?: number | undefined;
|
|
63
77
|
}
|
|
64
78
|
export declare function errCodes(e: unknown): ErrCodes;
|
|
79
|
+
export type SteerHostQueueFact = 'queued_until_turn_end' | 'dropped' | 'unknown';
|
|
65
80
|
export declare function steeringStatusIs4xx(e: object): boolean;
|
|
66
81
|
export interface SteerRefusalAdvice {
|
|
67
82
|
safety: ControlSafetyCode;
|
|
@@ -70,8 +85,8 @@ export interface SteerRefusalAdvice {
|
|
|
70
85
|
nextStep: string;
|
|
71
86
|
}
|
|
72
87
|
export type SteeringRefusedBeforeEngine = SteerRefusalAdvice;
|
|
73
|
-
export declare function steeringRefusedBeforeEngine(e: object): SteeringRefusedBeforeEngine | undefined;
|
|
74
|
-
export declare function steerRefusalAdviceOf(e: object): SteerRefusalAdvice | undefined;
|
|
88
|
+
export declare function steeringRefusedBeforeEngine(e: object, hostQueue?: SteerHostQueueFact, lang?: UiLanguage): SteeringRefusedBeforeEngine | undefined;
|
|
89
|
+
export declare function steerRefusalAdviceOf(e: object, hostQueue?: SteerHostQueueFact, lang?: UiLanguage): SteerRefusalAdvice | undefined;
|
|
75
90
|
export interface SteerBody {
|
|
76
91
|
readonly text: string;
|
|
77
92
|
readonly mode?: 'all' | 'one-at-a-time';
|
package/dist/controlRouter.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { cancelConflictContent, cancelConflictFromError } from './wireRefusalCopy.js';
|
|
2
|
+
import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, protocolErrorNameOf, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
3
|
import { steerPriorityMode } from './steerPriorityCapability.js';
|
|
4
|
+
import { preemptReadingOfAck, preemptReadingOfError } from './preemptWire.js';
|
|
5
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
6
|
export class ControlSafetyError extends Error {
|
|
4
7
|
code;
|
|
5
8
|
cause;
|
|
@@ -86,8 +89,11 @@ export class ControlRouter {
|
|
|
86
89
|
if (this.taskId === null) {
|
|
87
90
|
throw controlSafetyRefusal('not_found', 'no run in flight to cancel');
|
|
88
91
|
}
|
|
92
|
+
return this.cancelRun(this.taskId, opts);
|
|
93
|
+
}
|
|
94
|
+
async cancelRun(taskId, opts) {
|
|
89
95
|
try {
|
|
90
|
-
return await this.client.runs.cancel(
|
|
96
|
+
return await this.client.runs.cancel(taskId, opts?.signal !== undefined ? { signal: opts.signal } : undefined);
|
|
91
97
|
}
|
|
92
98
|
catch (e) {
|
|
93
99
|
const conflict = cancelConflictFromError(e);
|
|
@@ -100,14 +106,62 @@ export class ControlRouter {
|
|
|
100
106
|
throw e;
|
|
101
107
|
}
|
|
102
108
|
}
|
|
109
|
+
async preempt(opts) {
|
|
110
|
+
const taskId = this.taskId;
|
|
111
|
+
if (taskId === null)
|
|
112
|
+
return Object.freeze({ kind: 'no-run' });
|
|
113
|
+
let signal;
|
|
114
|
+
let fallback = 'cancel';
|
|
115
|
+
try {
|
|
116
|
+
const s = opts?.signal;
|
|
117
|
+
if (s !== undefined && s !== null)
|
|
118
|
+
signal = s;
|
|
119
|
+
const f = opts?.onUnavailable;
|
|
120
|
+
if (f !== undefined && f !== 'cancel')
|
|
121
|
+
fallback = 'report';
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
fallback = 'report';
|
|
125
|
+
}
|
|
126
|
+
let verb;
|
|
127
|
+
let slice;
|
|
128
|
+
try {
|
|
129
|
+
slice = this.client.assistant;
|
|
130
|
+
const v = slice?.preempt;
|
|
131
|
+
if (typeof v === 'function')
|
|
132
|
+
verb = v;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
verb = undefined;
|
|
136
|
+
}
|
|
137
|
+
let reading;
|
|
138
|
+
if (verb === undefined) {
|
|
139
|
+
reading = { kind: 'lane-absent' };
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
try {
|
|
143
|
+
reading = preemptReadingOfAck(taskId, await verb.call(slice, taskId, signal !== undefined ? { signal } : undefined));
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
reading = preemptReadingOfError(e);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (reading.kind !== 'lane-absent')
|
|
150
|
+
return Object.freeze(reading);
|
|
151
|
+
if (fallback === 'report')
|
|
152
|
+
return Object.freeze({ kind: 'unavailable' });
|
|
153
|
+
const ack = await this.cancelRun(taskId, signal !== undefined ? { signal } : undefined);
|
|
154
|
+
return Object.freeze({ kind: 'cancelled-instead', ack });
|
|
155
|
+
}
|
|
103
156
|
}
|
|
104
157
|
export function errCodes(e) {
|
|
105
158
|
if (!e || typeof e !== 'object')
|
|
106
159
|
return {};
|
|
107
|
-
const
|
|
108
|
-
const code = typeof
|
|
109
|
-
const
|
|
110
|
-
const
|
|
160
|
+
const rawCode = readThrownSlot(e, 'errorCode', 'data');
|
|
161
|
+
const code = typeof rawCode === 'string' ? rawCode : undefined;
|
|
162
|
+
const rawName = readThrownSlot(e, 'name');
|
|
163
|
+
const name = typeof rawName === 'string' ? rawName : undefined;
|
|
164
|
+
const rawStatus = readThrownStatusSlot(e);
|
|
111
165
|
const status = typeof rawStatus === 'number' ? rawStatus : undefined;
|
|
112
166
|
return { code, name, status };
|
|
113
167
|
}
|
|
@@ -122,59 +176,43 @@ const STEERING_CODE_TO_SAFETY = new Map([
|
|
|
122
176
|
['steering.blocked_by_hook', 'blocked_by_hook'],
|
|
123
177
|
['steering.ledger_unavailable', 'ledger_unavailable'],
|
|
124
178
|
]);
|
|
125
|
-
const STEERING_NAME_TO_SAFETY =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
179
|
+
const STEERING_NAME_TO_SAFETY = {
|
|
180
|
+
SteeringNotRunningError: 'not_running',
|
|
181
|
+
SteeringInvalidContentError: 'invalid_content',
|
|
182
|
+
SteeringAmbiguousTargetError: 'ambiguous_target',
|
|
183
|
+
SteeringStillRunningError: 'still_running',
|
|
184
|
+
SteeringLedgerUnavailableError: 'ledger_unavailable',
|
|
185
|
+
SteeringQueueFullError: 'queue_full',
|
|
186
|
+
SteeringDuplicateInputIdError: 'duplicate_input_id',
|
|
187
|
+
SteeringError: 'steering_other',
|
|
188
|
+
};
|
|
135
189
|
const STEERING_COPY = {
|
|
136
|
-
not_running: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
happened: 'that run is paused and already holds as many waiting messages as it can, so this one was not accepted',
|
|
146
|
-
nextStep: 'send it again once the waiting messages have been delivered (when the run resumes or the session is woken)',
|
|
147
|
-
},
|
|
148
|
-
duplicate_input_id: {
|
|
149
|
-
happened: 'a different instruction was already accepted under this idempotency key, and that earlier instruction stands',
|
|
150
|
-
nextStep: 'if you changed the text, send the new text under a new key; otherwise do not resend it — a new key would deliver the same instruction twice',
|
|
151
|
-
},
|
|
152
|
-
ambiguous_target: {
|
|
153
|
-
happened: 'more than one running agent matches that target, so the message was not delivered',
|
|
154
|
-
nextStep: 'address a sub-agent by its tool-call id; a workflow agent cannot be singled out while another running agent shares its label, so send it again once only one does',
|
|
155
|
-
},
|
|
156
|
-
still_running: {
|
|
157
|
-
happened: 'that agent is still running, so it cannot be resumed',
|
|
158
|
-
nextStep: 'send it a message instead, or wait for it to finish',
|
|
159
|
-
},
|
|
160
|
-
blocked_by_hook: {
|
|
161
|
-
happened: "the message was not accepted: a prompt check on this deployment blocked it, so nothing was delivered",
|
|
162
|
-
nextStep: 'edit the message and send it again — that is not a duplicate submission',
|
|
163
|
-
},
|
|
164
|
-
ledger_unavailable: {
|
|
165
|
-
happened: 'the server could not record the message and refused it before anything reached the engine, so nothing was delivered',
|
|
166
|
-
nextStep: 'send the same text again later',
|
|
167
|
-
},
|
|
168
|
-
steering_other: {
|
|
169
|
-
happened: 'the message was refused for a reason this version does not recognise, so it did not land',
|
|
170
|
-
nextStep: 'report its error code if this keeps happening; do not guess what it means',
|
|
171
|
-
},
|
|
190
|
+
not_running: { happened: 'session.steerRefusal.notRunning.happened', nextStep: 'session.steerRefusal.notRunning.nextStep' },
|
|
191
|
+
invalid_content: { happened: 'session.steerRefusal.invalidContent.happened', nextStep: 'session.steerRefusal.invalidContent.nextStep' },
|
|
192
|
+
queue_full: { happened: 'session.steerRefusal.queueFull.happened', nextStep: 'session.steerRefusal.queueFull.nextStep' },
|
|
193
|
+
duplicate_input_id: { happened: 'session.steerRefusal.duplicateInputId.happened', nextStep: 'session.steerRefusal.duplicateInputId.nextStep' },
|
|
194
|
+
ambiguous_target: { happened: 'session.steerRefusal.ambiguousTarget.happened', nextStep: 'session.steerRefusal.ambiguousTarget.nextStep' },
|
|
195
|
+
still_running: { happened: 'session.steerRefusal.stillRunning.happened', nextStep: 'session.steerRefusal.stillRunning.nextStep' },
|
|
196
|
+
blocked_by_hook: { happened: 'session.steerRefusal.blockedByHook.happened', nextStep: 'session.steerRefusal.blockedByHook.nextStep' },
|
|
197
|
+
ledger_unavailable: { happened: 'session.steerRefusal.ledgerUnavailable.happened', nextStep: 'session.steerRefusal.ledgerUnavailable.nextStep' },
|
|
198
|
+
steering_other: { happened: 'session.steerRefusal.steeringOther.happened', nextStep: 'session.steerRefusal.steeringOther.nextStep' },
|
|
172
199
|
};
|
|
173
|
-
const adviceOfCopy = (c) =>
|
|
174
|
-
|
|
200
|
+
const adviceOfCopy = (c, lang) => renderMessage(msg('session.steerRefusal.advice', { happened: c.happened, nextStep: c.nextStep }), lang);
|
|
201
|
+
function hostQueueFactOf(v) {
|
|
202
|
+
return v === 'queued_until_turn_end' || v === 'dropped' ? v : 'unknown';
|
|
203
|
+
}
|
|
204
|
+
function renderedCopyOf(keys, lang, hostQueue) {
|
|
205
|
+
const happened = renderMessage(msg(keys.happened), lang);
|
|
206
|
+
const tableNextStep = renderMessage(msg(keys.nextStep), lang);
|
|
207
|
+
if (hostQueue === 'queued_until_turn_end')
|
|
208
|
+
return { happened, nextStep: renderMessage(msg('session.steerRefusal.hostQueue.queued'), lang) };
|
|
209
|
+
if (hostQueue === 'dropped')
|
|
210
|
+
return { happened, nextStep: renderMessage(msg('session.steerRefusal.hostQueue.dropped', { nextStep: tableNextStep }), lang) };
|
|
211
|
+
return { happened, nextStep: tableNextStep };
|
|
212
|
+
}
|
|
175
213
|
const STEERING_OTHER_UNKNOWN_COPY = {
|
|
176
|
-
happened: '
|
|
177
|
-
nextStep: '
|
|
214
|
+
happened: 'session.steerRefusal.steeringOtherUnknown.happened',
|
|
215
|
+
nextStep: 'session.steerRefusal.steeringOtherUnknown.nextStep',
|
|
178
216
|
};
|
|
179
217
|
const CANCEL_NOT_FOUND_COPY = {
|
|
180
218
|
happened: 'this server has no run with that id for you — it does not exist, or it belongs to someone else',
|
|
@@ -210,7 +248,7 @@ function steeringCopyOf(e, safety) {
|
|
|
210
248
|
return STEERING_COPY[safety];
|
|
211
249
|
}
|
|
212
250
|
const STEERING_REFUSED_BEFORE_ENGINE = new Map([['ledger_unavailable', 503]]);
|
|
213
|
-
export function steeringRefusedBeforeEngine(e) {
|
|
251
|
+
export function steeringRefusedBeforeEngine(e, hostQueue, lang) {
|
|
214
252
|
try {
|
|
215
253
|
const { status } = errCodes(e);
|
|
216
254
|
if (status === undefined)
|
|
@@ -218,8 +256,8 @@ export function steeringRefusedBeforeEngine(e) {
|
|
|
218
256
|
const safety = steeringVerdict(e);
|
|
219
257
|
if (safety === undefined || STEERING_REFUSED_BEFORE_ENGINE.get(safety) !== status)
|
|
220
258
|
return undefined;
|
|
221
|
-
const copy = STEERING_COPY[safety];
|
|
222
|
-
return { safety, advice:
|
|
259
|
+
const copy = renderedCopyOf(STEERING_COPY[safety], lang, hostQueueFactOf(hostQueue));
|
|
260
|
+
return { safety, advice: adviceOfCopy(copy, lang), happened: copy.happened, nextStep: copy.nextStep };
|
|
223
261
|
}
|
|
224
262
|
catch {
|
|
225
263
|
return undefined;
|
|
@@ -232,22 +270,23 @@ function steeringSafetyOf(e, verdict) {
|
|
|
232
270
|
return refused !== undefined && refused.safety === verdict ? verdict : 'steering_other';
|
|
233
271
|
}
|
|
234
272
|
function steeringVerdict(e) {
|
|
235
|
-
const { code
|
|
273
|
+
const { code } = errCodes(e);
|
|
236
274
|
if (typeof code === 'string' && code.startsWith('steering.')) {
|
|
237
275
|
return STEERING_CODE_TO_SAFETY.get(code) ?? 'steering_other';
|
|
238
276
|
}
|
|
239
|
-
if (
|
|
240
|
-
return
|
|
241
|
-
|
|
277
|
+
if (readThrownSlot(e, 'errorCode', 'data') === THROWN_SLOT_UNREADABLE)
|
|
278
|
+
return undefined;
|
|
279
|
+
const protocolName = protocolErrorNameOf(e);
|
|
280
|
+
return protocolName !== undefined ? STEERING_NAME_TO_SAFETY[protocolName] : undefined;
|
|
242
281
|
}
|
|
243
|
-
export function steerRefusalAdviceOf(e) {
|
|
282
|
+
export function steerRefusalAdviceOf(e, hostQueue, lang) {
|
|
244
283
|
try {
|
|
245
284
|
const verdict = steeringVerdict(e);
|
|
246
285
|
if (verdict === undefined)
|
|
247
286
|
return undefined;
|
|
248
287
|
const safety = steeringSafetyOf(e, verdict);
|
|
249
|
-
const copy = steeringCopyOf(e, safety);
|
|
250
|
-
return { safety, advice: adviceOfCopy(copy), happened: copy.happened, nextStep: copy.nextStep };
|
|
288
|
+
const copy = renderedCopyOf(steeringCopyOf(e, safety), lang, hostQueueFactOf(hostQueue));
|
|
289
|
+
return { safety, advice: adviceOfCopy(copy, lang), happened: copy.happened, nextStep: copy.nextStep };
|
|
251
290
|
}
|
|
252
291
|
catch {
|
|
253
292
|
return undefined;
|
|
@@ -308,6 +347,6 @@ export function steerBodyOf(input, reading) {
|
|
|
308
347
|
return Object.freeze({ ...base, priority });
|
|
309
348
|
}
|
|
310
349
|
function isNotFound(e) {
|
|
311
|
-
const {
|
|
312
|
-
return
|
|
350
|
+
const { status } = errCodes(e);
|
|
351
|
+
return status === 404 || (typeof e === 'object' && e !== null && protocolErrorNameOf(e) === PROTOCOL_ERROR_NAME.NotFoundError);
|
|
313
352
|
}
|
package/dist/coreValuePorts.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export interface RouteCredentialView {
|
|
|
73
73
|
}
|
|
74
74
|
export type RouteAdjudicationView = {
|
|
75
75
|
ok: true;
|
|
76
|
-
posture: 'per-model' | 'paired' | '
|
|
76
|
+
posture: 'per-model' | 'paired' | 'keyless' | (string & {});
|
|
77
77
|
} | {
|
|
78
78
|
ok: false;
|
|
79
79
|
code: 'route.credential_mismatch' | 'route.credential_missing' | (string & {});
|
|
@@ -97,15 +97,36 @@ export interface RuleToolNameVerdictView {
|
|
|
97
97
|
readonly guidance?: string;
|
|
98
98
|
readonly currentName?: string;
|
|
99
99
|
}
|
|
100
|
+
export type RuleEntryReadingView = {
|
|
101
|
+
readonly kind: 'row';
|
|
102
|
+
readonly compiled: RuleEntryCompiledView;
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: 'inert';
|
|
105
|
+
readonly reason: string;
|
|
106
|
+
readonly verdict?: string;
|
|
107
|
+
readonly guidance?: string;
|
|
108
|
+
readonly currentName?: string;
|
|
109
|
+
readonly valueType?: string;
|
|
110
|
+
};
|
|
111
|
+
export interface RuleEntryCompiledView {
|
|
112
|
+
readonly kind: string;
|
|
113
|
+
}
|
|
114
|
+
export type McpToolAxesReadView = {
|
|
115
|
+
readonly ok: true;
|
|
116
|
+
readonly toolAxes?: Readonly<Record<string, object>>;
|
|
117
|
+
} | {
|
|
118
|
+
readonly ok: false;
|
|
119
|
+
readonly problem: string;
|
|
120
|
+
};
|
|
100
121
|
export interface CoreValuePorts {
|
|
101
122
|
resolveAutonomousLoopPrompt: (prompt: string, opts?: AutonomousLoopPromptOptionsView) => string | null;
|
|
102
123
|
loosenReasons: (prior: SessionPermissionRules, next: SessionPermissionRules) => string[];
|
|
103
|
-
combinePolicies
|
|
124
|
+
combinePolicies(...policies: CoreToolPolicyHandle[]): CoreToolPolicyHandle;
|
|
104
125
|
createAllowDenyPolicy: (opts: AllowDenyPolicyOptionsView) => CoreToolPolicyHandle;
|
|
105
126
|
MCP_NAMESPACE: CoreProtocolNamespaceView;
|
|
106
127
|
protocolOf: (name: string) => CoreProtocolNamespaceView | undefined;
|
|
107
128
|
ruleToolGrammarOf: (toolName: string) => RuleGrammarView | undefined;
|
|
108
|
-
validatePermissionRules
|
|
129
|
+
validatePermissionRules(rules: PermissionRuleView[], opts?: ValidatePermissionRulesOptionsView): PermissionRuleIssueView[];
|
|
109
130
|
mintNamespacePrefix(ns: CoreProtocolNamespaceView, peer: string): string;
|
|
110
131
|
compileAllowList(entries: readonly string[], behavior: 'allow' | 'deny', roster?: ReadonlySet<string>): AllowListReadingView;
|
|
111
132
|
routeKeyOf(url: string | undefined): string;
|
|
@@ -118,8 +139,10 @@ export interface CoreValuePorts {
|
|
|
118
139
|
adjudicateRoute?(model: RouteModelView, perModelAuth?: PerModelAuthView): RouteAdjudicationView | undefined;
|
|
119
140
|
}, model: RouteModelView, perModelAuth?: PerModelAuthView): RoutePairingStatusView;
|
|
120
141
|
judgeRuleToolName(name: string, roster: ReadonlySet<string>): RuleToolNameVerdictView;
|
|
142
|
+
readRuleEntry(raw: {} | null | undefined, behavior: 'allow' | 'deny', roster?: ReadonlySet<string>): RuleEntryReadingView;
|
|
143
|
+
readMcpToolAxes(declared: {} | null | undefined): McpToolAxesReadView;
|
|
121
144
|
}
|
|
122
|
-
export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "mintNamespacePrefix", "compileAllowList", "routeKeyOf", "joinRequestUrl", "resolveRouteCredential", "adjudicateModelRoute", "routePairingStatus", "judgeRuleToolName"];
|
|
145
|
+
export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "mintNamespacePrefix", "compileAllowList", "routeKeyOf", "joinRequestUrl", "resolveRouteCredential", "adjudicateModelRoute", "routePairingStatus", "judgeRuleToolName", "readRuleEntry", "readMcpToolAxes"];
|
|
123
146
|
export type CoreValuePortName = (typeof CORE_VALUE_PORT_NAMES)[number];
|
|
124
147
|
export declare function installCoreValuePorts(ports: Partial<CoreValuePorts> | null): () => void;
|
|
125
148
|
export declare function hasCoreValuePorts(): boolean;
|
|
@@ -145,3 +168,5 @@ export declare function adjudicateModelRoute(model: RouteModelView, credential:
|
|
|
145
168
|
export declare function routePairingStatus(brain: {
|
|
146
169
|
adjudicateRoute?(model: RouteModelView, perModelAuth?: PerModelAuthView): RouteAdjudicationView | undefined;
|
|
147
170
|
}, model: RouteModelView, perModelAuth?: PerModelAuthView): RoutePairingStatusView | undefined;
|
|
171
|
+
export declare function readRuleEntry(raw: {} | null | undefined, behavior: 'allow' | 'deny', roster?: ReadonlySet<string>): RuleEntryReadingView | undefined;
|
|
172
|
+
export declare function readMcpToolAxes(declared: {} | null | undefined): McpToolAxesReadView | undefined;
|
package/dist/coreValuePorts.js
CHANGED
|
@@ -15,6 +15,8 @@ export const CORE_VALUE_PORT_NAMES = Object.freeze([
|
|
|
15
15
|
'adjudicateModelRoute',
|
|
16
16
|
'routePairingStatus',
|
|
17
17
|
'judgeRuleToolName',
|
|
18
|
+
'readRuleEntry',
|
|
19
|
+
'readMcpToolAxes',
|
|
18
20
|
]);
|
|
19
21
|
let installed = null;
|
|
20
22
|
export function installCoreValuePorts(ports) {
|
|
@@ -99,3 +101,11 @@ export function routePairingStatus(brain, model, perModelAuth) {
|
|
|
99
101
|
const fn = port('routePairingStatus');
|
|
100
102
|
return fn === undefined ? undefined : fn(brain, model, perModelAuth);
|
|
101
103
|
}
|
|
104
|
+
export function readRuleEntry(raw, behavior, roster) {
|
|
105
|
+
const fn = port('readRuleEntry');
|
|
106
|
+
return fn === undefined ? undefined : fn(raw, behavior, roster);
|
|
107
|
+
}
|
|
108
|
+
export function readMcpToolAxes(declared) {
|
|
109
|
+
const fn = port('readMcpToolAxes');
|
|
110
|
+
return fn === undefined ? undefined : fn(declared);
|
|
111
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
|
+
export declare function corruptSessionContent(lang?: UiLanguage): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
|
+
export function corruptSessionContent(lang) {
|
|
3
|
+
return renderMessage(msg('session.corrupt.content'), lang);
|
|
4
4
|
}
|
package/dist/decideReceipt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GateOutcomeView } from './gateOutcome.js';
|
|
2
2
|
import { type ResumeReopenDetail } from './hitl/suspendedReopen.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CrashConvergedRowReading } from './hitl/crashConverged.js';
|
|
4
4
|
import type { AskRowEndingCause } from '@sema-agent/sdk';
|
|
5
5
|
export interface DecideReceiptView {
|
|
6
6
|
status?: string;
|
|
@@ -35,7 +35,7 @@ export interface AskGoneDetail {
|
|
|
35
35
|
code: 'gone.ask';
|
|
36
36
|
state?: 'VOID' | 'DENIED';
|
|
37
37
|
endingCause?: AskRowEndingCause;
|
|
38
|
-
holderGone?:
|
|
38
|
+
holderGone?: CrashConvergedRowReading['cause'];
|
|
39
39
|
}
|
|
40
40
|
export declare function askGoneFromError(e: unknown): AskGoneDetail | null;
|
|
41
41
|
export declare function askGoneContent(detail: AskGoneDetail): string;
|
package/dist/decideReceipt.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { gateOutcomeOf } from './gateOutcome.js';
|
|
2
|
+
import { readOwnDataValue } from './ownKey.js';
|
|
2
3
|
import { resumeReopenFromError } from './hitl/suspendedReopen.js';
|
|
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
|
+
import { ASK_GONE, DECIDE_CLAIM_LOST, CONFLICT_NOT_RESUMABLE, GATE_NOT_TOOL_APPROVAL, 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
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
5
6
|
import { readErrorString, readErrorStrictStringList, readThrownExtra } from './wireFailureShape.js';
|
|
6
7
|
import { isCrashConvergedCause } from './hitl/crashConverged.js';
|
|
@@ -16,7 +17,7 @@ export function readDecideReceipt(result) {
|
|
|
16
17
|
const status = Object.hasOwn(r, 'status') ? str(r.status) : undefined;
|
|
17
18
|
const taskId = Object.hasOwn(r, 'taskId') ? str(r.taskId) : undefined;
|
|
18
19
|
const sessionId = Object.hasOwn(r, 'sessionId') ? str(r.sessionId) : undefined;
|
|
19
|
-
const idempotent =
|
|
20
|
+
const idempotent = readOwnDataValue(r, 'idempotent') === true ? true : undefined;
|
|
20
21
|
const handoffTaskId = status === STATUS_RESUMING && taskId !== undefined ? taskId : undefined;
|
|
21
22
|
const executionOutcome = Object.hasOwn(r, 'executionOutcome')
|
|
22
23
|
? gateOutcomeOf({ gate: r.executionOutcome })
|
|
@@ -117,6 +118,8 @@ const DECIDE_PARK_MOVED_WHAT = Object.freeze({
|
|
|
117
118
|
[DECIDE_NOT_PARKED]: 'This approval was no longer waiting when the decision arrived (the agent was stopped, the approval was decided elsewhere, or the session it belongs to was deleted; this client cannot tell which)',
|
|
118
119
|
[DECIDE_GATE_MOVED]: 'This approval moved while the decision was on its way (it was parked again, or settled elsewhere; this client cannot tell which)',
|
|
119
120
|
[DECIDE_CLAIM_LOST]: 'Another decision on this approval got there first, or an earlier attempt is still holding it until the engine clears that hold on its own; this client cannot tell which',
|
|
121
|
+
[CONFLICT_NOT_RESUMABLE]: 'The run was no longer waiting to be resumed when the decision arrived (it had been resumed, decided, or expired before this decision; this client cannot tell which)',
|
|
122
|
+
[GATE_NOT_TOOL_APPROVAL]: 'The run is waiting at a different kind of gate than a tool approval, so this tool approval decision had nothing to act on',
|
|
120
123
|
});
|
|
121
124
|
export function decideParkMovedContent(detail) {
|
|
122
125
|
let code;
|
package/dist/detachWire.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { hostEnv } from './hostEnv.js';
|
|
2
2
|
import { envFlagOff } from './envFlag.js';
|
|
3
|
+
import { readThrownSlot } from './wireFailureShape.js';
|
|
3
4
|
import { resolveWireAuth } from './engineWireSdk.js';
|
|
4
5
|
export const DETACH_HEADER = 'x-detach-on-disconnect';
|
|
5
6
|
export const HEADLESS_DETACH_ENV = 'SEMA_HEADLESS_DETACH';
|
|
@@ -13,10 +14,10 @@ export async function resolveHeadlessDetach(env = hostEnv()) {
|
|
|
13
14
|
}
|
|
14
15
|
export const DETACH_DURABLE_OFF_400_ANCHOR = 'x-detach-on-disconnect requires a durable run';
|
|
15
16
|
export function isDetachDurableOff400(err) {
|
|
17
|
+
if (readThrownSlot(err, 'status', 'data') !== 400)
|
|
18
|
+
return false;
|
|
16
19
|
try {
|
|
17
20
|
const e = err;
|
|
18
|
-
if (e?.status !== 400)
|
|
19
|
-
return false;
|
|
20
21
|
const msg = e?.message;
|
|
21
22
|
return typeof msg === 'string' && msg.includes(DETACH_DURABLE_OFF_400_ANCHOR);
|
|
22
23
|
}
|
|
@@ -15,11 +15,7 @@ export type DeviceExecutorManagementReading = {
|
|
|
15
15
|
wsPath?: string;
|
|
16
16
|
};
|
|
17
17
|
export declare function projectDeviceExecutorManagementCapability(caps: unknown): DeviceExecutorManagementReading | undefined;
|
|
18
|
-
export declare function noteEngineCapsForDeviceExecutorManagement(baseUrl: string, caps: unknown, opts?: {
|
|
19
|
-
generation?: number;
|
|
20
|
-
}): void;
|
|
21
18
|
export declare function observedDeviceExecutorManagement(baseUrl?: string | undefined): DeviceExecutorManagementReading;
|
|
22
19
|
export declare function deviceManagementVerbsAvailable(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
23
20
|
export declare function deviceLaneOpen(reading: DeviceExecutorManagementReading): 'yes' | 'no' | 'unknown';
|
|
24
21
|
export declare function deviceExecutorManagementDoctorDetail(reading: DeviceExecutorManagementReading): string;
|
|
25
|
-
export declare function __resetDeviceExecutorManagementReadingsForTests(): void;
|
|
@@ -44,9 +44,6 @@ const reader = createEngineCapReader({
|
|
|
44
44
|
name: 'deviceExecutor.management',
|
|
45
45
|
project: projectDeviceExecutorManagementCapability,
|
|
46
46
|
});
|
|
47
|
-
export function noteEngineCapsForDeviceExecutorManagement(baseUrl, caps, opts) {
|
|
48
|
-
reader.note(baseUrl, caps, opts);
|
|
49
|
-
}
|
|
50
47
|
export function observedDeviceExecutorManagement(baseUrl = engineWireTarget()?.baseUrl) {
|
|
51
48
|
return reader.observed(baseUrl);
|
|
52
49
|
}
|
|
@@ -103,6 +100,3 @@ export function deviceExecutorManagementDoctorDetail(reading) {
|
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
|
-
export function __resetDeviceExecutorManagementReadingsForTests() {
|
|
107
|
-
reader.__resetForTests();
|
|
108
|
-
}
|
package/dist/deviceRebind.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type { AgentClient } from '@sema-agent/sdk';
|
|
1
|
+
import type { AgentClient, DeviceEnrollRequest } from '@sema-agent/sdk';
|
|
2
2
|
export type DeviceListVerb = Pick<AgentClient['devices'], 'list'>;
|
|
3
3
|
export type DeviceSessionBindingVerb = Pick<AgentClient['devices'], 'sessionBinding'>;
|
|
4
4
|
export type DeviceRebindVerb = Pick<AgentClient['devices'], 'rebind'>;
|
|
5
|
+
export type DeviceIssueEnrollTokenVerb = Pick<AgentClient['devices'], 'issueEnrollToken'>;
|
|
6
|
+
export type DeviceEnrollVerb = Pick<AgentClient['devices'], 'enroll'>;
|
|
7
|
+
export type DeviceRevokeVerb = Pick<AgentClient['devices'], 'revoke'>;
|
|
5
8
|
export interface DeviceRosterRow {
|
|
6
9
|
readonly deviceId: string;
|
|
7
10
|
readonly name?: string;
|
|
@@ -86,3 +89,48 @@ export declare function reconcileRebindOutcome(before: DeviceBindingReading, toD
|
|
|
86
89
|
readonly serverMayStillBeRunning: boolean;
|
|
87
90
|
}): DeviceRebindReconcileVerdict;
|
|
88
91
|
export declare function rebindProvesRequestNotApplied(outcome: DeviceRebindOutcome): boolean;
|
|
92
|
+
export type DeviceRegistrationVerb = 'issue' | 'enroll' | 'revoke';
|
|
93
|
+
export interface DeviceRateLimited {
|
|
94
|
+
readonly kind: 'rate-limited';
|
|
95
|
+
readonly retryAfterSec?: number;
|
|
96
|
+
}
|
|
97
|
+
export type DeviceEnrollTokenOutcome = {
|
|
98
|
+
readonly kind: 'ok';
|
|
99
|
+
readonly token: string;
|
|
100
|
+
readonly expiresAt?: string;
|
|
101
|
+
readonly ttlSec?: number;
|
|
102
|
+
} | DeviceRateLimited | DeviceUnreadable | DeviceLaneAbsent | DeviceRefused | DeviceTransport | DeviceUnarmed;
|
|
103
|
+
export type DeviceEnrollOutcome = {
|
|
104
|
+
readonly kind: 'ok';
|
|
105
|
+
readonly deviceId: string;
|
|
106
|
+
} | {
|
|
107
|
+
readonly kind: 'enrollment-invalid';
|
|
108
|
+
} | DeviceRateLimited | DeviceRebindUnconfirmed | DeviceLaneAbsent | DeviceRefused | DeviceUnarmed;
|
|
109
|
+
export type DeviceRevokeOutcome = {
|
|
110
|
+
readonly kind: 'ok';
|
|
111
|
+
readonly deviceId: string;
|
|
112
|
+
readonly revokedAt?: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'not-found';
|
|
115
|
+
} | DeviceRebindUnconfirmed | DeviceLaneAbsent | DeviceRefused | DeviceUnarmed;
|
|
116
|
+
export declare function issueEnrollToken(devices: DeviceIssueEnrollTokenVerb | null | undefined, opts?: {
|
|
117
|
+
readonly signal?: AbortSignal | undefined;
|
|
118
|
+
}): Promise<DeviceEnrollTokenOutcome>;
|
|
119
|
+
export interface DeviceEnrollOptions {
|
|
120
|
+
readonly signal?: AbortSignal | undefined;
|
|
121
|
+
readonly acceptDeviceId?: ((deviceId: string) => boolean) | undefined;
|
|
122
|
+
}
|
|
123
|
+
export declare function enrollDevice(devices: DeviceEnrollVerb | null | undefined, req: DeviceEnrollRequest, opts?: DeviceEnrollOptions): Promise<DeviceEnrollOutcome>;
|
|
124
|
+
export declare function revokeDevice(devices: DeviceRevokeVerb | null | undefined, deviceId: string, opts?: {
|
|
125
|
+
readonly reason?: string | undefined;
|
|
126
|
+
readonly signal?: AbortSignal | undefined;
|
|
127
|
+
}): Promise<DeviceRevokeOutcome>;
|
|
128
|
+
declare const IDENTITY_MISMATCH = "device.identity_mismatch";
|
|
129
|
+
export interface DeviceIdentityMismatch {
|
|
130
|
+
readonly code: typeof IDENTITY_MISMATCH;
|
|
131
|
+
readonly boundDeviceId?: string;
|
|
132
|
+
}
|
|
133
|
+
export declare function deviceIdentityMismatchOf(err: {} | null | undefined): DeviceIdentityMismatch | null;
|
|
134
|
+
export declare function deviceIdentityMismatchLine(detail: DeviceIdentityMismatch): string;
|
|
135
|
+
export declare function deviceRegistrationOutcomeLine(verb: DeviceRegistrationVerb, outcome: DeviceEnrollTokenOutcome | DeviceEnrollOutcome | DeviceRevokeOutcome): string | undefined;
|
|
136
|
+
export {};
|