@north-light/cli 0.3.472 → 0.3.473

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.
Files changed (43) hide show
  1. package/dist/api/dto/nodes.d.ts +1 -1
  2. package/dist/builtin-memory/crouter-sdk/README.md +1 -1
  3. package/dist/builtin-memory/crouter-sdk/errors.md +1 -1
  4. package/dist/builtin-memory/crouter-sdk/getting-started.md +1 -1
  5. package/dist/builtin-memory/crouter-sdk/guides/apps-on-northlight.md +1 -1
  6. package/dist/builtin-memory/crouter-sdk/nodes.md +1 -1
  7. package/dist/builtin-memory/crouter-sdk/release-notes.md +20 -20
  8. package/dist/commands/node/create.js +2 -2
  9. package/docs/apps/cli.md +40 -0
  10. package/docs/apps/coding-agents.md +72 -0
  11. package/docs/apps/concepts/apps-and-sign-in.md +82 -0
  12. package/docs/apps/concepts/connections.md +106 -0
  13. package/docs/apps/concepts/providers.md +59 -0
  14. package/docs/apps/concepts/runs.md +94 -0
  15. package/docs/apps/concepts/scopes-and-grants.md +62 -0
  16. package/docs/apps/concepts/testing-mode.md +36 -0
  17. package/docs/apps/errors.md +117 -0
  18. package/docs/apps/guides/background-runs.md +78 -0
  19. package/docs/apps/guides/files-and-documents.md +59 -0
  20. package/docs/apps/guides/go-live.md +37 -0
  21. package/docs/apps/guides/grant-changes.md +98 -0
  22. package/docs/apps/guides/manage-your-app.md +75 -0
  23. package/docs/apps/guides/many-users.md +61 -0
  24. package/docs/apps/guides/stream-a-run.md +82 -0
  25. package/docs/apps/guides/test-your-app.md +191 -0
  26. package/docs/apps/guides/typed-results.md +72 -0
  27. package/docs/apps/how-it-fits.md +46 -0
  28. package/docs/apps/providers/README.md +26 -0
  29. package/docs/apps/providers/context.md +32 -0
  30. package/docs/apps/providers/device.md +26 -0
  31. package/docs/apps/providers/integrations.md +26 -0
  32. package/docs/apps/providers/search.md +29 -0
  33. package/docs/apps/providers/sms.md +37 -0
  34. package/docs/apps/quickstart.md +120 -2
  35. package/docs/sdk/README.md +1 -1
  36. package/docs/sdk/errors.md +1 -1
  37. package/docs/sdk/getting-started.md +1 -1
  38. package/docs/sdk/guides/apps-on-northlight.md +1 -1
  39. package/docs/sdk/nodes.md +1 -1
  40. package/docs/sdk/release-notes.md +20 -20
  41. package/package.json +2 -2
  42. package/packages/crouter-identity/package.json +1 -1
  43. package/runtime.lock.json +12 -12
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Typed results
3
+ description: Start a run with a schema and get back a value that was checked against it.
4
+ ---
5
+
6
+ # Typed results
7
+
8
+ Pass an `output_schema` and call `runs.parse`. The runtime arms the schema on the run's root agent, which must submit a value that validates against it. The run settles with that value, and `runs.parse` returns it as `output_parsed`, typed from your schema.
9
+
10
+ <include lang="ts">../../../examples/apps/runs-parse.ts</include>
11
+
12
+ The runtime validates the value before it records it. A submission that does not match is refused with its field errors and never appears in `runs.get`, an event or a report, so the agent fixes it and resubmits.
13
+
14
+ - `output_schema` accepts a plain JSON Schema object or anything with `toJSONSchema()`, such as a Zod v4 object. The SDK sends it as JSON and validates nothing itself.
15
+ - A schema that is not an object, or is over 256 KB serialized, is refused with `invalid_request` and `param: 'output_schema'`, and no run is created. A submitted result can be at most 1 MiB.
16
+ - The value is validated exactly as submitted, with no coercion: `"5"` is not turned into `5`.
17
+ - A `$ref` can point only into the schema itself (`#/$defs/x`, `#anchor`) or at another schema document bundled under `$defs` with its own `$id`. Files are never fetched. A `$ref` that resolves nowhere, or a schema that cannot be compiled (a bad `pattern`), is refused with `invalid_request` and `param: 'output_schema'`.
18
+ - The agent submits with its `submit_result` tool, which needs no scope, so a run that only reasons and answers can start with `scopes: ['crtr:llm']`.
19
+ - The same value is in `runs.get(runId).result`, which `runs.wait` returns unchanged.
20
+
21
+ Do not parse assistant text out of `runs.trace` to get data back. `runs.trace` is for showing a person the transcript.
22
+
23
+ ## A run that declines
24
+
25
+ An agent that cannot honestly satisfy the schema declines. A decline, a cancel, a deadline and a runtime error all come back as an outcome. They do not throw. Narrow on `outcome.kind` and `outcome.reason`, as the example does.
26
+
27
+ ## Stopping without a result: `run_idle`
28
+
29
+ `runs.parse` rejects with an `APIError` with code `run_idle` when the agent stopped without submitting. The runtime reminds the agent of the schema up to three times in a row, then leaves the run `idle` with the schema still armed. The run is untouched: send `runs.message` to nudge the agent (this resets the reminders), or end it with `runs.cancel`.
30
+
31
+ A question from the run rejects with `waiting_on_user` unless you pass `onQuestion`. With `onQuestion`, `parse` answers each open question once and keeps waiting.
32
+
33
+ ## Bounding a run
34
+
35
+ No run is bounded in time by default. Pass a `signal` to `runs.parse` or `runs.wait`. When it aborts, the helper rejects with the signal's reason and leaves the run alone. Call `runs.cancel` if you want the run ended:
36
+
37
+ ```ts
38
+ const controller = new AbortController();
39
+ const timer = setTimeout(() => controller.abort(new Error('took too long')), 10 * 60_000);
40
+ let runId: string | undefined;
41
+ try {
42
+ const started = await runtime.runs.start({prompt, output_schema: Profile});
43
+ runId = started.run_id;
44
+ const run = await runtime.runs.wait(runId, {signal: controller.signal});
45
+ // read run.status, run.outcome, run.result
46
+ } catch (error) {
47
+ if (controller.signal.aborted && runId) await runtime.runs.cancel(runId);
48
+ throw error;
49
+ } finally {
50
+ clearTimeout(timer);
51
+ }
52
+ ```
53
+
54
+ ## Showing progress
55
+
56
+ For a run you poll, `runs.get(runId).activity` is `null` unless `status` is `running`, and otherwise says what the root agent is doing:
57
+
58
+ | `phase` | The root agent is |
59
+ |---|---|
60
+ | `starting` | launching; its first turn has not begun |
61
+ | `thinking` | reasoning, or waiting on the model before any output |
62
+ | `tool` | calling a tool: `tool.name`, and `tool.summary` (`null` while the call is still being written) |
63
+ | `submitting_result` | writing or recording its `output_schema` result |
64
+ | `writing` | streaming its answer text |
65
+ | `between_turns` | between turns while the run still works |
66
+
67
+ ```ts
68
+ const run = await runtime.runs.get(runId);
69
+ const badge = run.activity?.phase === 'tool' ? `Running ${run.activity.tool.name}` : run.activity?.phase ?? run.status;
70
+ ```
71
+
72
+ `activity` covers the root agent only, and it is read each time you call `runs.get`, so a phase shorter than your poll interval can be missed. To show text as it streams, follow the events instead: see [Stream a run](/docs/guides/stream-a-run). To be told when a background run ends, see [Background runs](/docs/guides/background-runs).
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: Where your app runs
3
+ description: Your app runs on your server, people sign in at account.northlight.ai, and the agent work runs on each person's own Northlight runtime. Northlight does not host your app's code.
4
+ ---
5
+
6
+ # Where your app runs
7
+
8
+ Your app runs on a server you choose. Northlight hosts two other things: the directory at `account.northlight.ai`, and each person's agent runtime. Northlight does not host your app's code, and there is no flow for deploying it to Northlight.
9
+
10
+ | Piece | Runs where | What it does |
11
+ |---|---|---|
12
+ | **Your server** | Anywhere you choose. Your laptop while you develop. | Your pages and logic. It holds the app's private signing key and a stored connection for each person. |
13
+ | **The directory** | `https://account.northlight.ai`, hosted by Northlight | Accounts, app registration (the console at `/console`), consent, tokens and the marketplace. |
14
+ | **The person's runtime** | Hosted by Northlight, one per person | Their agents, runs, files, documents and providers (sms, search and others), using their own AI subscription. |
15
+
16
+ "Build on Northlight" therefore means three things. Your app's agent work runs on the person's Northlight-hosted runtime. People sign in to your app with their Northlight account. And your app can be listed in the Northlight marketplace.
17
+
18
+ ```mermaid
19
+ sequenceDiagram
20
+ participant P as Person's browser
21
+ participant A as Your server
22
+ participant D as account.northlight.ai
23
+ participant R as Person's runtime
24
+ P->>A: GET /auth/login
25
+ A->>P: redirect to the directory (client ID, scopes, PKCE challenge)
26
+ P->>D: sign in, consent
27
+ D->>P: redirect to your /auth/callback with a code
28
+ P->>A: GET /auth/callback?code=…
29
+ A->>D: exchange the code, signed with your private key
30
+ D->>A: access token, refresh token, runtime URL
31
+ Note over A: store the connection for this person
32
+ A->>R: oauth.client(userId).runs.start(…)
33
+ R->>A: the run, its status and its result
34
+ ```
35
+
36
+ 1. **Sign-in.** Your `/auth/login` route sends the person to the directory with your client ID and the scopes you ask for. The directory shows its consent page and returns them to your registered redirect URI with a one-use code.
37
+ 2. **Token.** Your server exchanges the code for tokens. It proves it is your app by signing the request with its private key. No client secret exists. The result is a connection: a short-lived access token, a rotating refresh token, and the URL of that person's runtime. See [Apps and sign-in](/docs/concepts/apps-and-sign-in).
38
+ 3. **Calls.** `oauth.client(userId)` loads the stored connection, refreshes the access token when it needs to, and returns a client on that person's runtime. You call `runs.*` and `providers.*` on it. See [Connections](/docs/concepts/connections) and [Runs](/docs/concepts/runs).
39
+
40
+ The person's AI subscription pays for model calls, and what your app may do on their runtime is limited by the scopes they approved. See [Scopes and grants](/docs/concepts/scopes-and-grants).
41
+
42
+ ## What you operate
43
+
44
+ You operate your server, its sessions, its database and its `ConnectionStore`. You register the app in the console and keep its key pair. Northlight operates the directory and the runtimes; you do not run either, and there is no local Northlight to start. If you run crouter yourself and want a runtime of your own, that is a different path: see [crouter.docs.northlight.ai](https://crouter.docs.northlight.ai).
45
+
46
+ The directory's discovery document at `https://account.northlight.ai/.well-known/openid-configuration` lists the endpoints, the `S256` PKCE method and `private_key_jwt` as the only token authentication method (checked on production).
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: Providers
3
+ description: The first-party providers an app can call on a person's runtime, their ids, how scope strings are named, and how to list a provider's tools.
4
+ ---
5
+
6
+ # Providers
7
+
8
+ A provider is a service the person's runtime calls for your app. Your app asks the runtime with `runtime.providers.call(...)`, and the runtime checks that the person approved the provider's scope for your app. See [Providers](/docs/concepts/providers) for the model.
9
+
10
+ | Provider id | What it does | Scopes | Page |
11
+ |---|---|---|---|
12
+ | `sms` | Texts the signed-in person's own verified phone | `sms:send`, `sms:status` | [Texting (sms)](/docs/providers/sms) |
13
+ | `search` | Web search, sourced answers, page contents and paid data endpoints | `search:<group>` | [Search](/docs/providers/search) |
14
+ | `integrations` | The person's own accounts at other services | `integrations:discover`, `integrations:<service>_read`, `integrations:<service>_write` | [Integrations](/docs/providers/integrations) |
15
+ | `context` | Ask about the person from their memory, and look up public profiles | `context:<group>` | [Context](/docs/providers/context) |
16
+ | `device` | The person's Mac: browser, files, Messages and shell | `device:<group>` | [Device](/docs/providers/device) |
17
+
18
+ ## Where names come from
19
+
20
+ - **Scope strings** come from the console's **What it asks for → Add permissions** list. A scope is `<provider id>:<group>`. Do not guess them.
21
+ - **Tool names and arguments** come from `runtime.providers.tools('<provider id>')`. It answers the provider's groups, and each group's tools with a description, parameters and output. It lists only the groups your app's grant holds, so ask for the scope first, then list.
22
+ - **Required providers.** If your app does not work without a provider being set up first, add it under **What your app requires** in the console. See [Grant changes](/docs/guides/grant-changes#wait-on-a-provider-your-app-requires).
23
+
24
+ <include lang="ts">../../../examples/apps/provider-tools.ts</include>
25
+
26
+ Each provider page below shows the tools of a provider as captured on **2026-10-16**. The capture is not an app's view: it came from the runtime of a person's own Northlight account (`GET /v1/providers/<id>/tools` on `crtr` 0.3.462, joined to production), which shows the groups that person's own grant holds. What `providers.tools` answers for your app depends on the scopes your app was granted. Tools can change between releases, so treat a table as a starting point and list the tools at run time.
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Context
3
+ description: Ask about the person from their memory, and look up public profiles, through the context provider.
4
+ ---
5
+
6
+ # Context
7
+
8
+ The `context` provider answers questions about the person from what their agent knows, and looks up public profiles.
9
+
10
+ ## Scopes and setup
11
+
12
+ Scopes are `context:<group>`. The console's **Add permissions** list shows `context:ask_informed` and `context:ask_public` on 2026-10-16; the tool list also shows a `research` group (`context:research`) that was not in that console list when we checked (not yet checked on production).
13
+
14
+ Context needs setup before it works: the person gives a profile URL on the provider's setup page, and its state stays `pending` for a few minutes afterwards. If your app depends on it, add `context` under **What your app requires** and follow the state with `grant.get().dependencies['context']`. See [Grant changes](/docs/guides/grant-changes#wait-on-a-provider-your-app-requires).
15
+
16
+ ## Tools
17
+
18
+ Captured 2026-10-16 from `GET /v1/providers/context/tools` on a joined runtime (provider major version 1). `*` marks a required parameter. Tool names with a space are written as the provider lists them; check how to pass a multi-word `tool` to `providers.call` against your own `providers.tools` output before relying on it (not yet checked on production).
19
+
20
+ | Tool | Group | Parameters | What it does |
21
+ |---|---|---|---|
22
+ | `ask informed` | `ask_informed` | `request`\*, `question` (repeatable, up to 10) | Advice about the person shaped by everything their agent knows, private memories included, without being told private details |
23
+ | `ask public` | `ask_public` | `request`\*, `question` (repeatable, up to 10) | Answers about the person from public memories only |
24
+ | `linkedin profile` | `research` | `profile`\* | A person's LinkedIn profile |
25
+ | `linkedin posts` | `research` | `profile`\*, `limit` | Recent LinkedIn posts |
26
+ | `x profile` | `research` | `profile`\* | A person's X profile |
27
+ | `x posts` | `research` | `profile`\*, `limit` | Not available |
28
+ | `github profile` | `research` | `profile`\* | A person's GitHub profile |
29
+ | `github repos` | `research` | `profile`\*, `limit` | Public repositories |
30
+ | `search people` | `research` | `query`\* | Search LinkedIn people |
31
+
32
+ `request` is the task you are doing, 1 to 4000 characters. Each `question` is 1 to 500 characters. Run `runtime.providers.tools('context')` for the current list and each tool's output shape.
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: Device
3
+ description: "Reach the person's Mac from your app: browser, files, Messages and shell, each behind its own scope."
4
+ ---
5
+
6
+ # Device
7
+
8
+ The `device` provider reaches the person's own Mac. Its tools run on the person's machine (the provider's transport is `machine`), and each group is its own scope, so ask only for the groups your app needs. What happens when the Mac is asleep or offline is not yet checked on production.
9
+
10
+ ## Scopes
11
+
12
+ `device:browser`, `device:files`, `device:messages_read`, `device:messages_send` and `device:shell`. Add them under **What it asks for → Add permissions** (provider `device`).
13
+
14
+ ## Tools
15
+
16
+ Captured 2026-10-16 from `GET /v1/providers/device/tools` on a joined runtime (provider major version 2, transport `machine`). `*` marks a required parameter.
17
+
18
+ | Group (scope) | Tools |
19
+ |---|---|
20
+ | `browser` | `browser profiles`, `browser executor create` (`url`, `mode`, `profile`, `target-pattern`), `browser executor list`, `browser executor navigate` (`executor`\*, `url`\*), `browser executor exec` (`executor`\*, `code`\*, `timeout-ms`, `short-description`), `browser executor result` (`run`\*), `browser executor close` (`executor`\*), `browser libs` (`query`, `limit`, `service`, `fn`), `browser cdp` (`method`\*, `params`, `tab`) |
21
+ | `files` | `files list` (`path`\*, `limit`), `files stat` (`path`\*), `files read` (`path`\*, `encoding`, `offset`, `length`), `files write` (`path`\*, `text`, `base64`, `from`, `append`, `parents`), `files delete` (`path`\*, `recursive`), `files move` (`from`\*, `to`\*, `overwrite`), `files mkdir` (`path`\*) |
22
+ | `messages_read` | `messages chats` (`limit`), `messages history` (`chat`, `participant`, `since`, `until`, `limit`, `attachments`), `messages search` (`text`\*, `limit`), `messages contacts` (`query`\*, `limit`), `messages permissions` (`open`) |
23
+ | `messages_send` | `messages send` (`recipient`\*, `text`\*, `file`, `service`) |
24
+ | `shell` | `shell run` (`command`\*, `cwd`, `timeout`, `stdin`) |
25
+
26
+ Tool names with spaces are written as the provider lists them; check how to pass them to `providers.call` against your own `providers.tools` output (not yet checked on production). The capture is of a person's own grant, not an app's. Run `runtime.providers.tools('device')` for the list your app can use.
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: Integrations
3
+ description: Call the person's own accounts at other services through the integrations provider, and find the tool you need.
4
+ ---
5
+
6
+ # Integrations
7
+
8
+ The `integrations` provider lets your app act in the person's own accounts at other services, with the person's consent for each service.
9
+
10
+ ## Scopes
11
+
12
+ - `integrations:discover` allows `search` and `schema`, which find services and their tools, and the `link` group's `accounts`, which lists the person's linked accounts.
13
+ - `integrations:<service>_read` and `integrations:<service>_write` gate each service's tools. For example, a service named `gmail` has `integrations:gmail_read` and `integrations:gmail_write`.
14
+
15
+ Scope strings come from **What it asks for → Add permissions** (provider `integrations`). The catalog is large, so search it by service name.
16
+
17
+ ## Find the tool you need
18
+
19
+ The provider has thousands of tools: on 2026-10-16 the runtime we captured from listed 3,061 tools across 3,060 groups, one `_read` group and one `_write` group per service, plus `discover` and `link`. This page does not table them. List them from your app:
20
+
21
+ ```ts
22
+ const integrations = await runtime.providers.tools('integrations');
23
+ for (const group of integrations.groups) console.log(group.group, group.leaves.map((leaf) => leaf.tool));
24
+ ```
25
+
26
+ `providers.tools('integrations')` is large (several megabytes on that runtime), and it lists only groups your app's grant holds, so it stays small until you add service scopes. To find a service or a tool, call the provider's `search` and `schema` tools (group `discover`) instead of reading the whole list.
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: Search
3
+ description: Web search, sourced answers, page contents, and paid data endpoints through the search provider.
4
+ ---
5
+
6
+ # Search
7
+
8
+ The `search` provider runs web search and returns ranked pages, sourced answers, page contents and deep research, and it finds and calls paid data endpoints.
9
+
10
+ ## Scopes
11
+
12
+ Each scope is `search:<group>`: `search:search`, `search:answer`, `search:contents`, `search:discover`, `search:research` and `search:run`. Add them under **What it asks for → Add permissions** (provider `search`). A tool is available when your app holds its group's scope.
13
+
14
+ ## Tools
15
+
16
+ Captured 2026-10-16 from `GET /v1/providers/search/tools` on a joined runtime (provider major version 1). `*` marks a required parameter.
17
+
18
+ | Tool | Group (scope) | Parameters | What it does |
19
+ |---|---|---|---|
20
+ | `search` | `search` | `query`\*, `type`, `category`, `num-results`, `start-published-date`, `end-published-date`, `include-domains`, `exclude-domains`, `no-text` | Ranked web pages |
21
+ | `answer` | `answer` | `query`\*, `structured` | A sourced answer |
22
+ | `contents` | `contents` | `urls`\*, `no-text`, `highlights`, `summary`, `livecrawl` | Contents of known pages |
23
+ | `research` | `research` | `query`\*, `depth` | Deep web research |
24
+ | `discover` | `discover` | `query`\*, `limit`, `min-score` | Matching data endpoints and prices |
25
+ | `inspect` | `discover` | `provider`\*, `endpoint`\* | Data endpoint details and price |
26
+ | `run` | `run` | `provider`\*, `endpoint`\*, `input`\* | A paid data result, or a pending run ID |
27
+ | `status` | `run` | `run-id`\* | State and result of a data run |
28
+
29
+ The capture is of a person's own grant, not an app's. Run `runtime.providers.tools('search')` for what your app's grant holds. A call is billed to the person under your app's spend cap ([Grant changes](/docs/guides/grant-changes#show-what-a-persons-month-has-cost)).
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Texting (sms)
3
+ description: Text the signed-in person's own verified phone from your app with the sms provider.
4
+ ---
5
+
6
+ # Texting (sms)
7
+
8
+ The `sms` provider sends a text from Northlight's number to the verified phone of the person who signed in to your app. It has no recipient argument, so an app cannot text anyone else.
9
+
10
+ ## Scopes
11
+
12
+ | Scope | Consent sentence | Gates |
13
+ |---|---|---|
14
+ | `sms:send` | Send you text messages from Northlight's number | `send`, `react` |
15
+ | `sms:status` | Not captured | `status` |
16
+
17
+ Add them under **What it asks for → Add permissions** (provider `sms`). Without `sms:send` the consent page does not offer it and `providers.call` for `sms` is refused with `scope_missing`.
18
+
19
+ ## Send a text
20
+
21
+ ```ts
22
+ await runtime.providers.call({provider: 'sms', tool: 'send', arguments: {body: 'Your summary is ready.'}});
23
+ ```
24
+
25
+ `body` is required. The text goes from Northlight's number to the person's verified phone, and each person can receive at most 50 texts from your app per UTC day. These limits are the provider's documented behavior (the 50-per-day limit is not yet checked on production).
26
+
27
+ ## Tools
28
+
29
+ Captured 2026-10-16 from `GET /v1/providers/sms/tools` on a joined runtime (provider major version 1). `*` marks a required parameter.
30
+
31
+ | Tool | Group (scope) | Parameters | What it does |
32
+ |---|---|---|---|
33
+ | `send` | `send` (`sms:send`) | `body`\*, `file`, `reply-to` | Send a text to your verified phone. `file` is a signed URL of at most 5 MiB sent after the text. `reply-to` is the label of a message in the conversation, such as `m3`, to send a threaded reply. Answers `message_id`. |
34
+ | `react` | `send` (`sms:send`) | `label`\*, `emoji`\* | React to a text in the conversation with a tapback or any emoji. |
35
+ | `status` | `status` (`sms:status`) | `message-id`\* | Check the delivery state of a text. |
36
+
37
+ Parameter names are the provider's own. In a `providers.call`, `arguments` is an object keyed by those names, such as `{body, file}`. Run `runtime.providers.tools('sms')` for the current list.
@@ -1,8 +1,126 @@
1
1
  ---
2
2
  title: Quick setup
3
- description: Register an app, sign a person in with Northlight, and start a run on their runtime.
3
+ description: From no account to a running app that signs a person in with Northlight, starts a run on their runtime and sends them a text.
4
4
  ---
5
5
 
6
6
  # Quick setup
7
7
 
8
- This page is a placeholder. The quick setup path is written in a later change.
8
+ ```bash
9
+ npx @north-light/sdk@latest init my-app
10
+ ```
11
+
12
+ This command creates a small Node server, a signing key and an env file. About ten minutes later you have an app on your laptop that signs you in with Northlight, starts an agent run on your own Northlight runtime, and texts your phone. The app runs on your machine and talks to Northlight's production directory at `https://account.northlight.ai`. There is no local Northlight stack to run, and you do not need crouter.
13
+
14
+ You need Node.js 22.19 or later and a phone that can receive iMessage.
15
+
16
+ Using a coding agent? Run the same `init` command, or tell your agent: *Read https://sdk.docs.northlight.ai/SKILL.md and follow it.* See [Use your coding agent](/docs/coding-agents).
17
+
18
+ Each step below ends with what you should see when it worked. A step marked "(not yet checked on production)" is written from the source code and has not been run end to end against `account.northlight.ai`.
19
+
20
+ ## 1. Create an account
21
+
22
+ Open `https://account.northlight.ai/signup` and create your account. Signup texts a confirmation code to your phone, and that text is sent over iMessage. A number that cannot receive iMessage gets "We couldn't send the text", and retrying does not help. One phone number belongs to one account.
23
+
24
+ You should see: your account's page after you enter the code. Opening `https://account.northlight.ai/console` while signed in shows the console, where your apps are listed. Checked on production: `/signup` redirects to the phone step at `/signup/phone`, and `/console` while signed out redirects to sign-in. Completing signup and the signed-in console are not yet checked on production.
25
+
26
+ ## 2. Scaffold the app
27
+
28
+ ```bash
29
+ npx @north-light/sdk@latest init my-app
30
+ cd my-app
31
+ ```
32
+
33
+ `init` writes these files into `my-app/`:
34
+
35
+ | File | What it is |
36
+ |---|---|
37
+ | `package.json` | Pins `@north-light/sdk` to the exact version of the CLI you ran, and adds `tsx`. |
38
+ | `server.ts` | The server shown at the end of this page. |
39
+ | `local/app-key.json` | Your app's private signing key, mode `0600`. Never commit it or paste it anywhere. |
40
+ | `local/app.env` | The settings the server reads: `CROUTER_ISSUER`, `APP_ORIGIN`, an empty `CROUTER_CLIENT_ID=` and `CROUTER_KEY_FILE`. |
41
+ | `.gitignore` | Keeps `local/` and `node_modules/` out of git. |
42
+ | `.agents/skills/northlight/SKILL.md` and `.claude/skills/northlight/SKILL.md` | The Northlight skill for your coding agent. |
43
+
44
+ You should see, on the terminal: `Created a Northlight app in my-app:` with the file names, the path of the private key, the next steps in order, and last, on its own line, the **public key** as one line of JSON:
45
+
46
+ ```json
47
+ {"kty":"EC","x":"…","y":"…","crv":"P-256","kid":"…","alg":"ES256","use":"sig"}
48
+ ```
49
+
50
+ Copy that line. You paste it into the console in the next step. If a file already exists, `init` refuses, names it and exits non-zero without writing anything.
51
+
52
+ Checked: this output and these files, from the SDK source built on this branch in an empty directory with no crtr on `PATH`. `npx @north-light/sdk@latest` fetches the npm `latest` release, and that release does not include `init` until the site goes live (not yet checked on production).
53
+
54
+ ## 3. Register the app in the console
55
+
56
+ Open `https://account.northlight.ai/console/new`. The page is titled **Register an app**. Fill in:
57
+
58
+ | Field | Value |
59
+ |---|---|
60
+ | **Name** | Shown to people on the consent page and in their account. |
61
+ | **Origin URL** | `http://localhost:3000` |
62
+ | **Logo URL** | Required. A square image shown beside your app's name. |
63
+ | **Why your app needs access** | One sentence. It is quoted on the consent page as your words. |
64
+ | **Redirect URIs** | `http://localhost:3000/auth/callback`, one URL per line. Sign-in returns only to a URI listed here, matched exactly. `localhost` and `127.0.0.1` are different URIs, and the port counts. |
65
+ | **Public key (optional)** | The JSON line `init` printed. |
66
+
67
+ Choose **Register app**.
68
+
69
+ You should see: a page titled "*your app's name* is registered" with a **Client ID** and, under it, the key ID of the key you pasted. Copy the client ID. If it says "Next: add your app's public key on the Sign-in tab", the key was left out: open the app's **Sign-in** tab and choose **Add key**. The app starts asking for `crtr:llm` and `crtr:act`.
70
+
71
+ The field labels are from the console's source. Pasting a key at registration is not yet checked on production.
72
+
73
+ ## 4. Add the permission to text
74
+
75
+ On the app's page, open the **What it asks for** tab and choose **Add permissions**. Add `sms:send` from the list.
76
+
77
+ You should see: `sms:send` under what your app asks for, next to `crtr:llm` and `crtr:act`. The server in this guide asks for all three, so without `sms:send` the consent page does not offer it and the text in step 6 is refused. Take scope strings from this list. Do not invent them. See [Scopes and grants](/docs/concepts/scopes-and-grants).
78
+
79
+ Not yet checked on production.
80
+
81
+ ## 5. Write the client ID into the env file
82
+
83
+ ```bash
84
+ npx @north-light/sdk env --client-id <client id>
85
+ ```
86
+
87
+ You should see:
88
+
89
+ ```text
90
+ Set in local/app.env:
91
+ CROUTER_ISSUER=https://account.northlight.ai
92
+ CROUTER_CLIENT_ID=<client id>
93
+ APP_ORIGIN=http://localhost:3000
94
+ Key file: local/app-key.json (set CROUTER_KEY_FILE to change it).
95
+ ```
96
+
97
+ `local/app.env` now has all four settings. The command makes no network call and keeps every other line in the file. Add `--origin <url>` if your app does not run on `http://localhost:3000`.
98
+
99
+ Checked from the SDK source built on this branch.
100
+
101
+ ## 6. Run it
102
+
103
+ ```bash
104
+ npm i
105
+ node --env-file=local/app.env --import tsx server.ts
106
+ ```
107
+
108
+ (`npm start` runs the same command.) You should see `Listening on http://localhost:3000`.
109
+
110
+ Open `http://localhost:3000/auth/login`. Your browser goes to `account.northlight.ai`. Sign in if asked, read the consent page, and choose Allow. You land back on `http://localhost:3000/` with "Signed in" and your Northlight user id. Press **Start a run and send me a text**. The page answers "Done", shows the run's status `idle`, and your phone receives "Hello from my first Northlight app." from Northlight's number.
111
+
112
+ What was checked: the server starts, `/` shows the sign-in link, and `/auth/login` answers `303` to `https://account.northlight.ai/authorize?client_id=…&scope=openid+profile+crtr%3Allm+crtr%3Aact+sms%3Asend…&code_challenge_method=S256…`. The consent page, the callback, the run and the text are not yet checked on production.
113
+
114
+ If `/` shows "One step left", `CROUTER_CLIENT_ID` is empty: repeat step 5 and restart. If a call fails with `426 runtime_version_unsupported`, your SDK is newer than the Northlight runtimes. Install the previous version with `npm i --save-exact @north-light/sdk@<version>` and tell support@northlight.ai.
115
+
116
+ ## 7. What next
117
+
118
+ - Only you can sign in until you add testers: see [Testing mode](/docs/concepts/testing-mode).
119
+ - Keep each person's sign-in across restarts and processes: see [Connections](/docs/concepts/connections).
120
+ - See what `server.ts` does and where each piece runs: [Where your app runs](/docs/how-it-fits).
121
+
122
+ ## The server `init` writes
123
+
124
+ This is `examples/apps/quickstart-server.ts`. The SDK reads no environment: the server passes the values in.
125
+
126
+ <include lang="ts">../../examples/apps/quickstart-server.ts</include>
@@ -82,7 +82,7 @@ The directory rejects the key until its public JWK is added to the app. To chang
82
82
  | [Errors](./errors.md) | The error class table and the retry policy |
83
83
  | [Docker environment](./docker.md) | `start()`, `attach()`, `connection()` from `@north-light/env-docker` |
84
84
  | [Testing your app](./testing.md) | `FakeCloud` from `@north-light/sdk/testing`: a fake directory and runtime your real `OAuth2Client` and `Crouter` talk to through `fetch` |
85
- | [Release notes](./release-notes.md) | Behavior changes an existing app must act on, newest first |
85
+ | [Release notes](https://sdk.docs.northlight.ai/docs/release-notes) | Behavior changes an existing app must act on, newest first |
86
86
  | [Apps on Northlight](./guides/apps-on-northlight.md) | Building and registering an app against production (joining a laptop, `crtr cloud apps` registration, keys, env file, scopes, running locally, the `crtr cloud apps` commands); typed results from app runs with `runs.parse`, declines, bounding a run, `run_idle`, and waiting on a provider your app requires |
87
87
  | [Apps with many users](./guides/apps-with-many-users.md) | Per-person runtime connections, app-owned user access, privacy, and spending |
88
88
 
@@ -24,7 +24,7 @@ Every class below extends `APIError`, which carries `status`, `code`, `message`,
24
24
  | Condition | Class |
25
25
  |---|---|
26
26
  | SDK configuration error | `CrouterError` with `status: 0`, `code: 'crouter_error'` |
27
- | The runtime does not serve the contract level the SDK requires, or names none. The hosting router or the runtime refuses this *before* handling (the SDK sends `Crouter-Required-Contract` and a frozen `Crouter-Minimum-Runtime-Version`): nothing was accepted and no idempotency key was recorded. A runtime that predates the contract level handles the request first, and the SDK then raises after | `RuntimeVersionError` with `status: 426`, `code: 'runtime_version_unsupported'`; `requiredContract` and `runtimeContract` (or `null`) name both levels, `sdkVersion` and `runtimeVersion` stay for logging, and it is never retryable. A level is `MAJOR.MINOR`; the runtime satisfies it when it serves the same major and a minor at or above. See [Release notes](./release-notes.md) |
27
+ | The runtime does not serve the contract level the SDK requires, or names none. The hosting router or the runtime refuses this *before* handling (the SDK sends `Crouter-Required-Contract` and a frozen `Crouter-Minimum-Runtime-Version`): nothing was accepted and no idempotency key was recorded. A runtime that predates the contract level handles the request first, and the SDK then raises after | `RuntimeVersionError` with `status: 426`, `code: 'runtime_version_unsupported'`; `requiredContract` and `runtimeContract` (or `null`) name both levels, `sdkVersion` and `runtimeVersion` stay for logging, and it is never retryable. A level is `MAJOR.MINOR`; the runtime satisfies it when it serves the same major and a minor at or above. See [Release notes](https://sdk.docs.northlight.ai/docs/release-notes) |
28
28
  | HTTP 400 | `BadRequestError` |
29
29
  | HTTP 401 | `AuthenticationError` |
30
30
  | HTTP 403 | `PermissionDeniedError` |
@@ -25,7 +25,7 @@ npm i --save-exact @north-light/sdk@0.3.451
25
25
 
26
26
  One dependency. It re-exports every data type you need, so you do not also install `@north-light/api`.
27
27
 
28
- `@latest` always works against production: a release reaches `latest` only once production serves its contract level. The `next` tag carries every release the moment it is published and may need a newer runtime than production runs (see [Errors](./errors.md) for `RuntimeVersionError`). Keep the exact pin: the compatibility gate protects the wire, not the TypeScript API. To move it, check `npm view @north-light/sdk dist-tags` and read the [release notes](./release-notes.md) first.
28
+ `@latest` always works against production: a release reaches `latest` only once production serves its contract level. The `next` tag carries every release the moment it is published and may need a newer runtime than production runs (see [Errors](./errors.md) for `RuntimeVersionError`). Keep the exact pin: the compatibility gate protects the wire, not the TypeScript API. To move it, check `npm view @north-light/sdk dist-tags` and read the [release notes](https://sdk.docs.northlight.ai/docs/release-notes) first.
29
29
 
30
30
  ## 3. Node, on the owner's own daemon
31
31
 
@@ -50,7 +50,7 @@ npm init -y
50
50
  npm i --save-exact @north-light/sdk@0.3.451
51
51
  ```
52
52
 
53
- `0.3.451` is the version this guide was last checked against on production. To move on purpose, run `npm view @north-light/sdk dist-tags`, read the [release notes](../release-notes.md) for the versions in between, and install the new exact version the same way.
53
+ `0.3.451` is the version this guide was last checked against on production. To move on purpose, run `npm view @north-light/sdk dist-tags`, read the [release notes](https://sdk.docs.northlight.ai/docs/release-notes) for the versions in between, and install the new exact version the same way.
54
54
 
55
55
  Pin an exact version of `@north-light/sdk` rather than a range or `latest`. A compatibility gate between the SDK and Northlight's runtimes protects the wire, so an SDK that is too new for the runtime is refused cleanly. It does not protect the TypeScript API: a later SDK release can change a type or a method your code uses, and an unpinned install picks that up on its next `npm i`.
56
56
  If a call fails with `426 runtime_version_unsupported`, the SDK is newer than the Northlight runtimes. This can happen briefly right after a new SDK release, until production runtimes are upgraded. Install the previous version or wait, and tell Northlight at support@northlight.ai.
package/docs/sdk/nodes.md CHANGED
@@ -63,7 +63,7 @@ Wire fields are `snake_case`. Every `NodeCreateParams` property is optional; `pa
63
63
  | `description` | `string` | Display description. |
64
64
  | `parent` | node id | Graph placement. An external caller leaves this unset. |
65
65
  | `creator` | node id | Graph placement. An external caller leaves this unset. |
66
- | `scopes` | `string[]` | Per-run allow-list. Omit it to inherit every scope, or under a scoped token to receive that token's ceiling; a list outside the ceiling answers `403 scope_denied` with the offending scopes in `details.scopes`. Scopes are prefixed (`crtr:llm`, `crtr:act`, `crtr:schedule`, `crtr:memory:…`, `crtr:files:…`); `crtr:act` requires `crtr:llm`, and the list must stay inside what the creator's grant holds. Some scopes are recorded rather than enforced, per the `CreateNodeRequest` contract. See [scoped tokens](./getting-started.md#a-token-that-holds-less-than-the-owner). |
66
+ | `scopes` | `string[]` | Per-run allow-list. Omit it to inherit every scope, or under a scoped token to receive that token's ceiling; a list outside the ceiling answers `403 scope_denied` with the offending scopes in `details.scopes`. Scopes are prefixed (`crtr:llm`, `crtr:act`, `crtr:schedule`, `crtr:memory:…`, `crtr:files:…`); `crtr:act` requires `crtr:llm`, and the list must stay inside what the creator's grant holds. Provider-group scopes (`device:messages_send`) are enforced on the broker route; on an unsandboxed host a same-UID process can bypass the list by calling the daemon socket directly, so it guards against a mistaken call, not a hostile node. Keep the list short: it travels in a request header on every device call. See [scoped tokens](./getting-started.md#a-token-that-holds-less-than-the-owner). |
67
67
  | `worktree` | `string \| boolean` | Create a managed git worktree for the run. |
68
68
  | `fork_from` | `string` | Start from an existing conversation. |
69
69
  | `no_kickoff` | `boolean` | Create the node without sending the first message. |