@cortexkit/opencode-magic-context 0.49.63 → 0.49.64

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 (63) hide show
  1. package/dist/auto-search-worker.js +1 -1
  2. package/dist/chunk-embedding-write-worker.js +1 -1
  3. package/dist/{context-aaht09yh.js → context-v1apxpct.js} +14 -14
  4. package/dist/features/magic-context/overflow-detection.d.ts +0 -20
  5. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  6. package/dist/features/magic-context/storage-tags.d.ts +7 -0
  7. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  8. package/dist/{index-tq20edcs.js → index-0ab398z2.js} +2 -2
  9. package/dist/{index-qdver0af.js → index-5fbeycst.js} +6 -6
  10. package/dist/{index-d0feqcs5.js → index-6kgsfb81.js} +1 -1
  11. package/dist/{index-3hk445am.js → index-71h616be.js} +1 -1
  12. package/dist/{index-ev2rrjfc.js → index-7dj3s7qq.js} +1 -1
  13. package/dist/{index-bqd5dmm4.js → index-aq4yfcq6.js} +15 -15
  14. package/dist/{index-3yyfftqq.js → index-c0k54yhd.js} +3 -3
  15. package/dist/{index-ywxvdwmj.js → index-ezr8mr1c.js} +1 -1
  16. package/dist/{index-s2jdky2x.js → index-g59gpt1j.js} +3 -3
  17. package/dist/{index-kv4ntrr6.js → index-gwb2wpz7.js} +2 -2
  18. package/dist/{index-s2qsd3w9.js → index-hs9xxmmy.js} +5 -5
  19. package/dist/{index-8sc7vqt7.js → index-kvfrse61.js} +75 -43
  20. package/dist/{index-3wq9btxt.js → index-m568xww6.js} +3 -3
  21. package/dist/{index-0cz8bsyx.js → index-qn27gh4e.js} +1 -1
  22. package/dist/{index-4yjn3er4.js → index-zdd01nhc.js} +5 -5
  23. package/dist/index.js +18 -18
  24. package/dist/{message-index-bounded-f6yz4xq8.js → message-index-bounded-zs7ah2te.js} +3 -3
  25. package/dist/migration-worker.js +1 -1
  26. package/dist/raw-ordinal-warmup-worker.js +4 -4
  27. package/dist/{read-session-chunk-8b1g06nz.js → read-session-chunk-jf2f8jz8.js} +2 -2
  28. package/dist/{recomp-orchestrator-7s8nyzhy.js → recomp-orchestrator-6vxnrh2w.js} +7 -7
  29. package/dist/{render-nrfbtkkw.js → render-n46wpv2n.js} +6 -6
  30. package/dist/{search-archive-1ppdjfm9.js → search-archive-9k6vsp44.js} +4 -4
  31. package/dist/{search-xha0r30f.js → search-s386bwwh.js} +5 -5
  32. package/dist/shared/tag-transcript.d.ts.map +1 -1
  33. package/dist/{storage-tags-spet01yb.js → storage-tags-2r952wqy.js} +1 -1
  34. package/dist/{transform-postprocess-phase-fxp1atm1.js → transform-postprocess-phase-jjc9jcer.js} +8 -8
  35. package/dist/v2/auto-search-worker.js +1 -1
  36. package/dist/v2/chunk-embedding-write-worker.js +1 -1
  37. package/dist/v2/{context-hk9x7ngz.js → context-nfkhb5sv.js} +12 -12
  38. package/dist/v2/{message-index-bounded-0w8eh8fc.js → message-index-bounded-axbs1s97.js} +3 -3
  39. package/dist/v2/migration-worker.js +1 -1
  40. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  41. package/dist/v2/{read-session-chunk-dxs1tgt9.js → read-session-chunk-41cm522x.js} +2 -2
  42. package/dist/v2/{recomp-orchestrator-zc1wdv9q.js → recomp-orchestrator-krccyz0a.js} +6 -6
  43. package/dist/v2/{render-9knrdrjs.js → render-7v7yx9xb.js} +6 -6
  44. package/dist/v2/{search-archive-2jmyvj69.js → search-archive-1yc8bh6y.js} +4 -4
  45. package/dist/v2/{search-a2a0qs3t.js → search-mabwkzw2.js} +4 -4
  46. package/dist/v2/{server-svx20ra2.js → server-8w9b5exq.js} +1 -1
  47. package/dist/v2/{server-9m5r04ws.js → server-anh8gf0w.js} +2 -2
  48. package/dist/v2/{server-ja6swvmb.js → server-bh9yzxpz.js} +2 -2
  49. package/dist/v2/{server-9ab9jnpq.js → server-bnka2vf2.js} +3 -3
  50. package/dist/v2/{server-8ycacd59.js → server-cdddk5d1.js} +1 -1
  51. package/dist/v2/{server-88n85n60.js → server-hb5zm7yh.js} +75 -43
  52. package/dist/v2/{server-tzh55x6d.js → server-hcgqsdrh.js} +1 -1
  53. package/dist/v2/{server-4r86tcs2.js → server-k97r77x3.js} +2 -2
  54. package/dist/v2/{server-8hcxmt1w.js → server-xse5jngy.js} +5 -5
  55. package/dist/v2/{server-t8tmrtcg.js → server-yxw43z2w.js} +1 -1
  56. package/dist/v2/server.js +2 -2
  57. package/dist/v2/{storage-tags-50wsqg3t.js → storage-tags-9zs0gc7w.js} +1 -1
  58. package/dist/v2/{v2-archive-reader-ycjh6a2d.js → v2-archive-reader-pgk140pb.js} +1 -1
  59. package/dist/v2/{wrapup-orchestrator-fyyb28jf.js → wrapup-orchestrator-v2rgtczc.js} +6 -6
  60. package/dist/{v2-archive-reader-wec0a8fx.js → v2-archive-reader-cv6veqnz.js} +1 -1
  61. package/dist/{wrapup-orchestrator-560v99mk.js → wrapup-orchestrator-qbtg1dhm.js} +8 -8
  62. package/package.json +1 -1
  63. package/src/shared/tag-transcript.ts +105 -1
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
31
31
  import("./embedding-cache-mgyr73ef.js"),
32
32
  import("./storage-memory-e6a7mb0k.js"),
33
33
  import("./project-embedding-registry-k0hjqt11.js"),
34
- import("./search-a2a0qs3t.js"),
34
+ import("./search-mabwkzw2.js"),
35
35
  import("./compartment-chunk-embedding-x6qw6mjk.js"),
36
36
  import("./embedding-activity-g1dhes6g.js"),
37
37
  import("./harness-e4avh192.js"),
@@ -36,7 +36,7 @@ import"./server-jdfe07mp.js";
36
36
  import {
37
37
  LATEST_SUPPORTED_VERSION,
38
38
  enforceSchemaFence
39
- } from "./server-tzh55x6d.js";
39
+ } from "./server-hcgqsdrh.js";
40
40
  import"./server-468mya5v.js";
41
41
  import"./server-jn4pktdk.js";
42
42
  import"./server-xepx8t43.js";
@@ -220,7 +220,7 @@ import {
220
220
  startCompartmentAgent,
221
221
  setRecompStarting2,
222
222
  setRecompTerminal2
223
- } from "./server-8hcxmt1w.js";
223
+ } from "./server-xse5jngy.js";
224
224
  import {
225
225
  resolveHistorianModel2
226
226
  } from "./server-5kym00ag.js";
@@ -534,7 +534,7 @@ import {
534
534
  adoptNullOwnerToolTag2,
535
535
  getCandidateToolOwners2,
536
536
  pickNearestPriorOwner2
537
- } from "./server-88n85n60.js";
537
+ } from "./server-hb5zm7yh.js";
538
538
  import {
539
539
  textMentionsRecentCommit,
540
540
  hasMeaningfulUserText2,
@@ -616,12 +616,12 @@ import {
616
616
  readRawSessionMessageOrdinalById2,
617
617
  readSessionChunk2,
618
618
  readRawSessionSeedTail2
619
- } from "./server-8ycacd59.js";
619
+ } from "./server-cdddk5d1.js";
620
620
  import {
621
621
  cleanSearchText,
622
622
  matchedSearchSnippet,
623
623
  getLastIndexedOrdinal
624
- } from "./server-svx20ra2.js";
624
+ } from "./server-8w9b5exq.js";
625
625
  import"./server-ds8vpfkr.js";
626
626
  import {
627
627
  getMessageIndexEpoch,
@@ -648,7 +648,7 @@ import {
648
648
  resolveMemoriesByIdsForSearch2,
649
649
  unifiedSearch2,
650
650
  formatSearchResults2
651
- } from "./server-ja6swvmb.js";
651
+ } from "./server-bh9yzxpz.js";
652
652
  import {
653
653
  embedPauseBySession,
654
654
  embedRunStateBySession,
@@ -794,7 +794,7 @@ import {
794
794
  saveSourceContent,
795
795
  replaceSourceContent,
796
796
  getSourceContents
797
- } from "./server-t8tmrtcg.js";
797
+ } from "./server-yxw43z2w.js";
798
798
  import {
799
799
  startBootDeadline,
800
800
  getUnconfirmedMigrationHolders,
@@ -810,7 +810,7 @@ import {
810
810
  openDatabaseAsync,
811
811
  isDatabasePersisted,
812
812
  getDatabasePersistenceError
813
- } from "./server-tzh55x6d.js";
813
+ } from "./server-hcgqsdrh.js";
814
814
  import {
815
815
  V2_MEMORY_CATEGORIES,
816
816
  CATEGORY_PRIORITY
@@ -996,14 +996,14 @@ import {
996
996
  renderMessageByOrdinal2,
997
997
  renderVerboseRangeForTool2,
998
998
  renderItemByTag2
999
- } from "./server-4r86tcs2.js";
999
+ } from "./server-k97r77x3.js";
1000
1000
  import"./server-52x68mj4.js";
1001
1001
  import {
1002
1002
  readV2ArchiveOffThread2
1003
- } from "./server-9ab9jnpq.js";
1003
+ } from "./server-bnka2vf2.js";
1004
1004
  import {
1005
1005
  renderSearchArchiveOffThread2
1006
- } from "./server-9m5r04ws.js";
1006
+ } from "./server-anh8gf0w.js";
1007
1007
  import {
1008
1008
  markHostInstructionRow,
1009
1009
  hostInstructionRow,
@@ -26079,7 +26079,7 @@ function registerRpcHandlers(rpcServer, args) {
26079
26079
  const db = readDatabase();
26080
26080
  if (!db)
26081
26081
  return { ok: false, error: "db unavailable" };
26082
- const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-zc1wdv9q.js"));
26082
+ const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-krccyz0a.js"));
26083
26083
  const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-8g4r97bp.js"));
26084
26084
  log2(`[rpc] recomp requested for session ${sessionId}`);
26085
26085
  if (!args.client && !args.hiddenCompletionExecutor) {
@@ -26164,7 +26164,7 @@ function registerRpcHandlers(rpcServer, args) {
26164
26164
  const db = readDatabase();
26165
26165
  if (!db)
26166
26166
  return { ok: false, error: "db unavailable" };
26167
- const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-fyyb28jf.js"));
26167
+ const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-v2rgtczc.js"));
26168
26168
  const model = liveSessionState.liveModelBySession.get(sessionId);
26169
26169
  const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
26170
26170
  const ctx = {
@@ -4,7 +4,7 @@ import {
4
4
  yieldIndexChunk2
5
5
  } from "./server-gzy5w8ya.js";
6
6
  import"./server-1zx87sdm.js";
7
- import"./server-88n85n60.js";
7
+ import"./server-hb5zm7yh.js";
8
8
  import"./server-y8xjr8rx.js";
9
9
  import"./server-pavzsdc6.js";
10
10
  import"./server-j8376q08.js";
@@ -17,7 +17,7 @@ import"./server-1d042x6w.js";
17
17
  import"./server-6ash6z8z.js";
18
18
  import"./server-2ra6pwf3.js";
19
19
  import"./server-3ap5dmhc.js";
20
- import"./server-8ycacd59.js";
20
+ import"./server-cdddk5d1.js";
21
21
  import {
22
22
  MESSAGE_INDEX_MAX_FTS_BYTES,
23
23
  messageIndexSkipKey,
@@ -25,7 +25,7 @@ import {
25
25
  markMessageIndexDirty,
26
26
  getIndexableContent,
27
27
  indexSingleMessage
28
- } from "./server-svx20ra2.js";
28
+ } from "./server-8w9b5exq.js";
29
29
  import"./server-ds8vpfkr.js";
30
30
  import"./server-5sbsnpkn.js";
31
31
 
@@ -19,7 +19,7 @@ import"./server-fb3zxn06.js";
19
19
  import {
20
20
  setSqlitePragmaConfig,
21
21
  initializeDatabase
22
- } from "./server-tzh55x6d.js";
22
+ } from "./server-hcgqsdrh.js";
23
23
  import"./server-468mya5v.js";
24
24
  import"./server-v0p37hm2.js";
25
25
  import"./server-96ztjvkn.js";
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
19
19
  await main();
20
20
  async function main() {
21
21
  if (input.v2ArchiveReader) {
22
- const { serveV2ArchiveReads } = await import("./v2-archive-reader-ycjh6a2d.js");
22
+ const { serveV2ArchiveReads } = await import("./v2-archive-reader-pgk140pb.js");
23
23
  await serveV2ArchiveReads(port, openConnections);
24
24
  return;
25
25
  }
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
51
51
  await runMessageFtsRowidMapBackfill(db);
52
52
  reply = { kind: "fts-rowid-backfill" };
53
53
  } else if (input.searchArchive) {
54
- const { renderSearchArchive } = await import("./search-archive-2jmyvj69.js");
54
+ const { renderSearchArchive } = await import("./search-archive-1yc8bh6y.js");
55
55
  const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-wg5zc29f.js");
56
56
  const archive = input.searchArchive;
57
57
  let raw;
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
81
81
  const { setHarness } = await import("./harness-e4avh192.js");
82
82
  setHarness(input.harness ?? "opencode");
83
83
  const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
- import("./message-index-bounded-0w8eh8fc.js"),
84
+ import("./message-index-bounded-axbs1s97.js"),
85
85
  import("./sqlite-context-pragmas-mv9jqwjh.js")
86
86
  ]);
87
87
  configureContextDatabasePragmas(db);
@@ -95,7 +95,7 @@ serveWorkerJobs(async (input, port) => {
95
95
  measurements: result.measurements
96
96
  };
97
97
  } else if (input.tagRatio !== undefined) {
98
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-50wsqg3t.js");
98
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-9zs0gc7w.js");
99
99
  const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
100
100
  if (delta)
101
101
  reply = { kind: "tag-delta", delta };
@@ -38,8 +38,8 @@ import {
38
38
  readSessionChunk2,
39
39
  getRawSessionMessageIdsThrough2,
40
40
  readRawSessionSeedTail2
41
- } from "./server-8ycacd59.js";
42
- import"./server-88n85n60.js";
41
+ } from "./server-cdddk5d1.js";
42
+ import"./server-hb5zm7yh.js";
43
43
  import"./server-1zx87sdm.js";
44
44
  import"./server-3ap5dmhc.js";
45
45
  import"./server-rz6g5xne.js";
@@ -7,23 +7,23 @@ import {
7
7
  setRecompTerminal2,
8
8
  buildRecompDeps2,
9
9
  runManagedRecomp2
10
- } from "./server-8hcxmt1w.js";
10
+ } from "./server-xse5jngy.js";
11
11
  import"./server-at0v0z4t.js";
12
12
  import"./server-d07yxksx.js";
13
13
  import"./server-d9aayyxk.js";
14
14
  import"./server-jjvbk92s.js";
15
15
  import"./server-z5255w05.js";
16
16
  import"./server-4dhv7mqz.js";
17
- import"./server-t8tmrtcg.js";
17
+ import"./server-yxw43z2w.js";
18
18
  import"./server-rbtx6q5v.js";
19
- import"./server-svx20ra2.js";
19
+ import"./server-8w9b5exq.js";
20
20
  import"./server-2amn2s73.js";
21
21
  import"./server-rthnpmbp.js";
22
22
  import"./server-aewxmvnf.js";
23
23
  import"./server-qjff96a6.js";
24
24
  import"./server-qt1qqasc.js";
25
- import"./server-8ycacd59.js";
26
- import"./server-88n85n60.js";
25
+ import"./server-cdddk5d1.js";
26
+ import"./server-hb5zm7yh.js";
27
27
  import"./server-1zx87sdm.js";
28
28
  import"./server-3ap5dmhc.js";
29
29
  import"./server-npdey91q.js";
@@ -35,7 +35,7 @@ import"./server-rz6g5xne.js";
35
35
  import"./server-jtq03rkb.js";
36
36
  import"./server-8pdfmc27.js";
37
37
  import"./server-x6fn9x8q.js";
38
- import"./server-tzh55x6d.js";
38
+ import"./server-hcgqsdrh.js";
39
39
  import"./server-fb3zxn06.js";
40
40
  import"./server-jn4pktdk.js";
41
41
  import"./server-fr0wbhdn.js";
@@ -2,20 +2,20 @@ import {
2
2
  renderMessageByOrdinal2,
3
3
  renderVerboseRangeForTool2,
4
4
  renderItemByTag2
5
- } from "./server-4r86tcs2.js";
6
- import"./server-t8tmrtcg.js";
5
+ } from "./server-k97r77x3.js";
6
+ import"./server-yxw43z2w.js";
7
7
  import"./server-rbtx6q5v.js";
8
- import"./server-svx20ra2.js";
8
+ import"./server-8w9b5exq.js";
9
9
  import"./server-2amn2s73.js";
10
10
  import"./server-rthnpmbp.js";
11
- import"./server-8ycacd59.js";
12
- import"./server-88n85n60.js";
11
+ import"./server-cdddk5d1.js";
12
+ import"./server-hb5zm7yh.js";
13
13
  import"./server-1zx87sdm.js";
14
14
  import"./server-3ap5dmhc.js";
15
15
  import"./server-rz6g5xne.js";
16
16
  import"./server-8pdfmc27.js";
17
17
  import"./server-x6fn9x8q.js";
18
- import"./server-tzh55x6d.js";
18
+ import"./server-hcgqsdrh.js";
19
19
  import"./server-fb3zxn06.js";
20
20
  import"./server-jn4pktdk.js";
21
21
  import"./server-fr0wbhdn.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  renderSearchArchive2,
3
3
  renderSearchArchiveOffThread2
4
- } from "./server-9m5r04ws.js";
5
- import"./server-9ab9jnpq.js";
4
+ } from "./server-anh8gf0w.js";
5
+ import"./server-bnka2vf2.js";
6
6
  import"./server-52x68mj4.js";
7
- import"./server-8ycacd59.js";
8
- import"./server-88n85n60.js";
7
+ import"./server-cdddk5d1.js";
8
+ import"./server-hb5zm7yh.js";
9
9
  import"./server-1zx87sdm.js";
10
10
  import"./server-3ap5dmhc.js";
11
11
  import"./server-rz6g5xne.js";
@@ -5,7 +5,7 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./server-ja6swvmb.js";
8
+ } from "./server-bh9yzxpz.js";
9
9
  import"./server-52x68mj4.js";
10
10
  import"./server-d07yxksx.js";
11
11
  import"./server-d9aayyxk.js";
@@ -13,11 +13,11 @@ import"./server-jjvbk92s.js";
13
13
  import"./server-z5255w05.js";
14
14
  import"./server-4dhv7mqz.js";
15
15
  import"./server-rbtx6q5v.js";
16
- import"./server-svx20ra2.js";
16
+ import"./server-8w9b5exq.js";
17
17
  import"./server-2amn2s73.js";
18
18
  import"./server-qt1qqasc.js";
19
- import"./server-8ycacd59.js";
20
- import"./server-88n85n60.js";
19
+ import"./server-cdddk5d1.js";
20
+ import"./server-hb5zm7yh.js";
21
21
  import"./server-1zx87sdm.js";
22
22
  import"./server-3ap5dmhc.js";
23
23
  import"./server-d706s5xn.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./server-pavzsdc6.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./server-8ycacd59.js";
12
+ } from "./server-cdddk5d1.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
@@ -19,10 +19,10 @@ import {
19
19
  rawMessageWorkerSource2,
20
20
  rawMessageOffThreadRangeReader2,
21
21
  readRawSessionMessageIdOrdinalsForRange2
22
- } from "./server-8ycacd59.js";
22
+ } from "./server-cdddk5d1.js";
23
23
  import {
24
24
  readV2ArchiveOffThread2
25
- } from "./server-9ab9jnpq.js";
25
+ } from "./server-bnka2vf2.js";
26
26
 
27
27
  // src/tools/ctx-expand/search-archive.ts
28
28
  var archiveReadsOnThisThread = 0;
@@ -15,7 +15,7 @@ import {
15
15
  } from "./server-afsz3cmx.js";
16
16
  import {
17
17
  isRecord
18
- } from "./server-88n85n60.js";
18
+ } from "./server-hb5zm7yh.js";
19
19
  import {
20
20
  cleanSearchText,
21
21
  hintKeywordRelevance,
@@ -25,7 +25,7 @@ import {
25
25
  isMessageIndexReconciledThrough,
26
26
  clearIndexedMessages,
27
27
  indexMessagesAfterOrdinal
28
- } from "./server-svx20ra2.js";
28
+ } from "./server-8w9b5exq.js";
29
29
  import {
30
30
  Priority,
31
31
  AdmissionClass,
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
139
139
  import("./sqlite-zdgm52sv.js"),
140
140
  import("./store-reader-yaxtdy6f.js"),
141
141
  import("./store-skkhh3rd.js"),
142
- import("./read-session-chunk-dxs1tgt9.js"),
143
- import("./render-9knrdrjs.js"),
144
- import("./search-archive-2jmyvj69.js"),
142
+ import("./read-session-chunk-41cm522x.js"),
143
+ import("./render-7v7yx9xb.js"),
144
+ import("./search-archive-1yc8bh6y.js"),
145
145
  import("./expand-attachments-h33jbgyz.js")
146
146
  ]);
147
147
  const pool = new V2StoreReaderPool;
@@ -6,7 +6,7 @@ import {
6
6
  estimateMessageTokens,
7
7
  getCandidateToolOwners2,
8
8
  pickNearestPriorOwner2
9
- } from "./server-88n85n60.js";
9
+ } from "./server-hb5zm7yh.js";
10
10
  import {
11
11
  OMO_INTERNAL_INITIATOR_MARKER,
12
12
  isSystemDirective,
@@ -4981,6 +4981,11 @@ function markDropLeavesReasoning(db, sessionId) {
4981
4981
  }
4982
4982
 
4983
4983
  // src/features/magic-context/overflow-detection.ts
4984
+ var TOKEN_COUNT = String.raw`(?<![\d+_-])(?:\d+(?:[,_ .\u202f]+\d+)*(?=\s*tokens?\b)|\d+(?:[,_ \u202f]+\d+)*)(?!\w|[,_\s.]+\d)`;
4985
+ var ESTIMATED_REQUEST = String.raw`\bthis request has an estimated\b`;
4986
+ function overflowPattern(strings, ...fragments) {
4987
+ return new RegExp(String.raw(strings, ...fragments), "i");
4988
+ }
4984
4989
  var OVERFLOW_PATTERNS = [
4985
4990
  /prompt is too long/i,
4986
4991
  /input is too long for requested model/i,
@@ -4988,7 +4993,7 @@ var OVERFLOW_PATTERNS = [
4988
4993
  /input token count.*exceeds the maximum/i,
4989
4994
  /maximum prompt length is \d+/i,
4990
4995
  /reduce the length of the messages/i,
4991
- /maximum context length is \d+ tokens/i,
4996
+ overflowPattern`maximum context length is ${TOKEN_COUNT} tokens?\b`,
4992
4997
  /maximum model length is \d+/i,
4993
4998
  /exceeds the limit of \d+/i,
4994
4999
  /exceeds the available context size/i,
@@ -4997,48 +5002,84 @@ var OVERFLOW_PATTERNS = [
4997
5002
  /exceeded model token limit/i,
4998
5003
  /context[_ ]length[_ ]exceeded/i,
4999
5004
  /request entity too large/i,
5000
- /context length is only \d+ tokens/i,
5005
+ overflowPattern`context length is only ${TOKEN_COUNT} tokens?\b`,
5001
5006
  /input length.*exceeds.*context length/i,
5002
5007
  /\bContextWindowExceededError\b/i,
5003
- /\bthe input \(\d+ tokens?\) is longer than the model's context length \(\d+ tokens?\)/i,
5008
+ overflowPattern`\bthe input \(${TOKEN_COUNT} tokens?\) is longer than the model's context length \(${TOKEN_COUNT} tokens?\)`,
5004
5009
  /prompt too long; exceeded (?:max )?context length/i,
5005
- /too large for model with \d+ maximum context length/i,
5010
+ overflowPattern`too large for model with ${TOKEN_COUNT} maximum context length`,
5006
5011
  /model_context_window_exceeded/i,
5007
5012
  /context size has been exceeded/i,
5008
5013
  /prepared prompt exceeds engine max_context/i,
5009
5014
  /prompt exceeds (?:the )?.{0,32}\bmax_context\b/i
5010
5015
  ];
5011
5016
  var LIMIT_EXTRACTION_PATTERNS = [
5012
- { pattern: /maximum prompt length is (\d+)/i, provenance: "prompt_only" },
5013
5017
  {
5014
- pattern: /maximum context length is (\d+) tokens?/i,
5018
+ pattern: overflowPattern`maximum prompt length is (${TOKEN_COUNT})`,
5019
+ provenance: "prompt_only"
5020
+ },
5021
+ {
5022
+ pattern: overflowPattern`maximum context length is (${TOKEN_COUNT}) tokens?\b`,
5015
5023
  provenance: "combined"
5016
5024
  },
5017
- { pattern: /maximum model length is (\d+)/i, provenance: "combined" },
5018
- { pattern: /context length is only (\d+) tokens?/i, provenance: "combined" },
5019
- { pattern: /exceeds the limit of (\d+)/i, provenance: "unknown" },
5025
+ { pattern: overflowPattern`maximum model length is (${TOKEN_COUNT})`, provenance: "combined" },
5020
5026
  {
5021
- pattern: /too large for model with (\d+) maximum context length/i,
5027
+ pattern: overflowPattern`context length is only (${TOKEN_COUNT}) tokens?\b`,
5022
5028
  provenance: "combined"
5023
5029
  },
5024
- { pattern: /context size[^0-9]{0,40}(\d{4,})\s*tokens?/i, provenance: "combined" },
5025
- { pattern: /exceeds? the context length of (\d+)/i, provenance: "combined" },
5030
+ { pattern: overflowPattern`exceeds the limit of (${TOKEN_COUNT})`, provenance: "unknown" },
5026
5031
  {
5027
- pattern: /\bthe input \(\d+ tokens?\) is longer than the model's context length \((\d+) tokens?\)/i,
5032
+ pattern: overflowPattern`too large for model with (${TOKEN_COUNT}) maximum context length`,
5028
5033
  provenance: "combined"
5029
5034
  },
5030
5035
  {
5031
- pattern: />\s*(\d+)\s*(?:tokens?\s*)?(?:maximum|max|limit)\b/i,
5036
+ pattern: overflowPattern`context size[^0-9]{0,40}(${TOKEN_COUNT})\s*tokens?\b`,
5037
+ provenance: "combined"
5038
+ },
5039
+ {
5040
+ pattern: overflowPattern`exceeds? the context length of (${TOKEN_COUNT})`,
5041
+ provenance: "combined"
5042
+ },
5043
+ {
5044
+ pattern: overflowPattern`\bthe input \(${TOKEN_COUNT} tokens?\) is longer than the model's context length \((${TOKEN_COUNT}) tokens?\)`,
5045
+ provenance: "combined"
5046
+ },
5047
+ {
5048
+ pattern: overflowPattern`>\s*(${TOKEN_COUNT})\s*(?:tokens?\s*)?(?:maximum|max|limit)\b`,
5032
5049
  provenance: "prompt_only"
5033
5050
  },
5034
5051
  {
5035
- pattern: /maximum number of tokens allowed\s*\(?\s*(\d+)/i,
5052
+ pattern: overflowPattern`maximum number of tokens allowed\s*\(?\s*(${TOKEN_COUNT})`,
5036
5053
  provenance: "prompt_only"
5037
5054
  },
5038
- { pattern: /prepared prompt exceeds engine max_context\s+(\d+)/i, provenance: "unknown" },
5039
- { pattern: /prompt exceeds (?:the )?.{0,32}\bmax_context\s+(\d+)/i, provenance: "unknown" },
5040
- { pattern: /max(?:imum)?.*context.*?(\d+)/i, provenance: "unknown" }
5055
+ {
5056
+ pattern: overflowPattern`prepared prompt exceeds engine max_context\s+(${TOKEN_COUNT})`,
5057
+ provenance: "unknown"
5058
+ },
5059
+ {
5060
+ pattern: overflowPattern`prompt exceeds (?:the )?.{0,32}\bmax_context\s+(${TOKEN_COUNT})`,
5061
+ provenance: "unknown"
5062
+ },
5063
+ {
5064
+ pattern: overflowPattern`\ballows a context of up to (${TOKEN_COUNT}) tokens?\b`,
5065
+ provenance: "combined"
5066
+ },
5067
+ {
5068
+ pattern: overflowPattern`(?<!${ESTIMATED_REQUEST}\s+)\bup to (${TOKEN_COUNT}) tokens?\b`,
5069
+ provenance: "unknown"
5070
+ },
5071
+ {
5072
+ pattern: overflowPattern`max(?:imum)?.*context(?:(?!${ESTIMATED_REQUEST})[^\d\r\n])*(${TOKEN_COUNT})`,
5073
+ provenance: "unknown"
5074
+ }
5041
5075
  ];
5076
+ function parseTokenCount(raw) {
5077
+ if (raw === undefined || !/^(?:\d+|\d{1,3}([,_ .\u202f])\d{3}(?:\1\d{3})*)$/.test(raw)) {
5078
+ return null;
5079
+ }
5080
+ const value = Number(raw.replace(/[,_ .\u202f]/g, ""));
5081
+ return Number.isSafeInteger(value) ? value : null;
5082
+ }
5042
5083
  var MIN_PLAUSIBLE_LIMIT = 1024;
5043
5084
  var MAX_PLAUSIBLE_LIMIT = 1e7;
5044
5085
  var THINKING_BINDING_MISMATCH_PATTERN = /bound to a different conversation/i;
@@ -5160,24 +5201,22 @@ function detectOverflow(error) {
5160
5201
  matchedPattern: matched?.source
5161
5202
  };
5162
5203
  }
5204
+ var INPUT_EXTRACTION_PATTERNS = [
5205
+ overflowPattern`prompt is too long:\s*(${TOKEN_COUNT})`,
5206
+ overflowPattern`input token count\s*\(?\s*(${TOKEN_COUNT})`,
5207
+ overflowPattern`input length\s*(${TOKEN_COUNT})`,
5208
+ overflowPattern`prompt was\s*(${TOKEN_COUNT})`,
5209
+ overflowPattern`messages resulted in\s*(${TOKEN_COUNT})\s*tokens?\b`,
5210
+ overflowPattern`\bthe input \((${TOKEN_COUNT}) tokens?\) is longer than the model's context length \(${TOKEN_COUNT} tokens?\)`,
5211
+ overflowPattern`\(\s*(${TOKEN_COUNT})\s+in the messages,\s*${TOKEN_COUNT}\s+in the completion\s*\)`,
5212
+ overflowPattern`${ESTIMATED_REQUEST}\s+(${TOKEN_COUNT})`
5213
+ ];
5163
5214
  function parseReportedInputTokens(message) {
5164
5215
  if (!message)
5165
5216
  return;
5166
- const patterns = [
5167
- /prompt is too long:\s*(\d+)/i,
5168
- /input token count\s*\(?\s*(\d+)/i,
5169
- /input length\s*(\d+)/i,
5170
- /prompt was\s*(\d+)/i,
5171
- /messages resulted in\s*(\d+)\s*tokens?/i,
5172
- /\bthe input \((\d+) tokens?\) is longer than the model's context length \(\d+ tokens?\)/i,
5173
- /\(\s*(\d+)\s+in the messages,\s*\d+\s+in the completion\s*\)/i
5174
- ];
5175
- for (const pattern of patterns) {
5176
- const raw = message.match(pattern)?.[1];
5177
- if (!raw)
5178
- continue;
5179
- const value = Number.parseInt(raw, 10);
5180
- if (Number.isFinite(value) && value > 0)
5217
+ for (const pattern of INPUT_EXTRACTION_PATTERNS) {
5218
+ const value = parseTokenCount(message.match(pattern)?.[1]);
5219
+ if (value !== null && value > 0)
5181
5220
  return value;
5182
5221
  }
5183
5222
  return;
@@ -5186,16 +5225,8 @@ function parseReportedLimit(message) {
5186
5225
  if (!message)
5187
5226
  return;
5188
5227
  for (const { pattern, provenance } of LIMIT_EXTRACTION_PATTERNS) {
5189
- const match = message.match(pattern);
5190
- if (!match)
5191
- continue;
5192
- const raw = match[1];
5193
- if (!raw)
5194
- continue;
5195
- const value = Number.parseInt(raw, 10);
5196
- if (!Number.isFinite(value))
5197
- continue;
5198
- if (value < MIN_PLAUSIBLE_LIMIT || value > MAX_PLAUSIBLE_LIMIT)
5228
+ const value = parseTokenCount(message.match(pattern)?.[1]);
5229
+ if (value === null || value < MIN_PLAUSIBLE_LIMIT || value > MAX_PLAUSIBLE_LIMIT)
5199
5230
  continue;
5200
5231
  return { value, provenance };
5201
5232
  }
@@ -7380,6 +7411,7 @@ function getActiveTagTokenTotalsByMessage2(db, sessionId, messageIds) {
7380
7411
  return out;
7381
7412
  }
7382
7413
  var updateTagTokenCountStatements = new WeakMap;
7414
+ var setTagTokenCountStatements = new WeakMap;
7383
7415
  var updateTagInputTokenCountStatements = new WeakMap;
7384
7416
  function getUpdateTagTokenCountStatement(db) {
7385
7417
  let stmt = updateTagTokenCountStatements.get(db);
@@ -1021,7 +1021,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1021
1021
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1022
1022
  if (signal.aborted || !readsOpenCodeStore)
1023
1023
  return;
1024
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-dxs1tgt9.js"));
1024
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-41cm522x.js"));
1025
1025
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ynb3vg6r.js"));
1026
1026
  if (signal.aborted)
1027
1027
  return;
@@ -3,12 +3,12 @@ import {
3
3
  } from "./server-y8xjr8rx.js";
4
4
  import {
5
5
  getTagById2
6
- } from "./server-88n85n60.js";
6
+ } from "./server-hb5zm7yh.js";
7
7
  import {
8
8
  expandToolPart,
9
9
  visitRawSessionMessages2,
10
10
  readRawSessionMessageById2
11
- } from "./server-8ycacd59.js";
11
+ } from "./server-cdddk5d1.js";
12
12
 
13
13
  // src/tools/ctx-expand/render.ts
14
14
  import { createHash } from "node:crypto";
@@ -100,7 +100,7 @@ import {
100
100
  foldShrunkPartTags2,
101
101
  getTagNumberByMessageId2,
102
102
  getActiveTagsBySession2
103
- } from "./server-88n85n60.js";
103
+ } from "./server-hb5zm7yh.js";
104
104
  import {
105
105
  hasMeaningfulUserText2,
106
106
  estimateTokens,
@@ -155,14 +155,14 @@ import {
155
155
  getRawSessionTagKeysThrough2,
156
156
  getLegacyProtectedTailStartOrdinal2,
157
157
  readSessionChunk2
158
- } from "./server-8ycacd59.js";
158
+ } from "./server-cdddk5d1.js";
159
159
  import {
160
160
  clearCompressionDepth,
161
161
  clearCompressionDepthRange,
162
162
  toMessageIndexSource,
163
163
  clearIndexedMessagesInTransaction,
164
164
  indexSourcesAfterOrdinal
165
- } from "./server-svx20ra2.js";
165
+ } from "./server-8w9b5exq.js";
166
166
  import {
167
167
  COMPARTMENT_LEASE_RENEWAL_MS,
168
168
  getCompartmentLeaseBlocker,
@@ -207,7 +207,7 @@ import {
207
207
  getProjectState,
208
208
  recordSubagentInvocation,
209
209
  getLatestHistorianInvocationId
210
- } from "./server-t8tmrtcg.js";
210
+ } from "./server-yxw43z2w.js";
211
211
  import {
212
212
  invalidateAutoEmbedSession
213
213
  } from "./server-2amn2s73.js";
@@ -267,7 +267,7 @@ import {
267
267
  LATEST_SUPPORTED_VERSION,
268
268
  getPersistedSchemaVersion,
269
269
  openDatabase
270
- } from "./server-tzh55x6d.js";
270
+ } from "./server-hcgqsdrh.js";
271
271
  import {
272
272
  parseCompartmentOutput,
273
273
  resolveWorkspaceShareCategories,
@@ -57,7 +57,7 @@ import {
57
57
  getPendingPiCompactionMarkerState,
58
58
  logPiCompactionMarkerClear,
59
59
  isPrefixBoundThinkingModel
60
- } from "./server-88n85n60.js";
60
+ } from "./server-hb5zm7yh.js";
61
61
  import {
62
62
  BoundedSessionMap,
63
63
  getMeasuredToolDefinitionTokens,