@nyte-ai/plugin 0.0.27 → 0.0.28-nightly.20261107.65

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 (55) hide show
  1. package/dist/chunks/{bash-description-tc68h635.js → bash-description-4y8ey061.js} +1 -1
  2. package/dist/chunks/{bash-description-5zjawxsz.js → bash-description-7pkkngps.js} +1 -1
  3. package/dist/chunks/{bash-description-j2azw9sj.js → bash-description-ajjg78ww.js} +1 -1
  4. package/dist/chunks/{bash-description-jhrs22a3.js → bash-description-nn0tmjap.js} +16 -8
  5. package/dist/chunks/{bash-description-0gnxcq7q.js → bash-description-rckj413b.js} +1 -1
  6. package/dist/chunks/bash-description-wtcc8946.js +14 -0
  7. package/dist/src/acp/connection.d.ts +0 -11
  8. package/dist/src/acp/connection.js +1 -1
  9. package/dist/src/acp/index.js +1 -1
  10. package/dist/src/acp/registry.d.ts +0 -15
  11. package/dist/src/acp/thread.d.ts +0 -17
  12. package/dist/src/acp/transcript.d.ts +0 -3
  13. package/dist/src/acp/translate.d.ts +0 -5
  14. package/dist/src/approvals/approvals.d.ts +0 -1
  15. package/dist/src/approvals/schema.d.ts +0 -7
  16. package/dist/src/bash-description.d.ts +0 -9
  17. package/dist/src/browser-client.d.ts +0 -20
  18. package/dist/src/canvas/canvas-client.d.ts +0 -20
  19. package/dist/src/canvas/canvas-compile.js +2 -2
  20. package/dist/src/canvas/canvas-preview.js +2 -2
  21. package/dist/src/canvas/canvas-protocol.d.ts +16 -8
  22. package/dist/src/canvas/canvas-protocol.js +1 -1
  23. package/dist/src/canvas/canvas.js +4 -4
  24. package/dist/src/canvas/schema.js +2 -2
  25. package/dist/src/claude-code-sdk/session.d.ts +0 -17
  26. package/dist/src/claude-code-sdk/translate.d.ts +0 -1
  27. package/dist/src/client/citation.d.ts +8 -0
  28. package/dist/src/client/citation.js +6 -0
  29. package/dist/src/client/mount.d.ts +0 -12
  30. package/dist/src/client/notifications.js +2 -1
  31. package/dist/src/client/presentation.d.ts +2 -144
  32. package/dist/src/client/presentation.js +5 -1
  33. package/dist/src/client/transcript-tui.d.ts +0 -6
  34. package/dist/src/client/transcript.d.ts +0 -6
  35. package/dist/src/client/user-messages.d.ts +0 -10
  36. package/dist/src/client.d.ts +0 -25
  37. package/dist/src/codemode.d.ts +0 -6
  38. package/dist/src/codemode.js +2 -2
  39. package/dist/src/core.d.ts +0 -26
  40. package/dist/src/desktop-settings/schema.d.ts +0 -3
  41. package/dist/src/find-on-path.d.ts +0 -2
  42. package/dist/src/openai-astra-context.d.ts +0 -14
  43. package/dist/src/question/schema.d.ts +0 -8
  44. package/dist/src/rename.js +1 -1
  45. package/dist/src/subagents.d.ts +0 -8
  46. package/dist/src/subagents.js +65 -21
  47. package/dist/src/tool-search.d.ts +0 -1
  48. package/dist/src/web/body.d.ts +0 -1
  49. package/dist/src/web/fetch.d.ts +0 -5
  50. package/dist/src/web/html-markdown.d.ts +0 -6
  51. package/dist/src/web/index.d.ts +0 -6
  52. package/dist/src/web/providers.d.ts +0 -19
  53. package/dist/src/web/search.d.ts +0 -4
  54. package/package.json +4 -4
  55. /package/dist/chunks/{bash-description-spc5av5d.js → bash-description-sqknck2c.js} +0 -0
@@ -9,22 +9,24 @@ var SCHEDULED = {
9
9
  deciding: "its plugins are deciding it"
10
10
  };
11
11
  var selectionParameters = {
12
- agent: Type.Optional(Type.String({ description: "A registered agent to run as; the default agent otherwise." })),
12
+ agent: Type.Optional(Type.String({
13
+ description: "A registered agent to run as, only when the user names one. Without it, a chat that runs as an agent starts subagents of its own agent, model and thinking level; any other chat, of the default agent."
14
+ })),
13
15
  model: Type.Optional(Type.String({
14
- description: "A model from /model, as provider/id or its id alone; a fast variant is its own id. The default model otherwise."
16
+ description: "A model to run on, only when the user asks for one: provider/id or an id from /model. Without it, the subagent runs on the inherited or default model."
15
17
  })),
16
18
  thinking: Type.Optional(Type.Enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"], {
17
- description: "A thinking level the model accepts; its default otherwise."
19
+ description: "A thinking level, only when the user asks for one; the model must accept it. The inherited level or the model's default otherwise."
18
20
  }))
19
21
  };
20
22
  var isolationParameter = {
21
23
  isolation: Type.Optional(Type.Literal("worktree", {
22
- description: "Run the subagent in a git worktree on a new branch from HEAD, with your uncommitted changes copied in, so its edits stay out of this workspace. The reply names the folder and branch. Without it, the subagent works in this workspace."
24
+ description: "Only when the user asks for an isolated copy: runs the subagent in a git worktree on a new branch from HEAD, with your uncommitted changes copied in. The reply names the folder and branch. Without it, the subagent works in this workspace."
23
25
  }))
24
26
  };
25
27
  var taskParameters = standard(Type.Object({
26
28
  prompt: Type.String({
27
- description: "The task for the subagent, with everything it needs to know."
29
+ description: "The task for the subagent, with everything it needs to know. Only its last message comes back, so say what that message should report."
28
30
  }),
29
31
  title: Type.Optional(Type.String({ description: "A short name for the subagent's session." })),
30
32
  ...selectionParameters,
@@ -32,7 +34,7 @@ var taskParameters = standard(Type.Object({
32
34
  }));
33
35
  var createParameters = standard(Type.Object({
34
36
  prompt: Type.String({
35
- description: "The subagent's first message; it starts working on it at once."
37
+ description: "The subagent's first message; it starts working on it at once. Only its last message comes back, so say what that message should report."
36
38
  }),
37
39
  title: Type.Optional(Type.String({ description: "A short name for the subagent's session." })),
38
40
  ...selectionParameters,
@@ -60,7 +62,7 @@ var stopParameters = standard(Type.Object({
60
62
  }));
61
63
  var task = {
62
64
  name: "task",
63
- description: "Run a subagent on a task and wait for its answer. Give it everything it needs; it does not see this conversation.",
65
+ description: "Run a subagent and get its answer as this call's result. Use it whenever you need the answer this turn; several task calls in one response run in parallel. Give it everything it needs; it does not see this conversation. A new message to you ends the wait early, and the answer reaches you when it finishes.",
64
66
  parameters: taskParameters,
65
67
  class: (args) => ({ kind: "delegate", child: null, role: "task", title: args.title ?? null }),
66
68
  replay: "safe",
@@ -92,7 +94,7 @@ ${answer}`, "head"));
92
94
  };
93
95
  var create = {
94
96
  name: "create",
95
- description: "Start a subagent on a first message and return its id, to send it more messages and await it later.",
97
+ description: "Start a subagent in the background and return its id at once, for work you won't wait on or a subagent you'll message again with send. Its answer reaches you on its own when it finishes. When you need the answer this turn, use task instead. Link it in a reply as [short title](agent:<id>).",
96
98
  parameters: createParameters,
97
99
  class: (args) => ({ kind: "delegate", child: null, role: "create", title: args.title ?? null }),
98
100
  effects: "none",
@@ -112,7 +114,7 @@ var create = {
112
114
  };
113
115
  var send = {
114
116
  name: "send",
115
- description: "Send a message to a subagent; it works in the background. Use await for its answer.",
117
+ description: "Send a message to a subagent from create. A message sent while it works runs once that work ends, so there is no need to await first. Use await for its answer.",
116
118
  parameters: sendParameters,
117
119
  class: (args) => ({
118
120
  kind: "delegate",
@@ -134,7 +136,7 @@ var send = {
134
136
  };
135
137
  var awaitChild = {
136
138
  name: "await",
137
- description: "Wait for a subagent to finish its current work and return its answer.",
139
+ description: "Wait for a subagent to finish its current work and return its answer. A new message to you ends the wait early, with the subagent still working.",
138
140
  parameters: awaitParameters,
139
141
  class: (args) => ({
140
142
  kind: "delegate",
@@ -223,20 +225,23 @@ var subagents_default = {
223
225
  api.contribute.tools.add(definition);
224
226
  }
225
227
  };
226
- async function childConfiguration(invocation, { agent, model, thinking }) {
227
- if (agent === undefined && model === undefined && thinking === undefined)
228
- return;
229
- return {
230
- agent,
231
- model: model === undefined ? undefined : await findModel(invocation, model),
232
- thinking
228
+ async function childConfiguration(invocation, args) {
229
+ const view = await invocation.session.head(invocation.head).view({ tail: 0 });
230
+ const unregistered = args.agent !== undefined && !view.catalog.agents.some((agent) => agent.id === args.agent) ? args.agent : undefined;
231
+ const agent = unregistered === undefined ? args.agent : undefined;
232
+ const effective = view.configuration.effective;
233
+ const parent = agent === undefined && effective?.agent !== null ? effective : null;
234
+ const named = unregistered === undefined ? args.model === undefined ? undefined : await findModel(invocation, args.model) : await findAgentModel(invocation, unregistered, args.model);
235
+ const patch = {
236
+ agent: agent ?? parent?.agent,
237
+ model: named ?? parent?.model,
238
+ thinking: args.thinking ?? (named === undefined ? parent?.thinking : undefined)
233
239
  };
240
+ return Object.values(patch).every((value) => value === undefined) ? undefined : patch;
234
241
  }
235
242
  async function findModel(invocation, name) {
236
- const models = (await invocation.sdk.models.list()).providers.flatMap((provider) => provider.credential === "unknown" || provider.credential === "configured" || provider.credential === "verified" ? provider.models : []);
237
- const refs = models.flatMap((info) => info.fast === null ? [info.ref] : [info.ref, info.fast]);
238
- const exact = refs.filter((ref) => `${ref.provider}/${ref.id}` === name);
239
- const matches = exact.length > 0 ? exact : refs.filter((ref) => ref.id === name);
243
+ const models = await listModels(invocation);
244
+ const matches = matchModels(models, name);
240
245
  const [only, ...others] = matches;
241
246
  if (only !== undefined && others.length === 0)
242
247
  return only;
@@ -248,6 +253,45 @@ async function findModel(invocation, name) {
248
253
  ${models.map((info) => `- ${info.ref.provider}/${info.ref.id} (thinking: ${info.thinking.join(", ")})${info.fast === null ? "" : `, fast: ${info.fast.provider}/${info.fast.id}`}`).join(`
249
254
  `)}`);
250
255
  }
256
+ async function findAgentModel(invocation, agent, model) {
257
+ const models = await listModels(invocation);
258
+ const names = model === undefined ? [agent] : [model, `${agent} ${model}`, agent];
259
+ const [found] = names.flatMap((name) => {
260
+ const matches = matchModels(models, name);
261
+ return matches.length === 1 ? matches : [];
262
+ });
263
+ if (found === undefined)
264
+ throw new Error(`No agent is registered as ${agent}.`);
265
+ return found;
266
+ }
267
+ async function listModels(invocation) {
268
+ return (await invocation.sdk.models.list()).providers.flatMap((provider) => provider.credential === "unknown" || provider.credential === "configured" || provider.credential === "verified" ? provider.models : []);
269
+ }
270
+ function matchModels(models, name) {
271
+ const refs = models.flatMap((info) => info.fast === null ? [info.ref] : [info.ref, info.fast]);
272
+ const exact = refs.filter((ref) => `${ref.provider}/${ref.id}` === name);
273
+ if (exact.length > 0)
274
+ return exact;
275
+ const ids = refs.filter((ref) => ref.id === name);
276
+ return ids.length > 0 ? ids : closestModels(refs, name);
277
+ }
278
+ function closestModels(refs, name) {
279
+ const wanted = modelWords(name);
280
+ if (!wanted.some((word) => /[a-z]/u.test(word)))
281
+ return [];
282
+ const held = refs.flatMap((ref) => {
283
+ const words = modelWords(`${ref.provider}/${ref.id}`);
284
+ return wanted.every((word) => countWord(words, word) >= countWord(wanted, word)) ? [{ ref, extra: modelWords(ref.id).length }] : [];
285
+ });
286
+ const fewest = Math.min(...held.map((entry) => entry.extra));
287
+ return held.flatMap((entry) => entry.extra === fewest ? [entry.ref] : []);
288
+ }
289
+ function modelWords(source) {
290
+ return source.toLowerCase().match(/[a-z]+|\d+/gu) ?? [];
291
+ }
292
+ function countWord(words, word) {
293
+ return words.filter((entry) => entry === word).length;
294
+ }
251
295
  async function describeWorktree(invocation, child) {
252
296
  const workspace = await invocation.sdk.workspace((await child.info()).workspace).info();
253
297
  if (workspace.isolation === null)
@@ -1,7 +1,6 @@
1
1
  import type { ToolNamespace } from "@nyte-ai/core";
2
2
  import type { ToolInfo } from "@nyte-ai/schema";
3
3
  export declare const DEFAULT_SEARCH_LIMIT = 8;
4
- /** A tool as the ranker sees it: its name and the text {@link createToolSearchDocument} builds. */
5
4
  export type ToolSearchDocument = {
6
5
  readonly name: string;
7
6
  readonly text: string;
@@ -1,3 +1,2 @@
1
1
  export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
2
- /** Reads a response body, throwing once its declared or streamed size passes `limit` bytes. */
3
2
  export declare function readCapped(response: Response, limit: number): Promise<Uint8Array>;
@@ -7,10 +7,5 @@ declare const fetchParameters: Type.TObject<{
7
7
  format: Type.TOptional<Type.TUnion<[Type.TLiteral<"markdown">, Type.TLiteral<"text">, Type.TLiteral<"html">]>>;
8
8
  timeout: Type.TOptional<Type.TNumber>;
9
9
  }>;
10
- /**
11
- * The `web_fetch` tool: GETs an http(s) URL through `fetch`, following at most ten
12
- * redirects that stay on http(s), and returns HTML as markdown, text or itself, other
13
- * text as is, and an image as a file. Bodies stop at 5 MiB; text shown inline at 50 KiB.
14
- */
15
10
  export declare function webFetch(fetch: Fetch): ToolDefinition<Static<typeof fetchParameters>>;
16
11
  export {};
@@ -1,9 +1,3 @@
1
1
  export declare const MAX_MARKDOWN_BYTES: number;
2
- /**
3
- * Converts HTML to Markdown in one streaming pass: drops scripts, styles, the head and
4
- * hidden elements; keeps headings, lists, GFM tables, fenced code, links and images;
5
- * stops nesting past 10,000 levels and caps the result at `MAX_MARKDOWN_BYTES`.
6
- */
7
2
  export declare function htmlToMarkdown(html: string): string;
8
- /** Returns an HTML document's text outside scripts, styles and embeds, trimmed. */
9
3
  export declare function htmlToText(html: string): string;
@@ -14,11 +14,5 @@ export type { SearchInput, ShippedProvider } from "./providers.ts";
14
14
  * @since 0.1.0
15
15
  */
16
16
  export declare function webPlugin(fetch: Fetch): Plugin;
17
- /**
18
- * The web plugin over the global `fetch`.
19
- *
20
- * @category plugins
21
- * @since 0.1.0
22
- */
23
17
  declare const _default: Plugin;
24
18
  export default _default;
@@ -1,11 +1,5 @@
1
1
  import type { SearchProvider, SearchResult } from "@nyte-ai/plugin/core";
2
2
  import type { Fetch } from "./body.ts";
3
- /**
4
- * The search providers the web plugin ships, by id and display name.
5
- *
6
- * @category plugins
7
- * @since 0.1.0
8
- */
9
3
  export declare const PROVIDERS: readonly [{
10
4
  readonly id: "exa";
11
5
  readonly name: "Exa";
@@ -19,12 +13,6 @@ export declare const PROVIDERS: readonly [{
19
13
  readonly id: "parallel";
20
14
  readonly name: "Parallel";
21
15
  }];
22
- /**
23
- * Names a search provider the web plugin ships.
24
- *
25
- * @category plugins
26
- * @since 0.1.0
27
- */
28
16
  export type ShippedProvider = (typeof PROVIDERS)[number]["id"];
29
17
  /**
30
18
  * Returns what one adapter call needs: the query, the provider's key or
@@ -50,11 +38,4 @@ export interface SearchInput {
50
38
  export declare const adapters: {
51
39
  readonly [P in ShippedProvider]: (input: SearchInput) => Promise<readonly SearchResult[]>;
52
40
  };
53
- /**
54
- * Returns the shipped providers for the search registry, each reading its key
55
- * through `key` on every search and sending through `fetch`.
56
- *
57
- * @category plugins
58
- * @since 0.1.0
59
- */
60
41
  export declare function shippedProviders(fetch: Fetch, key: (provider: ShippedProvider) => Promise<string | undefined>): readonly SearchProvider[];
@@ -11,10 +11,6 @@ declare const searchOutput: Type.TObject<{
11
11
  }>>;
12
12
  }>;
13
13
  type SearchOutput = Static<typeof searchOutput>;
14
- /**
15
- * The `web_search` tool: asks the registered provider the setting `setting` names,
16
- * falling back to Exa and then to the first one registered.
17
- */
18
14
  export declare function webSearch(api: PluginApi, setting: string): ToolDefinition<{
19
15
  query: string;
20
16
  }, SearchOutput>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyte-ai/plugin",
3
- "version": "0.0.27",
3
+ "version": "0.0.28-nightly.20261107.65",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -168,9 +168,9 @@
168
168
  "@agentclientprotocol/sdk": "^2.4.0",
169
169
  "@anthropic-ai/claude-agent-sdk": "^0.3.317",
170
170
  "@earendil-works/pi-codemode": "^1.5.0",
171
- "@nyte-ai/ai": "0.0.27",
172
- "@nyte-ai/core": "0.0.27",
173
- "@nyte-ai/schema": "0.0.27",
171
+ "@nyte-ai/ai": "0.0.28-nightly.20261107.65",
172
+ "@nyte-ai/core": "0.0.28-nightly.20261107.65",
173
+ "@nyte-ai/schema": "0.0.28-nightly.20261107.65",
174
174
  "@opentelemetry/api": "^1.10.0",
175
175
  "@opentelemetry/exporter-trace-otlp-http": "^0.300.0",
176
176
  "@opentelemetry/resources": "^3.0.0",