@wrongstack/core 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-DmBiCipY.d.ts → agent-bridge-C3DUGjSb.d.ts} +1 -1
- package/dist/{compactor-DSl2FK7a.d.ts → compactor-BUU6Zm_3.d.ts} +1 -1
- package/dist/{config-DXrqb41m.d.ts → config-CKLYPkCi.d.ts} +1 -1
- package/dist/{context-u0bryklF.d.ts → context-IovtuTf8.d.ts} +2 -0
- package/dist/coordination/index.d.ts +11 -11
- package/dist/coordination/index.js +24 -1
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +30 -15
- package/dist/defaults/index.js +321 -2
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-B6Q03pTu.d.ts → events-CNB9PALO.d.ts} +27 -1
- package/dist/execution/index.d.ts +12 -12
- package/dist/extension/index.d.ts +9 -0
- package/dist/extension/index.js +234 -0
- package/dist/extension/index.js.map +1 -0
- package/dist/{plugin-CoYYZKdn.d.ts → index-BDb0cAMP.d.ts} +370 -11
- package/dist/index.d.ts +75 -25
- package/dist/index.js +1864 -1347
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/kernel/index.d.ts +12 -9
- package/dist/kernel/index.js +73 -7
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BA1Ofmfj.d.ts → mcp-servers-DR35ojJZ.d.ts} +3 -3
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +24 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-BDfkxL5C.d.ts → multi-agent-B9a6sflH.d.ts} +2 -2
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-Crkt8wTQ.d.ts → path-resolver-Cl_q0u-R.d.ts} +2 -2
- package/dist/provider-runner-BXuADQqQ.d.ts +36 -0
- package/dist/sdd/index.d.ts +3 -3
- package/dist/{secret-scrubber-3TLUkiCV.d.ts → secret-scrubber-CgG2tV2B.d.ts} +1 -1
- package/dist/{secret-scrubber-CwYliRWd.d.ts → secret-scrubber-Cuy5afaQ.d.ts} +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/security/index.js +24 -1
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-BRqzvugb.d.ts → selector-wT2fv9Fg.d.ts} +1 -1
- package/dist/{session-reader-C3x96CDR.d.ts → session-reader-CcPi4BQ8.d.ts} +1 -1
- package/dist/{skill-Bx8jxznf.d.ts → skill-C_7znCIC.d.ts} +2 -2
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.js +24 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/{renderer-0A2ZEtca.d.ts → system-prompt-Dk1qm8ey.d.ts} +30 -2
- package/dist/{tool-executor-CYdZdtno.d.ts → tool-executor-DKu4A6nB.d.ts} +5 -5
- package/dist/types/index.d.ts +16 -16
- package/dist/types/index.js +24 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +24 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -1
- package/dist/system-prompt-CG9jU5-5.d.ts +0 -31
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
import { u as Tool, z as ToolResultBlock,
|
|
1
|
+
import { u as Tool, z as ToolResultBlock, T as TextBlock, a0 as Context, R as Request, j as Response, D as ToolUseBlock, g as Provider, W as WrongStackError, b as ContentBlock, a7 as RunOptions, J as JSONSchema } from './context-IovtuTf8.js';
|
|
2
|
+
import { L as Logger } from './logger-BMQgxvdy.js';
|
|
3
|
+
import { R as Renderer, B as BuildContext, C as Container, P as Pipeline, e as ReadonlyPipeline } from './system-prompt-Dk1qm8ey.js';
|
|
2
4
|
import { T as Tracer } from './observability-BhnVLBLS.js';
|
|
3
|
-
import { E as EventBus, a as EventName, L as Listener } from './events-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { e as ProviderConfig, C as Config } from './config-DXrqb41m.js';
|
|
5
|
+
import { E as EventBus, a as EventName, L as Listener } from './events-CNB9PALO.js';
|
|
6
|
+
import { a as PermissionPolicy, S as SecretScrubber } from './secret-scrubber-CgG2tV2B.js';
|
|
7
|
+
import { e as ProviderConfig, C as Config } from './config-CKLYPkCi.js';
|
|
7
8
|
import { W as WireFamily } from './models-registry-Y2xbog0E.js';
|
|
8
|
-
import { L as Logger } from './logger-BMQgxvdy.js';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A function that wraps (decorates) an existing tool. Receives the
|
|
12
|
+
* original tool and returns a modified version — typically the same
|
|
13
|
+
* tool with a wrapped `execute` / `executeStream`, or with modified
|
|
14
|
+
* metadata (description, permission).
|
|
15
|
+
*
|
|
16
|
+
* Use `ToolRegistry.wrap()` to apply; the wrapper is called immediately
|
|
17
|
+
* and the result replaces the registered tool. Multiple wraps stack —
|
|
18
|
+
* each wrapper receives the output of the previous.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* registry.wrap('read', (original) => ({
|
|
23
|
+
* ...original,
|
|
24
|
+
* async execute(input, ctx, opts) {
|
|
25
|
+
* console.log('read called');
|
|
26
|
+
* return original.execute(input, ctx, opts);
|
|
27
|
+
* }
|
|
28
|
+
* }));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
type ToolWrapper = (tool: Tool) => Tool;
|
|
10
32
|
declare class ToolRegistry {
|
|
11
33
|
private readonly tools;
|
|
12
34
|
register(tool: Tool, owner?: string): void;
|
|
@@ -16,6 +38,17 @@ declare class ToolRegistry {
|
|
|
16
38
|
* scenarios where duplicate registration may be intentional.
|
|
17
39
|
*/
|
|
18
40
|
tryRegister(tool: Tool, owner?: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Bulk-register multiple tools at once. Each tool that conflicts with an
|
|
43
|
+
* existing registration is silently skipped — use `registerAllOrThrow`
|
|
44
|
+
* if you want it to throw on conflicts.
|
|
45
|
+
*/
|
|
46
|
+
registerAll(tools: Tool[], owner?: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Bulk-register and throw on the first conflict. Use when you need
|
|
49
|
+
* strict registration (e.g. at boot time).
|
|
50
|
+
*/
|
|
51
|
+
registerAllOrThrow(tools: Tool[], owner?: string): void;
|
|
19
52
|
/**
|
|
20
53
|
* Register a tool as a default. If the tool name is already registered,
|
|
21
54
|
* this is a no-op — the existing registration (from core or another
|
|
@@ -28,9 +61,27 @@ declare class ToolRegistry {
|
|
|
28
61
|
* Plugins use this to replace built-in tools with custom implementations.
|
|
29
62
|
*/
|
|
30
63
|
override(name: string, tool: Tool, owner?: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Wrap (decorate) an existing tool. The wrapper receives the current
|
|
66
|
+
* tool and must return a new tool — typically the same tool with a
|
|
67
|
+
* wrapped `execute` or `executeStream`. Throws if the tool is not
|
|
68
|
+
* registered.
|
|
69
|
+
*
|
|
70
|
+
* Multiple wraps stack: each wrapper gets the output of the previous.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* registry.wrap('bash', (t) => ({ ...t, permission: 'confirm' }));
|
|
74
|
+
*/
|
|
75
|
+
wrap(name: string, wrapper: ToolWrapper, owner?: string): void;
|
|
31
76
|
get(name: string): Tool | undefined;
|
|
32
77
|
ownerOf(name: string): string | undefined;
|
|
33
78
|
list(): Tool[];
|
|
79
|
+
/**
|
|
80
|
+
* Group tools by their `category` field. Tools without a category
|
|
81
|
+
* are placed under the key `""` (empty string). Returns a Map of
|
|
82
|
+
* category → tools, sorted by registration order within each category.
|
|
83
|
+
*/
|
|
84
|
+
listByCategory(): Map<string, Tool[]>;
|
|
34
85
|
listWithOwner(): {
|
|
35
86
|
tool: Tool;
|
|
36
87
|
owner: string;
|
|
@@ -96,6 +147,226 @@ interface ToolConfirmPendingResult {
|
|
|
96
147
|
}
|
|
97
148
|
type ToolExecutorStrategy = 'parallel' | 'sequential' | 'smart';
|
|
98
149
|
|
|
150
|
+
/**
|
|
151
|
+
* A contributor that injects additional TextBlocks into the system prompt.
|
|
152
|
+
*
|
|
153
|
+
* Contributors are called on every `build()` in registration order.
|
|
154
|
+
* Their output is inserted after the core blocks (identity, tool usage,
|
|
155
|
+
* environment) but before the mode and plan blocks. This lets plugins
|
|
156
|
+
* inject ephemeral context — current state, recent events, plugin-specific
|
|
157
|
+
* instructions — without replacing the entire system prompt builder.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* api.extensions.registerSystemPromptContributor(async (ctx) => {
|
|
162
|
+
* return [{ type: 'text', text: '## My Plugin Context\n...' }];
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
interface SystemPromptContributor {
|
|
167
|
+
(ctx: BuildContext): Promise<TextBlock[]>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Extension points for the Agent lifecycle.
|
|
172
|
+
*
|
|
173
|
+
* Each extension point is a hook that gets called at a specific phase.
|
|
174
|
+
* Extensions are always optional and failures are isolated — a failing
|
|
175
|
+
* extension never aborts the agent run.
|
|
176
|
+
*
|
|
177
|
+
* Plugins register extensions via `PluginAPI.extensions`, not by
|
|
178
|
+
* directly importing this module. The Agent calls the registry in
|
|
179
|
+
* order at each phase.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Called before Agent.run() begins the main iteration loop.
|
|
184
|
+
* Returns `false` or throws to prevent the run from starting.
|
|
185
|
+
*/
|
|
186
|
+
type BeforeRunHook = (ctx: Context, input: UserInputPayload) => void | Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Called after Agent.run() completes (or fails/aborts).
|
|
189
|
+
* Receives the final RunResult, always called regardless of outcome.
|
|
190
|
+
*/
|
|
191
|
+
type AfterRunHook = (ctx: Context, result: RunResult) => void | Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Called right before each iteration of the agent loop.
|
|
194
|
+
* The context is live (messages, signal, etc.) and can be inspected.
|
|
195
|
+
* Modifications to ctx (e.g. ctx.messages, ctx.model) take effect
|
|
196
|
+
* for the upcoming iteration.
|
|
197
|
+
*/
|
|
198
|
+
type BeforeIterationHook = (ctx: Context, iterationIndex: number) => void | Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Called after each iteration completes (tool results appended,
|
|
201
|
+
* compaction done, but before the next loop iteration check).
|
|
202
|
+
*/
|
|
203
|
+
type AfterIterationHook = (ctx: Context, iterationIndex: number) => void | Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Called when the agent encounters an error during the provider call
|
|
206
|
+
* or tool execution phase. The hook can return a modified context
|
|
207
|
+
* or signal that recovery should be attempted.
|
|
208
|
+
*
|
|
209
|
+
* Return `{ action: 'retry', model?: string }` to retry the turn
|
|
210
|
+
* (possibly with a different model).
|
|
211
|
+
* Return `{ action: 'fail' }` to propagate the error.
|
|
212
|
+
* Return `{ action: 'continue' }` to skip and continue the loop.
|
|
213
|
+
*/
|
|
214
|
+
type OnErrorHook = (ctx: Context, err: unknown, phase: 'provider' | 'tool' | 'agent', iterationIndex: number) => {
|
|
215
|
+
action: 'retry';
|
|
216
|
+
model?: string;
|
|
217
|
+
} | {
|
|
218
|
+
action: 'fail';
|
|
219
|
+
} | {
|
|
220
|
+
action: 'continue';
|
|
221
|
+
} | void | Promise<{
|
|
222
|
+
action: 'retry';
|
|
223
|
+
model?: string;
|
|
224
|
+
} | {
|
|
225
|
+
action: 'fail';
|
|
226
|
+
} | {
|
|
227
|
+
action: 'continue';
|
|
228
|
+
} | void>;
|
|
229
|
+
/**
|
|
230
|
+
* The default provider runner function signature — what the Agent's
|
|
231
|
+
* built-in provider runner looks like. Extensions that wrap the provider
|
|
232
|
+
* runner receive this as the `inner` parameter they can delegate to.
|
|
233
|
+
*/
|
|
234
|
+
type ProviderRunnerFn = (ctx: Context, request: Request) => Promise<Response>;
|
|
235
|
+
/**
|
|
236
|
+
* Wrap or replace the provider call in the agent loop.
|
|
237
|
+
*
|
|
238
|
+
* The `inner` function is the default provider runner (with retries).
|
|
239
|
+
* The extension can call it, modify the request/response, add caching,
|
|
240
|
+
* or bypass it entirely.
|
|
241
|
+
*/
|
|
242
|
+
type ProviderRunnerWrapper = (ctx: Context, request: Request, inner: ProviderRunnerFn) => Promise<Response>;
|
|
243
|
+
/**
|
|
244
|
+
* Called before a batch of tools is executed. Can modify or reject
|
|
245
|
+
* the tool list. Return the (possibly filtered/modified) tool uses.
|
|
246
|
+
*/
|
|
247
|
+
type BeforeToolExecutionHook = (ctx: Context, toolUses: ToolUseBlock[]) => ToolUseBlock[] | Promise<ToolUseBlock[]>;
|
|
248
|
+
/**
|
|
249
|
+
* Called after a batch of tools has been executed and results
|
|
250
|
+
* are available. The extension can inspect or transform results
|
|
251
|
+
* before they're appended to context.
|
|
252
|
+
*/
|
|
253
|
+
type AfterToolExecutionHook = (ctx: Context, outputs: ToolExecutionOutput[]) => void | Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* An extension registered by a plugin or the host application.
|
|
256
|
+
*
|
|
257
|
+
* Every hook is optional — implement only the phases you need.
|
|
258
|
+
* Hooks are called in registration order. A hook failure is
|
|
259
|
+
* caught, logged, and does not prevent subsequent hooks from running.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const myExt: AgentExtension = {
|
|
264
|
+
* name: 'my-plugin-ext',
|
|
265
|
+
* beforeIteration: async (ctx, idx) => {
|
|
266
|
+
* console.log('Starting iteration', idx);
|
|
267
|
+
* },
|
|
268
|
+
* };
|
|
269
|
+
* api.extensions.register(myExt);
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
interface AgentExtension {
|
|
273
|
+
/** Unique name for this extension. Used in diagnostics and logging. */
|
|
274
|
+
name: string;
|
|
275
|
+
/** Optional owner tag (plugin name or host identifier). */
|
|
276
|
+
owner?: string;
|
|
277
|
+
beforeRun?: BeforeRunHook;
|
|
278
|
+
afterRun?: AfterRunHook;
|
|
279
|
+
beforeIteration?: BeforeIterationHook;
|
|
280
|
+
afterIteration?: AfterIterationHook;
|
|
281
|
+
onError?: OnErrorHook;
|
|
282
|
+
wrapProviderRunner?: ProviderRunnerWrapper;
|
|
283
|
+
beforeToolExecution?: BeforeToolExecutionHook;
|
|
284
|
+
afterToolExecution?: AfterToolExecutionHook;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* ExtensionRegistry — manages AgentExtension registrations.
|
|
289
|
+
*
|
|
290
|
+
* Extensions are called in registration order at each lifecycle phase.
|
|
291
|
+
* Each extension hook failure is caught and logged independently so
|
|
292
|
+
* one bad extension can't take down the agent.
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
declare class ExtensionRegistry {
|
|
296
|
+
private readonly extensions;
|
|
297
|
+
private readonly promptContributors;
|
|
298
|
+
private log;
|
|
299
|
+
setLogger(log: Logger): void;
|
|
300
|
+
/**
|
|
301
|
+
* Register a system prompt contributor. Returns an unregister function.
|
|
302
|
+
* Contributors are called on every system prompt build in registration
|
|
303
|
+
* order. Their output blocks are inserted after the core environment
|
|
304
|
+
* block, before the mode and plan blocks.
|
|
305
|
+
*/
|
|
306
|
+
registerSystemPromptContributor(c: SystemPromptContributor): () => void;
|
|
307
|
+
/**
|
|
308
|
+
* Build all registered system prompt contributions.
|
|
309
|
+
* Failures are caught and logged — one bad contributor doesn't
|
|
310
|
+
* break the prompt assembly.
|
|
311
|
+
*/
|
|
312
|
+
buildSystemPromptContributions(ctx: Parameters<SystemPromptContributor>[0]): Promise<TextBlock[]>;
|
|
313
|
+
/**
|
|
314
|
+
* Returns the live array of contributors (readonly snapshot for
|
|
315
|
+
* passing to DefaultSystemPromptBuilder at build time).
|
|
316
|
+
*/
|
|
317
|
+
listSystemPromptContributors(): readonly SystemPromptContributor[];
|
|
318
|
+
/**
|
|
319
|
+
* Register an extension. Duplicate names are rejected.
|
|
320
|
+
* Returns an unregister function.
|
|
321
|
+
*/
|
|
322
|
+
register(ext: AgentExtension): () => void;
|
|
323
|
+
/**
|
|
324
|
+
* Register an extension, silently replacing any previous registration
|
|
325
|
+
* with the same name. Use this when overriding a default extension.
|
|
326
|
+
*/
|
|
327
|
+
registerOrReplace(ext: AgentExtension): () => void;
|
|
328
|
+
/**
|
|
329
|
+
* Unregister an extension by name. Returns true if found.
|
|
330
|
+
*/
|
|
331
|
+
unregister(name: string): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* List registered extension names in order.
|
|
334
|
+
*/
|
|
335
|
+
list(): readonly string[];
|
|
336
|
+
/**
|
|
337
|
+
* Check if an extension with the given name is registered.
|
|
338
|
+
*/
|
|
339
|
+
has(name: string): boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Remove all registered extensions and contributors.
|
|
342
|
+
*/
|
|
343
|
+
clear(): void;
|
|
344
|
+
runBeforeRun(...args: Parameters<BeforeRunHook>): Promise<void>;
|
|
345
|
+
runAfterRun(...args: Parameters<AfterRunHook>): Promise<void>;
|
|
346
|
+
runBeforeIteration(...args: Parameters<BeforeIterationHook>): Promise<void>;
|
|
347
|
+
runAfterIteration(...args: Parameters<AfterIterationHook>): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Run onError hooks in order. The first hook that returns a non-void
|
|
350
|
+
* result wins; subsequent hooks are skipped.
|
|
351
|
+
*/
|
|
352
|
+
runOnError(...args: Parameters<OnErrorHook>): Promise<{
|
|
353
|
+
action: 'retry';
|
|
354
|
+
model?: string;
|
|
355
|
+
} | {
|
|
356
|
+
action: 'fail';
|
|
357
|
+
} | {
|
|
358
|
+
action: 'continue';
|
|
359
|
+
} | void>;
|
|
360
|
+
/**
|
|
361
|
+
* Build a composed provider runner. Extensions with `wrapProviderRunner`
|
|
362
|
+
* form a middleware-style chain: the innermost extension wraps the
|
|
363
|
+
* default runner, each subsequent wrapper wraps the previous.
|
|
364
|
+
*/
|
|
365
|
+
wrapProviderRunner(inner: ProviderRunnerFn): ProviderRunnerFn;
|
|
366
|
+
runBeforeToolExecution(...args: Parameters<BeforeToolExecutionHook>): Promise<Parameters<BeforeToolExecutionHook>[1]>;
|
|
367
|
+
runAfterToolExecution(...args: Parameters<AfterToolExecutionHook>): Promise<void>;
|
|
368
|
+
}
|
|
369
|
+
|
|
99
370
|
/**
|
|
100
371
|
* Factory for constructing a Provider instance. The `family` field
|
|
101
372
|
* declares the wire protocol so callers can route without inspecting
|
|
@@ -124,6 +395,10 @@ declare class ProviderRegistry {
|
|
|
124
395
|
* runtime overrides (e.g. from plugins or CLI flags).
|
|
125
396
|
*/
|
|
126
397
|
register(f: ProviderFactory$1): void;
|
|
398
|
+
/**
|
|
399
|
+
* Bulk-register multiple provider factories at once.
|
|
400
|
+
*/
|
|
401
|
+
registerAll(factories: ProviderFactory$1[]): void;
|
|
127
402
|
/**
|
|
128
403
|
* Override an existing factory. Throws if no factory is registered
|
|
129
404
|
* for the given type. Use this to safely replace a provider at runtime
|
|
@@ -188,6 +463,14 @@ interface AgentInit {
|
|
|
188
463
|
* Default is `NoopTracer` (zero overhead).
|
|
189
464
|
*/
|
|
190
465
|
tracer?: Tracer | undefined;
|
|
466
|
+
/**
|
|
467
|
+
* Optional extension registry. Plugins and host applications register
|
|
468
|
+
* extensions here to hook into the agent lifecycle (beforeRun, afterRun,
|
|
469
|
+
* beforeIteration, onError, wrapProviderRunner, etc.).
|
|
470
|
+
* When not provided, the agent creates an empty registry internally —
|
|
471
|
+
* no overhead, zero breakage.
|
|
472
|
+
*/
|
|
473
|
+
extensions?: ExtensionRegistry | undefined;
|
|
191
474
|
}
|
|
192
475
|
interface AgentPipelines {
|
|
193
476
|
request: Pipeline<Request>;
|
|
@@ -227,6 +510,7 @@ declare class Agent {
|
|
|
227
510
|
private readonly toolExecutor;
|
|
228
511
|
private readonly autoExtendLimit;
|
|
229
512
|
private readonly tracer;
|
|
513
|
+
readonly extensions: ExtensionRegistry;
|
|
230
514
|
constructor(init: AgentInit);
|
|
231
515
|
private get logger();
|
|
232
516
|
private get retry();
|
|
@@ -238,10 +522,6 @@ declare class Agent {
|
|
|
238
522
|
use(plugin: Plugin, api: PluginAPI): Promise<void>;
|
|
239
523
|
run(userInput: AgentInput, opts?: RunOptions): Promise<RunResult>;
|
|
240
524
|
private runInner;
|
|
241
|
-
/**
|
|
242
|
-
* Normalize user input and emit through userInput pipeline + session append.
|
|
243
|
-
*/
|
|
244
|
-
private normalizeAndEmitUserInput;
|
|
245
525
|
/**
|
|
246
526
|
* Check if iteration limit has been reached and request extension if needed.
|
|
247
527
|
* Returns the new effective limit (possibly extended) and a RunResult if
|
|
@@ -316,6 +596,8 @@ interface SlashCommand {
|
|
|
316
596
|
interface ToolRegistryView {
|
|
317
597
|
register(t: Tool): void;
|
|
318
598
|
unregister(name: string): void;
|
|
599
|
+
/** Wrap (decorate) an existing tool. The wrapper gets the current tool and returns the decorated version. */
|
|
600
|
+
wrap(name: string, wrapper: ToolWrapper): void;
|
|
319
601
|
get(name: string): Tool | undefined;
|
|
320
602
|
list(): Tool[];
|
|
321
603
|
}
|
|
@@ -347,6 +629,31 @@ interface SlashCommandRegistryView {
|
|
|
347
629
|
get(name: string): SlashCommand | undefined;
|
|
348
630
|
list(): SlashCommand[];
|
|
349
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Read-only view of the session writer. Plugins can append custom events
|
|
634
|
+
* to the JSONL session log and read the transcript path.
|
|
635
|
+
*
|
|
636
|
+
* The `append` method accepts any JSON-serializable payload — custom
|
|
637
|
+
* event types are persisted verbatim next to the built-in events.
|
|
638
|
+
*/
|
|
639
|
+
interface SessionWriterView {
|
|
640
|
+
readonly transcriptPath?: string;
|
|
641
|
+
append(event: Record<string, unknown> & {
|
|
642
|
+
type: string;
|
|
643
|
+
ts: string;
|
|
644
|
+
}): Promise<void>;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Metrics sink scoped to a plugin. The host auto-prefixes metric names
|
|
648
|
+
* with `plugin.<pluginName>.` so plugins don't need to namespace
|
|
649
|
+
* manually. Plugins call counter/histogram/gauge directly; the values
|
|
650
|
+
* flow to the host's MetricsSink (Prometheus, OTLP, or noop).
|
|
651
|
+
*/
|
|
652
|
+
interface MetricsSinkView {
|
|
653
|
+
counter(name: string, value?: number, labels?: Record<string, string>): void;
|
|
654
|
+
histogram(name: string, value: number, labels?: Record<string, string>): void;
|
|
655
|
+
gauge(name: string, value: number, labels?: Record<string, string>): void;
|
|
656
|
+
}
|
|
350
657
|
interface PluginPipelines {
|
|
351
658
|
request: ReadonlyPipeline<Request>;
|
|
352
659
|
response: ReadonlyPipeline<Response>;
|
|
@@ -368,6 +675,18 @@ interface PluginAPI {
|
|
|
368
675
|
providers: ProviderRegistryView;
|
|
369
676
|
mcp: MCPRegistryView;
|
|
370
677
|
slashCommands: SlashCommandRegistryView;
|
|
678
|
+
/** Live session writer — plugins can append custom events here. */
|
|
679
|
+
session: SessionWriterView;
|
|
680
|
+
/** Scoped metrics sink — counters/histograms/gauges auto-namespaced under `plugin.<name>.` */
|
|
681
|
+
metrics: MetricsSinkView;
|
|
682
|
+
/** Registry for agent lifecycle extensions — hooks like beforeRun, beforeIteration, onError, etc. */
|
|
683
|
+
extensions: ExtensionRegistry;
|
|
684
|
+
/**
|
|
685
|
+
* Register a system prompt contributor. Plugins call this to inject
|
|
686
|
+
* ephemeral TextBlocks into the system prompt on every build.
|
|
687
|
+
* Returns an unregister function.
|
|
688
|
+
*/
|
|
689
|
+
registerSystemPromptContributor(c: SystemPromptContributor): () => void;
|
|
371
690
|
config: Config;
|
|
372
691
|
log: Logger;
|
|
373
692
|
/**
|
|
@@ -376,6 +695,28 @@ interface PluginAPI {
|
|
|
376
695
|
* comes first.
|
|
377
696
|
*/
|
|
378
697
|
onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
|
|
698
|
+
/**
|
|
699
|
+
* Subscribe to all events matching a glob-style pattern.
|
|
700
|
+
* `'tool.*'` matches all tool events. `'*'` matches everything.
|
|
701
|
+
* Returns an unsubscribe function.
|
|
702
|
+
*/
|
|
703
|
+
onPattern(pattern: string, handler: (event: string, payload: unknown) => void): () => void;
|
|
704
|
+
/**
|
|
705
|
+
* Emit a custom event on the agent's EventBus. Use for inter-plugin
|
|
706
|
+
* communication or to surface plugin-specific state to the host.
|
|
707
|
+
*
|
|
708
|
+
* Custom events use a `pluginName:eventName` convention to avoid
|
|
709
|
+
* collisions with built-in events (e.g. `my-plugin:cache_hit`).
|
|
710
|
+
* The payload is passed through to all subscribers.
|
|
711
|
+
*/
|
|
712
|
+
emitCustom(event: string, payload: unknown): void;
|
|
713
|
+
/**
|
|
714
|
+
* Register a callback that fires when the configuration changes at
|
|
715
|
+
* runtime (e.g. via `/config` slash command or programmatic update).
|
|
716
|
+
* The handler receives the new and previous config snapshots.
|
|
717
|
+
* Returns an unsubscribe function.
|
|
718
|
+
*/
|
|
719
|
+
onConfigChange(handler: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
379
720
|
}
|
|
380
721
|
/**
|
|
381
722
|
* Capability declaration — informs the host which subsystems a plugin
|
|
@@ -440,8 +781,26 @@ interface Plugin {
|
|
|
440
781
|
/** Optional plugin dependencies — silently skipped if absent. */
|
|
441
782
|
optionalDeps?: (string | PluginDependency)[];
|
|
442
783
|
conflictsWith?: string[];
|
|
784
|
+
/**
|
|
785
|
+
* Default configuration values, deep-merged under the plugin's options
|
|
786
|
+
* key before `configSchema` validation. User-provided values take
|
|
787
|
+
* precedence over defaults — this is a fallback, not an override.
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* defaultConfig: { ttl: 3600, maxSize: 100 }
|
|
791
|
+
*/
|
|
792
|
+
defaultConfig?: Record<string, unknown>;
|
|
443
793
|
setup(api: PluginAPI): void | Promise<void>;
|
|
444
794
|
teardown?(api: PluginAPI): void | Promise<void>;
|
|
795
|
+
/**
|
|
796
|
+
* Optional health check. Called by the host (e.g. `/diag plugins` slash
|
|
797
|
+
* command or health endpoint) to surface plugin status. Return
|
|
798
|
+
* `{ ok: false, message: '...' }` when the plugin is degraded.
|
|
799
|
+
*/
|
|
800
|
+
health?(): Promise<{
|
|
801
|
+
ok: boolean;
|
|
802
|
+
message?: string;
|
|
803
|
+
}>;
|
|
445
804
|
}
|
|
446
805
|
|
|
447
|
-
export {
|
|
806
|
+
export { type AfterIterationHook as A, type BeforeIterationHook as B, type ToolWrapper as C, DEFAULT_MAX_ITERATIONS as D, ExtensionRegistry as E, createDefaultPipelines as F, type ProviderRunnerFn as G, type MCPRegistryView as M, type OnErrorHook as O, type Plugin as P, type RunResult as R, type SessionWriterView as S, type ToolRegistryView as T, type UserInputPayload as U, type MetricsSinkView as a, type PluginAPI as b, type PluginCapabilities as c, type PluginDependency as d, type PluginPipelines as e, type ProviderFactory as f, type ProviderRegistryView as g, type SlashCommand as h, type SlashCommandRegistryView as i, type SystemPromptContributor as j, type ToolExecutorOptions as k, type ToolExecutorStrategy as l, type ToolBatchResult as m, ToolRegistry as n, ProviderRegistry as o, type AfterRunHook as p, type AfterToolExecutionHook as q, Agent as r, type AgentExtension as s, type AgentInit as t, type AgentInput as u, type AgentPipelines as v, type BeforeRunHook as w, type BeforeToolExecutionHook as x, type ProviderFactory$1 as y, type ProviderRunnerWrapper as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { C as Container } from './
|
|
2
|
-
export {
|
|
3
|
-
import { E as EventBus, a as EventName, L as Listener } from './events-
|
|
4
|
-
export { b as EventLogger, c as EventMap } from './events-
|
|
1
|
+
import { S as SystemPromptBuilder, M as ModelCapabilities, B as BuildContext, C as Container } from './system-prompt-Dk1qm8ey.js';
|
|
2
|
+
export { a as BindOptions, D as Decorator, F as Factory, b as Middleware, c as MiddlewareHandler, N as NextFn, P as Pipeline, d as PipelineOptions, R as Renderer, T as Token } from './system-prompt-Dk1qm8ey.js';
|
|
3
|
+
import { E as EventBus, a as EventName, L as Listener } from './events-CNB9PALO.js';
|
|
4
|
+
export { b as EventLogger, c as EventMap } from './events-CNB9PALO.js';
|
|
5
5
|
export { RunController, RunControllerOptions, TOKENS } from './kernel/index.js';
|
|
6
|
-
import { b as ContentBlock, T as TextBlock, a0 as Context } from './context-
|
|
7
|
-
export { A as AgentError, C as Capabilities, a as ConfigError, a3 as ContextInit, a4 as ConversationState, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, g as Provider, h as ProviderError, i as ProviderErrorBody, a5 as ReadonlyConversationState, R as Request, j as Response, k as ResumedSession, a6 as RunEnv, a7 as RunOptions, S as SessionData, l as SessionError, m as SessionEvent, n as SessionMetadata, o as SessionStore, p as SessionSummary, q as SessionWriter, a8 as StateChange, a9 as StateChangeHandler, r as StopReason, s as StreamEvent, t as ThinkingBlock, aa as TodoItem, a1 as TokenCounter, u as Tool, v as ToolCallContext, w as ToolError, x as ToolFinalEvent, y as ToolProgressEvent, z as ToolResultBlock, B as ToolStreamEvent, D as ToolUseBlock, U as Usage, W as WrongStackError, F as asBlocks, G as asText, ab as extractRunEnv, H as isAgentError, K as isConfigError, L as isImageBlock, N as isPluginError, O as isSessionError, Q as isTextBlock, V as isThinkingBlock, X as isToolError, Y as isToolResultBlock, Z as isToolUseBlock, _ as isWrongStackError, $ as toWrongStackError, ac as wrapAsState } from './context-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { P as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
6
|
+
import { b as ContentBlock, T as TextBlock, a0 as Context } from './context-IovtuTf8.js';
|
|
7
|
+
export { A as AgentError, C as Capabilities, a as ConfigError, a3 as ContextInit, a4 as ConversationState, E as ErrorCode, c as ErrorSeverity, d as ErrorSubsystem, I as ImageBlock, J as JSONSchema, M as Message, e as MessageRole, P as Permission, f as PluginError, g as Provider, h as ProviderError, i as ProviderErrorBody, a5 as ReadonlyConversationState, R as Request, j as Response, k as ResumedSession, a6 as RunEnv, a7 as RunOptions, S as SessionData, l as SessionError, m as SessionEvent, n as SessionMetadata, o as SessionStore, p as SessionSummary, q as SessionWriter, a8 as StateChange, a9 as StateChangeHandler, r as StopReason, s as StreamEvent, t as ThinkingBlock, aa as TodoItem, a1 as TokenCounter, u as Tool, v as ToolCallContext, w as ToolError, x as ToolFinalEvent, y as ToolProgressEvent, z as ToolResultBlock, B as ToolStreamEvent, D as ToolUseBlock, U as Usage, W as WrongStackError, F as asBlocks, G as asText, ab as extractRunEnv, H as isAgentError, K as isConfigError, L as isImageBlock, N as isPluginError, O as isSessionError, Q as isTextBlock, V as isThinkingBlock, X as isToolError, Y as isToolResultBlock, Z as isToolUseBlock, _ as isWrongStackError, $ as toWrongStackError, ac as wrapAsState } from './context-IovtuTf8.js';
|
|
8
|
+
export { P as ProviderRunner, R as RunProviderOptions } from './provider-runner-BXuADQqQ.js';
|
|
9
|
+
import { C as Config } from './config-CKLYPkCi.js';
|
|
10
|
+
export { a as ConfigLoader, b as ConfigStore, c as ContextConfig, F as FeaturesConfig, L as LogConfig, M as MCPServerConfig, P as PluginConfig, d as ProviderApiKey, e as ProviderConfig, T as ToolsConfig } from './config-CKLYPkCi.js';
|
|
11
|
+
export { P as PermissionDecision, a as PermissionPolicy, T as TrustPolicy } from './secret-scrubber-CgG2tV2B.js';
|
|
12
|
+
import { e as AttachmentStore, d as AttachmentRef, A as AddAttachmentInput } from './session-reader-CcPi4BQ8.js';
|
|
13
|
+
export { a as Attachment, b as AttachmentKind, c as AttachmentMeta, D as DefaultSessionReader } from './session-reader-CcPi4BQ8.js';
|
|
14
|
+
export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from './secret-scrubber-Cuy5afaQ.js';
|
|
14
15
|
export { D as DefaultLogger, a as DefaultLoggerOptions } from './logger-BH6AE0W9.js';
|
|
15
|
-
export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-
|
|
16
|
+
export { D as DefaultPathResolver, a as DefaultTokenCounter } from './path-resolver-Cl_q0u-R.js';
|
|
16
17
|
import { b as MemoryStore } from './memory-CEXuo7sz.js';
|
|
17
18
|
export { M as MemoryEntry, a as MemoryScope } from './memory-CEXuo7sz.js';
|
|
18
|
-
export { C as CompactorOptions,
|
|
19
|
-
import { a as SkillLoader } from './skill-
|
|
20
|
-
export { S as SkillEntry, b as SkillManifest } from './skill-
|
|
21
|
-
import { S as SystemPromptBuilder, M as ModelCapabilities, B as BuildContext } from './system-prompt-CG9jU5-5.js';
|
|
19
|
+
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, c as buildRecoveryStrategies } from './tool-executor-DKu4A6nB.js';
|
|
20
|
+
import { a as SkillLoader } from './skill-C_7znCIC.js';
|
|
21
|
+
export { S as SkillEntry, b as SkillManifest } from './skill-C_7znCIC.js';
|
|
22
22
|
export { I as InputReader, P as PromptOption } from './input-reader-E-ffP2ee.js';
|
|
23
|
-
import {
|
|
24
|
-
export { A as Agent,
|
|
23
|
+
import { j as SystemPromptContributor, h as SlashCommand, b as PluginAPI, e as PluginPipelines, T as ToolRegistryView, g as ProviderRegistryView, M as MCPRegistryView, i as SlashCommandRegistryView, E as ExtensionRegistry, S as SessionWriterView, a as MetricsSinkView, n as ToolRegistry, o as ProviderRegistry, P as Plugin } from './index-BDb0cAMP.js';
|
|
24
|
+
export { A as AfterIterationHook, p as AfterRunHook, q as AfterToolExecutionHook, r as Agent, s as AgentExtension, t as AgentInit, u as AgentInput, v as AgentPipelines, B as BeforeIterationHook, w as BeforeRunHook, x as BeforeToolExecutionHook, D as DEFAULT_MAX_ITERATIONS, O as OnErrorHook, c as PluginCapabilities, d as PluginDependency, y as ProviderFactory, z as ProviderRunnerWrapper, R as RunResult, C as ToolWrapper, U as UserInputPayload, F as createDefaultPipelines } from './index-BDb0cAMP.js';
|
|
25
25
|
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from './models-registry-DqzwpBQy.js';
|
|
26
26
|
import { c as ModeStore } from './mode-CV077NjV.js';
|
|
27
27
|
export { D as DEFAULT_MODES, M as Mode, a as ModeConfig, b as ModeManifest } from './mode-CV077NjV.js';
|
|
28
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-
|
|
29
|
-
export {
|
|
28
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from './agent-bridge-C3DUGjSb.js';
|
|
29
|
+
export { n as BudgetExceededError, o as BudgetKind, p as BudgetLimits, q as BudgetUsage, C as CoordinatorEvents, a as CoordinatorStatus, D as DoneCondition, M as MultiAgentConfig, b as MultiAgentCoordinator, S as SpawnResult, r as SubagentBudget, c as SubagentConfig, d as SubagentContext, e as SubagentError, f as SubagentErrorKind, g as SubagentRunContext, h as SubagentRunOutcome, i as SubagentRunner, T as TaskDelegation, j as TaskResult, k as TaskSpec } from './multi-agent-B9a6sflH.js';
|
|
30
30
|
export { C as CriticalPathResult, D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification, T as TaskAssignment, i as TaskDependency, j as TaskEdge, k as TaskFilter, l as TaskGraph, m as TaskNode, n as TaskPriority, o as TaskProgress, p as TaskSort, q as TaskStatus, r as TaskType, s as computeTaskProgress, t as findCriticalPath, u as topologicalSort } from './task-graph-BITvWt4t.js';
|
|
31
31
|
export { A as AggregateHealth, H as HealthCheck, a as HealthCheckResult, b as HealthRegistry, c as HealthStatus, M as MetricLabels, d as MetricSeries, e as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from './observability-BhnVLBLS.js';
|
|
32
32
|
export { AtomicWriteOptions, BuildChildEnvOptions, NewlineStyle, SafeParseResult, ToolOutputSerializerOptions, UnifiedDiffOptions, ValidationError, ValidationResult, atomicWrite, buildChildEnv, color, compileGlob, createToolOutputSerializer, detectNewlineStyle, ensureDir, estimateTextTokens, estimateToolInputTokens, estimateToolResultTokens, formatTodosList, matchAny, matchGlob, normalizeToLf, safeParse, safeStringify, sanitizeJsonString, stripAnsi, toStyle, unifiedDiff, validateAgainstSchema } from './utils/index.js';
|
|
@@ -34,18 +34,19 @@ export { W as WstackPathOptions, a as WstackPaths, p as projectHash, r as resolv
|
|
|
34
34
|
export { AbandonedSession, AttachmentStoreOptions, ConfigLoaderOptions, ConfigMigration, ConfigMigrationError, ConfigSource, DEFAULT_CONFIG_MIGRATIONS, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultMemoryStore, DefaultSessionStore, DirectorStateCheckpoint, DirectorStateSnapshot, DirectorSubagentState, DirectorTaskState, MemoryStoreOptions, MigrationContext, MigrationResult, PersistedQueueItem, PlanFile, PlanItem, QueueStore, RecoveryLock, RecoveryLockOptions, SessionAnalyzer, SessionStoreOptions, TodosCheckpointFile, addPlanItem, attachPlanCheckpoint, attachTodosCheckpoint, clearPlan, emptyPlan, formatPlan, loadDirectorState, loadPlan, loadTodosCheckpoint, removePlanItem, runConfigMigrations, savePlan, saveTodosCheckpoint, setPlanItemStatus } from './storage/index.js';
|
|
35
35
|
export { AutoApprovePermissionPolicy, DefaultPermissionPolicy, PermissionPolicyOptions } from './security/index.js';
|
|
36
36
|
export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, IntelligentCompactor, IntelligentCompactorOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions } from './execution/index.js';
|
|
37
|
+
export { DefaultProviderRunner } from './defaults/index.js';
|
|
37
38
|
export { ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, AgentFactory, AgentFactoryResult, AgentRunnerOptions, BUG_HUNTER_AGENT, CreateDelegateToolOptions, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_SUBAGENT_BASELINE, DefaultMultiAgentCoordinator, DelegateHost, Director, DirectorBudgetError, DirectorPromptParts, DirectorSessionFactory, DirectorSessionFactoryOptions, FLEET_ROSTER, FleetBus, FleetEvent, FleetHandler, FleetUsage, FleetUsageAggregator, MultiAgentCoordinatorOptions, REFACTOR_PLANNER_AGENT, SECURITY_SCANNER_AGENT, SubagentPromptParts, SubagentUsageSnapshot, composeDirectorPrompt, composeSubagentPrompt, createDelegateTool, makeAgentSubagentRunner, makeDirectorSessionFactory, rosterSummaryFromConfigs } from './coordination/index.js';
|
|
38
39
|
export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
|
|
39
40
|
export { DefaultTaskStore, GeneratedTask, SpecDrivenDev, SpecDrivenDevOptions, SpecParser, TaskFlow, TaskFlowEventMap, TaskFlowEventName, TaskFlowExecutionContext, TaskFlowOptions, TaskFlowPhase, TaskGenerator, TaskGeneratorOptions, TaskStore, TaskTracker, TaskTrackerOptions, TaskTransition } from './sdd/index.js';
|
|
40
41
|
export { DefaultHealthRegistry, InMemoryMetricsSink, MetricsServerHandle, MetricsServerOptions, NoopMetricsSink, NoopTracer, OTelTracer, OtlpMetricsExporterHandle, OtlpMetricsExporterOptions, OtlpTraceExporterHandle, OtlpTraceExporterOptions, PROMETHEUS_CONTENT_TYPE, buildOtlpMetricsRequest, buildOtlpTracesRequest, renderPrometheus, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, wireMetricsToEvents } from './observability/index.js';
|
|
41
|
-
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, s as sentinelServer, o as slackServer } from './mcp-servers-
|
|
42
|
+
export { C as ContextManagerAction, a as ContextManagerInput, b as ContextManagerResult, c as ContextManagerToolOptions, d as allServers, e as awsServer, f as blockServer, g as braveSearchServer, h as context7Server, i as contextManagerTool, j as createContextManagerTool, k as everArtServer, l as filesystemServer, m as githubServer, n as googleMapsServer, s as sentinelServer, o as slackServer } from './mcp-servers-DR35ojJZ.js';
|
|
42
43
|
import { L as Logger } from './logger-BMQgxvdy.js';
|
|
43
44
|
export { a as LogLevel } from './logger-BMQgxvdy.js';
|
|
44
45
|
export { a as ModelsDevPayload, c as ModelsDevProvider, M as ModelsRegistry, b as ResolvedModel, R as ResolvedProvider, W as WireFamily } from './models-registry-Y2xbog0E.js';
|
|
45
46
|
export { S as SecretVault } from './secret-vault-DoISxaKO.js';
|
|
46
|
-
import './compactor-
|
|
47
|
+
import './compactor-BUU6Zm_3.js';
|
|
47
48
|
import './path-resolver-CPRj4bFY.js';
|
|
48
|
-
import './selector-
|
|
49
|
+
import './selector-wT2fv9Fg.js';
|
|
49
50
|
import 'node:events';
|
|
50
51
|
|
|
51
52
|
interface InputBuilderOptions {
|
|
@@ -138,6 +139,13 @@ interface DefaultSystemPromptBuilderOptions {
|
|
|
138
139
|
* created.
|
|
139
140
|
*/
|
|
140
141
|
planPath?: string | (() => string | undefined);
|
|
142
|
+
/**
|
|
143
|
+
* System prompt contributors — called on every `build()` to inject
|
|
144
|
+
* additional TextBlocks. Use `ExtensionRegistry.listSystemPromptContributors()`
|
|
145
|
+
* or pass a plain array. Contributors are called in order; a throwing
|
|
146
|
+
* contributor is caught and logged without aborting the build.
|
|
147
|
+
*/
|
|
148
|
+
contributors?: readonly SystemPromptContributor[];
|
|
141
149
|
}
|
|
142
150
|
declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
|
|
143
151
|
private readonly opts;
|
|
@@ -178,6 +186,10 @@ declare class SlashCommandRegistry {
|
|
|
178
186
|
*/
|
|
179
187
|
register(cmd: SlashCommand, owner?: string): void;
|
|
180
188
|
unregister(name: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Bulk-register multiple slash commands at once.
|
|
191
|
+
*/
|
|
192
|
+
registerAll(cmds: SlashCommand[], owner?: string): void;
|
|
181
193
|
get(name: string): SlashCommand | undefined;
|
|
182
194
|
ownerOf(name: string): string | undefined;
|
|
183
195
|
list(): SlashCommand[];
|
|
@@ -213,7 +225,30 @@ interface PluginAPIInit {
|
|
|
213
225
|
providerRegistry: ProviderRegistry;
|
|
214
226
|
slashCommandRegistry?: SlashCommandRegistry;
|
|
215
227
|
mcpRegistry?: MCPRegistryView;
|
|
228
|
+
/**
|
|
229
|
+
* The agent's extension registry. Plugins register AgentExtension
|
|
230
|
+
* instances here to hook into agent lifecycle events.
|
|
231
|
+
*/
|
|
232
|
+
extensions?: ExtensionRegistry;
|
|
233
|
+
/**
|
|
234
|
+
* The active session writer. Plugins append custom events here.
|
|
235
|
+
* When not provided, a noop writer is used.
|
|
236
|
+
*/
|
|
237
|
+
sessionWriter?: SessionWriterView;
|
|
238
|
+
/**
|
|
239
|
+
* The host's metrics sink. When set, the plugin gets a scoped view
|
|
240
|
+
* that auto-prefixes metric names with `plugin.<pluginName>.`.
|
|
241
|
+
* When not provided, a noop sink is used.
|
|
242
|
+
*/
|
|
243
|
+
metricsSink?: MetricsSinkView;
|
|
216
244
|
config: Config;
|
|
245
|
+
/**
|
|
246
|
+
* The host's ConfigStore. Used to wire `api.onConfigChange()`.
|
|
247
|
+
* When not provided, `onConfigChange` is a noop.
|
|
248
|
+
*/
|
|
249
|
+
configStore?: {
|
|
250
|
+
watch(cb: (next: unknown, prev: unknown) => void): () => void;
|
|
251
|
+
};
|
|
217
252
|
log: Logger;
|
|
218
253
|
}
|
|
219
254
|
declare class DefaultPluginAPI implements PluginAPI {
|
|
@@ -224,13 +259,21 @@ declare class DefaultPluginAPI implements PluginAPI {
|
|
|
224
259
|
readonly providers: ProviderRegistryView;
|
|
225
260
|
readonly mcp: MCPRegistryView;
|
|
226
261
|
readonly slashCommands: SlashCommandRegistryView;
|
|
262
|
+
readonly extensions: ExtensionRegistry;
|
|
263
|
+
readonly session: SessionWriterView;
|
|
264
|
+
readonly metrics: MetricsSinkView;
|
|
227
265
|
readonly config: Config;
|
|
228
266
|
readonly log: Logger;
|
|
267
|
+
private readonly configStore;
|
|
229
268
|
private readonly pluginCleanupFns;
|
|
230
269
|
constructor(init: PluginAPIInit);
|
|
231
270
|
onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
|
|
271
|
+
onPattern(pattern: string, handler: (event: string, payload: unknown) => void): () => void;
|
|
272
|
+
emitCustom(event: string, payload: unknown): void;
|
|
273
|
+
onConfigChange(handler: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
232
274
|
/** Called by the plugin loader when uninstalling the plugin. */
|
|
233
275
|
drainCleanup(): void;
|
|
276
|
+
registerSystemPromptContributor(c: SystemPromptContributor): () => void;
|
|
234
277
|
}
|
|
235
278
|
|
|
236
279
|
/**
|
|
@@ -266,6 +309,13 @@ interface LoadPluginsOptions {
|
|
|
266
309
|
* `{ [name]: { options } }` or any flat record.
|
|
267
310
|
*/
|
|
268
311
|
pluginOptions?: Record<string, unknown>;
|
|
312
|
+
/**
|
|
313
|
+
* When true, the loader throws a PluginError if a plugin calls an API
|
|
314
|
+
* method that contradicts its declared `capabilities` — instead of
|
|
315
|
+
* just logging a warning. Use in CI/strict deployments to enforce
|
|
316
|
+
* manifest honesty. Default: false (log-only, backward-compatible).
|
|
317
|
+
*/
|
|
318
|
+
enforceCapabilities?: boolean;
|
|
269
319
|
}
|
|
270
320
|
declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promise<{
|
|
271
321
|
loaded: Plugin[];
|
|
@@ -285,4 +335,4 @@ declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promi
|
|
|
285
335
|
*/
|
|
286
336
|
declare function unloadPlugins(loadedPlugins: Plugin[], opts: LoadPluginsOptions): Promise<void>;
|
|
287
337
|
|
|
288
|
-
export { AddAttachmentInput, AttachmentRef, AttachmentStore, BuildContext, Config, Container, ContentBlock, Context, DefaultPluginAPI, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, EventBus, EventName, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, MCPRegistryView, MemoryStore, ModeStore, ModelCapabilities, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, ProviderRegistry, ProviderRegistryView, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, TextBlock, ToolRegistry, ToolRegistryView, loadPlugins, unloadPlugins };
|
|
338
|
+
export { AddAttachmentInput, AttachmentRef, AttachmentStore, BuildContext, Config, Container, ContentBlock, Context, DefaultPluginAPI, DefaultSystemPromptBuilder, type DefaultSystemPromptBuilderOptions, EventBus, EventName, ExtensionRegistry, InputBuilder, type InputBuilderEvent, type InputBuilderOptions, KERNEL_API_VERSION, LAYER_1_IDENTITY, Listener, type LoadPluginsOptions, Logger, MCPRegistryView, MemoryStore, MetricsSinkView, ModeStore, ModelCapabilities, Plugin, PluginAPI, type PluginAPIInit, PluginPipelines, ProviderRegistry, ProviderRegistryView, SessionWriterView, SkillLoader, SlashCommand, SlashCommandRegistry, SlashCommandRegistryView, SystemPromptBuilder, SystemPromptContributor, TextBlock, ToolRegistry, ToolRegistryView, loadPlugins, unloadPlugins };
|