@neurocode-ai/plugin 1.18.13 → 1.18.15

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.
@@ -0,0 +1,515 @@
1
+ # V2 Plugin System Implementation Plan
2
+
3
+ ## Status
4
+
5
+ This document describes the agreed target design for the V2 plugin system. It is an implementation plan, not documentation for the current API.
6
+
7
+ ## Goals
8
+
9
+ - Internal and external plugins use the same public plugin API.
10
+ - Effect plugins import `@opencode-ai/plugin/v2/effect`, not `@opencode-ai/core`.
11
+ - Public domain values use generated `@opencode-ai/sdk` types.
12
+ - Core may retain branded IDs, decoded Effect schemas, and internal service types.
13
+ - Plugins may register replayable domain transforms and runtime hooks imperatively during setup.
14
+ - Registrations are scoped, independently disposable, ordered, and removable.
15
+ - Dynamic sources such as models.dev, config files, and skill directories can rebuild one domain without reloading the entire Location.
16
+ - The initial implementation covers the Effect API. A Promise API will be designed afterward as a wrapper over the same capabilities.
17
+
18
+ ## Authoring Model
19
+
20
+ A plugin setup effect receives `PluginHost` and imperatively registers transforms and hooks.
21
+
22
+ ```ts
23
+ export const Plugin = define({
24
+ id: "example",
25
+ effect: (ctx) =>
26
+ Effect.gen(function* () {
27
+ yield* ctx.agent.transform(
28
+ Effect.fn(function* (agent) {
29
+ agent.update("reviewer", (item) => {
30
+ item.description = "Reviews code for regressions"
31
+ item.mode = "subagent"
32
+ })
33
+ }),
34
+ )
35
+
36
+ yield* ctx.tool.hook(
37
+ "execute.before",
38
+ Effect.fn(function* (event) {
39
+ event.args.update(sanitizeArgs)
40
+ }),
41
+ )
42
+ }),
43
+ })
44
+ ```
45
+
46
+ Plugin setup does not return hooks.
47
+
48
+ ## Public Naming
49
+
50
+ Settled names:
51
+
52
+ - Replayable domain registration: `transform`
53
+ - Explicit domain replay: `rebuild`
54
+ - Runtime callback registration: `hook`
55
+ - Registration cleanup: `dispose`
56
+ - Event domain: singular `event`
57
+ - Other domains are singular: `agent`, `command`, `integration`, `reference`, `session`, `skill`, and `tool`; `catalog` remains `catalog`
58
+ - Hook names use dotted lifecycle names such as `"execute.before"` and `"execute.after"`
59
+
60
+ ## Transform API
61
+
62
+ Each transformable domain exposes:
63
+
64
+ ```ts
65
+ interface TransformDomain<Editor> {
66
+ transform(callback: (editor: Editor) => Effect.Effect<void>): Effect.Effect<Registration, never, Scope.Scope>
67
+
68
+ rebuild(): Effect.Effect<void>
69
+ }
70
+ ```
71
+
72
+ The actual callback may be represented with the project's normal `Effect.fn` style.
73
+
74
+ ```ts
75
+ const registration =
76
+ yield *
77
+ ctx.catalog.transform(
78
+ Effect.fn(function* (catalog) {
79
+ const integration = yield* ctx.integration.get("anthropic")
80
+ if (!integration) return
81
+
82
+ catalog.provider.update("anthropic", (provider) => {
83
+ provider.name = "Anthropic"
84
+ })
85
+ }),
86
+ )
87
+ ```
88
+
89
+ Transforms may perform arbitrary Effects, including reads from other PluginHost services, filesystem I/O, and network I/O. Reads from another domain observe that domain's latest committed state.
90
+
91
+ Transforms have no typed error channel. Unexpected failures are defects.
92
+
93
+ ## Transform Semantics
94
+
95
+ - Every call to `transform()` creates an independent registration.
96
+ - Multiple transforms from one plugin and domain are allowed.
97
+ - Transform order is plugin registration order, then transform registration order within the plugin.
98
+ - A transform is automatically removed when its registration scope closes.
99
+ - `Registration.dispose` removes it early and is idempotent.
100
+ - Registering or disposing a transform automatically rebuilds its domain.
101
+ - During bulk plugin boot, automatic rebuilds are deferred and each affected domain is rebuilt once after the batch.
102
+ - `rebuild()` waits until replay and finalization complete.
103
+ - `rebuild()` always replays every active transform for the domain.
104
+ - Rebuilds are serialized and coalesced. Calls arriving during an active rebuild schedule at most one additional rebuild.
105
+ - A rebuild captures its registration list at the start. Concurrent registration changes affect the next rebuild.
106
+ - Transforms may not register or dispose transforms while replaying. Such changes are rejected or deferred by the runtime.
107
+ - Calling `rebuild()` for the currently rebuilding domain from one of its transforms is rejected.
108
+ - Rebuilding another domain from a transform is deferred until the current transform finishes.
109
+
110
+ ## Registration API
111
+
112
+ Transforms and runtime hooks return the same Effect registration type.
113
+
114
+ ```ts
115
+ interface Registration {
116
+ readonly dispose: Effect.Effect<void>
117
+ }
118
+ ```
119
+
120
+ Registration behavior:
121
+
122
+ - Automatically attached to the current `Scope.Scope`
123
+ - Explicitly disposable before scope closure
124
+ - Disposal affects future replays or invocations
125
+ - An in-flight rebuild or hook invocation uses the registration snapshot captured when it started and is allowed to finish
126
+
127
+ ## Runtime Hook API
128
+
129
+ Domains expose runtime interception through `hook()`.
130
+
131
+ ```ts
132
+ const registration =
133
+ yield *
134
+ ctx.tool.hook(
135
+ "execute.before",
136
+ Effect.fn(function* (event) {
137
+ event.args.update(sanitizeArgs)
138
+ }),
139
+ )
140
+ ```
141
+
142
+ Runtime hook behavior:
143
+
144
+ - Multiple registrations for the same hook are allowed.
145
+ - Hooks run sequentially in plugin and registration order.
146
+ - Later hooks observe mutations made by earlier hooks.
147
+ - Hook registration is scope-owned and independently disposable.
148
+ - Disposal affects future invocations; an in-flight invocation finishes using its captured registration snapshot.
149
+ - Runtime hooks are not replayed during domain rebuilds.
150
+ - Runtime hook callbacks have no typed error channel.
151
+
152
+ ## Hook Contexts
153
+
154
+ Each hook receives one purpose-built context object rather than separate input/output parameters.
155
+
156
+ ```ts
157
+ ctx.tool.hook("execute.before", (event) => {
158
+ event.args.update((args) => ({
159
+ ...args,
160
+ timeout: 30,
161
+ }))
162
+ })
163
+ ```
164
+
165
+ Hook context objects may contain:
166
+
167
+ - Readonly SDK-typed operation data
168
+ - Purpose-built methods for allowed mutations
169
+ - Capability methods where the operation requires more than field assignment
170
+
171
+ They must not expose core drafts or unrestricted internal objects.
172
+
173
+ ## Domain Transforms Versus Runtime Hooks
174
+
175
+ Both use the same low-level scoped registration registry, but consumers invoke them differently.
176
+
177
+ ```ts
178
+ ctx.tool.transform(...) // replayed to build effective tool registry state
179
+ ctx.tool.hook(...) // invoked at a live tool operation boundary
180
+ ```
181
+
182
+ The shared low-level machinery owns registration order, scope cleanup, disposal, and snapshots. Each domain owns when its transforms or runtime hooks execute.
183
+
184
+ ## Event API
185
+
186
+ The Effect API exposes the existing event system as typed streams using generated SDK event discriminants.
187
+
188
+ ```ts
189
+ ctx.event.subscribe("catalog.updated")
190
+ // Stream.Stream<EventCatalogUpdated>
191
+ ```
192
+
193
+ Example:
194
+
195
+ ```ts
196
+ yield *
197
+ ctx.event.subscribe("catalog.updated").pipe(
198
+ Stream.runForEach(() => ctx.agent.rebuild()),
199
+ Effect.forkScoped,
200
+ )
201
+ ```
202
+
203
+ The plugin package derives event payload types from the generated SDK `Event` union:
204
+
205
+ ```ts
206
+ type EventMap = {
207
+ [Item in Event as Item["type"]]: Item
208
+ }
209
+ ```
210
+
211
+ Core resolves the public event type string to its internal event definition and delegates to `EventV2.Service.subscribe`.
212
+
213
+ ## Domain State Model
214
+
215
+ Each transformable core service continues to own:
216
+
217
+ - Base state
218
+ - Effective committed state
219
+ - Editor creation
220
+ - Ordered transform registrations for that domain
221
+ - Rebuild serialization and coalescing
222
+ - Core finalization
223
+ - Commit and post-commit events
224
+
225
+ The initial implementation should evolve the existing generic `State` helper rather than create a central cross-domain state manager.
226
+
227
+ ```text
228
+ base state
229
+ → replay active transforms in order
230
+ → core domain finalization
231
+ → commit effective state
232
+ → publish updated event
233
+ ```
234
+
235
+ No cross-domain transform or transaction API is included.
236
+
237
+ ## Finalization
238
+
239
+ Each domain has one plugin transform phase followed by core finalization.
240
+
241
+ Core finalization is for invariants and materialization, not plugin extension behavior.
242
+
243
+ Examples:
244
+
245
+ - Catalog policy filtering and validation
246
+ - Reference repository materialization
247
+ - Integration connection projection
248
+ - Index construction
249
+ - Post-commit update events
250
+
251
+ Finalizers should distinguish pre-commit work from post-commit notification. Update events should publish after the new state is visible.
252
+
253
+ ## Plugin Order
254
+
255
+ The default distribution uses an opinionated internal order:
256
+
257
+ ```text
258
+ 1. Built-in agents, commands, and skills
259
+ 2. Base data sources such as models.dev
260
+ 3. Configuration projections
261
+ 4. Provider-specific normalization and authentication
262
+ 5. External user plugins
263
+ 6. Core domain finalization
264
+ ```
265
+
266
+ For catalog transforms:
267
+
268
+ ```text
269
+ models.dev
270
+ → config provider overrides
271
+ → built-in provider normalization
272
+ → user catalog transforms
273
+ → catalog finalization
274
+ ```
275
+
276
+ This replaces the current distinction between setup-installed State transforms and catalog hooks invoked from the catalog finalizer.
277
+
278
+ Replacing a plugin with the same ID retains its existing order position. The old plugin is disabled before the replacement setup starts.
279
+
280
+ ## Boot Batching
281
+
282
+ Plugin boot runs in an internal registration batch.
283
+
284
+ ```text
285
+ begin batch
286
+ → initialize plugins sequentially
287
+ → register transforms and hooks
288
+ → collect affected domains
289
+ → rebuild each affected domain once
290
+ → end batch
291
+ ```
292
+
293
+ Registration itself is not staged per plugin. If setup fails, closing the plugin's child scope removes every registration made before the failure.
294
+
295
+ Outside a batch, transform registration and disposal rebuild immediately.
296
+
297
+ ## Models.dev Example
298
+
299
+ Models.dev performs effectful reads directly from its transforms and rebuilds affected domains after refresh.
300
+
301
+ ```ts
302
+ export const ModelsDevPlugin = define({
303
+ id: "models-dev",
304
+ effect: (ctx) =>
305
+ Effect.gen(function* () {
306
+ const modelsDev = yield* ModelsDev.Service
307
+ const event = yield* EventV2.Service
308
+
309
+ yield* ctx.integration.transform(
310
+ Effect.fn(function* (integration) {
311
+ const data = yield* modelsDev.get()
312
+ applyIntegrations(data, integration)
313
+ }),
314
+ )
315
+
316
+ yield* ctx.catalog.transform(
317
+ Effect.fn(function* (catalog) {
318
+ const data = yield* modelsDev.get()
319
+ applyCatalog(data, catalog)
320
+ }),
321
+ )
322
+
323
+ yield* event.subscribe(ModelsDev.Event.Refreshed).pipe(
324
+ Stream.runForEach(
325
+ Effect.fn(function* () {
326
+ yield* ctx.integration.rebuild()
327
+ yield* ctx.catalog.rebuild()
328
+ }),
329
+ ),
330
+ Effect.forkScoped({ startImmediately: true }),
331
+ )
332
+ }),
333
+ })
334
+ ```
335
+
336
+ The two domains rebuild sequentially. This plan does not add a cross-domain atomic transaction.
337
+
338
+ ## Config Watcher Example
339
+
340
+ ```ts
341
+ export const ConfigPlugin = define({
342
+ id: "config",
343
+ effect: (ctx) =>
344
+ Effect.gen(function* () {
345
+ const config = yield* ConfigSource.Service
346
+
347
+ yield* ctx.agent.transform(
348
+ Effect.fn(function* (agent) {
349
+ applyAgentConfig(yield* config.get(), agent)
350
+ }),
351
+ )
352
+
353
+ yield* ctx.command.transform(
354
+ Effect.fn(function* (command) {
355
+ applyCommandConfig(yield* config.get(), command)
356
+ }),
357
+ )
358
+
359
+ yield* config.changes.pipe(
360
+ Stream.runForEach(
361
+ Effect.fn(function* () {
362
+ yield* ctx.agent.rebuild()
363
+ yield* ctx.command.rebuild()
364
+ }),
365
+ ),
366
+ Effect.forkScoped,
367
+ )
368
+ }),
369
+ })
370
+ ```
371
+
372
+ ## Cross-Domain Read Example
373
+
374
+ A transform may read another committed service. It must still arrange for its own domain to rebuild when that dependency changes.
375
+
376
+ ```ts
377
+ export const AnthropicAgentPlugin = define({
378
+ id: "anthropic-agent",
379
+ effect: (ctx) =>
380
+ Effect.gen(function* () {
381
+ yield* ctx.agent.transform(
382
+ Effect.fn(function* (agent) {
383
+ const providers = yield* ctx.catalog.provider.list()
384
+ if (!providers.some((provider) => provider.id === "anthropic")) return
385
+
386
+ agent.update("anthropic-reviewer", (item) => {
387
+ item.description = "Reviews code using Anthropic"
388
+ item.mode = "subagent"
389
+ item.model = {
390
+ providerID: "anthropic",
391
+ id: "claude-sonnet",
392
+ }
393
+ })
394
+ }),
395
+ )
396
+
397
+ yield* ctx.event.subscribe("catalog.updated").pipe(
398
+ Stream.runForEach(() => ctx.agent.rebuild()),
399
+ Effect.forkScoped,
400
+ )
401
+ }),
402
+ })
403
+ ```
404
+
405
+ The runtime does not infer cross-domain dependencies.
406
+
407
+ ## Embedding API Compatibility
408
+
409
+ The imperative registration model maps naturally to a future application embedding API:
410
+
411
+ ```ts
412
+ const registration = oc.agent.transform((agent) => {
413
+ agent.update("reviewer", configureReviewer)
414
+ })
415
+
416
+ registration.dispose()
417
+ ```
418
+
419
+ An application registration is stored as an application-level plugin registration. It attaches to every current Location and is installed during future Location boot. Disposal removes all current attachments and prevents future attachment.
420
+
421
+ The Effect implementation remains the canonical runtime. Promise and embedding wrappers are deferred until after the Effect API is stable.
422
+
423
+ ## Migration Plan
424
+
425
+ ### 1. Define Public Contracts
426
+
427
+ - Define `PluginHost` domain capabilities in `@opencode-ai/plugin/v2/effect`.
428
+ - Define SDK-typed editors for agent, catalog, command, integration, reference, skill, and tool.
429
+ - Define typed runtime hook maps per domain.
430
+ - Define `Registration`.
431
+ - Define typed `event.subscribe(type)`.
432
+
433
+ ### 2. Generalize Registration Machinery
434
+
435
+ - Add one low-level scoped registration registry used by transforms and runtime hooks.
436
+ - Preserve plugin order and registration order.
437
+ - Support idempotent disposal and registration snapshots.
438
+ - Retain plugin position during same-ID replacement.
439
+
440
+ ### 3. Evolve State
441
+
442
+ - Replace the current returned transform-slot updater with direct `transform(callback)` registration.
443
+ - Support Effectful callbacks.
444
+ - Add public `rebuild()`.
445
+ - Add rebuild serialization and coalescing.
446
+ - Add boot batching that defers automatic rebuilds.
447
+ - Move update event publication after commit.
448
+
449
+ ### 4. Expand Domain Transform Hooks
450
+
451
+ - Agent
452
+ - Catalog
453
+ - Command
454
+ - Integration
455
+ - Reference
456
+ - Skill
457
+ - Tool
458
+
459
+ ### 5. Migrate Existing Plugins
460
+
461
+ - Built-in agent transform
462
+ - Built-in command transform
463
+ - Built-in skill transform
464
+ - Models.dev catalog and integration transforms
465
+ - Config transforms
466
+ - OpenAI integration transform
467
+ - Provider catalog transforms
468
+
469
+ ### 6. Migrate Runtime Hooks
470
+
471
+ - AI SDK resolution
472
+ - Language model resolution
473
+ - Tool execution hooks
474
+ - Session prompt/context hooks as required
475
+
476
+ ### 7. Remove Returned Hooks
477
+
478
+ - Remove `HookFunctions` as the plugin setup return value.
479
+ - Remove catalog's special finalizer-triggered plugin hook path.
480
+ - Remove `plugin.added` catalog mutation handling.
481
+ - Make add/remove/replacement rely on scoped registration and domain rebuilds.
482
+
483
+ ### 8. Add Event Adapter
484
+
485
+ - Build the SDK event discriminant map.
486
+ - Resolve public type strings to internal EventV2 definitions.
487
+ - Return typed Effect streams.
488
+
489
+ ### 9. Verification
490
+
491
+ - Transform order is deterministic.
492
+ - Multiple transforms per plugin/domain compose.
493
+ - Registration and disposal rebuild automatically outside boot batches.
494
+ - Boot performs one rebuild per affected domain.
495
+ - Plugin setup failure removes prior registrations.
496
+ - Same-ID replacement retains order and disables the old plugin first.
497
+ - Rebuilds serialize and coalesce.
498
+ - Registration changes during replay affect the next rebuild.
499
+ - Same-domain recursive rebuild is rejected.
500
+ - Cross-domain rebuild requests from transforms are deferred.
501
+ - Hook execution is sequential and snapshot-based.
502
+ - Models.dev refresh replays config and provider transforms.
503
+ - Config and skill watcher refreshes remove stale entries.
504
+ - Plugin removal restores prior effective state.
505
+ - Events observe newly committed state.
506
+
507
+ ## Deferred Decisions
508
+
509
+ - Promise API shape
510
+ - Typed error model
511
+ - Transform timeouts
512
+ - Cross-domain atomic rebuilds
513
+ - Automatic dependency tracking
514
+ - Whole-Location generation reload
515
+ - Exact editors and runtime hooks not required by current plugins
@@ -0,0 +1,111 @@
1
+ # OpenCode V2 Effect Plugin API
2
+
3
+ The Effect plugin API grants plugins two in-process capabilities:
4
+
5
+ - `hook` installs behavior at an OpenCode extension point.
6
+ - `reload` reruns every transform hook for a stateful domain.
7
+
8
+ The public server client will be exposed separately. It is intentionally not part of `PluginContext` yet.
9
+
10
+ ## Defining A Plugin
11
+
12
+ ```ts
13
+ import { define } from "@opencode-ai/plugin/v2/effect"
14
+ import { Effect } from "effect"
15
+
16
+ export const Plugin = define({
17
+ id: "example",
18
+ effect: Effect.fn(function* (ctx) {
19
+ yield* ctx.catalog.transform((catalog) => {
20
+ catalog.provider.update("example", (provider) => {
21
+ provider.name = "Example"
22
+ })
23
+ })
24
+ }),
25
+ })
26
+ ```
27
+
28
+ Plugin setup registers hooks imperatively. It does not return a hook object.
29
+
30
+ Configuration supplied for the plugin is available as `ctx.options`.
31
+
32
+ Registrations are owned by the plugin scope. Closing the scope removes them automatically; a registration may also be removed early through `dispose`.
33
+
34
+ ## Transform Hooks
35
+
36
+ Transform hooks contribute to stateful domains:
37
+
38
+ ```ts
39
+ yield *
40
+ ctx.agent.transform((agent) => {
41
+ agent.update("reviewer", (item) => {
42
+ item.description = "Reviews code for regressions"
43
+ item.mode = "subagent"
44
+ })
45
+ })
46
+ ```
47
+
48
+ OpenCode rebuilds the domain when a transform is registered or disposed. A rebuild starts from fresh domain state and runs every active transform in registration order.
49
+
50
+ Available transform hooks are namespaced by domain:
51
+
52
+ ```ts
53
+ ctx.agent.transform
54
+ ctx.catalog.transform
55
+ ctx.command.transform
56
+ ctx.integration.transform
57
+ ctx.reference.transform
58
+ ctx.skill.transform
59
+ ```
60
+
61
+ ## Runtime Hooks
62
+
63
+ Runtime hooks intercept live operations rather than rebuilding domain state:
64
+
65
+ ```ts
66
+ yield *
67
+ ctx.aisdk.sdk(
68
+ Effect.fn(function* (event) {
69
+ if (event.package !== "@ai-sdk/xai") return
70
+ const mod = yield* Effect.promise(() => import("@ai-sdk/xai"))
71
+ event.sdk = mod.createXai(event.options)
72
+ }),
73
+ )
74
+
75
+ yield *
76
+ ctx.aisdk.language((event) => {
77
+ if (event.model.providerID !== "xai") return
78
+ event.language = event.sdk.responses(event.model.api.id)
79
+ })
80
+ ```
81
+
82
+ Hooks run sequentially in registration order. Later hooks observe mutations made by earlier hooks.
83
+
84
+ ## Reloading A Domain
85
+
86
+ When data captured by a transform changes, reload the affected domain:
87
+
88
+ ```ts
89
+ let data = yield * loadCatalog()
90
+
91
+ yield *
92
+ ctx.catalog.transform((catalog) => {
93
+ applyCatalog(data, catalog)
94
+ })
95
+
96
+ data = yield * loadCatalog()
97
+ yield * ctx.catalog.reload()
98
+ ```
99
+
100
+ Reload belongs to the domain, not an individual registration. `ctx.catalog.reload()` reruns every active catalog transform and publishes the rebuilt catalog.
101
+
102
+ Available reload operations are:
103
+
104
+ ```ts
105
+ ctx.agent.reload()
106
+ ctx.catalog.reload()
107
+ ctx.command.reload()
108
+ ctx.integration.reload()
109
+ ctx.reference.reload()
110
+ ctx.skill.reload()
111
+ ```
@@ -0,0 +1,14 @@
1
+ import type { AgentV2Info } from "@neurocode-ai/sdk/v2/types"
2
+ import type { Hooks } from "./registration.js"
3
+
4
+ export interface AgentDraft {
5
+ list(): readonly AgentV2Info[]
6
+ get(id: string): AgentV2Info | undefined
7
+ default(id: string | undefined): void
8
+ update(id: string, update: (agent: AgentV2Info) => void): void
9
+ remove(id: string): void
10
+ }
11
+
12
+ export type AgentHooks = Hooks<{
13
+ transform: AgentDraft
14
+ }>
@@ -0,0 +1,18 @@
1
+ import type { LanguageModelV3 } from "@ai-sdk/provider"
2
+ import type { ModelV2Info } from "@neurocode-ai/sdk/v2/types"
3
+ import type { Hooks } from "./registration.js"
4
+
5
+ export type AISDKHooks = Hooks<{
6
+ sdk: {
7
+ readonly model: ModelV2Info
8
+ readonly package: string
9
+ readonly options: Record<string, any>
10
+ sdk?: any
11
+ }
12
+ language: {
13
+ readonly model: ModelV2Info
14
+ readonly sdk: any
15
+ readonly options: Record<string, any>
16
+ language?: LanguageModelV3
17
+ }
18
+ }>
@@ -0,0 +1,29 @@
1
+ import type { ModelV2Info, ProviderV2Info } from "@neurocode-ai/sdk/v2/types"
2
+ import type { Hooks } from "./registration.js"
3
+
4
+ export interface CatalogProviderRecord {
5
+ readonly provider: ProviderV2Info
6
+ readonly models: ReadonlyMap<string, ModelV2Info>
7
+ }
8
+
9
+ export interface CatalogDraft {
10
+ readonly provider: {
11
+ list(): readonly CatalogProviderRecord[]
12
+ get(providerID: string): CatalogProviderRecord | undefined
13
+ update(providerID: string, update: (provider: ProviderV2Info) => void): void
14
+ remove(providerID: string): void
15
+ }
16
+ readonly model: {
17
+ get(providerID: string, modelID: string): ModelV2Info | undefined
18
+ update(providerID: string, modelID: string, update: (model: ModelV2Info) => void): void
19
+ remove(providerID: string, modelID: string): void
20
+ readonly default: {
21
+ get(): { providerID: string; modelID: string } | undefined
22
+ set(providerID: string, modelID: string): void
23
+ }
24
+ }
25
+ }
26
+
27
+ export type CatalogHooks = Hooks<{
28
+ transform: CatalogDraft
29
+ }>
@@ -0,0 +1,13 @@
1
+ import type { CommandV2Info } from "@neurocode-ai/sdk/v2/types"
2
+ import type { Hooks } from "./registration.js"
3
+
4
+ export interface CommandDraft {
5
+ list(): readonly CommandV2Info[]
6
+ get(name: string): CommandV2Info | undefined
7
+ update(name: string, update: (command: CommandV2Info) => void): void
8
+ remove(name: string): void
9
+ }
10
+
11
+ export type CommandHooks = Hooks<{
12
+ transform: CommandDraft
13
+ }>