@north-light/sdk 0.3.900 → 0.3.902

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/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export type { CustomDeliveryStream, ReceiveOptions } from './resources/custom-ob
6
6
  export type { RunEvent, RunEventOf, RunEventType, UnknownRunEvent } from './resources/run-stream.js';
7
7
  export { RunReply } from './resources/run-reply.js';
8
8
  export type { RunReplyCollectOptions, RunReplyEnding, RunReplyEvent, RunReplyResult, SentRunMessage } from './resources/run-reply.js';
9
- export type { AppMachine, AppProfile, RunActivity, RunDeleteResult, RunImportParams, RunImportResult, RunObject, RunParsedOutcome, RunParseOptions, RunParseParams, RunRecap, RunStartParams, RunStartResult, StopHook, RunStatus, RunTrace } from './resources/runs.js';
9
+ export type { AppMachine, AppProfile, RunActivity, RunDeleteResult, RunImportParams, RunImportResult, OpenItem, RunObject, RunParsedOutcome, RunParseOptions, RunParseParams, RunRecap, RunStartParams, RunStartResult, RunSummary, StopHook, RunStatus, RunTrace } from './resources/runs.js';
10
10
  export type { FileLink } from './resources/files.js';
11
11
  export type { Upload, UploadCreateParams } from './resources/uploads.js';
12
12
  export type { AttachmentLink } from './resources/attachments.js';
@@ -119,6 +119,44 @@ export interface RunObject {
119
119
  branch: string;
120
120
  } | null;
121
121
  }
122
+ /** One chat in `runs.summaries`: the cheap list row. Activity, last report, usage, outcome and worktree stay on `runs.get`. */
123
+ export interface RunSummary {
124
+ run_id: string;
125
+ /** The runtime's generated title; null before it writes one. */
126
+ title: string | null;
127
+ status: RunStatus;
128
+ created_at: string;
129
+ last_activity_at: string | null;
130
+ /** Open decisions (not notices) of the run and its child agents; 0 when settled. */
131
+ pending_question_count: number;
132
+ /** Open display-only notices; 0 when settled. */
133
+ open_notice_count: number;
134
+ recap?: {
135
+ goal: string;
136
+ state: string;
137
+ };
138
+ }
139
+ /** One open question, notice or review in `runs.openItems`. `steps`, `slots`, `provider` and `tool` are `questions.get`'s values (decisions and notices); `document` is a review's document name. */
140
+ export interface OpenItem {
141
+ id: string;
142
+ kind: 'decision' | 'notice' | 'review';
143
+ /** The chat root, also for an item a child agent asked. */
144
+ run_id: string;
145
+ node_id: string;
146
+ created_at: string;
147
+ title: string;
148
+ subtitle?: string;
149
+ steps?: number;
150
+ slots?: Array<{
151
+ id?: string;
152
+ kind: string;
153
+ step: number;
154
+ config: Record<string, unknown>;
155
+ }>;
156
+ provider?: string;
157
+ tool?: string;
158
+ document?: string;
159
+ }
122
160
  /** `RunObject.recap`. */
123
161
  export interface RunRecap {
124
162
  goal: string;
@@ -208,6 +246,23 @@ export declare class Runs {
208
246
  runs: RunObject[];
209
247
  next: string | null;
210
248
  }>;
249
+ /** The caller's chats as cheap rows, newest activity first, one statement on the runtime. `limit` 1 to 1000 (default 1000); filter by status on the returned rows. */
250
+ summaries(filters?: {
251
+ after?: string;
252
+ limit?: number;
253
+ app?: string;
254
+ }, options?: RequestOptions): Promise<{
255
+ runs: RunSummary[];
256
+ next: string | null;
257
+ }>;
258
+ /** Open questions, notices and reviews of the caller's chats (child agents' included), oldest first; `run_id` limits to one chat. At most 500: `truncated` is true past that. */
259
+ openItems(filters?: {
260
+ run_id?: string;
261
+ app?: string;
262
+ }, options?: RequestOptions): Promise<{
263
+ items: OpenItem[];
264
+ truncated: boolean;
265
+ }>;
211
266
  /** Every run across pages, most recently active first: `for await (const run of runs.listAll())`. Fetches
212
267
  * the next page (`limit` per page) only as you iterate; `break` stops fetching. */
213
268
  listAll(filters?: {
@@ -29,6 +29,14 @@ export class Runs {
29
29
  list(filters = {}, options) {
30
30
  return this.request('GET', `/v1/runs${query(filters)}`, undefined, options);
31
31
  }
32
+ /** The caller's chats as cheap rows, newest activity first, one statement on the runtime. `limit` 1 to 1000 (default 1000); filter by status on the returned rows. */
33
+ summaries(filters = {}, options) {
34
+ return this.request('GET', `/v1/runs/summaries${query(filters)}`, undefined, options);
35
+ }
36
+ /** Open questions, notices and reviews of the caller's chats (child agents' included), oldest first; `run_id` limits to one chat. At most 500: `truncated` is true past that. */
37
+ openItems(filters = {}, options) {
38
+ return this.request('GET', `/v1/open-items${query(filters)}`, undefined, options);
39
+ }
32
40
  /** Every run across pages, most recently active first: `for await (const run of runs.listAll())`. Fetches
33
41
  * the next page (`limit` per page) only as you iterate; `break` stops fetching. */
34
42
  async *listAll(filters = {}, options) {
@@ -2,7 +2,7 @@
2
2
  name: northlight
3
3
  description: "Use when building, debugging or shipping an app that signs people in with Northlight, starts runs on their Northlight runtime, or calls Northlight providers (sms, search, integrations, context, device) with @north-light/sdk."
4
4
  metadata:
5
- sdk-version: "0.3.900"
5
+ sdk-version: "0.3.902"
6
6
  ---
7
7
 
8
8
  # Building a Northlight app
@@ -27,7 +27,7 @@ Never text a person first: Comms refuses a send to anyone who has not texted you
27
27
 
28
28
  ## First: check this skill matches the SDK
29
29
 
30
- This skill is for SDK version `0.3.900`. If the project has `node_modules/@north-light/sdk/package.json`, compare its `version` with that number. If they differ, run `npx @north-light/sdk skill` in the project, then read the rewritten `.agents/skills/northlight/SKILL.md` (or `.claude/skills/northlight/SKILL.md`) instead of this copy. It needs no account. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
30
+ This skill is for SDK version `0.3.902`. If the project has `node_modules/@north-light/sdk/package.json`, compare its `version` with that number. If they differ, run `npx @north-light/sdk skill` in the project, then read the rewritten `.agents/skills/northlight/SKILL.md` (or `.claude/skills/northlight/SKILL.md`) instead of this copy. It needs no account. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
31
31
 
32
32
  ## Where things run
33
33
 
@@ -7,7 +7,7 @@ import { type SpaceOp } from './space.js';
7
7
  import { type FakeRefusalCode, type FakeScope, type FakeUser, type Responder } from './users.js';
8
8
  import { type FakeError } from './wire.js';
9
9
  /** A runtime operation, named as the daemon's `OPERATIONS` table names it. */
10
- export type FakeOp = 'grant.get' | 'run.start' | 'run.list' | 'run.get' | 'run.message' | 'run.events' | 'run.interrupt' | 'run.cancel' | 'run.cancel_node' | 'run.job.kill' | 'run.delete' | 'run.rename' | 'question.get' | 'question.answer' | 'question.cancel' | 'question.history' | 'review.list' | 'review.get' | 'review.submit' | 'review.cancel' | 'discuss.ticket.get' | 'discuss.ticket.post' | 'discuss.review.get' | 'discuss.review.post' | 'trace.get' | 'memory.list' | 'memory.get' | 'provider.tools' | 'provider.call' | 'provider.machine' | 'profile.list' | 'exec' | SpaceOp;
10
+ export type FakeOp = 'grant.get' | 'run.start' | 'run.list' | 'run.summaries' | 'run.open_items' | 'run.get' | 'run.message' | 'run.events' | 'run.interrupt' | 'run.cancel' | 'run.cancel_node' | 'run.job.kill' | 'run.delete' | 'run.rename' | 'question.get' | 'question.answer' | 'question.cancel' | 'question.history' | 'review.list' | 'review.get' | 'review.submit' | 'review.cancel' | 'discuss.ticket.get' | 'discuss.ticket.post' | 'discuss.review.get' | 'discuss.review.post' | 'trace.get' | 'memory.list' | 'memory.get' | 'provider.tools' | 'provider.call' | 'provider.machine' | 'profile.list' | 'exec' | SpaceOp;
11
11
  /** A directory operation. */
12
12
  export type FakeDirectoryOp = 'directory.discovery' | 'directory.token' | 'directory.jwks';
13
13
  /** What `intercept` / `failNext` / `gate` match: a runtime operation, `'*'` (every runtime operation), or a directory operation. */
@@ -19,6 +19,8 @@ const ROUTES = [
19
19
  ['GET', /^\/v1\/grant$/, 'grant.get'],
20
20
  ['POST', /^\/v1\/runs$/, 'run.start'],
21
21
  ['GET', /^\/v1\/runs$/, 'run.list'],
22
+ ['GET', /^\/v1\/runs\/summaries$/, 'run.summaries'],
23
+ ['GET', /^\/v1\/open-items$/, 'run.open_items'],
22
24
  ['GET', /^\/v1\/runs\/([^/]+)$/, 'run.get'],
23
25
  ['DELETE', /^\/v1\/runs\/([^/]+)$/, 'run.delete'],
24
26
  ['POST', /^\/v1\/runs\/([^/]+)\/messages$/, 'run.message'],
@@ -754,6 +756,19 @@ export class FakeCloud {
754
756
  const last = page.at(-1);
755
757
  return { status: 200, body: { runs: page.map((run) => run.toObject()), next: rows.length > limit && last ? Buffer.from(JSON.stringify({ activity: last.lastActivityAt, id: last.id })).toString('base64url') : null } };
756
758
  }
759
+ case 'run.summaries': {
760
+ const limit = integerParam(query.get('limit'), 'limit', 1, 1000, 1000);
761
+ const rows = user.runs.filter((run) => !run.deleted)
762
+ .sort((a, b) => (a.lastActivityAt === b.lastActivityAt ? (a.id < b.id ? 1 : -1) : a.lastActivityAt < b.lastActivityAt ? 1 : -1));
763
+ const page = rows.slice(0, limit);
764
+ const last = page.at(-1);
765
+ return { status: 200, body: { runs: page.map((run) => run.toSummary()), next: rows.length > limit && last ? Buffer.from(JSON.stringify({ activity: last.lastActivityAt, id: last.id })).toString('base64url') : null } };
766
+ }
767
+ case 'run.open_items': {
768
+ const runId = query.get('run_id');
769
+ const items = user.runs.filter((run) => !run.deleted && (runId === null || run.id === runId)).flatMap((run) => run.openItems());
770
+ return { status: 200, body: { items: items.slice(0, 500), truncated: items.length > 500 } };
771
+ }
757
772
  case 'run.get': {
758
773
  const wait = waitSeconds(query);
759
774
  const run = this.ownedRun(user, id);
@@ -123,6 +123,10 @@ export declare class FakeRun {
123
123
  get status(): RunStatusDTO;
124
124
  /** What the root is doing, derived from the event log as `runActivity` derives it with no open streaming block. */
125
125
  get activity(): RunActivityDTO | null;
126
+ /** A `runs.summaries` row. */
127
+ toSummary(): Record<string, unknown>;
128
+ /** The open questions and notices of this run as `runs.openItems` items. */
129
+ openItems(): Record<string, unknown>[];
126
130
  /** `run.get`'s body. */
127
131
  toObject(): Record<string, unknown>;
128
132
  /** Append any run event; `nodeId` defaults to the root (another id is a child node's event). */
@@ -108,6 +108,22 @@ export class FakeRun {
108
108
  }
109
109
  return { phase: 'thinking' };
110
110
  }
111
+ /** A `runs.summaries` row. */
112
+ toSummary() {
113
+ const status = this.status;
114
+ const settled = status === 'settled';
115
+ return { run_id: this.id, title: null, status, created_at: this.createdAt, last_activity_at: this.lastActivityAt,
116
+ pending_question_count: settled ? 0 : this.pendingQuestionIds.length, open_notice_count: settled ? 0 : this.openNoticeIds.length };
117
+ }
118
+ /** The open questions and notices of this run as `runs.openItems` items. */
119
+ openItems() {
120
+ if (this.status === 'settled')
121
+ return [];
122
+ return [...this.pendingQuestionIds, ...this.openNoticeIds].map((id) => {
123
+ const q = this.questions.get(id);
124
+ return { id, kind: q.kind, run_id: this.id, node_id: this.id, created_at: this.createdAt, title: q.title, ...(q.subtitle === undefined ? {} : { subtitle: q.subtitle }), steps: q.steps, slots: q.slots };
125
+ });
126
+ }
111
127
  /** `run.get`'s body. */
112
128
  toObject() {
113
129
  const status = this.status;
package/dist/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
2
- export declare const SDK_VERSION = "0.3.900";
2
+ export declare const SDK_VERSION = "0.3.902";
3
3
  /** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
4
4
  * contract level existed (which only knows this header) refuses this SDK, while every later runtime accepts it. */
5
5
  export declare const LEGACY_FLOOR = "0.3.423";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // SDK_VERSION is written by scripts/release-version.mjs on every release; do not edit by hand.
2
2
  /** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
3
- export const SDK_VERSION = '0.3.900';
3
+ export const SDK_VERSION = '0.3.902';
4
4
  // LEGACY_FLOOR is written once by `scripts/contract.mjs release`, at the first release that carries the contract level
5
5
  // (the `0.0.0` placeholder is replaced there and never again); do not edit by hand.
6
6
  /** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@north-light/sdk",
3
- "version": "0.3.900",
4
- "crouterContract": "1.119",
3
+ "version": "0.3.902",
4
+ "crouterContract": "1.120",
5
5
  "description": "Typed Node and browser client for running crouter agents through the crtrd /v1 API.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -50,9 +50,9 @@
50
50
  "prepublishOnly": "node -e \"if (process.env.npm_config_tag !== 'next') { console.error('@north-light/sdk publishes only with --tag next; scripts/promote-sdk.mjs is the only mover of latest.'); process.exit(1); }\""
51
51
  },
52
52
  "dependencies": {
53
- "@north-light/api": "0.3.900",
54
- "@north-light/identity": "0.3.900",
55
- "@north-light/plugin": "0.3.900",
53
+ "@north-light/api": "0.3.902",
54
+ "@north-light/identity": "0.3.902",
55
+ "@north-light/plugin": "0.3.902",
56
56
  "jose": "^6.2.1"
57
57
  },
58
58
  "peerDependencies": {