@wrongstack/governance 0.302.0 → 0.303.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.
@@ -1,2 +1,7 @@
1
- export {};
1
+ export interface GovernanceDaemonArguments {
2
+ readonly projectRoot: string;
3
+ readonly projectId: string;
4
+ }
5
+ export declare function parseGovernanceDaemonArguments(argv: readonly string[]): GovernanceDaemonArguments;
6
+ export declare function isGovernanceProjectDaemonEntrypoint(entrypoint?: string | undefined, moduleUrl?: string): boolean;
2
7
  //# sourceMappingURL=project-daemon.d.ts.map
@@ -2,6 +2,7 @@
2
2
  import { randomUUID as randomUUID2 } from "node:crypto";
3
3
  import * as fs3 from "node:fs/promises";
4
4
  import * as path4 from "node:path";
5
+ import { fileURLToPath } from "node:url";
5
6
 
6
7
  // src/daemon-metadata.ts
7
8
  import * as fs from "node:fs/promises";
@@ -5564,7 +5565,7 @@ var GovernanceProjectServer = class {
5564
5565
 
5565
5566
  // src/project-daemon.ts
5566
5567
  var BOOTSTRAP_REQUEST_TIMEOUT_MS = 1e4;
5567
- function parseArguments(argv) {
5568
+ function parseGovernanceDaemonArguments(argv) {
5568
5569
  const values = /* @__PURE__ */ new Map();
5569
5570
  for (let index = 0; index < argv.length; index += 2) {
5570
5571
  const flag = argv[index];
@@ -5582,6 +5583,9 @@ function parseArguments(argv) {
5582
5583
  }
5583
5584
  return { projectRoot: path4.resolve(projectRoot), projectId };
5584
5585
  }
5586
+ function isGovernanceProjectDaemonEntrypoint(entrypoint = process.argv[1], moduleUrl = import.meta.url) {
5587
+ return Boolean(entrypoint && path4.resolve(entrypoint) === path4.resolve(fileURLToPath(moduleUrl)));
5588
+ }
5585
5589
  function send(message, callback) {
5586
5590
  if (!process.send || !process.connected) {
5587
5591
  callback?.(new Error("Governance daemon bootstrap channel is unavailable."));
@@ -5596,7 +5600,7 @@ async function run() {
5596
5600
  if (!process.send || !process.connected) {
5597
5601
  throw new Error("Governance daemon must be launched with a private bootstrap IPC channel.");
5598
5602
  }
5599
- const parsed = parseArguments(process.argv.slice(2));
5603
+ const parsed = parseGovernanceDaemonArguments(process.argv.slice(2));
5600
5604
  const instanceId = randomUUID2();
5601
5605
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
5602
5606
  const metadata = createGovernanceDaemonMetadata({
@@ -5818,8 +5822,14 @@ async function run() {
5818
5822
  }
5819
5823
  });
5820
5824
  }
5821
- void run().catch(() => {
5822
- process.exitCode = 1;
5823
- if (process.connected) process.disconnect?.();
5824
- });
5825
+ if (isGovernanceProjectDaemonEntrypoint()) {
5826
+ void run().catch(() => {
5827
+ process.exitCode = 1;
5828
+ if (process.connected) process.disconnect?.();
5829
+ });
5830
+ }
5831
+ export {
5832
+ isGovernanceProjectDaemonEntrypoint,
5833
+ parseGovernanceDaemonArguments
5834
+ };
5825
5835
  //# sourceMappingURL=project-daemon.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/governance",
3
- "version": "0.302.0",
3
+ "version": "0.303.0",
4
4
  "license": "MIT",
5
5
  "description": "Deterministic workflow contracts and transition policy for WrongStack orchestration.",
6
6
  "repository": {