@urateam/core 0.1.52 → 0.1.53

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.
@@ -10,24 +10,25 @@ beforeEach(() => {
10
10
  afterEach(() => {
11
11
  rmSync(tmpRoot, { recursive: true, force: true });
12
12
  });
13
- describe("session-store (BEC-227)", () => {
14
- it("transcriptPath builds the expected per-cwd / per-session path", () => {
13
+ describe("session-store (BEC-227 + BEC-232)", () => {
14
+ it("transcriptPath builds the SDK's leading-dash encoding for absolute cwds (BEC-232)", () => {
15
15
  const p = transcriptPath({
16
16
  projectsRoot: tmpRoot,
17
17
  cwd: "/home/ura/data/runs/abc/worktree",
18
18
  sessionId: "uuid-1",
19
19
  });
20
- // Per SDK convention: projectsRoot / <encoded-cwd> / <sessionId>.jsonl
21
- expect(p).toMatch(/uuid-1\.jsonl$/);
22
- expect(p).toContain(tmpRoot);
20
+ // BEC-232: leading "/" is replaced with "-", not stripped. Matches the
21
+ // SDK's actual on-disk path: <projectsRoot>/-home-ura-...-worktree/<id>.jsonl
22
+ expect(p).toBe(join(tmpRoot, "-home-ura-data-runs-abc-worktree", "uuid-1.jsonl"));
23
23
  });
24
- it("transcriptExists returns true when the JSONL file is present", () => {
25
- const dir = join(tmpRoot, "encoded-cwd");
24
+ it("transcriptExists returns true when the JSONL file is at the SDK-encoded path", () => {
25
+ // Place the file where the SDK would actually write it (leading-dash dir).
26
+ const dir = join(tmpRoot, "-home-ura-data-runs-abc-worktree");
26
27
  mkdirSync(dir, { recursive: true });
27
28
  writeFileSync(join(dir, "uuid-1.jsonl"), '{"message":"hi"}\n');
28
29
  const exists = transcriptExists({
29
30
  projectsRoot: tmpRoot,
30
- cwd: "/encoded-cwd",
31
+ cwd: "/home/ura/data/runs/abc/worktree",
31
32
  sessionId: "uuid-1",
32
33
  });
33
34
  expect(exists).toBe(true);
@@ -40,5 +41,19 @@ describe("session-store (BEC-227)", () => {
40
41
  });
41
42
  expect(exists).toBe(false);
42
43
  });
44
+ it("regression (BEC-232): the OLD no-leading-dash path is NOT what we look up", () => {
45
+ // If anyone places a JSONL at the pre-BEC-232 (incorrect) location,
46
+ // transcriptExists() should NOT find it — the fix is unconditional, not
47
+ // a fallback-to-old-path behavior.
48
+ const wrongDir = join(tmpRoot, "home-ura-data-runs-abc-worktree");
49
+ mkdirSync(wrongDir, { recursive: true });
50
+ writeFileSync(join(wrongDir, "uuid-1.jsonl"), '{"message":"hi"}\n');
51
+ const exists = transcriptExists({
52
+ projectsRoot: tmpRoot,
53
+ cwd: "/home/ura/data/runs/abc/worktree",
54
+ sessionId: "uuid-1",
55
+ });
56
+ expect(exists).toBe(false);
57
+ });
43
58
  });
44
59
  //# sourceMappingURL=session-store.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.test.js","sourceRoot":"","sources":["../../src/__tests__/session-store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAM,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAc,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhF,IAAI,OAAe,CAAC;AAEpB,UAAU,CAAC,GAAG,EAAE;IACd,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,6BAA6B,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC;AACH,SAAS,CAAC,GAAG,EAAE;IACb,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC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
  export declare function defaultProjectsRoot(env?: NodeJS.ProcessEnv): string;
20
+ /**
21
+ * Encode a cwd into the SDK's per-project directory name.
22
+ *
23
+ * BEC-232 — match the SDK's encoding exactly. The SDK replaces ALL path
24
+ * separators (including a leading `/`) with `-`, producing a directory name
25
+ * like `"-home-ura-data-runs-<run>-worktree"` (note the LEADING dash).
26
+ *
27
+ * The pre-BEC-232 implementation stripped the leading `/` BEFORE replacing,
28
+ * producing `"home-..."` (no leading dash). The mismatch caused
29
+ * `transcriptExists()` to always return false for absolute cwds — every
30
+ * BEC-227 session-resume attempt fell back to legacy handoff because
31
+ * urateam looked for the JSONL at the wrong path. Verified on the dogfood
32
+ * instance against real SDK-written transcripts (BEC-231 soak observation).
33
+ */
34
+ export declare function encodeCwd(cwd: string): string;
20
35
  /** Build the JSONL transcript path for a given (cwd, sessionId). */
21
36
  export declare function transcriptPath(opts: {
22
37
  projectsRoot: string;
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/executor/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEhF;AAQD,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAET;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAEV"}
1
+ {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/executor/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAET;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAEV"}
@@ -22,10 +22,22 @@ import { homedir } from "node:os";
22
22
  export function defaultProjectsRoot(env = process.env) {
23
23
  return env.URATEAM_CLAUDE_PROJECTS_DIR ?? join(homedir(), ".claude", "projects");
24
24
  }
25
- /** Encode a cwd into the SDK's per-project directory name. */
26
- function encodeCwd(cwd) {
27
- // SDK convention: replace path separators with hyphens, prefix removed if leading slash.
28
- return cwd.replace(/^\//, "").replace(/[\/\\]/g, "-");
25
+ /**
26
+ * Encode a cwd into the SDK's per-project directory name.
27
+ *
28
+ * BEC-232 — match the SDK's encoding exactly. The SDK replaces ALL path
29
+ * separators (including a leading `/`) with `-`, producing a directory name
30
+ * like `"-home-ura-data-runs-<run>-worktree"` (note the LEADING dash).
31
+ *
32
+ * The pre-BEC-232 implementation stripped the leading `/` BEFORE replacing,
33
+ * producing `"home-..."` (no leading dash). The mismatch caused
34
+ * `transcriptExists()` to always return false for absolute cwds — every
35
+ * BEC-227 session-resume attempt fell back to legacy handoff because
36
+ * urateam looked for the JSONL at the wrong path. Verified on the dogfood
37
+ * instance against real SDK-written transcripts (BEC-231 soak observation).
38
+ */
39
+ export function encodeCwd(cwd) {
40
+ return cwd.replace(/[\/\\]/g, "-");
29
41
  }
30
42
  /** Build the JSONL transcript path for a given (cwd, sessionId). */
31
43
  export function transcriptPath(opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../src/executor/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACtE,OAAO,GAAG,CAAC,2BAA2B,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACnF,CAAC;AAED,8DAA8D;AAC9D,SAAS,SAAS,CAAC,GAAW;IAC5B,yFAAyF;IACzF,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,IAI9B;IACC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,IAIhC;IACC,OAAO,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../src/executor/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACtE,OAAO,GAAG,CAAC,2BAA2B,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,IAI9B;IACC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,IAIhC;IACC,OAAO,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urateam/core",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "license": "BUSL-1.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",