nanoodle 0.4.0 → 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.
package/README.md CHANGED
@@ -46,10 +46,6 @@ npm install nanoodle # library + CLI
46
46
  npx nanoodle --help # or run the CLI without installing
47
47
  ```
48
48
 
49
- Latest on npm is **0.2.0**; accountless `--pay` (x402) and the local-media
50
- nodes below need 0.4 — until it ships, install from this repo
51
- (`npm install github:nanoodlecom/nanoodle-js`).
52
-
53
49
  ## Quickstart (library)
54
50
 
55
51
  ```js
@@ -164,7 +160,7 @@ all fail **before** anything is spent.
164
160
  | local media† | resize, vframes, combine, soundtrack, trim, extractaudio |
165
161
  | NanoGPT | llm (incl. vision + audio input), image, draw, edit, inpaint*, vision, tvideo, ivideo, vedit, lipsync, music, remix, tts, transcribe |
166
162
 
167
- † **local media** (0.4, unreleased — see [Install](#install)) prefers a pure-JS path that matches the browser (lossless mp4 remux, PCM-WAV trim, PNG resize). **ffmpeg** on `PATH` is the fallback for everything else (soft dependency — not an npm package); clear error if it’s required and missing.
163
+ † **local media** prefers a pure-JS path that matches the browser (lossless mp4 remux, PCM-WAV trim, PNG resize). **ffmpeg** on `PATH` is the fallback for everything else (soft dependency — not an npm package); clear error if it’s required and missing.
168
164
 
169
165
  \* **inpaint:** the mask is composited onto black at the source image’s pixel
170
166
  size before send (same as the browser app) — white = repaint, black = keep.
@@ -202,7 +198,7 @@ A price of `0` means known-included (subscription), not unknown. `inspect`
202
198
  and loading/validating workflows never call the API. No telemetry, no
203
199
  analytics; the API key is never logged.
204
200
 
205
- ## No account at all: pay per run in Nano (x402) — 0.4, unreleased
201
+ ## No account at all: pay per run in Nano (x402)
206
202
 
207
203
  NanoGPT supports [x402](https://nano-gpt.com) accountless payments: call the
208
204
  API with no key, get an HTTP 402 invoice, settle it in Nano (XNO — instant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanoodle",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Run nanoodle visual AI workflows from JavaScript — zero-dependency executor for saved noodle-graph.json files",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
package/src/nodes.mjs CHANGED
@@ -188,6 +188,18 @@ function isValidCustomAir(air) {
188
188
  return /^(civitai:\d+@\d+|persona:\d+@\d+|runware:[^\s@]+@[^\s@]+)$/i.test(air);
189
189
  }
190
190
 
191
+ // FLUX-family platform AIRs are guidance-distilled (CFG=1) — a negative prompt has no effect, so
192
+ // omit it. Ids: 100/101 FLUX.1, 103/104 depth/canny, 106 kontext, 107 krea, 111 SRPO, 160 Flex.1,
193
+ // 400 FLUX.2/klein. Mirrors the app.
194
+ function airTakesNegative(air) { return !/^runware:(100|101|103|104|106|107|111|160|400)@/i.test(String(air || "")); }
195
+
196
+ // The NanoGPT catalog also lists AIR-style ids as DIRECT models (e.g. persona:376130@2456367) —
197
+ // same Runware path, same negative_prompt support, same FLUX gate.
198
+ function airModelTakesNegative(model) {
199
+ const m = String(model || "");
200
+ return /^(persona:|civitai:|runware:)/i.test(m) && airTakesNegative(m);
201
+ }
202
+
191
203
  /** Per-call image extras: LoRA params + fixed seed (when numeric) + custom-civitai AIR. */
192
204
  function imgExtra(n) {
193
205
  const e = loraParams(n);
@@ -200,6 +212,13 @@ function imgExtra(n) {
200
212
  throw new NanoodleError("AIR must look like civitai:MODEL@VERSION, runware:id@rev, or persona:MODEL@VERSION");
201
213
  }
202
214
  e.customCivitaiAir = air;
215
+ // snake_case only — negativePrompt (camelCase) is silently dropped by the API; same-seed
216
+ // probe on persona:376130@2456367 confirmed negative_prompt reaches the sampler (2026-07-18)
217
+ const np = String(n.fields.negativePrompt || "").trim();
218
+ if (np && airTakesNegative(air)) e.negative_prompt = np;
219
+ } else if (airModelTakesNegative(n.fields.model)) {
220
+ const np = String(n.fields.negativePrompt || "").trim();
221
+ if (np) e.negative_prompt = np;
203
222
  }
204
223
  return e;
205
224
  }
package/src/workflow.mjs CHANGED
@@ -360,7 +360,13 @@ export class Workflow {
360
360
 
361
361
  const failedSinks = this.outputs.filter((o) => nodesRec[o.nodeId] && nodesRec[o.nodeId].status === "error");
362
362
  if (failedSinks.length) {
363
- const detail = failedSinks.map((o) => `"${o.key}": ${nodesRec[o.nodeId].error}`).join("; ");
363
+ let detail = failedSinks.map((o) => `"${o.key}": ${nodesRec[o.nodeId].error}`).join("; ");
364
+ // "upstream failed: X" only names the sink's neighbor — name the node(s) that actually broke
365
+ const sinkIds = new Set(failedSinks.map((o) => o.nodeId));
366
+ const roots = errors.filter((e) => !sinkIds.has(e.nodeId) && !/^upstream failed: /.test(e.message));
367
+ if (roots.length) {
368
+ detail += ` (root cause — ${roots.map((e) => `"${e.name}": ${e.message}`).join("; ")})`;
369
+ }
364
370
  throw new RunError("run failed — " + detail, result);
365
371
  }
366
372
  return result;