@brainervirus/workit-pi 8.9.1 → 8.10.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.
package/dist/worker.js CHANGED
@@ -8305,6 +8305,15 @@ var ENVELOPE = new Set([
8305
8305
  "expectedWorkspaceRevision",
8306
8306
  "judgment"
8307
8307
  ]);
8308
+ // packages/workit-core/src/host-session.ts
8309
+ var OWN_CHILD_SHELL = new Set(["opencode", "pi"]);
8310
+ var SESSION_UNSAFE = /[^A-Za-z0-9_.:@/+-]/g;
8311
+ function childSessionId(lead, child) {
8312
+ const leaf = child.replace(SESSION_UNSAFE, "-").slice(-120);
8313
+ const prefix = lead.replace(SESSION_UNSAFE, "-").slice(0, 127 - leaf.length);
8314
+ return prefix ? `${prefix}:${leaf}` : leaf;
8315
+ }
8316
+
8308
8317
  // packages/workit-core/src/core/package-root.ts
8309
8318
  import { existsSync } from "node:fs";
8310
8319
  import path from "node:path";
@@ -8804,7 +8813,7 @@ function launchWorker(assignment, options) {
8804
8813
  WORKIT_PI_WORKER_ID: workerId ?? "",
8805
8814
  WORKIT_PI_WORKER_SESSION: sessionId,
8806
8815
  WORKIT_HOST: "pi",
8807
- WORKIT_SESSION_ID: sessionId,
8816
+ WORKIT_SESSION_ID: options.leadSession ? childSessionId(options.leadSession, sessionId) : sessionId,
8808
8817
  WORKIT_PI_WORKER_ROLE: assignment.role,
8809
8818
  WORKIT_PI_WORKER_SCOPE: JSON.stringify(assignment.scope)
8810
8819
  };