@nyte-ai/core 0.0.25-beta.1 → 0.0.25-nightly.20261025.2

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 (116) hide show
  1. package/THIRD-PARTY-NOTICES.md +13 -5
  2. package/dist/chunks/{compose-17xxey5y.js → compose-0jtc3169.js} +37 -23
  3. package/dist/chunks/{compose-zajq79k0.js → compose-0rpfpwsp.js} +4 -4
  4. package/dist/chunks/{compose-9tntshv3.js → compose-16d6m2yk.js} +4 -4
  5. package/dist/chunks/{compose-75pnchkk.js → compose-1zcz79y0.js} +3 -3
  6. package/dist/chunks/{compose-kw3bf8mf.js → compose-2686emyc.js} +2 -2
  7. package/dist/chunks/{compose-7sjf0y70.js → compose-2k9gtwym.js} +1 -1
  8. package/dist/chunks/{compose-ht5fhzzw.js → compose-2zv4kak9.js} +10 -6
  9. package/dist/chunks/{compose-krkyrds4.js → compose-30wjb3f7.js} +8 -8
  10. package/dist/chunks/{compose-zx78edb2.js → compose-3fsmzem7.js} +2 -2
  11. package/dist/chunks/{compose-jawbhn7q.js → compose-6sf5hp8s.js} +79 -11
  12. package/dist/chunks/{compose-dywbt4he.js → compose-71gcpf17.js} +3 -3
  13. package/dist/chunks/{compose-b4zb2rpb.js → compose-9bdnm7rj.js} +11 -8
  14. package/dist/chunks/{compose-p7j0gt4t.js → compose-ae3zaa70.js} +49 -11
  15. package/dist/chunks/{compose-jbrtw0md.js → compose-c258nc2c.js} +3 -3
  16. package/dist/chunks/{compose-rh1d2g0s.js → compose-dp3h0fc0.js} +7 -7
  17. package/dist/chunks/{compose-ct1h40fd.js → compose-egbfgq9x.js} +5 -5
  18. package/dist/chunks/{compose-8nysak5a.js → compose-ek8qhasq.js} +10 -10
  19. package/dist/chunks/{compose-n5f6w2y6.js → compose-enaz2vzg.js} +11 -2
  20. package/dist/chunks/{compose-kf2k4hq5.js → compose-eyf1k580.js} +1 -1
  21. package/dist/chunks/{compose-5ygdrc65.js → compose-f5m11q9e.js} +2 -2
  22. package/dist/chunks/{compose-kgdmzx0n.js → compose-g3t6wvp4.js} +4 -4
  23. package/dist/chunks/{compose-pjkzf9ev.js → compose-hjssyk7n.js} +172 -11
  24. package/dist/chunks/{compose-s4kyfjj6.js → compose-hyv5s2ds.js} +1 -1
  25. package/dist/chunks/{compose-yd5t8qj3.js → compose-m24z174t.js} +11 -11
  26. package/dist/chunks/{compose-4s0c5zqv.js → compose-pmg34fjv.js} +2 -2
  27. package/dist/chunks/{compose-4jqwbez4.js → compose-pt48xw3f.js} +7 -7
  28. package/dist/chunks/{compose-vphbntyn.js → compose-qxn2kq6e.js} +10 -17
  29. package/dist/chunks/{compose-j8xmyfy6.js → compose-r2h4fwk1.js} +2 -2
  30. package/dist/chunks/{compose-zq7ar8qm.js → compose-r9q7jf4e.js} +7 -4
  31. package/dist/chunks/{compose-vxme67gg.js → compose-rdprm263.js} +2 -2
  32. package/dist/chunks/{compose-sjfbxw65.js → compose-sewnv4bq.js} +8 -7
  33. package/dist/chunks/{compose-sd0stm97.js → compose-sp6d0d37.js} +1 -13
  34. package/dist/chunks/compose-sr2wnvct.js +96 -0
  35. package/dist/chunks/{compose-8p6emvvh.js → compose-szzyh482.js} +4 -4
  36. package/dist/chunks/{compose-1nqjy2z5.js → compose-t76kg3y3.js} +2 -2
  37. package/dist/chunks/{compose-ztyjpn84.js → compose-tgca43vp.js} +1 -1
  38. package/dist/chunks/{compose-1kvvrw50.js → compose-vax85d5c.js} +1 -1
  39. package/dist/chunks/{compose-jrxg4vqg.js → compose-vyyb17zb.js} +1 -1
  40. package/dist/chunks/{compose-h0d0vess.js → compose-wvhedsv0.js} +2 -2
  41. package/dist/chunks/{compose-d95420jw.js → compose-wwf4z4kq.js} +4 -4
  42. package/dist/chunks/{compose-zt2qtrxj.js → compose-xb1js0ah.js} +2 -2
  43. package/dist/chunks/{compose-prek5sd9.js → compose-xf3fht3g.js} +1 -1
  44. package/dist/chunks/{compose-hx8j2kef.js → compose-xh3v0ppv.js} +2 -2
  45. package/dist/chunks/{compose-34cqydxc.js → compose-yvzt0tk5.js} +2 -2
  46. package/dist/chunks/{compose-gnfmty38.js → compose-ywhk6fhv.js} +6 -6
  47. package/dist/chunks/{compose-xdq54csy.js → compose-zehjryd3.js} +38 -37
  48. package/dist/chunks/{compose-hf0nrd46.js → compose-zg6mejam.js} +13 -13
  49. package/dist/src/agent/compaction.js +22 -22
  50. package/dist/src/agent/request.js +13 -13
  51. package/dist/src/agent/tool-runner.js +22 -15
  52. package/dist/src/agent/transcript.d.ts +7 -1
  53. package/dist/src/agent/transcript.js +21 -19
  54. package/dist/src/agent/turn.js +28 -28
  55. package/dist/src/api/connection.js +39 -38
  56. package/dist/src/api/head.js +25 -25
  57. package/dist/src/api/part.js +6 -6
  58. package/dist/src/api/server.js +30 -29
  59. package/dist/src/api/session.js +29 -30
  60. package/dist/src/builtins/environment.js +1 -1
  61. package/dist/src/builtins/mcp.d.ts +2 -2
  62. package/dist/src/builtins/mcp.js +1 -1
  63. package/dist/src/compose.js +49 -51
  64. package/dist/src/contract/plugin.d.ts +17 -0
  65. package/dist/src/contract/tools.d.ts +25 -3
  66. package/dist/src/contract/workspace.d.ts +15 -5
  67. package/dist/src/drive/execution.js +27 -26
  68. package/dist/src/engine/admission.js +8 -8
  69. package/dist/src/engine/batches.js +7 -7
  70. package/dist/src/engine/branch-summary.js +6 -6
  71. package/dist/src/engine/durable.js +5 -5
  72. package/dist/src/engine/fence.js +5 -5
  73. package/dist/src/engine/holds.js +9 -9
  74. package/dist/src/engine/jobs.d.ts +1 -1
  75. package/dist/src/engine/jobs.js +10 -10
  76. package/dist/src/engine/move.js +8 -8
  77. package/dist/src/engine/principals.js +4 -4
  78. package/dist/src/engine/receipts.js +6 -6
  79. package/dist/src/engine/runs.js +9 -9
  80. package/dist/src/engine/start.js +19 -19
  81. package/dist/src/engine/waits.js +4 -4
  82. package/dist/src/env/browser.js +11 -11
  83. package/dist/src/env/environment.js +13 -13
  84. package/dist/src/env/mcp.js +15 -15
  85. package/dist/src/env/trust.js +14 -14
  86. package/dist/src/env/workspaces.js +18 -17
  87. package/dist/src/env/worktrees.d.ts +4 -1
  88. package/dist/src/env/worktrees.js +24 -20
  89. package/dist/src/extend/activation.js +19 -18
  90. package/dist/src/extend/hooks.js +7 -7
  91. package/dist/src/extend/models.js +12 -12
  92. package/dist/src/extend/plugin-api.js +4 -4
  93. package/dist/src/extend/plugin-runtime.js +24 -24
  94. package/dist/src/extend/registry.js +11 -11
  95. package/dist/src/extend/resources.js +15 -15
  96. package/dist/src/extend/setting-layers.d.ts +1 -0
  97. package/dist/src/extend/setting-layers.js +3 -1
  98. package/dist/src/extend/settings.js +21 -21
  99. package/dist/src/extend/workspace-commands.js +25 -25
  100. package/dist/src/fold/commit.js +3 -3
  101. package/dist/src/fold/seen.js +4 -4
  102. package/dist/src/fold/watch.js +2 -2
  103. package/dist/src/harness.d.ts +1 -1
  104. package/dist/src/harness.js +50 -52
  105. package/dist/src/index.d.ts +2 -2
  106. package/dist/src/index.js +2 -2
  107. package/dist/src/server.js +46 -48
  108. package/dist/src/testing.js +48 -50
  109. package/dist/src/util/trace.d.ts +0 -4
  110. package/dist/src/util/trace.js +1 -5
  111. package/package.json +3 -3
  112. package/dist/chunks/compose-3qkhfwtd.js +0 -120
  113. package/dist/chunks/compose-597de3tc.js +0 -68
  114. package/dist/chunks/compose-zv0t13e7.js +0 -343
  115. package/dist/src/builtins/delegation.d.ts +0 -2
  116. package/dist/src/builtins/delegation.js +0 -10
@@ -55,6 +55,11 @@ SOFTWARE.
55
55
  `@earendil-works/pi-codemode` 1.0.0 supply the MCP client and QuickJS
56
56
  executor. Tool discovery and code-mode integration are adapted from commit
57
57
  `86dfceec402ad77e563bf4feab5f26c42d5f5db6`.
58
+ - BM25 tool search (`tool_search`, `searchTools()`), tool namespaces with
59
+ `describeNamespace()`, the budgeted codemode listing and the one-line MCP
60
+ server summary (`packages/plugin/src/tool-search.ts`,
61
+ `packages/plugin/src/codemode.ts`, `packages/core/src/builtins/mcp.ts`) are
62
+ ported from commit `d5b3de22d0e24a3e9c38a9410d3329b099717283`.
58
63
  - Transcript reconciliation, checkpoint instruction snapshots, provider system
59
64
  updates, and cache warming are ported from the 1.0.0 release commit
60
65
  `a13d35a742c6ef8462812a28fbe1d8c8b7431c32`.
@@ -312,11 +317,14 @@ Copyright 2025 OpenAI
312
317
  front of the queue (`packages/tui/src/model/interactions.ts`) is its
313
318
  `onEmptySubmit`. The rename
314
319
  plugin's context construction, prompt, model fallback, and output cleanup
315
- (`packages/plugin/src/rename.ts`) port OpenCode v2. The web-search
316
- plugin set (`packages/plugin/src/web-search.ts`) ports its Exa, Firecrawl,
317
- Parallel, and Tavily adapters, its stateless MCP `tools/call` transport and
318
- response bounds, its result and error vocabulary, and its arrangement of one
319
- plugin per provider from OpenCode v2.
320
+ (`packages/plugin/src/rename.ts`) port OpenCode v2. The web plugin
321
+ (`packages/plugin/src/web/`) ports OpenCode v2's web search and fetch tools:
322
+ the search provider registry any plugin can add to (`searchProviders` in
323
+ `packages/core/src/contract/plugin.ts`), its Exa, Firecrawl, Parallel, and
324
+ Tavily adapters, their stateless MCP `tools/call` transport and response
325
+ bounds, the result and error vocabulary, `web_fetch`'s Accept headers,
326
+ Cloudflare-challenge retry and size limits, and the streaming HTML-to-Markdown
327
+ and HTML-to-text converters (`packages/plugin/src/web/html-markdown.ts`).
320
328
  - Core's ripgrep resolver and search adapter (`packages/core/src/ripgrep.ts`,
321
329
  `packages/core/src/ripgrep/binary.ts`) and filename search
322
330
  (`packages/core/src/file-search.ts`) adapt OpenCode v2's core implementation.
@@ -20,24 +20,24 @@ import {
20
20
  import {
21
21
  followedTrace2,
22
22
  traceparent2
23
- } from "./compose-sd0stm97.js";
23
+ } from "./compose-sp6d0d37.js";
24
24
  import {
25
25
  commit2
26
- } from "./compose-s4kyfjj6.js";
26
+ } from "./compose-hyv5s2ds.js";
27
27
  import {
28
28
  closable2
29
29
  } from "./compose-zfjxkavf.js";
30
30
  import {
31
31
  readJob2,
32
32
  waitFor2
33
- } from "./compose-kf2k4hq5.js";
33
+ } from "./compose-eyf1k580.js";
34
34
  import {
35
35
  send2
36
- } from "./compose-sjfbxw65.js";
36
+ } from "./compose-sewnv4bq.js";
37
37
  import {
38
38
  recordAcquisition2,
39
39
  recordedAcquisition2
40
- } from "./compose-4s0c5zqv.js";
40
+ } from "./compose-pmg34fjv.js";
41
41
 
42
42
  // src/engine/jobs.ts
43
43
  import { asId, asSeq, foldJobChange, SdkError } from "@nyte-ai/schema";
@@ -81,6 +81,16 @@ function createJobTable2(kernel) {
81
81
  item
82
82
  });
83
83
  };
84
+ const update = (id, change) => {
85
+ const previous = entries.get(id);
86
+ if (previous === undefined)
87
+ return;
88
+ const next = { ...previous, view: change(previous.view) };
89
+ entries.set(id, next);
90
+ announce(next, previous);
91
+ if (previous.view.state.kind === "running" && next.view.state.kind !== "running")
92
+ forgetEnded(next.workspace);
93
+ };
84
94
  return {
85
95
  get: (id) => entries.get(id),
86
96
  byKey: (key) => [...entries.values()].find((entry) => entry.key === key),
@@ -98,16 +108,7 @@ function createJobTable2(kernel) {
98
108
  entries.set(entry.view.id, entry);
99
109
  announce(entry, null);
100
110
  },
101
- update(id, change) {
102
- const previous = entries.get(id);
103
- if (previous === undefined)
104
- return;
105
- const next = { ...previous, view: change(previous.view) };
106
- entries.set(id, next);
107
- announce(next, previous);
108
- if (previous.view.state.kind === "running" && next.view.state.kind !== "running")
109
- forgetEnded(next.workspace);
110
- },
111
+ update,
111
112
  subscribe(workspace, listener) {
112
113
  const known = listeners.get(workspace) ?? new Set;
113
114
  known.add(listener);
@@ -125,8 +126,14 @@ function createJobTable2(kernel) {
125
126
  release(session, call) {
126
127
  const started = [...entries.values()].filter((entry) => entry.owner?.session === session && entry.owner.startedBy === call && entry.view.state.kind === "running");
127
128
  for (const entry of started)
128
- entries.set(entry.view.id, { ...entry, held: false });
129
+ update(entry.view.id, (view) => ({ ...view, foreground: false }));
129
130
  return started.length > 0;
131
+ },
132
+ markStopping(id) {
133
+ const entry = entries.get(id);
134
+ if (entry === undefined)
135
+ return;
136
+ entries.set(id, { ...entry, stopping: true });
130
137
  }
131
138
  };
132
139
  }
@@ -256,6 +263,7 @@ function jobHandle2(kernel, id) {
256
263
  const state = entry.view.state;
257
264
  if (state.kind !== "running")
258
265
  return { kind: "settled", outcome: state };
266
+ kernel.jobs.markStopping(id);
259
267
  await entry.process.stop();
260
268
  return { kind: "settled", outcome: await settled() };
261
269
  },
@@ -278,11 +286,12 @@ async function endJob(kernel, id, end) {
278
286
  endedAt: Date.now(),
279
287
  tail: entry.output.tail()
280
288
  }));
281
- const held = kernel.jobs.get(id)?.held === true;
289
+ const ended = kernel.jobs.get(id);
290
+ const silent = ended !== undefined && (ended.view.foreground || ended.stopping);
282
291
  entry.output.end(end.kind === "exited" ? end.code : null);
283
292
  const consumed = await kernel.waits.jobEnded(id, end);
284
293
  const owner = entry.owner;
285
- if (consumed || owner === null || !recorded || held)
294
+ if (consumed || owner === null || !recorded || silent)
286
295
  return;
287
296
  await send2(kernel, {
288
297
  session: owner.session,
@@ -294,7 +303,7 @@ async function endJob(kernel, id, end) {
294
303
  return;
295
304
  });
296
305
  }
297
- async function startJob2(kernel, origin, workspace, input, hold = false) {
306
+ async function startJob2(kernel, origin, workspace, input, foreground = false) {
298
307
  const digest = JSON.stringify([
299
308
  input.command ?? null,
300
309
  input.session ?? null,
@@ -314,10 +323,14 @@ async function startJob2(kernel, origin, workspace, input, hold = false) {
314
323
  if (acquired.kind === "recorded")
315
324
  return held(asId(acquired.id));
316
325
  const id = acquired.value.id;
317
- await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, { id, digest, held: hold }));
326
+ await kernel.jobs.start(id, digest, () => spawn(kernel, origin, workspace, input, { id, digest, foreground }));
318
327
  return jobHandle2(kernel, id);
319
328
  }
320
- async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
329
+ async function spawn(kernel, origin, workspace, input, {
330
+ id,
331
+ digest,
332
+ foreground
333
+ }) {
321
334
  const on = async (session) => (await readSession2(kernel.store, session))?.record.workspace === workspace;
322
335
  if (input.session !== undefined && !await on(input.session))
323
336
  throw new SdkError("invalid", `Session ${input.session} is not on workspace ${workspace}.`);
@@ -377,7 +390,8 @@ async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
377
390
  state: { kind: "running" },
378
391
  startedAt: Date.now(),
379
392
  endedAt: null,
380
- tail: ""
393
+ tail: "",
394
+ foreground
381
395
  },
382
396
  workspace,
383
397
  key: input.pty === undefined ? null : asId(crypto.randomUUID()),
@@ -385,7 +399,7 @@ async function spawn(kernel, origin, workspace, input, { id, digest, held }) {
385
399
  owner,
386
400
  digest,
387
401
  output,
388
- held
402
+ stopping: false
389
403
  });
390
404
  pump(kernel, id, process, output);
391
405
  }
@@ -23,25 +23,25 @@ import {
23
23
  } from "./compose-ydth4n0z.js";
24
24
  import {
25
25
  commit2
26
- } from "./compose-s4kyfjj6.js";
26
+ } from "./compose-hyv5s2ds.js";
27
27
  import {
28
28
  withFold2
29
29
  } from "./compose-122g5jvb.js";
30
30
  import {
31
31
  fence2,
32
32
  finishFence2
33
- } from "./compose-kgdmzx0n.js";
33
+ } from "./compose-g3t6wvp4.js";
34
34
  import {
35
35
  holdSummary2,
36
36
  summaryHeld2,
37
37
  summarizedMove2
38
- } from "./compose-kw3bf8mf.js";
38
+ } from "./compose-2686emyc.js";
39
39
  import {
40
40
  settleReceipt2,
41
41
  reserve2,
42
42
  known2,
43
43
  typedReceipt2
44
- } from "./compose-dywbt4he.js";
44
+ } from "./compose-71gcpf17.js";
45
45
 
46
46
  // src/engine/move.ts
47
47
  import { asId, SdkError } from "@nyte-ai/schema";
@@ -9,20 +9,20 @@ import {
9
9
  } from "./compose-cqpjcx2t.js";
10
10
  import {
11
11
  publishSet2
12
- } from "./compose-1kvvrw50.js";
12
+ } from "./compose-vax85d5c.js";
13
13
  import {
14
14
  newRun2,
15
15
  begin2
16
- } from "./compose-d95420jw.js";
16
+ } from "./compose-wwf4z4kq.js";
17
17
  import {
18
18
  createHostState2
19
19
  } from "./compose-xm52jghq.js";
20
20
  import {
21
21
  createHost2
22
- } from "./compose-rh1d2g0s.js";
22
+ } from "./compose-dp3h0fc0.js";
23
23
  import {
24
24
  createKernel2
25
- } from "./compose-xdq54csy.js";
25
+ } from "./compose-zehjryd3.js";
26
26
  import {
27
27
  memoryStore2
28
28
  } from "./compose-pcfvksb2.js";
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  UnavailableError2,
7
7
  readWorkspace2
8
- } from "./compose-zt2qtrxj.js";
8
+ } from "./compose-xb1js0ah.js";
9
9
  import {
10
10
  projectTrust2
11
- } from "./compose-hx8j2kef.js";
11
+ } from "./compose-xh3v0ppv.js";
12
12
  import {
13
13
  settle2
14
- } from "./compose-pjkzf9ev.js";
14
+ } from "./compose-hjssyk7n.js";
15
15
 
16
16
  // src/extend/activation.ts
17
17
  import { SdkError } from "@nyte-ai/schema";
@@ -16,13 +16,13 @@ import {
16
16
  } from "./compose-ydth4n0z.js";
17
17
  import {
18
18
  commit2
19
- } from "./compose-s4kyfjj6.js";
19
+ } from "./compose-hyv5s2ds.js";
20
20
  import {
21
21
  withFold2
22
22
  } from "./compose-122g5jvb.js";
23
23
  import {
24
24
  fence2
25
- } from "./compose-kgdmzx0n.js";
25
+ } from "./compose-g3t6wvp4.js";
26
26
 
27
27
  // src/engine/branch-summary.ts
28
28
  import { asId } from "@nyte-ai/schema";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./compose-ydth4n0z.js";
12
12
  import {
13
13
  commit2
14
- } from "./compose-s4kyfjj6.js";
14
+ } from "./compose-hyv5s2ds.js";
15
15
 
16
16
  // src/engine/principals.ts
17
17
  import { asId, OPERATIONS, SdkError } from "@nyte-ai/schema";
@@ -40,25 +40,28 @@ import {
40
40
  } from "./compose-kwbs1f34.js";
41
41
  import {
42
42
  commit2
43
- } from "./compose-s4kyfjj6.js";
43
+ } from "./compose-hyv5s2ds.js";
44
44
  import {
45
45
  signalsPark2,
46
46
  parkStep2,
47
47
  runStep2
48
- } from "./compose-4s0c5zqv.js";
48
+ } from "./compose-pmg34fjv.js";
49
49
  import {
50
50
  startJob2
51
- } from "./compose-17xxey5y.js";
51
+ } from "./compose-0jtc3169.js";
52
52
  import {
53
53
  publishPatch2
54
- } from "./compose-d95420jw.js";
54
+ } from "./compose-wwf4z4kq.js";
55
55
  import {
56
56
  hiddenOwners2,
57
57
  missingCapabilities2
58
58
  } from "./compose-qyjchprv.js";
59
59
  import {
60
60
  toolSource2
61
- } from "./compose-zq7ar8qm.js";
61
+ } from "./compose-r9q7jf4e.js";
62
+ import {
63
+ loadedTools2
64
+ } from "./compose-ae3zaa70.js";
62
65
 
63
66
  // src/agent/tool-runner.ts
64
67
  import { Type } from "typebox";
@@ -613,7 +616,8 @@ function createInvocation2(kernel, input) {
613
616
  });
614
617
  return outcome.kind === "parked" ? parkStep2(durable) : outcome;
615
618
  },
616
- list: () => source.list().filter((info) => input.hidden?.has(info.owner) !== true)
619
+ list: () => source.list().filter((info) => input.hidden?.has(info.owner) !== true),
620
+ loaded: () => loadedTools2(kernel, source, { session, head, run })
617
621
  },
618
622
  wait: (target) => durable.wait(target),
619
623
  memo: (name, compute) => durable.memo(name, compute),
@@ -3,25 +3,25 @@ import {
3
3
  } from "./compose-cqpjcx2t.js";
4
4
  import {
5
5
  sendReceipt2
6
- } from "./compose-dywbt4he.js";
7
- import {
8
- move2
9
- } from "./compose-zajq79k0.js";
6
+ } from "./compose-71gcpf17.js";
10
7
  import {
11
8
  heldReceipt2,
12
9
  applyBatch2
13
- } from "./compose-jbrtw0md.js";
10
+ } from "./compose-c258nc2c.js";
11
+ import {
12
+ move2
13
+ } from "./compose-0rpfpwsp.js";
14
14
  import {
15
15
  driveInProcess2
16
- } from "./compose-8nysak5a.js";
16
+ } from "./compose-ek8qhasq.js";
17
17
  import {
18
18
  leaseHold2,
19
19
  releaseHold2
20
- } from "./compose-vxme67gg.js";
20
+ } from "./compose-rdprm263.js";
21
21
  import {
22
22
  redeemPairing2,
23
23
  authenticateToken2
24
- } from "./compose-7sjf0y70.js";
24
+ } from "./compose-2k9gtwym.js";
25
25
 
26
26
  // src/api/server.ts
27
27
  function createServerHost2(kernel) {
@@ -35,13 +35,13 @@ import {
35
35
  } from "./compose-kwbs1f34.js";
36
36
  import {
37
37
  commit2
38
- } from "./compose-s4kyfjj6.js";
38
+ } from "./compose-hyv5s2ds.js";
39
39
  import {
40
40
  runAction2,
41
41
  reserveRerun2,
42
42
  openAction2,
43
43
  recordAcquisition2
44
- } from "./compose-4s0c5zqv.js";
44
+ } from "./compose-pmg34fjv.js";
45
45
  import {
46
46
  RESERVED_PART_KINDS2
47
47
  } from "./compose-zaanjpb7.js";
@@ -38,8 +38,13 @@ var writeParameters = standard(Type.Object({
38
38
  var editParameters = standard(Type.Object({
39
39
  path: Type.String({ description: "The file to edit, relative to the workspace root." }),
40
40
  edits: Type.Array(Type.Object({
41
- oldText: Type.String({ description: "Text that occurs exactly once in the file." }),
42
- newText: Type.String({ description: "The text that replaces it." })
41
+ oldText: Type.String({
42
+ description: "Text in the file, copied from read without the line-number prefix."
43
+ }),
44
+ newText: Type.String({ description: "The text that replaces it." }),
45
+ replaceAll: Type.Optional(Type.Boolean({
46
+ description: "Replace every occurrence instead of requiring exactly one."
47
+ }))
43
48
  }), { minItems: 1 })
44
49
  }));
45
50
  var listParameters = standard(Type.Object({
@@ -109,7 +114,7 @@ var write = {
109
114
  };
110
115
  var edit = {
111
116
  name: "edit",
112
- description: "Edit a file in the workspace by exact replacement. Each oldText must match exactly one place in the file, and edits must not overlap.",
117
+ description: "Edit a file in the workspace by replacing text. Each oldText must match exactly one place in the file unless replaceAll is set, and edits must not overlap. Line endings follow the file. Without an exact match, the edit retries ignoring typographic quote, dash and space variants, then trailing whitespace on each line.",
113
118
  parameters: editParameters,
114
119
  output: PatchEntrySchema,
115
120
  class: (args) => ({ kind: "edit", path: args.path }),
@@ -120,14 +125,16 @@ var edit = {
120
125
  if (document.kind !== "text")
121
126
  throw new Error(`${args.path} is ${document.kind}, not a text file.`);
122
127
  const { contents } = document;
123
- const spans = args.edits.map((change, index) => {
124
- const starts = change.oldText === "" ? [] : Array.from(contents.matchAll(new RegExp(`(?=${RegExp.escape(change.oldText)})`, "g")), (match) => match.index);
125
- const [start] = starts;
126
- if (start === undefined)
127
- throw new Error(`Edit ${index + 1}: no match for oldText in ${args.path}.`);
128
- if (starts.length > 1)
129
- throw new Error(`Edit ${index + 1}: oldText occurs ${starts.length} times in ${args.path}; make it unique.`);
130
- return { start, end: start + change.oldText.length, newText: change.newText, index };
128
+ const crlf = /^[^\n]*\r\n/.test(contents);
129
+ const spans = args.edits.flatMap((change, index) => {
130
+ const matches = change.oldText === "" ? [] : findMatches(contents, change.oldText, crlf);
131
+ if (matches.length === 0)
132
+ throw new Error(`Edit ${index + 1}: no match for oldText in ${args.path}; read it again and copy the text exactly.`);
133
+ if (matches.length > 1 && change.replaceAll !== true)
134
+ throw new Error(`Edit ${index + 1}: oldText occurs ${matches.length} times in ${args.path}; add surrounding lines to make it unique, or set replaceAll.`);
135
+ const newText = crlf ? change.newText.replace(/\r?\n/g, `\r
136
+ `) : change.newText;
137
+ return separate(matches).map((match) => ({ ...match, newText, index }));
131
138
  });
132
139
  const ordered = [...spans].sort((left, right) => left.start - right.start);
133
140
  for (const [position, span] of ordered.entries()) {
@@ -377,6 +384,67 @@ var environmentPlugin2 = {
377
384
  });
378
385
  }
379
386
  };
387
+ function findMatches(contents, oldText, crlf) {
388
+ const searches = crlf ? [oldText, oldText.replace(/\r?\n/g, `\r
389
+ `)] : [oldText];
390
+ const tiers = [
391
+ () => searches.map((search) => occurrences(contents, search)),
392
+ () => {
393
+ const folded = foldTypography(contents);
394
+ return searches.map((search) => occurrences(folded, foldTypography(search)));
395
+ },
396
+ () => [lineOccurrences(contents, oldText)]
397
+ ];
398
+ for (const tier of tiers) {
399
+ const found = tier().find((matches) => matches.length > 0);
400
+ if (found !== undefined)
401
+ return found;
402
+ }
403
+ return [];
404
+ }
405
+ function occurrences(contents, search) {
406
+ return Array.from(contents.matchAll(new RegExp(`(?=${RegExp.escape(search)})`, "g")), (match) => ({
407
+ start: match.index,
408
+ end: match.index + search.length
409
+ }));
410
+ }
411
+ function foldTypography(value) {
412
+ return value.replace(/[\u2018\u2019\u201A\u201B]/g, "'").replace(/[\u201C\u201D\u201E\u201F]/g, '"').replace(/[\u2010-\u2015\u2212]/g, "-").replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g, " ");
413
+ }
414
+ function lineOccurrences(contents, search) {
415
+ const expected = search.split(/\r?\n/);
416
+ const throughNewline = expected.at(-1) === "";
417
+ if (throughNewline)
418
+ expected.pop();
419
+ if (expected.length === 0)
420
+ return [];
421
+ const key = (line) => foldTypography(line.trimEnd());
422
+ const wanted = expected.map(key);
423
+ const lines = Array.from(contents.matchAll(/([^\n]*?)(\r?\n|$)/g), (match) => ({
424
+ key: key(match[1] ?? ""),
425
+ start: match.index,
426
+ contentEnd: match.index + (match[1] ?? "").length,
427
+ end: match.index + match[0].length,
428
+ newline: (match[2] ?? "") !== ""
429
+ }));
430
+ return lines.flatMap((line, index) => {
431
+ const last = lines[index + wanted.length - 1];
432
+ if (last === undefined || throughNewline && !last.newline)
433
+ return [];
434
+ if (wanted.some((want, offset) => lines[index + offset]?.key !== want))
435
+ return [];
436
+ return [{ start: line.start, end: throughNewline ? last.end : last.contentEnd }];
437
+ });
438
+ }
439
+ function separate(matches) {
440
+ let end = 0;
441
+ return matches.filter((match) => {
442
+ if (match.start < end)
443
+ return false;
444
+ end = match.end;
445
+ return true;
446
+ });
447
+ }
380
448
  function text(value) {
381
449
  return { content: [{ kind: "text", text: value }] };
382
450
  }
@@ -16,16 +16,16 @@ import {
16
16
  } from "./compose-ydth4n0z.js";
17
17
  import {
18
18
  commit2
19
- } from "./compose-s4kyfjj6.js";
19
+ } from "./compose-hyv5s2ds.js";
20
20
  import {
21
21
  withFold2
22
22
  } from "./compose-122g5jvb.js";
23
23
  import {
24
24
  waitFor2
25
- } from "./compose-kf2k4hq5.js";
25
+ } from "./compose-eyf1k580.js";
26
26
  import {
27
27
  stopRun2
28
- } from "./compose-kgdmzx0n.js";
28
+ } from "./compose-g3t6wvp4.js";
29
29
 
30
30
  // src/engine/receipts.ts
31
31
  import { asId, SdkError } from "@nyte-ai/schema";
@@ -20,28 +20,28 @@ import {
20
20
  } from "./compose-ry29956g.js";
21
21
  import {
22
22
  scanResources2
23
- } from "./compose-j8xmyfy6.js";
23
+ } from "./compose-r2h4fwk1.js";
24
24
  import {
25
25
  activateSession2,
26
26
  loadPlugins2
27
- } from "./compose-75pnchkk.js";
27
+ } from "./compose-1zcz79y0.js";
28
28
  import {
29
29
  corePluginApi2,
30
30
  build2
31
- } from "./compose-prek5sd9.js";
31
+ } from "./compose-xf3fht3g.js";
32
32
  import {
33
33
  createHookDispatch2,
34
34
  namesCoreHook2
35
- } from "./compose-1nqjy2z5.js";
35
+ } from "./compose-t76kg3y3.js";
36
36
  import {
37
37
  createRegistrySet2,
38
38
  publishCatalog2,
39
39
  bumpGeneration2
40
- } from "./compose-zq7ar8qm.js";
40
+ } from "./compose-r9q7jf4e.js";
41
41
  import {
42
42
  settingHandle2,
43
43
  publishSettings2
44
- } from "./compose-vphbntyn.js";
44
+ } from "./compose-qxn2kq6e.js";
45
45
 
46
46
  // src/extend/plugin-runtime.ts
47
47
  import { SdkError } from "@nyte-ai/schema";
@@ -50,8 +50,8 @@ var BUILT_IN = new Set([
50
50
  "system-prompt",
51
51
  "environment",
52
52
  "resources",
53
- "delegation",
54
- "interruptions"
53
+ "interruptions",
54
+ "worktrees"
55
55
  ]);
56
56
  var RESERVED_IDS = ["models", "settings"];
57
57
  var ACTIVATE_SECONDS = 30;
@@ -566,6 +566,8 @@ function install(plugin, api) {
566
566
  contribute.modelContext.add(item);
567
567
  for (const item of declared?.skills ?? [])
568
568
  contribute.skills.add(item);
569
+ for (const item of declared?.searchProviders ?? [])
570
+ contribute.searchProviders.add(item);
569
571
  for (const item of declared?.parts ?? [])
570
572
  contribute.parts.add(item);
571
573
  for (const item of declared?.commands ?? [])
@@ -656,6 +658,7 @@ function createInstance(kernel, input) {
656
658
  agents: contribution((registries) => registries.agents),
657
659
  modelContext: contribution((registries) => registries.modelContext),
658
660
  skills: contribution((registries) => registries.skills),
661
+ searchProviders: contribution((registries) => registries.searchProviders),
659
662
  parts: contribution((registries) => registries.parts),
660
663
  commands: contribution((registries) => registries.commands),
661
664
  settings: {