@nyte-ai/core 0.0.18 → 0.0.19

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 (175) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +66 -0
  3. package/dist/chunks/{compose-q1b0tppc.js → compose-0827b2k4.js} +4 -4
  4. package/dist/chunks/{compose-j3tkz0tb.js → compose-1g03zpvn.js} +6 -6
  5. package/dist/chunks/{compose-2g3enfv5.js → compose-31zqcfte.js} +4 -4
  6. package/dist/chunks/{compose-4b1zf3p0.js → compose-4770pb1s.js} +62 -46
  7. package/dist/chunks/{compose-madtxnp1.js → compose-47f47sgy.js} +7 -7
  8. package/dist/chunks/{compose-1z7q169s.js → compose-5489evqa.js} +67 -39
  9. package/dist/chunks/{compose-yk3y0jap.js → compose-54svedb8.js} +7 -7
  10. package/dist/chunks/{compose-9tqm6g18.js → compose-57j0pme0.js} +4 -4
  11. package/dist/chunks/{compose-k8aghhv2.js → compose-5cmp34zp.js} +16 -16
  12. package/dist/chunks/compose-5rg7askh.js +52 -0
  13. package/dist/chunks/{compose-mryw0674.js → compose-5z835ej2.js} +6 -1
  14. package/dist/chunks/{compose-7k6nsmtq.js → compose-6gt28900.js} +11 -14
  15. package/dist/chunks/{compose-q1n2dgrs.js → compose-6m60v1pk.js} +4 -4
  16. package/dist/chunks/{compose-2eg8w67t.js → compose-6r5ymwyr.js} +15 -4
  17. package/dist/chunks/{compose-q1ts0v6k.js → compose-767bb340.js} +1 -1
  18. package/dist/chunks/{compose-pgeemk2b.js → compose-a7k9h27z.js} +6 -5
  19. package/dist/chunks/{compose-wgphshsn.js → compose-azq5jxr2.js} +7 -7
  20. package/dist/chunks/compose-bd8c5n7k.js +32 -0
  21. package/dist/chunks/{compose-drdej9yt.js → compose-c2rnebv0.js} +3 -3
  22. package/dist/chunks/compose-c4238qkb.js +105 -0
  23. package/dist/chunks/{compose-djq2bt61.js → compose-ccrh32hd.js} +6 -6
  24. package/dist/chunks/{compose-kb22bkpt.js → compose-cqpjcx2t.js} +12 -1
  25. package/dist/chunks/{compose-dbx6ftbm.js → compose-csh5vv2t.js} +42 -4
  26. package/dist/chunks/{compose-jc22rsz4.js → compose-dbsn3bsy.js} +2 -2
  27. package/dist/chunks/{compose-rehp8epe.js → compose-eemt6sea.js} +7 -7
  28. package/dist/chunks/{compose-r7dx7rpz.js → compose-exfx5b4d.js} +72 -15
  29. package/dist/chunks/{compose-p3q14yt1.js → compose-g2a1f1yx.js} +5 -5
  30. package/dist/chunks/compose-gvm49f4b.js +155 -0
  31. package/dist/chunks/{compose-9m19b27b.js → compose-gvrqkyn4.js} +7 -7
  32. package/dist/chunks/{compose-1jz2j92f.js → compose-gxjc6vz9.js} +30 -2
  33. package/dist/chunks/{compose-s2aew2c9.js → compose-gxvetm0j.js} +5 -5
  34. package/dist/chunks/{compose-cq1zx4gp.js → compose-h14pmqv3.js} +1 -1
  35. package/dist/chunks/{compose-5w5bbakh.js → compose-h3pch7ch.js} +5 -5
  36. package/dist/chunks/{compose-r12cnkpc.js → compose-hf6xkwdw.js} +10 -10
  37. package/dist/chunks/{compose-aa73dbe8.js → compose-hms4hf6p.js} +92 -49
  38. package/dist/chunks/{compose-jjchxce6.js → compose-j42p9wfs.js} +1 -1
  39. package/dist/chunks/{compose-vmhv4e00.js → compose-jehg40ce.js} +13 -12
  40. package/dist/chunks/{compose-5tkyrzr0.js → compose-jhs91x01.js} +4 -4
  41. package/dist/chunks/{compose-xd0kdp3t.js → compose-jrqn6xhy.js} +8 -8
  42. package/dist/chunks/{compose-ef936rsa.js → compose-ks2rdteq.js} +27 -11
  43. package/dist/chunks/{compose-k35b75k9.js → compose-kwkna3cg.js} +2 -4
  44. package/dist/chunks/{compose-gaps3heh.js → compose-m1ecjzm2.js} +8 -8
  45. package/dist/chunks/{compose-xtkavyrw.js → compose-m6nsbnkk.js} +17 -9
  46. package/dist/chunks/{compose-y478gv6x.js → compose-mamr4qwf.js} +4 -4
  47. package/dist/chunks/{compose-j12n448k.js → compose-nj4nj5n9.js} +36 -3
  48. package/dist/chunks/{compose-cdy4q5mv.js → compose-pe0cgbv0.js} +17 -16
  49. package/dist/chunks/{compose-xpfr4wt3.js → compose-pnsvwd3m.js} +7 -4
  50. package/dist/chunks/{compose-52afaf3v.js → compose-prchdrqk.js} +7 -7
  51. package/dist/chunks/{compose-7pc3p5ex.js → compose-q1d09qpr.js} +8 -8
  52. package/dist/chunks/{compose-amr0k1m1.js → compose-q1rrtq3a.js} +2 -2
  53. package/dist/chunks/{compose-0bpspysf.js → compose-qknd62yj.js} +5 -5
  54. package/dist/chunks/{compose-b5xz0dj7.js → compose-qwbe95qs.js} +2 -2
  55. package/dist/chunks/{compose-064y3n82.js → compose-r1pxdxbw.js} +5 -5
  56. package/dist/chunks/{compose-7b8ajk7a.js → compose-rd5e5nxg.js} +8 -8
  57. package/dist/chunks/{compose-gg8b9b21.js → compose-s5522cth.js} +23 -18
  58. package/dist/chunks/{compose-t53j8yxv.js → compose-se7wwcq1.js} +1 -1
  59. package/dist/chunks/{compose-dc2ns6gd.js → compose-seyhq3fb.js} +10 -10
  60. package/dist/chunks/{compose-ffk8dnbh.js → compose-smsafpqe.js} +3 -3
  61. package/dist/chunks/{compose-eqr5qwp1.js → compose-tb5ywdfk.js} +56 -21
  62. package/dist/chunks/{compose-dckpgtks.js → compose-ts08bth2.js} +3 -3
  63. package/dist/chunks/{compose-1gd9vkye.js → compose-v9yf9mrh.js} +3 -3
  64. package/dist/chunks/{compose-n10w4nkk.js → compose-vn7b7fdj.js} +12 -3
  65. package/dist/chunks/{compose-kmzr06mw.js → compose-w2ac7xjx.js} +8 -5
  66. package/dist/chunks/{compose-rpq9n0nz.js → compose-xaegezm3.js} +84 -26
  67. package/dist/chunks/{compose-6vf6dkk2.js → compose-xhtgytrh.js} +2 -2
  68. package/dist/chunks/{compose-4tb2vn84.js → compose-y6xgbg2h.js} +1 -1
  69. package/dist/chunks/{compose-yn2et568.js → compose-y9c31w4e.js} +118 -9
  70. package/dist/chunks/{compose-h272znxk.js → compose-z6hbq6y0.js} +7 -7
  71. package/dist/chunks/{compose-d2s80zg2.js → compose-zch4zapc.js} +5 -5
  72. package/dist/src/agent/compaction.js +39 -37
  73. package/dist/src/agent/images.d.ts +7 -0
  74. package/dist/src/agent/images.js +8 -0
  75. package/dist/src/agent/request.js +28 -28
  76. package/dist/src/agent/tool-runner.d.ts +1 -7
  77. package/dist/src/agent/tool-runner.js +29 -28
  78. package/dist/src/agent/transcript.d.ts +0 -1
  79. package/dist/src/agent/transcript.js +35 -33
  80. package/dist/src/agent/turn.js +43 -41
  81. package/dist/src/api/connection.js +56 -53
  82. package/dist/src/api/head.js +39 -39
  83. package/dist/src/api/part.js +20 -20
  84. package/dist/src/api/server.js +45 -42
  85. package/dist/src/api/session.js +44 -44
  86. package/dist/src/builtins/environment.js +1 -1
  87. package/dist/src/compose.d.ts +6 -7
  88. package/dist/src/compose.js +68 -64
  89. package/dist/src/contract/fold.d.ts +1 -3
  90. package/dist/src/contract/host.d.ts +30 -1
  91. package/dist/src/contract/host.js +4 -2
  92. package/dist/src/contract/kernel.d.ts +6 -35
  93. package/dist/src/contract/records.d.ts +69 -3
  94. package/dist/src/contract/records.js +5 -1
  95. package/dist/src/contract/session.d.ts +2 -1
  96. package/dist/src/contract/workspace.d.ts +5 -3
  97. package/dist/src/drive/execution.js +43 -40
  98. package/dist/src/drive/interruptions.d.ts +7 -0
  99. package/dist/src/drive/interruptions.js +17 -0
  100. package/dist/src/engine/admission.js +22 -22
  101. package/dist/src/engine/batches.js +21 -21
  102. package/dist/src/engine/branch-summary.js +20 -20
  103. package/dist/src/engine/durable.d.ts +0 -2
  104. package/dist/src/engine/durable.js +19 -19
  105. package/dist/src/engine/fence.js +19 -19
  106. package/dist/src/engine/jobs.d.ts +1 -0
  107. package/dist/src/engine/jobs.js +27 -25
  108. package/dist/src/engine/move.js +22 -22
  109. package/dist/src/engine/presence.d.ts +39 -0
  110. package/dist/src/engine/presence.js +16 -0
  111. package/dist/src/engine/principals.js +16 -16
  112. package/dist/src/engine/receipts.js +20 -20
  113. package/dist/src/engine/runs.d.ts +1 -1
  114. package/dist/src/engine/runs.js +23 -23
  115. package/dist/src/engine/start.js +33 -33
  116. package/dist/src/engine/surface.d.ts +4 -0
  117. package/dist/src/engine/surface.js +13 -0
  118. package/dist/src/engine/waits.d.ts +5 -15
  119. package/dist/src/engine/waits.js +22 -18
  120. package/dist/src/env/browser.js +25 -25
  121. package/dist/src/env/environment.js +27 -27
  122. package/dist/src/env/mcp.js +29 -29
  123. package/dist/src/env/trust.js +28 -28
  124. package/dist/src/env/workspaces.js +31 -31
  125. package/dist/src/env/worktrees.js +32 -32
  126. package/dist/src/extend/activation.js +32 -32
  127. package/dist/src/extend/hooks.js +21 -21
  128. package/dist/src/extend/models.d.ts +2 -1
  129. package/dist/src/extend/models.js +30 -28
  130. package/dist/src/extend/plugin-api.js +17 -17
  131. package/dist/src/extend/plugin-runtime.js +38 -38
  132. package/dist/src/extend/registry.js +25 -25
  133. package/dist/src/extend/resources.js +29 -29
  134. package/dist/src/extend/setting-layers.js +4 -4
  135. package/dist/src/extend/settings.js +35 -35
  136. package/dist/src/extend/workspace-commands.js +39 -39
  137. package/dist/src/fold/calls.js +5 -5
  138. package/dist/src/fold/checkpoint.js +11 -11
  139. package/dist/src/fold/code.d.ts +1 -2
  140. package/dist/src/fold/code.js +1 -1
  141. package/dist/src/fold/commit.d.ts +0 -4
  142. package/dist/src/fold/commit.js +15 -15
  143. package/dist/src/fold/draft.js +4 -4
  144. package/dist/src/fold/fold.js +7 -7
  145. package/dist/src/fold/paths.js +5 -5
  146. package/dist/src/fold/project.d.ts +3 -1
  147. package/dist/src/fold/project.js +8 -6
  148. package/dist/src/fold/reads.js +5 -5
  149. package/dist/src/fold/seen.js +18 -18
  150. package/dist/src/fold/view.d.ts +1 -1
  151. package/dist/src/fold/view.js +19 -19
  152. package/dist/src/fold/watch.js +14 -14
  153. package/dist/src/harness.d.ts +2 -1
  154. package/dist/src/harness.js +71 -67
  155. package/dist/src/index.d.ts +2 -2
  156. package/dist/src/index.js +4 -2
  157. package/dist/src/server.js +66 -62
  158. package/dist/src/store/inspect.js +4 -4
  159. package/dist/src/store/log.d.ts +0 -2
  160. package/dist/src/store/log.js +2 -2
  161. package/dist/src/store/memory-store.js +5 -5
  162. package/dist/src/store/migrations.js +3 -3
  163. package/dist/src/store/model-state.d.ts +6 -1
  164. package/dist/src/store/model-state.js +14 -4
  165. package/dist/src/store/parts.js +4 -4
  166. package/dist/src/store/refs.d.ts +6 -5
  167. package/dist/src/store/refs.js +11 -1
  168. package/dist/src/store/session-index.js +2 -2
  169. package/dist/src/store/session.d.ts +3 -1
  170. package/dist/src/store/session.js +5 -3
  171. package/dist/src/store.d.ts +1 -1
  172. package/dist/src/store.js +11 -7
  173. package/dist/src/testing.d.ts +2 -0
  174. package/dist/src/testing.js +77 -65
  175. package/package.json +4 -4
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Core owns durable session state and execution. `composeHost` (`@nyte-ai/core/server`) builds a host from a `Store`, the `@nyte-ai/ai` models, core plugins and a default workspace; [host](../host/README.md)'s `openHost`, which the sdk's Node `sdk.open` is, calls it with what a machine supplies. Clients do not import core: they use `@nyte-ai/sdk`, whose types are core's and schema's.
4
4
 
5
- The package has four entries: [src/index.ts](src/index.ts) (`.`), the client and plugin contract; [src/store.ts](src/store.ts) (`./store`), the store-backend SPI host's stores implement; [src/server.ts](src/server.ts) (`./server`), composition and the `ServerHost` port a listener serves a composed host through; and [src/testing.ts](src/testing.ts) (`./testing`), the kernel under a composed host, the steps the tests of other packages drive by hand and the scripted-turn harness ([src/harness.ts](src/harness.ts)) core's own tests share, outside the SDK contract. Each export's JSDoc is its contract, and the surface it implements is the baseline in [packages/lab/sdk-shape.ts](../lab/sdk-shape.ts).
5
+ The package has four entries: [src/index.ts](src/index.ts) (`.`), the client and plugin contract; [src/store.ts](src/store.ts) (`./store`), the store-backend SPI host's stores implement; [src/server.ts](src/server.ts) (`./server`), composition and the `ServerHost` port a listener serves a composed host through; and [src/testing.ts](src/testing.ts) (`./testing`), the kernel under a composed host, the steps the tests of other packages drive by hand and the scripted-turn harness ([src/harness.ts](src/harness.ts)) core's own tests share, outside the SDK contract.
6
6
 
7
7
  A store is two primitives: immutable content-addressed objects, written before any publish, and refs, the only mutable state, published as one all-or-nothing `refs.set` batch. `memoryStore` (`./store`) is the in-process one; sqlite, postgres and Durable Object storage live in host. A head's `watch()` folds the session into one `SessionView` per change, and the sdk folds the wire's deltas with the same code, so no client derives what the view carries.
8
8
 
@@ -91,6 +91,9 @@ SOFTWARE.
91
91
  - Transcript reconciliation, checkpoint instruction snapshots, provider system
92
92
  updates, and cache warming are ported from the 1.0.0 release commit
93
93
  `a13d35a742c6ef8462812a28fbe1d8c8b7431c32`.
94
+ - Fitting images to model limits (`packages/core/src/agent/images.ts` and
95
+ `packages/host/src/images`) is ported from `@earendil-works/pi-durable`'s
96
+ images at commit `73f8de80bc87021375f8b525292ac07492253002`.
94
97
 
95
98
  License: MIT, with the following notice:
96
99
 
@@ -148,6 +151,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
148
151
  THE SOFTWARE.
149
152
  ```
150
153
 
154
+ ## Photon (`silvia-odwyer/photon`)
155
+
156
+ - Repository: https://github.com/silvia-odwyer/photon
157
+ - Package: `@silvia-odwyer/photon` 0.3.3
158
+ - What: the host decodes, orients, scales and re-encodes images for the model
159
+ with Photon's WebAssembly build.
160
+
161
+ License: Apache License 2.0, reproduced in the appendix below. Copyright 2023
162
+ Silvia O'Dwyer.
163
+
151
164
  ## Pierre
152
165
 
153
166
  - Repository: https://github.com/pierrecomputer/pierre
@@ -561,6 +574,59 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
561
574
  SOFTWARE.
562
575
  ```
563
576
 
577
+ ## snapcn (`snapcndev/snapcn`)
578
+
579
+ - Repository: https://github.com/snapcndev/snapcn
580
+ - What: the launch film's Logo Flicker and Check Cycle scenes
581
+ (`packages/lab/video/src/snap-cn/`) are adapted from snapcn's registry
582
+ components at commit `47ee435f17d85f74abf48b095b40d64fc9616fb0`.
583
+
584
+ License: MIT, with the following notice:
585
+
586
+ ```text
587
+ MIT License
588
+
589
+ Copyright (c) 2026 Sri Nath (snap-cn)
590
+
591
+ Permission is hereby granted, free of charge, to any person obtaining a copy
592
+ of this software and associated documentation files (the "Software"), to deal
593
+ in the Software without restriction, including without limitation the rights
594
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
595
+ copies of the Software, and to permit persons to whom the Software is
596
+ furnished to do so, subject to the following conditions:
597
+
598
+ The above copyright notice and this permission notice shall be included in all
599
+ copies or substantial portions of the Software.
600
+
601
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
602
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
603
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
604
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
605
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
606
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
607
+ SOFTWARE.
608
+ ```
609
+
610
+ ## Naybr, "Copyright Free Gameplay (No Commentary) - Minecraft Survival"
611
+
612
+ - Source: https://www.youtube.com/watch?v=GPsGyv5zTlM, by Naybr (youtube.com/@Naybr)
613
+ - What: the launch film opens on four shots from 0:30 to 2:30 of this video
614
+ (`clip` in `packages/lab/video/src/film/media.ts`). The footage is not in
615
+ the repository; `packages/lab/video/README.md` says how to fetch it.
616
+
617
+ License: Creative Commons Attribution, as published on YouTube. The author
618
+ allows use, modification, redistribution and monetisation, with this credit
619
+ wherever the gameplay is used: "Gameplay – youtube.com/@Naybr".
620
+
621
+ ## Photographs in the launch film
622
+
623
+ - Source: Wikimedia Commons; each file's author and source page are listed in
624
+ `photos` in `packages/lab/video/src/film/media.ts`.
625
+ - What: eleven photographs the launch film cuts between. They are not in the
626
+ repository.
627
+
628
+ License: every one is public domain or CC0. None requires attribution.
629
+
564
630
  ## Design references
565
631
 
566
632
  These credits record design sources. They do not grant a license to the
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CORE_CONTEXT2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  kvRef2
6
- } from "./compose-kb22bkpt.js";
6
+ } from "./compose-cqpjcx2t.js";
7
7
  import {
8
8
  requireSession2,
9
9
  put2,
10
10
  readKv2
11
- } from "./compose-n10w4nkk.js";
11
+ } from "./compose-vn7b7fdj.js";
12
12
  import {
13
13
  commit2
14
- } from "./compose-xpfr4wt3.js";
14
+ } from "./compose-pnsvwd3m.js";
15
15
 
16
16
  // src/extend/plugin-api.ts
17
17
  import { isJsonObject, SdkError } from "@nyte-ai/schema";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  hostPrincipalsRef2
3
- } from "./compose-kb22bkpt.js";
3
+ } from "./compose-cqpjcx2t.js";
4
4
  import {
5
5
  sendReceipt2
6
- } from "./compose-52afaf3v.js";
6
+ } from "./compose-prchdrqk.js";
7
7
  import {
8
8
  move2
9
- } from "./compose-madtxnp1.js";
9
+ } from "./compose-47f47sgy.js";
10
10
  import {
11
11
  heldReceipt2,
12
12
  applyBatch2
13
- } from "./compose-9tqm6g18.js";
13
+ } from "./compose-57j0pme0.js";
14
14
  import {
15
15
  driveInProcess2
16
- } from "./compose-rpq9n0nz.js";
16
+ } from "./compose-xaegezm3.js";
17
17
  import {
18
18
  redeemPairing2,
19
19
  authenticateToken2
20
- } from "./compose-5tkyrzr0.js";
20
+ } from "./compose-jhs91x01.js";
21
21
 
22
22
  // src/api/server.ts
23
23
  function createServerHost2(kernel) {
@@ -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-eemt6sea.js";
14
14
  import {
15
15
  stepPluginApi2
16
- } from "./compose-q1b0tppc.js";
16
+ } from "./compose-0827b2k4.js";
17
17
 
18
18
  // src/extend/hooks.ts
19
19
  import { compile, JsonType, SdkError, SubmissionType, withJson } 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";
@@ -13,26 +13,32 @@ import {
13
13
  } from "./compose-bjx8s01m.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-mamr4qwf.js";
36
+ import {
37
+ hiddenOwners2
38
+ } from "./compose-bd8c5n7k.js";
33
39
  import {
34
40
  toolSource2
35
- } from "./compose-064y3n82.js";
41
+ } from "./compose-r1pxdxbw.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)
@@ -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-pnsvwd3m.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-gvrqkyn4.js";
34
34
  import {
35
35
  holdSummary2,
36
36
  summaryHeld2,
37
37
  summarizedMove2
38
- } from "./compose-p3q14yt1.js";
38
+ } from "./compose-g2a1f1yx.js";
39
39
  import {
40
40
  settleReceipt2,
41
41
  reserve2,
42
42
  known2,
43
43
  typedReceipt2
44
- } from "./compose-52afaf3v.js";
44
+ } from "./compose-prchdrqk.js";
45
45
 
46
46
  // src/engine/move.ts
47
47
  import { asId, SdkError } from "@nyte-ai/schema";
@@ -1,100 +1,105 @@
1
1
  import {
2
2
  CORE_CONTEXT2
3
- } from "./compose-mryw0674.js";
3
+ } from "./compose-5z835ej2.js";
4
4
  import {
5
5
  envelope2,
6
6
  decodeHostIdentity2
7
- } from "./compose-1jz2j92f.js";
7
+ } from "./compose-gxjc6vz9.js";
8
8
  import {
9
9
  kvRef2,
10
10
  hostIdentityRef2
11
- } from "./compose-kb22bkpt.js";
11
+ } from "./compose-cqpjcx2t.js";
12
12
  import {
13
13
  dev2
14
14
  } from "./compose-n116fnmp.js";
15
15
  import {
16
16
  readKv2
17
- } from "./compose-n10w4nkk.js";
17
+ } from "./compose-vn7b7fdj.js";
18
18
  import {
19
19
  createPartTable2
20
- } from "./compose-drdej9yt.js";
20
+ } from "./compose-c2rnebv0.js";
21
21
  import {
22
22
  EMPTY_CATALOG2
23
- } from "./compose-7k6nsmtq.js";
23
+ } from "./compose-6gt28900.js";
24
24
  import {
25
25
  createFoldCache2,
26
26
  createLogPublisher2,
27
27
  pollStore2
28
- } from "./compose-7b8ajk7a.js";
28
+ } from "./compose-rd5e5nxg.js";
29
29
  import {
30
30
  createModelState2
31
- } from "./compose-dbx6ftbm.js";
31
+ } from "./compose-csh5vv2t.js";
32
32
  import {
33
33
  createWaitRegistry2
34
- } from "./compose-ef936rsa.js";
34
+ } from "./compose-ks2rdteq.js";
35
35
  import {
36
36
  pluginSecrets2
37
- } from "./compose-q1b0tppc.js";
37
+ } from "./compose-0827b2k4.js";
38
38
  import {
39
39
  settingInfos2
40
- } from "./compose-b5xz0dj7.js";
40
+ } from "./compose-qwbe95qs.js";
41
41
  import {
42
42
  bumpGeneration2
43
- } from "./compose-064y3n82.js";
43
+ } from "./compose-r1pxdxbw.js";
44
44
  import {
45
45
  createModelsApi2,
46
- createConfigurationResolver2
47
- } from "./compose-r7dx7rpz.js";
46
+ createConfigurationResolver2,
47
+ rememberChoice2
48
+ } from "./compose-exfx5b4d.js";
48
49
  import {
49
50
  createRequest2
50
- } from "./compose-djq2bt61.js";
51
+ } from "./compose-ccrh32hd.js";
51
52
  import {
52
- createJobTable2
53
- } from "./compose-yn2et568.js";
53
+ createJobTable2,
54
+ jobHandle2
55
+ } from "./compose-y9c31w4e.js";
54
56
  import {
55
57
  createPageTable2
56
- } from "./compose-t53j8yxv.js";
58
+ } from "./compose-se7wwcq1.js";
57
59
  import {
58
60
  createEnvironmentRegistry2
59
- } from "./compose-0bpspysf.js";
61
+ } from "./compose-qknd62yj.js";
60
62
  import {
61
63
  dropScans2,
62
64
  resourcesPlugin2
63
- } from "./compose-y478gv6x.js";
65
+ } from "./compose-mamr4qwf.js";
64
66
  import {
65
67
  createCompactor2,
66
68
  createSummarizer2
67
- } from "./compose-r12cnkpc.js";
69
+ } from "./compose-hf6xkwdw.js";
68
70
  import {
69
71
  stoppableTool2
70
- } from "./compose-aa73dbe8.js";
72
+ } from "./compose-hms4hf6p.js";
71
73
  import {
72
74
  readMcpWorkspace2
73
- } from "./compose-1gd9vkye.js";
75
+ } from "./compose-v9yf9mrh.js";
74
76
  import {
75
77
  createTurnDriver2
76
- } from "./compose-k8aghhv2.js";
78
+ } from "./compose-5cmp34zp.js";
79
+ import {
80
+ openPresence2
81
+ } from "./compose-gvm49f4b.js";
77
82
  import {
78
83
  createWorkspaceState2,
79
84
  createWorkspaces2
80
- } from "./compose-eqr5qwp1.js";
85
+ } from "./compose-tb5ywdfk.js";
81
86
  import {
82
87
  sweepWorktrees2
83
- } from "./compose-s2aew2c9.js";
88
+ } from "./compose-gxvetm0j.js";
84
89
  import {
85
90
  stopStart2
86
- } from "./compose-dc2ns6gd.js";
91
+ } from "./compose-seyhq3fb.js";
87
92
  import {
88
93
  createExecutionState2,
89
94
  driveInProcess2,
90
95
  dispatchHead2
91
- } from "./compose-rpq9n0nz.js";
96
+ } from "./compose-xaegezm3.js";
92
97
  import {
93
98
  createConnectionRegistry2
94
- } from "./compose-5tkyrzr0.js";
99
+ } from "./compose-jhs91x01.js";
95
100
  import {
96
101
  createSettingsApi2
97
- } from "./compose-xd0kdp3t.js";
102
+ } from "./compose-jrqn6xhy.js";
98
103
  import {
99
104
  createPartDefinitions2
100
105
  } from "./compose-0rx7ygxq.js";
@@ -104,30 +109,30 @@ import {
104
109
  checkPlugins2,
105
110
  replacePlugins2,
106
111
  hostPluginRows2
107
- } from "./compose-gaps3heh.js";
112
+ } from "./compose-m1ecjzm2.js";
108
113
  import {
109
114
  createHostState2
110
115
  } from "./compose-xm52jghq.js";
111
116
  import {
112
117
  rerunAction2
113
- } from "./compose-wgphshsn.js";
118
+ } from "./compose-azq5jxr2.js";
114
119
  import {
115
120
  sessionHandle2,
116
121
  activationSession2
117
- } from "./compose-gg8b9b21.js";
122
+ } from "./compose-s5522cth.js";
118
123
  import {
119
124
  createConnection2,
120
125
  createHost2
121
- } from "./compose-7pc3p5ex.js";
126
+ } from "./compose-q1d09qpr.js";
122
127
  import {
123
128
  createServerHost2
124
- } from "./compose-j3tkz0tb.js";
129
+ } from "./compose-1g03zpvn.js";
125
130
  import {
126
131
  delegationPlugin2
127
132
  } from "./compose-n93897b0.js";
128
133
  import {
129
134
  environmentPlugin2
130
- } from "./compose-amr0k1m1.js";
135
+ } from "./compose-q1rrtq3a.js";
131
136
  import {
132
137
  mcpPlugin2
133
138
  } from "./compose-597de3tc.js";
@@ -149,6 +154,7 @@ var NO_MODELS = {
149
154
  usage: async () => unavailable("models"),
150
155
  refresh: async () => unavailable("models"),
151
156
  setDefault: async () => unavailable("models"),
157
+ setListing: async () => unavailable("models"),
152
158
  verify: async () => unavailable("models"),
153
159
  login: () => unavailable("models"),
154
160
  logout: async () => unavailable("models")
@@ -267,9 +273,13 @@ async function applySeed(kernel, seed) {
267
273
  }
268
274
  async function composeKernel(options, store) {
269
275
  const identity = await hostIdentity2(store);
276
+ const instance = crypto.randomUUID();
277
+ const presence = options.member === undefined ? null : await openPresence2(store, { instance, holder: identity.id, member: options.member });
270
278
  const kernel = createKernel2({
271
279
  hostId: identity.id,
272
- store,
280
+ instance,
281
+ presence,
282
+ store: presence?.store ?? store,
273
283
  description: options.description,
274
284
  host: createHostState2({
275
285
  catalog: asId(crypto.randomUUID()),
@@ -281,6 +291,7 @@ async function composeKernel(options, store) {
281
291
  models: options.models,
282
292
  mcp: options.mcp,
283
293
  github: options.github,
294
+ images: options.images,
284
295
  builtins: BUILTINS,
285
296
  hostPlugins: options.plugins,
286
297
  pluginSources: options.pluginSources,
@@ -290,6 +301,10 @@ async function composeKernel(options, store) {
290
301
  loadPlugins: options.loadPlugins
291
302
  });
292
303
  kernel.host.update({ plugins: hostPluginRows2(kernel) });
304
+ presence?.revoked.addEventListener("abort", () => {
305
+ kernel.executionState.closing.abort();
306
+ options.revoked?.();
307
+ }, { once: true });
293
308
  return kernel;
294
309
  }
295
310
  function createKernel2(input) {
@@ -318,7 +333,8 @@ function createKernel2(input) {
318
333
  let pages = null;
319
334
  const kernel = {
320
335
  hostId: input.hostId,
321
- instance: crypto.randomUUID(),
336
+ instance: input.instance ?? crypto.randomUUID(),
337
+ presence: input.presence ?? null,
322
338
  poll: input.poll ?? null,
323
339
  externalCommits: new Set,
324
340
  store: input.store,
@@ -358,6 +374,10 @@ function createKernel2(input) {
358
374
  get resolveConfiguration() {
359
375
  return resolveConfiguration ??= models === undefined ? async () => unavailable("resolveConfiguration") : createConfigurationResolver2(kernel, models);
360
376
  },
377
+ rememberChoice: async (choice, scope) => {
378
+ if (models !== undefined)
379
+ await rememberChoice2(kernel, models, choice, scope);
380
+ },
361
381
  get waits() {
362
382
  return waits ??= createWaitRegistry2(kernel, (session, call) => rerunAction2(kernel, session, call));
363
383
  },
@@ -382,6 +402,7 @@ function createKernel2(input) {
382
402
  connections: createConnectionRegistry2(),
383
403
  secrets: input.secrets ?? null,
384
404
  github: input.github ?? null,
405
+ images: input.images ?? null,
385
406
  get mcp() {
386
407
  if (mcp === undefined)
387
408
  mcp = input.mcp?.({ secrets: pluginSecrets2(kernel, "mcp") }) ?? null;
@@ -428,7 +449,9 @@ async function release(kernel, driver) {
428
449
  await driver?.close();
429
450
  const sessions = [...kernel.plugins.runtimes().keys()];
430
451
  const workspaces = (await kernel.store.refs.list("workspaces/")).map((ref) => asId(ref.name.slice("workspaces/".length)));
431
- await Promise.allSettled(workspaces.flatMap((workspace) => kernel.jobs.list(workspace).flatMap((job) => job.view.state.kind === "running" ? [job.process.stop()] : [])));
452
+ const running = workspaces.flatMap((workspace) => kernel.jobs.list(workspace).filter((job) => job.view.state.kind === "running"));
453
+ await Promise.allSettled(running.map((job) => job.process.stop()));
454
+ await Promise.allSettled(running.map((job) => jobHandle2(kernel, job.view.id).settled()));
432
455
  for (const session of sessions)
433
456
  await kernel.plugins.close(session);
434
457
  dropScans2(kernel);
@@ -436,6 +459,11 @@ async function release(kernel, driver) {
436
459
  await kernel.environments.detach(session);
437
460
  for (const workspace of workspaces)
438
461
  await kernel.environments.detachWorkspace(workspace);
462
+ const state = kernel.executionState;
463
+ await kernel.presence?.close([...state.undrained].flatMap((name) => {
464
+ const held = state.held.get(name);
465
+ return held === undefined ? [] : [{ name, expect: held.revision }];
466
+ }));
439
467
  }
440
468
  async function storedIdentity(store) {
441
469
  const ref = await store.refs.get(hostIdentityRef2());