@sema-agent/client-core 0.95.0 → 0.97.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 +269 -0
- package/README.md +61 -31
- package/dist/adapt/arms.js +7 -1
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +16 -3
- package/dist/adapt/wireShapes.js +2 -16
- package/dist/adapter/activeRunSelfHeal.d.ts +4 -2
- package/dist/adapter/activeRunSelfHeal.js +32 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +11 -3
- package/dist/adapter/downstream/terminalToSdkResult.js +14 -11
- package/dist/adapter/runStream.js +30 -47
- package/dist/agentSession/backgroundView.js +2 -15
- package/dist/agentSession/engineAgentRegistryRead.js +5 -4
- package/dist/agentSession/engineSessionBackgroundStop.js +22 -15
- package/dist/agentsWireCaps.d.ts +1 -1
- package/dist/agentsWireCaps.js +29 -12
- package/dist/approvalDecidedByCapability.d.ts +2 -0
- package/dist/approvalDecidedByCapability.js +0 -1
- package/dist/approvalsStreamLiveCapability.d.ts +2 -0
- package/dist/approvalsStreamLiveCapability.js +3 -2
- package/dist/attachmentSeatCapability.d.ts +2 -0
- package/dist/attachmentSeatCapability.js +0 -1
- package/dist/callerCwdCapability.d.ts +2 -4
- package/dist/callerCwdCapability.js +0 -7
- package/dist/centerWiringCapability.d.ts +2 -4
- package/dist/centerWiringCapability.js +4 -9
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +4 -4
- package/dist/cloudConfigWireCaps.js +241 -85
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/decideFailureNote.js +3 -1
- package/dist/decideReceipt.js +7 -10
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/deviceExecutorManagementCapability.d.ts +2 -0
- package/dist/deviceExecutorManagementCapability.js +3 -2
- package/dist/displayUntrusted.d.ts +10 -3
- package/dist/displayUntrusted.js +371 -60
- package/dist/engineCapReader.d.ts +8 -2
- package/dist/engineCapReader.js +15 -7
- package/dist/engineCapsCache.d.ts +17 -3
- package/dist/engineCapsCache.js +268 -43
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineErrorCodes.d.ts +17 -1
- package/dist/engineErrorCodes.js +46 -16
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +54 -1
- package/dist/executionLaneCapability.d.ts +2 -0
- package/dist/executionLaneCapability.js +3 -2
- package/dist/fileHistoryCaptureCapability.d.ts +16 -0
- package/dist/fileHistoryCaptureCapability.js +98 -2
- package/dist/fileHistoryLegNotice.js +4 -0
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +1 -0
- package/dist/fleet/fleetLedger.js +164 -126
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +10 -3
- package/dist/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +56 -1
- package/dist/gateVocabulary.d.ts +2 -2
- package/dist/gateVocabulary.js +4 -3
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +7 -0
- package/dist/generated/settingsSchemaFns.d.ts +3 -0
- package/dist/generated/settingsSchemaFns.js +53 -0
- package/dist/generated/toolNameTables.d.ts +1 -1
- package/dist/generated/toolNameTables.js +1 -42
- package/dist/hitl/approvalDecisionNoteAudit.js +2 -2
- package/dist/hitl/approvalEndingCause.d.ts +2 -0
- package/dist/hitl/approvalEndingCause.js +26 -21
- package/dist/hitl/approvalHolds.d.ts +16 -1
- package/dist/hitl/approvalHolds.js +52 -12
- package/dist/hitl/askGateWire.js +1 -0
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +13 -10
- package/dist/hitl/decisionConflict.js +4 -5
- package/dist/hitl/decisionRefusal.d.ts +8 -0
- package/dist/hitl/decisionRefusal.js +55 -14
- package/dist/hitl/frameRouter.d.ts +3 -1
- package/dist/hitl/frameRouter.js +58 -39
- package/dist/hitl/gateLedger.d.ts +0 -5
- package/dist/hitl/gateLedger.js +0 -21
- package/dist/hitl/hitlBridge.d.ts +6 -2
- package/dist/hitl/hitlBridge.js +46 -11
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkResolver.d.ts +1 -0
- package/dist/hitl/parkResolver.js +14 -56
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/planReviewWire.d.ts +1 -0
- package/dist/hitl/planReviewWire.js +98 -20
- package/dist/hitl/replayedApproval.d.ts +3 -3
- package/dist/hitl/replayedApproval.js +21 -16
- package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
- package/dist/hitl/sessionPolicyDeliverable.js +17 -17
- package/dist/hitl/sessionPolicyWire.d.ts +2 -0
- package/dist/hitl/sessionPolicyWire.js +15 -3
- package/dist/hitl/standingRows.d.ts +19 -0
- package/dist/hitl/standingRows.js +148 -0
- package/dist/hitl/suspendedReopen.js +2 -1
- package/dist/hitl/toolApprovalWire.d.ts +22 -10
- package/dist/hitl/toolApprovalWire.js +286 -47
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +2 -2
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +6 -0
- package/dist/index.d.ts +26 -12
- package/dist/index.js +20 -10
- package/dist/liveModelCatalog.d.ts +13 -0
- package/dist/liveModelCatalog.js +56 -0
- package/dist/mcpProbeCapability.d.ts +2 -4
- package/dist/mcpProbeCapability.js +3 -8
- package/dist/mcpWireCaps.d.ts +1 -0
- package/dist/mcpWireCaps.js +4 -1
- package/dist/memoryComplianceCapability.d.ts +2 -4
- package/dist/memoryComplianceCapability.js +3 -8
- package/dist/memoryOriginCapability.d.ts +2 -4
- package/dist/memoryOriginCapability.js +3 -8
- package/dist/memorySpecWire.js +2 -2
- package/dist/modelIdentityResolvability.d.ts +2 -2
- package/dist/modelIdentityResolvability.js +14 -5
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/outputStyleSeatCapability.d.ts +2 -1
- package/dist/outputStyleSeatCapability.js +0 -4
- package/dist/ownKey.d.ts +2 -0
- package/dist/ownKey.js +18 -0
- package/dist/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +2 -0
- package/dist/peerLaneCapability.js +3 -2
- package/dist/permissionModesCapability.d.ts +2 -4
- package/dist/permissionModesCapability.js +0 -7
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +2 -0
- package/dist/permissionRulesWriteCapability.js +3 -2
- package/dist/permissionsAllowGrantCapability.d.ts +2 -0
- package/dist/permissionsAllowGrantCapability.js +4 -2
- package/dist/permissionsDeclaration.d.ts +2 -0
- package/dist/permissionsDeclaration.js +72 -59
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -9
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/request/taskRequest.d.ts +1 -4
- package/dist/request/taskRequest.js +74 -19
- package/dist/resumeRefusalCopy.js +9 -25
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +3 -13
- package/dist/rewindArchiveCapability.js +12 -58
- package/dist/rewindArchiveReading.d.ts +17 -0
- package/dist/rewindArchiveReading.js +55 -0
- package/dist/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +48 -5
- package/dist/runTerminal.js +215 -12
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkWireTransit.d.ts +2 -1
- package/dist/sdkWireTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +2 -4
- package/dist/sealedKeyCapability.js +0 -7
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +76 -11
- package/dist/seatContract.js +222 -27
- package/dist/sessionPolicyCapability.d.ts +2 -0
- package/dist/sessionPolicyCapability.js +3 -2
- package/dist/sessionReadRedactionCapability.d.ts +2 -4
- package/dist/sessionReadRedactionCapability.js +0 -7
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +2 -1
- package/dist/sessionSyncFileHistoryCapability.js +3 -5
- package/dist/skillToolListsCapability.d.ts +2 -1
- package/dist/skillToolListsCapability.js +3 -5
- package/dist/sqlEngineCapability.d.ts +2 -0
- package/dist/sqlEngineCapability.js +4 -3
- package/dist/steerPriorityCapability.d.ts +2 -1
- package/dist/steerPriorityCapability.js +3 -5
- package/dist/storePostureCapability.d.ts +2 -4
- package/dist/storePostureCapability.js +4 -9
- package/dist/subagent/engineSubagentSteer.js +7 -5
- package/dist/subagentContentStore.js +4 -15
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +13 -9
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/toolHistoryBadTurn.js +3 -2
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +12 -1
- package/dist/toolResult.js +55 -1
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/usageAnalytics.js +40 -16
- package/dist/userInvokedSkillsCapability.d.ts +2 -1
- package/dist/userInvokedSkillsCapability.js +3 -5
- package/dist/webSearchBackendCapability.d.ts +2 -0
- package/dist/webSearchBackendCapability.js +3 -2
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +91 -38
- package/dist/wireFailureShape.d.ts +20 -3
- package/dist/wireFailureShape.js +128 -72
- package/dist/workflowsJournalCapability.d.ts +2 -0
- package/dist/workflowsJournalCapability.js +3 -2
- package/dist/writeProtectionCapability.d.ts +2 -0
- package/dist/writeProtectionCapability.js +3 -2
- package/docs/INTEGRATION-CLIENTS.md +1784 -20
- package/package.json +5 -5
- package/dist/engineRefusedToolName.d.ts +0 -1
- package/dist/engineRefusedToolName.js +0 -8
package/dist/gateOutcome.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ccToolDenialKindForSettledBy, isCcToolDenialKind, isGateDeniedByWord } from './gateVocabulary.js';
|
|
2
2
|
import { GATE_PARKED_ERROR_CODE } from './engineErrorCodes.js';
|
|
3
3
|
import { CORE_MODE_RELEASE_REASONS, CORE_SETTLEMENT_KINDS } from './generated/engineFactTables.js';
|
|
4
|
-
import { readAskOrigin } from './ownKey.js';
|
|
4
|
+
import { readAskOrigin, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
5
5
|
function str(v) {
|
|
6
6
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
7
7
|
}
|
|
@@ -9,6 +9,61 @@ export const GATE_MODE_RELEASE_REASON_WORDS = CORE_MODE_RELEASE_REASONS;
|
|
|
9
9
|
export function isGateModeReleaseReasonWord(v) {
|
|
10
10
|
return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
|
|
11
11
|
}
|
|
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
|
+
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
|
+
});
|
|
16
|
+
const MODE_RELEASE_UNRECOGNISED_SENTENCE = 'The permission mode let this call run without asking, for a reason this client does not recognise.';
|
|
17
|
+
export function modeReleaseReasonSentence(reason) {
|
|
18
|
+
try {
|
|
19
|
+
if (typeof reason !== 'string' || reason === '')
|
|
20
|
+
return undefined;
|
|
21
|
+
return Object.hasOwn(MODE_RELEASE_SENTENCE_BY_REASON, reason)
|
|
22
|
+
? MODE_RELEASE_SENTENCE_BY_REASON[reason]
|
|
23
|
+
: MODE_RELEASE_UNRECOGNISED_SENTENCE;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const RELEASE_DISCLOSURE_LEDGER_MAX = 256;
|
|
30
|
+
function releaseDisclosureKeyOf(identity) {
|
|
31
|
+
try {
|
|
32
|
+
if (typeof identity !== 'object' || identity === null)
|
|
33
|
+
return undefined;
|
|
34
|
+
const callId = readOwnDataNonEmptyString(identity, 'toolCallId');
|
|
35
|
+
if (callId !== undefined) {
|
|
36
|
+
const epoch = readOwnDataValue(identity, 'epoch');
|
|
37
|
+
const scope = typeof epoch === 'string' ? epoch : typeof epoch === 'number' && Number.isFinite(epoch) ? String(epoch) : '';
|
|
38
|
+
return JSON.stringify(['call', scope, callId]);
|
|
39
|
+
}
|
|
40
|
+
const cardKey = readOwnDataNonEmptyString(identity, 'callKey');
|
|
41
|
+
return cardKey !== undefined ? JSON.stringify(['card', cardKey]) : undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function createReleaseDisclosureLedger() {
|
|
48
|
+
const said = new Set();
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
has(identity) {
|
|
51
|
+
const key = releaseDisclosureKeyOf(identity);
|
|
52
|
+
return key !== undefined && said.has(key);
|
|
53
|
+
},
|
|
54
|
+
mark(identity) {
|
|
55
|
+
const key = releaseDisclosureKeyOf(identity);
|
|
56
|
+
if (key === undefined || said.has(key))
|
|
57
|
+
return;
|
|
58
|
+
said.add(key);
|
|
59
|
+
if (said.size > RELEASE_DISCLOSURE_LEDGER_MAX) {
|
|
60
|
+
const oldest = said.values().next();
|
|
61
|
+
if (oldest.done !== true)
|
|
62
|
+
said.delete(oldest.value);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
12
67
|
export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
|
|
13
68
|
function readWho(v) {
|
|
14
69
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
|
|
2
|
-
import type { APPROVAL_MANDATE_WORDS } from './hitl/toolApprovalWire.js';
|
|
1
|
+
import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
|
|
3
2
|
export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
|
|
4
3
|
export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
|
|
5
4
|
export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
|
|
@@ -11,6 +10,7 @@ export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
|
|
|
11
10
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
12
11
|
export declare function askOriginDetail(origin: unknown): string;
|
|
13
12
|
export declare function mandatedApprovalDetail(): string;
|
|
13
|
+
export declare const APPROVAL_MANDATE_WORDS: readonly (typeof CORE_PERSISTED_RULE_MANDATES)[number][];
|
|
14
14
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
|
15
15
|
export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
|
|
16
16
|
export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
|
package/dist/gateVocabulary.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
|
|
1
|
+
import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
|
|
2
2
|
export const CC_TOOL_DENIAL_KINDS = Object.freeze([
|
|
3
3
|
'user-rejected',
|
|
4
4
|
'permission-rule',
|
|
@@ -71,6 +71,7 @@ export function askOriginDetail(origin) {
|
|
|
71
71
|
export function mandatedApprovalDetail() {
|
|
72
72
|
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';
|
|
73
73
|
}
|
|
74
|
+
export const APPROVAL_MANDATE_WORDS = Object.freeze([...CORE_PERSISTED_RULE_MANDATES]);
|
|
74
75
|
const _mandateWordsPin = true;
|
|
75
76
|
void _mandateWordsPin;
|
|
76
77
|
export function isApprovalMandateWord(v) {
|
|
@@ -82,9 +83,9 @@ const APPROVAL_MANDATE_SENTENCES = Object.freeze({
|
|
|
82
83
|
probe_mandate: 'the check run on this call marked it as needing its own confirmation (the built-in shell check does so for a read outside the directories allowed for this session)',
|
|
83
84
|
probe_unanswered: 'the check run on this call did not answer (it timed out or failed; this client cannot tell which), so whether the call stays inside the directories allowed for this session is unknown',
|
|
84
85
|
write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
|
|
85
|
-
|
|
86
|
+
target_unresolved: 'where this change lands on disk could not be determined (a link on the way could not be examined, or the target could not be resolved), so whether it lands on a guarded location is unknown',
|
|
86
87
|
});
|
|
87
|
-
const APPROVAL_MANDATE_SET = new Set(
|
|
88
|
+
const APPROVAL_MANDATE_SET = new Set(APPROVAL_MANDATE_WORDS);
|
|
88
89
|
export function approvalMandateDetail(word) {
|
|
89
90
|
if (typeof word === 'string' && Object.hasOwn(APPROVAL_MANDATE_SENTENCES, word)) {
|
|
90
91
|
return APPROVAL_MANDATE_SENTENCES[word];
|
|
@@ -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", "rule_unreadable", "
|
|
10
|
+
"shell": Object.freeze(["transcript_write", "rule_unreadable", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
11
11
|
"other": Object.freeze(["transcript_write", "rule_unreadable", "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 ["rule_unreadable", "
|
|
11
|
+
export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "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" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "
|
|
24
|
+
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "governance_unavailable" | "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", "
|
|
26
|
+
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
|
|
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"];
|
|
@@ -32,6 +32,7 @@ export declare const CORE_AUTO_MODE_UNAVAILABLE_CAUSES: readonly ["error", "time
|
|
|
32
32
|
export declare const CORE_DEFAULT_TIER_ORDER: readonly ["ultra", "max", "pro", "flash", "lite"];
|
|
33
33
|
export declare const CORE_CC_MODEL_TIER_ALIASES: Readonly<Record<"fable" | "mythos" | "opus" | "sonnet" | "haiku", (typeof CORE_DEFAULT_TIER_ORDER)[number]>>;
|
|
34
34
|
export declare const CORE_DURABLE_AGENT_HANDLE_RE: RegExp;
|
|
35
|
+
export declare const CORE_TASK_HANDLE_PREFIXES: Readonly<Record<"background_bash" | "workflow" | "background_agent" | "monitor", string>>;
|
|
35
36
|
export declare const CORE_PERMISSION_MODE_CLASSES: readonly ["bypass", "prompting"];
|
|
36
37
|
export declare const CORE_MCP_LIVENESS_STATES: readonly ["reachable", "unreachable", "unknown"];
|
|
37
38
|
export declare const CORE_RULE_BEHAVIORS: readonly ["deny", "ask", "allow"];
|
|
@@ -40,3 +41,4 @@ export declare const CORE_MAX_PENDING_STEER_CHARS: number;
|
|
|
40
41
|
export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
|
|
41
42
|
export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
42
43
|
export declare const CORE_APPROVAL_REACH: readonly ["none"];
|
|
44
|
+
export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
|
|
@@ -113,7 +113,7 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
|
|
|
113
113
|
]);
|
|
114
114
|
export const CORE_MODE_RELEASE_REASONS = Object.freeze([
|
|
115
115
|
"rule_unreadable",
|
|
116
|
-
"
|
|
116
|
+
"target_unresolved",
|
|
117
117
|
]);
|
|
118
118
|
export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
|
|
119
119
|
["ListPeers", "ListAgents"],
|
|
@@ -147,6 +147,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
147
147
|
"ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
148
148
|
"dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
149
149
|
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
|
+
"unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
151
|
"transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
151
152
|
"org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
152
153
|
"governance_unavailable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -157,7 +158,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
157
158
|
"requires_user_interaction": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
158
159
|
"operator_forced": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
159
160
|
"shell_floor": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
160
|
-
"
|
|
161
|
+
"target_unresolved": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
|
|
161
162
|
"probe": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
162
163
|
"write_protection": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
|
|
163
164
|
"tool_marks_mcp": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -176,8 +177,6 @@ export const CORE_SKILL_GRANT_ORIGINS = Object.freeze([
|
|
|
176
177
|
export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
|
|
177
178
|
"wildcard_all",
|
|
178
179
|
"namespace_wildcard",
|
|
179
|
-
"path_pattern",
|
|
180
|
-
"domain",
|
|
181
180
|
"content_unsupported",
|
|
182
181
|
"grammar",
|
|
183
182
|
"tool_name",
|
|
@@ -235,6 +234,12 @@ export const CORE_CC_MODEL_TIER_ALIASES = Object.freeze({
|
|
|
235
234
|
"haiku": "lite",
|
|
236
235
|
});
|
|
237
236
|
export const CORE_DURABLE_AGENT_HANDLE_RE = Object.freeze(/^a[0-9a-f]{6,32}$/);
|
|
237
|
+
export const CORE_TASK_HANDLE_PREFIXES = Object.freeze({
|
|
238
|
+
"background_bash": "b",
|
|
239
|
+
"workflow": "w",
|
|
240
|
+
"background_agent": "a",
|
|
241
|
+
"monitor": "m",
|
|
242
|
+
});
|
|
238
243
|
export const CORE_PERMISSION_MODE_CLASSES = Object.freeze([
|
|
239
244
|
"bypass",
|
|
240
245
|
"prompting",
|
|
@@ -268,3 +273,11 @@ export const CORE_PERMISSION_MODES = Object.freeze([
|
|
|
268
273
|
export const CORE_APPROVAL_REACH = Object.freeze([
|
|
269
274
|
"none",
|
|
270
275
|
]);
|
|
276
|
+
export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
|
|
277
|
+
"operator_always",
|
|
278
|
+
"tool_marks",
|
|
279
|
+
"probe_mandate",
|
|
280
|
+
"probe_unanswered",
|
|
281
|
+
"write_protection",
|
|
282
|
+
"target_unresolved",
|
|
283
|
+
]);
|
|
@@ -14,7 +14,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
14
14
|
"config.artifact_host_invalid",
|
|
15
15
|
"config.task_root_not_canonical",
|
|
16
16
|
"config.write_protection_target_view_absent",
|
|
17
|
-
"config.
|
|
17
|
+
"config.path_view_unresolved",
|
|
18
18
|
"config.execution_env_capability_invalid",
|
|
19
19
|
"config.tool_card_undeclared",
|
|
20
20
|
"config.tool_face_undeclared",
|
|
@@ -66,6 +66,9 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
66
66
|
"route.base_url_changed_key_unchanged",
|
|
67
67
|
"route.response_model_mismatch",
|
|
68
68
|
"route.tool_call_id_folded",
|
|
69
|
+
"route.finish_reason_unknown",
|
|
70
|
+
"route.stream_end_ignored",
|
|
71
|
+
"route.extra_body_reserved_dropped",
|
|
69
72
|
"context.tool_turn_repaired",
|
|
70
73
|
"task.user_steer_undrained",
|
|
71
74
|
"task.user_followup_undrained",
|
|
@@ -103,7 +106,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
103
106
|
"config.artifact_host_invalid": "operator",
|
|
104
107
|
"config.task_root_not_canonical": "operator",
|
|
105
108
|
"config.write_protection_target_view_absent": "operator",
|
|
106
|
-
"config.
|
|
109
|
+
"config.path_view_unresolved": "operator",
|
|
107
110
|
"config.execution_env_capability_invalid": "operator",
|
|
108
111
|
"config.tool_card_undeclared": "operator",
|
|
109
112
|
"config.tool_face_undeclared": "operator",
|
|
@@ -155,6 +158,9 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
155
158
|
"route.base_url_changed_key_unchanged": "operator",
|
|
156
159
|
"route.response_model_mismatch": "operator",
|
|
157
160
|
"route.tool_call_id_folded": "operator",
|
|
161
|
+
"route.finish_reason_unknown": "user",
|
|
162
|
+
"route.stream_end_ignored": "user",
|
|
163
|
+
"route.extra_body_reserved_dropped": "operator",
|
|
158
164
|
"context.tool_turn_repaired": "operator",
|
|
159
165
|
"task.user_steer_undrained": "user",
|
|
160
166
|
"task.user_followup_undrained": "user",
|
|
@@ -198,7 +204,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
198
204
|
"config.artifact_host_invalid": "engine",
|
|
199
205
|
"config.task_root_not_canonical": "engine",
|
|
200
206
|
"config.write_protection_target_view_absent": "engine",
|
|
201
|
-
"config.
|
|
207
|
+
"config.path_view_unresolved": "engine",
|
|
202
208
|
"config.execution_env_capability_invalid": "engine",
|
|
203
209
|
"config.tool_card_undeclared": "engine",
|
|
204
210
|
"config.tool_face_undeclared": "engine",
|
|
@@ -250,6 +256,9 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
250
256
|
"route.base_url_changed_key_unchanged": "engine",
|
|
251
257
|
"route.response_model_mismatch": "engine",
|
|
252
258
|
"route.tool_call_id_folded": "engine",
|
|
259
|
+
"route.finish_reason_unknown": "engine",
|
|
260
|
+
"route.stream_end_ignored": "engine",
|
|
261
|
+
"route.extra_body_reserved_dropped": "engine",
|
|
253
262
|
"context.tool_turn_repaired": "engine",
|
|
254
263
|
"task.user_steer_undrained": "engine",
|
|
255
264
|
"task.user_followup_undrained": "engine",
|
|
@@ -3,3 +3,5 @@ export declare const SDK_STATUS_DERIVED_COARSE_CODES: readonly ["request.rejecte
|
|
|
3
3
|
export declare const SDK_DENY_REASON_ROUTING_FAILURE: "routing_failure_fail_closed";
|
|
4
4
|
export declare const SDK_ASK_ROW_ENDING_CAUSES: readonly ["routing_failure_fail_closed", "run_cancelled", "run_exited", "batch_aborted", "batch_sibling_withdrawn", "batch_bound_elsewhere", "adhoc_leg_no_durable_domain", "orphan_ttl_exceeded", "crashed_before_park", "shutdown_before_park"];
|
|
5
5
|
export declare const SDK_RUN_DEATH_VERDICT_CODES: readonly ["run.stalled", "run.orphaned", "approval.expired"];
|
|
6
|
+
export declare const SDK_APPROVAL_DECIDE_GATE_KINDS: readonly ["human", "irreversible_ask"];
|
|
7
|
+
export declare const SDK_PLAN_REVIEW_GATE_KINDS: readonly ["plan_review"];
|
|
@@ -32,3 +32,10 @@ export const SDK_RUN_DEATH_VERDICT_CODES = Object.freeze([
|
|
|
32
32
|
"run.orphaned",
|
|
33
33
|
"approval.expired",
|
|
34
34
|
]);
|
|
35
|
+
export const SDK_APPROVAL_DECIDE_GATE_KINDS = Object.freeze([
|
|
36
|
+
"human",
|
|
37
|
+
"irreversible_ask",
|
|
38
|
+
]);
|
|
39
|
+
export const SDK_PLAN_REVIEW_GATE_KINDS = Object.freeze([
|
|
40
|
+
"plan_review",
|
|
41
|
+
]);
|
|
@@ -5,6 +5,9 @@ export type SettingsAtMention = {
|
|
|
5
5
|
readonly mode: 'only';
|
|
6
6
|
readonly models: readonly string[];
|
|
7
7
|
};
|
|
8
|
+
export type SettingsHookMatcherForm = "literal" | "regex" | "invalid";
|
|
8
9
|
export declare const SETTINGS_IS_LOOPBACK_AUTH_HOST: (host: string) => boolean;
|
|
9
10
|
export declare const SETTINGS_IS_HIERARCHICAL_URL: (raw: string) => boolean;
|
|
10
11
|
export declare const SETTINGS_NARROW_AT_MENTION: (atMention: SettingsAtMention, available: ReadonlySet<string>) => SettingsAtMention;
|
|
12
|
+
export declare const SETTINGS_HOOK_MATCHER_SELECTS: (matcher: string | undefined, name: string) => boolean | 'invalid';
|
|
13
|
+
export declare const SETTINGS_HOOK_MATCHER_FORM: (matcher: string | undefined) => SettingsHookMatcherForm;
|
|
@@ -20,3 +20,56 @@ export const SETTINGS_NARROW_AT_MENTION = function narrowAtMention(atMention, av
|
|
|
20
20
|
return atMention;
|
|
21
21
|
return kept.length > 0 ? { mode: "only", models: kept } : { mode: "none" };
|
|
22
22
|
};
|
|
23
|
+
const HOOK_MATCHER_NAME_LIST = /^[a-zA-Z0-9_|, -]+$/;
|
|
24
|
+
const readHookMatcher = function readHookMatcher(matcher) {
|
|
25
|
+
if (matcher === undefined || matcher === "" || matcher === "*")
|
|
26
|
+
return { form: "all" };
|
|
27
|
+
if (HOOK_MATCHER_NAME_LIST.test(matcher)) {
|
|
28
|
+
return {
|
|
29
|
+
form: "names",
|
|
30
|
+
names: matcher
|
|
31
|
+
.split(/[|,]/)
|
|
32
|
+
.map((part) => part.trim())
|
|
33
|
+
.filter((part) => part !== ""),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return { form: "regex", pattern: new RegExp(matcher) };
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return { form: "invalid" };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export const SETTINGS_HOOK_MATCHER_SELECTS = function hookMatcherSelects(matcher, name) {
|
|
44
|
+
const r = readHookMatcher(matcher);
|
|
45
|
+
switch (r.form) {
|
|
46
|
+
case "all":
|
|
47
|
+
return true;
|
|
48
|
+
case "names":
|
|
49
|
+
return r.names.includes(name);
|
|
50
|
+
case "regex":
|
|
51
|
+
return r.pattern.test(name);
|
|
52
|
+
case "invalid":
|
|
53
|
+
return "invalid";
|
|
54
|
+
default: {
|
|
55
|
+
const unhandled = r;
|
|
56
|
+
throw new Error(`hookMatcherSelects: unhandled matcher reading ${JSON.stringify(unhandled)}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export const SETTINGS_HOOK_MATCHER_FORM = function hookMatcherForm(matcher) {
|
|
61
|
+
const r = readHookMatcher(matcher);
|
|
62
|
+
switch (r.form) {
|
|
63
|
+
case "all":
|
|
64
|
+
case "names":
|
|
65
|
+
return "literal";
|
|
66
|
+
case "regex":
|
|
67
|
+
return "regex";
|
|
68
|
+
case "invalid":
|
|
69
|
+
return "invalid";
|
|
70
|
+
default: {
|
|
71
|
+
const unhandled = r;
|
|
72
|
+
throw new Error(`hookMatcherForm: unhandled matcher reading ${JSON.stringify(unhandled)}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const CORE_PROTOCOL_PREFIXES: readonly ["mcp__", "a2a__"];
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const CORE_SKILL_TOOL_NAME: "Skill";
|
|
@@ -1,43 +1,2 @@
|
|
|
1
1
|
export const CORE_PROTOCOL_PREFIXES = ["mcp__", "a2a__"];
|
|
2
|
-
export const
|
|
3
|
-
["read_file", "Read"],
|
|
4
|
-
["edit_file", "Edit"],
|
|
5
|
-
["write_file", "Write"],
|
|
6
|
-
["bash", "Bash"],
|
|
7
|
-
["bash_readonly", null],
|
|
8
|
-
["glob", "Glob"],
|
|
9
|
-
["grep", "Grep"],
|
|
10
|
-
["web_fetch", "WebFetch"],
|
|
11
|
-
["tool_search", "ToolSearch"],
|
|
12
|
-
["skill", "Skill"],
|
|
13
|
-
["present_plan", "ExitPlanMode"],
|
|
14
|
-
["enter_plan_mode", "EnterPlanMode"],
|
|
15
|
-
["spawn_subagent", "Agent"],
|
|
16
|
-
["CronCancel", "CronDelete"],
|
|
17
|
-
["lsp", "LSP"],
|
|
18
|
-
["submit_output", "StructuredOutput"],
|
|
19
|
-
["repo_map", "RepoMap"],
|
|
20
|
-
["read_tool_result", "ReadToolResult"],
|
|
21
|
-
["report_blocked", "ReportBlocked"],
|
|
22
|
-
["declare_done", "DeclareDone"],
|
|
23
|
-
["run_workflow", "Workflow"],
|
|
24
|
-
["RunWorkflow", "Workflow"],
|
|
25
|
-
["Task", "Agent"],
|
|
26
|
-
["BashOutput", "TaskOutput"],
|
|
27
|
-
["AgentOutputTool", "TaskOutput"],
|
|
28
|
-
["BashOutputTool", "TaskOutput"],
|
|
29
|
-
["AgentOutput", "TaskOutput"],
|
|
30
|
-
["WorkflowStatus", null],
|
|
31
|
-
["KillShell", "TaskStop"],
|
|
32
|
-
["KillBash", "TaskStop"],
|
|
33
|
-
["ListMcpResources", "ListMcpResourcesTool"],
|
|
34
|
-
["ReadMcpResource", "ReadMcpResourceTool"],
|
|
35
|
-
["ReadMcpResourceDir", "ReadMcpResourceDirTool"],
|
|
36
|
-
["MultiEdit", null],
|
|
37
|
-
["Fork", null],
|
|
38
|
-
["Sleep", null],
|
|
39
|
-
["Remember", null],
|
|
40
|
-
["remember", null],
|
|
41
|
-
["Recall", null],
|
|
42
|
-
["recall", null],
|
|
43
|
-
]);
|
|
2
|
+
export const CORE_SKILL_TOOL_NAME = "Skill";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { displayUntrusted } from '../displayUntrusted.js';
|
|
1
|
+
import { displayUntrusted, markerSafeCut } from '../displayUntrusted.js';
|
|
2
2
|
const NOTE_DISPLAY_MAX = 200;
|
|
3
3
|
export const DECISION_NOTE_NOTICE_KEY = 'approval-decision-note';
|
|
4
4
|
function cleanNote(raw) {
|
|
@@ -7,7 +7,7 @@ function cleanNote(raw) {
|
|
|
7
7
|
.trim();
|
|
8
8
|
if (flat === '')
|
|
9
9
|
return undefined;
|
|
10
|
-
return flat.length <= NOTE_DISPLAY_MAX ? flat : `${flat.slice(0, NOTE_DISPLAY_MAX - 1)}…`;
|
|
10
|
+
return flat.length <= NOTE_DISPLAY_MAX ? flat : `${flat.slice(0, markerSafeCut(flat, NOTE_DISPLAY_MAX - 1))}…`;
|
|
11
11
|
}
|
|
12
12
|
export function readDecisionNoteAudit(ack) {
|
|
13
13
|
if (ack === null || typeof ack !== 'object')
|
|
@@ -2,4 +2,6 @@ import type { ApprovalSettleCause, AskRowEndingCause } from '@sema-agent/sdk';
|
|
|
2
2
|
export declare const ASK_ROW_ENDING_CAUSE_WORDS: readonly ["routing_failure_fail_closed", "run_cancelled", "run_exited", "batch_aborted", "batch_sibling_withdrawn", "batch_bound_elsewhere", "adhoc_leg_no_durable_domain", "orphan_ttl_exceeded", "crashed_before_park", "shutdown_before_park"];
|
|
3
3
|
export declare function askRowEndingCauseFor(state: 'VOID' | 'DENIED' | undefined, word: unknown): AskRowEndingCause | undefined;
|
|
4
4
|
export declare function approvalCompleteCauseOf(frame: unknown): ApprovalSettleCause | undefined;
|
|
5
|
+
export declare function notPendingCauseReading(err: object): 'ended' | 'other_replica' | 'none';
|
|
6
|
+
export declare function refusalCauseWordOf(err: object): string | undefined;
|
|
5
7
|
export declare function notPendingCauseSaysEnded(err: object): boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ASK_GONE_DENIED_WORD } from '../engineErrorCodes.js';
|
|
2
2
|
import { SDK_ASK_ROW_ENDING_CAUSES } from '../generated/sdkFactTables.js';
|
|
3
|
+
import { guardedRead, readOwnDataValue } from '../ownKey.js';
|
|
4
|
+
import { readThrownExtra } from '../wireFailureShape.js';
|
|
3
5
|
export const ASK_ROW_ENDING_CAUSE_WORDS = SDK_ASK_ROW_ENDING_CAUSES;
|
|
4
6
|
const _askRowCausePin = true;
|
|
5
7
|
void _askRowCausePin;
|
|
@@ -25,37 +27,40 @@ export function askRowEndingCauseFor(state, word) {
|
|
|
25
27
|
return word !== DENIED_GROUP_WORD ? word : undefined;
|
|
26
28
|
return undefined;
|
|
27
29
|
}
|
|
30
|
+
function ownDataSlot(o, key) {
|
|
31
|
+
return guardedRead(() => readOwnDataValue(o, key));
|
|
32
|
+
}
|
|
28
33
|
export function approvalCompleteCauseOf(frame) {
|
|
29
34
|
try {
|
|
30
35
|
if (typeof frame !== 'object' || frame === null)
|
|
31
36
|
return undefined;
|
|
32
|
-
|
|
33
|
-
if (typeSlot === undefined || !Object.hasOwn(typeSlot, 'value') || typeSlot.value !== 'tool_approval_complete')
|
|
34
|
-
return undefined;
|
|
35
|
-
const causeSlot = Object.getOwnPropertyDescriptor(frame, 'cause');
|
|
36
|
-
if (causeSlot === undefined || !Object.hasOwn(causeSlot, 'value'))
|
|
37
|
+
if (ownDataSlot(frame, 'type') !== 'tool_approval_complete')
|
|
37
38
|
return undefined;
|
|
38
|
-
const word =
|
|
39
|
+
const word = ownDataSlot(frame, 'cause');
|
|
39
40
|
return isApprovalSettleCause(word) ? word : undefined;
|
|
40
41
|
}
|
|
41
42
|
catch {
|
|
42
43
|
return undefined;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
+
const NOT_PENDING_OTHER_REPLICA_WORDS = Object.freeze({
|
|
47
|
+
unknown_or_other_replica: true,
|
|
48
|
+
});
|
|
49
|
+
export function notPendingCauseReading(err) {
|
|
50
|
+
const word = refusalCauseWordOf(err);
|
|
51
|
+
if (word === undefined)
|
|
52
|
+
return 'none';
|
|
53
|
+
if (isAskRowEndingCause(word))
|
|
54
|
+
return 'ended';
|
|
55
|
+
return Object.hasOwn(NOT_PENDING_OTHER_REPLICA_WORDS, word) ? 'other_replica' : 'none';
|
|
56
|
+
}
|
|
57
|
+
export function refusalCauseWordOf(err) {
|
|
58
|
+
const reading = readThrownExtra(err);
|
|
59
|
+
if (reading.state !== 'object')
|
|
60
|
+
return undefined;
|
|
61
|
+
const word = ownDataSlot(reading.value, 'cause');
|
|
62
|
+
return typeof word === 'string' && word !== '' ? word : undefined;
|
|
63
|
+
}
|
|
46
64
|
export function notPendingCauseSaysEnded(err) {
|
|
47
|
-
|
|
48
|
-
const extraSlot = Object.getOwnPropertyDescriptor(err, 'extra');
|
|
49
|
-
const extra = extraSlot !== undefined && Object.hasOwn(extraSlot, 'value') ? extraSlot.value : undefined;
|
|
50
|
-
if (typeof extra !== 'object' || extra === null || Array.isArray(extra))
|
|
51
|
-
return false;
|
|
52
|
-
const causeSlot = Object.getOwnPropertyDescriptor(extra, 'cause');
|
|
53
|
-
if (causeSlot === undefined || !Object.hasOwn(causeSlot, 'value'))
|
|
54
|
-
return false;
|
|
55
|
-
const word = causeSlot.value;
|
|
56
|
-
return isAskRowEndingCause(word) || (typeof word === 'string' && LEGACY_NOT_PENDING_ENDED_WORDS.has(word));
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
65
|
+
return notPendingCauseReading(err) === 'ended';
|
|
61
66
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { ApprovalHolderIdentity, FsApprovalOutcome, ToolApprovalFrameOutcome } from './toolApprovalWire.js';
|
|
2
|
+
export declare const APPROVAL_SETTLED_HOWS: readonly ["answered", "interrupted", "closed_by_engine"];
|
|
3
|
+
export type ApprovalSettledHow = (typeof APPROVAL_SETTLED_HOWS)[number];
|
|
4
|
+
export declare const SETTLED_APPROVALS_MAX_ENTRIES = 4096;
|
|
5
|
+
export interface SettledApprovalEntry {
|
|
6
|
+
readonly how: ApprovalSettledHow;
|
|
7
|
+
readonly parked: boolean;
|
|
8
|
+
readonly outcome: ToolApprovalFrameOutcome;
|
|
9
|
+
}
|
|
2
10
|
export interface DurableDecisionHold {
|
|
3
11
|
readonly lane: 'durable';
|
|
4
12
|
readonly outcome: Promise<FsApprovalOutcome>;
|
|
@@ -17,7 +25,7 @@ export interface LiveCardHold {
|
|
|
17
25
|
};
|
|
18
26
|
readonly cardSignal: AbortSignal;
|
|
19
27
|
readonly interrupt: () => void;
|
|
20
|
-
trailing?: Promise<
|
|
28
|
+
trailing?: Promise<boolean>;
|
|
21
29
|
}
|
|
22
30
|
export type ApprovalHold = DurableDecisionHold | LiveCardHold;
|
|
23
31
|
export interface LiveCardIdentity {
|
|
@@ -27,12 +35,14 @@ export interface LiveCardIdentity {
|
|
|
27
35
|
readonly sessionId?: string;
|
|
28
36
|
}
|
|
29
37
|
export declare function liveCardHoldFor(who: ApprovalHolderIdentity): LiveCardHold | undefined;
|
|
38
|
+
export declare function settledForDurableLane(entry: SettledApprovalEntry | undefined): boolean;
|
|
30
39
|
export declare function liveCardAnsweredHow(o: ToolApprovalFrameOutcome): 'answered' | 'interrupted' | undefined;
|
|
31
40
|
export declare function awaitLiveCardHolder(hold: LiveCardHold, signal: AbortSignal | undefined): Promise<ToolApprovalFrameOutcome | undefined>;
|
|
32
41
|
export interface ApprovalDecisionHoldTable {
|
|
33
42
|
readonly inFlight: Map<string, ApprovalHold>;
|
|
34
43
|
readonly settled: Map<string, DurableSettledHold>;
|
|
35
44
|
readonly openReads: Set<number>;
|
|
45
|
+
readonly outcomes: Map<string, SettledApprovalEntry>;
|
|
36
46
|
clock: number;
|
|
37
47
|
}
|
|
38
48
|
export interface DurableSettledHold {
|
|
@@ -40,6 +50,11 @@ export interface DurableSettledHold {
|
|
|
40
50
|
readonly hold: DurableDecisionHold;
|
|
41
51
|
}
|
|
42
52
|
export declare const approvalDecisionHolds: ApprovalDecisionHoldTable;
|
|
53
|
+
export declare function settledApprovalOf(approvalId: string | undefined): SettledApprovalEntry | undefined;
|
|
54
|
+
export declare function clearSettledApprovals(): void;
|
|
55
|
+
export declare function anyApprovalSettled(): boolean;
|
|
56
|
+
export declare function noteEngineClosedApproval(approvalId: string, parked: boolean): void;
|
|
57
|
+
export declare function settledLiveCardOutcome(approvalId: string): ToolApprovalFrameOutcome | undefined;
|
|
43
58
|
export declare function liveCardHoldOf(key: string): LiveCardHold | undefined;
|
|
44
59
|
export declare function holdLiveCard(identity: LiveCardIdentity, callerSignal: AbortSignal | undefined, present: (hold: LiveCardHold) => Promise<ToolApprovalFrameOutcome>): Promise<ToolApprovalFrameOutcome>;
|
|
45
60
|
export declare function joinLiveCard(hold: LiveCardHold, signal: AbortSignal | undefined): Promise<ToolApprovalFrameOutcome>;
|