@nyte-ai/plugin 0.0.25-beta.1 → 0.0.25-nightly.20261101.40

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 (88) hide show
  1. package/THIRD-PARTY-NOTICES.md +49 -32
  2. package/dist/chunks/bash-description-0ah30s12.js +33 -0
  3. package/dist/chunks/bash-description-4h0hnsv4.js +68 -0
  4. package/dist/chunks/{bash-description-dnvgk30y.js → bash-description-4rfavmha.js} +32 -1
  5. package/dist/chunks/bash-description-5dpf5hpt.js +724 -0
  6. package/dist/chunks/{bash-description-yyd9jznf.js → bash-description-94km1hm2.js} +1 -1
  7. package/dist/chunks/{bash-description-svrhh5a5.js → bash-description-99k8z2r7.js} +3 -2
  8. package/dist/chunks/bash-description-9gw9ets8.js +162 -0
  9. package/dist/chunks/{bash-description-h13r0byk.js → bash-description-axnga0jz.js} +3 -3
  10. package/dist/chunks/bash-description-b78pre8c.js +147 -0
  11. package/dist/chunks/{bash-description-ye3wk5r3.js → bash-description-bas41ptb.js} +6 -24
  12. package/dist/chunks/{bash-description-2v3g7rd9.js → bash-description-bj5yh7tr.js} +26 -64
  13. package/dist/chunks/{bash-description-6z2kgtyt.js → bash-description-bkhr9zrz.js} +4 -4
  14. package/dist/chunks/{bash-description-hg64tqf1.js → bash-description-f754ge33.js} +49 -3
  15. package/dist/chunks/{bash-description-zz15raxk.js → bash-description-ff18794t.js} +1 -1
  16. package/dist/chunks/{bash-description-wmcbg6fw.js → bash-description-g7gfy7nw.js} +1 -1
  17. package/dist/chunks/{bash-description-1neewp76.js → bash-description-hp4rb8k4.js} +4 -3
  18. package/dist/chunks/bash-description-myvnmtt2.js +125 -0
  19. package/dist/chunks/{bash-description-9nn3yp18.js → bash-description-q2v8wbn8.js} +9 -1
  20. package/dist/chunks/bash-description-qwyy182r.js +452 -0
  21. package/dist/chunks/bash-description-rxpx004v.js +295 -0
  22. package/dist/chunks/{bash-description-eqp7ap2w.js → bash-description-z1581a29.js} +23 -9
  23. package/dist/src/acp/connection.d.ts +3 -1
  24. package/dist/src/acp/connection.js +3 -3
  25. package/dist/src/acp/index.d.ts +7 -4
  26. package/dist/src/acp/index.js +41 -8
  27. package/dist/src/acp/registry.d.ts +9 -0
  28. package/dist/src/acp/registry.js +5 -3
  29. package/dist/src/acp/thread.js +2 -2
  30. package/dist/src/acp/transcript.js +2 -2
  31. package/dist/src/acp/translate.d.ts +10 -2
  32. package/dist/src/acp/translate.js +3 -1
  33. package/dist/src/approvals/approvals.d.ts +1 -1
  34. package/dist/src/approvals/approvals.js +2 -2
  35. package/dist/src/approvals/schema.d.ts +3 -3
  36. package/dist/src/approvals/schema.js +1 -1
  37. package/dist/src/browser-tools.js +8 -2
  38. package/dist/src/canvas/canvas-compile.js +2 -2
  39. package/dist/src/canvas/canvas-preview.js +2 -2
  40. package/dist/src/canvas/canvas-protocol.d.ts +46 -0
  41. package/dist/src/canvas/canvas-protocol.js +11 -1
  42. package/dist/src/canvas/canvas.d.ts +17 -3
  43. package/dist/src/canvas/canvas.js +75 -31
  44. package/dist/src/canvas/schema.d.ts +28 -7
  45. package/dist/src/canvas/schema.js +2 -2
  46. package/dist/src/claude-code-sdk/index.d.ts +0 -10
  47. package/dist/src/claude-code-sdk/index.js +19 -179
  48. package/dist/src/claude-code-sdk/session.d.ts +22 -23
  49. package/dist/src/claude-code-sdk/session.js +6 -3
  50. package/dist/src/claude-code-sdk/transcript.d.ts +0 -6
  51. package/dist/src/claude-code-sdk/transcript.js +2 -4
  52. package/dist/src/claude-code-sdk/translate.d.ts +1 -5
  53. package/dist/src/claude-code-sdk/translate.js +2 -8
  54. package/dist/src/client/mount.d.ts +4 -2
  55. package/dist/src/client/mount.js +3 -0
  56. package/dist/src/client/notifications.d.ts +12 -4
  57. package/dist/src/client/notifications.js +25 -10
  58. package/dist/src/client/presentation.d.ts +138 -8
  59. package/dist/src/client/presentation.js +86 -371
  60. package/dist/src/codemode.js +151 -46
  61. package/dist/src/core.d.ts +1 -1
  62. package/dist/src/question/client/questions-tui.js +3 -3
  63. package/dist/src/question/client/questions.js +3 -3
  64. package/dist/src/question/question.js +84 -5
  65. package/dist/src/question/schema.js +3 -3
  66. package/dist/src/rename.d.ts +7 -35
  67. package/dist/src/rename.js +115 -48
  68. package/dist/src/subagents.d.ts +30 -0
  69. package/dist/src/subagents.js +323 -0
  70. package/dist/src/tool-search.d.ts +49 -0
  71. package/dist/src/tool-search.js +14 -0
  72. package/dist/src/web/body.d.ts +3 -0
  73. package/dist/src/web/body.js +6 -0
  74. package/dist/src/web/fetch.d.ts +16 -0
  75. package/dist/src/web/fetch.js +8 -0
  76. package/dist/src/web/html-markdown.d.ts +9 -0
  77. package/dist/src/web/html-markdown.js +10 -0
  78. package/dist/src/web/index.d.ts +24 -0
  79. package/dist/src/web/index.js +93 -0
  80. package/dist/src/web/providers.d.ts +60 -0
  81. package/dist/src/web/providers.js +11 -0
  82. package/dist/src/web/search.d.ts +21 -0
  83. package/dist/src/web/search.js +6 -0
  84. package/package.json +16 -7
  85. package/dist/chunks/bash-description-3j77ss7y.js +0 -86
  86. package/dist/chunks/bash-description-wbe8w0te.js +0 -530
  87. package/dist/src/web-search.d.ts +0 -78
  88. package/dist/src/web-search.js +0 -219
@@ -0,0 +1,295 @@
1
+ import {
2
+ NYTE_SERVER2,
3
+ NYTE_TOOL_PREFIX2,
4
+ emptyMessage3,
5
+ Translator3
6
+ } from "./bash-description-bas41ptb.js";
7
+ import {
8
+ messageKey3
9
+ } from "./bash-description-bj5yh7tr.js";
10
+
11
+ // src/claude-code-sdk/session.ts
12
+ import { createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
13
+ import { createAssistantMessageEventStream } from "@nyte-ai/ai";
14
+ import { Type } from "typebox";
15
+ import { Value } from "typebox/value";
16
+ var toolUseId = Type.String({ minLength: 1 });
17
+ var ISOLATION_ENV = {
18
+ CLAUDE_CODE_DISABLE_CLAUDE_MDS: "1",
19
+ CLAUDE_CODE_DISABLE_AUTO_MEMORY: "1",
20
+ DISABLE_AUTO_COMPACT: "1",
21
+ CLAUDE_CODE_ENABLE_AWAY_SUMMARY: "0",
22
+ ENABLE_TOOL_SEARCH: "false",
23
+ CLAUDE_CODE_DISABLE_ADVISOR_TOOL: "1",
24
+ MAX_MCP_OUTPUT_TOKENS: "200000",
25
+ CLAUDE_CODE_SIMPLE: undefined,
26
+ CLAUDE_CODE_EFFORT_LEVEL: undefined,
27
+ MCP_TOOL_TIMEOUT: undefined
28
+ };
29
+ function isolatedOptions2(claude, env) {
30
+ return {
31
+ pathToClaudeCodeExecutable: claude,
32
+ env: { ...process.env, ...env, CLAUDE_AGENT_SDK_CLIENT_APP: "nyte", ...ISOLATION_ENV },
33
+ tools: [],
34
+ settingSources: [],
35
+ settings: { disableAllHooks: true },
36
+ strictMcpConfig: true,
37
+ skills: [],
38
+ permissionMode: "dontAsk",
39
+ verbatimPrompts: true
40
+ };
41
+ }
42
+
43
+ class Inbox {
44
+ #items = [];
45
+ #waiter;
46
+ #ended = false;
47
+ push(item) {
48
+ this.#items.push(item);
49
+ this.#wake();
50
+ }
51
+ clear() {
52
+ this.#items.length = 0;
53
+ }
54
+ end() {
55
+ this.#ended = true;
56
+ this.#wake();
57
+ }
58
+ async next() {
59
+ while (this.#items.length === 0 && !this.#ended)
60
+ await new Promise((resolve) => this.#waiter = resolve);
61
+ return this.#items.shift();
62
+ }
63
+ async* [Symbol.asyncIterator]() {
64
+ for (;; ) {
65
+ const item = await this.next();
66
+ if (item === undefined)
67
+ return;
68
+ yield item;
69
+ }
70
+ }
71
+ #wake() {
72
+ const waiter = this.#waiter;
73
+ this.#waiter = undefined;
74
+ waiter?.();
75
+ }
76
+ }
77
+ function toolError(text) {
78
+ return { content: [{ type: "text", text }], isError: true };
79
+ }
80
+ function reply(message) {
81
+ return {
82
+ content: message.content.map((block) => block.type === "text" ? { type: "text", text: block.text } : { type: "image", data: block.data, mimeType: block.mimeType }),
83
+ isError: message.isError
84
+ };
85
+ }
86
+ function storePath(key) {
87
+ return key.subpath === undefined ? key.sessionId : `${key.sessionId}/${key.subpath}`;
88
+ }
89
+ function memoryStore(session, history) {
90
+ const files = new Map([[session, [...history]]]);
91
+ return {
92
+ append: async (key, entries) => {
93
+ files.set(storePath(key), [...files.get(storePath(key)) ?? [], ...entries]);
94
+ },
95
+ load: async (key) => files.get(storePath(key)) ?? null
96
+ };
97
+ }
98
+
99
+ class ClaudeCodeSession2 {
100
+ #key;
101
+ #known = [];
102
+ #prompts = new Inbox;
103
+ #turn = new Inbox;
104
+ #replies = new Map;
105
+ #server;
106
+ #query;
107
+ #tools;
108
+ #effort;
109
+ #idle = true;
110
+ #stderr = "";
111
+ #failure;
112
+ constructor(launch) {
113
+ this.#key = launch.key;
114
+ this.#effort = launch.effort;
115
+ this.#tools = launch.tools;
116
+ this.#server = createSdkMcpServer({ name: NYTE_SERVER2, tools: [] });
117
+ this.#server.instance.server.registerCapabilities({ tools: { listChanged: true } });
118
+ this.#server.instance.server.fallbackRequestHandler = async (request, extra) => {
119
+ if (request.method === "tools/list")
120
+ return {
121
+ tools: this.#tools.map((tool) => ({
122
+ name: tool.name,
123
+ description: tool.description,
124
+ inputSchema: { ...tool.parameters, type: "object" }
125
+ }))
126
+ };
127
+ if (request.method !== "tools/call")
128
+ throw new Error(`Nyte does not serve ${request.method}.`);
129
+ const { _meta: meta } = extra;
130
+ const id = meta?.["claudecode/toolUseId"];
131
+ return Value.Check(toolUseId, id) ? await this.#call(id, extra.signal) : toolError("Claude Code sent no tool use id for this Nyte tool call.");
132
+ };
133
+ const options = {
134
+ ...isolatedOptions2(launch.claude, launch.env),
135
+ model: launch.model,
136
+ cwd: launch.cwd,
137
+ systemPrompt: { type: "custom", prompt: launch.system },
138
+ includePartialMessages: true,
139
+ mcpServers: { [NYTE_SERVER2]: this.#server },
140
+ allowedTools: [`${NYTE_TOOL_PREFIX2}*`],
141
+ thinking: launch.thinking ? { type: "adaptive", display: "summarized" } : { type: "disabled" },
142
+ stderr: (chunk) => this.#stderr = (this.#stderr + chunk).slice(-4096)
143
+ };
144
+ if (launch.effort !== undefined)
145
+ options.effort = launch.effort;
146
+ if (launch.history.length > 0) {
147
+ options.resume = launch.session;
148
+ options.sessionStore = memoryStore(launch.session, launch.history);
149
+ }
150
+ this.#query = launch.query({ prompt: this.#prompts, options });
151
+ this.#pump();
152
+ }
153
+ get closed() {
154
+ return this.#failure !== undefined;
155
+ }
156
+ follows(key, keys) {
157
+ return !this.closed && this.#key === key && this.#known.length < keys.length && this.#known.every((known, index) => keys[index] === known);
158
+ }
159
+ async configure(effort) {
160
+ if (this.#effort === effort)
161
+ return;
162
+ this.#effort = effort;
163
+ await this.#query.applyFlagSettings({ effortLevel: effort ?? null });
164
+ }
165
+ expose(tools) {
166
+ if (JSON.stringify(tools) === JSON.stringify(this.#tools))
167
+ return;
168
+ this.#tools = tools;
169
+ this.#server.instance.sendToolListChanged();
170
+ }
171
+ deliver(messages) {
172
+ for (const message of messages)
173
+ if (message.role === "toolResult")
174
+ this.#replies.get(message.toolCallId)?.resolve(reply(message));
175
+ }
176
+ send(content) {
177
+ if (this.#idle)
178
+ this.#turn.clear();
179
+ this.#idle = false;
180
+ this.#prompts.push({
181
+ type: "user",
182
+ message: { role: "user", content: [...content] },
183
+ parent_tool_use_id: null,
184
+ origin: { kind: "human" }
185
+ });
186
+ }
187
+ respond(model, keys, signal) {
188
+ const stream = createAssistantMessageEventStream();
189
+ const output = emptyMessage3(model);
190
+ const translator = new Translator3(model, output, stream);
191
+ const abort = () => this.close(new Error("Request was aborted"));
192
+ signal?.addEventListener("abort", abort, { once: true });
193
+ (async () => {
194
+ try {
195
+ stream.push({ type: "start", partial: output });
196
+ let failure;
197
+ for (;; ) {
198
+ const item = await this.#turn.next();
199
+ if (item === undefined)
200
+ throw this.#failure ?? new Error("Claude Code exited.");
201
+ if (item.type === "assistant") {
202
+ if (item.error !== undefined)
203
+ failure = item.message.content.flatMap((block) => block.type === "text" ? [block.text] : []).join(`
204
+ `);
205
+ continue;
206
+ }
207
+ if (item.type === "result") {
208
+ if (item.subtype !== "success")
209
+ throw new Error(failure ?? (item.errors.join(`
210
+ `) || `Claude Code failed: ${item.subtype}`));
211
+ if (item.is_error)
212
+ throw new Error(failure ?? item.result);
213
+ this.#idle = true;
214
+ if (output.stopReason === "pending")
215
+ output.stopReason = "stop";
216
+ break;
217
+ }
218
+ if (translator.apply(item.event) === "tool_use" && output.content.some((block) => block.type === "toolCall"))
219
+ break;
220
+ }
221
+ if (output.stopReason === "error")
222
+ throw new Error(output.errorMessage ?? "Claude Code failed.");
223
+ if (output.stopReason === "aborted" || output.stopReason === "pending")
224
+ throw new Error("Claude Code ended without a response.");
225
+ this.#known = [...keys, messageKey3(output)];
226
+ stream.push({ type: "done", reason: output.stopReason, message: output });
227
+ } catch (error) {
228
+ output.stopReason = signal?.aborted === true ? "aborted" : "error";
229
+ output.errorMessage = error instanceof Error ? error.message : String(error);
230
+ stream.push({ type: "error", reason: output.stopReason, error: output });
231
+ this.close(error instanceof Error ? error : new Error(String(error)));
232
+ } finally {
233
+ signal?.removeEventListener("abort", abort);
234
+ stream.end();
235
+ }
236
+ })();
237
+ return stream;
238
+ }
239
+ close(reason = new Error("Claude Code closed.")) {
240
+ if (this.#failure !== undefined)
241
+ return;
242
+ this.#failure = reason;
243
+ for (const pending of this.#replies.values())
244
+ pending.resolve(toolError(reason.message));
245
+ this.#prompts.end();
246
+ this.#turn.end();
247
+ this.#query.close();
248
+ }
249
+ #reply(id) {
250
+ const known = this.#replies.get(id);
251
+ if (known !== undefined)
252
+ return known;
253
+ const created = Promise.withResolvers();
254
+ this.#replies.set(id, created);
255
+ return created;
256
+ }
257
+ async#call(id, signal) {
258
+ const pending = this.#reply(id);
259
+ const cancel = () => pending.resolve(toolError("Request was aborted"));
260
+ signal.addEventListener("abort", cancel, { once: true });
261
+ try {
262
+ return await pending.promise;
263
+ } finally {
264
+ this.#replies.delete(id);
265
+ signal.removeEventListener("abort", cancel);
266
+ }
267
+ }
268
+ async#pump() {
269
+ try {
270
+ for await (const message of this.#query)
271
+ this.#route(message);
272
+ this.close(new Error(`Claude Code exited.${this.#detail()}`));
273
+ } catch (error) {
274
+ const message = error instanceof Error ? error.message : String(error);
275
+ this.close(new Error(`${message}${this.#detail()}`, { cause: error }));
276
+ }
277
+ }
278
+ #detail() {
279
+ const tail = this.#stderr.trim().slice(-500);
280
+ return tail === "" ? "" : ` (${tail})`;
281
+ }
282
+ #route(message) {
283
+ if (message.type === "result") {
284
+ this.#turn.push(message);
285
+ return;
286
+ }
287
+ if (message.type !== "stream_event" && message.type !== "assistant" || message.parent_tool_use_id !== null)
288
+ return;
289
+ if (message.type === "stream_event" && message.event.type === "content_block_start" && message.event.content_block.type === "tool_use" && message.event.content_block.name.startsWith(NYTE_TOOL_PREFIX2))
290
+ this.#reply(message.event.content_block.id);
291
+ this.#turn.push(message);
292
+ }
293
+ }
294
+
295
+ export { isolatedOptions2, ClaudeCodeSession2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AcpThread2
3
- } from "./bash-description-svrhh5a5.js";
3
+ } from "./bash-description-99k8z2r7.js";
4
4
 
5
5
  // src/acp/connection.ts
6
6
  import { randomUUID } from "node:crypto";
@@ -15,7 +15,7 @@ import { processEnvironment } from "@nyte-ai/core";
15
15
  // package.json
16
16
  var package_default = {
17
17
  name: "@nyte-ai/plugin",
18
- version: "0.0.25-beta.1",
18
+ version: "0.0.25-nightly.20261101.40",
19
19
  private: false,
20
20
  license: "MIT",
21
21
  repository: {
@@ -46,8 +46,10 @@ var package_default = {
46
46
  "./core/openai-compaction": "./src/openai-compaction.ts",
47
47
  "./core/question": "./src/question/question.ts",
48
48
  "./core/rename": "./src/rename.ts",
49
+ "./core/subagents": "./src/subagents.ts",
49
50
  "./core/telemetry": "./src/telemetry.ts",
50
- "./core/web-search": "./src/web-search.ts",
51
+ "./core/tool-search": "./src/tool-search.ts",
52
+ "./core/web": "./src/web/index.ts",
51
53
  "./client": "./src/client.ts",
52
54
  "./client/mount": "./src/client/mount.ts",
53
55
  "./client/notifications": "./src/client/notifications.ts",
@@ -127,13 +129,21 @@ var package_default = {
127
129
  types: "./dist/src/rename.d.ts",
128
130
  import: "./dist/src/rename.js"
129
131
  },
132
+ "./core/subagents": {
133
+ types: "./dist/src/subagents.d.ts",
134
+ import: "./dist/src/subagents.js"
135
+ },
130
136
  "./core/telemetry": {
131
137
  types: "./dist/src/telemetry.d.ts",
132
138
  import: "./dist/src/telemetry.js"
133
139
  },
134
- "./core/web-search": {
135
- types: "./dist/src/web-search.d.ts",
136
- import: "./dist/src/web-search.js"
140
+ "./core/tool-search": {
141
+ types: "./dist/src/tool-search.d.ts",
142
+ import: "./dist/src/tool-search.js"
143
+ },
144
+ "./core/web": {
145
+ types: "./dist/src/web/index.d.ts",
146
+ import: "./dist/src/web/index.js"
137
147
  },
138
148
  "./client": {
139
149
  types: "./dist/src/client.d.ts",
@@ -206,6 +216,7 @@ var package_default = {
206
216
  "@opentelemetry/sdk-trace": "^3.0.0",
207
217
  "@opentelemetry/semantic-conventions": "^1.43.0",
208
218
  "es-module-lexer": "^3.0.4",
219
+ htmlparser2: "^8.0.2",
209
220
  sucrase: "^3.35.1",
210
221
  typebox: "^1.4.2",
211
222
  zod: "^4.6.7"
@@ -283,9 +294,7 @@ class AcpProcess2 {
283
294
  clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
284
295
  clientInfo: { name: "nyte", title: "Nyte", version: package_default.version }
285
296
  });
286
- this.#ready.catch(() => {
287
- return;
288
- });
297
+ this.#ready.catch((error) => this.close(error instanceof Error ? error : new Error(String(error))));
289
298
  }
290
299
  static async start(env, agent) {
291
300
  await processEnvironment();
@@ -316,6 +325,11 @@ class AcpProcess2 {
316
325
  });
317
326
  throw error;
318
327
  }
328
+ if (this.agent.mode !== undefined)
329
+ await this.#connection.agent.request(methods.agent.session.setMode, {
330
+ sessionId,
331
+ modeId: this.agent.mode
332
+ });
319
333
  const thread = new AcpThread2(`acp-${randomUUID().slice(0, 8)}-`, {
320
334
  cwd,
321
335
  approve,
@@ -5,7 +5,9 @@ import type { AcpApprove } from "./thread.ts";
5
5
  /**
6
6
  * One agent process, started in a session's environment so the host's
7
7
  * environment, sandbox and login-shell gate apply to it, and the ACP
8
- * connection over its stdio. Each `open` starts an ACP session on it.
8
+ * connection over its stdio. Each `open` starts an ACP session on it. A
9
+ * failed `initialize` closes it: an agent that refuses it (fx before
10
+ * `fx login`) stays up and keeps refusing, so the next turn needs a new one.
9
11
  */
10
12
  export declare class AcpProcess {
11
13
  #private;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  AcpProcess2
3
- } from "../../chunks/bash-description-eqp7ap2w.js";
4
- import"../../chunks/bash-description-svrhh5a5.js";
5
- import"../../chunks/bash-description-9nn3yp18.js";
3
+ } from "../../chunks/bash-description-z1581a29.js";
4
+ import"../../chunks/bash-description-99k8z2r7.js";
5
+ import"../../chunks/bash-description-q2v8wbn8.js";
6
6
  export {
7
7
  AcpProcess2 as AcpProcess
8
8
  };
@@ -12,13 +12,16 @@ export type { AcpAgent } from "./registry.ts";
12
12
  * Nyte settles without running is refused). A stopped run cancels the
13
13
  * agent's turn. Which agents there are, and the command, arguments and
14
14
  * environment each starts with, come from the registry list shipped in
15
- * `registry-seed.json` alone, never from the network, so no remote entry
16
- * picks what runs on this machine. An installed agent is listed but runs
17
- * only once the user picks it, never as a default the host chooses.
18
- * `agents`, when given, replaces the registry lookup, as tests do.
15
+ * `registry-seed.json` and the user's `agentsFile`, never from the network,
16
+ * so no remote entry picks what runs on this machine; a user agent replaces
17
+ * a registry agent of the same id. An agent with a `mode` has each new
18
+ * session set to it. An installed agent is listed but runs only once the
19
+ * user picks it, never as a default the host chooses. `agents`, when given,
20
+ * replaces both lookups, as tests do.
19
21
  */
20
22
  export declare function acpAgents(options?: {
21
23
  readonly agents?: () => Promise<readonly AcpAgent[]>;
24
+ readonly agentsFile?: string;
22
25
  }): {
23
26
  provider: Provider<Api>;
24
27
  plugin: {
@@ -4,21 +4,22 @@ import {
4
4
  MIRROR_TOOL2,
5
5
  mirrorArguments2,
6
6
  mirrorClass2
7
- } from "../../chunks/bash-description-9nn3yp18.js";
8
- import"../../chunks/bash-description-svrhh5a5.js";
7
+ } from "../../chunks/bash-description-q2v8wbn8.js";
8
+ import"../../chunks/bash-description-99k8z2r7.js";
9
9
  import {
10
10
  AcpProcess2
11
- } from "../../chunks/bash-description-eqp7ap2w.js";
11
+ } from "../../chunks/bash-description-z1581a29.js";
12
12
  import"../../chunks/bash-description-4vz9pxyx.js";
13
13
  import {
14
14
  registryEntries2,
15
- installedAgents2
16
- } from "../../chunks/bash-description-hg64tqf1.js";
15
+ installedAgents2,
16
+ userAgents2
17
+ } from "../../chunks/bash-description-f754ge33.js";
17
18
  import {
18
19
  messageKey2,
19
20
  userBlocks2,
20
21
  transcriptText2
21
- } from "../../chunks/bash-description-wmcbg6fw.js";
22
+ } from "../../chunks/bash-description-g7gfy7nw.js";
22
23
 
23
24
  // src/acp/index.ts
24
25
  import {
@@ -353,6 +354,31 @@ var registry_seed_default = {
353
354
  }
354
355
  }
355
356
  },
357
+ {
358
+ id: "fx",
359
+ name: "fx",
360
+ mode: "ask",
361
+ distribution: {
362
+ binary: {
363
+ "darwin-aarch64": {
364
+ cmd: "./fx",
365
+ args: ["acp"]
366
+ },
367
+ "darwin-x86_64": {
368
+ cmd: "./fx",
369
+ args: ["acp"]
370
+ },
371
+ "linux-aarch64": {
372
+ cmd: "./fx",
373
+ args: ["acp"]
374
+ },
375
+ "linux-x86_64": {
376
+ cmd: "./fx",
377
+ args: ["acp"]
378
+ }
379
+ }
380
+ }
381
+ },
356
382
  {
357
383
  id: "gemini",
358
384
  name: "Gemini CLI",
@@ -967,8 +993,15 @@ Answer in text only; do not use tools.`
967
993
  return;
968
994
  }
969
995
  await processEnvironment();
970
- const found = await installedAgents2(registryEntries2(registry_seed_default), process.env.PATH ?? "");
971
- await context.publish({ update: () => agents = found });
996
+ const [own, found] = await Promise.all([
997
+ options?.agentsFile === undefined ? [] : userAgents2(options.agentsFile),
998
+ installedAgents2(registryEntries2(registry_seed_default), process.env.PATH ?? "")
999
+ ]);
1000
+ const listed = [
1001
+ ...own,
1002
+ ...found.filter((agent) => !own.some((mine) => mine.id === agent.id))
1003
+ ];
1004
+ await context.publish({ update: () => agents = listed });
972
1005
  },
973
1006
  stream: (model, context, streamOptions) => stream(model, context, {
974
1007
  signal: streamOptions?.signal,
@@ -5,6 +5,8 @@ export interface AcpAgent {
5
5
  readonly command: string;
6
6
  readonly args: readonly string[];
7
7
  readonly env: Readonly<Record<string, string>>;
8
+ /** The ACP session mode each new session is set to, so the agent's permission asks reach Nyte; else the agent's own default. */
9
+ readonly mode?: string;
8
10
  }
9
11
  /** The agent entries of a registry document; anything else is no entries. */
10
12
  export declare function registryEntries(document: unknown): readonly unknown[];
@@ -16,3 +18,10 @@ export declare function registryEntries(document: unknown): readonly unknown[];
16
18
  * can download is left out, so choosing a model never downloads one.
17
19
  */
18
20
  export declare function installedAgents(entries: readonly unknown[], path: string): Promise<readonly AcpAgent[]>;
21
+ /**
22
+ * The agents the user lists in `file` (`{ "agents": [{ id, name, command,
23
+ * args?, env?, mode? }] }`), none when there is no file. Each is listed as
24
+ * written, installed or not, and its command runs without shell expansion.
25
+ * The file is the host's alone, so no client or project picks what runs.
26
+ */
27
+ export declare function userAgents(file: string): Promise<readonly AcpAgent[]>;
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  registryEntries2,
3
- installedAgents2
4
- } from "../../chunks/bash-description-hg64tqf1.js";
3
+ installedAgents2,
4
+ userAgents2
5
+ } from "../../chunks/bash-description-f754ge33.js";
5
6
  import"../../chunks/bash-description-4vz9pxyx.js";
6
7
  export {
7
8
  installedAgents2 as installedAgents,
8
- registryEntries2 as registryEntries
9
+ registryEntries2 as registryEntries,
10
+ userAgents2 as userAgents
9
11
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AcpThread2
3
- } from "../../chunks/bash-description-svrhh5a5.js";
4
- import"../../chunks/bash-description-9nn3yp18.js";
3
+ } from "../../chunks/bash-description-99k8z2r7.js";
4
+ import"../../chunks/bash-description-q2v8wbn8.js";
5
5
  export {
6
6
  AcpThread2 as AcpThread
7
7
  };
@@ -2,8 +2,8 @@ import {
2
2
  messageKey2,
3
3
  userBlocks2,
4
4
  transcriptText2
5
- } from "../../chunks/bash-description-wmcbg6fw.js";
6
- import"../../chunks/bash-description-9nn3yp18.js";
5
+ } from "../../chunks/bash-description-g7gfy7nw.js";
6
+ import"../../chunks/bash-description-q2v8wbn8.js";
7
7
  export {
8
8
  messageKey2 as messageKey,
9
9
  transcriptText2 as transcriptText,
@@ -1,4 +1,4 @@
1
- import type { ToolCallContent, Usage } from "@agentclientprotocol/sdk/unstable";
1
+ import type { ToolCallContent } from "@agentclientprotocol/sdk/unstable";
2
2
  import type { Api, AssistantMessage, AssistantMessageEventStream, Model, ToolCall } from "@nyte-ai/ai";
3
3
  import type { ToolClass } from "@nyte-ai/schema";
4
4
  import { Type } from "typebox";
@@ -16,6 +16,14 @@ export declare const mirrorArguments: Type.TObject<{
16
16
  paths: Type.TArray<Type.TString>;
17
17
  }>;
18
18
  export type MirrorArguments = Static<typeof mirrorArguments>;
19
+ /** A turn's usage as ACP defines it. An agent's report missing a required count (fx sends no `totalTokens`) is not usage. */
20
+ export declare const agentUsage: Type.TObject<{
21
+ inputTokens: Type.TNumber;
22
+ outputTokens: Type.TNumber;
23
+ totalTokens: Type.TNumber;
24
+ cachedReadTokens: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
25
+ cachedWriteTokens: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
26
+ }>;
19
27
  export declare function emptyMessage(model: Model<Api>): AssistantMessage;
20
28
  /** The class Nyte shows and gates an agent's tool call by, from the ACP kind, its paths and its input. */
21
29
  export declare function mirrorClass(args: MirrorArguments): ToolClass;
@@ -28,6 +36,6 @@ export declare class Translator {
28
36
  text(delta: string): void;
29
37
  thinking(delta: string): void;
30
38
  call(call: ToolCall): void;
31
- usage(usage: Usage): void;
39
+ usage(usage: Static<typeof agentUsage>): void;
32
40
  end(): void;
33
41
  }
@@ -3,16 +3,18 @@ import {
3
3
  ACP_API2,
4
4
  MIRROR_TOOL2,
5
5
  mirrorArguments2,
6
+ agentUsage2,
6
7
  emptyMessage2,
7
8
  mirrorClass2,
8
9
  toolText2,
9
10
  Translator2
10
- } from "../../chunks/bash-description-9nn3yp18.js";
11
+ } from "../../chunks/bash-description-q2v8wbn8.js";
11
12
  export {
12
13
  ACP_API2 as ACP_API,
13
14
  ACP_PROVIDER2 as ACP_PROVIDER,
14
15
  MIRROR_TOOL2 as MIRROR_TOOL,
15
16
  Translator2 as Translator,
17
+ agentUsage2 as agentUsage,
16
18
  emptyMessage2 as emptyMessage,
17
19
  mirrorArguments2 as mirrorArguments,
18
20
  mirrorClass2 as mirrorClass,
@@ -5,7 +5,7 @@ export interface ApprovalTool extends RuntimeCall {
5
5
  readonly approval?: ToolDefinition["approval"];
6
6
  }
7
7
  /**
8
- * The host's policy for tool calls, `full` by default. It applies to every
8
+ * The host's policy for tool calls, `ask` by default. It applies to every
9
9
  * session at its next call, including one already running.
10
10
  *
11
11
  * @category plugins
@@ -4,7 +4,7 @@ import {
4
4
  APPROVAL_POLICIES2,
5
5
  approval2,
6
6
  openApprovals2
7
- } from "../../chunks/bash-description-h13r0byk.js";
7
+ } from "../../chunks/bash-description-axnga0jz.js";
8
8
 
9
9
  // src/approvals/approvals.ts
10
10
  import { posix } from "node:path";
@@ -17,7 +17,7 @@ var permissions = {
17
17
  label: "Permissions",
18
18
  schema: approvalPolicy2,
19
19
  choices: APPROVAL_POLICIES2,
20
- default: "full",
20
+ default: "ask",
21
21
  scope: "host"
22
22
  };
23
23
  var GUARDED = new Set([".claude", ".git", ".nyte"]);
@@ -14,15 +14,15 @@ export declare const approvalPolicy: import("@nyte-ai/schema").Schema<"ask" | "a
14
14
  export declare const APPROVAL_POLICIES: readonly [{
15
15
  readonly value: "ask";
16
16
  readonly label: "Ask first";
17
- readonly description: "Asks before every command and file change";
17
+ readonly badge: "Asks before commands, file edits and other tools";
18
18
  }, {
19
19
  readonly value: "auto-edit";
20
20
  readonly label: "Auto-edit";
21
- readonly description: "Edits workspace files, asks before commands and anything outside";
21
+ readonly badge: "Edits workspace files, asks before commands and other tools";
22
22
  }, {
23
23
  readonly value: "full";
24
24
  readonly label: "Full access";
25
- readonly description: "Runs every tool without asking";
25
+ readonly badge: "Runs every tool without asking";
26
26
  }];
27
27
  declare const state: import("@nyte-ai/schema").Schema<{
28
28
  tool: string;
@@ -6,7 +6,7 @@ import {
6
6
  approvalPrompt2,
7
7
  approval2,
8
8
  openApprovals2
9
- } from "../../chunks/bash-description-h13r0byk.js";
9
+ } from "../../chunks/bash-description-axnga0jz.js";
10
10
  export {
11
11
  APPROVAL_ACTIONS2 as APPROVAL_ACTIONS,
12
12
  APPROVAL_POLICIES2 as APPROVAL_POLICIES,