@roj-ai/sdk 0.1.36 → 0.2.2
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/dist/bootstrap.d.ts +420 -26
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +55 -24
- package/dist/bootstrap.js.map +1 -1
- package/dist/bun-platform/fs.d.ts.map +1 -1
- package/dist/bun-platform/fs.js +1 -0
- package/dist/bun-platform/fs.js.map +1 -1
- package/dist/bun-platform/index.d.ts +4 -1
- package/dist/bun-platform/index.d.ts.map +1 -1
- package/dist/bun-platform/index.js +7 -1
- package/dist/bun-platform/index.js.map +1 -1
- package/dist/bun-platform/server-lifecycle.d.ts +30 -0
- package/dist/bun-platform/server-lifecycle.d.ts.map +1 -0
- package/dist/bun-platform/server-lifecycle.js +182 -0
- package/dist/bun-platform/server-lifecycle.js.map +1 -0
- package/dist/bun-platform/shell.d.ts +33 -0
- package/dist/bun-platform/shell.d.ts.map +1 -0
- package/dist/bun-platform/shell.js +322 -0
- package/dist/bun-platform/shell.js.map +1 -0
- package/dist/config.d.ts +34 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +97 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agents/agent.d.ts +42 -7
- package/dist/core/agents/agent.d.ts.map +1 -1
- package/dist/core/agents/agent.js +202 -87
- package/dist/core/agents/agent.js.map +1 -1
- package/dist/core/agents/config.d.ts +8 -1
- package/dist/core/agents/config.d.ts.map +1 -1
- package/dist/core/agents/config.js +5 -1
- package/dist/core/agents/config.js.map +1 -1
- package/dist/core/agents/retry.d.ts +1 -1
- package/dist/core/agents/retry.d.ts.map +1 -1
- package/dist/core/agents/retry.js +14 -16
- package/dist/core/agents/retry.js.map +1 -1
- package/dist/core/agents/state.d.ts +3 -1
- package/dist/core/agents/state.d.ts.map +1 -1
- package/dist/core/agents/state.js +1 -1
- package/dist/core/agents/state.js.map +1 -1
- package/dist/core/context/state.d.ts +3 -3
- package/dist/core/context/state.js +2 -2
- package/dist/core/events/base-event-store.d.ts.map +1 -1
- package/dist/core/events/base-event-store.js +22 -14
- package/dist/core/events/base-event-store.js.map +1 -1
- package/dist/core/events/file.d.ts +39 -1
- package/dist/core/events/file.d.ts.map +1 -1
- package/dist/core/events/file.js +159 -20
- package/dist/core/events/file.js.map +1 -1
- package/dist/core/events/types.d.ts +1 -1
- package/dist/core/file-store/containment.d.ts +19 -0
- package/dist/core/file-store/containment.d.ts.map +1 -0
- package/dist/core/file-store/containment.js +62 -0
- package/dist/core/file-store/containment.js.map +1 -0
- package/dist/core/file-store/file-store.d.ts +22 -2
- package/dist/core/file-store/file-store.d.ts.map +1 -1
- package/dist/core/file-store/file-store.js +88 -20
- package/dist/core/file-store/file-store.js.map +1 -1
- package/dist/core/file-store/types.d.ts +13 -1
- package/dist/core/file-store/types.d.ts.map +1 -1
- package/dist/core/image/image-processor.d.ts.map +1 -1
- package/dist/core/image/image-processor.js +3 -1
- package/dist/core/image/image-processor.js.map +1 -1
- package/dist/core/image/types.d.ts +2 -0
- package/dist/core/image/types.d.ts.map +1 -1
- package/dist/core/image/vips-resizer.d.ts.map +1 -1
- package/dist/core/image/vips-resizer.js +81 -33
- package/dist/core/image/vips-resizer.js.map +1 -1
- package/dist/core/llm/anthropic.d.ts +0 -1
- package/dist/core/llm/anthropic.d.ts.map +1 -1
- package/dist/core/llm/anthropic.js +58 -72
- package/dist/core/llm/anthropic.js.map +1 -1
- package/dist/core/llm/logger.d.ts +14 -2
- package/dist/core/llm/logger.d.ts.map +1 -1
- package/dist/core/llm/logger.js +161 -36
- package/dist/core/llm/logger.js.map +1 -1
- package/dist/core/llm/openrouter.d.ts +0 -1
- package/dist/core/llm/openrouter.d.ts.map +1 -1
- package/dist/core/llm/openrouter.js +53 -66
- package/dist/core/llm/openrouter.js.map +1 -1
- package/dist/core/llm/provider-request.d.ts +10 -0
- package/dist/core/llm/provider-request.d.ts.map +1 -0
- package/dist/core/llm/provider-request.js +41 -0
- package/dist/core/llm/provider-request.js.map +1 -0
- package/dist/core/llm/provider.d.ts +11 -0
- package/dist/core/llm/provider.d.ts.map +1 -1
- package/dist/core/llm/provider.js +26 -0
- package/dist/core/llm/provider.js.map +1 -1
- package/dist/core/llm/state.d.ts +2 -2
- package/dist/core/llm/state.js +4 -4
- package/dist/core/plugins/plugin-builder.d.ts +57 -3
- package/dist/core/plugins/plugin-builder.d.ts.map +1 -1
- package/dist/core/plugins/plugin-builder.js +68 -14
- package/dist/core/plugins/plugin-builder.js.map +1 -1
- package/dist/core/preset/preset-builder.d.ts +3 -2
- package/dist/core/preset/preset-builder.d.ts.map +1 -1
- package/dist/core/preset/preset-builder.js +7 -16
- package/dist/core/preset/preset-builder.js.map +1 -1
- package/dist/core/sessions/context.d.ts +23 -5
- package/dist/core/sessions/context.d.ts.map +1 -1
- package/dist/core/sessions/runtime-activity.d.ts +33 -0
- package/dist/core/sessions/runtime-activity.d.ts.map +1 -0
- package/dist/core/sessions/runtime-activity.js +55 -0
- package/dist/core/sessions/runtime-activity.js.map +1 -0
- package/dist/core/sessions/schema.d.ts +23 -2
- package/dist/core/sessions/schema.d.ts.map +1 -1
- package/dist/core/sessions/schema.js +24 -3
- package/dist/core/sessions/schema.js.map +1 -1
- package/dist/core/sessions/session-manager.d.ts +83 -6
- package/dist/core/sessions/session-manager.d.ts.map +1 -1
- package/dist/core/sessions/session-manager.js +517 -118
- package/dist/core/sessions/session-manager.js.map +1 -1
- package/dist/core/sessions/session-store.d.ts +18 -0
- package/dist/core/sessions/session-store.d.ts.map +1 -1
- package/dist/core/sessions/session-store.js +33 -0
- package/dist/core/sessions/session-store.js.map +1 -1
- package/dist/core/sessions/session.d.ts +42 -6
- package/dist/core/sessions/session.d.ts.map +1 -1
- package/dist/core/sessions/session.js +176 -44
- package/dist/core/sessions/session.js.map +1 -1
- package/dist/core/sessions/state.d.ts +10 -1
- package/dist/core/sessions/state.d.ts.map +1 -1
- package/dist/core/sessions/state.js +11 -1
- package/dist/core/sessions/state.js.map +1 -1
- package/dist/core/system.d.ts +9 -0
- package/dist/core/system.d.ts.map +1 -1
- package/dist/core/system.js +4 -1
- package/dist/core/system.js.map +1 -1
- package/dist/core/tools/executor.d.ts +1 -1
- package/dist/core/wake-key.d.ts +34 -0
- package/dist/core/wake-key.d.ts.map +1 -0
- package/dist/core/wake-key.js +51 -0
- package/dist/core/wake-key.js.map +1 -0
- package/dist/index.d.ts +25 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/archive/archive-inspection.d.ts +48 -0
- package/dist/lib/archive/archive-inspection.d.ts.map +1 -0
- package/dist/lib/archive/archive-inspection.fixtures.d.ts +7 -0
- package/dist/lib/archive/archive-inspection.fixtures.d.ts.map +1 -0
- package/dist/lib/archive/archive-inspection.fixtures.js +134 -0
- package/dist/lib/archive/archive-inspection.fixtures.js.map +1 -0
- package/dist/lib/archive/archive-inspection.js +253 -0
- package/dist/lib/archive/archive-inspection.js.map +1 -0
- package/dist/lib/archive/index.d.ts +3 -0
- package/dist/lib/archive/index.d.ts.map +1 -0
- package/dist/lib/archive/index.js +2 -0
- package/dist/lib/archive/index.js.map +1 -0
- package/dist/lib/logger/console.d.ts +5 -12
- package/dist/lib/logger/console.d.ts.map +1 -1
- package/dist/lib/logger/console.js +5 -47
- package/dist/lib/logger/console.js.map +1 -1
- package/dist/lib/logger/file.d.ts +8 -11
- package/dist/lib/logger/file.d.ts.map +1 -1
- package/dist/lib/logger/file.js +26 -37
- package/dist/lib/logger/file.js.map +1 -1
- package/dist/lib/logger/index.d.ts +3 -1
- package/dist/lib/logger/index.d.ts.map +1 -1
- package/dist/lib/logger/index.js +3 -1
- package/dist/lib/logger/index.js.map +1 -1
- package/dist/lib/logger/jsonl.d.ts +21 -0
- package/dist/lib/logger/jsonl.d.ts.map +1 -0
- package/dist/lib/logger/jsonl.js +29 -0
- package/dist/lib/logger/jsonl.js.map +1 -0
- package/dist/lib/logger/logger.d.ts +22 -0
- package/dist/lib/logger/logger.d.ts.map +1 -1
- package/dist/lib/logger/logger.js +37 -0
- package/dist/lib/logger/logger.js.map +1 -1
- package/dist/lib/logger/session-log.d.ts +21 -0
- package/dist/lib/logger/session-log.d.ts.map +1 -0
- package/dist/lib/logger/session-log.js +37 -0
- package/dist/lib/logger/session-log.js.map +1 -0
- package/dist/lib/utils/concurrency.d.ts +1 -1
- package/dist/lib/utils/concurrency.d.ts.map +1 -1
- package/dist/lib/utils/concurrency.js +30 -7
- package/dist/lib/utils/concurrency.js.map +1 -1
- package/dist/lib/utils/fs-batch.d.ts +17 -0
- package/dist/lib/utils/fs-batch.d.ts.map +1 -0
- package/dist/lib/utils/fs-batch.js +38 -0
- package/dist/lib/utils/fs-batch.js.map +1 -0
- package/dist/lib/utils/result.d.ts +7 -22
- package/dist/lib/utils/result.d.ts.map +1 -1
- package/dist/lib/utils/result.js +6 -17
- package/dist/lib/utils/result.js.map +1 -1
- package/dist/lib/utils/sleep.d.ts +10 -0
- package/dist/lib/utils/sleep.d.ts.map +1 -0
- package/dist/lib/utils/sleep.js +26 -0
- package/dist/lib/utils/sleep.js.map +1 -0
- package/dist/platform/fs-revision.d.ts +21 -0
- package/dist/platform/fs-revision.d.ts.map +1 -0
- package/dist/platform/fs-revision.js +9 -0
- package/dist/platform/fs-revision.js.map +1 -0
- package/dist/platform/fs.d.ts +104 -1
- package/dist/platform/fs.d.ts.map +1 -1
- package/dist/platform/git.d.ts +59 -0
- package/dist/platform/git.d.ts.map +1 -0
- package/dist/platform/git.js +8 -0
- package/dist/platform/git.js.map +1 -0
- package/dist/platform/index.d.ts +40 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/llm-call-log.d.ts +80 -0
- package/dist/platform/llm-call-log.d.ts.map +1 -0
- package/dist/platform/llm-call-log.js +12 -0
- package/dist/platform/llm-call-log.js.map +1 -0
- package/dist/platform/scheduler.d.ts +32 -0
- package/dist/platform/scheduler.d.ts.map +1 -0
- package/dist/platform/scheduler.js +46 -0
- package/dist/platform/scheduler.js.map +1 -0
- package/dist/platform/session-log.d.ts +36 -0
- package/dist/platform/session-log.d.ts.map +1 -0
- package/dist/platform/session-log.js +12 -0
- package/dist/platform/session-log.js.map +1 -0
- package/dist/platform/shell.d.ts +83 -0
- package/dist/platform/shell.d.ts.map +1 -0
- package/dist/platform/shell.js +13 -0
- package/dist/platform/shell.js.map +1 -0
- package/dist/plugins/agent-status/plugin.d.ts.map +1 -1
- package/dist/plugins/agent-status/plugin.js +1 -0
- package/dist/plugins/agent-status/plugin.js.map +1 -1
- package/dist/plugins/agents/plugin.d.ts.map +1 -1
- package/dist/plugins/agents/plugin.js +129 -62
- package/dist/plugins/agents/plugin.js.map +1 -1
- package/dist/plugins/filesystem/listing.d.ts +3 -0
- package/dist/plugins/filesystem/listing.d.ts.map +1 -1
- package/dist/plugins/filesystem/listing.js +66 -10
- package/dist/plugins/filesystem/listing.js.map +1 -1
- package/dist/plugins/filesystem/plugin.d.ts.map +1 -1
- package/dist/plugins/filesystem/plugin.js +8 -6
- package/dist/plugins/filesystem/plugin.js.map +1 -1
- package/dist/plugins/git-status/index.d.ts +1 -0
- package/dist/plugins/git-status/index.d.ts.map +1 -1
- package/dist/plugins/git-status/plugin.d.ts +38 -7
- package/dist/plugins/git-status/plugin.d.ts.map +1 -1
- package/dist/plugins/git-status/plugin.js +169 -64
- package/dist/plugins/git-status/plugin.js.map +1 -1
- package/dist/plugins/llm-debug/plugin.d.ts.map +1 -1
- package/dist/plugins/llm-debug/plugin.js +1 -0
- package/dist/plugins/llm-debug/plugin.js.map +1 -1
- package/dist/plugins/logs/plugin.d.ts +1 -4
- package/dist/plugins/logs/plugin.d.ts.map +1 -1
- package/dist/plugins/logs/plugin.js +7 -0
- package/dist/plugins/logs/plugin.js.map +1 -1
- package/dist/plugins/mailbox/helpers.d.ts +2 -2
- package/dist/plugins/mailbox/helpers.js +1 -1
- package/dist/plugins/mailbox/plugin.d.ts.map +1 -1
- package/dist/plugins/mailbox/plugin.js +38 -43
- package/dist/plugins/mailbox/plugin.js.map +1 -1
- package/dist/plugins/mailbox/query.d.ts +7 -2
- package/dist/plugins/mailbox/query.d.ts.map +1 -1
- package/dist/plugins/mailbox/query.js +14 -7
- package/dist/plugins/mailbox/query.js.map +1 -1
- package/dist/plugins/mailbox/state.d.ts +5 -4
- package/dist/plugins/mailbox/state.d.ts.map +1 -1
- package/dist/plugins/mailbox/state.js +6 -5
- package/dist/plugins/mailbox/state.js.map +1 -1
- package/dist/plugins/resources/filename.d.ts +4 -0
- package/dist/plugins/resources/filename.d.ts.map +1 -0
- package/dist/plugins/resources/filename.js +18 -0
- package/dist/plugins/resources/filename.js.map +1 -0
- package/dist/plugins/resources/plugin.d.ts +3 -0
- package/dist/plugins/resources/plugin.d.ts.map +1 -1
- package/dist/plugins/resources/plugin.js +97 -60
- package/dist/plugins/resources/plugin.js.map +1 -1
- package/dist/plugins/resources/state.d.ts +1 -1
- package/dist/plugins/resources/state.js +1 -1
- package/dist/plugins/result-eviction/plugin.d.ts.map +1 -1
- package/dist/plugins/result-eviction/plugin.js +6 -1
- package/dist/plugins/result-eviction/plugin.js.map +1 -1
- package/dist/plugins/services/plugin.d.ts +4 -1
- package/dist/plugins/services/plugin.d.ts.map +1 -1
- package/dist/plugins/services/plugin.js +251 -100
- package/dist/plugins/services/plugin.js.map +1 -1
- package/dist/plugins/services/prompt.d.ts.map +1 -1
- package/dist/plugins/services/prompt.js +1 -4
- package/dist/plugins/services/prompt.js.map +1 -1
- package/dist/plugins/services/schema.d.ts +15 -5
- package/dist/plugins/services/schema.d.ts.map +1 -1
- package/dist/plugins/services/service.d.ts +100 -18
- package/dist/plugins/services/service.d.ts.map +1 -1
- package/dist/plugins/services/service.js +680 -230
- package/dist/plugins/services/service.js.map +1 -1
- package/dist/plugins/session-lifecycle/plugin.d.ts +21 -1
- package/dist/plugins/session-lifecycle/plugin.d.ts.map +1 -1
- package/dist/plugins/session-lifecycle/plugin.js +53 -40
- package/dist/plugins/session-lifecycle/plugin.js.map +1 -1
- package/dist/plugins/session-state/plugin.d.ts +21 -13
- package/dist/plugins/session-state/plugin.d.ts.map +1 -1
- package/dist/plugins/session-state/plugin.js +214 -79
- package/dist/plugins/session-state/plugin.js.map +1 -1
- package/dist/plugins/session-stats/plugin.d.ts.map +1 -1
- package/dist/plugins/session-stats/plugin.js +1 -0
- package/dist/plugins/session-stats/plugin.js.map +1 -1
- package/dist/plugins/shell/executor.d.ts +17 -15
- package/dist/plugins/shell/executor.d.ts.map +1 -1
- package/dist/plugins/shell/executor.js +130 -195
- package/dist/plugins/shell/executor.js.map +1 -1
- package/dist/plugins/shell/index.d.ts +2 -2
- package/dist/plugins/shell/index.d.ts.map +1 -1
- package/dist/plugins/shell/index.js +2 -2
- package/dist/plugins/shell/index.js.map +1 -1
- package/dist/plugins/shell/plugin.d.ts +5 -4
- package/dist/plugins/shell/plugin.d.ts.map +1 -1
- package/dist/plugins/shell/plugin.js +4 -8
- package/dist/plugins/shell/plugin.js.map +1 -1
- package/dist/plugins/skills/discovery.d.ts.map +1 -1
- package/dist/plugins/skills/discovery.js +10 -8
- package/dist/plugins/skills/discovery.js.map +1 -1
- package/dist/plugins/skills/index.d.ts +1 -1
- package/dist/plugins/skills/index.d.ts.map +1 -1
- package/dist/plugins/skills/plugin.d.ts +1 -1
- package/dist/plugins/skills/plugin.d.ts.map +1 -1
- package/dist/plugins/skills/plugin.js +23 -30
- package/dist/plugins/skills/plugin.js.map +1 -1
- package/dist/plugins/skills/prompts.d.ts +3 -3
- package/dist/plugins/skills/prompts.d.ts.map +1 -1
- package/dist/plugins/skills/prompts.js.map +1 -1
- package/dist/plugins/skills/schema.d.ts +4 -2
- package/dist/plugins/skills/schema.d.ts.map +1 -1
- package/dist/plugins/todo/schema.d.ts +1 -1
- package/dist/plugins/uploads/plugin.d.ts +11 -4
- package/dist/plugins/uploads/plugin.d.ts.map +1 -1
- package/dist/plugins/uploads/plugin.js +891 -225
- package/dist/plugins/uploads/plugin.js.map +1 -1
- package/dist/plugins/uploads/preprocessor.d.ts +14 -0
- package/dist/plugins/uploads/preprocessor.d.ts.map +1 -1
- package/dist/plugins/uploads/preprocessor.js +11 -0
- package/dist/plugins/uploads/preprocessor.js.map +1 -1
- package/dist/plugins/uploads/preprocessors/image-classifier.d.ts +1 -1
- package/dist/plugins/uploads/preprocessors/image-classifier.d.ts.map +1 -1
- package/dist/plugins/uploads/preprocessors/image-classifier.js +51 -26
- package/dist/plugins/uploads/preprocessors/image-classifier.js.map +1 -1
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.d.ts +2 -2
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.d.ts.map +1 -1
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.js +41 -16
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.js.map +1 -1
- package/dist/plugins/uploads/preprocessors/pdf-preprocessor.d.ts +1 -1
- package/dist/plugins/uploads/preprocessors/pdf-preprocessor.d.ts.map +1 -1
- package/dist/plugins/uploads/preprocessors/pdf-preprocessor.js +29 -14
- package/dist/plugins/uploads/preprocessors/pdf-preprocessor.js.map +1 -1
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.d.ts +1 -1
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.d.ts.map +1 -1
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.js +62 -34
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.js.map +1 -1
- package/dist/plugins/uploads/schema.d.ts +25 -2
- package/dist/plugins/uploads/schema.d.ts.map +1 -1
- package/dist/plugins/uploads/schema.js +24 -3
- package/dist/plugins/uploads/schema.js.map +1 -1
- package/dist/plugins/uploads/state.d.ts +13 -1
- package/dist/plugins/uploads/state.d.ts.map +1 -1
- package/dist/plugins/uploads/state.js +4 -1
- package/dist/plugins/uploads/state.js.map +1 -1
- package/dist/plugins/user-chat/plugin.d.ts +12 -5
- package/dist/plugins/user-chat/plugin.d.ts.map +1 -1
- package/dist/plugins/user-chat/plugin.js +141 -32
- package/dist/plugins/user-chat/plugin.js.map +1 -1
- package/dist/plugins/workers/context.d.ts +35 -13
- package/dist/plugins/workers/context.d.ts.map +1 -1
- package/dist/plugins/workers/context.js +82 -32
- package/dist/plugins/workers/context.js.map +1 -1
- package/dist/plugins/workers/definition.d.ts +7 -0
- package/dist/plugins/workers/definition.d.ts.map +1 -1
- package/dist/plugins/workers/definition.js.map +1 -1
- package/dist/plugins/workers/index.d.ts +4 -4
- package/dist/plugins/workers/index.d.ts.map +1 -1
- package/dist/plugins/workers/index.js +2 -2
- package/dist/plugins/workers/index.js.map +1 -1
- package/dist/plugins/workers/plugin.d.ts +10 -57
- package/dist/plugins/workers/plugin.d.ts.map +1 -1
- package/dist/plugins/workers/plugin.js +385 -123
- package/dist/plugins/workers/plugin.js.map +1 -1
- package/dist/plugins/workers/state.d.ts +69 -0
- package/dist/plugins/workers/state.d.ts.map +1 -0
- package/dist/plugins/workers/state.js +52 -0
- package/dist/plugins/workers/state.js.map +1 -0
- package/dist/plugins/workers/worker.d.ts +15 -4
- package/dist/plugins/workers/worker.d.ts.map +1 -1
- package/dist/testing/conformance.d.ts +106 -0
- package/dist/testing/conformance.d.ts.map +1 -0
- package/dist/testing/conformance.js +1463 -0
- package/dist/testing/conformance.js.map +1 -0
- package/dist/testing/node-platform.d.ts.map +1 -1
- package/dist/testing/node-platform.js +5 -0
- package/dist/testing/node-platform.js.map +1 -1
- package/dist/testing/test-harness.d.ts +11 -1
- package/dist/testing/test-harness.d.ts.map +1 -1
- package/dist/testing/test-harness.js +17 -37
- package/dist/testing/test-harness.js.map +1 -1
- package/dist/testing/wait-helpers.d.ts.map +1 -1
- package/dist/testing/wait-helpers.js +1 -3
- package/dist/testing/wait-helpers.js.map +1 -1
- package/dist/transport/adapter/client-adapter.d.ts +6 -0
- package/dist/transport/adapter/client-adapter.d.ts.map +1 -1
- package/dist/transport/adapter/client-adapter.js +50 -3
- package/dist/transport/adapter/client-adapter.js.map +1 -1
- package/dist/transport/adapter/heartbeat.d.ts +16 -0
- package/dist/transport/adapter/heartbeat.d.ts.map +1 -0
- package/dist/transport/adapter/heartbeat.js +41 -0
- package/dist/transport/adapter/heartbeat.js.map +1 -0
- package/dist/transport/adapter/server-adapter.d.ts.map +1 -1
- package/dist/transport/adapter/server-adapter.js +6 -0
- package/dist/transport/adapter/server-adapter.js.map +1 -1
- package/dist/transport/http/app.d.ts +3 -30
- package/dist/transport/http/app.d.ts.map +1 -1
- package/dist/transport/http/app.js +3 -7
- package/dist/transport/http/app.js.map +1 -1
- package/dist/transport/http/context.d.ts +40 -0
- package/dist/transport/http/context.d.ts.map +1 -0
- package/dist/transport/http/context.js +17 -0
- package/dist/transport/http/context.js.map +1 -0
- package/dist/transport/http/fetch-guard.d.ts +49 -0
- package/dist/transport/http/fetch-guard.d.ts.map +1 -0
- package/dist/transport/http/fetch-guard.js +312 -0
- package/dist/transport/http/fetch-guard.js.map +1 -0
- package/dist/transport/http/index.d.ts +1 -1
- package/dist/transport/http/index.d.ts.map +1 -1
- package/dist/transport/http/middleware/bearer-auth.d.ts +1 -1
- package/dist/transport/http/middleware/bearer-auth.d.ts.map +1 -1
- package/dist/transport/http/middleware/error-handler.d.ts +2 -2
- package/dist/transport/http/middleware/error-handler.d.ts.map +1 -1
- package/dist/transport/http/path-containment.d.ts +20 -0
- package/dist/transport/http/path-containment.d.ts.map +1 -0
- package/dist/transport/http/path-containment.js +31 -0
- package/dist/transport/http/path-containment.js.map +1 -0
- package/dist/transport/http/responses.d.ts +30 -0
- package/dist/transport/http/responses.d.ts.map +1 -0
- package/dist/transport/http/responses.js +5 -0
- package/dist/transport/http/responses.js.map +1 -0
- package/dist/transport/http/routes/files.d.ts +1 -1
- package/dist/transport/http/routes/files.d.ts.map +1 -1
- package/dist/transport/http/routes/files.js +54 -155
- package/dist/transport/http/routes/files.js.map +1 -1
- package/dist/transport/http/routes/resources.d.ts +1 -1
- package/dist/transport/http/routes/resources.d.ts.map +1 -1
- package/dist/transport/http/routes/resources.js +92 -57
- package/dist/transport/http/routes/resources.js.map +1 -1
- package/dist/transport/http/routes/rpc.d.ts +6 -1
- package/dist/transport/http/routes/rpc.d.ts.map +1 -1
- package/dist/transport/http/routes/rpc.js +51 -21
- package/dist/transport/http/routes/rpc.js.map +1 -1
- package/dist/transport/http/routes/upload.d.ts +1 -1
- package/dist/transport/http/routes/upload.d.ts.map +1 -1
- package/dist/transport/http/routes/upload.js +256 -169
- package/dist/transport/http/routes/upload.js.map +1 -1
- package/dist/user-config.d.ts +34 -7
- package/dist/user-config.d.ts.map +1 -1
- package/dist/user-config.js +71 -0
- package/dist/user-config.js.map +1 -1
- package/package.json +17 -7
- package/src/bootstrap.ts +119 -35
- package/src/bun-platform/fs.ts +1 -0
- package/src/bun-platform/index.ts +18 -1
- package/src/bun-platform/server-lifecycle.ts +218 -0
- package/src/bun-platform/shell.ts +362 -0
- package/src/config.ts +130 -0
- package/src/core/agents/agent.ts +210 -92
- package/src/core/agents/config.ts +8 -0
- package/src/core/agents/retry.ts +16 -17
- package/src/core/agents/state.ts +2 -0
- package/src/core/events/base-event-store.ts +24 -16
- package/src/core/events/file.ts +198 -22
- package/src/core/file-store/containment.ts +75 -0
- package/src/core/file-store/file-store.ts +106 -25
- package/src/core/file-store/types.ts +14 -1
- package/src/core/image/image-processor.ts +3 -1
- package/src/core/image/types.ts +2 -0
- package/src/core/image/vips-resizer.ts +102 -37
- package/src/core/llm/anthropic.ts +63 -79
- package/src/core/llm/logger.ts +175 -37
- package/src/core/llm/openrouter.ts +57 -72
- package/src/core/llm/provider-request.ts +40 -0
- package/src/core/llm/provider.ts +28 -0
- package/src/core/plugins/plugin-builder.ts +106 -14
- package/src/core/preset/preset-builder.ts +12 -22
- package/src/core/sessions/context.ts +18 -0
- package/src/core/sessions/runtime-activity.ts +78 -0
- package/src/core/sessions/schema.ts +29 -3
- package/src/core/sessions/session-manager.ts +560 -140
- package/src/core/sessions/session-store.ts +38 -0
- package/src/core/sessions/session.ts +187 -47
- package/src/core/sessions/state.ts +11 -0
- package/src/core/system.ts +15 -0
- package/src/core/wake-key.ts +65 -0
- package/src/index.ts +32 -12
- package/src/lib/archive/archive-inspection.fixtures.ts +138 -0
- package/src/lib/archive/archive-inspection.ts +359 -0
- package/src/lib/archive/index.ts +17 -0
- package/src/lib/logger/console.ts +7 -57
- package/src/lib/logger/file.ts +28 -50
- package/src/lib/logger/index.ts +3 -1
- package/src/lib/logger/jsonl.ts +36 -0
- package/src/lib/logger/logger.ts +48 -0
- package/src/lib/logger/session-log.ts +42 -0
- package/src/lib/utils/concurrency.ts +37 -8
- package/src/lib/utils/fs-batch.ts +49 -0
- package/src/lib/utils/result.ts +7 -31
- package/src/lib/utils/sleep.ts +23 -0
- package/src/platform/fs-revision.ts +21 -0
- package/src/platform/fs.ts +109 -1
- package/src/platform/git.ts +67 -0
- package/src/platform/index.ts +51 -1
- package/src/platform/llm-call-log.ts +86 -0
- package/src/platform/scheduler.ts +71 -0
- package/src/platform/session-log.ts +39 -0
- package/src/platform/shell.ts +89 -0
- package/src/plugins/agent-status/plugin.ts +1 -0
- package/src/plugins/agents/plugin.ts +134 -81
- package/src/plugins/filesystem/listing.ts +70 -12
- package/src/plugins/filesystem/plugin.ts +8 -6
- package/src/plugins/git-status/index.ts +1 -0
- package/src/plugins/git-status/plugin.ts +211 -77
- package/src/plugins/llm-debug/plugin.ts +1 -0
- package/src/plugins/logs/plugin.ts +9 -0
- package/src/plugins/mailbox/plugin.ts +46 -64
- package/src/plugins/mailbox/query.ts +15 -7
- package/src/plugins/mailbox/state.ts +1 -0
- package/src/plugins/resources/filename.ts +19 -0
- package/src/plugins/resources/plugin.ts +111 -59
- package/src/plugins/result-eviction/plugin.ts +6 -1
- package/src/plugins/services/plugin.ts +254 -98
- package/src/plugins/services/prompt.ts +1 -6
- package/src/plugins/services/schema.ts +17 -3
- package/src/plugins/services/service.ts +702 -252
- package/src/plugins/session-lifecycle/plugin.ts +56 -41
- package/src/plugins/session-state/plugin.ts +242 -88
- package/src/plugins/session-stats/plugin.ts +1 -0
- package/src/plugins/shell/executor.ts +144 -226
- package/src/plugins/shell/index.ts +1 -4
- package/src/plugins/shell/plugin.ts +7 -9
- package/src/plugins/skills/discovery.ts +10 -8
- package/src/plugins/skills/index.ts +1 -1
- package/src/plugins/skills/plugin.ts +19 -27
- package/src/plugins/skills/prompts.ts +3 -3
- package/src/plugins/skills/schema.ts +5 -2
- package/src/plugins/uploads/plugin.ts +991 -273
- package/src/plugins/uploads/preprocessor.ts +25 -0
- package/src/plugins/uploads/preprocessors/image-classifier.ts +56 -25
- package/src/plugins/uploads/preprocessors/markitdown-preprocessor.ts +41 -15
- package/src/plugins/uploads/preprocessors/pdf-preprocessor.ts +32 -16
- package/src/plugins/uploads/preprocessors/zip-preprocessor.ts +67 -38
- package/src/plugins/uploads/schema.ts +30 -3
- package/src/plugins/uploads/state.ts +12 -0
- package/src/plugins/user-chat/plugin.ts +196 -40
- package/src/plugins/workers/context.ts +102 -39
- package/src/plugins/workers/definition.ts +7 -0
- package/src/plugins/workers/index.ts +4 -4
- package/src/plugins/workers/plugin.ts +461 -151
- package/src/plugins/workers/state.ts +64 -0
- package/src/plugins/workers/worker.ts +15 -4
- package/src/testing/conformance.ts +1751 -0
- package/src/testing/node-platform.ts +5 -0
- package/src/testing/test-harness.ts +21 -38
- package/src/testing/wait-helpers.ts +1 -4
- package/src/transport/adapter/client-adapter.ts +60 -3
- package/src/transport/adapter/heartbeat.ts +50 -0
- package/src/transport/adapter/server-adapter.ts +6 -0
- package/src/transport/http/app.ts +7 -35
- package/src/transport/http/context.ts +46 -0
- package/src/transport/http/fetch-guard.ts +318 -0
- package/src/transport/http/index.ts +1 -1
- package/src/transport/http/middleware/bearer-auth.ts +1 -1
- package/src/transport/http/middleware/error-handler.ts +1 -1
- package/src/transport/http/path-containment.ts +44 -0
- package/src/transport/http/responses.ts +20 -0
- package/src/transport/http/routes/files.ts +69 -159
- package/src/transport/http/routes/resources.ts +124 -93
- package/src/transport/http/routes/rpc.ts +63 -26
- package/src/transport/http/routes/upload.ts +327 -258
- package/src/user-config.ts +93 -7
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -155
- package/dist/config.test.js.map +0 -1
- package/dist/core/agent-loop.integration.test.d.ts +0 -2
- package/dist/core/agent-loop.integration.test.d.ts.map +0 -1
- package/dist/core/agent-loop.integration.test.js +0 -414
- package/dist/core/agent-loop.integration.test.js.map +0 -1
- package/dist/core/agents/agent-config.test.d.ts +0 -2
- package/dist/core/agents/agent-config.test.d.ts.map +0 -1
- package/dist/core/agents/agent-config.test.js +0 -194
- package/dist/core/agents/agent-config.test.js.map +0 -1
- package/dist/core/agents/agent-shutdown.test.d.ts +0 -6
- package/dist/core/agents/agent-shutdown.test.d.ts.map +0 -1
- package/dist/core/agents/agent-shutdown.test.js +0 -180
- package/dist/core/agents/agent-shutdown.test.js.map +0 -1
- package/dist/core/agents/agent.test.d.ts +0 -2
- package/dist/core/agents/agent.test.d.ts.map +0 -1
- package/dist/core/agents/agent.test.js +0 -313
- package/dist/core/agents/agent.test.js.map +0 -1
- package/dist/core/agents/communicator.d.ts +0 -3
- package/dist/core/agents/communicator.d.ts.map +0 -1
- package/dist/core/agents/communicator.js +0 -13
- package/dist/core/agents/communicator.js.map +0 -1
- package/dist/core/agents/handler-events.test.d.ts +0 -5
- package/dist/core/agents/handler-events.test.d.ts.map +0 -1
- package/dist/core/agents/handler-events.test.js +0 -115
- package/dist/core/agents/handler-events.test.js.map +0 -1
- package/dist/core/agents/response-sanitizer.test.d.ts +0 -2
- package/dist/core/agents/response-sanitizer.test.d.ts.map +0 -1
- package/dist/core/agents/response-sanitizer.test.js +0 -101
- package/dist/core/agents/response-sanitizer.test.js.map +0 -1
- package/dist/core/error-recovery.integration.test.d.ts +0 -2
- package/dist/core/error-recovery.integration.test.d.ts.map +0 -1
- package/dist/core/error-recovery.integration.test.js +0 -288
- package/dist/core/error-recovery.integration.test.js.map +0 -1
- package/dist/core/event-sourcing.integration.test.d.ts +0 -2
- package/dist/core/event-sourcing.integration.test.d.ts.map +0 -1
- package/dist/core/event-sourcing.integration.test.js +0 -154
- package/dist/core/event-sourcing.integration.test.js.map +0 -1
- package/dist/core/events/file.test.d.ts +0 -2
- package/dist/core/events/file.test.d.ts.map +0 -1
- package/dist/core/events/file.test.js +0 -284
- package/dist/core/events/file.test.js.map +0 -1
- package/dist/core/events/memory.test.d.ts +0 -2
- package/dist/core/events/memory.test.d.ts.map +0 -1
- package/dist/core/events/memory.test.js +0 -502
- package/dist/core/events/memory.test.js.map +0 -1
- package/dist/core/image/image-processor.test.d.ts +0 -2
- package/dist/core/image/image-processor.test.d.ts.map +0 -1
- package/dist/core/image/image-processor.test.js +0 -171
- package/dist/core/image/image-processor.test.js.map +0 -1
- package/dist/core/image/vips-resizer.test.d.ts +0 -2
- package/dist/core/image/vips-resizer.test.d.ts.map +0 -1
- package/dist/core/image/vips-resizer.test.js +0 -336
- package/dist/core/image/vips-resizer.test.js.map +0 -1
- package/dist/core/llm/anthropic.test.d.ts +0 -2
- package/dist/core/llm/anthropic.test.d.ts.map +0 -1
- package/dist/core/llm/anthropic.test.js +0 -464
- package/dist/core/llm/anthropic.test.js.map +0 -1
- package/dist/core/llm/cache-breakpoints.test.d.ts +0 -2
- package/dist/core/llm/cache-breakpoints.test.d.ts.map +0 -1
- package/dist/core/llm/cache-breakpoints.test.js +0 -69
- package/dist/core/llm/cache-breakpoints.test.js.map +0 -1
- package/dist/core/llm/cache-live.test.d.ts +0 -16
- package/dist/core/llm/cache-live.test.d.ts.map +0 -1
- package/dist/core/llm/cache-live.test.js +0 -137
- package/dist/core/llm/cache-live.test.js.map +0 -1
- package/dist/core/llm/logger.test.d.ts +0 -7
- package/dist/core/llm/logger.test.d.ts.map +0 -1
- package/dist/core/llm/logger.test.js +0 -228
- package/dist/core/llm/logger.test.js.map +0 -1
- package/dist/core/llm/message-sanitization.test.d.ts +0 -2
- package/dist/core/llm/message-sanitization.test.d.ts.map +0 -1
- package/dist/core/llm/message-sanitization.test.js +0 -181
- package/dist/core/llm/message-sanitization.test.js.map +0 -1
- package/dist/core/llm/mock.test.d.ts +0 -2
- package/dist/core/llm/mock.test.d.ts.map +0 -1
- package/dist/core/llm/mock.test.js +0 -318
- package/dist/core/llm/mock.test.js.map +0 -1
- package/dist/core/llm/model-shortlist-live.test.d.ts +0 -35
- package/dist/core/llm/model-shortlist-live.test.d.ts.map +0 -1
- package/dist/core/llm/model-shortlist-live.test.js +0 -452
- package/dist/core/llm/model-shortlist-live.test.js.map +0 -1
- package/dist/core/llm/openrouter-mapping.test.d.ts +0 -2
- package/dist/core/llm/openrouter-mapping.test.d.ts.map +0 -1
- package/dist/core/llm/openrouter-mapping.test.js +0 -190
- package/dist/core/llm/openrouter-mapping.test.js.map +0 -1
- package/dist/core/llm/openrouter.test.d.ts +0 -2
- package/dist/core/llm/openrouter.test.d.ts.map +0 -1
- package/dist/core/llm/openrouter.test.js +0 -377
- package/dist/core/llm/openrouter.test.js.map +0 -1
- package/dist/core/llm/provider-integration.test.d.ts +0 -12
- package/dist/core/llm/provider-integration.test.d.ts.map +0 -1
- package/dist/core/llm/provider-integration.test.js +0 -350
- package/dist/core/llm/provider-integration.test.js.map +0 -1
- package/dist/core/llm/reasoning-details.test.d.ts +0 -2
- package/dist/core/llm/reasoning-details.test.d.ts.map +0 -1
- package/dist/core/llm/reasoning-details.test.js +0 -144
- package/dist/core/llm/reasoning-details.test.js.map +0 -1
- package/dist/core/llm/routing-provider.test.d.ts +0 -2
- package/dist/core/llm/routing-provider.test.d.ts.map +0 -1
- package/dist/core/llm/routing-provider.test.js +0 -94
- package/dist/core/llm/routing-provider.test.js.map +0 -1
- package/dist/core/llm/snapshot-middleware.test.d.ts +0 -2
- package/dist/core/llm/snapshot-middleware.test.d.ts.map +0 -1
- package/dist/core/llm/snapshot-middleware.test.js +0 -144
- package/dist/core/llm/snapshot-middleware.test.js.map +0 -1
- package/dist/core/llm/thinking-blocks.test.d.ts +0 -2
- package/dist/core/llm/thinking-blocks.test.d.ts.map +0 -1
- package/dist/core/llm/thinking-blocks.test.js +0 -291
- package/dist/core/llm/thinking-blocks.test.js.map +0 -1
- package/dist/core/multi-agent.integration.test.d.ts +0 -2
- package/dist/core/multi-agent.integration.test.d.ts.map +0 -1
- package/dist/core/multi-agent.integration.test.js +0 -298
- package/dist/core/multi-agent.integration.test.js.map +0 -1
- package/dist/core/plugin-hooks.integration.test.d.ts +0 -2
- package/dist/core/plugin-hooks.integration.test.d.ts.map +0 -1
- package/dist/core/plugin-hooks.integration.test.js +0 -458
- package/dist/core/plugin-hooks.integration.test.js.map +0 -1
- package/dist/core/reasoning-round-trip.integration.test.d.ts +0 -2
- package/dist/core/reasoning-round-trip.integration.test.d.ts.map +0 -1
- package/dist/core/reasoning-round-trip.integration.test.js +0 -150
- package/dist/core/reasoning-round-trip.integration.test.js.map +0 -1
- package/dist/core/session-lifecycle.integration.test.d.ts +0 -2
- package/dist/core/session-lifecycle.integration.test.d.ts.map +0 -1
- package/dist/core/session-lifecycle.integration.test.js +0 -159
- package/dist/core/session-lifecycle.integration.test.js.map +0 -1
- package/dist/core/sessions/fork-utils.test.d.ts +0 -2
- package/dist/core/sessions/fork-utils.test.d.ts.map +0 -1
- package/dist/core/sessions/fork-utils.test.js +0 -129
- package/dist/core/sessions/fork-utils.test.js.map +0 -1
- package/dist/core/sessions/session-overrides.integration.test.d.ts +0 -2
- package/dist/core/sessions/session-overrides.integration.test.d.ts.map +0 -1
- package/dist/core/sessions/session-overrides.integration.test.js +0 -154
- package/dist/core/sessions/session-overrides.integration.test.js.map +0 -1
- package/dist/core/sessions/session.test.d.ts +0 -2
- package/dist/core/sessions/session.test.d.ts.map +0 -1
- package/dist/core/sessions/session.test.js +0 -1100
- package/dist/core/sessions/session.test.js.map +0 -1
- package/dist/core/tools/executor.test.d.ts +0 -2
- package/dist/core/tools/executor.test.d.ts.map +0 -1
- package/dist/core/tools/executor.test.js +0 -144
- package/dist/core/tools/executor.test.js.map +0 -1
- package/dist/lib/logger/console.test.d.ts +0 -2
- package/dist/lib/logger/console.test.d.ts.map +0 -1
- package/dist/lib/logger/console.test.js +0 -258
- package/dist/lib/logger/console.test.js.map +0 -1
- package/dist/lib/never.d.ts +0 -2
- package/dist/lib/never.d.ts.map +0 -1
- package/dist/lib/never.js +0 -4
- package/dist/lib/never.js.map +0 -1
- package/dist/lib/utils/concurrency.test.d.ts +0 -2
- package/dist/lib/utils/concurrency.test.d.ts.map +0 -1
- package/dist/lib/utils/concurrency.test.js +0 -135
- package/dist/lib/utils/concurrency.test.js.map +0 -1
- package/dist/plugins/agent-status/agent-status.test.d.ts +0 -2
- package/dist/plugins/agent-status/agent-status.test.d.ts.map +0 -1
- package/dist/plugins/agent-status/agent-status.test.js +0 -136
- package/dist/plugins/agent-status/agent-status.test.js.map +0 -1
- package/dist/plugins/agents/agents.integration.test.d.ts +0 -2
- package/dist/plugins/agents/agents.integration.test.d.ts.map +0 -1
- package/dist/plugins/agents/agents.integration.test.js +0 -830
- package/dist/plugins/agents/agents.integration.test.js.map +0 -1
- package/dist/plugins/agents/supervision.integration.test.d.ts +0 -2
- package/dist/plugins/agents/supervision.integration.test.d.ts.map +0 -1
- package/dist/plugins/agents/supervision.integration.test.js +0 -215
- package/dist/plugins/agents/supervision.integration.test.js.map +0 -1
- package/dist/plugins/context-compact/compaction-live.test.d.ts +0 -17
- package/dist/plugins/context-compact/compaction-live.test.d.ts.map +0 -1
- package/dist/plugins/context-compact/compaction-live.test.js +0 -177
- package/dist/plugins/context-compact/compaction-live.test.js.map +0 -1
- package/dist/plugins/context-compact/context-compact.integration.test.d.ts +0 -2
- package/dist/plugins/context-compact/context-compact.integration.test.d.ts.map +0 -1
- package/dist/plugins/context-compact/context-compact.integration.test.js +0 -364
- package/dist/plugins/context-compact/context-compact.integration.test.js.map +0 -1
- package/dist/plugins/context-compact/context-compactor.test.d.ts +0 -2
- package/dist/plugins/context-compact/context-compactor.test.d.ts.map +0 -1
- package/dist/plugins/context-compact/context-compactor.test.js +0 -858
- package/dist/plugins/context-compact/context-compactor.test.js.map +0 -1
- package/dist/plugins/context-compact/history-offloader.test.d.ts +0 -2
- package/dist/plugins/context-compact/history-offloader.test.d.ts.map +0 -1
- package/dist/plugins/context-compact/history-offloader.test.js +0 -77
- package/dist/plugins/context-compact/history-offloader.test.js.map +0 -1
- package/dist/plugins/filesystem/filesystem.integration.test.d.ts +0 -2
- package/dist/plugins/filesystem/filesystem.integration.test.d.ts.map +0 -1
- package/dist/plugins/filesystem/filesystem.integration.test.js +0 -447
- package/dist/plugins/filesystem/filesystem.integration.test.js.map +0 -1
- package/dist/plugins/filesystem/schema.d.ts +0 -7
- package/dist/plugins/filesystem/schema.d.ts.map +0 -1
- package/dist/plugins/filesystem/schema.js +0 -2
- package/dist/plugins/filesystem/schema.js.map +0 -1
- package/dist/plugins/limits-guard/limit-guard.test.d.ts +0 -2
- package/dist/plugins/limits-guard/limit-guard.test.d.ts.map +0 -1
- package/dist/plugins/limits-guard/limit-guard.test.js +0 -194
- package/dist/plugins/limits-guard/limit-guard.test.js.map +0 -1
- package/dist/plugins/limits-guard/limits-guard.integration.test.d.ts +0 -2
- package/dist/plugins/limits-guard/limits-guard.integration.test.d.ts.map +0 -1
- package/dist/plugins/limits-guard/limits-guard.integration.test.js +0 -887
- package/dist/plugins/limits-guard/limits-guard.integration.test.js.map +0 -1
- package/dist/plugins/llm-debug/llm-debug.integration.test.d.ts +0 -2
- package/dist/plugins/llm-debug/llm-debug.integration.test.d.ts.map +0 -1
- package/dist/plugins/llm-debug/llm-debug.integration.test.js +0 -157
- package/dist/plugins/llm-debug/llm-debug.integration.test.js.map +0 -1
- package/dist/plugins/mailbox/mailbox.integration.test.d.ts +0 -2
- package/dist/plugins/mailbox/mailbox.integration.test.d.ts.map +0 -1
- package/dist/plugins/mailbox/mailbox.integration.test.js +0 -678
- package/dist/plugins/mailbox/mailbox.integration.test.js.map +0 -1
- package/dist/plugins/resources/resources.integration.test.d.ts +0 -2
- package/dist/plugins/resources/resources.integration.test.d.ts.map +0 -1
- package/dist/plugins/resources/resources.integration.test.js +0 -62
- package/dist/plugins/resources/resources.integration.test.js.map +0 -1
- package/dist/plugins/result-eviction/result-eviction.integration.test.d.ts +0 -2
- package/dist/plugins/result-eviction/result-eviction.integration.test.d.ts.map +0 -1
- package/dist/plugins/result-eviction/result-eviction.integration.test.js +0 -294
- package/dist/plugins/result-eviction/result-eviction.integration.test.js.map +0 -1
- package/dist/plugins/services/pid-registry.test.d.ts +0 -2
- package/dist/plugins/services/pid-registry.test.d.ts.map +0 -1
- package/dist/plugins/services/pid-registry.test.js +0 -161
- package/dist/plugins/services/pid-registry.test.js.map +0 -1
- package/dist/plugins/services/services.integration.test.d.ts +0 -2
- package/dist/plugins/services/services.integration.test.d.ts.map +0 -1
- package/dist/plugins/services/services.integration.test.js +0 -1057
- package/dist/plugins/services/services.integration.test.js.map +0 -1
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.d.ts +0 -2
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.d.ts.map +0 -1
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.js +0 -498
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.js.map +0 -1
- package/dist/plugins/session-stats/plugin.test.d.ts +0 -2
- package/dist/plugins/session-stats/plugin.test.d.ts.map +0 -1
- package/dist/plugins/session-stats/plugin.test.js +0 -145
- package/dist/plugins/session-stats/plugin.test.js.map +0 -1
- package/dist/plugins/shell/shell.integration.test.d.ts +0 -2
- package/dist/plugins/shell/shell.integration.test.d.ts.map +0 -1
- package/dist/plugins/shell/shell.integration.test.js +0 -234
- package/dist/plugins/shell/shell.integration.test.js.map +0 -1
- package/dist/plugins/shell/shell.test.d.ts +0 -2
- package/dist/plugins/shell/shell.test.d.ts.map +0 -1
- package/dist/plugins/shell/shell.test.js +0 -236
- package/dist/plugins/shell/shell.test.js.map +0 -1
- package/dist/plugins/skills/discovery.test.d.ts +0 -2
- package/dist/plugins/skills/discovery.test.d.ts.map +0 -1
- package/dist/plugins/skills/discovery.test.js +0 -312
- package/dist/plugins/skills/discovery.test.js.map +0 -1
- package/dist/plugins/skills/skills.integration.test.d.ts +0 -2
- package/dist/plugins/skills/skills.integration.test.d.ts.map +0 -1
- package/dist/plugins/skills/skills.integration.test.js +0 -475
- package/dist/plugins/skills/skills.integration.test.js.map +0 -1
- package/dist/plugins/todo/todo.integration.test.d.ts +0 -2
- package/dist/plugins/todo/todo.integration.test.d.ts.map +0 -1
- package/dist/plugins/todo/todo.integration.test.js +0 -605
- package/dist/plugins/todo/todo.integration.test.js.map +0 -1
- package/dist/plugins/uploads/preprocessors/image-classifier.test.d.ts +0 -2
- package/dist/plugins/uploads/preprocessors/image-classifier.test.d.ts.map +0 -1
- package/dist/plugins/uploads/preprocessors/image-classifier.test.js +0 -113
- package/dist/plugins/uploads/preprocessors/image-classifier.test.js.map +0 -1
- package/dist/plugins/uploads/uploads.integration.test.d.ts +0 -2
- package/dist/plugins/uploads/uploads.integration.test.d.ts.map +0 -1
- package/dist/plugins/uploads/uploads.integration.test.js +0 -639
- package/dist/plugins/uploads/uploads.integration.test.js.map +0 -1
- package/dist/plugins/user-chat/user-chat.integration.test.d.ts +0 -2
- package/dist/plugins/user-chat/user-chat.integration.test.d.ts.map +0 -1
- package/dist/plugins/user-chat/user-chat.integration.test.js +0 -754
- package/dist/plugins/user-chat/user-chat.integration.test.js.map +0 -1
- package/dist/plugins/workers/workers.integration.test.d.ts +0 -2
- package/dist/plugins/workers/workers.integration.test.d.ts.map +0 -1
- package/dist/plugins/workers/workers.integration.test.js +0 -629
- package/dist/plugins/workers/workers.integration.test.js.map +0 -1
- package/dist/prompts/macros.test.d.ts +0 -2
- package/dist/prompts/macros.test.d.ts.map +0 -1
- package/dist/prompts/macros.test.js +0 -80
- package/dist/prompts/macros.test.js.map +0 -1
- package/dist/testing/test-harness.test.d.ts +0 -2
- package/dist/testing/test-harness.test.d.ts.map +0 -1
- package/dist/testing/test-harness.test.js +0 -92
- package/dist/testing/test-harness.test.js.map +0 -1
- package/dist/transport/http/routes/rpc.integration.test.d.ts +0 -2
- package/dist/transport/http/routes/rpc.integration.test.d.ts.map +0 -1
- package/dist/transport/http/routes/rpc.integration.test.js +0 -189
- package/dist/transport/http/routes/rpc.integration.test.js.map +0 -1
- package/dist/transport/http/routes/rpc.test.d.ts +0 -2
- package/dist/transport/http/routes/rpc.test.d.ts.map +0 -1
- package/dist/transport/http/routes/rpc.test.js +0 -316
- package/dist/transport/http/routes/rpc.test.js.map +0 -1
- package/src/config.test.ts +0 -174
- package/src/core/agent-loop.integration.test.ts +0 -503
- package/src/core/agents/agent-config.test.ts +0 -240
- package/src/core/agents/agent-shutdown.test.ts +0 -236
- package/src/core/agents/agent.test.ts +0 -387
- package/src/core/agents/communicator.ts +0 -16
- package/src/core/agents/handler-events.test.ts +0 -167
- package/src/core/agents/response-sanitizer.test.ts +0 -137
- package/src/core/error-recovery.integration.test.ts +0 -343
- package/src/core/event-sourcing.integration.test.ts +0 -191
- package/src/core/events/file.test.ts +0 -436
- package/src/core/events/memory.test.ts +0 -741
- package/src/core/image/image-processor.test.ts +0 -218
- package/src/core/image/vips-resizer.test.ts +0 -388
- package/src/core/llm/anthropic.test.ts +0 -546
- package/src/core/llm/cache-breakpoints.test.ts +0 -85
- package/src/core/llm/cache-live.test.ts +0 -155
- package/src/core/llm/logger.test.ts +0 -270
- package/src/core/llm/message-sanitization.test.ts +0 -217
- package/src/core/llm/mock.test.ts +0 -402
- package/src/core/llm/model-shortlist-live.test.ts +0 -577
- package/src/core/llm/openrouter-mapping.test.ts +0 -234
- package/src/core/llm/openrouter.test.ts +0 -499
- package/src/core/llm/provider-integration.test.ts +0 -408
- package/src/core/llm/reasoning-details.test.ts +0 -177
- package/src/core/llm/routing-provider.test.ts +0 -113
- package/src/core/llm/snapshot-middleware.test.ts +0 -168
- package/src/core/llm/thinking-blocks.test.ts +0 -345
- package/src/core/multi-agent.integration.test.ts +0 -340
- package/src/core/plugin-hooks.integration.test.ts +0 -568
- package/src/core/reasoning-round-trip.integration.test.ts +0 -188
- package/src/core/session-lifecycle.integration.test.ts +0 -202
- package/src/core/sessions/fork-utils.test.ts +0 -158
- package/src/core/sessions/session-overrides.integration.test.ts +0 -210
- package/src/core/sessions/session.test.ts +0 -1736
- package/src/core/tools/executor.test.ts +0 -161
- package/src/lib/logger/console.test.ts +0 -348
- package/src/lib/never.ts +0 -3
- package/src/lib/utils/concurrency.test.ts +0 -169
- package/src/plugins/agent-status/agent-status.test.ts +0 -164
- package/src/plugins/agents/agents.integration.test.ts +0 -976
- package/src/plugins/agents/supervision.integration.test.ts +0 -249
- package/src/plugins/context-compact/compaction-live.test.ts +0 -221
- package/src/plugins/context-compact/context-compact.integration.test.ts +0 -418
- package/src/plugins/context-compact/context-compactor.test.ts +0 -1036
- package/src/plugins/context-compact/history-offloader.test.ts +0 -100
- package/src/plugins/filesystem/filesystem.integration.test.ts +0 -529
- package/src/plugins/filesystem/schema.ts +0 -6
- package/src/plugins/limits-guard/limit-guard.test.ts +0 -253
- package/src/plugins/limits-guard/limits-guard.integration.test.ts +0 -1012
- package/src/plugins/llm-debug/llm-debug.integration.test.ts +0 -192
- package/src/plugins/mailbox/mailbox.integration.test.ts +0 -794
- package/src/plugins/resources/resources.integration.test.ts +0 -68
- package/src/plugins/result-eviction/result-eviction.integration.test.ts +0 -332
- package/src/plugins/services/pid-registry.test.ts +0 -180
- package/src/plugins/services/services.integration.test.ts +0 -1223
- package/src/plugins/session-lifecycle/session-lifecycle.integration.test.ts +0 -639
- package/src/plugins/session-stats/plugin.test.ts +0 -160
- package/src/plugins/shell/shell.integration.test.ts +0 -273
- package/src/plugins/shell/shell.test.ts +0 -314
- package/src/plugins/skills/discovery.test.ts +0 -395
- package/src/plugins/skills/skills.integration.test.ts +0 -580
- package/src/plugins/todo/todo.integration.test.ts +0 -687
- package/src/plugins/uploads/preprocessors/image-classifier.test.ts +0 -142
- package/src/plugins/uploads/uploads.integration.test.ts +0 -831
- package/src/plugins/user-chat/user-chat.integration.test.ts +0 -893
- package/src/plugins/workers/workers.integration.test.ts +0 -778
- package/src/prompts/macros.test.ts +0 -107
- package/src/testing/test-harness.test.ts +0 -114
- package/src/transport/http/routes/rpc.integration.test.ts +0 -243
- package/src/transport/http/routes/rpc.test.ts +0 -372
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live verification of the webmaster model shortlist against the real OpenRouter API.
|
|
3
|
-
*
|
|
4
|
-
* The list mirrors `AGENT_MODEL_OPTIONS` in webmaster `packages/api/feature-flags.ts` — the
|
|
5
|
-
* models an org admin can pin an edit-session agent to. Every entry there had only ever been
|
|
6
|
-
* read off a screenshot; this exercises each one through the SDK's real path:
|
|
7
|
-
*
|
|
8
|
-
* SessionManager → Session → Agent → OpenRouterProvider → openrouter.ai
|
|
9
|
-
*
|
|
10
|
-
* so a pass means *our runtime* works with the model, not merely that the model exists. The
|
|
11
|
-
* agent loop is forced through a tool call whose answer cannot be guessed (a made-up
|
|
12
|
-
* identifier), then through `tell_user`, so the assertions cover: tool call with correct
|
|
13
|
-
* arguments → tool result consumed → final user-visible answer containing the looked-up value.
|
|
14
|
-
*
|
|
15
|
-
* Every outbound HTTP body is recorded, which is what makes the secondary checks real rather
|
|
16
|
-
* than assumed:
|
|
17
|
-
*
|
|
18
|
-
* - `cache_control` — `buildHttpRequest` attaches Anthropic-shaped markers unconditionally.
|
|
19
|
-
* Recorded per request, and on a 4xx the same body is replayed with the markers stripped to
|
|
20
|
-
* prove whether they were the cause.
|
|
21
|
-
* - `reasoning_details` — the branch echoes them back on the next request. Proven by finding
|
|
22
|
-
* the key in a *later* outbound body, not by trusting the code path.
|
|
23
|
-
* - `stop` — the agent always sends `['<message']`; several shortlist models do not list
|
|
24
|
-
* `stop` in `supported_parameters`.
|
|
25
|
-
* - vision — separate one-shot requests with real PNG bytes, asserting the model names the
|
|
26
|
-
* colour rather than merely that the request shape was accepted.
|
|
27
|
-
*
|
|
28
|
-
* Opt-in, so a plain `bun test` stays hermetic and offline:
|
|
29
|
-
*
|
|
30
|
-
* LIVE_TESTS=1 OPENROUTER_API_KEY=… bun test model-shortlist-live
|
|
31
|
-
*
|
|
32
|
-
* `LIVE_MODELS` (comma-separated slugs) narrows the run to a subset.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
import { describe, expect, test } from 'bun:test'
|
|
36
|
-
import z4 from 'zod/v4'
|
|
37
|
-
import { MemoryEventStore } from '~/core/events/memory.js'
|
|
38
|
-
import { SessionFileStore } from '~/core/file-store/file-store.js'
|
|
39
|
-
import type { ImageProcessor } from '~/core/image/types.js'
|
|
40
|
-
import { SessionManager } from '~/core/sessions/session-manager.js'
|
|
41
|
-
import { createTool } from '~/core/tools/definition.js'
|
|
42
|
-
import { ToolExecutor } from '~/core/tools/executor.js'
|
|
43
|
-
import { silentLogger } from '~/lib/logger/logger.js'
|
|
44
|
-
import { agentStatusPlugin } from '~/plugins/agent-status/plugin.js'
|
|
45
|
-
import { agentsPlugin } from '~/plugins/agents/plugin.js'
|
|
46
|
-
import { filesystemPlugin } from '~/plugins/filesystem/index.js'
|
|
47
|
-
import { gitStatusPlugin } from '~/plugins/git-status/index.js'
|
|
48
|
-
import { llmDebugPlugin } from '~/plugins/llm-debug/plugin.js'
|
|
49
|
-
import { logsPlugin } from '~/plugins/logs/index.js'
|
|
50
|
-
import { mailboxPlugin } from '~/plugins/mailbox/plugin.js'
|
|
51
|
-
import { resourcesPlugin } from '~/plugins/resources/plugin.js'
|
|
52
|
-
import { servicePlugin } from '~/plugins/services/plugin.js'
|
|
53
|
-
import { presetsPlugin, sessionLifecyclePlugin } from '~/plugins/session-lifecycle/index.js'
|
|
54
|
-
import { sessionStatePlugin } from '~/plugins/session-state/plugin.js'
|
|
55
|
-
import { sessionStatsPlugin } from '~/plugins/session-stats/index.js'
|
|
56
|
-
import { uploadsPlugin } from '~/plugins/uploads/plugin.js'
|
|
57
|
-
import { userChatPlugin } from '~/plugins/user-chat/plugin.js'
|
|
58
|
-
import { createNodePlatform } from '~/testing/node-platform.js'
|
|
59
|
-
import { createTestPreset } from '~/testing/preset-helpers.js'
|
|
60
|
-
import { waitForAllAgentsIdle } from '~/testing/wait-helpers.js'
|
|
61
|
-
import { OpenRouterProvider } from './openrouter.js'
|
|
62
|
-
import { ModelId } from './schema.js'
|
|
63
|
-
|
|
64
|
-
// ============================================================================
|
|
65
|
-
// Gating
|
|
66
|
-
// ============================================================================
|
|
67
|
-
|
|
68
|
-
const liveEnabled = process.env.LIVE_TESTS === '1'
|
|
69
|
-
const openRouterApiKey = liveEnabled ? process.env.OPENROUTER_API_KEY : undefined
|
|
70
|
-
|
|
71
|
-
/** Mirrors webmaster `AGENT_MODEL_OPTIONS`. Keep in sync by hand — the repos do not share code. */
|
|
72
|
-
const SHORTLIST = [
|
|
73
|
-
'anthropic/claude-haiku-4.5',
|
|
74
|
-
'anthropic/claude-sonnet-5',
|
|
75
|
-
'anthropic/claude-sonnet-4.6',
|
|
76
|
-
'anthropic/claude-opus-5',
|
|
77
|
-
'openai/gpt-5.6-luna',
|
|
78
|
-
'openai/gpt-5.6-terra',
|
|
79
|
-
'openai/gpt-5.6-sol',
|
|
80
|
-
'google/gemini-3.6-flash',
|
|
81
|
-
'x-ai/grok-4.5',
|
|
82
|
-
'moonshotai/kimi-k2.7-code',
|
|
83
|
-
'moonshotai/kimi-k3',
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
const selectedModels = process.env.LIVE_MODELS ? process.env.LIVE_MODELS.split(',').map((s) => s.trim()).filter(Boolean) : SHORTLIST
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The constant from provider-integration.test.ts, where it is commented "1x1 red pixel". It is
|
|
90
|
-
* actually a 1x1 RGBA pixel of #FFFF00 at alpha 127. Kept because xAI rejects it outright
|
|
91
|
-
* (min 8x8), which is worth knowing before someone reuses it as a vision fixture.
|
|
92
|
-
*/
|
|
93
|
-
const TINY_PNG = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 32x32 opaque #0000FF — unambiguous to name, and above every provider's minimum. xAI is the
|
|
97
|
-
* binding constraint: it rejects anything under 8px per side or under 512 total pixels, so 16x16
|
|
98
|
-
* (256 px) is still too small.
|
|
99
|
-
*/
|
|
100
|
-
const BLUE_PNG_32 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAJklEQVR42u3NsQkAAAjAsP7/tF7hIASyp5pjAoFAIBAIBAKB4EmwOkv8Lom8x/sAAAAASUVORK5CYII='
|
|
101
|
-
|
|
102
|
-
const noopImageProcessor: ImageProcessor = {
|
|
103
|
-
resolveContent: async (content) => content,
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// ============================================================================
|
|
107
|
-
// Recorded HTTP exchanges
|
|
108
|
-
// ============================================================================
|
|
109
|
-
|
|
110
|
-
interface RecordedContentItem {
|
|
111
|
-
type: string
|
|
112
|
-
text?: string
|
|
113
|
-
cache_control?: { type: string; ttl?: string }
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface RecordedMessage {
|
|
117
|
-
role: string
|
|
118
|
-
content: string | RecordedContentItem[]
|
|
119
|
-
tool_calls?: Array<{ id: string; function: { name: string; arguments: string } }>
|
|
120
|
-
tool_call_id?: string
|
|
121
|
-
reasoning_details?: unknown[]
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface RecordedRequestBody {
|
|
125
|
-
model: string
|
|
126
|
-
messages: RecordedMessage[]
|
|
127
|
-
stop?: string[]
|
|
128
|
-
max_tokens?: number
|
|
129
|
-
temperature?: number
|
|
130
|
-
tools?: Array<{ function: { name: string } }>
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
interface RecordedResponseBody {
|
|
134
|
-
model?: string
|
|
135
|
-
choices?: Array<{
|
|
136
|
-
message?: { content?: string | null; reasoning_details?: unknown[]; tool_calls?: unknown[] }
|
|
137
|
-
finish_reason?: string | null
|
|
138
|
-
}>
|
|
139
|
-
usage?: {
|
|
140
|
-
prompt_tokens?: number
|
|
141
|
-
completion_tokens?: number
|
|
142
|
-
cost?: number
|
|
143
|
-
prompt_tokens_details?: { cached_tokens?: number; cache_write_tokens?: number }
|
|
144
|
-
completion_tokens_details?: { reasoning_tokens?: number }
|
|
145
|
-
}
|
|
146
|
-
error?: { message?: string; code?: string | number; metadata?: unknown }
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
interface Exchange {
|
|
150
|
-
request: RecordedRequestBody
|
|
151
|
-
status: number
|
|
152
|
-
rawResponse: string
|
|
153
|
-
response?: RecordedResponseBody
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Wraps real fetch and keeps the parsed request/response pair. Auth headers are never stored. */
|
|
157
|
-
const createRecordingFetch = (sink: Exchange[]) => {
|
|
158
|
-
return async (input: string | URL | Request, init?: RequestInit): Promise<Response> => {
|
|
159
|
-
const requestBody: RecordedRequestBody = JSON.parse(typeof init?.body === 'string' ? init.body : '{}')
|
|
160
|
-
const response = await globalThis.fetch(input, init)
|
|
161
|
-
const rawResponse = await response.text()
|
|
162
|
-
let parsed: RecordedResponseBody | undefined
|
|
163
|
-
try {
|
|
164
|
-
parsed = JSON.parse(rawResponse)
|
|
165
|
-
} catch {
|
|
166
|
-
parsed = undefined
|
|
167
|
-
}
|
|
168
|
-
sink.push({ request: requestBody, status: response.status, rawResponse, response: parsed })
|
|
169
|
-
return new Response(rawResponse, { status: response.status, statusText: response.statusText, headers: response.headers })
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const hasCacheControl = (body: RecordedRequestBody): boolean =>
|
|
174
|
-
body.messages.some((m) => Array.isArray(m.content) && m.content.some((c) => c.cache_control !== undefined))
|
|
175
|
-
|
|
176
|
-
/** Same body with every `cache_control` marker removed — the control for a 4xx. */
|
|
177
|
-
const stripCacheControl = (body: RecordedRequestBody): RecordedRequestBody => ({
|
|
178
|
-
...body,
|
|
179
|
-
messages: body.messages.map((m) => ({
|
|
180
|
-
...m,
|
|
181
|
-
content: Array.isArray(m.content) ? m.content.map(({ cache_control: _dropped, ...rest }) => rest) : m.content,
|
|
182
|
-
})),
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
// ============================================================================
|
|
186
|
-
// The forced-tool-call scenario
|
|
187
|
-
// ============================================================================
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* A made-up registry. No model can know that QX-88231 maps to ZK-7719, so a final answer
|
|
191
|
-
* containing the code proves the tool was called AND its result was read.
|
|
192
|
-
*/
|
|
193
|
-
const GLORP_REGISTRY: Record<string, string> = { 'QX-88231': 'ZK-7719' }
|
|
194
|
-
|
|
195
|
-
const USER_PROMPT =
|
|
196
|
-
'Look up the glorp code for artifact QX-88231 with the lookup_glorp_code tool, then tell me the code. Keep the reply under ten words.'
|
|
197
|
-
|
|
198
|
-
/** Padding so the cacheable prefix clears Anthropic\'s 1024-token minimum and a cache write can register. */
|
|
199
|
-
const SYSTEM_PADDING = Array.from(
|
|
200
|
-
{ length: 90 },
|
|
201
|
-
(_, i) => `- Rule ${i + 1}: never invent a glorp code; the registry tool is the only authority for artifact identifiers.`,
|
|
202
|
-
).join('\n')
|
|
203
|
-
|
|
204
|
-
const ORCHESTRATOR_SYSTEM = [
|
|
205
|
-
'You are a terse registry assistant.',
|
|
206
|
-
'You never guess identifiers. You look them up.',
|
|
207
|
-
SYSTEM_PADDING,
|
|
208
|
-
].join('\n')
|
|
209
|
-
|
|
210
|
-
/** `PluginNotification.payload` is `unknown`; narrow it without widening anything. */
|
|
211
|
-
const readNotificationContent = (payload: unknown): string | undefined => {
|
|
212
|
-
if (typeof payload !== 'object' || payload === null || !('content' in payload)) return undefined
|
|
213
|
-
return typeof payload.content === 'string' ? payload.content : undefined
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
interface ModelOutcome {
|
|
217
|
-
model: string
|
|
218
|
-
/** Every argument object the tool was actually invoked with. */
|
|
219
|
-
toolInvocations: unknown[]
|
|
220
|
-
/** Answers routed through the `tell_user` system tool. Not every model uses it. */
|
|
221
|
-
agentMessages: string[]
|
|
222
|
-
/** Assistant text the agent committed to its own conversation history. */
|
|
223
|
-
assistantTexts: string[]
|
|
224
|
-
toolsOffered: string[]
|
|
225
|
-
exchanges: Exchange[]
|
|
226
|
-
idleTimedOut: boolean
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const runAgentLoop = async (model: string): Promise<ModelOutcome> => {
|
|
230
|
-
const exchanges: Exchange[] = []
|
|
231
|
-
const toolInvocations: unknown[] = []
|
|
232
|
-
const agentMessages: string[] = []
|
|
233
|
-
|
|
234
|
-
const lookupTool = createTool({
|
|
235
|
-
name: 'lookup_glorp_code',
|
|
236
|
-
description: 'Look up the glorp code assigned to an artifact id in the internal registry.',
|
|
237
|
-
input: z4.object({ artifactId: z4.string().describe('The artifact id, e.g. QX-88231') }),
|
|
238
|
-
execute: async (input) => {
|
|
239
|
-
toolInvocations.push(input)
|
|
240
|
-
const code = GLORP_REGISTRY[input.artifactId]
|
|
241
|
-
return { ok: true, value: code ? `glorp code: ${code}` : 'unknown artifact id' }
|
|
242
|
-
},
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
const provider = new OpenRouterProvider({
|
|
246
|
-
apiKey: openRouterApiKey ?? '',
|
|
247
|
-
imageProcessor: noopImageProcessor,
|
|
248
|
-
defaultModel: model,
|
|
249
|
-
fetch: createRecordingFetch(exchanges),
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
const preset = createTestPreset({
|
|
253
|
-
id: 'shortlist',
|
|
254
|
-
orchestratorSystem: ORCHESTRATOR_SYSTEM,
|
|
255
|
-
})
|
|
256
|
-
preset.orchestrator.model = ModelId(model)
|
|
257
|
-
preset.orchestrator.tools = [lookupTool]
|
|
258
|
-
|
|
259
|
-
const basePath = `/tmp/roj-shortlist-${Math.random().toString(36).slice(2)}`
|
|
260
|
-
const platform = createNodePlatform()
|
|
261
|
-
const sessionManager = new SessionManager({
|
|
262
|
-
eventStore: new MemoryEventStore(),
|
|
263
|
-
llmProvider: provider,
|
|
264
|
-
toolExecutor: new ToolExecutor(silentLogger),
|
|
265
|
-
presets: new Map([[preset.id, preset]]),
|
|
266
|
-
logger: silentLogger,
|
|
267
|
-
basePath,
|
|
268
|
-
dataFileStore: new SessionFileStore(basePath, undefined, false, platform.fs, 'session'),
|
|
269
|
-
platform,
|
|
270
|
-
onUserOutput: (notification) => {
|
|
271
|
-
if (notification.pluginName !== 'user-chat' || notification.type !== 'agentMessage') return
|
|
272
|
-
const content = readNotificationContent(notification.payload)
|
|
273
|
-
if (content !== undefined) agentMessages.push(content)
|
|
274
|
-
},
|
|
275
|
-
systemPlugins: [
|
|
276
|
-
sessionLifecyclePlugin,
|
|
277
|
-
presetsPlugin,
|
|
278
|
-
mailboxPlugin,
|
|
279
|
-
agentsPlugin,
|
|
280
|
-
agentStatusPlugin,
|
|
281
|
-
userChatPlugin,
|
|
282
|
-
uploadsPlugin,
|
|
283
|
-
resourcesPlugin,
|
|
284
|
-
llmDebugPlugin,
|
|
285
|
-
servicePlugin,
|
|
286
|
-
filesystemPlugin,
|
|
287
|
-
logsPlugin,
|
|
288
|
-
sessionStatsPlugin,
|
|
289
|
-
sessionStatePlugin,
|
|
290
|
-
gitStatusPlugin,
|
|
291
|
-
],
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
const created = await sessionManager.createSession(preset.id)
|
|
295
|
-
if (!created.ok) throw new Error(`createSession failed: ${created.error.type} — ${created.error.message}`)
|
|
296
|
-
const session = created.value
|
|
297
|
-
|
|
298
|
-
const entryAgentId = session.getEntryAgentId()
|
|
299
|
-
if (!entryAgentId) throw new Error('no entry agent')
|
|
300
|
-
|
|
301
|
-
const sent = await session.callPluginMethod('user-chat.sendMessage', {
|
|
302
|
-
sessionId: String(session.id),
|
|
303
|
-
content: USER_PROMPT,
|
|
304
|
-
agentId: String(entryAgentId),
|
|
305
|
-
})
|
|
306
|
-
if (!sent.ok) throw new Error(`sendMessage failed: ${sent.error.type} — ${sent.error.message}`)
|
|
307
|
-
|
|
308
|
-
let idleTimedOut = false
|
|
309
|
-
try {
|
|
310
|
-
await waitForAllAgentsIdle(session, { timeoutMs: 150_000 })
|
|
311
|
-
} catch {
|
|
312
|
-
// A non-retryable 4xx parks the agent in `error`, which never becomes idle. The recorded
|
|
313
|
-
// exchanges are the evidence either way, so this is reported rather than thrown.
|
|
314
|
-
idleTimedOut = true
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const agentState = session.getAgent(entryAgentId)?.state
|
|
318
|
-
const assistantTexts = (agentState?.conversationHistory ?? [])
|
|
319
|
-
.filter((m) => m.role === 'assistant')
|
|
320
|
-
.map((m) => (typeof m.content === 'string' ? m.content : ''))
|
|
321
|
-
.filter((text) => text.length > 0)
|
|
322
|
-
|
|
323
|
-
await sessionManager.shutdown()
|
|
324
|
-
|
|
325
|
-
const toolsOffered = (exchanges[0]?.request.tools ?? []).map((t) => t.function.name)
|
|
326
|
-
|
|
327
|
-
return { model, toolInvocations, agentMessages, assistantTexts, toolsOffered, exchanges, idleTimedOut }
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// ============================================================================
|
|
331
|
-
// Reporting
|
|
332
|
-
// ============================================================================
|
|
333
|
-
|
|
334
|
-
/** Stable short identity for a reasoning_details array, for matching returned blocks to echoed ones. */
|
|
335
|
-
const reasoningFingerprint = (details: unknown[] | undefined): string | null => {
|
|
336
|
-
if (!details?.length) return null
|
|
337
|
-
const serialized = JSON.stringify(details)
|
|
338
|
-
return `${details.length}b/${serialized.length}c/${serialized.slice(0, 24)}`
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/** One machine-readable line per model, so the run can be turned into a matrix afterwards. */
|
|
342
|
-
const reportOutcome = (outcome: ModelOutcome): void => {
|
|
343
|
-
const { exchanges } = outcome
|
|
344
|
-
const failures = exchanges.filter((e) => e.status >= 400)
|
|
345
|
-
const reasoningTurns = exchanges.filter((e) => (e.response?.choices?.[0]?.message?.reasoning_details?.length ?? 0) > 0).length
|
|
346
|
-
const echoTurns = exchanges.filter((e) => e.request.messages.some((m) => m.role === 'assistant' && m.reasoning_details !== undefined)).length
|
|
347
|
-
const assistantTurns = exchanges.flatMap((e) => e.request.messages.filter((m) => m.role === 'assistant')).length
|
|
348
|
-
const cost = exchanges.reduce((sum, e) => sum + (e.response?.usage?.cost ?? 0), 0)
|
|
349
|
-
const cached = exchanges.reduce((sum, e) => sum + (e.response?.usage?.prompt_tokens_details?.cached_tokens ?? 0), 0)
|
|
350
|
-
const cacheWrites = exchanges.reduce((sum, e) => sum + (e.response?.usage?.prompt_tokens_details?.cache_write_tokens ?? 0), 0)
|
|
351
|
-
|
|
352
|
-
console.log(
|
|
353
|
-
`RESULT ${JSON.stringify({
|
|
354
|
-
model: outcome.model,
|
|
355
|
-
requests: exchanges.length,
|
|
356
|
-
httpFailures: failures.map((f) => ({ status: f.status, body: f.rawResponse.slice(0, 400) })),
|
|
357
|
-
cacheControlSent: exchanges.every((e) => hasCacheControl(e.request)),
|
|
358
|
-
stopSent: exchanges[0]?.request.stop,
|
|
359
|
-
promptTokens: exchanges.map((e) => e.response?.usage?.prompt_tokens ?? 0),
|
|
360
|
-
cachedTokens: cached,
|
|
361
|
-
cacheWriteTokens: cacheWrites,
|
|
362
|
-
reasoningReturnedOnTurns: reasoningTurns,
|
|
363
|
-
assistantMessagesSentBack: assistantTurns,
|
|
364
|
-
assistantMessagesCarryingReasoningDetails: echoTurns,
|
|
365
|
-
reasoningTrace: exchanges.map((e, i) => ({
|
|
366
|
-
turn: i,
|
|
367
|
-
returned: reasoningFingerprint(e.response?.choices?.[0]?.message?.reasoning_details),
|
|
368
|
-
sentBack: e.request.messages.filter((m) => m.role === 'assistant').map((m) => reasoningFingerprint(m.reasoning_details)),
|
|
369
|
-
})),
|
|
370
|
-
toolInvocations: outcome.toolInvocations,
|
|
371
|
-
tellUserOffered: outcome.toolsOffered.includes('tell_user'),
|
|
372
|
-
usedTellUser: outcome.agentMessages.length > 0,
|
|
373
|
-
agentMessages: outcome.agentMessages,
|
|
374
|
-
assistantTexts: outcome.assistantTexts,
|
|
375
|
-
idleTimedOut: outcome.idleTimedOut,
|
|
376
|
-
cost,
|
|
377
|
-
})}`,
|
|
378
|
-
)
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// ============================================================================
|
|
382
|
-
// Tests
|
|
383
|
-
// ============================================================================
|
|
384
|
-
|
|
385
|
-
const describeLive = (name: string, fn: () => void) => {
|
|
386
|
-
if (!openRouterApiKey) {
|
|
387
|
-
describe.skip(`${name} (skipped — LIVE_TESTS=1 + OPENROUTER_API_KEY required)`, fn)
|
|
388
|
-
return
|
|
389
|
-
}
|
|
390
|
-
describe(name, fn)
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
describeLive('OpenRouter shortlist — agent loop', () => {
|
|
394
|
-
for (const model of selectedModels) {
|
|
395
|
-
test(`${model} runs a tool-calling agent turn`, async () => {
|
|
396
|
-
const outcome = await runAgentLoop(model)
|
|
397
|
-
reportOutcome(outcome)
|
|
398
|
-
|
|
399
|
-
const failed = outcome.exchanges.filter((e) => e.status >= 400)
|
|
400
|
-
if (failed.length > 0) {
|
|
401
|
-
// Isolate the cause: replay the same body without the cache_control markers.
|
|
402
|
-
const first = failed[0]
|
|
403
|
-
const control = await globalThis.fetch('https://openrouter.ai/api/v1/chat/completions', {
|
|
404
|
-
method: 'POST',
|
|
405
|
-
headers: { 'content-type': 'application/json', 'Authorization': `Bearer ${openRouterApiKey}` },
|
|
406
|
-
body: JSON.stringify(stripCacheControl(first.request)),
|
|
407
|
-
})
|
|
408
|
-
const controlBody = await control.text()
|
|
409
|
-
console.log(`CONTROL ${JSON.stringify({ model, withoutCacheControl: control.status, body: controlBody.slice(0, 400) })}`)
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
expect(failed.map((f) => `${f.status} ${f.rawResponse.slice(0, 300)}`)).toEqual([])
|
|
413
|
-
|
|
414
|
-
// The agent loop actually ran: correct tool, correct argument, result used in the answer.
|
|
415
|
-
// The answer counts whether it came back as assistant text or through `tell_user` —
|
|
416
|
-
// which one a model picks is instruction-following, not runtime compatibility.
|
|
417
|
-
expect(outcome.toolInvocations).toContainEqual({ artifactId: 'QX-88231' })
|
|
418
|
-
expect([...outcome.assistantTexts, ...outcome.agentMessages].join('\n')).toContain('ZK-7719')
|
|
419
|
-
|
|
420
|
-
// cache_control travelled on every request — the point of the exercise.
|
|
421
|
-
for (const exchange of outcome.exchanges) {
|
|
422
|
-
expect(hasCacheControl(exchange.request)).toBe(true)
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// The agent always sends stop sequences, whatever the model advertises.
|
|
426
|
-
expect(outcome.exchanges[0].request.stop).toEqual(['<message'])
|
|
427
|
-
|
|
428
|
-
// reasoning_details round trip. The negative control comes first: a model that never
|
|
429
|
-
// reasons must produce no `reasoning_details` key anywhere on the wire, because the prompt
|
|
430
|
-
// cache is keyed on the serialized prefix and the pre-fix bytes had no such key.
|
|
431
|
-
const producedReasoning = outcome.exchanges.some((e) => (e.response?.choices?.[0]?.message?.reasoning_details?.length ?? 0) > 0)
|
|
432
|
-
const echoed = outcome.exchanges.some((e) => e.request.messages.some((m) => m.role === 'assistant' && m.reasoning_details !== undefined))
|
|
433
|
-
if (!producedReasoning) {
|
|
434
|
-
expect(echoed).toBe(false)
|
|
435
|
-
return
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// Verbatim, on the wire: every block set that goes back out must be byte-identical to one
|
|
439
|
-
// the provider returned earlier — nothing invented, reordered or edited, which is exactly
|
|
440
|
-
// what OpenRouter rejects. All these requests came back 200 (asserted above), so the echo
|
|
441
|
-
// was also accepted.
|
|
442
|
-
//
|
|
443
|
-
// The converse does not hold and must not be asserted: an auxiliary inference
|
|
444
|
-
// (`runAuxiliaryInference`) and an empty-response retry both discard their response
|
|
445
|
-
// without committing it to history, so some returned blocks legitimately never come back.
|
|
446
|
-
const returnedFingerprints = new Set<string>()
|
|
447
|
-
let verbatimEchoes = 0
|
|
448
|
-
for (const exchange of outcome.exchanges) {
|
|
449
|
-
for (const message of exchange.request.messages) {
|
|
450
|
-
if (message.reasoning_details === undefined) continue
|
|
451
|
-
expect(returnedFingerprints).toContain(JSON.stringify(message.reasoning_details))
|
|
452
|
-
verbatimEchoes++
|
|
453
|
-
}
|
|
454
|
-
const returned = exchange.response?.choices?.[0]?.message?.reasoning_details
|
|
455
|
-
if (returned?.length) returnedFingerprints.add(JSON.stringify(returned))
|
|
456
|
-
}
|
|
457
|
-
console.log(`ROUNDTRIP ${JSON.stringify({ model, verbatimEchoes, roundTripProven: verbatimEchoes > 0 })}`)
|
|
458
|
-
}, 200_000)
|
|
459
|
-
}
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* `stop` is sent on every agent inference (`agent.ts` hardcodes `['<message']` to stop the model
|
|
464
|
-
* hallucinating message tags), but several shortlist models do not list `stop` in
|
|
465
|
-
* `supported_parameters`. OpenRouter drops unsupported parameters instead of erroring, so the
|
|
466
|
-
* question is not "does the request fail" but "is the guard actually in force". Asking the model
|
|
467
|
-
* to emit text that straddles the stop sequence answers it: truncated → honored, intact → dropped.
|
|
468
|
-
*/
|
|
469
|
-
describeLive('OpenRouter shortlist — stop sequences', () => {
|
|
470
|
-
for (const model of selectedModels) {
|
|
471
|
-
test(`${model} stop sequence behaviour`, async () => {
|
|
472
|
-
const exchanges: Exchange[] = []
|
|
473
|
-
const provider = new OpenRouterProvider({
|
|
474
|
-
apiKey: openRouterApiKey ?? '',
|
|
475
|
-
imageProcessor: noopImageProcessor,
|
|
476
|
-
defaultModel: model,
|
|
477
|
-
fetch: createRecordingFetch(exchanges),
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
const result = await provider.inference({
|
|
481
|
-
model: ModelId(model),
|
|
482
|
-
systemPrompt: 'You echo text literally. No preamble, no commentary, no markdown.',
|
|
483
|
-
messages: [{ role: 'user', content: 'Repeat this line exactly, and nothing else: ALPHA<message>BRAVO' }],
|
|
484
|
-
stopSequences: ['<message'],
|
|
485
|
-
// Generous: a reasoning model spends most of its budget before the first visible token.
|
|
486
|
-
maxTokens: 512,
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
const content = result.ok ? (result.value.content ?? '') : ''
|
|
490
|
-
const reasoning = result.ok ? (result.value.reasoning ?? '') : ''
|
|
491
|
-
|
|
492
|
-
// `honored_killed_turn` is the dangerous one: the sequence also applies to the reasoning
|
|
493
|
-
// stream, so the model stops mid-thought and the turn yields no content at all.
|
|
494
|
-
const verdict = content.includes('ALPHA') && !content.includes('BRAVO')
|
|
495
|
-
? 'honored'
|
|
496
|
-
: content.includes('ALPHA') && content.includes('BRAVO')
|
|
497
|
-
? 'ignored'
|
|
498
|
-
: content === '' && reasoning.includes('ALPHA') && !reasoning.includes('BRAVO')
|
|
499
|
-
? 'honored_killed_turn'
|
|
500
|
-
: 'inconclusive'
|
|
501
|
-
|
|
502
|
-
console.log(
|
|
503
|
-
`STOP ${JSON.stringify({
|
|
504
|
-
model,
|
|
505
|
-
status: exchanges[0]?.status,
|
|
506
|
-
stopInRequest: exchanges[0]?.request.stop,
|
|
507
|
-
verdict,
|
|
508
|
-
content,
|
|
509
|
-
reasoning: reasoning.slice(0, 200),
|
|
510
|
-
finishReason: result.ok ? result.value.finishReason : undefined,
|
|
511
|
-
error: result.ok ? undefined : result.error,
|
|
512
|
-
cost: exchanges[0]?.response?.usage?.cost,
|
|
513
|
-
})}`,
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
// The only hard requirement: sending `stop` must never break the request.
|
|
517
|
-
expect(exchanges[0]?.request.stop).toEqual(['<message'])
|
|
518
|
-
expect(exchanges[0]?.status).toBe(200)
|
|
519
|
-
}, 120_000)
|
|
520
|
-
}
|
|
521
|
-
})
|
|
522
|
-
|
|
523
|
-
interface VisionProbe {
|
|
524
|
-
status: number | undefined
|
|
525
|
-
content: string | null | undefined
|
|
526
|
-
error: unknown
|
|
527
|
-
body: string | undefined
|
|
528
|
-
cost: number | undefined
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
const probeVision = async (model: string, imageBase64: string, maxTokens: number): Promise<VisionProbe> => {
|
|
532
|
-
const exchanges: Exchange[] = []
|
|
533
|
-
const provider = new OpenRouterProvider({
|
|
534
|
-
apiKey: openRouterApiKey ?? '',
|
|
535
|
-
imageProcessor: noopImageProcessor,
|
|
536
|
-
defaultModel: model,
|
|
537
|
-
fetch: createRecordingFetch(exchanges),
|
|
538
|
-
})
|
|
539
|
-
|
|
540
|
-
const result = await provider.inference({
|
|
541
|
-
model: ModelId(model),
|
|
542
|
-
systemPrompt: 'You describe images. Answer with a single colour word and nothing else.',
|
|
543
|
-
messages: [{
|
|
544
|
-
role: 'user',
|
|
545
|
-
content: [
|
|
546
|
-
{ type: 'text', text: 'What colour fills this image? Answer with one colour word.' },
|
|
547
|
-
{ type: 'image_url', imageUrl: { url: `data:image/png;base64,${imageBase64}` } },
|
|
548
|
-
],
|
|
549
|
-
}],
|
|
550
|
-
maxTokens,
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
return {
|
|
554
|
-
status: exchanges[0]?.status,
|
|
555
|
-
content: result.ok ? result.value.content : undefined,
|
|
556
|
-
error: result.ok ? undefined : result.error,
|
|
557
|
-
body: result.ok ? undefined : exchanges[0]?.rawResponse.slice(0, 300),
|
|
558
|
-
cost: exchanges[0]?.response?.usage?.cost,
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
describeLive('OpenRouter shortlist — vision', () => {
|
|
563
|
-
for (const model of selectedModels) {
|
|
564
|
-
test(`${model} accepts an inline image`, async () => {
|
|
565
|
-
// Two fixtures: the existing 1x1 constant (some providers reject it on size), then a
|
|
566
|
-
// 32x32 solid blue that clears every minimum. Answering "blue" is behavioural proof the
|
|
567
|
-
// pixels arrived; a 200 with empty content only proves the request shape was accepted.
|
|
568
|
-
const tiny = await probeVision(model, TINY_PNG, 64)
|
|
569
|
-
const blue = await probeVision(model, BLUE_PNG_32, 512)
|
|
570
|
-
|
|
571
|
-
console.log(`VISION ${JSON.stringify({ model, tiny1x1: tiny, blue32x32: blue, sawBlue: (blue.content ?? '').toLowerCase().includes('blue') })}`)
|
|
572
|
-
|
|
573
|
-
expect(blue.status).toBe(200)
|
|
574
|
-
expect((blue.content ?? '').toLowerCase()).toContain('blue')
|
|
575
|
-
}, 180_000)
|
|
576
|
-
}
|
|
577
|
-
})
|