overlane 0.1.125 → 0.1.126

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/dist/overlane.mjs CHANGED
@@ -22378,6 +22378,208 @@ var init_onboarding = __esm({
22378
22378
  }
22379
22379
  });
22380
22380
 
22381
+ // ../contracts/src/audit.ts
22382
+ function canonicalJson(value) {
22383
+ if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
22384
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
22385
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
22386
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
22387
+ }
22388
+ function sha256Hex(text) {
22389
+ const data = new TextEncoder().encode(text);
22390
+ const bitLength = data.length * 8;
22391
+ const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
22392
+ padded.set(data);
22393
+ padded[data.length] = 128;
22394
+ const view = new DataView(padded.buffer);
22395
+ view.setUint32(padded.length - 8, Math.floor(bitLength / 2 ** 32));
22396
+ view.setUint32(padded.length - 4, bitLength >>> 0);
22397
+ const h = new Uint32Array([1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]);
22398
+ const w = new Uint32Array(64);
22399
+ const rotr = (x, n) => x >>> n | x << 32 - n;
22400
+ for (let offset = 0; offset < padded.length; offset += 64) {
22401
+ for (let i2 = 0; i2 < 16; i2 += 1) w[i2] = view.getUint32(offset + i2 * 4);
22402
+ for (let i2 = 16; i2 < 64; i2 += 1) {
22403
+ const a2 = w[i2 - 15];
22404
+ const b2 = w[i2 - 2];
22405
+ const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
22406
+ const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
22407
+ w[i2] = w[i2 - 16] + s0 + w[i2 - 7] + s1 >>> 0;
22408
+ }
22409
+ let [a, b, c, d, e, f, g, hh] = h;
22410
+ for (let i2 = 0; i2 < 64; i2 += 1) {
22411
+ const t1 = hh + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + (e & f ^ ~e & g) + K[i2] + w[i2] >>> 0;
22412
+ const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
22413
+ hh = g;
22414
+ g = f;
22415
+ f = e;
22416
+ e = d + t1 >>> 0;
22417
+ d = c;
22418
+ c = b;
22419
+ b = a;
22420
+ a = t1 + t2 >>> 0;
22421
+ }
22422
+ const sums = [a, b, c, d, e, f, g, hh];
22423
+ for (let i2 = 0; i2 < 8; i2 += 1) h[i2] = h[i2] + sums[i2] >>> 0;
22424
+ }
22425
+ return [...h].map((n) => n.toString(16).padStart(8, "0")).join("");
22426
+ }
22427
+ function auditHash(prevHash, body2) {
22428
+ return sha256Hex(`${prevHash}
22429
+ ${canonicalJson(AuditEventBody.parse(body2))}`);
22430
+ }
22431
+ function chainAuditEvent(prevHash, body2) {
22432
+ const previous = prevHash ?? AUDIT_GENESIS_HASH;
22433
+ return AuditEvent.parse({ ...body2, prevHash: previous, hash: auditHash(previous, body2) });
22434
+ }
22435
+ var AUDIT_CATEGORIES, AuditCategory, AUDIT_ACTIONS, AUDIT_ACTION_NAMES, AuditActionName, AUDIT_RESULTS, AuditResult, AuditPrincipalType, AuditTarget, Hash, AUDIT_GENESIS_HASH, AuditEventBody, AuditEvent, AuditList, AuditVerification, K, FIXTURE_AT, fixtureBodies, AUDIT_FIXTURE;
22436
+ var init_audit = __esm({
22437
+ "../contracts/src/audit.ts"() {
22438
+ "use strict";
22439
+ init_zod();
22440
+ init_common();
22441
+ AUDIT_CATEGORIES = ["admin", "policy", "token"];
22442
+ AuditCategory = external_exports.enum(AUDIT_CATEGORIES);
22443
+ AUDIT_ACTIONS = {
22444
+ "member.removed": "admin",
22445
+ "member.role_changed": "admin",
22446
+ "invitation.created": "admin",
22447
+ "invitation.revoked": "admin",
22448
+ "run_policy.updated": "policy",
22449
+ "project.updated": "policy",
22450
+ "release.published": "policy",
22451
+ "release.promoted": "policy",
22452
+ "release.withdrawn": "policy",
22453
+ "release.pinned": "policy",
22454
+ "release.rolled_back": "policy",
22455
+ "memory_settings.updated": "policy",
22456
+ "issue_sync.updated": "policy",
22457
+ "loop.created": "policy",
22458
+ "loop.updated": "policy",
22459
+ "loop.deleted": "policy",
22460
+ "bot.registered": "policy",
22461
+ "bot.revoked": "policy",
22462
+ "bot.key_rotated": "policy",
22463
+ "token.created": "token",
22464
+ "token.revoked": "token"
22465
+ };
22466
+ AUDIT_ACTION_NAMES = Object.keys(AUDIT_ACTIONS);
22467
+ AuditActionName = external_exports.enum(Object.keys(AUDIT_ACTIONS));
22468
+ AUDIT_RESULTS = ["success", "denied", "failure"];
22469
+ AuditResult = external_exports.enum(AUDIT_RESULTS);
22470
+ AuditPrincipalType = external_exports.enum(["user", "agent", "system"]);
22471
+ AuditTarget = external_exports.object({ type: external_exports.string().min(1).max(40), id: external_exports.string().max(200) }).strict();
22472
+ Hash = external_exports.string().regex(/^[0-9a-f]{64}$/, "must be 64 lowercase hex characters");
22473
+ AUDIT_GENESIS_HASH = "0".repeat(64);
22474
+ AuditEventBody = external_exports.object({
22475
+ tenantId: TenantId,
22476
+ /** 1, 2, 3 ... per tenant, with no gaps. */
22477
+ seq: external_exports.number().int().positive(),
22478
+ eventId: external_exports.string().min(1).max(64),
22479
+ at: Timestamp,
22480
+ /** User ID, agent token ID or `system`. */
22481
+ actor: external_exports.string().min(1).max(200),
22482
+ principalType: AuditPrincipalType,
22483
+ role: external_exports.string().min(1).max(40).nullable(),
22484
+ action: AuditActionName,
22485
+ category: AuditCategory,
22486
+ target: AuditTarget,
22487
+ result: AuditResult
22488
+ }).strict();
22489
+ AuditEvent = AuditEventBody.extend({ prevHash: Hash, hash: Hash }).strict().refine((event) => AUDIT_ACTIONS[event.action] === event.category, { message: "category does not match the action", path: ["category"] });
22490
+ AuditList = external_exports.object({
22491
+ tenantId: TenantId,
22492
+ events: external_exports.array(AuditEvent),
22493
+ /** Pass as `after` to read the next page; null when this is the last page. */
22494
+ nextAfter: external_exports.number().int().nonnegative().nullable(),
22495
+ /** Hash of the newest row of the tenant's chain (null for an empty log). */
22496
+ head: Hash.nullable()
22497
+ }).strict();
22498
+ AuditVerification = external_exports.object({
22499
+ tenantId: TenantId,
22500
+ ok: external_exports.boolean(),
22501
+ checked: external_exports.number().int().nonnegative(),
22502
+ head: Hash.nullable(),
22503
+ /** The first row that fails (its seq) and why. */
22504
+ brokenAt: external_exports.number().int().positive().optional(),
22505
+ reason: external_exports.enum(["bad_hash", "bad_link", "bad_sequence", "wrong_tenant", "bad_category"]).optional()
22506
+ }).strict();
22507
+ K = new Uint32Array([
22508
+ 1116352408,
22509
+ 1899447441,
22510
+ 3049323471,
22511
+ 3921009573,
22512
+ 961987163,
22513
+ 1508970993,
22514
+ 2453635748,
22515
+ 2870763221,
22516
+ 3624381080,
22517
+ 310598401,
22518
+ 607225278,
22519
+ 1426881987,
22520
+ 1925078388,
22521
+ 2162078206,
22522
+ 2614888103,
22523
+ 3248222580,
22524
+ 3835390401,
22525
+ 4022224774,
22526
+ 264347078,
22527
+ 604807628,
22528
+ 770255983,
22529
+ 1249150122,
22530
+ 1555081692,
22531
+ 1996064986,
22532
+ 2554220882,
22533
+ 2821834349,
22534
+ 2952996808,
22535
+ 3210313671,
22536
+ 3336571891,
22537
+ 3584528711,
22538
+ 113926993,
22539
+ 338241895,
22540
+ 666307205,
22541
+ 773529912,
22542
+ 1294757372,
22543
+ 1396182291,
22544
+ 1695183700,
22545
+ 1986661051,
22546
+ 2177026350,
22547
+ 2456956037,
22548
+ 2730485921,
22549
+ 2820302411,
22550
+ 3259730800,
22551
+ 3345764771,
22552
+ 3516065817,
22553
+ 3600352804,
22554
+ 4094571909,
22555
+ 275423344,
22556
+ 430227734,
22557
+ 506948616,
22558
+ 659060556,
22559
+ 883997877,
22560
+ 958139571,
22561
+ 1322822218,
22562
+ 1537002063,
22563
+ 1747873779,
22564
+ 1955562222,
22565
+ 2024104815,
22566
+ 2227730452,
22567
+ 2361852424,
22568
+ 2428436474,
22569
+ 2756734187,
22570
+ 3204031479,
22571
+ 3329325298
22572
+ ]);
22573
+ FIXTURE_AT = "2026-10-09T00:00:00.000Z";
22574
+ fixtureBodies = [
22575
+ { tenantId: "tm-1", seq: 1, eventId: "aud_1", at: FIXTURE_AT, actor: "u-owner", principalType: "user", role: "owner", action: "invitation.created", category: "admin", target: { type: "invitation", id: "inv_1" }, result: "success" },
22576
+ { tenantId: "tm-1", seq: 2, eventId: "aud_2", at: "2026-10-09T00:05:00.000Z", actor: "u-admin", principalType: "user", role: "admin", action: "run_policy.updated", category: "policy", target: { type: "project", id: "prj-demo" }, result: "success" },
22577
+ { tenantId: "tm-1", seq: 3, eventId: "aud_3", at: "2026-10-09T00:10:00.000Z", actor: "u-viewer", principalType: "user", role: "viewer", action: "token.created", category: "token", target: { type: "token", id: "" }, result: "denied" }
22578
+ ];
22579
+ AUDIT_FIXTURE = fixtureBodies.reduce((rows, body2) => [...rows, chainAuditEvent(rows.at(-1)?.hash ?? null, body2)], []);
22580
+ }
22581
+ });
22582
+
22381
22583
  // ../contracts/src/docs-service.ts
22382
22584
  function scoped(shape2) {
22383
22585
  return external_exports.discriminatedUnion("visibility", [external_exports.object({ ...shape2, ...PublicScope }).strict(), external_exports.object({ ...shape2, ...PrivateScope }).strict()]);
@@ -23551,6 +23753,7 @@ var init_src = __esm({
23551
23753
  init_memory();
23552
23754
  init_issues();
23553
23755
  init_onboarding();
23756
+ init_audit();
23554
23757
  init_docs_service();
23555
23758
  init_review();
23556
23759
  init_guardrails();
@@ -30909,7 +31112,7 @@ var VERSION;
30909
31112
  var init_assets = __esm({
30910
31113
  "src/assets.ts"() {
30911
31114
  "use strict";
30912
- VERSION = true ? "0.1.125" : "0.0.0-dev";
31115
+ VERSION = true ? "0.1.126" : "0.0.0-dev";
30913
31116
  }
30914
31117
  });
30915
31118
 
@@ -38841,9 +39044,9 @@ import { lstat, readFile as readFile4 } from "node:fs/promises";
38841
39044
  import { join as join25 } from "node:path";
38842
39045
  import { promisify } from "node:util";
38843
39046
  function shardKeyOf(shard) {
38844
- return `sha256:${sha256Hex(Buffer.from(`${shard.path}\0${shard.contentHash}\0${shard.precision}`, "utf8"))}`;
39047
+ return `sha256:${sha256Hex2(Buffer.from(`${shard.path}\0${shard.contentHash}\0${shard.precision}`, "utf8"))}`;
38845
39048
  }
38846
- function sha256Hex(bytes) {
39049
+ function sha256Hex2(bytes) {
38847
39050
  return createHash6("sha256").update(bytes).digest("hex");
38848
39051
  }
38849
39052
  async function listTrackedFiles(repoRoot) {
@@ -38869,7 +39072,7 @@ async function hashRegularFile(repoRoot, path) {
38869
39072
  try {
38870
39073
  const stats = await lstat(absolute);
38871
39074
  if (!stats.isFile()) return null;
38872
- return `sha256:${sha256Hex(await readFile4(absolute))}`;
39075
+ return `sha256:${sha256Hex2(await readFile4(absolute))}`;
38873
39076
  } catch (error62) {
38874
39077
  if (error62 instanceof Error && "code" in error62 && error62.code === "ENOENT") return null;
38875
39078
  throw error62;
@@ -38905,7 +39108,7 @@ async function buildSnapshot(options) {
38905
39108
  if (languageForPath(path) === null) return { path, shard: null };
38906
39109
  const bytes = await readFile4(join25(options.repoRoot, path));
38907
39110
  if (bytes.byteLength > MAX_PARSE_BYTES) return { path, shard: null };
38908
- const hash2 = `sha256:${sha256Hex(bytes)}`;
39111
+ const hash2 = `sha256:${sha256Hex2(bytes)}`;
38909
39112
  if (hash2 !== hashes.get(path)) throw new Error(`${path} changed while the snapshot was being built`);
38910
39113
  const shard = await parseDeclarations(path, bytes.toString("utf8"));
38911
39114
  return { path, shard: shard ? { ...shard, contentHash: hash2 } : null };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overlane",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "description": "Overlane: connect a GitHub project to your coding agents. One portable CLI with project memory, tasks, a code index, guardrails and the Claude Code and Codex plugin.",
5
5
  "keywords": [
6
6
  "overlane",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mvrx-harness",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "description": "Overlane context at session start and the shared Overlane skills.",
5
5
  "author": {
6
6
  "name": "owenob1"