@robota-sdk/agent-core 3.0.0-beta.84 → 3.0.0-beta.86

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 (53) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/browser/bounded-output-Bgx2Cgkx.js +2 -0
  3. package/dist/browser/bounded-output-Bgx2Cgkx.js.map +1 -0
  4. package/dist/browser/{command-executor-BsBTcghZ.js → command-executor-C0XXfBnt.js} +2 -2
  5. package/dist/browser/{command-executor-BsBTcghZ.js.map → command-executor-C0XXfBnt.js.map} +1 -1
  6. package/dist/browser/{http-executor-CHy6UeBU.js → http-executor-B4YgCJg7.js} +2 -2
  7. package/dist/browser/{http-executor-CHy6UeBU.js.map → http-executor-B4YgCJg7.js.map} +1 -1
  8. package/dist/browser/index.d.ts +48 -19
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js +11 -11
  11. package/dist/browser/index.js.map +1 -1
  12. package/dist/browser/{verdict-decoder-Dk_w2NG9.js → verdict-decoder-Dz_rjoIZ.js} +2 -2
  13. package/dist/browser/verdict-decoder-Dz_rjoIZ.js.map +1 -0
  14. package/dist/node/bounded-output-Bgx2Cgkx.js +2 -0
  15. package/dist/node/bounded-output-Bgx2Cgkx.js.map +1 -0
  16. package/dist/node/{command-executor-CPGK8I8l.cjs → command-executor-CqAFpB-X.cjs} +1 -1
  17. package/dist/node/{command-executor-BdE1zg3q.js → command-executor-d6DdfUTD.js} +2 -2
  18. package/dist/node/{command-executor-BdE1zg3q.js.map → command-executor-d6DdfUTD.js.map} +1 -1
  19. package/dist/node/{http-executor-cWzI2svn.js → http-executor-ADn4locH.js} +2 -2
  20. package/dist/node/{http-executor-cWzI2svn.js.map → http-executor-ADn4locH.js.map} +1 -1
  21. package/dist/node/{http-executor-BYiKn8h3.cjs → http-executor-BFtXs8FP.cjs} +1 -1
  22. package/dist/node/{index-DXZ-pyEr.d.ts → index-CPwJEiFl.d.cts} +49 -20
  23. package/dist/node/index-CPwJEiFl.d.cts.map +1 -0
  24. package/dist/node/{index-gEUh4G-t.d.cts → index-DQrmrFn9.d.ts} +49 -20
  25. package/dist/node/index-DQrmrFn9.d.ts.map +1 -0
  26. package/dist/node/index.cjs +9 -9
  27. package/dist/node/index.d.cts +3 -3
  28. package/dist/node/index.d.ts +3 -3
  29. package/dist/node/index.js +11 -11
  30. package/dist/node/index.js.map +1 -1
  31. package/dist/node/node.cjs +1 -1
  32. package/dist/node/node.d.cts +1 -1
  33. package/dist/node/node.d.ts +1 -1
  34. package/dist/node/node.js +1 -1
  35. package/dist/node/testing/index.d.cts +1 -1
  36. package/dist/node/testing/index.d.ts +1 -1
  37. package/dist/node/{types-BQ-sKCQS.d.cts → types-Ge2XB-y-.d.cts} +2 -2
  38. package/dist/node/{types-BQ-sKCQS.d.cts.map → types-Ge2XB-y-.d.cts.map} +1 -1
  39. package/dist/node/{types-BQ-sKCQS.d.ts → types-Ge2XB-y-.d.ts} +2 -2
  40. package/dist/node/{types-BQ-sKCQS.d.ts.map → types-Ge2XB-y-.d.ts.map} +1 -1
  41. package/dist/node/verdict-decoder-DIHay1ul.cjs +1 -0
  42. package/dist/node/{verdict-decoder-Dk_w2NG9.js → verdict-decoder-Dz_rjoIZ.js} +2 -2
  43. package/dist/node/verdict-decoder-Dz_rjoIZ.js.map +1 -0
  44. package/package.json +1 -1
  45. package/dist/browser/bounded-output-D3cgiOrh.js +0 -2
  46. package/dist/browser/bounded-output-D3cgiOrh.js.map +0 -1
  47. package/dist/browser/verdict-decoder-Dk_w2NG9.js.map +0 -1
  48. package/dist/node/bounded-output-D3cgiOrh.js +0 -2
  49. package/dist/node/bounded-output-D3cgiOrh.js.map +0 -1
  50. package/dist/node/index-DXZ-pyEr.d.ts.map +0 -1
  51. package/dist/node/index-gEUh4G-t.d.cts.map +0 -1
  52. package/dist/node/verdict-decoder-D412SAGd.cjs +0 -1
  53. package/dist/node/verdict-decoder-Dk_w2NG9.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # @robota-sdk/agent-core
2
2
 
3
+ ## 3.0.0-beta.86
4
+
5
+ ## 3.0.0-beta.85
6
+
7
+ ### Patch Changes
8
+
9
+ - 41cca13: Fixed `run(input, { allowToolOnlyCompletion: true })` throwing an internal `[STRICT-POLICY]` error
10
+ when a round produced neither a tool call nor any text — for example a tool-calling decision agent
11
+ whose model answered with nothing at all. `allowToolOnlyCompletion` only widens what counts as a
12
+ finished turn (a tool call alone, with no final text); an ordinary text-only reply already completes
13
+ normally and is unaffected, and a turn that ends in tool results still resolves with `''`. A turn
14
+ that ends with neither text nor a tool result now rejects with a new, catchable `EmptyCompletionError`
15
+ (`code: 'EMPTY_COMPLETION'`) instead of the internal invariant message; `resume()` of such an
16
+ execution raises the same error.
17
+ - ada3841: Dispatch tool-call plugin hooks around each decoded attempt, including unknown-tool refusals,
18
+ and emit the event emitter plugin's before-execution event. A pre-effect wait resumes the same
19
+ logical call without repeating its before hooks; recovered results do not replay call hooks.
20
+
21
+ Pair parallel tool analytics by the logical execution ID, including calls of the same tool.
22
+
23
+ - 5093a30: A `Robota` run now calls `beforeConversation`, with `beforeExecution`, and `onStreamingChunk` for
24
+ each streamed piece of text, in order; the round waits for those chunk hooks before it goes on,
25
+ whether the provider call returned, failed or was interrupted. `EventEmitterPlugin` therefore emits
26
+ `CONVERSATION_START`.
27
+
28
+ The run result's `toolCalls` now carry each executed call's id and `result: null` for one that
29
+ failed, so `EventEmitterPlugin` emits `TOOL_ERROR` instead of `TOOL_SUCCESS` for a failed call, and
30
+ `WebhookPlugin`'s `tool.executed` payload reports it as failed with its call id.
31
+
32
+ `EXECUTION_START`, `EXECUTION_COMPLETE` and `EXECUTION_ERROR` are marked deprecated: no run emits
33
+ them; the `AGENT_EXECUTION_*` events are the ones a run emits. `beforeToolCall`,
34
+ `beforeToolExecution` and `afterToolCall` are still not called.
35
+
36
+ - 94b2c87: A PreToolUse `command` hook can now steer a tool call, not only refuse it. The permission gate
37
+ applies the winning `hookSpecificOutput.permissionDecision`:
38
+
39
+ - `allow` skips the prompt a person would otherwise get. Deny rules, refusals from the mode, the
40
+ `auto` mode classifier and asks that must reach a person (an `ask` rule, a protected path, a
41
+ policy that asks about everything) still apply.
42
+ - `ask` sends the call to a person even when the mode or a remembered consent would run it. The
43
+ answer is not remembered, and with no one to ask the call is refused.
44
+ - `defer` leaves the call to the normal flow, as before.
45
+
46
+ Before this change these decisions were read and then ignored.
47
+
48
+ `updatedInput` is still not applied: the call runs the input it was made with, and an `allow` sent
49
+ with an `updatedInput` is not applied either, since it approved another input.
50
+
51
+ `runHooks` (agent-core) now reads a decision and an `updatedInput` only from `command` hooks: a
52
+ `prompt` or `agent` hook answers from a model that reads the tool input it judges, so it can only
53
+ refuse. With several hooks, `ask` now outranks `defer` (`deny` > `ask` > `defer` > `allow`), and the
54
+ reported `updatedInput` is the one sent with the winning decision.
55
+
56
+ - 3ab2eca: - External presets accept every permission mode a session does, `auto` included; `auto` used to fail validation.
57
+ - `createDagFramework({ ports: { costMeta } })` wires cost-metadata management; without it cost operations still report that they are unsupported.
58
+ - `startCli()` runs the subagent worker when a subagent starts the embedder's entry script again, as the `robota` executable already did; an embedded CLI used to start a second CLI there.
59
+ - The provider `executor` option docs no longer import a `RemoteExecutor` that does not exist, and `IRemoteExecutorConfig` is marked deprecated: nothing implements a remote executor.
60
+
3
61
  ## 3.0.0-beta.84
4
62
 
5
63
  ### Minor Changes
@@ -0,0 +1,2 @@
1
+ var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;provider;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Network Error: ${e}`,n),this.originalError=t,this.provider=r}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool "${e}" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{round;code=`EMPTY_COMPLETION`;category=`provider`;recoverable=!0;constructor(e,t){super(`Round ${e} ended with no tool call and no text response, and allowToolOnlyCompletion prevented the follow-up call that would otherwise recover it`,t),this.round=e}},d=class extends e{model;provider;availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){let i=e===void 0?`No model available for provider "${t}"`:`Model "${e}" is not available for provider "${t}"`,a=r?.originalMessage;super(typeof a==`string`&&a.length>0?`${i}: ${a}`:i,r),this.model=e,this.provider=t,this.availableModels=n}},f=class extends e{code=`CIRCUIT_BREAKER_OPEN`;category=`system`;recoverable=!0;constructor(e=`Circuit breaker is open`,t){super(e,t)}},p=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},m=class extends e{code=`STORAGE_ERROR`;category=`system`;recoverable=!0;constructor(e,t){super(`Storage Error: ${e}`,t)}},h=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},g=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function _(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i ""` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function v(e,t){let n=x(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:_(t)}}function y(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \`Get-ChildItem\` not \`ls -la\`, \`\$env:VAR\` not \`\$VAR\`.`}}function b(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function x(e){return(e.split(/[\\/]/).at(-1)?.toLowerCase()??``).replace(/\.exe$/i,``)}function S(e,t){switch(x(e)){case`sh`:case`bash`:return v(e,t);case`powershell`:case`pwsh`:return y(e,t);case`cmd`:return b(e,t);default:throw new g(e)}}function C(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function w(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=C(e.executable);return r===void 0?n===`win32`?y(`powershell.exe`,n):v(C(t.SHELL)??`/bin/sh`,n):S(r,n)}const T=/^(?!0{32}$)[0-9a-f]{32}$/,E=/^(?!0{16}$)[0-9a-f]{16}$/;function D(e){return e.replaceAll(`-`,``).slice(0,16)}const O=D;function k(e){return E.test(e)}function A(e,t){if(!(!T.test(e)||!E.test(t)))return`00-${e}-${t}-01`}function j(e,t){if(e.allowedOrigins.length===0)return;let n=A(e.traceId,D(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function M(e,t){return j(e,t)}function N(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=A(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function P(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function F(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const I=e=>`\n…[output truncated: ${e} byte(s) dropped]`;function L(e){let t=e.retain??`head`,n=e.truncationMarker??I,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\n/,``)}\n${i}`}}}export{e as C,c as D,r as E,n as O,o as S,m as T,u as _,O as a,p as b,M as c,g as d,w as f,t as g,f as h,j as i,N as l,h as m,A as n,D as o,a as p,k as r,P as s,L as t,F as u,d as v,l as w,i as x,s as y};
2
+ //# sourceMappingURL=bounded-output-Bgx2Cgkx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounded-output-Bgx2Cgkx.js","names":[],"sources":["../../src/utils/errors.ts","../../src/utils/platform-shell.ts","../../src/utils/trace-context.ts","../../src/utils/bounded-output.ts"],"sourcesContent":["/**\n * Reusable type definitions for error utilities\n */\n\n/**\n * Error context data type\n * Used for storing contextual information in error instances\n */\nexport type TErrorContextData = Record<\n string,\n string | number | boolean | Date | Error | string[] | undefined\n>;\n\n/**\n * Error external input type\n * Used for handling external errors from unknown sources\n */\nexport type TErrorExternalInput =\n Error | string | Record<string, string | number | boolean> | null | undefined;\n\n/**\n * Base error class for all Robota errors\n */\nexport abstract class RobotaError extends Error {\n abstract readonly code: string;\n abstract readonly category: 'user' | 'system' | 'provider';\n abstract readonly recoverable: boolean;\n\n constructor(\n message: string,\n public readonly context?: TErrorContextData,\n ) {\n super(message);\n this.name = this.constructor.name;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Configuration related errors\n */\nexport class ConfigurationError extends RobotaError {\n readonly code = 'CONFIGURATION_ERROR';\n readonly category = 'user' as const;\n readonly recoverable = false;\n\n constructor(message: string, context?: TErrorContextData) {\n super(`Configuration Error: ${message}`, context);\n }\n}\n\n/**\n * Input validation errors\n */\nexport class ValidationError extends RobotaError {\n readonly code = 'VALIDATION_ERROR';\n readonly category = 'user' as const;\n readonly recoverable = false;\n\n constructor(\n message: string,\n public readonly field?: string,\n context?: TErrorContextData,\n ) {\n super(`Validation Error: ${message}`, context);\n }\n}\n\n/**\n * Structured output validation exhausted its retry budget (CORE-015).\n *\n * Thrown by `run(input, { output })` when the model's final response still fails\n * schema validation after the configured number of retries. `issues` holds the\n * validation messages from the last attempt; `attempts` is the total number of\n * provider turns spent (initial + retries).\n */\nexport class StructuredOutputError extends RobotaError {\n readonly code = 'STRUCTURED_OUTPUT_ERROR';\n readonly category = 'provider' as const;\n readonly recoverable = true;\n\n constructor(\n message: string,\n public readonly issues: string[],\n public readonly attempts: number,\n context?: TErrorContextData,\n ) {\n super(`Structured Output Error: ${message}`, context);\n }\n}\n\n/** What the vendor said about a failed call, as far as it said anything. */\nexport interface IProviderFailureDetails {\n /** The HTTP status of the failed response; absent for a failure with no response (e.g. an SSE error event). */\n status?: number;\n /** The vendor's own error type, e.g. Anthropic's `overloaded_error`. */\n type?: string;\n}\n\n/**\n * Provider related errors\n */\nexport class ProviderError extends RobotaError {\n readonly code = 'PROVIDER_ERROR';\n readonly category = 'provider' as const;\n readonly recoverable = true;\n readonly status?: number;\n readonly type?: string;\n\n constructor(\n message: string,\n public readonly provider: string,\n public readonly originalError?: Error,\n context?: TErrorContextData,\n details?: IProviderFailureDetails,\n ) {\n super(`Provider Error (${provider}): ${message}`, context);\n if (details?.status !== undefined) this.status = details.status;\n if (details?.type !== undefined) this.type = details.type;\n }\n}\n\n/**\n * Authentication errors\n */\nexport class AuthenticationError extends RobotaError {\n readonly code = 'AUTHENTICATION_ERROR';\n readonly category = 'user' as const;\n readonly recoverable = false;\n\n constructor(\n message: string,\n public readonly provider?: string,\n context?: TErrorContextData,\n ) {\n super(`Authentication Error: ${message}`, context);\n }\n}\n\n/**\n * Rate limit errors\n */\nexport class RateLimitError extends RobotaError {\n readonly code = 'RATE_LIMIT_ERROR';\n readonly category = 'provider' as const;\n readonly recoverable = true;\n\n constructor(\n message: string,\n public readonly retryAfter?: number,\n public readonly provider?: string,\n context?: TErrorContextData,\n ) {\n super(`Rate Limit Error: ${message}`, context);\n }\n}\n\n/**\n * Network/connectivity errors\n */\nexport class NetworkError extends RobotaError {\n readonly code = 'NETWORK_ERROR';\n readonly category = 'system' as const;\n readonly recoverable = true;\n\n constructor(\n message: string,\n public readonly originalError?: Error,\n context?: TErrorContextData,\n /** `undefined` for a network failure with no provider context (e.g. a generic timeout). */\n public readonly provider?: string,\n ) {\n super(`Network Error: ${message}`, context);\n }\n}\n\n/**\n * Tool execution errors\n */\nexport class ToolExecutionError extends RobotaError {\n readonly code = 'TOOL_EXECUTION_ERROR';\n readonly category = 'system' as const;\n readonly recoverable = false;\n\n constructor(\n message: string,\n public readonly toolName: string,\n public readonly originalError?: Error,\n context?: TErrorContextData,\n ) {\n super(`Tool Execution Error (${toolName}): ${message}`, context);\n }\n}\n\n/**\n * The same-tool-input loop guard tripped — CORE-035.\n *\n * A tool was invoked with byte-identical serialized inputs more times than `maxSameToolInputs`\n * allows, so the turn stopped rather than looping. This is the AGENT giving up, not the user\n * cancelling: the SPEC used to promise an `AbortError` here, which `isAbortFailure` resolves as\n * `success: true, interrupted: true` — reporting a run that produced no answer as a success.\n *\n * Named rather than a bare `Error` for the reason the SPEC was reaching for by naming a type at all:\n * a caller must be able to tell \"the agent looped\" from \"the network died\". `RobotaError` carries\n * `code`/`category`/`recoverable` out through CORE-027's failure path intact.\n *\n * `recoverable` is TRUE: the loop is a property of this turn's prompt and tool set, not of the\n * system, and a caller that varies either can reasonably try again.\n */\nexport class SameToolInputLoopError extends RobotaError {\n readonly code = 'SAME_TOOL_INPUT_LOOP';\n readonly category = 'system' as const;\n readonly recoverable = true;\n\n constructor(\n public readonly toolName: string,\n public readonly callCount: number,\n public readonly maxSameToolInputs: number,\n context?: TErrorContextData,\n ) {\n super(\n `Tool \"${toolName}\" was called with identical input ${callCount} times, past the ` +\n `maxSameToolInputs limit of ${maxSameToolInputs} — stopping the turn to break the loop`,\n context,\n );\n }\n}\n\n/**\n * A turn ended with neither a tool result nor a final text response while `allowToolOnlyCompletion`\n * was set.\n *\n * `allowToolOnlyCompletion` only WIDENS what counts as a valid finish (a tool call alone, with no\n * final text after it); it never narrows the ordinary case. Without the flag, a round that produces\n * neither is recovered by one more provider call asking for a summary (`forceSummaryCall`). Setting\n * the flag is what turns that rescue off — a decision agent wants exactly one provider call, never a\n * follow-up — so a round that produces neither has nothing left to recover it. That is a genuinely\n * unanswered turn, not the internal `[STRICT-POLICY]` result-shape violation an actually malformed\n * execution result trips; a caller must be able to catch this by type instead of parsing that message.\n *\n * `recoverable` is TRUE: like `SameToolInputLoopError`, this is a property of this turn's prompt and\n * model response, not of the system, and a caller that varies either can reasonably try again.\n */\nexport class EmptyCompletionError extends RobotaError {\n readonly code = 'EMPTY_COMPLETION';\n readonly category = 'provider' as const;\n readonly recoverable = true;\n\n constructor(\n public readonly round: number,\n context?: TErrorContextData,\n ) {\n super(\n `Round ${round} ended with no tool call and no text response, and allowToolOnlyCompletion ` +\n 'prevented the follow-up call that would otherwise recover it',\n context,\n );\n }\n}\n\n/**\n * Model not available errors\n */\nexport class ModelNotAvailableError extends RobotaError {\n readonly code = 'MODEL_NOT_AVAILABLE';\n readonly category = 'user' as const;\n readonly recoverable = false;\n\n constructor(\n /** `undefined` when the failure names no model — a provider adapter classifying a raw HTTP\n * response by status alone does not always know which model the vendor meant. */\n public readonly model: string | undefined,\n public readonly provider: string,\n public readonly availableModels?: string[],\n /**\n * `context.originalMessage`, when given, is the vendor's own text (already scrubbed of any\n * credential by the caller) — folded into `message` so a \"Details\" disclosure built from\n * `message` alone still shows the real cause instead of just this class's fixed sentence.\n */\n context?: TErrorContextData,\n ) {\n const base =\n model !== undefined\n ? `Model \"${model}\" is not available for provider \"${provider}\"`\n : `No model available for provider \"${provider}\"`;\n const detail = context?.['originalMessage'];\n super(typeof detail === 'string' && detail.length > 0 ? `${base}: ${detail}` : base, context);\n }\n}\n\n/**\n * Circuit breaker open error\n */\nexport class CircuitBreakerOpenError extends RobotaError {\n readonly code = 'CIRCUIT_BREAKER_OPEN';\n readonly category = 'system' as const;\n readonly recoverable = true;\n\n constructor(message: string = 'Circuit breaker is open', context?: TErrorContextData) {\n super(message, context);\n }\n}\n\n/**\n * Plugin errors\n */\nexport class PluginError extends RobotaError {\n readonly code = 'PLUGIN_ERROR';\n readonly category = 'system' as const;\n readonly recoverable = false;\n\n constructor(\n message: string,\n public readonly pluginName: string,\n context?: TErrorContextData,\n ) {\n super(`Plugin Error (${pluginName}): ${message}`, context);\n }\n}\n\n/**\n * Storage related errors\n */\nexport class StorageError extends RobotaError {\n readonly code = 'STORAGE_ERROR';\n readonly category = 'system' as const;\n readonly recoverable = true;\n\n constructor(message: string, context?: TErrorContextData) {\n super(`Storage Error: ${message}`, context);\n }\n}\n\n/**\n * Cache integrity validation errors\n */\nexport class CacheIntegrityError extends RobotaError {\n readonly code = 'CACHE_INTEGRITY_ERROR';\n readonly category = 'system' as const;\n readonly recoverable = false;\n\n constructor(message: string, context?: TErrorContextData) {\n super(`Cache Integrity Error: ${message}`, context);\n }\n}\n","/**\n * TERM-008: cross-platform shell resolution (SSOT).\n *\n * Single source of truth for \"which shell do we spawn, and how\", shared by every shell-running site.\n * Resolution is a pure function of one request so every branch is testable without the host shell.\n */\n\nimport { RobotaError } from './errors.js';\n\n/** Shell family — drives non-interactive arg shape, quoting, and LLM syntax guidance. */\nexport type TShellKind = 'bash' | 'sh' | 'powershell' | 'cmd';\n\n/** The active shell resolved for a platform, plus the metadata callers need to drive and describe it. */\nexport interface IPlatformShell {\n /** Executable to spawn (e.g. `/bin/sh`, `powershell.exe`, or `$SHELL`). */\n readonly command: string;\n /** Shell family. */\n readonly kind: TShellKind;\n /** Node platform this was resolved for (`process.platform`). */\n readonly platform: NodeJS.Platform;\n /** Args to run a single command string non-interactively. */\n commandArgs(command: string): string[];\n /** Args for an interactive shell session (drop-to-shell). */\n readonly interactiveArgs: string[];\n /** Human label for the active shell, for tool/UI descriptions (e.g. `PowerShell (Windows)`). */\n readonly label: string;\n /** One-line syntax guidance for an LLM authoring commands. */\n readonly syntaxHint: string;\n}\n\n/** Pure inputs for resolving one executable together with its command argument family. */\nexport interface IPlatformShellResolutionRequest {\n /** Request-local executable. A non-blank value has the highest precedence. */\n readonly executable?: string;\n /** Environment used for SHELL resolution. */\n readonly env?: NodeJS.ProcessEnv;\n /** Actual host platform retained in the resolved metadata. */\n readonly platform?: NodeJS.Platform;\n}\n\n/** An explicit executable whose basename has no supported command argument family. */\nexport class UnsupportedShellError extends RobotaError {\n readonly code = 'UNSUPPORTED_SHELL';\n readonly category = 'user' as const;\n readonly recoverable = false;\n\n constructor(public readonly executable: string) {\n super(`Unsupported shell executable: ${executable}`, { executable });\n }\n}\n\n/**\n * OS-family syntax guidance for the LLM. macOS and Linux are both POSIX but ship different userlands\n * (macOS = BSD coreutils, most Linux = GNU coreutils), so flags like `sed -i`, `date`, and `grep`\n * differ — naming the OS lets the model avoid Linux-only invocations on macOS and vice versa.\n */\nfunction posixSyntaxHint(platform: NodeJS.Platform): string {\n if (platform === 'darwin') {\n return 'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i \"\"` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.';\n }\n if (platform === 'linux') {\n return 'Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.';\n }\n return `Host OS: ${platform}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`;\n}\n\nfunction posixShell(command: string, platform: NodeJS.Platform): IPlatformShell {\n const isBash = shellBasename(command) === 'bash';\n const kind: TShellKind = isBash ? 'bash' : 'sh';\n return {\n command,\n kind,\n platform,\n commandArgs: (cmd: string): string[] => ['-c', cmd],\n interactiveArgs: [],\n label: `${kind} on ${platform}`,\n syntaxHint: posixSyntaxHint(platform),\n };\n}\n\nfunction powerShell(command: string, platform: NodeJS.Platform): IPlatformShell {\n return {\n command,\n kind: 'powershell',\n platform,\n commandArgs: (cmd: string): string[] => ['-NoProfile', '-Command', cmd],\n interactiveArgs: ['-NoProfile'],\n label: `PowerShell on ${platform}`,\n syntaxHint:\n `Host OS: ${platform}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. ` +\n '`Get-ChildItem` not `ls -la`, `$env:VAR` not `$VAR`.',\n };\n}\n\nfunction cmdShell(command: string, platform: NodeJS.Platform): IPlatformShell {\n return {\n command,\n kind: 'cmd',\n platform,\n commandArgs: (cmd: string): string[] => ['/d', '/s', '/c', cmd],\n interactiveArgs: [],\n label: `cmd.exe on ${platform}`,\n syntaxHint: `Host OS: ${platform}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`,\n };\n}\n\nfunction shellBasename(command: string): string {\n const basename = command.split(/[\\\\/]/).at(-1)?.toLowerCase() ?? '';\n return basename.replace(/\\.exe$/i, '');\n}\n\nfunction explicitShell(command: string, platform: NodeJS.Platform): IPlatformShell {\n switch (shellBasename(command)) {\n case 'sh':\n case 'bash':\n return posixShell(command, platform);\n case 'powershell':\n case 'pwsh':\n return powerShell(command, platform);\n case 'cmd':\n return cmdShell(command, platform);\n default:\n throw new UnsupportedShellError(command);\n }\n}\n\nfunction nonBlank(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n return trimmed === undefined || trimmed.length === 0 ? undefined : trimmed;\n}\n\n/**\n * Resolve the shell to spawn for the current (or a given) platform.\n *\n * - request `executable` wins when non-blank.\n * - **win32:** PowerShell.\n * - **posix:** `$SHELL` if set, else `/bin/sh`.\n */\nexport function resolvePlatformShell(\n request: IPlatformShellResolutionRequest = {},\n): IPlatformShell {\n const env = request.env ?? process.env;\n const platform = request.platform ?? process.platform;\n const requestedExecutable = nonBlank(request.executable);\n if (requestedExecutable !== undefined) return explicitShell(requestedExecutable, platform);\n\n if (platform === 'win32') return powerShell('powershell.exe', platform);\n\n return posixShell(nonBlank(env['SHELL']) ?? '/bin/sh', platform);\n}\n","/**\n * Pure helpers for trusted W3C trace context. Strings and the WHATWG `URL` only, so they are the\n * same in the browser build and in every adapter that attaches the header.\n */\nimport type {\n IOutboundTraceContext,\n IRunTraceContext,\n ISubprocessTraceEnv,\n TSubprocessTraceClass,\n} from '../interfaces/trace-context';\n\nconst TRACE_ID = /^(?!0{32}$)[0-9a-f]{32}$/;\nconst SPAN_ID = /^(?!0{16}$)[0-9a-f]{16}$/;\n\n/**\n * The span ID an operation is exported under, derived from the ID core mints before it runs (a\n * provider call's call ID, a tool body's body ID). One derivation for both the exporter and the\n * outgoing header, so the span a recipient sees as its parent is the span the trace contains.\n */\nexport function spanIdFromMintedId(mintedId: string): string {\n return mintedId.replaceAll('-', '').slice(0, 16);\n}\n\n/** The provider-call name for {@link spanIdFromMintedId}, kept so existing callers keep working. */\nexport const providerCallSpanId: (callId: string) => string = spanIdFromMintedId;\n\n/** Whether `spanId` is a well-formed minted span ID: 16 lowercase hex characters, not all zero. */\nexport function isMintedSpanId(spanId: string): boolean {\n return SPAN_ID.test(spanId);\n}\n\n/** A sampled version-00 `traceparent`, or undefined when either identifier is invalid. */\nexport function buildTraceparent(traceId: string, spanId: string): string | undefined {\n if (!TRACE_ID.test(traceId) || !SPAN_ID.test(spanId)) return undefined;\n return `00-${traceId}-${spanId}-01`;\n}\n\n/** The outbound context for one invoked call, or undefined when there is nothing valid to send. */\nexport function outboundTraceContextFor(\n traceContext: IRunTraceContext,\n callId: string,\n): IOutboundTraceContext | undefined {\n if (traceContext.allowedOrigins.length === 0) return undefined;\n const traceparent = buildTraceparent(traceContext.traceId, spanIdFromMintedId(callId));\n if (traceparent === undefined) return undefined;\n return { traceparent, allowedOrigins: [...traceContext.allowedOrigins] };\n}\n\n/**\n * The outbound context for one tool body, keyed by the body ID core minted for it — never the\n * vendor's tool call ID, which is neither unique nor hex.\n */\nexport function toolTraceContextFor(\n traceContext: IRunTraceContext,\n toolBodyId: string,\n): IOutboundTraceContext | undefined {\n return outboundTraceContextFor(traceContext, toolBodyId);\n}\n\n/**\n * The environment one child process of `subprocessClass` receives, naming `spanId` as its parent,\n * or undefined when the host did not enable that class. Independent of the origin allowlist.\n */\nexport function traceEnvFor(\n subprocessClass: TSubprocessTraceClass,\n traceContext: IRunTraceContext | undefined,\n spanId: string,\n): ISubprocessTraceEnv | undefined {\n if (traceContext?.subprocessClasses?.includes(subprocessClass) !== true) return undefined;\n const traceparent = buildTraceparent(traceContext.traceId, spanId);\n return traceparent === undefined ? undefined : { TRACEPARENT: traceparent };\n}\n\n/**\n * A fresh child environment: `base`, then Robota's trace, then `overrides`. When Robota's value\n * applies, the ambient `TRACESTATE` is dropped because it belongs to a different parent. When\n * `overrides` sets its own `TRACEPARENT`, Robota's value does not apply and `base` passes unchanged.\n * `base` itself is never modified.\n */\nexport function subprocessTraceEnvironment(\n base: Readonly<Record<string, string | undefined>>,\n traceEnv: ISubprocessTraceEnv | undefined,\n overrides: Readonly<Record<string, string>> = {},\n): Record<string, string | undefined> {\n if (traceEnv === undefined || overrides['TRACEPARENT'] !== undefined) return { ...base, ...overrides };\n const { TRACESTATE: _ambientState, ...rest } = base;\n return { ...rest, ...traceEnv, ...overrides };\n}\n\n/**\n * The headers to add to a request whose effective base URL is `baseUrl`: `traceparent` when its\n * origin exactly equals a listed origin, nothing otherwise. Scheme, host and port must all match;\n * a subdomain or a different port is a different origin.\n */\nexport function traceHeadersFor(\n baseUrl: string | undefined,\n traceContext: IOutboundTraceContext | undefined,\n): Readonly<Record<string, string>> {\n if (baseUrl === undefined || traceContext === undefined) return {};\n let origin: string;\n try {\n origin = new URL(baseUrl).origin;\n } catch {\n return {};\n }\n if (origin === 'null' || !traceContext.allowedOrigins.includes(origin)) return {};\n return { traceparent: traceContext.traceparent };\n}\n","/**\n * ARCH-056 (#2161): the bounded output-retention contract for child-process execution.\n *\n * Every path that reads a child's stdout/stderr must bound memory WHILE the output is being read —\n * not cap a summary afterwards while retaining the whole log. Before this existed, `shell-tool`\n * could buffer for ten minutes, the hook `CommandExecutor` repeated the pattern, and a subagent\n * runner had rediscovered a 4 KiB tail on its own. This module names the policy once:\n *\n * - **Budget.** `maxBytes` is the most that is ever RETAINED; bytes beyond it are dropped as they\n * arrive, so memory is bounded by the budget, not by the child's lifetime.\n * - **Retention.** `head` keeps the first `maxBytes` (a tool result: what the command said first);\n * `tail` keeps the last `maxBytes` (a diagnostic: how it ended).\n * - **Truncation is visible.** `truncated`, `droppedBytes` and a marker in `toString()` say that\n * output was dropped and how much — never a silently shorter string.\n * - **No spill.** This contract never writes to disk; a caller that needs the whole stream owns a\n * log file (background tasks do), and this buffer is what stays in memory beside it.\n * - **Termination is not here.** Exceeding the budget drops bytes; whether the child is killed is\n * the caller's policy (CORE-023 owns process-tree termination).\n *\n * Chunks are `Uint8Array` (a Node `Buffer` is one), and decoding happens once at `toString()`, so a\n * multi-byte character split across a chunk boundary is never decoded twice.\n */\n\nexport type TOutputRetention = 'head' | 'tail';\n\nexport interface IBoundedOutputOptions {\n /** Most bytes ever retained. */\n readonly maxBytes: number;\n /** Which end to keep once over budget. Default `head`. */\n readonly retain?: TOutputRetention;\n /** Marker appended (head) or prepended (tail) to `toString()` when bytes were dropped. */\n readonly truncationMarker?: (droppedBytes: number) => string;\n}\n\nexport interface IBoundedOutput {\n append(chunk: Uint8Array | string): void;\n /** Bytes currently retained (≤ `maxBytes`). */\n readonly retainedBytes: number;\n /** Bytes the child produced in total, retained or not. */\n readonly totalBytes: number;\n readonly droppedBytes: number;\n readonly truncated: boolean;\n /** The retained output, decoded as UTF-8, with the truncation marker when bytes were dropped. */\n toString(): string;\n}\n\nconst DEFAULT_MARKER = (dropped: number): string =>\n `\\n…[output truncated: ${dropped} byte(s) dropped]`;\n\nexport function createBoundedOutput(options: IBoundedOutputOptions): IBoundedOutput {\n const retain = options.retain ?? 'head';\n const marker = options.truncationMarker ?? DEFAULT_MARKER;\n const maxBytes = Math.max(0, Math.floor(options.maxBytes));\n const encoder = new TextEncoder();\n let chunks: Uint8Array[] = [];\n let retained = 0;\n let total = 0;\n\n const appendHead = (bytes: Uint8Array): void => {\n const room = maxBytes - retained;\n if (room <= 0) return;\n const kept = bytes.byteLength <= room ? bytes : bytes.subarray(0, room);\n chunks.push(kept);\n retained += kept.byteLength;\n };\n\n const appendTail = (bytes: Uint8Array): void => {\n const kept = bytes.byteLength <= maxBytes ? bytes : bytes.subarray(bytes.byteLength - maxBytes);\n chunks.push(kept);\n retained += kept.byteLength;\n // Drop whole leading chunks first, then trim the oldest survivor — O(chunks), no re-copying.\n while (retained > maxBytes && chunks.length > 0) {\n const oldest = chunks[0] as Uint8Array;\n const excess = retained - maxBytes;\n if (oldest.byteLength <= excess) {\n chunks.shift();\n retained -= oldest.byteLength;\n } else {\n chunks[0] = oldest.subarray(excess);\n retained -= excess;\n }\n }\n };\n\n return {\n append(chunk) {\n const bytes = typeof chunk === 'string' ? encoder.encode(chunk) : chunk;\n total += bytes.byteLength;\n if (retain === 'head') appendHead(bytes);\n else appendTail(bytes);\n },\n get retainedBytes() {\n return retained;\n },\n get totalBytes() {\n return total;\n },\n get droppedBytes() {\n return total - retained;\n },\n get truncated() {\n return total > retained;\n },\n toString() {\n const joined = new Uint8Array(retained);\n let offset = 0;\n for (const chunk of chunks) {\n joined.set(chunk, offset);\n offset += chunk.byteLength;\n }\n chunks = chunks.length > 1 ? [joined] : chunks;\n const text = new TextDecoder().decode(joined);\n if (total <= retained) return text;\n const note = marker(total - retained);\n return retain === 'head' ? `${text}${note}` : `${note.replace(/^\\n/, '')}\\n${text}`;\n },\n };\n}\n"],"mappings":"AAuBA,IAAsB,EAAtB,cAA0C,KAAM,CAO5B,QAFlB,YACE,EACA,EACA,CACA,MAAM,CAAO,EAFG,KAAA,QAAA,EAGhB,KAAK,KAAO,KAAK,YAAY,KAG7B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EAC9B,IAAM,EAAO,EAAO,EAAQ,CAAQ,EACpC,OAAO,IAAW,OAAS,GAAG,IAAO,IAAS,GAAG,EAAK,QAAQ,MAAO,EAAE,EAAE,IAAI,GAC/E,CACF,CACF"}
@@ -1,2 +1,2 @@
1
- import{f as e,s as t,t as n}from"./bounded-output-D3cgiOrh.js";import{spawn as r}from"node:child_process";const i=1e6;function a(e,t){let r=n({maxBytes:i}),a=n({maxBytes:i,retain:`tail`});return e.stdout?.on(`data`,e=>r.append(e)),e.stderr?.on(`data`,e=>a.append(e)),e.stdin?.on(`error`,()=>{}),e.stdin?.write(t),e.stdin?.end(),{stdoutOutput:r,stderrOutput:a}}function o(e,t,n,r){if(e===0)return{outcome:`allow`,source:`command`,stdout:n};if(e===2)return{outcome:`deny`,source:`command`,reason:r.trim()||`Blocked by hook`};let i=r.trim()?`: ${r.trim()}`:``;return{outcome:`error`,source:`command`,kind:`nonzero-exit`,reason:e===null?`Hook terminated by signal ${t??`unknown`}${i}`:`Hook exited ${e}${i}`}}var s=class{shellExecutable;type=`command`;constructor(e){this.shellExecutable=e}execute(n,i,s){let c=n.timeout??600,l=c*1e3,u=JSON.stringify(i);return new Promise(d=>{let f=!1,p=e({executable:this.shellExecutable}),m=r(p.command,p.commandArgs(n.command),{cwd:i.cwd,env:t(process.env,s,i.env)}),{stdoutOutput:h,stderrOutput:g}=a(m,u),_=setTimeout(()=>{f||(f=!0,m.kill(`SIGTERM`),d({outcome:`error`,source:`command`,kind:`timeout`,reason:`Hook timed out after ${c}s`}))},l);m.on(`close`,(e,t)=>{f||(f=!0,clearTimeout(_),d(o(e,t,h.toString(),g.toString())))}),m.on(`error`,e=>{f||(f=!0,clearTimeout(_),d({outcome:`error`,source:`command`,kind:`spawn-failure`,reason:e.message}))})})}};export{s as CommandExecutor};
2
- //# sourceMappingURL=command-executor-BsBTcghZ.js.map
1
+ import{f as e,s as t,t as n}from"./bounded-output-Bgx2Cgkx.js";import{spawn as r}from"node:child_process";const i=1e6;function a(e,t){let r=n({maxBytes:i}),a=n({maxBytes:i,retain:`tail`});return e.stdout?.on(`data`,e=>r.append(e)),e.stderr?.on(`data`,e=>a.append(e)),e.stdin?.on(`error`,()=>{}),e.stdin?.write(t),e.stdin?.end(),{stdoutOutput:r,stderrOutput:a}}function o(e,t,n,r){if(e===0)return{outcome:`allow`,source:`command`,stdout:n};if(e===2)return{outcome:`deny`,source:`command`,reason:r.trim()||`Blocked by hook`};let i=r.trim()?`: ${r.trim()}`:``;return{outcome:`error`,source:`command`,kind:`nonzero-exit`,reason:e===null?`Hook terminated by signal ${t??`unknown`}${i}`:`Hook exited ${e}${i}`}}var s=class{shellExecutable;type=`command`;constructor(e){this.shellExecutable=e}execute(n,i,s){let c=n.timeout??600,l=c*1e3,u=JSON.stringify(i);return new Promise(d=>{let f=!1,p=e({executable:this.shellExecutable}),m=r(p.command,p.commandArgs(n.command),{cwd:i.cwd,env:t(process.env,s,i.env)}),{stdoutOutput:h,stderrOutput:g}=a(m,u),_=setTimeout(()=>{f||(f=!0,m.kill(`SIGTERM`),d({outcome:`error`,source:`command`,kind:`timeout`,reason:`Hook timed out after ${c}s`}))},l);m.on(`close`,(e,t)=>{f||(f=!0,clearTimeout(_),d(o(e,t,h.toString(),g.toString())))}),m.on(`error`,e=>{f||(f=!0,clearTimeout(_),d({outcome:`error`,source:`command`,kind:`spawn-failure`,reason:e.message}))})})}};export{s as CommandExecutor};
2
+ //# sourceMappingURL=command-executor-C0XXfBnt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-executor-BsBTcghZ.js","names":[],"sources":["../../src/hooks/executors/command-executor.ts"],"sourcesContent":["/**\n * Command hook executor — executes shell commands with JSON input on stdin.\n *\n * Exit-code mapping (SEC-015):\n * - `0` → `allow`, stdout carried for the runner's response-protocol decode\n * - `2` → `deny`, stderr carried as the reason\n * - any other code → `error` / `nonzero-exit`\n * - killed by a signal (exit code `null`) → `error` / `nonzero-exit`, signal named in the reason\n * - deadline elapsed → `error` / `timeout`\n * - the process never started → `error` / `spawn-failure`\n *\n * The last four used to be one number. A missing binary exits `127` and a timeout resolved `1`, and\n * the runner discarded both alike, so a gate that never ran was indistinguishable from one that\n * approved.\n */\n\nimport { spawn } from 'node:child_process';\n\nimport { createBoundedOutput, type IBoundedOutput } from '../../utils/bounded-output.js';\nimport { resolvePlatformShell } from '../../utils/platform-shell.js';\nimport { subprocessTraceEnvironment } from '../../utils/trace-context.js';\n\nimport type { ISubprocessTraceEnv } from '../../interfaces/trace-context.js';\nimport type {\n ICommandHookDefinition,\n IHookInput,\n THookOutcome,\n IHookTypeExecutor,\n} from '../types.js';\n\n/** Default timeout in seconds — matches Claude Code's 600s default */\nconst DEFAULT_TIMEOUT_SECONDS = 600;\n/** ARCH-056: most bytes retained per hook stream (stdout head, stderr tail). */\nconst MAX_HOOK_OUTPUT_BYTES = 1_000_000;\n\n/**\n * How a finished process maps onto an outcome — a pure function of what the process reported.\n *\n * Extracted from `execute` because it is the part that carries the contract: `execute` owns spawning\n * and settling exactly once, this owns what the result MEANS, and the two change for different\n * reasons.\n */\n/**\n * Attach the output collectors and feed the hook input to stdin.\n *\n * Separated from `execute` so the promise body reads as the three things that can settle it —\n * timeout, close, spawn error — rather than as stream plumbing interleaved with them. The\n * `settled` guard those three share is the invariant worth keeping visible in one place.\n */\nfunction wireChildIo(\n child: ReturnType<typeof spawn>,\n inputJson: string,\n): { stdoutOutput: IBoundedOutput; stderrOutput: IBoundedOutput } {\n // ARCH-056: bounded while reading; a hook that floods stdout cannot grow the parent's memory.\n const stdoutOutput = createBoundedOutput({ maxBytes: MAX_HOOK_OUTPUT_BYTES });\n const stderrOutput = createBoundedOutput({ maxBytes: MAX_HOOK_OUTPUT_BYTES, retain: 'tail' });\n child.stdout?.on('data', (chunk: Buffer) => stdoutOutput.append(chunk));\n child.stderr?.on('data', (chunk: Buffer) => stderrOutput.append(chunk));\n child.stdin?.on('error', () => {\n // EPIPE: child closed stdin before we finished writing — safe to ignore\n });\n child.stdin?.write(inputJson);\n child.stdin?.end();\n return { stdoutOutput, stderrOutput };\n}\n\nfunction outcomeOfExit(\n code: number | null,\n signal: NodeJS.Signals | null,\n stdout: string,\n stderr: string,\n): THookOutcome {\n if (code === 0) return { outcome: 'allow', source: 'command', stdout };\n if (code === 2) {\n return { outcome: 'deny', source: 'command', reason: stderr.trim() || 'Blocked by hook' };\n }\n const detail = stderr.trim() ? `: ${stderr.trim()}` : '';\n return {\n outcome: 'error',\n source: 'command',\n kind: 'nonzero-exit',\n // `code === null` means a signal ended it. That is not an exit code and must not be read as\n // one — the old `code ?? 1` made a SIGKILLed hook indistinguishable from one that exited 1.\n reason:\n code === null\n ? `Hook terminated by signal ${signal ?? 'unknown'}${detail}`\n : `Hook exited ${code}${detail}`,\n };\n}\n\nexport class CommandExecutor implements IHookTypeExecutor {\n readonly type = 'command' as const;\n\n constructor(private readonly shellExecutable?: string) {}\n\n /**\n * `traceEnv` is the prompt's trace for this child, handed separately so it never reaches the\n * stdin JSON. The child sees `process.env`, then Robota's value, then the hook's own `env`; a hook\n * that sets its own `TRACEPARENT` wins and gets the ambient environment unchanged.\n */\n execute(\n definition: ICommandHookDefinition,\n input: IHookInput,\n traceEnv?: ISubprocessTraceEnv,\n ): Promise<THookOutcome> {\n const timeoutSeconds = definition.timeout ?? DEFAULT_TIMEOUT_SECONDS;\n const timeoutMs = timeoutSeconds * 1000;\n const inputJson = JSON.stringify(input);\n\n return new Promise<THookOutcome>((resolve) => {\n let settled = false;\n const shell = resolvePlatformShell({ executable: this.shellExecutable });\n const child = spawn(shell.command, shell.commandArgs(definition.command), {\n cwd: input.cwd,\n env: subprocessTraceEnvironment(process.env, traceEnv, input.env),\n });\n const { stdoutOutput, stderrOutput } = wireChildIo(child, inputJson);\n\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n child.kill('SIGTERM');\n resolve({\n outcome: 'error',\n source: 'command',\n kind: 'timeout',\n reason: `Hook timed out after ${timeoutSeconds}s`,\n });\n }\n }, timeoutMs);\n\n child.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(outcomeOfExit(code, signal, stdoutOutput.toString(), stderrOutput.toString()));\n });\n\n child.on('error', (err: Error) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve({\n outcome: 'error',\n source: 'command',\n kind: 'spawn-failure',\n reason: err.message,\n });\n });\n });\n }\n}\n"],"mappings":"0GA+BA,MAEM,EAAwB,IAgB9B,SAAS,EACP,EACA,EACgE,CAEhE,IAAM,EAAe,EAAoB,CAAE,SAAU,CAAsB,CAAC,EACtE,EAAe,EAAoB,CAAE,SAAU,EAAuB,OAAQ,MAAO,CAAC,EAQ5F,OAPA,EAAM,QAAQ,GAAG,OAAS,GAAkB,EAAa,OAAO,CAAK,CAAC,EACtE,EAAM,QAAQ,GAAG,OAAS,GAAkB,EAAa,OAAO,CAAK,CAAC,EACtE,EAAM,OAAO,GAAG,YAAe,CAE/B,CAAC,EACD,EAAM,OAAO,MAAM,CAAS,EAC5B,EAAM,OAAO,IAAI,EACV,CAAE,eAAc,cAAa,CACtC,CAEA,SAAS,EACP,EACA,EACA,EACA,EACc,CACd,GAAI,IAAS,EAAG,MAAO,CAAE,QAAS,QAAS,OAAQ,UAAW,QAAO,EACrE,GAAI,IAAS,EACX,MAAO,CAAE,QAAS,OAAQ,OAAQ,UAAW,OAAQ,EAAO,KAAK,GAAK,iBAAkB,EAE1F,IAAM,EAAS,EAAO,KAAK,EAAI,KAAK,EAAO,KAAK,IAAM,GACtD,MAAO,CACL,QAAS,QACT,OAAQ,UACR,KAAM,eAGN,OACE,IAAS,KACL,6BAA6B,GAAU,YAAY,IACnD,eAAe,IAAO,GAC9B,CACF,CAEA,IAAa,EAAb,KAA0D,CAG3B,gBAF7B,KAAgB,UAEhB,YAAY,EAA2C,CAA1B,KAAA,gBAAA,CAA2B,CAOxD,QACE,EACA,EACA,EACuB,CACvB,IAAM,EAAiB,EAAW,SAAW,IACvC,EAAY,EAAiB,IAC7B,EAAY,KAAK,UAAU,CAAK,EAEtC,OAAO,IAAI,QAAuB,GAAY,CAC5C,IAAI,EAAU,GACR,EAAQ,EAAqB,CAAE,WAAY,KAAK,eAAgB,CAAC,EACjE,EAAQ,EAAM,EAAM,QAAS,EAAM,YAAY,EAAW,OAAO,EAAG,CACxE,IAAK,EAAM,IACX,IAAK,EAA2B,QAAQ,IAAK,EAAU,EAAM,GAAG,CAClE,CAAC,EACK,CAAE,eAAc,gBAAiB,EAAY,EAAO,CAAS,EAE7D,EAAQ,eAAiB,CACxB,IACH,EAAU,GACV,EAAM,KAAK,SAAS,EACpB,EAAQ,CACN,QAAS,QACT,OAAQ,UACR,KAAM,UACN,OAAQ,wBAAwB,EAAe,EACjD,CAAC,EAEL,EAAG,CAAS,EAEZ,EAAM,GAAG,SAAU,EAAqB,IAAkC,CACpE,IACJ,EAAU,GACV,aAAa,CAAK,EAClB,EAAQ,EAAc,EAAM,EAAQ,EAAa,SAAS,EAAG,EAAa,SAAS,CAAC,CAAC,EACvF,CAAC,EAED,EAAM,GAAG,QAAU,GAAe,CAC5B,IACJ,EAAU,GACV,aAAa,CAAK,EAClB,EAAQ,CACN,QAAS,QACT,OAAQ,UACR,KAAM,gBACN,OAAQ,EAAI,OACd,CAAC,EACH,CAAC,CACH,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"command-executor-C0XXfBnt.js","names":[],"sources":["../../src/hooks/executors/command-executor.ts"],"sourcesContent":["/**\n * Command hook executor — executes shell commands with JSON input on stdin.\n *\n * Exit-code mapping (SEC-015):\n * - `0` → `allow`, stdout carried for the runner's response-protocol decode\n * - `2` → `deny`, stderr carried as the reason\n * - any other code → `error` / `nonzero-exit`\n * - killed by a signal (exit code `null`) → `error` / `nonzero-exit`, signal named in the reason\n * - deadline elapsed → `error` / `timeout`\n * - the process never started → `error` / `spawn-failure`\n *\n * The last four used to be one number. A missing binary exits `127` and a timeout resolved `1`, and\n * the runner discarded both alike, so a gate that never ran was indistinguishable from one that\n * approved.\n */\n\nimport { spawn } from 'node:child_process';\n\nimport { createBoundedOutput, type IBoundedOutput } from '../../utils/bounded-output.js';\nimport { resolvePlatformShell } from '../../utils/platform-shell.js';\nimport { subprocessTraceEnvironment } from '../../utils/trace-context.js';\n\nimport type { ISubprocessTraceEnv } from '../../interfaces/trace-context.js';\nimport type {\n ICommandHookDefinition,\n IHookInput,\n THookOutcome,\n IHookTypeExecutor,\n} from '../types.js';\n\n/** Default timeout in seconds — matches Claude Code's 600s default */\nconst DEFAULT_TIMEOUT_SECONDS = 600;\n/** ARCH-056: most bytes retained per hook stream (stdout head, stderr tail). */\nconst MAX_HOOK_OUTPUT_BYTES = 1_000_000;\n\n/**\n * How a finished process maps onto an outcome — a pure function of what the process reported.\n *\n * Extracted from `execute` because it is the part that carries the contract: `execute` owns spawning\n * and settling exactly once, this owns what the result MEANS, and the two change for different\n * reasons.\n */\n/**\n * Attach the output collectors and feed the hook input to stdin.\n *\n * Separated from `execute` so the promise body reads as the three things that can settle it —\n * timeout, close, spawn error — rather than as stream plumbing interleaved with them. The\n * `settled` guard those three share is the invariant worth keeping visible in one place.\n */\nfunction wireChildIo(\n child: ReturnType<typeof spawn>,\n inputJson: string,\n): { stdoutOutput: IBoundedOutput; stderrOutput: IBoundedOutput } {\n // ARCH-056: bounded while reading; a hook that floods stdout cannot grow the parent's memory.\n const stdoutOutput = createBoundedOutput({ maxBytes: MAX_HOOK_OUTPUT_BYTES });\n const stderrOutput = createBoundedOutput({ maxBytes: MAX_HOOK_OUTPUT_BYTES, retain: 'tail' });\n child.stdout?.on('data', (chunk: Buffer) => stdoutOutput.append(chunk));\n child.stderr?.on('data', (chunk: Buffer) => stderrOutput.append(chunk));\n child.stdin?.on('error', () => {\n // EPIPE: child closed stdin before we finished writing — safe to ignore\n });\n child.stdin?.write(inputJson);\n child.stdin?.end();\n return { stdoutOutput, stderrOutput };\n}\n\nfunction outcomeOfExit(\n code: number | null,\n signal: NodeJS.Signals | null,\n stdout: string,\n stderr: string,\n): THookOutcome {\n if (code === 0) return { outcome: 'allow', source: 'command', stdout };\n if (code === 2) {\n return { outcome: 'deny', source: 'command', reason: stderr.trim() || 'Blocked by hook' };\n }\n const detail = stderr.trim() ? `: ${stderr.trim()}` : '';\n return {\n outcome: 'error',\n source: 'command',\n kind: 'nonzero-exit',\n // `code === null` means a signal ended it. That is not an exit code and must not be read as\n // one — the old `code ?? 1` made a SIGKILLed hook indistinguishable from one that exited 1.\n reason:\n code === null\n ? `Hook terminated by signal ${signal ?? 'unknown'}${detail}`\n : `Hook exited ${code}${detail}`,\n };\n}\n\nexport class CommandExecutor implements IHookTypeExecutor {\n readonly type = 'command' as const;\n\n constructor(private readonly shellExecutable?: string) {}\n\n /**\n * `traceEnv` is the prompt's trace for this child, handed separately so it never reaches the\n * stdin JSON. The child sees `process.env`, then Robota's value, then the hook's own `env`; a hook\n * that sets its own `TRACEPARENT` wins and gets the ambient environment unchanged.\n */\n execute(\n definition: ICommandHookDefinition,\n input: IHookInput,\n traceEnv?: ISubprocessTraceEnv,\n ): Promise<THookOutcome> {\n const timeoutSeconds = definition.timeout ?? DEFAULT_TIMEOUT_SECONDS;\n const timeoutMs = timeoutSeconds * 1000;\n const inputJson = JSON.stringify(input);\n\n return new Promise<THookOutcome>((resolve) => {\n let settled = false;\n const shell = resolvePlatformShell({ executable: this.shellExecutable });\n const child = spawn(shell.command, shell.commandArgs(definition.command), {\n cwd: input.cwd,\n env: subprocessTraceEnvironment(process.env, traceEnv, input.env),\n });\n const { stdoutOutput, stderrOutput } = wireChildIo(child, inputJson);\n\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n child.kill('SIGTERM');\n resolve({\n outcome: 'error',\n source: 'command',\n kind: 'timeout',\n reason: `Hook timed out after ${timeoutSeconds}s`,\n });\n }\n }, timeoutMs);\n\n child.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(outcomeOfExit(code, signal, stdoutOutput.toString(), stderrOutput.toString()));\n });\n\n child.on('error', (err: Error) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve({\n outcome: 'error',\n source: 'command',\n kind: 'spawn-failure',\n reason: err.message,\n });\n });\n });\n }\n}\n"],"mappings":"0GA+BA,MAEM,EAAwB,IAgB9B,SAAS,EACP,EACA,EACgE,CAEhE,IAAM,EAAe,EAAoB,CAAE,SAAU,CAAsB,CAAC,EACtE,EAAe,EAAoB,CAAE,SAAU,EAAuB,OAAQ,MAAO,CAAC,EAQ5F,OAPA,EAAM,QAAQ,GAAG,OAAS,GAAkB,EAAa,OAAO,CAAK,CAAC,EACtE,EAAM,QAAQ,GAAG,OAAS,GAAkB,EAAa,OAAO,CAAK,CAAC,EACtE,EAAM,OAAO,GAAG,YAAe,CAE/B,CAAC,EACD,EAAM,OAAO,MAAM,CAAS,EAC5B,EAAM,OAAO,IAAI,EACV,CAAE,eAAc,cAAa,CACtC,CAEA,SAAS,EACP,EACA,EACA,EACA,EACc,CACd,GAAI,IAAS,EAAG,MAAO,CAAE,QAAS,QAAS,OAAQ,UAAW,QAAO,EACrE,GAAI,IAAS,EACX,MAAO,CAAE,QAAS,OAAQ,OAAQ,UAAW,OAAQ,EAAO,KAAK,GAAK,iBAAkB,EAE1F,IAAM,EAAS,EAAO,KAAK,EAAI,KAAK,EAAO,KAAK,IAAM,GACtD,MAAO,CACL,QAAS,QACT,OAAQ,UACR,KAAM,eAGN,OACE,IAAS,KACL,6BAA6B,GAAU,YAAY,IACnD,eAAe,IAAO,GAC9B,CACF,CAEA,IAAa,EAAb,KAA0D,CAG3B,gBAF7B,KAAgB,UAEhB,YAAY,EAA2C,CAA1B,KAAA,gBAAA,CAA2B,CAOxD,QACE,EACA,EACA,EACuB,CACvB,IAAM,EAAiB,EAAW,SAAW,IACvC,EAAY,EAAiB,IAC7B,EAAY,KAAK,UAAU,CAAK,EAEtC,OAAO,IAAI,QAAuB,GAAY,CAC5C,IAAI,EAAU,GACR,EAAQ,EAAqB,CAAE,WAAY,KAAK,eAAgB,CAAC,EACjE,EAAQ,EAAM,EAAM,QAAS,EAAM,YAAY,EAAW,OAAO,EAAG,CACxE,IAAK,EAAM,IACX,IAAK,EAA2B,QAAQ,IAAK,EAAU,EAAM,GAAG,CAClE,CAAC,EACK,CAAE,eAAc,gBAAiB,EAAY,EAAO,CAAS,EAE7D,EAAQ,eAAiB,CACxB,IACH,EAAU,GACV,EAAM,KAAK,SAAS,EACpB,EAAQ,CACN,QAAS,QACT,OAAQ,UACR,KAAM,UACN,OAAQ,wBAAwB,EAAe,EACjD,CAAC,EAEL,EAAG,CAAS,EAEZ,EAAM,GAAG,SAAU,EAAqB,IAAkC,CACpE,IACJ,EAAU,GACV,aAAa,CAAK,EAClB,EAAQ,EAAc,EAAM,EAAQ,EAAa,SAAS,EAAG,EAAa,SAAS,CAAC,CAAC,EACvF,CAAC,EAED,EAAM,GAAG,QAAU,GAAe,CAC5B,IACJ,EAAU,GACV,aAAa,CAAK,EAClB,EAAQ,CACN,QAAS,QACT,OAAQ,UACR,KAAM,gBACN,OAAQ,EAAI,OACd,CAAC,EACH,CAAC,CACH,CAAC,CACH,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./verdict-decoder-Dk_w2NG9.js";function t(e){return e.replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(e,t)=>{let n=process.env[t];return n===void 0?e:n})}var n=class{type=`http`;async execute(n,i){let a=(n.timeout??10)*1e3,o={"Content-Type":`application/json`};if(n.headers)for(let[e,r]of Object.entries(n.headers))o[e]=t(r);try{let t=await fetch(n.url,{method:`POST`,headers:o,body:JSON.stringify(i),signal:AbortSignal.timeout(a)});return t.ok?e(await t.text(),`http`,i.hook_event_name):{outcome:`error`,source:`http`,kind:`http-status`,reason:`HTTP ${t.status} ${t.statusText}`}}catch(e){return r(e)}}};function r(e){return{outcome:`error`,source:`http`,kind:e instanceof Error&&e.name===`TimeoutError`?`timeout`:`transport-failure`,reason:e instanceof Error?e.message:String(e)}}export{n as HttpExecutor};
2
- //# sourceMappingURL=http-executor-CHy6UeBU.js.map
1
+ import{t as e}from"./verdict-decoder-Dz_rjoIZ.js";function t(e){return e.replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(e,t)=>{let n=process.env[t];return n===void 0?e:n})}var n=class{type=`http`;async execute(n,i){let a=(n.timeout??10)*1e3,o={"Content-Type":`application/json`};if(n.headers)for(let[e,r]of Object.entries(n.headers))o[e]=t(r);try{let t=await fetch(n.url,{method:`POST`,headers:o,body:JSON.stringify(i),signal:AbortSignal.timeout(a)});return t.ok?e(await t.text(),`http`,i.hook_event_name):{outcome:`error`,source:`http`,kind:`http-status`,reason:`HTTP ${t.status} ${t.statusText}`}}catch(e){return r(e)}}};function r(e){return{outcome:`error`,source:`http`,kind:e instanceof Error&&e.name===`TimeoutError`?`timeout`:`transport-failure`,reason:e instanceof Error?e.message:String(e)}}export{n as HttpExecutor};
2
+ //# sourceMappingURL=http-executor-B4YgCJg7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-executor-CHy6UeBU.js","names":[],"sources":["../../src/hooks/executors/http-executor.ts"],"sourcesContent":["/**\n * HTTP hook executor — POSTs hook input as JSON to a URL.\n *\n * Response format: `{ ok: boolean, reason?: string }`, decoded by `decodeHookVerdict` (SEC-015):\n * - `ok: true` → `allow`\n * - `ok: false` → `deny`, carrying `reason`\n * - anything else, including a non-boolean `ok` → `error` / `malformed-response`\n *\n * Transport conditions are outcomes in their own right rather than a shared failure code:\n * non-2xx → `http-status`, deadline elapsed → `timeout`, unreachable → `transport-failure`,\n * unparseable body → `malformed-response`.\n *\n * Supports env var interpolation in headers: $VAR_NAME\n */\n\nimport { decodeHookVerdict } from '../verdict-decoder.js';\n\nimport type { IHttpHookDefinition, IHookInput, THookOutcome, IHookTypeExecutor } from '../types.js';\n\n/** Default timeout in seconds */\nconst DEFAULT_TIMEOUT_SECONDS = 10;\n\n/** Interpolate $VAR_NAME references in a string with process.env values. */\nfunction interpolateEnvVars(value: string): string {\n return value.replace(/\\$([A-Za-z_][A-Za-z0-9_]*)/g, (_match, varName: string) => {\n const envValue = process.env[varName];\n return envValue !== undefined ? envValue : _match;\n });\n}\n\nexport class HttpExecutor implements IHookTypeExecutor {\n readonly type = 'http' as const;\n\n async execute(definition: IHttpHookDefinition, input: IHookInput): Promise<THookOutcome> {\n const timeoutSeconds = definition.timeout ?? DEFAULT_TIMEOUT_SECONDS;\n const timeoutMs = timeoutSeconds * 1000;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n\n if (definition.headers) {\n for (const [key, value] of Object.entries(definition.headers)) {\n headers[key] = interpolateEnvVars(value);\n }\n }\n\n try {\n const response = await fetch(definition.url, {\n method: 'POST',\n headers,\n body: JSON.stringify(input),\n signal: AbortSignal.timeout(timeoutMs),\n });\n\n if (!response.ok) {\n return {\n outcome: 'error',\n source: 'http',\n kind: 'http-status',\n reason: `HTTP ${response.status} ${response.statusText}`,\n };\n }\n\n // Read the body as TEXT first. `response.json()` would collapse \"the endpoint sent HTML\" and\n // \"the endpoint sent a verdict\" into one throw, and the raw text is what the decoder quotes\n // back — so a misconfigured endpoint is identifiable from the reason alone.\n return decodeHookVerdict(await response.text(), 'http', input.hook_event_name);\n } catch (err: unknown) {\n return toTransportOutcome(err);\n }\n }\n}\n\n/**\n * Classify a `fetch` rejection.\n *\n * `AbortSignal.timeout` rejects with a `DOMException` named `TimeoutError`, which is a different\n * fact from a connection refused or dropped: one says the hook was too slow, the other says it was\n * never reached. Both are `error`, and an operator reading the reason needs to know which.\n */\nfunction toTransportOutcome(err: unknown): THookOutcome {\n return {\n outcome: 'error',\n source: 'http',\n kind: err instanceof Error && err.name === 'TimeoutError' ? 'timeout' : 'transport-failure',\n reason: err instanceof Error ? err.message : String(err),\n };\n}\n"],"mappings":"kDAuBA,SAAS,EAAmB,EAAuB,CACjD,OAAO,EAAM,QAAQ,+BAAgC,EAAQ,IAAoB,CAC/E,IAAM,EAAW,QAAQ,IAAI,GAC7B,OAAO,IAAa,IAAA,GAAuB,EAAX,CAClC,CAAC,CACH,CAEA,IAAa,EAAb,KAAuD,CACrD,KAAgB,OAEhB,MAAM,QAAQ,EAAiC,EAA0C,CAEvF,IAAM,GADiB,EAAW,SAAW,IACV,IAE7B,EAAkC,CACtC,eAAgB,kBAClB,EAEA,GAAI,EAAW,QACb,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,EAAW,OAAO,EAC1D,EAAQ,GAAO,EAAmB,CAAK,EAI3C,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAW,IAAK,CAC3C,OAAQ,OACR,UACA,KAAM,KAAK,UAAU,CAAK,EAC1B,OAAQ,YAAY,QAAQ,CAAS,CACvC,CAAC,EAcD,OAZK,EAAS,GAYP,EAAkB,MAAM,EAAS,KAAK,EAAG,OAAQ,EAAM,eAAe,EAXpE,CACL,QAAS,QACT,OAAQ,OACR,KAAM,cACN,OAAQ,QAAQ,EAAS,OAAO,GAAG,EAAS,YAC9C,CAOJ,OAAS,EAAc,CACrB,OAAO,EAAmB,CAAG,CAC/B,CACF,CACF,EASA,SAAS,EAAmB,EAA4B,CACtD,MAAO,CACL,QAAS,QACT,OAAQ,OACR,KAAM,aAAe,OAAS,EAAI,OAAS,eAAiB,UAAY,oBACxE,OAAQ,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,CACzD,CACF"}
1
+ {"version":3,"file":"http-executor-B4YgCJg7.js","names":[],"sources":["../../src/hooks/executors/http-executor.ts"],"sourcesContent":["/**\n * HTTP hook executor — POSTs hook input as JSON to a URL.\n *\n * Response format: `{ ok: boolean, reason?: string }`, decoded by `decodeHookVerdict` (SEC-015):\n * - `ok: true` → `allow`\n * - `ok: false` → `deny`, carrying `reason`\n * - anything else, including a non-boolean `ok` → `error` / `malformed-response`\n *\n * Transport conditions are outcomes in their own right rather than a shared failure code:\n * non-2xx → `http-status`, deadline elapsed → `timeout`, unreachable → `transport-failure`,\n * unparseable body → `malformed-response`.\n *\n * Supports env var interpolation in headers: $VAR_NAME\n */\n\nimport { decodeHookVerdict } from '../verdict-decoder.js';\n\nimport type { IHttpHookDefinition, IHookInput, THookOutcome, IHookTypeExecutor } from '../types.js';\n\n/** Default timeout in seconds */\nconst DEFAULT_TIMEOUT_SECONDS = 10;\n\n/** Interpolate $VAR_NAME references in a string with process.env values. */\nfunction interpolateEnvVars(value: string): string {\n return value.replace(/\\$([A-Za-z_][A-Za-z0-9_]*)/g, (_match, varName: string) => {\n const envValue = process.env[varName];\n return envValue !== undefined ? envValue : _match;\n });\n}\n\nexport class HttpExecutor implements IHookTypeExecutor {\n readonly type = 'http' as const;\n\n async execute(definition: IHttpHookDefinition, input: IHookInput): Promise<THookOutcome> {\n const timeoutSeconds = definition.timeout ?? DEFAULT_TIMEOUT_SECONDS;\n const timeoutMs = timeoutSeconds * 1000;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n\n if (definition.headers) {\n for (const [key, value] of Object.entries(definition.headers)) {\n headers[key] = interpolateEnvVars(value);\n }\n }\n\n try {\n const response = await fetch(definition.url, {\n method: 'POST',\n headers,\n body: JSON.stringify(input),\n signal: AbortSignal.timeout(timeoutMs),\n });\n\n if (!response.ok) {\n return {\n outcome: 'error',\n source: 'http',\n kind: 'http-status',\n reason: `HTTP ${response.status} ${response.statusText}`,\n };\n }\n\n // Read the body as TEXT first. `response.json()` would collapse \"the endpoint sent HTML\" and\n // \"the endpoint sent a verdict\" into one throw, and the raw text is what the decoder quotes\n // back — so a misconfigured endpoint is identifiable from the reason alone.\n return decodeHookVerdict(await response.text(), 'http', input.hook_event_name);\n } catch (err: unknown) {\n return toTransportOutcome(err);\n }\n }\n}\n\n/**\n * Classify a `fetch` rejection.\n *\n * `AbortSignal.timeout` rejects with a `DOMException` named `TimeoutError`, which is a different\n * fact from a connection refused or dropped: one says the hook was too slow, the other says it was\n * never reached. Both are `error`, and an operator reading the reason needs to know which.\n */\nfunction toTransportOutcome(err: unknown): THookOutcome {\n return {\n outcome: 'error',\n source: 'http',\n kind: err instanceof Error && err.name === 'TimeoutError' ? 'timeout' : 'transport-failure',\n reason: err instanceof Error ? err.message : String(err),\n };\n}\n"],"mappings":"kDAuBA,SAAS,EAAmB,EAAuB,CACjD,OAAO,EAAM,QAAQ,+BAAgC,EAAQ,IAAoB,CAC/E,IAAM,EAAW,QAAQ,IAAI,GAC7B,OAAO,IAAa,IAAA,GAAuB,EAAX,CAClC,CAAC,CACH,CAEA,IAAa,EAAb,KAAuD,CACrD,KAAgB,OAEhB,MAAM,QAAQ,EAAiC,EAA0C,CAEvF,IAAM,GADiB,EAAW,SAAW,IACV,IAE7B,EAAkC,CACtC,eAAgB,kBAClB,EAEA,GAAI,EAAW,QACb,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,EAAW,OAAO,EAC1D,EAAQ,GAAO,EAAmB,CAAK,EAI3C,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAW,IAAK,CAC3C,OAAQ,OACR,UACA,KAAM,KAAK,UAAU,CAAK,EAC1B,OAAQ,YAAY,QAAQ,CAAS,CACvC,CAAC,EAcD,OAZK,EAAS,GAYP,EAAkB,MAAM,EAAS,KAAK,EAAG,OAAQ,EAAM,eAAe,EAXpE,CACL,QAAS,QACT,OAAQ,OACR,KAAM,cACN,OAAQ,QAAQ,EAAS,OAAO,GAAG,EAAS,YAC9C,CAOJ,OAAS,EAAc,CACrB,OAAO,EAAmB,CAAG,CAC/B,CACF,CACF,EASA,SAAS,EAAmB,EAA4B,CACtD,MAAO,CACL,QAAS,QACT,OAAQ,OACR,KAAM,aAAe,OAAS,EAAI,OAAS,eAAiB,UAAY,oBACxE,OAAQ,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,CACzD,CACF"}
@@ -487,6 +487,28 @@ declare class SameToolInputLoopError extends RobotaError {
487
487
  readonly recoverable = true;
488
488
  constructor(toolName: string, callCount: number, maxSameToolInputs: number, context?: TErrorContextData);
489
489
  }
490
+ /**
491
+ * A turn ended with neither a tool result nor a final text response while `allowToolOnlyCompletion`
492
+ * was set.
493
+ *
494
+ * `allowToolOnlyCompletion` only WIDENS what counts as a valid finish (a tool call alone, with no
495
+ * final text after it); it never narrows the ordinary case. Without the flag, a round that produces
496
+ * neither is recovered by one more provider call asking for a summary (`forceSummaryCall`). Setting
497
+ * the flag is what turns that rescue off — a decision agent wants exactly one provider call, never a
498
+ * follow-up — so a round that produces neither has nothing left to recover it. That is a genuinely
499
+ * unanswered turn, not the internal `[STRICT-POLICY]` result-shape violation an actually malformed
500
+ * execution result trips; a caller must be able to catch this by type instead of parsing that message.
501
+ *
502
+ * `recoverable` is TRUE: like `SameToolInputLoopError`, this is a property of this turn's prompt and
503
+ * model response, not of the system, and a caller that varies either can reasonably try again.
504
+ */
505
+ declare class EmptyCompletionError extends RobotaError {
506
+ readonly round: number;
507
+ readonly code = "EMPTY_COMPLETION";
508
+ readonly category: "provider";
509
+ readonly recoverable = true;
510
+ constructor(round: number, context?: TErrorContextData);
511
+ }
490
512
  /**
491
513
  * Model not available errors
492
514
  */
@@ -2204,7 +2226,8 @@ interface IRunOptions {
2204
2226
  * The summary call is the one made when the round cap ends the loop on a tool round; before the cap
2205
2227
  * the model is called again after tool results as usual, so a decision agent sets
2206
2228
  * `maxExecutionRounds` too (e.g. `1`). The run resolves with the turn's text, or `''` when it
2207
- * produced none; consumers read the outcome from the tool results.
2229
+ * ended in tool results (consumers read the outcome from those results), and rejects with
2230
+ * `EmptyCompletionError` when it produced neither text nor a tool result.
2208
2231
  */
2209
2232
  allowToolOnlyCompletion?: boolean;
2210
2233
  /**
@@ -2252,8 +2275,11 @@ type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES
2252
2275
  * - Import and use EVENT_EMITTER_EVENTS instead.
2253
2276
  */
2254
2277
  declare const EVENT_EMITTER_EVENTS: {
2278
+ /** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_START`. */
2255
2279
  readonly EXECUTION_START: "execution.start";
2280
+ /** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_COMPLETE`. */
2256
2281
  readonly EXECUTION_COMPLETE: "execution.complete";
2282
+ /** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_ERROR`. */
2257
2283
  readonly EXECUTION_ERROR: "execution.error";
2258
2284
  readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
2259
2285
  readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
@@ -2484,6 +2510,8 @@ interface IPluginExecutionResult {
2484
2510
  * above, which lives at this abstracts layer.
2485
2511
  */
2486
2512
  interface IPluginContext {
2513
+ toolData?: IToolExecutionContext;
2514
+ toolResult?: IToolExecutionResult;
2487
2515
  input?: string;
2488
2516
  response?: string;
2489
2517
  messages?: TUniversalMessage[];
@@ -2493,7 +2521,10 @@ interface IPluginContext {
2493
2521
  executionContext?: TContextData;
2494
2522
  /** PLG-020 (issue #2460): the run's result, for `afterExecution` / `afterConversation` / `afterToolExecution`. */
2495
2523
  executionResult?: IPluginExecutionResult;
2496
- /** PLG-020 (issue #2460): the message just appended to the conversation, for `onMessageAdded`. */
2524
+ /**
2525
+ * The message just appended to the conversation, for `onMessageAdded`, or the streamed text
2526
+ * chunk, for `onStreamingChunk`.
2527
+ */
2497
2528
  message?: TUniversalMessage;
2498
2529
  }
2499
2530
  /** Error context for plugin error handling */
@@ -2573,7 +2604,7 @@ interface IPluginHooks {
2573
2604
  afterExecution?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
2574
2605
  beforeConversation?(context: IPluginExecutionContext): Promise<void> | void;
2575
2606
  afterConversation?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
2576
- beforeToolCall?(toolName: string, parameters: TToolParameters): Promise<void> | void;
2607
+ beforeToolCall?(toolName: string, parameters: TToolParameters, context?: IToolExecutionContext): Promise<void> | void;
2577
2608
  beforeToolExecution?(context: IPluginExecutionContext, toolData: IToolExecutionContext): Promise<void> | void;
2578
2609
  afterToolCall?(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void> | void;
2579
2610
  afterToolExecution?(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void> | void;
@@ -3088,7 +3119,7 @@ interface IProviderDefinition {
3088
3119
  * LLM nodes' single `COST_PER_TOKEN_USD` scalar. The correct long-term home is the per-model
3089
3120
  * {@link IProviderModelCatalogEntry.costPerInputToken}/`costPerOutputToken`; this flat scalar is a
3090
3121
  * fidelity-preserving interim used only while model catalogs are `status:'unavailable'` (no per-model
3091
- * entries to attach cost to). Consumed by the collapsed `llm-text` node's `maxCostUsd` estimation. Absent
3122
+ * entries to attach cost to). Consumed by the collapsed `llm-text` node's cost estimate. Absent
3092
3123
  * means cost is unknown for this provider and estimators must degrade explicitly.
3093
3124
  */
3094
3125
  costPerTokenUsd?: number;
@@ -3758,14 +3789,9 @@ type TExecutorStreamEvent = IExecutorStreamMessageEvent | IExecutorStreamTermina
3758
3789
  /**
3759
3790
  * Interface for executing AI provider operations
3760
3791
  *
3761
- * Executors abstract the execution mechanism, allowing providers to work
3762
- * with either local API calls or remote server calls transparently.
3763
- *
3764
- * Implementation patterns:
3765
- * - LocalExecutor: Direct API calls using provider SDKs
3766
- * - RemoteExecutor: HTTP/WebSocket calls to remote server
3767
- * - CacheExecutor: Cached responses with explicit error propagation
3768
- * - HybridExecutor: Conditional local/remote execution
3792
+ * Executors abstract the execution mechanism, so a provider can call its API directly or hand the
3793
+ * call to something else (a server of your own, a cache). `LocalExecutor` is the in-process one;
3794
+ * any other is yours to implement.
3769
3795
  */
3770
3796
  interface IExecutor {
3771
3797
  /**
@@ -3843,7 +3869,10 @@ interface ILocalExecutorConfig {
3843
3869
  enableLogging?: boolean;
3844
3870
  }
3845
3871
  /**
3846
- * Configuration options for remote executor
3872
+ * Configuration options for a remote executor.
3873
+ *
3874
+ * @deprecated Robota ships no remote executor, so nothing reads this type. It stays exported only
3875
+ * so existing imports keep compiling; describe your own executor's options instead.
3847
3876
  */
3848
3877
  interface IRemoteExecutorConfig {
3849
3878
  /** Remote server URL */
@@ -4391,7 +4420,7 @@ declare abstract class AbstractPlugin<TOptions extends IPluginOptions = IPluginO
4391
4420
  afterExecution?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
4392
4421
  beforeConversation?(context: IPluginExecutionContext): Promise<void>;
4393
4422
  afterConversation?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
4394
- beforeToolCall?(toolName: string, parameters: TToolParameters): Promise<void>;
4423
+ beforeToolCall?(toolName: string, parameters: TToolParameters, context?: IToolExecutionContext): Promise<void>;
4395
4424
  beforeToolExecution?(context: IPluginExecutionContext, toolData: IToolExecutionContext): Promise<void>;
4396
4425
  afterToolCall?(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void>;
4397
4426
  afterToolExecution?(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void>;
@@ -6539,9 +6568,9 @@ interface IOrchestrationStepResult {
6539
6568
  output: string;
6540
6569
  /**
6541
6570
  * Optional token usage of the step's subagent run (the {@link ITokenUsage} SSOT triple;
6542
- * TYPE-003). Present only when the underlying runner/manager surfaces usage through its
6543
- * result — the default `SubagentManager.wait` does not yet thread it, so this is
6544
- * `undefined` there until that port is extended.
6571
+ * TYPE-003). Present when the underlying runner reported it — `SubagentManager.wait` already
6572
+ * threads a completed job's `usage` straight through its result; this is `undefined` only when
6573
+ * the runner itself never reported any.
6545
6574
  */
6546
6575
  usage?: ITokenUsage;
6547
6576
  }
@@ -7356,7 +7385,7 @@ interface IAgentHookDefinition {
7356
7385
  * Guardrail hook (SELFHOST-005) — runs the registered guardrail SET in parallel and fails the turn
7357
7386
  * fast. The guardrail functions live in the `GuardrailExecutor` (registered by the consumer); this
7358
7387
  * data-only definition just selects which to run. Any failure maps onto the existing exit-code-2 /
7359
- * `blocked` contract, so enforcement reuses the single `runHooks` → `runPreToolHook` path.
7388
+ * `blocked` contract, so enforcement reuses the single `runHooks` → `runPreToolGate` path.
7360
7389
  */
7361
7390
  interface IGuardrailHookDefinition {
7362
7391
  type: 'guardrail';
@@ -7599,5 +7628,5 @@ declare function decodeHookVerdict(raw: string, source: THookDefinition['type'],
7599
7628
  /** Does a hook that reached no verdict block at this event? */
7600
7629
  declare function isEnforcing(event: THookEvent): boolean;
7601
7630
  //#endregion
7602
- export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CONFIRM_NO, CONFIRM_YES, CONTEXT_ESTIMATE_CHARS_PER_TOKEN, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_BACKGROUND_PERMISSION_POLICY, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DEFAULT_TOOL_RESULT_HARD_CHARS, DEFAULT_TOOL_RESULT_WARNING_CHARS, DEFERRED_WITHOUT_LOADER_MESSAGE, DefaultEventService, ENV_REFERENCE_PREFIX, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionJournalError, ExecutionProxy, ExecutionRecoveryError, ExecutionSuspendedError, FunctionTool, GuardrailExecutor, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IActionDefault, type IActionOption, type IActionRequest, type IAgent, type IAgentConfig, type IAgentCreationStats, type IAgentEventData, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IAssistantUsageMetadata, type IBaseEventData, type IBaseMessage, type IBoundedOutput, type IBoundedOutputOptions, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IContextOptions, type IContextTokenEstimate, type IContextTokenEstimateOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type ICredentialKey, type ICredentialStore, type ICriticalPathContext, type IDeferredToolCatalog, type IDestroyResult, type IDirent, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionContinuationState, type IExecutionEventData, type IExecutionJournal, type IExecutionProxyConfig, type IExecutionRoundCheckpoint, type IExecutor, IExecutorAwareProviderConfig, type IExecutorChatResult, type IExecutorStreamMessageEvent, type IExecutorStreamTerminalEvent, type IFileSystem, type IFileSystemAsync, type IFunctionTool, type IGroupChatOrchestrationSpec, type IGuardrailHookDefinition, type IGuardrailResult, type IHandoffOrchestrationSpec, type IHierarchicalOrchestrationSpec, type IHistoryEntry, type IHookGroup, type IHookInput, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type IJsonSchemaOutput, type ILocalExecutorConfig, ILogger, ILoggerOptions, IManagerLifecycleOptions, type IMediaOutputRef, type IMediaProviderConfig, type IMediaProviderCredentialRequirement, type IMediaProviderDefinition, type IMediaProviderOverrides, type IMessageTokenUsage, type IModelCapabilityDeviation, type IModelDefinition, type IModelEffortCapability, type IModelEffortOutcome, type IModelEffortResolution, type IModelFallbackNotice, type IModelJournalContext, type IModelPrice, type IModelRef, type IObjectParameterSchema, type IOpenAPIToolConfig, type IOrchestrationDelegation, type IOrchestrationEventData, type IOrchestrationRunResult, type IOrchestrationStep, type IOrchestrationStepResult, type IOutboundTraceContext, type IOwnerPathSegment, type IParallelOrchestrationSpec, type IParameterRule, type IParameterSchema, type IParameterValidationResult, type IPermissionEvaluationContext, type IPermissionLists, type IPermissionPatternProblem, type IPermissionPolicyContext, type IPermissionPolicyProjection, IPlatformShell, IPlatformShellResolutionRequest, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderCapabilities, type IProviderCapabilityTable, type IProviderCredentialRequirement, type IProviderDefinition, type IProviderDefinitionConfig, type IProviderEndpoint, type IProviderFailureClassification, IProviderFailureDetails, type IProviderFunctionCallingCapability, type IProviderMediaError, type IProviderModelCatalog, type IProviderModelCatalogEntry, type IProviderModelEffortTable, type IProviderNativeRawPayloadEvent, type IProviderNativeWebToolCapabilities, type IProviderNativeWebToolCapability, type IProviderNativeWebToolRequest, type IProviderOptions, type IProviderProbeResult, type IProviderProfileConfig, type IProviderProfileDefaults, type IProviderRequest, IProviderRuntimeConfig, type IProviderSetupHelpLink, type IProviderSetupStepDefinition, type IProviderSpecificOptions, type IProviderStructuredOutputCapability, type IRawProviderResponse, type IReadOnlyCommandContext, type IRecoverableExecutionJournal, type IRegistryOwnedLifecycle, type IRegistryTransactionError, type IRegistryTransactionStep, type IRemoteExecutorConfig, type IResponseFormatConfig, type IResumeExecutionOptions, type IResumeToolCallsOptions, type IResumeToolCallsResult, type IRunOptions, type IRunTraceContext, type ISchemaClosureChange, type ISchemaClosureOptions, type ISchemaConversionOptions, type ISequentialOrchestrationSpec, type ISession, type ISessionUsageTotals, ISimpleValidationResult, type ISpanCompletionEventData, type ISpinner, type IStats, type IStreamExecutionRequest, type IStreamingChunk, type IStructuredOutputResolutionInput, type IStructuredOutputSpec, type ISubprocessTraceEnv, type ISystemMessage, type ITemplateApplicationResult, type ITerminalOutput, type ITextMessagePart, type ITokenUsage, type ITokenUsageWithCacheRead, type ITool, type IToolActionIdentity, type IToolCall, type IToolContinuation, type IToolContinuationPrompt, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolPermissionArgument, type IToolPermissionProfile, type IToolRegistry, type IToolResult, type IToolResultAdmissionOptions, type IToolResultSpillStore, type IToolSchema, type IToolSchemaProjection, type IToolSchemaProjectionChange, type IToolSchemaProjectionProfile, type IToolWaitRequest, type IToolWaitResponse, type IToolWaitState, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserInteraction, type IUserMessage, IUtilLogEntry, type IVerifiedProviderCallUsage, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IZodParseResult, type IZodSchema, type IZodSchemaDef, InMemoryEventEmitterMetrics, LocalExecutor, MAX_TOOL_RESULT_CHARS, MODEL_EFFORT_VALUES, MODEL_PRICES, MessageConverter, ModelNotAvailableError, NetworkError, ORCHESTRATION_EVENTS, ORCHESTRATION_EVENT_PREFIX, ObservableEventService, PARAMETER_SCHEMA_KEYWORDS, PERMISSIVE_TOOL_SCHEMA_PROFILE, PROTECTED_DIRECTORY_NAMES, PROTECTED_FILE_NAMES, PROVIDER_CALL_EVENTS, PROVIDER_FALLBACK_EVENTS, PluginCategory, PluginError, PluginPriority, ProviderError, RISK_CLASS_POLICY, RateLimitError, Robota, RobotaError, SPAN_EVENTS, SPAN_EVENT_PREFIX, STRICT_TOOL_SCHEMA_PROFILE, SameToolInputLoopError, SilentLogger, StorageError, StructuredEventService, StructuredOutputError, TASK_EVENTS, TASK_EVENT_PREFIX, type TActionResponse, type TArgumentKind, type TBackgroundPermissionPolicy, TComplexConfigValue, TConfigData, TConfigValue, TContextData, type TConversationContextMetadata, type TEnvResolver, TErrorContextData, TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventCallback, type TExecutionEventData, type TExecutionEventName, type TExecutionJournalRecord, type TExecutionRecoveryErrorCode, type TExecutorStreamEvent, type TGuardrail, type THookDefinition, type THookEvent, type THookOutcome, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TJournalModelOptions, TLoggerData, type TManagerToolParameters, type TMatchDirection, TMessageConverterRegistry, TMessageFormatConverter, type TMessageState, TMetadata, TMetadataValue, type TModelEffort, type TModelEffortDisposition, type TModelEffortNativeControl, type TModelEffortOutcomeCallback, type TModelEffortProviderDispatch, type TModelEffortSelection, type TModelFallbackCallback, TOOL_BODY_EVENTS, TOOL_EVENTS, TOOL_EVENT_PREFIX, TOOL_PERMISSION_EVENTS, TOOL_SCHEMA_PROJECTION_MAX_DEPTH, TOOL_SCHEMA_PROJECTION_MAX_NODES, TOOL_SEARCH_TOOL_NAME, type TOrchestrationEvent, type TOrchestrationPrimitive, type TOutputRetention, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderCredentialField, type TProviderFailureReason, TProviderLoggingData, type TProviderMediaResult, TProviderMessage, type TProviderModelCapability, type TProviderModelCatalogStatus, type TProviderModelLifecycle, type TProviderNativeRawPayload, type TProviderNativeRawPayloadCallback, type TProviderNativeRawPayloadKind, type TProviderOptionValueBase, type TProviderSetupField, type TProviderSetupHelpLinkKind, type TProviderUsageProvenance, TRUST_TO_MODE, type TResolveInWorkspace, type TResponseMetadata, type TRoleModelMap, type TSessionEndReason, TShellKind, type TSpanEvent, type TStructuredOutputMechanism, type TStructuredOutputProvenance, type TStructuredOutputSchema, type TStructuredOutputValidation, type TSubprocessTraceClass, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolChoice, type TToolEffectAdmission, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, TToolParameters, type TToolProgressCallback, type TToolResultAdmissionErrorCode, type TToolRiskClass, type TToolSchemaProjectionOutcome, type TToolSchemaProjectionProfileBase, type TToolSearchMode, type TToolSearchSetting, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, TUtilLogLevel, ToolExecutionError, ToolRegistry, ToolResultAdmissionError, TypeUtils, UNCLASSIFIED_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, UnsupportedShellError, ValidationError, Validator, admitToolResult, allowRulesForAutoMode, applyPresetToolLists, assertProviderNativeWebToolsAvailable, assertResidentToolRemains, bindEventServiceOwner, bindWithOwnerPath, buildTraceparent, calculateModelCost, callJournaledProvider, chatEntryToMessage, classifyProviderFailure, clearRegisteredToolProfiles, closeObjectSchemas, collectAssistantUsageMetadata, composeEventName, confirmAction, createAssistantMessage, createBoundedOutput, createDefaultProviderCapabilities, createExecutionProxy, createImageProviderFromDefinition, createLogger, createModelEffortOutcome, createProviderFromConfig, createRecordEnvResolver, createSystemMessage, createToolMessage, createUserMessage, createVideoProviderFromDefinition, decodeHookVerdict, estimateBlendedCostPer1000, estimateContextTokensFromMessages, estimateSerializedContextTokens, estimateToolSchemaTokens, evaluatePermission, extractEnumValues, findInvalidPermissionPatterns, findMediaProviderDefinition, findModelDefinition, findPermissionPatternWarnings, findProviderDefinition, formatEnvReference, formatSupportedProviderTypes, formatTokenCount, generateSpanId, getGlobalLogLevel, getGlobalLoggerSink, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getProviderCapabilities, getProviderCredentialRequirement, getSchemaTypeName, getToolEstimatedDuration, getToolExecutionSteps, getToolPermissionProfile, hasUsableSecretReference, hasValidationConstraints, hashToolSchema, isAbortFailure, isAssistantMessage, isBroadExecutionAllowRule, isChatEntry, isConfirmed, isDefaultEventService, isEnforcing, isEnvReference, isExecutionControlError, isImageGenerationProvider, isMediaProviderDefinition, isMintedSpanId, isModelEffort, isProgressReportingTool, isProtectedPath, isReadOnlyCommandLine, isRegistryTransactionError, isSystemMessage, isToolDeniedOutright, isToolMessage, isUserMessage, isVideoGenerationProvider, lifecycleOf, logger, lookupModelPrice, matchesAnyPattern, messageToHistoryEntry, modelDeclaresCapability, multiSelectAction, normalizeProviderConfig, normalizeStructuredOutput, outboundTraceContextFor, parseParameterRule, parseStructuredResponseText, peerDriverOf, printablePeerDriver, processEnvResolver, projectPermissionPolicy, projectToolSchema, providerCallSpanId, readModelFallbackNotice, readProviderFailureDetails, readTokenUsageFromMessage, readTokenUsageFromMetadata, registerModelMetadata, registerToolPermissionProfile, removesCriticalPath, requiresFreshApproval, resolveEnvReference, resolveMediaProviderConfig, resolveModelCapabilities, resolveModelCapability, resolveModelEffort, resolvePlatformShell, resolveStructuredOutputCapability, runHooks, runRegistryTransaction, scrubSecrets, selectAction, setGlobalLogLevel, setGlobalLoggerSink, setToolProgressCallback, shellArgumentForDisplay, spanIdFromMintedId, splitCommandSegments, startPeriodicTask, stopPeriodicTask, subprocessTraceEnvironment, sumHistoryUsage, sumMessagesUsage, textAction, toProviderError, toolNameMatches, toolNamesToPatterns, toolTraceContextFor, traceEnvFor, traceHeadersFor, validateAgainstJsonSchema, validateAgentConfig, validateApiKey, validateModelName, validatePermissionPattern, validateProviderName, validateUserInput, verifiedProviderCallUsage, wasToolResultAdmitted, withEventEmission, zodToJsonSchema };
7631
+ export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CONFIRM_NO, CONFIRM_YES, CONTEXT_ESTIMATE_CHARS_PER_TOKEN, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_BACKGROUND_PERMISSION_POLICY, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DEFAULT_TOOL_RESULT_HARD_CHARS, DEFAULT_TOOL_RESULT_WARNING_CHARS, DEFERRED_WITHOUT_LOADER_MESSAGE, DefaultEventService, ENV_REFERENCE_PREFIX, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, EmptyCompletionError, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionJournalError, ExecutionProxy, ExecutionRecoveryError, ExecutionSuspendedError, FunctionTool, GuardrailExecutor, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IActionDefault, type IActionOption, type IActionRequest, type IAgent, type IAgentConfig, type IAgentCreationStats, type IAgentEventData, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IAssistantUsageMetadata, type IBaseEventData, type IBaseMessage, type IBoundedOutput, type IBoundedOutputOptions, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IContextOptions, type IContextTokenEstimate, type IContextTokenEstimateOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type ICredentialKey, type ICredentialStore, type ICriticalPathContext, type IDeferredToolCatalog, type IDestroyResult, type IDirent, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionContinuationState, type IExecutionEventData, type IExecutionJournal, type IExecutionProxyConfig, type IExecutionRoundCheckpoint, type IExecutor, IExecutorAwareProviderConfig, type IExecutorChatResult, type IExecutorStreamMessageEvent, type IExecutorStreamTerminalEvent, type IFileSystem, type IFileSystemAsync, type IFunctionTool, type IGroupChatOrchestrationSpec, type IGuardrailHookDefinition, type IGuardrailResult, type IHandoffOrchestrationSpec, type IHierarchicalOrchestrationSpec, type IHistoryEntry, type IHookGroup, type IHookInput, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type IJsonSchemaOutput, type ILocalExecutorConfig, ILogger, ILoggerOptions, IManagerLifecycleOptions, type IMediaOutputRef, type IMediaProviderConfig, type IMediaProviderCredentialRequirement, type IMediaProviderDefinition, type IMediaProviderOverrides, type IMessageTokenUsage, type IModelCapabilityDeviation, type IModelDefinition, type IModelEffortCapability, type IModelEffortOutcome, type IModelEffortResolution, type IModelFallbackNotice, type IModelJournalContext, type IModelPrice, type IModelRef, type IObjectParameterSchema, type IOpenAPIToolConfig, type IOrchestrationDelegation, type IOrchestrationEventData, type IOrchestrationRunResult, type IOrchestrationStep, type IOrchestrationStepResult, type IOutboundTraceContext, type IOwnerPathSegment, type IParallelOrchestrationSpec, type IParameterRule, type IParameterSchema, type IParameterValidationResult, type IPermissionEvaluationContext, type IPermissionLists, type IPermissionPatternProblem, type IPermissionPolicyContext, type IPermissionPolicyProjection, IPlatformShell, IPlatformShellResolutionRequest, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderCapabilities, type IProviderCapabilityTable, type IProviderCredentialRequirement, type IProviderDefinition, type IProviderDefinitionConfig, type IProviderEndpoint, type IProviderFailureClassification, IProviderFailureDetails, type IProviderFunctionCallingCapability, type IProviderMediaError, type IProviderModelCatalog, type IProviderModelCatalogEntry, type IProviderModelEffortTable, type IProviderNativeRawPayloadEvent, type IProviderNativeWebToolCapabilities, type IProviderNativeWebToolCapability, type IProviderNativeWebToolRequest, type IProviderOptions, type IProviderProbeResult, type IProviderProfileConfig, type IProviderProfileDefaults, type IProviderRequest, IProviderRuntimeConfig, type IProviderSetupHelpLink, type IProviderSetupStepDefinition, type IProviderSpecificOptions, type IProviderStructuredOutputCapability, type IRawProviderResponse, type IReadOnlyCommandContext, type IRecoverableExecutionJournal, type IRegistryOwnedLifecycle, type IRegistryTransactionError, type IRegistryTransactionStep, type IRemoteExecutorConfig, type IResponseFormatConfig, type IResumeExecutionOptions, type IResumeToolCallsOptions, type IResumeToolCallsResult, type IRunOptions, type IRunTraceContext, type ISchemaClosureChange, type ISchemaClosureOptions, type ISchemaConversionOptions, type ISequentialOrchestrationSpec, type ISession, type ISessionUsageTotals, ISimpleValidationResult, type ISpanCompletionEventData, type ISpinner, type IStats, type IStreamExecutionRequest, type IStreamingChunk, type IStructuredOutputResolutionInput, type IStructuredOutputSpec, type ISubprocessTraceEnv, type ISystemMessage, type ITemplateApplicationResult, type ITerminalOutput, type ITextMessagePart, type ITokenUsage, type ITokenUsageWithCacheRead, type ITool, type IToolActionIdentity, type IToolCall, type IToolContinuation, type IToolContinuationPrompt, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolPermissionArgument, type IToolPermissionProfile, type IToolRegistry, type IToolResult, type IToolResultAdmissionOptions, type IToolResultSpillStore, type IToolSchema, type IToolSchemaProjection, type IToolSchemaProjectionChange, type IToolSchemaProjectionProfile, type IToolWaitRequest, type IToolWaitResponse, type IToolWaitState, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserInteraction, type IUserMessage, IUtilLogEntry, type IVerifiedProviderCallUsage, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IZodParseResult, type IZodSchema, type IZodSchemaDef, InMemoryEventEmitterMetrics, LocalExecutor, MAX_TOOL_RESULT_CHARS, MODEL_EFFORT_VALUES, MODEL_PRICES, MessageConverter, ModelNotAvailableError, NetworkError, ORCHESTRATION_EVENTS, ORCHESTRATION_EVENT_PREFIX, ObservableEventService, PARAMETER_SCHEMA_KEYWORDS, PERMISSIVE_TOOL_SCHEMA_PROFILE, PROTECTED_DIRECTORY_NAMES, PROTECTED_FILE_NAMES, PROVIDER_CALL_EVENTS, PROVIDER_FALLBACK_EVENTS, PluginCategory, PluginError, PluginPriority, ProviderError, RISK_CLASS_POLICY, RateLimitError, Robota, RobotaError, SPAN_EVENTS, SPAN_EVENT_PREFIX, STRICT_TOOL_SCHEMA_PROFILE, SameToolInputLoopError, SilentLogger, StorageError, StructuredEventService, StructuredOutputError, TASK_EVENTS, TASK_EVENT_PREFIX, type TActionResponse, type TArgumentKind, type TBackgroundPermissionPolicy, TComplexConfigValue, TConfigData, TConfigValue, TContextData, type TConversationContextMetadata, type TEnvResolver, TErrorContextData, TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventCallback, type TExecutionEventData, type TExecutionEventName, type TExecutionJournalRecord, type TExecutionRecoveryErrorCode, type TExecutorStreamEvent, type TGuardrail, type THookDefinition, type THookEvent, type THookOutcome, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TJournalModelOptions, TLoggerData, type TManagerToolParameters, type TMatchDirection, TMessageConverterRegistry, TMessageFormatConverter, type TMessageState, TMetadata, TMetadataValue, type TModelEffort, type TModelEffortDisposition, type TModelEffortNativeControl, type TModelEffortOutcomeCallback, type TModelEffortProviderDispatch, type TModelEffortSelection, type TModelFallbackCallback, TOOL_BODY_EVENTS, TOOL_EVENTS, TOOL_EVENT_PREFIX, TOOL_PERMISSION_EVENTS, TOOL_SCHEMA_PROJECTION_MAX_DEPTH, TOOL_SCHEMA_PROJECTION_MAX_NODES, TOOL_SEARCH_TOOL_NAME, type TOrchestrationEvent, type TOrchestrationPrimitive, type TOutputRetention, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderCredentialField, type TProviderFailureReason, TProviderLoggingData, type TProviderMediaResult, TProviderMessage, type TProviderModelCapability, type TProviderModelCatalogStatus, type TProviderModelLifecycle, type TProviderNativeRawPayload, type TProviderNativeRawPayloadCallback, type TProviderNativeRawPayloadKind, type TProviderOptionValueBase, type TProviderSetupField, type TProviderSetupHelpLinkKind, type TProviderUsageProvenance, TRUST_TO_MODE, type TResolveInWorkspace, type TResponseMetadata, type TRoleModelMap, type TSessionEndReason, TShellKind, type TSpanEvent, type TStructuredOutputMechanism, type TStructuredOutputProvenance, type TStructuredOutputSchema, type TStructuredOutputValidation, type TSubprocessTraceClass, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolChoice, type TToolEffectAdmission, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, TToolParameters, type TToolProgressCallback, type TToolResultAdmissionErrorCode, type TToolRiskClass, type TToolSchemaProjectionOutcome, type TToolSchemaProjectionProfileBase, type TToolSearchMode, type TToolSearchSetting, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, TUtilLogLevel, ToolExecutionError, ToolRegistry, ToolResultAdmissionError, TypeUtils, UNCLASSIFIED_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, UnsupportedShellError, ValidationError, Validator, admitToolResult, allowRulesForAutoMode, applyPresetToolLists, assertProviderNativeWebToolsAvailable, assertResidentToolRemains, bindEventServiceOwner, bindWithOwnerPath, buildTraceparent, calculateModelCost, callJournaledProvider, chatEntryToMessage, classifyProviderFailure, clearRegisteredToolProfiles, closeObjectSchemas, collectAssistantUsageMetadata, composeEventName, confirmAction, createAssistantMessage, createBoundedOutput, createDefaultProviderCapabilities, createExecutionProxy, createImageProviderFromDefinition, createLogger, createModelEffortOutcome, createProviderFromConfig, createRecordEnvResolver, createSystemMessage, createToolMessage, createUserMessage, createVideoProviderFromDefinition, decodeHookVerdict, estimateBlendedCostPer1000, estimateContextTokensFromMessages, estimateSerializedContextTokens, estimateToolSchemaTokens, evaluatePermission, extractEnumValues, findInvalidPermissionPatterns, findMediaProviderDefinition, findModelDefinition, findPermissionPatternWarnings, findProviderDefinition, formatEnvReference, formatSupportedProviderTypes, formatTokenCount, generateSpanId, getGlobalLogLevel, getGlobalLoggerSink, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getProviderCapabilities, getProviderCredentialRequirement, getSchemaTypeName, getToolEstimatedDuration, getToolExecutionSteps, getToolPermissionProfile, hasUsableSecretReference, hasValidationConstraints, hashToolSchema, isAbortFailure, isAssistantMessage, isBroadExecutionAllowRule, isChatEntry, isConfirmed, isDefaultEventService, isEnforcing, isEnvReference, isExecutionControlError, isImageGenerationProvider, isMediaProviderDefinition, isMintedSpanId, isModelEffort, isProgressReportingTool, isProtectedPath, isReadOnlyCommandLine, isRegistryTransactionError, isSystemMessage, isToolDeniedOutright, isToolMessage, isUserMessage, isVideoGenerationProvider, lifecycleOf, logger, lookupModelPrice, matchesAnyPattern, messageToHistoryEntry, modelDeclaresCapability, multiSelectAction, normalizeProviderConfig, normalizeStructuredOutput, outboundTraceContextFor, parseParameterRule, parseStructuredResponseText, peerDriverOf, printablePeerDriver, processEnvResolver, projectPermissionPolicy, projectToolSchema, providerCallSpanId, readModelFallbackNotice, readProviderFailureDetails, readTokenUsageFromMessage, readTokenUsageFromMetadata, registerModelMetadata, registerToolPermissionProfile, removesCriticalPath, requiresFreshApproval, resolveEnvReference, resolveMediaProviderConfig, resolveModelCapabilities, resolveModelCapability, resolveModelEffort, resolvePlatformShell, resolveStructuredOutputCapability, runHooks, runRegistryTransaction, scrubSecrets, selectAction, setGlobalLogLevel, setGlobalLoggerSink, setToolProgressCallback, shellArgumentForDisplay, spanIdFromMintedId, splitCommandSegments, startPeriodicTask, stopPeriodicTask, subprocessTraceEnvironment, sumHistoryUsage, sumMessagesUsage, textAction, toProviderError, toolNameMatches, toolNamesToPatterns, toolTraceContextFor, traceEnvFor, traceHeadersFor, validateAgainstJsonSchema, validateAgentConfig, validateApiKey, validateModelName, validatePermissionPattern, validateProviderName, validateUserInput, verifiedProviderCallUsage, wasToolResultAdmitted, withEventEmission, zodToJsonSchema };
7603
7632
  //# sourceMappingURL=index.d.ts.map