@nyte-ai/plugin 0.0.24 → 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 (52) hide show
  1. package/THIRD-PARTY-NOTICES.md +13 -5
  2. package/dist/chunks/bash-description-0ah30s12.js +33 -0
  3. package/dist/chunks/{bash-description-qnwggxq3.js → bash-description-1neewp76.js} +19 -8
  4. package/dist/chunks/bash-description-4cdbmar0.js +124 -0
  5. package/dist/chunks/bash-description-4h0hnsv4.js +68 -0
  6. package/dist/chunks/bash-description-5dpf5hpt.js +724 -0
  7. package/dist/chunks/bash-description-9gw9ets8.js +162 -0
  8. package/dist/chunks/bash-description-b78pre8c.js +147 -0
  9. package/dist/chunks/{bash-description-necnb2k7.js → bash-description-vg0xecwm.js} +17 -7
  10. package/dist/src/acp/connection.js +1 -1
  11. package/dist/src/acp/index.d.ts +3 -3
  12. package/dist/src/acp/index.js +1 -1
  13. package/dist/src/approvals/approvals.d.ts +16 -16
  14. package/dist/src/approvals/schema.d.ts +18 -18
  15. package/dist/src/bash-description.d.ts +1 -1
  16. package/dist/src/bash-description.js +3 -5
  17. package/dist/src/canvas/canvas-protocol.d.ts +12 -12
  18. package/dist/src/canvas/canvas.d.ts +12 -3
  19. package/dist/src/canvas/canvas.js +33 -11
  20. package/dist/src/canvas/schema.d.ts +48 -8
  21. package/dist/src/canvas/schema.js +5 -1
  22. package/dist/src/claude-code-sdk/index.d.ts +1 -1
  23. package/dist/src/claude-code-sdk/index.js +1 -0
  24. package/dist/src/client/notifications.d.ts +1 -1
  25. package/dist/src/client/presentation.d.ts +1 -27
  26. package/dist/src/client/presentation.js +1 -19
  27. package/dist/src/codemode.js +148 -41
  28. package/dist/src/core.d.ts +1 -1
  29. package/dist/src/question/question.d.ts +14 -14
  30. package/dist/src/question/schema.d.ts +23 -23
  31. package/dist/src/rename.d.ts +17 -32
  32. package/dist/src/rename.js +115 -48
  33. package/dist/src/subagents.d.ts +30 -0
  34. package/dist/src/subagents.js +323 -0
  35. package/dist/src/telemetry.d.ts +1 -1
  36. package/dist/src/tool-search.d.ts +49 -0
  37. package/dist/src/tool-search.js +14 -0
  38. package/dist/src/web/body.d.ts +3 -0
  39. package/dist/src/web/body.js +6 -0
  40. package/dist/src/web/fetch.d.ts +16 -0
  41. package/dist/src/web/fetch.js +8 -0
  42. package/dist/src/web/html-markdown.d.ts +9 -0
  43. package/dist/src/web/html-markdown.js +10 -0
  44. package/dist/src/web/index.d.ts +24 -0
  45. package/dist/src/web/index.js +93 -0
  46. package/dist/src/web/providers.d.ts +60 -0
  47. package/dist/src/web/providers.js +11 -0
  48. package/dist/src/web/search.d.ts +21 -0
  49. package/dist/src/web/search.js +6 -0
  50. package/package.json +17 -9
  51. package/dist/src/web-search.d.ts +0 -78
  52. package/dist/src/web-search.js +0 -219
@@ -0,0 +1,6 @@
1
+ import {
2
+ webSearch2
3
+ } from "../../chunks/bash-description-4h0hnsv4.js";
4
+ export {
5
+ webSearch2 as webSearch
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyte-ai/plugin",
3
- "version": "0.0.24",
3
+ "version": "0.0.25-nightly.20261025.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -79,13 +79,21 @@
79
79
  "types": "./dist/src/rename.d.ts",
80
80
  "import": "./dist/src/rename.js"
81
81
  },
82
+ "./core/subagents": {
83
+ "types": "./dist/src/subagents.d.ts",
84
+ "import": "./dist/src/subagents.js"
85
+ },
82
86
  "./core/telemetry": {
83
87
  "types": "./dist/src/telemetry.d.ts",
84
88
  "import": "./dist/src/telemetry.js"
85
89
  },
86
- "./core/web-search": {
87
- "types": "./dist/src/web-search.d.ts",
88
- "import": "./dist/src/web-search.js"
90
+ "./core/tool-search": {
91
+ "types": "./dist/src/tool-search.d.ts",
92
+ "import": "./dist/src/tool-search.js"
93
+ },
94
+ "./core/web": {
95
+ "types": "./dist/src/web/index.d.ts",
96
+ "import": "./dist/src/web/index.js"
89
97
  },
90
98
  "./client": {
91
99
  "types": "./dist/src/client.d.ts",
@@ -144,15 +152,16 @@
144
152
  "@agentclientprotocol/sdk": "^2.0.0",
145
153
  "@anthropic-ai/claude-agent-sdk": "^0.3.306",
146
154
  "@earendil-works/pi-codemode": "^1.3.0",
147
- "@nyte-ai/ai": "0.0.24",
148
- "@nyte-ai/core": "0.0.24",
149
- "@nyte-ai/schema": "0.0.24",
155
+ "@nyte-ai/ai": "0.0.25-nightly.20261025.2",
156
+ "@nyte-ai/core": "0.0.25-nightly.20261025.2",
157
+ "@nyte-ai/schema": "0.0.25-nightly.20261025.2",
150
158
  "@opentelemetry/api": "^1.10.0",
151
159
  "@opentelemetry/exporter-trace-otlp-http": "^0.300.0",
152
160
  "@opentelemetry/resources": "^3.0.0",
153
161
  "@opentelemetry/sdk-trace": "^3.0.0",
154
162
  "@opentelemetry/semantic-conventions": "^1.43.0",
155
163
  "es-module-lexer": "^3.0.4",
164
+ "htmlparser2": "^8.0.2",
156
165
  "sucrase": "^3.35.1",
157
166
  "typebox": "^1.4.2",
158
167
  "zod": "^4.6.7"
@@ -162,7 +171,6 @@
162
171
  "@types/node": "^26.6.5",
163
172
  "@types/react": "^19.3.0",
164
173
  "react": "^19.3.1",
165
- "typescript": "6.0.3",
166
174
  "vitest": "^5.0.5"
167
175
  },
168
176
  "peerDependencies": {
@@ -183,7 +191,7 @@
183
191
  "scripts": {
184
192
  "clean": "rm -rf node_modules .turbo",
185
193
  "test": "vitest --run",
186
- "typecheck": "tsrs --noEmit",
194
+ "typecheck": "tsc --noEmit",
187
195
  "build:package": "bun ../../scripts/sdk-packages.mjs build plugin"
188
196
  }
189
197
  }
@@ -1,78 +0,0 @@
1
- import type { Command, SettingDefinition } from "@nyte-ai/core";
2
- /**
3
- * Names a search provider the `web_search` tool can route to.
4
- *
5
- * @category plugins
6
- * @since 0.1.0
7
- */
8
- export type SearchProvider = (typeof PROVIDERS)[number];
9
- declare const PROVIDERS: readonly ["exa", "tavily", "firecrawl", "parallel"];
10
- /**
11
- * Returns one search hit as the tool reports it.
12
- *
13
- * @category plugins
14
- * @since 0.1.0
15
- */
16
- export interface SearchResult {
17
- readonly url: string;
18
- readonly title: string | null;
19
- readonly content: string | null;
20
- }
21
- /**
22
- * Returns what one adapter call needs: the query, the provider's key or
23
- * undefined for its keyless route, the fetch to send with, and a signal.
24
- *
25
- * @category plugins
26
- * @since 0.1.0
27
- */
28
- export interface SearchInput {
29
- readonly query: string;
30
- readonly key: string | undefined;
31
- readonly fetch: typeof globalThis.fetch;
32
- readonly signal: AbortSignal;
33
- }
34
- /**
35
- * One adapter per provider: Tavily over its REST endpoint, the others over
36
- * one stateless MCP `tools/call` to their public route. Each sends through
37
- * the given fetch only and returns the hits it recognised.
38
- *
39
- * @category plugins
40
- * @since 0.1.0
41
- */
42
- export declare const adapters: {
43
- readonly [P in SearchProvider]: (input: SearchInput) => Promise<readonly SearchResult[]>;
44
- };
45
- /**
46
- * Adds `web_search`, routed by the host setting `web_search.provider` to
47
- * Tavily, Exa, Firecrawl or Parallel. A provider's key lives in the plugin's
48
- * secrets under the provider's id, set with the `websearch-key` command; without one
49
- * the provider's keyless route is used.
50
- *
51
- * @category plugins
52
- * @since 0.1.0
53
- */
54
- declare const _default: {
55
- id: string;
56
- contribute: {
57
- settings: SettingDefinition<"exa" | "tavily" | "firecrawl" | "parallel">[];
58
- commands: Command<keyof import("@nyte-ai/core").SideTable>[];
59
- };
60
- activate(api: {
61
- readonly side: "core";
62
- readonly sdk: import("@nyte-ai/core").Connection;
63
- readonly contribute: import("@nyte-ai/core").Registries<"core">;
64
- readonly storage: import("@nyte-ai/core").PluginStorage;
65
- readonly signal: AbortSignal;
66
- hook<N extends "session_activated" | "before_send" | "run_started" | "transform_transcript" | "before_compaction" | "before_request" | "before_tool" | "after_tool" | "after_request" | "run_ended">(name: N, entry: import("@nyte-ai/core").HookEntry<"core", N>): import("@nyte-ai/schema").Disposer;
67
- report(issue: import("@nyte-ai/schema").ValidationIssue): void;
68
- reload(): void;
69
- } & {
70
- readonly session: import("@nyte-ai/core").Session;
71
- readonly env: import("@nyte-ai/core").ExecutionEnv;
72
- wrapEnv(wrap: import("@nyte-ai/core").EnvironmentWrap): import("@nyte-ai/schema").Disposer;
73
- readonly inputs: import("@nyte-ai/core").Resources;
74
- request<T = string>(input: import("@nyte-ai/schema").ModelRequestInput<T>): Promise<import("@nyte-ai/schema").ModelRequestOutcome<T>>;
75
- approve(call: import("@nyte-ai/core").RuntimeCall, signal: AbortSignal): Promise<import("@nyte-ai/core").RuntimeVerdict>;
76
- }): void;
77
- };
78
- export default _default;
@@ -1,219 +0,0 @@
1
- // src/web-search.ts
2
- import { dev } from "@nyte-ai/core";
3
- import { standard } from "@nyte-ai/schema";
4
- import { Type } from "typebox";
5
- import { Value } from "typebox/value";
6
- var PROVIDERS = ["exa", "tavily", "firecrawl", "parallel"];
7
- var providerSchema = Type.Union(PROVIDERS.map((name) => Type.Literal(name)));
8
- var provider = {
9
- id: "web_search.provider",
10
- label: "Web search provider",
11
- schema: standard(providerSchema),
12
- choices: [
13
- { value: "exa", label: "Exa" },
14
- { value: "tavily", label: "Tavily" },
15
- { value: "firecrawl", label: "Firecrawl" },
16
- { value: "parallel", label: "Parallel" }
17
- ],
18
- default: "exa",
19
- scope: "host"
20
- };
21
- var textBlocks = Type.Object({
22
- content: Type.Array(Type.Object({ type: Type.String(), text: Type.Optional(Type.String()) }))
23
- });
24
- var tavilyResponse = Type.Object({
25
- results: Type.Array(Type.Object({ url: Type.String(), title: Type.String(), content: Type.String() }))
26
- });
27
- var firecrawlResponse = Type.Object({
28
- data: Type.Object({
29
- web: Type.Array(Type.Object({
30
- url: Type.String(),
31
- title: Type.Optional(Type.Union([Type.String(), Type.Null()])),
32
- description: Type.Optional(Type.Union([Type.String(), Type.Null()]))
33
- }))
34
- })
35
- });
36
- var parallelResponse = Type.Object({
37
- structuredContent: Type.Object({
38
- results: Type.Array(Type.Object({
39
- url: Type.String(),
40
- title: Type.Optional(Type.Union([Type.String(), Type.Null()])),
41
- excerpts: Type.Array(Type.String())
42
- }))
43
- })
44
- });
45
- var adapters = {
46
- async tavily({ query, key, fetch, signal }) {
47
- const response = await fetch("https://api.tavily.com/search", {
48
- method: "POST",
49
- headers: {
50
- "Content-Type": "application/json",
51
- ...key === undefined ? { "X-Tavily-Access-Mode": "keyless" } : { Authorization: `Bearer ${key}` }
52
- },
53
- body: JSON.stringify({ query, search_depth: "basic", max_results: 8 }),
54
- signal
55
- });
56
- const body = parse(await answered(response));
57
- return Value.Check(tavilyResponse, body) ? body.results.map((hit) => ({ url: hit.url, title: hit.title, content: hit.content })) : [];
58
- },
59
- async exa({ query, key, fetch, signal }) {
60
- const endpoint = new URL("https://mcp.exa.ai/mcp");
61
- if (key !== undefined)
62
- endpoint.searchParams.set("exaApiKey", key);
63
- const result = await callTool(fetch, endpoint, undefined, "web_search_exa", { query, numResults: 8 }, signal);
64
- const text = Value.Check(textBlocks, result) ? result.content.find((block) => block.text !== undefined)?.text ?? "" : "";
65
- return text.split(/\n\n---\n\n/).flatMap((block) => {
66
- const url = field(block, "URL");
67
- return url === null ? [] : [
68
- {
69
- url,
70
- title: field(block, "Title"),
71
- content: block.match(/^(?:Highlights|Text):\s*\n?([\s\S]*)$/m)?.[1]?.trim() ?? null
72
- }
73
- ];
74
- });
75
- },
76
- async firecrawl({ query, key, fetch, signal }) {
77
- const result = await callTool(fetch, new URL("https://mcp.firecrawl.dev/v2/mcp"), key, "firecrawl_search", { query, limit: 8 }, signal);
78
- const text = Value.Check(textBlocks, result) ? result.content.find((block) => block.text !== undefined)?.text ?? "" : "";
79
- const body = parse(text);
80
- return Value.Check(firecrawlResponse, body) ? body.data.web.map((hit) => ({
81
- url: hit.url,
82
- title: hit.title ?? null,
83
- content: hit.description ?? null
84
- })) : [];
85
- },
86
- async parallel({ query, key, fetch, signal }) {
87
- const result = await callTool(fetch, new URL("https://search.parallel.ai/mcp"), key, "web_search", { objective: query, search_queries: [query] }, signal);
88
- return Value.Check(parallelResponse, result) ? result.structuredContent.results.map((hit) => ({
89
- url: hit.url,
90
- title: hit.title ?? null,
91
- content: hit.excerpts.length === 0 ? null : hit.excerpts.join(`
92
-
93
- `)
94
- })) : [];
95
- }
96
- };
97
- async function callTool(fetch, url, key, tool, args, signal) {
98
- const response = await fetch(url, {
99
- method: "POST",
100
- headers: {
101
- Accept: "application/json, text/event-stream",
102
- "Content-Type": "application/json",
103
- ...key === undefined ? {} : { Authorization: `Bearer ${key}` }
104
- },
105
- body: JSON.stringify({
106
- jsonrpc: "2.0",
107
- id: 1,
108
- method: "tools/call",
109
- params: { name: tool, arguments: args }
110
- }),
111
- signal
112
- });
113
- const body = await answered(response);
114
- const frames = [
115
- body,
116
- ...body.split(`
117
- `).flatMap((line) => line.startsWith("data: ") ? [line.slice(6)] : [])
118
- ];
119
- for (const frame of frames) {
120
- const message = parse(frame);
121
- if (typeof message === "object" && message !== null && "result" in message)
122
- return message.result;
123
- }
124
- return;
125
- }
126
- async function answered(response) {
127
- const body = await response.text();
128
- if (!response.ok)
129
- throw new Error(`HTTP ${response.status}: ${body.trim().slice(0, 200) || response.statusText}`);
130
- return body;
131
- }
132
- function parse(text) {
133
- try {
134
- return JSON.parse(text);
135
- } catch {
136
- return;
137
- }
138
- }
139
- function field(block, name) {
140
- const value = block.match(new RegExp(`^${name}:\\s*(.+)$`, "m"))?.[1]?.trim();
141
- return value === undefined || value === "" || value === "N/A" ? null : value;
142
- }
143
- var parameters = standard(Type.Object({ query: Type.String({ minLength: 1, description: "What to search the web for." }) }));
144
- function webSearch(api) {
145
- return {
146
- name: "web_search",
147
- description: "Search the web for current information beyond your knowledge cutoff. Returns titles, URLs and excerpts.",
148
- parameters,
149
- class: (args) => ({ kind: "custom", label: `Searching ${args.query}` }),
150
- effects: "none",
151
- approval: "never",
152
- replay: "safe",
153
- async execute(args, invocation) {
154
- const value = await api.contribute.settings.value(provider.id);
155
- const name = PROVIDERS.find((known) => known === value) ?? provider.default;
156
- const results = await invocation.memo("results", async () => {
157
- const key = await api.storage.secrets.get(name);
158
- dev("web-search", "search", {
159
- call: invocation.call,
160
- provider: name,
161
- keyed: key !== undefined
162
- });
163
- const hits = await adapters[name]({
164
- query: args.query,
165
- key,
166
- fetch: globalThis.fetch,
167
- signal: AbortSignal.any([invocation.signal, AbortSignal.timeout(25000)])
168
- });
169
- return hits.map((hit) => ({ url: hit.url, title: hit.title, content: hit.content }));
170
- });
171
- const text = results.length === 0 ? "No results. Try a different query." : results.map((hit) => `## ${hit.title ?? hit.url}
172
- ${hit.url}${hit.content === null ? "" : `
173
-
174
- ${hit.content}`}`).join(`
175
-
176
- `);
177
- return { content: [{ kind: "text", text }] };
178
- }
179
- };
180
- }
181
- var keyCommand = {
182
- name: "websearch-key",
183
- title: "Set a web search key",
184
- description: "Store a web search provider's API key: <provider> <key>; no key removes it.",
185
- complete(prefix) {
186
- const typed = prefix.trimStart();
187
- if (/\s/u.test(typed))
188
- return [];
189
- return PROVIDERS.filter((known) => known.startsWith(typed.toLowerCase())).map((known) => ({
190
- value: `${known} `,
191
- label: known
192
- }));
193
- },
194
- async run(text, { api }) {
195
- const [named = "", key = ""] = text.split(/\s+(.*)/su);
196
- const chosen = PROVIDERS.find((known) => known === named.toLowerCase());
197
- if (chosen === undefined)
198
- throw new Error(`Name a provider first: ${PROVIDERS.join(", ")}.`);
199
- if (key === "")
200
- await api.storage.secrets.delete(chosen);
201
- else
202
- await api.storage.secrets.set(chosen, key);
203
- return `Key for ${chosen} ${key === "" ? "removed" : "saved"}.`;
204
- }
205
- };
206
- var web_search_default = {
207
- id: "web-search",
208
- contribute: {
209
- settings: [provider],
210
- commands: [keyCommand]
211
- },
212
- activate(api) {
213
- api.contribute.tools.add(webSearch(api));
214
- }
215
- };
216
- export {
217
- adapters,
218
- web_search_default as default
219
- };