opencode-aicodewith-auth 0.1.7 → 0.1.8

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/index.js CHANGED
@@ -1307,8 +1307,10 @@ function invalidatePackage(packageName = PACKAGE_NAME) {
1307
1307
  }
1308
1308
 
1309
1309
  // lib/hooks/auto-update/index.ts
1310
+ var DISPLAY_NAME = "AICodewith";
1311
+ var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1310
1312
  function createAutoUpdateHook(ctx, options = {}) {
1311
- const { autoUpdate = true } = options;
1313
+ const { autoUpdate = true, showStartupToast = true } = options;
1312
1314
  let hasChecked = false;
1313
1315
  return {
1314
1316
  event: async ({ event }) => {
@@ -1320,17 +1322,43 @@ function createAutoUpdateHook(ctx, options = {}) {
1320
1322
  if (props?.info?.parentID)
1321
1323
  return;
1322
1324
  hasChecked = true;
1325
+ const cachedVersion = getCachedVersion();
1323
1326
  const localDevVersion = getLocalDevVersion(ctx.directory);
1327
+ const displayVersion = localDevVersion ?? cachedVersion ?? "unknown";
1324
1328
  if (localDevVersion) {
1329
+ if (showStartupToast) {
1330
+ showStartupToastWithSpinner(ctx, `${displayVersion} (dev)`, "Local development mode").catch(() => {});
1331
+ }
1325
1332
  log("Local development mode, skipping update check");
1326
1333
  return;
1327
1334
  }
1335
+ if (showStartupToast) {
1336
+ showStartupToastWithSpinner(ctx, displayVersion, "GPT-5.2 \xB7 Claude \xB7 Gemini").catch(() => {});
1337
+ }
1328
1338
  runBackgroundUpdateCheck(ctx, autoUpdate).catch((err) => {
1329
1339
  log("Background update check failed:", err);
1330
1340
  });
1331
1341
  }
1332
1342
  };
1333
1343
  }
1344
+ async function showStartupToastWithSpinner(ctx, version, message) {
1345
+ const totalDuration = 3000;
1346
+ const frameInterval = 100;
1347
+ const totalFrames = Math.floor(totalDuration / frameInterval);
1348
+ for (let i = 0;i < totalFrames; i++) {
1349
+ const spinner = SPINNER_FRAMES[i % SPINNER_FRAMES.length];
1350
+ await ctx.client.tui.showToast({
1351
+ body: {
1352
+ title: `${spinner} ${DISPLAY_NAME} v${version}`,
1353
+ message,
1354
+ variant: "info",
1355
+ duration: frameInterval + 50
1356
+ }
1357
+ }).catch(() => {});
1358
+ await new Promise((resolve) => setTimeout(resolve, frameInterval));
1359
+ }
1360
+ log(`Startup toast shown: v${version}`);
1361
+ }
1334
1362
  async function runBackgroundUpdateCheck(ctx, autoUpdate) {
1335
1363
  const pluginInfo = findPluginEntry(ctx.directory);
1336
1364
  if (!pluginInfo) {
@@ -1402,7 +1430,7 @@ async function runBunInstallSafe() {
1402
1430
  async function showUpdateAvailableToast(ctx, currentVersion, latestVersion) {
1403
1431
  await ctx.client.tui.showToast({
1404
1432
  body: {
1405
- title: `${PACKAGE_NAME} Update Available`,
1433
+ title: `${DISPLAY_NAME} Update Available`,
1406
1434
  message: `v${currentVersion} \u2192 v${latestVersion}
1407
1435
  Restart OpenCode to apply.`,
1408
1436
  variant: "info",
@@ -1414,7 +1442,7 @@ Restart OpenCode to apply.`,
1414
1442
  async function showAutoUpdatedToast(ctx, oldVersion, newVersion) {
1415
1443
  await ctx.client.tui.showToast({
1416
1444
  body: {
1417
- title: `${PACKAGE_NAME} Updated!`,
1445
+ title: `${DISPLAY_NAME} Updated!`,
1418
1446
  message: `v${oldVersion} \u2192 v${newVersion}
1419
1447
  Restart OpenCode to apply.`,
1420
1448
  variant: "success",
@@ -20,6 +20,7 @@ export interface UpdateCheckResult {
20
20
  }
21
21
  export interface AutoUpdateOptions {
22
22
  autoUpdate?: boolean;
23
+ showStartupToast?: boolean;
23
24
  }
24
25
  export interface PluginEntryInfo {
25
26
  entry: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-aicodewith-auth",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "OpenCode plugin for AICodewith authentication - Access GPT-5.2, Claude, and Gemini models through AICodewith API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",