@tagma/sdk 0.6.1 → 0.6.2
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/bootstrap.d.ts +11 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +18 -9
- package/dist/bootstrap.js.map +1 -1
- package/dist/engine.d.ts +8 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +17 -16
- package/dist/engine.js.map +1 -1
- package/dist/plugin-registry.test.d.ts +2 -0
- package/dist/plugin-registry.test.d.ts.map +1 -0
- package/dist/plugin-registry.test.js +188 -0
- package/dist/plugin-registry.test.js.map +1 -0
- package/dist/registry.d.ts +52 -28
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +126 -91
- package/dist/registry.js.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap.ts +18 -9
- package/src/drivers/opencode.ts +1 -1
- package/src/engine.ts +24 -16
- package/src/plugin-registry.test.ts +230 -0
- package/src/registry.ts +155 -106
- package/src/sdk.ts +2 -0
package/dist/registry.d.ts
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
import type { PluginCategory, DriverPlugin, TriggerPlugin, CompletionPlugin, MiddlewarePlugin, PluginManifest } from './types';
|
|
2
2
|
type PluginType = DriverPlugin | TriggerPlugin | CompletionPlugin | MiddlewarePlugin;
|
|
3
3
|
export type RegisterResult = 'registered' | 'replaced' | 'unchanged';
|
|
4
|
-
/**
|
|
5
|
-
* Register a plugin under (category, type). Returns:
|
|
6
|
-
* - 'registered' on first registration
|
|
7
|
-
* - 'replaced' when an existing entry was overwritten with a different handler
|
|
8
|
-
* - 'unchanged' when the same handler instance was already present
|
|
9
|
-
*
|
|
10
|
-
* Throws if `category` is unknown, `type` is empty, or `handler` violates the
|
|
11
|
-
* minimum interface contract for the category.
|
|
12
|
-
*/
|
|
13
|
-
export declare function registerPlugin<T extends PluginType>(category: PluginCategory, type: string, handler: T): RegisterResult;
|
|
14
|
-
/**
|
|
15
|
-
* Remove a plugin from the in-process registry. Returns true if a plugin
|
|
16
|
-
* was actually removed. Note: ESM module caching is not affected, so
|
|
17
|
-
* re-importing the same file after unregister will yield the cached module —
|
|
18
|
-
* callers wanting a fresh load must restart the host process.
|
|
19
|
-
*/
|
|
20
|
-
export declare function unregisterPlugin(category: PluginCategory, type: string): boolean;
|
|
21
|
-
export declare function getHandler<T extends PluginType>(category: PluginCategory, type: string): T;
|
|
22
|
-
export declare function hasHandler(category: PluginCategory, type: string): boolean;
|
|
23
4
|
export declare const PLUGIN_NAME_RE: RegExp;
|
|
24
5
|
export declare function isValidPluginName(name: unknown): name is string;
|
|
25
6
|
/**
|
|
@@ -38,16 +19,59 @@ export declare function isValidPluginName(name: unknown): name is string;
|
|
|
38
19
|
*/
|
|
39
20
|
export declare function readPluginManifest(pkgJson: unknown): PluginManifest | null;
|
|
40
21
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* uses the SDK's own `node_modules`, which will fail for plugins installed
|
|
47
|
-
* only in the user's workspace. CLI callers should pass `process.cwd()` or
|
|
48
|
-
* the workspace root so that workspace-local plugins resolve correctly.
|
|
22
|
+
* Instance-scoped plugin registry. Each workspace in a multi-tenant sidecar
|
|
23
|
+
* owns its own PluginRegistry, so installing/uninstalling a driver in one
|
|
24
|
+
* workspace cannot clobber another. The process-wide `defaultRegistry`
|
|
25
|
+
* exported at the bottom of this file preserves the historical free-function
|
|
26
|
+
* API (registerPlugin / getHandler / …) for CLI and single-tenant hosts.
|
|
49
27
|
*/
|
|
50
|
-
export declare
|
|
28
|
+
export declare class PluginRegistry {
|
|
29
|
+
private readonly registries;
|
|
30
|
+
/**
|
|
31
|
+
* Register a plugin under (category, type). Returns:
|
|
32
|
+
* - 'registered' on first registration
|
|
33
|
+
* - 'replaced' when an existing entry was overwritten with a different handler
|
|
34
|
+
* - 'unchanged' when the same handler instance was already present
|
|
35
|
+
*
|
|
36
|
+
* Throws if `category` is unknown, `type` is empty, or `handler` violates
|
|
37
|
+
* the minimum interface contract for the category.
|
|
38
|
+
*/
|
|
39
|
+
registerPlugin<T extends PluginType>(category: PluginCategory, type: string, handler: T): RegisterResult;
|
|
40
|
+
/**
|
|
41
|
+
* Remove a plugin from the in-process registry. Returns true if a plugin
|
|
42
|
+
* was actually removed. Note: ESM module caching is not affected, so
|
|
43
|
+
* re-importing the same file after unregister will yield the cached module —
|
|
44
|
+
* callers wanting a fresh load must restart the host process.
|
|
45
|
+
*/
|
|
46
|
+
unregisterPlugin(category: PluginCategory, type: string): boolean;
|
|
47
|
+
getHandler<T extends PluginType>(category: PluginCategory, type: string): T;
|
|
48
|
+
hasHandler(category: PluginCategory, type: string): boolean;
|
|
49
|
+
listRegistered(category: PluginCategory): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Load and register a list of plugin packages into this registry.
|
|
52
|
+
*
|
|
53
|
+
* @param pluginNames - Validated npm package names to load.
|
|
54
|
+
* @param resolveFrom - Optional absolute path to resolve plugins from (e.g.
|
|
55
|
+
* the workspace's working directory). When omitted, the default ESM
|
|
56
|
+
* resolution uses the SDK's own `node_modules`, which will fail for
|
|
57
|
+
* plugins installed only in the user's workspace. CLI callers should
|
|
58
|
+
* pass `process.cwd()` or the workspace root so that workspace-local
|
|
59
|
+
* plugins resolve correctly.
|
|
60
|
+
*/
|
|
61
|
+
loadPlugins(pluginNames: readonly string[], resolveFrom?: string): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Process-wide default registry. Preserves the historical free-function API
|
|
65
|
+
* for CLI and single-tenant hosts. Multi-tenant hosts (the editor sidecar
|
|
66
|
+
* after the one-sidecar refactor) build their own `PluginRegistry` per
|
|
67
|
+
* workspace and pass it through `RunPipelineOptions.registry`.
|
|
68
|
+
*/
|
|
69
|
+
export declare const defaultRegistry: PluginRegistry;
|
|
70
|
+
export declare function registerPlugin<T extends PluginType>(category: PluginCategory, type: string, handler: T): RegisterResult;
|
|
71
|
+
export declare function unregisterPlugin(category: PluginCategory, type: string): boolean;
|
|
72
|
+
export declare function getHandler<T extends PluginType>(category: PluginCategory, type: string): T;
|
|
73
|
+
export declare function hasHandler(category: PluginCategory, type: string): boolean;
|
|
51
74
|
export declare function listRegistered(category: PluginCategory): string[];
|
|
75
|
+
export declare function loadPlugins(pluginNames: readonly string[], resolveFrom?: string): Promise<void>;
|
|
52
76
|
export {};
|
|
53
77
|
//# sourceMappingURL=registry.d.ts.map
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,KAAK,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,KAAK,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AA6FrF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAKrE,eAAO,MAAM,cAAc,QAA4D,CAAC;AAExF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAE/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBA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AgB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,EAAE,CAEjE;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
package/dist/registry.js
CHANGED
|
@@ -6,12 +6,6 @@ const VALID_CATEGORIES = new Set([
|
|
|
6
6
|
'completions',
|
|
7
7
|
'middlewares',
|
|
8
8
|
]);
|
|
9
|
-
const registries = {
|
|
10
|
-
drivers: new Map(),
|
|
11
|
-
triggers: new Map(),
|
|
12
|
-
completions: new Map(),
|
|
13
|
-
middlewares: new Map(),
|
|
14
|
-
};
|
|
15
9
|
/**
|
|
16
10
|
* Minimal contract enforcement so a malformed plugin fails fast at
|
|
17
11
|
* registration time rather than crashing the engine mid-run.
|
|
@@ -90,63 +84,6 @@ function validateContract(category, handler) {
|
|
|
90
84
|
break;
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Register a plugin under (category, type). Returns:
|
|
95
|
-
* - 'registered' on first registration
|
|
96
|
-
* - 'replaced' when an existing entry was overwritten with a different handler
|
|
97
|
-
* - 'unchanged' when the same handler instance was already present
|
|
98
|
-
*
|
|
99
|
-
* Throws if `category` is unknown, `type` is empty, or `handler` violates the
|
|
100
|
-
* minimum interface contract for the category.
|
|
101
|
-
*/
|
|
102
|
-
export function registerPlugin(category, type, handler) {
|
|
103
|
-
if (!VALID_CATEGORIES.has(category)) {
|
|
104
|
-
throw new Error(`Unknown plugin category "${category}"`);
|
|
105
|
-
}
|
|
106
|
-
if (typeof type !== 'string' || type.length === 0) {
|
|
107
|
-
throw new Error(`Plugin type must be a non-empty string (category="${category}")`);
|
|
108
|
-
}
|
|
109
|
-
validateContract(category, handler);
|
|
110
|
-
const registry = registries[category];
|
|
111
|
-
const existing = registry.get(type);
|
|
112
|
-
if (existing === handler)
|
|
113
|
-
return 'unchanged';
|
|
114
|
-
const wasReplaced = existing !== undefined;
|
|
115
|
-
registry.set(type, handler);
|
|
116
|
-
if (wasReplaced) {
|
|
117
|
-
// D18: surface silent shadowing. Hot-reload flows legitimately replace
|
|
118
|
-
// handlers; installing two different plugin packages that both claim
|
|
119
|
-
// the same (category, type) does not — the second wins and breaks the
|
|
120
|
-
// first's consumers with no audit trail. A console.warn is cheap,
|
|
121
|
-
// respects existing callers that rely on 'replaced', and gives ops a
|
|
122
|
-
// grep-able signal when registrations collide unexpectedly.
|
|
123
|
-
console.warn(`[tagma-sdk] registerPlugin: replaced existing ${category}/${type} — ` +
|
|
124
|
-
`check for duplicate plugin packages claiming the same type.`);
|
|
125
|
-
}
|
|
126
|
-
return wasReplaced ? 'replaced' : 'registered';
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Remove a plugin from the in-process registry. Returns true if a plugin
|
|
130
|
-
* was actually removed. Note: ESM module caching is not affected, so
|
|
131
|
-
* re-importing the same file after unregister will yield the cached module —
|
|
132
|
-
* callers wanting a fresh load must restart the host process.
|
|
133
|
-
*/
|
|
134
|
-
export function unregisterPlugin(category, type) {
|
|
135
|
-
if (!VALID_CATEGORIES.has(category))
|
|
136
|
-
return false;
|
|
137
|
-
return registries[category].delete(type);
|
|
138
|
-
}
|
|
139
|
-
export function getHandler(category, type) {
|
|
140
|
-
const handler = registries[category].get(type);
|
|
141
|
-
if (!handler) {
|
|
142
|
-
throw new Error(`${category} type "${type}" not registered.\n` +
|
|
143
|
-
`Install the plugin: bun add @tagma/${category.replace(/s$/, '')}-${type}`);
|
|
144
|
-
}
|
|
145
|
-
return handler;
|
|
146
|
-
}
|
|
147
|
-
export function hasHandler(category, type) {
|
|
148
|
-
return registries[category].has(type);
|
|
149
|
-
}
|
|
150
87
|
// Plugin name must be a scoped npm package or a tagma-prefixed package.
|
|
151
88
|
// Reject absolute/relative paths and suspicious patterns to prevent
|
|
152
89
|
// arbitrary code execution via crafted YAML configs.
|
|
@@ -189,40 +126,138 @@ export function readPluginManifest(pkgJson) {
|
|
|
189
126
|
return { category: category, type };
|
|
190
127
|
}
|
|
191
128
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* uses the SDK's own `node_modules`, which will fail for plugins installed
|
|
198
|
-
* only in the user's workspace. CLI callers should pass `process.cwd()` or
|
|
199
|
-
* the workspace root so that workspace-local plugins resolve correctly.
|
|
129
|
+
* Instance-scoped plugin registry. Each workspace in a multi-tenant sidecar
|
|
130
|
+
* owns its own PluginRegistry, so installing/uninstalling a driver in one
|
|
131
|
+
* workspace cannot clobber another. The process-wide `defaultRegistry`
|
|
132
|
+
* exported at the bottom of this file preserves the historical free-function
|
|
133
|
+
* API (registerPlugin / getHandler / …) for CLI and single-tenant hosts.
|
|
200
134
|
*/
|
|
201
|
-
export
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
135
|
+
export class PluginRegistry {
|
|
136
|
+
registries = {
|
|
137
|
+
drivers: new Map(),
|
|
138
|
+
triggers: new Map(),
|
|
139
|
+
completions: new Map(),
|
|
140
|
+
middlewares: new Map(),
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Register a plugin under (category, type). Returns:
|
|
144
|
+
* - 'registered' on first registration
|
|
145
|
+
* - 'replaced' when an existing entry was overwritten with a different handler
|
|
146
|
+
* - 'unchanged' when the same handler instance was already present
|
|
147
|
+
*
|
|
148
|
+
* Throws if `category` is unknown, `type` is empty, or `handler` violates
|
|
149
|
+
* the minimum interface contract for the category.
|
|
150
|
+
*/
|
|
151
|
+
registerPlugin(category, type, handler) {
|
|
152
|
+
if (!VALID_CATEGORIES.has(category)) {
|
|
153
|
+
throw new Error(`Unknown plugin category "${category}"`);
|
|
154
|
+
}
|
|
155
|
+
if (typeof type !== 'string' || type.length === 0) {
|
|
156
|
+
throw new Error(`Plugin type must be a non-empty string (category="${category}")`);
|
|
207
157
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
158
|
+
validateContract(category, handler);
|
|
159
|
+
const registry = this.registries[category];
|
|
160
|
+
const existing = registry.get(type);
|
|
161
|
+
if (existing === handler)
|
|
162
|
+
return 'unchanged';
|
|
163
|
+
const wasReplaced = existing !== undefined;
|
|
164
|
+
registry.set(type, handler);
|
|
165
|
+
if (wasReplaced) {
|
|
166
|
+
// D18: surface silent shadowing. Hot-reload flows legitimately replace
|
|
167
|
+
// handlers; installing two different plugin packages that both claim
|
|
168
|
+
// the same (category, type) does not — the second wins and breaks the
|
|
169
|
+
// first's consumers with no audit trail. A console.warn is cheap,
|
|
170
|
+
// respects existing callers that rely on 'replaced', and gives ops a
|
|
171
|
+
// grep-able signal when registrations collide unexpectedly.
|
|
172
|
+
console.warn(`[tagma-sdk] registerPlugin: replaced existing ${category}/${type} — ` +
|
|
173
|
+
`check for duplicate plugin packages claiming the same type.`);
|
|
217
174
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
175
|
+
return wasReplaced ? 'replaced' : 'registered';
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Remove a plugin from the in-process registry. Returns true if a plugin
|
|
179
|
+
* was actually removed. Note: ESM module caching is not affected, so
|
|
180
|
+
* re-importing the same file after unregister will yield the cached module —
|
|
181
|
+
* callers wanting a fresh load must restart the host process.
|
|
182
|
+
*/
|
|
183
|
+
unregisterPlugin(category, type) {
|
|
184
|
+
if (!VALID_CATEGORIES.has(category))
|
|
185
|
+
return false;
|
|
186
|
+
return this.registries[category].delete(type);
|
|
187
|
+
}
|
|
188
|
+
getHandler(category, type) {
|
|
189
|
+
const handler = this.registries[category].get(type);
|
|
190
|
+
if (!handler) {
|
|
191
|
+
throw new Error(`${category} type "${type}" not registered.\n` +
|
|
192
|
+
`Install the plugin: bun add @tagma/${category.replace(/s$/, '')}-${type}`);
|
|
193
|
+
}
|
|
194
|
+
return handler;
|
|
195
|
+
}
|
|
196
|
+
hasHandler(category, type) {
|
|
197
|
+
return this.registries[category].has(type);
|
|
198
|
+
}
|
|
199
|
+
listRegistered(category) {
|
|
200
|
+
return [...this.registries[category].keys()];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Load and register a list of plugin packages into this registry.
|
|
204
|
+
*
|
|
205
|
+
* @param pluginNames - Validated npm package names to load.
|
|
206
|
+
* @param resolveFrom - Optional absolute path to resolve plugins from (e.g.
|
|
207
|
+
* the workspace's working directory). When omitted, the default ESM
|
|
208
|
+
* resolution uses the SDK's own `node_modules`, which will fail for
|
|
209
|
+
* plugins installed only in the user's workspace. CLI callers should
|
|
210
|
+
* pass `process.cwd()` or the workspace root so that workspace-local
|
|
211
|
+
* plugins resolve correctly.
|
|
212
|
+
*/
|
|
213
|
+
async loadPlugins(pluginNames, resolveFrom) {
|
|
214
|
+
for (const name of pluginNames) {
|
|
215
|
+
if (!isValidPluginName(name)) {
|
|
216
|
+
throw new Error(`Plugin "${name}" rejected: plugin names must be scoped npm packages ` +
|
|
217
|
+
`(e.g. @tagma/trigger-xyz) or tagma-plugin-* packages. ` +
|
|
218
|
+
`Relative/absolute paths are not allowed.`);
|
|
219
|
+
}
|
|
220
|
+
let moduleUrl = name;
|
|
221
|
+
if (resolveFrom) {
|
|
222
|
+
// Resolve the package entry point relative to the caller's directory
|
|
223
|
+
// so plugins installed in the workspace's node_modules are found
|
|
224
|
+
// even when the SDK itself lives elsewhere (e.g. a global install
|
|
225
|
+
// or a monorepo sibling package).
|
|
226
|
+
const req = createRequire(resolveFrom.endsWith('/') ? resolveFrom : resolveFrom + '/');
|
|
227
|
+
const resolved = req.resolve(name);
|
|
228
|
+
moduleUrl = pathToFileURL(resolved).href;
|
|
229
|
+
}
|
|
230
|
+
const mod = await import(moduleUrl);
|
|
231
|
+
if (!mod.pluginCategory || !mod.pluginType || !mod.default) {
|
|
232
|
+
throw new Error(`Plugin "${name}" must export pluginCategory, pluginType, and default`);
|
|
233
|
+
}
|
|
234
|
+
this.registerPlugin(mod.pluginCategory, mod.pluginType, mod.default);
|
|
221
235
|
}
|
|
222
|
-
registerPlugin(mod.pluginCategory, mod.pluginType, mod.default);
|
|
223
236
|
}
|
|
224
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Process-wide default registry. Preserves the historical free-function API
|
|
240
|
+
* for CLI and single-tenant hosts. Multi-tenant hosts (the editor sidecar
|
|
241
|
+
* after the one-sidecar refactor) build their own `PluginRegistry` per
|
|
242
|
+
* workspace and pass it through `RunPipelineOptions.registry`.
|
|
243
|
+
*/
|
|
244
|
+
export const defaultRegistry = new PluginRegistry();
|
|
245
|
+
export function registerPlugin(category, type, handler) {
|
|
246
|
+
return defaultRegistry.registerPlugin(category, type, handler);
|
|
247
|
+
}
|
|
248
|
+
export function unregisterPlugin(category, type) {
|
|
249
|
+
return defaultRegistry.unregisterPlugin(category, type);
|
|
250
|
+
}
|
|
251
|
+
export function getHandler(category, type) {
|
|
252
|
+
return defaultRegistry.getHandler(category, type);
|
|
253
|
+
}
|
|
254
|
+
export function hasHandler(category, type) {
|
|
255
|
+
return defaultRegistry.hasHandler(category, type);
|
|
256
|
+
}
|
|
225
257
|
export function listRegistered(category) {
|
|
226
|
-
return
|
|
258
|
+
return defaultRegistry.listRegistered(category);
|
|
259
|
+
}
|
|
260
|
+
export function loadPlugins(pluginNames, resolveFrom) {
|
|
261
|
+
return defaultRegistry.loadPlugins(pluginNames, resolveFrom);
|
|
227
262
|
}
|
|
228
263
|
//# sourceMappingURL=registry.js.map
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAYzC,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CAAC;AAC/D,CAAC"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { parseYaml, resolveConfig, loadPipeline, serializePipeline, deresolvePip
|
|
|
9
9
|
export { buildDag, buildRawDag } from './dag';
|
|
10
10
|
export type { DagNode, Dag, RawDagNode, RawDag } from './dag';
|
|
11
11
|
export { bootstrapBuiltins } from './bootstrap';
|
|
12
|
-
export { loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
|
|
12
|
+
export { PluginRegistry, defaultRegistry, loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
|
|
13
13
|
export type { RegisterResult } from './registry';
|
|
14
14
|
export { InMemoryApprovalGateway } from './approval';
|
|
15
15
|
export type { ApprovalGateway, ApprovalRequest, ApprovalDecision, ApprovalOutcome, ApprovalEvent, ApprovalListener, } from './approval';
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGlF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAA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parseYaml, resolveConfig, loadPipeline, serializePipeline, deresolvePip
|
|
|
16
16
|
export { buildDag, buildRawDag } from './dag';
|
|
17
17
|
// ── Plugin registry ──
|
|
18
18
|
export { bootstrapBuiltins } from './bootstrap';
|
|
19
|
-
export { loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
|
|
19
|
+
export { PluginRegistry, defaultRegistry, loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
|
|
20
20
|
// ── Approval gateway ──
|
|
21
21
|
export { InMemoryApprovalGateway } from './approval';
|
|
22
22
|
// ── Approval adapters ──
|
package/dist/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,4EAA4E;AAC5E,oEAAoE;AAEpE,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGjF,8DAA8D;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,oDAAoD;AACpD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,mDAAmD;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,8DAA8D;AAC9D,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAA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SAAS,CAAC"}
|
package/package.json
CHANGED
package/src/bootstrap.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultRegistry, type PluginRegistry } from './registry';
|
|
2
2
|
|
|
3
3
|
// Built-in Drivers
|
|
4
4
|
// Only opencode is built in. Other drivers (codex, claude-code) ship as
|
|
@@ -19,19 +19,28 @@ import { OutputCheckCompletion } from './completions/output-check';
|
|
|
19
19
|
// Built-in Middleware
|
|
20
20
|
import { StaticContextMiddleware } from './middlewares/static-context';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Register every built-in plugin into `target` (defaults to the process-wide
|
|
24
|
+
* default registry). Multi-tenant hosts instantiate one PluginRegistry per
|
|
25
|
+
* workspace and call this once per instance so each workspace sees the same
|
|
26
|
+
* built-ins without sharing registration state.
|
|
27
|
+
*
|
|
28
|
+
* Built-in handlers are stateless module singletons — registering the same
|
|
29
|
+
* handler object into N registries is cheap and safe; no cloning is needed.
|
|
30
|
+
*/
|
|
31
|
+
export function bootstrapBuiltins(target: PluginRegistry = defaultRegistry): void {
|
|
23
32
|
// Drivers
|
|
24
|
-
registerPlugin('drivers', 'opencode', OpenCodeDriver);
|
|
33
|
+
target.registerPlugin('drivers', 'opencode', OpenCodeDriver);
|
|
25
34
|
|
|
26
35
|
// Triggers
|
|
27
|
-
registerPlugin('triggers', 'file', FileTrigger);
|
|
28
|
-
registerPlugin('triggers', 'manual', ManualTrigger);
|
|
36
|
+
target.registerPlugin('triggers', 'file', FileTrigger);
|
|
37
|
+
target.registerPlugin('triggers', 'manual', ManualTrigger);
|
|
29
38
|
|
|
30
39
|
// Completions
|
|
31
|
-
registerPlugin('completions', 'exit_code', ExitCodeCompletion);
|
|
32
|
-
registerPlugin('completions', 'file_exists', FileExistsCompletion);
|
|
33
|
-
registerPlugin('completions', 'output_check', OutputCheckCompletion);
|
|
40
|
+
target.registerPlugin('completions', 'exit_code', ExitCodeCompletion);
|
|
41
|
+
target.registerPlugin('completions', 'file_exists', FileExistsCompletion);
|
|
42
|
+
target.registerPlugin('completions', 'output_check', OutputCheckCompletion);
|
|
34
43
|
|
|
35
44
|
// Middlewares
|
|
36
|
-
registerPlugin('middlewares', 'static_context', StaticContextMiddleware);
|
|
45
|
+
target.registerPlugin('middlewares', 'static_context', StaticContextMiddleware);
|
|
37
46
|
}
|
package/src/drivers/opencode.ts
CHANGED
|
@@ -38,7 +38,7 @@ const EFFORT_TO_VARIANT: Record<string, string | null> = {
|
|
|
38
38
|
//
|
|
39
39
|
// 1. Desktop app — the Electron shell ships a platform-matched opencode
|
|
40
40
|
// binary under resources/opencode/bin/, prepended to the sidecar's PATH
|
|
41
|
-
// at launch (see
|
|
41
|
+
// at launch (see apps/electron/src/runtime-paths.ts). In-app updates
|
|
42
42
|
// drop a newer copy into userData/opencode/bin/ which wins via PATH
|
|
43
43
|
// precedence. That path resolves on the first `opencode --version`
|
|
44
44
|
// probe below; no auto-install ever fires.
|