@wrongstack/core 0.89.1 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-B8F2ORwg.d.ts → agent-bridge-mOxbpFcg.d.ts} +1 -1
- package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-DukQLUcS.d.ts} +433 -433
- package/dist/{events-DzyLtja6.d.ts → brain-Dfv4Y82E.d.ts} +179 -92
- package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
- package/dist/{config-_DZ7dN-T.d.ts → config-BSU-6vah.d.ts} +45 -38
- package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
- package/dist/coordination/index.d.ts +16 -17
- package/dist/coordination/index.js +128 -37
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +34 -35
- package/dist/defaults/index.js +752 -218
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
- package/dist/execution/index.d.ts +65 -370
- package/dist/execution/index.js +446 -53
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +9 -10
- package/dist/extension/index.js +8 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/goal-preamble-CI8lxeY1.d.ts +378 -0
- package/dist/{goal-store-DvWLNu52.d.ts → goal-store-ht0VmR1A.d.ts} +63 -21
- package/dist/{index-Ca_lOmKl.d.ts → index-BWRN6wOb.d.ts} +13 -15
- package/dist/{index-Dx-CnrDN.d.ts → index-DIKEcfgC.d.ts} +9 -10
- package/dist/index.d.ts +188 -176
- package/dist/index.js +1508 -407
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -9
- package/dist/infrastructure/index.js +4 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +14 -16
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
- package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
- package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-CXCsANdY.d.ts} +3 -3
- package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +8 -6
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
- package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-51LvnXkD.d.ts} +2 -2
- package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-D09hMzFQ.d.ts} +32 -31
- package/dist/observability/index.d.ts +3 -3
- package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
- package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CUtmM_0V.d.ts} +54 -35
- package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-DDJiMAtX.d.ts} +3 -3
- package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
- package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
- package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-BqiA_UMr.d.ts} +73 -73
- package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-BdDxl9cI.d.ts} +79 -11
- package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-BUunikwY.d.ts} +5 -5
- package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
- package/dist/sdd/index.d.ts +17 -33
- package/dist/sdd/index.js +145 -36
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
- package/dist/security/index.d.ts +4 -5
- package/dist/security/index.js +4 -2
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
- package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-BpJ5trO9.d.ts} +2 -2
- package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
- package/dist/{skill-BJeF2DwY.d.ts → skill-Bj6Ezqb8.d.ts} +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +3 -9
- package/dist/skills/index.js.map +1 -1
- package/dist/spec-TBi3Jr6T.d.ts +78 -0
- package/dist/storage/index.d.ts +145 -13
- package/dist/storage/index.js +990 -172
- package/dist/storage/index.js.map +1 -1
- package/dist/task-format-vGOIftmK.d.ts +23 -0
- package/dist/task-graph-u1q9Jkyk.d.ts +84 -0
- package/dist/types/index.d.ts +27 -28
- package/dist/types/index.js +19 -31
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.d.ts +7 -0
- package/dist/utils/expect-defined.js +11 -0
- package/dist/utils/expect-defined.js.map +1 -0
- package/dist/utils/index.d.ts +8 -20
- package/dist/utils/index.js +120 -41
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
- package/package.json +5 -1
- package/skills/tech-stack/SKILL.md +177 -0
- package/dist/memory-CEXuo7sz.d.ts +0 -16
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
- package/dist/task-graph-CikNdRTG.d.ts +0 -161
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Assert a value is neither null nor undefined. Throws if it is.
|
|
2
|
+
* Useful after optional chaining and indexed access when the
|
|
3
|
+
* control flow guarantees the value exists but TypeScript can't
|
|
4
|
+
* prove it (e.g. after a check on a related field). */
|
|
5
|
+
declare function expectDefined<T>(value: T | null | undefined, label?: string): T;
|
|
6
|
+
|
|
7
|
+
export { expectDefined };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/utils/expect-defined.ts
|
|
2
|
+
function expectDefined(value, label) {
|
|
3
|
+
if (value === null || value === void 0) {
|
|
4
|
+
throw new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { expectDefined };
|
|
10
|
+
//# sourceMappingURL=expect-defined.js.map
|
|
11
|
+
//# sourceMappingURL=expect-defined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/expect-defined.ts"],"names":[],"mappings":";AAIO,SAAS,aAAA,CAAiB,OAA6B,KAAA,EAAmB;AAC/E,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AACzC,IAAA,MAAM,IAAI,KAAA,CAAM,KAAA,GAAQ,CAAA,SAAA,EAAY,KAAK,mBAAmB,8BAA8B,CAAA;AAAA,EAC5F;AACA,EAAA,OAAO,KAAA;AACT","file":"expect-defined.js","sourcesContent":["/** Assert a value is neither null nor undefined. Throws if it is.\n * Useful after optional chaining and indexed access when the\n * control flow guarantees the value exists but TypeScript can't\n * prove it (e.g. after a check on a related field). */\nexport function expectDefined<T>(value: T | null | undefined, label?: string): T {\n if (value === null || value === undefined) {\n throw new Error(label ? `Expected ${label} to be defined` : 'Expected value to be defined');\n }\n return value;\n}\n"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { s as TodoItem, M as Message, J as JSONSchema } from '../context-CNRYfhUv.js';
|
|
2
|
+
export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from '../task-format-vGOIftmK.js';
|
|
3
|
+
export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths } from '../wstack-paths-_lqjzErq.js';
|
|
4
|
+
export { expectDefined } from './expect-defined.js';
|
|
5
|
+
import { a as ModelsDevPayload } from '../models-registry-B6_KfS65.js';
|
|
6
|
+
import { q as CustomModelDefinition } from '../config-BSU-6vah.js';
|
|
7
|
+
export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-u1q9Jkyk.js';
|
|
5
8
|
|
|
6
9
|
interface AtomicWriteOptions {
|
|
7
10
|
mode?: number | undefined;
|
|
@@ -259,12 +262,6 @@ declare function buildChildEnv(optsOrSessionId?: BuildChildEnvOptions | string):
|
|
|
259
262
|
* and an abortable variant can be introduced without a codebase-wide hunt. */
|
|
260
263
|
declare function sleep(ms: number): Promise<void>;
|
|
261
264
|
|
|
262
|
-
/** Assert a value is neither null nor undefined. Throws if it is.
|
|
263
|
-
* Useful after optional chaining and indexed access when the
|
|
264
|
-
* control flow guarantees the value exists but TypeScript can't
|
|
265
|
-
* prove it (e.g. after a check on a related field). */
|
|
266
|
-
declare function expectDefined<T>(value: T | null | undefined): T;
|
|
267
|
-
|
|
268
265
|
/**
|
|
269
266
|
* Tool output serialization utilities.
|
|
270
267
|
* Extracted from Agent.executeTools to allow reuse and consistent output handling.
|
|
@@ -434,15 +431,6 @@ interface CompileFail {
|
|
|
434
431
|
}
|
|
435
432
|
declare function compileUserRegex(pattern: string, flags: string): CompileResult | CompileFail;
|
|
436
433
|
|
|
437
|
-
/**
|
|
438
|
-
* Glob pattern → concrete file path expansion.
|
|
439
|
-
*
|
|
440
|
-
* Supports: *, **, ?, [...]
|
|
441
|
-
* Does NOT support brace expansion {a,b}.
|
|
442
|
-
*
|
|
443
|
-
* Returns the input as-is if it contains no glob metacharacters.
|
|
444
|
-
* On Windows, both / and \ are accepted as path separators.
|
|
445
|
-
*/
|
|
446
434
|
/**
|
|
447
435
|
* Resolve `pattern` to the set of concrete file paths it matches.
|
|
448
436
|
* Literal paths (no glob chars) are returned as-is.
|
|
@@ -506,4 +494,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
506
494
|
*/
|
|
507
495
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
508
496
|
|
|
509
|
-
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob,
|
|
497
|
+
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
package/dist/utils/index.js
CHANGED
|
@@ -364,13 +364,124 @@ function formatTodosList(todos) {
|
|
|
364
364
|
return lines.join("\n");
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
// src/utils/
|
|
368
|
-
function
|
|
367
|
+
// src/utils/task-format.ts
|
|
368
|
+
function computeTaskItemProgress(tasks) {
|
|
369
|
+
let completed = 0;
|
|
370
|
+
let pending = 0;
|
|
371
|
+
let inProgress = 0;
|
|
372
|
+
let blocked = 0;
|
|
373
|
+
let failed = 0;
|
|
374
|
+
let review = 0;
|
|
375
|
+
let estimatedHours = 0;
|
|
376
|
+
let actualHours = 0;
|
|
377
|
+
for (const t of tasks) {
|
|
378
|
+
switch (t.status) {
|
|
379
|
+
case "completed":
|
|
380
|
+
completed++;
|
|
381
|
+
break;
|
|
382
|
+
case "pending":
|
|
383
|
+
pending++;
|
|
384
|
+
break;
|
|
385
|
+
case "in_progress":
|
|
386
|
+
inProgress++;
|
|
387
|
+
break;
|
|
388
|
+
case "blocked":
|
|
389
|
+
blocked++;
|
|
390
|
+
break;
|
|
391
|
+
case "failed":
|
|
392
|
+
failed++;
|
|
393
|
+
break;
|
|
394
|
+
case "review":
|
|
395
|
+
review++;
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
estimatedHours += t.estimateHours ?? 0;
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
total: tasks.length,
|
|
402
|
+
pending,
|
|
403
|
+
inProgress,
|
|
404
|
+
blocked,
|
|
405
|
+
failed,
|
|
406
|
+
review,
|
|
407
|
+
completed,
|
|
408
|
+
percentComplete: tasks.length > 0 ? Math.round(completed / tasks.length * 100) : 0,
|
|
409
|
+
estimatedHours,
|
|
410
|
+
actualHours
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
var STATUS_ICON = {
|
|
414
|
+
pending: "\u25CB",
|
|
415
|
+
in_progress: "\u25D0",
|
|
416
|
+
blocked: "\u2298",
|
|
417
|
+
failed: "\u2717",
|
|
418
|
+
review: "\u25D1",
|
|
419
|
+
completed: "\u25CF"
|
|
420
|
+
};
|
|
421
|
+
var PRIORITY_ICON = {
|
|
422
|
+
critical: "\u{1F534}",
|
|
423
|
+
high: "\u{1F7E0}",
|
|
424
|
+
medium: "\u{1F7E1}",
|
|
425
|
+
low: "\u{1F7E2}"
|
|
426
|
+
};
|
|
427
|
+
var TYPE_ICON = {
|
|
428
|
+
feature: "\u26A1",
|
|
429
|
+
bugfix: "\u{1F41B}",
|
|
430
|
+
refactor: "\u267B\uFE0F",
|
|
431
|
+
docs: "\u{1F4DD}",
|
|
432
|
+
test: "\u{1F9EA}",
|
|
433
|
+
chore: "\u{1F527}"
|
|
434
|
+
};
|
|
435
|
+
function formatTaskProgress(tasks) {
|
|
436
|
+
const p = computeTaskItemProgress(tasks);
|
|
437
|
+
if (p.total === 0) return "No tasks.";
|
|
438
|
+
const barWidth = 24;
|
|
439
|
+
const filled = Math.round(p.percentComplete / 100 * barWidth);
|
|
440
|
+
const empty = barWidth - filled;
|
|
441
|
+
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
442
|
+
return [
|
|
443
|
+
`${color.bold("Tasks")} [${bar}] ${p.percentComplete}%`,
|
|
444
|
+
` ${color.green("\u25CF")} ${p.completed} done \u2502 ${color.yellow("\u25D0")} ${p.inProgress} active \u2502 ${color.dim("\u25CB")} ${p.pending} pending \u2502 \u2298 ${p.blocked} blocked \u2502 \u2717 ${p.failed} failed`,
|
|
445
|
+
p.estimatedHours > 0 ? ` ${color.dim(`est. ${p.estimatedHours}h`)}` : ""
|
|
446
|
+
].filter(Boolean).join("\n");
|
|
447
|
+
}
|
|
448
|
+
function formatTaskList(tasks) {
|
|
449
|
+
if (tasks.length === 0) return "No tasks.";
|
|
450
|
+
const order = ["in_progress", "blocked", "review", "pending", "failed", "completed"];
|
|
451
|
+
const groups = /* @__PURE__ */ new Map();
|
|
452
|
+
for (const t of tasks) {
|
|
453
|
+
const list = groups.get(t.status) ?? [];
|
|
454
|
+
list.push(t);
|
|
455
|
+
groups.set(t.status, list);
|
|
456
|
+
}
|
|
457
|
+
const lines = [];
|
|
458
|
+
lines.push(color.dim(`Tasks (${tasks.length} total):`));
|
|
459
|
+
for (const status of order) {
|
|
460
|
+
const group = groups.get(status);
|
|
461
|
+
if (!group || group.length === 0) continue;
|
|
462
|
+
const icon = STATUS_ICON[status];
|
|
463
|
+
lines.push(` ${icon} ${status.toUpperCase()} (${group.length})`);
|
|
464
|
+
for (const t of group) {
|
|
465
|
+
const prio = PRIORITY_ICON[t.priority];
|
|
466
|
+
const type = TYPE_ICON[t.type];
|
|
467
|
+
const deps = t.dependsOn && t.dependsOn.length > 0 ? ` ${color.dim("\u2190")} ${color.dim(t.dependsOn.map((d) => d.slice(0, 8)).join(", "))}` : "";
|
|
468
|
+
const who = t.assignee ? ` ${color.dim(`@${t.assignee}`)}` : "";
|
|
469
|
+
const hrs = t.estimateHours ? ` ${color.dim(`${t.estimateHours}h`)}` : "";
|
|
470
|
+
lines.push(` ${type} ${prio} ${t.title}${deps}${who}${hrs}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return lines.join("\n");
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// src/utils/expect-defined.ts
|
|
477
|
+
function expectDefined(value, label) {
|
|
369
478
|
if (value === null || value === void 0) {
|
|
370
|
-
throw new Error("Expected value to be defined");
|
|
479
|
+
throw new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
371
480
|
}
|
|
372
481
|
return value;
|
|
373
482
|
}
|
|
483
|
+
|
|
484
|
+
// src/utils/glob-match.ts
|
|
374
485
|
function escapeRegex(s) {
|
|
375
486
|
return s.replace(/[.+^${}()|\\]/g, "\\$&");
|
|
376
487
|
}
|
|
@@ -743,14 +854,6 @@ function sleep(ms) {
|
|
|
743
854
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
744
855
|
}
|
|
745
856
|
|
|
746
|
-
// src/utils/expect-defined.ts
|
|
747
|
-
function expectDefined2(value) {
|
|
748
|
-
if (value === null || value === void 0) {
|
|
749
|
-
throw new Error("Expected value to be defined");
|
|
750
|
-
}
|
|
751
|
-
return value;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
857
|
// src/utils/tool-output-serializer.ts
|
|
755
858
|
function createToolOutputSerializer(opts = {}) {
|
|
756
859
|
const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
|
|
@@ -796,12 +899,6 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
796
899
|
}
|
|
797
900
|
|
|
798
901
|
// src/utils/token-estimate.ts
|
|
799
|
-
function expectDefined3(value) {
|
|
800
|
-
if (value === null || value === void 0) {
|
|
801
|
-
throw new Error("Expected value to be defined");
|
|
802
|
-
}
|
|
803
|
-
return value;
|
|
804
|
-
}
|
|
805
902
|
var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
|
|
806
903
|
var _cal = {
|
|
807
904
|
ratio: 1,
|
|
@@ -822,7 +919,7 @@ function getCachedEstimate(key, compute) {
|
|
|
822
919
|
if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
|
|
823
920
|
const keys = [...ESTIMATE_CACHE.keys()];
|
|
824
921
|
for (let i = 0; i < Math.floor(ESTIMATE_CACHE_MAX_SIZE / 4); i++) {
|
|
825
|
-
ESTIMATE_CACHE.delete(
|
|
922
|
+
ESTIMATE_CACHE.delete(expectDefined(keys[i]));
|
|
826
923
|
}
|
|
827
924
|
}
|
|
828
925
|
const estimate = compute();
|
|
@@ -935,12 +1032,6 @@ function resetCalibration() {
|
|
|
935
1032
|
}
|
|
936
1033
|
|
|
937
1034
|
// src/utils/message-invariants.ts
|
|
938
|
-
function expectDefined4(value) {
|
|
939
|
-
if (value === null || value === void 0) {
|
|
940
|
-
throw new Error("Expected value to be defined");
|
|
941
|
-
}
|
|
942
|
-
return value;
|
|
943
|
-
}
|
|
944
1035
|
function repairToolUseAdjacency(messages) {
|
|
945
1036
|
const removedToolUses = [];
|
|
946
1037
|
const removedToolResults = [];
|
|
@@ -948,7 +1039,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
948
1039
|
let changed = false;
|
|
949
1040
|
const out = [];
|
|
950
1041
|
for (let i = 0; i < messages.length; i++) {
|
|
951
|
-
const original =
|
|
1042
|
+
const original = expectDefined(messages[i]);
|
|
952
1043
|
let msg = original;
|
|
953
1044
|
if (hasToolUse(msg)) {
|
|
954
1045
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -1161,12 +1252,6 @@ function compileUserRegex(pattern, flags) {
|
|
|
1161
1252
|
};
|
|
1162
1253
|
}
|
|
1163
1254
|
}
|
|
1164
|
-
function expectDefined5(value) {
|
|
1165
|
-
if (value === null || value === void 0) {
|
|
1166
|
-
throw new Error("Expected value to be defined");
|
|
1167
|
-
}
|
|
1168
|
-
return value;
|
|
1169
|
-
}
|
|
1170
1255
|
var GLOB_CHARS = /* @__PURE__ */ new Set(["*", "?", "["]);
|
|
1171
1256
|
var IS_WINDOWS = process.platform === "win32";
|
|
1172
1257
|
var SEP = IS_WINDOWS ? "\\" : "/";
|
|
@@ -1180,7 +1265,7 @@ function globToRegex(pat) {
|
|
|
1180
1265
|
let i = 0;
|
|
1181
1266
|
let re = "^";
|
|
1182
1267
|
while (i < pat.length) {
|
|
1183
|
-
const c =
|
|
1268
|
+
const c = expectDefined(pat[i]);
|
|
1184
1269
|
if (c === "*") {
|
|
1185
1270
|
if (pat[i + 1] === "*") {
|
|
1186
1271
|
re += ".*";
|
|
@@ -1219,7 +1304,7 @@ function globToRegex(pat) {
|
|
|
1219
1304
|
}
|
|
1220
1305
|
function baseDir(pat) {
|
|
1221
1306
|
let i = pat.length - 1;
|
|
1222
|
-
while (i >= 0 && !GLOB_CHARS.has(
|
|
1307
|
+
while (i >= 0 && !GLOB_CHARS.has(expectDefined(pat[i])) && pat[i] !== SEP && pat[i] !== "/") i--;
|
|
1223
1308
|
const cut = i >= 0 ? pat.lastIndexOf(SEP, i) : pat.lastIndexOf("/", i);
|
|
1224
1309
|
return cut < 0 ? "." : pat.slice(0, cut);
|
|
1225
1310
|
}
|
|
@@ -1284,12 +1369,6 @@ async function expandGlob(pattern) {
|
|
|
1284
1369
|
}
|
|
1285
1370
|
|
|
1286
1371
|
// src/utils/json-repair.ts
|
|
1287
|
-
function expectDefined6(value) {
|
|
1288
|
-
if (value === null || value === void 0) {
|
|
1289
|
-
throw new Error("Expected value to be defined");
|
|
1290
|
-
}
|
|
1291
|
-
return value;
|
|
1292
|
-
}
|
|
1293
1372
|
function completePartialObject(s) {
|
|
1294
1373
|
if (!s.trim().startsWith("{")) return s;
|
|
1295
1374
|
if (tryParse(s).ok) return s;
|
|
@@ -1301,7 +1380,7 @@ function completePartialObject(s) {
|
|
|
1301
1380
|
let contentEnd = 0;
|
|
1302
1381
|
let stringBraceDepth = 0;
|
|
1303
1382
|
for (let i = 0; i < s.length; i++) {
|
|
1304
|
-
const ch =
|
|
1383
|
+
const ch = expectDefined(s[i]);
|
|
1305
1384
|
if (inString) {
|
|
1306
1385
|
contentEnd = i + 1;
|
|
1307
1386
|
if (escaped) {
|
|
@@ -1458,6 +1537,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1458
1537
|
return out;
|
|
1459
1538
|
}
|
|
1460
1539
|
|
|
1461
|
-
export { atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob,
|
|
1540
|
+
export { atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeTaskItemProgress, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, projectHash, projectSlug, recordActualUsage, repairToolUseAdjacency, resetCalibration, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
1462
1541
|
//# sourceMappingURL=index.js.map
|
|
1463
1542
|
//# sourceMappingURL=index.js.map
|