@north-light/crouter-api 0.3.269 → 0.3.270

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.
@@ -26,6 +26,10 @@ export interface BrokerWelcomeSnapshot<M = unknown> {
26
26
  messages: M[];
27
27
  /** Stable session-entry ids aligned 1:1 with `messages`. */
28
28
  messageIds?: string[];
29
+ /** Presentation visibility aligned 1:1 with `messages`. */
30
+ messageVisibility: Array<'visible' | 'internal'>;
31
+ /** Presentation visibility of the run currently owned by the engine. */
32
+ turnVisibility: 'visible' | 'internal';
29
33
  state?: {
30
34
  isStreaming?: boolean;
31
35
  };
@@ -42,6 +46,11 @@ export interface BrokerWelcomeFrame<M = unknown> {
42
46
  type: 'welcome';
43
47
  snapshot?: BrokerWelcomeSnapshot<M>;
44
48
  }
49
+ /** The presentation classification of the run whose native events follow. */
50
+ export interface BrokerTurnVisibilityFrame {
51
+ type: 'turn_visibility';
52
+ visibility: 'visible' | 'internal';
53
+ }
45
54
  /**
46
55
  * The crtrd broker `node_named` control frame — the node's generated name at the
47
56
  * instant crtrd committed it.
@@ -68,11 +77,11 @@ export interface BrokerNodeNamedFrame {
68
77
  }
69
78
  /**
70
79
  * The broker-control frames a relay consumer reads: `welcome` (catch-up snapshot),
71
- * `error`, and `node_named`. The broker interleaves others (display_*, ack, …)
80
+ * `turn_visibility`, `error`, and `node_named`. The broker interleaves others (display_*, ack, …)
72
81
  * under non-colliding `type` discriminants; a relay mapper drops those through its
73
82
  * `default` arm untyped, so they are not enumerated here.
74
83
  */
75
- export type BrokerControlFrame<M = unknown> = BrokerWelcomeFrame<M> | BrokerErrorFrame | BrokerNodeNamedFrame;
84
+ export type BrokerControlFrame<M = unknown> = BrokerWelcomeFrame<M> | BrokerTurnVisibilityFrame | BrokerErrorFrame | BrokerNodeNamedFrame;
76
85
  /**
77
86
  * What the crtrd broker attach delivers to a relay consumer: the live engine
78
87
  * event stream (`E` — pi's `AgentSessionEvent`, relayed verbatim) unioned with the
@@ -1,8 +1,8 @@
1
1
  // Broker attach-protocol envelope DTOs — the crtrd-specific control frames the
2
2
  // broker interleaves around pi's native agent-session event stream over a node's
3
3
  // `view.sock` (and its WS bridge, spec §5). This module owns ONLY that envelope
4
- // vocabulary: the two broker-control frames a relay consumer reads (`welcome` +
5
- // `error`), the welcome snapshot they carry, and the relay union that folds them
4
+ // vocabulary: the broker-control frames a relay consumer reads, the welcome
5
+ // snapshot they carry, and the relay union that folds them
6
6
  // together with the live engine event stream.
7
7
  //
8
8
  // PURITY (spec §3.1): like every file under `src/api/`, this imports NOTHING —
@@ -244,6 +244,8 @@ export interface NodeSnapshotDTO {
244
244
  snapshot: {
245
245
  messages: unknown[];
246
246
  messageIds?: string[];
247
+ messageVisibility: Array<'visible' | 'internal'>;
248
+ turnVisibility: 'visible' | 'internal';
247
249
  stats: unknown;
248
250
  state: Record<string, unknown>;
249
251
  display: {
@@ -282,6 +284,8 @@ export interface NodeMessagesPageDTO {
282
284
  messages: unknown[];
283
285
  /** Stable session-entry ids aligned 1:1 with `messages`. */
284
286
  message_ids?: string[];
287
+ /** Presentation visibility aligned 1:1 with `messages`. */
288
+ message_visibility: Array<'visible' | 'internal'>;
285
289
  /** Opaque cursor toward older messages; null at the start of the session. */
286
290
  next_cursor: Cursor | null;
287
291
  captured_at: IsoTime;
@@ -11,8 +11,7 @@ export declare const STALL_REPROMPT: string;
11
11
  /** The daemon's parking mandate: the last turn of a conversation the unattended
12
12
  * clock is concluding. Delivered live, wrapped in a `park` runtime card. It
13
13
  * governs both the node's durable inheritance and reader-facing output:
14
- * one update for subscribers and history, then a silent stop with no assistant
15
- * prose for an external channel to relay.
14
+ * one update for subscribers and history, then a brief completion reply.
16
15
  *
17
16
  * The durable inheritance shares a CONTRACT with `node yield`'s pre-invocation
18
17
  * guide (roadmap current, short and shrinking; context dir for in-progress
@@ -16,8 +16,7 @@ export const STALL_REPROMPT = "You've stopped but you're not waiting on anyone a
16
16
  /** The daemon's parking mandate: the last turn of a conversation the unattended
17
17
  * clock is concluding. Delivered live, wrapped in a `park` runtime card. It
18
18
  * governs both the node's durable inheritance and reader-facing output:
19
- * one update for subscribers and history, then a silent stop with no assistant
20
- * prose for an external channel to relay.
19
+ * one update for subscribers and history, then a brief completion reply.
21
20
  *
22
21
  * The durable inheritance shares a CONTRACT with `node yield`'s pre-invocation
23
22
  * guide (roadmap current, short and shrinking; context dir for in-progress
@@ -28,8 +27,8 @@ export const PARK_SUMMARY_PROMPT = 'This conversation has been idle with nothing
28
27
  + '2. Rewrite `$CRTR_CONTEXT_DIR/roadmap.md` for a fresh context window. This is the only handoff document a later fresh cycle receives in full. Preserve the current goal and exit criteria when they still apply, then state the present outcome; what remains or is blocked; decisions or questions still open; exact recovery handles for in-flight state; and the first safe move on return. Keep strategy and present state, not a transcript recap. Delete stale and completed steps instead of marking them done; the roadmap should stay short and shrink. Write a minimal one now if none exists.\n\n'
29
28
  + '3. Put supporting material in your context directory only when the roadmap would become bulky without it. Rewrite existing living documents rather than leave superseded versions. Name every supporting file the next cycle must read from the roadmap and say what it is for—the revive shows filenames but does not inject their contents. Task state, identifiers, and recovery detail belong here, not in memory.\n\n'
30
29
  + '4. Use memory only for a non-obvious, reusable lesson that should survive this task and is not already recorded. Read `crtr memory write -h`, find before writing, and choose the narrowest scope that will reach the next agent who needs it. Do not put a conversation recap, task status, recovery handles, or facts already captured in code or docs into memory.\n\n'
31
- + '5. Push exactly one regular update with `crtr push update --tier deferred`, never `crtr push final`. Write it for subscribers and history, not as a second roadmap. Its first line must stand alone as the current outcome, blocker, or decision that matters; then include only unfinished work, a needed decision, and concrete handles a subscriber may need. This concludes the conversation; it does not finish the mandate.\n\n'
32
- + '6. Keep this entire turn silent in the conversation: produce no assistant prose before, between, or after tool calls, and do not narrate the work. Once every required tool call has finished, end the response immediately without emitting any text, sign-off, summary, acknowledgement, or other visible content by emitting the `stop` token with no text. The deferred update from step 5 is the only reader-facing conclusion. A later message reopens you on a fresh context window grounded in your goal and roadmap, so the inheritance you leave now is what you get back.';
30
+ + '5. Push exactly one regular update with `crtr push update --tier deferred`, never `crtr push final`. Write for someone who has not seen this conversation: name the work in plain terms, say where it stands, and say what remains or is blocked. Put the current outcome in the first line; include only needed decisions and recovery handles. This concludes the conversation, not the mandate.\n\n'
31
+ + '6. When finished, reply with exactly `done`.';
33
32
  /** Static recovery prompts shared by the broker producer and display classifier. */
34
33
  export const AUTH_FAULT_RECOVERY_BODY = 'Provider credentials were just updated (a new login landed). Your previous turn stopped on a provider authentication failure. Continue from where you left off and retry the work that failed.';
35
34
  export const CONNECTION_FAULT_RECOVERY_BODY = 'The network connection is back online. Your previous turn stopped on a connection error (the network was down). Continue from where you left off and retry the work that failed.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter-api",
3
- "version": "0.3.269",
3
+ "version": "0.3.270",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, and the CrtrClient. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",