@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
|
@@ -7,6 +7,6 @@ export const CORE_SHELL_FACE_TOOL_NAMES = Object.freeze([
|
|
|
7
7
|
"Monitor",
|
|
8
8
|
]);
|
|
9
9
|
export const CORE_RELEASABLE_ASK_CLASSES_BY_FACE = Object.freeze({
|
|
10
|
-
"shell": Object.freeze(["transcript_write", "
|
|
11
|
-
"other": Object.freeze(["transcript_write", "
|
|
10
|
+
"shell": Object.freeze(["transcript_write", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
11
|
+
"other": Object.freeze(["transcript_write", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
12
12
|
});
|
|
@@ -8,7 +8,7 @@ export declare const CORE_DENIED_BY_VALUES: readonly ["policy", "hook", "org", "
|
|
|
8
8
|
export declare const CORE_PERMISSION_MODE_FOLD_REASONS: readonly string[];
|
|
9
9
|
export declare const CORE_ENGINE_CARD_TYPES: readonly string[];
|
|
10
10
|
export declare const CORE_TOOL_DECLARATION_CODES: readonly string[];
|
|
11
|
-
export declare const CORE_MODE_RELEASE_REASONS: readonly ["
|
|
11
|
+
export declare const CORE_MODE_RELEASE_REASONS: readonly ["target_unresolved"];
|
|
12
12
|
export declare const CORE_HOOK_TOOL_ALIASES: Readonly<Record<string, string>>;
|
|
13
13
|
export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
|
|
14
14
|
export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
|
|
@@ -21,9 +21,9 @@ export interface CoreModeArbitrationRow {
|
|
|
21
21
|
readonly ruleMayClear: boolean;
|
|
22
22
|
readonly hookAskFloor: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "
|
|
24
|
+
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
|
|
25
25
|
export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
|
|
26
|
-
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
|
|
26
|
+
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"];
|
|
27
27
|
export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
|
|
28
28
|
export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
|
|
29
29
|
export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
|
|
@@ -42,3 +42,22 @@ export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "ti
|
|
|
42
42
|
export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
43
43
|
export declare const CORE_APPROVAL_REACH: readonly ["none"];
|
|
44
44
|
export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
|
|
45
|
+
export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
|
|
46
|
+
export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"];
|
|
47
|
+
export declare const CORE_BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
|
|
48
|
+
export declare const CORE_USER_ATTACHMENT_KINDS: readonly ["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"];
|
|
49
|
+
export declare const CORE_USER_ATTACHMENT_SUPPLIES: readonly ["path", "content_text", "content_image"];
|
|
50
|
+
export declare const CORE_USER_ATTACHMENT_OUTCOMES: readonly ["attached", "partial", "unchanged", "not_attached"];
|
|
51
|
+
export interface CoreUserAttachmentSeatLimits {
|
|
52
|
+
readonly maxEntries: number;
|
|
53
|
+
readonly maxRenderedTextChars: number;
|
|
54
|
+
}
|
|
55
|
+
export interface CoreUserAttachmentSeat {
|
|
56
|
+
readonly entries: readonly string[];
|
|
57
|
+
readonly kinds: readonly (typeof CORE_USER_ATTACHMENT_KINDS)[number][];
|
|
58
|
+
readonly supplies: readonly (typeof CORE_USER_ATTACHMENT_SUPPLIES)[number][];
|
|
59
|
+
readonly limits: CoreUserAttachmentSeatLimits;
|
|
60
|
+
}
|
|
61
|
+
export declare const CORE_USER_ATTACHMENT_SEAT: CoreUserAttachmentSeat;
|
|
62
|
+
export declare const CORE_USER_ATTACHMENTS_MAX: number;
|
|
63
|
+
export declare const CORE_USER_ATTACHMENT_LABEL_MAX: number;
|
|
@@ -112,7 +112,6 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
|
|
|
112
112
|
"config.reserved_tool_name",
|
|
113
113
|
]);
|
|
114
114
|
export const CORE_MODE_RELEASE_REASONS = Object.freeze([
|
|
115
|
-
"rule_unreadable",
|
|
116
115
|
"target_unresolved",
|
|
117
116
|
]);
|
|
118
117
|
export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
|
|
@@ -146,12 +145,11 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
146
145
|
"hook": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
147
146
|
"ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
148
147
|
"dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
149
|
-
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible:
|
|
148
|
+
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
149
|
"unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
151
150
|
"transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
152
151
|
"org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
153
|
-
"
|
|
154
|
-
"rule_unreadable": Object.freeze({ bypassImmune: false, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
152
|
+
"rule_unreadable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
155
153
|
"ask_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
156
154
|
"denial_limit_fallback": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
157
155
|
"classifier_no_ruling": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -181,6 +179,7 @@ export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
|
|
|
181
179
|
"grammar",
|
|
182
180
|
"tool_name",
|
|
183
181
|
"near_miss",
|
|
182
|
+
"earlier_grammar",
|
|
184
183
|
]);
|
|
185
184
|
export const CORE_ALLOW_RULE_MEMBERS = Object.freeze([
|
|
186
185
|
"hook",
|
|
@@ -281,3 +280,51 @@ export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
|
|
|
281
280
|
"write_protection",
|
|
282
281
|
"target_unresolved",
|
|
283
282
|
]);
|
|
283
|
+
export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze([
|
|
284
|
+
"completed",
|
|
285
|
+
"failed",
|
|
286
|
+
"killed",
|
|
287
|
+
"cancelled",
|
|
288
|
+
]);
|
|
289
|
+
export const CORE_RESUME_STARTUP_CAUSES = Object.freeze([
|
|
290
|
+
"environment",
|
|
291
|
+
"session_gone",
|
|
292
|
+
"transcript_corrupt",
|
|
293
|
+
"tool_unavailable",
|
|
294
|
+
"configuration",
|
|
295
|
+
"decision_rejected",
|
|
296
|
+
]);
|
|
297
|
+
export const CORE_BUILTIN_SUBAGENT_TYPES = Object.freeze([
|
|
298
|
+
"Explore",
|
|
299
|
+
"Plan",
|
|
300
|
+
"fork",
|
|
301
|
+
"general-purpose",
|
|
302
|
+
]);
|
|
303
|
+
export const CORE_USER_ATTACHMENT_KINDS = Object.freeze([
|
|
304
|
+
"text",
|
|
305
|
+
"notebook",
|
|
306
|
+
"image",
|
|
307
|
+
"pdf",
|
|
308
|
+
"directory",
|
|
309
|
+
"client_text",
|
|
310
|
+
"client_image",
|
|
311
|
+
]);
|
|
312
|
+
export const CORE_USER_ATTACHMENT_SUPPLIES = Object.freeze([
|
|
313
|
+
"path",
|
|
314
|
+
"content_text",
|
|
315
|
+
"content_image",
|
|
316
|
+
]);
|
|
317
|
+
export const CORE_USER_ATTACHMENT_OUTCOMES = Object.freeze([
|
|
318
|
+
"attached",
|
|
319
|
+
"partial",
|
|
320
|
+
"unchanged",
|
|
321
|
+
"not_attached",
|
|
322
|
+
]);
|
|
323
|
+
export const CORE_USER_ATTACHMENT_SEAT = Object.freeze({
|
|
324
|
+
entries: Object.freeze(["objective"]),
|
|
325
|
+
kinds: CORE_USER_ATTACHMENT_KINDS,
|
|
326
|
+
supplies: CORE_USER_ATTACHMENT_SUPPLIES,
|
|
327
|
+
limits: Object.freeze({ maxEntries: 20, maxRenderedTextChars: 100000 }),
|
|
328
|
+
});
|
|
329
|
+
export const CORE_USER_ATTACHMENTS_MAX = 20;
|
|
330
|
+
export const CORE_USER_ATTACHMENT_LABEL_MAX = 4096;
|
|
@@ -8,6 +8,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
8
8
|
"config.read_face_deployment_clamped",
|
|
9
9
|
"config.write_face_swapped",
|
|
10
10
|
"config.write_face_deployment_clamped",
|
|
11
|
+
"config.read_deny_swapped",
|
|
11
12
|
"config.tool_model_gate_removed",
|
|
12
13
|
"config.tool_model_gate_unknown_class",
|
|
13
14
|
"config.tool_model_gate_env_invalid",
|
|
@@ -24,12 +25,14 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
24
25
|
"config.peer_admission_out_of_range",
|
|
25
26
|
"config.peer_lane_unmounted",
|
|
26
27
|
"config.secret_env_scrubbed",
|
|
28
|
+
"config.credential_not_withheld",
|
|
27
29
|
"config.permission_mode_unavailable",
|
|
28
30
|
"permission.ask_released_by_mode",
|
|
29
31
|
"permission.read_deny_unapplied",
|
|
30
32
|
"permission.rule_store_unavailable",
|
|
31
33
|
"permission.rule_row_dropped",
|
|
32
34
|
"permission.allowed_tool_not_granted",
|
|
35
|
+
"mods.registration_refused",
|
|
33
36
|
"peer.inbound_disposition",
|
|
34
37
|
"peer.held_settled",
|
|
35
38
|
"peer.idle_subscription",
|
|
@@ -63,7 +66,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
63
66
|
"memory.project_scope_absent",
|
|
64
67
|
"route.fallback_to_primary",
|
|
65
68
|
"route.classifier_unroutable",
|
|
66
|
-
"route.
|
|
69
|
+
"route.credential_origin_mismatch",
|
|
67
70
|
"route.response_model_mismatch",
|
|
68
71
|
"route.tool_call_id_folded",
|
|
69
72
|
"route.finish_reason_unknown",
|
|
@@ -85,10 +88,12 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
|
85
88
|
"skills.listing_truncated",
|
|
86
89
|
"agents.listing_truncated",
|
|
87
90
|
"tool_result.offload_put_failed",
|
|
91
|
+
"tool_result.media_refused",
|
|
88
92
|
"instructions.source_changed",
|
|
89
93
|
"session.records_skipped",
|
|
90
94
|
"memory.layer_locked_legacy",
|
|
91
95
|
"server.model_unreachable",
|
|
96
|
+
"permission.entry_mode_clamped",
|
|
92
97
|
]);
|
|
93
98
|
export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
94
99
|
"config.autocompact_window_clamped": "operator",
|
|
@@ -100,6 +105,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
100
105
|
"config.read_face_deployment_clamped": "operator",
|
|
101
106
|
"config.write_face_swapped": "operator",
|
|
102
107
|
"config.write_face_deployment_clamped": "operator",
|
|
108
|
+
"config.read_deny_swapped": "operator",
|
|
103
109
|
"config.tool_model_gate_removed": "operator",
|
|
104
110
|
"config.tool_model_gate_unknown_class": "operator",
|
|
105
111
|
"config.tool_model_gate_env_invalid": "operator",
|
|
@@ -116,12 +122,14 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
116
122
|
"config.peer_admission_out_of_range": "operator",
|
|
117
123
|
"config.peer_lane_unmounted": "operator",
|
|
118
124
|
"config.secret_env_scrubbed": "operator",
|
|
125
|
+
"config.credential_not_withheld": "operator",
|
|
119
126
|
"config.permission_mode_unavailable": "user",
|
|
120
127
|
"permission.ask_released_by_mode": "user",
|
|
121
128
|
"permission.read_deny_unapplied": "user",
|
|
122
129
|
"permission.rule_store_unavailable": "user",
|
|
123
130
|
"permission.rule_row_dropped": "user",
|
|
124
131
|
"permission.allowed_tool_not_granted": "user",
|
|
132
|
+
"mods.registration_refused": "user",
|
|
125
133
|
"peer.inbound_disposition": "user",
|
|
126
134
|
"peer.held_settled": "user",
|
|
127
135
|
"peer.idle_subscription": "user",
|
|
@@ -155,7 +163,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
155
163
|
"memory.project_scope_absent": "operator",
|
|
156
164
|
"route.fallback_to_primary": "operator",
|
|
157
165
|
"route.classifier_unroutable": "operator",
|
|
158
|
-
"route.
|
|
166
|
+
"route.credential_origin_mismatch": "user",
|
|
159
167
|
"route.response_model_mismatch": "operator",
|
|
160
168
|
"route.tool_call_id_folded": "operator",
|
|
161
169
|
"route.finish_reason_unknown": "user",
|
|
@@ -177,10 +185,12 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
|
177
185
|
"skills.listing_truncated": "operator",
|
|
178
186
|
"agents.listing_truncated": "operator",
|
|
179
187
|
"tool_result.offload_put_failed": "operator",
|
|
188
|
+
"tool_result.media_refused": "operator",
|
|
180
189
|
"instructions.source_changed": "user",
|
|
181
190
|
"session.records_skipped": "user",
|
|
182
191
|
"memory.layer_locked_legacy": "operator",
|
|
183
192
|
"server.model_unreachable": "user",
|
|
193
|
+
"permission.entry_mode_clamped": "user",
|
|
184
194
|
});
|
|
185
195
|
export const CORE_MCP_INJECTION_DROP_REASONS = Object.freeze([
|
|
186
196
|
"malformed_entry",
|
|
@@ -198,6 +208,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
198
208
|
"config.read_face_deployment_clamped": "engine",
|
|
199
209
|
"config.write_face_swapped": "engine",
|
|
200
210
|
"config.write_face_deployment_clamped": "engine",
|
|
211
|
+
"config.read_deny_swapped": "engine",
|
|
201
212
|
"config.tool_model_gate_removed": "engine",
|
|
202
213
|
"config.tool_model_gate_unknown_class": "engine",
|
|
203
214
|
"config.tool_model_gate_env_invalid": "engine",
|
|
@@ -214,12 +225,14 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
214
225
|
"config.peer_admission_out_of_range": "engine",
|
|
215
226
|
"config.peer_lane_unmounted": "engine",
|
|
216
227
|
"config.secret_env_scrubbed": "engine",
|
|
228
|
+
"config.credential_not_withheld": "engine",
|
|
217
229
|
"config.permission_mode_unavailable": "engine",
|
|
218
230
|
"permission.ask_released_by_mode": "engine",
|
|
219
231
|
"permission.read_deny_unapplied": "engine",
|
|
220
232
|
"permission.rule_store_unavailable": "engine",
|
|
221
233
|
"permission.rule_row_dropped": "engine",
|
|
222
234
|
"permission.allowed_tool_not_granted": "engine",
|
|
235
|
+
"mods.registration_refused": "engine",
|
|
223
236
|
"peer.inbound_disposition": "engine",
|
|
224
237
|
"peer.held_settled": "engine",
|
|
225
238
|
"peer.idle_subscription": "engine",
|
|
@@ -253,7 +266,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
253
266
|
"memory.project_scope_absent": "engine",
|
|
254
267
|
"route.fallback_to_primary": "engine",
|
|
255
268
|
"route.classifier_unroutable": "engine",
|
|
256
|
-
"route.
|
|
269
|
+
"route.credential_origin_mismatch": "engine",
|
|
257
270
|
"route.response_model_mismatch": "engine",
|
|
258
271
|
"route.tool_call_id_folded": "engine",
|
|
259
272
|
"route.finish_reason_unknown": "engine",
|
|
@@ -275,10 +288,12 @@ export const CORE_NOTICE_MINTER = Object.freeze({
|
|
|
275
288
|
"skills.listing_truncated": "engine",
|
|
276
289
|
"agents.listing_truncated": "engine",
|
|
277
290
|
"tool_result.offload_put_failed": "engine",
|
|
291
|
+
"tool_result.media_refused": "engine",
|
|
278
292
|
"instructions.source_changed": "server",
|
|
279
293
|
"session.records_skipped": "server",
|
|
280
294
|
"memory.layer_locked_legacy": "server",
|
|
281
295
|
"server.model_unreachable": "server",
|
|
296
|
+
"permission.entry_mode_clamped": "server",
|
|
282
297
|
});
|
|
283
298
|
export const CORE_USER_INPUT_UNDRAINED_CAUSES = Object.freeze([
|
|
284
299
|
"leg_end",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HooksClassification } from './settingsSchemaTypes.js';
|
|
1
2
|
export declare const SETTINGS_AT_MENTION_MODES: readonly ["all", "none", "only"];
|
|
2
3
|
export type SettingsAtMention = {
|
|
3
4
|
readonly mode: Exclude<(typeof SETTINGS_AT_MENTION_MODES)[number], 'only'>;
|
|
@@ -11,3 +12,8 @@ export declare const SETTINGS_IS_HIERARCHICAL_URL: (raw: string) => boolean;
|
|
|
11
12
|
export declare const SETTINGS_NARROW_AT_MENTION: (atMention: SettingsAtMention, available: ReadonlySet<string>) => SettingsAtMention;
|
|
12
13
|
export declare const SETTINGS_HOOK_MATCHER_SELECTS: (matcher: string | undefined, name: string) => boolean | 'invalid';
|
|
13
14
|
export declare const SETTINGS_HOOK_MATCHER_FORM: (matcher: string | undefined) => SettingsHookMatcherForm;
|
|
15
|
+
export declare const SETTINGS_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged", "MessageDisplay", "DirectoryAdded", "PreModelSwitch", "PostModelSwitch"];
|
|
16
|
+
export declare const SETTINGS_HOOKS_CLASSIFICATION_OUTCOMES: readonly ["loaded", "loaded-partial", "rejected"];
|
|
17
|
+
export declare const SETTINGS_HOOKS_DROPPED_PIECE_CODES: readonly ["hooks-not-object", "unknown-event", "event-not-array", "matcher-invalid", "entry-invalid"];
|
|
18
|
+
export declare const SETTINGS_HOOKS_REJECTION_CODES: readonly ["guard-outside-hooks", "hooks-is-matcher", "guard-under-unknown-event", "guard-event-not-array", "guard-matcher-invalid", "guard-entry-invalid"];
|
|
19
|
+
export declare const SETTINGS_CLASSIFY_HOOKS_CONFIG: (settingsDoc: unknown) => HooksClassification;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE } from './settingsSchemaHooksClassifier.js';
|
|
1
2
|
export const SETTINGS_AT_MENTION_MODES = Object.freeze([
|
|
2
3
|
"all",
|
|
3
4
|
"none",
|
|
@@ -73,3 +74,59 @@ export const SETTINGS_HOOK_MATCHER_FORM = function hookMatcherForm(matcher) {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
};
|
|
77
|
+
export const SETTINGS_HOOK_EVENTS = Object.freeze([
|
|
78
|
+
"PreToolUse",
|
|
79
|
+
"PostToolUse",
|
|
80
|
+
"PostToolUseFailure",
|
|
81
|
+
"PostToolBatch",
|
|
82
|
+
"Notification",
|
|
83
|
+
"UserPromptSubmit",
|
|
84
|
+
"UserPromptExpansion",
|
|
85
|
+
"SessionStart",
|
|
86
|
+
"SessionEnd",
|
|
87
|
+
"Stop",
|
|
88
|
+
"StopFailure",
|
|
89
|
+
"SubagentStart",
|
|
90
|
+
"SubagentStop",
|
|
91
|
+
"PreCompact",
|
|
92
|
+
"PostCompact",
|
|
93
|
+
"PermissionRequest",
|
|
94
|
+
"PermissionDenied",
|
|
95
|
+
"Setup",
|
|
96
|
+
"TeammateIdle",
|
|
97
|
+
"TaskCreated",
|
|
98
|
+
"TaskCompleted",
|
|
99
|
+
"Elicitation",
|
|
100
|
+
"ElicitationResult",
|
|
101
|
+
"ConfigChange",
|
|
102
|
+
"WorktreeCreate",
|
|
103
|
+
"WorktreeRemove",
|
|
104
|
+
"InstructionsLoaded",
|
|
105
|
+
"CwdChanged",
|
|
106
|
+
"FileChanged",
|
|
107
|
+
"MessageDisplay",
|
|
108
|
+
"DirectoryAdded",
|
|
109
|
+
"PreModelSwitch",
|
|
110
|
+
"PostModelSwitch",
|
|
111
|
+
]);
|
|
112
|
+
export const SETTINGS_HOOKS_CLASSIFICATION_OUTCOMES = Object.freeze([
|
|
113
|
+
"loaded",
|
|
114
|
+
"loaded-partial",
|
|
115
|
+
"rejected",
|
|
116
|
+
]);
|
|
117
|
+
export const SETTINGS_HOOKS_DROPPED_PIECE_CODES = Object.freeze([
|
|
118
|
+
"hooks-not-object",
|
|
119
|
+
"unknown-event",
|
|
120
|
+
"event-not-array",
|
|
121
|
+
"matcher-invalid",
|
|
122
|
+
"entry-invalid",
|
|
123
|
+
]);
|
|
124
|
+
export const SETTINGS_HOOKS_REJECTION_CODES = Object.freeze([
|
|
125
|
+
"guard-outside-hooks",
|
|
126
|
+
"hooks-is-matcher",
|
|
127
|
+
"guard-under-unknown-event",
|
|
128
|
+
"guard-event-not-array",
|
|
129
|
+
"guard-matcher-invalid",
|
|
130
|
+
"guard-entry-invalid",
|
|
131
|
+
]);
|
|
132
|
+
export const SETTINGS_CLASSIFY_HOOKS_CONFIG = SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE(SETTINGS_HOOK_EVENTS);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { HooksClassification } from './settingsSchemaTypes.js';
|
|
2
|
+
export declare const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE: (HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged", "MessageDisplay", "DirectoryAdded", "PreModelSwitch", "PostModelSwitch"]) => (settingsDoc: unknown) => HooksClassification;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
export const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE = (HOOK_EVENTS) => {
|
|
2
|
+
const HOOK_GUARD_EVENTS = ["PreToolUse", "PermissionRequest"];
|
|
3
|
+
const HOOK_SHELLS = ["bash", "powershell"];
|
|
4
|
+
const HOOK_ENTRY_COMMON_FIELDS = { if: "string?", timeout: "seconds?", statusMessage: "string?", once: "boolean?" };
|
|
5
|
+
const HOOK_ENTRY_FIELDS = {
|
|
6
|
+
command: { command: "text", shell: "shell?", async: "boolean?", asyncRewake: "boolean?", ...HOOK_ENTRY_COMMON_FIELDS },
|
|
7
|
+
prompt: { prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS },
|
|
8
|
+
agent: { prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS },
|
|
9
|
+
http: { url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", ...HOOK_ENTRY_COMMON_FIELDS },
|
|
10
|
+
mcp_tool: { server: "string", tool: "string", input: "record?", ...HOOK_ENTRY_COMMON_FIELDS },
|
|
11
|
+
};
|
|
12
|
+
function hookIsRecord(value) {
|
|
13
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
14
|
+
return false;
|
|
15
|
+
const proto = Object.getPrototypeOf(value);
|
|
16
|
+
return proto === Object.prototype || proto === null;
|
|
17
|
+
}
|
|
18
|
+
function hookGuardKeyOf(node) {
|
|
19
|
+
for (const key of Object.keys(node)) {
|
|
20
|
+
if (!HOOK_GUARD_EVENTS.includes(key))
|
|
21
|
+
continue;
|
|
22
|
+
const value = node[key];
|
|
23
|
+
if (value !== null && value !== undefined && !(Array.isArray(value) && value.length === 0))
|
|
24
|
+
return key;
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
function hookLooksLikeMatcher(value) {
|
|
29
|
+
if (!hookIsRecord(value))
|
|
30
|
+
return false;
|
|
31
|
+
const inner = Object.hasOwn(value, "hooks") ? value.hooks : undefined;
|
|
32
|
+
if (Array.isArray(inner))
|
|
33
|
+
return inner.length > 0;
|
|
34
|
+
return hookIsRecord(inner) && (Object.hasOwn(value, "matcher") || typeof inner.type === "string");
|
|
35
|
+
}
|
|
36
|
+
function hookGuardSignIn(root, rootPath, place) {
|
|
37
|
+
const frames = [];
|
|
38
|
+
const pending = [[root, -1, place]];
|
|
39
|
+
const seen = { matcherList: new Set(), matcher: new Set(), other: new Set() };
|
|
40
|
+
const pathTo = (frame, tail) => {
|
|
41
|
+
const segments = [...tail];
|
|
42
|
+
for (let f = frame; f >= 0; f = frames[f].parent)
|
|
43
|
+
segments.unshift(frames[f].key);
|
|
44
|
+
return [...rootPath, ...segments];
|
|
45
|
+
};
|
|
46
|
+
while (pending.length > 0) {
|
|
47
|
+
const [node, frame, at] = pending.pop();
|
|
48
|
+
if (node === null || typeof node !== "object" || seen[at].has(node))
|
|
49
|
+
continue;
|
|
50
|
+
seen[at].add(node);
|
|
51
|
+
if (Array.isArray(node)) {
|
|
52
|
+
for (let i = node.length - 1; i >= 0; i--) {
|
|
53
|
+
frames.push({ key: i, parent: frame });
|
|
54
|
+
pending.push([node[i], frames.length - 1, at === "matcherList" ? "matcher" : "other"]);
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const guardKey = hookGuardKeyOf(node);
|
|
59
|
+
if (guardKey !== undefined)
|
|
60
|
+
return pathTo(frame, [guardKey]);
|
|
61
|
+
if (at !== "matcher" && hookLooksLikeMatcher(node))
|
|
62
|
+
return pathTo(frame, []);
|
|
63
|
+
const keys = Object.keys(node);
|
|
64
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
65
|
+
frames.push({ key: keys[i], parent: frame });
|
|
66
|
+
pending.push([node[keys[i]], frames.length - 1, "other"]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
function hookSignKeyOf(at, sign) {
|
|
72
|
+
const key = sign[at.length];
|
|
73
|
+
return key === undefined ? "hooks" : String(key);
|
|
74
|
+
}
|
|
75
|
+
function hookFieldFits(base, value) {
|
|
76
|
+
switch (base) {
|
|
77
|
+
case "text":
|
|
78
|
+
return typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
79
|
+
case "string":
|
|
80
|
+
return typeof value === "string";
|
|
81
|
+
case "shell":
|
|
82
|
+
return typeof value === "string" && HOOK_SHELLS.includes(value);
|
|
83
|
+
case "boolean":
|
|
84
|
+
return typeof value === "boolean";
|
|
85
|
+
case "seconds":
|
|
86
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
87
|
+
case "stringRecord":
|
|
88
|
+
return hookIsRecord(value) && Object.values(value).every((v) => typeof v === "string");
|
|
89
|
+
case "stringList":
|
|
90
|
+
if (!Array.isArray(value))
|
|
91
|
+
return false;
|
|
92
|
+
for (let i = 0; i < value.length; i++)
|
|
93
|
+
if (typeof value[i] !== "string")
|
|
94
|
+
return false;
|
|
95
|
+
return true;
|
|
96
|
+
case "record":
|
|
97
|
+
return hookIsRecord(value);
|
|
98
|
+
default: {
|
|
99
|
+
const unknownKind = base;
|
|
100
|
+
throw new Error(`hook entry field table: unknown field kind '${String(unknownKind)}'`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function hookEntryRead(entry) {
|
|
105
|
+
if (!hookIsRecord(entry))
|
|
106
|
+
return {};
|
|
107
|
+
const type = Object.hasOwn(entry, "type") ? entry.type : undefined;
|
|
108
|
+
if (typeof type !== "string" || !Object.hasOwn(HOOK_ENTRY_FIELDS, type))
|
|
109
|
+
return { field: "type" };
|
|
110
|
+
const fields = HOOK_ENTRY_FIELDS[type];
|
|
111
|
+
const out = { type };
|
|
112
|
+
for (const field of Object.keys(fields)) {
|
|
113
|
+
const kind = fields[field];
|
|
114
|
+
const optional = kind.endsWith("?");
|
|
115
|
+
const value = Object.hasOwn(entry, field) ? entry[field] : undefined;
|
|
116
|
+
if (value === undefined) {
|
|
117
|
+
if (optional)
|
|
118
|
+
continue;
|
|
119
|
+
return { field };
|
|
120
|
+
}
|
|
121
|
+
const base = (optional ? kind.slice(0, -1) : kind);
|
|
122
|
+
if (!hookFieldFits(base, value))
|
|
123
|
+
return { field };
|
|
124
|
+
out[field] = Array.isArray(value) ? value.slice() : hookIsRecord(value) ? Object.fromEntries(Object.entries(value)) : value;
|
|
125
|
+
}
|
|
126
|
+
return { entry: out };
|
|
127
|
+
}
|
|
128
|
+
function hookMatcherRead(matcher, at, guardEvent, reject, drop) {
|
|
129
|
+
if (!hookIsRecord(matcher)) {
|
|
130
|
+
if (guardEvent || hookGuardSignIn(matcher, at, "matcher") !== undefined)
|
|
131
|
+
reject("guard-matcher-invalid", at);
|
|
132
|
+
else
|
|
133
|
+
drop("matcher-invalid", at);
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const entries = Object.hasOwn(matcher, "hooks") ? matcher.hooks : undefined;
|
|
137
|
+
const signField = hookGuardKeyOf(matcher) ??
|
|
138
|
+
Object.keys(matcher).find((key) => !(key === "hooks" && Array.isArray(entries)) && hookGuardSignIn(matcher[key], [...at, key], "other") !== undefined);
|
|
139
|
+
if (signField !== undefined) {
|
|
140
|
+
reject("guard-matcher-invalid", at, signField);
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
const entrySigns = [];
|
|
144
|
+
if (Array.isArray(entries))
|
|
145
|
+
for (let j = 0; j < entries.length; j++)
|
|
146
|
+
entrySigns.push(hookGuardSignIn(entries[j], [...at, "hooks", j], "other"));
|
|
147
|
+
const name = Object.hasOwn(matcher, "matcher") ? matcher.matcher : undefined;
|
|
148
|
+
const badField = name !== undefined && typeof name !== "string" ? "matcher" : !Array.isArray(entries) ? "hooks" : undefined;
|
|
149
|
+
if (badField !== undefined || !Array.isArray(entries)) {
|
|
150
|
+
if (guardEvent || entrySigns.some((sign) => sign !== undefined))
|
|
151
|
+
reject("guard-matcher-invalid", at, badField);
|
|
152
|
+
else
|
|
153
|
+
drop("matcher-invalid", at, badField);
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
const kept = [];
|
|
157
|
+
for (let j = 0; j < entries.length; j++) {
|
|
158
|
+
const where = [...at, "hooks", j];
|
|
159
|
+
const sign = entrySigns[j];
|
|
160
|
+
if (sign !== undefined) {
|
|
161
|
+
reject("guard-entry-invalid", where, hookIsRecord(entries[j]) ? hookSignKeyOf(where, sign) : undefined);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const read = hookEntryRead(entries[j]);
|
|
165
|
+
if (read.entry !== undefined)
|
|
166
|
+
kept.push(read.entry);
|
|
167
|
+
else if (guardEvent)
|
|
168
|
+
reject("guard-entry-invalid", where, read.field);
|
|
169
|
+
else
|
|
170
|
+
drop("entry-invalid", where, read.field);
|
|
171
|
+
}
|
|
172
|
+
return typeof name === "string" ? { matcher: name, hooks: kept } : { hooks: kept };
|
|
173
|
+
}
|
|
174
|
+
function hookBlockRead(hooks, reject, drop) {
|
|
175
|
+
if (!hookIsRecord(hooks)) {
|
|
176
|
+
if (Array.isArray(hooks) && hooks.some((x) => x !== null && typeof x === "object"))
|
|
177
|
+
reject("hooks-is-matcher", ["hooks"]);
|
|
178
|
+
else
|
|
179
|
+
drop("hooks-not-object", ["hooks"]);
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
if (hookLooksLikeMatcher(hooks) || typeof hooks.type === "string") {
|
|
183
|
+
reject("hooks-is-matcher", ["hooks"]);
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
const loaded = {};
|
|
187
|
+
for (const event of Object.keys(hooks)) {
|
|
188
|
+
const value = hooks[event];
|
|
189
|
+
const at = ["hooks", event];
|
|
190
|
+
if (!HOOK_EVENTS.includes(event)) {
|
|
191
|
+
if (hookGuardSignIn(value, at, Array.isArray(value) ? "matcherList" : "other") !== undefined)
|
|
192
|
+
reject("guard-under-unknown-event", at);
|
|
193
|
+
else
|
|
194
|
+
drop("unknown-event", at);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const guardEvent = HOOK_GUARD_EVENTS.includes(event);
|
|
198
|
+
if (!Array.isArray(value)) {
|
|
199
|
+
if ((guardEvent && value !== null) || hookGuardSignIn(value, at, "other") !== undefined)
|
|
200
|
+
reject("guard-event-not-array", at);
|
|
201
|
+
else
|
|
202
|
+
drop("event-not-array", at);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const matchers = [];
|
|
206
|
+
for (let i = 0; i < value.length; i++) {
|
|
207
|
+
const read = hookMatcherRead(value[i], [...at, i], guardEvent, reject, drop);
|
|
208
|
+
if (read !== undefined)
|
|
209
|
+
matchers.push(read);
|
|
210
|
+
}
|
|
211
|
+
loaded[event] = matchers;
|
|
212
|
+
}
|
|
213
|
+
return loaded;
|
|
214
|
+
}
|
|
215
|
+
function classifyHooksConfig(settingsDoc) {
|
|
216
|
+
const rejections = [];
|
|
217
|
+
const dropped = [];
|
|
218
|
+
const reject = (code, path, field) => {
|
|
219
|
+
rejections.push(field === undefined ? { code, path } : { code, path, field });
|
|
220
|
+
};
|
|
221
|
+
const drop = (code, path, field) => {
|
|
222
|
+
dropped.push(field === undefined ? { code, path } : { code, path, field });
|
|
223
|
+
};
|
|
224
|
+
let hooks;
|
|
225
|
+
if (settingsDoc !== null && typeof settingsDoc === "object" && !Array.isArray(settingsDoc)) {
|
|
226
|
+
const doc = settingsDoc;
|
|
227
|
+
for (const key of Object.keys(doc)) {
|
|
228
|
+
const value = doc[key];
|
|
229
|
+
if (key === "hooks") {
|
|
230
|
+
hooks = hookBlockRead(value, reject, drop);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const sign = key === "matcher" && hookLooksLikeMatcher(doc)
|
|
234
|
+
? [key]
|
|
235
|
+
: HOOK_GUARD_EVENTS.includes(key) && value !== null && value !== undefined && !(Array.isArray(value) && value.length === 0)
|
|
236
|
+
? [key]
|
|
237
|
+
: hookGuardSignIn(value, [key], "other");
|
|
238
|
+
if (sign !== undefined)
|
|
239
|
+
reject("guard-outside-hooks", sign);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const sign = hookGuardSignIn(settingsDoc, [], "other");
|
|
244
|
+
if (sign !== undefined)
|
|
245
|
+
reject("guard-outside-hooks", sign);
|
|
246
|
+
}
|
|
247
|
+
if (rejections.length > 0)
|
|
248
|
+
return { outcome: "rejected", hooks: undefined, dropped: [], rejections };
|
|
249
|
+
if (dropped.length > 0)
|
|
250
|
+
return { outcome: "loaded-partial", hooks, dropped, rejections: [] };
|
|
251
|
+
return { outcome: "loaded", hooks, dropped: [], rejections: [] };
|
|
252
|
+
}
|
|
253
|
+
return classifyHooksConfig;
|
|
254
|
+
};
|
|
@@ -9,3 +9,4 @@ export declare const SETTINGS_BUDGET_STRING_KEYS: readonly ["mode", "budgetDurat
|
|
|
9
9
|
export declare const SETTINGS_BUDGET_PER_MODEL_NUMBER_KEYS: readonly ["maxBudgetUsd", "tpmLimit", "rpmLimit"];
|
|
10
10
|
export declare const SETTINGS_MODEL_API_WORDS: readonly ["openai-completions", "anthropic-messages"];
|
|
11
11
|
export declare const SETTINGS_TOOL_NAME_MATCHER_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure"];
|
|
12
|
+
export declare const SETTINGS_UI_LANGUAGE_VALUES: readonly ["en", "zh"];
|