@wrongstack/core 0.107.2 → 0.109.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.
@@ -1,4 +1,4 @@
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-CUtmM_0V.js';
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-B2CbsKpc.js';
2
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-CI8lxeY1.js';
3
3
  import { P as Provider } from '../context-CNRYfhUv.js';
4
4
  import { B as BrainDecision, a as BrainDecisionRequest, b as BrainArbiter } from '../brain-Dfv4Y82E.js';
@@ -12,7 +12,7 @@ import '../config-BSU-6vah.js';
12
12
  import '../observability-D-HZN_mF.js';
13
13
  import '../permission-BDv7z0mk.js';
14
14
  import '../agent-subagent-runner-DukQLUcS.js';
15
- import '../goal-store-ht0VmR1A.js';
15
+ import '../goal-store-CV9Yz2X_.js';
16
16
  import '../multi-agent-coordinator-51LvnXkD.js';
17
17
  import 'node:events';
18
18
  import '../skill-Bj6Ezqb8.js';
@@ -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 * as path from 'path';
5
- import { randomUUID, createHash, randomBytes } from 'crypto';
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 = path.dirname(targetPath);
2067
+ const dir = path2.dirname(targetPath);
2068
2068
  await fs.mkdir(dir, { recursive: true });
2069
- const tmp = path.join(dir, `.${path.basename(targetPath)}.${randomBytes(6).toString("hex")}.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,12 +2124,62 @@ 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
+ inProjectAgentsFile: path2.join(opts.projectRoot, ".wrongstack", "AGENTS.md"),
2165
+ inProjectSkills: path2.join(opts.projectRoot, ".wrongstack", "skills"),
2166
+ inProjectWorktrees: path2.join(opts.projectRoot, ".wrongstack", "worktrees"),
2167
+ projectHash: hash,
2168
+ projectSlug: slug,
2169
+ projectGoal: path2.join(projectDir, "goal.json"),
2170
+ projectSpecs: path2.join(projectDir, "specs"),
2171
+ projectTaskGraphs: path2.join(projectDir, "task-graphs"),
2172
+ projectSddSession: path2.join(projectDir, "sdd-session.json"),
2173
+ projectPlan: path2.join(projectDir, "plan.json"),
2174
+ projectAutophase: path2.join(projectDir, "autophase"),
2175
+ syncConfig: path2.join(globalRoot, "sync.json")
2176
+ };
2177
+ }
2127
2178
 
2128
2179
  // src/storage/goal-store.ts
2129
2180
  var MAX_JOURNAL_ENTRIES = 500;
2130
2181
  function goalFilePath(projectRoot) {
2131
- const hash = createHash("sha256").update(path.resolve(projectRoot)).digest("hex").slice(0, 12);
2132
- return path.join(os.homedir(), ".wrongstack", "projects", hash, "goal.json");
2182
+ return resolveWstackPaths({ projectRoot }).projectGoal;
2133
2183
  }
2134
2184
  async function loadGoal(filePath) {
2135
2185
  let raw;
@@ -7624,7 +7674,7 @@ var DefaultSkillLoader = class {
7624
7674
  const entries = await fs.readdir(dir, { withFileTypes: true });
7625
7675
  for (const e of entries) {
7626
7676
  if (!e.isDirectory()) continue;
7627
- const skillFile = path.join(dir, e.name, "SKILL.md");
7677
+ const skillFile = path2.join(dir, e.name, "SKILL.md");
7628
7678
  try {
7629
7679
  const raw = await fs.readFile(skillFile, "utf8");
7630
7680
  const meta = parseFrontmatter(raw);