@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
@@ -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
- };