@cohortapp/agent-sdk 2.3.0 → 2.3.1

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.
Files changed (2) hide show
  1. package/bin/maestro.mjs +18 -1
  2. package/package.json +2 -1
package/bin/maestro.mjs CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  openSync,
24
24
  readSync,
25
25
  closeSync,
26
+ realpathSync,
26
27
  } from "node:fs";
27
28
  import { execFileSync, spawnSync } from "node:child_process";
28
29
  import { createHash } from "node:crypto";
@@ -3511,6 +3512,22 @@ Upgrade workflow (existing agents):
3511
3512
 
3512
3513
  // Dispatch only when invoked as the CLI entrypoint — importing for tests must
3513
3514
  // not run any command (process.argv would be the test runner's argv).
3514
- if (import.meta.url === `file://${process.argv[1]}`) {
3515
+ //
3516
+ // Both sides must be realpath-resolved file URLs. npm installs bins as symlinks
3517
+ // (node_modules/.bin/maestro -> ../@cohortapp/agent-sdk/bin/maestro.mjs) and
3518
+ // import.meta.url is already symlink-resolved, so comparing against a raw
3519
+ // argv[1] never matches and every installed invocation silently no-ops.
3520
+ // pathToFileURL (not `file://` + path) also keeps paths with spaces working.
3521
+ function isCliEntrypoint() {
3522
+ const invoked = process.argv[1];
3523
+ if (!invoked) return false;
3524
+ try {
3525
+ return import.meta.url === pathToFileURL(realpathSync(invoked)).href;
3526
+ } catch {
3527
+ return false;
3528
+ }
3529
+ }
3530
+
3531
+ if (isCliEntrypoint()) {
3515
3532
  await main();
3516
3533
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@cohortapp/agent-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Cohort Agent SDK — autonomous AI colleague runtime. Deploy senior AI colleagues on dedicated Mac minis, wired to the Cohort operating surface.",
5
5
  "type": "module",
6
6
  "bin": {
7
+ "agent-sdk": "./bin/maestro.mjs",
7
8
  "maestro": "./bin/maestro.mjs",
8
9
  "cohort": "./bin/maestro.mjs",
9
10
  "cohort-mcp": "./bin/cohort-mcp.mjs",