@cultured_computer/sight 0.8.1 → 0.8.3

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/CHANGELOG.md CHANGED
@@ -5,9 +5,28 @@ reconstructed from the repository: the `sdk-v*` release tags (dates are tag
5
5
  dates) and the commits between them. Where the history does not say what a
6
6
  version changed for SDK users, the entry says "see git history".
7
7
 
8
- ## Unreleased
9
-
10
- Nothing yet.
8
+ ## 0.8.3 (2026-10-06)
9
+
10
+ - `sight openrouter connect --house-trial`: marks the connection as the
11
+ operator's key connected for a demo. The server accepts it only for the
12
+ house key it has pinned; any other key is refused with `not_house_key`.
13
+
14
+ ## 0.8.2 (2026-10-06)
15
+
16
+ - `sight auth login` works again. 0.8.1 sent `client_id: undefined` (the
17
+ command dispatch ran before the constant was initialised in the bundle),
18
+ the server refused the grant, and the CLI called it a network problem. The
19
+ dispatch now runs last, a refusal is reported as the server's answer with
20
+ its status, and `--no-browser` (or `SIGHT_NO_BROWSER=1`) prints the link
21
+ without opening a browser. The server side ships beside it: the
22
+ verification link now points at the dashboard's `/device` page instead of
23
+ the auth host, where it was a 404.
24
+
25
+ - Wording only, no behavior change: a key has a role (Capture, App, Admin)
26
+ and permissions. The `403` warning now reads `[sight] this key cannot
27
+ capture (403): it lacks the ingest permission. ... Ask the project owner
28
+ for a Capture key.`, and `sight account create --openrouter` without
29
+ `providers:write` asks for an Admin key. The README says the same.
11
30
 
12
31
  ## 0.8.1 (2026-10-03)
13
32
 
package/README.md CHANGED
@@ -10,7 +10,7 @@ Full documentation: https://sight.cultured.computer/docs
10
10
  ## Requirements
11
11
 
12
12
  - Node 20.6 or later. Server-side only; never ship the key to a browser.
13
- - A Sight API key with the `ingest` capability, set as `SIGHT_API_KEY`.
13
+ - A Sight API key with the `ingest` permission (a Capture key or an App key), set as `SIGHT_API_KEY`.
14
14
  - TypeScript types, an ESM build and a CommonJS build are included.
15
15
 
16
16
  ## Install
@@ -53,15 +53,16 @@ Walkthrough: [Get started](https://sight.cultured.computer/docs/get-started).
53
53
  | Initialise once at startup | `Sight.init({ apiKey, deployment })` | Nothing is captured. `init` throws on an invalid configuration; no other Sight call throws on bad input. |
54
54
  | Scope each conversation | `Sight.withSession(id, fn)` around the model call; `id` is your conversation id | The call is not captured. The first such call in a process prints one warning. |
55
55
  | Record the person's message | `Sight.userInputSubmit(id, text)` before the model call | A wrapped OpenAI client's turn has no person's message. The span and `ai` paths read the last user message of the request. |
56
- | Use a key that may send | A key with the `ingest` capability (access `ingest`, `both` or `app`) | The API answers `403` and the turn is dropped. One warning prints. |
56
+ | Use a key that may send | A key with the `ingest` permission: a Capture key or an App key | The API answers `403` and the turn is dropped. One warning prints. |
57
57
 
58
58
  - `Sight.withSession(id, fn)` is required for autocapture.
59
59
  - `deployment` names the configuration the traffic belongs to. The API host
60
60
  defaults to `https://api.cultured.computer`; set `endpoint` only for a
61
61
  self-hosted or staging API.
62
62
  - Keys are created by a project owner on the dashboard's API Keys page and
63
- shown once. No dashboard access: ask the project owner for a key. See
64
- [Keys and access](https://sight.cultured.computer/docs/keys-and-access).
63
+ shown once. The default role, Capture, is the one the SDK needs. If you
64
+ cannot sign in to the dashboard, ask the project owner for a key. See
65
+ [API keys](https://sight.cultured.computer/docs/keys-and-access).
65
66
  - Optional: `Sight.startSession({ externalId, externalUserId })` attaches a
66
67
  stable, pseudonymous user id, which ties one person's sessions together.
67
68
 
@@ -181,7 +182,7 @@ environment variables. Secrets are read from the environment, never from a flag.
181
182
  | `sight export --project <slug> --deployment <slug>` | Writes a deployment's record as JSONL (`--out <file>`, default stdout) | `auth login`; owner role on the project |
182
183
  | `sight conditions --session <id>` | Prints one session's detector checks as NDJSON | A key with `studio:run`: `SIGHT_API_KEY`, or the key saved by `account create` |
183
184
  | `sight account create` | Redeems a one-time token and saves the key to `~/.config/sight/machine.json` (mode `0600`) | `SIGHT_PROVISION_TOKEN` |
184
- | `sight openrouter connect --budget <usd>` | Connects your OpenRouter key (`OPENROUTER_API_KEY`) to the project | A key with `providers:write` |
185
+ | `sight openrouter connect --budget <usd> [--house-trial]` | Connects your OpenRouter key (`OPENROUTER_API_KEY`) to the project; `--house-trial` marks it as the operator's key for a demo | A key with `providers:write` |
185
186
  | `sight openrouter status` | Prints the stored connection: status, last four characters, budget | A key with `studio:run` or `providers:write` |
186
187
  | `sight connect <relay-url> --invite <code>` | See [Connect your room](https://sight.cultured.computer/docs/connect-your-room) | An invite code |
187
188
 
@@ -205,7 +206,7 @@ to log every failed send as `[sight] ingest failed status=<code>`.
205
206
  | Nothing captured; stderr shows `[sight] call not captured (...): no session scope.` | The model call ran outside a session scope | Wrap it in `Sight.withSession(id, fn)` |
206
207
  | Nothing captured, no warning | The send failed with a server or network error, or the client is not on a capture path | Set `debug: true` and read the status it logs |
207
208
  | `[sight] the API rejected the key (401). Nothing is being captured.` | The key is missing, mistyped or revoked | Set `SIGHT_API_KEY` to a current key |
208
- | `[sight] this key cannot capture (403): it lacks the ingest capability.` | The key lacks the `ingest` capability | Use a key with access `ingest`, `both` or `app` |
209
+ | `[sight] this key cannot capture (403): it lacks the ingest permission.` | The key's role lacks the `ingest` permission | Use a Capture key or an App key |
209
210
  | `[sight] the API rejected a turn (400) and it was dropped.` (or `413`) | The API refused that request body | Set `debug: true` to log every failed send; check the turn's fields and size |
210
211
  | `status=429`, or one `[sight] rate limited (429)` line | Over the project's request limit (600 per minute by default). Each limited send is retried once after `Retry-After`, then dropped. | Send fewer requests per minute, or ask for a higher limit |
211
212
  | The first-session line is not printed | No turn has been accepted yet. The line prints once per process, on stderr. | Fix the rows above |
package/dist/cli.js CHANGED
@@ -16,12 +16,12 @@ function usage() {
16
16
  "sight: the command line for Sight.",
17
17
  "",
18
18
  "Usage:",
19
- " sight auth login [--base <dashboard-url>]",
19
+ " sight auth login [--base <dashboard-url>] [--no-browser]",
20
20
  " sight auth logout",
21
21
  " sight export --project <slug> --deployment <slug> [--readings|--conditions] [--out file.jsonl]",
22
22
  " sight conditions --session <id-or-external-id> [--deployment <slug>] [--run <id>] [--since <iso>] [--until <iso>] [--base <dashboard-url>]",
23
23
  " sight account create [--openrouter --budget <usd>] [--api <base>]",
24
- " sight openrouter connect --budget <usd> [--api <base>]",
24
+ " sight openrouter connect --budget <usd> [--house-trial] [--api <base>]",
25
25
  " sight openrouter status [--api <base>]",
26
26
  " sight connect <relay-url> --invite <code> [--pulse] [--api <base>]",
27
27
  "",
@@ -41,6 +41,7 @@ function usage() {
41
41
  " OPENROUTER_API_KEY Your OpenRouter key, for account create --openrouter and openrouter connect.",
42
42
  " SIGHT_API API base for account create, openrouter, connect. Default https://api.cultured.computer",
43
43
  " SIGHT_BASE Dashboard base for auth login and conditions. Default https://sight.cultured.computer",
44
+ " SIGHT_NO_BROWSER 1 prints the auth login link without opening a browser (same as --no-browser).",
44
45
  " XDG_CONFIG_HOME Directory for the stored login and key files. Default ~/.config",
45
46
  "",
46
47
  "Docs:",
@@ -99,23 +100,6 @@ async function connect(args) {
99
100
  return 0;
100
101
  }
101
102
  var DEFAULT_DASHBOARD = "https://sight.cultured.computer";
102
- var [, , command, ...rest] = process.argv;
103
- if (command === "connect") {
104
- connect(rest).then((code) => process.exit(code));
105
- } else if (command === "auth") {
106
- auth(rest).then((code) => process.exit(code));
107
- } else if (command === "account") {
108
- account(rest).then((code) => process.exit(code));
109
- } else if (command === "openrouter") {
110
- openrouter(rest).then((code) => process.exit(code));
111
- } else if (command === "export") {
112
- exportRecord(rest).then((code) => process.exit(code));
113
- } else if (command === "conditions") {
114
- conditions(rest).then((code) => process.exit(code));
115
- } else {
116
- usage();
117
- process.exit(command && command !== "--help" && command !== "-h" ? 1 : 0);
118
- }
119
103
  var CLIENT_ID = "sight-cli";
120
104
  function credentialsPath() {
121
105
  return join(process.env["XDG_CONFIG_HOME"] ?? join(homedir(), ".config"), "sight", "credentials.json");
@@ -184,7 +168,13 @@ async function connectOpenRouter(api, sightKey, args) {
184
168
  authorization: `Bearer ${sightKey}`,
185
169
  "content-type": "application/json"
186
170
  },
187
- body: JSON.stringify({ apiKey: openRouterKey, monthlyBudgetUsd: budget })
171
+ body: JSON.stringify({
172
+ apiKey: openRouterKey,
173
+ monthlyBudgetUsd: budget,
174
+ // --house-trial: the key is the operator's, connected for a demo
175
+ // (the connection says so; the dashboard card and the audit read it).
176
+ ...args.includes("--house-trial") ? { houseTrial: true } : {}
177
+ })
188
178
  }).catch((_error) => ({ __error: _error }));
189
179
  if (!response.ok) {
190
180
  const body2 = response instanceof Response ? await response.json().catch(() => ({})) : {};
@@ -235,7 +225,7 @@ async function account(args) {
235
225
  console.log(`capabilities: ${body.capabilities.join(", ") || "none"}`);
236
226
  if (!args.includes("--openrouter")) return 0;
237
227
  if (!body.capabilities.includes("providers:write")) {
238
- console.error('The Sight key was saved, but connecting OpenRouter requires providers:write. Ask the project owner for a key with access "manage", set it as SIGHT_API_KEY, then run: sight openrouter connect --budget <usd>');
228
+ console.error("The Sight key was saved, but connecting OpenRouter requires providers:write. Ask the project owner for an Admin key, set it as SIGHT_API_KEY, then run: sight openrouter connect --budget <usd>");
239
229
  return 1;
240
230
  }
241
231
  const connected = await connectOpenRouter(api, body.key, args);
@@ -247,7 +237,7 @@ async function account(args) {
247
237
  async function openrouter(args) {
248
238
  const sub = args[0];
249
239
  if (sub !== "connect" && sub !== "status") {
250
- console.error("usage: sight openrouter connect --budget <usd> [--api <base>] | sight openrouter status [--api <base>]");
240
+ console.error("usage: sight openrouter connect --budget <usd> [--house-trial] [--api <base>] | sight openrouter status [--api <base>]");
251
241
  return 1;
252
242
  }
253
243
  const stored = readMachineCredentials();
@@ -272,6 +262,7 @@ async function openrouter(args) {
272
262
  return 0;
273
263
  }
274
264
  function openBrowser(url) {
265
+ if (process.argv.includes("--no-browser") || process.env["SIGHT_NO_BROWSER"] === "1") return;
275
266
  const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
276
267
  exec(`${cmd} "${url}"`);
277
268
  }
@@ -297,8 +288,13 @@ async function auth(args) {
297
288
  headers: { "content-type": "application/json" },
298
289
  body: JSON.stringify({ client_id: CLIENT_ID })
299
290
  }).catch((err) => ({ __err: err }));
300
- if (!codeRes || !codeRes.ok) {
301
- console.error(`could not start the login at ${base}. Check the URL (--base or SIGHT_BASE) and your network.`);
291
+ if (!codeRes || codeRes.__err) {
292
+ console.error(`could not reach ${base}. Check the URL (--base or SIGHT_BASE) and your network.`);
293
+ return 1;
294
+ }
295
+ if (!codeRes.ok) {
296
+ const detail = await codeRes.text().catch(() => "");
297
+ console.error(`the login was refused by ${base} (${codeRes.status})${detail ? `: ${detail.slice(0, 300)}` : ""}`);
302
298
  return 1;
303
299
  }
304
300
  const grant = await codeRes.json();
@@ -422,3 +418,20 @@ async function conditions(args) {
422
418
  process.stdout.write(await res.text());
423
419
  return 0;
424
420
  }
421
+ var [, , command, ...rest] = process.argv;
422
+ if (command === "connect") {
423
+ connect(rest).then((code) => process.exit(code));
424
+ } else if (command === "auth") {
425
+ auth(rest).then((code) => process.exit(code));
426
+ } else if (command === "account") {
427
+ account(rest).then((code) => process.exit(code));
428
+ } else if (command === "openrouter") {
429
+ openrouter(rest).then((code) => process.exit(code));
430
+ } else if (command === "export") {
431
+ exportRecord(rest).then((code) => process.exit(code));
432
+ } else if (command === "conditions") {
433
+ conditions(rest).then((code) => process.exit(code));
434
+ } else {
435
+ usage();
436
+ process.exit(command && command !== "--help" && command !== "-h" ? 1 : 0);
437
+ }
package/dist/index.cjs CHANGED
@@ -337,7 +337,7 @@ var IngestClient = class {
337
337
  const cls = status === 401 ? "401" : status === 403 ? "403" : "other";
338
338
  if (this.rejectionAnnounced.has(cls)) return;
339
339
  this.rejectionAnnounced.add(cls);
340
- const line = cls === "401" ? "[sight] the API rejected the key (401). Nothing is being captured. Set apiKey to a key with the ingest capability." : cls === "403" ? '[sight] this key cannot capture (403): it lacks the ingest capability. Nothing is being captured. Ask the project owner for a key with access "ingest".' : `[sight] the API rejected ${what} (${status}) and it was dropped. Set debug: true to log every failed send. This warning prints once per process.`;
340
+ const line = cls === "401" ? "[sight] the API rejected the key (401). Nothing is being captured. Set apiKey to a key with the ingest capability." : cls === "403" ? "[sight] this key cannot capture (403): it lacks the ingest permission. Nothing is being captured. Ask the project owner for a Capture key." : `[sight] the API rejected ${what} (${status}) and it was dropped. Set debug: true to log every failed send. This warning prints once per process.`;
341
341
  console.error(line);
342
342
  }
343
343
  log(msg) {