@sema-agent/client-core 0.97.1 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +8 -0
- package/dist/frameBinding.js +35 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
|
-
import {
|
|
3
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
|
+
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
5
|
export function projectUserInvokedSkillsCapability(caps) {
|
|
5
6
|
try {
|
|
6
7
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
@@ -20,9 +21,6 @@ const reader = createEngineCapReader({
|
|
|
20
21
|
name: 'userInvokedSkills',
|
|
21
22
|
project: projectUserInvokedSkillsCapability,
|
|
22
23
|
});
|
|
23
|
-
export function noteEngineCapsForUserInvokedSkills(baseUrl, caps, opts) {
|
|
24
|
-
reader.note(baseUrl, caps, opts);
|
|
25
|
-
}
|
|
26
24
|
export function observedUserInvokedSkills(baseUrl = engineWireTarget()?.baseUrl) {
|
|
27
25
|
return reader.observed(baseUrl);
|
|
28
26
|
}
|
|
@@ -33,17 +31,40 @@ export function userInvokedSkillsAvailable(reading) {
|
|
|
33
31
|
return 'no';
|
|
34
32
|
return 'unknown';
|
|
35
33
|
}
|
|
36
|
-
export function userInvokedSkillsDoctorDetail(reading) {
|
|
34
|
+
export function userInvokedSkillsDoctorDetail(reading, lang) {
|
|
35
|
+
const subject = msg('notice.capability.subject.userInvokedSkills');
|
|
37
36
|
switch (reading.kind) {
|
|
38
37
|
case 'unreadable':
|
|
39
|
-
return unreadableReadingDetail(
|
|
38
|
+
return unreadableReadingDetail(renderMessage(subject, lang), lang);
|
|
40
39
|
case 'unobserved':
|
|
41
|
-
return
|
|
40
|
+
return renderMessage(msg('notice.capability.unobserved', { subject, key: 'userInvokedSkills' }), lang);
|
|
42
41
|
case 'not_reported':
|
|
43
|
-
return '
|
|
42
|
+
return renderMessage(msg('notice.capability.userInvokedSkills.notReported'), lang);
|
|
44
43
|
case 'absent':
|
|
45
|
-
return '
|
|
44
|
+
return renderMessage(msg('notice.capability.userInvokedSkills.absent'), lang);
|
|
46
45
|
case 'present':
|
|
47
|
-
return '
|
|
46
|
+
return renderMessage(msg('notice.capability.userInvokedSkills.present'), lang);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function userInvokedSkillsDeclaration(names, reading) {
|
|
50
|
+
let named = false;
|
|
51
|
+
try {
|
|
52
|
+
named = Array.isArray(names) && names.length > 0;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
named = false;
|
|
56
|
+
}
|
|
57
|
+
if (!named)
|
|
58
|
+
return { field: {} };
|
|
59
|
+
let kind;
|
|
60
|
+
try {
|
|
61
|
+
kind = reading !== null && typeof reading === 'object' ? readOwnDataValue(reading, 'kind') : undefined;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
kind = undefined;
|
|
48
65
|
}
|
|
66
|
+
if (kind === 'present')
|
|
67
|
+
return { field: { userInvokedSkills: names } };
|
|
68
|
+
const cause = kind === 'absent' || kind === 'not_reported' || kind === 'unobserved' ? kind : 'unreadable';
|
|
69
|
+
return { field: {}, withheld: { cause } };
|
|
49
70
|
}
|
|
@@ -15,9 +15,5 @@ export type WebSearchBackendReading = {
|
|
|
15
15
|
view: WebSearchBackendCapabilityView;
|
|
16
16
|
};
|
|
17
17
|
export declare function projectWebSearchBackendCapability(caps: unknown): WebSearchBackendReading | undefined;
|
|
18
|
-
export declare function noteEngineCapsForWebSearchBackend(baseUrl: string, caps: unknown, opts?: {
|
|
19
|
-
generation?: number;
|
|
20
|
-
}): void;
|
|
21
18
|
export declare function observedWebSearchBackend(baseUrl?: string | undefined): WebSearchBackendReading;
|
|
22
19
|
export declare function webSearchBackendDoctorDetail(reading: WebSearchBackendReading): string;
|
|
23
|
-
export declare function __resetWebSearchBackendReadingsForTests(): void;
|
|
@@ -29,9 +29,6 @@ const reader = createEngineCapReader({
|
|
|
29
29
|
name: 'webSearch.backend',
|
|
30
30
|
project: projectWebSearchBackendCapability,
|
|
31
31
|
});
|
|
32
|
-
export function noteEngineCapsForWebSearchBackend(baseUrl, caps, opts) {
|
|
33
|
-
reader.note(baseUrl, caps, opts);
|
|
34
|
-
}
|
|
35
32
|
export function observedWebSearchBackend(baseUrl = engineWireTarget()?.baseUrl) {
|
|
36
33
|
return reader.observed(baseUrl);
|
|
37
34
|
}
|
|
@@ -56,6 +53,3 @@ export function webSearchBackendDoctorDetail(reading) {
|
|
|
56
53
|
'(per-request overrides are not echoed here)');
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
export function __resetWebSearchBackendReadingsForTests() {
|
|
60
|
-
reader.__resetForTests();
|
|
61
|
-
}
|
|
@@ -21,6 +21,13 @@ export declare function classifyTurnWireError(err: unknown): TurnWireErrorVerdic
|
|
|
21
21
|
export declare function isWireTransportError(err: unknown): boolean;
|
|
22
22
|
export declare function isPreStreamDrainingReject(err: unknown): boolean;
|
|
23
23
|
export declare function effectiveWireErrorCode(err: unknown): string | undefined;
|
|
24
|
+
export type NotFoundFailure = {
|
|
25
|
+
readonly kind: 'not_found';
|
|
26
|
+
readonly code: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'unknown_404';
|
|
29
|
+
};
|
|
30
|
+
export declare function isNotFoundFailure(e: {} | null | undefined): NotFoundFailure | false;
|
|
24
31
|
export declare function corruptStoredRowWhere(err: unknown): string | undefined;
|
|
25
32
|
export declare function corruptStoredRowContent(where: string): string;
|
|
26
33
|
export declare function isResumeAtRejection(err: unknown): boolean;
|
package/dist/wireErrorTriage.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { readBlockedBy, readErrorNumber, readErrorString, readErrorStringList, readThrownSlot, thrownIsInstanceOf, THROWN_SLOT_UNREADABLE, WIRE_FAILURE_UNRENDERABLE_TEXT, } from './wireFailureShape.js';
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, protocolErrorNameOf, readBlockedBy, 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 { DRAINING_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, isCorruptSessionCode, RESUME_AT_ERROR_CODE_PREFIX, RESUME_POLICY_FOLD_CODE, RESUME_RETRY_LATER_CODES, RESUME_USAGE_WINDOW_EXHAUSTED, SCENARIO_NOT_ALLOWED_ERROR_CODE, } from './engineErrorCodes.js';
|
|
5
|
+
import { CORRUPT_ROW_ERROR_CODE, DRAINING_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, isCorruptSessionCode, RESUME_AT_ERROR_CODE_PREFIX, RESUME_POLICY_FOLD_CODE, RESUME_RETRY_LATER_CODES, RESUME_USAGE_WINDOW_EXHAUSTED, SCENARIO_NOT_ALLOWED_ERROR_CODE, } from './engineErrorCodes.js';
|
|
6
6
|
export const WIRE_NETWORK_ERROR_PATTERN = /fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|EHOSTUNREACH|ENETUNREACH|EPIPE|socket hang up|UND_ERR|\bterminated\b|\bother side closed\b/i;
|
|
7
7
|
function readTurnErrorSlots(err) {
|
|
8
8
|
if (err === null || err === undefined)
|
|
@@ -72,16 +72,32 @@ export function isPreStreamDrainingReject(err) {
|
|
|
72
72
|
export function effectiveWireErrorCode(err) {
|
|
73
73
|
if (typeof err !== 'object' || err === null)
|
|
74
74
|
return undefined;
|
|
75
|
-
|
|
75
|
+
const outerRaw = readThrownSlot(err, 'errorCode', 'data');
|
|
76
|
+
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
77
|
+
return foldedWireErrorCode(err, outer);
|
|
78
|
+
}
|
|
79
|
+
export function isNotFoundFailure(e) {
|
|
76
80
|
try {
|
|
77
|
-
|
|
81
|
+
if (e === null || e === undefined || (typeof e !== 'object' && typeof e !== 'function'))
|
|
82
|
+
return false;
|
|
83
|
+
const code = readThrownSlot(e, 'errorCode', 'data');
|
|
84
|
+
if (code === THROWN_SLOT_UNREADABLE)
|
|
85
|
+
return false;
|
|
86
|
+
if (typeof code === 'string') {
|
|
87
|
+
return code.startsWith(NOT_FOUND_CODE_PREFIX) ? Object.freeze({ kind: 'not_found', code }) : false;
|
|
88
|
+
}
|
|
89
|
+
const status = readThrownStatusSlot(e);
|
|
90
|
+
if (status === 404)
|
|
91
|
+
return Object.freeze({ kind: 'unknown_404' });
|
|
92
|
+
if (status === undefined && typeof e === 'object' && protocolErrorNameOf(e) === PROTOCOL_ERROR_NAME.NotFoundError)
|
|
93
|
+
return Object.freeze({ kind: 'unknown_404' });
|
|
94
|
+
return false;
|
|
78
95
|
}
|
|
79
96
|
catch {
|
|
80
|
-
|
|
97
|
+
return false;
|
|
81
98
|
}
|
|
82
|
-
const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
|
|
83
|
-
return foldedWireErrorCode(err, outer);
|
|
84
99
|
}
|
|
100
|
+
const NOT_FOUND_CODE_PREFIX = 'not_found.';
|
|
85
101
|
function foldedWireErrorCode(err, outer) {
|
|
86
102
|
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
87
103
|
return outer;
|
|
@@ -93,7 +109,7 @@ export function corruptStoredRowWhere(err) {
|
|
|
93
109
|
return typeof err === 'object' && err !== null ? storedRowWhereOf(err, code) : undefined;
|
|
94
110
|
}
|
|
95
111
|
function storedRowWhereOf(err, effectiveCode) {
|
|
96
|
-
if (effectiveCode !==
|
|
112
|
+
if (effectiveCode !== CORRUPT_ROW_ERROR_CODE)
|
|
97
113
|
return undefined;
|
|
98
114
|
const where = readErrorString(err, 'where');
|
|
99
115
|
return where !== undefined && where.trim().length > 0 ? where : undefined;
|
|
@@ -150,24 +166,11 @@ export function streamDrainingDecision(frame, attempt, opts) {
|
|
|
150
166
|
export function scenarioDenyFromError(err) {
|
|
151
167
|
if (typeof err !== 'object' || err === null)
|
|
152
168
|
return null;
|
|
153
|
-
const
|
|
154
|
-
let status;
|
|
155
|
-
try {
|
|
156
|
-
status = e.status;
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
169
|
+
const status = readThrownSlot(err, 'status', 'data');
|
|
161
170
|
if (status !== 400 && status !== 409)
|
|
162
171
|
return null;
|
|
163
172
|
if (status === 409) {
|
|
164
|
-
|
|
165
|
-
try {
|
|
166
|
-
outer = e.errorCode;
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
173
|
+
const outer = readThrownSlot(err, 'errorCode', 'data');
|
|
171
174
|
if (outer !== RESUME_POLICY_FOLD_CODE)
|
|
172
175
|
return null;
|
|
173
176
|
}
|
|
@@ -4,9 +4,10 @@ interface WireFailureShape {
|
|
|
4
4
|
retryAfterSec?: number;
|
|
5
5
|
committed?: 'no' | 'unknown' | 'unreadable';
|
|
6
6
|
bodyField?: string;
|
|
7
|
-
bodyName?: string;
|
|
8
7
|
bodyVerdict?: string;
|
|
9
8
|
bodyCurrentName?: string;
|
|
9
|
+
bodyEntry?: string;
|
|
10
|
+
bodyReason?: string;
|
|
10
11
|
message: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const THROWN_SLOT_UNREADABLE: unique symbol;
|
|
@@ -21,6 +22,40 @@ export type ThrownExtraReading = {
|
|
|
21
22
|
readonly state: 'unreadable';
|
|
22
23
|
};
|
|
23
24
|
export declare function readThrownExtra(o: {} | null | undefined): ThrownExtraReading;
|
|
25
|
+
export declare const PROTOCOL_ERROR_NAME: Readonly<{
|
|
26
|
+
readonly ApprovalBindingMismatchError: "ApprovalBindingMismatchError";
|
|
27
|
+
readonly ApprovalStaleError: "ApprovalStaleError";
|
|
28
|
+
readonly AskDecidedError: "AskDecidedError";
|
|
29
|
+
readonly ConflictError: "ConflictError";
|
|
30
|
+
readonly NotFoundError: "NotFoundError";
|
|
31
|
+
readonly ParkedResumeStartupError: "ParkedResumeStartupError";
|
|
32
|
+
readonly RateLimitedError: "RateLimitedError";
|
|
33
|
+
readonly SteeringAmbiguousTargetError: "SteeringAmbiguousTargetError";
|
|
34
|
+
readonly SteeringDuplicateInputIdError: "SteeringDuplicateInputIdError";
|
|
35
|
+
readonly SteeringError: "SteeringError";
|
|
36
|
+
readonly SteeringInvalidContentError: "SteeringInvalidContentError";
|
|
37
|
+
readonly SteeringLedgerUnavailableError: "SteeringLedgerUnavailableError";
|
|
38
|
+
readonly SteeringNotRunningError: "SteeringNotRunningError";
|
|
39
|
+
readonly SteeringQueueFullError: "SteeringQueueFullError";
|
|
40
|
+
readonly SteeringStillRunningError: "SteeringStillRunningError";
|
|
41
|
+
readonly UsageWindowExhaustedError: "UsageWindowExhaustedError";
|
|
42
|
+
}>;
|
|
43
|
+
export type ProtocolErrorName = (typeof PROTOCOL_ERROR_NAME)[keyof typeof PROTOCOL_ERROR_NAME];
|
|
44
|
+
export declare function isSdkErrorInstance(o: object): boolean;
|
|
45
|
+
export type ProtocolErrorNameReading = {
|
|
46
|
+
readonly state: 'named';
|
|
47
|
+
readonly name: ProtocolErrorName;
|
|
48
|
+
} | {
|
|
49
|
+
readonly state: 'absent';
|
|
50
|
+
} | {
|
|
51
|
+
readonly state: 'sdk-instance';
|
|
52
|
+
} | {
|
|
53
|
+
readonly state: 'unreadable';
|
|
54
|
+
};
|
|
55
|
+
export declare function protocolErrorNameReading(e: object): ProtocolErrorNameReading;
|
|
56
|
+
export declare function protocolErrorNameOf(e: object): ProtocolErrorName | undefined;
|
|
57
|
+
export type ThrownStatusReading = number | undefined | typeof THROWN_SLOT_UNREADABLE;
|
|
58
|
+
export declare function readThrownStatusSlot(o: object): ThrownStatusReading;
|
|
24
59
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
25
60
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
26
61
|
export declare function readErrorString(o: object, key: string): string | undefined;
|
|
@@ -28,10 +63,17 @@ export declare function readErrorStringList(o: object, key: string): readonly st
|
|
|
28
63
|
export declare function readErrorStrictStringList(o: object, key: string): readonly string[] | undefined;
|
|
29
64
|
export declare const WIRE_FAILURE_UNRENDERABLE_TEXT = "the call failed with an error this client could not render";
|
|
30
65
|
export declare function wireFailureShapeOf(e: unknown): WireFailureShape;
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
66
|
+
export interface WireFailureCore {
|
|
67
|
+
readonly status?: number;
|
|
68
|
+
readonly errorCode?: string;
|
|
69
|
+
readonly message: string;
|
|
70
|
+
}
|
|
71
|
+
export declare function wireFailureCoreOf(e: {} | null | undefined): WireFailureCore;
|
|
72
|
+
export interface WireFailureTexts {
|
|
73
|
+
readonly reason: string;
|
|
74
|
+
readonly log: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function wireFailureTextsOf(e: unknown): WireFailureTexts;
|
|
35
77
|
export type BlockedByReading = {
|
|
36
78
|
kind: 'named';
|
|
37
79
|
code: string;
|
|
@@ -42,4 +84,19 @@ export type BlockedByReading = {
|
|
|
42
84
|
};
|
|
43
85
|
export declare function readBlockedBy(o: object): BlockedByReading;
|
|
44
86
|
export declare function readRefusalField(o: object): string | undefined;
|
|
87
|
+
export declare function isDisplayableWireCode(s: string): boolean;
|
|
88
|
+
export declare const ASSEMBLY_REFUSAL_CAUSES: readonly ["ports_missing", "judge_unanswerable", "input_malformed", "agents_projection_failed", "agents_not_ready"];
|
|
89
|
+
export interface AssemblyRefusal {
|
|
90
|
+
readonly code: 'assembly_refused';
|
|
91
|
+
readonly detail: {
|
|
92
|
+
readonly cause: (typeof ASSEMBLY_REFUSAL_CAUSES)[number];
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export declare function assemblyRefusal(cause: AssemblyRefusal['detail']['cause']): AssemblyRefusal;
|
|
96
|
+
export declare function withAssemblyRefusal<E extends Error>(err: E, cause: AssemblyRefusal['detail']['cause']): E;
|
|
97
|
+
export declare function asAssemblyRefusal(thrown: {} | null | undefined, cause: AssemblyRefusal['detail']['cause'], who: string): {};
|
|
98
|
+
export declare function assemblyRefusalOf(x: {} | null | undefined): {
|
|
99
|
+
readonly code: 'assembly_refused';
|
|
100
|
+
readonly cause: AssemblyRefusal['detail']['cause'] | 'unknown';
|
|
101
|
+
} | undefined;
|
|
45
102
|
export {};
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
1
2
|
import { guardedRead, ownDataField, readOwnDataValue } from './ownKey.js';
|
|
2
3
|
export const THROWN_SLOT_UNREADABLE = Symbol('thrown-slot-unreadable');
|
|
3
4
|
export function readThrownSlot(o, key, own = false) {
|
|
@@ -105,6 +106,57 @@ export function readThrownExtra(o) {
|
|
|
105
106
|
}
|
|
106
107
|
return { state: 'object', value: slot };
|
|
107
108
|
}
|
|
109
|
+
export const PROTOCOL_ERROR_NAME = Object.freeze({
|
|
110
|
+
ApprovalBindingMismatchError: 'ApprovalBindingMismatchError',
|
|
111
|
+
ApprovalStaleError: 'ApprovalStaleError',
|
|
112
|
+
AskDecidedError: 'AskDecidedError',
|
|
113
|
+
ConflictError: 'ConflictError',
|
|
114
|
+
NotFoundError: 'NotFoundError',
|
|
115
|
+
ParkedResumeStartupError: 'ParkedResumeStartupError',
|
|
116
|
+
RateLimitedError: 'RateLimitedError',
|
|
117
|
+
SteeringAmbiguousTargetError: 'SteeringAmbiguousTargetError',
|
|
118
|
+
SteeringDuplicateInputIdError: 'SteeringDuplicateInputIdError',
|
|
119
|
+
SteeringError: 'SteeringError',
|
|
120
|
+
SteeringInvalidContentError: 'SteeringInvalidContentError',
|
|
121
|
+
SteeringLedgerUnavailableError: 'SteeringLedgerUnavailableError',
|
|
122
|
+
SteeringNotRunningError: 'SteeringNotRunningError',
|
|
123
|
+
SteeringQueueFullError: 'SteeringQueueFullError',
|
|
124
|
+
SteeringStillRunningError: 'SteeringStillRunningError',
|
|
125
|
+
UsageWindowExhaustedError: 'UsageWindowExhaustedError',
|
|
126
|
+
});
|
|
127
|
+
const PROTOCOL_ERROR_NAMES = new Set(Object.values(PROTOCOL_ERROR_NAME));
|
|
128
|
+
export function isSdkErrorInstance(o) {
|
|
129
|
+
try {
|
|
130
|
+
return extraSlotOf(o).kind === 'sdk-class';
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export function protocolErrorNameReading(e) {
|
|
137
|
+
if (typeof e !== 'object' || e === null)
|
|
138
|
+
return { state: 'absent' };
|
|
139
|
+
try {
|
|
140
|
+
if (isSdkErrorInstance(e))
|
|
141
|
+
return { state: 'sdk-instance' };
|
|
142
|
+
const name = ownDataField(e, 'name');
|
|
143
|
+
return typeof name === 'string' && PROTOCOL_ERROR_NAMES.has(name) ? { state: 'named', name: name } : { state: 'absent' };
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return { state: 'unreadable' };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export function protocolErrorNameOf(e) {
|
|
150
|
+
const r = protocolErrorNameReading(e);
|
|
151
|
+
return r.state === 'named' ? r.name : undefined;
|
|
152
|
+
}
|
|
153
|
+
export function readThrownStatusSlot(o) {
|
|
154
|
+
const st = readThrownSlot(o, 'status', 'data');
|
|
155
|
+
const raw = st !== THROWN_SLOT_UNREADABLE && (st === undefined || st === null) ? readThrownSlot(o, 'statusCode', 'data') : st;
|
|
156
|
+
if (raw === undefined)
|
|
157
|
+
return undefined;
|
|
158
|
+
return typeof raw === 'number' ? raw : THROWN_SLOT_UNREADABLE;
|
|
159
|
+
}
|
|
108
160
|
function readErrorSlot(obj, key, accept) {
|
|
109
161
|
try {
|
|
110
162
|
const topRaw = readThrownSlot(obj, key, 'data');
|
|
@@ -216,9 +268,10 @@ export function wireFailureShapeOf(e) {
|
|
|
216
268
|
}
|
|
217
269
|
};
|
|
218
270
|
const bodyField = ownString('field');
|
|
219
|
-
const bodyName = ownString('name');
|
|
220
271
|
const bodyVerdict = ownString('verdict');
|
|
221
272
|
const bodyCurrentName = ownString('currentName');
|
|
273
|
+
const bodyEntry = ownString('entry');
|
|
274
|
+
const bodyReason = ownString('reason');
|
|
222
275
|
const ownMessage = typeof rawMessage === 'string' && rawMessage !== '' ? rawMessage : undefined;
|
|
223
276
|
const message = userFacingReasonOf(e, ownMessage);
|
|
224
277
|
const sec = typeof retryAfterMs === 'number' && Number.isFinite(retryAfterMs) && retryAfterMs >= 0
|
|
@@ -237,12 +290,21 @@ export function wireFailureShapeOf(e) {
|
|
|
237
290
|
...(sec !== undefined ? { retryAfterSec: sec } : {}),
|
|
238
291
|
...(committed !== undefined ? { committed } : {}),
|
|
239
292
|
...(bodyField !== undefined ? { bodyField } : {}),
|
|
240
|
-
...(bodyName !== undefined ? { bodyName } : {}),
|
|
241
293
|
...(bodyVerdict !== undefined ? { bodyVerdict } : {}),
|
|
242
294
|
...(bodyCurrentName !== undefined ? { bodyCurrentName } : {}),
|
|
295
|
+
...(bodyEntry !== undefined ? { bodyEntry } : {}),
|
|
296
|
+
...(bodyReason !== undefined ? { bodyReason } : {}),
|
|
243
297
|
message,
|
|
244
298
|
};
|
|
245
299
|
}
|
|
300
|
+
export function wireFailureCoreOf(e) {
|
|
301
|
+
const shape = wireFailureShapeOf(e);
|
|
302
|
+
return {
|
|
303
|
+
...(shape.status !== undefined ? { status: shape.status } : {}),
|
|
304
|
+
...(shape.errorCode !== undefined ? { errorCode: shape.errorCode } : {}),
|
|
305
|
+
message: shape.message,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
246
308
|
export function wireFailureTextsOf(e) {
|
|
247
309
|
const { message } = wireFailureShapeOf(e);
|
|
248
310
|
let log;
|
|
@@ -257,14 +319,18 @@ export function wireFailureTextsOf(e) {
|
|
|
257
319
|
export function readBlockedBy(o) {
|
|
258
320
|
const judge = (v) => (typeof v === 'string' && v.length > 0 ? { kind: 'named', code: v } : { kind: 'unreadable' });
|
|
259
321
|
try {
|
|
260
|
-
const top = o
|
|
322
|
+
const top = readThrownSlot(o, 'blockedBy', 'data');
|
|
323
|
+
if (top === THROWN_SLOT_UNREADABLE)
|
|
324
|
+
return { kind: 'unreadable' };
|
|
261
325
|
if (top !== undefined)
|
|
262
326
|
return judge(top);
|
|
263
327
|
const reading = readThrownExtra(o);
|
|
264
328
|
if (reading.state === 'unreadable')
|
|
265
329
|
return { kind: 'unreadable' };
|
|
266
|
-
if (reading.state === 'object'
|
|
267
|
-
|
|
330
|
+
if (reading.state === 'object') {
|
|
331
|
+
const d = Object.getOwnPropertyDescriptor(reading.value, 'blockedBy');
|
|
332
|
+
if (d !== undefined)
|
|
333
|
+
return Object.hasOwn(d, 'value') ? judge(d.value) : { kind: 'unreadable' };
|
|
268
334
|
}
|
|
269
335
|
return { kind: 'absent' };
|
|
270
336
|
}
|
|
@@ -285,3 +351,38 @@ export function readRefusalField(o) {
|
|
|
285
351
|
}
|
|
286
352
|
return str(o);
|
|
287
353
|
}
|
|
354
|
+
const DISPLAYABLE_WIRE_CODE = /^[A-Za-z0-9._:-]{1,64}$/;
|
|
355
|
+
export function isDisplayableWireCode(s) {
|
|
356
|
+
return DISPLAYABLE_WIRE_CODE.test(s);
|
|
357
|
+
}
|
|
358
|
+
export const ASSEMBLY_REFUSAL_CAUSES = Object.freeze([
|
|
359
|
+
'ports_missing',
|
|
360
|
+
'judge_unanswerable',
|
|
361
|
+
'input_malformed',
|
|
362
|
+
'agents_projection_failed',
|
|
363
|
+
'agents_not_ready',
|
|
364
|
+
]);
|
|
365
|
+
const CODE = 'assembly_refused';
|
|
366
|
+
export function assemblyRefusal(cause) {
|
|
367
|
+
return Object.freeze({ code: CODE, detail: Object.freeze({ cause }) });
|
|
368
|
+
}
|
|
369
|
+
export function withAssemblyRefusal(err, cause) {
|
|
370
|
+
Object.defineProperty(err, 'code', { value: CODE, writable: true, enumerable: true, configurable: true });
|
|
371
|
+
Object.defineProperty(err, 'detail', { value: Object.freeze({ cause }), writable: true, enumerable: true, configurable: true });
|
|
372
|
+
return err;
|
|
373
|
+
}
|
|
374
|
+
export function asAssemblyRefusal(thrown, cause, who) {
|
|
375
|
+
if (assemblyRefusalOf(thrown) !== undefined)
|
|
376
|
+
return thrown;
|
|
377
|
+
return withAssemblyRefusal(new Error(renderMessage(msg('config.assembly.thrownDuringAssembly', { who })), { cause: thrown }), cause);
|
|
378
|
+
}
|
|
379
|
+
export function assemblyRefusalOf(x) {
|
|
380
|
+
if (x === null || x === undefined)
|
|
381
|
+
return undefined;
|
|
382
|
+
if (readThrownSlot(x, 'code', 'data') !== CODE)
|
|
383
|
+
return undefined;
|
|
384
|
+
const detail = readThrownSlot(x, 'detail', 'data');
|
|
385
|
+
const cause = typeof detail === 'object' && detail !== null ? readThrownSlot(detail, 'cause', 'data') : undefined;
|
|
386
|
+
const known = ASSEMBLY_REFUSAL_CAUSES.includes(cause) ? cause : 'unknown';
|
|
387
|
+
return Object.freeze({ code: CODE, cause: known });
|
|
388
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
|
|
1
|
+
import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
2
|
import type { TaskRequestLike } from './request/taskRequest.js';
|
|
3
3
|
export declare const CONFLICT_APPROVAL_SETTLED = "conflict.approval_settled";
|
|
4
4
|
export declare const CONFLICT_RUN_NOT_RUNNING = "conflict.run_not_running";
|
|
@@ -77,14 +77,36 @@ export interface HostPostureRefusalDetail {
|
|
|
77
77
|
}
|
|
78
78
|
export declare function hostPostureRefusalFromError(err: unknown, sentRequest?: TaskRequestLike): HostPostureRefusalDetail | null;
|
|
79
79
|
export declare function hostPostureRefusalContent(detail: Pick<HostPostureRefusalDetail, 'askedWholeEnvironment' | 'askedOpenWriteFace'>): string;
|
|
80
|
-
export
|
|
80
|
+
export type HookMatcherRefusal = {
|
|
81
|
+
readonly reason: 'alias_without_canonical';
|
|
81
82
|
readonly event: string;
|
|
82
83
|
readonly alias: string;
|
|
83
84
|
readonly canonical: string;
|
|
84
|
-
}
|
|
85
|
+
} | {
|
|
86
|
+
readonly reason: 'invalid_regex';
|
|
87
|
+
readonly event: string;
|
|
88
|
+
readonly groupIndex: number;
|
|
89
|
+
} | {
|
|
90
|
+
readonly reason: 'over_budget';
|
|
91
|
+
readonly event: string;
|
|
92
|
+
readonly groupIndex: number;
|
|
93
|
+
readonly budgetMs?: number;
|
|
94
|
+
};
|
|
85
95
|
export declare function hookMatcherRefusalFromError(err: unknown): HookMatcherRefusal | undefined;
|
|
86
96
|
export interface AutonomyLaneRefusalDetail {
|
|
87
97
|
readonly code: typeof REQUEST_AUTONOMY_LANE_REFUSED;
|
|
88
98
|
}
|
|
89
99
|
export declare function autonomyLaneRefusalFromError(err: unknown): AutonomyLaneRefusalDetail | null;
|
|
90
100
|
export declare function autonomyLaneRefusalContent(): string;
|
|
101
|
+
export interface UserAttachmentRefusalDetail {
|
|
102
|
+
readonly code: typeof USER_ATTACHMENT_INVALID_ERROR_CODE;
|
|
103
|
+
readonly retryable: false;
|
|
104
|
+
}
|
|
105
|
+
export declare function userAttachmentRefusalFromError(err: {} | null | undefined): UserAttachmentRefusalDetail | null;
|
|
106
|
+
export declare function userAttachmentRefusalContent(): string;
|
|
107
|
+
export interface UserInvokedSkillRefusalDetail {
|
|
108
|
+
readonly code: typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE;
|
|
109
|
+
readonly retryable: false;
|
|
110
|
+
}
|
|
111
|
+
export declare function userInvokedSkillRefusalFromError(err: {} | null | undefined): UserInvokedSkillRefusalDetail | null;
|
|
112
|
+
export declare function userInvokedSkillRefusalContent(): string;
|