@whoz-oss/coday-server 0.82.0 → 0.83.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-server",
3
- "version": "0.82.0",
3
+ "version": "0.83.0",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
package/server.js CHANGED
@@ -306,7 +306,7 @@ ${a}\r
306
306
  }
307
307
 
308
308
  More details: https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md#removed-logprovider-and-loglevel-options
309
- `)),t}function pZ(r){let e=r.logProvider&&r.logProvider();return e&&(r.logger=e),(0,Gyt.getLogger)(r)}});var Lbe=S(hZ=>{"use strict";Object.defineProperty(hZ,"__esModule",{value:!0});hZ.legacyCreateProxyMiddleware=Qyt;var Kyt=cZ(),Yyt=ul(),Xyt=Nbe(),Mbe=Yyt.Debug.extend("legacy-create-proxy-middleware");function Qyt(r,e){Mbe("init");let t=(0,Xyt.legacyOptionsAdapter)(r,e),n=(0,Kyt.createProxyMiddleware)(t);return Mbe("add marker for patching req.url (old behavior)"),n.__LEGACY_HTTP_PROXY_MIDDLEWARE__=!0,n}});var qbe=S(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0});NT.legacyCreateProxyMiddleware=void 0;var ebt=Lbe();Object.defineProperty(NT,"legacyCreateProxyMiddleware",{enumerable:!0,get:function(){return ebt.legacyCreateProxyMiddleware}})});var zbe=S(Zd=>{"use strict";var tbt=Zd&&Zd.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rbt=Zd&&Zd.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&tbt(e,r,t)};Object.defineProperty(Zd,"__esModule",{value:!0});rbt(qbe(),Zd)});var mZ=S(ru=>{"use strict";var nbt=ru&&ru.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),MT=ru&&ru.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&nbt(e,r,t)};Object.defineProperty(ru,"__esModule",{value:!0});MT(cZ(),ru);MT(Fbe(),ru);MT(FG(),ru);MT(zbe(),ru)});var HT=wr(dte(),1);import fl from"path";import LT from"fs";import*as Z9e from"path";var Fe=class{commandWord;description;requiredIntegrations=[];isInternal=!1;constructor(e){this.commandWord=e.commandWord,this.description=e.description,this.requiredIntegrations=e.requiredIntegrations||[],this.isInternal=!!e?.isInternal}getSubCommand(e){return e.slice(this.commandWord.length).trim()}accept(e,t){return!!e&&e.toLowerCase().startsWith(this.commandWord)}};function EO(r,e=80){if(r.length<=e)return r;try{if(r.trim().startsWith("{")||r.trim().startsWith("[")){let t=JSON.parse(r),n=JSON.stringify(t);return n.length<=e?n:n.substring(0,e)+`...(${n.length} chars)`}}catch{}return r.substring(0,e)+"..."}var li=class{constructor(e,t){this.type=t;if(e.timestamp)this.timestamp=e.timestamp;else{let n=Math.random().toString(36).substring(2,7);this.timestamp=`${new Date().toISOString()}-${n}`}this.parentKey=e.parentKey,this.length=0}timestamp;parentKey;static type;length},z7=class extends li{invite;constructor(e,t){super(e,t),this.invite=e.invite}buildAnswer(e){return new Hr({answer:e,parentKey:this.timestamp,invite:this.invite})}},w3=class r extends li{static type="heartbeat";constructor(e){super(e,r.type)}},ua=class r extends z7{defaultValue;static type="invite";constructor(e){super(e,r.type),this.defaultValue=e.defaultValue}},hte="InviteEventDefault",Hr=class r extends li{answer;invite;static type="answer";constructor(e){super(e,r.type),this.answer=e.answer??"No answer",this.invite=e.invite}},Df=class r extends li{speaker;text;static type="text";constructor(e){super(e,r.type),this.speaker=e.speaker,this.text=e.text}},Sl=class r extends li{chunk;static type="text_chunk";constructor(e){super(e,r.type),this.chunk=e.chunk,this.length=this.chunk.length}},_3=class r extends li{warning;static type="warn";constructor(e){super(e,r.type),this.warning=e.warning}},Oa=class r extends li{error;static type="error";constructor(e){super(e,r.type),this.error=e.error}},la=class r extends z7{options;optionalQuestion;static type="choice";constructor(e){super(e,r.type),this.options=e.options,this.optionalQuestion=e.optionalQuestion}},cn=class r extends li{toolRequestId;name;args;static type="tool_request";constructor(e){super(e,r.type),this.toolRequestId=e.toolRequestId??this.timestamp,this.name=e.name,this.args=e.args,this.length=this.args.length+this.name.length+this.toolRequestId.length+20}buildResponse(e){return new En({output:e,toolRequestId:this.toolRequestId,parentKey:this.timestamp})}toSingleLineString(e=50){let t=EO(this.args,e);return`\u{1F527} ${this.name}(${t})`}},En=class r extends li{toolRequestId;output;static type="tool_response";constructor(e){if(super(e,r.type),this.toolRequestId=e.toolRequestId||this.timestamp||new Date().toISOString(),this.output=e.output,typeof this.output=="string")this.length=this.output.length+this.toolRequestId.length+20;else if(this.output.type==="text")this.length=this.output.content.length+this.toolRequestId.length+20;else if(this.output.type==="image"){let t=(this.output.width??0)*(this.output.height??0)/750;this.length=(t?t*3.5:this.output.content.length)+this.toolRequestId.length+20}else this.length=this.toolRequestId.length+20}getTextOutput(){return typeof this.output=="string"?this.output:this.output.type==="text"?this.output.content:this.output.type==="image"?`[Image: ${this.output.mimeType}]`:""}toSingleLineString(e=50){let t=this.getTextOutput(),n=EO(t,e),i=typeof this.output!="string"&&this.output.type==="image"?" [image]":"";return`\u2B91 ${n}${i}`}},Of=class r extends li{static type="thinking";static debounce=5e3;constructor(e){super(e,r.type)}},fa=class r extends li{summary;static type="summary";constructor(e){super(e,r.type),this.summary=e.summary,this.length=this.summary.length}toSingleLineString(e=80){return`\u{1F4CB} Summary: ${EO(this.summary,e)}`}},Wt=class r extends li{role;name;content;static type="message";constructor(e){super(e,r.type),this.role=e.role,this.name=e.name,this.content=e.content,this.length=this.content.map(t=>{if(t.type==="text")return t.content.length;if(t.type==="image"){let n=(t.width||0)*(t.height||0)/750;return n?n*3.5:t.content.length}return 0}).reduce((t,n)=>t+n,0)}getTextContent(){return this.content.filter(e=>e.type==="text").map(e=>e.content).join(`
309
+ `)),t}function pZ(r){let e=r.logProvider&&r.logProvider();return e&&(r.logger=e),(0,Gyt.getLogger)(r)}});var Lbe=S(hZ=>{"use strict";Object.defineProperty(hZ,"__esModule",{value:!0});hZ.legacyCreateProxyMiddleware=Qyt;var Kyt=cZ(),Yyt=ul(),Xyt=Nbe(),Mbe=Yyt.Debug.extend("legacy-create-proxy-middleware");function Qyt(r,e){Mbe("init");let t=(0,Xyt.legacyOptionsAdapter)(r,e),n=(0,Kyt.createProxyMiddleware)(t);return Mbe("add marker for patching req.url (old behavior)"),n.__LEGACY_HTTP_PROXY_MIDDLEWARE__=!0,n}});var qbe=S(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0});NT.legacyCreateProxyMiddleware=void 0;var ebt=Lbe();Object.defineProperty(NT,"legacyCreateProxyMiddleware",{enumerable:!0,get:function(){return ebt.legacyCreateProxyMiddleware}})});var zbe=S(Zd=>{"use strict";var tbt=Zd&&Zd.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rbt=Zd&&Zd.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&tbt(e,r,t)};Object.defineProperty(Zd,"__esModule",{value:!0});rbt(qbe(),Zd)});var mZ=S(ru=>{"use strict";var nbt=ru&&ru.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),MT=ru&&ru.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&nbt(e,r,t)};Object.defineProperty(ru,"__esModule",{value:!0});MT(cZ(),ru);MT(Fbe(),ru);MT(FG(),ru);MT(zbe(),ru)});var HT=wr(dte(),1);import fl from"path";import LT from"fs";import*as Z9e from"path";var Fe=class{commandWord;description;requiredIntegrations=[];isInternal=!1;constructor(e){this.commandWord=e.commandWord,this.description=e.description,this.requiredIntegrations=e.requiredIntegrations||[],this.isInternal=!!e?.isInternal}getSubCommand(e){return e.slice(this.commandWord.length).trim()}accept(e,t){return!!e&&e.toLowerCase().startsWith(this.commandWord)}};function EO(r,e=80){if(r.length<=e)return r;try{if(r.trim().startsWith("{")||r.trim().startsWith("[")){let t=JSON.parse(r),n=JSON.stringify(t);return n.length<=e?n:n.substring(0,e)+`...(${n.length} chars)`}}catch{}return r.substring(0,e)+"..."}var li=class{constructor(e,t){this.type=t;if(e.timestamp)this.timestamp=e.timestamp;else{let n=Math.random().toString(36).substring(2,7);this.timestamp=`${new Date().toISOString()}-${n}`}this.parentKey=e.parentKey,this.length=0}timestamp;parentKey;static type;length;get date(){let e=this.timestamp.lastIndexOf("-");if(e>0){let t=this.timestamp.substring(e+1);if(t.length===5&&/^[a-z0-9]+$/.test(t))return new Date(this.timestamp.substring(0,e))}return new Date(this.timestamp)}},z7=class extends li{invite;constructor(e,t){super(e,t),this.invite=e.invite}buildAnswer(e){return new Hr({answer:e,parentKey:this.timestamp,invite:this.invite})}},w3=class r extends li{static type="heartbeat";constructor(e){super(e,r.type)}},ua=class r extends z7{defaultValue;static type="invite";constructor(e){super(e,r.type),this.defaultValue=e.defaultValue}},hte="InviteEventDefault",Hr=class r extends li{answer;invite;static type="answer";constructor(e){super(e,r.type),this.answer=e.answer??"No answer",this.invite=e.invite}},Df=class r extends li{speaker;text;static type="text";constructor(e){super(e,r.type),this.speaker=e.speaker,this.text=e.text}},Sl=class r extends li{chunk;static type="text_chunk";constructor(e){super(e,r.type),this.chunk=e.chunk,this.length=this.chunk.length}},_3=class r extends li{warning;static type="warn";constructor(e){super(e,r.type),this.warning=e.warning}},Oa=class r extends li{error;static type="error";constructor(e){super(e,r.type),this.error=e.error}},la=class r extends z7{options;optionalQuestion;static type="choice";constructor(e){super(e,r.type),this.options=e.options,this.optionalQuestion=e.optionalQuestion}},cn=class r extends li{toolRequestId;name;args;static type="tool_request";constructor(e){super(e,r.type),this.toolRequestId=e.toolRequestId??this.timestamp,this.name=e.name,this.args=e.args,this.length=this.args.length+this.name.length+this.toolRequestId.length+20}buildResponse(e){return new En({output:e,toolRequestId:this.toolRequestId,parentKey:this.timestamp})}toSingleLineString(e=50){let t=EO(this.args,e);return`\u{1F527} ${this.name}(${t})`}},En=class r extends li{toolRequestId;output;static type="tool_response";constructor(e){if(super(e,r.type),this.toolRequestId=e.toolRequestId||this.timestamp||new Date().toISOString(),this.output=e.output,typeof this.output=="string")this.length=this.output.length+this.toolRequestId.length+20;else if(this.output.type==="text")this.length=this.output.content.length+this.toolRequestId.length+20;else if(this.output.type==="image"){let t=(this.output.width??0)*(this.output.height??0)/750;this.length=(t?t*3.5:this.output.content.length)+this.toolRequestId.length+20}else this.length=this.toolRequestId.length+20}getTextOutput(){return typeof this.output=="string"?this.output:this.output.type==="text"?this.output.content:this.output.type==="image"?`[Image: ${this.output.mimeType}]`:""}toSingleLineString(e=50){let t=this.getTextOutput(),n=EO(t,e),i=typeof this.output!="string"&&this.output.type==="image"?" [image]":"";return`\u2B91 ${n}${i}`}},Of=class r extends li{static type="thinking";static debounce=5e3;constructor(e){super(e,r.type)}},fa=class r extends li{summary;static type="summary";constructor(e){super(e,r.type),this.summary=e.summary,this.length=this.summary.length}toSingleLineString(e=80){return`\u{1F4CB} Summary: ${EO(this.summary,e)}`}},Wt=class r extends li{role;name;content;static type="message";constructor(e){super(e,r.type),this.role=e.role,this.name=e.name,this.content=e.content,this.length=this.content.map(t=>{if(t.type==="text")return t.content.length;if(t.type==="image"){let n=(t.width||0)*(t.height||0)/750;return n?n*3.5:t.content.length}return 0}).reduce((t,n)=>t+n,0)}getTextContent(){return this.content.filter(e=>e.type==="text").map(e=>e.content).join(`
310
310
  `)}},nc=class r extends li{threadId;name;summary;static type="thread_update";constructor(e){super(e,r.type),this.threadId=e.threadId,this.name=e.name,this.summary=e.summary}},ic=class r extends li{filename;operation;size;mimeType;static type="file";constructor(e){super(e,r.type),this.filename=e.filename,this.operation=e.operation,this.size=e.size,this.mimeType=e.mimeType}toSingleLineString(){let e=this.operation==="created"?"\u{1F4C4}":this.operation==="updated"?"\u{1F4DD}":"\u{1F5D1}\uFE0F",t=this.size?` (${(this.size/1024).toFixed(1)} KB)`:"";return`${e} ${this.operation}: ${this.filename}${t}`}},El=class r extends li{authUrl;state;integrationName;static type="oauth_request";constructor(e){super(e,r.type),this.authUrl=e.authUrl,this.state=e.state,this.integrationName=e.integrationName}},U7=class r extends li{code;state;integrationName;error;errorDescription;static type="oauth_callback";constructor(e){super(e,r.type),this.code=e.code,this.state=e.state,this.integrationName=e.integrationName,this.error=e.error,this.errorDescription=e.errorDescription}},sDe={[Wt.type]:Wt,[Hr.type]:Hr,[la.type]:la,[Oa.type]:Oa,[w3.type]:w3,[ua.type]:ua,[cn.type]:cn,[En.type]:En,[Df.type]:Df,[Sl.type]:Sl,[Of.type]:Of,[_3.type]:_3,[nc.type]:nc,[fa.type]:fa,[ic.type]:ic,[El.type]:El,[U7.type]:U7};function B7(r){let e=sDe[r.type];return e?new e(r):void 0}var H7=class{constructor(e,t,n,i=!1){this.aiClient=t;this.tools=n;this.internal=i;this.name=e.name,this.description=e.description,this.definition={...e}}name;description;definition;get systemInstructions(){return this.definition.instructions}getAiClient(){return this.aiClient}async run(e,t){let n=e.trim(),i=new Hr({answer:n});return t.addAnswerEvent(i),await this.aiClient.run(this,t)}};var W7={name:"Coday",description:"Default fallback agent with neutral character and access to all tools",instructions:`
311
311
  You are Coday, an AI assistant designed for interactive usage by users through various chat-like interfaces.
312
312