@cultured_computer/sight 0.10.3 → 0.10.4

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,6 +5,27 @@ 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
+ ## 0.10.4 (2026-12-02)
9
+
10
+ - `sight character trial` validates before any reply is made: a
11
+ `checks.json` that does not parse, or names a situation or turn that does
12
+ not exist, is refused, and the service is asked about the candidate scene
13
+ (a dry-run save) before the kept version runs again.
14
+ - Run settings live in `workbench.json` under `execution` and a flag
15
+ overrides one run: `model`, `temperature`, `maxOutputTokens`,
16
+ `reasoningEffort`, `fallback`, `reader`, `repeats`, `modelSeed`,
17
+ `moveSeed`. `init` writes `repeats`, `modelSeed` and `moveSeed` as 1 and
18
+ takes `--designer <id>[,<id>]`. A setting that does not read is refused
19
+ as `invalid_workbench`.
20
+ - `sight character show <run-dir>` prints, under each reply, every read
21
+ (score over bar, before or after the reply, met, unmet or no reading) and
22
+ the blocks that were on and off. `--json` adds `readTotals`.
23
+ - A run warns once, on stderr and in its manifest, when the model was not
24
+ sent the requested temperature or seed.
25
+ - Planning the same run again leaves `plan.json` byte-identical.
26
+ - The generated `SKILL.md` is a shorter command reference with one example
27
+ of each check kind.
28
+
8
29
  ## 0.10.3 (2026-12-02)
9
30
 
10
31
  - New `sight character` lab authoring loop: initialize, check, preflight,
package/README.md CHANGED
@@ -244,6 +244,7 @@ environment variables. Secrets are read from the environment, never from a flag.
244
244
  | `sight account create` | Redeems a one-time token and saves the key to `~/.config/sight/machine.json` (mode `0600`) | `SIGHT_PROVISION_TOKEN` |
245
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
246
  | `sight openrouter status` | Prints the stored connection: status, last four characters, budget | A key with `studio:run` or `providers:write` |
247
+ | `sight character <verb>` | Builds one character by hand on two lab profiles: `init`, `check`, `trial`, `show`, `note`, `keep`, `revert`. See [The character loop](https://sight.cultured.computer/docs/cli#the-character-loop) | A lab key with `profiles:write` |
247
248
  | `sight connect <relay-url> --invite <code>` | See [Connect your room](https://sight.cultured.computer/docs/connect-your-room) | An invite code |
248
249
 
249
250
  Every flag: [CLI](https://sight.cultured.computer/docs/cli).
package/dist/cli.js CHANGED
@@ -3099,6 +3099,21 @@ function assertSessionPins(context, attempt, session, throughTurn, captures) {
3099
3099
  }
3100
3100
  }
3101
3101
  }
3102
+ function warnUnsentSettings(context, attempt, captures) {
3103
+ const add = (warning) => {
3104
+ if (!context.warnings.includes(warning)) context.warnings.push(warning);
3105
+ };
3106
+ for (const capture of captures) {
3107
+ const original = capture ? runFrame(capture.frames) : null;
3108
+ if (!original) continue;
3109
+ if (original["temperature"] === null) {
3110
+ add(`temperature ${context.spec.configuration.runtime.temperature} was not sent: ${context.spec.configuration.runtime.model} takes no temperature`);
3111
+ }
3112
+ if (original["seed"] === null && seedForAttempt(context.spec.modelSeed, attempt.repeat) !== void 0) {
3113
+ add(`the model seed was not sent: ${context.spec.configuration.runtime.model} takes no seed`);
3114
+ }
3115
+ }
3116
+ }
3102
3117
  function pendingProjectionTurn(session, throughTurn) {
3103
3118
  if (!Array.isArray(session.turns)) return null;
3104
3119
  for (let index = 0; index <= throughTurn; index += 1) {
@@ -3119,6 +3134,7 @@ async function projectSession(context, attempt, throughTurn) {
3119
3134
  const pending = pendingProjectionTurn(session, throughTurn);
3120
3135
  if (pending === null) {
3121
3136
  assertSessionPins(context, attempt, session, throughTurn, captures);
3137
+ warnUnsentSettings(context, attempt, captures);
3122
3138
  await writeMember(context, sessionPath(attempt.attemptId), session);
3123
3139
  attempt.status = "running";
3124
3140
  attempt.reason = void 0;
@@ -3968,187 +3984,177 @@ function skillDocument(humanAnnotatorIds2, candidate) {
3968
3984
  const designers = humanAnnotatorIds2.map((id) => `\`${id}\``).join(", ");
3969
3985
  return `# Character workbench
3970
3986
 
3971
- This directory holds one canonical character document, \`character.scene.json\`.
3972
- Its readable views and diffs are generated; do not turn them into another
3973
- source of truth.
3974
-
3975
- ## The headless loop
3976
-
3977
- Run these commands from the workbench directory. Every \`--json\` answer is one
3978
- noninteractive envelope. Use the real Sight command; do not replace it with a
3979
- private runtime or a model judge.
3987
+ One character lives in \`character.scene.json\`. Run every command from this
3988
+ directory with the real \`sight\` command. \`--json\` answers one line,
3989
+ \`{"ok":true,"result":...}\` or \`{"ok":false,"error":{"code","message","details"}}\`
3990
+ with exit 1. Progress and warnings go to stderr.
3980
3991
 
3981
3992
  The configured human designers are ${designers}. Examples use \`${designer}\` as
3982
3993
  the actor; use another configured id when that person is the actual designer.
3983
3994
 
3984
- 1. Show, diff and authoritatively dry-run the complete scene:
3995
+ ## The loop
3985
3996
 
3986
- - \`sight character show character.scene.json --json\`
3987
- - \`sight character show runs/<run-id> --situation ordinary-hello --repeat 1 --turn 0 --json\`
3988
- - \`sight character diff runs/<parent-run-id>/scene.json character.scene.json --json\`
3989
- - \`sight character check character.scene.json --profile ${candidate} --json\` stores nothing.
3990
-
3991
- Run evidence show returns the raw capture and normalized reply, reads, block
3992
- verdicts, state and transitions. A selected missing turn is shown as missing,
3993
- never as a pass, fail or zero.
3997
+ 1. Run the first trial before any edit. The scene as it stands becomes the
3998
+ kept version, and both sides run the same scene, which shows how much the
3999
+ model varies on its own.
3994
4000
 
3995
- 2. Preflight, then freeze exact scene and situation bytes into evidence:
4001
+ \`sight character trial --actor ${designer} --reason "Baseline, same scene on both sides." --json\`
3996
4002
 
3997
- - \`sight character preflight character.scene.json --situations situations/climb.json --profile ${candidate} --runs runs --json\`
3998
- - \`sight character run character.scene.json --situations situations/climb.json --profile ${candidate} --runs runs --json\`
3999
- - \`sight character run character.scene.json --situations situations/climb.json --profile ${candidate} --dry-run --json\`
4003
+ 2. Change one thing in \`character.scene.json\`. Look at it, then ask the
4004
+ service whether it reads (nothing is stored):
4000
4005
 
4001
- Preflight and \`run --dry-run\` make no PUT or provider call and need no
4002
- credential. Every run writes \`plan.json\` and prints planned conversations,
4003
- turns and model-call floor to stderr before any PUT or provider call. The
4004
- run freezes the scene, situations, effective configuration, stable
4005
- conversation identities and per-turn request ids. \`--repeats\`,
4006
- \`--model-seed\` and \`--move-seed\` are explicit. Warning thresholds only
4007
- warn. Only \`--stop-after-conversations\` or \`--stop-after-turns\` stops a
4008
- planned run early. An explicit stop closes the fully captured conversation,
4009
- leaves the run incomplete and exits nonzero. Confirmation situations are
4010
- refused before client work.
4011
- Failed, unknown, incomplete, service-limited, configuration-changed and
4012
- evidence-incomplete outcomes exit nonzero with stable error codes. A new run
4013
- refuses an unfinished profile session before its PUT. The configured API host
4014
- is frozen into run identity and lock scope. Turn receipts are stored locally
4015
- without provider-attempt hydration or sealed evidence export.
4016
-
4017
- 3. If a run is incomplete, inspect its manifest and resume the same directory:
4006
+ - \`sight character show character.scene.json --json\`
4007
+ - \`sight character diff runs/<parent-run-id>/scene.json character.scene.json --json\`
4008
+ - \`sight character check character.scene.json --profile ${candidate} --json\`
4018
4009
 
4019
- \`sight character resume runs/<run-id> --json\`
4010
+ 3. Plan the trial, then run it:
4020
4011
 
4021
- Resume first refuses torn or uncertain local evidence. It recovers the exact
4022
- identified receipt before any new admission and rechecks the live profile
4023
- configuration. Unknown or missing evidence is never a pass, fail or zero.
4012
+ - \`sight character trial --dry-run --json\`
4013
+ - \`sight character trial --actor ${designer} --reason "Review the raw evidence together." --json\`
4024
4014
 
4025
- 4. Compare the raw evidence and store it with deterministic code annotations:
4015
+ The kept version is read from disk. It runs again only when the situations
4016
+ or the run settings changed, or its evidence is not on this machine;
4017
+ \`parentRunReasons\` and stderr say which. The actor, \`checks.json\` and the
4018
+ candidate scene are validated before any reply is made.
4026
4019
 
4027
- \`sight character compare runs/<parent-run-id> runs/<candidate-run-id> --checks checks.json --notes annotations/notes.jsonl --out comparisons/by-hand.json --json\`
4020
+ 4. Read both runs:
4028
4021
 
4029
- The comparison shows reads, block verdicts, state, transitions and replies
4030
- side by side. It has no winner, aggregate character score or automatic keep.
4031
- A first divergence is withheld across an earlier evidence gap. The comparison
4032
- file and each run's \`annotations/checks.jsonl\` are written atomically;
4033
- repeating the same comparison is idempotent and conflicting ids are refused.
4022
+ - \`sight character show runs/<candidate-run-id>\`
4023
+ - \`sight character show runs/<run-id> --situation ordinary-hello --repeat 1 --turn 0 --json\`
4034
4024
 
4035
- 5. Add and read typed human or agent notes:
4025
+ 5. Write what you saw, then decide:
4036
4026
 
4037
- - \`sight character note run:<candidate-run-id> --run runs/<candidate-run-id> --actor ${designer} --text "I reviewed the candidate run evidence and support this voice change." --tags behavioral,voice,uptake --json\`
4027
+ - \`sight character note run:<candidate-run-id> --run runs/<candidate-run-id> --actor ${designer} --text "I reviewed the candidate run evidence and support this voice change." --tags behavioral,voice --json\`
4038
4028
  - \`sight character notes --target run:<candidate-run-id> --json\`
4039
-
4040
- Run, turn and block notes bind to the exact stored evidence digest. This
4041
- run-scoped human note is the example to cite by id in the behavioral keep.
4042
- Supported targets are turn, conversation, run, version, block, situation,
4043
- note and decision. Agent notes require \`--agent\` and are marked as model
4044
- annotations, not human judgments. Without \`--agent\` the actor must be one
4045
- of the configured human designers; any other id is refused. Corrections use
4046
- \`--replaces <note-id>\`. \`notes\` also returns a supervision count: notes and
4047
- decisions by the configured designers only, a corrected note counted once,
4048
- a repeated decision counted once.
4049
-
4050
- 6. Execute a trial, then choose the next local working parent:
4051
-
4052
- - \`sight character trial --actor ${designer} --reason "Review the raw evidence together." --json\`
4053
- - \`sight character trial --dry-run --json\`
4054
4029
  - \`sight character keep <comparison-path> --actor ${designer} --mode behavioral --reason "Keep this voice change." --note <designer-note-id> --json\`
4055
4030
  - \`sight character revert <comparison-path> --actor ${designer} --mode mechanical --reason "Leave the current parent in place." --json\`
4056
4031
 
4057
4032
  \`<comparison-path>\` is \`comparison.path\` in the trial's answer, under
4058
4033
  \`runs/comparisons/\`.
4059
4034
 
4060
- Run the first trial before editing \`character.scene.json\`, so the scene as
4061
- it stands becomes the parent; or pass \`--parent-scene <file>\` to name the
4062
- parent yourself. Change one thing per trial.
4035
+ - Keep makes the candidate the kept version. It copies the
4036
+ kept scene to \`character.scene.json\` only when that file still holds
4037
+ the parent's text or is missing.
4038
+ - Revert leaves the kept version as it is and puts
4039
+ the parent's text back into \`character.scene.json\` when the file still
4040
+ holds exactly the rejected candidate. The rejected scene stays in
4041
+ \`runs/<candidate-run-id>/scene.json\`.
4042
+ - A file edited since the trial is left alone both times; \`scene.action\`
4043
+ in the answer says what happened.
4044
+ - Without \`--agent\` the actor must be one of the configured human designers.
4045
+ Correct a note with \`--replaces <note-id>\`.
4063
4046
 
4064
- Trial checks the actor, mode and reason, then plans both sides before any
4065
- call. It reuses the kept version's stored evidence when that evidence is on
4066
- this machine and was made with the same situations and the same run settings
4067
- (repeats, model, temperature, reader, endpoint, seeds, stop). Otherwise it
4068
- runs the parent again from the kept run's frozen \`scene.json\` and says why
4069
- in \`parentRunReasons\` and on stderr. It then runs or resumes the candidate,
4070
- compares them and only then records a decision. \`trial --dry-run\` stops
4071
- after the plans. Decisions cite comparison evidence, parent, candidate,
4072
- alternatives, actor, reason and note ids.
4047
+ ## Reading a run
4073
4048
 
4074
- Keep points \`workbench.workingParent\` at the candidate run. It copies the
4075
- kept scene to \`character.scene.json\` only when that file still holds the
4076
- parent's text or is missing; a file edited since the trial is left as it is
4077
- and the answer says so. Revert leaves the working parent unchanged and puts
4078
- the parent's text back into \`character.scene.json\` when the file still
4079
- holds exactly the rejected candidate; a file edited since is left as it is.
4080
- The rejected scene stays in \`runs/<candidate-run-id>/scene.json\`. Both
4081
- answers carry \`scene.action\`. Neither moves a remote profile pointer or
4082
- changes a deployment.
4049
+ \`show runs/<run-id>\` prints each turn like this:
4083
4050
 
4084
- The generated \`.gitignore\` keeps each run's \`manifest.json\` and
4085
- \`scene.json\` in git and leaves the rest of the evidence local. In a fresh
4086
- clone a trial therefore runs the kept version again before comparing. A
4087
- run directory that came from another machine is never written over: the
4088
- same run made here is recorded beside it with the replicate id
4089
- \`rerun-of-<run-id>\`.
4051
+ \`\`\`text
4052
+ ordinary-hello/1/0: walking
4053
+ <the reply>
4054
+ read before 0.9/0.5 met <statement>
4055
+ read after - no reading <statement>
4056
+ on: character-floor, hard-day
4057
+ off: next-step
4058
+ \`\`\`
4090
4059
 
4091
- 7. Optionally generate an always-on scene control on demand:
4060
+ - \`read\`: score over bar, and whether the statement was read before or after
4061
+ the reply. A statement read after the reply acts on the next turn.
4062
+ - \`no reading\`: the reader returned no number. The block stays off and a
4063
+ check on that statement is \`unmeasured\`, never a pass.
4064
+ - \`on\` and \`off\` are block ids. A statement scheduled \`once\` keeps its block
4065
+ on after it is met.
4066
+ - A live model varies between two runs of the same scene, so a comparison's
4067
+ \`firstDivergence\` is always the first turn. Read the rows.
4068
+ - One sample cannot rank two versions. For a question about behaviour set
4069
+ \`execution.repeats\` to 3 or more and keep it there.
4070
+ - Write one behaviour per statement. A statement that scores near its bar on
4071
+ unrelated messages needs rewording.
4092
4072
 
4093
- \`sight character controls scene character.scene.json --out comparisons/scene-controls.json --scene-out comparisons/always-on.scene.json --json\`
4073
+ ## Run settings
4094
4074
 
4095
- This local generator writes a second scene in which authored text that sits
4096
- behind a detector condition or a step condition is always on, with the same
4097
- words. \`--scene-out\` writes that scene alone. Run it as the candidate of a
4098
- trial (\`sight character trial comparisons/always-on.scene.json ...\`) or with
4099
- \`run\`, on the same situations, to see whether a change comes from the
4100
- condition or only from the words; then revert, so it never becomes the
4101
- working parent. Text it cannot move honestly is refused with the block named:
4102
- \`moves\` blocks, interpolated values, blocks with several conditions or
4103
- another condition kind, and conditional text that also sets state. The
4104
- generator runs no model, compares nothing and chooses no winner. Writing
4105
- the same file twice is a no-op.
4075
+ Set in \`workbench.json\` under \`execution\`; the flag of the same name
4076
+ overrides one run. Changing any of them makes the next trial run the kept
4077
+ version again with the same settings.
4106
4078
 
4107
- ## Files and contracts
4079
+ | \`execution\` key | Flag | What it sets |
4080
+ | --- | --- | --- |
4081
+ | \`model\` | \`--model\` | The reply model, as \`vendor/model\` |
4082
+ | \`temperature\` | \`--temperature\` | Not sent to a model that takes none; the run warns |
4083
+ | \`maxOutputTokens\` | \`--max-output-tokens\` | The reply's output limit |
4084
+ | \`reasoningEffort\` | \`--reasoning-effort\` | ${FIELD_REASONING_EFFORTS.join(", ")} |
4085
+ | \`fallback\` | \`--fallback\` | A second model when the first fails |
4086
+ | \`reader\` | \`--reader-model\` | The model that reads detector statements |
4087
+ | \`repeats\` | \`--repeats\` | Conversations per situation |
4088
+ | \`modelSeed\` | \`--model-seed\` | The reply seed; not sent to a model that takes none |
4089
+ | \`moveSeed\` | \`--move-seed\` | The seed for sampled examples |
4108
4090
 
4109
- \`situations/climb.json\` is \`character-situations/v0.1\`. Each situation keeps
4110
- the \`moment-trace/v2\` shape and adds a stable id, family, split, provenance
4111
- and free tags. \`opening\` is constructed dialogue history only: it replays no
4112
- detector reads, clocks, latches or state transitions. Every line in \`served\`
4113
- goes through the real engine in order. Put state-establishing prefixes in
4114
- \`served\`, never in \`opening\`; \`servedPrefix\` optionally counts those leading
4115
- lines. Unknown format marks are refused.
4091
+ \`warnAt\` counts only warn. \`--stop-after-conversations\` and
4092
+ \`--stop-after-turns\` stop a run early, and \`resume\` cannot finish a run
4093
+ stopped that way.
4116
4094
 
4117
- \`checks.json\` is optional and provisional. It supports only turn-level
4118
- expectations: step, block entered or silent, sentence flagged or clean, and
4119
- state. Each check applies only to its declared situation and turn. Checks
4120
- produce pass, fail, unmeasured or errored rows, never a character score or a
4121
- keep decision. No check file executes code. Code rows carry check-set,
4122
- check-runner and comparison implementation versions.
4095
+ ## Checks
4123
4096
 
4124
- Annotations are append-only JSONL records with a typed \`target\`, \`name\`,
4125
- \`annotator\`, and at least one of \`label\`, \`score\` or \`explanation\`. A
4126
- correction is a new row whose \`metadata.replaces\` names the old row. Code check
4127
- rows carry \`metadata.checkSetHash\` and \`metadata.checkRunnerVersion\`. Human
4128
- annotations come from a person; an agent writes model annotations and marks them
4129
- as such. A model judgment is not a human label.
4097
+ \`checks.json\` is optional. Each check names a situation and a turn and gives
4098
+ \`pass\`, \`fail\` or \`unmeasured\`. One of each kind:
4130
4099
 
4131
- ## Decision and credential boundaries
4100
+ \`\`\`json
4101
+ {
4102
+ "format": "${CHECK_SET_FORMAT}",
4103
+ "checks": [
4104
+ { "id": "starts-listening", "situation": "ordinary-hello", "turn": 0, "kind": "step", "step": "listening" },
4105
+ { "id": "floor-on", "situation": "ordinary-hello", "turn": 0, "kind": "block", "blockId": "character-floor", "entered": true },
4106
+ { "id": "hard-day-clean", "situation": "ordinary-hello", "turn": 0, "kind": "sentence", "sentence": "<statement or read id>", "flagged": false },
4107
+ { "id": "still-listening", "situation": "ordinary-hello", "turn": 1, "kind": "state", "name": "moment", "value": "listening" }
4108
+ ]
4109
+ }
4110
+ \`\`\`
4132
4111
 
4133
- Use only the isolated parent and candidate lab profiles named in
4134
- \`workbench.json\`. Never target production or read production credentials from
4135
- the agent environment.
4112
+ ## Single runs and the always-on scene
4136
4113
 
4137
- The configured human designers decide behavioral keeps and supply the cited
4138
- run-scoped human note bound to the kept run. Agent keeps and reverts are
4139
- mechanical and exploratory only. They also require complete comparison evidence
4140
- and explicit \`workbench.agent.mechanicalKeep\` or
4141
- \`workbench.agent.mechanicalRevert\` permission. An agent cannot make a behavioral
4142
- keep. No command here picks a winner or claims a validated improvement.
4114
+ - \`sight character preflight character.scene.json --situations situations/climb.json --profile ${candidate} --runs runs --json\`
4115
+ - \`sight character run character.scene.json --situations situations/climb.json --profile ${candidate} --runs runs --json\`
4116
+ - \`sight character resume runs/<run-id> --json\` finishes an interrupted run without repeating a turn already made.
4117
+ - \`sight character compare runs/<parent-run-id> runs/<candidate-run-id> --checks checks.json --notes annotations/notes.jsonl --out comparisons/by-hand.json --json\`
4118
+ - \`sight character controls scene character.scene.json --out comparisons/scene-controls.json --scene-out comparisons/always-on.scene.json --json\`
4119
+
4120
+ The always-on scene has the same words, but text behind a detector condition or a step condition is always on.
4121
+ Run it as a trial candidate (\`sight character trial comparisons/always-on.scene.json ...\`)
4122
+ to see whether a change comes from the condition or only from the words, then
4123
+ revert it. Blocks it cannot convert are refused by name.
4124
+
4125
+ ## Files
4126
+
4127
+ | File | Holds |
4128
+ | --- | --- |
4129
+ | \`workbench.json\` | Lab profiles, run settings, designers, agent permissions, the kept version |
4130
+ | \`character.scene.json\` | The working scene |
4131
+ | \`situations/climb.json\` | Scripted conversations. Every \`served\` line goes through the real engine; \`opening\` is history only |
4132
+ | \`checks.json\` | Optional expectations |
4133
+ | \`annotations/notes.jsonl\` | Notes, append only |
4134
+ | \`climb.jsonl\` | Trial, keep and revert records, append only |
4135
+ | \`runs/<run-id>/\` | One run: plan, scene, situations, turns, manifest |
4136
+ | \`runs/comparisons/\` | Comparisons written by \`trial\` |
4137
+
4138
+ The generated \`.gitignore\` commits each run's \`manifest.json\` and
4139
+ \`scene.json\` and keeps the rest local. In a fresh clone a trial runs the kept
4140
+ version again, recorded beside the original as \`rerun-of-<run-id>\`.
4141
+
4142
+ ## Who decides
4143
+
4144
+ - A behavioral keep is a configured human designer's, and cites that
4145
+ designer's run-scoped human note bound to the kept run.
4146
+ - An agent passes \`--agent\`. Its notes are model annotations. It may keep or
4147
+ revert only in mechanical mode, and only when \`agent.mechanicalKeep\` or
4148
+ \`agent.mechanicalRevert\` in \`workbench.json\` allows it.
4149
+ - No command picks a winner or computes a score.
4150
+ - Use only the lab profiles named in \`workbench.json\`. Never target production
4151
+ or read production credentials from the agent environment.
4152
+ - A conversation left in an unknown state blocks its profile until the
4153
+ service's idle limit.
4143
4154
 
4144
4155
  Production go-live is not an agent command. A person reviews the frozen scene,
4145
4156
  then uses the existing Field scene PUT (\`profiles.putScene\`) with a production
4146
- key and the current profile etag as \`If-Match\`. That person owns the production
4147
- write and any rollback; this workbench supplies neither a credential nor a
4148
- production deployment command.
4149
-
4150
- Service limits are reported, not treated as behavioral failures. Warning counts
4151
- in \`workbench.json\` warn only; they are not budgets and stop nothing.
4157
+ key and the current profile etag as \`If-Match\`.
4152
4158
  `;
4153
4159
  }
4154
4160
  function workbenchDocument(model, parent, candidate, parentProfile, candidateProfile, humanAnnotatorIds2) {
@@ -4162,6 +4168,9 @@ function workbenchDocument(model, parent, candidate, parentProfile, candidatePro
4162
4168
  model,
4163
4169
  temperature: parentProfile.runtime?.temperature ?? 0.7,
4164
4170
  reader: parentProfile.runtime?.readerModel ?? null,
4171
+ repeats: 1,
4172
+ modelSeed: 1,
4173
+ moveSeed: 1,
4165
4174
  replyCheck: "off",
4166
4175
  readsPosture: parentEndpoint.readsPosture,
4167
4176
  closingLine: parentEndpoint.closingLine,
@@ -4549,7 +4558,7 @@ function buildSceneControls(input) {
4549
4558
 
4550
4559
  // src/character/index.ts
4551
4560
  var CHARACTER_USAGE = [
4552
- "sight character init <dir> [--model <vendor/model>] [--parent <profile>] [--candidate <profile>] [--api <base>] [--json]",
4561
+ "sight character init <dir> [--model <vendor/model>] [--designer <id>[,<id>]] [--parent <profile>] [--candidate <profile>] [--api <base>] [--json]",
4553
4562
  "sight character check <scene.json> --profile <profile> [--if-match <etag>] [settings overrides] [--api <base>] [--json]",
4554
4563
  "sight character show <scene.json|run-dir> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]",
4555
4564
  "sight character diff <parent.scene.json> <working.scene.json> [--json]",
@@ -4559,10 +4568,14 @@ var CHARACTER_USAGE = [
4559
4568
  "sight character compare <parent-run-dir> <candidate-run-dir> [--parent-parent] [--checks <checks.json>] [--notes <notes.jsonl>] [--out <comparison.json>] [--json]",
4560
4569
  "sight character note <kind:id> --actor <id> --text <note> [--run <run-dir>] [--agent] [--json]",
4561
4570
  "sight character notes [--target <kind:id>] [--name <name>] [--tag <tag>] [--json]",
4562
- "sight character trial [scene.json] --actor <id> --reason <reason> [--parent-scene <scene.json>] [--replicate-id <id>] [--dry-run] [--json]",
4571
+ "sight character trial [scene.json] --actor <id> --reason <reason> [--parent-scene <scene.json>] [--replicate-id <id>] [--dry-run] [settings overrides] [--json]",
4563
4572
  "sight character keep <comparison.json> --actor <id> --reason <reason> [--mode behavioral|mechanical] [--note <id>] [--agent] [--json]",
4564
4573
  "sight character revert <comparison.json> --actor <id> --reason <reason> [--mode behavioral|mechanical] [--note <id>] [--agent] [--json]",
4565
- "sight character controls scene <scene.json> --out <controls.json> [--scene-out <always-on.scene.json>] [--json]"
4574
+ "sight character controls scene <scene.json> --out <controls.json> [--scene-out <always-on.scene.json>] [--json]",
4575
+ "",
4576
+ "settings overrides (run, preflight, trial); each defaults to execution.<name> in workbench.json:",
4577
+ " --model <vendor/model> --temperature <n> --max-output-tokens <n> --reasoning-effort <level> --fallback <vendor/model>",
4578
+ " --reader-model <id|null> --repeats <n> --model-seed <n> --move-seed <n>"
4566
4579
  ].join("\n");
4567
4580
  var CharacterCommandError = class extends Error {
4568
4581
  code;
@@ -4610,7 +4623,7 @@ var TRIAL_VALUE_FLAGS = [
4610
4623
  "--out"
4611
4624
  ];
4612
4625
  var VALUE_FLAGS = {
4613
- init: /* @__PURE__ */ new Set(["--api", "--model", "--parent", "--candidate"]),
4626
+ init: /* @__PURE__ */ new Set(["--api", "--model", "--parent", "--candidate", "--designer"]),
4614
4627
  check: /* @__PURE__ */ new Set([
4615
4628
  "--api",
4616
4629
  "--profile",
@@ -4849,8 +4862,38 @@ function readWorkbench(parsed) {
4849
4862
  if (value["format"] !== "character-workbench/v0.1" || !profiles || !execution || !agent || typeof profiles["parent"] !== "string" || typeof profiles["candidate"] !== "string" || humanAnnotatorIds2 !== void 0 && (!Array.isArray(humanAnnotatorIds2) || humanAnnotatorIds2.length === 0 || !humanAnnotatorIds2.every((id) => typeof id === "string" && id.trim().length > 0) || new Set(humanAnnotatorIds2).size !== humanAnnotatorIds2.length)) {
4850
4863
  throw new CharacterCommandError("invalid_workbench", `${path} is not a character-workbench/v0.1 document`);
4851
4864
  }
4865
+ const problems = executionProblems(execution);
4866
+ if (problems.length > 0) {
4867
+ throw new CharacterCommandError("invalid_workbench", `${path} has run settings that do not read`, problems);
4868
+ }
4852
4869
  return { directory, document: value };
4853
4870
  }
4871
+ function executionProblems(execution) {
4872
+ const problems = [];
4873
+ const present = (key) => execution[key] !== void 0;
4874
+ const integer = (key, min) => {
4875
+ if (present(key) && (!Number.isSafeInteger(execution[key]) || execution[key] < min)) {
4876
+ problems.push(`execution.${key} is an integer of at least ${min}`);
4877
+ }
4878
+ };
4879
+ if (present("model") && (typeof execution["model"] !== "string" || execution["model"].trim().length === 0)) {
4880
+ problems.push("execution.model is a non-empty string");
4881
+ }
4882
+ if (present("temperature") && (typeof execution["temperature"] !== "number" || !Number.isFinite(execution["temperature"]))) {
4883
+ problems.push("execution.temperature is a number");
4884
+ }
4885
+ if (present("reasoningEffort") && !FIELD_REASONING_EFFORTS.includes(execution["reasoningEffort"])) {
4886
+ problems.push(`execution.reasoningEffort is one of ${FIELD_REASONING_EFFORTS.join(", ")}`);
4887
+ }
4888
+ if (present("fallback") && execution["fallback"] !== null && typeof execution["fallback"] !== "string") {
4889
+ problems.push("execution.fallback is a model id or null");
4890
+ }
4891
+ integer("maxOutputTokens", 0);
4892
+ integer("repeats", 1);
4893
+ integer("modelSeed", 0);
4894
+ integer("moveSeed", 0);
4895
+ return problems;
4896
+ }
4854
4897
  function humanAnnotatorIds(workbench) {
4855
4898
  return workbench?.document.humanAnnotatorIds;
4856
4899
  }
@@ -4902,15 +4945,16 @@ async function prepareRun(parsed, workbench, profile, scenePath, dryRun) {
4902
4945
  const situations = readFileSync(situationsPath, "utf8");
4903
4946
  const situationSet = parseSituationSet(JSON.parse(situations));
4904
4947
  const execution = workbench?.document.execution;
4905
- const reasoningEffort2 = parsed.values.get("--reasoning-effort");
4906
- if (reasoningEffort2 !== void 0 && !FIELD_REASONING_EFFORTS.includes(reasoningEffort2)) {
4948
+ const reasoningFlag = parsed.values.get("--reasoning-effort");
4949
+ if (reasoningFlag !== void 0 && !FIELD_REASONING_EFFORTS.includes(reasoningFlag)) {
4907
4950
  throw new CharacterCommandError("invalid_arguments", `--reasoning-effort is one of ${FIELD_REASONING_EFFORTS.join(", ")}`);
4908
4951
  }
4952
+ const reasoningEffort2 = reasoningFlag ?? execution?.reasoningEffort;
4909
4953
  const model = parsed.values.get("--model") ?? execution?.model;
4910
4954
  const temperature = numberFlag(parsed, "--temperature") ?? execution?.temperature;
4911
- const maxOutputTokens = nonNegativeFlag(parsed, "--max-output-tokens");
4955
+ const maxOutputTokens = nonNegativeFlag(parsed, "--max-output-tokens") ?? execution?.maxOutputTokens;
4912
4956
  const readerModel = parsed.values.has("--reader-model") ? parsed.values.get("--reader-model") === "null" ? null : parsed.values.get("--reader-model") : execution?.reader;
4913
- const fallback = parsed.values.get("--fallback");
4957
+ const fallback = parsed.values.get("--fallback") ?? execution?.fallback ?? void 0;
4914
4958
  const revealsState = booleanValue(parsed, "--reveals-state") ?? execution?.revealsState ?? true;
4915
4959
  const afterConversations = nonNegativeFlag(parsed, "--stop-after-conversations");
4916
4960
  const afterTurns = nonNegativeFlag(parsed, "--stop-after-turns");
@@ -4918,7 +4962,7 @@ async function prepareRun(parsed, workbench, profile, scenePath, dryRun) {
4918
4962
  ...afterConversations !== void 0 ? { afterConversations } : {},
4919
4963
  ...afterTurns !== void 0 ? { afterTurns } : {}
4920
4964
  };
4921
- const repeats = numberFlag(parsed, "--repeats", true) ?? 1;
4965
+ const repeats = numberFlag(parsed, "--repeats", true) ?? execution?.repeats ?? 1;
4922
4966
  if (repeats < 1) throw new CharacterCommandError("invalid_arguments", "--repeats is a positive integer");
4923
4967
  const runtime = {
4924
4968
  ...model !== void 0 ? { model } : {},
@@ -4936,8 +4980,8 @@ async function prepareRun(parsed, workbench, profile, scenePath, dryRun) {
4936
4980
  ...nonNegativeFlag(parsed, "--turns-per-conversation") !== void 0 ? { turnsPerConversation: nonNegativeFlag(parsed, "--turns-per-conversation") } : {},
4937
4981
  ...nonNegativeFlag(parsed, "--conversations-per-day") !== void 0 ? { conversationsPerDay: nonNegativeFlag(parsed, "--conversations-per-day") } : {}
4938
4982
  };
4939
- const modelSeed = numberFlag(parsed, "--model-seed", true);
4940
- const moveSeed = numberFlag(parsed, "--move-seed", true);
4983
+ const modelSeed = numberFlag(parsed, "--model-seed", true) ?? execution?.modelSeed;
4984
+ const moveSeed = numberFlag(parsed, "--move-seed", true) ?? execution?.moveSeed;
4941
4985
  let replicateId2 = parsed.values.get("--replicate-id");
4942
4986
  if (replicateId2 !== void 0 && (replicateId2.trim().length === 0 || replicateId2.length > 200)) {
4943
4987
  throw new CharacterCommandError("invalid_arguments", "--replicate-id needs a non-empty value of at most 200 characters");
@@ -4974,13 +5018,19 @@ async function prepareRun(parsed, workbench, profile, scenePath, dryRun) {
4974
5018
  modelCallsFloor: situationSet.situations.reduce((total, situation) => total + situation.served.length, 0) * repeats
4975
5019
  };
4976
5020
  const planPath = join8(runDir, "plan.json");
5021
+ let createdAt = (/* @__PURE__ */ new Date()).toISOString();
5022
+ try {
5023
+ const prior = JSON.parse(readFileSync(planPath, "utf8"));
5024
+ if (prior.runId === runId && typeof prior.createdAt === "string") createdAt = prior.createdAt;
5025
+ } catch {
5026
+ }
4977
5027
  const plan = {
4978
5028
  schema: "character-run-plan/v0.1",
4979
5029
  status: "planned",
4980
5030
  dryRun,
4981
5031
  runnerContract: CHARACTER_RUNNER_CONTRACT,
4982
5032
  runnerVersion: "character-cli/v0.2",
4983
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5033
+ createdAt,
4984
5034
  runId,
4985
5035
  runDir,
4986
5036
  planPath,
@@ -5028,6 +5078,9 @@ function assertRunEvidence(result2) {
5028
5078
  attempts: result2.attempts
5029
5079
  });
5030
5080
  }
5081
+ function printRunWarnings(result2) {
5082
+ for (const warning of result2.warnings) console.error(`warning ${result2.runId}: ${warning}`);
5083
+ }
5031
5084
  async function executePrepared(parsed, prepared) {
5032
5085
  const result2 = await runCharacter({
5033
5086
  ...prepared.options,
@@ -5054,6 +5107,7 @@ plan: ${prepared.plan.planPath}`
5054
5107
  };
5055
5108
  }
5056
5109
  const result2 = await executePrepared(parsed, prepared);
5110
+ printRunWarnings(result2);
5057
5111
  return {
5058
5112
  result: { ...result2, plan: prepared.plan },
5059
5113
  rendered: `run ${result2.runId}: ${result2.status}
@@ -5124,6 +5178,33 @@ function finalizeCheckIds(comparison, generated, existing) {
5124
5178
  }
5125
5179
  return generated.map((annotation) => replacements.get(annotation.id));
5126
5180
  }
5181
+ function readOutcome(read) {
5182
+ if (typeof read["score"] === "number" && typeof read["bar"] === "number") return read["score"] >= read["bar"] ? "met" : "unmet";
5183
+ if (read["value"] === "flagged" || read["value"] === "clean") return read["value"] === "flagged" ? "met" : "unmet";
5184
+ if (typeof read["flagged"] === "boolean") return read["flagged"] ? "met" : "unmet";
5185
+ return "none";
5186
+ }
5187
+ function renderTurnMechanics(turn, totals) {
5188
+ const lines = [];
5189
+ if (turn.reads === null) lines.push(" reads: not recorded");
5190
+ for (const raw of turn.reads ?? []) {
5191
+ if (raw === null || typeof raw !== "object") continue;
5192
+ const read = raw;
5193
+ const outcome = readOutcome(read);
5194
+ totals[outcome] += 1;
5195
+ const phase = read["phase"] === "pre" ? "before" : read["phase"] === "post" ? "after " : " ";
5196
+ const score = typeof read["score"] === "number" ? String(read["score"]) : "-";
5197
+ const bar = typeof read["bar"] === "number" ? `/${read["bar"]}` : "";
5198
+ lines.push(` read ${phase} ${`${score}${bar}`.padEnd(9)} ${(outcome === "none" ? "no reading" : outcome).padEnd(10)} ${String(read["statement"] ?? read["id"] ?? "")}`);
5199
+ }
5200
+ if (turn.blocks === null) lines.push(" blocks: not recorded");
5201
+ else {
5202
+ const blocks2 = turn.blocks;
5203
+ const ids = (fired) => blocks2.filter((block) => block.fired === fired).map((block) => block.id).join(", ") || "-";
5204
+ lines.push(` on: ${ids(true)}`, ` off: ${ids(false)}`);
5205
+ }
5206
+ return lines.join("\n");
5207
+ }
5127
5208
  async function executeShow(parsed) {
5128
5209
  expectPositionals(parsed, 1, "sight character show <scene.json|run-dir> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]");
5129
5210
  const path = parsed.positionals[0];
@@ -5172,12 +5253,15 @@ scene SHA-256: ${sceneDigest}` };
5172
5253
  }
5173
5254
  return { ...attempt, annotations: attemptAnnotations, turns };
5174
5255
  });
5256
+ const readTotals = { met: 0, unmet: 0, none: 0 };
5175
5257
  const rendered = rows.flatMap((attempt) => attempt.turns.map((turn) => {
5176
5258
  const normalized = turn.normalized;
5177
5259
  const notes = turn.annotations.map((annotation) => `
5178
5260
  ${annotation.annotator.id}: ${annotation.explanation ?? annotation.label ?? annotation.name}`).join("");
5261
+ const mechanics = normalized === null ? "" : `
5262
+ ${renderTurnMechanics(normalized, readTotals)}`;
5179
5263
  return `${attempt.situationId}/${attempt.repeat}/${turn.turnIndex}: ${normalized?.status ?? "missing"}${normalized?.reply === void 0 ? "" : `
5180
- ${normalized.reply}`}${notes}`;
5264
+ ${normalized.reply}`}${mechanics}${notes}`;
5181
5265
  })).join("\n");
5182
5266
  return {
5183
5267
  result: {
@@ -5186,17 +5270,22 @@ ${normalized.reply}`}${notes}`;
5186
5270
  situationsDigest: evidence.situationsDigest,
5187
5271
  selectors: { situation: situation ?? null, repeat: repeat ?? null, turn: turnIndex ?? null },
5188
5272
  annotations: humanAnnotations,
5273
+ readTotals,
5189
5274
  attempts: rows
5190
5275
  },
5191
- rendered: rendered || "no turn evidence"
5276
+ rendered: rendered ? `${rendered}
5277
+ reads: ${readTotals.met} met, ${readTotals.unmet} unmet, ${readTotals.none} with no reading` : "no turn evidence"
5192
5278
  };
5193
5279
  }
5194
- async function compareAndPersist(parentDir, candidateDir, checksPath, notesPath, explicitChecks, requestedOutput) {
5195
- await Promise.all([assertCharacterDevelopmentRun(parentDir), assertCharacterDevelopmentRun(candidateDir)]);
5280
+ function readTargetedChecks(checksPath, explicitChecks) {
5196
5281
  if (explicitChecks && !existsSync2(checksPath)) {
5197
5282
  throw new CharacterCommandError("read_failed", `could not read ${checksPath}`);
5198
5283
  }
5199
- const targeted = existsSync2(checksPath) ? parseCheckSet(JSON.parse(readFileSync(checksPath, "utf8"))).checks : void 0;
5284
+ return existsSync2(checksPath) ? parseCheckSet(JSON.parse(readFileSync(checksPath, "utf8"))).checks : void 0;
5285
+ }
5286
+ async function compareAndPersist(parentDir, candidateDir, checksPath, notesPath, explicitChecks, requestedOutput) {
5287
+ const targeted = readTargetedChecks(checksPath, explicitChecks);
5288
+ await Promise.all([assertCharacterDevelopmentRun(parentDir), assertCharacterDevelopmentRun(candidateDir)]);
5200
5289
  const checks = targeted?.map(borrowedCheck);
5201
5290
  const checkSetHash = checks === void 0 ? void 0 : hashCheckSet(checks);
5202
5291
  const annotations = await listAnnotations(notesPath);
@@ -5452,6 +5541,18 @@ async function executeTrial(parsed) {
5452
5541
  assertHumanActor(workbench, parsed.booleans.has("--agent"), requiredValue(parsed, "--actor"), "a trial");
5453
5542
  requiredValue(parsed, "--reason");
5454
5543
  }
5544
+ const checksPath = parsed.values.get("--checks") ?? join8(workbench.directory, "checks.json");
5545
+ const targetedChecks = readTargetedChecks(checksPath, parsed.values.has("--checks"));
5546
+ if (targetedChecks !== void 0 && targetedChecks.length > 0) {
5547
+ const situationsPath = parsed.values.get("--situations") ?? join8(workbench.directory, "situations", "climb.json");
5548
+ const served = new Map(parseSituationSet(JSON.parse(readFileSync(situationsPath, "utf8"))).situations.map((situation) => [situation.id, situation.served.length]));
5549
+ const problems = targetedChecks.flatMap((check, index) => {
5550
+ const turns = served.get(check.situation);
5551
+ if (turns === void 0) return [`checks[${index}]: situation '${check.situation}' is not in ${situationsPath}`];
5552
+ return check.turn < turns ? [] : [`checks[${index}]: turn ${check.turn} is past the ${turns} served turns of '${check.situation}'`];
5553
+ });
5554
+ if (problems.length > 0) throw new CharacterCommandError("invalid_contract", "a character contract does not read", problems);
5555
+ }
5455
5556
  const candidatePrepared = await prepareRun(parsed, workbench, candidateProfile, scenePath, dryRun);
5456
5557
  const previousParent = readWorkingParent(workbench);
5457
5558
  if (previousParent !== null && previousParent.spec !== null) await assertCharacterDevelopmentRun(previousParent.runDir);
@@ -5491,14 +5592,30 @@ async function executeTrial(parsed) {
5491
5592
  };
5492
5593
  return { result: result2, rendered: "trial dry run: no PUT, provider call, comparison or decision" };
5493
5594
  }
5595
+ if (!existsSync2(join8(candidatePrepared.plan.runDir, "spec.json"))) {
5596
+ const { runtime, endpoint } = candidatePrepared.options;
5597
+ await fieldFor(parsed).profiles.putScene(candidateProfile, readFileSync(scenePath, "utf8"), {
5598
+ ...runtime?.model !== void 0 ? { model: runtime.model } : {},
5599
+ ...runtime?.temperature !== void 0 ? { temperature: runtime.temperature } : {},
5600
+ ...runtime?.maxOutputTokens !== void 0 ? { maxOutputTokens: runtime.maxOutputTokens } : {},
5601
+ ...runtime?.reasoningEffort !== void 0 ? { reasoningEffort: runtime.reasoningEffort } : {},
5602
+ ...typeof runtime?.fallback === "string" ? { fallback: runtime.fallback } : {},
5603
+ ...endpoint?.idleMinutes !== void 0 ? { idleMinutes: endpoint.idleMinutes } : {},
5604
+ ...endpoint?.turnsPerConversation !== void 0 ? { turnsPerConversation: endpoint.turnsPerConversation } : {},
5605
+ ...endpoint?.conversationsPerDay !== void 0 ? { conversationsPerDay: endpoint.conversationsPerDay } : {},
5606
+ dryRun: true
5607
+ });
5608
+ }
5494
5609
  const parentResult = parentPrepared !== void 0 ? existsSync2(join8(parentPrepared.plan.runDir, "spec.json")) ? await resumeEvidence(parsed, parentPrepared.plan.runDir, workbench) : await executePrepared(parsed, parentPrepared) : await resumeEvidence(parsed, previousParent.runDir, workbench);
5495
5610
  console.error(`parent ${parentResult.runId}: ${parentResult.status}`);
5611
+ printRunWarnings(parentResult);
5496
5612
  const candidateResult = existsSync2(join8(candidatePrepared.plan.runDir, "spec.json")) ? await resumeEvidence(parsed, candidatePrepared.plan.runDir, workbench) : await executePrepared(parsed, candidatePrepared);
5497
5613
  console.error(`candidate ${candidateResult.runId}: ${candidateResult.status}`);
5614
+ printRunWarnings(candidateResult);
5498
5615
  const compared = await compareAndPersist(
5499
5616
  parentResult.runDir,
5500
5617
  candidateResult.runDir,
5501
- parsed.values.get("--checks") ?? join8(workbench.directory, "checks.json"),
5618
+ checksPath,
5502
5619
  parsed.values.get("--notes") ?? join8(workbench.directory, "annotations", "notes.jsonl"),
5503
5620
  parsed.values.has("--checks"),
5504
5621
  parsed.values.get("--out")
@@ -5725,7 +5842,8 @@ outcome: ${dryRun.outcome}`);
5725
5842
  field: fieldFor(parsed),
5726
5843
  model: parsed.values.get("--model"),
5727
5844
  parent: parsed.values.get("--parent"),
5728
- candidate: parsed.values.get("--candidate")
5845
+ candidate: parsed.values.get("--candidate"),
5846
+ ...parsed.values.has("--designer") ? { humanAnnotatorIds: parsed.values.get("--designer").split(",") } : {}
5729
5847
  });
5730
5848
  printSuccess(output, result2, `initialized ${result2.directory}
5731
5849
  parent: ${result2.profiles.parent.profile}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cultured_computer/sight",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "bin": {
5
5
  "sight": "./dist/cli.js"
6
6
  },