@sema-agent/client-core 0.109.0 → 0.111.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 +342 -0
- package/README.md +88 -32
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +45 -11
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +20 -15
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/declared/supportFloorDeclared.js +1 -1
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +138 -14
- package/dist/engineErrorCodes.d.ts +3 -0
- package/dist/engineErrorCodes.js +3 -0
- package/dist/engineHealthFacts.d.ts +20 -0
- package/dist/engineHealthFacts.js +42 -1
- package/dist/engineHealthProbeVerdict.d.ts +23 -0
- package/dist/engineHealthProbeVerdict.js +115 -0
- package/dist/engineInlineTaskStats.d.ts +4 -3
- package/dist/engineInlineTaskStats.js +18 -2
- package/dist/engineNoticeCodes.d.ts +10 -0
- package/dist/engineNoticeCodes.js +36 -6
- package/dist/engineRepoint.d.ts +147 -0
- package/dist/engineRepoint.js +310 -0
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +13 -1
- package/dist/engineSessionMessages.d.ts +2 -1
- package/dist/engineSessionMessages.js +5 -0
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +44 -0
- package/dist/engineUnavailable.js +492 -0
- package/dist/errorSupplementRoles.js +2 -1
- package/dist/eventLeg.js +3 -3
- package/dist/fleet/fleetProjection.js +3 -2
- package/dist/generated/engineFactTables.d.ts +2 -0
- package/dist/generated/engineFactTables.js +12 -0
- package/dist/generated/sdkFactTables.d.ts +2 -1
- package/dist/generated/sdkFactTables.js +5 -0
- package/dist/generated/settingsSchemaTables.d.ts +4 -0
- package/dist/generated/settingsSchemaTables.js +1 -0
- package/dist/hitl/approvalAskers.d.ts +6 -0
- package/dist/hitl/approvalAskers.js +30 -0
- package/dist/hitl/approvalCardReasons.js +6 -3
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalRequestFrameReading.d.ts +7 -0
- package/dist/hitl/approvalRequestFrameReading.js +11 -0
- package/dist/hitl/approvalResolution.d.ts +9 -2
- package/dist/hitl/approvalResolution.js +6 -1
- package/dist/hitl/askGateWire.js +5 -8
- package/dist/hitl/automaticAnswerVerdict.js +2 -2
- package/dist/hitl/decisionConflict.js +6 -3
- package/dist/hitl/decisionRefusal.d.ts +2 -0
- package/dist/hitl/decisionRefusal.js +8 -8
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +10 -0
- package/dist/hitl/decisionSend.js +57 -17
- package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
- package/dist/hitl/editedApprovalAcceptance.js +26 -0
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +12 -33
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/gateLedger.d.ts +0 -4
- package/dist/hitl/gateLedger.js +0 -19
- package/dist/hitl/hitlBridge.d.ts +7 -0
- package/dist/hitl/hitlBridge.js +14 -8
- package/dist/hitl/hitlHostSurface.d.ts +3 -1
- package/dist/hitl/hitlHostSurface.js +14 -4
- package/dist/hitl/hostWithdrawal.d.ts +15 -0
- package/dist/hitl/hostWithdrawal.js +38 -0
- package/dist/hitl/localAllowRedemption.d.ts +67 -0
- package/dist/hitl/localAllowRedemption.js +256 -0
- package/dist/hitl/parkResolver.js +32 -13
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +72 -2
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +37 -10
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +362 -0
- package/dist/hitl/sessionPolicyWire.js +6 -4
- package/dist/hitl/standingRows.d.ts +4 -1
- package/dist/hitl/standingRows.js +33 -1
- package/dist/hitl/toolApprovalWire.d.ts +64 -15
- package/dist/hitl/toolApprovalWire.js +470 -125
- package/dist/hooksWireCaps.js +31 -1
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +13 -4
- package/dist/hostTurnSettings.js +150 -10
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +212 -0
- package/dist/i18n/messages.en.js +217 -5
- package/dist/i18n/messages.zh.js +235 -5
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +56 -16
- package/dist/index.js +40 -12
- package/dist/inheritEnvCapability.js +2 -0
- package/dist/inputAuthor.d.ts +16 -0
- package/dist/inputAuthor.js +44 -0
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/interruptRefusalNote.d.ts +2 -0
- package/dist/interruptRefusalNote.js +17 -0
- package/dist/liveModelCatalog.d.ts +2 -0
- package/dist/liveModelCatalog.js +23 -9
- package/dist/liveQuestionStore.d.ts +4 -1
- package/dist/liveQuestionStore.js +12 -3
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpEngineLeg.d.ts +3 -0
- package/dist/mcpEngineLeg.js +38 -1
- package/dist/mcpPanel.js +2 -0
- package/dist/mcpReconnect.d.ts +9 -1
- package/dist/mcpReconnect.js +124 -19
- package/dist/mcpWireCaps.js +1 -1
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +7 -43
- package/dist/modsFace.d.ts +8 -1
- package/dist/modsFace.js +27 -0
- package/dist/notifications.d.ts +36 -6
- package/dist/notifications.js +170 -20
- package/dist/ownKey.d.ts +6 -5
- package/dist/ownKey.js +31 -7
- package/dist/peerFrames.d.ts +40 -2
- package/dist/peerFrames.js +158 -3
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +1 -0
- package/dist/permissionsDeclaration.js +11 -1
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +10 -1
- package/dist/pluginHooksWire.js +96 -7
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +11 -6
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/replayBody.js +10 -2
- package/dist/request/taskRequest.d.ts +5 -0
- package/dist/request/taskRequest.js +142 -21
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +1 -3
- package/dist/resumeRefusalCopy.js +2 -1
- package/dist/retryStatus.d.ts +2 -2
- package/dist/retryStatus.js +2 -0
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runPermissionModeSwitch.js +2 -2
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +27 -2
- package/dist/seam.js +17 -1
- package/dist/seatContract.d.ts +189 -12
- package/dist/seatContract.js +401 -9
- package/dist/sessionBackground.js +2 -1
- package/dist/sessionBackgroundHandoff.js +2 -1
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionEngine.d.ts +2 -0
- package/dist/sessionEngine.js +111 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionMemoryStatus.d.ts +2 -1
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +27 -0
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sseIdleTriage.d.ts +13 -1
- package/dist/sseIdleTriage.js +25 -6
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +8 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/terminalStatuses.d.ts +1 -0
- package/dist/terminalStatuses.js +4 -1
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/turnFailurePresentation.js +9 -2
- package/dist/typePins.d.ts +11 -0
- package/dist/usageAnalytics.d.ts +17 -0
- package/dist/usageAnalytics.js +44 -2
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +6 -5
- package/dist/wireFailureShape.js +150 -38
- package/dist/wireRefusalCopy.d.ts +16 -5
- package/dist/wireRefusalCopy.js +119 -86
- package/docs/INTEGRATION-CLIENTS.md +4228 -21
- package/package.json +7 -3
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PROTOCOL_ERROR_NAME, REFUSAL_PROBLEMS_READ_MAX, THROWN_SLOT_UNREADABLE, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorPresent,
|
|
2
|
-
import { appendOwnElement, guardedRead, readOwnDataValue
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, REFUSAL_PROBLEMS_READ_MAX, THROWN_SLOT_UNREADABLE, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorPresent, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readRefusalSlots, readThrownExtra, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
|
+
import { appendOwnElement, guardedRead, readOwnDataValue } from './ownKey.js';
|
|
3
3
|
import { ACTIVE_RUN_BUSY_ERROR_CODE, CONFLICT_SESSION_ARCHIVE_STAMPED, CONFLICT_SESSION_ID_RETIRED, FLEET_LEASE_UNAVAILABLE, LIMIT_RATE_EXCEEDED, RATE_EXCEEDED_RUN_CONCURRENCY_CAP, REQUEST_ENV_CREDENTIAL_REFUSED, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
5
|
import { quoteUntrustedForSentence } from './displayUntrusted.js';
|
|
@@ -342,7 +342,7 @@ export function fieldLimitRefusalFromError(err) {
|
|
|
342
342
|
if (coded.code !== FIELD_INVALID)
|
|
343
343
|
return null;
|
|
344
344
|
const field = readErrorString(err, 'field');
|
|
345
|
-
if (field === undefined || field.length === 0)
|
|
345
|
+
if (field === undefined || field.length === 0 || isSettingsHooksCoordinate(field))
|
|
346
346
|
return null;
|
|
347
347
|
const reason = readErrorString(err, 'reason');
|
|
348
348
|
const folded = coded.folded;
|
|
@@ -366,13 +366,6 @@ export function fieldLimitRefusalFromError(err) {
|
|
|
366
366
|
return null;
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
function hooksCoordinateOf(path) {
|
|
370
|
-
const lead = path !== undefined && path[0] === 'hooks';
|
|
371
|
-
let out = lead ? 'settings' : HOOK_MATCHER_REFUSAL_FIELD;
|
|
372
|
-
for (const seg of path ?? [])
|
|
373
|
-
out += typeof seg === 'number' ? `[${seg}]` : `.${seg}`;
|
|
374
|
-
return out;
|
|
375
|
-
}
|
|
376
369
|
export function fieldLimitRefusalOfSettingsHooks(refusal) {
|
|
377
370
|
try {
|
|
378
371
|
if (typeof refusal !== 'object' || refusal === null)
|
|
@@ -380,25 +373,12 @@ export function fieldLimitRefusalOfSettingsHooks(refusal) {
|
|
|
380
373
|
const reason = readOwnDataValue(refusal, 'reason');
|
|
381
374
|
if (reason !== 'over_cap' && reason !== 'too_long')
|
|
382
375
|
return null;
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
if (Array.isArray(rawPath)) {
|
|
386
|
-
const out = [];
|
|
387
|
-
for (let i = 0; i < rawPath.length; i++) {
|
|
388
|
-
const seg = Object.hasOwn(rawPath, i) ? rawPath[i] : undefined;
|
|
389
|
-
if (typeof seg === 'string' || (typeof seg === 'number' && Number.isSafeInteger(seg) && seg >= 0))
|
|
390
|
-
out.push(seg);
|
|
391
|
-
else {
|
|
392
|
-
out.length = 0;
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
path = out.length > 0 ? out : undefined;
|
|
397
|
-
}
|
|
376
|
+
const rawField = guardedRead(() => readOwnDataValue(refusal, 'field'));
|
|
377
|
+
const field = typeof rawField === 'string' && isSettingsHooksCoordinate(rawField) ? rawField : HOOK_MATCHER_REFUSAL_FIELD;
|
|
398
378
|
const count = nonNegInt(readOwnDataValue(refusal, 'count'));
|
|
399
379
|
const cap = posInt(readOwnDataValue(refusal, 'cap'));
|
|
400
380
|
return Object.freeze({
|
|
401
|
-
field
|
|
381
|
+
field,
|
|
402
382
|
reason,
|
|
403
383
|
...(count !== undefined ? { count } : {}),
|
|
404
384
|
...(cap !== undefined ? { cap } : {}),
|
|
@@ -730,26 +710,19 @@ export function hostPostureRefusalContent(detail, lang) {
|
|
|
730
710
|
}
|
|
731
711
|
}
|
|
732
712
|
const HOOK_MATCHER_REFUSAL_FIELD = 'settings.hooks';
|
|
733
|
-
function
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
713
|
+
function isSettingsHooksCoordinate(field) {
|
|
714
|
+
return field === HOOK_MATCHER_REFUSAL_FIELD || field.startsWith(`${HOOK_MATCHER_REFUSAL_FIELD}.`) || field.startsWith(`${HOOK_MATCHER_REFUSAL_FIELD}[`);
|
|
715
|
+
}
|
|
716
|
+
function refusalRootReader(err) {
|
|
717
|
+
const bag = readThrownExtra(err);
|
|
718
|
+
return (key) => {
|
|
719
|
+
const top = readThrownSlot(err, key, 'data');
|
|
720
|
+
if (top !== undefined && top !== THROWN_SLOT_UNREADABLE)
|
|
721
|
+
return top;
|
|
722
|
+
if (bag.state !== 'object')
|
|
737
723
|
return undefined;
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
if (!Object.hasOwn(raw, i))
|
|
741
|
-
return undefined;
|
|
742
|
-
const v = raw[i];
|
|
743
|
-
if (typeof v === 'string' || (typeof v === 'number' && Number.isSafeInteger(v) && v >= 0))
|
|
744
|
-
out.push(v);
|
|
745
|
-
else
|
|
746
|
-
return undefined;
|
|
747
|
-
}
|
|
748
|
-
return Object.freeze(out);
|
|
749
|
-
}
|
|
750
|
-
catch {
|
|
751
|
-
return undefined;
|
|
752
|
-
}
|
|
724
|
+
return guardedRead(() => readOwnDataValue(bag.value, key));
|
|
725
|
+
};
|
|
753
726
|
}
|
|
754
727
|
export function settingsHooksRefusalFromError(err) {
|
|
755
728
|
try {
|
|
@@ -757,20 +730,23 @@ export function settingsHooksRefusalFromError(err) {
|
|
|
757
730
|
return undefined;
|
|
758
731
|
if (err.errorCode !== FIELD_INVALID)
|
|
759
732
|
return undefined;
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
const detail = readErrorRecord(err, 'detail');
|
|
763
|
-
if (detail === undefined)
|
|
733
|
+
const field = readErrorString(err, 'field');
|
|
734
|
+
if (field === undefined || !isSettingsHooksCoordinate(field))
|
|
764
735
|
return undefined;
|
|
765
|
-
const
|
|
766
|
-
const
|
|
767
|
-
const
|
|
768
|
-
const family = (reason, rest = {}) => Object.freeze({ reason,
|
|
769
|
-
const
|
|
736
|
+
const at = refusalRootReader(err);
|
|
737
|
+
const reasonRaw = at('reason');
|
|
738
|
+
const withField = (o) => Object.freeze({ ...o, field });
|
|
739
|
+
const family = (reason, rest = {}) => Object.freeze({ reason, field, ...rest });
|
|
740
|
+
const nonEmpty = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
741
|
+
const event = nonEmpty(at('event'));
|
|
742
|
+
const groupIndexRaw = at('groupIndex');
|
|
743
|
+
const groupIndex = typeof groupIndexRaw === 'number' && Number.isInteger(groupIndexRaw) && groupIndexRaw >= 0 ? groupIndexRaw : undefined;
|
|
770
744
|
if (reasonRaw === undefined || reasonRaw === 'dead_alias') {
|
|
771
|
-
const alias =
|
|
772
|
-
const canonical =
|
|
773
|
-
const matcher = event !== undefined && alias !== undefined && canonical !== undefined
|
|
745
|
+
const alias = nonEmpty(at('alias'));
|
|
746
|
+
const canonical = nonEmpty(at('canonical'));
|
|
747
|
+
const matcher = event !== undefined && alias !== undefined && canonical !== undefined
|
|
748
|
+
? withField({ reason: 'alias_without_canonical', event, alias, canonical, ...(groupIndex !== undefined ? { groupIndex } : {}) })
|
|
749
|
+
: undefined;
|
|
774
750
|
if (reasonRaw === undefined && matcher === undefined)
|
|
775
751
|
return undefined;
|
|
776
752
|
return family('dead_alias', matcher !== undefined ? { matcher } : {});
|
|
@@ -778,24 +754,22 @@ export function settingsHooksRefusalFromError(err) {
|
|
|
778
754
|
if (typeof reasonRaw !== 'string' || reasonRaw.length === 0)
|
|
779
755
|
return undefined;
|
|
780
756
|
if (reasonRaw === 'invalid_regex' || reasonRaw === 'over_budget' || reasonRaw === 'budget_exceeded') {
|
|
781
|
-
const groupIndex = readOwnDataValue(detail, 'groupIndex');
|
|
782
|
-
const okIndex = typeof groupIndex === 'number' && Number.isInteger(groupIndex) && groupIndex >= 0;
|
|
783
757
|
let matcher;
|
|
784
|
-
if (event !== undefined &&
|
|
758
|
+
if (event !== undefined && groupIndex !== undefined) {
|
|
785
759
|
if (reasonRaw === 'invalid_regex')
|
|
786
|
-
matcher =
|
|
760
|
+
matcher = withField({ reason: 'invalid_regex', event, groupIndex });
|
|
787
761
|
else {
|
|
788
762
|
const key = reasonRaw === 'over_budget' ? 'budgetMs' : 'totalMs';
|
|
789
|
-
const ms =
|
|
763
|
+
const ms = at(key);
|
|
790
764
|
const msBit = typeof ms === 'number' && Number.isFinite(ms) && ms > 0 ? { [key]: ms } : {};
|
|
791
|
-
matcher = reasonRaw === 'over_budget' ?
|
|
765
|
+
matcher = reasonRaw === 'over_budget' ? withField({ reason: 'over_budget', event, groupIndex, ...msBit }) : withField({ reason: 'budget_exceeded', event, groupIndex, ...msBit });
|
|
792
766
|
}
|
|
793
767
|
}
|
|
794
768
|
return family(reasonRaw, matcher !== undefined ? { matcher } : {});
|
|
795
769
|
}
|
|
796
770
|
if (reasonRaw === 'over_cap' || reasonRaw === 'too_long') {
|
|
797
|
-
const count = nonNegInt(
|
|
798
|
-
const cap = posInt(
|
|
771
|
+
const count = nonNegInt(at('count'));
|
|
772
|
+
const cap = posInt(at('cap'));
|
|
799
773
|
return family(reasonRaw, { ...(count !== undefined ? { count } : {}), ...(cap !== undefined ? { cap } : {}) });
|
|
800
774
|
}
|
|
801
775
|
return family(reasonRaw);
|
|
@@ -877,6 +851,74 @@ export function sessionIdRetiredFromError(err) {
|
|
|
877
851
|
export function sessionIdRetiredContent(detail, lang) {
|
|
878
852
|
return renderMessage(msg(detail.folded === true ? 'notice.wireRefusal.sessionIdRetired.folded' : 'notice.wireRefusal.sessionIdRetired'), lang);
|
|
879
853
|
}
|
|
854
|
+
function isIndexedMemberCoordinate(field, list, member) {
|
|
855
|
+
const head = `${list}[`;
|
|
856
|
+
if (!field.startsWith(head))
|
|
857
|
+
return false;
|
|
858
|
+
const close = field.indexOf(']', head.length);
|
|
859
|
+
if (close < 0 || !/^[0-9]+$/.test(field.slice(head.length, close)))
|
|
860
|
+
return false;
|
|
861
|
+
const rest = field.slice(close + 1);
|
|
862
|
+
return rest === `.${member}` || rest.startsWith(`.${member}.`);
|
|
863
|
+
}
|
|
864
|
+
function unreadMembersFaceOf(field) {
|
|
865
|
+
if (/^settings\.hooks(?:\.|$)/.test(field))
|
|
866
|
+
return 'settings_hooks';
|
|
867
|
+
if (/^settings\.env(?:\.|$)/.test(field))
|
|
868
|
+
return 'settings_env';
|
|
869
|
+
if (/^settings\.[^\s.[\]]/.test(field))
|
|
870
|
+
return 'settings_other';
|
|
871
|
+
if (isIndexedMemberCoordinate(field, 'mcpServers', 'transport'))
|
|
872
|
+
return 'mcp_transport';
|
|
873
|
+
if (isIndexedMemberCoordinate(field, 'a2aPeers', 'headers'))
|
|
874
|
+
return 'a2a_headers';
|
|
875
|
+
return undefined;
|
|
876
|
+
}
|
|
877
|
+
export function unreadRequestMembersFromError(err) {
|
|
878
|
+
try {
|
|
879
|
+
if (typeof err !== 'object' || err === null)
|
|
880
|
+
return null;
|
|
881
|
+
const effective = effectiveWireCodeReading(err);
|
|
882
|
+
if (effective.code !== FIELD_INVALID)
|
|
883
|
+
return null;
|
|
884
|
+
const slots = readRefusalSlots(err, ['field', 'reason']);
|
|
885
|
+
if (slots.reason.present)
|
|
886
|
+
return null;
|
|
887
|
+
const field = slots.field.word;
|
|
888
|
+
if (field === undefined)
|
|
889
|
+
return null;
|
|
890
|
+
const face = unreadMembersFaceOf(field);
|
|
891
|
+
if (face === undefined)
|
|
892
|
+
return null;
|
|
893
|
+
return Object.freeze({ code: FIELD_INVALID, field, face, ...(effective.folded ? { folded: true } : {}) });
|
|
894
|
+
}
|
|
895
|
+
catch {
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function unreadMembersPartKey(face) {
|
|
900
|
+
switch (face) {
|
|
901
|
+
case 'settings_hooks':
|
|
902
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsHooks';
|
|
903
|
+
case 'settings_env':
|
|
904
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsEnv';
|
|
905
|
+
case 'settings_other':
|
|
906
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsOther';
|
|
907
|
+
case 'mcp_transport':
|
|
908
|
+
return 'notice.wireRefusal.unreadMembers.part.mcpTransport';
|
|
909
|
+
case 'a2a_headers':
|
|
910
|
+
return 'notice.wireRefusal.unreadMembers.part.a2aHeaders';
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
const UNREAD_MEMBERS_FIELD_SHOWN_MAX = 120;
|
|
914
|
+
export function unreadRequestMembersContent(detail, lang) {
|
|
915
|
+
const folded = detail.folded === true;
|
|
916
|
+
const part = renderMessage(msg(unreadMembersPartKey(detail.face)), lang);
|
|
917
|
+
const head = renderMessage(msg(folded ? 'notice.wireRefusal.unreadMembers.folded' : 'notice.wireRefusal.unreadMembers', { part }), lang);
|
|
918
|
+
const quoted = quoteUntrustedForSentence(detail.field, UNREAD_MEMBERS_FIELD_SHOWN_MAX);
|
|
919
|
+
const where = quoted !== undefined ? ` · ${renderMessage(msg('notice.wireRefusal.unreadMembers.where', { where: quoted }), lang)}` : '';
|
|
920
|
+
return `${head}${where} · ${renderMessage(msg(folded ? 'notice.wireRefusal.unreadMembers.folded.remedy' : 'notice.wireRefusal.unreadMembers.remedy'), lang)}`;
|
|
921
|
+
}
|
|
880
922
|
export function runConcurrencyCapFromError(err) {
|
|
881
923
|
try {
|
|
882
924
|
if (typeof err !== 'object' || err === null)
|
|
@@ -930,13 +972,10 @@ export function unsupportedRuleRefusalFromError(err) {
|
|
|
930
972
|
const effective = effectiveWireCodeReading(err);
|
|
931
973
|
if (effective.code !== REQUEST_UNPROCESSABLE)
|
|
932
974
|
return null;
|
|
933
|
-
const detail = readErrorRecord(err, 'detail');
|
|
934
|
-
if (detail === undefined)
|
|
935
|
-
return null;
|
|
936
975
|
let list;
|
|
937
976
|
let length = 0;
|
|
938
977
|
try {
|
|
939
|
-
const raw =
|
|
978
|
+
const raw = readErrorPresent(err, 'problems');
|
|
940
979
|
if (Array.isArray(raw)) {
|
|
941
980
|
list = raw;
|
|
942
981
|
const n = raw.length;
|
|
@@ -1026,7 +1065,8 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
1026
1065
|
try {
|
|
1027
1066
|
if (typeof err !== 'object' || err === null)
|
|
1028
1067
|
return null;
|
|
1029
|
-
let
|
|
1068
|
+
let index;
|
|
1069
|
+
let path;
|
|
1030
1070
|
const kind = readOwnDataValue(err, 'kind');
|
|
1031
1071
|
const plane = readOwnDataValue(err, 'plane');
|
|
1032
1072
|
if (kind === 'failed' && (plane === 'cause' || plane === 'flat')) {
|
|
@@ -1034,26 +1074,15 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
1034
1074
|
return null;
|
|
1035
1075
|
const cause = readOwnDataValue(err, 'detail');
|
|
1036
1076
|
const inner = typeof cause === 'object' && cause !== null && readOwnDataValue(cause, 'kind') === 'coded' ? readOwnDataValue(cause, 'detail') : undefined;
|
|
1037
|
-
facts = typeof inner === 'object' && inner !== null && !Array.isArray(inner) ? inner : undefined;
|
|
1077
|
+
const facts = typeof inner === 'object' && inner !== null && !Array.isArray(inner) ? inner : undefined;
|
|
1078
|
+
index = facts === undefined ? undefined : guardedRead(() => readOwnDataValue(facts, 'index'));
|
|
1079
|
+
path = facts === undefined ? undefined : guardedRead(() => readOwnDataValue(facts, 'path'));
|
|
1038
1080
|
}
|
|
1039
1081
|
else {
|
|
1040
1082
|
if (effectiveWireErrorCode(err) !== USER_ATTACHMENT_INVALID_ERROR_CODE)
|
|
1041
1083
|
return null;
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
let index;
|
|
1045
|
-
let path;
|
|
1046
|
-
try {
|
|
1047
|
-
index = facts === undefined ? undefined : readOwnDataValue(facts, 'index');
|
|
1048
|
-
}
|
|
1049
|
-
catch {
|
|
1050
|
-
index = undefined;
|
|
1051
|
-
}
|
|
1052
|
-
try {
|
|
1053
|
-
path = facts === undefined ? undefined : readOwnDataValue(facts, 'path');
|
|
1054
|
-
}
|
|
1055
|
-
catch {
|
|
1056
|
-
path = undefined;
|
|
1084
|
+
index = guardedRead(() => readErrorNumber(err, 'index'));
|
|
1085
|
+
path = guardedRead(() => readErrorString(err, 'field'));
|
|
1057
1086
|
}
|
|
1058
1087
|
return {
|
|
1059
1088
|
code: USER_ATTACHMENT_INVALID_ERROR_CODE,
|
|
@@ -1069,3 +1098,7 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
1069
1098
|
export function userInvokedSkillRefusalFromError(err) {
|
|
1070
1099
|
return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
|
|
1071
1100
|
}
|
|
1101
|
+
const _pinRequestField = [true, true, true, true, true, true, true, true];
|
|
1102
|
+
void _pinRequestField;
|
|
1103
|
+
const _pinWallSource = [true, true, true];
|
|
1104
|
+
void _pinWallSource;
|