@sema-agent/client-core 0.97.0 → 0.98.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 +429 -0
- package/README.md +74 -36
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +128 -34
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +5 -0
- package/dist/adapter/activeRunSelfHeal.js +51 -28
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +27 -34
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +29 -13
- package/dist/adapter/types.d.ts +4 -4
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentsWireCaps.d.ts +8 -6
- package/dist/agentsWireCaps.js +177 -162
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +4 -2
- package/dist/cloudConfigWireCaps.js +81 -61
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +14 -1
- package/dist/controlRouter.js +68 -17
- package/dist/coreValuePorts.d.ts +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +250 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +5 -4
- package/dist/engineAgentPanelStore.js +3 -12
- package/dist/engineCapReader.d.ts +0 -4
- package/dist/engineCapReader.js +1 -5
- package/dist/engineCapsCache.d.ts +4 -0
- package/dist/engineCapsCache.js +17 -12
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +9 -2
- package/dist/engineErrorCodes.js +9 -1
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +111 -0
- package/dist/engineSessionMessages.d.ts +67 -0
- package/dist/engineSessionMessages.js +364 -0
- package/dist/engineToolDirectory.d.ts +18 -0
- package/dist/engineToolDirectory.js +85 -0
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/env/uiLanguage.d.ts +9 -0
- package/dist/env/uiLanguage.js +35 -0
- package/dist/eventLeg.d.ts +92 -0
- package/dist/eventLeg.js +285 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +0 -4
- package/dist/fileHistoryCaptureCapability.js +5 -7
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +5 -0
- package/dist/frameBinding.js +23 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +25 -6
- package/dist/gateVocabulary.d.ts +5 -0
- package/dist/gateVocabulary.js +64 -2
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +6 -3
- package/dist/generated/engineFactTables.js +22 -4
- package/dist/generated/engineNoticeTables.js +9 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +6 -1
- package/dist/hitl/allowRuleShadow.js +21 -17
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +13 -0
- package/dist/hitl/approvalCardReasons.js +120 -0
- package/dist/hitl/approvalHolds.d.ts +47 -15
- package/dist/hitl/approvalHolds.js +134 -28
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +1 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +49 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +18 -0
- package/dist/hitl/askSettlementLine.js +79 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +21 -5
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +3 -1
- package/dist/hitl/crashConvergedNotice.js +48 -11
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +20 -16
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +1 -2
- package/dist/hitl/hitlBridge.js +10 -7
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +24 -0
- package/dist/hitl/persistedRulesWire.js +122 -2
- package/dist/hitl/planReviewWire.d.ts +26 -13
- package/dist/hitl/planReviewWire.js +112 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.js +2 -4
- package/dist/hitl/sessionPolicyWire.d.ts +32 -20
- package/dist/hitl/sessionPolicyWire.js +162 -52
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/toolApprovalWire.d.ts +87 -152
- package/dist/hitl/toolApprovalWire.js +591 -380
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +59 -55
- package/dist/i18n/messages.en.d.ts +121 -0
- package/dist/i18n/messages.en.js +119 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +120 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +53 -18
- package/dist/index.js +38 -10
- package/dist/inheritEnvCapability.d.ts +31 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/liveModelCatalog.d.ts +1 -2
- package/dist/liveModelCatalog.js +2 -6
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpProbeWire.d.ts +6 -1
- package/dist/mcpProbeWire.js +1 -1
- package/dist/mcpWireCaps.d.ts +13 -2
- package/dist/mcpWireCaps.js +48 -0
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +15 -0
- package/dist/ownKey.js +60 -3
- package/dist/panelReduce.d.ts +15 -9
- package/dist/panelReduce.js +680 -549
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRulesWriteCapability.d.ts +0 -4
- package/dist/permissionRulesWriteCapability.js +0 -6
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +1 -1
- package/dist/pluginHooksWire.js +3 -6
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +0 -1
- package/dist/request/taskRequest.js +0 -3
- package/dist/resumeRefusalCopy.d.ts +2 -1
- package/dist/resumeRefusalCopy.js +38 -2
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +106 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +24 -2
- package/dist/seam.js +15 -3
- package/dist/seatContract.d.ts +53 -10
- package/dist/seatContract.js +132 -81
- package/dist/sessionPolicyCapability.d.ts +0 -4
- package/dist/sessionPolicyCapability.js +0 -6
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/skillToolListsCapability.d.ts +0 -3
- package/dist/skillToolListsCapability.js +0 -3
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.js +1 -11
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +0 -2
- package/dist/toolRoster.js +0 -2
- package/dist/turnFailurePresentation.d.ts +28 -0
- package/dist/turnFailurePresentation.js +205 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -3
- package/dist/userInvokedSkillsCapability.js +0 -3
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.js +5 -24
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +105 -5
- package/dist/wireRefusalCopy.d.ts +12 -2
- package/dist/wireRefusalCopy.js +50 -52
- package/dist/workflowsJournalCapability.d.ts +0 -4
- package/dist/workflowsJournalCapability.js +0 -6
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1305 -46
- package/package.json +5 -4
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const frameBindings = new WeakMap();
|
|
2
|
+
export function registerFrameBinding(frame, binding) {
|
|
3
|
+
if (typeof frame !== 'object' || frame === null)
|
|
4
|
+
return;
|
|
5
|
+
if (binding.taskId === undefined && binding.sessionId === undefined)
|
|
6
|
+
return;
|
|
7
|
+
if (frameBindings.has(frame))
|
|
8
|
+
return;
|
|
9
|
+
frameBindings.set(frame, binding);
|
|
10
|
+
}
|
|
11
|
+
export function frameBindingOf(frame) {
|
|
12
|
+
if (typeof frame !== 'object' || frame === null)
|
|
13
|
+
return undefined;
|
|
14
|
+
return frameBindings.get(frame);
|
|
15
|
+
}
|
|
16
|
+
export function inheritFrameBinding(from, to) {
|
|
17
|
+
if (typeof from !== 'object' || from === null || typeof to !== 'object' || to === null || from === to)
|
|
18
|
+
return to;
|
|
19
|
+
const binding = frameBindings.get(from);
|
|
20
|
+
if (binding !== undefined && !frameBindings.has(to))
|
|
21
|
+
frameBindings.set(to, binding);
|
|
22
|
+
return to;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, PARKED_RESUME_STARTUP_FAILED, RESUME_POLICY_FOLD_CODE, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, isRefusedParkCode } from './engineErrorCodes.js';
|
|
2
|
+
import { RESUME_REFUSAL_CODES } from './resumeRefusalCopy.js';
|
|
3
|
+
export function isGateStandingErrorCode(code, retriable) {
|
|
4
|
+
return (code === RESUME_POLICY_FOLD_CODE ||
|
|
5
|
+
code === 'corrupt' ||
|
|
6
|
+
(isRefusedParkCode(code) && retriable === true) ||
|
|
7
|
+
(typeof code === 'string' && RESUME_REOPEN_CODES.includes(code) && retriable === true) ||
|
|
8
|
+
code === DECIDE_WORKFLOW_PARKS_UNREADABLE ||
|
|
9
|
+
code === DECIDE_WORKFLOW_PARK_FORKED);
|
|
10
|
+
}
|
|
11
|
+
export function isCodeClassifiedGateFailure(code, retriable) {
|
|
12
|
+
return (isGateStandingErrorCode(code, retriable) ||
|
|
13
|
+
code === PARKED_RESUME_STARTUP_FAILED ||
|
|
14
|
+
(typeof code === 'string' && (RESUME_RETRY_LATER_CODES.includes(code) || RESUME_REFUSAL_CODES.includes(code))));
|
|
15
|
+
}
|
package/dist/gateOutcome.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface GateModeReleaseView {
|
|
|
32
32
|
mandate?: string;
|
|
33
33
|
reason?: string;
|
|
34
34
|
}
|
|
35
|
-
export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["
|
|
35
|
+
export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["target_unresolved"];
|
|
36
36
|
export type GateModeReleaseReasonWord = (typeof CORE_MODE_RELEASE_REASONS)[number];
|
|
37
37
|
export declare function isGateModeReleaseReasonWord(v: unknown): v is GateModeReleaseReasonWord;
|
|
38
38
|
export declare function modeReleaseReasonSentence(reason: string | null | undefined): string | undefined;
|
|
@@ -58,10 +58,12 @@ export interface SettlementView {
|
|
|
58
58
|
when?: number;
|
|
59
59
|
note?: string;
|
|
60
60
|
}
|
|
61
|
+
export type GateRecordSeat = 'settlement' | 'cause' | 'classifier';
|
|
61
62
|
export interface GateOutcomeView {
|
|
62
63
|
disposition: GateDispositionView;
|
|
63
64
|
settlement?: SettlementView;
|
|
64
65
|
origin?: string;
|
|
66
|
+
unreadable?: readonly GateRecordSeat[];
|
|
65
67
|
}
|
|
66
68
|
export declare function gateOutcomeOf(frame: unknown): GateOutcomeView | undefined;
|
|
67
69
|
export declare function isGateParkedToolEnd(frame: unknown): boolean;
|
package/dist/gateOutcome.js
CHANGED
|
@@ -10,7 +10,6 @@ export function isGateModeReleaseReasonWord(v) {
|
|
|
10
10
|
return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
|
|
11
11
|
}
|
|
12
12
|
const MODE_RELEASE_SENTENCE_BY_REASON = Object.freeze({
|
|
13
|
-
rule_unreadable: 'The permission mode let this call run without asking, even though it could not be checked against your saved permission rules.',
|
|
14
13
|
target_unresolved: 'The permission mode let this call run without asking, even though it could not be determined where its write lands on disk, so whether it lands on a guarded location is unknown.',
|
|
15
14
|
});
|
|
16
15
|
const MODE_RELEASE_UNRECOGNISED_SENTENCE = 'The permission mode let this call run without asking, for a reason this client does not recognise.';
|
|
@@ -65,6 +64,9 @@ export function createReleaseDisclosureLedger() {
|
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
|
|
67
|
+
function isGateRecordSeat(x) {
|
|
68
|
+
return x === 'settlement' || x === 'cause' || x === 'classifier';
|
|
69
|
+
}
|
|
68
70
|
function readWho(v) {
|
|
69
71
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
70
72
|
return undefined;
|
|
@@ -151,6 +153,15 @@ function readClassifierRound(raw) {
|
|
|
151
153
|
}
|
|
152
154
|
return view;
|
|
153
155
|
}
|
|
156
|
+
function carriedUnreadableSeats(v) {
|
|
157
|
+
const out = new Set();
|
|
158
|
+
if (!Array.isArray(v))
|
|
159
|
+
return out;
|
|
160
|
+
for (const x of v)
|
|
161
|
+
if (isGateRecordSeat(x))
|
|
162
|
+
out.add(x);
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
154
165
|
function readGateRecord(frame) {
|
|
155
166
|
if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
|
|
156
167
|
return undefined;
|
|
@@ -158,6 +169,7 @@ function readGateRecord(frame) {
|
|
|
158
169
|
if (typeof g !== 'object' || g === null || Array.isArray(g))
|
|
159
170
|
return undefined;
|
|
160
171
|
const raw = g;
|
|
172
|
+
const carried = carriedUnreadableSeats(raw.unreadable);
|
|
161
173
|
const d = raw.disposition;
|
|
162
174
|
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
163
175
|
return undefined;
|
|
@@ -180,7 +192,7 @@ function readGateRecord(frame) {
|
|
|
180
192
|
if (deniedBy === undefined)
|
|
181
193
|
return undefined;
|
|
182
194
|
const causeRaw = dr.cause;
|
|
183
|
-
causePresent = causeRaw !== undefined;
|
|
195
|
+
causePresent = causeRaw !== undefined || carried.has('cause');
|
|
184
196
|
const cause = str(causeRaw);
|
|
185
197
|
const mode = str(dr.mode);
|
|
186
198
|
const askClass = str(dr.askClass);
|
|
@@ -201,15 +213,24 @@ function readGateRecord(frame) {
|
|
|
201
213
|
const settlementRaw = raw.settlement;
|
|
202
214
|
const settlement = readSettlement(settlementRaw);
|
|
203
215
|
const origin = readAskOrigin(raw);
|
|
216
|
+
const settlementPresent = settlementRaw !== undefined || carried.has('settlement');
|
|
217
|
+
const classifierPresent = classifierRaw !== undefined || carried.has('classifier');
|
|
218
|
+
const missing = {
|
|
219
|
+
settlement: settlementPresent && settlement === undefined,
|
|
220
|
+
cause: causePresent && disposition.kind === 'denied' && disposition.cause === undefined,
|
|
221
|
+
classifier: classifierPresent && disposition.classifier === undefined,
|
|
222
|
+
};
|
|
223
|
+
const unreadable = Object.keys(missing).filter((seat) => missing[seat]);
|
|
204
224
|
return {
|
|
205
225
|
view: {
|
|
206
226
|
disposition,
|
|
207
227
|
...(settlement !== undefined ? { settlement } : {}),
|
|
208
228
|
...(origin !== undefined ? { origin } : {}),
|
|
229
|
+
...(unreadable.length > 0 ? { unreadable: Object.freeze(unreadable) } : {}),
|
|
209
230
|
},
|
|
210
|
-
settlementPresent
|
|
231
|
+
settlementPresent,
|
|
211
232
|
causePresent,
|
|
212
|
-
classifierPresent
|
|
233
|
+
classifierPresent,
|
|
213
234
|
};
|
|
214
235
|
}
|
|
215
236
|
export function gateOutcomeOf(frame) {
|
|
@@ -257,8 +278,6 @@ export function ccToolDenialKindForToolEnd(frame) {
|
|
|
257
278
|
const stamped = frame._sema_denial_kind;
|
|
258
279
|
if (isCcToolDenialKind(stamped))
|
|
259
280
|
return stamped;
|
|
260
|
-
if (frame._sema_denial_unclassified === true)
|
|
261
|
-
return undefined;
|
|
262
281
|
const record = readGateRecord(frame);
|
|
263
282
|
const outcome = record?.view;
|
|
264
283
|
const kind = outcome?.settlement?.kind;
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export declare const GATE_DENIED_BY_WORDS: readonly GateDeniedByWord[];
|
|
|
9
9
|
export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
|
|
10
10
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
11
11
|
export declare function askOriginDetail(origin: unknown): string;
|
|
12
|
+
export declare function askOriginNoteOf(origin: string | undefined): string | undefined;
|
|
13
|
+
export declare function ruleOffersAbsenceDetail(reason: string | undefined, opts?: {
|
|
14
|
+
readonly deploymentListSessionRow?: boolean;
|
|
15
|
+
}): string | undefined;
|
|
16
|
+
export declare function ruleOfferUncoveredDetail(reason: string | undefined): string;
|
|
12
17
|
export declare function mandatedApprovalDetail(): string;
|
|
13
18
|
export declare const APPROVAL_MANDATE_WORDS: readonly (typeof CORE_PERSISTED_RULE_MANDATES)[number][];
|
|
14
19
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
package/dist/gateVocabulary.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
|
|
2
|
+
import { guardedRead, readOwnDataValue } from './ownKey.js';
|
|
2
3
|
export const CC_TOOL_DENIAL_KINDS = Object.freeze([
|
|
3
4
|
'user-rejected',
|
|
4
5
|
'permission-rule',
|
|
@@ -48,6 +49,7 @@ export function gateDeniedByDetail(deniedBy) {
|
|
|
48
49
|
}
|
|
49
50
|
const ASK_ORIGIN_SENTENCES = Object.freeze({
|
|
50
51
|
content_question: 'the tool itself asked you a question',
|
|
52
|
+
plan_review: 'the model paused its run for your verdict on the plan it proposed',
|
|
51
53
|
ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate; this client cannot tell which from the origin alone): it must reach the park with no synchronous decision-maker in between',
|
|
52
54
|
org_unavailable: 'the organization policy was unavailable, so this call asks',
|
|
53
55
|
org_rule: 'an organization rule asks about this call',
|
|
@@ -57,7 +59,7 @@ const ASK_ORIGIN_SENTENCES = Object.freeze({
|
|
|
57
59
|
denial_limit_fallback: 'the auto-mode classifier hit its denial limit and handed this call back to you',
|
|
58
60
|
shell_gate_tighten: 'the coarse shell check rates this command above the tier it lets through, so it asks',
|
|
59
61
|
safety_tighten: 'the gate tightened on this call’s own facts (network egress, irreversibility, or a protected write; this client cannot tell which from the origin alone)',
|
|
60
|
-
policy: 'this deployment’s permission policy asks about this call',
|
|
62
|
+
policy: 'this deployment’s permission policy, or the permission mode’s default, asks about this call',
|
|
61
63
|
});
|
|
62
64
|
export function askOriginDetail(origin) {
|
|
63
65
|
const known = typeof origin === 'string' && Object.hasOwn(ASK_ORIGIN_SENTENCES, origin)
|
|
@@ -66,7 +68,67 @@ export function askOriginDetail(origin) {
|
|
|
66
68
|
if (known !== undefined)
|
|
67
69
|
return known;
|
|
68
70
|
const word = typeof origin === 'string' && origin.length > 0 ? origin : '(none)';
|
|
69
|
-
return
|
|
71
|
+
return unknownAskOriginSentence(word);
|
|
72
|
+
}
|
|
73
|
+
function unknownAskOriginSentence(word) {
|
|
74
|
+
return `this call asks; its origin ${word === undefined ? '' : `${word} `}is a word newer than this client, so answer it as usual`;
|
|
75
|
+
}
|
|
76
|
+
const ASK_ORIGIN_QUIET = Object.freeze({
|
|
77
|
+
content_question: true,
|
|
78
|
+
plan_review: true,
|
|
79
|
+
ancestor_marked: false,
|
|
80
|
+
org_unavailable: false,
|
|
81
|
+
org_rule: false,
|
|
82
|
+
rule_store_unavailable: false,
|
|
83
|
+
hook: false,
|
|
84
|
+
ask_rule: true,
|
|
85
|
+
denial_limit_fallback: false,
|
|
86
|
+
shell_gate_tighten: false,
|
|
87
|
+
safety_tighten: false,
|
|
88
|
+
policy: true,
|
|
89
|
+
});
|
|
90
|
+
export function askOriginNoteOf(origin) {
|
|
91
|
+
if (typeof origin !== 'string' || origin === '')
|
|
92
|
+
return undefined;
|
|
93
|
+
if (Object.hasOwn(ASK_ORIGIN_QUIET, origin)) {
|
|
94
|
+
return ASK_ORIGIN_QUIET[origin] === true ? undefined : askOriginDetail(origin);
|
|
95
|
+
}
|
|
96
|
+
return unknownAskOriginSentence(undefined);
|
|
97
|
+
}
|
|
98
|
+
const NO_REMEMBER_HEAD = 'no "don\'t ask again" option here';
|
|
99
|
+
const RULE_OFFERS_ABSENCE_LINES = Object.freeze({
|
|
100
|
+
mandated: { line: null },
|
|
101
|
+
allow_outranked: {
|
|
102
|
+
line: `${NO_REMEMBER_HEAD}: an allow rule already matches this call, but this question outranks it — another allow rule would be outranked the same way`,
|
|
103
|
+
},
|
|
104
|
+
ask_rule_matched: {
|
|
105
|
+
line: `${NO_REMEMBER_HEAD}: an ask rule matches this call and keeps asking — an allow rule changes nothing while it stands; to stop being asked, review your ask rules`,
|
|
106
|
+
deploymentList: `${NO_REMEMBER_HEAD}: this deployment asks about every call to this tool and your own rules cannot switch that off — the "in this session" option stops it asking again until the session ends`,
|
|
107
|
+
},
|
|
108
|
+
lane_cannot_speak: { line: `${NO_REMEMBER_HEAD}: this approval lane cannot persist rules` },
|
|
109
|
+
});
|
|
110
|
+
export function ruleOffersAbsenceDetail(reason, opts) {
|
|
111
|
+
if (typeof reason !== 'string' || reason === '')
|
|
112
|
+
return undefined;
|
|
113
|
+
if (Object.hasOwn(RULE_OFFERS_ABSENCE_LINES, reason)) {
|
|
114
|
+
const entry = RULE_OFFERS_ABSENCE_LINES[reason];
|
|
115
|
+
if (entry.line === null)
|
|
116
|
+
return undefined;
|
|
117
|
+
const onList = guardedRead(() => readOwnDataValue(opts, 'deploymentListSessionRow')) === true;
|
|
118
|
+
return onList && entry.deploymentList !== undefined ? entry.deploymentList : entry.line;
|
|
119
|
+
}
|
|
120
|
+
return `${NO_REMEMBER_HEAD} (the reason is one this build does not know yet)`;
|
|
121
|
+
}
|
|
122
|
+
const RULE_OFFER_UNCOVERED_LINES = Object.freeze({
|
|
123
|
+
redirection: 'always asks (shell redirection)',
|
|
124
|
+
no_rule_form: 'no coverable rule form',
|
|
125
|
+
cap_overflow: 'trimmed by the offer cap',
|
|
126
|
+
});
|
|
127
|
+
export function ruleOfferUncoveredDetail(reason) {
|
|
128
|
+
if (typeof reason === 'string' && Object.hasOwn(RULE_OFFER_UNCOVERED_LINES, reason)) {
|
|
129
|
+
return RULE_OFFER_UNCOVERED_LINES[reason];
|
|
130
|
+
}
|
|
131
|
+
return 'a reason this build does not know yet';
|
|
70
132
|
}
|
|
71
133
|
export function mandatedApprovalDetail() {
|
|
72
134
|
return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here or by an automatic check the deployment runs — and an answer covers only that call';
|
|
@@ -7,6 +7,6 @@ export const CORE_SHELL_FACE_TOOL_NAMES = Object.freeze([
|
|
|
7
7
|
"Monitor",
|
|
8
8
|
]);
|
|
9
9
|
export const CORE_RELEASABLE_ASK_CLASSES_BY_FACE = Object.freeze({
|
|
10
|
-
"shell": Object.freeze(["transcript_write", "
|
|
11
|
-
"other": Object.freeze(["transcript_write", "
|
|
10
|
+
"shell": Object.freeze(["transcript_write", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
11
|
+
"other": Object.freeze(["transcript_write", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
12
12
|
});
|
|
@@ -8,7 +8,7 @@ export declare const CORE_DENIED_BY_VALUES: readonly ["policy", "hook", "org", "
|
|
|
8
8
|
export declare const CORE_PERMISSION_MODE_FOLD_REASONS: readonly string[];
|
|
9
9
|
export declare const CORE_ENGINE_CARD_TYPES: readonly string[];
|
|
10
10
|
export declare const CORE_TOOL_DECLARATION_CODES: readonly string[];
|
|
11
|
-
export declare const CORE_MODE_RELEASE_REASONS: readonly ["
|
|
11
|
+
export declare const CORE_MODE_RELEASE_REASONS: readonly ["target_unresolved"];
|
|
12
12
|
export declare const CORE_HOOK_TOOL_ALIASES: Readonly<Record<string, string>>;
|
|
13
13
|
export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
|
|
14
14
|
export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
|
|
@@ -21,9 +21,9 @@ export interface CoreModeArbitrationRow {
|
|
|
21
21
|
readonly ruleMayClear: boolean;
|
|
22
22
|
readonly hookAskFloor: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "
|
|
24
|
+
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
|
|
25
25
|
export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
|
|
26
|
-
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
|
|
26
|
+
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"];
|
|
27
27
|
export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
|
|
28
28
|
export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
|
|
29
29
|
export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
|
|
@@ -42,3 +42,6 @@ export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "ti
|
|
|
42
42
|
export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
43
43
|
export declare const CORE_APPROVAL_REACH: readonly ["none"];
|
|
44
44
|
export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
|
|
45
|
+
export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
|
|
46
|
+
export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "tool_unavailable", "configuration", "decision_rejected"];
|
|
47
|
+
export declare const CORE_BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
|
|
@@ -112,7 +112,6 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
|
|
|
112
112
|
"config.reserved_tool_name",
|
|
113
113
|
]);
|
|
114
114
|
export const CORE_MODE_RELEASE_REASONS = Object.freeze([
|
|
115
|
-
"rule_unreadable",
|
|
116
115
|
"target_unresolved",
|
|
117
116
|
]);
|
|
118
117
|
export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
|
|
@@ -146,12 +145,11 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
146
145
|
"hook": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
147
146
|
"ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
148
147
|
"dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
149
|
-
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible:
|
|
148
|
+
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
149
|
"unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
151
150
|
"transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
152
151
|
"org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
153
|
-
"
|
|
154
|
-
"rule_unreadable": Object.freeze({ bypassImmune: false, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
152
|
+
"rule_unreadable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
155
153
|
"ask_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
156
154
|
"denial_limit_fallback": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
157
155
|
"classifier_no_ruling": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -181,6 +179,7 @@ export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
|
|
|
181
179
|
"grammar",
|
|
182
180
|
"tool_name",
|
|
183
181
|
"near_miss",
|
|
182
|
+
"earlier_grammar",
|
|
184
183
|
]);
|
|
185
184
|
export const CORE_ALLOW_RULE_MEMBERS = Object.freeze([
|
|
186
185
|
"hook",
|
|
@@ -281,3 +280,22 @@ export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
|
|
|
281
280
|
"write_protection",
|
|
282
281
|
"target_unresolved",
|
|
283
282
|
]);
|
|
283
|
+
export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze([
|
|
284
|
+
"completed",
|
|
285
|
+
"failed",
|
|
286
|
+
"killed",
|
|
287
|
+
"cancelled",
|
|
288
|
+
]);
|
|
289
|
+
export const CORE_RESUME_STARTUP_CAUSES = Object.freeze([
|
|
290
|
+
"environment",
|
|
291
|
+
"session_gone",
|
|
292
|
+
"tool_unavailable",
|
|
293
|
+
"configuration",
|
|
294
|
+
"decision_rejected",
|
|
295
|
+
]);
|
|
296
|
+
export const CORE_BUILTIN_SUBAGENT_TYPES = Object.freeze([
|
|
297
|
+
"Explore",
|
|
298
|
+
"Plan",
|
|
299
|
+
"fork",
|
|
300
|
+
"general-purpose",
|
|
301
|
+
]);
|
|
@@ -8,6 +8,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
8
8
|
"config.read_face_deployment_clamped",
|
|
9
9
|
"config.write_face_swapped",
|
|
10
10
|
"config.write_face_deployment_clamped",
|
|
11
|
+
"config.read_deny_swapped",
|
|
11
12
|
"config.tool_model_gate_removed",
|
|
12
13
|
"config.tool_model_gate_unknown_class",
|
|
13
14
|
"config.tool_model_gate_env_invalid",
|
|
@@ -85,10 +86,12 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
85
86
|
"skills.listing_truncated",
|
|
86
87
|
"agents.listing_truncated",
|
|
87
88
|
"tool_result.offload_put_failed",
|
|
89
|
+
"tool_result.media_refused",
|
|
88
90
|
"instructions.source_changed",
|
|
89
91
|
"session.records_skipped",
|
|
90
92
|
"memory.layer_locked_legacy",
|
|
91
93
|
"server.model_unreachable",
|
|
94
|
+
"permission.entry_mode_clamped",
|
|
92
95
|
]);
|
|
93
96
|
export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
94
97
|
"config.autocompact_window_clamped": "operator",
|
|
@@ -100,6 +103,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
100
103
|
"config.read_face_deployment_clamped": "operator",
|
|
101
104
|
"config.write_face_swapped": "operator",
|
|
102
105
|
"config.write_face_deployment_clamped": "operator",
|
|
106
|
+
"config.read_deny_swapped": "operator",
|
|
103
107
|
"config.tool_model_gate_removed": "operator",
|
|
104
108
|
"config.tool_model_gate_unknown_class": "operator",
|
|
105
109
|
"config.tool_model_gate_env_invalid": "operator",
|
|
@@ -177,10 +181,12 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
177
181
|
"skills.listing_truncated": "operator",
|
|
178
182
|
"agents.listing_truncated": "operator",
|
|
179
183
|
"tool_result.offload_put_failed": "operator",
|
|
184
|
+
"tool_result.media_refused": "operator",
|
|
180
185
|
"instructions.source_changed": "user",
|
|
181
186
|
"session.records_skipped": "user",
|
|
182
187
|
"memory.layer_locked_legacy": "operator",
|
|
183
188
|
"server.model_unreachable": "user",
|
|
189
|
+
"permission.entry_mode_clamped": "user",
|
|
184
190
|
});
|
|
185
191
|
export const CORE_MCP_INJECTION_DROP_REASONS = Object.freeze([
|
|
186
192
|
"malformed_entry",
|
|
@@ -198,6 +204,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
198
204
|
"config.read_face_deployment_clamped": "engine",
|
|
199
205
|
"config.write_face_swapped": "engine",
|
|
200
206
|
"config.write_face_deployment_clamped": "engine",
|
|
207
|
+
"config.read_deny_swapped": "engine",
|
|
201
208
|
"config.tool_model_gate_removed": "engine",
|
|
202
209
|
"config.tool_model_gate_unknown_class": "engine",
|
|
203
210
|
"config.tool_model_gate_env_invalid": "engine",
|
|
@@ -275,10 +282,12 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
275
282
|
"skills.listing_truncated": "engine",
|
|
276
283
|
"agents.listing_truncated": "engine",
|
|
277
284
|
"tool_result.offload_put_failed": "engine",
|
|
285
|
+
"tool_result.media_refused": "engine",
|
|
278
286
|
"instructions.source_changed": "server",
|
|
279
287
|
"session.records_skipped": "server",
|
|
280
288
|
"memory.layer_locked_legacy": "server",
|
|
281
289
|
"server.model_unreachable": "server",
|
|
290
|
+
"permission.entry_mode_clamped": "server",
|
|
282
291
|
});
|
|
283
292
|
export const CORE_USER_INPUT_UNDRAINED_CAUSES = Object.freeze([
|
|
284
293
|
"leg_end",
|
|
@@ -11,10 +11,15 @@ export interface AllowRuleShadowedWireMember {
|
|
|
11
11
|
readonly omitted?: number;
|
|
12
12
|
}
|
|
13
13
|
export interface ApprovalAllowRuleShadow {
|
|
14
|
-
readonly source: 'allow_rule_shadowed'
|
|
14
|
+
readonly source: 'allow_rule_shadowed';
|
|
15
15
|
readonly members: readonly ApprovalAllowRuleShadowMember[];
|
|
16
16
|
readonly unreadable?: true;
|
|
17
17
|
}
|
|
18
|
+
export declare const RETIRED_SHADOW_EVIDENCE_LABEL: Readonly<{
|
|
19
|
+
readonly frame: "persistedRuleShadowed";
|
|
20
|
+
readonly row: "riskDescriptor.shadowedRule";
|
|
21
|
+
}>;
|
|
22
|
+
export declare function retiredAllowRuleShadowKeyPresent(carrier: object | null | undefined, leg: 'frame' | 'row'): boolean;
|
|
18
23
|
export declare function readAllowRuleShadowFromWire(carrier: object | null | undefined, leg: 'frame' | 'row'): ApprovalAllowRuleShadow | undefined;
|
|
19
24
|
export declare function readApprovalAllowRuleShadow(card: object | null | undefined): ApprovalAllowRuleShadow | undefined;
|
|
20
25
|
export declare function approvalAllowRuleShadowed(card: object | null | undefined): boolean;
|
|
@@ -76,20 +76,27 @@ function readNewKeyValue(raw) {
|
|
|
76
76
|
return unreadable();
|
|
77
77
|
return Object.freeze({ source: 'allow_rule_shadowed', members: Object.freeze(members) });
|
|
78
78
|
}
|
|
79
|
-
function readLegacyValue(raw) {
|
|
80
|
-
if (typeof raw !== 'string' || raw.trim() === '')
|
|
81
|
-
return undefined;
|
|
82
|
-
return Object.freeze({
|
|
83
|
-
source: 'legacy_shadowed_rule',
|
|
84
|
-
members: Object.freeze([freezeMember({ member: 'persisted', known: true, entries: Object.freeze([raw]) })]),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
79
|
function ownValue(v, key) {
|
|
88
80
|
return Object.hasOwn(v, key) ? v[key] : undefined;
|
|
89
81
|
}
|
|
90
82
|
function keyValue(v, key) {
|
|
91
83
|
return v[key];
|
|
92
84
|
}
|
|
85
|
+
const RETIRED_SHADOW_KEY = Object.freeze({ frame: 'persistedRuleShadowed', row: 'shadowedRule' });
|
|
86
|
+
export const RETIRED_SHADOW_EVIDENCE_LABEL = Object.freeze({ frame: 'persistedRuleShadowed', row: 'riskDescriptor.shadowedRule' });
|
|
87
|
+
export function retiredAllowRuleShadowKeyPresent(carrier, leg) {
|
|
88
|
+
try {
|
|
89
|
+
if (typeof carrier !== 'object' || carrier === null)
|
|
90
|
+
return false;
|
|
91
|
+
const host = leg === 'row' ? keyValue(carrier, 'riskDescriptor') : carrier;
|
|
92
|
+
if (typeof host !== 'object' || host === null)
|
|
93
|
+
return false;
|
|
94
|
+
return RETIRED_SHADOW_KEY[leg] in host;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
93
100
|
function readMemberAt(arr, i) {
|
|
94
101
|
const d = Object.getOwnPropertyDescriptor(arr, i);
|
|
95
102
|
return d !== undefined && 'value' in d ? readMemberRecord(d.value) : freezeMember({ known: false, malformed: true });
|
|
@@ -105,10 +112,7 @@ export function readAllowRuleShadowFromWire(carrier, leg) {
|
|
|
105
112
|
}
|
|
106
113
|
if (host === undefined)
|
|
107
114
|
return undefined;
|
|
108
|
-
|
|
109
|
-
if (fresh !== undefined)
|
|
110
|
-
return fresh;
|
|
111
|
-
return readLegacyValue(keyValue(host, leg === 'row' ? 'shadowedRule' : 'persistedRuleShadowed'));
|
|
115
|
+
return readNewKeyValue(keyValue(host, 'allowRuleShadowed'));
|
|
112
116
|
}
|
|
113
117
|
catch {
|
|
114
118
|
return unreadable();
|
|
@@ -119,7 +123,7 @@ function readStampedValue(raw) {
|
|
|
119
123
|
return unreadable();
|
|
120
124
|
const source = ownValue(raw, 'source');
|
|
121
125
|
const members = ownValue(raw, 'members');
|
|
122
|
-
if (
|
|
126
|
+
if (source !== 'allow_rule_shadowed' || !Array.isArray(members))
|
|
123
127
|
return unreadable();
|
|
124
128
|
const length = members.length;
|
|
125
129
|
if (typeof length !== 'number' || !Number.isSafeInteger(length))
|
|
@@ -159,7 +163,7 @@ const ENTRY_MAX = 4096;
|
|
|
159
163
|
const MEMBER_MAX = 64;
|
|
160
164
|
const ENTRIES_SHOWN = 5;
|
|
161
165
|
const UNREADABLE_LINE = 'An allow rule matched this call but cannot clear it; which rule could not be read, so this one is confirmed individually.';
|
|
162
|
-
function
|
|
166
|
+
function singlePersistedEntry(shadow) {
|
|
163
167
|
if (shadow.unreadable === true || shadow.members.length !== 1)
|
|
164
168
|
return undefined;
|
|
165
169
|
const m = shadow.members[0];
|
|
@@ -196,9 +200,9 @@ export function allowRuleShadowSentence(card) {
|
|
|
196
200
|
try {
|
|
197
201
|
if (shadow.unreadable === true || shadow.members.length === 0)
|
|
198
202
|
return UNREADABLE_LINE;
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
return `Your saved permission rule ${
|
|
203
|
+
const single = singlePersistedEntry(shadow);
|
|
204
|
+
if (single !== undefined) {
|
|
205
|
+
return `Your saved permission rule ${single} still exists — it just cannot clear this particular call, so this one is confirmed individually.`;
|
|
202
206
|
}
|
|
203
207
|
return `Allow rules matched this call but cannot clear it, so this one is confirmed individually — ${shadow.members.map(memberPhrase).join(' · ')}.`;
|
|
204
208
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApprovalCardRequest } from './toolApprovalWire.js';
|
|
2
|
+
export declare function readRequiresRealApproval(carrier: object | null | undefined): boolean;
|
|
3
|
+
export interface ApprovalWindowKeys {
|
|
4
|
+
readonly expiresInMs?: number;
|
|
5
|
+
readonly expiresAtMs?: number;
|
|
6
|
+
readonly serverNowMs?: number;
|
|
7
|
+
readonly receivedAtMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ApprovalWindowReadOpts {
|
|
10
|
+
readonly windowIsCurrent?: boolean;
|
|
11
|
+
readonly receivedAtMs?: number;
|
|
12
|
+
readonly unknownShape?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function approvalWindowKeysOf(carrier: object | null | undefined, opts?: ApprovalWindowReadOpts | null): Readonly<ApprovalWindowKeys>;
|
|
15
|
+
export declare function probeCauseRowsOf(card: Pick<ApprovalCardRequest, 'probeCause'> | null | undefined): readonly string[] | undefined;
|