@cultured_computer/sight 0.8.1 → 0.8.2

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,22 @@ 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.2 (2026-10-06)
9
+
10
+ - `sight auth login` works again. 0.8.1 sent `client_id: undefined` (the
11
+ command dispatch ran before the constant was initialised in the bundle),
12
+ the server refused the grant, and the CLI called it a network problem. The
13
+ dispatch now runs last, a refusal is reported as the server's answer with
14
+ its status, and `--no-browser` (or `SIGHT_NO_BROWSER=1`) prints the link
15
+ without opening a browser. The server side ships beside it: the
16
+ verification link now points at the dashboard's `/device` page instead of
17
+ the auth host, where it was a 404.
18
+
19
+ - Wording only, no behavior change: a key has a role (Capture, App, Admin)
20
+ and permissions. The `403` warning now reads `[sight] this key cannot
21
+ capture (403): it lacks the ingest permission. ... Ask the project owner
22
+ for a Capture key.`, and `sight account create --openrouter` without
23
+ `providers:write` asks for an Admin key. The README says the same.
11
24
 
12
25
  ## 0.8.1 (2026-10-03)
13
26
 
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
 
@@ -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,7 +16,7 @@ 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>]",
@@ -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");
@@ -235,7 +219,7 @@ async function account(args) {
235
219
  console.log(`capabilities: ${body.capabilities.join(", ") || "none"}`);
236
220
  if (!args.includes("--openrouter")) return 0;
237
221
  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>');
222
+ 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
223
  return 1;
240
224
  }
241
225
  const connected = await connectOpenRouter(api, body.key, args);
@@ -272,6 +256,7 @@ async function openrouter(args) {
272
256
  return 0;
273
257
  }
274
258
  function openBrowser(url) {
259
+ if (process.argv.includes("--no-browser") || process.env["SIGHT_NO_BROWSER"] === "1") return;
275
260
  const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
276
261
  exec(`${cmd} "${url}"`);
277
262
  }
@@ -297,8 +282,13 @@ async function auth(args) {
297
282
  headers: { "content-type": "application/json" },
298
283
  body: JSON.stringify({ client_id: CLIENT_ID })
299
284
  }).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.`);
285
+ if (!codeRes || codeRes.__err) {
286
+ console.error(`could not reach ${base}. Check the URL (--base or SIGHT_BASE) and your network.`);
287
+ return 1;
288
+ }
289
+ if (!codeRes.ok) {
290
+ const detail = await codeRes.text().catch(() => "");
291
+ console.error(`the login was refused by ${base} (${codeRes.status})${detail ? `: ${detail.slice(0, 300)}` : ""}`);
302
292
  return 1;
303
293
  }
304
294
  const grant = await codeRes.json();
@@ -422,3 +412,20 @@ async function conditions(args) {
422
412
  process.stdout.write(await res.text());
423
413
  return 0;
424
414
  }
415
+ var [, , command, ...rest] = process.argv;
416
+ if (command === "connect") {
417
+ connect(rest).then((code) => process.exit(code));
418
+ } else if (command === "auth") {
419
+ auth(rest).then((code) => process.exit(code));
420
+ } else if (command === "account") {
421
+ account(rest).then((code) => process.exit(code));
422
+ } else if (command === "openrouter") {
423
+ openrouter(rest).then((code) => process.exit(code));
424
+ } else if (command === "export") {
425
+ exportRecord(rest).then((code) => process.exit(code));
426
+ } else if (command === "conditions") {
427
+ conditions(rest).then((code) => process.exit(code));
428
+ } else {
429
+ usage();
430
+ process.exit(command && command !== "--help" && command !== "-h" ? 1 : 0);
431
+ }
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) {