@sema-agent/client-core 0.99.0 → 0.101.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 +572 -0
- package/README.md +174 -114
- package/dist/adapt/arms.js +109 -50
- package/dist/adapt/panelTasks.d.ts +2 -1
- package/dist/adapt/panelTasks.js +32 -9
- package/dist/adapt/textStream.d.ts +1 -1
- package/dist/adapt/textStream.js +58 -32
- package/dist/adapt/toolCards.js +9 -8
- package/dist/adapt.js +7 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +31 -2
- package/dist/adapter/activeRunSelfHeal.js +162 -13
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +25 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +157 -20
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +219 -39
- package/dist/adapter/downstream/wiringManifestView.d.ts +3 -1
- package/dist/adapter/downstream/wiringManifestView.js +1 -0
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +184 -42
- package/dist/adapter/types.d.ts +2 -0
- package/dist/agentsWireCaps.d.ts +9 -7
- package/dist/agentsWireCaps.js +101 -17
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +28 -5
- package/dist/cloudConfigWireCaps.js +334 -103
- package/dist/compactionStatus.d.ts +34 -0
- package/dist/compactionStatus.js +196 -0
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +8 -6
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +215 -13
- package/dist/engineAgentPanelStore.d.ts +7 -4
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +23 -6
- package/dist/engineErrorCodes.js +36 -11
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +4 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.d.ts +3 -0
- package/dist/engineToolDirectory.js +6 -4
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/eventLeg.d.ts +1 -7
- package/dist/eventLeg.js +7 -8
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.d.ts +0 -3
- package/dist/fileHistoryCaptureCapability.js +3 -7
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +15 -2
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -2
- package/dist/generated/engineFactTables.js +79 -0
- package/dist/generated/engineNoticeTables.js +15 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +66 -0
- package/dist/generated/settingsSchemaFns.js +38 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.js +156 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +18 -0
- package/dist/generated/settingsSchemaTypes.d.ts +28 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +9 -7
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCardReasons.js +2 -2
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalHolds.d.ts +14 -0
- package/dist/hitl/approvalHolds.js +41 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +8 -2
- package/dist/hitl/askClassPair.js +31 -4
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +62 -0
- package/dist/hitl/attributionLadder.js +138 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionLedger.d.ts +55 -0
- package/dist/hitl/decisionLedger.js +156 -0
- package/dist/hitl/decisionRefusal.d.ts +21 -10
- package/dist/hitl/decisionRefusal.js +100 -55
- package/dist/hitl/decisionSend.d.ts +116 -0
- package/dist/hitl/decisionSend.js +563 -0
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +59 -43
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +104 -106
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +65 -35
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +103 -151
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +114 -19
- package/dist/hostTurnSettings.js +966 -68
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +4 -2
- package/dist/humanTurn.js +40 -10
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +313 -0
- package/dist/i18n/messages.en.js +326 -13
- package/dist/i18n/messages.zh.js +341 -13
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +85 -15
- package/dist/index.js +53 -12
- package/dist/inheritEnvCapability.d.ts +4 -1
- package/dist/inheritEnvCapability.js +38 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/injectionLaneNotice.d.ts +5 -0
- package/dist/injectionLaneNotice.js +46 -0
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +3 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpReconnect.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.d.ts +6 -0
- package/dist/mcpToolToggles.js +47 -0
- package/dist/mcpWireCaps.d.ts +48 -4
- package/dist/mcpWireCaps.js +338 -99
- package/dist/mcpWireTransport.d.ts +4 -0
- package/dist/mcpWireTransport.js +18 -0
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.d.ts +2 -1
- package/dist/modelCapabilityProbe.js +16 -15
- package/dist/modelIdentityResolvability.d.ts +12 -1
- package/dist/modelIdentityResolvability.js +69 -28
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +37 -0
- package/dist/ownKey.js +238 -2
- package/dist/panelReduce.d.ts +5 -0
- package/dist/panelReduce.js +45 -13
- package/dist/panelStateHolder.d.ts +1 -0
- package/dist/panelStateHolder.js +10 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.d.ts +2 -1
- package/dist/permissionRuleIssue.js +24 -21
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +101 -60
- package/dist/prepareRefusal.d.ts +9 -0
- package/dist/prepareRefusal.js +90 -0
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +5 -1
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +22 -14
- package/dist/request/taskRequest.js +312 -202
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +22 -4
- package/dist/retryStatus.d.ts +26 -0
- package/dist/retryStatus.js +133 -28
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +8 -0
- package/dist/ruleRefusalSentence.js +64 -0
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +3 -2
- package/dist/sandboxWire.js +59 -27
- package/dist/scenarioRefusal.d.ts +2 -1
- package/dist/scenarioRefusal.js +6 -6
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +26 -9
- package/dist/seam.js +44 -4
- package/dist/seatContract.d.ts +62 -9
- package/dist/seatContract.js +70 -25
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.d.ts +8 -0
- package/dist/settingsCredentialKeyPaths.js +274 -0
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -3
- package/dist/skillsWireCaps.js +48 -18
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/subagentContentStore.d.ts +1 -0
- package/dist/subagentContentStore.js +135 -27
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +158 -9
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/toolsFlagNames.d.ts +8 -0
- package/dist/toolsFlagNames.js +110 -0
- package/dist/turnFailurePresentation.js +41 -96
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +75 -18
- package/dist/wireRefusalCopy.js +532 -148
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +1013 -190
- package/package.json +15 -4
package/dist/wireErrorTriage.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { PROTOCOL_ERROR_NAME,
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorString, readErrorStringList, readThrownSlot, readThrownStatusSlot, thrownIsInstanceOf, THROWN_SLOT_UNREADABLE, WIRE_FAILURE_UNRENDERABLE_TEXT, } from './wireFailureShape.js';
|
|
2
2
|
import { capForDisplay, escapeDisplayControlChars } from './fleetTaskDesc.js';
|
|
3
3
|
import { readOwnDataValue } from './ownKey.js';
|
|
4
4
|
import { fleetLeaseUnavailableFromError } from './wireRefusalCopy.js';
|
|
5
|
-
import {
|
|
5
|
+
import { answerReadingOf, captureAnswer, captureUnanswered, causeSlotReadOf, effectiveCodeOf, noteTriageReading, ownReadingSlot } from './engineWireFor.js';
|
|
6
|
+
import { CORRUPT_ROW_ERROR_CODE, DRAINING_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, isCorruptSessionCode, RESUME_AT_ERROR_CODE_PREFIX, RESUME_RETRY_LATER_CODES, RESUME_USAGE_WINDOW_EXHAUSTED, SCENARIO_NOT_ALLOWED_ERROR_CODE, } from './engineErrorCodes.js';
|
|
6
7
|
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
|
-
function readTurnErrorSlots(err) {
|
|
8
|
+
function readTurnErrorSlots(err, status, topCause) {
|
|
8
9
|
if (err === null || err === undefined)
|
|
9
10
|
return { status: undefined, errorCode: undefined, message: undefined, cause: undefined, name: undefined };
|
|
10
11
|
return {
|
|
11
|
-
status
|
|
12
|
+
status,
|
|
12
13
|
errorCode: readThrownSlot(err, 'errorCode', 'data'),
|
|
13
14
|
message: readThrownSlot(err, 'message'),
|
|
14
|
-
cause:
|
|
15
|
+
cause: topCause !== undefined ? topCause.value : undefined,
|
|
15
16
|
name: typeof err === 'object' ? readThrownSlot(err, 'name') : undefined,
|
|
16
17
|
};
|
|
17
18
|
}
|
|
@@ -29,52 +30,108 @@ function wireErrorDetailOf(slots, err) {
|
|
|
29
30
|
(typeof slots.message === 'string' && slots.message.length > 0 && slots.message) ||
|
|
30
31
|
renderedText(err));
|
|
31
32
|
}
|
|
32
|
-
function isTransportShape(slots, detail) {
|
|
33
|
+
function isTransportShape(slots, detail, chain) {
|
|
33
34
|
if (typeof slots.status === 'number' || slots.status === THROWN_SLOT_UNREADABLE)
|
|
34
35
|
return false;
|
|
35
|
-
|
|
36
|
+
if (chain.reading === 'answered')
|
|
37
|
+
return false;
|
|
38
|
+
if (chain.reading === 'transient')
|
|
39
|
+
return true;
|
|
40
|
+
if (slots.cause !== undefined && slots.cause !== THROWN_SLOT_UNREADABLE && ownReadingSlot(chain, 'chainEnd') !== 'unreadable')
|
|
41
|
+
return true;
|
|
42
|
+
return WIRE_NETWORK_ERROR_PATTERN.test(detail()) || (typeof slots.message === 'string' && WIRE_NETWORK_ERROR_PATTERN.test(slots.message));
|
|
43
|
+
}
|
|
44
|
+
function topStatusOf(err, ans) {
|
|
45
|
+
if (ans.answer === THROWN_SLOT_UNREADABLE)
|
|
46
|
+
return ans.chain.reading === 'answered' ? undefined : THROWN_SLOT_UNREADABLE;
|
|
47
|
+
return ans.answer !== undefined && ans.answer.layer === err ? ans.answer.status : undefined;
|
|
48
|
+
}
|
|
49
|
+
function httpVerdictOf(captured, fallbackMessage, topLocal, topCause) {
|
|
50
|
+
const source = captured.layer;
|
|
51
|
+
const errorCode = captured.code.state === 'read' ? captured.code.wire : undefined;
|
|
52
|
+
const rawMessage = readThrownSlot(source, 'message');
|
|
53
|
+
const message = typeof rawMessage === 'string' && rawMessage.length > 0 ? rawMessage : fallbackMessage();
|
|
54
|
+
const effectiveCode = effectiveCodeOf(captured.code);
|
|
55
|
+
const storedRowWhere = isSlotCarrier(source) ? storedRowWhereOf(source, effectiveCode) : undefined;
|
|
56
|
+
const sessionUnreadable = isCorruptSessionCode(effectiveCode);
|
|
57
|
+
const leaseUnavailable = errorCode === FLEET_LEASE_UNAVAILABLE && fleetLeaseUnavailableFromError(source) !== null;
|
|
58
|
+
const verdict = {
|
|
59
|
+
kind: 'http',
|
|
60
|
+
status: captured.status,
|
|
61
|
+
...(errorCode !== undefined ? { errorCode } : {}),
|
|
62
|
+
message,
|
|
63
|
+
...(storedRowWhere !== undefined ? { storedRowWhere } : {}),
|
|
64
|
+
...(sessionUnreadable ? { sessionUnreadable: true } : {}),
|
|
65
|
+
...(leaseUnavailable ? { leaseUnavailable: true } : {}),
|
|
66
|
+
};
|
|
67
|
+
noteTriageReading(verdict, { answer: captured, ...(topLocal !== undefined ? { topLocalCode: topLocal } : {}), ...(topCause !== undefined ? { topCause } : {}), transport: false });
|
|
68
|
+
return verdict;
|
|
69
|
+
}
|
|
70
|
+
function noted(verdict, ans, captured, transport, err, topCode, topCauseRead) {
|
|
71
|
+
const a = ans.answer;
|
|
72
|
+
const topLocalCode = ownReadingSlot(ans, 'topLocalCode');
|
|
73
|
+
const unanswered = a === undefined && isSlotCarrier(err) ? { unanswered: captureUnanswered(err, topCode, topLocalCode, ownReadingSlot(ans, 'topStatusSlot')) } : {};
|
|
74
|
+
const topLocal = topLocalOf(err, a, topLocalCode);
|
|
75
|
+
const topCause = topCauseRecordOf(err, topCauseRead);
|
|
76
|
+
noteTriageReading(verdict, {
|
|
77
|
+
answer: a === THROWN_SLOT_UNREADABLE ? a : captured,
|
|
78
|
+
...unanswered,
|
|
79
|
+
...(topLocal !== undefined ? { topLocalCode: topLocal } : {}),
|
|
80
|
+
...(topCause !== undefined ? { topCause } : {}),
|
|
81
|
+
transport,
|
|
82
|
+
...(ownReadingSlot(ans.chain, 'chainEnd') === 'unreadable' ? { chainEnd: 'unreadable' } : {}),
|
|
83
|
+
});
|
|
84
|
+
return verdict;
|
|
85
|
+
}
|
|
86
|
+
function topCauseReadFor(err, ans) {
|
|
87
|
+
const walked = ownReadingSlot(ans, 'topCause');
|
|
88
|
+
if (walked !== undefined)
|
|
89
|
+
return walked;
|
|
90
|
+
return isSlotCarrier(err) ? causeSlotReadOf(err) : undefined;
|
|
91
|
+
}
|
|
92
|
+
function topCauseRecordOf(err, read) {
|
|
93
|
+
return read !== undefined && isSlotCarrier(err) ? Object.freeze({ layer: err, read }) : undefined;
|
|
94
|
+
}
|
|
95
|
+
function topLocalOf(err, a, topLocalCode) {
|
|
96
|
+
if (topLocalCode === undefined || a === undefined || (a !== THROWN_SLOT_UNREADABLE && a.layer === err) || !isSlotCarrier(err))
|
|
97
|
+
return undefined;
|
|
98
|
+
return Object.freeze({ layer: err, localCode: topLocalCode.value });
|
|
36
99
|
}
|
|
37
100
|
export function classifyTurnWireError(err) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const leaseUnavailable = slots.errorCode === FLEET_LEASE_UNAVAILABLE && fleetLeaseUnavailableFromError(err) !== null;
|
|
46
|
-
return {
|
|
47
|
-
kind: 'http',
|
|
48
|
-
status: slots.status,
|
|
49
|
-
...(errorCode !== undefined ? { errorCode } : {}),
|
|
50
|
-
message,
|
|
51
|
-
...(storedRowWhere !== undefined ? { storedRowWhere } : {}),
|
|
52
|
-
...(sessionUnreadable ? { sessionUnreadable: true } : {}),
|
|
53
|
-
...(leaseUnavailable ? { leaseUnavailable: true } : {}),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
101
|
+
const ans = answerReadingOf(err);
|
|
102
|
+
const a = ans.answer;
|
|
103
|
+
const captured = a !== undefined && a !== THROWN_SLOT_UNREADABLE ? captureAnswer(a, readThrownSlot(a.layer, 'errorCode', 'data')) : undefined;
|
|
104
|
+
const topCauseRead = topCauseReadFor(err, ans);
|
|
105
|
+
if (captured !== undefined && captured.layer === err)
|
|
106
|
+
return httpVerdictOf(captured, () => renderedText(err), undefined, topCauseRecordOf(err, topCauseRead));
|
|
107
|
+
const slots = readTurnErrorSlots(err, topStatusOf(err, ans), topCauseRead);
|
|
56
108
|
if (slots.status !== THROWN_SLOT_UNREADABLE && slots.name === 'StreamEndedWithoutTerminalError') {
|
|
57
|
-
return { kind: 'stream-ended-without-terminal' };
|
|
109
|
+
return noted({ kind: 'stream-ended-without-terminal' }, ans, captured, transportShapeOf(slots, err, ans), err, slots.errorCode, topCauseRead);
|
|
110
|
+
}
|
|
111
|
+
if (captured !== undefined) {
|
|
112
|
+
const top = slots.message;
|
|
113
|
+
return httpVerdictOf(captured, () => (typeof top === 'string' && top.length > 0 ? top : renderedText(err)), topLocalOf(err, captured, ownReadingSlot(ans, 'topLocalCode')), topCauseRecordOf(err, topCauseRead));
|
|
58
114
|
}
|
|
59
115
|
const detail = wireErrorDetailOf(slots, err);
|
|
60
|
-
if (isTransportShape(slots, () => detail))
|
|
61
|
-
return { kind: 'transport', detail };
|
|
116
|
+
if (ans.answer === undefined && isTransportShape(slots, () => detail, ans.chain))
|
|
117
|
+
return noted({ kind: 'transport', detail }, ans, undefined, true, err, slots.errorCode, topCauseRead);
|
|
62
118
|
const name = thrownIsInstanceOf(err, Error) && slots.name !== THROWN_SLOT_UNREADABLE ? slots.name : typeof err;
|
|
63
|
-
return { kind: 'internal', name, detail };
|
|
119
|
+
return noted({ kind: 'internal', name, detail }, ans, undefined, false, err, slots.errorCode, topCauseRead);
|
|
120
|
+
}
|
|
121
|
+
function transportShapeOf(slots, err, ans) {
|
|
122
|
+
return ans.answer === undefined && isTransportShape(slots, () => wireErrorDetailOf(slots, err), ans.chain);
|
|
64
123
|
}
|
|
65
124
|
export function isWireTransportError(err) {
|
|
66
|
-
const
|
|
67
|
-
return
|
|
125
|
+
const ans = answerReadingOf(err);
|
|
126
|
+
return transportShapeOf(readTurnErrorSlots(err, topStatusOf(err, ans), topCauseReadFor(err, ans)), err, ans);
|
|
68
127
|
}
|
|
69
128
|
export function isPreStreamDrainingReject(err) {
|
|
70
129
|
return readThrownSlot(err, 'status', 'data') === 503 && readThrownSlot(err, 'errorCode', 'data') === DRAINING_ERROR_CODE;
|
|
71
130
|
}
|
|
72
131
|
export function effectiveWireErrorCode(err) {
|
|
73
|
-
if (
|
|
132
|
+
if (!isSlotCarrier(err))
|
|
74
133
|
return undefined;
|
|
75
|
-
|
|
76
|
-
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
77
|
-
return foldedWireErrorCode(err, outer);
|
|
134
|
+
return effectiveWireCodeReading(err).code;
|
|
78
135
|
}
|
|
79
136
|
export function isNotFoundFailure(e) {
|
|
80
137
|
try {
|
|
@@ -98,15 +155,9 @@ export function isNotFoundFailure(e) {
|
|
|
98
155
|
}
|
|
99
156
|
}
|
|
100
157
|
const NOT_FOUND_CODE_PREFIX = 'not_found.';
|
|
101
|
-
function foldedWireErrorCode(err, outer) {
|
|
102
|
-
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
103
|
-
return outer;
|
|
104
|
-
const inner = readBlockedBy(err);
|
|
105
|
-
return inner.kind === 'named' ? inner.code : outer;
|
|
106
|
-
}
|
|
107
158
|
export function corruptStoredRowWhere(err) {
|
|
108
159
|
const code = effectiveWireErrorCode(err);
|
|
109
|
-
return
|
|
160
|
+
return isSlotCarrier(err) ? storedRowWhereOf(err, code) : undefined;
|
|
110
161
|
}
|
|
111
162
|
function storedRowWhereOf(err, effectiveCode) {
|
|
112
163
|
if (effectiveCode !== CORRUPT_ROW_ERROR_CODE)
|
|
@@ -164,17 +215,15 @@ export function streamDrainingDecision(frame, attempt, opts) {
|
|
|
164
215
|
return { reconnectAfterMs: drainingRetryDelayMs(null, attempt, opts?.ladder !== undefined ? { ladder: opts.ladder } : undefined) };
|
|
165
216
|
}
|
|
166
217
|
export function scenarioDenyFromError(err) {
|
|
167
|
-
if (
|
|
218
|
+
if (!isSlotCarrier(err))
|
|
168
219
|
return null;
|
|
169
220
|
const status = readThrownSlot(err, 'status', 'data');
|
|
170
221
|
if (status !== 400 && status !== 409)
|
|
171
222
|
return null;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
if (effectiveWireErrorCode(err) !== SCENARIO_NOT_ALLOWED_ERROR_CODE)
|
|
223
|
+
const coded = effectiveWireCodeReading(err);
|
|
224
|
+
if (status === 409 && !coded.folded)
|
|
225
|
+
return null;
|
|
226
|
+
if (coded.code !== SCENARIO_NOT_ALLOWED_ERROR_CODE)
|
|
178
227
|
return null;
|
|
179
228
|
const allowlist = (readErrorStringList(err, 'allowlist') ?? []).filter((x) => x.length > 0);
|
|
180
229
|
return { allowlist };
|
|
@@ -209,7 +258,7 @@ export function scenarioNotAllowedContent(detail, requestedScenario, surface) {
|
|
|
209
258
|
return parts.join(' · ');
|
|
210
259
|
}
|
|
211
260
|
export function resumeRetryLaterFromError(err) {
|
|
212
|
-
if (
|
|
261
|
+
if (!isSlotCarrier(err))
|
|
213
262
|
return null;
|
|
214
263
|
const code = readThrownSlot(err, 'errorCode', 'data');
|
|
215
264
|
if (typeof code !== 'string' || !RESUME_RETRY_LATER_CODES.includes(code))
|
|
@@ -11,6 +11,7 @@ interface WireFailureShape {
|
|
|
11
11
|
message: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const THROWN_SLOT_UNREADABLE: unique symbol;
|
|
14
|
+
export declare function isSlotCarrier(x: {} | null | undefined): x is object;
|
|
14
15
|
export declare function readThrownSlot(o: unknown, key: string, own?: boolean | 'data'): unknown;
|
|
15
16
|
export declare function thrownIsInstanceOf<C extends abstract new (...args: never[]) => unknown>(e: unknown, cls: C): e is InstanceType<C>;
|
|
16
17
|
export type ThrownExtraReading = {
|
|
@@ -55,7 +56,14 @@ export type ProtocolErrorNameReading = {
|
|
|
55
56
|
export declare function protocolErrorNameReading(e: object): ProtocolErrorNameReading;
|
|
56
57
|
export declare function protocolErrorNameOf(e: object): ProtocolErrorName | undefined;
|
|
57
58
|
export type ThrownStatusReading = number | undefined | typeof THROWN_SLOT_UNREADABLE;
|
|
58
|
-
export declare function readThrownStatusSlot(o: object): ThrownStatusReading;
|
|
59
|
+
export declare function readThrownStatusSlot(o: object, notePresence?: (presence: SlotPresence) => void): ThrownStatusReading;
|
|
60
|
+
export type SlotPresence = 'absent' | 'present' | 'unreadable';
|
|
61
|
+
export interface OwnSlotRead {
|
|
62
|
+
readonly value: {} | null | undefined;
|
|
63
|
+
readonly presence: SlotPresence;
|
|
64
|
+
}
|
|
65
|
+
export declare function slotPresenceOf(o: object, key: string): SlotPresence;
|
|
66
|
+
export declare function slotReadOf(o: object, key: string): OwnSlotRead;
|
|
59
67
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
60
68
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
61
69
|
export declare function readErrorString(o: object, key: string): string | undefined;
|
|
@@ -83,7 +91,23 @@ export type BlockedByReading = {
|
|
|
83
91
|
kind: 'unreadable';
|
|
84
92
|
};
|
|
85
93
|
export declare function readBlockedBy(o: object): BlockedByReading;
|
|
94
|
+
export interface FoldedCodeReading {
|
|
95
|
+
readonly code: string | undefined;
|
|
96
|
+
readonly folded: boolean;
|
|
97
|
+
}
|
|
98
|
+
export declare function foldedWireCodeReading(o: object, outer: string | undefined): FoldedCodeReading;
|
|
99
|
+
export declare function effectiveWireCodeReading(o: object): FoldedCodeReading;
|
|
100
|
+
export interface FoldedCodeBits {
|
|
101
|
+
readonly errorCode: string | undefined;
|
|
102
|
+
readonly blockedBy: string | undefined;
|
|
103
|
+
}
|
|
104
|
+
export declare function ownFoldedCodeBitsOf(wire: {
|
|
105
|
+
readonly errorCode?: string;
|
|
106
|
+
readonly blockedBy?: string;
|
|
107
|
+
} | undefined): FoldedCodeBits;
|
|
86
108
|
export declare function readRefusalField(o: object): string | undefined;
|
|
109
|
+
export declare const REFUSAL_PROBLEMS_READ_MAX = 1000;
|
|
110
|
+
export declare function readRefusalNamedFields(o: object): readonly string[];
|
|
87
111
|
export declare function isDisplayableWireCode(s: string): boolean;
|
|
88
112
|
export declare const ASSEMBLY_REFUSAL_CAUSES: readonly ["ports_missing", "judge_unanswerable", "input_malformed", "agents_projection_failed", "agents_not_ready"];
|
|
89
113
|
export interface AssemblyRefusal {
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
2
|
import { guardedRead, ownDataField, readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { RESUME_POLICY_FOLD_CODE } from './engineErrorCodes.js';
|
|
3
4
|
export const THROWN_SLOT_UNREADABLE = Symbol('thrown-slot-unreadable');
|
|
5
|
+
export function isSlotCarrier(x) {
|
|
6
|
+
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
7
|
+
}
|
|
4
8
|
export function readThrownSlot(o, key, own = false) {
|
|
5
9
|
try {
|
|
6
10
|
if (own === 'data') {
|
|
7
11
|
if (o === null || o === undefined)
|
|
8
12
|
return THROWN_SLOT_UNREADABLE;
|
|
9
|
-
return
|
|
13
|
+
return isSlotCarrier(o) ? ownDataField(o, key) : undefined;
|
|
10
14
|
}
|
|
11
15
|
if (own && !Object.hasOwn(o, key))
|
|
12
16
|
return undefined;
|
|
@@ -150,13 +154,48 @@ export function protocolErrorNameOf(e) {
|
|
|
150
154
|
const r = protocolErrorNameReading(e);
|
|
151
155
|
return r.state === 'named' ? r.name : undefined;
|
|
152
156
|
}
|
|
153
|
-
export function readThrownStatusSlot(o) {
|
|
154
|
-
const
|
|
155
|
-
const
|
|
157
|
+
export function readThrownStatusSlot(o, notePresence) {
|
|
158
|
+
const withPresence = notePresence !== undefined;
|
|
159
|
+
const offCarrier = { value: o === null || o === undefined ? THROWN_SLOT_UNREADABLE : undefined, presence: 'unreadable' };
|
|
160
|
+
const st = isSlotCarrier(o) ? readOwnSlot(o, 'status', withPresence) : offCarrier;
|
|
161
|
+
let raw = st.value;
|
|
162
|
+
let presence = st.presence;
|
|
163
|
+
if (raw !== THROWN_SLOT_UNREADABLE && (raw === undefined || raw === null)) {
|
|
164
|
+
const sc = isSlotCarrier(o) ? readOwnSlot(o, 'statusCode', withPresence) : offCarrier;
|
|
165
|
+
raw = sc.value;
|
|
166
|
+
if (presence === 'absent')
|
|
167
|
+
presence = sc.presence;
|
|
168
|
+
}
|
|
169
|
+
notePresence?.(presence);
|
|
156
170
|
if (raw === undefined)
|
|
157
171
|
return undefined;
|
|
158
172
|
return typeof raw === 'number' ? raw : THROWN_SLOT_UNREADABLE;
|
|
159
173
|
}
|
|
174
|
+
function readOwnSlot(o, key, withPresence) {
|
|
175
|
+
let d;
|
|
176
|
+
try {
|
|
177
|
+
d = Object.getOwnPropertyDescriptor(o, key);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return { value: THROWN_SLOT_UNREADABLE, presence: 'unreadable' };
|
|
181
|
+
}
|
|
182
|
+
if (d !== undefined)
|
|
183
|
+
return Object.hasOwn(d, 'value') ? { value: d.value, presence: 'present' } : { value: THROWN_SLOT_UNREADABLE, presence: 'unreadable' };
|
|
184
|
+
if (!withPresence)
|
|
185
|
+
return { value: undefined, presence: 'unreadable' };
|
|
186
|
+
try {
|
|
187
|
+
return { value: undefined, presence: key in o ? 'unreadable' : 'absent' };
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return { value: undefined, presence: 'unreadable' };
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export function slotPresenceOf(o, key) {
|
|
194
|
+
return slotReadOf(o, key).presence;
|
|
195
|
+
}
|
|
196
|
+
export function slotReadOf(o, key) {
|
|
197
|
+
return readOwnSlot(o, key, true);
|
|
198
|
+
}
|
|
160
199
|
function readErrorSlot(obj, key, accept) {
|
|
161
200
|
try {
|
|
162
201
|
const topRaw = readThrownSlot(obj, key, 'data');
|
|
@@ -338,6 +377,24 @@ export function readBlockedBy(o) {
|
|
|
338
377
|
return { kind: 'unreadable' };
|
|
339
378
|
}
|
|
340
379
|
}
|
|
380
|
+
export function foldedWireCodeReading(o, outer) {
|
|
381
|
+
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
382
|
+
return { code: outer, folded: false };
|
|
383
|
+
const inner = readBlockedBy(o);
|
|
384
|
+
return inner.kind === 'named' ? { code: inner.code, folded: true } : { code: outer, folded: false };
|
|
385
|
+
}
|
|
386
|
+
export function effectiveWireCodeReading(o) {
|
|
387
|
+
const outerRaw = readThrownSlot(o, 'errorCode', 'data');
|
|
388
|
+
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
389
|
+
return foldedWireCodeReading(o, outer);
|
|
390
|
+
}
|
|
391
|
+
export function ownFoldedCodeBitsOf(wire) {
|
|
392
|
+
const bit = (key) => {
|
|
393
|
+
const v = readThrownSlot(wire, key, 'data');
|
|
394
|
+
return typeof v === 'string' ? v : undefined;
|
|
395
|
+
};
|
|
396
|
+
return Object.freeze({ errorCode: bit('errorCode'), blockedBy: bit('blockedBy') });
|
|
397
|
+
}
|
|
341
398
|
export function readRefusalField(o) {
|
|
342
399
|
const str = (rec) => {
|
|
343
400
|
const v = guardedRead(() => readOwnDataValue(rec, 'field'));
|
|
@@ -349,7 +406,37 @@ export function readRefusalField(o) {
|
|
|
349
406
|
if (fromExtra !== undefined)
|
|
350
407
|
return fromExtra;
|
|
351
408
|
}
|
|
352
|
-
|
|
409
|
+
const top = readThrownSlot(o, 'field', 'data');
|
|
410
|
+
return typeof top === 'string' && top !== '' ? top : undefined;
|
|
411
|
+
}
|
|
412
|
+
export const REFUSAL_PROBLEMS_READ_MAX = 1000;
|
|
413
|
+
export function readRefusalNamedFields(o) {
|
|
414
|
+
const out = [];
|
|
415
|
+
const add = (v) => {
|
|
416
|
+
if (typeof v === 'string' && v !== '' && !out.includes(v))
|
|
417
|
+
out.push(v);
|
|
418
|
+
};
|
|
419
|
+
add(guardedRead(() => readRefusalField(o)));
|
|
420
|
+
const detail = guardedRead(() => readErrorRecord(o, 'detail'));
|
|
421
|
+
if (detail !== undefined) {
|
|
422
|
+
add(guardedRead(() => readOwnDataValue(detail, 'field')));
|
|
423
|
+
try {
|
|
424
|
+
const list = readOwnDataValue(detail, 'problems');
|
|
425
|
+
if (Array.isArray(list)) {
|
|
426
|
+
const n = list.length;
|
|
427
|
+
const len = typeof n === 'number' && Number.isSafeInteger(n) && n > 0 ? Math.min(n, REFUSAL_PROBLEMS_READ_MAX) : 0;
|
|
428
|
+
for (let i = 0; i < len; i += 1) {
|
|
429
|
+
const item = guardedRead(() => readOwnDataValue(list, String(i)));
|
|
430
|
+
if (typeof item !== 'object' || item === null)
|
|
431
|
+
continue;
|
|
432
|
+
add(guardedRead(() => readOwnDataValue(item, 'field')));
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
catch {
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return Object.freeze(out);
|
|
353
440
|
}
|
|
354
441
|
const DISPLAYABLE_WIRE_CODE = /^[A-Za-z0-9._:-]{1,64}$/;
|
|
355
442
|
export function isDisplayableWireCode(s) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED,
|
|
1
|
+
import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
2
|
import type { TaskRequestLike } from './request/taskRequest.js';
|
|
3
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
4
|
export declare const CONFLICT_APPROVAL_SETTLED = "conflict.approval_settled";
|
|
4
5
|
export declare const CONFLICT_RUN_NOT_RUNNING = "conflict.run_not_running";
|
|
5
6
|
export type CancelConflictKind = 'approval_settled' | 'run_not_running' | 'unrecognized';
|
|
@@ -8,26 +9,31 @@ export interface CancelConflictDetail {
|
|
|
8
9
|
code?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare function cancelConflictFromError(err: unknown): CancelConflictDetail | null;
|
|
11
|
-
export declare function cancelConflictContent(detail: Pick<CancelConflictDetail, 'kind'
|
|
12
|
+
export declare function cancelConflictContent(detail: Pick<CancelConflictDetail, 'kind'>, lang?: UiLanguage): string;
|
|
12
13
|
export interface UsageWindowExhaustedDetail {
|
|
13
14
|
code: typeof USAGE_WINDOW_EXHAUSTED;
|
|
14
15
|
retryAfterSec?: number;
|
|
15
16
|
}
|
|
16
17
|
export declare function usageWindowExhaustedFromError(err: unknown): UsageWindowExhaustedDetail | null;
|
|
17
|
-
export declare function usageWindowExhaustedContent(detail: UsageWindowExhaustedDetail): string;
|
|
18
|
+
export declare function usageWindowExhaustedContent(detail: UsageWindowExhaustedDetail, lang?: UiLanguage): string;
|
|
19
|
+
export interface QuotaExhaustedView {
|
|
20
|
+
readonly windowType?: 'fiveHour' | 'weekly' | 'budget';
|
|
21
|
+
readonly remaining?: number;
|
|
22
|
+
readonly resetAt?: string | null;
|
|
23
|
+
readonly isEstimate?: boolean;
|
|
24
|
+
readonly pool?: string;
|
|
25
|
+
readonly retryAfterSec?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function quotaExhaustedFromError(err: {} | null | undefined): QuotaExhaustedView | null;
|
|
28
|
+
export declare function quotaResetInstantText(resetAtIso: string, nowMs: number, lang?: UiLanguage): string | undefined;
|
|
29
|
+
export declare function quotaExhaustedContent(detail: QuotaExhaustedView, nowMs: number, lang?: UiLanguage): string;
|
|
18
30
|
export interface FleetLeaseUnavailableDetail {
|
|
19
31
|
code: typeof FLEET_LEASE_UNAVAILABLE;
|
|
20
32
|
reason?: string;
|
|
21
33
|
retryAfterSec?: number;
|
|
22
34
|
}
|
|
23
35
|
export declare function fleetLeaseUnavailableFromError(err: unknown): FleetLeaseUnavailableDetail | null;
|
|
24
|
-
export declare function fleetLeaseUnavailableContent(detail: FleetLeaseUnavailableDetail): string;
|
|
25
|
-
export interface ScenarioAssignmentUnknownDetail {
|
|
26
|
-
code: typeof SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE;
|
|
27
|
-
scenario?: string;
|
|
28
|
-
source?: 'ruling' | 'deployment';
|
|
29
|
-
}
|
|
30
|
-
export declare function scenarioAssignmentUnknownFromError(err: unknown): ScenarioAssignmentUnknownDetail | null;
|
|
36
|
+
export declare function fleetLeaseUnavailableContent(detail: FleetLeaseUnavailableDetail, lang?: UiLanguage): string;
|
|
31
37
|
export type DenyAttributionRefusalKind = 'not_in_proof' | 'decision_conflict' | 'attribution_rejected' | 'retired_key';
|
|
32
38
|
export interface DenyAttributionRefusalDetail {
|
|
33
39
|
kind: DenyAttributionRefusalKind;
|
|
@@ -36,7 +42,7 @@ export interface DenyAttributionRefusalDetail {
|
|
|
36
42
|
field?: string;
|
|
37
43
|
}
|
|
38
44
|
export declare function denyAttributionRefusalFromError(err: unknown, sentAttributionKey: boolean): DenyAttributionRefusalDetail | null;
|
|
39
|
-
export declare function denyAttributionRefusalContent(detail: Pick<DenyAttributionRefusalDetail, 'kind' | 'field'
|
|
45
|
+
export declare function denyAttributionRefusalContent(detail: Pick<DenyAttributionRefusalDetail, 'kind' | 'field'>, lang?: UiLanguage): string;
|
|
40
46
|
export declare const CONFLICT_SESSION_CHILDREN_ALIVE = "conflict.session_children_alive";
|
|
41
47
|
export type SessionDeleteConflictKind = 'children_alive' | 'active_run' | 'unrecognized';
|
|
42
48
|
export interface SessionDeleteConflictDetail {
|
|
@@ -46,7 +52,7 @@ export interface SessionDeleteConflictDetail {
|
|
|
46
52
|
activeTaskId?: string;
|
|
47
53
|
}
|
|
48
54
|
export declare function sessionDeleteConflictFromError(err: unknown): SessionDeleteConflictDetail | null;
|
|
49
|
-
export declare function sessionDeleteConflictContent(detail: Pick<SessionDeleteConflictDetail, 'kind' | 'remaining' | 'activeTaskId'
|
|
55
|
+
export declare function sessionDeleteConflictContent(detail: Pick<SessionDeleteConflictDetail, 'kind' | 'remaining' | 'activeTaskId'>, lang?: UiLanguage): string;
|
|
50
56
|
export type SettingsPermissionBucket = 'allow' | 'deny' | 'ask';
|
|
51
57
|
export type SettingsPermissionBucketRefusalReason = 'over_cap' | 'bad_entry';
|
|
52
58
|
export interface SettingsPermissionBucketRefusalDetail {
|
|
@@ -57,13 +63,32 @@ export interface SettingsPermissionBucketRefusalDetail {
|
|
|
57
63
|
readonly index?: number;
|
|
58
64
|
readonly folded?: true;
|
|
59
65
|
}
|
|
60
|
-
export
|
|
61
|
-
export
|
|
66
|
+
export type FieldLimitRefusalReason = 'over_cap' | 'too_long' | 'bad_entry';
|
|
67
|
+
export interface FieldLimitRefusalDetail {
|
|
68
|
+
readonly field: string;
|
|
69
|
+
readonly reason: FieldLimitRefusalReason;
|
|
70
|
+
readonly count?: number;
|
|
71
|
+
readonly cap?: number;
|
|
72
|
+
readonly index?: number;
|
|
73
|
+
readonly folded?: true;
|
|
74
|
+
}
|
|
75
|
+
export declare function fieldLimitRefusalFromError(err: {} | null | undefined): FieldLimitRefusalDetail | null;
|
|
76
|
+
export declare function fieldLimitRefusalOfSettingsHooks(refusal: SettingsHooksRefusal | null | undefined): FieldLimitRefusalDetail | null;
|
|
77
|
+
export declare function fieldLimitRefusalContent(detail: FieldLimitRefusalDetail, lang?: UiLanguage): string;
|
|
78
|
+
export declare function settingsPermissionBucketRefusalContent(detail: SettingsPermissionBucketRefusalDetail, lang?: UiLanguage): string;
|
|
79
|
+
declare const PAYLOAD_TOO_LARGE = "request.payload_too_large";
|
|
80
|
+
declare const BLOB_TOO_LARGE_FOR_SQL = "blob_too_large_for_sql";
|
|
81
|
+
export interface AdmissionWallRefusalDetail {
|
|
82
|
+
readonly code: typeof PAYLOAD_TOO_LARGE | typeof BLOB_TOO_LARGE_FOR_SQL;
|
|
83
|
+
readonly wallSource: 'reported' | 'assumed' | 'operator';
|
|
84
|
+
}
|
|
85
|
+
export declare function admissionWallRefusalFromError(err: {} | null | undefined): AdmissionWallRefusalDetail | null;
|
|
86
|
+
export declare function admissionWallRefusalContent(detail: AdmissionWallRefusalDetail): string;
|
|
62
87
|
export interface ToolDeclarationRefusalDetail {
|
|
63
88
|
readonly code: string;
|
|
64
89
|
}
|
|
65
90
|
export declare function toolDeclarationRefusalFromError(err: unknown): ToolDeclarationRefusalDetail | null;
|
|
66
|
-
export declare function toolDeclarationRefusalContent(_detail: Pick<ToolDeclarationRefusalDetail, 'code'
|
|
91
|
+
export declare function toolDeclarationRefusalContent(_detail: Pick<ToolDeclarationRefusalDetail, 'code'>, lang?: UiLanguage): string;
|
|
67
92
|
export interface BodyShapeRefusalDetail {
|
|
68
93
|
readonly unknownKeys?: readonly string[];
|
|
69
94
|
readonly unsupportedKeys?: readonly string[];
|
|
@@ -76,37 +101,69 @@ export interface HostPostureRefusalDetail {
|
|
|
76
101
|
readonly askedOpenWriteFace?: true;
|
|
77
102
|
}
|
|
78
103
|
export declare function hostPostureRefusalFromError(err: unknown, sentRequest?: TaskRequestLike): HostPostureRefusalDetail | null;
|
|
79
|
-
export declare function hostPostureRefusalContent(detail: Pick<HostPostureRefusalDetail, 'askedWholeEnvironment' | 'askedOpenWriteFace'
|
|
104
|
+
export declare function hostPostureRefusalContent(detail: Pick<HostPostureRefusalDetail, 'askedWholeEnvironment' | 'askedOpenWriteFace'>, lang?: UiLanguage): string;
|
|
80
105
|
export type HookMatcherRefusal = {
|
|
81
106
|
readonly reason: 'alias_without_canonical';
|
|
82
107
|
readonly event: string;
|
|
83
108
|
readonly alias: string;
|
|
84
109
|
readonly canonical: string;
|
|
110
|
+
readonly path?: readonly (string | number)[];
|
|
85
111
|
} | {
|
|
86
112
|
readonly reason: 'invalid_regex';
|
|
87
113
|
readonly event: string;
|
|
88
114
|
readonly groupIndex: number;
|
|
115
|
+
readonly path?: readonly (string | number)[];
|
|
89
116
|
} | {
|
|
90
117
|
readonly reason: 'over_budget';
|
|
91
118
|
readonly event: string;
|
|
92
119
|
readonly groupIndex: number;
|
|
93
120
|
readonly budgetMs?: number;
|
|
121
|
+
readonly path?: readonly (string | number)[];
|
|
122
|
+
} | {
|
|
123
|
+
readonly reason: 'budget_exceeded';
|
|
124
|
+
readonly event: string;
|
|
125
|
+
readonly groupIndex: number;
|
|
126
|
+
readonly totalMs?: number;
|
|
127
|
+
readonly path?: readonly (string | number)[];
|
|
94
128
|
};
|
|
95
129
|
export declare function hookMatcherRefusalFromError(err: unknown): HookMatcherRefusal | undefined;
|
|
130
|
+
export interface SettingsHooksRefusal {
|
|
131
|
+
readonly reason: string;
|
|
132
|
+
readonly path?: readonly (string | number)[];
|
|
133
|
+
readonly matcher?: HookMatcherRefusal;
|
|
134
|
+
readonly count?: number;
|
|
135
|
+
readonly cap?: number;
|
|
136
|
+
}
|
|
137
|
+
export declare function settingsHooksRefusalFromError(err: {} | null | undefined): SettingsHooksRefusal | undefined;
|
|
96
138
|
export interface AutonomyLaneRefusalDetail {
|
|
97
139
|
readonly code: typeof REQUEST_AUTONOMY_LANE_REFUSED;
|
|
98
140
|
}
|
|
99
141
|
export declare function autonomyLaneRefusalFromError(err: unknown): AutonomyLaneRefusalDetail | null;
|
|
100
|
-
export declare function autonomyLaneRefusalContent(): string;
|
|
142
|
+
export declare function autonomyLaneRefusalContent(lang?: UiLanguage): string;
|
|
143
|
+
export interface UnsupportedRuleRefusalProblem {
|
|
144
|
+
readonly code: string;
|
|
145
|
+
readonly field?: string;
|
|
146
|
+
readonly entry?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface UnsupportedRuleRefusalDetail {
|
|
149
|
+
readonly code: string;
|
|
150
|
+
readonly problems?: readonly UnsupportedRuleRefusalProblem[];
|
|
151
|
+
readonly folded?: true;
|
|
152
|
+
}
|
|
153
|
+
export declare function unsupportedRuleRefusalFromError(err: {} | null | undefined): UnsupportedRuleRefusalDetail | null;
|
|
154
|
+
export declare function unsupportedRuleRefusalContent(detail: UnsupportedRuleRefusalDetail, lang?: UiLanguage): string;
|
|
101
155
|
export interface UserAttachmentRefusalDetail {
|
|
102
156
|
readonly code: typeof USER_ATTACHMENT_INVALID_ERROR_CODE;
|
|
103
157
|
readonly retryable: false;
|
|
158
|
+
readonly index?: number;
|
|
159
|
+
readonly path?: string;
|
|
104
160
|
}
|
|
105
161
|
export declare function userAttachmentRefusalFromError(err: {} | null | undefined): UserAttachmentRefusalDetail | null;
|
|
106
|
-
export declare function userAttachmentRefusalContent(): string;
|
|
162
|
+
export declare function userAttachmentRefusalContent(detail?: Pick<UserAttachmentRefusalDetail, 'index'>): string;
|
|
107
163
|
export interface UserInvokedSkillRefusalDetail {
|
|
108
164
|
readonly code: typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE;
|
|
109
165
|
readonly retryable: false;
|
|
110
166
|
}
|
|
111
167
|
export declare function userInvokedSkillRefusalFromError(err: {} | null | undefined): UserInvokedSkillRefusalDetail | null;
|
|
112
168
|
export declare function userInvokedSkillRefusalContent(): string;
|
|
169
|
+
export {};
|