@tinkerlandai/indiana-sdk 0.9.5 → 0.10.2
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/CHANGELOG.md +18 -0
- package/README.md +30 -41
- package/README.zh-CN.md +24 -22
- package/dist/{ai-usage-CUTIHAU0.d.ts → ai-usage-Cn7dhvFw.d.ts} +3 -3
- package/dist/{api-BXu6TAoB.d.ts → api-DC44FaTV.d.ts} +6354 -904
- package/dist/chunk-ACF2FBUB.js +1 -0
- package/dist/{chunk-XSOEA4A5.js → chunk-CWHJKWOD.js} +1 -1
- package/dist/chunk-EARSGITJ.js +1 -0
- package/dist/chunk-FYGXGMRB.js +1 -0
- package/dist/chunk-GHJ65ILJ.js +1 -0
- package/dist/chunk-JPV7F5XI.js +1 -0
- package/dist/{chunk-AOGPGUWE.js → chunk-LCLCG2I2.js} +1 -1
- package/dist/chunk-Q64VNSPV.js +6 -0
- package/dist/chunk-SBPTOOYB.js +1 -0
- package/dist/{chunk-MKV726FV.js → chunk-V3RAOCVQ.js} +1 -1
- package/dist/chunk-VZVUZWP2.js +1 -0
- package/dist/{chunk-M7JWCLYX.js → chunk-X6BCUINI.js} +1 -1
- package/dist/{chunk-4C3HUZ3B.js → chunk-XO42OH3M.js} +1 -1
- package/dist/{configuration-sync-DuJl4SbM.d.ts → configuration-sync-CywDxRkX.d.ts} +12 -12
- package/dist/{content-PQJYLAGQ.js → content-QM75T7JO.js} +1 -1
- package/dist/{funnel-local-client-BhHdi5_V.d.ts → funnel-local-client-DXamAj1-.d.ts} +18475 -2597
- package/dist/funnel-node-evaluation-P5B4fPfJ.d.ts +2054 -0
- package/dist/{funnel-resource-client-BoIhL_my.d.ts → funnel-resource-client-md62M8Rv.d.ts} +5977 -1126
- package/dist/funnel-runtime-host-BJZUVJAI.js +1 -0
- package/dist/index.d.ts +9924 -1958
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +4 -4
- package/dist/page.js +1 -1
- package/dist/paywall-527RPFAX.js +1 -0
- package/dist/popup.d.ts +1 -1
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +19930 -7179
- package/dist/react-native.js +1 -1
- package/dist/{screen-renderer-VAMWY7ID.js → screen-renderer-ZSAR7LPS.js} +1 -1
- package/dist/server.d.ts +2737 -573
- package/dist/server.js +1 -1
- package/dist/visual.d.ts +1 -1
- package/dist/visual.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5ZWSFE2C.js +0 -1
- package/dist/chunk-6ZZUNGNE.js +0 -1
- package/dist/chunk-HEGNIATD.js +0 -1
- package/dist/chunk-LMO3FXRT.js +0 -1
- package/dist/chunk-QYECMZJJ.js +0 -1
- package/dist/chunk-UBMPFTGE.js +0 -1
- package/dist/chunk-UWFYBRM2.js +0 -6
- package/dist/chunk-XRXI3DMZ.js +0 -1
- package/dist/funnel-node-evaluation-DuPmqIo1.d.ts +0 -998
- package/dist/funnel-runtime-host-3YUGXD3Y.js +0 -1
- package/dist/paywall-CSAGKPCP.js +0 -1
- package/dist/{screen-CvfI_L41.d.ts → screen-D81zCpfi.d.ts} +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"./chunk-DSPLGTQI.js";import{b as d}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-DSPLGTQI.js";import{b as d}from"./chunk-GHJ65ILJ.js";function m(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let i of document.cookie.split(";"))if(i.trim().startsWith(`${e}=`))try{t=decodeURIComponent(i.trim().slice(e.length+1))}catch{}return/^[A-Za-z0-9_-]{8,128}$/.test(t)||(t=crypto.randomUUID(),document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${400*24*3600}; SameSite=Lax`),t}function y(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function g(e=d){let t=new URL(e);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname))||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an https origin without credentials");return t.origin}var o=new Set,s;function S(e){let t=()=>e();if(o.add(t),!s){let i=!0,a=history.pushState,p=history.replaceState,r=()=>{if(i)for(let n of[...o])o.has(n)&&u(n)},c=function(...n){a.apply(this,n),r()},h=function(...n){p.apply(this,n),r()};history.pushState=c,history.replaceState=h,addEventListener("popstate",r),addEventListener("hashchange",r),s=()=>{i=!1,history.pushState===c&&(history.pushState=a),history.replaceState===h&&(history.replaceState=p),removeEventListener("popstate",r),removeEventListener("hashchange",r)}}return()=>{o.delete(t)&&(o.size||(s?.(),s=void 0))}}export{m as a,y as b,g as c,S as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StackNode } from './screen-
|
|
2
|
+
import { S as StackNode } from './screen-D81zCpfi.js';
|
|
3
3
|
|
|
4
4
|
declare const configurationScopeSchema: z.ZodObject<{
|
|
5
5
|
projectId: z.ZodString;
|
|
@@ -46,8 +46,8 @@ declare const sdkConfigurationManifestSchema: z.ZodObject<{
|
|
|
46
46
|
funnels: z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
47
47
|
state: z.ZodEnum<{
|
|
48
48
|
active: "active";
|
|
49
|
-
archived: "archived";
|
|
50
49
|
paused: "paused";
|
|
50
|
+
archived: "archived";
|
|
51
51
|
}>;
|
|
52
52
|
controlRevision: z.ZodNumber;
|
|
53
53
|
evaluationMode: z.ZodEnum<{
|
|
@@ -90,7 +90,7 @@ type ConfigurationStorage = {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
type ConfigurationSyncOptions = {
|
|
93
|
-
/** Public configuration origin; defaults to https://api.
|
|
93
|
+
/** Public configuration origin; defaults to https://api.longplayai.com. */
|
|
94
94
|
origin?: string;
|
|
95
95
|
scope: ConfigurationScope;
|
|
96
96
|
fetch?: typeof globalThis.fetch;
|
|
@@ -139,7 +139,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
139
139
|
generation?: string | undefined;
|
|
140
140
|
}>;
|
|
141
141
|
funnels: Record<string, {
|
|
142
|
-
state: "active" | "
|
|
142
|
+
state: "active" | "paused" | "archived";
|
|
143
143
|
controlRevision: number;
|
|
144
144
|
evaluationMode: "local" | "remote";
|
|
145
145
|
evaluationRevision: number;
|
|
@@ -342,6 +342,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
342
342
|
urlRedirect: string;
|
|
343
343
|
}[];
|
|
344
344
|
name?: string | undefined;
|
|
345
|
+
phase?: string | undefined;
|
|
345
346
|
filters?: {
|
|
346
347
|
seed: string;
|
|
347
348
|
hashVersion: 2;
|
|
@@ -376,7 +377,6 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
376
377
|
name?: string | undefined;
|
|
377
378
|
passthrough?: boolean | undefined;
|
|
378
379
|
}[] | undefined;
|
|
379
|
-
phase?: string | undefined;
|
|
380
380
|
}[];
|
|
381
381
|
savedGroups: Record<string, {
|
|
382
382
|
type: "hashed";
|
|
@@ -753,7 +753,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
753
753
|
primary: string;
|
|
754
754
|
background: string;
|
|
755
755
|
text: string;
|
|
756
|
-
radius: "none" | "
|
|
756
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
757
757
|
font: "system" | "serif" | "rounded" | "mono";
|
|
758
758
|
};
|
|
759
759
|
pages: {
|
|
@@ -764,7 +764,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
764
764
|
primary: string;
|
|
765
765
|
background: string;
|
|
766
766
|
text: string;
|
|
767
|
-
radius: "none" | "
|
|
767
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
768
768
|
font: "system" | "serif" | "rounded" | "mono";
|
|
769
769
|
} | undefined;
|
|
770
770
|
editorPosition?: {
|
|
@@ -1078,7 +1078,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1078
1078
|
} | undefined;
|
|
1079
1079
|
versionId: string;
|
|
1080
1080
|
control: {
|
|
1081
|
-
state: "active" | "
|
|
1081
|
+
state: "active" | "paused" | "archived";
|
|
1082
1082
|
controlRevision: number;
|
|
1083
1083
|
evaluationMode: "local" | "remote";
|
|
1084
1084
|
evaluationRevision: number;
|
|
@@ -1121,7 +1121,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1121
1121
|
generation?: string | undefined;
|
|
1122
1122
|
}>;
|
|
1123
1123
|
funnels: Record<string, {
|
|
1124
|
-
state: "active" | "
|
|
1124
|
+
state: "active" | "paused" | "archived";
|
|
1125
1125
|
controlRevision: number;
|
|
1126
1126
|
evaluationMode: "local" | "remote";
|
|
1127
1127
|
evaluationRevision: number;
|
|
@@ -1186,7 +1186,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1186
1186
|
primary: string;
|
|
1187
1187
|
background: string;
|
|
1188
1188
|
text: string;
|
|
1189
|
-
radius: "none" | "
|
|
1189
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
1190
1190
|
font: "system" | "serif" | "rounded" | "mono";
|
|
1191
1191
|
};
|
|
1192
1192
|
pages: {
|
|
@@ -1197,7 +1197,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1197
1197
|
primary: string;
|
|
1198
1198
|
background: string;
|
|
1199
1199
|
text: string;
|
|
1200
|
-
radius: "none" | "
|
|
1200
|
+
radius: "none" | "full" | "sm" | "md" | "lg";
|
|
1201
1201
|
font: "system" | "serif" | "rounded" | "mono";
|
|
1202
1202
|
} | undefined;
|
|
1203
1203
|
editorPosition?: {
|
|
@@ -1426,7 +1426,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1426
1426
|
generation?: string | undefined;
|
|
1427
1427
|
}>;
|
|
1428
1428
|
funnels: Record<string, {
|
|
1429
|
-
state: "active" | "
|
|
1429
|
+
state: "active" | "paused" | "archived";
|
|
1430
1430
|
controlRevision: number;
|
|
1431
1431
|
evaluationMode: "local" | "remote";
|
|
1432
1432
|
evaluationRevision: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as _,j as F}from"./chunk-
|
|
1
|
+
import{f as _,j as F}from"./chunk-X6BCUINI.js";import{b as q}from"./chunk-SSLZKIIU.js";import{L as U}from"./chunk-Q64VNSPV.js";import{Y as P,ca as M,ja as z,ka as N,qa as d}from"./chunk-ACF2FBUB.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-GHJ65ILJ.js";import{a as O}from"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";import{z as p}from"zod";var V=new WeakMap;function Q(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:O}[r.type];return r.nullable?t.nullable():t}async function ne(r,t){return W(r,t,!1)}async function re(r,t){return W(r,t,!0)}async function W(r,t,w){t.signal?.throwIfAborted();let T=U.parse(t.content),o=T.document;if(V.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),O).parse(t.inputs??{});if(Object.keys(f).length>40)throw new d("INVALID_REQUEST","Too many content inputs");for(let[e,s]of Object.entries(f))z.parse({[e]:s});if(Object.keys(f).some(e=>!Object.hasOwn(o.contract.inputs,e)))throw new d("INVALID_REQUEST","Undeclared content input");for(let[e,s]of Object.entries(o.contract.inputs))if(Object.hasOwn(f,e))Q(s).parse(f[e]);else if(s.required)throw new d("INVALID_REQUEST",`Missing content input ${e}`);for(let e of Object.keys(o.contract.outputs))if(typeof t.actions[e]!="function")throw new d("INVALID_REQUEST",`Missing host handler for ${e}`);let $=N.parse(t.bindings??[]),a=r.ownerDocument,L,k=o.kind==="popup",n=k?a.createElement("dialog"):null,i=a.createElement("div");if(i.dataset.indianaContent=o.kind,i.setAttribute("aria-label",o.name),i.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",o.name);let e=o.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${P[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",n.append(i),r.append(n)}else r.append(i);let c=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||a.defaultView?.innerWidth||800}px`);let B=w?_(n??i):()=>{},H,x,A=new Promise((e,s)=>{H=e,x=s});A.catch(()=>{});let l=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let b;function m(){c||(c=!0,t.signal?.removeEventListener("abort",m),x(new Error("Content preparation cancelled")),b?.destroy(),n?.close(),n?.remove(),i.remove(),V.delete(r),n&&L?.())}let S=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=a.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),e.style.cssText="position:absolute;right:8px;top:8px;width:30px;height:30px;z-index:1",e.addEventListener("click",S),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),S()});async function D(){if(c||!g||C||!l)return;let e=l;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),l=null}catch(s){v(t.onError,s)}finally{C=!1,c||i.removeAttribute("aria-busy")}}function R(){if(c)throw new d("CONFLICT","Content host has been destroyed");g||(L=q(a),B(),w&&!n&&(i.style.width="100%"),n?.showModal(),g=!0)}try{w||R(),b=F(i,{mode:"live",title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||a.defaultView?.innerHeight||800:void 0,onRendered:H,onError:u=>{let I=new Error(u);x(I),v(t.onError,I)},onEscape:k?S:void 0,onAction:(u,I,J)=>{if(c||!g||C||l)return;let h=o.screen.actions.find(y=>y.id===u),j=o.contract.outputs[u];if(!(h?.type!=="event"||!j))try{let y=Q(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);l={requestId:crypto.randomUUID(),contentVersionId:T.id,actionId:u,event:h.event,value:y,selection:I??{},answers:J??{},requestedClose:h.close},D()}catch(y){v(t.onError,y)}}});let e={destroy:m,show:R,get pendingAction(){return l?structuredClone(l):null},retryAction:D,updateCapabilities:u=>b?.updateCapabilities(u)};V.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=M(E,[t.locale,...a.defaultView?.navigator.languages??[]]);if(b.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:$,answers:{},values:f}}),await Promise.race([b.ready,A]),w&&await A,c)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ne as mountContent,re as prepareContent};
|