@zweer/mage-space-client 1.1.2 → 1.3.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/index.d.cts CHANGED
@@ -1,11 +1,56 @@
1
- //#region lib/types.d.ts
1
+ //#region lib/targets.d.ts
2
+ /**
3
+ * Per-host {@link Target} descriptors.
4
+ *
5
+ * mage.space is migrating from production (`https://www.mage.space`) to a new
6
+ * portal (`https://beta.mage.space`). Rather than hard-coding one base URL and
7
+ * one action-name set, each host is modelled as a `Target` so host differences
8
+ * (renamed actions, poll strategy) live in a single table. The client holds an
9
+ * ordered chain `[production, beta]` and advances to the next target only when
10
+ * the active host can no longer serve a required action.
11
+ */
12
+ /** Hosts the client can talk to. */
13
+ type TargetKey = 'production' | 'beta';
14
+ /** How a single history-status read is performed on a given host. */
15
+ type PollStrategy = 'byId' | 'paginated';
16
+ /**
17
+ * Logical operations the generation/history services invoke, decoupled from the
18
+ * host-specific wire names. `createUserSession` is intentionally NOT a member:
19
+ * it is resolved by its literal name on both hosts (see `lib/auth.ts`).
20
+ */
21
+ type LogicalAction = 'submitGeneration' | 'getHistoryById' | 'cancelJob' | 'listHistory' | 'listCreations';
22
+ /** A single host the client can target. */
23
+ interface Target {
24
+ readonly key: TargetKey;
25
+ readonly baseUrl: string;
26
+ /** logical name → host-specific wire name; unlisted names resolve to themselves. */
27
+ readonly actionNames: Readonly<Partial<Record<LogicalAction, string>>>;
28
+ readonly pollStrategy: PollStrategy;
29
+ }
30
+ /** Resolve a logical action to its host-specific wire name (identity if unlisted). */
31
+ declare function resolveActionName(target: Target, logical: LogicalAction): string;
2
32
  /**
3
- * Shared type definitions for the mage.space client.
33
+ * Production target.
4
34
  *
5
35
  * @remarks
6
- * mage.space is not a REST API: it uses Next.js Server Actions. These types model
7
- * the request/response shapes reverse-engineered in `docs/api/*.md`.
36
+ * Maps each logical action to the wire name the current production deploy
37
+ * actually serves (all VERIFIED against `lib/seed.ts` / the existing MSW tests):
38
+ * `submitGeneration → runArchitecture`, `cancelJob → cancelArchitectureJob`,
39
+ * `listHistory → getHistoryPaginated`, `listCreations → getCreationsPaginatedParallel`,
40
+ * and `getHistoryById → getHistoryById` (identity). The table is explicit rather
41
+ * than empty so production behaviour is reproduced exactly regardless of the
42
+ * logical-name vocabulary.
8
43
  */
44
+ declare const PRODUCTION_TARGET: Target;
45
+ /**
46
+ * Beta target. Beta facts are assumptions pending a reverse-engineering capture
47
+ * under `docs/api/beta` — treat them as unverified until that doc lands.
48
+ */
49
+ declare const BETA_TARGET: Target;
50
+ /** Default ordered fallback chain: production first, then beta. */
51
+ declare const DEFAULT_TARGET_CHAIN: readonly Target[];
52
+ //#endregion
53
+ //#region lib/types.d.ts
9
54
  /** Minimal `fetch` signature the client depends on (injectable for tests). */
10
55
  type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
11
56
  /** In-memory representation of the Firebase token chain. */
@@ -27,7 +72,7 @@ interface SessionState {
27
72
  expiresAt: number;
28
73
  }
29
74
  /** Server Action function names the client relies on for the MVP surface. */
30
- type ActionName = 'createUserSession' | 'deleteUserSession' | 'getUserHydrationData' | 'runArchitecture' | 'getHistoryById' | 'cancelArchitectureJob' | 'getHistoryPaginated' | 'getMentionSuggestionsParallel' | 'createCharacter' | 'updateCharacter' | 'deleteCharacter' | 'getCharacter' | 'getCharacters' | 'publishCharacter' | 'unpublishCharacter' | 'uploadCharacterImage' | 'uploadReferenceImage' | 'createReference' | 'updateReference' | 'deleteReference' | 'getReferences' | 'getReferencesPaginated' | 'getCharactersPaginated' | 'getCreationsPaginatedParallel' | 'deleteHistory' | 'deleteManyHistories' | 'deleteCreation' | 'deleteManyCreations' | 'saveCreation' | 'generateCharacterVoice' | 'followCharacter' | 'unfollowCharacter';
75
+ type ActionName = 'createUserSession' | 'deleteUserSession' | 'getUserHydrationData' | 'runArchitecture' | 'getHistoryById' | 'cancelArchitectureJob' | 'getHistoryPaginated' | 'getMentionSuggestionsParallel' | 'createCharacter' | 'updateCharacter' | 'deleteCharacter' | 'getCharacter' | 'getCharacters' | 'publishCharacter' | 'unpublishCharacter' | 'uploadCharacterImage' | 'uploadReferenceImage' | 'createReference' | 'updateReference' | 'deleteReference' | 'getReferences' | 'getReferencesPaginated' | 'getCharactersPaginated' | 'getCreationsPaginatedParallel' | 'getCreationsPaginated' | 'deleteHistory' | 'deleteManyHistories' | 'deleteCreation' | 'deleteManyCreations' | 'saveCreation' | 'generateCharacterVoice' | 'followCharacter' | 'unfollowCharacter';
31
76
  /** Map of Server Action function name → hex action hash. */
32
77
  type ActionHashes = Record<string, string>;
33
78
  /** A discovered (or seeded) set of action hashes for a single Vercel deploy. */
@@ -136,6 +181,21 @@ interface MageSpaceClientOptions {
136
181
  baseUrl?: string;
137
182
  /** Override the Firebase Web API key. */
138
183
  firebaseApiKey?: string;
184
+ /**
185
+ * Host-fallback behaviour. Default: production first, with an automatic,
186
+ * sticky fallback to beta when production can no longer serve a required
187
+ * action. Cannot be combined with `baseUrl` (which pins a single host).
188
+ */
189
+ fallback?: FallbackOptions;
190
+ }
191
+ /** Configuration for the automatic beta-portal fallback. */
192
+ interface FallbackOptions {
193
+ /** Host to start on. Default `'production'`. `'beta'` forces beta from the first call. */
194
+ start?: TargetKey;
195
+ /** Auto-advance to the next target on a definitive action-unavailable signal. Default `true`. */
196
+ auto?: boolean;
197
+ /** Override the ordered target chain. Advanced/testing. Default `DEFAULT_TARGET_CHAIN`. */
198
+ chain?: readonly Target[];
139
199
  }
140
200
  interface GenerateOptions {
141
201
  /** Prompt text; supports `@character-username` mentions. */
@@ -305,8 +365,15 @@ interface SearchCharactersOptions {
305
365
  interface CreateCharacterInput {
306
366
  /** Display name. */
307
367
  name: string;
308
- /** Unique @-mention handle (name + short suffix). */
309
- username: string;
368
+ /**
369
+ * Unique @-mention handle. Max 15 chars, lowercase `a-z`, `0-9`, `_`, `-`,
370
+ * must start with a letter.
371
+ *
372
+ * @remarks
373
+ * When omitted, one is auto-generated from `name` with a 4-char random suffix
374
+ * (matching the web UI behavior), truncated to 15 chars.
375
+ */
376
+ username?: string;
310
377
  /** CDN URL from {@link uploadCharacterImage} or an existing character. */
311
378
  image_url: string;
312
379
  /** Voice audio URL (default null). */
@@ -330,8 +397,11 @@ interface UpdateCharacterInput {
330
397
  interface CreateReferenceInput {
331
398
  /** Display name. */
332
399
  name: string;
333
- /** Unique handle (name + short suffix). */
334
- username: string;
400
+ /**
401
+ * Unique handle. Max 15 chars, lowercase `a-z`, `0-9`, `_`, `-`, starts with a letter.
402
+ * When omitted, auto-generated from `name` with a 4-char random suffix.
403
+ */
404
+ username?: string;
335
405
  /** CDN URL from {@link uploadReferenceImage} (required for image refs). */
336
406
  image_url?: string;
337
407
  /** Audio URL (required for audio refs). */
@@ -535,15 +605,23 @@ declare class HttpClient {
535
605
  private readonly registry;
536
606
  private readonly fetchImpl;
537
607
  private readonly baseUrl;
608
+ private readonly targetKey;
538
609
  private readonly userAgent;
539
- constructor(registry: ActionRegistry, fetchImpl: FetchLike, baseUrl: string, userAgent?: string);
610
+ constructor(registry: ActionRegistry, fetchImpl: FetchLike, baseUrl: string, targetKey: string, userAgent?: string);
611
+ /** A response that means the action is unavailable (stale hash or gone). */
612
+ private isUnavailable;
540
613
  callAction<T = unknown>(params: CallActionParams, retried?: boolean): Promise<CallActionResult<T>>;
541
614
  }
542
615
  //#endregion
543
616
  //#region lib/auth.d.ts
544
617
  interface AuthManagerOptions {
545
618
  refreshToken: string;
546
- http: HttpClient;
619
+ /**
620
+ * Accessor for the active host's {@link HttpClient}. A closure (not the client
621
+ * itself) so `createUserSession` always hits whichever host is currently
622
+ * active after an automatic fallback.
623
+ */
624
+ getHttp: () => HttpClient;
547
625
  fetch: FetchLike;
548
626
  firebaseApiKey?: string;
549
627
  /** Page path for the `createUserSession` action (default `/creations`). */
@@ -551,13 +629,19 @@ interface AuthManagerOptions {
551
629
  }
552
630
  declare class AuthManager {
553
631
  private refreshToken;
554
- private readonly http;
632
+ private readonly getHttp;
555
633
  private readonly fetchImpl;
556
634
  private readonly apiKey;
557
635
  private readonly sessionPath;
558
636
  private tokens;
559
637
  private session;
560
638
  constructor(opts: AuthManagerOptions);
639
+ /**
640
+ * Drop the cached `__session` cookie so the next {@link getSession} mints a
641
+ * fresh one against the (newly) active host. The Firebase token chain is kept
642
+ * because it is host-independent.
643
+ */
644
+ resetSession(): void;
561
645
  /** Return a valid Firebase ID token, refreshing via the refresh token if needed. */
562
646
  getIdToken(): Promise<string>;
563
647
  /** Return the Firebase uid (fetching an ID token first if necessary). */
@@ -657,15 +741,43 @@ declare class ReferencesService {
657
741
  //#endregion
658
742
  //#region lib/client.d.ts
659
743
  declare class MageSpaceClient {
660
- private readonly registry;
661
744
  private readonly auth;
662
- private readonly generationService;
663
- private readonly historyService;
664
- /** Character management (search, CRUD, pagination, uploads). */
745
+ private readonly chain;
746
+ private readonly auto;
747
+ private readonly contextDeps;
748
+ private readonly contexts;
749
+ private activeIndex;
750
+ private activeContext;
751
+ private activeBundle;
752
+ /**
753
+ * Character management (search, CRUD, pagination, uploads).
754
+ *
755
+ * @remarks
756
+ * Bound to the initial host (production by default) and does not follow an
757
+ * automatic beta fallback. Construct a client with `fallback: { start: 'beta' }`
758
+ * to use these against beta.
759
+ */
665
760
  readonly characters: CharactersService;
666
- /** Reference asset management (upload, create, update, list, feed). */
761
+ /**
762
+ * Reference asset management (upload, create, update, list, feed).
763
+ *
764
+ * @remarks
765
+ * Bound to the initial host (production by default) and does not follow an
766
+ * automatic beta fallback. Construct a client with `fallback: { start: 'beta' }`
767
+ * to use these against beta.
768
+ */
667
769
  readonly references: ReferencesService;
668
770
  constructor(options: MageSpaceClientOptions);
771
+ /** Lazily build (and memoise) the {@link TargetContext} for a chain index. */
772
+ private getContext;
773
+ /** Build the generation/history service bundle for a context. */
774
+ private buildBundle;
775
+ /** Advance to the next target (sticky). Returns `null` if none or `auto` is off. */
776
+ private advanceTarget;
777
+ /** Whether an error is a definitive action-unavailable signal (a fallback trigger). */
778
+ private shouldFallback;
779
+ /** Run `op` against the active bundle, switching to the next target once on a trigger. */
780
+ private withFallback;
669
781
  /** Submit a generation job; returns its `historyId`. */
670
782
  generate(options: GenerateOptions): Promise<{
671
783
  historyId: string;
@@ -694,10 +806,12 @@ declare class MageSpaceClient {
694
806
  deleteCreation(creationId: string, options?: ConfirmOptions): Promise<void>;
695
807
  /** Permanently delete many creations. Irreversible — requires `{ confirm: true }`. */
696
808
  deleteManyCreations(creationIds: string[], options?: ConfirmOptions): Promise<void>;
697
- /** Force re-discovery of the Server Action hashes. */
809
+ /** Force re-discovery of the Server Action hashes on the active host. */
698
810
  refreshActions(): Promise<ActionSnapshot>;
699
811
  /** Return the authenticated user's Firebase uid. */
700
812
  getUid(): Promise<string>;
813
+ /** Return the key of the currently active target (`'production'` or `'beta'`). */
814
+ getActiveTarget(): TargetKey;
701
815
  }
702
816
  //#endregion
703
817
  //#region lib/errors.d.ts
@@ -716,11 +830,34 @@ declare class AuthError extends MageSpaceError {
716
830
  }
717
831
  /** Action-hash discovery failures (page/chunk fetch, empty registry). */
718
832
  declare class DiscoveryError extends MageSpaceError {
833
+ /**
834
+ * `true` when the action name was absent even after a forced re-discovery
835
+ * (a fallback trigger); `false` for scrape failures (no chunks/no hashes).
836
+ */
837
+ readonly notFound: boolean;
719
838
  constructor(message: string, options?: {
720
839
  cause?: unknown;
840
+ notFound?: boolean;
721
841
  });
722
842
  }
723
- /** A Server Action returned 404, indicating a stale (post-deploy) hash. */
843
+ /**
844
+ * A required action is unavailable on the active host (a persistent 404 / HTML
845
+ * fallback that survived one in-place re-discovery). A fallback trigger.
846
+ */
847
+ declare class ActionUnavailableError extends MageSpaceError {
848
+ readonly action: string;
849
+ readonly targetKey: string;
850
+ constructor(action: string, targetKey: string, options?: {
851
+ cause?: unknown;
852
+ });
853
+ }
854
+ /**
855
+ * A Server Action returned 404, indicating a stale (post-deploy) hash.
856
+ *
857
+ * @deprecated Legacy export kept for backward compatibility; no longer thrown.
858
+ * The current signal for a definitively unavailable action is
859
+ * {@link ActionUnavailableError}.
860
+ */
724
861
  declare class StaleActionError extends MageSpaceError {
725
862
  readonly action: string;
726
863
  constructor(action: string, options?: {
@@ -798,5 +935,5 @@ declare const SEED_SNAPSHOT: ActionSnapshot;
798
935
  /** Public entry point for `@zweer/mage-space-client`. */
799
936
  declare const VERSION = "0.0.0";
800
937
  //#endregion
801
- export { type ActionCache, type ActionHashes, type ActionName, ActionRegistry, type ActionSnapshot, type ArchitectureConfig, type AspectRatio, AuthError, type AuthTokens, type Character, type CharacterPage, type CharacterRef, type CharacterSearchResult, CharactersService, type ConfirmOptions, type CreateCharacterInput, type CreateReferenceInput, type Creation, type CreationPage, DiscoveryError, type FetchLike, type GenerateOptions, type GenerateVideoOptions, type GenerateVoiceOptions, GenerationError, type GenerationMode, type GenerationResult, type HistoryItem, type HistoryPage, InMemoryActionCache, type JobStatus, type ListCharactersOptions, type ListCreationsOptions, type ListHistoryOptions, type ListReferencesOptions, MageSpaceClient, type MageSpaceClientOptions, MageSpaceError, type Modality, type Reference, type ReferenceOrder, type ReferencePage, type ReferenceVariant, ReferencesService, type Resolution, RscParseError, SEED_SNAPSHOT, type SearchCharactersOptions, type SessionState, StaleActionError, TimeoutError, type UpdateCharacterInput, type UpdateReferenceInput, VERSION, type VideoArchitectureConfig, type VideoAspectRatio, type VideoResolution, type Visibility, type VoiceResult, type WaitOptions, discoverActions, parseFlightRows, parseServerActionResponse, resolveFlightValue, unwrapResult };
938
+ export { type ActionCache, type ActionHashes, type ActionName, ActionRegistry, type ActionSnapshot, ActionUnavailableError, type ArchitectureConfig, type AspectRatio, AuthError, type AuthTokens, BETA_TARGET, type Character, type CharacterPage, type CharacterRef, type CharacterSearchResult, CharactersService, type ConfirmOptions, type CreateCharacterInput, type CreateReferenceInput, type Creation, type CreationPage, DEFAULT_TARGET_CHAIN, DiscoveryError, type FallbackOptions, type FetchLike, type GenerateOptions, type GenerateVideoOptions, type GenerateVoiceOptions, GenerationError, type GenerationMode, type GenerationResult, type HistoryItem, type HistoryPage, InMemoryActionCache, type JobStatus, type ListCharactersOptions, type ListCreationsOptions, type ListHistoryOptions, type ListReferencesOptions, type LogicalAction, MageSpaceClient, type MageSpaceClientOptions, MageSpaceError, type Modality, PRODUCTION_TARGET, type PollStrategy, type Reference, type ReferenceOrder, type ReferencePage, type ReferenceVariant, ReferencesService, type Resolution, RscParseError, SEED_SNAPSHOT, type SearchCharactersOptions, type SessionState, StaleActionError, type Target, type TargetKey, TimeoutError, type UpdateCharacterInput, type UpdateReferenceInput, VERSION, type VideoArchitectureConfig, type VideoAspectRatio, type VideoResolution, type Visibility, type VoiceResult, type WaitOptions, discoverActions, parseFlightRows, parseServerActionResponse, resolveActionName, resolveFlightValue, unwrapResult };
802
939
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/rsc.ts","../lib/seed.ts","../lib/index.ts"],"mappings":";;;;;;;;;KASY,aAAa,eAAe,OAAO,gBAAgB,QAAQ;;UAOtD;;EAEf;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;;KAQU;;KAmCA,eAAe;;UAGV;;EAEf;;EAEA,QAAQ;;EAER;;;;;;;;;;UAWe;EACf,QAAQ,QAAQ;EAChB,KAAK,UAAU,iBAAiB;;KAOtB;KACA;;KAEA;;KAEA;;UAGK;EACf;EACA;EACA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAEf;EACA;EACA,YAAY;EACZ;EACA;;EAEA;;;UAIe;EACf;IACE;IACA;IACA;IACA;IACA;IACA;MAAe;MAAkB;;;EAEnC;EACA;;;UAIe;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA,QAAQ;EACR;EACA,sBAAsB;EACtB;EACA;EACA;GACC;;;UAI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;;cAO9B,yBAAyB;WAElB;EADlB,YACkB,gBAChB;IAAY;;;;cAQH,wBAAwB;WAGjB;EAFlB,YACE,iBACgB,2BAChB;IAAY;;;;cAQH,sBAAsB;EACjC,YAAY,iBAAiB;IAAY;;;;cAO9B,qBAAqB;EAChC,YAAY,iBAAiB;IAAY;;;;;;;;;;;;;;;;;iBCL3B,gBAAgB,eAAe;;iBAmE/B,mBACd,gBACA,MAAM,sBACN,OAAM;;;;;;iBA4CQ,0BAA0B,aAAa,eAAe;;;;;;;;;;;;iBA8BtD,aAAa,GAAG,iBAAiB;;;;;;;;;;;;cC3LpC,eAAe;;;;cCVf"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../lib/targets.ts","../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/rsc.ts","../lib/seed.ts","../lib/index.ts"],"mappings":";;;;;;;;;;;;KAYY;;KAGA;;;;;;KAOA;;UAQK;WACN,KAAK;WACL;;WAEA,aAAa,SAAS,QAAQ,OAAO;WACrC,cAAc;;;iBAIT,kBAAkB,QAAQ,QAAQ,SAAS;;;;;;;;;;;;;cAgB9C,mBAAmB;;;;;cAiBnB,aAAa;;cAkBb,+BAA+B;;;;KC/EhC,aAAa,eAAe,OAAO,gBAAgB,QAAQ;;UAOtD;;EAEf;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;;KAQU;;KAoCA,eAAe;;UAGV;;EAEf;;EAEA,QAAQ;;EAER;;;;;;;;;;UAWe;EACf,QAAQ,QAAQ;EAChB,KAAK,UAAU,iBAAiB;;KAOtB;KACA;;KAEA;;KAEA;;UAGK;EACf;EACA;EACA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAEf;EACA;EACA,YAAY;EACZ;EACA;;EAEA;;;UAIe;EACf;IACE;IACA;IACA;IACA;IACA;IACA;MAAe;MAAkB;;;EA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K5D,oBAAoB,sBAAsB,UAAU,iBAAiB;;EAKrE,eAAe,oBAAoB,UAAU,iBAAiB;;EAK9D,oBAAoB,uBAAuB,UAAU,iBAAiB;;EAKtE,kBAAkB,QAAQ;;EAK1B,UAAU;;EAKV,mBAAmB;;;;;;cC/QR,uBAAuB;EAClC,YAAY,iBAAiB;IAAY;;;;cAO9B,kBAAkB;EAC7B,YAAY,iBAAiB;IAAY;;;;cAO9B,uBAAuB;;;;;WAKlB;EAEhB,YAAY,iBAAiB;IAAY;IAAiB;;;;;;;cAW/C,+BAA+B;WAExB;WACA;EAFlB,YACkB,gBACA,mBAChB;IAAY;;;;;;;;;;cAcH,yBAAyB;WAElB;EADlB,YACkB,gBAChB;IAAY;;;;cAQH,wBAAwB;WAGjB;EAFlB,YACE,iBACgB,2BAChB;IAAY;;;;cAQH,sBAAsB;EACjC,YAAY,iBAAiB;IAAY;;;;cAO9B,qBAAqB;EAChC,YAAY,iBAAiB;IAAY;;;;;;;;;;;;;;;;;iBCjC3B,gBAAgB,eAAe;;iBAmE/B,mBACd,gBACA,MAAM,sBACN,OAAM;;;;;;iBAqDQ,0BAA0B,aAAa,eAAe;;;;;;;;;;;;iBA8BtD,aAAa,GAAG,iBAAiB;;;;;;;;;;;;cCpMpC,eAAe;;;;cCVf"}
package/dist/index.d.mts CHANGED
@@ -1,11 +1,56 @@
1
- //#region lib/types.d.ts
1
+ //#region lib/targets.d.ts
2
+ /**
3
+ * Per-host {@link Target} descriptors.
4
+ *
5
+ * mage.space is migrating from production (`https://www.mage.space`) to a new
6
+ * portal (`https://beta.mage.space`). Rather than hard-coding one base URL and
7
+ * one action-name set, each host is modelled as a `Target` so host differences
8
+ * (renamed actions, poll strategy) live in a single table. The client holds an
9
+ * ordered chain `[production, beta]` and advances to the next target only when
10
+ * the active host can no longer serve a required action.
11
+ */
12
+ /** Hosts the client can talk to. */
13
+ type TargetKey = 'production' | 'beta';
14
+ /** How a single history-status read is performed on a given host. */
15
+ type PollStrategy = 'byId' | 'paginated';
16
+ /**
17
+ * Logical operations the generation/history services invoke, decoupled from the
18
+ * host-specific wire names. `createUserSession` is intentionally NOT a member:
19
+ * it is resolved by its literal name on both hosts (see `lib/auth.ts`).
20
+ */
21
+ type LogicalAction = 'submitGeneration' | 'getHistoryById' | 'cancelJob' | 'listHistory' | 'listCreations';
22
+ /** A single host the client can target. */
23
+ interface Target {
24
+ readonly key: TargetKey;
25
+ readonly baseUrl: string;
26
+ /** logical name → host-specific wire name; unlisted names resolve to themselves. */
27
+ readonly actionNames: Readonly<Partial<Record<LogicalAction, string>>>;
28
+ readonly pollStrategy: PollStrategy;
29
+ }
30
+ /** Resolve a logical action to its host-specific wire name (identity if unlisted). */
31
+ declare function resolveActionName(target: Target, logical: LogicalAction): string;
2
32
  /**
3
- * Shared type definitions for the mage.space client.
33
+ * Production target.
4
34
  *
5
35
  * @remarks
6
- * mage.space is not a REST API: it uses Next.js Server Actions. These types model
7
- * the request/response shapes reverse-engineered in `docs/api/*.md`.
36
+ * Maps each logical action to the wire name the current production deploy
37
+ * actually serves (all VERIFIED against `lib/seed.ts` / the existing MSW tests):
38
+ * `submitGeneration → runArchitecture`, `cancelJob → cancelArchitectureJob`,
39
+ * `listHistory → getHistoryPaginated`, `listCreations → getCreationsPaginatedParallel`,
40
+ * and `getHistoryById → getHistoryById` (identity). The table is explicit rather
41
+ * than empty so production behaviour is reproduced exactly regardless of the
42
+ * logical-name vocabulary.
8
43
  */
44
+ declare const PRODUCTION_TARGET: Target;
45
+ /**
46
+ * Beta target. Beta facts are assumptions pending a reverse-engineering capture
47
+ * under `docs/api/beta` — treat them as unverified until that doc lands.
48
+ */
49
+ declare const BETA_TARGET: Target;
50
+ /** Default ordered fallback chain: production first, then beta. */
51
+ declare const DEFAULT_TARGET_CHAIN: readonly Target[];
52
+ //#endregion
53
+ //#region lib/types.d.ts
9
54
  /** Minimal `fetch` signature the client depends on (injectable for tests). */
10
55
  type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
11
56
  /** In-memory representation of the Firebase token chain. */
@@ -27,7 +72,7 @@ interface SessionState {
27
72
  expiresAt: number;
28
73
  }
29
74
  /** Server Action function names the client relies on for the MVP surface. */
30
- type ActionName = 'createUserSession' | 'deleteUserSession' | 'getUserHydrationData' | 'runArchitecture' | 'getHistoryById' | 'cancelArchitectureJob' | 'getHistoryPaginated' | 'getMentionSuggestionsParallel' | 'createCharacter' | 'updateCharacter' | 'deleteCharacter' | 'getCharacter' | 'getCharacters' | 'publishCharacter' | 'unpublishCharacter' | 'uploadCharacterImage' | 'uploadReferenceImage' | 'createReference' | 'updateReference' | 'deleteReference' | 'getReferences' | 'getReferencesPaginated' | 'getCharactersPaginated' | 'getCreationsPaginatedParallel' | 'deleteHistory' | 'deleteManyHistories' | 'deleteCreation' | 'deleteManyCreations' | 'saveCreation' | 'generateCharacterVoice' | 'followCharacter' | 'unfollowCharacter';
75
+ type ActionName = 'createUserSession' | 'deleteUserSession' | 'getUserHydrationData' | 'runArchitecture' | 'getHistoryById' | 'cancelArchitectureJob' | 'getHistoryPaginated' | 'getMentionSuggestionsParallel' | 'createCharacter' | 'updateCharacter' | 'deleteCharacter' | 'getCharacter' | 'getCharacters' | 'publishCharacter' | 'unpublishCharacter' | 'uploadCharacterImage' | 'uploadReferenceImage' | 'createReference' | 'updateReference' | 'deleteReference' | 'getReferences' | 'getReferencesPaginated' | 'getCharactersPaginated' | 'getCreationsPaginatedParallel' | 'getCreationsPaginated' | 'deleteHistory' | 'deleteManyHistories' | 'deleteCreation' | 'deleteManyCreations' | 'saveCreation' | 'generateCharacterVoice' | 'followCharacter' | 'unfollowCharacter';
31
76
  /** Map of Server Action function name → hex action hash. */
32
77
  type ActionHashes = Record<string, string>;
33
78
  /** A discovered (or seeded) set of action hashes for a single Vercel deploy. */
@@ -136,6 +181,21 @@ interface MageSpaceClientOptions {
136
181
  baseUrl?: string;
137
182
  /** Override the Firebase Web API key. */
138
183
  firebaseApiKey?: string;
184
+ /**
185
+ * Host-fallback behaviour. Default: production first, with an automatic,
186
+ * sticky fallback to beta when production can no longer serve a required
187
+ * action. Cannot be combined with `baseUrl` (which pins a single host).
188
+ */
189
+ fallback?: FallbackOptions;
190
+ }
191
+ /** Configuration for the automatic beta-portal fallback. */
192
+ interface FallbackOptions {
193
+ /** Host to start on. Default `'production'`. `'beta'` forces beta from the first call. */
194
+ start?: TargetKey;
195
+ /** Auto-advance to the next target on a definitive action-unavailable signal. Default `true`. */
196
+ auto?: boolean;
197
+ /** Override the ordered target chain. Advanced/testing. Default `DEFAULT_TARGET_CHAIN`. */
198
+ chain?: readonly Target[];
139
199
  }
140
200
  interface GenerateOptions {
141
201
  /** Prompt text; supports `@character-username` mentions. */
@@ -305,8 +365,15 @@ interface SearchCharactersOptions {
305
365
  interface CreateCharacterInput {
306
366
  /** Display name. */
307
367
  name: string;
308
- /** Unique @-mention handle (name + short suffix). */
309
- username: string;
368
+ /**
369
+ * Unique @-mention handle. Max 15 chars, lowercase `a-z`, `0-9`, `_`, `-`,
370
+ * must start with a letter.
371
+ *
372
+ * @remarks
373
+ * When omitted, one is auto-generated from `name` with a 4-char random suffix
374
+ * (matching the web UI behavior), truncated to 15 chars.
375
+ */
376
+ username?: string;
310
377
  /** CDN URL from {@link uploadCharacterImage} or an existing character. */
311
378
  image_url: string;
312
379
  /** Voice audio URL (default null). */
@@ -330,8 +397,11 @@ interface UpdateCharacterInput {
330
397
  interface CreateReferenceInput {
331
398
  /** Display name. */
332
399
  name: string;
333
- /** Unique handle (name + short suffix). */
334
- username: string;
400
+ /**
401
+ * Unique handle. Max 15 chars, lowercase `a-z`, `0-9`, `_`, `-`, starts with a letter.
402
+ * When omitted, auto-generated from `name` with a 4-char random suffix.
403
+ */
404
+ username?: string;
335
405
  /** CDN URL from {@link uploadReferenceImage} (required for image refs). */
336
406
  image_url?: string;
337
407
  /** Audio URL (required for audio refs). */
@@ -535,15 +605,23 @@ declare class HttpClient {
535
605
  private readonly registry;
536
606
  private readonly fetchImpl;
537
607
  private readonly baseUrl;
608
+ private readonly targetKey;
538
609
  private readonly userAgent;
539
- constructor(registry: ActionRegistry, fetchImpl: FetchLike, baseUrl: string, userAgent?: string);
610
+ constructor(registry: ActionRegistry, fetchImpl: FetchLike, baseUrl: string, targetKey: string, userAgent?: string);
611
+ /** A response that means the action is unavailable (stale hash or gone). */
612
+ private isUnavailable;
540
613
  callAction<T = unknown>(params: CallActionParams, retried?: boolean): Promise<CallActionResult<T>>;
541
614
  }
542
615
  //#endregion
543
616
  //#region lib/auth.d.ts
544
617
  interface AuthManagerOptions {
545
618
  refreshToken: string;
546
- http: HttpClient;
619
+ /**
620
+ * Accessor for the active host's {@link HttpClient}. A closure (not the client
621
+ * itself) so `createUserSession` always hits whichever host is currently
622
+ * active after an automatic fallback.
623
+ */
624
+ getHttp: () => HttpClient;
547
625
  fetch: FetchLike;
548
626
  firebaseApiKey?: string;
549
627
  /** Page path for the `createUserSession` action (default `/creations`). */
@@ -551,13 +629,19 @@ interface AuthManagerOptions {
551
629
  }
552
630
  declare class AuthManager {
553
631
  private refreshToken;
554
- private readonly http;
632
+ private readonly getHttp;
555
633
  private readonly fetchImpl;
556
634
  private readonly apiKey;
557
635
  private readonly sessionPath;
558
636
  private tokens;
559
637
  private session;
560
638
  constructor(opts: AuthManagerOptions);
639
+ /**
640
+ * Drop the cached `__session` cookie so the next {@link getSession} mints a
641
+ * fresh one against the (newly) active host. The Firebase token chain is kept
642
+ * because it is host-independent.
643
+ */
644
+ resetSession(): void;
561
645
  /** Return a valid Firebase ID token, refreshing via the refresh token if needed. */
562
646
  getIdToken(): Promise<string>;
563
647
  /** Return the Firebase uid (fetching an ID token first if necessary). */
@@ -657,15 +741,43 @@ declare class ReferencesService {
657
741
  //#endregion
658
742
  //#region lib/client.d.ts
659
743
  declare class MageSpaceClient {
660
- private readonly registry;
661
744
  private readonly auth;
662
- private readonly generationService;
663
- private readonly historyService;
664
- /** Character management (search, CRUD, pagination, uploads). */
745
+ private readonly chain;
746
+ private readonly auto;
747
+ private readonly contextDeps;
748
+ private readonly contexts;
749
+ private activeIndex;
750
+ private activeContext;
751
+ private activeBundle;
752
+ /**
753
+ * Character management (search, CRUD, pagination, uploads).
754
+ *
755
+ * @remarks
756
+ * Bound to the initial host (production by default) and does not follow an
757
+ * automatic beta fallback. Construct a client with `fallback: { start: 'beta' }`
758
+ * to use these against beta.
759
+ */
665
760
  readonly characters: CharactersService;
666
- /** Reference asset management (upload, create, update, list, feed). */
761
+ /**
762
+ * Reference asset management (upload, create, update, list, feed).
763
+ *
764
+ * @remarks
765
+ * Bound to the initial host (production by default) and does not follow an
766
+ * automatic beta fallback. Construct a client with `fallback: { start: 'beta' }`
767
+ * to use these against beta.
768
+ */
667
769
  readonly references: ReferencesService;
668
770
  constructor(options: MageSpaceClientOptions);
771
+ /** Lazily build (and memoise) the {@link TargetContext} for a chain index. */
772
+ private getContext;
773
+ /** Build the generation/history service bundle for a context. */
774
+ private buildBundle;
775
+ /** Advance to the next target (sticky). Returns `null` if none or `auto` is off. */
776
+ private advanceTarget;
777
+ /** Whether an error is a definitive action-unavailable signal (a fallback trigger). */
778
+ private shouldFallback;
779
+ /** Run `op` against the active bundle, switching to the next target once on a trigger. */
780
+ private withFallback;
669
781
  /** Submit a generation job; returns its `historyId`. */
670
782
  generate(options: GenerateOptions): Promise<{
671
783
  historyId: string;
@@ -694,10 +806,12 @@ declare class MageSpaceClient {
694
806
  deleteCreation(creationId: string, options?: ConfirmOptions): Promise<void>;
695
807
  /** Permanently delete many creations. Irreversible — requires `{ confirm: true }`. */
696
808
  deleteManyCreations(creationIds: string[], options?: ConfirmOptions): Promise<void>;
697
- /** Force re-discovery of the Server Action hashes. */
809
+ /** Force re-discovery of the Server Action hashes on the active host. */
698
810
  refreshActions(): Promise<ActionSnapshot>;
699
811
  /** Return the authenticated user's Firebase uid. */
700
812
  getUid(): Promise<string>;
813
+ /** Return the key of the currently active target (`'production'` or `'beta'`). */
814
+ getActiveTarget(): TargetKey;
701
815
  }
702
816
  //#endregion
703
817
  //#region lib/errors.d.ts
@@ -716,11 +830,34 @@ declare class AuthError extends MageSpaceError {
716
830
  }
717
831
  /** Action-hash discovery failures (page/chunk fetch, empty registry). */
718
832
  declare class DiscoveryError extends MageSpaceError {
833
+ /**
834
+ * `true` when the action name was absent even after a forced re-discovery
835
+ * (a fallback trigger); `false` for scrape failures (no chunks/no hashes).
836
+ */
837
+ readonly notFound: boolean;
719
838
  constructor(message: string, options?: {
720
839
  cause?: unknown;
840
+ notFound?: boolean;
721
841
  });
722
842
  }
723
- /** A Server Action returned 404, indicating a stale (post-deploy) hash. */
843
+ /**
844
+ * A required action is unavailable on the active host (a persistent 404 / HTML
845
+ * fallback that survived one in-place re-discovery). A fallback trigger.
846
+ */
847
+ declare class ActionUnavailableError extends MageSpaceError {
848
+ readonly action: string;
849
+ readonly targetKey: string;
850
+ constructor(action: string, targetKey: string, options?: {
851
+ cause?: unknown;
852
+ });
853
+ }
854
+ /**
855
+ * A Server Action returned 404, indicating a stale (post-deploy) hash.
856
+ *
857
+ * @deprecated Legacy export kept for backward compatibility; no longer thrown.
858
+ * The current signal for a definitively unavailable action is
859
+ * {@link ActionUnavailableError}.
860
+ */
724
861
  declare class StaleActionError extends MageSpaceError {
725
862
  readonly action: string;
726
863
  constructor(action: string, options?: {
@@ -798,5 +935,5 @@ declare const SEED_SNAPSHOT: ActionSnapshot;
798
935
  /** Public entry point for `@zweer/mage-space-client`. */
799
936
  declare const VERSION = "0.0.0";
800
937
  //#endregion
801
- export { type ActionCache, type ActionHashes, type ActionName, ActionRegistry, type ActionSnapshot, type ArchitectureConfig, type AspectRatio, AuthError, type AuthTokens, type Character, type CharacterPage, type CharacterRef, type CharacterSearchResult, CharactersService, type ConfirmOptions, type CreateCharacterInput, type CreateReferenceInput, type Creation, type CreationPage, DiscoveryError, type FetchLike, type GenerateOptions, type GenerateVideoOptions, type GenerateVoiceOptions, GenerationError, type GenerationMode, type GenerationResult, type HistoryItem, type HistoryPage, InMemoryActionCache, type JobStatus, type ListCharactersOptions, type ListCreationsOptions, type ListHistoryOptions, type ListReferencesOptions, MageSpaceClient, type MageSpaceClientOptions, MageSpaceError, type Modality, type Reference, type ReferenceOrder, type ReferencePage, type ReferenceVariant, ReferencesService, type Resolution, RscParseError, SEED_SNAPSHOT, type SearchCharactersOptions, type SessionState, StaleActionError, TimeoutError, type UpdateCharacterInput, type UpdateReferenceInput, VERSION, type VideoArchitectureConfig, type VideoAspectRatio, type VideoResolution, type Visibility, type VoiceResult, type WaitOptions, discoverActions, parseFlightRows, parseServerActionResponse, resolveFlightValue, unwrapResult };
938
+ export { type ActionCache, type ActionHashes, type ActionName, ActionRegistry, type ActionSnapshot, ActionUnavailableError, type ArchitectureConfig, type AspectRatio, AuthError, type AuthTokens, BETA_TARGET, type Character, type CharacterPage, type CharacterRef, type CharacterSearchResult, CharactersService, type ConfirmOptions, type CreateCharacterInput, type CreateReferenceInput, type Creation, type CreationPage, DEFAULT_TARGET_CHAIN, DiscoveryError, type FallbackOptions, type FetchLike, type GenerateOptions, type GenerateVideoOptions, type GenerateVoiceOptions, GenerationError, type GenerationMode, type GenerationResult, type HistoryItem, type HistoryPage, InMemoryActionCache, type JobStatus, type ListCharactersOptions, type ListCreationsOptions, type ListHistoryOptions, type ListReferencesOptions, type LogicalAction, MageSpaceClient, type MageSpaceClientOptions, MageSpaceError, type Modality, PRODUCTION_TARGET, type PollStrategy, type Reference, type ReferenceOrder, type ReferencePage, type ReferenceVariant, ReferencesService, type Resolution, RscParseError, SEED_SNAPSHOT, type SearchCharactersOptions, type SessionState, StaleActionError, type Target, type TargetKey, TimeoutError, type UpdateCharacterInput, type UpdateReferenceInput, VERSION, type VideoArchitectureConfig, type VideoAspectRatio, type VideoResolution, type Visibility, type VoiceResult, type WaitOptions, discoverActions, parseFlightRows, parseServerActionResponse, resolveActionName, resolveFlightValue, unwrapResult };
802
939
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/rsc.ts","../lib/seed.ts","../lib/index.ts"],"mappings":";;;;;;;;;KASY,aAAa,eAAe,OAAO,gBAAgB,QAAQ;;UAOtD;;EAEf;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;;KAQU;;KAmCA,eAAe;;UAGV;;EAEf;;EAEA,QAAQ;;EAER;;;;;;;;;;UAWe;EACf,QAAQ,QAAQ;EAChB,KAAK,UAAU,iBAAiB;;KAOtB;KACA;;KAEA;;KAEA;;UAGK;EACf;EACA;EACA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAEf;EACA;EACA,YAAY;EACZ;EACA;;EAEA;;;UAIe;EACf;IACE;IACA;IACA;IACA;IACA;IACA;MAAe;MAAkB;;;EAEnC;EACA;;;UAIe;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA,QAAQ;EACR;EACA,sBAAsB;EACtB;EACA;EACA;GACC;;;UAIc;EACf,WAAW;EACX;;UAOe;;EAEf;;EAEA,QAAQ;;EAER,QAAQ;;EAER;;EAEA,OAAO;;EAEP;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;EACA,cAAc;EACd,aAAa;;EAEb;;EAEA;;EAEA,aAAa;;;;;;EAMb,aAAa;;EAEb;;EAEA;;EAEA,iBAAiB;;;KAQP;;KAEA;;;;;;;;UASK;EACf;EACA;EACA;EACA;;EAEA;EACA;EACA,qBAAqB;;EAErB;;EAEA;EACA;EACA,YAAY;EACZ;EACA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,cAAc;;EAEd,aAAa;;EAEb;;EAEA;;EAEA;;EAEA,aAAa;;EAEb,aAAa;;EAEb;;EAEA;;EAEA,iBAAiB;;;;;;;;;UAUF;EACf;;UAGe;;EAEf;;EAEA;;EAEA,SAAS;;UAGM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;;;;cCvFpD;mBACM;mBACA;mBACA;mBACA;;WAGR,YAAY;;WAGZ,YAAY;EAErB,YAAY,SAAS;;EA2BrB,SAAS,SAAS,kBAAkB;IAAU;;;EAK9C,cAAc,SAAS,uBAAuB;IAAU;;;EAKxD,UAAU,oBAAoB,QAAQ;;EAKtC,cAAc,mBAAmB,UAAU,cAAc,QAAQ;;EAKjE,UAAU,oBAAoB;;EAK9B,YAAY,UAAU,qBAAqB,QAAQ;;EAKnD,cAAc,UAAU,uBAAuB,QAAQ;;EAKvD,aAAa,QAAQ,mBAAmB;;EAKxC,cAAc,mBAAmB,UAAU,iBAAiB;;EAK5D,oBAAoB,sBAAsB,UAAU,iBAAiB;;EAKrE,eAAe,oBAAoB,UAAU,iBAAiB;;EAK9D,oBAAoB,uBAAuB,UAAU,iBAAiB;;EAKtE,kBAAkB,QAAQ;;EAK1B,UAAU;;;;;;cCnIC,uBAAuB;EAClC,YAAY,iBAAiB;IAAY;;;;cAO9B,kBAAkB;EAC7B,YAAY,iBAAiB;IAAY;;;;cAO9B,uBAAuB;EAClC,YAAY,iBAAiB;IAAY;;;;cAO9B,yBAAyB;WAElB;EADlB,YACkB,gBAChB;IAAY;;;;cAQH,wBAAwB;WAGjB;EAFlB,YACE,iBACgB,2BAChB;IAAY;;;;cAQH,sBAAsB;EACjC,YAAY,iBAAiB;IAAY;;;;cAO9B,qBAAqB;EAChC,YAAY,iBAAiB;IAAY;;;;;;;;;;;;;;;;;iBCL3B,gBAAgB,eAAe;;iBAmE/B,mBACd,gBACA,MAAM,sBACN,OAAM;;;;;;iBA4CQ,0BAA0B,aAAa,eAAe;;;;;;;;;;;;iBA8BtD,aAAa,GAAG,iBAAiB;;;;;;;;;;;;cC3LpC,eAAe;;;;cCVf"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../lib/targets.ts","../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/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