@inerrata-corporation/errata 2.0.0-dev.25 → 2.0.0-dev.26

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.
Files changed (2) hide show
  1. package/errata.mjs +58 -3
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -18827,7 +18827,41 @@ function communitySeeds(store, opts = {}) {
18827
18827
  }
18828
18828
  return seeds;
18829
18829
  }
18830
- var JOINT_COMMUNITY_LABELS, JOINT_COMMUNITY_EDGES, DEFAULT_MIN_COMMUNITY_SIZE;
18830
+ function communityInductionRequests(store, opts = {}) {
18831
+ const maxCommunities = opts.maxCommunities ?? 2;
18832
+ const byCommunity = /* @__PURE__ */ new Map();
18833
+ for (const label of JOINT_COMMUNITY_LABELS) {
18834
+ for (const n of store.findNodesByLabel(label)) {
18835
+ const cid = n.attrs["localCommunity"];
18836
+ if (typeof cid !== "string") continue;
18837
+ const cloudId = n.attrs["cloudNodeId"];
18838
+ const l = byCommunity.get(cid) ?? [];
18839
+ l.push({
18840
+ id: n.id,
18841
+ pulled: n.attrs["source"] === "cloud",
18842
+ cloudId: typeof cloudId === "string" && cloudId !== n.id ? cloudId : null,
18843
+ ts: n.lastUpdatedAt,
18844
+ description: n.description
18845
+ });
18846
+ byCommunity.set(cid, l);
18847
+ }
18848
+ }
18849
+ if (byCommunity.size === 0) return [];
18850
+ return [...byCommunity.entries()].map(([cid, mem]) => ({ cid, mem, fresh: Math.max(...mem.map((m) => m.ts)) })).sort((a, b) => b.fresh - a.fresh).map(({ cid, mem }) => {
18851
+ const ids = /* @__PURE__ */ new Set();
18852
+ for (const m of mem) {
18853
+ ids.add(m.id);
18854
+ if (m.cloudId) ids.add(m.cloudId);
18855
+ }
18856
+ const freshestLocal = [...mem].filter((m) => !m.pulled).sort((a, b) => b.ts - a.ts)[0];
18857
+ return {
18858
+ communityId: cid,
18859
+ members: [...ids].slice(0, 64),
18860
+ context: (freshestLocal?.description ?? "recurring workspace problem cluster").slice(0, 200)
18861
+ };
18862
+ }).filter((r) => r.members.length >= MIN_INDUCTION_MEMBERS).slice(0, maxCommunities);
18863
+ }
18864
+ var JOINT_COMMUNITY_LABELS, JOINT_COMMUNITY_EDGES, DEFAULT_MIN_COMMUNITY_SIZE, MIN_INDUCTION_MEMBERS;
18831
18865
  var init_community2 = __esm({
18832
18866
  "../../packages/local-graph/src/community.ts"() {
18833
18867
  "use strict";
@@ -18853,6 +18887,7 @@ var init_community2 = __esm({
18853
18887
  "RELATES_TO"
18854
18888
  ];
18855
18889
  DEFAULT_MIN_COMMUNITY_SIZE = 2;
18890
+ MIN_INDUCTION_MEMBERS = 3;
18856
18891
  }
18857
18892
  });
18858
18893
 
@@ -19496,6 +19531,7 @@ __export(src_exports, {
19496
19531
  causalChain: () => causalChain,
19497
19532
  claimId: () => claimId,
19498
19533
  clearRevisit: () => clearRevisit,
19534
+ communityInductionRequests: () => communityInductionRequests,
19499
19535
  communitySeeds: () => communitySeeds,
19500
19536
  compareSemver: () => compareSemver,
19501
19537
  corroborateClaim: () => corroborateClaim,
@@ -20344,6 +20380,13 @@ var init_client = __esm({
20344
20380
  if (seed && seed.length > 0) qs.set("seed", seed.join(","));
20345
20381
  return this.json("GET", `/v2/skills?${qs.toString()}`);
20346
20382
  }
20383
+ /** CL-induce: request a skill for a locally-detected community's cloud-
20384
+ * resolvable member ids. AUTHED. Always HTTP 200 — the `status` field
20385
+ * discriminates outcomes (incl. the autophagy-floor refusal, which is a
20386
+ * normal "not enough collective grounding yet" result, not an error). */
20387
+ async induceSkill(body2) {
20388
+ return this.json("POST", "/v2/skills/induce", body2);
20389
+ }
20347
20390
  /** Dependency-spine neighborhood. Accepts purls (Package canonicalId = purl)
20348
20391
  * or bare name@version slugs. A miss 404s AND registers demand (Stream B). */
20349
20392
  async packages(purlOrSlug, limit) {
@@ -41231,7 +41274,7 @@ function maybeFlushDigests() {
41231
41274
  }
41232
41275
 
41233
41276
  // src/engine.ts
41234
- var DAEMON_VERSION = true ? "2.0.0-dev.25" : "2.0.0-alpha.0";
41277
+ var DAEMON_VERSION = true ? "2.0.0-dev.26" : "2.0.0-alpha.0";
41235
41278
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
41236
41279
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
41237
41280
  var GIT_OP_MUTE_MS = 4e3;
@@ -42036,7 +42079,19 @@ function createWorkspaceEngine(opts) {
42036
42079
  }
42037
42080
  });
42038
42081
  }
42039
- const pullSkills = () => {
42082
+ const pullSkills = async () => {
42083
+ if ((opts.syncConsent ?? loadConfig().consent.sync) === true) {
42084
+ for (const req of communityInductionRequests(store)) {
42085
+ try {
42086
+ const r = await cloud.induceSkill({ members: req.members, context: req.context });
42087
+ if (r.status === "induced" || r.status === "refreshed") {
42088
+ console.log(`[errata] skill ${r.status} for community ${req.communityId}: ${r.title ?? r.skillId}`);
42089
+ }
42090
+ } catch {
42091
+ break;
42092
+ }
42093
+ }
42094
+ }
42040
42095
  const communitySeed = communitySeeds(store);
42041
42096
  const skillSeed = communitySeed.length > 0 ? communitySeed : store.findNodesByLabel("Problem").sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt).slice(0, 6).flatMap((p) => {
42042
42097
  const cloudId = p.attrs["cloudNodeId"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.25",
3
+ "version": "2.0.0-dev.26",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {