@pipeline-moe/client-core 0.1.3 → 0.1.4

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
@@ -125,6 +125,10 @@ export declare function createApi(API_BASE: string): {
125
125
  accepted: boolean;
126
126
  provider: string;
127
127
  }>;
128
+ /** Answer an in-flight OAuth flow (pasted redirect URL / authorization code). */
129
+ oauthInput: (name: string, value: string) => Promise<{
130
+ ok: boolean;
131
+ }>;
128
132
  personaTemplates: () => Promise<PersonaTemplate[]>;
129
133
  listRooms: () => Promise<RoomSummary[]>;
130
134
  resumableRooms: () => Promise<ResumableRoom[]>;
package/dist/api.js CHANGED
@@ -185,6 +185,12 @@ export function createApi(API_BASE) {
185
185
  }).then((r) => json(r)),
186
186
  removeProvider: (name) => fetch(`${API_BASE}/api/providers/${name}`, { method: "DELETE" }).then((r) => json(r)),
187
187
  loginProvider: (name) => fetch(`${API_BASE}/api/providers/${name}/login`, { method: "POST" }).then((r) => json(r)),
188
+ /** Answer an in-flight OAuth flow (pasted redirect URL / authorization code). */
189
+ oauthInput: (name, value) => fetch(`${API_BASE}/api/providers/${name}/login/input`, {
190
+ method: "POST",
191
+ headers: { "Content-Type": "application/json" },
192
+ body: JSON.stringify({ value }),
193
+ }).then((r) => json(r)),
188
194
  // ── Room CRUD (process-global) ──────────────────────────────────────────
189
195
  personaTemplates: () => fetch(`${API_BASE}/api/persona-templates`).then((r) => json(r)),
190
196
  listRooms: () => fetch(`${API_BASE}/api/rooms`).then((r) => json(r)),
package/dist/state.js CHANGED
@@ -274,6 +274,9 @@ export function reduce(state, event) {
274
274
  else if (data.type === "auth_url") {
275
275
  effect = { type: "notice", msg: `OAuth for ${data.provider}: ${data.instructions || "visit " + data.url}`, level: "info" };
276
276
  }
277
+ else if (data.type === "prompt") {
278
+ effect = { type: "notice", msg: `OAuth ${data.provider}: ${data.message ?? "input required"}`, level: "info" };
279
+ }
277
280
  else if (data.type === "progress") {
278
281
  effect = { type: "notice", msg: `OAuth ${data.provider}: ${data.message}`, level: "info" };
279
282
  }
@@ -283,14 +286,18 @@ export function reduce(state, event) {
283
286
  else {
284
287
  effect = { type: "notice", msg: data.message ?? "", level: "error" };
285
288
  }
289
+ // Carry link details across steps: a later "prompt"/"progress" event must
290
+ // not wipe the auth URL the user may still need on screen.
291
+ const prev = state.oauthProgress;
286
292
  const oauthProgress = {
287
- provider: data.provider ?? state.oauthProgress?.provider ?? "",
293
+ provider: data.provider ?? prev?.provider ?? "",
288
294
  status: data.type,
289
- verificationUri: data.verificationUri,
290
- userCode: data.userCode,
291
- url: data.url,
292
- instructions: data.instructions,
295
+ verificationUri: data.verificationUri ?? prev?.verificationUri,
296
+ userCode: data.userCode ?? prev?.userCode,
297
+ url: data.url ?? prev?.url,
298
+ instructions: data.instructions ?? prev?.instructions,
293
299
  message: data.message,
300
+ placeholder: data.placeholder ?? prev?.placeholder,
294
301
  };
295
302
  return { state: { ...state, oauthProgress }, effects: [effect] };
296
303
  }
package/dist/store.d.ts CHANGED
@@ -82,6 +82,7 @@ export declare function createRoomStore(opts: RoomStoreOptions): {
82
82
  addProvider: (name: string, key: string) => void;
83
83
  removeProvider: (name: string) => void;
84
84
  loginProvider: (name: string) => void;
85
+ submitOAuthInput: (provider: string, value: string) => void;
85
86
  dismissOAuth: () => void;
86
87
  };
87
88
  pushNotice: (msg: string, level?: "info" | "error") => void;
package/dist/store.js CHANGED
@@ -292,6 +292,9 @@ export function createRoomStore(opts) {
292
292
  pushNotice(`OAuth login started for ${name} — follow the instructions in notifications.`);
293
293
  }).catch(fail);
294
294
  },
295
+ submitOAuthInput: (provider, value) => {
296
+ api.oauthInput(provider, value).catch(fail);
297
+ },
295
298
  dismissOAuth: () => {
296
299
  patch({ oauthProgress: null });
297
300
  },
package/dist/types.d.ts CHANGED
@@ -184,12 +184,14 @@ export interface ResumableRoom {
184
184
  /** Live state of an in-flight OAuth device/auth flow (from oauth_progress SSE). */
185
185
  export interface OAuthProgress {
186
186
  provider: string;
187
- status: "device_code" | "auth_url" | "progress" | "success" | "error";
187
+ status: "device_code" | "auth_url" | "prompt" | "progress" | "success" | "error";
188
188
  verificationUri?: string;
189
189
  userCode?: string;
190
190
  url?: string;
191
191
  instructions?: string;
192
192
  message?: string;
193
+ /** Input hint when the flow asks for a pasted code/redirect URL (status "prompt"). */
194
+ placeholder?: string;
193
195
  }
194
196
  /** A provider listed by GET /api/providers. */
195
197
  export interface ProviderInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipeline-moe/client-core",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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.",