@sema-agent/client-core 0.100.0 → 0.102.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 +452 -0
- package/README.md +172 -120
- package/dist/adapt/arms.js +51 -16
- package/dist/adapt/textStream.js +7 -4
- package/dist/adapt/toolCards.d.ts +2 -1
- package/dist/adapt/toolCards.js +28 -13
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +8 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
- package/dist/adapter/activeRunSelfHeal.js +108 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +38 -79
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
- package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
- package/dist/adapter/downstream/wiringManifestView.js +138 -0
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +158 -43
- package/dist/agentsWireCaps.d.ts +2 -7
- package/dist/agentsWireCaps.js +1 -2
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +19 -5
- package/dist/cloudConfigWireCaps.js +193 -56
- package/dist/compensations.js +1 -1
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +5 -3
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +9 -4
- package/dist/displayUntrusted.js +834 -104
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +14 -5
- package/dist/engineErrorCodes.js +27 -6
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +4 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.js +2 -2
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.js +3 -3
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +16 -3
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -3
- package/dist/generated/engineFactTables.js +52 -0
- package/dist/generated/engineNoticeTables.js +12 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +54 -0
- package/dist/generated/settingsSchemaFns.js +26 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +2 -0
- package/dist/generated/settingsSchemaTables.js +13 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +7 -5
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +6 -0
- package/dist/hitl/askClassPair.js +30 -3
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +42 -3
- package/dist/hitl/attributionLadder.js +79 -8
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionRefusal.d.ts +20 -10
- package/dist/hitl/decisionRefusal.js +99 -54
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +87 -103
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +41 -37
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +59 -30
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +62 -29
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +72 -54
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +73 -17
- package/dist/hostTurnSettings.js +594 -97
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +2 -1
- package/dist/humanTurn.js +37 -7
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +222 -2
- package/dist/i18n/messages.en.js +225 -5
- package/dist/i18n/messages.zh.js +237 -5
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +77 -15
- package/dist/index.js +50 -13
- package/dist/inheritEnvCapability.d.ts +3 -1
- package/dist/inheritEnvCapability.js +31 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/interactiveHalt.d.ts +3 -1
- package/dist/interactiveHalt.js +2 -0
- package/dist/interactiveInterrupt.d.ts +2 -0
- package/dist/interactiveInterrupt.js +15 -0
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +1 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.js +2 -1
- package/dist/mcpWireCaps.d.ts +39 -1
- package/dist/mcpWireCaps.js +254 -50
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.js +6 -6
- package/dist/modelIdentityResolvability.d.ts +10 -1
- package/dist/modelIdentityResolvability.js +62 -39
- package/dist/modsFace.d.ts +8 -0
- package/dist/modsFace.js +59 -0
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +12 -0
- package/dist/ownKey.js +179 -3
- package/dist/panelReduce.js +1 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +92 -53
- package/dist/prepareRefusal.d.ts +3 -2
- package/dist/prepareRefusal.js +27 -9
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/printToolResultFrame.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +6 -2
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +33 -4
- package/dist/request/taskRequest.js +341 -156
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +57 -9
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +4 -0
- package/dist/ruleRefusalSentence.js +9 -3
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +1 -1
- package/dist/sandboxWire.js +4 -6
- package/dist/scenarioRefusal.js +1 -1
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +2 -0
- package/dist/seam.js +3 -3
- package/dist/seatContract.d.ts +68 -7
- package/dist/seatContract.js +84 -25
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionBackground.d.ts +165 -0
- package/dist/sessionBackground.js +781 -0
- package/dist/sessionBackgroundHandoff.d.ts +54 -0
- package/dist/sessionBackgroundHandoff.js +321 -0
- package/dist/sessionMap.js +4 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.js +55 -15
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -0
- package/dist/skillsWireCaps.js +47 -16
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/thinkingLatch.d.ts +69 -0
- package/dist/thinkingLatch.js +255 -0
- package/dist/thinkingLatchWords.d.ts +7 -0
- package/dist/thinkingLatchWords.js +4 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +159 -32
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/turnFailurePresentation.js +27 -90
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +24 -1
- package/dist/wireRefusalCopy.js +253 -32
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +907 -182
- package/package.json +14 -3
- package/dist/argvFlagValue.d.ts +0 -8
- package/dist/argvFlagValue.js +0 -37
package/dist/pluginHooksWire.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { displayUntrusted } from './displayUntrusted.js';
|
|
2
|
+
import { appendOwnElement } from './ownKey.js';
|
|
3
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
4
|
import { SETTINGS_ENGINE_OWNED_HOOK_EVENTS } from './generated/settingsSchemaTables.js';
|
|
3
5
|
import { HOOK_SETTINGS_SOURCE_TEXT, hooksSalvageMaskOf, salvageSettingsHooksEntries, } from './settingsHooksSalvage.js';
|
|
4
6
|
export const ENGINE_FIRED_HOOK_EVENTS = SETTINGS_ENGINE_OWNED_HOOK_EVENTS;
|
|
@@ -26,6 +28,7 @@ export const PLUGIN_HOOK_REASONS = [
|
|
|
26
28
|
'hooks_module',
|
|
27
29
|
'scope_unsupported',
|
|
28
30
|
'source_incomplete',
|
|
31
|
+
'compaction_local_fallback',
|
|
29
32
|
];
|
|
30
33
|
export const PLUGIN_HOOK_EXCLUSION_REASONS = [
|
|
31
34
|
'workspace_untrusted',
|
|
@@ -54,6 +57,9 @@ export function hooksWirePlanShapeOf(v) {
|
|
|
54
57
|
Array.isArray(o.settingsVerdicts) &&
|
|
55
58
|
Array.isArray(o.settingsExcluded) &&
|
|
56
59
|
arrayOrAbsent('settingsSalvage') &&
|
|
60
|
+
arrayOrAbsent('httpPolicyDrops') &&
|
|
61
|
+
arrayOrAbsent('settingsSources') &&
|
|
62
|
+
arrayOrAbsent('settingsWithheld') &&
|
|
57
63
|
arrayOrAbsent('moduleVerdicts') &&
|
|
58
64
|
arrayOrAbsent('sessionVerdicts') &&
|
|
59
65
|
(!Object.hasOwn(o, 'sessionReader') || o.sessionReader === 'present' || o.sessionReader === 'absent' || o.sessionReader === 'failed') &&
|
|
@@ -69,8 +75,8 @@ export function hooksWirePlanShapeOf(v) {
|
|
|
69
75
|
return 'threw';
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
const PLAN_KEYS = ['engine', 'pluginReader', 'verdicts', 'excluded', 'settingsDropped', 'settingsVerdicts', 'settingsExcluded', 'settingsSalvage', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy', 'wire'];
|
|
73
|
-
const LATER_PLAN_KEYS = new Set(['settingsSalvage', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy']);
|
|
78
|
+
const PLAN_KEYS = ['engine', 'pluginReader', 'verdicts', 'excluded', 'settingsDropped', 'settingsVerdicts', 'settingsExcluded', 'settingsSalvage', 'httpPolicyDrops', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy', 'settingsSources', 'settingsWithheld', 'wire'];
|
|
79
|
+
const LATER_PLAN_KEYS = new Set(['settingsSalvage', 'httpPolicyDrops', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy', 'settingsSources', 'settingsWithheld']);
|
|
74
80
|
const _planKeysPin = [true, true];
|
|
75
81
|
void _planKeysPin;
|
|
76
82
|
export const ENGINE_HOOK_LIMITS = { maxGroupsPerEvent: 16, maxEntriesPerEvent: 32, maxCommandChars: 8192, maxLlmEntriesPerEvent: 4 };
|
|
@@ -93,6 +99,9 @@ function hookExecutorOf(x) {
|
|
|
93
99
|
? { reason: 'engine_llm_limit', certain: false }
|
|
94
100
|
: undefined;
|
|
95
101
|
const compaction = COMPACTION_EVENTS.has(x.event);
|
|
102
|
+
if (compaction && x.compactionOnShell === true && x.shellRuns && (why === undefined || (!why.certain && why.reason !== 'engine_llm_limit'))) {
|
|
103
|
+
return judged('shell', 'compaction_local_fallback');
|
|
104
|
+
}
|
|
96
105
|
if (why === undefined) {
|
|
97
106
|
if (!x.shellRuns || x.engine.ownedByThisShell === true)
|
|
98
107
|
return judged('engine', 'projected');
|
|
@@ -225,7 +234,7 @@ export function decidePluginHooks(input) {
|
|
|
225
234
|
return;
|
|
226
235
|
}
|
|
227
236
|
if (p.hooksModule === true && input.exclusion === undefined && !(input.managedOnly && p.managed !== true)) {
|
|
228
|
-
modules
|
|
237
|
+
appendOwnElement(modules, { pluginId: typeof p.id === 'string' ? p.id : '', pluginName: typeof p.name === 'string' ? p.name : '', disposition: 'not_run', reason: 'hooks_module' });
|
|
229
238
|
}
|
|
230
239
|
if (!isRecord(p.hooks)) {
|
|
231
240
|
unreadable++;
|
|
@@ -252,37 +261,37 @@ export function decidePluginHooks(input) {
|
|
|
252
261
|
group.hooks.forEach((entry, hookIndex) => {
|
|
253
262
|
const key = { pluginId, pluginName, event, groupIndex, hookIndex };
|
|
254
263
|
if (input.exclusion !== undefined) {
|
|
255
|
-
excluded
|
|
264
|
+
appendOwnElement(excluded, { ...key, reason: input.exclusion });
|
|
256
265
|
return;
|
|
257
266
|
}
|
|
258
267
|
if (input.managedOnly && p.managed !== true) {
|
|
259
|
-
excluded
|
|
268
|
+
appendOwnElement(excluded, { ...key, reason: 'managed_plugins_only' });
|
|
260
269
|
return;
|
|
261
270
|
}
|
|
262
271
|
const entryType = isRecord(entry) && typeof entry.type === 'string' ? entry.type : undefined;
|
|
263
272
|
if (!sourceOk) {
|
|
264
|
-
verdicts
|
|
273
|
+
appendOwnElement(verdicts, { ...key, disposition: 'not_run', reason: 'source_incomplete' });
|
|
265
274
|
return;
|
|
266
275
|
}
|
|
267
276
|
if (!pieceMask.eventDropped(event) && pieceMask.entryDropped(event, groupIndex, hookIndex)) {
|
|
268
|
-
verdicts
|
|
277
|
+
appendOwnElement(verdicts, { ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
269
278
|
return;
|
|
270
279
|
}
|
|
271
280
|
const shape = classifyEntry(entry, src.options);
|
|
272
281
|
if (shape.kind === 'malformed') {
|
|
273
|
-
verdicts
|
|
282
|
+
appendOwnElement(verdicts, { ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
274
283
|
return;
|
|
275
284
|
}
|
|
276
285
|
if (shape.kind === 'shell_form' && shape.refusesUserConfig) {
|
|
277
|
-
verdicts
|
|
286
|
+
appendOwnElement(verdicts, { ...key, disposition: 'not_run', reason: 'shell_form_user_config' });
|
|
278
287
|
return;
|
|
279
288
|
}
|
|
280
289
|
if (shape.kind === 'exec_form' && shape.unsetUserConfig) {
|
|
281
|
-
verdicts
|
|
290
|
+
appendOwnElement(verdicts, { ...key, disposition: 'not_run', reason: 'user_config_unset' });
|
|
282
291
|
return;
|
|
283
292
|
}
|
|
284
293
|
if (!ENGINE_EVENTS.has(event)) {
|
|
285
|
-
verdicts
|
|
294
|
+
appendOwnElement(verdicts, {
|
|
286
295
|
...key,
|
|
287
296
|
...(input.shellRuns(event, entryType)
|
|
288
297
|
? { disposition: 'shell', reason: 'shell_event' }
|
|
@@ -301,11 +310,11 @@ export function decidePluginHooks(input) {
|
|
|
301
310
|
...(shape.kind === 'other' ? { pluginBlock: 'not_command' } : declaresSensitive(src.options) ? { pluginBlock: 'sensitive_options' } : {}),
|
|
302
311
|
});
|
|
303
312
|
if (ex.kind === 'excluded') {
|
|
304
|
-
excluded
|
|
313
|
+
appendOwnElement(excluded, { ...key, reason: ex.reason });
|
|
305
314
|
return;
|
|
306
315
|
}
|
|
307
316
|
if (ex.disposition !== 'engine') {
|
|
308
|
-
verdicts
|
|
317
|
+
appendOwnElement(verdicts, { ...key, disposition: ex.disposition, reason: ex.reason });
|
|
309
318
|
return;
|
|
310
319
|
}
|
|
311
320
|
const plugin = { name: src.name, root: src.root, dataDir: src.dataDir };
|
|
@@ -318,9 +327,9 @@ export function decidePluginHooks(input) {
|
|
|
318
327
|
wireEntry.args = shape.args.map((a) => substituteUserConfig(a, src.options));
|
|
319
328
|
}
|
|
320
329
|
const verdict = { ...key, disposition: 'engine', reason: 'projected' };
|
|
321
|
-
verdicts
|
|
330
|
+
appendOwnElement(verdicts, verdict);
|
|
322
331
|
const list = candidates.get(event) ?? [];
|
|
323
|
-
list
|
|
332
|
+
appendOwnElement(list, { verdict, pluginIndex, group, wireEntry });
|
|
324
333
|
candidates.set(event, list);
|
|
325
334
|
});
|
|
326
335
|
});
|
|
@@ -341,7 +350,7 @@ export function decidePluginHooks(input) {
|
|
|
341
350
|
for (const c of fits) {
|
|
342
351
|
const k = `${c.pluginIndex}\u0000${c.verdict.groupIndex}`;
|
|
343
352
|
if (!groupKeys.includes(k))
|
|
344
|
-
groupKeys
|
|
353
|
+
appendOwnElement(groupKeys, k);
|
|
345
354
|
}
|
|
346
355
|
const occ = input.occupied.get(event) ?? { groups: 0, entries: 0 };
|
|
347
356
|
if (occ.groups + groupKeys.length > ENGINE_HOOK_LIMITS.maxGroupsPerEvent ||
|
|
@@ -356,7 +365,7 @@ export function decidePluginHooks(input) {
|
|
|
356
365
|
const first = members[0];
|
|
357
366
|
if (first === undefined)
|
|
358
367
|
continue;
|
|
359
|
-
groupsOut
|
|
368
|
+
appendOwnElement(groupsOut, { ...first.group, hooks: members.map((c) => c.wireEntry) });
|
|
360
369
|
}
|
|
361
370
|
projected.set(event, groupsOut);
|
|
362
371
|
}
|
|
@@ -416,18 +425,18 @@ export function decideSessionHooks(input) {
|
|
|
416
425
|
const key = { origin, name, event, groupIndex, hookIndex };
|
|
417
426
|
const type = isRecord(entry) && typeof entry.type === 'string' ? entry.type : undefined;
|
|
418
427
|
if (rejectedWhole || (!mask.eventDropped(event) && mask.entryDropped(event, groupIndex, hookIndex)) || type === undefined) {
|
|
419
|
-
out
|
|
428
|
+
appendOwnElement(out, { ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
420
429
|
return;
|
|
421
430
|
}
|
|
422
431
|
const shellRuns = input.shellRuns(event, type);
|
|
423
432
|
if (!ENGINE_EVENTS.has(event)) {
|
|
424
|
-
out
|
|
433
|
+
appendOwnElement(out, { ...key, ...(shellRuns ? { disposition: 'shell', reason: 'shell_event' } : { disposition: 'not_run', reason: 'no_executor' }) });
|
|
425
434
|
return;
|
|
426
435
|
}
|
|
427
436
|
const ex = hookExecutorOf({ source: 'session', event, powershell: false, llmPosition: 0, engine: input.engine, shellRuns, promptAuthoredByUser: input.promptAuthoredByUser });
|
|
428
437
|
if (ex.kind === 'excluded')
|
|
429
438
|
return;
|
|
430
|
-
out
|
|
439
|
+
appendOwnElement(out, { ...key, disposition: ex.disposition, reason: ex.reason });
|
|
431
440
|
});
|
|
432
441
|
});
|
|
433
442
|
}
|
|
@@ -456,7 +465,7 @@ export function filterSettingsHookGroups(source, event, groups, execFormCapable,
|
|
|
456
465
|
if (mask !== undefined && mask.groupDropped(event, groupIndex))
|
|
457
466
|
return;
|
|
458
467
|
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
459
|
-
out
|
|
468
|
+
appendOwnElement(out, group);
|
|
460
469
|
return;
|
|
461
470
|
}
|
|
462
471
|
const kept = [];
|
|
@@ -474,18 +483,18 @@ export function filterSettingsHookGroups(source, event, groups, execFormCapable,
|
|
|
474
483
|
? 'exec_form_unsupported'
|
|
475
484
|
: undefined;
|
|
476
485
|
if (reason !== undefined) {
|
|
477
|
-
drops
|
|
486
|
+
appendOwnElement(drops, { source, event, groupIndex, hookIndex, reason, notRun: engineEvent && !shellRunsType(isRecord(entry) && typeof entry.type === 'string' ? entry.type : undefined) });
|
|
478
487
|
changed = true;
|
|
479
488
|
return;
|
|
480
489
|
}
|
|
481
490
|
if (engineEvent && isRecord(entry) && judgeableSettingsEntry(entry)) {
|
|
482
491
|
const ex = judge(event, group, entry);
|
|
483
492
|
if (ex.kind === 'excluded') {
|
|
484
|
-
excluded
|
|
493
|
+
appendOwnElement(excluded, { source, event, groupIndex, hookIndex, reason: ex.reason });
|
|
485
494
|
changed = true;
|
|
486
495
|
return;
|
|
487
496
|
}
|
|
488
|
-
verdicts
|
|
497
|
+
appendOwnElement(verdicts, { source, event, groupIndex, hookIndex, disposition: ex.disposition, reason: ex.reason });
|
|
489
498
|
if (ex.disposition === 'shell') {
|
|
490
499
|
changed = true;
|
|
491
500
|
return;
|
|
@@ -494,17 +503,17 @@ export function filterSettingsHookGroups(source, event, groups, execFormCapable,
|
|
|
494
503
|
if (isRecord(entry) && Object.hasOwn(entry, 'plugin')) {
|
|
495
504
|
const copy = { ...entry };
|
|
496
505
|
delete copy.plugin;
|
|
497
|
-
kept
|
|
506
|
+
appendOwnElement(kept, copy);
|
|
498
507
|
stripped++;
|
|
499
508
|
changed = true;
|
|
500
509
|
return;
|
|
501
510
|
}
|
|
502
|
-
kept
|
|
511
|
+
appendOwnElement(kept, entry);
|
|
503
512
|
});
|
|
504
513
|
if (!changed)
|
|
505
|
-
out
|
|
514
|
+
appendOwnElement(out, group);
|
|
506
515
|
else if (kept.length > 0)
|
|
507
|
-
out
|
|
516
|
+
appendOwnElement(out, { ...group, hooks: kept });
|
|
508
517
|
});
|
|
509
518
|
return { groups: out, drops, stripped, verdicts, excluded };
|
|
510
519
|
}
|
|
@@ -515,7 +524,7 @@ function judgeableSettingsEntry(entry) {
|
|
|
515
524
|
const field = type === 'command' ? entry.command : type === 'http' ? entry.url : entry.prompt;
|
|
516
525
|
return nonEmptyString(field) && !field.includes('\u0000');
|
|
517
526
|
}
|
|
518
|
-
export function createSettingsHookJudge(engine, shellRuns, promptAuthoredByUser) {
|
|
527
|
+
export function createSettingsHookJudge(engine, shellRuns, promptAuthoredByUser, compactionOnShell) {
|
|
519
528
|
const llm = new Map();
|
|
520
529
|
const seen = new Map();
|
|
521
530
|
return (event, group, entry) => {
|
|
@@ -544,6 +553,7 @@ export function createSettingsHookJudge(engine, shellRuns, promptAuthoredByUser)
|
|
|
544
553
|
engine,
|
|
545
554
|
shellRuns: shellRuns(event, typeof type === 'string' ? type : undefined),
|
|
546
555
|
promptAuthoredByUser,
|
|
556
|
+
...(compactionOnShell === true ? { compactionOnShell: true } : {}),
|
|
547
557
|
});
|
|
548
558
|
if (isLlm && ex.kind === 'judged' && ex.disposition !== 'shell')
|
|
549
559
|
llm.set(event, (llm.get(event) ?? 0) + 1);
|
|
@@ -610,7 +620,7 @@ export function dedupeSettingsHookGroups(groups) {
|
|
|
610
620
|
const winner = new Map();
|
|
611
621
|
for (const { source, group } of groups) {
|
|
612
622
|
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
613
|
-
keysOf
|
|
623
|
+
appendOwnElement(keysOf, []);
|
|
614
624
|
continue;
|
|
615
625
|
}
|
|
616
626
|
let groupKey;
|
|
@@ -627,21 +637,21 @@ export function dedupeSettingsHookGroups(groups) {
|
|
|
627
637
|
for (const entry of group.hooks) {
|
|
628
638
|
const entryKey = groupKey === undefined ? undefined : settingsHookEntryKey(entry);
|
|
629
639
|
const key = entryKey === undefined ? undefined : `${groupKey}\u0000${entryKey}`;
|
|
630
|
-
keys
|
|
640
|
+
appendOwnElement(keys, key);
|
|
631
641
|
if (key === undefined)
|
|
632
642
|
continue;
|
|
633
643
|
const prev = winner.get(key);
|
|
634
644
|
if (prev === undefined || rank >= prev.rank)
|
|
635
645
|
winner.set(key, { entry, rank });
|
|
636
646
|
}
|
|
637
|
-
keysOf
|
|
647
|
+
appendOwnElement(keysOf, keys);
|
|
638
648
|
}
|
|
639
649
|
const placed = new Set();
|
|
640
650
|
const out = [];
|
|
641
651
|
let removed = 0;
|
|
642
652
|
groups.forEach(({ group }, gi) => {
|
|
643
653
|
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
644
|
-
out
|
|
654
|
+
appendOwnElement(out, group);
|
|
645
655
|
return;
|
|
646
656
|
}
|
|
647
657
|
const keys = keysOf[gi] ?? [];
|
|
@@ -650,7 +660,7 @@ export function dedupeSettingsHookGroups(groups) {
|
|
|
650
660
|
group.hooks.forEach((entry, hi) => {
|
|
651
661
|
const key = keys[hi];
|
|
652
662
|
if (key === undefined) {
|
|
653
|
-
kept
|
|
663
|
+
appendOwnElement(kept, entry);
|
|
654
664
|
return;
|
|
655
665
|
}
|
|
656
666
|
if (placed.has(key)) {
|
|
@@ -662,12 +672,12 @@ export function dedupeSettingsHookGroups(groups) {
|
|
|
662
672
|
const win = winner.get(key)?.entry ?? entry;
|
|
663
673
|
if (win !== entry)
|
|
664
674
|
changed = true;
|
|
665
|
-
kept
|
|
675
|
+
appendOwnElement(kept, win);
|
|
666
676
|
});
|
|
667
677
|
if (!changed)
|
|
668
|
-
out
|
|
678
|
+
appendOwnElement(out, group);
|
|
669
679
|
else if (kept.length > 0)
|
|
670
|
-
out
|
|
680
|
+
appendOwnElement(out, { ...group, hooks: kept });
|
|
671
681
|
});
|
|
672
682
|
return { groups: out, removed };
|
|
673
683
|
}
|
|
@@ -686,6 +696,20 @@ export function settingsHooksKeptLocally(plan, event, group, opts) {
|
|
|
686
696
|
raw = undefined;
|
|
687
697
|
}
|
|
688
698
|
const hooks = raw;
|
|
699
|
+
if (Array.isArray(hooks) && hooks.length > 0) {
|
|
700
|
+
let layerSkipped;
|
|
701
|
+
try {
|
|
702
|
+
const src = isRecord(group) ? group.source : undefined;
|
|
703
|
+
const planRec0 = plan;
|
|
704
|
+
const allowed = typeof src === 'string' && isRecord(planRec0) ? ownField(planRec0, 'settingsSources') : undefined;
|
|
705
|
+
layerSkipped = Array.isArray(allowed) && !allowed.includes(src);
|
|
706
|
+
}
|
|
707
|
+
catch {
|
|
708
|
+
layerSkipped = false;
|
|
709
|
+
}
|
|
710
|
+
if (layerSkipped)
|
|
711
|
+
return [];
|
|
712
|
+
}
|
|
689
713
|
if (!Array.isArray(hooks) || hooks.length === 0 || !ENGINE_EVENTS.has(event))
|
|
690
714
|
return hooks;
|
|
691
715
|
try {
|
|
@@ -729,7 +753,7 @@ export function settingsHooksKeptLocally(plan, event, group, opts) {
|
|
|
729
753
|
if (skip)
|
|
730
754
|
kept ??= hooks.slice(0, i);
|
|
731
755
|
else if (kept !== null)
|
|
732
|
-
kept
|
|
756
|
+
appendOwnElement(kept, h);
|
|
733
757
|
});
|
|
734
758
|
return kept ?? hooks;
|
|
735
759
|
}
|
|
@@ -807,6 +831,7 @@ const REASON_TEXT = {
|
|
|
807
831
|
hooks_module: 'hooks registered in code by a plugin module run neither in the engine nor in this client',
|
|
808
832
|
scope_unsupported: 'hooks registered for a skill, an agent or by the host application are not sent to the engine, and this client does not run this event',
|
|
809
833
|
source_incomplete: 'the plugin was reported without its id, name, root folder or data folder',
|
|
834
|
+
compaction_local_fallback: renderMessage(msg('config.hooks.plan.reason.compactionLocalFallback')),
|
|
810
835
|
};
|
|
811
836
|
const DROP_TEXT = {
|
|
812
837
|
exec_form_unsupported: 'exec-form hooks (with "args") are sent to the engine only once it reports support for them',
|
|
@@ -844,17 +869,17 @@ function escapeNoticeQuotes(s) {
|
|
|
844
869
|
j++;
|
|
845
870
|
const want = s.charCodeAt(j) === 0x22 ? (j - i) * 2 : j - i;
|
|
846
871
|
const take = Math.min(want, budget + 1 - len);
|
|
847
|
-
out
|
|
872
|
+
appendOwnElement(out, '\\'.repeat(take));
|
|
848
873
|
len += take;
|
|
849
874
|
i = j;
|
|
850
875
|
continue;
|
|
851
876
|
}
|
|
852
877
|
if (c === 0x22) {
|
|
853
|
-
out
|
|
878
|
+
appendOwnElement(out, '\\"');
|
|
854
879
|
len += 2;
|
|
855
880
|
}
|
|
856
881
|
else {
|
|
857
|
-
out
|
|
882
|
+
appendOwnElement(out, s.charAt(i));
|
|
858
883
|
len++;
|
|
859
884
|
}
|
|
860
885
|
i++;
|
|
@@ -882,13 +907,13 @@ export function hooksNotRunNotice(plan) {
|
|
|
882
907
|
const k = `${v.pluginId}\u0000${v.reason}`;
|
|
883
908
|
const row = byPlugin.get(k) ?? { name: v.pluginName, reason: v.reason, events: [], count: 0 };
|
|
884
909
|
if (!row.events.includes(v.event))
|
|
885
|
-
row.events
|
|
910
|
+
appendOwnElement(row.events, v.event);
|
|
886
911
|
row.count++;
|
|
887
912
|
byPlugin.set(k, row);
|
|
888
913
|
}
|
|
889
914
|
for (const row of byPlugin.values()) {
|
|
890
915
|
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
891
|
-
lines
|
|
916
|
+
appendOwnElement(lines, `Plugin "${noticeLabel(row.name) || '(unnamed)'}": ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${pluginHookReasonText(row.reason)}.`);
|
|
892
917
|
}
|
|
893
918
|
const bySource = new Map();
|
|
894
919
|
for (const d of plan.settingsDropped) {
|
|
@@ -897,13 +922,13 @@ export function hooksNotRunNotice(plan) {
|
|
|
897
922
|
const k = `${d.source}\u0000${d.reason}`;
|
|
898
923
|
const row = bySource.get(k) ?? { source: d.source, reason: d.reason, events: [], count: 0 };
|
|
899
924
|
if (!row.events.includes(d.event))
|
|
900
|
-
row.events
|
|
925
|
+
appendOwnElement(row.events, d.event);
|
|
901
926
|
row.count++;
|
|
902
927
|
bySource.set(k, row);
|
|
903
928
|
}
|
|
904
929
|
for (const row of bySource.values()) {
|
|
905
930
|
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
906
|
-
lines
|
|
931
|
+
appendOwnElement(lines, `${SOURCE_TEXT[row.source]}: ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${settingsHookDropText(row.reason)}.`);
|
|
907
932
|
}
|
|
908
933
|
const settingsVerdicts = plan.settingsVerdicts;
|
|
909
934
|
const byVerdict = new Map();
|
|
@@ -914,13 +939,13 @@ export function hooksNotRunNotice(plan) {
|
|
|
914
939
|
const k = `${v.source}\u0000${v.reason}`;
|
|
915
940
|
const row = byVerdict.get(k) ?? { source: v.source, reason: v.reason, events: [], count: 0 };
|
|
916
941
|
if (!row.events.includes(v.event))
|
|
917
|
-
row.events
|
|
942
|
+
appendOwnElement(row.events, v.event);
|
|
918
943
|
row.count++;
|
|
919
944
|
byVerdict.set(k, row);
|
|
920
945
|
}
|
|
921
946
|
for (const row of byVerdict.values()) {
|
|
922
947
|
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
923
|
-
lines
|
|
948
|
+
appendOwnElement(lines, `${SOURCE_TEXT[row.source]}: ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${pluginHookReasonText(row.reason)}.`);
|
|
924
949
|
}
|
|
925
950
|
const moduleRows = plan.moduleVerdicts;
|
|
926
951
|
for (const raw of Array.isArray(moduleRows) ? moduleRows : []) {
|
|
@@ -930,7 +955,7 @@ export function hooksNotRunNotice(plan) {
|
|
|
930
955
|
const name = ownField(raw, 'pluginName');
|
|
931
956
|
if (typeof reason !== 'string' || !REASON_SET.has(reason))
|
|
932
957
|
continue;
|
|
933
|
-
lines
|
|
958
|
+
appendOwnElement(lines, `Plugin "${noticeLabel(typeof name === 'string' ? name : '') || '(unnamed)'}": hooks module will not run — ${pluginHookReasonText(reason)}.`);
|
|
934
959
|
}
|
|
935
960
|
const sessionRows = plan.sessionVerdicts;
|
|
936
961
|
const bySession = new Map();
|
|
@@ -947,20 +972,32 @@ export function hooksNotRunNotice(plan) {
|
|
|
947
972
|
const k = `${origin}\u0000${nm}\u0000${reason}`;
|
|
948
973
|
const row = bySession.get(k) ?? { origin: origin, name: nm, reason: reason, events: [], count: 0 };
|
|
949
974
|
if (!row.events.includes(event))
|
|
950
|
-
row.events
|
|
975
|
+
appendOwnElement(row.events, event);
|
|
951
976
|
row.count++;
|
|
952
977
|
bySession.set(k, row);
|
|
953
978
|
}
|
|
954
979
|
for (const row of bySession.values()) {
|
|
955
980
|
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
956
981
|
const who = row.origin === 'sdk_host' ? 'Host application hooks' : `${row.origin === 'skill' ? 'Skill' : 'Agent'} "${noticeLabel(row.name) || '(unnamed)'}"`;
|
|
957
|
-
lines
|
|
982
|
+
appendOwnElement(lines, `${who}: ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${pluginHookReasonText(row.reason)}.`);
|
|
958
983
|
}
|
|
959
984
|
const salvageRows = plan.settingsSalvage;
|
|
960
985
|
for (const row of Array.isArray(salvageRows) ? salvageRows : []) {
|
|
961
986
|
const notice = isRecord(row) ? ownField(row, 'notice') : undefined;
|
|
962
987
|
if (typeof notice === 'string' && notice.length > 0)
|
|
963
|
-
lines
|
|
988
|
+
appendOwnElement(lines, notice);
|
|
989
|
+
}
|
|
990
|
+
const httpRows = plan.httpPolicyDrops;
|
|
991
|
+
for (const row of Array.isArray(httpRows) ? httpRows : []) {
|
|
992
|
+
const notice = isRecord(row) ? ownField(row, 'notice') : undefined;
|
|
993
|
+
if (typeof notice === 'string' && notice.length > 0)
|
|
994
|
+
appendOwnElement(lines, notice);
|
|
995
|
+
}
|
|
996
|
+
const withheldRows = plan.settingsWithheld;
|
|
997
|
+
for (const row of Array.isArray(withheldRows) ? withheldRows : []) {
|
|
998
|
+
const notice = isRecord(row) ? ownField(row, 'notice') : undefined;
|
|
999
|
+
if (typeof notice === 'string' && notice.length > 0)
|
|
1000
|
+
appendOwnElement(lines, notice);
|
|
964
1001
|
}
|
|
965
1002
|
return lines;
|
|
966
1003
|
}
|
|
@@ -976,12 +1013,14 @@ export function userPromptSubmitExecutorOf(plan) {
|
|
|
976
1013
|
const settingsRows = ownField(p, 'settingsVerdicts');
|
|
977
1014
|
if (!Array.isArray(settingsRows))
|
|
978
1015
|
return 'unknown';
|
|
979
|
-
|
|
1016
|
+
for (const v of settingsRows)
|
|
1017
|
+
appendOwnElement(rows, v);
|
|
980
1018
|
const sessionRows = ownField(p, 'sessionVerdicts');
|
|
981
1019
|
if (sessionRows !== undefined) {
|
|
982
1020
|
if (!Array.isArray(sessionRows))
|
|
983
1021
|
return 'unknown';
|
|
984
|
-
|
|
1022
|
+
for (const v of sessionRows)
|
|
1023
|
+
appendOwnElement(rows, v);
|
|
985
1024
|
}
|
|
986
1025
|
const ups = rows.filter((r) => isRecord(r) && ownField(r, 'event') === 'UserPromptSubmit').map((r) => ownField(r, 'disposition'));
|
|
987
1026
|
if (ups.length === 0)
|
package/dist/prepareRefusal.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_TOOL_FACE_CONTROL, PROMPT_ASSEMBLED_ROLE_REFUSED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
|
-
export type PrepareRefusalCode = typeof CONFIG_LEGACY_TOOL_NAME | typeof CONFIG_IMAGE_INVALID | typeof CONFIG_AGENT_UNKNOWN_TOOL | typeof PROMPT_ASSEMBLED_ROLE_REFUSED | typeof USER_ATTACHMENT_INVALID_ERROR_CODE | typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE | typeof CONFIG_TOOL_FACE_CONTROL;
|
|
1
|
+
import { CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_MCP_SERVER_NAME_COLLISION, CONFIG_TOOL_FACE_CONTROL, PROMPT_ASSEMBLED_ROLE_REFUSED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
|
+
export type PrepareRefusalCode = typeof CONFIG_LEGACY_TOOL_NAME | typeof CONFIG_IMAGE_INVALID | typeof CONFIG_AGENT_UNKNOWN_TOOL | typeof PROMPT_ASSEMBLED_ROLE_REFUSED | typeof USER_ATTACHMENT_INVALID_ERROR_CODE | typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE | typeof CONFIG_TOOL_FACE_CONTROL | typeof CONFIG_MCP_SERVER_NAME_COLLISION;
|
|
3
3
|
export interface PrepareRefusalNoteFacts {
|
|
4
4
|
readonly index?: number;
|
|
5
|
+
readonly draftKept?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function prepareRefusalNoteOf(code: string | undefined, facts?: PrepareRefusalNoteFacts): string | undefined;
|
|
7
8
|
export declare function prepareRefusalCodeOf(failure: {} | null | undefined): PrepareRefusalCode | undefined;
|
package/dist/prepareRefusal.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_TOOL_FACE_CONTROL, PROMPT_ASSEMBLED_ROLE_REFUSED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, } from './engineErrorCodes.js';
|
|
1
|
+
import { CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_MCP_SERVER_NAME_COLLISION, CONFIG_TOOL_FACE_CONTROL, PROMPT_ASSEMBLED_ROLE_REFUSED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, } from './engineErrorCodes.js';
|
|
2
2
|
import { REFUSED_NAME_CLASSES } from './hitl/refusedToolNameProse.js';
|
|
3
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
4
|
import { readOwnDataValue } from './ownKey.js';
|
|
4
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
5
6
|
const nonNegInt = (v) => (typeof v === 'number' && Number.isSafeInteger(v) && v >= 0 ? v : undefined);
|
|
7
|
+
const draftKeptSegment = (facts) => Object.hasOwn(facts, 'draftKept') && facts.draftKept === true ? ` · ${renderMessage(msg('notice.prepareRefusal.draftKept'))}` : '';
|
|
8
|
+
const indexOf = (facts) => nonNegInt(Object.hasOwn(facts, 'index') ? facts.index : undefined);
|
|
6
9
|
const PREPARE_REFUSAL_NOTES = Object.freeze({
|
|
7
10
|
[CONFIG_LEGACY_TOOL_NAME]: () => `The engine refused this run at setup: a tool rule applied to it names a tool the engine refuses — ${REFUSED_NAME_CLASSES} (the engine's own error text names the entry). ` +
|
|
8
11
|
'Every later run fails the same way until that entry is removed from wherever it is set: this session’s rule record, the settings sent with the run, a parent session’s rule record, or the deployment’s own tool rules.',
|
|
@@ -13,17 +16,18 @@ const PREPARE_REFUSAL_NOTES = Object.freeze({
|
|
|
13
16
|
[PROMPT_ASSEMBLED_ROLE_REFUSED]: () => 'The engine refused this run at setup: the role text sent with it contains the engine’s own prompt sections word for word — the engine’s own error text names the field · ' +
|
|
14
17
|
'Send only your own role text (the engine assembles the rest), then send it again',
|
|
15
18
|
[USER_ATTACHMENT_INVALID_ERROR_CODE]: (facts) => {
|
|
16
|
-
const index =
|
|
19
|
+
const index = indexOf(facts);
|
|
17
20
|
return index !== undefined
|
|
18
|
-
? `The engine refused attachment ${index + 1} of this message: it is in a form the engine does not accept, or larger than it takes ·
|
|
19
|
-
: 'The engine refused the files attached to this message: together with the message they are more than it can take in one request on this model, or one of them is in a form it does not accept
|
|
20
|
-
|
|
21
|
+
? `The engine refused attachment ${index + 1} of this message: it is in a form the engine does not accept, or larger than it takes${draftKeptSegment(facts)} · Remove or replace that attachment, then send it again`
|
|
22
|
+
: 'The engine refused the files attached to this message: together with the message they are more than it can take in one request on this model, or one of them is in a form it does not accept' +
|
|
23
|
+
`${draftKeptSegment(facts)} · Remove some attachments or attach smaller parts, then send it again`;
|
|
21
24
|
},
|
|
22
|
-
[USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE]: () => 'The engine refused this run at setup: a skill named for it is not one this run has loaded, or skills are turned off for this run
|
|
23
|
-
|
|
25
|
+
[USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE]: (facts) => 'The engine refused this run at setup: a skill named for it is not one this run has loaded, or skills are turned off for this run' +
|
|
26
|
+
`${draftKeptSegment(facts)} · Check the skill name, or load that skill, then send it again`,
|
|
24
27
|
[CONFIG_TOOL_FACE_CONTROL]: () => 'The engine refused this run at setup: its tool set could not be put together as asked — usually a tool list on the request or one it inherits (allowed or excluded tools) names something no tool answers to, ' +
|
|
25
28
|
'uses a form those lists do not accept, or excludes a tool this run depends on; it can also be the deployment’s own tool mounts — the engine’s own error text says what it refused and where · ' +
|
|
26
29
|
'Sending the same request again is refused the same way; fix what it names (or ask whoever operates the engine, if it names the deployment’s tools), then send it',
|
|
30
|
+
[CONFIG_MCP_SERVER_NAME_COLLISION]: () => renderMessage(msg('notice.prepareRefusal.mcpServerNameCollision')),
|
|
27
31
|
});
|
|
28
32
|
function isPrepareRefusalCode(code) {
|
|
29
33
|
return typeof code === 'string' && Object.hasOwn(PREPARE_REFUSAL_NOTES, code);
|
|
@@ -32,15 +36,29 @@ export function prepareRefusalNoteOf(code, facts) {
|
|
|
32
36
|
try {
|
|
33
37
|
if (!isPrepareRefusalCode(code))
|
|
34
38
|
return undefined;
|
|
39
|
+
let bag;
|
|
40
|
+
try {
|
|
41
|
+
bag = typeof facts === 'object' && facts !== null && !Array.isArray(facts) ? facts : undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
bag = undefined;
|
|
45
|
+
}
|
|
35
46
|
let index;
|
|
36
47
|
try {
|
|
37
|
-
index =
|
|
48
|
+
index = readOwnDataValue(bag, 'index');
|
|
38
49
|
}
|
|
39
50
|
catch {
|
|
40
51
|
index = undefined;
|
|
41
52
|
}
|
|
53
|
+
let draftKept;
|
|
54
|
+
try {
|
|
55
|
+
draftKept = readOwnDataValue(bag, 'draftKept');
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
draftKept = undefined;
|
|
59
|
+
}
|
|
42
60
|
const i = nonNegInt(index);
|
|
43
|
-
return PREPARE_REFUSAL_NOTES[code](i !== undefined ? { index: i } : {});
|
|
61
|
+
return PREPARE_REFUSAL_NOTES[code]({ ...(i !== undefined ? { index: i } : {}), ...(draftKept === true ? { draftKept: true } : {}) });
|
|
44
62
|
}
|
|
45
63
|
catch {
|
|
46
64
|
return undefined;
|
|
@@ -87,7 +87,7 @@ function snapshotStampKeys(rec) {
|
|
|
87
87
|
return undefined;
|
|
88
88
|
const d = Reflect.getOwnPropertyDescriptor(o, key);
|
|
89
89
|
if (d !== undefined) {
|
|
90
|
-
if ('get'
|
|
90
|
+
if (Object.hasOwn(d, 'get') || Object.hasOwn(d, 'set'))
|
|
91
91
|
return undefined;
|
|
92
92
|
if (depth === 0)
|
|
93
93
|
own = d;
|
|
@@ -112,7 +112,7 @@ function restoreStampKeys(rec, saved) {
|
|
|
112
112
|
if (s.own !== undefined) {
|
|
113
113
|
if (now === undefined)
|
|
114
114
|
ok = Reflect.defineProperty(rec, s.key, s.own);
|
|
115
|
-
else if (!('value'
|
|
115
|
+
else if (!Object.hasOwn(now, 'value') || !Object.is(now.value, s.own.value))
|
|
116
116
|
ok = Reflect.set(rec, s.key, s.own.value);
|
|
117
117
|
}
|
|
118
118
|
else if (now !== undefined) {
|
package/dist/printModelStatus.js
CHANGED
|
@@ -77,7 +77,7 @@ function isMainLaneArm(msg) {
|
|
|
77
77
|
const tri = (o, key) => {
|
|
78
78
|
try {
|
|
79
79
|
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
80
|
-
if (d !== undefined && !('value'
|
|
80
|
+
if (d !== undefined && !Object.hasOwn(d, 'value'))
|
|
81
81
|
return { ok: false };
|
|
82
82
|
return { ok: true, v: readOwnDataValue(o, key) };
|
|
83
83
|
}
|
|
@@ -41,7 +41,7 @@ export function toolEndResultToUserFrame(arm) {
|
|
|
41
41
|
parent_tool_use_id: parent,
|
|
42
42
|
...(isCcToolDenialKind(arm._sema_denial_kind) ? { _sema_denial_kind: arm._sema_denial_kind } : {}),
|
|
43
43
|
...(gateView !== undefined ? { _sema_gate: gateView } : {}),
|
|
44
|
-
...toolResultRowFlagParts(arm),
|
|
44
|
+
...toolResultRowFlagParts(arm, gateView),
|
|
45
45
|
...(Object.hasOwn(envelope, 'tool_use_result') ? { tool_use_result: envelope.tool_use_result } : {}),
|
|
46
46
|
...(Object.hasOwn(envelope, '_sema_degraded') ? { _sema_degraded: envelope._sema_degraded } : {}),
|
|
47
47
|
uuid: rowIdentity.uuid,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
|
+
export declare const PROJECT_MEMORY_DISABLED: "disabled";
|
|
3
|
+
export declare const PROJECT_MEMORY_WORDS: readonly ["on", "disabled", "absent"];
|
|
4
|
+
export type ProjectMemoryWord = (typeof PROJECT_MEMORY_WORDS)[number];
|
|
5
|
+
export interface ProjectMemoryManifestSeat {
|
|
6
|
+
readonly projectMemory?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function projectMemoryOf(manifest: ProjectMemoryManifestSeat | null | undefined): ProjectMemoryWord | undefined;
|
|
9
|
+
export type ProjectMemoryCapabilityReading = {
|
|
10
|
+
readonly kind: 'confirmed';
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'absent';
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'declined';
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'unreadable';
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'unobserved';
|
|
19
|
+
};
|
|
20
|
+
export declare function observedProjectMemoryCapability(baseUrl?: string | undefined): ProjectMemoryCapabilityReading;
|
|
21
|
+
export type ProjectMemoryWithheldCause = 'capability_absent' | 'capability_declined' | 'capability_unreadable';
|
|
22
|
+
export interface ProjectMemoryWithheld {
|
|
23
|
+
readonly cause: ProjectMemoryWithheldCause;
|
|
24
|
+
}
|
|
25
|
+
export interface ProjectMemoryDeclaration {
|
|
26
|
+
readonly field: {
|
|
27
|
+
readonly projectMemory?: 'disabled';
|
|
28
|
+
};
|
|
29
|
+
readonly withheld?: ProjectMemoryWithheld;
|
|
30
|
+
}
|
|
31
|
+
export declare function projectMemoryDeclaration(intent: 'disabled' | undefined, reading: ProjectMemoryCapabilityReading): ProjectMemoryDeclaration;
|
|
32
|
+
export declare function projectMemoryWithheldNotice(withheld: ProjectMemoryWithheld, lang?: UiLanguage): string;
|