worktrust 0.10.32 → 0.10.34
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/README.md +26 -0
- package/commit-rules.mjs +447 -0
- package/engine-release.json +1 -1
- package/git-commits.mjs +346 -0
- package/history-outbox.mjs +123 -0
- package/log-session.mjs +67 -6
- package/package-release.json +1 -1
- package/package.json +3 -1
- package/worktrust.mjs +53 -7
package/package-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"c6f5280c5bf81a14db4bdc282218fb005706e92dd9a9170c0e727716ee91685a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"3096ed1693974a90e1f4f59bf01c9559d94a7941d933e36fb81d3995a97f25c1","README.md":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"c6f5280c5bf81a14db4bdc282218fb005706e92dd9a9170c0e727716ee91685a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"3096ed1693974a90e1f4f59bf01c9559d94a7941d933e36fb81d3995a97f25c1","README.md":"4f2ea9b41f90fbdc478fa1f461e4f34d8c67c847ec5bec983f809bd49897fdc7","SECURITY.md":"b672649c7c7bf18538dd4560d7b533498721e0be765a000796d7d18390b5cbb6","chat-exports.mjs":"04eafe333940ec03d5058d8d51062124aa12ab882bf04db03bcda5613ec69298","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"0eba2f176ef6f7afba071d6e00de0ff19ba2b283180a801dfd957aa38c1edd94","count-behaviour.mjs":"1beaec2a4d0aead76d166f89cc52441a9cf48f2e69da9888ca2091dd3a10a37b","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","engine-release.json":"613734a8d130c4dbd512faf6ee53e29f9892a2cbc92173598411ec28c8bc6ebe","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"b88072a28aa1dd94d9fab880f96b711b5fbed76ca62e5de24d612c08171e5b71","log-session.mjs":"d20e20c4fa5e4dd6a48a2c3b7caf4cefb090063503f38dc4716d8daee6d3bf22","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","package.json":"427be6e3e70086bc3484bcde258447d393d11bf4088298db786a024a4ae7469b","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"3e369083ba43bcda2fa0622fd526aa64fcf8ad66e7b6e8f23821752c4d47ad27","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","session-databases.mjs":"543fd3b82d28d96d789be0a1dc9186c5fafa783e98b87e5b3b17b211542e2b4d","setup-mcp.mjs":"0c29113179561af1c1e9ff8b7a786e7240edf48a2244993e12335e5ee362c812","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"ed6fef364aa28f39361d8f627abcda2162498cbaa13e90cc5860a768cb355fa2","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"dd947a3de77a3db3f17c7027f16a2e5a2da1001ed954808614e20eb871691e6b"},"format":"worktrust-package/1","kind":"npm","version":"0.10.34"},"signature":"NBifKfprOGRr5AeZSTgwwIhcyGtTuQCYYWQGAOZFZ8y3Uk700xdJlJ4x_lffCNmh-ANZZo2qliuUQrw8iO50AQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktrust",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.34",
|
|
4
4
|
"description": "Couple this computer to WorkTrust: approve a code in your browser, and every AI app here reports what you built. Metadata only, no dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"claude-mod.mjs",
|
|
33
33
|
"package-integrity.mjs",
|
|
34
34
|
"worktrust-launch.mjs",
|
|
35
|
+
"git-commits.mjs",
|
|
36
|
+
"commit-rules.mjs",
|
|
35
37
|
"engine-release.json",
|
|
36
38
|
"package-release.json",
|
|
37
39
|
"history-outbox.mjs",
|
package/worktrust.mjs
CHANGED
|
@@ -76,7 +76,7 @@ const command = args.includes("--help") ? "help" : args.includes("--version") ?
|
|
|
76
76
|
const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
|
|
77
77
|
const has = (name) => args.includes(`--${name}`);
|
|
78
78
|
/** This CLI's version, said to the door so the app can tell which computer runs an old one (check-cli-package holds it equal to package.json). */
|
|
79
|
-
const CLI_VERSION = "0.10.
|
|
79
|
+
const CLI_VERSION = "0.10.34";
|
|
80
80
|
/**
|
|
81
81
|
* HOW THIS CLI MEASURES, AS A NUMBER OF ITS OWN (0.10.31; owner, 2026-10-28: 0.10.30 offered a re-measure it had no reason
|
|
82
82
|
* to offer). Raised ONLY when what is measured changes: the timeline, the seconds, the tokens, the steering, the session
|
|
@@ -84,6 +84,12 @@ const CLI_VERSION = "0.10.32";
|
|
|
84
84
|
* the earlier install measured by other rules, and names what changed from MEASURE_CHANGES; installed-release.json and
|
|
85
85
|
* history.json record it. 1 is the rules of 0.10.29, which 0.10.30 and 0.10.31 kept; 2 (0.10.32) adds the subagent runs, each
|
|
86
86
|
* agent call's outcome and who wrote each turn of a run no person started.
|
|
87
|
+
* 0.10.33 KEEPS 2 (release 9, 2026-10-29): one line per autonomous process per day changes how finished headless and
|
|
88
|
+
* scheduled runs are PACKED into lines, not what is measured: the timeline, the seconds (the minute compaction keeps every
|
|
89
|
+
* counted second), the tokens, the steering, the session kinds and the readers are the same. On production (read-only) the
|
|
90
|
+
* existing data a re-measure would repack is 4 headless lines of one person on 2 days, none scheduled, none with a person's
|
|
91
|
+
* second and none under the 60 s floor, so a re-measure would move no figure the passport shows; raising would offer every
|
|
92
|
+
* person a re-measure for nothing. New runs arrive folded from 0.10.33 on.
|
|
87
93
|
*/
|
|
88
94
|
const MEASURE_RULES = 2;
|
|
89
95
|
/** What each measure-rules version changed, in the words the re-measure offer says (one entry per raise, never rewritten). */
|
|
@@ -95,9 +101,9 @@ const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.w
|
|
|
95
101
|
const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
|
|
96
102
|
const HOME_DIR = join(homedir(), ".worktrust");
|
|
97
103
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
98
|
-
const SCRIPTS = ["credential-store.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs"];
|
|
104
|
+
const SCRIPTS = ["credential-store.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "commit-rules.mjs", "git-commits.mjs"];
|
|
99
105
|
/** The modules the scripts import by name from beside them; a download keeps that name. */
|
|
100
|
-
const IMPORTED = new Set(["transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs"]);
|
|
106
|
+
const IMPORTED = new Set(["transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "commit-rules.mjs", "git-commits.mjs"]);
|
|
101
107
|
const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
|
|
102
108
|
const BUNDLED = SCRIPTS.every((name) => existsSync(join(HERE, name)));
|
|
103
109
|
const PLACEHOLDER = `wt_${"0".repeat(43)}`;
|
|
@@ -233,7 +239,7 @@ async function pairByBrowser(host, extra) {
|
|
|
233
239
|
server.close();
|
|
234
240
|
if (!code) fail("no approval arrived in time. Run `worktrust connect` again.");
|
|
235
241
|
const exchange = await post("/api/cli/token", { device_code: secret, code, code_verifier: verifier }).catch(() => null);
|
|
236
|
-
if (exchange?.json?.error === "device_limit") fail("
|
|
242
|
+
if (exchange?.json?.error === "device_limit") fail("The devices your plan allows are already connected. In WorkTrust Sources, disconnect a device (or upgrade to Premium for more), then connect again. Every connected device keeps working and earlier measurements are kept.");
|
|
237
243
|
if (!exchange || exchange.status !== 200 || !exchange.json.token) fail(`the approval could not be exchanged (${exchange?.json?.error ?? "no answer"}). Run \`worktrust connect\` again.`);
|
|
238
244
|
say(` ✓ Approved as "${exchange.json.label}"${exchange.json.account ? ` for the WorkTrust account ${exchange.json.account}` : ""}`);
|
|
239
245
|
if (exchange.json.account) say(" Not your account? Run `npx worktrust disconnect` now and revoke it in WorkTrust.");
|
|
@@ -268,7 +274,7 @@ async function pairByCode(host, extra) {
|
|
|
268
274
|
if (answer.json.account) say(" Not your account? Run `npx worktrust disconnect` now and revoke it in WorkTrust.");
|
|
269
275
|
return paired(answer.json);
|
|
270
276
|
}
|
|
271
|
-
if (answer.json.error === "device_limit") fail("
|
|
277
|
+
if (answer.json.error === "device_limit") fail("The devices your plan allows are already connected. In WorkTrust Sources, disconnect a device (or upgrade to Premium for more), then connect again. Every connected device keeps working and earlier measurements are kept.");
|
|
272
278
|
if (answer.json.error === "slow_down") wait += 2000;
|
|
273
279
|
else if (answer.json.error === "expired_token") fail("the code expired. Run `worktrust connect` again.");
|
|
274
280
|
else if (answer.json.error === "invalid_grant") fail("this pairing was already used. Run `worktrust connect` again.");
|
|
@@ -355,7 +361,7 @@ const previousNote = {
|
|
|
355
361
|
* file; a coupling to another account starts it empty. An unreadable file counts as no agreement at all.
|
|
356
362
|
*/
|
|
357
363
|
const CONSENT_FILE = join(HOME_DIR, "consent.json");
|
|
358
|
-
const CONSENT_NAME = /^(?:door:[^\n,]{1,80}|session-hook|codex-notify|antigravity-stop)$/;
|
|
364
|
+
const CONSENT_NAME = /^(?:door:[^\n,]{1,80}|session-hook|codex-notify|antigravity-stop|git-commits)$/;
|
|
359
365
|
const CONSENT_HOW = new Set(["typed", "flag", "found"]);
|
|
360
366
|
let consentLoaded = null;
|
|
361
367
|
async function consent() {
|
|
@@ -1313,6 +1319,41 @@ async function preserve() {
|
|
|
1313
1319
|
process.exitCode = await new Promise((resolve) => child.on("exit", (code) => resolve(code ?? 1)));
|
|
1314
1320
|
}
|
|
1315
1321
|
|
|
1322
|
+
/**
|
|
1323
|
+
* YOUR OWN COMMITS, MEASURED HERE (`npx worktrust git`, 0.10.34; option C, owner 2026-10-29; docs/GITHUB.md). git-commits.mjs
|
|
1324
|
+
* reads them with git log and makes the GitHub walk's keys of them on this computer; this file lends it the key, the signed
|
|
1325
|
+
* send to the CLI's commits door, the question (Enter is No) and the consent file. Nothing is sent without a typed yes.
|
|
1326
|
+
*/
|
|
1327
|
+
function archiveSalt() {
|
|
1328
|
+
const file = join(HOME_DIR, "archive-salt");
|
|
1329
|
+
try { const kept = readPrivateFile(file)?.trim(); if (/^[0-9a-f]{64}$/.test(kept ?? "")) return kept; } catch { /* first run */ }
|
|
1330
|
+
try { ensureHome(); const made = randomBytes(32).toString("hex"); writePrivateFile(file, `${made}\n`); return made; } catch { return null; }
|
|
1331
|
+
}
|
|
1332
|
+
async function gitCommits() {
|
|
1333
|
+
if (!["git-commits.mjs", "commit-rules.mjs"].every((name) => existsSync(join(HERE, name)))) fail("worktrust git needs the complete WorkTrust npm/Python package. Nothing was read or sent.");
|
|
1334
|
+
const { gitMain } = await import("./git-commits.mjs");
|
|
1335
|
+
const sub = args.slice(args.indexOf("git") + 1).filter((arg) => !arg.startsWith("--"));
|
|
1336
|
+
const local = ["list", "emails", "remove"].includes(sub[0]) || has("dry-run");
|
|
1337
|
+
const key = local ? keyStore.load() : await freshKey();
|
|
1338
|
+
if (!key && !local) fail("this computer is not coupled. Run `npx worktrust` first.");
|
|
1339
|
+
const url = key ? `${new URL(key.url).origin}/api/cli/commits` : null;
|
|
1340
|
+
const send = async (body) => {
|
|
1341
|
+
if (!key || !url) return null;
|
|
1342
|
+
const text = JSON.stringify({ ...body, cli_version: CLI_VERSION });
|
|
1343
|
+
try {
|
|
1344
|
+
const response = await fetch(url, { method: "POST", headers: { "content-type": "application/json", authorization: `Bearer ${key.token}`, "user-agent": `worktrust-cli/${CLI_VERSION}`, ...proof(key.device, url, text) }, body: text, redirect: "error", signal: AbortSignal.timeout(30_000) });
|
|
1345
|
+
if (response.status === 200) return await response.json();
|
|
1346
|
+
// A fair-use refusal (0.10.34, docs/FAIR-USE.md §2): its own sentence, said as it is; the commits stay for the next run.
|
|
1347
|
+
if (response.status === 429 || response.status === 503) {
|
|
1348
|
+
const refusal = await response.json().catch(() => null);
|
|
1349
|
+
if (typeof refusal?.message === "string") return { refused: { message: refusal.message.slice(0, 400), retryAfter: Number(response.headers.get("retry-after")) || null } };
|
|
1350
|
+
}
|
|
1351
|
+
return null;
|
|
1352
|
+
} catch { return null; }
|
|
1353
|
+
};
|
|
1354
|
+
process.exitCode = await gitMain(sub, { say, ask, send, consent: await consent(), salt: archiveSalt(), dryRun: has("dry-run") });
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1316
1357
|
function help() {
|
|
1317
1358
|
say("WorkTrust: couple this computer to your record. Metadata only.");
|
|
1318
1359
|
say();
|
|
@@ -1351,6 +1392,10 @@ function help() {
|
|
|
1351
1392
|
say(" worktrust mod the WorkTrust mod for Claude Code: what it counts, and whether it is on");
|
|
1352
1393
|
say(" install turn it on: counts permission answers, effort levels, context peaks and subagents (asks first)");
|
|
1353
1394
|
say(" remove turn it off and delete what it counted");
|
|
1395
|
+
say(" worktrust git send your own commits, measured on this computer: counts and kinds, never a file name,");
|
|
1396
|
+
say(" a message, code or the commit's id (asks once, with the list of repositories; Enter is No)");
|
|
1397
|
+
say(" add <folder> offer one more repository remove <folder> read nothing more from it");
|
|
1398
|
+
say(" list what is offered and agreed emails add <e-mail> another author e-mail of yours");
|
|
1354
1399
|
say(" worktrust preserve keep your AI history: the report, then the settings and a local archive, each on your yes");
|
|
1355
1400
|
say(" --apply keep them: asks per change, backs the file up first (--yes: no question)");
|
|
1356
1401
|
say(" --archive [dir] a local, metadata-only, hash-chained record of the measured days (~/AI-Evidence)");
|
|
@@ -1368,7 +1413,7 @@ async function main() {
|
|
|
1368
1413
|
if (!moduleArgs || !moduleExecutable || !createCredentialStore) fail("Use the complete WorkTrust package from npm/PyPI or the signed preservation kit; individual scripts cannot run.");
|
|
1369
1414
|
if (Number(process.versions.node.split(".")[0]) < 18) fail("needs Node 18 or later (fetch is built in from 18).");
|
|
1370
1415
|
const AGENT_ENV = ["CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT", "CODEX_SANDBOX", "CODEX_CI", "GEMINI_CLI", "CURSOR_AGENT", "OPENCODE", "CLINE_ACTIVE", "AIDER_CHAT", "ANTIGRAVITY_AGENT", "WINDSURF_AGENT"];
|
|
1371
|
-
const PERSON_ONLY = new Set(["default", "connect", "update", "history", "disconnect", "preserve", "codex", "antigravity", "sources", "web", "import", "orchestration", "mod", "protect-key"]);
|
|
1416
|
+
const PERSON_ONLY = new Set(["default", "connect", "update", "history", "disconnect", "preserve", "codex", "antigravity", "sources", "web", "import", "orchestration", "mod", "protect-key", "git"]);
|
|
1372
1417
|
const agentShell = AGENT_ENV.find((name) => process.env[name] && process.env[name] !== "0");
|
|
1373
1418
|
if (agentShell && PERSON_ONLY.has(command)) {
|
|
1374
1419
|
say();
|
|
@@ -1425,6 +1470,7 @@ else if (command === "disconnect") await disconnect();
|
|
|
1425
1470
|
else if (command === "status") await status();
|
|
1426
1471
|
else if (command === "preserve") await preserve();
|
|
1427
1472
|
else if (command === "mod") await mod();
|
|
1473
|
+
else if (command === "git") await gitCommits();
|
|
1428
1474
|
else if (command === "orchestration") {
|
|
1429
1475
|
if (!["orchestration-report.mjs", "orchestration-evidence.mjs", "orchestration-contract.mjs"].every((name) => existsSync(join(HERE, name)))) fail("Local agent reports need the complete WorkTrust npm/Python package or preservation kit. No file was read or sent.");
|
|
1430
1476
|
const { reportFile } = await import("./orchestration-report.mjs"); reportFile(args.slice(1));
|