@wrongstack/core 0.306.3 → 0.307.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/chronicle/index.js +957 -953
- package/dist/chronicle/metrics-ingest.d.ts +55 -0
- package/dist/chronicle/metrics-schema.d.ts +86 -0
- package/dist/chronicle/metrics-store.d.ts +5 -120
- package/dist/chronicle/project-server.js +1083 -1084
- package/dist/chronicle/sqlite-journal-quota.d.ts +39 -0
- package/dist/chronicle/sqlite-journal-schema.d.ts +25 -0
- package/dist/chronicle/sqlite-journal.d.ts +12 -177
- package/dist/coordination/agents/index.js +1738 -1690
- package/dist/coordination/agents/project-agent-capture.d.ts +48 -0
- package/dist/coordination/agents/project-agent-identity.d.ts +3 -129
- package/dist/coordination/agents/project-agent-roster.d.ts +17 -0
- package/dist/coordination/index.js +6103 -5890
- package/dist/coordination/mailbox-http-actor-query.d.ts +16 -0
- package/dist/coordination/mailbox-http-router.d.ts +0 -48
- package/dist/coordination/mailbox-http-sse.d.ts +12 -0
- package/dist/coordination/mailbox-message-types.d.ts +71 -0
- package/dist/coordination/mailbox-predicates.d.ts +13 -0
- package/dist/coordination/mailbox-project-server.js +1 -1
- package/dist/coordination/mailbox-session-sync.d.ts +8 -0
- package/dist/coordination/mailbox-types.d.ts +6 -793
- package/dist/core/agent-loop-context.d.ts +28 -0
- package/dist/core/agent-loop-detector.d.ts +25 -0
- package/dist/core/conversation-state.d.ts +1 -2
- package/dist/core/fallback-doctor.d.ts +72 -0
- package/dist/core/fallback-model.d.ts +19 -1
- package/dist/core/fallback-profile-manager.d.ts +21 -3
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1143 -766
- package/dist/defaults/index.js +3833 -3595
- package/dist/execution/auto-compaction-middleware.d.ts +64 -0
- package/dist/execution/autonomy-brain-llm.d.ts +55 -0
- package/dist/execution/autonomy-brain.d.ts +3 -156
- package/dist/execution/compaction-budget.d.ts +38 -0
- package/dist/execution/compaction-core.d.ts +3 -166
- package/dist/execution/compaction-elision.d.ts +58 -0
- package/dist/execution/council-orchestrator-helpers.d.ts +39 -0
- package/dist/execution/council-orchestrator.d.ts +3 -42
- package/dist/execution/council-response-parser.d.ts +56 -0
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.js +10016 -9903
- package/dist/execution/prompt-enhancer.js +11 -3
- package/dist/execution/retry-policy.d.ts +27 -0
- package/dist/execution/tool-executor-guard.d.ts +18 -0
- package/dist/execution/tool-executor-runner.d.ts +12 -0
- package/dist/execution/tool-executor.d.ts +0 -75
- package/dist/goal/index.js +19 -6
- package/dist/hq/index.js +58 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8731 -7756
- package/dist/infrastructure/index.js +24 -1
- package/dist/kernel/events/agent-events.d.ts +2 -0
- package/dist/kernel/events/provider-events.d.ts +13 -0
- package/dist/plugin/index.js +2123 -1918
- package/dist/plugins/auto-review-config.d.ts +53 -0
- package/dist/plugins/auto-review-git.d.ts +19 -0
- package/dist/plugins/auto-review-plugin.d.ts +2 -140
- package/dist/plugins/review-finding-verification.d.ts +7 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/prompt-journal.d.ts +94 -0
- package/dist/security/index.js +677 -667
- package/dist/security/permission-explain.d.ts +19 -0
- package/dist/security/permission-policy.d.ts +0 -101
- package/dist/security/yolo-risk.d.ts +5 -4
- package/dist/session-catalog/index.js +270 -227
- package/dist/session-catalog/project-server.js +277 -234
- package/dist/session-catalog/store-rebuild.d.ts +9 -0
- package/dist/session-catalog/store-schema.d.ts +48 -0
- package/dist/session-catalog/store.d.ts +0 -17
- package/dist/storage/cloud-config-sync/sanitize.d.ts +18 -0
- package/dist/storage/cloud-config-sync.d.ts +1 -1
- package/dist/storage/director-state.d.ts +6 -0
- package/dist/storage/file-session-writer.d.ts +2 -58
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2121 -1736
- package/dist/storage/orphan-lock-cleaner.d.ts +15 -0
- package/dist/storage/provider-config-watcher.d.ts +9 -0
- package/dist/storage/session-recovery.d.ts +9 -0
- package/dist/storage/session-store/rename-session.d.ts +16 -0
- package/dist/storage/session-store/resume-session.d.ts +26 -0
- package/dist/storage/session-store/session-store-clear.d.ts +11 -0
- package/dist/storage/session-store/session-store-index.d.ts +13 -0
- package/dist/storage/session-store/strict-empty-check.d.ts +7 -0
- package/dist/storage/session-store.d.ts +2 -129
- package/dist/storage/session-summary-tracker.d.ts +39 -0
- package/dist/storage/session-write-buffer.d.ts +43 -0
- package/dist/storage/session-writer/session-writer-flush.d.ts +4 -0
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +28 -0
- package/dist/tools/fallback-agent-model-assign-tool.d.ts +18 -0
- package/dist/tools/fallback-leader-model-set-tool.d.ts +18 -0
- package/dist/tools/fallback-manage-tools.d.ts +8 -45
- package/dist/tools/fallback-profile-manage-tool.d.ts +16 -0
- package/dist/tools/fallback-provider-key-set-tool.d.ts +17 -0
- package/dist/tools/fallback-provider-manage-tool.d.ts +26 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +5150 -5090
- package/dist/types/config/root.d.ts +21 -2
- package/dist/types/default-config.d.ts +1 -1
- package/dist/types/index.d.ts +54 -55
- package/dist/types/index.js +953 -932
- package/dist/types/runtime-capability-manifest.d.ts +5 -5
- package/dist/types/session-markers.d.ts +12 -0
- package/dist/types/session-markers.js +19 -0
- package/dist/types/session.d.ts +7 -0
- package/dist/worktree/worktree-manager.d.ts +1 -1
- package/instructions/coordination/subagent-baseline.md +2 -2
- package/instructions/llm/prompt-enhancer.md +2 -1
- package/instructions/sections/tool/common-patterns.md +21 -0
- package/instructions/sections/tool/delegation-compact.md +3 -1
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/system-lite.md +28 -3
- package/instructions/system-pro.md +37 -8
- package/instructions/system.md +4 -2
- package/package.json +5 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Context } from '../core/context.js';
|
|
2
|
+
import type { PermissionTrace, TrustPolicy } from '../types/permission.js';
|
|
3
|
+
import type { Tool } from '../types/tool.js';
|
|
4
|
+
export interface PermissionExplainContext {
|
|
5
|
+
policy: TrustPolicy;
|
|
6
|
+
policyInvalid: boolean;
|
|
7
|
+
wildcardEntries: {
|
|
8
|
+
pattern: string;
|
|
9
|
+
value: TrustPolicy[string];
|
|
10
|
+
}[];
|
|
11
|
+
sessionDenied: Map<string, boolean>;
|
|
12
|
+
sessionAllowed: Map<string, boolean>;
|
|
13
|
+
yolo: boolean;
|
|
14
|
+
promptDelegatePresent: boolean;
|
|
15
|
+
isSensitiveReadCall(tool: Tool, input: unknown): boolean;
|
|
16
|
+
yoloBlockedAsDestructive(tool: Tool, input: unknown, ctx: Context): boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function explainPermissionTrace(state: PermissionExplainContext, tool: Tool, input: unknown, ctx: Context): PermissionTrace;
|
|
19
|
+
//# sourceMappingURL=permission-explain.d.ts.map
|
|
@@ -8,11 +8,6 @@ export { alwaysAllowUnavailableReason, matchesTrust, matchesCommandTrust, hasShe
|
|
|
8
8
|
export interface PermissionPolicyOptions {
|
|
9
9
|
trustFile: string;
|
|
10
10
|
yolo?: boolean | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Let YOLO auto-approve destructive shell commands too. Off by default: with
|
|
13
|
-
* YOLO on, `rm -rf`, git history rewrites and external publishes still ask
|
|
14
|
-
* (WS-008).
|
|
15
|
-
*/
|
|
16
11
|
yoloDestructive?: boolean | undefined;
|
|
17
12
|
promptDelegate?: (tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>;
|
|
18
13
|
inputReader?: InputReader | undefined;
|
|
@@ -22,110 +17,22 @@ export declare class DefaultPermissionPolicy implements PermissionPolicy {
|
|
|
22
17
|
private loaded;
|
|
23
18
|
private readonly trustFile;
|
|
24
19
|
private yolo;
|
|
25
|
-
/**
|
|
26
|
-
* Session-scoped "soft deny" map. When the user presses 'n' (block once),
|
|
27
|
-
* the tool+pattern is added here. If the LLM retries in the same session,
|
|
28
|
-
* we return deny directly without asking again.
|
|
29
|
-
*
|
|
30
|
-
* Cleared on reload() since reload = fresh trust file snapshot.
|
|
31
|
-
*/
|
|
32
20
|
private sessionDenied;
|
|
33
|
-
/**
|
|
34
|
-
* Session-scoped one-shot "soft trust" map. When the user presses 'y', the
|
|
35
|
-
* tool+pattern is added here so the immediate confirm re-run can proceed.
|
|
36
|
-
* The entry is consumed on first use; future calls must ask again unless the
|
|
37
|
-
* user chose persistent trust.
|
|
38
|
-
*
|
|
39
|
-
* Cleared on reload().
|
|
40
|
-
*/
|
|
41
21
|
private sessionAllowed;
|
|
42
|
-
/**
|
|
43
|
-
* Interactive prompt delegate. When set, `evaluate()` calls it to get a
|
|
44
|
-
* user decision synchronously (CLI REPL path). When cleared (TUI / WebUI),
|
|
45
|
-
* `evaluate()` returns `confirm` so the caller can emit
|
|
46
|
-
* `tool.confirm_needed` for the UI layer to handle.
|
|
47
|
-
*
|
|
48
|
-
* Mutable so the host can switch from CLI-prompt to event-driven
|
|
49
|
-
* confirmation at runtime (e.g. when `--goal` forces TUI mode after
|
|
50
|
-
* the agent was already constructed).
|
|
51
|
-
*/
|
|
52
22
|
private promptDelegate?;
|
|
53
|
-
/** Pre-compiled wildcard patterns — rebuilt on reload for O(1) lookup. */
|
|
54
23
|
private wildcardEntries;
|
|
55
|
-
/**
|
|
56
|
-
* Evaluate-result cache. Keyed by `tool.name::subject::permissionFingerprint`
|
|
57
|
-
* so repeated calls with the same tool+input skip namespace matching,
|
|
58
|
-
* subject computation, and pattern matching (matchAny). The fingerprint
|
|
59
|
-
* suffix covers the `Tool` fields `evaluate()` reads (`permission`,
|
|
60
|
-
* `riskTier`, `mutating`, `capabilities`), so a tool redefined via
|
|
61
|
-
* `ToolRegistry.wrap()` misses the cache instead of inheriting a stale
|
|
62
|
-
* verdict.
|
|
63
|
-
*
|
|
64
|
-
* Cleared on any state change (reload, trust, deny, yolo toggle) because
|
|
65
|
-
* the result depends on the full policy state. The write-tool smart-bypass
|
|
66
|
-
* (step 7 in `evaluate()`) is not cached since `ctx.hasRead()` changes
|
|
67
|
-
* dynamically within a session.
|
|
68
|
-
*
|
|
69
|
-
* P3 #17 (before-release.md): capped at 500 entries via LRU eviction. An
|
|
70
|
-
* iteration that evaluates thousands of unique tool+subject combinations
|
|
71
|
-
* (e.g. repeated `tool-help` or `bash` with different commands) can grow
|
|
72
|
-
* the cache without bound. 500 is far more than any single iteration needs;
|
|
73
|
-
* the LRU evicts the least-recently-used entries first.
|
|
74
|
-
*/
|
|
75
24
|
private _evalCache;
|
|
76
25
|
private policyDiagnostics;
|
|
77
26
|
private policyInvalid;
|
|
78
|
-
/**
|
|
79
|
-
* When true, YOLO also auto-approves clearly destructive shell commands.
|
|
80
|
-
*
|
|
81
|
-
* WS-008: `isClearlyDestructiveBashCommand` was exported and heavily tested
|
|
82
|
-
* but called from zero production modules, so YOLO returned `auto` for
|
|
83
|
-
* everything — including `rm -rf`, git history rewrites, and external
|
|
84
|
-
* publishes. The `'yolo_destructive'` decision source, the getter/setter on
|
|
85
|
-
* PermissionPolicy, and the TUI branch that reads it all existed; only the
|
|
86
|
-
* gate itself was missing. Defaults to false: destructive commands still ask,
|
|
87
|
-
* even in YOLO.
|
|
88
|
-
*/
|
|
89
27
|
private yoloDestructive;
|
|
90
28
|
constructor(opts: PermissionPolicyOptions);
|
|
91
|
-
/** Allow YOLO to cover destructive shell commands too (off by default). */
|
|
92
29
|
setYoloDestructive(enabled: boolean): void;
|
|
93
|
-
/** Whether YOLO currently extends to destructive shell commands. */
|
|
94
30
|
getYoloDestructive(): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* True when this call is an FS_WRITE whose target lands inside WrongStack's
|
|
97
|
-
* own state root.
|
|
98
|
-
*
|
|
99
|
-
* FS_WRITE tools disagree on where the target path lives: write/edit use
|
|
100
|
-
* `path`, replace/format/git `files` (string OR array), patch `directory`,
|
|
101
|
-
* design `out`, scaffold writes under `cwd`/`template`. Checking only
|
|
102
|
-
* `path`/`file_path` let a state-root write merely switch tools, so every
|
|
103
|
-
* path-bearing key is inspected.
|
|
104
|
-
*
|
|
105
|
-
* Shared by the YOLO carve-out and the eval-cache guard so the two cannot
|
|
106
|
-
* drift: the carve-out scans all path keys while the cache key fingerprints
|
|
107
|
-
* only the subject key, so the cache must consult the same predicate or a
|
|
108
|
-
* secondary state-root key can be replayed a cached `auto`.
|
|
109
|
-
*/
|
|
110
31
|
private hasAgentStateWriteTarget;
|
|
111
|
-
/**
|
|
112
|
-
* True when YOLO is on but this specific call is a destructive shell command
|
|
113
|
-
* the user has not opted to auto-approve. Shared by `evaluate()` and the
|
|
114
|
-
* explain/trace path so the two cannot drift.
|
|
115
|
-
*/
|
|
116
32
|
private yoloBlockedAsDestructive;
|
|
117
|
-
/**
|
|
118
|
-
* Replace (or clear) the interactive prompt delegate at runtime.
|
|
119
|
-
* Used by the CLI to switch from inline prompts (REPL) to event-driven
|
|
120
|
-
* confirmation (TUI) when the run mode is determined after the policy
|
|
121
|
-
* was constructed (e.g. `--goal` auto-flipping to TUI).
|
|
122
|
-
*/
|
|
123
33
|
setPromptDelegate(delegate: PermissionPolicyOptions['promptDelegate']): void;
|
|
124
|
-
/** Toggle YOLO (auto-approve) mode at runtime. */
|
|
125
34
|
setYolo(enabled: boolean): void;
|
|
126
|
-
/** Check whether YOLO mode is currently active. */
|
|
127
35
|
getYolo(): boolean;
|
|
128
|
-
/** Read-only diagnostics for policy inspector/editor surfaces. */
|
|
129
36
|
getPolicyDiagnostics(): readonly TrustPolicyDiagnostic[];
|
|
130
37
|
reload(): Promise<void>;
|
|
131
38
|
private _logDeny;
|
|
@@ -135,26 +42,18 @@ export declare class DefaultPermissionPolicy implements PermissionPolicy {
|
|
|
135
42
|
tool: string;
|
|
136
43
|
pattern: string;
|
|
137
44
|
}): Promise<void>;
|
|
138
|
-
/** Persist a deny rule — this tool+pattern pair is permanently blocked. */
|
|
139
45
|
deny(rule: {
|
|
140
46
|
tool: string;
|
|
141
47
|
pattern: string;
|
|
142
48
|
}): Promise<void>;
|
|
143
|
-
/** Block this tool+pattern for the rest of this session (no trust file). */
|
|
144
49
|
denyOnce(rule: {
|
|
145
50
|
tool: string;
|
|
146
51
|
pattern: string;
|
|
147
52
|
}): void;
|
|
148
|
-
/** Auto-approve this tool+pattern once (no trust file). */
|
|
149
53
|
allowOnce(rule: {
|
|
150
54
|
tool: string;
|
|
151
55
|
pattern: string;
|
|
152
56
|
}): void;
|
|
153
|
-
/**
|
|
154
|
-
* Side-effect-free permission evaluation trace. Mirrors `evaluate()`
|
|
155
|
-
* step-by-step without prompting the user, writing to trust files, or
|
|
156
|
-
* mutating session state. Returns the full ordered trace and winner.
|
|
157
|
-
*/
|
|
158
57
|
explain(tool: Tool, input: unknown, ctx: Context): Promise<PermissionTrace>;
|
|
159
58
|
private findNamespaceEntry;
|
|
160
59
|
}
|
|
@@ -2,10 +2,11 @@ export declare function getInputString(input: unknown, key: string): string | un
|
|
|
2
2
|
export declare function pathLooksInsideProject(rawPath: string, projectRoot: string | undefined): boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Best-effort detection of a *catastrophic* shell command — system-/disk-/
|
|
5
|
-
* home-wide, effectively irreversible destruction
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* home-wide, effectively irreversible destruction, OR a write to WrongStack's
|
|
6
|
+
* own trusted state files that could disable security boundaries.
|
|
7
|
+
* `projectRoot` is accepted for signature stability but is intentionally
|
|
8
|
+
* unused for catastrophic targets (they are absolute). It is not used for
|
|
9
|
+
* state-root detection either (those paths are resolved absolutely).
|
|
9
10
|
*/
|
|
10
11
|
export declare function isClearlyDestructiveBashCommand(command: string, projectRoot: string | undefined): boolean;
|
|
11
12
|
//# sourceMappingURL=yolo-risk.d.ts.map
|