@aippy/runtime 0.4.2-dev.4 → 0.4.2-dev.7

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 staged Viggle generation/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-BWszI06u.js";
2
- import "../bridge-D_-7nPNC.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-DnJHjgMg.js";
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,59 @@
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 = 'prepare' | 'authorize' | 'create' | 'poll' | 'resume';
4
+ interface GenerationOptions {
5
+ /** Save createViggleRequestId() before starting, and reuse it for a retry. */
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
+ }
38
+ /** Retain these fields after cancellation, timeout, or a lost HTTP response. */
39
+ export declare class ViggleGenerationError extends AISDKError {
40
+ readonly requestId?: string;
41
+ readonly jobId?: string;
42
+ /** True only after the backend confirmed that this job was persisted. */
43
+ readonly jobConfirmed: boolean;
44
+ readonly kind: ViggleKind;
45
+ readonly stage: ViggleStage;
46
+ readonly reason: string;
47
+ readonly httpStatus?: number;
48
+ constructor(message: string, handle: Handle, reason: string, cause?: unknown, httpStatus?: number);
16
49
  }
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
- */
50
+ /** One key per user action. A retry of the same action must reuse the key. */
51
+ export declare function createViggleRequestId(): string;
52
+ /** Persist a job, use/buy its project ticket, then wait for confirmed fulfillment. */
21
53
  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
- */
54
+ /** Generate a 441-joint GLB motion; quantity is one priced generation coupon. */
26
55
  export declare function generateMotion(input: GenerateMotionInput): Promise<ViggleAsset>;
56
+ /** Explicit user action: recover a job with GET only, including consent/recharge. */
57
+ export declare function resumeViggleGeneration(input: ResumeViggleGenerationInput): Promise<ViggleAsset>;
58
+ export declare function viggleScope(signal: AbortSignal): () => void;
59
+ 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>;
@@ -156,17 +156,18 @@ class A {
156
156
  }
157
157
  }
158
158
  }
159
- const m = new A(), C = { iOS: "1.6.7", Android: "1.1.8" }, k = { iOS: "1.6.7", Android: "1.1.8" }, d = {
159
+ const m = new A(), C = { iOS: "1.6.7", Android: "1.1.8" }, k = { iOS: "1.6.7", Android: "1.1.8" }, P = { iOS: "1.21.0", Android: "1.3.7.0" }, d = {
160
160
  userCredentials: C,
161
- userInfo: k
161
+ userInfo: k,
162
+ ministore: P
162
163
  }, l = "https://cdn.aippy.ai/asset/fd292077086044ee9565bd36ac3a8b78.svg";
163
- function P() {
164
+ function V() {
164
165
  const t = m.parseAippyInfo();
165
166
  if (!t) return !1;
166
167
  const e = d.userCredentials[t.platform];
167
168
  return f(t.version, e) >= 0;
168
169
  }
169
- async function V(t, e = "update") {
170
+ async function _(t, e = "update") {
170
171
  const n = document.createElement("div");
171
172
  n.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:12px;display:flex;align-items:flex-end;justify-content:center;z-index:999999;pointer-events:none";
172
173
  const r = document.createElement("div");
@@ -181,7 +182,7 @@ async function V(t, e = "update") {
181
182
  const a = document.createElement("img");
182
183
  a.src = l, a.style.cssText = "width:36px;height:36px;flex-shrink:0", r.appendChild(a);
183
184
  }
184
- const i = e === "signin" || e === "update" && P(), p = i ? t.replace(/\n/g, "") : t, s = document.createElement("span");
185
+ const i = e === "signin" || e === "update" && V(), p = i ? t.replace(/\n/g, "") : t, s = document.createElement("span");
185
186
  if (s.style.cssText = "font-size:14px;font-weight:600;color:#fff;line-height:1.4;white-space:pre-line", s.textContent = p, r.appendChild(s), i) {
186
187
  const a = e === "signin" ? "Sign in" : "Update", c = document.createElement("button");
187
188
  c.style.cssText = "background:#fff;color:#000;font-size:14px;font-weight:600;border:none;border-radius:32px;height:36px;min-width:80px;padding:0 16px;cursor:pointer;flex-shrink:0;white-space:nowrap", c.textContent = a, c.onclick = () => {
@@ -196,12 +197,12 @@ async function V(t, e = "update") {
196
197
  }
197
198
  n.appendChild(r), document.body.appendChild(n);
198
199
  }
199
- function _(t) {
200
+ function R(t) {
200
201
  const e = d[t];
201
202
  return e || (console.warn(`[AppVersionChecker] Unknown feature: ${t}`), { iOS: "999.0.0", Android: "999.0.0" });
202
203
  }
203
- function R(t) {
204
- const e = _(t), n = m.checkAppEnvironment(e), r = n.aippyInfo?.version, o = n.aippyInfo ? e[n.aippyInfo.platform] : void 0;
204
+ function I(t) {
205
+ const e = R(t), n = m.checkAppEnvironment(e), r = n.aippyInfo?.version, o = n.aippyInfo ? e[n.aippyInfo.platform] : void 0;
205
206
  switch (n.type) {
206
207
  case "new_app":
207
208
  return {
@@ -225,24 +226,24 @@ function R(t) {
225
226
  };
226
227
  }
227
228
  }
228
- function L(t) {
229
- const e = R(t);
229
+ function M(t) {
230
+ const e = I(t);
230
231
  if (!e.supported && (e.envCheck.type === "new_app" || e.envCheck.type === "old_ios_app" || e.envCheck.type === "old_android_app"))
231
- throw console.warn(`[AppVersionChecker] ${e.message}`), V(`This project needs a newer version.
232
+ throw console.warn(`[AppVersionChecker] ${e.message}`), _(`This project needs a newer version.
232
233
  Update to view it.`, "update"), v(`App version too old: ${e.message}`, x.NOT_SUPPORTED);
233
234
  return e;
234
235
  }
235
- function M() {
236
+ function N() {
236
237
  return Object.keys(d);
237
238
  }
238
239
  export {
239
240
  A as P,
240
- R as a,
241
- M as b,
241
+ I as a,
242
+ N as b,
242
243
  f as c,
243
- _ as g,
244
+ R as g,
244
245
  y as i,
245
246
  m as p,
246
- L as r,
247
- V as s
247
+ M as r,
248
+ _ as s
248
249
  };
@@ -1,5 +1,5 @@
1
1
  import { a as v } from "./runtime-CmoG3v2m.js";
2
- import { r as b, s as q, i as w } from "./app-version-checker-Bz7FrEZz.js";
2
+ import { r as b, s as q, i as w } from "./app-version-checker-YVIFbytA.js";
3
3
  import { c as A, a as _ } from "./errors-B3bDbQbD.js";
4
4
  const F = ".aippynow.com", k = "https://api.aippy.dev", S = "https://api.aippy.ai";
5
5
  function ee(e) {
@@ -1,5 +1,5 @@
1
- import { g as o, a as i } from "./bridge-D_-7nPNC.js";
2
- const r = "0.4.2-dev.4", c = {
1
+ import { g as o, a as i } from "./bridge-K3HqQwdj.js";
2
+ const r = "0.4.2-dev.7", 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
- import { _ as t, r as i } from "../bridge-D_-7nPNC.js";
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-DmIChz4h.js";
4
+ import { S as f, V as g, c as l, a as y, g as _, s as d } from "../container-message-D-wg98Oh.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,