@wrongstack/core 0.107.2 → 0.119.1
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-bridge-mOxbpFcg.d.ts → agent-bridge-PRAbEX-9.d.ts} +1 -1
- package/dist/{agent-subagent-runner-DukQLUcS.d.ts → agent-subagent-runner-DXWImnNV.d.ts} +7 -8
- package/dist/{brain-Dfv4Y82E.d.ts → brain-NZZqL8sn.d.ts} +1 -1
- package/dist/{compactor-DXLxLcmU.d.ts → compactor-C3stu664.d.ts} +1 -1
- package/dist/{config-BSU-6vah.d.ts → config-DZV9VK9n.d.ts} +104 -3
- package/dist/{context-CNRYfhUv.d.ts → context-hvXINa6a.d.ts} +31 -1
- package/dist/coordination/index.d.ts +12 -13
- package/dist/coordination/index.js +198 -0
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +27 -28
- package/dist/defaults/index.js +346 -86
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +16 -17
- package/dist/execution/index.js +266 -12
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -7
- package/dist/{goal-preamble-CI8lxeY1.d.ts → goal-preamble-COpt55W8.d.ts} +10 -10
- package/dist/{goal-store-ht0VmR1A.d.ts → goal-store-CV9Yz2X_.d.ts} +11 -0
- package/dist/{index-DIKEcfgC.d.ts → index-4VVHuTZF.d.ts} +7 -6
- package/dist/{index-BWRN6wOb.d.ts → index-Cj3le7TI.d.ts} +9 -10
- package/dist/index.d.ts +41 -42
- package/dist/index.js +372 -118
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -7
- package/dist/kernel/index.d.ts +10 -11
- package/dist/llm-selector-Bmx4PsVM.d.ts +58 -0
- package/dist/{mcp-servers-CXCsANdY.d.ts → mcp-servers-CofNHOqn.d.ts} +3 -3
- package/dist/{mode-ARA3HrkY.d.ts → mode-CZlO9iU1.d.ts} +1 -1
- package/dist/models/index.d.ts +157 -53
- package/dist/models/index.js +423 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-DU64QxQa.d.ts → models-registry-BzlsjKcy.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-51LvnXkD.d.ts → multi-agent-coordinator-CmDmUgq2.d.ts} +1 -1
- package/dist/{null-fleet-bus-D09hMzFQ.d.ts → null-fleet-bus-CyH2YqP4.d.ts} +6 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-CUtmM_0V.d.ts → parallel-eternal-engine-uxVm4y4V.d.ts} +11 -10
- package/dist/{path-resolver-DDJiMAtX.d.ts → path-resolver-gfoGxpdd.d.ts} +3 -3
- package/dist/{permission-BDv7z0mk.d.ts → permission-DhLrgA30.d.ts} +1 -1
- package/dist/{permission-policy-dF74EpDp.d.ts → permission-policy-DGOvne7i.d.ts} +2 -2
- package/dist/{pipeline-BqiA_UMr.d.ts → pipeline-CqF7uju2.d.ts} +2 -2
- package/dist/{plan-templates-BdDxl9cI.d.ts → plan-templates-DoKhzenv.d.ts} +6 -6
- package/dist/{provider-runner-BUunikwY.d.ts → provider-runner-BPlI5sPZ.d.ts} +3 -3
- package/dist/{retry-policy-BcmuT_V0.d.ts → retry-policy-B4Q-FZgE.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -9
- package/dist/sdd/index.js +198 -0
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-DrOhc2i5.d.ts → secret-vault-B7GnL6o9.d.ts} +1 -1
- package/dist/security/index.d.ts +4 -4
- package/dist/{selector-C7wcdqMA.d.ts → selector-BakeMnWR.d.ts} +1 -1
- package/dist/{session-event-bridge-BpJ5trO9.d.ts → session-event-bridge-DE5Oekwx.d.ts} +1 -1
- package/dist/{session-reader-DDz1Ek4V.d.ts → session-reader-DFC81-4p.d.ts} +1 -1
- package/dist/storage/index.d.ts +12 -13
- package/dist/storage/index.js +147 -88
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +20 -21
- package/dist/types/index.js +35 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-_lqjzErq.d.ts → wstack-paths-DD50Omgn.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/models-registry-B6_KfS65.d.ts +0 -95
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-
|
|
2
|
-
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-
|
|
3
|
-
import { P as Provider } from '../context-
|
|
4
|
-
import { B as BrainDecision, a as BrainDecisionRequest, b as BrainArbiter } from '../brain-
|
|
5
|
-
import '../retry-policy-
|
|
6
|
-
import '../compactor-
|
|
7
|
-
import '../
|
|
8
|
-
import '../index-
|
|
1
|
+
export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-uxVm4y4V.js';
|
|
2
|
+
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-COpt55W8.js';
|
|
3
|
+
import { P as Provider } from '../context-hvXINa6a.js';
|
|
4
|
+
import { B as BrainDecision, a as BrainDecisionRequest, b as BrainArbiter } from '../brain-NZZqL8sn.js';
|
|
5
|
+
import '../retry-policy-B4Q-FZgE.js';
|
|
6
|
+
import '../compactor-C3stu664.js';
|
|
7
|
+
import '../config-DZV9VK9n.js';
|
|
8
|
+
import '../index-4VVHuTZF.js';
|
|
9
9
|
import '../logger-B63L5bTg.js';
|
|
10
|
-
import '../pipeline-
|
|
11
|
-
import '../config-BSU-6vah.js';
|
|
10
|
+
import '../pipeline-CqF7uju2.js';
|
|
12
11
|
import '../observability-D-HZN_mF.js';
|
|
13
|
-
import '../permission-
|
|
14
|
-
import '../agent-subagent-runner-
|
|
15
|
-
import '../goal-store-
|
|
16
|
-
import '../multi-agent-coordinator-
|
|
12
|
+
import '../permission-DhLrgA30.js';
|
|
13
|
+
import '../agent-subagent-runner-DXWImnNV.js';
|
|
14
|
+
import '../goal-store-CV9Yz2X_.js';
|
|
15
|
+
import '../multi-agent-coordinator-CmDmUgq2.js';
|
|
17
16
|
import 'node:events';
|
|
18
17
|
import '../skill-Bj6Ezqb8.js';
|
|
19
|
-
import '../wstack-paths-
|
|
20
|
-
import '../selector-
|
|
21
|
-
import '../session-event-bridge-
|
|
18
|
+
import '../wstack-paths-DD50Omgn.js';
|
|
19
|
+
import '../selector-BakeMnWR.js';
|
|
20
|
+
import '../session-event-bridge-DE5Oekwx.js';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* AutonomyBrain — a self-driving decision layer for autonomous workflows.
|
package/dist/execution/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { execFile } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
3
|
import * as fs from 'fs/promises';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
5
|
+
import * as path2 from 'path';
|
|
6
6
|
import * as os from 'os';
|
|
7
7
|
import { EventEmitter } from 'events';
|
|
8
8
|
|
|
@@ -2064,9 +2064,9 @@ var AutonomousRunner = class {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
};
|
|
2066
2066
|
async function atomicWrite(targetPath, content, opts = {}) {
|
|
2067
|
-
const dir =
|
|
2067
|
+
const dir = path2.dirname(targetPath);
|
|
2068
2068
|
await fs.mkdir(dir, { recursive: true });
|
|
2069
|
-
const tmp =
|
|
2069
|
+
const tmp = path2.join(dir, `.${path2.basename(targetPath)}.${randomBytes(6).toString("hex")}.tmp`);
|
|
2070
2070
|
try {
|
|
2071
2071
|
if (typeof content === "string") {
|
|
2072
2072
|
await fs.writeFile(tmp, content, { flag: "wx", encoding: opts.encoding ?? "utf8" });
|
|
@@ -2124,27 +2124,82 @@ async function renameWithRetry(from, to) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
throw lastErr;
|
|
2126
2126
|
}
|
|
2127
|
+
function projectHash(absRoot) {
|
|
2128
|
+
return createHash("sha256").update(path2.resolve(absRoot)).digest("hex").slice(0, 12);
|
|
2129
|
+
}
|
|
2130
|
+
function projectSlug(absRoot) {
|
|
2131
|
+
const base = slugify(path2.basename(absRoot));
|
|
2132
|
+
const hash = createHash("sha256").update(path2.resolve(absRoot)).digest("hex").slice(0, 6);
|
|
2133
|
+
return `${base}-${hash}`;
|
|
2134
|
+
}
|
|
2135
|
+
function slugify(name) {
|
|
2136
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "project";
|
|
2137
|
+
}
|
|
2138
|
+
function resolveWstackPaths(opts) {
|
|
2139
|
+
const home = opts.userHome ?? os.homedir();
|
|
2140
|
+
const globalRoot = opts.globalRoot ?? path2.join(home, ".wrongstack");
|
|
2141
|
+
const hash = projectHash(opts.projectRoot);
|
|
2142
|
+
const slug = projectSlug(opts.projectRoot);
|
|
2143
|
+
const projectDir = path2.join(globalRoot, "projects", slug);
|
|
2144
|
+
return {
|
|
2145
|
+
globalRoot,
|
|
2146
|
+
configDir: globalRoot,
|
|
2147
|
+
globalConfig: path2.join(globalRoot, "config.json"),
|
|
2148
|
+
secretsKey: path2.join(globalRoot, ".key"),
|
|
2149
|
+
globalMemory: path2.join(globalRoot, "memory.md"),
|
|
2150
|
+
globalSkills: path2.join(globalRoot, "skills"),
|
|
2151
|
+
globalPrompts: path2.join(globalRoot, "prompts"),
|
|
2152
|
+
cacheDir: path2.join(globalRoot, "cache"),
|
|
2153
|
+
modelsCache: path2.join(globalRoot, "cache", "models.dev.json"),
|
|
2154
|
+
modelsOverlayCache: path2.join(globalRoot, "cache", "models-overlay.json"),
|
|
2155
|
+
historyFile: path2.join(globalRoot, "history"),
|
|
2156
|
+
logFile: path2.join(globalRoot, "logs", "wrongstack.log"),
|
|
2157
|
+
projectDir,
|
|
2158
|
+
projectCodebaseIndex: path2.join(projectDir, "codebase-index"),
|
|
2159
|
+
projectMemory: path2.join(projectDir, "memory.md"),
|
|
2160
|
+
projectSessions: path2.join(projectDir, "sessions"),
|
|
2161
|
+
projectTrust: path2.join(projectDir, "trust.json"),
|
|
2162
|
+
projectMeta: path2.join(projectDir, "meta.json"),
|
|
2163
|
+
projectLocalConfig: path2.join(projectDir, "config.local.json"),
|
|
2164
|
+
inProjectConfig: path2.join(opts.projectRoot, ".wrongstack", "config.json"),
|
|
2165
|
+
inProjectAgentsFile: path2.join(opts.projectRoot, ".wrongstack", "AGENTS.md"),
|
|
2166
|
+
inProjectSkills: path2.join(opts.projectRoot, ".wrongstack", "skills"),
|
|
2167
|
+
inProjectWorktrees: path2.join(opts.projectRoot, ".wrongstack", "worktrees"),
|
|
2168
|
+
projectHash: hash,
|
|
2169
|
+
projectSlug: slug,
|
|
2170
|
+
projectGoal: path2.join(projectDir, "goal.json"),
|
|
2171
|
+
projectSpecs: path2.join(projectDir, "specs"),
|
|
2172
|
+
projectTaskGraphs: path2.join(projectDir, "task-graphs"),
|
|
2173
|
+
projectSddSession: path2.join(projectDir, "sdd-session.json"),
|
|
2174
|
+
projectPlan: path2.join(projectDir, "plan.json"),
|
|
2175
|
+
projectAutophase: path2.join(projectDir, "autophase"),
|
|
2176
|
+
syncConfig: path2.join(globalRoot, "sync.json")
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2127
2179
|
|
|
2128
2180
|
// src/storage/goal-store.ts
|
|
2129
2181
|
var MAX_JOURNAL_ENTRIES = 500;
|
|
2130
2182
|
function goalFilePath(projectRoot) {
|
|
2131
|
-
|
|
2132
|
-
return path.join(os.homedir(), ".wrongstack", "projects", hash, "goal.json");
|
|
2183
|
+
return resolveWstackPaths({ projectRoot }).projectGoal;
|
|
2133
2184
|
}
|
|
2134
2185
|
async function loadGoal(filePath) {
|
|
2135
2186
|
let raw;
|
|
2136
2187
|
try {
|
|
2137
2188
|
raw = await fs.readFile(filePath, "utf8");
|
|
2138
|
-
} catch {
|
|
2139
|
-
|
|
2189
|
+
} catch (err) {
|
|
2190
|
+
const code = err.code;
|
|
2191
|
+
if (code === "ENOENT") return null;
|
|
2192
|
+
throw err;
|
|
2140
2193
|
}
|
|
2141
2194
|
try {
|
|
2142
2195
|
const parsed = JSON.parse(raw);
|
|
2143
2196
|
if (parsed?.version !== 1 || typeof parsed.goal !== "string" || !Array.isArray(parsed.journal)) {
|
|
2197
|
+
console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 invalid schema. Consider deleting it and re-creating.`);
|
|
2144
2198
|
return null;
|
|
2145
2199
|
}
|
|
2146
2200
|
return parsed;
|
|
2147
2201
|
} catch {
|
|
2202
|
+
console.warn(`[goal-store] Corrupt goal.json at ${filePath} \u2014 JSON parse failed. Consider deleting it and re-creating.`);
|
|
2148
2203
|
return null;
|
|
2149
2204
|
}
|
|
2150
2205
|
}
|
|
@@ -2198,7 +2253,7 @@ function computeTrend(history) {
|
|
|
2198
2253
|
const recent = history.slice(-5);
|
|
2199
2254
|
const deltas = [];
|
|
2200
2255
|
for (let i = 1; i < recent.length; i++) {
|
|
2201
|
-
deltas.push(recent[i]
|
|
2256
|
+
deltas.push((recent[i]?.progress ?? 0) - (recent[i - 1]?.progress ?? 0));
|
|
2202
2257
|
}
|
|
2203
2258
|
if (deltas.length < 2) return void 0;
|
|
2204
2259
|
const avgDelta = deltas.reduce((a, b) => a + b, 0) / deltas.length;
|
|
@@ -2957,8 +3012,8 @@ ${recentJournal}` : "No prior iterations.",
|
|
|
2957
3012
|
await saveGoal(this.goalPath, abandoned);
|
|
2958
3013
|
}
|
|
2959
3014
|
try {
|
|
2960
|
-
const { unlink:
|
|
2961
|
-
await
|
|
3015
|
+
const { unlink: unlink3 } = await import('fs/promises');
|
|
3016
|
+
await unlink3(this.goalPath);
|
|
2962
3017
|
} catch {
|
|
2963
3018
|
}
|
|
2964
3019
|
this.opts.onEternalStop?.();
|
|
@@ -3959,6 +4014,53 @@ Working rules:
|
|
|
3959
4014
|
"flaws"
|
|
3960
4015
|
]
|
|
3961
4016
|
}
|
|
4017
|
+
},
|
|
4018
|
+
{
|
|
4019
|
+
config: {
|
|
4020
|
+
id: "refactor-planner",
|
|
4021
|
+
name: "Refactor Planner",
|
|
4022
|
+
role: "refactor-planner",
|
|
4023
|
+
tools: [...PLAN_TOOLS, "diff"],
|
|
4024
|
+
prompt: `You are the Refactor Planner agent. Your job is to analyze code
|
|
4025
|
+
structure and produce a concrete, phased refactoring plan with risk
|
|
4026
|
+
assessment, dependency ordering, and rollback strategy.
|
|
4027
|
+
|
|
4028
|
+
Scope:
|
|
4029
|
+
- Map module-level dependencies (import graph)
|
|
4030
|
+
- Identify coupling hotspots (high fan-in/out modules)
|
|
4031
|
+
- Assess refactoring risk by complexity and test coverage
|
|
4032
|
+
- Generate phased plans with checkpoint milestones
|
|
4033
|
+
- Produce diff-friendly task lists (one task = one concern)
|
|
4034
|
+
|
|
4035
|
+
Input format you accept:
|
|
4036
|
+
{ "task": "plan | assess | roadmap", "target": "src/core", "constraint": "no-breaking-changes | minimal-downtime | full-rewrite", "focus": "architecture | performance | maintainability" }
|
|
4037
|
+
|
|
4038
|
+
Output: Markdown refactor plan with phases (Low Risk / Medium Risk / High Risk),
|
|
4039
|
+
dependency graph, rollback strategy, and exit criteria.
|
|
4040
|
+
|
|
4041
|
+
Working rules:
|
|
4042
|
+
- Always include rollback strategy \u2014 every refactor can fail
|
|
4043
|
+
- Merge tasks that take <1h into a single phase
|
|
4044
|
+
- Respect team constraints (reviewer availability, parallelization)
|
|
4045
|
+
- Never plan without analyzing the actual code first`
|
|
4046
|
+
},
|
|
4047
|
+
budget: HEAVY_BUDGET,
|
|
4048
|
+
capability: {
|
|
4049
|
+
phase: "planning",
|
|
4050
|
+
summary: "Refactoring planner: analyzes code structure, maps dependencies, produces risk-scored phased plans with rollback strategy.",
|
|
4051
|
+
keywords: [
|
|
4052
|
+
"refactor",
|
|
4053
|
+
"refactoring",
|
|
4054
|
+
"restructure",
|
|
4055
|
+
"debt",
|
|
4056
|
+
"technical debt",
|
|
4057
|
+
"clean up",
|
|
4058
|
+
"modularize",
|
|
4059
|
+
"decouple",
|
|
4060
|
+
"dependency graph",
|
|
4061
|
+
"code structure"
|
|
4062
|
+
]
|
|
4063
|
+
}
|
|
3962
4064
|
}
|
|
3963
4065
|
];
|
|
3964
4066
|
|
|
@@ -4498,6 +4600,157 @@ Working rules:
|
|
|
4498
4600
|
"robustness"
|
|
4499
4601
|
]
|
|
4500
4602
|
}
|
|
4603
|
+
},
|
|
4604
|
+
{
|
|
4605
|
+
config: {
|
|
4606
|
+
id: "security-scanner",
|
|
4607
|
+
name: "Security Scanner",
|
|
4608
|
+
role: "security-scanner",
|
|
4609
|
+
tools: [...TOOLS.inspect],
|
|
4610
|
+
prompt: `You are the Security Scanner agent. Your job is to scan code,
|
|
4611
|
+
configs, and dependencies for security issues from hardcoded secrets to
|
|
4612
|
+
supply chain risks.
|
|
4613
|
+
|
|
4614
|
+
Scope:
|
|
4615
|
+
- Detect hardcoded secrets: API keys, tokens, passwords, private keys
|
|
4616
|
+
- Find injection vectors: eval, innerHTML, SQL concat, shell injection
|
|
4617
|
+
- Identify insecure patterns: weak crypto, hardcoded IVs, disabled TLS
|
|
4618
|
+
- Scan dependencies for known CVEs (via npm/pnpm audit)
|
|
4619
|
+
- Flag supply chain risks: postinstall hooks, unverified scripts
|
|
4620
|
+
|
|
4621
|
+
Input format you accept:
|
|
4622
|
+
{ "task": "scan | audit | secrets | dependencies", "paths": ["src", "config"], "depth": "quick | normal | deep" }
|
|
4623
|
+
|
|
4624
|
+
Output: Markdown security report with severity-ranked findings, injection
|
|
4625
|
+
vectors, dependency issues, and a remediation checklist.
|
|
4626
|
+
|
|
4627
|
+
Working rules:
|
|
4628
|
+
- Never scan node_modules \u2014 use npm audit instead
|
|
4629
|
+
- Always provide remediation steps, not just findings
|
|
4630
|
+
- Verify regex-based secrets before flagging (false positive risk)
|
|
4631
|
+
- When in doubt, flag as medium rather than ignoring potential issues`
|
|
4632
|
+
},
|
|
4633
|
+
budget: HEAVY_BUDGET,
|
|
4634
|
+
capability: {
|
|
4635
|
+
phase: "verify",
|
|
4636
|
+
summary: "Security scanner: detects hardcoded secrets, injection vectors, insecure patterns, and supply-chain risks with remediation.",
|
|
4637
|
+
keywords: [
|
|
4638
|
+
"security",
|
|
4639
|
+
"scan",
|
|
4640
|
+
"vulnerability",
|
|
4641
|
+
"secret",
|
|
4642
|
+
"api key",
|
|
4643
|
+
"hardcoded",
|
|
4644
|
+
"injection",
|
|
4645
|
+
"cve",
|
|
4646
|
+
"audit dependencies",
|
|
4647
|
+
"supply chain",
|
|
4648
|
+
"xss",
|
|
4649
|
+
"sqli",
|
|
4650
|
+
"shell injection",
|
|
4651
|
+
"sensitive data",
|
|
4652
|
+
"credential"
|
|
4653
|
+
]
|
|
4654
|
+
}
|
|
4655
|
+
},
|
|
4656
|
+
{
|
|
4657
|
+
config: {
|
|
4658
|
+
id: "bug-hunter",
|
|
4659
|
+
name: "Bug Hunter",
|
|
4660
|
+
role: "bug-hunter",
|
|
4661
|
+
tools: [...TOOLS.inspect],
|
|
4662
|
+
prompt: `You are the Bug Hunter agent. Your job is to systematically scan
|
|
4663
|
+
source code for bugs, anti-patterns, and code smells using pattern matching
|
|
4664
|
+
and heuristics. Output a prioritized hit list with file:line references.
|
|
4665
|
+
|
|
4666
|
+
Scope:
|
|
4667
|
+
- Detect common bug patterns (uncaught errors, resource leaks, race conditions)
|
|
4668
|
+
- Identify anti-patterns (callback hell, God objects, circular deps)
|
|
4669
|
+
- Find TypeScript-specific issues (unsafe any, missing null checks, branded types)
|
|
4670
|
+
- Flag security-sensitive constructs (eval, innerHTML, hardcoded secrets)
|
|
4671
|
+
- Rank findings: critical > high > medium > low
|
|
4672
|
+
|
|
4673
|
+
Input format you accept:
|
|
4674
|
+
{ "task": "scan | hunt | check", "paths": ["src/**/*.ts"], "focus": "bugs | patterns | security | all", "severityThreshold": "medium" }
|
|
4675
|
+
|
|
4676
|
+
Output: Markdown bug hunt report with critically/high/medium/low sections.
|
|
4677
|
+
Each entry: **[TYPE]** \`file:line\` \u2014 description + suggested fix
|
|
4678
|
+
|
|
4679
|
+
Working rules:
|
|
4680
|
+
- Never scan node_modules \u2014 it's noise
|
|
4681
|
+
- Always include file:line for every finding
|
|
4682
|
+
- If >30% of findings are false positives, note the confidence level
|
|
4683
|
+
- Ask director for clarification if paths are ambiguous`
|
|
4684
|
+
},
|
|
4685
|
+
budget: HEAVY_BUDGET,
|
|
4686
|
+
capability: {
|
|
4687
|
+
phase: "verify",
|
|
4688
|
+
summary: "Bug hunter: scans source code for bugs, anti-patterns, and code smells, producing a file:line-ranked hit list with fixes.",
|
|
4689
|
+
keywords: [
|
|
4690
|
+
"bug",
|
|
4691
|
+
"hunt",
|
|
4692
|
+
"scan",
|
|
4693
|
+
"code smell",
|
|
4694
|
+
"anti-pattern",
|
|
4695
|
+
"race condition",
|
|
4696
|
+
"memory leak",
|
|
4697
|
+
"null deref",
|
|
4698
|
+
"type safety",
|
|
4699
|
+
"unhandled error",
|
|
4700
|
+
"find bugs",
|
|
4701
|
+
"audit code",
|
|
4702
|
+
"code quality"
|
|
4703
|
+
]
|
|
4704
|
+
}
|
|
4705
|
+
},
|
|
4706
|
+
{
|
|
4707
|
+
config: {
|
|
4708
|
+
id: "audit-log",
|
|
4709
|
+
name: "Audit Log",
|
|
4710
|
+
role: "audit-log",
|
|
4711
|
+
tools: [...TOOLS.inspect],
|
|
4712
|
+
prompt: `You are the Audit Log agent. Your job is to analyze structured JSONL
|
|
4713
|
+
session logs and produce actionable markdown reports.
|
|
4714
|
+
|
|
4715
|
+
Scope:
|
|
4716
|
+
- Parse session logs (iteration counts, tool calls, errors, usage)
|
|
4717
|
+
- Detect repeated failure patterns across multiple runs
|
|
4718
|
+
- Identify tool usage anomalies (over-use, failures, unexpected chains)
|
|
4719
|
+
- Track token consumption trends
|
|
4720
|
+
- Generate structured audit reports with severity ratings
|
|
4721
|
+
|
|
4722
|
+
Input format you accept:
|
|
4723
|
+
{ "task": "analyze | report | trends", "sessionPath": "<path>", "focus": "errors | tools | usage | all" }
|
|
4724
|
+
|
|
4725
|
+
Output: Markdown audit report with Summary, Top Errors, Tool Usage table,
|
|
4726
|
+
Anomalies, and Cost Trend sections.
|
|
4727
|
+
|
|
4728
|
+
Working rules:
|
|
4729
|
+
- Never fabricate numbers \u2014 read the actual logs first
|
|
4730
|
+
- Always include file:line references for errors
|
|
4731
|
+
- If sessionPath is missing, ask the director to provide it
|
|
4732
|
+
- Report confidence level: high (>90% accuracy), medium, low`
|
|
4733
|
+
},
|
|
4734
|
+
budget: MEDIUM_BUDGET,
|
|
4735
|
+
capability: {
|
|
4736
|
+
phase: "verify",
|
|
4737
|
+
summary: "Audit log analyzer: parses session JSONL, detects failure patterns, tool anomalies, and cost trends with structured reports.",
|
|
4738
|
+
keywords: [
|
|
4739
|
+
"audit",
|
|
4740
|
+
"log",
|
|
4741
|
+
"logs",
|
|
4742
|
+
"session",
|
|
4743
|
+
"trace",
|
|
4744
|
+
"analyze logs",
|
|
4745
|
+
"error patterns",
|
|
4746
|
+
"cost analysis",
|
|
4747
|
+
"tool usage",
|
|
4748
|
+
"token usage",
|
|
4749
|
+
"post-mortem",
|
|
4750
|
+
"trend",
|
|
4751
|
+
"anomaly"
|
|
4752
|
+
]
|
|
4753
|
+
}
|
|
4501
4754
|
}
|
|
4502
4755
|
];
|
|
4503
4756
|
|
|
@@ -7505,6 +7758,7 @@ var DefaultRetryPolicy = class {
|
|
|
7505
7758
|
if (err instanceof ProviderError) {
|
|
7506
7759
|
if (err.status === 429) return 5;
|
|
7507
7760
|
if (err.status === 529) return 3;
|
|
7761
|
+
if (err.status === 599) return 5;
|
|
7508
7762
|
if (err.status >= 500) return 3;
|
|
7509
7763
|
return 0;
|
|
7510
7764
|
}
|
|
@@ -7624,7 +7878,7 @@ var DefaultSkillLoader = class {
|
|
|
7624
7878
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
7625
7879
|
for (const e of entries) {
|
|
7626
7880
|
if (!e.isDirectory()) continue;
|
|
7627
|
-
const skillFile =
|
|
7881
|
+
const skillFile = path2.join(dir, e.name, "SKILL.md");
|
|
7628
7882
|
try {
|
|
7629
7883
|
const raw = await fs.readFile(skillFile, "utf8");
|
|
7630
7884
|
const meta = parseFrontmatter(raw);
|