@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/displayUntrusted.js
CHANGED
|
@@ -43,6 +43,9 @@ export function looksLikeKnownSecret(s) {
|
|
|
43
43
|
for (let layer = 0; layer < 4; layer++) {
|
|
44
44
|
if (scanForSecretLiteral(cur))
|
|
45
45
|
return true;
|
|
46
|
+
const wide = percentBoundaryDecode(cur);
|
|
47
|
+
if (wide !== null && scanForSecretLiteral(wide.decoded))
|
|
48
|
+
return true;
|
|
46
49
|
const next = percentDecodeForMatching(cur).decoded;
|
|
47
50
|
if (next === cur)
|
|
48
51
|
break;
|
|
@@ -301,7 +304,7 @@ function pathCandidates(src, base, path, opaqueSegments, edits, soft) {
|
|
|
301
304
|
if (opaqueSegments) {
|
|
302
305
|
let a = 0;
|
|
303
306
|
let b = head.length;
|
|
304
|
-
while (a < b && !isKeyWordChar(head.charCodeAt(a)))
|
|
307
|
+
while (a < b && !isKeyWordChar(head.charCodeAt(a)) && !(head.charCodeAt(a) === 0x25 && hasNonAsciiPercentEscape(head.slice(a, a + 3))))
|
|
305
308
|
a++;
|
|
306
309
|
while (b > a && !isKeyWordChar(head.charCodeAt(b - 1)))
|
|
307
310
|
b--;
|
|
@@ -1321,10 +1324,97 @@ function percentDecodeForMatching(text) {
|
|
|
1321
1324
|
return { decoded: chars.join(''), offsets };
|
|
1322
1325
|
}
|
|
1323
1326
|
const PERCENT_ESCAPE_ASCII = /%[0-7][0-9A-Fa-f]/;
|
|
1327
|
+
function hasNonAsciiPercentEscape(text) {
|
|
1328
|
+
return /%[89A-Fa-f][0-9A-Fa-f]/.test(text);
|
|
1329
|
+
}
|
|
1330
|
+
function isWellFormedUtf8(bytes) {
|
|
1331
|
+
for (let i = 0; i < bytes.length;) {
|
|
1332
|
+
const lead = bytes[i] ?? 0;
|
|
1333
|
+
if (lead < 0x80) {
|
|
1334
|
+
i += 1;
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1337
|
+
const need = utf8TailLength(lead);
|
|
1338
|
+
if (need === 0)
|
|
1339
|
+
return false;
|
|
1340
|
+
for (let k = 1; k <= need; k++) {
|
|
1341
|
+
const c = bytes[i + k];
|
|
1342
|
+
const lo = k === 1 ? (lead === 0xe0 ? 0xa0 : lead === 0xf0 ? 0x90 : 0x80) : 0x80;
|
|
1343
|
+
const hi = k === 1 ? (lead === 0xed ? 0x9f : lead === 0xf4 ? 0x8f : 0xbf) : 0xbf;
|
|
1344
|
+
if (c === undefined || c < lo || c > hi)
|
|
1345
|
+
return false;
|
|
1346
|
+
}
|
|
1347
|
+
i += need + 1;
|
|
1348
|
+
}
|
|
1349
|
+
return true;
|
|
1350
|
+
}
|
|
1351
|
+
function utf8TailLength(lead) {
|
|
1352
|
+
if (lead >= 0xc2 && lead <= 0xdf)
|
|
1353
|
+
return 1;
|
|
1354
|
+
if (lead >= 0xe0 && lead <= 0xef)
|
|
1355
|
+
return 2;
|
|
1356
|
+
if (lead >= 0xf0 && lead <= 0xf4)
|
|
1357
|
+
return 3;
|
|
1358
|
+
return 0;
|
|
1359
|
+
}
|
|
1360
|
+
function percentBoundaryDecode(text) {
|
|
1361
|
+
if (!hasNonAsciiPercentEscape(text))
|
|
1362
|
+
return null;
|
|
1363
|
+
const chars = [];
|
|
1364
|
+
const from = [];
|
|
1365
|
+
const to = [];
|
|
1366
|
+
const escapeAt = (k) => text.charCodeAt(k) === 0x25 && isHexDigit(text.charAt(k + 1)) && isHexDigit(text.charAt(k + 2));
|
|
1367
|
+
let i = 0;
|
|
1368
|
+
while (i < text.length) {
|
|
1369
|
+
if (!escapeAt(i)) {
|
|
1370
|
+
chars.push(text.charAt(i));
|
|
1371
|
+
from.push(i);
|
|
1372
|
+
to.push(i + 1);
|
|
1373
|
+
i += 1;
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
const bytes = [];
|
|
1377
|
+
let j = i;
|
|
1378
|
+
while (escapeAt(j)) {
|
|
1379
|
+
bytes.push(Number.parseInt(text.slice(j + 1, j + 3), 16));
|
|
1380
|
+
j += 3;
|
|
1381
|
+
}
|
|
1382
|
+
if (isWellFormedUtf8(bytes)) {
|
|
1383
|
+
for (let k = 0; k < bytes.length;) {
|
|
1384
|
+
const lead = bytes[k] ?? 0;
|
|
1385
|
+
const len = lead < 0x80 ? 1 : utf8TailLength(lead) + 1;
|
|
1386
|
+
let cp = len === 1 ? lead : lead & (0xff >> (len + 1));
|
|
1387
|
+
for (let t = 1; t < len; t++)
|
|
1388
|
+
cp = (cp << 6) | ((bytes[k + t] ?? 0) & 0x3f);
|
|
1389
|
+
const ch = String.fromCodePoint(cp);
|
|
1390
|
+
for (let u = 0; u < ch.length; u++) {
|
|
1391
|
+
chars.push(ch.charAt(u));
|
|
1392
|
+
from.push(i + k * 3);
|
|
1393
|
+
to.push(i + (k + len) * 3);
|
|
1394
|
+
}
|
|
1395
|
+
k += len;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
for (let k = 0; k < bytes.length; k++) {
|
|
1400
|
+
const b = bytes[k] ?? 0;
|
|
1401
|
+
chars.push(b < 0x80 ? String.fromCharCode(b) : ' ');
|
|
1402
|
+
from.push(i + k * 3);
|
|
1403
|
+
to.push(i + k * 3 + 3);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
i = j;
|
|
1407
|
+
}
|
|
1408
|
+
return { decoded: chars.join(''), from, to };
|
|
1409
|
+
}
|
|
1410
|
+
export function percentBoundaryReadingOf(text) {
|
|
1411
|
+
const wide = percentBoundaryDecode(text);
|
|
1412
|
+
return wide === null ? text : wide.decoded;
|
|
1413
|
+
}
|
|
1324
1414
|
const MAX_PERCENT_VIEW_LAYERS = 3;
|
|
1325
1415
|
function percentLayers(text) {
|
|
1326
1416
|
const out = [];
|
|
1327
|
-
if (!PERCENT_ESCAPE_ASCII.test(text))
|
|
1417
|
+
if (!PERCENT_ESCAPE_ASCII.test(text) && !hasNonAsciiPercentEscape(text))
|
|
1328
1418
|
return out;
|
|
1329
1419
|
let cur = text;
|
|
1330
1420
|
let ps = null;
|
|
@@ -1347,6 +1437,22 @@ function percentLayers(text) {
|
|
|
1347
1437
|
ps = nps;
|
|
1348
1438
|
pe = npe;
|
|
1349
1439
|
}
|
|
1440
|
+
const bases = [[text, null, null], ...out.map((l) => [l.text, l.ps, l.pe])];
|
|
1441
|
+
for (const [base, bps, bpe] of bases) {
|
|
1442
|
+
const wide = percentBoundaryDecode(base);
|
|
1443
|
+
if (wide === null)
|
|
1444
|
+
continue;
|
|
1445
|
+
const n = wide.decoded.length;
|
|
1446
|
+
const nps = new Int32Array(n);
|
|
1447
|
+
const npe = new Int32Array(n);
|
|
1448
|
+
for (let k = 0; k < n; k++) {
|
|
1449
|
+
const a = wide.from[k] ?? 0;
|
|
1450
|
+
const b = wide.to[k] ?? base.length;
|
|
1451
|
+
nps[k] = bps === null ? a : (bps[a] ?? 0);
|
|
1452
|
+
npe[k] = bpe === null ? b : (bpe[b - 1] ?? 0);
|
|
1453
|
+
}
|
|
1454
|
+
out.push({ text: wide.decoded, ps: nps, pe: npe });
|
|
1455
|
+
}
|
|
1350
1456
|
return out;
|
|
1351
1457
|
}
|
|
1352
1458
|
function firstLabelCutInPath(path, outer = false) {
|
|
@@ -3312,7 +3418,7 @@ function proseLiteralEdits(text) {
|
|
|
3312
3418
|
let end = i;
|
|
3313
3419
|
while (end < text.length && isKeyWordChar(text.charCodeAt(end)))
|
|
3314
3420
|
end++;
|
|
3315
|
-
const escHead = i > 0 && text.charCodeAt(i - 1) === 0x25 && PERCENT_ESCAPE_ASCII.test(text.slice(i - 1, i + 2)) && i + 2 < end ? 2 : 0;
|
|
3421
|
+
const escHead = i > 0 && text.charCodeAt(i - 1) === 0x25 && (PERCENT_ESCAPE_ASCII.test(text.slice(i - 1, i + 2)) || hasNonAsciiPercentEscape(text.slice(i - 1, i + 2))) && i + 2 < end ? 2 : 0;
|
|
3316
3422
|
const word = text.slice(i, end);
|
|
3317
3423
|
if (word.startsWith('eyJ')) {
|
|
3318
3424
|
let segEnd = end;
|
|
@@ -3809,11 +3915,12 @@ function screenSurfaces(text, o) {
|
|
|
3809
3915
|
function percentSurfaces(raw, text, base, o) {
|
|
3810
3916
|
const surfaces = [];
|
|
3811
3917
|
const contents = [];
|
|
3918
|
+
const locals = [];
|
|
3812
3919
|
for (const layer of percentLayers(text))
|
|
3813
|
-
layerSurfaces(raw, layer, base, o, surfaces, contents);
|
|
3814
|
-
return { surfaces, contents };
|
|
3920
|
+
layerSurfaces(raw, layer, base, o, surfaces, contents, true, base === null ? locals : undefined);
|
|
3921
|
+
return { surfaces, contents, locals };
|
|
3815
3922
|
}
|
|
3816
|
-
function layerSurfaces(raw, layer, base, o, surfaces, contents, decoded = true) {
|
|
3923
|
+
function layerSurfaces(raw, layer, base, o, surfaces, contents, decoded = true, locals) {
|
|
3817
3924
|
const n = layer.text.length;
|
|
3818
3925
|
const ps = new Int32Array(n);
|
|
3819
3926
|
const pe = new Int32Array(n);
|
|
@@ -3835,6 +3942,52 @@ function layerSurfaces(raw, layer, base, o, surfaces, contents, decoded = true)
|
|
|
3835
3942
|
surfaces.push(base === null ? { ...joined, rawDot: null, decoded } : { ...joined, decoded });
|
|
3836
3943
|
for (const [a, b] of VD.contents)
|
|
3837
3944
|
contents.push({ sub: layer.text.slice(a, b), rawAt: (k) => ps[a + k] ?? 0, rawEndAt: (k) => pe[a + k] ?? 0 });
|
|
3945
|
+
if (locals !== undefined && decoded && base === null && hasLineBreakAny(layer.text)) {
|
|
3946
|
+
locals.push({ text: layer.text, view: VD, ps, pe });
|
|
3947
|
+
if (layer.text.includes('+')) {
|
|
3948
|
+
const spaced = layer.text.split('+').join(' ');
|
|
3949
|
+
locals.push({ text: spaced, view: buildScanView(spaced, o), ps, pe });
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
function hasLineBreakAny(text) {
|
|
3954
|
+
for (let i = 0; i < text.length; i++) {
|
|
3955
|
+
const c = text.charCodeAt(i);
|
|
3956
|
+
if ((c === 0x0a || c === 0x0d || c === 0x5c) && lineBreakLengthAt(text, i) > 0)
|
|
3957
|
+
return true;
|
|
3958
|
+
}
|
|
3959
|
+
return false;
|
|
3960
|
+
}
|
|
3961
|
+
function decodedLayerLocalCandidates(L, o, out) {
|
|
3962
|
+
const layerSep = { ...separatedSurface(L.text, L.view), rawDot: null, decoded: true };
|
|
3963
|
+
const layerJoined = joinedSurface(L.text, L.view);
|
|
3964
|
+
const surfaces = layerJoined === null ? [layerSep] : [layerSep, { ...layerJoined, rawDot: null, decoded: true }];
|
|
3965
|
+
const blocks = { raw: L.text, view: L.view, out: [], lines: [null, null], marks: null };
|
|
3966
|
+
const found = [];
|
|
3967
|
+
for (const S of surfaces) {
|
|
3968
|
+
const cands = [];
|
|
3969
|
+
const regions = [];
|
|
3970
|
+
if (o.urls) {
|
|
3971
|
+
const unitPos = (k) => S.dropped(k) || L.view.rawUnit[S.rawStart(k)] === 1;
|
|
3972
|
+
urlCandidates(S.text, [], regions, unitPos, (k) => unitPos(k) || S.painted(k), o.queryByShape ?? false, o.wholeAddress === true, false);
|
|
3973
|
+
}
|
|
3974
|
+
runLabelPasses(S, regions, cands, blocks);
|
|
3975
|
+
for (const c of cands) {
|
|
3976
|
+
const r = toRaw(S, c);
|
|
3977
|
+
if (r !== null)
|
|
3978
|
+
found.push(r);
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
for (const r of blocks.out)
|
|
3982
|
+
found.push(r);
|
|
3983
|
+
for (const r of found) {
|
|
3984
|
+
const start = L.ps[r.start];
|
|
3985
|
+
const end = L.pe[r.end - 1];
|
|
3986
|
+
if (start === undefined || end === undefined || end <= start)
|
|
3987
|
+
continue;
|
|
3988
|
+
const tokenEnd = r.tokenEnd > r.start ? (L.pe[Math.min(r.tokenEnd, L.text.length) - 1] ?? end) : end;
|
|
3989
|
+
out.push({ ...r, start, end, tokenEnd });
|
|
3990
|
+
}
|
|
3838
3991
|
}
|
|
3839
3992
|
function parserViewLayer(text) {
|
|
3840
3993
|
if (!/[\t\n\r]/.test(text))
|
|
@@ -4107,6 +4260,13 @@ function toRaw(S, c) {
|
|
|
4107
4260
|
const te = c.te > b ? S.rawEnd(c.te - 1) : S.rawEnd(b - 1);
|
|
4108
4261
|
return { start: S.rawStart(a), end: S.rawEnd(b - 1), kind: c.kind, cls: c.cls, tokenEnd: te };
|
|
4109
4262
|
}
|
|
4263
|
+
function runLabelPasses(S, regions, cands, blocks) {
|
|
4264
|
+
labelCandidates(S, 'scheme', regions, cands, blocks);
|
|
4265
|
+
labelCandidates(S, 'token', regions, cands, blocks);
|
|
4266
|
+
labelCandidates(S, 'label', regions, cands, blocks);
|
|
4267
|
+
labelCandidates(S, 'scheme', regions, cands, blocks, true);
|
|
4268
|
+
labelCandidates(S, 'label', regions, cands, blocks, true);
|
|
4269
|
+
}
|
|
4110
4270
|
function collectCandidates(text, o, nested) {
|
|
4111
4271
|
const V = buildScanView(text, o);
|
|
4112
4272
|
const separated = separatedSurface(text, V);
|
|
@@ -4134,19 +4294,23 @@ function collectCandidates(text, o, nested) {
|
|
|
4134
4294
|
for (const S of surfaces) {
|
|
4135
4295
|
const cands = [];
|
|
4136
4296
|
const regions = [];
|
|
4297
|
+
const unitPos = (k) => S.dropped(k) || V.rawUnit[S.rawStart(k)] === 1;
|
|
4137
4298
|
if (o.urls) {
|
|
4138
|
-
const unitPos = (k) => S.dropped(k) || V.rawUnit[S.rawStart(k)] === 1;
|
|
4139
4299
|
urlCandidates(S.text, cands, regions, unitPos, (k) => unitPos(k) || S.painted(k), o.queryByShape ?? false, o.wholeAddress === true, o.wholeAddress === true && S.decoded !== true);
|
|
4140
4300
|
userinfoCandidates(S, cands, o.words);
|
|
4141
4301
|
}
|
|
4302
|
+
else if (o.words && o.wholeAddress === true) {
|
|
4303
|
+
const scratch = [];
|
|
4304
|
+
const hostOnly = [];
|
|
4305
|
+
urlCandidates(S.text, scratch, hostOnly, unitPos, (k) => unitPos(k) || S.painted(k), false, true, S.decoded !== true);
|
|
4306
|
+
for (const r of hostOnly)
|
|
4307
|
+
if (r[2] === 'host')
|
|
4308
|
+
regions.push(r);
|
|
4309
|
+
}
|
|
4142
4310
|
if (o.words) {
|
|
4143
4311
|
editsToCandidates(pemEdits(S, (blk) => { if (S === regionSurface)
|
|
4144
4312
|
pemBlocksSeen.push(pemBlockToRaw(S, blk)); }), 'pem', cands);
|
|
4145
|
-
|
|
4146
|
-
labelCandidates(S, 'token', regions, cands, blocks);
|
|
4147
|
-
labelCandidates(S, 'label', regions, cands, blocks);
|
|
4148
|
-
labelCandidates(S, 'scheme', regions, cands, blocks, true);
|
|
4149
|
-
labelCandidates(S, 'label', regions, cands, blocks, true);
|
|
4313
|
+
runLabelPasses(S, regions, cands, blocks);
|
|
4150
4314
|
editsToCandidates(authParamEdits(S.text), 'param', cands);
|
|
4151
4315
|
editsToCandidates(proseLiteralEdits(S.text), 'prose', cands);
|
|
4152
4316
|
}
|
|
@@ -4156,6 +4320,9 @@ function collectCandidates(text, o, nested) {
|
|
|
4156
4320
|
raw.push(S.rawDot !== null ? { ...r, dotted: true } : r);
|
|
4157
4321
|
}
|
|
4158
4322
|
}
|
|
4323
|
+
if (o.words)
|
|
4324
|
+
for (const L of decoded.locals)
|
|
4325
|
+
decodedLayerLocalCandidates(L, o, raw);
|
|
4159
4326
|
if (!nested) {
|
|
4160
4327
|
for (const [a, b] of V.contents) {
|
|
4161
4328
|
const sub = text.slice(a, b);
|
|
@@ -4778,7 +4945,42 @@ function isHighEntropyQueryValue(value) {
|
|
|
4778
4945
|
}
|
|
4779
4946
|
function isOpaqueSecretValue(value) {
|
|
4780
4947
|
const core = valueCoreForJudging(value);
|
|
4781
|
-
|
|
4948
|
+
if (core.length === 0)
|
|
4949
|
+
return false;
|
|
4950
|
+
if (looksLikeKnownSecret(core) || isHighEntropyQueryValue(core))
|
|
4951
|
+
return true;
|
|
4952
|
+
if (hasNonAsciiPercentEscape(core)) {
|
|
4953
|
+
for (const chunk of percentByteChunks(core))
|
|
4954
|
+
if (chunk.length > 0 && isHighEntropyQueryValue(chunk))
|
|
4955
|
+
return true;
|
|
4956
|
+
}
|
|
4957
|
+
return false;
|
|
4958
|
+
}
|
|
4959
|
+
function percentByteChunks(text) {
|
|
4960
|
+
const escapeAt = (k) => text.charCodeAt(k) === 0x25 && isHexDigit(text.charAt(k + 1)) && isHexDigit(text.charAt(k + 2));
|
|
4961
|
+
const chunks = [];
|
|
4962
|
+
let start = 0;
|
|
4963
|
+
let i = 0;
|
|
4964
|
+
while (i < text.length) {
|
|
4965
|
+
if (!escapeAt(i)) {
|
|
4966
|
+
i += 1;
|
|
4967
|
+
continue;
|
|
4968
|
+
}
|
|
4969
|
+
let j = i;
|
|
4970
|
+
let wide = false;
|
|
4971
|
+
while (escapeAt(j)) {
|
|
4972
|
+
if (text.charCodeAt(j + 1) >= 0x38)
|
|
4973
|
+
wide = true;
|
|
4974
|
+
j += 3;
|
|
4975
|
+
}
|
|
4976
|
+
if (wide) {
|
|
4977
|
+
chunks.push(text.slice(start, i));
|
|
4978
|
+
start = j;
|
|
4979
|
+
}
|
|
4980
|
+
i = j;
|
|
4981
|
+
}
|
|
4982
|
+
chunks.push(text.slice(start));
|
|
4983
|
+
return chunks;
|
|
4782
4984
|
}
|
|
4783
4985
|
const VALUE_PIECE_SEPARATORS = new Set(['/', '\\', '?', '#', '&', '=', ';', ':', '@', ',', '+']);
|
|
4784
4986
|
function hasOpaquePiece(text) {
|
|
@@ -2,6 +2,10 @@ import { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, MAX_HELD_WIRE_T
|
|
|
2
2
|
import type { EngineAgentPanelCycleIdentity } from './cycleOrder.js';
|
|
3
3
|
export { isNewEngineAgentPanelCycle, isStaleEngineAgentPanelEnd, MAX_HELD_WIRE_TICK_BEATS };
|
|
4
4
|
export type { EngineAgentPanelCycleIdentity, EnginePanelTaskIdentity };
|
|
5
|
+
type PanelFinalityFlags = {
|
|
6
|
+
totalTokens?: true;
|
|
7
|
+
toolUses?: true;
|
|
8
|
+
};
|
|
5
9
|
export type EngineAgentPanelEvent = {
|
|
6
10
|
kind: 'tick';
|
|
7
11
|
taskId: string;
|
|
@@ -16,6 +20,8 @@ export type EngineAgentPanelEvent = {
|
|
|
16
20
|
cardBound?: true;
|
|
17
21
|
wireTaskId?: string;
|
|
18
22
|
taskIdOrigin?: 'fleet-row' | 'wire';
|
|
23
|
+
cycleSeq?: number;
|
|
24
|
+
final?: PanelFinalityFlags;
|
|
19
25
|
} | {
|
|
20
26
|
kind: 'fleet-row';
|
|
21
27
|
taskId: string;
|
|
@@ -33,10 +39,7 @@ export type EngineAgentPanelEvent = {
|
|
|
33
39
|
parentToolCallId?: string;
|
|
34
40
|
wireTaskId?: string;
|
|
35
41
|
taskIdOrigin?: 'wire';
|
|
36
|
-
final?:
|
|
37
|
-
totalTokens?: true;
|
|
38
|
-
toolUses?: true;
|
|
39
|
-
};
|
|
42
|
+
final?: PanelFinalityFlags;
|
|
40
43
|
} | {
|
|
41
44
|
kind: 'end';
|
|
42
45
|
taskId: string;
|
package/dist/engineCapReader.js
CHANGED
|
@@ -11,7 +11,7 @@ function freezeReading(reading, seen = new Set()) {
|
|
|
11
11
|
seen.add(reading);
|
|
12
12
|
Object.freeze(reading);
|
|
13
13
|
for (const d of Object.values(Object.getOwnPropertyDescriptors(reading))) {
|
|
14
|
-
if ('value'
|
|
14
|
+
if (Object.hasOwn(d, 'value'))
|
|
15
15
|
freezeReading(d.value, seen);
|
|
16
16
|
}
|
|
17
17
|
return reading;
|
|
@@ -3,7 +3,7 @@ function countOf(v) {
|
|
|
3
3
|
}
|
|
4
4
|
function ownValue(o, key) {
|
|
5
5
|
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
6
|
-
return d !== undefined && 'value'
|
|
6
|
+
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
7
7
|
}
|
|
8
8
|
export function readEngineConfigApplyState(health) {
|
|
9
9
|
try {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { SDK_STATUS_DERIVED_COARSE_CODES } from './generated/sdkFactTables.js';
|
|
1
2
|
import type { RunDeathVerdictCode } from '@sema-agent/sdk';
|
|
3
|
+
import type { SDKResultError } from '@sema-agent/agent-types';
|
|
2
4
|
export declare const LIMITS_MAX_TOKENS_EXCEEDED = "limits.max_tokens_exceeded";
|
|
3
5
|
export declare const LIMITS_MAX_COST_EXCEEDED = "limits.max_cost_exceeded";
|
|
4
6
|
export declare const LIMITS_MAX_TURNS_EXCEEDED = "limits.max_turns_exceeded";
|
|
@@ -8,16 +10,16 @@ export declare const USAGE_WINDOW_EXHAUSTED = "usage.window_exhausted";
|
|
|
8
10
|
export declare const ENV_LIFETIME_EXPIRED = "env.lifetime_expired";
|
|
9
11
|
export declare const FLEET_LEASE_UNAVAILABLE = "fleet.lease_unavailable";
|
|
10
12
|
export declare const CONFIG_LIMIT_INVALID = "config.limit_invalid";
|
|
11
|
-
export declare const CONFIG_STRATEGY_FIND_LIMIT_INVALID = "config.strategy_find_limit_invalid";
|
|
12
|
-
export declare const CONFIG_STRATEGY_MAX_SIZE_INVALID = "config.strategy_max_size_invalid";
|
|
13
13
|
export declare const CONFIG_LIMIT_UNKNOWN_KEY = "config.limit_unknown_key";
|
|
14
14
|
export declare const CONFIG_DELEGATION_ENTRY_CAPS = "config.delegation_entry_caps";
|
|
15
15
|
export declare const CONFIG_MEMORY_PROJECT_KEY_SPELLING = "config.memory_project_key_spelling";
|
|
16
16
|
export declare const CONFIG_MEMORY_WRITE_SCOPE_MISMATCH = "config.memory_write_scope_mismatch";
|
|
17
17
|
export declare const CONFIG_LEGACY_TOOL_NAME = "config.legacy_tool_name";
|
|
18
18
|
export declare const CONFIG_IMAGE_INVALID = "config.image_invalid";
|
|
19
|
-
export declare function imageInvalidFailureNoteOf(code: string | undefined): string | undefined;
|
|
20
19
|
export declare const CONFIG_AGENT_UNKNOWN_TOOL = "config.agent.unknown_tool";
|
|
20
|
+
export declare const CONFIG_TOOL_FACE_CONTROL = "config.tool_face_control";
|
|
21
|
+
export declare const CONFIG_MCP_SERVER_NAME_COLLISION = "config.mcp_server_name_collision";
|
|
22
|
+
export declare const PROMPT_ASSEMBLED_ROLE_REFUSED = "prompt.assembled_role_refused";
|
|
21
23
|
export declare const CONFIG_OUTPUT_STYLE_INVALID = "config.output_style_invalid";
|
|
22
24
|
export declare const RULES_INERT_ENTRY = "rules.inert_entry";
|
|
23
25
|
export declare const RULES_INVALID_SHAPE = "rules.invalid_shape";
|
|
@@ -29,12 +31,17 @@ export declare function isDelegationCapCode(code: string | undefined): boolean;
|
|
|
29
31
|
export type DelegationCapDisposition = 'wait-for-slot' | 'reuse-existing-or-await-reap';
|
|
30
32
|
export declare function delegationCapDispositionOf(code: string | undefined): DelegationCapDisposition | undefined;
|
|
31
33
|
export declare const MCP_SERVER_REVOKED = "mcp.server_revoked";
|
|
34
|
+
export declare const MCP_TOOL_DECLARATION_CHANGED = "mcp.tool_declaration_changed";
|
|
35
|
+
export declare const MCP_TOOL_LISTING_UNREACHED = "mcp.tool_listing_unreached";
|
|
32
36
|
export declare function isConfigRefusalCode(code: string | undefined): boolean;
|
|
33
37
|
export declare const TOOL_END_INTERRUPTED_NEVER_STARTED = "interrupted_never_started";
|
|
34
38
|
export declare const TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN = "interrupted_outcome_unknown";
|
|
35
39
|
export declare function isInterruptedToolEndCode(code: string | undefined): boolean;
|
|
36
40
|
export declare const CAPABILITY_SELF_ORCHESTRATION_REQUIRED = "capability.self_orchestration_required";
|
|
37
41
|
export declare const CAPABILITY_IMAGE_INDEX_REQUIRED = "capability.image_index_required";
|
|
42
|
+
export declare const CAPABILITY_K8S_LANE_REQUIRED = "capability.k8s_lane_required";
|
|
43
|
+
export declare const NOT_FOUND_IMAGE = "not_found.image";
|
|
44
|
+
export declare const REQUEST_PRECONDITION_UNMET = "request.precondition_unmet";
|
|
38
45
|
export declare const GATE_PARKED_ERROR_CODE = "gate.parked";
|
|
39
46
|
export declare const ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
|
|
40
47
|
export declare const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = "conflict.idempotency_payload_mismatch";
|
|
@@ -59,8 +66,13 @@ export declare const STOP_NOT_LANDED = "stop.not_landed";
|
|
|
59
66
|
export declare const STOP_NOT_LOCAL = "stop.not_local";
|
|
60
67
|
export declare const STOP_PARKED = "stop.parked";
|
|
61
68
|
export declare const OUTPUT_INVALID = "output.invalid";
|
|
69
|
+
export type ResultLimitWord = 'wall_clock' | 'tokens' | 'turns' | 'budget_usd' | 'structured_output_retries';
|
|
70
|
+
export declare const RESULT_LIMIT_WORDS: readonly ResultLimitWord[];
|
|
71
|
+
export declare function resultLimitRowOfCode(code: string | undefined): {
|
|
72
|
+
readonly word: ResultLimitWord;
|
|
73
|
+
readonly subtype: SDKResultError['subtype'];
|
|
74
|
+
} | undefined;
|
|
62
75
|
export declare const RESUME_POLICY_FOLD_CODE = "resume_blocked_by_policy";
|
|
63
|
-
export declare const STATUS_DERIVED_COARSE_CODES: readonly ["request.rejected", "auth.unauthorized", "auth.forbidden", "not_found.resource", "request.payload_too_large", "request.unprocessable", "limit.rate_exceeded", "capability.unavailable", "internal.error"];
|
|
64
76
|
export declare function isStatusDerivedCoarseCode(code: string | null | undefined): boolean;
|
|
65
77
|
export declare const RESUME_AT_ERROR_CODE_PREFIX = "resume_at.";
|
|
66
78
|
export declare const REWIND_ERROR_CODE_PREFIXES: readonly ["resume_at.", "rewind_snapshot."];
|
|
@@ -77,7 +89,7 @@ export declare const CHECKPOINT_REFUSED_PARK_CODES: readonly string[];
|
|
|
77
89
|
export declare function isRefusedParkCode(code: string | null | undefined): code is typeof CHECKPOINT_UNSUPPORTED_VERSION | typeof CHECKPOINT_WALLTIME_AXIS_RETIRED | typeof CHECKPOINT_CONFIG_REFUSED;
|
|
78
90
|
export declare function refusalSaysStillPending(err: object): boolean;
|
|
79
91
|
export declare function refusalRetriableReading(err: object): boolean | undefined;
|
|
80
|
-
export type StatusDerivedCoarseCode = (typeof
|
|
92
|
+
export type StatusDerivedCoarseCode = (typeof SDK_STATUS_DERIVED_COARSE_CODES)[number];
|
|
81
93
|
export declare const RESUME_PLACEMENT_MISMATCH = "resume.placement_mismatch";
|
|
82
94
|
export declare const RESUME_CONTEXT_UNAVAILABLE = "conflict.resume_context_unavailable";
|
|
83
95
|
export declare const RESUME_RETRY_LATER_CODES: readonly string[];
|
|
@@ -98,6 +110,8 @@ export declare const CONFLICT_NOT_RESUMABLE = "conflict.not_resumable";
|
|
|
98
110
|
export declare const GATE_NOT_TOOL_APPROVAL = "gate_not_tool_approval";
|
|
99
111
|
export declare const DECIDE_PARK_MOVED_CODES: readonly string[];
|
|
100
112
|
export declare function isDecideParkMovedCode(code: string | null | undefined): boolean;
|
|
113
|
+
export declare const DECIDE_ROW_UNREVIVABLE = "decide.row_unrevivable";
|
|
114
|
+
export declare function isDecideRowUnrevivableCode(code: string | null | undefined): boolean;
|
|
101
115
|
export declare const APPROVAL_STALE = "approval_stale";
|
|
102
116
|
export declare const APPROVAL_BINDING_MISMATCH = "approval_binding_mismatch";
|
|
103
117
|
export declare const CHECKPOINT_INVALID_OUTCOME = "checkpoint.invalid_outcome";
|
|
@@ -110,8 +124,11 @@ export declare const DECIDE_ALREADY_RESOLVED_CODES: readonly string[];
|
|
|
110
124
|
export declare function isDecideAlreadyResolvedCode(code: string | null | undefined): boolean;
|
|
111
125
|
export declare const ASK_GONE = "gone.ask";
|
|
112
126
|
export declare const ASK_GONE_PARKED = "gone.ask_parked";
|
|
127
|
+
export declare const ASK_NOT_FOUND = "not_found.ask";
|
|
128
|
+
export declare const ASK_IDEMPOTENCY_CONFLICT = "conflict.ask_idempotency";
|
|
129
|
+
export declare const ASK_PARKING_RETRY = "parking.ask_retry";
|
|
130
|
+
export declare const ASK_DECISION_LANE_DISABLED = "feature.approval_ask_disabled";
|
|
113
131
|
export declare const ASK_GONE_DENIED_WORD: "routing_failure_fail_closed";
|
|
114
|
-
export declare const RUN_DEATH_VERDICT_CODES: readonly ["run.stalled", "run.orphaned", "approval.expired"];
|
|
115
132
|
export type { RunDeathVerdictCode };
|
|
116
133
|
export declare const RUN_STALLED: "run.stalled";
|
|
117
134
|
export declare const RUN_ORPHANED: "run.orphaned";
|
package/dist/engineErrorCodes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { frozenSet } from './frozenSet.js';
|
|
2
2
|
import { ownDataField } from './ownKey.js';
|
|
3
|
-
import { SDK_DENY_REASON_ROUTING_FAILURE,
|
|
3
|
+
import { SDK_DENY_REASON_ROUTING_FAILURE, SDK_STATUS_DERIVED_COARSE_CODES } from './generated/sdkFactTables.js';
|
|
4
4
|
export const LIMITS_MAX_TOKENS_EXCEEDED = 'limits.max_tokens_exceeded';
|
|
5
5
|
export const LIMITS_MAX_COST_EXCEEDED = 'limits.max_cost_exceeded';
|
|
6
6
|
export const LIMITS_MAX_TURNS_EXCEEDED = 'limits.max_turns_exceeded';
|
|
@@ -13,20 +13,16 @@ export const USAGE_WINDOW_EXHAUSTED = 'usage.window_exhausted';
|
|
|
13
13
|
export const ENV_LIFETIME_EXPIRED = 'env.lifetime_expired';
|
|
14
14
|
export const FLEET_LEASE_UNAVAILABLE = 'fleet.lease_unavailable';
|
|
15
15
|
export const CONFIG_LIMIT_INVALID = 'config.limit_invalid';
|
|
16
|
-
export const CONFIG_STRATEGY_FIND_LIMIT_INVALID = 'config.strategy_find_limit_invalid';
|
|
17
|
-
export const CONFIG_STRATEGY_MAX_SIZE_INVALID = 'config.strategy_max_size_invalid';
|
|
18
16
|
export const CONFIG_LIMIT_UNKNOWN_KEY = 'config.limit_unknown_key';
|
|
19
17
|
export const CONFIG_DELEGATION_ENTRY_CAPS = 'config.delegation_entry_caps';
|
|
20
18
|
export const CONFIG_MEMORY_PROJECT_KEY_SPELLING = 'config.memory_project_key_spelling';
|
|
21
19
|
export const CONFIG_MEMORY_WRITE_SCOPE_MISMATCH = 'config.memory_write_scope_mismatch';
|
|
22
20
|
export const CONFIG_LEGACY_TOOL_NAME = 'config.legacy_tool_name';
|
|
23
21
|
export const CONFIG_IMAGE_INVALID = 'config.image_invalid';
|
|
24
|
-
const IMAGE_INVALID_FAILURE_NOTE = 'This run did not start: an image sent with the message was refused before the model was called — the engine’s own error text says which image and what is wrong with it. ' +
|
|
25
|
-
'Nothing was sent to the model; remove or replace that image, then send the message again.';
|
|
26
|
-
export function imageInvalidFailureNoteOf(code) {
|
|
27
|
-
return code === CONFIG_IMAGE_INVALID ? IMAGE_INVALID_FAILURE_NOTE : undefined;
|
|
28
|
-
}
|
|
29
22
|
export const CONFIG_AGENT_UNKNOWN_TOOL = 'config.agent.unknown_tool';
|
|
23
|
+
export const CONFIG_TOOL_FACE_CONTROL = 'config.tool_face_control';
|
|
24
|
+
export const CONFIG_MCP_SERVER_NAME_COLLISION = 'config.mcp_server_name_collision';
|
|
25
|
+
export const PROMPT_ASSEMBLED_ROLE_REFUSED = 'prompt.assembled_role_refused';
|
|
30
26
|
export const CONFIG_OUTPUT_STYLE_INVALID = 'config.output_style_invalid';
|
|
31
27
|
export const RULES_INERT_ENTRY = 'rules.inert_entry';
|
|
32
28
|
export const RULES_INVALID_SHAPE = 'rules.invalid_shape';
|
|
@@ -51,6 +47,8 @@ export function delegationCapDispositionOf(code) {
|
|
|
51
47
|
return undefined;
|
|
52
48
|
}
|
|
53
49
|
export const MCP_SERVER_REVOKED = 'mcp.server_revoked';
|
|
50
|
+
export const MCP_TOOL_DECLARATION_CHANGED = 'mcp.tool_declaration_changed';
|
|
51
|
+
export const MCP_TOOL_LISTING_UNREACHED = 'mcp.tool_listing_unreached';
|
|
54
52
|
export function isConfigRefusalCode(code) {
|
|
55
53
|
return typeof code === 'string' && code.startsWith('config.');
|
|
56
54
|
}
|
|
@@ -65,6 +63,9 @@ export function isInterruptedToolEndCode(code) {
|
|
|
65
63
|
}
|
|
66
64
|
export const CAPABILITY_SELF_ORCHESTRATION_REQUIRED = 'capability.self_orchestration_required';
|
|
67
65
|
export const CAPABILITY_IMAGE_INDEX_REQUIRED = 'capability.image_index_required';
|
|
66
|
+
export const CAPABILITY_K8S_LANE_REQUIRED = 'capability.k8s_lane_required';
|
|
67
|
+
export const NOT_FOUND_IMAGE = 'not_found.image';
|
|
68
|
+
export const REQUEST_PRECONDITION_UNMET = 'request.precondition_unmet';
|
|
68
69
|
export const GATE_PARKED_ERROR_CODE = 'gate.parked';
|
|
69
70
|
export const ACTIVE_RUN_BUSY_ERROR_CODE = 'conflict.session_active_run';
|
|
70
71
|
export const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = 'conflict.idempotency_payload_mismatch';
|
|
@@ -112,10 +113,27 @@ export const STOP_NOT_LANDED = 'stop.not_landed';
|
|
|
112
113
|
export const STOP_NOT_LOCAL = 'stop.not_local';
|
|
113
114
|
export const STOP_PARKED = 'stop.parked';
|
|
114
115
|
export const OUTPUT_INVALID = 'output.invalid';
|
|
116
|
+
const RESULT_LIMIT_TABLE = Object.freeze([
|
|
117
|
+
Object.freeze({ code: LIMITS_MAX_TURNS_EXCEEDED, word: 'turns', subtype: 'error_max_turns' }),
|
|
118
|
+
Object.freeze({ code: LIMITS_MAX_COST_EXCEEDED, word: 'budget_usd', subtype: 'error_max_budget_usd' }),
|
|
119
|
+
Object.freeze({ code: OUTPUT_INVALID, word: 'structured_output_retries', subtype: 'error_max_structured_output_retries' }),
|
|
120
|
+
Object.freeze({ code: LIMITS_MAX_WALLTIME_EXCEEDED, word: 'wall_clock', subtype: 'error_during_execution' }),
|
|
121
|
+
Object.freeze({ code: LIMITS_MAX_TOKENS_EXCEEDED, word: 'tokens', subtype: 'error_during_execution' }),
|
|
122
|
+
]);
|
|
123
|
+
export const RESULT_LIMIT_WORDS = Object.freeze(RESULT_LIMIT_TABLE.map((r) => r.word));
|
|
124
|
+
const _limitWordPins = [true, true];
|
|
125
|
+
void _limitWordPins;
|
|
126
|
+
export function resultLimitRowOfCode(code) {
|
|
127
|
+
if (typeof code !== 'string' || code.length === 0)
|
|
128
|
+
return undefined;
|
|
129
|
+
for (const row of RESULT_LIMIT_TABLE)
|
|
130
|
+
if (row.code === code)
|
|
131
|
+
return row;
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
115
134
|
export const RESUME_POLICY_FOLD_CODE = 'resume_blocked_by_policy';
|
|
116
|
-
export const STATUS_DERIVED_COARSE_CODES = SDK_STATUS_DERIVED_COARSE_CODES;
|
|
117
135
|
export function isStatusDerivedCoarseCode(code) {
|
|
118
|
-
return typeof code === 'string' &&
|
|
136
|
+
return typeof code === 'string' && SDK_STATUS_DERIVED_COARSE_CODES.includes(code);
|
|
119
137
|
}
|
|
120
138
|
export const RESUME_AT_ERROR_CODE_PREFIX = 'resume_at.';
|
|
121
139
|
export const REWIND_ERROR_CODE_PREFIXES = Object.freeze([RESUME_AT_ERROR_CODE_PREFIX, 'rewind_snapshot.']);
|
|
@@ -189,6 +207,10 @@ export const DECIDE_PARK_MOVED_CODES = Object.freeze([
|
|
|
189
207
|
export function isDecideParkMovedCode(code) {
|
|
190
208
|
return typeof code === 'string' && DECIDE_PARK_MOVED_CODES.includes(code);
|
|
191
209
|
}
|
|
210
|
+
export const DECIDE_ROW_UNREVIVABLE = 'decide.row_unrevivable';
|
|
211
|
+
export function isDecideRowUnrevivableCode(code) {
|
|
212
|
+
return typeof code === 'string' && code === DECIDE_ROW_UNREVIVABLE;
|
|
213
|
+
}
|
|
192
214
|
export const APPROVAL_STALE = 'approval_stale';
|
|
193
215
|
export const APPROVAL_BINDING_MISMATCH = 'approval_binding_mismatch';
|
|
194
216
|
export const CHECKPOINT_INVALID_OUTCOME = 'checkpoint.invalid_outcome';
|
|
@@ -208,8 +230,11 @@ export function isDecideAlreadyResolvedCode(code) {
|
|
|
208
230
|
}
|
|
209
231
|
export const ASK_GONE = 'gone.ask';
|
|
210
232
|
export const ASK_GONE_PARKED = 'gone.ask_parked';
|
|
233
|
+
export const ASK_NOT_FOUND = 'not_found.ask';
|
|
234
|
+
export const ASK_IDEMPOTENCY_CONFLICT = 'conflict.ask_idempotency';
|
|
235
|
+
export const ASK_PARKING_RETRY = 'parking.ask_retry';
|
|
236
|
+
export const ASK_DECISION_LANE_DISABLED = 'feature.approval_ask_disabled';
|
|
211
237
|
export const ASK_GONE_DENIED_WORD = SDK_DENY_REASON_ROUTING_FAILURE;
|
|
212
|
-
export const RUN_DEATH_VERDICT_CODES = SDK_RUN_DEATH_VERDICT_CODES;
|
|
213
238
|
const _runDeathVerdictCodePin = true;
|
|
214
239
|
void _runDeathVerdictCodePin;
|
|
215
240
|
export const RUN_STALLED = 'run.stalled';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ApprovalWindowAnchor {
|
|
2
|
+
readonly receivedAtMs?: number;
|
|
3
|
+
readonly expiresInMs?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const ENGINE_GENERATION_WINDOW_MARGIN_MS = 5000;
|
|
6
|
+
export declare const ENGINE_STOPPED_CALL_PHASES: readonly ["engine-stopped-awaiting-approval", "engine-stopped-before-result"];
|
|
7
|
+
export type EngineStoppedCallPhase = (typeof ENGINE_STOPPED_CALL_PHASES)[number];
|
|
8
|
+
export interface EndedGenerationCard {
|
|
9
|
+
readonly callKey: string;
|
|
10
|
+
readonly toolCallId?: string;
|
|
11
|
+
readonly parkRow: boolean;
|
|
12
|
+
readonly windowLeftMs?: number;
|
|
13
|
+
readonly closedByEngine?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface EndedGenerationOpenedCall {
|
|
16
|
+
readonly toolCallId: string;
|
|
17
|
+
readonly generation: number;
|
|
18
|
+
}
|
|
19
|
+
export interface EndedGenerationPhaseHold {
|
|
20
|
+
readonly toolCallId: string;
|
|
21
|
+
readonly generation: number;
|
|
22
|
+
}
|
|
23
|
+
export interface EndedGenerationFacts {
|
|
24
|
+
readonly cards: readonly EndedGenerationCard[];
|
|
25
|
+
readonly opened: readonly EndedGenerationOpenedCall[];
|
|
26
|
+
readonly phases?: readonly EndedGenerationPhaseHold[];
|
|
27
|
+
readonly endedGeneration: number;
|
|
28
|
+
}
|
|
29
|
+
export interface EndedGenerationPhaseChange {
|
|
30
|
+
readonly toolCallId: string;
|
|
31
|
+
readonly phase: EngineStoppedCallPhase;
|
|
32
|
+
readonly viaCallKey?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface EngineGenerationConvergence {
|
|
35
|
+
readonly retract: readonly string[];
|
|
36
|
+
readonly phases: readonly EndedGenerationPhaseChange[];
|
|
37
|
+
}
|
|
38
|
+
export declare function approvalWindowLeftMs(keys: Readonly<ApprovalWindowAnchor> | null | undefined, nowMs: number): number | undefined;
|
|
39
|
+
export declare function convergeEndedEngineGeneration(facts: EndedGenerationFacts): EngineGenerationConvergence;
|