@tinkerlandai/indiana-sdk 0.9.1 → 0.9.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 +6 -0
- package/dist/{chunk-JEFEBF2H.js → chunk-65TBYVCS.js} +1 -1
- package/dist/{chunk-DAWZULXZ.js → chunk-67A7I6MB.js} +1 -1
- package/dist/{chunk-UBRLGIZE.js → chunk-CCQHYQ4P.js} +1 -1
- package/dist/chunk-PK5HYUHD.js +1 -0
- package/dist/{chunk-NTP55JMK.js → chunk-SEW4YVR7.js} +1 -1
- package/dist/{chunk-YAU4DI52.js → chunk-UYSOTMY3.js} +1 -1
- package/dist/{chunk-7IB7CZ5P.js → chunk-WSVH6IQA.js} +1 -1
- package/dist/{chunk-SX5MO56H.js → chunk-YZSQDZXW.js} +1 -1
- package/dist/{content-YAPEUX6I.js → content-3LOJVYQO.js} +1 -1
- package/dist/funnel-runtime-host-NYHKQT6T.js +1 -0
- package/dist/index.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/page.js +1 -1
- package/dist/{paywall-EM7RGU56.js → paywall-ISCYOGPZ.js} +1 -1
- package/dist/react-native.js +1 -1
- package/dist/server.js +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-IH4KBLNR.js +0 -1
- package/dist/funnel-runtime-host-OZA763NT.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Release facts and artifact evidence: [SDK release ledger](../../docs/sdk-releases.md).
|
|
4
4
|
|
|
5
|
+
## 0.9.2 — 2026-10-29
|
|
6
|
+
|
|
7
|
+
- Add Python Server-Key APIs for Funnel decisions and recovery, Offering resolution, Feature evaluation and marketing events, with synchronous and asynchronous clients.
|
|
8
|
+
- Support Pika V1 marketing data delivery entirely on the merchant backend, without creating or distributing a Customer Token. Keep payment and entitlements in Pika's existing flow.
|
|
9
|
+
- Keep wire protocol 0.9 and the existing JavaScript, React Native, Swift, Kotlin and Go business behavior.
|
|
10
|
+
|
|
5
11
|
## 0.9.1 — 2026-10-29
|
|
6
12
|
|
|
7
13
|
- Return scoped Access/Refresh credential pairs from backend issuance and Guest session resumption. Replace backend renewal with client Refresh Token rotation; backend revocation invalidates both credentials.
|
|
@@ -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-WSVH6IQA.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 +1 @@
|
|
|
1
|
-
import{M as E,N as M,O as j,P as O,Q as T}from"./chunk-
|
|
1
|
+
import{M as E,N as M,O as j,P as O,Q as T}from"./chunk-PK5HYUHD.js";import{fa as u,k as w}from"./chunk-G23YNWWI.js";import{z as t}from"zod";var _=E,V=t.string().regex(/^(0|[1-9]\d{0,5})(\.\d{1,12})?$/),C=t.strictObject(Object.fromEntries(_.map(i=>[i,t.number().int().nonnegative().max(1e9)]))),L=M,D=j,q=t.strictObject({modelId:L,source:t.enum(["models.dev","custom"]),fetchedAt:t.iso.datetime(),rates:O,contextTier:t.number().int().nonnegative(),markupPercent:D}),U=t.strictObject({pricing:q,tokens:C,quantity:w,digest:t.string().regex(/^[a-f0-9]{64}$/)}),z=i=>{let[s,o=""]=i.split(".");return BigInt(s)*10n**12n+BigInt(o.padEnd(12,"0"))};function $(i){if(typeof i!="number"||!Number.isFinite(i)||i<0)throw new u("AI_PRICE_UNAVAILABLE","A published token price is missing");let s=String(i),o=s.includes("e")?i.toFixed(12).replace(/0+$/,"").replace(/\.$/,""):s;if(Number(o)!==i||!V.safeParse(o).success)throw new u("AI_PRICE_UNAVAILABLE","Published price exceeds the supported precision");return o}var R=t.strictObject({input:t.number().nonnegative(),output:t.number().nonnegative(),cache_read:t.number().nonnegative().optional(),cache_write:t.number().nonnegative().optional(),reasoning:t.number().nonnegative().optional(),input_audio:t.number().nonnegative().optional(),output_audio:t.number().nonnegative().optional()}),F=R.extend({context_over_200k:t.unknown().optional(),tiers:t.array(R.extend({tier:t.strictObject({type:t.literal("context"),size:t.number().int().nonnegative()})})).max(20).refine(i=>new Set(i.map(s=>s.tier.size)).size===i.length).optional()});async function N(i,s,o){let d=new TextEncoder().encode(JSON.stringify({pricing:i,tokens:s,quantity:o}));return[...new Uint8Array(await crypto.subtle.digest("SHA-256",d))].map(m=>m.toString(16).padStart(2,"0")).join("")}function B(i,s){let o=0n;for(let c of _){if(!s[c])continue;let f=i.rates[c];if(f===void 0)throw new u("AI_PRICE_UNAVAILABLE",`No published price for ${c}; report exclusive token pools`);o+=z(f)*BigInt(s[c])}let[d,m="0"]=String(i.markupPercent).split("e"),r=(d.split(".")[1]?.length??0)-Number(m),e=10n**BigInt(Math.max(r,0)),n=BigInt(d.replace(".",""))*10n**BigInt(Math.max(-r,0)),g=100n*e+n,l=100n*e*1000000n,a=(o*g+l-1n)/l;return w.parse(`${a/1000000n}.${(a%1000000n).toString().padStart(6,"0")}`)}function K(i={}){if(typeof window<"u")throw new u("SERVER_ONLY","AI token pricing belongs on your backend");let s=T.parse({defaultMarkup:i.defaultMarkup??0,providerMarkups:i.providerMarkups??{},modelMarkups:i.modelMarkups??{},customModels:i.customModels??{}}),o=null,d=0;async function m(){if(!o||Date.now()>=d){d=Date.now()+15*6e4;let r=(async()=>{let e=await(i.fetch??fetch)("https://models.dev/api.json",{signal:AbortSignal.timeout(3e4)});if(!e.ok)throw new u("AI_PRICE_UNAVAILABLE","Models.dev pricing is unavailable");return{data:t.record(t.string(),t.object({models:t.record(t.string(),t.unknown())})).parse(await e.json()),fetchedAt:new Date().toISOString()}})().catch(e=>{throw o===r&&(o=null),e});o=r}return o}return{refreshPrices(){o=null,d=0},async quoteTokens(r){let e=L.parse(r.modelId),n=C.parse(r.tokens),[g,...l]=e.split("/"),a=s.customModels[e],c,f,p,y=0;if(a?.input!==void 0&&a.output!==void 0&&_.every(A=>n[A]===0||a[A]!==void 0))c={...a,input:a.input,output:a.output},f="custom",p=new Date().toISOString();else{let A=await m(),x=A.data[g]?.models[l.join("/")];if(!x)throw new u("AI_PRICE_UNAVAILABLE","Unknown model; configure a complete custom price");let{cost:I}=t.object({cost:F}).parse(x),P=n.input+n.cache_read+n.cache_write+n.input_audio;if(I.tiers===void 0&&I.context_over_200k!==void 0&&P>2e5)throw new u("AI_PRICE_UNAVAILABLE","A current context tier is required for this model");let b=I.tiers?.filter(k=>P>k.tier.size).sort((k,Q)=>Q.tier.size-k.tier.size)[0],v=b??I;b&&(y=b.tier.size),c=Object.fromEntries(_.filter(k=>v[k]!==void 0).map(k=>[k,$(v[k])])),c={...c,...a},f=a?"custom":"models.dev",p=A.fetchedAt}let h=q.parse({modelId:e,source:f,fetchedAt:p,rates:c,contextTier:y,markupPercent:s.modelMarkups[e]??s.providerMarkups[g]??s.defaultMarkup}),S=B(h,n);return U.parse({pricing:h,tokens:n,quantity:S,digest:await N(h,n,S)})},async trackTokens(r,e){let n=U.parse(e.quote);if(n.quantity!==B(n.pricing,n.tokens)||n.digest!==await N(n.pricing,n.tokens,n.quantity))throw new u("INVALID_REQUEST","AI quote changed after pricing");let g=e.properties??{},l=e.providerCostUsd===void 0?void 0:t.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/).parse(e.providerCostUsd),a=e.generationId===void 0?void 0:t.string().min(1).max(120).parse(e.generationId),c=8+ +(l!==void 0)+ +(a!==void 0);if(Object.keys(g).some(p=>p.startsWith("ai_")))throw new u("INVALID_REQUEST","AI tracking reserves ai_ event properties");if(Object.keys(g).length>16-c)throw new u("INVALID_REQUEST","AI tracking properties exceed the available event budget");let f={operation:"consume",internal_feature_id:e.internal_feature_id,quantity:n.quantity,idempotencyKey:e.idempotencyKey,properties:{...g,...l!==void 0?{ai_provider_cost_usd:l}:{},...a!==void 0?{ai_generation_id:a}:{},ai_model:n.pricing.modelId,ai_source:n.pricing.source,ai_price_at:n.pricing.fetchedAt,ai_quote_hash:n.digest,ai_markup:String(n.pricing.markupPercent),ai_tier:String(n.pricing.contextTier),ai_tokens:_.map(p=>n.tokens[p]).join(","),ai_rates:"v1:"+_.map(p=>n.pricing.rates[p]===void 0?"-":z(n.pricing.rates[p]).toString(36)).join(",")},...e.entityId?{entityId:e.entityId}:{}};return r.mutateBalance({customerId:e.customerId,command:f})}}}async function Y(i,s,o={}){let{config:d,model_markups:m}=await i.readAiPricing(s);return K({defaultMarkup:d.default_markup??0,providerMarkups:Object.fromEntries(Object.entries(d.provider_markups??{}).map(([r,e])=>[r,e.markup])),modelMarkups:Object.fromEntries(Object.entries(m??{}).filter(([,r])=>r.markup!==void 0).map(([r,e])=>[r,e.markup])),customModels:Object.fromEntries(Object.entries(m??{}).filter(([,r])=>r.input_cost!==void 0||r.output_cost!==void 0).map(([r,e])=>[r,{...e.input_cost!==void 0?{input:String(e.input_cost)}:{},...e.output_cost!==void 0?{output:String(e.output_cost)}:{}}])),...o})}export{q as a,U as b,K as c,Y as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as S,a as U,b as j,c as x,d as R,e as C,f as F}from"./chunk-
|
|
1
|
+
import{R as S,a as U,b as j,c as x,d as R,e as C,f as F}from"./chunk-PK5HYUHD.js";import{fa as s}from"./chunk-G23YNWWI.js";import{a as H}from"./chunk-G56XGVMS.js";var N=r=>{if(!Number.isSafeInteger(r)||r<0||r>=Number.MAX_SAFE_INTEGER)throw new s("INVALID_STATE","Installation sequence exhausted");return r+1},G=async r=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(r,c=>c.charCodeAt(0))))].map(c=>c.toString(16).padStart(2,"0")).join("");function q(r,c){return r.transaction(a=>{if(!Number.isSafeInteger(a.identitySeq)||a.identitySeq<0||!Number.isSafeInteger(a.addressSeq)||a.addressSeq<0||a.detachSeq!==null&&(!Number.isSafeInteger(a.detachSeq)||a.detachSeq<1||a.detachSeq>a.identitySeq))throw new s("INVALID_STATE","Installation journal is invalid");return c({...a})})}function W(r,c,a){let i=null,g=0,f=0,P=0,L=Promise.resolve();if(r&&(!a||H.parse(r.scope).projectId!==a.projectId||r.scope.environment!==a.environment))throw new s("SCOPE_MISMATCH","Push installation belongs to another scope");let y=()=>{if(!r)throw new s("NOT_CONFIGURED","Configure this client's native Push host first");return r},l=e=>{if(e!==g)throw new s("IDENTITY_CHANGED","Identity changed during Push operation")};async function D(e){let t=y();if(!t.sha256&&!globalThis.crypto?.subtle)throw new s("NOT_CONFIGURED","Configure native SHA-256 for this Push host");let n=t.sha256?await t.sha256(Uint8Array.from(e,d=>d.charCodeAt(0))):await G(e);if(!/^[a-f0-9]{64}$/.test(n))throw new s("INVALID_STATE","Push credential digest is invalid");return n}function A(e){let t=C.parse(e);if(t.installationId.toLowerCase()!==y().installationId.toLowerCase())throw new s("INVALID_RESPONSE","Push response belongs to another installation");return t}async function E(e,t){let n=y(),d={installationId:n.installationId,publicKey:n.publicKey,issuedAt:new Date().toISOString(),...t},u=await n.sign(F(e,n.scope,d));return{...d,signature:u}}let O=(e,t,n)=>c.requestWithCredential?c.requestWithCredential(e,t,n):c.request(e,t);async function _(){let e=y(),t=g,n=i?await(c.session?.access()??i):null,d=q(e,h=>h),u;if(d.detachSeq!==null){let h=d.detachSeq,k=U.parse(await E("detach",{sequence:h,platform:e.platform}));try{let o=await c.request("push/installations/detach",{...e.scope,...k},"POST",{installationDetach:!0});if(!o||typeof o!="object"||!("installation"in o))throw new s("INVALID_RESPONSE","Push detach acknowledgement is invalid");let w=A(o.installation);if(w.bound||w.identitySeq!==h)throw new s("INVALID_RESPONSE","Push detach acknowledgement does not match its intent")}catch(o){if(o instanceof s&&o.status===404)u=o;else if(!(o instanceof s)||o.status!==412)throw o}u||q(e,o=>({...o,detachSeq:o.detachSeq===h?null:o.detachSeq}))}if(l(t),!n){if(u)throw u;return null}let p=S.bindPushInstallation,m=p.request.parse(await E("bind",{sequence:P,platform:e.platform,credentialDigest:await D(n)}));l(t);let I=p.response.parse(await O(p.path,m,n));l(t);let v=A(I.installation);if(!v.bound||v.identitySeq!==P)throw new s("INVALID_RESPONSE","Push binding acknowledgement does not match its intent");return u&&d.detachSeq!==null&&P>d.detachSeq&&q(e,h=>({...h,detachSeq:h.detachSeq===d.detachSeq?null:h.detachSeq})),v}async function V(){y();let e=g,t=i?await(c.session?.access()??i):null;if(!t)throw new s("NOT_IDENTIFIED","Identify before reading this installation");let n=S.readPushInstallation,d=n.request.parse(await E("read",{credentialDigest:await D(t)}));l(e);let u=n.response.parse(await O(n.path,d,t));return l(e),A(u.installation)}function T(e=_){let t=L.catch(()=>{}).then(e);return L=t,t.catch(n=>{try{r?.onError?.(n instanceof Error?n:new Error("Push synchronization failed"))}catch{}}),t}async function M(e,t,n){let d=y(),u=t.identity,p=t.observation,m=i?await(c.session?.access()??i):null;if(l(u),p!==f)throw new s("INVALID_STATE","Push observation changed during recovery");if(!m)throw new s("NOT_IDENTIFIED","Identify before recovering a Push address");if(!e.connectionId||!e.kind||!e.token||!["granted","provisional"].includes(e.permission))throw new s("INVALID_REQUEST","Recovery needs a provider token and notification permission");return await T(async()=>{if(l(u),await _(),l(u),p!==f)throw new s("INVALID_STATE","Push observation changed during recovery");let I=q(d,w=>n?w:{...w,addressSeq:N(w.addressSeq)}),h=await E(n?"recovery_confirm":"recovery_request",{...e,sequence:I.addressSeq,credentialDigest:await D(m),...n?{challenge:n}:{}}),k=n?x.parse(h):j.parse(h);if(l(u),p!==f)throw new s("INVALID_STATE","Push observation changed during recovery");let o=await O(`push/installations/recovery/${n?"confirm":"request"}`,k,m);if(l(u),p!==f||q(d,w=>w).addressSeq!==I.addressSeq)throw new s("INVALID_STATE","Push observation changed during recovery");if(n){let w=S.updatePushAddress.response.parse(o),b=A(w.installation);if(!b.bound||b.identitySeq!==P||b.addressSeq!==I.addressSeq||b.connectionId!==e.connectionId||b.addressStatus!=="active")throw new s("INVALID_RESPONSE","Push recovery acknowledgement does not match its intent");return b}if(!o||typeof o!="object"||!("recovery"in o))throw new s("INVALID_RESPONSE","Push recovery acknowledgement is invalid");return R.parse(o.recovery)})}return{recoveryObserver(){y();let e={identity:g,observation:++f};return{async request(t){return R.parse(await M(t,e))},async confirm(t,n){return C.parse(await M(n,e,t))}}},identify(e){if(!r)return;P=q(r,n=>({...n,identitySeq:N(n.identitySeq)})).identitySeq,i=e,g++,f++},reset(){if(r)try{q(r,e=>{let t=N(e.identitySeq);return{...e,identitySeq:t,detachSeq:t}})}finally{i=null,g++,f++}},start(){r&&T()},async sync(){return await T()},read:V,async recover(){let e=y(),t=g,n=P;return f++,await T(async()=>{l(t);let d=await V();return l(t),P=q(e,p=>{if(p.identitySeq!==n)throw new s("IDENTITY_CHANGED","A newer installation intent exists");return{...p,identitySeq:N(Math.max(p.identitySeq,d.identitySeq)),addressSeq:Math.max(p.addressSeq,d.addressSeq)}}).identitySeq,await _()})},tokenObserver(){y();let e=++f,t=g;return async n=>{if(e!==f||t!==g)return null;let d=y(),u=i?await(c.session?.access()??i):null;if(!u)throw new s("NOT_IDENTIFIED","Identify before registering a Push token");if(await T(),l(t),e!==f)return null;let p=q(d,h=>({...h,addressSeq:N(h.addressSeq)})),m=S.updatePushAddress,I=m.request.parse(await E("address",{...n,sequence:p.addressSeq,credentialDigest:await D(u)}));if(l(t),e!==f)return null;let v=m.response.parse(await O(m.path,I,u));return l(t),A(v.installation)}}}}function z(r,c){return{messaging:{async preference(a){let i=S.readMessagingPreference;return i.response.parse(await r(i.path,i.request.parse({channel:a}))).preference},async setPreference(a){let i=S.setMessagingPreference;return i.response.parse(await r(i.path,i.request.parse(a))).preference}},push:{sync:c.sync,read:c.read,recover:c.recover,tokenObserver:c.tokenObserver,recoveryObserver:c.recoveryObserver,async preference(){let a=S.readMessagingPreference;return a.response.parse(await r(a.path,{channel:"push"})).preference},async setPreference(a){let i=S.setMessagingPreference;return i.response.parse(await r(i.path,i.request.parse({...a,channel:"push"}))).preference}}}}export{W as a,z as b};
|