@cleocode/caamp 2026.4.14 → 2026.4.16

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/cli.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  tokenizeCriteriaValue,
53
53
  updateInstructionsSingleOperation,
54
54
  validateSkill
55
- } from "./chunk-VD2JJXE7.js";
55
+ } from "./chunk-K7AO3SE7.js";
56
56
  import {
57
57
  buildSkillsMap,
58
58
  checkAllInjections,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { WorktreeHandle } from '@cleocode/cant';
2
+
1
3
  /**
2
4
  * Priority tier identifier stored in registry.json.
3
5
  *
@@ -2111,11 +2113,33 @@ interface SubagentSpawnOptions {
2111
2113
  *
2112
2114
  * @remarks
2113
2115
  * Useful when the same task description is reused across multiple
2114
- * working directories.
2116
+ * working directories. When {@link worktree} is also set, the worktree
2117
+ * path is used as the cwd and this field is ignored.
2115
2118
  *
2116
2119
  * @defaultValue undefined
2117
2120
  */
2118
2121
  cwd?: string;
2122
+ /**
2123
+ * Git worktree handle providing physical + logical isolation for the
2124
+ * spawned subagent (ADR-041 §D2).
2125
+ *
2126
+ * @remarks
2127
+ * When set, `PiHarness.spawnSubagent` MUST:
2128
+ * 1. Pass `cwd: worktree.path` to the Pi subprocess.
2129
+ * 2. Inject the following env vars (before `opts.env` and `task.env`):
2130
+ * - `CLEO_WORKTREE_ROOT` = worktree.path
2131
+ * - `CLEO_WORKTREE_BRANCH` = worktree.branch
2132
+ * - `CLEO_PROJECT_HASH` = worktree.projectHash
2133
+ *
2134
+ * These env vars allow `getProjectRoot()` inside the worker to resolve
2135
+ * DB paths against the correct worktree directory via the
2136
+ * `worktreeScope` AsyncLocalStorage (ADR-041 §D3) or direct env-var
2137
+ * inspection when AsyncLocalStorage is not in scope.
2138
+ *
2139
+ * @defaultValue undefined
2140
+ * @task T380
2141
+ */
2142
+ worktree?: WorktreeHandle;
2119
2143
  }
2120
2144
  /**
2121
2145
  * One streaming event surfaced through {@link SubagentSpawnOptions.onStream}.
@@ -3219,9 +3243,24 @@ declare class PiHarness implements Harness {
3219
3243
  * `spawnCommand` so callers see configuration errors early rather
3220
3244
  * than at child-exit time.
3221
3245
  *
3246
+ * **Worktree isolation (T380/ADR-041 §D2)** — Pass a
3247
+ * {@link SubagentSpawnOptions.worktree} handle to bind the spawned
3248
+ * process to a physical git worktree. When set, this method:
3249
+ * - Uses `worktree.path` as the child cwd.
3250
+ * - Injects `CLEO_WORKTREE_ROOT`, `CLEO_WORKTREE_BRANCH`, and
3251
+ * `CLEO_PROJECT_HASH` env vars so the child's path resolvers
3252
+ * (including `getProjectRoot()` via `worktreeScope`) direct DB I/O
3253
+ * to the correct worktree directory.
3254
+ *
3255
+ * The spawned worker MUST run the worktree guard defined in
3256
+ * `packages/agents/cleo-subagent/AGENT.md §WORKTREE GUARD` as its
3257
+ * first Bash call. That guard verifies the cwd binding was applied
3258
+ * correctly before any file I/O occurs.
3259
+ *
3222
3260
  * @param task - Subagent task specification.
3223
- * @param opts - Per-call streaming and cleanup overrides.
3261
+ * @param opts - Per-call streaming, cleanup, and worktree overrides.
3224
3262
  * @returns A live subagent handle.
3263
+ * @task T380
3225
3264
  */
3226
3265
  spawnSubagent(task: SubagentTask, opts?: SubagentSpawnOptions): Promise<SubagentHandle>;
3227
3266
  /**
@@ -6319,11 +6358,27 @@ declare function providerSupportsById(idOrAlias: string, capabilityPath: string)
6319
6358
  *
6320
6359
  * This is an interface-only module — no concrete implementations yet.
6321
6360
  * CLEO will consume this interface to build provider-specific adapters.
6361
+ *
6362
+ * @remarks
6363
+ * T380/ADR-041: `SpawnOptions.isolate: boolean` has been superseded by
6364
+ * `SpawnOptions.worktree: WorktreeHandle`. The boolean alias is kept for one
6365
+ * release cycle (removal target: v2026.5.x) so existing callers compile
6366
+ * without changes during the migration window.
6322
6367
  */
6323
6368
 
6324
6369
  /**
6325
6370
  * Options for spawning a subagent.
6326
6371
  *
6372
+ * @remarks
6373
+ * When `worktree` is present, the spawn adapter MUST bind the child process
6374
+ * cwd to `worktree.path` and export the following environment variables:
6375
+ * - `CLEO_WORKTREE_ROOT` = worktree.path
6376
+ * - `CLEO_WORKTREE_BRANCH` = worktree.branch
6377
+ * - `CLEO_PROJECT_HASH` = worktree.projectHash
6378
+ *
6379
+ * See ADR-041 §D2 and ULTRAPLAN §14 for the full isolation contract.
6380
+ *
6381
+ * @task T380
6327
6382
  * @public
6328
6383
  */
6329
6384
  interface SpawnOptions {
@@ -6335,7 +6390,33 @@ interface SpawnOptions {
6335
6390
  tools?: string[];
6336
6391
  /** Timeout in milliseconds for the spawned agent. @defaultValue undefined */
6337
6392
  timeout?: number;
6338
- /** Whether to isolate the spawned agent (e.g. in a worktree). @defaultValue undefined */
6393
+ /**
6394
+ * Git worktree handle that provides physical + logical isolation for the
6395
+ * spawned subagent (ADR-041 §D1).
6396
+ *
6397
+ * @remarks
6398
+ * When set, the adapter MUST pass `cwd: worktree.path` to the child process
6399
+ * and export `CLEO_WORKTREE_ROOT`, `CLEO_WORKTREE_BRANCH`, and
6400
+ * `CLEO_PROJECT_HASH` into its environment so that path resolvers inside
6401
+ * the worker direct DB I/O to the correct worktree directory.
6402
+ *
6403
+ * Supersedes the deprecated {@link SpawnOptions.isolate} boolean which
6404
+ * carried no data and could not drive cwd binding or env-var injection.
6405
+ *
6406
+ * @defaultValue undefined
6407
+ * @task T380
6408
+ */
6409
+ worktree?: WorktreeHandle;
6410
+ /**
6411
+ * Whether to isolate the spawned agent (e.g. in a worktree).
6412
+ *
6413
+ * @deprecated Use `worktree` instead. The boolean flag has no associated
6414
+ * data and cannot drive cwd binding or env-var injection. Pass a
6415
+ * {@link WorktreeHandle} via `worktree` to achieve isolation.
6416
+ * Removal target: v2026.5.x.
6417
+ *
6418
+ * @defaultValue undefined
6419
+ */
6339
6420
  isolate?: boolean;
6340
6421
  }
6341
6422
  /**
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ import {
70
70
  validateRecommendationCriteria,
71
71
  validateSkill,
72
72
  writeConfig
73
- } from "./chunk-VD2JJXE7.js";
73
+ } from "./chunk-K7AO3SE7.js";
74
74
  import {
75
75
  buildInjectionContent,
76
76
  buildSkillsMap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/caamp",
3
- "version": "2026.4.14",
3
+ "version": "2026.4.16",
4
4
  "description": "Central AI Agent Managed Packages - unified provider registry and package manager for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,8 +10,8 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
15
  }
16
16
  },
17
17
  "files": [
@@ -51,8 +51,8 @@
51
51
  "jsonc-parser": "^3.3.1",
52
52
  "picocolors": "^1.1.1",
53
53
  "simple-git": "3.33.0",
54
- "@cleocode/lafs": "2026.4.14",
55
- "@cleocode/cant": "2026.4.14"
54
+ "@cleocode/lafs": "2026.4.16",
55
+ "@cleocode/cant": "2026.4.16"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@biomejs/biome": "2.4.8",
@@ -63,7 +63,7 @@
63
63
  "tsup": "^8.5.0",
64
64
  "tsx": "^4.21.0",
65
65
  "typedoc": "0.28.17",
66
- "typescript": "^5.9.0",
66
+ "typescript": "^6.0.2",
67
67
  "vitest": "^4.1.4"
68
68
  },
69
69
  "engines": {