@verax-ai/body 0.9.0 → 0.10.0
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 +7 -4
- package/dist/canary-cli.d.ts +5 -0
- package/dist/canary-cli.js +213 -0
- package/dist/cli.js +56 -2
- package/dist/config.d.ts +6 -0
- package/dist/config.js +1 -0
- package/dist/demo.js +3 -0
- package/dist/doctor.d.ts +11 -0
- package/dist/doctor.js +76 -2
- package/dist/downstream-pin.js +11 -1
- package/dist/downstream.d.ts +51 -0
- package/dist/downstream.js +329 -4
- package/dist/explain-cli.d.ts +5 -0
- package/dist/explain-cli.js +132 -0
- package/dist/init-local.d.ts +5 -0
- package/dist/init-local.js +1 -0
- package/dist/install.js +1 -1
- package/dist/policy-cli.d.ts +8 -0
- package/dist/policy-cli.js +169 -0
- package/dist/policy-rehearsal.d.ts +39 -0
- package/dist/policy-rehearsal.js +512 -0
- package/dist/server.js +38 -5
- package/dist/taint-cli.d.ts +5 -0
- package/dist/taint-cli.js +80 -0
- package/dist/wiring.d.ts +5 -0
- package/dist/wiring.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `verax taint clear` appends one line. It does not open the ledger and does
|
|
3
|
+
* not sign anything: the body copies the line into a signed record on its
|
|
4
|
+
* next sync. A tool call has no path here.
|
|
5
|
+
*/
|
|
6
|
+
import { readdirSync, statSync } from "node:fs";
|
|
7
|
+
import { userInfo } from "node:os";
|
|
8
|
+
import { appendTaintClearLine, terminalText } from "@verax-ai/proxy";
|
|
9
|
+
const USAGE = `usage: verax taint clear <stateDir> --session <jti>
|
|
10
|
+
|
|
11
|
+
Clears that token's session taint. The body signs the clear the next time
|
|
12
|
+
it syncs. A tool call cannot clear a session.
|
|
13
|
+
`;
|
|
14
|
+
function option(argv, name) {
|
|
15
|
+
const i = argv.indexOf(name);
|
|
16
|
+
if (i < 0)
|
|
17
|
+
return null;
|
|
18
|
+
const value = argv[i + 1];
|
|
19
|
+
if (value === undefined || value.startsWith("-"))
|
|
20
|
+
return null;
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function stateProblem(stateDir) {
|
|
24
|
+
let entries;
|
|
25
|
+
try {
|
|
26
|
+
if (!statSync(stateDir).isDirectory())
|
|
27
|
+
return "not a directory";
|
|
28
|
+
entries = readdirSync(stateDir);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
const code = err.code;
|
|
32
|
+
if (code === "ENOENT")
|
|
33
|
+
return "no such directory";
|
|
34
|
+
return "not a directory";
|
|
35
|
+
}
|
|
36
|
+
const names = new Set(entries);
|
|
37
|
+
if (names.has("decisions.jsonl") || names.has("ledger.lock") || names.has("pieces") || names.has("halted")) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return "no ledger files there";
|
|
41
|
+
}
|
|
42
|
+
function cliUser() {
|
|
43
|
+
try {
|
|
44
|
+
return userInfo().username || "unknown";
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return "unknown";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function runTaint(argv, stdout, stderr) {
|
|
51
|
+
if (argv.length === 0 || argv.includes("--help") || argv.includes("-h")) {
|
|
52
|
+
stdout.write(USAGE);
|
|
53
|
+
return argv.includes("--help") || argv.includes("-h") ? 0 : 78;
|
|
54
|
+
}
|
|
55
|
+
if (argv[0] !== "clear") {
|
|
56
|
+
stderr.write(USAGE);
|
|
57
|
+
return 64;
|
|
58
|
+
}
|
|
59
|
+
const session = option(argv, "--session");
|
|
60
|
+
const stateDir = argv.slice(1).find((arg) => arg !== "--session" && arg !== session);
|
|
61
|
+
if (!stateDir || !session || stateDir.startsWith("-")) {
|
|
62
|
+
stderr.write(USAGE);
|
|
63
|
+
return 78;
|
|
64
|
+
}
|
|
65
|
+
const problem = stateProblem(stateDir);
|
|
66
|
+
if (problem) {
|
|
67
|
+
stderr.write(`taint-clear-failed: ${problem}\n`);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
appendTaintClearLine(stateDir, { session, by: cliUser(), atMs: Date.now() });
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
const message = err instanceof Error ? err.message : "taint-clear-failed";
|
|
75
|
+
stderr.write(`taint-clear-failed: ${terminalText(message.replace(/[\r\n]+/g, " ").slice(0, 300))}\n`);
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
stdout.write("taint-clear appended\n");
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
package/dist/wiring.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ export declare function createBodyServices(opts: {
|
|
|
37
37
|
now?: () => number;
|
|
38
38
|
nonce?: () => string;
|
|
39
39
|
extraTools?: readonly ExtraTool[];
|
|
40
|
+
/**
|
|
41
|
+
* Labels from the downstream document, keyed by the prefixed tool name.
|
|
42
|
+
* A key that is present replaces the unlabelled-downstream default.
|
|
43
|
+
*/
|
|
44
|
+
downstreamLabels?: Readonly<Record<string, readonly ("reads-untrusted" | "egress")[]>>;
|
|
40
45
|
keysDir?: string;
|
|
41
46
|
headDir?: string;
|
|
42
47
|
alarmWebhookUrl?: string;
|
package/dist/wiring.js
CHANGED
|
@@ -167,6 +167,8 @@ export function createBodyServices(opts) {
|
|
|
167
167
|
nonce,
|
|
168
168
|
inner,
|
|
169
169
|
resolveInput: (id, principal) => readMemoryMeta(opts.stateDir, id, principal, store, onIntegrity),
|
|
170
|
+
...(extraNames.length > 0 ? { downstreamTools: new Set(extraNames) } : {}),
|
|
171
|
+
...(opts.downstreamLabels !== undefined ? { downstreamLabels: opts.downstreamLabels } : {}),
|
|
170
172
|
checkTenantMismatch: async (call, principal) => {
|
|
171
173
|
if (call.name === "memory.get") {
|
|
172
174
|
if (memoryHistoryUnavailable(opts.stateDir, store))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verax-ai/body",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@cedulon/cose": "0.16.0",
|
|
27
27
|
"@cedulon/effect-extract": "0.16.0",
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
29
|
-
"@verax-ai/inventory": "^0.
|
|
30
|
-
"@verax-ai/proxy": "^0.
|
|
29
|
+
"@verax-ai/inventory": "^0.10.0",
|
|
30
|
+
"@verax-ai/proxy": "^0.10.0",
|
|
31
31
|
"jose": "^6.2.13"
|
|
32
32
|
},
|
|
33
33
|
"description": "VERAX body: an MCP server that decides, records and proves what an agent did.",
|