@north-light/cli 0.3.780 → 0.3.782
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/README.md +14 -24
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +1 -1
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/charges.d.ts +1 -1
- package/dist/api/dto/charges.js +1 -1
- package/dist/api/dto/inbox.d.ts +2 -0
- package/dist/build-root.js +1 -1
- package/dist/builtin-memory/crouter-concepts/why-a-daemon.md +2 -2
- package/dist/builtin-memory/crouter-sdk/README.md +4 -3
- package/dist/builtin-memory/crouter-sdk/client.md +5 -7
- package/dist/builtin-memory/crouter-sdk/docker.md +6 -10
- package/dist/builtin-memory/crouter-sdk/getting-started.md +10 -10
- package/dist/builtin-memory/crouter-sdk/release-notes.md +19 -3
- package/dist/builtin-memory/crouter-sdk/sourcing.md +94 -0
- package/dist/builtin-memory/insights/capture.md +2 -2
- package/dist/builtin-memory/northlight-apps/cli.md +1 -1
- package/dist/builtin-memory/northlight-apps/coding-agents.md +1 -1
- package/dist/builtin-memory/northlight-apps/get-started.md +2 -2
- package/dist/builtin-memory/northlight-apps/guides/watchable-objects.md +1 -1
- package/dist/builtin-memory/northlight-apps/how-it-fits.md +1 -1
- package/dist/builtin-memory/northlight-apps/let-their-ai-use-your-app.md +1 -4
- package/dist/builtin-memory/northlight-apps/quickstart.md +1 -1
- package/dist/cli.js +2 -2
- package/dist/clients/attach/command.js +1 -1
- package/dist/clients/attach/input/capabilities.js +1 -1
- package/dist/clients/attach/viewer.js +458 -458
- package/dist/clients/inbox/controller.d.ts +34 -11
- package/dist/clients/inbox/controller.js +1 -1
- package/dist/clients/inbox/dto-adapt.d.ts +1 -0
- package/dist/clients/inbox/dto-adapt.js +1 -1
- package/dist/clients/inbox/surface.js +1 -1
- package/dist/commands/canvas-config.js +2 -2
- package/dist/commands/canvas-use.js +1 -1
- package/dist/commands/node/inspect.js +6 -6
- package/dist/commands/profile/default.js +1 -1
- package/dist/commands/sys/signin.d.ts +1 -1
- package/dist/commands/sys/signin.js +3 -3
- package/dist/core/command.d.ts +1 -2
- package/dist/core/command.js +6 -6
- package/dist/core/human/requests.d.ts +2 -0
- package/dist/core/human/requests.js +18 -18
- package/dist/core/providers/call.js +1 -1
- package/dist/core/runtime/broker/cli-relay.d.ts +0 -2
- package/dist/core/runtime/broker/cli-relay.js +1 -1
- package/dist/core/runtime/broker/run-turn-queue.js +1 -1
- package/dist/core/runtime/broker/turn-cause.d.ts +2 -0
- package/dist/core/runtime/broker/turn-cause.js +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/router.js +1 -1
- package/dist/daemon/machine-link/config.d.ts +2 -4
- package/dist/daemon/machine-link/config.js +4 -4
- package/dist/daemon/manage.js +2 -2
- package/dist/daemon/postgres/cluster.d.ts +3 -3
- package/dist/daemon/postgres/cluster.js +5 -5
- package/dist/daemon/postgres/supervisor.js +1 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
- package/docs/apps/cli.md +1 -1
- package/docs/apps/coding-agents.md +1 -1
- package/docs/apps/get-started.md +2 -2
- package/docs/apps/guides/watchable-objects.md +1 -1
- package/docs/apps/how-it-fits.md +1 -1
- package/docs/apps/let-their-ai-use-your-app.md +1 -4
- package/docs/apps/quickstart.md +1 -1
- package/docs/cli/first-session.md +2 -2
- package/docs/concepts/why-a-daemon.md +2 -2
- package/docs/sdk/README.md +4 -3
- package/docs/sdk/client.md +5 -7
- package/docs/sdk/docker.md +5 -9
- package/docs/sdk/getting-started.md +10 -10
- package/docs/sdk/release-notes.md +19 -3
- package/docs/sdk/sourcing.md +91 -0
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/client.js +2 -2
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/dto/charges.js +1 -1
- package/packages/crouter-api/dist/daemon/machine-link/config.js +3 -5
- package/packages/crouter-api/dist/daemon/manage.js +3 -3
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/scripts/install-runtime.mjs +1 -1
- package/dist/core/northlight/previews.d.ts +0 -22
- package/dist/core/northlight/previews.js +0 -1
|
@@ -9,6 +9,22 @@ when-and-why-to-read: When you need Release notes, this knowledge should be read
|
|
|
9
9
|
|
|
10
10
|
Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
|
|
11
11
|
|
|
12
|
+
## 0.3.781
|
|
13
|
+
|
|
14
|
+
`sourcing.read` and `SOURCING_RUN_RULE`. Additive: no request or response an existing app sends or reads changes.
|
|
15
|
+
|
|
16
|
+
- `sourcing.read(client, request, options?)` reads from the person's Mac (or their GitHub account) first and Northlight's hosted `search` second, and resolves `{served_by, data, cost_usd?, fallback_reason?}`. LinkedIn reads have no hosted path. See [sourcing](/docs/reference/sourcing).
|
|
17
|
+
- `SourcingUnavailableError` (`code: 'sourcing_unavailable'`, status 503, with `attempts`, `retryAt`, `budget`) is raised when no path can serve the read now.
|
|
18
|
+
- `SOURCING_RUN_RULE` is the same rule as text for run prompts that hold `device:browser`.
|
|
19
|
+
|
|
20
|
+
### `payment.reason` can be `account_held`
|
|
21
|
+
|
|
22
|
+
`PaymentRefusalDTO.reason` now lists `account_held`, which the directory already sent while a new account waits for approval. Treat it like any refusal the person cannot fix by paying: show `message`, no link.
|
|
23
|
+
|
|
24
|
+
`GET /v1/human/inbox?include=page`. Additive: without the query the response is unchanged.
|
|
25
|
+
|
|
26
|
+
- With `include=page`, each page ticket carries an optional `page` field holding the same body `GET /v1/human/inbox/:ticket_id` returns, so a client can open every listed page without a read per page. A page that cannot be read is listed without `page`.
|
|
27
|
+
|
|
12
28
|
## 0.3.759
|
|
13
29
|
|
|
14
30
|
### A grant can hold a whole provider as `<provider>:*`
|
|
@@ -333,7 +349,7 @@ Every other `canvas` method and `customObjects.receive`/`ack` remain absent from
|
|
|
333
349
|
- `definePlugin({objectKinds})` declares canvas object kinds by name relative to the plugin (`repo`), each `{ description, events: { <name>: { level: 1-10, supersedes? } }, read?: { command: [...] } }`. The bundle the kit serves carries them in `bundle.json` `object_kinds`, keyed `<providerId>.<name>`: `providerId` is the `auth.providerId` the handler was given, else the plugin name. `definePlugin` throws `PluginDefinitionError` for a relative name that is not lowercase letters, digits and `-`, a blank description, more than 64 events, a level outside 1-10, and a `read.command` that is not a non-streaming leaf of the plugin. Building the bundle throws if the prefixed kind is not one crouter accepts (a provider id with capitals or `_`, or one of crouter's reserved roots such as `repo` or `report`).
|
|
334
350
|
- `ctx.caller.crtr` carries the calling node: `{ node?, machine?, profile?, run? }`, parsed by the exported `parseCrtrCaller(header)` from the request's `Crtr-Caller`. It is absent when the header names no field. The runtime asserts that header and the bearer token does not cover it, so use it to tell which of the verified `sub`'s nodes called, never to authorize; authorize on `sub`.
|
|
335
351
|
|
|
336
|
-
See
|
|
352
|
+
See Local plugins and Object kinds and the calling node.
|
|
337
353
|
|
|
338
354
|
### `nodes.revive` reports `ready` (additive)
|
|
339
355
|
|
|
@@ -377,7 +393,7 @@ Plugins can now declare canvas object kinds and act on the canvas, and an app to
|
|
|
377
393
|
|
|
378
394
|
### Plugin manifests declare `object_kinds` and `scopes` (additive)
|
|
379
395
|
|
|
380
|
-
`plugin.json` and `bundle.json` take two optional top-level blocks. `object_kinds` maps a kind name (`<plugin>.<name>`, so the first segment is the plugin's own name) to `{ description, events, read? }`: `events` holds up to 64 entries `{ level: 1-10, supersedes?: boolean }`, and `read.command` is a leaf path below the plugin's root command. That leaf must answer once: a leaf declared `rest.streaming: true` is refused as a `read.command`. `scopes` lists the canvas scopes the plugin asks for. A provider bundle may not declare `scopes`: a cloud app's scopes come from directory consent. Install, update and enable refuse an invalid block and keep the installed version; a kind another owner already holds is reported as `kind_owned` and the plugin's other kinds still apply. `crtr pkg plugin install|update|enable` print these as `warnings`, plus `appScopes` (the scopes the plugin's token now carries). Plugin authors: see
|
|
396
|
+
`plugin.json` and `bundle.json` take two optional top-level blocks. `object_kinds` maps a kind name (`<plugin>.<name>`, so the first segment is the plugin's own name) to `{ description, events, read? }`: `events` holds up to 64 entries `{ level: 1-10, supersedes?: boolean }`, and `read.command` is a leaf path below the plugin's root command. That leaf must answer once: a leaf declared `rest.streaming: true` is refused as a `read.command`. `scopes` lists the canvas scopes the plugin asks for. A provider bundle may not declare `scopes`: a cloud app's scopes come from directory consent. Install, update and enable refuse an invalid block and keep the installed version; a kind another owner already holds is reported as `kind_owned` and the plugin's other kinds still apply. `crtr pkg plugin install|update|enable` print these as `warnings`, plus `appScopes` (the scopes the plugin's token now carries). Plugin authors: see Local plugins.
|
|
381
397
|
|
|
382
398
|
`ReconcilePackagesDTO` (the answer of `POST /v1/documents/reconcile-packages`) gains two optional fields: `kinds` (`applied` with `outcome` of `inserted`, `updated` or `unchanged`; `refused` with code `kind_owned`; `invalid` plugins with the reason) and `tokens` (`granted` plugins with their scopes, and `revoked` plugin names).
|
|
383
399
|
|
|
@@ -402,7 +418,7 @@ Each enabled local plugin that declares `object_kinds` or `scopes`, or serves ov
|
|
|
402
418
|
|
|
403
419
|
### `Crtr-Caller` and `Crtr-Signature` on local HTTP calls (additive)
|
|
404
420
|
|
|
405
|
-
Every HTTP call to a plugin carries `Crtr-Caller: node=<id>; machine=<id>; profile=<id>; run=<id>` (fields in that order, empty ones left out, header omitted when none). Calls to a local plugin's endpoint origin also carry `Crtr-Signature: v1,t=<unix seconds>,h=<signed header names>,sig=<base64url HMAC-SHA256 keyed by the plugin's token>` plus a fresh `Crtr-Request-Id`. A manifest cannot set these three header names. Provider calls carry `Crtr-Caller` too. Plugin authors: the canonical string and a reference verifier are in
|
|
421
|
+
Every HTTP call to a plugin carries `Crtr-Caller: node=<id>; machine=<id>; profile=<id>; run=<id>` (fields in that order, empty ones left out, header omitted when none). Calls to a local plugin's endpoint origin also carry `Crtr-Signature: v1,t=<unix seconds>,h=<signed header names>,sig=<base64url HMAC-SHA256 keyed by the plugin's token>` plus a fresh `Crtr-Request-Id`. A manifest cannot set these three header names. Provider calls carry `Crtr-Caller` too. Plugin authors: the canonical string and a reference verifier are in Local plugins.
|
|
406
422
|
|
|
407
423
|
crtrd signs the call; the CLI never holds the token. `POST /v1/plugins/:name/call-headers` (new operation `plugins.call-headers`, person and broker callers) takes only digests, `{ method, url, body_sha256, header_names, headers_sha256 }`, and answers `{ headers }` (`Crtr-Caller`, and `Crtr-Signature` when the URL is on the installed endpoint's origin and that endpoint is loopback). Any other URL gets `Crtr-Caller` only. An unknown or disabled plugin and a provider plugin answer `404 not_found`; malformed digests answer `400 invalid_request`. SDK: `CrtrClient.plugins.callHeaders(name, request)`, `PluginCallHeadersRequestDTO`, `PluginCallHeadersDTO`, `routes.pluginCallHeaders(name)`.
|
|
408
424
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: knowledge
|
|
3
|
+
when-and-why-to-read: When you need Sourcing reads, this knowledge should be
|
|
4
|
+
read because Read a person, company or page from the person's own Mac first,
|
|
5
|
+
then from Northlight's hosted search, with one result shape and one "not now"
|
|
6
|
+
error.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Sourcing reads
|
|
10
|
+
|
|
11
|
+
`sourcing.read(client, request, options?)` reads one thing about a person, company or page. It tries the person's own Mac (or their linked GitHub account) first. When that path cannot be used now, it tries Northlight's hosted `search` provider, which Northlight pays for up to the app's caps. It never writes, never sleeps and never retries.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { sourcing, SourcingUnavailableError } from '@north-light/sdk';
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const r = await sourcing.read(runtime, { read: 'github.user', login: 'octocat' }, { scopes: grantedScopes });
|
|
18
|
+
// r.served_by: 'device' | 'integrations' | 'hosted'
|
|
19
|
+
// r.data, r.cost_usd? (hosted only), r.fallback_reason? (hosted only: why path 1 did not serve it)
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error instanceof SourcingUnavailableError) {
|
|
22
|
+
// error.attempts, error.retryAt (ISO or null), error.budget, error.retryable
|
|
23
|
+
} else throw error;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`client` is anything with `providers.call`: a `Crouter` or the client from `oauth.appClient(userId)`. The app's grant needs `device:browser` for Mac reads, `integrations:github_read` for GitHub, and the `search` scopes for hosted reads (`search:search`, `search:contents`, `search:answer`, `search:people`).
|
|
28
|
+
|
|
29
|
+
## Route table
|
|
30
|
+
|
|
31
|
+
| `read` | Path 1 | Path 2 (hosted `search`) |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `linkedin.profile`, `linkedin.search`, `linkedin.company` | Mac, `@northlight/linkedin` `getProfile`, `searchPeople`, `getCompany` | **none** |
|
|
34
|
+
| `x.profile` | Mac, `@northlight/x` `getProfile` | `people x-profile` |
|
|
35
|
+
| `x.search` | Mac, `@northlight/x` `searchUsers` | none |
|
|
36
|
+
| `x.posts` | Mac, `@northlight/x` `searchPosts` | `search` with `include-domains x.com` |
|
|
37
|
+
| `github.user` | `integrations` `github read` (the person's own GitHub account) | `people github-user` |
|
|
38
|
+
| `github.repos` | `integrations` `github read` | none (a profile is not a repo list) |
|
|
39
|
+
| `web.search`, `web.contents`, `web.answer` | none | `search`, `contents`, `answer` |
|
|
40
|
+
| `email.work` | none | `people work-email` |
|
|
41
|
+
|
|
42
|
+
There is no hosted LinkedIn path. A LinkedIn read the Mac cannot serve ends in `sourcing_unavailable`; retry at `retryAt` once the Mac is back or the limit window passes.
|
|
43
|
+
|
|
44
|
+
## The rule
|
|
45
|
+
|
|
46
|
+
Path 1 is skipped, with no call, when `options.scopes` is given and lacks the scope for that path, or when `options.browser === false` (the app's last device probe found no Chrome). The attempt is recorded as `skipped:no_scope` or `skipped:no_browser`.
|
|
47
|
+
|
|
48
|
+
| Path 1 returns | Result |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `device_offline`, `device_timeout`, `provider_not_connected`, `machine_required`, `helper_not_installed`, `browser_profile_not_open` | Fall through (the Mac cannot be used now) |
|
|
51
|
+
| `site_signed_out`, `wrong_site` | Fall through (not signed in to the site) |
|
|
52
|
+
| `rate_limited` | Fall through; `retry_after_s` is carried to `retryAt` |
|
|
53
|
+
| `lib_broken` | Fall through |
|
|
54
|
+
| `account_not_linked`, `account_reconnect_required` (GitHub) | Fall through |
|
|
55
|
+
| `js_exception`, `outcome_unknown` | Fall through. Reads never return `outcome_unknown`; it is treated as `js_exception`. A `js_exception` whose message names the site function's `NotFound`, `Validation` or `PermissionDenied` is the answer instead |
|
|
56
|
+
| `not_found`, `invalid_argument`, `permission_error`, `scope_missing`, and any code not listed | **Thrown as is.** The person does not exist, the input is bad, or the grant is wrong |
|
|
57
|
+
|
|
58
|
+
| Hosted returns | Result |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `limit_reached`, `payment_required`, `cap_exhausted` (HTTP 402) | Stop: `SourcingUnavailableError` with `budget: true`; `retryAt` is the refusal's `reset_at` |
|
|
61
|
+
| `provider_rate_limited`, `provider_capacity`, `vendor_unavailable` | `SourcingUnavailableError`, retryable, `retryAt` from `retry_after_s` |
|
|
62
|
+
| `price_over_maximum` | Stop: thrown as is |
|
|
63
|
+
| anything else | Thrown as is |
|
|
64
|
+
|
|
65
|
+
## `SourcingUnavailableError`
|
|
66
|
+
|
|
67
|
+
`code: 'sourcing_unavailable'`, `status: 503`. Retryable when any attempt was transient.
|
|
68
|
+
|
|
69
|
+
| Field | Meaning |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `attempts` | One entry per path tried or skipped: `{path, code, retry_after_s?, reset_at?}` |
|
|
72
|
+
| `retryAt` | ISO time of the earliest `retry_after_s` or `reset_at` across the attempts, or `null` |
|
|
73
|
+
| `budget` | `true` when the hosted refusal was a 402 |
|
|
74
|
+
|
|
75
|
+
The app decides what to do: leave the work queued, show "Mac offline and hosted budget used up", and try again after `retryAt`.
|
|
76
|
+
|
|
77
|
+
## Options
|
|
78
|
+
|
|
79
|
+
| Option | Use |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `scopes` | The scopes the grant holds, so a path without its scope is skipped without a call |
|
|
82
|
+
| `browser` | `false` skips the Mac path (the app's last probe found no Chrome) |
|
|
83
|
+
| `machine` | Which Mac takes the device calls, when the person has more than one |
|
|
84
|
+
| `githubAccount` | The linked GitHub account label, when the person has several |
|
|
85
|
+
| `execTimeoutMs` | The Mac script budget (default 30000) |
|
|
86
|
+
| `signal` | Aborts the read |
|
|
87
|
+
|
|
88
|
+
## Cost and logging
|
|
89
|
+
|
|
90
|
+
Device and integrations reads cost Northlight nothing and are not metered. `served_by` says which path answered; for `hosted`, `cost_usd` is the top-level `cost_usd` of the hosted answer (dollars), when the leaf returns one. Add it to your own per-pass cost.
|
|
91
|
+
|
|
92
|
+
## Rule text for agent runs
|
|
93
|
+
|
|
94
|
+
`SOURCING_RUN_RULE` is the same rule written for an agent. Append it to the prompt of any run that holds `device:browser`, so a run that reads LinkedIn with `crtr device browser` follows the same fall-through, no-hosted-LinkedIn and stop rules.
|
|
@@ -36,7 +36,7 @@ Write the proposal as a small document with `crtr doc write` and submit it with
|
|
|
36
36
|
- <Another plausible formulation only when the deeper principle is uncertain.>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`destination` and `visibility` are proposals to approve, never questions to ask: decide both and state the reason. Quote only enough of the user's words in `source` for them to judge the inference. Candidate bullets are hypotheses, not polished prose: several alternatives are allowed when the deeper principle is uncertain; do not pad, explain every bullet, or hide uncertainty in a long essay.
|
|
39
|
+
`destination` and `visibility` are proposals to approve, never questions to ask: decide both and state the reason. Quote only enough of the user's words in `source` for them to judge the inference; quotes belong there and nowhere else. Write each candidate bullet as a general truth with no literal examples — no quotes of the user, no specific UI strings or names, no episode details — because a principle must apply broadly, and a later agent cannot make sense of an example from an episode it never saw. Candidate bullets are hypotheses, not polished prose: several alternatives are allowed when the deeper principle is uncertain; do not pad, explain every bullet, or hide uncertainty in a long essay.
|
|
40
40
|
|
|
41
41
|
The review is asynchronous. Continue unrelated work or wait dormant, but do not finish while this review is outstanding. An approval settles only this candidate; do not recapture it as a new insight unless the user introduces a genuinely separate principle.
|
|
42
42
|
|
|
@@ -44,6 +44,6 @@ The review is asynchronous. Continue unrelated work or wait dormant, but do not
|
|
|
44
44
|
|
|
45
45
|
Apply direct line edits and explicit comments. If feedback requires a materially new formulation, update the open review document or submit a replacement review; review the revised formulation before writing it. If no candidate survives, save nothing.
|
|
46
46
|
|
|
47
|
-
Run `crtr doc write -h` for the writing contract, then reach only the approved destination — `crtr doc write --owner <owner>` to create it, `crtr doc edit` to revise one that exists. A new principle is normally knowledge, and a preference only when its use is behavioral; give it no delivery rule unless review approves a boot rule. Keep its body to the approved truth, any material boundary, and the concise why. Update the selected active listener or organizing router with the canonical link without duplicating the principle.
|
|
47
|
+
Run `crtr doc write -h` for the writing contract, then reach only the approved destination — `crtr doc write --owner <owner>` to create it, `crtr doc edit` to revise one that exists. A new principle is normally knowledge, and a preference only when its use is behavioral; give it no delivery rule unless review approves a boot rule. Keep its body to the approved truth, any material boundary, and the concise why, with no literal examples from the episode. Update the selected active listener or organizing router with the canonical link without duplicating the principle.
|
|
48
48
|
|
|
49
49
|
Source context and agent reasoning stay only in the review document. Do not copy them into the principle's body or fields. Run `crtr doc lint` after every create or rewrite and fix every finding.
|
|
@@ -23,7 +23,7 @@ With no dependencies installed, `npx` downloads the newest published release of
|
|
|
23
23
|
| `npx @north-light/sdk register [--name <text>] [--scope <scope>]... [--logo <url>] [--justification <text>] [--redirect-uri <uri>]... [--issuer <url>]` | Run in a project made by `init`, after `login`: registers the app with the public key from `local/app-key.json`, adds each `--scope` beyond `crtr:llm crtr:act`, and writes `CROUTER_CLIENT_ID` and `CROUTER_ISSUER` to `local/app.env`. | No |
|
|
24
24
|
| `npx @north-light/sdk apps <leaf> [--app <client id>] [--issuer <url>] [leaf flags] [--json]` | Call one app-management leaf with the login and print its answer as JSON. Leaves: `mine`, `get`, `update`, `set-logo --file <path>`, `set-brand-color --color <#rrggbb|none>`, `set-redirect-uris`, `asks`, `set-scopes`, `set-requires`, `set-run-notice-url`, `keys list\|add\|retire\|delete\|set-jwks-uri\|remove-jwks-uri`, `testers list\|add\|remove`. `--app` defaults to `CROUTER_CLIENT_ID` in `local/app.env`; `keys add` takes `--key-file <path>` and sends only the public half. Deleting an app, its marketplace listing, monthly spend cap, sharing and provider role are console-only: those leaves exit 1 and name the console page, with no request. | No |
|
|
25
25
|
|
|
26
|
-
`keygen` and `env` are the only commands that can call `crtr`, and only with `--app`. The rest of this site never uses `--app`, so crtr is optional
|
|
26
|
+
`keygen` and `env` are the only commands that can call `crtr`, and only with `--app`. The rest of this site never uses `--app`, so crtr is optional. `login`, `logout`, `whoami`, `register` and `apps` call only the Northlight directory.
|
|
27
27
|
|
|
28
28
|
## Details
|
|
29
29
|
|
|
@@ -8,7 +8,7 @@ when-and-why-to-read: When you need Use your coding agent, this knowledge should
|
|
|
8
8
|
|
|
9
9
|
# Use your coding agent
|
|
10
10
|
|
|
11
|
-
The `northlight` skill teaches a coding agent the whole path in the [[northlight-apps/quickstart]]: the commands, the code patterns and the rules. With it, your agent signs you up, logs in, registers the app and runs it, and you choose **Allow** twice in your browser: once on the login page, once on the app's consent page. `npx @north-light/sdk init` installs it into your project. The skill needs no account to install, and works
|
|
11
|
+
The `northlight` skill teaches a coding agent the whole path in the [[northlight-apps/quickstart]]: the commands, the code patterns and the rules. With it, your agent signs you up, logs in, registers the app and runs it, and you choose **Allow** twice in your browser: once on the login page, once on the app's consent page. `npx @north-light/sdk init` installs it into your project. The skill needs no account to install, and works on any machine.
|
|
12
12
|
|
|
13
13
|
## Install it
|
|
14
14
|
|
|
@@ -45,7 +45,7 @@ Then pick what your app does from the sections in the sidebar: [[northlight-apps
|
|
|
45
45
|
|
|
46
46
|
## Run `crtr cloud apps` yourself
|
|
47
47
|
|
|
48
|
-
Everything on this site works with the SDK's own commands and the web console.
|
|
48
|
+
Everything on this site works with the SDK's own commands and the web console. You can also sign your Mac in to your Northlight account with the `crtr` CLI and manage your apps with `crtr cloud apps`. The agents that run commands there run on Northlight; your Mac is a machine they can use.
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npm i -g @north-light/cli@latest
|
|
@@ -53,4 +53,4 @@ crtr sys signin
|
|
|
53
53
|
crtr cloud apps mine
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
`crtr sys signin` asks you to approve once in your browser. The
|
|
56
|
+
`crtr sys signin` asks you to approve once in your browser. The CLI is [`@north-light/cli`](https://www.npmjs.com/package/@north-light/cli) on npm.
|
|
@@ -10,7 +10,7 @@ when-and-why-to-read: When you need Watchable objects, this knowledge should be
|
|
|
10
10
|
|
|
11
11
|
`PostgresObjectStore` from `@north-light/sdk/stores/postgres` keeps one canvas object per person for each thing in your app (a problem, a ticket, a workspace), links the person's nodes to it, and delivers events to it from a database outbox. An agent that runs `crtr <your-plugin> thing watch T-12` then receives the events you publish for T-12.
|
|
12
12
|
|
|
13
|
-
Your app declares the object kinds and their events in its plugin with `definePlugin({objectKinds})
|
|
13
|
+
Your app declares the object kinds and their events in its plugin with `definePlugin({objectKinds})`. The store registers objects of those kinds. Install `pg` in your app.
|
|
14
14
|
|
|
15
15
|
## Create the tables
|
|
16
16
|
|
|
@@ -44,6 +44,6 @@ The person's AI subscription pays for model calls, and what your app may do on t
|
|
|
44
44
|
|
|
45
45
|
## What you operate
|
|
46
46
|
|
|
47
|
-
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.
|
|
47
|
+
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.
|
|
48
48
|
|
|
49
49
|
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.
|
|
@@ -57,11 +57,8 @@ A group's `who` says who may be granted it: `own` (only your own app), `user` (t
|
|
|
57
57
|
|
|
58
58
|
## Guides
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
The plugin kit `@north-light/plugin` adds commands to the Northlight runtime.
|
|
61
61
|
|
|
62
62
|
| Page | What it covers |
|
|
63
63
|
|---|---|
|
|
64
|
-
| [Plugin docs](https://crouter.docs.northlight.ai/docs/plugin) | What `@north-light/plugin` does and how a plugin is installed |
|
|
65
|
-
| [Commands](https://crouter.docs.northlight.ai/docs/plugin/commands) | Branches, leaves, parameters, outputs, groups and `who` |
|
|
66
|
-
| [Deploying](https://crouter.docs.northlight.ai/docs/plugin/deploying) | `auth: {issuer, audience, providerId}`, `ctx.caller`, versions and breaking changes |
|
|
67
64
|
| [[northlight-apps/guides/manage-your-app]] | The console's **Provider** tab beside the others |
|
|
@@ -11,7 +11,7 @@ when-and-why-to-read: When you need Quick setup, this knowledge should be read
|
|
|
11
11
|
npx @north-light/sdk@latest init my-app
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
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.
|
|
14
|
+
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.
|
|
15
15
|
|
|
16
16
|
You need Node.js 20.6 or later (the start command uses `--env-file`) and a phone that can receive iMessage. The server was run on Node 20.6, 20.20, 22.14, 22.22 and 26.12.
|
|
17
17
|
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var R=Object.defineProperty;var n=(r,o)=>R(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as _,openSync as
|
|
2
|
+
var R=Object.defineProperty;var n=(r,o)=>R(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as _,openSync as I,readFileSync as b,renameSync as E,rmSync as C,statSync as u,writeFileSync as k}from"node:fs";import{dirname as g,join as s}from"node:path";import{enableCompileCache as O}from"node:module";import{fileURLToPath as h}from"node:url";import{isDaemonControlInvocation as m,isJoinInvocation as A,isPkgInstallInvocation as $,isSignInInvocation as N,personOnlyInvocation as P,resolveDaemonControlRoot as x,resolveRoot as T}from"./build-root.js";import{maybeBootRoot as F}from"./core/runtime/front-door.js";import{maybeAutoUpdate as D}from"./core/auto-update.js";import{ensureProjectScope as j}from"./core/bootstrap.js";import{provisionExports as U,pruneLegacyExports as B}from"./core/host-exports/export.js";import{revalidateBundlePlugins as L}from"./core/command-plugins/revalidate.js";import{runCli as M}from"./core/command.js";import{dispatchWithStaleRecovery as J}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as K}from"./core/stdout-errors.js";import{handle as V}from"./core/io.js";import{CrtrError as w,ownerOnly as G}from"./core/errors.js";import{runtimeRoot as W}from"./core/layout.js";import{ApiError as v}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as q,providerProjectionOverBrokerRelay as y,sandboxCliNodeId as z}from"./shared/env.js";import{nodeRunDir as f}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as H}from"./core/config.js";I(h(import.meta.url),"r"),K(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{O()}catch{}i("cli.compile_cache");const Q=s(g(h(import.meta.url)),".."),l=s(W(),"first-run.json");function a(r){return(r instanceof Error?r.message:String(r)).split(/\r?\n/,1)[0]??""}n(a,"errorMessage");function X(r){const o=g(l);_(o,{recursive:!0});const t=`${l}.${process.pid}.${Date.now()}.tmp`;try{k(t,JSON.stringify({packageVersion:r,completedAt:new Date().toISOString()})+`
|
|
3
3
|
`,"utf8"),E(t,l)}finally{C(t,{force:!0})}}n(X,"writeFirstRunMarker");async function Y(){if(process.env.CRTR_NO_AUTO_INIT==="1")return;try{if(u(l,{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile marker check failed: ${a(o)}
|
|
4
4
|
`);return}try{if(u(s(Q,".git"),{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile source check failed: ${a(o)}
|
|
5
5
|
`);return}let r;try{const{reconcileFirstRun:o}=await import("./commands/sys/setup-core.js");r=await o((t,c)=>{process.stderr.write(`crtr: first-run reconcile ${t} failed: ${a(c)}
|
|
6
6
|
`)})}catch(o){process.stderr.write(`crtr: first-run reconcile failed: ${a(o)}
|
|
7
7
|
`)}finally{if(r!==void 0)try{X(r)}catch(o){process.stderr.write(`crtr: first-run reconcile marker failed: ${a(o)}
|
|
8
|
-
`)}}}n(Y,"maybeReconcileFirstRun");async function Z(){const r=z(),o=r!==void 0;if(r!==void 0){process.env.CRTR_API_SOCKET=s(f(r),"cli.sock");const e=
|
|
8
|
+
`)}}}n(Y,"maybeReconcileFirstRun");async function Z(){const r=z(),o=r!==void 0;if(r!==void 0){process.env.CRTR_API_SOCKET=s(f(r),"cli.sock");const e=P(process.argv);if(e!==null)throw G(`crtr ${e} is not available to an app's node`,"Run this command from the person's terminal.");const p=JSON.parse(b(q(f(r))??s(f(r),"broker-launch.json"),"utf8"));if(!p.configSnapshot)throw new Error("node launch is missing its config snapshot");H(p.configSnapshot)}const t=n(async()=>(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}}),"installEmptySettings");if(!o&&(await import("./commands/api-client.js")).usesRunToken())await t();else if(!o&&!y()&&(await import("./daemon/machine-link/config.js")).computerIsNotSignedIn()&&!m(process.argv))await t();else if((!o||$(process.argv))&&!m(process.argv)&&!A(process.argv)&&!N(process.argv)){try{o||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi(),o||await(await import("./core/scoped-state/imported-mac-installs.js")).migrateLegacyInstallsOnce()}catch(e){const p=process.argv.slice(2).some(d=>d==="-h"||d==="--help"),S=e instanceof v&&(e.code==="daemon_unavailable"||e.code==="northlight_unreachable")||e instanceof w&&(e.code==="daemon_generation_mismatch"||e.code==="not_signed_in"||e.code==="northlight_unreachable");if(!(p&&S))throw e;await t()}i("cli.settings_loaded")}if(o||(B(process.argv),y()||await Y()),await F(process.argv),i("cli.front_door_passed"),m(process.argv)){await M(await x(),process.argv);return}o||await L(process.argv),i("cli.plugins_revalidated");const c=await T(process.argv[2]);i("cli.root_resolved"),o||(U(c,process.argv),await j(process.argv),await D(process.argv)),i("cli.dispatch_start"),await J(c,process.argv),i("cli.dispatch_done")}n(Z,"main"),Z().catch(r=>{(r instanceof Error&&r.name==="AbortError"||r instanceof Error&&/operation was aborted/i.test(r.message))&&(process.stderr.write(`crtr: Interrupted
|
|
9
9
|
`),process.exit(130)),(r instanceof v||r instanceof w)&&(V(r),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const t=r instanceof Error?r.message:String(r);process.stderr.write(`crtr: ${t}
|
|
10
10
|
`),process.exit(1)});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var n=(t,e)=>c(t,"name",{value:e,configurable:!0});import{defineBranch as h,defineLeaf as l}from"../../core/command.js";import{mark as
|
|
1
|
+
var c=Object.defineProperty;var n=(t,e)=>c(t,"name",{value:e,configurable:!0});import{defineBranch as h,defineLeaf as l}from"../../core/command.js";import{mark as o}from"../../core/timing.js";function v(t){return l({name:"to",description:"attach an interactive terminal viewer to a node (reviving it if dormant)",whenToUse:"you want to WATCH or DRIVE a headless node live in this pane \u2014 it connects over the node's unix socket to the broker hosting the engine and renders the same chat stream. Attaches are writable by default, remote ones included (a remote canvas admits a writer only with message permission on the node); use --observer for read-only. A DORMANT node is revived first: crtrd runs reviveNode server-side, then the viewer streams over the broker's socket. The configured detach shortcuts leave the engine running",help:{name:`${t} attach to`,summary:"attach a terminal viewer to a headless node's running broker (writable by default, --observer for read-only); configured detach shortcuts leave the engine running",params:[{kind:"positional",name:"node",required:!0,constraint:"Node id to attach to. A dormant node is revived (server-side) before the viewer connects."},{kind:"flag",name:"observer",type:"bool",required:!1,default:!1,constraint:"Attach READ-ONLY: request the observer role (needs only read permission). Default attaches, local or --canvas, request the writable controller role."},{kind:"flag",name:"canvas",type:"string",required:!1,constraint:"Attach against a remote canvas target configured via `crtr canvas config add` instead of the default account canvas \u2014 connects over a relayed WebSocket to the target's preview endpoint using the relay token from the 0600 secrets store. A remote attach is writable by default and needs message permission on the node; with read permission only, the attach is refused and --observer is required. Omit for the default: connects to the node's local unix socket on THIS computer, for a node whose broker runs here. Does NOT honor `crtr canvas use` \u2014 this flag is the only way to attach remotely."}],output:[{name:"note",type:"string",required:!1,constraint:"Only set on the non-TTY/piped path (a static notice); the interactive path returns nothing."}],outputKind:"object",effects:["Takes over the current pane in raw mode and renders the node's live engine stream until you use a configured detach shortcut or the broker exits.","As a writable controller: sends prompts/steers/dialog answers to the engine over the socket. As observer: read-only. Multiple writable viewers may drive the same broker.","A dormant node is revived server-side (crtrd runs reviveNode) before the viewer connects; this LOCAL process NEVER spawns pi and NEVER writes the session \u2014 it holds only a socket to the broker.","Outside a TTY (piped): prints a short notice and exits 0 \u2014 attach is an interactive program, not a pipe stage."]},run:n(async e=>{const r=e.node,a=e.observer??!1,s=e.canvas,i=process.env.CRTR_ATTACH_WAKE_PARKED!=="0";if(delete process.env.CRTR_ATTACH_WAKE_PARKED,!process.stdout.isTTY)return{note:`crtr surface attach is an interactive terminal viewer \u2014 run it in a tmux pane (a TTY), not a pipe. Node: ${r}`};o("viewer.bundle_import_start");const{runAttach:d}=await import("./viewer.js");o("viewer.bundle_loaded"),await d(r,a,s,i),process.exit(process.exitCode??0)},"run"),render:n(e=>e.note!==void 0?String(e.note):"","render")})}n(v,"attachToLeaf");function w(t,e){return h({name:"attach",description:"a terminal viewer for a headless node \u2014 connect over its socket and drive (or watch) the live engine",whenToUse:"you want to open a headless node live in this pane \u2014 watch its engine stream and drive it by typing, without the node ever running pi in your window. A dormant node is revived server-side (crtrd runs reviveNode) before the viewer connects over a unix socket; this local process never starts the engine itself. Configured detach shortcuts leave the engine running.",tier:e,rootEntry:{concept:"a terminal viewer for a headless node \u2014 connect over its socket and drive (or watch) the live engine",desc:"attach a terminal viewer to a headless node",useWhen:"you want to open a headless node live in this pane \u2014 watch its engine stream and drive it by typing, without the node ever running pi in your window. A dormant node is revived server-side (crtrd runs reviveNode) before the viewer connects over a unix socket; this local process never starts the engine itself. Configured detach shortcuts leave the engine running."},help:{name:`${t} attach`,summary:"attach a terminal viewer to a headless node's running broker",model:`The branch opens a viewer in the current pane. A TTY is required; piped invocation prints a notice and exits. Attaches request the writable controller role, local or --canvas; --observer is read-only. Multiple writable viewers may watch and drive one broker. Configured detach shortcuts detach cleanly and the engine runs on. A dormant node is revived server-side (crtrd runs reviveNode) before the viewer connects. If the broker exits, the viewer holds the pane and auto-reconnects \u2014 through a yield/refresh relaunch, and across dormancy until the node wakes again \u2014 reporting "broker gone" and exiting only when the node is terminal (done/dead/canceled) or deleted. This local process NEVER spawns pi or writes the session \u2014 it holds only a socket to the broker. --canvas <name> is the escape hatch for a node hosted on a different machine's canvas \u2014 see the leaf's own -h.`},children:[v(t)]})}n(w,"registerAttach");export{w as registerAttach};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(e,s)=>o(e,"name",{value:s,configurable:!0});function
|
|
1
|
+
var o=Object.defineProperty;var n=(e,s)=>o(e,"name",{value:s,configurable:!0});function u(e){const s=e.remote,t=e.role,a=new Set;return s||(a.add("local-canvas-inspect"),a.add("canvas-inbox")),t==="controller"&&(a.add("engine-drive"),a.add("dequeue")),t==="controller"&&!s&&(a.add("wake-dormant"),a.add("auth"),a.add("canvas-resume"),a.add("local-host")),{role:t,remote:s,get nodeId(){return e.nodeId},profileId:e.profileId,permittedOperations:a,permits:n(r=>a.has(r),"permits"),refusal:n((r,i)=>{const c=i===void 0?"":`/${i} `;if(e.isBrokerOffline?.()===!0&&(r==="engine-drive"||r==="dequeue"||r==="auth"))return`${c}needs a live broker; this node is parked \u2014 submit a message to wake it`;if(!a.has(r))return s&&(r==="canvas-resume"||r==="local-canvas-inspect"||r==="canvas-inbox")?`${c}Not available with --canvas because it acts on this computer`:s&&t==="controller"?`${c}Not available with --canvas because it acts on this machine, not the remote node`:`${c}is not available to a read-only observer attach (--observer) \u2014 it would drive this node`},"refusal")}}n(u,"createViewerCapabilities");function l(e){switch(e.type){case"prompt":case"steer":case"follow_up":case"abort":case"bash":case"set_model":case"cycle_model":case"cycle_ladder":case"cycle_thinking":case"set_thinking_level":case"set_auto_retry":case"set_auto_compaction":case"compact":case"new_session":case"switch_session":case"fork":case"set_session_name":case"navigate_tree":case"reload":case"export":case"clone":case"share":case"reload_auth":return"engine-drive";default:return}}n(l,"viewerOperationForFrame");function f(e,s,t){if(t)switch(e){case"resume":return"canvas-resume";case"context":case"node-metadata":return"local-canvas-inspect";case"plugins":return;case"inbox":return"canvas-inbox";case"clear":case"resume-session":case"tutorial":return"engine-drive";case"recover":case"promote":case"rename":case"mcp":return"local-host";default:return}if(s)switch(e){case"copy":case"session":case"changelog":case"hotkeys":case"quit":return;case"login":case"logout":return"auth";default:return"engine-drive"}}n(f,"viewerOperationForSlash");export{u as createViewerCapabilities,l as viewerOperationForFrame,f as viewerOperationForSlash};
|