@cultured_computer/sight 0.3.5 → 0.4.0

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/README.md CHANGED
@@ -150,11 +150,24 @@ modify responses, and it does not estimate what a different response would
150
150
  have produced. Counterfactual evaluation requires logged propensities or a
151
151
  live experiment.
152
152
 
153
+ ## The record schema
154
+
155
+ Everything Sight captures exports in one published, versioned shape:
156
+ `schema/sight-record-v1.schema.json`, shipped in this package
157
+ (`@cultured_computer/sight/schema/record-v1`). One JSON line per
158
+ session; each turn carries the fixed four-field envelope — the
159
+ situation, the assistant's move, how the person took it, and what
160
+ followed — on both sides of the exchange, with provenance and
161
+ redaction built into the shape. A CI test keeps the schema and the
162
+ export bytes in lockstep. Formats that standardize the agent log stop
163
+ at the assistant's half; this one records the exchange and its
164
+ consequences. See [Data format](https://sight.cultured.computer/docs/data-format).
165
+
153
166
  ## Docs
154
167
 
155
168
  - [Get started](https://sight.cultured.computer/docs/get-started):
156
169
  install, initialise, verify capture.
157
- - [Worked examples](https://sight.cultured.computer/docs/examples):
170
+ - [Cookbook](https://sight.cultured.computer/docs/examples):
158
171
  runnable snippets, each with what it lands in the record.
159
172
  - [SDK reference](https://sight.cultured.computer/docs/sdk-reference):
160
173
  the full method surface.
package/dist/cli.js ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli.ts
4
+ var DEFAULT_API = "https://fieldwork-ingest.fly.dev";
5
+ function flag(args, name) {
6
+ const i = args.indexOf(name);
7
+ return i === -1 ? null : args[i + 1] ?? null;
8
+ }
9
+ function usage() {
10
+ console.log(
11
+ [
12
+ "sight \u2014 the observer for agent conversations",
13
+ "",
14
+ "Usage:",
15
+ " sight connect <relay-url> --invite <code> [--pulse] [--api <base>]",
16
+ "",
17
+ " connect attach Sight to a buzz room as a read-only observer.",
18
+ " --invite one single-use invite code, minted by you on",
19
+ " your relay (its admin surface, or",
20
+ " POST /api/invites as the community owner).",
21
+ " Your invite is the authorization: Sight can",
22
+ " never enter a room you did not invite it into.",
23
+ " --pulse opt into the daily in-room readout (off by",
24
+ " default; counts, times, and links only).",
25
+ "",
26
+ "The SDK half of this package (serving-path capture) is documented at",
27
+ "https://field.cultured.computer/docs \u2014 the two lanes share one project."
28
+ ].join("\n")
29
+ );
30
+ }
31
+ async function connect(args) {
32
+ const relayUrl = args.find((a) => !a.startsWith("-"));
33
+ const invite = flag(args, "--invite");
34
+ const api = (flag(args, "--api") ?? process.env["SIGHT_API"] ?? DEFAULT_API).replace(/\/+$/, "");
35
+ if (!relayUrl) {
36
+ console.error("connect needs a relay URL. Try: sight connect https://your-relay.example --invite <code>");
37
+ return 1;
38
+ }
39
+ if (!invite) {
40
+ console.error(
41
+ [
42
+ "connect needs --invite <code> \u2014 one single-use invite, minted by you.",
43
+ "On your relay: the community admin surface, or POST /api/invites as owner.",
44
+ "This stays manual on purpose: your community, your authority."
45
+ ].join("\n")
46
+ );
47
+ return 1;
48
+ }
49
+ let res;
50
+ try {
51
+ res = await fetch(`${api}/v1/connections`, {
52
+ method: "POST",
53
+ headers: { "content-type": "application/json" },
54
+ body: JSON.stringify({ relayUrl, inviteCode: invite, pulse: args.includes("--pulse") })
55
+ });
56
+ } catch (err) {
57
+ console.error(`could not reach ${api}: ${err instanceof Error ? err.message : err}`);
58
+ return 1;
59
+ }
60
+ const body = await res.json().catch(() => ({}));
61
+ if (!res.ok) {
62
+ console.error(`connect failed (${res.status}): ${body["error"] ?? "unknown error"}`);
63
+ return 1;
64
+ }
65
+ if (body["status"] === "already-connected") {
66
+ console.log(`this relay is already connected. ${body["note"] ?? ""}`);
67
+ console.log(`deployment: ${body["deploymentSlug"]}`);
68
+ if (body["claimUrl"]) console.log(`claim/archive: ${body["claimUrl"]}`);
69
+ return 0;
70
+ }
71
+ console.log("connected. sight is observing your room.");
72
+ console.log(` deployment: ${body["deploymentSlug"]}`);
73
+ console.log(` first sync: ${body["firstSync"]}`);
74
+ console.log(` room pulse: ${body["pulse"]} ${body["pulse"] === "off" ? "(re-run with --pulse, or toggle after claiming)" : ""}`);
75
+ console.log("");
76
+ console.log("the archive (sessions, measurements, the label queue) attaches when");
77
+ console.log("you claim \u2014 keep this link, it is the only copy:");
78
+ console.log(` ${body["claimUrl"]}`);
79
+ return 0;
80
+ }
81
+ var [, , command, ...rest] = process.argv;
82
+ if (command === "connect") {
83
+ connect(rest).then((code) => process.exit(code));
84
+ } else {
85
+ usage();
86
+ process.exit(command && command !== "--help" && command !== "-h" ? 1 : 0);
87
+ }
package/dist/index.cjs CHANGED
@@ -1290,6 +1290,9 @@ zod.z.object({
1290
1290
  */
1291
1291
  startDate: zod.z.string().optional()
1292
1292
  });
1293
+ zod.z.object({
1294
+ requestId: zod.z.string().uuid()
1295
+ });
1293
1296
  zod.z.object({
1294
1297
  deploymentSlug: zod.z.string().min(1),
1295
1298
  /** Same (seed, startDate) the seeding job used — the plan is recomputed