@north-light/crouter 0.3.180 → 0.3.182

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 (137) hide show
  1. package/dist/api/client.d.ts +10 -1
  2. package/dist/api/client.js +13 -0
  3. package/dist/api/dto/broker.d.ts +32 -0
  4. package/dist/api/dto/crons.d.ts +17 -0
  5. package/dist/api/dto/memory.d.ts +17 -0
  6. package/dist/api/dto/memory.js +6 -0
  7. package/dist/api/dto/messages.d.ts +5 -0
  8. package/dist/api/dto/reviews.d.ts +8 -4
  9. package/dist/api/index.d.ts +1 -0
  10. package/dist/api/index.js +1 -0
  11. package/dist/api/routes.d.ts +2 -0
  12. package/dist/api/routes.js +4 -0
  13. package/dist/build-root.d.ts +7 -0
  14. package/dist/build-root.js +21 -0
  15. package/dist/builtin-memory/insights/init.md +48 -3
  16. package/dist/builtin-pi-packages/pi-crtr-extensions/__tests__/insights-active-init.test.ts +98 -0
  17. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +7 -50
  18. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +16 -1
  19. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/pi-shell-runner.ts +34 -0
  20. package/dist/cli.js +1 -2
  21. package/dist/clients/attach/__tests__/context-message.test.js +5 -2
  22. package/dist/clients/attach/assets/README.md +7 -0
  23. package/dist/clients/attach/assets/whip-06.mp3 +0 -0
  24. package/dist/clients/attach/assets/whip-crack.mp3 +0 -0
  25. package/dist/clients/attach/assets/whip-snap.mp3 +0 -0
  26. package/dist/clients/attach/chrome/canvas-panels.d.ts +7 -1
  27. package/dist/clients/attach/chrome/canvas-panels.js +20 -3
  28. package/dist/clients/attach/chrome/review-wait.d.ts +6 -0
  29. package/dist/clients/attach/chrome/review-wait.js +22 -0
  30. package/dist/clients/attach/chrome/roster.js +23 -2
  31. package/dist/clients/attach/chrome/widgets.js +1 -1
  32. package/dist/clients/attach/input/controller.js +4 -3
  33. package/dist/clients/attach/overlays/mcp.js +3 -1
  34. package/dist/clients/attach/render/chat-view.js +1 -1
  35. package/dist/clients/attach/session/whip.d.ts +1 -0
  36. package/dist/clients/attach/session/whip.js +26 -0
  37. package/dist/clients/attach/slash/dispatch.js +2 -0
  38. package/dist/clients/attach/viewer.js +578 -573
  39. package/dist/clients/inbox/review/document-surface.d.ts +1 -1
  40. package/dist/clients/inbox/review/document-surface.js +4 -4
  41. package/dist/clients/inbox/review/launch.js +16 -4
  42. package/dist/clients/inbox/review/review-client.d.ts +9 -4
  43. package/dist/clients/inbox/review/review-client.js +3 -0
  44. package/dist/commands/cron.js +30 -8
  45. package/dist/commands/human/prompts.d.ts +7 -2
  46. package/dist/commands/human/prompts.js +15 -10
  47. package/dist/commands/human.js +1 -2
  48. package/dist/commands/memory/find.js +11 -8
  49. package/dist/commands/memory/read.js +111 -11
  50. package/dist/commands/memory/write.js +1 -1
  51. package/dist/commands/memory.js +1 -1
  52. package/dist/commands/pkg/market-manage.d.ts +13 -0
  53. package/dist/commands/pkg/market-manage.js +39 -33
  54. package/dist/commands/pkg/plugin-inspect.js +4 -3
  55. package/dist/commands/pkg/plugin-manage.js +12 -11
  56. package/dist/commands/surface/node/focus.js +1 -2
  57. package/dist/commands/sys/doctor.js +4 -4
  58. package/dist/commands/sys/setup-core.d.ts +14 -7
  59. package/dist/commands/sys/setup-core.js +66 -11
  60. package/dist/commands/sys/setup-wizard.js +2 -2
  61. package/dist/commands/sys/setup.js +1 -1
  62. package/dist/core/__tests__/cron-held-settlement.test.d.ts +1 -0
  63. package/dist/core/__tests__/cron-held-settlement.test.js +222 -0
  64. package/dist/core/__tests__/helpers/harness.js +1 -2
  65. package/dist/core/__tests__/phase4-review-store.test.js +1 -0
  66. package/dist/core/__tests__/serial/command-plugins.test.js +88 -1
  67. package/dist/core/__tests__/session-model.test.js +5 -3
  68. package/dist/core/bootstrap.d.ts +0 -4
  69. package/dist/core/bootstrap.js +1 -55
  70. package/dist/core/canvas/crons.d.ts +54 -2
  71. package/dist/core/canvas/crons.js +48 -4
  72. package/dist/core/canvas/db.js +23 -0
  73. package/dist/core/command-manifests/manifest.d.ts +11 -0
  74. package/dist/core/command-manifests/manifest.js +45 -4
  75. package/dist/core/command-manifests/schema.d.ts +1 -1
  76. package/dist/core/command-plugins/bundle.d.ts +1 -0
  77. package/dist/core/command-plugins/bundle.js +3 -3
  78. package/dist/core/command-plugins/discovery.d.ts +5 -2
  79. package/dist/core/command-plugins/discovery.js +5 -5
  80. package/dist/core/command-plugins/help-addenda.d.ts +12 -0
  81. package/dist/core/command-plugins/help-addenda.js +30 -0
  82. package/dist/core/command.js +25 -2
  83. package/dist/core/config.js +0 -1
  84. package/dist/core/human/convention.d.ts +0 -1
  85. package/dist/core/human/convention.js +0 -6
  86. package/dist/core/keybindings/inbox.d.ts +6 -8
  87. package/dist/core/keybindings/inbox.js +6 -15
  88. package/dist/core/keybindings/index.d.ts +1 -1
  89. package/dist/core/keybindings/index.js +1 -1
  90. package/dist/core/memory/doc-link-grammar.js +4 -1
  91. package/dist/core/memory-resolver.d.ts +28 -4
  92. package/dist/core/memory-resolver.js +51 -39
  93. package/dist/core/review/stage.js +1 -0
  94. package/dist/core/review/store.d.ts +5 -0
  95. package/dist/core/review/store.js +10 -0
  96. package/dist/core/review/types.d.ts +4 -0
  97. package/dist/core/runtime/broker/event-projection.d.ts +8 -1
  98. package/dist/core/runtime/broker/event-projection.js +25 -1
  99. package/dist/core/runtime/broker/frame-dispatch.d.ts +2 -0
  100. package/dist/core/runtime/broker/frame-dispatch.js +50 -8
  101. package/dist/core/runtime/broker/inbox.d.ts +4 -0
  102. package/dist/core/runtime/broker/inbox.js +17 -8
  103. package/dist/core/runtime/broker/message-ledger.d.ts +53 -0
  104. package/dist/core/runtime/broker/message-ledger.js +143 -0
  105. package/dist/core/runtime/broker/rebind.js +14 -0
  106. package/dist/core/runtime/broker-protocol.d.ts +46 -1
  107. package/dist/core/runtime/broker.js +11 -2
  108. package/dist/core/runtime/interactive-deliver.d.ts +5 -2
  109. package/dist/core/runtime/interactive-deliver.js +6 -3
  110. package/dist/core/runtime/shell-expansion.d.ts +32 -0
  111. package/dist/core/runtime/shell-expansion.js +102 -0
  112. package/dist/core/session-model/session-state.d.ts +9 -4
  113. package/dist/core/session-model/session-state.js +5 -1
  114. package/dist/daemon/api/handlers/broker-ops.js +8 -0
  115. package/dist/daemon/api/handlers/crons.js +14 -1
  116. package/dist/daemon/api/handlers/inbox.js +5 -0
  117. package/dist/daemon/api/handlers/memory.d.ts +2 -0
  118. package/dist/daemon/api/handlers/memory.js +48 -0
  119. package/dist/daemon/api/handlers/messages.js +7 -1
  120. package/dist/daemon/api/handlers/reviews.js +7 -5
  121. package/dist/daemon/api/map.js +3 -0
  122. package/dist/daemon/api/server.js +2 -0
  123. package/dist/daemon/cron-run.js +71 -3
  124. package/dist/daemon/crtrd.js +3 -0
  125. package/dist/daemon/reconcilers/pending-review-submit.d.ts +7 -0
  126. package/dist/daemon/reconcilers/pending-review-submit.js +35 -0
  127. package/dist/daemon/review/companion.d.ts +8 -0
  128. package/dist/daemon/review/companion.js +35 -0
  129. package/dist/daemon/review/deliver.js +2 -1
  130. package/dist/daemon/review/finish.d.ts +29 -2
  131. package/dist/daemon/review/finish.js +75 -2
  132. package/dist/pi-extensions/canvas-inbox-watcher.js +34 -1
  133. package/dist/shared/generated-context.d.ts +3 -4
  134. package/dist/shared/generated-context.js +24 -6
  135. package/dist/types.d.ts +0 -1
  136. package/package.json +1 -1
  137. package/runtime.lock.json +2 -2
@@ -31,6 +31,8 @@ export const CONNECTION_FAULT_RECOVERY_BODY = 'The network connection is back on
31
31
  export const PROVIDER_FAULT_RECOVERY_BODY = 'Your previous turn stopped on a provider fault. Continue from where you left off and retry the work that failed.';
32
32
  const PERSONA_TRANSITION_OPEN = '<persona-transition>';
33
33
  const PERSONA_TRANSITION_CLOSE = '</persona-transition>';
34
+ const REVIEW_APPROVAL_OPEN = '<crtr-review-approval>';
35
+ const REVIEW_APPROVAL_CLOSE = '</crtr-review-approval>';
34
36
  const MODEL_FALLBACK_RECOVERY_OPEN = '<model-fallback-recovery>';
35
37
  const MODEL_FALLBACK_RECOVERY_CLOSE = '</model-fallback-recovery>';
36
38
  const STRUCTURED_OUTPUT_REPROMPT_PREFIX = 'You must call the `submit` tool with a result matching the required schema before you can stop. You cannot finish or go dormant any other way while this request is pending.\n\nRequired schema:\n\n```json\n';
@@ -39,6 +41,10 @@ const STRUCTURED_OUTPUT_REPROMPT_SUFFIX = '\n```';
39
41
  export function formatPersonaTransition(guidance) {
40
42
  return `${PERSONA_TRANSITION_OPEN}\n${guidance}\n${PERSONA_TRANSITION_CLOSE}`;
41
43
  }
44
+ /** Mark a daemon-delivered review approval for compact viewer presentation. */
45
+ export function formatReviewApproval(body) {
46
+ return `${REVIEW_APPROVAL_OPEN}\n${body}\n${REVIEW_APPROVAL_CLOSE}`;
47
+ }
42
48
  /** Format the stop guard's dynamic structured-output mandate. */
43
49
  export function formatStructuredOutputReprompt(schema) {
44
50
  return `${STRUCTURED_OUTPUT_REPROMPT_PREFIX}${schema}${STRUCTURED_OUTPUT_REPROMPT_SUFFIX}`;
@@ -55,14 +61,18 @@ const YIELD_MESSAGE_BLOCK = /<yield-message>([\s\S]*?)<\/yield-message>/;
55
61
  /** The display-only disclosure body for a generated context card. The full
56
62
  * message remains in `body` for the model and transcript bookkeeping; the two
57
63
  * prompt-sized cards expose the one piece a person needs to inspect. */
64
+ function unmarkReviewApprovals(body) {
65
+ return body.replaceAll(`${REVIEW_APPROVAL_OPEN}\n`, '').replaceAll(`\n${REVIEW_APPROVAL_CLOSE}`, '');
66
+ }
58
67
  export function generatedContextExpandedBody(presentation) {
68
+ let body = presentation.body;
59
69
  if (presentation.label === 'crtr context') {
60
- return AUTO_LOADED_CONTEXT_BLOCK.exec(presentation.body)?.[1]?.trim() ?? '';
70
+ body = AUTO_LOADED_CONTEXT_BLOCK.exec(body)?.[1]?.trim() ?? '';
61
71
  }
62
- if (presentation.kind === 'revive') {
63
- return YIELD_MESSAGE_BLOCK.exec(presentation.body)?.[1]?.trim() ?? '';
72
+ else if (presentation.kind === 'revive') {
73
+ body = YIELD_MESSAGE_BLOCK.exec(body)?.[1]?.trim() ?? '';
64
74
  }
65
- return presentation.body;
75
+ return unmarkReviewApprovals(body);
66
76
  }
67
77
  /** Plain text from a generated message's string or text-block content. */
68
78
  export function generatedContextText(message) {
@@ -88,7 +98,9 @@ function nudgeSummary(body) {
88
98
  }
89
99
  // Stable header emitted by core/feed/inbox.ts coalesce(). Human-authored inbox
90
100
  // messages are deliberately delivered verbatim and never carry this header.
91
- const INBOX_HEADER_RE = /^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human) — (\d+) update/m;
101
+ // Senders are node ids, the two reserved words, or the daemon itself (crtrd —
102
+ // review notes and other daemon-originated node messages).
103
+ const INBOX_HEADER_RE = /^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human|crtrd) — (\d+) update/m;
92
104
  export function isInboxDigest(text) {
93
105
  return INBOX_HEADER_RE.test(text);
94
106
  }
@@ -96,7 +108,7 @@ export function extractInboxSender(text) {
96
108
  return INBOX_HEADER_RE.exec(text)?.[1] ?? null;
97
109
  }
98
110
  function inboxSummary(body) {
99
- const headers = [...body.matchAll(/^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human) — (\d+) update/gm)];
111
+ const headers = [...body.matchAll(/^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human|crtrd) — (\d+) update/gm)];
100
112
  if (headers.length === 0)
101
113
  return 'node update';
102
114
  const updates = headers.reduce((total, match) => total + Number(match[2] ?? 0), 0);
@@ -109,6 +121,9 @@ function inboxSummary(body) {
109
121
  function isPersonaTransition(body) {
110
122
  return body.startsWith(`${PERSONA_TRANSITION_OPEN}\n`) && body.endsWith(`\n${PERSONA_TRANSITION_CLOSE}`);
111
123
  }
124
+ function isReviewApproval(body) {
125
+ return body.startsWith(`${REVIEW_APPROVAL_OPEN}\n`) && body.endsWith(`\n${REVIEW_APPROVAL_CLOSE}`);
126
+ }
112
127
  function isStructuredOutputReprompt(body) {
113
128
  if (!body.startsWith(STRUCTURED_OUTPUT_REPROMPT_PREFIX) || !body.endsWith(STRUCTURED_OUTPUT_REPROMPT_SUFFIX)) {
114
129
  return false;
@@ -189,6 +204,9 @@ export function generatedContextPresentation(message) {
189
204
  if (isInboxDigest(body)) {
190
205
  return { kind: 'inbox', label: 'crtr inbox', summary: inboxSummary(body), body };
191
206
  }
207
+ if (isReviewApproval(body)) {
208
+ return { kind: 'review-approval', label: 'crtr review', summary: 'human review approved', body };
209
+ }
192
210
  if (isPersonaTransition(body)) {
193
211
  return {
194
212
  kind: 'persona-transition',
package/dist/types.d.ts CHANGED
@@ -263,7 +263,6 @@ export interface ScopeState {
263
263
  last_updated?: string;
264
264
  }>;
265
265
  last_self_check?: string;
266
- bootstrap_done?: boolean;
267
266
  /** The name of the remote canvas target `crtr canvas use` last selected
268
267
  * (see `RemoteCanvasConfig`), or `null`/omitted for local. Read by
269
268
  * `resolveCanvasSource` (`core/canvas/source.ts`) as the durable fallback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.180",
3
+ "version": "0.3.182",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.180",
3
+ "version": "0.3.182",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.180",
9
+ "version": "0.3.182",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {