@inerrata-corporation/errata 2.0.0-dev.67 → 2.0.0-dev.69

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.
@@ -15110,7 +15110,7 @@ var init_symbol_intent = __esm({
15110
15110
  });
15111
15111
 
15112
15112
  // ../../packages/shared/src/wire.ts
15113
- var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
15113
+ var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
15114
15114
  var init_wire = __esm({
15115
15115
  "../../packages/shared/src/wire.ts"() {
15116
15116
  "use strict";
@@ -15122,6 +15122,28 @@ var init_wire = __esm({
15122
15122
  ...SEMANTIC_NODE_LABELS,
15123
15123
  ...CONTEXT_NODE_LABELS
15124
15124
  ];
15125
+ CLOUD_WRITABLE_NODE_LABELS = [
15126
+ "Problem",
15127
+ "Solution",
15128
+ "RootCause",
15129
+ "Component",
15130
+ "Symptom",
15131
+ "Pattern",
15132
+ "Vulnerability",
15133
+ "Exploit",
15134
+ "Weakness",
15135
+ "Package",
15136
+ "OperatingSystem",
15137
+ "Language",
15138
+ "Domain",
15139
+ "Algorithm",
15140
+ "Paradigm",
15141
+ "DataStructure",
15142
+ "Triage",
15143
+ "Claim",
15144
+ "AntiPattern"
15145
+ ];
15146
+ CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
15125
15147
  CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
15126
15148
  (e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
15127
15149
  );
package/errata.mjs CHANGED
@@ -15365,6 +15365,9 @@ var init_symbol_intent = __esm({
15365
15365
  });
15366
15366
 
15367
15367
  // ../../packages/shared/src/wire.ts
15368
+ function isCloudWritableNodeLabel(label) {
15369
+ return CLOUD_WRITABLE_NODE_LABEL_SET.has(label);
15370
+ }
15368
15371
  function provenanceBand(source) {
15369
15372
  switch (source) {
15370
15373
  case "agent-observed":
@@ -15413,7 +15416,7 @@ function summarizeIngestResult(r) {
15413
15416
  ...r.patternReconciliation ? { patternReconciliation: r.patternReconciliation } : {}
15414
15417
  };
15415
15418
  }
15416
- var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
15419
+ var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
15417
15420
  var init_wire = __esm({
15418
15421
  "../../packages/shared/src/wire.ts"() {
15419
15422
  "use strict";
@@ -15425,6 +15428,28 @@ var init_wire = __esm({
15425
15428
  ...SEMANTIC_NODE_LABELS,
15426
15429
  ...CONTEXT_NODE_LABELS
15427
15430
  ];
15431
+ CLOUD_WRITABLE_NODE_LABELS = [
15432
+ "Problem",
15433
+ "Solution",
15434
+ "RootCause",
15435
+ "Component",
15436
+ "Symptom",
15437
+ "Pattern",
15438
+ "Vulnerability",
15439
+ "Exploit",
15440
+ "Weakness",
15441
+ "Package",
15442
+ "OperatingSystem",
15443
+ "Language",
15444
+ "Domain",
15445
+ "Algorithm",
15446
+ "Paradigm",
15447
+ "DataStructure",
15448
+ "Triage",
15449
+ "Claim",
15450
+ "AntiPattern"
15451
+ ];
15452
+ CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
15428
15453
  CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
15429
15454
  (e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
15430
15455
  );
@@ -15575,6 +15600,7 @@ __export(src_exports, {
15575
15600
  CAUSAL_PROTECT_EDGES: () => CAUSAL_PROTECT_EDGES,
15576
15601
  CLOUD_EDGE_TYPES: () => CLOUD_EDGE_TYPES,
15577
15602
  CLOUD_NODE_LABELS: () => CLOUD_NODE_LABELS,
15603
+ CLOUD_WRITABLE_NODE_LABELS: () => CLOUD_WRITABLE_NODE_LABELS,
15578
15604
  CODE_EDGES: () => CODE_EDGES,
15579
15605
  CODE_NODE_LABELS: () => CODE_NODE_LABELS,
15580
15606
  CONCEPTUAL_EDGES: () => CONCEPTUAL_EDGES,
@@ -15628,6 +15654,7 @@ __export(src_exports, {
15628
15654
  genericCanonicalId: () => genericCanonicalId,
15629
15655
  identityId: () => identityId,
15630
15656
  isCausalProtected: () => isCausalProtected,
15657
+ isCloudWritableNodeLabel: () => isCloudWritableNodeLabel,
15631
15658
  isCodeLabel: () => isCodeLabel,
15632
15659
  isContextLabel: () => isContextLabel,
15633
15660
  isInferredSource: () => isInferredSource,
@@ -20727,7 +20754,10 @@ function sidecarForNodes(sidecar, nodes) {
20727
20754
  return count > 0 ? filtered : void 0;
20728
20755
  }
20729
20756
  function toWirePayload(batch, runId) {
20730
- const nodes = batch.nodes.map((n) => ({
20757
+ const droppedNodeIds = new Set(
20758
+ batch.nodes.filter((n) => !isCloudWritableNodeLabel(n.label)).map((n) => n.id)
20759
+ );
20760
+ const nodes = batch.nodes.filter((n) => !droppedNodeIds.has(n.id)).map((n) => ({
20731
20761
  canonicalId: n.id,
20732
20762
  label: n.label,
20733
20763
  description: n.description,
@@ -20736,7 +20766,7 @@ function toWirePayload(batch, runId) {
20736
20766
  attrs: n.attrs ?? {},
20737
20767
  extractionSource: n.extractionSource
20738
20768
  }));
20739
- const edges = batch.edges.map((e) => {
20769
+ const edges = batch.edges.filter((e) => !droppedNodeIds.has(e.from) && !droppedNodeIds.has(e.to)).map((e) => {
20740
20770
  const perContext = wirePerContext(e.attrs?.["perContext"]);
20741
20771
  return {
20742
20772
  fromCanonicalId: e.from,
@@ -20884,6 +20914,17 @@ function chunkArray(items, size) {
20884
20914
  for (let i2 = 0; i2 < items.length; i2 += size) out2.push(items.slice(i2, i2 + size));
20885
20915
  return out2;
20886
20916
  }
20917
+ function provenanceHeaders(provenance) {
20918
+ return {
20919
+ ...provenance.clientProduct ? { "x-inerrata-client-product": provenance.clientProduct } : {},
20920
+ ...provenance.clientKind ? { "x-inerrata-client-kind": provenance.clientKind } : {},
20921
+ ...provenance.clientVersion ? { "x-inerrata-client-version": provenance.clientVersion } : {},
20922
+ ...provenance.hostHarness ? { "x-inerrata-host-harness": provenance.hostHarness } : {},
20923
+ ...provenance.runtime ? { "x-inerrata-runtime": provenance.runtime } : {},
20924
+ ...provenance.agentProvider ? { "x-inerrata-agent-provider": provenance.agentProvider } : {},
20925
+ ...provenance.agentModel ? { "x-inerrata-agent-model": provenance.agentModel } : {}
20926
+ };
20927
+ }
20887
20928
  var asWireCount, INGEST_NODE_CHUNK, CloudClient, CloudError;
20888
20929
  var init_client = __esm({
20889
20930
  "../../packages/cloud-client/src/client.ts"() {
@@ -20905,6 +20946,7 @@ var init_client = __esm({
20905
20946
  timeoutMs;
20906
20947
  daemonVersion;
20907
20948
  daemonChannel;
20949
+ provenance;
20908
20950
  constructor(opts) {
20909
20951
  this.baseUrl = opts.baseUrl.replace(/\/+$/, "");
20910
20952
  if (opts.apiKey !== void 0) this.apiKey = opts.apiKey;
@@ -20918,6 +20960,12 @@ var init_client = __esm({
20918
20960
  this.timeoutMs = opts.timeoutMs ?? 15e3;
20919
20961
  this.daemonVersion = opts.daemonVersion;
20920
20962
  this.daemonChannel = opts.daemonChannel;
20963
+ this.provenance = opts.provenance ?? {
20964
+ clientProduct: "inerrata_cloud_client",
20965
+ clientKind: "sdk",
20966
+ runtime: "unknown",
20967
+ hostHarness: "unknown"
20968
+ };
20921
20969
  }
20922
20970
  /**
20923
20971
  * The bearer token to send: a fresh OAuth access token (refreshing it first if
@@ -21293,7 +21341,8 @@ var init_client = __esm({
21293
21341
  const url2 = `${this.baseUrl}${path2}`;
21294
21342
  const headers = {
21295
21343
  "content-type": "application/json",
21296
- accept: "application/json"
21344
+ accept: "application/json",
21345
+ ...provenanceHeaders(this.provenance)
21297
21346
  };
21298
21347
  if (!opts?.skipAuth) {
21299
21348
  const token = await this.authToken();
@@ -21783,6 +21832,21 @@ var init_cloud_endpoint_policy = __esm({
21783
21832
  function oauthClientId() {
21784
21833
  return process.env["ERRATA_OAUTH_CLIENT_ID"] ?? "errata-daemon";
21785
21834
  }
21835
+ function daemonProvenance(env2 = process.env) {
21836
+ const explicit = env2["ERRATA_HOST_HARNESS"];
21837
+ const hostHarness = explicit === "claude_code" || explicit === "codex" || explicit === "cursor" || explicit === "gemini_cli" || explicit === "openclaw" || explicit === "custom" ? explicit : env2["CODEX_HOME"] || env2["CODEX_THREAD_ID"] ? "codex" : env2["CLAUDE_PROJECT_DIR"] || env2["CLAUDECODE"] ? "claude_code" : env2["CURSOR_TRACE_ID"] ? "cursor" : "unknown";
21838
+ const provider = env2["ERRATA_AGENT_PROVIDER"];
21839
+ const agentProvider = provider === "anthropic" || provider === "openai" || provider === "google" || provider === "aws" || provider === "azure" || provider === "custom" ? provider : "unknown";
21840
+ return {
21841
+ clientProduct: "inerrata_daemon",
21842
+ clientKind: "sidecar",
21843
+ clientVersion: "2.0.0-alpha.0",
21844
+ hostHarness,
21845
+ runtime: "local",
21846
+ agentProvider,
21847
+ ...env2["ERRATA_AGENT_MODEL"] ? { agentModel: env2["ERRATA_AGENT_MODEL"] } : {}
21848
+ };
21849
+ }
21786
21850
  function authedCloudClient(cfg, opts = {}) {
21787
21851
  const baseUrl = normalizeCloudUrl(cfg.cloudUrl);
21788
21852
  const fetchFn = guardCloudFetch(baseUrl, opts.fetchFn ?? fetch);
@@ -21795,6 +21859,7 @@ function authedCloudClient(cfg, opts = {}) {
21795
21859
  ...cfg.refreshToken ? { refreshToken: cfg.refreshToken } : {},
21796
21860
  fetchFn,
21797
21861
  ...versionOpts,
21862
+ provenance: daemonProvenance(),
21798
21863
  ...opts.timeoutMs ? { timeoutMs: opts.timeoutMs } : {},
21799
21864
  ...tokenEndpoint && cfg.refreshToken ? {
21800
21865
  refreshFn: (rt) => refreshAccessToken(opts.fetchFn ?? fetch, tokenEndpoint, {
@@ -21816,6 +21881,7 @@ function authedCloudClient(cfg, opts = {}) {
21816
21881
  ...cfg.apiKey ? { apiKey: cfg.apiKey } : {},
21817
21882
  fetchFn,
21818
21883
  ...versionOpts,
21884
+ provenance: daemonProvenance(),
21819
21885
  ...opts.timeoutMs ? { timeoutMs: opts.timeoutMs } : {}
21820
21886
  });
21821
21887
  }
@@ -37436,6 +37502,12 @@ async function flushOutbox(paths, client, store) {
37436
37502
  }
37437
37503
  try {
37438
37504
  const res = await client.ingest(payload);
37505
+ if (res.accepted > 0) uploaded++;
37506
+ if (res.rejected > 0) {
37507
+ failed++;
37508
+ quarantine(abs, `semantic rejection (${res.rejected} item${res.rejected === 1 ? "" : "s"})`);
37509
+ continue;
37510
+ }
37439
37511
  if (store && res.patternReconciliation) {
37440
37512
  for (const [provId, canonId] of Object.entries(res.patternReconciliation)) {
37441
37513
  const n = store.getNode(provId);
@@ -37447,7 +37519,7 @@ async function flushOutbox(paths, client, store) {
37447
37519
  }
37448
37520
  }
37449
37521
  unlinkSync(abs);
37450
- uploaded++;
37522
+ if (res.accepted === 0) uploaded++;
37451
37523
  } catch (err2) {
37452
37524
  failed++;
37453
37525
  const status = err2.status;
@@ -42904,7 +42976,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42904
42976
  }
42905
42977
 
42906
42978
  // src/engine.ts
42907
- var DAEMON_VERSION = true ? "2.0.0-dev.67" : "2.0.0-alpha.0";
42979
+ var DAEMON_VERSION = true ? "2.0.0-dev.69" : "2.0.0-alpha.0";
42908
42980
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42909
42981
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42910
42982
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.67",
3
+ "version": "2.0.0-dev.69",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -14958,7 +14958,7 @@ var init_symbol_intent = __esm({
14958
14958
  });
14959
14959
 
14960
14960
  // ../../packages/shared/src/wire.ts
14961
- var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
14961
+ var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
14962
14962
  var init_wire = __esm({
14963
14963
  "../../packages/shared/src/wire.ts"() {
14964
14964
  "use strict";
@@ -14970,6 +14970,28 @@ var init_wire = __esm({
14970
14970
  ...SEMANTIC_NODE_LABELS,
14971
14971
  ...CONTEXT_NODE_LABELS
14972
14972
  ];
14973
+ CLOUD_WRITABLE_NODE_LABELS = [
14974
+ "Problem",
14975
+ "Solution",
14976
+ "RootCause",
14977
+ "Component",
14978
+ "Symptom",
14979
+ "Pattern",
14980
+ "Vulnerability",
14981
+ "Exploit",
14982
+ "Weakness",
14983
+ "Package",
14984
+ "OperatingSystem",
14985
+ "Language",
14986
+ "Domain",
14987
+ "Algorithm",
14988
+ "Paradigm",
14989
+ "DataStructure",
14990
+ "Triage",
14991
+ "Claim",
14992
+ "AntiPattern"
14993
+ ];
14994
+ CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
14973
14995
  CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
14974
14996
  (e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
14975
14997
  );