intentional-cognition-os 1.5.1 → 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 +7 -0
- package/README.md +1 -1
- package/dist/index.js +55 -44
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## [v1.5.1] - 2026-05-26
|
|
4
11
|
|
|
5
12
|
- chore(beads): file P4 sweep bead for doc 037 prose polish (GFM table-cell escape semantics) (d870d64)
|
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.5.
|
|
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
|
-
|
|
4336
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
11743
|
+
fileSize = statSync2(filePath).size;
|
|
11733
11744
|
} catch {
|
|
11734
11745
|
}
|
|
11735
11746
|
const previewType = detectSourceType2(filePath);
|