@chatpanel/events 0.447.3 → 0.448.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/entitlement.js +1 -1
- package/package.json +1 -1
package/entitlement.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class S extends Error{constructor(t){super(t),this.name="EntitlementError"}}const m=Object.freeze(["free","pro","team"]),
|
|
1
|
+
class S extends Error{constructor(t){super(t),this.name="EntitlementError"}}const m=Object.freeze(["free","pro","team"]),u=Object.freeze({free:0,pro:1,team:2}),l="https://api.chatpanel.net",C=Object.freeze({verify:`${l}/license/verify`,entitlement:`${l}/entitlement`,claim:`${l}/entitlement/claim`,entitlementChallenge:`${l}/entitlement/challenge`,release:`${l}/entitlement/release`,restore:`${l}/restore`,appStore:`${l}/appstore/transaction`}),h=Object.freeze({kty:"EC",crv:"P-256",x:"CmgKLC4e3xDMvwhbjVqF7jbDe1JhC1KKQi8JN3qVX_4",y:"r40l6fQiyCcJYqW-SvB4VoSyn4F36yhSt82ZAOSo78E"}),O="https://chatpanel.net/#pricing";function _(e="pro",t="",n=""){const r=new URL("https://chatpanel.net/");return t&&r.searchParams.set("install_id",t),e&&r.searchParams.set("plan",e),n&&r.searchParams.set("client",n),r.hash="pricing",r.toString()}const y=Object.freeze({localAgents:"free",byoModels:"free",urlContext:"free",liveMeetings:"free",multiTab:"pro",unlimitedAgents:"pro",customSkills:"pro",customAgents:"pro",advancedAgent:"pro",unlimitedNotes:"pro",unlimitedMeetings:"pro",structuredInsert:"pro",exportChats:"pro",autoBackup:"pro",promptLibrary:"pro",fileAttachments:"pro",watch:"pro",link:"pro",unlimitedPoolAgents:"pro",unlimitedTeams:"pro",unlimitedTeamRuns:"pro",unlimitedProjects:"pro",unlimitedBoardPosts:"pro",fullObservability:"pro",unlimitedRecipes:"pro",unlimitedSkills:"pro",unlimitedWidgets:"pro",unlimitedMcpTools:"pro",cloudSync:"team",sharedLibrary:"team",hostedBridge:"team",sso:"team"}),R=Object.freeze({unlimitedNotes:"Unlimited notes — Free keeps your first 10",unlimitedMeetings:"Unlimited meetings — Free keeps your first 10",multiTab:"Attach several tabs at once",unlimitedAgents:"Unlimited custom agents",customSkills:"Create & edit your own skills",advancedAgent:"Per-agent system prompts & working directories",structuredInsert:"Clean diagrams on Excalidraw, draw.io & tldraw — shapes placed as data, not pixel-drawn",exportChats:"Export conversations as Markdown",autoBackup:"Automatic daily backup of all your data to disk",watch:"Watch a page & act on changes — the agent reacts as the page updates",link:"ChatPanel Link — your phone reaches your computer's agents and models, and both keep the same chats, notes and meetings",unlimitedPoolAgents:"Unlimited agents in your roster — Free keeps 2 of your own",unlimitedTeams:"Unlimited agent teams and runs — Free keeps 1 team, 3 runs a day",unlimitedProjects:"Unlimited projects — Free keeps 1",fullObservability:"The whole run history in Observe — Free sees the last 24 hours",unlimitedRecipes:"Unlimited saved recipes — Free keeps 2",unlimitedSkills:"Unlimited skills — Free uses 3 at a time",unlimitedWidgets:"Unlimited widgets — Free keeps 3",unlimitedMcpTools:"Unlimited MCP tools — Free enables 10"}),U=Object.freeze({cloudSync:"Sync chats across your devices",sharedLibrary:"Shared team agents & skills",hostedBridge:"Hosted agents — no local bridge to run",sso:"SSO & admin controls"}),p=Object.freeze({notes:10,meetings:10,apiEndpoints:1,bridgeAgents:1,customAgents:1,attachmentsPerMessage:1,mcpServers:1,gatewayDestinations:1,webSearchEngines:3,webSearchesPerDay:50,fullRedactions:25,poolAgents:2,teams:1,teamRunsPerDay:3,projects:1,boardPostsPerDay:10,observeDays:1,recipes:2,skills:3,widgets:3,mcpTools:10}),g=Object.freeze({unlimitedAgents:"customAgents",customSkills:"skills",unlimitedPoolAgents:"poolAgents",unlimitedTeams:"teams",unlimitedTeamRuns:"teamRunsPerDay",unlimitedProjects:"projects",unlimitedBoardPosts:"boardPostsPerDay",unlimitedRecipes:"recipes",unlimitedSkills:"skills",unlimitedWidgets:"widgets",unlimitedMcpTools:"mcpTools"});function c(e,t=Date.now()){return!e||!m.includes(e.plan)||e.expiresAt&&t>e.expiresAt?"free":e.plan}function x(e,t=Date.now()){return{free:"Free",pro:"Pro",team:"Team"}[c(e,t)]}function b(e,t=Date.now()){return u[c(e,t)]>=u.pro}function j(e,t=Date.now()){return c(e,t)==="team"}function F(e,t,n=0,r=Date.now()){const i=c(e,r),o=g[t];if(o&&u[i]<u.pro)return n<p[o];const a=y[t]||"free";return u[i]>=u[a]}function M(e){const t=g[e];return t?p[t]:null}function N(e,t=Date.now()){return b(e,t)?0:t-p.observeDays*864e5}function L(e){return y[e]||"free"}function B(e,t,n,r=Date.now()){if(b(e,r))return!0;const i=p[t];return typeof i!="number"||n<i}function d(e){const t="=".repeat((4-String(e).length%4)%4),n=String(e).replace(/-/g,"+").replace(/_/g,"/")+t;if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const r=atob(n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}function A(e){try{return JSON.parse(new TextDecoder().decode(d(e)))}catch{return null}}let f=null;async function E(e){const t=e||globalThis.crypto?.subtle;if(!t)throw new S("no WebCrypto available on this runtime");return e?t.importKey("jwk",h,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]):(f||(f=t.importKey("jwk",h,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])),f)}const T="ent";async function K(e,{typ:t=null,subtle:n=null,now:r=Date.now()}={}){if(!e||typeof e!="string"||e.indexOf(".")<0)return null;const[i,o]=e.split(".");if(!i||!o)return null;let a=!1;try{a=await(n||globalThis.crypto?.subtle).verify({name:"ECDSA",hash:"SHA-256"},await E(n),d(o),new TextEncoder().encode(i))}catch{return null}if(!a)return null;const s=A(i);return!s||t&&s.typ!==t||s.exp&&r>Number(s.exp)?null:s}async function P(e,t,{subtle:n=null,now:r=Date.now()}={}){if(!e||typeof e!="string"||e.indexOf(".")<0)return null;const[i,o]=e.split(".");if(!i||!o)return null;let a=!1;try{a=await(n||globalThis.crypto?.subtle).verify({name:"ECDSA",hash:"SHA-256"},await E(n),d(o),new TextEncoder().encode(i))}catch{return null}if(!a)return null;const s=A(i);return!s||s.typ!==T||s.exp&&r>Number(s.exp)||!s.install_id||t&&s.install_id!==t||!m.includes(s.plan)?null:s}function D(e,{at:t=Date.now(),expiresAt:n=0}={}){return e?{plan:e.plan,trial:!!e.trial,expiresAt:Number(n)||0,tokenExp:Number(e.exp)||0,installId:e.install_id||"",sub:e.sub||null,checkedAt:t,source:"entitlement"}:{plan:"free"}}const v=720*60*1e3;function z(e,{now:t=Date.now(),interval:n=v}={}){if(!e||!e.checkedAt||t-e.checkedAt>n)return!0;const r=1440*60*1e3;return!!(e.expiresAt&&e.expiresAt-t<r||e.tokenExp&&e.tokenExp-t<r)}async function I(e,{installId:t="",token:n="",subtle:r=null,now:i=Date.now()}={}){const o={plan:"free",status:"inactive"};if(!e||typeof e!="object")return o;if(!m.includes(e.plan)||e.plan==="free")return{...e,plan:"free"};const a=await P(n||e.token||"",t,{subtle:r,now:i});return a?{...e,...D(a,{at:e.checkedAt||i,expiresAt:e.expiresAt||0})}:{...o,status:"lapsed",source:e.source||""}}function w(e,t=Date.now()){return!!(e&&e.trial)&&c(e,t)!=="free"}function $(e,t=Date.now()){return w(e,t)?`${x(e,t)} trial`:x(e,t)}function W(e,t=Date.now()){return!w(e,t)||!e.expiresAt?null:Math.max(0,Math.ceil((e.expiresAt-t)/864e5))}export{l as API_BASE,g as COUNTED,C as ENDPOINTS,h as ENTITLEMENT_PUBLIC_JWK,S as EntitlementError,y as FEATURE_TIER,p as FREE_LIMITS,m as PLANS,R as PRO_FEATURES,v as RECHECK_INTERVAL_MS,U as TEAM_FEATURES,T as TOKEN_TYPE,O as UPGRADE_URL,F as can,_ as checkoutUrl,M as freeCap,b as isPro,j as isTeam,w as isTrial,D as licenseFromPayload,z as needsRecheck,N as observeSince,$ as planBadge,x as planLabel,c as planOf,L as tierFor,W as trialDaysLeft,I as trustedLicense,P as verifyEntitlement,K as verifySignedToken,B as withinFreeLimit};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.448.0",
|
|
4
4
|
"description": "The canonical ChatPanel event-log and capability contracts — typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|