@aexol/opencode-wizard 0.1.8 → 0.1.11

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/server.js CHANGED
@@ -1329,7 +1329,7 @@ const OpencodeWizardSkillsPlugin = async input => {
1329
1329
  browserUrl: loginStart.browserUrl,
1330
1330
  browserOpenError,
1331
1331
  email: null,
1332
- message: browserOpenError ? `Automatic browser open failed. Open ${loginStart.browserUrl} manually.` : 'Browser login started for published skill fetch.'
1332
+ message: browserOpenError ? `Automatic browser open failed. Open ${loginStart.browserUrl} manually.` : `Browser login started for published skill ${trigger}.`
1333
1333
  };
1334
1334
  try {
1335
1335
  const callbackPayload = await loginStart.callbackPromise;
@@ -1370,7 +1370,7 @@ const OpencodeWizardSkillsPlugin = async input => {
1370
1370
  browserUrl: loginStart.browserUrl,
1371
1371
  browserOpenError,
1372
1372
  email: authState.email,
1373
- message: 'Browser login completed successfully for published skill fetch.'
1373
+ message: `Browser login completed successfully for published skill ${trigger}.`
1374
1374
  };
1375
1375
  return authState;
1376
1376
  } catch (error) {
@@ -1738,11 +1738,25 @@ const OpencodeWizardSkillsPlugin = async input => {
1738
1738
  context
1739
1739
  }) => {
1740
1740
  const requestedDirectory = normalizeDirectoryArg(context.directory, args.directory);
1741
- const snapshot = await resolvePluginStatusSnapshot({
1741
+ let snapshot = await resolvePluginStatusSnapshot({
1742
1742
  worktree: input.worktree,
1743
1743
  directory: requestedDirectory,
1744
1744
  signal: context.abort
1745
1745
  });
1746
+ if (snapshot.status === 'missing_auth') {
1747
+ try {
1748
+ await startLoginCompletion('status').then(async authState => {
1749
+ await schedulePresenceStart(authState);
1750
+ });
1751
+ snapshot = await resolvePluginStatusSnapshot({
1752
+ worktree: input.worktree,
1753
+ directory: requestedDirectory,
1754
+ signal: context.abort
1755
+ });
1756
+ } catch {
1757
+ // Keep returning the safe missing-auth snapshot when interactive login is cancelled or fails.
1758
+ }
1759
+ }
1746
1760
  const metadata = toPluginStatusMetadata(snapshot);
1747
1761
  context.metadata({
1748
1762
  title: `opencode-wizard status: ${snapshot.status} / auth ${snapshot.authState.status}`,
@@ -1771,7 +1785,7 @@ const OpencodeWizardSkillsPlugin = async input => {
1771
1785
  }
1772
1786
  }),
1773
1787
  opencode_wizard_status: tool({
1774
- description: 'Report opencode-wizard plugin status, targeted backend/GraphQL URLs, and safe auth summary without exposing tokens',
1788
+ description: 'Report opencode-wizard plugin status, bootstrap auth when missing, and return a safe auth summary without exposing tokens',
1775
1789
  args: {
1776
1790
  directory: tool.schema.string().optional().describe('Optional absolute or relative directory override')
1777
1791
  },
@@ -1784,14 +1798,30 @@ const OpencodeWizardSkillsPlugin = async input => {
1784
1798
  })
1785
1799
  },
1786
1800
  'experimental.chat.system.transform': async (_hookInput, output) => {
1787
- const publishedSkillsResult = await loadPublishedSkillCatalog({
1801
+ let publishedSkillsResult = await loadPublishedSkillCatalog({
1788
1802
  directory: input.directory,
1789
1803
  useCache: true,
1790
1804
  signal: AbortSignal.timeout(5_000)
1791
1805
  });
1792
1806
  if (!publishedSkillsResult.fetchResult.ok && publishedSkillsResult.fetchResult.status === 'missing_auth') {
1793
- output.system.push('opencode-wizard plugin stored auth is missing, expired, or rejected. Passive startup will not open browser login; use opencode_wizard_published_skills_fetch interactively to authenticate when published skills are needed. No tokens are exposed.');
1794
- return;
1807
+ try {
1808
+ await startLoginCompletion('status').then(async authState => {
1809
+ await schedulePresenceStart(authState);
1810
+ });
1811
+ publishedSkillsResult = await loadPublishedSkillCatalog({
1812
+ directory: input.directory,
1813
+ useCache: false,
1814
+ signal: AbortSignal.timeout(5_000)
1815
+ });
1816
+ } catch {
1817
+ const loginMessage = loginBootstrap.snapshot.message ? ` Last login status: ${loginBootstrap.snapshot.message}` : '';
1818
+ output.system.push(`opencode-wizard plugin stored auth is missing, expired, or rejected. Startup browser login was started but did not complete successfully.${loginMessage} Use opencode_wizard_status or opencode_wizard_published_skills_fetch to retry authentication when published skills are needed. No tokens are exposed.`);
1819
+ return;
1820
+ }
1821
+ if (!publishedSkillsResult.fetchResult.ok) {
1822
+ output.system.push(`opencode-wizard plugin startup login completed, but published skills are still unavailable: ${publishedSkillsResult.fetchResult.message} No tokens are exposed.`);
1823
+ return;
1824
+ }
1795
1825
  }
1796
1826
  const details = await loadSystemNoteDetails({
1797
1827
  publishedSkillsResult,