@cuylabs/agent-core 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +33 -17
  2. package/dist/chunk-2O4MCSQS.js +780 -0
  3. package/dist/chunk-2TTOLHBT.js +198 -0
  4. package/dist/chunk-5FMSGQVX.js +281 -0
  5. package/dist/chunk-5NVVNXPQ.js +288 -0
  6. package/dist/{chunk-CAA7FHIH.js → chunk-6HZBHFOL.js} +3 -103
  7. package/dist/chunk-CJI7PVS2.js +58 -0
  8. package/dist/{chunk-N6HWIEEA.js → chunk-CMYN2RCB.js} +278 -61
  9. package/dist/chunk-FII65CN7.js +117 -0
  10. package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
  11. package/dist/chunk-I6PKJ7XQ.js +292 -0
  12. package/dist/{chunk-BDBZ3SLK.js → chunk-ICZ66572.js} +48 -4
  13. package/dist/chunk-KYLPMBHD.js +316 -0
  14. package/dist/chunk-MXAP4UG6.js +2956 -0
  15. package/dist/{chunk-RZITT45F.js → chunk-N3VX7FEE.js} +39 -6
  16. package/dist/{chunk-YSLSEQ6B.js → chunk-NDZWXCBZ.js} +218 -95
  17. package/dist/{chunk-P6YF7USR.js → chunk-Q742PSH3.js} +23 -38
  18. package/dist/chunk-QAL3OMI3.js +943 -0
  19. package/dist/{chunk-RFEKJKTO.js → chunk-RN6WZEUF.js} +330 -280
  20. package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
  21. package/dist/chunk-SPBFQXOT.js +0 -0
  22. package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
  23. package/dist/chunk-SSFBF3US.js +602 -0
  24. package/dist/chunk-SZ2XBPTW.js +8 -0
  25. package/dist/chunk-T4UIX5D7.js +115 -0
  26. package/dist/chunk-TIHPYVAJ.js +102 -0
  27. package/dist/{chunk-YUUJK53A.js → chunk-TOTDGK3P.js} +1 -1
  28. package/dist/chunk-V4RFNEET.js +563 -0
  29. package/dist/chunk-VOUEJSW6.js +0 -0
  30. package/dist/{chunk-4BDA7DQY.js → chunk-WBPOZ7CL.js} +673 -273
  31. package/dist/chunk-X4VN4GIJ.js +185 -0
  32. package/dist/dispatch/index.d.ts +93 -0
  33. package/dist/dispatch/index.js +37 -0
  34. package/dist/events/index.d.ts +93 -0
  35. package/dist/events/index.js +6 -0
  36. package/dist/{runtime → execution}/index.d.ts +120 -34
  37. package/dist/{runtime → execution}/index.js +18 -13
  38. package/dist/index-BCqEGzBj.d.ts +251 -0
  39. package/dist/index.d.ts +490 -122
  40. package/dist/index.js +2104 -615
  41. package/dist/{errors → inference/errors}/index.d.ts +2 -2
  42. package/dist/{errors → inference/errors}/index.js +1 -1
  43. package/dist/inference/index.d.ts +16 -23
  44. package/dist/inference/index.js +45 -16
  45. package/dist/instance-BqV2D5pc.d.ts +5723 -0
  46. package/dist/logger/index.d.ts +50 -0
  47. package/dist/logger/index.js +11 -0
  48. package/dist/mcp/index.d.ts +5 -9
  49. package/dist/mcp/index.js +2 -3
  50. package/dist/middleware/index.d.ts +10 -149
  51. package/dist/middleware/index.js +11 -3
  52. package/dist/model-messages-B4nK9D1-.d.ts +13 -0
  53. package/dist/models/index.d.ts +23 -18
  54. package/dist/models/index.js +48 -11
  55. package/dist/models/reasoning/index.d.ts +4 -0
  56. package/dist/{reasoning → models/reasoning}/index.js +3 -3
  57. package/dist/plugin/index.d.ts +458 -0
  58. package/dist/plugin/index.js +32 -0
  59. package/dist/profiles/index.d.ts +55 -0
  60. package/dist/profiles/index.js +30 -0
  61. package/dist/prompt/index.d.ts +8 -12
  62. package/dist/prompt/index.js +3 -2
  63. package/dist/safety/index.d.ts +109 -14
  64. package/dist/safety/index.js +59 -3
  65. package/dist/sandbox/index.d.ts +81 -0
  66. package/dist/sandbox/index.js +1 -0
  67. package/dist/skill/index.d.ts +10 -8
  68. package/dist/skill/index.js +3 -3
  69. package/dist/storage/index.d.ts +12 -4
  70. package/dist/storage/index.js +1 -1
  71. package/dist/subagents/index.d.ts +177 -0
  72. package/dist/subagents/index.js +78 -0
  73. package/dist/team/index.d.ts +544 -0
  74. package/dist/team/index.js +41 -0
  75. package/dist/tool/host/index.d.ts +41 -0
  76. package/dist/tool/host/index.js +10 -0
  77. package/dist/tool/index.d.ts +125 -21
  78. package/dist/tool/index.js +20 -13
  79. package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
  80. package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
  81. package/dist/types-RSCv7nQ4.d.ts +59 -0
  82. package/package.json +58 -53
  83. package/dist/builder-UpOWQMW3.d.ts +0 -34
  84. package/dist/chunk-7MUFEN4K.js +0 -559
  85. package/dist/chunk-7VKQ4WPB.js +0 -73
  86. package/dist/chunk-BFM2YHNM.js +0 -222
  87. package/dist/chunk-DWYX7ASF.js +0 -26
  88. package/dist/chunk-KUVSERLJ.js +0 -50
  89. package/dist/chunk-N7P4PN3O.js +0 -84
  90. package/dist/chunk-SDSBEQXG.js +0 -157
  91. package/dist/chunk-SQU2AJHO.js +0 -305
  92. package/dist/chunk-VBWWUHWI.js +0 -724
  93. package/dist/chunk-VEKUXUVF.js +0 -41
  94. package/dist/chunk-VNQBHPCT.js +0 -398
  95. package/dist/chunk-WWYYNWEW.js +0 -259
  96. package/dist/context/index.d.ts +0 -259
  97. package/dist/context/index.js +0 -26
  98. package/dist/events-CE72w8W4.d.ts +0 -149
  99. package/dist/host/index.d.ts +0 -45
  100. package/dist/host/index.js +0 -8
  101. package/dist/index-CWSchSql.d.ts +0 -1058
  102. package/dist/messages-BYWGn8TY.d.ts +0 -110
  103. package/dist/presets/index.d.ts +0 -53
  104. package/dist/presets/index.js +0 -28
  105. package/dist/reasoning/index.d.ts +0 -116
  106. package/dist/registry-DwYqsQkX.d.ts +0 -164
  107. package/dist/runner-e2YRcUoX.d.ts +0 -786
  108. package/dist/scope/index.d.ts +0 -10
  109. package/dist/scope/index.js +0 -14
  110. package/dist/session-manager-B_CWGTsl.d.ts +0 -274
  111. package/dist/signal/index.d.ts +0 -28
  112. package/dist/signal/index.js +0 -6
  113. package/dist/sub-agent/index.d.ts +0 -23
  114. package/dist/sub-agent/index.js +0 -15
  115. package/dist/tool-BHbyUAy3.d.ts +0 -150
  116. package/dist/tool-DLXAR9Ce.d.ts +0 -145
  117. package/dist/tracker-DClqYqTj.d.ts +0 -96
  118. package/dist/tracking/index.d.ts +0 -111
  119. package/dist/tracking/index.js +0 -20
  120. package/dist/types-BfNpU8NS.d.ts +0 -270
  121. package/dist/types-BnpEOYV-.d.ts +0 -50
  122. package/dist/types-CQL-SvTn.d.ts +0 -29
  123. package/dist/types-CWm-7rvB.d.ts +0 -55
  124. package/dist/types-KKDrdU9Y.d.ts +0 -325
  125. package/dist/types-QA4WhEfz.d.ts +0 -138
  126. package/dist/types-QKHHQLLq.d.ts +0 -336
  127. package/dist/types-YuWV4ag7.d.ts +0 -72
@@ -0,0 +1,458 @@
1
+ import { T as Tool, L as AgentMiddleware, c5 as PromptSection } from '../instance-BqV2D5pc.js';
2
+ import { ZodType } from 'zod';
3
+ import { Jiti } from 'jiti';
4
+ import '../types-C_LCeYNg.js';
5
+ import 'ai';
6
+ import '../types-RSCv7nQ4.js';
7
+ import '../types-CQaXbRsS.js';
8
+ import '../types-Bj_J8u_W.js';
9
+ import '@ai-sdk/provider-utils';
10
+ import '../sandbox/index.js';
11
+ import '../llm-error-D93FNNLY.js';
12
+
13
+ /**
14
+ * PluginEventBus — string-keyed pub/sub for inter-plugin communication.
15
+ *
16
+ * Channel names are namespaced by convention:
17
+ * "finance:transaction-created", "crm:contact-updated".
18
+ */
19
+ /** Remove a previously registered listener. */
20
+ type PluginUnsubscribe = () => void;
21
+ /** Listener function for a specific channel. */
22
+ type PluginEventHandler = (data: unknown) => void;
23
+ /**
24
+ * Minimal event bus interface. Plugins depend only on this.
25
+ */
26
+ interface PluginEventBusAPI {
27
+ emit(channel: string, data: unknown): void;
28
+ on(channel: string, handler: PluginEventHandler): PluginUnsubscribe;
29
+ }
30
+ /**
31
+ * In-process event bus. Dispatches synchronously.
32
+ * Listener errors are caught silently.
33
+ */
34
+ declare class PluginEventBus implements PluginEventBusAPI {
35
+ private readonly channels;
36
+ emit(channel: string, data: unknown): void;
37
+ on(channel: string, handler: PluginEventHandler): PluginUnsubscribe;
38
+ /** Number of active channels. */
39
+ get size(): number;
40
+ /** Remove all listeners. */
41
+ clear(): void;
42
+ }
43
+
44
+ /**
45
+ * Plugin types — contracts for the extension system.
46
+ *
47
+ * Plugins contribute tools, middleware, commands, prompt sections,
48
+ * and lifecycle hooks to an agent without coupling to a specific host.
49
+ */
50
+
51
+ /** Static metadata about a plugin (from package.json or inline). */
52
+ interface PluginCompatibility {
53
+ /** Expected plugin API version supported by the host (exact match). */
54
+ apiVersion?: string;
55
+ /** Supported Node.js version range (supports exact or comparator syntax). */
56
+ node?: string;
57
+ }
58
+ /** Host-readable capability tags such as "workspace", "session", or "network". */
59
+ type PluginCapabilityTag = string;
60
+ /**
61
+ * Static surface contract for a plugin.
62
+ *
63
+ * This keeps the server/plugin boundary explicit: plugin behavior is headless
64
+ * by default, and any future UI surface must remain a separate client concern.
65
+ */
66
+ interface PluginSurfaceContract {
67
+ tools?: boolean;
68
+ middleware?: boolean;
69
+ commands?: boolean;
70
+ promptSections?: boolean;
71
+ lifecycle?: boolean;
72
+ ui?: "none" | "separate-client-extension";
73
+ }
74
+ interface PluginManifest {
75
+ /** Unique plugin identifier (e.g. "brave-search", "finance") */
76
+ id: string;
77
+ /** Human-readable display name */
78
+ name?: string;
79
+ /** Short description */
80
+ description?: string;
81
+ /** SemVer string */
82
+ version?: string;
83
+ /** Compatibility requirements validated by the host at load time. */
84
+ compatibility?: PluginCompatibility;
85
+ /** Host-readable business capability tags. */
86
+ capabilities?: PluginCapabilityTag[];
87
+ /** Explicit contract for which host-owned surfaces this plugin contributes to. */
88
+ surfaces?: PluginSurfaceContract;
89
+ }
90
+ /**
91
+ * Host-readable metadata for a plugin command.
92
+ *
93
+ * This is the sanctioned way to enrich command discovery and routing without
94
+ * coupling plugins to a specific renderer or UI widget system.
95
+ */
96
+ interface PluginCommandMetadata {
97
+ /** Grouping hint for help views, palettes, and command inventories. */
98
+ category?: string;
99
+ /** Short argument hint shown in usage/help surfaces. */
100
+ argsHint?: string;
101
+ /** Host-readable capability tags such as "workspace", "session", or "network". */
102
+ capabilities?: PluginCapabilityTag[];
103
+ }
104
+ /**
105
+ * A user-facing command registered by a plugin.
106
+ *
107
+ * Commands are intentionally host-surfaced, not renderer-owned UI. Plugins
108
+ * should return results and metadata here instead of trying to reach into TUI
109
+ * or web implementation details.
110
+ */
111
+ interface PluginCommand {
112
+ /** Command name (without leading slash) */
113
+ name: string;
114
+ /** Optional aliases */
115
+ alias?: string[];
116
+ /** One-line description shown in help */
117
+ summary: string;
118
+ /** Execute the command. Return the text to display, or null for silent. */
119
+ execute: (args: string) => Promise<string | null>;
120
+ /** Optional host-readable metadata for richer discovery and routing. */
121
+ metadata?: PluginCommandMetadata;
122
+ }
123
+ type PluginSettingsSchema<T = unknown> = ZodType<T>;
124
+ interface PluginSettingsDefinition<T = unknown> {
125
+ /** Settings namespace. Defaults to the plugin ID. */
126
+ namespace?: string;
127
+ /** Whether missing settings are allowed. Defaults to true. */
128
+ optional?: boolean;
129
+ /** Zod schema used to validate the resolved settings object. */
130
+ schema: PluginSettingsSchema<T>;
131
+ }
132
+ /** Namespace-isolated config access. The host injects the implementation. */
133
+ interface PluginSettingsProvider {
134
+ /**
135
+ * Read the config value for a given namespace.
136
+ *
137
+ * @param namespace Plugin's config key (e.g. "brave-search")
138
+ * @returns The config object, or undefined if not configured.
139
+ */
140
+ get<T = unknown>(namespace: string): T | undefined;
141
+ /**
142
+ * Read and validate a namespace with a schema.
143
+ *
144
+ * Returns undefined when the namespace is not configured.
145
+ */
146
+ parse<T>(namespace: string, schema: PluginSettingsSchema<T>): T | undefined;
147
+ /**
148
+ * Read and validate a namespace with a schema.
149
+ *
150
+ * Throws when the namespace is missing or invalid.
151
+ */
152
+ require<T>(namespace: string, schema: PluginSettingsSchema<T>): T;
153
+ }
154
+ /** Session lifecycle hooks a plugin can register. */
155
+ interface PluginLifecycleHooks {
156
+ activate?: (ctx: PluginSessionContext) => Promise<void> | void;
157
+ deactivate?: () => Promise<void> | void;
158
+ }
159
+ /** Context available during plugin activation. */
160
+ interface PluginSessionContext {
161
+ /** Agent's working directory */
162
+ cwd: string;
163
+ /** Session ID (if session-based) */
164
+ sessionId?: string;
165
+ }
166
+ /** The API surface passed to a plugin's entry function. */
167
+ interface PluginContext {
168
+ /** Working directory of the agent (project root) */
169
+ cwd: string;
170
+ /** Plugin's own manifest (id, name, version). Read-only. */
171
+ manifest: Readonly<PluginManifest>;
172
+ /** Register a tool the LLM can call */
173
+ addTool(tool: Tool.AnyInfo): void;
174
+ /** Register middleware (model hooks, tool guards, prompt sections) */
175
+ addMiddleware(mw: AgentMiddleware): void;
176
+ /** Register a user-facing command (host-dependent) */
177
+ addCommand(cmd: PluginCommand): void;
178
+ /** Add a dynamic prompt section injected at system-prompt build time. */
179
+ addPromptSection(section: PromptSection): void;
180
+ /** Inter-plugin event bus (string-keyed pub/sub). */
181
+ events: PluginEventBus;
182
+ /** Plugin-namespaced settings from the host. */
183
+ settings: PluginSettingsProvider;
184
+ /** Register an activation hook (fires when the agent session starts). */
185
+ onActivate(fn: (ctx: PluginSessionContext) => Promise<void> | void): void;
186
+ /** Register a deactivation hook (fires when the agent session ends). */
187
+ onDeactivate(fn: () => Promise<void> | void): void;
188
+ }
189
+ /** The function shape a plugin file must default-export. */
190
+ type PluginInit = (ctx: PluginContext) => void | Promise<void>;
191
+ /** Aggregated contributions from all loaded plugins. */
192
+ interface PluginContributions {
193
+ /** Tools to add to the agent's tool set */
194
+ tools: Tool.AnyInfo[];
195
+ /** Middleware to prepend to the agent's middleware stack */
196
+ middleware: AgentMiddleware[];
197
+ /** User-facing commands (host-dependent surfacing) */
198
+ commands: PluginCommand[];
199
+ /** Dynamic prompt sections */
200
+ promptSections: PromptSection[];
201
+ /** Loader / plugin errors (non-fatal — the rest of the system keeps working) */
202
+ errors: Array<{
203
+ pluginId: string;
204
+ error: string;
205
+ }>;
206
+ }
207
+
208
+ /**
209
+ * Plugin settings — namespace-isolated layered configuration.
210
+ */
211
+
212
+ /** Settings provider that always returns undefined. */
213
+ declare class NullSettings implements PluginSettingsProvider {
214
+ get<T = unknown>(_namespace: string): T | undefined;
215
+ parse<T>(_namespace: string, _schema: PluginSettingsSchema<T>): T | undefined;
216
+ require<T>(namespace: string, _schema: PluginSettingsSchema<T>): T;
217
+ }
218
+ /** Settings provider backed by a plain object. Top-level keys are plugin namespaces. */
219
+ declare class StaticSettings implements PluginSettingsProvider {
220
+ private readonly data;
221
+ constructor(data: Record<string, unknown>);
222
+ get<T = unknown>(namespace: string): T | undefined;
223
+ parse<T>(namespace: string, schema: PluginSettingsSchema<T>): T | undefined;
224
+ require<T>(namespace: string, schema: PluginSettingsSchema<T>): T;
225
+ }
226
+ /** Merges multiple settings sources in priority order (later layers win). */
227
+ declare class LayeredSettings implements PluginSettingsProvider {
228
+ private readonly layers;
229
+ constructor(layers: PluginSettingsProvider[]);
230
+ get<T = unknown>(namespace: string): T | undefined;
231
+ parse<T>(namespace: string, schema: PluginSettingsSchema<T>): T | undefined;
232
+ require<T>(namespace: string, schema: PluginSettingsSchema<T>): T;
233
+ }
234
+ /** Wraps a provider with validated overrides for specific namespaces. */
235
+ declare class ValidatedSettings implements PluginSettingsProvider {
236
+ private readonly base;
237
+ private readonly overrides;
238
+ constructor(base: PluginSettingsProvider, overrides: Record<string, unknown>);
239
+ get<T = unknown>(namespace: string): T | undefined;
240
+ parse<T>(namespace: string, schema: PluginSettingsSchema<T>): T | undefined;
241
+ require<T>(namespace: string, schema: PluginSettingsSchema<T>): T;
242
+ }
243
+
244
+ /**
245
+ * Plugin loader — filesystem discovery and dynamic import via jiti.
246
+ *
247
+ * Scans `.cuylabs/plugins/` and explicit paths for plugin entries.
248
+ * Files starting with `_` are ignored. Each plugin must default-export
249
+ * a PluginInit function.
250
+ *
251
+ * Uses jiti for TypeScript-native loading — users drop raw `.ts` files
252
+ * and they work without a build step. Transpiled output is cached to
253
+ * disk for fast subsequent loads.
254
+ *
255
+ * Framework packages (`@cuylabs/*`) are auto-aliased so plugins can
256
+ * `import { ... } from "@cuylabs/agent-core"` without any user config.
257
+ * Resolution uses `import.meta.resolve` (ESM standard) with a monorepo
258
+ * workspace fallback for development.
259
+ */
260
+
261
+ /** Options for configuring the plugin loader's jiti instance. */
262
+ interface PluginLoaderOptions {
263
+ /** Extra module aliases (e.g. `{ "@my-lib": "./src/lib" }`). */
264
+ alias?: Record<string, string>;
265
+ /** Modules to skip transforming (already compiled). */
266
+ nativeModules?: string[];
267
+ /** Enable source maps in error stacks (default: true). */
268
+ sourceMaps?: boolean;
269
+ /** Enable jiti debug logging (default: false). */
270
+ debug?: boolean;
271
+ /**
272
+ * Disable automatic `@cuylabs/*` alias resolution.
273
+ * When false, plugins must resolve framework packages on their own.
274
+ * @default true
275
+ */
276
+ autoAlias?: boolean;
277
+ }
278
+ /**
279
+ * Auto-resolve `@cuylabs/*` packages to their filesystem paths.
280
+ *
281
+ * Uses two strategies in order:
282
+ * 1. `import.meta.resolve(specifier)` — standard ESM resolution.
283
+ * Works when packages are in node_modules (installed via npm/pnpm).
284
+ * 2. Monorepo workspace fallback — walk up from this file to find
285
+ * the workspace root, then check `packages/<name>/dist/index.js`.
286
+ *
287
+ * Results are cached for the process lifetime.
288
+ */
289
+ declare function resolveFrameworkAliases(): Record<string, string>;
290
+ /** Reset cached framework aliases (for testing). */
291
+ declare function resetFrameworkAliases(): void;
292
+ /** Get or create a shared jiti instance for plugin loading. */
293
+ declare function getPluginLoader(options?: PluginLoaderOptions): Jiti;
294
+ /** Reset the shared jiti instance (for testing). */
295
+ declare function resetPluginLoader(): void;
296
+ /** A discovered plugin file with its resolved entry path and manifest. */
297
+ interface DiscoveredPlugin {
298
+ entryPath: string;
299
+ manifest: PluginManifest;
300
+ }
301
+ /** Discover plugin files on disk from convention dir and explicit paths. */
302
+ declare function discoverPlugins(cwd: string, extraPaths?: string[]): Promise<DiscoveredPlugin[]>;
303
+ /** Dynamically import a plugin file and extract its init function. */
304
+ declare function loadPluginModule(entryPath: string, options?: PluginLoaderOptions): Promise<PluginInit>;
305
+
306
+ /**
307
+ * Declarative plugin authoring — `definePlugin()`.
308
+ *
309
+ * Converts a static plugin definition into a `PluginInit` function.
310
+ * The registry and imperative layer stay unchanged; this is sugar
311
+ * that makes plugins inspectable, type-safe, and easier to author.
312
+ */
313
+
314
+ /** Declarative plugin definition passed to `definePlugin()`. */
315
+ interface PluginDefinition {
316
+ /** Unique plugin identifier. */
317
+ id: string;
318
+ /** Human-readable display name. */
319
+ name?: string;
320
+ /** Short description. */
321
+ description?: string;
322
+ /** SemVer string. */
323
+ version?: string;
324
+ /** Host/runtime compatibility validated before the plugin is committed. */
325
+ compatibility?: PluginCompatibility;
326
+ /** Host-readable business capability tags for catalogs and inventories. */
327
+ capabilities?: PluginCapabilityTag[];
328
+ /** Explicit contract for the host-owned surfaces this plugin contributes to. */
329
+ surfaces?: PluginSurfaceContract;
330
+ /** Optional settings schema to validate before the plugin is committed. */
331
+ settings?: PluginSettingsDefinition;
332
+ /** Tools the LLM can call. Statically declared — inspectable without execution. */
333
+ tools?: Tool.AnyInfo[];
334
+ /** Middleware hooks (model I/O, tool guards, prompt sections). */
335
+ middleware?: AgentMiddleware[];
336
+ /** User-facing commands. */
337
+ commands?: PluginCommand[];
338
+ /** Dynamic prompt sections injected at system-prompt build time. */
339
+ promptSections?: PromptSection[];
340
+ /**
341
+ * Imperative activation hook — runs when the agent session starts.
342
+ * Use for dynamic setup that can't be expressed declaratively
343
+ * (starting servers, loading config, managing state).
344
+ */
345
+ activate?: (ctx: PluginActivateContext) => Promise<void> | void;
346
+ /**
347
+ * Imperative deactivation hook — runs when the agent session ends.
348
+ */
349
+ deactivate?: () => Promise<void> | void;
350
+ /**
351
+ * Full imperative escape hatch — runs during plugin loading.
352
+ * Receives the raw PluginContext for anything the declarative
353
+ * fields can't express. Runs after all declarative contributions
354
+ * have been registered.
355
+ */
356
+ setup?: (ctx: PluginContext) => void | Promise<void>;
357
+ }
358
+ /** Context passed to the declarative `activate` hook. */
359
+ interface PluginActivateContext extends PluginSessionContext {
360
+ /** The plugin's own event bus. */
361
+ events: PluginContext["events"];
362
+ /** The plugin's settings provider. */
363
+ settings: PluginContext["settings"];
364
+ }
365
+ /**
366
+ * Create a plugin from a declarative definition.
367
+ *
368
+ * Returns a `PluginInit` function that the registry executes normally.
369
+ * The definition object is attached as `init.__definition` so the
370
+ * registry can inspect it without running the plugin.
371
+ */
372
+ declare function definePlugin(def: PluginDefinition): PluginInit;
373
+ /** A PluginInit created by `definePlugin()` — carries the static definition. */
374
+ interface DefinePluginInit extends PluginInit {
375
+ __definition: PluginDefinition;
376
+ }
377
+ /** Type guard: check if a PluginInit was created by `definePlugin()`. */
378
+ declare function isDefinedPlugin(init: PluginInit): init is DefinePluginInit;
379
+
380
+ /**
381
+ * PluginRegistry — orchestrates the full plugin lifecycle.
382
+ *
383
+ * `loadAll` → `activate` → (agent runs) → `deactivate`.
384
+ * Owns the shared PluginEventBus and wires isolated PluginContext per plugin.
385
+ */
386
+
387
+ interface PluginRegistryCompatibilityOptions {
388
+ /** Supported plugin API version (exact match). */
389
+ apiVersion?: string;
390
+ /** Runtime Node.js version. Defaults to the current process version. */
391
+ nodeVersion?: string;
392
+ }
393
+ interface PluginRegistryTimeoutOptions {
394
+ /** Maximum time allowed for a plugin init function. */
395
+ load?: number | false;
396
+ /** Maximum time allowed per activation hook. */
397
+ activate?: number | false;
398
+ /** Maximum time allowed per deactivation hook. */
399
+ deactivate?: number | false;
400
+ }
401
+ interface PluginRegistryOptions {
402
+ /** Settings provider. Defaults to NullSettings (no config). */
403
+ settings?: PluginSettingsProvider;
404
+ /** Shared event bus. A fresh one is created if omitted. */
405
+ events?: PluginEventBus;
406
+ /** Options for the jiti-powered plugin loader. */
407
+ loader?: PluginLoaderOptions;
408
+ /** Host compatibility context used to reject incompatible plugins. */
409
+ compatibility?: PluginRegistryCompatibilityOptions;
410
+ /** Timeouts applied to init and lifecycle hooks. */
411
+ timeouts?: PluginRegistryTimeoutOptions;
412
+ }
413
+ declare class PluginRegistry {
414
+ private readonly settings;
415
+ private readonly eventBus;
416
+ private readonly loaderOptions;
417
+ private readonly compatibilityContext;
418
+ private readonly timeouts;
419
+ private readonly plugins;
420
+ private readonly pluginIds;
421
+ private readonly commandOwners;
422
+ private readonly commandTokens;
423
+ private readonly _contributions;
424
+ private activated;
425
+ private activeSessionContext?;
426
+ constructor(options?: PluginRegistryOptions);
427
+ /** The shared event bus wired to all loaded plugins. */
428
+ get events(): PluginEventBus;
429
+ /** Read-only view of everything plugins have contributed. */
430
+ get contributions(): Readonly<PluginContributions>;
431
+ /** Number of successfully loaded plugins. */
432
+ get pluginCount(): number;
433
+ /** Get the static definition for a plugin (if it used `definePlugin()`). */
434
+ getDefinition(pluginId: string): PluginDefinition | undefined;
435
+ /** Get all static definitions (only for declarative plugins). */
436
+ get definitions(): ReadonlyArray<Readonly<PluginDefinition>>;
437
+ /** Get the plugin ID that contributed a command. */
438
+ getCommandOwner(command: PluginCommand): string | undefined;
439
+ /** Record a host-level plugin error without throwing. */
440
+ recordError(pluginId: string, error: string): void;
441
+ /** Discover, load, and execute all plugins. */
442
+ loadAll(cwd: string, extraPaths?: string[]): Promise<void>;
443
+ /** Load a single plugin from its init function (programmatic / tests). */
444
+ loadOne(init: PluginInit, manifest: PluginManifest, cwd: string, entryPath?: string): Promise<void>;
445
+ /** Fire `onActivate` hooks sequentially in load order. */
446
+ activate(ctx: PluginSessionContext): Promise<void>;
447
+ /** Fire `onDeactivate` hooks in reverse load order. */
448
+ deactivate(): Promise<void>;
449
+ private executePlugin;
450
+ private resolvePluginSettings;
451
+ private findCommandConflict;
452
+ private checkCommandTokenConflict;
453
+ private commitPlugin;
454
+ private runActivateHooks;
455
+ private runDeactivateHooks;
456
+ }
457
+
458
+ export { type DefinePluginInit, type DiscoveredPlugin, LayeredSettings, NullSettings, type PluginActivateContext, type PluginCapabilityTag, type PluginCommand, type PluginCommandMetadata, type PluginCompatibility, type PluginContext, type PluginContributions, type PluginDefinition, PluginEventBus, type PluginEventBusAPI, type PluginEventHandler, type PluginInit, type PluginLifecycleHooks, type PluginLoaderOptions, type PluginManifest, PluginRegistry, type PluginRegistryCompatibilityOptions, type PluginRegistryOptions, type PluginRegistryTimeoutOptions, type PluginSessionContext, type PluginSettingsDefinition, type PluginSettingsProvider, type PluginSettingsSchema, type PluginSurfaceContract, type PluginUnsubscribe, StaticSettings, ValidatedSettings, definePlugin, discoverPlugins, getPluginLoader, isDefinedPlugin, loadPluginModule, resetFrameworkAliases, resetPluginLoader, resolveFrameworkAliases };
@@ -0,0 +1,32 @@
1
+ import {
2
+ LayeredSettings,
3
+ NullSettings,
4
+ PluginEventBus,
5
+ PluginRegistry,
6
+ StaticSettings,
7
+ ValidatedSettings,
8
+ definePlugin,
9
+ discoverPlugins,
10
+ getPluginLoader,
11
+ isDefinedPlugin,
12
+ loadPluginModule,
13
+ resetFrameworkAliases,
14
+ resetPluginLoader,
15
+ resolveFrameworkAliases
16
+ } from "../chunk-QAL3OMI3.js";
17
+ export {
18
+ LayeredSettings,
19
+ NullSettings,
20
+ PluginEventBus,
21
+ PluginRegistry,
22
+ StaticSettings,
23
+ ValidatedSettings,
24
+ definePlugin,
25
+ discoverPlugins,
26
+ getPluginLoader,
27
+ isDefinedPlugin,
28
+ loadPluginModule,
29
+ resetFrameworkAliases,
30
+ resetPluginLoader,
31
+ resolveFrameworkAliases
32
+ };
@@ -0,0 +1,55 @@
1
+ import { T as Tool, c2 as Profile, aa as AppliedProfile } from '../instance-BqV2D5pc.js';
2
+ import '../types-C_LCeYNg.js';
3
+ import 'ai';
4
+ import '../types-RSCv7nQ4.js';
5
+ import 'zod';
6
+ import '../types-CQaXbRsS.js';
7
+ import '../types-Bj_J8u_W.js';
8
+ import '@ai-sdk/provider-utils';
9
+ import '../sandbox/index.js';
10
+ import '../llm-error-D93FNNLY.js';
11
+
12
+ /**
13
+ * Filter tools using profile allow/deny patterns.
14
+ *
15
+ * Explicit allow matches win over deny matches. This lets profiles define a
16
+ * broad deny rule like `"*"` and then carve out a safe allow-list.
17
+ */
18
+ declare function filterTools(tools: Tool.AnyInfo[], options: {
19
+ allow?: string[];
20
+ deny?: string[];
21
+ }): Tool.AnyInfo[];
22
+
23
+ /**
24
+ * Apply a profile to available tools and a parent system prompt.
25
+ */
26
+ declare function applyProfile(profile: Profile, availableTools: Tool.AnyInfo[], baseSystemPrompt?: string): AppliedProfile;
27
+ /**
28
+ * Merge multiple profiles. Later profiles override earlier scalar values.
29
+ */
30
+ declare function mergeProfiles(...profiles: Profile[]): Profile;
31
+ /**
32
+ * Create a custom profile with sensible defaults.
33
+ */
34
+ declare function createProfile(options: Partial<Profile> & {
35
+ name: string;
36
+ }): Profile;
37
+
38
+ declare const explore: Profile;
39
+ declare const plan: Profile;
40
+ declare const review: Profile;
41
+ declare const quick: Profile;
42
+ declare const careful: Profile;
43
+ declare const code: Profile;
44
+ declare const watch: Profile;
45
+ declare const Profiles: {
46
+ readonly explore: Profile;
47
+ readonly plan: Profile;
48
+ readonly review: Profile;
49
+ readonly quick: Profile;
50
+ readonly careful: Profile;
51
+ readonly code: Profile;
52
+ readonly watch: Profile;
53
+ };
54
+
55
+ export { AppliedProfile, Profile, Profiles, applyProfile, careful, code, createProfile, explore, filterTools, mergeProfiles, plan, quick, review, watch };
@@ -0,0 +1,30 @@
1
+ import {
2
+ applyProfile,
3
+ createProfile,
4
+ filterTools,
5
+ mergeProfiles
6
+ } from "../chunk-TIHPYVAJ.js";
7
+ import {
8
+ Profiles,
9
+ careful,
10
+ code,
11
+ explore,
12
+ plan,
13
+ quick,
14
+ review,
15
+ watch
16
+ } from "../chunk-6HZBHFOL.js";
17
+ export {
18
+ Profiles,
19
+ applyProfile,
20
+ careful,
21
+ code,
22
+ createProfile,
23
+ explore,
24
+ filterTools,
25
+ mergeProfiles,
26
+ plan,
27
+ quick,
28
+ review,
29
+ watch
30
+ };
@@ -1,18 +1,14 @@
1
- import { c as ModelFamily, g as EnvironmentInfo, I as InstructionFile } from '../runner-e2YRcUoX.js';
2
- export { a as PromptBuildContext, P as PromptConfig, b as PromptSection } from '../runner-e2YRcUoX.js';
1
+ import { bM as ModelFamily, b6 as EnvironmentInfo, bq as InstructionFile } from '../instance-BqV2D5pc.js';
2
+ export { c3 as PromptBuildContext, P as PromptBuilder, c4 as PromptConfig, c5 as PromptSection, cq as SkillConfig, dG as createPromptBuilder } from '../instance-BqV2D5pc.js';
3
3
  import { LanguageModel } from 'ai';
4
- export { P as PromptBuilder, c as createPromptBuilder } from '../builder-UpOWQMW3.js';
5
- export { d as SkillConfig } from '../types-BfNpU8NS.js';
6
- import '@ai-sdk/provider-utils';
7
- import '../events-CE72w8W4.js';
8
- import '../messages-BYWGn8TY.js';
9
- import '../types-CQL-SvTn.js';
10
- import '../tool-DLXAR9Ce.js';
11
- import '../types-CHiPh8U2.js';
12
- import '../tool-BHbyUAy3.js';
4
+ import '../types-C_LCeYNg.js';
5
+ import '../types-RSCv7nQ4.js';
13
6
  import 'zod';
14
7
  import '../types-CQaXbRsS.js';
15
- import '../registry-DwYqsQkX.js';
8
+ import '../types-Bj_J8u_W.js';
9
+ import '@ai-sdk/provider-utils';
10
+ import '../sandbox/index.js';
11
+ import '../llm-error-D93FNNLY.js';
16
12
 
17
13
  /**
18
14
  * Prompt Templates — Base system prompts per model family
@@ -19,8 +19,9 @@ import {
19
19
  getTemplate,
20
20
  loadGlobalInstructions,
21
21
  summarizeEnvironment
22
- } from "../chunk-IVUJDISU.js";
23
- import "../chunk-LRHOS4ZN.js";
22
+ } from "../chunk-GFTW23FV.js";
23
+ import "../chunk-SPILYYDF.js";
24
+ import "../chunk-I6PKJ7XQ.js";
24
25
  export {
25
26
  DEFAULT_INSTRUCTION_PATTERNS,
26
27
  DEFAULT_MAX_DEPTH,