@plusonelabs/cue 0.0.58 → 0.0.59

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.
Binary file
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from 'module'; const require = createRequire(import.meta.url); global.__CUE_VERSION__ = '0.0.58';
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url); global.__CUE_VERSION__ = '0.0.59';
3
3
  var Pce=Object.create;var pw=Object.defineProperty;var Lce=Object.getOwnPropertyDescriptor;var $ce=Object.getOwnPropertyNames;var zce=Object.getPrototypeOf,Hce=Object.prototype.hasOwnProperty;var _t=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var _=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ie=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pn=(t,e)=>{for(var n in e)pw(t,n,{get:e[n],enumerable:!0})},rj=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $ce(e))!Hce.call(t,s)&&s!==n&&pw(t,s,{get:()=>e[s],enumerable:!(i=Lce(e,s))||i.enumerable});return t};var we=(t,e,n)=>(n=t!=null?Pce(zce(t)):{},rj(e||!t||!t.__esModule?pw(n,"default",{value:t,enumerable:!0}):n,t)),aj=t=>rj(pw({},"__esModule",{value:!0}),t);import fw from"fs";import CR from"path";function hf(){if(typeof global.__CUE_VERSION__<"u")return global.__CUE_VERSION__;try{let t=process.argv[1],e=CR.join(CR.dirname(t),"..","package.json");if(fw.existsSync(e)){let n=fw.readFileSync(e,"utf-8");return JSON.parse(n).version}}catch{}if(process.argv[1].includes("src/cli.tsx"))try{let t=CR.join(process.cwd(),"package.json");if(fw.existsSync(t)){let e=fw.readFileSync(t,"utf-8");return JSON.parse(e).version}}catch{}return"unknown"}var sI=_(()=>{"use strict"});function nt(t,e,n,i,s){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n}function ae(t,e,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(t):i?i.value:e.get(t)}var Sd=_(()=>{});var vR,lj=_(()=>{vR=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return vR=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),n=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^n()&15>>+i/4).toString(16))}});function xd(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var iI,$D=_(()=>{iI=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var ht,Vi,Fo,gf,zD,HD,jD,GD,KD,qD,JD,YD,WD,au=_(()=>{$D();ht=class extends Error{},Vi=class t extends ht{constructor(e,n,i,s){super(`${t.makeMessage(e,n,i)}`),this.status=e,this.headers=s,this.requestID=s?.get("request-id"),this.error=n}static makeMessage(e,n,i){let s=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):i;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,n,i,s){if(!e||!s)return new gf({message:i,cause:iI(n)});let o=n;return e===400?new HD(e,o,i,s):e===401?new jD(e,o,i,s):e===403?new GD(e,o,i,s):e===404?new KD(e,o,i,s):e===409?new qD(e,o,i,s):e===422?new JD(e,o,i,s):e===429?new YD(e,o,i,s):e>=500?new WD(e,o,i,s):new t(e,o,i,s)}},Fo=class extends Vi{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},gf=class extends Vi{constructor({message:e,cause:n}){super(void 0,void 0,e||"Connection error.",void 0),n&&(this.cause=n)}},zD=class extends gf{constructor({message:e}={}){super({message:e??"Request timed out."})}},HD=class extends Vi{},jD=class extends Vi{},GD=class extends Vi{},KD=class extends Vi{},qD=class extends Vi{},JD=class extends Vi{},YD=class extends Vi{},WD=class extends Vi{}});function Aw(t){return typeof t!="object"?{}:t??{}}function pj(t){if(!t)return!0;for(let e in t)return!1;return!0}function fj(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Gce,dj,IR,SR,Aj,mw,bm=_(()=>{au();Gce=/^[a-z][a-z0-9+.-]*:/i,dj=t=>Gce.test(t),IR=t=>(IR=Array.isArray,IR(t)),SR=IR;Aj=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ht(`${t} must be an integer`);if(e<0)throw new ht(`${t} must be a positive integer`);return e},mw=t=>{try{return JSON.parse(t)}catch{return}}});var mj,hj=_(()=>{mj=t=>new Promise(e=>setTimeout(e,t))});var Df,xR=_(()=>{Df="0.71.2"});function Kce(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function Jce(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:n}of t){let i=n.exec(navigator.userAgent);if(i){let s=i[1]||0,o=i[2]||0,u=i[3]||0;return{browser:e,version:`${s}.${o}.${u}`}}}return null}var yj,qce,gj,Dj,Ej,Cj,bR=_(()=>{xR();yj=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";qce=()=>{let t=Kce();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Df,"X-Stainless-OS":Dj(Deno.build.os),"X-Stainless-Arch":gj(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Df,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Df,"X-Stainless-OS":Dj(globalThis.process.platform??"unknown"),"X-Stainless-Arch":gj(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Jce();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Df,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Df,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};gj=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Dj=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Cj=()=>Ej??(Ej=qce())});function vj(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function BR(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function hw(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return BR({start(){},async pull(n){let{done:i,value:s}=await e.next();i?n.close():n.enqueue(s)},async cancel(){await e.return?.()}})}function oI(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let n=await e.read();return n?.done&&e.releaseLock(),n}catch(n){throw e.releaseLock(),n}},async return(){let n=e.cancel();return e.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ij(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),n=e.cancel();e.releaseLock(),await n}var ZD=_(()=>{});var Sj,xj=_(()=>{Sj=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});function wj(t){let e=0;for(let s of t)e+=s.length;let n=new Uint8Array(e),i=0;for(let s of t)n.set(s,i),i+=s.length;return n}function rI(t){let e;return(bj??(e=new globalThis.TextEncoder,bj=e.encode.bind(e)))(t)}function wR(t){let e;return(Bj??(e=new globalThis.TextDecoder,Bj=e.decode.bind(e)))(t)}var bj,Bj,_R=_(()=>{});function Zce(t,e){for(let s=e??0;s<t.length;s++){if(t[s]===10)return{preceding:s,index:s+1,carriage:!1};if(t[s]===13)return{preceding:s,index:s+1,carriage:!0}}return null}function _j(t){for(let i=0;i<t.length-1;i++){if(t[i]===10&&t[i+1]===10||t[i]===13&&t[i+1]===13)return i+2;if(t[i]===13&&t[i+1]===10&&i+3<t.length&&t[i+2]===13&&t[i+3]===10)return i+4}return-1}var fa,Aa,bd,FR=_(()=>{Sd();_R();bd=class{constructor(){fa.set(this,void 0),Aa.set(this,void 0),nt(this,fa,new Uint8Array,"f"),nt(this,Aa,null,"f")}decode(e){if(e==null)return[];let n=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?rI(e):e;nt(this,fa,wj([ae(this,fa,"f"),n]),"f");let i=[],s;for(;(s=Zce(ae(this,fa,"f"),ae(this,Aa,"f")))!=null;){if(s.carriage&&ae(this,Aa,"f")==null){nt(this,Aa,s.index,"f");continue}if(ae(this,Aa,"f")!=null&&(s.index!==ae(this,Aa,"f")+1||s.carriage)){i.push(wR(ae(this,fa,"f").subarray(0,ae(this,Aa,"f")-1))),nt(this,fa,ae(this,fa,"f").subarray(ae(this,Aa,"f")),"f"),nt(this,Aa,null,"f");continue}let o=ae(this,Aa,"f")!==null?s.preceding-1:s.preceding,u=wR(ae(this,fa,"f").subarray(0,o));i.push(u),nt(this,fa,ae(this,fa,"f").subarray(s.index),"f"),nt(this,Aa,null,"f")}return i}flush(){return ae(this,fa,"f").length?this.decode(`
4
4
  `):[]}};fa=new WeakMap,Aa=new WeakMap;bd.NEWLINE_CHARS=new Set([`
5
5
  `,"\r"]);bd.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function aI(){}function gw(t,e,n){return!e||Dw[t]>Dw[n]?aI:e[t].bind(e)}function Xi(t){let e=t.logger,n=t.logLevel??"off";if(!e)return Vce;let i=Fj.get(e);if(i&&i[0]===n)return i[1];let s={error:gw("error",e,n),warn:gw("warn",e,n),info:gw("info",e,n),debug:gw("debug",e,n)};return Fj.set(e,[n,s]),s}var Dw,TR,Vce,Fj,Bd,Ew=_(()=>{bm();Dw={off:0,error:200,warn:300,info:400,debug:500},TR=(t,e,n)=>{if(t){if(fj(Dw,t))return t;Xi(n).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Dw))}`)}};Vce={error:aI,warn:aI,info:aI,debug:aI},Fj=new WeakMap;Bd=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,n])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*Xce(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ht("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ht("Attempted to iterate over a response with no body");let n=new QR,i=new bd,s=oI(t.body);for await(let o of ele(s))for(let u of i.decode(o)){let d=n.decode(u);d&&(yield d)}for(let o of i.flush()){let u=n.decode(o);u&&(yield u)}}async function*ele(t){let e=new Uint8Array;for await(let n of t){if(n==null)continue;let i=n instanceof ArrayBuffer?new Uint8Array(n):typeof n=="string"?rI(n):n,s=new Uint8Array(e.length+i.length);s.set(e),s.set(i,e.length),e=s;let o;for(;(o=_j(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}function tle(t,e){let n=t.indexOf(e);return n!==-1?[t.substring(0,n),e,t.substring(n+e.length)]:[t,"",""]}var uI,el,QR,RR=_(()=>{Sd();au();ZD();FR();ZD();$D();bm();_R();Ew();au();el=class t{constructor(e,n,i){this.iterator=e,uI.set(this,void 0),this.controller=n,nt(this,uI,i,"f")}static fromSSEResponse(e,n,i){let s=!1,o=i?Xi(i):console;async function*u(){if(s)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let d=!1;try{for await(let f of Xce(e,n)){if(f.event==="completion")try{yield JSON.parse(f.data)}catch(m){throw o.error("Could not parse message into JSON:",f.data),o.error("From chunk:",f.raw),m}if(f.event==="message_start"||f.event==="message_delta"||f.event==="message_stop"||f.event==="content_block_start"||f.event==="content_block_delta"||f.event==="content_block_stop")try{yield JSON.parse(f.data)}catch(m){throw o.error("Could not parse message into JSON:",f.data),o.error("From chunk:",f.raw),m}if(f.event!=="ping"&&f.event==="error")throw new Vi(void 0,mw(f.data)??f.data,void 0,e.headers)}d=!0}catch(f){if(xd(f))return;throw f}finally{d||n.abort()}}return new t(u,n,i)}static fromReadableStream(e,n,i){let s=!1;async function*o(){let d=new bd,f=oI(e);for await(let m of f)for(let g of d.decode(m))yield g;for(let m of d.flush())yield m}async function*u(){if(s)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let d=!1;try{for await(let f of o())d||f&&(yield JSON.parse(f));d=!0}catch(f){if(xd(f))return;throw f}finally{d||n.abort()}}return new t(u,n,i)}[(uI=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],n=[],i=this.iterator(),s=o=>({next:()=>{if(o.length===0){let u=i.next();e.push(u),n.push(u)}return o.shift()}});return[new t(()=>s(e),this.controller,ae(this,uI,"f")),new t(()=>s(n),this.controller,ae(this,uI,"f"))]}toReadableStream(){let e=this,n;return BR({async start(){n=e[Symbol.asyncIterator]()},async pull(i){try{let{value:s,done:o}=await n.next();if(o)return i.close();let u=rI(JSON.stringify(s)+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusonelabs/cue",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "Cue CLI",
5
5
  "main": "./dist/cli.mjs",
6
6
  "bin": {
Binary file