@aippy/runtime 0.4.2-dev.5 → 0.4.2-dev.8

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/README.md CHANGED
@@ -127,6 +127,12 @@ const image = await generateImage({
127
127
  console.log(image.image?.base64);
128
128
  ```
129
129
 
130
+ `@aippy/runtime/ai` also exports internal-test Viggle generation with automatic recovery and
131
+ `listViggleModels` for the current user's project history. Project ticket keys
132
+ are resolved by the backend; applications do not settle tickets or pass SKU
133
+ constants. Availability depends on the matching backend/shared MiniStore
134
+ contracts and project configuration. See the [AI module](./src/ai/README.md).
135
+
130
136
  ### Ministore (Internal Test Only)
131
137
 
132
138
  `@aippy/runtime/ministore` provides project entitlement catalogs, holdings,
@@ -41,5 +41,6 @@ export type { AippyOpenAIConfig } from './openai';
41
41
  export { aippyChatConfig, type AippyUseChatOptions, type AippyUIConfig, type AippyChatConfig, UI_CHAT_ENDPOINT, } from './ui';
42
42
  export { DEFAULT_BASE_URL, DEFAULT_UI_BASE_URL, DEFAULT_CHAT_MODEL, DEFAULT_CHAT_SYSTEM, resolveOpenAIConfig, resolveUIConfig, } from './shared';
43
43
  export { normalizeError } from './errors';
44
- export { generateCharacter3D, generateMotion, type GenerateCharacter3DInput, type GenerateMotionInput, type ViggleAsset, } from './viggle/generate';
44
+ export { generateCharacter3D, generateMotion, createViggleRequestId, resumeViggleGeneration, ViggleGenerationError, type GenerateCharacter3DInput, type GenerateMotionInput, type ViggleAsset, type ViggleKind, type ViggleStage, type ResumeViggleGenerationInput, } from './viggle/generate';
45
+ export { listViggleModels, type ListViggleModelsOptions, type ViggleModel, type ViggleModelValue, type ViggleModelsPage, } from './viggle/models';
45
46
  export { type AIConfig, type AIConfigValue, type AIConfigItem, type NumberAIConfigItem, type BooleanAIConfigItem, type TextAIConfigItem, type EnumAIConfigItem, type AIConfigError, type AIConfigValues, validateAIConfig, parseAIConfig, loadAIConfig, getAIConfigValue, sendAIConfigToContainer, createAIConfig, } from './config';
package/dist/ai/index.js CHANGED
@@ -1,22 +1,26 @@
1
- import { D as o, d as r, e as i, c as n, U as A, a as C, b as g, j as I, g as f, h as t, i as _, l as E, n as T, p as U, r as p, f as D, s as l, v as L } from "../helper-CSe2sxu6.js";
1
+ import { D as o, d as r, e as i, c as n, U as g, V as A, a as t, b as C, o as l, i as I, g as f, h as E, m as _, l as T, k as U, n as p, p as D, r as d, f as L, j as V, s as m, v } from "../helper-CQZmdyi3.js";
2
2
  import "../bridge-K3HqQwdj.js";
3
3
  export {
4
4
  o as DEFAULT_BASE_URL,
5
5
  r as DEFAULT_CHAT_MODEL,
6
6
  i as DEFAULT_CHAT_SYSTEM,
7
7
  n as DEFAULT_UI_BASE_URL,
8
- A as UI_CHAT_ENDPOINT,
9
- C as aippyAIProvider,
10
- g as aippyChatConfig,
11
- I as createAIConfig,
8
+ g as UI_CHAT_ENDPOINT,
9
+ A as ViggleGenerationError,
10
+ t as aippyAIProvider,
11
+ C as aippyChatConfig,
12
+ l as createAIConfig,
13
+ I as createViggleRequestId,
12
14
  f as generateCharacter3D,
13
- t as generateMotion,
15
+ E as generateMotion,
14
16
  _ as getAIConfigValue,
15
- E as loadAIConfig,
16
- T as normalizeError,
17
- U as parseAIConfig,
18
- p as resolveOpenAIConfig,
19
- D as resolveUIConfig,
20
- l as sendAIConfigToContainer,
21
- L as validateAIConfig
17
+ T as listViggleModels,
18
+ U as loadAIConfig,
19
+ p as normalizeError,
20
+ D as parseAIConfig,
21
+ d as resolveOpenAIConfig,
22
+ L as resolveUIConfig,
23
+ V as resumeViggleGeneration,
24
+ m as sendAIConfigToContainer,
25
+ v as validateAIConfig
22
26
  };
@@ -1,26 +1,67 @@
1
- export interface GenerateCharacter3DInput {
2
- /** File from `<input type="file">`. The backend stores it and calls Viggle. */
1
+ import { AISDKError } from 'ai';
2
+ export type ViggleKind = 'character' | 'motion';
3
+ export type ViggleStage = 'authorize' | 'create' | 'poll' | 'resume';
4
+ interface GenerationOptions {
5
+ /** Optional explicit idempotency key. Normal calls manage recovery internally. */
6
+ requestId?: string;
7
+ signal?: AbortSignal;
8
+ }
9
+ export interface GenerateCharacter3DInput extends GenerationOptions {
3
10
  image?: Blob;
4
11
  imageUrl?: string;
5
12
  prompt?: string;
6
- signal?: AbortSignal;
7
13
  }
8
- export interface GenerateMotionInput {
14
+ export interface GenerateMotionInput extends GenerationOptions {
9
15
  text: string;
10
16
  durationSeconds?: number;
11
- signal?: AbortSignal;
17
+ }
18
+ export interface ResumeViggleGenerationInput extends GenerationOptions {
19
+ jobId: string;
20
+ kind: ViggleKind;
12
21
  }
13
22
  export interface ViggleAsset {
14
23
  url: string;
15
24
  thumbnailUrl?: string;
25
+ jobId: string;
26
+ requestId: string;
27
+ kind: ViggleKind;
28
+ /** Prepaid jobs are delivered only after the coupon consume is confirmed. */
29
+ billingState?: string;
30
+ }
31
+ interface Handle {
32
+ requestId?: string;
33
+ jobId?: string;
34
+ jobConfirmed?: boolean;
35
+ kind: ViggleKind;
36
+ stage: ViggleStage;
37
+ persist?: () => void;
38
+ clear?: () => void;
39
+ }
40
+ /** Recovery is automatic on the next call with the same input. Handles remain available for diagnostics and explicit recovery. */
41
+ export declare class ViggleGenerationError extends AISDKError {
42
+ readonly requestId?: string;
43
+ readonly jobId?: string;
44
+ /** True only after the backend confirmed that this job was persisted. */
45
+ readonly jobConfirmed: boolean;
46
+ readonly kind: ViggleKind;
47
+ readonly stage: ViggleStage;
48
+ readonly reason: string;
49
+ readonly httpStatus?: number;
50
+ readonly activeJob?: {
51
+ jobId: string;
52
+ kind: ViggleKind;
53
+ requestId: string;
54
+ sameInput: boolean;
55
+ };
56
+ constructor(message: string, handle: Handle, reason: string, cause?: unknown, httpStatus?: number, activeJob?: ViggleGenerationError['activeJob']);
16
57
  }
17
- /**
18
- * Create a rigged `.vsplat` character and wait until its CDN URL is ready.
19
- * Call this from a user gesture. The request goes to the Aippy backend.
20
- */
58
+ /** One key per user action. A retry of the same action must reuse the key. */
59
+ export declare function createViggleRequestId(): string;
60
+ /** Persist a job, use/buy its project ticket, then wait for confirmed fulfillment. */
21
61
  export declare function generateCharacter3D(input: GenerateCharacter3DInput): Promise<ViggleAsset>;
22
- /**
23
- * Create a 441-joint GLB motion from text and wait until its CDN URL is ready.
24
- * Call this from a user gesture. The request goes to the Aippy backend.
25
- */
62
+ /** Generate a 441-joint GLB motion; quantity is one priced generation coupon. */
26
63
  export declare function generateMotion(input: GenerateMotionInput): Promise<ViggleAsset>;
64
+ /** Explicit user action: recover a job with GET only, including consent/recharge. */
65
+ export declare function resumeViggleGeneration(input: ResumeViggleGenerationInput): Promise<ViggleAsset>;
66
+ export declare function viggleScope(signal: AbortSignal): () => void;
67
+ export {};
@@ -0,0 +1,46 @@
1
+ import { ViggleKind } from './generate';
2
+ export interface ListViggleModelsOptions {
3
+ kind?: ViggleKind;
4
+ /** Opaque decimal record ID; keep as a string. */
5
+ cursor?: string;
6
+ /** Raw records per page, 1–50; default 20. Filtered pages can be empty. */
7
+ limit?: number;
8
+ signal?: AbortSignal;
9
+ }
10
+ export interface ViggleModelValue {
11
+ schemaVersion: 1;
12
+ source: 'aisdk.viggle';
13
+ jobId: string;
14
+ provider: 'viggle';
15
+ kind: ViggleKind;
16
+ durationSeconds?: number;
17
+ asset: {
18
+ url: string;
19
+ format: 'vsplat' | 'glb';
20
+ thumbnailUrl?: string;
21
+ };
22
+ generatedAt: string;
23
+ }
24
+ export interface ViggleModel {
25
+ recordId: string;
26
+ benefitKey: string;
27
+ bizOrderNo: string;
28
+ jobId: string;
29
+ kind: ViggleKind;
30
+ url: string;
31
+ thumbnailUrl?: string;
32
+ durationSeconds?: number;
33
+ generatedAt: string;
34
+ consumedAt: string;
35
+ /** Original consumed-item value snapshot; independent of job retention. */
36
+ value: ViggleModelValue;
37
+ }
38
+ export interface ViggleModelsPage {
39
+ models: ViggleModel[];
40
+ nextCursor: string;
41
+ }
42
+ /** Read successful model records for the authenticated user/current project.
43
+ * Product keys are resolved by the backend, including retired products.
44
+ * This call never authorizes, recharges, purchases, generates or consumes.
45
+ */
46
+ export declare function listViggleModels(options?: ListViggleModelsOptions): Promise<ViggleModelsPage>;
@@ -0,0 +1,12 @@
1
+ export interface SavedGeneration {
2
+ requestId: string;
3
+ jobId?: string;
4
+ }
5
+ export declare function inputDigest(input: unknown): Promise<string>;
6
+ /** Hints only: server ownership, input binding, CAS and purchase authorization
7
+ * remain authoritative. Never persist prompts, images, tokens or billing data. */
8
+ export declare function recoveryKey(kind: string, digest: string): string | undefined;
9
+ export declare function readGeneration(key?: string): SavedGeneration | undefined;
10
+ export declare function saveGeneration(key: string | undefined, saved: SavedGeneration): void;
11
+ export declare function clearGeneration(key: string | undefined, requestId: string): void;
12
+ export declare function singleGeneration<T>(key: string | undefined, run: () => Promise<T>, signal: AbortSignal): Promise<T>;
@@ -1,5 +1,5 @@
1
1
  import { g as o, a as i } from "./bridge-K3HqQwdj.js";
2
- const r = "0.4.2-dev.5", c = {
2
+ const r = "0.4.2-dev.8", c = {
3
3
  version: r
4
4
  }, a = c.version, p = "@aippy/runtime";
5
5
  function u() {
@@ -1,7 +1,7 @@
1
1
  import { D as r, g as s, m as o } from "../config-B0A7gHQM.js";
2
2
  import { _ as t, r as i } from "../bridge-K3HqQwdj.js";
3
3
  import { A as R, a as E, E as c, b as m, c as A } from "../errors-B3bDbQbD.js";
4
- import { S as f, V as g, c as l, a as y, g as _, s as d } from "../container-message-D4RX93q2.js";
4
+ import { S as f, V as g, c as l, a as y, g as _, s as d } from "../container-message-D_fZlguH.js";
5
5
  import { A as D, C as O, R as F, a as I, p as S } from "../runtime-CmoG3v2m.js";
6
6
  export {
7
7
  D as AippyRuntime,