@sema-agent/client-core 0.97.1 → 0.99.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 +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- 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/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- 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 +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- 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 +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- 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 +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- 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/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- 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 +8 -0
- package/dist/frameBinding.js +35 -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 +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- 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 +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- 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 +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- 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 +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -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.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- 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/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- 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 +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- 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/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- 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 +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -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 +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -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/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- 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/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- 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/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type HookMatcherUnjudgedReason = 'event_out_of_scope' | 'not_a_string' | 'oversize' | '
|
|
1
|
+
export type HookMatcherUnjudgedReason = 'event_out_of_scope' | 'not_a_string' | 'oversize' | 'pattern_unsupported' | 'over_budget';
|
|
2
|
+
export type HookMatcherRefusedReason = 'alias_without_canonical' | 'invalid_regex';
|
|
2
3
|
export type HookMatcherVerdict = {
|
|
3
4
|
readonly kind: 'matchesAll';
|
|
4
5
|
} | {
|
|
@@ -14,6 +15,10 @@ export type HookMatcherVerdict = {
|
|
|
14
15
|
readonly reading: 'names' | 'pattern';
|
|
15
16
|
readonly alias: string;
|
|
16
17
|
readonly canonical: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: 'refused';
|
|
20
|
+
readonly reason: 'invalid_regex';
|
|
21
|
+
readonly reading: 'pattern';
|
|
17
22
|
} | {
|
|
18
23
|
readonly kind: 'unjudged';
|
|
19
24
|
readonly reason: HookMatcherUnjudgedReason;
|
|
@@ -12,6 +12,9 @@ function unjudged(reason) {
|
|
|
12
12
|
function refused(reading, p) {
|
|
13
13
|
return Object.freeze({ kind: 'refused', reason: 'alias_without_canonical', reading, alias: p.alias, canonical: p.canonical });
|
|
14
14
|
}
|
|
15
|
+
function refusedInvalidRegex() {
|
|
16
|
+
return Object.freeze({ kind: 'refused', reason: 'invalid_regex', reading: 'pattern' });
|
|
17
|
+
}
|
|
15
18
|
function aliasPairs() {
|
|
16
19
|
return Object.entries(HOOK_TOOL_ALIASES).map(([alias, canonical]) => ({ alias, canonical }));
|
|
17
20
|
}
|
|
@@ -185,7 +188,7 @@ export function hookMatcherVerdict(event, matcher) {
|
|
|
185
188
|
return unjudged('oversize');
|
|
186
189
|
const form = SETTINGS_HOOK_MATCHER_FORM(matcher);
|
|
187
190
|
if (form === 'invalid')
|
|
188
|
-
return
|
|
191
|
+
return refusedInvalidRegex();
|
|
189
192
|
const pairs = aliasPairs();
|
|
190
193
|
if (form === 'regex' && matcher !== undefined) {
|
|
191
194
|
const subjects = pairs.flatMap((p) => [p.alias, p.canonical]);
|
|
@@ -199,10 +202,10 @@ export function hookMatcherVerdict(event, matcher) {
|
|
|
199
202
|
const selects = (name) => {
|
|
200
203
|
try {
|
|
201
204
|
const v = SETTINGS_HOOK_MATCHER_SELECTS(matcher, name);
|
|
202
|
-
return
|
|
205
|
+
return v === true ? true : v === false ? false : 'invalid';
|
|
203
206
|
}
|
|
204
207
|
catch {
|
|
205
|
-
return
|
|
208
|
+
return 'threw';
|
|
206
209
|
}
|
|
207
210
|
};
|
|
208
211
|
if (form === 'literal' && selects('') === true)
|
|
@@ -211,13 +214,17 @@ export function hookMatcherVerdict(event, matcher) {
|
|
|
211
214
|
const selected = [];
|
|
212
215
|
for (const p of pairs) {
|
|
213
216
|
const a = selects(p.alias);
|
|
214
|
-
if (a ===
|
|
215
|
-
return
|
|
217
|
+
if (a === 'invalid')
|
|
218
|
+
return refusedInvalidRegex();
|
|
219
|
+
if (a === 'threw')
|
|
220
|
+
return unjudged('pattern_unsupported');
|
|
216
221
|
if (!a)
|
|
217
222
|
continue;
|
|
218
223
|
const c = selects(p.canonical);
|
|
219
|
-
if (c ===
|
|
220
|
-
return
|
|
224
|
+
if (c === 'invalid')
|
|
225
|
+
return refusedInvalidRegex();
|
|
226
|
+
if (c === 'threw')
|
|
227
|
+
return unjudged('pattern_unsupported');
|
|
221
228
|
if (!c)
|
|
222
229
|
return refused(reading, p);
|
|
223
230
|
selected.push(p);
|
package/dist/hooksWireCaps.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import type { WireHooksConfig } from './finalVerifyWire.js';
|
|
|
4
4
|
export { GOAL_STOP_HOOK_WIRE_ENV, isGoalStopHookWireArmed, setWireSessionStopHook, getWireSessionStopHook, } from './goalStopHook.js';
|
|
5
5
|
export type { WireHooksConfig };
|
|
6
6
|
export interface HooksForWireOptions {
|
|
7
|
-
readonly plan
|
|
7
|
+
readonly plan: HooksWirePlan;
|
|
8
8
|
}
|
|
9
|
-
export declare function hooksForWire(opts
|
|
9
|
+
export declare function hooksForWire(opts: HooksForWireOptions): WireHooksConfig | undefined;
|
|
10
10
|
export declare function hooksWirePlan(opts?: HooksWirePlanOptions): HooksWirePlan;
|
|
11
11
|
export declare function __resetHooksWireCapsForTests(): void;
|
|
12
12
|
export declare function fleetHookFailureNoticeCapable(baseUrl: string | undefined): boolean;
|
package/dist/hooksWireCaps.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { engineCapNestedTrue, engineCapState, engineCapValue } from './engineCapsCache.js';
|
|
2
|
-
import {
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
3
|
import { capForDisplay, collapseLabel } from './fleetTaskDesc.js';
|
|
4
4
|
import { hostLog, hostSettings } from './host.js';
|
|
5
|
-
import {
|
|
5
|
+
import { hooksSalvageMaskOf, salvageSettingsHooksEntries, settingsHooksSalvageNotice } from './settingsHooksSalvage.js';
|
|
6
|
+
import { createSettingsHookJudge, decidePluginHooks, decideSessionHooks, dedupeSettingsHookGroups, filterSettingsHookGroups, hooksWirePlanShapeOf, occupancyOf, } from './pluginHooksWire.js';
|
|
6
7
|
import { MAX_HOOK_NOTICE_TEXT_CHARS } from './notifications.js';
|
|
7
8
|
import { goalStopHookMatcher, __resetGoalStopHookForTests } from './goalStopHook.js';
|
|
8
9
|
export { GOAL_STOP_HOOK_WIRE_ENV, isGoalStopHookWireArmed, setWireSessionStopHook, getWireSessionStopHook, } from './goalStopHook.js';
|
|
@@ -100,26 +101,43 @@ function managedPolicyUnreadable(settings) {
|
|
|
100
101
|
return true;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
const NO_LAYER = Object.freeze({ hooks: null, mask: undefined });
|
|
105
|
+
function layerOfDoc(source, doc) {
|
|
104
106
|
try {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
return classifyLayer(source, doc);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
hostLog('debug', `hooksWireCaps: ${source} settings could not be read by the hooks reader — treated as no hooks from this source: ${String(err)}`);
|
|
111
|
+
return NO_LAYER;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function classifyLayer(source, doc) {
|
|
115
|
+
const salvage = salvageSettingsHooksEntries(doc);
|
|
116
|
+
const hooks = typeof doc === 'object' && doc !== null && !Array.isArray(doc) ? doc.hooks : undefined;
|
|
117
|
+
const original = typeof hooks === 'object' && hooks !== null && !Array.isArray(hooks) ? hooks : null;
|
|
118
|
+
if (salvage.outcome === 'loaded')
|
|
119
|
+
return { hooks: original, mask: undefined };
|
|
120
|
+
const notice = settingsHooksSalvageNotice(salvage, source, doc) ?? '';
|
|
121
|
+
const row = Object.freeze({ source, outcome: salvage.outcome, dropped: salvage.dropped, rejections: salvage.rejections, notice });
|
|
122
|
+
if (salvage.outcome === 'rejected')
|
|
123
|
+
return { hooks: null, mask: undefined, row };
|
|
124
|
+
return { hooks: original, mask: hooksSalvageMaskOf(salvage.dropped), row };
|
|
125
|
+
}
|
|
126
|
+
function layerOfSource(source) {
|
|
127
|
+
let doc;
|
|
128
|
+
try {
|
|
129
|
+
doc = hostSettings()?.getSettingsForSource(source);
|
|
107
130
|
}
|
|
108
131
|
catch (err) {
|
|
109
132
|
hostLog('debug', `hooksWireCaps: ${source} settings read threw — treated as no hooks from this source: ${String(err)}`);
|
|
110
|
-
return
|
|
133
|
+
return NO_LAYER;
|
|
111
134
|
}
|
|
135
|
+
return layerOfDoc(source, doc);
|
|
112
136
|
}
|
|
113
137
|
let warnedNoPluginReader = new WeakSet();
|
|
114
138
|
const NO_PLUGIN_READER_WARNING = 'client-core: the installed settings port does not implement enabledPluginHooks() — ' +
|
|
115
139
|
'plugin hooks are not sent to the engine and are not reported as not running. ' +
|
|
116
140
|
'Implement SettingsPort.enabledPluginHooks() to list the enabled plugins and their hooks.';
|
|
117
|
-
let warnedNoPlanDrops = new WeakMap();
|
|
118
|
-
function noPlanDropWarning(event, reason) {
|
|
119
|
-
return (`client-core: ${displayUntrusted(event, { credentialUrls: false, credentialWords: false })} hooks from settings are not sent to the engine (${reason}), so they do not run there — ` +
|
|
120
|
-
`${settingsHookDropText(reason)}. Build the request with hooksForWire({ plan }) from hooksWirePlan() and show ` +
|
|
121
|
-
'hooksNotRunNotice(plan) to tell the user which hooks will not run.');
|
|
122
|
-
}
|
|
123
141
|
function guardPluginTraversal(run) {
|
|
124
142
|
try {
|
|
125
143
|
return run();
|
|
@@ -150,48 +168,87 @@ function readPluginHooks(settings, warnIfAbsent) {
|
|
|
150
168
|
}
|
|
151
169
|
return { state: 'absent' };
|
|
152
170
|
}
|
|
153
|
-
|
|
154
|
-
export function hooksForWire(opts = {}) {
|
|
155
|
-
const given = opts?.plan;
|
|
156
|
-
if (isHooksWirePlan(given))
|
|
157
|
-
return given.wire;
|
|
158
|
-
if (given !== undefined && given !== null) {
|
|
159
|
-
hostLog('debug', 'hooksForWire: opts.plan is not a plan from hooksWirePlan() — treated as absent (settings hooks only)');
|
|
160
|
-
}
|
|
161
|
-
if (isHooksWirePlan(opts))
|
|
162
|
-
return opts.wire;
|
|
163
|
-
return buildHooksWirePlan(NO_PLAN_ENGINE, () => false, false, true).wire;
|
|
164
|
-
}
|
|
165
|
-
function isHooksWirePlan(v) {
|
|
171
|
+
function readSessionHooks(settings) {
|
|
166
172
|
try {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
arrayOrAbsent('settingsVerdicts') &&
|
|
181
|
-
arrayOrAbsent('settingsExcluded') &&
|
|
182
|
-
(reader === 'present' || reader === 'absent' || reader === 'failed') &&
|
|
183
|
-
typeof engineFacts === 'object' &&
|
|
184
|
-
engineFacts !== null &&
|
|
185
|
-
(wire === undefined || (typeof wire === 'object' && wire !== null && !Array.isArray(wire))));
|
|
173
|
+
const member = settings.sessionHooks;
|
|
174
|
+
if (member === undefined)
|
|
175
|
+
return { state: 'absent' };
|
|
176
|
+
if (typeof member !== 'function') {
|
|
177
|
+
hostLog('debug', 'hooksWireCaps: sessionHooks is not a method — no session hooks judged this turn');
|
|
178
|
+
return { state: 'failed' };
|
|
179
|
+
}
|
|
180
|
+
const r = member.call(settings);
|
|
181
|
+
const sources = typeof r === 'object' && r !== null ? r.sources : undefined;
|
|
182
|
+
if (Array.isArray(sources))
|
|
183
|
+
return { state: 'present', sources };
|
|
184
|
+
hostLog('debug', 'hooksWireCaps: sessionHooks() returned a malformed reading — no session hooks judged this turn');
|
|
185
|
+
return { state: 'failed' };
|
|
186
186
|
}
|
|
187
187
|
catch (err) {
|
|
188
|
-
hostLog('debug', `
|
|
189
|
-
return
|
|
188
|
+
hostLog('debug', `hooksWireCaps: sessionHooks() threw — no session hooks judged this turn: ${String(err)}`);
|
|
189
|
+
return { state: 'failed' };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function suppressedLocallyOf(o) {
|
|
193
|
+
let raw;
|
|
194
|
+
try {
|
|
195
|
+
raw = o.suppressedLocally;
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
hostLog('debug', 'hooksWirePlan: suppressedLocally threw while being read — treated as absent (no plugin suppressed locally)');
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
if (raw === undefined)
|
|
202
|
+
return undefined;
|
|
203
|
+
if (!Array.isArray(raw) || !raw.every((x) => typeof x === 'string')) {
|
|
204
|
+
hostLog('debug', 'hooksWirePlan: suppressedLocally is not an array of plugin ids — treated as absent (no plugin suppressed locally)');
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
return new Set(raw);
|
|
208
|
+
}
|
|
209
|
+
function usageError(sentence) {
|
|
210
|
+
return new TypeError(renderMessage(sentence));
|
|
211
|
+
}
|
|
212
|
+
function hostValueShape(v) {
|
|
213
|
+
try {
|
|
214
|
+
if (v === undefined)
|
|
215
|
+
return msg('config.hooks.valueShape.nothing');
|
|
216
|
+
if (v === null)
|
|
217
|
+
return msg('config.hooks.valueShape.null');
|
|
218
|
+
if (Array.isArray(v))
|
|
219
|
+
return msg('config.hooks.valueShape.array');
|
|
220
|
+
return typeof v === 'object' ? msg('config.hooks.valueShape.object') : msg('config.hooks.valueShape.typeof', { type: typeof v });
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return msg('config.hooks.valueShape.unreadable');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export function hooksForWire(opts) {
|
|
227
|
+
if (typeof opts !== 'object' || opts === null)
|
|
228
|
+
throw usageError(msg('config.hooks.forWire.gotShape', { shape: hostValueShape(opts) }));
|
|
229
|
+
let given;
|
|
230
|
+
try {
|
|
231
|
+
given = opts.plan;
|
|
190
232
|
}
|
|
233
|
+
catch {
|
|
234
|
+
throw usageError(msg('config.hooks.forWire.readPlanThrew'));
|
|
235
|
+
}
|
|
236
|
+
const shape = planShapeOf(given);
|
|
237
|
+
if (shape === 'plan') {
|
|
238
|
+
try {
|
|
239
|
+
return given.wire;
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
throw usageError(msg('config.hooks.forWire.readWireThrew'));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (shape === 'threw')
|
|
246
|
+
throw usageError(msg('config.hooks.forWire.planUnreadable'));
|
|
247
|
+
if (given === undefined && planShapeOf(opts) === 'plan')
|
|
248
|
+
throw usageError(msg('config.hooks.forWire.planPassedBare'));
|
|
249
|
+
throw usageError(given === undefined ? msg('config.hooks.forWire.planMissing') : msg('config.hooks.forWire.planNotPlan', { shape: hostValueShape(given) }));
|
|
191
250
|
}
|
|
192
|
-
const
|
|
193
|
-
const _planKeysPin = [true, true];
|
|
194
|
-
void _planKeysPin;
|
|
251
|
+
const planShapeOf = hooksWirePlanShapeOf;
|
|
195
252
|
export function hooksWirePlan(opts = {}) {
|
|
196
253
|
const o = opts ?? {};
|
|
197
254
|
const owned = o.engineOwnedByThisShell;
|
|
@@ -217,7 +274,7 @@ export function hooksWirePlan(opts = {}) {
|
|
|
217
274
|
const types = typesByEvent.get(event);
|
|
218
275
|
return types === undefined || (typeof type === 'string' && types.has(type));
|
|
219
276
|
};
|
|
220
|
-
return buildHooksWirePlan(engine, shellRuns,
|
|
277
|
+
return buildHooksWirePlan(engine, shellRuns, promptAuthoredByUserOf(o), suppressedLocallyOf(o));
|
|
221
278
|
}
|
|
222
279
|
function taskHooksCapability(baseUrl) {
|
|
223
280
|
const v = engineCapValue(baseUrl, 'taskSettings');
|
|
@@ -268,16 +325,34 @@ function promptAuthoredByUserOf(o) {
|
|
|
268
325
|
}
|
|
269
326
|
return true;
|
|
270
327
|
}
|
|
271
|
-
function buildHooksWirePlan(engine, shellRuns,
|
|
328
|
+
function buildHooksWirePlan(engine, shellRuns, promptAuthoredByUser, suppressedLocally) {
|
|
272
329
|
const settingsDropped = [];
|
|
273
330
|
const settingsVerdicts = [];
|
|
274
331
|
const settingsExcluded = [];
|
|
275
|
-
const
|
|
332
|
+
const settingsSalvage = [];
|
|
333
|
+
let sessionVerdicts = [];
|
|
334
|
+
let sessionReader = 'absent';
|
|
335
|
+
let closedBy = null;
|
|
336
|
+
const judge = createSettingsHookJudge(engine, shellRuns, promptAuthoredByUser);
|
|
276
337
|
let settingsStripped = 0;
|
|
277
|
-
const planOf = (pluginReader, wire, verdicts = [], excluded = []) => ({
|
|
338
|
+
const planOf = (pluginReader, wire, verdicts = [], excluded = [], moduleVerdicts = []) => ({
|
|
339
|
+
engine,
|
|
340
|
+
pluginReader,
|
|
341
|
+
verdicts,
|
|
342
|
+
excluded,
|
|
343
|
+
settingsDropped,
|
|
344
|
+
settingsVerdicts,
|
|
345
|
+
settingsExcluded,
|
|
346
|
+
settingsSalvage,
|
|
347
|
+
moduleVerdicts,
|
|
348
|
+
sessionVerdicts,
|
|
349
|
+
sessionReader,
|
|
350
|
+
closedBy,
|
|
351
|
+
wire,
|
|
352
|
+
});
|
|
278
353
|
const closedPlan = (settings, reason) => {
|
|
279
|
-
|
|
280
|
-
|
|
354
|
+
closedBy = reason;
|
|
355
|
+
sessionReader = readSessionHooks(settings).state;
|
|
281
356
|
const read = readPluginHooks(settings, false);
|
|
282
357
|
if (read.reading === undefined)
|
|
283
358
|
return planOf(read.state, undefined);
|
|
@@ -311,13 +386,28 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
311
386
|
if (managedPolicyUnreadable(settings))
|
|
312
387
|
return closedPlan(settings, 'governance_unreadable');
|
|
313
388
|
let policy = null;
|
|
389
|
+
let policyDoc;
|
|
314
390
|
try {
|
|
315
|
-
|
|
391
|
+
policyDoc = settings.getSettingsForSource('policySettings');
|
|
392
|
+
policy = policyDoc;
|
|
316
393
|
}
|
|
317
394
|
catch (err) {
|
|
318
395
|
hostLog('debug', `hooksWireCaps: policySettings read threw — fail-closed (no hooks projected to the engine): ${String(err)}`);
|
|
319
396
|
return closedPlan(settings, 'governance_unreadable');
|
|
320
397
|
}
|
|
398
|
+
let policyLayer;
|
|
399
|
+
try {
|
|
400
|
+
policyLayer = classifyLayer('policySettings', policyDoc);
|
|
401
|
+
}
|
|
402
|
+
catch (err) {
|
|
403
|
+
hostLog('debug', `hooksWireCaps: managed settings could not be read by the hooks reader — fail-closed (no hooks projected to the engine): ${String(err)}`);
|
|
404
|
+
return closedPlan(settings, 'governance_unreadable');
|
|
405
|
+
}
|
|
406
|
+
if (policyLayer.row?.outcome === 'rejected') {
|
|
407
|
+
settingsSalvage.push(policyLayer.row);
|
|
408
|
+
hostLog('debug', 'hooksWireCaps: managed settings hooks rejected by the hooks reader — fail-closed (no hooks projected to the engine)');
|
|
409
|
+
return closedPlan(settings, 'governance_unreadable');
|
|
410
|
+
}
|
|
321
411
|
if (policy?.disableAllHooks === true) {
|
|
322
412
|
hostLog('debug', 'hooksWireCaps: disableAllHooks (managed) — no hooks projected to the engine');
|
|
323
413
|
return closedPlan(settings, 'policy_disable_all');
|
|
@@ -334,10 +424,25 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
334
424
|
hostLog('debug', 'hooksWireCaps: disableAllHooks (merged, non-managed) — only policySettings hooks projected to the engine');
|
|
335
425
|
}
|
|
336
426
|
const managedOnly = managedByPolicy || disabledByNonManaged;
|
|
337
|
-
|
|
427
|
+
{
|
|
428
|
+
const sr = readSessionHooks(settings);
|
|
429
|
+
sessionReader = sr.state;
|
|
430
|
+
if (sr.sources !== undefined && !managedOnly) {
|
|
431
|
+
const sources = sr.sources;
|
|
432
|
+
const ds = guardPluginTraversal(() => decideSessionHooks({ sources, engine, shellRuns, promptAuthoredByUser }));
|
|
433
|
+
if (ds === undefined)
|
|
434
|
+
sessionReader = 'failed';
|
|
435
|
+
else {
|
|
436
|
+
sessionVerdicts = ds.verdicts;
|
|
437
|
+
if (ds.unreadable > 0)
|
|
438
|
+
hostLog('debug', `hooksWireCaps: ${ds.unreadable} session hook source(s) or group(s) unreadable — skipped`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const read = readPluginHooks(settings, true);
|
|
338
443
|
let oldStartupBit;
|
|
339
444
|
let pluginDataThrew = false;
|
|
340
|
-
if (read
|
|
445
|
+
if (read.reading !== undefined) {
|
|
341
446
|
const reading = read.reading;
|
|
342
447
|
const bit = guardPluginTraversal(() => reading.suppressedByStartupMode === true);
|
|
343
448
|
if (bit === undefined)
|
|
@@ -356,13 +461,18 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
356
461
|
const merged = {};
|
|
357
462
|
const sourced = new Map();
|
|
358
463
|
for (const source of sources) {
|
|
359
|
-
const
|
|
464
|
+
const layer = source === 'policySettings' ? policyLayer : layerOfSource(source);
|
|
465
|
+
if (layer.row !== undefined)
|
|
466
|
+
settingsSalvage.push(layer.row);
|
|
467
|
+
const hooks = layer.hooks;
|
|
360
468
|
if (!hooks)
|
|
361
469
|
continue;
|
|
362
470
|
for (const [event, groups] of Object.entries(hooks)) {
|
|
471
|
+
if (layer.mask !== undefined && layer.mask.eventDropped(event))
|
|
472
|
+
continue;
|
|
363
473
|
if (!Array.isArray(groups) || groups.length === 0)
|
|
364
474
|
continue;
|
|
365
|
-
const kept = filterSettingsHookGroups(source, event, groups, engine.pluginHooksCapable === true, (type) => shellRuns(event, type),
|
|
475
|
+
const kept = filterSettingsHookGroups(source, event, groups, engine.pluginHooksCapable === true, (type) => shellRuns(event, type), judge, layer.mask);
|
|
366
476
|
settingsDropped.push(...kept.drops);
|
|
367
477
|
settingsVerdicts.push(...kept.verdicts);
|
|
368
478
|
settingsExcluded.push(...kept.excluded);
|
|
@@ -401,25 +511,8 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
401
511
|
'stripped before sending (plugin context is only minted for entries from the plugin reader)');
|
|
402
512
|
}
|
|
403
513
|
const wireOf = () => (Object.keys(merged).length > 0 ? merged : undefined);
|
|
404
|
-
if (
|
|
405
|
-
|
|
406
|
-
for (const d of settingsDropped) {
|
|
407
|
-
if (!d.notRun)
|
|
408
|
-
continue;
|
|
409
|
-
const key = `${d.event}\u0000${d.reason}`;
|
|
410
|
-
if (seen?.has(key) === true)
|
|
411
|
-
continue;
|
|
412
|
-
if (seen === undefined) {
|
|
413
|
-
seen = new Set();
|
|
414
|
-
warnedNoPlanDrops.set(settings, seen);
|
|
415
|
-
}
|
|
416
|
-
seen.add(key);
|
|
417
|
-
hostLog('warn', noPlanDropWarning(d.event, d.reason));
|
|
418
|
-
}
|
|
419
|
-
return planOf('absent', wireOf());
|
|
420
|
-
}
|
|
421
|
-
if (read?.reading === undefined)
|
|
422
|
-
return planOf(read?.state ?? 'absent', wireOf());
|
|
514
|
+
if (read.reading === undefined)
|
|
515
|
+
return planOf(read.state, wireOf());
|
|
423
516
|
if (pluginDataThrew)
|
|
424
517
|
return planOf('failed', wireOf());
|
|
425
518
|
const reading = read.reading;
|
|
@@ -436,6 +529,7 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
436
529
|
shellRuns,
|
|
437
530
|
promptAuthoredByUser,
|
|
438
531
|
occupied,
|
|
532
|
+
...(suppressedLocally !== undefined ? { suppressedLocally } : {}),
|
|
439
533
|
});
|
|
440
534
|
});
|
|
441
535
|
if (d === undefined)
|
|
@@ -445,13 +539,12 @@ function buildHooksWirePlan(engine, shellRuns, withPlugins, promptAuthoredByUser
|
|
|
445
539
|
}
|
|
446
540
|
for (const [event, groups] of d.projected)
|
|
447
541
|
merged[event] = [...(merged[event] ?? []), ...groups];
|
|
448
|
-
return planOf('present', wireOf(), d.verdicts, d.excluded);
|
|
542
|
+
return planOf('present', wireOf(), d.verdicts, d.excluded, d.modules);
|
|
449
543
|
}
|
|
450
544
|
export function __resetHooksWireCapsForTests() {
|
|
451
545
|
__resetGoalStopHookForTests();
|
|
452
546
|
warnedNoMergedReader = new WeakSet();
|
|
453
547
|
warnedNoPluginReader = new WeakSet();
|
|
454
|
-
warnedNoPlanDrops = new WeakMap();
|
|
455
548
|
}
|
|
456
549
|
export function fleetHookFailureNoticeCapable(baseUrl) {
|
|
457
550
|
return engineCapNestedTrue(baseUrl, 'fleet', 'hookFailureNotice');
|
package/dist/host.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface SettingsPort {
|
|
|
9
9
|
enabledPluginHooks?(): PluginHooksReading;
|
|
10
10
|
hooksStartupMode?(): HooksStartupMode | undefined;
|
|
11
11
|
managedPolicyReading?(): ManagedPolicyReading;
|
|
12
|
+
sessionHooks?(): SessionHooksReading;
|
|
12
13
|
}
|
|
13
14
|
export type ManagedPolicyState = 'absent' | 'in-effect' | 'unreadable';
|
|
14
15
|
export interface ManagedPolicyReading {
|
|
@@ -32,6 +33,26 @@ export interface PluginHookSource {
|
|
|
32
33
|
readonly managed: boolean;
|
|
33
34
|
readonly options?: Readonly<Record<string, PluginHookOption>>;
|
|
34
35
|
readonly hooks: WireHooksConfig;
|
|
36
|
+
readonly hooksModule?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type SessionHookOrigin = 'skill' | 'agent' | 'sdk_host';
|
|
39
|
+
export interface SessionHookSource {
|
|
40
|
+
readonly origin: SessionHookOrigin;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly hooks: WireHooksConfig | {
|
|
43
|
+
readonly [event: string]: readonly {
|
|
44
|
+
readonly matcher?: string;
|
|
45
|
+
readonly hooks: readonly (NonNullable<WireHooksConfig[string]>[number]['hooks'][number] | SessionLocalHook)[];
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface SessionLocalHook {
|
|
50
|
+
readonly type: 'callback' | 'function';
|
|
51
|
+
readonly callback?: (...args: never[]) => void;
|
|
52
|
+
readonly timeout?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface SessionHooksReading {
|
|
55
|
+
readonly sources: readonly SessionHookSource[];
|
|
35
56
|
}
|
|
36
57
|
export interface PluginHooksReading {
|
|
37
58
|
readonly plugins: readonly PluginHookSource[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { WireHooksConfig } from './finalVerifyWire.js';
|
|
2
|
+
import type { SettingsDocument } from './host.js';
|
|
3
|
+
import { type HookSettingsSource, type HooksWirePlan } from './pluginHooksWire.js';
|
|
4
|
+
export declare const HOST_SUPPLIED_KEYS: readonly ["settings.hooks", "settings.resolved", "settings.webSearch", "settings.outputStyle"];
|
|
5
|
+
export type HostSuppliedKey = (typeof HOST_SUPPLIED_KEYS)[number];
|
|
6
|
+
export declare const HOST_SETTING_CAUSES: readonly ["carried", "entries_dropped", "source_rejected", "projection_failed", "source_unreadable", "empty", "no_source", "host_port_missing"];
|
|
7
|
+
export type HostSettingCause = (typeof HOST_SETTING_CAUSES)[number];
|
|
8
|
+
export declare const HOST_SETTING_DISPOSITIONS: readonly ["carry", "carry_partial", "withhold_notice", "refuse_turn", "unwired", "nothing_to_carry"];
|
|
9
|
+
export type HostSettingDisposition = (typeof HOST_SETTING_DISPOSITIONS)[number];
|
|
10
|
+
export type HostSettingPlane = 'turn' | 'session' | 'diagnostic';
|
|
11
|
+
export type HostSettingNoticeId = 'HS-UNWIRED' | 'HS-MANAGED-REJECTED' | 'HS-PROJECTION' | 'HS-SOURCE-UNREADABLE';
|
|
12
|
+
export interface HostSettingRow {
|
|
13
|
+
readonly key: HostSuppliedKey;
|
|
14
|
+
readonly cause: HostSettingCause;
|
|
15
|
+
readonly disposition: HostSettingDisposition;
|
|
16
|
+
readonly layers?: readonly HookSettingsSource[];
|
|
17
|
+
}
|
|
18
|
+
export interface HostSettingNotice {
|
|
19
|
+
readonly id: HostSettingNoticeId;
|
|
20
|
+
readonly plane: HostSettingPlane;
|
|
21
|
+
readonly text: string;
|
|
22
|
+
}
|
|
23
|
+
export type HostTurnVerdict = {
|
|
24
|
+
readonly kind: 'send';
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'refuse';
|
|
27
|
+
readonly notice: HostSettingNotice;
|
|
28
|
+
};
|
|
29
|
+
export interface HostTurnSettingsSources {
|
|
30
|
+
readonly hooks: {
|
|
31
|
+
readonly plan: HooksWirePlan;
|
|
32
|
+
} | 'none';
|
|
33
|
+
readonly resolved: {
|
|
34
|
+
readonly snapshot: SettingsDocument;
|
|
35
|
+
} | 'none';
|
|
36
|
+
readonly webSearch: {
|
|
37
|
+
readonly settings: SettingsDocument;
|
|
38
|
+
} | 'none';
|
|
39
|
+
readonly outputStyle: {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
} | 'none';
|
|
42
|
+
}
|
|
43
|
+
export interface HostTurnSettingsInput {
|
|
44
|
+
readonly sources: HostTurnSettingsSources;
|
|
45
|
+
}
|
|
46
|
+
export interface HostSettingsCarried {
|
|
47
|
+
readonly hooks?: WireHooksConfig;
|
|
48
|
+
readonly resolved?: SettingsDocument;
|
|
49
|
+
readonly webSearch?: SettingsDocument;
|
|
50
|
+
readonly outputStyle?: string;
|
|
51
|
+
}
|
|
52
|
+
declare const hostTurnSettingsBrand: unique symbol;
|
|
53
|
+
export interface HostTurnSettings {
|
|
54
|
+
readonly [hostTurnSettingsBrand]: true;
|
|
55
|
+
readonly verdict: HostTurnVerdict;
|
|
56
|
+
readonly rows: readonly HostSettingRow[];
|
|
57
|
+
readonly notices: readonly HostSettingNotice[];
|
|
58
|
+
readonly hooks: HooksWirePlan | undefined;
|
|
59
|
+
readonly carried: HostSettingsCarried;
|
|
60
|
+
}
|
|
61
|
+
export declare function rethrowHostResolvedDeferred(product: HostTurnSettings): void;
|
|
62
|
+
export type HostResolvedMaterializer = (snapshot: SettingsDocument) => SettingsDocument;
|
|
63
|
+
export declare function buildHostTurnSettings(input: HostTurnSettingsInput, materialize: HostResolvedMaterializer): HostTurnSettings;
|
|
64
|
+
export declare function hostSettingsSelfCheck(product: HostTurnSettings): readonly HostSuppliedKey[];
|
|
65
|
+
export declare class HostSettingsRefused extends Error {
|
|
66
|
+
readonly notice: HostSettingNotice;
|
|
67
|
+
constructor(n: HostSettingNotice);
|
|
68
|
+
}
|
|
69
|
+
export declare function hostTurnSettingsOf(v: unknown, depth?: 'shape' | 'full'): HostTurnSettings | undefined;
|
|
70
|
+
export declare const UNWIRED_HOST_TURN_SETTINGS: HostTurnSettings;
|
|
71
|
+
export {};
|