diff --git a/docs/ROADMAP.zh-CN.md b/docs/ROADMAP.zh-CN.md index 952f521..cbe0057 100644 --- a/docs/ROADMAP.zh-CN.md +++ b/docs/ROADMAP.zh-CN.md @@ -64,7 +64,7 @@ Checkpoint 回答“做到哪里、哪些结果已经提交”;Memory 回答 ### M1 · Durable Personal Core -- [ ] [#10 · Pi Durable 适配:为 Personal Agent 建立持久执行内核](https://github.com/ydflow/Trail/issues/10) +- [ ] [#10 · Pi Durable 适配:为 Personal Agent 建立持久执行内核](https://github.com/ydflow/Trail/issues/10),已完成[隔离恢复实验与初步评估](adr/0002-pi-durable-feasibility.md),桌面集成待验收。 - [ ] [#11 · 统一 Goal / Project / Task / Run / Step 状态与任务图](https://github.com/ydflow/Trail/issues/11) - [ ] [#12 · 将 Checkpoint 扩展到普通助手与长任务](https://github.com/ydflow/Trail/issues/12) - [ ] [#13 · 工具副作用日志与重放策略:区分读取、幂等写入和人工确认](https://github.com/ydflow/Trail/issues/13) diff --git a/docs/adr/0002-pi-durable-feasibility.md b/docs/adr/0002-pi-durable-feasibility.md new file mode 100644 index 0000000..1d2306b --- /dev/null +++ b/docs/adr/0002-pi-durable-feasibility.md @@ -0,0 +1,97 @@ +# ADR 0002 · Pi Durable 隔离恢复实验与适配评估 + +- 日期为 2026-11-11。 +- 状态为初步评估完成,建议继续隔离适配实验,生产接入待桌面验收。 +- 对应 [#10](https://github.com/ydflow/Trail/issues/10),后续实体契约见 [#11](https://github.com/ydflow/Trail/issues/11)。 + +## 评估基线 + +Trail 基线为 `e695545`。实验固定 npm 发布包 `@earendil-works/pi-durable`、`@earendil-works/pi-ai`、`@earendil-works/chord` 的 `1.5.2` 版本,完整依赖树与 integrity 记录在独立的 `package-lock.json` 中。Pi Durable 包的 integrity 为 `sha512-zDB3anbI/yD0IG+VVY+g5tU+c5XOVqQAFwLkXRMiqZb4p/afWro0voZtLNoRAWcDA2r73kvmH6kKin9Ka8l55g==`。 + +源码阅读参照上游提交 `6e11a00a01a568ef0ae0df5074acf02fc107c34b`。npm 包元数据未提供 `gitHead`,本次实测对象按发布版本与 integrity 标识。上游 README 将 API 标为实验性,说明发布间可能发生变化。[上游 README](https://github.com/earendil-works/pi/blob/6e11a00a01a568ef0ae0df5074acf02fc107c34b/packages/durable/README.md) · [包定义](https://github.com/earendil-works/pi/blob/6e11a00a01a568ef0ae0df5074acf02fc107c34b/packages/durable/package.json) + +## 决策 + +本轮交付独立 PoC 和状态映射,生产接入暂缓。下一轮通过 `AgentRuntime` 边界试接普通助手的只读任务,并以独立 profile 验收桌面恢复行为。研究任务继续由 `ResearchService` 管理其权威 checkpoint,适配期间保持每个任务只有一个执行与恢复所有者。 + +实验包位于 `scripts/experiments/pi-durable`,依赖通过该目录的 npm lock 安装。实验的数据目录由 `mkdtemp` 创建,公开样例仅含合成股票符号和数值。 + +## 兼容性实测 + +环境为 Windows x64、Bun 1.4.2、Node 24.19.0。上游包声明 Node `>=22.19.0`。 + +| 运行边界 | 实测对象 | 结果与范围 | +| --- | --- | --- | +| Node 子进程 | Node 24.19.0 | JSONL 持久化、强制终止、跨进程恢复和终态重开通过 | +| Bun 子进程 | Bun 1.4.2 | 同一实验通过,实际加载发布包的 ESM 导出 | +| Electron Node 模式 | Electron 39.8.9 内置 Node 22.22.1,`ELECTRON_RUN_AS_NODE=1` | 同一实验通过,覆盖其 Node 执行环境 | +| Electron 主进程与 renderer | Trail 当前 IPC、事件和窗口生命周期 | 待集成验收 | +| Windows 打包应用 | 安装版、便携版和资源解析 | 待集成验收 | +| macOS、Linux | 文件系统和进程终止差异 | 待验证 | +| 现有 Pi RPC adapter | `PiRuntimeAdapter`、`PiRpcClient` 与 CLI 扩展 | 复用当前实现,相关回归通过;Durable 接口映射为后续工作 | + +当前根依赖中的 `@earendil-works/pi-coding-agent` 是 `0.82.1` 本地 vendor 包;`PiRpcClient` 默认启动命令仍为 `bunx @mariozechner/pi-coding-agent --mode rpc`,也支持显式命令和参数。Durable 的 `1.5.2` ESM Harness 使用独立接口,兼容性评估需要覆盖 CLI 协议、扩展注册和模型设置。[vendor 定义](../../.pi/extensions/langsmith/vendor/pi-coding-agent/package.json) · [RPC 启动参数](../../packages/shared/src/agent/pi-rpc-client.ts) · [运行时 adapter](../../packages/shared/src/agent/pi-runtime-adapter.ts) + +## 最小恢复实验 + +`recovery.mjs` 注册一个有两个 phase 的自定义 Durable task。每个 phase 读取一份本地 JSON 合成数据,诊断日志记录每次实际读取的进程 PID。Harness 使用 `openNodeJsonlStorage(..., { fsync: true })`。 + +1. 第一个进程读取第一份数据,将结果和第二 phase 的 checkpoint 提交到 Durable 存储。 +2. 第二 phase 完成读取后暂停。父进程收到明确的 kill-point 事件,对工作进程执行 `SIGKILL` 并等待关闭。 +3. 父进程把第一份源文件的数值从 `1` 改为 `999`,再启动新的工作进程。 +4. 新进程重开相同存储,校验 conversation 和 task ID,恢复第二 phase。恢复时保存的状态为 `pending`,其中第一步结果仍为 `1`。 +5. 最终结果保留第一步已提交的值,第二步完成提交。第三个工作进程再次打开终态任务,结果保持一致。 + +三个运行环境均得到 `firstReads=1`、`secondReads=2`。第一次的第二步结果尚未提交,因此恢复会重新读取。实验覆盖自定义 task 的状态持久化与恢复,模型请求、注册工具、外部 API、费用预算和动作审批仍需各自的集成验证。 + +## 状态与身份映射草案 + +| Trail 当前概念 | Durable 对应概念 | 适配要求 | +| --- | --- | --- | +| `Session.id` 与 `runtimeSessionPath` | Conversation ID 与存储目录 | 显式存储一对一映射,保留现有 Trail ID 和 Pi JSONL 路径用于读取历史 | +| `Run.id`、`AgentRunInput.runId` | 输入 Submission ID、`requestId` 与关联任务 | 同一次请求固定 requestId,并持久化 ID 关联;重试先查询原 submission | +| 一次模型响应及其工具调用 | `pi.generation` 与其 `pi.tool` 子任务 | 明确 Trail run 包含的 turn 范围,保存每个调用与消息的关联 | +| `ToolCall.id`、参数、结果 | Durable 工具任务及结果 entry | 通过能力注册层校验权限、输入与来源,重放读取保存结果 | +| `ResearchCheckpoint.plan/outcomes/inFlight` | 自定义 task checkpoint、子任务与持久结果 | 按研究阶段定义所有者和映射,先提供显式导入流程 | +| `fetching → synthesizing → publishing` | 自定义 task phases | 保存预算、来源、配置指纹和发布身份,恢复时逐项校验 | +| `interrupted/recovering` | 重开后的 pending task 与显式 resume | 由主进程暴露用户可见恢复状态,授权和取消策略需要映射 | +| `completed/partial/failed/cancelled` | terminal outcome 与业务结果 | 保留 `partial`、预算停止与故障原因,避免丢失业务语义 | + +当前普通 `RunStatus` 只有 `running/completed/failed/cancelled`,研究 checkpoint 另有恢复状态。#11 需要先确定统一状态契约,以及等待授权、暂停、失败、取消和重试 attempt 的关系。[核心类型](../../packages/core/src/index.ts) · [SessionManager](../../packages/shared/src/kernel/session-manager.ts) · [RunManager](../../packages/shared/src/kernel/run-manager.ts) · [研究 checkpoint](../../packages/shared/src/research/checkpoint.ts) + +## 存储、迁移与退出方案 + +- 本次实验选择独立 JSONL 目录并启用 fsync,方便在 Bun 和 Node 中运行同一代码。JSONL 会将历史保留在内存中,长期任务的存储选择需另测容量和恢复耗时。SQLite 是后续候选,其适配器和打包行为需按平台验证。 +- 每个存储目录由一个主进程持有写权限,renderer 通过 IPC 读取主进程视图。上游说明 JSONL 缺少跨进程写锁,写模式 open 会执行修复操作,旁观进程需要显式只读打开。适配时应沿用并验证 Electron 单实例约束。[上游存储说明](https://github.com/earendil-works/pi/blob/6e11a00a01a568ef0ae0df5074acf02fc107c34b/packages/durable/README.md#storage) +- 首轮接入为新会话使用独立目录,原 Pi JSONL 和研究 checkpoint 保留各自 schema。迁移工具先导出映射与预检结果,再将带来源、预算和身份信息的数据导入新目录,经校验后切换。 +- 回退时停止新 Harness 的执行,保留其目录和诊断记录,后续新任务切回当前 adapter。已创建的 Durable 任务需要通过对应版本的工具读取或导出,跨格式继续执行需显式迁移。 +- 存储提交与外部动作之间的崩溃窗口需要业务幂等键或人工确认。此次实验以可重读数据验证恢复行为,写操作的重放与取消留给 #13 和 #26 的契约。 + +## 复验命令与证据 + +在仓库根目录执行以下命令。npm 使用实验子目录内的 lock 文件。 + +```powershell +npm ci --prefix scripts/experiments/pi-durable --ignore-scripts --no-audit --no-fund +node --check scripts/experiments/pi-durable/recovery.mjs +node scripts/experiments/pi-durable/recovery.mjs +bun scripts/experiments/pi-durable/recovery.mjs + +$env:ELECTRON_RUN_AS_NODE = '1' +& apps/electron/node_modules/electron/dist/electron.exe scripts/experiments/pi-durable/recovery.mjs +Remove-Item Env:ELECTRON_RUN_AS_NODE + +bun test --isolate packages/shared/src/kernel/agent-kernel.test.ts packages/shared/src/kernel/run-manager.test.ts packages/shared/src/agent/pi-runtime-adapter.test.ts packages/shared/src/research/hard-kill.test.ts packages/shared/src/research/recovery.test.ts --timeout 20000 +bun run typecheck +``` + +每次 PoC 在临时目录保存 manifest、恢复前 checkpoint、恢复后结果、读取次数和 `verification.json`,结束时打印证据目录。Windows PowerShell 下 Electron 的输出捕获可使用 Node `spawnSync` 并传入 `ELECTRON_RUN_AS_NODE=1`。 + +本次结果为 Node、Bun、Electron Node 模式各 1 个完整恢复实验通过,相关回归 `50 pass / 0 fail`、`205 expect()`、5 个文件,现有工作区类型检查全部 exit 0。`npm ci` 从 lock 重新安装后,Node 复验通过。脱敏验证记录见 [Node](../benchmarks/evidence/2026-11-11/pi-durable/node.json)、[Bun](../benchmarks/evidence/2026-11-11/pi-durable/bun.json) 和 [Electron Node 模式](../benchmarks/evidence/2026-11-11/pi-durable/electron-node.json)。 + +## 下一轮验收 + +- 将上述身份映射落实为 #11 的实体契约和 schema 版本策略。 +- 通过 `AgentRuntime` 适配注册工具、模型设置、事件 sequence、取消与预算。 +- 使用隔离 profile 对真实 Electron 主进程执行杀进程恢复、重复恢复、配置变更和多实例竞争验证,再执行 Windows 安装版与便携版回归。 +- 根据桌面结果决定扩大接入范围,或结束实验并保留现有执行方案。 diff --git a/docs/benchmarks/evidence/2026-11-11/pi-durable/bun.json b/docs/benchmarks/evidence/2026-11-11/pi-durable/bun.json new file mode 100644 index 0000000..93c4fc4 --- /dev/null +++ b/docs/benchmarks/evidence/2026-11-11/pi-durable/bun.json @@ -0,0 +1,122 @@ +{ + "status": "passed", + "runtime": { + "node": "26.3.0", + "bun": "1.4.2", + "boringssl": "41bf9b59c2ebf277a7aa427e1ecad5cc80dd4d4f", + "openssl": "1.1.0", + "llhttp": "9.3.0", + "libarchive": "ded82291ab41d5e355831b96b0e1ff49e24d8939", + "mimalloc": "6a64e1ba7f5b2130d4efccb67ec87fd0003f0f6a", + "picohttpparser": "066d2b1e9ab820703db0837a7255d92d30f0c9f5", + "uwebsockets": "744846f844374847c902b5e7fd59b4342a51ef99", + "webkit": "2e2aa2290fac856d6f451ceacb58f7f5b44dd057", + "zig": "04e7f6ac1e009525bc00934f20199c68f04e0a24", + "zlib": "12731092979c6d07f42da27da673a9f6c7b13586", + "tinycc": "05f0fafaa3be31e31d7b4b5c17dc60f62c991171", + "lolhtml": "725ce499aa9b71e38b7a2d0a9fbb6d7294a4079e", + "ares": "c7a3138dcfe3bb0eaaf10c0c24c36dc66dc790ab", + "libdeflate": "c8c56a20f8f621e6a966b716b31f1dedab6a41e3", + "usockets": "744846f844374847c902b5e7fd59b4342a51ef99", + "lshpack": "8905c024b6d052f083a3d11d0a169b3c2735c8a1", + "zstd": "f8745da6ff1ad1e7bab384bd1f9d742439278e99", + "v8": "14.6.202.34-node.20", + "uv": "1.51.1-dev", + "napi": "10", + "icu": "78.3", + "unicode": "17.0", + "sqlite": "3.53.2", + "modules": "147" + }, + "taskId": 7, + "sourceSha256": "7db78e0963c28c5b5dbf72f09c7d5e080e2cbcade7e83a3dbb84dded06303a37", + "packageLockSha256": "a779baf19e49023ced797e6dfd32655b825cde543b6705816be851b8c1b06837", + "conversationId": 1, + "killPoint": { + "event": "kill-ready", + "taskId": 7, + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + }, + "killed": { + "code": null, + "signal": "SIGKILL", + "stderr": "" + }, + "before": { + "status": "pending", + "checkpoint": { + "phase": "second", + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + } + }, + "after": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 51788 + }, + "settled": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 55572 + }, + "attempts": [ + { + "name": "first", + "pid": 57152 + }, + { + "name": "second", + "pid": 57152 + }, + { + "name": "second", + "pid": 51788 + } + ], + "completedReadAttempts": 1, + "uncommittedReadAttempts": 2 +} \ No newline at end of file diff --git a/docs/benchmarks/evidence/2026-11-11/pi-durable/electron-node.json b/docs/benchmarks/evidence/2026-11-11/pi-durable/electron-node.json new file mode 100644 index 0000000..fb96fc2 --- /dev/null +++ b/docs/benchmarks/evidence/2026-11-11/pi-durable/electron-node.json @@ -0,0 +1,125 @@ +{ + "status": "passed", + "runtime": { + "node": "22.22.1", + "acorn": "8.15.0", + "ada": "2.9.2", + "amaro": "1.1.5", + "ares": "1.34.6", + "brotli": "1.0.9", + "cjs_module_lexer": "2.2.0", + "cldr": "44.1", + "icu": "74.2", + "llhttp": "9.3.0", + "modules": "140", + "napi": "10", + "nbytes": "0.1.1", + "ncrypto": "0.0.1", + "nghttp2": "1.64.0", + "openssl": "0.0.0", + "simdjson": "4.2.4", + "simdutf": "7.3.3", + "sqlite": "3.51.2", + "tz": "2025b", + "undici": "6.23.0", + "unicode": "15.1", + "uv": "1.51.0", + "uvwasi": "0.0.23", + "v8": "14.2.231.22-electron.0", + "zlib": "1.3.1", + "zstd": "1.5.8", + "electron": "39.8.9", + "chrome": "142.0.7444.265" + }, + "taskId": 7, + "sourceSha256": "7db78e0963c28c5b5dbf72f09c7d5e080e2cbcade7e83a3dbb84dded06303a37", + "packageLockSha256": "a779baf19e49023ced797e6dfd32655b825cde543b6705816be851b8c1b06837", + "conversationId": 1, + "killPoint": { + "event": "kill-ready", + "taskId": 7, + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + }, + "killed": { + "code": null, + "signal": "SIGKILL", + "stderr": "" + }, + "before": { + "status": "pending", + "checkpoint": { + "phase": "second", + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + } + }, + "after": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 13096 + }, + "settled": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 50852 + }, + "attempts": [ + { + "name": "first", + "pid": 50552 + }, + { + "name": "second", + "pid": 50552 + }, + { + "name": "second", + "pid": 13096 + } + ], + "completedReadAttempts": 1, + "uncommittedReadAttempts": 2 +} \ No newline at end of file diff --git a/docs/benchmarks/evidence/2026-11-11/pi-durable/node.json b/docs/benchmarks/evidence/2026-11-11/pi-durable/node.json new file mode 100644 index 0000000..87a923b --- /dev/null +++ b/docs/benchmarks/evidence/2026-11-11/pi-durable/node.json @@ -0,0 +1,125 @@ +{ + "status": "passed", + "runtime": { + "node": "24.19.0", + "acorn": "8.17.0", + "ada": "3.4.4", + "amaro": "1.1.10", + "ares": "1.34.6", + "brotli": "1.2.0", + "cldr": "48.0", + "icu": "78.3", + "llhttp": "9.4.3", + "merve": "1.2.2", + "modules": "137", + "napi": "10", + "nbytes": "0.1.4", + "ncrypto": "0.0.1", + "nghttp2": "1.69.0", + "nghttp3": "", + "ngtcp2": "", + "openssl": "3.5.7", + "simdjson": "4.6.4", + "simdutf": "6.4.0", + "sqlite": "3.53.3", + "tz": "2026b", + "undici": "7.29.0", + "unicode": "17.0", + "uv": "1.52.1", + "uvwasi": "0.0.23", + "v8": "13.6.233.17-node.51", + "zlib": "1.3.2.1-motley-3246f1b", + "zstd": "1.5.7" + }, + "taskId": 7, + "sourceSha256": "7db78e0963c28c5b5dbf72f09c7d5e080e2cbcade7e83a3dbb84dded06303a37", + "packageLockSha256": "a779baf19e49023ced797e6dfd32655b825cde543b6705816be851b8c1b06837", + "conversationId": 1, + "killPoint": { + "event": "kill-ready", + "taskId": 7, + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + }, + "killed": { + "code": null, + "signal": "SIGKILL", + "stderr": "" + }, + "before": { + "status": "pending", + "checkpoint": { + "phase": "second", + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + } + } + }, + "after": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 55060 + }, + "settled": { + "taskId": 7, + "conversationId": 1, + "state": { + "status": "terminal", + "outcome": { + "status": "completed", + "result": { + "first": { + "symbol": "NVDA.US", + "source": "local-fixture", + "value": 1 + }, + "second": { + "symbol": "AAPL.US", + "source": "local-fixture", + "value": 2 + } + } + } + }, + "pid": 55072 + }, + "attempts": [ + { + "name": "first", + "pid": 48684 + }, + { + "name": "second", + "pid": 48684 + }, + { + "name": "second", + "pid": 55060 + } + ], + "completedReadAttempts": 1, + "uncommittedReadAttempts": 2 +} \ No newline at end of file diff --git a/scripts/experiments/pi-durable/package-lock.json b/scripts/experiments/pi-durable/package-lock.json new file mode 100644 index 0000000..0a61587 --- /dev/null +++ b/scripts/experiments/pi-durable/package-lock.json @@ -0,0 +1,1231 @@ +{ + "name": "trail-pi-durable-experiment", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "trail-pi-durable-experiment", + "dependencies": { + "@earendil-works/chord": "1.5.2", + "@earendil-works/pi-ai": "1.5.2", + "@earendil-works/pi-durable": "1.5.2" + } + }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.129.0", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.129.0.tgz", + "integrity": "sha512-MH7LB20kNpGLUpPTe2OG5XvL/KhX8HUO9XyBaFjgFk6TLS4Xjt0VPIuMKywe7POKKPslX+QxSlVok9e+8kG5Nw==", + "license": "MIT", + "dependencies": { + "json-schema-to-ts": "^3.1.1", + "standardwebhooks": "^1.0.0" + }, + "bin": { + "anthropic-ai-sdk": "bin/cli" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/client-bedrock-runtime": { + "version": "3.1127.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.1127.0.tgz", + "integrity": "sha512-IDl/lrPb90aH+pZFHGNDmgH9nAUQj5PlZH1sJ3w7RikctyjHSnY3oNjZhrLoaBoQn/rNK0zsP6OHEqEhj2tdLA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.977.9", + "@aws-sdk/credential-provider-node": "^3.972.82", + "@aws-sdk/eventstream-handler-node": "^3.972.34", + "@aws-sdk/middleware-eventstream": "^3.972.29", + "@aws-sdk/middleware-websocket": "^3.972.52", + "@aws-sdk/token-providers": "3.1127.0", + "@aws-sdk/types": "^3.974.5", + "@smithy/core": "^3.33.3", + "@smithy/fetch-http-handler": "^5.7.2", + "@smithy/node-http-handler": "^4.11.3", + "@smithy/types": "^4.17.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.981.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.981.0.tgz", + "integrity": "sha512-Mnu7gaDrC5UCdyH8uLxLfB2eWbjE/HbjKX1U1J2VQxG3TTATUDObW2wU3I8iH3e9YH5NN2CY6w1mlAIe2XJ3jg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.975.1", + "@aws-sdk/xml-builder": "^3.972.43", + "@aws/lambda-invoke-store": "^0.3.0", + "@smithy/core": "^3.40.0", + "@smithy/signature-v4": "^5.7.5", + "@smithy/types": "^4.20.0", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.972.84", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.972.84.tgz", + "integrity": "sha512-akZJetiMVeLRHsKzYh3LamDCo74ZUCeo0XoyRKMEMZT5qP7ReM6LhpioBCyuqKP5Vav5gEOeCmaQV0VVQr1Meg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.972.86", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.972.86.tgz", + "integrity": "sha512-U4mHaDRPWAn63yhl7FXIzbppNmW1F+4dSLeuiUpej2v3Xb6rGwvayEJ8SdlrdMV+/mZtd+GStTEP2HqurEzXtw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/fetch-http-handler": "^5.8.1", + "@smithy/node-http-handler": "^4.14.2", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler": { + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.14.2.tgz", + "integrity": "sha512-i1uORV1v3qBqP43ayRKzIdm1q5x14tf8N4Dd06/QUX1Szm6VxHMrTsu20X5E63UFsaNZCRjI4SXG0jDmqYa+3w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.39.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.973.29", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.973.29.tgz", + "integrity": "sha512-/idO4bVjw34b1OiNxDqFNr3BsPg9dRm1iS6XM/rTqA33RfUgTuwBCFFCz/TwxNHkrQ45tp+RpKE8P609Ino8XQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/credential-provider-env": "^3.972.84", + "@aws-sdk/credential-provider-http": "^3.972.86", + "@aws-sdk/credential-provider-login": "^3.972.91", + "@aws-sdk/credential-provider-process": "^3.972.84", + "@aws-sdk/credential-provider-sso": "^3.973.28", + "@aws-sdk/credential-provider-web-identity": "^3.972.90", + "@aws-sdk/nested-clients": "^3.998.3", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/credential-provider-imds": "^4.5.2", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-login": { + "version": "3.972.91", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-login/-/credential-provider-login-3.972.91.tgz", + "integrity": "sha512-MujcVZc7mnodrsp85NX0QpnQrt7kY6zbVUl+TcvzJEZzgEQkRj4iopj0kNs3uXJUArpkA64Rxa0ga86qdx0gag==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/nested-clients": "^3.998.3", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.972.96", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.972.96.tgz", + "integrity": "sha512-tBunyyRnxMvKsCn/pu1QrIxUYZ4Z25LkV8zGkFGpSE/YmI2W4m8SLQzloG/hZlelGP2vLRGtIQc5w1+DoXCK1A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "^3.972.84", + "@aws-sdk/credential-provider-http": "^3.972.86", + "@aws-sdk/credential-provider-ini": "^3.973.29", + "@aws-sdk/credential-provider-process": "^3.972.84", + "@aws-sdk/credential-provider-sso": "^3.973.28", + "@aws-sdk/credential-provider-web-identity": "^3.972.90", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/credential-provider-imds": "^4.5.2", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.972.84", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.972.84.tgz", + "integrity": "sha512-199C6OpNejd0nq9GFAkEFIKids1FL0R6LJtL9c1OTiDOXki7S1OduuPxW4+hE0LwndcYJ7YHOuYTlqScfpCocA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.973.28", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.973.28.tgz", + "integrity": "sha512-bGg7wH8wVDJQIcJggO9lg1ZYbG7l+PbLwHuM3Bi/e1TlCZhU712JS1W3tdRpyptdJD1UGyhBNGO/YrhrQCHKbg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/nested-clients": "^3.998.3", + "@aws-sdk/token-providers": "3.1166.0", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers": { + "version": "3.1166.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.1166.0.tgz", + "integrity": "sha512-ngJ8mxXqtQ9mnp7QV6TWKJCxkpjVfPWxKQSc2FYhCyCfOVFIGdFv7P+/RqVffFrJAorwBPpktnv32gNlcEgF4g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/nested-clients": "^3.998.3", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.972.90", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.972.90.tgz", + "integrity": "sha512-duLeE3xlf0viHeH+1RM4z5duR3b32BCZTWVMu+MbxFPjQBxy7hmIGEqt5hekuFPRuXoyhMovjNl+PNNsb5oiGQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/nested-clients": "^3.998.3", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/eventstream-handler-node": { + "version": "3.972.42", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.972.42.tgz", + "integrity": "sha512-YVB1wrpE1WF8NvMpaRyhwm9XBYl3HTbPNEIgybi0b0XpmBrJ7Y3Y/drbxh9qAVMbR+0hcwM63GPWzhOVRuerfg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-eventstream": { + "version": "3.972.38", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-eventstream/-/middleware-eventstream-3.972.38.tgz", + "integrity": "sha512-4K6FDz2BxH3rve8Hw/8uApWXKCuKKMeYKzY23PoiGqUBWaA23eAy+GzW9aoG3Cm7HqgYzqkljl3ECJRJCxGs7g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-websocket": { + "version": "3.972.66", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.972.66.tgz", + "integrity": "sha512-feGNDB15ZgqX4DTsUykkgj7d8hzfzx03v80EIyRA1FTbsbAJQKxYB50kRbrrpE5WeFaWhgk+p5YHlsoyXrI2/g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/fetch-http-handler": "^5.8.1", + "@smithy/signature-v4": "^5.7.5", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients": { + "version": "3.998.3", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.998.3.tgz", + "integrity": "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.981.0", + "@aws-sdk/signature-v4-multi-region": "^3.996.52", + "@aws-sdk/types": "^3.975.1", + "@smithy/core": "^3.40.0", + "@smithy/fetch-http-handler": "^5.8.1", + "@smithy/node-http-handler": "^4.14.2", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler": { + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.14.2.tgz", + "integrity": "sha512-i1uORV1v3qBqP43ayRKzIdm1q5x14tf8N4Dd06/QUX1Szm6VxHMrTsu20X5E63UFsaNZCRjI4SXG0jDmqYa+3w==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.39.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/signature-v4-multi-region": { + "version": "3.996.52", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.996.52.tgz", + "integrity": "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.975.1", + "@smithy/signature-v4": "^5.7.5", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.1127.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.1127.0.tgz", + "integrity": "sha512-Dv2TMWBshJ+tF6ahs2Sy5bh4Iabsd4GAQqVvE9XZmYmnoaVbpS2QKIKE/HRacc7bTtbjEEvP+laGzHvHlf1CiQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.977.9", + "@aws-sdk/nested-clients": "^3.997.44", + "@aws-sdk/types": "^3.974.5", + "@smithy/core": "^3.33.3", + "@smithy/types": "^4.17.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.975.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.975.1.tgz", + "integrity": "sha512-7rGxUkCB2QPoQOeJmonmAICTN2zrH+fpmi1p4Iwu72lnxNaMhOgqcbpyddifnM1DBb19TWQ1u6z/XjkaFNEDWw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.972.43", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.972.43.tgz", + "integrity": "sha512-rG8QVx4DOrJWptsogu1Aq+CDsnPKaBrAlJpKLxrJrIDXAq1ElnW0yQjjBnlWSXll0cDakCG6UDvaqwz0A9d9Og==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws/lambda-invoke-store": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@aws/lambda-invoke-store/-/lambda-invoke-store-0.3.0.tgz", + "integrity": "sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.13.tgz", + "integrity": "sha512-v+oN26xP4YIlQsbQ/CbTH1WG5m/l/DjKKZNy/Kp3f/AFvbgt7Em/D0FeMM3O2hX0YzeN2M16W8lOpyhIkfCBcQ==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@earendil-works/chord": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-1.5.2.tgz", + "integrity": "sha512-3g088g7qVXL2cpRAKWjj9za6RLls9FBnuUo5c0hBZ0xCftBQjae0opS+34M22vdXTVE7BNqkRG/FPc9BsM7eEg==", + "license": "MIT", + "dependencies": { + "@earendil-works/pi-schema": "1.5.2", + "@earendil-works/pi-telemetry": "1.5.2" + }, + "engines": { + "node": ">=22.19.0" + }, + "peerDependencies": { + "esbuild": "0.28.2", + "react": "19.3.0", + "ws": "8.21.0" + }, + "peerDependenciesMeta": { + "esbuild": { + "optional": true + }, + "react": { + "optional": true + }, + "ws": { + "optional": true + } + } + }, + "node_modules/@earendil-works/pi-ai": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-1.5.2.tgz", + "integrity": "sha512-2tWPSnV3qzfiDIY3aWluBag3vC++Vs+VsXt/UquSU5onPMohPih72FUhIhaqmDdMYubOgB3Byl9uF4Vk40JLvQ==", + "license": "MIT", + "dependencies": { + "@anthropic-ai/sdk": "0.129.0", + "@aws-sdk/client-bedrock-runtime": "3.1127.0", + "@earendil-works/pi-schema": "1.5.2", + "@earendil-works/pi-telemetry": "1.5.2", + "@google/genai": "2.21.0", + "@smithy/node-http-handler": "4.12.1", + "http-proxy-agent": "9.1.0", + "https-proxy-agent": "9.1.0", + "openai": "7.19.0", + "partial-json": "0.1.7" + }, + "bin": { + "pi-ai": "dist/cli.js" + }, + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/@earendil-works/pi-codemode": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/pi-codemode/-/pi-codemode-1.5.2.tgz", + "integrity": "sha512-HoZQ40a9RgdZ1VgmrX6x8887cNXedaRJT1l+Ie5YRIMK4gY7v0EpsiNqf6dmixrKylZlTgUSyR+vE8xhjfkr+w==", + "license": "MIT", + "dependencies": { + "quickjs-wasi": "3.6.2" + }, + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/@earendil-works/pi-durable": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/pi-durable/-/pi-durable-1.5.2.tgz", + "integrity": "sha512-zDB3anbI/yD0IG+VVY+g5tU+c5XOVqQAFwLkXRMiqZb4p/afWro0voZtLNoRAWcDA2r73kvmH6kKin9Ka8l55g==", + "license": "MIT", + "dependencies": { + "@earendil-works/chord": "1.5.2", + "@earendil-works/pi-ai": "1.5.2", + "@earendil-works/pi-codemode": "1.5.2", + "@earendil-works/pi-schema": "1.5.2", + "@earendil-works/pi-telemetry": "1.5.2", + "@silvia-odwyer/photon": "0.3.3", + "diff": "8.0.4" + }, + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/@earendil-works/pi-schema": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/pi-schema/-/pi-schema-1.5.2.tgz", + "integrity": "sha512-hJoyCXWUhsSrXY5wJo2Q4kHXUsR51pNhkJHAMkWRwVMLDRtMDPkKNaa+JlVRVqTw1hjdSxcVVaFLSDbKlaTXEQ==", + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/@earendil-works/pi-telemetry": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-1.5.2.tgz", + "integrity": "sha512-m+cumjIqNh1aMISi/9ttcG3ZOwIdriPbz/eMyWmRMJCGa/WcgY1RX4lrb7HvsHhSfI/JUeBESA4nOCr8C3y5ow==", + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/@google/genai": { + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-2.21.0.tgz", + "integrity": "sha512-+PDtco2/Z0ONdzCGekCoCT+O1VJS9xJQNN4XzQpXG/t3El/SWWMkCWlFRO1KmivOHPa4Q0VjUYu1HBKCZ/v33Q==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "google-auth-library": "^10.3.0", + "p-retry": "^4.6.2", + "protobufjs": "^7.5.4", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@modelcontextprotocol/sdk": "^1.25.2" + }, + "peerDependenciesMeta": { + "@modelcontextprotocol/sdk": { + "optional": true + } + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.2.tgz", + "integrity": "sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==", + "license": "BSD-3-Clause" + }, + "node_modules/@silvia-odwyer/photon": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@silvia-odwyer/photon/-/photon-0.3.3.tgz", + "integrity": "sha512-8BhUjEch4slwRe8uXnaA4vcA5uiiOTT90UMsxulOj2gN98X1p0q9Z4Ysk4DkD05uNgbR9XoSqtZ37w+33w4QKQ==", + "license": "Apache-2.0" + }, + "node_modules/@smithy/core": { + "version": "3.40.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.40.0.tgz", + "integrity": "sha512-DssGno52pzZ5m6RlDtyKuBIpZNPg9pqgs0CnNDKz9IatxCsmvNmJNn5Zn6rf77MthZo9wf89OvZFhTY/RwxhxQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.5.2.tgz", + "integrity": "sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.33.2", + "@smithy/types": "^4.17.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.8.1.tgz", + "integrity": "sha512-h8BdMUrUBhMhMaeK7QqAdINRZezCGuYOCpcOZZ1ewxbHST9rdTd09xwNpvLTYfzDRehxQiReK4SKbdYZxBA+ew==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.39.0", + "@smithy/types": "^4.20.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.12.1.tgz", + "integrity": "sha512-ThMkboGeONWXAelq9FvGsuJC4rOi+qyC4/zhUF58xYpxUg5sQKx2VXZYJmtNjr4dSuBJ1HeJXETQILCz3wOHvw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.33.3", + "@smithy/types": "^4.18.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "5.7.5", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.7.5.tgz", + "integrity": "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.38.0", + "@smithy/types": "^4.19.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.20.0.tgz", + "integrity": "sha512-lCA6QG22dPk9ecHbv91jDQZsmtPUjdS1aE2Il6NNPqe7DrYc0dZQi6DhcESk2KYXH2sp5xbAcGdYMZDFnuzA2A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@stablelib/base64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz", + "integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz", + "integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==", + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bowser": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.15.0.tgz", + "integrity": "sha512-xic6KSZglg/I4ymp45fdM4GWfYpBK79Fxd/TOvJktlaPgQqqDxvmGwOPZl2V0dyeS3Lj5c180bLhXF43iyAjZQ==", + "license": "MIT" + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/diff": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/fast-sha256": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz", + "integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==", + "license": "Unlicense" + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "license": "MIT", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/gaxios": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.3.1.tgz", + "integrity": "sha512-kB3rzJV7d9juLZh8/56QTXCwQfxyhdOMdyYk1HdQKFtF8TJTDTZQJtixWIwXdE9Jji91mC41DUNpjleo4L4eAQ==", + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "node-fetch": "^3.3.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/gaxios/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/gaxios/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/gcp-metadata": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-8.1.2.tgz", + "integrity": "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==", + "license": "Apache-2.0", + "dependencies": { + "gaxios": "^7.0.0", + "google-logging-utils": "^1.0.0", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/google-auth-library": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.9.1.tgz", + "integrity": "sha512-i1ydyHrqcIxXkWh/uBmVkzCvIuq5yiK2ATndIe5XxKholrG/MTYP9xGYka4sQhrbIAgGjL2B6NOE7rFaiF3fXw==", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^7.1.4", + "gcp-metadata": "8.1.2", + "google-logging-utils": "1.1.3", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/google-logging-utils": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.3.tgz", + "integrity": "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/http-proxy-agent": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-9.1.0.tgz", + "integrity": "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig==", + "license": "MIT", + "dependencies": { + "agent-base": "9.0.0", + "debug": "^4.3.4", + "proxy-agent-negotiate": "1.1.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/https-proxy-agent": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-9.1.0.tgz", + "integrity": "sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA==", + "license": "MIT", + "dependencies": { + "agent-base": "9.0.0", + "debug": "^4.3.4", + "proxy-agent-negotiate": "1.1.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-schema-to-ts": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz", + "integrity": "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.18.3", + "ts-algebra": "^2.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "license": "MIT", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/openai": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/openai/-/openai-7.19.0.tgz", + "integrity": "sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=22.0.0" + }, + "peerDependencies": { + "@aws-sdk/credential-provider-node": ">=3.972.0 <4", + "@smithy/hash-node": ">=4.3.0 <5", + "@smithy/signature-v4": ">=5.4.0 <6", + "undici": ">=5 <9", + "ws": "^8.21.0", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-provider-node": { + "optional": true + }, + "@smithy/hash-node": { + "optional": true + }, + "@smithy/signature-v4": { + "optional": true + }, + "undici": { + "optional": true + }, + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "license": "MIT", + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/partial-json": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/partial-json/-/partial-json-0.1.7.tgz", + "integrity": "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA==", + "license": "MIT" + }, + "node_modules/protobufjs": { + "version": "7.6.6", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.6.tgz", + "integrity": "sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", + "@protobufjs/float": "^1.0.2", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", + "@types/node": ">=13.7.0", + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/proxy-agent-negotiate": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-agent-negotiate/-/proxy-agent-negotiate-1.1.0.tgz", + "integrity": "sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ==", + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "kerberos": "^2.0.0" + }, + "peerDependenciesMeta": { + "kerberos": { + "optional": true + } + } + }, + "node_modules/quickjs-wasi": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/quickjs-wasi/-/quickjs-wasi-3.6.2.tgz", + "integrity": "sha512-FCqGtGOrMgzUiIrMNMA2YnsOxCNwo31dzqXvclXUC6xeT35NJLKXQJsvbeCTjvoFAwZgEAPg8U6+KAPDGXn8Mg==", + "license": "MIT" + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/standardwebhooks": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.1.1.tgz", + "integrity": "sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ==", + "license": "MIT", + "dependencies": { + "@stablelib/base64": "^1.0.0", + "fast-sha256": "^1.3.0" + } + }, + "node_modules/ts-algebra": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz", + "integrity": "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==", + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "license": "0BSD" + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "license": "MIT" + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/scripts/experiments/pi-durable/package.json b/scripts/experiments/pi-durable/package.json new file mode 100644 index 0000000..a7670e7 --- /dev/null +++ b/scripts/experiments/pi-durable/package.json @@ -0,0 +1,13 @@ +{ + "name": "trail-pi-durable-experiment", + "private": true, + "type": "module", + "scripts": { + "test": "node recovery.mjs" + }, + "dependencies": { + "@earendil-works/chord": "1.5.2", + "@earendil-works/pi-ai": "1.5.2", + "@earendil-works/pi-durable": "1.5.2" + } +} diff --git a/scripts/experiments/pi-durable/recovery.mjs b/scripts/experiments/pi-durable/recovery.mjs new file mode 100644 index 0000000..e8bb9fc --- /dev/null +++ b/scripts/experiments/pi-durable/recovery.mjs @@ -0,0 +1,190 @@ +import assert from 'node:assert/strict'; +import { spawn } from 'node:child_process'; +import { createHash } from 'node:crypto'; +import { once } from 'node:events'; +import { appendFile, mkdtemp, readFile, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { createInterface } from 'node:readline'; +import { fileURLToPath } from 'node:url'; +import { BACKGROUND_CONTEXT } from '@earendil-works/chord/context'; +import { createModels } from '@earendil-works/pi-ai/models'; +import { createRegistry, defineExtension, defineTask, Harness } from '@earendil-works/pi-durable'; +import { openNodeJsonlStorage } from '@earendil-works/pi-durable/storage/jsonl/node'; + +const context = BACKGROUND_CONTEXT; +const script = fileURLToPath(import.meta.url); + +async function runWorker(directory, mode) { + async function readFixture(name) { + const value = JSON.parse(await readFile(join(directory, `${name}.json`), 'utf8')); + // This diagnostic records actual read attempts, including an uncommitted read. + await appendFile(join(directory, 'attempts.jsonl'), JSON.stringify({ name, pid: process.pid }) + '\n'); + return value; + } + + const ReadTwoFiles = defineTask({ + name: 'trail.experiment.read-two-files', + version: 1, + initial: () => ({ phase: 'first' }), + phases: { + first: async (_task, runtime, taskContext) => { + const first = await readFixture('first'); + await runtime.commit(() => ({ status: 'running', checkpoint: { phase: 'second', first } }), taskContext); + }, + second: async (task, runtime, taskContext) => { + const second = await readFixture('second'); + if (mode === 'start') { + // The first result is durable. The second read finished but has no saved outcome. + console.log(JSON.stringify({ event: 'kill-ready', taskId: task.id, first: task.state.checkpoint.first })); + await new Promise(() => { + setInterval(() => {}, 1000); + }); + } + await runtime.commit(() => ({ + status: 'terminal', + outcome: { status: 'completed', result: { first: task.state.checkpoint.first, second } }, + }), taskContext); + }, + }, + abort: (_task, runtime, taskContext) => runtime.commit( + () => ({ status: 'terminal', outcome: { status: 'aborted' } }), taskContext, + ), + }); + + const registry = createRegistry(); + registry.install(defineExtension({ name: 'trail-experiment', tasks: [ReadTwoFiles] })); + const storage = await openNodeJsonlStorage(join(directory, 'store'), context, { fsync: true }); + const harness = await Harness.open(storage, { models: createModels(), registry }, context); + try { + const root = await harness.root(context); + let manifest; + if (mode === 'start') { + const taskId = await root.commit( + (tx) => tx.createTask(ReadTwoFiles, {}, { ownership: { kind: 'conversation' } }), context, + ); + manifest = { taskId, conversationId: root.id }; + await writeFile(join(directory, 'manifest.json'), JSON.stringify(manifest)); + } else { + manifest = JSON.parse(await readFile(join(directory, 'manifest.json'), 'utf8')); + assert.equal(root.id, manifest.conversationId); + const saved = await harness.getTask(manifest.taskId, context); + assert(saved); + await writeFile(join(directory, `${mode}-before.json`), JSON.stringify(saved.state)); + } + const completed = await harness.waitForTask(manifest.taskId, context); + assert.equal(completed.state.outcome.status, 'completed'); + await writeFile(join(directory, `${mode}-after.json`), JSON.stringify({ + ...manifest, state: completed.state, pid: process.pid, + }, null, 2)); + console.log(JSON.stringify({ event: 'completed', taskId: manifest.taskId })); + } finally { + await harness.close(context); + } +} + +async function runExperiment() { + const directory = await mkdtemp(join(tmpdir(), 'trail-pi-durable-')); + const first = { symbol: 'NVDA.US', source: 'local-fixture', value: 1 }; + const second = { symbol: 'AAPL.US', source: 'local-fixture', value: 2 }; + await writeFile(join(directory, 'first.json'), JSON.stringify(first)); + await writeFile(join(directory, 'second.json'), JSON.stringify(second)); + const children = new Set(); + function launch(mode, expectedEvent) { + const child = spawn(process.execPath, [script, '--worker', directory, mode], { + stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true, + }); + children.add(child); + const watchdog = setTimeout(() => child.kill('SIGKILL'), 30000); + let stderr = ''; + child.stderr.setEncoding('utf8').on('data', (data) => { stderr += data; }); + const lines = createInterface({ input: child.stdout }); + const exited = new Promise((resolve, reject) => { + child.once('error', reject); + child.once('close', (code, signal) => { + clearTimeout(watchdog); + children.delete(child); + lines.close(); + resolve({ code, signal, stderr }); + }); + }); + const reached = new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error(`${mode} timed out\n${stderr}`)), 30000); + lines.on('line', (line) => { + try { + const event = JSON.parse(line); + if (event.event === expectedEvent) { + clearTimeout(timeout); + resolve(event); + } + } catch (error) { + clearTimeout(timeout); + reject(error); + } + }); + exited.then((result) => { + clearTimeout(timeout); + reject(new Error(`${mode} exited before ${expectedEvent}: ${JSON.stringify(result)}`)); + }, (error) => { + clearTimeout(timeout); + reject(error); + }); + }); + return { child, reached, exited }; + } + + try { + const started = launch('start', 'kill-ready'); + const killPoint = await started.reached; + assert.deepEqual(killPoint.first, first); + assert(started.child.kill('SIGKILL')); + const killed = await started.exited; + assert(killed.code !== 0 || killed.signal !== null); + await writeFile(join(directory, 'first.json'), JSON.stringify({ ...first, value: 999 })); + + const resumed = launch('resume', 'completed'); + await resumed.reached; + assert.equal((await resumed.exited).code, 0); + const before = JSON.parse(await readFile(join(directory, 'resume-before.json'), 'utf8')); + const after = JSON.parse(await readFile(join(directory, 'resume-after.json'), 'utf8')); + assert.equal(before.status, 'pending'); + assert.equal(before.checkpoint.phase, 'second'); + assert.deepEqual(before.checkpoint.first, first); + assert.equal(after.taskId, killPoint.taskId); + assert.deepEqual(after.state.outcome.result, { first, second }); + + // A third fresh process opens an already completed task without dispatching its reads. + const reopened = launch('reopen', 'completed'); + await reopened.reached; + assert.equal((await reopened.exited).code, 0); + const settled = JSON.parse(await readFile(join(directory, 'reopen-after.json'), 'utf8')); + assert.deepEqual(settled.state, after.state); + assert.notEqual(after.pid, settled.pid); + const attempts = (await readFile(join(directory, 'attempts.jsonl'), 'utf8')).trim().split('\n').map(JSON.parse); + assert.deepEqual(attempts.map((attempt) => attempt.name), ['first', 'second', 'second']); + assert.notEqual(attempts[0].pid, attempts[2].pid); + const verification = { + status: 'passed', runtime: process.versions, taskId: after.taskId, + sourceSha256: createHash('sha256').update(await readFile(script)).digest('hex'), + packageLockSha256: createHash('sha256').update(await readFile(new URL('./package-lock.json', import.meta.url))).digest('hex'), + conversationId: after.conversationId, killPoint, killed, before, after, settled, attempts, + completedReadAttempts: 1, uncommittedReadAttempts: 2, + }; + await writeFile(join(directory, 'verification.json'), JSON.stringify(verification, null, 2)); + console.log(JSON.stringify({ status: 'passed', directory, firstReads: 1, secondReads: 2, taskId: after.taskId })); + } finally { + for (const child of children) { + const stopped = once(child, 'close'); + child.kill('SIGKILL'); + await stopped; + } + // Keep fixture-only evidence for inspection, including failures. + console.error(`Evidence directory: ${directory}`); + } +} + +if (process.argv[2] === '--worker') { + await runWorker(process.argv[3], process.argv[4]); +} else { + await runExperiment(); +}