agent-nuvira 1.69.0 → 1.70.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.
package/README.md CHANGED
@@ -180,6 +180,37 @@ npm run build
180
180
  npm link
181
181
  ```
182
182
 
183
+ ### One-command setup for new users (recommended)
184
+
185
+ If you're setting up on a **fresh machine** (or just don't want to deal with
186
+ installing Node.js, Git, build tools, etc. by hand), use the platform setup
187
+ script. Each one **checks for the required tools, installs anything missing
188
+ for you, installs Agent-Nuvira, and then asks whether you want the optional
189
+ performance upgrades** (native FAISS + local embeddings) — with plain-English
190
+ prompts the whole way.
191
+
192
+ | OS | Run this |
193
+ |---|---|
194
+ | **macOS** | `bash <(curl -fsSL https://raw.githubusercontent.com/imdheerajKube/agent-nuvira/main/scripts/setup/install-macos.sh)` |
195
+ | **Linux** (Ubuntu/Debian/Fedora/RHEL/Arch/Alpine) | `bash <(curl -fsSL https://raw.githubusercontent.com/imdheerajKube/agent-nuvira/main/scripts/setup/install-linux.sh)` |
196
+ | **Windows** (PowerShell) | `Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force; irm https://raw.githubusercontent.com/imdheerajKube/agent-nuvira/main/scripts/setup/install-windows.ps1 | iex` |
197
+
198
+ What each script does:
199
+
200
+ 1. **Detects what's missing** — Node.js, npm, Git, build tools (and Homebrew on
201
+ macOS / `winget` on Windows), and installs them automatically (with your
202
+ confirmation) using the right installer for your OS.
203
+ 2. **Installs Agent-Nuvira** — `npm install -g agent-nuvira` (with npm 11's
204
+ install-script security gate handled automatically so native components build).
205
+ 3. **Asks about optional upgrades** (recommended, each a yes/no):
206
+ - **Native FAISS** → faster semantic search / memory recall
207
+ - **Local embeddings** → free, offline, private embeddings (no cloud call)
208
+ 4. **Verifies** the install and prints next steps.
209
+
210
+ > The scripts are safe to re-run — they skip tools that are already present.
211
+ > Manual install instructions for every step are below for those who prefer
212
+ > full control.
213
+
183
214
  ### Native FAISS acceleration (optional, recommended)
184
215
 
185
216
  Agent-Nuvira includes an optional native FAISS backend for faster semantic retrieval. The runtime prefers this backend automatically when the native addon can build successfully; if that path is unavailable, it falls back to the pure-JS IVF implementation and then the exact JSON backend so your workflow stays reliable.
@@ -237,6 +268,26 @@ metadata filters don't miss results.
237
268
 
238
269
  If the native addon cannot be built on your machine, Agent-Nuvira will continue to work using the pure-JS fallback path.
239
270
 
271
+ ### Local embeddings (optional, recommended)
272
+
273
+ Semantic search and memory recall use embeddings. Agent-Nuvira's embedder has a
274
+ 3-tier strategy and **always prefers the local tier when it works**:
275
+
276
+ | Tier | Engine | Notes |
277
+ |---|---|---|
278
+ | **1 — Local** | `@huggingface/transformers` (`onnxruntime-node`) | Free, offline, private — `Xenova/all-MiniLM-L6-v2` (384-dim). **Default when available** |
279
+ | **2 — Python** | `sentence-transformers` via subprocess | Used when Tier 1 is unavailable and Python is present |
280
+ | **3 — LLM** | Any configured inference provider | Last-resort fallback; costs tokens |
281
+
282
+ With `@huggingface/transformers` installed and its native binary present, no
283
+ configuration is needed — local embeddings are used automatically, offline,
284
+ with zero API cost. The one-command setup scripts above enable this for you.
285
+ To verify which tier is active, run:
286
+
287
+ ```bash
288
+ agent-nuvira memory backend --check
289
+ ```
290
+
240
291
  ### Verify
241
292
 
242
293
  ```bash
@@ -1 +1 @@
1
- {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agents/agents/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAiB,MAAM,aAAa,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkH7C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,8DAA8D;IAE5E,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAuQ9E;;;OAGG;IACH,OAAO,CAAC,SAAS;CAkClB"}
1
+ {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agents/agents/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAiB,MAAM,aAAa,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA0H7C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,8DAA8D;IAE5E,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAuQ9E;;;OAGG;IACH,OAAO,CAAC,SAAS;CAkClB"}
@@ -35,6 +35,14 @@ const PLANNER_SYSTEM_PROMPT = [
35
35
  ' Use the description to specify the command: "Run: python hello.py" or "Run `node index.js`"',
36
36
  ' IMPORTANT: Only suggest "npm test" if the project already has a "test" script in its package.json!',
37
37
  ' Check the project structure above — if there\'s no test script, skip the test step.',
38
+ ' IMPORTANT — "deployable format" / packaging goals: when the goal asks for a',
39
+ ' deliverable that CANNOT RUN in this environment (an addon/plugin that needs',
40
+ ' its host app — e.g. an NVDA addon needs NVDA, an iOS app needs Xcode), do NOT',
41
+ ' plan a runner step that tries to execute it. Instead plan the runner step with',
42
+ ' the explicit PACKAGING command in backticks, e.g. "Run `zip -r myaddon.nvda-addon',
43
+ ' manifest.ini globalPlugins` to build the deployable addon", or a static check',
44
+ ' (e.g. "Run `python3 -m py_compile globalPlugins/*.py`"). The runner will build',
45
+ ' the artifact; it will not pretend the addon can execute outside its host.',
38
46
  '5. End with a "reviewer" step to validate the work',
39
47
  '6. Set dependsOn correctly so steps run in the right order',
40
48
  '7. Keep steps granular — each step should change at most 2-3 files',
@@ -1 +1 @@
1
- {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../../src/agents/agents/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAsD,MAAM,aAAa,CAAC;AAGxF,MAAM,qBAAqB,GAAG;IAC5B,uHAAuH;IACvH,EAAE;IACF,yBAAyB;IACzB,kEAAkE;IAClE,wDAAwD;IACxD,2JAA2J;IAC3J,iGAAiG;IACjG,sKAAsK;IACtK,wUAAwU;IACxU,EAAE;IACF,2EAA2E;IAC3E,8EAA8E;IAC9E,gFAAgF;IAChF,4EAA4E;IAC5E,gFAAgF;IAChF,EAAE;IACF,QAAQ;IACR,qFAAqF;IACrF,iFAAiF;IACjF,6EAA6E;IAC7E,oEAAoE;IACpE,yFAAyF;IACzF,kDAAkD;IAClD,gGAAgG;IAChG,uGAAuG;IACvG,wFAAwF;IACxF,oDAAoD;IACpD,4DAA4D;IAC5D,oEAAoE;IACpE,2BAA2B;IAC3B,2EAA2E;IAC3E,yEAAyE;IACzE,sEAAsE;IACtE,yEAAyE;IACzE,4EAA4E;IAC5E,mEAAmE;IACnE,EAAE;IACF,+DAA+D;IAC/D,EAAE;IACF,sCAAsC;IACtC,yEAAyE;IACzE,2EAA2E;IAC3E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,EAAE;IACF,2DAA2D;IAC3D,GAAG;IACH,KAAK;IACL,iCAAiC;IACjC,8IAA8I;IAC9I,sCAAsC;IACtC,6BAA6B;IAC7B,qBAAqB;IACrB,MAAM;IACN,KAAK;IACL,iCAAiC;IACjC,wJAAwJ;IACxJ,4BAA4B;IAC5B,+BAA+B;IAC/B,iDAAiD;IACjD,yCAAyC;IACzC,MAAM;IACN,KAAK;IACL,qCAAqC;IACrC,wFAAwF;IACxF,4BAA4B;IAC5B,+BAA+B;IAC/B,yCAAyC;IACzC,MAAM;IACN,KAAK;IACL,oCAAoC;IACpC,oFAAoF;IACpF,8BAA8B;IAC9B,+BAA+B;IA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AAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,oBAAoB,GAAG;IAC3B,+DAA+D;IAC/D,mCAAmC;IACnC,gEAAgE;IAChE,iEAAiE;IACjE,qBAAqB;IACrB,aAAa;CACd,CAAC;AAEF,gFAAgF;AAChF,SAAS,eAAe,CAAC,IAAY,EAAE,IAAY;IACjD,sEAAsE;IACtE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,IAAI,MAAM,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../../src/agents/agents/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAsD,MAAM,aAAa,CAAC;AAGxF,MAAM,qBAAqB,GAAG;IAC5B,uHAAuH;IACvH,EAAE;IACF,yBAAyB;IACzB,kEAAkE;IAClE,wDAAwD;IACxD,2JAA2J;IAC3J,iGAAiG;IACjG,sKAAsK;IACtK,wUAAwU;IACxU,EAAE;IACF,2EAA2E;IAC3E,8EAA8E;IAC9E,gFAAgF;IAChF,4EAA4E;IAC5E,gFAAgF;IAChF,EAAE;IACF,QAAQ;IACR,qFAAqF;IACrF,iFAAiF;IACjF,6EAA6E;IAC7E,oEAAoE;IACpE,yFAAyF;IACzF,kDAAkD;IAClD,gGAAgG;IAChG,uGAAuG;IACvG,wFAAwF;IACxF,gFAAgF;IAChF,gFAAgF;IAChF,kFAAkF;IAClF,mFAAmF;IACnF,sFAAsF;IACtF,kFAAkF;IAClF,mFAAmF;IACnF,8EAA8E;IAC9E,oDAAoD;IACpD,4DAA4D;IAC5D,oEAAoE;IACpE,2BAA2B;IAC3B,2EAA2E;IAC3E,yEAAyE;IACzE,sEAAsE;IACtE,yEAAyE;IACzE,4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EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU;IAC5E,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS;IAChF,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;CAClF,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,MAAM,GAAG,IAAI;SAChB,WAAW,EAAE;SACb,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,oBAAoB,GAAG;IAC3B,+DAA+D;IAC/D,mCAAmC;IACnC,gEAAgE;IAChE,iEAAiE;IACjE,qBAAqB;IACrB,aAAa;CACd,CAAC;AAEF,gFAAgF;AAChF,SAAS,eAAe,CAAC,IAAY,EAAE,IAAY;IACjD,sEAAsE;IACtE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,IAAI,MAAM,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC"}
@@ -174,15 +174,60 @@ export declare class RunnerAgent extends Agent {
174
174
  /**
175
175
  * Ask the LLM for the NEXT command after a previous command failed.
176
176
  * This is what makes the repair loop ADAPT instead of re-running the same
177
- * failing command: the LLM sees the task, the previous command, and its
178
- * captured stdout/stderr, and proposes a corrected command (e.g. create the
179
- * Cloudflare Pages project before deploying).
177
+ * failing command: the LLM sees the task, the previous command, its captured
178
+ * stdout/stderr, AND the full project context (written files + reference
179
+ * docs), and proposes a corrected command (e.g. create the Cloudflare Pages
180
+ * project before deploying, or — when the deliverable CANNOT run in this
181
+ * environment — the PACKAGING command that produces the deployable artifact).
180
182
  */
181
183
  private askLLMForRepairCommand;
182
184
  /**
183
185
  * Fallback: ask the LLM what command to run based on the project context.
184
- * Includes project's package.json metadata so the LLM can make an informed choice.
186
+ * Includes the written file contents, package.json metadata, and curated
187
+ * reference docs (referenceDocsFor) so the LLM can choose a CORRECT action —
188
+ * including recognizing when the deliverable CANNOT run in this environment
189
+ * (a plugin/addon that needs its host app) and proposing the PACKAGING
190
+ * command that produces the deployable artifact instead of a useless run.
185
191
  */
186
192
  private askLLMForCommand;
193
+ /**
194
+ * Deterministic "cannot run here → package it" detection.
195
+ *
196
+ * When the project written for this task is a known addon/package whose
197
+ * runtime is NOT this machine (NVDA addon = manifest.ini + globalPlugins/
198
+ * needs the NVDA screen reader), running it can never succeed — the correct
199
+ * build action is to PACKAGE the source tree into the deployable artifact.
200
+ * This returns that packaging command, or null when no deterministic target
201
+ * exists (falls through to the LLM).
202
+ *
203
+ * Currently supports: NVDA addons (manifest.ini + globalPlugins/ → zip into
204
+ * a .nvda-addon archive, the real distribution format per the reference doc).
205
+ */
206
+ private detectPackagingCommand;
207
+ /**
208
+ * Detect a missing system tool referenced by a command (enterprise parity).
209
+ *
210
+ * Scans every token of the command (so compound commands like
211
+ * `cd addon && zip -r …` are covered), checks each against the known-tool
212
+ * recipes, and returns the FIRST missing tool name — or null when nothing
213
+ * is missing / unknown. Only the bare tool name is checked (paths like
214
+ * /usr/bin/zip are unwrapped to zip).
215
+ */
216
+ private detectMissingSystemTool;
217
+ /**
218
+ * Ensure every known system tool referenced by a command is installed.
219
+ *
220
+ * Enterprise flow (parity with a human agent):
221
+ * - Tool present → null (continue).
222
+ * - Tool missing + interactive TTY → ask the user with the OS-appropriate
223
+ * install command. On 'install': execute it, verify, and continue. On
224
+ * 'manual'/'skip': return the manual steps as the error (the user takes
225
+ * over the manual task — e.g. installing brew, generating a token).
226
+ * - Tool missing + non-interactive (piped/CI) → never block; return the
227
+ * recommended install command as the error so the user can run it.
228
+ *
229
+ * Returns null to proceed, or an error string that fails the step.
230
+ */
231
+ private ensureSystemTool;
187
232
  }
188
233
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/agents/agents/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsB7C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,+CAA+C;IAC/C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wEAAwE;IACxE,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD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BAAsB;IA8EpC;;;;;;;OAOG;YACW,gBAAgB;IAkG9B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,sBAAsB;IA0B9B;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IAY/B;;;;;;;;;;;;;OAaG;YACW,gBAAgB;CA0C/B"}
@@ -28,6 +28,8 @@ import { runShell, runShellSync } from '../../utils/shell.js';
28
28
  import { SandboxManager } from '../../sandbox/manager.js';
29
29
  import { detectProjectImage } from '../../sandbox/images.js';
30
30
  import { getSandboxConfig } from '../../sandbox/types.js';
31
+ import { referenceDocsFor } from '../reference-docs.js';
32
+ import { isKnownSystemTool, manualInstallSteps, promptToolInstall, toolInstallCommand, } from '../../cli/tool-install-prompt.js';
31
33
  /** Maximum stdout/stderr length to store in context metadata */
32
34
  const MAX_OUTPUT_LENGTH = 10_000;
33
35
  /** Timeout per command in milliseconds (default: 2 minutes) */
@@ -67,6 +69,25 @@ export class RunnerAgent extends Agent {
67
69
  // fix — otherwise the exit-127 repair loop just re-runs the same broken
68
70
  // `python …` command until the budget is exhausted.
69
71
  command = this.normalizeInterpreter(command);
72
+ // ENTERPRISE TOOL HANDLING: if the command needs a system tool that is
73
+ // not installed (e.g. `zip` for packaging), detect it BEFORE running and
74
+ // ask the user to approve an OS-appropriate install (interactive TTY) or
75
+ // surface the manual steps (non-interactive) — never fail silently and
76
+ // never install OS software without consent. On approval the install
77
+ // runs, the tool is verified, and the original command proceeds.
78
+ const toolOutcome = await this.ensureSystemTool(context, command);
79
+ if (toolOutcome !== null) {
80
+ // Either the user declined/skipped (return its error) or the install
81
+ // failed — the command cannot run without the tool.
82
+ if (context.metadata.verboseLogging) {
83
+ logger.warn(` 🛠️ Missing system tool handling: ${toolOutcome}`);
84
+ }
85
+ return {
86
+ success: false,
87
+ summary: `Required tool not available: ${toolOutcome}`,
88
+ error: toolOutcome,
89
+ };
90
+ }
70
91
  this.report(context, 'running', `Executing \`${command}\` and capturing output…`);
71
92
  // Check if we should run inside a Docker sandbox
72
93
  const useDocker = context.metadata.useDockerSandbox === true ||
@@ -817,27 +838,54 @@ export class RunnerAgent extends Agent {
817
838
  let depInstallSucceeded = false;
818
839
  let depInstallTool;
819
840
  let depInstallToolInstalled = false;
841
+ // Holds the actionable tool-install message when a missing system tool
842
+ // blocked the run (surfaced in the result error instead of the raw
843
+ // "command not found" so the user sees exactly what to do).
844
+ let toolBlockError = null;
820
845
  if (exitCode !== 0 && depRetries < MAX_DEP_INSTALL_RETRIES && this.looksLikeMissingDependency(command, stdout, stderr, execError)) {
821
- if (context.metadata.verboseLogging) {
822
- logger.info(' 📦 Command failed missing dependency detected, installing...');
823
- }
824
- // autoInstallTools defaults to true; set metadata.autoInstallTools=false
825
- // to only run the install command without bootstrapping missing tools.
826
- const autoInstallTools = context.metadata.autoInstallTools !== false;
827
- const installResult = this.installDependencies(context.workingDirectory, autoInstallTools, command);
828
- depInstallAttempted = true;
829
- depInstallSucceeded = installResult.success;
830
- depInstallTool = installResult.tool;
831
- depInstallToolInstalled = installResult.toolInstalled === true;
832
- if (context.metadata.verboseLogging) {
833
- if (installResult.toolInstalled) {
834
- logger.info(` 🛠️ Auto-installed missing tool '${installResult.tool}'`);
846
+ // ENTERPRISE TOOL PATH FIRST: a "command not found" for a KNOWN system
847
+ // tool (e.g. `zip`, `git`, `make`) is NOT a project-dependency problem
848
+ // it needs an OS-level install with user consent. Handle it here too
849
+ // (covers tools invoked mid-command by scripts), then re-run.
850
+ const missingTool = this.detectMissingSystemTool(command);
851
+ if (missingTool) {
852
+ const toolOutcome = await this.ensureSystemTool(context, command);
853
+ if (toolOutcome === null) {
854
+ // Installed — retry the original command once.
855
+ return this.executeOnHost(context, command, fallbackAttempts, depRetries + 1);
856
+ }
857
+ // User declined / install failed / non-interactive: fall through to
858
+ // record the failed run with the actionable message.
859
+ if (context.metadata.verboseLogging) {
860
+ logger.info(` 🛠️ Tool '${missingTool}' not available — ${toolOutcome}`);
835
861
  }
836
- logger.info(` 📦 Dependency install ${installResult.success ? 'succeeded' : 'failed'}: ${installResult.command || installResult.message}`);
862
+ depInstallAttempted = true;
863
+ depInstallSucceeded = false;
864
+ depInstallTool = missingTool;
865
+ toolBlockError = toolOutcome;
837
866
  }
838
- if (installResult.success) {
839
- // Retry the original command once after a successful install
840
- return this.executeOnHost(context, command, fallbackAttempts, depRetries + 1);
867
+ else {
868
+ if (context.metadata.verboseLogging) {
869
+ logger.info(' 📦 Command failed missing dependency detected, installing...');
870
+ }
871
+ // autoInstallTools defaults to true; set metadata.autoInstallTools=false
872
+ // to only run the install command without bootstrapping missing tools.
873
+ const autoInstallTools = context.metadata.autoInstallTools !== false;
874
+ const installResult = this.installDependencies(context.workingDirectory, autoInstallTools, command);
875
+ depInstallAttempted = true;
876
+ depInstallSucceeded = installResult.success;
877
+ depInstallTool = installResult.tool;
878
+ depInstallToolInstalled = installResult.toolInstalled === true;
879
+ if (context.metadata.verboseLogging) {
880
+ if (installResult.toolInstalled) {
881
+ logger.info(` 🛠️ Auto-installed missing tool '${installResult.tool}'`);
882
+ }
883
+ logger.info(` 📦 Dependency install ${installResult.success ? 'succeeded' : 'failed'}: ${installResult.command || installResult.message}`);
884
+ }
885
+ if (installResult.success) {
886
+ // Retry the original command once after a successful install
887
+ return this.executeOnHost(context, command, fallbackAttempts, depRetries + 1);
888
+ }
841
889
  }
842
890
  }
843
891
  const runResult = {
@@ -847,7 +895,7 @@ export class RunnerAgent extends Agent {
847
895
  stdout: stdout.slice(0, MAX_OUTPUT_LENGTH),
848
896
  stderr: stderr.slice(0, MAX_OUTPUT_LENGTH),
849
897
  duration,
850
- error: execError,
898
+ error: toolBlockError || execError,
851
899
  dependencyInstallAttempted: depInstallAttempted,
852
900
  dependencyInstallSucceeded: depInstallSucceeded,
853
901
  dependencyInstallTool: depInstallTool,
@@ -857,7 +905,7 @@ export class RunnerAgent extends Agent {
857
905
  if (depInstallAttempted) {
858
906
  this.report(context, depInstallSucceeded ? 'installed' : 'failed', depInstallSucceeded
859
907
  ? 'Installed missing dependencies — re-running the command'
860
- : `Dependency install failed (${depInstallTool || 'unknown tool'})`);
908
+ : toolBlockError || `Dependency install failed (${depInstallTool || 'unknown tool'})`);
861
909
  }
862
910
  context.metadata['dependencyInstallAttempted'] = depInstallAttempted;
863
911
  context.metadata['dependencyInstallSucceeded'] = depInstallSucceeded;
@@ -885,9 +933,11 @@ export class RunnerAgent extends Agent {
885
933
  success: exitCode === 0,
886
934
  summary: exitCode === 0
887
935
  ? `✅ Command succeeded: ${command}`
888
- : `❌ Command failed (exit ${exitCode}): ${command}`,
936
+ : toolBlockError
937
+ ? `❌ Required tool not available: ${command}`
938
+ : `❌ Command failed (exit ${exitCode}): ${command}`,
889
939
  details: lines.join('\n'),
890
- error: execError && exitCode !== 0 ? execError : undefined,
940
+ error: (toolBlockError || execError) && exitCode !== 0 ? (toolBlockError || execError) : undefined,
891
941
  };
892
942
  }
893
943
  /**
@@ -901,11 +951,28 @@ export class RunnerAgent extends Agent {
901
951
  /**
902
952
  * Ask the LLM for the NEXT command after a previous command failed.
903
953
  * This is what makes the repair loop ADAPT instead of re-running the same
904
- * failing command: the LLM sees the task, the previous command, and its
905
- * captured stdout/stderr, and proposes a corrected command (e.g. create the
906
- * Cloudflare Pages project before deploying).
954
+ * failing command: the LLM sees the task, the previous command, its captured
955
+ * stdout/stderr, AND the full project context (written files + reference
956
+ * docs), and proposes a corrected command (e.g. create the Cloudflare Pages
957
+ * project before deploying, or — when the deliverable CANNOT run in this
958
+ * environment — the PACKAGING command that produces the deployable artifact).
907
959
  */
908
960
  async askLLMForRepairCommand(context, callLLM, taskDescription) {
961
+ // DETERMINISTIC FAST-PATH: when the project is a known addon/package that
962
+ // cannot execute in this environment (e.g. an NVDA addon needs NVDA, an
963
+ // iOS app needs Xcode), a previous RUN attempt can never succeed — the
964
+ // correct action is to PACKAGE it (zip the source tree into the deployable
965
+ // artifact). Detecting this deterministically avoids asking a weak model
966
+ // to re-guess a run command (the observed failure: 3+ useless `python3
967
+ // globalPlugins/addon_main.py` variants). Falls through to the LLM when no
968
+ // deterministic package target exists.
969
+ const packaging = this.detectPackagingCommand(context);
970
+ if (packaging) {
971
+ if (context.metadata.verboseLogging) {
972
+ logger.info(` 📦 Deliverable cannot run here — proposing packaging command: ${packaging}`);
973
+ }
974
+ return packaging;
975
+ }
909
976
  const prev = context.metadata.runResult;
910
977
  const prevLines = prev
911
978
  ? [
@@ -915,17 +982,35 @@ export class RunnerAgent extends Agent {
915
982
  prev.stderr ? `stderr:\n${prev.stderr.slice(0, 1500)}` : '',
916
983
  ].filter(Boolean).join('\n')
917
984
  : 'No previous run recorded.';
985
+ const filesChanged = context.fileChanges
986
+ .map((c) => {
987
+ const head = (c.newContent || '').slice(0, 400);
988
+ return ` - ${c.path} (${c.status})${head ? `:\n${head}${head.length >= 400 ? '…' : ''}` : ''}`;
989
+ })
990
+ .join('\n');
991
+ const referenceSection = referenceDocsFor(`${taskDescription} ${context.goal}`);
918
992
  const prompt = [
919
993
  'A command failed during execution. Propose the NEXT command to run.',
920
994
  '',
921
995
  `Task: ${taskDescription}`,
922
996
  '',
997
+ 'Files that were just written for this task:',
998
+ filesChanged || ' (no files recorded)',
999
+ '',
1000
+ referenceSection,
1001
+ '',
923
1002
  'The previous attempt failed:',
924
1003
  prevLines,
925
1004
  '',
926
- 'Analyze the failure and propose a corrected command that addresses the error',
927
- '(e.g. create a missing project/configuration first, use a different flag, or',
928
- 'skip a step that is already done). Do NOT repeat the failed command unchanged.',
1005
+ 'Analyze the failure. IMPORTANT decide what KIND of action is correct:',
1006
+ '- If the deliverable CANNOT RUN in this environment (a plugin/addon that needs',
1007
+ ' its host app, e.g. an NVDA addon needs NVDA; an iOS app needs Xcode), do NOT',
1008
+ ' try to execute it. Instead propose the PACKAGING command that produces the',
1009
+ ' deployable artifact (e.g. `zip -r myaddon.nvda-addon manifest.ini globalPlugins`)',
1010
+ ' or a static verification (e.g. `python3 -m py_compile`).',
1011
+ '- If it CAN run, address the error (create a missing project/config first,',
1012
+ ' use a different flag, or skip a step that is already done).',
1013
+ 'Do NOT repeat the failed command unchanged.',
929
1014
  '',
930
1015
  'Return ONLY the single shell command to run next, with no explanation or markdown.',
931
1016
  ].join('\n');
@@ -945,11 +1030,29 @@ export class RunnerAgent extends Agent {
945
1030
  }
946
1031
  /**
947
1032
  * Fallback: ask the LLM what command to run based on the project context.
948
- * Includes project's package.json metadata so the LLM can make an informed choice.
1033
+ * Includes the written file contents, package.json metadata, and curated
1034
+ * reference docs (referenceDocsFor) so the LLM can choose a CORRECT action —
1035
+ * including recognizing when the deliverable CANNOT run in this environment
1036
+ * (a plugin/addon that needs its host app) and proposing the PACKAGING
1037
+ * command that produces the deployable artifact instead of a useless run.
949
1038
  */
950
1039
  async askLLMForCommand(context, callLLM) {
1040
+ // DETERMINISTIC FAST-PATH (same as the repair path): if the written project
1041
+ // is a known addon/package that cannot execute here, return the packaging
1042
+ // command directly — a weak model asked "what command runs this?" will
1043
+ // otherwise guess `python3 globalPlugins/addon_main.py` (observed live).
1044
+ const packaging = this.detectPackagingCommand(context);
1045
+ if (packaging) {
1046
+ if (context.metadata.verboseLogging) {
1047
+ logger.info(` 📦 Deliverable cannot run here — proposing packaging command: ${packaging}`);
1048
+ }
1049
+ return packaging;
1050
+ }
951
1051
  const fileList = context.fileChanges
952
- .map((c) => ` - ${c.path} (${c.status})`)
1052
+ .map((c) => {
1053
+ const head = (c.newContent || '').slice(0, 400);
1054
+ return ` - ${c.path} (${c.status})${head ? `:\n${head}${head.length >= 400 ? '…' : ''}` : ''}`;
1055
+ })
953
1056
  .join('\n');
954
1057
  const artifactList = context.artifacts
955
1058
  .slice(0, 5)
@@ -972,16 +1075,17 @@ export class RunnerAgent extends Agent {
972
1075
  catch {
973
1076
  // Ignore — scriptsInfo stays empty
974
1077
  }
1078
+ const referenceSection = referenceDocsFor(context.goal);
975
1079
  const prompt = [
976
1080
  'You are a build-and-run expert. Given the context below, what single shell command should be executed',
977
- 'to verify the work that was done?',
1081
+ 'to verify — or, when the deliverable cannot run here, to BUILD/PACKAGE — the work that was done?',
978
1082
  '',
979
1083
  'IMPORTANT: Check if "npm test" is available. Only suggest it if the project',
980
1084
  'actually has a test script defined in package.json.',
981
1085
  '',
982
1086
  `Goal: ${context.goal}`,
983
1087
  '',
984
- 'Files changed:',
1088
+ 'Files written:',
985
1089
  fileList || ' (no files changed)',
986
1090
  '',
987
1091
  'Relevant project files:',
@@ -989,6 +1093,17 @@ export class RunnerAgent extends Agent {
989
1093
  '',
990
1094
  scriptsInfo || 'No npm scripts available.',
991
1095
  '',
1096
+ referenceSection,
1097
+ '',
1098
+ 'Decide what KIND of action is correct:',
1099
+ '- If the deliverable is a plugin/addon that needs its host application (e.g. an NVDA',
1100
+ ' addon needs NVDA; an iOS app needs Xcode), it CANNOT run in this environment.',
1101
+ ' Do NOT try to execute it. Propose the PACKAGING command that produces the',
1102
+ ' deployable artifact (e.g. `zip -r myaddon.nvda-addon manifest.ini globalPlugins`)',
1103
+ ' or a static verification (e.g. `python3 -m py_compile`).',
1104
+ '- Otherwise propose the command that runs/verifies the work (e.g. "python hello.py",',
1105
+ ' "node index.js", "go run main.go").',
1106
+ '',
992
1107
  'Return ONLY the command to run. Examples: "python hello.py" or "node index.js" or "go run main.go".',
993
1108
  'Rules:',
994
1109
  '- Return a single line command only',
@@ -1012,5 +1127,121 @@ export class RunnerAgent extends Agent {
1012
1127
  }
1013
1128
  return null;
1014
1129
  }
1130
+ /**
1131
+ * Deterministic "cannot run here → package it" detection.
1132
+ *
1133
+ * When the project written for this task is a known addon/package whose
1134
+ * runtime is NOT this machine (NVDA addon = manifest.ini + globalPlugins/
1135
+ * needs the NVDA screen reader), running it can never succeed — the correct
1136
+ * build action is to PACKAGE the source tree into the deployable artifact.
1137
+ * This returns that packaging command, or null when no deterministic target
1138
+ * exists (falls through to the LLM).
1139
+ *
1140
+ * Currently supports: NVDA addons (manifest.ini + globalPlugins/ → zip into
1141
+ * a .nvda-addon archive, the real distribution format per the reference doc).
1142
+ */
1143
+ detectPackagingCommand(context) {
1144
+ const cwd = context.workingDirectory;
1145
+ const hasManifest = existsSync(join(cwd, 'manifest.ini'));
1146
+ const hasPlugins = existsSync(join(cwd, 'globalPlugins'));
1147
+ if (!hasManifest || !hasPlugins)
1148
+ return null;
1149
+ // Only trigger for NVDA-addon goals — manifest.ini alone is ambiguous.
1150
+ const goalText = `${context.goal} ${(context.taskPlan || []).map((s) => s.description).join(' ')}`.toLowerCase();
1151
+ if (!goalText.includes('nvda') && !goalText.includes('addon'))
1152
+ return null;
1153
+ // Addon name: read from manifest.ini ([addon] name = X) or fall back to
1154
+ // the working-directory basename — sanitized for a safe zip target.
1155
+ let addonName = '';
1156
+ try {
1157
+ const manifest = readFileSync(join(cwd, 'manifest.ini'), 'utf-8');
1158
+ const nameMatch = manifest.match(/^\s*name\s*=\s*(.+?)\s*$/m);
1159
+ if (nameMatch)
1160
+ addonName = nameMatch[1].trim();
1161
+ }
1162
+ catch {
1163
+ // Fall through to dir basename below.
1164
+ }
1165
+ if (!addonName)
1166
+ addonName = cwd.split(/[\\/]/).pop() || 'addon';
1167
+ const safe = addonName.replace(/[^a-zA-Z0-9._-]/g, '-').replace(/-+/g, '-');
1168
+ return `zip -r ${safe}.nvda-addon manifest.ini globalPlugins`;
1169
+ }
1170
+ /**
1171
+ * Detect a missing system tool referenced by a command (enterprise parity).
1172
+ *
1173
+ * Scans every token of the command (so compound commands like
1174
+ * `cd addon && zip -r …` are covered), checks each against the known-tool
1175
+ * recipes, and returns the FIRST missing tool name — or null when nothing
1176
+ * is missing / unknown. Only the bare tool name is checked (paths like
1177
+ * /usr/bin/zip are unwrapped to zip).
1178
+ */
1179
+ detectMissingSystemTool(command) {
1180
+ if (!command)
1181
+ return null;
1182
+ const tokens = command.split(/[\s;&|]+/).filter(Boolean);
1183
+ for (const token of tokens) {
1184
+ if (token.startsWith('-') || token.startsWith('--'))
1185
+ continue; // flags
1186
+ const tool = token.split(/[\\/]/).pop() || token; // handle paths
1187
+ if (!isKnownSystemTool(tool))
1188
+ continue;
1189
+ if (!this.commandExists(tool))
1190
+ return tool;
1191
+ }
1192
+ return null;
1193
+ }
1194
+ /**
1195
+ * Ensure every known system tool referenced by a command is installed.
1196
+ *
1197
+ * Enterprise flow (parity with a human agent):
1198
+ * - Tool present → null (continue).
1199
+ * - Tool missing + interactive TTY → ask the user with the OS-appropriate
1200
+ * install command. On 'install': execute it, verify, and continue. On
1201
+ * 'manual'/'skip': return the manual steps as the error (the user takes
1202
+ * over the manual task — e.g. installing brew, generating a token).
1203
+ * - Tool missing + non-interactive (piped/CI) → never block; return the
1204
+ * recommended install command as the error so the user can run it.
1205
+ *
1206
+ * Returns null to proceed, or an error string that fails the step.
1207
+ */
1208
+ async ensureSystemTool(context, command) {
1209
+ const tool = this.detectMissingSystemTool(command);
1210
+ if (!tool)
1211
+ return null;
1212
+ const installCmd = toolInstallCommand(tool, process.platform, (name) => this.commandExists(name));
1213
+ const recommended = installCmd || `brew install ${tool} # macOS | sudo apt-get install -y ${tool} # Linux | winget install ${tool} # Windows`;
1214
+ if (context.metadata.verboseLogging) {
1215
+ logger.warn(` 🛠️ Missing system tool: '${tool}' (recommended: ${recommended})`);
1216
+ }
1217
+ // Non-interactive — surface the manual steps, never block.
1218
+ if (!process.stdin.isTTY) {
1219
+ return manualInstallSteps(tool, recommended);
1220
+ }
1221
+ let choice;
1222
+ try {
1223
+ choice = await promptToolInstall(tool, recommended);
1224
+ }
1225
+ catch {
1226
+ // Prompt failed (no TTY after all) — treat as manual.
1227
+ return manualInstallSteps(tool, recommended);
1228
+ }
1229
+ if (choice === 'manual' || choice === 'skip') {
1230
+ return choice === 'manual'
1231
+ ? manualInstallSteps(tool, recommended)
1232
+ : `Skipped installing '${tool}' — the step was not run. Install it manually (${recommended}) and re-run the task.`;
1233
+ }
1234
+ // 'install' — execute the recommended command, verify, continue.
1235
+ logger.info(` 🛠️ Installing '${tool}' via: ${recommended}`);
1236
+ const installResult = this.runInstallCommand(recommended, context.workingDirectory);
1237
+ if (!installResult.success) {
1238
+ return `Failed to auto-install '${tool}' (${installResult.message || 'install command failed'}).\n${manualInstallSteps(tool, recommended)}`;
1239
+ }
1240
+ if (!this.commandExists(tool)) {
1241
+ return `Installed '${tool}' but it is not on PATH for this process yet — open a new terminal and re-run, or: ${recommended}`;
1242
+ }
1243
+ logger.success(` ✅ Installed '${tool}' — continuing.`);
1244
+ return null;
1245
+ }
1015
1246
  }
1016
1247
  //# sourceMappingURL=runner.js.map