@ordewell/core 0.13.2 → 0.13.3

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.
Files changed (45) hide show
  1. package/dist/{ModeResolver-BmG9O08A.d.ts → ModeResolver-CXGnEhbN.d.ts} +1 -1
  2. package/dist/{ModeResolver-CNKcOksr.d.mts → ModeResolver-DqpwKbfJ.d.mts} +1 -1
  3. package/dist/{Task-CH1z4L3h.d.mts → Task-TFPWtKoz.d.mts} +2 -0
  4. package/dist/{Task-CH1z4L3h.d.ts → Task-TFPWtKoz.d.ts} +2 -0
  5. package/dist/{chunk-7ACNW5CD.mjs → chunk-4OARA73Z.mjs} +2 -2
  6. package/dist/{chunk-3P5UIXTR.mjs → chunk-5ETS2NIB.mjs} +13 -3
  7. package/dist/{chunk-3P5UIXTR.mjs.map → chunk-5ETS2NIB.mjs.map} +1 -1
  8. package/dist/{chunk-I436RXQT.mjs → chunk-62MSJNOG.mjs} +3 -3
  9. package/dist/{chunk-I436RXQT.mjs.map → chunk-62MSJNOG.mjs.map} +1 -1
  10. package/dist/{chunk-MGMQKUIJ.mjs → chunk-DFRDXOEG.mjs} +15 -5
  11. package/dist/chunk-DFRDXOEG.mjs.map +1 -0
  12. package/dist/{chunk-O52PN7P2.mjs → chunk-FOGPFLRO.mjs} +4 -4
  13. package/dist/chunk-FOGPFLRO.mjs.map +1 -0
  14. package/dist/daemon-client.js +14 -4
  15. package/dist/daemon-client.js.map +1 -1
  16. package/dist/daemon-client.mjs +1 -1
  17. package/dist/{eventStore-ClHaWY9b.d.mts → eventStore-D9Kv5dTu.d.mts} +27 -2
  18. package/dist/{eventStore-s1fpKwFe.d.ts → eventStore-DeuZxnKm.d.ts} +27 -2
  19. package/dist/index.d.mts +21 -12
  20. package/dist/index.d.ts +21 -12
  21. package/dist/index.js +1487 -1362
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +1104 -1002
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/{maxParallel-fSAdLIMh.d.mts → maxParallel-CSTmqKeu.d.mts} +44 -8
  26. package/dist/{maxParallel-DXvhdlD5.d.ts → maxParallel-Ds9VI1KO.d.ts} +44 -8
  27. package/dist/parsing.d.mts +2 -2
  28. package/dist/parsing.d.ts +2 -2
  29. package/dist/parsing.js +1 -1
  30. package/dist/parsing.js.map +1 -1
  31. package/dist/parsing.mjs +3 -3
  32. package/dist/plan-utils.d.mts +4 -4
  33. package/dist/plan-utils.d.ts +4 -4
  34. package/dist/plan-utils.js.map +1 -1
  35. package/dist/plan-utils.mjs +3 -3
  36. package/dist/testing.d.mts +4 -2
  37. package/dist/testing.d.ts +4 -2
  38. package/dist/testing.js +2 -0
  39. package/dist/testing.js.map +1 -1
  40. package/dist/testing.mjs +3 -1
  41. package/dist/testing.mjs.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-MGMQKUIJ.mjs.map +0 -1
  44. package/dist/chunk-O52PN7P2.mjs.map +0 -1
  45. /package/dist/{chunk-7ACNW5CD.mjs.map → chunk-4OARA73Z.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { bb as RunnerId } from './Task-CH1z4L3h.js';
1
+ import { bb as RunnerId } from './Task-TFPWtKoz.js';
2
2
 
3
3
  interface RunnerModeInfo {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { bb as RunnerId } from './Task-CH1z4L3h.mjs';
1
+ import { bb as RunnerId } from './Task-TFPWtKoz.mjs';
2
2
 
3
3
  interface RunnerModeInfo {
4
4
  id: string;
@@ -1954,6 +1954,8 @@ interface RunningLongFacts {
1954
1954
  /** What the main model's context holds now, from the last usage record or compaction. */
1955
1955
  contextTokens?: number;
1956
1956
  contextWindow?: number;
1957
+ /** Where Ordewell set the runner to compact its context, when it did: a compaction there is routine. */
1958
+ compactionWindow?: number;
1957
1959
  /** The most the context has held this attempt: the saved usage keeps only the last. */
1958
1960
  peakContextTokens?: number;
1959
1961
  /** Automatic compactions of the attempt's own runner session so far. */
@@ -1954,6 +1954,8 @@ interface RunningLongFacts {
1954
1954
  /** What the main model's context holds now, from the last usage record or compaction. */
1955
1955
  contextTokens?: number;
1956
1956
  contextWindow?: number;
1957
+ /** Where Ordewell set the runner to compact its context, when it did: a compaction there is routine. */
1958
+ compactionWindow?: number;
1957
1959
  /** The most the context has held this attempt: the saved usage keeps only the last. */
1958
1960
  peakContextTokens?: number;
1959
1961
  /** Automatic compactions of the attempt's own runner session so far. */
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  flattenTasks,
3
3
  flattenTasksWithParents
4
- } from "./chunk-3P5UIXTR.mjs";
4
+ } from "./chunk-5ETS2NIB.mjs";
5
5
 
6
6
  // src/models/ScriptTask.ts
7
7
  var DEFAULT_SCRIPT_TIMEOUT_MS = 10 * 6e4;
@@ -350,4 +350,4 @@ export {
350
350
  filterModelsForPrompt,
351
351
  clampThinkingEffort
352
352
  };
353
- //# sourceMappingURL=chunk-7ACNW5CD.mjs.map
353
+ //# sourceMappingURL=chunk-4OARA73Z.mjs.map
@@ -1304,14 +1304,17 @@ function runningLongThreshold(tasks) {
1304
1304
  const scaled = basis ? basis.runningMs * RUNNING_LONG_FACTOR : 0;
1305
1305
  return basis && scaled > RUNNING_LONG_FLOOR_MS ? { ms: scaled, basis } : { ms: RUNNING_LONG_FLOOR_MS };
1306
1306
  }
1307
+ var ROUTINE_COMPACTIONS = 3;
1307
1308
  var MAX_TIMER_MS = 2 ** 31 - 1;
1308
1309
  var RunningLongClock = class {
1309
- constructor(threshold, flag) {
1310
+ constructor(threshold, flag, compactWindow = () => void 0) {
1310
1311
  this.threshold = threshold;
1311
1312
  this.flag = flag;
1313
+ this.compactWindow = compactWindow;
1312
1314
  }
1313
1315
  threshold;
1314
1316
  flag;
1317
+ compactWindow;
1315
1318
  accrued = 0;
1316
1319
  since = null;
1317
1320
  timer = null;
@@ -1350,8 +1353,14 @@ var RunningLongClock = class {
1350
1353
  this.measure();
1351
1354
  if (trigger !== "auto") return;
1352
1355
  this.compactions += 1;
1356
+ if (this.compactWindow() !== void 0 && !this.beyondRoutine()) return;
1353
1357
  this.flag(this.facts("compaction", this.due()));
1354
1358
  }
1359
+ /** The 3rd compaction, the 6th, the 12th: the first that is no longer routine, then each doubling. */
1360
+ beyondRoutine() {
1361
+ const n = this.compactions / ROUTINE_COMPACTIONS;
1362
+ return Number.isInteger(n) && Number.isInteger(Math.log2(n));
1363
+ }
1355
1364
  measure() {
1356
1365
  const tokens = this.meter.lastPromptTokens;
1357
1366
  if (tokens !== void 0) this.peak = Math.max(this.peak ?? 0, tokens);
@@ -1392,6 +1401,7 @@ var RunningLongClock = class {
1392
1401
  ...basis ? { basis } : {},
1393
1402
  ...this.meter.lastPromptTokens !== void 0 ? { contextTokens: this.meter.lastPromptTokens } : {},
1394
1403
  ...this.meter.contextWindow !== void 0 ? { contextWindow: this.meter.contextWindow } : {},
1404
+ ...this.compactWindow() !== void 0 ? { compactionWindow: this.compactWindow() } : {},
1395
1405
  ...this.peak !== void 0 ? { peakContextTokens: this.peak } : {},
1396
1406
  compactions: this.compactions
1397
1407
  };
@@ -1594,7 +1604,7 @@ var VerdictEngine = class {
1594
1604
  const clock = task.type === "ai" ? new RunningLongClock(this.runningLongThreshold, (facts) => {
1595
1605
  if (this.generations.get(task.id) !== gen) return;
1596
1606
  for (const l of this.runningLongListeners) l(task.id, facts);
1597
- }) : void 0;
1607
+ }, () => session.compactWindowTokens) : void 0;
1598
1608
  if (clock) {
1599
1609
  this.clocks.set(task.id, clock);
1600
1610
  clock.run();
@@ -2015,4 +2025,4 @@ export {
2015
2025
  isSettledTask,
2016
2026
  keepExecutionState
2017
2027
  };
2018
- //# sourceMappingURL=chunk-3P5UIXTR.mjs.map
2028
+ //# sourceMappingURL=chunk-5ETS2NIB.mjs.map