wicked-crew 0.12.4 → 0.13.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.
Files changed (74) hide show
  1. package/dist/api/auth.d.ts +1 -1
  2. package/dist/api/auth.d.ts.map +1 -1
  3. package/dist/api/auth.js +10 -9
  4. package/dist/api/auth.js.map +1 -1
  5. package/dist/api/elicitation-cache.d.ts +18 -0
  6. package/dist/api/elicitation-cache.d.ts.map +1 -1
  7. package/dist/api/elicitation-cache.js +15 -0
  8. package/dist/api/elicitation-cache.js.map +1 -1
  9. package/dist/api/eval-sample.d.ts +12 -12
  10. package/dist/api/governance-steering.d.ts +8 -8
  11. package/dist/api/mcp.d.ts +4 -2
  12. package/dist/api/mcp.d.ts.map +1 -1
  13. package/dist/api/mcp.js +12 -0
  14. package/dist/api/mcp.js.map +1 -1
  15. package/dist/api/product.d.ts +4 -4
  16. package/dist/api/routes.d.ts +22 -20
  17. package/dist/api/routes.d.ts.map +1 -1
  18. package/dist/api/routes.js +1 -0
  19. package/dist/api/routes.js.map +1 -1
  20. package/dist/api/seat-agents.d.ts.map +1 -1
  21. package/dist/api/seat-agents.js +2 -1
  22. package/dist/api/seat-agents.js.map +1 -1
  23. package/dist/api/seat-container-login.d.ts +5 -0
  24. package/dist/api/seat-container-login.d.ts.map +1 -1
  25. package/dist/api/seat-container-login.js +11 -0
  26. package/dist/api/seat-container-login.js.map +1 -1
  27. package/dist/api/seat-governance.d.ts +13 -10
  28. package/dist/api/seat-governance.d.ts.map +1 -1
  29. package/dist/api/seat-governance.js +87 -54
  30. package/dist/api/seat-governance.js.map +1 -1
  31. package/dist/api/server.d.ts.map +1 -1
  32. package/dist/api/server.js +4 -0
  33. package/dist/api/server.js.map +1 -1
  34. package/dist/api/testing.d.ts +2 -2
  35. package/dist/cli/index.d.ts.map +1 -1
  36. package/dist/cli/index.js +8 -16
  37. package/dist/cli/index.js.map +1 -1
  38. package/dist/core/adapter.d.ts +6 -0
  39. package/dist/core/adapter.d.ts.map +1 -1
  40. package/dist/core/adapter.js +35 -0
  41. package/dist/core/adapter.js.map +1 -1
  42. package/dist/core/bridge-reaper.d.ts +3 -4
  43. package/dist/core/bridge-reaper.d.ts.map +1 -1
  44. package/dist/core/bridge-reaper.js +3 -4
  45. package/dist/core/bridge-reaper.js.map +1 -1
  46. package/dist/core/types.d.ts +29 -0
  47. package/dist/core/types.d.ts.map +1 -1
  48. package/dist/core/types.js +14 -0
  49. package/dist/core/types.js.map +1 -1
  50. package/dist/mcp/ask-server.d.ts +40 -0
  51. package/dist/mcp/ask-server.d.ts.map +1 -0
  52. package/dist/mcp/ask-server.js +268 -0
  53. package/dist/mcp/ask-server.js.map +1 -0
  54. package/dist/projects/routes.d.ts +4 -4
  55. package/dist/studio/assets/{index-56V_Dtuh.js → index-C1LBAnY7.js} +145 -145
  56. package/dist/studio/assets/index-DKX8JGG5.css +32 -0
  57. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  58. package/dist/studio/editors/wicked-deck/index.html +1 -1
  59. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  60. package/dist/studio/editors/wicked-doc/index.html +1 -1
  61. package/dist/studio/editors/wicked-page/editor.json +1 -1
  62. package/dist/studio/editors/wicked-page/index.html +1 -1
  63. package/dist/studio/editors/wicked-video/editor.json +1 -1
  64. package/dist/studio/editors/wicked-video/index.html +1 -1
  65. package/dist/studio/index.html +2 -2
  66. package/dist/studio/testid-inventory.json +9 -3
  67. package/dist/team/routes.d.ts +2 -2
  68. package/endpoint-manifest.json +29 -0
  69. package/package.json +3 -7
  70. package/dist/core/bridge-path.d.ts +0 -87
  71. package/dist/core/bridge-path.d.ts.map +0 -1
  72. package/dist/core/bridge-path.js +0 -205
  73. package/dist/core/bridge-path.js.map +0 -1
  74. package/dist/studio/assets/index-D1WKb58Z.css +0 -32
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "wicked-deck",
3
3
  "title": "Slides",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "protocol": [
6
6
  1,
7
7
  2
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="wicked-editor" content="wicked-deck">
6
- <meta name="wicked-editor-version" content="0.9.4">
6
+ <meta name="wicked-editor-version" content="0.9.5">
7
7
  <title>Slides</title>
8
8
  <style>
9
9
  /* The editor's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "wicked-doc",
3
3
  "title": "Document",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "protocol": [
6
6
  1,
7
7
  2
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="wicked-editor" content="wicked-doc">
6
- <meta name="wicked-editor-version" content="0.9.4">
6
+ <meta name="wicked-editor-version" content="0.9.5">
7
7
  <title>Document</title>
8
8
  <style>
9
9
  /* The plugin's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "wicked-page",
3
3
  "title": "Page",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "protocol": [
6
6
  1,
7
7
  2
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="wicked-editor" content="wicked-page">
6
- <meta name="wicked-editor-version" content="0.9.4">
6
+ <meta name="wicked-editor-version" content="0.9.5">
7
7
  <title>Document</title>
8
8
  <style>
9
9
  /* The plugin's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "wicked-video",
3
3
  "title": "Video",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "protocol": [
6
6
  1,
7
7
  2
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html lang="en"><head><meta charset="utf-8">
3
3
  <meta name="wicked-editor" content="wicked-video">
4
- <meta name="wicked-editor-version" content="0.9.4">
4
+ <meta name="wicked-editor-version" content="0.9.5">
5
5
  <title>Video</title>
6
6
  <style>
7
7
  :root{--surface-base:#fff;--surface-card:#f6f7f9;--surface-raised:#fff;--ink-high:#0d1117;--ink-body:#2b333d;--ink-muted:#5b6673;--border:#d5dae1;--accent:#224a5e;--font-sans:system-ui,sans-serif}
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>wicked-studio</title>
7
- <script type="module" crossorigin src="/assets/index-56V_Dtuh.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-D1WKb58Z.css">
7
+ <script type="module" crossorigin src="/assets/index-C1LBAnY7.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-DKX8JGG5.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -9,11 +9,11 @@
9
9
  "Forwarded ids count: a literal handed to a component through a testId-like prop or key (`testId`, `testid`, `tid`, `triggerTestId`), a parameter typed as a union of id literals, or a string literal marked `/* testid */` is listed as static/dynamic at the call site — the component renders it — so static + dynamic is the whole denominator of ids a surface can show."
10
10
  ],
11
11
  "version": 1,
12
- "studioVersion": "0.9.4",
12
+ "studioVersion": "0.9.5",
13
13
  "counts": {
14
14
  "files": 230,
15
- "occurrences": 2835,
16
- "static": 2445,
15
+ "occurrences": 2836,
16
+ "static": 2446,
17
17
  "dynamic": 72,
18
18
  "computed": 24
19
19
  },
@@ -10921,6 +10921,12 @@
10921
10921
  "src/components/session/SessionView.tsx"
10922
10922
  ]
10923
10923
  },
10924
+ {
10925
+ "testId": "session-working",
10926
+ "files": [
10927
+ "src/components/session/SessionView.tsx"
10928
+ ]
10929
+ },
10924
10930
  {
10925
10931
  "testId": "settings-council-size",
10926
10932
  "files": [
@@ -184,7 +184,7 @@ export declare const PlanPreviewSchema: z.ZodObject<{
184
184
  asked: number;
185
185
  } | undefined;
186
186
  };
187
- deliver?: "none" | "pr" | undefined;
187
+ deliver?: "pr" | "none" | undefined;
188
188
  projectId?: string | undefined;
189
189
  humanConfirm?: string | undefined;
190
190
  repoRef?: string | undefined;
@@ -203,7 +203,7 @@ export declare const PlanPreviewSchema: z.ZodObject<{
203
203
  asked: number;
204
204
  } | undefined;
205
205
  };
206
- deliver?: "none" | "pr" | undefined;
206
+ deliver?: "pr" | "none" | undefined;
207
207
  projectId?: string | undefined;
208
208
  humanConfirm?: string | undefined;
209
209
  repoRef?: string | undefined;
@@ -683,6 +683,35 @@
683
683
  503
684
684
  ]
685
685
  },
686
+ {
687
+ "method": "DELETE",
688
+ "path": "/api/v1/mcp/ask",
689
+ "requestType": null,
690
+ "responseType": null,
691
+ "statusCodes": [
692
+ 405
693
+ ]
694
+ },
695
+ {
696
+ "method": "GET",
697
+ "path": "/api/v1/mcp/ask",
698
+ "requestType": null,
699
+ "responseType": null,
700
+ "statusCodes": [
701
+ 405
702
+ ]
703
+ },
704
+ {
705
+ "method": "POST",
706
+ "path": "/api/v1/mcp/ask",
707
+ "requestType": null,
708
+ "responseType": null,
709
+ "statusCodes": [
710
+ 200,
711
+ 401,
712
+ 503
713
+ ]
714
+ },
686
715
  {
687
716
  "method": "POST",
688
717
  "path": "/api/v1/mcp/call",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew",
3
- "version": "0.12.4",
3
+ "version": "0.13.0",
4
4
  "description": "wicked-crew daemon — thin REST+WS bridge to the wicked-core engine via wicked-core-ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,15 +29,11 @@
29
29
  "start": "node dist/cli/index.js serve"
30
30
  },
31
31
  "dependencies": {
32
- "@agentclientprotocol/claude-agent-acp": "^0.73.0",
33
- "@agentclientprotocol/codex-acp": "^1.1.7",
34
32
  "@fastify/static": "^10.1.2",
35
33
  "@fastify/websocket": "^11.2.0",
36
34
  "@modelcontextprotocol/sdk": "^1.31.0",
37
- "agent-acp-bridges": "^1.3.0",
38
35
  "fastify": "^5.12.5",
39
- "pi-acp": "^0.0.32",
40
- "wicked-core-ts": "^0.11.3",
36
+ "wicked-core-ts": "^0.12.0",
41
37
  "wicked-ledger": "^0.6.0",
42
38
  "yaml": "^2.4.2",
43
39
  "zod": "^3.23.0"
@@ -53,7 +49,7 @@
53
49
  "vitest": "^5.0.2",
54
50
  "wicked-bus": "^2.5.0",
55
51
  "wicked-crew-api-types": "*",
56
- "wicked-studio": "^0.9.4"
52
+ "wicked-studio": "^0.9.5"
57
53
  },
58
54
  "engines": {
59
55
  "node": ">=22.0.0"
@@ -1,87 +0,0 @@
1
- /**
2
- * ACP bridge binary resolution — makes the bridges deployable without any manual step.
3
- *
4
- * wicked-core spawns ACP bridge binaries (`claude-agent-acp`, `codex-acp`, `pi-acp`,
5
- * `agy-acp`) by BARE NAME on PATH. The bridges ship as npm packages (dependencies of
6
- * this package), so after any normal install their launcher shims land in a
7
- * `node_modules/.bin` directory — but nothing puts that directory on the daemon's
8
- * PATH. Requiring users to `npm i -g` the bridge packages (or hand-symlink bins) is
9
- * exactly the kind of install friction that breaks "clone → npm install → run".
10
- *
11
- * FOUR names, and the list is exhaustive on purpose. It used to carry a fifth, for the
12
- * opencode seat — a bridge that no package declares, that no install produces a shim
13
- * for, and that `wicked-core/crates/wicked-council/src/registry.rs` never asks for: the
14
- * opencode seat's `[acp]` block spawns `opencode acp`, the CLI's own NATIVE ACP mode,
15
- * and so does copilot's (`copilot --acp`). A natively-speaking CLI needs no bridge, so
16
- * `ensureBridgesOnPath` could not have helped one and nothing was observed broken — but
17
- * the name existed nowhere except this comment, which is the failure mode the rest of
18
- * this file exists to prevent: a claim about what is installable that no artifact backs
19
- * (FINDING-097). Dropped rather than shipped, and the phantom is not respelled here —
20
- * `bridge-names.test.ts` audits THIS comment for `*-acp` tokens, so writing the dead
21
- * name to explain it would fail the guard that exists to catch it.
22
- *
23
- * `ensureBridgesOnPath()` closes the gap at daemon startup: it walks up from this
24
- * module looking for a `node_modules/.bin` that contains a bridge shim and prepends
25
- * it to `process.env.PATH`. Every subprocess the engine spawns inherits the daemon's
26
- * environment, so the registry's bare binary names resolve in dev checkouts
27
- * (workspace root `.bin`), global installs, and nested-dependency layouts alike.
28
- * A user-installed bridge earlier on PATH still wins for spawn resolution only if
29
- * it appears before ours — we prepend, so the packaged versions take precedence
30
- * and match the engine version they shipped with.
31
- *
32
- * What is prepended is NOT that `.bin` itself (crew#858): `.bin` is crew's whole
33
- * dependency bin directory, and `@agentclientprotocol/codex-acp` depends on
34
- * `@openai/codex`, whose launcher lands there as `codex` — prepending it made every
35
- * bare-name `codex` seat spawn resolve to the vendored CLI instead of the one the
36
- * operator installed and logs into. The daemon prepends a directory that holds ONLY
37
- * links to the four bridges (`claude-agent-acp`, `codex-acp`, `pi-acp`, `agy-acp`)
38
- * and the `wicked-pi` launcher. The precedence above is right for the bridges; a seat
39
- * CLI that rides along as a transitive dependency never gets it. (`codex-acp` itself
40
- * is unaffected: it resolves its bundled codex by module path, not PATH.)
41
- */
42
- /**
43
- * Find the nearest `node_modules/.bin` (walking up from `start`) that contains a
44
- * bridge shim. Returns `null` when none is found — e.g. a checkout before
45
- * `npm install` — in which case PATH is left untouched and the engine's own
46
- * single-shot fallback still applies.
47
- */
48
- export declare function findBridgeBinDir(start: string): string | null;
49
- /**
50
- * The variable the community `pi-acp` adapter reads for the command it spawns as pi
51
- * (`getPiCommand(process.env.PI_ACP_PI_COMMAND)`), and the bin this package's
52
- * `agent-acp-bridges` dependency provides for it: `wicked-pi` turns wicked-core's
53
- * `WICKED_PI_SKILL_DIRS` (the deliverable portable skill dirs of the published snapshot,
54
- * F-079 / wicked-core#441) into pi's `--no-skills --skill <dir>…` and runs pi. Without
55
- * this seam the env contract is inert on the ACP carrier: pi-acp forwards no argv.
56
- */
57
- export declare const PI_ACP_COMMAND_ENV = "PI_ACP_PI_COMMAND";
58
- /**
59
- * The launcher shim in `binDir`, or `null` when this install has none (an older
60
- * `agent-acp-bridges` on the registry — the seat keeps working, skills do not reach pi
61
- * over ACP). Windows shims are `<name>.cmd` and pi-acp starts a `.cmd` through a shell.
62
- */
63
- export declare function piLauncherIn(binDir: string): string | null;
64
- /**
65
- * Point pi-acp at the `wicked-pi` launcher (idempotent; an operator's own
66
- * `PI_ACP_PI_COMMAND` is respected and never overwritten). Returns the command set — or
67
- * already in force — else `null`. Call once at daemon startup, after `ensureBridgesOnPath`.
68
- */
69
- export declare function ensurePiLauncherCommand(start?: string, env?: NodeJS.ProcessEnv): string | null;
70
- /**
71
- * Every bin the bridges-only PATH directory may carry: the four bridges and the pi
72
- * launcher. Nothing else from `.bin` — in particular never a seat CLI (crew#858).
73
- */
74
- export declare const BRIDGE_ONLY_BINS: readonly string[];
75
- /**
76
- * The directory holding ONLY the bridge shims from `binDir` (crew#858), created or
77
- * refreshed: `<node_modules>/.wicked-crew-bridges` beside `.bin`, or — when the install
78
- * is read-only — a fresh per-process directory under the OS temp dir.
79
- */
80
- export declare function bridgesOnlyDir(binDir: string): string;
81
- /**
82
- * Prepend a bridges-only directory (links to the bridge shims of the nearest bridge
83
- * `.bin`) to PATH (idempotent). Returns the prepended directory when bridges were found,
84
- * else `null`. Call once at daemon startup, before the engine spawns anything.
85
- */
86
- export declare function ensureBridgesOnPath(start?: string): string | null;
87
- //# sourceMappingURL=bridge-path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bridge-path.d.ts","sourceRoot":"","sources":["../../src/core/bridge-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAiBH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS7D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAGtD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,GAAE,MAAgD,EACvD,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,GAAG,IAAI,CASf;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAA4E,CAAC;AAoD3H;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,GAAE,MAAgD,GACtD,MAAM,GAAG,IAAI,CAYf"}
@@ -1,205 +0,0 @@
1
- /**
2
- * ACP bridge binary resolution — makes the bridges deployable without any manual step.
3
- *
4
- * wicked-core spawns ACP bridge binaries (`claude-agent-acp`, `codex-acp`, `pi-acp`,
5
- * `agy-acp`) by BARE NAME on PATH. The bridges ship as npm packages (dependencies of
6
- * this package), so after any normal install their launcher shims land in a
7
- * `node_modules/.bin` directory — but nothing puts that directory on the daemon's
8
- * PATH. Requiring users to `npm i -g` the bridge packages (or hand-symlink bins) is
9
- * exactly the kind of install friction that breaks "clone → npm install → run".
10
- *
11
- * FOUR names, and the list is exhaustive on purpose. It used to carry a fifth, for the
12
- * opencode seat — a bridge that no package declares, that no install produces a shim
13
- * for, and that `wicked-core/crates/wicked-council/src/registry.rs` never asks for: the
14
- * opencode seat's `[acp]` block spawns `opencode acp`, the CLI's own NATIVE ACP mode,
15
- * and so does copilot's (`copilot --acp`). A natively-speaking CLI needs no bridge, so
16
- * `ensureBridgesOnPath` could not have helped one and nothing was observed broken — but
17
- * the name existed nowhere except this comment, which is the failure mode the rest of
18
- * this file exists to prevent: a claim about what is installable that no artifact backs
19
- * (FINDING-097). Dropped rather than shipped, and the phantom is not respelled here —
20
- * `bridge-names.test.ts` audits THIS comment for `*-acp` tokens, so writing the dead
21
- * name to explain it would fail the guard that exists to catch it.
22
- *
23
- * `ensureBridgesOnPath()` closes the gap at daemon startup: it walks up from this
24
- * module looking for a `node_modules/.bin` that contains a bridge shim and prepends
25
- * it to `process.env.PATH`. Every subprocess the engine spawns inherits the daemon's
26
- * environment, so the registry's bare binary names resolve in dev checkouts
27
- * (workspace root `.bin`), global installs, and nested-dependency layouts alike.
28
- * A user-installed bridge earlier on PATH still wins for spawn resolution only if
29
- * it appears before ours — we prepend, so the packaged versions take precedence
30
- * and match the engine version they shipped with.
31
- *
32
- * What is prepended is NOT that `.bin` itself (crew#858): `.bin` is crew's whole
33
- * dependency bin directory, and `@agentclientprotocol/codex-acp` depends on
34
- * `@openai/codex`, whose launcher lands there as `codex` — prepending it made every
35
- * bare-name `codex` seat spawn resolve to the vendored CLI instead of the one the
36
- * operator installed and logs into. The daemon prepends a directory that holds ONLY
37
- * links to the four bridges (`claude-agent-acp`, `codex-acp`, `pi-acp`, `agy-acp`)
38
- * and the `wicked-pi` launcher. The precedence above is right for the bridges; a seat
39
- * CLI that rides along as a transitive dependency never gets it. (`codex-acp` itself
40
- * is unaffected: it resolves its bundled codex by module path, not PATH.)
41
- */
42
- import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs';
43
- import { tmpdir } from 'node:os';
44
- import { delimiter, dirname, join } from 'node:path';
45
- import { fileURLToPath } from 'node:url';
46
- /** One shim that proves a `.bin` dir holds the bridges (any of them will do). */
47
- const PROBE_BINS = ['claude-agent-acp', 'codex-acp'];
48
- /** Windows npm shims are `<name>.cmd`; POSIX shims are extensionless. */
49
- function hasBridgeShim(binDir) {
50
- return PROBE_BINS.some((bin) => existsSync(join(binDir, bin)) || existsSync(join(binDir, `${bin}.cmd`)));
51
- }
52
- /**
53
- * Find the nearest `node_modules/.bin` (walking up from `start`) that contains a
54
- * bridge shim. Returns `null` when none is found — e.g. a checkout before
55
- * `npm install` — in which case PATH is left untouched and the engine's own
56
- * single-shot fallback still applies.
57
- */
58
- export function findBridgeBinDir(start) {
59
- let dir = start;
60
- for (;;) {
61
- const candidate = join(dir, 'node_modules', '.bin');
62
- if (hasBridgeShim(candidate))
63
- return candidate;
64
- const parent = dirname(dir);
65
- if (parent === dir)
66
- return null;
67
- dir = parent;
68
- }
69
- }
70
- /**
71
- * The variable the community `pi-acp` adapter reads for the command it spawns as pi
72
- * (`getPiCommand(process.env.PI_ACP_PI_COMMAND)`), and the bin this package's
73
- * `agent-acp-bridges` dependency provides for it: `wicked-pi` turns wicked-core's
74
- * `WICKED_PI_SKILL_DIRS` (the deliverable portable skill dirs of the published snapshot,
75
- * F-079 / wicked-core#441) into pi's `--no-skills --skill <dir>…` and runs pi. Without
76
- * this seam the env contract is inert on the ACP carrier: pi-acp forwards no argv.
77
- */
78
- export const PI_ACP_COMMAND_ENV = 'PI_ACP_PI_COMMAND';
79
- const PI_LAUNCHER_BIN = 'wicked-pi';
80
- /**
81
- * The launcher shim in `binDir`, or `null` when this install has none (an older
82
- * `agent-acp-bridges` on the registry — the seat keeps working, skills do not reach pi
83
- * over ACP). Windows shims are `<name>.cmd` and pi-acp starts a `.cmd` through a shell.
84
- */
85
- export function piLauncherIn(binDir) {
86
- const shim = join(binDir, process.platform === 'win32' ? `${PI_LAUNCHER_BIN}.cmd` : PI_LAUNCHER_BIN);
87
- return existsSync(shim) ? shim : null;
88
- }
89
- /**
90
- * Point pi-acp at the `wicked-pi` launcher (idempotent; an operator's own
91
- * `PI_ACP_PI_COMMAND` is respected and never overwritten). Returns the command set — or
92
- * already in force — else `null`. Call once at daemon startup, after `ensureBridgesOnPath`.
93
- */
94
- export function ensurePiLauncherCommand(start = dirname(fileURLToPath(import.meta.url)), env = process.env) {
95
- const current = env[PI_ACP_COMMAND_ENV];
96
- if (current !== undefined && current !== '')
97
- return current;
98
- const binDir = findBridgeBinDir(start);
99
- if (binDir === null)
100
- return null;
101
- const shim = piLauncherIn(binDir);
102
- if (shim === null)
103
- return null;
104
- env[PI_ACP_COMMAND_ENV] = shim;
105
- return shim;
106
- }
107
- /**
108
- * Every bin the bridges-only PATH directory may carry: the four bridges and the pi
109
- * launcher. Nothing else from `.bin` — in particular never a seat CLI (crew#858).
110
- */
111
- export const BRIDGE_ONLY_BINS = ['claude-agent-acp', 'codex-acp', 'pi-acp', 'agy-acp', PI_LAUNCHER_BIN];
112
- /** Name of the bridges-only directory, a sibling of `.bin` inside `node_modules`. */
113
- const BRIDGES_DIR_NAME = '.wicked-crew-bridges';
114
- /** Point `link` at `target`, replacing a stale link; a link already right is left alone. */
115
- function linkTo(target, link) {
116
- try {
117
- if (lstatSync(link).isSymbolicLink() && readlinkSync(link) === target)
118
- return;
119
- unlinkSync(link);
120
- }
121
- catch {
122
- // absent — create below
123
- }
124
- try {
125
- symlinkSync(target, link);
126
- }
127
- catch (err) {
128
- if (err.code !== 'EEXIST')
129
- throw err;
130
- // A concurrent daemon from the same install linked it first: fine ONLY if it agrees —
131
- // anything else (a file, a link elsewhere) throws so the caller falls back to a fresh dir.
132
- if (!(lstatSync(link).isSymbolicLink() && readlinkSync(link) === target))
133
- throw err;
134
- }
135
- }
136
- /** Write a Windows `.cmd` forwarder to `target` (a `.cmd` shim resolves `%~dp0` from its own dir). */
137
- function cmdForwarder(target, link) {
138
- // `%` expands inside a quoted batch string, so a literal one in the path is doubled.
139
- const body = `@"${target.replace(/%/g, '%%')}" %*\r\n`;
140
- try {
141
- if (readFileSync(link, 'utf8') === body)
142
- return;
143
- }
144
- catch {
145
- // absent
146
- }
147
- writeFileSync(link, body);
148
- }
149
- /**
150
- * Populate `dir` with links to the bridge shims found in `binDir` and nothing else.
151
- * Throws when `dir` cannot be created or written (the caller falls back).
152
- */
153
- function populateBridgesDir(binDir, dir) {
154
- mkdirSync(dir, { recursive: true });
155
- for (const name of BRIDGE_ONLY_BINS) {
156
- for (const file of [name, `${name}.cmd`]) {
157
- const target = join(binDir, file);
158
- if (!existsSync(target))
159
- continue;
160
- const link = join(dir, file);
161
- if (file.endsWith('.cmd'))
162
- cmdForwarder(target, link);
163
- else
164
- linkTo(target, link);
165
- }
166
- }
167
- }
168
- /**
169
- * The directory holding ONLY the bridge shims from `binDir` (crew#858), created or
170
- * refreshed: `<node_modules>/.wicked-crew-bridges` beside `.bin`, or — when the install
171
- * is read-only — a fresh per-process directory under the OS temp dir.
172
- */
173
- export function bridgesOnlyDir(binDir) {
174
- const preferred = join(dirname(binDir), BRIDGES_DIR_NAME);
175
- try {
176
- populateBridgesDir(binDir, preferred);
177
- return preferred;
178
- }
179
- catch {
180
- const fallback = mkdtempSync(join(tmpdir(), 'wicked-crew-bridges-'));
181
- populateBridgesDir(binDir, fallback);
182
- return fallback;
183
- }
184
- }
185
- /**
186
- * Prepend a bridges-only directory (links to the bridge shims of the nearest bridge
187
- * `.bin`) to PATH (idempotent). Returns the prepended directory when bridges were found,
188
- * else `null`. Call once at daemon startup, before the engine spawns anything.
189
- */
190
- export function ensureBridgesOnPath(start = dirname(fileURLToPath(import.meta.url))) {
191
- const found = findBridgeBinDir(start);
192
- if (found === null)
193
- return null;
194
- const binDir = bridgesOnlyDir(found);
195
- const current = process.env['PATH'];
196
- if (current === undefined || current === '') {
197
- // No trailing delimiter: an empty PATH entry means the CWD on POSIX.
198
- process.env['PATH'] = binDir;
199
- }
200
- else if (!current.split(delimiter).includes(binDir)) {
201
- process.env['PATH'] = binDir + delimiter + current;
202
- }
203
- return binDir;
204
- }
205
- //# sourceMappingURL=bridge-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bridge-path.js","sourceRoot":"","sources":["../../src/core/bridge-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5I,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,C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