qlogicagent 2.23.6 → 2.23.8

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.
@@ -1 +1 @@
1
- import*as n from"node:fs";import*as r from"node:path";import{execFile as N}from"node:child_process";import{promisify as h}from"node:util";function E(){let e=process.env.XIAOZHICLAW_NODE_EXE,t=process.env.XIAOZHICLAW_NPM_CLI;return!e||!t?null:{nodeExe:e,npmCli:t,prefix:process.env.XIAOZHICLAW_NPM_GLOBAL_PREFIX||void 0}}function k(e){let t={...process.env,ELECTRON_RUN_AS_NODE:"1"};return e.prefix&&(t.npm_config_prefix=e.prefix),t}function w(e,t){return e?{file:e.nodeExe,argv:[e.npmCli,...t],env:k(e)}:{file:"npm",argv:t}}function y(e){if(!r.isAbsolute(e))throw new Error("marketplace compute requires an absolute gateway stageDir");let t=r.resolve(e);if(!n.statSync(t).isDirectory())throw new Error(`marketplace compute stageDir is not a directory: ${t}`);return t}async function R(e,t,g={}){let o=e.specifier.trim();if(!o||o.includes("\0"))throw new Error("marketplace compute requires a non-empty npm specifier");let c=y(e.stageDir),a=r.join(c,"content");if(n.existsSync(a))throw new Error(`marketplace compute content stage already exists: ${a}`);let u=g.execFile??h(N),f=(g.resolveNpm??E)(),v=e.version?`${o}@${e.version}`:o,l=w(f,["pack",v,"--pack-destination",c]),p=(await u(l.file,l.argv,{cwd:c,timeout:6e4,windowsHide:!0,...l.env?{env:l.env}:{}})).stdout.trim().split(/\r?\n/).at(-1)?.trim();if(!p||r.basename(p)!==p||!p.endsWith(".tgz"))throw new Error(`marketplace compute npm pack returned an invalid artifact name for ${v}`);let d=r.join(c,p);n.mkdirSync(a);try{await u("tar",["xzf",d,"-C",a,"--strip-components=1"],{cwd:c,timeout:3e4,windowsHide:!0})}finally{try{n.unlinkSync(d)}catch{}}let x=r.join(a,"package.json"),s;try{s=JSON.parse(n.readFileSync(x,"utf8"))}catch(i){throw new Error(`marketplace compute unpacked package has no valid package.json: ${i instanceof Error?i.message:String(i)}`)}if(s.name!==o)throw new Error(`marketplace compute package identity mismatch: requested ${o}, unpacked ${String(s.name)}`);if(typeof s.version!="string"||!s.version.trim())throw new Error("marketplace compute unpacked package has no version");let m=w(f,["install","--production","--no-save"]);try{await u(m.file,m.argv,{cwd:a,timeout:12e4,windowsHide:!0,...m.env?{env:m.env}:{}})}catch(i){throw t.warn(`[marketplace] npm install for ${o} failed; staged plugin may be incomplete: ${i instanceof Error?i.message:String(i)}`),i}return t.info(`[marketplace] staged ${o}@${s.version} for gateway adoption`),{name:o,version:s.version,contentDir:a}}export{w as resolveNpmExec,R as stageMarketplaceNpmPlugin};
1
+ import*as r from"node:fs";import*as t from"node:path";import{execFile as h}from"node:child_process";import{promisify as y}from"node:util";function N(e){return/(?:^|[\\/])node(?:\.exe)?$/i.test(e)}function k(){let e=process.env.XIAOZHICLAW_NODE_EXE,n=process.env.XIAOZHICLAW_NPM_CLI;if(!e||!n)return null;if(!N(e))throw new Error("XIAOZHICLAW_NODE_EXE must reference the Host-vetted standard Node executable");return{nodeExe:e,npmCli:n,prefix:process.env.XIAOZHICLAW_NPM_GLOBAL_PREFIX||void 0}}function E(e){let n={...process.env};return delete n.ELECTRON_RUN_AS_NODE,e.prefix&&(n.npm_config_prefix=e.prefix),n}function w(e,n){return e?{file:e.nodeExe,argv:[e.npmCli,...n],env:E(e)}:{file:"npm",argv:n}}function S(e){if(!t.isAbsolute(e))throw new Error("marketplace compute requires an absolute gateway stageDir");let n=t.resolve(e);if(!r.statSync(n).isDirectory())throw new Error(`marketplace compute stageDir is not a directory: ${n}`);return n}async function A(e,n,d={}){let i=e.specifier.trim();if(!i||i.includes("\0"))throw new Error("marketplace compute requires a non-empty npm specifier");let c=S(e.stageDir),a=t.join(c,"content");if(r.existsSync(a))throw new Error(`marketplace compute content stage already exists: ${a}`);let u=d.execFile??y(h),g=(d.resolveNpm??k)(),f=e.version?`${i}@${e.version}`:i,l=w(g,["pack",f,"--pack-destination",c]),p=(await u(l.file,l.argv,{cwd:c,timeout:6e4,windowsHide:!0,...l.env?{env:l.env}:{}})).stdout.trim().split(/\r?\n/).at(-1)?.trim();if(!p||t.basename(p)!==p||!p.endsWith(".tgz"))throw new Error(`marketplace compute npm pack returned an invalid artifact name for ${f}`);let v=t.join(c,p);r.mkdirSync(a);try{await u("tar",["xzf",v,"-C",a,"--strip-components=1"],{cwd:c,timeout:3e4,windowsHide:!0})}finally{try{r.unlinkSync(v)}catch{}}let x=t.join(a,"package.json"),s;try{s=JSON.parse(r.readFileSync(x,"utf8"))}catch(o){throw new Error(`marketplace compute unpacked package has no valid package.json: ${o instanceof Error?o.message:String(o)}`)}if(s.name!==i)throw new Error(`marketplace compute package identity mismatch: requested ${i}, unpacked ${String(s.name)}`);if(typeof s.version!="string"||!s.version.trim())throw new Error("marketplace compute unpacked package has no version");let m=w(g,["install","--production","--no-save"]);try{await u(m.file,m.argv,{cwd:a,timeout:12e4,windowsHide:!0,...m.env?{env:m.env}:{}})}catch(o){throw n.warn(`[marketplace] npm install for ${i} failed; staged plugin may be incomplete: ${o instanceof Error?o.message:String(o)}`),o}return n.info(`[marketplace] staged ${i}@${s.version} for gateway adoption`),{name:i,version:s.version,contentDir:a}}export{w as resolveNpmExec,A as stageMarketplaceNpmPlugin};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Desktop-owned standard Node/npm projection.
3
+ *
4
+ * Packaged desktop products expose their vetted standard Node executable, bundled npm CLI and
5
+ * writable package prefix through Host-owned environment variables. Development, CI and server
6
+ * deployments omit those variables and retain their ambient npm behavior.
7
+ */
8
+ /** Resolved desktop npm runtime (all paths absolute). */
9
+ export interface BundledNpmRuntime {
10
+ /** Host-vetted standard Node executable. */
11
+ nodeExe: string;
12
+ /** Bundled npm CLI entry (`node_modules/npm/bin/npm-cli.js`). */
13
+ npmCli: string;
14
+ /** Writable global-install prefix, or undefined if the Host set none. */
15
+ prefix?: string;
16
+ }
17
+ /** Resolve the desktop npm runtime from env, or null outside the packaged desktop product. */
18
+ export declare function resolveBundledNpm(): BundledNpmRuntime | null;
19
+ /** Build the environment for a desktop-owned npm invocation. */
20
+ export declare function bundledNpmEnv(runtime: BundledNpmRuntime): NodeJS.ProcessEnv;
21
+ /** True when `command` is an npm invocation the bundled runtime should handle. */
22
+ export declare function isNpmCommand(command: string): boolean;
23
+ export declare function isForeignInstaller(command: string): boolean;
24
+ /** A copy of process.env with ELECTRON_RUN_AS_NODE stripped for non-Node installers. */
25
+ export declare function envWithoutElectronRunAsNode(): NodeJS.ProcessEnv;
@@ -1,4 +1,4 @@
1
- import { type ElectronNpm } from "../../runtime/infra/electron-node.js";
1
+ import { type BundledNpmRuntime } from "../../runtime/infra/bundled-node.js";
2
2
  export interface MarketplaceSource {
3
3
  type: "npm" | "git" | "url";
4
4
  specifier: string;
@@ -30,10 +30,10 @@ type ExecResult = {
30
30
  };
31
31
  type ExecFile = (file: string, args: string[], options: Record<string, unknown>) => Promise<ExecResult>;
32
32
  export interface MarketplaceComputeDeps {
33
- resolveNpm?: () => ElectronNpm | null;
33
+ resolveNpm?: () => BundledNpmRuntime | null;
34
34
  execFile?: ExecFile;
35
35
  }
36
- export declare function resolveNpmExec(bridge: ElectronNpm | null, args: string[]): {
36
+ export declare function resolveNpmExec(runtime: BundledNpmRuntime | null, args: string[]): {
37
37
  file: string;
38
38
  argv: string[];
39
39
  env?: NodeJS.ProcessEnv;
@@ -91,7 +91,7 @@ export interface SearchToolDeps {
91
91
  * The implementation may use ripgrep, native grep, or a custom engine.
92
92
  * Returns match records.
93
93
  * The host SHOULD auto-exclude VCS directories (.git, .svn, .hg, .bzr)
94
- * and enforcemax-columns 500 to avoid minified file noise.
94
+ * and enforce max-columns 500 to avoid minified file noise.
95
95
  */
96
96
  grep(pattern: string, options: {
97
97
  cwd: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlogicagent",
3
- "version": "2.23.6",
3
+ "version": "2.23.8",
4
4
  "packageManager": "pnpm@10.23.0",
5
5
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
6
6
  "type": "module",
@@ -170,7 +170,7 @@
170
170
  "dependencies": {
171
171
  "@agentclientprotocol/sdk": "^0.25.0",
172
172
  "@napi-rs/canvas": "0.1.100",
173
- "@xiaozhiclaw/module-sdk": "0.4.0",
173
+ "@xiaozhiclaw/module-sdk": "0.4.1",
174
174
  "@xiaozhiclaw/provider-core": "0.1.34",
175
175
  "ajv": "8.20.0",
176
176
  "better-sqlite3": "^12.10.0",
@@ -1,36 +0,0 @@
1
- /**
2
- * Desktop (Electron-as-Node) npm bridge.
3
- *
4
- * The packaged desktop app is the ONLY Node/npm on a terminal user's machine: most machines have no
5
- * system Node, so `npm i -g <agent>` through a plain shell fails with "'npm' is not recognized". The
6
- * desktop ships npm INSIDE the runtime and exposes, via env, how to run it — `AstraClaw.exe npm-cli.js …`
7
- * with ELECTRON_RUN_AS_NODE=1 (process.execPath runs as pure Node). These helpers let the install runner
8
- * and the CLI detector drive THAT npm instead of a missing system npm.
9
- *
10
- * The env vars are set by the Electron shell (embedded-gateway) before it spawns the gateway that hosts
11
- * qlogicagent. In every other environment (dev with a real Node, CI, tests, the cloud server) they are
12
- * absent and {@link resolveElectronNpm} returns null, so callers fall back to the system `npm` unchanged.
13
- */
14
- /** Resolved desktop npm bridge (all paths absolute). */
15
- export interface ElectronNpm {
16
- /** The app binary (process.execPath), run as Node via ELECTRON_RUN_AS_NODE=1. */
17
- nodeExe: string;
18
- /** Bundled npm's CLI entry (…/node_modules/npm/bin/npm-cli.js). */
19
- npmCli: string;
20
- /** Writable global-install prefix (~/.xiaozhiclaw-agents/npm-global), or undefined if the shell set none. */
21
- prefix?: string;
22
- }
23
- /** Resolve the desktop npm bridge from env, or null when not running under the packaged desktop app. */
24
- export declare function resolveElectronNpm(): ElectronNpm | null;
25
- /**
26
- * Build the env for a desktop npm invocation. CRITICAL: it KEEPS ELECTRON_RUN_AS_NODE=1 — npm shells out
27
- * to `node` for lifecycle scripts / node-gyp, and those grandchildren must run as Node too, not pop the
28
- * Electron GUI. Pins npm_config_prefix to the writable global prefix so `npm i -g` installs there (never
29
- * read-only Program Files → EACCES) and `npm root -g` reports that same location for version detection.
30
- */
31
- export declare function electronNpmEnv(bridge: ElectronNpm): NodeJS.ProcessEnv;
32
- /** True when `command` is an npm invocation the bridge should handle (checked after any mirror rewrite). */
33
- export declare function isNpmCommand(command: string): boolean;
34
- export declare function isForeignInstaller(command: string): boolean;
35
- /** A copy of process.env with ELECTRON_RUN_AS_NODE stripped, for spawning non-Node foreign installers. */
36
- export declare function envWithoutElectronRunAsNode(): NodeJS.ProcessEnv;