@cueloop/schema 0.1.0-alpha.34 → 0.1.0-alpha.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cueloop/schema",
3
- "version": "0.1.0-alpha.34",
3
+ "version": "0.1.0-alpha.36",
4
4
  "description": "The ReviewSession primitive: types, markdown block model, quote-primary anchors, feedback serialization",
5
5
  "homepage": "https://github.com/mmurakaru/cueloop#readme",
6
6
  "bugs": {
package/src/herdr.test.ts CHANGED
@@ -4,7 +4,15 @@ import { detectHerdr, insideHerdr, returnPaneFor } from "./herdr";
4
4
  describe("detectHerdr", () => {
5
5
  test("null outside herdr, context inside", () => {
6
6
  expect(detectHerdr({})).toBeNull();
7
- expect(detectHerdr({ HERDR_ENV: "1", HERDR_PANE_ID: "p1" })).toBeNull();
7
+ // no HERDR_ENV or no pane id means we are not in a usable herdr pane
8
+ expect(detectHerdr({ HERDR_PANE_ID: "p1" })).toBeNull();
9
+ expect(detectHerdr({ HERDR_ENV: "1" })).toBeNull();
10
+ // herdr 0.8.0 sets no HERDR_BIN_PATH: the binary defaults to `herdr` on PATH
11
+ expect(detectHerdr({ HERDR_ENV: "1", HERDR_PANE_ID: "p1" })).toEqual({
12
+ paneId: "p1",
13
+ binPath: "herdr",
14
+ });
15
+ // an explicit HERDR_BIN_PATH (tests, or a pinned install) still wins
8
16
  expect(
9
17
  detectHerdr({ HERDR_ENV: "1", HERDR_PANE_ID: "p1", HERDR_BIN_PATH: "/x/herdr" }),
10
18
  ).toEqual({
package/src/herdr.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * The herdr ambient env contract, single-sourced. A process running inside a
3
- * herdr pane sees HERDR_ENV=1 plus the pane id and the herdr binary path.
4
- * Both the agent-side reporter (adapters) and the reviewer-side return-focus
5
- * (client) read this contract; decoding it in one place stops the two sides
6
- * drifting on which vars are required. Pure: no IO, env is only the default
7
- * argument so callers can pass a fixture.
3
+ * herdr pane sees HERDR_ENV=1 plus the pane id; the herdr CLI itself reaches
4
+ * the app over HERDR_SOCKET_PATH (which the spawned `herdr` reads from the
5
+ * inherited env), so the binary is just `herdr` on PATH. Both the agent-side
6
+ * reporter (adapters) and the reviewer-side return-focus (client) read this
7
+ * contract; decoding it in one place stops the two sides drifting on which
8
+ * vars are required. Pure: no IO, env is only the default argument so callers
9
+ * can pass a fixture.
8
10
  */
9
11
 
10
12
  export interface HerdrContext {
@@ -21,8 +23,11 @@ export type HerdrEnv = Record<string, string | undefined>;
21
23
  export function detectHerdr(env: HerdrEnv = process.env): HerdrContext | null {
22
24
  if (env.HERDR_ENV !== "1") return null;
23
25
  const paneId = env.HERDR_PANE_ID;
24
- const binPath = env.HERDR_BIN_PATH;
25
- if (!paneId || !binPath) return null;
26
+ if (!paneId) return null;
27
+ // herdr 0.8.0 exposes no HERDR_BIN_PATH; the CLI is `herdr` on PATH and finds
28
+ // the app over HERDR_SOCKET_PATH from the inherited env. Tests still override
29
+ // HERDR_BIN_PATH to point the spawn at a stub script.
30
+ const binPath = env.HERDR_BIN_PATH ?? "herdr";
26
31
  return { paneId, binPath };
27
32
  }
28
33