@north-light/crouter-api 0.3.219 → 0.3.221

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.
@@ -12,6 +12,7 @@ import type { AttachEnsureRequest, AttachEnsureResultDTO } from './dto/attach.js
12
12
  import type { DeleteProfileRequest, DeleteProfileResultDTO, EnsureProfileRequest, ProfileDTO } from './dto/profiles.js';
13
13
  import type { FilePeekDTO } from './dto/files.js';
14
14
  import type { MemoryDocRefDTO } from './dto/memory.js';
15
+ import type { ChatInventoryDTO } from './dto/chat-inventory.js';
15
16
  import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, ModelAuthListDTO } from './dto/modelauth.js';
16
17
  import type { CreateHumanBridgeRequest, HumanBridgeResultDTO, HumanCancelRequest, HumanCancelResultDTO, HumanResolveRequest, HumanResolveResultDTO } from './dto/human.js';
17
18
  import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
@@ -151,6 +152,11 @@ export declare class CrtrClient {
151
152
  /** The node's conversation exactly as it ran — raw `.jsonl` bytes plus the
152
153
  * assembled system prompt. For exports; `getSnapshot` is for renderers. */
153
154
  getSession(id: string): Promise<NodeSessionDTO>;
155
+ /** What a non-terminal chat surface may offer for this node: the chat-capable
156
+ * slash commands its live engine registered, and the memory documents an
157
+ * inline `/name` token resolves to. Never revives — a node whose broker is
158
+ * not live answers `broker_live: false` with empty arrays. */
159
+ getChatInventory(id: string): Promise<ChatInventoryDTO>;
154
160
  getArtifacts(id: string, q?: ArtifactsQuery): Promise<ArtifactListDTO>;
155
161
  getContext(id: string): Promise<ContextListDTO>;
156
162
  /** Read an absolute host path as UTF-8 (capped, `truncated` when clipped) for
@@ -160,6 +166,9 @@ export declare class CrtrClient {
160
166
  * node would read — the node's own precedence chain, not this process's.
161
167
  * Pair with `peekFile` to render the document. */
162
168
  resolveMemoryDoc(name: string, nodeId: string): Promise<MemoryDocRefDTO>;
169
+ /** Create-or-return by name. Supplied `projects` are shape-checked even when
170
+ * the profile already exists; their directories are only required to exist
171
+ * when this call creates the profile. */
163
172
  ensureProfile(name: string, req?: EnsureProfileRequest): Promise<ProfileDTO>;
164
173
  listProfiles(): Promise<ProfileDTO[]>;
165
174
  getProfile(name: string): Promise<ProfileDTO>;
@@ -267,6 +267,13 @@ export class CrtrClient {
267
267
  getSession(id) {
268
268
  return this.request('GET', routes.nodeSession(this.nodePath(id)));
269
269
  }
270
+ /** What a non-terminal chat surface may offer for this node: the chat-capable
271
+ * slash commands its live engine registered, and the memory documents an
272
+ * inline `/name` token resolves to. Never revives — a node whose broker is
273
+ * not live answers `broker_live: false` with empty arrays. */
274
+ getChatInventory(id) {
275
+ return this.request('GET', routes.nodeChatInventory(this.nodePath(id)));
276
+ }
270
277
  getArtifacts(id, q) {
271
278
  return this.request('GET', withQuery(routes.nodeArtifacts(this.nodePath(id)), q));
272
279
  }
@@ -287,6 +294,9 @@ export class CrtrClient {
287
294
  return this.request('GET', withQuery(routes.memoryResolve(), { name, node: nodeId }));
288
295
  }
289
296
  // ---- Profiles ----------------------------------------------------------
297
+ /** Create-or-return by name. Supplied `projects` are shape-checked even when
298
+ * the profile already exists; their directories are only required to exist
299
+ * when this call creates the profile. */
290
300
  ensureProfile(name, req) {
291
301
  return this.request('PUT', routes.profile(name), req ?? {});
292
302
  }
@@ -0,0 +1,43 @@
1
+ /** One command a chat surface may advertise. Builtin and non-opted-in rows are
2
+ * dropped before this DTO exists, so `source` never carries `'builtin'`. */
3
+ export interface ChatInventoryCommandDTO {
4
+ /** No leading slash, exactly as the engine dispatches it. */
5
+ name: string;
6
+ description: string;
7
+ source: 'command' | 'template';
8
+ /** Argument shape to display beside the name, when the command supplies one. */
9
+ argument_hint?: string;
10
+ /** Deterministic expansion metadata for a memory-slash command — the same
11
+ * material the terminal preview uses, so a chat preview cannot drift from
12
+ * what submission sends. */
13
+ expansion?: {
14
+ kind: 'memory-slash';
15
+ commandName: string;
16
+ body: string;
17
+ };
18
+ /** Raw prompt-template content (frontmatter stripped), for `source: 'template'`. */
19
+ template?: string;
20
+ }
21
+ /** One resolvable inline memory reference. Metadata only — never the document
22
+ * body or its source path. `shortForm` stays camelCase to mirror the broker's
23
+ * own `RefMeta`, which is where these rows come from. */
24
+ export interface ChatInventoryMemoryRefDTO {
25
+ /** Canonical `/`-joined name, e.g. `taste/writing`. */
26
+ name: string;
27
+ kind: 'knowledge' | 'preference';
28
+ scope: 'node' | 'project' | 'profile' | 'user' | 'builtin';
29
+ shortForm: string;
30
+ }
31
+ /** `GET /v1/nodes/{id}/chat-inventory` result.
32
+ *
33
+ * `broker_live` reports whether the node's engine was reachable at all. There
34
+ * is no per-part error flag: a part that failed and a part that is genuinely
35
+ * empty both arrive as an empty array, and a client's behavior is identical
36
+ * for both. A dormant node answers 200 with `broker_live: false` — this read
37
+ * never revives an engine. */
38
+ export interface ChatInventoryDTO {
39
+ node_id: string;
40
+ broker_live: boolean;
41
+ commands: ChatInventoryCommandDTO[];
42
+ memory_refs: ChatInventoryMemoryRefDTO[];
43
+ }
@@ -0,0 +1,11 @@
1
+ // Chat-inventory DTO. Backs `GET /v1/nodes/{id}/chat-inventory` — the one read
2
+ // a non-terminal chat surface makes to learn what the node's live engine will
3
+ // accept: the slash commands that can complete their outcome from a chat
4
+ // conversation, and the memory documents an inline `/name` token resolves to.
5
+ //
6
+ // Eligibility is decided in crouter and disclosed here. A client never filters
7
+ // by name, infers capability, or invents a row: what is absent from these
8
+ // arrays is not offered.
9
+ //
10
+ // PURITY (spec §3.1): Node built-ins + `src/api/*` only.
11
+ export {};
@@ -1,8 +1,22 @@
1
+ /** The disclosure ladder, lowest to highest. Index order is the ordering. */
2
+ export declare const PROFILE_PROJECT_MEMORY_VALUES: readonly ["none", "name", "preview", "content"];
3
+ /** How much of a project's memory stores the profile relationship lets an
4
+ * automatic delivery disclose. */
5
+ export type ProfileProjectMemory = (typeof PROFILE_PROJECT_MEMORY_VALUES)[number];
6
+ /** One project directory in a profile's purview. */
7
+ export interface ProfileProject {
8
+ /** Absolute, real-path-resolved directory. */
9
+ path: string;
10
+ /** Maximum rung automatic boot and workspace-open delivery may reach from
11
+ * this project's memory stores, regardless of the node's working directory.
12
+ * An authored lower rung stays lower; targeted reads are never capped. */
13
+ memory: ProfileProjectMemory;
14
+ }
1
15
  /** `PUT /v1/profiles/{name}` body — idempotent ensure. Every field applies
2
16
  * only at create; an existing same-named profile is returned untouched. */
3
17
  export interface EnsureProfileRequest {
4
- /** Absolute project directories in the profile's purview. */
5
- projects?: string[];
18
+ /** Project directories in the profile's purview, each with its memory cap. */
19
+ projects?: ProfileProject[];
6
20
  /** Persona kind for node creates under the profile that omit kind. */
7
21
  default_kind?: string;
8
22
  /** Profile facts (identity, role); each entry reaches every broker
@@ -37,9 +51,9 @@ export interface ProfileDTO {
37
51
  /** Stable profile-directory id (`<slug>-<id>`). */
38
52
  id: string;
39
53
  name: string;
40
- projects: string[];
41
- /** Where nodes under this profile run — one of `projects` (the first unless
42
- * re-pointed), or null when the profile owns none. */
54
+ projects: ProfileProject[];
55
+ /** Where nodes under this profile run — one of `projects[].path` (the first
56
+ * unless re-pointed), or null when the profile owns none. */
43
57
  home: string | null;
44
58
  /** ISO timestamp when the profile was paused, or null while active. */
45
59
  paused_at: string | null;
@@ -1,3 +1,4 @@
1
1
  // Profile DTOs (spec §6.6). Profile deletion crosses profile, canvas, cron,
2
2
  // inbox, and review state, so every consumer routes it through crtrd.
3
- export {};
3
+ /** The disclosure ladder, lowest to highest. Index order is the ordering. */
4
+ export const PROFILE_PROJECT_MEMORY_VALUES = ['none', 'name', 'preview', 'content'];
@@ -27,3 +27,4 @@ export * from './dto/memory.js';
27
27
  export * from './dto/inbox.js';
28
28
  export * from './dto/reviews.js';
29
29
  export * from './dto/review-comments.js';
30
+ export * from './dto/chat-inventory.js';
package/dist/api/index.js CHANGED
@@ -28,3 +28,4 @@ export * from './dto/memory.js';
28
28
  export * from './dto/inbox.js';
29
29
  export * from './dto/reviews.js';
30
30
  export * from './dto/review-comments.js';
31
+ export * from './dto/chat-inventory.js';
@@ -11,6 +11,7 @@ export declare const routes: {
11
11
  readonly nodeSnapshot: (id: string) => string;
12
12
  readonly nodeSubject: (id: string) => string;
13
13
  readonly nodeSession: (id: string) => string;
14
+ readonly nodeChatInventory: (id: string) => string;
14
15
  readonly nodeTranscript: (id: string) => string;
15
16
  readonly nodeContext: (id: string) => string;
16
17
  readonly nodeArtifacts: (id: string) => string;
@@ -27,6 +27,7 @@ export const routes = {
27
27
  nodeSnapshot: (id) => `${V}/nodes/${id}/snapshot`,
28
28
  nodeSubject: (id) => `${V}/nodes/${id}/subject`,
29
29
  nodeSession: (id) => `${V}/nodes/${id}/session`,
30
+ nodeChatInventory: (id) => `${V}/nodes/${id}/chat-inventory`,
30
31
  nodeTranscript: (id) => `${V}/nodes/${id}/transcript`,
31
32
  nodeContext: (id) => `${V}/nodes/${id}/context`,
32
33
  nodeArtifacts: (id) => `${V}/nodes/${id}/artifacts`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter-api",
3
- "version": "0.3.219",
3
+ "version": "0.3.221",
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",