@sema-agent/client-core 0.97.1 → 0.98.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 +408 -0
- package/README.md +74 -37
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +128 -34
- 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/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 +5 -0
- package/dist/adapter/activeRunSelfHeal.js +51 -28
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +27 -34
- 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 +29 -13
- package/dist/adapter/types.d.ts +4 -4
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentsWireCaps.d.ts +8 -8
- package/dist/agentsWireCaps.js +168 -175
- 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 +4 -2
- package/dist/cloudConfigWireCaps.js +81 -61
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +14 -1
- package/dist/controlRouter.js +68 -17
- package/dist/coreValuePorts.d.ts +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- 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/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +250 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +5 -4
- package/dist/engineAgentPanelStore.js +3 -12
- package/dist/engineCapReader.d.ts +0 -4
- package/dist/engineCapReader.js +1 -5
- package/dist/engineCapsCache.d.ts +4 -0
- package/dist/engineCapsCache.js +17 -12
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +9 -2
- package/dist/engineErrorCodes.js +9 -1
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +111 -0
- package/dist/engineSessionMessages.d.ts +67 -0
- package/dist/engineSessionMessages.js +364 -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/env/uiLanguage.d.ts +9 -0
- package/dist/env/uiLanguage.js +35 -0
- package/dist/eventLeg.d.ts +92 -0
- package/dist/eventLeg.js +285 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +0 -4
- package/dist/fileHistoryCaptureCapability.js +5 -7
- 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 +5 -0
- package/dist/frameBinding.js +23 -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 +25 -6
- package/dist/gateVocabulary.d.ts +5 -0
- package/dist/gateVocabulary.js +64 -2
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +6 -3
- package/dist/generated/engineFactTables.js +22 -4
- package/dist/generated/engineNoticeTables.js +9 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +6 -1
- package/dist/hitl/allowRuleShadow.js +21 -17
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +13 -0
- package/dist/hitl/approvalCardReasons.js +120 -0
- package/dist/hitl/approvalHolds.d.ts +47 -15
- package/dist/hitl/approvalHolds.js +134 -28
- 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 +1 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +49 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +18 -0
- package/dist/hitl/askSettlementLine.js +79 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +21 -5
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +3 -1
- package/dist/hitl/crashConvergedNotice.js +48 -11
- 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 +20 -16
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +1 -2
- package/dist/hitl/hitlBridge.js +10 -7
- 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 +24 -0
- package/dist/hitl/persistedRulesWire.js +122 -2
- package/dist/hitl/planReviewWire.d.ts +26 -13
- package/dist/hitl/planReviewWire.js +112 -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.js +2 -4
- package/dist/hitl/sessionPolicyWire.d.ts +32 -20
- package/dist/hitl/sessionPolicyWire.js +162 -52
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/toolApprovalWire.d.ts +87 -152
- package/dist/hitl/toolApprovalWire.js +591 -380
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +59 -55
- package/dist/i18n/messages.en.d.ts +121 -0
- package/dist/i18n/messages.en.js +119 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +120 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +53 -20
- package/dist/index.js +38 -11
- package/dist/inheritEnvCapability.d.ts +31 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/liveModelCatalog.d.ts +1 -2
- package/dist/liveModelCatalog.js +2 -6
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpProbeWire.d.ts +6 -1
- package/dist/mcpProbeWire.js +1 -1
- package/dist/mcpWireCaps.d.ts +13 -2
- package/dist/mcpWireCaps.js +48 -0
- package/dist/memoryEntriesWire.d.ts +4 -9
- 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/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- 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 +15 -0
- package/dist/ownKey.js +60 -3
- package/dist/panelReduce.d.ts +15 -9
- package/dist/panelReduce.js +680 -549
- 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/permissionRulesWriteCapability.d.ts +0 -4
- package/dist/permissionRulesWriteCapability.js +0 -6
- 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 +1 -1
- package/dist/pluginHooksWire.js +3 -6
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -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 +0 -1
- package/dist/request/taskRequest.js +0 -3
- package/dist/resumeRefusalCopy.d.ts +2 -1
- package/dist/resumeRefusalCopy.js +38 -2
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +106 -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/scenarioWire.js +1 -1
- package/dist/seam.d.ts +24 -2
- package/dist/seam.js +15 -3
- package/dist/seatContract.d.ts +53 -10
- package/dist/seatContract.js +132 -81
- package/dist/sessionPolicyCapability.d.ts +0 -4
- package/dist/sessionPolicyCapability.js +0 -6
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/skillToolListsCapability.d.ts +0 -3
- package/dist/skillToolListsCapability.js +0 -3
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- 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/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.js +1 -11
- 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/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +0 -2
- package/dist/toolRoster.js +0 -2
- package/dist/turnFailurePresentation.d.ts +28 -0
- package/dist/turnFailurePresentation.js +205 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -3
- package/dist/userInvokedSkillsCapability.js +0 -3
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.js +5 -24
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +105 -5
- package/dist/wireRefusalCopy.d.ts +12 -2
- package/dist/wireRefusalCopy.js +50 -52
- package/dist/workflowsJournalCapability.d.ts +0 -4
- package/dist/workflowsJournalCapability.js +0 -6
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1253 -46
- package/package.json +5 -4
- 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/wireErrorTriage.js
CHANGED
|
@@ -2,7 +2,7 @@ import { readBlockedBy, readErrorNumber, readErrorString, readErrorStringList, r
|
|
|
2
2
|
import { capForDisplay, escapeDisplayControlChars } from './fleetTaskDesc.js';
|
|
3
3
|
import { readOwnDataValue } from './ownKey.js';
|
|
4
4
|
import { fleetLeaseUnavailableFromError } from './wireRefusalCopy.js';
|
|
5
|
-
import { DRAINING_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, 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
|
+
import { CORRUPT_ROW_ERROR_CODE, DRAINING_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, 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';
|
|
6
6
|
export const WIRE_NETWORK_ERROR_PATTERN = /fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|EHOSTUNREACH|ENETUNREACH|EPIPE|socket hang up|UND_ERR|\bterminated\b|\bother side closed\b/i;
|
|
7
7
|
function readTurnErrorSlots(err) {
|
|
8
8
|
if (err === null || err === undefined)
|
|
@@ -72,13 +72,7 @@ export function isPreStreamDrainingReject(err) {
|
|
|
72
72
|
export function effectiveWireErrorCode(err) {
|
|
73
73
|
if (typeof err !== 'object' || err === null)
|
|
74
74
|
return undefined;
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
outerRaw = err.errorCode;
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
outerRaw = undefined;
|
|
81
|
-
}
|
|
75
|
+
const outerRaw = readThrownSlot(err, 'errorCode', 'data');
|
|
82
76
|
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
83
77
|
return foldedWireErrorCode(err, outer);
|
|
84
78
|
}
|
|
@@ -93,7 +87,7 @@ export function corruptStoredRowWhere(err) {
|
|
|
93
87
|
return typeof err === 'object' && err !== null ? storedRowWhereOf(err, code) : undefined;
|
|
94
88
|
}
|
|
95
89
|
function storedRowWhereOf(err, effectiveCode) {
|
|
96
|
-
if (effectiveCode !==
|
|
90
|
+
if (effectiveCode !== CORRUPT_ROW_ERROR_CODE)
|
|
97
91
|
return undefined;
|
|
98
92
|
const where = readErrorString(err, 'where');
|
|
99
93
|
return where !== undefined && where.trim().length > 0 ? where : undefined;
|
|
@@ -150,24 +144,11 @@ export function streamDrainingDecision(frame, attempt, opts) {
|
|
|
150
144
|
export function scenarioDenyFromError(err) {
|
|
151
145
|
if (typeof err !== 'object' || err === null)
|
|
152
146
|
return null;
|
|
153
|
-
const
|
|
154
|
-
let status;
|
|
155
|
-
try {
|
|
156
|
-
status = e.status;
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
147
|
+
const status = readThrownSlot(err, 'status', 'data');
|
|
161
148
|
if (status !== 400 && status !== 409)
|
|
162
149
|
return null;
|
|
163
150
|
if (status === 409) {
|
|
164
|
-
|
|
165
|
-
try {
|
|
166
|
-
outer = e.errorCode;
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
151
|
+
const outer = readThrownSlot(err, 'errorCode', 'data');
|
|
171
152
|
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
172
153
|
return null;
|
|
173
154
|
}
|
|
@@ -4,9 +4,10 @@ interface WireFailureShape {
|
|
|
4
4
|
retryAfterSec?: number;
|
|
5
5
|
committed?: 'no' | 'unknown' | 'unreadable';
|
|
6
6
|
bodyField?: string;
|
|
7
|
-
bodyName?: string;
|
|
8
7
|
bodyVerdict?: string;
|
|
9
8
|
bodyCurrentName?: string;
|
|
9
|
+
bodyEntry?: string;
|
|
10
|
+
bodyReason?: string;
|
|
10
11
|
message: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const THROWN_SLOT_UNREADABLE: unique symbol;
|
|
@@ -21,6 +22,40 @@ export type ThrownExtraReading = {
|
|
|
21
22
|
readonly state: 'unreadable';
|
|
22
23
|
};
|
|
23
24
|
export declare function readThrownExtra(o: {} | null | undefined): ThrownExtraReading;
|
|
25
|
+
export declare const PROTOCOL_ERROR_NAME: Readonly<{
|
|
26
|
+
readonly ApprovalBindingMismatchError: "ApprovalBindingMismatchError";
|
|
27
|
+
readonly ApprovalStaleError: "ApprovalStaleError";
|
|
28
|
+
readonly AskDecidedError: "AskDecidedError";
|
|
29
|
+
readonly ConflictError: "ConflictError";
|
|
30
|
+
readonly NotFoundError: "NotFoundError";
|
|
31
|
+
readonly ParkedResumeStartupError: "ParkedResumeStartupError";
|
|
32
|
+
readonly RateLimitedError: "RateLimitedError";
|
|
33
|
+
readonly SteeringAmbiguousTargetError: "SteeringAmbiguousTargetError";
|
|
34
|
+
readonly SteeringDuplicateInputIdError: "SteeringDuplicateInputIdError";
|
|
35
|
+
readonly SteeringError: "SteeringError";
|
|
36
|
+
readonly SteeringInvalidContentError: "SteeringInvalidContentError";
|
|
37
|
+
readonly SteeringLedgerUnavailableError: "SteeringLedgerUnavailableError";
|
|
38
|
+
readonly SteeringNotRunningError: "SteeringNotRunningError";
|
|
39
|
+
readonly SteeringQueueFullError: "SteeringQueueFullError";
|
|
40
|
+
readonly SteeringStillRunningError: "SteeringStillRunningError";
|
|
41
|
+
readonly UsageWindowExhaustedError: "UsageWindowExhaustedError";
|
|
42
|
+
}>;
|
|
43
|
+
export type ProtocolErrorName = (typeof PROTOCOL_ERROR_NAME)[keyof typeof PROTOCOL_ERROR_NAME];
|
|
44
|
+
export declare function isSdkErrorInstance(o: object): boolean;
|
|
45
|
+
export type ProtocolErrorNameReading = {
|
|
46
|
+
readonly state: 'named';
|
|
47
|
+
readonly name: ProtocolErrorName;
|
|
48
|
+
} | {
|
|
49
|
+
readonly state: 'absent';
|
|
50
|
+
} | {
|
|
51
|
+
readonly state: 'sdk-instance';
|
|
52
|
+
} | {
|
|
53
|
+
readonly state: 'unreadable';
|
|
54
|
+
};
|
|
55
|
+
export declare function protocolErrorNameReading(e: object): ProtocolErrorNameReading;
|
|
56
|
+
export declare function protocolErrorNameOf(e: object): ProtocolErrorName | undefined;
|
|
57
|
+
export type ThrownStatusReading = number | undefined | typeof THROWN_SLOT_UNREADABLE;
|
|
58
|
+
export declare function readThrownStatusSlot(o: object): ThrownStatusReading;
|
|
24
59
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
25
60
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
26
61
|
export declare function readErrorString(o: object, key: string): string | undefined;
|
|
@@ -28,10 +63,17 @@ export declare function readErrorStringList(o: object, key: string): readonly st
|
|
|
28
63
|
export declare function readErrorStrictStringList(o: object, key: string): readonly string[] | undefined;
|
|
29
64
|
export declare const WIRE_FAILURE_UNRENDERABLE_TEXT = "the call failed with an error this client could not render";
|
|
30
65
|
export declare function wireFailureShapeOf(e: unknown): WireFailureShape;
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
66
|
+
export interface WireFailureCore {
|
|
67
|
+
readonly status?: number;
|
|
68
|
+
readonly errorCode?: string;
|
|
69
|
+
readonly message: string;
|
|
70
|
+
}
|
|
71
|
+
export declare function wireFailureCoreOf(e: {} | null | undefined): WireFailureCore;
|
|
72
|
+
export interface WireFailureTexts {
|
|
73
|
+
readonly reason: string;
|
|
74
|
+
readonly log: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function wireFailureTextsOf(e: unknown): WireFailureTexts;
|
|
35
77
|
export type BlockedByReading = {
|
|
36
78
|
kind: 'named';
|
|
37
79
|
code: string;
|
|
@@ -42,4 +84,19 @@ export type BlockedByReading = {
|
|
|
42
84
|
};
|
|
43
85
|
export declare function readBlockedBy(o: object): BlockedByReading;
|
|
44
86
|
export declare function readRefusalField(o: object): string | undefined;
|
|
87
|
+
export declare function isDisplayableWireCode(s: string): boolean;
|
|
88
|
+
export declare const ASSEMBLY_REFUSAL_CAUSES: readonly ["ports_missing", "judge_unanswerable", "input_malformed", "agents_projection_failed", "agents_not_ready"];
|
|
89
|
+
export interface AssemblyRefusal {
|
|
90
|
+
readonly code: 'assembly_refused';
|
|
91
|
+
readonly detail: {
|
|
92
|
+
readonly cause: (typeof ASSEMBLY_REFUSAL_CAUSES)[number];
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export declare function assemblyRefusal(cause: AssemblyRefusal['detail']['cause']): AssemblyRefusal;
|
|
96
|
+
export declare function withAssemblyRefusal<E extends Error>(err: E, cause: AssemblyRefusal['detail']['cause']): E;
|
|
97
|
+
export declare function asAssemblyRefusal(thrown: {} | null | undefined, cause: AssemblyRefusal['detail']['cause'], who: string): {};
|
|
98
|
+
export declare function assemblyRefusalOf(x: {} | null | undefined): {
|
|
99
|
+
readonly code: 'assembly_refused';
|
|
100
|
+
readonly cause: AssemblyRefusal['detail']['cause'] | 'unknown';
|
|
101
|
+
} | undefined;
|
|
45
102
|
export {};
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -105,6 +105,57 @@ export function readThrownExtra(o) {
|
|
|
105
105
|
}
|
|
106
106
|
return { state: 'object', value: slot };
|
|
107
107
|
}
|
|
108
|
+
export const PROTOCOL_ERROR_NAME = Object.freeze({
|
|
109
|
+
ApprovalBindingMismatchError: 'ApprovalBindingMismatchError',
|
|
110
|
+
ApprovalStaleError: 'ApprovalStaleError',
|
|
111
|
+
AskDecidedError: 'AskDecidedError',
|
|
112
|
+
ConflictError: 'ConflictError',
|
|
113
|
+
NotFoundError: 'NotFoundError',
|
|
114
|
+
ParkedResumeStartupError: 'ParkedResumeStartupError',
|
|
115
|
+
RateLimitedError: 'RateLimitedError',
|
|
116
|
+
SteeringAmbiguousTargetError: 'SteeringAmbiguousTargetError',
|
|
117
|
+
SteeringDuplicateInputIdError: 'SteeringDuplicateInputIdError',
|
|
118
|
+
SteeringError: 'SteeringError',
|
|
119
|
+
SteeringInvalidContentError: 'SteeringInvalidContentError',
|
|
120
|
+
SteeringLedgerUnavailableError: 'SteeringLedgerUnavailableError',
|
|
121
|
+
SteeringNotRunningError: 'SteeringNotRunningError',
|
|
122
|
+
SteeringQueueFullError: 'SteeringQueueFullError',
|
|
123
|
+
SteeringStillRunningError: 'SteeringStillRunningError',
|
|
124
|
+
UsageWindowExhaustedError: 'UsageWindowExhaustedError',
|
|
125
|
+
});
|
|
126
|
+
const PROTOCOL_ERROR_NAMES = new Set(Object.values(PROTOCOL_ERROR_NAME));
|
|
127
|
+
export function isSdkErrorInstance(o) {
|
|
128
|
+
try {
|
|
129
|
+
return extraSlotOf(o).kind === 'sdk-class';
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export function protocolErrorNameReading(e) {
|
|
136
|
+
if (typeof e !== 'object' || e === null)
|
|
137
|
+
return { state: 'absent' };
|
|
138
|
+
try {
|
|
139
|
+
if (isSdkErrorInstance(e))
|
|
140
|
+
return { state: 'sdk-instance' };
|
|
141
|
+
const name = ownDataField(e, 'name');
|
|
142
|
+
return typeof name === 'string' && PROTOCOL_ERROR_NAMES.has(name) ? { state: 'named', name: name } : { state: 'absent' };
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return { state: 'unreadable' };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export function protocolErrorNameOf(e) {
|
|
149
|
+
const r = protocolErrorNameReading(e);
|
|
150
|
+
return r.state === 'named' ? r.name : undefined;
|
|
151
|
+
}
|
|
152
|
+
export function readThrownStatusSlot(o) {
|
|
153
|
+
const st = readThrownSlot(o, 'status', 'data');
|
|
154
|
+
const raw = st !== THROWN_SLOT_UNREADABLE && (st === undefined || st === null) ? readThrownSlot(o, 'statusCode', 'data') : st;
|
|
155
|
+
if (raw === undefined)
|
|
156
|
+
return undefined;
|
|
157
|
+
return typeof raw === 'number' ? raw : THROWN_SLOT_UNREADABLE;
|
|
158
|
+
}
|
|
108
159
|
function readErrorSlot(obj, key, accept) {
|
|
109
160
|
try {
|
|
110
161
|
const topRaw = readThrownSlot(obj, key, 'data');
|
|
@@ -216,9 +267,10 @@ export function wireFailureShapeOf(e) {
|
|
|
216
267
|
}
|
|
217
268
|
};
|
|
218
269
|
const bodyField = ownString('field');
|
|
219
|
-
const bodyName = ownString('name');
|
|
220
270
|
const bodyVerdict = ownString('verdict');
|
|
221
271
|
const bodyCurrentName = ownString('currentName');
|
|
272
|
+
const bodyEntry = ownString('entry');
|
|
273
|
+
const bodyReason = ownString('reason');
|
|
222
274
|
const ownMessage = typeof rawMessage === 'string' && rawMessage !== '' ? rawMessage : undefined;
|
|
223
275
|
const message = userFacingReasonOf(e, ownMessage);
|
|
224
276
|
const sec = typeof retryAfterMs === 'number' && Number.isFinite(retryAfterMs) && retryAfterMs >= 0
|
|
@@ -237,12 +289,21 @@ export function wireFailureShapeOf(e) {
|
|
|
237
289
|
...(sec !== undefined ? { retryAfterSec: sec } : {}),
|
|
238
290
|
...(committed !== undefined ? { committed } : {}),
|
|
239
291
|
...(bodyField !== undefined ? { bodyField } : {}),
|
|
240
|
-
...(bodyName !== undefined ? { bodyName } : {}),
|
|
241
292
|
...(bodyVerdict !== undefined ? { bodyVerdict } : {}),
|
|
242
293
|
...(bodyCurrentName !== undefined ? { bodyCurrentName } : {}),
|
|
294
|
+
...(bodyEntry !== undefined ? { bodyEntry } : {}),
|
|
295
|
+
...(bodyReason !== undefined ? { bodyReason } : {}),
|
|
243
296
|
message,
|
|
244
297
|
};
|
|
245
298
|
}
|
|
299
|
+
export function wireFailureCoreOf(e) {
|
|
300
|
+
const shape = wireFailureShapeOf(e);
|
|
301
|
+
return {
|
|
302
|
+
...(shape.status !== undefined ? { status: shape.status } : {}),
|
|
303
|
+
...(shape.errorCode !== undefined ? { errorCode: shape.errorCode } : {}),
|
|
304
|
+
message: shape.message,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
246
307
|
export function wireFailureTextsOf(e) {
|
|
247
308
|
const { message } = wireFailureShapeOf(e);
|
|
248
309
|
let log;
|
|
@@ -257,14 +318,18 @@ export function wireFailureTextsOf(e) {
|
|
|
257
318
|
export function readBlockedBy(o) {
|
|
258
319
|
const judge = (v) => (typeof v === 'string' && v.length > 0 ? { kind: 'named', code: v } : { kind: 'unreadable' });
|
|
259
320
|
try {
|
|
260
|
-
const top = o
|
|
321
|
+
const top = readThrownSlot(o, 'blockedBy', 'data');
|
|
322
|
+
if (top === THROWN_SLOT_UNREADABLE)
|
|
323
|
+
return { kind: 'unreadable' };
|
|
261
324
|
if (top !== undefined)
|
|
262
325
|
return judge(top);
|
|
263
326
|
const reading = readThrownExtra(o);
|
|
264
327
|
if (reading.state === 'unreadable')
|
|
265
328
|
return { kind: 'unreadable' };
|
|
266
|
-
if (reading.state === 'object'
|
|
267
|
-
|
|
329
|
+
if (reading.state === 'object') {
|
|
330
|
+
const d = Object.getOwnPropertyDescriptor(reading.value, 'blockedBy');
|
|
331
|
+
if (d !== undefined)
|
|
332
|
+
return Object.hasOwn(d, 'value') ? judge(d.value) : { kind: 'unreadable' };
|
|
268
333
|
}
|
|
269
334
|
return { kind: 'absent' };
|
|
270
335
|
}
|
|
@@ -285,3 +350,38 @@ export function readRefusalField(o) {
|
|
|
285
350
|
}
|
|
286
351
|
return str(o);
|
|
287
352
|
}
|
|
353
|
+
const DISPLAYABLE_WIRE_CODE = /^[A-Za-z0-9._:-]{1,64}$/;
|
|
354
|
+
export function isDisplayableWireCode(s) {
|
|
355
|
+
return DISPLAYABLE_WIRE_CODE.test(s);
|
|
356
|
+
}
|
|
357
|
+
export const ASSEMBLY_REFUSAL_CAUSES = Object.freeze([
|
|
358
|
+
'ports_missing',
|
|
359
|
+
'judge_unanswerable',
|
|
360
|
+
'input_malformed',
|
|
361
|
+
'agents_projection_failed',
|
|
362
|
+
'agents_not_ready',
|
|
363
|
+
]);
|
|
364
|
+
const CODE = 'assembly_refused';
|
|
365
|
+
export function assemblyRefusal(cause) {
|
|
366
|
+
return Object.freeze({ code: CODE, detail: Object.freeze({ cause }) });
|
|
367
|
+
}
|
|
368
|
+
export function withAssemblyRefusal(err, cause) {
|
|
369
|
+
Object.defineProperty(err, 'code', { value: CODE, writable: true, enumerable: true, configurable: true });
|
|
370
|
+
Object.defineProperty(err, 'detail', { value: Object.freeze({ cause }), writable: true, enumerable: true, configurable: true });
|
|
371
|
+
return err;
|
|
372
|
+
}
|
|
373
|
+
export function asAssemblyRefusal(thrown, cause, who) {
|
|
374
|
+
if (assemblyRefusalOf(thrown) !== undefined)
|
|
375
|
+
return thrown;
|
|
376
|
+
return withAssemblyRefusal(new Error(`${who}: 装配时出错,拒绝装配(原抛出物见 cause)。`, { cause: thrown }), cause);
|
|
377
|
+
}
|
|
378
|
+
export function assemblyRefusalOf(x) {
|
|
379
|
+
if (x === null || x === undefined)
|
|
380
|
+
return undefined;
|
|
381
|
+
if (readThrownSlot(x, 'code', 'data') !== CODE)
|
|
382
|
+
return undefined;
|
|
383
|
+
const detail = readThrownSlot(x, 'detail', 'data');
|
|
384
|
+
const cause = typeof detail === 'object' && detail !== null ? readThrownSlot(detail, 'cause', 'data') : undefined;
|
|
385
|
+
const known = ASSEMBLY_REFUSAL_CAUSES.includes(cause) ? cause : 'unknown';
|
|
386
|
+
return Object.freeze({ code: CODE, cause: known });
|
|
387
|
+
}
|
|
@@ -77,11 +77,21 @@ export interface HostPostureRefusalDetail {
|
|
|
77
77
|
}
|
|
78
78
|
export declare function hostPostureRefusalFromError(err: unknown, sentRequest?: TaskRequestLike): HostPostureRefusalDetail | null;
|
|
79
79
|
export declare function hostPostureRefusalContent(detail: Pick<HostPostureRefusalDetail, 'askedWholeEnvironment' | 'askedOpenWriteFace'>): string;
|
|
80
|
-
export
|
|
80
|
+
export type HookMatcherRefusal = {
|
|
81
|
+
readonly reason: 'alias_without_canonical';
|
|
81
82
|
readonly event: string;
|
|
82
83
|
readonly alias: string;
|
|
83
84
|
readonly canonical: string;
|
|
84
|
-
}
|
|
85
|
+
} | {
|
|
86
|
+
readonly reason: 'invalid_regex';
|
|
87
|
+
readonly event: string;
|
|
88
|
+
readonly groupIndex: number;
|
|
89
|
+
} | {
|
|
90
|
+
readonly reason: 'over_budget';
|
|
91
|
+
readonly event: string;
|
|
92
|
+
readonly groupIndex: number;
|
|
93
|
+
readonly budgetMs?: number;
|
|
94
|
+
};
|
|
85
95
|
export declare function hookMatcherRefusalFromError(err: unknown): HookMatcherRefusal | undefined;
|
|
86
96
|
export interface AutonomyLaneRefusalDetail {
|
|
87
97
|
readonly code: typeof REQUEST_AUTONOMY_LANE_REFUSED;
|
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
import { readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField } from './wireFailureShape.js';
|
|
2
|
-
import { readOwnNonEmptyString } from './ownKey.js';
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
|
+
import { readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
|
|
3
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';
|
|
7
7
|
export const CONFLICT_APPROVAL_SETTLED = 'conflict.approval_settled';
|
|
8
8
|
export const CONFLICT_RUN_NOT_RUNNING = 'conflict.run_not_running';
|
|
9
|
-
function
|
|
10
|
-
const v = o
|
|
9
|
+
function ownNonEmptyStringSlot(o, key) {
|
|
10
|
+
const v = readThrownSlot(o, key, 'data');
|
|
11
11
|
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
12
12
|
}
|
|
13
13
|
export function cancelConflictFromError(err) {
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
if (err === null || typeof err !== 'object')
|
|
17
|
-
return null;
|
|
18
|
-
o = err;
|
|
19
|
-
const rawStatus = o.status ?? o.statusCode;
|
|
20
|
-
const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
|
|
21
|
-
if (!is409)
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
14
|
+
if (err === null || typeof err !== 'object')
|
|
25
15
|
return null;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
code = undefined;
|
|
33
|
-
}
|
|
16
|
+
const rawStatus = readThrownStatusSlot(err);
|
|
17
|
+
if (rawStatus === THROWN_SLOT_UNREADABLE)
|
|
18
|
+
return null;
|
|
19
|
+
if (!(rawStatus === 409 || (rawStatus === undefined && protocolErrorNameOf(err) === PROTOCOL_ERROR_NAME.ConflictError)))
|
|
20
|
+
return null;
|
|
21
|
+
const code = ownNonEmptyStringSlot(err, 'errorCode');
|
|
34
22
|
if (code === CONFLICT_APPROVAL_SETTLED)
|
|
35
23
|
return { kind: 'approval_settled', code };
|
|
36
24
|
if (code === CONFLICT_RUN_NOT_RUNNING)
|
|
@@ -58,17 +46,20 @@ export function usageWindowExhaustedFromError(err) {
|
|
|
58
46
|
if (err === null || typeof err !== 'object')
|
|
59
47
|
return null;
|
|
60
48
|
const o = err;
|
|
61
|
-
if (o
|
|
49
|
+
if (readThrownSlot(o, 'errorCode', 'data') !== USAGE_WINDOW_EXHAUSTED)
|
|
50
|
+
return null;
|
|
51
|
+
const rawStatus = readThrownStatusSlot(o);
|
|
52
|
+
if (rawStatus === THROWN_SLOT_UNREADABLE)
|
|
62
53
|
return null;
|
|
63
|
-
const
|
|
64
|
-
const is429 = rawStatus === 429 || (rawStatus === undefined && (
|
|
54
|
+
const protocolName = rawStatus === undefined ? protocolErrorNameOf(o) : undefined;
|
|
55
|
+
const is429 = rawStatus === 429 || (rawStatus === undefined && (protocolName === PROTOCOL_ERROR_NAME.UsageWindowExhaustedError || protocolName === PROTOCOL_ERROR_NAME.RateLimitedError));
|
|
65
56
|
if (!is429)
|
|
66
57
|
return null;
|
|
67
58
|
const rawSec = readErrorNumber(o, 'retryAfterSec');
|
|
68
59
|
const sec = nonNegativeFinite(rawSec)
|
|
69
60
|
? Math.ceil(rawSec)
|
|
70
61
|
: (() => {
|
|
71
|
-
const rawMs = o
|
|
62
|
+
const rawMs = readThrownSlot(o, 'retryAfterMs', 'data');
|
|
72
63
|
return nonNegativeFinite(rawMs) ? Math.ceil(rawMs / 1000) : undefined;
|
|
73
64
|
})();
|
|
74
65
|
return { code: USAGE_WINDOW_EXHAUSTED, ...(sec !== undefined ? { retryAfterSec: sec } : {}) };
|
|
@@ -98,13 +89,7 @@ const positiveFinite = (v) => typeof v === 'number' && Number.isFinite(v) && v >
|
|
|
98
89
|
export function fleetLeaseUnavailableFromError(err) {
|
|
99
90
|
if (err === null || typeof err !== 'object')
|
|
100
91
|
return null;
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
code = err.errorCode;
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
92
|
+
const code = readThrownSlot(err, 'errorCode', 'data');
|
|
108
93
|
if (code !== FLEET_LEASE_UNAVAILABLE)
|
|
109
94
|
return null;
|
|
110
95
|
const reason = readErrorString(err, 'reason');
|
|
@@ -190,11 +175,11 @@ export function denyAttributionRefusalFromError(err, sentAttributionKey) {
|
|
|
190
175
|
if (err === null || typeof err !== 'object')
|
|
191
176
|
return null;
|
|
192
177
|
const o = err;
|
|
193
|
-
const rawStatus = o
|
|
178
|
+
const rawStatus = readThrownStatusSlot(o);
|
|
194
179
|
const status = typeof rawStatus === 'number' && Number.isFinite(rawStatus) ? rawStatus : undefined;
|
|
195
180
|
if (status === undefined)
|
|
196
181
|
return null;
|
|
197
|
-
const code =
|
|
182
|
+
const code = ownNonEmptyStringSlot(o, 'errorCode');
|
|
198
183
|
if (code === undefined)
|
|
199
184
|
return null;
|
|
200
185
|
if (status === 400 && (code === SETTLED_BY_NOT_IN_PROOF || code === DECIDED_BY_NOT_IN_PROOF))
|
|
@@ -245,12 +230,12 @@ export function sessionDeleteConflictFromError(err) {
|
|
|
245
230
|
try {
|
|
246
231
|
if (err === null || typeof err !== 'object')
|
|
247
232
|
return null;
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
|
|
251
|
-
if (!is409)
|
|
233
|
+
const rawStatus = readThrownStatusSlot(err);
|
|
234
|
+
if (rawStatus === THROWN_SLOT_UNREADABLE)
|
|
252
235
|
return null;
|
|
253
|
-
|
|
236
|
+
if (!(rawStatus === 409 || (rawStatus === undefined && protocolErrorNameOf(err) === PROTOCOL_ERROR_NAME.ConflictError)))
|
|
237
|
+
return null;
|
|
238
|
+
const code = ownNonEmptyStringSlot(err, 'errorCode');
|
|
254
239
|
if (code === CONFLICT_SESSION_CHILDREN_ALIVE) {
|
|
255
240
|
const remaining = readErrorStringList(err, 'remaining')?.filter((id) => id.length > 0);
|
|
256
241
|
return { kind: 'children_alive', code, ...(remaining !== undefined && remaining.length > 0 ? { remaining: Object.freeze(remaining) } : {}) };
|
|
@@ -391,13 +376,7 @@ export function toolDeclarationRefusalFromError(err) {
|
|
|
391
376
|
try {
|
|
392
377
|
if (typeof err !== 'object' || err === null)
|
|
393
378
|
return null;
|
|
394
|
-
|
|
395
|
-
try {
|
|
396
|
-
code = err.errorCode;
|
|
397
|
-
}
|
|
398
|
-
catch {
|
|
399
|
-
return null;
|
|
400
|
-
}
|
|
379
|
+
const code = readThrownSlot(err, 'errorCode', 'data');
|
|
401
380
|
if (typeof code !== 'string' || !CORE_TOOL_DECLARATION_CODES.includes(code))
|
|
402
381
|
return null;
|
|
403
382
|
return Object.freeze({ code });
|
|
@@ -600,11 +579,30 @@ export function hookMatcherRefusalFromError(err) {
|
|
|
600
579
|
if (detail === undefined)
|
|
601
580
|
return undefined;
|
|
602
581
|
const event = readOwnNonEmptyString(detail, 'event');
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
582
|
+
if (event === undefined)
|
|
583
|
+
return undefined;
|
|
584
|
+
const reasonRaw = readOwnDataValue(detail, 'reason');
|
|
585
|
+
if (reasonRaw === undefined || reasonRaw === 'dead_alias') {
|
|
586
|
+
const alias = readOwnNonEmptyString(detail, 'alias');
|
|
587
|
+
const canonical = readOwnNonEmptyString(detail, 'canonical');
|
|
588
|
+
if (alias === undefined || canonical === undefined)
|
|
589
|
+
return undefined;
|
|
590
|
+
return Object.freeze({ reason: 'alias_without_canonical', event, alias, canonical });
|
|
591
|
+
}
|
|
592
|
+
if (reasonRaw !== 'invalid_regex' && reasonRaw !== 'over_budget')
|
|
593
|
+
return undefined;
|
|
594
|
+
const groupIndex = readOwnDataValue(detail, 'groupIndex');
|
|
595
|
+
if (typeof groupIndex !== 'number' || !Number.isInteger(groupIndex) || groupIndex < 0)
|
|
606
596
|
return undefined;
|
|
607
|
-
|
|
597
|
+
if (reasonRaw === 'invalid_regex')
|
|
598
|
+
return Object.freeze({ reason: 'invalid_regex', event, groupIndex });
|
|
599
|
+
const budget = readOwnDataValue(detail, 'budgetMs');
|
|
600
|
+
return Object.freeze({
|
|
601
|
+
reason: 'over_budget',
|
|
602
|
+
event,
|
|
603
|
+
groupIndex,
|
|
604
|
+
...(typeof budget === 'number' && Number.isFinite(budget) && budget > 0 ? { budgetMs: budget } : {}),
|
|
605
|
+
});
|
|
608
606
|
}
|
|
609
607
|
catch {
|
|
610
608
|
return undefined;
|
|
@@ -10,10 +10,6 @@ export type WorkflowsJournalReading = {
|
|
|
10
10
|
kind: 'present';
|
|
11
11
|
};
|
|
12
12
|
export declare function projectWorkflowsJournalCapability(caps: unknown): WorkflowsJournalReading | undefined;
|
|
13
|
-
export declare function noteEngineCapsForWorkflowsJournal(baseUrl: string, caps: unknown, opts?: {
|
|
14
|
-
generation?: number;
|
|
15
|
-
}): void;
|
|
16
13
|
export declare function observedWorkflowsJournal(baseUrl?: string | undefined): WorkflowsJournalReading;
|
|
17
14
|
export declare function workflowsJournalAvailable(reading: WorkflowsJournalReading): 'yes' | 'no' | 'unknown';
|
|
18
15
|
export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading): string;
|
|
19
|
-
export declare function __resetWorkflowsJournalReadingsForTests(): void;
|
|
@@ -20,9 +20,6 @@ const reader = createEngineCapReader({
|
|
|
20
20
|
name: 'workflowsJournal',
|
|
21
21
|
project: projectWorkflowsJournalCapability,
|
|
22
22
|
});
|
|
23
|
-
export function noteEngineCapsForWorkflowsJournal(baseUrl, caps, opts) {
|
|
24
|
-
reader.note(baseUrl, caps, opts);
|
|
25
|
-
}
|
|
26
23
|
export function observedWorkflowsJournal(baseUrl = engineWireTarget()?.baseUrl) {
|
|
27
24
|
return reader.observed(baseUrl);
|
|
28
25
|
}
|
|
@@ -47,6 +44,3 @@ export function workflowsJournalDoctorDetail(reading) {
|
|
|
47
44
|
return 'workflow journal on — a workflow’s execution journal can be read';
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
|
-
export function __resetWorkflowsJournalReadingsForTests() {
|
|
51
|
-
reader.__resetForTests();
|
|
52
|
-
}
|
|
@@ -24,10 +24,6 @@ export interface WriteProtectionPostureView {
|
|
|
24
24
|
droppedDefaultRows?: readonly string[];
|
|
25
25
|
}
|
|
26
26
|
export declare function projectWriteProtectionPosture(wiring: unknown): WriteProtectionPostureView | undefined;
|
|
27
|
-
export declare function noteEngineCapsForWriteProtection(baseUrl: string, caps: unknown, opts?: {
|
|
28
|
-
generation?: number;
|
|
29
|
-
}): void;
|
|
30
27
|
export declare function observedWriteProtection(baseUrl?: string | undefined): WriteProtectionReading;
|
|
31
28
|
export declare function writeProtectionDoctorDetail(reading: WriteProtectionReading): string;
|
|
32
29
|
export declare function writeProtectionPostureDetail(posture: WriteProtectionPostureView): string;
|
|
33
|
-
export declare function __resetWriteProtectionReadingsForTests(): void;
|
|
@@ -66,9 +66,6 @@ const reader = createEngineCapReader({
|
|
|
66
66
|
name: 'writeProtection',
|
|
67
67
|
project: projectWriteProtectionCapability,
|
|
68
68
|
});
|
|
69
|
-
export function noteEngineCapsForWriteProtection(baseUrl, caps, opts) {
|
|
70
|
-
reader.note(baseUrl, caps, opts);
|
|
71
|
-
}
|
|
72
69
|
export function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
|
|
73
70
|
return reader.observed(baseUrl);
|
|
74
71
|
}
|
|
@@ -113,6 +110,3 @@ export function writeProtectionPostureDetail(posture) {
|
|
|
113
110
|
: '';
|
|
114
111
|
return `source ${source} · ${String(posture.rows.length)} ${posture.rows.length === 1 ? 'name' : 'names'}: ${shown}${more}${dropped}`;
|
|
115
112
|
}
|
|
116
|
-
export function __resetWriteProtectionReadingsForTests() {
|
|
117
|
-
reader.__resetForTests();
|
|
118
|
-
}
|