@north-light/crouter-api 0.3.213 → 0.3.215
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/dto/inbox.d.ts
CHANGED
|
@@ -17,6 +17,21 @@ export interface ReviewTicketSummaryDTO {
|
|
|
17
17
|
blocked_since: IsoTime;
|
|
18
18
|
source: TicketSourceDTO;
|
|
19
19
|
}
|
|
20
|
+
/** One question's recommended option, flat on the wire like every other summary field. */
|
|
21
|
+
export interface RecommendedOptionDTO {
|
|
22
|
+
slot_id: string;
|
|
23
|
+
option_id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What one keypress on an inbox row publishes. `responses` is a complete final response
|
|
28
|
+
* map this daemon already accepts for the ticket, so a client publishes it untouched
|
|
29
|
+
* rather than assembling one from the summary.
|
|
30
|
+
*/
|
|
31
|
+
export interface PageFastActionDTO {
|
|
32
|
+
kind: 'answer' | 'acknowledge';
|
|
33
|
+
responses: PageResponsesDTO;
|
|
34
|
+
}
|
|
20
35
|
export interface PageTicketSummaryDTO {
|
|
21
36
|
ticket_id: InboxTicketIdDTO;
|
|
22
37
|
kind: 'page';
|
|
@@ -30,6 +45,10 @@ export interface PageTicketSummaryDTO {
|
|
|
30
45
|
source: TicketSourceDTO;
|
|
31
46
|
slot_kinds: string[];
|
|
32
47
|
awaits_response: boolean;
|
|
48
|
+
/** Omitted when no question recommends an option. */
|
|
49
|
+
recommended_options?: RecommendedOptionDTO[];
|
|
50
|
+
/** Present only on a pending ticket that a row can settle without opening it. */
|
|
51
|
+
fast_action?: PageFastActionDTO;
|
|
33
52
|
state: 'pending' | 'resolved' | 'canceled' | 'passive';
|
|
34
53
|
/** Present only on resolved history entries; the stored one-line answer digest. */
|
|
35
54
|
answer_digest?: string;
|
package/dist/api/dto/nodes.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export interface NodeSubjectDTO {
|
|
|
17
17
|
}
|
|
18
18
|
/** `POST /v1/nodes` body. Carries the full immediate spawn recipe. */
|
|
19
19
|
export interface CreateNodeRequest {
|
|
20
|
-
kind
|
|
20
|
+
/** Persona kind. Omit to resolve the selected profile's `default_kind`, then `general`. */
|
|
21
|
+
kind?: string;
|
|
21
22
|
prompt?: string;
|
|
22
23
|
profile?: string;
|
|
23
24
|
mode?: ModeDTO;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
/** `PUT /v1/profiles/{name}` body — idempotent ensure.
|
|
1
|
+
/** `PUT /v1/profiles/{name}` body — idempotent ensure. Every field applies
|
|
2
|
+
* only at create; an existing same-named profile is returned untouched. */
|
|
2
3
|
export interface EnsureProfileRequest {
|
|
3
4
|
/** Absolute project directories in the profile's purview. */
|
|
4
5
|
projects?: string[];
|
|
6
|
+
/** Persona kind for node creates under the profile that omit kind. */
|
|
7
|
+
default_kind?: string;
|
|
8
|
+
/** Profile facts (identity, role); each entry reaches every broker
|
|
9
|
+
* launched under the profile as `CRTR_PROFILE_META_<KEY>` env. */
|
|
10
|
+
metadata?: Record<string, string>;
|
|
5
11
|
}
|
|
6
12
|
/** `DELETE /v1/profiles/{name}` body. Destructive deletion is never implicit. */
|
|
7
13
|
export interface DeleteProfileRequest {
|
|
@@ -35,6 +41,12 @@ export interface ProfileDTO {
|
|
|
35
41
|
/** Where nodes under this profile run — one of `projects` (the first unless
|
|
36
42
|
* re-pointed), or null when the profile owns none. */
|
|
37
43
|
home: string | null;
|
|
44
|
+
/** ISO timestamp when the profile was paused, or null while active. */
|
|
45
|
+
paused_at: string | null;
|
|
46
|
+
/** Default node kind when a create omits kind; `general` when absent on the manifest. */
|
|
47
|
+
default_kind: string;
|
|
48
|
+
/** Stored profile facts; empty when the manifest carries none. */
|
|
49
|
+
metadata: Record<string, string>;
|
|
38
50
|
/** The directory this profile is pinned as default for, if any. */
|
|
39
51
|
default_dir?: string | null;
|
|
40
52
|
}
|
|
@@ -33,7 +33,6 @@ export interface CardEntry {
|
|
|
33
33
|
}
|
|
34
34
|
export interface CardSender {
|
|
35
35
|
id: string;
|
|
36
|
-
name?: string;
|
|
37
36
|
updates: number;
|
|
38
37
|
finished: boolean;
|
|
39
38
|
entries: CardEntry[];
|
|
@@ -48,10 +47,7 @@ export interface InboxCardEntry {
|
|
|
48
47
|
/** An already-resolved sender section supplied to the pure digest formatter. */
|
|
49
48
|
export interface InboxCardSection {
|
|
50
49
|
id: string;
|
|
51
|
-
name?: string;
|
|
52
50
|
entries: readonly InboxCardEntry[];
|
|
53
|
-
updates?: number;
|
|
54
|
-
finished?: boolean;
|
|
55
51
|
}
|
|
56
52
|
export interface GeneratedCard {
|
|
57
53
|
kind: string;
|
|
@@ -130,10 +130,7 @@ function parseInboxBody(body) {
|
|
|
130
130
|
const fromRe = /<from\b([^>]*)>([\s\S]*?)<\/from>/g;
|
|
131
131
|
for (const fromMatch of body.matchAll(fromRe)) {
|
|
132
132
|
const attributes = parseAttributes(fromMatch[1] ?? '');
|
|
133
|
-
if (attributes?.id === undefined
|
|
134
|
-
continue;
|
|
135
|
-
const updates = Number(attributes.updates);
|
|
136
|
-
if (!Number.isFinite(updates))
|
|
133
|
+
if (attributes?.id === undefined)
|
|
137
134
|
continue;
|
|
138
135
|
const entries = [];
|
|
139
136
|
const entryBody = fromMatch[2] ?? '';
|
|
@@ -152,10 +149,12 @@ function parseInboxBody(body) {
|
|
|
152
149
|
...(entryAttributes.ref === undefined ? {} : { ref: entryAttributes.ref }),
|
|
153
150
|
});
|
|
154
151
|
}
|
|
152
|
+
// `updates` and `finished` are derived from the entry list; pre-cut
|
|
153
|
+
// scrollback still carries them as attributes, honored when present.
|
|
154
|
+
const legacyUpdates = attributes.updates === undefined ? Number.NaN : Number(attributes.updates);
|
|
155
155
|
senders.push({
|
|
156
156
|
id: attributes.id,
|
|
157
|
-
|
|
158
|
-
updates,
|
|
157
|
+
updates: Number.isFinite(legacyUpdates) ? legacyUpdates : entries.length,
|
|
159
158
|
finished: attributes.finished === 'true' || entries.some((entry) => entry.kind === 'final'),
|
|
160
159
|
entries,
|
|
161
160
|
});
|
|
@@ -203,15 +202,13 @@ export function parseCard(message) {
|
|
|
203
202
|
/** Format a complete inbox card from report bodies resolved by the caller. */
|
|
204
203
|
export function formatInboxCard(sections) {
|
|
205
204
|
const body = sections.map((section) => {
|
|
206
|
-
const updates = section.updates ?? section.entries.length;
|
|
207
|
-
const finished = section.finished ?? section.entries.some((entry) => entry.kind === 'final');
|
|
208
205
|
const entries = section.entries.map((entry) => {
|
|
209
206
|
const disposition = entry.disposition === 'human-answer' || entry.disposition === 'human-canceled'
|
|
210
207
|
? entry.disposition
|
|
211
208
|
: undefined;
|
|
212
209
|
return `<entry${formatAttributes({ kind: entry.kind, ref: entry.ref, disposition })}>${escapeXmlText(entry.body)}</entry>`;
|
|
213
210
|
}).join('\n');
|
|
214
|
-
return `<from${formatAttributes({ id: section.id
|
|
211
|
+
return `<from${formatAttributes({ id: section.id })}>${entries}</from>`;
|
|
215
212
|
}).join('\n');
|
|
216
213
|
return formatCard('inbox', {}, body);
|
|
217
214
|
}
|
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.215",
|
|
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",
|