@north-light/crouter-api 0.3.322 → 0.3.323
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.
- package/dist/api/client.d.ts +6 -2
- package/dist/api/client.js +8 -0
- package/dist/api/dto/broker-ops.d.ts +9 -0
- package/dist/api/dto/canvas.d.ts +23 -1
- package/dist/api/dto/nodes.d.ts +8 -0
- package/dist/api/node-transport.js +2 -1
- package/dist/api/routes.d.ts +2 -0
- package/dist/api/routes.js +2 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, Review
|
|
|
19
19
|
import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentForkDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
|
|
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
|
-
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
22
|
+
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, GraphDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
23
23
|
import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO } from './dto/worktree.js';
|
|
24
|
-
import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest } from './dto/broker-ops.js';
|
|
24
|
+
import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
|
|
25
25
|
import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
|
|
26
26
|
import type { BrokerFaultInputDTO, BrokerFaultRequest, BrokerFaultResultDTO, BrokerProviderRetryRequest, BrokerProviderRetryResultDTO, BrokerTurnRequest, BrokerTurnResultDTO, NodeFaultClearResultDTO, RecoveryStateDTO } from './dto/recovery.js';
|
|
27
27
|
export interface CrtrClientOptions {
|
|
@@ -129,6 +129,7 @@ export declare class CrtrClient {
|
|
|
129
129
|
settleBroker(id: string, req: BrokerSettleRequest): Promise<BrokerSettleDirective>;
|
|
130
130
|
completeBrokerPark(id: string, req: BrokerParkCompleteRequest): Promise<BrokerSettleDirective>;
|
|
131
131
|
recordBrokerParkActivity(id: string, req: BrokerExecutionRequest): Promise<BrokerParkActivityResultDTO>;
|
|
132
|
+
recordBrokerTelemetry(id: string, req: BrokerTelemetryRequest): Promise<void>;
|
|
132
133
|
claimNodeMail(id: string, req: ClaimMailRequest): Promise<ClaimMailResultDTO>;
|
|
133
134
|
acknowledgeNodeMail(id: string, req: AcknowledgeMailRequest): Promise<AcknowledgeMailResultDTO>;
|
|
134
135
|
recordBrokerTurn(id: string, req: BrokerTurnRequest): Promise<BrokerTurnResultDTO>;
|
|
@@ -315,6 +316,9 @@ export declare class CrtrClient {
|
|
|
315
316
|
* poll target for attach/browser topology; use `canvasSnapshot` for the
|
|
316
317
|
* enriched on-demand view. */
|
|
317
318
|
canvasRoster(): Promise<RosterDTO>;
|
|
319
|
+
/** The lean attach-graph projection: display rows, topology, and focus state
|
|
320
|
+
* in one daemon-owned read rather than the full node-summary list. */
|
|
321
|
+
canvasGraph(): Promise<GraphDTO>;
|
|
318
322
|
prune(req: PruneRequest): Promise<PruneResultDTO>;
|
|
319
323
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
320
324
|
* autostart + retry + error-mapping semantics. */
|
package/dist/api/client.js
CHANGED
|
@@ -178,6 +178,9 @@ export class CrtrClient {
|
|
|
178
178
|
recordBrokerParkActivity(id, req) {
|
|
179
179
|
return this.request('POST', routes.nodeBrokerParkActivity(this.nodePath(id)), req);
|
|
180
180
|
}
|
|
181
|
+
async recordBrokerTelemetry(id, req) {
|
|
182
|
+
await this.request('POST', routes.nodeBrokerTelemetry(this.nodePath(id)), req);
|
|
183
|
+
}
|
|
181
184
|
claimNodeMail(id, req) {
|
|
182
185
|
return this.request('POST', routes.nodeMailClaim(this.nodePath(id)), req);
|
|
183
186
|
}
|
|
@@ -597,6 +600,11 @@ export class CrtrClient {
|
|
|
597
600
|
canvasRoster() {
|
|
598
601
|
return this.request('GET', routes.canvasRoster());
|
|
599
602
|
}
|
|
603
|
+
/** The lean attach-graph projection: display rows, topology, and focus state
|
|
604
|
+
* in one daemon-owned read rather than the full node-summary list. */
|
|
605
|
+
canvasGraph() {
|
|
606
|
+
return this.request('GET', routes.canvasGraph());
|
|
607
|
+
}
|
|
600
608
|
prune(req) {
|
|
601
609
|
return this.request('POST', routes.canvasPrune(), req);
|
|
602
610
|
}
|
|
@@ -29,6 +29,15 @@ export interface BrokerSettleRequest extends BrokerExecutionRequest {
|
|
|
29
29
|
backgroundJobsRunning: boolean;
|
|
30
30
|
pushedFinal: boolean;
|
|
31
31
|
}
|
|
32
|
+
/** `POST /v1/nodes/{id}/broker/telemetry` body. Tokens are cumulative within
|
|
33
|
+
* the broker's current Pi session; null context/activity values preserve the
|
|
34
|
+
* last usable value in the daemon projection, matching telemetry.json. */
|
|
35
|
+
export interface BrokerTelemetryRequest extends BrokerExecutionRequest {
|
|
36
|
+
tokens_in: number;
|
|
37
|
+
context_tokens: number | null;
|
|
38
|
+
last_activity: string | null;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
}
|
|
32
41
|
/** The only consequence a settle caller may enact. crtrd has already committed
|
|
33
42
|
* every canvas and placement effect before returning this directive. */
|
|
34
43
|
export type BrokerSettleDirective = {
|
package/dist/api/dto/canvas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Cursor, IsoTime, NodeIdDTO, NodeStatusDTO } from './common.js';
|
|
2
|
-
import type { NodeSummaryDTO } from './nodes.js';
|
|
2
|
+
import type { NodeFaultDTO, NodeSummaryDTO } from './nodes.js';
|
|
3
3
|
/** `GET /v1/nodes` + `GET /v1/status` composed for the dashboard view. */
|
|
4
4
|
export interface DashboardQuery {
|
|
5
5
|
/** Restrict to the subtree under this node. */
|
|
@@ -280,6 +280,28 @@ export interface RosterDTO {
|
|
|
280
280
|
nodes: RosterNodeDTO[];
|
|
281
281
|
edges: RosterEdgeDTO[];
|
|
282
282
|
}
|
|
283
|
+
/** One row in `GET /v1/canvas/graph`: exactly the node fields the attach graph displays. */
|
|
284
|
+
export interface GraphNodeDTO {
|
|
285
|
+
node_id: NodeIdDTO;
|
|
286
|
+
name: string;
|
|
287
|
+
description: string | null;
|
|
288
|
+
cycles: number | null;
|
|
289
|
+
kind: string;
|
|
290
|
+
status: NodeStatusDTO;
|
|
291
|
+
frozen_at: IsoTime | null;
|
|
292
|
+
pi_pid: number | null;
|
|
293
|
+
telemetry_context_tokens: number | null;
|
|
294
|
+
telemetry_last_activity: string | null;
|
|
295
|
+
fault: NodeFaultDTO | null;
|
|
296
|
+
streaming: boolean;
|
|
297
|
+
}
|
|
298
|
+
/** `GET /v1/canvas/graph` — the attach graph's one-read projection: display rows, subscription topology, and the current local viewer-focus set. */
|
|
299
|
+
export interface GraphDTO {
|
|
300
|
+
generated_at: IsoTime;
|
|
301
|
+
nodes: GraphNodeDTO[];
|
|
302
|
+
edges: RosterEdgeDTO[];
|
|
303
|
+
focused_node_ids: NodeIdDTO[];
|
|
304
|
+
}
|
|
283
305
|
/** `POST /v1/canvas/prune` body — the three exclusive prune modes of
|
|
284
306
|
* `crtr canvas prune`, precedence COUNT (`limit`) > EMPTY (`empty`) > TTL sweep. */
|
|
285
307
|
export interface PruneRequest {
|
package/dist/api/dto/nodes.d.ts
CHANGED
|
@@ -105,6 +105,14 @@ export interface NodeSummaryDTO {
|
|
|
105
105
|
final_report: string | null;
|
|
106
106
|
finalized_at: IsoTime | null;
|
|
107
107
|
deadline_at: IsoTime | null;
|
|
108
|
+
/** Cumulative input tokens reported by the broker telemetry producer. */
|
|
109
|
+
telemetry_tokens_in?: number | null;
|
|
110
|
+
/** Latest context-window token gauge reported by the broker. */
|
|
111
|
+
telemetry_context_tokens?: number | null;
|
|
112
|
+
/** Latest tool summary reported by the broker. */
|
|
113
|
+
telemetry_last_activity?: string | null;
|
|
114
|
+
/** Timestamp of the latest broker telemetry update. */
|
|
115
|
+
telemetry_updated_at?: IsoTime | null;
|
|
108
116
|
outcome: NodeOutcomeSummaryDTO | null;
|
|
109
117
|
fault?: NodeFaultDTO | null;
|
|
110
118
|
streaming?: boolean;
|
|
@@ -65,7 +65,8 @@ export function socketFetch(socketPath) {
|
|
|
65
65
|
for (const one of Array.isArray(value) ? value : [value])
|
|
66
66
|
responseHeaders.append(name, one);
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
const status = res.statusCode ?? 0;
|
|
69
|
+
resolvePromise(new Response(status === 204 ? null : body, { status, statusText: res.statusMessage, headers: responseHeaders }));
|
|
69
70
|
});
|
|
70
71
|
req.on('error', (err) => reject(new TypeError('fetch failed', { cause: err })));
|
|
71
72
|
const signal = init.signal;
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const routes: {
|
|
|
33
33
|
readonly nodeBrokerSettle: (id: string) => string;
|
|
34
34
|
readonly nodeBrokerParkComplete: (id: string) => string;
|
|
35
35
|
readonly nodeBrokerParkActivity: (id: string) => string;
|
|
36
|
+
readonly nodeBrokerTelemetry: (id: string) => string;
|
|
36
37
|
readonly nodeMailClaim: (id: string) => string;
|
|
37
38
|
readonly nodeMailAcknowledge: (id: string) => string;
|
|
38
39
|
readonly nodeBrokerModel: (id: string) => string;
|
|
@@ -75,6 +76,7 @@ export declare const routes: {
|
|
|
75
76
|
readonly canvasHistoryStats: () => string;
|
|
76
77
|
readonly canvasSnapshot: () => string;
|
|
77
78
|
readonly canvasRoster: () => string;
|
|
79
|
+
readonly canvasGraph: () => string;
|
|
78
80
|
readonly canvasPrune: () => string;
|
|
79
81
|
readonly humanReviews: () => string;
|
|
80
82
|
readonly humanReview: (reviewId: string) => string;
|
package/dist/api/routes.js
CHANGED
|
@@ -51,6 +51,7 @@ export const routes = {
|
|
|
51
51
|
nodeBrokerSettle: (id) => `${V}/nodes/${id}/broker/settle`,
|
|
52
52
|
nodeBrokerParkComplete: (id) => `${V}/nodes/${id}/broker/park-complete`,
|
|
53
53
|
nodeBrokerParkActivity: (id) => `${V}/nodes/${id}/broker/park-activity`,
|
|
54
|
+
nodeBrokerTelemetry: (id) => `${V}/nodes/${id}/broker/telemetry`,
|
|
54
55
|
nodeMailClaim: (id) => `${V}/nodes/${id}/mail/claim`,
|
|
55
56
|
nodeMailAcknowledge: (id) => `${V}/nodes/${id}/mail/acknowledge`,
|
|
56
57
|
nodeBrokerModel: (id) => `${V}/nodes/${id}/broker/model`,
|
|
@@ -97,6 +98,7 @@ export const routes = {
|
|
|
97
98
|
canvasHistoryStats: () => `${V}/canvas/history/stats`,
|
|
98
99
|
canvasSnapshot: () => `${V}/canvas/snapshot`,
|
|
99
100
|
canvasRoster: () => `${V}/canvas/roster`,
|
|
101
|
+
canvasGraph: () => `${V}/canvas/graph`,
|
|
100
102
|
canvasPrune: () => `${V}/canvas/prune`,
|
|
101
103
|
// Daemon-owned document reviews and comments. All interpolated ids are
|
|
102
104
|
// guarded by `CrtrClient` before they reach these pure builders.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/crouter-api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.323",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|