@north-light/crouter 0.3.220 → 0.3.222

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 (271) hide show
  1. package/dist/api/client.d.ts +29 -0
  2. package/dist/api/client.js +44 -0
  3. package/dist/api/dto/chat-inventory.d.ts +56 -0
  4. package/dist/api/dto/chat-inventory.js +11 -0
  5. package/dist/api/dto/human-requests.d.ts +88 -0
  6. package/dist/api/dto/human-requests.js +4 -0
  7. package/dist/api/dto/human.d.ts +3 -0
  8. package/dist/api/dto/profiles.d.ts +19 -5
  9. package/dist/api/dto/profiles.js +2 -1
  10. package/dist/api/dto/reviews.d.ts +2 -0
  11. package/dist/api/index.d.ts +2 -0
  12. package/dist/api/index.js +2 -0
  13. package/dist/api/routes.d.ts +8 -0
  14. package/dist/api/routes.js +11 -0
  15. package/dist/build-root.d.ts +2 -6
  16. package/dist/build-root.js +51 -4
  17. package/dist/builtin-memory/00-runtime-base/00-authoring.md +31 -0
  18. package/dist/builtin-memory/00-runtime-base/01-escalation.md +14 -0
  19. package/dist/builtin-memory/{insights/listen.md → 00-runtime-base/02-insight-capture.md} +1 -0
  20. package/dist/builtin-memory/02-turn-lifecycle/00-ending-a-turn.md +27 -0
  21. package/dist/builtin-memory/{02-lifecycle/01-resident.md → 02-turn-lifecycle/02-resident.md} +5 -0
  22. package/dist/builtin-memory/04-base-worker.md +4 -8
  23. package/dist/builtin-memory/04-orchestration-kernel.md +1 -1
  24. package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +1 -0
  25. package/dist/builtin-memory/05-kinds/advisor/advice-contract.md +1 -0
  26. package/dist/builtin-memory/05-kinds/design/00-base.md +2 -1
  27. package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +2 -1
  28. package/dist/builtin-memory/05-kinds/design/design-contract.md +19 -0
  29. package/dist/builtin-memory/05-kinds/developer/00-base.md +1 -0
  30. package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +1 -0
  31. package/dist/builtin-memory/05-kinds/explore/00-base.md +1 -0
  32. package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +1 -0
  33. package/dist/builtin-memory/05-kinds/general/00-base.md +1 -0
  34. package/dist/builtin-memory/05-kinds/plan/00-base.md +2 -1
  35. package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +2 -1
  36. package/dist/builtin-memory/05-kinds/plan/plan-contract.md +28 -0
  37. package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +1 -0
  38. package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +1 -0
  39. package/dist/builtin-memory/05-kinds/plan/reviewers/lens-contract.md +1 -0
  40. package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +1 -0
  41. package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +1 -0
  42. package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +1 -0
  43. package/dist/builtin-memory/05-kinds/review/00-base.md +1 -0
  44. package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +1 -0
  45. package/dist/builtin-memory/05-kinds/review/companion/00-base.md +1 -0
  46. package/dist/builtin-memory/05-kinds/review/security-findings.md +1 -0
  47. package/dist/builtin-memory/05-kinds/spec/00-base.md +4 -3
  48. package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +1 -0
  49. package/dist/builtin-memory/05-kinds/spec/requirements.md +1 -0
  50. package/dist/builtin-memory/design/guide.md +35 -0
  51. package/dist/builtin-memory/design/roadmap.md +21 -0
  52. package/dist/builtin-memory/insights/capture.md +1 -1
  53. package/dist/builtin-memory/internal/agent-shaping.md +3 -1
  54. package/dist/builtin-memory/internal/memory-loading.md +4 -0
  55. package/dist/builtin-memory/internal/plugins.md +10 -1
  56. package/dist/builtin-memory/internal/storage-tiers.md +1 -1
  57. package/dist/builtin-memory/plan/roadmap.md +6 -22
  58. package/dist/builtin-memory/spec/guide.md +23 -6
  59. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +1 -1
  60. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crtr-commands/index.ts +7 -1
  61. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +34 -16
  62. package/dist/clients/attach/__tests__/ref-autocomplete.test.js +1 -1
  63. package/dist/clients/attach/__tests__/titled-editor-preview.test.js +1 -1
  64. package/dist/clients/attach/overlays/file-review.js +2 -2
  65. package/dist/clients/attach/render/markdown-source.js +106 -1
  66. package/dist/clients/attach/session/file-links.d.ts +13 -4
  67. package/dist/clients/attach/session/file-links.js +54 -58
  68. package/dist/clients/attach/session/keys.d.ts +1 -1
  69. package/dist/clients/attach/session/profile-files.js +1 -1
  70. package/dist/clients/attach/viewer.js +698 -696
  71. package/dist/clients/inbox/controller.js +1 -1
  72. package/dist/clients/inbox/resolve.d.ts +1 -0
  73. package/dist/clients/inbox/review/launch.d.ts +8 -4
  74. package/dist/clients/inbox/review/launch.js +55 -5
  75. package/dist/clients/inbox/review/review-client.d.ts +1 -0
  76. package/dist/clients/inbox/review/review-client.js +7 -1
  77. package/dist/clients/inbox/review-adapter.d.ts +1 -8
  78. package/dist/clients/inbox/review-adapter.js +4 -52
  79. package/dist/commands/__tests__/human.test.js +2 -2
  80. package/dist/commands/human/request.d.ts +2 -0
  81. package/dist/commands/human/request.js +281 -0
  82. package/dist/commands/human.js +5 -2
  83. package/dist/commands/memory/lint.js +2 -1
  84. package/dist/commands/memory/read.js +1 -0
  85. package/dist/commands/memory.js +1 -1
  86. package/dist/commands/pkg/market-manage.js +165 -75
  87. package/dist/commands/pkg/plugin-inspect.js +19 -2
  88. package/dist/commands/pkg/plugin-manage.d.ts +8 -3
  89. package/dist/commands/pkg/plugin-manage.js +72 -24
  90. package/dist/commands/profile/default.js +6 -10
  91. package/dist/commands/profile/list.js +5 -3
  92. package/dist/commands/profile/new.js +21 -8
  93. package/dist/commands/profile/project.js +25 -19
  94. package/dist/commands/profile/show.js +3 -3
  95. package/dist/commands/surface-inbox.js +1 -0
  96. package/dist/commands/sys/__tests__/migrate.test.js +16 -5
  97. package/dist/commands/sys/config.js +2 -2
  98. package/dist/commands/sys/doctor.js +87 -5
  99. package/dist/commands/sys/migrate.js +38 -19
  100. package/dist/commands/sys/setup-core.js +1 -1
  101. package/dist/commands/sys/sync-project-guidance.js +1 -1
  102. package/dist/core/__tests__/broker-extension-canvas-db-boundary.test.js +7 -4
  103. package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +1 -1
  104. package/dist/core/__tests__/fixtures/c5-command-boundary-ext.js +24 -0
  105. package/dist/core/__tests__/fixtures/fake-engine.d.ts +24 -18
  106. package/dist/core/__tests__/fixtures/fake-engine.js +8 -1
  107. package/dist/core/__tests__/fixtures/memory-slash-live-probe.js +71 -0
  108. package/dist/core/__tests__/human-action-delivery.test.d.ts +1 -0
  109. package/dist/core/__tests__/human-action-delivery.test.js +140 -0
  110. package/dist/core/__tests__/human-actions.test.d.ts +1 -0
  111. package/dist/core/__tests__/human-actions.test.js +116 -0
  112. package/dist/core/__tests__/inline-memory-refs.test.js +36 -2
  113. package/dist/core/__tests__/profile-project-memory-delivery.test.d.ts +1 -0
  114. package/dist/core/__tests__/profile-project-memory-delivery.test.js +217 -0
  115. package/dist/core/__tests__/prospective-inventory-capability-parity.test.d.ts +1 -0
  116. package/dist/core/__tests__/prospective-inventory-capability-parity.test.js +91 -0
  117. package/dist/core/__tests__/seam/memory-slash-node-relative-inventory.test.d.ts +1 -0
  118. package/dist/core/__tests__/seam/memory-slash-node-relative-inventory.test.js +127 -0
  119. package/dist/core/__tests__/seam/prospective-inventory-stdout.test.d.ts +1 -0
  120. package/dist/core/__tests__/seam/prospective-inventory-stdout.test.js +31 -0
  121. package/dist/core/__tests__/serial/broker-sdk-wiring.test.js +102 -2
  122. package/dist/core/bootstrap.js +6 -0
  123. package/dist/core/canvas/browse/app.js +5 -2
  124. package/dist/core/canvas/browse/model.d.ts +25 -15
  125. package/dist/core/canvas/browse/model.js +86 -65
  126. package/dist/core/canvas/db.js +23 -0
  127. package/dist/core/canvas/human-deliveries.d.ts +53 -0
  128. package/dist/core/canvas/human-deliveries.js +75 -0
  129. package/dist/core/canvas/render-source.d.ts +6 -0
  130. package/dist/core/canvas/render-source.js +7 -1
  131. package/dist/core/canvas/render.js +10 -2
  132. package/dist/core/command-hooks/artifact.d.ts +10 -0
  133. package/dist/core/command-hooks/artifact.js +129 -0
  134. package/dist/core/command-hooks/catalog.d.ts +14 -0
  135. package/dist/core/command-hooks/catalog.js +38 -0
  136. package/dist/core/command-hooks/compose.d.ts +15 -0
  137. package/dist/core/command-hooks/compose.js +99 -0
  138. package/dist/core/command-hooks/discovery.d.ts +87 -0
  139. package/dist/core/command-hooks/discovery.js +174 -0
  140. package/dist/core/command-hooks/help.d.ts +5 -0
  141. package/dist/core/command-hooks/help.js +18 -0
  142. package/dist/core/command-hooks/index.d.ts +6 -0
  143. package/dist/core/command-hooks/index.js +6 -0
  144. package/dist/core/command-hooks/report.d.ts +23 -0
  145. package/dist/core/command-hooks/report.js +19 -0
  146. package/dist/core/command-hooks/schema.d.ts +27 -0
  147. package/dist/core/command-hooks/schema.js +68 -0
  148. package/dist/core/command-hooks/transport/exec-invoke.d.ts +22 -0
  149. package/dist/core/command-hooks/transport/exec-invoke.js +274 -0
  150. package/dist/core/command-plugins/presence.d.ts +2 -0
  151. package/dist/core/command-plugins/presence.js +17 -0
  152. package/dist/core/command-plugins/transport/exec-invoke.d.ts +5 -0
  153. package/dist/core/command-plugins/transport/exec-invoke.js +58 -5
  154. package/dist/core/command.d.ts +8 -1
  155. package/dist/core/command.js +12 -10
  156. package/dist/core/config.d.ts +13 -1
  157. package/dist/core/config.js +51 -1
  158. package/dist/core/feed/inbox.d.ts +6 -0
  159. package/dist/core/feed/inbox.js +9 -1
  160. package/dist/core/help.d.ts +7 -1
  161. package/dist/core/human/action-binding.d.ts +21 -0
  162. package/dist/core/human/action-binding.js +40 -0
  163. package/dist/core/human/completion.d.ts +38 -0
  164. package/dist/core/human/completion.js +27 -0
  165. package/dist/core/human/convention.d.ts +2 -0
  166. package/dist/core/human/convention.js +2 -0
  167. package/dist/core/human/tickets.d.ts +25 -6
  168. package/dist/core/human/tickets.js +19 -13
  169. package/dist/core/human/types.d.ts +5 -0
  170. package/dist/core/human-actions.d.ts +25 -0
  171. package/dist/core/human-actions.js +101 -0
  172. package/dist/core/io.d.ts +9 -1
  173. package/dist/core/io.js +44 -2
  174. package/dist/core/memory/inline-ref-inventory.d.ts +2 -1
  175. package/dist/core/memory/inline-ref-inventory.js +15 -8
  176. package/dist/core/memory-resolver.d.ts +13 -1
  177. package/dist/core/memory-resolver.js +26 -20
  178. package/dist/core/profiles/manifest.d.ts +13 -2
  179. package/dist/core/profiles/manifest.js +84 -18
  180. package/dist/core/profiles/select.d.ts +2 -0
  181. package/dist/core/profiles/select.js +29 -12
  182. package/dist/core/render.js +11 -0
  183. package/dist/core/runtime/advertised-command-invocation.d.ts +20 -0
  184. package/dist/core/runtime/advertised-command-invocation.js +233 -0
  185. package/dist/core/runtime/bearings.js +1 -1
  186. package/dist/core/runtime/broker/event-projection.js +7 -0
  187. package/dist/core/runtime/broker/frame-dispatch.d.ts +1 -1
  188. package/dist/core/runtime/broker/frame-dispatch.js +13 -11
  189. package/dist/core/runtime/broker/read-ops.d.ts +4 -0
  190. package/dist/core/runtime/broker/read-ops.js +6 -2
  191. package/dist/core/runtime/broker-extension-render.js +1 -1
  192. package/dist/core/runtime/broker-inventory.d.ts +4 -0
  193. package/dist/core/runtime/broker-inventory.js +116 -0
  194. package/dist/core/runtime/broker-persona-guidance.js +1 -1
  195. package/dist/core/runtime/broker-protocol.d.ts +9 -2
  196. package/dist/core/runtime/broker.js +10 -1
  197. package/dist/core/runtime/chat-inventory-rows.d.ts +8 -0
  198. package/dist/core/runtime/chat-inventory-rows.js +105 -0
  199. package/dist/core/runtime/command-surface.d.ts +38 -0
  200. package/dist/core/runtime/command-surface.js +117 -0
  201. package/dist/core/runtime/launch-target.d.ts +25 -0
  202. package/dist/core/runtime/launch-target.js +54 -0
  203. package/dist/core/runtime/node-read.js +5 -0
  204. package/dist/core/runtime/persona.js +3 -3
  205. package/dist/core/runtime/prospective-inventory-cli.d.ts +1 -0
  206. package/dist/core/runtime/prospective-inventory-cli.js +61 -0
  207. package/dist/core/runtime/prospective-inventory.d.ts +10 -0
  208. package/dist/core/runtime/prospective-inventory.js +88 -0
  209. package/dist/core/runtime/spawn.d.ts +3 -1
  210. package/dist/core/runtime/spawn.js +5 -3
  211. package/dist/core/scope.d.ts +26 -1
  212. package/dist/core/scope.js +52 -12
  213. package/dist/core/substrate/on-read.d.ts +7 -1
  214. package/dist/core/substrate/on-read.js +30 -32
  215. package/dist/core/substrate/render-node.d.ts +3 -2
  216. package/dist/core/substrate/render-node.js +3 -2
  217. package/dist/core/substrate/render.js +65 -24
  218. package/dist/core/substrate/schema.d.ts +16 -2
  219. package/dist/core/substrate/schema.js +14 -5
  220. package/dist/core/user-settings.d.ts +4 -0
  221. package/dist/core/user-settings.js +1 -0
  222. package/dist/daemon/api/__tests__/profile-launch-gates.test.js +56 -7
  223. package/dist/daemon/api/handlers/chat-inventory.d.ts +2 -0
  224. package/dist/daemon/api/handlers/chat-inventory.js +25 -0
  225. package/dist/daemon/api/handlers/human-requests.d.ts +2 -0
  226. package/dist/daemon/api/handlers/human-requests.js +409 -0
  227. package/dist/daemon/api/handlers/human.js +3 -0
  228. package/dist/daemon/api/handlers/inbox.js +3 -0
  229. package/dist/daemon/api/handlers/nodes.d.ts +1 -3
  230. package/dist/daemon/api/handlers/nodes.js +11 -46
  231. package/dist/daemon/api/handlers/profiles.js +7 -1
  232. package/dist/daemon/api/handlers/prospective-chat-inventory.d.ts +2 -0
  233. package/dist/daemon/api/handlers/prospective-chat-inventory.js +59 -0
  234. package/dist/daemon/api/handlers/reviews.js +10 -2
  235. package/dist/daemon/api/map.d.ts +2 -1
  236. package/dist/daemon/api/map.js +3 -2
  237. package/dist/daemon/api/server.js +6 -0
  238. package/dist/daemon/crtrd.js +6 -0
  239. package/dist/daemon/human/deliver-action.d.ts +16 -0
  240. package/dist/daemon/human/deliver-action.js +168 -0
  241. package/dist/daemon/human/finish.d.ts +8 -5
  242. package/dist/daemon/human/finish.js +45 -6
  243. package/dist/daemon/human/sweep.js +4 -1
  244. package/dist/daemon/reconcilers/human-delivery-lane.d.ts +10 -0
  245. package/dist/daemon/reconcilers/human-delivery-lane.js +41 -0
  246. package/dist/daemon/review/finish.d.ts +8 -3
  247. package/dist/daemon/review/finish.js +19 -1
  248. package/dist/hook-authoring.d.ts +75 -0
  249. package/dist/hook-authoring.js +358 -0
  250. package/dist/hook-process.d.ts +7 -0
  251. package/dist/hook-process.js +34 -0
  252. package/dist/index.d.ts +2 -0
  253. package/dist/index.js +2 -0
  254. package/dist/migrations/002-profile-project-memory.d.ts +2 -0
  255. package/dist/migrations/002-profile-project-memory.js +71 -0
  256. package/dist/migrations/profile-manifests.d.ts +30 -0
  257. package/dist/migrations/profile-manifests.js +70 -0
  258. package/dist/migrations/registry.js +10 -5
  259. package/dist/migrations/types.d.ts +28 -1
  260. package/dist/migrations/types.js +15 -9
  261. package/dist/pi-extensions/__tests__/canvas-structured-output.test.js +21 -4
  262. package/dist/pi-extensions/canvas-structured-output.js +85 -2
  263. package/dist/types.d.ts +23 -6
  264. package/dist/types.js +1 -0
  265. package/package.json +1 -1
  266. package/runtime.lock.json +2 -2
  267. package/dist/builtin-memory/00-runtime-base.md +0 -55
  268. package/dist/builtin-memory/design.md +0 -55
  269. package/dist/clients/attach/__tests__/file-review-focus.test.js +0 -49
  270. /package/dist/builtin-memory/{02-lifecycle/00-terminal.md → 02-turn-lifecycle/01-terminal.md} +0 -0
  271. /package/dist/{clients/attach/__tests__/file-review-focus.test.d.ts → core/__tests__/fixtures/memory-slash-live-probe.d.ts} +0 -0
@@ -220,7 +220,7 @@ export class InboxController {
220
220
  async cancelFromInbox(dir) {
221
221
  this.submittingDir = dir;
222
222
  try {
223
- await cancelTicketViaDaemon(dir, { reason: 'Canceled from the inbox.', actor: 'human' });
223
+ await cancelTicketViaDaemon(dir, { reason: 'Canceled from the inbox.', actor: 'human', disposition: 'dismissed' });
224
224
  this.status = 'canceled';
225
225
  }
226
226
  catch (error) {
@@ -4,6 +4,7 @@ export declare function resolveTicketPage(dir: string, responses: PageResponses)
4
4
  export declare function cancelTicketViaDaemon(dir: string, opts: {
5
5
  reason: string;
6
6
  actor: string;
7
+ disposition?: 'canceled' | 'dismissed';
7
8
  }): Promise<void>;
8
9
  export declare function daemonErrorMessage(err: unknown): string;
9
10
  export type ResolveFailure = 'unreachable' | 'already_resolved' | 'delivery_failed' | 'other';
@@ -3,8 +3,12 @@ import { type ResolvedReview } from './review-client.js';
3
3
  export interface ReviewSurfaceOptions {
4
4
  review: ResolvedReview;
5
5
  }
6
- /** Mount the review document. Both callers — the inbox's `ReviewAdapter` and
7
- * the viewer's `launchFileReview` — refuse a remote attach and resolve the
8
- * review record themselves, so this function is never reached from a remote
9
- * viewer and never reads a review record of its own. */
6
+ /** Open a dedicated viewer window for a review without replacing the caller's
7
+ * conversation window. The fresh viewer consumes the review id at startup. */
8
+ export declare function openReviewWindow(host: SurfaceHost, review: ResolvedReview): boolean;
9
+ /** Consume the review id handed to a dedicated attach viewer. */
10
+ export declare function takeStartupReviewId(): string | undefined;
11
+ /** Resolve and mount the review seeded into a dedicated viewer window. */
12
+ export declare function openReviewSurfaceById(host: SurfaceHost, reviewId: string): Promise<void>;
13
+ /** Mount the review document inside its dedicated viewer window. */
10
14
  export declare function openReviewSurface(host: SurfaceHost, opts: ReviewSurfaceOptions): Promise<void>;
@@ -1,10 +1,60 @@
1
+ import { basename } from 'node:path';
2
+ import { getPaneOption, openNodeWindow, paneLocation, selectWindow, shellQuote, viewerSplitEnv, } from '../../../core/runtime/placement-tmux.js';
1
3
  import { ReviewDocumentSurface } from './document-surface.js';
2
4
  import { openLiveSource } from './live-source.js';
3
- import { createReviewClient } from './review-client.js';
4
- /** Mount the review document. Both callers — the inbox's `ReviewAdapter` and
5
- * the viewer's `launchFileReview` — refuse a remote attach and resolve the
6
- * review record themselves, so this function is never reached from a remote
7
- * viewer and never reads a review record of its own. */
5
+ import { createReviewClient, ReviewTerminalError, terminalRefusalNotice, } from './review-client.js';
6
+ const ATTACH_REVIEW_ENV = 'CRTR_ATTACH_REVIEW_ID';
7
+ /** Open a dedicated viewer window for a review without replacing the caller's
8
+ * conversation window. The fresh viewer consumes the review id at startup. */
9
+ export function openReviewWindow(host, review) {
10
+ if (host.capabilities.remote) {
11
+ host.notice('The review is unavailable in a remote attach — the file and companion live on the host.');
12
+ return false;
13
+ }
14
+ const callerPane = host.capabilities.selfPane;
15
+ if (callerPane === undefined || callerPane === '') {
16
+ host.notice('Opening a review needs a local viewer in tmux.');
17
+ return false;
18
+ }
19
+ const location = paneLocation(callerPane);
20
+ const nodeId = getPaneOption(callerPane, '@crtr_node');
21
+ if (location === null || nodeId === undefined || nodeId === '') {
22
+ host.notice('Could not resolve the current viewer for this review.');
23
+ return false;
24
+ }
25
+ const opened = openNodeWindow({
26
+ session: location.session,
27
+ name: `review:${basename(review.file)}`,
28
+ cwd: review.cwd,
29
+ env: { ...viewerSplitEnv(), [ATTACH_REVIEW_ENV]: review.reviewId },
30
+ command: `crtr surface attach to ${shellQuote(nodeId)}`,
31
+ });
32
+ if (opened === null) {
33
+ host.notice('tmux could not open the review window.');
34
+ return false;
35
+ }
36
+ selectWindow(location.session, opened.window);
37
+ return true;
38
+ }
39
+ /** Consume the review id handed to a dedicated attach viewer. */
40
+ export function takeStartupReviewId() {
41
+ const reviewId = process.env[ATTACH_REVIEW_ENV];
42
+ delete process.env[ATTACH_REVIEW_ENV];
43
+ return reviewId === undefined || reviewId === '' ? undefined : reviewId;
44
+ }
45
+ /** Resolve and mount the review seeded into a dedicated viewer window. */
46
+ export async function openReviewSurfaceById(host, reviewId) {
47
+ try {
48
+ const review = await createReviewClient().byId(reviewId);
49
+ await openReviewSurface(host, { review });
50
+ }
51
+ catch (error) {
52
+ host.notice(error instanceof ReviewTerminalError
53
+ ? terminalRefusalNotice(error)
54
+ : `couldn't open review: ${describeError(error)}`);
55
+ }
56
+ }
57
+ /** Mount the review document inside its dedicated viewer window. */
8
58
  export async function openReviewSurface(host, opts) {
9
59
  const review = opts.review;
10
60
  let source;
@@ -13,6 +13,7 @@ export interface ResolvedReview {
13
13
  cwd: string;
14
14
  }
15
15
  export interface ReviewClient {
16
+ byId(reviewId: string): Promise<ResolvedReview>;
16
17
  byBridge(bridgeNodeId: string): Promise<ResolvedReview>;
17
18
  createInline(p: {
18
19
  originNodeId: string;
@@ -36,6 +36,10 @@ export function createReviewClient(opts = {}) {
36
36
  }
37
37
  };
38
38
  return {
39
+ async byId(reviewId) {
40
+ const review = await request(() => cliClient().getReview(reviewId));
41
+ return await resolveReview(review, review.companion_node_id, request);
42
+ },
39
43
  async byBridge(bridgeNodeId) {
40
44
  const review = await request(() => cliClient().getReviewByBridge(bridgeNodeId));
41
45
  return await resolveReview(review, review.companion_node_id, request);
@@ -63,7 +67,9 @@ export function createReviewClient(opts = {}) {
63
67
  };
64
68
  },
65
69
  async cancel(reviewId, reason) {
66
- await request(() => cliClient().cancelReview(reviewId, { reason, actor: 'human' }));
70
+ // The recipient surface: closing a review here is a dismissal, never the
71
+ // requester withdrawing it.
72
+ await request(() => cliClient().cancelReview(reviewId, { reason, actor: 'human', disposition: 'dismissed' }));
67
73
  },
68
74
  };
69
75
  }
@@ -3,20 +3,13 @@ export interface ReviewAdapterOptions {
3
3
  host: SurfaceHost;
4
4
  dir: string;
5
5
  }
6
- /**
7
- * Resolves a durable review ticket to its canonical daemon review and mounts
8
- * the one terminal review surface. Approval flows entirely through
9
- * `reviewClient.submit` inside that surface — this adapter owns only the
10
- * remote refusal, the bridge lookup, and the mounted surface's lifecycle.
11
- */
6
+ /** Resolve a durable review ticket and open it in its own tmux window. */
12
7
  export declare class ReviewAdapter {
13
8
  private readonly opts;
14
9
  private running;
15
10
  private stopped;
16
- private mountedHandle;
17
11
  constructor(opts: ReviewAdapterOptions);
18
12
  start(): Promise<void>;
19
- /** Toggle, cancellation, and controller teardown all take this same path. */
20
13
  stop(): Promise<void>;
21
14
  private run;
22
15
  }
@@ -1,18 +1,12 @@
1
1
  import { basename } from 'node:path';
2
2
  import { ApiError } from '../../api/errors.js';
3
- import { openReviewSurface } from './review/launch.js';
3
+ import { openReviewWindow } from './review/launch.js';
4
4
  import { createReviewClient, ReviewTerminalError, terminalRefusalNotice } from './review/review-client.js';
5
- /**
6
- * Resolves a durable review ticket to its canonical daemon review and mounts
7
- * the one terminal review surface. Approval flows entirely through
8
- * `reviewClient.submit` inside that surface — this adapter owns only the
9
- * remote refusal, the bridge lookup, and the mounted surface's lifecycle.
10
- */
5
+ /** Resolve a durable review ticket and open it in its own tmux window. */
11
6
  export class ReviewAdapter {
12
7
  opts;
13
8
  running = null;
14
9
  stopped = false;
15
- mountedHandle;
16
10
  constructor(opts) {
17
11
  this.opts = opts;
18
12
  }
@@ -22,18 +16,12 @@ export class ReviewAdapter {
22
16
  this.running = this.run();
23
17
  return this.running;
24
18
  }
25
- /** Toggle, cancellation, and controller teardown all take this same path. */
26
19
  async stop() {
27
- if (this.stopped)
28
- return;
29
20
  this.stopped = true;
30
- this.mountedHandle?.close();
31
21
  if (this.running !== null)
32
22
  await this.running;
33
23
  }
34
24
  async run() {
35
- // The refusal precedes the record read: a remote viewer can reach neither
36
- // the reviewed file nor the companion's pane.
37
25
  if (this.opts.host.capabilities.remote) {
38
26
  this.opts.host.notice('The review is unavailable in a remote attach — the file and companion live on the host.');
39
27
  return;
@@ -47,46 +35,10 @@ export class ReviewAdapter {
47
35
  this.opts.host.notice(noticeForBridgeFailure(error));
48
36
  return;
49
37
  }
50
- if (this.stopped)
51
- return;
52
- let resolveClosed;
53
- const closed = new Promise((resolve) => { resolveClosed = resolve; });
54
- const host = wrapHostForMount(this.opts.host, (handle) => {
55
- this.mountedHandle = handle;
56
- handle.onClose(() => {
57
- this.mountedHandle = undefined;
58
- resolveClosed();
59
- });
60
- });
61
- await openReviewSurface(host, { review });
62
- // A live-source failure reports through `host.notice` and returns without
63
- // ever mounting.
64
- if (this.mountedHandle === undefined)
65
- return;
66
- if (this.stopped) {
67
- this.mountedHandle.close();
68
- return;
69
- }
70
- await closed;
38
+ if (!this.stopped)
39
+ openReviewWindow(this.opts.host, review);
71
40
  }
72
41
  }
73
- /** Observes the one surface `openReviewSurface` mounts so this adapter can
74
- * await its close and close it itself from `stop()`, without widening
75
- * `SurfaceHost` or reaching into the real host's internals. */
76
- function wrapHostForMount(host, onMount) {
77
- return {
78
- capabilities: host.capabilities,
79
- mount: (component, opts) => {
80
- const handle = host.mount(component, opts);
81
- onMount(handle);
82
- return handle;
83
- },
84
- notice: (text, opts) => host.notice(text, opts),
85
- suspendForChild: () => host.suspendForChild(),
86
- focusNode: (nodeId) => host.focusNode(nodeId),
87
- pickReviewFile: (spec) => host.pickReviewFile(spec),
88
- };
89
- }
90
42
  function noticeForBridgeFailure(error) {
91
43
  if (error instanceof ReviewTerminalError)
92
44
  return terminalRefusalNotice(error);
@@ -101,11 +101,11 @@ test('human help carries the page authoring model and follows the page-surface s
101
101
  test('page_surface removes the terminal-only human surfaces from the tree', () => {
102
102
  const names = () => registerHuman().children.map((child) => child.name);
103
103
  withPageSurface(false, () => {
104
- assert.deepEqual(names(), ['components', 'send', 'review', 'feedback', 'show', 'cancel', 'list', 'resolve']);
104
+ assert.deepEqual(names(), ['components', 'send', 'review', 'feedback', 'show', 'request', 'cancel', 'list', 'resolve']);
105
105
  });
106
106
  withPageSurface(true, () => {
107
107
  const children = names();
108
- assert.deepEqual(children, ['components', 'send', 'feedback', 'cancel', 'list', 'resolve']);
108
+ assert.deepEqual(children, ['components', 'send', 'feedback', 'request', 'cancel', 'list', 'resolve']);
109
109
  const human = registerHuman();
110
110
  assert.doesNotMatch(human.help.model ?? '', /`review`|`show`/);
111
111
  assert.doesNotMatch(human.rootEntry?.useWhen ?? '', /review a document|live display/);
@@ -0,0 +1,2 @@
1
+ import type { BranchDef } from '../../core/command.js';
2
+ export declare const humanRequestBranch: BranchDef;
@@ -0,0 +1,281 @@
1
+ // `crtr human request` — the command-line face of the durable programmatic
2
+ // request contract. A request is an ordinary page ticket in the human inbox
3
+ // whose creator may exit immediately: there is no reply bridge, the terminal
4
+ // result is durable, and an optional named action carries the completion
5
+ // document to a local command. Every leaf is a thin typed call on crtrd; the
6
+ // daemon owns validation, settlement, and delivery.
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { defineBranch, defineLeaf } from '../../core/command.js';
9
+ import { InputError } from '../../core/io.js';
10
+ import { cliClient, rethrowAsCliError } from '../api-client.js';
11
+ // ---------------------------------------------------------------------------
12
+ // shared input helpers
13
+ // ---------------------------------------------------------------------------
14
+ function readJsonFile(path, field, shape) {
15
+ if (!existsSync(path)) {
16
+ throw new InputError({ error: 'not_found', message: `no such file: ${path}`, field, next: `Pass --${field} PATH pointing at a JSON file holding ${shape}.` });
17
+ }
18
+ let raw;
19
+ try {
20
+ raw = readFileSync(path, 'utf8');
21
+ }
22
+ catch (error) {
23
+ throw new InputError({ error: 'unreadable_file', message: `could not read ${path}: ${String(error)}`, field, next: 'Pass a readable JSON file.' });
24
+ }
25
+ let parsed;
26
+ try {
27
+ parsed = JSON.parse(raw);
28
+ }
29
+ catch (error) {
30
+ throw new InputError({ error: 'invalid_json', message: `${path} is not valid JSON: ${String(error)}`, field, next: `Write ${shape} into the file as JSON.` });
31
+ }
32
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
33
+ throw new InputError({ error: 'invalid_field', message: `${path} must hold a JSON object`, field, next: `Write ${shape} into the file as a JSON object.` });
34
+ }
35
+ return parsed;
36
+ }
37
+ /** The page crosses the wire inline, so the CLI reads the authored file and
38
+ * derives its dialect from the extension — the same rule page authoring uses. */
39
+ function readPageFile(path) {
40
+ const html = /\.html?$/i.test(path);
41
+ if (!html && !path.endsWith('.tsx')) {
42
+ throw new InputError({ error: 'invalid_field', message: `page source file must be .tsx, .html, or .htm: ${path}`, field: 'page', next: 'Author the page as a .tsx module or a complete .html document.' });
43
+ }
44
+ if (!existsSync(path)) {
45
+ throw new InputError({ error: 'not_found', message: `page source file does not exist: ${path}`, field: 'page', next: 'Pass --page PATH pointing at the authored page.' });
46
+ }
47
+ return { dialect: html ? 'html' : 'jsx', source: readFileSync(path, 'utf8') };
48
+ }
49
+ function requestId(input) {
50
+ const id = typeof input['request_id'] === 'string' ? input['request_id'].trim() : '';
51
+ if (id === '') {
52
+ throw new InputError({ error: 'missing_request_id', message: 'a request id is required', field: 'request_id', next: 'Pass the request_id returned by `crtr human request create`.' });
53
+ }
54
+ return id;
55
+ }
56
+ /** The one projection of a request record onto leaf output. Absent fields stay
57
+ * absent: a dismissal or a withdrawal has no responses to report. */
58
+ function requestResult(dto) {
59
+ return {
60
+ request_id: dto.request_id,
61
+ state: dto.state,
62
+ title: dto.title,
63
+ ...(dto.subtitle === undefined ? {} : { subtitle: dto.subtitle }),
64
+ source: dto.source,
65
+ emitted_at: dto.emitted_at,
66
+ ...(dto.settled_at === undefined ? {} : { settled_at: dto.settled_at }),
67
+ ...(dto.responses === undefined ? {} : { responses: dto.responses }),
68
+ ...(dto.reason === undefined ? {} : { reason: dto.reason }),
69
+ ...(dto.actor === undefined ? {} : { actor: dto.actor }),
70
+ ...(dto.action === undefined ? {} : { action: dto.action }),
71
+ ...(dto.delivery === undefined ? {} : { delivery: dto.delivery }),
72
+ };
73
+ }
74
+ const RECORD_OUTPUT = [
75
+ { name: 'request_id', type: 'string', required: true, constraint: 'The request — the same 64-hex id the human inbox lists it under.' },
76
+ { name: 'state', type: 'pending | answered | dismissed | canceled', required: true, constraint: 'answered: the person (or an authorized responder) submitted the typed responses. dismissed: the recipient surface closed it unanswered. canceled: the requester withdrew it.' },
77
+ { name: 'title', type: 'string', required: true, constraint: 'Page title as currently published.' },
78
+ { name: 'subtitle', type: 'string', required: false, constraint: 'Page subtitle when the page carries one.' },
79
+ { name: 'source', type: 'object', required: true, constraint: 'Stored provenance from the request creator: sessionName?, askedBy?, emittedAt?, profileName?, nodeId?.' },
80
+ { name: 'emitted_at', type: 'string', required: true, constraint: 'UTC ISO instant of creation; a replace never changes it.' },
81
+ { name: 'settled_at', type: 'string', required: false, constraint: 'UTC ISO instant of the terminal result. Absent while pending.' },
82
+ { name: 'responses', type: 'object', required: false, constraint: 'The typed slot map, keyed by response-bearing component id. Present only when state is answered.' },
83
+ { name: 'reason', type: 'string', required: false, constraint: 'Note recorded by the dismissal or the withdrawal.' },
84
+ { name: 'actor', type: 'string', required: false, constraint: 'Who settled it, when the settling surface named itself.' },
85
+ { name: 'action', type: 'object', required: false, constraint: '{name, payload} frozen at creation; an omitted payload is frozen as null. Absent when no action is bound.' },
86
+ { name: 'delivery', type: 'object', required: false, constraint: 'Completion-delivery state for the bound action: {state: none | pending | running | accepted | permanent_failed, attempt, next_attempt_at?, accepted_at?, permanent_failed_at?, last_failure?}. Absent when no action is bound.' },
87
+ ];
88
+ // ---------------------------------------------------------------------------
89
+ // create
90
+ // ---------------------------------------------------------------------------
91
+ const createLeaf = defineLeaf({
92
+ name: 'create',
93
+ description: 'create a durable request from a JSON request file',
94
+ whenToUse: 'a script or backend needs a human decision that must survive its own exit, rather than an answer routed back to a live node.',
95
+ help: {
96
+ name: 'human request create',
97
+ summary: 'create one durable human request from the typed create object',
98
+ params: [
99
+ {
100
+ kind: 'flag',
101
+ name: 'request-file',
102
+ type: 'path',
103
+ required: true,
104
+ constraint: 'JSON file holding the create object: {"page":{"dialect":"jsx"|"html","source":"<the authored page text, inline>"}, "delivery"?:{"placement":"inline"|"panel"}, "source"?:{"sessionName"?,"askedBy"?,"emittedAt"?,"profileName"?,"nodeId"?}, "creator_cwd"?:"<absolute dir>", "action"?:{"name":"<declared action>","payload":<any JSON, null when omitted>}}. The page text is inline, never a path — the request must stay readable after the creating process is gone. creator_cwd defaults to this directory and is the scope the action name resolves from. delivery.inbox and delivery.reply are pinned: a programmatic request is always answerable from the inbox and never routes to an agent bridge. Unknown fields are rejected.',
105
+ },
106
+ ],
107
+ output: [
108
+ { name: 'request_id', type: 'string', required: true, constraint: 'The created request — pass it to get/replace/respond/cancel. Stable, and the deduplication key every completion destination keys on.' },
109
+ { name: 'state', type: 'string', required: true, constraint: 'Always "pending": creation never settles.' },
110
+ { name: 'action', type: 'object', required: false, constraint: '{name} of the frozen action binding. Absent when the request carries no action.' },
111
+ { name: 'delivery_state', type: 'string', required: true, constraint: 'Always "none" at creation: delivery is enqueued at settlement, not before.' },
112
+ ],
113
+ outputKind: 'object',
114
+ effects: [
115
+ 'Publishes one durable page ticket into the human inbox. It has no reply bridge and outlives this process.',
116
+ 'An action name is resolved from the humanActions map in scope config (project ancestors, then user) BEFORE anything is written — an unknown or unusable name is rejected and leaves no inbox row for a person to answer.',
117
+ 'A resolved action is frozen onto the ticket: name, payload, resolved argv, and cwd. replace can never change it; a different effect needs a cancel and a new request.',
118
+ ],
119
+ },
120
+ run: async (input) => {
121
+ const path = input['requestFile'];
122
+ const body = readJsonFile(path, 'request-file', 'the create object');
123
+ if (body['creator_cwd'] === undefined)
124
+ body['creator_cwd'] = process.cwd();
125
+ try {
126
+ const created = await cliClient().createHumanRequest(body);
127
+ return {
128
+ request_id: created.request_id,
129
+ state: created.state,
130
+ ...(created.action === undefined ? {} : { action: created.action }),
131
+ delivery_state: created.delivery_state,
132
+ };
133
+ }
134
+ catch (error) {
135
+ rethrowAsCliError(error);
136
+ }
137
+ },
138
+ });
139
+ // ---------------------------------------------------------------------------
140
+ // get
141
+ // ---------------------------------------------------------------------------
142
+ const getLeaf = defineLeaf({
143
+ name: 'get',
144
+ description: 'read one request, its terminal result, and its delivery state',
145
+ whenToUse: 'you need the current state of a request you created — including the answers, once someone has settled it.',
146
+ help: {
147
+ name: 'human request get',
148
+ summary: 'read one durable request',
149
+ params: [{ kind: 'positional', name: 'request_id', type: 'string', required: true, constraint: 'request_id returned by `human request create`.' }],
150
+ output: [...RECORD_OUTPUT],
151
+ outputKind: 'object',
152
+ effects: ['None. Read-only.'],
153
+ },
154
+ run: async (input) => {
155
+ try {
156
+ return requestResult(await cliClient().getHumanRequest(requestId(input)));
157
+ }
158
+ catch (error) {
159
+ rethrowAsCliError(error);
160
+ }
161
+ },
162
+ });
163
+ // ---------------------------------------------------------------------------
164
+ // replace
165
+ // ---------------------------------------------------------------------------
166
+ const replaceLeaf = defineLeaf({
167
+ name: 'replace',
168
+ description: 'revise a pending request\'s page in place',
169
+ whenToUse: 'what you are asking changed while the request is still pending, and the same request should keep its identity and its frozen action.',
170
+ help: {
171
+ name: 'human request replace',
172
+ summary: 'republish a pending request\'s page',
173
+ params: [
174
+ { kind: 'positional', name: 'request_id', type: 'string', required: true, constraint: 'request_id returned by `human request create`.' },
175
+ { kind: 'flag', name: 'page', type: 'path', required: true, constraint: 'The revised page: a .tsx module or a complete .html/.htm document. Read here and sent inline.' },
176
+ ],
177
+ output: [...RECORD_OUTPUT],
178
+ outputKind: 'object',
179
+ effects: [
180
+ 'Rewrites the page and its typed response contract in place; open surfaces reload it without a second request.',
181
+ 'Identity is untouched: request id, provenance, emitted time, delivery, and the frozen action binding all survive verbatim.',
182
+ 'Refused with already_settled once the request has a terminal result — a settled request is revised by cancelling and creating a new one.',
183
+ ],
184
+ },
185
+ run: async (input) => {
186
+ const id = requestId(input);
187
+ const body = { page: readPageFile(input['page']) };
188
+ try {
189
+ return requestResult(await cliClient().replaceHumanRequest(id, body));
190
+ }
191
+ catch (error) {
192
+ rethrowAsCliError(error);
193
+ }
194
+ },
195
+ });
196
+ // ---------------------------------------------------------------------------
197
+ // respond
198
+ // ---------------------------------------------------------------------------
199
+ const respondLeaf = defineLeaf({
200
+ name: 'respond',
201
+ description: 'settle a pending request with typed answers',
202
+ whenToUse: 'an authorized host is submitting the answers on the person\'s behalf, rather than the person answering in their inbox.',
203
+ help: {
204
+ name: 'human request respond',
205
+ summary: 'answer a pending request',
206
+ params: [
207
+ { kind: 'positional', name: 'request_id', type: 'string', required: true, constraint: 'request_id returned by `human request create`.' },
208
+ {
209
+ kind: 'flag',
210
+ name: 'response-file',
211
+ type: 'path',
212
+ required: true,
213
+ constraint: 'JSON file holding the respond object: {"responses":{"<component_id>":{...}}, "actor"?:"<who answered>"}. One typed response per response-bearing component; the daemon validates the complete map against the currently published page.',
214
+ },
215
+ ],
216
+ output: [...RECORD_OUTPUT],
217
+ outputKind: 'object',
218
+ effects: [
219
+ 'Settles the request as answered and drops it from the human inbox.',
220
+ 'Competes with the person\'s own answer, a recipient dismissal, and a requester cancel through one first-writer-wins store: a losing attempt returns already_settled and changes nothing.',
221
+ 'When an action is bound, the winning settlement enqueues one at-least-once completion delivery keyed on the request id.',
222
+ ],
223
+ },
224
+ run: async (input) => {
225
+ const id = requestId(input);
226
+ const body = readJsonFile(input['responseFile'], 'response-file', 'the respond object');
227
+ try {
228
+ return requestResult(await cliClient().respondHumanRequest(id, body));
229
+ }
230
+ catch (error) {
231
+ rethrowAsCliError(error);
232
+ }
233
+ },
234
+ });
235
+ // ---------------------------------------------------------------------------
236
+ // cancel
237
+ // ---------------------------------------------------------------------------
238
+ const cancelLeaf = defineLeaf({
239
+ name: 'cancel',
240
+ description: 'withdraw a pending request',
241
+ whenToUse: 'the decision you asked for stopped mattering, or the effect must change — the action binding is immutable, so a new effect needs a new request.',
242
+ help: {
243
+ name: 'human request cancel',
244
+ summary: 'withdraw a pending request',
245
+ params: [
246
+ { kind: 'positional', name: 'request_id', type: 'string', required: true, constraint: 'request_id returned by `human request create`.' },
247
+ { kind: 'flag', name: 'reason', type: 'string', required: false, constraint: 'Short note recorded on the terminal result and carried in the completion document.' },
248
+ ],
249
+ output: [...RECORD_OUTPUT],
250
+ outputKind: 'object',
251
+ effects: [
252
+ 'Settles the request as canceled and drops it from the human inbox — the person is no longer asked.',
253
+ 'Races the person\'s answer through the same first-writer-wins store; whoever lands first is authoritative and the loser returns already_settled.',
254
+ 'When an action is bound, the winning settlement enqueues one completion delivery carrying the canceled event.',
255
+ ],
256
+ },
257
+ run: async (input) => {
258
+ const id = requestId(input);
259
+ const reason = typeof input['reason'] === 'string' && input['reason'] !== '' ? input['reason'] : undefined;
260
+ try {
261
+ return requestResult(await cliClient().cancelHumanRequest(id, reason === undefined ? {} : { reason }));
262
+ }
263
+ catch (error) {
264
+ rethrowAsCliError(error);
265
+ }
266
+ },
267
+ });
268
+ // ---------------------------------------------------------------------------
269
+ // Registration
270
+ // ---------------------------------------------------------------------------
271
+ export const humanRequestBranch = defineBranch({
272
+ name: 'request',
273
+ description: 'durable requests that outlive the process that made them',
274
+ whenToUse: 'a script or backend needs a human decision whose outcome must survive its own exit, instead of an answer pushed back to a live node.',
275
+ help: {
276
+ name: 'human request',
277
+ summary: 'durable programmatic human requests — create, read, revise, and settle',
278
+ model: 'A request is the same page ticket `human send` publishes, minus the agent bridge: nothing waits on it, and the outcome is read with `get` or carried to a local command by a named action. Reach for it when the caller will be gone before the person answers; when a live node should receive the answer, use `crtr human send` instead.\n\nThe page and its typed response contract stay revisable with `replace` while pending. The action binding does not: name, payload, resolved argv, and cwd are frozen at creation, so a different effect means `cancel` plus a new request. An action is a name declared in the humanActions map of scope config — there is no command, shell string, or callback URL anywhere in this surface.\n\nA request ends exactly once. `respond` (an authorized host answering), the person answering in their own inbox, a recipient dismissal, and `cancel` all compete through one first-writer-wins settlement; the loser gets already_settled and no second delivery. Only the winner enqueues the completion document, delivered at least once — the receiving command must deduplicate on the request id.',
279
+ },
280
+ children: [createLeaf, getLeaf, replaceLeaf, respondLeaf, cancelLeaf],
281
+ });
@@ -9,6 +9,7 @@ import { humanList, humanResolve, humanCancel } from './human/queue.js';
9
9
  import { humanReviewBranch } from './human/review.js';
10
10
  import { humanFeedbackBranch } from './human/feedback.js';
11
11
  import { humanComponents } from './human/components.js';
12
+ import { humanRequestBranch } from './human/request.js';
12
13
  import { pageHelpText } from './human/shared.js';
13
14
  export function registerHuman() {
14
15
  // `page_surface` marks a host whose human surface is a rendered page product
@@ -21,9 +22,10 @@ export function registerHuman() {
21
22
  const concept = pageSurface
22
23
  ? 'human-in-the-loop decisions and structured pages'
23
24
  : 'human-in-the-loop decisions, document review, and live display';
25
+ const durableRequests = '`request` publishes the same page with no bridge at all, for a caller that will have exited before the answer arrives: its outcome is read back or carried to a named local action.';
24
26
  const ticketModel = pageSurface
25
- ? 'Tickets queue in the human inbox; nothing opens on screen. `send` routes completion back when the page carries response-bearing components, and publishes a standalone announcement when it does not.'
26
- : 'Tickets queue in the human inbox; nothing opens on screen. `send` routes completion back when the page carries response-bearing components, and publishes a standalone announcement when it does not. `review` is for live document review with anchored comments; `show` is a passive tmux live-watch rather than a ticket.';
27
+ ? `Tickets queue in the human inbox; nothing opens on screen. \`send\` routes completion back when the page carries response-bearing components, and publishes a standalone announcement when it does not. ${durableRequests}`
28
+ : `Tickets queue in the human inbox; nothing opens on screen. \`send\` routes completion back when the page carries response-bearing components, and publishes a standalone announcement when it does not. ${durableRequests} \`review\` is for live document review with anchored comments; \`show\` is a passive tmux live-watch rather than a ticket.`;
27
29
  return defineBranch({
28
30
  name: 'human',
29
31
  rootEntry: {
@@ -48,6 +50,7 @@ export function registerHuman() {
48
50
  ...(pageSurface ? [] : [humanReviewBranch]),
49
51
  humanFeedbackBranch,
50
52
  ...(pageSurface ? [] : [humanShow]),
53
+ humanRequestBranch,
51
54
  humanCancel,
52
55
  humanList,
53
56
  humanResolve,
@@ -283,8 +283,9 @@ export const lintLeaf = defineLeaf({
283
283
  const { profileId, manifest } = loadProfileManifest(profileIdOrName);
284
284
  profileResolved = true;
285
285
  lintDir(profileMemoryDir(profileId), 'user');
286
- for (const dir of manifest.projects) {
286
+ for (const project of manifest.projects) {
287
287
  profileProjects += 1;
288
+ const dir = project.path;
288
289
  const doors = frontDoorDocs(join(dir, '.crouter', 'memory'));
289
290
  if (doors.length === 0) {
290
291
  findings.push({
@@ -81,6 +81,7 @@ export const readLeaf = defineLeaf({
81
81
  outputKind: 'object',
82
82
  effects: [
83
83
  'Reads the document. A document that embeds shell (`!`cmd`` or a ```! block) runs those commands once, in the current working directory.',
84
+ 'Records a content delivery for this node: a document whose profile project caps automatic boot and workspace-open disclosure below content is still returned whole here, and unsolicited channels stay quiet about it afterwards.',
84
85
  ],
85
86
  },
86
87
  run: async (input) => {
@@ -23,7 +23,7 @@ export function registerMemory() {
23
23
  help: {
24
24
  name: 'memory',
25
25
  summary: 'list, read, search, and write memory documents — knowledge and preferences',
26
- model: 'Documents have path-derived identities and resolve across layered scopes in precedence order: node > project stack > profile > user > builtin. Browse the inventory with `list` to see what is stored; address a document directly with `read` once you know its name — a directory name is a valid read target answering with its listing. One verb per operation: `write` creates, `edit` revises (every revision carries a rationale and is recorded), `move` relocates or renames a doc and rewrites inbound `[[refs]]` corpus-wide, `delete` removes, and `history` reads how a document reached its current state. Beyond listings, delivery is explicit `surfaces` routing: each entry names the event that fires it (boot, workspace-open, read, memory-read, command) and how much delivers (name, preview, content).',
26
+ model: 'Documents have path-derived identities and resolve across layered scopes in precedence order: node > project stack > profile > user > builtin. Browse the inventory with `list` to see what is stored; address a document directly with `read` once you know its name — a directory name is a valid read target answering with its listing. One verb per operation: `write` creates, `edit` revises (every revision carries a rationale and is recorded), `move` relocates or renames a doc and rewrites inbound `[[refs]]` corpus-wide, `delete` removes, and `history` reads how a document reached its current state. Beyond listings, delivery is explicit `surfaces` routing: each entry names the event that fires it (boot, workspace-open, read, memory-read, command) and how much delivers (name, preview, content). A selected profile widens the project stack to every project in its purview, and each of those relationships caps what its stores deliver to the boot and workspace-open events; `read`, find, listings, and file- and command-routed delivery see the full corpus regardless.',
27
27
  },
28
28
  children: [listLeaf, readLeaf, findLeaf, writeLeaf, editLeaf, moveLeaf, historyLeaf, deleteLeaf, originLeaf, lintLeaf],
29
29
  });