@lenserfight/sdk 0.2.0-alpha.9 → 0.3.0-alpha.10

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
@@ -58,4 +58,4 @@ surface.
58
58
 
59
59
  For the deeper walkthrough see the [SDK quickstart](https://docs.lenserfight.com/how-to/integrations/sdk-quickstart) and the [reference docs](https://docs.lenserfight.com/reference/sdk).
60
60
 
61
- Apache-2.0.
61
+ MIT.
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=100;class l{constructor(t){this.rpcClient=t}rpcClient;async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,h)),s={p_search:t.search??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n},{data:i,error:c}=await this.rpcClient.rpc("fn_sdk_browse_agents",s);if(c)throw new Error(`@lenserfight/sdk: fn_sdk_browse_agents failed — ${JSON.stringify(c)}`);return Array.isArray(i)?i:[]}async getById(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_detail",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_detail failed — ${JSON.stringify(e)}`);return r??null}async getLensBindings(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_lens_bindings",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_lens_bindings failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}async getModelBindings(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_model_bindings",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_model_bindings failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}}const u=100;class _{constructor(t){this.rpcClient=t}rpcClient;async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,u)),s={p_search:t.search??null,p_category:t.category??null,p_status:t.status??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n},{data:i,error:c}=await this.rpcClient.rpc("fn_browse_battles",s);if(c)throw new Error(`@lenserfight/sdk: browse failed — ${JSON.stringify(c)}`);return Array.isArray(i)?i:[]}}function d(a){if(!a.url)throw new Error("@lenserfight/sdk: createClient requires `url`");if(!a.anonKey)throw new Error("@lenserfight/sdk: createClient requires `anonKey`");const t=a.fetch??globalThis.fetch;if(typeof t!="function")throw new Error("@lenserfight/sdk: global fetch unavailable — pass `fetch` in options");const r=a.url.replace(/\/+$/,"");return{async rpc(e,n){const s=await t(`${r}/rest/v1/rpc/${e}`,{method:"POST",headers:{apikey:a.anonKey,authorization:`Bearer ${a.anonKey}`,"content-type":"application/json"},body:JSON.stringify(n??{})});if(!s.ok){const c=await s.text().catch(()=>"");return{data:null,error:{status:s.status,message:c||s.statusText}}}return{data:await s.json().catch(()=>null),error:null}}}}const w=100;class p{constructor(t){this.rpcClient=t}rpcClient;async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,w)),{data:s,error:i}=await this.rpcClient.rpc("fn_sdk_browse_lenses",{p_search:t.search??null,p_tag:t.tag??null,p_kind:t.kind??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n});if(i)throw new Error(`@lenserfight/sdk: fn_sdk_browse_lenses failed — ${JSON.stringify(i)}`);return Array.isArray(s)?s:[]}async search(t,r={},e,n=20){return this.browse({...r,search:t},e,n)}async getById(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_get_lens_detail_bootstrap",{p_lens_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_get_lens_detail_bootstrap failed — ${JSON.stringify(e)}`);return!r||r.error?null:r}async getVersion(t){const[r,e]=await Promise.all([this.rpcClient.rpc("fn_get_lens_version_detail",{p_version_id:t}),this.rpcClient.rpc("fn_get_lens_version_parameters",{p_version_id:t})]);if(r.error)throw new Error(`@lenserfight/sdk: fn_get_lens_version_detail failed — ${JSON.stringify(r.error)}`);if(!r.data)return null;const n=Array.isArray(r.data)?r.data[0]:r.data;return n?{...n,parameters:Array.isArray(e.data)?e.data:e.data??[]}:null}async getParameterContracts(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_get_version_contracts",{p_version_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_get_version_contracts failed — ${JSON.stringify(e)}`);if(!r)return[];const n=Array.isArray(r)?r[0]:r;if(!n)return[];const s=n.input_contract;if(!s)return[];const i=s.parameters??s.inputs;return Array.isArray(i)?i:[]}}class f{constructor(t){this.rpcClient=t}rpcClient;async getContractByVersion(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_contract",{p_version_id:t,p_content_hash:null});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);return r??null}async getContractByHash(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_contract",{p_version_id:null,p_content_hash:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);return r??null}async getManifest(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_manifest",{p_version_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_manifest failed — ${JSON.stringify(e)}`);return r??null}async getDependencies(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_dependencies",{p_content_hash:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_dependencies failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}async checkCompatibility(t,r){const e=await this.getContractByHash(t);if(!e)return{compatible:!1,missingScopes:[],warnings:["Contract not found"]};const n=e.body.requiredScopes??[],s=r.filter(i=>!n.includes(i));return{compatible:s.length===0,missingScopes:s,warnings:[]}}}class g{constructor(t){this.rpcClient=t}rpcClient;async renderPrompt(t,r={}){const{data:e,error:n}=await this.rpcClient.rpc("fn_battles_render_prompt",{p_template_id:t,p_variables:r});if(n)throw new Error(`@lenserfight/sdk: renderPrompt failed — ${JSON.stringify(n)}`);return typeof e=="string"?e:""}}class o{battles;templates;lenses;agents;protocols;rpc;constructor(t){this.rpc=t,this.battles=new _(t),this.templates=new g(t),this.lenses=new p(t),this.agents=new l(t),this.protocols=new f(t)}async rpcCall(t,r){const{data:e,error:n}=await this.rpc.rpc(t,r);if(n)throw new Error(`@lenserfight/sdk: ${t} failed — ${JSON.stringify(n)}`);return e}}function y(a){const t=d(a);return new o(t)}function C(a){return new o(a)}const m="0.2.0-alpha.1";exports.AgentClient=l;exports.BattleClient=_;exports.LensClient=p;exports.LenserFightClient=o;exports.ProtocolClient=f;exports.SDK_VERSION=m;exports.TemplateClient=g;exports.createClient=y;exports.createClientFromRpc=C;exports.createFetchRpcClient=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=100;class C{constructor(t){this.rpcClient=t}async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,k)),i={p_search:t.search??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n},{data:s,error:o}=await this.rpcClient.rpc("fn_sdk_browse_agents",i);if(o)throw new Error(`@lenserfight/sdk: fn_sdk_browse_agents failed — ${JSON.stringify(o)}`);return Array.isArray(s)?s:[]}async getById(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_detail",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_detail failed — ${JSON.stringify(e)}`);return r??null}async getLensBindings(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_lens_bindings",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_lens_bindings failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}async getModelBindings(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_agent_model_bindings",{p_agent_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_agent_model_bindings failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}}const b=100;class u{constructor(t){this.rpcClient=t}async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,b)),i={p_search:t.search??null,p_category:t.category??null,p_status:t.status??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n},{data:s,error:o}=await this.rpcClient.rpc("fn_browse_battles",i);if(o)throw new Error(`@lenserfight/sdk: browse failed — ${JSON.stringify(o)}`);return Array.isArray(s)?s:[]}}function w(a){if(!a.url)throw new Error("@lenserfight/sdk: createClient requires `url`");if(!a.anonKey)throw new Error("@lenserfight/sdk: createClient requires `anonKey`");const t=a.fetch??globalThis.fetch;if(typeof t!="function")throw new Error("@lenserfight/sdk: global fetch unavailable — pass `fetch` in options");const r=a.url.replace(/\/+$/,""),e=a.apiKey??a.anonKey;return{async rpc(n,i){const s=await t(`${r}/rest/v1/rpc/${n}`,{method:"POST",headers:{apikey:a.anonKey,authorization:`Bearer ${e}`,"content-type":"application/json"},body:JSON.stringify(i??{})});if(!s.ok){const c=await s.text().catch(()=>"");return{data:null,error:{status:s.status,message:c||s.statusText}}}return{data:await s.json().catch(()=>null),error:null}}}}const S=100;class h{constructor(t){this.rpcClient=t}async browse(t={},r,e=20){const n=Math.max(1,Math.min(e,S)),{data:i,error:s}=await this.rpcClient.rpc("fn_sdk_browse_lenses",{p_search:t.search??null,p_tag:t.tag??null,p_kind:t.kind??null,p_cursor_created_at:r?.created_at??null,p_cursor_id:r?.id??null,p_limit:n});if(s)throw new Error(`@lenserfight/sdk: fn_sdk_browse_lenses failed — ${JSON.stringify(s)}`);return Array.isArray(i)?i:[]}async search(t,r={},e,n=20){return this.browse({...r,search:t},e,n)}async getById(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_get_lens_detail_bootstrap",{p_lens_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_get_lens_detail_bootstrap failed — ${JSON.stringify(e)}`);return!r||r.error?null:r}async getVersion(t){const[r,e]=await Promise.all([this.rpcClient.rpc("fn_get_lens_version_detail",{p_version_id:t}),this.rpcClient.rpc("fn_get_lens_version_parameters",{p_version_id:t})]);if(r.error)throw new Error(`@lenserfight/sdk: fn_get_lens_version_detail failed — ${JSON.stringify(r.error)}`);if(!r.data)return null;const n=Array.isArray(r.data)?r.data[0]:r.data;return n?{...n,parameters:Array.isArray(e.data)?e.data:e.data??[]}:null}async resolveTemplate(t,r,e){const{data:n,error:i}=await this.rpcClient.rpc("fn_mcp_lens_resolve_template",{p_lens_id:t,p_version_id:e?.versionId??null});if(i)throw new Error(`@lenserfight/sdk: fn_mcp_lens_resolve_template failed — ${JSON.stringify(i)}`);if(!n)throw new Error(`@lenserfight/sdk: lens ${t} not found`);const s=n;let o=s.template_body;const c=[],d=[];for(const l of s.parameters??[]){const f=`[[:${l.id}]]`,p=r[l.label]??r[l.label.toLowerCase()]??Object.entries(r).find(([m])=>m.toLowerCase()===l.label.toLowerCase())?.[1];p!==void 0?(o=o.split(f).join(p),d.push(l.label)):l.optional?o=o.split(f).join(""):c.push(l.label)}return{resolvedPrompt:o,lensId:s.lens_id,versionId:s.version_id,lensTitle:s.title??t,lensDescription:s.description??null,paramsUsed:d,missing:c}}async getParameterContracts(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_get_version_contracts",{p_version_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_get_version_contracts failed — ${JSON.stringify(e)}`);if(!r)return[];const n=Array.isArray(r)?r[0]:r;if(!n)return[];const i=n.input_contract;if(!i)return[];const s=i.parameters??i.inputs;return Array.isArray(s)?s:[]}}class E{constructor(t){this.rpcClient=t}async getContractByVersion(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_contract",{p_version_id:t,p_content_hash:null});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);return r??null}async getContractByHash(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_contract",{p_version_id:null,p_content_hash:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);return r??null}async getManifest(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_manifest",{p_version_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_manifest failed — ${JSON.stringify(e)}`);return r??null}async getDependencies(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_sdk_get_dependencies",{p_content_hash:t});if(e)throw new Error(`@lenserfight/sdk: fn_sdk_get_dependencies failed — ${JSON.stringify(e)}`);return Array.isArray(r)?r:[]}async checkCompatibility(t,r){const e=await this.getContractByHash(t);if(!e)return{compatible:!1,missingScopes:[],warnings:["Contract not found"]};const n=e.body.requiredScopes??[],i=r.filter(s=>!n.includes(s));return{compatible:i.length===0,missingScopes:i,warnings:[]}}}class g{constructor(t){this.rpcClient=t}async renderPrompt(t,r={}){const{data:e,error:n}=await this.rpcClient.rpc("fn_battles_render_prompt",{p_template_id:t,p_variables:r});if(n)throw new Error(`@lenserfight/sdk: renderPrompt failed — ${JSON.stringify(n)}`);return typeof e=="string"?e:""}}const $=new Set(["completed","failed","cancelled"]),A=3e3,v=12e4;class y{constructor(t){this.rpcClient=t}async browse(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_mcp_workflow_list",{p_limit:t?.limit??20,p_offset:t?.offset??0,p_visibility:t?.visibility??null,p_lenser_id:null});if(e)throw new Error(`@lenserfight/sdk: fn_mcp_workflow_list failed — ${JSON.stringify(e)}`);const n=r?.data;return Array.isArray(n)?n:[]}async getById(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_mcp_workflow_get",{p_workflow_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_mcp_workflow_get failed — ${JSON.stringify(e)}`);return r??null}async startRun(t,r,e){const{data:n,error:i}=await this.rpcClient.rpc("fn_mcp_workflow_run_start",{p_workflow_id:t,p_inputs:r??{},p_global_model_id:e?.modelId??null,p_idempotency_key:e?.idempotencyKey??null,p_metadata:{}});if(i)throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_start failed — ${JSON.stringify(i)}`);if(!n)throw new Error(`@lenserfight/sdk: workflow ${t} not found or inaccessible`);return n}async getRunStatus(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_mcp_workflow_run_status",{p_run_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_status failed — ${JSON.stringify(e)}`);if(!r)throw new Error(`@lenserfight/sdk: run ${t} not found`);const n=r;return{id:n.id,status:n.status,activeNodeId:n.active_node_id??null,creditsSpent:n.credits_spent??0}}async getRunLogs(t){const{data:r,error:e}=await this.rpcClient.rpc("fn_mcp_workflow_run_logs",{p_run_id:t});if(e)throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_logs failed — ${JSON.stringify(e)}`);const n=r?.node_results;return Array.isArray(n)?n.map(i=>{const s=i;return{nodeId:s.node_id,status:s.status,result:s.result??null,error:s.error??null,durationMs:s.duration_ms??0,tokenCount:s.token_count??0}}):[]}async awaitRun(t,r,e){const n=e?.timeoutMs??v,i=await this.startRun(t,r,e),s=Date.now()+n;for(;Date.now()<s;){await new Promise(c=>setTimeout(c,A));const o=await this.getRunStatus(i.id);if($.has(o.status)){if(o.status==="completed")return this.getRunLogs(i.id);throw new Error(`@lenserfight/sdk: workflow run ${i.id} ended with status "${o.status}"`)}}throw new Error(`@lenserfight/sdk: workflow run ${i.id} timed out after ${n}ms`)}}class _{agents;battles;lenses;protocols;templates;workflows;rpc;constructor(t){this.rpc=t,this.agents=new C(t),this.battles=new u(t),this.lenses=new h(t),this.protocols=new E(t),this.templates=new g(t),this.workflows=new y(t)}async rpcCall(t,r){const{data:e,error:n}=await this.rpc.rpc(t,r);if(n)throw new Error(`@lenserfight/sdk: ${t} failed — ${JSON.stringify(n)}`);return e}}function O(a){const t=w(a);return new _(t)}function N(a){return new _(a)}const J="0.3.0-alpha.0";exports.BattleClient=u;exports.LensClient=h;exports.LenserFightClient=_;exports.SDK_VERSION=J;exports.TemplateClient=g;exports.WorkflowClient=y;exports.createClient=O;exports.createClientFromRpc=N;exports.createFetchRpcClient=w;
package/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  export { createClient, createClientFromRpc, LenserFightClient } from './lib/lenserfight-client';
2
2
  export { BattleClient } from './lib/battle-client';
3
- export { TemplateClient } from './lib/template-client';
4
3
  export { LensClient } from './lib/lens-client';
5
- export { AgentClient } from './lib/agent-client';
6
- export { ProtocolClient } from './lib/protocol-client';
4
+ export { TemplateClient } from './lib/template-client';
5
+ export { WorkflowClient } from './lib/workflow-client';
7
6
  export { createFetchRpcClient } from './lib/client';
8
7
  export type { SupabaseLikeRpcClient } from './lib/client';
9
8
  export type { BattleLifecycleStatus, BrowseFilters, BrowseCursor, BrowseBattle, BattleTemplate, CreateClientOptions, } from './lib/types';
10
- export type { SdkLensKind, SdkVisibility, SdkContentStatus, SdkLensAuthor, SdkLensTag, SdkLensSummary, SdkLensDetail, SdkLensVersionSummary, SdkLensVersion, SdkLensParameter, SdkParameterTool, LensBrowseFilters, } from './lib/types/lenses';
11
- export type { SdkAgentRuntimePref, SdkAgentModelBindingMode, SdkAgentSummary, SdkAgentDetail, SdkAgentCapabilities, SdkAgentStats, SdkAgentOwner, SdkAgentLensBinding, SdkAgentModelBinding, AgentBrowseFilters, } from './lib/types/agents';
12
- export type { SdkContractKind, SdkChannel, SdkSignatureAlgorithm, SdkParameterClassification, SdkParameterKind, SdkParameterScope, SdkDependencyBinding, SdkParameterDefault, SdkParameterValidation, SdkParameterContract, SdkOutputDefinition, SdkDependencyReference, SdkLensContractBody, SdkLensContract, SdkContractSignature, SdkLensManifest, SdkDependencyEdge, SdkCompatibilityResult, } from './lib/types/protocols';
13
- export declare const SDK_VERSION = "0.2.0-alpha.1";
9
+ export type { LensBrowseFilters, SdkLensDetail, SdkLensKind, SdkLensParameter, SdkLensSummary, SdkLensVersion, SdkLensVersionSummary, SdkParameterTool, SdkResolvedTemplate, SdkVisibility, SdkContentStatus, } from './lib/types/lenses';
10
+ export type { SdkWorkflowDetail, SdkWorkflowRun, SdkWorkflowRunLog, SdkWorkflowRunState, SdkWorkflowRunStatus, SdkWorkflowSummary, } from './lib/types/workflows';
11
+ export declare const SDK_VERSION = "0.3.0-alpha.0";
package/index.mjs CHANGED
@@ -1,69 +1,67 @@
1
- class l {
2
- constructor(r) {
3
- this.rpcClient = r;
1
+ class u {
2
+ constructor(t) {
3
+ this.rpcClient = t;
4
4
  }
5
- rpcClient;
6
5
  /**
7
6
  * Browse public AI agents. Only agents with `is_public_policy = true` are visible.
8
7
  * Keyset pagination on (created_at DESC, id DESC).
9
8
  */
10
- async browse(r = {}, t, e = 20) {
11
- const n = Math.max(1, Math.min(e, 100)), s = {
12
- p_search: r.search ?? null,
13
- p_cursor_created_at: t?.created_at ?? null,
14
- p_cursor_id: t?.id ?? null,
9
+ async browse(t = {}, r, e = 20) {
10
+ const n = Math.max(1, Math.min(e, 100)), i = {
11
+ p_search: t.search ?? null,
12
+ p_cursor_created_at: r?.created_at ?? null,
13
+ p_cursor_id: r?.id ?? null,
15
14
  p_limit: n
16
- }, { data: i, error: c } = await this.rpcClient.rpc("fn_sdk_browse_agents", s);
17
- if (c)
18
- throw new Error(`@lenserfight/sdk: fn_sdk_browse_agents failed — ${JSON.stringify(c)}`);
19
- return Array.isArray(i) ? i : [];
15
+ }, { data: s, error: o } = await this.rpcClient.rpc("fn_sdk_browse_agents", i);
16
+ if (o)
17
+ throw new Error(`@lenserfight/sdk: fn_sdk_browse_agents failed — ${JSON.stringify(o)}`);
18
+ return Array.isArray(s) ? s : [];
20
19
  }
21
20
  /**
22
21
  * Get public agent profile detail. Returns null for non-public or non-existent agents.
23
22
  */
24
- async getById(r) {
25
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_detail", {
26
- p_agent_id: r
23
+ async getById(t) {
24
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_detail", {
25
+ p_agent_id: t
27
26
  });
28
27
  if (e)
29
28
  throw new Error(
30
29
  `@lenserfight/sdk: fn_sdk_get_agent_detail failed — ${JSON.stringify(e)}`
31
30
  );
32
- return t ?? null;
31
+ return r ?? null;
33
32
  }
34
33
  /**
35
34
  * Get lens bindings for a public agent.
36
35
  */
37
- async getLensBindings(r) {
38
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_lens_bindings", {
39
- p_agent_id: r
36
+ async getLensBindings(t) {
37
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_lens_bindings", {
38
+ p_agent_id: t
40
39
  });
41
40
  if (e)
42
41
  throw new Error(
43
42
  `@lenserfight/sdk: fn_sdk_get_agent_lens_bindings failed — ${JSON.stringify(e)}`
44
43
  );
45
- return Array.isArray(t) ? t : [];
44
+ return Array.isArray(r) ? r : [];
46
45
  }
47
46
  /**
48
47
  * Get model bindings for a public agent.
49
48
  */
50
- async getModelBindings(r) {
51
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_model_bindings", {
52
- p_agent_id: r
49
+ async getModelBindings(t) {
50
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_agent_model_bindings", {
51
+ p_agent_id: t
53
52
  });
54
53
  if (e)
55
54
  throw new Error(
56
55
  `@lenserfight/sdk: fn_sdk_get_agent_model_bindings failed — ${JSON.stringify(e)}`
57
56
  );
58
- return Array.isArray(t) ? t : [];
57
+ return Array.isArray(r) ? r : [];
59
58
  }
60
59
  }
61
- const _ = 100;
62
- class d {
63
- constructor(r) {
64
- this.rpcClient = r;
60
+ const h = 100;
61
+ class g {
62
+ constructor(t) {
63
+ this.rpcClient = t;
65
64
  }
66
- rpcClient;
67
65
  /**
68
66
  * Browse public battles. Calls `public.fn_browse_battles` (SECURITY DEFINER,
69
67
  * grants EXECUTE to anon + authenticated). Returns at most 100 rows per call
@@ -71,41 +69,41 @@ class d {
71
69
  *
72
70
  * For deeper paging, pass the last row's `{created_at, id}` as `cursor`.
73
71
  */
74
- async browse(r = {}, t, e = 20) {
75
- const n = Math.max(1, Math.min(e, _)), s = {
76
- p_search: r.search ?? null,
77
- p_category: r.category ?? null,
78
- p_status: r.status ?? null,
79
- p_cursor_created_at: t?.created_at ?? null,
80
- p_cursor_id: t?.id ?? null,
72
+ async browse(t = {}, r, e = 20) {
73
+ const n = Math.max(1, Math.min(e, h)), i = {
74
+ p_search: t.search ?? null,
75
+ p_category: t.category ?? null,
76
+ p_status: t.status ?? null,
77
+ p_cursor_created_at: r?.created_at ?? null,
78
+ p_cursor_id: r?.id ?? null,
81
79
  p_limit: n
82
- }, { data: i, error: c } = await this.rpcClient.rpc("fn_browse_battles", s);
83
- if (c)
80
+ }, { data: s, error: o } = await this.rpcClient.rpc("fn_browse_battles", i);
81
+ if (o)
84
82
  throw new Error(
85
- `@lenserfight/sdk: browse failed — ${JSON.stringify(c)}`
83
+ `@lenserfight/sdk: browse failed — ${JSON.stringify(o)}`
86
84
  );
87
- return Array.isArray(i) ? i : [];
85
+ return Array.isArray(s) ? s : [];
88
86
  }
89
87
  }
90
- function p(a) {
88
+ function y(a) {
91
89
  if (!a.url)
92
90
  throw new Error("@lenserfight/sdk: createClient requires `url`");
93
91
  if (!a.anonKey)
94
92
  throw new Error("@lenserfight/sdk: createClient requires `anonKey`");
95
- const r = a.fetch ?? globalThis.fetch;
96
- if (typeof r != "function")
93
+ const t = a.fetch ?? globalThis.fetch;
94
+ if (typeof t != "function")
97
95
  throw new Error("@lenserfight/sdk: global fetch unavailable — pass `fetch` in options");
98
- const t = a.url.replace(/\/+$/, "");
96
+ const r = a.url.replace(/\/+$/, ""), e = a.apiKey ?? a.anonKey;
99
97
  return {
100
- async rpc(e, n) {
101
- const s = await r(`${t}/rest/v1/rpc/${e}`, {
98
+ async rpc(n, i) {
99
+ const s = await t(`${r}/rest/v1/rpc/${n}`, {
102
100
  method: "POST",
103
101
  headers: {
104
102
  apikey: a.anonKey,
105
- authorization: `Bearer ${a.anonKey}`,
103
+ authorization: `Bearer ${e}`,
106
104
  "content-type": "application/json"
107
105
  },
108
- body: JSON.stringify(n ?? {})
106
+ body: JSON.stringify(i ?? {})
109
107
  });
110
108
  if (!s.ok) {
111
109
  const c = await s.text().catch(() => "");
@@ -118,162 +116,198 @@ function p(a) {
118
116
  }
119
117
  };
120
118
  }
121
- const f = 100;
122
- class h {
123
- constructor(r) {
124
- this.rpcClient = r;
119
+ const m = 100;
120
+ class k {
121
+ constructor(t) {
122
+ this.rpcClient = t;
125
123
  }
126
- rpcClient;
127
124
  /**
128
125
  * Browse public lenses. Keyset pagination on (created_at DESC, id DESC).
129
126
  */
130
- async browse(r = {}, t, e = 20) {
131
- const n = Math.max(1, Math.min(e, f)), { data: s, error: i } = await this.rpcClient.rpc("fn_sdk_browse_lenses", {
132
- p_search: r.search ?? null,
133
- p_tag: r.tag ?? null,
134
- p_kind: r.kind ?? null,
135
- p_cursor_created_at: t?.created_at ?? null,
136
- p_cursor_id: t?.id ?? null,
127
+ async browse(t = {}, r, e = 20) {
128
+ const n = Math.max(1, Math.min(e, m)), { data: i, error: s } = await this.rpcClient.rpc("fn_sdk_browse_lenses", {
129
+ p_search: t.search ?? null,
130
+ p_tag: t.tag ?? null,
131
+ p_kind: t.kind ?? null,
132
+ p_cursor_created_at: r?.created_at ?? null,
133
+ p_cursor_id: r?.id ?? null,
137
134
  p_limit: n
138
135
  });
139
- if (i)
140
- throw new Error(`@lenserfight/sdk: fn_sdk_browse_lenses failed — ${JSON.stringify(i)}`);
141
- return Array.isArray(s) ? s : [];
136
+ if (s)
137
+ throw new Error(`@lenserfight/sdk: fn_sdk_browse_lenses failed — ${JSON.stringify(s)}`);
138
+ return Array.isArray(i) ? i : [];
142
139
  }
143
140
  /**
144
141
  * Full-text search across public lenses.
145
142
  */
146
- async search(r, t = {}, e, n = 20) {
147
- return this.browse({ ...t, search: r }, e, n);
143
+ async search(t, r = {}, e, n = 20) {
144
+ return this.browse({ ...r, search: t }, e, n);
148
145
  }
149
146
  /**
150
147
  * Get full lens detail. Reuses existing `fn_get_lens_detail_bootstrap`.
151
148
  */
152
- async getById(r) {
153
- const { data: t, error: e } = await this.rpcClient.rpc("fn_get_lens_detail_bootstrap", {
154
- p_lens_id: r
149
+ async getById(t) {
150
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_get_lens_detail_bootstrap", {
151
+ p_lens_id: t
155
152
  });
156
153
  if (e)
157
154
  throw new Error(`@lenserfight/sdk: fn_get_lens_detail_bootstrap failed — ${JSON.stringify(e)}`);
158
- return !t || t.error ? null : t;
155
+ return !r || r.error ? null : r;
159
156
  }
160
157
  /**
161
158
  * Get a specific version with parameters. Combines existing RPCs:
162
159
  * `fn_get_lens_version_detail` + `fn_get_lens_version_parameters`.
163
160
  */
164
- async getVersion(r) {
165
- const [t, e] = await Promise.all([
166
- this.rpcClient.rpc("fn_get_lens_version_detail", { p_version_id: r }),
167
- this.rpcClient.rpc("fn_get_lens_version_parameters", { p_version_id: r })
161
+ async getVersion(t) {
162
+ const [r, e] = await Promise.all([
163
+ this.rpcClient.rpc("fn_get_lens_version_detail", { p_version_id: t }),
164
+ this.rpcClient.rpc("fn_get_lens_version_parameters", { p_version_id: t })
168
165
  ]);
169
- if (t.error)
170
- throw new Error(`@lenserfight/sdk: fn_get_lens_version_detail failed — ${JSON.stringify(t.error)}`);
171
- if (!t.data) return null;
172
- const n = Array.isArray(t.data) ? t.data[0] : t.data;
166
+ if (r.error)
167
+ throw new Error(`@lenserfight/sdk: fn_get_lens_version_detail failed — ${JSON.stringify(r.error)}`);
168
+ if (!r.data) return null;
169
+ const n = Array.isArray(r.data) ? r.data[0] : r.data;
173
170
  return n ? {
174
171
  ...n,
175
172
  parameters: Array.isArray(e.data) ? e.data : e.data ?? []
176
173
  } : null;
177
174
  }
175
+ /**
176
+ * Resolve a lens template by substituting `[[:paramId]]` tokens with the
177
+ * supplied values (matched by parameter label, case-insensitive). Returns the
178
+ * filled prompt and lists which parameters were used or missing.
179
+ *
180
+ * Requires an authenticated client (`apiKey` in `createClient`).
181
+ *
182
+ * @example
183
+ * const result = await lf.lenses.resolveTemplate(lensId, { Topic: 'TypeScript' });
184
+ * if (result.missing.length === 0) {
185
+ * // pass result.resolvedPrompt to your AI model
186
+ * }
187
+ */
188
+ async resolveTemplate(t, r, e) {
189
+ const { data: n, error: i } = await this.rpcClient.rpc("fn_mcp_lens_resolve_template", {
190
+ p_lens_id: t,
191
+ p_version_id: e?.versionId ?? null
192
+ });
193
+ if (i)
194
+ throw new Error(`@lenserfight/sdk: fn_mcp_lens_resolve_template failed — ${JSON.stringify(i)}`);
195
+ if (!n)
196
+ throw new Error(`@lenserfight/sdk: lens ${t} not found`);
197
+ const s = n;
198
+ let o = s.template_body;
199
+ const c = [], _ = [];
200
+ for (const l of s.parameters ?? []) {
201
+ const d = `[[:${l.id}]]`, f = r[l.label] ?? r[l.label.toLowerCase()] ?? Object.entries(r).find(([w]) => w.toLowerCase() === l.label.toLowerCase())?.[1];
202
+ f !== void 0 ? (o = o.split(d).join(f), _.push(l.label)) : l.optional ? o = o.split(d).join("") : c.push(l.label);
203
+ }
204
+ return {
205
+ resolvedPrompt: o,
206
+ lensId: s.lens_id,
207
+ versionId: s.version_id,
208
+ lensTitle: s.title ?? t,
209
+ lensDescription: s.description ?? null,
210
+ paramsUsed: _,
211
+ missing: c
212
+ };
213
+ }
178
214
  /**
179
215
  * Get parameter contracts for a version via `fn_get_version_contracts`.
180
216
  * Returns the input_contract's parameter array if present.
181
217
  */
182
- async getParameterContracts(r) {
183
- const { data: t, error: e } = await this.rpcClient.rpc("fn_get_version_contracts", {
184
- p_version_id: r
218
+ async getParameterContracts(t) {
219
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_get_version_contracts", {
220
+ p_version_id: t
185
221
  });
186
222
  if (e)
187
223
  throw new Error(`@lenserfight/sdk: fn_get_version_contracts failed — ${JSON.stringify(e)}`);
188
- if (!t) return [];
189
- const n = Array.isArray(t) ? t[0] : t;
224
+ if (!r) return [];
225
+ const n = Array.isArray(r) ? r[0] : r;
190
226
  if (!n) return [];
191
- const s = n.input_contract;
192
- if (!s) return [];
193
- const i = s.parameters ?? s.inputs;
194
- return Array.isArray(i) ? i : [];
227
+ const i = n.input_contract;
228
+ if (!i) return [];
229
+ const s = i.parameters ?? i.inputs;
230
+ return Array.isArray(s) ? s : [];
195
231
  }
196
232
  }
197
- class g {
198
- constructor(r) {
199
- this.rpcClient = r;
233
+ class C {
234
+ constructor(t) {
235
+ this.rpcClient = t;
200
236
  }
201
- rpcClient;
202
237
  /**
203
238
  * Get the contract for a lens version (by version_id).
204
239
  * Uses `fn_sdk_get_contract(p_version_id)`.
205
240
  */
206
- async getContractByVersion(r) {
207
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_contract", {
208
- p_version_id: r,
241
+ async getContractByVersion(t) {
242
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_contract", {
243
+ p_version_id: t,
209
244
  p_content_hash: null
210
245
  });
211
246
  if (e)
212
247
  throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);
213
- return t ?? null;
248
+ return r ?? null;
214
249
  }
215
250
  /**
216
251
  * Get a contract by its content hash (hex-encoded SHA-256).
217
252
  * Uses `fn_sdk_get_contract(p_content_hash)`.
218
253
  */
219
- async getContractByHash(r) {
220
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_contract", {
254
+ async getContractByHash(t) {
255
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_contract", {
221
256
  p_version_id: null,
222
- p_content_hash: r
257
+ p_content_hash: t
223
258
  });
224
259
  if (e)
225
260
  throw new Error(`@lenserfight/sdk: fn_sdk_get_contract failed — ${JSON.stringify(e)}`);
226
- return t ?? null;
261
+ return r ?? null;
227
262
  }
228
263
  /**
229
264
  * Get the full manifest (contract + channel + signatures) for a version.
230
265
  */
231
- async getManifest(r) {
232
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_manifest", {
233
- p_version_id: r
266
+ async getManifest(t) {
267
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_manifest", {
268
+ p_version_id: t
234
269
  });
235
270
  if (e)
236
271
  throw new Error(`@lenserfight/sdk: fn_sdk_get_manifest failed — ${JSON.stringify(e)}`);
237
- return t ?? null;
272
+ return r ?? null;
238
273
  }
239
274
  /**
240
275
  * Get dependency edges for a contract (its children in the DAG).
241
276
  */
242
- async getDependencies(r) {
243
- const { data: t, error: e } = await this.rpcClient.rpc("fn_sdk_get_dependencies", {
244
- p_content_hash: r
277
+ async getDependencies(t) {
278
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_sdk_get_dependencies", {
279
+ p_content_hash: t
245
280
  });
246
281
  if (e)
247
282
  throw new Error(`@lenserfight/sdk: fn_sdk_get_dependencies failed — ${JSON.stringify(e)}`);
248
- return Array.isArray(t) ? t : [];
283
+ return Array.isArray(r) ? r : [];
249
284
  }
250
285
  /**
251
286
  * Check if a contract satisfies required scopes. Pure client-side logic —
252
287
  * fetches the contract and compares scopes locally.
253
288
  */
254
- async checkCompatibility(r, t) {
255
- const e = await this.getContractByHash(r);
289
+ async checkCompatibility(t, r) {
290
+ const e = await this.getContractByHash(t);
256
291
  if (!e)
257
292
  return { compatible: !1, missingScopes: [], warnings: ["Contract not found"] };
258
- const n = e.body.requiredScopes ?? [], s = t.filter((i) => !n.includes(i));
259
- return { compatible: s.length === 0, missingScopes: s, warnings: [] };
293
+ const n = e.body.requiredScopes ?? [], i = r.filter((s) => !n.includes(s));
294
+ return { compatible: i.length === 0, missingScopes: i, warnings: [] };
260
295
  }
261
296
  }
262
- class u {
263
- constructor(r) {
264
- this.rpcClient = r;
297
+ class b {
298
+ constructor(t) {
299
+ this.rpcClient = t;
265
300
  }
266
- rpcClient;
267
301
  /**
268
302
  * Render a template's task_prompt with the supplied variable values.
269
303
  * Calls `public.fn_battles_render_prompt` (SECURITY DEFINER, EXEC granted
270
304
  * to anon + authenticated). Required variables that are missing raise
271
305
  * 22023 — the SDK surfaces the server error verbatim.
272
306
  */
273
- async renderPrompt(r, t = {}) {
307
+ async renderPrompt(t, r = {}) {
274
308
  const { data: e, error: n } = await this.rpcClient.rpc("fn_battles_render_prompt", {
275
- p_template_id: r,
276
- p_variables: t
309
+ p_template_id: t,
310
+ p_variables: r
277
311
  });
278
312
  if (n)
279
313
  throw new Error(
@@ -282,45 +316,159 @@ class u {
282
316
  return typeof e == "string" ? e : "";
283
317
  }
284
318
  }
285
- class o {
319
+ const S = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]), $ = 3e3, E = 12e4;
320
+ class A {
321
+ constructor(t) {
322
+ this.rpcClient = t;
323
+ }
324
+ /**
325
+ * List workflows visible to the authenticated user.
326
+ */
327
+ async browse(t) {
328
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_mcp_workflow_list", {
329
+ p_limit: t?.limit ?? 20,
330
+ p_offset: t?.offset ?? 0,
331
+ p_visibility: t?.visibility ?? null,
332
+ p_lenser_id: null
333
+ });
334
+ if (e)
335
+ throw new Error(`@lenserfight/sdk: fn_mcp_workflow_list failed — ${JSON.stringify(e)}`);
336
+ const n = r?.data;
337
+ return Array.isArray(n) ? n : [];
338
+ }
339
+ /**
340
+ * Get a single workflow by ID.
341
+ */
342
+ async getById(t) {
343
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_mcp_workflow_get", {
344
+ p_workflow_id: t
345
+ });
346
+ if (e)
347
+ throw new Error(`@lenserfight/sdk: fn_mcp_workflow_get failed — ${JSON.stringify(e)}`);
348
+ return r ?? null;
349
+ }
350
+ /**
351
+ * Start a workflow run. Returns immediately with a run ID and `pending` status.
352
+ * The workflow executes asynchronously — use `getRunStatus` to poll or
353
+ * `awaitRun` to block until completion.
354
+ *
355
+ * Requires an authenticated client (`apiKey` in `createClient`).
356
+ */
357
+ async startRun(t, r, e) {
358
+ const { data: n, error: i } = await this.rpcClient.rpc("fn_mcp_workflow_run_start", {
359
+ p_workflow_id: t,
360
+ p_inputs: r ?? {},
361
+ p_global_model_id: e?.modelId ?? null,
362
+ p_idempotency_key: e?.idempotencyKey ?? null,
363
+ p_metadata: {}
364
+ });
365
+ if (i)
366
+ throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_start failed — ${JSON.stringify(i)}`);
367
+ if (!n)
368
+ throw new Error(`@lenserfight/sdk: workflow ${t} not found or inaccessible`);
369
+ return n;
370
+ }
371
+ /**
372
+ * Get the current status of a workflow run.
373
+ */
374
+ async getRunStatus(t) {
375
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_mcp_workflow_run_status", {
376
+ p_run_id: t
377
+ });
378
+ if (e)
379
+ throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_status failed — ${JSON.stringify(e)}`);
380
+ if (!r)
381
+ throw new Error(`@lenserfight/sdk: run ${t} not found`);
382
+ const n = r;
383
+ return {
384
+ id: n.id,
385
+ status: n.status,
386
+ activeNodeId: n.active_node_id ?? null,
387
+ creditsSpent: n.credits_spent ?? 0
388
+ };
389
+ }
390
+ /**
391
+ * Get per-node execution logs for a completed run.
392
+ */
393
+ async getRunLogs(t) {
394
+ const { data: r, error: e } = await this.rpcClient.rpc("fn_mcp_workflow_run_logs", {
395
+ p_run_id: t
396
+ });
397
+ if (e)
398
+ throw new Error(`@lenserfight/sdk: fn_mcp_workflow_run_logs failed — ${JSON.stringify(e)}`);
399
+ const n = r?.node_results;
400
+ return Array.isArray(n) ? n.map((i) => {
401
+ const s = i;
402
+ return {
403
+ nodeId: s.node_id,
404
+ status: s.status,
405
+ result: s.result ?? null,
406
+ error: s.error ?? null,
407
+ durationMs: s.duration_ms ?? 0,
408
+ tokenCount: s.token_count ?? 0
409
+ };
410
+ }) : [];
411
+ }
412
+ /**
413
+ * Start a workflow run and poll until it reaches a terminal state
414
+ * (`completed`, `failed`, or `cancelled`). Returns the run logs on success
415
+ * and throws on failure or timeout.
416
+ *
417
+ * @param timeoutMs Maximum wait time in milliseconds (default 120 s).
418
+ */
419
+ async awaitRun(t, r, e) {
420
+ const n = e?.timeoutMs ?? E, i = await this.startRun(t, r, e), s = Date.now() + n;
421
+ for (; Date.now() < s; ) {
422
+ await new Promise((c) => setTimeout(c, $));
423
+ const o = await this.getRunStatus(i.id);
424
+ if (S.has(o.status)) {
425
+ if (o.status === "completed")
426
+ return this.getRunLogs(i.id);
427
+ throw new Error(`@lenserfight/sdk: workflow run ${i.id} ended with status "${o.status}"`);
428
+ }
429
+ }
430
+ throw new Error(`@lenserfight/sdk: workflow run ${i.id} timed out after ${n}ms`);
431
+ }
432
+ }
433
+ class p {
434
+ agents;
286
435
  battles;
287
- templates;
288
436
  lenses;
289
- agents;
290
437
  protocols;
438
+ templates;
439
+ workflows;
291
440
  rpc;
292
- constructor(r) {
293
- this.rpc = r, this.battles = new d(r), this.templates = new u(r), this.lenses = new h(r), this.agents = new l(r), this.protocols = new g(r);
441
+ constructor(t) {
442
+ this.rpc = t, this.agents = new u(t), this.battles = new g(t), this.lenses = new k(t), this.protocols = new C(t), this.templates = new b(t), this.workflows = new A(t);
294
443
  }
295
444
  /**
296
445
  * Direct RPC escape hatch. Use sparingly — anything that's part of the
297
446
  * stable surface should live on `battles` / `templates` (or get added there
298
447
  * in a follow-up PR).
299
448
  */
300
- async rpcCall(r, t) {
301
- const { data: e, error: n } = await this.rpc.rpc(r, t);
449
+ async rpcCall(t, r) {
450
+ const { data: e, error: n } = await this.rpc.rpc(t, r);
302
451
  if (n)
303
- throw new Error(`@lenserfight/sdk: ${r} failed — ${JSON.stringify(n)}`);
452
+ throw new Error(`@lenserfight/sdk: ${t} failed — ${JSON.stringify(n)}`);
304
453
  return e;
305
454
  }
306
455
  }
307
- function w(a) {
308
- const r = p(a);
309
- return new o(r);
456
+ function v(a) {
457
+ const t = y(a);
458
+ return new p(t);
310
459
  }
311
- function y(a) {
312
- return new o(a);
460
+ function O(a) {
461
+ return new p(a);
313
462
  }
314
- const m = "0.2.0-alpha.1";
463
+ const N = "0.3.0-alpha.0";
315
464
  export {
316
- l as AgentClient,
317
- d as BattleClient,
318
- h as LensClient,
319
- o as LenserFightClient,
320
- g as ProtocolClient,
321
- m as SDK_VERSION,
322
- u as TemplateClient,
323
- w as createClient,
324
- y as createClientFromRpc,
325
- p as createFetchRpcClient
465
+ g as BattleClient,
466
+ k as LensClient,
467
+ p as LenserFightClient,
468
+ N as SDK_VERSION,
469
+ b as TemplateClient,
470
+ A as WorkflowClient,
471
+ v as createClient,
472
+ O as createClientFromRpc,
473
+ y as createFetchRpcClient
326
474
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lenserfight/sdk",
3
- "version": "0.2.0-alpha.9",
4
- "description": "LenserFight public client SDK — read battles, lenses, agents, protocols, and templates from any Supabase-backed deployment",
5
- "license": "Apache-2.0",
3
+ "version": "0.3.0-alpha.10",
4
+ "description": "LenserFight public client SDK — browse and execute lenses, workflows, battles, agents, and protocols from any Supabase-backed deployment",
5
+ "license": "MIT",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.mjs",
8
8
  "types": "./index.d.ts",
@@ -24,9 +24,7 @@
24
24
  "ai-agents",
25
25
  "supabase",
26
26
  "evaluation",
27
- "battles",
28
- "lenses",
29
- "protocols"
27
+ "battles"
30
28
  ],
31
29
  "repository": {
32
30
  "type": "git",
@@ -36,7 +34,7 @@
36
34
  "publishConfig": {
37
35
  "access": "public",
38
36
  "registry": "https://registry.npmjs.org/",
39
- "tag": "alpha"
37
+ "tag": "latest"
40
38
  },
41
39
  "peerDependencies": {
42
40
  "@supabase/supabase-js": "^2.0.0"