@aexol/opencode-wizard 0.4.5 → 0.4.6
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/README.md +29 -4
- package/dist/pi.d.ts +1 -0
- package/dist/pi.js +2 -0
- package/dist/pi.js.map +1 -0
- package/dist/plugin-tools.d.ts +1 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/server/constants.d.ts +1 -1
- package/dist/server/constants.js +1 -1
- package/dist/server/constants.js.map +1 -1
- package/dist/server/runtime.d.ts +3 -7
- package/dist/server/runtime.js +7 -13
- package/dist/server/runtime.js.map +1 -1
- package/dist/server-opencode.d.ts +7 -0
- package/dist/server-opencode.js +13 -0
- package/dist/server-opencode.js.map +1 -0
- package/dist/server-pi.d.ts +34 -0
- package/dist/server-pi.js +314 -0
- package/dist/server-pi.js.map +1 -0
- package/dist/server.d.ts +1 -5
- package/dist/server.js +1 -5
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createWizardRuntime, PLUGIN_ID } from './server/runtime.js';
|
|
2
|
+
const importOpencodePluginModule = new Function('specifier', 'return import(specifier)');
|
|
3
|
+
export const OpencodeWizardSkillsPlugin = async input => {
|
|
4
|
+
const {
|
|
5
|
+
tool
|
|
6
|
+
} = await importOpencodePluginModule('@opencode-ai/plugin');
|
|
7
|
+
return createWizardRuntime(input, tool);
|
|
8
|
+
};
|
|
9
|
+
export default {
|
|
10
|
+
id: PLUGIN_ID,
|
|
11
|
+
server: OpencodeWizardSkillsPlugin
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=server-opencode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createWizardRuntime","PLUGIN_ID","importOpencodePluginModule","Function","OpencodeWizardSkillsPlugin","input","tool","id","server"],"sources":["../src/server-opencode.ts"],"sourcesContent":["import { createWizardRuntime, PLUGIN_ID } from './server/runtime.js';\nimport type { OpencodePluginModule, OpencodePluginServer } from './server/types.js';\n\nconst importOpencodePluginModule = new Function('specifier', 'return import(specifier)') as (\n specifier: string,\n) => Promise<OpencodePluginModule>;\n\nexport const OpencodeWizardSkillsPlugin: OpencodePluginServer = async (input) => {\n const { tool } = await importOpencodePluginModule('@opencode-ai/plugin');\n return createWizardRuntime(input, tool);\n};\n\nexport default {\n id: PLUGIN_ID,\n server: OpencodeWizardSkillsPlugin,\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,SAAS,QAAQ,qBAAqB;AAGpE,MAAMC,0BAA0B,GAAG,IAAIC,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAErD;AAElC,OAAO,MAAMC,0BAAgD,GAAG,MAAOC,KAAK,IAAK;EAC/E,MAAM;IAAEC;EAAK,CAAC,GAAG,MAAMJ,0BAA0B,CAAC,qBAAqB,CAAC;EACxE,OAAOF,mBAAmB,CAACK,KAAK,EAAEC,IAAI,CAAC;AACzC,CAAC;AAED,eAAe;EACbC,EAAE,EAAEN,SAAS;EACbO,MAAM,EAAEJ;AACV,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type JsonObject = Record<string, unknown>;
|
|
2
|
+
type PiToolResult = {
|
|
3
|
+
content: Array<{
|
|
4
|
+
type: 'text';
|
|
5
|
+
text: string;
|
|
6
|
+
}>;
|
|
7
|
+
details: JsonObject;
|
|
8
|
+
};
|
|
9
|
+
type PiParamSchema = {
|
|
10
|
+
type: 'object';
|
|
11
|
+
properties: Record<string, unknown>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
};
|
|
14
|
+
type PiToolDefinition = {
|
|
15
|
+
name: string;
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
promptSnippet?: string;
|
|
19
|
+
promptGuidelines?: string[];
|
|
20
|
+
parameters: PiParamSchema;
|
|
21
|
+
execute: (toolCallId: string, params: unknown) => Promise<PiToolResult>;
|
|
22
|
+
};
|
|
23
|
+
type BeforeAgentStartEvent = {
|
|
24
|
+
systemPrompt: string;
|
|
25
|
+
};
|
|
26
|
+
type PiExtensionApi = {
|
|
27
|
+
registerTool: (tool: PiToolDefinition) => void;
|
|
28
|
+
on: (event: 'before_agent_start', handler: (event: BeforeAgentStartEvent) => Promise<{
|
|
29
|
+
systemPrompt: string;
|
|
30
|
+
}>) => void;
|
|
31
|
+
};
|
|
32
|
+
export declare const buildPiTools: () => PiToolDefinition[];
|
|
33
|
+
export default function opencodeWizardPiExtension(pi: PiExtensionApi): Promise<void>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { createWizardRuntime, PLUGIN_ID } from './server/runtime.js';
|
|
2
|
+
const createSchemaValue = () => ({
|
|
3
|
+
optional: createSchemaValue,
|
|
4
|
+
describe: createSchemaValue
|
|
5
|
+
});
|
|
6
|
+
const createPiRuntimeToolFactory = () => {
|
|
7
|
+
const createTool = definition => ({
|
|
8
|
+
description: definition.description,
|
|
9
|
+
execute: (args, context) => definition.execute(args, context)
|
|
10
|
+
});
|
|
11
|
+
const tool = Object.assign(createTool, {
|
|
12
|
+
schema: {
|
|
13
|
+
string: createSchemaValue,
|
|
14
|
+
boolean: createSchemaValue
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return tool;
|
|
18
|
+
};
|
|
19
|
+
const runtimeCache = new Map();
|
|
20
|
+
const directorySchema = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
directory: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Optional absolute or relative directory override for workspace-scoped wizard resolution.'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const catalogSchema = {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
artifactKind: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Wizard artifact kind to catalog: SKILL or DESIGN_DOC; defaults to SKILL.'
|
|
35
|
+
},
|
|
36
|
+
directory: directorySchema.properties.directory,
|
|
37
|
+
refresh: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
description: 'Bypass the local plugin cache for this request.'
|
|
40
|
+
},
|
|
41
|
+
recommendationContext: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Optional metadata-only relevance/ranking context for catalog recommendations.'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const artifactFetchSchema = {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
artifactKind: catalogSchema.properties.artifactKind,
|
|
51
|
+
artifact: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Single artifact identifier; for SKILL this is a skill slug, artifact name, or skill name.'
|
|
54
|
+
},
|
|
55
|
+
artifacts: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'One or more comma-separated or newline-separated artifact identifiers.'
|
|
58
|
+
},
|
|
59
|
+
directory: directorySchema.properties.directory,
|
|
60
|
+
refresh: catalogSchema.properties.refresh,
|
|
61
|
+
recommendationContext: catalogSchema.properties.recommendationContext
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const artifactPreferenceSchema = {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
artifactKind: catalogSchema.properties.artifactKind,
|
|
68
|
+
artifact: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'Artifact identifier; for SKILL this is the published skill slug.'
|
|
71
|
+
},
|
|
72
|
+
action: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Preference action: install, uninstall, ignore, or unignore.'
|
|
75
|
+
},
|
|
76
|
+
preferenceScope: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Preference scope: project/workspace or global; defaults to project.'
|
|
79
|
+
},
|
|
80
|
+
directory: directorySchema.properties.directory
|
|
81
|
+
},
|
|
82
|
+
required: ['artifact', 'action']
|
|
83
|
+
};
|
|
84
|
+
const publishedSkillsFetchSchema = {
|
|
85
|
+
type: 'object',
|
|
86
|
+
properties: {
|
|
87
|
+
skill: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Single skill slug, artifact name, or skill name; comma-separated values are accepted.'
|
|
90
|
+
},
|
|
91
|
+
skills: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'One or more comma-separated or newline-separated skill slugs, artifact names, or skill names.'
|
|
94
|
+
},
|
|
95
|
+
directory: directorySchema.properties.directory,
|
|
96
|
+
refresh: catalogSchema.properties.refresh,
|
|
97
|
+
recommendationContext: catalogSchema.properties.recommendationContext
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const publishedSkillPreferenceSchema = {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
skill: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'Published skill slug, artifact name, or skill name to update.'
|
|
106
|
+
},
|
|
107
|
+
action: artifactPreferenceSchema.properties.action,
|
|
108
|
+
preferenceScope: artifactPreferenceSchema.properties.preferenceScope,
|
|
109
|
+
directory: directorySchema.properties.directory
|
|
110
|
+
},
|
|
111
|
+
required: ['skill', 'action']
|
|
112
|
+
};
|
|
113
|
+
const piToOpencodeToolNames = {
|
|
114
|
+
wizard_status: 'opencode_wizard_status',
|
|
115
|
+
wizard_catalog_fetch: 'opencode_wizard_catalog_fetch',
|
|
116
|
+
wizard_artifact_fetch: 'opencode_wizard_artifact_fetch',
|
|
117
|
+
wizard_artifact_preference_set: 'opencode_wizard_artifact_preference_set',
|
|
118
|
+
wizard_published_skills_fetch: 'opencode_wizard_published_skills_fetch',
|
|
119
|
+
wizard_published_skill_preference_set: 'opencode_wizard_published_skill_preference_set'
|
|
120
|
+
};
|
|
121
|
+
const opencodeToPiToolNames = Object.fromEntries(Object.entries(piToOpencodeToolNames).map(([piName, opencodeName]) => [opencodeName, piName]));
|
|
122
|
+
const textResult = (text, details = {}) => ({
|
|
123
|
+
content: [{
|
|
124
|
+
type: 'text',
|
|
125
|
+
text
|
|
126
|
+
}],
|
|
127
|
+
details
|
|
128
|
+
});
|
|
129
|
+
const getStringParam = (params, key) => {
|
|
130
|
+
if (!params || typeof params !== 'object') return undefined;
|
|
131
|
+
const value = params[key];
|
|
132
|
+
if (typeof value !== 'string') return undefined;
|
|
133
|
+
const trimmed = value.trim();
|
|
134
|
+
if (!trimmed) return undefined;
|
|
135
|
+
return trimmed;
|
|
136
|
+
};
|
|
137
|
+
const toJsonObject = value => {
|
|
138
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return {};
|
|
139
|
+
return value;
|
|
140
|
+
};
|
|
141
|
+
const isExecutableTool = value => {
|
|
142
|
+
if (!value || typeof value !== 'object') return false;
|
|
143
|
+
const candidate = value;
|
|
144
|
+
return typeof candidate.description === 'string' && typeof candidate.execute === 'function';
|
|
145
|
+
};
|
|
146
|
+
const getRuntime = directory => {
|
|
147
|
+
const key = directory;
|
|
148
|
+
const existingRuntime = runtimeCache.get(key);
|
|
149
|
+
if (existingRuntime) return existingRuntime;
|
|
150
|
+
const runtime = createWizardRuntime({
|
|
151
|
+
worktree: directory,
|
|
152
|
+
directory
|
|
153
|
+
}, createPiRuntimeToolFactory());
|
|
154
|
+
runtimeCache.set(key, runtime);
|
|
155
|
+
return runtime;
|
|
156
|
+
};
|
|
157
|
+
const toToolContext = (directory, toolCallId) => ({
|
|
158
|
+
sessionID: `pi-${process.pid}`,
|
|
159
|
+
messageID: toolCallId,
|
|
160
|
+
agent: 'pi',
|
|
161
|
+
directory,
|
|
162
|
+
worktree: directory,
|
|
163
|
+
abort: AbortSignal.timeout(30_000),
|
|
164
|
+
metadata: () => undefined
|
|
165
|
+
});
|
|
166
|
+
const toPiResult = (toolName, result) => {
|
|
167
|
+
if (typeof result === 'string') return textResult(result, {
|
|
168
|
+
toolName,
|
|
169
|
+
source: PLUGIN_ID
|
|
170
|
+
});
|
|
171
|
+
if (result && typeof result === 'object' && 'output' in result) {
|
|
172
|
+
const outputResult = result;
|
|
173
|
+
return textResult(outputResult.output, {
|
|
174
|
+
...(outputResult.metadata ?? {}),
|
|
175
|
+
toolName,
|
|
176
|
+
source: PLUGIN_ID
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return textResult(JSON.stringify(result ?? null), {
|
|
180
|
+
toolName,
|
|
181
|
+
source: PLUGIN_ID
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const toErrorMessage = error => {
|
|
185
|
+
if (error instanceof Error) return error.message;
|
|
186
|
+
if (typeof error === 'string') return error;
|
|
187
|
+
return 'Unknown Wizard Pi runtime failure.';
|
|
188
|
+
};
|
|
189
|
+
const executeOpencodeTool = async ({
|
|
190
|
+
opencodeToolName,
|
|
191
|
+
toolCallId,
|
|
192
|
+
params
|
|
193
|
+
}) => {
|
|
194
|
+
try {
|
|
195
|
+
const args = toJsonObject(params);
|
|
196
|
+
const directory = getStringParam(args, 'directory') ?? process.cwd();
|
|
197
|
+
const runtime = await getRuntime(directory);
|
|
198
|
+
const tool = runtime.tool[opencodeToolName];
|
|
199
|
+
if (!isExecutableTool(tool)) {
|
|
200
|
+
return textResult(`Wizard Pi tool bridge could not find executable backend tool ${opencodeToolName}.`, {
|
|
201
|
+
status: 'tool_unavailable',
|
|
202
|
+
opencodeToolName,
|
|
203
|
+
source: PLUGIN_ID
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const result = await tool.execute(args, toToolContext(directory, toolCallId));
|
|
207
|
+
return toPiResult(opencodeToolName, result);
|
|
208
|
+
} catch (error) {
|
|
209
|
+
return textResult(`Wizard Pi backend-backed tool request failed: ${toErrorMessage(error)}`, {
|
|
210
|
+
status: 'request_failed',
|
|
211
|
+
opencodeToolName,
|
|
212
|
+
source: PLUGIN_ID
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const createBridgeTool = ({
|
|
217
|
+
name,
|
|
218
|
+
label,
|
|
219
|
+
description,
|
|
220
|
+
promptSnippet,
|
|
221
|
+
promptGuidelines,
|
|
222
|
+
parameters
|
|
223
|
+
}) => ({
|
|
224
|
+
name,
|
|
225
|
+
label,
|
|
226
|
+
description,
|
|
227
|
+
promptSnippet,
|
|
228
|
+
promptGuidelines,
|
|
229
|
+
parameters,
|
|
230
|
+
execute: (toolCallId, params) => executeOpencodeTool({
|
|
231
|
+
opencodeToolName: piToOpencodeToolNames[name],
|
|
232
|
+
toolCallId,
|
|
233
|
+
params
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
export const buildPiTools = () => [createBridgeTool({
|
|
237
|
+
name: 'wizard_status',
|
|
238
|
+
label: 'Wizard Status',
|
|
239
|
+
description: 'Report Wizard backend auth, catalog, cache, source, and workspace-resolution status through the Pi Wizard runtime.',
|
|
240
|
+
promptSnippet: 'Inspect real Wizard backend/auth/catalog status before relying on wizard-listed artifacts.',
|
|
241
|
+
promptGuidelines: ['Use wizard_status when you need to verify Wizard Pi backend/auth/catalog state before relying on fetched artifacts.', 'Missing auth, forbidden role, backend, or catalog problems are operational states reported by the backend-backed runtime.'],
|
|
242
|
+
parameters: directorySchema
|
|
243
|
+
}), createBridgeTool({
|
|
244
|
+
name: 'wizard_catalog_fetch',
|
|
245
|
+
label: 'Wizard Catalog Fetch',
|
|
246
|
+
description: 'Fetch real backend wizard artifact catalog metadata for SKILL or DESIGN_DOC artifacts; metadata is discovery-only until a body is fetched.',
|
|
247
|
+
promptSnippet: 'List backend wizard artifacts for this workspace/directory; fetch bodies before using artifact instructions.',
|
|
248
|
+
promptGuidelines: ['Treat catalog metadata as discovery-only; call wizard_artifact_fetch or wizard_published_skills_fetch for authoritative bodies.'],
|
|
249
|
+
parameters: catalogSchema
|
|
250
|
+
}), createBridgeTool({
|
|
251
|
+
name: 'wizard_artifact_fetch',
|
|
252
|
+
label: 'Wizard Artifact Fetch',
|
|
253
|
+
description: 'Fetch real backend-authorized wizard artifact detail/body for SKILL or DESIGN_DOC artifacts through the Pi Wizard runtime.',
|
|
254
|
+
promptSnippet: 'Fetch a backend wizard artifact body/detail before treating it as authoritative.',
|
|
255
|
+
parameters: artifactFetchSchema
|
|
256
|
+
}), createBridgeTool({
|
|
257
|
+
name: 'wizard_artifact_preference_set',
|
|
258
|
+
label: 'Wizard Artifact Preference Set',
|
|
259
|
+
description: 'Install, uninstall, ignore, or unignore a backend wizard artifact through the Pi Wizard preference runtime.',
|
|
260
|
+
promptSnippet: 'Set backend wizard artifact preference through the real wizard runtime.',
|
|
261
|
+
parameters: artifactPreferenceSchema
|
|
262
|
+
}), createBridgeTool({
|
|
263
|
+
name: 'wizard_published_skills_fetch',
|
|
264
|
+
label: 'Wizard Published Skills Fetch',
|
|
265
|
+
description: 'Compatibility Pi tool to fetch one or more backend-published SKILL.md bodies/details through the Pi Wizard runtime.',
|
|
266
|
+
promptSnippet: 'Fetch backend-published skill bodies before using wizard-listed skill guidance.',
|
|
267
|
+
promptGuidelines: ['Only rely on Wizard skill instructions when this tool returns an explicit backend-fetched body/detail.'],
|
|
268
|
+
parameters: publishedSkillsFetchSchema
|
|
269
|
+
}), createBridgeTool({
|
|
270
|
+
name: 'wizard_published_skill_preference_set',
|
|
271
|
+
label: 'Wizard Published Skill Preference Set',
|
|
272
|
+
description: 'Compatibility Pi tool to install, uninstall, ignore, or unignore a backend-published skill through the Pi Wizard runtime.',
|
|
273
|
+
promptSnippet: 'Set backend-published Wizard skill preference through the real wizard runtime.',
|
|
274
|
+
parameters: publishedSkillPreferenceSchema
|
|
275
|
+
})];
|
|
276
|
+
const appendSystemNotes = (systemPrompt, notes) => {
|
|
277
|
+
const normalizedNotes = notes.map(note => note.trim()).filter(Boolean);
|
|
278
|
+
if (normalizedNotes.length === 0) return systemPrompt;
|
|
279
|
+
const missingNotes = normalizedNotes.filter(note => !systemPrompt.includes(note));
|
|
280
|
+
if (missingNotes.length === 0) return systemPrompt;
|
|
281
|
+
return `${systemPrompt.trimEnd()}\n\n${missingNotes.join('\n\n')}`;
|
|
282
|
+
};
|
|
283
|
+
const toPiSystemNote = note => {
|
|
284
|
+
let piNote = note;
|
|
285
|
+
for (const [opencodeName, piName] of Object.entries(opencodeToPiToolNames)) {
|
|
286
|
+
piNote = piNote.replaceAll(opencodeName, piName);
|
|
287
|
+
}
|
|
288
|
+
return piNote;
|
|
289
|
+
};
|
|
290
|
+
const buildSystemPrompt = async event => {
|
|
291
|
+
try {
|
|
292
|
+
const directory = process.cwd();
|
|
293
|
+
const runtime = await getRuntime(directory);
|
|
294
|
+
const output = {
|
|
295
|
+
system: []
|
|
296
|
+
};
|
|
297
|
+
await runtime['experimental.chat.system.transform']({}, output);
|
|
298
|
+
return {
|
|
299
|
+
systemPrompt: appendSystemNotes(event.systemPrompt, output.system.map(toPiSystemNote))
|
|
300
|
+
};
|
|
301
|
+
} catch (error) {
|
|
302
|
+
const failureNote = ['Wizard Pi context:', 'status=request_failed', `source=${PLUGIN_ID}`, `message=${toErrorMessage(error)}`].join(' ');
|
|
303
|
+
return {
|
|
304
|
+
systemPrompt: appendSystemNotes(event.systemPrompt, [failureNote])
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
export default async function opencodeWizardPiExtension(pi) {
|
|
309
|
+
for (const tool of buildPiTools()) {
|
|
310
|
+
pi.registerTool(tool);
|
|
311
|
+
}
|
|
312
|
+
pi.on('before_agent_start', buildSystemPrompt);
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=server-pi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createWizardRuntime","PLUGIN_ID","createSchemaValue","optional","describe","createPiRuntimeToolFactory","createTool","definition","description","execute","args","context","tool","Object","assign","schema","string","boolean","runtimeCache","Map","directorySchema","type","properties","directory","catalogSchema","artifactKind","refresh","recommendationContext","artifactFetchSchema","artifact","artifacts","artifactPreferenceSchema","action","preferenceScope","required","publishedSkillsFetchSchema","skill","skills","publishedSkillPreferenceSchema","piToOpencodeToolNames","wizard_status","wizard_catalog_fetch","wizard_artifact_fetch","wizard_artifact_preference_set","wizard_published_skills_fetch","wizard_published_skill_preference_set","opencodeToPiToolNames","fromEntries","entries","map","piName","opencodeName","textResult","text","details","content","getStringParam","params","key","undefined","value","trimmed","trim","toJsonObject","Array","isArray","isExecutableTool","candidate","getRuntime","existingRuntime","get","runtime","worktree","set","toToolContext","toolCallId","sessionID","process","pid","messageID","agent","abort","AbortSignal","timeout","metadata","toPiResult","toolName","result","source","outputResult","output","JSON","stringify","toErrorMessage","error","Error","message","executeOpencodeTool","opencodeToolName","cwd","status","createBridgeTool","name","label","promptSnippet","promptGuidelines","parameters","buildPiTools","appendSystemNotes","systemPrompt","notes","normalizedNotes","note","filter","Boolean","length","missingNotes","includes","trimEnd","join","toPiSystemNote","piNote","replaceAll","buildSystemPrompt","event","system","failureNote","opencodeWizardPiExtension","pi","registerTool","on"],"sources":["../src/server-pi.ts"],"sourcesContent":["import { createWizardRuntime, PLUGIN_ID } from './server/runtime.js';\nimport type { ToolDefinition, ToolFactory } from './plugin-tools.js';\n\ntype JsonObject = Record<string, unknown>;\n\ntype PiToolResult = {\n content: Array<{ type: 'text'; text: string }>;\n details: JsonObject;\n};\n\ntype PiParamSchema = {\n type: 'object';\n properties: Record<string, unknown>;\n required?: string[];\n};\n\ntype PiToolDefinition = {\n name: string;\n label: string;\n description: string;\n promptSnippet?: string;\n promptGuidelines?: string[];\n parameters: PiParamSchema;\n execute: (toolCallId: string, params: unknown) => Promise<PiToolResult>;\n};\n\ntype BeforeAgentStartEvent = {\n systemPrompt: string;\n};\n\ntype PiExtensionApi = {\n registerTool: (tool: PiToolDefinition) => void;\n on: (event: 'before_agent_start', handler: (event: BeforeAgentStartEvent) => Promise<{ systemPrompt: string }>) => void;\n};\n\ntype OpencodeToolResult =\n | string\n | {\n output: string;\n metadata?: JsonObject;\n };\n\ntype OpencodeToolContext = {\n sessionID: string;\n messageID: string;\n agent: string;\n directory: string;\n worktree: string;\n abort: AbortSignal;\n metadata: (input: { title?: string; metadata?: JsonObject }) => void;\n};\n\ntype OpencodeExecutableTool = {\n description: string;\n execute: (args: JsonObject, context: OpencodeToolContext) => Promise<unknown>;\n};\n\ntype RuntimeEntry = Awaited<ReturnType<typeof createWizardRuntime>>;\n\ntype SchemaValue = {\n optional: () => SchemaValue;\n describe: (description: string) => SchemaValue;\n};\n\nconst createSchemaValue = (): SchemaValue => ({\n optional: createSchemaValue,\n describe: createSchemaValue,\n});\n\nconst createPiRuntimeToolFactory = (): ToolFactory => {\n const createTool = <TArgs extends object>(definition: ToolDefinition<TArgs>) => ({\n description: definition.description,\n execute: (args: JsonObject, context: OpencodeToolContext) => definition.execute(args as TArgs, context),\n });\n\n const tool = Object.assign(createTool, {\n schema: {\n string: createSchemaValue,\n boolean: createSchemaValue,\n },\n });\n\n return tool;\n};\n\nconst runtimeCache = new Map<string, Promise<RuntimeEntry>>();\n\nconst directorySchema: PiParamSchema = {\n type: 'object',\n properties: {\n directory: {\n type: 'string',\n description: 'Optional absolute or relative directory override for workspace-scoped wizard resolution.',\n },\n },\n};\n\nconst catalogSchema: PiParamSchema = {\n type: 'object',\n properties: {\n artifactKind: {\n type: 'string',\n description: 'Wizard artifact kind to catalog: SKILL or DESIGN_DOC; defaults to SKILL.',\n },\n directory: directorySchema.properties.directory,\n refresh: {\n type: 'boolean',\n description: 'Bypass the local plugin cache for this request.',\n },\n recommendationContext: {\n type: 'string',\n description: 'Optional metadata-only relevance/ranking context for catalog recommendations.',\n },\n },\n};\n\nconst artifactFetchSchema: PiParamSchema = {\n type: 'object',\n properties: {\n artifactKind: catalogSchema.properties.artifactKind,\n artifact: {\n type: 'string',\n description: 'Single artifact identifier; for SKILL this is a skill slug, artifact name, or skill name.',\n },\n artifacts: {\n type: 'string',\n description: 'One or more comma-separated or newline-separated artifact identifiers.',\n },\n directory: directorySchema.properties.directory,\n refresh: catalogSchema.properties.refresh,\n recommendationContext: catalogSchema.properties.recommendationContext,\n },\n};\n\nconst artifactPreferenceSchema: PiParamSchema = {\n type: 'object',\n properties: {\n artifactKind: catalogSchema.properties.artifactKind,\n artifact: {\n type: 'string',\n description: 'Artifact identifier; for SKILL this is the published skill slug.',\n },\n action: {\n type: 'string',\n description: 'Preference action: install, uninstall, ignore, or unignore.',\n },\n preferenceScope: {\n type: 'string',\n description: 'Preference scope: project/workspace or global; defaults to project.',\n },\n directory: directorySchema.properties.directory,\n },\n required: ['artifact', 'action'],\n};\n\nconst publishedSkillsFetchSchema: PiParamSchema = {\n type: 'object',\n properties: {\n skill: {\n type: 'string',\n description: 'Single skill slug, artifact name, or skill name; comma-separated values are accepted.',\n },\n skills: {\n type: 'string',\n description: 'One or more comma-separated or newline-separated skill slugs, artifact names, or skill names.',\n },\n directory: directorySchema.properties.directory,\n refresh: catalogSchema.properties.refresh,\n recommendationContext: catalogSchema.properties.recommendationContext,\n },\n};\n\nconst publishedSkillPreferenceSchema: PiParamSchema = {\n type: 'object',\n properties: {\n skill: {\n type: 'string',\n description: 'Published skill slug, artifact name, or skill name to update.',\n },\n action: artifactPreferenceSchema.properties.action,\n preferenceScope: artifactPreferenceSchema.properties.preferenceScope,\n directory: directorySchema.properties.directory,\n },\n required: ['skill', 'action'],\n};\n\nconst piToOpencodeToolNames = {\n wizard_status: 'opencode_wizard_status',\n wizard_catalog_fetch: 'opencode_wizard_catalog_fetch',\n wizard_artifact_fetch: 'opencode_wizard_artifact_fetch',\n wizard_artifact_preference_set: 'opencode_wizard_artifact_preference_set',\n wizard_published_skills_fetch: 'opencode_wizard_published_skills_fetch',\n wizard_published_skill_preference_set: 'opencode_wizard_published_skill_preference_set',\n} as const;\n\nconst opencodeToPiToolNames = Object.fromEntries(\n Object.entries(piToOpencodeToolNames).map(([piName, opencodeName]) => [opencodeName, piName]),\n) as Record<(typeof piToOpencodeToolNames)[keyof typeof piToOpencodeToolNames], keyof typeof piToOpencodeToolNames>;\n\nconst textResult = (text: string, details: JsonObject = {}): PiToolResult => ({\n content: [{ type: 'text', text }],\n details,\n});\n\nconst getStringParam = (params: unknown, key: string): string | undefined => {\n if (!params || typeof params !== 'object') return undefined;\n const value = (params as JsonObject)[key];\n if (typeof value !== 'string') return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n return trimmed;\n};\n\nconst toJsonObject = (value: unknown): JsonObject => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return {};\n return value as JsonObject;\n};\n\nconst isExecutableTool = (value: unknown): value is OpencodeExecutableTool => {\n if (!value || typeof value !== 'object') return false;\n const candidate = value as { description?: unknown; execute?: unknown };\n return typeof candidate.description === 'string' && typeof candidate.execute === 'function';\n};\n\nconst getRuntime = (directory: string): Promise<RuntimeEntry> => {\n const key = directory;\n const existingRuntime = runtimeCache.get(key);\n if (existingRuntime) return existingRuntime;\n\n const runtime = createWizardRuntime({ worktree: directory, directory }, createPiRuntimeToolFactory());\n runtimeCache.set(key, runtime);\n return runtime;\n};\n\nconst toToolContext = (directory: string, toolCallId: string): OpencodeToolContext => ({\n sessionID: `pi-${process.pid}`,\n messageID: toolCallId,\n agent: 'pi',\n directory,\n worktree: directory,\n abort: AbortSignal.timeout(30_000),\n metadata: () => undefined,\n});\n\nconst toPiResult = (toolName: string, result: unknown): PiToolResult => {\n if (typeof result === 'string') return textResult(result, { toolName, source: PLUGIN_ID });\n if (result && typeof result === 'object' && 'output' in result) {\n const outputResult = result as Exclude<OpencodeToolResult, string>;\n return textResult(outputResult.output, { ...(outputResult.metadata ?? {}), toolName, source: PLUGIN_ID });\n }\n return textResult(JSON.stringify(result ?? null), { toolName, source: PLUGIN_ID });\n};\n\nconst toErrorMessage = (error: unknown): string => {\n if (error instanceof Error) return error.message;\n if (typeof error === 'string') return error;\n return 'Unknown Wizard Pi runtime failure.';\n};\n\nconst executeOpencodeTool = async ({\n opencodeToolName,\n toolCallId,\n params,\n}: {\n opencodeToolName: string;\n toolCallId: string;\n params: unknown;\n}): Promise<PiToolResult> => {\n try {\n const args = toJsonObject(params);\n const directory = getStringParam(args, 'directory') ?? process.cwd();\n const runtime = await getRuntime(directory);\n const tool = runtime.tool[opencodeToolName];\n\n if (!isExecutableTool(tool)) {\n return textResult(`Wizard Pi tool bridge could not find executable backend tool ${opencodeToolName}.`, {\n status: 'tool_unavailable',\n opencodeToolName,\n source: PLUGIN_ID,\n });\n }\n\n const result = await tool.execute(args, toToolContext(directory, toolCallId));\n return toPiResult(opencodeToolName, result);\n } catch (error) {\n return textResult(`Wizard Pi backend-backed tool request failed: ${toErrorMessage(error)}`, {\n status: 'request_failed',\n opencodeToolName,\n source: PLUGIN_ID,\n });\n }\n};\n\nconst createBridgeTool = ({\n name,\n label,\n description,\n promptSnippet,\n promptGuidelines,\n parameters,\n}: {\n name: keyof typeof piToOpencodeToolNames;\n label: string;\n description: string;\n promptSnippet: string;\n promptGuidelines?: string[];\n parameters: PiParamSchema;\n}): PiToolDefinition => ({\n name,\n label,\n description,\n promptSnippet,\n promptGuidelines,\n parameters,\n execute: (toolCallId, params) => executeOpencodeTool({ opencodeToolName: piToOpencodeToolNames[name], toolCallId, params }),\n});\n\nexport const buildPiTools = (): PiToolDefinition[] => [\n createBridgeTool({\n name: 'wizard_status',\n label: 'Wizard Status',\n description:\n 'Report Wizard backend auth, catalog, cache, source, and workspace-resolution status through the Pi Wizard runtime.',\n promptSnippet: 'Inspect real Wizard backend/auth/catalog status before relying on wizard-listed artifacts.',\n promptGuidelines: [\n 'Use wizard_status when you need to verify Wizard Pi backend/auth/catalog state before relying on fetched artifacts.',\n 'Missing auth, forbidden role, backend, or catalog problems are operational states reported by the backend-backed runtime.',\n ],\n parameters: directorySchema,\n }),\n createBridgeTool({\n name: 'wizard_catalog_fetch',\n label: 'Wizard Catalog Fetch',\n description:\n 'Fetch real backend wizard artifact catalog metadata for SKILL or DESIGN_DOC artifacts; metadata is discovery-only until a body is fetched.',\n promptSnippet: 'List backend wizard artifacts for this workspace/directory; fetch bodies before using artifact instructions.',\n promptGuidelines: ['Treat catalog metadata as discovery-only; call wizard_artifact_fetch or wizard_published_skills_fetch for authoritative bodies.'],\n parameters: catalogSchema,\n }),\n createBridgeTool({\n name: 'wizard_artifact_fetch',\n label: 'Wizard Artifact Fetch',\n description:\n 'Fetch real backend-authorized wizard artifact detail/body for SKILL or DESIGN_DOC artifacts through the Pi Wizard runtime.',\n promptSnippet: 'Fetch a backend wizard artifact body/detail before treating it as authoritative.',\n parameters: artifactFetchSchema,\n }),\n createBridgeTool({\n name: 'wizard_artifact_preference_set',\n label: 'Wizard Artifact Preference Set',\n description:\n 'Install, uninstall, ignore, or unignore a backend wizard artifact through the Pi Wizard preference runtime.',\n promptSnippet: 'Set backend wizard artifact preference through the real wizard runtime.',\n parameters: artifactPreferenceSchema,\n }),\n createBridgeTool({\n name: 'wizard_published_skills_fetch',\n label: 'Wizard Published Skills Fetch',\n description:\n 'Compatibility Pi tool to fetch one or more backend-published SKILL.md bodies/details through the Pi Wizard runtime.',\n promptSnippet: 'Fetch backend-published skill bodies before using wizard-listed skill guidance.',\n promptGuidelines: ['Only rely on Wizard skill instructions when this tool returns an explicit backend-fetched body/detail.'],\n parameters: publishedSkillsFetchSchema,\n }),\n createBridgeTool({\n name: 'wizard_published_skill_preference_set',\n label: 'Wizard Published Skill Preference Set',\n description:\n 'Compatibility Pi tool to install, uninstall, ignore, or unignore a backend-published skill through the Pi Wizard runtime.',\n promptSnippet: 'Set backend-published Wizard skill preference through the real wizard runtime.',\n parameters: publishedSkillPreferenceSchema,\n }),\n];\n\nconst appendSystemNotes = (systemPrompt: string, notes: string[]): string => {\n const normalizedNotes = notes.map((note) => note.trim()).filter(Boolean);\n if (normalizedNotes.length === 0) return systemPrompt;\n const missingNotes = normalizedNotes.filter((note) => !systemPrompt.includes(note));\n if (missingNotes.length === 0) return systemPrompt;\n return `${systemPrompt.trimEnd()}\\n\\n${missingNotes.join('\\n\\n')}`;\n};\n\nconst toPiSystemNote = (note: string): string => {\n let piNote = note;\n for (const [opencodeName, piName] of Object.entries(opencodeToPiToolNames)) {\n piNote = piNote.replaceAll(opencodeName, piName);\n }\n return piNote;\n};\n\nconst buildSystemPrompt = async (event: BeforeAgentStartEvent): Promise<{ systemPrompt: string }> => {\n try {\n const directory = process.cwd();\n const runtime = await getRuntime(directory);\n const output = { system: [] as string[] };\n await runtime['experimental.chat.system.transform']({}, output);\n return { systemPrompt: appendSystemNotes(event.systemPrompt, output.system.map(toPiSystemNote)) };\n } catch (error) {\n const failureNote = [\n 'Wizard Pi context:',\n 'status=request_failed',\n `source=${PLUGIN_ID}`,\n `message=${toErrorMessage(error)}`,\n ].join(' ');\n return { systemPrompt: appendSystemNotes(event.systemPrompt, [failureNote]) };\n }\n};\n\nexport default async function opencodeWizardPiExtension(pi: PiExtensionApi): Promise<void> {\n for (const tool of buildPiTools()) {\n pi.registerTool(tool);\n }\n\n pi.on('before_agent_start', buildSystemPrompt);\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,SAAS,QAAQ,qBAAqB;AAgEpE,MAAMC,iBAAiB,GAAGA,CAAA,MAAoB;EAC5CC,QAAQ,EAAED,iBAAiB;EAC3BE,QAAQ,EAAEF;AACZ,CAAC,CAAC;AAEF,MAAMG,0BAA0B,GAAGA,CAAA,KAAmB;EACpD,MAAMC,UAAU,GAA0BC,UAAiC,KAAM;IAC/EC,WAAW,EAAED,UAAU,CAACC,WAAW;IACnCC,OAAO,EAAEA,CAACC,IAAgB,EAAEC,OAA4B,KAAKJ,UAAU,CAACE,OAAO,CAACC,IAAI,EAAWC,OAAO;EACxG,CAAC,CAAC;EAEF,MAAMC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAACR,UAAU,EAAE;IACrCS,MAAM,EAAE;MACNC,MAAM,EAAEd,iBAAiB;MACzBe,OAAO,EAAEf;IACX;EACF,CAAC,CAAC;EAEF,OAAOU,IAAI;AACb,CAAC;AAED,MAAMM,YAAY,GAAG,IAAIC,GAAG,CAAgC,CAAC;AAE7D,MAAMC,eAA8B,GAAG;EACrCC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE;IACVC,SAAS,EAAE;MACTF,IAAI,EAAE,QAAQ;MACdb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G;MAAEmC,MAAM,EAAE;IAAe,CAAC;IACzC,MAAMtD,OAAO,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,EAAEmB,MAAM,CAAC;IAC/D,OAAO;MAAEmB,YAAY,EAAED,iBAAiB,CAACgB,KAAK,CAACf,YAAY,EAAEnB,MAAM,CAACmC,MAAM,CAAC5E,GAAG,CAACuE,cAAc,CAAC;IAAE,CAAC;EACnG,CAAC,CAAC,OAAO1B,KAAK,EAAE;IACd,MAAMgC,WAAW,GAAG,CAClB,oBAAoB,EACpB,uBAAuB,EACvB,UAAU7H,SAAS,EAAE,EACrB,WAAW4F,cAAc,CAACC,KAAK,CAAC,EAAE,CACnC,CAACyB,IAAI,CAAC,GAAG,CAAC;IACX,OAAO;MAAEV,YAAY,EAAED,iBAAiB,CAACgB,KAAK,CAACf,YAAY,EAAE,CAACiB,WAAW,CAAC;IAAE,CAAC;EAC/E;AACF,CAAC;AAED,eAAe,eAAeC,yBAAyBA,CAACC,EAAkB,EAAiB;EACzF,KAAK,MAAMpH,IAAI,IAAI+F,YAAY,CAAC,CAAC,EAAE;IACjCqB,EAAE,CAACC,YAAY,CAACrH,IAAI,CAAC;EACvB;EAEAoH,EAAE,CAACE,EAAE,CAAC,oBAAoB,EAAEP,iBAAiB,CAAC;AAChD","ignoreList":[]}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,8 +2,4 @@ export { AVAILABLE_PUBLISHED_SKILL_TOOLS, resolveAvailableTools, type PublishedS
|
|
|
2
2
|
export { buildSkillMarkdown, parseRequestedSkillArgs, selectPublishedSkills, toPublishedSkillDetail, } from './published-skills-transform.js';
|
|
3
3
|
export { planWizardArtifactImport } from './server/import-sources.js';
|
|
4
4
|
export { PLUGIN_ID, NATIVE_SKILLS_URL_COMPATIBILITY, buildSystemNote, resolveConfig, resolvePluginStatusSnapshot, resolvePluginStatusSnapshotWithAuthBootstrap, setPublishedSkillIgnored, setPublishedSkillInstalled, toPluginAuthStateSummary, toPublishedSkillCatalog, type NativeSkillsUrlCompatibility, type PluginAuthStateSummary, type PluginStatusSnapshot, type PublishedSkillCatalogItem, type PublishedSkillCatalogPayload, type PublishedSkillDetailItem, type PublishedSkillInstallableCatalogItem, } from './server/runtime.js';
|
|
5
|
-
|
|
6
|
-
id: string;
|
|
7
|
-
server: import("./server/types.js").OpencodePluginServer;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
5
|
+
export { OpencodeWizardSkillsPlugin, default } from './server-opencode.js';
|
package/dist/server.js
CHANGED
|
@@ -2,9 +2,5 @@ export { AVAILABLE_PUBLISHED_SKILL_TOOLS, resolveAvailableTools } from './plugin
|
|
|
2
2
|
export { buildSkillMarkdown, parseRequestedSkillArgs, selectPublishedSkills, toPublishedSkillDetail } from './published-skills-transform.js';
|
|
3
3
|
export { planWizardArtifactImport } from './server/import-sources.js';
|
|
4
4
|
export { PLUGIN_ID, NATIVE_SKILLS_URL_COMPATIBILITY, buildSystemNote, resolveConfig, resolvePluginStatusSnapshot, resolvePluginStatusSnapshotWithAuthBootstrap, setPublishedSkillIgnored, setPublishedSkillInstalled, toPluginAuthStateSummary, toPublishedSkillCatalog } from './server/runtime.js';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
id: PLUGIN_ID,
|
|
8
|
-
server: OpencodeWizardSkillsPlugin
|
|
9
|
-
};
|
|
5
|
+
export { OpencodeWizardSkillsPlugin, default } from './server-opencode.js';
|
|
10
6
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AVAILABLE_PUBLISHED_SKILL_TOOLS","resolveAvailableTools","buildSkillMarkdown","parseRequestedSkillArgs","selectPublishedSkills","toPublishedSkillDetail","planWizardArtifactImport","PLUGIN_ID","NATIVE_SKILLS_URL_COMPATIBILITY","buildSystemNote","resolveConfig","resolvePluginStatusSnapshot","resolvePluginStatusSnapshotWithAuthBootstrap","setPublishedSkillIgnored","setPublishedSkillInstalled","toPluginAuthStateSummary","toPublishedSkillCatalog","OpencodeWizardSkillsPlugin","
|
|
1
|
+
{"version":3,"names":["AVAILABLE_PUBLISHED_SKILL_TOOLS","resolveAvailableTools","buildSkillMarkdown","parseRequestedSkillArgs","selectPublishedSkills","toPublishedSkillDetail","planWizardArtifactImport","PLUGIN_ID","NATIVE_SKILLS_URL_COMPATIBILITY","buildSystemNote","resolveConfig","resolvePluginStatusSnapshot","resolvePluginStatusSnapshotWithAuthBootstrap","setPublishedSkillIgnored","setPublishedSkillInstalled","toPluginAuthStateSummary","toPublishedSkillCatalog","OpencodeWizardSkillsPlugin","default"],"sources":["../src/server.ts"],"sourcesContent":["export {\n AVAILABLE_PUBLISHED_SKILL_TOOLS,\n resolveAvailableTools,\n type PublishedSkillFetchArgs,\n} from './plugin-tools.js';\nexport {\n buildSkillMarkdown,\n parseRequestedSkillArgs,\n selectPublishedSkills,\n toPublishedSkillDetail,\n} from './published-skills-transform.js';\nexport { planWizardArtifactImport } from './server/import-sources.js';\nexport {\n PLUGIN_ID,\n NATIVE_SKILLS_URL_COMPATIBILITY,\n buildSystemNote,\n resolveConfig,\n resolvePluginStatusSnapshot,\n resolvePluginStatusSnapshotWithAuthBootstrap,\n setPublishedSkillIgnored,\n setPublishedSkillInstalled,\n toPluginAuthStateSummary,\n toPublishedSkillCatalog,\n type NativeSkillsUrlCompatibility,\n type PluginAuthStateSummary,\n type PluginStatusSnapshot,\n type PublishedSkillCatalogItem,\n type PublishedSkillCatalogPayload,\n type PublishedSkillDetailItem,\n type PublishedSkillInstallableCatalogItem,\n} from './server/runtime.js';\nexport { OpencodeWizardSkillsPlugin, default } from './server-opencode.js';\n"],"mappings":"AAAA,SACEA,+BAA+B,EAC/BC,qBAAqB,QAEhB,mBAAmB;AAC1B,SACEC,kBAAkB,EAClBC,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,QACjB,iCAAiC;AACxC,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SACEC,SAAS,EACTC,+BAA+B,EAC/BC,eAAe,EACfC,aAAa,EACbC,2BAA2B,EAC3BC,4CAA4C,EAC5CC,wBAAwB,EACxBC,0BAA0B,EAC1BC,wBAAwB,EACxBC,uBAAuB,QAQlB,qBAAqB;AAC5B,SAASC,0BAA0B,EAAEC,OAAO,QAAQ,sBAAsB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aexol/opencode-wizard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "OpenCode plugin for opencode-wizard published skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"oc-plugin": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
35
|
"url": "git+https://gitlab.com/aexol/open-source/opencode-wizard.git",
|
|
36
|
-
"directory": "
|
|
36
|
+
"directory": "plugins/opencode-wizard"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"opencode",
|