@urateam/core 0.1.52 → 0.1.54
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/dist/__tests__/session-resume-flag.test.js +52 -27
- package/dist/__tests__/session-resume-flag.test.js.map +1 -1
- package/dist/__tests__/session-store.test.js +23 -8
- package/dist/__tests__/session-store.test.js.map +1 -1
- package/dist/executor/session-policy.d.ts +16 -5
- package/dist/executor/session-policy.d.ts.map +1 -1
- package/dist/executor/session-policy.js +17 -6
- package/dist/executor/session-policy.js.map +1 -1
- package/dist/executor/session-store.d.ts +15 -0
- package/dist/executor/session-store.d.ts.map +1 -1
- package/dist/executor/session-store.js +16 -4
- package/dist/executor/session-store.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,32 +3,35 @@ import { eq } from "drizzle-orm";
|
|
|
3
3
|
import { createDb } from "../db/client.js";
|
|
4
4
|
import { pipelineRuns } from "../db/schema.js";
|
|
5
5
|
/**
|
|
6
|
-
* BEC-227 —
|
|
6
|
+
* BEC-227 — agent_session_id minting + opt-out flag semantics.
|
|
7
7
|
*
|
|
8
|
-
* `runner.start()` mints an `agent_session_id` UUID
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* Phase 3: default ON. `runner.start()` mints an `agent_session_id` UUID
|
|
9
|
+
* for every pipeline run unless the operator sets
|
|
10
|
+
* `URATEAM_DISABLE_AGENT_SESSION_RESUME=true`. The strict equality semantics
|
|
11
|
+
* mirror the BEC-218 precedent (`URATEAM_DISABLE_TIER_6E`).
|
|
12
|
+
*
|
|
13
|
+
* This test simulates the row state directly (rather than invoking
|
|
14
|
+
* `start()` which requires reconstructing 6 positional params + a queue +
|
|
15
|
+
* executor) and asserts the column behaviour — the runner-level
|
|
16
|
+
* integration is verified by typecheck + existing pipeline tests.
|
|
14
17
|
*/
|
|
15
|
-
describe("agent_session_id minting (BEC-227)", () => {
|
|
18
|
+
describe("agent_session_id minting (BEC-227 Phase 3 — default ON)", () => {
|
|
16
19
|
let originalEnv;
|
|
17
20
|
beforeEach(() => {
|
|
18
|
-
originalEnv = process.env.
|
|
21
|
+
originalEnv = process.env.URATEAM_DISABLE_AGENT_SESSION_RESUME;
|
|
19
22
|
});
|
|
20
23
|
afterEach(() => {
|
|
21
24
|
if (originalEnv === undefined) {
|
|
22
|
-
delete process.env.
|
|
25
|
+
delete process.env.URATEAM_DISABLE_AGENT_SESSION_RESUME;
|
|
23
26
|
}
|
|
24
27
|
else {
|
|
25
|
-
process.env.
|
|
28
|
+
process.env.URATEAM_DISABLE_AGENT_SESSION_RESUME = originalEnv;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
it("
|
|
29
|
-
process.env.
|
|
31
|
+
it("default (env unset) → mints UUID and persists on pipeline_runs row", async () => {
|
|
32
|
+
delete process.env.URATEAM_DISABLE_AGENT_SESSION_RESUME;
|
|
30
33
|
const db = await createDb({ driver: "sqlite", connectionString: ":memory:" });
|
|
31
|
-
const runId = "test-run-
|
|
34
|
+
const runId = "test-run-default-on";
|
|
32
35
|
await db.insert(pipelineRuns).values({
|
|
33
36
|
id: runId,
|
|
34
37
|
issueId: "BEC-227",
|
|
@@ -37,7 +40,7 @@ describe("agent_session_id minting (BEC-227)", () => {
|
|
|
37
40
|
pipelineKey: "auto-implement",
|
|
38
41
|
status: "queued",
|
|
39
42
|
startedAt: new Date(),
|
|
40
|
-
agentSessionId: "expected-uuid", // simulate what start() writes
|
|
43
|
+
agentSessionId: "expected-uuid", // simulate what start() writes when default-on
|
|
41
44
|
});
|
|
42
45
|
const [row] = await db
|
|
43
46
|
.select()
|
|
@@ -45,10 +48,10 @@ describe("agent_session_id minting (BEC-227)", () => {
|
|
|
45
48
|
.where(eq(pipelineRuns.id, runId));
|
|
46
49
|
expect(row.agentSessionId).toBe("expected-uuid");
|
|
47
50
|
});
|
|
48
|
-
it("
|
|
49
|
-
|
|
51
|
+
it("explicit opt-out via DISABLE=true → agentSessionId can be null", async () => {
|
|
52
|
+
process.env.URATEAM_DISABLE_AGENT_SESSION_RESUME = "true";
|
|
50
53
|
const db = await createDb({ driver: "sqlite", connectionString: ":memory:" });
|
|
51
|
-
const runId = "test-run-
|
|
54
|
+
const runId = "test-run-opt-out";
|
|
52
55
|
await db.insert(pipelineRuns).values({
|
|
53
56
|
id: runId,
|
|
54
57
|
issueId: "BEC-227",
|
|
@@ -57,6 +60,7 @@ describe("agent_session_id minting (BEC-227)", () => {
|
|
|
57
60
|
pipelineKey: "auto-implement",
|
|
58
61
|
status: "queued",
|
|
59
62
|
startedAt: new Date(),
|
|
63
|
+
// start() under opt-out leaves agent_session_id null
|
|
60
64
|
});
|
|
61
65
|
const [row] = await db
|
|
62
66
|
.select()
|
|
@@ -64,24 +68,45 @@ describe("agent_session_id minting (BEC-227)", () => {
|
|
|
64
68
|
.where(eq(pipelineRuns.id, runId));
|
|
65
69
|
expect(row.agentSessionId).toBeNull();
|
|
66
70
|
});
|
|
67
|
-
it("isAgentSessionResumeEnabled
|
|
71
|
+
it("isAgentSessionResumeEnabled is default-on with strict opt-out (BEC-227 Phase 3)", async () => {
|
|
68
72
|
const { isAgentSessionResumeEnabled } = await import("../executor/session-policy.js");
|
|
73
|
+
// Default ON when var is unset or any value other than literal "true".
|
|
74
|
+
expect(isAgentSessionResumeEnabled({})).toBe(true);
|
|
69
75
|
expect(isAgentSessionResumeEnabled({
|
|
70
|
-
|
|
76
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "",
|
|
71
77
|
})).toBe(true);
|
|
72
78
|
expect(isAgentSessionResumeEnabled({
|
|
73
|
-
|
|
74
|
-
})).toBe(
|
|
79
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "false",
|
|
80
|
+
})).toBe(true);
|
|
75
81
|
expect(isAgentSessionResumeEnabled({
|
|
76
|
-
|
|
77
|
-
})).toBe(
|
|
82
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "1",
|
|
83
|
+
})).toBe(true);
|
|
84
|
+
expect(isAgentSessionResumeEnabled({
|
|
85
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "yes",
|
|
86
|
+
})).toBe(true);
|
|
87
|
+
expect(isAgentSessionResumeEnabled({
|
|
88
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "TRUE",
|
|
89
|
+
})).toBe(true);
|
|
90
|
+
// Off only on literal "true" (strict equality, matches BEC-218 precedent).
|
|
78
91
|
expect(isAgentSessionResumeEnabled({
|
|
79
|
-
|
|
92
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "true",
|
|
80
93
|
})).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
it("legacy URATEAM_ENABLE_AGENT_SESSION_RESUME is ignored under Phase 3", async () => {
|
|
96
|
+
const { isAgentSessionResumeEnabled } = await import("../executor/session-policy.js");
|
|
97
|
+
// Phase 1/2 operators may still have URATEAM_ENABLE_AGENT_SESSION_RESUME
|
|
98
|
+
// set in their .env. Under Phase 3 it is ignored; default-on applies.
|
|
81
99
|
expect(isAgentSessionResumeEnabled({
|
|
82
|
-
URATEAM_ENABLE_AGENT_SESSION_RESUME: "",
|
|
100
|
+
URATEAM_ENABLE_AGENT_SESSION_RESUME: "true",
|
|
101
|
+
})).toBe(true);
|
|
102
|
+
expect(isAgentSessionResumeEnabled({
|
|
103
|
+
URATEAM_ENABLE_AGENT_SESSION_RESUME: "false",
|
|
104
|
+
})).toBe(true);
|
|
105
|
+
// The new var still wins.
|
|
106
|
+
expect(isAgentSessionResumeEnabled({
|
|
107
|
+
URATEAM_ENABLE_AGENT_SESSION_RESUME: "true",
|
|
108
|
+
URATEAM_DISABLE_AGENT_SESSION_RESUME: "true",
|
|
83
109
|
})).toBe(false);
|
|
84
|
-
expect(isAgentSessionResumeEnabled({})).toBe(false);
|
|
85
110
|
});
|
|
86
111
|
});
|
|
87
112
|
//# sourceMappingURL=session-resume-flag.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-resume-flag.test.js","sourceRoot":"","sources":["../../src/__tests__/session-resume-flag.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAc,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"session-resume-flag.test.js","sourceRoot":"","sources":["../../src/__tests__/session-resume-flag.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAc,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,QAAQ,CAAC,yDAAyD,EAAE,GAAG,EAAE;IACvE,IAAI,WAA+B,CAAC;IACpC,UAAU,CAAC,GAAG,EAAE;QACd,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oCAAoC,GAAG,WAAW,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;QAClF,OAAO,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC;Q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C;IAChB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACnF,MAAM,EAAE,2BAA2B,EAAE,GAAG,MAAM,MAAM,CAClD,+BAA+B,CAChC,CAAC;QACF,yEAAyE;QACzE,sEAAsE;QACtE,MAAM,CACJ,2BAA2B,CAAC;YAC1B,mCAAmC,EAAE,MAAM;SAC5C,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,CACJ,2BAA2B,CAAC;YAC1B,mCAAmC,EAAE,OAAO;SAC7C,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,0BAA0B;QAC1B,MAAM,CACJ,2BAA2B,CAAC;YAC1B,mCAAmC,EAAE,MAAM;YAC3C,oCAAoC,EAAE,MAAM;SAC7C,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -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
|
|
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
|
-
//
|
|
21
|
-
|
|
22
|
-
expect(p).
|
|
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
|
|
25
|
-
|
|
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: "/
|
|
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,
|
|
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,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxE,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,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;QAC3F,MAAM,CAAC,GAAG,cAAc,CAAC;YACvB,YAAY,EAAE,OAAO;YACrB,GAAG,EAAE,kCAAkC;YACvC,SAAS,EAAE,QAAQ;SACpB,CAAC,CAAC;QACH,uEAAuE;QACvE,8EAA8E;QAC9E,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CACZ,IAAI,CAAC,OAAO,EAAE,kCAAkC,EAAE,cAAc,C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AE,QAAQ;SACpB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -27,12 +27,23 @@ export declare function isAlwaysFreshStage(stage: string): boolean;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function isResumable(stage: string, model: string): boolean;
|
|
29
29
|
/**
|
|
30
|
-
* Returns true iff
|
|
30
|
+
* Returns true iff agent session resume (BEC-227) is enabled for this run.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* BEC-227 Phase 3: default ON. After the Phase 2 dogfood soak verified the
|
|
33
|
+
* mechanism works end-to-end (combined with the BEC-231 + BEC-232 fixes),
|
|
34
|
+
* the default flipped from opt-in to opt-out. Operators who want to disable
|
|
35
|
+
* session resume can set `URATEAM_DISABLE_AGENT_SESSION_RESUME=true`.
|
|
36
|
+
*
|
|
37
|
+
* Strict equality on `"true"` — mirrors BEC-218 precedent so `"1"` /
|
|
38
|
+
* `"yes"` / `"TRUE"` / `""` do NOT disable the flag. The env is read at
|
|
39
|
+
* call time so flipping the var takes effect on the next pipeline run
|
|
40
|
+
* without a daemon restart.
|
|
41
|
+
*
|
|
42
|
+
* The previous Phase-1/2 env var `URATEAM_ENABLE_AGENT_SESSION_RESUME` is
|
|
43
|
+
* ignored under Phase 3. Operators with `URATEAM_ENABLE_AGENT_SESSION_RESUME=true`
|
|
44
|
+
* in their `.env` will see no behavior change (the new default is on);
|
|
45
|
+
* operators relying on the old default-off can switch to
|
|
46
|
+
* `URATEAM_DISABLE_AGENT_SESSION_RESUME=true`.
|
|
36
47
|
*/
|
|
37
48
|
export declare function isAgentSessionResumeEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
38
49
|
//# sourceMappingURL=session-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-policy.d.ts","sourceRoot":"","sources":["../../src/executor/session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED
|
|
1
|
+
{"version":3,"file":"session-policy.d.ts","sourceRoot":"","sources":["../../src/executor/session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAET"}
|
|
@@ -53,14 +53,25 @@ export function isResumable(stage, model) {
|
|
|
53
53
|
return modelFamily(model) === "claude";
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Returns true iff
|
|
56
|
+
* Returns true iff agent session resume (BEC-227) is enabled for this run.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* BEC-227 Phase 3: default ON. After the Phase 2 dogfood soak verified the
|
|
59
|
+
* mechanism works end-to-end (combined with the BEC-231 + BEC-232 fixes),
|
|
60
|
+
* the default flipped from opt-in to opt-out. Operators who want to disable
|
|
61
|
+
* session resume can set `URATEAM_DISABLE_AGENT_SESSION_RESUME=true`.
|
|
62
|
+
*
|
|
63
|
+
* Strict equality on `"true"` — mirrors BEC-218 precedent so `"1"` /
|
|
64
|
+
* `"yes"` / `"TRUE"` / `""` do NOT disable the flag. The env is read at
|
|
65
|
+
* call time so flipping the var takes effect on the next pipeline run
|
|
66
|
+
* without a daemon restart.
|
|
67
|
+
*
|
|
68
|
+
* The previous Phase-1/2 env var `URATEAM_ENABLE_AGENT_SESSION_RESUME` is
|
|
69
|
+
* ignored under Phase 3. Operators with `URATEAM_ENABLE_AGENT_SESSION_RESUME=true`
|
|
70
|
+
* in their `.env` will see no behavior change (the new default is on);
|
|
71
|
+
* operators relying on the old default-off can switch to
|
|
72
|
+
* `URATEAM_DISABLE_AGENT_SESSION_RESUME=true`.
|
|
62
73
|
*/
|
|
63
74
|
export function isAgentSessionResumeEnabled(env = process.env) {
|
|
64
|
-
return env.
|
|
75
|
+
return env.URATEAM_DISABLE_AGENT_SESSION_RESUME !== "true";
|
|
65
76
|
}
|
|
66
77
|
//# sourceMappingURL=session-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-policy.js","sourceRoot":"","sources":["../../src/executor/session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IAC9D,UAAU,EAAE,iDAAiD;IAC7D,aAAa,EAAE,uDAAuD;CACvE,CAAC,CAAC;AAEH,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,OAAO,CAAC;IACrD,IAAI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MAAM,CAAC;AAC7D,CAAC"}
|
|
@@ -17,6 +17,21 @@
|
|
|
17
17
|
* `URATEAM_CLAUDE_PROJECTS_DIR` env var for tests or non-standard deploys.
|
|
18
18
|
*/
|
|
19
19
|
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;
|
|
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
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
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,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