@messenger-agent/client 0.30.0 → 0.31.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/dist/install.js +1 -1
  2. package/package.json +5 -5
package/dist/install.js CHANGED
@@ -1 +1 @@
1
- import{mkdir as w,realpath as l,stat as m}from"node:fs/promises";import{normalizeAgentServer as h}from"@messenger-agent/shared/agent-config";import{readConfigYaml as k,updateClientConfig as v,writeUpgradeChannel as y}from"./config-file.js";import{installRuntime as g}from"./runtime.js";import{installService as P}from"./service.js";import{UsageError as d}from"./args.js";import{defaultWorkspacePath as f}from"./paths.js";function A(e=process.platform){if(e!=="linux"&&e!=="darwin")throw new Error("Only Linux and macOS are supported")}function x(e=process.versions.node){const r=Number.parseInt(e.split(".")[0]??"",10);if(!Number.isInteger(r)||r<24)throw new Error("Node.js 24 or newer is required")}function D(e){if(e.server)try{h(e.server)}catch{throw new Error("--server must be a valid HTTP or HTTPS server address")}if(e.tunnelId&&!/^[A-Za-z0-9._:-]+$/.test(e.tunnelId))throw new Error("--tunnel-id may only contain letters, numbers, '.', '_', ':', and '-'");if(e.workspaceId&&!/^[A-Za-z0-9._:-]+$/.test(e.workspaceId))throw new Error("--workspace-id may only contain letters, numbers, '.', '_', ':', and '-'");if(e.workspaceName&&(e.workspaceName.trim().length===0||e.workspaceName.trim().length>128))throw new Error("--workspace-name must be between 1 and 128 characters")}async function I(e,r=!1){r&&await w(e,{recursive:!0});const t=await l(e);if(!(await m(t)).isDirectory())throw new Error("--workspace must point to an existing directory");return t}async function M(e){A(),x();const r=await N(e);D(r);const t=await I(r.workspace,r.createWorkspace);await v({configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,workspaceId:r.workspaceId,workspaceName:r.workspaceName,tunnelId:r.tunnelId,token:r.token,server:r.server,serverUrl:r.serverUrl,preserveWorkspaces:r.preserveWorkspaces}),e.channel&&await y(r.configPath,e.channel);const o=await g({version:"current",configPath:r.configPath}),a=await P({configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,serviceCommandPath:o.wrapperPath});return{configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,runtime:o,service:a}}async function N(e){const r=await k(e.configPath),t=E(r,"tunnel"),o=e.tunnelId??p(t,"tunnel_id"),a=e.token??p(t,"token"),s=b(r,e.workspaceId,o),i=e.workspace??s?.path??f,n=e.workspaceId??s?.id??(o?`${o}--default`:void 0),c=e.workspaceName??s?.name??(o?`${o} Default`:void 0),u=i===f;if(!o)throw new d("Missing required option: --tunnel-id");if(!a)throw new d("Missing required option: --token");if(!n)throw new d("Missing required option: --workspace-id");if(!c)throw new d("Missing required option: --workspace-name");return{...e,tunnelId:o,token:a,workspace:i,workspaceId:n,workspaceName:c,preserveWorkspaces:!e.workspace&&!!s,createWorkspace:u}}function b(e,r,t){const o=e.workspaces;if(!Array.isArray(o))return;const a=o.filter(n=>!!n&&typeof n=="object"&&!Array.isArray(n)&&typeof n.path=="string");if(r){const n=a.find(c=>c.id===r);return!n||typeof n.path!="string"?void 0:{id:r,name:typeof n.name=="string"&&n.name?n.name:`${t??r} Default`,path:n.path}}const s=r??(t?`${t}--default`:void 0),i=(s?a.find(n=>n.id===s):void 0)??a.find(n=>n.id==="default")??a[0];if(!(!i||typeof i.path!="string"))return{id:typeof i.id=="string"&&i.id?i.id:s??"default",name:typeof i.name=="string"&&i.name?i.name:`${t??s??"default"} Default`,path:i.path}}function E(e,r){const t=e[r];if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function p(e,r){const t=e?.[r];return typeof t=="string"&&t?t:void 0}export{x as assertNodeVersion,A as assertSupportedPlatform,M as installClient,N as resolveInstallArgs,I as resolveWorkspacePath,D as validateInstallArgs};
1
+ import{randomUUID as w}from"node:crypto";import{mkdir as l,realpath as m,stat as h}from"node:fs/promises";import{normalizeAgentServer as k}from"@messenger-agent/shared/agent-config";import{readConfigYaml as v,updateClientConfig as y,writeUpgradeChannel as g}from"./config-file.js";import{installRuntime as P}from"./runtime.js";import{installService as A}from"./service.js";import{UsageError as f}from"./args.js";import{defaultWorkspacePath as d}from"./paths.js";function D(e=process.platform){if(e!=="linux"&&e!=="darwin")throw new Error("Only Linux and macOS are supported")}function I(e=process.versions.node){const r=Number.parseInt(e.split(".")[0]??"",10);if(!Number.isInteger(r)||r<24)throw new Error("Node.js 24 or newer is required")}function x(e){if(e.server)try{k(e.server)}catch{throw new Error("--server must be a valid HTTP or HTTPS server address")}if(e.tunnelId&&!/^[A-Za-z0-9._:-]+$/.test(e.tunnelId))throw new Error("--tunnel-id may only contain letters, numbers, '.', '_', ':', and '-'");if(e.workspaceId&&!/^[A-Za-z0-9._:-]+$/.test(e.workspaceId))throw new Error("--workspace-id may only contain letters, numbers, '.', '_', ':', and '-'");if(e.workspaceName&&(e.workspaceName.trim().length===0||e.workspaceName.trim().length>128))throw new Error("--workspace-name must be between 1 and 128 characters")}async function N(e,r=!1){r&&await l(e,{recursive:!0});const t=await m(e);if(!(await h(t)).isDirectory())throw new Error("--workspace must point to an existing directory");return t}async function z(e){D(),I();const r=await b(e);x(r);const t=await N(r.workspace,r.createWorkspace);await y({configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,workspaceId:r.workspaceId,workspaceName:r.workspaceName,tunnelId:r.tunnelId,token:r.token,server:r.server,serverUrl:r.serverUrl,preserveWorkspaces:r.preserveWorkspaces}),e.channel&&await g(r.configPath,e.channel);const o=await P({version:"current",configPath:r.configPath}),a=await A({configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,serviceCommandPath:o.wrapperPath});return{configPath:r.configPath,dataDir:r.dataDir,workspacePath:t,runtime:o,service:a}}async function b(e){const r=await v(e.configPath),t=C(r,"tunnel"),o=e.tunnelId??p(t,"tunnel_id"),a=e.token??p(t,"token"),s=E(r,e.workspaceId,o),i=e.workspace??s?.path??d,n=e.workspaceId??s?.id??w(),c=e.workspaceName??s?.name??(o?`${o} Default`:void 0),u=i===d;if(!o)throw new f("Missing required option: --tunnel-id");if(!a)throw new f("Missing required option: --token");if(!n)throw new f("Missing required option: --workspace-id");if(!c)throw new f("Missing required option: --workspace-name");return{...e,tunnelId:o,token:a,workspace:i,workspaceId:n,workspaceName:c,preserveWorkspaces:!e.workspace&&!!s,createWorkspace:u}}function E(e,r,t){const o=e.workspaces;if(!Array.isArray(o))return;const a=o.filter(n=>!!n&&typeof n=="object"&&!Array.isArray(n)&&typeof n.path=="string");if(r){const n=a.find(c=>c.id===r);return!n||typeof n.path!="string"?void 0:{id:r,name:typeof n.name=="string"&&n.name?n.name:`${t??r} Default`,path:n.path}}const s=r??(t?`${t}--default`:void 0),i=(s?a.find(n=>n.id===s):void 0)??a.find(n=>n.id==="default")??a[0];if(!(!i||typeof i.path!="string"))return{id:typeof i.id=="string"&&i.id?i.id:s??"default",name:typeof i.name=="string"&&i.name?i.name:`${t??s??"default"} Default`,path:i.path}}function C(e,r){const t=e[r];if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function p(e,r){const t=e?.[r];return typeof t=="string"&&t?t:void 0}export{I as assertNodeVersion,D as assertSupportedPlatform,z as installClient,b as resolveInstallArgs,N as resolveWorkspacePath,x as validateInstallArgs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-agent/client",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,10 +20,10 @@
20
20
  "dependencies": {
21
21
  "cac": "^7.0.0",
22
22
  "yaml": "^2.9.0",
23
- "@messenger-agent/claude-agent": "0.30.0",
24
- "@messenger-agent/codex-agent": "0.30.0",
25
- "@messenger-agent/messenger-agent": "0.30.0",
26
- "@messenger-agent/shared": "0.30.0"
23
+ "@messenger-agent/claude-agent": "0.31.0",
24
+ "@messenger-agent/codex-agent": "0.31.0",
25
+ "@messenger-agent/shared": "0.31.0",
26
+ "@messenger-agent/messenger-agent": "0.31.0"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "rm -rf dist && tsc -p tsconfig.json && node ../../scripts/copy-client-assets.mjs && chmod +x dist/index.js",