@sema-agent/client-core 0.100.0 → 0.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +395 -0
- package/README.md +164 -117
- package/dist/adapt/arms.js +51 -16
- package/dist/adapt/textStream.js +7 -4
- package/dist/adapt/toolCards.js +9 -8
- package/dist/adapt.js +7 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
- package/dist/adapter/activeRunSelfHeal.js +108 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -12
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +158 -43
- package/dist/agentsWireCaps.d.ts +2 -7
- package/dist/agentsWireCaps.js +1 -2
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +19 -5
- package/dist/cloudConfigWireCaps.js +193 -56
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +5 -3
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +65 -8
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +14 -5
- package/dist/engineErrorCodes.js +27 -6
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +3 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.js +2 -2
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.js +3 -3
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +15 -2
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -3
- package/dist/generated/engineFactTables.js +52 -0
- package/dist/generated/engineNoticeTables.js +12 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +54 -0
- package/dist/generated/settingsSchemaFns.js +26 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +2 -0
- package/dist/generated/settingsSchemaTables.js +13 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +7 -5
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +6 -0
- package/dist/hitl/askClassPair.js +30 -3
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +42 -3
- package/dist/hitl/attributionLadder.js +79 -8
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionRefusal.d.ts +20 -10
- package/dist/hitl/decisionRefusal.js +99 -54
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +87 -103
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +41 -37
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +59 -30
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +62 -29
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +72 -54
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +73 -17
- package/dist/hostTurnSettings.js +594 -97
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +2 -1
- package/dist/humanTurn.js +37 -7
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +184 -2
- package/dist/i18n/messages.en.js +187 -5
- package/dist/i18n/messages.zh.js +197 -5
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +69 -15
- package/dist/index.js +45 -13
- package/dist/inheritEnvCapability.d.ts +3 -1
- package/dist/inheritEnvCapability.js +31 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +1 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.js +2 -1
- package/dist/mcpWireCaps.d.ts +39 -1
- package/dist/mcpWireCaps.js +254 -50
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.js +6 -6
- package/dist/modelIdentityResolvability.d.ts +10 -1
- package/dist/modelIdentityResolvability.js +62 -39
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +11 -0
- package/dist/ownKey.js +164 -3
- package/dist/panelReduce.js +1 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +92 -53
- package/dist/prepareRefusal.d.ts +3 -2
- package/dist/prepareRefusal.js +27 -9
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +5 -1
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +12 -4
- package/dist/request/taskRequest.js +221 -152
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +57 -9
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +4 -0
- package/dist/ruleRefusalSentence.js +9 -3
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +1 -1
- package/dist/sandboxWire.js +4 -6
- package/dist/scenarioRefusal.js +1 -1
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +2 -0
- package/dist/seam.js +2 -2
- package/dist/seatContract.d.ts +46 -1
- package/dist/seatContract.js +49 -19
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.js +60 -5
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -0
- package/dist/skillsWireCaps.js +47 -16
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +158 -9
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/turnFailurePresentation.js +27 -90
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +24 -1
- package/dist/wireRefusalCopy.js +253 -32
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +607 -181
- package/package.json +14 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CONFIG_LEGACY_TOOL_NAME } from '../engineErrorCodes.js';
|
|
2
2
|
import { rosterMountedNames } from '../rosterMountedNames.js';
|
|
3
|
-
import {
|
|
4
|
-
import { readRuleEntry } from '../coreValuePorts.js';
|
|
3
|
+
import { msg, renderMessage } from '../i18n/translate.js';
|
|
5
4
|
import { readOwnDataValue } from '../ownKey.js';
|
|
5
|
+
import { denyEntryReading, ruleCompileVerdict } from '../ruleCompileVerdict.js';
|
|
6
6
|
import { ruleToolNameVerdictOf } from '../protocolSegment.js';
|
|
7
7
|
import { PREFIXES_IN_PROSE, REFUSED_NAME_FIX } from './refusedToolNameProse.js';
|
|
8
8
|
import { prepareRefusalNoteOf } from '../prepareRefusal.js';
|
|
@@ -16,17 +16,60 @@ const WITHHELD_NOTICE = {
|
|
|
16
16
|
not_a_tool_name: 'Not written to this session’s rule record: this entry is not exactly one tool name — it is empty, not text, has spaces around the name, is not a single tool name in rule syntax (for example it contains a backslash or a parenthesis, or is longer than a rule can be), or spells its server or agent peer part in a way the engine never uses when naming tools (for example with a dot or a space), so no tool would ever match it.',
|
|
17
17
|
legacy_tool_name: `Not written to this session’s rule record: unless a tool by exactly this name is available, the engine refuses it — it is a retired tool name, or it contains "__" but does not start with ${PREFIXES_IN_PROSE} — and with it in that record every later run of this session would fail at startup until that entry is removed from the record. ${REFUSED_NAME_FIX}`,
|
|
18
18
|
not_in_roster: 'Not written to this session’s rule record: the tool roster supplied for this check has no tool by exactly this name, as a name or an alias, with letter case counted — it may be misspelled, or name a tool this deployment does not provide — so recorded as it is it would block nothing here.',
|
|
19
|
+
namespace_covering_unconfirmed: msg('session.policy.withheld.namespaceCoveringUnconfirmed'),
|
|
19
20
|
};
|
|
20
21
|
export const SESSION_POLICY_WITHHELD_WHY = Object.freeze(Object.keys(WITHHELD_NOTICE));
|
|
21
22
|
const MAX_RULES = 10_000;
|
|
22
23
|
function unreadable() {
|
|
23
24
|
return { deliverable: {}, withheld: [], unreadable: true };
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function namespaceCoveringFormOf(rule) {
|
|
27
|
+
if (rule.trim() !== rule)
|
|
28
|
+
return undefined;
|
|
29
|
+
for (const prefix of COVERING_NAMESPACE_PREFIXES) {
|
|
30
|
+
if (!rule.startsWith(prefix))
|
|
31
|
+
continue;
|
|
32
|
+
const segments = rule.slice(prefix.length).split('__');
|
|
33
|
+
const peer = segments[0];
|
|
34
|
+
if (peer === undefined || peer === '' || peer.includes('*'))
|
|
35
|
+
return undefined;
|
|
36
|
+
if (segments.length === 1)
|
|
37
|
+
return 'peer';
|
|
38
|
+
const tool = segments.slice(1).join('__');
|
|
39
|
+
if (tool === '*')
|
|
40
|
+
return 'tool_star';
|
|
41
|
+
return /^[^*]+\*$/.test(tool) ? 'tool_glob' : undefined;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function suppliedNamespaceForms(opts) {
|
|
46
|
+
if (opts === undefined || opts === null || typeof opts !== 'object')
|
|
47
|
+
return 'unsupplied';
|
|
48
|
+
let reading;
|
|
49
|
+
try {
|
|
50
|
+
reading = readOwnDataValue(opts, 'namespaceForms');
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return 'unsupplied';
|
|
54
|
+
}
|
|
55
|
+
if (reading === undefined || reading === null)
|
|
56
|
+
return 'unsupplied';
|
|
57
|
+
if (typeof reading !== 'object')
|
|
58
|
+
return 'unconfirmed';
|
|
59
|
+
try {
|
|
60
|
+
return readOwnDataValue(reading, 'kind') === 'confirmed' ? 'confirmed' : 'unconfirmed';
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return 'unconfirmed';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function withheldWhyOf(rule, covering, forms) {
|
|
26
67
|
if (rule.length === 0)
|
|
27
68
|
return 'not_a_tool_name';
|
|
28
69
|
if (/(?:^|[^\\])\(/.test(rule))
|
|
29
70
|
return 'qualified_deny';
|
|
71
|
+
if (covering !== undefined)
|
|
72
|
+
return forms === 'confirmed' ? undefined : 'namespace_covering_unconfirmed';
|
|
30
73
|
if (rule.includes('*'))
|
|
31
74
|
return 'wildcard';
|
|
32
75
|
for (const prefix of COVERING_NAMESPACE_PREFIXES) {
|
|
@@ -80,6 +123,7 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
|
|
|
80
123
|
if (known === 'unreadable')
|
|
81
124
|
return unreadable();
|
|
82
125
|
const mounted = known === 'absent' ? undefined : known;
|
|
126
|
+
const forms = suppliedNamespaceForms(opts);
|
|
83
127
|
const withheld = [];
|
|
84
128
|
if (behavior === 'ask') {
|
|
85
129
|
for (const r of entries)
|
|
@@ -92,7 +136,8 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
|
|
|
92
136
|
withheld.push({ rule: '', why: 'not_a_tool_name' });
|
|
93
137
|
continue;
|
|
94
138
|
}
|
|
95
|
-
|
|
139
|
+
const covering = forms === 'unsupplied' ? undefined : namespaceCoveringFormOf(r);
|
|
140
|
+
let why = withheldWhyOf(r, covering, forms);
|
|
96
141
|
const engineAsked = why === undefined;
|
|
97
142
|
let currentName;
|
|
98
143
|
if (engineAsked) {
|
|
@@ -125,7 +170,7 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
|
|
|
125
170
|
if (grammar === 'refused')
|
|
126
171
|
why = 'not_a_tool_name';
|
|
127
172
|
}
|
|
128
|
-
if (why === undefined && mounted !== undefined && !mounted.has(r))
|
|
173
|
+
if (why === undefined && mounted !== undefined && !mounted.has(r) && covering === undefined)
|
|
129
174
|
why = 'not_in_roster';
|
|
130
175
|
if (why === undefined)
|
|
131
176
|
exact.push(r);
|
|
@@ -144,32 +189,20 @@ export function sessionPolicyDeliverable(behavior, rules, opts) {
|
|
|
144
189
|
return { deliverable: { toolDeny: exact }, withheld };
|
|
145
190
|
}
|
|
146
191
|
function entryReadingOf(rule) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const kind = readOwnDataValue(reading, 'kind');
|
|
152
|
-
if (kind === 'row') {
|
|
153
|
-
const compiled = readOwnDataValue(reading, 'compiled');
|
|
154
|
-
return typeof compiled === 'object' && compiled !== null ? 'row' : 'unknown';
|
|
155
|
-
}
|
|
156
|
-
if (kind !== 'inert')
|
|
157
|
-
return 'unknown';
|
|
158
|
-
const reason = readOwnDataValue(reading, 'reason');
|
|
159
|
-
if (reason === 'grammar' || reason === 'content_unsupported')
|
|
160
|
-
return { why: 'not_a_tool_name', reason };
|
|
161
|
-
if (reason === 'wildcard_all' || reason === 'namespace_wildcard')
|
|
162
|
-
return { why: 'wildcard', reason };
|
|
163
|
-
return 'unknown';
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
192
|
+
const reading = denyEntryReading(rule);
|
|
193
|
+
if (reading.kind === 'row')
|
|
194
|
+
return 'row';
|
|
195
|
+
if (reading.kind === 'unknown')
|
|
166
196
|
return 'unknown';
|
|
167
|
-
|
|
197
|
+
const reason = reading.reason;
|
|
198
|
+
return reason === 'grammar' || reason === 'content_unsupported' ? { why: 'not_a_tool_name', reason } : { why: 'wildcard', reason };
|
|
168
199
|
}
|
|
169
|
-
export function sessionPolicyWithheldNotice(why) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
200
|
+
export function sessionPolicyWithheldNotice(why, lang) {
|
|
201
|
+
if (typeof why === 'string' && Object.hasOwn(WITHHELD_NOTICE, why)) {
|
|
202
|
+
const sentence = WITHHELD_NOTICE[why];
|
|
203
|
+
return typeof sentence === 'string' ? sentence : renderMessage(sentence, lang);
|
|
204
|
+
}
|
|
205
|
+
return 'Not written to this session’s rule record.';
|
|
173
206
|
}
|
|
174
207
|
export function legacyToolNameFailureNoteOf(code) {
|
|
175
208
|
return code === CONFIG_LEGACY_TOOL_NAME ? prepareRefusalNoteOf(code) : undefined;
|
|
@@ -128,14 +128,24 @@ export interface SessionPolicyInertEntryRefusal {
|
|
|
128
128
|
export declare function tightenSessionPolicy(facade: SessionPolicyFacade, req: SessionPolicyTightenRequest, opts?: {
|
|
129
129
|
signal?: AbortSignal;
|
|
130
130
|
}): Promise<SessionPolicyTightenOutcome>;
|
|
131
|
-
export
|
|
131
|
+
export interface SessionPolicyTightenFacts {
|
|
132
|
+
readonly agentsStartedBeforeFirstRule?: number | undefined;
|
|
133
|
+
readonly workflowsRunning?: number | undefined;
|
|
134
|
+
readonly untrackedBackgroundItems?: number | undefined;
|
|
135
|
+
readonly inFlightUnreadable?: true | undefined;
|
|
136
|
+
}
|
|
137
|
+
export interface SessionPolicyDeploymentFacts {
|
|
138
|
+
readonly operator?: 'present' | 'absent';
|
|
139
|
+
readonly identityAttach?: 'available' | 'unavailable';
|
|
140
|
+
}
|
|
141
|
+
export declare function sessionPolicyTightenNotice(outcome: SessionPolicyTightenOutcome, lang?: UiLanguage, facts?: SessionPolicyTightenFacts, deployment?: SessionPolicyDeploymentFacts): string;
|
|
132
142
|
export declare function sessionPolicyReadNotice(outcome: Exclude<SessionPolicyReadOutcome, {
|
|
133
143
|
kind: 'present';
|
|
134
144
|
}> | {
|
|
135
145
|
kind: 'no_target';
|
|
136
146
|
} | {
|
|
137
147
|
kind: 'not_started';
|
|
138
|
-
}): string;
|
|
148
|
+
}, deployment?: SessionPolicyDeploymentFacts): string;
|
|
139
149
|
export interface SessionPolicyRemovedEntry {
|
|
140
150
|
readonly field: 'toolDeny' | 'toolAllow';
|
|
141
151
|
readonly rule: string;
|
|
@@ -178,4 +188,4 @@ export type SessionPolicyRosterRequiredWhy = 'absent' | 'unreadable';
|
|
|
178
188
|
export declare function removeRefusedSessionRules(facade: SessionPolicyFacade, sessionId: string, roster: ToolRosterView | undefined, opts?: {
|
|
179
189
|
signal?: AbortSignal;
|
|
180
190
|
}): Promise<SessionPolicyRemovalOutcome>;
|
|
181
|
-
export declare function sessionPolicyRemovalNotice(outcome: SessionPolicyRemovalOutcome): string;
|
|
191
|
+
export declare function sessionPolicyRemovalNotice(outcome: SessionPolicyRemovalOutcome, deployment?: SessionPolicyDeploymentFacts): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { appendOwnElement } from '../ownKey.js';
|
|
1
2
|
import { wireFailureShapeOf } from '../wireFailureShape.js';
|
|
2
3
|
import { hostLog } from '../host.js';
|
|
3
4
|
import { msg, renderMessage } from '../i18n/translate.js';
|
|
@@ -97,7 +98,7 @@ function narrowBucket(raw, field) {
|
|
|
97
98
|
const x = raw[i];
|
|
98
99
|
if (typeof x !== 'string')
|
|
99
100
|
return { ok: false, detail: `rule field "${field}" entry ${i} is not a string` };
|
|
100
|
-
list
|
|
101
|
+
appendOwnElement(list, x);
|
|
101
102
|
}
|
|
102
103
|
return { ok: true, list };
|
|
103
104
|
}
|
|
@@ -195,13 +196,13 @@ export function tightenedSessionRules(prior, add) {
|
|
|
195
196
|
if (seen.has(x))
|
|
196
197
|
continue;
|
|
197
198
|
seen.add(x);
|
|
198
|
-
merged
|
|
199
|
+
appendOwnElement(merged, x);
|
|
199
200
|
}
|
|
200
201
|
for (const x of al ?? []) {
|
|
201
202
|
if (seen.has(x))
|
|
202
203
|
continue;
|
|
203
204
|
seen.add(x);
|
|
204
|
-
merged
|
|
205
|
+
appendOwnElement(merged, x);
|
|
205
206
|
}
|
|
206
207
|
out[field] = merged;
|
|
207
208
|
}
|
|
@@ -329,7 +330,7 @@ function earlierGrammarEntriesOf(prior, outgoing) {
|
|
|
329
330
|
if (name === undefined || name === rule)
|
|
330
331
|
continue;
|
|
331
332
|
seen.add(rule);
|
|
332
|
-
out
|
|
333
|
+
appendOwnElement(out, { field: 'toolAllow', rule });
|
|
333
334
|
}
|
|
334
335
|
return out;
|
|
335
336
|
}
|
|
@@ -413,11 +414,67 @@ export async function tightenSessionPolicy(facade, req, opts) {
|
|
|
413
414
|
return { kind: 'conflict', rev: second.retryAtRev };
|
|
414
415
|
}
|
|
415
416
|
const earlierGrammarNote = (lang) => renderMessage(msg('rules.sessionPolicy.tighten.earlierGrammar'), lang);
|
|
416
|
-
|
|
417
|
+
function factSlot(facts, key) {
|
|
418
|
+
try {
|
|
419
|
+
return ownRead(facts, key);
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function factCount(facts, key) {
|
|
426
|
+
const n = factSlot(facts, key);
|
|
427
|
+
return typeof n === 'number' && Number.isSafeInteger(n) && n >= 1 ? n : undefined;
|
|
428
|
+
}
|
|
429
|
+
function firstRuleWorkFactsOf(facts) {
|
|
430
|
+
const none = { agents: undefined, workflows: undefined, untracked: undefined, unreadable: false };
|
|
431
|
+
if (typeof facts !== 'object' || facts === null)
|
|
432
|
+
return none;
|
|
433
|
+
return {
|
|
434
|
+
agents: factCount(facts, 'agentsStartedBeforeFirstRule'),
|
|
435
|
+
workflows: factCount(facts, 'workflowsRunning'),
|
|
436
|
+
untracked: factCount(facts, 'untrackedBackgroundItems'),
|
|
437
|
+
unreadable: factSlot(facts, 'inFlightUnreadable') === true,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function deploymentHasNoOperator(d) {
|
|
441
|
+
try {
|
|
442
|
+
return typeof d === 'object' && d !== null && ownRead(d, 'operator') === 'absent';
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function deploymentHasNoIdentity(d) {
|
|
449
|
+
try {
|
|
450
|
+
return typeof d === 'object' && d !== null && ownRead(d, 'identityAttach') === 'unavailable';
|
|
451
|
+
}
|
|
452
|
+
catch {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
export function sessionPolicyTightenNotice(outcome, lang, facts, deployment) {
|
|
417
457
|
const say = (key, params) => renderMessage(msg(key, params), lang);
|
|
418
458
|
switch (outcome.kind) {
|
|
419
|
-
case 'written':
|
|
420
|
-
|
|
459
|
+
case 'written': {
|
|
460
|
+
const head = say('rules.sessionPolicy.tighten.written', { rev: outcome.rev });
|
|
461
|
+
const w = firstRuleWorkFactsOf(facts);
|
|
462
|
+
const unseen = msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.unseen');
|
|
463
|
+
if (w.unreadable)
|
|
464
|
+
return `${head} ${renderMessage(msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.unreadable'), lang)} ${renderMessage(unseen, lang)}`;
|
|
465
|
+
const parts = [];
|
|
466
|
+
if (w.agents !== undefined)
|
|
467
|
+
appendOwnElement(parts, msg(w.agents === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.agents.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.agents.many', { n: w.agents }));
|
|
468
|
+
if (w.workflows !== undefined)
|
|
469
|
+
appendOwnElement(parts, msg(w.workflows === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.workflows.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.workflows.many', { n: w.workflows }));
|
|
470
|
+
if (w.untracked !== undefined)
|
|
471
|
+
appendOwnElement(parts, msg(w.untracked === 1 ? 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.untracked.one' : 'rules.sessionPolicy.tighten.writtenBeforeFirstRule.untracked.many', { n: w.untracked }));
|
|
472
|
+
const [p0, p1, p2] = parts;
|
|
473
|
+
if (p0 === undefined)
|
|
474
|
+
return head;
|
|
475
|
+
const list = p1 === undefined ? p0 : p2 === undefined ? msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.list.two', { a: p0, b: p1 }) : msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.list.three', { a: p0, b: p1, c: p2 });
|
|
476
|
+
return `${head} ${renderMessage(msg('rules.sessionPolicy.tighten.writtenBeforeFirstRule.counts', { list }), lang)} ${renderMessage(unseen, lang)}`;
|
|
477
|
+
}
|
|
421
478
|
case 'conflict':
|
|
422
479
|
return say('rules.sessionPolicy.tighten.conflict');
|
|
423
480
|
case 'loosen_forbidden':
|
|
@@ -435,13 +492,13 @@ export function sessionPolicyTightenNotice(outcome, lang) {
|
|
|
435
492
|
case 'session_not_found':
|
|
436
493
|
return say('rules.sessionPolicy.tighten.unknown.sessionNotFound');
|
|
437
494
|
case 'session_ownerless':
|
|
438
|
-
return say('rules.sessionPolicy.tighten.unknown.sessionOwnerless');
|
|
495
|
+
return say(deploymentHasNoIdentity(deployment) ? 'rules.sessionPolicy.tighten.unknown.sessionOwnerless.noIdentity' : 'rules.sessionPolicy.tighten.unknown.sessionOwnerless');
|
|
439
496
|
case 'unauthorized':
|
|
440
497
|
return say('rules.sessionPolicy.tighten.unknown.unauthorized');
|
|
441
498
|
case 'request_rejected':
|
|
442
499
|
return say('rules.sessionPolicy.tighten.unknown.requestRejected');
|
|
443
500
|
case 'store_corrupt':
|
|
444
|
-
return say('rules.sessionPolicy.tighten.unknown.storeCorrupt');
|
|
501
|
+
return say(deploymentHasNoOperator(deployment) ? 'rules.sessionPolicy.tighten.unknown.storeCorrupt.noOperator' : 'rules.sessionPolicy.tighten.unknown.storeCorrupt');
|
|
445
502
|
case 'read_unreadable':
|
|
446
503
|
return say('rules.sessionPolicy.tighten.unknown.readUnreadable');
|
|
447
504
|
case 'read_failed':
|
|
@@ -460,13 +517,15 @@ export function sessionPolicyTightenNotice(outcome, lang) {
|
|
|
460
517
|
const READ_NOTICE_GENERIC = 'This session’s rule record could not be shown, so what it holds is not known. Try reading it again.';
|
|
461
518
|
const READ_NOTICE_NO_TARGET = 'There is no engine connection for this session, so its rule record cannot be read and what it holds is not known. Look again once it is connected.';
|
|
462
519
|
const READ_NOTICE_NOT_STARTED = 'This session has not begun on the engine yet — nothing has been sent in it — so it has no rule record to read. Send a first message, then look again.';
|
|
463
|
-
function readFailureSentence(kind) {
|
|
520
|
+
function readFailureSentence(kind, deployment) {
|
|
464
521
|
switch (kind) {
|
|
465
522
|
case 'face-unavailable':
|
|
466
523
|
return 'This deployment does not keep per-session tool rules, so there is no session rule record to read.';
|
|
467
524
|
case 'loosen-forbidden':
|
|
468
525
|
return 'The engine answered this read with a refusal that only applies to relaxing rules, so this session’s rule record could not be read. Try again; if it keeps happening, whoever runs the engine needs to look at it.';
|
|
469
526
|
case 'store-corrupt':
|
|
527
|
+
if (deploymentHasNoOperator(deployment))
|
|
528
|
+
return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.readStoreCorrupt'));
|
|
470
529
|
return 'The engine could not establish which version this session’s rules are at, so it would not hand the record over. This needs an operator to look at the rule store.';
|
|
471
530
|
case 'cas-conflict':
|
|
472
531
|
return 'The engine reported a version clash on this session’s rule record, so it could not be read this time. Try again.';
|
|
@@ -504,7 +563,7 @@ function ownRead(o, key) {
|
|
|
504
563
|
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
505
564
|
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
506
565
|
}
|
|
507
|
-
export function sessionPolicyReadNotice(outcome) {
|
|
566
|
+
export function sessionPolicyReadNotice(outcome, deployment) {
|
|
508
567
|
try {
|
|
509
568
|
if (outcome === null || typeof outcome !== 'object')
|
|
510
569
|
return READ_NOTICE_GENERIC;
|
|
@@ -513,7 +572,7 @@ export function sessionPolicyReadNotice(outcome) {
|
|
|
513
572
|
const failure = ownRead(outcome, 'failure');
|
|
514
573
|
if (failure === null || typeof failure !== 'object')
|
|
515
574
|
return READ_NOTICE_GENERIC;
|
|
516
|
-
return readFailureSentence(ownRead(failure, 'kind')) ?? READ_NOTICE_GENERIC;
|
|
575
|
+
return readFailureSentence(ownRead(failure, 'kind'), deployment) ?? READ_NOTICE_GENERIC;
|
|
517
576
|
}
|
|
518
577
|
if (arm === 'malformed')
|
|
519
578
|
return readMalformedSentence(ownRead(outcome, 'why')) ?? READ_NOTICE_GENERIC;
|
|
@@ -544,20 +603,20 @@ function withoutRefusedEntries(prior, mounted) {
|
|
|
544
603
|
const seen = new Set();
|
|
545
604
|
for (const x of list) {
|
|
546
605
|
if (mounted.has(x)) {
|
|
547
|
-
kept
|
|
606
|
+
appendOwnElement(kept, x);
|
|
548
607
|
continue;
|
|
549
608
|
}
|
|
550
609
|
const kind = ruleToolNameVerdictOf(x).kind;
|
|
551
610
|
if (kind === 'unknown')
|
|
552
611
|
return 'judge_failed';
|
|
553
612
|
if (kind === 'current') {
|
|
554
|
-
kept
|
|
613
|
+
appendOwnElement(kept, x);
|
|
555
614
|
continue;
|
|
556
615
|
}
|
|
557
616
|
if (seen.has(x))
|
|
558
617
|
continue;
|
|
559
618
|
seen.add(x);
|
|
560
|
-
removed
|
|
619
|
+
appendOwnElement(removed, { field, rule: x });
|
|
561
620
|
}
|
|
562
621
|
next[field] = kept;
|
|
563
622
|
}
|
|
@@ -656,7 +715,7 @@ export async function removeRefusedSessionRules(facade, sessionId, roster, opts)
|
|
|
656
715
|
return second.done;
|
|
657
716
|
return { kind: 'conflict', rev: second.retryAtRev };
|
|
658
717
|
}
|
|
659
|
-
export function sessionPolicyRemovalNotice(outcome) {
|
|
718
|
+
export function sessionPolicyRemovalNotice(outcome, deployment) {
|
|
660
719
|
const generic = 'The session’s rule record may not have changed — re-read it before doing anything else.';
|
|
661
720
|
if (outcome === null || typeof outcome !== 'object')
|
|
662
721
|
return generic;
|
|
@@ -683,6 +742,8 @@ export function sessionPolicyRemovalNotice(outcome) {
|
|
|
683
742
|
case 'judge_failed':
|
|
684
743
|
return 'Nothing was changed: this client could not check which entries in this session’s rule record name a tool the engine refuses (its copy of the engine’s tool-name check is unavailable or gave no clear answer), so it removed none rather than guess. Removing them needs that check available in this client.';
|
|
685
744
|
case 'loosen_forbidden':
|
|
745
|
+
if (deploymentHasNoOperator(deployment))
|
|
746
|
+
return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeLoosenForbidden'));
|
|
686
747
|
return 'The engine refused to take these entries out of this session’s rule record: on this engine only an operator can remove entries from it, so the record is unchanged. Ask an operator to remove them, or continue in a new session.';
|
|
687
748
|
case 'conflict':
|
|
688
749
|
return 'This session’s rule record was changed by someone else while the refused entries were being removed, twice in a row — nothing was changed. Try again once the other change has finished.';
|
|
@@ -697,6 +758,8 @@ export function sessionPolicyRemovalNotice(outcome) {
|
|
|
697
758
|
case 'unauthorized':
|
|
698
759
|
return 'This call could not present a verifiable identity, so nothing was changed.';
|
|
699
760
|
case 'store_corrupt':
|
|
761
|
+
if (deploymentHasNoOperator(deployment))
|
|
762
|
+
return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeReadStoreCorrupt'));
|
|
700
763
|
return 'The engine could not establish which version this session’s rules are at, so nothing was changed. This needs an operator to look at the rule store.';
|
|
701
764
|
case 'read_unreadable':
|
|
702
765
|
return 'The session’s current rules could not be read, so nothing was changed — rewriting a record that cannot be read could replace real restrictions.';
|
|
@@ -706,6 +769,8 @@ export function sessionPolicyRemovalNotice(outcome) {
|
|
|
706
769
|
case 'write_refused':
|
|
707
770
|
switch (outcome.why) {
|
|
708
771
|
case 'store_corrupt':
|
|
772
|
+
if (deploymentHasNoOperator(deployment))
|
|
773
|
+
return renderMessage(msg('rules.sessionPolicy.deployment.noOperator.removeWriteStoreCorrupt'));
|
|
709
774
|
return 'The engine could not establish which version this session’s rules are at and refused to stamp a new one, so nothing was changed. This needs an operator to look at the rule store.';
|
|
710
775
|
case 'session_not_found':
|
|
711
776
|
return 'This session is not writable from here — it may not exist, or it may belong to someone else (the engine answers both the same way, so this client cannot tell which); nothing was changed.';
|
|
@@ -8,7 +8,7 @@ const UNREADABLE = Symbol('unreadable');
|
|
|
8
8
|
function ownData(v, key) {
|
|
9
9
|
try {
|
|
10
10
|
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
11
|
-
return d !== undefined && 'value'
|
|
11
|
+
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
12
12
|
}
|
|
13
13
|
catch {
|
|
14
14
|
return undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HitlClientLike, type DecideOperationObserver } from './hitlBridge.js';
|
|
2
|
+
import { readApprovalCardWord, type ApprovalCardWord } from './approvalCardReading.js';
|
|
2
3
|
import { type ApprovalAllowRuleShadow } from './allowRuleShadow.js';
|
|
3
4
|
import type { UiLanguage } from '../env/uiLanguage.js';
|
|
4
5
|
import type { SessionRuleInertReason } from './sessionPolicyWire.js';
|
|
@@ -8,13 +9,15 @@ import { type ApprovalMandateWord } from '../gateVocabulary.js';
|
|
|
8
9
|
import type { ToolPermissionRequest } from '../seatContract.js';
|
|
9
10
|
import { type ApprovalDecidedByReading } from '../approvalDecidedByCapability.js';
|
|
10
11
|
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS } from '@sema-agent/sdk';
|
|
11
|
-
import type { ApprovalDecidedBy, ToolApprovalDecision as SdkToolApprovalDecision, ToolApprovalRespondAck, ToolApprovalRespondReplayed, PersistedRuleAnchor, RuleOfferMatch, RuleOfferBatchMember, RuleOfferUncoveredDetail, RuleOfferUncoveredReason, AskOrigin, RuleOffersAbsence, DenialLimitKind, DenialLimitFallback, ToolApprovalFrame, RuleOffer as SdkRuleOffer
|
|
12
|
+
import type { ApprovalDecidedBy, ApprovalCardDelegation, ToolApprovalDecision as SdkToolApprovalDecision, ToolApprovalRespondAck, ToolApprovalRespondReplayed, PersistedRuleAnchor, RuleOfferMatch, RuleOfferBatchMember, RuleOfferUncoveredDetail, RuleOfferUncoveredReason, AskOrigin, RuleOffersAbsence, DenialLimitKind, DenialLimitFallback, ToolApprovalFrame, RuleOffer as SdkRuleOffer } from '@sema-agent/sdk';
|
|
12
13
|
export declare function toolNameIsFsWrite(name: string): boolean;
|
|
13
14
|
export declare function toolNameIsShellExec(name: string): boolean;
|
|
14
|
-
export
|
|
15
|
+
export interface ToolApprovalGateLike {
|
|
15
16
|
kind?: unknown;
|
|
16
17
|
toolName?: unknown;
|
|
17
|
-
|
|
18
|
+
approvalCard?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare function isToolApprovalGate(gate: ToolApprovalGateLike | undefined | null): boolean;
|
|
18
21
|
export interface FsApprovalWireDeps {
|
|
19
22
|
client: HitlClientLike;
|
|
20
23
|
onPresented?: () => void;
|
|
@@ -106,7 +109,7 @@ export interface ApprovalCardRequest {
|
|
|
106
109
|
mandate?: ApprovalMandateWord;
|
|
107
110
|
denialLimitFallback?: DenialLimitFallback;
|
|
108
111
|
origin?: string;
|
|
109
|
-
approvalCard?:
|
|
112
|
+
approvalCard?: ApprovalCardWord;
|
|
110
113
|
askClass?: string;
|
|
111
114
|
classes?: readonly string[];
|
|
112
115
|
boundGrants?: BoundSkillGrantsWire;
|
|
@@ -162,11 +165,7 @@ export interface ReadRootCandidateView {
|
|
|
162
165
|
clearsThisAsk: true;
|
|
163
166
|
covers?: 'exact';
|
|
164
167
|
}
|
|
165
|
-
export
|
|
166
|
-
parentToolCallId: string;
|
|
167
|
-
depth: number;
|
|
168
|
-
agentName?: string;
|
|
169
|
-
}
|
|
168
|
+
export type ToolApprovalDelegation = ApprovalCardDelegation;
|
|
170
169
|
export declare const TOOL_APPROVAL_FRAME_KEYS_MIRROR: readonly ["type", "approvalId", "toolCallId", "toolName", "sourceTaskId", "fromSubagent", "sourceAgentName", "message", "args", "argsOmitted", "governanceForced", "ruleOffers", "ruleOffersAbsence", "denialLimitFallback", "readRootCandidate", "mandated", "mandate", "origin", "approvalCard", "askClass", "classes", "inputHasBidi", "parked", "persistedRuleShadowed", "allowRuleShadowed", "probeCause", "probeReason", "rememberRefused", "boundGrantDigest", "boundGrantAbsence", "boundGrants", "classifierNoRuling", "ruleEvidence", "requiresRealApproval", "expiresInMs", "expiresAtMs", "serverNowMs", "delegation", "outcome", "cause"];
|
|
171
170
|
export interface ApprovalMandatedFacts {
|
|
172
171
|
readonly mandated?: true;
|
|
@@ -177,7 +176,7 @@ export declare function approvalIsMandated(v: ApprovalMandatedFacts | undefined
|
|
|
177
176
|
export declare function readApprovalMandate(v: {
|
|
178
177
|
readonly mandate?: string;
|
|
179
178
|
} | undefined | null): ApprovalMandateWord | undefined;
|
|
180
|
-
export
|
|
179
|
+
export { readApprovalCardWord };
|
|
181
180
|
export declare function toolPermissionRequestAskBits(card: object | null | undefined, requestId?: string): Pick<ToolPermissionRequest, 'mandated' | 'mandate' | 'origin' | 'ruleOffersAbsence' | 'askClass' | 'classes' | 'sessionRow'>;
|
|
182
181
|
export declare function isFromSubagent(frame: ToolApprovalFrame): boolean;
|
|
183
182
|
export type ToolApprovalRespondDecision = SdkToolApprovalDecision;
|