@cultured_computer/sight 0.10.1 → 0.10.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 +40 -3
- package/README.md +95 -252
- package/dist/cli.js +5527 -151
- package/dist/index.cjs +105 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -6
- package/dist/index.d.ts +100 -6
- package/dist/index.js +105 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,46 @@ 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
|
-
##
|
|
9
|
-
|
|
10
|
-
-
|
|
8
|
+
## 0.10.3 (2026-12-02)
|
|
9
|
+
|
|
10
|
+
- New `sight character` lab authoring loop: initialize, check, preflight,
|
|
11
|
+
run and resume a character; inspect and compare real Field turns; write
|
|
12
|
+
notes; and trial, keep or revert successive versions. Complete parent
|
|
13
|
+
evidence is reused offline when it is on this machine and was made with
|
|
14
|
+
the same situations and run settings; otherwise the parent is run again
|
|
15
|
+
and the answer says why. Exact repeated trials and keeps are idempotent,
|
|
16
|
+
and stale decisions are refused.
|
|
17
|
+
- Keep copies the kept scene into the working scene file only when that
|
|
18
|
+
file was not edited since the trial. Revert puts the parent's text back
|
|
19
|
+
when the file still holds exactly the rejected candidate. Neither
|
|
20
|
+
overwrites newer work.
|
|
21
|
+
- Without `--agent`, a note, trial, keep or revert must name a human
|
|
22
|
+
designer listed in `workbench.json`. `notes --json` derives supervision
|
|
23
|
+
counts from those designers' records only, a corrected note once.
|
|
24
|
+
- The generated ignore file lets git carry each run's manifest and scene. A
|
|
25
|
+
run from another machine is never written over: the same run made locally
|
|
26
|
+
is recorded beside it with the replicate id `rerun-of-<run-id>`.
|
|
27
|
+
- Turn-level regression checks cover block entry, sentence flags, steps and
|
|
28
|
+
state. An on-demand `controls scene` generates an always-on scene: text
|
|
29
|
+
behind a detector or step condition is delivered on every turn with the
|
|
30
|
+
same words, and text it cannot move honestly is refused. `--scene-out`
|
|
31
|
+
writes that scene alone, to run as a trial candidate.
|
|
32
|
+
`compare --parent-parent` measures matched variability without a winner.
|
|
33
|
+
Scene output includes its exact digest.
|
|
34
|
+
- `createFieldClient` reads the profile deployment id, live content hash and
|
|
35
|
+
effective endpoint state settings, and adds `endpoints.update` for
|
|
36
|
+
`revealsState`. Profile puts accept `ifNoneMatch: '*'` for create-only
|
|
37
|
+
initialization. Scene puts and identified turn request/replay are
|
|
38
|
+
included.
|
|
39
|
+
|
|
40
|
+
## 0.10.2 (2026-11-23)
|
|
41
|
+
|
|
42
|
+
- The README only: shorter and in the standard order (what it is, install,
|
|
43
|
+
usage, troubleshooting). It shows three uses, each with one example:
|
|
44
|
+
capture, labeling a file of conversations, and serving a profile. The
|
|
45
|
+
serving tables it carried are in the SDK reference and the profile
|
|
46
|
+
reference, which it links. No code changed.
|
|
47
|
+
- The package description says the three uses.
|
|
11
48
|
|
|
12
49
|
## 0.10.1 (2026-11-23)
|
|
13
50
|
|
package/README.md
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
# Sight
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
the
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[Sets and runs](https://sight.cultured.computer/docs/sets-and-runs).
|
|
3
|
+
Record, label and serve the conversations of a production assistant. Node SDK and CLI.
|
|
4
|
+
|
|
5
|
+
Sight keeps a record of what your assistant said and what it led to, and
|
|
6
|
+
labels that record. This package is the way in from your own code and
|
|
7
|
+
terminal. Use it to:
|
|
8
|
+
|
|
9
|
+
- **Capture** each model call your assistant makes as one turn of a
|
|
10
|
+
conversation (the person's message, the reply, model, tokens, latency),
|
|
11
|
+
without changing or delaying the response.
|
|
12
|
+
- **Label a file** of conversations you already have: send it, have two
|
|
13
|
+
judges from different vendors read it against a rubric, and read the
|
|
14
|
+
labels back.
|
|
15
|
+
- **Serve** a `SOUL.md` profile through the Field API, with no serving
|
|
16
|
+
process of your own.
|
|
18
17
|
|
|
19
18
|
Full documentation: https://sight.cultured.computer/docs
|
|
20
19
|
|
|
20
|
+
## Contents
|
|
21
|
+
|
|
22
|
+
- [Requirements](#requirements)
|
|
23
|
+
- [Install](#install)
|
|
24
|
+
- [Usage](#usage): [capture](#capture-your-models-turns), [label a file](#label-a-file-of-conversations), [serve a profile](#serve-a-profile)
|
|
25
|
+
- [The CLI](#the-cli)
|
|
26
|
+
- [Troubleshooting](#troubleshooting)
|
|
27
|
+
- [Versions and compatibility](#versions-and-compatibility)
|
|
28
|
+
|
|
21
29
|
## Requirements
|
|
22
30
|
|
|
23
31
|
- Node 20.6 or later. Server-side only; never ship the key to a browser.
|
|
24
|
-
- A Sight API key
|
|
32
|
+
- A Sight API key, set as `SIGHT_API_KEY`. Capture needs the `ingest`
|
|
33
|
+
permission (a Capture key or an App key). Labeling and serving need an
|
|
34
|
+
App key. See [API keys](https://sight.cultured.computer/docs/keys-and-access).
|
|
25
35
|
- TypeScript types, an ESM build and a CommonJS build are included.
|
|
26
36
|
|
|
27
37
|
## Install
|
|
@@ -30,7 +40,9 @@ Full documentation: https://sight.cultured.computer/docs
|
|
|
30
40
|
npm install @cultured_computer/sight
|
|
31
41
|
```
|
|
32
42
|
|
|
33
|
-
##
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Capture your model's turns
|
|
34
46
|
|
|
35
47
|
```ts
|
|
36
48
|
import OpenAI from "openai";
|
|
@@ -57,7 +69,7 @@ After the first accepted turn, stderr prints one line with a link to the
|
|
|
57
69
|
session: `Sight: first session captured -> <url>`.
|
|
58
70
|
Walkthrough: [Get started](https://sight.cultured.computer/docs/get-started).
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
### What you must do for a turn to be captured
|
|
61
73
|
|
|
62
74
|
| Step | Call | Without it |
|
|
63
75
|
| --- | --- | --- |
|
|
@@ -77,7 +89,7 @@ Walkthrough: [Get started](https://sight.cultured.computer/docs/get-started).
|
|
|
77
89
|
- Optional: `Sight.startSession({ externalId, externalUserId })` attaches a
|
|
78
90
|
stable, pseudonymous user id, which ties one person's sessions together.
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
### Capture paths
|
|
81
93
|
|
|
82
94
|
| Path | What you add | Verified with | What it sends that others do not |
|
|
83
95
|
| --- | --- | --- | --- |
|
|
@@ -102,33 +114,20 @@ Walkthrough: [Get started](https://sight.cultured.computer/docs/get-started).
|
|
|
102
114
|
|
|
103
115
|
Details per path: [Integration paths](https://sight.cultured.computer/docs/integration-paths).
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
### What a captured turn carries
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
| First-token time | `probe_first_token_ms` | Wrapped OpenAI streams and `ai` streams only |
|
|
117
|
-
| Tool names and count | `probe_tool_names`, `probe_tool_calls` | The model requested tools |
|
|
118
|
-
| Finish reason, error | `probe_finish_reason`, `probe_error` | Reported, or the call failed |
|
|
119
|
-
| Cost | `probe_cost_usd` | The provider reports one. Otherwise the server estimates it from its price catalogue when the provider and model match one price; otherwise the turn has no cost (empty, never 0). |
|
|
120
|
-
| Turn identity | `turnId`, `turnIndex` | Always |
|
|
121
|
-
|
|
122
|
-
Every captured turn is sent with a `turnId`: a fresh UUID per turn. A retried
|
|
123
|
-
send carries the same `turnId`. `turnIndex` is a per-session counter held in
|
|
124
|
-
the process.
|
|
125
|
-
|
|
126
|
-
The exported record has a published JSON Schema, shipped in this package as
|
|
127
|
-
`@cultured_computer/sight/schema/record-v1`. See
|
|
128
|
-
[The record](https://sight.cultured.computer/docs/what-it-captures) and
|
|
119
|
+
The reply text, the person's message, the model and provider, tokens,
|
|
120
|
+
latency, first-token time on streams, tool names, the finish reason and
|
|
121
|
+
the cost where it is known. Every captured turn is sent with a `turnId`: a
|
|
122
|
+
fresh UUID per turn. A retried send carries the same `turnId`.
|
|
123
|
+
|
|
124
|
+
Every field and its payload key:
|
|
125
|
+
[SDK reference](https://sight.cultured.computer/docs/sdk-reference#what-every-autocaptured-turn-carries).
|
|
126
|
+
The exported record has a published JSON Schema, shipped in this package
|
|
127
|
+
as `@cultured_computer/sight/schema/record-v1`:
|
|
129
128
|
[Data format](https://sight.cultured.computer/docs/data-format).
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
### What is not sent
|
|
132
131
|
|
|
133
132
|
Autocapture does not send:
|
|
134
133
|
|
|
@@ -143,7 +142,7 @@ Autocapture does not send:
|
|
|
143
142
|
Text is sent as your process holds it. Personal data is scrubbed on the
|
|
144
143
|
server before storage: [Privacy & retention](https://sight.cultured.computer/docs/data-and-privacy).
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
### Manual capture
|
|
147
146
|
|
|
148
147
|
For calls autocapture does not see:
|
|
149
148
|
|
|
@@ -166,58 +165,45 @@ An invalid turn logs one warning naming the first invalid field and is not
|
|
|
166
165
|
sent. Pass `turnId` (a UUID) to supply your own identity.
|
|
167
166
|
Reference: [SDK reference](https://sight.cultured.computer/docs/sdk-reference).
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
Outcomes, feedback, spans and events join a session by its id and can be
|
|
169
|
+
sent later, from a webhook or a callback: `Sight.emitOutcomeEvent`,
|
|
170
|
+
`Sight.userThumbs`, `Sight.endSession`, `Sight.captureSpans`. Await
|
|
171
|
+
`Sight.shutdown()` before a short-lived process exits. Every method:
|
|
172
|
+
[SDK reference](https://sight.cultured.computer/docs/sdk-reference).
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
webhook or a callback.
|
|
174
|
+
### Label a file of conversations
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| `Sight.emitOutcomeEvent({ sessionExternalId, kind, detail? })` | Your own outcome: a resolved ticket, a conversion | [Outcome helpers](https://sight.cultured.computer/docs/sdk-reference#outcome-helpers) |
|
|
177
|
-
| `Sight.flagPersonaBreak({ sessionExternalId, note?, turnIndex? })` | A person's report that a reply was out of character | [Outcome helpers](https://sight.cultured.computer/docs/sdk-reference#outcome-helpers) |
|
|
178
|
-
| `Sight.userThumbs(id, "up" \| "down")`, `Sight.userRating(id, 1..5)` | Feedback, sent with the next captured turn | [Outcome helpers](https://sight.cultured.computer/docs/sdk-reference#outcome-helpers) |
|
|
179
|
-
| `Sight.endSession({ externalId, endedReason?, outcome? })` | Why the session ended, and an outcome known at close | [Sessions](https://sight.cultured.computer/docs/sdk-reference#sessions) |
|
|
180
|
-
| `Sight.captureSpans(spans, alignment?)` | Steps inside a turn: tool calls, model calls. At most 50 per call. | [Spans](https://sight.cultured.computer/docs/sdk-reference#spans) |
|
|
181
|
-
| `Sight.captureEnvironmentEvents(events, alignment?)` | Events from a channel beside the conversation. At most 100 per call. | [Environment events](https://sight.cultured.computer/docs/sdk-reference#environment-events) |
|
|
182
|
-
| `Sight.shutdown()` | Nothing; waits for sends in flight. Await it before a short-lived process exits. | [SDK reference](https://sight.cultured.computer/docs/sdk-reference) |
|
|
176
|
+
For a dump of support tickets, call transcripts or chat logs. The file is
|
|
177
|
+
JSONL, one conversation on each line. Check it, then send it:
|
|
183
178
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
```bash
|
|
180
|
+
npx @cultured_computer/sight import ./conversations.jsonl --deployment my-archive --batch march-tickets --dry-run
|
|
181
|
+
npx @cultured_computer/sight import ./conversations.jsonl --deployment my-archive --batch march-tickets
|
|
182
|
+
```
|
|
188
183
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
| `sight import <file> --deployment <slug> --batch <name>` | Sends historical conversations from a JSONL file through the capture route with their original times; `--dry-run` checks the file and sends nothing; `--replies-by person` (or `"replies_by": "person"` on a conversation) sends a call between two people, where no model took part | A key with `ingest`: `SIGHT_API_KEY`, or the key saved by `account create` |
|
|
196
|
-
| `sight account create` | Redeems a one-time token and saves the key to `~/.config/sight/machine.json` (mode `0600`) | `SIGHT_PROVISION_TOKEN` |
|
|
197
|
-
| `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` |
|
|
198
|
-
| `sight openrouter status` | Prints the stored connection: status, last four characters, budget | A key with `studio:run` or `providers:write` |
|
|
199
|
-
| `sight connect <relay-url> --invite <code>` | See [Connect your room](https://sight.cultured.computer/docs/connect-your-room) | An invite code |
|
|
184
|
+
```text
|
|
185
|
+
import finished.
|
|
186
|
+
conversations sent: 40
|
|
187
|
+
turns sent: 160
|
|
188
|
+
session ends sent: 40
|
|
189
|
+
```
|
|
200
190
|
|
|
201
|
-
|
|
191
|
+
Then fix the batch as a set, run one rubric with two judges from
|
|
192
|
+
different vendors, store the check between them, and read the labels.
|
|
193
|
+
Those are four calls to the API, each shown with its answer in
|
|
194
|
+
[Quickstart: label a file](https://sight.cultured.computer/docs/label-a-file).
|
|
195
|
+
Every label comes back with the conversation id you sent and says how far
|
|
196
|
+
it has been checked: `preliminary` from one judge, `corroborated` once the
|
|
197
|
+
check between the two judges has passed.
|
|
202
198
|
|
|
203
|
-
|
|
199
|
+
### Serve a profile
|
|
204
200
|
|
|
205
201
|
The serving client puts a `SOUL.md` at a name on the Field API, serves it
|
|
206
202
|
turn by turn and reads its record. It is separate from capture: it takes
|
|
207
|
-
its own key and shares no state with `Sight`.
|
|
208
|
-
keeps nothing between calls and never retries a request.
|
|
209
|
-
|
|
210
|
-
### Setup
|
|
203
|
+
its own key and shares no state with `Sight`.
|
|
211
204
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- The project's OpenRouter key, connected once with an Admin key. See call 1
|
|
215
|
-
of [Quickstart: serve a profile](https://sight.cultured.computer/docs/serve-a-soul-md),
|
|
216
|
-
or `sight openrouter connect`.
|
|
217
|
-
- The host is `https://api.cultured.computer`, the same as capture; set
|
|
218
|
-
`endpoint` only for a staging API.
|
|
219
|
-
|
|
220
|
-
### Quickstart
|
|
205
|
+
It needs an App key, set as `SIGHT_APP_KEY` and kept on a server, and the
|
|
206
|
+
project's OpenRouter key connected once (`sight openrouter connect`).
|
|
221
207
|
|
|
222
208
|
```ts
|
|
223
209
|
import { createFieldClient } from "@cultured_computer/sight";
|
|
@@ -232,178 +218,35 @@ Show `notices` to the person before the reply: they are fixed platform
|
|
|
232
218
|
texts (an AI disclosure, a crisis referral), sent only by a profile with a
|
|
233
219
|
safeguard switched on.
|
|
234
220
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
```ts
|
|
238
|
-
for await (const frame of field.turns.stream("listener", { conversation: "conv-001", message: "Hi" })) {
|
|
239
|
-
if (frame.event === "notice") showNotice(frame.data.text);
|
|
240
|
-
if (frame.event === "delta") write(frame.data.text);
|
|
241
|
-
if (frame.event === "error") console.error(frame.data.code, frame.data.reason);
|
|
242
|
-
}
|
|
243
|
-
```
|
|
221
|
+
Every answer that is not a `2xx` throws a `FieldRefusal`. Branch on its
|
|
222
|
+
`code`, never on the message.
|
|
244
223
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
224
|
+
- Streaming, every method, the runtime settings and choosing a model per
|
|
225
|
+
conversation:
|
|
226
|
+
[SDK reference](https://sight.cultured.computer/docs/sdk-reference#serve-a-profile).
|
|
227
|
+
- Every route, body and refusal code, with what to do for each:
|
|
228
|
+
[Profile reference](https://sight.cultured.computer/docs/serve-a-profile-reference).
|
|
229
|
+
- The five calls as curl:
|
|
230
|
+
[Quickstart: serve a profile](https://sight.cultured.computer/docs/serve-a-soul-md).
|
|
248
231
|
|
|
249
|
-
|
|
250
|
-
| --- | --- | --- |
|
|
251
|
-
| `profiles.put(name, soulMarkdown, options?)` | `PUT /v1/profiles/{name}` | `outcome`, `changed`, the version, the `runtime`, `refused` (parts of the file left out; check it after every put), `etag` |
|
|
252
|
-
| `profiles.get(name)` | `GET /v1/profiles/{name}` | The live version, the `runtime`, limits, safeguards, the connection, `etag` |
|
|
253
|
-
| `profiles.sessions(name, { conversation?, cursor?, limit?, version?, ended? })` | `GET /v1/profiles/{name}/sessions` | One page of sessions, newest first; pass `nextBefore` as `cursor` for the next |
|
|
254
|
-
| `conversations.start(profile, { conversation, user, runtime?, opening?, seed? })` | `POST /v1/profiles/{name}/conversations` | `runId`, `sessionId`, `record` |
|
|
255
|
-
| `turns.send(profile, { conversation, message, resume? })` | `POST /v1/profiles/{name}/turns`, JSON | `reply`, `notices`, `events`, `turnIndex` |
|
|
256
|
-
| `turns.stream(profile, { conversation, message, resume? })` | The same route, server-sent events | The frames, as an async iterator |
|
|
257
|
-
| `sessions.get(id)` | `GET /v1/sessions/{id}` | The session and its turns: each turn's `message`, then the `reply` it prompted |
|
|
258
|
-
|
|
259
|
-
Every method takes an optional `signal` (an `AbortSignal`). The client sets
|
|
260
|
-
no timeout of its own; the Field bounds a reply at 90 seconds.
|
|
261
|
-
|
|
262
|
-
### The runtime record
|
|
263
|
-
|
|
264
|
-
What the reply call is sent. A profile sets it; a conversation can
|
|
265
|
-
override it.
|
|
266
|
-
|
|
267
|
-
| Setting | What it does | Default |
|
|
268
|
-
| --- | --- | --- |
|
|
269
|
-
| `model` | The OpenRouter model id that writes the reply, `vendor/model`. It must have an active route in the model catalogue. | None: the file or the put must name one. |
|
|
270
|
-
| `temperature` | Sampling temperature, 0 to 2. Left out of the request where the model's route takes none. | 0.7 |
|
|
271
|
-
| `maxOutputTokens` | The reply's output budget, in tokens: an integer from 256 to the model's catalogue `max_completion_tokens` (16,384 when it states none). A reasoning model's reasoning tokens count inside it, with the answer. | The smaller of 16,384 and the model's catalogue `max_completion_tokens`; 4,096 when the catalogue says nothing of the model |
|
|
272
|
-
| `reasoningEffort` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max`. Sent only where the model's catalogue entry lists that effort; elsewhere left out. `none` asks for no reasoning. | `low` where the catalogue lists it, else the lowest effort it lists; nothing when it lists none |
|
|
273
|
-
|
|
274
|
-
- On a profile: write them in the `SOUL.md` frontmatter, or pass them to
|
|
275
|
-
`profiles.put` (the options override the file for that put). A changed
|
|
276
|
-
`reasoningEffort` or `maxOutputTokens` saves a new version.
|
|
277
|
-
`maxOutputTokens` in the frontmatter and as a put option.
|
|
278
|
-
- `profiles.get` answers what the replies are sent with, under `runtime`.
|
|
279
|
-
`maxOutputTokens` and `reasoningEffort` (`null` when nothing is
|
|
280
|
-
asked), each with its source, `maxOutputTokensSource` and
|
|
281
|
-
`reasoningEffortSource`: `profile` when the live version names it,
|
|
282
|
-
`default` for the house default.
|
|
283
|
-
- Each turn's `run` frame, and each turn of `sessions.get` under `sent`,
|
|
284
|
-
say what the call actually sent.
|
|
285
|
-
|
|
286
|
-
Every model the Field serves reasons by default, so a setting you leave
|
|
287
|
-
out is not "off": it is the house default above, per model.
|
|
288
|
-
|
|
289
|
-
Reasoning tokens count inside `maxOutputTokens`. A reasoning model at a
|
|
290
|
-
high effort with a small limit can spend the whole limit reasoning and
|
|
291
|
-
write no reply; that turn fails with `empty_completion_length` (below).
|
|
292
|
-
Reasoning before the first visible token also counts against the
|
|
293
|
-
15-second first-token deadline.
|
|
294
|
-
|
|
295
|
-
### Choosing a model per conversation
|
|
232
|
+
## The CLI
|
|
296
233
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
conversation: "conv-002",
|
|
300
|
-
user: "user-481",
|
|
301
|
-
runtime: { model: "anthropic/claude-opus-5", reasoningEffort: "none", maxOutputTokens: 1024 },
|
|
302
|
-
});
|
|
303
|
-
```
|
|
234
|
+
`npx @cultured_computer/sight <verb>`. `sight --help` lists flags and
|
|
235
|
+
environment variables. Secrets are read from the environment, never from a flag.
|
|
304
236
|
|
|
305
|
-
|
|
306
|
-
a key left out keeps the profile's value.
|
|
307
|
-
- Only a key holding `profiles:write` (the App key) may send it; any
|
|
308
|
-
other key is refused with `runtime_forbidden`.
|
|
309
|
-
- `model` must have an active route in the catalogue (`model_unavailable`
|
|
310
|
-
otherwise); `maxOutputTokens` must be in that model's range and
|
|
311
|
-
`reasoningEffort` one of the efforts (`invalid_max_output_tokens`,
|
|
312
|
-
`invalid_reasoning_effort`). A refused start starts nothing.
|
|
313
|
-
- It is stored with the conversation and every turn uses it. A repeated
|
|
314
|
-
start of the same conversation must send the same `runtime`
|
|
315
|
-
(`opening_conflict` otherwise). Each turn's `run` frame names it as
|
|
316
|
-
`override`.
|
|
317
|
-
- The profile's file, its `## When` sentences and its safeguards are the
|
|
318
|
-
same for every conversation; only the runtime record changes.
|
|
319
|
-
|
|
320
|
-
### Handling `empty_completion`
|
|
321
|
-
|
|
322
|
-
A model that finishes a turn with no reply text is a `provider_error`
|
|
323
|
-
(`502`) with a `reason`:
|
|
324
|
-
|
|
325
|
-
| `reason` | What happened | What to do |
|
|
237
|
+
| Verb | What it does | Key or login needed |
|
|
326
238
|
| --- | --- | --- |
|
|
327
|
-
| `
|
|
328
|
-
| `
|
|
329
|
-
|
|
330
|
-
A
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
try {
|
|
338
|
-
const { reply } = await field.turns.send("listener", { conversation, message });
|
|
339
|
-
} catch (error) {
|
|
340
|
-
if (error instanceof FieldRefusal && error.code === "provider_error" && error.reason === "empty_completion_length") {
|
|
341
|
-
// The limit was spent reasoning: start the next conversation with a larger maxOutputTokens.
|
|
342
|
-
}
|
|
343
|
-
throw error;
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
In a stream the same failure is the `error` frame, with `code` and
|
|
348
|
-
`reason`; it ends the stream.
|
|
349
|
-
|
|
350
|
-
### Refusals
|
|
351
|
-
|
|
352
|
-
Every answer that is not a `2xx` throws a `FieldRefusal`:
|
|
353
|
-
|
|
354
|
-
| Property | What it is |
|
|
355
|
-
| --- | --- |
|
|
356
|
-
| `status` | The HTTP status |
|
|
357
|
-
| `code` | The stable code (below), or `null` when the answer has none (`401`, a `403` for a missing permission, `413`) |
|
|
358
|
-
| `reason` | The `conversation_ended` reason (`idle`, `turn_cap`, `floor`, `failed`, `ended`), or the `provider_error` reason, or `null` |
|
|
359
|
-
| `retryAfter` | `Retry-After` in seconds, or `null` |
|
|
360
|
-
| `notices`, `events`, `turnIndex` | A failed turn's notices (show them), frames and index |
|
|
361
|
-
| `body` | The answer as sent |
|
|
362
|
-
|
|
363
|
-
Branch on `code`, never on the message. `FIELD_REFUSAL_CODES` lists every
|
|
364
|
-
code this version knows; a newer API may answer one it does not list.
|
|
239
|
+
| `sight auth login` | Signs this terminal in: prints a link, you approve it in your browser | Your dashboard sign-in |
|
|
240
|
+
| `sight auth logout` | Deletes the stored login token | None |
|
|
241
|
+
| `sight export --project <slug> --deployment <slug>` | Writes a deployment's record as JSONL (`--out <file>`, default stdout) | `auth login`; owner role on the project |
|
|
242
|
+
| `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` |
|
|
243
|
+
| `sight import <file> --deployment <slug> --batch <name>` | Sends historical conversations from a JSONL file through the capture route with their original times; `--dry-run` checks the file and sends nothing; `--replies-by person` sends calls between two people. [The import file](https://sight.cultured.computer/docs/cli#the-import-file) | A key with `ingest`: `SIGHT_API_KEY`, or the key saved by `account create` |
|
|
244
|
+
| `sight account create` | Redeems a one-time token and saves the key to `~/.config/sight/machine.json` (mode `0600`) | `SIGHT_PROVISION_TOKEN` |
|
|
245
|
+
| `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` |
|
|
246
|
+
| `sight openrouter status` | Prints the stored connection: status, last four characters, budget | A key with `studio:run` or `providers:write` |
|
|
247
|
+
| `sight connect <relay-url> --invite <code>` | See [Connect your room](https://sight.cultured.computer/docs/connect-your-room) | An invite code |
|
|
365
248
|
|
|
366
|
-
|
|
367
|
-
| --- | --- | --- |
|
|
368
|
-
| `invalid_body` | `400` | Fix the body; `body.detail` names the fields |
|
|
369
|
-
| `no_owner` | `400` | The project has no owner. Ask us. |
|
|
370
|
-
| `forbidden` | `403` | A rehearsal link was used at a profile address. Use the App key. |
|
|
371
|
-
| `opening_forbidden` | `403` | An `opening` needs a key with `profiles:write` |
|
|
372
|
-
| `runtime_forbidden` | `403` | A `runtime` override needs a key with `profiles:write` |
|
|
373
|
-
| `no_such_profile`, `no_such_endpoint` | `404` | Check the name; put the profile first |
|
|
374
|
-
| `no_such_conversation` | `404` | Start the conversation before sending a turn |
|
|
375
|
-
| `conversation_unknown` | `409` | The conversation has not started |
|
|
376
|
-
| `conversation_conflict` | `409` | This conversation id was started with another `user`. Use a new id. |
|
|
377
|
-
| `opening_conflict` | `409` | This id was started with another `opening`, `seed` or `runtime`. Send the same ones, or use a new id. |
|
|
378
|
-
| `conversation_ended` | `409` | The id is spent; `reason` says why. Start a new conversation under a new id. |
|
|
379
|
-
| `turn_cap` | `409` | The conversation reached its turn cap. Start a new one. |
|
|
380
|
-
| `stale_turn_index` | `409` | `resume.turnIndex` is not the next turn; use the `turnIndex` in the answer |
|
|
381
|
-
| `busy` | `409` | A reply is in progress on this conversation. Wait, then send. |
|
|
382
|
-
| `interrupted`, `record_gap` | `409` | The conversation cannot continue. Start a new one. |
|
|
383
|
-
| `no_live_version` | `409` | Put the file |
|
|
384
|
-
| `model_unavailable` | `409` | The profile's model, or the start's `runtime.model`, has no active route in the catalogue. Name a model it carries. |
|
|
385
|
-
| `not_connected` | `409` | Connect the project's OpenRouter key |
|
|
386
|
-
| `budget` | `409` | The monthly budget is reached. Connect again with a larger budget. |
|
|
387
|
-
| `put_in_progress` | `409` | Another put of this profile is running. Retry after `retryAfter`. |
|
|
388
|
-
| `scene_live` | `409` | The profile serves a stepped scene. Put with `force: true` to replace it. |
|
|
389
|
-
| `request_conflict`, `request_pending`, `request_interrupted` | `409` | Logical turn requests only; not sent by this client |
|
|
390
|
-
| `not_a_soul_md`, `not_a_scene` | `406` | Profile read in another format; not sent by this client |
|
|
391
|
-
| `archived`, `revoked`, `link_inactive` | `410` | It does not come back |
|
|
392
|
-
| `request_unknown`, `replay_expired` | `404`, `410` | Logical turn requests only; not sent by this client |
|
|
393
|
-
| `precondition_failed` | `412` | `ifMatch` no longer names the live version. Read the profile, then put. |
|
|
394
|
-
| `invalid_consent`, `invalid_safeguards`, `invalid_scrub`, `invalid_fallback`, `invalid_scene`, `invalid_reasoning_effort`, `invalid_reply_check` | `422` | Fix that setting (on a put, or a start's `runtime`); `body.accepted` lists the words. Nothing was stored. |
|
|
395
|
-
| `invalid_max_output_tokens` | `422` | `maxOutputTokens` (on a put, or a start's `runtime`) is not an integer in the model's range; `body.accepted` is `{ min, max }`. Nothing was stored. |
|
|
396
|
-
| `daily_cap` | `429` | The day's conversations are used up (UTC) |
|
|
397
|
-
| `link_session_cap` | `429` | A rehearsal link's session limit; not sent by this client |
|
|
398
|
-
| `rate_limited` | `429` | Wait `retryAfter` seconds, then retry |
|
|
399
|
-
| `turn_failed` | `500` | The turn broke and the conversation is closed. Start a new one. |
|
|
400
|
-
| `provider_error` | `502` | The provider or the model failed; see `reason` above |
|
|
401
|
-
| `provider_timeout` | `504` | A reply deadline passed. The next turn can be sent at once. |
|
|
402
|
-
| `not_enabled` | `503` | Serving is not enabled for the project. Ask us. |
|
|
403
|
-
|
|
404
|
-
Every route, body and refusal:
|
|
405
|
-
[Profile reference](https://sight.cultured.computer/docs/serve-a-profile-reference)
|
|
406
|
-
and [SDK reference](https://sight.cultured.computer/docs/sdk-reference#serve-a-profile).
|
|
249
|
+
Every flag: [CLI](https://sight.cultured.computer/docs/cli).
|
|
407
250
|
|
|
408
251
|
## Troubleshooting
|
|
409
252
|
|