@sema-agent/client-core 0.110.0 → 0.112.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 +244 -0
- package/README.md +59 -18
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +25 -4
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/checkpointRowVerdict.d.ts +3 -0
- package/dist/checkpointRowVerdict.js +14 -1
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/consoleCaPin.d.ts +136 -0
- package/dist/consoleCaPin.js +827 -0
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/deviceRebind.js +3 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +6 -0
- package/dist/effectiveFacts.d.ts +9 -0
- package/dist/effectiveFacts.js +33 -0
- package/dist/engineAddress.d.ts +1 -0
- package/dist/engineAddress.js +4 -1
- package/dist/engineCredentialRelease.d.ts +54 -0
- package/dist/engineCredentialRelease.js +146 -0
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +1 -0
- package/dist/engineHealthProbeVerdict.d.ts +24 -0
- package/dist/engineHealthProbeVerdict.js +123 -0
- package/dist/engineNoticeCodes.js +5 -7
- package/dist/engineRepoint.d.ts +12 -5
- package/dist/engineRepoint.js +44 -19
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +11 -1
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +45 -0
- package/dist/engineUnavailable.js +496 -0
- package/dist/engineUrl.js +4 -2
- package/dist/eventLeg.js +3 -3
- package/dist/gateFailureCodes.js +2 -2
- package/dist/generated/sdkFactTables.d.ts +2 -1
- package/dist/generated/sdkFactTables.js +14 -0
- package/dist/generated/settingsSchemaFns.d.ts +1 -0
- package/dist/generated/settingsSchemaFns.js +3 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
- package/dist/generated/settingsSchemaTables.d.ts +56 -0
- package/dist/generated/settingsSchemaTables.js +19 -0
- package/dist/generated/settingsSchemaTypes.d.ts +23 -13
- package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlShape.js +17 -0
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalResolution.d.ts +1 -1
- package/dist/hitl/approvalResolution.js +2 -1
- package/dist/hitl/askGateWire.js +5 -6
- package/dist/hitl/decisionRefusal.d.ts +6 -0
- package/dist/hitl/decisionRefusal.js +19 -10
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +7 -0
- package/dist/hitl/decisionSend.js +34 -12
- package/dist/hitl/editedApprovalAcceptance.js +1 -1
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +8 -15
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/hitlBridge.d.ts +6 -0
- package/dist/hitl/hitlBridge.js +10 -4
- package/dist/hitl/hitlHostSurface.d.ts +2 -1
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/localAllowRedemption.d.ts +70 -0
- package/dist/hitl/localAllowRedemption.js +276 -0
- package/dist/hitl/parkOwnership.js +2 -1
- package/dist/hitl/parkResolver.js +14 -4
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +70 -0
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +23 -6
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +363 -0
- package/dist/hitl/sessionPolicyWire.js +2 -2
- package/dist/hitl/standingRows.d.ts +6 -2
- package/dist/hitl/standingRows.js +27 -2
- package/dist/hitl/toolApprovalWire.d.ts +30 -8
- package/dist/hitl/toolApprovalWire.js +264 -121
- package/dist/hooksReaderGenerations.js +1 -1
- package/dist/hooksWireCaps.js +3 -3
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +3 -0
- package/dist/hostTurnSettings.js +38 -5
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +292 -0
- package/dist/i18n/messages.en.js +298 -7
- package/dist/i18n/messages.zh.js +316 -6
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +71 -20
- package/dist/index.js +44 -13
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/liveModelCatalog.d.ts +4 -0
- package/dist/liveModelCatalog.js +12 -3
- package/dist/localConfig/documents.d.ts +61 -0
- package/dist/localConfig/documents.js +51 -0
- package/dist/localConfig/kernel.d.ts +149 -0
- package/dist/localConfig/kernel.js +597 -0
- package/dist/localConfig/mcp/edit.d.ts +161 -0
- package/dist/localConfig/mcp/edit.js +846 -0
- package/dist/localConfig/mcp/servers.d.ts +165 -0
- package/dist/localConfig/mcp/servers.js +776 -0
- package/dist/localConfig/mcp/views.d.ts +170 -0
- package/dist/localConfig/mcp/views.js +429 -0
- package/dist/localConfig/modelPool.d.ts +262 -0
- package/dist/localConfig/modelPool.js +1489 -0
- package/dist/localConfig/modelPoolWords.d.ts +13 -0
- package/dist/localConfig/modelPoolWords.js +20 -0
- package/dist/localConfig/receiptShape.d.ts +7 -0
- package/dist/localConfig/receiptShape.js +135 -0
- package/dist/localConfig/settingsWrite.d.ts +127 -0
- package/dist/localConfig/settingsWrite.js +237 -0
- package/dist/localConfig/skills.d.ts +124 -0
- package/dist/localConfig/skills.js +397 -0
- package/dist/localConfig/skillsWords.d.ts +10 -0
- package/dist/localConfig/skillsWords.js +5 -0
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpProbeWire.js +2 -1
- package/dist/mcpReconnect.js +3 -3
- package/dist/mcpWireCaps.js +1 -1
- package/dist/memoryVerbsWire.js +3 -2
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/onboardJudgement.d.ts +14 -4
- package/dist/model/onboardJudgement.js +91 -139
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +3 -40
- package/dist/modelConfigGapNotice.d.ts +20 -0
- package/dist/modelConfigGapNotice.js +102 -0
- package/dist/modsKernelIdentity.js +2 -47
- package/dist/notifications.d.ts +19 -0
- package/dist/notifications.js +114 -12
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +71 -8
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +3 -1
- package/dist/permissionsDeclaration.js +33 -9
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +9 -1
- package/dist/pluginHooksWire.js +40 -6
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +12 -7
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/request/taskRequest.js +10 -6
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +12 -4
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runLedgerSnapshot.js +3 -3
- package/dist/runPermissionModeSwitch.js +3 -4
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +16 -2
- package/dist/seam.js +10 -0
- package/dist/seatContract.d.ts +259 -9
- package/dist/seatContract.js +444 -15
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +4 -1
- package/dist/sessionMemoryErase.js +2 -1
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.js +8 -9
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sha256Bytes.d.ts +1 -0
- package/dist/sha256Bytes.js +46 -0
- package/dist/skillOverrideChain.d.ts +83 -0
- package/dist/skillOverrideChain.js +378 -0
- package/dist/skillsWireCaps.d.ts +3 -0
- package/dist/skillsWireCaps.js +16 -1
- package/dist/sseIdleTriage.js +2 -1
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +2 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/turnFailurePresentation.js +4 -10
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +141 -19
- package/dist/wireRefusalCopy.d.ts +6 -5
- package/dist/wireRefusalCopy.js +49 -92
- package/docs/INTEGRATION-CLIENTS.md +2718 -17
- package/package.json +7 -3
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
export const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE = (HOOK_EVENTS) => {
|
|
2
2
|
const HOOK_GUARD_EVENTS = ["PreToolUse", "PermissionRequest"];
|
|
3
3
|
const HOOK_SHELLS = ["bash", "powershell"];
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
command: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const HOOK_ON_FAILURE_ACCEPTED = { continue: true, block: true };
|
|
5
|
+
const HOOK_ENTRY_FIELDS_READ = {
|
|
6
|
+
command: {
|
|
7
|
+
command: "text",
|
|
8
|
+
args: "argv?",
|
|
9
|
+
shell: "shell?",
|
|
10
|
+
async: "boolean?",
|
|
11
|
+
asyncRewake: "boolean?",
|
|
12
|
+
onFailure: "onFailure?",
|
|
13
|
+
if: "string?",
|
|
14
|
+
timeout: "seconds?",
|
|
15
|
+
statusMessage: "string?",
|
|
16
|
+
once: "boolean?",
|
|
17
|
+
rewakeMessage: "nonEmpty?",
|
|
18
|
+
rewakeSummary: "nonEmpty?",
|
|
19
|
+
cloud: "any?",
|
|
20
|
+
},
|
|
21
|
+
prompt: { prompt: "text", model: "string?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?", continueOnBlock: "boolean?" },
|
|
22
|
+
agent: { prompt: "text", model: "string?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" },
|
|
23
|
+
http: { url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", onFailure: "onFailure?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?", cloud: "any?" },
|
|
24
|
+
mcp_tool: { server: "string", tool: "string", input: "record?", if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" },
|
|
11
25
|
};
|
|
12
26
|
function hookShapeOf(v) {
|
|
13
27
|
try {
|
|
@@ -146,6 +160,8 @@ export const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE = (HOOK_EVENTS) => {
|
|
|
146
160
|
switch (base) {
|
|
147
161
|
case "text":
|
|
148
162
|
return typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
163
|
+
case "nonEmpty":
|
|
164
|
+
return typeof value === "string" && value.length > 0;
|
|
149
165
|
case "string":
|
|
150
166
|
return typeof value === "string";
|
|
151
167
|
case "shell":
|
|
@@ -163,6 +179,19 @@ export const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE = (HOOK_EVENTS) => {
|
|
|
163
179
|
if (typeof value[i] !== "string")
|
|
164
180
|
return false;
|
|
165
181
|
return true;
|
|
182
|
+
case "argv":
|
|
183
|
+
if (!hookIsArray(value))
|
|
184
|
+
return false;
|
|
185
|
+
for (let i = 0; i < value.length; i++) {
|
|
186
|
+
const arg = value[i];
|
|
187
|
+
if (typeof arg !== "string" || arg.includes("\0"))
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
case "onFailure":
|
|
192
|
+
return typeof value === "string" && Object.hasOwn(HOOK_ON_FAILURE_ACCEPTED, value);
|
|
193
|
+
case "any":
|
|
194
|
+
return true;
|
|
166
195
|
case "record":
|
|
167
196
|
return hookIsRecord(value);
|
|
168
197
|
default: {
|
|
@@ -175,9 +204,9 @@ export const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE = (HOOK_EVENTS) => {
|
|
|
175
204
|
if (!hookIsRecord(entry))
|
|
176
205
|
return {};
|
|
177
206
|
const type = Object.hasOwn(entry, "type") ? entry.type : undefined;
|
|
178
|
-
if (typeof type !== "string" || !Object.hasOwn(
|
|
207
|
+
if (typeof type !== "string" || !Object.hasOwn(HOOK_ENTRY_FIELDS_READ, type))
|
|
179
208
|
return { field: "type" };
|
|
180
|
-
const fields =
|
|
209
|
+
const fields = HOOK_ENTRY_FIELDS_READ[type];
|
|
181
210
|
const out = { type };
|
|
182
211
|
for (const field of Object.keys(fields)) {
|
|
183
212
|
const kind = fields[field];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const SETTINGS_ENGINE_OWNED_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "PreCompact", "PostCompact", "Stop", "StopFailure", "UserPromptSubmit"];
|
|
2
2
|
export declare const SETTINGS_SECRET_LITERAL_RE: RegExp;
|
|
3
3
|
export declare const SETTINGS_PRIVATE_KEY_PEM_HEADER: RegExp;
|
|
4
|
+
export declare const SETTINGS_SHA256_DIGEST_RE: RegExp;
|
|
4
5
|
export declare const SETTINGS_DEVICE_CODE_TTL_SECONDS = 900;
|
|
5
6
|
export declare const SETTINGS_DEVICE_POLL_INTERVAL_SECONDS = 5;
|
|
6
7
|
export declare const SETTINGS_TIER_GROUP_NAME_RE: RegExp;
|
|
@@ -14,4 +15,59 @@ export declare const SETTINGS_MCP_CONTENT_ORIGINS: readonly ["local", "execution
|
|
|
14
15
|
export declare const SETTINGS_MIN_TRUST_WORDS: readonly ["local", "session", "project", "global", "managed", "task"];
|
|
15
16
|
export declare const SETTINGS_WORKSPACE_TRUST_STATES: readonly ["accepted", "declined", "no_trust_step"];
|
|
16
17
|
export declare const SETTINGS_MODEL_PLANE_REFUSAL_CODES: readonly ["config.default_model_missing", "config.model_refused_name_minted", "config.model_route_endpoint_missing", "config.gateway_fallback_without_primary", "config.catalog_replaces_env_models"];
|
|
18
|
+
export declare const SETTINGS_WEB_ADMIN_TOKEN_ENV: Readonly<{
|
|
19
|
+
readonly token: "SEMA_WEB_ADMIN_TOKEN";
|
|
20
|
+
readonly tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE";
|
|
21
|
+
}>;
|
|
17
22
|
export declare const SETTINGS_NO_EXECUTION_TARGET_LANES: readonly ["none"];
|
|
23
|
+
export declare const SETTINGS_ROOT_DOCUMENT_UNREADABLE_REASONS: readonly ["bad_json", "bad_shape", "io"];
|
|
24
|
+
export declare const SETTINGS_UNIT_PLACES: Readonly<{
|
|
25
|
+
permissions: Readonly<{
|
|
26
|
+
path: readonly ["permissions"];
|
|
27
|
+
category: "permissions";
|
|
28
|
+
}>;
|
|
29
|
+
permissionMode: Readonly<{
|
|
30
|
+
path: readonly ["permissions", "defaultMode"];
|
|
31
|
+
category: "permissionMode";
|
|
32
|
+
reading: "permissionMode";
|
|
33
|
+
}>;
|
|
34
|
+
additionalDirectories: Readonly<{
|
|
35
|
+
path: readonly ["permissions", "additionalDirectories"];
|
|
36
|
+
category: "sandboxNetwork";
|
|
37
|
+
reading: "stringList";
|
|
38
|
+
}>;
|
|
39
|
+
sandbox: Readonly<{
|
|
40
|
+
path: readonly ["sandbox"];
|
|
41
|
+
category: "sandboxNetwork";
|
|
42
|
+
}>;
|
|
43
|
+
disableBypassPermissionsMode: Readonly<{
|
|
44
|
+
path: readonly ["permissions", "disableBypassPermissionsMode"];
|
|
45
|
+
category: "killSwitches";
|
|
46
|
+
reading: "killSwitch";
|
|
47
|
+
}>;
|
|
48
|
+
disableAutoMode: Readonly<{
|
|
49
|
+
path: readonly ["permissions", "disableAutoMode"];
|
|
50
|
+
category: "killSwitches";
|
|
51
|
+
reading: "killSwitch";
|
|
52
|
+
}>;
|
|
53
|
+
hooks: Readonly<{
|
|
54
|
+
path: readonly ["hooks"];
|
|
55
|
+
category: "hooks";
|
|
56
|
+
reading: "hooks";
|
|
57
|
+
}>;
|
|
58
|
+
env: Readonly<{
|
|
59
|
+
path: readonly ["env"];
|
|
60
|
+
category: "env";
|
|
61
|
+
reading: "envMap";
|
|
62
|
+
}>;
|
|
63
|
+
model: Readonly<{
|
|
64
|
+
path: readonly ["model"];
|
|
65
|
+
category: "model";
|
|
66
|
+
reading: "nonEmptyString";
|
|
67
|
+
}>;
|
|
68
|
+
outputStyle: Readonly<{
|
|
69
|
+
path: readonly ["outputStyle"];
|
|
70
|
+
category: "ui";
|
|
71
|
+
reading: "nonEmptyString";
|
|
72
|
+
}>;
|
|
73
|
+
}>;
|
|
@@ -11,6 +11,7 @@ export const SETTINGS_ENGINE_OWNED_HOOK_EVENTS = Object.freeze([
|
|
|
11
11
|
]);
|
|
12
12
|
export const SETTINGS_SECRET_LITERAL_RE = Object.freeze(/^(sk-|gh[opus]_|github_pat_|xox[baprse]-|xapp-|bearer\s|basic\s|eyJ[A-Za-z0-9_-]{10,}\.|AKIA[0-9A-Z]{12,}|AIza[0-9A-Za-z_-]{20,}|-----BEGIN[A-Z0-9 ]*PRIVATE KEY)/i);
|
|
13
13
|
export const SETTINGS_PRIVATE_KEY_PEM_HEADER = Object.freeze(/-----BEGIN[A-Z0-9 ]*PRIVATE KEY/i);
|
|
14
|
+
export const SETTINGS_SHA256_DIGEST_RE = Object.freeze(/^sha256:[0-9a-f]{64}$/);
|
|
14
15
|
export const SETTINGS_DEVICE_CODE_TTL_SECONDS = 900;
|
|
15
16
|
export const SETTINGS_DEVICE_POLL_INTERVAL_SECONDS = 5;
|
|
16
17
|
export const SETTINGS_TIER_GROUP_NAME_RE = Object.freeze(/^[a-z0-9][a-z0-9._-]*$/i);
|
|
@@ -70,6 +71,24 @@ export const SETTINGS_MODEL_PLANE_REFUSAL_CODES = Object.freeze([
|
|
|
70
71
|
"config.gateway_fallback_without_primary",
|
|
71
72
|
"config.catalog_replaces_env_models",
|
|
72
73
|
]);
|
|
74
|
+
export const SETTINGS_WEB_ADMIN_TOKEN_ENV = Object.freeze({ token: "SEMA_WEB_ADMIN_TOKEN", tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE" });
|
|
73
75
|
export const SETTINGS_NO_EXECUTION_TARGET_LANES = Object.freeze([
|
|
74
76
|
"none",
|
|
75
77
|
]);
|
|
78
|
+
export const SETTINGS_ROOT_DOCUMENT_UNREADABLE_REASONS = Object.freeze([
|
|
79
|
+
"bad_json",
|
|
80
|
+
"bad_shape",
|
|
81
|
+
"io",
|
|
82
|
+
]);
|
|
83
|
+
export const SETTINGS_UNIT_PLACES = Object.freeze({
|
|
84
|
+
"permissions": Object.freeze({ path: Object.freeze(["permissions"]), category: "permissions" }),
|
|
85
|
+
"permissionMode": Object.freeze({ path: Object.freeze(["permissions", "defaultMode"]), category: "permissionMode", reading: "permissionMode" }),
|
|
86
|
+
"additionalDirectories": Object.freeze({ path: Object.freeze(["permissions", "additionalDirectories"]), category: "sandboxNetwork", reading: "stringList" }),
|
|
87
|
+
"sandbox": Object.freeze({ path: Object.freeze(["sandbox"]), category: "sandboxNetwork" }),
|
|
88
|
+
"disableBypassPermissionsMode": Object.freeze({ path: Object.freeze(["permissions", "disableBypassPermissionsMode"]), category: "killSwitches", reading: "killSwitch" }),
|
|
89
|
+
"disableAutoMode": Object.freeze({ path: Object.freeze(["permissions", "disableAutoMode"]), category: "killSwitches", reading: "killSwitch" }),
|
|
90
|
+
"hooks": Object.freeze({ path: Object.freeze(["hooks"]), category: "hooks", reading: "hooks" }),
|
|
91
|
+
"env": Object.freeze({ path: Object.freeze(["env"]), category: "env", reading: "envMap" }),
|
|
92
|
+
"model": Object.freeze({ path: Object.freeze(["model"]), category: "model", reading: "nonEmptyString" }),
|
|
93
|
+
"outputStyle": Object.freeze({ path: Object.freeze(["outputStyle"]), category: "ui", reading: "nonEmptyString" }),
|
|
94
|
+
});
|
|
@@ -3,35 +3,44 @@ declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFa
|
|
|
3
3
|
type HookEventWord = (typeof HOOK_EVENTS)[number];
|
|
4
4
|
declare const HOOK_ENTRY_TYPES: readonly ["command", "prompt", "agent", "http", "mcp_tool"];
|
|
5
5
|
export type HookEntryType = (typeof HOOK_ENTRY_TYPES)[number];
|
|
6
|
+
declare const HOOK_ON_FAILURE_WORDS: readonly ["continue", "block"];
|
|
7
|
+
export type HookOnFailure = (typeof HOOK_ON_FAILURE_WORDS)[number];
|
|
6
8
|
declare const HOOK_SHELLS: readonly ["bash", "powershell"];
|
|
7
|
-
declare const HOOK_ENTRY_FIELDS: {
|
|
8
|
-
|
|
9
|
+
declare const HOOK_ENTRY_FIELDS: Readonly<{
|
|
10
|
+
command: Readonly<{
|
|
11
|
+
readonly rewakeMessage: "nonEmpty?";
|
|
12
|
+
readonly rewakeSummary: "nonEmpty?";
|
|
13
|
+
readonly cloud: "any?";
|
|
9
14
|
readonly if: "string?";
|
|
10
15
|
readonly timeout: "seconds?";
|
|
11
16
|
readonly statusMessage: "string?";
|
|
12
17
|
readonly once: "boolean?";
|
|
13
18
|
readonly command: "text";
|
|
19
|
+
readonly args: "argv?";
|
|
14
20
|
readonly shell: "shell?";
|
|
15
21
|
readonly async: "boolean?";
|
|
16
22
|
readonly asyncRewake: "boolean?";
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
readonly onFailure: "onFailure?";
|
|
24
|
+
}>;
|
|
25
|
+
prompt: Readonly<{
|
|
26
|
+
readonly continueOnBlock: "boolean?";
|
|
19
27
|
readonly if: "string?";
|
|
20
28
|
readonly timeout: "seconds?";
|
|
21
29
|
readonly statusMessage: "string?";
|
|
22
30
|
readonly once: "boolean?";
|
|
23
31
|
readonly prompt: "text";
|
|
24
32
|
readonly model: "string?";
|
|
25
|
-
}
|
|
26
|
-
|
|
33
|
+
}>;
|
|
34
|
+
agent: Readonly<{
|
|
27
35
|
readonly if: "string?";
|
|
28
36
|
readonly timeout: "seconds?";
|
|
29
37
|
readonly statusMessage: "string?";
|
|
30
38
|
readonly once: "boolean?";
|
|
31
39
|
readonly prompt: "text";
|
|
32
40
|
readonly model: "string?";
|
|
33
|
-
}
|
|
34
|
-
|
|
41
|
+
}>;
|
|
42
|
+
http: Readonly<{
|
|
43
|
+
readonly cloud: "any?";
|
|
35
44
|
readonly if: "string?";
|
|
36
45
|
readonly timeout: "seconds?";
|
|
37
46
|
readonly statusMessage: "string?";
|
|
@@ -39,8 +48,9 @@ declare const HOOK_ENTRY_FIELDS: {
|
|
|
39
48
|
readonly url: "text";
|
|
40
49
|
readonly headers: "stringRecord?";
|
|
41
50
|
readonly allowedEnvVars: "stringList?";
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
readonly onFailure: "onFailure?";
|
|
52
|
+
}>;
|
|
53
|
+
mcp_tool: Readonly<{
|
|
44
54
|
readonly if: "string?";
|
|
45
55
|
readonly timeout: "seconds?";
|
|
46
56
|
readonly statusMessage: "string?";
|
|
@@ -48,9 +58,9 @@ declare const HOOK_ENTRY_FIELDS: {
|
|
|
48
58
|
readonly server: "string";
|
|
49
59
|
readonly tool: "string";
|
|
50
60
|
readonly input: "record?";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
type HookFieldBaseValue<B> = B extends "text" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" ? string[] : B extends "record" ? Record<string, unknown> : never;
|
|
61
|
+
}>;
|
|
62
|
+
}>;
|
|
63
|
+
type HookFieldBaseValue<B> = B extends "text" | "nonEmpty" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "onFailure" ? HookOnFailure : B extends "any" ? unknown : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" | "argv" ? string[] : B extends "record" ? Record<string, unknown> : never;
|
|
54
64
|
type HookFieldValue<K> = K extends `${infer B}?` ? HookFieldBaseValue<B> : HookFieldBaseValue<K>;
|
|
55
65
|
type Flat<O> = {
|
|
56
66
|
[K in keyof O]: O[K];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SETTINGS_URL_SHAPE_CLOSURE: (isHierarchicalUrl: (raw: string) => boolean) => any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const SETTINGS_URL_SHAPE_CLOSURE = (isHierarchicalUrl) => {
|
|
2
|
+
const HTTP_URL_PARTS = ["userinfo", "query", "fragment"];
|
|
3
|
+
function httpUrlFlaws(raw, forbid) {
|
|
4
|
+
if (!isHierarchicalUrl(raw))
|
|
5
|
+
return ["not-http-url"];
|
|
6
|
+
const u = new URL(raw);
|
|
7
|
+
const hashAt = u.href.indexOf("#");
|
|
8
|
+
const present = {
|
|
9
|
+
userinfo: u.username !== "" || u.password !== "",
|
|
10
|
+
query: (hashAt < 0 ? u.href : u.href.slice(0, hashAt)).includes("?"),
|
|
11
|
+
fragment: hashAt >= 0,
|
|
12
|
+
};
|
|
13
|
+
const shape = u.protocol === "http:" || u.protocol === "https:" ? [] : ["not-http-url"];
|
|
14
|
+
return [...shape, ...HTTP_URL_PARTS.filter((p) => forbid.includes(p) && present[p])];
|
|
15
|
+
}
|
|
16
|
+
return { httpUrlFlaws };
|
|
17
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AnswerCapture, type TopCauseReading, type TopLocalCodeReading, type UnansweredCapture } from '../engineWireFor.js';
|
|
2
2
|
import { type AttributionLadderState, type AttributionLadderStep } from './attributionLadder.js';
|
|
3
3
|
import { type RefusalCarrier, type SafetyStopHead } from './hitlBridge.js';
|
|
4
|
+
export declare const RETRY_BUDGET_MS = 8000;
|
|
4
5
|
export declare const PARKING_WAIT_CAP_MS = 5000;
|
|
5
6
|
export interface DeliveryTiming {
|
|
6
7
|
readonly delays?: readonly number[];
|
|
@@ -5,7 +5,7 @@ import { isSlotCarrier, readThrownSlot, THROWN_SLOT_UNREADABLE } from '../wireFa
|
|
|
5
5
|
import { deliverWithAttributionLadder, localCodeReadOf, topCauseReadOf } from './attributionLadder.js';
|
|
6
6
|
import { GATE_FAILURE_CODES, refusalCarrierOf, safetyStopHeadOf } from './hitlBridge.js';
|
|
7
7
|
const RETRY_DELAYS_MS = Object.freeze([500, 1_000, 2_000]);
|
|
8
|
-
const RETRY_BUDGET_MS = 8_000;
|
|
8
|
+
export const RETRY_BUDGET_MS = 8_000;
|
|
9
9
|
export const PARKING_WAIT_CAP_MS = 5_000;
|
|
10
10
|
let timingOverride;
|
|
11
11
|
export function setDeliveryTimingForTests(t) {
|
|
@@ -60,7 +60,7 @@ export declare function isApprovalDecided(r: ApprovalResolution): r is ApprovalR
|
|
|
60
60
|
export declare function approvalNotSentCause(r: ApprovalResolution): ApprovalNotSentCause | undefined;
|
|
61
61
|
export declare function approvalUnsettledCause(r: ApprovalResolution): ApprovalUnsettledCause | undefined;
|
|
62
62
|
export declare const APPROVAL_NOTE_RETRACTED_DETAIL = "the card was retracted (this host no longer has a decision port for it)";
|
|
63
|
-
export declare const APPROVAL_NOTE_EDIT_REFUSED_DETAIL
|
|
63
|
+
export declare const APPROVAL_NOTE_EDIT_REFUSED_DETAIL: string;
|
|
64
64
|
export declare function approvalResolutionDetail(r: ApprovalResolution): string | undefined;
|
|
65
65
|
export declare function approvalResolutionStatusTag(r: ApprovalResolution): string;
|
|
66
66
|
export declare function unsettledCauseOfReading(reading: DecisionRefusalReading): 'engine_refused' | 'engine_error' | 'no_answer';
|
|
@@ -5,6 +5,7 @@ import { carrierReadOf, isLocalSafetyStop, localCodeReadOf, topCauseReadOf } fro
|
|
|
5
5
|
import { directFailureReadingOf, transportReadingOf } from './approvalDelivery.js';
|
|
6
6
|
import { ownReadingSlot } from '../engineWireFor.js';
|
|
7
7
|
import { CHECKPOINT_ROW_BAR_SENTENCE, unboundWayOutContent } from '../checkpointRowVerdict.js';
|
|
8
|
+
import { msg, renderMessage } from '../i18n/translate.js';
|
|
8
9
|
export const APPROVAL_RESOLUTION_LANES = Object.freeze(['respond', 'decide', 'ask']);
|
|
9
10
|
export const APPROVAL_NOT_SENT_CAUSES = Object.freeze([
|
|
10
11
|
'retracted',
|
|
@@ -45,7 +46,7 @@ export function approvalUnsettledCause(r) {
|
|
|
45
46
|
return r.cause;
|
|
46
47
|
}
|
|
47
48
|
export const APPROVAL_NOTE_RETRACTED_DETAIL = 'the card was retracted (this host no longer has a decision port for it)';
|
|
48
|
-
export const APPROVAL_NOTE_EDIT_REFUSED_DETAIL = '
|
|
49
|
+
export const APPROVAL_NOTE_EDIT_REFUSED_DETAIL = renderMessage(msg('approval.editRefusal.stem'));
|
|
49
50
|
const NOT_SENT_SENTENCES = Object.freeze({
|
|
50
51
|
retracted: APPROVAL_NOTE_RETRACTED_DETAIL,
|
|
51
52
|
edit_refused: APPROVAL_NOTE_EDIT_REFUSED_DETAIL,
|
package/dist/hitl/askGateWire.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createGateLedger } from './gateLedger.js';
|
|
2
|
-
import {
|
|
2
|
+
import { flushHeldWithInterruptRewrite, isHostProgressFrame, routeFrame, } from './frameRouter.js';
|
|
3
3
|
import { resolvePark, nextHopBudget, stalledTerminal, MAX_GATE_HOPS } from './parkResolver.js';
|
|
4
4
|
import { createStreamDrainingLegs } from '../streamDrainingLegs.js';
|
|
5
5
|
import { abortableSleep } from '../abortableSleep.js';
|
|
6
6
|
import { hostLog } from '../host.js';
|
|
7
|
+
import { sourceGenerationNow } from './screenCardCarriers.js';
|
|
7
8
|
import { invokeHostCallbackIsolated } from '../hostCallbackGuard.js';
|
|
8
9
|
import { decideAcceptedNotResolved, readDecideReceipt } from '../decideReceipt.js';
|
|
9
10
|
import { APPROVAL_EXPIRED } from '../engineErrorCodes.js';
|
|
@@ -28,6 +29,7 @@ export async function* bridgeAskUserQuestionGates(source, deps, opts) {
|
|
|
28
29
|
deps,
|
|
29
30
|
taskId,
|
|
30
31
|
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
32
|
+
streamGeneration: sourceGenerationNow(deps),
|
|
31
33
|
};
|
|
32
34
|
let stream = source;
|
|
33
35
|
let budget;
|
|
@@ -81,16 +83,12 @@ export async function* bridgeAskUserQuestionGates(source, deps, opts) {
|
|
|
81
83
|
const drained = drains.legEnded('returned');
|
|
82
84
|
if (drained !== undefined) {
|
|
83
85
|
const reopenAfterMs = 'reconnectAfterMs' in drained ? drained.reconnectAfterMs : undefined;
|
|
84
|
-
if (taskId.current === undefined) {
|
|
85
|
-
const bound = bridgeRunHandleFallbackOf(deps);
|
|
86
|
-
if (bound !== undefined && reopenAfterMs !== undefined)
|
|
87
|
-
taskId.current = bound;
|
|
88
|
-
}
|
|
89
86
|
if (reopenAfterMs !== undefined && taskId.current !== undefined && !opts?.signal?.aborted) {
|
|
90
87
|
hostLog('debug', `liveHitlAskWire: runs.events(${taskId.current}) ended on the drain end frame — the engine is going down; reopening in ${reopenAfterMs}ms`);
|
|
91
88
|
await abortableSleep(reopenAfterMs, opts?.signal ?? new AbortController().signal);
|
|
92
89
|
if (!opts?.signal?.aborted) {
|
|
93
90
|
const seq = led.lastSeq();
|
|
91
|
+
ctx.streamGeneration = sourceGenerationNow(deps);
|
|
94
92
|
stream = deps.runsEvents(taskId.current, {
|
|
95
93
|
...(seq !== undefined ? { lastEventId: seq } : {}),
|
|
96
94
|
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
@@ -169,6 +167,7 @@ export async function* bridgeAskUserQuestionGates(source, deps, opts) {
|
|
|
169
167
|
led.forgetRunScopedState();
|
|
170
168
|
}
|
|
171
169
|
const seq = handoff !== undefined ? undefined : led.lastSeq();
|
|
170
|
+
ctx.streamGeneration = sourceGenerationNow(deps);
|
|
172
171
|
stream = deps.runsEvents(taskId.current, {
|
|
173
172
|
...(seq !== undefined ? { lastEventId: seq } : {}),
|
|
174
173
|
...(opts?.signal ? { signal: opts.signal } : {}),
|
|
@@ -5,7 +5,9 @@ import { type ProtocolErrorName, type ProtocolErrorNameReading } from '../wireFa
|
|
|
5
5
|
import type { DenyAttributionRefusalDetail } from '../wireRefusalCopy.js';
|
|
6
6
|
import { type DeliveredReading } from './attributionLadder.js';
|
|
7
7
|
import { type AnswerCapture, type UnansweredCapture } from '../engineWireFor.js';
|
|
8
|
+
import { type DecisionRefusalWayOut } from '../checkpointRowVerdict.js';
|
|
8
9
|
export declare const ASK_DECIDED_CODE = "conflict.ask_decided";
|
|
10
|
+
export type { DecisionRefusalWayOut } from '../checkpointRowVerdict.js';
|
|
9
11
|
export type DecisionRefusalStanding = 'settled-elsewhere' | 'ambiguous' | 'refused-pending';
|
|
10
12
|
export type { DecisionRefusalConflict } from './decisionConflict.js';
|
|
11
13
|
export { refusalCarrierOf, type RefusalCarrier } from './hitlBridge.js';
|
|
@@ -19,6 +21,8 @@ export interface RefusalRouteContext {
|
|
|
19
21
|
readonly afterRetry?: true;
|
|
20
22
|
}
|
|
21
23
|
export declare function notPendingAfterRetry(status: number | undefined, retried: boolean): boolean;
|
|
24
|
+
type RefusalRoute = NonNullable<RefusalRouteContext['route']>;
|
|
25
|
+
export declare const REFUSAL_ROUTES: readonly RefusalRoute[];
|
|
22
26
|
export interface RefusalDelivery {
|
|
23
27
|
readonly delivery: 'refused' | 'ambiguous' | 'no_answer';
|
|
24
28
|
readonly status?: number;
|
|
@@ -55,6 +59,7 @@ export interface DecisionRefusalReading {
|
|
|
55
59
|
readonly conflict?: DecisionRefusalConflict;
|
|
56
60
|
readonly unrecoverable?: true;
|
|
57
61
|
readonly acceptableForm?: {} | null;
|
|
62
|
+
readonly wayOut?: DecisionRefusalWayOut;
|
|
58
63
|
}
|
|
59
64
|
export declare function mintDecisionRefusalReading(err: {} | null | undefined, context?: RefusalRouteContext, attributionCarried?: boolean, delivered?: DeliveredReading, carried?: RefusalCarrier): DecisionRefusalReading;
|
|
60
65
|
export declare function readDecisionRefusalReading(err: {} | null | undefined, context?: RefusalRouteContext): DecisionRefusalReading;
|
|
@@ -65,6 +70,7 @@ export interface DecisionRefusalClassified {
|
|
|
65
70
|
readonly transient?: true;
|
|
66
71
|
readonly conflict?: DecisionRefusalConflict;
|
|
67
72
|
readonly unrecoverable?: true;
|
|
73
|
+
readonly wayOut?: DecisionRefusalWayOut;
|
|
68
74
|
}
|
|
69
75
|
export declare function classifyDecisionRefusal(err: unknown, context?: RefusalRouteContext): DecisionRefusalClassified | undefined;
|
|
70
76
|
export declare function classifyDeliveredDecisionRefusal(err: {} | null | undefined, delivered: DeliveredReading): DecisionRefusalClassified | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ASK_GONE, ASK_GONE_PARKED, RESUME_CONSTRAINT_REJECTED, RESUME_PREFLIGHT_REJECTED, isDecideAlreadyResolvedCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, refusalRetriableReading, refusalSaysStillPending } from '../engineErrorCodes.js';
|
|
1
|
+
import { ASK_GONE, ASK_GONE_PARKED, CORRUPT_ROW_ERROR_CODE, RESUME_CONSTRAINT_REJECTED, RESUME_PREFLIGHT_REJECTED, isDecideAlreadyResolvedCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, refusalRetriableReading, refusalSaysStillPending } from '../engineErrorCodes.js';
|
|
2
2
|
import { isUiLanguage } from '../env/uiLanguage.js';
|
|
3
3
|
import { msg, renderMessage } from '../i18n/translate.js';
|
|
4
4
|
import { notPendingCauseReading, refusalCauseWordOf } from './approvalEndingCause.js';
|
|
@@ -7,9 +7,10 @@ import { isAlreadyResolvedGateReason, isCodeClassifiedGateFailure } from './park
|
|
|
7
7
|
import { decisionConflictOf } from './decisionConflict.js';
|
|
8
8
|
import { readLivePendingRows } from './livePendingAsk.js';
|
|
9
9
|
import { guardedRead, ownDataField, readOwnDataValue } from '../ownKey.js';
|
|
10
|
-
import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, isDisplayableWireCode, isSlotCarrier, ownFoldedCodeBitsOf, protocolErrorNameReading, readErrorPresent,
|
|
10
|
+
import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, isDisplayableWireCode, isSlotCarrier, ownFoldedCodeBitsOf, protocolErrorNameReading, readErrorPresent, readErrorString, readRefusalField, readThrownSlot } from '../wireFailureShape.js';
|
|
11
11
|
import { attributionRefusalOf, carrierReadOf } from './attributionLadder.js';
|
|
12
12
|
import { CODE_UNREADABLE, ownReadingSlot } from '../engineWireFor.js';
|
|
13
|
+
import { isDecisionRefusalWayOut } from '../checkpointRowVerdict.js';
|
|
13
14
|
export const ASK_DECIDED_CODE = 'conflict.ask_decided';
|
|
14
15
|
const TRANSIENT_STATUSES = new Set([408, 425, 429, 502, 503, 504]);
|
|
15
16
|
export { refusalCarrierOf } from './hitlBridge.js';
|
|
@@ -29,10 +30,10 @@ export function notPendingAfterRetry(status, retried) {
|
|
|
29
30
|
return retried && (status === 404 || status === 410);
|
|
30
31
|
}
|
|
31
32
|
const ROUTE_WORDS = { approval_decide: true, live_respond: true, ask_decide: true, plan_review: true, compact: true };
|
|
32
|
-
const REFUSAL_ROUTES = Object.freeze(Object.keys(ROUTE_WORDS));
|
|
33
|
+
export const REFUSAL_ROUTES = Object.freeze(Object.keys(ROUTE_WORDS));
|
|
33
34
|
const PRIOR_REFUSAL_EVIDENCE = Object.freeze([
|
|
34
35
|
Object.freeze({
|
|
35
|
-
errorCode:
|
|
36
|
+
errorCode: CORRUPT_ROW_ERROR_CODE,
|
|
36
37
|
routes: Object.freeze(['plan_review', 'approval_decide', 'live_respond']),
|
|
37
38
|
evidence: 'server resume-legs.ts:1019 / :2752 / :2910 (resume context read, before the claim CAS at :1666 / :1457); plan_review resumePlanReview reads context before settling',
|
|
38
39
|
}),
|
|
@@ -74,12 +75,11 @@ const codeUnreadable = () => {
|
|
|
74
75
|
throw new TypeError('status or errorCode was unreadable when this failure was first read');
|
|
75
76
|
};
|
|
76
77
|
function preflightSettledBitsPresent(carrier) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return nonEmpty(bit('settledBy')) || nonEmpty(bit('rowStatus'));
|
|
78
|
+
const nonEmpty = (k) => {
|
|
79
|
+
const v = guardedRead(() => readErrorString(carrier, k));
|
|
80
|
+
return typeof v === 'string' && v.length > 0;
|
|
81
|
+
};
|
|
82
|
+
return nonEmpty('settledBy') || nonEmpty('rowStatus');
|
|
83
83
|
}
|
|
84
84
|
const RESOLUTION_KINDS = Object.freeze(['decided', 'not_sent', 'unsettled']);
|
|
85
85
|
const ASK_READINGS = Object.freeze(['settled', 'not_settled', 'unreadable']);
|
|
@@ -224,10 +224,13 @@ export function mintDecisionRefusalReading(err, context, attributionCarried, del
|
|
|
224
224
|
const conflict = inRange && status === 409 && obj !== undefined ? isolated(() => decisionConflictOf(obj, captured, pn)) : undefined;
|
|
225
225
|
const unrecoverable = inRange && status !== undefined && Number.isInteger(status) && status >= 400 && status <= 599 && isDecideRowUnrevivableCode(errorCode);
|
|
226
226
|
const acceptableForm = errorCode === RESUME_CONSTRAINT_REJECTED && obj !== undefined ? isolated(() => readErrorPresent(obj, 'acceptableForm')) : undefined;
|
|
227
|
+
const wayOutRaw = inRange && status === 409 && obj !== undefined ? isolated(() => readErrorString(obj, 'wayOut')) : undefined;
|
|
228
|
+
const wayOut = isDecisionRefusalWayOut(wayOutRaw) ? wayOutRaw : undefined;
|
|
227
229
|
const transient = inRange &&
|
|
228
230
|
conflict !== 'grant_changed' &&
|
|
229
231
|
conflict !== 'row_integrity' &&
|
|
230
232
|
!unrecoverable &&
|
|
233
|
+
wayOut === undefined &&
|
|
231
234
|
(TRANSIENT_STATUSES.has(status) || retriable || (status === 404 && obj !== undefined && isolated(() => notPendingCauseReading(obj)) === 'other_replica'));
|
|
232
235
|
return Object.freeze({
|
|
233
236
|
...(status !== undefined ? { status } : {}),
|
|
@@ -247,6 +250,7 @@ export function mintDecisionRefusalReading(err, context, attributionCarried, del
|
|
|
247
250
|
...(conflict !== undefined ? { conflict } : {}),
|
|
248
251
|
...(unrecoverable ? { unrecoverable: true } : {}),
|
|
249
252
|
...(acceptableForm !== undefined ? { acceptableForm } : {}),
|
|
253
|
+
...(wayOut !== undefined ? { wayOut } : {}),
|
|
250
254
|
});
|
|
251
255
|
}
|
|
252
256
|
export function readDecisionRefusalReading(err, context) {
|
|
@@ -265,6 +269,7 @@ function classifiedOf(reading) {
|
|
|
265
269
|
const transient = ownDataField(reading, 'transient') === true;
|
|
266
270
|
const conflict = ownDataField(reading, 'conflict');
|
|
267
271
|
const unrecoverable = ownDataField(reading, 'unrecoverable') === true;
|
|
272
|
+
const wayOut = ownDataField(reading, 'wayOut');
|
|
268
273
|
return Object.freeze({
|
|
269
274
|
standing,
|
|
270
275
|
status,
|
|
@@ -272,6 +277,7 @@ function classifiedOf(reading) {
|
|
|
272
277
|
...(transient ? { transient: true } : {}),
|
|
273
278
|
...(typeof conflict === 'string' ? { conflict: conflict } : {}),
|
|
274
279
|
...(unrecoverable ? { unrecoverable: true } : {}),
|
|
280
|
+
...(isDecisionRefusalWayOut(wayOut) ? { wayOut } : {}),
|
|
275
281
|
});
|
|
276
282
|
}
|
|
277
283
|
catch {
|
|
@@ -313,6 +319,9 @@ export function decisionRefusalClosesOut(refusal, pending) {
|
|
|
313
319
|
const conflict = readThrownSlot(refusal, 'conflict', 'data');
|
|
314
320
|
if (conflict === 'grant_changed' || conflict === THROWN_SLOT_UNREADABLE)
|
|
315
321
|
return false;
|
|
322
|
+
const wayOut = readThrownSlot(refusal, 'wayOut', 'data');
|
|
323
|
+
if (wayOut === 'newer_worker' || wayOut === THROWN_SLOT_UNREADABLE)
|
|
324
|
+
return false;
|
|
316
325
|
return standing === 'ambiguous' || standing === 'refused-pending';
|
|
317
326
|
}
|
|
318
327
|
export function decisionStatusTag(status, errorCode) {
|