stitchkit 0.131.0 → 0.132.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 (32) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/agent-executor/claude/limits.d.ts.map +1 -1
  3. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  4. package/dist/agent-executor/claude/transcript.d.ts +1 -1
  5. package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
  6. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  7. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  8. package/dist/agent-executor/profile.d.ts +2 -1
  9. package/dist/agent-executor/profile.d.ts.map +1 -1
  10. package/dist/entrypoints/agent-executor/acp.js +2 -2
  11. package/dist/entrypoints/agent-executor/claude-sdk.js +11 -10
  12. package/dist/entrypoints/agent-executor/claude.js +9 -8
  13. package/dist/entrypoints/agent-executor/codex.js +60 -62
  14. package/dist/entrypoints/agent-executor/testing.js +3 -3
  15. package/dist/entrypoints/agent-executor.js +2 -2
  16. package/dist/entrypoints/sync.js +8 -4
  17. package/dist/{index-32vaajec.js → index-athc412x.js} +1 -1
  18. package/dist/{index-g2d9kws8.js → index-f9p62ean.js} +20 -4
  19. package/dist/{index-gm9yz82v.js → index-jcrj0b8z.js} +1 -1
  20. package/dist/{index-64e9p079.js → index-z114ax5e.js} +7 -7
  21. package/dist/sync/session-machine.d.ts.map +1 -1
  22. package/dist/sync/session.d.ts +3 -3
  23. package/llms/agent-executor-claude.txt +1 -1
  24. package/llms/agent-executor-codex.txt +1 -1
  25. package/llms/agent-executor.txt +7 -1
  26. package/llms/stitchkit.txt +74 -74
  27. package/llms/sync.txt +1 -1
  28. package/llms/{upgrading-0.128.0-0.131.0.txt → upgrading-0.128.0-0.132.0.txt} +23 -3
  29. package/llms/upgrading.txt +1 -1
  30. package/llms-full.txt +104 -78
  31. package/llms.txt +4 -4
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -15,6 +15,32 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.132.0] - 2026-11-27
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** callers that return `0` from `SyncSessionPorts.readCursor` before their first full snapshot. [Migration](docs/guide/upgrading.md#saved-sync-cursor-zero)
23
+
24
+ - `stitchkit/sync` — `createSyncSession` now reads changes after every saved nonnegative version, including zero. Return `null` to request the initial snapshot. A completed token-paged snapshot retains its known starting version when the final page omits `latestVersion`.
25
+
26
+ ```ts
27
+ // before
28
+ readCursor: () => row?.version ?? 0
29
+ // after
30
+ readCursor: () => row?.version ?? null
31
+ ```
32
+
33
+ **Affects:** `stitchkit/sync` createSyncSession, SyncSessionPorts(readCursor)
34
+
35
+ ### Fixed
36
+
37
+ - `stitchkit/agent-executor` — Claude CLI and SDK profiles can use the user's native sign-in by setting `claudeConfigDir: 'default'` and keeping `home` at the user's `.claude` transcript directory. The child receives no `CLAUDE_CONFIG_DIR` in this mode. Existing profiles still select their configured directory explicitly.
38
+ **Affects:** `stitchkit/agent-executor` ExecutorProfileConfig(claudeConfigDir), ExecutorProfileConfigSchema, engineEnvironment; `stitchkit/agent-executor/claude` createClaudeCliDriver, findTranscriptInput; `stitchkit/agent-executor/claude-sdk` createClaudeSdkDriver, findTranscriptInput
39
+ - `stitchkit/agent-executor/codex` — preserve the account plan and quota windows when a snapshot carries a sibling per-model map. Overlapping measurements appear once, and model buckets cannot crowd the account out of the 32-window result.
40
+ **Affects:** `stitchkit/agent-executor/codex` codexPlanLimits, codexPlanWindows
41
+ - `stitchkit/agent-executor/claude` and `stitchkit/agent-executor/claude-sdk` — named model usage windows carry their reported scope and label. A measured window with no model name still carries its percentage.
42
+ **Affects:** `stitchkit/agent-executor/claude` claudeUsagePlanLimits; `stitchkit/agent-executor/claude-sdk` claudeUsagePlanLimits, createClaudeSdkDriver
43
+
18
44
  ## [0.131.0] - 2026-11-27
19
45
 
20
46
  ### ⚠️ Breaking changes
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude/limits.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAiIlB;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,GAAE,IAAiB,GAAG,UAAU,CAmCtF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,EAAE,CAwB7D"}
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude/limits.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAgIlB;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,GAAE,IAAiB,GAAG,UAAU,CAmCtF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,EAAE,CAwB7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAmB,MAAM,WAAW,CAAC;AAUrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,qBAAqB,EAAoC,MAAM,YAAY,CAAC;AAQ1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAwD1D;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,kBAAkB,GAAG;IAC3B,UAAU,EAAE,MAAM,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G,SAAS,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACjC,EACD,KAAK,EAAE;IACL,OAAO,EAAE,qBAAqB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,cAAc,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACrE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC,GACA,OAAO,CAAC,kBAAkB,CAAC,CAiL7B"}
@@ -32,5 +32,5 @@ export declare function findTranscriptInput(engine: Extract<ExecutorEngine, 'cla
32
32
  cwd: string;
33
33
  nativeThreadId: string;
34
34
  clientId: string;
35
- }): Promise<boolean>;
35
+ }, ambient?: Readonly<Record<string, string | undefined>>): Promise<boolean>;
36
36
  //# sourceMappingURL=transcript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude/transcript.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,YAAY,CAAC;AAsCvE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAWT;AA+BD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6E1F;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAU3E;AAED,8FA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,CAAC,OAAO,CAAC,CAUlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude-sdk/session.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAY3C,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAGlB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AA2QlB;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAC/B,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAgM3B"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/claude-sdk/session.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAY3C,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAGlB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AA2QlB;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAC/B,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAiM3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/limits.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAkMlB;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,EAAE,CAEhE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAE,IAAiB,GAAG,UAAU,CAQrF"}
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/limits.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAsKlB;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,EAAE,CAEhE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAE,IAAiB,GAAG,UAAU,CAQrF"}
@@ -21,6 +21,7 @@ export declare const ExecutorProfileConfigSchema: z.ZodObject<{
21
21
  codex: "codex";
22
22
  }>;
23
23
  home: z.ZodString;
24
+ claudeConfigDir: z.ZodOptional<z.ZodLiteral<"default">>;
24
25
  accountLabel: z.ZodOptional<z.ZodString>;
25
26
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
26
27
  }, z.core.$strict>;
@@ -32,7 +33,7 @@ export type ExecutorProfileConfig = z.input<typeof ExecutorProfileConfigSchema>;
32
33
  * its own and run on the executor's account. Every driver method that takes a profile asks
33
34
  * this first, before it reads a file or starts a process.
34
35
  */
35
- export declare function engineProfile(engine: ExecutorEngine, raw: ExecutorProfileConfig): z.output<typeof ExecutorProfileConfigSchema>;
36
+ export declare function engineProfile(engine: ExecutorEngine, raw: ExecutorProfileConfig, ambient?: Readonly<Record<string, string | undefined>>): z.output<typeof ExecutorProfileConfigSchema>;
36
37
  /**
37
38
  * Credential variables an engine would bill against. They are never passed
38
39
  * on — the allowlist already keeps them out — and their names, without
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/agent-executor/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,cAAc,EAAwB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1F,0GAA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E,CAEV;AAED,wGAAwG;AACxG,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAC,CAAC;IAC9E,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CACvD,GAAG,eAAe,CAWlB"}
@@ -14,7 +14,7 @@ import {
14
14
  safeJsonValue,
15
15
  invokeSafely,
16
16
  emitStartupPhase
17
- } from "../../index-g2d9kws8.js";
17
+ } from "../../index-f9p62ean.js";
18
18
  import"../../index-09f7w2qq.js";
19
19
  import {
20
20
  NativeCommandError2
@@ -38,7 +38,7 @@ import {
38
38
  drainEngineRequests,
39
39
  endEngineTurn,
40
40
  loseEngineTurn
41
- } from "../../index-gm9yz82v.js";
41
+ } from "../../index-jcrj0b8z.js";
42
42
  import {
43
43
  spawnEngineProcess2
44
44
  } from "../../index-rxh3qy4x.js";
@@ -15,7 +15,7 @@ import {
15
15
  safeJsonValue,
16
16
  invokeSafely,
17
17
  emitStartupPhase
18
- } from "../../index-g2d9kws8.js";
18
+ } from "../../index-f9p62ean.js";
19
19
  import {
20
20
  ClaudeTaskUsageSchema2,
21
21
  ClaudeRuntimeEventSchema2,
@@ -29,7 +29,7 @@ import {
29
29
  claudeTranscriptHasUuid2,
30
30
  claudeTranscriptExists,
31
31
  findTranscriptInput2
32
- } from "../../index-64e9p079.js";
32
+ } from "../../index-z114ax5e.js";
33
33
  import {
34
34
  JsonRpcRecordSchema2
35
35
  } from "../../index-kwsr7j5k.js";
@@ -43,11 +43,11 @@ import {
43
43
  drainEngineRequests,
44
44
  endEngineTurn,
45
45
  loseEngineTurn
46
- } from "../../index-gm9yz82v.js";
46
+ } from "../../index-jcrj0b8z.js";
47
47
  import {
48
48
  planLimitsReadFailed2,
49
49
  mergeRateLimitEvent2
50
- } from "../../index-32vaajec.js";
50
+ } from "../../index-athc412x.js";
51
51
  import"../../index-pzhqydxb.js";
52
52
  import {
53
53
  isPositiveSafeInteger
@@ -618,13 +618,13 @@ function buildProbeOptions(input) {
618
618
  };
619
619
  }
620
620
  async function probeClaudeSdkCapabilities(config, limits, input) {
621
- const profile = engineProfile("claude-sdk", input.profile);
621
+ const ambient = config.ambient ?? process.env;
622
+ const profile = engineProfile("claude-sdk", input.profile, ambient);
622
623
  if (input.timeoutMs !== undefined) {
623
624
  assertTimerMs("timeoutMs", input.timeoutMs);
624
625
  }
625
626
  input.signal?.throwIfAborted();
626
627
  const timeoutMs = input.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
627
- const ambient = config.ambient ?? process.env;
628
628
  const env = engineEnvironment2(profile, ambient);
629
629
  return withSignalDeadline(timeoutMs, input.signal, () => new Error(`Claude SDK capability probe timed out after ${timeoutMs} ms`), async (deadlineSignal) => {
630
630
  const probeAbort = new AbortController;
@@ -1036,8 +1036,9 @@ function recordSdkPlanLimitsFailure(limits, profileId, error) {
1036
1036
  async function openClaudeSdkSession(config, limits, input) {
1037
1037
  validateClaudeSdkOpenInput(input);
1038
1038
  const ambient = config.ambient ?? process.env;
1039
- const profile = engineProfile("claude-sdk", input.profile);
1039
+ const profile = engineProfile("claude-sdk", input.profile, ambient);
1040
1040
  input.signal?.throwIfAborted();
1041
+ const env = engineEnvironment2(profile, ambient);
1041
1042
  const sessionId = input.nativeThreadId ?? randomUUID2();
1042
1043
  const transcript = claudeTranscriptPath2({ home: profile.home, cwd: input.cwd, sessionId });
1043
1044
  const transcriptExists = input.nativeThreadId !== undefined && await claudeTranscriptExists(transcript);
@@ -1093,7 +1094,7 @@ async function openClaudeSdkSession(config, limits, input) {
1093
1094
  const promise = launchSingleSdkQuery({
1094
1095
  config,
1095
1096
  cwd: input.cwd,
1096
- env: engineEnvironment2(profile, ambient),
1097
+ env: { ...env },
1097
1098
  profileId: profile.profileId,
1098
1099
  limits,
1099
1100
  sessionId,
@@ -1256,7 +1257,7 @@ function createClaudeSdkDriver(config) {
1256
1257
  };
1257
1258
  },
1258
1259
  async status(rawProfile) {
1259
- const profile = engineProfile("claude-sdk", rawProfile);
1260
+ const profile = engineProfile("claude-sdk", rawProfile, config.ambient);
1260
1261
  const known = limits.get(profile.profileId);
1261
1262
  return {
1262
1263
  login: { state: "unknown" },
@@ -1264,7 +1265,7 @@ function createClaudeSdkDriver(config) {
1264
1265
  ...known && { planLimits: known }
1265
1266
  };
1266
1267
  },
1267
- findInput: (input) => findTranscriptInput2("claude-sdk", input),
1268
+ findInput: (input) => findTranscriptInput2("claude-sdk", input, config.ambient),
1268
1269
  open: (input) => openClaudeSdkSession(config, limits, input),
1269
1270
  async forkSession(sessionId, options) {
1270
1271
  if (sessionId.trim().length === 0) {
@@ -8,7 +8,7 @@ import {
8
8
  runEngineCli,
9
9
  stopConnection,
10
10
  emitStartupPhase
11
- } from "../../index-g2d9kws8.js";
11
+ } from "../../index-f9p62ean.js";
12
12
  import"../../index-09f7w2qq.js";
13
13
  import"../../index-v59pxmf1.js";
14
14
  import"../../index-qa2jjb65.js";
@@ -28,7 +28,7 @@ import {
28
28
  claudeTranscriptHasUuid2,
29
29
  claudeTranscriptExists,
30
30
  findTranscriptInput2
31
- } from "../../index-64e9p079.js";
31
+ } from "../../index-z114ax5e.js";
32
32
  import {
33
33
  CLAUDE_CLI_MAX_LINE_BYTES,
34
34
  validateImageOptions,
@@ -41,7 +41,7 @@ import {
41
41
  drainEngineRequests,
42
42
  endEngineTurn,
43
43
  loseEngineTurn
44
- } from "../../index-gm9yz82v.js";
44
+ } from "../../index-jcrj0b8z.js";
45
45
  import {
46
46
  ENGINE_LINE_BYTES,
47
47
  spawnEngineProcess2
@@ -49,7 +49,7 @@ import {
49
49
  import"../../index-3fym4j8n.js";
50
50
  import {
51
51
  mergeRateLimitEvent2
52
- } from "../../index-32vaajec.js";
52
+ } from "../../index-athc412x.js";
53
53
  import"../../index-pzhqydxb.js";
54
54
 
55
55
  // src/agent-executor/claude/cli-driver.ts
@@ -85,8 +85,9 @@ function claudeTurnHandle(turn, send) {
85
85
  }
86
86
  async function openClaudeSession(config, input) {
87
87
  const { executable, prefix, ambient, limits } = config;
88
- const profile = engineProfile("claude-cli", input.profile);
88
+ const profile = engineProfile("claude-cli", input.profile, ambient);
89
89
  input.signal?.throwIfAborted();
90
+ const env = engineEnvironment2(profile, ambient);
90
91
  const sessionId = input.nativeThreadId ?? randomUUID();
91
92
  const transcript = claudeTranscriptPath2({ home: profile.home, cwd: input.cwd, sessionId });
92
93
  const resume = input.nativeThreadId !== undefined && await claudeTranscriptExists(transcript);
@@ -116,7 +117,7 @@ async function openClaudeSession(config, input) {
116
117
  ...config.model !== undefined ? ["--model", config.model] : []
117
118
  ],
118
119
  cwd: input.cwd,
119
- env: engineEnvironment2(profile, ambient),
120
+ env,
120
121
  signal: linked.signal,
121
122
  maxLineBytes: CLAUDE_CLI_MAX_LINE_BYTES
122
123
  });
@@ -297,7 +298,7 @@ function createClaudeCliDriver(config = {}) {
297
298
  };
298
299
  },
299
300
  async status(rawProfile) {
300
- const profile = engineProfile("claude-cli", rawProfile);
301
+ const profile = engineProfile("claude-cli", rawProfile, ambient);
301
302
  const result = await cli(profile, ["auth", "status"]);
302
303
  let decoded = {};
303
304
  try {
@@ -325,7 +326,7 @@ function createClaudeCliDriver(config = {}) {
325
326
  ...planLimits && { planLimits }
326
327
  };
327
328
  },
328
- findInput: (input) => findTranscriptInput2("claude-cli", input),
329
+ findInput: (input) => findTranscriptInput2("claude-cli", input, ambient),
329
330
  open: (input) => openClaudeSession({
330
331
  executable,
331
332
  prefix,
@@ -24,7 +24,7 @@ import {
24
24
  invokeSafely,
25
25
  emitStartupPhase,
26
26
  clampUniqueWindowName
27
- } from "../../index-g2d9kws8.js";
27
+ } from "../../index-f9p62ean.js";
28
28
  import {
29
29
  JsonRpcValueSchema2,
30
30
  JsonRpcError2,
@@ -88,7 +88,7 @@ import {
88
88
  drainEngineRequests,
89
89
  endEngineTurn,
90
90
  loseEngineTurn
91
- } from "../../index-gm9yz82v.js";
91
+ } from "../../index-jcrj0b8z.js";
92
92
  import {
93
93
  spawnEngineProcess2
94
94
  } from "../../index-rxh3qy4x.js";
@@ -96,7 +96,7 @@ import"../../index-3fym4j8n.js";
96
96
  import {
97
97
  planLimitsReadFailed2,
98
98
  mergeRateLimitEvent2
99
- } from "../../index-32vaajec.js";
99
+ } from "../../index-athc412x.js";
100
100
  import"../../index-pzhqydxb.js";
101
101
  import {
102
102
  assertExpectedOwnerUid
@@ -2519,75 +2519,73 @@ function resolveWindowFields(raw) {
2519
2519
  const resetsAt = parseCodexResetsAt(window.resetsAt ?? window.resets_at);
2520
2520
  return { usedPercent, mins, resetsAt };
2521
2521
  }
2522
- function appendBucketWindows(out, seenNames, bucketId, seedKey, snapshot) {
2522
+ function mergeBucket(windows, bucket, snapshot) {
2523
2523
  const label = clampPlanName(snapshot.limitName ?? snapshot.limit_name, MAX_WINDOW_NAME_CHARS);
2524
2524
  const primary = resolveWindowFields(snapshot.primary);
2525
2525
  const secondary = resolveWindowFields(snapshot.secondary);
2526
- const duplicateDuration = primary !== undefined && secondary !== undefined && primary.mins !== undefined && primary.mins === secondary.mins;
2527
- const slots = [
2528
- ["primary", primary],
2529
- ["secondary", secondary]
2530
- ];
2531
- for (const [slot, window] of slots) {
2532
- if (window === undefined || out.length >= MAX_PLAN_WINDOWS)
2526
+ const sharedDuration = primary?.mins !== undefined && primary.mins === secondary?.mins;
2527
+ const slots = { primary, secondary };
2528
+ for (const slot of ["primary", "secondary"]) {
2529
+ const measurement = slots[slot];
2530
+ if (!measurement)
2533
2531
  continue;
2534
- const suffix = window.mins === undefined ? `:${slot}` : duplicateDuration ? `:${window.mins}m:${slot}` : `:${window.mins}m`;
2535
- const name = clampUniqueWindowName(bucketId, suffix, seenNames, `${seedKey}:${bucketId}:${slot}`, MAX_WINDOW_NAME_CHARS);
2536
- out.push(PlanWindowSchema2.parse({
2532
+ const sameDuration = (w) => w.bucket === bucket && w.mins === measurement.mins;
2533
+ let previous = windows.findIndex((w) => sameDuration(w) && w.slot === slot);
2534
+ if (previous < 0 && measurement.mins !== undefined && !sharedDuration) {
2535
+ previous = windows.findIndex(sameDuration);
2536
+ }
2537
+ const window = { ...measurement, bucket, slot, label };
2538
+ if (previous >= 0)
2539
+ windows[previous] = window;
2540
+ else if (windows.length < MAX_PLAN_WINDOWS)
2541
+ windows.push(window);
2542
+ }
2543
+ }
2544
+ function nameBucketWindows(windows) {
2545
+ const seen = new Set;
2546
+ return windows.map((window) => {
2547
+ const { bucket, slot, usedPercent, mins, resetsAt, label } = window;
2548
+ const sharedDuration = mins !== undefined && windows.some((other) => other !== window && other.bucket === bucket && other.mins === mins);
2549
+ const suffix = mins === undefined ? `:${slot}` : sharedDuration ? `:${mins}m:${slot}` : `:${mins}m`;
2550
+ const name = clampUniqueWindowName(bucket, suffix, seen, `${bucket}:${slot}`, MAX_WINDOW_NAME_CHARS);
2551
+ return PlanWindowSchema2.parse({
2537
2552
  name,
2538
- usedPercent: Math.min(100, window.usedPercent),
2539
- ...window.resetsAt !== undefined && { resetsAt: window.resetsAt },
2540
- ...window.mins !== undefined && { windowDurationMins: window.mins },
2553
+ usedPercent: Math.min(100, usedPercent),
2554
+ ...resetsAt !== undefined && { resetsAt },
2555
+ ...mins !== undefined && { windowDurationMins: mins },
2541
2556
  ...label !== undefined && { label }
2542
- }));
2543
- }
2557
+ });
2558
+ });
2544
2559
  }
2545
2560
  function parseCodexRateLimitsInternal(reported) {
2561
+ if (!isRecord(reported))
2562
+ return { windows: [], plan: undefined };
2546
2563
  const windows = [];
2547
- const seenNames = new Set;
2548
2564
  let plan;
2549
- const capturePlan = (snapshot) => {
2550
- if (plan === undefined) {
2551
- plan = clampPlanName(snapshot.planType ?? snapshot.plan_type, MAX_WINDOW_NAME_CHARS);
2552
- }
2553
- };
2554
- if (isRecord(reported) && (("rateLimits" in reported) || ("rateLimitsByLimitId" in reported) || ("rate_limits" in reported) || ("rate_limits_by_limit_id" in reported))) {
2555
- const seenLimitIds = new Set;
2556
- const rawById = reported.rateLimitsByLimitId ?? reported.rate_limits_by_limit_id;
2557
- if (isRecord(rawById)) {
2558
- for (const mapKey of Object.keys(rawById).sort((a, b) => a.localeCompare(b))) {
2559
- const parsed = SnapshotSchema.safeParse(rawById[mapKey]);
2560
- if (!parsed.success)
2561
- continue;
2562
- capturePlan(parsed.data);
2563
- const limitId = nonEmptyString(parsed.data.limitId ?? parsed.data.limit_id)?.trim() ?? nonEmptyString(mapKey)?.trim() ?? "limit";
2564
- seenLimitIds.add(limitId);
2565
- appendBucketWindows(windows, seenNames, limitId, mapKey, parsed.data);
2566
- if (windows.length >= MAX_PLAN_WINDOWS)
2567
- return { windows, plan };
2568
- }
2569
- }
2570
- const rawSingle = reported.rateLimits ?? reported.rate_limits;
2571
- if (windows.length < MAX_PLAN_WINDOWS && rawSingle !== undefined) {
2572
- const parsedSingle = SnapshotSchema.safeParse(rawSingle);
2573
- if (parsedSingle.success) {
2574
- capturePlan(parsedSingle.data);
2575
- const explicitId = nonEmptyString(parsedSingle.data.limitId ?? parsedSingle.data.limit_id)?.trim();
2576
- const shouldIncludeSingle = seenLimitIds.size === 0 || explicitId !== undefined && !seenLimitIds.has(explicitId);
2577
- if (shouldIncludeSingle) {
2578
- appendBucketWindows(windows, seenNames, explicitId ?? "limit", explicitId ?? "rateLimits", parsedSingle.data);
2579
- }
2580
- }
2581
- }
2582
- return { windows, plan };
2583
- }
2584
- const single = SnapshotSchema.safeParse(reported);
2585
- if (!single.success)
2586
- return { windows: [], plan: undefined };
2587
- capturePlan(single.data);
2588
- const limitId = nonEmptyString(single.data.limitId ?? single.data.limit_id)?.trim() ?? "limit";
2589
- appendBucketWindows(windows, seenNames, limitId, limitId, single.data);
2590
- return { windows, plan };
2565
+ function readBucket(raw, fallbackId) {
2566
+ const parsed = SnapshotSchema.safeParse(raw);
2567
+ if (!parsed.success)
2568
+ return fallbackId;
2569
+ const snapshot = parsed.data;
2570
+ plan ??= clampPlanName(snapshot.planType ?? snapshot.plan_type, MAX_WINDOW_NAME_CHARS);
2571
+ const id = nonEmptyString(snapshot.limitId ?? snapshot.limit_id)?.trim() ?? fallbackId;
2572
+ mergeBucket(windows, id, snapshot);
2573
+ return id;
2574
+ }
2575
+ const byId = reported.rateLimitsByLimitId ?? reported.rate_limits_by_limit_id;
2576
+ const defaultId = isRecord(byId) && isRecord(byId.codex) ? "codex" : "limit";
2577
+ const accountId = readBucket(reported.rateLimits ?? reported.rate_limits ?? reported, defaultId);
2578
+ if (isRecord(byId)) {
2579
+ if (Object.hasOwn(byId, accountId))
2580
+ readBucket(byId[accountId], accountId);
2581
+ for (const key of Object.keys(byId).sort((a, b) => a.localeCompare(b))) {
2582
+ if (windows.length >= MAX_PLAN_WINDOWS)
2583
+ break;
2584
+ if (key !== accountId)
2585
+ readBucket(byId[key], nonEmptyString(key)?.trim() ?? "limit");
2586
+ }
2587
+ }
2588
+ return { windows: nameBucketWindows(windows), plan };
2591
2589
  }
2592
2590
  function codexPlanWindows(reported) {
2593
2591
  return parseCodexRateLimitsInternal(reported).windows;
@@ -17,7 +17,7 @@ import {
17
17
  offerTurnDelta,
18
18
  sessionAbort,
19
19
  emitStartupPhase
20
- } from "../../index-g2d9kws8.js";
20
+ } from "../../index-f9p62ean.js";
21
21
  import {
22
22
  JsonRpcValueSchema2,
23
23
  JsonRpcError2,
@@ -41,14 +41,14 @@ import {
41
41
  drainEngineRequests,
42
42
  endEngineTurn,
43
43
  loseEngineTurn
44
- } from "../../index-gm9yz82v.js";
44
+ } from "../../index-jcrj0b8z.js";
45
45
  import {
46
46
  dispatchTurn2,
47
47
  projectExecutorDeltas2
48
48
  } from "../../index-x5ayy5bn.js";
49
49
  import {
50
50
  mergeRateLimitEvent2
51
- } from "../../index-32vaajec.js";
51
+ } from "../../index-athc412x.js";
52
52
  import"../../index-pzhqydxb.js";
53
53
  import {
54
54
  unlinkUnixSocketIfMatching,
@@ -48,7 +48,7 @@ import {
48
48
  engineEnvironment2,
49
49
  ownCredentials2,
50
50
  helloProfile2
51
- } from "../index-g2d9kws8.js";
51
+ } from "../index-f9p62ean.js";
52
52
  import"../index-v59pxmf1.js";
53
53
  import"../index-qa2jjb65.js";
54
54
  import"../index-6kec3b14.js";
@@ -75,7 +75,7 @@ import {
75
75
  planLimitsDue2,
76
76
  planLimitsReadFailed2,
77
77
  mergeRateLimitEvent2
78
- } from "../index-32vaajec.js";
78
+ } from "../index-athc412x.js";
79
79
  import"../index-pzhqydxb.js";
80
80
  import {
81
81
  AppError2
@@ -526,10 +526,14 @@ class SyncSessionMachine {
526
526
  this.continueSnapshot(checkedResume(cursor));
527
527
  return;
528
528
  }
529
- this.openSession(cursor ? "incremental" : "full");
530
- return chain(cursor ? undefined : this.ports.beginFullSync(), () => {
529
+ if (cursor !== null)
530
+ assertNonNegativeSafeInteger("saved sync cursor", cursor, TypeError, {
531
+ absent: "refused"
532
+ });
533
+ this.openSession(cursor === null ? "full" : "incremental");
534
+ return chain(cursor === null ? this.ports.beginFullSync() : undefined, () => {
531
535
  if (this.alive(stamp))
532
- this.sendPage({ after: cursor || null, token: null });
536
+ this.sendPage({ after: cursor, token: null });
533
537
  });
534
538
  }), (error) => {
535
539
  if (!this.alive(stamp))
@@ -621,7 +625,7 @@ class SyncSessionMachine {
621
625
  const full = this.mode === "full";
622
626
  const from = full ? this.snapshotFrom : null;
623
627
  const catchUp = from !== null && (page.latestVersion ?? from) > from;
624
- return chain(full ? this.rebasePending() : undefined, () => this.saveLastPage(stamp, expected, catchUp ? from : page.latestVersion, catchUp));
628
+ return chain(full ? this.rebasePending() : undefined, () => this.saveLastPage(stamp, expected, catchUp ? from : page.latestVersion ?? from ?? undefined, catchUp));
625
629
  }
626
630
  saveLastPage(stamp, expected, cursor, catchUp) {
627
631
  if (!this.alive(stamp))
@@ -2,7 +2,7 @@ import {
2
2
  PlanWindowSchema2,
3
3
  PlanLimitsSchema2,
4
4
  clampPlanName
5
- } from "./index-g2d9kws8.js";
5
+ } from "./index-f9p62ean.js";
6
6
  import {
7
7
  isPositiveSafeInteger
8
8
  } from "./index-gr0kxymw.js";
@@ -344,6 +344,8 @@ import { createHash } from "node:crypto";
344
344
  import { z as z5 } from "zod";
345
345
 
346
346
  // src/agent-executor/profile.ts
347
+ import { homedir } from "node:os";
348
+ import { dirname, isAbsolute, resolve } from "node:path";
347
349
  import { z as z4 } from "zod";
348
350
  var EXECUTOR_ENV_KEY_PATTERN2 = /^[A-Z_][A-Z0-9_]*$/;
349
351
  function sanitizeProfileEnv2(env) {
@@ -361,14 +363,24 @@ var ExecutorProfileConfigSchema2 = z4.strictObject({
361
363
  profileId: z4.string().min(1).max(128),
362
364
  engine: ExecutorEngineSchema2,
363
365
  home: z4.string().min(1),
366
+ claudeConfigDir: z4.literal("default").optional(),
364
367
  accountLabel: z4.string().min(1).max(200).optional(),
365
368
  env: z4.record(z4.string().regex(EXECUTOR_ENV_KEY_PATTERN2), z4.string()).default({})
369
+ }).refine((profile) => profile.claudeConfigDir === undefined || (profile.engine === "claude-sdk" || profile.engine === "claude-cli") && profile.env.CLAUDE_CONFIG_DIR === undefined, {
370
+ path: ["claudeConfigDir"],
371
+ message: "Default Claude configuration requires a Claude engine and no declared CLAUDE_CONFIG_DIR"
366
372
  });
367
- function engineProfile(engine, raw) {
373
+ function engineProfile(engine, raw, ambient = process.env) {
368
374
  const profile = ExecutorProfileConfigSchema2.parse(raw);
369
375
  if (profile.engine !== engine) {
370
376
  throw new TypeError(`Profile ${profile.profileId} is for the ${profile.engine} engine; this driver runs ${engine}`);
371
377
  }
378
+ if (profile.claudeConfigDir === "default") {
379
+ const userHome = profile.env.HOME ?? ambient.HOME ?? homedir();
380
+ if (!isAbsolute(userHome) || !isAbsolute(profile.home) || resolve(profile.home) !== resolve(userHome, ".claude")) {
381
+ throw new TypeError("The default Claude profile home must match .claude under the engine user home");
382
+ }
383
+ }
372
384
  return profile;
373
385
  }
374
386
  var INHERITED = ["PATH", "HOME", "USER", "LOGNAME", "SHELL", "LANG", "TMPDIR", "TERM", "TZ"];
@@ -388,7 +400,7 @@ var HOME_VARIABLE = {
388
400
  acp: "HOME"
389
401
  };
390
402
  function engineEnvironment2(rawProfile, ambient) {
391
- const profile = ExecutorProfileConfigSchema2.parse(rawProfile);
403
+ const profile = engineProfile(rawProfile.engine, rawProfile, ambient);
392
404
  const env = {};
393
405
  for (const [name, value] of Object.entries(ambient)) {
394
406
  if (value === undefined)
@@ -396,14 +408,18 @@ function engineEnvironment2(rawProfile, ambient) {
396
408
  if (INHERITED.includes(name) || name.startsWith("LC_"))
397
409
  env[name] = value;
398
410
  }
399
- env[HOME_VARIABLE[profile.engine]] = profile.home;
411
+ if (profile.claudeConfigDir === "default") {
412
+ env.HOME = profile.env.HOME ?? env.HOME ?? dirname(resolve(profile.home));
413
+ } else {
414
+ env[HOME_VARIABLE[profile.engine]] = profile.home;
415
+ }
400
416
  return { ...env, ...profile.env };
401
417
  }
402
418
  function ownCredentials2(ambient) {
403
419
  return CREDENTIAL_VARIABLES2.filter((name) => (ambient[name] ?? "") !== "");
404
420
  }
405
421
  function helloProfile2(input) {
406
- const profile = ExecutorProfileConfigSchema2.parse(input.profile);
422
+ const profile = engineProfile(input.profile.engine, input.profile, input.ambient);
407
423
  return {
408
424
  profileId: profile.profileId,
409
425
  engine: profile.engine,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  offerTurnDelta
3
- } from "./index-g2d9kws8.js";
3
+ } from "./index-f9p62ean.js";
4
4
 
5
5
  // src/agent-executor/engine-requests.ts
6
6
  function holdEngineRequest(turn, request) {
@@ -8,7 +8,7 @@ import {
8
8
  epochSecondsToIso,
9
9
  safeJsonValue,
10
10
  clampUniqueWindowName
11
- } from "./index-g2d9kws8.js";
11
+ } from "./index-f9p62ean.js";
12
12
  import {
13
13
  isSupportedImageMediaType
14
14
  } from "./index-y0a4gt1s.js";
@@ -1101,16 +1101,16 @@ function extractUsageWindows(bucketMap) {
1101
1101
  if (!entry.success)
1102
1102
  continue;
1103
1103
  const { display_name, utilization, resets_at } = entry.data;
1104
- const label = nonEmptyString(display_name)?.trim().slice(0, MAX_WINDOW_NAME_CHARS);
1105
- if (label === undefined || utilization == null || !Number.isFinite(utilization))
1104
+ const label = clampPlanName(display_name, MAX_WINDOW_NAME_CHARS);
1105
+ if (utilization == null || !Number.isFinite(utilization))
1106
1106
  continue;
1107
- const name = clampUniqueWindowName(`model:${label}`, "", seenNames, `model:${display_name ?? label}:${index}`, MAX_WINDOW_NAME_CHARS);
1107
+ const name = clampUniqueWindowName(label === undefined ? "model_scoped" : `model:${label}`, "", seenNames, `model:${display_name ?? label}:${index}`, MAX_WINDOW_NAME_CHARS);
1108
1108
  const resetsAt = parseIsoReset(resets_at);
1109
1109
  windows.push(PlanWindowSchema2.parse({
1110
1110
  name,
1111
1111
  usedPercent: Math.min(100, utilization),
1112
1112
  ...resetsAt !== undefined && { resetsAt },
1113
- label
1113
+ ...label !== undefined && { label, scope: label }
1114
1114
  }));
1115
1115
  }
1116
1116
  }
@@ -1324,8 +1324,8 @@ async function claudeTranscriptExists(path) {
1324
1324
  await handle.close();
1325
1325
  return true;
1326
1326
  }
1327
- async function findTranscriptInput2(engine, input) {
1328
- const profile = engineProfile(engine, input.profile);
1327
+ async function findTranscriptInput2(engine, input, ambient) {
1328
+ const profile = engineProfile(engine, input.profile, ambient);
1329
1329
  return claudeTranscriptHasUuid2(claudeTranscriptPath2({
1330
1330
  home: profile.home,
1331
1331
  cwd: input.cwd,