@cultured_computer/sight 0.10.4 → 0.10.5
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 +16 -0
- package/dist/cli.js +228 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +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
|
+
## 0.10.5 (2026-12-02)
|
|
9
|
+
|
|
10
|
+
- `sight character show <comparison.json>` prints a trial as one Markdown
|
|
11
|
+
page: the scene change, then for every turn the person's message, the kept
|
|
12
|
+
reply, the candidate reply, each statement's reading on both sides, the
|
|
13
|
+
blocks that were on and the checks that did not pass. Raw text is escaped
|
|
14
|
+
for GitHub and Deepnote, so a trial can be reviewed as a pull request.
|
|
15
|
+
Both `runs/comparisons/` and the documented manual `comparisons/` path find
|
|
16
|
+
their run evidence. Missing evidence says `not recorded`, distinct from a
|
|
17
|
+
recorded empty list; categorical and boolean reads need no numeric fields;
|
|
18
|
+
and zero-turn attempts are not counted as turns.
|
|
19
|
+
- `sight character show <run-dir>` prints the person's message above each
|
|
20
|
+
reply and lists turns in the order of the situations file, then numerically
|
|
21
|
+
by repeat and turn index. The `attempts` in `--json` follow the same order.
|
|
22
|
+
- `sight --version` prints the package version.
|
|
23
|
+
|
|
8
24
|
## 0.10.4 (2026-12-02)
|
|
9
25
|
|
|
10
26
|
- `sight character trial` validates before any reply is made: a
|
package/dist/cli.js
CHANGED
|
@@ -370,9 +370,9 @@ async function sendImport(plan, options, deps) {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
// src/character/index.ts
|
|
373
|
-
import { existsSync as existsSync2, readdirSync, readFileSync } from "fs";
|
|
373
|
+
import { existsSync as existsSync2, readdirSync, readFileSync, statSync } from "fs";
|
|
374
374
|
import { homedir } from "os";
|
|
375
|
-
import { dirname as dirname5, isAbsolute, join as join8, relative } from "path";
|
|
375
|
+
import { dirname as dirname5, isAbsolute, join as join8, relative, resolve } from "path";
|
|
376
376
|
|
|
377
377
|
// src/field.ts
|
|
378
378
|
var DEFAULT_FIELD_ENDPOINT = "https://api.cultured.computer";
|
|
@@ -1126,7 +1126,7 @@ async function locked(filePath, operation, timeoutMs) {
|
|
|
1126
1126
|
if (Date.now() >= deadline) {
|
|
1127
1127
|
throw new CharacterAnnotationError("locked", `annotation file is locked: ${filePath}`, { cause: error });
|
|
1128
1128
|
}
|
|
1129
|
-
await new Promise((
|
|
1129
|
+
await new Promise((resolve2) => setTimeout(resolve2, 25));
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
try {
|
|
@@ -2181,7 +2181,7 @@ async function withFileLocks(paths, operation) {
|
|
|
2181
2181
|
if (!object3(error) || error["code"] !== "EEXIST") throw error;
|
|
2182
2182
|
if (await removeLockOfDeadProcess(lockPath)) continue;
|
|
2183
2183
|
if (Date.now() >= deadline) throw new CharacterDecisionError("locked", `evidence file is locked: ${path}`, { cause: error });
|
|
2184
|
-
await new Promise((
|
|
2184
|
+
await new Promise((resolve2) => setTimeout(resolve2, 25));
|
|
2185
2185
|
}
|
|
2186
2186
|
}
|
|
2187
2187
|
await handle.close();
|
|
@@ -2585,7 +2585,7 @@ function defaultNow() {
|
|
|
2585
2585
|
return /* @__PURE__ */ new Date();
|
|
2586
2586
|
}
|
|
2587
2587
|
async function defaultSleep(milliseconds) {
|
|
2588
|
-
await new Promise((
|
|
2588
|
+
await new Promise((resolve2) => setTimeout(resolve2, milliseconds));
|
|
2589
2589
|
}
|
|
2590
2590
|
function parseJson(raw, label) {
|
|
2591
2591
|
try {
|
|
@@ -4017,8 +4017,11 @@ the actor; use another configured id when that person is the actual designer.
|
|
|
4017
4017
|
\`parentRunReasons\` and stderr say which. The actor, \`checks.json\` and the
|
|
4018
4018
|
candidate scene are validated before any reply is made.
|
|
4019
4019
|
|
|
4020
|
-
4. Read
|
|
4020
|
+
4. Read the trial. The first command prints one Markdown page with the scene
|
|
4021
|
+
change and, for every turn, the person's message and both replies; save it
|
|
4022
|
+
as \`reviews/<name>.md\` for the designer to read:
|
|
4021
4023
|
|
|
4024
|
+
- \`sight character show <comparison-path>\`
|
|
4022
4025
|
- \`sight character show runs/<candidate-run-id>\`
|
|
4023
4026
|
- \`sight character show runs/<run-id> --situation ordinary-hello --repeat 1 --turn 0 --json\`
|
|
4024
4027
|
|
|
@@ -4050,6 +4053,7 @@ the actor; use another configured id when that person is the actual designer.
|
|
|
4050
4053
|
|
|
4051
4054
|
\`\`\`text
|
|
4052
4055
|
ordinary-hello/1/0: walking
|
|
4056
|
+
> <the person's message>
|
|
4053
4057
|
<the reply>
|
|
4054
4058
|
read before 0.9/0.5 met <statement>
|
|
4055
4059
|
read after - no reading <statement>
|
|
@@ -4058,9 +4062,12 @@ ordinary-hello/1/0: walking
|
|
|
4058
4062
|
\`\`\`
|
|
4059
4063
|
|
|
4060
4064
|
- \`read\`: score over bar, and whether the statement was read before or after
|
|
4061
|
-
the reply.
|
|
4065
|
+
the reply. Categorical and boolean reads show \`met\` or \`unmet\` without a
|
|
4066
|
+
score. A statement read after the reply acts on the next turn.
|
|
4062
4067
|
- \`no reading\`: the reader returned no number. The block stays off and a
|
|
4063
4068
|
check on that statement is \`unmeasured\`, never a pass.
|
|
4069
|
+
- \`not recorded\` means reads or blocks were not captured; \`none\` means the
|
|
4070
|
+
captured list is empty. They are different evidence.
|
|
4064
4071
|
- \`on\` and \`off\` are block ids. A statement scheduled \`once\` keeps its block
|
|
4065
4072
|
on after it is met.
|
|
4066
4073
|
- A live model varies between two runs of the same scene, so a comparison's
|
|
@@ -4115,6 +4122,7 @@ stopped that way.
|
|
|
4115
4122
|
- \`sight character run character.scene.json --situations situations/climb.json --profile ${candidate} --runs runs --json\`
|
|
4116
4123
|
- \`sight character resume runs/<run-id> --json\` finishes an interrupted run without repeating a turn already made.
|
|
4117
4124
|
- \`sight character compare runs/<parent-run-id> runs/<candidate-run-id> --checks checks.json --notes annotations/notes.jsonl --out comparisons/by-hand.json --json\`
|
|
4125
|
+
- \`sight character show comparisons/by-hand.json\` reads that manual comparison with its run evidence under \`runs/\`.
|
|
4118
4126
|
- \`sight character controls scene character.scene.json --out comparisons/scene-controls.json --scene-out comparisons/always-on.scene.json --json\`
|
|
4119
4127
|
|
|
4120
4128
|
The always-on scene has the same words, but text behind a detector condition or a step condition is always on.
|
|
@@ -4560,7 +4568,7 @@ function buildSceneControls(input) {
|
|
|
4560
4568
|
var CHARACTER_USAGE = [
|
|
4561
4569
|
"sight character init <dir> [--model <vendor/model>] [--designer <id>[,<id>]] [--parent <profile>] [--candidate <profile>] [--api <base>] [--json]",
|
|
4562
4570
|
"sight character check <scene.json> --profile <profile> [--if-match <etag>] [settings overrides] [--api <base>] [--json]",
|
|
4563
|
-
"sight character show <scene.json|run-dir> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]",
|
|
4571
|
+
"sight character show <scene.json|run-dir|comparison.json> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]",
|
|
4564
4572
|
"sight character diff <parent.scene.json> <working.scene.json> [--json]",
|
|
4565
4573
|
"sight character run <scene.json> --situations <situations.json> --profile <profile> [--replicate-id <id>] [--dry-run] [--runs <dir>] [settings overrides] [--api <base>] [--json]",
|
|
4566
4574
|
"sight character preflight <scene.json> --situations <situations.json> --profile <profile> [--replicate-id <id>] [--runs <dir>] [settings overrides] [--json]",
|
|
@@ -5187,6 +5195,7 @@ function readOutcome(read) {
|
|
|
5187
5195
|
function renderTurnMechanics(turn, totals) {
|
|
5188
5196
|
const lines = [];
|
|
5189
5197
|
if (turn.reads === null) lines.push(" reads: not recorded");
|
|
5198
|
+
else if (turn.reads.length === 0) lines.push(" reads: none");
|
|
5190
5199
|
for (const raw of turn.reads ?? []) {
|
|
5191
5200
|
if (raw === null || typeof raw !== "object") continue;
|
|
5192
5201
|
const read = raw;
|
|
@@ -5200,14 +5209,204 @@ function renderTurnMechanics(turn, totals) {
|
|
|
5200
5209
|
if (turn.blocks === null) lines.push(" blocks: not recorded");
|
|
5201
5210
|
else {
|
|
5202
5211
|
const blocks2 = turn.blocks;
|
|
5203
|
-
const ids = (fired) => blocks2.filter((block) => block.fired === fired).map((block) => block.id).join(", ") || "
|
|
5212
|
+
const ids = (fired) => blocks2.filter((block) => block.fired === fired).map((block) => block.id).join(", ") || "none";
|
|
5204
5213
|
lines.push(` on: ${ids(true)}`, ` off: ${ids(false)}`);
|
|
5205
5214
|
}
|
|
5206
5215
|
return lines.join("\n");
|
|
5207
5216
|
}
|
|
5217
|
+
function personLine(capture) {
|
|
5218
|
+
const conversation = capture !== null && typeof capture === "object" ? capture.conversation : void 0;
|
|
5219
|
+
if (!Array.isArray(conversation)) return void 0;
|
|
5220
|
+
for (let index = conversation.length - 1; index >= 0; index -= 1) {
|
|
5221
|
+
const entry = conversation[index];
|
|
5222
|
+
if (entry !== null && typeof entry === "object" && entry.role === "person" && typeof entry.text === "string") return entry.text;
|
|
5223
|
+
}
|
|
5224
|
+
return void 0;
|
|
5225
|
+
}
|
|
5226
|
+
function quoted(text) {
|
|
5227
|
+
return text.split("\n").map((line) => line === "" ? ">" : `> ${line}`).join("\n");
|
|
5228
|
+
}
|
|
5229
|
+
function situationList2(value) {
|
|
5230
|
+
const list = Array.isArray(value) ? value : value !== null && typeof value === "object" && Array.isArray(value.situations) ? value.situations : [];
|
|
5231
|
+
return list.flatMap((entry) => {
|
|
5232
|
+
if (entry === null || typeof entry !== "object") return [];
|
|
5233
|
+
const { id, served } = entry;
|
|
5234
|
+
return typeof id === "string" ? [{ id, served: Array.isArray(served) ? served.filter((line) => typeof line === "string") : [] }] : [];
|
|
5235
|
+
});
|
|
5236
|
+
}
|
|
5237
|
+
function bySituationThenRepeat(situations) {
|
|
5238
|
+
const position = new Map(situationList2(situations).map((situation, index) => [situation.id, index]));
|
|
5239
|
+
const place = (id) => position.get(id) ?? Number.MAX_SAFE_INTEGER;
|
|
5240
|
+
return (left, right) => place(left.situationId) - place(right.situationId) || left.situationId.localeCompare(right.situationId) || Number(left.repeat) - Number(right.repeat) || String(left.repeat).localeCompare(String(right.repeat));
|
|
5241
|
+
}
|
|
5242
|
+
function readComparisonFile(path) {
|
|
5243
|
+
try {
|
|
5244
|
+
if (!statSync(path).isFile()) return void 0;
|
|
5245
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
5246
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) && String(value.schema ?? "").startsWith("character-comparison/") ? value : void 0;
|
|
5247
|
+
} catch {
|
|
5248
|
+
return void 0;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
function markdownText(text) {
|
|
5252
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
5253
|
+
}
|
|
5254
|
+
function markdownTableText(text) {
|
|
5255
|
+
return markdownText(text).replace(/\|/g, "\\|");
|
|
5256
|
+
}
|
|
5257
|
+
function quotedMarkdown(text) {
|
|
5258
|
+
return quoted(markdownText(text));
|
|
5259
|
+
}
|
|
5260
|
+
function comparisonRunDirectory(roots, runId) {
|
|
5261
|
+
if (runId.length === 0 || runId === "." || runId === ".." || runId.includes("/") || runId.includes("\\")) return null;
|
|
5262
|
+
let unidentified = null;
|
|
5263
|
+
for (const root of roots) {
|
|
5264
|
+
const directory = join8(root, runId);
|
|
5265
|
+
try {
|
|
5266
|
+
if (!statSync(directory).isDirectory()) continue;
|
|
5267
|
+
const identityFiles = ["spec.json", "manifest.json"].map((file) => join8(directory, file)).filter((file) => existsSync2(file));
|
|
5268
|
+
if (identityFiles.length === 0) {
|
|
5269
|
+
unidentified ??= directory;
|
|
5270
|
+
continue;
|
|
5271
|
+
}
|
|
5272
|
+
const identities = identityFiles.map((file) => JSON.parse(readFileSync(file, "utf8")));
|
|
5273
|
+
if (identities.every((identity) => identity.runId === runId)) return directory;
|
|
5274
|
+
} catch {
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
return unidentified;
|
|
5278
|
+
}
|
|
5279
|
+
function showComparison(parsed, path, comparison) {
|
|
5280
|
+
const runId = (key) => String(comparison[key]?.runId ?? "");
|
|
5281
|
+
const comparisonDirectory = dirname5(resolve(path));
|
|
5282
|
+
const roots = [.../* @__PURE__ */ new Set([dirname5(comparisonDirectory), join8(dirname5(comparisonDirectory), "runs")])];
|
|
5283
|
+
const parentDir = comparisonRunDirectory(roots, runId("parent"));
|
|
5284
|
+
const candidateDir = comparisonRunDirectory(roots, runId("candidate"));
|
|
5285
|
+
const json = (file) => {
|
|
5286
|
+
try {
|
|
5287
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
5288
|
+
} catch {
|
|
5289
|
+
return void 0;
|
|
5290
|
+
}
|
|
5291
|
+
};
|
|
5292
|
+
const situations = (candidateDir === null ? void 0 : json(join8(candidateDir, "situations.json"))) ?? (parentDir === null ? void 0 : json(join8(parentDir, "situations.json")));
|
|
5293
|
+
const served = new Map(situationList2(situations).map((situation2) => [situation2.id, situation2.served]));
|
|
5294
|
+
const situation = parsed.values.get("--situation");
|
|
5295
|
+
const repeat = nonNegativeFlag(parsed, "--repeat");
|
|
5296
|
+
const turnIndex = nonNegativeFlag(parsed, "--turn");
|
|
5297
|
+
const order = bySituationThenRepeat(situations);
|
|
5298
|
+
const rows = (Array.isArray(comparison["rows"]) ? comparison["rows"] : []).map((row) => row).filter((row) => (situation === void 0 || row.situationId === situation) && (repeat === void 0 || String(row.repeat) === String(repeat)) && (turnIndex === void 0 || row.turnIndex === turnIndex)).sort((left, right) => order(left, right) || (left.turnIndex ?? -1) - (right.turnIndex ?? -1));
|
|
5299
|
+
if (rows.length === 0) throw new CharacterCommandError("target_not_found", "no comparison rows match the selectors");
|
|
5300
|
+
const turnCount = rows.filter((row) => row.turnIndex !== null).length;
|
|
5301
|
+
const zeroTurnAttempts = rows.length - turnCount;
|
|
5302
|
+
const words = (text) => text === void 0 ? 0 : text.split(/\s+/).filter(Boolean).length;
|
|
5303
|
+
const cell = (read, evidence2) => {
|
|
5304
|
+
if (read === void 0) return evidence2 == null ? "not recorded" : "none";
|
|
5305
|
+
const outcome = readOutcome(read);
|
|
5306
|
+
if (outcome === "none") return "no reading";
|
|
5307
|
+
if (typeof read["score"] === "number" && typeof read["bar"] === "number") return `${read["score"]}/${read["bar"]} ${outcome}`;
|
|
5308
|
+
return outcome;
|
|
5309
|
+
};
|
|
5310
|
+
const reply = (label, side) => side.reply === void 0 ? [`**${label}:** no reply (${markdownText(side.status ?? "missing")})`, ""] : [`**${label}** (${words(side.reply)} words):`, "", quotedMarkdown(side.reply), ""];
|
|
5311
|
+
const on = (side) => side.blocks == null ? "not recorded" : side.blocks.filter((block) => block.fired).map((block) => block.id).join(", ") || "none";
|
|
5312
|
+
const evidence = [`${turnCount} ${turnCount === 1 ? "turn" : "turns"} shown`];
|
|
5313
|
+
if (zeroTurnAttempts > 0) evidence.push(`${zeroTurnAttempts} zero-turn ${zeroTurnAttempts === 1 ? "attempt" : "attempts"} shown`);
|
|
5314
|
+
const lines = [
|
|
5315
|
+
"# Kept version against candidate",
|
|
5316
|
+
"",
|
|
5317
|
+
`- Kept: \`${markdownText(runId("parent"))}\``,
|
|
5318
|
+
`- Candidate: \`${markdownText(runId("candidate"))}\``,
|
|
5319
|
+
`- Evidence: ${markdownText(String(comparison["status"] ?? "unknown"))}, ${evidence.join(", ")}`,
|
|
5320
|
+
"",
|
|
5321
|
+
"## What changed in the scene",
|
|
5322
|
+
""
|
|
5323
|
+
];
|
|
5324
|
+
const sceneSource = (key, directory) => {
|
|
5325
|
+
if (directory === null) return void 0;
|
|
5326
|
+
try {
|
|
5327
|
+
const source = readFileSync(join8(directory, "scene.json"), "utf8");
|
|
5328
|
+
const expected = comparison[key]?.sceneDigest;
|
|
5329
|
+
if (expected !== void 0 && (typeof expected !== "string" || sha256(source) !== expected)) return void 0;
|
|
5330
|
+
return source;
|
|
5331
|
+
} catch {
|
|
5332
|
+
return void 0;
|
|
5333
|
+
}
|
|
5334
|
+
};
|
|
5335
|
+
const parentScene = sceneSource("parent", parentDir);
|
|
5336
|
+
const candidateScene = sceneSource("candidate", candidateDir);
|
|
5337
|
+
if (parentScene === void 0 || candidateScene === void 0) lines.push("The two scenes are not both on this machine. Both available scene files must match the comparison digests.", "");
|
|
5338
|
+
else if (parentScene === candidateScene) lines.push("Nothing. Both sides ran the same scene, so every difference below is the model varying on its own.", "");
|
|
5339
|
+
else lines.push(renderSceneDiff(diffScenes(parseSceneText(parentScene), parseSceneText(candidateScene))).replace(/^## /gm, "### ").trimEnd(), "");
|
|
5340
|
+
for (const row of rows) {
|
|
5341
|
+
const heading = `${markdownText(row.situationId)}, repeat ${markdownText(String(row.repeat))}`;
|
|
5342
|
+
if (row.turnIndex === null) {
|
|
5343
|
+
lines.push(`## ${heading}`, "", "No turns were planned or captured on either side.", "");
|
|
5344
|
+
continue;
|
|
5345
|
+
}
|
|
5346
|
+
lines.push(`## ${heading}, turn ${row.turnIndex}`, "");
|
|
5347
|
+
const person = served.get(row.situationId)?.[row.turnIndex];
|
|
5348
|
+
if (person === void 0) lines.push("**Person:** not recorded", "");
|
|
5349
|
+
else lines.push("**Person:**", "", quotedMarkdown(person), "");
|
|
5350
|
+
lines.push(...reply("Kept", row.parent), ...reply("Candidate", row.candidate));
|
|
5351
|
+
const reads = /* @__PURE__ */ new Map();
|
|
5352
|
+
for (const key of ["parent", "candidate"]) {
|
|
5353
|
+
for (const raw of row[key].reads ?? []) {
|
|
5354
|
+
if (raw === null || typeof raw !== "object") continue;
|
|
5355
|
+
const read = raw;
|
|
5356
|
+
const id = String(read["id"] ?? read["statement"] ?? "");
|
|
5357
|
+
const entry = reads.get(id) ?? {
|
|
5358
|
+
statement: String(read["statement"] ?? id),
|
|
5359
|
+
phase: read["phase"] === "pre" ? "before" : read["phase"] === "post" ? "after" : ""
|
|
5360
|
+
};
|
|
5361
|
+
entry[key] = read;
|
|
5362
|
+
reads.set(id, entry);
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5365
|
+
if (reads.size === 0) {
|
|
5366
|
+
const keptReads = row.parent.reads == null ? "not recorded" : "none";
|
|
5367
|
+
const candidateReads = row.candidate.reads == null ? "not recorded" : "none";
|
|
5368
|
+
if (keptReads === candidateReads) lines.push(`Reads, both sides: ${keptReads}`, "");
|
|
5369
|
+
else lines.push(`Reads, kept: ${keptReads}`, "", `Reads, candidate: ${candidateReads}`, "");
|
|
5370
|
+
} else {
|
|
5371
|
+
lines.push("| Statement | Read | Kept | Candidate |", "| --- | --- | --- | --- |");
|
|
5372
|
+
for (const read of reads.values()) {
|
|
5373
|
+
lines.push(`| ${markdownTableText(read.statement)} | ${read.phase} | ${cell(read.parent, row.parent.reads)} | ${cell(read.candidate, row.candidate.reads)} |`);
|
|
5374
|
+
}
|
|
5375
|
+
lines.push("");
|
|
5376
|
+
}
|
|
5377
|
+
const [keptOn, candidateOn] = [on(row.parent), on(row.candidate)];
|
|
5378
|
+
if (keptOn === candidateOn) lines.push(`Blocks on, both sides: ${markdownText(keptOn)}`);
|
|
5379
|
+
else lines.push(`Blocks on, kept: ${markdownText(keptOn)}`, "", `Blocks on, candidate: ${markdownText(candidateOn)}`);
|
|
5380
|
+
const checks = /* @__PURE__ */ new Map();
|
|
5381
|
+
for (const key of ["parent", "candidate"]) {
|
|
5382
|
+
for (const check of row[key].checks ?? []) checks.set(check.name, { ...checks.get(check.name), [key]: check.label ?? "-" });
|
|
5383
|
+
}
|
|
5384
|
+
if (checks.size > 0) {
|
|
5385
|
+
const failing = [...checks].filter(([, labels]) => labels.parent !== "pass" || labels.candidate !== "pass");
|
|
5386
|
+
lines.push("", failing.length === 0 ? `Checks: all ${checks.size} pass on both sides` : `Checks: ${failing.map(([name, labels]) => `\`${markdownText(name)}\` kept ${markdownText(labels.parent ?? "-")}, candidate ${markdownText(labels.candidate ?? "-")}`).join("; ")}`);
|
|
5387
|
+
}
|
|
5388
|
+
lines.push("");
|
|
5389
|
+
}
|
|
5390
|
+
const view = `${lines.join("\n").trimEnd()}
|
|
5391
|
+
`;
|
|
5392
|
+
return {
|
|
5393
|
+
result: {
|
|
5394
|
+
comparisonPath: resolve(path),
|
|
5395
|
+
status: comparison["status"] ?? null,
|
|
5396
|
+
parent: { runId: runId("parent") },
|
|
5397
|
+
candidate: { runId: runId("candidate") },
|
|
5398
|
+
turns: turnCount,
|
|
5399
|
+
zeroTurnAttempts,
|
|
5400
|
+
view
|
|
5401
|
+
},
|
|
5402
|
+
rendered: view.trimEnd()
|
|
5403
|
+
};
|
|
5404
|
+
}
|
|
5208
5405
|
async function executeShow(parsed) {
|
|
5209
|
-
expectPositionals(parsed, 1, "sight character show <scene.json|run-dir> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]");
|
|
5406
|
+
expectPositionals(parsed, 1, "sight character show <scene.json|run-dir|comparison.json> [--situation <id>] [--repeat <n>] [--turn <n>] [--json]");
|
|
5210
5407
|
const path = parsed.positionals[0];
|
|
5408
|
+
const comparison = readComparisonFile(path);
|
|
5409
|
+
if (comparison !== void 0) return showComparison(parsed, path, comparison);
|
|
5211
5410
|
if (!existsSync2(join8(path, "spec.json"))) {
|
|
5212
5411
|
const document = readScene(path);
|
|
5213
5412
|
const view = renderScene(document);
|
|
@@ -5229,14 +5428,14 @@ scene SHA-256: ${sceneDigest}` };
|
|
|
5229
5428
|
const allowedHumans = new Set(humanAnnotatorIds(workbench) ?? []);
|
|
5230
5429
|
const loadedNotes = await Promise.all([...notePaths].map((notesPath) => listAnnotations(notesPath)));
|
|
5231
5430
|
const humanAnnotations = [...new Map(loadedNotes.flat().concat(evidence.checkAnnotations).filter((annotation) => annotation.annotator.kind === "human" && allowedHumans.has(annotation.annotator.id)).map((annotation) => [annotation.id, annotation])).values()];
|
|
5232
|
-
const attempts = evidence.attempts.filter((attempt) => (situation === void 0 || attempt.situationId === situation) && (repeat === void 0 || String(attempt.repeat) === String(repeat)));
|
|
5431
|
+
const attempts = evidence.attempts.filter((attempt) => (situation === void 0 || attempt.situationId === situation) && (repeat === void 0 || String(attempt.repeat) === String(repeat))).sort(bySituationThenRepeat(evidence.situations));
|
|
5233
5432
|
if (attempts.length === 0) throw new CharacterCommandError("target_not_found", "no run attempts match the selectors");
|
|
5234
5433
|
const attemptIds = new Set(attempts.map((attempt) => attempt.attemptId));
|
|
5235
5434
|
const selectedTurns = evidence.turns.filter((turn) => attemptIds.has(turn.attemptId) && (turnIndex === void 0 || turn.turnIndex === turnIndex));
|
|
5236
5435
|
const rows = attempts.map((attempt) => {
|
|
5237
5436
|
const conversationId = `${encodeURIComponent(evidence.runId)}/${encodeURIComponent(attempt.attemptId)}`;
|
|
5238
5437
|
const attemptAnnotations = humanAnnotations.filter((annotation) => annotation.target.kind === "run" && annotation.target.id === evidence.runId || annotation.target.kind === "situation" && annotation.target.id === attempt.situationId || annotation.target.kind === "conversation" && annotation.target.id === conversationId);
|
|
5239
|
-
const captures = selectedTurns.filter((turn) => turn.attemptId === attempt.attemptId);
|
|
5438
|
+
const captures = selectedTurns.filter((turn) => turn.attemptId === attempt.attemptId).sort((left, right) => left.turnIndex - right.turnIndex);
|
|
5240
5439
|
const turns = captures.map((turn) => {
|
|
5241
5440
|
const normalized = normalizeTurnEvidence(turn.capture, evidence.scene);
|
|
5242
5441
|
const targetId = `${encodeURIComponent(evidence.runId)}/${encodeURIComponent(attempt.attemptId)}/${turn.turnIndex}`;
|
|
@@ -5254,15 +5453,22 @@ scene SHA-256: ${sceneDigest}` };
|
|
|
5254
5453
|
return { ...attempt, annotations: attemptAnnotations, turns };
|
|
5255
5454
|
});
|
|
5256
5455
|
const readTotals = { met: 0, unmet: 0, none: 0 };
|
|
5257
|
-
const rendered = rows.flatMap((attempt) =>
|
|
5258
|
-
|
|
5259
|
-
|
|
5456
|
+
const rendered = rows.flatMap((attempt) => {
|
|
5457
|
+
if (attempt.turns.length === 0) {
|
|
5458
|
+
return [`${attempt.situationId}/${attempt.repeat}: ${attempt.plannedTurns === 0 ? "0 turns planned; no turns recorded" : "no turn evidence"}`];
|
|
5459
|
+
}
|
|
5460
|
+
return attempt.turns.map((turn) => {
|
|
5461
|
+
const normalized = turn.normalized;
|
|
5462
|
+
const notes = turn.annotations.map((annotation) => `
|
|
5260
5463
|
${annotation.annotator.id}: ${annotation.explanation ?? annotation.label ?? annotation.name}`).join("");
|
|
5261
|
-
|
|
5464
|
+
const mechanics = normalized === null ? "\n reads: not recorded\n blocks: not recorded" : `
|
|
5262
5465
|
${renderTurnMechanics(normalized, readTotals)}`;
|
|
5263
|
-
|
|
5466
|
+
const person = personLine(turn.capture);
|
|
5467
|
+
return `${attempt.situationId}/${attempt.repeat}/${turn.turnIndex}: ${normalized?.status ?? "missing"}${person === void 0 ? "" : `
|
|
5468
|
+
${quoted(person)}`}${normalized?.reply === void 0 ? "" : `
|
|
5264
5469
|
${normalized.reply}`}${mechanics}${notes}`;
|
|
5265
|
-
|
|
5470
|
+
});
|
|
5471
|
+
}).join("\n");
|
|
5266
5472
|
return {
|
|
5267
5473
|
result: {
|
|
5268
5474
|
runId: evidence.runId,
|
|
@@ -5878,6 +6084,7 @@ function usage() {
|
|
|
5878
6084
|
" sight openrouter connect --budget <usd> [--house-trial] [--api <base>]",
|
|
5879
6085
|
" sight openrouter status [--api <base>]",
|
|
5880
6086
|
" sight connect <relay-url> --invite <code> [--pulse] [--api <base>]",
|
|
6087
|
+
" sight --version",
|
|
5881
6088
|
` ${CHARACTER_USAGE.split("\n").join("\n ")}`,
|
|
5882
6089
|
"",
|
|
5883
6090
|
"Commands:",
|
|
@@ -6516,6 +6723,9 @@ if (command === "connect") {
|
|
|
6516
6723
|
importConversations(rest).then(exit);
|
|
6517
6724
|
} else if (command === "character") {
|
|
6518
6725
|
character(rest).then(exit);
|
|
6726
|
+
} else if (command === "--version" || command === "-v") {
|
|
6727
|
+
console.log(JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf8")).version);
|
|
6728
|
+
exit(0);
|
|
6519
6729
|
} else {
|
|
6520
6730
|
usage();
|
|
6521
6731
|
exit(command && command !== "--help" && command !== "-h" ? 1 : 0);
|