@wrongstack/core 0.267.0 → 0.268.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-STJ3JwwK.d.ts → agent-bridge-UhojbpWx.d.ts} +1 -1
- package/dist/{agent-subagent-runner-CzPGP3jA.d.ts → agent-subagent-runner-Bvtf1o9K.d.ts} +7 -7
- package/dist/{brain-Cdg77tVN.d.ts → brain-69wzMKp1.d.ts} +1 -1
- package/dist/{compactor-iMZ84CXq.d.ts → compactor-CBQAJoDc.d.ts} +1 -1
- package/dist/{config-Du3pYYln.d.ts → config-VKfOZ-6X.d.ts} +70 -2
- package/dist/{context-dT5Ueund.d.ts → context-C0U8B9NF.d.ts} +24 -1
- package/dist/coordination/index.d.ts +56 -160
- package/dist/coordination/index.js +333 -63
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -25
- package/dist/defaults/index.js +94 -68
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +72 -16
- package/dist/execution/index.js +151 -36
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/extension/index.d.ts +7 -6
- package/dist/global-mailbox-KByEFFBa.d.ts +663 -0
- package/dist/{goal-preamble-SulMTowG.d.ts → goal-preamble-CrYjmdw4.d.ts} +9 -9
- package/dist/{goal-store-CABDwdFE.d.ts → goal-store-Y_zdLZ3q.d.ts} +1 -1
- package/dist/hq/index.d.ts +195 -0
- package/dist/hq/index.js +1884 -0
- package/dist/hq/index.js.map +1 -0
- package/dist/{index-IEuxQd-E.d.ts → index-BfaS-f_m.d.ts} +2 -2
- package/dist/{index-DtCVWel4.d.ts → index-CtQnmkaS.d.ts} +8 -8
- package/dist/{index-Bms0m4oy.d.ts → index-gCv830d7.d.ts} +5 -5
- package/dist/index.d.ts +46 -42
- package/dist/index.js +2955 -1498
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +45 -18
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +10 -9
- package/dist/{pipeline-BfD2k1rT.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
- package/dist/{mcp-servers-C2cBTxUR.d.ts → mcp-servers-HT3Fi7Bl.d.ts} +10 -4
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +3 -2
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-BqGZNJQ-.d.ts → models-registry-Bvcl3Vaa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-B8R43uPz.d.ts → multi-agent-coordinator-BACjsmkC.d.ts} +1 -1
- package/dist/{null-fleet-bus-CnXa5oTH.d.ts → null-fleet-bus-DA7fvhUg.d.ts} +6 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-DdNnw9BQ.d.ts → parallel-eternal-engine-Ci71gYu_.d.ts} +9 -15
- package/dist/{path-resolver-COIMLCQL.d.ts → path-resolver-O1IJnmKE.d.ts} +4 -3
- package/dist/{permission-B75JAi3-.d.ts → permission-Bd-57Lbl.d.ts} +1 -1
- package/dist/{permission-policy-DlR9eJAM.d.ts → permission-policy-uNXC6Kge.d.ts} +2 -3
- package/dist/pipeline-BDNvENyV.d.ts +245 -0
- package/dist/{plan-templates-DSIKCXZN.d.ts → plan-templates-EMsalEtN.d.ts} +5 -5
- package/dist/{provider-model-resolve-BNRsNuJx.d.ts → provider-model-resolve-CEb9x886.d.ts} +3 -3
- package/dist/{provider-runner-CX7iIvox.d.ts → provider-runner-DWJbpo70.d.ts} +3 -3
- package/dist/{retry-policy-BilV1ujH.d.ts → retry-policy-C3s_lvdK.d.ts} +1 -1
- package/dist/sdd/index.d.ts +9 -8
- package/dist/sdd/index.js +32 -2
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-gkvEZZfE.d.ts → secret-vault-Cgduf5xL.d.ts} +1 -1
- package/dist/security/index.d.ts +5 -5
- package/dist/security/index.js +39 -29
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-Bc7eWtT3.d.ts → selector-47LBnBVk.d.ts} +1 -1
- package/dist/{session-event-bridge-D-araDEz.d.ts → session-event-bridge-Cw7oqmW2.d.ts} +1 -1
- package/dist/{session-reader-D7Dapswh.d.ts → session-reader-DD4v2Obw.d.ts} +1 -1
- package/dist/storage/index.d.ts +14 -12
- package/dist/storage/index.js +63 -36
- package/dist/storage/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +166 -31
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +20 -19
- package/dist/types/index.js +68 -51
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +22 -3
- package/dist/utils/index.js +139 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -1
package/dist/types/index.js
CHANGED
|
@@ -575,6 +575,41 @@ function truncate(s, max) {
|
|
|
575
575
|
return s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
+
// src/utils/tool-subject.ts
|
|
579
|
+
var GLOB_METACHARACTERS = /[*?[\]]/g;
|
|
580
|
+
function escapeGlobSubject(value) {
|
|
581
|
+
return value.replace(GLOB_METACHARACTERS, (char) => `\\${char}`);
|
|
582
|
+
}
|
|
583
|
+
function normalizePathSubject(value) {
|
|
584
|
+
return escapeGlobSubject(value.replace(/\\/g, "/"));
|
|
585
|
+
}
|
|
586
|
+
function isPathSubjectKey(subjectKey) {
|
|
587
|
+
return subjectKey === "path" || subjectKey === "file" || subjectKey === "files";
|
|
588
|
+
}
|
|
589
|
+
function subjectForToolInput(toolName, input, subjectKey) {
|
|
590
|
+
if (!input || typeof input !== "object") return void 0;
|
|
591
|
+
const obj = input;
|
|
592
|
+
if (subjectKey) {
|
|
593
|
+
const value = obj[subjectKey];
|
|
594
|
+
if (typeof value === "string") {
|
|
595
|
+
return isPathSubjectKey(subjectKey) ? normalizePathSubject(value) : escapeGlobSubject(value);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
if (toolName === "bash" && typeof obj.command === "string") {
|
|
599
|
+
return escapeGlobSubject(obj.command);
|
|
600
|
+
}
|
|
601
|
+
if (typeof obj.path === "string") {
|
|
602
|
+
return normalizePathSubject(obj.path);
|
|
603
|
+
}
|
|
604
|
+
if (typeof obj.url === "string") {
|
|
605
|
+
return escapeGlobSubject(obj.url);
|
|
606
|
+
}
|
|
607
|
+
if (typeof obj.name === "string") {
|
|
608
|
+
return escapeGlobSubject(obj.name);
|
|
609
|
+
}
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
612
|
+
|
|
578
613
|
// src/utils/tool-wire-compact.ts
|
|
579
614
|
var TOOL_DESCRIPTION_MAX_CHARS = 640;
|
|
580
615
|
var SCHEMA_DESCRIPTION_MAX_CHARS = 180;
|
|
@@ -2373,11 +2408,10 @@ var DefaultTokenCounter = class {
|
|
|
2373
2408
|
const price = model ? this.priceCache.get(model) : void 0;
|
|
2374
2409
|
if (price) {
|
|
2375
2410
|
this.applyPrice(usage, price);
|
|
2376
|
-
this.
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
} else if (this.registry && this.providerId && model) {
|
|
2411
|
+
this.emitAccounted();
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
if (this.registry && this.providerId && model) {
|
|
2381
2415
|
if (this.priceCache.size >= PRICE_CACHE_MAX_SIZE) {
|
|
2382
2416
|
const keys = [...this.priceCache.keys()];
|
|
2383
2417
|
this.priceCache.delete(keys[0] ?? "");
|
|
@@ -2387,16 +2421,16 @@ var DefaultTokenCounter = class {
|
|
|
2387
2421
|
const p = priceFromModel(m);
|
|
2388
2422
|
this.priceCache.set(model, p);
|
|
2389
2423
|
this.applyPrice(usage, p);
|
|
2390
|
-
this.events?.emit("token.accounted", {
|
|
2391
|
-
usage: this.total(),
|
|
2392
|
-
cost: { input: this.costInput, output: this.costOutput, total: this.costInput + this.costOutput }
|
|
2393
|
-
});
|
|
2394
2424
|
}
|
|
2425
|
+
this.emitAccounted();
|
|
2395
2426
|
}).catch(() => {
|
|
2396
2427
|
this.events?.emit("token.cost_estimate_unavailable", { model: model ?? "<unknown>" });
|
|
2428
|
+
this.emitAccounted();
|
|
2397
2429
|
return void 0;
|
|
2398
2430
|
});
|
|
2431
|
+
return;
|
|
2399
2432
|
}
|
|
2433
|
+
this.emitAccounted();
|
|
2400
2434
|
}
|
|
2401
2435
|
/** Synchronous variant for code paths that have already resolved the model. */
|
|
2402
2436
|
accountWithModel(usage, resolved) {
|
|
@@ -2413,10 +2447,7 @@ var DefaultTokenCounter = class {
|
|
|
2413
2447
|
}
|
|
2414
2448
|
this.priceCache.set(resolved.modelId, price);
|
|
2415
2449
|
this.applyPrice(usage, price);
|
|
2416
|
-
this.
|
|
2417
|
-
usage: this.total(),
|
|
2418
|
-
cost: { input: this.costInput, output: this.costOutput, total: this.costInput + this.costOutput }
|
|
2419
|
-
});
|
|
2450
|
+
this.emitAccounted();
|
|
2420
2451
|
}
|
|
2421
2452
|
total() {
|
|
2422
2453
|
return {
|
|
@@ -2449,6 +2480,12 @@ var DefaultTokenCounter = class {
|
|
|
2449
2480
|
invalidateCache() {
|
|
2450
2481
|
this.priceCache.clear();
|
|
2451
2482
|
}
|
|
2483
|
+
emitAccounted() {
|
|
2484
|
+
this.events?.emit("token.accounted", {
|
|
2485
|
+
usage: this.total(),
|
|
2486
|
+
cost: { input: this.costInput, output: this.costOutput, total: this.costInput + this.costOutput }
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2452
2489
|
reset() {
|
|
2453
2490
|
this.input = 0;
|
|
2454
2491
|
this.output = 0;
|
|
@@ -2456,6 +2493,9 @@ var DefaultTokenCounter = class {
|
|
|
2456
2493
|
this.cacheWrite = 0;
|
|
2457
2494
|
this.costInput = 0;
|
|
2458
2495
|
this.costOutput = 0;
|
|
2496
|
+
this.lastInput = 0;
|
|
2497
|
+
this.lastCacheRead = 0;
|
|
2498
|
+
this.emitAccounted();
|
|
2459
2499
|
}
|
|
2460
2500
|
applyPrice(usage, price) {
|
|
2461
2501
|
if (price.input) this.costInput += usage.input / 1e6 * price.input;
|
|
@@ -2463,8 +2503,14 @@ var DefaultTokenCounter = class {
|
|
|
2463
2503
|
if (usage.cacheRead && price.cacheRead) {
|
|
2464
2504
|
this.costInput += usage.cacheRead / 1e6 * price.cacheRead;
|
|
2465
2505
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2506
|
+
const hasCacheWriteSplit = usage.cacheWrite5m !== void 0 || usage.cacheWrite1h !== void 0;
|
|
2507
|
+
const cacheWrite5m = usage.cacheWrite5m ?? (hasCacheWriteSplit ? 0 : usage.cacheWrite);
|
|
2508
|
+
const cacheWrite1h = usage.cacheWrite1h ?? 0;
|
|
2509
|
+
if (cacheWrite5m && (price.cacheWrite5m ?? price.cacheWrite)) {
|
|
2510
|
+
this.costInput += cacheWrite5m / 1e6 * (price.cacheWrite5m ?? price.cacheWrite ?? 0);
|
|
2511
|
+
}
|
|
2512
|
+
if (cacheWrite1h && (price.cacheWrite1h ?? price.cacheWrite)) {
|
|
2513
|
+
this.costInput += cacheWrite1h / 1e6 * (price.cacheWrite1h ?? price.cacheWrite ?? 0);
|
|
2468
2514
|
}
|
|
2469
2515
|
}
|
|
2470
2516
|
};
|
|
@@ -2473,7 +2519,9 @@ function priceFromModel(m) {
|
|
|
2473
2519
|
input: m.cost?.input,
|
|
2474
2520
|
output: m.cost?.output,
|
|
2475
2521
|
cacheRead: m.cost?.cache_read,
|
|
2476
|
-
cacheWrite: m.cost?.cache_write
|
|
2522
|
+
cacheWrite: m.cost?.cache_write,
|
|
2523
|
+
cacheWrite5m: m.cost?.cache_write_5m ?? m.cost?.cache_write,
|
|
2524
|
+
cacheWrite1h: m.cost?.cache_write_1h ?? (m.cost?.input !== void 0 ? m.cost.input * 2 : void 0)
|
|
2477
2525
|
};
|
|
2478
2526
|
}
|
|
2479
2527
|
function round4(n) {
|
|
@@ -3605,10 +3653,11 @@ var DefaultModelsRegistry = class {
|
|
|
3605
3653
|
capabilities: {
|
|
3606
3654
|
tools: model.tool_call ?? false,
|
|
3607
3655
|
vision: Boolean(model.modalities?.input?.includes("image")),
|
|
3608
|
-
reasoning: model.reasoning ??
|
|
3656
|
+
reasoning: model.reasoning ?? model.reasoningConfig !== void 0,
|
|
3609
3657
|
maxContext: model.limit?.context ?? 0,
|
|
3610
3658
|
maxOutput: model.limit?.output,
|
|
3611
|
-
knowledge: model.knowledge
|
|
3659
|
+
knowledge: model.knowledge,
|
|
3660
|
+
reasoningConfig: model.reasoningConfig
|
|
3612
3661
|
},
|
|
3613
3662
|
cost: model.cost
|
|
3614
3663
|
};
|
|
@@ -4489,7 +4538,7 @@ ${errorDetails}`,
|
|
|
4489
4538
|
return { result, tool, durationMs: Date.now() - start };
|
|
4490
4539
|
}
|
|
4491
4540
|
} else {
|
|
4492
|
-
const suggestedPattern =
|
|
4541
|
+
const suggestedPattern = subjectForToolInput(tool.name, use.input, tool.subjectKey) ?? tool.name;
|
|
4493
4542
|
const pending = {
|
|
4494
4543
|
type: "tool_confirm_pending",
|
|
4495
4544
|
toolUseId: use.id,
|
|
@@ -4768,38 +4817,6 @@ ${excerpt}`;
|
|
|
4768
4817
|
budgetForString(content, budget) {
|
|
4769
4818
|
return Math.max(0, budget - Buffer.byteLength(content, "utf8"));
|
|
4770
4819
|
}
|
|
4771
|
-
/**
|
|
4772
|
-
* Compute the suggestedPattern string for a tool+input pair.
|
|
4773
|
-
* Matches the logic in DefaultPermissionPolicy so the TUI shows the
|
|
4774
|
-
* same subject that the trust file would use.
|
|
4775
|
-
*/
|
|
4776
|
-
subjectFor(toolName, input, subjectKey) {
|
|
4777
|
-
if (!input || typeof input !== "object") return void 0;
|
|
4778
|
-
const obj = input;
|
|
4779
|
-
const globChars = /[*?[\]]/g;
|
|
4780
|
-
const escapeGlob = (s) => s.replace(globChars, (c) => `\\${c}`);
|
|
4781
|
-
const normalizePath = (s) => escapeGlob(s.replace(/\\/g, "/"));
|
|
4782
|
-
if (subjectKey) {
|
|
4783
|
-
const v = obj[subjectKey];
|
|
4784
|
-
if (typeof v === "string") {
|
|
4785
|
-
const isPathKey = subjectKey === "path" || subjectKey === "file" || subjectKey === "files";
|
|
4786
|
-
return isPathKey ? normalizePath(v) : escapeGlob(v);
|
|
4787
|
-
}
|
|
4788
|
-
}
|
|
4789
|
-
if (toolName === "bash" && typeof obj.command === "string") {
|
|
4790
|
-
return escapeGlob(obj.command);
|
|
4791
|
-
}
|
|
4792
|
-
if (typeof obj.path === "string") {
|
|
4793
|
-
return normalizePath(obj.path);
|
|
4794
|
-
}
|
|
4795
|
-
if (typeof obj.url === "string") {
|
|
4796
|
-
return escapeGlob(obj.url);
|
|
4797
|
-
}
|
|
4798
|
-
if (typeof obj.name === "string") {
|
|
4799
|
-
return escapeGlob(obj.name);
|
|
4800
|
-
}
|
|
4801
|
-
return void 0;
|
|
4802
|
-
}
|
|
4803
4820
|
};
|
|
4804
4821
|
function clampTimeoutMs(timeoutMs, maxTimeoutMs) {
|
|
4805
4822
|
const fallback = 3e5;
|