@almadar/workspace 0.5.0 → 0.7.0

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/types.d.ts CHANGED
@@ -326,6 +326,18 @@ export interface AccountConfig {
326
326
  export interface ProviderCredential {
327
327
  apiKey: string;
328
328
  }
329
+ /**
330
+ * Hosted-builder auth token, persisted to `~/.almadar/auth.json` (chmod 600).
331
+ * The Firebase ID token the local server / sync sends to the hosted builder for
332
+ * the signed-in ("studio") account. Distinct from {@link ProviderCredential}
333
+ * (BYO LLM key) and {@link AccountIdentity} (non-secret uid/email overlay).
334
+ */
335
+ export interface AuthToken {
336
+ token: string;
337
+ refreshToken?: string;
338
+ /** ISO expiry of the ID token (~1h from issue). */
339
+ expiresAt?: string;
340
+ }
329
341
  /** Studio-synced identity overlay, persisted to `~/.almadar/account.json`. Empty until login. */
330
342
  export interface AccountIdentity {
331
343
  uid: string;
@@ -353,15 +365,27 @@ export interface AccountService {
353
365
  getCredential(provider: string): Promise<ProviderCredential | null>;
354
366
  setCredential(provider: string, cred: ProviderCredential): Promise<void>;
355
367
  listCredentialedProviders(): Promise<string[]>;
368
+ /** Remove a stored provider credential. Idempotent (no-op if absent). */
369
+ clearCredential(provider: string): Promise<void>;
356
370
  readAccount(): Promise<AccountIdentity | null>;
357
371
  writeAccount(identity: AccountIdentity): Promise<void>;
372
+ /** Read the stored hosted-builder auth token, or null when signed out. */
373
+ getAuthToken(): Promise<AuthToken | null>;
374
+ /** Persist the hosted-builder auth token (chmod 600). */
375
+ setAuthToken(token: AuthToken): Promise<void>;
376
+ /** Remove the stored auth token (sign out). Idempotent. */
377
+ clearAuthToken(): Promise<void>;
358
378
  /**
359
379
  * Resolve the explicit {@link ProviderConfig} for `provider` (stored apiKey +
360
380
  * config baseUrl/model overrides), ready to pass into `@almadar/llm` / rabit.
361
381
  * Returns null when no credential is stored for `provider`.
362
382
  */
363
383
  resolveProviderConfig(provider: string): Promise<ProviderConfig | null>;
364
- /** True once setup completed AND at least one provider has a stored credential. */
384
+ /**
385
+ * True once setup completed AND the account can actually run AI — either a
386
+ * stored provider credential (BYO-key) or a hosted-builder auth token
387
+ * (signed-in studio account).
388
+ */
365
389
  isConfigured(): Promise<boolean>;
366
390
  dispose(): Promise<void>;
367
391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/workspace",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Storage-agnostic workspace primitives shared by Almadar consumers. One service, six exports, hidden paths, single observer. See docs/Almadar_Workspace.md.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",