@fiducian/recover 0.4.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.
@@ -0,0 +1,14 @@
1
+ declare const repoRoot: string;
2
+ export interface AgentTrioReport {
3
+ scenario: string;
4
+ compromised_agent: string;
5
+ compromised_delta: string;
6
+ recovered: boolean;
7
+ poison_visible_before: boolean;
8
+ poison_visible_after: boolean;
9
+ }
10
+ /** Run `fiducia demo` in recovertrust workspace (requires Rust build). */
11
+ export declare function runDemo(cwd?: string): AgentTrioReport;
12
+ /** Spawn fiducia CLI with args; returns stdout. */
13
+ export declare function fiducia(args: string[], dir: string): string;
14
+ export { repoRoot as recoverWorkspaceRoot };
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { fileURLToPath } from "node:url";
3
+ import { dirname, join } from "node:path";
4
+ const repoRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
5
+ /** Run `fiducia demo` in recovertrust workspace (requires Rust build). */
6
+ export function runDemo(cwd = join(repoRoot, "recovertrust")) {
7
+ const proc = spawnSync("cargo", ["run", "-p", "fiducia-recover", "--bin", "fiducia", "--", "demo"], { cwd, encoding: "utf8", shell: process.platform === "win32" });
8
+ if (proc.status !== 0) {
9
+ throw new Error(proc.stderr || proc.stdout || "fiducia demo failed");
10
+ }
11
+ const line = proc.stdout.split("\n").find((l) => l.trim().startsWith("{"));
12
+ if (!line)
13
+ throw new Error("no JSON from fiducia demo");
14
+ const parsed = JSON.parse(line);
15
+ return parsed.demo;
16
+ }
17
+ /** Spawn fiducia CLI with args; returns stdout. */
18
+ export function fiducia(args, dir) {
19
+ const proc = spawnSync("cargo", ["run", "-q", "-p", "fiducia-recover", "--bin", "fiducia", "--", ...args], { cwd: join(repoRoot, "recovertrust"), encoding: "utf8", shell: process.platform === "win32" });
20
+ if (proc.status !== 0)
21
+ throw new Error(proc.stderr || proc.stdout);
22
+ return proc.stdout;
23
+ }
24
+ export { repoRoot as recoverWorkspaceRoot };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@fiducian/recover",
3
+ "version": "0.4.0",
4
+ "description": "TypeScript helpers for Fiducian Recover — post-compromise shared JSON",
5
+ "license": "AGPL-3.0-or-later",
6
+ "keywords": ["fiducia", "recover", "melda", "post-compromise", "agents"],
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/thesnmc/Fiducian.git",
10
+ "directory": "trace/packages/recover"
11
+ },
12
+ "publishConfig": { "access": "public" },
13
+ "type": "module",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": { ".": "./dist/index.js" },
17
+ "files": ["dist"],
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^22.10.0",
24
+ "typescript": "^5.7.2"
25
+ }
26
+ }