@inerrata-corporation/errata 2.0.0-dev.54 → 2.0.0-dev.55

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 +27 -6
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -20896,6 +20896,8 @@ var init_client = __esm({
20896
20896
  refreshSkewSec;
20897
20897
  fetchFn;
20898
20898
  timeoutMs;
20899
+ daemonVersion;
20900
+ daemonChannel;
20899
20901
  constructor(opts) {
20900
20902
  this.baseUrl = opts.baseUrl.replace(/\/+$/, "");
20901
20903
  if (opts.apiKey !== void 0) this.apiKey = opts.apiKey;
@@ -20907,6 +20909,8 @@ var init_client = __esm({
20907
20909
  this.refreshSkewSec = opts.refreshSkewSec ?? 60;
20908
20910
  this.fetchFn = opts.fetchFn ?? fetch;
20909
20911
  this.timeoutMs = opts.timeoutMs ?? 15e3;
20912
+ this.daemonVersion = opts.daemonVersion;
20913
+ this.daemonChannel = opts.daemonChannel;
20910
20914
  }
20911
20915
  /**
20912
20916
  * The bearer token to send: a fresh OAuth access token (refreshing it first if
@@ -21204,6 +21208,8 @@ var init_client = __esm({
21204
21208
  async getSkills(context = "daemon skill sync", seed) {
21205
21209
  const qs = new URLSearchParams({ context });
21206
21210
  if (seed && seed.length > 0) qs.set("seed", seed.join(","));
21211
+ if (this.daemonVersion) qs.set("daemonVersion", this.daemonVersion);
21212
+ if (this.daemonChannel) qs.set("daemonChannel", this.daemonChannel);
21207
21213
  return this.json("GET", `/v2/skills?${qs.toString()}`);
21208
21214
  }
21209
21215
  /** CL-induce: request a skill for a locally-detected community's cloud-
@@ -21751,6 +21757,7 @@ function oauthClientId() {
21751
21757
  function authedCloudClient(cfg, opts = {}) {
21752
21758
  const baseUrl = normalizeCloudUrl(cfg.cloudUrl);
21753
21759
  const fetchFn = guardCloudFetch(baseUrl, opts.fetchFn ?? fetch);
21760
+ const versionOpts = opts.daemonVersion ? { daemonVersion: opts.daemonVersion, daemonChannel: cfg.updateChannel } : {};
21754
21761
  if (cfg.accessToken) {
21755
21762
  const tokenEndpoint = cfg.tokenEndpoint;
21756
21763
  return new CloudClient({
@@ -21758,6 +21765,7 @@ function authedCloudClient(cfg, opts = {}) {
21758
21765
  accessToken: cfg.accessToken,
21759
21766
  ...cfg.refreshToken ? { refreshToken: cfg.refreshToken } : {},
21760
21767
  fetchFn,
21768
+ ...versionOpts,
21761
21769
  ...opts.timeoutMs ? { timeoutMs: opts.timeoutMs } : {},
21762
21770
  ...tokenEndpoint && cfg.refreshToken ? {
21763
21771
  refreshFn: (rt) => refreshAccessToken(opts.fetchFn ?? fetch, tokenEndpoint, {
@@ -21778,6 +21786,7 @@ function authedCloudClient(cfg, opts = {}) {
21778
21786
  baseUrl,
21779
21787
  ...cfg.apiKey ? { apiKey: cfg.apiKey } : {},
21780
21788
  fetchFn,
21789
+ ...versionOpts,
21781
21790
  ...opts.timeoutMs ? { timeoutMs: opts.timeoutMs } : {}
21782
21791
  });
21783
21792
  }
@@ -42355,10 +42364,11 @@ function readSkillManifest(manifestPath) {
42355
42364
  }
42356
42365
  async function syncSkills(paths, client, seed) {
42357
42366
  const res = await client.getSkills(void 0, seed);
42367
+ const staleDaemon = res.staleDaemon && res.latestDaemonVersion ? { latest: res.latestDaemonVersion } : void 0;
42358
42368
  mkdirSync5(paths.skillsDir, { recursive: true });
42359
42369
  if (res.skills.length === 0) {
42360
42370
  const existing = readdirSync6(paths.skillsDir).filter((f) => f.endsWith(".md"));
42361
- if (existing.length > 0) return { written: 0, pruned: 0 };
42371
+ if (existing.length > 0) return { written: 0, pruned: 0, ...staleDaemon ? { staleDaemon } : {} };
42362
42372
  }
42363
42373
  const rows = [];
42364
42374
  const keep = /* @__PURE__ */ new Set();
@@ -42390,7 +42400,7 @@ async function syncSkills(paths, client, seed) {
42390
42400
  JSON.stringify({ generatedAt: Date.now(), skills: rows }, null, 2),
42391
42401
  "utf8"
42392
42402
  );
42393
- return { written: rows.length, pruned };
42403
+ return { written: rows.length, pruned, ...staleDaemon ? { staleDaemon } : {} };
42394
42404
  }
42395
42405
 
42396
42406
  // src/working-file-state.ts
@@ -42810,7 +42820,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42810
42820
  }
42811
42821
 
42812
42822
  // src/engine.ts
42813
- var DAEMON_VERSION = true ? "2.0.0-dev.54" : "2.0.0-alpha.0";
42823
+ var DAEMON_VERSION = true ? "2.0.0-dev.55" : "2.0.0-alpha.0";
42814
42824
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42815
42825
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42816
42826
  var GIT_OP_MUTE_MS = 4e3;
@@ -44991,7 +45001,7 @@ async function startMultiDaemon(opts = {}) {
44991
45001
  initialCfg.tokenEndpoint = null;
44992
45002
  initialCfg.oauthClientId = null;
44993
45003
  }
44994
- const cloud = authedCloudClient(initialCfg, { timeoutMs: CLOUD_TIMEOUT_MS });
45004
+ const cloud = authedCloudClient(initialCfg, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
44995
45005
  const cloudNow = () => {
44996
45006
  const c = loadConfig();
44997
45007
  const baseUrl2 = normalizeCloudUrl(opts.cloudUrl ?? c.cloudUrl);
@@ -45003,7 +45013,7 @@ async function startMultiDaemon(opts = {}) {
45003
45013
  current.tokenEndpoint = null;
45004
45014
  current.oauthClientId = null;
45005
45015
  }
45006
- return authedCloudClient(current, { timeoutMs: CLOUD_TIMEOUT_MS });
45016
+ return authedCloudClient(current, { timeoutMs: CLOUD_TIMEOUT_MS, daemonVersion: DAEMON_VERSION });
45007
45017
  };
45008
45018
  const sharedDbPath = sharedStorePath();
45009
45019
  ensureParent(sharedDbPath);
@@ -45022,6 +45032,7 @@ async function startMultiDaemon(opts = {}) {
45022
45032
  for (const r of records) r.engine.markContextDirty();
45023
45033
  }
45024
45034
  }) : null;
45035
+ let serverPending = null;
45025
45036
  const boundaryListeners = [];
45026
45037
  let boundaryFlushing = false;
45027
45038
  const fireBoundary = () => {
@@ -45040,7 +45051,7 @@ async function startMultiDaemon(opts = {}) {
45040
45051
  apiKey: opts.apiKey,
45041
45052
  reviewUrl: () => `${baseUrl}/ws/${id}/review`,
45042
45053
  sharedStore,
45043
- pendingUpdate: () => updatePoller?.current() ?? null,
45054
+ pendingUpdate: () => serverPending ?? updatePoller?.current() ?? null,
45044
45055
  ...opts.skipWatchers ? { skipWatchers: true } : {}
45045
45056
  });
45046
45057
  const webApp = buildWebUi({
@@ -45615,10 +45626,17 @@ async function startMultiDaemon(opts = {}) {
45615
45626
  async syncSkillsAll() {
45616
45627
  let written = 0;
45617
45628
  let pruned2 = 0;
45629
+ let stale;
45618
45630
  for (const r of records) {
45619
45631
  const s = await r.engine.fetchSkills();
45620
45632
  written += s.written;
45621
45633
  pruned2 += s.pruned;
45634
+ if (s.staleDaemon) stale = s.staleDaemon;
45635
+ }
45636
+ const next = stale ? { current: DAEMON_VERSION, latest: stale.latest, channel: loadConfig().updateChannel } : null;
45637
+ if ((next?.latest ?? null) !== (serverPending?.latest ?? null)) {
45638
+ serverPending = next;
45639
+ for (const rec of records) rec.engine.markContextDirty();
45622
45640
  }
45623
45641
  return { written, pruned: pruned2 };
45624
45642
  },
@@ -46014,6 +46032,9 @@ var cmd = argv[0] ?? "help";
46014
46032
  var rest = argv.slice(1);
46015
46033
  var NIGHTLY_INTERVAL_MS = 10 * 6e4;
46016
46034
  async function main() {
46035
+ if (cmd !== "help" && cmd !== "--help" && cmd !== "-h" && (rest.includes("--help") || rest.includes("-h"))) {
46036
+ return printHelp();
46037
+ }
46017
46038
  switch (cmd) {
46018
46039
  case "init":
46019
46040
  return cmdInit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.54",
3
+ "version": "2.0.0-dev.55",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {