@staticn0va/wigolo 0.3.1 → 0.5.1

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 (255) hide show
  1. package/README.md +57 -2
  2. package/SKILL.md +196 -0
  3. package/dist/agent/executor.d.ts +13 -0
  4. package/dist/agent/executor.d.ts.map +1 -0
  5. package/dist/agent/executor.js +128 -0
  6. package/dist/agent/executor.js.map +1 -0
  7. package/dist/agent/pipeline.d.ts +5 -0
  8. package/dist/agent/pipeline.d.ts.map +1 -0
  9. package/dist/agent/pipeline.js +198 -0
  10. package/dist/agent/pipeline.js.map +1 -0
  11. package/dist/agent/planner.d.ts +9 -0
  12. package/dist/agent/planner.d.ts.map +1 -0
  13. package/dist/agent/planner.js +190 -0
  14. package/dist/agent/planner.js.map +1 -0
  15. package/dist/cache/change-detector.d.ts +7 -0
  16. package/dist/cache/change-detector.d.ts.map +1 -0
  17. package/dist/cache/change-detector.js +43 -0
  18. package/dist/cache/change-detector.js.map +1 -0
  19. package/dist/cache/db.d.ts.map +1 -1
  20. package/dist/cache/db.js +32 -0
  21. package/dist/cache/db.js.map +1 -1
  22. package/dist/cache/diff-summary.d.ts +2 -0
  23. package/dist/cache/diff-summary.d.ts.map +1 -0
  24. package/dist/cache/diff-summary.js +87 -0
  25. package/dist/cache/diff-summary.js.map +1 -0
  26. package/dist/cache/store.d.ts +16 -0
  27. package/dist/cache/store.d.ts.map +1 -1
  28. package/dist/cache/store.js +79 -0
  29. package/dist/cache/store.js.map +1 -1
  30. package/dist/cli/auth.d.ts +2 -0
  31. package/dist/cli/auth.d.ts.map +1 -0
  32. package/dist/cli/auth.js +95 -0
  33. package/dist/cli/auth.js.map +1 -0
  34. package/dist/cli/daemon.d.ts +6 -1
  35. package/dist/cli/daemon.d.ts.map +1 -1
  36. package/dist/cli/daemon.js +56 -3
  37. package/dist/cli/daemon.js.map +1 -1
  38. package/dist/cli/health.d.ts +1 -1
  39. package/dist/cli/health.d.ts.map +1 -1
  40. package/dist/cli/health.js +41 -3
  41. package/dist/cli/health.js.map +1 -1
  42. package/dist/cli/index.d.ts +1 -1
  43. package/dist/cli/index.d.ts.map +1 -1
  44. package/dist/cli/index.js +1 -1
  45. package/dist/cli/index.js.map +1 -1
  46. package/dist/cli/plugin.d.ts +5 -0
  47. package/dist/cli/plugin.d.ts.map +1 -0
  48. package/dist/cli/plugin.js +188 -0
  49. package/dist/cli/plugin.js.map +1 -0
  50. package/dist/cli/shell.d.ts +2 -0
  51. package/dist/cli/shell.d.ts.map +1 -0
  52. package/dist/cli/shell.js +86 -0
  53. package/dist/cli/shell.js.map +1 -0
  54. package/dist/cli/warmup.d.ts +8 -0
  55. package/dist/cli/warmup.d.ts.map +1 -1
  56. package/dist/cli/warmup.js +106 -1
  57. package/dist/cli/warmup.js.map +1 -1
  58. package/dist/config.d.ts +15 -0
  59. package/dist/config.d.ts.map +1 -1
  60. package/dist/config.js +23 -0
  61. package/dist/config.js.map +1 -1
  62. package/dist/daemon/health-check.d.ts +16 -0
  63. package/dist/daemon/health-check.d.ts.map +1 -0
  64. package/dist/daemon/health-check.js +36 -0
  65. package/dist/daemon/health-check.js.map +1 -0
  66. package/dist/daemon/http-server.d.ts +26 -0
  67. package/dist/daemon/http-server.d.ts.map +1 -0
  68. package/dist/daemon/http-server.js +282 -0
  69. package/dist/daemon/http-server.js.map +1 -0
  70. package/dist/daemon/proxy.d.ts +10 -0
  71. package/dist/daemon/proxy.d.ts.map +1 -0
  72. package/dist/daemon/proxy.js +99 -0
  73. package/dist/daemon/proxy.js.map +1 -0
  74. package/dist/embedding/embed.d.ts +19 -0
  75. package/dist/embedding/embed.d.ts.map +1 -0
  76. package/dist/embedding/embed.js +131 -0
  77. package/dist/embedding/embed.js.map +1 -0
  78. package/dist/embedding/key-terms.d.ts +12 -0
  79. package/dist/embedding/key-terms.d.ts.map +1 -0
  80. package/dist/embedding/key-terms.js +138 -0
  81. package/dist/embedding/key-terms.js.map +1 -0
  82. package/dist/embedding/subprocess.d.ts +31 -0
  83. package/dist/embedding/subprocess.d.ts.map +1 -0
  84. package/dist/embedding/subprocess.js +213 -0
  85. package/dist/embedding/subprocess.js.map +1 -0
  86. package/dist/embedding/vector-index.d.ts +26 -0
  87. package/dist/embedding/vector-index.d.ts.map +1 -0
  88. package/dist/embedding/vector-index.js +78 -0
  89. package/dist/embedding/vector-index.js.map +1 -0
  90. package/dist/fetch/action-executor.d.ts +28 -0
  91. package/dist/fetch/action-executor.d.ts.map +1 -0
  92. package/dist/fetch/action-executor.js +86 -0
  93. package/dist/fetch/action-executor.js.map +1 -0
  94. package/dist/fetch/auth.d.ts +2 -1
  95. package/dist/fetch/auth.d.ts.map +1 -1
  96. package/dist/fetch/auth.js +30 -2
  97. package/dist/fetch/auth.js.map +1 -1
  98. package/dist/fetch/browser-pool.d.ts +30 -11
  99. package/dist/fetch/browser-pool.d.ts.map +1 -1
  100. package/dist/fetch/browser-pool.js +228 -51
  101. package/dist/fetch/browser-pool.js.map +1 -1
  102. package/dist/fetch/browser-selector.d.ts +17 -0
  103. package/dist/fetch/browser-selector.d.ts.map +1 -0
  104. package/dist/fetch/browser-selector.js +70 -0
  105. package/dist/fetch/browser-selector.js.map +1 -0
  106. package/dist/fetch/browser-types.d.ts +3 -0
  107. package/dist/fetch/browser-types.d.ts.map +1 -0
  108. package/dist/fetch/browser-types.js +45 -0
  109. package/dist/fetch/browser-types.js.map +1 -0
  110. package/dist/fetch/cdp-client.d.ts +9 -0
  111. package/dist/fetch/cdp-client.d.ts.map +1 -0
  112. package/dist/fetch/cdp-client.js +90 -0
  113. package/dist/fetch/cdp-client.js.map +1 -0
  114. package/dist/fetch/lightpanda.d.ts +28 -0
  115. package/dist/fetch/lightpanda.d.ts.map +1 -0
  116. package/dist/fetch/lightpanda.js +177 -0
  117. package/dist/fetch/lightpanda.js.map +1 -0
  118. package/dist/fetch/router.d.ts +4 -1
  119. package/dist/fetch/router.d.ts.map +1 -1
  120. package/dist/fetch/router.js +8 -2
  121. package/dist/fetch/router.js.map +1 -1
  122. package/dist/index.js +32 -3
  123. package/dist/index.js.map +1 -1
  124. package/dist/instructions.d.ts +29 -0
  125. package/dist/instructions.d.ts.map +1 -0
  126. package/dist/instructions.js +176 -0
  127. package/dist/instructions.js.map +1 -0
  128. package/dist/logger.d.ts +1 -1
  129. package/dist/logger.d.ts.map +1 -1
  130. package/dist/plugins/loader.d.ts +20 -0
  131. package/dist/plugins/loader.d.ts.map +1 -0
  132. package/dist/plugins/loader.js +162 -0
  133. package/dist/plugins/loader.js.map +1 -0
  134. package/dist/plugins/registry.d.ts +26 -0
  135. package/dist/plugins/registry.d.ts.map +1 -0
  136. package/dist/plugins/registry.js +68 -0
  137. package/dist/plugins/registry.js.map +1 -0
  138. package/dist/plugins/validate.d.ts +9 -0
  139. package/dist/plugins/validate.d.ts.map +1 -0
  140. package/dist/plugins/validate.js +70 -0
  141. package/dist/plugins/validate.js.map +1 -0
  142. package/dist/repl/commands/agent.d.ts +5 -0
  143. package/dist/repl/commands/agent.d.ts.map +1 -0
  144. package/dist/repl/commands/agent.js +48 -0
  145. package/dist/repl/commands/agent.js.map +1 -0
  146. package/dist/repl/commands/cache.d.ts +4 -0
  147. package/dist/repl/commands/cache.d.ts.map +1 -0
  148. package/dist/repl/commands/cache.js +44 -0
  149. package/dist/repl/commands/cache.js.map +1 -0
  150. package/dist/repl/commands/crawl.d.ts +7 -0
  151. package/dist/repl/commands/crawl.d.ts.map +1 -0
  152. package/dist/repl/commands/crawl.js +42 -0
  153. package/dist/repl/commands/crawl.js.map +1 -0
  154. package/dist/repl/commands/extract.d.ts +5 -0
  155. package/dist/repl/commands/extract.d.ts.map +1 -0
  156. package/dist/repl/commands/extract.js +37 -0
  157. package/dist/repl/commands/extract.js.map +1 -0
  158. package/dist/repl/commands/fetch.d.ts +5 -0
  159. package/dist/repl/commands/fetch.d.ts.map +1 -0
  160. package/dist/repl/commands/fetch.js +53 -0
  161. package/dist/repl/commands/fetch.js.map +1 -0
  162. package/dist/repl/commands/find-similar.d.ts +5 -0
  163. package/dist/repl/commands/find-similar.d.ts.map +1 -0
  164. package/dist/repl/commands/find-similar.js +61 -0
  165. package/dist/repl/commands/find-similar.js.map +1 -0
  166. package/dist/repl/commands/research.d.ts +5 -0
  167. package/dist/repl/commands/research.d.ts.map +1 -0
  168. package/dist/repl/commands/research.js +50 -0
  169. package/dist/repl/commands/research.js.map +1 -0
  170. package/dist/repl/commands/search.d.ts +5 -0
  171. package/dist/repl/commands/search.d.ts.map +1 -0
  172. package/dist/repl/commands/search.js +62 -0
  173. package/dist/repl/commands/search.js.map +1 -0
  174. package/dist/repl/commands/types.d.ts +9 -0
  175. package/dist/repl/commands/types.d.ts.map +1 -0
  176. package/dist/repl/commands/types.js +2 -0
  177. package/dist/repl/commands/types.js.map +1 -0
  178. package/dist/repl/formatters.d.ts +13 -0
  179. package/dist/repl/formatters.d.ts.map +1 -0
  180. package/dist/repl/formatters.js +282 -0
  181. package/dist/repl/formatters.js.map +1 -0
  182. package/dist/repl/parser.d.ts +9 -0
  183. package/dist/repl/parser.d.ts.map +1 -0
  184. package/dist/repl/parser.js +84 -0
  185. package/dist/repl/parser.js.map +1 -0
  186. package/dist/repl/shell.d.ts +8 -0
  187. package/dist/repl/shell.d.ts.map +1 -0
  188. package/dist/repl/shell.js +177 -0
  189. package/dist/repl/shell.js.map +1 -0
  190. package/dist/research/decompose.d.ts +7 -0
  191. package/dist/research/decompose.d.ts.map +1 -0
  192. package/dist/research/decompose.js +195 -0
  193. package/dist/research/decompose.js.map +1 -0
  194. package/dist/research/pipeline.d.ts +5 -0
  195. package/dist/research/pipeline.d.ts.map +1 -0
  196. package/dist/research/pipeline.js +135 -0
  197. package/dist/research/pipeline.js.map +1 -0
  198. package/dist/research/synthesize.d.ts +10 -0
  199. package/dist/research/synthesize.d.ts.map +1 -0
  200. package/dist/research/synthesize.js +119 -0
  201. package/dist/research/synthesize.js.map +1 -0
  202. package/dist/search/answer-synthesis.d.ts +13 -0
  203. package/dist/search/answer-synthesis.d.ts.map +1 -0
  204. package/dist/search/answer-synthesis.js +120 -0
  205. package/dist/search/answer-synthesis.js.map +1 -0
  206. package/dist/search/context-formatter.d.ts +3 -0
  207. package/dist/search/context-formatter.d.ts.map +1 -0
  208. package/dist/search/context-formatter.js +56 -0
  209. package/dist/search/context-formatter.js.map +1 -0
  210. package/dist/search/find-similar.d.ts +5 -0
  211. package/dist/search/find-similar.d.ts.map +1 -0
  212. package/dist/search/find-similar.js +329 -0
  213. package/dist/search/find-similar.js.map +1 -0
  214. package/dist/search/multi-query.d.ts +22 -0
  215. package/dist/search/multi-query.d.ts.map +1 -0
  216. package/dist/search/multi-query.js +157 -0
  217. package/dist/search/multi-query.js.map +1 -0
  218. package/dist/search/rrf.d.ts +17 -0
  219. package/dist/search/rrf.d.ts.map +1 -0
  220. package/dist/search/rrf.js +48 -0
  221. package/dist/search/rrf.js.map +1 -0
  222. package/dist/search/sampling.d.ts +25 -0
  223. package/dist/search/sampling.d.ts.map +1 -0
  224. package/dist/search/sampling.js +52 -0
  225. package/dist/search/sampling.js.map +1 -0
  226. package/dist/server.d.ts +17 -0
  227. package/dist/server.d.ts.map +1 -1
  228. package/dist/server.js +366 -105
  229. package/dist/server.js.map +1 -1
  230. package/dist/tools/agent.d.ts +5 -0
  231. package/dist/tools/agent.d.ts.map +1 -0
  232. package/dist/tools/agent.js +67 -0
  233. package/dist/tools/agent.js.map +1 -0
  234. package/dist/tools/cache.d.ts +2 -1
  235. package/dist/tools/cache.d.ts.map +1 -1
  236. package/dist/tools/cache.js +56 -1
  237. package/dist/tools/cache.js.map +1 -1
  238. package/dist/tools/fetch.d.ts.map +1 -1
  239. package/dist/tools/fetch.js +26 -1
  240. package/dist/tools/fetch.js.map +1 -1
  241. package/dist/tools/find-similar.d.ts +5 -0
  242. package/dist/tools/find-similar.d.ts.map +1 -0
  243. package/dist/tools/find-similar.js +48 -0
  244. package/dist/tools/find-similar.js.map +1 -0
  245. package/dist/tools/research.d.ts +5 -0
  246. package/dist/tools/research.d.ts.map +1 -0
  247. package/dist/tools/research.js +50 -0
  248. package/dist/tools/research.js.map +1 -0
  249. package/dist/tools/search.d.ts +2 -1
  250. package/dist/tools/search.d.ts.map +1 -1
  251. package/dist/tools/search.js +179 -13
  252. package/dist/tools/search.js.map +1 -1
  253. package/dist/types.d.ts +147 -2
  254. package/dist/types.d.ts.map +1 -1
  255. package/package.json +43 -4
@@ -0,0 +1,28 @@
1
+ import { type Browser, type BrowserContext } from 'playwright';
2
+ export interface DomainRoutingStats {
3
+ domain: string;
4
+ successCount: number;
5
+ failureCount: number;
6
+ preferChromium: boolean;
7
+ lastSuccess?: string;
8
+ lastFailure?: string;
9
+ }
10
+ export interface ConnectionResult {
11
+ connected: boolean;
12
+ error?: string;
13
+ }
14
+ export declare function shouldUseLightpanda(domain: string): boolean;
15
+ export declare function recordSuccess(domain: string): void;
16
+ export declare function recordFailure(domain: string): void;
17
+ export declare function getDomainStats(domain: string): DomainRoutingStats | null;
18
+ export declare class LightpandaAdapter {
19
+ private browser;
20
+ private url;
21
+ constructor(url?: string);
22
+ connect(): Promise<ConnectionResult>;
23
+ disconnect(): Promise<void>;
24
+ isHealthy(): Promise<boolean>;
25
+ getContext(): Promise<BrowserContext | null>;
26
+ getBrowser(): Browser | null;
27
+ }
28
+ //# sourceMappingURL=lightpanda.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightpanda.d.ts","sourceRoot":"","sources":["../../src/fetch/lightpanda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAQzE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAoC3D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAgBlD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAuBlD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CA4BxE;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,GAAG,CAAS;gBAER,GAAG,CAAC,EAAE,MAAM;IAKlB,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAwBpC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAa3B,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAc7B,UAAU,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAgBlD,UAAU,IAAI,OAAO,GAAG,IAAI;CAG7B"}
@@ -0,0 +1,177 @@
1
+ import { chromium } from 'playwright';
2
+ import { getConfig } from '../config.js';
3
+ import { createLogger } from '../logger.js';
4
+ import { isCDPReachable } from './cdp-client.js';
5
+ import { getDatabase } from '../cache/db.js';
6
+ const log = createLogger('fetch');
7
+ export function shouldUseLightpanda(domain) {
8
+ try {
9
+ const config = getConfig();
10
+ if (!config.lightpandaEnabled || !config.lightpandaUrl) {
11
+ return false;
12
+ }
13
+ const db = getDatabase();
14
+ const row = db.prepare('SELECT failure_count, prefer_chromium FROM lightpanda_routing WHERE domain = ?').get(domain);
15
+ if (!row)
16
+ return true;
17
+ if (row.prefer_chromium === 1) {
18
+ log.debug('domain prefers chromium over lightpanda', { domain });
19
+ return false;
20
+ }
21
+ if (row.failure_count >= config.lightpandaFailureThreshold) {
22
+ log.debug('domain failure threshold reached for lightpanda', {
23
+ domain,
24
+ failures: row.failure_count,
25
+ threshold: config.lightpandaFailureThreshold,
26
+ });
27
+ return false;
28
+ }
29
+ return true;
30
+ }
31
+ catch (err) {
32
+ log.warn('shouldUseLightpanda check failed, defaulting to chromium', {
33
+ domain,
34
+ error: String(err),
35
+ });
36
+ return false;
37
+ }
38
+ }
39
+ export function recordSuccess(domain) {
40
+ try {
41
+ const db = getDatabase();
42
+ db.prepare(`
43
+ INSERT INTO lightpanda_routing (domain, success_count, last_success, last_updated)
44
+ VALUES (?, 1, datetime('now'), datetime('now'))
45
+ ON CONFLICT(domain) DO UPDATE SET
46
+ success_count = success_count + 1,
47
+ last_success = datetime('now'),
48
+ last_updated = datetime('now')
49
+ `).run(domain);
50
+ log.debug('recorded lightpanda success', { domain });
51
+ }
52
+ catch (err) {
53
+ log.warn('failed to record lightpanda success', { domain, error: String(err) });
54
+ }
55
+ }
56
+ export function recordFailure(domain) {
57
+ try {
58
+ const config = getConfig();
59
+ const db = getDatabase();
60
+ db.prepare(`
61
+ INSERT INTO lightpanda_routing (domain, failure_count, last_failure, last_updated)
62
+ VALUES (?, 1, datetime('now'), datetime('now'))
63
+ ON CONFLICT(domain) DO UPDATE SET
64
+ failure_count = failure_count + 1,
65
+ last_failure = datetime('now'),
66
+ last_updated = datetime('now'),
67
+ prefer_chromium = CASE
68
+ WHEN failure_count + 1 >= ?
69
+ THEN 1
70
+ ELSE prefer_chromium
71
+ END
72
+ `).run(domain, config.lightpandaFailureThreshold);
73
+ log.debug('recorded lightpanda failure', { domain });
74
+ }
75
+ catch (err) {
76
+ log.warn('failed to record lightpanda failure', { domain, error: String(err) });
77
+ }
78
+ }
79
+ export function getDomainStats(domain) {
80
+ try {
81
+ const db = getDatabase();
82
+ const row = db.prepare('SELECT * FROM lightpanda_routing WHERE domain = ?').get(domain);
83
+ if (!row)
84
+ return null;
85
+ return {
86
+ domain: row.domain,
87
+ successCount: row.success_count,
88
+ failureCount: row.failure_count,
89
+ preferChromium: row.prefer_chromium === 1,
90
+ lastSuccess: row.last_success ?? undefined,
91
+ lastFailure: row.last_failure ?? undefined,
92
+ };
93
+ }
94
+ catch (err) {
95
+ log.warn('getDomainStats failed', { domain, error: String(err) });
96
+ return null;
97
+ }
98
+ }
99
+ export class LightpandaAdapter {
100
+ browser = null;
101
+ url;
102
+ constructor(url) {
103
+ const config = getConfig();
104
+ this.url = url ?? config.lightpandaUrl ?? 'http://localhost:9222';
105
+ }
106
+ async connect() {
107
+ try {
108
+ const reachable = await isCDPReachable(this.url);
109
+ if (!reachable) {
110
+ log.debug('lightpanda CDP not reachable', { url: this.url });
111
+ return { connected: false, error: 'CDP endpoint not reachable' };
112
+ }
113
+ this.browser = await chromium.connectOverCDP(this.url);
114
+ log.info('connected to lightpanda via CDP', { url: this.url });
115
+ return { connected: true };
116
+ }
117
+ catch (err) {
118
+ log.warn('lightpanda connection failed', {
119
+ url: this.url,
120
+ error: err instanceof Error ? err.message : String(err),
121
+ });
122
+ this.browser = null;
123
+ return {
124
+ connected: false,
125
+ error: err instanceof Error ? err.message : String(err),
126
+ };
127
+ }
128
+ }
129
+ async disconnect() {
130
+ try {
131
+ if (this.browser) {
132
+ await this.browser.close();
133
+ this.browser = null;
134
+ log.debug('disconnected from lightpanda');
135
+ }
136
+ }
137
+ catch (err) {
138
+ log.warn('lightpanda disconnect error', { error: String(err) });
139
+ this.browser = null;
140
+ }
141
+ }
142
+ async isHealthy() {
143
+ try {
144
+ if (!this.browser)
145
+ return false;
146
+ if (typeof this.browser.isConnected === 'function') {
147
+ if (!this.browser.isConnected())
148
+ return false;
149
+ }
150
+ return await isCDPReachable(this.url);
151
+ }
152
+ catch {
153
+ return false;
154
+ }
155
+ }
156
+ async getContext() {
157
+ try {
158
+ if (!this.browser) {
159
+ const result = await this.connect();
160
+ if (!result.connected || !this.browser)
161
+ return null;
162
+ }
163
+ const contexts = this.browser.contexts();
164
+ if (contexts.length > 0)
165
+ return contexts[0];
166
+ return await this.browser.newContext();
167
+ }
168
+ catch (err) {
169
+ log.warn('failed to get lightpanda context', { error: String(err) });
170
+ return null;
171
+ }
172
+ }
173
+ getBrowser() {
174
+ return this.browser;
175
+ }
176
+ }
177
+ //# sourceMappingURL=lightpanda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightpanda.js","sourceRoot":"","sources":["../../src/fetch/lightpanda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqC,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAgBlC,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CACpB,gFAAgF,CACjF,CAAC,GAAG,CAAC,MAAM,CAAmE,CAAC;QAEhF,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QAEtB,IAAI,GAAG,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACjE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,GAAG,CAAC,aAAa,IAAI,MAAM,CAAC,0BAA0B,EAAE,CAAC;YAC3D,GAAG,CAAC,KAAK,CAAC,iDA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1,9 +1,10 @@
1
- import type { RawFetchResult } from '../types.js';
1
+ import type { RawFetchResult, BrowserAction } from '../types.js';
2
2
  export interface RouterFetchOptions {
3
3
  renderJs?: 'auto' | 'always' | 'never';
4
4
  useAuth?: boolean;
5
5
  headers?: Record<string, string>;
6
6
  screenshot?: boolean;
7
+ actions?: BrowserAction[];
7
8
  }
8
9
  export interface HttpClient {
9
10
  fetch(url: string, options?: {
@@ -25,6 +26,8 @@ export interface BrowserPoolInterface {
25
26
  storageStatePath?: string;
26
27
  userDataDir?: string;
27
28
  screenshot?: boolean;
29
+ actions?: BrowserAction[];
30
+ cdpUrl?: string;
28
31
  }): Promise<RawFetchResult>;
29
32
  }
30
33
  interface DomainStats {
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/fetch/router.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CACH,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GACjE,OAAO,CAAC;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;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MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC;IAoEnF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIvD,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,gBAAgB;CAczB"}
@@ -11,14 +11,20 @@ export class SmartRouter {
11
11
  this.browserPool = browserPool;
12
12
  }
13
13
  async fetch(url, options = {}) {
14
- const { renderJs = 'auto', useAuth = false, headers, screenshot } = options;
14
+ const { renderJs = 'auto', useAuth = false, headers, screenshot, actions } = options;
15
15
  const config = getConfig();
16
16
  const logger = createLogger('fetch');
17
17
  const threshold = config.browserFallbackThreshold;
18
18
  const domain = new URL(url).hostname;
19
+ // Actions always force Playwright --- actions need a live browser page
20
+ if (actions && actions.length > 0) {
21
+ const authOptions = useAuth ? (await getAuthOptions() ?? {}) : {};
22
+ logger.debug('routing to playwright', { url, reason: 'actions present' });
23
+ return this.browserPool.fetchWithBrowser(url, { headers, screenshot, actions, ...authOptions });
24
+ }
19
25
  // Always Playwright for auth or explicit override
20
26
  if (renderJs === 'always' || useAuth) {
21
- const authOptions = useAuth ? (getAuthOptions() ?? {}) : {};
27
+ const authOptions = useAuth ? (await getAuthOptions() ?? {}) : {};
22
28
  logger.debug('routing to playwright', { url, reason: useAuth ? 'auth' : 'render_js=always' });
23
29
  return this.browserPool.fetchWithBrowser(url, { headers, screenshot, ...authOptions });
24
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/fetch/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAqC3C,MAAM,OAAO,WAAW;IAIH;IACA;IAJF,SAAS,GAAG,IA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AC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAEO,WAAW,CAAC,MAAc;QAChC,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,YAAY,EAAE,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,gBAAgB,CACtB,MAAgD;QAEhD,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC;IACJ,CAAC;CACF"}
package/dist/index.js CHANGED
@@ -4,6 +4,9 @@ import { runWarmup } from './cli/warmup.js';
4
4
  import { runDaemon } from './cli/daemon.js';
5
5
  import { runHealthCheck } from './cli/health.js';
6
6
  import { runDoctor } from './cli/doctor.js';
7
+ import { runShell } from './cli/shell.js';
8
+ import { runAuth } from './cli/auth.js';
9
+ import { runPluginCommand } from './cli/plugin.js';
7
10
  import { getConfig } from './config.js';
8
11
  import { startServer } from './server.js';
9
12
  const { command, args } = parseCommand(process.argv.slice(2));
@@ -14,16 +17,42 @@ switch (command) {
14
17
  case 'serve':
15
18
  runDaemon(args);
16
19
  break;
17
- case 'health':
18
- runHealthCheck();
20
+ case 'health': {
21
+ const exitCode = await runHealthCheck();
22
+ process.exit(exitCode);
19
23
  break;
24
+ }
20
25
  case 'doctor': {
21
26
  const code = await runDoctor(getConfig().dataDir);
22
27
  process.exit(code);
23
28
  break;
24
29
  }
25
- case 'mcp':
30
+ case 'auth': {
31
+ const authCode = await runAuth(args);
32
+ process.exit(authCode);
33
+ break;
34
+ }
35
+ case 'shell':
36
+ await runShell(args);
37
+ break;
38
+ case 'plugin':
39
+ runPluginCommand(args);
40
+ break;
41
+ case 'mcp': {
42
+ const config = getConfig();
43
+ try {
44
+ const { tryConnectDaemon } = await import('./daemon/proxy.js');
45
+ const report = await tryConnectDaemon(config.daemonPort, config.daemonHost);
46
+ if (report) {
47
+ process.stderr.write(`[wigolo] Daemon detected at ${config.daemonHost}:${config.daemonPort} ` +
48
+ `(status: ${report.status}). Full proxy deferred to v2.1; starting local server.\n`);
49
+ }
50
+ }
51
+ catch {
52
+ // Daemon proxy module may not be available -- fall through to local server
53
+ }
26
54
  await startServer();
27
55
  break;
56
+ }
28
57
  }
29
58
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,QAAQ;QACX,MAAM,S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AC;QACpB,MAAM;IACR,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * LLM knowledge layer for wigolo.
3
+ *
4
+ * Two layers. They do different jobs and must not repeat each other:
5
+ *
6
+ * Layer 1 — WIGOLO_INSTRUCTIONS: server-level STRATEGY. Injected into the
7
+ * LLM system prompt once per session by compatible MCP clients. Answers
8
+ * "when do I reach for wigolo? which of its tools fits this situation?".
9
+ *
10
+ * Layer 2 — TOOL_DESCRIPTIONS: per-tool TACTICS. Seen every time the LLM is
11
+ * picking a tool. Answers "what does this tool do, which parameters matter,
12
+ * what does the output look like?".
13
+ *
14
+ * Parameter schemas (types, enums, required/optional) belong on the JSON
15
+ * Schema, not here. Installation/configuration is for humans, not LLMs.
16
+ */
17
+ export declare const WIGOLO_INSTRUCTIONS = "Wigolo is a local-first web access layer: search the open web, fetch pages, crawl sites, extract structured data, find related content, run multi-step research, and execute agent-driven data gathering. All results land in a local SQLite cache that persists across sessions.\n\n## When to use which tool\n\n- `search` -- you need information on a topic but do not have a URL yet. Pass a query string or an array of 3-5 semantically varied keyword forms for broader coverage.\n- `fetch` -- you already have a specific URL to read.\n- `crawl` -- you need multiple pages from the same site (docs, wikis, references).\n- `cache` -- you want to know if the content is already on disk from an earlier read.\n- `extract` -- you need specific data points (tables, metadata, schema-shaped fields) rather than a whole page as markdown.\n- `find_similar` -- you have a URL or concept and want related content from the cache or web. Useful for \"more like this\" discovery.\n- `research` -- you have a complex question that needs multi-step investigation: question decomposition, parallel search, source synthesis into a report. Set `depth` to control thoroughness.\n- `agent` -- you need to gather structured or unstructured data from multiple sources based on a natural-language prompt. Provides full step transparency.\n\n## Routing by intent\n\n| Intent | Tool | Key parameters |\n|--------|------|----------------|\n| Documentation lookup | `search` | `include_domains: [\"react.dev\", \"docs.python.org\"]`, `category: \"docs\"` |\n| Error debugging | `search` | exact error string as query, `category: \"code\"` |\n| Library research | `crawl` | seed URL of docs site, `strategy: \"sitemap\"`, then `cache` for later queries |\n| Related content | `find_similar` | `url` of a known good page, or `concept` as free text |\n| Direct answer | `search` | `format: \"answer\"` for a synthesized direct response |\n| Comprehensive research | `research` | `depth: \"comprehensive\"`, optional `include_domains` to scope |\n| Data gathering | `agent` | natural-language `prompt`, optional `schema` for structured output |\n| Structured extraction | `extract` | `mode: \"schema\"` with a JSON Schema, or `mode: \"tables\"` |\n| Site inventory | `crawl` | `strategy: \"map\"` for URL-only discovery, no content fetched |\n\n## Check the cache before going to the network\n\nBefore every `search` or `fetch`, consider a `cache` call with the query text or URL pattern. Pages read in this or a prior session return instantly with their full markdown -- no network, no rate limits. The `research` and `agent` tools check the cache internally, so you do not need a separate call for those.\n\n## Multi-query search strategy\n\nFor broad or exploratory queries, pass an array of 3-5 semantically varied keyword forms rather than a single natural-language question. Example: instead of \"how does React handle state management\", pass `[\"react state management\", \"useState useReducer patterns\", \"react hooks state\", \"react context vs redux\"]`. The search tool deduplicates across sub-queries automatically.\n\n## Pick the right strategy\n\n- For documentation sites, prefer `crawl` with `strategy: \"sitemap\"` -- it is faster and more complete than BFS because it reads sitemap.xml directly.\n- When you only need to discover what pages exist on a site, use `crawl` with `strategy: \"map\"`. It returns URLs only, no content, and is far cheaper than a full crawl. Follow up with targeted `fetch` calls.\n- For structured data (prices, specs, listings, table rows), use `extract` with `mode: \"schema\"` or `mode: \"tables\"`. Reach for `fetch` only when you want the whole page as markdown.\n- For complex questions requiring synthesis from multiple sources, use `research` instead of manually chaining `search` + `fetch` calls.\n- For natural-language data gathering tasks (\"find the pricing for the top 5 CRM tools\"), use `agent` with an optional `schema` to structure the output.\n\n## Scope searches, do not just broaden queries\n\n`search` accepts `include_domains` (e.g. `[\"react.dev\", \"developer.mozilla.org\"]`) and a `category` such as `\"docs\"`, `\"code\"`, `\"news\"`, or `\"papers\"`. A scoped query usually beats a broader query with post-filtering.\n\n## Performance\n\n- `max_results: 3` for focused lookups; `5` is the default; `10+` only for broad research.\n- `fetch` with `section: \"Heading Name\"` returns just the content under that heading. Cheaper and more relevant than the whole page.\n- Repeated fetches of the same URL are free -- served directly from the SQLite cache.\n- `research` with `depth: \"quick\"` is fast (~15s) and sufficient for most factual questions. Reserve `\"comprehensive\"` for topics requiring deep investigation.\n- `agent` respects `max_pages` (default 10) and `max_time_ms` (default 60s) to bound resource usage.\n\n## Capabilities worth knowing\n\n- Localhost URLs work: `http://localhost:3000`, `http://127.0.0.1:8080`, and similar. Useful for reading local dev servers and internal docs.\n- `use_auth: true` on `fetch` and `crawl` reuses the user's configured browser session for pages behind a login.\n- `cache` accepts FTS5 query syntax (`AND`, `OR`, `NOT`, `\"exact phrase\"`) for precise lookups.\n- `crawl` accepts regex `include_patterns` and `exclude_patterns` to stay inside a section of a large site.\n- `find_similar` uses cached embeddings when available -- no network call needed if the content has been seen before.\n- `research` and `agent` use MCP requestSampling for intelligent decomposition and synthesis when the client supports it. Without sampling support, they return raw sources in context format.";
18
+ export declare const TOOL_DESCRIPTIONS: {
19
+ readonly fetch: "Fetch a single URL and return clean markdown. Use when you have a specific URL to read. Automatically detects if JavaScript rendering is needed.\n\nKey parameters:\n- section: extract content under a specific heading (e.g., section: \"API Reference\") -- faster than reading the whole page\n- use_auth: true to use stored browser session for authenticated/private pages\n- render_js: \"auto\" (default, detects JS need), \"always\" (force browser), \"never\" (HTTP only, fastest)\n- headers: custom HTTP headers if needed\n\nReturns title, markdown content, links, images, and metadata. Result is cached locally -- subsequent fetches of the same URL return instantly. Works with localhost URLs (localhost:3000, etc.) for reading local dev servers.";
20
+ readonly search: "Search the web and return full markdown content from top results. Use for finding information on any topic -- returns extracted page content, not just snippets.\n\nKey parameters:\n- query: a search string, or an array of 3-5 semantically varied keyword forms for broader coverage. Arrays are deduplicated and merged automatically.\n- include_domains/exclude_domains: scope results to specific sites (e.g., include_domains: [\"react.dev\"])\n- category: \"general\", \"news\", \"code\", \"docs\", \"papers\" -- filters by content type\n- from_date/to_date: ISO dates for time-bounded queries\n- max_results: default 5. Use 3 for focused queries, 10+ for research.\n- format: \"full\" (default, structured JSON), \"context\" (single token-budgeted string for LLM injection), \"answer\" (synthesized direct answer via requestSampling), \"stream_answer\" (streaming answer chunks)\n\nThe \"answer\" format uses the MCP client's sampling capability to synthesize a direct response from search results. If sampling is not supported, falls back to \"context\" format. \"stream_answer\" sends incremental progress notifications.\n\nResults include title, URL, relevance_score, and full markdown_content per result. Previously fetched pages are served from local cache.";
21
+ readonly crawl: "Crawl a website starting from a URL and return content from multiple pages. Use for indexing documentation sites, wikis, or any multi-page resource.\n\nKey parameters:\n- strategy: \"bfs\" (breadth-first, default), \"dfs\" (depth-first), \"sitemap\" (use sitemap.xml -- fastest for doc sites), \"map\" (URL discovery only, no content -- fastest for scoping a site)\n- max_depth: how many links deep to follow (default 2)\n- max_pages: maximum pages to fetch (default 20)\n- include_patterns/exclude_patterns: regex filters on URLs\n\nReturns an array of pages with title, markdown, and depth. Content is deduplicated across pages (repeated nav/headers/footers stripped). All pages are cached for later cache queries.";
22
+ readonly cache: "Search previously fetched content without hitting the network. Use before searching the web -- if relevant content was already fetched or crawled, this returns it instantly.\n\nKey parameters:\n- query: full-text search over cached markdown and titles (supports FTS5 syntax: AND, OR, NOT, \"phrase match\")\n- url_pattern: glob filter on URLs (e.g., \"*example.com*\")\n- since: ISO date -- only results cached after this date\n- stats: true to get cache size, entry count, oldest/newest dates\n- clear: true to delete matching entries\n\nReturns matching cached pages with full markdown content. Cache persists across sessions in local SQLite.";
23
+ readonly extract: "Extract structured data from a URL or raw HTML. Use when you need specific data points, tables, or metadata rather than full page markdown.\n\nKey parameters:\n- mode: \"selector\" (CSS selector -> text), \"tables\" (HTML tables -> JSON rows), \"metadata\" (title/author/date/description), \"schema\" (JSON Schema -> heuristic field extraction)\n- css_selector: required for mode=\"selector\" -- any valid CSS selector\n- schema: for mode=\"schema\", a JSON Schema object describing the fields to extract\n- multiple: true to return array of all matches (mode=\"selector\" only)\n\nFor mode=\"tables\", returns array of table objects with headers and row data. For mode=\"schema\", pass { price: \"string\", name: \"string\" } and get structured fields extracted from the page.";
24
+ readonly find_similar: "Find content related to a URL or concept. Use when you have a known-good page or topic and want to discover similar resources from the cache or web.\n\nKey parameters:\n- url: a URL to find content similar to. The page's content and embeddings are used for similarity matching.\n- concept: free-text description of what you want similar content for. Use when you do not have a specific URL.\n- max_results: number of similar items to return (default 5)\n- include_cached: true (default) to search the local cache first, false to skip cache and search the web only\n- threshold: minimum similarity score (0-1, default 0.5) -- higher values return fewer, more relevant results\n\nProvide either url or concept (not both). Results are ranked by cosine similarity of embeddings. Cached content with embeddings is searched first for instant results. If fewer than max_results are found in cache, a web search supplements the results.\n\nReturns title, URL, similarity_score, and markdown_content per result.";
25
+ readonly research: "Run multi-step research on a complex question. Decomposes the question into sub-queries, searches in parallel, fetches top sources, and synthesizes a report with citations.\n\nKey parameters:\n- question: the research question to investigate\n- depth: \"quick\" (~15s, 2 sub-queries, 5-8 sources), \"standard\" (~40s, 4 sub-queries, 10-15 sources, default), \"comprehensive\" (~80s, 7 sub-queries, 20-25 sources)\n- max_sources: override the default source count for the chosen depth\n- include_domains/exclude_domains: scope research to specific sites\n- schema: optional JSON Schema -- if provided, the report is structured to extract fields matching the schema\n- stream: true to receive progress notifications as each research phase completes\n\nThe pipeline: (1) decompose question into sub-queries, (2) parallel search across sub-queries, (3) fetch and extract top unique sources, (4) synthesize report with citations from all sources, (5) optionally structure report fields if schema is provided.\n\nUses MCP requestSampling for intelligent decomposition and synthesis. Without sampling support, returns raw sources in context format with sampling_supported: false.\n\nReturns report (markdown), citations array, sources with full content, sub_queries used, depth level, and total_time_ms.";
26
+ readonly agent: "Execute a natural-language data gathering task. Plans search queries and URLs from a prompt, executes them in parallel, and synthesizes results. Full step transparency.\n\nKey parameters:\n- prompt: natural-language description of what data to gather (e.g., \"find pricing for the top 5 CRM tools\")\n- urls: optional array of specific URLs to include in the gathering\n- schema: optional JSON Schema -- if provided, extracts structured data matching the schema from each page and merges results\n- max_pages: maximum pages to fetch (default 10)\n- max_time_ms: maximum execution time in milliseconds (default 60000)\n- stream: true to receive progress notifications as each step completes\n\nThe pipeline: (1) plan -- interpret prompt to determine search queries and URLs to visit, (2) execute -- run searches and fetch URLs in parallel within budget, (3) extract -- if schema provided, apply schema extraction to each page and merge, (4) synthesize -- produce natural-language or structured result.\n\nThe steps array in the output provides full transparency into every action taken (plan, search, fetch, extract, synthesize) with timing. This differentiates from black-box alternatives.\n\nUses MCP requestSampling for planning and synthesis. Without sampling support, uses keyword extraction for planning and returns raw content.\n\nReturns result (string or structured object), sources array, pages_fetched count, steps array with action/detail/time_ms, total_time_ms, and sampling_supported flag.";
27
+ };
28
+ export type ToolName = keyof typeof TOOL_DESCRIPTIONS;
29
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,mBAAmB,yiLA8DmK,CAAC;AAEpM,eAAO,MAAM,iBAAiB;;;;;;;;;CAsGpB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,iBAAiB,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * LLM knowledge layer for wigolo.
3
+ *
4
+ * Two layers. They do different jobs and must not repeat each other:
5
+ *
6
+ * Layer 1 — WIGOLO_INSTRUCTIONS: server-level STRATEGY. Injected into the
7
+ * LLM system prompt once per session by compatible MCP clients. Answers
8
+ * "when do I reach for wigolo? which of its tools fits this situation?".
9
+ *
10
+ * Layer 2 — TOOL_DESCRIPTIONS: per-tool TACTICS. Seen every time the LLM is
11
+ * picking a tool. Answers "what does this tool do, which parameters matter,
12
+ * what does the output look like?".
13
+ *
14
+ * Parameter schemas (types, enums, required/optional) belong on the JSON
15
+ * Schema, not here. Installation/configuration is for humans, not LLMs.
16
+ */
17
+ export const WIGOLO_INSTRUCTIONS = `Wigolo is a local-first web access layer: search the open web, fetch pages, crawl sites, extract structured data, find related content, run multi-step research, and execute agent-driven data gathering. All results land in a local SQLite cache that persists across sessions.
18
+
19
+ ## When to use which tool
20
+
21
+ - \`search\` -- you need information on a topic but do not have a URL yet. Pass a query string or an array of 3-5 semantically varied keyword forms for broader coverage.
22
+ - \`fetch\` -- you already have a specific URL to read.
23
+ - \`crawl\` -- you need multiple pages from the same site (docs, wikis, references).
24
+ - \`cache\` -- you want to know if the content is already on disk from an earlier read.
25
+ - \`extract\` -- you need specific data points (tables, metadata, schema-shaped fields) rather than a whole page as markdown.
26
+ - \`find_similar\` -- you have a URL or concept and want related content from the cache or web. Useful for "more like this" discovery.
27
+ - \`research\` -- you have a complex question that needs multi-step investigation: question decomposition, parallel search, source synthesis into a report. Set \`depth\` to control thoroughness.
28
+ - \`agent\` -- you need to gather structured or unstructured data from multiple sources based on a natural-language prompt. Provides full step transparency.
29
+
30
+ ## Routing by intent
31
+
32
+ | Intent | Tool | Key parameters |
33
+ |--------|------|----------------|
34
+ | Documentation lookup | \`search\` | \`include_domains: ["react.dev", "docs.python.org"]\`, \`category: "docs"\` |
35
+ | Error debugging | \`search\` | exact error string as query, \`category: "code"\` |
36
+ | Library research | \`crawl\` | seed URL of docs site, \`strategy: "sitemap"\`, then \`cache\` for later queries |
37
+ | Related content | \`find_similar\` | \`url\` of a known good page, or \`concept\` as free text |
38
+ | Direct answer | \`search\` | \`format: "answer"\` for a synthesized direct response |
39
+ | Comprehensive research | \`research\` | \`depth: "comprehensive"\`, optional \`include_domains\` to scope |
40
+ | Data gathering | \`agent\` | natural-language \`prompt\`, optional \`schema\` for structured output |
41
+ | Structured extraction | \`extract\` | \`mode: "schema"\` with a JSON Schema, or \`mode: "tables"\` |
42
+ | Site inventory | \`crawl\` | \`strategy: "map"\` for URL-only discovery, no content fetched |
43
+
44
+ ## Check the cache before going to the network
45
+
46
+ Before every \`search\` or \`fetch\`, consider a \`cache\` call with the query text or URL pattern. Pages read in this or a prior session return instantly with their full markdown -- no network, no rate limits. The \`research\` and \`agent\` tools check the cache internally, so you do not need a separate call for those.
47
+
48
+ ## Multi-query search strategy
49
+
50
+ For broad or exploratory queries, pass an array of 3-5 semantically varied keyword forms rather than a single natural-language question. Example: instead of "how does React handle state management", pass \`["react state management", "useState useReducer patterns", "react hooks state", "react context vs redux"]\`. The search tool deduplicates across sub-queries automatically.
51
+
52
+ ## Pick the right strategy
53
+
54
+ - For documentation sites, prefer \`crawl\` with \`strategy: "sitemap"\` -- it is faster and more complete than BFS because it reads sitemap.xml directly.
55
+ - When you only need to discover what pages exist on a site, use \`crawl\` with \`strategy: "map"\`. It returns URLs only, no content, and is far cheaper than a full crawl. Follow up with targeted \`fetch\` calls.
56
+ - For structured data (prices, specs, listings, table rows), use \`extract\` with \`mode: "schema"\` or \`mode: "tables"\`. Reach for \`fetch\` only when you want the whole page as markdown.
57
+ - For complex questions requiring synthesis from multiple sources, use \`research\` instead of manually chaining \`search\` + \`fetch\` calls.
58
+ - For natural-language data gathering tasks ("find the pricing for the top 5 CRM tools"), use \`agent\` with an optional \`schema\` to structure the output.
59
+
60
+ ## Scope searches, do not just broaden queries
61
+
62
+ \`search\` accepts \`include_domains\` (e.g. \`["react.dev", "developer.mozilla.org"]\`) and a \`category\` such as \`"docs"\`, \`"code"\`, \`"news"\`, or \`"papers"\`. A scoped query usually beats a broader query with post-filtering.
63
+
64
+ ## Performance
65
+
66
+ - \`max_results: 3\` for focused lookups; \`5\` is the default; \`10+\` only for broad research.
67
+ - \`fetch\` with \`section: "Heading Name"\` returns just the content under that heading. Cheaper and more relevant than the whole page.
68
+ - Repeated fetches of the same URL are free -- served directly from the SQLite cache.
69
+ - \`research\` with \`depth: "quick"\` is fast (~15s) and sufficient for most factual questions. Reserve \`"comprehensive"\` for topics requiring deep investigation.
70
+ - \`agent\` respects \`max_pages\` (default 10) and \`max_time_ms\` (default 60s) to bound resource usage.
71
+
72
+ ## Capabilities worth knowing
73
+
74
+ - Localhost URLs work: \`http://localhost:3000\`, \`http://127.0.0.1:8080\`, and similar. Useful for reading local dev servers and internal docs.
75
+ - \`use_auth: true\` on \`fetch\` and \`crawl\` reuses the user's configured browser session for pages behind a login.
76
+ - \`cache\` accepts FTS5 query syntax (\`AND\`, \`OR\`, \`NOT\`, \`"exact phrase"\`) for precise lookups.
77
+ - \`crawl\` accepts regex \`include_patterns\` and \`exclude_patterns\` to stay inside a section of a large site.
78
+ - \`find_similar\` uses cached embeddings when available -- no network call needed if the content has been seen before.
79
+ - \`research\` and \`agent\` use MCP requestSampling for intelligent decomposition and synthesis when the client supports it. Without sampling support, they return raw sources in context format.`;
80
+ export const TOOL_DESCRIPTIONS = {
81
+ fetch: `Fetch a single URL and return clean markdown. Use when you have a specific URL to read. Automatically detects if JavaScript rendering is needed.
82
+
83
+ Key parameters:
84
+ - section: extract content under a specific heading (e.g., section: "API Reference") -- faster than reading the whole page
85
+ - use_auth: true to use stored browser session for authenticated/private pages
86
+ - render_js: "auto" (default, detects JS need), "always" (force browser), "never" (HTTP only, fastest)
87
+ - headers: custom HTTP headers if needed
88
+
89
+ Returns title, markdown content, links, images, and metadata. Result is cached locally -- subsequent fetches of the same URL return instantly. Works with localhost URLs (localhost:3000, etc.) for reading local dev servers.`,
90
+ search: `Search the web and return full markdown content from top results. Use for finding information on any topic -- returns extracted page content, not just snippets.
91
+
92
+ Key parameters:
93
+ - query: a search string, or an array of 3-5 semantically varied keyword forms for broader coverage. Arrays are deduplicated and merged automatically.
94
+ - include_domains/exclude_domains: scope results to specific sites (e.g., include_domains: ["react.dev"])
95
+ - category: "general", "news", "code", "docs", "papers" -- filters by content type
96
+ - from_date/to_date: ISO dates for time-bounded queries
97
+ - max_results: default 5. Use 3 for focused queries, 10+ for research.
98
+ - format: "full" (default, structured JSON), "context" (single token-budgeted string for LLM injection), "answer" (synthesized direct answer via requestSampling), "stream_answer" (streaming answer chunks)
99
+
100
+ The "answer" format uses the MCP client's sampling capability to synthesize a direct response from search results. If sampling is not supported, falls back to "context" format. "stream_answer" sends incremental progress notifications.
101
+
102
+ Results include title, URL, relevance_score, and full markdown_content per result. Previously fetched pages are served from local cache.`,
103
+ crawl: `Crawl a website starting from a URL and return content from multiple pages. Use for indexing documentation sites, wikis, or any multi-page resource.
104
+
105
+ Key parameters:
106
+ - strategy: "bfs" (breadth-first, default), "dfs" (depth-first), "sitemap" (use sitemap.xml -- fastest for doc sites), "map" (URL discovery only, no content -- fastest for scoping a site)
107
+ - max_depth: how many links deep to follow (default 2)
108
+ - max_pages: maximum pages to fetch (default 20)
109
+ - include_patterns/exclude_patterns: regex filters on URLs
110
+
111
+ Returns an array of pages with title, markdown, and depth. Content is deduplicated across pages (repeated nav/headers/footers stripped). All pages are cached for later cache queries.`,
112
+ cache: `Search previously fetched content without hitting the network. Use before searching the web -- if relevant content was already fetched or crawled, this returns it instantly.
113
+
114
+ Key parameters:
115
+ - query: full-text search over cached markdown and titles (supports FTS5 syntax: AND, OR, NOT, "phrase match")
116
+ - url_pattern: glob filter on URLs (e.g., "*example.com*")
117
+ - since: ISO date -- only results cached after this date
118
+ - stats: true to get cache size, entry count, oldest/newest dates
119
+ - clear: true to delete matching entries
120
+
121
+ Returns matching cached pages with full markdown content. Cache persists across sessions in local SQLite.`,
122
+ extract: `Extract structured data from a URL or raw HTML. Use when you need specific data points, tables, or metadata rather than full page markdown.
123
+
124
+ Key parameters:
125
+ - mode: "selector" (CSS selector -> text), "tables" (HTML tables -> JSON rows), "metadata" (title/author/date/description), "schema" (JSON Schema -> heuristic field extraction)
126
+ - css_selector: required for mode="selector" -- any valid CSS selector
127
+ - schema: for mode="schema", a JSON Schema object describing the fields to extract
128
+ - multiple: true to return array of all matches (mode="selector" only)
129
+
130
+ For mode="tables", returns array of table objects with headers and row data. For mode="schema", pass { price: "string", name: "string" } and get structured fields extracted from the page.`,
131
+ find_similar: `Find content related to a URL or concept. Use when you have a known-good page or topic and want to discover similar resources from the cache or web.
132
+
133
+ Key parameters:
134
+ - url: a URL to find content similar to. The page's content and embeddings are used for similarity matching.
135
+ - concept: free-text description of what you want similar content for. Use when you do not have a specific URL.
136
+ - max_results: number of similar items to return (default 5)
137
+ - include_cached: true (default) to search the local cache first, false to skip cache and search the web only
138
+ - threshold: minimum similarity score (0-1, default 0.5) -- higher values return fewer, more relevant results
139
+
140
+ Provide either url or concept (not both). Results are ranked by cosine similarity of embeddings. Cached content with embeddings is searched first for instant results. If fewer than max_results are found in cache, a web search supplements the results.
141
+
142
+ Returns title, URL, similarity_score, and markdown_content per result.`,
143
+ research: `Run multi-step research on a complex question. Decomposes the question into sub-queries, searches in parallel, fetches top sources, and synthesizes a report with citations.
144
+
145
+ Key parameters:
146
+ - question: the research question to investigate
147
+ - depth: "quick" (~15s, 2 sub-queries, 5-8 sources), "standard" (~40s, 4 sub-queries, 10-15 sources, default), "comprehensive" (~80s, 7 sub-queries, 20-25 sources)
148
+ - max_sources: override the default source count for the chosen depth
149
+ - include_domains/exclude_domains: scope research to specific sites
150
+ - schema: optional JSON Schema -- if provided, the report is structured to extract fields matching the schema
151
+ - stream: true to receive progress notifications as each research phase completes
152
+
153
+ The pipeline: (1) decompose question into sub-queries, (2) parallel search across sub-queries, (3) fetch and extract top unique sources, (4) synthesize report with citations from all sources, (5) optionally structure report fields if schema is provided.
154
+
155
+ Uses MCP requestSampling for intelligent decomposition and synthesis. Without sampling support, returns raw sources in context format with sampling_supported: false.
156
+
157
+ Returns report (markdown), citations array, sources with full content, sub_queries used, depth level, and total_time_ms.`,
158
+ agent: `Execute a natural-language data gathering task. Plans search queries and URLs from a prompt, executes them in parallel, and synthesizes results. Full step transparency.
159
+
160
+ Key parameters:
161
+ - prompt: natural-language description of what data to gather (e.g., "find pricing for the top 5 CRM tools")
162
+ - urls: optional array of specific URLs to include in the gathering
163
+ - schema: optional JSON Schema -- if provided, extracts structured data matching the schema from each page and merges results
164
+ - max_pages: maximum pages to fetch (default 10)
165
+ - max_time_ms: maximum execution time in milliseconds (default 60000)
166
+ - stream: true to receive progress notifications as each step completes
167
+
168
+ The pipeline: (1) plan -- interpret prompt to determine search queries and URLs to visit, (2) execute -- run searches and fetch URLs in parallel within budget, (3) extract -- if schema provided, apply schema extraction to each page and merge, (4) synthesize -- produce natural-language or structured result.
169
+
170
+ The steps array in the output provides full transparency into every action taken (plan, search, fetch, extract, synthesize) with timing. This differentiates from black-box alternatives.
171
+
172
+ Uses MCP requestSampling for planning and synthesis. Without sampling support, uses keyword extraction for planning and returns raw content.
173
+
174
+ Returns result (string or structured object), sources array, pages_fetched count, steps array with action/detail/time_ms, total_time_ms, and sampling_supported flag.`,
175
+ };
176
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mMA8DgK,CAAC;AAEpM,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE;;;;;;;;+NAQsN;IAE7N,MAAM,EAAE;;;;;;;;;;;;yIAY+H;IAEvI,KAAK,EAAE;;;;;;;;uLAQ8K;IAErL,KAAK,EAAE;;;;;;;;;0GASiG;IAExG,OAAO,EAAE;;;;;;;;4LAQiL;IAE1L,YAAY,EAAE;;;;;;;;;;;uEAWuD;IAErE,QAAQ,EAAE;;;;;;;;;;;;;;yHAc6G;IAEvH,KAAK,EAAE;;;;;;;;;;;;;;;;sKAgB6J;CAC5J,CAAC"}
package/dist/logger.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- type Module = 'fetch' | 'search' | 'crawl' | 'cache' | 'extract' | 'searxng' | 'server' | 'cli' | 'jsonld';
1
+ type Module = 'fetch' | 'search' | 'crawl' | 'cache' | 'extract' | 'searxng' | 'server' | 'cli' | 'jsonld' | 'repl' | 'embedding' | 'research' | 'agent';
2
2
  export interface Logger {
3
3
  debug(msg: string, data?: Record<string, unknown>): void;
4
4
  info(msg: string, data?: Record<string, unknown>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAS3G,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D;AAmBD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBnD"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AASzJ,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,GAAG,EAAE,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