@north-light/sdk 0.3.851 → 0.3.853

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 CHANGED
@@ -12,6 +12,7 @@ import { Attachments } from './resources/attachments.js';
12
12
  import { Files } from './resources/files.js';
13
13
  import { Models } from './resources/models.js';
14
14
  import { Questions } from './resources/questions.js';
15
+ import { Reviews } from './resources/reviews.js';
15
16
  import { Providers } from './resources/providers.js';
16
17
  import { Runs } from './resources/runs.js';
17
18
  import { Shares } from './resources/shares.js';
@@ -88,6 +89,8 @@ export declare class Crouter {
88
89
  readonly shares: Shares;
89
90
  /** Questions agents in runs ask the user (app listener only). */
90
91
  readonly questions: Questions;
92
+ /** Reviews of documents agents in runs asked the person to review (app listener only). */
93
+ readonly reviews: Reviews;
91
94
  /** Read the documents the person owns (`store: 'user'`): an app sees their `public` documents, `private` ones too while the grant holds
92
95
  * `crtr:memory:read_private:user` (read-only), and `crtr:memory:manage:user` covers both. */
93
96
  readonly memory: Memory;
package/dist/client.js CHANGED
@@ -13,6 +13,7 @@ import { Attachments } from './resources/attachments.js';
13
13
  import { Files } from './resources/files.js';
14
14
  import { Models } from './resources/models.js';
15
15
  import { Questions } from './resources/questions.js';
16
+ import { Reviews } from './resources/reviews.js';
16
17
  import { Providers } from './resources/providers.js';
17
18
  import { CAUSED_BY_HEADER, Runs } from './resources/runs.js';
18
19
  import { Shares } from './resources/shares.js';
@@ -48,6 +49,8 @@ export class Crouter {
48
49
  shares;
49
50
  /** Questions agents in runs ask the user (app listener only). */
50
51
  questions;
52
+ /** Reviews of documents agents in runs asked the person to review (app listener only). */
53
+ reviews;
51
54
  /** Read the documents the person owns (`store: 'user'`): an app sees their `public` documents, `private` ones too while the grant holds
52
55
  * `crtr:memory:read_private:user` (read-only), and `crtr:memory:manage:user` covers both. */
53
56
  memory;
@@ -169,6 +172,7 @@ export class Crouter {
169
172
  this.attachments = new Attachments(request);
170
173
  this.shares = new Shares(request);
171
174
  this.questions = new Questions(request);
175
+ this.reviews = new Reviews(request);
172
176
  this.memory = new Memory(request);
173
177
  this.docs = new Docs(request);
174
178
  this.crons = new Crons(request);
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export type { Environments } from './resources/environments.js';
19
19
  export type { SpendLimits } from './resources/spend-limits.js';
20
20
  export type { MemoryDocument, MemoryGetParams, MemoryListItem, MemoryListPage, MemoryListParams } from './resources/memory.js';
21
21
  export type { Question, QuestionAnswered, QuestionCanceled, QuestionFields, QuestionKind, QuestionResponses, QuestionSlot, QuestionStatus } from './resources/questions.js';
22
+ export type { ReviewListQuery } from './resources/reviews.js';
22
23
  export type { ProviderToolEntry } from './resources/providers.js';
23
24
  export { OAuth2Client, ConnectedCrouter, MemoryConnectionStore, profileFromClaims } from './oauth/index.js';
24
25
  export { authorizationRefusalOf, refusalOf } from './oauth/index.js';
@@ -67,4 +67,11 @@ export declare class Providers {
67
67
  name: string;
68
68
  chosen_by: 'named' | 'account' | 'only_device' | 'newest';
69
69
  }>;
70
+ /** For a provider's own app, while serving a request: which of its own broker runs is sending that live request. `jti` is the `jti` of the bearer token the request carries. A request that is not live, or not from a run of this app, is `not_found`. */
71
+ caller(provider: string, requestId: string, jti: string, options?: RequestOptions): Promise<{
72
+ run_id: string;
73
+ node_id: string;
74
+ sub: string;
75
+ tool: string;
76
+ }>;
70
77
  }
@@ -24,4 +24,8 @@ export class Providers {
24
24
  machine(input, options) {
25
25
  return this.request('POST', '/v1/provider/machine', input, options);
26
26
  }
27
+ /** For a provider's own app, while serving a request: which of its own broker runs is sending that live request. `jti` is the `jti` of the bearer token the request carries. A request that is not live, or not from a run of this app, is `not_found`. */
28
+ caller(provider, requestId, jti, options) {
29
+ return this.request('GET', `/v1/providers/${pathSegment(provider, 'provider')}/calls/${pathSegment(requestId, 'request_id')}?jti=${encodeURIComponent(jti)}`, undefined, options);
30
+ }
27
31
  }
@@ -0,0 +1,25 @@
1
+ import type { ReviewCancelResultDTO, ReviewDTO, ReviewDocumentBaseDTO, ReviewListDTO, ReviewStateDTO, ReviewSubmitResultDTO } from '@north-light/api';
2
+ import type { RequestOptions } from '../types.js';
3
+ import { type Request } from './request.js';
4
+ export type { ReviewCancelResultDTO, ReviewDTO, ReviewDocumentBaseDTO, ReviewListDTO, ReviewStateDTO, ReviewSubmitResultDTO };
5
+ /** Filters for `reviews.list`. `run_id` keeps the reviews whose asking node belongs to that run. */
6
+ export interface ReviewListQuery {
7
+ state?: ReviewStateDTO;
8
+ run_id?: string;
9
+ origin_node_id?: string;
10
+ file?: string;
11
+ }
12
+ /** Reviews of documents that agents in the caller's runs asked the person to review (app listener only).
13
+ * A review whose run the caller may not read is `not_found`; one of another app's run is `other_app_run` when acting. */
14
+ export declare class Reviews {
15
+ private readonly request;
16
+ constructor(request: Request);
17
+ list(query?: ReviewListQuery, options?: RequestOptions): Promise<ReviewListDTO>;
18
+ get(reviewId: string, options?: RequestOptions): Promise<ReviewDTO>;
19
+ /** The text the review's comments are anchored to. */
20
+ document(reviewId: string, options?: RequestOptions): Promise<ReviewDocumentBaseDTO>;
21
+ submit(reviewId: string, options?: RequestOptions): Promise<ReviewSubmitResultDTO>;
22
+ cancel(reviewId: string, body?: {
23
+ reason?: string;
24
+ }, options?: RequestOptions): Promise<ReviewCancelResultDTO>;
25
+ }
@@ -0,0 +1,29 @@
1
+ import { pathSegment } from './identifiers.js';
2
+ import { withQuery } from './request.js';
3
+ /** Reviews of documents that agents in the caller's runs asked the person to review (app listener only).
4
+ * A review whose run the caller may not read is `not_found`; one of another app's run is `other_app_run` when acting. */
5
+ export class Reviews {
6
+ request;
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ list(query, options) {
11
+ return this.request('GET', withQuery('/v1/human/reviews', query), undefined, options);
12
+ }
13
+ get(reviewId, options) {
14
+ return this.request('GET', reviewPath(reviewId), undefined, options);
15
+ }
16
+ /** The text the review's comments are anchored to. */
17
+ document(reviewId, options) {
18
+ return this.request('GET', `${reviewPath(reviewId)}/document`, undefined, options);
19
+ }
20
+ submit(reviewId, options = {}) {
21
+ return this.request('POST', `${reviewPath(reviewId)}/submit`, {}, { ...options, maxRetries: 0 });
22
+ }
23
+ cancel(reviewId, body = {}, options = {}) {
24
+ return this.request('POST', `${reviewPath(reviewId)}/cancel`, body, { ...options, maxRetries: 0 });
25
+ }
26
+ }
27
+ function reviewPath(id) {
28
+ return `/v1/human/reviews/${encodeURIComponent(pathSegment(id, 'review id'))}`;
29
+ }
@@ -11,6 +11,8 @@ export interface RunStartParams {
11
11
  metadata?: Record<string, unknown>;
12
12
  /** Launch every node without network or the app's files mount. Descendants cannot disable it. */
13
13
  isolated?: boolean;
14
+ /** Fix the run to the person whose verified call starts it: no other principal is acted for, and no node is born from or of the run. Needs an explicit `scopes` list without `crtr:schedule`. Refusals are `subject_fixed`. */
15
+ fixed_subject?: boolean;
14
16
  /** Profile id (`profile_id` from `profiles.list()`) the run's agent uses; absent uses the app's default profile. */
15
17
  profile?: string;
16
18
  /** The model the run's root agent runs on: a bare strength (`medium`, resolved against the default provider), `family/strength` (`anthropic/medium`), or a concrete registered model id. Absent uses the run kind's default. Applies to the root only; its child nodes choose their own. An unknown or unregistered value is refused (`invalid_request`, `param: model`). */
@@ -45,6 +47,8 @@ export interface RunStartResult {
45
47
  created_at: string;
46
48
  metadata: Record<string, unknown>;
47
49
  sequence_number: number;
50
+ /** Whether the run was started with `fixed_subject`. */
51
+ fixed_subject: boolean;
48
52
  /** Present when `RunStartParams.message` was sent: pass it to `runs.reply(run.run_id, run.message)`. */
49
53
  message?: SentRunMessage;
50
54
  }
@@ -80,6 +84,8 @@ export interface RunObject {
80
84
  scopes: string[] | null;
81
85
  metadata: Record<string, unknown>;
82
86
  created_at: string;
87
+ /** Whether the run was started with `fixed_subject`. */
88
+ fixed_subject: boolean;
83
89
  settled_at?: string;
84
90
  latest_sequence: number;
85
91
  last_activity_at: string;
@@ -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.851"
5
+ sdk-version: "0.3.853"
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.851`. 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.853`. 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.delete' | 'run.rename' | 'question.get' | 'question.answer' | 'question.cancel' | '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.get' | 'run.message' | 'run.events' | 'run.interrupt' | 'run.cancel' | 'run.delete' | 'run.rename' | 'question.get' | 'question.answer' | 'question.cancel' | 'review.list' | 'review.get' | 'review.submit' | 'review.cancel' | '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. */
@@ -30,6 +30,10 @@ const ROUTES = [
30
30
  ['GET', /^\/v1\/questions\/([^/]+)$/, 'question.get'],
31
31
  ['POST', /^\/v1\/questions\/([^/]+)\/answer$/, 'question.answer'],
32
32
  ['POST', /^\/v1\/questions\/([^/]+)\/cancel$/, 'question.cancel'],
33
+ ['GET', /^\/v1\/human\/reviews$/, 'review.list'],
34
+ ['GET', /^\/v1\/human\/reviews\/([^/]+)$/, 'review.get'],
35
+ ['POST', /^\/v1\/human\/reviews\/([^/]+)\/submit$/, 'review.submit'],
36
+ ['POST', /^\/v1\/human\/reviews\/([^/]+)\/cancel$/, 'review.cancel'],
33
37
  ['GET', /^\/v1\/memory$/, 'memory.list'],
34
38
  ['GET', /^\/v1\/memory\/document$/, 'memory.get'],
35
39
  ['GET', /^\/v1\/providers\/tools$/, 'provider.tools'],
@@ -829,6 +833,10 @@ export class FakeCloud {
829
833
  end--;
830
834
  return { status: 200, body: { ...memoryItem(doc), body: full.subarray(0, end).toString('utf8'), size: full.length, truncated: end < full.length } };
831
835
  }
836
+ case 'review.list': return { status: 200, body: { reviews: [] } };
837
+ case 'review.get':
838
+ case 'review.submit':
839
+ case 'review.cancel': throw refuse(404, 'not_found', 'review not found');
832
840
  case 'provider.tools': return this.providerTools(user, id);
833
841
  case 'provider.call': return this.providerCall(user, body, signal);
834
842
  case 'provider.machine': return this.providerMachine(user, body);
@@ -951,7 +959,7 @@ export class FakeCloud {
951
959
  const accepted = message === undefined ? undefined : run.accept(message, false, key);
952
960
  const response = {
953
961
  run_id: run.id, node_id: run.id, grantee: this.host.grantee, grant: user.grantId, rev: user.rev, scopes, payer: 'user',
954
- status: 'running', created_at: run.createdAt, metadata, sequence_number: 0,
962
+ status: 'running', created_at: run.createdAt, metadata, sequence_number: 0, fixed_subject: false,
955
963
  ...(accepted ? { message: { run_id: run.id, message_id: accepted.message_id, sequence_number: accepted.sequence_number } } : {}),
956
964
  };
957
965
  if (key !== null)
@@ -119,7 +119,7 @@ export class FakeRun {
119
119
  pending_question_ids: status === 'settled' ? [] : this.pendingQuestionIds,
120
120
  open_notice_ids: status === 'settled' ? [] : this.openNoticeIds,
121
121
  ...(this.turnError ? { last_turn_error: this.turnError } : {}),
122
- usage: usage(), payer: 'user', scopes: this.scopes, metadata: this.metadata, created_at: this.createdAt,
122
+ usage: usage(), payer: 'user', scopes: this.scopes, metadata: this.metadata, created_at: this.createdAt, fixed_subject: false,
123
123
  ...(this.settledAt ? { settled_at: this.settledAt } : {}),
124
124
  latest_sequence: this.sequence, last_activity_at: this.lastActivityAt, activity: this.activity, worktree: null,
125
125
  };
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.851";
2
+ export declare const SDK_VERSION = "0.3.853";
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.851';
3
+ export const SDK_VERSION = '0.3.853';
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.851",
4
- "crouterContract": "1.100",
3
+ "version": "0.3.853",
4
+ "crouterContract": "1.101",
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",
@@ -44,9 +44,9 @@
44
44
  "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); }\""
45
45
  },
46
46
  "dependencies": {
47
- "@north-light/api": "0.3.851",
48
- "@north-light/identity": "0.3.851",
49
- "@north-light/plugin": "0.3.851",
47
+ "@north-light/api": "0.3.853",
48
+ "@north-light/identity": "0.3.853",
49
+ "@north-light/plugin": "0.3.853",
50
50
  "jose": "^6.2.1"
51
51
  },
52
52
  "peerDependencies": {