@pipeline-moe/client-core 0.1.4 → 0.1.5

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/api.d.ts CHANGED
@@ -129,6 +129,10 @@ export declare function createApi(API_BASE: string): {
129
129
  oauthInput: (name: string, value: string) => Promise<{
130
130
  ok: boolean;
131
131
  }>;
132
+ /** Cancel an in-flight OAuth flow (frees pi's localhost callback port). */
133
+ cancelLogin: (name: string) => Promise<{
134
+ ok: boolean;
135
+ }>;
132
136
  personaTemplates: () => Promise<PersonaTemplate[]>;
133
137
  listRooms: () => Promise<RoomSummary[]>;
134
138
  resumableRooms: () => Promise<ResumableRoom[]>;
package/dist/api.js CHANGED
@@ -191,6 +191,8 @@ export function createApi(API_BASE) {
191
191
  headers: { "Content-Type": "application/json" },
192
192
  body: JSON.stringify({ value }),
193
193
  }).then((r) => json(r)),
194
+ /** Cancel an in-flight OAuth flow (frees pi's localhost callback port). */
195
+ cancelLogin: (name) => fetch(`${API_BASE}/api/providers/${name}/login`, { method: "DELETE" }).then((r) => json(r)),
194
196
  // ── Room CRUD (process-global) ──────────────────────────────────────────
195
197
  personaTemplates: () => fetch(`${API_BASE}/api/persona-templates`).then((r) => json(r)),
196
198
  listRooms: () => fetch(`${API_BASE}/api/rooms`).then((r) => json(r)),
package/dist/store.js CHANGED
@@ -296,6 +296,12 @@ export function createRoomStore(opts) {
296
296
  api.oauthInput(provider, value).catch(fail);
297
297
  },
298
298
  dismissOAuth: () => {
299
+ // Cancel any in-flight flow server-side (404 = already finished, fine) —
300
+ // an abandoned flow would otherwise hold pi's callback port forever.
301
+ const provider = state.oauthProgress?.provider;
302
+ const active = state.oauthProgress && state.oauthProgress.status !== "success" && state.oauthProgress.status !== "error";
303
+ if (provider && active)
304
+ api.cancelLogin(provider).catch(() => { });
299
305
  patch({ oauthProgress: null });
300
306
  },
301
307
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipeline-moe/client-core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Framework-agnostic client for a pipeline-moe server: typed REST surface, pure SSE reducer, and an effectful room store. Consumed by the web and terminal clients.",