@sema-agent/client-core 0.110.0 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +244 -0
- package/README.md +59 -18
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +25 -4
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/checkpointRowVerdict.d.ts +3 -0
- package/dist/checkpointRowVerdict.js +14 -1
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/consoleCaPin.d.ts +136 -0
- package/dist/consoleCaPin.js +827 -0
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/deviceRebind.js +3 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +6 -0
- package/dist/effectiveFacts.d.ts +9 -0
- package/dist/effectiveFacts.js +33 -0
- package/dist/engineAddress.d.ts +1 -0
- package/dist/engineAddress.js +4 -1
- package/dist/engineCredentialRelease.d.ts +54 -0
- package/dist/engineCredentialRelease.js +146 -0
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +1 -0
- package/dist/engineHealthProbeVerdict.d.ts +24 -0
- package/dist/engineHealthProbeVerdict.js +123 -0
- package/dist/engineNoticeCodes.js +5 -7
- package/dist/engineRepoint.d.ts +12 -5
- package/dist/engineRepoint.js +44 -19
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +11 -1
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +45 -0
- package/dist/engineUnavailable.js +496 -0
- package/dist/engineUrl.js +4 -2
- package/dist/eventLeg.js +3 -3
- package/dist/gateFailureCodes.js +2 -2
- package/dist/generated/sdkFactTables.d.ts +2 -1
- package/dist/generated/sdkFactTables.js +14 -0
- package/dist/generated/settingsSchemaFns.d.ts +1 -0
- package/dist/generated/settingsSchemaFns.js +3 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
- package/dist/generated/settingsSchemaTables.d.ts +56 -0
- package/dist/generated/settingsSchemaTables.js +19 -0
- package/dist/generated/settingsSchemaTypes.d.ts +23 -13
- package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlShape.js +17 -0
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalResolution.d.ts +1 -1
- package/dist/hitl/approvalResolution.js +2 -1
- package/dist/hitl/askGateWire.js +5 -6
- package/dist/hitl/decisionRefusal.d.ts +6 -0
- package/dist/hitl/decisionRefusal.js +19 -10
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +7 -0
- package/dist/hitl/decisionSend.js +34 -12
- package/dist/hitl/editedApprovalAcceptance.js +1 -1
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +8 -15
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/hitlBridge.d.ts +6 -0
- package/dist/hitl/hitlBridge.js +10 -4
- package/dist/hitl/hitlHostSurface.d.ts +2 -1
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/localAllowRedemption.d.ts +70 -0
- package/dist/hitl/localAllowRedemption.js +276 -0
- package/dist/hitl/parkOwnership.js +2 -1
- package/dist/hitl/parkResolver.js +14 -4
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +70 -0
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +23 -6
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +363 -0
- package/dist/hitl/sessionPolicyWire.js +2 -2
- package/dist/hitl/standingRows.d.ts +6 -2
- package/dist/hitl/standingRows.js +27 -2
- package/dist/hitl/toolApprovalWire.d.ts +30 -8
- package/dist/hitl/toolApprovalWire.js +264 -121
- package/dist/hooksReaderGenerations.js +1 -1
- package/dist/hooksWireCaps.js +3 -3
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +3 -0
- package/dist/hostTurnSettings.js +38 -5
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +292 -0
- package/dist/i18n/messages.en.js +298 -7
- package/dist/i18n/messages.zh.js +316 -6
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +71 -20
- package/dist/index.js +44 -13
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/liveModelCatalog.d.ts +4 -0
- package/dist/liveModelCatalog.js +12 -3
- package/dist/localConfig/documents.d.ts +61 -0
- package/dist/localConfig/documents.js +51 -0
- package/dist/localConfig/kernel.d.ts +149 -0
- package/dist/localConfig/kernel.js +597 -0
- package/dist/localConfig/mcp/edit.d.ts +161 -0
- package/dist/localConfig/mcp/edit.js +846 -0
- package/dist/localConfig/mcp/servers.d.ts +165 -0
- package/dist/localConfig/mcp/servers.js +776 -0
- package/dist/localConfig/mcp/views.d.ts +170 -0
- package/dist/localConfig/mcp/views.js +429 -0
- package/dist/localConfig/modelPool.d.ts +262 -0
- package/dist/localConfig/modelPool.js +1489 -0
- package/dist/localConfig/modelPoolWords.d.ts +13 -0
- package/dist/localConfig/modelPoolWords.js +20 -0
- package/dist/localConfig/receiptShape.d.ts +7 -0
- package/dist/localConfig/receiptShape.js +135 -0
- package/dist/localConfig/settingsWrite.d.ts +127 -0
- package/dist/localConfig/settingsWrite.js +237 -0
- package/dist/localConfig/skills.d.ts +124 -0
- package/dist/localConfig/skills.js +397 -0
- package/dist/localConfig/skillsWords.d.ts +10 -0
- package/dist/localConfig/skillsWords.js +5 -0
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpProbeWire.js +2 -1
- package/dist/mcpReconnect.js +3 -3
- package/dist/mcpWireCaps.js +1 -1
- package/dist/memoryVerbsWire.js +3 -2
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/onboardJudgement.d.ts +14 -4
- package/dist/model/onboardJudgement.js +91 -139
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +3 -40
- package/dist/modelConfigGapNotice.d.ts +20 -0
- package/dist/modelConfigGapNotice.js +102 -0
- package/dist/modsKernelIdentity.js +2 -47
- package/dist/notifications.d.ts +19 -0
- package/dist/notifications.js +114 -12
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +71 -8
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +3 -1
- package/dist/permissionsDeclaration.js +33 -9
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +9 -1
- package/dist/pluginHooksWire.js +40 -6
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +12 -7
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/request/taskRequest.js +10 -6
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +12 -4
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runLedgerSnapshot.js +3 -3
- package/dist/runPermissionModeSwitch.js +3 -4
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +16 -2
- package/dist/seam.js +10 -0
- package/dist/seatContract.d.ts +259 -9
- package/dist/seatContract.js +444 -15
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +4 -1
- package/dist/sessionMemoryErase.js +2 -1
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.js +8 -9
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sha256Bytes.d.ts +1 -0
- package/dist/sha256Bytes.js +46 -0
- package/dist/skillOverrideChain.d.ts +83 -0
- package/dist/skillOverrideChain.js +378 -0
- package/dist/skillsWireCaps.d.ts +3 -0
- package/dist/skillsWireCaps.js +16 -1
- package/dist/sseIdleTriage.js +2 -1
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +2 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/turnFailurePresentation.js +4 -10
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +141 -19
- package/dist/wireRefusalCopy.d.ts +6 -5
- package/dist/wireRefusalCopy.js +49 -92
- package/docs/INTEGRATION-CLIENTS.md +2718 -17
- package/package.json +7 -3
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);
|
|
@@ -907,8 +881,8 @@ export function unreadRequestMembersFromError(err) {
|
|
|
907
881
|
const effective = effectiveWireCodeReading(err);
|
|
908
882
|
if (effective.code !== FIELD_INVALID)
|
|
909
883
|
return null;
|
|
910
|
-
const slots = readRefusalSlots(err, ['field', 'reason'
|
|
911
|
-
if (slots.reason.present
|
|
884
|
+
const slots = readRefusalSlots(err, ['field', 'reason']);
|
|
885
|
+
if (slots.reason.present)
|
|
912
886
|
return null;
|
|
913
887
|
const field = slots.field.word;
|
|
914
888
|
if (field === undefined)
|
|
@@ -998,13 +972,10 @@ export function unsupportedRuleRefusalFromError(err) {
|
|
|
998
972
|
const effective = effectiveWireCodeReading(err);
|
|
999
973
|
if (effective.code !== REQUEST_UNPROCESSABLE)
|
|
1000
974
|
return null;
|
|
1001
|
-
const detail = readErrorRecord(err, 'detail');
|
|
1002
|
-
if (detail === undefined)
|
|
1003
|
-
return null;
|
|
1004
975
|
let list;
|
|
1005
976
|
let length = 0;
|
|
1006
977
|
try {
|
|
1007
|
-
const raw =
|
|
978
|
+
const raw = readErrorPresent(err, 'problems');
|
|
1008
979
|
if (Array.isArray(raw)) {
|
|
1009
980
|
list = raw;
|
|
1010
981
|
const n = raw.length;
|
|
@@ -1094,7 +1065,8 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
1094
1065
|
try {
|
|
1095
1066
|
if (typeof err !== 'object' || err === null)
|
|
1096
1067
|
return null;
|
|
1097
|
-
let
|
|
1068
|
+
let index;
|
|
1069
|
+
let path;
|
|
1098
1070
|
const kind = readOwnDataValue(err, 'kind');
|
|
1099
1071
|
const plane = readOwnDataValue(err, 'plane');
|
|
1100
1072
|
if (kind === 'failed' && (plane === 'cause' || plane === 'flat')) {
|
|
@@ -1102,26 +1074,15 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
1102
1074
|
return null;
|
|
1103
1075
|
const cause = readOwnDataValue(err, 'detail');
|
|
1104
1076
|
const inner = typeof cause === 'object' && cause !== null && readOwnDataValue(cause, 'kind') === 'coded' ? readOwnDataValue(cause, 'detail') : undefined;
|
|
1105
|
-
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'));
|
|
1106
1080
|
}
|
|
1107
1081
|
else {
|
|
1108
1082
|
if (effectiveWireErrorCode(err) !== USER_ATTACHMENT_INVALID_ERROR_CODE)
|
|
1109
1083
|
return null;
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
let index;
|
|
1113
|
-
let path;
|
|
1114
|
-
try {
|
|
1115
|
-
index = facts === undefined ? undefined : readOwnDataValue(facts, 'index');
|
|
1116
|
-
}
|
|
1117
|
-
catch {
|
|
1118
|
-
index = undefined;
|
|
1119
|
-
}
|
|
1120
|
-
try {
|
|
1121
|
-
path = facts === undefined ? undefined : readOwnDataValue(facts, 'path');
|
|
1122
|
-
}
|
|
1123
|
-
catch {
|
|
1124
|
-
path = undefined;
|
|
1084
|
+
index = guardedRead(() => readErrorNumber(err, 'index'));
|
|
1085
|
+
path = guardedRead(() => readErrorString(err, 'field'));
|
|
1125
1086
|
}
|
|
1126
1087
|
return {
|
|
1127
1088
|
code: USER_ATTACHMENT_INVALID_ERROR_CODE,
|
|
@@ -1139,9 +1100,5 @@ export function userInvokedSkillRefusalFromError(err) {
|
|
|
1139
1100
|
}
|
|
1140
1101
|
const _pinRequestField = [true, true, true, true, true, true, true, true];
|
|
1141
1102
|
void _pinRequestField;
|
|
1142
|
-
const _pinSettingsHooks = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true];
|
|
1143
|
-
void _pinSettingsHooks;
|
|
1144
|
-
const _pinAttachment = [true, true, true];
|
|
1145
|
-
void _pinAttachment;
|
|
1146
1103
|
const _pinWallSource = [true, true, true];
|
|
1147
1104
|
void _pinWallSource;
|