@north-light/crouter-api 0.3.236 → 0.3.238

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.
@@ -20,7 +20,7 @@ import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCo
20
20
  import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
21
21
  import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest } from './dto/human-requests.js';
22
22
  import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RebuildIndexResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
23
- import type { CloseWorktreeResultDTO } from './dto/worktree.js';
23
+ import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO } from './dto/worktree.js';
24
24
  import type { BrokerExtensionStateDTO, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerInboxCursorDirective, BrokerInboxCursorRequest, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest } from './dto/broker-ops.js';
25
25
  export interface CrtrClientOptions {
26
26
  /** Unix socket path (default local transport). Exactly one of socketPath|baseUrl. */
@@ -113,6 +113,7 @@ export declare class CrtrClient {
113
113
  * because it interleaves a canvas WRITE with a git land transaction and
114
114
  * crtrd is the repo host (same principle as spawnChild's creation git). */
115
115
  closeWorktree(id: string): Promise<CloseWorktreeResultDTO>;
116
+ abandonWorktree(id: string, req: AbandonWorktreeRequest): Promise<AbandonWorktreeResultDTO>;
116
117
  subscribe(id: string, req: SubscribeRequest): Promise<SubscriptionDTO>;
117
118
  listFocuses(): Promise<FocusDTO[]>;
118
119
  focusOf(nodeId: string): Promise<FocusDTO | null>;
@@ -176,6 +176,9 @@ export class CrtrClient {
176
176
  closeWorktree(id) {
177
177
  return this.request('POST', routes.nodeWorktreeClose(this.nodePath(id)), {});
178
178
  }
179
+ abandonWorktree(id, req) {
180
+ return this.request('POST', routes.nodeWorktreeAbandon(this.nodePath(id)), req);
181
+ }
179
182
  subscribe(id, req) {
180
183
  return this.request('POST', routes.nodeSubscriptions(this.nodePath(id)), req);
181
184
  }
@@ -75,7 +75,7 @@ export interface BrokerExtensionNodeDTO {
75
75
  fork_from: string | null;
76
76
  profile_id: string | null;
77
77
  managed_worktree?: {
78
- state: 'open' | 'closed';
78
+ state: 'open' | 'closed' | 'abandoned';
79
79
  cleanup?: 'pending' | 'complete';
80
80
  path: string;
81
81
  branch: string;
@@ -19,6 +19,8 @@ export type LifecycleDTO = 'terminal' | 'resident';
19
19
  export type ModeDTO = 'base' | 'orchestrator';
20
20
  /** Why a node last stopped (mirrors the runtime `ExitIntent` union). */
21
21
  export type ExitIntentDTO = 'done' | 'refresh' | 'idle-release' | 'parked' | null;
22
+ /** Why a terminal node ended (mirrors the runtime `TerminalReason` union). */
23
+ export type TerminalReasonDTO = 'finalized' | 'finished' | 'parked' | 'closed' | 'retired' | 'crashed' | 'stranded';
22
24
  /** Inbox urgency tier for a delivered message (mirrors feed/inbox `InboxTier`). */
23
25
  export type InboxTierDTO = 'critical' | 'urgent' | 'normal' | 'deferred';
24
26
  /** Whether a node id is a safe single filesystem path segment. Re-declared here
@@ -21,20 +21,27 @@ export interface ReviveResultDTO {
21
21
  revived: boolean;
22
22
  resumed: boolean;
23
23
  status: NodeStatusDTO;
24
+ /** What the call did: `launched` started a broker, `already-live` found one
25
+ * already running, `frozen` found no free broker slot and left the row
26
+ * waiting for one. */
27
+ outcome: 'launched' | 'already-live' | 'frozen';
24
28
  }
25
29
  /** `POST /v1/nodes/{id}/relaunch-root` result. A null id means the target
26
30
  * was not a relaunchable live root, or its replacement failed to launch. */
27
31
  export interface RelaunchRootResultDTO {
28
32
  newNodeId: NodeIdDTO | null;
29
33
  }
30
- /** `POST /v1/nodes/revive-all` result. Node ids relaunched, plus any that
31
- * failed to revive with the reason (the reader reports both). */
34
+ /** `POST /v1/nodes/revive-all` result. Node ids relaunched, any that failed to
35
+ * revive with the reason, and any the broker cap turned away (the reader
36
+ * reports all three). */
32
37
  export interface ReviveAllResultDTO {
33
38
  revived: NodeIdDTO[];
34
39
  failed: {
35
40
  node_id: NodeIdDTO;
36
41
  error: string;
37
42
  }[];
43
+ /** Frozen for capacity, not failed: the daemon relaunches these as slots free. */
44
+ frozen: NodeIdDTO[];
38
45
  }
39
46
  /** `POST /v1/nodes/{id}/close` body. The cascade set is computed server-side
40
47
  * from edges; the flag only opts out of cascading descendants. */
@@ -57,6 +57,11 @@ export interface MessageResultDTO {
57
57
  delivered: boolean;
58
58
  /** Whether a dormant target was revived to receive the message. */
59
59
  revived: boolean;
60
+ /** Present only when a wake was attempted and did not happen:
61
+ * `capacity_frozen` means no broker slot was free, so the target's row is
62
+ * frozen and the daemon relaunches it when one frees. The entry is durably
63
+ * appended either way, and delivery follows that relaunch. */
64
+ not_revived_reason?: 'capacity_frozen';
60
65
  delivered_at?: IsoTime;
61
66
  /** Which channel a `delivery:'interactive'` send actually used: `'engine'`
62
67
  * (live broker frame loop, no inbox entry) or `'inbox'` (durable fallback).
@@ -1,4 +1,4 @@
1
- import type { Cursor, ExitIntentDTO, IsoTime, LifecycleDTO, ModeDTO, NodeIdDTO, NodeStatusDTO } from './common.js';
1
+ import type { Cursor, ExitIntentDTO, IsoTime, LifecycleDTO, ModeDTO, NodeIdDTO, NodeStatusDTO, TerminalReasonDTO } from './common.js';
2
2
  import type { ReportDTO } from './reports.js';
3
3
  /** `GET /v1/nodes/{id}/subject` — the node-config subject substrate gate
4
4
  * predicates evaluate against. Mirrors `NodeConfigSubject`; this narrow
@@ -76,6 +76,8 @@ export interface NodeSummaryDTO {
76
76
  created: IsoTime;
77
77
  intent: ExitIntentDTO;
78
78
  waiting_for: NodeIdDTO | null;
79
+ frozen_at: IsoTime | null;
80
+ terminal_reason: TerminalReasonDTO | null;
79
81
  pi_pid: number | null;
80
82
  /** Launch-time process identity paired with `pi_pid`, or null when absent. */
81
83
  pi_pid_identity: string | null;
@@ -122,7 +124,7 @@ export interface NodePathsDTO {
122
124
  }
123
125
  /** A node's managed git worktree, if any. */
124
126
  export interface NodeWorktreeDTO {
125
- state: 'open' | 'closed';
127
+ state: 'open' | 'closed' | 'abandoned';
126
128
  /** Pending cleanup must be run manually after the owner exits. */
127
129
  cleanup?: 'pending' | 'complete';
128
130
  path: string;
@@ -132,6 +134,12 @@ export interface NodeWorktreeDTO {
132
134
  base_sha: string;
133
135
  created: IsoTime;
134
136
  closed?: IsoTime;
137
+ abandoned?: {
138
+ branch: string;
139
+ tip_sha: string;
140
+ at: IsoTime;
141
+ by: string;
142
+ };
135
143
  }
136
144
  /** Immutable companion provenance and fork coordinates. Present only on a
137
145
  * daemon-spawned companion node: a `review/companion` node for a human review
@@ -15,3 +15,13 @@ export interface CloseWorktreeResultDTO {
15
15
  branch_deleted: boolean;
16
16
  branch_delete_error?: string;
17
17
  }
18
+ export interface AbandonWorktreeRequest {
19
+ by: string;
20
+ }
21
+ export interface AbandonWorktreeResultDTO {
22
+ node_id: NodeIdDTO;
23
+ branch: string;
24
+ tip_sha: string;
25
+ worktree_path: string;
26
+ branch_deleted: boolean;
27
+ }
@@ -39,6 +39,7 @@ export declare const routes: {
39
39
  readonly nodeWait: (id: string) => string;
40
40
  readonly nodeConfig: (id: string) => string;
41
41
  readonly nodeWorktreeClose: (id: string) => string;
42
+ readonly nodeWorktreeAbandon: (id: string) => string;
42
43
  readonly nodeAttach: (id: string) => string;
43
44
  readonly focuses: () => string;
44
45
  readonly focusByNode: () => string;
@@ -57,6 +57,7 @@ export const routes = {
57
57
  nodeWait: (id) => `${V}/nodes/${id}/wait`,
58
58
  nodeConfig: (id) => `${V}/nodes/${id}/config`,
59
59
  nodeWorktreeClose: (id) => `${V}/nodes/${id}/worktree/close`,
60
+ nodeWorktreeAbandon: (id) => `${V}/nodes/${id}/worktree/abandon`,
60
61
  nodeAttach: (id) => `${V}/nodes/${id}/attach`,
61
62
  // Focuses (viewer registry — the canvas.db `focuses` table)
62
63
  focuses: () => `${V}/focuses`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter-api",
3
- "version": "0.3.236",
3
+ "version": "0.3.238",
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",