fascicle 0.8.1 → 0.8.11
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/CHANGELOG.md +106 -0
- package/README.md +35 -4
- package/dist/{tee-B-MeNi7d.js → adapters-DdUx-_b3.js} +120 -25
- package/dist/adapters-DdUx-_b3.js.map +1 -0
- package/dist/adapters.d.ts +17 -9
- package/dist/adapters.js +2 -78
- package/dist/core-dRSAN1Q2.js +1846 -0
- package/dist/core-dRSAN1Q2.js.map +1 -0
- package/dist/index-CEj6hY9z.d.ts +856 -0
- package/dist/index-Cy7EUeiP.d.ts +430 -0
- package/dist/index.d.ts +24 -452
- package/dist/index.js +116 -1918
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +78 -0
- package/dist/mcp.js +315 -0
- package/dist/mcp.js.map +1 -0
- package/dist/static/viewer.html +1 -1
- package/dist/stdio.d.ts +38 -0
- package/dist/stdio.js +191 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +60 -24
- package/dist/adapters.js.map +0 -1
- package/dist/index-BjOnbuc9.d.ts +0 -710
- package/dist/tee-B-MeNi7d.js.map +0 -1
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { T as run } from "./core-dRSAN1Q2.js";
|
|
2
|
+
import { r as stderr_logger } from "./adapters-DdUx-_b3.js";
|
|
3
|
+
import { text } from "node:stream/consumers";
|
|
4
|
+
//#region src/stdio/execute_stdio.ts
|
|
5
|
+
async function execute_stdio(flow, options, io) {
|
|
6
|
+
const produced = await produce_output(flow, options, io);
|
|
7
|
+
const dispose_failure = await dispose_engine(options.engine);
|
|
8
|
+
if (produced.kind === "failed") return {
|
|
9
|
+
code: produced.code,
|
|
10
|
+
failure: produced.failure
|
|
11
|
+
};
|
|
12
|
+
if (dispose_failure !== null) return {
|
|
13
|
+
code: 1,
|
|
14
|
+
failure: dispose_failure
|
|
15
|
+
};
|
|
16
|
+
try {
|
|
17
|
+
await io.write_output(`${produced.json}\n`);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
return {
|
|
20
|
+
code: 1,
|
|
21
|
+
failure: make_failure("write", err)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return { code: 0 };
|
|
25
|
+
}
|
|
26
|
+
async function produce_output(flow, options, io) {
|
|
27
|
+
let raw;
|
|
28
|
+
try {
|
|
29
|
+
raw = await io.read_input();
|
|
30
|
+
} catch (err) {
|
|
31
|
+
return {
|
|
32
|
+
kind: "failed",
|
|
33
|
+
code: 2,
|
|
34
|
+
failure: make_failure("read", err)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(raw);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
return {
|
|
42
|
+
kind: "failed",
|
|
43
|
+
code: 2,
|
|
44
|
+
failure: make_failure("parse", err)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
let input;
|
|
48
|
+
if (options.input_schema !== void 0) {
|
|
49
|
+
const checked = options.input_schema.safeParse(parsed);
|
|
50
|
+
if (!checked.success) return {
|
|
51
|
+
kind: "failed",
|
|
52
|
+
code: 2,
|
|
53
|
+
failure: {
|
|
54
|
+
error: "input failed schema validation",
|
|
55
|
+
stage: "validate_input",
|
|
56
|
+
cause: to_json_safe(checked.error.issues)
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
input = checked.data;
|
|
60
|
+
} else input = parsed;
|
|
61
|
+
const trajectory = options.trajectory ?? stderr_logger({ stream: io.error_stream });
|
|
62
|
+
let result;
|
|
63
|
+
try {
|
|
64
|
+
result = await run(flow, input, {
|
|
65
|
+
trajectory,
|
|
66
|
+
...options.abort !== void 0 ? { abort: options.abort } : {}
|
|
67
|
+
});
|
|
68
|
+
} catch (err) {
|
|
69
|
+
return {
|
|
70
|
+
kind: "failed",
|
|
71
|
+
code: 1,
|
|
72
|
+
failure: make_failure("run", err)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
let output = result;
|
|
76
|
+
if (options.output_schema !== void 0) {
|
|
77
|
+
const checked = options.output_schema.safeParse(result);
|
|
78
|
+
if (!checked.success) return {
|
|
79
|
+
kind: "failed",
|
|
80
|
+
code: 2,
|
|
81
|
+
failure: {
|
|
82
|
+
error: "flow result failed schema validation",
|
|
83
|
+
stage: "validate_output",
|
|
84
|
+
cause: to_json_safe(checked.error.issues)
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
output = checked.data;
|
|
88
|
+
}
|
|
89
|
+
let json;
|
|
90
|
+
try {
|
|
91
|
+
json = JSON.stringify(output);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return {
|
|
94
|
+
kind: "failed",
|
|
95
|
+
code: 2,
|
|
96
|
+
failure: make_failure("serialize", err)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (json === void 0) return {
|
|
100
|
+
kind: "failed",
|
|
101
|
+
code: 2,
|
|
102
|
+
failure: {
|
|
103
|
+
error: "flow result is not JSON-serializable",
|
|
104
|
+
stage: "serialize"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
kind: "ok",
|
|
109
|
+
json
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function dispose_engine(engine) {
|
|
113
|
+
if (engine === void 0) return null;
|
|
114
|
+
try {
|
|
115
|
+
await engine.dispose();
|
|
116
|
+
return null;
|
|
117
|
+
} catch (err) {
|
|
118
|
+
return make_failure("dispose", err);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function make_failure(stage, err) {
|
|
122
|
+
const cause = safe_cause(err);
|
|
123
|
+
return {
|
|
124
|
+
error: err instanceof Error ? err.message : String(err),
|
|
125
|
+
stage,
|
|
126
|
+
...cause !== void 0 ? { cause } : {}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function safe_cause(err) {
|
|
130
|
+
if (err instanceof Error) {
|
|
131
|
+
const path = Reflect.get(err, "path");
|
|
132
|
+
return {
|
|
133
|
+
name: err.name,
|
|
134
|
+
message: err.message,
|
|
135
|
+
...Array.isArray(path) ? { path: to_json_safe(path) } : {}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return to_json_safe(err);
|
|
139
|
+
}
|
|
140
|
+
function to_json_safe(value) {
|
|
141
|
+
try {
|
|
142
|
+
const json = JSON.stringify(value);
|
|
143
|
+
if (json === void 0) return void 0;
|
|
144
|
+
return JSON.parse(json);
|
|
145
|
+
} catch {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/stdio/run_stdio.ts
|
|
151
|
+
/**
|
|
152
|
+
* Process glue for the stdio agent contract.
|
|
153
|
+
*
|
|
154
|
+
* Binds `execute_stdio` to the real process: stdin to EOF in, exactly one JSON
|
|
155
|
+
* document on stdout out, trajectory on stderr, exit code as the verdict
|
|
156
|
+
* (0 = result on stdout is authoritative, 1 = flow failure, 2 = contract
|
|
157
|
+
* violation). On a non-zero exit the LAST stderr line is the `StdioFailure`
|
|
158
|
+
* as a single JSON object, so parents that want machine-readable detail take
|
|
159
|
+
* the tail line.
|
|
160
|
+
*
|
|
161
|
+
* Final writes await the write callback before `process.exit`: on pipes,
|
|
162
|
+
* exiting with buffered data truncates it, and a large JSON result is exactly
|
|
163
|
+
* the risk case. Signal handlers stay at the runner's default (installed): a
|
|
164
|
+
* single-shot child must die when the parent forwards SIGINT.
|
|
165
|
+
*
|
|
166
|
+
* Excluded from mutation testing as process/IO glue (see stryker.config.mjs);
|
|
167
|
+
* the spawn-based contract tests in `__tests__/e2e/` exercise it for real.
|
|
168
|
+
*/
|
|
169
|
+
async function run_stdio(flow, options = {}) {
|
|
170
|
+
const outcome = await execute_stdio(flow, options, {
|
|
171
|
+
read_input: () => text(process.stdin),
|
|
172
|
+
write_output: (chunk) => write_flushed(process.stdout, chunk),
|
|
173
|
+
error_stream: process.stderr
|
|
174
|
+
});
|
|
175
|
+
if (outcome.code !== 0) try {
|
|
176
|
+
await write_flushed(process.stderr, `${JSON.stringify(outcome.failure)}\n`);
|
|
177
|
+
} catch {}
|
|
178
|
+
process.exit(outcome.code);
|
|
179
|
+
}
|
|
180
|
+
function write_flushed(stream, chunk) {
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
stream.write(chunk, (err) => {
|
|
183
|
+
if (err) reject(err);
|
|
184
|
+
else resolve();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
export { execute_stdio, run_stdio };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","names":[],"sources":["../src/stdio/execute_stdio.ts","../src/stdio/run_stdio.ts"],"sourcesContent":["/**\n * The stdio agent contract, minus the process.\n *\n * `execute_stdio` is everything `run_stdio` does (read, parse, validate, run,\n * validate, serialize, dispose), expressed over an injected `StdioIo` and\n * returning a `StdioOutcome` instead of touching `process.*` or exiting. The\n * split keeps the contract's branching unit-testable; the thin glue in\n * `run_stdio.ts` owns the real streams and the exit.\n *\n * The governing invariant: code 0 if and only if stdout carries an\n * authoritative result. That is why the engine is disposed before the output\n * is written (a teardown failure on the success path yields code 1 and no\n * stdout) and why every failure class short-circuits before `write_output`.\n * Code 1 means the flow did not produce a result (including a forwarded\n * SIGINT/SIGTERM aborting the run, or a failed delivery); code 2 means the\n * contract itself was violated (unparseable stdin, schema mismatch in either\n * direction, unserializable result).\n */\n\nimport type { z } from 'zod'\nimport { run } from '#core'\nimport type { Step, TrajectoryLogger } from '#core'\nimport { stderr_logger } from '#adapters'\n\nexport type RunStdioOptions<i, o> = {\n readonly input_schema?: z.ZodType<i>\n readonly output_schema?: z.ZodType<o>\n // Structural on purpose: anything with an async dispose qualifies, and the\n // stdio module never imports the engine layer.\n readonly engine?: { readonly dispose: () => Promise<void> }\n readonly trajectory?: TrajectoryLogger\n readonly abort?: AbortSignal\n}\n\nexport type StdioFailure = {\n readonly error: string\n readonly stage?:\n | 'read'\n | 'parse'\n | 'validate_input'\n | 'run'\n | 'validate_output'\n | 'serialize'\n | 'write'\n | 'dispose'\n readonly cause?: unknown\n}\n\nexport type StdioOutcome =\n | { readonly code: 0 }\n | { readonly code: 1 | 2; readonly failure: StdioFailure }\n\nexport type StdioIo = {\n readonly read_input: () => Promise<string>\n // Resolves once the bytes are flushed to the OS, so the caller may exit.\n readonly write_output: (text: string) => Promise<void>\n readonly error_stream: { write(chunk: string): unknown }\n}\n\nexport async function execute_stdio<i, o>(\n flow: Step<i, o>,\n options: RunStdioOptions<i, o>,\n io: StdioIo,\n): Promise<StdioOutcome> {\n const produced = await produce_output(flow, options, io)\n const dispose_failure = await dispose_engine(options.engine)\n if (produced.kind === 'failed') return { code: produced.code, failure: produced.failure }\n if (dispose_failure !== null) return { code: 1, failure: dispose_failure }\n try {\n await io.write_output(`${produced.json}\\n`)\n } catch (err) {\n return { code: 1, failure: make_failure('write', err) }\n }\n return { code: 0 }\n}\n\ntype ProduceResult =\n | { readonly kind: 'ok'; readonly json: string }\n | { readonly kind: 'failed'; readonly code: 1 | 2; readonly failure: StdioFailure }\n\nasync function produce_output<i, o>(\n flow: Step<i, o>,\n options: RunStdioOptions<i, o>,\n io: StdioIo,\n): Promise<ProduceResult> {\n let raw: string\n try {\n raw = await io.read_input()\n } catch (err) {\n return { kind: 'failed', code: 2, failure: make_failure('read', err) }\n }\n\n let parsed: unknown\n try {\n parsed = JSON.parse(raw)\n } catch (err) {\n return { kind: 'failed', code: 2, failure: make_failure('parse', err) }\n }\n\n let input: i\n if (options.input_schema !== undefined) {\n const checked = options.input_schema.safeParse(parsed)\n if (!checked.success) {\n return {\n kind: 'failed',\n code: 2,\n failure: {\n error: 'input failed schema validation',\n stage: 'validate_input',\n cause: to_json_safe(checked.error.issues),\n },\n }\n }\n input = checked.data\n } else {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n input = parsed as i\n }\n\n const trajectory = options.trajectory ?? stderr_logger({ stream: io.error_stream })\n\n let result: o\n try {\n result = await run(flow, input, {\n trajectory,\n ...(options.abort !== undefined ? { abort: options.abort } : {}),\n })\n } catch (err) {\n return { kind: 'failed', code: 1, failure: make_failure('run', err) }\n }\n\n let output: unknown = result\n if (options.output_schema !== undefined) {\n const checked = options.output_schema.safeParse(result)\n if (!checked.success) {\n return {\n kind: 'failed',\n code: 2,\n failure: {\n error: 'flow result failed schema validation',\n stage: 'validate_output',\n cause: to_json_safe(checked.error.issues),\n },\n }\n }\n output = checked.data\n }\n\n let json: string | undefined\n try {\n json = JSON.stringify(output)\n } catch (err) {\n return { kind: 'failed', code: 2, failure: make_failure('serialize', err) }\n }\n if (json === undefined) {\n return {\n kind: 'failed',\n code: 2,\n failure: { error: 'flow result is not JSON-serializable', stage: 'serialize' },\n }\n }\n return { kind: 'ok', json }\n}\n\nasync function dispose_engine(\n engine: RunStdioOptions<never, never>['engine'],\n): Promise<StdioFailure | null> {\n if (engine === undefined) return null\n try {\n await engine.dispose()\n return null\n } catch (err) {\n return make_failure('dispose', err)\n }\n}\n\nfunction make_failure(stage: NonNullable<StdioFailure['stage']>, err: unknown): StdioFailure {\n const cause = safe_cause(err)\n return {\n error: err instanceof Error ? err.message : String(err),\n stage,\n ...(cause !== undefined ? { cause } : {}),\n }\n}\n\nfunction safe_cause(err: unknown): unknown {\n if (err instanceof Error) {\n const path = Reflect.get(err, 'path')\n return {\n name: err.name,\n message: err.message,\n ...(Array.isArray(path) ? { path: to_json_safe(path) } : {}),\n }\n }\n return to_json_safe(err)\n}\n\n// The glue serializes the failure with JSON.stringify; cause must never make\n// that throw (circular refs, BigInt) or silently vanish (undefined-only).\nfunction to_json_safe(value: unknown): unknown {\n try {\n const json = JSON.stringify(value)\n if (json === undefined) return undefined\n return JSON.parse(json) as unknown\n } catch {\n return undefined\n }\n}\n","/**\n * Process glue for the stdio agent contract.\n *\n * Binds `execute_stdio` to the real process: stdin to EOF in, exactly one JSON\n * document on stdout out, trajectory on stderr, exit code as the verdict\n * (0 = result on stdout is authoritative, 1 = flow failure, 2 = contract\n * violation). On a non-zero exit the LAST stderr line is the `StdioFailure`\n * as a single JSON object, so parents that want machine-readable detail take\n * the tail line.\n *\n * Final writes await the write callback before `process.exit`: on pipes,\n * exiting with buffered data truncates it, and a large JSON result is exactly\n * the risk case. Signal handlers stay at the runner's default (installed): a\n * single-shot child must die when the parent forwards SIGINT.\n *\n * Excluded from mutation testing as process/IO glue (see stryker.config.mjs);\n * the spawn-based contract tests in `__tests__/e2e/` exercise it for real.\n */\n\nimport { text } from 'node:stream/consumers'\nimport type { Step } from '#core'\nimport { execute_stdio } from './execute_stdio.js'\nimport type { RunStdioOptions } from './execute_stdio.js'\n\nexport async function run_stdio<i, o>(\n flow: Step<i, o>,\n options: RunStdioOptions<i, o> = {},\n): Promise<void> {\n const outcome = await execute_stdio(flow, options, {\n read_input: () => text(process.stdin),\n write_output: (chunk) => write_flushed(process.stdout, chunk),\n error_stream: process.stderr,\n })\n if (outcome.code !== 0) {\n try {\n await write_flushed(process.stderr, `${JSON.stringify(outcome.failure)}\\n`)\n } catch {\n // stderr is gone; the exit code still carries the verdict.\n }\n }\n process.exit(outcome.code)\n}\n\nfunction write_flushed(stream: NodeJS.WriteStream, chunk: string): Promise<void> {\n return new Promise((resolve, reject) => {\n stream.write(chunk, (err) => {\n if (err) reject(err)\n else resolve()\n })\n })\n}\n"],"mappings":";;;;AA2DA,eAAsB,cACpB,MACA,SACA,IACuB;CACvB,MAAM,WAAW,MAAM,eAAe,MAAM,SAAS,GAAG;CACxD,MAAM,kBAAkB,MAAM,eAAe,QAAQ,OAAO;AAC5D,KAAI,SAAS,SAAS,SAAU,QAAO;EAAE,MAAM,SAAS;EAAM,SAAS,SAAS;EAAS;AACzF,KAAI,oBAAoB,KAAM,QAAO;EAAE,MAAM;EAAG,SAAS;EAAiB;AAC1E,KAAI;AACF,QAAM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K,QAAQ,MAAM;EACrC,eAAe,UAAU,cAAc,QAAQ,QAAQ,MAAM;EAC7D,cAAc,QAAQ;EACvB,CAAC;AACF,KAAI,QAAQ,SAAS,EACnB,KAAI;AACF,QAAM,cAAc,QAAQ,QAAQ,GAAG,KAAK,UAAU,QAAQ,QAAQ,CAAC,IAAI;SACrE;AAIV,SAAQ,KAAK,QAAQ,KAAK;;AAG5B,SAAS,cAAc,QAA4B,OAA8B;AAC/E,QAAO,IAAI,SAAS,SAAS,WAAW;AACtC,SAAO,MAAM,QAAQ,QAAQ;AAC3B,OAAI,IAAK,QAAO,IAAI;OACf,UAAS;IACd;GACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fascicle",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.8.11",
|
|
4
|
+
"description": "Compose agents like plain values. A TypeScript toolkit that wires LLM calls, tools, and functions into typed steps over eight providers. No framework, no ambient state.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"agentic",
|
|
8
|
+
"multi-agent",
|
|
9
|
+
"ai",
|
|
10
|
+
"llm",
|
|
11
|
+
"workflow",
|
|
12
|
+
"pipeline",
|
|
13
|
+
"orchestration",
|
|
14
|
+
"tool-calling",
|
|
15
|
+
"harness",
|
|
16
|
+
"streaming",
|
|
17
|
+
"observability",
|
|
18
|
+
"typescript",
|
|
19
|
+
"composable",
|
|
20
|
+
"ai-sdk",
|
|
21
|
+
"vercel-ai-sdk",
|
|
22
|
+
"anthropic",
|
|
23
|
+
"openai",
|
|
24
|
+
"gemini",
|
|
25
|
+
"bedrock",
|
|
26
|
+
"openrouter",
|
|
27
|
+
"ollama",
|
|
28
|
+
"lmstudio"
|
|
29
|
+
],
|
|
5
30
|
"license": "Apache-2.0",
|
|
6
31
|
"author": {
|
|
7
32
|
"name": "Rob McLarty",
|
|
@@ -13,7 +38,6 @@
|
|
|
13
38
|
"node": ">=24.0.0",
|
|
14
39
|
"pnpm": ">=10.13.0"
|
|
15
40
|
},
|
|
16
|
-
"packageManager": "pnpm@11.1.2",
|
|
17
41
|
"main": "./dist/index.js",
|
|
18
42
|
"module": "./dist/index.js",
|
|
19
43
|
"types": "./dist/index.d.ts",
|
|
@@ -25,16 +49,24 @@
|
|
|
25
49
|
"./adapters": {
|
|
26
50
|
"types": "./dist/adapters.d.ts",
|
|
27
51
|
"import": "./dist/adapters.js"
|
|
52
|
+
},
|
|
53
|
+
"./mcp": {
|
|
54
|
+
"types": "./dist/mcp.d.ts",
|
|
55
|
+
"import": "./dist/mcp.js"
|
|
56
|
+
},
|
|
57
|
+
"./stdio": {
|
|
58
|
+
"types": "./dist/stdio.d.ts",
|
|
59
|
+
"import": "./dist/stdio.js"
|
|
28
60
|
}
|
|
29
61
|
},
|
|
30
62
|
"imports": {
|
|
31
63
|
"#core": "./src/core/index.ts",
|
|
32
64
|
"#engine": "./src/engine/index.ts",
|
|
33
65
|
"#composites": "./src/composites/index.ts",
|
|
34
|
-
"#
|
|
35
|
-
"#stores": "./src/stores/index.ts",
|
|
66
|
+
"#adapters": "./src/adapters/index.ts",
|
|
36
67
|
"#viewer": "./src/viewer/index.ts",
|
|
37
|
-
"#agents": "./src/agents/index.ts"
|
|
68
|
+
"#agents": "./src/agents/index.ts",
|
|
69
|
+
"#stdio": "./src/stdio/index.ts"
|
|
38
70
|
},
|
|
39
71
|
"bin": {
|
|
40
72
|
"fascicle-viewer": "./dist/bin/fascicle-viewer.js"
|
|
@@ -49,35 +81,20 @@
|
|
|
49
81
|
"type": "git",
|
|
50
82
|
"url": "git+https://github.com/robmclarty/fascicle.git"
|
|
51
83
|
},
|
|
52
|
-
"homepage": "https://github.
|
|
84
|
+
"homepage": "https://robmclarty.github.io/fascicle/",
|
|
53
85
|
"bugs": {
|
|
54
86
|
"url": "https://github.com/robmclarty/fascicle/issues"
|
|
55
87
|
},
|
|
56
88
|
"publishConfig": {
|
|
57
89
|
"access": "public"
|
|
58
90
|
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "node scripts/build.mjs",
|
|
61
|
-
"check": "node scripts/check.mjs",
|
|
62
|
-
"check:all": "node scripts/check.mjs --all",
|
|
63
|
-
"check:json": "node scripts/check.mjs --json",
|
|
64
|
-
"check:bail": "node scripts/check.mjs --bail",
|
|
65
|
-
"check:fix": "pnpm exec oxlint --type-aware --fix && node scripts/strip-semicolons.mjs && pnpm exec fallow fix",
|
|
66
|
-
"check:mutation": "stryker run",
|
|
67
|
-
"check:publish": "node scripts/check-publish.mjs",
|
|
68
|
-
"check:security": "pnpm audit --audit-level=high",
|
|
69
|
-
"prepublishOnly": "pnpm check && pnpm build && pnpm check:publish",
|
|
70
|
-
"test": "vitest run",
|
|
71
|
-
"test:watch": "vitest",
|
|
72
|
-
"types": "tsc --noEmit",
|
|
73
|
-
"fascicle-viewer": "tsx src/viewer/cli.ts"
|
|
74
|
-
},
|
|
75
91
|
"peerDependencies": {
|
|
76
92
|
"@ai-sdk/amazon-bedrock": "^3.0.0",
|
|
77
93
|
"@ai-sdk/anthropic": "^3.0.0",
|
|
78
94
|
"@ai-sdk/google": "^3.0.0",
|
|
79
95
|
"@ai-sdk/openai": "^3.0.0",
|
|
80
96
|
"@ai-sdk/openai-compatible": "^2.0.0",
|
|
97
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
81
98
|
"@openrouter/ai-sdk-provider": "^2.0.0",
|
|
82
99
|
"ai": "^6.0.0",
|
|
83
100
|
"ai-sdk-ollama": "^3.0.0",
|
|
@@ -99,6 +116,9 @@
|
|
|
99
116
|
"@ai-sdk/openai-compatible": {
|
|
100
117
|
"optional": true
|
|
101
118
|
},
|
|
119
|
+
"@modelcontextprotocol/sdk": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
102
122
|
"@openrouter/ai-sdk-provider": {
|
|
103
123
|
"optional": true
|
|
104
124
|
},
|
|
@@ -109,6 +129,7 @@
|
|
|
109
129
|
"devDependencies": {
|
|
110
130
|
"@arethetypeswrong/cli": "0.18.2",
|
|
111
131
|
"@ast-grep/cli": "0.42.1",
|
|
132
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
112
133
|
"@stryker-mutator/core": "9.6.1",
|
|
113
134
|
"@stryker-mutator/vitest-runner": "9.6.1",
|
|
114
135
|
"@types/node": "24.12.2",
|
|
@@ -123,5 +144,20 @@
|
|
|
123
144
|
"typescript": "6.0.3",
|
|
124
145
|
"vitest": "4.1.4",
|
|
125
146
|
"zod": "4.3.6"
|
|
147
|
+
},
|
|
148
|
+
"scripts": {
|
|
149
|
+
"build": "node scripts/build.mjs",
|
|
150
|
+
"check": "node scripts/check.mjs",
|
|
151
|
+
"check:all": "node scripts/check.mjs --all",
|
|
152
|
+
"check:json": "node scripts/check.mjs --json",
|
|
153
|
+
"check:bail": "node scripts/check.mjs --bail",
|
|
154
|
+
"check:fix": "pnpm exec oxlint --type-aware --fix && node scripts/strip-semicolons.mjs && pnpm exec fallow fix",
|
|
155
|
+
"check:mutation": "stryker run",
|
|
156
|
+
"check:publish": "node scripts/check-publish.mjs",
|
|
157
|
+
"check:security": "pnpm audit --audit-level=high",
|
|
158
|
+
"test": "vitest run",
|
|
159
|
+
"test:watch": "vitest",
|
|
160
|
+
"types": "tsc --noEmit",
|
|
161
|
+
"fascicle-viewer": "tsx src/viewer/cli.ts"
|
|
126
162
|
}
|
|
127
|
-
}
|
|
163
|
+
}
|
package/dist/adapters.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","names":[],"sources":["../src/observability/noop.ts","../src/stores/filesystem.ts"],"sourcesContent":["/**\n * No-op trajectory logger.\n *\n * Satisfies `TrajectoryLogger` from `core` without emitting any\n * output. Used as the default when no logger is supplied to `run(...)` and as\n * a cheap fallback in tests that do not care about trajectory output.\n */\n\nimport { randomUUID } from 'node:crypto'\nimport type { TrajectoryLogger } from '#core'\n\nexport function noop_logger(): TrajectoryLogger {\n return {\n record: () => {},\n start_span: (name) => `${name}:${randomUUID().slice(0, 8)}`,\n end_span: () => {},\n }\n}\n","/**\n * Filesystem-backed checkpoint store.\n *\n * Satisfies `CheckpointStore` from `core`. Each key is stored as\n * a JSON file under the configured root directory. Writes are all-or-nothing:\n * values are written to a temporary sibling file and then atomically renamed\n * into place, so an interrupted write never leaves a partially-written file\n * at the target key (spec.md §6.3, §6.8). On `get`, a missing file, a partial\n * temp file that is not atomically renamed, or a JSON parse failure each read\n * as a cache miss (returning `null`) rather than an error.\n *\n * Paths are accepted at construction; the store never reads `process.env`.\n */\n\nimport { createHash, randomUUID } from 'node:crypto'\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { CheckpointStore } from '#core'\n\nexport type FilesystemStoreOptions = {\n readonly root_dir: string\n}\n\nfunction safe_filename(key: string): string {\n const hash = createHash('sha256').update(key).digest('hex').slice(0, 12)\n const slug = key.replace(/[^a-zA-Z0-9._-]/g, '_').slice(0, 64)\n return `${slug}.${hash}.json`\n}\n\nexport function filesystem_store(options: FilesystemStoreOptions): CheckpointStore {\n const { root_dir } = options\n\n const ensure_root = async (): Promise<void> => {\n await mkdir(root_dir, { recursive: true })\n }\n\n const path_for = (key: string): string => join(root_dir, safe_filename(key))\n\n const get = async (key: string): Promise<unknown> => {\n const path = path_for(key)\n let raw: string\n try {\n raw = await readFile(path, 'utf8')\n } catch {\n return null\n }\n try {\n return JSON.parse(raw) as unknown\n } catch {\n return null\n }\n }\n\n const set = async (key: string, value: unknown): Promise<void> => {\n await ensure_root()\n const target = path_for(key)\n const tmp = `${target}.${randomUUID().slice(0, 8)}.tmp`\n await writeFile(tmp, JSON.stringify(value), 'utf8')\n await rename(tmp, target)\n }\n\n const delete_key = async (key: string): Promise<void> => {\n const target = path_for(key)\n await rm(target, { force: true })\n }\n\n return { get, set, delete: delete_key }\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,cAAgC;AAC9C,QAAO;EACL,cAAc;EACd,aAAa,SAAS,GAAG,KAAK,GAAG,YAAY,CAAC,MAAM,GAAG,EAAE;EACzD,gBAAgB;EACjB;;;;;;;;;;;;;;;;;ACOH,SAAS,cAAc,KAAqB;CAC1C,MAAM,OAAO,WAAW,SAAS,CAAC,OAAO,IAAI,CAAC,OAAO,MAAM,CAAC,MAAM,GAAG,GAAG;AAExE,QAAO,GADM,IAAI,QAAQ,oBAAoB,IAAI,CAAC,MAAM,GAAG,GAAG,CAC/C,GAAG,KAAK;;AAGzB,SAAgB,iBAAiB,SAAkD;CACjF,MAAM,EAAE,aAAa;CAErB,MAAM,cAAc,YAA2B;AAC7C,QAAM,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;;CAG5C,MAAM,YAAY,QAAwB,KAAK,UAAU,cAAc,IAAI,CAAC;CAE5E,MAAM,MAAM,OAAO,QAAkC;EACnD,MAAM,OAAO,SAAS,IAAI;EAC1B,IAAI;AACJ,MAAI;AACF,SAAM,MAAM,SAAS,MAAM,OAAO;UAC5B;AACN,UAAO;;AAET,MAAI;AACF,UAAO,KAAK,MAAM,IAAI;UAChB;AACN,UAAO;;;CAIX,MAAM,MAAM,OAAO,KAAa,UAAkC;AAChE,QAAM,aAAa;EACnB,MAAM,SAAS,SAAS,IAAI;EAC5B,MAAM,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC,MAAM,GAAG,EAAE,CAAC;AAClD,QAAM,UAAU,KAAK,KAAK,UAAU,MAAM,EAAE,OAAO;AACnD,QAAM,OAAO,KAAK,OAAO;;CAG3B,MAAM,aAAa,OAAO,QAA+B;AAEvD,QAAM,GADS,SAAS,IAAI,EACX,EAAE,OAAO,MAAM,CAAC;;AAGnC,QAAO;EAAE;EAAK;EAAK,QAAQ;EAAY"}
|