opencode-supabase 0.2.1 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-supabase",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Supabase integration with server and TUI components",
6
6
  "license": "Apache-2.0",
@@ -253,7 +253,7 @@ async function openBrowser(url: string, logger: SupabaseLogger) {
253
253
  }
254
254
  }
255
255
 
256
- async function ensureChatSession(api: TuiPluginApi) {
256
+ async function ensureChatSession(api: TuiPluginApi, navigate = true) {
257
257
  const currentRoute = api.route.current;
258
258
  let sessionID =
259
259
  currentRoute.name === "session" ? (currentRoute.params as { sessionID?: string } | undefined)?.sessionID : undefined;
@@ -261,8 +261,9 @@ async function ensureChatSession(api: TuiPluginApi) {
261
261
  if (!sessionID && currentRoute.name === "home") {
262
262
  const response = await api.client.session.create({});
263
263
  sessionID = (response.data as { id?: string } | undefined)?.id;
264
- if (sessionID) {
264
+ if (sessionID && navigate) {
265
265
  api.route.navigate("session", { sessionID });
266
+ await new Promise<void>((resolve) => setTimeout(resolve, 0));
266
267
  }
267
268
  }
268
269
 
@@ -298,7 +299,7 @@ async function injectOnboardingPrompt(
298
299
  onboardedSessionIDs.add(sessionID);
299
300
 
300
301
  try {
301
- await api.client.session.promptAsync({
302
+ await api.client.session.prompt({
302
303
  sessionID,
303
304
  noReply: true,
304
305
  parts: [
@@ -650,10 +651,14 @@ export function SupabaseDialog(props: SupabaseDialogProps) {
650
651
  title: "You're all set",
651
652
  message: "Your Supabase account is connected and ready to go.\n\nClose this dialog to continue, or disconnect to sign out.",
652
653
  onConfirm: async () => {
654
+ const startedFromHome = props.api.route.current.name === "home";
653
655
  if (!lifecycle.chatSessionID) {
654
- lifecycle.chatSessionID = await ensureChatSession(props.api);
656
+ lifecycle.chatSessionID = await ensureChatSession(props.api, false);
655
657
  }
656
658
  await injectOnboardingPrompt(props.api, props.logger, lifecycle);
659
+ if (startedFromHome && lifecycle.chatSessionID) {
660
+ props.api.route.navigate("session", { sessionID: lifecycle.chatSessionID });
661
+ }
657
662
  closeDialog();
658
663
  },
659
664
  onCancel: disconnect,