@librechat/agents 3.1.67 → 3.1.68-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cjs/agents/AgentContext.cjs +23 -3
  2. package/dist/cjs/agents/AgentContext.cjs.map +1 -1
  3. package/dist/cjs/common/enum.cjs +16 -1
  4. package/dist/cjs/common/enum.cjs.map +1 -1
  5. package/dist/cjs/graphs/Graph.cjs +91 -0
  6. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  7. package/dist/cjs/graphs/MultiAgentGraph.cjs +36 -0
  8. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
  9. package/dist/cjs/hooks/HookRegistry.cjs +162 -0
  10. package/dist/cjs/hooks/HookRegistry.cjs.map +1 -0
  11. package/dist/cjs/hooks/executeHooks.cjs +276 -0
  12. package/dist/cjs/hooks/executeHooks.cjs.map +1 -0
  13. package/dist/cjs/hooks/matchers.cjs +256 -0
  14. package/dist/cjs/hooks/matchers.cjs.map +1 -0
  15. package/dist/cjs/hooks/types.cjs +27 -0
  16. package/dist/cjs/hooks/types.cjs.map +1 -0
  17. package/dist/cjs/main.cjs +54 -0
  18. package/dist/cjs/main.cjs.map +1 -1
  19. package/dist/cjs/messages/format.cjs +74 -12
  20. package/dist/cjs/messages/format.cjs.map +1 -1
  21. package/dist/cjs/run.cjs +111 -0
  22. package/dist/cjs/run.cjs.map +1 -1
  23. package/dist/cjs/summarization/index.cjs +41 -0
  24. package/dist/cjs/summarization/index.cjs.map +1 -1
  25. package/dist/cjs/summarization/node.cjs +165 -19
  26. package/dist/cjs/summarization/node.cjs.map +1 -1
  27. package/dist/cjs/tools/BashExecutor.cjs +165 -0
  28. package/dist/cjs/tools/BashExecutor.cjs.map +1 -0
  29. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +287 -0
  30. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -0
  31. package/dist/cjs/tools/CodeExecutor.cjs +0 -9
  32. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  33. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +7 -23
  34. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  35. package/dist/cjs/tools/ReadFile.cjs +43 -0
  36. package/dist/cjs/tools/ReadFile.cjs.map +1 -0
  37. package/dist/cjs/tools/SkillTool.cjs +50 -0
  38. package/dist/cjs/tools/SkillTool.cjs.map +1 -0
  39. package/dist/cjs/tools/SubagentTool.cjs +92 -0
  40. package/dist/cjs/tools/SubagentTool.cjs.map +1 -0
  41. package/dist/cjs/tools/ToolNode.cjs +304 -140
  42. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  43. package/dist/cjs/tools/ToolSearch.cjs +2 -13
  44. package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
  45. package/dist/cjs/tools/skillCatalog.cjs +84 -0
  46. package/dist/cjs/tools/skillCatalog.cjs.map +1 -0
  47. package/dist/cjs/tools/subagent/SubagentExecutor.cjs +511 -0
  48. package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -0
  49. package/dist/esm/agents/AgentContext.mjs +23 -3
  50. package/dist/esm/agents/AgentContext.mjs.map +1 -1
  51. package/dist/esm/common/enum.mjs +15 -2
  52. package/dist/esm/common/enum.mjs.map +1 -1
  53. package/dist/esm/graphs/Graph.mjs +91 -0
  54. package/dist/esm/graphs/Graph.mjs.map +1 -1
  55. package/dist/esm/graphs/MultiAgentGraph.mjs +36 -0
  56. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
  57. package/dist/esm/hooks/HookRegistry.mjs +160 -0
  58. package/dist/esm/hooks/HookRegistry.mjs.map +1 -0
  59. package/dist/esm/hooks/executeHooks.mjs +273 -0
  60. package/dist/esm/hooks/executeHooks.mjs.map +1 -0
  61. package/dist/esm/hooks/matchers.mjs +251 -0
  62. package/dist/esm/hooks/matchers.mjs.map +1 -0
  63. package/dist/esm/hooks/types.mjs +25 -0
  64. package/dist/esm/hooks/types.mjs.map +1 -0
  65. package/dist/esm/main.mjs +13 -2
  66. package/dist/esm/main.mjs.map +1 -1
  67. package/dist/esm/messages/format.mjs +66 -4
  68. package/dist/esm/messages/format.mjs.map +1 -1
  69. package/dist/esm/run.mjs +111 -0
  70. package/dist/esm/run.mjs.map +1 -1
  71. package/dist/esm/summarization/index.mjs +41 -1
  72. package/dist/esm/summarization/index.mjs.map +1 -1
  73. package/dist/esm/summarization/node.mjs +165 -19
  74. package/dist/esm/summarization/node.mjs.map +1 -1
  75. package/dist/esm/tools/BashExecutor.mjs +159 -0
  76. package/dist/esm/tools/BashExecutor.mjs.map +1 -0
  77. package/dist/esm/tools/BashProgrammaticToolCalling.mjs +278 -0
  78. package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -0
  79. package/dist/esm/tools/CodeExecutor.mjs +0 -9
  80. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  81. package/dist/esm/tools/ProgrammaticToolCalling.mjs +8 -24
  82. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  83. package/dist/esm/tools/ReadFile.mjs +38 -0
  84. package/dist/esm/tools/ReadFile.mjs.map +1 -0
  85. package/dist/esm/tools/SkillTool.mjs +45 -0
  86. package/dist/esm/tools/SkillTool.mjs.map +1 -0
  87. package/dist/esm/tools/SubagentTool.mjs +85 -0
  88. package/dist/esm/tools/SubagentTool.mjs.map +1 -0
  89. package/dist/esm/tools/ToolNode.mjs +306 -142
  90. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  91. package/dist/esm/tools/ToolSearch.mjs +3 -14
  92. package/dist/esm/tools/ToolSearch.mjs.map +1 -1
  93. package/dist/esm/tools/skillCatalog.mjs +82 -0
  94. package/dist/esm/tools/skillCatalog.mjs.map +1 -0
  95. package/dist/esm/tools/subagent/SubagentExecutor.mjs +505 -0
  96. package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -0
  97. package/dist/types/agents/AgentContext.d.ts +6 -0
  98. package/dist/types/common/enum.d.ts +10 -2
  99. package/dist/types/graphs/Graph.d.ts +2 -0
  100. package/dist/types/graphs/MultiAgentGraph.d.ts +12 -0
  101. package/dist/types/hooks/HookRegistry.d.ts +56 -0
  102. package/dist/types/hooks/executeHooks.d.ts +79 -0
  103. package/dist/types/hooks/index.d.ts +6 -0
  104. package/dist/types/hooks/matchers.d.ts +95 -0
  105. package/dist/types/hooks/types.d.ts +320 -0
  106. package/dist/types/index.d.ts +8 -0
  107. package/dist/types/messages/format.d.ts +2 -1
  108. package/dist/types/run.d.ts +1 -0
  109. package/dist/types/summarization/index.d.ts +2 -0
  110. package/dist/types/summarization/node.d.ts +2 -0
  111. package/dist/types/tools/BashExecutor.d.ts +45 -0
  112. package/dist/types/tools/BashProgrammaticToolCalling.d.ts +72 -0
  113. package/dist/types/tools/ProgrammaticToolCalling.d.ts +4 -9
  114. package/dist/types/tools/ReadFile.d.ts +28 -0
  115. package/dist/types/tools/SkillTool.d.ts +40 -0
  116. package/dist/types/tools/SubagentTool.d.ts +36 -0
  117. package/dist/types/tools/ToolNode.d.ts +24 -2
  118. package/dist/types/tools/ToolSearch.d.ts +2 -2
  119. package/dist/types/tools/skillCatalog.d.ts +19 -0
  120. package/dist/types/tools/subagent/SubagentExecutor.d.ts +137 -0
  121. package/dist/types/tools/subagent/index.d.ts +2 -0
  122. package/dist/types/types/graph.d.ts +61 -2
  123. package/dist/types/types/index.d.ts +1 -0
  124. package/dist/types/types/run.d.ts +20 -0
  125. package/dist/types/types/skill.d.ts +9 -0
  126. package/dist/types/types/tools.d.ts +38 -10
  127. package/package.json +5 -1
  128. package/src/agents/AgentContext.ts +26 -2
  129. package/src/common/enum.ts +15 -1
  130. package/src/graphs/Graph.ts +113 -0
  131. package/src/graphs/MultiAgentGraph.ts +39 -0
  132. package/src/graphs/__tests__/MultiAgentGraph.test.ts +91 -0
  133. package/src/hooks/HookRegistry.ts +208 -0
  134. package/src/hooks/__tests__/HookRegistry.test.ts +190 -0
  135. package/src/hooks/__tests__/compactHooks.test.ts +214 -0
  136. package/src/hooks/__tests__/executeHooks.test.ts +1013 -0
  137. package/src/hooks/__tests__/integration.test.ts +337 -0
  138. package/src/hooks/__tests__/matchers.test.ts +238 -0
  139. package/src/hooks/__tests__/toolHooks.test.ts +669 -0
  140. package/src/hooks/executeHooks.ts +375 -0
  141. package/src/hooks/index.ts +57 -0
  142. package/src/hooks/matchers.ts +280 -0
  143. package/src/hooks/types.ts +404 -0
  144. package/src/index.ts +10 -0
  145. package/src/messages/format.ts +74 -4
  146. package/src/messages/formatAgentMessages.skills.test.ts +334 -0
  147. package/src/run.ts +126 -0
  148. package/src/scripts/multi-agent-subagent.ts +246 -0
  149. package/src/scripts/programmatic_exec.ts +1 -10
  150. package/src/scripts/subagent-event-driven-debug.ts +190 -0
  151. package/src/scripts/subagent-tools-debug.ts +160 -0
  152. package/src/scripts/test_code_api.ts +0 -7
  153. package/src/scripts/tool_search.ts +1 -10
  154. package/src/specs/subagent.test.ts +305 -0
  155. package/src/summarization/__tests__/node.test.ts +42 -0
  156. package/src/summarization/__tests__/trigger.test.ts +100 -1
  157. package/src/summarization/index.ts +47 -0
  158. package/src/summarization/node.ts +202 -24
  159. package/src/tools/BashExecutor.ts +193 -0
  160. package/src/tools/BashProgrammaticToolCalling.ts +381 -0
  161. package/src/tools/CodeExecutor.ts +0 -11
  162. package/src/tools/ProgrammaticToolCalling.ts +4 -29
  163. package/src/tools/ReadFile.ts +39 -0
  164. package/src/tools/SkillTool.ts +46 -0
  165. package/src/tools/SubagentTool.ts +100 -0
  166. package/src/tools/ToolNode.ts +391 -169
  167. package/src/tools/ToolSearch.ts +3 -19
  168. package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.ts +7 -8
  169. package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -1
  170. package/src/tools/__tests__/ReadFile.test.ts +44 -0
  171. package/src/tools/__tests__/SkillTool.test.ts +442 -0
  172. package/src/tools/__tests__/SubagentExecutor.test.ts +1148 -0
  173. package/src/tools/__tests__/SubagentTool.test.ts +149 -0
  174. package/src/tools/__tests__/ToolNode.session.test.ts +12 -12
  175. package/src/tools/__tests__/ToolSearch.integration.test.ts +7 -8
  176. package/src/tools/__tests__/skillCatalog.test.ts +161 -0
  177. package/src/tools/__tests__/subagentHooks.test.ts +215 -0
  178. package/src/tools/skillCatalog.ts +126 -0
  179. package/src/tools/subagent/SubagentExecutor.ts +676 -0
  180. package/src/tools/subagent/index.ts +13 -0
  181. package/src/types/graph.ts +80 -1
  182. package/src/types/index.ts +1 -0
  183. package/src/types/run.ts +20 -0
  184. package/src/types/skill.ts +11 -0
  185. package/src/types/tools.ts +41 -10
@@ -0,0 +1,320 @@
1
+ import type { BaseMessage } from '@langchain/core/messages';
2
+ /**
3
+ * Closed set of hook lifecycle events supported by the hooks system.
4
+ *
5
+ * These mirror the subset of Claude Code's event surface that makes sense
6
+ * for a library context (no filesystem/CLI-specific events). See
7
+ * `docs/hooks-design-report.md` §3.2 for the mapping to existing
8
+ * `@librechat/agents` emission points.
9
+ */
10
+ export declare const HOOK_EVENTS: readonly ["RunStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PermissionDenied", "SubagentStart", "SubagentStop", "Stop", "StopFailure", "PreCompact", "PostCompact"];
11
+ export type HookEvent = (typeof HOOK_EVENTS)[number];
12
+ /** Tool-gating decision; executeHooks folds with `deny > ask > allow` precedence. */
13
+ export type ToolDecision = 'allow' | 'deny' | 'ask';
14
+ /** Stop-loop decision; `block` means "do not stop, run another turn". Any `block` wins. */
15
+ export type StopDecision = 'continue' | 'block';
16
+ /**
17
+ * Fields shared by every `HookInput`. Discriminated by `hook_event_name`.
18
+ *
19
+ * - `runId` identifies the current agent run and is always present.
20
+ * - `threadId` identifies the conversation thread when the host has one.
21
+ * - `agentId` is only set when the hook fires inside a subagent scope.
22
+ */
23
+ export interface BaseHookInput {
24
+ runId: string;
25
+ threadId?: string;
26
+ agentId?: string;
27
+ }
28
+ export interface RunStartHookInput extends BaseHookInput {
29
+ hook_event_name: 'RunStart';
30
+ messages: BaseMessage[];
31
+ }
32
+ export interface UserPromptSubmitHookInput extends BaseHookInput {
33
+ hook_event_name: 'UserPromptSubmit';
34
+ prompt: string;
35
+ attachments?: BaseMessage[];
36
+ }
37
+ /**
38
+ * Fires before a tool is invoked. Hook may return `deny`/`ask`/`allow` and/or
39
+ * an `updatedInput` that replaces the tool arguments before invocation.
40
+ *
41
+ * `toolInput` is intentionally typed as `Record<string, unknown>` because the
42
+ * SDK is tool-agnostic — concrete tool argument shapes are only known at the
43
+ * call site and are narrowed by the host. This is the one escape hatch in
44
+ * the hook type system.
45
+ */
46
+ export interface PreToolUseHookInput extends BaseHookInput {
47
+ hook_event_name: 'PreToolUse';
48
+ toolName: string;
49
+ toolInput: Record<string, unknown>;
50
+ toolUseId: string;
51
+ stepId?: string;
52
+ /**
53
+ * Number of times this tool has been invoked in prior batches within the
54
+ * current run. Within a single batch of parallel calls, all calls to the
55
+ * same tool share the same turn value — per-call discrimination within a
56
+ * batch is not supported in v1.
57
+ */
58
+ turn?: number;
59
+ }
60
+ export interface PostToolUseHookInput extends BaseHookInput {
61
+ hook_event_name: 'PostToolUse';
62
+ toolName: string;
63
+ toolInput: Record<string, unknown>;
64
+ toolOutput: unknown;
65
+ toolUseId: string;
66
+ stepId?: string;
67
+ turn?: number;
68
+ }
69
+ export interface PostToolUseFailureHookInput extends BaseHookInput {
70
+ hook_event_name: 'PostToolUseFailure';
71
+ toolName: string;
72
+ toolInput: Record<string, unknown>;
73
+ toolUseId: string;
74
+ error: string;
75
+ stepId?: string;
76
+ turn?: number;
77
+ }
78
+ export interface PermissionDeniedHookInput extends BaseHookInput {
79
+ hook_event_name: 'PermissionDenied';
80
+ toolName: string;
81
+ toolInput: Record<string, unknown>;
82
+ toolUseId: string;
83
+ reason: string;
84
+ }
85
+ export interface SubagentStartHookInput extends BaseHookInput {
86
+ hook_event_name: 'SubagentStart';
87
+ parentAgentId?: string;
88
+ agentId: string;
89
+ agentType: string;
90
+ inputs: BaseMessage[];
91
+ }
92
+ export interface SubagentStopHookInput extends BaseHookInput {
93
+ hook_event_name: 'SubagentStop';
94
+ agentId: string;
95
+ agentType: string;
96
+ messages: BaseMessage[];
97
+ }
98
+ export interface StopHookInput extends BaseHookInput {
99
+ hook_event_name: 'Stop';
100
+ messages: BaseMessage[];
101
+ stopReason?: string;
102
+ stopHookActive: boolean;
103
+ }
104
+ export interface StopFailureHookInput extends BaseHookInput {
105
+ hook_event_name: 'StopFailure';
106
+ error: string;
107
+ lastAssistantMessage?: BaseMessage;
108
+ }
109
+ export interface PreCompactHookInput extends BaseHookInput {
110
+ hook_event_name: 'PreCompact';
111
+ messagesBeforeCount: number;
112
+ /**
113
+ * What triggered compaction. Matches `SummarizationTrigger.type` from the
114
+ * agent's summarization config. `'default'` means no trigger was
115
+ * configured and compaction fired because messages were pruned.
116
+ */
117
+ trigger: 'token_ratio' | 'remaining_tokens' | 'messages_to_refine' | 'default' | (string & {});
118
+ }
119
+ export interface PostCompactHookInput extends BaseHookInput {
120
+ hook_event_name: 'PostCompact';
121
+ summary: string;
122
+ /**
123
+ * Number of messages remaining after compaction. The summarize node
124
+ * returns a `removeAll` signal that clears all messages from state;
125
+ * the summary itself is injected into the system prompt, not as a
126
+ * message. This is `0` at the point of hook dispatch.
127
+ */
128
+ messagesAfterCount: number;
129
+ }
130
+ /** Discriminated union of every hook input shape. */
131
+ export type HookInput = RunStartHookInput | UserPromptSubmitHookInput | PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PermissionDeniedHookInput | SubagentStartHookInput | SubagentStopHookInput | StopHookInput | StopFailureHookInput | PreCompactHookInput | PostCompactHookInput;
132
+ /** Compile-time map from event name to its input shape. */
133
+ export type HookInputByEvent = {
134
+ RunStart: RunStartHookInput;
135
+ UserPromptSubmit: UserPromptSubmitHookInput;
136
+ PreToolUse: PreToolUseHookInput;
137
+ PostToolUse: PostToolUseHookInput;
138
+ PostToolUseFailure: PostToolUseFailureHookInput;
139
+ PermissionDenied: PermissionDeniedHookInput;
140
+ SubagentStart: SubagentStartHookInput;
141
+ SubagentStop: SubagentStopHookInput;
142
+ Stop: StopHookInput;
143
+ StopFailure: StopFailureHookInput;
144
+ PreCompact: PreCompactHookInput;
145
+ PostCompact: PostCompactHookInput;
146
+ };
147
+ /**
148
+ * Fields common to every hook output. Hooks that have nothing to say simply
149
+ * return `{}` (or omit the fields below).
150
+ */
151
+ export interface BaseHookOutput {
152
+ /** Context string to inject into the conversation. Accumulated across hooks. */
153
+ additionalContext?: string;
154
+ /** True to prevent the next model turn. Any hook can set this. */
155
+ preventContinuation?: boolean;
156
+ /** Reason reported alongside `preventContinuation`. */
157
+ stopReason?: string;
158
+ }
159
+ export type RunStartHookOutput = BaseHookOutput;
160
+ export interface UserPromptSubmitHookOutput extends BaseHookOutput {
161
+ decision?: ToolDecision;
162
+ reason?: string;
163
+ }
164
+ export interface PreToolUseHookOutput extends BaseHookOutput {
165
+ decision?: ToolDecision;
166
+ reason?: string;
167
+ /**
168
+ * Replacement tool input. Merged into the pending tool call by the host.
169
+ *
170
+ * When multiple hooks set `updatedInput` within a single `executeHooks`
171
+ * call, the last writer in registration order wins (outer loop: matcher
172
+ * registration order; inner loop: hook position within the matcher). The
173
+ * winner is deterministic — `Promise.all` preserves input-array order.
174
+ * Consumers that need a single authoritative rewrite should still scope
175
+ * `updatedInput` to one hook per matcher to avoid confusing precedence.
176
+ */
177
+ updatedInput?: Record<string, unknown>;
178
+ }
179
+ export interface PostToolUseHookOutput extends BaseHookOutput {
180
+ /**
181
+ * Replacement tool output. Flows through the aggregated result so the
182
+ * host can substitute it before appending the tool result message.
183
+ * Ordering semantics match `PreToolUseHookOutput.updatedInput`:
184
+ * last-writer-wins in registration order.
185
+ */
186
+ updatedOutput?: unknown;
187
+ }
188
+ export type PostToolUseFailureHookOutput = BaseHookOutput;
189
+ export type PermissionDeniedHookOutput = BaseHookOutput;
190
+ export interface SubagentStartHookOutput extends BaseHookOutput {
191
+ decision?: ToolDecision;
192
+ reason?: string;
193
+ }
194
+ export type SubagentStopHookOutput = BaseHookOutput;
195
+ export interface StopHookOutput extends BaseHookOutput {
196
+ decision?: StopDecision;
197
+ reason?: string;
198
+ }
199
+ export type StopFailureHookOutput = BaseHookOutput;
200
+ export type PreCompactHookOutput = BaseHookOutput;
201
+ export type PostCompactHookOutput = BaseHookOutput;
202
+ /** Compile-time map from event name to its output shape. */
203
+ export type HookOutputByEvent = {
204
+ RunStart: RunStartHookOutput;
205
+ UserPromptSubmit: UserPromptSubmitHookOutput;
206
+ PreToolUse: PreToolUseHookOutput;
207
+ PostToolUse: PostToolUseHookOutput;
208
+ PostToolUseFailure: PostToolUseFailureHookOutput;
209
+ PermissionDenied: PermissionDeniedHookOutput;
210
+ SubagentStart: SubagentStartHookOutput;
211
+ SubagentStop: SubagentStopHookOutput;
212
+ Stop: StopHookOutput;
213
+ StopFailure: StopFailureHookOutput;
214
+ PreCompact: PreCompactHookOutput;
215
+ PostCompact: PostCompactHookOutput;
216
+ };
217
+ /** Superset output shape used by the executor's fold loop. */
218
+ export type HookOutput = RunStartHookOutput | UserPromptSubmitHookOutput | PreToolUseHookOutput | PostToolUseHookOutput | PostToolUseFailureHookOutput | PermissionDeniedHookOutput | SubagentStartHookOutput | SubagentStopHookOutput | StopHookOutput | StopFailureHookOutput | PreCompactHookOutput | PostCompactHookOutput;
219
+ /**
220
+ * A hook callback is a plain async function registered against a specific
221
+ * event. The `signal` is always supplied by `executeHooks` and combines the
222
+ * batch's parent signal with the per-hook timeout — callbacks that perform
223
+ * long-running work should observe it.
224
+ */
225
+ export type HookCallback<E extends HookEvent = HookEvent> = (input: HookInputByEvent[E], signal: AbortSignal) => HookOutputByEvent[E] | Promise<HookOutputByEvent[E]>;
226
+ /**
227
+ * A matcher groups one or more callbacks under a shared regex filter and
228
+ * shared timeout/once/internal flags. The generic `E` ties the callback
229
+ * types to the event the matcher is registered against.
230
+ */
231
+ export interface HookMatcher<E extends HookEvent = HookEvent> {
232
+ /**
233
+ * Regex pattern matched against the event's primary query string (e.g.
234
+ * the tool name for `PreToolUse`, the agent type for `SubagentStart`).
235
+ *
236
+ * Omitted or empty means "always match". For events that do not supply a
237
+ * query string (`RunStart`, `Stop`, etc.), only wildcard matchers fire —
238
+ * a non-empty pattern on such events will never match.
239
+ *
240
+ * Patterns are treated as trusted input: `executeHooks` compiles them
241
+ * with `new RegExp(pattern)` without any sandbox, and a pathological
242
+ * pattern can block the event loop. Host registration code is expected
243
+ * to validate or length-bound patterns that originate from user input.
244
+ */
245
+ pattern?: string;
246
+ /** Callbacks that fire when the matcher hits. Executed in parallel. */
247
+ hooks: HookCallback<E>[];
248
+ /** Per-matcher timeout in ms. Defaults to the executor's batch timeout. */
249
+ timeout?: number;
250
+ /**
251
+ * Atomically remove the matcher before its first dispatch.
252
+ *
253
+ * `executeHooks` claims `once: true` matchers synchronously — between
254
+ * `getMatchers` and its first `await` — so two concurrent calls cannot
255
+ * both dispatch the same matcher. Whichever call runs its sync prefix
256
+ * first wins the matcher; the other sees an empty bucket.
257
+ *
258
+ * Semantics are "at most one dispatch, ever" — if every hook in the
259
+ * matcher throws, the matcher is still gone. Use `once` for
260
+ * fire-and-forget bootstrapping (registration, telemetry, setup). Hosts
261
+ * that need retry semantics should register a normal matcher and
262
+ * self-unregister via the callback returned from `registry.register`.
263
+ */
264
+ once?: boolean;
265
+ /** Internal hooks are excluded from telemetry and non-fatal error logging. */
266
+ internal?: boolean;
267
+ }
268
+ /**
269
+ * Storage shape for matchers keyed by event. Each event's matcher list is
270
+ * a generic array parameterized by that event type, so lookup via
271
+ * `HooksByEvent[E]` preserves type-safe callback signatures.
272
+ */
273
+ export type HooksByEvent = {
274
+ [E in HookEvent]?: HookMatcher<E>[];
275
+ };
276
+ /**
277
+ * Aggregated result of a single `executeHooks` call. Fields are populated
278
+ * according to the fold rules in `executeHooks.ts`.
279
+ */
280
+ export interface AggregatedHookResult {
281
+ /** Folded tool-gating decision; `deny > ask > allow`. */
282
+ decision?: ToolDecision;
283
+ /** Folded stop decision; any `block` wins. */
284
+ stopDecision?: StopDecision;
285
+ /** Reason from the hook that set the winning decision. */
286
+ reason?: string;
287
+ /**
288
+ * Replacement tool input from a `PreToolUse` hook.
289
+ *
290
+ * Last-writer-wins in **registration order**: `executeHooks` uses
291
+ * `Promise.all`, which preserves input-array order, so the fold iterates
292
+ * outcomes in the same order they were pushed — outer loop over matchers
293
+ * as they sit in the registry, inner loop over each matcher's `hooks`
294
+ * array. The winner is therefore deterministic but may not match the
295
+ * order in which hooks actually completed. Consumers that want a single
296
+ * authoritative rewrite should still register one `updatedInput`-setting
297
+ * hook per matcher to avoid subtle precedence bugs.
298
+ */
299
+ updatedInput?: Record<string, unknown>;
300
+ /**
301
+ * Replacement tool output from a `PostToolUse` hook.
302
+ *
303
+ * Same last-writer-wins-in-registration-order semantics as
304
+ * `updatedInput`. Present only when at least one hook set it; `undefined`
305
+ * means "use the original tool output".
306
+ */
307
+ updatedOutput?: unknown;
308
+ /** Accumulated `additionalContext` strings from every hook, in order. */
309
+ additionalContexts: string[];
310
+ /** True if any hook returned `preventContinuation`. */
311
+ preventContinuation?: boolean;
312
+ /**
313
+ * Reason recorded alongside `preventContinuation`. First winner wins:
314
+ * once a hook sets both flags, later hooks that also set
315
+ * `preventContinuation` do not overwrite the reason.
316
+ */
317
+ stopReason?: string;
318
+ /** Error messages from hooks that threw; always present (possibly empty). */
319
+ errors: string[];
320
+ }
@@ -7,7 +7,14 @@ export * from './graphs';
7
7
  export * from './summarization';
8
8
  export * from './tools/Calculator';
9
9
  export * from './tools/CodeExecutor';
10
+ export * from './tools/BashExecutor';
10
11
  export * from './tools/ProgrammaticToolCalling';
12
+ export * from './tools/BashProgrammaticToolCalling';
13
+ export * from './tools/SkillTool';
14
+ export * from './tools/SubagentTool';
15
+ export * from './tools/subagent';
16
+ export * from './tools/ReadFile';
17
+ export * from './tools/skillCatalog';
11
18
  export * from './tools/ToolSearch';
12
19
  export * from './tools/ToolNode';
13
20
  export * from './tools/schema';
@@ -15,6 +22,7 @@ export * from './tools/handlers';
15
22
  export * from './tools/search';
16
23
  export * from './common';
17
24
  export * from './utils';
25
+ export * from './hooks';
18
26
  export type * from './types';
19
27
  export { CustomOpenAIClient } from './llm/openai';
20
28
  export { ChatOpenRouter } from './llm/openrouter';
@@ -104,9 +104,10 @@ export declare const labelContentByAgent: (contentParts: MessageContentComplex[]
104
104
  * @param payload - The array of messages to format.
105
105
  * @param indexTokenCountMap - Optional map of message indices to token counts.
106
106
  * @param tools - Optional set of tool names that are allowed in the request.
107
+ * @param skills - Optional map of skill name to body for reconstructing skill HumanMessages.
107
108
  * @returns - Object containing formatted messages and updated indexTokenCountMap if provided.
108
109
  */
109
- export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number | undefined>, tools?: Set<string>) => {
110
+ export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number | undefined>, tools?: Set<string>, skills?: Map<string, string>) => {
110
111
  messages: Array<HumanMessage | AIMessage | SystemMessage | ToolMessage>;
111
112
  indexTokenCountMap?: Record<number, number>;
112
113
  /** Cross-run summary extracted from the payload. Should be forwarded to the
@@ -9,6 +9,7 @@ export declare class Run<_T extends t.BaseGraphState> {
9
9
  id: string;
10
10
  private tokenCounter?;
11
11
  private handlerRegistry?;
12
+ private hookRegistry?;
12
13
  private indexTokenCountMap?;
13
14
  calibrationRatio: number;
14
15
  graphRunnable?: t.CompiledStateWorkflow;
@@ -1,4 +1,6 @@
1
1
  import type { SummarizationTrigger } from '@/types';
2
+ /** For tests only. Resets the dedup set so warnings can be observed again. */
3
+ export declare function _resetUnrecognizedTriggerWarnings(): void;
2
4
  /**
3
5
  * Determines whether summarization should be triggered based on the configured trigger
4
6
  * and current context state.
@@ -1,6 +1,7 @@
1
1
  import type { RunnableConfig } from '@langchain/core/runnables';
2
2
  import type { BaseMessage } from '@langchain/core/messages';
3
3
  import type { AgentContext } from '@/agents/AgentContext';
4
+ import type { HookRegistry } from '@/hooks';
4
5
  import type * as t from '@/types';
5
6
  /** Structured checkpoint prompt for fresh summarization (no prior summary). */
6
7
  export declare const DEFAULT_SUMMARIZATION_PROMPT = "Hold on, before you continue I need you to write me a checkpoint of everything so far. Your context window is filling up and this checkpoint replaces the messages above, so capture everything you need to pick right back up.\n\nDon't second-guess or fact-check anything you did, your tool results reflect exactly what happened. If a tool result appears truncated, that's just a display artifact from context management: the tool executed fully. Just record what you did and what you observed. Only the checkpoint, don't respond to me or continue the conversation.\n\n## Checkpoint\n\n## Goal\nWhat I asked you to do and any sub-goals you identified.\n\n## Constraints & Preferences\nAny rules, preferences, or configuration I established.\n\n## Progress\n### Done\n- What you completed and the outcomes\n\n### In Progress\n- What you're currently working on\n\n## Key Decisions\nDecisions you made and why.\n\n## Next Steps\nConcrete task actions remaining, in priority order.\n\n## Critical Context\nExact identifiers, names, error messages, URLs, and details you need to preserve verbatim.\n\nRules:\n- Record what you did and observed, don't judge or re-evaluate it\n- For each tool call: the tool name, key inputs, and the outcome\n- Preserve exact identifiers, names, errors, and references verbatim\n- Short declarative sentences\n- Skip empty sections";
@@ -14,6 +15,7 @@ interface CreateSummarizeNodeParams {
14
15
  config?: RunnableConfig;
15
16
  runId?: string;
16
17
  isMultiAgent: boolean;
18
+ hookRegistry?: HookRegistry;
17
19
  dispatchRunStep: (runStep: t.RunStep, config?: RunnableConfig) => Promise<void>;
18
20
  dispatchRunStepCompleted: (stepId: string, result: t.StepCompleted, config?: RunnableConfig) => Promise<void>;
19
21
  };
@@ -0,0 +1,45 @@
1
+ import { DynamicStructuredTool } from '@langchain/core/tools';
2
+ import type * as t from '@/types';
3
+ import { Constants } from '@/common';
4
+ export declare const BashExecutionToolSchema: {
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly command: {
8
+ readonly type: "string";
9
+ readonly description: "The bash command or script to execute.\n- The environment is stateless; variables and state don't persist between executions.\n- Generated files from previous executions are automatically available in \"/mnt/data/\".\n- Files from previous executions are automatically available and can be modified in place.\n- Input code **IS ALREADY** displayed to the user, so **DO NOT** repeat it in your response unless asked.\n- Output code **IS NOT** displayed to the user, so **DO** write all desired output explicitly.\n- IMPORTANT: You MUST explicitly print/output ALL results you want the user to see.\n- Use `echo`, `printf`, or `cat` for all outputs.";
10
+ };
11
+ readonly args: {
12
+ readonly type: "array";
13
+ readonly items: {
14
+ readonly type: "string";
15
+ };
16
+ readonly description: "Additional arguments to execute the command with. This should only be used if the input command requires additional arguments to run.";
17
+ };
18
+ };
19
+ readonly required: readonly ["command"];
20
+ };
21
+ export declare const BashExecutionToolDescription: string;
22
+ export declare const BashExecutionToolName = Constants.BASH_TOOL;
23
+ export declare const BashExecutionToolDefinition: {
24
+ readonly name: Constants.BASH_TOOL;
25
+ readonly description: string;
26
+ readonly schema: {
27
+ readonly type: "object";
28
+ readonly properties: {
29
+ readonly command: {
30
+ readonly type: "string";
31
+ readonly description: "The bash command or script to execute.\n- The environment is stateless; variables and state don't persist between executions.\n- Generated files from previous executions are automatically available in \"/mnt/data/\".\n- Files from previous executions are automatically available and can be modified in place.\n- Input code **IS ALREADY** displayed to the user, so **DO NOT** repeat it in your response unless asked.\n- Output code **IS NOT** displayed to the user, so **DO** write all desired output explicitly.\n- IMPORTANT: You MUST explicitly print/output ALL results you want the user to see.\n- Use `echo`, `printf`, or `cat` for all outputs.";
32
+ };
33
+ readonly args: {
34
+ readonly type: "array";
35
+ readonly items: {
36
+ readonly type: "string";
37
+ };
38
+ readonly description: "Additional arguments to execute the command with. This should only be used if the input command requires additional arguments to run.";
39
+ };
40
+ };
41
+ readonly required: readonly ["command"];
42
+ };
43
+ };
44
+ declare function createBashExecutionTool(params?: t.BashExecutionToolParams): DynamicStructuredTool;
45
+ export { createBashExecutionTool };
@@ -0,0 +1,72 @@
1
+ import { DynamicStructuredTool } from '@langchain/core/tools';
2
+ import type * as t from '@/types';
3
+ import { Constants } from '@/common';
4
+ export declare const BashProgrammaticToolCallingSchema: {
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly code: {
8
+ readonly type: "string";
9
+ readonly minLength: 1;
10
+ readonly description: "Bash code that calls tools programmatically. Tools are available as bash functions.\n\nCRITICAL - STATELESS EXECUTION:\nEach call is a fresh bash shell. Variables and state do NOT persist between calls.\nYou MUST complete your entire workflow in ONE code block.\nDO NOT split work across multiple calls expecting to reuse variables.\n\nEach tool function accepts a JSON string as its argument.\nExample: tool_name '{\"key\": \"value\"}'\n\nExample (Complete workflow in one call):\n # Query data and process\n data=$(query_database '{\"sql\": \"SELECT * FROM users\"}')\n echo \"$data\" | jq '.[] | .name'\n\nExample (Parallel calls):\n web_search '{\"query\": \"SF weather\"}' > /tmp/sf.txt &\n web_search '{\"query\": \"NY weather\"}' > /tmp/ny.txt &\n wait\n echo \"SF: $(cat /tmp/sf.txt)\"\n echo \"NY: $(cat /tmp/ny.txt)\"\n\nRules:\n- EVERYTHING in one call—no state persists between executions\n- Tools are pre-defined as bash functions—DO NOT redefine them\n- Each tool function accepts a JSON string argument\n- Only echo/printf output returns to the model\n- Generated files are automatically available in /mnt/data/ for subsequent executions";
11
+ };
12
+ readonly timeout: {
13
+ readonly type: "integer";
14
+ readonly minimum: 1000;
15
+ readonly maximum: 300000;
16
+ readonly default: 60000;
17
+ readonly description: "Maximum execution time in milliseconds. Default: 60 seconds. Max: 5 minutes.";
18
+ };
19
+ };
20
+ readonly required: readonly ["code"];
21
+ };
22
+ export declare const BashProgrammaticToolCallingName = Constants.BASH_PROGRAMMATIC_TOOL_CALLING;
23
+ export declare const BashProgrammaticToolCallingDescription: string;
24
+ export declare const BashProgrammaticToolCallingDefinition: {
25
+ readonly name: Constants.BASH_PROGRAMMATIC_TOOL_CALLING;
26
+ readonly description: string;
27
+ readonly schema: {
28
+ readonly type: "object";
29
+ readonly properties: {
30
+ readonly code: {
31
+ readonly type: "string";
32
+ readonly minLength: 1;
33
+ readonly description: "Bash code that calls tools programmatically. Tools are available as bash functions.\n\nCRITICAL - STATELESS EXECUTION:\nEach call is a fresh bash shell. Variables and state do NOT persist between calls.\nYou MUST complete your entire workflow in ONE code block.\nDO NOT split work across multiple calls expecting to reuse variables.\n\nEach tool function accepts a JSON string as its argument.\nExample: tool_name '{\"key\": \"value\"}'\n\nExample (Complete workflow in one call):\n # Query data and process\n data=$(query_database '{\"sql\": \"SELECT * FROM users\"}')\n echo \"$data\" | jq '.[] | .name'\n\nExample (Parallel calls):\n web_search '{\"query\": \"SF weather\"}' > /tmp/sf.txt &\n web_search '{\"query\": \"NY weather\"}' > /tmp/ny.txt &\n wait\n echo \"SF: $(cat /tmp/sf.txt)\"\n echo \"NY: $(cat /tmp/ny.txt)\"\n\nRules:\n- EVERYTHING in one call—no state persists between executions\n- Tools are pre-defined as bash functions—DO NOT redefine them\n- Each tool function accepts a JSON string argument\n- Only echo/printf output returns to the model\n- Generated files are automatically available in /mnt/data/ for subsequent executions";
34
+ };
35
+ readonly timeout: {
36
+ readonly type: "integer";
37
+ readonly minimum: 1000;
38
+ readonly maximum: 300000;
39
+ readonly default: 60000;
40
+ readonly description: "Maximum execution time in milliseconds. Default: 60 seconds. Max: 5 minutes.";
41
+ };
42
+ };
43
+ readonly required: readonly ["code"];
44
+ };
45
+ };
46
+ /**
47
+ * Normalizes a tool name to a valid bash function identifier.
48
+ * 1. Replace hyphens, spaces, dots with underscores
49
+ * 2. Remove any other invalid characters
50
+ * 3. Prefix with underscore if starts with number
51
+ * 4. Append `_tool` if it's a bash reserved word
52
+ */
53
+ export declare function normalizeToBashIdentifier(name: string): string;
54
+ /**
55
+ * Extracts tool names that are actually called in the bash code.
56
+ * Bash functions are invoked as commands (no parentheses), so we match
57
+ * the normalized name as a word boundary.
58
+ */
59
+ export declare function extractUsedBashToolNames(code: string, toolNameMap: Map<string, string>): Set<string>;
60
+ /**
61
+ * Filters tool definitions to only include tools actually used in the bash code.
62
+ */
63
+ export declare function filterBashToolsByUsage(toolDefs: t.LCTool[], code: string, debug?: boolean): t.LCTool[];
64
+ /**
65
+ * Creates a Bash Programmatic Tool Calling tool for multi-tool orchestration.
66
+ *
67
+ * This tool enables AI agents to write bash scripts that orchestrate multiple
68
+ * tool calls programmatically via the remote Code API, reducing LLM round-trips.
69
+ *
70
+ * The tool map must be provided at runtime via config.toolCall (injected by ToolNode).
71
+ */
72
+ export declare function createBashProgrammaticToolCallingTool(initParams?: t.BashProgrammaticToolCallingParams): DynamicStructuredTool;
@@ -75,21 +75,19 @@ export declare function filterToolsByUsage(toolDefs: t.LCTool[], code: string, d
75
75
  * Fetches files from a previous session to make them available for the current execution.
76
76
  * Files are returned as CodeEnvFile references to be included in the request.
77
77
  * @param baseUrl - The base URL for the Code API
78
- * @param apiKey - The API key for authentication
79
78
  * @param sessionId - The session ID to fetch files from
80
79
  * @param proxy - Optional HTTP proxy URL
81
80
  * @returns Array of CodeEnvFile references, or empty array if fetch fails
82
81
  */
83
- export declare function fetchSessionFiles(baseUrl: string, apiKey: string, sessionId: string, proxy?: string): Promise<t.CodeEnvFile[]>;
82
+ export declare function fetchSessionFiles(baseUrl: string, sessionId: string, proxy?: string): Promise<t.CodeEnvFile[]>;
84
83
  /**
85
84
  * Makes an HTTP request to the Code API.
86
85
  * @param endpoint - The API endpoint URL
87
- * @param apiKey - The API key for authentication
88
86
  * @param body - The request body
89
87
  * @param proxy - Optional HTTP proxy URL
90
88
  * @returns The parsed API response
91
89
  */
92
- export declare function makeRequest(endpoint: string, apiKey: string, body: Record<string, unknown>, proxy?: string): Promise<t.ProgrammaticExecutionResponse>;
90
+ export declare function makeRequest(endpoint: string, body: Record<string, unknown>, proxy?: string): Promise<t.ProgrammaticExecutionResponse>;
93
91
  /**
94
92
  * Unwraps tool responses that may be formatted as tuples or content blocks.
95
93
  * MCP tools return [content, artifacts], we need to extract the raw data.
@@ -121,14 +119,11 @@ export declare function formatCompletedResponse(response: t.ProgrammaticExecutio
121
119
  *
122
120
  * The tool map must be provided at runtime via config.configurable.toolMap.
123
121
  *
124
- * @param params - Configuration parameters (apiKey, baseUrl, maxRoundTrips, proxy)
122
+ * @param params - Configuration parameters (baseUrl, maxRoundTrips, proxy)
125
123
  * @returns A LangChain DynamicStructuredTool for programmatic tool calling
126
124
  *
127
125
  * @example
128
- * const ptcTool = createProgrammaticToolCallingTool({
129
- * apiKey: process.env.CODE_API_KEY,
130
- * maxRoundTrips: 20
131
- * });
126
+ * const ptcTool = createProgrammaticToolCallingTool({ maxRoundTrips: 20 });
132
127
  *
133
128
  * const [output, artifact] = await ptcTool.invoke(
134
129
  * { code, tools },
@@ -0,0 +1,28 @@
1
+ import { Constants } from '@/common';
2
+ export declare const ReadFileToolName = Constants.READ_FILE;
3
+ export declare const ReadFileToolDescription = "Read the contents of a file. Returns text content with line numbers for easy reference.\n\nFor skill files, use the path format: {skillName}/{filePath} (e.g. \"pdf-analyzer/src/utils.py\", \"code-review/SKILL.md\").\n\nBEHAVIOR:\n- Text files: returned with numbered lines.\n- Images (png, jpeg, gif, webp): returned as visual content the model can see.\n- PDFs: returned as document content.\n- Other binary files: metadata returned with a note to use bash for processing.\n- Large files (>256KB text, >10MB binary): metadata only.\n- SKILL.md: returns the skill's instructions directly.\n\nCONSTRAINTS:\n- Only files from invoked skills or code execution output are accessible.\n- Do not guess file paths. Use paths from the skill documentation or tool output.";
4
+ export declare const ReadFileToolSchema: {
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly file_path: {
8
+ readonly type: "string";
9
+ readonly description: "Path to the file. For skill files: \"{skillName}/{path}\" (e.g. \"pdf-analyzer/src/utils.py\"). For code execution output: the path as returned by the execution tool.";
10
+ };
11
+ };
12
+ readonly required: readonly ["file_path"];
13
+ };
14
+ export declare const ReadFileToolDefinition: {
15
+ readonly name: Constants.READ_FILE;
16
+ readonly description: "Read the contents of a file. Returns text content with line numbers for easy reference.\n\nFor skill files, use the path format: {skillName}/{filePath} (e.g. \"pdf-analyzer/src/utils.py\", \"code-review/SKILL.md\").\n\nBEHAVIOR:\n- Text files: returned with numbered lines.\n- Images (png, jpeg, gif, webp): returned as visual content the model can see.\n- PDFs: returned as document content.\n- Other binary files: metadata returned with a note to use bash for processing.\n- Large files (>256KB text, >10MB binary): metadata only.\n- SKILL.md: returns the skill's instructions directly.\n\nCONSTRAINTS:\n- Only files from invoked skills or code execution output are accessible.\n- Do not guess file paths. Use paths from the skill documentation or tool output.";
17
+ readonly parameters: {
18
+ readonly type: "object";
19
+ readonly properties: {
20
+ readonly file_path: {
21
+ readonly type: "string";
22
+ readonly description: "Path to the file. For skill files: \"{skillName}/{path}\" (e.g. \"pdf-analyzer/src/utils.py\"). For code execution output: the path as returned by the execution tool.";
23
+ };
24
+ };
25
+ readonly required: readonly ["file_path"];
26
+ };
27
+ readonly responseFormat: "content_and_artifact";
28
+ };
@@ -0,0 +1,40 @@
1
+ import { Constants } from '@/common';
2
+ export declare const SkillToolName = Constants.SKILL_TOOL;
3
+ export declare const SkillToolDescription = "Invoke a skill from the user's library. Skills provide domain-specific instructions loaded into the conversation context, and may also provide files accessible via available tools depending on the runtime environment.\n\nWHEN TO USE:\n- The user's request matches a skill listed in the \"Available Skills\" section of the system prompt.\n- You MUST invoke the matching skill BEFORE attempting the task yourself.\n\nWHAT HAPPENS:\n- The skill's full instructions are loaded into the conversation as context.\n- Files bundled with the skill may become accessible via available tools.\n- Follow the skill's instructions to complete the task.\n\nCONSTRAINTS:\n- Do not invoke a skill that is already active in this conversation.\n- Skill names come from the catalog only. Do not guess names.";
4
+ /**
5
+ * JSON Schema for the SkillTool parameters.
6
+ * Single source of truth used by both SkillToolDefinition (LCTool registry)
7
+ * and createSkillTool() (DynamicStructuredTool instance).
8
+ */
9
+ export declare const SkillToolSchema: {
10
+ readonly type: "object";
11
+ readonly properties: {
12
+ readonly skillName: {
13
+ readonly type: "string";
14
+ readonly description: "The kebab-case identifier of the skill to invoke (e.g. \"financial-analyzer\", \"meeting-notes\"). Must match a name from the \"Available Skills\" section.";
15
+ };
16
+ readonly args: {
17
+ readonly type: "string";
18
+ readonly description: "Optional freeform arguments string passed to the skill.";
19
+ };
20
+ };
21
+ readonly required: readonly ["skillName"];
22
+ };
23
+ export declare const SkillToolDefinition: {
24
+ readonly name: Constants.SKILL_TOOL;
25
+ readonly description: "Invoke a skill from the user's library. Skills provide domain-specific instructions loaded into the conversation context, and may also provide files accessible via available tools depending on the runtime environment.\n\nWHEN TO USE:\n- The user's request matches a skill listed in the \"Available Skills\" section of the system prompt.\n- You MUST invoke the matching skill BEFORE attempting the task yourself.\n\nWHAT HAPPENS:\n- The skill's full instructions are loaded into the conversation as context.\n- Files bundled with the skill may become accessible via available tools.\n- Follow the skill's instructions to complete the task.\n\nCONSTRAINTS:\n- Do not invoke a skill that is already active in this conversation.\n- Skill names come from the catalog only. Do not guess names.";
26
+ readonly parameters: {
27
+ readonly type: "object";
28
+ readonly properties: {
29
+ readonly skillName: {
30
+ readonly type: "string";
31
+ readonly description: "The kebab-case identifier of the skill to invoke (e.g. \"financial-analyzer\", \"meeting-notes\"). Must match a name from the \"Available Skills\" section.";
32
+ };
33
+ readonly args: {
34
+ readonly type: "string";
35
+ readonly description: "Optional freeform arguments string passed to the skill.";
36
+ };
37
+ };
38
+ readonly required: readonly ["skillName"];
39
+ };
40
+ };