neuron-inspector 0.1.1 → 0.2.0

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.
package/README.md CHANGED
@@ -1,30 +1,32 @@
1
1
  # neuron-inspector
2
2
 
3
- **51 browser tools for AI agents.** Turn Chrome into an MCP-powered DevOps platform inspect DOM, automate clicks, audit security, mock APIs, extract data, record demos — all from Claude Code, Cursor, Windsurf, or any MCP client.
3
+ **51 browser tools for AI agents.** Your AI can't see your browser. This fixes that.
4
4
 
5
- ```bash
6
- npx neuron-inspector
7
- ```
5
+ Inspect DOM, automate clicks, run JavaScript, search network traffic, audit security, check accessibility, scan SEO, mock APIs, extract structured data, record demos — all from Claude Code, Cursor, Windsurf, or any MCP client.
8
6
 
9
- ## What this does
7
+ No API keys. No cloud. Runs on localhost.
10
8
 
11
- Your AI agent can't see your browser. neuron-inspector fixes that.
9
+ [![npm](https://img.shields.io/npm/v/neuron-inspector)](https://www.npmjs.com/package/neuron-inspector)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
12
11
 
13
- It bridges a Chrome extension to your AI coding tool via MCP (Model Context Protocol). Once connected, your agent gets 51 tools that let it read the DOM, click buttons, run JS, search network traffic, audit accessibility, scan for security leaks, mock API responses, extract structured data from any page, and more.
12
+ ```bash
13
+ npx neuron-inspector
14
+ ```
14
15
 
15
- No API keys. No cloud. Runs entirely on localhost.
16
+ ---
16
17
 
17
- ## Setup (2 minutes)
18
+ ## Get started
18
19
 
19
20
  ### 1. Install the Chrome extension
20
21
 
21
- Download from [neuron.ng/extension](https://neuron.ng/extension) and sideload it:
22
+ Download from **[neuron.ng/extension](https://neuron.ng/extension)** and sideload:
22
23
 
23
- 1. Extract the zip
24
- 2. Open `chrome://extensions`, enable Developer Mode
25
- 3. Click "Load unpacked" and select the folder
24
+ 1. Download and extract the zip
25
+ 2. Open `chrome://extensions` and enable **Developer Mode**
26
+ 3. Click **Load unpacked** and select the extracted folder
27
+ 4. The extension icon appears in your toolbar
26
28
 
27
- ### 2. Register the MCP server
29
+ ### 2. Connect to your AI tool
28
30
 
29
31
  **Claude Code:**
30
32
  ```bash
@@ -55,9 +57,75 @@ claude mcp add neuron-inspector -- npx neuron-inspector
55
57
  }
56
58
  ```
57
59
 
58
- That's it. The extension auto-connects to the bridge on `ws://localhost:7377`.
60
+ ### 3. Use it
61
+
62
+ Open any page in Chrome. Ask your AI agent to interact with it. Done.
63
+
64
+ ---
65
+
66
+ ## What you can do
67
+
68
+ ### Ask your agent to debug a page
69
+
70
+ > "Why is this page slow?"
71
+
72
+ The agent calls `neuron_perf_snapshot` and gets back Core Web Vitals, render-blocking scripts, memory usage, and the heaviest resources.
73
+
74
+ > "Check this page for security issues"
75
+
76
+ `neuron_security_scan` finds leaked API keys in inline scripts, missing CSP headers, mixed content, insecure forms, exposed source maps.
77
+
78
+ > "Is this page accessible?"
79
+
80
+ `neuron_a11y_audit` runs a WCAG audit — color contrast failures, missing alt text, broken heading hierarchy, unlabeled form fields.
81
+
82
+ ### Ask your agent to explore traffic
83
+
84
+ > "What APIs is this SPA calling?"
85
+
86
+ `neuron_discover_apis` maps every endpoint from observed traffic — call counts, status codes, auth patterns, response shapes.
87
+
88
+ > "Search all network responses for 'user_id'"
89
+
90
+ `neuron_search_traffic` does full-text search across every captured response body.
91
+
92
+ > "Show me the network waterfall"
93
+
94
+ `neuron_waterfall` gives DNS, TCP, TLS, TTFB timing per resource — the same view as DevTools Network, but in your agent's context.
95
+
96
+ ### Ask your agent to interact with the page
97
+
98
+ > "Click the Sign Up button"
99
+
100
+ `neuron_click` finds it by CSS selector or visible text and clicks it.
101
+
102
+ > "Fill in the email field with test@example.com"
103
+
104
+ `neuron_type` targets the input and types into it.
105
+
106
+ > "Scroll down and extract all the product listings"
59
107
 
60
- ## The 51 tools
108
+ `neuron_scroll` + `neuron_extract_data` — scrolls the page and pulls structured data from repeating patterns (cards, tables, feeds).
109
+
110
+ ### Ask your agent to test edge cases
111
+
112
+ > "Mock the payments API to return a 500 error"
113
+
114
+ `neuron_set_mock` intercepts matching requests and returns your custom response. Test error states without touching the real backend.
115
+
116
+ > "Take a snapshot, click submit, then tell me what changed"
117
+
118
+ `neuron_snapshot_state` before, action, `neuron_diff_states` after — detects DOM changes, added/removed elements, URL changes.
119
+
120
+ ### Ask your agent to record and replay
121
+
122
+ > "Record what I'm doing as a workflow"
123
+
124
+ `neuron_start_recording` captures clicks, typing, and navigation. `neuron_start_demo` replays it as a polished video with chapter markers and cursor overlay.
125
+
126
+ ---
127
+
128
+ ## All 51 tools
61
129
 
62
130
  ### Inspect & Debug
63
131
  | Tool | What it does |
@@ -67,141 +135,132 @@ That's it. The extension auto-connects to the bridge on `ws://localhost:7377`.
67
135
  | `neuron_evaluate_js` | Run JavaScript in page context |
68
136
  | `neuron_get_logs` | Console logs filtered by level, tab, search |
69
137
  | `neuron_screenshot` | PNG screenshot of the visible area |
70
- | `neuron_diagnose` | Connection health extension connected? Tabs open? |
138
+ | `neuron_diagnose` | Connection health check |
71
139
  | `neuron_list_tabs` | Open tabs with platform detection |
72
140
 
73
141
  ### Browse & Automate
74
142
  | Tool | What it does |
75
143
  |------|-------------|
76
- | `neuron_click` | Click an element by selector or text |
144
+ | `neuron_click` | Click by selector or text |
77
145
  | `neuron_type` | Type into inputs and contenteditable |
78
- | `neuron_scroll` | Scroll by pixels or scroll an element into view |
79
- | `neuron_navigate` | Navigate a tab to a URL |
146
+ | `neuron_scroll` | Scroll by pixels or into view |
147
+ | `neuron_navigate` | Navigate to a URL |
80
148
  | `neuron_open_tab` | Open a new tab |
81
149
  | `neuron_reload` | Reload a tab |
82
- | `neuron_run_sequence` | Execute a multi-step sequence (click, type, wait, eval) |
150
+ | `neuron_run_sequence` | Multi-step automation (click, type, wait, eval) |
83
151
 
84
152
  ### Network Intelligence
85
153
  | Tool | What it does |
86
154
  |------|-------------|
87
- | `neuron_get_requests` | Query captured HTTP requests by tab, method, status, URL |
88
- | `neuron_get_errors` | Recent 4xx/5xx responses and console errors |
155
+ | `neuron_get_requests` | Query HTTP requests by tab, method, status, URL |
156
+ | `neuron_get_errors` | Recent 4xx/5xx and console errors |
89
157
  | `neuron_get_ws_frames` | WebSocket and SSE frame history |
90
- | `neuron_export_har` | Export traffic as HAR 1.2 |
91
- | `neuron_search_traffic` | Full-text search across all captured response bodies |
92
- | `neuron_discover_apis` | Auto-map API endpoints from observed traffic |
93
- | `neuron_replay_request` | Re-fire an HTTP request with the browser's live session |
94
- | `neuron_waterfall` | Network timing breakdown — DNS, TLS, TTFB per resource |
158
+ | `neuron_export_har` | Export as HAR 1.2 |
159
+ | `neuron_search_traffic` | Full-text search across response bodies |
160
+ | `neuron_discover_apis` | Auto-map API endpoints from traffic |
161
+ | `neuron_replay_request` | Re-fire a request with the browser's live session |
162
+ | `neuron_waterfall` | DNS/TLS/TTFB timing per resource |
95
163
 
96
- ### Security Scan
164
+ ### Security
97
165
  | Tool | What it does |
98
166
  |------|-------------|
99
- | `neuron_security_scan` | Scan for leaked secrets, missing headers, CORS issues, mixed content |
100
- | `neuron_check_auth` | Verify platform credentials are still valid |
167
+ | `neuron_security_scan` | Leaked secrets, missing headers, CORS, mixed content |
168
+ | `neuron_check_auth` | Verify platform credentials |
101
169
  | `neuron_detect_blocker` | Detect rate limits, captchas, login walls |
102
170
 
103
- ### Quality Audits
171
+ ### Quality
104
172
  | Tool | What it does |
105
173
  |------|-------------|
106
- | `neuron_a11y_audit` | WCAG accessibility audit — contrast, labels, headings, tabindex |
107
- | `neuron_perf_snapshot` | Core Web Vitals, resource breakdown, memory, long tasks |
108
- | `neuron_seo_audit` | Title, meta, OG, headings, structured data, link ratio |
174
+ | `neuron_a11y_audit` | WCAG audit — contrast, labels, headings, tabindex |
175
+ | `neuron_perf_snapshot` | Core Web Vitals, resource breakdown, memory |
176
+ | `neuron_seo_audit` | Meta, OG, headings, structured data, links |
109
177
 
110
178
  ### Network Mocking
111
179
  | Tool | What it does |
112
180
  |------|-------------|
113
- | `neuron_set_mock` | Intercept requests and return custom responses |
181
+ | `neuron_set_mock` | Intercept requests, return custom responses |
114
182
  | `neuron_get_mocks` | List active mock rules |
115
183
  | `neuron_clear_mocks` | Remove all mocks |
116
184
 
117
185
  ### Cookies & Storage
118
186
  | Tool | What it does |
119
187
  |------|-------------|
120
- | `neuron_get_cookies` | Read all cookies for a URL |
188
+ | `neuron_get_cookies` | Read cookies for a URL |
121
189
  | `neuron_set_cookie` | Set a cookie |
122
190
  | `neuron_delete_cookie` | Delete a cookie |
123
- | `neuron_get_storage` | Read localStorage or sessionStorage |
191
+ | `neuron_get_storage` | Read localStorage / sessionStorage |
124
192
  | `neuron_clear_storage` | Clear storage |
125
193
 
126
194
  ### Page Monitoring
127
195
  | Tool | What it does |
128
196
  |------|-------------|
129
- | `neuron_snapshot_state` | Capture page state (DOM, visibility, text) for later diff |
130
- | `neuron_diff_states` | Compare two snapshots — detect what changed |
131
- | `neuron_watch_element` | Watch a selector for changes over time |
197
+ | `neuron_snapshot_state` | Capture page state for later diff |
198
+ | `neuron_diff_states` | Compare two snapshots |
199
+ | `neuron_watch_element` | Watch a selector for changes |
132
200
  | `neuron_get_watches` | Check accumulated changes |
133
201
  | `neuron_stop_watch` | Stop watching |
134
- | `neuron_extract_data` | Extract structured data from repeating patterns (feeds, tables, listings) |
202
+ | `neuron_extract_data` | Extract structured data from feeds, tables, listings |
135
203
 
136
204
  ### Demo Recording
137
205
  | Tool | What it does |
138
206
  |------|-------------|
139
- | `neuron_start_recording` | Record user interactions as a replayable workflow |
207
+ | `neuron_start_recording` | Record interactions as a workflow |
140
208
  | `neuron_stop_recording` | Save the recording |
141
209
  | `neuron_list_workflows` | List saved workflows |
142
210
  | `neuron_start_replay` | Replay a workflow |
143
211
  | `neuron_stop_replay` | Stop replay |
144
- | `neuron_start_demo` | Record a demo video with chapters, captions, cursor overlay |
145
- | `neuron_workflow_status` | Current engine state |
212
+ | `neuron_start_demo` | Record a demo video with chapters + cursor |
213
+ | `neuron_workflow_status` | Engine state |
146
214
 
147
215
  ### Other
148
216
  | Tool | What it does |
149
217
  |------|-------------|
150
- | `neuron_trigger_post` | Trigger the IG post runner |
151
- | `neuron_session_diagnostics` | Agent session health — capture rate, stalls, auth, buffers |
218
+ | `neuron_trigger_post` | Trigger the post runner |
219
+ | `neuron_session_diagnostics` | Agent session health |
152
220
 
153
- ## Examples
221
+ ---
154
222
 
155
- **"Why is this page slow?"**
156
- ```
157
- → neuron_perf_snapshot { tabId: 123 }
158
- ← LCP: 3.2s, CLS: 0.04, 14 render-blocking scripts, heaviest: analytics.js (890KB)
159
- ```
223
+ ## Recipes purpose-built agents
160
224
 
161
- **"Check this page for security issues"**
162
- ```
163
- → neuron_security_scan { tabId: 123 }
164
- ← 3 findings: API key leaked in inline script, missing CSP header, autocomplete on password field
165
- ```
225
+ The 51 tools are primitives. A **recipe** turns them into a purpose-built agent — a QA engineer, a job applicant, a web researcher. Recipes are shareable, and they get better with every run.
166
226
 
167
- **"What APIs is this SPA calling?"**
168
- ```
169
- → neuron_discover_apis {}
170
- ← 12 endpoints: GET /api/users/{id} (called 8x), POST /api/auth/refresh (2x), ...
171
- ```
227
+ ### Built-in recipes
172
228
 
173
- **"Extract all product listings from this page"**
174
- ```
175
- neuron_extract_data { tabId: 123 }
176
- 47 items: [{ text: "Nike Air Max", link: "/product/123", image: "...", price: "$129" }, ...]
177
- ```
229
+ | Recipe | What it does |
230
+ |--------|-------------|
231
+ | **[Web Researcher](recipes/web-researcher/)** | Deep-dives into topics, cross-references sources, produces reports with citations |
232
+ | **[Job Applicant](recipes/job-applicant/)** | Searches job boards, evaluates fit, writes cover letters, fills forms, tracks outcomes |
233
+ | **[QA Engineer](recipes/qa-engineer/)** | Tests web apps — finds bugs, checks a11y, audits security, builds regression suites |
178
234
 
179
- **"Mock the payments API to return a 500"**
180
- ```
181
- → neuron_set_mock { urlPattern: "*/api/payments*", responseStatus: 500, responseBody: "{\"error\":\"service down\"}" }
182
- ← Mock rule active. All matching requests will return 500.
183
- ```
235
+ ### How recipes work
184
236
 
185
- ## How it works
237
+ A recipe is a folder with instructions (`agent.md`) and config (`recipe.yaml`). The instructions tell the AI *how* to use the browser tools for a specific purpose. The config declares variables you fill in (your resume, your target URL, your preferences).
186
238
 
187
- ```
188
- ┌─────────────┐ WebSocket ┌──────────────────┐ stdio/MCP ┌──────────────┐
189
- │ Chrome + │ ←──────────────→ │ neuron-inspector ←──────────────→ │ Claude Code │
190
- │ Extension │ localhost:7377 │ (this pkg) │ │ / Cursor │
191
- └─────────────┘ └──────────────────┘ └──────────────┘
192
- ```
239
+ **Recipes are alive.** Each run captures outcomes to `memory/`. After enough runs, the agent reviews what worked and updates its own strategy in `learnings.md`. A job applicant that discovers technical-tone cover letters get 3x more responses will start writing technical-tone cover letters by default.
240
+
241
+ **Recipes feed each other.** The web researcher produces reports that the job applicant reads to tailor cover letters. The QA engineer reads its own previous reports to re-check if old bugs are fixed. Output from one recipe is input to another.
242
+
243
+ ### Use a recipe
244
+
245
+ Copy a recipe's `agent.md` into your project as a CLAUDE.md (or append it), fill in the `{{variables}}` from `recipe.yaml`, and run. The recipe tells your AI agent exactly how to use the 51 tools for that purpose.
193
246
 
194
- 1. The Chrome extension captures network traffic, DOM state, and console logs in real time
195
- 2. `neuron-inspector` runs as a local bridge — WebSocket server on port 7377 (extension connects here) + MCP server on stdio (your AI tool connects here)
196
- 3. Your AI agent calls tools via MCP → the bridge forwards them to the extension → the extension executes in Chrome → results flow back
247
+ ### Build your own
197
248
 
198
- Everything runs on localhost. No data leaves your machine.
249
+ See [RECIPE-SPEC.md](RECIPE-SPEC.md) for the full format. The core idea: write the instructions you'd give a skilled human, reference the tools by name, add reflect/evolve sections so the agent improves itself, and declare your variables so others can import and customize.
250
+
251
+ ---
199
252
 
200
253
  ## Requirements
201
254
 
202
255
  - Node.js 18+
203
- - Chrome (or Chromium-based browser)
204
- - [Neuron extension](https://neuron.ng/extension) installed
256
+ - Chrome or any Chromium browser
257
+ - [Neuron extension](https://neuron.ng/extension)
258
+
259
+ ## Links
260
+
261
+ - **Extension download:** [neuron.ng/extension](https://neuron.ng/extension)
262
+ - **npm:** [npmjs.com/package/neuron-inspector](https://www.npmjs.com/package/neuron-inspector)
263
+ - **Recipe spec:** [RECIPE-SPEC.md](RECIPE-SPEC.md)
205
264
 
206
265
  ## License
207
266
 
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Recipe MCP tools — same ToolDef shape as browser tools so they register
3
+ * through the same mcp.tool() overload. Handled locally (no extension needed).
4
+ */
5
+ import type { ToolDef } from "./tools.js";
6
+ export declare const RECIPE_TOOLS: ToolDef[];
7
+ /** Handle a recipe tool call locally (no extension needed). */
8
+ export declare function handleRecipeTool(name: string, args: Record<string, unknown>): Promise<unknown>;
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Recipe MCP tools — same ToolDef shape as browser tools so they register
3
+ * through the same mcp.tool() overload. Handled locally (no extension needed).
4
+ */
5
+ import * as recipes from "./recipes.js";
6
+ export const RECIPE_TOOLS = [
7
+ {
8
+ name: "neuron_recipe_list",
9
+ description: "List all available recipes (bundled + user-installed). Shows name, description, whether it has accumulated learnings, and run count.",
10
+ inputSchema: { type: "object", properties: {} },
11
+ },
12
+ {
13
+ name: "neuron_recipe_get",
14
+ description: "Get a recipe's full contents — agent instructions (agent.md), configuration (recipe.yaml), accumulated learnings, and variable definitions. Use this to understand what a recipe does before running it.",
15
+ inputSchema: {
16
+ type: "object",
17
+ properties: {
18
+ slug: { type: "string", description: "Recipe slug (e.g. 'web-researcher', 'qa-engineer')" },
19
+ },
20
+ required: ["slug"],
21
+ },
22
+ },
23
+ {
24
+ name: "neuron_recipe_create",
25
+ description: "Create a new recipe from scratch. Provide the slug, name, description, agent instructions (agent.md content with Strategy/Reflect/Evolve sections), and configuration (recipe.yaml content with variables/tools/pipes/limits). Saved to ~/.neuron/recipes/<slug>/.",
26
+ inputSchema: {
27
+ type: "object",
28
+ properties: {
29
+ slug: { type: "string", description: "URL-safe identifier (e.g. 'grant-scraper')" },
30
+ name: { type: "string", description: "Display name" },
31
+ description: { type: "string", description: "One-line description" },
32
+ agent_md: { type: "string", description: "Full agent.md content — strategy, reflect, evolve sections" },
33
+ recipe_yaml: { type: "string", description: "Full recipe.yaml content — variables, tools, pipes, limits" },
34
+ },
35
+ required: ["slug", "name", "description", "agent_md", "recipe_yaml"],
36
+ },
37
+ },
38
+ {
39
+ name: "neuron_recipe_update",
40
+ description: "Update a recipe's agent instructions, learnings, or configuration. If updating a bundled recipe, it's forked to ~/.neuron/recipes/ first. Use this after the evolve phase to persist improved strategy.",
41
+ inputSchema: {
42
+ type: "object",
43
+ properties: {
44
+ slug: { type: "string", description: "Recipe slug" },
45
+ agent_md: { type: "string", description: "Updated agent.md content" },
46
+ learnings: { type: "string", description: "Updated learnings.md content" },
47
+ recipe_yaml: { type: "string", description: "Updated recipe.yaml content" },
48
+ },
49
+ required: ["slug"],
50
+ },
51
+ },
52
+ {
53
+ name: "neuron_recipe_log",
54
+ description: "Log a run outcome to a recipe's memory. Each entry captures what happened — success/failure, sources found, dead ends, quality score. The recipe's evolve phase reads these to improve its strategy.",
55
+ inputSchema: {
56
+ type: "object",
57
+ properties: {
58
+ slug: { type: "string", description: "Recipe slug" },
59
+ entry: { type: "object", description: "Run outcome data — structure varies per recipe, see the Reflect section in agent.md" },
60
+ },
61
+ required: ["slug", "entry"],
62
+ },
63
+ },
64
+ {
65
+ name: "neuron_recipe_memory",
66
+ description: "Read a recipe's run history — the outcomes captured by neuron_recipe_log. Returns the most recent entries. Use during the evolve phase to analyze what's working and what's not.",
67
+ inputSchema: {
68
+ type: "object",
69
+ properties: {
70
+ slug: { type: "string", description: "Recipe slug" },
71
+ limit: { type: "number", description: "Max entries to return (default: 20)" },
72
+ },
73
+ required: ["slug"],
74
+ },
75
+ },
76
+ {
77
+ name: "neuron_recipe_import",
78
+ description: "Import a recipe from GitHub or a local path. GitHub: 'github:user/repo' imports all recipes from the repo's recipes/ subdir. Local: absolute path to a folder with recipe.yaml. Saved to ~/.neuron/recipes/. Memory is stripped on import (local-only).",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ source: { type: "string", description: "GitHub repo (github:user/repo) or absolute local path to recipe folder" },
83
+ },
84
+ required: ["source"],
85
+ },
86
+ },
87
+ {
88
+ name: "neuron_recipe_export",
89
+ description: "Export a recipe's shareable contents — agent.md, recipe.yaml, and optionally learnings. The recipient imports this with neuron_recipe_import. Memory (run history) is never exported.",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {
93
+ slug: { type: "string", description: "Recipe slug" },
94
+ include_learnings: { type: "boolean", description: "Include accumulated learnings (default: true)" },
95
+ },
96
+ required: ["slug"],
97
+ },
98
+ },
99
+ {
100
+ name: "neuron_recipe_delete",
101
+ description: "Delete a user-installed recipe and all its memory/learnings. Bundled recipes cannot be deleted.",
102
+ inputSchema: {
103
+ type: "object",
104
+ properties: {
105
+ slug: { type: "string", description: "Recipe slug to delete" },
106
+ },
107
+ required: ["slug"],
108
+ },
109
+ },
110
+ {
111
+ name: "neuron_profile_get",
112
+ description: "Read the user's profile (~/.neuron/profile.yaml). Profiles auto-fill recipe variables — name, email, location, tone, timezone, etc.",
113
+ inputSchema: { type: "object", properties: {} },
114
+ },
115
+ {
116
+ name: "neuron_profile_save",
117
+ description: "Save or update the user's profile (~/.neuron/profile.yaml). Common fields: name, email, location, timezone, tone, linkedin, github. Recipe variables with matching keys are auto-filled from this profile.",
118
+ inputSchema: {
119
+ type: "object",
120
+ properties: {
121
+ data: { type: "object", description: "Profile key-value pairs (e.g. {name: 'Jane', email: 'jane@co.com', timezone: 'US/Eastern'})" },
122
+ },
123
+ required: ["data"],
124
+ },
125
+ },
126
+ ];
127
+ /** Handle a recipe tool call locally (no extension needed). */
128
+ export async function handleRecipeTool(name, args) {
129
+ switch (name) {
130
+ case "neuron_recipe_list":
131
+ return recipes.listRecipes();
132
+ case "neuron_recipe_get": {
133
+ const result = recipes.getRecipe(args.slug);
134
+ if (!result)
135
+ throw new Error(`Recipe "${args.slug}" not found.`);
136
+ return result;
137
+ }
138
+ case "neuron_recipe_create":
139
+ return recipes.createRecipe(args.slug, args.name, args.description, args.agent_md, args.recipe_yaml);
140
+ case "neuron_recipe_update":
141
+ return recipes.updateRecipe(args.slug, {
142
+ agent_md: args.agent_md,
143
+ learnings: args.learnings,
144
+ recipe_yaml: args.recipe_yaml,
145
+ });
146
+ case "neuron_recipe_log":
147
+ return recipes.logMemory(args.slug, args.entry);
148
+ case "neuron_recipe_memory":
149
+ return recipes.getMemory(args.slug, args.limit || 20);
150
+ case "neuron_recipe_import":
151
+ return recipes.importRecipe(args.source);
152
+ case "neuron_recipe_export":
153
+ return recipes.exportRecipe(args.slug, args.include_learnings ?? true);
154
+ case "neuron_recipe_delete":
155
+ recipes.deleteRecipe(args.slug);
156
+ return { deleted: args.slug };
157
+ case "neuron_profile_get": {
158
+ const profile = recipes.getProfile();
159
+ if (!profile)
160
+ return { message: "No profile found. Create one with neuron_profile_save." };
161
+ return profile;
162
+ }
163
+ case "neuron_profile_save":
164
+ return recipes.saveProfile(args.data);
165
+ default:
166
+ throw new Error(`Unknown recipe tool: ${name}`);
167
+ }
168
+ }
169
+ //# sourceMappingURL=recipe-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-tools.js","sourceRoot":"","sources":["../src/recipe-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,sIAAsI;QACnJ,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,0MAA0M;QACvN,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EA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memory
3
+ * for self-improving agent recipes. All file operations are local.
4
+ */
5
+ interface RecipeSummary {
6
+ name: string;
7
+ slug: string;
8
+ version: string;
9
+ description: string;
10
+ author: string;
11
+ tags: string[];
12
+ location: "bundled" | "user";
13
+ path: string;
14
+ has_learnings: boolean;
15
+ has_memory: boolean;
16
+ memory_count: number;
17
+ }
18
+ export declare function listRecipes(): RecipeSummary[];
19
+ export declare function getRecipe(slug: string): {
20
+ meta: RecipeSummary;
21
+ agent_md: string;
22
+ recipe_yaml: string;
23
+ learnings: string | null;
24
+ variables: Record<string, unknown>;
25
+ } | null;
26
+ export declare function createRecipe(slug: string, name: string, description: string, agentMd: string, recipeYaml: string): {
27
+ path: string;
28
+ };
29
+ export declare function updateRecipe(slug: string, updates: {
30
+ agent_md?: string;
31
+ learnings?: string;
32
+ recipe_yaml?: string;
33
+ }): {
34
+ path: string;
35
+ };
36
+ export declare function logMemory(slug: string, entry: Record<string, unknown>): {
37
+ path: string;
38
+ };
39
+ export declare function getMemory(slug: string, limit?: number): {
40
+ entries: Record<string, unknown>[];
41
+ total: number;
42
+ };
43
+ export declare function importRecipe(source: string): {
44
+ slug: string;
45
+ path: string;
46
+ };
47
+ export declare function exportRecipe(slug: string, includeLearnings?: boolean): {
48
+ agent_md: string;
49
+ recipe_yaml: string;
50
+ learnings: string | null;
51
+ };
52
+ export declare function deleteRecipe(slug: string): void;
53
+ export declare function getProfile(): Record<string, unknown> | null;
54
+ export declare function saveProfile(data: Record<string, string>): {
55
+ path: string;
56
+ };
57
+ export {};