@north-light/crouter-api 0.3.179 → 0.3.180
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/client.d.ts +17 -1
- package/dist/client.js +28 -1
- package/dist/dto/human.d.ts +1 -7
- package/dist/dto/inbox.d.ts +71 -1
- package/dist/dto/inbox.js +9 -1
- package/dist/routes.d.ts +3 -0
- package/dist/routes.js +4 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredential
|
|
|
14
14
|
import type { CreateHumanBridgeRequest, HumanBridgeResultDTO, HumanCancelRequest, HumanCancelResultDTO, HumanResolveRequest, HumanResolveResultDTO } from './dto/human.js';
|
|
15
15
|
import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
|
|
16
16
|
import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
|
|
17
|
-
import type { InboxListDTO } from './dto/inbox.js';
|
|
17
|
+
import type { CancelInboxTicketRequest, CanceledTicketResultDTO, DeckTicketResultDTO, InboxDeckDTO, InboxListDTO, InboxTicketIdDTO, RespondInboxDeckRequest } from './dto/inbox.js';
|
|
18
18
|
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RebuildIndexResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
19
19
|
import type { CloseWorktreeResultDTO } from './dto/worktree.js';
|
|
20
20
|
import type { BrokerExtensionStateDTO, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerInboxCursorDirective, BrokerInboxCursorRequest, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerPersonaAckRequest, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest } from './dto/broker-ops.js';
|
|
@@ -179,7 +179,17 @@ export declare class CrtrClient {
|
|
|
179
179
|
resolveReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
|
|
180
180
|
reopenReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
|
|
181
181
|
deleteReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
|
|
182
|
+
/** Pending deck/review tickets across every available crouter-owned
|
|
183
|
+
* humanloop root. */
|
|
182
184
|
listHumanInbox(): Promise<InboxListDTO>;
|
|
185
|
+
/** Read one pending deck by its opaque ticket id, with Markdown bodies
|
|
186
|
+
* resolved inline. */
|
|
187
|
+
getHumanInboxDeck(ticketId: InboxTicketIdDTO): Promise<InboxDeckDTO>;
|
|
188
|
+
/** Submit ordered interaction responses for a pending deck. Single-assignment
|
|
189
|
+
* server-side: a competing resolution races to `ticket_already_resolved`. */
|
|
190
|
+
respondHumanInboxDeck(ticketId: InboxTicketIdDTO, request: RespondInboxDeckRequest): Promise<DeckTicketResultDTO>;
|
|
191
|
+
/** Cancel a pending deck (terminal response, never deletion). */
|
|
192
|
+
cancelHumanInboxTicket(ticketId: InboxTicketIdDTO, request?: CancelInboxTicketRequest): Promise<CanceledTicketResultDTO>;
|
|
183
193
|
/** Composed client-side from `GET /v1/nodes` + `GET /v1/status` (spec §6.3 —
|
|
184
194
|
* the dashboard is absorbed into those two reads; there is no single route).
|
|
185
195
|
* `generated_at` is the client-side capture instant of the composition. */
|
|
@@ -217,6 +227,12 @@ export declare class CrtrClient {
|
|
|
217
227
|
* it raw, so a value carrying `/`, whitespace or `?` would corrupt the
|
|
218
228
|
* request line rather than 404 cleanly. Mirrors `nodePath`. */
|
|
219
229
|
private cronPath;
|
|
230
|
+
/** Validate an opaque inbox ticket id before route construction. A local
|
|
231
|
+
* shape violation is a caller bug, not a server-rejectable request — throws
|
|
232
|
+
* `TypeError` (matching the existing safe-segment discipline of a local
|
|
233
|
+
* precondition, distinct from `nodePath`'s `ApiError` because that one IS a
|
|
234
|
+
* request the server could plausibly receive and reject itself). */
|
|
235
|
+
private ticketId;
|
|
220
236
|
/** Validate a review id before route construction (D-A6). Reviews are minted
|
|
221
237
|
* and addressed like node ids, but arrive from agent argv, so a malformed
|
|
222
238
|
* one is a plausible request the server would also reject — `ApiError`,
|
package/dist/client.js
CHANGED
|
@@ -351,10 +351,26 @@ export class CrtrClient {
|
|
|
351
351
|
deleteReviewComment(commentId, req = {}) {
|
|
352
352
|
return this.request('POST', routes.humanCommentDelete(this.commentPath(commentId)), req);
|
|
353
353
|
}
|
|
354
|
-
// ----
|
|
354
|
+
// ---- Humanloop inbox (Northlight crouter-inbox v1, inbox-contract.md §A) --
|
|
355
|
+
/** Pending deck/review tickets across every available crouter-owned
|
|
356
|
+
* humanloop root. */
|
|
355
357
|
listHumanInbox() {
|
|
356
358
|
return this.request('GET', routes.humanInbox());
|
|
357
359
|
}
|
|
360
|
+
/** Read one pending deck by its opaque ticket id, with Markdown bodies
|
|
361
|
+
* resolved inline. */
|
|
362
|
+
getHumanInboxDeck(ticketId) {
|
|
363
|
+
return this.request('GET', routes.humanInboxTicket(this.ticketId(ticketId)));
|
|
364
|
+
}
|
|
365
|
+
/** Submit ordered interaction responses for a pending deck. Single-assignment
|
|
366
|
+
* server-side: a competing resolution races to `ticket_already_resolved`. */
|
|
367
|
+
respondHumanInboxDeck(ticketId, request) {
|
|
368
|
+
return this.request('POST', routes.humanInboxRespond(this.ticketId(ticketId)), request);
|
|
369
|
+
}
|
|
370
|
+
/** Cancel a pending deck (terminal response, never deletion). */
|
|
371
|
+
cancelHumanInboxTicket(ticketId, request) {
|
|
372
|
+
return this.request('POST', routes.humanInboxCancel(this.ticketId(ticketId)), request ?? {});
|
|
373
|
+
}
|
|
358
374
|
// ---- Canvas reads / maintenance ---------------------------------------
|
|
359
375
|
/** Composed client-side from `GET /v1/nodes` + `GET /v1/status` (spec §6.3 —
|
|
360
376
|
* the dashboard is absorbed into those two reads; there is no single route).
|
|
@@ -446,6 +462,17 @@ export class CrtrClient {
|
|
|
446
462
|
}
|
|
447
463
|
return id;
|
|
448
464
|
}
|
|
465
|
+
/** Validate an opaque inbox ticket id before route construction. A local
|
|
466
|
+
* shape violation is a caller bug, not a server-rejectable request — throws
|
|
467
|
+
* `TypeError` (matching the existing safe-segment discipline of a local
|
|
468
|
+
* precondition, distinct from `nodePath`'s `ApiError` because that one IS a
|
|
469
|
+
* request the server could plausibly receive and reject itself). */
|
|
470
|
+
ticketId(id) {
|
|
471
|
+
if (!/^[a-f0-9]{64}$/.test(id)) {
|
|
472
|
+
throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(id)}`);
|
|
473
|
+
}
|
|
474
|
+
return id;
|
|
475
|
+
}
|
|
449
476
|
/** Validate a review id before route construction (D-A6). Reviews are minted
|
|
450
477
|
* and addressed like node ids, but arrive from agent argv, so a malformed
|
|
451
478
|
* one is a plausible request the server would also reject — `ApiError`,
|
package/dist/dto/human.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NodeIdDTO } from './common.js';
|
|
2
|
+
import type { InteractionResponseDTO } from './inbox.js';
|
|
2
3
|
/** One anchored review comment, mirroring crouter's ticket-store shape as a
|
|
3
4
|
* plain structural wire type (no store import). */
|
|
4
5
|
export interface FeedbackCommentDTO {
|
|
@@ -36,13 +37,6 @@ export interface FeedbackResultDTO {
|
|
|
36
37
|
commentsTotal: number;
|
|
37
38
|
commentsUnresolved: number;
|
|
38
39
|
}
|
|
39
|
-
export interface InteractionResponseDTO {
|
|
40
|
-
id: string;
|
|
41
|
-
selectedOptionId?: string;
|
|
42
|
-
selectedOptionIds?: string[];
|
|
43
|
-
freetext?: string;
|
|
44
|
-
optionComments?: Record<string, string>;
|
|
45
|
-
}
|
|
46
40
|
/** `POST /v1/human/tickets/{node_id}/resolve` body — a deck answer. */
|
|
47
41
|
export interface HumanResolveRequest {
|
|
48
42
|
responses: InteractionResponseDTO[];
|
package/dist/dto/inbox.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IsoTime } from './common.js';
|
|
2
2
|
/** Opaque, stable, URL-safe ticket id: lowercase SHA-256 hex of
|
|
3
|
-
* `canonicalRoot + "\0" + ticketBasename`.
|
|
3
|
+
* `canonicalRoot + "\0" + ticketBasename`. Clients must treat it as opaque —
|
|
4
|
+
* it discloses no home filesystem path. */
|
|
4
5
|
export type InboxTicketIdDTO = string;
|
|
5
6
|
export type InteractionKindDTO = 'notify' | 'decision' | 'context' | 'error' | 'review';
|
|
6
7
|
export interface DeckSourceDTO {
|
|
@@ -32,3 +33,72 @@ export type InboxTicketSummaryDTO = DeckTicketSummaryDTO | ReviewTicketSummaryDT
|
|
|
32
33
|
export interface InboxListDTO {
|
|
33
34
|
tickets: InboxTicketSummaryDTO[];
|
|
34
35
|
}
|
|
36
|
+
export interface InteractionOptionDTO {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface InteractionPreAnswerDTO {
|
|
42
|
+
selectedOptionId?: string;
|
|
43
|
+
selectedOptionIds?: string[];
|
|
44
|
+
freetext?: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface InteractionDTO {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle: string;
|
|
51
|
+
/** Resolved source Markdown — `bodyPath` is deliberately impossible here. */
|
|
52
|
+
body?: string;
|
|
53
|
+
options: InteractionOptionDTO[];
|
|
54
|
+
multiSelect?: boolean;
|
|
55
|
+
allowFreetext?: boolean;
|
|
56
|
+
freetextLabel?: string;
|
|
57
|
+
kind?: InteractionKindDTO;
|
|
58
|
+
preAnswered?: InteractionPreAnswerDTO;
|
|
59
|
+
}
|
|
60
|
+
export interface DeckDTO {
|
|
61
|
+
title: string;
|
|
62
|
+
source?: DeckSourceDTO;
|
|
63
|
+
interactions: InteractionDTO[];
|
|
64
|
+
}
|
|
65
|
+
/** `GET /v1/human/inbox/:ticket_id` result for a pending deck. */
|
|
66
|
+
export interface InboxDeckDTO {
|
|
67
|
+
ticket_id: InboxTicketIdDTO;
|
|
68
|
+
kind: 'deck';
|
|
69
|
+
deck: DeckDTO;
|
|
70
|
+
}
|
|
71
|
+
export interface InteractionResponseDTO {
|
|
72
|
+
id: string;
|
|
73
|
+
selectedOptionId?: string;
|
|
74
|
+
selectedOptionIds?: string[];
|
|
75
|
+
freetext?: string;
|
|
76
|
+
optionComments?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
/** `POST /v1/human/inbox/:ticket_id/respond` body. */
|
|
79
|
+
export interface RespondInboxDeckRequest {
|
|
80
|
+
responses: InteractionResponseDTO[];
|
|
81
|
+
}
|
|
82
|
+
/** `POST /v1/human/inbox/:ticket_id/respond` result — the canonical humanloop
|
|
83
|
+
* `humanloop.response/v2` result, unchanged. */
|
|
84
|
+
export interface DeckTicketResultDTO {
|
|
85
|
+
schema: 'humanloop.response/v2';
|
|
86
|
+
kind: 'deck';
|
|
87
|
+
responses: InteractionResponseDTO[];
|
|
88
|
+
summary: string;
|
|
89
|
+
completedAt: IsoTime;
|
|
90
|
+
}
|
|
91
|
+
/** `POST /v1/human/inbox/:ticket_id/cancel` body. `reason`, when present, must
|
|
92
|
+
* be nonempty after trim and at most 1000 characters. */
|
|
93
|
+
export interface CancelInboxTicketRequest {
|
|
94
|
+
reason?: string;
|
|
95
|
+
}
|
|
96
|
+
/** `POST /v1/human/inbox/:ticket_id/cancel` result — the canonical humanloop
|
|
97
|
+
* `humanloop.cancel/v1` result, unchanged. `actor` is always `"human"`. */
|
|
98
|
+
export interface CanceledTicketResultDTO {
|
|
99
|
+
schema: 'humanloop.cancel/v1';
|
|
100
|
+
kind: 'canceled';
|
|
101
|
+
canceledAt: IsoTime;
|
|
102
|
+
reason?: string;
|
|
103
|
+
actor?: string;
|
|
104
|
+
}
|
package/dist/dto/inbox.js
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Humanloop inbox DTOs — crtrd `/v1/human/inbox` (Northlight crouter-inbox v1,
|
|
2
|
+
// inbox-contract.md §A). Crouter API envelope fields use the existing
|
|
3
|
+
// snake_case convention; nested humanloop protocol objects retain their
|
|
4
|
+
// canonical camelCase field names so they cross the wire without translation
|
|
5
|
+
// or loss. Optional fields are omitted when absent, never serialized as
|
|
6
|
+
// `null`. `bodyPath` is deliberately impossible on this wire — crtrd resolves
|
|
7
|
+
// it server-side via humanloop's `parseDeck` and returns inline `body`.
|
|
8
|
+
//
|
|
9
|
+
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
2
10
|
export {};
|
package/dist/routes.d.ts
CHANGED
|
@@ -73,6 +73,9 @@ export declare const routes: {
|
|
|
73
73
|
readonly humanCommentReopen: (commentId: string) => string;
|
|
74
74
|
readonly humanCommentDelete: (commentId: string) => string;
|
|
75
75
|
readonly humanInbox: () => string;
|
|
76
|
+
readonly humanInboxTicket: (ticketId: string) => string;
|
|
77
|
+
readonly humanInboxRespond: (ticketId: string) => string;
|
|
78
|
+
readonly humanInboxCancel: (ticketId: string) => string;
|
|
76
79
|
readonly profiles: () => string;
|
|
77
80
|
readonly profile: (name: string) => string;
|
|
78
81
|
readonly modelAuths: () => string;
|
package/dist/routes.js
CHANGED
|
@@ -98,8 +98,11 @@ export const routes = {
|
|
|
98
98
|
humanCommentResolve: (commentId) => `${V}/human/comments/${commentId}/resolve`,
|
|
99
99
|
humanCommentReopen: (commentId) => `${V}/human/comments/${commentId}/reopen`,
|
|
100
100
|
humanCommentDelete: (commentId) => `${V}/human/comments/${commentId}/delete`,
|
|
101
|
-
//
|
|
101
|
+
// Humanloop inbox (Northlight crouter-inbox v1, inbox-contract.md §A)
|
|
102
102
|
humanInbox: () => `${V}/human/inbox`,
|
|
103
|
+
humanInboxTicket: (ticketId) => `${V}/human/inbox/${ticketId}`,
|
|
104
|
+
humanInboxRespond: (ticketId) => `${V}/human/inbox/${ticketId}/respond`,
|
|
105
|
+
humanInboxCancel: (ticketId) => `${V}/human/inbox/${ticketId}/cancel`,
|
|
103
106
|
// Profiles (server-side for P2 Core; CLI profile verbs stay fs-local)
|
|
104
107
|
profiles: () => `${V}/profiles`,
|
|
105
108
|
profile: (name) => `${V}/profiles/${name}`,
|
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.180",
|
|
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/index.js",
|