@nathapp/nax 0.32.0 → 0.32.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
@@ -300,15 +300,96 @@ Integrate notifications, CI triggers, or custom scripts via lifecycle hooks.
300
300
  | Event | Fires when |
301
301
  |:------|:-----------|
302
302
  | `on-start` | Run begins |
303
- | `on-story-start` | A story starts |
304
- | `on-story-complete` | A story passes |
305
- | `on-story-fail` | A story exhausts all attempts |
306
- | `on-pause` | Run paused (awaiting input) |
307
- | `on-complete` | All stories done |
308
- | `on-error` | Unhandled error |
303
+ | `on-story-start` | A story starts processing |
304
+ | `on-story-complete` | A story passes all checks |
305
+ | `on-story-fail` | A story exhausts all retry attempts |
306
+ | `on-pause` | Run paused (awaiting human input) |
307
+ | `on-resume` | Run resumed after pause |
308
+ | `on-session-end` | An agent session ends (per-session teardown) |
309
+ | `on-complete` | All stories finished successfully |
310
+ | `on-error` | Unhandled error terminates the run |
309
311
 
310
312
  Each hook receives context via `NAX_*` environment variables and full JSON on stdin.
311
313
 
314
+ **Environment variables passed to hooks:**
315
+
316
+ | Variable | Description |
317
+ |:---------|:------------|
318
+ | `NAX_EVENT` | Event name (e.g., `on-story-complete`) |
319
+ | `NAX_FEATURE` | Feature name |
320
+ | `NAX_STORY_ID` | Current story ID (if applicable) |
321
+ | `NAX_STATUS` | Status (`pass`, `fail`, `paused`, `error`) |
322
+ | `NAX_REASON` | Reason for pause or error |
323
+ | `NAX_COST` | Accumulated cost in USD |
324
+ | `NAX_MODEL` | Current model |
325
+ | `NAX_AGENT` | Current agent |
326
+ | `NAX_ITERATION` | Current iteration number |
327
+
328
+ **Global vs project hooks:** Global hooks (`~/.nax/hooks.json`) fire alongside project hooks. Set `"skipGlobal": true` in your project `hooks.json` to disable global hooks.
329
+
330
+ ---
331
+
332
+ ## Interaction Triggers
333
+
334
+ nax can pause execution and prompt you for decisions at critical points. Configure triggers in `nax/config.json` (or `~/.nax/config.json` globally):
335
+
336
+ ```json
337
+ {
338
+ "interaction": {
339
+ "plugin": "telegram",
340
+ "defaults": {
341
+ "timeout": 600000,
342
+ "fallback": "escalate"
343
+ },
344
+ "triggers": {
345
+ "security-review": true,
346
+ "cost-exceeded": true,
347
+ "cost-warning": true,
348
+ "max-retries": true,
349
+ "human-review": true,
350
+ "story-ambiguity": true,
351
+ "review-gate": true,
352
+ "pre-merge": false,
353
+ "merge-conflict": true
354
+ }
355
+ }
356
+ }
357
+ ```
358
+
359
+ **Available triggers:**
360
+
361
+ | Trigger | Safety | Default Fallback | Description |
362
+ |:--------|:------:|:----------------:|:------------|
363
+ | `security-review` | 🔴 Red | `abort` | Critical security issues found during review |
364
+ | `cost-exceeded` | 🔴 Red | `abort` | Run cost exceeded the configured limit |
365
+ | `merge-conflict` | 🔴 Red | `abort` | Git merge conflict detected |
366
+ | `cost-warning` | 🟡 Yellow | `escalate` | Approaching cost limit — escalate to higher model tier? |
367
+ | `max-retries` | 🟡 Yellow | `skip` | Story exhausted all retry attempts — skip and continue? |
368
+ | `pre-merge` | 🟡 Yellow | `escalate` | Checkpoint before merging to main branch |
369
+ | `human-review` | 🟡 Yellow | `skip` | Human review required on critical failure |
370
+ | `story-ambiguity` | 🟢 Green | `continue` | Story requirements unclear — continue with best effort? |
371
+ | `review-gate` | 🟢 Green | `continue` | Code review checkpoint before proceeding |
372
+
373
+ **Safety tiers:**
374
+ - 🔴 **Red** — Critical; defaults to aborting if no response
375
+ - 🟡 **Yellow** — Caution; defaults to escalating or skipping
376
+ - 🟢 **Green** — Informational; defaults to continuing
377
+
378
+ **Fallback behaviors** (when interaction times out):
379
+ - `continue` — proceed as normal
380
+ - `skip` — skip the current story
381
+ - `escalate` — escalate to a higher model tier
382
+ - `abort` — stop the run
383
+
384
+ **Interaction plugins:**
385
+
386
+ | Plugin | Description |
387
+ |:-------|:------------|
388
+ | `telegram` | Send prompts via Telegram bot (recommended for remote runs) |
389
+ | `cli` | Interactive terminal prompts (for local runs) |
390
+ | `webhook` | POST interaction requests to a webhook URL |
391
+ | `auto` | Auto-respond based on fallback behavior (no human prompt) |
392
+
312
393
  ---
313
394
 
314
395
  ## Plugins
package/dist/nax.js CHANGED
@@ -19531,7 +19531,7 @@ var package_default;
19531
19531
  var init_package = __esm(() => {
19532
19532
  package_default = {
19533
19533
  name: "@nathapp/nax",
19534
- version: "0.32.0",
19534
+ version: "0.32.1",
19535
19535
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
19536
19536
  type: "module",
19537
19537
  bin: {
@@ -19593,8 +19593,8 @@ var init_version = __esm(() => {
19593
19593
  NAX_VERSION = package_default.version;
19594
19594
  NAX_COMMIT = (() => {
19595
19595
  try {
19596
- if (/^[0-9a-f]{6,10}$/.test("76e82f7"))
19597
- return "76e82f7";
19596
+ if (/^[0-9a-f]{6,10}$/.test("f3068ba"))
19597
+ return "f3068ba";
19598
19598
  } catch {}
19599
19599
  try {
19600
19600
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
@@ -27640,7 +27640,8 @@ function validateHookCommand(command) {
27640
27640
  }
27641
27641
  }
27642
27642
  function parseCommandToArgv(command) {
27643
- return command.trim().split(/\s+/);
27643
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
27644
+ return command.trim().split(/\s+/).map((token) => token.startsWith("~/") ? home + token.slice(1) : token);
27644
27645
  }
27645
27646
  async function executeHook(hookDef, ctx, workdir) {
27646
27647
  if (hookDef.enabled === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "AI Coding Agent Orchestrator \u2014 loops until done",
5
5
  "type": "module",
6
6
  "bin": {
@@ -144,8 +144,12 @@ export function validateHookCommand(command: string): void {
144
144
  * @param command - Command string
145
145
  * @returns Array of command and arguments
146
146
  */
147
- function parseCommandToArgv(command: string): string[] {
148
- return command.trim().split(/\s+/);
147
+ export function parseCommandToArgv(command: string): string[] {
148
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
149
+ return command
150
+ .trim()
151
+ .split(/\s+/)
152
+ .map((token) => (token.startsWith("~/") ? home + token.slice(1) : token));
149
153
  }
150
154
 
151
155
  /**