opencode-aicodewith-auth 0.1.7 → 0.1.10

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,11 @@ 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"];
1312
+ var STARTUP_TOAST_DELAY = 6000;
1310
1313
  function createAutoUpdateHook(ctx, options = {}) {
1311
- const { autoUpdate = true } = options;
1314
+ const { autoUpdate = true, showStartupToast = true } = options;
1312
1315
  let hasChecked = false;
1313
1316
  return {
1314
1317
  event: async ({ event }) => {
@@ -1320,17 +1323,47 @@ function createAutoUpdateHook(ctx, options = {}) {
1320
1323
  if (props?.info?.parentID)
1321
1324
  return;
1322
1325
  hasChecked = true;
1326
+ const cachedVersion = getCachedVersion();
1323
1327
  const localDevVersion = getLocalDevVersion(ctx.directory);
1328
+ const displayVersion = localDevVersion ?? cachedVersion ?? "unknown";
1324
1329
  if (localDevVersion) {
1330
+ if (showStartupToast) {
1331
+ setTimeout(() => {
1332
+ showStartupToastWithSpinner(ctx, `${displayVersion} (dev)`, "Local development mode").catch(() => {});
1333
+ }, STARTUP_TOAST_DELAY);
1334
+ }
1325
1335
  log("Local development mode, skipping update check");
1326
1336
  return;
1327
1337
  }
1338
+ if (showStartupToast) {
1339
+ setTimeout(() => {
1340
+ showStartupToastWithSpinner(ctx, displayVersion, "GPT-5.2 \xB7 Claude \xB7 Gemini").catch(() => {});
1341
+ }, STARTUP_TOAST_DELAY);
1342
+ }
1328
1343
  runBackgroundUpdateCheck(ctx, autoUpdate).catch((err) => {
1329
1344
  log("Background update check failed:", err);
1330
1345
  });
1331
1346
  }
1332
1347
  };
1333
1348
  }
1349
+ async function showStartupToastWithSpinner(ctx, version, message) {
1350
+ const totalDuration = 3000;
1351
+ const frameInterval = 100;
1352
+ const totalFrames = Math.floor(totalDuration / frameInterval);
1353
+ for (let i = 0;i < totalFrames; i++) {
1354
+ const spinner = SPINNER_FRAMES[i % SPINNER_FRAMES.length];
1355
+ await ctx.client.tui.showToast({
1356
+ body: {
1357
+ title: `${spinner} ${DISPLAY_NAME} v${version}`,
1358
+ message,
1359
+ variant: "info",
1360
+ duration: frameInterval + 50
1361
+ }
1362
+ }).catch(() => {});
1363
+ await new Promise((resolve) => setTimeout(resolve, frameInterval));
1364
+ }
1365
+ log(`Startup toast shown: v${version}`);
1366
+ }
1334
1367
  async function runBackgroundUpdateCheck(ctx, autoUpdate) {
1335
1368
  const pluginInfo = findPluginEntry(ctx.directory);
1336
1369
  if (!pluginInfo) {
@@ -1402,7 +1435,7 @@ async function runBunInstallSafe() {
1402
1435
  async function showUpdateAvailableToast(ctx, currentVersion, latestVersion) {
1403
1436
  await ctx.client.tui.showToast({
1404
1437
  body: {
1405
- title: `${PACKAGE_NAME} Update Available`,
1438
+ title: `${DISPLAY_NAME} Update Available`,
1406
1439
  message: `v${currentVersion} \u2192 v${latestVersion}
1407
1440
  Restart OpenCode to apply.`,
1408
1441
  variant: "info",
@@ -1414,7 +1447,7 @@ Restart OpenCode to apply.`,
1414
1447
  async function showAutoUpdatedToast(ctx, oldVersion, newVersion) {
1415
1448
  await ctx.client.tui.showToast({
1416
1449
  body: {
1417
- title: `${PACKAGE_NAME} Updated!`,
1450
+ title: `${DISPLAY_NAME} Updated!`,
1418
1451
  message: `v${oldVersion} \u2192 v${newVersion}
1419
1452
  Restart OpenCode to apply.`,
1420
1453
  variant: "success",
@@ -7,4 +7,5 @@ export declare function findPluginEntry(directory: string): PluginEntryInfo | nu
7
7
  export declare function getCachedVersion(): string | null;
8
8
  export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
9
9
  export declare function getLatestVersion(): Promise<string | null>;
10
+ export declare function hasOhMyOpencode(directory: string): boolean;
10
11
  export { log };
@@ -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.10",
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",