@themoltnet/legreffier 0.32.2 → 0.32.4
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/index.js +94 -26
- package/package.json +11 -7
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { basename, dirname, isAbsolute, join } from "node:path";
|
|
|
5
5
|
import { Box, Text, render, useApp, useInput } from "ink";
|
|
6
6
|
import { useEffect, useReducer, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { createSign } from "node:crypto";
|
|
9
|
-
import { createHash, randomBytes } from "crypto";
|
|
8
|
+
import { createHash, createSign } from "node:crypto";
|
|
9
|
+
import crypto, { createHash as createHash$1, randomBytes } from "crypto";
|
|
10
10
|
import { access, chmod, copyFile, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
11
11
|
import { homedir } from "node:os";
|
|
12
12
|
import { parse, stringify } from "smol-toml";
|
|
@@ -1415,6 +1415,7 @@ function problemToError(problem, statusCode) {
|
|
|
1415
1415
|
detail: problem.detail
|
|
1416
1416
|
});
|
|
1417
1417
|
}
|
|
1418
|
+
new TextEncoder();
|
|
1418
1419
|
//#endregion
|
|
1419
1420
|
//#region ../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/bytes.js
|
|
1420
1421
|
function equals$1(aa, bb) {
|
|
@@ -1631,12 +1632,12 @@ var Codec = class {
|
|
|
1631
1632
|
return this.decoder.decode(input);
|
|
1632
1633
|
}
|
|
1633
1634
|
};
|
|
1634
|
-
function from({ name, prefix, encode, decode }) {
|
|
1635
|
+
function from$1({ name, prefix, encode, decode }) {
|
|
1635
1636
|
return new Codec(name, prefix, encode, decode);
|
|
1636
1637
|
}
|
|
1637
1638
|
function baseX({ name, prefix, alphabet }) {
|
|
1638
1639
|
const { encode, decode } = _brrp__multiformats_scope_baseX(alphabet, name);
|
|
1639
|
-
return from({
|
|
1640
|
+
return from$1({
|
|
1640
1641
|
prefix,
|
|
1641
1642
|
name,
|
|
1642
1643
|
encode,
|
|
@@ -1691,7 +1692,7 @@ function createAlphabetIdx(alphabet) {
|
|
|
1691
1692
|
*/
|
|
1692
1693
|
function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
|
|
1693
1694
|
const alphabetIdx = createAlphabetIdx(alphabet);
|
|
1694
|
-
return from({
|
|
1695
|
+
return from$1({
|
|
1695
1696
|
prefix,
|
|
1696
1697
|
name,
|
|
1697
1698
|
encode(input) {
|
|
@@ -2728,7 +2729,7 @@ var _SHA512 = class extends SHA2_64B {
|
|
|
2728
2729
|
}
|
|
2729
2730
|
};
|
|
2730
2731
|
/** SHA2-512 hash function from RFC 4634. */
|
|
2731
|
-
var sha512 = /* @__PURE__ */ createHasher$1(() => new _SHA512(), /* @__PURE__ */ oidNist(3));
|
|
2732
|
+
var sha512$1 = /* @__PURE__ */ createHasher$1(() => new _SHA512(), /* @__PURE__ */ oidNist(3));
|
|
2732
2733
|
//#endregion
|
|
2733
2734
|
//#region ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/utils.js
|
|
2734
2735
|
/**
|
|
@@ -4567,7 +4568,7 @@ var ed25519_Point = /* @__PURE__ */ edwards(ed25519_CURVE$1, { uvRatio: uvRatio$
|
|
|
4567
4568
|
var Fp = ed25519_Point.Fp;
|
|
4568
4569
|
var Fn = ed25519_Point.Fn;
|
|
4569
4570
|
function ed(opts) {
|
|
4570
|
-
return eddsa(ed25519_Point, sha512, Object.assign({ adjustScalarBytes }, opts));
|
|
4571
|
+
return eddsa(ed25519_Point, sha512$1, Object.assign({ adjustScalarBytes }, opts));
|
|
4571
4572
|
}
|
|
4572
4573
|
/**
|
|
4573
4574
|
* ed25519 curve with EdDSA signatures.
|
|
@@ -4666,7 +4667,7 @@ createHasher(ed25519_Point, (scalars) => map_to_curve_elligator2_edwards25519(sc
|
|
|
4666
4667
|
m: 1,
|
|
4667
4668
|
k: 128,
|
|
4668
4669
|
expand: "xmd",
|
|
4669
|
-
hash: sha512
|
|
4670
|
+
hash: sha512$1
|
|
4670
4671
|
});
|
|
4671
4672
|
var SQRT_M1 = ED25519_SQRT_M1;
|
|
4672
4673
|
var SQRT_AD_MINUS_ONE = /* @__PURE__ */ BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235");
|
|
@@ -4807,11 +4808,11 @@ var _RistrettoPoint = class _RistrettoPoint extends PrimeEdwardsPoint {
|
|
|
4807
4808
|
var ristretto255_hasher = {
|
|
4808
4809
|
Point: _RistrettoPoint,
|
|
4809
4810
|
hashToCurve(msg, options) {
|
|
4810
|
-
const xmd = expand_message_xmd(msg, options?.DST || "ristretto255_XMD:SHA-512_R255MAP_RO_", 64, sha512);
|
|
4811
|
+
const xmd = expand_message_xmd(msg, options?.DST || "ristretto255_XMD:SHA-512_R255MAP_RO_", 64, sha512$1);
|
|
4811
4812
|
return ristretto255_hasher.deriveToCurve(xmd);
|
|
4812
4813
|
},
|
|
4813
4814
|
hashToScalar(msg, options = { DST: _DST_scalar }) {
|
|
4814
|
-
const xmd = expand_message_xmd(msg, options.DST, 64, sha512);
|
|
4815
|
+
const xmd = expand_message_xmd(msg, options.DST, 64, sha512$1);
|
|
4815
4816
|
return Fn.create(bytesToNumberLE(xmd));
|
|
4816
4817
|
},
|
|
4817
4818
|
deriveToCurve(bytes) {
|
|
@@ -4824,7 +4825,7 @@ var ristretto255_hasher = {
|
|
|
4824
4825
|
createORPF({
|
|
4825
4826
|
name: "ristretto255-SHA512",
|
|
4826
4827
|
Point: _RistrettoPoint,
|
|
4827
|
-
hash: sha512,
|
|
4828
|
+
hash: sha512$1,
|
|
4828
4829
|
hashToGroup: ristretto255_hasher.hashToCurve,
|
|
4829
4830
|
hashToScalar: ristretto255_hasher.hashToScalar
|
|
4830
4831
|
});
|
|
@@ -5316,7 +5317,7 @@ var wNAF = (n) => {
|
|
|
5316
5317
|
* Uses @noble/ed25519 for pure TypeScript implementation
|
|
5317
5318
|
*/
|
|
5318
5319
|
etc.sha512Sync = (...m) => {
|
|
5319
|
-
const hash = createHash("sha512");
|
|
5320
|
+
const hash = createHash$1("sha512");
|
|
5320
5321
|
m.forEach((msg) => hash.update(msg));
|
|
5321
5322
|
return hash.digest();
|
|
5322
5323
|
};
|
|
@@ -5335,7 +5336,7 @@ var DOMAIN_PREFIX = "moltnet:v1";
|
|
|
5335
5336
|
* newline, and encoding differences between runtimes.
|
|
5336
5337
|
*/
|
|
5337
5338
|
function buildSigningBytes(message, nonce) {
|
|
5338
|
-
const msgHash = createHash("sha256").update(Buffer.from(message, "utf-8")).digest();
|
|
5339
|
+
const msgHash = createHash$1("sha256").update(Buffer.from(message, "utf-8")).digest();
|
|
5339
5340
|
const nonceBytes = Buffer.from(nonce, "utf-8");
|
|
5340
5341
|
const prefix = Buffer.from(DOMAIN_PREFIX, "utf-8");
|
|
5341
5342
|
const buf = Buffer.alloc(prefix.length + 4 + msgHash.length + 4 + nonceBytes.length);
|
|
@@ -5363,7 +5364,7 @@ var cryptoService = {
|
|
|
5363
5364
|
};
|
|
5364
5365
|
},
|
|
5365
5366
|
generateFingerprint(publicKeyBytes) {
|
|
5366
|
-
return (createHash("sha256").update(publicKeyBytes).digest("hex").slice(0, 16).toUpperCase().match(/.{4}/g) ?? []).join("-");
|
|
5367
|
+
return (createHash$1("sha256").update(publicKeyBytes).digest("hex").slice(0, 16).toUpperCase().match(/.{4}/g) ?? []).join("-");
|
|
5367
5368
|
},
|
|
5368
5369
|
parsePublicKey(publicKey) {
|
|
5369
5370
|
const base64 = publicKey.replace(/^ed25519:/, "");
|
|
@@ -5445,6 +5446,71 @@ var cryptoService = {
|
|
|
5445
5446
|
}
|
|
5446
5447
|
};
|
|
5447
5448
|
//#endregion
|
|
5449
|
+
//#region ../../libs/crypto-service/src/executor-attestation.ts
|
|
5450
|
+
etc.sha512Sync = (...m) => {
|
|
5451
|
+
const hash = createHash("sha512");
|
|
5452
|
+
m.forEach((msg) => hash.update(msg));
|
|
5453
|
+
return hash.digest();
|
|
5454
|
+
};
|
|
5455
|
+
new TextEncoder();
|
|
5456
|
+
new TextDecoder();
|
|
5457
|
+
//#endregion
|
|
5458
|
+
//#region ../../node_modules/.pnpm/multiformats@13.4.2/node_modules/multiformats/dist/src/hashes/hasher.js
|
|
5459
|
+
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
5460
|
+
function from({ name, code, encode, minDigestLength, maxDigestLength }) {
|
|
5461
|
+
return new Hasher(name, code, encode, minDigestLength, maxDigestLength);
|
|
5462
|
+
}
|
|
5463
|
+
/**
|
|
5464
|
+
* Hasher represents a hashing algorithm implementation that produces as
|
|
5465
|
+
* `MultihashDigest`.
|
|
5466
|
+
*/
|
|
5467
|
+
var Hasher = class {
|
|
5468
|
+
name;
|
|
5469
|
+
code;
|
|
5470
|
+
encode;
|
|
5471
|
+
minDigestLength;
|
|
5472
|
+
maxDigestLength;
|
|
5473
|
+
constructor(name, code, encode, minDigestLength, maxDigestLength) {
|
|
5474
|
+
this.name = name;
|
|
5475
|
+
this.code = code;
|
|
5476
|
+
this.encode = encode;
|
|
5477
|
+
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
5478
|
+
this.maxDigestLength = maxDigestLength;
|
|
5479
|
+
}
|
|
5480
|
+
digest(input, options) {
|
|
5481
|
+
if (options?.truncate != null) {
|
|
5482
|
+
if (options.truncate < this.minDigestLength) throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
5483
|
+
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
5484
|
+
}
|
|
5485
|
+
if (input instanceof Uint8Array) {
|
|
5486
|
+
const result = this.encode(input);
|
|
5487
|
+
if (result instanceof Uint8Array) return createDigest(result, this.code, options?.truncate);
|
|
5488
|
+
return result.then((digest) => createDigest(digest, this.code, options?.truncate));
|
|
5489
|
+
} else throw Error("Unknown type, must be binary type");
|
|
5490
|
+
}
|
|
5491
|
+
};
|
|
5492
|
+
/**
|
|
5493
|
+
* Create a Digest from the passed uint8array and code, optionally truncating it
|
|
5494
|
+
* first.
|
|
5495
|
+
*/
|
|
5496
|
+
function createDigest(digest, code, truncate) {
|
|
5497
|
+
if (truncate != null && truncate !== digest.byteLength) {
|
|
5498
|
+
if (truncate > digest.byteLength) throw new Error(`Invalid truncate option, must be less than or equal to ${digest.byteLength}`);
|
|
5499
|
+
digest = digest.subarray(0, truncate);
|
|
5500
|
+
}
|
|
5501
|
+
return create(code, digest);
|
|
5502
|
+
}
|
|
5503
|
+
from({
|
|
5504
|
+
name: "sha2-256",
|
|
5505
|
+
code: 18,
|
|
5506
|
+
encode: (input) => coerce(crypto.createHash("sha256").update(input).digest())
|
|
5507
|
+
});
|
|
5508
|
+
from({
|
|
5509
|
+
name: "sha2-512",
|
|
5510
|
+
code: 19,
|
|
5511
|
+
encode: (input) => coerce(crypto.createHash("sha512").update(input).digest())
|
|
5512
|
+
});
|
|
5513
|
+
//#endregion
|
|
5448
5514
|
//#region ../../node_modules/.pnpm/cborg@4.5.8/node_modules/cborg/lib/is.js
|
|
5449
5515
|
var objectTypeNames = [
|
|
5450
5516
|
"Object",
|
|
@@ -7253,7 +7319,7 @@ _decodeOptions.tags[CID_CBOR_TAG] = cidDecoder;
|
|
|
7253
7319
|
* for use with git commit signing and SSH authentication.
|
|
7254
7320
|
*/
|
|
7255
7321
|
if (!etc.sha512Sync) etc.sha512Sync = (...m) => {
|
|
7256
|
-
const hash = createHash("sha512");
|
|
7322
|
+
const hash = createHash$1("sha512");
|
|
7257
7323
|
m.forEach((msg) => hash.update(msg));
|
|
7258
7324
|
return hash.digest();
|
|
7259
7325
|
};
|
|
@@ -7638,15 +7704,6 @@ var SKILLS = [
|
|
|
7638
7704
|
name: "legreffier",
|
|
7639
7705
|
files: ["SKILL.md"]
|
|
7640
7706
|
},
|
|
7641
|
-
{
|
|
7642
|
-
name: "legreffier-scan",
|
|
7643
|
-
files: [
|
|
7644
|
-
"SKILL.md",
|
|
7645
|
-
"references/scan-flows.md",
|
|
7646
|
-
"references/path-discovery.md",
|
|
7647
|
-
"references/content-templates.md"
|
|
7648
|
-
]
|
|
7649
|
-
},
|
|
7650
7707
|
{
|
|
7651
7708
|
name: "legreffier-explore",
|
|
7652
7709
|
files: ["SKILL.md", "references/exploration-pack-plan.yaml"]
|
|
@@ -7730,7 +7787,13 @@ function buildGhTokenRule() {
|
|
|
7730
7787
|
"# 2. Refuse to proceed if the file does not exist at that absolute path.",
|
|
7731
7788
|
"[ -f \"$CREDS\" ] || { echo \"FATAL: moltnet.json not found at $CREDS\" >&2; exit 1; }",
|
|
7732
7789
|
"",
|
|
7733
|
-
"# 3. Call gh with GH_TOKEN inlined.",
|
|
7790
|
+
"# 3. Call gh with GH_TOKEN inlined. Use the `moltnet` binary if it",
|
|
7791
|
+
"# is on PATH, otherwise fall back to `npx @themoltnet/cli`. Never",
|
|
7792
|
+
"# reference `$MOLTNET_CLI` here — it may be unset in ad-hoc shells",
|
|
7793
|
+
"# and expanding to empty silently swallows the subcommand, producing",
|
|
7794
|
+
"# an empty GH_TOKEN and falling back to your personal auth.",
|
|
7795
|
+
"GH_TOKEN=$(moltnet github token --credentials \"$CREDS\") gh <command>",
|
|
7796
|
+
"# or, if `moltnet` is not installed:",
|
|
7734
7797
|
"GH_TOKEN=$(npx @themoltnet/cli github token --credentials \"$CREDS\") gh <command>",
|
|
7735
7798
|
"```",
|
|
7736
7799
|
"",
|
|
@@ -7746,7 +7809,7 @@ function buildGhTokenRule() {
|
|
|
7746
7809
|
"`$(dirname \"$GIT_CONFIG_GLOBAL\")` resolves differently depending on where you are.",
|
|
7747
7810
|
"When it resolves to a non-existent directory:",
|
|
7748
7811
|
"",
|
|
7749
|
-
"- `npx @themoltnet/cli github token` prints `no credentials found` to stderr,",
|
|
7812
|
+
"- `moltnet github token` (or `npx @themoltnet/cli github token`) prints `no credentials found` to stderr,",
|
|
7750
7813
|
"- the command substitution yields an empty `GH_TOKEN`,",
|
|
7751
7814
|
"- `gh` silently falls back to your personal token,",
|
|
7752
7815
|
"- the resulting API call is attributed to the **human**, not the agent.",
|
|
@@ -7763,6 +7826,11 @@ function buildGhTokenRule() {
|
|
|
7763
7826
|
"- `GH_TOKEN=$(... --credentials \"./moltnet.json\") gh ...` — relative. Breaks.",
|
|
7764
7827
|
"- `GH_TOKEN=$(... --credentials \"~/.moltnet/...\") gh ...` — `~` is not expanded",
|
|
7765
7828
|
" inside double quotes; use `$HOME` or the literal absolute path.",
|
|
7829
|
+
"- `GH_TOKEN=$($MOLTNET_CLI github token ...) gh ...` — do **not** reference the",
|
|
7830
|
+
" `$MOLTNET_CLI` variable in this rule. It is only set inside the legreffier",
|
|
7831
|
+
" skill session; in ad-hoc shells it expands to empty, the `github token`",
|
|
7832
|
+
" subcommand is swallowed, `GH_TOKEN` is empty, and `gh` silently falls back",
|
|
7833
|
+
" to the human token. Hardcode `moltnet` or `npx @themoltnet/cli`.",
|
|
7766
7834
|
"",
|
|
7767
7835
|
"## Allowed `gh` subcommands",
|
|
7768
7836
|
"",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/legreffier",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.4",
|
|
4
4
|
"description": "LeGreffier — attribution and measured memory for AI coding agents.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -33,17 +33,21 @@
|
|
|
33
33
|
"vite": "^8.0.0",
|
|
34
34
|
"vitest": "^3.0.0",
|
|
35
35
|
"@moltnet/api-client": "0.1.0",
|
|
36
|
+
"@themoltnet/design-system": "0.7.2",
|
|
37
|
+
"@themoltnet/github-agent": "0.23.3",
|
|
36
38
|
"@moltnet/crypto-service": "0.1.0",
|
|
37
|
-
"@themoltnet/
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
"@themoltnet/sdk": "0.98.0"
|
|
40
|
+
},
|
|
41
|
+
"nx": {
|
|
42
|
+
"tags": [
|
|
43
|
+
"type:client",
|
|
44
|
+
"scope:diary",
|
|
45
|
+
"platform:cli"
|
|
46
|
+
]
|
|
40
47
|
},
|
|
41
48
|
"scripts": {
|
|
42
49
|
"dev": "vite build --watch",
|
|
43
|
-
"build": "vite build",
|
|
44
50
|
"typecheck": "tsc -b --emitDeclarationOnly && tsc -b tsconfig.test.json --force",
|
|
45
|
-
"test": "vitest run --passWithNoTests",
|
|
46
|
-
"lint": "eslint src/",
|
|
47
51
|
"check:pack": "tsx ../../tools/src/check-pack.ts --package ."
|
|
48
52
|
}
|
|
49
53
|
}
|