@nyte-ai/core 0.0.18 → 0.0.21

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 (186) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +66 -0
  3. package/dist/chunks/{compose-yk3y0jap.js → compose-0m65m83c.js} +7 -7
  4. package/dist/chunks/{compose-r12cnkpc.js → compose-12jnd50a.js} +11 -11
  5. package/dist/chunks/{compose-q1n2dgrs.js → compose-1knxqqm1.js} +4 -4
  6. package/dist/chunks/{compose-xtkavyrw.js → compose-1r0wr5dc.js} +17 -9
  7. package/dist/chunks/{compose-9tqm6g18.js → compose-2rha31fc.js} +4 -4
  8. package/dist/chunks/{compose-0bpspysf.js → compose-4ppmas7g.js} +5 -5
  9. package/dist/chunks/compose-5rg7askh.js +52 -0
  10. package/dist/chunks/{compose-mryw0674.js → compose-5z835ej2.js} +6 -1
  11. package/dist/chunks/{compose-7k6nsmtq.js → compose-6gt28900.js} +11 -14
  12. package/dist/chunks/{compose-2eg8w67t.js → compose-6r5ymwyr.js} +15 -4
  13. package/dist/chunks/{compose-xd0kdp3t.js → compose-753gc057.js} +8 -8
  14. package/dist/chunks/{compose-q1ts0v6k.js → compose-767bb340.js} +1 -1
  15. package/dist/chunks/{compose-rpq9n0nz.js → compose-8mkfr84d.js} +89 -32
  16. package/dist/chunks/{compose-5w5bbakh.js → compose-8pp3vtv0.js} +5 -5
  17. package/dist/chunks/{compose-gaps3heh.js → compose-9hy3p236.js} +9 -9
  18. package/dist/chunks/{compose-pgeemk2b.js → compose-a7k9h27z.js} +6 -5
  19. package/dist/chunks/{compose-dc2ns6gd.js → compose-a8ddt55n.js} +10 -10
  20. package/dist/chunks/{compose-7b8ajk7a.js → compose-ad80nkkn.js} +8 -8
  21. package/dist/chunks/{compose-064y3n82.js → compose-ae5t6v5b.js} +5 -5
  22. package/dist/chunks/{compose-amr0k1m1.js → compose-b2bf1jvy.js} +122 -41
  23. package/dist/chunks/{compose-xpfr4wt3.js → compose-bbhk8vnr.js} +7 -4
  24. package/dist/chunks/compose-bd8c5n7k.js +32 -0
  25. package/dist/chunks/{compose-rehp8epe.js → compose-byse0eqj.js} +7 -7
  26. package/dist/chunks/{compose-ef936rsa.js → compose-bz70g01d.js} +27 -11
  27. package/dist/chunks/compose-c4238qkb.js +105 -0
  28. package/dist/chunks/{compose-q1b0tppc.js → compose-c9wxgbjp.js} +4 -4
  29. package/dist/chunks/{compose-h272znxk.js → compose-cdj05t7x.js} +7 -7
  30. package/dist/chunks/{compose-kb22bkpt.js → compose-cqpjcx2t.js} +12 -1
  31. package/dist/chunks/{compose-dbx6ftbm.js → compose-csh5vv2t.js} +42 -4
  32. package/dist/chunks/{compose-eqr5qwp1.js → compose-d1m94kzq.js} +62 -22
  33. package/dist/chunks/{compose-drdej9yt.js → compose-d95fwwvw.js} +4 -4
  34. package/dist/chunks/{compose-jc22rsz4.js → compose-dbsn3bsy.js} +2 -2
  35. package/dist/chunks/{compose-s2aew2c9.js → compose-e2fyz3xc.js} +5 -5
  36. package/dist/chunks/{compose-gg8b9b21.js → compose-e9f6nrwp.js} +23 -18
  37. package/dist/chunks/{compose-52afaf3v.js → compose-fnncnk81.js} +7 -7
  38. package/dist/chunks/{compose-bjx8s01m.js → compose-fqsqjbrf.js} +1 -1
  39. package/dist/chunks/{compose-1gd9vkye.js → compose-gj2ypr7q.js} +3 -3
  40. package/dist/chunks/compose-gvm49f4b.js +155 -0
  41. package/dist/chunks/{compose-1jz2j92f.js → compose-gxjc6vz9.js} +30 -2
  42. package/dist/chunks/{compose-cq1zx4gp.js → compose-h14pmqv3.js} +1 -1
  43. package/dist/chunks/{compose-d2s80zg2.js → compose-hfrjm4a1.js} +5 -5
  44. package/dist/chunks/{compose-kmzr06mw.js → compose-hfsn6pnt.js} +8 -5
  45. package/dist/chunks/{compose-jjchxce6.js → compose-j42p9wfs.js} +1 -1
  46. package/dist/chunks/{compose-4b1zf3p0.js → compose-jd4bsnqh.js} +63 -47
  47. package/dist/chunks/{compose-2g3enfv5.js → compose-jeemzja1.js} +4 -4
  48. package/dist/chunks/{compose-y478gv6x.js → compose-jmmyw9hd.js} +4 -4
  49. package/dist/chunks/{compose-5tkyrzr0.js → compose-jwy1gba9.js} +4 -4
  50. package/dist/chunks/{compose-k35b75k9.js → compose-kwkna3cg.js} +2 -4
  51. package/dist/chunks/{compose-t53j8yxv.js → compose-m01wspwf.js} +1 -1
  52. package/dist/chunks/{compose-n93897b0.js → compose-m91ffwss.js} +1 -1
  53. package/dist/chunks/{compose-madtxnp1.js → compose-matk94se.js} +7 -7
  54. package/dist/chunks/{compose-aa73dbe8.js → compose-mcz93154.js} +117 -58
  55. package/dist/chunks/{compose-r7dx7rpz.js → compose-mdwr0er9.js} +72 -15
  56. package/dist/chunks/{compose-j12n448k.js → compose-nj4nj5n9.js} +36 -3
  57. package/dist/chunks/{compose-yn2et568.js → compose-nkxwrphm.js} +141 -15
  58. package/dist/chunks/{compose-k8aghhv2.js → compose-pkprmn5b.js} +16 -16
  59. package/dist/chunks/{compose-1z7q169s.js → compose-q2zxbg41.js} +69 -41
  60. package/dist/chunks/{compose-b5xz0dj7.js → compose-qwbe95qs.js} +2 -2
  61. package/dist/chunks/{compose-vmhv4e00.js → compose-qxfq6dn9.js} +13 -12
  62. package/dist/chunks/{compose-wgphshsn.js → compose-r8tz1xfj.js} +8 -8
  63. package/dist/chunks/{compose-ffk8dnbh.js → compose-smsafpqe.js} +3 -3
  64. package/dist/chunks/{compose-djq2bt61.js → compose-sprfv38c.js} +6 -6
  65. package/dist/chunks/{compose-cdy4q5mv.js → compose-t9fcqtby.js} +17 -16
  66. package/dist/chunks/{compose-p3q14yt1.js → compose-tppkp915.js} +5 -5
  67. package/dist/chunks/{compose-dckpgtks.js → compose-ts08bth2.js} +3 -3
  68. package/dist/chunks/{compose-n10w4nkk.js → compose-vn7b7fdj.js} +12 -3
  69. package/dist/chunks/{compose-9m19b27b.js → compose-w6zb11k1.js} +7 -7
  70. package/dist/chunks/{compose-j3tkz0tb.js → compose-wvzzf8n2.js} +6 -6
  71. package/dist/chunks/{compose-6vf6dkk2.js → compose-xhtgytrh.js} +2 -2
  72. package/dist/chunks/{compose-4tb2vn84.js → compose-y6xgbg2h.js} +1 -1
  73. package/dist/chunks/compose-yfcb6w2h.js +58 -0
  74. package/dist/chunks/{compose-0rx7ygxq.js → compose-zaanjpb7.js} +1 -1
  75. package/dist/chunks/{compose-7pc3p5ex.js → compose-zjj072km.js} +8 -8
  76. package/dist/src/agent/compaction.js +41 -39
  77. package/dist/src/agent/images.d.ts +7 -0
  78. package/dist/src/agent/images.js +8 -0
  79. package/dist/src/agent/request.js +30 -30
  80. package/dist/src/agent/tool-runner.d.ts +3 -7
  81. package/dist/src/agent/tool-runner.js +34 -30
  82. package/dist/src/agent/transcript.d.ts +0 -1
  83. package/dist/src/agent/transcript.js +37 -35
  84. package/dist/src/agent/turn.js +46 -43
  85. package/dist/src/api/connection.js +60 -56
  86. package/dist/src/api/head.js +42 -41
  87. package/dist/src/api/part.js +22 -22
  88. package/dist/src/api/server.js +48 -44
  89. package/dist/src/api/session.js +48 -47
  90. package/dist/src/builtins/delegation.js +2 -2
  91. package/dist/src/builtins/environment.js +1 -2
  92. package/dist/src/compose.d.ts +6 -7
  93. package/dist/src/compose.js +72 -67
  94. package/dist/src/contract/fold.d.ts +1 -3
  95. package/dist/src/contract/host.d.ts +30 -1
  96. package/dist/src/contract/host.js +4 -2
  97. package/dist/src/contract/kernel.d.ts +6 -35
  98. package/dist/src/contract/parts.d.ts +4 -0
  99. package/dist/src/contract/parts.js +1 -1
  100. package/dist/src/contract/records.d.ts +69 -3
  101. package/dist/src/contract/records.js +5 -1
  102. package/dist/src/contract/session.d.ts +2 -1
  103. package/dist/src/contract/tools.d.ts +10 -1
  104. package/dist/src/contract/workspace.d.ts +7 -3
  105. package/dist/src/drive/execution.js +46 -42
  106. package/dist/src/drive/interruptions.d.ts +7 -0
  107. package/dist/src/drive/interruptions.js +17 -0
  108. package/dist/src/engine/admission.js +24 -24
  109. package/dist/src/engine/batches.js +22 -22
  110. package/dist/src/engine/branch-summary.js +21 -21
  111. package/dist/src/engine/durable.d.ts +0 -2
  112. package/dist/src/engine/durable.js +20 -20
  113. package/dist/src/engine/fence.js +20 -20
  114. package/dist/src/engine/jobs.d.ts +2 -0
  115. package/dist/src/engine/jobs.js +31 -27
  116. package/dist/src/engine/move.js +23 -23
  117. package/dist/src/engine/part-definitions.js +2 -2
  118. package/dist/src/engine/presence.d.ts +39 -0
  119. package/dist/src/engine/presence.js +16 -0
  120. package/dist/src/engine/principals.js +17 -17
  121. package/dist/src/engine/receipts.js +21 -21
  122. package/dist/src/engine/runs.d.ts +1 -1
  123. package/dist/src/engine/runs.js +25 -25
  124. package/dist/src/engine/start.js +36 -35
  125. package/dist/src/engine/surface.d.ts +4 -0
  126. package/dist/src/engine/surface.js +13 -0
  127. package/dist/src/engine/waits.d.ts +5 -15
  128. package/dist/src/engine/waits.js +23 -19
  129. package/dist/src/env/browser.js +27 -27
  130. package/dist/src/env/environment.js +29 -29
  131. package/dist/src/env/mcp.js +31 -31
  132. package/dist/src/env/session-changes.d.ts +10 -0
  133. package/dist/src/env/session-changes.js +15 -0
  134. package/dist/src/env/trust.js +30 -30
  135. package/dist/src/env/workspaces.js +34 -33
  136. package/dist/src/env/worktrees.js +35 -34
  137. package/dist/src/extend/activation.js +35 -34
  138. package/dist/src/extend/hooks.js +22 -22
  139. package/dist/src/extend/models.d.ts +2 -1
  140. package/dist/src/extend/models.js +32 -30
  141. package/dist/src/extend/plugin-api.js +18 -18
  142. package/dist/src/extend/plugin-runtime.js +42 -41
  143. package/dist/src/extend/registry.js +27 -27
  144. package/dist/src/extend/resources.js +31 -31
  145. package/dist/src/extend/setting-layers.js +4 -4
  146. package/dist/src/extend/settings.js +38 -37
  147. package/dist/src/extend/workspace-commands.js +43 -42
  148. package/dist/src/fold/calls.js +5 -5
  149. package/dist/src/fold/checkpoint.js +11 -11
  150. package/dist/src/fold/code.d.ts +1 -2
  151. package/dist/src/fold/code.js +1 -1
  152. package/dist/src/fold/commit.d.ts +0 -4
  153. package/dist/src/fold/commit.js +16 -16
  154. package/dist/src/fold/draft.js +4 -4
  155. package/dist/src/fold/fold.js +7 -7
  156. package/dist/src/fold/paths.js +5 -5
  157. package/dist/src/fold/project.d.ts +3 -1
  158. package/dist/src/fold/project.js +8 -6
  159. package/dist/src/fold/reads.js +5 -5
  160. package/dist/src/fold/seen.js +19 -19
  161. package/dist/src/fold/view.d.ts +1 -1
  162. package/dist/src/fold/view.js +20 -20
  163. package/dist/src/fold/watch.js +15 -15
  164. package/dist/src/harness.d.ts +3 -1
  165. package/dist/src/harness.js +75 -70
  166. package/dist/src/index.d.ts +3 -3
  167. package/dist/src/index.js +5 -3
  168. package/dist/src/server.js +70 -65
  169. package/dist/src/store/inspect.js +4 -4
  170. package/dist/src/store/log.d.ts +0 -2
  171. package/dist/src/store/log.js +2 -2
  172. package/dist/src/store/memory-store.js +5 -5
  173. package/dist/src/store/migrations.js +3 -3
  174. package/dist/src/store/model-state.d.ts +6 -1
  175. package/dist/src/store/model-state.js +14 -4
  176. package/dist/src/store/parts.js +5 -5
  177. package/dist/src/store/refs.d.ts +6 -5
  178. package/dist/src/store/refs.js +11 -1
  179. package/dist/src/store/session-index.js +2 -2
  180. package/dist/src/store/session.d.ts +3 -1
  181. package/dist/src/store/session.js +5 -3
  182. package/dist/src/store.d.ts +1 -1
  183. package/dist/src/store.js +11 -7
  184. package/dist/src/testing.d.ts +2 -0
  185. package/dist/src/testing.js +83 -70
  186. package/package.json +4 -4
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  decodeSeenRecord2
3
- } from "./compose-1jz2j92f.js";
3
+ } from "./compose-gxjc6vz9.js";
4
4
  import {
5
5
  seenRef2
6
- } from "./compose-kb22bkpt.js";
6
+ } from "./compose-cqpjcx2t.js";
7
7
  import {
8
8
  dev2
9
9
  } from "./compose-n116fnmp.js";
@@ -16,13 +16,13 @@ import {
16
16
  attempt2,
17
17
  walkCommitPath2,
18
18
  readPositionCommit2
19
- } from "./compose-n10w4nkk.js";
19
+ } from "./compose-vn7b7fdj.js";
20
20
  import {
21
21
  commit2
22
- } from "./compose-xpfr4wt3.js";
22
+ } from "./compose-bbhk8vnr.js";
23
23
  import {
24
24
  withFold2
25
- } from "./compose-6vf6dkk2.js";
25
+ } from "./compose-xhtgytrh.js";
26
26
 
27
27
  // src/fold/seen.ts
28
28
  import { serial } from "@nyte-ai/schema/serial";
@@ -9,11 +9,12 @@ import {
9
9
  } from "./compose-zfjxkavf.js";
10
10
  import {
11
11
  project2,
12
- readSeenCommit2
13
- } from "./compose-2eg8w67t.js";
12
+ readSeenCommit2,
13
+ findLeadingPrompt2
14
+ } from "./compose-6r5ymwyr.js";
14
15
  import {
15
16
  seenWriter2
16
- } from "./compose-d2s80zg2.js";
17
+ } from "./compose-hfrjm4a1.js";
17
18
 
18
19
  // src/fold/view.ts
19
20
  function watchHead2(kernel, input) {
@@ -78,13 +79,15 @@ async function historyHead2(kernel, input) {
78
79
  const messages = folded?.messages ?? [];
79
80
  const end = messages.findIndex((message) => message.id === input.before);
80
81
  if (folded === undefined || path === undefined || end < 0 || input.limit <= 0)
81
- return { messages: [], turns: [] };
82
- const page = messages.slice(Math.max(0, end - input.limit), end);
82
+ return { messages: [], leadingPrompt: null, turns: [] };
83
+ const start = Math.max(0, end - input.limit);
84
+ const page = messages.slice(start, end);
83
85
  const positions = [
84
86
  ...new Set(page.flatMap((message) => path.turnAt.get(message.turn) ?? []))
85
87
  ].toSorted((left, right) => left - right);
86
88
  return {
87
89
  messages: page,
90
+ leadingPrompt: findLeadingPrompt2(path, start),
88
91
  turns: positions.flatMap((position) => folded.turns[position] ?? [])
89
92
  };
90
93
  } finally {
@@ -2,7 +2,7 @@ import {
2
2
  updatePart2,
3
3
  setTurn2,
4
4
  liveRun2
5
- } from "./compose-cq1zx4gp.js";
5
+ } from "./compose-h14pmqv3.js";
6
6
 
7
7
  // src/fold/calls.ts
8
8
  import { compile, isJsonObject, ToolClassType } from "@nyte-ai/schema";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LOCAL2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  check2
6
6
  } from "./compose-bj54tkph.js";
@@ -10,29 +10,35 @@ import {
10
10
  tool2,
11
11
  compaction2,
12
12
  branchSummary2
13
- } from "./compose-bjx8s01m.js";
13
+ } from "./compose-fqsqjbrf.js";
14
14
  import {
15
15
  decodeRunRecord2
16
- } from "./compose-1jz2j92f.js";
16
+ } from "./compose-gxjc6vz9.js";
17
17
  import {
18
18
  runRef2
19
- } from "./compose-kb22bkpt.js";
19
+ } from "./compose-cqpjcx2t.js";
20
20
  import {
21
21
  START2,
22
22
  load2,
23
23
  requireSession2,
24
24
  walkCommitPath2,
25
25
  readPositionCommit2
26
- } from "./compose-n10w4nkk.js";
26
+ } from "./compose-vn7b7fdj.js";
27
27
  import {
28
28
  withFold2
29
- } from "./compose-6vf6dkk2.js";
29
+ } from "./compose-xhtgytrh.js";
30
+ import {
31
+ modelImage2
32
+ } from "./compose-c4238qkb.js";
30
33
  import {
31
34
  scanResources2
32
- } from "./compose-y478gv6x.js";
35
+ } from "./compose-jmmyw9hd.js";
36
+ import {
37
+ hiddenOwners2
38
+ } from "./compose-bd8c5n7k.js";
33
39
  import {
34
40
  toolSource2
35
- } from "./compose-064y3n82.js";
41
+ } from "./compose-ae5t6v5b.js";
36
42
 
37
43
  // src/agent/transcript.ts
38
44
  import { isJsonObject } from "@nyte-ai/schema";
@@ -60,7 +66,8 @@ async function requestBody2(kernel, models, runtime, input) {
60
66
  });
61
67
  const source = toolSource2(runtime);
62
68
  const named = agent?.tools;
63
- const tools = source.list().filter((info) => info.exposure === "model" && (named === undefined || named.includes(info.name)));
69
+ const hidden = await hiddenOwners2(kernel, session, run);
70
+ const tools = source.list().filter((info) => info.exposure === "model" && (named === undefined || named.includes(info.name)) && (info.owner === null || !hidden.has(info.owner)));
64
71
  return {
65
72
  transcript: await runtime.hooks.transform("transform_transcript", { messages, tools }, where),
66
73
  source
@@ -364,7 +371,7 @@ async function toolResult(kernel, id, state, at, images) {
364
371
  const said = (words) => result([{ type: "text", text: words }], true);
365
372
  switch (outcome.kind) {
366
373
  case "ok": {
367
- const content = await Promise.all(outcome.content.map((item) => item.kind === "text" ? Promise.resolve({ type: "text", text: item.text }) : fileContent(kernel, item, images)));
374
+ const content = (await Promise.all(outcome.content.map((item) => item.kind === "text" ? Promise.resolve([{ type: "text", text: item.text }]) : fileContent(kernel, item, images)))).flat();
368
375
  return result(content.length > 0 ? content : [
369
376
  {
370
377
  type: "text",
@@ -395,30 +402,35 @@ ${content}`;
395
402
  async function userContent(kernel, content, images) {
396
403
  if (typeof content === "string")
397
404
  return content;
398
- return Promise.all(content.map((item) => {
405
+ const parts = await Promise.all(content.map((item) => {
399
406
  switch (item.kind) {
400
407
  case "text":
401
- return Promise.resolve({ type: "text", text: item.text });
408
+ return Promise.resolve([{ type: "text", text: item.text }]);
402
409
  case "file":
403
410
  return fileContent(kernel, item, images);
404
411
  case "reference":
405
- return mentionContent(kernel.store, item);
412
+ return mentionContent(kernel.store, item).then((mention) => [mention]);
406
413
  case "skill":
407
- return Promise.resolve({
408
- type: "text",
409
- text: `<skill name="${escapeAttribute(item.name)}" location="${escapeAttribute(item.location)}">
414
+ return Promise.resolve([
415
+ {
416
+ type: "text",
417
+ text: `<skill name="${escapeAttribute(item.name)}" location="${escapeAttribute(item.location)}">
410
418
  Read the skill's file at its location and follow it.
411
419
  </skill>`
412
- });
420
+ }
421
+ ]);
413
422
  case "excerpt":
414
- return Promise.resolve({
415
- type: "text",
416
- text: `<excerpt ${excerptAttributes(item.source)}>
423
+ return Promise.resolve([
424
+ {
425
+ type: "text",
426
+ text: `<excerpt ${excerptAttributes(item.source)}>
417
427
  ${fencedExcerpt(item.text)}
418
428
  </excerpt>`
419
- });
429
+ }
430
+ ]);
420
431
  }
421
432
  }));
433
+ return parts.flat();
422
434
  }
423
435
  async function fileContent(kernel, file, images) {
424
436
  const name = file.name ?? file.blob;
@@ -429,41 +441,45 @@ async function fileContent(kernel, file, images) {
429
441
  if (cached !== undefined) {
430
442
  cache.delete(file.blob);
431
443
  cache.set(file.blob, cached);
432
- return { type: "image", data: cached, mimeType: file.mime };
444
+ return cached.map((part) => ({ ...part }));
433
445
  }
434
446
  const reader = await kernel.store.objects.blob(file.blob);
435
447
  if (reader === null)
436
- return { type: "text", text: `[File ${name}, ${file.mime}: no longer stored]` };
448
+ return [{ type: "text", text: `[File ${name}, ${file.mime}: no longer stored]` }];
437
449
  try {
438
- if (image) {
439
- const chunks = [];
440
- for await (const chunk of reader.chunks())
441
- chunks.push(chunk);
442
- const bytes = new Uint8Array(chunks.reduce((size, chunk) => size + chunk.byteLength, 0));
443
- let offset = 0;
444
- for (const chunk of chunks) {
445
- bytes.set(chunk, offset);
446
- offset += chunk.byteLength;
447
- }
448
- const data = bytes.toBase64();
449
- cache.set(file.blob, data);
450
- let size = [...cache.values()].reduce((total, kept) => total + kept.length, 0);
451
- for (const [blob, kept] of cache) {
452
- if (size <= IMAGE_CACHE_CHARS)
453
- break;
454
- cache.delete(blob);
455
- size -= kept.length;
456
- }
457
- return { type: "image", data, mimeType: file.mime };
450
+ if (!image)
451
+ return [
452
+ {
453
+ type: "text",
454
+ text: `[File ${name}, ${reader.size === null ? "unknown size" : `${reader.size} bytes`}, ${file.mime}]`
455
+ }
456
+ ];
457
+ const chunks = [];
458
+ for await (const chunk of reader.chunks())
459
+ chunks.push(chunk);
460
+ const bytes = new Uint8Array(chunks.reduce((size, chunk) => size + chunk.byteLength, 0));
461
+ let offset = 0;
462
+ for (const chunk of chunks) {
463
+ bytes.set(chunk, offset);
464
+ offset += chunk.byteLength;
458
465
  }
459
- return {
460
- type: "text",
461
- text: `[File ${name}, ${reader.size === null ? "unknown size" : `${reader.size} bytes`}, ${file.mime}]`
462
- };
466
+ const content = await modelImage2(kernel.images, { bytes, mime: file.mime, name });
467
+ cache.set(file.blob, content);
468
+ let size = [...cache.values()].reduce((total, kept) => total + cachedChars(kept), 0);
469
+ for (const [blob, kept] of cache) {
470
+ if (size <= IMAGE_CACHE_CHARS)
471
+ break;
472
+ cache.delete(blob);
473
+ size -= cachedChars(kept);
474
+ }
475
+ return content.map((part) => ({ ...part }));
463
476
  } finally {
464
477
  await reader.close();
465
478
  }
466
479
  }
480
+ function cachedChars(content) {
481
+ return content.reduce((total, part) => total + (part.type === "image" ? part.data.length : part.text.length), 0);
482
+ }
467
483
  async function mentionContent(store, mention) {
468
484
  const reader = mention.blob === undefined ? null : await store.objects.blob(mention.blob);
469
485
  if (reader === null)
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  CORE_CONTEXT2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  dev2
6
6
  } from "./compose-n116fnmp.js";
7
7
  import {
8
8
  readCall2
9
- } from "./compose-n10w4nkk.js";
9
+ } from "./compose-vn7b7fdj.js";
10
10
  import {
11
11
  signalsPark2,
12
12
  runStep2
13
- } from "./compose-rehp8epe.js";
13
+ } from "./compose-byse0eqj.js";
14
14
  import {
15
15
  stepPluginApi2
16
- } from "./compose-q1b0tppc.js";
16
+ } from "./compose-c9wxgbjp.js";
17
17
 
18
18
  // src/extend/hooks.ts
19
19
  import { compile, JsonType, SdkError, SubmissionType, withJson } from "@nyte-ai/schema";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  kvRef2
3
- } from "./compose-kb22bkpt.js";
3
+ } from "./compose-cqpjcx2t.js";
4
4
  import {
5
5
  dev2
6
6
  } from "./compose-n116fnmp.js";
7
7
  import {
8
8
  requireSession2,
9
9
  readKv2
10
- } from "./compose-n10w4nkk.js";
10
+ } from "./compose-vn7b7fdj.js";
11
11
  import {
12
12
  classifyFileSupport2,
13
13
  readWorkspace2
14
- } from "./compose-0bpspysf.js";
14
+ } from "./compose-4ppmas7g.js";
15
15
  import {
16
16
  WORKSPACE_TRUST2,
17
17
  projectTrust2
18
- } from "./compose-5w5bbakh.js";
18
+ } from "./compose-8pp3vtv0.js";
19
19
 
20
20
  // src/extend/resources.ts
21
21
  import { SdkError, standard } from "@nyte-ai/schema";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  decodePrincipalRecord2
3
- } from "./compose-1jz2j92f.js";
3
+ } from "./compose-gxjc6vz9.js";
4
4
  import {
5
5
  hostPrincipalsRef2
6
- } from "./compose-kb22bkpt.js";
6
+ } from "./compose-cqpjcx2t.js";
7
7
  import {
8
8
  load2,
9
9
  readRefExpectation2,
10
10
  put2
11
- } from "./compose-n10w4nkk.js";
11
+ } from "./compose-vn7b7fdj.js";
12
12
  import {
13
13
  commit2
14
- } from "./compose-xpfr4wt3.js";
14
+ } from "./compose-bbhk8vnr.js";
15
15
 
16
16
  // src/engine/principals.ts
17
17
  import { asId, OPERATIONS, SdkError } from "@nyte-ai/schema";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseSessionRef2
3
- } from "./compose-kb22bkpt.js";
3
+ } from "./compose-cqpjcx2t.js";
4
4
 
5
5
  // src/store/log.ts
6
6
  import { SdkError, SessionEventSchema } from "@nyte-ai/schema";
@@ -12,9 +12,7 @@ function admits2(update, current) {
12
12
  return current?.revision === update.expect;
13
13
  }
14
14
  function fenceNames2(updates) {
15
- return [
16
- ...new Set(updates.flatMap((update) => update.fence === undefined ? [] : [update.fence]))
17
- ];
15
+ return [...new Set(updates.flatMap((update) => update.fences ?? []))];
18
16
  }
19
17
  function collectSessionEvents2(updates) {
20
18
  return updates.flatMap((update) => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./compose-q6c7wswc.js";
4
4
  import {
5
5
  acquire2
6
- } from "./compose-yn2et568.js";
6
+ } from "./compose-nkxwrphm.js";
7
7
 
8
8
  // src/env/browser.ts
9
9
  import { asId, asSeq, SdkError } from "@nyte-ai/schema";
@@ -2,7 +2,7 @@ import {
2
2
  isPart2,
3
3
  text2,
4
4
  tool2
5
- } from "./compose-bjx8s01m.js";
5
+ } from "./compose-fqsqjbrf.js";
6
6
  import {
7
7
  extractUserText2
8
8
  } from "./compose-rxsqmcgq.js";
@@ -5,7 +5,7 @@ import {
5
5
  headRef2,
6
6
  inboxRef2,
7
7
  receiptRef2
8
- } from "./compose-kb22bkpt.js";
8
+ } from "./compose-cqpjcx2t.js";
9
9
  import {
10
10
  MAIN2,
11
11
  EMPTY_REVISION2,
@@ -20,28 +20,28 @@ import {
20
20
  createPosition2,
21
21
  toCommitObjectId2,
22
22
  guard2
23
- } from "./compose-n10w4nkk.js";
23
+ } from "./compose-vn7b7fdj.js";
24
24
  import {
25
25
  commit2
26
- } from "./compose-xpfr4wt3.js";
26
+ } from "./compose-bbhk8vnr.js";
27
27
  import {
28
28
  withFold2
29
- } from "./compose-6vf6dkk2.js";
29
+ } from "./compose-xhtgytrh.js";
30
30
  import {
31
31
  fence2,
32
32
  finishFence2
33
- } from "./compose-9m19b27b.js";
33
+ } from "./compose-w6zb11k1.js";
34
34
  import {
35
35
  holdSummary2,
36
36
  summaryHeld2,
37
37
  summarizedMove2
38
- } from "./compose-p3q14yt1.js";
38
+ } from "./compose-tppkp915.js";
39
39
  import {
40
40
  settleReceipt2,
41
41
  reserve2,
42
42
  known2,
43
43
  typedReceipt2
44
- } from "./compose-52afaf3v.js";
44
+ } from "./compose-fnncnk81.js";
45
45
 
46
46
  // src/engine/move.ts
47
47
  import { asId, SdkError } from "@nyte-ai/schema";