intentional-cognition-os 1.4.3 → 1.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.5.2] - 2026-05-26
4
+
5
+ - Merge pull request #109 from jeremylongshore/feat/audit-chain-race-fix-lhm (312c2e0)
6
+ - fix(kernel/audit): use FD-based open+fstat+write (CodeQL canonical safe pattern) (d32460a)
7
+ - fix(kernel/audit): drop existsSync check-then-use pattern in writeTrace (ad08dac)
8
+ - fix(kernel/audit): serialize writeTrace under SQLite EXCLUSIVE lock (lhm) (d09d62c)
9
+
10
+ ## [v1.5.1] - 2026-05-26
11
+
12
+ - chore(beads): file P4 sweep bead for doc 037 prose polish (GFM table-cell escape semantics) (d870d64)
13
+ - Merge pull request #108 from jeremylongshore/fix/codeql-triage-corrections (2974682)
14
+ - fix(docs/security): correct CodeQL triage — hash-chain race is real, alert #13 reopened (fb11fb1)
15
+ - chore(beads): close 0wy.3 (CodeQL triage), file lhm (reliability follow-up) (d98b0d6)
16
+ - Merge pull request #107 from jeremylongshore/feat/codeql-triage-0wy.3 (96f69e0)
17
+ - docs(security): CodeQL alert triage — 31 dismissed, 1 follow-up bead (1613593)
18
+ - chore(beads): nhj.1 + 0wy.1 closed, 2v4 filed (compiler mutation deferral) (8e14ed8)
19
+
20
+ ## [v1.5.0] - 2026-05-26
21
+
22
+ - Merge pull request #106 from jeremylongshore/feat/stryker-baseline-lock-0wy.1 (01490d8)
23
+ - feat(mutation): lock Stryker kernel baseline at 55% floor + wire to PR gate (e083c51)
24
+ - chore(beads): nhj.1 — upstream comment posted on gastownhall/beads#4135 (b03a2f0)
25
+ - chore(beads): close nhj.1 — dossier + candidate staged for upstream beads (4f6f6f0)
26
+ - Merge pull request #105 from jeremylongshore/chore/steveyegge-to-gastownhall-and-nhj.1-dossier (eda7f63)
27
+ - chore(beads): update upstream repo references steveyegge → gastownhall (b590258)
28
+ - chore(beads): sync state — close 55q.4 + cross-layer mirror evidence (916b005)
29
+
30
+ ## [v1.4.4] - 2026-05-25
31
+
32
+ - Merge pull request #104 from jeremylongshore/feat/bd-sync-race-gemini-followups (43699e6)
33
+ - fix(bd-sync-repro): address PR #103 Gemini review findings (0e60ba5)
34
+
3
35
  ## [v1.4.3] - 2026-05-25
4
36
 
5
37
  - Merge pull request #103 from jeremylongshore/feat/bd-sync-rapid-write-race-55q.4 (bf57454)
package/README.md CHANGED
@@ -152,7 +152,7 @@ Global flags on every command: `--workspace <path>`, `--json`, `--verbose`, `--q
152
152
 
153
153
  ## Status
154
154
 
155
- **v1.0.5 — stable.** 1.4.3 tests passing across 5 packages. Used daily by the author. Public release on npm.
155
+ **v1.0.5 — stable.** 1.5.2 tests passing across 5 packages. Used daily by the author. Public release on npm.
156
156
 
157
157
  - **Stable**: all 14 commands, the compilation passes, ask + research + recall + render + promote, the audit chain.
158
158
  - **In progress**: post-v1 coverage uplift on compiler + cli packages; mutation-testing baseline.
package/dist/index.js CHANGED
@@ -4329,11 +4329,15 @@ import { join as join3 } from "path";
4329
4329
  import { randomUUID } from "crypto";
4330
4330
  import {
4331
4331
  appendFileSync,
4332
+ closeSync,
4333
+ constants as fsConstants,
4332
4334
  existsSync as existsSync4,
4335
+ fstatSync,
4333
4336
  mkdirSync as mkdirSync2,
4337
+ openSync,
4334
4338
  readFileSync as readFileSync4,
4335
- statSync,
4336
- writeFileSync as writeFileSync2
4339
+ writeFileSync as writeFileSync2,
4340
+ writeSync
4337
4341
  } from "fs";
4338
4342
  import { join as join2 } from "path";
4339
4343
  import { readFileSync as readFileSync3 } from "fs";
@@ -4350,7 +4354,7 @@ import { basename, resolve as resolve4 } from "path";
4350
4354
  import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync7 } from "fs";
4351
4355
  import { basename as basename2, resolve as resolve5 } from "path";
4352
4356
  import { createHash as createHash3, randomUUID as randomUUID5 } from "crypto";
4353
- import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync8, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync4 } from "fs";
4357
+ import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync8, statSync, unlinkSync, writeFileSync as writeFileSync4 } from "fs";
4354
4358
  import { join as join5, relative, resolve as resolve6 } from "path";
4355
4359
  import matter from "gray-matter";
4356
4360
  import matter2 from "gray-matter";
@@ -4364,16 +4368,16 @@ import {
4364
4368
  readdirSync as readdirSync6,
4365
4369
  readFileSync as readFileSync11,
4366
4370
  renameSync as renameSync2,
4367
- statSync as statSync4,
4371
+ statSync as statSync3,
4368
4372
  writeFileSync as writeFileSync5
4369
4373
  } from "fs";
4370
4374
  import { basename as basename3, join as join9, resolve as resolve7 } from "path";
4371
4375
  import matter4 from "gray-matter";
4372
4376
  import { existsSync as existsSync14, readdirSync as readdirSync7, readFileSync as readFileSync12 } from "fs";
4373
4377
  import { basename as basename4, join as join10 } from "path";
4374
- import { mkdirSync as mkdirSync7, readdirSync as readdirSync8, statSync as statSync5, writeFileSync as writeFileSync6 } from "fs";
4378
+ import { mkdirSync as mkdirSync7, readdirSync as readdirSync8, statSync as statSync4, writeFileSync as writeFileSync6 } from "fs";
4375
4379
  import { join as join11 } from "path";
4376
- import { readdirSync as readdirSync9, readFileSync as readFileSync13, statSync as statSync6 } from "fs";
4380
+ import { readdirSync as readdirSync9, readFileSync as readFileSync13, statSync as statSync5 } from "fs";
4377
4381
  import { join as join12, resolve as resolve8 } from "path";
4378
4382
  import { load as yamlLoad } from "js-yaml";
4379
4383
  import { randomUUID as randomUUID6 } from "crypto";
@@ -4893,39 +4897,46 @@ function writeTrace(db, workspacePath, eventType, payload, options) {
4893
4897
  const absoluteFilePath = join2(workspacePath, relativeFilePath);
4894
4898
  const tracesDir = join2(workspacePath, "audit", "traces");
4895
4899
  mkdirSync2(tracesDir, { recursive: true });
4896
- const lastLine = readLastLine(absoluteFilePath);
4897
- const prev_hash = lastLine !== null ? sha256Hex(lastLine) : null;
4898
- const envelope = {
4899
- timestamp,
4900
- event_type: eventType,
4901
- event_id,
4902
- correlation_id,
4903
- payload: safePayload,
4904
- prev_hash
4905
- };
4906
- const jsonLine = JSON.stringify(envelope);
4907
- let line_offset = 0;
4908
- if (existsSync4(absoluteFilePath)) {
4909
- try {
4910
- line_offset = statSync(absoluteFilePath).size;
4911
- } catch {
4912
- line_offset = 0;
4913
- }
4914
- }
4915
- appendFileSync(absoluteFilePath, jsonLine + "\n", "utf-8");
4916
- const stmt = db.prepare(
4900
+ const insertStmt = db.prepare(
4917
4901
  `INSERT INTO traces (id, event_type, correlation_id, timestamp, file_path, line_offset, summary)
4918
4902
  VALUES (?, ?, ?, ?, ?, ?, ?)`
4919
4903
  );
4920
- stmt.run(
4921
- event_id,
4922
- eventType,
4923
- correlation_id,
4924
- timestamp,
4925
- relativeFilePath,
4926
- line_offset,
4927
- summary
4928
- );
4904
+ const writeAndIndex = db.transaction(() => {
4905
+ const lastLine = readLastLine(absoluteFilePath);
4906
+ const prev_hash = lastLine !== null ? sha256Hex(lastLine) : null;
4907
+ const envelope2 = {
4908
+ timestamp,
4909
+ event_type: eventType,
4910
+ event_id,
4911
+ correlation_id,
4912
+ payload: safePayload,
4913
+ prev_hash
4914
+ };
4915
+ const jsonLine = JSON.stringify(envelope2);
4916
+ const fd = openSync(
4917
+ absoluteFilePath,
4918
+ fsConstants.O_CREAT | fsConstants.O_APPEND | fsConstants.O_WRONLY,
4919
+ 384
4920
+ );
4921
+ let line_offset;
4922
+ try {
4923
+ line_offset = fstatSync(fd).size;
4924
+ writeSync(fd, jsonLine + "\n");
4925
+ } finally {
4926
+ closeSync(fd);
4927
+ }
4928
+ insertStmt.run(
4929
+ event_id,
4930
+ eventType,
4931
+ correlation_id,
4932
+ timestamp,
4933
+ relativeFilePath,
4934
+ line_offset,
4935
+ summary
4936
+ );
4937
+ return envelope2;
4938
+ });
4939
+ const envelope = writeAndIndex.exclusive();
4929
4940
  appendToAuditLog(workspacePath, timestamp, eventType, summary);
4930
4941
  return ok(envelope);
4931
4942
  } catch (e) {
@@ -5674,7 +5685,7 @@ function promoteArtifact(db, workspacePath, input) {
5674
5685
  }
5675
5686
  let fileSize;
5676
5687
  try {
5677
- fileSize = statSync2(absoluteSource).size;
5688
+ fileSize = statSync(absoluteSource).size;
5678
5689
  } catch {
5679
5690
  return err(new PromotionError("FILE_NOT_FOUND", `Cannot stat source file: ${relativeSource}`));
5680
5691
  }
@@ -6096,7 +6107,7 @@ function atomicWriteSpool(outDirAbs, filename, jsonlBody, candidateIds, emittedA
6096
6107
  try {
6097
6108
  writeFileSync5(spoolTmp, jsonlBody, "utf-8");
6098
6109
  renameSync2(spoolTmp, spoolFile);
6099
- const bytes = statSync4(spoolFile).size;
6110
+ const bytes = statSync3(spoolFile).size;
6100
6111
  const sha256 = createHash4("sha256").update(jsonlBody, "utf-8").digest("hex");
6101
6112
  const manifest = {
6102
6113
  schemaVersion,
@@ -6425,7 +6436,7 @@ function countFiles(dirPath) {
6425
6436
  const files = [];
6426
6437
  for (const entry of entries) {
6427
6438
  try {
6428
- const s = statSync5(join11(dirPath, entry));
6439
+ const s = statSync4(join11(dirPath, entry));
6429
6440
  if (s.isFile()) {
6430
6441
  files.push(entry);
6431
6442
  }
@@ -11435,7 +11446,7 @@ function register4(program) {
11435
11446
  }
11436
11447
 
11437
11448
  // src/commands/ingest.ts
11438
- import { copyFileSync, existsSync as existsSync24, mkdirSync as mkdirSync9, readdirSync as readdirSync12, statSync as statSync3 } from "fs";
11449
+ import { copyFileSync, existsSync as existsSync24, mkdirSync as mkdirSync9, readdirSync as readdirSync12, statSync as statSync2 } from "fs";
11439
11450
  import { basename as basename6, extname, join as join16, relative as relative3 } from "path";
11440
11451
  import { createInterface } from "readline";
11441
11452
  var SIZE_LIMITS = {
@@ -11504,7 +11515,7 @@ function runIngest(filePath, ingestOpts, globalOpts) {
11504
11515
  }
11505
11516
  let fileSize;
11506
11517
  try {
11507
- fileSize = statSync3(filePath).size;
11518
+ fileSize = statSync2(filePath).size;
11508
11519
  } catch (e) {
11509
11520
  return { ok: false, error: e instanceof Error ? e : new Error(String(e)) };
11510
11521
  }
@@ -11665,7 +11676,7 @@ function register5(program) {
11665
11676
  ...globalOpts.workspace !== void 0 && { workspace: globalOpts.workspace }
11666
11677
  };
11667
11678
  const skipConfirm = opts.yes === true || globalOpts.yes === true;
11668
- const pathStat = statSync3(filePath, { throwIfNoEntry: false });
11679
+ const pathStat = statSync2(filePath, { throwIfNoEntry: false });
11669
11680
  if (pathStat?.isDirectory()) {
11670
11681
  const files = scanDirectory(filePath);
11671
11682
  if (files.length === 0) {
@@ -11683,7 +11694,7 @@ function register5(program) {
11683
11694
  if (!skipConfirm && process.stdin.isTTY) {
11684
11695
  let fileSize = 0;
11685
11696
  try {
11686
- fileSize = statSync3(file).size;
11697
+ fileSize = statSync2(file).size;
11687
11698
  } catch {
11688
11699
  }
11689
11700
  const previewType = detectSourceType2(file);
@@ -11729,7 +11740,7 @@ function register5(program) {
11729
11740
  }
11730
11741
  let fileSize = 0;
11731
11742
  try {
11732
- fileSize = statSync3(filePath).size;
11743
+ fileSize = statSync2(filePath).size;
11733
11744
  } catch {
11734
11745
  }
11735
11746
  const previewType = detectSourceType2(filePath);