@whyvix/remote 0.3.15 → 0.3.17
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whyvix/remote",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"gateway": "node services/gateway/src/index.js",
|
|
20
20
|
"agent": "node packages/agent/src/index.js",
|
|
21
21
|
"test:r0": "node scripts/r0-test.js",
|
|
22
|
-
"test": "npm run test:r0 && npm run test:r1-r2 && npm run test:r3-r5 && npm run test:r10-gui-window-focus && npm run test:r10-documents && npm run test:r10-observability",
|
|
23
|
-
"check": "node --check packages/protocol/src/index.js && node --check packages/agent/src/security.js && node --check packages/agent/src/process-manager.js && node --check packages/agent/src/precision-document-manager.js && node --check packages/agent/src/tools.js && node --check packages/agent/src/agent.js && node --check packages/agent/src/index.js && node --check packages/cli/index.js && node --check services/gateway/src/device-registry.js && node --check services/gateway/src/gateway.js && node --check services/gateway/src/index.js && node --check scripts/r0-test.js && node --check scripts/r1-r2-test.js && node --check scripts/r3-r5-test.js",
|
|
22
|
+
"test": "npm run test:r0 && npm run test:r4-desktop-connect && npm run test:r1-r2 && npm run test:r3-r5 && npm run test:r10-gui-window-focus && npm run test:r10-documents && npm run test:r10-observability",
|
|
23
|
+
"check": "node --check packages/protocol/src/index.js && node --check packages/agent/src/security.js && node --check packages/agent/src/process-manager.js && node --check packages/agent/src/precision-document-manager.js && node --check packages/agent/src/tools.js && node --check packages/agent/src/agent.js && node --check packages/agent/src/index.js && node --check packages/cli/index.js && node --check services/gateway/src/device-registry.js && node --check services/gateway/src/gateway.js && node --check services/gateway/src/index.js && node --check services/gateway/src/authorization/sqlite-desktop-connect-repository.js && node --check services/gateway/src/web/desktop-connect-api.js && node --check services/gateway/src/production-authority.js && node --check services/gateway/src/production-runtime.js && node --check services/gateway/src/web/identity-web-server.js && node --check scripts/r4-desktop-connect-authorization-test.js && node --check scripts/r4-desktop-connect-transaction-test.js && node --check scripts/r4-desktop-connect-api-test.js && node --check scripts/r0-test.js && node --check scripts/r1-r2-test.js && node --check scripts/r3-r5-test.js",
|
|
24
|
+
"test:r4-desktop-connect": "node scripts/r4-desktop-connect-authorization-test.js && node scripts/r4-desktop-connect-transaction-test.js && node scripts/r4-desktop-connect-api-test.js && node scripts/r4-desktop-connect-browser-test.js",
|
|
24
25
|
"test:r1-r2": "node scripts/r1-r2-test.js",
|
|
25
26
|
"test:r3-r5": "node scripts/r3-r5-test.js",
|
|
26
27
|
"test:r10-gui-window-focus": "node scripts/r10-gui-window-action-contract-test.js && node scripts/r10-gui-window-action-source-test.js && node scripts/r10-gui-window-action-agent-capability-test.js && node scripts/r10-gui-window-action-authorization-test.js && node scripts/r10-gui-window-action-loader-test.js && node scripts/r10-gui-window-action-mcp-schema-test.js && node scripts/r10-gui-window-action-cli-wiring-test.js && node scripts/r10-deployment-certify-authorization-test.js && node scripts/r10-deployment-certify-protocol-test.js && node scripts/r10-deployment-activation-response-test.js",
|
|
@@ -8,7 +8,11 @@ const WINDOWS_TOOLCHAIN_PATTERNS = [
|
|
|
8
8
|
"C:/wamp/bin/mysql/*/bin",
|
|
9
9
|
"C:/xampp/mysql/bin",
|
|
10
10
|
"C:/Program Files/MySQL/*/bin",
|
|
11
|
-
"C:/Program Files/MariaDB */bin"
|
|
11
|
+
"C:/Program Files/MariaDB */bin",
|
|
12
|
+
"C:/dev/whyvix-toolchains/jdk/*/bin",
|
|
13
|
+
"C:/dev/whyvix-toolchains/android-sdk/cmdline-tools/*/bin",
|
|
14
|
+
"C:/dev/whyvix-toolchains/android-sdk/platform-tools",
|
|
15
|
+
"C:/dev/whyvix-toolchains/android-sdk/build-tools/*"
|
|
12
16
|
];
|
|
13
17
|
const BLOCKED_SHELL_EXECUTABLES = new Set([
|
|
14
18
|
"cmd", "command", "powershell", "pwsh", "sh", "bash", "dash", "zsh", "fish", "wsl"
|
|
@@ -104,8 +108,14 @@ export class ProcessManager {
|
|
|
104
108
|
spawnCommand=selected;
|
|
105
109
|
}
|
|
106
110
|
if(this.platform==="win32"&&(executable.name==="npm"||executable.name==="npx")) {
|
|
107
|
-
const
|
|
108
|
-
|
|
111
|
+
const selectedDir=executableMatch!=null?path.dirname(spawnCommand):path.dirname(this.nodeExecPath);
|
|
112
|
+
const selectedNode=path.join(selectedDir,"node.exe");
|
|
113
|
+
const selectedCli=path.join(selectedDir,"node_modules","npm","bin",executable.name==="npm"?"npm-cli.js":"npx-cli.js");
|
|
114
|
+
const fallbackCli=path.join(path.dirname(this.nodeExecPath),"node_modules","npm","bin",executable.name==="npm"?"npm-cli.js":"npx-cli.js");
|
|
115
|
+
if(executableMatch!=null){
|
|
116
|
+
try{if(!fs.statSync(selectedNode).isFile()||!fs.statSync(selectedCli).isFile())fail("LOCAL_EXEC_NOT_ALLOWED","Selected Windows command shim does not have an approved adjacent Node launcher");}catch(error){if(error?.code==="LOCAL_EXEC_NOT_ALLOWED")throw error;fail("LOCAL_EXEC_NOT_ALLOWED","Selected Windows command shim does not have an approved adjacent Node launcher");}
|
|
117
|
+
spawnCommand=selectedNode;args=[selectedCli,...args];
|
|
118
|
+
}else{spawnCommand=this.nodeExecPath;args=[fallbackCli,...args];}
|
|
109
119
|
}
|
|
110
120
|
if([...this.processes.values()].filter(x=>x.running).length>=this.maxRunningJobs)fail("LOCAL_JOB_LIMIT","Local running job limit reached");
|
|
111
121
|
const id=String(this.nextId++);let child;
|
|
@@ -122,6 +132,7 @@ export class ProcessManager {
|
|
|
122
132
|
|
|
123
133
|
#owned(id,ownerId){this.#cleanup();const s=this.processes.get(String(id));if(!s)fail("LOCAL_JOB_NOT_FOUND","Local job not found");if(s.ownerId!=null&&String(ownerId||"")!==s.ownerId)fail("LOCAL_JOB_NOT_FOUND","Local job not found");return s;}
|
|
124
134
|
output({id,ownerId}={}){const s=this.#owned(id,ownerId);return{id:s.id,stdout:s.stdout,stderr:s.stderr,running:s.running,exitCode:s.exitCode,errorCode:s.errorCode,truncated:s.truncated,timedOut:s.timedOut};}
|
|
135
|
+
async wait({id,ownerId,waitMs=30000}={}){const s=this.#owned(id,ownerId),bounded=Math.max(0,Math.min(Number(waitMs)||0,30000));if(!s.running||bounded===0)return this.output({id,ownerId});await new Promise(resolve=>{let settled=false;const done=()=>{if(settled)return;settled=true;clearTimeout(timer);s.child.off?.("close",done);s.child.off?.("error",done);resolve();};const timer=setTimeout(done,bounded);s.child.once?.("close",done);s.child.once?.("error",done);if(!s.running)done();});return this.output({id,ownerId});}
|
|
125
136
|
input({id,ownerId,data,end=false}={}){const s=this.#owned(id,ownerId);if(!s.running)fail("LOCAL_JOB_NOT_RUNNING","Local job is not running");if(typeof data!=="string")fail("INVALID_ARGUMENT","data must be a string");if(Buffer.byteLength(data,"utf8")>65536)fail("CONTENT_TOO_LARGE","stdin data exceeds 65536 UTF-8 bytes");if(!s.child.stdin||typeof s.child.stdin.write!=="function")fail("LOCAL_STDIN_UNAVAILABLE","Local process stdin is unavailable");if(data.length)s.child.stdin.write(data);if(end){if(typeof s.child.stdin.end!=="function")fail("LOCAL_STDIN_UNAVAILABLE","Local process stdin cannot be closed");s.child.stdin.end();}this.audit({event:"process.input",id,bytes:Buffer.byteLength(data,"utf8"),end:Boolean(end)});return{id:s.id,writtenBytes:Buffer.byteLength(data,"utf8"),ended:Boolean(end)};}
|
|
126
137
|
stop({id,ownerId}={}){const s=this.#owned(id,ownerId);if(s.running)s.child.kill();return{id:s.id,stopping:s.running};}
|
|
127
138
|
}
|
|
@@ -129,7 +129,8 @@ export function createToolExecutor({ security, processManager, remoteExecutionMa
|
|
|
129
129
|
if(tool==="remote.stop"){if(!remoteExecutionManager)throw Object.assign(new Error("Remote execution is not configured"),{code:"REMOTE_JOB_NOT_FOUND"});return remoteExecutionManager.stop(args);}
|
|
130
130
|
if(tool==="process.discover")return processManager.discover(args);
|
|
131
131
|
if(tool==="process.start"){const cwd=security.resolveFilesystemPath(args.cwd);return processManager.start({...args,cwd});}
|
|
132
|
-
if(tool==="process.output")return processManager.output(args);
|
|
132
|
+
if(tool==="process.output")return processManager.output(args);
|
|
133
|
+
if(tool==="process.wait")return processManager.wait(args);
|
|
133
134
|
if(tool==="process.input")return processManager.input(args);
|
|
134
135
|
if(tool==="process.stop")return processManager.stop(args);
|
|
135
136
|
if(tool==="git.status"||tool==="git.diff"||tool==="git.log"){const cwd=security.resolveFilesystemPath(args.cwd);const gitArgs=tool==="git.status"?["status","--porcelain=v1","--branch"]:tool==="git.diff"?["diff","--",...(args.paths||[])]:["log","--oneline","-n",String(Math.min(Number(args.limit||10),50))];const {stdout,stderr}=await execFileAsync("git",gitArgs,{cwd,windowsHide:true,maxBuffer:1024*1024});return{stdout,stderr};}
|