@wrongstack/core 0.104.0 → 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.
- package/dist/defaults/index.d.ts +2 -2
- package/dist/defaults/index.js +103 -51
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +2 -2
- package/dist/execution/index.js +57 -7
- package/dist/execution/index.js.map +1 -1
- package/dist/{goal-store-ht0VmR1A.d.ts → goal-store-CV9Yz2X_.d.ts} +11 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +74 -75
- package/dist/index.js.map +1 -1
- package/dist/{parallel-eternal-engine-CUtmM_0V.d.ts → parallel-eternal-engine-B2CbsKpc.d.ts} +3 -2
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +104 -54
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
|
@@ -81,6 +81,17 @@ interface GoalFile {
|
|
|
81
81
|
declare const MAX_JOURNAL_ENTRIES = 500;
|
|
82
82
|
/**
|
|
83
83
|
* Resolve the goal file path for a given project root.
|
|
84
|
+
*
|
|
85
|
+
* SINGLE canonical location: the per-project directory that
|
|
86
|
+
* `resolveWstackPaths()` uses for everything else (sessions, memory, specs) —
|
|
87
|
+
* `~/.wrongstack/projects/<slug>/goal.json`. This is the same path the `/goal`
|
|
88
|
+
* slash command writes via `opts.paths.projectGoal`, so every reader/writer
|
|
89
|
+
* (the eternal/parallel autonomy engines, the CLI autonomy commands, the TUI
|
|
90
|
+
* F9 panel, and `/goal` itself) now agree on one file.
|
|
91
|
+
*
|
|
92
|
+
* Previously this returned a SEPARATE hash-based dir (`projects/<hash>/`), which
|
|
93
|
+
* disagreed with `/goal` and littered the home dir with thousands of stray
|
|
94
|
+
* `<hash>/goal.json` directories that held nothing else.
|
|
84
95
|
*/
|
|
85
96
|
declare function goalFilePath(projectRoot: string): string;
|
|
86
97
|
declare function loadGoal(filePath: string): Promise<GoalFile | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { D as DefaultLogger } from './logger-B9J5puGM.js';
|
|
|
21
21
|
export { a as DefaultLoggerOptions } from './logger-B9J5puGM.js';
|
|
22
22
|
import { D as DefaultPathResolver } from './path-resolver-DDJiMAtX.js';
|
|
23
23
|
export { a as DefaultTokenCounter } from './path-resolver-DDJiMAtX.js';
|
|
24
|
-
export { C as CompactorOptions, g as DEFAULT_RECOVERY_STRATEGIES, 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, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from './parallel-eternal-engine-
|
|
24
|
+
export { C as CompactorOptions, g as DEFAULT_RECOVERY_STRATEGIES, 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, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from './parallel-eternal-engine-B2CbsKpc.js';
|
|
25
25
|
import { S as SkillLoader } from './skill-Bj6Ezqb8.js';
|
|
26
26
|
export { b as SkillEntry, a as SkillManifest } from './skill-Bj6Ezqb8.js';
|
|
27
27
|
export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
|
|
@@ -60,7 +60,7 @@ export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManage
|
|
|
60
60
|
export { DownloadResult, InstallResult, InstalledSkillEntry, ManifestData, ParsedRef, SkillInstaller, SkillInstallerOptions, SkillManifestStore, UpdateResult, downloadGitHubTarball, parseSkillRef } from './skills/index.js';
|
|
61
61
|
import { ReplayLogStore, DefaultPromptStore } from './storage/index.js';
|
|
62
62
|
export { ALL_SYNC_CATEGORIES, Annotation, AnnotationsStore, AnnotationsStoreOptions, AuditEntry, CloudSync, ConsolidationOp, DefaultSessionRewinder, GraphMemoryBackend, GraphMemoryBackendOptions, MemoryConsolidatorOptions, PromptEntry, PromptStore, RecoveryPlan, ReplayEntry, ReplayLogStoreOptions, SessionMemoryConsolidator, SessionRecovery, SessionRewinderOptions, StaleSession, SyncResult, TaskFile, ToolAuditLog, ToolAuditLogOptions, VerifyResult, emptyTaskFile, loadTasks, saveTasks } from './storage/index.js';
|
|
63
|
-
export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as MAX_PROGRESS_HISTORY, P as ProgressSnapshot, b as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, p as parseProgressFromText, r as recordProgress, s as saveGoal, c as setProgress, d as summarizeUsage } from './goal-store-
|
|
63
|
+
export { G as GoalFile, J as JournalEntry, M as MAX_JOURNAL_ENTRIES, a as MAX_PROGRESS_HISTORY, P as ProgressSnapshot, b as appendJournal, e as emptyGoal, f as formatGoal, g as goalFilePath, l as loadGoal, p as parseProgressFromText, r as recordProgress, s as saveGoal, c as setProgress, d as summarizeUsage } from './goal-store-CV9Yz2X_.js';
|
|
64
64
|
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-BcmuT_V0.js';
|
|
65
65
|
import { L as Logger } from './logger-B63L5bTg.js';
|
|
66
66
|
export { a as LogLevel } from './logger-B63L5bTg.js';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { readFile, readdir, stat, mkdir } from 'fs/promises';
|
|
|
5
5
|
import * as path6 from 'path';
|
|
6
6
|
import { join, extname, relative, isAbsolute, resolve, sep } from 'path';
|
|
7
7
|
import * as fs2 from 'fs';
|
|
8
|
-
import * as
|
|
8
|
+
import * as os6 from 'os';
|
|
9
9
|
import { hostname } from 'os';
|
|
10
10
|
import { execFile, spawn } from 'child_process';
|
|
11
11
|
import { promisify } from 'util';
|
|
@@ -99,7 +99,7 @@ async function withFileLock(targetPath, fn, opts = {}) {
|
|
|
99
99
|
if (Date.now() - started >= timeoutMs) {
|
|
100
100
|
throw new Error(`Timed out waiting for file lock: ${targetPath}`);
|
|
101
101
|
}
|
|
102
|
-
await new Promise((
|
|
102
|
+
await new Promise((resolve12) => setTimeout(resolve12, 25));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
@@ -132,7 +132,7 @@ async function renameWithRetry(from, to) {
|
|
|
132
132
|
if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {
|
|
133
133
|
throw err;
|
|
134
134
|
}
|
|
135
|
-
await new Promise((
|
|
135
|
+
await new Promise((resolve12) => setTimeout(resolve12, delays[i]));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
throw lastErr;
|
|
@@ -2139,7 +2139,7 @@ var DefaultPathResolver = class {
|
|
|
2139
2139
|
detectProjectRoot(start) {
|
|
2140
2140
|
let dir = path6.resolve(start);
|
|
2141
2141
|
const root = path6.parse(dir).root;
|
|
2142
|
-
const home = path6.resolve(
|
|
2142
|
+
const home = path6.resolve(os6.homedir());
|
|
2143
2143
|
const startPath = path6.resolve(start);
|
|
2144
2144
|
while (dir !== root) {
|
|
2145
2145
|
if (dir === home && dir !== startPath) {
|
|
@@ -3200,7 +3200,7 @@ var InMemoryAgentBridge = class {
|
|
|
3200
3200
|
);
|
|
3201
3201
|
}
|
|
3202
3202
|
this.inflightGuards.add(correlationId);
|
|
3203
|
-
return new Promise((
|
|
3203
|
+
return new Promise((resolve12, reject) => {
|
|
3204
3204
|
const timer = setTimeout(() => {
|
|
3205
3205
|
this.inflightGuards.delete(correlationId);
|
|
3206
3206
|
this.pendingRequests.delete(correlationId);
|
|
@@ -3212,7 +3212,7 @@ var InMemoryAgentBridge = class {
|
|
|
3212
3212
|
return;
|
|
3213
3213
|
}
|
|
3214
3214
|
this.pendingRequests.set(correlationId, {
|
|
3215
|
-
resolve:
|
|
3215
|
+
resolve: resolve12,
|
|
3216
3216
|
reject,
|
|
3217
3217
|
timer
|
|
3218
3218
|
});
|
|
@@ -3405,11 +3405,11 @@ function validateAgainstSchema(value, schema) {
|
|
|
3405
3405
|
walk2(value, schema, "", errors);
|
|
3406
3406
|
return { ok: errors.length === 0, errors };
|
|
3407
3407
|
}
|
|
3408
|
-
function walk2(value, schema,
|
|
3408
|
+
function walk2(value, schema, path36, errors) {
|
|
3409
3409
|
if (schema.enum !== void 0) {
|
|
3410
3410
|
if (!schema.enum.some((e) => deepEqual(e, value))) {
|
|
3411
3411
|
errors.push({
|
|
3412
|
-
path:
|
|
3412
|
+
path: path36 || "<root>",
|
|
3413
3413
|
message: `expected one of ${JSON.stringify(schema.enum)}, got ${JSON.stringify(value)}`
|
|
3414
3414
|
});
|
|
3415
3415
|
return;
|
|
@@ -3418,7 +3418,7 @@ function walk2(value, schema, path37, errors) {
|
|
|
3418
3418
|
if (typeof schema.type === "string") {
|
|
3419
3419
|
if (!checkType(value, schema.type)) {
|
|
3420
3420
|
errors.push({
|
|
3421
|
-
path:
|
|
3421
|
+
path: path36 || "<root>",
|
|
3422
3422
|
message: `expected ${schema.type}, got ${describeType(value)}`
|
|
3423
3423
|
});
|
|
3424
3424
|
return;
|
|
@@ -3428,19 +3428,19 @@ function walk2(value, schema, path37, errors) {
|
|
|
3428
3428
|
const obj = value;
|
|
3429
3429
|
for (const req of schema.required ?? []) {
|
|
3430
3430
|
if (!(req in obj)) {
|
|
3431
|
-
errors.push({ path: joinPath(
|
|
3431
|
+
errors.push({ path: joinPath(path36, req), message: "required property missing" });
|
|
3432
3432
|
}
|
|
3433
3433
|
}
|
|
3434
3434
|
if (schema.properties) {
|
|
3435
3435
|
for (const [key, subSchema] of Object.entries(schema.properties)) {
|
|
3436
3436
|
if (key in obj) {
|
|
3437
|
-
walk2(obj[key], subSchema, joinPath(
|
|
3437
|
+
walk2(obj[key], subSchema, joinPath(path36, key), errors);
|
|
3438
3438
|
}
|
|
3439
3439
|
}
|
|
3440
3440
|
}
|
|
3441
3441
|
}
|
|
3442
3442
|
if (schema.type === "array" && Array.isArray(value) && schema.items) {
|
|
3443
|
-
value.forEach((item, i) => walk2(item, schema.items, `${
|
|
3443
|
+
value.forEach((item, i) => walk2(item, schema.items, `${path36}[${i}]`, errors));
|
|
3444
3444
|
}
|
|
3445
3445
|
}
|
|
3446
3446
|
function checkType(value, type) {
|
|
@@ -4790,7 +4790,7 @@ function slugify(name) {
|
|
|
4790
4790
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "project";
|
|
4791
4791
|
}
|
|
4792
4792
|
function resolveWstackPaths(opts) {
|
|
4793
|
-
const home = opts.userHome ??
|
|
4793
|
+
const home = opts.userHome ?? os6.homedir();
|
|
4794
4794
|
const globalRoot = opts.globalRoot ?? path6.join(home, ".wrongstack");
|
|
4795
4795
|
const hash = projectHash(opts.projectRoot);
|
|
4796
4796
|
const slug = projectSlug(opts.projectRoot);
|
|
@@ -4921,7 +4921,7 @@ function buildChildEnv(optsOrSessionId) {
|
|
|
4921
4921
|
|
|
4922
4922
|
// src/utils/sleep.ts
|
|
4923
4923
|
function sleep(ms) {
|
|
4924
|
-
return new Promise((
|
|
4924
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
4925
4925
|
}
|
|
4926
4926
|
var GLOB_CHARS = /* @__PURE__ */ new Set(["*", "?", "["]);
|
|
4927
4927
|
var IS_WINDOWS = process.platform === "win32";
|
|
@@ -7113,7 +7113,7 @@ var RecoveryLock = class {
|
|
|
7113
7113
|
constructor(opts) {
|
|
7114
7114
|
this.file = path6.join(opts.dir, LOCK_FILE);
|
|
7115
7115
|
this.pid = opts.pid ?? process.pid;
|
|
7116
|
-
this.hostname = opts.hostname ??
|
|
7116
|
+
this.hostname = opts.hostname ?? os6.hostname();
|
|
7117
7117
|
this.maxAgeMs = opts.maxAgeMs ?? DEFAULT_MAX_AGE_MS;
|
|
7118
7118
|
this.sessionStore = opts.sessionStore;
|
|
7119
7119
|
this.probe = opts.isPidAlive ?? defaultIsPidAlive;
|
|
@@ -8660,8 +8660,8 @@ async function streamProviderToResponse(provider, req, signal, ctx, events) {
|
|
|
8660
8660
|
try {
|
|
8661
8661
|
await Promise.race([
|
|
8662
8662
|
Promise.resolve(iter.return?.()),
|
|
8663
|
-
new Promise((
|
|
8664
|
-
drainTimer = setTimeout(
|
|
8663
|
+
new Promise((resolve12) => {
|
|
8664
|
+
drainTimer = setTimeout(resolve12, STREAM_DRAIN_TIMEOUT_MS);
|
|
8665
8665
|
})
|
|
8666
8666
|
]);
|
|
8667
8667
|
} finally {
|
|
@@ -8722,7 +8722,7 @@ async function runProviderWithRetry(opts) {
|
|
|
8722
8722
|
description
|
|
8723
8723
|
});
|
|
8724
8724
|
}
|
|
8725
|
-
await new Promise((
|
|
8725
|
+
await new Promise((resolve12, reject) => {
|
|
8726
8726
|
let settled = false;
|
|
8727
8727
|
const onAbort = () => {
|
|
8728
8728
|
if (settled) return;
|
|
@@ -8735,7 +8735,7 @@ async function runProviderWithRetry(opts) {
|
|
|
8735
8735
|
settled = true;
|
|
8736
8736
|
clearTimeout(t2);
|
|
8737
8737
|
signal.removeEventListener("abort", onAbort);
|
|
8738
|
-
|
|
8738
|
+
resolve12();
|
|
8739
8739
|
}, delay);
|
|
8740
8740
|
if (signal.aborted) {
|
|
8741
8741
|
onAbort();
|
|
@@ -9742,8 +9742,7 @@ var AutonomousRunner = class {
|
|
|
9742
9742
|
init_atomic_write();
|
|
9743
9743
|
var MAX_JOURNAL_ENTRIES = 500;
|
|
9744
9744
|
function goalFilePath(projectRoot) {
|
|
9745
|
-
|
|
9746
|
-
return path6.join(os7.homedir(), ".wrongstack", "projects", hash, "goal.json");
|
|
9745
|
+
return resolveWstackPaths({ projectRoot }).projectGoal;
|
|
9747
9746
|
}
|
|
9748
9747
|
async function loadGoal(filePath) {
|
|
9749
9748
|
let raw;
|
|
@@ -10798,12 +10797,12 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
10798
10797
|
if (!bus || !bus.hasListenerFor("budget.threshold_reached")) {
|
|
10799
10798
|
return Promise.resolve("stop");
|
|
10800
10799
|
}
|
|
10801
|
-
return new Promise((
|
|
10800
|
+
return new Promise((resolve12) => {
|
|
10802
10801
|
let resolved = false;
|
|
10803
10802
|
const respond = (d) => {
|
|
10804
10803
|
if (resolved) return;
|
|
10805
10804
|
resolved = true;
|
|
10806
|
-
|
|
10805
|
+
resolve12(d);
|
|
10807
10806
|
};
|
|
10808
10807
|
const fallback = setTimeout(
|
|
10809
10808
|
() => respond("stop"),
|
|
@@ -14219,7 +14218,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
14219
14218
|
taskIds.map((id) => {
|
|
14220
14219
|
const cached = this.completedResults.find((r) => r.taskId === id);
|
|
14221
14220
|
if (cached) return cached;
|
|
14222
|
-
return new Promise((
|
|
14221
|
+
return new Promise((resolve12, reject) => {
|
|
14223
14222
|
const timeout = setTimeout(() => {
|
|
14224
14223
|
this.off("task.completed", handler);
|
|
14225
14224
|
reject(new Error(`awaitTasks timed out waiting for task "${id}"`));
|
|
@@ -14228,7 +14227,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
14228
14227
|
if (result.taskId === id) {
|
|
14229
14228
|
clearTimeout(timeout);
|
|
14230
14229
|
this.off("task.completed", handler);
|
|
14231
|
-
|
|
14230
|
+
resolve12(result);
|
|
14232
14231
|
}
|
|
14233
14232
|
};
|
|
14234
14233
|
this.on("task.completed", handler);
|
|
@@ -17559,11 +17558,11 @@ var Director = class _Director {
|
|
|
17559
17558
|
if (cached) return cached;
|
|
17560
17559
|
const existing = this.taskWaiters.get(id);
|
|
17561
17560
|
if (existing) return existing.promise;
|
|
17562
|
-
let
|
|
17561
|
+
let resolve12;
|
|
17563
17562
|
const promise = new Promise((res) => {
|
|
17564
|
-
|
|
17563
|
+
resolve12 = res;
|
|
17565
17564
|
});
|
|
17566
|
-
this.taskWaiters.set(id, { promise, resolve:
|
|
17565
|
+
this.taskWaiters.set(id, { promise, resolve: resolve12 });
|
|
17567
17566
|
return promise;
|
|
17568
17567
|
})
|
|
17569
17568
|
);
|
|
@@ -17953,7 +17952,7 @@ function createDelegateTool(opts) {
|
|
|
17953
17952
|
subagentId
|
|
17954
17953
|
});
|
|
17955
17954
|
const dir = director;
|
|
17956
|
-
const result = await new Promise((
|
|
17955
|
+
const result = await new Promise((resolve12) => {
|
|
17957
17956
|
let settled = false;
|
|
17958
17957
|
let timer;
|
|
17959
17958
|
const finish = (value) => {
|
|
@@ -17963,7 +17962,7 @@ function createDelegateTool(opts) {
|
|
|
17963
17962
|
offTool();
|
|
17964
17963
|
offIter();
|
|
17965
17964
|
offProgress();
|
|
17966
|
-
|
|
17965
|
+
resolve12(value);
|
|
17967
17966
|
};
|
|
17968
17967
|
const arm = () => {
|
|
17969
17968
|
if (timer) clearTimeout(timer);
|
|
@@ -19661,9 +19660,9 @@ var AISpecBuilder = class {
|
|
|
19661
19660
|
if (!this.sessionPath) return;
|
|
19662
19661
|
try {
|
|
19663
19662
|
const fsp21 = await import('fs/promises');
|
|
19664
|
-
const
|
|
19663
|
+
const path36 = await import('path');
|
|
19665
19664
|
const { atomicWrite: atomicWrite2 } = await Promise.resolve().then(() => (init_atomic_write(), atomic_write_exports));
|
|
19666
|
-
await fsp21.mkdir(
|
|
19665
|
+
await fsp21.mkdir(path36.dirname(this.sessionPath), { recursive: true });
|
|
19667
19666
|
await atomicWrite2(this.sessionPath, JSON.stringify(this.session, null, 2));
|
|
19668
19667
|
} catch {
|
|
19669
19668
|
}
|
|
@@ -20373,15 +20372,15 @@ function computeCriticalPath(graph, _topoOrder, blockedByMap) {
|
|
|
20373
20372
|
maxId = id;
|
|
20374
20373
|
}
|
|
20375
20374
|
}
|
|
20376
|
-
const
|
|
20375
|
+
const path36 = [];
|
|
20377
20376
|
let current = maxId;
|
|
20378
20377
|
const visited = /* @__PURE__ */ new Set();
|
|
20379
20378
|
while (current && !visited.has(current)) {
|
|
20380
20379
|
visited.add(current);
|
|
20381
|
-
|
|
20380
|
+
path36.unshift(current);
|
|
20382
20381
|
current = prev.get(current) ?? null;
|
|
20383
20382
|
}
|
|
20384
|
-
return
|
|
20383
|
+
return path36;
|
|
20385
20384
|
}
|
|
20386
20385
|
function computeParallelGroups(graph, blockedByMap) {
|
|
20387
20386
|
const groups = [];
|
|
@@ -21192,9 +21191,9 @@ var DefaultHealthRegistry = class {
|
|
|
21192
21191
|
}
|
|
21193
21192
|
async runOne(check) {
|
|
21194
21193
|
let timer = null;
|
|
21195
|
-
const timeout = new Promise((
|
|
21194
|
+
const timeout = new Promise((resolve12) => {
|
|
21196
21195
|
timer = setTimeout(
|
|
21197
|
-
() =>
|
|
21196
|
+
() => resolve12({ status: "unhealthy", detail: `timeout after ${this.timeoutMs}ms` }),
|
|
21198
21197
|
this.timeoutMs
|
|
21199
21198
|
);
|
|
21200
21199
|
});
|
|
@@ -21377,7 +21376,7 @@ async function startMetricsServer(opts) {
|
|
|
21377
21376
|
const tls = opts.tls;
|
|
21378
21377
|
const useHttps = !!(tls?.cert && tls?.key);
|
|
21379
21378
|
const host = opts.host ?? "127.0.0.1";
|
|
21380
|
-
const
|
|
21379
|
+
const path36 = opts.path ?? "/metrics";
|
|
21381
21380
|
const healthPath = opts.healthPath ?? "/healthz";
|
|
21382
21381
|
const healthRegistry = opts.healthRegistry;
|
|
21383
21382
|
const listener = (req, res) => {
|
|
@@ -21387,7 +21386,7 @@ async function startMetricsServer(opts) {
|
|
|
21387
21386
|
return;
|
|
21388
21387
|
}
|
|
21389
21388
|
const url = req.url.split("?")[0];
|
|
21390
|
-
if (url ===
|
|
21389
|
+
if (url === path36) {
|
|
21391
21390
|
let body;
|
|
21392
21391
|
try {
|
|
21393
21392
|
body = renderPrometheus(opts.sink.snapshot());
|
|
@@ -21433,14 +21432,14 @@ async function startMetricsServer(opts) {
|
|
|
21433
21432
|
const { createServer } = await import('http');
|
|
21434
21433
|
server = createServer(listener);
|
|
21435
21434
|
}
|
|
21436
|
-
await new Promise((
|
|
21435
|
+
await new Promise((resolve12, reject) => {
|
|
21437
21436
|
const onError = (err) => {
|
|
21438
21437
|
server.off("listening", onListening);
|
|
21439
21438
|
reject(err);
|
|
21440
21439
|
};
|
|
21441
21440
|
const onListening = () => {
|
|
21442
21441
|
server.off("error", onError);
|
|
21443
|
-
|
|
21442
|
+
resolve12();
|
|
21444
21443
|
};
|
|
21445
21444
|
server.once("error", onError);
|
|
21446
21445
|
server.once("listening", onListening);
|
|
@@ -21451,9 +21450,9 @@ async function startMetricsServer(opts) {
|
|
|
21451
21450
|
const protocol = useHttps ? "https" : "http";
|
|
21452
21451
|
return {
|
|
21453
21452
|
port: boundPort,
|
|
21454
|
-
url: `${protocol}://${host}:${boundPort}${
|
|
21455
|
-
close: () => new Promise((
|
|
21456
|
-
server.close((err) => err ? reject(err) :
|
|
21453
|
+
url: `${protocol}://${host}:${boundPort}${path36}`,
|
|
21454
|
+
close: () => new Promise((resolve12, reject) => {
|
|
21455
|
+
server.close((err) => err ? reject(err) : resolve12());
|
|
21457
21456
|
})
|
|
21458
21457
|
};
|
|
21459
21458
|
}
|
|
@@ -22154,7 +22153,7 @@ async function downloadGitHubTarball(parsed) {
|
|
|
22154
22153
|
`Tarball too large (${(Number.parseInt(contentLength, 10) / 1024 / 1024).toFixed(1)}MB). Max: ${MAX_TARBALL_SIZE / 1024 / 1024}MB`
|
|
22155
22154
|
);
|
|
22156
22155
|
}
|
|
22157
|
-
const tempDir = await fsp3.mkdtemp(path6.join(
|
|
22156
|
+
const tempDir = await fsp3.mkdtemp(path6.join(os6.tmpdir(), "wskill-"));
|
|
22158
22157
|
try {
|
|
22159
22158
|
if (!response.body) {
|
|
22160
22159
|
throw new Error("Empty response body from GitHub API");
|
|
@@ -25383,7 +25382,7 @@ var SecurityScannerOrchestrator = class {
|
|
|
25383
25382
|
const delay = Math.round(policy.delayMs(attempt));
|
|
25384
25383
|
const status = isProviderErr ? err.status : 0;
|
|
25385
25384
|
console.warn(`[SecurityScanner] retry ${attempt + 1} after ${delay}ms (status=${status}) \u2014 ${errAsErr.message}`);
|
|
25386
|
-
await new Promise((
|
|
25385
|
+
await new Promise((resolve12) => setTimeout(resolve12, delay));
|
|
25387
25386
|
return this.completeWithRetry(provider, request, abortController, attempt + 1);
|
|
25388
25387
|
}
|
|
25389
25388
|
}
|
|
@@ -26905,13 +26904,13 @@ function createAgentToolHandler(a) {
|
|
|
26905
26904
|
}
|
|
26906
26905
|
}
|
|
26907
26906
|
function waitForConfirm(info) {
|
|
26908
|
-
return new Promise((
|
|
26907
|
+
return new Promise((resolve12) => {
|
|
26909
26908
|
a.events.emit("tool.confirm_needed", {
|
|
26910
26909
|
tool: info.tool,
|
|
26911
26910
|
input: info.input,
|
|
26912
26911
|
toolUseId: info.toolUseId,
|
|
26913
26912
|
suggestedPattern: info.suggestedPattern,
|
|
26914
|
-
resolve:
|
|
26913
|
+
resolve: resolve12
|
|
26915
26914
|
});
|
|
26916
26915
|
});
|
|
26917
26916
|
}
|
|
@@ -27167,12 +27166,12 @@ function buildBtwBlock(notes) {
|
|
|
27167
27166
|
// src/core/iteration-limit.ts
|
|
27168
27167
|
function requestLimitExtension(opts) {
|
|
27169
27168
|
const { events, currentIterations, currentLimit, autoExtend, timeoutMs = 3e4 } = opts;
|
|
27170
|
-
return new Promise((
|
|
27169
|
+
return new Promise((resolve12) => {
|
|
27171
27170
|
let resolved = false;
|
|
27172
27171
|
const timerFired = () => {
|
|
27173
27172
|
if (!resolved) {
|
|
27174
27173
|
resolved = true;
|
|
27175
|
-
|
|
27174
|
+
resolve12(0);
|
|
27176
27175
|
}
|
|
27177
27176
|
};
|
|
27178
27177
|
const timer = setTimeout(timerFired, timeoutMs);
|
|
@@ -27181,14 +27180,14 @@ function requestLimitExtension(opts) {
|
|
|
27181
27180
|
if (!resolved) {
|
|
27182
27181
|
resolved = true;
|
|
27183
27182
|
clearTimeout(timer);
|
|
27184
|
-
|
|
27183
|
+
resolve12(0);
|
|
27185
27184
|
}
|
|
27186
27185
|
};
|
|
27187
27186
|
const grant = (extra) => {
|
|
27188
27187
|
if (!resolved) {
|
|
27189
27188
|
resolved = true;
|
|
27190
27189
|
clearTimeout(timer);
|
|
27191
|
-
|
|
27190
|
+
resolve12(Math.max(0, extra));
|
|
27192
27191
|
}
|
|
27193
27192
|
};
|
|
27194
27193
|
events.emit("iteration.limit_reached", {
|
|
@@ -27202,7 +27201,7 @@ function requestLimitExtension(opts) {
|
|
|
27202
27201
|
if (!resolved) {
|
|
27203
27202
|
resolved = true;
|
|
27204
27203
|
clearTimeout(timer);
|
|
27205
|
-
|
|
27204
|
+
resolve12(100);
|
|
27206
27205
|
}
|
|
27207
27206
|
});
|
|
27208
27207
|
}
|
|
@@ -27651,13 +27650,13 @@ var DEFAULT_TIMEOUT_MS3 = 5e3;
|
|
|
27651
27650
|
var MAX_OUTPUT_BYTES = 64 * 1024;
|
|
27652
27651
|
async function runShellHook(spec, input, logger) {
|
|
27653
27652
|
const timeoutMs = spec.timeoutMs ?? DEFAULT_TIMEOUT_MS3;
|
|
27654
|
-
return await new Promise((
|
|
27653
|
+
return await new Promise((resolve12) => {
|
|
27655
27654
|
let settled = false;
|
|
27656
27655
|
const done = (v) => {
|
|
27657
27656
|
if (settled) return;
|
|
27658
27657
|
settled = true;
|
|
27659
27658
|
clearTimeout(timer);
|
|
27660
|
-
|
|
27659
|
+
resolve12(v);
|
|
27661
27660
|
};
|
|
27662
27661
|
let child;
|
|
27663
27662
|
try {
|
|
@@ -27669,7 +27668,7 @@ async function runShellHook(spec, input, logger) {
|
|
|
27669
27668
|
});
|
|
27670
27669
|
} catch (err2) {
|
|
27671
27670
|
logger?.warn?.(`hook spawn failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
27672
|
-
return
|
|
27671
|
+
return resolve12(null);
|
|
27673
27672
|
}
|
|
27674
27673
|
const timer = setTimeout(() => {
|
|
27675
27674
|
logger?.warn?.(`hook command timed out after ${timeoutMs}ms: ${spec.command}`);
|
|
@@ -27846,7 +27845,7 @@ async function bootConfig(options = {}) {
|
|
|
27846
27845
|
const cwd = typeof flags["cwd"] === "string" ? path6.resolve(flags["cwd"]) : process.cwd();
|
|
27847
27846
|
const pathResolver = new DefaultPathResolver(cwd);
|
|
27848
27847
|
const projectRoot = pathResolver.projectRoot;
|
|
27849
|
-
const userHome =
|
|
27848
|
+
const userHome = os6.homedir();
|
|
27850
27849
|
const wpaths = resolveWstackPaths({ projectRoot, userHome });
|
|
27851
27850
|
await fsp3.mkdir(wpaths.globalRoot, { recursive: true });
|
|
27852
27851
|
await fsp3.mkdir(wpaths.projectDir, { recursive: true });
|
|
@@ -28270,8 +28269,8 @@ var InputBuilder = class {
|
|
|
28270
28269
|
async registerFile(input) {
|
|
28271
28270
|
const ref = await this.store.add({ ...input, kind: "file" });
|
|
28272
28271
|
this.refs.push(ref);
|
|
28273
|
-
const
|
|
28274
|
-
return `[file:${
|
|
28272
|
+
const path36 = ref.meta.filename ?? ref.meta.label ?? String(ref.seq);
|
|
28273
|
+
return `[file:${path36}]`;
|
|
28275
28274
|
}
|
|
28276
28275
|
/**
|
|
28277
28276
|
* Whether `appendPaste(text)` would collapse the text to a placeholder
|
|
@@ -28638,7 +28637,7 @@ summarize it, and let the tool result hold only the summary.`);
|
|
|
28638
28637
|
const cached = this.envCacheByRoot.get(ctx.projectRoot);
|
|
28639
28638
|
if (cached) return cached;
|
|
28640
28639
|
const today = this.opts.todayIso ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
28641
|
-
const platform2 = `${
|
|
28640
|
+
const platform2 = `${os6.platform()} ${os6.release()}`;
|
|
28642
28641
|
const shell = process.env.SHELL ?? process.env.ComSpec ?? "unknown";
|
|
28643
28642
|
const node = process.version;
|
|
28644
28643
|
const isGit = await this.dirExists(path6.join(ctx.projectRoot, ".git"));
|
|
@@ -28768,12 +28767,12 @@ ${this.skillBodyCache}`);
|
|
|
28768
28767
|
}
|
|
28769
28768
|
}
|
|
28770
28769
|
async gitStatus(root) {
|
|
28771
|
-
return new Promise((
|
|
28770
|
+
return new Promise((resolve12) => {
|
|
28772
28771
|
let settled = false;
|
|
28773
28772
|
const finish = (s) => {
|
|
28774
28773
|
if (settled) return;
|
|
28775
28774
|
settled = true;
|
|
28776
|
-
|
|
28775
|
+
resolve12(s);
|
|
28777
28776
|
};
|
|
28778
28777
|
let proc;
|
|
28779
28778
|
const timer = setTimeout(() => {
|
|
@@ -30132,7 +30131,7 @@ var PhaseOrchestrator = class {
|
|
|
30132
30131
|
async mergeOne(phase, handle) {
|
|
30133
30132
|
if (!this.worktrees) return;
|
|
30134
30133
|
try {
|
|
30135
|
-
const
|
|
30134
|
+
const resolve12 = this.ctx.resolveConflict ? async (info) => {
|
|
30136
30135
|
const shouldResolve = await this.shouldAttemptConflictResolution(phase, info);
|
|
30137
30136
|
if (!shouldResolve) return false;
|
|
30138
30137
|
this.emit("phase.conflictResolving", {
|
|
@@ -30146,7 +30145,7 @@ var PhaseOrchestrator = class {
|
|
|
30146
30145
|
const mergeOpts = {
|
|
30147
30146
|
squash: true
|
|
30148
30147
|
};
|
|
30149
|
-
if (
|
|
30148
|
+
if (resolve12 !== void 0) mergeOpts.resolve = resolve12;
|
|
30150
30149
|
const result = await this.worktrees.merge(handle, mergeOpts);
|
|
30151
30150
|
if (result.resolved) {
|
|
30152
30151
|
this.emit("phase.conflictResolved", { phaseId: phase.id, name: phase.name });
|
|
@@ -30497,7 +30496,7 @@ var PhaseOrchestrator = class {
|
|
|
30497
30496
|
}
|
|
30498
30497
|
}
|
|
30499
30498
|
delay(ms) {
|
|
30500
|
-
return new Promise((
|
|
30499
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
30501
30500
|
}
|
|
30502
30501
|
};
|
|
30503
30502
|
|
|
@@ -31569,12 +31568,12 @@ var BrainDecisionQueue = class {
|
|
|
31569
31568
|
options: request.options,
|
|
31570
31569
|
rationale: "Decision escalated to human authority."
|
|
31571
31570
|
};
|
|
31572
|
-
const pending = new Promise((
|
|
31573
|
-
const entry = { request, resolve:
|
|
31571
|
+
const pending = new Promise((resolve12) => {
|
|
31572
|
+
const entry = { request, resolve: resolve12 };
|
|
31574
31573
|
if (this.opts.timeoutMs && this.opts.timeoutMs > 0) {
|
|
31575
31574
|
entry.timer = setTimeout(() => {
|
|
31576
31575
|
this.pending.delete(request.id);
|
|
31577
|
-
|
|
31576
|
+
resolve12({ type: "deny", reason: "Brain human decision timed out." });
|
|
31578
31577
|
}, this.opts.timeoutMs);
|
|
31579
31578
|
}
|
|
31580
31579
|
this.pending.set(request.id, entry);
|
|
@@ -31689,8 +31688,8 @@ var CollaborationBus = class {
|
|
|
31689
31688
|
if (this.isPaused()) return false;
|
|
31690
31689
|
this.pausedAtMs = Date.now();
|
|
31691
31690
|
this.pausedBy = byParticipant;
|
|
31692
|
-
this.pausePromise = new Promise((
|
|
31693
|
-
this.pauseResolve =
|
|
31691
|
+
this.pausePromise = new Promise((resolve12) => {
|
|
31692
|
+
this.pauseResolve = resolve12;
|
|
31694
31693
|
});
|
|
31695
31694
|
return true;
|
|
31696
31695
|
}
|
|
@@ -31726,8 +31725,8 @@ var CollaborationBus = class {
|
|
|
31726
31725
|
return true;
|
|
31727
31726
|
}
|
|
31728
31727
|
let timer;
|
|
31729
|
-
const timeoutPromise = new Promise((
|
|
31730
|
-
timer = setTimeout(() =>
|
|
31728
|
+
const timeoutPromise = new Promise((resolve12) => {
|
|
31729
|
+
timer = setTimeout(() => resolve12("timeout"), timeoutMs);
|
|
31731
31730
|
});
|
|
31732
31731
|
const resumedPromise = this.pausePromise.then(() => "resumed");
|
|
31733
31732
|
const winner = await Promise.race([resumedPromise, timeoutPromise]);
|
|
@@ -32218,7 +32217,7 @@ function createGitPlugin() {
|
|
|
32218
32217
|
}
|
|
32219
32218
|
async function runGit(args, cwd) {
|
|
32220
32219
|
try {
|
|
32221
|
-
return await new Promise((
|
|
32220
|
+
return await new Promise((resolve12, reject) => {
|
|
32222
32221
|
const child = spawn("git", args, { cwd, stdio: ["ignore", "pipe", "pipe"], signal: AbortSignal.timeout(3e4) });
|
|
32223
32222
|
let stdout = "";
|
|
32224
32223
|
let stderr = "";
|
|
@@ -32239,7 +32238,7 @@ async function runGit(args, cwd) {
|
|
|
32239
32238
|
})
|
|
32240
32239
|
);
|
|
32241
32240
|
});
|
|
32242
|
-
child.on("close", (code) =>
|
|
32241
|
+
child.on("close", (code) => resolve12({ stdout, stderr, code: code ?? 0 }));
|
|
32243
32242
|
});
|
|
32244
32243
|
} catch (err) {
|
|
32245
32244
|
if (err instanceof WrongStackError) throw err;
|
|
@@ -32593,7 +32592,7 @@ function createSkillsPlugin(opts) {
|
|
|
32593
32592
|
};
|
|
32594
32593
|
}
|
|
32595
32594
|
function makeInstaller(skillLoader, projectRoot) {
|
|
32596
|
-
const globalRoot = path6.join(
|
|
32595
|
+
const globalRoot = path6.join(os6.homedir(), ".wrongstack");
|
|
32597
32596
|
return new SkillInstaller({
|
|
32598
32597
|
manifestPath: path6.join(globalRoot, "installed-skills.json"),
|
|
32599
32598
|
projectSkillsDir: path6.join(projectRoot, ".wrongstack", "skills"),
|