@wrongstack/core 0.287.0 → 0.291.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/dist/agent-status-tracker.d.ts +13 -0
- package/dist/agent-status-tracker.d.ts.map +1 -1
- package/dist/boot.d.ts.map +1 -1
- package/dist/chronicle/context.d.ts +13 -0
- package/dist/chronicle/context.d.ts.map +1 -0
- package/dist/chronicle/decision-adapter.d.ts +13 -0
- package/dist/chronicle/decision-adapter.d.ts.map +1 -0
- package/dist/chronicle/domain-adapter.d.ts +13 -0
- package/dist/chronicle/domain-adapter.d.ts.map +1 -0
- package/dist/chronicle/file-observer.d.ts +20 -0
- package/dist/chronicle/file-observer.d.ts.map +1 -0
- package/dist/chronicle/health-monitor.d.ts +11 -0
- package/dist/chronicle/health-monitor.d.ts.map +1 -0
- package/dist/chronicle/identity.d.ts +18 -0
- package/dist/chronicle/identity.d.ts.map +1 -0
- package/dist/chronicle/index.d.ts +16 -0
- package/dist/chronicle/index.d.ts.map +1 -0
- package/dist/chronicle/index.js +2555 -0
- package/dist/chronicle/index.js.map +7 -0
- package/dist/chronicle/journal.d.ts +81 -0
- package/dist/chronicle/journal.d.ts.map +1 -0
- package/dist/chronicle/process-adapter.d.ts +14 -0
- package/dist/chronicle/process-adapter.d.ts.map +1 -0
- package/dist/chronicle/prompt-manifest.d.ts +34 -0
- package/dist/chronicle/prompt-manifest.d.ts.map +1 -0
- package/dist/chronicle/provider-adapter.d.ts +13 -0
- package/dist/chronicle/provider-adapter.d.ts.map +1 -0
- package/dist/chronicle/query.d.ts +108 -0
- package/dist/chronicle/query.d.ts.map +1 -0
- package/dist/chronicle/rollup-adapter.d.ts +14 -0
- package/dist/chronicle/rollup-adapter.d.ts.map +1 -0
- package/dist/chronicle/stream-adapter.d.ts +13 -0
- package/dist/chronicle/stream-adapter.d.ts.map +1 -0
- package/dist/chronicle/tool-adapter.d.ts +15 -0
- package/dist/chronicle/tool-adapter.d.ts.map +1 -0
- package/dist/chronicle/types.d.ts +82 -0
- package/dist/chronicle/types.d.ts.map +1 -0
- package/dist/coordination/agent-monitor.d.ts +40 -0
- package/dist/coordination/agent-monitor.d.ts.map +1 -1
- package/dist/coordination/agent-subagent-runner.d.ts +7 -1
- package/dist/coordination/agent-subagent-runner.d.ts.map +1 -1
- package/dist/coordination/agents/phase6-domain.d.ts.map +1 -1
- package/dist/coordination/autonomous-coordinator.d.ts +2 -0
- package/dist/coordination/autonomous-coordinator.d.ts.map +1 -1
- package/dist/coordination/brain-monitor.d.ts +1 -1
- package/dist/coordination/brain.d.ts +3 -2
- package/dist/coordination/brain.d.ts.map +1 -1
- package/dist/coordination/collab-debug.d.ts +0 -9
- package/dist/coordination/collab-debug.d.ts.map +1 -1
- package/dist/coordination/coordinator/error-classifier.d.ts.map +1 -1
- package/dist/coordination/dep-watcher.d.ts +2 -1
- package/dist/coordination/dep-watcher.d.ts.map +1 -1
- package/dist/coordination/director/director-collab.d.ts +1 -1
- package/dist/coordination/director/director-collab.d.ts.map +1 -1
- package/dist/coordination/director-tools.d.ts.map +1 -1
- package/dist/coordination/director.d.ts +10 -1
- package/dist/coordination/director.d.ts.map +1 -1
- package/dist/coordination/file-author-tracker.d.ts.map +1 -1
- package/dist/coordination/fleet-bus.d.ts.map +1 -1
- package/dist/coordination/fleet-event-validation.d.ts +0 -7
- package/dist/coordination/fleet-event-validation.d.ts.map +1 -1
- package/dist/coordination/fleet-spawn.d.ts.map +1 -1
- package/dist/coordination/fleet-supervisor.d.ts +1 -1
- package/dist/coordination/fleet-supervisor.d.ts.map +1 -1
- package/dist/coordination/fleet.d.ts +0 -44
- package/dist/coordination/fleet.d.ts.map +1 -1
- package/dist/coordination/global-mailbox.d.ts +7 -1
- package/dist/coordination/global-mailbox.d.ts.map +1 -1
- package/dist/coordination/index.d.ts +5 -3
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +2426 -299
- package/dist/coordination/index.js.map +4 -4
- package/dist/coordination/knowledge-graph.d.ts +2 -1
- package/dist/coordination/knowledge-graph.d.ts.map +1 -1
- package/dist/coordination/large-answer-store.d.ts +0 -6
- package/dist/coordination/large-answer-store.d.ts.map +1 -1
- package/dist/coordination/mail-tools.d.ts +2 -2
- package/dist/coordination/mail-tools.d.ts.map +1 -1
- package/dist/coordination/mailbox-hooks.d.ts +2 -0
- package/dist/coordination/mailbox-hooks.d.ts.map +1 -1
- package/dist/coordination/mailbox-http-router.d.ts +43 -0
- package/dist/coordination/mailbox-http-router.d.ts.map +1 -0
- package/dist/coordination/mailbox-message-codec.d.ts +35 -0
- package/dist/coordination/mailbox-message-codec.d.ts.map +1 -1
- package/dist/coordination/mailbox-tool.d.ts +1 -1
- package/dist/coordination/mailbox-tool.d.ts.map +1 -1
- package/dist/coordination/mailbox-types.d.ts +170 -10
- package/dist/coordination/mailbox-types.d.ts.map +1 -1
- package/dist/coordination/mailbox.d.ts +1 -1
- package/dist/coordination/mailbox.d.ts.map +1 -1
- package/dist/coordination/package-author-tracker.d.ts.map +1 -1
- package/dist/coordination/provider-status-tracker.d.ts +236 -0
- package/dist/coordination/provider-status-tracker.d.ts.map +1 -0
- package/dist/coordination/subagent-budget.d.ts +2 -1
- package/dist/coordination/subagent-budget.d.ts.map +1 -1
- package/dist/core/agent-loop.d.ts +8 -3
- package/dist/core/agent-loop.d.ts.map +1 -1
- package/dist/core/agent-response.d.ts +5 -4
- package/dist/core/agent-response.d.ts.map +1 -1
- package/dist/core/agent-tools.d.ts +1 -1
- package/dist/core/agent-tools.d.ts.map +1 -1
- package/dist/core/agent.d.ts +4 -2
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/context.d.ts +55 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/fallback-model.d.ts +14 -8
- package/dist/core/fallback-model.d.ts.map +1 -1
- package/dist/core/fallback-profile-manager.d.ts +118 -0
- package/dist/core/fallback-profile-manager.d.ts.map +1 -0
- package/dist/core/fleet-pulse.d.ts +2 -1
- package/dist/core/fleet-pulse.d.ts.map +1 -1
- package/dist/core/iteration-limit.d.ts +2 -1
- package/dist/core/iteration-limit.d.ts.map +1 -1
- package/dist/core/mailbox-loop.d.ts +16 -1
- package/dist/core/mailbox-loop.d.ts.map +1 -1
- package/dist/core/model-availability-calendar.d.ts +27 -0
- package/dist/core/model-availability-calendar.d.ts.map +1 -0
- package/dist/core/provider-runner.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +2 -1
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/defaults/index.js +1920 -598
- package/dist/defaults/index.js.map +4 -4
- package/dist/execution/auto-compaction-middleware.d.ts +3 -2
- package/dist/execution/auto-compaction-middleware.d.ts.map +1 -1
- package/dist/execution/compaction-core.d.ts.map +1 -1
- package/dist/execution/council-brain.d.ts +28 -49
- package/dist/execution/council-brain.d.ts.map +1 -1
- package/dist/execution/council-orchestrator.d.ts +30 -0
- package/dist/execution/council-orchestrator.d.ts.map +1 -1
- package/dist/execution/enhance-recovery.d.ts +8 -0
- package/dist/execution/enhance-recovery.d.ts.map +1 -1
- package/dist/execution/error-handler.d.ts +2 -2
- package/dist/execution/error-handler.d.ts.map +1 -1
- package/dist/execution/eternal-autonomy.d.ts.map +1 -1
- package/dist/execution/index.js +2600 -1903
- package/dist/execution/index.js.map +4 -4
- package/dist/execution/intelligent-compactor.d.ts +0 -16
- package/dist/execution/intelligent-compactor.d.ts.map +1 -1
- package/dist/execution/model-runtime.d.ts.map +1 -1
- package/dist/execution/one-shot-llm.d.ts +9 -1
- package/dist/execution/one-shot-llm.d.ts.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +36 -0
- package/dist/execution/prompt-enhancer.d.ts.map +1 -1
- package/dist/execution/prompt-enhancer.js +158 -10
- package/dist/execution/prompt-enhancer.js.map +2 -2
- package/dist/execution/retry-policy.d.ts +0 -13
- package/dist/execution/retry-policy.d.ts.map +1 -1
- package/dist/execution/skill-loader.d.ts.map +1 -1
- package/dist/execution/tool-executor.d.ts.map +1 -1
- package/dist/goal/checkpoint.d.ts.map +1 -0
- package/dist/{autophase/auto-phase-planner.d.ts → goal/goal-planner.d.ts} +8 -8
- package/dist/goal/goal-planner.d.ts.map +1 -0
- package/dist/{autophase/auto-phase-runner.d.ts → goal/goal-runner.d.ts} +10 -10
- package/dist/goal/goal-runner.d.ts.map +1 -0
- package/dist/{autophase → goal}/index.d.ts +3 -3
- package/dist/goal/index.d.ts.map +1 -0
- package/dist/goal/phase-graph-builder.d.ts.map +1 -0
- package/dist/{autophase → goal}/phase-orchestrator.d.ts +2 -2
- package/dist/goal/phase-orchestrator.d.ts.map +1 -0
- package/dist/goal/phase-store.d.ts.map +1 -0
- package/dist/{autophase → goal}/types.d.ts +2 -2
- package/dist/goal/types.d.ts.map +1 -0
- package/dist/hq/auth-store.d.ts.map +1 -1
- package/dist/hq/commands.d.ts +2 -1
- package/dist/hq/commands.d.ts.map +1 -1
- package/dist/hq/exposure.d.ts +66 -0
- package/dist/hq/exposure.d.ts.map +1 -0
- package/dist/hq/index.d.ts +1 -0
- package/dist/hq/index.d.ts.map +1 -1
- package/dist/hq/index.js +190 -21
- package/dist/hq/index.js.map +4 -4
- package/dist/hq/mailbox-mapper.d.ts +13 -1
- package/dist/hq/mailbox-mapper.d.ts.map +1 -1
- package/dist/hq/protocol/browser.d.ts +9 -1
- package/dist/hq/protocol/browser.d.ts.map +1 -1
- package/dist/hq/protocol/client.d.ts +2 -2
- package/dist/hq/protocol/client.d.ts.map +1 -1
- package/dist/hq/protocol/core.d.ts.map +1 -1
- package/dist/hq/protocol/mailbox.d.ts +6 -0
- package/dist/hq/protocol/mailbox.d.ts.map +1 -1
- package/dist/hq/protocol/session.d.ts +4 -0
- package/dist/hq/protocol/session.d.ts.map +1 -1
- package/dist/hq/publisher.d.ts.map +1 -1
- package/dist/index.d.ts +34 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30287 -22214
- package/dist/index.js.map +4 -4
- package/dist/infrastructure/index.js +60 -5
- package/dist/infrastructure/index.js.map +2 -2
- package/dist/kernel/events/agent-events.d.ts +33 -1
- package/dist/kernel/events/agent-events.d.ts.map +1 -1
- package/dist/kernel/events/file-events.d.ts +65 -0
- package/dist/kernel/events/file-events.d.ts.map +1 -0
- package/dist/kernel/events/memory-events.d.ts +36 -0
- package/dist/kernel/events/memory-events.d.ts.map +1 -1
- package/dist/kernel/events/network-events.d.ts +60 -0
- package/dist/kernel/events/network-events.d.ts.map +1 -0
- package/dist/kernel/events/process-events.d.ts +44 -0
- package/dist/kernel/events/process-events.d.ts.map +1 -0
- package/dist/kernel/events/provider-events.d.ts +89 -0
- package/dist/kernel/events/provider-events.d.ts.map +1 -1
- package/dist/kernel/events/tool-events.d.ts +10 -0
- package/dist/kernel/events/tool-events.d.ts.map +1 -1
- package/dist/kernel/events/worktree-events.d.ts +1 -1
- package/dist/kernel/events.d.ts +14 -1
- package/dist/kernel/events.d.ts.map +1 -1
- package/dist/kernel/index.js +2 -1
- package/dist/kernel/index.js.map +2 -2
- package/dist/kernel/tokens.d.ts +3 -1
- package/dist/kernel/tokens.d.ts.map +1 -1
- package/dist/mailbox-attach.d.ts.map +1 -1
- package/dist/models/index.js.map +2 -2
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +278 -0
- package/dist/observability/index.js.map +4 -4
- package/dist/observability/network-telemetry.d.ts +15 -0
- package/dist/observability/network-telemetry.d.ts.map +1 -0
- package/dist/observability/process-telemetry.d.ts +18 -0
- package/dist/observability/process-telemetry.d.ts.map +1 -0
- package/dist/observability/redact-command.d.ts +20 -0
- package/dist/observability/redact-command.d.ts.map +1 -0
- package/dist/plugins/auto-review-plugin.d.ts +56 -3
- package/dist/plugins/auto-review-plugin.d.ts.map +1 -1
- package/dist/plugins/chimera-plugin.d.ts +164 -5
- package/dist/plugins/chimera-plugin.d.ts.map +1 -1
- package/dist/plugins/review-context-builder.d.ts +52 -0
- package/dist/plugins/review-context-builder.d.ts.map +1 -0
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +186 -9
- package/dist/security/index.js.map +4 -4
- package/dist/security/kanban-boundary.d.ts +10 -0
- package/dist/security/kanban-boundary.d.ts.map +1 -0
- package/dist/security/permission-policy.d.ts +1 -0
- package/dist/security/permission-policy.d.ts.map +1 -1
- package/dist/session-registry.d.ts +80 -0
- package/dist/session-registry.d.ts.map +1 -1
- package/dist/skills/index.js.map +2 -2
- package/dist/storage/config-loader.d.ts +7 -0
- package/dist/storage/config-loader.d.ts.map +1 -1
- package/dist/storage/file-session-writer.d.ts +20 -7
- package/dist/storage/file-session-writer.d.ts.map +1 -1
- package/dist/storage/goal-coordination.d.ts +40 -0
- package/dist/storage/goal-coordination.d.ts.map +1 -0
- package/dist/storage/goal-store.d.ts +9 -5
- package/dist/storage/goal-store.d.ts.map +1 -1
- package/dist/storage/index.d.ts +4 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1066 -226
- package/dist/storage/index.js.map +4 -4
- package/dist/storage/memory-consolidator.d.ts +49 -4
- package/dist/storage/memory-consolidator.d.ts.map +1 -1
- package/dist/storage/memory-graph-backend.d.ts +11 -0
- package/dist/storage/memory-graph-backend.d.ts.map +1 -1
- package/dist/storage/provider-config-watcher.d.ts +19 -0
- package/dist/storage/provider-config-watcher.d.ts.map +1 -1
- package/dist/storage/session-event-bridge.d.ts +2 -2
- package/dist/storage/session-event-bridge.d.ts.map +1 -1
- package/dist/storage/session-resume-validation.d.ts +10 -0
- package/dist/storage/session-resume-validation.d.ts.map +1 -1
- package/dist/storage/session-rewind-apply.d.ts +53 -0
- package/dist/storage/session-rewind-apply.d.ts.map +1 -0
- package/dist/storage/session-rewinder.d.ts.map +1 -1
- package/dist/storage/session-store.d.ts.map +1 -1
- package/dist/tasking/index.js.map +1 -1
- package/dist/tasking/task-store.d.ts +1 -1
- package/dist/tools/council-tool.d.ts +3 -0
- package/dist/tools/council-tool.d.ts.map +1 -1
- package/dist/tools/fallback-manage-tools.d.ts +82 -0
- package/dist/tools/fallback-manage-tools.d.ts.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3423 -192
- package/dist/tools/index.js.map +4 -4
- package/dist/tools/one-shot-llm-tool.d.ts +2 -0
- package/dist/tools/one-shot-llm-tool.d.ts.map +1 -1
- package/dist/types/config.d.ts +76 -7
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/file-event-record.d.ts +68 -0
- package/dist/types/file-event-record.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +13 -8
- package/dist/types/index.js.map +3 -3
- package/dist/types/memory.d.ts +12 -0
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/types/multi-agent.d.ts +12 -1
- package/dist/types/multi-agent.d.ts.map +1 -1
- package/dist/types/one-shot-llm.d.ts +16 -7
- package/dist/types/one-shot-llm.d.ts.map +1 -1
- package/dist/types/provider.d.ts +1 -1
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/session.d.ts +68 -2
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/tool-executor.d.ts +2 -0
- package/dist/types/tool-executor.d.ts.map +1 -1
- package/dist/types/tool.d.ts +5 -0
- package/dist/types/tool.d.ts.map +1 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +497 -254
- package/dist/utils/index.js.map +4 -4
- package/dist/utils/message-invariants.d.ts +9 -0
- package/dist/utils/message-invariants.d.ts.map +1 -1
- package/dist/utils/safe-json.d.ts +1 -1
- package/dist/utils/safe-json.d.ts.map +1 -1
- package/dist/utils/term.d.ts +279 -0
- package/dist/utils/term.d.ts.map +1 -1
- package/dist/utils/tool-wire-compact.d.ts +9 -0
- package/dist/utils/tool-wire-compact.d.ts.map +1 -1
- package/dist/utils/wstack-paths.d.ts +12 -2
- package/dist/utils/wstack-paths.d.ts.map +1 -1
- package/dist/worktree/worktree-manager.d.ts +1 -1
- package/dist/worktree/worktree-manager.d.ts.map +1 -1
- package/instructions/agents/ios.md +113 -0
- package/instructions/agents/search.md +1 -1
- package/instructions/llm/chimera-review.md +66 -9
- package/instructions/llm/memory-consolidator.md +4 -12
- package/instructions/llm/prompt-enhancer.md +3 -1
- package/instructions/sections/tool/common-patterns.md +3 -3
- package/instructions/system.md +40 -5
- package/package.json +7 -3
- package/skills/auto-review/SKILL.md +176 -0
- package/skills/mnemosyne/SKILL.md +156 -0
- package/skills/mnemosyne/instructions/agent-prompt.md +200 -0
- package/dist/autophase/auto-phase-planner.d.ts.map +0 -1
- package/dist/autophase/auto-phase-runner.d.ts.map +0 -1
- package/dist/autophase/checkpoint.d.ts.map +0 -1
- package/dist/autophase/index.d.ts.map +0 -1
- package/dist/autophase/phase-graph-builder.d.ts.map +0 -1
- package/dist/autophase/phase-orchestrator.d.ts.map +0 -1
- package/dist/autophase/phase-store.d.ts.map +0 -1
- package/dist/autophase/types.d.ts.map +0 -1
- /package/dist/{autophase → goal}/checkpoint.d.ts +0 -0
- /package/dist/{autophase → goal}/phase-graph-builder.d.ts +0 -0
- /package/dist/{autophase → goal}/phase-store.d.ts +0 -0
- /package/instructions/{autophase → goal}/phase-planner.md +0 -0
|
@@ -11,6 +11,19 @@ interface ChimeraConfig {
|
|
|
11
11
|
* - `auto`: Spawn a fix subagent automatically with the review report.
|
|
12
12
|
*/
|
|
13
13
|
autoFix?: 'off' | 'ask' | 'auto' | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Cascade severity threshold for follow-up agents. When the post-session
|
|
16
|
+
* review finds findings at or above this level, security-scanner and/or
|
|
17
|
+
* bug-hunter agents are spawned to investigate and fix. Mirrors the
|
|
18
|
+
* auto-review plugin's cascadeOn. Default: "off" (no cascade).
|
|
19
|
+
*/
|
|
20
|
+
cascadeOn?: 'off' | 'critical' | 'high' | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum cascade fix→re-review cycles before the self-correcting loop
|
|
23
|
+
* stops. Default: 2. 0 disables re-review (fix agents run once, no
|
|
24
|
+
* re-check). Mirrors the auto-review plugin's maxCascadeDepth.
|
|
25
|
+
*/
|
|
26
|
+
maxCascadeDepth?: number | undefined;
|
|
14
27
|
/**
|
|
15
28
|
* @deprecated Removed. The subagent's `Request.maxTokens` now defaults to
|
|
16
29
|
* the provider's `capabilities.maxOutput`, so Chimera reports can run up
|
|
@@ -25,20 +38,166 @@ export interface ResolvedChimeraConfig {
|
|
|
25
38
|
model: string;
|
|
26
39
|
maxFiles: number;
|
|
27
40
|
autoFix: 'off' | 'ask' | 'auto';
|
|
41
|
+
cascadeOn: 'off' | 'critical' | 'high';
|
|
42
|
+
maxCascadeDepth: number;
|
|
28
43
|
}
|
|
29
44
|
export declare function resolveChimeraConfig(cfg: ChimeraConfig, sessionProvider: string, sessionModel: string): ResolvedChimeraConfig;
|
|
30
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A single changed file with its content and, for modified files, a
|
|
47
|
+
* unified diff against HEAD so the reviewer can focus on what changed.
|
|
48
|
+
*/
|
|
49
|
+
export interface ReviewFileEntry {
|
|
50
|
+
path: string;
|
|
51
|
+
status: 'added' | 'modified';
|
|
52
|
+
content: string;
|
|
53
|
+
/**
|
|
54
|
+
* Unified diff against HEAD for modified files.
|
|
55
|
+
* For added files, this is undefined (content is the full file).
|
|
56
|
+
* Capped at a reasonable size to avoid bloating the subagent task.
|
|
57
|
+
*/
|
|
58
|
+
diff?: string | undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Context bundle that enriches a review beyond "here are N files."
|
|
62
|
+
* Collects the *story*: what task motivated the change, what else
|
|
63
|
+
* changed alongside it, and what the recent commit history looks like.
|
|
64
|
+
*
|
|
65
|
+
* The review subagent receives this so it can:
|
|
66
|
+
* - Focus on the diff (what changed) rather than re-reviewing unchanged code
|
|
67
|
+
* - Understand the task intent (todos, narrative) to judge correctness
|
|
68
|
+
* - See sibling changes for cross-file consistency
|
|
69
|
+
* - Avoid re-reporting known issues (commit history context)
|
|
70
|
+
*/
|
|
71
|
+
export interface ReviewContextBundle {
|
|
31
72
|
/** Resolved chimera config */
|
|
32
73
|
config: ResolvedChimeraConfig;
|
|
33
74
|
/** Project root for git operations */
|
|
34
75
|
cwd: string;
|
|
35
|
-
/** Changed files with their contents */
|
|
36
|
-
files:
|
|
76
|
+
/** Changed files with their contents and diffs */
|
|
77
|
+
files: ReviewFileEntry[];
|
|
78
|
+
/**
|
|
79
|
+
* Auto-review-specific fallback chain, already resolved to provider/model refs.
|
|
80
|
+
* Absent for ordinary Chimera and manual review triggers.
|
|
81
|
+
*/
|
|
82
|
+
reviewFallbackModels?: string[] | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Cascade severity threshold from the auto-review plugin config.
|
|
85
|
+
* When the review subagent finds findings at or above this level, a
|
|
86
|
+
* follow-up agent (security-scanner, bug-hunter) is spawned to
|
|
87
|
+
* investigate. Set by the auto-review plugin when it builds the
|
|
88
|
+
* bundle; absent for chimera-plugin and /review triggers (no cascade).
|
|
89
|
+
*
|
|
90
|
+
* `'off'` disables cascading; `'high'` cascades on High+; `'critical'`
|
|
91
|
+
* cascades only on Critical.
|
|
92
|
+
*/
|
|
93
|
+
cascadeOn?: 'off' | 'critical' | 'high' | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Current cascade iteration depth (0 for the initial review, 1 after
|
|
96
|
+
* the first fix+re-review cycle, etc.). The cascade handler increments
|
|
97
|
+
* this on each re-review emission and stops when it reaches
|
|
98
|
+
* `maxCascadeDepth`. Absent (treated as 0) for non-cascade triggers.
|
|
99
|
+
*/
|
|
100
|
+
cascadeDepth?: number | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Maximum cascade iterations before the self-correcting loop stops.
|
|
103
|
+
* Prevents infinite fix → re-review → fix cycles. Default 2. Set by
|
|
104
|
+
* the auto-review plugin; absent for non-cascade triggers.
|
|
105
|
+
*/
|
|
106
|
+
maxCascadeDepth?: number | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* All files changed in the working tree, including ones not in the
|
|
109
|
+
* current review batch. Lets the reviewer understand the broader
|
|
110
|
+
* change set without expanding its review scope.
|
|
111
|
+
*/
|
|
112
|
+
allChangedFiles?: Array<{
|
|
37
113
|
path: string;
|
|
38
|
-
status:
|
|
114
|
+
status: string;
|
|
115
|
+
}> | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Recent commit messages (oneline), newest first.
|
|
118
|
+
* Helps the reviewer understand what was already committed vs.
|
|
119
|
+
* what's still uncommitted working-tree changes.
|
|
120
|
+
*/
|
|
121
|
+
recentCommits?: string[] | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Active todo items from the session Context at review-trigger time.
|
|
124
|
+
* Lets the reviewer understand what task motivated the file changes
|
|
125
|
+
* so it can judge correctness against intent, not just code shape.
|
|
126
|
+
*/
|
|
127
|
+
activeTodos?: Array<{
|
|
128
|
+
id: string;
|
|
39
129
|
content: string;
|
|
40
|
-
|
|
130
|
+
status: string;
|
|
131
|
+
}> | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The active kanban card, if the session uses a kanban board.
|
|
134
|
+
* Provides title, description, and success criteria so the
|
|
135
|
+
* reviewer can verify the change satisfies the stated requirements.
|
|
136
|
+
*/
|
|
137
|
+
kanbanCard?: {
|
|
138
|
+
id: string;
|
|
139
|
+
title: string;
|
|
140
|
+
description?: string | undefined;
|
|
141
|
+
successCriteria?: string[] | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* File provenance from the Chronicle journal: which agent/session/task
|
|
145
|
+
* last touched each file and when. Helps the reviewer attribute
|
|
146
|
+
* changes and understand the broader edit chain.
|
|
147
|
+
*/
|
|
148
|
+
fileProvenance?: Array<{
|
|
149
|
+
path: string;
|
|
150
|
+
agentId?: string | undefined;
|
|
151
|
+
taskId?: string | undefined;
|
|
152
|
+
eventType?: string | undefined;
|
|
153
|
+
observedAt?: string | undefined;
|
|
154
|
+
}> | undefined;
|
|
155
|
+
}
|
|
156
|
+
/** Legacy alias — the payload type is the bundle type. */
|
|
157
|
+
export type ChimeraReviewNeededPayload = ReviewContextBundle;
|
|
158
|
+
/**
|
|
159
|
+
* Payload emitted as `chimera.review_complete` after the review subagent
|
|
160
|
+
* finishes (success or failure). Consumed by the auto-review plugin's
|
|
161
|
+
* cascade listener to parse severity and decide whether to emit
|
|
162
|
+
* `chimera.cascade_needed`.
|
|
163
|
+
*/
|
|
164
|
+
export interface ChimeraReviewCompletePayload {
|
|
165
|
+
/** The original review context bundle that triggered this review. */
|
|
166
|
+
bundle: ReviewContextBundle;
|
|
167
|
+
/** The review report text the subagent produced (empty on failure). */
|
|
168
|
+
reviewText: string;
|
|
169
|
+
/** Whether the subagent succeeded (`'success'`) or failed otherwise. */
|
|
170
|
+
status: string;
|
|
171
|
+
/** Project root. */
|
|
172
|
+
cwd: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Payload emitted as `chimera.cascade_needed` when a review report
|
|
176
|
+
* contains findings at or above the configured `cascadeOn` threshold.
|
|
177
|
+
* Consumed by execution.ts to spawn follow-up investigation agents.
|
|
178
|
+
*/
|
|
179
|
+
export interface ChimeraCascadeNeededPayload {
|
|
180
|
+
/** The original review context bundle (carries cwd + files). */
|
|
181
|
+
bundle: ReviewContextBundle;
|
|
182
|
+
/** The review report text that triggered the cascade. */
|
|
183
|
+
reviewText: string;
|
|
184
|
+
/** The parsed severity counts that crossed the threshold. */
|
|
185
|
+
severities: {
|
|
186
|
+
critical: number;
|
|
187
|
+
high: number;
|
|
188
|
+
medium: number;
|
|
189
|
+
};
|
|
190
|
+
/** The threshold that was crossed (`'high'` or `'critical'`). */
|
|
191
|
+
threshold: 'high' | 'critical';
|
|
192
|
+
/** Follow-up agent roles to spawn, derived from the finding types. */
|
|
193
|
+
agents: CascadeAgentKind[];
|
|
41
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Follow-up cascade agent kinds. Each maps to a roster role and a
|
|
197
|
+
* tailored task description. Multiple may be spawned in parallel when
|
|
198
|
+
* a review surfaces both security and correctness concerns.
|
|
199
|
+
*/
|
|
200
|
+
export type CascadeAgentKind = 'security-scanner' | 'bug-hunter';
|
|
42
201
|
export declare const CHIMERA_REVIEW_PROMPT: string;
|
|
43
202
|
export declare function createChimeraPlugin(): Plugin;
|
|
44
203
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chimera-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/chimera-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"chimera-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/chimera-plugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReviewContextBundle, ResolvedChimeraConfig } from './chimera-plugin.js';
|
|
2
|
+
export interface BuildReviewContextOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
config: ResolvedChimeraConfig;
|
|
5
|
+
/** Files to review, with content already read. */
|
|
6
|
+
files: Array<{
|
|
7
|
+
path: string;
|
|
8
|
+
status: 'added' | 'modified';
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Active todo items from the session Context (P1 enrichment).
|
|
13
|
+
* Available from `ctx.todos` in the iteration.completed handler.
|
|
14
|
+
* Passed in by the caller — the builder itself has no ctx access.
|
|
15
|
+
*/
|
|
16
|
+
activeTodos?: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
content: string;
|
|
19
|
+
status: string;
|
|
20
|
+
}> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Cascade severity threshold from the auto-review plugin config.
|
|
23
|
+
* Threaded into the bundle so execution.ts and the cascade listener
|
|
24
|
+
* can decide whether findings warrant a follow-up agent. Absent for
|
|
25
|
+
* non-auto-review triggers (chimera plugin, /review slash command).
|
|
26
|
+
*/
|
|
27
|
+
cascadeOn?: 'off' | 'critical' | 'high' | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Current cascade depth (0 = initial review). Increments on each
|
|
30
|
+
* fix+re-review cycle; the cascade stops at maxCascadeDepth.
|
|
31
|
+
*/
|
|
32
|
+
cascadeDepth?: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum cascade iterations before the self-correcting loop stops.
|
|
35
|
+
* Default 2. Absent for non-auto-review triggers.
|
|
36
|
+
*/
|
|
37
|
+
maxCascadeDepth?: number | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Enrich a bare file list with diffs, sibling-change awareness, and
|
|
41
|
+
* recent commit history — the minimal "story" a reviewer needs to
|
|
42
|
+
* judge changes in context rather than in isolation.
|
|
43
|
+
*
|
|
44
|
+
* This is the P0 subset: diffs + siblings + commits.
|
|
45
|
+
* Future additions: todos, kanban card, prompt chain, prior findings.
|
|
46
|
+
*
|
|
47
|
+
* The function never throws — all enrichment is best-effort. If a git
|
|
48
|
+
* operation fails, the corresponding field is simply left `undefined`,
|
|
49
|
+
* and the caller still gets a valid bundle with the original file data.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildReviewContext(opts: BuildReviewContextOptions): Promise<ReviewContextBundle>;
|
|
52
|
+
//# sourceMappingURL=review-context-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-context-builder.d.ts","sourceRoot":"","sources":["../../src/plugins/review-context-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAmB,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAqGvG,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,qBAAqB,CAAC;IAC9B,kDAAkD;IAClD,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IACjF;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CA+E9B"}
|
package/dist/security/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { decryptConfigSecrets, encryptConfigSecrets, isSecretField } from './con
|
|
|
4
4
|
export { DefaultPermissionPolicy, AutoApprovePermissionPolicy, type PermissionPolicyOptions, } from './permission-policy.js';
|
|
5
5
|
export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './permission-policy-schema.js';
|
|
6
6
|
export { ToolCapabilities, DANGEROUS_FOR_SUBAGENTS, type ToolCapability, hasDangerousCapabilityForSubagents, hasCapability, getDangerousCapabilities, } from './capabilities.js';
|
|
7
|
+
export { evaluateToolKanbanBoundary, type ToolKanbanBoundaryEvaluation, } from './kanban-boundary.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,cAAc,EACnB,kCAAkC,EAClC,aAAa,EACb,wBAAwB,GACzB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,cAAc,EACnB,kCAAkC,EAClC,aAAa,EACb,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,0BAA0B,EAC1B,KAAK,4BAA4B,GAClC,MAAM,sBAAsB,CAAC"}
|
package/dist/security/index.js
CHANGED
|
@@ -264,7 +264,7 @@ async function renameWithRetry(from, to) {
|
|
|
264
264
|
if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {
|
|
265
265
|
throw err;
|
|
266
266
|
}
|
|
267
|
-
await new Promise((
|
|
267
|
+
await new Promise((resolve2) => setTimeout(resolve2, delays[i]));
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
throw lastErr;
|
|
@@ -428,7 +428,7 @@ function matchAny(patterns, input) {
|
|
|
428
428
|
|
|
429
429
|
// src/utils/safe-json.ts
|
|
430
430
|
function safeParse(input, maxBytes = 5e6) {
|
|
431
|
-
if (input
|
|
431
|
+
if (Buffer.byteLength(input, "utf8") > maxBytes) {
|
|
432
432
|
return { ok: false, error: `Input exceeds limit (${maxBytes} bytes)` };
|
|
433
433
|
}
|
|
434
434
|
try {
|
|
@@ -1265,19 +1265,19 @@ var UNSAFE_PROPERTY_NAMES = /* @__PURE__ */ new Set(["__proto__", "prototype", "
|
|
|
1265
1265
|
function isRecord(value) {
|
|
1266
1266
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1267
1267
|
}
|
|
1268
|
-
function error(diagnostics, code,
|
|
1269
|
-
diagnostics.push({ severity: "error", code, path:
|
|
1268
|
+
function error(diagnostics, code, path4, message) {
|
|
1269
|
+
diagnostics.push({ severity: "error", code, path: path4, message });
|
|
1270
1270
|
}
|
|
1271
|
-
function validatePatterns(value,
|
|
1271
|
+
function validatePatterns(value, path4, diagnostics) {
|
|
1272
1272
|
if (!Array.isArray(value)) {
|
|
1273
|
-
error(diagnostics, "invalid_pattern_list",
|
|
1273
|
+
error(diagnostics, "invalid_pattern_list", path4, "must be an array of strings");
|
|
1274
1274
|
return void 0;
|
|
1275
1275
|
}
|
|
1276
1276
|
if (value.length > TRUST_POLICY_LIMITS.maxPatternsPerRule) {
|
|
1277
1277
|
error(
|
|
1278
1278
|
diagnostics,
|
|
1279
1279
|
"too_many_patterns",
|
|
1280
|
-
|
|
1280
|
+
path4,
|
|
1281
1281
|
`must contain at most ${TRUST_POLICY_LIMITS.maxPatternsPerRule} patterns`
|
|
1282
1282
|
);
|
|
1283
1283
|
return void 0;
|
|
@@ -1285,7 +1285,7 @@ function validatePatterns(value, path3, diagnostics) {
|
|
|
1285
1285
|
const patterns = [];
|
|
1286
1286
|
const seen = /* @__PURE__ */ new Set();
|
|
1287
1287
|
for (const [index, pattern] of value.entries()) {
|
|
1288
|
-
const itemPath = `${
|
|
1288
|
+
const itemPath = `${path4}[${index}]`;
|
|
1289
1289
|
if (typeof pattern !== "string" || pattern.length === 0 || pattern.length > TRUST_POLICY_LIMITS.maxPatternChars) {
|
|
1290
1290
|
error(
|
|
1291
1291
|
diagnostics,
|
|
@@ -1397,8 +1397,8 @@ var LruCache = class {
|
|
|
1397
1397
|
this.capacity = capacity;
|
|
1398
1398
|
}
|
|
1399
1399
|
get(key) {
|
|
1400
|
+
if (!this.store.has(key)) return void 0;
|
|
1400
1401
|
const value = this.store.get(key);
|
|
1401
|
-
if (value === void 0) return void 0;
|
|
1402
1402
|
this.store.delete(key);
|
|
1403
1403
|
this.store.set(key, value);
|
|
1404
1404
|
return value;
|
|
@@ -1655,9 +1655,21 @@ var DefaultPermissionPolicy = class {
|
|
|
1655
1655
|
this._evalCache.clear();
|
|
1656
1656
|
this.loaded = true;
|
|
1657
1657
|
}
|
|
1658
|
+
_logDeny(tool, subject, reason) {
|
|
1659
|
+
console.warn(JSON.stringify({
|
|
1660
|
+
level: "warn",
|
|
1661
|
+
event: "permission.denied",
|
|
1662
|
+
message: `Permission denied: ${tool}${subject ? ` (subject: ${subject})` : ""} \u2014 ${reason}`,
|
|
1663
|
+
tool,
|
|
1664
|
+
subject,
|
|
1665
|
+
reason,
|
|
1666
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1667
|
+
}));
|
|
1668
|
+
}
|
|
1658
1669
|
async evaluate(tool, input, ctx) {
|
|
1659
1670
|
if (!this.loaded) await this.reload();
|
|
1660
1671
|
if (this.policyInvalid) {
|
|
1672
|
+
this._logDeny(tool.name, void 0, "trust policy is invalid");
|
|
1661
1673
|
return {
|
|
1662
1674
|
permission: "deny",
|
|
1663
1675
|
source: "deny",
|
|
@@ -1673,6 +1685,7 @@ var DefaultPermissionPolicy = class {
|
|
|
1673
1685
|
if (cached !== void 0) return cached;
|
|
1674
1686
|
}
|
|
1675
1687
|
if (this.sessionDenied.has(cacheKey)) {
|
|
1688
|
+
this._logDeny(tool.name, subject, "session soft deny (user pressed no)");
|
|
1676
1689
|
const decision = { permission: "deny", source: "deny", reason: "session soft deny (user pressed no)" };
|
|
1677
1690
|
this._evalCache.set(cacheKey, decision);
|
|
1678
1691
|
return decision;
|
|
@@ -1687,11 +1700,13 @@ var DefaultPermissionPolicy = class {
|
|
|
1687
1700
|
return decision;
|
|
1688
1701
|
}
|
|
1689
1702
|
if (entry?.deny && subject && matchesTrust(entry.deny, subject)) {
|
|
1703
|
+
this._logDeny(tool.name, subject, "matched deny pattern");
|
|
1690
1704
|
const decision = { permission: "deny", source: "deny", reason: "matched deny pattern" };
|
|
1691
1705
|
this._evalCache.set(cacheKey, decision);
|
|
1692
1706
|
return decision;
|
|
1693
1707
|
}
|
|
1694
1708
|
if (tool.permission === "deny") {
|
|
1709
|
+
this._logDeny(tool.name, subject, "tool default deny");
|
|
1695
1710
|
const decision = { permission: "deny", source: "default", reason: "tool default deny" };
|
|
1696
1711
|
this._evalCache.set(cacheKey, decision);
|
|
1697
1712
|
return decision;
|
|
@@ -1719,6 +1734,7 @@ var DefaultPermissionPolicy = class {
|
|
|
1719
1734
|
}
|
|
1720
1735
|
if (userDecision === "deny") {
|
|
1721
1736
|
await this.deny({ tool: tool.name, pattern: subject ?? tool.name });
|
|
1737
|
+
this._logDeny(tool.name, subject, "user denied sensitive read");
|
|
1722
1738
|
return { permission: "deny", source: "user", reason: "user denied sensitive read" };
|
|
1723
1739
|
}
|
|
1724
1740
|
return {
|
|
@@ -1771,6 +1787,7 @@ var DefaultPermissionPolicy = class {
|
|
|
1771
1787
|
}
|
|
1772
1788
|
if (decision === "deny") {
|
|
1773
1789
|
await this.deny({ tool: tool.name, pattern: subject ?? tool.name });
|
|
1790
|
+
this._logDeny(tool.name, subject, "user denied");
|
|
1774
1791
|
return { permission: "deny", source: "user", reason: "user denied" };
|
|
1775
1792
|
}
|
|
1776
1793
|
return { permission: decision === "yes" ? "auto" : "deny", source: "user" };
|
|
@@ -1890,6 +1907,165 @@ var AutoApprovePermissionPolicy = class _AutoApprovePermissionPolicy {
|
|
|
1890
1907
|
async reload() {
|
|
1891
1908
|
}
|
|
1892
1909
|
};
|
|
1910
|
+
|
|
1911
|
+
// src/security/kanban-boundary.ts
|
|
1912
|
+
import { realpath } from "node:fs/promises";
|
|
1913
|
+
import * as path3 from "node:path";
|
|
1914
|
+
import {
|
|
1915
|
+
evaluateKanbanBoundaryOpaque,
|
|
1916
|
+
evaluateKanbanBoundaryPath,
|
|
1917
|
+
readBoard,
|
|
1918
|
+
resolveKanbanBoundaryLayers
|
|
1919
|
+
} from "@wrongstack/kanban";
|
|
1920
|
+
var PATH_KEYS = /* @__PURE__ */ new Set([
|
|
1921
|
+
"path",
|
|
1922
|
+
"paths",
|
|
1923
|
+
"file",
|
|
1924
|
+
"files",
|
|
1925
|
+
"directory",
|
|
1926
|
+
"dir",
|
|
1927
|
+
"cwd",
|
|
1928
|
+
"root",
|
|
1929
|
+
"baseDir",
|
|
1930
|
+
"out",
|
|
1931
|
+
"outputPath",
|
|
1932
|
+
"sourcePath",
|
|
1933
|
+
"targetPath",
|
|
1934
|
+
"destinationPath",
|
|
1935
|
+
"fromPath",
|
|
1936
|
+
"toPath",
|
|
1937
|
+
"worktreePath"
|
|
1938
|
+
]);
|
|
1939
|
+
var TOOL_PATH_KEYS = {
|
|
1940
|
+
// `target` is an identifier in tools such as plan/task/document, but a
|
|
1941
|
+
// filesystem target in language_info. Keep ambiguous names tool-specific.
|
|
1942
|
+
language_info: ["target"]
|
|
1943
|
+
};
|
|
1944
|
+
async function evaluateToolKanbanBoundary(tool, input, ctx) {
|
|
1945
|
+
const identity = resolveKanbanIdentity(ctx);
|
|
1946
|
+
if (!identity.boardId) return { decision: "allow" };
|
|
1947
|
+
const board = await readBoard(identity.policyRoot ?? ctx.projectRoot, identity.boardId);
|
|
1948
|
+
if (!board) return { decision: "allow" };
|
|
1949
|
+
const task = identity.taskId ? board.tasks.find((candidate) => candidate.id === identity.taskId) : void 0;
|
|
1950
|
+
const layers = resolveKanbanBoundaryLayers(board, task);
|
|
1951
|
+
if (layers.length === 0) return { decision: "allow" };
|
|
1952
|
+
const caps = tool.capabilities ?? [];
|
|
1953
|
+
const access2 = caps.includes("fs.write") || caps.includes("fs.write.outside-project") ? "write" : caps.includes("fs.read") ? "read" : void 0;
|
|
1954
|
+
const shellLike = caps.some((capability) => capability.startsWith("shell."));
|
|
1955
|
+
const candidates = access2 ? await extractCandidatePaths(tool.name, input, ctx) : [];
|
|
1956
|
+
let evaluation;
|
|
1957
|
+
if (shellLike || access2 && candidates.length === 0) {
|
|
1958
|
+
evaluation = evaluateKanbanBoundaryOpaque(layers, tool.name);
|
|
1959
|
+
} else if (access2) {
|
|
1960
|
+
const results = candidates.map(
|
|
1961
|
+
(candidate) => evaluateKanbanBoundaryPath(layers, candidate, access2)
|
|
1962
|
+
);
|
|
1963
|
+
evaluation = results.find((result) => result.decision === "block") ?? results.find((result) => result.decision === "confirm") ?? { decision: "allow" };
|
|
1964
|
+
} else {
|
|
1965
|
+
evaluation = { decision: "allow" };
|
|
1966
|
+
}
|
|
1967
|
+
return {
|
|
1968
|
+
...evaluation,
|
|
1969
|
+
boardId: board.id,
|
|
1970
|
+
...task ? { taskId: task.id } : {}
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
function resolveKanbanIdentity(ctx) {
|
|
1974
|
+
const metaKanban = ctx.meta["kanban"];
|
|
1975
|
+
const record = metaKanban && typeof metaKanban === "object" ? metaKanban : void 0;
|
|
1976
|
+
const boardId = ctx.currentKanbanBoardId ?? (typeof record?.["boardId"] === "string" ? record["boardId"] : void 0);
|
|
1977
|
+
const taskId = ctx.currentKanbanTaskId ?? (typeof record?.["taskId"] === "string" ? record["taskId"] : void 0);
|
|
1978
|
+
const policyRoot = typeof record?.["projectRoot"] === "string" ? record["projectRoot"] : void 0;
|
|
1979
|
+
return {
|
|
1980
|
+
...boardId ? { boardId } : {},
|
|
1981
|
+
...taskId ? { taskId } : {},
|
|
1982
|
+
...policyRoot ? { policyRoot } : {}
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
async function extractCandidatePaths(toolName, input, ctx) {
|
|
1986
|
+
if (toolName === "patch" && typeof input["patch"] === "string") {
|
|
1987
|
+
const directoryInput = stringValue(input["directory"]) ?? ctx.workingDir;
|
|
1988
|
+
const directory = path3.isAbsolute(directoryInput) ? directoryInput : path3.resolve(ctx.workingDir, directoryInput);
|
|
1989
|
+
const strip = Math.max(1, numericValue(input["strip"]) ?? 1);
|
|
1990
|
+
const targets = extractPatchTargets(input["patch"], strip).map(
|
|
1991
|
+
(target) => relativeToProject(path3.resolve(directory, target), ctx.projectRoot)
|
|
1992
|
+
);
|
|
1993
|
+
return Promise.all(targets.map((target) => canonicalizeCandidatePath(target, ctx)));
|
|
1994
|
+
}
|
|
1995
|
+
const values = [];
|
|
1996
|
+
const pathKeys = new Set(PATH_KEYS);
|
|
1997
|
+
for (const key of TOOL_PATH_KEYS[toolName] ?? []) pathKeys.add(key);
|
|
1998
|
+
collectPathValues(input, values, pathKeys);
|
|
1999
|
+
if (toolName === "scaffold" && typeof input["name"] === "string") {
|
|
2000
|
+
const cwd = stringValue(input["cwd"]) ?? ctx.workingDir;
|
|
2001
|
+
values.push(path3.join(cwd, input["name"]));
|
|
2002
|
+
}
|
|
2003
|
+
const candidates = [
|
|
2004
|
+
...new Set(values.flatMap(splitPathList).map((value) => resolveInputPath(value, ctx)))
|
|
2005
|
+
];
|
|
2006
|
+
return Promise.all(candidates.map((candidate) => canonicalizeCandidatePath(candidate, ctx)));
|
|
2007
|
+
}
|
|
2008
|
+
async function canonicalizeCandidatePath(candidate, ctx) {
|
|
2009
|
+
if (path3.isAbsolute(candidate)) return candidate;
|
|
2010
|
+
const absolute = path3.resolve(ctx.projectRoot, candidate);
|
|
2011
|
+
const canonicalRoot = await realpath(ctx.projectRoot).catch(() => ctx.projectRoot);
|
|
2012
|
+
let probe = absolute;
|
|
2013
|
+
const missingSegments = [];
|
|
2014
|
+
while (true) {
|
|
2015
|
+
try {
|
|
2016
|
+
const canonical = path3.join(await realpath(probe), ...missingSegments);
|
|
2017
|
+
return relativeToProject(canonical, canonicalRoot);
|
|
2018
|
+
} catch (cause) {
|
|
2019
|
+
const code = cause.code;
|
|
2020
|
+
if (code !== "ENOENT" && code !== "ENOTDIR") return absolute;
|
|
2021
|
+
const parent = path3.dirname(probe);
|
|
2022
|
+
if (parent === probe) return absolute;
|
|
2023
|
+
missingSegments.unshift(path3.basename(probe));
|
|
2024
|
+
probe = parent;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
function collectPathValues(value, output, pathKeys, key) {
|
|
2029
|
+
if (typeof value === "string") {
|
|
2030
|
+
if (key && pathKeys.has(key)) output.push(value);
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
2033
|
+
if (Array.isArray(value)) {
|
|
2034
|
+
for (const item of value) collectPathValues(item, output, pathKeys, key);
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
if (!value || typeof value !== "object") return;
|
|
2038
|
+
for (const [childKey, child] of Object.entries(value)) {
|
|
2039
|
+
collectPathValues(child, output, pathKeys, childKey);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
function splitPathList(value) {
|
|
2043
|
+
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
2044
|
+
}
|
|
2045
|
+
function resolveInputPath(value, ctx) {
|
|
2046
|
+
const absolute = path3.isAbsolute(value) ? value : path3.resolve(ctx.workingDir, value);
|
|
2047
|
+
return relativeToProject(absolute, ctx.projectRoot);
|
|
2048
|
+
}
|
|
2049
|
+
function relativeToProject(absolute, projectRoot) {
|
|
2050
|
+
const relative2 = path3.relative(projectRoot, absolute).replace(/\\/g, "/");
|
|
2051
|
+
return relative2.startsWith("../") || path3.isAbsolute(relative2) ? absolute : relative2 || ".";
|
|
2052
|
+
}
|
|
2053
|
+
function extractPatchTargets(patchText, strip) {
|
|
2054
|
+
const targets = [];
|
|
2055
|
+
for (const match of patchText.matchAll(/^\+\+\+\s+([^\t\r\n]+)/gm)) {
|
|
2056
|
+
const raw = match[1]?.trim();
|
|
2057
|
+
if (!raw || raw === "/dev/null") continue;
|
|
2058
|
+
const parts = raw.replace(/\\/g, "/").split("/").filter((part) => part && part !== ".");
|
|
2059
|
+
if (parts.length > strip) targets.push(parts.slice(strip).join("/"));
|
|
2060
|
+
}
|
|
2061
|
+
return targets;
|
|
2062
|
+
}
|
|
2063
|
+
function stringValue(value) {
|
|
2064
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
2065
|
+
}
|
|
2066
|
+
function numericValue(value) {
|
|
2067
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
2068
|
+
}
|
|
1893
2069
|
export {
|
|
1894
2070
|
AutoApprovePermissionPolicy,
|
|
1895
2071
|
DANGEROUS_FOR_SUBAGENTS,
|
|
@@ -1902,6 +2078,7 @@ export {
|
|
|
1902
2078
|
ToolCapabilities,
|
|
1903
2079
|
decryptConfigSecrets,
|
|
1904
2080
|
encryptConfigSecrets,
|
|
2081
|
+
evaluateToolKanbanBoundary,
|
|
1905
2082
|
getDangerousCapabilities,
|
|
1906
2083
|
hasCapability,
|
|
1907
2084
|
hasDangerousCapabilityForSubagents,
|