@cultured_computer/sight 0.4.2 → 0.4.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/README.md CHANGED
@@ -59,11 +59,11 @@ Notes:
59
59
  stable, pseudonymous user id you supply. Return metrics key on the user id;
60
60
  sessions without it still capture, but return behaviour is not computable.
61
61
 
62
- ## Connect a room you don't serve: the CLI, no account
62
+ ## Connect a community you don't serve: the CLI, no account
63
63
 
64
64
  The SDK above captures from *inside* your serving path. The bundled `sight` CLI
65
65
  does the other end: it attaches Sight to a world you do **not** serve (a buzz
66
- relay/room) as a read-only observer, with **no account and no dashboard
66
+ relay/community) as a read-only observer, with **no account and no dashboard
67
67
  signup**:
68
68
 
69
69
  ```bash
@@ -72,13 +72,15 @@ npx @cultured_computer/sight connect https://your-relay.example --invite <code>
72
72
 
73
73
  - `--invite` is a single-use code you mint on your own relay (its admin surface,
74
74
  or `POST /api/invites` as the community owner). The invite is the
75
- authorization; Sight can never enter a room you did not invite it into.
76
- - `--pulse` opts into the daily in-room readout (counts, times, and links only;
75
+ authorization; Sight can never enter a community you did not invite it into.
76
+ - `--pulse` opts into the daily readout (counts, times, and links only;
77
77
  off by default).
78
78
 
79
79
  It prints a **claim link**: the archive (sessions, measurements, the label
80
80
  queue, and any billing later) attaches when and if you claim it, so you can run
81
81
  the whole thing before creating an account. Both lanes share one project.
82
+ The full walkthrough lives at
83
+ [Connect your buzz community](https://sight.cultured.computer/docs/connect-your-room).
82
84
 
83
85
  ## What lands automatically
84
86
 
package/dist/cli.js CHANGED
@@ -14,17 +14,17 @@ function usage() {
14
14
  "Usage:",
15
15
  " sight connect <relay-url> --invite <code> [--pulse] [--api <base>]",
16
16
  "",
17
- " connect attach Sight to a buzz room as a read-only observer.",
17
+ " connect attach Sight to a buzz community as a read-only observer.",
18
18
  " --invite one single-use invite code, minted by you on",
19
19
  " your relay (its admin surface, or",
20
20
  " POST /api/invites as the community owner).",
21
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",
22
+ " never enter a community you did not invite it into.",
23
+ " --pulse opt into the daily readout (off by",
24
24
  " default; counts, times, and links only).",
25
25
  "",
26
26
  "The SDK half of this package (serving-path capture) is documented at",
27
- "https://field.cultured.computer/docs (the two lanes share one project)."
27
+ "https://sight.cultured.computer/docs (the two lanes share one project)."
28
28
  ].join("\n")
29
29
  );
30
30
  }
@@ -68,7 +68,7 @@ async function connect(args) {
68
68
  if (body["claimUrl"]) console.log(`claim/archive: ${body["claimUrl"]}`);
69
69
  return 0;
70
70
  }
71
- console.log("connected. sight is observing your room.");
71
+ console.log("connected. sight is observing your community.");
72
72
  console.log(` deployment: ${body["deploymentSlug"]}`);
73
73
  console.log(` first sync: ${body["firstSync"]}`);
74
74
  console.log(` room pulse: ${body["pulse"]} ${body["pulse"] === "off" ? "(re-run with --pulse, or toggle after claiming)" : ""}`);
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ var zod = require('zod');
4
4
  var api = require('@opentelemetry/api');
5
5
 
6
6
  // src/client.ts
7
- var DEFAULT_DASHBOARD_URL = "https://field.cultured.computer/dashboard";
7
+ var DEFAULT_DASHBOARD_URL = "https://sight.cultured.computer/dashboard";
8
8
  var MAX_PENDING_RETRIES = 50;
9
9
  var SEND_TIMEOUT_MS = 15e3;
10
10
  var MAX_INFLIGHT = 64;
@@ -58,6 +58,19 @@ var IngestClient = class {
58
58
  this.inFlight--;
59
59
  }
60
60
  }
61
+ /**
62
+ * Await all in-flight sends (bounded). Called by Probe.shutdown() so
63
+ * short-lived processes (serverless, CLI scripts) can actually exit after
64
+ * it — the documented "in-flight sends finish within 15s" only holds while
65
+ * the process lives. Polling is coarse on purpose: sends report through
66
+ * guardedFetch's counter, never awaited individually.
67
+ */
68
+ async drainInFlight(timeoutMs = SEND_TIMEOUT_MS) {
69
+ const deadline = Date.now() + timeoutMs;
70
+ while (this.inFlight > 0 && Date.now() < deadline) {
71
+ await new Promise((r) => setTimeout(r, 50));
72
+ }
73
+ }
61
74
  constructor(opts) {
62
75
  this.apiKey = opts.apiKey;
63
76
  this.endpoint = opts.endpoint.replace(/\/$/, "");
@@ -283,7 +296,7 @@ var IngestClient = class {
283
296
  if (!this.rateLimitAnnounced) {
284
297
  this.rateLimitAnnounced = true;
285
298
  console.error(
286
- "Sight: ingest rate limit (429) \u2014 retrying once per Retry-After; sustained limiting drops captures. See https://field.cultured.computer/sight/sdk-reference#rate-limits"
299
+ "Sight: ingest rate limit (429) \u2014 retrying once per Retry-After; sustained limiting drops captures. See https://sight.cultured.computer/docs/sdk-reference#rate-limits"
287
300
  );
288
301
  } else {
289
302
  this.log("[sight] ingest rate limited (429), retrying once");
@@ -365,7 +378,7 @@ var ProbeConfigSchema = zod.z.object({
365
378
  * Self-hosted or staging dashboards override it the same way `endpoint`
366
379
  * is overridden.
367
380
  */
368
- dashboardUrl: zod.z.string().url().default("https://field.cultured.computer/dashboard"),
381
+ dashboardUrl: zod.z.string().url().default("https://sight.cultured.computer/dashboard"),
369
382
  /** Persona identification. Optional at init; can be set later via identifyPersona(). */
370
383
  persona: PersonaConfigSchema.optional(),
371
384
  /** Outcome hook. Optional at init; can be set later via wireOutcomeHook(). */
@@ -2062,8 +2075,10 @@ var Probe = class {
2062
2075
  if (state === null) {
2063
2076
  return;
2064
2077
  }
2078
+ const client = state.client;
2065
2079
  detachOtelState();
2066
2080
  state = null;
2081
+ await client.drainInFlight();
2067
2082
  }
2068
2083
  // ── Internal helpers ─────────────────────────────────────────────────────
2069
2084
  /** Package-internal: instrumentation adapters read this to build turns. */