agent-nuvira 3.2.0 → 3.3.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/.agents/skills/code-assessment/SKILL.md +10 -1
- package/.agents/skills/index.json +1 -1
- package/README.md +42 -1
- package/dist/agents/agents/writer.d.ts.map +1 -1
- package/dist/agents/agents/writer.js +7 -1
- package/dist/agents/agents/writer.js.map +1 -1
- package/dist/cli/chat.d.ts +6 -0
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +45 -1
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/cli-program.d.ts.map +1 -1
- package/dist/cli/cli-program.js +6 -2
- package/dist/cli/cli-program.js.map +1 -1
- package/dist/cli/commands.d.ts +2 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +3 -2
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/config.js +2 -2
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/dashboard.d.ts +26 -0
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +123 -3
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/execute.d.ts.map +1 -1
- package/dist/cli/execute.js +48 -3
- package/dist/cli/execute.js.map +1 -1
- package/dist/cli/intent.d.ts +1 -1
- package/dist/cli/intent.js +2 -2
- package/dist/cli/intent.js.map +1 -1
- package/dist/cli/loop-executor.d.ts +24 -0
- package/dist/cli/loop-executor.d.ts.map +1 -1
- package/dist/cli/loop-executor.js +161 -1
- package/dist/cli/loop-executor.js.map +1 -1
- package/dist/cli/process-control.d.ts +15 -0
- package/dist/cli/process-control.d.ts.map +1 -1
- package/dist/cli/process-control.js +38 -14
- package/dist/cli/process-control.js.map +1 -1
- package/dist/cli/trace.d.ts +19 -0
- package/dist/cli/trace.d.ts.map +1 -1
- package/dist/cli/trace.js +82 -2
- package/dist/cli/trace.js.map +1 -1
- package/dist/forwarded.d.ts +2 -0
- package/dist/forwarded.d.ts.map +1 -0
- package/dist/forwarded.js +2 -0
- package/dist/forwarded.js.map +1 -0
- package/dist/gateway/registry.d.ts.map +1 -1
- package/dist/gateway/registry.js +22 -3
- package/dist/gateway/registry.js.map +1 -1
- package/dist/inference/tool-call-utils.d.ts +54 -0
- package/dist/inference/tool-call-utils.d.ts.map +1 -1
- package/dist/inference/tool-call-utils.js +216 -4
- package/dist/inference/tool-call-utils.js.map +1 -1
- package/dist/learning/autonomy-policy.d.ts +42 -0
- package/dist/learning/autonomy-policy.d.ts.map +1 -1
- package/dist/learning/autonomy-policy.js +115 -19
- package/dist/learning/autonomy-policy.js.map +1 -1
- package/dist/learning/cost-tracker.d.ts +14 -0
- package/dist/learning/cost-tracker.d.ts.map +1 -1
- package/dist/learning/cost-tracker.js +22 -0
- package/dist/learning/cost-tracker.js.map +1 -1
- package/dist/learning/deliverable-class.d.ts +48 -0
- package/dist/learning/deliverable-class.d.ts.map +1 -1
- package/dist/learning/deliverable-class.js +72 -0
- package/dist/learning/deliverable-class.js.map +1 -1
- package/dist/learning/engine-router.d.ts +12 -1
- package/dist/learning/engine-router.d.ts.map +1 -1
- package/dist/learning/engine-router.js +28 -0
- package/dist/learning/engine-router.js.map +1 -1
- package/dist/learning/eval-framework.d.ts +24 -0
- package/dist/learning/eval-framework.d.ts.map +1 -1
- package/dist/learning/eval-framework.js +291 -0
- package/dist/learning/eval-framework.js.map +1 -1
- package/dist/learning/intent-envelope.d.ts +162 -0
- package/dist/learning/intent-envelope.d.ts.map +1 -0
- package/dist/learning/intent-envelope.js +235 -0
- package/dist/learning/intent-envelope.js.map +1 -0
- package/dist/learning/long-form.d.ts.map +1 -1
- package/dist/learning/long-form.js +12 -1
- package/dist/learning/long-form.js.map +1 -1
- package/dist/learning/reasoning-trace.d.ts +89 -0
- package/dist/learning/reasoning-trace.d.ts.map +1 -1
- package/dist/learning/reasoning-trace.js +49 -0
- package/dist/learning/reasoning-trace.js.map +1 -1
- package/dist/learning/run-trace.d.ts +164 -0
- package/dist/learning/run-trace.d.ts.map +1 -0
- package/dist/learning/run-trace.js +342 -0
- package/dist/learning/run-trace.js.map +1 -0
- package/dist/learning/skill-store.d.ts.map +1 -1
- package/dist/learning/skill-store.js +5 -1
- package/dist/learning/skill-store.js.map +1 -1
- package/dist/learning/skill-types.d.ts +14 -0
- package/dist/learning/skill-types.d.ts.map +1 -1
- package/dist/learning/skill-types.js +19 -0
- package/dist/learning/skill-types.js.map +1 -1
- package/dist/learning/unattended-job.d.ts +57 -0
- package/dist/learning/unattended-job.d.ts.map +1 -1
- package/dist/learning/unattended-job.js +92 -0
- package/dist/learning/unattended-job.js.map +1 -1
- package/dist/nlu/conversation-gate.d.ts +9 -0
- package/dist/nlu/conversation-gate.d.ts.map +1 -1
- package/dist/nlu/conversation-gate.js +38 -17
- package/dist/nlu/conversation-gate.js.map +1 -1
- package/dist/resources/command-manifest.json +10 -10
- package/dist/skills/bundled-skills.d.ts.map +1 -1
- package/dist/skills/bundled-skills.js +13 -2
- package/dist/skills/bundled-skills.js.map +1 -1
- package/dist/tools/coding-tools.d.ts.map +1 -1
- package/dist/tools/coding-tools.js +33 -8
- package/dist/tools/coding-tools.js.map +1 -1
- package/dist/tools/edit-verification.d.ts +95 -0
- package/dist/tools/edit-verification.d.ts.map +1 -1
- package/dist/tools/edit-verification.js +238 -16
- package/dist/tools/edit-verification.js.map +1 -1
- package/dist/tools/registry.d.ts +31 -2
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +44 -5
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/run-cli.d.ts.map +1 -1
- package/dist/tools/run-cli.js +15 -2
- package/dist/tools/run-cli.js.map +1 -1
- package/dist/tools/run-terminal.d.ts.map +1 -1
- package/dist/tools/run-terminal.js +23 -4
- package/dist/tools/run-terminal.js.map +1 -1
- package/dist/tools/skill-tool.d.ts.map +1 -1
- package/dist/tools/skill-tool.js +5 -0
- package/dist/tools/skill-tool.js.map +1 -1
- package/dist/tools/tool-loop.d.ts +102 -1
- package/dist/tools/tool-loop.d.ts.map +1 -1
- package/dist/tools/tool-loop.js +480 -13
- package/dist/tools/tool-loop.js.map +1 -1
- package/dist/web-dashboard/chat-console.d.ts +7 -0
- package/dist/web-dashboard/chat-console.d.ts.map +1 -1
- package/dist/web-dashboard/chat-console.js +41 -3
- package/dist/web-dashboard/chat-console.js.map +1 -1
- package/dist/web-dashboard/server.d.ts +46 -0
- package/dist/web-dashboard/server.d.ts.map +1 -1
- package/dist/web-dashboard/server.js +115 -1
- package/dist/web-dashboard/server.js.map +1 -1
- package/dist/web-dashboard/src/admin-auth.d.ts +49 -2
- package/dist/web-dashboard/src/admin-auth.d.ts.map +1 -1
- package/dist/web-dashboard/src/admin-auth.js +64 -3
- package/dist/web-dashboard/src/admin-auth.js.map +1 -1
- package/dist/web-dashboard/src/types.d.ts +41 -0
- package/dist/web-dashboard/src/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/web-dashboard/public/assets/index-CjvoBhlz.js +207 -0
- package/src/web-dashboard/public/assets/index-CjvoBhlz.js.map +1 -0
- package/src/web-dashboard/public/index.html +1 -1
- package/src/web-dashboard/public/assets/index-kCUkORm7.js +0 -207
- package/src/web-dashboard/public/assets/index-kCUkORm7.js.map +0 -1
package/dist/tools/registry.d.ts
CHANGED
|
@@ -108,6 +108,35 @@ export interface ToolContext {
|
|
|
108
108
|
* its original confirm-or-refuse behaviour exactly.
|
|
109
109
|
*/
|
|
110
110
|
authorizationRequest?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The approved INTENT ENVELOPE for this conversation — the durable, scoped
|
|
113
|
+
* grant that replaced per-action permission (see
|
|
114
|
+
* `learning/intent-envelope.ts`).
|
|
115
|
+
*
|
|
116
|
+
* `writesAuthorized` answers "does the last message ask for files?" and is
|
|
117
|
+
* recomputed every turn, so it forgets an approval the moment the next
|
|
118
|
+
* message arrives. The envelope does not: it is granted once (a directive
|
|
119
|
+
* request, or — the high-trust path — the user approving a plan) and lives
|
|
120
|
+
* for the conversation, so inside it reversible work executes with no
|
|
121
|
+
* prompt while `external` and `destructive` actions still ask.
|
|
122
|
+
*
|
|
123
|
+
* Absent/`null` (no loop, a direct tool call, a test) keeps every gate's
|
|
124
|
+
* original confirm-or-refuse behaviour exactly.
|
|
125
|
+
*/
|
|
126
|
+
envelope?: import('../learning/intent-envelope.js').IntentEnvelope | null;
|
|
127
|
+
/**
|
|
128
|
+
* The run's OWN behaviour — every question asked, every refusal, every
|
|
129
|
+
* mutation — so a gate can refuse to RE-ASK a question the user already
|
|
130
|
+
* answered (see `learning/run-trace.ts`).
|
|
131
|
+
*
|
|
132
|
+
* The envelope answers "what may I do"; the trace answers "what have I been
|
|
133
|
+
* doing". Without it the loop could not notice its own repetition (nothing
|
|
134
|
+
* counted it), could not stop it, and could not answer the user asking why it
|
|
135
|
+
* was repeating — the three failures of the live audit, which are one failure.
|
|
136
|
+
*
|
|
137
|
+
* Absent (a direct tool call, a test) keeps every gate's original behaviour.
|
|
138
|
+
*/
|
|
139
|
+
runTrace?: import('../learning/run-trace.js').RunTrace;
|
|
111
140
|
/** Emit an event on the observability bus (for pipeline runs). */
|
|
112
141
|
emit?: (event: string, data: unknown, source?: string) => void;
|
|
113
142
|
/** LLM call fn for C2 verify (resolved provider already chosen). */
|
|
@@ -324,9 +353,9 @@ export declare function toolJsonSchemas(toolNames?: string[]): ToolJsonSchema[];
|
|
|
324
353
|
* calling suggest_followups with exactly 3 followups, and clarifies ambiguous
|
|
325
354
|
* requests via ask_user instead of guessing.
|
|
326
355
|
*/
|
|
327
|
-
export declare const TOOL_CONTRACT = "You have tools available. Call them when appropriate.\n\n- If a request is ambiguous or incomplete, call `ask_user` with a question and 2\u20134 choices \u2014 never guess, never ask in plain text.\n- If a request needs code written, debugged, or prior work resumed, call `build`, `repair`, or `resume` with the goal.\n- If a request needs documentation, a website, analysis of a project, or running tests, call `document`, `website`, `analyze`, or `test` with the goal.\n- If a request asks to publish a release (npm/GitHub), call `publish`. It leaves this machine and is irreversible \u2014 confirm the bump type and target with the user via `ask_user` first unless they already specified them.\n- If a request's completeness is uncertain, call `verify_requirement` first.\n- If a request asks to deliver a message or result to a DIFFERENT contact/channel than the one you are currently chatting on (WhatsApp, Telegram, Slack, email, \u2026), call `gateway_send` with the target (e.g. `whatsapp:Alex`) and the text. Do NOT call gateway_send to reply to the CURRENT conversation \u2014 your text response is automatically delivered back. If the target contact is not configured, tell the user what to set up.\n- If a request asks to manage the system/agent itself in plain English \u2014 start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats \u2014 call `run_cli` with the plain-English ask. It resolves the exact `
|
|
356
|
+
export declare const TOOL_CONTRACT = "You have tools available. Call them when appropriate.\n\n- If a request is ambiguous or incomplete, call `ask_user` with a question and 2\u20134 choices \u2014 never guess, never ask in plain text.\n- If a request needs code written, debugged, or prior work resumed, call `build`, `repair`, or `resume` with the goal.\n- If a request needs documentation, a website, analysis of a project, or running tests, call `document`, `website`, `analyze`, or `test` with the goal.\n- If a request asks to publish a release (npm/GitHub), call `publish`. It leaves this machine and is irreversible \u2014 confirm the bump type and target with the user via `ask_user` first unless they already specified them.\n- If a request's completeness is uncertain, call `verify_requirement` first.\n- If a request asks to deliver a message or result to a DIFFERENT contact/channel than the one you are currently chatting on (WhatsApp, Telegram, Slack, email, \u2026), call `gateway_send` with the target (e.g. `whatsapp:Alex`) and the text. Do NOT call gateway_send to reply to the CURRENT conversation \u2014 your text response is automatically delivered back. If the target contact is not configured, tell the user what to set up.\n- If a request asks to manage the system/agent itself in plain English \u2014 start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats \u2014 call `run_cli` with the plain-English ask. It resolves the exact `nuvira` command and runs it. If the user's own request already resolves to that command (\"stop the dashboard\"), it just runs \u2014 do not ask for permission to do what was just asked. If it reports AMBIGUOUS, call `ask_user` with the two choices; if the intent is one YOU chose rather than the user (or is irreversible: history.clear, memory.prune, stats.cost.clear, publish), call `ask_user` first and retry with confirm:true.\n- If a subtask can be delegated to a specialized sub-agent (gather context, review, security scan, run tests), call `delegate` with the agent type, a focused prompt, and optional file paths.\n- To find code matching a pattern (context gathering, locating definitions/usages), call `code_search` with the pattern and optional globs.\n- To READ the project: call `read_file` to open a file (with line numbers), `list_dir` to see a directory's contents, or `glob` to find files by pattern. Always prefer reading the actual file over assuming its contents \u2014 a large file reports a line range, continue with offset/limit.\n- To CHANGE code (after reading it): call `edit_file` for a surgical exact-text replacement, or `write_file` to create/replace a file. CREATING a file the request asked for is applied directly \u2014 no confirmation needed, so just call it. An `edit_file` that is surgical (small relative to the file) also applies directly, as does one on a file the request names \u2014 the verify loop must not need a human between iterations. A whole-file write over existing content, or an edit that rewrites most of a file, refuses without confirm \u2014 call `ask_user` with a one-line summary, then retry with confirm:true.\n- NEVER ask for permission to do work the user already asked for \u2014 not via `ask_user` and never in plain text. Decide it yourself, state the decision in your answer, and continue. Reserve `ask_user` for a decision that is genuinely the user's: it cannot proceed without an answer, it is high-impact AND irreversible, and there is no sensible default (overwriting existing work, deleting data, spending money, publishing).\n- To VERIFY code by actual invocation: call `run_terminal` with the real command (`npx vitest run tests/x.test.ts`, `npx tsc --noEmit`, `npm run build`, `git diff`). Read-only verify commands run directly, and so do recoverable workspace commands (`npm/pnpm/yarn/bun install`, `pip install`, `mkdir`, `touch`, `cp`, `mv`, `git add`, `npm init`) when the request authorized the work \u2014 the build you were asked for is your job to set up. Everything else state-changing (network fetches, arbitrary code, global installs, anything leaving the machine) needs confirm:true after the user approves via ask_user. Never guess that a test passes \u2014 run it and read the output. Use run_cli (not run_terminal) for buff/agent-nuvira control commands, and the `git` tool (not run_terminal) to commit.\n- END EVERY RESPONSE by calling `suggest_followups` with exactly 3 followups the user is likely to want next \u2014 natural next questions, deeper dives, or related directions that build on what you just said; specific to this conversation, not generic.\n- If you have nothing to add, answer directly and still end with suggest_followups.\n- ORDERING (non-negotiable): deliver the user's answer FIRST, then suggest_followups. The followup call must come only AFTER the complete answer is written \u2014 never before it, never instead of it. A bare lead-in (\"Sure, I can help!\") is NOT an answer; write the full answer in the same step as the followup call.";
|
|
328
357
|
/** The JSON-fallback tool contract — for providers WITHOUT native tool-calling. */
|
|
329
|
-
export declare const TOOL_CONTRACT_JSON = "You have tools available. Call them when appropriate.\n\n- If a request is ambiguous or incomplete, call `ask_user` with a question and 2\u20134 choices \u2014 never guess, never ask in plain text.\n- If a request needs code written, debugged, or prior work resumed, call `build`, `repair`, or `resume` with the goal.\n- If a request needs documentation, a website, analysis of a project, or running tests, call `document`, `website`, `analyze`, or `test` with the goal.\n- If a request asks to publish a release (npm/GitHub), call `publish`. It leaves this machine and is irreversible \u2014 confirm the bump type and target with the user via `ask_user` first unless they already specified them.\n- If a request's completeness is uncertain, call `verify_requirement` first.\n- If a request asks to deliver a message or result to a DIFFERENT contact/channel than the one you are currently chatting on (WhatsApp, Telegram, Slack, email, \u2026), call `gateway_send` with the target (e.g. `whatsapp:Alex`) and the text. Do NOT call gateway_send to reply to the CURRENT conversation \u2014 your text response is automatically delivered back. If the target contact is not configured, tell the user what to set up.\n- If a request asks to manage the system/agent itself in plain English \u2014 start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats \u2014 call `run_cli` with the plain-English ask. It resolves the exact `
|
|
358
|
+
export declare const TOOL_CONTRACT_JSON = "You have tools available. Call them when appropriate.\n\n- If a request is ambiguous or incomplete, call `ask_user` with a question and 2\u20134 choices \u2014 never guess, never ask in plain text.\n- If a request needs code written, debugged, or prior work resumed, call `build`, `repair`, or `resume` with the goal.\n- If a request needs documentation, a website, analysis of a project, or running tests, call `document`, `website`, `analyze`, or `test` with the goal.\n- If a request asks to publish a release (npm/GitHub), call `publish`. It leaves this machine and is irreversible \u2014 confirm the bump type and target with the user via `ask_user` first unless they already specified them.\n- If a request's completeness is uncertain, call `verify_requirement` first.\n- If a request asks to deliver a message or result to a DIFFERENT contact/channel than the one you are currently chatting on (WhatsApp, Telegram, Slack, email, \u2026), call `gateway_send` with the target (e.g. `whatsapp:Alex`) and the text. Do NOT call gateway_send to reply to the CURRENT conversation \u2014 your text response is automatically delivered back. If the target contact is not configured, tell the user what to set up.\n- If a request asks to manage the system/agent itself in plain English \u2014 start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats \u2014 call `run_cli` with the plain-English ask. It resolves the exact `nuvira` command and runs it. If the user's own request already resolves to that command (\"stop the dashboard\"), it just runs \u2014 do not ask for permission to do what was just asked. If it reports AMBIGUOUS, call `ask_user` with the two choices; if the intent is one YOU chose rather than the user (or is irreversible: history.clear, memory.prune, stats.cost.clear, publish), call `ask_user` first and retry with confirm:true.\n- If a subtask can be delegated to a specialized sub-agent (gather context, review, security scan, run tests), call `delegate` with the agent type, a focused prompt, and optional file paths.\n- To find code matching a pattern (context gathering, locating definitions/usages), call `code_search` with the pattern and optional globs.\n- To READ the project: call `read_file` to open a file (with line numbers), `list_dir` to see a directory's contents, or `glob` to find files by pattern. Always prefer reading the actual file over assuming its contents \u2014 a large file reports a line range, continue with offset/limit.\n- To CHANGE code (after reading it): call `edit_file` for a surgical exact-text replacement, or `write_file` to create/replace a file. CREATING a file the request asked for is applied directly \u2014 no confirmation needed, so just call it. An `edit_file` that is surgical (small relative to the file) also applies directly, as does one on a file the request names \u2014 the verify loop must not need a human between iterations. A whole-file write over existing content, or an edit that rewrites most of a file, refuses without confirm \u2014 call `ask_user` with a one-line summary, then retry with confirm:true.\n- NEVER ask for permission to do work the user already asked for \u2014 not via `ask_user` and never in plain text. Decide it yourself, state the decision in your answer, and continue. Reserve `ask_user` for a decision that is genuinely the user's: it cannot proceed without an answer, it is high-impact AND irreversible, and there is no sensible default (overwriting existing work, deleting data, spending money, publishing).\n- To VERIFY code by actual invocation: call `run_terminal` with the real command (`npx vitest run tests/x.test.ts`, `npx tsc --noEmit`, `npm run build`, `git diff`). Read-only verify commands run directly, and so do recoverable workspace commands (`npm/pnpm/yarn/bun install`, `pip install`, `mkdir`, `touch`, `cp`, `mv`, `git add`, `npm init`) when the request authorized the work \u2014 the build you were asked for is your job to set up. Everything else state-changing (network fetches, arbitrary code, global installs, anything leaving the machine) needs confirm:true after the user approves via ask_user. Never guess that a test passes \u2014 run it and read the output. Use run_cli (not run_terminal) for buff/agent-nuvira control commands, and the `git` tool (not run_terminal) to commit.\n- END EVERY RESPONSE by calling `suggest_followups` with exactly 3 followups the user is likely to want next \u2014 natural next questions, deeper dives, or related directions that build on what you just said; specific to this conversation, not generic.\n- If you have nothing to add, answer directly and still end with suggest_followups.\n- ORDERING (non-negotiable): deliver the user's answer FIRST, then suggest_followups. The followup call must come only AFTER the complete answer is written \u2014 never before it, never instead of it. A bare lead-in (\"Sure, I can help!\") is NOT an answer; write the full answer in the same step as the followup call.\n\nTOOL CALL FORMAT (JSON fallback transport):\nWhen calling a tool, emit its JSON AFTER your response text, in this exact shape:\n{\"tool\":\"<name>\",\"arguments\":{...}}\nOne tool call per block. The final block may be a suggest_followups call.";
|
|
330
359
|
/**
|
|
331
360
|
* Parse + validate a model's followups output against the shared
|
|
332
361
|
* suggest_followups schema. Accepts both the tool shape `[{prompt,label?}]`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,CAAC,EAAgB,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAMpD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAElE,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,4EAA4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gB,SAAS,IAAI,IAAI,EAAE,CAElC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAOtE;AAID;;;;;GAKG;AACH,eAAO,MAAM,aAAa,08JAiB8R,CAAC;AAEzT,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,ksKAK2C,CAAC;AA2jB3E;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAyBvE;AASD,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/tools/registry.js
CHANGED
|
@@ -351,7 +351,7 @@ export const TOOL_CONTRACT = `You have tools available. Call them when appropria
|
|
|
351
351
|
- If a request asks to publish a release (npm/GitHub), call \`publish\`. It leaves this machine and is irreversible — confirm the bump type and target with the user via \`ask_user\` first unless they already specified them.
|
|
352
352
|
- If a request's completeness is uncertain, call \`verify_requirement\` first.
|
|
353
353
|
- If a request asks to deliver a message or result to a DIFFERENT contact/channel than the one you are currently chatting on (WhatsApp, Telegram, Slack, email, …), call \`gateway_send\` with the target (e.g. \`whatsapp:Alex\`) and the text. Do NOT call gateway_send to reply to the CURRENT conversation — your text response is automatically delivered back. If the target contact is not configured, tell the user what to set up.
|
|
354
|
-
- If a request asks to manage the system/agent itself in plain English — start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats — call \`run_cli\` with the plain-English ask. It resolves the exact \`
|
|
354
|
+
- If a request asks to manage the system/agent itself in plain English — start/stop the dashboard or gateway, check status, add/remove a verified sender, configure a platform (telegram/whatsapp), run evals, show stats — call \`run_cli\` with the plain-English ask. It resolves the exact \`nuvira\` command and runs it. If the user's own request already resolves to that command ("stop the dashboard"), it just runs — do not ask for permission to do what was just asked. If it reports AMBIGUOUS, call \`ask_user\` with the two choices; if the intent is one YOU chose rather than the user (or is irreversible: history.clear, memory.prune, stats.cost.clear, publish), call \`ask_user\` first and retry with confirm:true.
|
|
355
355
|
- If a subtask can be delegated to a specialized sub-agent (gather context, review, security scan, run tests), call \`delegate\` with the agent type, a focused prompt, and optional file paths.
|
|
356
356
|
- To find code matching a pattern (context gathering, locating definitions/usages), call \`code_search\` with the pattern and optional globs.
|
|
357
357
|
- To READ the project: call \`read_file\` to open a file (with line numbers), \`list_dir\` to see a directory's contents, or \`glob\` to find files by pattern. Always prefer reading the actual file over assuming its contents — a large file reports a line range, continue with offset/limit.
|
|
@@ -449,6 +449,33 @@ registerTool({
|
|
|
449
449
|
endsAgentStep: false,
|
|
450
450
|
run: async (args, ctx) => {
|
|
451
451
|
const { question, choices, multi_select } = askUserSchema.parse(args);
|
|
452
|
+
// ── Stage 2: REPETITION gate — never re-ask a question already answered ──
|
|
453
|
+
// Checked FIRST, before the authorization suppression below, because asking
|
|
454
|
+
// the same question twice is a defect on its own terms whatever the request
|
|
455
|
+
// authorized. The evidence is the RUN TRACE, not the current text: the
|
|
456
|
+
// question is compared to every question the agent has already asked in this
|
|
457
|
+
// conversation, and a repeat is refused with the answer the user gave.
|
|
458
|
+
//
|
|
459
|
+
// This is the mechanism the live audit lacked. A turn asked four variants of
|
|
460
|
+
// "may I run `node -c script.js`?" and nothing in the system held the fact
|
|
461
|
+
// that it had asked before, so it could not stop, and could not answer the
|
|
462
|
+
// user asking why it kept asking. Irreversible choices are exempt: "which of
|
|
463
|
+
// these two files should I delete?" is a genuine new decision each time.
|
|
464
|
+
const priorAsks = ctx.runTrace?.priorAskMatches(question) ?? [];
|
|
465
|
+
if (priorAsks.length > 0 && !IRREVERSIBLE_ACTION_RE.test(question)) {
|
|
466
|
+
const answer = ctx.runTrace?.priorAnswer(question);
|
|
467
|
+
ctx.runTrace?.recordAsk(question, false, answer);
|
|
468
|
+
ctx.emit?.('autonomy:repeat-suppressed', {
|
|
469
|
+
question,
|
|
470
|
+
times: priorAsks.length + 1,
|
|
471
|
+
answer,
|
|
472
|
+
}, 'tool-loop');
|
|
473
|
+
return (`Not shown to the user: you have already asked this ${priorAsks.length === 1 ? 'once' : `${priorAsks.length} times`} in this conversation` +
|
|
474
|
+
(answer ? `, and they answered "${answer}"` : '') +
|
|
475
|
+
'. Do NOT ask it again — the answer you have is the answer. Act on it, or state plainly ' +
|
|
476
|
+
'what blocks you. If something genuinely NEW has appeared that the user has not seen, ask ' +
|
|
477
|
+
'about THAT new thing instead of re-asking this.');
|
|
478
|
+
}
|
|
452
479
|
// ── G13: do not round-trip a permission question the ask already answered ─
|
|
453
480
|
// Over a chat surface (WhatsApp/Telegram) an ask_user call is a MESSAGE to
|
|
454
481
|
// the user, so a reflexive "Do you want me to create the full project
|
|
@@ -460,18 +487,26 @@ registerTool({
|
|
|
460
487
|
// Narrow on purpose — both conditions must hold, and any question naming an
|
|
461
488
|
// irreversible action (overwrite, delete, publish, deploy, send, pay…) is
|
|
462
489
|
// passed straight through, because that decision IS the user's.
|
|
463
|
-
if (ctx.writesAuthorized?.authorized === true &&
|
|
490
|
+
if ((ctx.writesAuthorized?.authorized === true || Boolean(ctx.envelope)) &&
|
|
464
491
|
detectPermissionSeeking(question) &&
|
|
465
492
|
!IRREVERSIBLE_ACTION_RE.test(question)) {
|
|
466
493
|
const recommended = choices[0]?.label ?? '';
|
|
494
|
+
// Read the authorizer from whichever one is live, so the audit line names
|
|
495
|
+
// the real reason ("the user approved this plan" reads very differently
|
|
496
|
+
// from "this message asked for files").
|
|
497
|
+
const authorization = ctx.envelope
|
|
498
|
+
? `approved envelope: ${ctx.envelope.goal} (${ctx.envelope.source})`
|
|
499
|
+
: (ctx.writesAuthorized?.reason ?? 'the request authorized this work');
|
|
467
500
|
ctx.emit?.('autonomy:consult-suppressed', {
|
|
468
501
|
question,
|
|
469
|
-
authorization
|
|
502
|
+
authorization,
|
|
470
503
|
}, 'tool-loop');
|
|
471
|
-
|
|
472
|
-
|
|
504
|
+
ctx.runTrace?.recordAsk(question, false);
|
|
505
|
+
return ('Not shown to the user: their request or approved plan already authorized this work, ' +
|
|
506
|
+
'and this is a permission question about doing it. Decide it yourself and continue.\n' +
|
|
473
507
|
(recommended ? `Recommended default: "${recommended}".\n` : '') +
|
|
474
508
|
'Carry the work out now and state the decision in your answer so the user can redirect. ' +
|
|
509
|
+
'Do NOT ask again for the same work — the answer is already yes. ' +
|
|
475
510
|
'Only if the choice is genuinely theirs — it cannot proceed without an answer, is ' +
|
|
476
511
|
'high-impact and irreversible, and has no sensible default — re-call ask_user naming ' +
|
|
477
512
|
'that specific irreversible choice (e.g. whether to overwrite an existing file).');
|
|
@@ -479,6 +514,10 @@ registerTool({
|
|
|
479
514
|
const render = ctx.askUser || (await import('./ask-user.js')).renderAskUser;
|
|
480
515
|
const answer = await render(question, choices, multi_select);
|
|
481
516
|
const picked = Array.isArray(answer.answer) ? answer.answer.join(', ') : answer.answer;
|
|
517
|
+
// Recorded SHOWN and with the answer, so the trace can hand both back when
|
|
518
|
+
// the agent tries to ask it a second time (and so a self-report can say what
|
|
519
|
+
// the user actually replied, instead of "asked 4×, no answer recorded").
|
|
520
|
+
ctx.runTrace?.recordAsk(question, true, picked);
|
|
482
521
|
return `User answered: ${picked}${answer.custom ? ` (custom: ${answer.custom})` : ''}`;
|
|
483
522
|
},
|
|
484
523
|
});
|