@cotal-ai/connector-jcode 0.41.3 → 0.41.4

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/dist/host.js CHANGED
@@ -42764,6 +42764,7 @@ function processPids() {
42764
42764
  throw new Error(`jcode connector: cannot prove Jcode process ownership on unsupported platform ${process.platform}`);
42765
42765
  }
42766
42766
  var processIdentityProbe = {
42767
+ readEnviron: (pid) => readFileSync3(`/proc/${pid}/environ`, "utf8"),
42767
42768
  ps: (pid) => execFileSync2("/bin/ps", ["eww", "-p", String(pid), "-o", "command="], {
42768
42769
  encoding: "utf8",
42769
42770
  stdio: ["ignore", "pipe", "ignore"]
@@ -42790,18 +42791,28 @@ function processHasLaunchIdentityFromPs(pid, identityValue, probe) {
42790
42791
  throw error51;
42791
42792
  }
42792
42793
  }
42793
- function processHasLaunchIdentity(pid, identityValue) {
42794
- if (process.platform === "linux")
42795
- return readFileSync3(`/proc/${pid}/environ`, "utf8").split("\0").includes(`${LAUNCH_IDENTITY_ENV}=${identityValue}`);
42794
+ function launchIdentityProof(pid, identityValue, probe) {
42795
+ if (process.platform === "linux") {
42796
+ let environ;
42797
+ try {
42798
+ environ = probe.readEnviron(pid);
42799
+ } catch (error51) {
42800
+ const code = error51.code;
42801
+ if (code === "ENOENT" || code === "ESRCH" || code === "EACCES" || code === "EPERM") return void 0;
42802
+ throw error51;
42803
+ }
42804
+ if (environ.length === 0) return void 0;
42805
+ return environ.split("\0").includes(`${LAUNCH_IDENTITY_ENV}=${identityValue}`);
42806
+ }
42796
42807
  if (process.platform === "darwin" || process.platform.endsWith("bsd"))
42797
- return processHasLaunchIdentityFromPs(pid, identityValue, processIdentityProbe);
42808
+ return processHasLaunchIdentityFromPs(pid, identityValue, probe);
42798
42809
  throw new Error(`jcode connector: launch-bound process identity is unavailable on ${process.platform}`);
42799
42810
  }
42800
- function captureLaunchProcesses(identityValue) {
42811
+ function captureLaunchProcesses(identityValue, probe = processIdentityProbe) {
42801
42812
  const owned = [];
42802
42813
  for (const pid of processPids()) {
42803
42814
  try {
42804
- if (!processHasLaunchIdentity(pid, identityValue)) continue;
42815
+ if (launchIdentityProof(pid, identityValue, probe) !== true) continue;
42805
42816
  const stat = processStat(pid);
42806
42817
  if (stat) owned.push({ pid: stat.pid, start: stat.start });
42807
42818
  } catch (error51) {
@@ -42917,13 +42928,21 @@ async function stopOrphanedTree(options) {
42917
42928
  return targets;
42918
42929
  }
42919
42930
  async function stopPrivateTree(options) {
42920
- const { jcodeHome, launch, identityValue, gracefulWaitMs = 3e3, killWaitMs = 2e3, settleMs = 500 } = options;
42931
+ const {
42932
+ jcodeHome,
42933
+ launch,
42934
+ identityValue,
42935
+ gracefulWaitMs = 3e3,
42936
+ killWaitMs = 2e3,
42937
+ settleMs = 500,
42938
+ identityProbe = processIdentityProbe
42939
+ } = options;
42921
42940
  const owned = /* @__PURE__ */ new Map();
42922
42941
  const refreshOwned = () => {
42923
- for (const identity of captureLaunchProcesses(identityValue)) owned.set(identity.pid, identity);
42942
+ for (const identity of captureLaunchProcesses(identityValue, identityProbe)) owned.set(identity.pid, identity);
42924
42943
  };
42925
42944
  refreshOwned();
42926
- if (alive(launch.pid) && processMatches(launch) && !owned.has(launch.pid))
42945
+ if (alive(launch.pid) && processMatches(launch) && launchIdentityProof(launch.pid, identityValue, identityProbe) === false)
42927
42946
  throw new Error(`jcode connector: spawned Jcode bridge ${launch.pid} does not carry its launch-bound identity \u2014 refusing unsafe teardown`);
42928
42947
  if (processMatches(launch)) {
42929
42948
  signalPid(launch.pid, "SIGTERM");
@@ -59253,7 +59272,7 @@ config(en_default());
59253
59272
 
59254
59273
  // ../connector-core/dist/docs-bundle.generated.js
59255
59274
  var DOCS_BUNDLE = {
59256
- "version": "0.41.3",
59275
+ "version": "0.41.4",
59257
59276
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
59258
59277
  "pages": [
59259
59278
  {
package/dist/index.js CHANGED
@@ -14840,7 +14840,7 @@ import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAll
14840
14840
 
14841
14841
  // ../connector-core/dist/docs-bundle.generated.js
14842
14842
  var DOCS_BUNDLE = {
14843
- "version": "0.41.3",
14843
+ "version": "0.41.4",
14844
14844
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
14845
14845
  "pages": [
14846
14846
  {
package/dist/mcp.js CHANGED
@@ -57487,7 +57487,7 @@ import { execFileSync } from "node:child_process";
57487
57487
 
57488
57488
  // ../connector-core/dist/docs-bundle.generated.js
57489
57489
  var DOCS_BUNDLE = {
57490
- "version": "0.41.3",
57490
+ "version": "0.41.4",
57491
57491
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
57492
57492
  "pages": [
57493
57493
  {
@@ -8,11 +8,12 @@ export declare function launchIdentityEnv(): {
8
8
  };
9
9
  /** Immutable identity of one process at capture time; throws when the platform cannot prove it. */
10
10
  export declare function captureProcessIdentity(pid: number): ProcessIdentity;
11
- interface ProcessIdentityProbe {
11
+ export interface ProcessIdentityProbe {
12
+ readEnviron: (pid: number) => string;
12
13
  ps: (pid: number) => string;
13
14
  pidExists: (pid: number) => boolean;
14
15
  }
15
- export declare const processHasLaunchIdentityForTest: (pid: number, identityValue: string, probe: ProcessIdentityProbe) => boolean;
16
+ export declare const processHasLaunchIdentityForTest: (pid: number, identityValue: string, probe: Pick<ProcessIdentityProbe, "ps" | "pidExists">) => boolean;
16
17
  /** Every PID this seat's private home records. The caller must still prove ownership. */
17
18
  export declare function recordedTreePids(jcodeHome: string): number[];
18
19
  export interface LaunchRecord {
@@ -63,10 +64,11 @@ export interface StopPrivateTreeOptions {
63
64
  killWaitMs?: number;
64
65
  /** Records must remain absent for this long after the bridge is gone (default 500ms). */
65
66
  settleMs?: number;
67
+ /** Injectable process proof source for direct lifecycle tests. */
68
+ identityProbe?: ProcessIdentityProbe;
66
69
  }
67
70
  /** SIGTERM the launch-owned tree, escalate survivors to SIGKILL, and only return once its records
68
71
  * remain quiescent after the bridge is gone. A stale or reused registry PID is skipped, never
69
72
  * signalled; an unprovable live process is not converted into ownership by location alone. */
70
73
  export declare function stopPrivateTree(options: StopPrivateTreeOptions): Promise<void>;
71
- export {};
72
74
  //# sourceMappingURL=private-lifecycle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"private-lifecycle.d.ts","sourceRoot":"","sources":["../src/private-lifecycle.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAiCD,wBAAgB,iBAAiB,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAElE;AAED,mGAAmG;AACnG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAMnE;AAoBD,UAAU,oBAAoB;IAC5B,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACrC;AA0CD,eAAO,MAAM,+BAA+B,GAC1C,KAAK,MAAM,EACX,eAAe,MAAM,EACrB,OAAO,oBAAoB,KAC1B,OAAoE,CAAC;AAkBxE,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAqB5D;AA4DD,MAAM,WAAW,YAAY;IAC3B,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;+EAC+E;AAC/E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAOrE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAYv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,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-jcode",
3
3
  "description": "Cotal connector for Jcode: a host-mode mesh peer driven through Jcode's Harness API bridge.",
4
- "version": "0.41.3",
4
+ "version": "0.41.4",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "esbuild": "^0.28.0",
30
30
  "tsx": "^4.22.4",
31
31
  "zod": "^4.4.3",
32
- "@cotal-ai/connector-core": "0.41.3",
33
- "@cotal-ai/core": "0.41.3",
34
- "@cotal-ai/smoke-kit": "0.0.0"
32
+ "@cotal-ai/connector-core": "0.41.4",
33
+ "@cotal-ai/smoke-kit": "0.0.0",
34
+ "@cotal-ai/core": "0.41.4"
35
35
  },
36
36
  "files": [
37
37
  "dist"