@north-light/sdk 0.3.509 → 0.3.511

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.
@@ -1,6 +1,6 @@
1
1
  import type { RequestOptions } from '../types.js';
2
2
  import type { Request } from './request.js';
3
- /** Help-only provider manifest: granted leaves, never transport or credentials. */
3
+ /** Help-only provider manifest: all grouped leaves in commands, caller-granted groups in groups; never transport or credentials. */
4
4
  export type ProviderToolEntry = {
5
5
  provider: string;
6
6
  display_name: string;
@@ -35,17 +35,25 @@ export type ProviderToolEntry = {
35
35
  export declare class Providers {
36
36
  private readonly request;
37
37
  constructor(request: Request);
38
- /** Omit provider to list every reachable provider; name one to inspect it. */
38
+ /** Omit provider to list every installed provider; name one to inspect it. */
39
39
  tools(provider: string, options?: RequestOptions): Promise<ProviderToolEntry>;
40
40
  tools(provider?: undefined, options?: RequestOptions): Promise<{
41
41
  providers: ProviderToolEntry[];
42
42
  }>;
43
- /** The daemon checks scope, mints an outbound token and calls the provider. */
43
+ /**
44
+ * The daemon checks scope, mints an outbound token and calls the provider.
45
+ *
46
+ * `machine` names which of the account's devices takes the call (a `machine_id`, `runtime:` prefix optional). Only a provider
47
+ * served by a machine, such as `device`, accepts it. When the account has more than one such machine and the call names none,
48
+ * the runtime refuses with `machine_required` rather than guessing (except `device`'s `browser libs`, which uses the most recently seen machine); name the
49
+ * device here and repeat the call.
50
+ */
44
51
  call(input: {
45
52
  provider: string;
46
53
  tool: string;
47
54
  arguments: Record<string, unknown>;
48
55
  version?: number;
49
56
  approval?: string;
57
+ machine?: string;
50
58
  }, options?: RequestOptions): Promise<unknown>;
51
59
  }
@@ -8,7 +8,14 @@ export class Providers {
8
8
  const path = provider === undefined ? '/v1/providers/tools' : `/v1/providers/${pathSegment(provider, 'provider')}/tools`;
9
9
  return this.request('GET', path, undefined, options);
10
10
  }
11
- /** The daemon checks scope, mints an outbound token and calls the provider. */
11
+ /**
12
+ * The daemon checks scope, mints an outbound token and calls the provider.
13
+ *
14
+ * `machine` names which of the account's devices takes the call (a `machine_id`, `runtime:` prefix optional). Only a provider
15
+ * served by a machine, such as `device`, accepts it. When the account has more than one such machine and the call names none,
16
+ * the runtime refuses with `machine_required` rather than guessing (except `device`'s `browser libs`, which uses the most recently seen machine); name the
17
+ * device here and repeat the call.
18
+ */
12
19
  call(input, options) {
13
20
  return this.request('POST', '/v1/provider/call', input, options);
14
21
  }
@@ -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.509"
5
+ sdk-version: "0.3.511"
6
6
  ---
7
7
 
8
8
  # Building a Northlight app
@@ -11,7 +11,7 @@ An app on Northlight signs people in with their Northlight account, then starts
11
11
 
12
12
  ## First: check this skill matches the SDK
13
13
 
14
- This skill is for SDK version `0.3.509`. 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. That command needs no account and no crtr. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
14
+ This skill is for SDK version `0.3.511`. 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. That command needs no account and no crtr. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
15
15
 
16
16
  ## Where things run
17
17
 
@@ -1012,10 +1012,10 @@ export class FakeCloud {
1012
1012
  }
1013
1013
  providerEntry(user, id, definition) {
1014
1014
  const held = user.scopeStrings();
1015
- if (!held.some((scope) => scope.startsWith(`${id}:`)))
1016
- return null;
1017
1015
  const displayName = definition.displayName ?? id;
1018
1016
  if (definition.status && definition.status !== 'available') {
1017
+ if (!held.some((scope) => scope.startsWith(`${id}:`)))
1018
+ return null;
1019
1019
  return { provider: id, display_name: displayName, status: definition.status, ...(definition.error ? { error: definition.error } : {}), groups: [], commands: [] };
1020
1020
  }
1021
1021
  const groups = new Map();
@@ -1026,8 +1026,6 @@ export class FakeCloud {
1026
1026
  const description = spec.description ?? tool;
1027
1027
  groups.set(group, [...(groups.get(group) ?? []), { tool, description, summary: description, params: [], output: [] }]);
1028
1028
  }
1029
- if (groups.size === 0)
1030
- return null;
1031
1029
  return { provider: id, display_name: displayName, status: 'available', major: 1, groups: [...groups].map(([group, leaves]) => ({ group, leaves })), commands: [] };
1032
1030
  }
1033
1031
  providerTools(user, provider) {
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.509";
2
+ export declare const SDK_VERSION = "0.3.511";
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.509';
3
+ export const SDK_VERSION = '0.3.511';
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.509",
4
- "crouterContract": "1.19",
3
+ "version": "0.3.511",
4
+ "crouterContract": "1.21",
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,8 +44,8 @@
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.509",
48
- "@north-light/identity": "0.3.509",
47
+ "@north-light/api": "0.3.511",
48
+ "@north-light/identity": "0.3.511",
49
49
  "jose": "^6.2.1"
50
50
  },
51
51
  "peerDependencies": {