@wrongstack/core 0.155.0 → 0.236.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-BbZU5TPN.d.ts → agent-bridge-Cimv7bK7.d.ts} +1 -1
- package/dist/{agent-subagent-runner-Bsueu0J2.d.ts → agent-subagent-runner-C658wj_c.d.ts} +9 -8
- package/dist/{brain-CS_B0vIE.d.ts → brain-sCZ3lCjq.d.ts} +26 -2
- package/dist/{compactor-BueGt7LG.d.ts → compactor-BRfg3QPd.d.ts} +1 -1
- package/dist/{config-BaVThgnT.d.ts → config-Koq6f3fs.d.ts} +2 -2
- package/dist/{context-C7G_MtLV.d.ts → context-CLz3z_E8.d.ts} +126 -2
- package/dist/coordination/index.d.ts +70 -13
- package/dist/coordination/index.js +1983 -145
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -26
- package/dist/defaults/index.js +1105 -289
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +45 -16
- package/dist/execution/index.js +224 -53
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +86 -0
- package/dist/execution/prompt-enhancer.js +125 -0
- package/dist/execution/prompt-enhancer.js.map +1 -0
- package/dist/extension/index.d.ts +6 -6
- package/dist/extension/index.js +3 -1
- package/dist/extension/index.js.map +1 -1
- package/dist/{goal-preamble-CbV8pXLD.d.ts → goal-preamble-CnbzyVvl.d.ts} +19 -10
- package/dist/{index-CI1hRfPt.d.ts → index-BlMqh5GO.d.ts} +8 -8
- package/dist/{index-B5wz-GXm.d.ts → index-C2eSNPsB.d.ts} +7 -5
- package/dist/index.d.ts +438 -128
- package/dist/index.js +4974 -836
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +7 -7
- package/dist/infrastructure/index.js +61 -13
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +7 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{llm-selector-CP72f1lC.d.ts → llm-selector-D22R4AFz.d.ts} +2 -2
- package/dist/logger-DmmQhf4P.d.ts +65 -0
- package/dist/{mcp-servers-CPERR2De.d.ts → mcp-servers-DFbirBv6.d.ts} +3 -3
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +89 -9
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-D90K9UnM.d.ts → models-registry-CnJRjTXc.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-BSKSFNhv.d.ts → multi-agent-coordinator-60weDZoA.d.ts} +8 -8
- package/dist/{null-fleet-bus-CGOez8Le.d.ts → null-fleet-bus-1068dEnr.d.ts} +7 -7
- package/dist/observability/index.d.ts +2 -2
- package/dist/package-outdated-watcher-pzJ5w7y8.d.ts +560 -0
- package/dist/{parallel-eternal-engine-CYoTKjsz.d.ts → parallel-eternal-engine-DtG1fjc9.d.ts} +13 -9
- package/dist/{path-resolver-DuhlmPil.d.ts → path-resolver-CA1ULU0J.d.ts} +3 -3
- package/dist/{permission-B7nKnEvQ.d.ts → permission-DbWPbuoA.d.ts} +1 -1
- package/dist/{permission-policy-8-6zBmfA.d.ts → permission-policy-AOk0LVsV.d.ts} +2 -2
- package/dist/pipeline-DsmlwTXu.d.ts +493 -0
- package/dist/{plan-templates-DbH7lg-t.d.ts → plan-templates-DPABrDvy.d.ts} +18 -7
- package/dist/{provider-runner-Cocq0O9E.d.ts → provider-runner-D0HgUqwV.d.ts} +3 -3
- package/dist/{retry-policy-rutAfVeR.d.ts → retry-policy-BVnkbMET.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js +215 -79
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-w8MbUe2Q.d.ts → secret-vault-CeVNiy_f.d.ts} +3 -2
- package/dist/security/index.d.ts +5 -4
- package/dist/security/index.js +155 -13
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-4vDFZKt3.d.ts → selector-Cb4_9-hf.d.ts} +1 -1
- package/dist/{session-event-bridge-DWlvglC2.d.ts → session-event-bridge-BhtkkFFy.d.ts} +4 -2
- package/dist/{session-reader-BAtCxdaw.d.ts → session-reader-CCOssnBS.d.ts} +1 -1
- package/dist/skills/index.js +171 -21
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +150 -12
- package/dist/storage/index.js +1041 -214
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +67 -20
- package/dist/types/index.js +557 -52
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.js +3 -1
- package/dist/utils/expect-defined.js.map +1 -1
- package/dist/utils/index.d.ts +16 -4
- package/dist/utils/index.js +40 -14
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-DD50Omgn.d.ts → wstack-paths-CJjEwPXn.d.ts} +14 -1
- package/package.json +7 -3
- package/skills/chimera/SKILL.md +105 -0
- package/skills/research-web/SKILL.md +342 -0
- package/dist/logger-B9J5puGM.d.ts +0 -32
- package/dist/pipeline-BG7UgbDc.d.ts +0 -239
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// src/utils/expect-defined.ts
|
|
2
2
|
function expectDefined(value, label) {
|
|
3
3
|
if (value === null || value === void 0) {
|
|
4
|
-
|
|
4
|
+
const err = new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
5
|
+
err.name = "ExpectDefinedError";
|
|
6
|
+
throw err;
|
|
5
7
|
}
|
|
6
8
|
return value;
|
|
7
9
|
}
|
|
@@ -1 +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,
|
|
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,MAAM,IAAI,KAAA,CAAM,QAAQ,CAAA,SAAA,EAAY,KAAK,mBAAmB,8BAA8B,CAAA;AAChG,IAAA,GAAA,CAAI,IAAA,GAAO,oBAAA;AACX,IAAA,MAAM,GAAA;AAAA,EACR;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 const err = new Error(label ? `Expected ${label} to be defined` : 'Expected value to be defined');\n err.name = 'ExpectDefinedError';\n throw err;\n }\n return value;\n}\n"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { s as TodoItem, M as Message, J as JSONSchema } from '../context-
|
|
1
|
+
import { s as TodoItem, M as Message, J as JSONSchema } from '../context-CLz3z_E8.js';
|
|
2
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-
|
|
3
|
+
export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-CJjEwPXn.js';
|
|
4
4
|
export { expectDefined } from './expect-defined.js';
|
|
5
|
-
import { a as ModelsDevPayload, t as CustomModelDefinition } from '../config-
|
|
5
|
+
import { a as ModelsDevPayload, t as CustomModelDefinition } from '../config-Koq6f3fs.js';
|
|
6
6
|
export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-u1q9Jkyk.js';
|
|
7
7
|
|
|
8
8
|
interface AtomicWriteOptions {
|
|
@@ -370,11 +370,23 @@ declare function estimateToolResultTokens(content: string | unknown): number;
|
|
|
370
370
|
* Estimate tokens for a text block.
|
|
371
371
|
*/
|
|
372
372
|
declare function estimateTextTokens(text: string): number;
|
|
373
|
+
/**
|
|
374
|
+
* Compute and cache the token estimate for a single message. This is the
|
|
375
|
+
* canonical per-message estimator — called once by ConversationState on
|
|
376
|
+
* append/replace so the O(n·m) content-block walk happens at mutation time,
|
|
377
|
+
* not on every context-pressure check.
|
|
378
|
+
*/
|
|
379
|
+
declare function computeMessageTokens(msg: Message): number;
|
|
373
380
|
/**
|
|
374
381
|
* Estimate tokens for an array of messages (text + tool I/O), using the shared
|
|
375
382
|
* 3.5 chars/token basis. This is the single canonical message-array estimator —
|
|
376
383
|
* compactors, the context_manager tool, and the `/context` display all route
|
|
377
384
|
* through it so the number a user sees matches the number compaction decides on.
|
|
385
|
+
*
|
|
386
|
+
* When a message carries a pre-computed `_estTokens` field (set by
|
|
387
|
+
* ConversationState on append/replace), it is used directly instead of
|
|
388
|
+
* re-walking the content blocks — turning the O(n·m) scan into an O(n)
|
|
389
|
+
* sum for fully-cached arrays.
|
|
378
390
|
*/
|
|
379
391
|
declare function estimateMessageTokens(messages: readonly Message[]): number;
|
|
380
392
|
/**
|
|
@@ -581,4 +593,4 @@ declare function mergeModelsPayload(base: ModelsDevPayload, overlay: ModelsDevPa
|
|
|
581
593
|
*/
|
|
582
594
|
declare function mergeCustomModelDefs(providerCustomModels: Record<string, CustomModelDefinition> | undefined, configModels: Record<string, CustomModelDefinition> | undefined): Record<string, CustomModelDefinition> | undefined;
|
|
583
595
|
|
|
584
|
-
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, isStdinTTY, isStdoutTTY, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizeToLf, onResize, recordActualUsage, repairToolUseAdjacency, resetCalibration, safeParse, safeStringify, sanitizeJsonString, setOutputLineGuard, setRawMode, sleep, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema, withFileLock, writeErr, writeOut };
|
|
596
|
+
export { type AtomicWriteOptions, type BuildChildEnvOptions, type CompileFail, type CompileResult, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RequestTokenBreakdown, type SafeParseResult, type ToolOutputSerializerOptions, type UnifiedDiffOptions, type ValidationError, type ValidationResult, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, 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
|
@@ -476,7 +476,9 @@ function formatTaskList(tasks) {
|
|
|
476
476
|
// src/utils/expect-defined.ts
|
|
477
477
|
function expectDefined(value, label) {
|
|
478
478
|
if (value === null || value === void 0) {
|
|
479
|
-
|
|
479
|
+
const err = new Error(label ? `Expected ${label} to be defined` : "Expected value to be defined");
|
|
480
|
+
err.name = "ExpectDefinedError";
|
|
481
|
+
throw err;
|
|
480
482
|
}
|
|
481
483
|
return value;
|
|
482
484
|
}
|
|
@@ -719,9 +721,13 @@ function projectSlug(absRoot) {
|
|
|
719
721
|
function slugify(name) {
|
|
720
722
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "project";
|
|
721
723
|
}
|
|
724
|
+
function wstackGlobalRoot() {
|
|
725
|
+
const fromEnv = process.env["WRONGSTACK_HOME"];
|
|
726
|
+
if (fromEnv && fromEnv.trim().length > 0) return path2.resolve(fromEnv);
|
|
727
|
+
return path2.join(os.homedir(), ".wrongstack");
|
|
728
|
+
}
|
|
722
729
|
function resolveWstackPaths(opts) {
|
|
723
|
-
const
|
|
724
|
-
const globalRoot = opts.globalRoot ?? path2.join(home, ".wrongstack");
|
|
730
|
+
const globalRoot = opts.globalRoot ?? (opts.userHome ? path2.join(opts.userHome, ".wrongstack") : wstackGlobalRoot());
|
|
725
731
|
const hash = projectHash(opts.projectRoot);
|
|
726
732
|
const slug = projectSlug(opts.projectRoot);
|
|
727
733
|
const projectDir = path2.join(globalRoot, "projects", slug);
|
|
@@ -839,7 +845,11 @@ function buildChildEnv(optsOrSessionId) {
|
|
|
839
845
|
continue;
|
|
840
846
|
}
|
|
841
847
|
if (looksSecret(upper)) continue;
|
|
842
|
-
if (upper.startsWith("NODE_") || upper.startsWith("NPM_") || upper.startsWith("PNPM_") || upper.startsWith("YARN_") || upper.startsWith("GIT_") || upper.startsWith("CI") || upper.startsWith("XDG_") ||
|
|
848
|
+
if (upper.startsWith("NODE_") || upper.startsWith("NPM_") || upper.startsWith("PNPM_") || upper.startsWith("YARN_") || upper.startsWith("GIT_") || upper.startsWith("CI") || upper.startsWith("XDG_") || // Our own non-secret knobs (WRONGSTACK_HOME, WRONGSTACK_SESSION_ID, …).
|
|
849
|
+
// Secrets never live in WRONGSTACK_* env vars (they're in the encrypted
|
|
850
|
+
// vault). Forwarding keeps child wstack processes — e.g. ones spawned
|
|
851
|
+
// by the test suite — inside the same redirected global root.
|
|
852
|
+
upper.startsWith("WRONGSTACK_") || upper === "EDITOR" || upper === "VISUAL" || upper === "PAGER") {
|
|
843
853
|
out[k] = v;
|
|
844
854
|
}
|
|
845
855
|
}
|
|
@@ -857,9 +867,11 @@ function sleep(ms) {
|
|
|
857
867
|
|
|
858
868
|
// src/utils/assert-never.ts
|
|
859
869
|
function assertNever(x, message) {
|
|
860
|
-
|
|
870
|
+
const err = new Error(
|
|
861
871
|
message ?? `Unhandled case: ${JSON.stringify(x)}`
|
|
862
872
|
);
|
|
873
|
+
err.name = "AssertNeverError";
|
|
874
|
+
throw err;
|
|
863
875
|
}
|
|
864
876
|
|
|
865
877
|
// src/utils/deep-merge.ts
|
|
@@ -1010,22 +1022,31 @@ function estimateToolResultTokens(content) {
|
|
|
1010
1022
|
function estimateTextTokens(text) {
|
|
1011
1023
|
return RoughTokenEstimate(text);
|
|
1012
1024
|
}
|
|
1025
|
+
function computeMessageTokens(msg) {
|
|
1026
|
+
if (typeof msg.content === "string") return estimateTextTokens(msg.content);
|
|
1027
|
+
let total = 0;
|
|
1028
|
+
for (const b of msg.content) {
|
|
1029
|
+
if (b.type === "text") total += estimateTextTokens(b.text);
|
|
1030
|
+
else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
|
|
1031
|
+
else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
|
|
1032
|
+
else total += RoughTokenEstimate(JSON.stringify(b));
|
|
1033
|
+
}
|
|
1034
|
+
return total;
|
|
1035
|
+
}
|
|
1013
1036
|
function estimateMessageTokens(messages) {
|
|
1014
1037
|
let total = 0;
|
|
1015
1038
|
for (const m of messages) {
|
|
1016
|
-
if (typeof m.
|
|
1017
|
-
total +=
|
|
1018
|
-
|
|
1019
|
-
for (const b of m.content) {
|
|
1020
|
-
if (b.type === "text") total += estimateTextTokens(b.text);
|
|
1021
|
-
else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
|
|
1022
|
-
else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
|
|
1023
|
-
}
|
|
1039
|
+
if (typeof m._estTokens === "number" && m._estTokens > 0) {
|
|
1040
|
+
total += m._estTokens;
|
|
1041
|
+
continue;
|
|
1024
1042
|
}
|
|
1043
|
+
total += computeMessageTokens(m);
|
|
1025
1044
|
}
|
|
1026
1045
|
return total;
|
|
1027
1046
|
}
|
|
1028
1047
|
function estimateToolDefTokens(tool) {
|
|
1048
|
+
const cached = tool._estDefTokens;
|
|
1049
|
+
if (typeof cached === "number" && cached > 0) return cached;
|
|
1029
1050
|
return RoughTokenEstimate(tool.name) + RoughTokenEstimate(tool.description ?? "") + RoughTokenEstimate(JSON.stringify(tool.inputSchema));
|
|
1030
1051
|
}
|
|
1031
1052
|
function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = CALIBRATION_GLOBAL_KEY) {
|
|
@@ -1035,6 +1056,11 @@ function estimateRequestTokens(messages, systemPrompt, tools, calibrationKey = C
|
|
|
1035
1056
|
} else if (Array.isArray(messages)) {
|
|
1036
1057
|
for (const m of messages) {
|
|
1037
1058
|
if (typeof m === "object" && m !== null && "content" in m) {
|
|
1059
|
+
const cached = m._estTokens;
|
|
1060
|
+
if (typeof cached === "number" && cached > 0) {
|
|
1061
|
+
messagesTokens += cached;
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1038
1064
|
const content = m.content;
|
|
1039
1065
|
if (typeof content === "string") {
|
|
1040
1066
|
messagesTokens += RoughTokenEstimate(content);
|
|
@@ -1625,6 +1651,6 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
1625
1651
|
return out;
|
|
1626
1652
|
}
|
|
1627
1653
|
|
|
1628
|
-
export { FORBIDDEN_PROTO_KEYS, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeTaskItemProgress, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, 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 };
|
|
1654
|
+
export { FORBIDDEN_PROTO_KEYS, assertNever, atomicWrite, buildChildEnv, color, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expectDefined, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getTermSize, isInteractive, isPrimitiveArray, 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, wstackGlobalRoot };
|
|
1629
1655
|
//# sourceMappingURL=index.js.map
|
|
1630
1656
|
//# sourceMappingURL=index.js.map
|