@aexol/opencode-wizard 0.4.8 → 0.5.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.
@@ -2,8 +2,10 @@ import { type ToolFactory } from '../plugin-tools.js';
2
2
  export { resolveConfig } from './config.js';
3
3
  export { PLUGIN_ID, NATIVE_SKILLS_URL_COMPATIBILITY, type NativeSkillsUrlCompatibility } from './constants.js';
4
4
  export { buildSystemNote, resolvePluginStatusSnapshot, toPluginAuthStateSummary, toPublishedSkillCatalog, } from './status.js';
5
- import type { OpencodePluginServer, OpencodePluginServerInput } from './types.js';
5
+ import type { OpencodePluginServer, OpencodePluginServerInput, PluginEventSource } from './types.js';
6
6
  export type { PluginAuthStateSummary, PluginStatusSnapshot, PublishedSkillCatalogItem, PublishedSkillCatalogPayload, PublishedSkillDetailItem, PublishedSkillInstallableCatalogItem, } from './types.js';
7
7
  export { resolvePluginStatusSnapshotWithAuthBootstrap } from './auth-bootstrap.js';
8
8
  export { setPublishedSkillIgnored, setPublishedSkillInstalled, toPublishedSkillPreferenceScope } from './preferences.js';
9
- export declare const createWizardRuntime: (input: OpencodePluginServerInput, tool: ToolFactory) => ReturnType<OpencodePluginServer>;
9
+ export declare const createWizardRuntime: (input: OpencodePluginServerInput, tool: ToolFactory, options?: {
10
+ eventSource?: PluginEventSource;
11
+ }) => ReturnType<OpencodePluginServer>;
@@ -216,8 +216,9 @@ const getMissingIdentifierSuggestions = (identifiers, candidates) => identifiers
216
216
  identifier,
217
217
  suggestions: getIdentifierSuggestions(identifier, candidates)
218
218
  }));
219
- export const createWizardRuntime = async (input, tool) => {
219
+ export const createWizardRuntime = async (input, tool, options = {}) => {
220
220
  const config = await resolveConfig(input.worktree);
221
+ const eventSource = options.eventSource ?? 'OPENCODE';
221
222
  const workspacePath = normalizeAbsolutePath(input.worktree);
222
223
  const cache = new Map();
223
224
  const catalogInflight = new Map();
@@ -256,6 +257,7 @@ export const createWizardRuntime = async (input, tool) => {
256
257
  config,
257
258
  authState: authState ?? (await resolveActionAuthState()),
258
259
  event,
260
+ source: eventSource,
259
261
  workspacePath,
260
262
  directoryPath
261
263
  });
@@ -270,6 +272,7 @@ export const createWizardRuntime = async (input, tool) => {
270
272
  config,
271
273
  authState,
272
274
  event: 'START',
275
+ source: eventSource,
273
276
  workspacePath
274
277
  }), emitActionEventForCurrentSession({
275
278
  event: 'START',
@@ -293,6 +296,7 @@ export const createWizardRuntime = async (input, tool) => {
293
296
  config,
294
297
  authState: lastAuthenticatedAuthState,
295
298
  event: 'STOP',
299
+ source: eventSource,
296
300
  workspacePath
297
301
  }), emitActionEventForCurrentSession({
298
302
  event: 'STOP',
@@ -387,6 +391,7 @@ export const createWizardRuntime = async (input, tool) => {
387
391
  code: callbackPayload.code,
388
392
  codeVerifier: loginStart.codeVerifier,
389
393
  redirectUri: OIDC_CALLBACK_URL,
394
+ source: eventSource,
390
395
  config,
391
396
  signal: loginSignal
392
397
  });
@@ -460,7 +465,7 @@ export const createWizardRuntime = async (input, tool) => {
460
465
  return inflight;
461
466
  }
462
467
  const requestPromise = (async () => {
463
- const fetchResult = await fetchPublishedSkillsCatalog(input.worktree, config, workspaceResolution, signal, recommendationContext, clearPublishedSkillState);
468
+ const fetchResult = await fetchPublishedSkillsCatalog(input.worktree, config, workspaceResolution, signal, recommendationContext, eventSource, clearPublishedSkillState);
464
469
  await maybePersistWorkspaceSlugFromCatalog({
465
470
  config,
466
471
  resolution: workspaceResolution,
@@ -521,7 +526,8 @@ export const createWizardRuntime = async (input, tool) => {
521
526
  artifactVersionId: item.publishedArtifact.id,
522
527
  signal,
523
528
  onAuthStateChanged: clearPublishedSkillState,
524
- purpose
529
+ purpose,
530
+ source: eventSource
525
531
  });
526
532
  if (!detailResult.ok) {
527
533
  return {
@@ -605,7 +611,8 @@ export const createWizardRuntime = async (input, tool) => {
605
611
  artifactVersionId: item.artifactVersion.id,
606
612
  signal,
607
613
  onAuthStateChanged: clearPublishedSkillState,
608
- purpose
614
+ purpose,
615
+ source: eventSource
609
616
  });
610
617
  wizardArtifactDetailInflight.set(inflightKey, requestPromise);
611
618
  try {
@@ -883,7 +890,7 @@ export const createWizardRuntime = async (input, tool) => {
883
890
  config,
884
891
  directory: requestedDirectory
885
892
  });
886
- const fetchResult = await fetchWizardArtifactsCatalog(input.worktree, config, workspaceResolution, artifactKind, context.abort, recommendationContext, clearPublishedSkillState);
893
+ const fetchResult = await fetchWizardArtifactsCatalog(input.worktree, config, workspaceResolution, artifactKind, context.abort, recommendationContext, eventSource, clearPublishedSkillState);
887
894
  if (!fetchResult.ok) {
888
895
  return {
889
896
  output: JSON.stringify({
@@ -969,7 +976,7 @@ export const createWizardRuntime = async (input, tool) => {
969
976
  config,
970
977
  directory: requestedDirectory
971
978
  });
972
- const fetchResult = await fetchWizardArtifactsCatalog(input.worktree, config, workspaceResolution, artifactKind, context.abort, recommendationContext, clearPublishedSkillState);
979
+ const fetchResult = await fetchWizardArtifactsCatalog(input.worktree, config, workspaceResolution, artifactKind, context.abort, recommendationContext, eventSource, clearPublishedSkillState);
973
980
  if (!fetchResult.ok) {
974
981
  return {
975
982
  output: JSON.stringify({
@@ -1224,13 +1231,15 @@ export const createWizardRuntime = async (input, tool) => {
1224
1231
  directory: requestedDirectory,
1225
1232
  skillSlug,
1226
1233
  ignored: action === 'ignore',
1227
- preferenceScope: toPublishedSkillPreferenceScope(args.preferenceScope, 'project')
1234
+ preferenceScope: toPublishedSkillPreferenceScope(args.preferenceScope, 'project'),
1235
+ source: eventSource
1228
1236
  }) : await setPublishedSkillInstalled({
1229
1237
  worktree: input.worktree,
1230
1238
  directory: requestedDirectory,
1231
1239
  skillSlug,
1232
1240
  installed: action === 'install',
1233
- preferenceScope: toPublishedSkillPreferenceScope(args.preferenceScope, 'project')
1241
+ preferenceScope: toPublishedSkillPreferenceScope(args.preferenceScope, 'project'),
1242
+ source: eventSource
1234
1243
  });
1235
1244
  await scheduleInteractivePresenceStart();
1236
1245
  await emitPreferenceOutcome('PREFERENCE_SUCCESS');
@@ -1312,6 +1321,7 @@ export const createWizardRuntime = async (input, tool) => {
1312
1321
  repositoryUrl: workspaceResolution.repositoryUrl,
1313
1322
  directoryPath: workspaceResolution.directoryPath,
1314
1323
  artifactKind,
1324
+ source: eventSource,
1315
1325
  artifactSlug: args.artifact.trim(),
1316
1326
  preferenceScope: toPublishedSkillPreferenceScope(args.preferenceScope, 'project') === 'global' ? 'GLOBAL' : 'WORKSPACE',
1317
1327
  installed: action === 'install' ? true : action === 'uninstall' ? false : undefined,