@north-light/crouter 0.3.214 → 0.3.216

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 (99) hide show
  1. package/dist/api/dto/nodes.d.ts +2 -1
  2. package/dist/api/dto/profiles.d.ts +13 -1
  3. package/dist/builtin-memory/00-runtime-base.md +12 -11
  4. package/dist/builtin-memory/01-spine/00-has-manager.md +1 -11
  5. package/dist/builtin-memory/02-lifecycle/00-terminal.md +4 -10
  6. package/dist/builtin-memory/04-orchestration-kernel.md +9 -35
  7. package/dist/builtin-memory/05-kinds/advisor/{00-base.md → advice-contract.md} +1 -1
  8. package/dist/builtin-memory/05-kinds/design/00-base.md +2 -2
  9. package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +1 -1
  10. package/dist/builtin-memory/05-kinds/developer/00-base.md +2 -2
  11. package/dist/builtin-memory/05-kinds/explore/00-base.md +1 -1
  12. package/dist/builtin-memory/05-kinds/general/00-base.md +2 -0
  13. package/dist/builtin-memory/05-kinds/plan/00-base.md +1 -1
  14. package/dist/builtin-memory/05-kinds/plan/reviewers/{00-base.md → lens-contract.md} +1 -1
  15. package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +1 -1
  16. package/dist/builtin-memory/05-kinds/review/00-base.md +1 -3
  17. package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +1 -1
  18. package/dist/builtin-memory/05-kinds/review/security-findings.md +12 -0
  19. package/dist/builtin-memory/05-kinds/spec/00-base.md +1 -1
  20. package/dist/clients/attach/__tests__/context-message.test.js +28 -1
  21. package/dist/clients/attach/chrome/canvas-panels.d.ts +0 -4
  22. package/dist/clients/attach/chrome/canvas-panels.js +5 -7
  23. package/dist/clients/attach/chrome/inbox-strip.d.ts +31 -0
  24. package/dist/clients/attach/chrome/inbox-strip.js +187 -0
  25. package/dist/clients/attach/chrome/roster.d.ts +6 -2
  26. package/dist/clients/attach/chrome/roster.js +13 -52
  27. package/dist/clients/attach/chrome/ticket-panel.d.ts +29 -0
  28. package/dist/clients/attach/chrome/ticket-panel.js +236 -0
  29. package/dist/clients/attach/render/card-presentation.d.ts +8 -3
  30. package/dist/clients/attach/render/card-presentation.js +48 -10
  31. package/dist/clients/attach/render/context-message.d.ts +5 -0
  32. package/dist/clients/attach/render/context-message.js +20 -14
  33. package/dist/clients/attach/session/context.d.ts +3 -0
  34. package/dist/clients/attach/session/frame.d.ts +4 -0
  35. package/dist/clients/attach/session/frame.js +8 -3
  36. package/dist/clients/attach/session/keys.d.ts +7 -0
  37. package/dist/clients/attach/session/keys.js +7 -0
  38. package/dist/clients/attach/session/layout.js +6 -3
  39. package/dist/clients/attach/session/pane-focus.d.ts +8 -0
  40. package/dist/clients/attach/session/pane-focus.js +42 -0
  41. package/dist/clients/attach/viewer.js +793 -789
  42. package/dist/clients/inbox/controller.d.ts +9 -0
  43. package/dist/clients/inbox/controller.js +57 -2
  44. package/dist/clients/inbox/surface.d.ts +2 -0
  45. package/dist/clients/inbox/surface.js +18 -3
  46. package/dist/clients/inbox/tui.d.ts +2 -0
  47. package/dist/clients/inbox/tui.js +11 -1
  48. package/dist/commands/node/create.js +3 -3
  49. package/dist/commands/profile/kind.d.ts +1 -0
  50. package/dist/commands/profile/kind.js +39 -0
  51. package/dist/commands/profile/list.js +5 -1
  52. package/dist/commands/profile/meta.d.ts +4 -0
  53. package/dist/commands/profile/meta.js +69 -0
  54. package/dist/commands/profile/new.js +34 -4
  55. package/dist/commands/profile/pause.d.ts +2 -0
  56. package/dist/commands/profile/pause.js +60 -0
  57. package/dist/commands/profile/show.js +10 -2
  58. package/dist/commands/profile.js +5 -8
  59. package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +40 -0
  60. package/dist/core/__tests__/parse-argv-stdin-secret.test.js +28 -0
  61. package/dist/core/__tests__/seam/dormancy-release.test.js +7 -0
  62. package/dist/core/command.js +23 -23
  63. package/dist/core/config.d.ts +5 -0
  64. package/dist/core/config.js +15 -0
  65. package/dist/core/help.d.ts +1 -1
  66. package/dist/core/keybindings/attach-control.d.ts +3 -0
  67. package/dist/core/keybindings/attach-control.js +1 -0
  68. package/dist/core/keybindings/catalog.js +1 -0
  69. package/dist/core/profiles/deletion-reservation.d.ts +7 -3
  70. package/dist/core/profiles/deletion-reservation.js +9 -5
  71. package/dist/core/profiles/manifest.d.ts +39 -1
  72. package/dist/core/profiles/manifest.js +171 -4
  73. package/dist/core/runtime/boot-root.js +3 -3
  74. package/dist/core/runtime/close.js +10 -5
  75. package/dist/core/runtime/revive.js +2 -0
  76. package/dist/core/runtime/spawn-env.d.ts +9 -1
  77. package/dist/core/runtime/spawn-env.js +17 -1
  78. package/dist/core/termrender/termrender.d.ts +7 -2
  79. package/dist/core/termrender/termrender.js +11 -6
  80. package/dist/core/termrender/version.d.ts +1 -1
  81. package/dist/core/termrender/version.js +1 -1
  82. package/dist/daemon/api/__tests__/profile-launch-gates.test.d.ts +1 -0
  83. package/dist/daemon/api/__tests__/profile-launch-gates.test.js +111 -0
  84. package/dist/daemon/api/handlers/messages.js +9 -2
  85. package/dist/daemon/api/handlers/nodes.d.ts +2 -0
  86. package/dist/daemon/api/handlers/nodes.js +15 -8
  87. package/dist/daemon/api/handlers/profiles.js +12 -2
  88. package/dist/daemon/api/map.js +4 -0
  89. package/dist/daemon/fleet.js +1 -6
  90. package/dist/daemon/reconcilers/broker-supervision.js +15 -25
  91. package/dist/daemon/reconcilers/dormant-inbox.js +10 -10
  92. package/dist/daemon/reconcilers/live-obligation.d.ts +5 -1
  93. package/dist/daemon/reconcilers/live-obligation.js +11 -19
  94. package/dist/pi-extensions/canvas-inbox-watcher.js +15 -0
  95. package/dist/types.d.ts +9 -0
  96. package/package.json +1 -1
  97. package/runtime.lock.json +2 -2
  98. package/dist/builtin-memory/01-spine/01-no-manager.md +0 -11
  99. package/dist/builtin-memory/05-kinds/general/01-orchestrator.md +0 -8
@@ -1,9 +1,12 @@
1
- import { hasActiveLiveSubscription, hasLiveMessageWait, hasLiveSubscriber, hasPendingCancelOnWakeCron, } from '../../core/canvas/index.js';
1
+ import { hasActiveLiveSubscription, hasLiveMessageWait, hasLiveSubscriber, hasPendingCancelOnWakeCron, subscribersOf, } from '../../core/canvas/index.js';
2
+ import { fullName } from '../../core/canvas/labels.js';
2
3
  import { countTickets } from '../../core/canvas/attention.js';
3
4
  import { readCursor, readInboxSince } from '../../core/feed/inbox.js';
4
5
  import { readOutputRequest } from '../../core/runtime/structured-output.js';
5
6
  import { focusOf } from '../../core/runtime/placement.js';
6
7
  import { hasAttachedBrokerViewers } from '../../core/runtime/broker/client-registry.js';
8
+ import { fanDoctrineWake } from '../../core/runtime/close.js';
9
+ import { transition } from '../../core/runtime/lifecycle.js';
7
10
  /** Durable work that requires a node to remain automatically wakeable. */
8
11
  export function hasLiveObligation(nodeId) {
9
12
  return hasActiveLiveSubscription(nodeId)
@@ -27,24 +30,6 @@ export function hasPendingWake(nodeId) {
27
30
  return true;
28
31
  return focusOf(nodeId) !== null || hasAttachedBrokerViewers(nodeId);
29
32
  }
30
- /** What parking an unattended node actually amounts to — the one rule both the
31
- * live-broker park clock (broker-supervision) and the already-parked
32
- * reconciliation (dormant-inbox) apply.
33
- *
34
- * `release` — something can still wake it, so parking is a pause.
35
- * `finish` — a resident with nothing left to wake it has completed its
36
- * conversation, and the row becomes prunable history.
37
- * `cancel` — a terminal node that never pushed a final was torn down before
38
- * finishing, which is what `canceled` records; it stays revivable
39
- * and becomes prunable. A live subscriber still awaiting its
40
- * report is an outstanding deliverable, so such a node keeps its
41
- * wakeable idle row instead of being written off.
42
- *
43
- * Undelivered mail of ANY tier also holds the row. A deferred-only unseen set
44
- * never wakes a node on its own — it rides the next natural cycle — but a
45
- * terminalized row no longer takes that cycle, so writing one off would drop
46
- * content the sender already handed over.
47
- */
48
33
  export function parkEvent(nodeId, lifecycle) {
49
34
  if (hasLiveObligation(nodeId))
50
35
  return 'release';
@@ -54,3 +39,10 @@ export function parkEvent(nodeId, lifecycle) {
54
39
  return 'finish';
55
40
  return hasLiveSubscriber(nodeId) ? 'release' : 'cancel';
56
41
  }
42
+ /** Apply an unattended decision and notify subscribers of automatic completion. */
43
+ export function applyParkEvent(nodeId, event) {
44
+ const node = transition(nodeId, event);
45
+ if (event !== 'finish')
46
+ return;
47
+ fanDoctrineWake(nodeId, subscribersOf(nodeId), `Child done — ${fullName(node)} (${nodeId}) was automatically marked done after its unattended grace with nothing left to wake it. It sent no final report.`, { reason: 'child-auto-done', child: nodeId });
48
+ }
@@ -17,6 +17,7 @@ import { emitEvent } from '../core/events/emit.js';
17
17
  import { errorClassFromError } from '../core/events/errors.js';
18
18
  import { operationIdContext } from '../core/events/operation-id.js';
19
19
  import { situationalContextEnvelope, SITUATIONAL_CONTEXT_CUSTOM_TYPE } from '../core/runtime/situational-context.js';
20
+ import { isProfilePaused } from '../core/profiles/manifest.js';
20
21
  const DEFAULT_TICK_MS = 800;
21
22
  const DEFAULT_DEBOUNCE_MS = 1000;
22
23
  const MAX_PENDING_HANDOFFS = 64;
@@ -45,6 +46,13 @@ function currentNodeId() {
45
46
  const nodeId = process.env['CRTR_NODE_ID'];
46
47
  return nodeId === undefined || nodeId.trim() === '' ? undefined : nodeId;
47
48
  }
49
+ /** The node's profile, read fresh each poll: `crtr profile pause` mutates the
50
+ * manifest file directly, so a live broker sees the flip on its next tick with
51
+ * no daemon round-trip. '' is the historical no-profile row. */
52
+ function profilePaused() {
53
+ const profileId = process.env['CRTR_PROFILE_ID'];
54
+ return profileId !== undefined && profileId !== '' && isProfilePaused(profileId);
55
+ }
48
56
  function isFilesystemError(error) {
49
57
  if (typeof error !== 'object' || error === null)
50
58
  return false;
@@ -529,6 +537,13 @@ class CanvasInboxWatcher {
529
537
  this.retryPendingCommitOnTick(nodeId);
530
538
  return;
531
539
  }
540
+ // A paused profile is inert: read nothing, send nothing, leave the cursor
541
+ // where it is, so every queued entry — critical included, since aborting the
542
+ // live turn is exactly the punch-through pause forbids — is still there to
543
+ // deliver on resume. Pause is not a kill: the turn already running finishes,
544
+ // and an in-flight handoff still commits above.
545
+ if (profilePaused())
546
+ return;
532
547
  if (this.buffer.length === 0 && this.pendingHandoffs.length >= MAX_PENDING_HANDOFFS)
533
548
  return;
534
549
  if (this.buffer.length > 0) {
package/dist/types.d.ts CHANGED
@@ -397,6 +397,15 @@ export interface ProfileManifest {
397
397
  * `profileHome`). Normalized on read to the first project when the manifest
398
398
  * carries none, so a profile written before homes existed still has one. */
399
399
  home: string | null;
400
+ /** ISO timestamp while the profile is inert; null (or absent on older manifests) means active. */
401
+ paused_at: string | null;
402
+ /** Persona kind for creates that omit kind; absent means `general`. */
403
+ default_kind?: string;
404
+ /** Optional string map of profile facts (identity, role, description).
405
+ * Not secrets — readable back from every projection, and surfaced to
406
+ * every broker launched under the profile as `CRTR_PROFILE_META_<KEY>`
407
+ * env (see `core/runtime/spawn-env.ts`). Absent means none. */
408
+ metadata?: Record<string, string>;
400
409
  created_at: string;
401
410
  last_used_at: string | null;
402
411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.214",
3
+ "version": "0.3.216",
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.214",
3
+ "version": "0.3.216",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.214",
9
+ "version": "0.3.216",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -1,11 +0,0 @@
1
- ---
2
- kind: preference
3
- when-and-why-to-read: When a node has no parent, this preference should be read so its results reach the user instead of disappearing into a nonexistent manager feed.
4
- gate: {hasManager: false}
5
- surfaces:
6
- - on: boot
7
- at: content
8
- ---
9
-
10
- ## Top of your spine
11
- Nobody subscribes to you — you sit at the top of your spine. There is no manager to report to and no feed to push upward.
@@ -1,8 +0,0 @@
1
- ---
2
- kind: preference
3
- when-and-why-to-read: When a node is spawned as kind general in orchestrator mode, this preference should be read so mixed goals are decomposed to the right specialists instead of being handled shallowly by a catch-all.
4
- gate: {kind: general, mode: orchestrator}
5
- surfaces:
6
- - on: boot
7
- at: content
8
- ---