@north-light/crouter 0.3.176 → 0.3.178

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 (152) hide show
  1. package/dist/api/client.d.ts +4 -4
  2. package/dist/api/client.js +2 -2
  3. package/dist/api/dto/lifecycle.d.ts +1 -1
  4. package/dist/api/dto/reports.d.ts +1 -1
  5. package/dist/clients/attach/__tests__/frame-selection.test.d.ts +1 -0
  6. package/dist/clients/attach/__tests__/frame-selection.test.js +84 -0
  7. package/dist/clients/attach/__tests__/group-activity.test.js +2 -2
  8. package/dist/clients/attach/ansi-cells.d.ts +31 -0
  9. package/dist/clients/attach/ansi-cells.js +120 -0
  10. package/dist/clients/attach/config.js +5 -5
  11. package/dist/clients/attach/input/clipboard-image.js +2 -2
  12. package/dist/clients/attach/input/ref-autocomplete.js +1 -1
  13. package/dist/clients/attach/input/titled-editor.d.ts +12 -13
  14. package/dist/clients/attach/input/titled-editor.js +14 -15
  15. package/dist/clients/attach/overlays/dialogs.d.ts +1 -1
  16. package/dist/clients/attach/overlays/dialogs.js +2 -2
  17. package/dist/clients/attach/overlays/help.js +2 -1
  18. package/dist/clients/attach/overlays/mcp.js +5 -12
  19. package/dist/clients/attach/render/chat-view.d.ts +1 -1
  20. package/dist/clients/attach/render/chat-view.js +2 -2
  21. package/dist/clients/attach/render/group-recap.js +7 -0
  22. package/dist/clients/attach/session/context.js +3 -3
  23. package/dist/clients/attach/session/editor-inventory.js +6 -6
  24. package/dist/clients/attach/session/file-links.js +15 -50
  25. package/dist/clients/attach/session/frame.d.ts +5 -1
  26. package/dist/clients/attach/session/frame.js +19 -4
  27. package/dist/clients/attach/session/input-wiring.js +2 -2
  28. package/dist/clients/attach/session/mouse.d.ts +4 -0
  29. package/dist/clients/attach/session/mouse.js +14 -3
  30. package/dist/clients/attach/session/selection.d.ts +28 -0
  31. package/dist/clients/attach/session/selection.js +108 -0
  32. package/dist/clients/attach/session/teardown.js +7 -9
  33. package/dist/clients/attach/slash/dispatch.d.ts +1 -2
  34. package/dist/clients/attach/slash/dispatch.js +5 -9
  35. package/dist/clients/attach/viewer.js +552 -550
  36. package/dist/clients/inbox/controller.js +3 -2
  37. package/dist/clients/inbox/deck-adapter.js +3 -2
  38. package/dist/clients/surfaces/host.d.ts +1 -1
  39. package/dist/commands/api-client.d.ts +12 -13
  40. package/dist/commands/api-client.js +15 -16
  41. package/dist/commands/chord.js +1 -2
  42. package/dist/commands/human/queue.js +6 -5
  43. package/dist/commands/memory/find.js +3 -3
  44. package/dist/commands/node/lifecycle.js +1 -1
  45. package/dist/commands/node-lifecycle-revive.d.ts +1 -1
  46. package/dist/commands/node-lifecycle-revive.js +3 -3
  47. package/dist/commands/push.js +1 -1
  48. package/dist/commands/surface/node/placement.d.ts +1 -1
  49. package/dist/commands/surface/node/placement.js +1 -1
  50. package/dist/commands/surface-edit.js +1 -4
  51. package/dist/commands/sys/panels/panel.d.ts +3 -3
  52. package/dist/commands/sys/panels/panel.js +3 -3
  53. package/dist/commands/sys/setup-core.js +1 -7
  54. package/dist/commands/sys/sync-deps.js +1 -3
  55. package/dist/commands/sys/sync-project-guidance.js +2 -11
  56. package/dist/commands/sys/sysprompt.js +1 -3
  57. package/dist/core/__tests__/fixtures/fake-engine.js +1 -1
  58. package/dist/core/__tests__/helpers/harness.d.ts +1 -1
  59. package/dist/core/__tests__/helpers/harness.js +1 -1
  60. package/dist/core/canvas/boot.js +1 -1
  61. package/dist/core/canvas/browse/app.js +2 -2
  62. package/dist/core/canvas/canvas.d.ts +3 -3
  63. package/dist/core/canvas/canvas.js +3 -3
  64. package/dist/core/canvas/daemon-owner.js +1 -2
  65. package/dist/core/canvas/db.js +7 -8
  66. package/dist/core/canvas/index.js +2 -2
  67. package/dist/core/canvas/pid.d.ts +12 -14
  68. package/dist/core/canvas/pid.js +16 -20
  69. package/dist/core/canvas/remote-transport.js +2 -2
  70. package/dist/core/canvas/status-glyph.d.ts +1 -1
  71. package/dist/core/canvas/status-glyph.js +1 -1
  72. package/dist/core/canvas/types.d.ts +1 -1
  73. package/dist/core/command-manifests/manifest.js +4 -6
  74. package/dist/core/command-manifests/schema.js +10 -12
  75. package/dist/core/command-plugins/transport/exec-invoke.js +5 -7
  76. package/dist/core/command-plugins/transport/http-invoke.js +4 -6
  77. package/dist/core/config.d.ts +1 -1
  78. package/dist/core/config.js +2 -2
  79. package/dist/core/events/read.js +1 -3
  80. package/dist/core/fault-classifier.js +1 -3
  81. package/dist/core/fs-utils.d.ts +7 -0
  82. package/dist/core/fs-utils.js +29 -2
  83. package/dist/core/host-exports/export.d.ts +4 -5
  84. package/dist/core/host-exports/export.js +4 -5
  85. package/dist/core/human/claim.js +3 -2
  86. package/dist/core/human/convention.d.ts +0 -1
  87. package/dist/core/human/convention.js +1 -9
  88. package/dist/core/human/scan.js +5 -4
  89. package/dist/core/profiles/manifest.d.ts +1 -1
  90. package/dist/core/profiles/manifest.js +1 -1
  91. package/dist/core/review/types.d.ts +1 -1
  92. package/dist/core/review/types.js +1 -1
  93. package/dist/core/runtime/broker/frame-dispatch.js +4 -4
  94. package/dist/core/runtime/broker-cli.js +1 -1
  95. package/dist/core/runtime/broker-protocol.d.ts +9 -10
  96. package/dist/core/runtime/broker-protocol.js +9 -10
  97. package/dist/core/runtime/broker-sdk.d.ts +1 -1
  98. package/dist/core/runtime/broker.js +6 -6
  99. package/dist/core/runtime/host.js +14 -14
  100. package/dist/core/runtime/launch.d.ts +1 -1
  101. package/dist/core/runtime/launch.js +1 -1
  102. package/dist/core/runtime/lifecycle.js +16 -21
  103. package/dist/core/runtime/node-read.js +2 -3
  104. package/dist/core/runtime/package-health.js +1 -8
  105. package/dist/core/runtime/persona.js +2 -2
  106. package/dist/core/runtime/pi-vendored.d.ts +4 -2
  107. package/dist/core/runtime/pi-vendored.js +5 -16
  108. package/dist/core/runtime/promote.js +1 -1
  109. package/dist/core/runtime/reopen.js +2 -2
  110. package/dist/core/runtime/revive-all.d.ts +3 -3
  111. package/dist/core/runtime/revive-all.js +6 -6
  112. package/dist/core/runtime/revive.js +1 -1
  113. package/dist/core/runtime/spawn.d.ts +1 -2
  114. package/dist/core/runtime/spawn.js +2 -3
  115. package/dist/core/runtime/structured-output.js +4 -6
  116. package/dist/core/runtime/tmux-driver.d.ts +2 -2
  117. package/dist/core/runtime/tmux-driver.js +3 -5
  118. package/dist/core/runtime/tool-group-summary.js +5 -4
  119. package/dist/core/runtime/warm-pool.js +1 -1
  120. package/dist/core/scope.js +2 -9
  121. package/dist/core/self-update.js +3 -3
  122. package/dist/core/spawn.d.ts +0 -1
  123. package/dist/core/spawn.js +1 -4
  124. package/dist/core/substrate/on-read.js +1 -9
  125. package/dist/core/wake.js +2 -2
  126. package/dist/core/worktree.d.ts +3 -3
  127. package/dist/core/worktree.js +5 -7
  128. package/dist/daemon/api/bridge.js +1 -1
  129. package/dist/daemon/api/handlers/broker-ops.js +1 -2
  130. package/dist/daemon/api/handlers/messages.js +2 -2
  131. package/dist/daemon/api/handlers/nodes.js +1 -1
  132. package/dist/daemon/api/handlers/reports.js +1 -1
  133. package/dist/daemon/api/handlers/validate.d.ts +2 -1
  134. package/dist/daemon/api/handlers/validate.js +2 -3
  135. package/dist/daemon/cron-run.js +7 -7
  136. package/dist/daemon/human/finish.js +3 -2
  137. package/dist/daemon/manage.d.ts +6 -6
  138. package/dist/daemon/manage.js +15 -16
  139. package/dist/pi-extensions/canvas-context-intro.js +1 -14
  140. package/dist/pi-extensions/canvas-doc-substrate.js +1 -1
  141. package/dist/pi-extensions/canvas-review-boundary.js +1 -14
  142. package/dist/pi-extensions/truncate.d.ts +5 -0
  143. package/dist/pi-extensions/truncate.js +14 -0
  144. package/dist/shared/predicates.d.ts +2 -0
  145. package/dist/shared/predicates.js +4 -0
  146. package/dist/shared/shell-quote.d.ts +3 -0
  147. package/dist/shared/shell-quote.js +5 -0
  148. package/dist/shared/tool-groups.d.ts +4 -2
  149. package/dist/shared/tool-groups.js +3 -3
  150. package/dist/types.d.ts +4 -5
  151. package/package.json +1 -1
  152. package/runtime.lock.json +2 -2
@@ -30,6 +30,7 @@ import { CONTEXT_INTRO_CUSTOM_TYPE } from '../shared/generated-context.js';
30
30
  import { brokerExtensionState } from '../core/runtime/broker/daemon-ops.js';
31
31
  import { buildContextBearingsFromState, buildForkBearingsFromState, buildProjectContextBlockForBroker } from '../core/runtime/broker-extension-render.js';
32
32
  import { situationalContextBlock } from '../core/runtime/situational-context.js';
33
+ import { truncateToWidth } from './truncate.js';
33
34
  /** The `customType` stamped on the injected session message. Used both to write
34
35
  * the entry and to detect it on resume (the idempotency guard). Defined beside
35
36
  * the block builder in `core/runtime/bearings.ts` because the warm-pool claim's
@@ -91,20 +92,6 @@ function wrapLine(line, width) {
91
92
  out.push(chars.slice(i, i + width).join(''));
92
93
  return out;
93
94
  }
94
- /** Truncate plain text to at most `width` columns, appending an ellipsis when it
95
- * would overflow. Content here is ANSI-free plain text (label + prose), so a
96
- * code-point count stands in for visible width. The renderer MUST keep every
97
- * emitted line within the terminal width or pi's TUI aborts the whole render. */
98
- function truncateToWidth(text, width) {
99
- if (width <= 0)
100
- return '';
101
- const chars = Array.from(text);
102
- if (chars.length <= width)
103
- return text;
104
- if (width === 1)
105
- return '…';
106
- return chars.slice(0, width - 1).join('') + '…';
107
- }
108
95
  /**
109
96
  * Renderer for `crtr-context` messages. Collapsed (default) shows a one-line
110
97
  * stub; expanded (Ctrl+O) shows the label + full body. Returns a plain object
@@ -76,7 +76,7 @@ export function registerCanvasDocSubstrate(pi) {
76
76
  // (memory-usage guidance + preferences). The guidance frame is always
77
77
  // present for a canvas node (the memory system always exists), so the block
78
78
  // is never empty even when no preference is eligible. (The knowledge catalog
79
- // no longer enters the system prompt — it rides the bearings message via
79
+ // does not enter the system prompt — it rides the bearings message via
80
80
  // renderKnowledgeBlock.)
81
81
  pi.on('before_agent_start', async (event) => {
82
82
  try {
@@ -6,23 +6,10 @@
6
6
  // inherited context.
7
7
  import { brokerExtensionState } from '../core/runtime/broker/daemon-ops.js';
8
8
  import { isReviewBoundary, REVIEW_BOUNDARY_CUSTOM_TYPE } from '../core/runtime/session-visibility.js';
9
+ import { truncateToWidth } from './truncate.js';
9
10
  // ---------------------------------------------------------------------------
10
11
  // Collapsed-by-default rendering
11
12
  // ---------------------------------------------------------------------------
12
- /** Truncate plain text to at most `width` columns, appending an ellipsis when it
13
- * would overflow. Content here is ANSI-free plain text, so code-point count
14
- * stands in for visible width. The renderer MUST keep every emitted line within
15
- * the terminal width or pi's TUI aborts the whole render. */
16
- function truncateToWidth(text, width) {
17
- if (width <= 0)
18
- return '';
19
- const chars = Array.from(text);
20
- if (chars.length <= width)
21
- return text;
22
- if (width === 1)
23
- return '…';
24
- return chars.slice(0, width - 1).join('') + '…';
25
- }
26
13
  /** Render the marker as a single compact divider; its full content remains in
27
14
  * the message list for the model and generated-context presenters. */
28
15
  export function renderReviewBoundary(_message, _options, theme) {
@@ -0,0 +1,5 @@
1
+ /** Hard-truncate to `width` columns with an ellipsis when the text would
2
+ * overflow. Extension-rendered content is ANSI-free plain text, so a
3
+ * code-point count stands in for visible width. Every renderer MUST keep its
4
+ * emitted lines within the terminal width or pi's TUI aborts the whole render. */
5
+ export declare function truncateToWidth(text: string, width: number): string;
@@ -0,0 +1,14 @@
1
+ /** Hard-truncate to `width` columns with an ellipsis when the text would
2
+ * overflow. Extension-rendered content is ANSI-free plain text, so a
3
+ * code-point count stands in for visible width. Every renderer MUST keep its
4
+ * emitted lines within the terminal width or pi's TUI aborts the whole render. */
5
+ export function truncateToWidth(text, width) {
6
+ if (width <= 0)
7
+ return '';
8
+ const chars = Array.from(text);
9
+ if (chars.length <= width)
10
+ return text;
11
+ if (width === 1)
12
+ return '…';
13
+ return chars.slice(0, width - 1).join('') + '…';
14
+ }
@@ -0,0 +1,2 @@
1
+ /** A plain object with named properties: null and arrays are not records. */
2
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,4 @@
1
+ /** A plain object with named properties: null and arrays are not records. */
2
+ export function isRecord(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
@@ -0,0 +1,3 @@
1
+ /** POSIX single-quote escaping for one shell word, so paths and arguments
2
+ * survive spaces and shell metacharacters when interpolated into `sh -c`. */
3
+ export declare function shellQuote(s: string): string;
@@ -0,0 +1,5 @@
1
+ /** POSIX single-quote escaping for one shell word, so paths and arguments
2
+ * survive spaces and shell metacharacters when interpolated into `sh -c`. */
3
+ export function shellQuote(s) {
4
+ return `'${s.replace(/'/g, `'\\''`)}'`;
5
+ }
@@ -1,8 +1,10 @@
1
- /** Broker-generated activity recap for one completed tool-call group. */
1
+ /** Broker-generated activity recap for one completed tool-call group. Changed
2
+ * files are counted deterministically by the viewer's GroupActivityRecorder;
3
+ * deletions have no tool of their own, so only the model can evidence them. */
2
4
  export interface ToolGroupSummary {
3
5
  bullets: string[];
4
6
  nodesSpawned: number;
5
- filesEdited: number;
7
+ filesDeleted: number;
6
8
  }
7
9
  export interface ToolGroupMessageLike {
8
10
  role?: string;
@@ -2,7 +2,7 @@
2
2
  // Keep this independent of renderer state: both live event tracking and snapshot
3
3
  // reconstruction must agree on which prose closes a run of tools.
4
4
  import { generatedContextPresentation, generatedContextText } from './generated-context.js';
5
- const TOOL_GROUP_SUMMARY_KEYS = new Set(['bullets', 'nodesSpawned', 'filesEdited']);
5
+ const TOOL_GROUP_SUMMARY_KEYS = new Set(['bullets', 'nodesSpawned', 'filesDeleted']);
6
6
  const MAX_TOOL_GROUP_BULLETS = 5;
7
7
  const MAX_TOOL_GROUP_BULLET_LENGTH = 1_000;
8
8
  /** Validate the one durable summary shape and cap its display-sized fields.
@@ -21,14 +21,14 @@ export function normalizeToolGroupSummary(value) {
21
21
  return null;
22
22
  if (typeof record.nodesSpawned !== 'number' || !Number.isSafeInteger(record.nodesSpawned) || record.nodesSpawned < 0)
23
23
  return null;
24
- if (typeof record.filesEdited !== 'number' || !Number.isSafeInteger(record.filesEdited) || record.filesEdited < 0)
24
+ if (typeof record.filesDeleted !== 'number' || !Number.isSafeInteger(record.filesDeleted) || record.filesDeleted < 0)
25
25
  return null;
26
26
  return {
27
27
  bullets: record.bullets
28
28
  .slice(0, MAX_TOOL_GROUP_BULLETS)
29
29
  .map((bullet) => bullet.trim().slice(0, MAX_TOOL_GROUP_BULLET_LENGTH).trimEnd()),
30
30
  nodesSpawned: record.nodesSpawned,
31
- filesEdited: record.filesEdited,
31
+ filesDeleted: record.filesDeleted,
32
32
  };
33
33
  }
34
34
  /** Validate sidecar/snapshot entries independently so one malformed or legacy
package/dist/types.d.ts CHANGED
@@ -128,13 +128,12 @@ export interface ModelRoutingConfig {
128
128
  /** Launch metadata for one kind (a top-level kind like `developer`, or a full
129
129
  * sub-kind string like `plan/reviewers/security`) — the settings-file
130
130
  * replacement for per-kind persona frontmatter. `model`/`tools`/`extensions`
131
- * are launch knobs consumed by `buildLaunchSpec` (Phase 3); `whenToUse` is the
131
+ * are launch knobs consumed by `buildLaunchSpec`; `whenToUse` is the
132
132
  * one-line gloss shown in `node new -h` / `node promote -h`. `availableTo` is
133
133
  * VISIBILITY-ONLY (never launch validation): the list of top-level kind names
134
134
  * whose spawn menus surface this sub-kind, `'*'` meaning every kind; omitted
135
135
  * defaults to the sub-kind's own top-level ancestor (e.g.
136
- * `plan/reviewers/security` defaults to `['plan']`) — this reproduces the
137
- * original sub-persona `availableTo` semantics. A direct launch by full kind
136
+ * `plan/reviewers/security` defaults to `['plan']`). A direct launch by full kind
138
137
  * string is always valid regardless of `availableTo`. */
139
138
  export interface KindConfig {
140
139
  model?: string;
@@ -313,9 +312,9 @@ export interface InstalledMarketplace {
313
312
  * (spec §2.1). A profile is an agent identity defined at the user root: it
314
313
  * names N project directories and owns its own `memory/` store. `projects`
315
314
  * are absolute, real-path-resolved directories in manifest order — the
316
- * pointer set `findProjectScopeRoots` walks (Phase 5), after the node's own
315
+ * pointer set `findProjectScopeRoots` walks, after the node's own
317
316
  * cwd. `name` is the mutable display name (and the gateable `profile` subject
318
- * field, Phase 6); `<slug>-<id>` in the directory name is the stable id and
317
+ * field); `<slug>-<id>` in the directory name is the stable id and
319
318
  * never changes on rename. See `src/core/profiles/manifest.ts` for every
320
319
  * read/write of this file — it is the sole owner of path resolution and
321
320
  * mutation. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.176",
3
+ "version": "0.3.178",
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.176",
3
+ "version": "0.3.178",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.176",
9
+ "version": "0.3.178",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {