@mearl/plugin-qoder 3.4.5 → 3.4.6

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.
@@ -7,8 +7,8 @@
7
7
  },
8
8
  "resources": {
9
9
  "runtime.cjs": {
10
- "sha256": "67c8343953c05ebf2d8bb570df9b9b53f8375904b065a5430cb8b9ac8fdbdcf6",
11
- "byteLength": 1105416
10
+ "sha256": "15fa358f4a37a1114a368bbb7a5546db1d2eb798f5c222c90a8bce3ae2050d07",
11
+ "byteLength": 1107684
12
12
  }
13
13
  },
14
14
  "contributions": {
@@ -25033,34 +25033,91 @@ module.exports = __toCommonJS(runtime_exports);
25033
25033
  // src/agent.ts
25034
25034
  var import_node_os3 = __toESM(require("node:os"), 1);
25035
25035
  var import_node_path5 = __toESM(require("node:path"), 1);
25036
- var import_node_child_process2 = require("node:child_process");
25036
+ var import_node_child_process3 = require("node:child_process");
25037
25037
  var import_node_stream = require("node:stream");
25038
25038
 
25039
25039
  // ../agent-runtime/dist/executable-resolver.js
25040
- var import_node_fs2 = __toESM(require("node:fs"), 1);
25041
- var import_node_child_process = require("node:child_process");
25040
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
25041
+ var import_node_child_process2 = require("node:child_process");
25042
25042
  var import_node_path3 = __toESM(require("node:path"), 1);
25043
25043
 
25044
+ // ../daemon-core/dist/process.js
25045
+ var import_node_fs = require("node:fs");
25046
+ var import_node_child_process = require("node:child_process");
25047
+ function linuxProcessStat(pid) {
25048
+ const stat = (0, import_node_fs.readFileSync)(`/proc/${pid}/stat`, "utf8");
25049
+ const end = stat.lastIndexOf(")");
25050
+ const fields = stat.slice(end + 2).trim().split(/\s+/);
25051
+ const group = Number(fields[2]);
25052
+ const threads = Number(fields[17]);
25053
+ if (end < 0 || !/^[A-Za-z]$/.test(fields[0]) || !Number.isSafeInteger(group) || group < 0 || !Number.isSafeInteger(threads) || threads < 0 || !/^\d+$/.test(fields[19] ?? ""))
25054
+ throw new Error("Invalid Linux process stat");
25055
+ return { state: fields[0], group, threads, identity: fields[19] };
25056
+ }
25057
+ function processIdentity(pid) {
25058
+ if (!Number.isSafeInteger(pid) || pid < 1)
25059
+ return void 0;
25060
+ try {
25061
+ if (process.platform === "linux") {
25062
+ return linuxProcessStat(pid).identity;
25063
+ }
25064
+ const result = process.platform === "win32" ? (0, import_node_child_process.spawnSync)("powershell.exe", [
25065
+ "-NoProfile",
25066
+ "-NonInteractive",
25067
+ "-Command",
25068
+ `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate.ToUniversalTime().Ticks`
25069
+ ], { encoding: "utf8", timeout: 2e3, windowsHide: true }) : (0, import_node_child_process.spawnSync)("ps", ["-p", String(pid), "-o", "lstart="], {
25070
+ encoding: "utf8",
25071
+ timeout: 2e3
25072
+ });
25073
+ return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
25074
+ } catch {
25075
+ return void 0;
25076
+ }
25077
+ }
25078
+
25044
25079
  // ../daemon-core/dist/paths.js
25045
25080
  var import_node_path = require("node:path");
25046
25081
  var import_node_os = require("node:os");
25047
25082
  var DAEMON_HOME = (0, import_node_path.join)((0, import_node_os.homedir)(), ".mearl");
25048
25083
 
25049
25084
  // ../daemon-core/dist/registry.js
25085
+ var import_node_fs2 = __toESM(require("node:fs"), 1);
25050
25086
  var lockWaitBuffer = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
25087
+ function readLinuxBootFile(file2) {
25088
+ if (process.platform !== "linux")
25089
+ return void 0;
25090
+ try {
25091
+ return (0, import_node_fs2.readFileSync)(file2, "utf8").trim();
25092
+ } catch {
25093
+ return void 0;
25094
+ }
25095
+ }
25096
+ var linuxBootId = readLinuxBootFile("/proc/sys/kernel/random/boot_id");
25097
+ var linuxBootTime = Number(readLinuxBootFile("/proc/stat")?.match(/^btime (\d+)$/m)?.[1]) * 1e3;
25098
+ function linuxDaemonOwner(pid) {
25099
+ if (process.platform !== "linux")
25100
+ return {};
25101
+ const identity = processIdentity(pid);
25102
+ return {
25103
+ ...linuxBootId ? { bootId: linuxBootId } : {},
25104
+ ...identity ? { processIdentity: identity } : {}
25105
+ };
25106
+ }
25107
+ var currentLinuxOwner = linuxDaemonOwner(process.pid);
25051
25108
 
25052
25109
  // ../daemon-core/dist/log.js
25053
25110
  var DEFAULT_MAX_LOG_BYTES = 5 * 1024 * 1024;
25054
25111
 
25055
25112
  // ../daemon-core/dist/command.js
25056
- var import_node_fs = __toESM(require("node:fs"), 1);
25113
+ var import_node_fs3 = __toESM(require("node:fs"), 1);
25057
25114
  var import_node_path2 = __toESM(require("node:path"), 1);
25058
25115
  var import_node_async_hooks = require("node:async_hooks");
25059
25116
  var ownedCommands = new import_node_async_hooks.AsyncLocalStorage();
25060
25117
  function versionManagerExecutableCandidates(home, names, options = {}) {
25061
25118
  const env = options.env ?? process.env;
25062
25119
  const platform = options.platform ?? process.platform;
25063
- const readdirSync = options.readdirSync ?? import_node_fs.default.readdirSync;
25120
+ const readdirSync3 = options.readdirSync ?? import_node_fs3.default.readdirSync;
25064
25121
  const fnmDefaultRoot = env.XDG_DATA_HOME ? import_node_path2.default.join(env.XDG_DATA_HOME, "fnm") : platform === "darwin" ? import_node_path2.default.join(home, "Library", "Application Support", "fnm") : platform === "win32" && env.APPDATA ? import_node_path2.default.join(env.APPDATA, "fnm") : import_node_path2.default.join(home, ".local", "share", "fnm");
25065
25122
  const roots = [
25066
25123
  import_node_path2.default.join(env.NVM_DIR || import_node_path2.default.join(home, ".nvm"), "versions", "node"),
@@ -25069,7 +25126,7 @@ function versionManagerExecutableCandidates(home, names, options = {}) {
25069
25126
  ].filter((root, index, all) => all.indexOf(root) === index);
25070
25127
  return roots.flatMap((root) => {
25071
25128
  try {
25072
- return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).sort((left, right) => right.name.localeCompare(left.name, void 0, { numeric: true })).flatMap((entry) => names.flatMap((name) => [
25129
+ return readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).sort((left, right) => right.name.localeCompare(left.name, void 0, { numeric: true })).flatMap((entry) => names.flatMap((name) => [
25073
25130
  import_node_path2.default.join(root, entry.name, "bin", name),
25074
25131
  import_node_path2.default.join(root, entry.name, "installation", "bin", name)
25075
25132
  ]));
@@ -25109,7 +25166,7 @@ function prependPathDirectory(directory, env = process.env) {
25109
25166
  }
25110
25167
 
25111
25168
  // ../agent-runtime/dist/executable-resolver.js
25112
- function agentExecutableCandidatePaths({ executableNames, configuredPath, env = process.env, extraUserCandidates = [], home, platform = process.platform, processExecPath = process.execPath, readdirSync }) {
25169
+ function agentExecutableCandidatePaths({ executableNames, configuredPath, env = process.env, extraUserCandidates = [], home, platform = process.platform, processExecPath = process.execPath, readdirSync: readdirSync3 }) {
25113
25170
  const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path") || "PATH";
25114
25171
  const pathCandidates = (env[pathKey] || "").split(import_node_path3.default.delimiter).filter(Boolean).flatMap((directory) => executableNames.map((name) => import_node_path3.default.join(directory, name)));
25115
25172
  const commonUserDirectories = [
@@ -25130,7 +25187,7 @@ function agentExecutableCandidatePaths({ executableNames, configuredPath, env =
25130
25187
  ...versionManagerExecutableCandidates(home, executableNames, {
25131
25188
  env,
25132
25189
  platform,
25133
- readdirSync
25190
+ readdirSync: readdirSync3
25134
25191
  }),
25135
25192
  ...systemDirectories.flatMap((directory) => executableNames.map((name) => import_node_path3.default.join(directory, name))),
25136
25193
  ...pathCandidates
@@ -25261,7 +25318,7 @@ function probeAgentExecutable(executable, options) {
25261
25318
  let settled = false;
25262
25319
  let stderr = "";
25263
25320
  const launch = resolveSpawnCommand(executable, options.args);
25264
- const child = (0, import_node_child_process.spawn)(launch.command, launch.args, {
25321
+ const child = (0, import_node_child_process2.spawn)(launch.command, launch.args, {
25265
25322
  stdio: ["ignore", "ignore", "pipe"],
25266
25323
  windowsHide: true,
25267
25324
  windowsVerbatimArguments: launch.windowsVerbatimArguments,
@@ -25294,21 +25351,21 @@ function probeAgentExecutable(executable, options) {
25294
25351
  }
25295
25352
  function isExecutableFile(candidate) {
25296
25353
  try {
25297
- import_node_fs2.default.accessSync(candidate, process.platform === "win32" ? import_node_fs2.default.constants.F_OK : import_node_fs2.default.constants.X_OK);
25298
- return import_node_fs2.default.statSync(candidate).isFile();
25354
+ import_node_fs4.default.accessSync(candidate, process.platform === "win32" ? import_node_fs4.default.constants.F_OK : import_node_fs4.default.constants.X_OK);
25355
+ return import_node_fs4.default.statSync(candidate).isFile();
25299
25356
  } catch {
25300
25357
  return false;
25301
25358
  }
25302
25359
  }
25303
25360
 
25304
25361
  // ../agent-runtime/dist/qoder-executable.js
25305
- var import_node_fs3 = __toESM(require("node:fs"), 1);
25362
+ var import_node_fs5 = __toESM(require("node:fs"), 1);
25306
25363
  var import_node_os2 = __toESM(require("node:os"), 1);
25307
25364
  var import_node_path4 = __toESM(require("node:path"), 1);
25308
- function qoderManagedExecutableCandidates(home, readdirSync = import_node_fs3.default.readdirSync) {
25365
+ function qoderManagedExecutableCandidates(home, readdirSync3 = import_node_fs5.default.readdirSync) {
25309
25366
  const directory = import_node_path4.default.join(home, ".qoder", "bin", "qodercli");
25310
25367
  try {
25311
- return readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.startsWith("qodercli-")).sort((left, right) => right.name.localeCompare(left.name, void 0, { numeric: true })).map((entry) => import_node_path4.default.join(directory, entry.name));
25368
+ return readdirSync3(directory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.startsWith("qodercli-")).sort((left, right) => right.name.localeCompare(left.name, void 0, { numeric: true })).map((entry) => import_node_path4.default.join(directory, entry.name));
25312
25369
  } catch {
25313
25370
  return [];
25314
25371
  }
@@ -25825,7 +25882,7 @@ ${message}` : message;
25825
25882
  if (lifecycle !== this.lifecycle) throw new Error("Qoder provider disposed during startup");
25826
25883
  this.sdk = sdk;
25827
25884
  const launch = resolveSpawnCommand(executable, ["--acp"]);
25828
- const child = (0, import_node_child_process2.spawn)(launch.command, launch.args, {
25885
+ const child = (0, import_node_child_process3.spawn)(launch.command, launch.args, {
25829
25886
  stdio: ["pipe", "pipe", "pipe"],
25830
25887
  windowsHide: true,
25831
25888
  windowsVerbatimArguments: launch.windowsVerbatimArguments,
@@ -26178,7 +26235,7 @@ ${message}` : message;
26178
26235
  runSkillsList(executable, cwd) {
26179
26236
  return new Promise((resolve2, reject) => {
26180
26237
  const launch = resolveSpawnCommand(executable, ["skill", "list", "--all"]);
26181
- const child = (0, import_node_child_process2.spawn)(launch.command, launch.args, {
26238
+ const child = (0, import_node_child_process3.spawn)(launch.command, launch.args, {
26182
26239
  cwd,
26183
26240
  stdio: ["ignore", "pipe", "pipe"],
26184
26241
  windowsHide: true,
@@ -27031,10 +27088,10 @@ function resolveActionTimeoutSec(action, data, fallback = 15) {
27031
27088
  }
27032
27089
 
27033
27090
  // src/auth.ts
27034
- var import_node_fs4 = require("node:fs");
27091
+ var import_node_fs6 = require("node:fs");
27035
27092
  var import_node_os4 = require("node:os");
27036
27093
  var import_node_path6 = require("node:path");
27037
- var import_node_child_process3 = require("node:child_process");
27094
+ var import_node_child_process4 = require("node:child_process");
27038
27095
  var QODER_TOKEN_KEY = "QODER_PERSONAL_ACCESS_TOKEN";
27039
27096
  var QODER_KEYCHAIN_SERVICE = "ai.mearl.qoder.pat";
27040
27097
  function qoderAuthenticationHint(platform = process.platform) {
@@ -27071,10 +27128,10 @@ function envValue(text, key) {
27071
27128
  }
27072
27129
  function readMacKeychainToken() {
27073
27130
  const securityPath = "/usr/bin/security";
27074
- if (!(0, import_node_fs4.existsSync)(securityPath)) return void 0;
27131
+ if (!(0, import_node_fs6.existsSync)(securityPath)) return void 0;
27075
27132
  try {
27076
27133
  const account = (0, import_node_os4.userInfo)().username;
27077
- const result = (0, import_node_child_process3.spawnSync)(
27134
+ const result = (0, import_node_child_process4.spawnSync)(
27078
27135
  securityPath,
27079
27136
  ["find-generic-password", "-a", account, "-s", QODER_KEYCHAIN_SERVICE, "-w"],
27080
27137
  {
@@ -27100,7 +27157,7 @@ function resolveQoderPersonalAccessToken(options = {}) {
27100
27157
  ...env.MEARL_ENV_FILE?.trim() ? [(0, import_node_path6.resolve)(env.MEARL_ENV_FILE)] : [],
27101
27158
  (0, import_node_path6.resolve)(homeDirectory, ".mearl", ".env")
27102
27159
  ];
27103
- const readFile = options.readFile ?? ((file2) => (0, import_node_fs4.readFileSync)(file2, "utf8"));
27160
+ const readFile = options.readFile ?? ((file2) => (0, import_node_fs6.readFileSync)(file2, "utf8"));
27104
27161
  for (const file2 of new Set(envFiles)) {
27105
27162
  try {
27106
27163
  const token = envValue(readFile(file2), QODER_TOKEN_KEY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/plugin-qoder",
3
- "version": "3.4.5",
3
+ "version": "3.4.6",
4
4
  "description": "Optional Qoder CLI agent and cloud connector capability for Mearl",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -27,10 +27,10 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@agentclientprotocol/sdk": "^1.2.1",
30
- "@mearl/browser-core": "3.4.5",
31
- "@mearl/cloud-connector": "3.4.5",
32
- "@mearl/client": "3.4.5",
33
- "@mearl/agent-runtime": "3.4.5"
30
+ "@mearl/agent-runtime": "3.4.6",
31
+ "@mearl/browser-core": "3.4.6",
32
+ "@mearl/client": "3.4.6",
33
+ "@mearl/cloud-connector": "3.4.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "^5.8.3",