@wrongstack/core 0.300.0 → 0.302.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.d.ts +2 -0
- package/dist/chronicle/index.js +297 -10
- package/dist/chronicle/project-server.js +253 -15
- package/dist/chronicle/sqlite-compaction.d.ts +20 -0
- package/dist/chronicle/sqlite-journal.d.ts +57 -0
- package/dist/coordination/agents/capability-manifest.d.ts +7 -0
- package/dist/coordination/agents/index.d.ts +3 -2
- package/dist/coordination/agents/index.js +818 -570
- package/dist/coordination/agents/project-agent-identity.d.ts +6 -6
- package/dist/coordination/agents/role-skills.d.ts +1 -1
- package/dist/coordination/agents/types.d.ts +6 -0
- package/dist/coordination/director.d.ts +2 -2
- package/dist/coordination/index.js +6787 -6447
- package/dist/coordination/mail-tools.d.ts +3 -3
- package/dist/coordination/mailbox-project-server.js +3 -4
- package/dist/coordination/mailbox-types.d.ts +6 -0
- package/dist/core/agent-response.d.ts +5 -1
- package/dist/core/agent-tools.d.ts +3 -0
- package/dist/core/context.d.ts +20 -0
- package/dist/core/index.d.ts +8 -7
- package/dist/core/index.js +893 -284
- package/dist/core/instruction-template.d.ts +6 -3
- package/dist/core/next-steps-slot.d.ts +88 -0
- package/dist/core/system-prompt-builder.d.ts +5 -3
- package/dist/core/system-prompt-memory-skills.d.ts +1 -0
- package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
- package/dist/defaults/index.js +9797 -8898
- package/dist/design/index.js +11 -3
- package/dist/execution/auto-compaction-middleware.d.ts +17 -0
- package/dist/execution/autonomy-brain.d.ts +8 -2
- package/dist/execution/brain-runtime.d.ts +3 -1
- package/dist/execution/compaction-core.d.ts +41 -2
- package/dist/execution/council-brain.d.ts +37 -2
- package/dist/execution/council-orchestrator.d.ts +2 -2
- package/dist/execution/index.d.ts +11 -10
- package/dist/execution/index.js +5179 -4078
- package/dist/execution/tool-executor.d.ts +4 -1
- package/dist/execution/topic-shift-advisor.d.ts +53 -0
- package/dist/extension/index.js +8 -2
- package/dist/extension/registry.d.ts +8 -1
- package/dist/goal/index.js +11 -3
- package/dist/hooks/index.js +42 -9
- package/dist/hooks/runner.d.ts +12 -1
- package/dist/hq/index.js +41 -17
- package/dist/hq/publisher.d.ts +21 -3
- package/dist/index.d.ts +21 -20
- package/dist/index.js +10901 -8067
- package/dist/infrastructure/index.js +108 -21
- package/dist/kernel/events/session-events.d.ts +13 -0
- package/dist/kernel/events/tool-events.d.ts +3 -3
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +17 -0
- package/dist/models/provider-credentials.d.ts +54 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js +2024 -502
- package/dist/plugins/auto-review-plugin.d.ts +3 -0
- package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
- package/dist/plugins/review-claim-registry.d.ts +23 -8
- package/dist/plugins/review-types.d.ts +2 -0
- package/dist/registry/index.js +109 -74
- package/dist/registry/tool-registry.d.ts +15 -0
- package/dist/security/capabilities.d.ts +2 -0
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +9 -2
- package/dist/security/readonly-permission-policy.d.ts +20 -0
- package/dist/session-registry-atomic-file.d.ts +32 -5
- package/dist/session-registry-types.d.ts +17 -0
- package/dist/session-registry.d.ts +1 -1
- package/dist/skills/frontmatter.d.ts +6 -0
- package/dist/skills/index.js +22 -5
- package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
- package/dist/storage/cloud-config-sync.d.ts +87 -0
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +854 -66
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +511 -234
- package/dist/tools/one-shot-llm-tool.d.ts +1 -0
- package/dist/tools/plugin-manager.d.ts +27 -0
- package/dist/types/config/mcp-features.d.ts +18 -11
- package/dist/types/config/root.d.ts +8 -1
- package/dist/types/config/runtime.d.ts +20 -6
- package/dist/types/config/skills-fleet-brain.d.ts +12 -4
- package/dist/types/config/tools.d.ts +16 -0
- package/dist/types/context-window.d.ts +1 -0
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +1 -0
- package/dist/types/multi-agent.d.ts +2 -0
- package/dist/types/one-shot-llm.d.ts +16 -0
- package/dist/types/provider.d.ts +16 -0
- package/dist/types/runtime-capability-manifest.d.ts +168 -0
- package/dist/types/skill.d.ts +5 -0
- package/dist/types/system-prompt.d.ts +3 -1
- package/dist/types/tool-executor.d.ts +8 -1
- package/dist/utils/context-breakdown.d.ts +8 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +141 -31
- package/dist/utils/regex-guard.d.ts +16 -2
- package/dist/utils/sage-output-block.d.ts +7 -10
- package/dist/utils/wstack-paths.d.ts +11 -3
- package/instructions/agents/browser.md +1 -4
- package/instructions/agents/e2e.md +17 -15
- package/instructions/agents/ios.md +3 -3
- package/instructions/agents/search.md +1 -1
- package/instructions/autonomy/goal-preamble.md +4 -4
- package/instructions/coordination/director-preamble.md +2 -3
- package/instructions/coordination/subagent-baseline.md +3 -1
- package/instructions/leader-after-task.md +12 -0
- package/instructions/llm/chimera-review.md +1 -1
- package/instructions/modes/audit-lite.md +1 -1
- package/instructions/sections/tool/common-patterns.md +18 -2
- package/instructions/sections/tool/mailbox-compact.md +1 -1
- package/instructions/sections/tool/mailbox-full.md +1 -1
- package/instructions/system-lite.md +10 -0
- package/instructions/system-pro.md +23 -14
- package/instructions/system.md +22 -13
- package/package.json +3 -3
- package/skills/api-design/SKILL.md +3 -0
- package/skills/audit-log/SKILL.md +2 -0
- package/skills/auto-review/SKILL.md +6 -1
- package/skills/bug-hunter/SKILL.md +4 -1
- package/skills/chimera/SKILL.md +3 -0
- package/skills/data-governance/SKILL.md +3 -0
- package/skills/design-system/SKILL.md +5 -2
- package/skills/docker-deploy/SKILL.md +2 -0
- package/skills/git-flow/SKILL.md +2 -0
- package/skills/mailbox-bridge/SKILL.md +3 -0
- package/skills/mnemosyne/SKILL.md +2 -0
- package/skills/multi-agent/SKILL.md +4 -1
- package/skills/node-modern/SKILL.md +4 -1
- package/skills/observability/SKILL.md +3 -0
- package/skills/output-standards/SKILL.md +2 -0
- package/skills/plugin-author/SKILL.md +4 -1
- package/skills/prompt-engineering/SKILL.md +3 -1
- package/skills/react-modern/SKILL.md +6 -3
- package/skills/refactor-planner/SKILL.md +2 -0
- package/skills/research-web/SKILL.md +3 -0
- package/skills/sdd/SKILL.md +3 -1
- package/skills/security-scanner/SKILL.md +3 -0
- package/skills/skill-creator/SKILL.md +2 -0
- package/skills/tech-stack/SKILL.md +3 -0
- package/skills/testing/SKILL.md +4 -1
- package/skills/typescript-strict/SKILL.md +4 -1
- package/skills/wrongstack-kanban/SKILL.md +6 -3
- package/skills/wrongstack-mailbox/SKILL.md +4 -1
- package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
|
@@ -67,7 +67,10 @@ export declare class ToolExecutor {
|
|
|
67
67
|
* Also installs the governed bridge because confirmed tools are re-run
|
|
68
68
|
* through this method after a pending confirmation.
|
|
69
69
|
*/
|
|
70
|
-
executeTool(tool: Tool, use: ToolUseBlock, ctx: Context, budget: number
|
|
70
|
+
executeTool(tool: Tool, use: ToolUseBlock, ctx: Context, budget: number, preToolContext?: {
|
|
71
|
+
text: string;
|
|
72
|
+
contextAs: 'inline' | 'separate';
|
|
73
|
+
}): Promise<{
|
|
71
74
|
block: ToolResultBlock;
|
|
72
75
|
bytes: number;
|
|
73
76
|
}>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Context } from '../core/context.js';
|
|
2
|
+
import { type Message, type Provider } from '../types/index.js';
|
|
3
|
+
export interface TopicShiftAdvice {
|
|
4
|
+
suggestNewContext: boolean;
|
|
5
|
+
confidence: number;
|
|
6
|
+
reason: string;
|
|
7
|
+
nextTopic?: string | undefined;
|
|
8
|
+
source: 'explicit' | 'model' | 'cache' | 'local';
|
|
9
|
+
}
|
|
10
|
+
export interface TopicShiftAdvisorInput {
|
|
11
|
+
prompt: string;
|
|
12
|
+
messages: readonly Message[];
|
|
13
|
+
provider?: Provider | undefined;
|
|
14
|
+
model?: string | undefined;
|
|
15
|
+
contextTokens?: number | undefined;
|
|
16
|
+
maxContext?: number | undefined;
|
|
17
|
+
signal?: AbortSignal | undefined;
|
|
18
|
+
/** Notifies prompt surfaces only when the remote ambiguity check actually runs. */
|
|
19
|
+
onModelCheck?: ((busy: boolean) => void) | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface TopicShiftAdvisorOptions {
|
|
22
|
+
capacity?: number | undefined;
|
|
23
|
+
ttlMs?: number | undefined;
|
|
24
|
+
timeoutMs?: number | undefined;
|
|
25
|
+
now?: (() => number) | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Best-effort, bounded topic-boundary advisor for prompt-submit surfaces.
|
|
29
|
+
*
|
|
30
|
+
* Most prompts finish in the local gate. A separate provider call happens
|
|
31
|
+
* only after history is substantial AND the new prompt has little lexical
|
|
32
|
+
* continuity with recent user goals. Results are held in a small TTL/LRU so
|
|
33
|
+
* edit/retry or duplicate submits never pay twice.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TopicShiftAdvisor {
|
|
36
|
+
private readonly capacity;
|
|
37
|
+
private readonly ttlMs;
|
|
38
|
+
private readonly timeoutMs;
|
|
39
|
+
private readonly now;
|
|
40
|
+
private readonly cache;
|
|
41
|
+
constructor(options?: TopicShiftAdvisorOptions);
|
|
42
|
+
advise(input: TopicShiftAdvisorInput): Promise<TopicShiftAdvice>;
|
|
43
|
+
private classify;
|
|
44
|
+
private get;
|
|
45
|
+
private set;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Start a clean model context without deleting the session journal or visible
|
|
49
|
+
* chat. Durable memory, provider/model selection, settings and project state
|
|
50
|
+
* remain owned by their existing services.
|
|
51
|
+
*/
|
|
52
|
+
export declare function startFreshTopicContext(ctx: Context): Promise<void>;
|
|
53
|
+
//# sourceMappingURL=topic-shift-advisor.d.ts.map
|
package/dist/extension/index.js
CHANGED
|
@@ -258,9 +258,15 @@ var ExtensionRegistry = class {
|
|
|
258
258
|
* Build a composed provider runner. Extensions with `wrapProviderRunner`
|
|
259
259
|
* form a middleware-style chain: the innermost extension wraps the
|
|
260
260
|
* default runner, each subsequent wrapper wraps the previous.
|
|
261
|
+
*
|
|
262
|
+
* Utility calls may exclude agent-loop-only middleware (notably
|
|
263
|
+
* `fallback-model`) while retaining request-safety wrappers such as the
|
|
264
|
+
* prompt firewall. One-shot orchestration owns its provider and fallback
|
|
265
|
+
* route, so an agent-loop fallback wrapper cannot safely run against it.
|
|
261
266
|
*/
|
|
262
|
-
wrapProviderRunner(inner) {
|
|
263
|
-
const
|
|
267
|
+
wrapProviderRunner(inner, options) {
|
|
268
|
+
const excluded = new Set(options?.exclude);
|
|
269
|
+
const wrappers = this.extensions.filter((e) => e.wrapProviderRunner && !excluded.has(e.name)).map((e) => ({ name: e.name, wrap: expectDefined(e.wrapProviderRunner) }));
|
|
264
270
|
if (wrappers.length === 0) return inner;
|
|
265
271
|
let composed = inner;
|
|
266
272
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -78,8 +78,15 @@ export declare class ExtensionRegistry {
|
|
|
78
78
|
* Build a composed provider runner. Extensions with `wrapProviderRunner`
|
|
79
79
|
* form a middleware-style chain: the innermost extension wraps the
|
|
80
80
|
* default runner, each subsequent wrapper wraps the previous.
|
|
81
|
+
*
|
|
82
|
+
* Utility calls may exclude agent-loop-only middleware (notably
|
|
83
|
+
* `fallback-model`) while retaining request-safety wrappers such as the
|
|
84
|
+
* prompt firewall. One-shot orchestration owns its provider and fallback
|
|
85
|
+
* route, so an agent-loop fallback wrapper cannot safely run against it.
|
|
81
86
|
*/
|
|
82
|
-
wrapProviderRunner(inner: ProviderRunnerFn
|
|
87
|
+
wrapProviderRunner(inner: ProviderRunnerFn, options?: {
|
|
88
|
+
exclude?: readonly string[] | undefined;
|
|
89
|
+
}): ProviderRunnerFn;
|
|
83
90
|
runBeforeToolExecution(...args: Parameters<BeforeToolExecutionHook>): Promise<Parameters<BeforeToolExecutionHook>[1]>;
|
|
84
91
|
runAfterToolExecution(...args: Parameters<AfterToolExecutionHook>): Promise<void>;
|
|
85
92
|
}
|
package/dist/goal/index.js
CHANGED
|
@@ -2765,6 +2765,9 @@ function canonicalProjectRoot(absRoot) {
|
|
|
2765
2765
|
const commonDirFile = path4.join(gitDir, "commondir");
|
|
2766
2766
|
if (!fs.statSync(commonDirFile).isFile()) return checkoutRoot;
|
|
2767
2767
|
const commonDir = path4.resolve(gitDir, fs.readFileSync(commonDirFile, "utf8").trim());
|
|
2768
|
+
const worktreesDir = path4.dirname(gitDir);
|
|
2769
|
+
if (path4.basename(worktreesDir).toLowerCase() !== "worktrees") return checkoutRoot;
|
|
2770
|
+
if (path4.resolve(worktreesDir, "..") !== commonDir) return checkoutRoot;
|
|
2768
2771
|
if (path4.basename(commonDir).toLowerCase() !== ".git") return checkoutRoot;
|
|
2769
2772
|
return path4.dirname(commonDir);
|
|
2770
2773
|
} catch {
|
|
@@ -2787,7 +2790,7 @@ function safeProfileName(name) {
|
|
|
2787
2790
|
const safe = (name ?? "").replace(/[/\\:]/g, "_").replace(/\.\./g, "_").trim();
|
|
2788
2791
|
return safe || "default";
|
|
2789
2792
|
}
|
|
2790
|
-
function
|
|
2793
|
+
function bootstrapProfileName(globalRoot) {
|
|
2791
2794
|
try {
|
|
2792
2795
|
const parsed = JSON.parse(fs.readFileSync(path4.join(globalRoot, "config.json"), "utf8"));
|
|
2793
2796
|
return safeProfileName(
|
|
@@ -2805,7 +2808,7 @@ function wstackGlobalRoot() {
|
|
|
2805
2808
|
function resolveWstackPaths(opts) {
|
|
2806
2809
|
const globalRoot = opts.globalRoot ?? (opts.userHome ? path4.join(opts.userHome, ".wrongstack") : wstackGlobalRoot());
|
|
2807
2810
|
const homeDir = opts.userHome ?? os.homedir();
|
|
2808
|
-
const profileName = safeProfileName(opts.profileName ??
|
|
2811
|
+
const profileName = safeProfileName(opts.profileName ?? bootstrapProfileName(globalRoot));
|
|
2809
2812
|
const profileDir = path4.join(globalRoot, "profiles", profileName);
|
|
2810
2813
|
const hash = projectHash(opts.projectRoot);
|
|
2811
2814
|
const slug = projectSlug(opts.projectRoot);
|
|
@@ -2875,7 +2878,12 @@ function resolveWstackPaths(opts) {
|
|
|
2875
2878
|
projectRequirementIntakes: path4.join(projectDir, "requirement-intakes"),
|
|
2876
2879
|
syncConfig: path4.join(profileDir, "sync.json"),
|
|
2877
2880
|
configHistoryDir: path4.join(globalRoot, "config-history"),
|
|
2878
|
-
projectStatus: (
|
|
2881
|
+
projectStatus: (statusProjectSlug) => {
|
|
2882
|
+
if (!/^[a-z0-9](?:[a-z0-9-]{0,39})-[a-f0-9]{6}$/.test(statusProjectSlug)) {
|
|
2883
|
+
throw new Error(`Invalid project slug: ${statusProjectSlug}`);
|
|
2884
|
+
}
|
|
2885
|
+
return path4.join(globalRoot, "projects", statusProjectSlug, "status.json");
|
|
2886
|
+
}
|
|
2879
2887
|
};
|
|
2880
2888
|
}
|
|
2881
2889
|
|
package/dist/hooks/index.js
CHANGED
|
@@ -781,19 +781,31 @@ var MAX_TIMEOUT_MS = 10 * 6e4;
|
|
|
781
781
|
function hookTimeoutMs(entry) {
|
|
782
782
|
return entry.timeoutMs ?? (entry.background ? DEFAULT_BACKGROUND_TIMEOUT_MS : DEFAULT_TIMEOUT_MS3);
|
|
783
783
|
}
|
|
784
|
+
function contextFromOutcome(outcome) {
|
|
785
|
+
return {
|
|
786
|
+
...outcome.additionalContext ? { additionalContext: outcome.additionalContext } : {},
|
|
787
|
+
...outcome.contextAs ? { contextAs: outcome.contextAs } : {}
|
|
788
|
+
};
|
|
789
|
+
}
|
|
784
790
|
function normalizePreToolOutcome(outcome) {
|
|
785
|
-
|
|
791
|
+
const context = contextFromOutcome(outcome);
|
|
792
|
+
if ("action" in outcome) return { ...outcome, ...context };
|
|
786
793
|
if (outcome.decision === "block") {
|
|
787
|
-
return {
|
|
794
|
+
return {
|
|
795
|
+
action: "deny",
|
|
796
|
+
reason: outcome.reason?.trim() || "blocked by PreToolUse hook",
|
|
797
|
+
...context
|
|
798
|
+
};
|
|
788
799
|
}
|
|
789
800
|
if (outcome.modifiedInput && typeof outcome.modifiedInput === "object") {
|
|
790
801
|
return {
|
|
791
802
|
action: "mutate",
|
|
792
803
|
input: outcome.modifiedInput,
|
|
793
|
-
...outcome.reason ? { reason: outcome.reason } : {}
|
|
804
|
+
...outcome.reason ? { reason: outcome.reason } : {},
|
|
805
|
+
...context
|
|
794
806
|
};
|
|
795
807
|
}
|
|
796
|
-
return { action: "allow" };
|
|
808
|
+
return { action: "allow", ...context };
|
|
797
809
|
}
|
|
798
810
|
function malformedOutcome(outcome) {
|
|
799
811
|
if (!("action" in outcome)) return void 0;
|
|
@@ -823,11 +835,26 @@ var HookRunner = class {
|
|
|
823
835
|
has(event) {
|
|
824
836
|
return this.registry.has(event);
|
|
825
837
|
}
|
|
826
|
-
async preToolUse(toolName, toolInput, env) {
|
|
838
|
+
async preToolUse(toolName, toolInput, env, toolMeta) {
|
|
827
839
|
const entries = this.matching("PreToolUse", toolName);
|
|
828
840
|
if (entries.length === 0) return {};
|
|
841
|
+
const declared = {
|
|
842
|
+
...toolMeta?.capabilities ? { toolCapabilities: toolMeta.capabilities } : {},
|
|
843
|
+
...toolMeta?.mutating === void 0 ? {} : { toolMutating: toolMeta.mutating }
|
|
844
|
+
};
|
|
829
845
|
let current = toolInput;
|
|
830
846
|
let mutated = false;
|
|
847
|
+
const contexts = [];
|
|
848
|
+
let contextAs;
|
|
849
|
+
const collectContext = (outcome) => {
|
|
850
|
+
if (outcome.additionalContext) contexts.push(outcome.additionalContext);
|
|
851
|
+
if (outcome.contextAs === "separate") contextAs = "separate";
|
|
852
|
+
else if (outcome.contextAs === "inline" && contextAs === void 0) contextAs = "inline";
|
|
853
|
+
};
|
|
854
|
+
const resultContext = () => ({
|
|
855
|
+
...contexts.length > 0 ? { additionalContext: contexts.join("\n") } : {},
|
|
856
|
+
...contextAs ? { contextAs } : {}
|
|
857
|
+
});
|
|
831
858
|
const mutators = entries.filter((entry) => entry.stage === "mutate");
|
|
832
859
|
const validators = entries.filter((entry) => entry.stage === "validate");
|
|
833
860
|
for (const entry of mutators) {
|
|
@@ -835,13 +862,15 @@ var HookRunner = class {
|
|
|
835
862
|
event: "PreToolUse",
|
|
836
863
|
toolName,
|
|
837
864
|
toolInput: current,
|
|
865
|
+
...declared,
|
|
838
866
|
...this.base(env)
|
|
839
867
|
};
|
|
840
868
|
const outcome = await this.invoke(entry, payload, env);
|
|
841
869
|
if (!outcome) continue;
|
|
842
870
|
const normalized = normalizePreToolOutcome(outcome);
|
|
871
|
+
collectContext(normalized);
|
|
843
872
|
if (normalized.action === "deny") {
|
|
844
|
-
return { block: true, reason: normalized.reason };
|
|
873
|
+
return { block: true, reason: normalized.reason, ...resultContext() };
|
|
845
874
|
}
|
|
846
875
|
if (normalized.action === "mutate") {
|
|
847
876
|
current = normalized.input;
|
|
@@ -853,21 +882,25 @@ var HookRunner = class {
|
|
|
853
882
|
event: "PreToolUse",
|
|
854
883
|
toolName,
|
|
855
884
|
toolInput: current,
|
|
885
|
+
...declared,
|
|
856
886
|
...this.base(env)
|
|
857
887
|
};
|
|
858
888
|
const outcome = await this.invoke(entry, payload, env);
|
|
859
889
|
if (!outcome) continue;
|
|
860
890
|
const normalized = normalizePreToolOutcome(outcome);
|
|
891
|
+
collectContext(normalized);
|
|
861
892
|
if (normalized.action === "deny") {
|
|
862
|
-
return { block: true, reason: normalized.reason };
|
|
893
|
+
return { block: true, reason: normalized.reason, ...resultContext() };
|
|
863
894
|
}
|
|
864
895
|
if (normalized.action === "mutate") {
|
|
865
896
|
const reason = `PreToolUse validator "${entry.name}" attempted to mutate tool arguments`;
|
|
866
897
|
this.opts.logger?.warn?.(reason);
|
|
867
|
-
if (entry.failurePolicy === "closed")
|
|
898
|
+
if (entry.failurePolicy === "closed") {
|
|
899
|
+
return { block: true, reason, ...resultContext() };
|
|
900
|
+
}
|
|
868
901
|
}
|
|
869
902
|
}
|
|
870
|
-
return mutated ? { input: current } : {};
|
|
903
|
+
return { ...mutated ? { input: current } : {}, ...resultContext() };
|
|
871
904
|
}
|
|
872
905
|
async postToolUse(toolName, toolInput, result, env) {
|
|
873
906
|
const payload = {
|
package/dist/hooks/runner.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface PreToolUseResult {
|
|
|
22
22
|
reason?: string | undefined;
|
|
23
23
|
/** Present only when a hook replaced the tool input. */
|
|
24
24
|
input?: Record<string, unknown>;
|
|
25
|
+
additionalContext?: string | undefined;
|
|
26
|
+
contextAs?: 'inline' | 'separate' | undefined;
|
|
25
27
|
}
|
|
26
28
|
export interface PromptResult {
|
|
27
29
|
block?: boolean | undefined;
|
|
@@ -46,7 +48,16 @@ export declare class HookRunner {
|
|
|
46
48
|
constructor(opts: HookRunnerOptions);
|
|
47
49
|
/** Cheap guard so callers can skip building payloads when nothing listens. */
|
|
48
50
|
has(event: HookEvent): boolean;
|
|
49
|
-
preToolUse(toolName: string, toolInput: Record<string, unknown>, env: HookRunEnv
|
|
51
|
+
preToolUse(toolName: string, toolInput: Record<string, unknown>, env: HookRunEnv,
|
|
52
|
+
/**
|
|
53
|
+
* What the tool declares about itself. Optional so existing callers (and
|
|
54
|
+
* tests) keep working, but the executor always passes it — a policy hook
|
|
55
|
+
* that keys on capability instead of tool name needs it to be there.
|
|
56
|
+
*/
|
|
57
|
+
toolMeta?: {
|
|
58
|
+
capabilities?: readonly string[] | undefined;
|
|
59
|
+
mutating?: boolean | undefined;
|
|
60
|
+
}): Promise<PreToolUseResult>;
|
|
50
61
|
postToolUse(toolName: string, toolInput: unknown, result: {
|
|
51
62
|
content: string;
|
|
52
63
|
isError: boolean;
|
package/dist/hq/index.js
CHANGED
|
@@ -1305,6 +1305,7 @@ function createMailboxEventPayload(input) {
|
|
|
1305
1305
|
var TRANSCRIPT_EVENT_TYPES = /* @__PURE__ */ new Set(["session.transcript", "agent.message"]);
|
|
1306
1306
|
var OPEN_STATE = 1;
|
|
1307
1307
|
var CONNECT_WARN_AFTER_FAILURES = 5;
|
|
1308
|
+
var DEFAULT_CONNECT_WARN_COOLDOWN_MS = 5 * 6e4;
|
|
1308
1309
|
var DEFAULT_RECONNECT_BASE_MS = 1e3;
|
|
1309
1310
|
var DEFAULT_RECONNECT_MAX_MS = 3e4;
|
|
1310
1311
|
var DEFAULT_DISCOVERY_POLL_MS = 5e3;
|
|
@@ -1316,6 +1317,7 @@ var DEFAULT_MAX_QUEUED_BYTES = Math.min(
|
|
|
1316
1317
|
var DEFAULT_COMMAND_POLL_INTERVAL_MS = 500;
|
|
1317
1318
|
var DEFAULT_COMMAND_POLL_LIMIT = 25;
|
|
1318
1319
|
var DEFAULT_HEARTBEAT_INTERVAL_MS = 25e3;
|
|
1320
|
+
var lastConnectWarningAtMs = 0;
|
|
1319
1321
|
function queuedFrameCoalesceKey(frame) {
|
|
1320
1322
|
if (frame.type !== "client.event" || !frame.event.type.endsWith(".snapshot")) {
|
|
1321
1323
|
return void 0;
|
|
@@ -1367,6 +1369,8 @@ var HqPublisher = class {
|
|
|
1367
1369
|
this.reconnect = options.reconnect ?? true;
|
|
1368
1370
|
this.reconnectBaseMs = options.reconnectBaseMs ?? DEFAULT_RECONNECT_BASE_MS;
|
|
1369
1371
|
this.reconnectMaxMs = options.reconnectMaxMs ?? DEFAULT_RECONNECT_MAX_MS;
|
|
1372
|
+
this.connectWarnAfterFailures = options.connectWarnAfterFailures ?? CONNECT_WARN_AFTER_FAILURES;
|
|
1373
|
+
this.connectWarnCooldownMs = options.connectWarnCooldownMs ?? DEFAULT_CONNECT_WARN_COOLDOWN_MS;
|
|
1370
1374
|
this.maxQueuedMessages = options.maxQueuedMessages ?? DEFAULT_MAX_QUEUED_MESSAGES;
|
|
1371
1375
|
this.maxQueuedBytes = options.maxQueuedBytes ?? DEFAULT_MAX_QUEUED_BYTES;
|
|
1372
1376
|
this.resolvedRedactionPolicy = resolveHqRedactionPolicy(options.redactionPolicy);
|
|
@@ -1380,6 +1384,8 @@ var HqPublisher = class {
|
|
|
1380
1384
|
reconnect;
|
|
1381
1385
|
reconnectBaseMs;
|
|
1382
1386
|
reconnectMaxMs;
|
|
1387
|
+
connectWarnAfterFailures;
|
|
1388
|
+
connectWarnCooldownMs;
|
|
1383
1389
|
maxQueuedMessages;
|
|
1384
1390
|
maxQueuedBytes;
|
|
1385
1391
|
resolvedRedactionPolicy;
|
|
@@ -1791,9 +1797,8 @@ var HqPublisher = class {
|
|
|
1791
1797
|
if (this.stopped || !this.reconnect || this.reconnectTimer !== null) return;
|
|
1792
1798
|
const delay = Math.min(this.reconnectMaxMs, this.reconnectBaseMs * 2 ** this.reconnectAttempt);
|
|
1793
1799
|
this.reconnectAttempt += 1;
|
|
1794
|
-
if (!this.connectWarningEmitted && this.reconnectAttempt >=
|
|
1795
|
-
this.connectWarningEmitted = true;
|
|
1796
|
-
this.emitConnectWarning();
|
|
1800
|
+
if (!this.connectWarningEmitted && this.reconnectAttempt >= this.connectWarnAfterFailures) {
|
|
1801
|
+
if (this.emitConnectWarning()) this.connectWarningEmitted = true;
|
|
1797
1802
|
}
|
|
1798
1803
|
this.reconnectTimer = setTimeout(() => {
|
|
1799
1804
|
this.reconnectTimer = null;
|
|
@@ -1802,11 +1807,16 @@ var HqPublisher = class {
|
|
|
1802
1807
|
this.reconnectTimer.unref?.();
|
|
1803
1808
|
}
|
|
1804
1809
|
emitConnectWarning() {
|
|
1810
|
+
const nowMs = Date.now();
|
|
1811
|
+
if (nowMs - lastConnectWarningAtMs < this.connectWarnCooldownMs) {
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
lastConnectWarningAtMs = nowMs;
|
|
1805
1815
|
const attempt = this.lastAttempt;
|
|
1806
1816
|
const message = `WrongStack HQ publisher: ${this.reconnectAttempt} consecutive connection failures${attempt !== null ? ` to ${attempt.url} (client token ${attempt.hadToken ? "present" : "absent"})` : ""}. Either the HQ server is unreachable or it rejected the token (401). If HQ runs in client-token mode, verify WRONGSTACK_HQ_TOKEN / auth.json. Retries continue with backoff.`;
|
|
1807
1817
|
if (this.logger) {
|
|
1808
1818
|
this.logger.warn(message, { event: "hq.publisher.connect_failed" });
|
|
1809
|
-
return;
|
|
1819
|
+
return true;
|
|
1810
1820
|
}
|
|
1811
1821
|
const warn = this.options.warn ?? ((msg) => console.warn(
|
|
1812
1822
|
JSON.stringify({
|
|
@@ -1820,6 +1830,7 @@ var HqPublisher = class {
|
|
|
1820
1830
|
warn(message);
|
|
1821
1831
|
} catch {
|
|
1822
1832
|
}
|
|
1833
|
+
return true;
|
|
1823
1834
|
}
|
|
1824
1835
|
/**
|
|
1825
1836
|
* Dormant re-check while no HQ endpoint is discoverable. Uses a FIXED
|
|
@@ -2071,6 +2082,20 @@ function windowsAccountName() {
|
|
|
2071
2082
|
return username;
|
|
2072
2083
|
}
|
|
2073
2084
|
|
|
2085
|
+
// src/utils/pid.ts
|
|
2086
|
+
function isPidAlive(pid) {
|
|
2087
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
2088
|
+
if (pid === process.pid) return true;
|
|
2089
|
+
try {
|
|
2090
|
+
process.kill(pid, 0);
|
|
2091
|
+
return true;
|
|
2092
|
+
} catch (err) {
|
|
2093
|
+
const code = err.code;
|
|
2094
|
+
if (code === "EPERM") return true;
|
|
2095
|
+
return false;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2074
2099
|
// src/utils/wstack-paths.ts
|
|
2075
2100
|
import { createHash } from "node:crypto";
|
|
2076
2101
|
import * as fs2 from "node:fs";
|
|
@@ -2088,6 +2113,9 @@ function canonicalProjectRoot(absRoot) {
|
|
|
2088
2113
|
const commonDirFile = path2.join(gitDir, "commondir");
|
|
2089
2114
|
if (!fs2.statSync(commonDirFile).isFile()) return checkoutRoot;
|
|
2090
2115
|
const commonDir = path2.resolve(gitDir, fs2.readFileSync(commonDirFile, "utf8").trim());
|
|
2116
|
+
const worktreesDir = path2.dirname(gitDir);
|
|
2117
|
+
if (path2.basename(worktreesDir).toLowerCase() !== "worktrees") return checkoutRoot;
|
|
2118
|
+
if (path2.resolve(worktreesDir, "..") !== commonDir) return checkoutRoot;
|
|
2091
2119
|
if (path2.basename(commonDir).toLowerCase() !== ".git") return checkoutRoot;
|
|
2092
2120
|
return path2.dirname(commonDir);
|
|
2093
2121
|
} catch {
|
|
@@ -2110,7 +2138,7 @@ function safeProfileName(name) {
|
|
|
2110
2138
|
const safe = (name ?? "").replace(/[/\\:]/g, "_").replace(/\.\./g, "_").trim();
|
|
2111
2139
|
return safe || "default";
|
|
2112
2140
|
}
|
|
2113
|
-
function
|
|
2141
|
+
function bootstrapProfileName(globalRoot) {
|
|
2114
2142
|
try {
|
|
2115
2143
|
const parsed = JSON.parse(fs2.readFileSync(path2.join(globalRoot, "config.json"), "utf8"));
|
|
2116
2144
|
return safeProfileName(
|
|
@@ -2128,7 +2156,7 @@ function wstackGlobalRoot() {
|
|
|
2128
2156
|
function resolveWstackPaths(opts) {
|
|
2129
2157
|
const globalRoot = opts.globalRoot ?? (opts.userHome ? path2.join(opts.userHome, ".wrongstack") : wstackGlobalRoot());
|
|
2130
2158
|
const homeDir = opts.userHome ?? os.homedir();
|
|
2131
|
-
const profileName = safeProfileName(opts.profileName ??
|
|
2159
|
+
const profileName = safeProfileName(opts.profileName ?? bootstrapProfileName(globalRoot));
|
|
2132
2160
|
const profileDir = path2.join(globalRoot, "profiles", profileName);
|
|
2133
2161
|
const hash = projectHash(opts.projectRoot);
|
|
2134
2162
|
const slug = projectSlug(opts.projectRoot);
|
|
@@ -2198,7 +2226,12 @@ function resolveWstackPaths(opts) {
|
|
|
2198
2226
|
projectRequirementIntakes: path2.join(projectDir, "requirement-intakes"),
|
|
2199
2227
|
syncConfig: path2.join(profileDir, "sync.json"),
|
|
2200
2228
|
configHistoryDir: path2.join(globalRoot, "config-history"),
|
|
2201
|
-
projectStatus: (
|
|
2229
|
+
projectStatus: (statusProjectSlug) => {
|
|
2230
|
+
if (!/^[a-z0-9](?:[a-z0-9-]{0,39})-[a-f0-9]{6}$/.test(statusProjectSlug)) {
|
|
2231
|
+
throw new Error(`Invalid project slug: ${statusProjectSlug}`);
|
|
2232
|
+
}
|
|
2233
|
+
return path2.join(globalRoot, "projects", statusProjectSlug, "status.json");
|
|
2234
|
+
}
|
|
2202
2235
|
};
|
|
2203
2236
|
}
|
|
2204
2237
|
|
|
@@ -2329,22 +2362,13 @@ async function writeHqRuntimeFile(dataDir, file) {
|
|
|
2329
2362
|
`, { mode: SECRET_FILE_MODE });
|
|
2330
2363
|
await restrictFilePermissions(target, { label: "hq-runtime" });
|
|
2331
2364
|
}
|
|
2332
|
-
function isProcessAlive(pid) {
|
|
2333
|
-
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
2334
|
-
try {
|
|
2335
|
-
process.kill(pid, 0);
|
|
2336
|
-
return true;
|
|
2337
|
-
} catch {
|
|
2338
|
-
return false;
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
2365
|
function readHqRuntimeFileSync(dataDir) {
|
|
2342
2366
|
try {
|
|
2343
2367
|
const parsed = JSON.parse(
|
|
2344
2368
|
syncFs.readFileSync(hqRuntimeFilePath(dataDir), "utf8")
|
|
2345
2369
|
);
|
|
2346
2370
|
if (typeof parsed.url !== "string" || parsed.url.trim().length === 0) return void 0;
|
|
2347
|
-
if (typeof parsed.pid === "number" && !
|
|
2371
|
+
if (typeof parsed.pid === "number" && !isPidAlive(parsed.pid)) return void 0;
|
|
2348
2372
|
return {
|
|
2349
2373
|
url: parsed.url,
|
|
2350
2374
|
updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : "",
|
package/dist/hq/publisher.d.ts
CHANGED
|
@@ -32,6 +32,20 @@ export interface HqPublisherOptions {
|
|
|
32
32
|
reconnect?: boolean;
|
|
33
33
|
reconnectBaseMs?: number;
|
|
34
34
|
reconnectMaxMs?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Consecutive connect failures (never reaching `open`) before the one-time
|
|
37
|
+
* diagnostic warning fires. Defaults to `CONNECT_WARN_AFTER_FAILURES` (5).
|
|
38
|
+
*/
|
|
39
|
+
connectWarnAfterFailures?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum gap between connect-failure warnings ACROSS all HqPublisher
|
|
42
|
+
* instances in this process. When a fleet of agents fails against the same
|
|
43
|
+
* dead/rejecting HQ at once, only the first instance to cross the threshold
|
|
44
|
+
* warns; the rest stay silent until the window elapses (each instance still
|
|
45
|
+
* warns at most once). Defaults to 5 minutes. Set to 0 to disable the
|
|
46
|
+
* process-wide gate entirely.
|
|
47
|
+
*/
|
|
48
|
+
connectWarnCooldownMs?: number;
|
|
35
49
|
maxQueuedMessages?: number;
|
|
36
50
|
/** Hard byte cap on the outbound queue (prevents RAM blow-up when HQ is
|
|
37
51
|
* offline). Older frames are dropped oldest-first when exceeded. The default
|
|
@@ -66,11 +80,13 @@ export interface HqPublisherOptions {
|
|
|
66
80
|
*/
|
|
67
81
|
heartbeatIntervalMs?: number;
|
|
68
82
|
/**
|
|
69
|
-
* Diagnostic sink for the
|
|
70
|
-
*
|
|
83
|
+
* Diagnostic sink for the consecutive-connect-failure warning. The
|
|
84
|
+
* publisher is otherwise deliberately silent (dormant queueing), which
|
|
71
85
|
* made auth failures invisible: a token the server rejects — e.g. a wrong
|
|
72
86
|
* `WRONGSTACK_HQ_TOKEN` against a remote HQ — looked exactly like "HQ not
|
|
73
|
-
* running".
|
|
87
|
+
* running". Emission is one-shot per instance and rate-limited process-wide
|
|
88
|
+
* via {@link HqPublisherOptions.connectWarnCooldownMs}. Defaults to a
|
|
89
|
+
* single structured `console.warn` line.
|
|
74
90
|
*/
|
|
75
91
|
warn?: (message: string) => void;
|
|
76
92
|
/** Logger for structured events. When provided, the `warn` callback is derived from it. */
|
|
@@ -99,6 +115,8 @@ export declare class HqPublisher {
|
|
|
99
115
|
private readonly reconnect;
|
|
100
116
|
private readonly reconnectBaseMs;
|
|
101
117
|
private readonly reconnectMaxMs;
|
|
118
|
+
private readonly connectWarnAfterFailures;
|
|
119
|
+
private readonly connectWarnCooldownMs;
|
|
102
120
|
private readonly maxQueuedMessages;
|
|
103
121
|
private readonly maxQueuedBytes;
|
|
104
122
|
private readonly resolvedRedactionPolicy;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,14 @@ export { assertProjectRootOutsideStateDir, type BootConfigOptions, type BootConf
|
|
|
2
2
|
export * from './chronicle/index.js';
|
|
3
3
|
export { type AgentFactory, type AgentFactoryResult, type AgentRunnerOptions, makeAgentSubagentRunner, } from './coordination/agent-subagent-runner.js';
|
|
4
4
|
export { AGENT_CATALOG, AGENTS_BY_PHASE, type AgentDefinition, type AgentPhase, ALL_AGENT_DEFINITIONS, getAgentDefinition, } from './coordination/agents/index.js';
|
|
5
|
-
export { type BrainArbiter, type BrainDecision, type BrainDecisionOption, BrainDecisionQueue, type BrainDecisionRequest, type BrainDecisionSource, type BrainEscalationMode, type BrainFallback, type BrainRisk, DefaultBrainArbiter, type DefaultBrainArbiterOptions, EscalationRoutingBrainArbiter, formatHumanPrompt, HumanEscalatingBrainArbiter, ObservableBrainArbiter,
|
|
5
|
+
export { type BrainArbiter, type BrainDecision, type BrainDecisionOption, BrainDecisionQueue, type BrainDecisionRequest, type BrainDecisionSource, type BrainEscalationMode, type BrainFallback, type BrainRisk, type BrainTerminalPolicy, DefaultBrainArbiter, type DefaultBrainArbiterOptions, EscalationRoutingBrainArbiter, formatHumanPrompt, HumanEscalatingBrainArbiter, ObservableBrainArbiter, terminalPolicyDecision, } from './coordination/brain.js';
|
|
6
|
+
export { type BrainCacheStats, BrainDecisionCache, type BrainDecisionCacheOptions, brainCacheKey, type CachingBrainArbiterOptions, createCachingBrainArbiter, } from './coordination/brain-cache.js';
|
|
7
|
+
export { BLOCKED_RESOLVED_MARKERS, type BrainHeuristicsConfig, compileResolutionMarkers, DEFAULT_BRAIN_HEURISTICS, isBlockedResolved, type ResolvedBrainHeuristics, resolveBrainHeuristics, } from './coordination/brain-heuristics.js';
|
|
6
8
|
export { BrainDecisionLedger, type BrainDecisionLedgerOptions, type BrainLedgerEntry, brainDecisionKey, createLedgerGuardBrainArbiter, type LedgerGuardBrainArbiterOptions, } from './coordination/brain-ledger.js';
|
|
7
9
|
export { type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, type BrainMonitorPolicy, type BrainMonitorSignalToggles, DEFAULT_FILE_EDIT_TOOLS, } from './coordination/brain-monitor.js';
|
|
8
|
-
export { BLOCKED_RESOLVED_MARKERS, type BrainHeuristicsConfig, compileResolutionMarkers, DEFAULT_BRAIN_HEURISTICS, isBlockedResolved, type ResolvedBrainHeuristics, resolveBrainHeuristics, } from './coordination/brain-heuristics.js';
|
|
9
10
|
export { applyRule, BRAIN_RULE_PATTERN_MAX, BRAIN_RULE_SUBJECT_MAX, type BrainRule, type BrainRuleAction, type BrainRuleCompileResult, type BrainRuleMatch, type CompiledBrainRule, compileBrainRules, createRuleBrainArbiter, evaluateBrainRules, type RuleBrainArbiterOptions, ruleMatches, } from './coordination/brain-rules.js';
|
|
10
|
-
export { type BrainCacheStats, BrainDecisionCache, type BrainDecisionCacheOptions, brainCacheKey, type CachingBrainArbiterOptions, createCachingBrainArbiter, } from './coordination/brain-cache.js';
|
|
11
|
-
export { BrainCircuitBreaker, type BrainCircuitOptions, type BrainCircuitSnapshot, type BrainCircuitState, } from './execution/brain-circuit.js';
|
|
12
|
-
export { applyContentMode, BRAIN_TRACE_REDACTED_MAX, BRAIN_TRACE_VERSION, type BrainTraceContentMode, type BrainTraceCouncilResolution, type BrainTraceCouncilVote, type BrainTraceLlmCall, type BrainTraceRecord, BrainTraceRecorder, type BrainTraceRecorderOptions, type BrainTraceTierStep, readBrainTrace, sanitizeDecision, sanitizeRequest, } from './coordination/brain-trace.js';
|
|
13
11
|
export { type BrainDecisionTier, BrainTierCounter, type BrainTierStats, DETERMINISTIC_BRAIN_TIERS, isDeterministicTier, markDecisionTier, readDecisionTier, } from './coordination/brain-telemetry.js';
|
|
12
|
+
export { applyContentMode, BRAIN_TRACE_REDACTED_MAX, BRAIN_TRACE_VERSION, type BrainTraceContentMode, type BrainTraceCouncilResolution, type BrainTraceCouncilVote, type BrainTraceLlmCall, type BrainTraceRecord, BrainTraceRecorder, type BrainTraceRecorderOptions, type BrainTraceTierStep, readBrainTrace, sanitizeDecision, sanitizeRequest, } from './coordination/brain-trace.js';
|
|
14
13
|
export { type CollabBusState, CollaborationBus, type ConsumedInjectionInfo, } from './coordination/collab-bus.js';
|
|
15
14
|
export { assessCommitSafety, type CommitSafetyOptions, type CommitSafetyReport, type ForeignFile, } from './coordination/commit-safety.js';
|
|
16
15
|
export { DEPENDENCY_FILE_PATTERNS, type DependencyWatcherConfig, type DepWatchEntry, makeDependencyWatcherConfig, } from './coordination/dep-watcher.js';
|
|
@@ -45,7 +44,7 @@ export { startTechStackConsumer, type TechStackConsumerOptions, } from './coordi
|
|
|
45
44
|
export { type FleetWorktreePolicy, resolveSubagentWorktreeDecision, subagentNeedsWorktree, WorktreeIntegrationError, type WorktreeIsolationDecision, type WorktreeTaskRunnerOptions, type WorktreeTaskStateUpdate, wrapSubagentRunnerWithWorktrees, } from './coordination/worktree-task-runner.js';
|
|
46
45
|
export { Agent, type AgentInit, type AgentInput, type AgentPipelines, createDefaultPipelines, DEFAULT_MAX_ITERATIONS, type RunResult, type ToolCallPipelinePayload, type UserInputPayload, } from './core/agent.js';
|
|
47
46
|
export { buildBtwBlock, consumeBtwNotes, pendingBtwCount, setBtwNote, } from './core/btw.js';
|
|
48
|
-
export { Context, type ContextInit, type RunOptions, type TodoItem } from './core/context.js';
|
|
47
|
+
export { Context, type ContextInit, type ProviderMemoryEvidence, type RunOptions, type TodoItem, } from './core/context.js';
|
|
49
48
|
export { type ContinuationInput, type ContinuationSource, detectContinueIntent, type ResolvedContinuation, resolveContinuation, } from './core/continue-intent.js';
|
|
50
49
|
export { type ContinueDirective, makeContinueToNextIterationTool, parseContinueDirective, } from './core/continue-to-next-iteration.js';
|
|
51
50
|
export { ConversationState, type ReadonlyConversationState, type StateChange, type StateChangeHandler, wrapAsState, } from './core/conversation-state.js';
|
|
@@ -62,9 +61,10 @@ export { buildQueuedMessagesBlock, consumeQueuedMessagesUpdate, peekQueuedMessag
|
|
|
62
61
|
export { extractRunEnv, type RunEnv } from './core/run-env.js';
|
|
63
62
|
export { DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, LAYER_1_IDENTITY, SYSTEM_BLOCK_SOURCE, type SystemBlockSource, } from './core/system-prompt-builder.js';
|
|
64
63
|
export * from './defaults/index.js';
|
|
65
|
-
export { AutoCompactionMiddleware, type CompactorOptions, type CompactorStrategy, createStrategyCompactor, HybridCompactor,
|
|
64
|
+
export { AutoCompactionMiddleware, type CompactorOptions, type CompactorStrategy, createStrategyCompactor, HybridCompactor, IntelligentCompactor, type IntelligentCompactorOptions, installSubagentAutoCompaction, SelectiveCompactor, type SelectiveCompactorOptions, type StrategyCompactorOptions, } from './defaults/index.js';
|
|
66
65
|
export { type AutonomyBrainOptions, type BrainAutoRisk, type BrainLlmTarget, buildBrainUserMessage, completeBrainLlm, createAutonomyBrain, createTieredBrainArbiter, formatDecisionSummary, parseOptionDecision, type TieredBrainArbiterOptions, } from './execution/autonomy-brain.js';
|
|
67
66
|
export { assembleBrainTiers, type BrainTierAssembly, type BrainTierAssemblyOptions, } from './execution/brain-chain.js';
|
|
67
|
+
export { BrainCircuitBreaker, type BrainCircuitOptions, type BrainCircuitSnapshot, type BrainCircuitState, } from './execution/brain-circuit.js';
|
|
68
68
|
export { BRAIN_EVALUATION_CASE_VERSION, type BrainEvaluationCaseResult, type BrainEvaluationCaseV1, type BrainEvaluationCaseValidation, type BrainEvaluationExpectations, type BrainEvaluationFailure, type BrainEvaluationFailureCode, type BrainEvaluationMetrics, type BrainEvaluationReport, type BrainTraceCaptureOptions, brainTraceToEvaluationCase, runBrainEvaluation, validateBrainEvaluationCase, } from './execution/brain-evaluation.js';
|
|
69
69
|
export { type BrainApplyResult, type BrainConfigPatch, type BrainConfigSnapshot, type BrainCouncilMinRisk, type BrainCouncilPatch, type BrainDefaultsContext, type BrainPoolStrategy, type BrainRuntime, type BrainRuntimeLedgerHost, type BrainRuntimeOptions, createBrainRuntime, resolveBrainConfigDefaults, } from './execution/brain-runtime.js';
|
|
70
70
|
export { buildLosslessDigest, buildSmartDigest, type ContentScore, type EliseResult, eliseOldToolResults, estimateMessages, extractText, findPreserveStart, hasTextContent, scoreMessage, } from './execution/compaction-core.js';
|
|
@@ -83,27 +83,28 @@ export { type Checkpoint, CheckpointManager, type CheckpointManagerOptions, crea
|
|
|
83
83
|
export { countShellHooks, HookRegistry, type HookRunEnv, HookRunner, type HookRunnerOptions, hookMatcherMatches, type PreToolUseResult, type PromptResult, runShellHook, type ShellHookSpec, shellHooksEqual, } from './hooks/index.js';
|
|
84
84
|
export * from './hq/index.js';
|
|
85
85
|
export { allServers } from './infrastructure/mcp-servers.js';
|
|
86
|
-
export {
|
|
86
|
+
export { type ProviderCacheEntry, ProviderCacheLedger, } from './infrastructure/provider-cache-ledger.js';
|
|
87
87
|
export * from './kernel/index.js';
|
|
88
88
|
export { attachMailboxChecker } from './mailbox-attach.js';
|
|
89
89
|
export { type CollabPauseMiddlewareOptions, collabInjectMiddleware, collabPauseMiddleware, type InjectedToolResult as CollabInjectedToolResult, } from './middleware/collab-pause.js';
|
|
90
|
+
export { type NotificationChannel, type NotificationChannelStatus, type NotificationLevel, type NotificationMessage, type NotificationResult, type Notifier, type NotifierCounters, NotifierImpl, } from './notifications/index.js';
|
|
90
91
|
export * from './observability/network-telemetry.js';
|
|
91
92
|
export * from './observability/process-telemetry.js';
|
|
92
|
-
export { type NotificationChannel, type NotificationChannelStatus, type NotificationLevel, type NotificationMessage, type NotificationResult, type Notifier, type NotifierCounters, NotifierImpl, } from './notifications/index.js';
|
|
93
93
|
export { DefaultPluginAPI, definePlugin, type PluginAPIInit } from './plugin/api.js';
|
|
94
|
-
export { diffPluginConfig, type PluginConfigChange, type PluginConfigSource,
|
|
95
|
-
export { KERNEL_API_VERSION, type LoadPluginsOptions, type PluginHostHandle, type PluginLoadFailure,
|
|
94
|
+
export { diffPluginConfig, type PluginConfigChange, type PluginConfigSource, type ResolvedPluginConfig, type ResolvePluginConfigInput, redactPluginConfig, resolvePluginConfig, resolvePluginManifestConfig, validatePluginConfigMetadata, } from './plugin/config.js';
|
|
95
|
+
export { KERNEL_API_VERSION, type LoadPluginsOptions, loadPlugins, type PluginHostHandle, type PluginLoadFailure, unloadPlugins, } from './plugin/loader.js';
|
|
96
96
|
export { buildReviewerModelPool, createAutoReviewPlugin, parseReviewSeverity, type ReviewerModelAssignment, selectRoundRobinReviewerAssignment, } from './plugins/auto-review-plugin.js';
|
|
97
97
|
export type { CascadeAgentKind, ChimeraCascadeNeededPayload, ChimeraReviewCompletePayload, ChimeraReviewNeededPayload, ResolvedChimeraConfig, ReviewContextBundle, } from './plugins/chimera-plugin.js';
|
|
98
98
|
export { CHIMERA_REVIEW_PROMPT, createChimeraPlugin, resolveChimeraConfig, } from './plugins/chimera-plugin.js';
|
|
99
|
-
export {
|
|
100
|
-
export { executeFindingCommand, transitionReport, type FindingCommandContext, } from './plugins/review-finding-commands.js';
|
|
101
|
-
export { JsonlFindingStore, FINDING_STORE_FILE, type FindingStore, type ListOptions as FindingListOptions, type UpsertContext, type UpsertResult, } from './plugins/review-finding-store.js';
|
|
102
|
-
export type { ChimeraFinding, ChimeraFindingLocation, ChimeraFindingOrigin, ChimeraFindingResolution, FindingEventType, FindingLifecycleEvent, FindingSeverity, FindingSource, FindingStatus, ResolutionOutcome, } from './plugins/review-finding-types.js';
|
|
103
|
-
export { JsonlReportStore, REPORT_STORE_FILE, type PersistReportInput, type ReportStore, type ListReportsOptions, type ReportActor, } from './plugins/review-report-store.js';
|
|
104
|
-
export type { ReviewReport, ReviewReportCounts, ReviewReportEvent, ReviewReportFile, ReportEventType, ReportLifecycleStatus, } from './plugins/review-report-types.js';
|
|
105
|
-
export { persistReviewReport, syncReportCompletion, syncReportReopen, type ReportIntegrationResult, type ReportSyncResult, type ReportReopenResult, } from './plugins/review-report-integration.js';
|
|
99
|
+
export { createCloudConfigSyncPlugin } from './plugins/cloud-config-sync-plugin.js';
|
|
106
100
|
export { createPromptsPlugin } from './plugins/prompts-plugin.js';
|
|
101
|
+
export { executeFindingCommand, type FindingCommandContext, transitionReport, } from './plugins/review-finding-commands.js';
|
|
102
|
+
export { type FindingsIntegrationResult, integrateFindings, } from './plugins/review-finding-integration.js';
|
|
103
|
+
export { FINDING_STORE_FILE, type FindingStore, JsonlFindingStore, type ListOptions as FindingListOptions, type UpsertContext, type UpsertResult, } from './plugins/review-finding-store.js';
|
|
104
|
+
export type { ChimeraFinding, ChimeraFindingLocation, ChimeraFindingOrigin, ChimeraFindingResolution, FindingEventType, FindingLifecycleEvent, FindingSeverity, FindingSource, FindingStatus, ResolutionOutcome, } from './plugins/review-finding-types.js';
|
|
105
|
+
export { persistReviewReport, type ReportIntegrationResult, type ReportReopenResult, type ReportSyncResult, syncReportCompletion, syncReportReopen, } from './plugins/review-report-integration.js';
|
|
106
|
+
export { JsonlReportStore, type ListReportsOptions, type PersistReportInput, REPORT_STORE_FILE, type ReportActor, type ReportStore, } from './plugins/review-report-store.js';
|
|
107
|
+
export type { ReportEventType, ReportLifecycleStatus, ReviewReport, ReviewReportCounts, ReviewReportEvent, ReviewReportFile, } from './plugins/review-report-types.js';
|
|
107
108
|
export { createSkillsPlugin } from './plugins/skills-plugin.js';
|
|
108
109
|
export { createSyncPlugin } from './plugins/sync-plugin.js';
|
|
109
110
|
export * from './prompts/index.js';
|
|
@@ -114,8 +115,8 @@ export { ToolRegistry } from './registry/tool-registry.js';
|
|
|
114
115
|
export { hashRequest, stableStringify, } from './replay/hash.js';
|
|
115
116
|
export { type ReplayMode, ReplayProviderRunner, type ReplayProviderRunnerOptions, } from './replay/replay-provider-runner.js';
|
|
116
117
|
export { DANGEROUS_FOR_SUBAGENTS, getDangerousCapabilities, hasCapability, hasDangerousCapabilityForSubagents, ToolCapabilities, type ToolCapability, WIDE_SUBAGENT_CAPABILITIES, } from './security/capabilities.js';
|
|
117
|
-
export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './security/permission-policy-schema.js';
|
|
118
118
|
export { evaluateToolKanbanBoundary, type ToolKanbanBoundaryEvaluation, } from './security/kanban-boundary.js';
|
|
119
|
+
export { TRUST_POLICY_JSON_SCHEMA, TRUST_POLICY_LIMITS, TRUST_POLICY_SCHEMA_VERSION, type TrustPolicyDiagnostic, type TrustPolicyDiagnosticCode, type TrustPolicyValidationResult, validateTrustPolicy, } from './security/permission-policy-schema.js';
|
|
119
120
|
export { DefaultSecretScrubber } from './security/secret-scrubber.js';
|
|
120
121
|
export { getSessionRegistry, hasSessionRegistry, type SessionLiveStatus, SessionRegistry, type SessionRegistryEntry, } from './session-registry.js';
|
|
121
122
|
export * from './skills/index.js';
|
|
@@ -132,11 +133,11 @@ export { type CreatePluginManagerToolOptions, createPluginManagerTool, PLUGIN_MA
|
|
|
132
133
|
export type { Compactor, CompactReport } from './types/compactor.js';
|
|
133
134
|
export { CONTEXT_WINDOW_MODES, type ContextWindowAggressiveOn, type ContextWindowConfigLike, type ContextWindowMode, type ContextWindowModeId, type ContextWindowModeSelectionId, type ContextWindowPolicy, type ContextWindowThresholds, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEPRECATED_CONTEXT_WINDOW_MODE_ALIASES, type DeprecatedContextWindowModeId, formatContextWindowModeList, getContextWindowMode, isContextWindowModeId, isContextWindowModeSelectionId, isDeprecatedContextWindowModeId, listContextWindowModes, normalizeContextWindowModeId, resolveContextWindowPolicy, } from './types/context-window.js';
|
|
134
135
|
export { DEFAULT_SESSION_PRUNE_DAYS } from './types/default-config.js';
|
|
136
|
+
export type { FileEventRecord } from './types/file-event-record.js';
|
|
135
137
|
export * from './types/index.js';
|
|
136
138
|
export type { Logger, LogLevel } from './types/logger.js';
|
|
137
139
|
export type { ModelsDevModel, ModelsDevPayload, ModelsDevProvider, ModelsRegistry, ResolvedModel, ResolvedProvider, WireFamily, } from './types/models-registry.js';
|
|
138
140
|
export type { ProviderRunner, RunProviderOptions } from './types/provider-runner.js';
|
|
139
|
-
export type { FileEventRecord } from './types/file-event-record.js';
|
|
140
141
|
export type { SecretScrubber } from './types/secret-scrubber.js';
|
|
141
142
|
export type { RotatableSecretVault, SecretVault } from './types/secret-vault.js';
|
|
142
143
|
export { encryptedPrefixForVersion, noOpVault, parseEncryptedVersion, } from './types/secret-vault.js';
|