@north-light/sdk 0.3.888 → 0.3.889

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
@@ -1,6 +1,7 @@
1
1
  import { type CheckDTO } from '@north-light/api';
2
2
  import { Audit } from './resources/audit.js';
3
3
  import { Canvas } from './resources/canvas.js';
4
+ import { Profiles } from './resources/profiles.js';
4
5
  import { Crons } from './resources/crons.js';
5
6
  import { Docs } from './resources/docs.js';
6
7
  import { Charges } from './resources/charges.js';
@@ -79,7 +80,7 @@ export declare class Crouter {
79
80
  }>;
80
81
  };
81
82
  /** Agent profiles. */
82
- readonly profiles: {
83
+ readonly profiles: Profiles & {
83
84
  /** The profiles an app may start runs with (app listener only): its own, and those of other apps its grant covers. `default` marks its default profile. */
84
85
  list: (options?: RequestOptions) => Promise<{
85
86
  profiles: AppProfile[];
package/dist/client.js CHANGED
@@ -2,6 +2,7 @@ import { APIError, CrtrClient, CONTRACT_HEADER, CONTRACT_LEVEL, MINIMUM_RUNTIME_
2
2
  import { CrouterError, mapError } from './errors.js';
3
3
  import { Audit } from './resources/audit.js';
4
4
  import { Canvas } from './resources/canvas.js';
5
+ import { Profiles } from './resources/profiles.js';
5
6
  import { Crons } from './resources/crons.js';
6
7
  import { Docs } from './resources/docs.js';
7
8
  import { Charges } from './resources/charges.js';
@@ -172,9 +173,9 @@ export class Crouter {
172
173
  this.customObjects = new CustomObjects(request, (path, options) => this.openCustomDeliveries(path, options));
173
174
  this.models = new Models(request);
174
175
  this.machines = { list: (options) => this.call(deadline(options), (options) => this.client.request('GET', routes.machines(), undefined, options)) };
175
- this.profiles = {
176
+ this.profiles = Object.assign(new Profiles(request), {
176
177
  list: (options) => this.call(deadline(options), (options) => this.client.request('GET', routes.profiles(), undefined, options)),
177
- };
178
+ });
178
179
  this.files = new Files(request);
179
180
  this.uploads = new Uploads(request);
180
181
  this.attachments = new Attachments(request);
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export type { Doc, DocEditParams, DocListParams, DocWriteParams } from './resour
15
15
  export type { Schemas } from './resources/schemas.js';
16
16
  export type { Relations } from './resources/relations.js';
17
17
  export type { Charges, ChargeListParams } from './resources/charges.js';
18
+ export type { Profiles } from './resources/profiles.js';
18
19
  export type { Environments } from './resources/environments.js';
19
20
  export type { SpendLimits } from './resources/spend-limits.js';
20
21
  export type { MemoryDocument, MemoryGetParams, MemoryListItem, MemoryListPage, MemoryListParams } from './resources/memory.js';
@@ -1,4 +1,4 @@
1
- import { type ArmCronRequest, type CronDTO, type CronRunDTO, type CronShowDTO } from '@north-light/api';
1
+ import { type ArmCronRequest, type CronDTO, type CronRunDTO, type CronShowDTO, type PokeCronsResult } from '@north-light/api';
2
2
  import type { RequestOptions } from '../types.js';
3
3
  import type { Request } from './request.js';
4
4
  /** `crons.create` input: the arm request without the fields the runtime derives from the calling app's grant. */
@@ -23,6 +23,8 @@ export declare class Crons {
23
23
  resume(cronId: string, options?: RequestOptions): Promise<CronDTO>;
24
24
  /** Fire now, out of band; resolves with the settled run once the process closes. Does not advance the schedule. Never retried. */
25
25
  run(cronId: string, options?: RequestOptions): Promise<CronRunDTO>;
26
+ /** Re-check every held cron of this app and person now (a held cron re-checks its own gate and re-parks if still blocked). */
27
+ poke(options?: RequestOptions): Promise<PokeCronsResult>;
26
28
  /** Cancel the cron (idempotent). */
27
29
  delete(cronId: string, options?: RequestOptions): Promise<void>;
28
30
  }
@@ -32,6 +32,10 @@ export class Crons {
32
32
  run(cronId, options = {}) {
33
33
  return this.request('POST', routes.cronRun(encodeURIComponent(pathSegment(cronId, 'cron id'))), {}, { ...options, maxRetries: 0 });
34
34
  }
35
+ /** Re-check every held cron of this app and person now (a held cron re-checks its own gate and re-parks if still blocked). */
36
+ poke(options) {
37
+ return this.request('POST', routes.cronsPoke(), {}, options);
38
+ }
35
39
  /** Cancel the cron (idempotent). */
36
40
  async delete(cronId, options) {
37
41
  await this.request('DELETE', this.path(cronId), undefined, options);
@@ -0,0 +1,39 @@
1
+ import { type CreateProfileRequest, type DeleteProfileResultDTO, type EnsureProfileRequest, type KindListDTO, type ProfileDTO, type ProfileEnvChangeDTO, type ProfileEnvNamesDTO, type UpdateProfileMetadataRequest, type UpdateProfileRequest } from '@north-light/api';
2
+ import type { RequestOptions } from '../types.js';
3
+ import type { Request } from './request.js';
4
+ /** Profiles of the calling app (app listener). An app creates and changes only its own app's profiles, and a profile holds repositories, never directory paths. */
5
+ export declare class Profiles {
6
+ private readonly request;
7
+ constructor(request: Request);
8
+ private name;
9
+ get(name: string, options?: RequestOptions): Promise<ProfileDTO>;
10
+ /** Create a profile; a name the app already holds is refused. Never retried. */
11
+ create(params: CreateProfileRequest, options?: RequestOptions): Promise<ProfileDTO>;
12
+ /** Return the app's profile `name`, creating it when absent. */
13
+ ensure(name: string, params?: EnsureProfileRequest, options?: RequestOptions): Promise<ProfileDTO>;
14
+ update(name: string, params: UpdateProfileRequest, options?: RequestOptions): Promise<ProfileDTO>;
15
+ setMetadata(name: string, params: UpdateProfileMetadataRequest, options?: RequestOptions): Promise<ProfileDTO>;
16
+ /** Delete the profile; `force: true` is required. */
17
+ delete(name: string, params: {
18
+ force: boolean;
19
+ detach?: boolean;
20
+ }, options?: RequestOptions): Promise<DeleteProfileResultDTO>;
21
+ /** Stored env var names of a profile (never values). */
22
+ envNames(name: string, options?: RequestOptions): Promise<ProfileEnvNamesDTO>;
23
+ setEnv(name: string, variable: string, value: string, options?: RequestOptions): Promise<ProfileEnvChangeDTO>;
24
+ removeEnv(name: string, variable: string, options?: RequestOptions): Promise<ProfileEnvChangeDTO>;
25
+ /** The kinds a run may start with, for the app (or for its own `profile`). */
26
+ kinds(params?: {
27
+ profile?: string;
28
+ }, options?: RequestOptions): Promise<KindListDTO>;
29
+ /** Names of the app's own env vars (never values). */
30
+ appEnvNames(options?: RequestOptions): Promise<{
31
+ names: string[];
32
+ }>;
33
+ setAppEnv(variable: string, value: string, options?: RequestOptions): Promise<{
34
+ changed: boolean;
35
+ }>;
36
+ removeAppEnv(variable: string, options?: RequestOptions): Promise<{
37
+ changed: boolean;
38
+ }>;
39
+ }
@@ -0,0 +1,56 @@
1
+ import { routes } from '@north-light/api';
2
+ import { pathSegment } from './identifiers.js';
3
+ /** Profiles of the calling app (app listener). An app creates and changes only its own app's profiles, and a profile holds repositories, never directory paths. */
4
+ export class Profiles {
5
+ request;
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ name(name) { return encodeURIComponent(pathSegment(name, 'profile name')); }
10
+ get(name, options) {
11
+ return this.request('GET', routes.profile(this.name(name)), undefined, options);
12
+ }
13
+ /** Create a profile; a name the app already holds is refused. Never retried. */
14
+ create(params, options = {}) {
15
+ return this.request('POST', routes.profiles(), params, { ...options, maxRetries: 0 });
16
+ }
17
+ /** Return the app's profile `name`, creating it when absent. */
18
+ ensure(name, params = {}, options) {
19
+ return this.request('PUT', routes.profile(this.name(name)), params, options);
20
+ }
21
+ update(name, params, options) {
22
+ return this.request('PATCH', routes.profile(this.name(name)), params, options);
23
+ }
24
+ setMetadata(name, params, options) {
25
+ return this.request('PATCH', routes.profileMetadata(this.name(name)), params, options);
26
+ }
27
+ /** Delete the profile; `force: true` is required. */
28
+ delete(name, params, options) {
29
+ return this.request('DELETE', routes.profile(this.name(name)), params, options);
30
+ }
31
+ /** Stored env var names of a profile (never values). */
32
+ envNames(name, options) {
33
+ return this.request('GET', routes.profileEnv(this.name(name)), undefined, options);
34
+ }
35
+ setEnv(name, variable, value, options) {
36
+ return this.request('PUT', routes.profileEnvVar(this.name(name), encodeURIComponent(pathSegment(variable, 'env var name'))), { value }, options);
37
+ }
38
+ removeEnv(name, variable, options) {
39
+ return this.request('DELETE', routes.profileEnvVar(this.name(name), encodeURIComponent(pathSegment(variable, 'env var name'))), undefined, options);
40
+ }
41
+ /** The kinds a run may start with, for the app (or for its own `profile`). */
42
+ kinds(params = {}, options) {
43
+ const search = params.profile === undefined ? '' : `?profile=${encodeURIComponent(params.profile)}`;
44
+ return this.request('GET', `${routes.kinds()}${search}`, undefined, options);
45
+ }
46
+ /** Names of the app's own env vars (never values). */
47
+ appEnvNames(options) {
48
+ return this.request('GET', routes.appEnv(), undefined, options);
49
+ }
50
+ setAppEnv(variable, value, options) {
51
+ return this.request('PUT', routes.appEnvVar(pathSegment(variable, 'env var name')), { value }, options);
52
+ }
53
+ removeAppEnv(variable, options) {
54
+ return this.request('DELETE', routes.appEnvVar(pathSegment(variable, 'env var name')), undefined, options);
55
+ }
56
+ }
@@ -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.888"
5
+ sdk-version: "0.3.889"
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.888`. 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.889`. 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
 
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.888";
2
+ export declare const SDK_VERSION = "0.3.889";
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.888';
3
+ export const SDK_VERSION = '0.3.889';
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.888",
4
- "crouterContract": "1.113",
3
+ "version": "0.3.889",
4
+ "crouterContract": "1.114",
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.888",
54
- "@north-light/identity": "0.3.888",
55
- "@north-light/plugin": "0.3.888",
53
+ "@north-light/api": "0.3.889",
54
+ "@north-light/identity": "0.3.889",
55
+ "@north-light/plugin": "0.3.889",
56
56
  "jose": "^6.2.1"
57
57
  },
58
58
  "peerDependencies": {