@wrongstack/core 0.41.0 → 0.54.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-D_XcS2HL.d.ts → agent-bridge-Dnhw4tnM.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C66vi4Gq.d.ts → agent-subagent-runner-By7jruZ_.d.ts} +3 -3
- package/dist/{compactor-D1RHFRmF.d.ts → compactor-Duhsf0ge.d.ts} +1 -1
- package/dist/{config-ZRCf7sTu.d.ts → config-bht0txXS.d.ts} +33 -2
- package/dist/{context-7u93AcGD.d.ts → context-DtPKqKYV.d.ts} +1 -0
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js +234 -32
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +23 -23
- package/dist/defaults/index.js +182 -75
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-BrQiweXN.d.ts → events-CbHTS4ZZ.d.ts} +136 -2
- package/dist/execution/index.d.ts +42 -16
- package/dist/execution/index.js +61 -28
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{goal-store-BeRsj7YX.d.ts → goal-store-DwcTDDiX.d.ts} +1 -1
- package/dist/{index-6_csX32J.d.ts → index-CI271MjL.d.ts} +5 -5
- package/dist/{index-DkVgH3wC.d.ts → index-ge5F2dnc.d.ts} +10 -8
- package/dist/index.d.ts +113 -37
- package/dist/index.js +601 -149
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DONdo-XM.d.ts → mcp-servers-DE6gzBry.d.ts} +3 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +36 -18
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-gwMAo6E3.d.ts → models-registry-Cuq1C8V9.d.ts} +7 -0
- package/dist/{multi-agent-C8Z1i__e.d.ts → multi-agent-BmC_xiog.d.ts} +2 -2
- package/dist/{multi-agent-coordinator-BUsjiRWl.d.ts → multi-agent-coordinator-CjNX4uBD.d.ts} +2 -2
- package/dist/{null-fleet-bus-FvgHnZah.d.ts → null-fleet-bus-BNiSlTna.d.ts} +23 -11
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-DumKAi0n.d.ts → path-resolver-Bax85amb.d.ts} +2 -2
- package/dist/{permission-B6sldrSp.d.ts → permission-Drm7LpPo.d.ts} +1 -1
- package/dist/{permission-policy-CtNscWOA.d.ts → permission-policy-CU6sqWxF.d.ts} +2 -2
- package/dist/{plan-templates-DYCeRCDN.d.ts → plan-templates-CLRcurWN.d.ts} +4 -4
- package/dist/{provider-runner-Dlv8Fvw9.d.ts → provider-runner-BikCxGCx.d.ts} +3 -3
- package/dist/{retry-policy-KF18W4dg.d.ts → retry-policy-Chtlvr5b.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/{selector-DmXxpFyM.d.ts → selector-BvSPdJj6.d.ts} +1 -1
- package/dist/{session-reader-bfgsy2a0.d.ts → session-reader-BGhzMir4.d.ts} +1 -1
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/index.js +57 -37
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CM6zOhd2.d.ts → system-prompt-dtzV_mLm.d.ts} +1 -1
- package/dist/{tool-executor-BpK-SWtJ.d.ts → tool-executor-CgU0yWpB.d.ts} +4 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/types/index.js +36 -18
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +14 -2
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
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 { execFile, spawn } from 'child_process';
|
|
10
10
|
import { promisify } from 'util';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
@@ -93,7 +93,7 @@ async function renameWithRetry(from, to) {
|
|
|
93
93
|
if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {
|
|
94
94
|
throw err;
|
|
95
95
|
}
|
|
96
|
-
await new Promise((
|
|
96
|
+
await new Promise((resolve12) => setTimeout(resolve12, delays[i]));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
throw lastErr;
|
|
@@ -882,7 +882,9 @@ var TOKENS = {
|
|
|
882
882
|
/** Replaces the entire provider call layer — retry, streaming, tracing. */
|
|
883
883
|
ProviderRunner: t("ProviderRunner"),
|
|
884
884
|
/** Optional git-worktree lifecycle manager (per-phase isolation in AutoPhase). */
|
|
885
|
-
WorktreeManager: t("WorktreeManager")
|
|
885
|
+
WorktreeManager: t("WorktreeManager"),
|
|
886
|
+
/** Optional global Brain arbiter for policy/decision escalation. */
|
|
887
|
+
BrainArbiter: t("BrainArbiter")
|
|
886
888
|
};
|
|
887
889
|
|
|
888
890
|
// src/kernel/run-controller.ts
|
|
@@ -2367,6 +2369,7 @@ function stripUndefined(obj) {
|
|
|
2367
2369
|
// src/models/models-registry.ts
|
|
2368
2370
|
var DEFAULT_URL = "https://models.dev/api.json";
|
|
2369
2371
|
var DEFAULT_TTL_SECONDS = 24 * 3600;
|
|
2372
|
+
var DEFAULT_REFRESH_TIMEOUT_MS = 15e3;
|
|
2370
2373
|
var FAMILY_BY_NPM = {
|
|
2371
2374
|
"@ai-sdk/anthropic": "anthropic",
|
|
2372
2375
|
"@ai-sdk/google-vertex/anthropic": "anthropic",
|
|
@@ -2403,6 +2406,7 @@ var DefaultModelsRegistry = class {
|
|
|
2403
2406
|
fetchImpl;
|
|
2404
2407
|
seed;
|
|
2405
2408
|
maxStaleAgeMs;
|
|
2409
|
+
refreshTimeoutMs;
|
|
2406
2410
|
overlay;
|
|
2407
2411
|
overlayUrl;
|
|
2408
2412
|
overlayFile;
|
|
@@ -2415,6 +2419,7 @@ var DefaultModelsRegistry = class {
|
|
|
2415
2419
|
this.seed = opts.seed;
|
|
2416
2420
|
const maxStaleSeconds = opts.maxStaleAgeSeconds ?? 7 * 24 * 3600;
|
|
2417
2421
|
this.maxStaleAgeMs = maxStaleSeconds * 1e3;
|
|
2422
|
+
this.refreshTimeoutMs = opts.refreshTimeoutMs ?? DEFAULT_REFRESH_TIMEOUT_MS;
|
|
2418
2423
|
this.overlay = opts.overlay;
|
|
2419
2424
|
this.overlayUrl = opts.overlayUrl;
|
|
2420
2425
|
this.overlayFile = opts.overlayFile;
|
|
@@ -2466,22 +2471,34 @@ var DefaultModelsRegistry = class {
|
|
|
2466
2471
|
}
|
|
2467
2472
|
/** Fetch + cache the models.dev base. Throws on failure (used by `refresh`). */
|
|
2468
2473
|
async refreshBase() {
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2474
|
+
const controller = new AbortController();
|
|
2475
|
+
const timeout = setTimeout(() => controller.abort(), this.refreshTimeoutMs);
|
|
2476
|
+
try {
|
|
2477
|
+
const res = await this.fetchImpl(this.url, {
|
|
2478
|
+
method: "GET",
|
|
2479
|
+
headers: { accept: "application/json" },
|
|
2480
|
+
signal: controller.signal
|
|
2481
|
+
});
|
|
2482
|
+
clearTimeout(timeout);
|
|
2483
|
+
if (!res.ok) {
|
|
2484
|
+
throw new Error(`ModelsRegistry: HTTP ${res.status} fetching ${this.url}`);
|
|
2485
|
+
}
|
|
2486
|
+
const json = await res.json();
|
|
2487
|
+
this.fetchedAt = /* @__PURE__ */ new Date();
|
|
2488
|
+
const envelope = {
|
|
2489
|
+
fetchedAt: this.fetchedAt.toISOString(),
|
|
2490
|
+
url: this.url,
|
|
2491
|
+
payload: json
|
|
2492
|
+
};
|
|
2493
|
+
await atomicWrite(this.cacheFile, JSON.stringify(envelope));
|
|
2494
|
+
return json;
|
|
2495
|
+
} catch (err) {
|
|
2496
|
+
clearTimeout(timeout);
|
|
2497
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
2498
|
+
throw new Error(`ModelsRegistry: fetch timed out after ${this.refreshTimeoutMs}ms`);
|
|
2499
|
+
}
|
|
2500
|
+
throw err;
|
|
2501
|
+
}
|
|
2485
2502
|
}
|
|
2486
2503
|
/**
|
|
2487
2504
|
* Resolve the curated overlay, memoised. Order: in-memory `overlay` →
|
|
@@ -2490,12 +2507,12 @@ var DefaultModelsRegistry = class {
|
|
|
2490
2507
|
*/
|
|
2491
2508
|
async loadOverlay(opts = {}) {
|
|
2492
2509
|
if (this.overlayPayload && !opts.force) return this.overlayPayload;
|
|
2493
|
-
if (this.overlay) {
|
|
2510
|
+
if (hasEntries(this.overlay)) {
|
|
2494
2511
|
this.overlayPayload = this.overlay;
|
|
2495
2512
|
return this.overlayPayload;
|
|
2496
2513
|
}
|
|
2497
2514
|
const fetched = await this.loadOverlayFromUrl(opts);
|
|
2498
|
-
if (fetched) {
|
|
2515
|
+
if (hasEntries(fetched)) {
|
|
2499
2516
|
this.overlayPayload = fetched;
|
|
2500
2517
|
return fetched;
|
|
2501
2518
|
}
|
|
@@ -2622,6 +2639,9 @@ var DefaultModelsRegistry = class {
|
|
|
2622
2639
|
return path6.resolve(this.cacheFile);
|
|
2623
2640
|
}
|
|
2624
2641
|
};
|
|
2642
|
+
function hasEntries(payload) {
|
|
2643
|
+
return payload !== void 0 && Object.keys(payload).length > 0;
|
|
2644
|
+
}
|
|
2625
2645
|
|
|
2626
2646
|
// src/types/mode.ts
|
|
2627
2647
|
var DEFAULT_MODES = [
|
|
@@ -3029,7 +3049,7 @@ var InMemoryAgentBridge = class {
|
|
|
3029
3049
|
);
|
|
3030
3050
|
}
|
|
3031
3051
|
this.inflightGuards.add(correlationId);
|
|
3032
|
-
return new Promise((
|
|
3052
|
+
return new Promise((resolve12, reject) => {
|
|
3033
3053
|
const timer = setTimeout(() => {
|
|
3034
3054
|
this.inflightGuards.delete(correlationId);
|
|
3035
3055
|
this.pendingRequests.delete(correlationId);
|
|
@@ -3041,7 +3061,7 @@ var InMemoryAgentBridge = class {
|
|
|
3041
3061
|
return;
|
|
3042
3062
|
}
|
|
3043
3063
|
this.pendingRequests.set(correlationId, {
|
|
3044
|
-
resolve:
|
|
3064
|
+
resolve: resolve12,
|
|
3045
3065
|
reject,
|
|
3046
3066
|
timer
|
|
3047
3067
|
});
|
|
@@ -3234,11 +3254,11 @@ function validateAgainstSchema(value, schema) {
|
|
|
3234
3254
|
walk2(value, schema, "", errors);
|
|
3235
3255
|
return { ok: errors.length === 0, errors };
|
|
3236
3256
|
}
|
|
3237
|
-
function walk2(value, schema,
|
|
3257
|
+
function walk2(value, schema, path36, errors) {
|
|
3238
3258
|
if (schema.enum !== void 0) {
|
|
3239
3259
|
if (!schema.enum.some((e) => deepEqual(e, value))) {
|
|
3240
3260
|
errors.push({
|
|
3241
|
-
path:
|
|
3261
|
+
path: path36 || "<root>",
|
|
3242
3262
|
message: `expected one of ${JSON.stringify(schema.enum)}, got ${JSON.stringify(value)}`
|
|
3243
3263
|
});
|
|
3244
3264
|
return;
|
|
@@ -3247,7 +3267,7 @@ function walk2(value, schema, path35, errors) {
|
|
|
3247
3267
|
if (typeof schema.type === "string") {
|
|
3248
3268
|
if (!checkType(value, schema.type)) {
|
|
3249
3269
|
errors.push({
|
|
3250
|
-
path:
|
|
3270
|
+
path: path36 || "<root>",
|
|
3251
3271
|
message: `expected ${schema.type}, got ${describeType(value)}`
|
|
3252
3272
|
});
|
|
3253
3273
|
return;
|
|
@@ -3257,19 +3277,19 @@ function walk2(value, schema, path35, errors) {
|
|
|
3257
3277
|
const obj = value;
|
|
3258
3278
|
for (const req of schema.required ?? []) {
|
|
3259
3279
|
if (!(req in obj)) {
|
|
3260
|
-
errors.push({ path: joinPath(
|
|
3280
|
+
errors.push({ path: joinPath(path36, req), message: "required property missing" });
|
|
3261
3281
|
}
|
|
3262
3282
|
}
|
|
3263
3283
|
if (schema.properties) {
|
|
3264
3284
|
for (const [key, subSchema] of Object.entries(schema.properties)) {
|
|
3265
3285
|
if (key in obj) {
|
|
3266
|
-
walk2(obj[key], subSchema, joinPath(
|
|
3286
|
+
walk2(obj[key], subSchema, joinPath(path36, key), errors);
|
|
3267
3287
|
}
|
|
3268
3288
|
}
|
|
3269
3289
|
}
|
|
3270
3290
|
}
|
|
3271
3291
|
if (schema.type === "array" && Array.isArray(value) && schema.items) {
|
|
3272
|
-
value.forEach((item, i) => walk2(item, schema.items, `${
|
|
3292
|
+
value.forEach((item, i) => walk2(item, schema.items, `${path36}[${i}]`, errors));
|
|
3273
3293
|
}
|
|
3274
3294
|
}
|
|
3275
3295
|
function checkType(value, type) {
|
|
@@ -4417,7 +4437,7 @@ function projectHash(absRoot) {
|
|
|
4417
4437
|
return createHash("sha256").update(path6.resolve(absRoot)).digest("hex").slice(0, 12);
|
|
4418
4438
|
}
|
|
4419
4439
|
function resolveWstackPaths(opts) {
|
|
4420
|
-
const home = opts.userHome ??
|
|
4440
|
+
const home = opts.userHome ?? os6.homedir();
|
|
4421
4441
|
const globalRoot = opts.globalRoot ?? path6.join(home, ".wrongstack");
|
|
4422
4442
|
const hash = projectHash(opts.projectRoot);
|
|
4423
4443
|
const projectDir = path6.join(globalRoot, "projects", hash);
|
|
@@ -4747,6 +4767,23 @@ function tryParse(s) {
|
|
|
4747
4767
|
}
|
|
4748
4768
|
}
|
|
4749
4769
|
|
|
4770
|
+
// src/utils/merge-custom-models.ts
|
|
4771
|
+
function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
4772
|
+
const out = {};
|
|
4773
|
+
if (providerCustomModels) {
|
|
4774
|
+
for (const [id, def] of Object.entries(providerCustomModels)) {
|
|
4775
|
+
out[id] = { ...def };
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
if (configModels) {
|
|
4779
|
+
for (const [id, def] of Object.entries(configModels)) {
|
|
4780
|
+
out[id] = { ...def };
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
if (Object.keys(out).length === 0) return void 0;
|
|
4784
|
+
return out;
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4750
4787
|
// src/storage/session-store.ts
|
|
4751
4788
|
init_atomic_write();
|
|
4752
4789
|
var DefaultSessionStore = class {
|
|
@@ -6092,7 +6129,7 @@ var RecoveryLock = class {
|
|
|
6092
6129
|
constructor(opts) {
|
|
6093
6130
|
this.file = path6.join(opts.dir, LOCK_FILE);
|
|
6094
6131
|
this.pid = opts.pid ?? process.pid;
|
|
6095
|
-
this.hostname = opts.hostname ??
|
|
6132
|
+
this.hostname = opts.hostname ?? os6.hostname();
|
|
6096
6133
|
this.maxAgeMs = opts.maxAgeMs ?? DEFAULT_MAX_AGE_MS;
|
|
6097
6134
|
this.sessionStore = opts.sessionStore;
|
|
6098
6135
|
this.probe = opts.isPidAlive ?? defaultIsPidAlive;
|
|
@@ -7529,8 +7566,8 @@ async function streamProviderToResponse(provider, req, signal, ctx, events) {
|
|
|
7529
7566
|
try {
|
|
7530
7567
|
await Promise.race([
|
|
7531
7568
|
Promise.resolve(iter.return?.()),
|
|
7532
|
-
new Promise((
|
|
7533
|
-
drainTimer = setTimeout(
|
|
7569
|
+
new Promise((resolve12) => {
|
|
7570
|
+
drainTimer = setTimeout(resolve12, 500);
|
|
7534
7571
|
})
|
|
7535
7572
|
]);
|
|
7536
7573
|
} finally {
|
|
@@ -7591,7 +7628,7 @@ async function runProviderWithRetry(opts) {
|
|
|
7591
7628
|
description
|
|
7592
7629
|
});
|
|
7593
7630
|
}
|
|
7594
|
-
await new Promise((
|
|
7631
|
+
await new Promise((resolve12, reject) => {
|
|
7595
7632
|
let settled = false;
|
|
7596
7633
|
const onAbort = () => {
|
|
7597
7634
|
if (settled) return;
|
|
@@ -7604,7 +7641,7 @@ async function runProviderWithRetry(opts) {
|
|
|
7604
7641
|
settled = true;
|
|
7605
7642
|
clearTimeout(t2);
|
|
7606
7643
|
signal.removeEventListener("abort", onAbort);
|
|
7607
|
-
|
|
7644
|
+
resolve12();
|
|
7608
7645
|
}, delay);
|
|
7609
7646
|
if (signal.aborted) {
|
|
7610
7647
|
onAbort();
|
|
@@ -8611,7 +8648,7 @@ init_atomic_write();
|
|
|
8611
8648
|
var MAX_JOURNAL_ENTRIES = 500;
|
|
8612
8649
|
function goalFilePath(projectRoot) {
|
|
8613
8650
|
const hash = createHash("sha256").update(path6.resolve(projectRoot)).digest("hex").slice(0, 12);
|
|
8614
|
-
return path6.join(
|
|
8651
|
+
return path6.join(os6.homedir(), ".wrongstack", "projects", hash, "goal.json");
|
|
8615
8652
|
}
|
|
8616
8653
|
async function loadGoal(filePath) {
|
|
8617
8654
|
let raw;
|
|
@@ -9283,7 +9320,7 @@ ${recentJournal}` : "No prior iterations.",
|
|
|
9283
9320
|
}
|
|
9284
9321
|
};
|
|
9285
9322
|
function sleep(ms) {
|
|
9286
|
-
return new Promise((
|
|
9323
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
9287
9324
|
}
|
|
9288
9325
|
|
|
9289
9326
|
// src/coordination/subagent-budget.ts
|
|
@@ -9499,12 +9536,12 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
9499
9536
|
if (!bus || !bus.hasListenerFor("budget.threshold_reached")) {
|
|
9500
9537
|
return Promise.resolve("stop");
|
|
9501
9538
|
}
|
|
9502
|
-
return new Promise((
|
|
9539
|
+
return new Promise((resolve12) => {
|
|
9503
9540
|
let resolved = false;
|
|
9504
9541
|
const respond = (d) => {
|
|
9505
9542
|
if (resolved) return;
|
|
9506
9543
|
resolved = true;
|
|
9507
|
-
|
|
9544
|
+
resolve12(d);
|
|
9508
9545
|
};
|
|
9509
9546
|
const fallback = setTimeout(
|
|
9510
9547
|
() => respond("stop"),
|
|
@@ -12731,7 +12768,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
12731
12768
|
taskIds.map((id) => {
|
|
12732
12769
|
const cached = this.completedResults.find((r) => r.taskId === id);
|
|
12733
12770
|
if (cached) return cached;
|
|
12734
|
-
return new Promise((
|
|
12771
|
+
return new Promise((resolve12, reject) => {
|
|
12735
12772
|
const timeout = setTimeout(() => {
|
|
12736
12773
|
this.off("task.completed", handler);
|
|
12737
12774
|
reject(new Error(`awaitTasks timed out waiting for task "${id}"`));
|
|
@@ -12740,7 +12777,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
12740
12777
|
if (result.taskId === id) {
|
|
12741
12778
|
clearTimeout(timeout);
|
|
12742
12779
|
this.off("task.completed", handler);
|
|
12743
|
-
|
|
12780
|
+
resolve12(result);
|
|
12744
12781
|
}
|
|
12745
12782
|
};
|
|
12746
12783
|
this.on("task.completed", handler);
|
|
@@ -13243,7 +13280,7 @@ function providerErrorToSubagentError(err, message, cause) {
|
|
|
13243
13280
|
|
|
13244
13281
|
// src/execution/parallel-eternal-engine.ts
|
|
13245
13282
|
function sleep2(ms) {
|
|
13246
|
-
return new Promise((
|
|
13283
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
13247
13284
|
}
|
|
13248
13285
|
var GOAL_COMPLETE_MARKER2 = /^\s*\[goal[_\s-]?complete\]\s*$/im;
|
|
13249
13286
|
var ParallelEternalEngine = class {
|
|
@@ -13309,8 +13346,14 @@ var ParallelEternalEngine = class {
|
|
|
13309
13346
|
await this.runOneIteration();
|
|
13310
13347
|
} catch (err) {
|
|
13311
13348
|
this.consecutiveFailures++;
|
|
13312
|
-
this.opts.onError?.(
|
|
13313
|
-
|
|
13349
|
+
this.opts.onError?.(
|
|
13350
|
+
err instanceof Error ? err : new Error(String(err)),
|
|
13351
|
+
this.consecutiveFailures
|
|
13352
|
+
);
|
|
13353
|
+
await this.appendFailure(
|
|
13354
|
+
"engine error",
|
|
13355
|
+
err instanceof Error ? err.message : String(err)
|
|
13356
|
+
);
|
|
13314
13357
|
}
|
|
13315
13358
|
if (this.stopRequested) break;
|
|
13316
13359
|
await sleep2(2e3);
|
|
@@ -13326,14 +13369,19 @@ var ParallelEternalEngine = class {
|
|
|
13326
13369
|
* Called by the REPL in its main loop (REPL drives, engine is stateless per tick).
|
|
13327
13370
|
*/
|
|
13328
13371
|
async runOneIteration() {
|
|
13372
|
+
const emit = (stage) => {
|
|
13373
|
+
this.opts.onStage?.(stage);
|
|
13374
|
+
};
|
|
13329
13375
|
this.iterations++;
|
|
13330
13376
|
const goal = await loadGoal(this.goalPath);
|
|
13331
13377
|
if (!goal) {
|
|
13332
13378
|
this.stopRequested = true;
|
|
13379
|
+
emit({ phase: "stopped" });
|
|
13333
13380
|
return false;
|
|
13334
13381
|
}
|
|
13335
13382
|
if (goal.goalState !== "active") {
|
|
13336
13383
|
this.stopRequested = true;
|
|
13384
|
+
emit({ phase: "stopped" });
|
|
13337
13385
|
return false;
|
|
13338
13386
|
}
|
|
13339
13387
|
if (!this.coordinator) {
|
|
@@ -13346,10 +13394,13 @@ var ParallelEternalEngine = class {
|
|
|
13346
13394
|
const runner = makeAgentSubagentRunner({ factory: this.agentFactory });
|
|
13347
13395
|
this.coordinator.setRunner?.(runner);
|
|
13348
13396
|
}
|
|
13397
|
+
emit({ phase: "decompose" });
|
|
13349
13398
|
const tasks = await this.decomposeGoal(goal);
|
|
13350
13399
|
if (!tasks || tasks.length === 0) {
|
|
13400
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
13351
13401
|
return false;
|
|
13352
13402
|
}
|
|
13403
|
+
emit({ phase: "fanout", slots: Math.min(this.slots, tasks.length) });
|
|
13353
13404
|
const fanOut = await this.fanOut(goal, tasks);
|
|
13354
13405
|
this.iterationsSinceCompact++;
|
|
13355
13406
|
const successCount = fanOut.results.filter((r) => r.status === "success").length;
|
|
@@ -13366,12 +13417,20 @@ var ParallelEternalEngine = class {
|
|
|
13366
13417
|
status,
|
|
13367
13418
|
note
|
|
13368
13419
|
});
|
|
13420
|
+
emit({
|
|
13421
|
+
phase: "aggregate",
|
|
13422
|
+
successCount,
|
|
13423
|
+
total: fanOut.results.length,
|
|
13424
|
+
goalComplete: fanOut.goalComplete
|
|
13425
|
+
});
|
|
13369
13426
|
if (fanOut.goalComplete) {
|
|
13370
13427
|
this.stopRequested = true;
|
|
13371
13428
|
this.state = "stopped";
|
|
13429
|
+
emit({ phase: "stopped" });
|
|
13372
13430
|
return true;
|
|
13373
13431
|
}
|
|
13374
13432
|
await this.maybeCompact();
|
|
13433
|
+
emit({ phase: "sleep", ms: 2e3 });
|
|
13375
13434
|
return fanOut.allSuccessful;
|
|
13376
13435
|
}
|
|
13377
13436
|
// -------------------------------------------------------------------------
|
|
@@ -13385,7 +13444,9 @@ var ParallelEternalEngine = class {
|
|
|
13385
13444
|
(t2) => dispatchAgent(t2, { classifier: this.dispatchClassifier }).catch(() => null)
|
|
13386
13445
|
)
|
|
13387
13446
|
) : [];
|
|
13388
|
-
const recentJournal = goal.journal.slice(-5).map(
|
|
13447
|
+
const recentJournal = goal.journal.slice(-5).map(
|
|
13448
|
+
(e) => ` #${e.iteration} [${e.status}] ${e.task}${e.note ? ` \u2014 ${e.note.slice(0, 80)}` : ""}`
|
|
13449
|
+
).join("\n");
|
|
13389
13450
|
const directivePreamble = [
|
|
13390
13451
|
"\u2550\u2550\u2550 ETERNAL AUTONOMY \u2014 parallel task slot \u2550\u2550\u2550",
|
|
13391
13452
|
"",
|
|
@@ -13428,35 +13489,44 @@ ${personaLine}Task: ${task}
|
|
|
13428
13489
|
role: route?.role ?? "generic",
|
|
13429
13490
|
method: route?.method ?? "none"
|
|
13430
13491
|
});
|
|
13431
|
-
spawnPromises.push(
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13492
|
+
spawnPromises.push(
|
|
13493
|
+
(async () => {
|
|
13494
|
+
try {
|
|
13495
|
+
await coordinator.spawn(
|
|
13496
|
+
route ? {
|
|
13497
|
+
id: subagentId,
|
|
13498
|
+
name: route.definition.config.name,
|
|
13499
|
+
role: route.role,
|
|
13500
|
+
tools: route.definition.config.tools,
|
|
13501
|
+
systemPromptOverride: route.definition.config.prompt,
|
|
13502
|
+
timeoutMs: this.timeoutMs
|
|
13503
|
+
} : {
|
|
13504
|
+
id: subagentId,
|
|
13505
|
+
name: `slot-${subagentId.slice(-6)}`,
|
|
13506
|
+
// Let the coordinator apply its default budget (roster or generic).
|
|
13507
|
+
// Hardcoding low limits here defeats the x10 budget improvement.
|
|
13508
|
+
timeoutMs: this.timeoutMs
|
|
13509
|
+
}
|
|
13510
|
+
);
|
|
13511
|
+
subagentIds.push(subagentId);
|
|
13512
|
+
taskIds.push(taskId);
|
|
13513
|
+
await coordinator.assign(spec);
|
|
13514
|
+
} catch {
|
|
13515
|
+
}
|
|
13516
|
+
})()
|
|
13517
|
+
);
|
|
13455
13518
|
}
|
|
13456
13519
|
await Promise.all(spawnPromises);
|
|
13457
13520
|
if (taskIds.length === 0) {
|
|
13458
|
-
return {
|
|
13521
|
+
return {
|
|
13522
|
+
results: [],
|
|
13523
|
+
allSuccessful: false,
|
|
13524
|
+
goalComplete: false,
|
|
13525
|
+
partialOutput: "",
|
|
13526
|
+
routes: routeInfo
|
|
13527
|
+
};
|
|
13459
13528
|
}
|
|
13529
|
+
this.opts.onStage?.({ phase: "await", taskIds: [...taskIds] });
|
|
13460
13530
|
let results = [];
|
|
13461
13531
|
try {
|
|
13462
13532
|
const ctrl = new AbortController();
|
|
@@ -15158,6 +15228,12 @@ var Director = class _Director {
|
|
|
15158
15228
|
getLeaderContextPressure() {
|
|
15159
15229
|
return this.leaderContextPressure;
|
|
15160
15230
|
}
|
|
15231
|
+
resolveMaxContext() {
|
|
15232
|
+
const resolved = typeof this.maxContext === "function" ? this.maxContext() : this.maxContext;
|
|
15233
|
+
return resolved && resolved > 0 ? resolved : 128e3;
|
|
15234
|
+
}
|
|
15235
|
+
/** Optional Brain arbiter for director-level policy decisions. */
|
|
15236
|
+
brain;
|
|
15161
15237
|
/**
|
|
15162
15238
|
* Optional fleet-level policy container. When provided the Director
|
|
15163
15239
|
* delegates spawn budgeting, manifest entries, and checkpointing to it
|
|
@@ -15249,7 +15325,7 @@ var Director = class _Director {
|
|
|
15249
15325
|
leaderContextPressure = 0;
|
|
15250
15326
|
/** Maximum context load fraction before spawn is refused. */
|
|
15251
15327
|
maxLeaderContextLoad;
|
|
15252
|
-
/** Provider's max context window in tokens. */
|
|
15328
|
+
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
15253
15329
|
maxContext;
|
|
15254
15330
|
/** Per-task model matrix (static record or live getter); resolved
|
|
15255
15331
|
* per-spawn when no explicit model is set. */
|
|
@@ -15269,6 +15345,7 @@ var Director = class _Director {
|
|
|
15269
15345
|
largeAnswerStore;
|
|
15270
15346
|
constructor(opts) {
|
|
15271
15347
|
this.id = opts.config.coordinatorId || randomUUID();
|
|
15348
|
+
this.brain = opts.brain;
|
|
15272
15349
|
this.manifestPath = opts.manifestPath;
|
|
15273
15350
|
this.roster = opts.roster;
|
|
15274
15351
|
this.directorPreamble = opts.directorPreamble ?? DEFAULT_DIRECTOR_PREAMBLE;
|
|
@@ -15413,33 +15490,81 @@ var Director = class _Director {
|
|
|
15413
15490
|
return;
|
|
15414
15491
|
}
|
|
15415
15492
|
}
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15493
|
+
const grantExtension = () => {
|
|
15494
|
+
setImmediate(() => {
|
|
15495
|
+
const extra = {};
|
|
15496
|
+
const base = Math.max(payload.limit, payload.used);
|
|
15497
|
+
const grow = (ceiling) => Math.min(Math.ceil(base * 1.5), ceiling);
|
|
15498
|
+
let newLimit = base;
|
|
15499
|
+
switch (payload.kind) {
|
|
15500
|
+
case "iterations":
|
|
15501
|
+
newLimit = grow(5e4);
|
|
15502
|
+
extra.maxIterations = newLimit;
|
|
15503
|
+
break;
|
|
15504
|
+
case "tool_calls":
|
|
15505
|
+
newLimit = grow(1e5);
|
|
15506
|
+
extra.maxToolCalls = newLimit;
|
|
15507
|
+
break;
|
|
15508
|
+
case "tokens":
|
|
15509
|
+
newLimit = grow(5e6);
|
|
15510
|
+
extra.maxTokens = newLimit;
|
|
15511
|
+
break;
|
|
15512
|
+
case "cost":
|
|
15513
|
+
newLimit = Math.min(base * 1.5, 100);
|
|
15514
|
+
extra.maxCostUsd = newLimit;
|
|
15515
|
+
break;
|
|
15516
|
+
}
|
|
15517
|
+
extendCounts.set(guardKey, prior + 1);
|
|
15518
|
+
this.recordExtension(e.subagentId, e.taskId, payload.kind, newLimit);
|
|
15519
|
+
payload.extend(extra);
|
|
15520
|
+
});
|
|
15521
|
+
};
|
|
15522
|
+
if (this.brain) {
|
|
15523
|
+
void this.brain.decide({
|
|
15524
|
+
id: `director-budget-${e.subagentId}-${payload.kind}`,
|
|
15525
|
+
source: "director",
|
|
15526
|
+
question: `Should the director extend the ${payload.kind} budget for subagent ${e.subagentId}?`,
|
|
15527
|
+
context: [
|
|
15528
|
+
e.taskId ? `Task id: ${e.taskId}` : void 0,
|
|
15529
|
+
`Used: ${payload.used}`,
|
|
15530
|
+
`Limit: ${payload.limit}`,
|
|
15531
|
+
`Prior extensions for this kind: ${prior}`
|
|
15532
|
+
].filter(Boolean).join("\n"),
|
|
15533
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
15534
|
+
fallback: "continue",
|
|
15535
|
+
options: [
|
|
15536
|
+
{
|
|
15537
|
+
id: "extend",
|
|
15538
|
+
label: "Grant the director default budget extension",
|
|
15539
|
+
consequence: "The subagent continues with a larger per-kind budget.",
|
|
15540
|
+
risk: payload.kind === "cost" ? "high" : "medium",
|
|
15541
|
+
recommended: true
|
|
15542
|
+
},
|
|
15543
|
+
{
|
|
15544
|
+
id: "stop",
|
|
15545
|
+
label: "Stop this subagent at the current budget limit",
|
|
15546
|
+
consequence: "The current task will fail or stop due to budget pressure.",
|
|
15547
|
+
risk: "low"
|
|
15548
|
+
}
|
|
15549
|
+
]
|
|
15550
|
+
}).then((decision) => {
|
|
15551
|
+
if (decision.type === "deny") {
|
|
15552
|
+
payload.deny();
|
|
15553
|
+
return;
|
|
15554
|
+
}
|
|
15555
|
+
if (decision.type === "ask_human") {
|
|
15556
|
+
payload.deny();
|
|
15557
|
+
return;
|
|
15558
|
+
}
|
|
15559
|
+
if (decision.optionId === "stop" || /\bstop\b/i.test(decision.text)) {
|
|
15560
|
+
payload.deny();
|
|
15561
|
+
return;
|
|
15562
|
+
}
|
|
15563
|
+
grantExtension();
|
|
15564
|
+
}).catch(() => payload.deny());
|
|
15565
|
+
return;
|
|
15566
|
+
}
|
|
15567
|
+
grantExtension();
|
|
15443
15568
|
});
|
|
15444
15569
|
this.largeAnswerStore = new LargeAnswerStore(2e3);
|
|
15445
15570
|
}
|
|
@@ -15649,7 +15774,8 @@ var Director = class _Director {
|
|
|
15649
15774
|
}
|
|
15650
15775
|
}
|
|
15651
15776
|
if (this.maxLeaderContextLoad < 1) {
|
|
15652
|
-
const
|
|
15777
|
+
const maxContext = this.resolveMaxContext();
|
|
15778
|
+
const threshold = maxContext * this.maxLeaderContextLoad;
|
|
15653
15779
|
if (this.leaderContextPressure >= threshold) {
|
|
15654
15780
|
throw new FleetContextOverflowError(threshold, this.leaderContextPressure);
|
|
15655
15781
|
}
|
|
@@ -15959,11 +16085,11 @@ var Director = class _Director {
|
|
|
15959
16085
|
if (cached) return cached;
|
|
15960
16086
|
const existing = this.taskWaiters.get(id);
|
|
15961
16087
|
if (existing) return existing.promise;
|
|
15962
|
-
let
|
|
16088
|
+
let resolve12;
|
|
15963
16089
|
const promise = new Promise((res) => {
|
|
15964
|
-
|
|
16090
|
+
resolve12 = res;
|
|
15965
16091
|
});
|
|
15966
|
-
this.taskWaiters.set(id, { promise, resolve:
|
|
16092
|
+
this.taskWaiters.set(id, { promise, resolve: resolve12 });
|
|
15967
16093
|
return promise;
|
|
15968
16094
|
})
|
|
15969
16095
|
);
|
|
@@ -16348,7 +16474,7 @@ function createDelegateTool(opts) {
|
|
|
16348
16474
|
subagentId
|
|
16349
16475
|
});
|
|
16350
16476
|
const dir = director;
|
|
16351
|
-
const result = await new Promise((
|
|
16477
|
+
const result = await new Promise((resolve12) => {
|
|
16352
16478
|
let settled = false;
|
|
16353
16479
|
let timer;
|
|
16354
16480
|
const finish = (value) => {
|
|
@@ -16358,7 +16484,7 @@ function createDelegateTool(opts) {
|
|
|
16358
16484
|
offTool();
|
|
16359
16485
|
offIter();
|
|
16360
16486
|
offProgress();
|
|
16361
|
-
|
|
16487
|
+
resolve12(value);
|
|
16362
16488
|
};
|
|
16363
16489
|
const arm = () => {
|
|
16364
16490
|
if (timer) clearTimeout(timer);
|
|
@@ -17988,9 +18114,9 @@ var AISpecBuilder = class {
|
|
|
17988
18114
|
if (!this.sessionPath) return;
|
|
17989
18115
|
try {
|
|
17990
18116
|
const fsp20 = await import('fs/promises');
|
|
17991
|
-
const
|
|
18117
|
+
const path36 = await import('path');
|
|
17992
18118
|
const { atomicWrite: atomicWrite2 } = await Promise.resolve().then(() => (init_atomic_write(), atomic_write_exports));
|
|
17993
|
-
await fsp20.mkdir(
|
|
18119
|
+
await fsp20.mkdir(path36.dirname(this.sessionPath), { recursive: true });
|
|
17994
18120
|
await atomicWrite2(this.sessionPath, JSON.stringify(this.session, null, 2));
|
|
17995
18121
|
} catch {
|
|
17996
18122
|
}
|
|
@@ -18700,15 +18826,15 @@ function computeCriticalPath(graph, _topoOrder, blockedByMap) {
|
|
|
18700
18826
|
maxId = id;
|
|
18701
18827
|
}
|
|
18702
18828
|
}
|
|
18703
|
-
const
|
|
18829
|
+
const path36 = [];
|
|
18704
18830
|
let current = maxId;
|
|
18705
18831
|
const visited = /* @__PURE__ */ new Set();
|
|
18706
18832
|
while (current && !visited.has(current)) {
|
|
18707
18833
|
visited.add(current);
|
|
18708
|
-
|
|
18834
|
+
path36.unshift(current);
|
|
18709
18835
|
current = prev.get(current) ?? null;
|
|
18710
18836
|
}
|
|
18711
|
-
return
|
|
18837
|
+
return path36;
|
|
18712
18838
|
}
|
|
18713
18839
|
function computeParallelGroups(graph, blockedByMap) {
|
|
18714
18840
|
const groups = [];
|
|
@@ -19501,9 +19627,9 @@ var DefaultHealthRegistry = class {
|
|
|
19501
19627
|
}
|
|
19502
19628
|
async runOne(check) {
|
|
19503
19629
|
let timer = null;
|
|
19504
|
-
const timeout = new Promise((
|
|
19630
|
+
const timeout = new Promise((resolve12) => {
|
|
19505
19631
|
timer = setTimeout(
|
|
19506
|
-
() =>
|
|
19632
|
+
() => resolve12({ status: "unhealthy", detail: `timeout after ${this.timeoutMs}ms` }),
|
|
19507
19633
|
this.timeoutMs
|
|
19508
19634
|
);
|
|
19509
19635
|
});
|
|
@@ -19686,7 +19812,7 @@ async function startMetricsServer(opts) {
|
|
|
19686
19812
|
const tls = opts.tls;
|
|
19687
19813
|
const useHttps = !!(tls?.cert && tls?.key);
|
|
19688
19814
|
const host = opts.host ?? "127.0.0.1";
|
|
19689
|
-
const
|
|
19815
|
+
const path36 = opts.path ?? "/metrics";
|
|
19690
19816
|
const healthPath = opts.healthPath ?? "/healthz";
|
|
19691
19817
|
const healthRegistry = opts.healthRegistry;
|
|
19692
19818
|
const listener = (req, res) => {
|
|
@@ -19696,7 +19822,7 @@ async function startMetricsServer(opts) {
|
|
|
19696
19822
|
return;
|
|
19697
19823
|
}
|
|
19698
19824
|
const url = req.url.split("?")[0];
|
|
19699
|
-
if (url ===
|
|
19825
|
+
if (url === path36) {
|
|
19700
19826
|
let body;
|
|
19701
19827
|
try {
|
|
19702
19828
|
body = renderPrometheus(opts.sink.snapshot());
|
|
@@ -19742,14 +19868,14 @@ async function startMetricsServer(opts) {
|
|
|
19742
19868
|
const { createServer } = await import('http');
|
|
19743
19869
|
server = createServer(listener);
|
|
19744
19870
|
}
|
|
19745
|
-
await new Promise((
|
|
19871
|
+
await new Promise((resolve12, reject) => {
|
|
19746
19872
|
const onError = (err) => {
|
|
19747
19873
|
server.off("listening", onListening);
|
|
19748
19874
|
reject(err);
|
|
19749
19875
|
};
|
|
19750
19876
|
const onListening = () => {
|
|
19751
19877
|
server.off("error", onError);
|
|
19752
|
-
|
|
19878
|
+
resolve12();
|
|
19753
19879
|
};
|
|
19754
19880
|
server.once("error", onError);
|
|
19755
19881
|
server.once("listening", onListening);
|
|
@@ -19760,9 +19886,9 @@ async function startMetricsServer(opts) {
|
|
|
19760
19886
|
const protocol = useHttps ? "https" : "http";
|
|
19761
19887
|
return {
|
|
19762
19888
|
port: boundPort,
|
|
19763
|
-
url: `${protocol}://${host}:${boundPort}${
|
|
19764
|
-
close: () => new Promise((
|
|
19765
|
-
server.close((err) => err ? reject(err) :
|
|
19889
|
+
url: `${protocol}://${host}:${boundPort}${path36}`,
|
|
19890
|
+
close: () => new Promise((resolve12, reject) => {
|
|
19891
|
+
server.close((err) => err ? reject(err) : resolve12());
|
|
19766
19892
|
})
|
|
19767
19893
|
};
|
|
19768
19894
|
}
|
|
@@ -20462,7 +20588,7 @@ async function downloadGitHubTarball(parsed) {
|
|
|
20462
20588
|
`Tarball too large (${(Number.parseInt(contentLength, 10) / 1024 / 1024).toFixed(1)}MB). Max: ${MAX_TARBALL_SIZE / 1024 / 1024}MB`
|
|
20463
20589
|
);
|
|
20464
20590
|
}
|
|
20465
|
-
const tempDir = await fsp3.mkdtemp(path6.join(
|
|
20591
|
+
const tempDir = await fsp3.mkdtemp(path6.join(os6.tmpdir(), "wskill-"));
|
|
20466
20592
|
try {
|
|
20467
20593
|
if (!response.body) {
|
|
20468
20594
|
throw new Error("Empty response body from GitHub API");
|
|
@@ -21901,7 +22027,7 @@ var CloudSync = class {
|
|
|
21901
22027
|
const localPath = this.categoryToPath(cat);
|
|
21902
22028
|
if (!localPath) continue;
|
|
21903
22029
|
const rel = segments.slice(2).join("/");
|
|
21904
|
-
const destPath =
|
|
22030
|
+
const destPath = resolvePulledCategoryPath(cat, localPath, rel, entry.path);
|
|
21905
22031
|
const blobData = await this.getBlob(token, owner, repoName, entry.sha);
|
|
21906
22032
|
await fsp3.mkdir(path6.dirname(destPath), { recursive: true });
|
|
21907
22033
|
await fsp3.writeFile(destPath, Buffer.from(blobData, "base64"));
|
|
@@ -22075,6 +22201,26 @@ var CloudSync = class {
|
|
|
22075
22201
|
return results;
|
|
22076
22202
|
}
|
|
22077
22203
|
};
|
|
22204
|
+
function resolvePulledCategoryPath(cat, localPath, rel, remotePath) {
|
|
22205
|
+
const directoryBacked = cat === "skills" || cat === "prompts";
|
|
22206
|
+
if (!directoryBacked) {
|
|
22207
|
+
if (rel) throw new Error(`Refusing nested CloudSync path for file category: ${remotePath}`);
|
|
22208
|
+
return localPath;
|
|
22209
|
+
}
|
|
22210
|
+
if (!rel) return localPath;
|
|
22211
|
+
const normalizedRel = path6.normalize(rel);
|
|
22212
|
+
const traversesUp = normalizedRel === ".." || normalizedRel.startsWith(`..${path6.sep}`);
|
|
22213
|
+
if (path6.isAbsolute(normalizedRel) || traversesUp) {
|
|
22214
|
+
throw new Error(`Refusing CloudSync path traversal: ${remotePath}`);
|
|
22215
|
+
}
|
|
22216
|
+
const dest = path6.resolve(localPath, normalizedRel);
|
|
22217
|
+
const root = path6.resolve(localPath);
|
|
22218
|
+
const relative7 = path6.relative(root, dest);
|
|
22219
|
+
if (relative7.startsWith("..") || path6.isAbsolute(relative7)) {
|
|
22220
|
+
throw new Error(`Refusing CloudSync path outside category root: ${remotePath}`);
|
|
22221
|
+
}
|
|
22222
|
+
return dest;
|
|
22223
|
+
}
|
|
22078
22224
|
function timeAgo(iso) {
|
|
22079
22225
|
const diff = Date.now() - new Date(iso).getTime();
|
|
22080
22226
|
const mins = Math.floor(diff / 6e4);
|
|
@@ -22962,8 +23108,8 @@ var ReportGenerator = class {
|
|
|
22962
23108
|
try {
|
|
22963
23109
|
await stat(this.options.outputDir);
|
|
22964
23110
|
} catch {
|
|
22965
|
-
const { mkdir:
|
|
22966
|
-
await
|
|
23111
|
+
const { mkdir: mkdir16 } = await import('fs/promises');
|
|
23112
|
+
await mkdir16(this.options.outputDir, { recursive: true });
|
|
22967
23113
|
}
|
|
22968
23114
|
}
|
|
22969
23115
|
generateMarkdown(result) {
|
|
@@ -23243,7 +23389,7 @@ var SecurityScannerOrchestrator = class {
|
|
|
23243
23389
|
const delay = Math.round(policy.delayMs(attempt));
|
|
23244
23390
|
const status = isProviderErr ? err.status : 0;
|
|
23245
23391
|
console.warn(`[SecurityScanner] retry ${attempt + 1} after ${delay}ms (status=${status}) \u2014 ${errAsErr.message}`);
|
|
23246
|
-
await new Promise((
|
|
23392
|
+
await new Promise((resolve12) => setTimeout(resolve12, delay));
|
|
23247
23393
|
return this.completeWithRetry(provider, request, abortController, attempt + 1);
|
|
23248
23394
|
}
|
|
23249
23395
|
}
|
|
@@ -23988,7 +24134,7 @@ var FleetManager = class {
|
|
|
23988
24134
|
leaderContextPressure = 0;
|
|
23989
24135
|
/** Maximum context load fraction before spawn is refused. */
|
|
23990
24136
|
maxLeaderContextLoad;
|
|
23991
|
-
/** Provider's max context window in tokens. */
|
|
24137
|
+
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
23992
24138
|
maxContext;
|
|
23993
24139
|
constructor(opts = {}) {
|
|
23994
24140
|
this.manifestPath = opts.manifestPath;
|
|
@@ -24068,7 +24214,8 @@ var FleetManager = class {
|
|
|
24068
24214
|
}
|
|
24069
24215
|
}
|
|
24070
24216
|
if (this.maxLeaderContextLoad < 1) {
|
|
24071
|
-
const
|
|
24217
|
+
const maxContext = this.resolveMaxContext();
|
|
24218
|
+
const threshold = maxContext * this.maxLeaderContextLoad;
|
|
24072
24219
|
if (this.leaderContextPressure >= threshold) {
|
|
24073
24220
|
return {
|
|
24074
24221
|
kind: "max_context_load",
|
|
@@ -24082,6 +24229,10 @@ var FleetManager = class {
|
|
|
24082
24229
|
setLeaderContextPressure(tokens) {
|
|
24083
24230
|
this.leaderContextPressure = tokens;
|
|
24084
24231
|
}
|
|
24232
|
+
resolveMaxContext() {
|
|
24233
|
+
const resolved = typeof this.maxContext === "function" ? this.maxContext() : this.maxContext;
|
|
24234
|
+
return resolved && resolved > 0 ? resolved : 128e3;
|
|
24235
|
+
}
|
|
24085
24236
|
/**
|
|
24086
24237
|
* Assign a memorable nickname (e.g. "Einstein (Bug Hunter)") to the config,
|
|
24087
24238
|
* record it so the same name is never reused, then record the spawn.
|
|
@@ -24814,12 +24965,12 @@ function makeContinueToNextIterationTool() {
|
|
|
24814
24965
|
// src/core/iteration-limit.ts
|
|
24815
24966
|
function requestLimitExtension(opts) {
|
|
24816
24967
|
const { events, currentIterations, currentLimit, autoExtend, timeoutMs = 3e4 } = opts;
|
|
24817
|
-
return new Promise((
|
|
24968
|
+
return new Promise((resolve12) => {
|
|
24818
24969
|
let resolved = false;
|
|
24819
24970
|
const timerFired = () => {
|
|
24820
24971
|
if (!resolved) {
|
|
24821
24972
|
resolved = true;
|
|
24822
|
-
|
|
24973
|
+
resolve12(0);
|
|
24823
24974
|
}
|
|
24824
24975
|
};
|
|
24825
24976
|
const timer = setTimeout(timerFired, timeoutMs);
|
|
@@ -24828,14 +24979,14 @@ function requestLimitExtension(opts) {
|
|
|
24828
24979
|
if (!resolved) {
|
|
24829
24980
|
resolved = true;
|
|
24830
24981
|
clearTimeout(timer);
|
|
24831
|
-
|
|
24982
|
+
resolve12(0);
|
|
24832
24983
|
}
|
|
24833
24984
|
};
|
|
24834
24985
|
const grant = (extra) => {
|
|
24835
24986
|
if (!resolved) {
|
|
24836
24987
|
resolved = true;
|
|
24837
24988
|
clearTimeout(timer);
|
|
24838
|
-
|
|
24989
|
+
resolve12(Math.max(0, extra));
|
|
24839
24990
|
}
|
|
24840
24991
|
};
|
|
24841
24992
|
events.emit("iteration.limit_reached", {
|
|
@@ -24849,7 +25000,7 @@ function requestLimitExtension(opts) {
|
|
|
24849
25000
|
if (!resolved) {
|
|
24850
25001
|
resolved = true;
|
|
24851
25002
|
clearTimeout(timer);
|
|
24852
|
-
|
|
25003
|
+
resolve12(100);
|
|
24853
25004
|
}
|
|
24854
25005
|
});
|
|
24855
25006
|
}
|
|
@@ -25441,13 +25592,13 @@ var Agent = class {
|
|
|
25441
25592
|
}
|
|
25442
25593
|
}
|
|
25443
25594
|
waitForConfirm(info) {
|
|
25444
|
-
return new Promise((
|
|
25595
|
+
return new Promise((resolve12) => {
|
|
25445
25596
|
this.events.emit("tool.confirm_needed", {
|
|
25446
25597
|
tool: info.tool,
|
|
25447
25598
|
input: info.input,
|
|
25448
25599
|
toolUseId: info.toolUseId,
|
|
25449
25600
|
suggestedPattern: info.suggestedPattern,
|
|
25450
|
-
resolve:
|
|
25601
|
+
resolve: resolve12
|
|
25451
25602
|
});
|
|
25452
25603
|
});
|
|
25453
25604
|
}
|
|
@@ -25521,6 +25672,85 @@ function sizeSignals(toolName, content) {
|
|
|
25521
25672
|
}
|
|
25522
25673
|
return { outputBytes, outputTokens, outputLines };
|
|
25523
25674
|
}
|
|
25675
|
+
async function bootConfig(options = {}) {
|
|
25676
|
+
const { flags = {}, appLabel = "wstack", loadSyncConfig = true } = options;
|
|
25677
|
+
const cwd = typeof flags["cwd"] === "string" ? path6.resolve(flags["cwd"]) : process.cwd();
|
|
25678
|
+
const pathResolver = new DefaultPathResolver(cwd);
|
|
25679
|
+
const projectRoot = pathResolver.projectRoot;
|
|
25680
|
+
const userHome = os6.homedir();
|
|
25681
|
+
const wpaths = resolveWstackPaths({ projectRoot, userHome });
|
|
25682
|
+
await fsp3.mkdir(wpaths.globalRoot, { recursive: true });
|
|
25683
|
+
await fsp3.mkdir(wpaths.projectDir, { recursive: true });
|
|
25684
|
+
await fsp3.mkdir(wpaths.projectSessions, { recursive: true });
|
|
25685
|
+
await writeProjectMeta(wpaths, projectRoot);
|
|
25686
|
+
const vault = new DefaultSecretVault({ keyFile: wpaths.secretsKey });
|
|
25687
|
+
for (const file of [wpaths.globalConfig, wpaths.projectLocalConfig]) {
|
|
25688
|
+
try {
|
|
25689
|
+
const { migrated } = await migratePlaintextSecrets(file, vault);
|
|
25690
|
+
if (migrated > 0) {
|
|
25691
|
+
writeErr(`[${appLabel}] Encrypted ${migrated} plaintext secret(s) in ${file}
|
|
25692
|
+
`);
|
|
25693
|
+
}
|
|
25694
|
+
} catch {
|
|
25695
|
+
}
|
|
25696
|
+
}
|
|
25697
|
+
const configLoader = new DefaultConfigLoader({ paths: wpaths, vault });
|
|
25698
|
+
let config = await configLoader.load({ cliFlags: flagsToConfigPatch(flags) });
|
|
25699
|
+
if (loadSyncConfig) {
|
|
25700
|
+
const syncConfig = await configLoader.loadSyncConfig();
|
|
25701
|
+
if (syncConfig) {
|
|
25702
|
+
config = Object.freeze({ ...config, sync: syncConfig });
|
|
25703
|
+
}
|
|
25704
|
+
}
|
|
25705
|
+
const logger = new DefaultLogger({ level: config.log?.level ?? "info", file: wpaths.logFile });
|
|
25706
|
+
return {
|
|
25707
|
+
cwd,
|
|
25708
|
+
projectRoot,
|
|
25709
|
+
userHome,
|
|
25710
|
+
wpaths,
|
|
25711
|
+
pathResolver,
|
|
25712
|
+
config,
|
|
25713
|
+
vault,
|
|
25714
|
+
logger,
|
|
25715
|
+
globalConfigPath: wpaths.globalConfig
|
|
25716
|
+
};
|
|
25717
|
+
}
|
|
25718
|
+
function flagsToConfigPatch(flags) {
|
|
25719
|
+
const patch = {};
|
|
25720
|
+
if (typeof flags["provider"] === "string") patch.provider = flags["provider"];
|
|
25721
|
+
if (typeof flags["model"] === "string") patch.model = flags["model"];
|
|
25722
|
+
if (typeof flags["cwd"] === "string") patch.cwd = flags["cwd"];
|
|
25723
|
+
if (typeof flags["log-level"] === "string") {
|
|
25724
|
+
patch.log = { level: flags["log-level"] };
|
|
25725
|
+
} else if (flags["verbose"]) {
|
|
25726
|
+
patch.log = { level: "debug" };
|
|
25727
|
+
} else if (flags["trace"]) {
|
|
25728
|
+
patch.log = { level: "trace" };
|
|
25729
|
+
}
|
|
25730
|
+
if (flags["yolo"]) patch.yolo = true;
|
|
25731
|
+
if (flags["no-features"]) {
|
|
25732
|
+
patch.features = {
|
|
25733
|
+
mcp: false,
|
|
25734
|
+
plugins: false,
|
|
25735
|
+
memory: false,
|
|
25736
|
+
modelsRegistry: false,
|
|
25737
|
+
skills: false
|
|
25738
|
+
};
|
|
25739
|
+
}
|
|
25740
|
+
return patch;
|
|
25741
|
+
}
|
|
25742
|
+
async function writeProjectMeta(paths, projectRoot) {
|
|
25743
|
+
try {
|
|
25744
|
+
await fsp3.mkdir(paths.projectDir, { recursive: true });
|
|
25745
|
+
const meta = {
|
|
25746
|
+
hash: paths.projectHash,
|
|
25747
|
+
root: projectRoot,
|
|
25748
|
+
lastSeen: (/* @__PURE__ */ new Date()).toISOString()
|
|
25749
|
+
};
|
|
25750
|
+
await fsp3.writeFile(paths.projectMeta, JSON.stringify(meta, null, 2));
|
|
25751
|
+
} catch {
|
|
25752
|
+
}
|
|
25753
|
+
}
|
|
25524
25754
|
|
|
25525
25755
|
// src/core/conversation-state.ts
|
|
25526
25756
|
var ConversationState = class {
|
|
@@ -25820,8 +26050,8 @@ var InputBuilder = class {
|
|
|
25820
26050
|
async registerFile(input) {
|
|
25821
26051
|
const ref = await this.store.add({ ...input, kind: "file" });
|
|
25822
26052
|
this.refs.push(ref);
|
|
25823
|
-
const
|
|
25824
|
-
return `[file:${
|
|
26053
|
+
const path36 = ref.meta.filename ?? ref.meta.label ?? String(ref.seq);
|
|
26054
|
+
return `[file:${path36}]`;
|
|
25825
26055
|
}
|
|
25826
26056
|
/**
|
|
25827
26057
|
* Whether `appendPaste(text)` would collapse the text to a placeholder
|
|
@@ -26152,7 +26382,7 @@ summarize it, and let the tool result hold only the summary.`);
|
|
|
26152
26382
|
const cached = this.envCacheByRoot.get(ctx.projectRoot);
|
|
26153
26383
|
if (cached) return cached;
|
|
26154
26384
|
const today = this.opts.todayIso ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
26155
|
-
const platform2 = `${
|
|
26385
|
+
const platform2 = `${os6.platform()} ${os6.release()}`;
|
|
26156
26386
|
const shell = process.env.SHELL ?? process.env.ComSpec ?? "unknown";
|
|
26157
26387
|
const node = process.version;
|
|
26158
26388
|
const isGit = await this.dirExists(path6.join(ctx.projectRoot, ".git"));
|
|
@@ -26221,12 +26451,12 @@ ${mem}`);
|
|
|
26221
26451
|
}
|
|
26222
26452
|
}
|
|
26223
26453
|
async gitStatus(root) {
|
|
26224
|
-
return new Promise((
|
|
26454
|
+
return new Promise((resolve12) => {
|
|
26225
26455
|
let settled = false;
|
|
26226
26456
|
const finish = (s) => {
|
|
26227
26457
|
if (settled) return;
|
|
26228
26458
|
settled = true;
|
|
26229
|
-
|
|
26459
|
+
resolve12(s);
|
|
26230
26460
|
};
|
|
26231
26461
|
let proc;
|
|
26232
26462
|
const timer = setTimeout(() => {
|
|
@@ -27183,11 +27413,15 @@ var PhaseOrchestrator = class {
|
|
|
27183
27413
|
this.graph.updatedAt = Date.now();
|
|
27184
27414
|
let readyPhases = this.getReadyPhases();
|
|
27185
27415
|
while (readyPhases.length > 0 && !this.stopped) {
|
|
27416
|
+
await this.waitWhilePaused();
|
|
27417
|
+
if (this.stopped) break;
|
|
27186
27418
|
const batch = readyPhases.slice(0, this.opts.maxConcurrentPhases);
|
|
27187
27419
|
await Promise.all(batch.map((p) => this.startPhase(p)));
|
|
27188
27420
|
if (this.opts.phaseDelayMs > 0) {
|
|
27189
27421
|
await this.delay(this.opts.phaseDelayMs);
|
|
27190
27422
|
}
|
|
27423
|
+
await this.waitWhilePaused();
|
|
27424
|
+
if (this.stopped) break;
|
|
27191
27425
|
readyPhases = this.getReadyPhases().filter(
|
|
27192
27426
|
(p) => !this.runningPhases.has(p.id) && p.status !== "completed" && p.status !== "failed"
|
|
27193
27427
|
);
|
|
@@ -27428,7 +27662,9 @@ var PhaseOrchestrator = class {
|
|
|
27428
27662
|
async mergeOne(phase, handle) {
|
|
27429
27663
|
if (!this.worktrees) return;
|
|
27430
27664
|
try {
|
|
27431
|
-
const
|
|
27665
|
+
const resolve12 = this.ctx.resolveConflict ? async (info) => {
|
|
27666
|
+
const shouldResolve = await this.shouldAttemptConflictResolution(phase, info);
|
|
27667
|
+
if (!shouldResolve) return false;
|
|
27432
27668
|
this.emit("phase.conflictResolving", {
|
|
27433
27669
|
phaseId: phase.id,
|
|
27434
27670
|
name: phase.name,
|
|
@@ -27436,12 +27672,22 @@ var PhaseOrchestrator = class {
|
|
|
27436
27672
|
});
|
|
27437
27673
|
return this.ctx.resolveConflict(phase, info);
|
|
27438
27674
|
} : void 0;
|
|
27439
|
-
const result = await this.worktrees.merge(handle, { squash: true, resolve:
|
|
27675
|
+
const result = await this.worktrees.merge(handle, { squash: true, resolve: resolve12 });
|
|
27440
27676
|
if (result.resolved) {
|
|
27441
27677
|
this.emit("phase.conflictResolved", { phaseId: phase.id, name: phase.name });
|
|
27442
27678
|
}
|
|
27679
|
+
this.setIntegrationMetadata(phase, result.ok ? "merged" : "needs_review", {
|
|
27680
|
+
branch: handle.branch,
|
|
27681
|
+
worktreeDir: handle.dir,
|
|
27682
|
+
conflictFiles: result.conflictFiles
|
|
27683
|
+
});
|
|
27443
27684
|
await this.worktrees.release(handle, { keep: !result.ok });
|
|
27444
27685
|
} catch (err) {
|
|
27686
|
+
this.setIntegrationMetadata(phase, "merge_failed", {
|
|
27687
|
+
branch: handle.branch,
|
|
27688
|
+
worktreeDir: handle.dir,
|
|
27689
|
+
error: err instanceof Error ? err.message : String(err)
|
|
27690
|
+
});
|
|
27445
27691
|
this.emit("phase.failed", {
|
|
27446
27692
|
phaseId: phase.id,
|
|
27447
27693
|
name: phase.name,
|
|
@@ -27449,6 +27695,56 @@ var PhaseOrchestrator = class {
|
|
|
27449
27695
|
});
|
|
27450
27696
|
}
|
|
27451
27697
|
}
|
|
27698
|
+
async shouldAttemptConflictResolution(phase, info) {
|
|
27699
|
+
if (!this.ctx.brain) return true;
|
|
27700
|
+
const decision = await this.ctx.brain.decide({
|
|
27701
|
+
id: `autophase-conflict-${phase.id}`,
|
|
27702
|
+
source: "autophase",
|
|
27703
|
+
question: `Should AutoPhase try to resolve merge conflicts for phase "${phase.name}" automatically?`,
|
|
27704
|
+
context: [
|
|
27705
|
+
`Phase id: ${phase.id}`,
|
|
27706
|
+
`Conflicted files: ${info.conflictFiles.join(", ") || "(unknown)"}`,
|
|
27707
|
+
`Base working tree: ${info.cwd}`
|
|
27708
|
+
].join("\n"),
|
|
27709
|
+
risk: "high",
|
|
27710
|
+
fallback: "ask_human",
|
|
27711
|
+
options: [
|
|
27712
|
+
{
|
|
27713
|
+
id: "resolve",
|
|
27714
|
+
label: "Try the configured conflict resolver",
|
|
27715
|
+
consequence: "A resolver agent may edit conflicted files in the base working tree.",
|
|
27716
|
+
risk: "medium"
|
|
27717
|
+
},
|
|
27718
|
+
{
|
|
27719
|
+
id: "review",
|
|
27720
|
+
label: "Keep the worktree for human review",
|
|
27721
|
+
consequence: "No automatic conflict resolution is attempted.",
|
|
27722
|
+
risk: "low",
|
|
27723
|
+
recommended: true
|
|
27724
|
+
}
|
|
27725
|
+
]
|
|
27726
|
+
});
|
|
27727
|
+
phase.metadata = {
|
|
27728
|
+
...phase.metadata,
|
|
27729
|
+
brainConflictDecision: decision.type,
|
|
27730
|
+
brainConflictDecisionAt: Date.now()
|
|
27731
|
+
};
|
|
27732
|
+
if (decision.type !== "answer") return false;
|
|
27733
|
+
return decision.optionId === "resolve" || /\bresolve\b/i.test(decision.text);
|
|
27734
|
+
}
|
|
27735
|
+
setIntegrationMetadata(phase, status, details = {}) {
|
|
27736
|
+
phase.metadata = {
|
|
27737
|
+
...phase.metadata,
|
|
27738
|
+
integrationStatus: status,
|
|
27739
|
+
integrationBranch: details.branch,
|
|
27740
|
+
integrationWorktreeDir: details.worktreeDir,
|
|
27741
|
+
integrationConflictFiles: details.conflictFiles,
|
|
27742
|
+
integrationError: details.error,
|
|
27743
|
+
integrationUpdatedAt: Date.now()
|
|
27744
|
+
};
|
|
27745
|
+
phase.updatedAt = Date.now();
|
|
27746
|
+
this.graph.updatedAt = Date.now();
|
|
27747
|
+
}
|
|
27452
27748
|
/** A failed phase keeps its worktree on disk for inspection (no merge). */
|
|
27453
27749
|
async keepWorktreeForReview(phase) {
|
|
27454
27750
|
const handle = this.phaseWorktrees.get(phase.id);
|
|
@@ -27457,6 +27753,10 @@ var PhaseOrchestrator = class {
|
|
|
27457
27753
|
await this.worktrees.commitAll(handle, `autophase(${phase.name}) [failed]: ${phase.id}`);
|
|
27458
27754
|
} catch {
|
|
27459
27755
|
}
|
|
27756
|
+
this.setIntegrationMetadata(phase, "not_merged_failed_phase", {
|
|
27757
|
+
branch: handle.branch,
|
|
27758
|
+
worktreeDir: handle.dir
|
|
27759
|
+
});
|
|
27460
27760
|
await this.worktrees.release(handle, { keep: true }).catch(() => {
|
|
27461
27761
|
});
|
|
27462
27762
|
}
|
|
@@ -27716,8 +28016,13 @@ var PhaseOrchestrator = class {
|
|
|
27716
28016
|
}
|
|
27717
28017
|
};
|
|
27718
28018
|
}
|
|
28019
|
+
async waitWhilePaused() {
|
|
28020
|
+
while (this.paused && !this.stopped) {
|
|
28021
|
+
await this.delay(100);
|
|
28022
|
+
}
|
|
28023
|
+
}
|
|
27719
28024
|
delay(ms) {
|
|
27720
|
-
return new Promise((
|
|
28025
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
27721
28026
|
}
|
|
27722
28027
|
};
|
|
27723
28028
|
|
|
@@ -27761,6 +28066,10 @@ var AutoPhaseRunner = class {
|
|
|
27761
28066
|
this.graph = await builder.build();
|
|
27762
28067
|
const ctx = {
|
|
27763
28068
|
executeTask: this.opts.executeTask,
|
|
28069
|
+
verifyPhase: this.opts.verifyPhase,
|
|
28070
|
+
repairPhase: this.opts.repairPhase,
|
|
28071
|
+
resolveConflict: this.opts.resolveConflict,
|
|
28072
|
+
brain: this.opts.brain,
|
|
27764
28073
|
onPhaseComplete: (phase) => {
|
|
27765
28074
|
this.opts.onPhaseComplete?.(phase);
|
|
27766
28075
|
},
|
|
@@ -27777,10 +28086,12 @@ var AutoPhaseRunner = class {
|
|
|
27777
28086
|
maxConcurrentPhases: this.opts.maxConcurrentPhases,
|
|
27778
28087
|
maxConcurrentTasks: this.opts.maxConcurrentTasks,
|
|
27779
28088
|
maxRetries: this.opts.maxRetries,
|
|
28089
|
+
maxVerifyAttempts: this.opts.maxVerifyAttempts,
|
|
27780
28090
|
autonomous: this.opts.autonomous,
|
|
27781
28091
|
phaseDelayMs: this.opts.phaseDelayMs,
|
|
27782
28092
|
stopOnFailure: this.opts.stopOnFailure,
|
|
27783
|
-
events: this.opts.events
|
|
28093
|
+
events: this.opts.events,
|
|
28094
|
+
worktrees: this.opts.worktrees
|
|
27784
28095
|
});
|
|
27785
28096
|
if (this.opts.onProgress) {
|
|
27786
28097
|
this.progressInterval = setInterval(() => {
|
|
@@ -28699,6 +29010,147 @@ function assertSafePath(dir, projectRoot) {
|
|
|
28699
29010
|
}
|
|
28700
29011
|
}
|
|
28701
29012
|
|
|
29013
|
+
// src/coordination/brain.ts
|
|
29014
|
+
var ObservableBrainArbiter = class {
|
|
29015
|
+
constructor(inner, events) {
|
|
29016
|
+
this.inner = inner;
|
|
29017
|
+
this.events = events;
|
|
29018
|
+
}
|
|
29019
|
+
inner;
|
|
29020
|
+
events;
|
|
29021
|
+
async decide(request) {
|
|
29022
|
+
this.events.emit("brain.decision_requested", { request, at: Date.now() });
|
|
29023
|
+
const decision = await this.inner.decide(request);
|
|
29024
|
+
const event = decision.type === "ask_human" ? "brain.decision_ask_human" : decision.type === "deny" ? "brain.decision_denied" : "brain.decision_answered";
|
|
29025
|
+
this.events.emit(event, { request, decision, at: Date.now() });
|
|
29026
|
+
return decision;
|
|
29027
|
+
}
|
|
29028
|
+
};
|
|
29029
|
+
var BrainDecisionQueue = class {
|
|
29030
|
+
constructor(events, opts = {}) {
|
|
29031
|
+
this.events = events;
|
|
29032
|
+
this.opts = opts;
|
|
29033
|
+
this.offAnswer = this.events.on("brain.human_answered", (answer) => {
|
|
29034
|
+
const pending = this.pending.get(answer.id);
|
|
29035
|
+
if (!pending) return;
|
|
29036
|
+
this.pending.delete(answer.id);
|
|
29037
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
29038
|
+
if (answer.deny) {
|
|
29039
|
+
pending.resolve({ type: "deny", reason: answer.text ?? "Denied by human." });
|
|
29040
|
+
return;
|
|
29041
|
+
}
|
|
29042
|
+
const option = pending.request.options?.find((o) => o.id === answer.optionId);
|
|
29043
|
+
pending.resolve({
|
|
29044
|
+
type: "answer",
|
|
29045
|
+
optionId: answer.optionId,
|
|
29046
|
+
text: answer.text ?? option?.label ?? answer.optionId ?? "Human answered.",
|
|
29047
|
+
rationale: "Human answered a Brain escalation prompt."
|
|
29048
|
+
});
|
|
29049
|
+
});
|
|
29050
|
+
}
|
|
29051
|
+
events;
|
|
29052
|
+
opts;
|
|
29053
|
+
pending = /* @__PURE__ */ new Map();
|
|
29054
|
+
offAnswer;
|
|
29055
|
+
async requestHumanDecision(request) {
|
|
29056
|
+
const ask = {
|
|
29057
|
+
type: "ask_human",
|
|
29058
|
+
prompt: formatHumanPrompt(request),
|
|
29059
|
+
options: request.options,
|
|
29060
|
+
rationale: "Decision escalated to human authority."
|
|
29061
|
+
};
|
|
29062
|
+
const pending = new Promise((resolve12) => {
|
|
29063
|
+
const entry = { request, resolve: resolve12 };
|
|
29064
|
+
if (this.opts.timeoutMs && this.opts.timeoutMs > 0) {
|
|
29065
|
+
entry.timer = setTimeout(() => {
|
|
29066
|
+
this.pending.delete(request.id);
|
|
29067
|
+
resolve12({ type: "deny", reason: "Brain human decision timed out." });
|
|
29068
|
+
}, this.opts.timeoutMs);
|
|
29069
|
+
}
|
|
29070
|
+
this.pending.set(request.id, entry);
|
|
29071
|
+
});
|
|
29072
|
+
this.events.emit("brain.decision_ask_human", { request, decision: ask, at: Date.now() });
|
|
29073
|
+
return pending;
|
|
29074
|
+
}
|
|
29075
|
+
dispose() {
|
|
29076
|
+
this.offAnswer();
|
|
29077
|
+
for (const [id, pending] of this.pending) {
|
|
29078
|
+
if (pending.timer) clearTimeout(pending.timer);
|
|
29079
|
+
pending.resolve({ type: "deny", reason: "Brain decision queue disposed." });
|
|
29080
|
+
this.pending.delete(id);
|
|
29081
|
+
}
|
|
29082
|
+
}
|
|
29083
|
+
};
|
|
29084
|
+
var HumanEscalatingBrainArbiter = class {
|
|
29085
|
+
constructor(inner, queue) {
|
|
29086
|
+
this.inner = inner;
|
|
29087
|
+
this.queue = queue;
|
|
29088
|
+
}
|
|
29089
|
+
inner;
|
|
29090
|
+
queue;
|
|
29091
|
+
async decide(request) {
|
|
29092
|
+
const decision = await this.inner.decide(request);
|
|
29093
|
+
if (decision.type !== "ask_human") return decision;
|
|
29094
|
+
return this.queue.requestHumanDecision(request);
|
|
29095
|
+
}
|
|
29096
|
+
};
|
|
29097
|
+
var DefaultBrainArbiter = class {
|
|
29098
|
+
allowLowRiskAutoAnswer;
|
|
29099
|
+
constructor(opts = {}) {
|
|
29100
|
+
this.allowLowRiskAutoAnswer = opts.allowLowRiskAutoAnswer ?? true;
|
|
29101
|
+
}
|
|
29102
|
+
async decide(request) {
|
|
29103
|
+
const recommended = request.options?.find((option) => option.recommended);
|
|
29104
|
+
if (this.allowLowRiskAutoAnswer && request.risk === "low" && recommended) {
|
|
29105
|
+
return {
|
|
29106
|
+
type: "answer",
|
|
29107
|
+
optionId: recommended.id,
|
|
29108
|
+
text: recommended.label,
|
|
29109
|
+
rationale: "Low-risk request with an explicit recommended option."
|
|
29110
|
+
};
|
|
29111
|
+
}
|
|
29112
|
+
switch (request.fallback) {
|
|
29113
|
+
case "deny":
|
|
29114
|
+
return {
|
|
29115
|
+
type: "deny",
|
|
29116
|
+
reason: `Brain could not safely decide: ${request.question}`
|
|
29117
|
+
};
|
|
29118
|
+
case "continue":
|
|
29119
|
+
return {
|
|
29120
|
+
type: "answer",
|
|
29121
|
+
text: "Continue with the caller default.",
|
|
29122
|
+
rationale: "No safe Brain decision was available; request fallback is continue."
|
|
29123
|
+
};
|
|
29124
|
+
case "ask_human":
|
|
29125
|
+
return {
|
|
29126
|
+
type: "ask_human",
|
|
29127
|
+
prompt: formatHumanPrompt(request),
|
|
29128
|
+
options: request.options,
|
|
29129
|
+
rationale: "Decision requires human authority or lacks a safe automatic option."
|
|
29130
|
+
};
|
|
29131
|
+
}
|
|
29132
|
+
}
|
|
29133
|
+
};
|
|
29134
|
+
function formatHumanPrompt(request) {
|
|
29135
|
+
const lines = [
|
|
29136
|
+
`Brain requires human decision for ${request.source}:`,
|
|
29137
|
+
`Question: ${request.question}`
|
|
29138
|
+
];
|
|
29139
|
+
if (request.context?.trim()) {
|
|
29140
|
+
lines.push("", "Context:", request.context.trim());
|
|
29141
|
+
}
|
|
29142
|
+
if (request.options?.length) {
|
|
29143
|
+
lines.push("", "Options:");
|
|
29144
|
+
for (const option of request.options) {
|
|
29145
|
+
const risk = option.risk ? ` [risk: ${option.risk}]` : "";
|
|
29146
|
+
const consequence = option.consequence ? ` \u2014 ${option.consequence}` : "";
|
|
29147
|
+
lines.push(`- ${option.id}: ${option.label}${risk}${consequence}`);
|
|
29148
|
+
}
|
|
29149
|
+
}
|
|
29150
|
+
lines.push("", `Risk: ${request.risk}`);
|
|
29151
|
+
return lines.join("\n");
|
|
29152
|
+
}
|
|
29153
|
+
|
|
28702
29154
|
// src/coordination/collab-bus.ts
|
|
28703
29155
|
var CollaborationBus = class {
|
|
28704
29156
|
pausePromise = null;
|
|
@@ -28727,8 +29179,8 @@ var CollaborationBus = class {
|
|
|
28727
29179
|
if (this.isPaused()) return false;
|
|
28728
29180
|
this.pausedAtMs = Date.now();
|
|
28729
29181
|
this.pausedBy = byParticipant;
|
|
28730
|
-
this.pausePromise = new Promise((
|
|
28731
|
-
this.pauseResolve =
|
|
29182
|
+
this.pausePromise = new Promise((resolve12) => {
|
|
29183
|
+
this.pauseResolve = resolve12;
|
|
28732
29184
|
});
|
|
28733
29185
|
return true;
|
|
28734
29186
|
}
|
|
@@ -28764,8 +29216,8 @@ var CollaborationBus = class {
|
|
|
28764
29216
|
return true;
|
|
28765
29217
|
}
|
|
28766
29218
|
let timer;
|
|
28767
|
-
const timeoutPromise = new Promise((
|
|
28768
|
-
timer = setTimeout(() =>
|
|
29219
|
+
const timeoutPromise = new Promise((resolve12) => {
|
|
29220
|
+
timer = setTimeout(() => resolve12("timeout"), timeoutMs);
|
|
28769
29221
|
});
|
|
28770
29222
|
const resumedPromise = this.pausePromise.then(() => "resumed");
|
|
28771
29223
|
const winner = await Promise.race([resumedPromise, timeoutPromise]);
|
|
@@ -29256,7 +29708,7 @@ function createGitPlugin() {
|
|
|
29256
29708
|
}
|
|
29257
29709
|
async function runGit(args, cwd) {
|
|
29258
29710
|
try {
|
|
29259
|
-
return await new Promise((
|
|
29711
|
+
return await new Promise((resolve12, reject) => {
|
|
29260
29712
|
const child = spawn("git", args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
29261
29713
|
let stdout = "";
|
|
29262
29714
|
let stderr = "";
|
|
@@ -29277,7 +29729,7 @@ async function runGit(args, cwd) {
|
|
|
29277
29729
|
})
|
|
29278
29730
|
);
|
|
29279
29731
|
});
|
|
29280
|
-
child.on("close", (code) =>
|
|
29732
|
+
child.on("close", (code) => resolve12({ stdout, stderr, code: code ?? 0 }));
|
|
29281
29733
|
});
|
|
29282
29734
|
} catch (err) {
|
|
29283
29735
|
if (err instanceof WrongStackError) throw err;
|
|
@@ -29602,7 +30054,7 @@ function createSkillsPlugin(opts) {
|
|
|
29602
30054
|
};
|
|
29603
30055
|
}
|
|
29604
30056
|
function makeInstaller(skillLoader, projectRoot) {
|
|
29605
|
-
const globalRoot = path6.join(
|
|
30057
|
+
const globalRoot = path6.join(os6.homedir(), ".wrongstack");
|
|
29606
30058
|
return new SkillInstaller({
|
|
29607
30059
|
manifestPath: path6.join(globalRoot, "installed-skills.json"),
|
|
29608
30060
|
projectSkillsDir: path6.join(projectRoot, ".wrongstack", "skills"),
|
|
@@ -29953,6 +30405,6 @@ ${formatPlan(updated)}`
|
|
|
29953
30405
|
};
|
|
29954
30406
|
}
|
|
29955
30407
|
|
|
29956
|
-
export { ACP_AGENTS, AGENTS_BY_PHASE, AGENT_CATALOG, AISpecBuilder, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, ALL_SYNC_CATEGORIES, AUDIT_LOG_AGENT, Agent, AgentError, AnnotationsStore, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutoPhasePlanner, AutoPhaseRunner, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, CONTEXT_WINDOW_MODES, CORE_RECONSTRUCT_EVENTS, CheckpointManager, CloudSync, CollaborationBus, ConfigError, ConfigMigrationError, Container, Context, ConversationState, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_MAX_ITERATIONS, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SPEC_TEMPLATE, DEFAULT_SUBAGENT_BASELINE, DEFAULT_TOOLS_CONFIG, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPathResolver, DefaultPermissionPolicy, DefaultPluginAPI, DefaultPromptStore, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DefaultSkillLoader, DefaultSystemPromptBuilder, DefaultTaskStore, DefaultTokenCounter, Director, DirectorStateCheckpoint, DoneConditionChecker, ERROR_CODES, EternalAutonomyEngine, EventBus, ExtensionRegistry, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, FsError, GitignoreUpdater, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, InputBuilder, IntelligentCompactor, KERNEL_API_VERSION, LAYER_1_IDENTITY, LLMSelector, MATRIX_PHASE_KEYS, MAX_JOURNAL_ENTRIES, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, PROMETHEUS_CONTENT_TYPE, ParallelEternalEngine, PhaseGraphBuilder, PhaseOrchestrator, PhaseStore, Pipeline, PluginError, ProviderError, ProviderRegistry, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, ReplayLogStore, ReplayProviderRunner, ReportGenerator, RunController, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, STANDARD_AUDIT_EVENTS, ScopedEventBus, SddParallelRun, SddTaskDecomposer, SecurityScanner, SecurityScannerOrchestrator, SelectiveCompactor, SessionAnalyzer, SessionError, SessionRecovery, SkillGenerator, SkillInstaller, SkillManifestStore, SlashCommandRegistry, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TOKENS, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, TechStackDetector, ToolAuditLog, ToolError, ToolExecutor, ToolRegistry, WorktreeManager, WrongStackError, addPlanItem, allServers, analyzeCriticalPath, appendJournal, applyRosterBudget, asBlocks, asText, assertSafePath, atomicWrite, attachAutoExtend, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, braveSearchServer, buildBtwBlock, buildChildEnv, buildGoalPreamble, buildOtlpMetricsRequest, buildOtlpTracesRequest, buildRecoveryStrategies, classifyFamily, clearPlan, collabInjectMiddleware, collabPauseMiddleware, color, compileGlob, compileUserRegex, completePartialObject, composeDirectorPrompt, composeSubagentPrompt, computeTaskProgress, consumeBtwNotes, context7Server, contextManagerTool, createAutoExecutor, createAutoPhaseFromTaskGraph, createContextManagerTool, createDefaultPipelines, createDelegateTool, createGitPlugin, createMcpControlTool, createMessage, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSessionEventBridge, createSkillsPlugin, createSyncPlugin, createToolOutputSerializer, decryptConfigSecrets, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, deriveTodosFromPlanItem, detectNewlineStyle, dispatchAgent, downloadGitHubTarball, emptyGoal, emptyPlan, encryptConfigSecrets, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, everArtServer, expandGlob, extractRunEnv, filesystemServer, findCriticalPath, formatContextWindowModeList, formatGoal, formatPlan, formatPlanTemplates, formatTodosList, getAgentDefinition, getCalibrationState, getContextWindowMode, getPlanTemplate, getTemplate, getTermSize, githubServer, goalFilePath, googleMapsServer, hashRequest, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isInteractive, isPluginError, isSessionError, isStdinTTY, isStdoutTTY, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isValidMatrixKey, isWrongStackError, listContextWindowModes, listPlanTemplates, listTemplates, loadDirectorState, loadGoal, loadPlan, loadPlugins, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeAskTool, makeAssignTool, makeAutonomyPromptContributor, makeAwaitTasksTool, makeCollabDebugTool, makeContinueToNextIterationTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, matchAny, matchGlob, matrixKeyKind, mergeModelsPayload, migratePlaintextSecrets, miniMaxVisionServer, normalizeToLf, onResize, parseContinueDirective, parseSkillRef, pendingBtwCount, phaseForRole, projectHash, recordActualUsage, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, repairToolUseAdjacency, resetCalibration, resolveAuditLevel, resolveContextWindowPolicy, resolveModelMatrix, resolveSessionLoggingConfig, resolveWstackPaths, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, runProviderWithRetry, safeParse, safeStringify, sanitizeJsonString, saveGoal, savePlan, saveTodosCheckpoint, scoreAgents, securitySlashCommand, sentinelServer, setBtwNote, setPlanItemStatus, setRawMode, slackServer, stableStringify, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, stripAnsi, summarizeUsage, templateToMarkdown, toStyle, toWrongStackError, topologicalSort, unifiedDiff, unloadPlugins, validateAgainstSchema, wireMetricsToEvents, wrapAsState, writeErr, writeOut, zaiVisionServer };
|
|
30408
|
+
export { ACP_AGENTS, AGENTS_BY_PHASE, AGENT_CATALOG, AISpecBuilder, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, ALL_SYNC_CATEGORIES, AUDIT_LOG_AGENT, Agent, AgentError, AnnotationsStore, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutoPhasePlanner, AutoPhaseRunner, AutonomousRunner, BUG_HUNTER_AGENT, BrainDecisionQueue, BudgetExceededError, CONTEXT_WINDOW_MODES, CORE_RECONSTRUCT_EVENTS, CheckpointManager, CloudSync, CollaborationBus, ConfigError, ConfigMigrationError, Container, Context, ConversationState, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_MAX_ITERATIONS, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SESSION_LOGGING_CONFIG, DEFAULT_SPEC_TEMPLATE, DEFAULT_SUBAGENT_BASELINE, DEFAULT_TOOLS_CONFIG, DefaultAttachmentStore, DefaultBrainArbiter, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPathResolver, DefaultPermissionPolicy, DefaultPluginAPI, DefaultPromptStore, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DefaultSkillLoader, DefaultSystemPromptBuilder, DefaultTaskStore, DefaultTokenCounter, Director, DirectorStateCheckpoint, DoneConditionChecker, ERROR_CODES, EternalAutonomyEngine, EventBus, ExtensionRegistry, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, FsError, GitignoreUpdater, HumanEscalatingBrainArbiter, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, InputBuilder, IntelligentCompactor, KERNEL_API_VERSION, LAYER_1_IDENTITY, LLMSelector, MATRIX_PHASE_KEYS, MAX_JOURNAL_ENTRIES, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, ObservableBrainArbiter, PROMETHEUS_CONTENT_TYPE, ParallelEternalEngine, PhaseGraphBuilder, PhaseOrchestrator, PhaseStore, Pipeline, PluginError, ProviderError, ProviderRegistry, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, ReplayLogStore, ReplayProviderRunner, ReportGenerator, RunController, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, STANDARD_AUDIT_EVENTS, ScopedEventBus, SddParallelRun, SddTaskDecomposer, SecurityScanner, SecurityScannerOrchestrator, SelectiveCompactor, SessionAnalyzer, SessionError, SessionRecovery, SkillGenerator, SkillInstaller, SkillManifestStore, SlashCommandRegistry, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TOKENS, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, TechStackDetector, ToolAuditLog, ToolError, ToolExecutor, ToolRegistry, WorktreeManager, WrongStackError, addPlanItem, allServers, analyzeCriticalPath, appendJournal, applyRosterBudget, asBlocks, asText, assertSafePath, atomicWrite, attachAutoExtend, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, bootConfig, braveSearchServer, buildBtwBlock, buildChildEnv, buildGoalPreamble, buildOtlpMetricsRequest, buildOtlpTracesRequest, buildRecoveryStrategies, classifyFamily, clearPlan, collabInjectMiddleware, collabPauseMiddleware, color, compileGlob, compileUserRegex, completePartialObject, composeDirectorPrompt, composeSubagentPrompt, computeTaskProgress, consumeBtwNotes, context7Server, contextManagerTool, createAutoExecutor, createAutoPhaseFromTaskGraph, createContextManagerTool, createDefaultPipelines, createDelegateTool, createGitPlugin, createMcpControlTool, createMessage, createObservabilityPlugin, createPlanPlugin, createPromptsPlugin, createSecurityPlugin, createSecuritySlashCommand, createSessionEventBridge, createSkillsPlugin, createSyncPlugin, createToolOutputSerializer, decryptConfigSecrets, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, deriveTodosFromPlanItem, detectNewlineStyle, dispatchAgent, downloadGitHubTarball, emptyGoal, emptyPlan, encryptConfigSecrets, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, everArtServer, expandGlob, extractRunEnv, filesystemServer, findCriticalPath, flagsToConfigPatch, formatContextWindowModeList, formatGoal, formatHumanPrompt, formatPlan, formatPlanTemplates, formatTodosList, getAgentDefinition, getCalibrationState, getContextWindowMode, getPlanTemplate, getTemplate, getTermSize, githubServer, goalFilePath, googleMapsServer, hashRequest, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isInteractive, isPluginError, isSessionError, isStdinTTY, isStdoutTTY, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isValidMatrixKey, isWrongStackError, listContextWindowModes, listPlanTemplates, listTemplates, loadDirectorState, loadGoal, loadPlan, loadPlugins, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeAskTool, makeAssignTool, makeAutonomyPromptContributor, makeAwaitTasksTool, makeCollabDebugTool, makeContinueToNextIterationTool, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeRollUpTool, makeSpawnTool, makeTerminateTool, matchAny, matchGlob, matrixKeyKind, mergeCustomModelDefs, mergeModelsPayload, migratePlaintextSecrets, miniMaxVisionServer, normalizeToLf, onResize, parseContinueDirective, parseSkillRef, pendingBtwCount, phaseForRole, projectHash, recordActualUsage, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, repairToolUseAdjacency, resetCalibration, resolveAuditLevel, resolveContextWindowPolicy, resolveModelMatrix, resolveSessionLoggingConfig, resolveWstackPaths, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, runProviderWithRetry, safeParse, safeStringify, sanitizeJsonString, saveGoal, savePlan, saveTodosCheckpoint, scoreAgents, securitySlashCommand, sentinelServer, setBtwNote, setPlanItemStatus, setRawMode, slackServer, stableStringify, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, stripAnsi, summarizeUsage, templateToMarkdown, toStyle, toWrongStackError, topologicalSort, unifiedDiff, unloadPlugins, validateAgainstSchema, wireMetricsToEvents, wrapAsState, writeErr, writeOut, zaiVisionServer };
|
|
29957
30409
|
//# sourceMappingURL=index.js.map
|
|
29958
30410
|
//# sourceMappingURL=index.js.map
|