@nac3/forge-cli 1.26.0 → 1.28.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.
Files changed (93) hide show
  1. package/dist/chat/graph_snapshot.d.ts +24 -0
  2. package/dist/chat/graph_snapshot.d.ts.map +1 -1
  3. package/dist/chat/graph_snapshot.js +28 -3
  4. package/dist/chat/graph_snapshot.js.map +1 -1
  5. package/dist/chat/history_budget.d.ts +114 -0
  6. package/dist/chat/history_budget.d.ts.map +1 -0
  7. package/dist/chat/history_budget.js +98 -0
  8. package/dist/chat/history_budget.js.map +1 -0
  9. package/dist/chat/panel.d.ts.map +1 -1
  10. package/dist/chat/panel.js +26 -0
  11. package/dist/chat/panel.js.map +1 -1
  12. package/dist/chat/server.d.ts.map +1 -1
  13. package/dist/chat/server.js +59 -1
  14. package/dist/chat/server.js.map +1 -1
  15. package/dist/chat/tools/pending.d.ts.map +1 -1
  16. package/dist/chat/tools/pending.js +25 -10
  17. package/dist/chat/tools/pending.js.map +1 -1
  18. package/dist/chat/tools/pending_ack.d.ts +82 -0
  19. package/dist/chat/tools/pending_ack.d.ts.map +1 -0
  20. package/dist/chat/tools/pending_ack.js +55 -0
  21. package/dist/chat/tools/pending_ack.js.map +1 -0
  22. package/dist/chat/tools/reader.d.ts.map +1 -1
  23. package/dist/chat/tools/reader.js +24 -4
  24. package/dist/chat/tools/reader.js.map +1 -1
  25. package/dist/commands/operate.d.ts.map +1 -1
  26. package/dist/commands/operate.js +42 -0
  27. package/dist/commands/operate.js.map +1 -1
  28. package/dist/commands/urazuke.d.ts.map +1 -1
  29. package/dist/commands/urazuke.js +189 -9
  30. package/dist/commands/urazuke.js.map +1 -1
  31. package/dist/core/instructions_budget.d.ts +113 -0
  32. package/dist/core/instructions_budget.d.ts.map +1 -0
  33. package/dist/core/instructions_budget.js +165 -0
  34. package/dist/core/instructions_budget.js.map +1 -0
  35. package/dist/core/limits_config.d.ts +23 -0
  36. package/dist/core/limits_config.d.ts.map +1 -1
  37. package/dist/core/limits_config.js +36 -0
  38. package/dist/core/limits_config.js.map +1 -1
  39. package/dist/core/machine_files.d.ts +27 -0
  40. package/dist/core/machine_files.d.ts.map +1 -0
  41. package/dist/core/machine_files.js +97 -0
  42. package/dist/core/machine_files.js.map +1 -0
  43. package/dist/docs/doctrine/session-orchestration.md +109 -109
  44. package/dist/docs/doctrine/urazuke.md +221 -221
  45. package/dist/nac3/dispatch_log.d.ts +16 -1
  46. package/dist/nac3/dispatch_log.d.ts.map +1 -1
  47. package/dist/nac3/dispatch_log.js +29 -10
  48. package/dist/nac3/dispatch_log.js.map +1 -1
  49. package/dist/nac3/manifest_lazy.d.ts +15 -0
  50. package/dist/nac3/manifest_lazy.d.ts.map +1 -1
  51. package/dist/nac3/manifest_lazy.js +17 -1
  52. package/dist/nac3/manifest_lazy.js.map +1 -1
  53. package/dist/telemetry/battery_events.d.ts +91 -0
  54. package/dist/telemetry/battery_events.d.ts.map +1 -0
  55. package/dist/telemetry/battery_events.js +84 -0
  56. package/dist/telemetry/battery_events.js.map +1 -0
  57. package/dist/telemetry/usage.d.ts.map +1 -1
  58. package/dist/telemetry/usage.js +11 -25
  59. package/dist/telemetry/usage.js.map +1 -1
  60. package/dist/urazuke/evidence.d.ts.map +1 -1
  61. package/dist/urazuke/evidence.js +14 -2
  62. package/dist/urazuke/evidence.js.map +1 -1
  63. package/dist/urazuke/freeze.d.ts.map +1 -1
  64. package/dist/urazuke/freeze.js +82 -16
  65. package/dist/urazuke/freeze.js.map +1 -1
  66. package/dist/urazuke/gates_data.d.ts +4 -1
  67. package/dist/urazuke/gates_data.d.ts.map +1 -1
  68. package/dist/urazuke/gates_data.js +7 -1
  69. package/dist/urazuke/gates_data.js.map +1 -1
  70. package/dist/urazuke/gates_ledger.d.ts +25 -1
  71. package/dist/urazuke/gates_ledger.d.ts.map +1 -1
  72. package/dist/urazuke/gates_ledger.js +30 -6
  73. package/dist/urazuke/gates_ledger.js.map +1 -1
  74. package/dist/urazuke/method_config.d.ts +116 -0
  75. package/dist/urazuke/method_config.d.ts.map +1 -0
  76. package/dist/urazuke/method_config.js +328 -0
  77. package/dist/urazuke/method_config.js.map +1 -0
  78. package/dist/urazuke/prompts_client.d.ts +42 -12
  79. package/dist/urazuke/prompts_client.d.ts.map +1 -1
  80. package/dist/urazuke/prompts_client.js +120 -16
  81. package/dist/urazuke/prompts_client.js.map +1 -1
  82. package/dist/urazuke/prompts_freeze.d.ts +186 -0
  83. package/dist/urazuke/prompts_freeze.d.ts.map +1 -0
  84. package/dist/urazuke/prompts_freeze.js +498 -0
  85. package/dist/urazuke/prompts_freeze.js.map +1 -0
  86. package/dist/urazuke/start.d.ts.map +1 -1
  87. package/dist/urazuke/start.js +42 -2
  88. package/dist/urazuke/start.js.map +1 -1
  89. package/dist/version.d.ts +1 -1
  90. package/dist/version.js +1 -1
  91. package/docs/doctrine/session-orchestration.md +109 -109
  92. package/docs/doctrine/urazuke.md +221 -221
  93. package/package.json +125 -124
@@ -66,6 +66,7 @@ import { getSessionProject, setSessionProject } from './session_projects.js';
66
66
  import { beginTurn, endTurn, interruptActiveTurn, interruptAllTurns, isTurnActive, activeTurnId, activeTurns, } from './turn_control.js';
67
67
  import { openSteering, closeSteering, drainSteers, formatSteer, queueSteer, pendingSteers, } from './turn_steering.js';
68
68
  import { manifest as nac3Manifest } from '../nac3/internal_manifest.js';
69
+ import { buildToolDefs } from '../mcp/forge_verbs_server.js';
69
70
  import { buildManifestForPrompt } from '../nac3/manifest_lazy.js';
70
71
  import { popPending, logApproval } from '../nac3/approval_queue.js';
71
72
  /**
@@ -2022,7 +2023,16 @@ async function route(req, res, ctx) {
2022
2023
  const { resolvePrompts } = await import('../urazuke/prompts_client.js');
2023
2024
  const r = await resolvePrompts(ctx.projectRoot);
2024
2025
  const contracts = Object.keys(r.prompts).sort().map((key) => ({ key, prompts: r.prompts[key], source: r.source[key] ?? 'vendored', overridden: r.overridden.includes(key) }));
2025
- sendJson(res, 200, { ok: true, version: r.version, contracts });
2026
+ /* PND-277 -- el congelado y sus avisos viajan al panel por la misma
2027
+ * puerta que los contratos. Lo que el CLI dice, el panel tiene que
2028
+ * poder decir: si el congelado no verifica, o si el archivo viejo no
2029
+ * declara si es congelado u override, quien mira el panel se tiene
2030
+ * que enterar ahi mismo. */
2031
+ sendJson(res, 200, {
2032
+ ok: true, version: r.version, contracts,
2033
+ ...(r.frozen ? { frozen: r.frozen } : {}),
2034
+ ...(r.notices ? { notices: r.notices } : {}),
2035
+ });
2026
2036
  }
2027
2037
  catch (e) {
2028
2038
  sendJson(res, 500, { ok: false, error: e instanceof Error ? e.message : String(e) });
@@ -6892,6 +6902,29 @@ async function handleChat(req, res, ctx) {
6892
6902
  * user turn; fall back to the client view if not. */
6893
6903
  turnMessages = normalized;
6894
6904
  }
6905
+ /* P0 (PND-281) -- el presupuesto de lo que se arrastra. Va ACA y no en
6906
+ * `flattenMessages` a proposito: aca lo cobran TODOS los cerebros (el
6907
+ * camino CLI aplana, los de HTTP mandan el `messages[]`), y los dos
6908
+ * pagan el prefijo en cada llamada de la rueda de herramientas.
6909
+ *
6910
+ * Los mensajes del dueno NO se tocan. Lo que se acota son las
6911
+ * respuestas viejas del agente, que quedan en el `sessionStore` y se
6912
+ * piden si hacen falta. El detalle de por que, y los numeros, estan en
6913
+ * la cabecera de history_budget.ts. */
6914
+ let historyBudgetApplied = { detached: 0, saved_chars: 0 };
6915
+ try {
6916
+ const { budgetHistory } = await import('./history_budget.js');
6917
+ const { readLimitsConfig: _readLimForHist } = await import('../core/limits_config.js');
6918
+ const _limHist = await _readLimForHist();
6919
+ const recortado = budgetHistory(turnMessages, {
6920
+ agentBudgetTokens: _limHist.agent_history_budget_tokens,
6921
+ transcriptHint: sessionStore.filePath,
6922
+ });
6923
+ turnMessages = recortado.messages;
6924
+ historyBudgetApplied = { detached: recortado.detached, saved_chars: recortado.saved_chars };
6925
+ }
6926
+ catch { /* nunca bloquear el turno por el recorte */ }
6927
+ void historyBudgetApplied;
6895
6928
  /* Register THIS turn as the active one right before the model
6896
6929
  * call. beginTurn returns the AbortSignal the callers honor
6897
6930
  * (claude.ts at round boundary, claude_cli kills the subprocess).
@@ -7738,6 +7771,21 @@ async function handleChat(req, res, ctx) {
7738
7771
  }
7739
7772
  }
7740
7773
  }
7774
+ /** Los verb_id que ya viajan como tool MCP individual con su esquema
7775
+ * completo (server `forge_verbs`). Se calcula de la MISMA fuente que
7776
+ * `claude_cli.ts` usa para registrarlas -- `buildToolDefs` sobre el
7777
+ * manifest -- para que agregar un prefijo a `EXPOSE_PREFIXES` no deje las
7778
+ * dos listas desincronizadas (par productor/consumidor, SQ 14).
7779
+ *
7780
+ * Se memoiza porque el manifest no cambia en caliente y esto corre en cada
7781
+ * turno. */
7782
+ let _verbosExpuestosCache;
7783
+ function verbosYaExpuestosComoTool() {
7784
+ if (!_verbosExpuestosCache) {
7785
+ _verbosExpuestosCache = [...buildToolDefs(nac3Manifest().verbs).nameToVerb.values()];
7786
+ }
7787
+ return _verbosExpuestosCache;
7788
+ }
7741
7789
  export function buildSystemPrompt(ctx, mode = 'didactico', pilotState = {
7742
7790
  pilot_completed: true, target_pending: false, mode_pending: false,
7743
7791
  },
@@ -8096,6 +8144,16 @@ multiagentEnabled = false) {
8096
8144
  /* operate mode (Pablo 2026-10-10): the config/orchestrator verbs only
8097
8145
  * exist in the prompt when the deployment profile authorises them. */
8098
8146
  includeOperateVerbs: operateEnabled(),
8147
+ /* 1a (PND-282) -- no describir dos veces el mismo verbo. Solo cuando
8148
+ * el camino de esta request LLEVA las tools individuales: `panelMode
8149
+ * === 'mcp-bridge'` es exactamente el caso claude-code-cli con el
8150
+ * bridge vivo, que es cuando `claude_cli.ts` registra el server
8151
+ * `forge_verbs` con su `buildToolDefs`. En el camino HTTP (BYOK /
8152
+ * Console / managed) NO hay tools individuales y el stub es la unica
8153
+ * puerta: ahi no se recorta nada. */
8154
+ alreadyExposedVerbIds: panelMode === 'mcp-bridge'
8155
+ ? verbosYaExpuestosComoTool()
8156
+ : undefined,
8099
8157
  }).text,
8100
8158
  /* alpha.59z.37 NAC-3 v3.x backend tools (task #23 slice 1):
8101
8159
  * splice the pre-built app.* verbs section. Empty string ->