@bounded-sh/observe 0.1.0 → 0.1.1

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/dist/pipeline.js CHANGED
@@ -169,6 +169,13 @@ class Pipeline {
169
169
  this.reporter.push({ wire, fields });
170
170
  return;
171
171
  }
172
+ // Bounded-only capture (the app-dev / skill default, "bounded stuff only"):
173
+ // send ONLY recognized-by-fixtures events + explicit counter routes. Drop
174
+ // every UNrecognized route here — no shape sample, no heuristic counter — so
175
+ // nothing about traffic Bounded doesn't already recognize ever leaves the
176
+ // process. BOUNDED_CAPTURE_SCOPE=all re-enables discovery (shapes/counters).
177
+ if (state_1.state.config?.captureScope === "recognized")
178
+ return;
172
179
  // Unrecognized: heuristic counter tally for GETs (exact from call #1).
173
180
  if (method === "GET") {
174
181
  this.counters.add(route, raw.ts, raw.status, raw.durMs, raw.bytesIn, raw.bytesOut, true);
package/dist/register.js CHANGED
@@ -32,6 +32,9 @@
32
32
  // BOUNDED_VERDICT_URL https://<org>.bounded.sh/api/verdict (arms escort)
33
33
  // BOUNDED_SENSOR_TOKEN obs1.<keyId>.<sig> (verdict auth + report auth)
34
34
  // BOUNDED_ORG org slug (manifest polling only)
35
+ // BOUNDED_CAPTURE_SCOPE bounded|recognized => send only recognized events
36
+ // + counters (app-dev default); all => full capture
37
+ // incl. unknown-route shape discovery (unset => all)
35
38
  // BOUNDED_INGEST_BASE default prod observe-ingest
36
39
  // BOUNDED_COLLECTION escort collection (default stripeRefunds)
37
40
  // BOUNDED_FAIL_MODE closed|open (default closed; SPEC U18) [alias BOUNDED_FAILMODE]
@@ -105,11 +108,18 @@ function bootstrapFromEnv(env = process.env) {
105
108
  const flushIntervalMs = Number.isFinite(flushMsRaw) && flushMsRaw > 0 ? flushMsRaw : undefined;
106
109
  const timeoutRaw = Number(env.BOUNDED_VERDICT_TIMEOUT_MS);
107
110
  const timeoutMs = Number.isFinite(timeoutRaw) && timeoutRaw > 0 ? Math.min(timeoutRaw, 30_000) : undefined;
111
+ // Capture scope: "bounded"/"recognized" => send only recognized-by-fixtures
112
+ // events + counter routes (the app-dev / skill default). Anything else (or
113
+ // unset) => "all" (full capture incl. unknown-route shape discovery).
114
+ const scopeRaw = String(env.BOUNDED_CAPTURE_SCOPE || "").toLowerCase();
115
+ const captureScope = scopeRaw === "recognized" || scopeRaw === "bounded" ? "recognized"
116
+ : scopeRaw === "all" ? "all" : undefined;
108
117
  const cfg = {
109
118
  ingestBase: env.BOUNDED_INGEST_BASE || DEFAULT_INGEST,
110
119
  token: env.BOUNDED_SENSOR_TOKEN || "obs1.unset.unset",
111
120
  org: env.BOUNDED_ORG || undefined,
112
121
  debug: env.BOUNDED_DEBUG === "1",
122
+ ...(captureScope ? { captureScope } : {}),
113
123
  ...(flushIntervalMs ? { flushIntervalMs } : {}),
114
124
  };
115
125
  if (verdictUrl) {
package/dist/types.d.ts CHANGED
@@ -83,6 +83,16 @@ export interface ObserveConfig {
83
83
  counterPromoteThreshold?: number;
84
84
  /** Max new shape samples emitted per minute (default 30). */
85
85
  shapesPerMinute?: number;
86
+ /**
87
+ * What to send. "all" (default): recognized events + counters + UNrecognized
88
+ * shape samples (needed for the classification loop). "recognized" (the
89
+ * app-dev / skill default, "bounded stuff only"): recognized-by-fixtures
90
+ * events + explicit counter routes ONLY — unknown external routes are neither
91
+ * sampled nor counted, so nothing about traffic Bounded doesn't already
92
+ * recognize ever leaves the process. Turn on full capture with
93
+ * BOUNDED_CAPTURE_SCOPE=all when you want to discover/classify new routes.
94
+ */
95
+ captureScope?: "recognized" | "all";
86
96
  /** Manifest override (tests/dev). Skips the built-in + polling when set. */
87
97
  manifest?: unknown;
88
98
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bounded-sh/observe",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Bounded observe shim for Node: intercepts fetch + http/https egress, attributes actors, reports metadata-only events to the Bounded observe ingest. Never breaks the app.",
5
5
  "license": "MIT",
6
6
  "private": false,