@openrig/cli 0.1.8 → 0.1.10

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 (87) hide show
  1. package/daemon/dist/adapters/claude-code-adapter.d.ts +14 -0
  2. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  3. package/daemon/dist/adapters/claude-code-adapter.js +103 -8
  4. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  5. package/daemon/dist/adapters/cmux-transport.d.ts +7 -2
  6. package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
  7. package/daemon/dist/adapters/cmux-transport.js +149 -24
  8. package/daemon/dist/adapters/cmux-transport.js.map +1 -1
  9. package/daemon/dist/adapters/cmux.d.ts.map +1 -1
  10. package/daemon/dist/adapters/cmux.js +1 -0
  11. package/daemon/dist/adapters/cmux.js.map +1 -1
  12. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +11 -0
  13. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  14. package/daemon/dist/adapters/codex-runtime-adapter.js +65 -7
  15. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  16. package/daemon/dist/domain/graph-projection.d.ts +2 -2
  17. package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
  18. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  19. package/daemon/dist/domain/native-resume-probe.js +11 -0
  20. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  21. package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
  22. package/daemon/dist/domain/pod-bundle-assembler.js +10 -0
  23. package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
  24. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  25. package/daemon/dist/domain/rigspec-codec.js +2 -0
  26. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  27. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  28. package/daemon/dist/domain/rigspec-schema.js +28 -0
  29. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  30. package/daemon/dist/domain/session-registry.d.ts +1 -1
  31. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  32. package/daemon/dist/domain/session-registry.js.map +1 -1
  33. package/daemon/dist/domain/startup-orchestrator.d.ts +1 -1
  34. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  35. package/daemon/dist/domain/startup-orchestrator.js +21 -22
  36. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  37. package/daemon/dist/domain/types.d.ts +6 -2
  38. package/daemon/dist/domain/types.d.ts.map +1 -1
  39. package/daemon/dist/startup.d.ts.map +1 -1
  40. package/daemon/dist/startup.js +14 -0
  41. package/daemon/dist/startup.js.map +1 -1
  42. package/daemon/docs/reference/agent-spec.md +411 -0
  43. package/daemon/docs/reference/agent-startup-guide.md +358 -0
  44. package/daemon/docs/reference/edge-types.md +126 -0
  45. package/daemon/docs/reference/rig-bundle.md +367 -0
  46. package/daemon/docs/reference/rig-spec.md +479 -0
  47. package/daemon/specs/agents/product-management/pm/agent.yaml +37 -0
  48. package/daemon/specs/agents/product-management/pm/guidance/role.md +43 -0
  49. package/daemon/specs/agents/shared/agent.yaml +17 -0
  50. package/daemon/specs/agents/shared/skills/pm/backlog-capture/SKILL.md +43 -0
  51. package/daemon/specs/agents/shared/skills/pm/context-builder/SKILL.md +87 -0
  52. package/daemon/specs/agents/shared/skills/pm/exec-summary/SKILL.md +84 -0
  53. package/daemon/specs/agents/shared/skills/pm/office-hours/SKILL.md +129 -0
  54. package/daemon/specs/agents/shared/skills/pm/plan-review/SKILL.md +98 -0
  55. package/daemon/specs/agents/shared/skills/pm/requirements-writer/SKILL.md +113 -0
  56. package/daemon/specs/agents/shared/skills/pm/ui-mockup/SKILL.md +76 -0
  57. package/daemon/specs/agents/shared/skills/rig-architect/SKILL.md +342 -0
  58. package/daemon/specs/rigs/focused/pm-team/CULTURE.md +17 -0
  59. package/daemon/specs/rigs/focused/pm-team/rig.yaml +51 -0
  60. package/dist/bin-wrapper.js +0 -0
  61. package/dist/commands/daemon.d.ts.map +1 -1
  62. package/dist/commands/daemon.js +3 -2
  63. package/dist/commands/daemon.js.map +1 -1
  64. package/dist/commands/doctor.d.ts +6 -1
  65. package/dist/commands/doctor.d.ts.map +1 -1
  66. package/dist/commands/doctor.js +53 -10
  67. package/dist/commands/doctor.js.map +1 -1
  68. package/dist/commands/setup.d.ts +48 -0
  69. package/dist/commands/setup.d.ts.map +1 -0
  70. package/dist/commands/setup.js +457 -0
  71. package/dist/commands/setup.js.map +1 -0
  72. package/dist/daemon-lifecycle.d.ts +7 -0
  73. package/dist/daemon-lifecycle.d.ts.map +1 -1
  74. package/dist/daemon-lifecycle.js +116 -19
  75. package/dist/daemon-lifecycle.js.map +1 -1
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +2 -0
  78. package/dist/index.js.map +1 -1
  79. package/package.json +1 -1
  80. package/ui/dist/assets/index-DlMH-REm.css +1 -0
  81. package/ui/dist/assets/{index-CXZYxZbF.js → index-lEO-zBxz.js} +26 -26
  82. package/ui/dist/index.html +2 -2
  83. package/dist/commands/claim.d.ts +0 -4
  84. package/dist/commands/claim.d.ts.map +0 -1
  85. package/dist/commands/claim.js +0 -40
  86. package/dist/commands/claim.js.map +0 -1
  87. package/ui/dist/assets/index-BsXbqPEl.css +0 -1
@@ -0,0 +1,367 @@
1
+ # RigBundle Reference
2
+
3
+ Version: 2 (pod-aware)
4
+ Last validated against code: 2026-04-11
5
+ Source of truth: `packages/daemon/src/domain/bundle-types.ts`, `packages/daemon/src/domain/bundle-archive.ts`, `packages/daemon/src/domain/pod-bundle-assembler.ts`
6
+
7
+ A `.rigbundle` is a self-contained distributable archive that packages a rig spec, all referenced agent specs, their resources (skills, guidance, startup files), culture file, documentation, and an integrity manifest into a single file. The recipient can install and launch the rig without needing the original source tree.
8
+
9
+ ---
10
+
11
+ ## Archive Format
12
+
13
+ A `.rigbundle` file is a gzip-compressed tar archive (`.tar.gz`) with a fixed structure.
14
+
15
+ ### File extension
16
+
17
+ The archive MUST have the `.rigbundle` extension. The packer rejects output paths that don't end with `.rigbundle`.
18
+
19
+ ### Sibling digest file
20
+
21
+ Every `.rigbundle` has a sibling `.rigbundle.sha256` file containing the SHA-256 hex digest of the archive. This detects corruption during transfer. The unpacker verifies this digest before extraction.
22
+
23
+ Example:
24
+ ```
25
+ my-rig.rigbundle — the archive
26
+ my-rig.rigbundle.sha256 — "a1b2c3d4..." (64-char hex SHA-256)
27
+ ```
28
+
29
+ ### Determinism
30
+
31
+ The packer produces deterministic output:
32
+ - Files are sorted alphabetically
33
+ - A fixed mtime is used (`2026-01-01T00:00:00Z`)
34
+ - Portable mode normalizes uid/gid/mode
35
+ - Maximum gzip compression (level 9)
36
+
37
+ This means the same inputs always produce the same archive hash.
38
+
39
+ ---
40
+
41
+ ## Archive Layout
42
+
43
+ ```
44
+ bundle.yaml — manifest (required)
45
+ rig.yaml — the RigSpec (required, may be rewritten)
46
+ CULTURE.md — culture file (if declared in rig spec)
47
+ SETUP.md — documentation (if declared in rig spec docs field)
48
+ agents/
49
+ agent-name/
50
+ agent.yaml — AgentSpec
51
+ guidance/
52
+ role.md — guidance files
53
+ skills/
54
+ skill-name/
55
+ SKILL.md — skill files
56
+ startup/
57
+ context.md — startup files
58
+ ```
59
+
60
+ ### Key rules
61
+
62
+ - `bundle.yaml` is the manifest — always present, always at the root
63
+ - `rig.yaml` is the rig spec — rewritten during assembly with vendored `agent_ref` paths
64
+ - Agent directories are vendored copies of the original agent specs with all their resources
65
+ - Import refs are rewritten from the original `local:` or `path:` paths to bundle-relative `local:` paths
66
+ - All file paths within the archive are safe relative paths (no `..`, no absolute, no symlinks)
67
+
68
+ ---
69
+
70
+ ## Manifest (`bundle.yaml`)
71
+
72
+ The manifest is a YAML file at the archive root that describes the bundle contents.
73
+
74
+ ### Schema Version 2 (pod-aware, current)
75
+
76
+ ```yaml
77
+ schema_version: 2
78
+ name: my-bundle
79
+ version: "0.1.0"
80
+ created_at: "2026-04-11T22:32:48.570Z"
81
+ rig_spec: rig.yaml
82
+ agents:
83
+ - name: pm-lead
84
+ version: "1.0"
85
+ path: agents/pm-lead
86
+ original_ref: "local:agents/pm-lead"
87
+ hash: "ed4cff20..."
88
+ import_entries: []
89
+ - name: researcher
90
+ version: "1.0"
91
+ path: agents/researcher
92
+ original_ref: "local:agents/researcher"
93
+ hash: "11f8a077..."
94
+ import_entries:
95
+ - name: shared
96
+ version: "1.0"
97
+ path: agents/shared
98
+ original_ref: "local:../../shared"
99
+ hash: "abc123..."
100
+ culture_file: CULTURE.md
101
+ integrity:
102
+ algorithm: sha256
103
+ files:
104
+ rig.yaml: "b80c0674..."
105
+ CULTURE.md: "9354361b..."
106
+ agents/pm-lead/agent.yaml: "ed4cff20..."
107
+ # ... every file in the archive
108
+ ```
109
+
110
+ ### Manifest Fields
111
+
112
+ | Field | Type | Required | Description |
113
+ |-------|------|----------|-------------|
114
+ | `schema_version` | number | yes | Must be `2` for pod-aware bundles. |
115
+ | `name` | string | yes | Bundle name. |
116
+ | `version` | string | yes | Bundle version. |
117
+ | `created_at` | string | yes | ISO-8601 timestamp of creation. |
118
+ | `rig_spec` | string | yes | Relative path to the rig spec within the archive. Safe relative path. |
119
+ | `agents` | AgentEntry[] | yes | Array of vendored agent entries. |
120
+ | `culture_file` | string | no | Relative path to the culture file if present. |
121
+ | `integrity` | Integrity | no | Per-file SHA-256 checksums for content verification. |
122
+
123
+ ### Agent Entry Fields
124
+
125
+ | Field | Type | Required | Description |
126
+ |-------|------|----------|-------------|
127
+ | `name` | string | yes | Agent name (from agent.yaml). |
128
+ | `version` | string | no | Agent version. |
129
+ | `path` | string | yes | Relative path to the vendored agent directory. Safe relative path. |
130
+ | `original_ref` | string | yes | The original `agent_ref` before rewriting. |
131
+ | `hash` | string | yes | SHA-256 hash of the agent.yaml content. |
132
+ | `import_entries` | ImportEntry[] | yes | Vendored imports for this agent (may be empty). |
133
+
134
+ ### Import Entry Fields
135
+
136
+ | Field | Type | Required | Description |
137
+ |-------|------|----------|-------------|
138
+ | `name` | string | yes | Imported agent name. |
139
+ | `version` | string | yes | Imported agent version. |
140
+ | `path` | string | yes | Relative path to the vendored import within the archive. |
141
+ | `original_ref` | string | yes | The original import ref before rewriting. |
142
+ | `hash` | string | yes | SHA-256 hash of the imported agent.yaml. |
143
+
144
+ ### Integrity Section
145
+
146
+ | Field | Type | Required | Description |
147
+ |-------|------|----------|-------------|
148
+ | `algorithm` | string | yes | Must be `sha256`. |
149
+ | `files` | map<string, string> | yes | Map of archive-relative file path → SHA-256 hex hash. Every file in the archive (except `bundle.yaml` itself) should be listed. |
150
+
151
+ ---
152
+
153
+ ## Security Model
154
+
155
+ Bundle integrity provides **self-consistency verification, not authenticity**.
156
+
157
+ - The sibling `.sha256` file detects corruption during transfer
158
+ - The per-file integrity hashes detect tampering of individual files within the archive
159
+ - Neither mechanism authenticates the bundle author
160
+
161
+ An attacker who can rewrite the full bundle + digest can bypass verification. Users must trust the source they obtained the bundle from. This is the same trust model as unsigned npm packages and Docker images.
162
+
163
+ Future enhancement: cryptographic signing (Ed25519) for author authentication.
164
+
165
+ ---
166
+
167
+ ## Safety Guarantees
168
+
169
+ The unpacker enforces these safety rules before extraction:
170
+
171
+ 1. **No symlinks or hardlinks** — `SymbolicLink` and `Link` entries are rejected
172
+ 2. **No absolute paths** — entries starting with `/` are rejected
173
+ 3. **No path traversal** — entries containing `..` segments are rejected
174
+ 4. **Digest verification** — archive SHA-256 must match the sibling `.sha256` file
175
+ 5. **Content integrity** — after extraction, per-file hashes are verified against the manifest
176
+
177
+ If any check fails, extraction is aborted and an error is thrown.
178
+
179
+ ---
180
+
181
+ ## CLI Surface
182
+
183
+ ### Create a bundle
184
+
185
+ ```bash
186
+ rig bundle create <spec-path> -o <output.rigbundle> [--rig-root <dir>] [--name <name>] [--bundle-version <ver>]
187
+ ```
188
+
189
+ | Flag | Required | Default | Description |
190
+ |------|----------|---------|-------------|
191
+ | `<spec-path>` | yes | — | Path to the rig spec YAML file. |
192
+ | `-o, --output` | yes | — | Output path. Must end with `.rigbundle`. |
193
+ | `--rig-root` | no | spec directory | Root directory for resolving `agent_ref` and other relative paths. |
194
+ | `--name` | no | `my-bundle` | Bundle name in the manifest. |
195
+ | `--bundle-version` | no | `0.1.0` | Bundle version in the manifest. |
196
+
197
+ The create command:
198
+ 1. Validates the rig spec
199
+ 2. Resolves all `agent_ref` paths and their imports
200
+ 3. Vendors all agent specs, resources, and startup files into a staging directory
201
+ 4. Rewrites `agent_ref` paths to bundle-relative `local:` refs
202
+ 5. Collects culture file, docs files, and rig-level startup files
203
+ 6. Computes per-file integrity hashes
204
+ 7. Writes the manifest (`bundle.yaml`)
205
+ 8. Packs into a deterministic `.tar.gz`
206
+ 9. Writes the sibling `.sha256` digest
207
+
208
+ ### Inspect a bundle
209
+
210
+ ```bash
211
+ rig bundle inspect <bundle-path> [--json]
212
+ ```
213
+
214
+ Shows the manifest, digest validity, and integrity verification result. Inspect extracts the archive into a temporary directory for safe validation, then cleans that directory up. It does not install the bundle.
215
+
216
+ ### Install a bundle
217
+
218
+ ```bash
219
+ rig bundle install <bundle-path> [--plan] [--yes] [--target <root>] [--json]
220
+ ```
221
+
222
+ | Flag | Required | Default | Description |
223
+ |------|----------|---------|-------------|
224
+ | `<bundle-path>` | yes | — | Path to the `.rigbundle` file. |
225
+ | `--plan` | no | `false` | Preview the bootstrap plan without installing or launching. |
226
+ | `--yes` | no | `false` | Auto-approve trusted actions during apply mode. |
227
+ | `--target <root>` | yes in apply mode | — | Target root directory for package installation. Required unless `--plan` is used. |
228
+ | `--json` | no | `false` | Emit machine-readable JSON. |
229
+
230
+ Extracts the bundle, validates integrity, and bootstraps the rig. In apply mode, the daemon requires `targetRoot`, so `rig bundle install` must be given `--target <root>` unless you are running with `--plan`.
231
+
232
+ ### Launch directly
233
+
234
+ ```bash
235
+ rig up <bundle-path> [--target <root>] [--cwd <dir>]
236
+ ```
237
+
238
+ `rig up` auto-detects `.rigbundle` files and routes them through the bundle bootstrap path.
239
+
240
+ - `--target <root>` controls where packaged files are installed
241
+ - if `--target` is omitted for a `.rigbundle`, the CLI defaults the install target to the current working directory
242
+ - `--cwd <dir>` does **not** change the install target; it only overrides the launched members' working directory for that run
243
+
244
+ ---
245
+
246
+ ## Assembly Process
247
+
248
+ When `rig bundle create` runs, the `PodBundleAssembler` performs these steps:
249
+
250
+ 1. **Parse and validate** the rig spec
251
+ 2. **Collect rig-level files:**
252
+ - Culture file (if `culture_file` is set)
253
+ - Docs files (if `docs` array is set) — **required: missing docs fail assembly**
254
+ - Rig-level startup files
255
+ - Pod-level and member-level startup files
256
+ 3. **For each member's `agent_ref`:**
257
+ - Resolve the ref to an agent spec directory
258
+ - Copy the agent spec and all its resources (skills, guidance, hooks, startup, runtime resources)
259
+ - Recursively resolve and copy imports
260
+ - Record the agent entry in the manifest with its hash
261
+ - Rewrite the ref to a bundle-relative `local:` path
262
+ 4. **Write the rewritten rig spec** to the staging directory
263
+ 5. **Compute integrity** — SHA-256 of every file in the staging directory
264
+ 6. **Write the manifest** (`bundle.yaml`) with all entries and integrity
265
+ 7. **Pack** the staging directory into a deterministic tar.gz
266
+
267
+ ### Terminal nodes
268
+
269
+ Members with `agent_ref: "builtin:terminal"` are bundle-native sentinels. They are not vendored — the runtime handles them directly.
270
+
271
+ ### Deduplication
272
+
273
+ If multiple members reference the same agent spec (same resolved path), the spec is vendored once and all members' refs are rewritten to the same bundle-relative path.
274
+
275
+ ### Import resolution
276
+
277
+ When an agent spec has `imports`, each import is resolved, vendored into the bundle, and the import refs in the vendored agent.yaml are rewritten to bundle-relative `local:` paths. Import entries are recorded in the manifest's agent entry.
278
+
279
+ ---
280
+
281
+ ## Validation Rules Summary
282
+
283
+ ### Manifest validation (schema version 2)
284
+
285
+ 1. `schema_version` must be `2`
286
+ 2. `name` is required non-empty string
287
+ 3. `version` is required non-empty string
288
+ 4. `created_at` is required non-empty string
289
+ 5. `rig_spec` is required and must be a safe relative path
290
+ 6. `agents` must be an array
291
+ 7. Each agent must have `name`, `path` (safe relative), and `hash`
292
+ 8. Integrity `algorithm` must be `sha256`
293
+ 9. Integrity `files` must be a non-empty map of safe-relative-path → 64-char hex hash
294
+
295
+ ### Archive safety (enforced on unpack)
296
+
297
+ 1. No symlinks or hardlinks
298
+ 2. No absolute paths
299
+ 3. No `..` path traversal
300
+ 4. Archive digest must match sibling `.sha256`
301
+ 5. Per-file content hashes must match integrity section
302
+
303
+ ### Assembly validation
304
+
305
+ 1. Rig spec must validate
306
+ 2. All `agent_ref` paths must resolve to valid agent specs
307
+ 3. All declared `docs` files must exist on disk (missing docs fail assembly)
308
+ 4. Culture file and startup files are collected best-effort (missing = skipped)
309
+
310
+ ---
311
+
312
+ ## Legacy Bundles (Schema Version 1)
313
+
314
+ Schema version 1 bundles are the pre-reboot format using flat-node rig specs and package-based bundling. They are still supported for backward compatibility but should not be created for new rigs.
315
+
316
+ Key differences from v2:
317
+ - `schema_version: 1` in the manifest
318
+ - `packages` array instead of `agents` array
319
+ - Package entries have `original_source` instead of `original_ref`
320
+ - No `import_entries` in package entries
321
+ - Legacy rig spec format (flat nodes, not pods)
322
+
323
+ ---
324
+
325
+ ## Example: Creating and Using a Bundle
326
+
327
+ ### Create
328
+
329
+ ```bash
330
+ # From the rig directory
331
+ rig bundle create rig.yaml -o my-team.rigbundle --rig-root . --name my-team --bundle-version 1.0.0
332
+ ```
333
+
334
+ Output:
335
+ ```
336
+ Bundle created: my-team.rigbundle
337
+ Name: my-team v1.0.0
338
+ Hash: a1b2c3d4e5f6...
339
+ ```
340
+
341
+ ### Inspect
342
+
343
+ ```bash
344
+ rig bundle inspect my-team.rigbundle
345
+ ```
346
+
347
+ Output:
348
+ ```
349
+ Bundle: my-team v1.0.0
350
+ Digest valid: true
351
+ Integrity: PASS
352
+ ```
353
+
354
+ ### Install and launch
355
+
356
+ ```bash
357
+ cd ~/projects/my-project
358
+ rig up /path/to/my-team.rigbundle
359
+ ```
360
+
361
+ Equivalent explicit form:
362
+
363
+ ```bash
364
+ rig up /path/to/my-team.rigbundle --target ~/projects/my-project
365
+ ```
366
+
367
+ The bundle is extracted to a temporary directory, integrity is verified, packaged files are installed into the target root, and the rig is bootstrapped with all agents and resources from the bundle. If you also want agents to launch with a different working directory for that run, pass `--cwd <dir>` separately.