@roj-ai/sdk 0.0.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 +453 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/builtin-events.d.ts +16 -0
- package/dist/builtin-events.d.ts.map +1 -0
- package/dist/bun-platform/fs.d.ts +9 -0
- package/dist/bun-platform/fs.d.ts.map +1 -0
- package/dist/bun-platform/index.d.ts +12 -0
- package/dist/bun-platform/index.d.ts.map +1 -0
- package/dist/bun-platform/process.d.ts +6 -0
- package/dist/bun-platform/process.d.ts.map +1 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/core/agent-loop.integration.test.d.ts +2 -0
- package/dist/core/agent-loop.integration.test.d.ts.map +1 -0
- package/dist/core/agents/agent-config.test.d.ts +2 -0
- package/dist/core/agents/agent-config.test.d.ts.map +1 -0
- package/dist/core/agents/agent-roles.d.ts +33 -0
- package/dist/core/agents/agent-roles.d.ts.map +1 -0
- package/dist/core/agents/agent-shutdown.test.d.ts +6 -0
- package/dist/core/agents/agent-shutdown.test.d.ts.map +1 -0
- package/dist/core/agents/agent.d.ts +234 -0
- package/dist/core/agents/agent.d.ts.map +1 -0
- package/dist/core/agents/agent.test.d.ts +2 -0
- package/dist/core/agents/agent.test.d.ts.map +1 -0
- package/dist/core/agents/communicator.d.ts +3 -0
- package/dist/core/agents/communicator.d.ts.map +1 -0
- package/dist/core/agents/config.d.ts +84 -0
- package/dist/core/agents/config.d.ts.map +1 -0
- package/dist/core/agents/context.d.ts +16 -0
- package/dist/core/agents/context.d.ts.map +1 -0
- package/dist/core/agents/debounce.d.ts +52 -0
- package/dist/core/agents/debounce.d.ts.map +1 -0
- package/dist/core/agents/handler-events.test.d.ts +5 -0
- package/dist/core/agents/handler-events.test.d.ts.map +1 -0
- package/dist/core/agents/index.d.ts +2 -0
- package/dist/core/agents/index.d.ts.map +1 -0
- package/dist/core/agents/response-sanitizer.d.ts +25 -0
- package/dist/core/agents/response-sanitizer.d.ts.map +1 -0
- package/dist/core/agents/response-sanitizer.test.d.ts +2 -0
- package/dist/core/agents/response-sanitizer.test.d.ts.map +1 -0
- package/dist/core/agents/retry.d.ts +40 -0
- package/dist/core/agents/retry.d.ts.map +1 -0
- package/dist/core/agents/schema.d.ts +57 -0
- package/dist/core/agents/schema.d.ts.map +1 -0
- package/dist/core/agents/state.d.ts +255 -0
- package/dist/core/agents/state.d.ts.map +1 -0
- package/dist/core/context/state.d.ts +28 -0
- package/dist/core/context/state.d.ts.map +1 -0
- package/dist/core/errors.d.ts +29 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/event-sourcing.integration.test.d.ts +2 -0
- package/dist/core/event-sourcing.integration.test.d.ts.map +1 -0
- package/dist/core/events/base-event-store.d.ts +55 -0
- package/dist/core/events/base-event-store.d.ts.map +1 -0
- package/dist/core/events/event-store.d.ts +108 -0
- package/dist/core/events/event-store.d.ts.map +1 -0
- package/dist/core/events/file.d.ts +50 -0
- package/dist/core/events/file.d.ts.map +1 -0
- package/dist/core/events/file.test.d.ts +2 -0
- package/dist/core/events/file.test.d.ts.map +1 -0
- package/dist/core/events/index.d.ts +4 -0
- package/dist/core/events/index.d.ts.map +1 -0
- package/dist/core/events/memory.d.ts +43 -0
- package/dist/core/events/memory.d.ts.map +1 -0
- package/dist/core/events/memory.test.d.ts +2 -0
- package/dist/core/events/memory.test.d.ts.map +1 -0
- package/dist/core/events/metadata-utils.d.ts +27 -0
- package/dist/core/events/metadata-utils.d.ts.map +1 -0
- package/dist/core/events/test-helpers.d.ts +28 -0
- package/dist/core/events/test-helpers.d.ts.map +1 -0
- package/dist/core/events/types.d.ts +46 -0
- package/dist/core/events/types.d.ts.map +1 -0
- package/dist/core/file-store/file-store.d.ts +56 -0
- package/dist/core/file-store/file-store.d.ts.map +1 -0
- package/dist/core/file-store/types.d.ts +50 -0
- package/dist/core/file-store/types.d.ts.map +1 -0
- package/dist/core/image/image-processor.d.ts +15 -0
- package/dist/core/image/image-processor.d.ts.map +1 -0
- package/dist/core/image/image-processor.test.d.ts +2 -0
- package/dist/core/image/image-processor.test.d.ts.map +1 -0
- package/dist/core/image/index.d.ts +5 -0
- package/dist/core/image/index.d.ts.map +1 -0
- package/dist/core/image/noop-resizer.d.ts +5 -0
- package/dist/core/image/noop-resizer.d.ts.map +1 -0
- package/dist/core/image/types.d.ts +20 -0
- package/dist/core/image/types.d.ts.map +1 -0
- package/dist/core/image/vips-resizer.d.ts +21 -0
- package/dist/core/image/vips-resizer.d.ts.map +1 -0
- package/dist/core/image/vips-resizer.test.d.ts +2 -0
- package/dist/core/image/vips-resizer.test.d.ts.map +1 -0
- package/dist/core/llm/anthropic.d.ts +51 -0
- package/dist/core/llm/anthropic.d.ts.map +1 -0
- package/dist/core/llm/anthropic.test.d.ts +2 -0
- package/dist/core/llm/anthropic.test.d.ts.map +1 -0
- package/dist/core/llm/cache-breakpoints.d.ts +17 -0
- package/dist/core/llm/cache-breakpoints.d.ts.map +1 -0
- package/dist/core/llm/cache-live.test.d.ts +16 -0
- package/dist/core/llm/cache-live.test.d.ts.map +1 -0
- package/dist/core/llm/index.d.ts +16 -0
- package/dist/core/llm/index.d.ts.map +1 -0
- package/dist/core/llm/llm-log-types.d.ts +148 -0
- package/dist/core/llm/llm-log-types.d.ts.map +1 -0
- package/dist/core/llm/logger.d.ts +74 -0
- package/dist/core/llm/logger.d.ts.map +1 -0
- package/dist/core/llm/logger.test.d.ts +7 -0
- package/dist/core/llm/logger.test.d.ts.map +1 -0
- package/dist/core/llm/logging-provider.d.ts +20 -0
- package/dist/core/llm/logging-provider.d.ts.map +1 -0
- package/dist/core/llm/middleware.d.ts +79 -0
- package/dist/core/llm/middleware.d.ts.map +1 -0
- package/dist/core/llm/mock.d.ts +79 -0
- package/dist/core/llm/mock.d.ts.map +1 -0
- package/dist/core/llm/mock.test.d.ts +2 -0
- package/dist/core/llm/mock.test.d.ts.map +1 -0
- package/dist/core/llm/openrouter-mapping.test.d.ts +2 -0
- package/dist/core/llm/openrouter-mapping.test.d.ts.map +1 -0
- package/dist/core/llm/openrouter.d.ts +37 -0
- package/dist/core/llm/openrouter.d.ts.map +1 -0
- package/dist/core/llm/openrouter.test.d.ts +2 -0
- package/dist/core/llm/openrouter.test.d.ts.map +1 -0
- package/dist/core/llm/provider-integration.test.d.ts +12 -0
- package/dist/core/llm/provider-integration.test.d.ts.map +1 -0
- package/dist/core/llm/provider.d.ts +175 -0
- package/dist/core/llm/provider.d.ts.map +1 -0
- package/dist/core/llm/routing-provider.d.ts +31 -0
- package/dist/core/llm/routing-provider.d.ts.map +1 -0
- package/dist/core/llm/routing-provider.test.d.ts +2 -0
- package/dist/core/llm/routing-provider.test.d.ts.map +1 -0
- package/dist/core/llm/schema.d.ts +24 -0
- package/dist/core/llm/schema.d.ts.map +1 -0
- package/dist/core/llm/snapshot-fetch.d.ts +21 -0
- package/dist/core/llm/snapshot-fetch.d.ts.map +1 -0
- package/dist/core/llm/snapshot-middleware.d.ts +71 -0
- package/dist/core/llm/snapshot-middleware.d.ts.map +1 -0
- package/dist/core/llm/snapshot-middleware.test.d.ts +2 -0
- package/dist/core/llm/snapshot-middleware.test.d.ts.map +1 -0
- package/dist/core/llm/state.d.ts +73 -0
- package/dist/core/llm/state.d.ts.map +1 -0
- package/dist/core/llm/tokens.d.ts +36 -0
- package/dist/core/llm/tokens.d.ts.map +1 -0
- package/dist/core/multi-agent.integration.test.d.ts +2 -0
- package/dist/core/multi-agent.integration.test.d.ts.map +1 -0
- package/dist/core/plugin-hooks.integration.test.d.ts +2 -0
- package/dist/core/plugin-hooks.integration.test.d.ts.map +1 -0
- package/dist/core/plugins/hook-types.d.ts +55 -0
- package/dist/core/plugins/hook-types.d.ts.map +1 -0
- package/dist/core/plugins/index.d.ts +23 -0
- package/dist/core/plugins/index.d.ts.map +1 -0
- package/dist/core/plugins/plugin-builder.d.ts +474 -0
- package/dist/core/plugins/plugin-builder.d.ts.map +1 -0
- package/dist/core/preset/config.d.ts +55 -0
- package/dist/core/preset/config.d.ts.map +1 -0
- package/dist/core/preset/index.d.ts +8 -0
- package/dist/core/preset/index.d.ts.map +1 -0
- package/dist/core/preset/preset-builder.d.ts +44 -0
- package/dist/core/preset/preset-builder.d.ts.map +1 -0
- package/dist/core/session-lifecycle.integration.test.d.ts +2 -0
- package/dist/core/session-lifecycle.integration.test.d.ts.map +1 -0
- package/dist/core/sessions/apply-event.d.ts +19 -0
- package/dist/core/sessions/apply-event.d.ts.map +1 -0
- package/dist/core/sessions/context.d.ts +34 -0
- package/dist/core/sessions/context.d.ts.map +1 -0
- package/dist/core/sessions/fork-utils.d.ts +20 -0
- package/dist/core/sessions/fork-utils.d.ts.map +1 -0
- package/dist/core/sessions/fork-utils.test.d.ts +2 -0
- package/dist/core/sessions/fork-utils.test.d.ts.map +1 -0
- package/dist/core/sessions/reducer.d.ts +50 -0
- package/dist/core/sessions/reducer.d.ts.map +1 -0
- package/dist/core/sessions/schema.d.ts +82 -0
- package/dist/core/sessions/schema.d.ts.map +1 -0
- package/dist/core/sessions/session-environment.d.ts +13 -0
- package/dist/core/sessions/session-environment.d.ts.map +1 -0
- package/dist/core/sessions/session-manager.d.ts +183 -0
- package/dist/core/sessions/session-manager.d.ts.map +1 -0
- package/dist/core/sessions/session-store.d.ts +69 -0
- package/dist/core/sessions/session-store.d.ts.map +1 -0
- package/dist/core/sessions/session.d.ts +212 -0
- package/dist/core/sessions/session.d.ts.map +1 -0
- package/dist/core/sessions/session.test.d.ts +2 -0
- package/dist/core/sessions/session.test.d.ts.map +1 -0
- package/dist/core/sessions/state.d.ts +110 -0
- package/dist/core/sessions/state.d.ts.map +1 -0
- package/dist/core/system.d.ts +97 -0
- package/dist/core/system.d.ts.map +1 -0
- package/dist/core/tools/context.d.ts +3 -0
- package/dist/core/tools/context.d.ts.map +1 -0
- package/dist/core/tools/definition.d.ts +10 -0
- package/dist/core/tools/definition.d.ts.map +1 -0
- package/dist/core/tools/executor.d.ts +28 -0
- package/dist/core/tools/executor.d.ts.map +1 -0
- package/dist/core/tools/executor.test.d.ts +2 -0
- package/dist/core/tools/executor.test.d.ts.map +1 -0
- package/dist/core/tools/index.d.ts +4 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/schema.d.ts +61 -0
- package/dist/core/tools/schema.d.ts.map +1 -0
- package/dist/core/tools/state.d.ts +28 -0
- package/dist/core/tools/state.d.ts.map +1 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/json/index.d.ts +17 -0
- package/dist/lib/json/index.d.ts.map +1 -0
- package/dist/lib/logger/console.d.ts +35 -0
- package/dist/lib/logger/console.d.ts.map +1 -0
- package/dist/lib/logger/console.test.d.ts +2 -0
- package/dist/lib/logger/console.test.d.ts.map +1 -0
- package/dist/lib/logger/file.d.ts +20 -0
- package/dist/lib/logger/file.d.ts.map +1 -0
- package/dist/lib/logger/index.d.ts +5 -0
- package/dist/lib/logger/index.d.ts.map +1 -0
- package/dist/lib/logger/logger.d.ts +87 -0
- package/dist/lib/logger/logger.d.ts.map +1 -0
- package/dist/lib/logger/ring-buffer.d.ts +33 -0
- package/dist/lib/logger/ring-buffer.d.ts.map +1 -0
- package/dist/lib/logger/tee.d.ts +15 -0
- package/dist/lib/logger/tee.d.ts.map +1 -0
- package/dist/lib/mime.d.ts +9 -0
- package/dist/lib/mime.d.ts.map +1 -0
- package/dist/lib/never.d.ts +2 -0
- package/dist/lib/never.d.ts.map +1 -0
- package/dist/lib/utils/hash.d.ts +19 -0
- package/dist/lib/utils/hash.d.ts.map +1 -0
- package/dist/lib/utils/result.d.ts +26 -0
- package/dist/lib/utils/result.d.ts.map +1 -0
- package/dist/platform/fs.d.ts +39 -0
- package/dist/platform/fs.d.ts.map +1 -0
- package/dist/platform/index.d.ts +21 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/process.d.ts +24 -0
- package/dist/platform/process.d.ts.map +1 -0
- package/dist/plugins/agent-status/plugin.d.ts +8 -0
- package/dist/plugins/agent-status/plugin.d.ts.map +1 -0
- package/dist/plugins/agents/agents.integration.test.d.ts +2 -0
- package/dist/plugins/agents/agents.integration.test.d.ts.map +1 -0
- package/dist/plugins/agents/index.d.ts +3 -0
- package/dist/plugins/agents/index.d.ts.map +1 -0
- package/dist/plugins/agents/plugin.d.ts +57 -0
- package/dist/plugins/agents/plugin.d.ts.map +1 -0
- package/dist/plugins/context-compact/context-compact.integration.test.d.ts +2 -0
- package/dist/plugins/context-compact/context-compact.integration.test.d.ts.map +1 -0
- package/dist/plugins/context-compact/context-compactor.d.ts +88 -0
- package/dist/plugins/context-compact/context-compactor.d.ts.map +1 -0
- package/dist/plugins/context-compact/context-compactor.test.d.ts +2 -0
- package/dist/plugins/context-compact/context-compactor.test.d.ts.map +1 -0
- package/dist/plugins/context-compact/history-offloader.d.ts +17 -0
- package/dist/plugins/context-compact/history-offloader.d.ts.map +1 -0
- package/dist/plugins/context-compact/history-offloader.test.d.ts +2 -0
- package/dist/plugins/context-compact/history-offloader.test.d.ts.map +1 -0
- package/dist/plugins/context-compact/index.d.ts +4 -0
- package/dist/plugins/context-compact/index.d.ts.map +1 -0
- package/dist/plugins/context-compact/plugin.d.ts +15 -0
- package/dist/plugins/context-compact/plugin.d.ts.map +1 -0
- package/dist/plugins/filesystem/filesystem.integration.test.d.ts +2 -0
- package/dist/plugins/filesystem/filesystem.integration.test.d.ts.map +1 -0
- package/dist/plugins/filesystem/helpers.d.ts +34 -0
- package/dist/plugins/filesystem/helpers.d.ts.map +1 -0
- package/dist/plugins/filesystem/index.d.ts +5 -0
- package/dist/plugins/filesystem/index.d.ts.map +1 -0
- package/dist/plugins/filesystem/listing.d.ts +38 -0
- package/dist/plugins/filesystem/listing.d.ts.map +1 -0
- package/dist/plugins/filesystem/plugin.d.ts +53 -0
- package/dist/plugins/filesystem/plugin.d.ts.map +1 -0
- package/dist/plugins/filesystem/schema.d.ts +7 -0
- package/dist/plugins/filesystem/schema.d.ts.map +1 -0
- package/dist/plugins/git-status/index.d.ts +2 -0
- package/dist/plugins/git-status/index.d.ts.map +1 -0
- package/dist/plugins/git-status/plugin.d.ts +12 -0
- package/dist/plugins/git-status/plugin.d.ts.map +1 -0
- package/dist/plugins/limits-guard/config.d.ts +23 -0
- package/dist/plugins/limits-guard/config.d.ts.map +1 -0
- package/dist/plugins/limits-guard/index.d.ts +5 -0
- package/dist/plugins/limits-guard/index.d.ts.map +1 -0
- package/dist/plugins/limits-guard/limit-guard.d.ts +40 -0
- package/dist/plugins/limits-guard/limit-guard.d.ts.map +1 -0
- package/dist/plugins/limits-guard/limit-guard.test.d.ts +2 -0
- package/dist/plugins/limits-guard/limit-guard.test.d.ts.map +1 -0
- package/dist/plugins/limits-guard/limits-guard.integration.test.d.ts +2 -0
- package/dist/plugins/limits-guard/limits-guard.integration.test.d.ts.map +1 -0
- package/dist/plugins/limits-guard/plugin.d.ts +39 -0
- package/dist/plugins/limits-guard/plugin.d.ts.map +1 -0
- package/dist/plugins/llm-debug/index.d.ts +2 -0
- package/dist/plugins/llm-debug/index.d.ts.map +1 -0
- package/dist/plugins/llm-debug/llm-debug.integration.test.d.ts +2 -0
- package/dist/plugins/llm-debug/llm-debug.integration.test.d.ts.map +1 -0
- package/dist/plugins/llm-debug/plugin.d.ts +31 -0
- package/dist/plugins/llm-debug/plugin.d.ts.map +1 -0
- package/dist/plugins/logs/index.d.ts +2 -0
- package/dist/plugins/logs/index.d.ts.map +1 -0
- package/dist/plugins/logs/plugin.d.ts +10 -0
- package/dist/plugins/logs/plugin.d.ts.map +1 -0
- package/dist/plugins/mailbox/helpers.d.ts +20 -0
- package/dist/plugins/mailbox/helpers.d.ts.map +1 -0
- package/dist/plugins/mailbox/index.d.ts +9 -0
- package/dist/plugins/mailbox/index.d.ts.map +1 -0
- package/dist/plugins/mailbox/mailbox.integration.test.d.ts +2 -0
- package/dist/plugins/mailbox/mailbox.integration.test.d.ts.map +1 -0
- package/dist/plugins/mailbox/plugin.d.ts +31 -0
- package/dist/plugins/mailbox/plugin.d.ts.map +1 -0
- package/dist/plugins/mailbox/prompts.d.ts +21 -0
- package/dist/plugins/mailbox/prompts.d.ts.map +1 -0
- package/dist/plugins/mailbox/query.d.ts +33 -0
- package/dist/plugins/mailbox/query.d.ts.map +1 -0
- package/dist/plugins/mailbox/schema.d.ts +54 -0
- package/dist/plugins/mailbox/schema.d.ts.map +1 -0
- package/dist/plugins/mailbox/state.d.ts +40 -0
- package/dist/plugins/mailbox/state.d.ts.map +1 -0
- package/dist/plugins/resources/index.d.ts +7 -0
- package/dist/plugins/resources/index.d.ts.map +1 -0
- package/dist/plugins/resources/manifest.d.ts +23 -0
- package/dist/plugins/resources/manifest.d.ts.map +1 -0
- package/dist/plugins/resources/plugin.d.ts +28 -0
- package/dist/plugins/resources/plugin.d.ts.map +1 -0
- package/dist/plugins/resources/post-inject.d.ts +39 -0
- package/dist/plugins/resources/post-inject.d.ts.map +1 -0
- package/dist/plugins/resources/state.d.ts +25 -0
- package/dist/plugins/resources/state.d.ts.map +1 -0
- package/dist/plugins/result-eviction/index.d.ts +3 -0
- package/dist/plugins/result-eviction/index.d.ts.map +1 -0
- package/dist/plugins/result-eviction/plugin.d.ts +19 -0
- package/dist/plugins/result-eviction/plugin.d.ts.map +1 -0
- package/dist/plugins/result-eviction/result-eviction.integration.test.d.ts +2 -0
- package/dist/plugins/result-eviction/result-eviction.integration.test.d.ts.map +1 -0
- package/dist/plugins/services/plugin.d.ts +85 -0
- package/dist/plugins/services/plugin.d.ts.map +1 -0
- package/dist/plugins/services/port-pool.d.ts +32 -0
- package/dist/plugins/services/port-pool.d.ts.map +1 -0
- package/dist/plugins/services/prompt.d.ts +13 -0
- package/dist/plugins/services/prompt.d.ts.map +1 -0
- package/dist/plugins/services/schema.d.ts +70 -0
- package/dist/plugins/services/schema.d.ts.map +1 -0
- package/dist/plugins/services/service.d.ts +86 -0
- package/dist/plugins/services/service.d.ts.map +1 -0
- package/dist/plugins/services/services.integration.test.d.ts +2 -0
- package/dist/plugins/services/services.integration.test.d.ts.map +1 -0
- package/dist/plugins/session-lifecycle/index.d.ts +2 -0
- package/dist/plugins/session-lifecycle/index.d.ts.map +1 -0
- package/dist/plugins/session-lifecycle/plugin.d.ts +97 -0
- package/dist/plugins/session-lifecycle/plugin.d.ts.map +1 -0
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.d.ts +2 -0
- package/dist/plugins/session-lifecycle/session-lifecycle.integration.test.d.ts.map +1 -0
- package/dist/plugins/session-state/plugin.d.ts +48 -0
- package/dist/plugins/session-state/plugin.d.ts.map +1 -0
- package/dist/plugins/session-stats/index.d.ts +4 -0
- package/dist/plugins/session-stats/index.d.ts.map +1 -0
- package/dist/plugins/session-stats/plugin.d.ts +29 -0
- package/dist/plugins/session-stats/plugin.d.ts.map +1 -0
- package/dist/plugins/shell/executor.d.ts +78 -0
- package/dist/plugins/shell/executor.d.ts.map +1 -0
- package/dist/plugins/shell/index.d.ts +6 -0
- package/dist/plugins/shell/index.d.ts.map +1 -0
- package/dist/plugins/shell/plugin.d.ts +51 -0
- package/dist/plugins/shell/plugin.d.ts.map +1 -0
- package/dist/plugins/shell/shell.integration.test.d.ts +2 -0
- package/dist/plugins/shell/shell.integration.test.d.ts.map +1 -0
- package/dist/plugins/shell/shell.test.d.ts +2 -0
- package/dist/plugins/shell/shell.test.d.ts.map +1 -0
- package/dist/plugins/skills/discovery.d.ts +69 -0
- package/dist/plugins/skills/discovery.d.ts.map +1 -0
- package/dist/plugins/skills/discovery.test.d.ts +2 -0
- package/dist/plugins/skills/discovery.test.d.ts.map +1 -0
- package/dist/plugins/skills/index.d.ts +11 -0
- package/dist/plugins/skills/index.d.ts.map +1 -0
- package/dist/plugins/skills/plugin.d.ts +94 -0
- package/dist/plugins/skills/plugin.d.ts.map +1 -0
- package/dist/plugins/skills/prompts.d.ts +29 -0
- package/dist/plugins/skills/prompts.d.ts.map +1 -0
- package/dist/plugins/skills/schema.d.ts +64 -0
- package/dist/plugins/skills/schema.d.ts.map +1 -0
- package/dist/plugins/skills/skills.integration.test.d.ts +2 -0
- package/dist/plugins/skills/skills.integration.test.d.ts.map +1 -0
- package/dist/plugins/snapshotting/index.d.ts +4 -0
- package/dist/plugins/snapshotting/index.d.ts.map +1 -0
- package/dist/plugins/snapshotting/jj-snapshotter.d.ts +27 -0
- package/dist/plugins/snapshotting/jj-snapshotter.d.ts.map +1 -0
- package/dist/plugins/snapshotting/plugin.d.ts +15 -0
- package/dist/plugins/snapshotting/plugin.d.ts.map +1 -0
- package/dist/plugins/snapshotting/snapshotter.d.ts +19 -0
- package/dist/plugins/snapshotting/snapshotter.d.ts.map +1 -0
- package/dist/plugins/todo/index.d.ts +7 -0
- package/dist/plugins/todo/index.d.ts.map +1 -0
- package/dist/plugins/todo/plugin.d.ts +95 -0
- package/dist/plugins/todo/plugin.d.ts.map +1 -0
- package/dist/plugins/todo/prompts.d.ts +13 -0
- package/dist/plugins/todo/prompts.d.ts.map +1 -0
- package/dist/plugins/todo/schema.d.ts +44 -0
- package/dist/plugins/todo/schema.d.ts.map +1 -0
- package/dist/plugins/todo/todo.integration.test.d.ts +2 -0
- package/dist/plugins/todo/todo.integration.test.d.ts.map +1 -0
- package/dist/plugins/uploads/index.d.ts +9 -0
- package/dist/plugins/uploads/index.d.ts.map +1 -0
- package/dist/plugins/uploads/plugin.d.ts +56 -0
- package/dist/plugins/uploads/plugin.d.ts.map +1 -0
- package/dist/plugins/uploads/preprocessor.d.ts +70 -0
- package/dist/plugins/uploads/preprocessor.d.ts.map +1 -0
- package/dist/plugins/uploads/preprocessors/image-classifier.d.ts +49 -0
- package/dist/plugins/uploads/preprocessors/image-classifier.d.ts.map +1 -0
- package/dist/plugins/uploads/preprocessors/index.d.ts +7 -0
- package/dist/plugins/uploads/preprocessors/index.d.ts.map +1 -0
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.d.ts +43 -0
- package/dist/plugins/uploads/preprocessors/markitdown-preprocessor.d.ts.map +1 -0
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.d.ts +30 -0
- package/dist/plugins/uploads/preprocessors/zip-preprocessor.d.ts.map +1 -0
- package/dist/plugins/uploads/schema.d.ts +72 -0
- package/dist/plugins/uploads/schema.d.ts.map +1 -0
- package/dist/plugins/uploads/state.d.ts +38 -0
- package/dist/plugins/uploads/state.d.ts.map +1 -0
- package/dist/plugins/uploads/uploads.integration.test.d.ts +2 -0
- package/dist/plugins/uploads/uploads.integration.test.d.ts.map +1 -0
- package/dist/plugins/user-chat/index.d.ts +7 -0
- package/dist/plugins/user-chat/index.d.ts.map +1 -0
- package/dist/plugins/user-chat/plugin.d.ts +221 -0
- package/dist/plugins/user-chat/plugin.d.ts.map +1 -0
- package/dist/plugins/user-chat/prompts.d.ts +13 -0
- package/dist/plugins/user-chat/prompts.d.ts.map +1 -0
- package/dist/plugins/user-chat/schema.d.ts +82 -0
- package/dist/plugins/user-chat/schema.d.ts.map +1 -0
- package/dist/plugins/user-chat/user-chat.integration.test.d.ts +2 -0
- package/dist/plugins/user-chat/user-chat.integration.test.d.ts.map +1 -0
- package/dist/plugins/workers/context.d.ts +159 -0
- package/dist/plugins/workers/context.d.ts.map +1 -0
- package/dist/plugins/workers/definition.d.ts +118 -0
- package/dist/plugins/workers/definition.d.ts.map +1 -0
- package/dist/plugins/workers/index.d.ts +11 -0
- package/dist/plugins/workers/index.d.ts.map +1 -0
- package/dist/plugins/workers/plugin.d.ts +125 -0
- package/dist/plugins/workers/plugin.d.ts.map +1 -0
- package/dist/plugins/workers/worker.d.ts +76 -0
- package/dist/plugins/workers/worker.d.ts.map +1 -0
- package/dist/plugins/workers/workers.integration.test.d.ts +2 -0
- package/dist/plugins/workers/workers.integration.test.d.ts.map +1 -0
- package/dist/prompts/base.d.ts +75 -0
- package/dist/prompts/base.d.ts.map +1 -0
- package/dist/prompts/builder.d.ts +73 -0
- package/dist/prompts/builder.d.ts.map +1 -0
- package/dist/prompts/index.d.ts +10 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/macros.d.ts +15 -0
- package/dist/prompts/macros.d.ts.map +1 -0
- package/dist/prompts/macros.test.d.ts +2 -0
- package/dist/prompts/macros.test.d.ts.map +1 -0
- package/dist/testing/bootstrap-for-testing.d.ts +12 -0
- package/dist/testing/bootstrap-for-testing.d.ts.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/node-platform.d.ts +12 -0
- package/dist/testing/node-platform.d.ts.map +1 -0
- package/dist/testing/notification-collector.d.ts +46 -0
- package/dist/testing/notification-collector.d.ts.map +1 -0
- package/dist/testing/preset-helpers.d.ts +28 -0
- package/dist/testing/preset-helpers.d.ts.map +1 -0
- package/dist/testing/test-harness.d.ts +117 -0
- package/dist/testing/test-harness.d.ts.map +1 -0
- package/dist/testing/test-harness.test.d.ts +2 -0
- package/dist/testing/test-harness.test.d.ts.map +1 -0
- package/dist/testing/wait-helpers.d.ts +17 -0
- package/dist/testing/wait-helpers.d.ts.map +1 -0
- package/dist/transport/adapter/client-adapter.d.ts +32 -0
- package/dist/transport/adapter/client-adapter.d.ts.map +1 -0
- package/dist/transport/adapter/index.d.ts +23 -0
- package/dist/transport/adapter/index.d.ts.map +1 -0
- package/dist/transport/adapter/server-adapter.d.ts +29 -0
- package/dist/transport/adapter/server-adapter.d.ts.map +1 -0
- package/dist/transport/adapter/types.d.ts +14 -0
- package/dist/transport/adapter/types.d.ts.map +1 -0
- package/dist/transport/http/app.d.ts +41 -0
- package/dist/transport/http/app.d.ts.map +1 -0
- package/dist/transport/http/index.d.ts +7 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/middleware/bearer-auth.d.ts +16 -0
- package/dist/transport/http/middleware/bearer-auth.d.ts.map +1 -0
- package/dist/transport/http/middleware/error-handler.d.ts +21 -0
- package/dist/transport/http/middleware/error-handler.d.ts.map +1 -0
- package/dist/transport/http/routes/files.d.ts +16 -0
- package/dist/transport/http/routes/files.d.ts.map +1 -0
- package/dist/transport/http/routes/resources.d.ts +12 -0
- package/dist/transport/http/routes/resources.d.ts.map +1 -0
- package/dist/transport/http/routes/rpc.d.ts +22 -0
- package/dist/transport/http/routes/rpc.d.ts.map +1 -0
- package/dist/transport/http/routes/rpc.integration.test.d.ts +2 -0
- package/dist/transport/http/routes/rpc.integration.test.d.ts.map +1 -0
- package/dist/transport/http/routes/rpc.test.d.ts +2 -0
- package/dist/transport/http/routes/rpc.test.d.ts.map +1 -0
- package/dist/transport/http/routes/upload.d.ts +14 -0
- package/dist/transport/http/routes/upload.d.ts.map +1 -0
- package/dist/transport/rpc/index.d.ts +8 -0
- package/dist/transport/rpc/index.d.ts.map +1 -0
- package/dist/transport/rpc/methods.d.ts +25 -0
- package/dist/transport/rpc/methods.d.ts.map +1 -0
- package/dist/user-config.d.ts +29 -0
- package/dist/user-config.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/bootstrap.ts +268 -0
- package/src/builtin-events.ts +25 -0
- package/src/bun-platform/fs.ts +50 -0
- package/src/bun-platform/index.ts +21 -0
- package/src/bun-platform/process.ts +25 -0
- package/src/config.test.ts +174 -0
- package/src/config.ts +103 -0
- package/src/core/agent-loop.integration.test.ts +503 -0
- package/src/core/agents/agent-config.test.ts +240 -0
- package/src/core/agents/agent-roles.ts +41 -0
- package/src/core/agents/agent-shutdown.test.ts +236 -0
- package/src/core/agents/agent.test.ts +387 -0
- package/src/core/agents/agent.ts +1472 -0
- package/src/core/agents/communicator.ts +16 -0
- package/src/core/agents/config.ts +98 -0
- package/src/core/agents/context.ts +19 -0
- package/src/core/agents/debounce.ts +116 -0
- package/src/core/agents/handler-events.test.ts +167 -0
- package/src/core/agents/index.ts +1 -0
- package/src/core/agents/response-sanitizer.test.ts +137 -0
- package/src/core/agents/response-sanitizer.ts +67 -0
- package/src/core/agents/retry.ts +164 -0
- package/src/core/agents/schema.ts +75 -0
- package/src/core/agents/state.ts +272 -0
- package/src/core/context/state.ts +38 -0
- package/src/core/errors.ts +55 -0
- package/src/core/event-sourcing.integration.test.ts +191 -0
- package/src/core/events/base-event-store.ts +264 -0
- package/src/core/events/event-store.ts +143 -0
- package/src/core/events/file.test.ts +436 -0
- package/src/core/events/file.ts +372 -0
- package/src/core/events/index.ts +3 -0
- package/src/core/events/memory.test.ts +741 -0
- package/src/core/events/memory.ts +131 -0
- package/src/core/events/metadata-utils.ts +133 -0
- package/src/core/events/test-helpers.ts +31 -0
- package/src/core/events/types.ts +64 -0
- package/src/core/file-store/file-store.ts +275 -0
- package/src/core/file-store/types.ts +52 -0
- package/src/core/image/image-processor.test.ts +218 -0
- package/src/core/image/image-processor.ts +127 -0
- package/src/core/image/index.ts +4 -0
- package/src/core/image/noop-resizer.ts +7 -0
- package/src/core/image/types.ts +24 -0
- package/src/core/image/vips-resizer.test.ts +377 -0
- package/src/core/image/vips-resizer.ts +124 -0
- package/src/core/llm/__snapshots__/anthropic-assistant-text-with-tool-calls.json +156 -0
- package/src/core/llm/__snapshots__/anthropic-consecutive-tool-results.json +152 -0
- package/src/core/llm/__snapshots__/anthropic-image-data-url.json +105 -0
- package/src/core/llm/__snapshots__/anthropic-image-http-url.json +104 -0
- package/src/core/llm/__snapshots__/anthropic-multiple-images.json +113 -0
- package/src/core/llm/__snapshots__/anthropic-multiple-tool-calls-requested.json +151 -0
- package/src/core/llm/__snapshots__/anthropic-simple-user-message.json +97 -0
- package/src/core/llm/__snapshots__/anthropic-system-message-in-conversation.json +119 -0
- package/src/core/llm/__snapshots__/anthropic-tool-call.json +123 -0
- package/src/core/llm/__snapshots__/anthropic-tool-error-result.json +139 -0
- package/src/core/llm/__snapshots__/anthropic-tool-result-with-image.json +152 -0
- package/src/core/llm/__snapshots__/anthropic-tool-roundtrip.json +139 -0
- package/src/core/llm/__snapshots__/openrouter-assistant-text-with-tool-calls.json +150 -0
- package/src/core/llm/__snapshots__/openrouter-consecutive-tool-results.json +150 -0
- package/src/core/llm/__snapshots__/openrouter-image-data-url.json +107 -0
- package/src/core/llm/__snapshots__/openrouter-image-http-url.json +107 -0
- package/src/core/llm/__snapshots__/openrouter-multiple-images.json +113 -0
- package/src/core/llm/__snapshots__/openrouter-multiple-tool-calls-requested.json +158 -0
- package/src/core/llm/__snapshots__/openrouter-simple-user-message.json +96 -0
- package/src/core/llm/__snapshots__/openrouter-system-message-in-conversation.json +108 -0
- package/src/core/llm/__snapshots__/openrouter-tool-call.json +129 -0
- package/src/core/llm/__snapshots__/openrouter-tool-error-result.json +137 -0
- package/src/core/llm/__snapshots__/openrouter-tool-result-with-image.json +148 -0
- package/src/core/llm/__snapshots__/openrouter-tool-roundtrip.json +137 -0
- package/src/core/llm/anthropic.test.ts +509 -0
- package/src/core/llm/anthropic.ts +578 -0
- package/src/core/llm/cache-breakpoints.ts +38 -0
- package/src/core/llm/cache-live.test.ts +155 -0
- package/src/core/llm/index.ts +30 -0
- package/src/core/llm/llm-log-types.ts +167 -0
- package/src/core/llm/logger.test.ts +270 -0
- package/src/core/llm/logger.ts +306 -0
- package/src/core/llm/logging-provider.ts +73 -0
- package/src/core/llm/middleware.ts +172 -0
- package/src/core/llm/mock.test.ts +402 -0
- package/src/core/llm/mock.ts +234 -0
- package/src/core/llm/openrouter-mapping.test.ts +153 -0
- package/src/core/llm/openrouter.test.ts +499 -0
- package/src/core/llm/openrouter.ts +458 -0
- package/src/core/llm/provider-integration.test.ts +408 -0
- package/src/core/llm/provider.ts +238 -0
- package/src/core/llm/routing-provider.test.ts +113 -0
- package/src/core/llm/routing-provider.ts +86 -0
- package/src/core/llm/schema.ts +47 -0
- package/src/core/llm/snapshot-fetch.ts +158 -0
- package/src/core/llm/snapshot-middleware.test.ts +168 -0
- package/src/core/llm/snapshot-middleware.ts +185 -0
- package/src/core/llm/state.ts +92 -0
- package/src/core/llm/tokens.ts +61 -0
- package/src/core/multi-agent.integration.test.ts +340 -0
- package/src/core/plugin-hooks.integration.test.ts +428 -0
- package/src/core/plugins/hook-types.ts +49 -0
- package/src/core/plugins/index.ts +52 -0
- package/src/core/plugins/plugin-builder.ts +967 -0
- package/src/core/preset/config.ts +110 -0
- package/src/core/preset/index.ts +11 -0
- package/src/core/preset/preset-builder.ts +111 -0
- package/src/core/session-lifecycle.integration.test.ts +202 -0
- package/src/core/sessions/apply-event.ts +46 -0
- package/src/core/sessions/context.ts +36 -0
- package/src/core/sessions/fork-utils.test.ts +158 -0
- package/src/core/sessions/fork-utils.ts +71 -0
- package/src/core/sessions/reducer.ts +95 -0
- package/src/core/sessions/schema.ts +91 -0
- package/src/core/sessions/session-environment.ts +12 -0
- package/src/core/sessions/session-manager.ts +883 -0
- package/src/core/sessions/session-store.ts +141 -0
- package/src/core/sessions/session.test.ts +1730 -0
- package/src/core/sessions/session.ts +833 -0
- package/src/core/sessions/state.ts +520 -0
- package/src/core/system.ts +206 -0
- package/src/core/tools/context.ts +3 -0
- package/src/core/tools/definition.ts +15 -0
- package/src/core/tools/executor.test.ts +160 -0
- package/src/core/tools/executor.ts +117 -0
- package/src/core/tools/index.ts +3 -0
- package/src/core/tools/schema.ts +80 -0
- package/src/core/tools/state.ts +34 -0
- package/src/index.ts +165 -0
- package/src/lib/json/index.ts +20 -0
- package/src/lib/logger/console.test.ts +348 -0
- package/src/lib/logger/console.ts +185 -0
- package/src/lib/logger/file.ts +65 -0
- package/src/lib/logger/index.ts +4 -0
- package/src/lib/logger/logger.ts +114 -0
- package/src/lib/logger/ring-buffer.ts +65 -0
- package/src/lib/logger/tee.ts +51 -0
- package/src/lib/mime.ts +23 -0
- package/src/lib/never.ts +3 -0
- package/src/lib/utils/hash.ts +38 -0
- package/src/lib/utils/result.ts +35 -0
- package/src/platform/fs.ts +38 -0
- package/src/platform/index.ts +23 -0
- package/src/platform/process.ts +28 -0
- package/src/plugins/agent-status/plugin.ts +77 -0
- package/src/plugins/agents/agents.integration.test.ts +808 -0
- package/src/plugins/agents/index.ts +2 -0
- package/src/plugins/agents/plugin.ts +242 -0
- package/src/plugins/context-compact/context-compact.integration.test.ts +207 -0
- package/src/plugins/context-compact/context-compactor.test.ts +923 -0
- package/src/plugins/context-compact/context-compactor.ts +343 -0
- package/src/plugins/context-compact/history-offloader.test.ts +100 -0
- package/src/plugins/context-compact/history-offloader.ts +47 -0
- package/src/plugins/context-compact/index.ts +3 -0
- package/src/plugins/context-compact/plugin.ts +62 -0
- package/src/plugins/filesystem/filesystem.integration.test.ts +485 -0
- package/src/plugins/filesystem/helpers.ts +216 -0
- package/src/plugins/filesystem/index.ts +4 -0
- package/src/plugins/filesystem/listing.ts +276 -0
- package/src/plugins/filesystem/plugin.ts +468 -0
- package/src/plugins/filesystem/schema.ts +6 -0
- package/src/plugins/git-status/index.ts +1 -0
- package/src/plugins/git-status/plugin.ts +166 -0
- package/src/plugins/limits-guard/config.ts +26 -0
- package/src/plugins/limits-guard/index.ts +4 -0
- package/src/plugins/limits-guard/limit-guard.test.ts +161 -0
- package/src/plugins/limits-guard/limit-guard.ts +164 -0
- package/src/plugins/limits-guard/limits-guard.integration.test.ts +437 -0
- package/src/plugins/limits-guard/plugin.ts +306 -0
- package/src/plugins/llm-debug/index.ts +1 -0
- package/src/plugins/llm-debug/llm-debug.integration.test.ts +192 -0
- package/src/plugins/llm-debug/plugin.ts +172 -0
- package/src/plugins/logs/index.ts +1 -0
- package/src/plugins/logs/plugin.ts +39 -0
- package/src/plugins/mailbox/helpers.ts +83 -0
- package/src/plugins/mailbox/index.ts +13 -0
- package/src/plugins/mailbox/mailbox.integration.test.ts +705 -0
- package/src/plugins/mailbox/plugin.ts +270 -0
- package/src/plugins/mailbox/prompts.ts +104 -0
- package/src/plugins/mailbox/query.ts +53 -0
- package/src/plugins/mailbox/schema.ts +81 -0
- package/src/plugins/mailbox/state.ts +52 -0
- package/src/plugins/resources/index.ts +11 -0
- package/src/plugins/resources/manifest.ts +25 -0
- package/src/plugins/resources/plugin.ts +201 -0
- package/src/plugins/resources/post-inject.ts +74 -0
- package/src/plugins/resources/state.ts +30 -0
- package/src/plugins/result-eviction/index.ts +2 -0
- package/src/plugins/result-eviction/plugin.ts +65 -0
- package/src/plugins/result-eviction/result-eviction.integration.test.ts +244 -0
- package/src/plugins/services/plugin.ts +485 -0
- package/src/plugins/services/port-pool.ts +73 -0
- package/src/plugins/services/prompt.ts +53 -0
- package/src/plugins/services/schema.ts +83 -0
- package/src/plugins/services/service.ts +578 -0
- package/src/plugins/services/services.integration.test.ts +595 -0
- package/src/plugins/session-lifecycle/index.ts +1 -0
- package/src/plugins/session-lifecycle/plugin.ts +302 -0
- package/src/plugins/session-lifecycle/session-lifecycle.integration.test.ts +639 -0
- package/src/plugins/session-state/plugin.ts +179 -0
- package/src/plugins/session-stats/index.ts +3 -0
- package/src/plugins/session-stats/plugin.ts +120 -0
- package/src/plugins/shell/executor.ts +462 -0
- package/src/plugins/shell/index.ts +23 -0
- package/src/plugins/shell/plugin.ts +118 -0
- package/src/plugins/shell/shell.integration.test.ts +273 -0
- package/src/plugins/shell/shell.test.ts +314 -0
- package/src/plugins/skills/discovery.test.ts +395 -0
- package/src/plugins/skills/discovery.ts +276 -0
- package/src/plugins/skills/index.ts +32 -0
- package/src/plugins/skills/plugin.ts +381 -0
- package/src/plugins/skills/prompts.ts +84 -0
- package/src/plugins/skills/schema.ts +88 -0
- package/src/plugins/skills/skills.integration.test.ts +580 -0
- package/src/plugins/snapshotting/index.ts +3 -0
- package/src/plugins/snapshotting/jj-snapshotter.ts +122 -0
- package/src/plugins/snapshotting/plugin.ts +36 -0
- package/src/plugins/snapshotting/snapshotter.ts +20 -0
- package/src/plugins/todo/index.ts +11 -0
- package/src/plugins/todo/plugin.ts +363 -0
- package/src/plugins/todo/prompts.ts +63 -0
- package/src/plugins/todo/schema.ts +71 -0
- package/src/plugins/todo/todo.integration.test.ts +687 -0
- package/src/plugins/uploads/index.ts +13 -0
- package/src/plugins/uploads/plugin.ts +406 -0
- package/src/plugins/uploads/preprocessor.ts +111 -0
- package/src/plugins/uploads/preprocessors/image-classifier.ts +176 -0
- package/src/plugins/uploads/preprocessors/index.ts +7 -0
- package/src/plugins/uploads/preprocessors/markitdown-preprocessor.ts +262 -0
- package/src/plugins/uploads/preprocessors/zip-preprocessor.ts +210 -0
- package/src/plugins/uploads/schema.ts +92 -0
- package/src/plugins/uploads/state.ts +42 -0
- package/src/plugins/uploads/uploads.integration.test.ts +654 -0
- package/src/plugins/user-chat/index.ts +17 -0
- package/src/plugins/user-chat/plugin.ts +728 -0
- package/src/plugins/user-chat/prompts.ts +30 -0
- package/src/plugins/user-chat/schema.ts +80 -0
- package/src/plugins/user-chat/user-chat.integration.test.ts +794 -0
- package/src/plugins/workers/context.ts +251 -0
- package/src/plugins/workers/definition.ts +169 -0
- package/src/plugins/workers/index.ts +21 -0
- package/src/plugins/workers/plugin.ts +722 -0
- package/src/plugins/workers/worker.ts +115 -0
- package/src/plugins/workers/workers.integration.test.ts +778 -0
- package/src/prompts/base.ts +266 -0
- package/src/prompts/builder.ts +194 -0
- package/src/prompts/index.ts +36 -0
- package/src/prompts/macros.test.ts +107 -0
- package/src/prompts/macros.ts +27 -0
- package/src/testing/bootstrap-for-testing.ts +39 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/node-platform.ts +80 -0
- package/src/testing/notification-collector.ts +100 -0
- package/src/testing/preset-helpers.ts +57 -0
- package/src/testing/test-harness.test.ts +63 -0
- package/src/testing/test-harness.ts +279 -0
- package/src/testing/wait-helpers.ts +84 -0
- package/src/transport/adapter/client-adapter.ts +81 -0
- package/src/transport/adapter/index.ts +42 -0
- package/src/transport/adapter/server-adapter.ts +93 -0
- package/src/transport/adapter/types.ts +20 -0
- package/src/transport/http/app.ts +129 -0
- package/src/transport/http/index.ts +7 -0
- package/src/transport/http/middleware/bearer-auth.ts +40 -0
- package/src/transport/http/middleware/error-handler.ts +76 -0
- package/src/transport/http/routes/files.ts +274 -0
- package/src/transport/http/routes/resources.ts +115 -0
- package/src/transport/http/routes/rpc.integration.test.ts +243 -0
- package/src/transport/http/routes/rpc.test.ts +372 -0
- package/src/transport/http/routes/rpc.ts +156 -0
- package/src/transport/http/routes/upload.ts +286 -0
- package/src/transport/rpc/index.ts +11 -0
- package/src/transport/rpc/methods.ts +38 -0
- package/src/user-config.ts +33 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session - OOP wrapper for session management.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* - Factory for agents
|
|
6
|
+
* - User output callback
|
|
7
|
+
* - Plugin method aggregation
|
|
8
|
+
*/
|
|
9
|
+
import { AgentId } from '../../core/agents/schema.js';
|
|
10
|
+
import { type DomainError } from '../../core/errors.js';
|
|
11
|
+
import type { LLMLogger } from '../../core/llm/logger.js';
|
|
12
|
+
import type { LLMProvider } from '../../core/llm/provider.js';
|
|
13
|
+
import type { CallerContext, ConfiguredPlugin } from '../../core/plugins/plugin-builder.js';
|
|
14
|
+
import { type PluginNotification } from '../../core/plugins/plugin-builder.js';
|
|
15
|
+
import type { Preset } from '../../core/preset/index.js';
|
|
16
|
+
import type { SessionId } from '../../core/sessions/schema.js';
|
|
17
|
+
import type { SessionState } from '../../core/sessions/state.js';
|
|
18
|
+
import type { Logger } from '../../lib/logger/logger.js';
|
|
19
|
+
import type { Platform } from '../../platform/index.js';
|
|
20
|
+
import type { Result } from '../../lib/utils/result.js';
|
|
21
|
+
import { Agent } from '../agents/agent.js';
|
|
22
|
+
import type { EventStore } from '../events/event-store.js';
|
|
23
|
+
import type { ToolExecutor } from '../tools/executor.js';
|
|
24
|
+
import { SessionStore } from './session-store.js';
|
|
25
|
+
/**
|
|
26
|
+
* Callback for user-facing output.
|
|
27
|
+
* Receives plugin notifications that are broadcast to connected clients.
|
|
28
|
+
*/
|
|
29
|
+
export type UserOutputCallback = (notification: PluginNotification) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Dependencies for creating a Session.
|
|
32
|
+
*/
|
|
33
|
+
export interface SessionDependencies {
|
|
34
|
+
store: SessionStore;
|
|
35
|
+
preset: Preset;
|
|
36
|
+
llmProvider: LLMProvider;
|
|
37
|
+
/** Named provider instances for middleware routing */
|
|
38
|
+
llmProviders?: ReadonlyMap<string, LLMProvider>;
|
|
39
|
+
toolExecutor: ToolExecutor;
|
|
40
|
+
logger: Logger;
|
|
41
|
+
onUserOutput?: UserOutputCallback;
|
|
42
|
+
/** Absolute path to session directory */
|
|
43
|
+
sessionDir: string;
|
|
44
|
+
/** Configured plugins for this session */
|
|
45
|
+
plugins: ConfiguredPlugin[];
|
|
46
|
+
/** Event store for loading/querying events */
|
|
47
|
+
eventStore: EventStore;
|
|
48
|
+
/** LLM call logger for debugging and audit */
|
|
49
|
+
llmLogger?: LLMLogger;
|
|
50
|
+
/** Host-environment adapters (filesystem, process). */
|
|
51
|
+
platform: Platform;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Session manages agents and delegates everything else to plugins.
|
|
55
|
+
*/
|
|
56
|
+
export declare class Session {
|
|
57
|
+
readonly id: SessionId;
|
|
58
|
+
readonly store: SessionStore;
|
|
59
|
+
private readonly preset;
|
|
60
|
+
private readonly llmProvider;
|
|
61
|
+
private readonly llmProviders;
|
|
62
|
+
private readonly toolExecutor;
|
|
63
|
+
private readonly logger;
|
|
64
|
+
private readonly onUserOutput?;
|
|
65
|
+
private readonly sessionDir;
|
|
66
|
+
private readonly plugins;
|
|
67
|
+
private readonly eventStore;
|
|
68
|
+
private readonly llmLogger?;
|
|
69
|
+
private readonly platform;
|
|
70
|
+
private readonly agents;
|
|
71
|
+
/** Cached plugin contexts created by plugin.createContext() */
|
|
72
|
+
private readonly pluginContexts;
|
|
73
|
+
constructor(deps: SessionDependencies);
|
|
74
|
+
/**
|
|
75
|
+
* Get the current session state.
|
|
76
|
+
*/
|
|
77
|
+
get state(): SessionState;
|
|
78
|
+
/**
|
|
79
|
+
* Get the preset configuration for this session.
|
|
80
|
+
*/
|
|
81
|
+
getPreset(): Preset;
|
|
82
|
+
/**
|
|
83
|
+
* Get the entry agent ID (communicator if present, otherwise orchestrator).
|
|
84
|
+
*/
|
|
85
|
+
getEntryAgentId(): AgentId | null;
|
|
86
|
+
/**
|
|
87
|
+
* Initialize plugin contexts.
|
|
88
|
+
* Must be called before session hooks or plugin methods that need pluginContext.
|
|
89
|
+
*/
|
|
90
|
+
initPluginContexts(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Call onSessionReady hooks for all plugins (with full context).
|
|
93
|
+
*
|
|
94
|
+
* Only errors are persisted as events — successful runs produce no event
|
|
95
|
+
* to keep the session log focused on state changes, not invocation noise.
|
|
96
|
+
*/
|
|
97
|
+
callSessionReadyHooks(): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Close the session.
|
|
100
|
+
* Emits session_closed event — hooks and agent shutdown are handled reactively by handleSessionClosed().
|
|
101
|
+
*/
|
|
102
|
+
close(): Promise<Result<void, DomainError>>;
|
|
103
|
+
/**
|
|
104
|
+
* Reopen a closed session.
|
|
105
|
+
*/
|
|
106
|
+
reopen(): Promise<Result<void, DomainError>>;
|
|
107
|
+
/**
|
|
108
|
+
* Get an agent by ID.
|
|
109
|
+
*/
|
|
110
|
+
getAgent(agentId: AgentId): Agent | null;
|
|
111
|
+
/**
|
|
112
|
+
* Get the entry agent (communicator or orchestrator).
|
|
113
|
+
*/
|
|
114
|
+
getEntryAgent(): Agent | null;
|
|
115
|
+
/**
|
|
116
|
+
* Schedule agent processing (with debounce).
|
|
117
|
+
*/
|
|
118
|
+
scheduleAgent(agentId: AgentId): void;
|
|
119
|
+
/**
|
|
120
|
+
* Force process an agent (bypass debounce).
|
|
121
|
+
*/
|
|
122
|
+
forceProcessAgent(agentId: AgentId): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Resume a paused agent so it can continue processing.
|
|
125
|
+
*/
|
|
126
|
+
resumeAgent(agentId: AgentId): Promise<Result<void, DomainError>>;
|
|
127
|
+
/**
|
|
128
|
+
* Pause an agent manually via API.
|
|
129
|
+
*/
|
|
130
|
+
pauseAgent(agentId: AgentId, message?: string): Promise<Result<void, DomainError>>;
|
|
131
|
+
/**
|
|
132
|
+
* Manually spawn an agent under a given parent.
|
|
133
|
+
*/
|
|
134
|
+
spawnAgentManually(definitionName: string, parentId: AgentId, message?: string, typedInput?: unknown): Promise<Result<AgentId, DomainError>>;
|
|
135
|
+
/**
|
|
136
|
+
* Shutdown the session - stop all agent processing.
|
|
137
|
+
*/
|
|
138
|
+
shutdown(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Check if a session has any agents that need processing.
|
|
141
|
+
*/
|
|
142
|
+
checkPendingAgents(): void;
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate methods from all plugins.
|
|
145
|
+
* Returns a map of "pluginName.methodName" → { input, output, handler }.
|
|
146
|
+
*/
|
|
147
|
+
getPluginMethods(): Map<string, ConfiguredPlugin['methods'][string]>;
|
|
148
|
+
/**
|
|
149
|
+
* Call a plugin method with properly constructed MethodHandlerContext.
|
|
150
|
+
* The context includes pluginState, pluginConfig (bound in closure),
|
|
151
|
+
* pluginContext, and scheduleAgent.
|
|
152
|
+
*/
|
|
153
|
+
callPluginMethod(method: string, input: unknown, agentId?: AgentId, caller?: CallerContext): Promise<Result<unknown, DomainError>>;
|
|
154
|
+
/**
|
|
155
|
+
* Initialize agents from session state.
|
|
156
|
+
*/
|
|
157
|
+
private initializeAgents;
|
|
158
|
+
/**
|
|
159
|
+
* Create an Agent instance from state.
|
|
160
|
+
*/
|
|
161
|
+
private createAgent;
|
|
162
|
+
/**
|
|
163
|
+
* Handle events emitted to the store — reactive scheduling.
|
|
164
|
+
*/
|
|
165
|
+
private handleStoreEvent;
|
|
166
|
+
/**
|
|
167
|
+
* Handle session_closed event — call close hooks and shutdown agents.
|
|
168
|
+
*
|
|
169
|
+
* Unlike onSessionReady (which re-throws), onSessionClose intentionally
|
|
170
|
+
* swallows per-plugin errors so that all plugins get a chance to clean up
|
|
171
|
+
* and agents are always shut down, even if one plugin's close hook fails.
|
|
172
|
+
*/
|
|
173
|
+
private handleSessionClosed;
|
|
174
|
+
/**
|
|
175
|
+
* Handle newly spawned agent.
|
|
176
|
+
*/
|
|
177
|
+
private handleAgentSpawned;
|
|
178
|
+
/**
|
|
179
|
+
* Handle user-facing output events.
|
|
180
|
+
*/
|
|
181
|
+
/**
|
|
182
|
+
* Create a notify function bound to a specific plugin name.
|
|
183
|
+
*/
|
|
184
|
+
private createNotify;
|
|
185
|
+
/**
|
|
186
|
+
* Build deps object for a plugin — delegates method calls to callPluginMethod.
|
|
187
|
+
*/
|
|
188
|
+
private buildPluginDeps;
|
|
189
|
+
/**
|
|
190
|
+
* Build a SessionContext from current session state.
|
|
191
|
+
*/
|
|
192
|
+
private buildSessionContext;
|
|
193
|
+
/**
|
|
194
|
+
* Build context for a session-level hook (onSessionReady / onSessionClose).
|
|
195
|
+
* Provides pluginConfig (via closure), pluginContext, pluginState, self, and session fields.
|
|
196
|
+
*/
|
|
197
|
+
private buildSessionHookContext;
|
|
198
|
+
/**
|
|
199
|
+
* Get session environment for tool context.
|
|
200
|
+
*/
|
|
201
|
+
private getSessionEnvironment;
|
|
202
|
+
/**
|
|
203
|
+
* Get LLM middleware from the agent/orchestrator/communicator definition.
|
|
204
|
+
*/
|
|
205
|
+
private getAgentMiddleware;
|
|
206
|
+
/**
|
|
207
|
+
* Get agent config from preset definition.
|
|
208
|
+
* Tools are provided by plugins (Agent collects from plugins).
|
|
209
|
+
*/
|
|
210
|
+
private getAgentConfig;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/sessions/session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,OAAO,EAAmB,MAAM,yBAAyB,CAAA;AAGlE,OAAO,EAAe,KAAK,WAAW,EAAmC,MAAM,kBAAkB,CAAA;AAGjG,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MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAkDxC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,WAAW;IA8DnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;;;;OAMG;YACW,mBAAmB;IAkCjC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAqB1B;;OAEG;IAEH;;OAEG;IACH,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgC/B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;IACH,OAAO,CAAC,cAAc;CA0DtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.test.d.ts","sourceRoot":"","sources":["../../../src/core/sessions/session.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import z4 from 'zod/v4';
|
|
2
|
+
import type { AgentId } from '../../core/agents/schema.js';
|
|
3
|
+
import type { DomainEvent } from '../../core/events/types.js';
|
|
4
|
+
import { SessionId } from '../../core/sessions/schema.js';
|
|
5
|
+
import type { ToolCallId } from '../../core/tools/schema.js';
|
|
6
|
+
import type { AgentState } from '../agents/state.js';
|
|
7
|
+
/**
|
|
8
|
+
* Session lifecycle hook name.
|
|
9
|
+
* These correspond to ConfiguredPlugin sessionHooks.
|
|
10
|
+
*/
|
|
11
|
+
export type SessionHandlerName = 'onSessionReady' | 'onSessionClose';
|
|
12
|
+
export declare const sessionEvents: import("../../core/events/types").EventsFactory<{
|
|
13
|
+
session_created: z4.ZodObject<{
|
|
14
|
+
presetId: z4.ZodString;
|
|
15
|
+
workspaceDir: z4.ZodOptional<z4.ZodString>;
|
|
16
|
+
forkedFrom: z4.ZodOptional<z4.ZodObject<{
|
|
17
|
+
sessionId: z4.core.$ZodBranded<z4.ZodString, "SessionId", "out">;
|
|
18
|
+
eventIndex: z4.ZodNumber;
|
|
19
|
+
}, z4.core.$strip>>;
|
|
20
|
+
}, z4.core.$strip>;
|
|
21
|
+
session_closed: z4.ZodObject<{}, z4.core.$loose>;
|
|
22
|
+
session_reopened: z4.ZodObject<{}, z4.core.$loose>;
|
|
23
|
+
session_restarted: z4.ZodObject<{
|
|
24
|
+
resetAgentIds: z4.ZodArray<z4.core.$ZodBranded<z4.ZodString, "AgentId", "out">>;
|
|
25
|
+
clearedToolAgentIds: z4.ZodArray<z4.core.$ZodBranded<z4.ZodString, "AgentId", "out">>;
|
|
26
|
+
}, z4.core.$strip>;
|
|
27
|
+
session_metadata_set: z4.ZodObject<{
|
|
28
|
+
key: z4.ZodString;
|
|
29
|
+
value: z4.ZodUnknown;
|
|
30
|
+
}, z4.core.$strip>;
|
|
31
|
+
session_handler_started: z4.ZodObject<{
|
|
32
|
+
handlerName: z4.ZodEnum<{
|
|
33
|
+
onSessionReady: "onSessionReady";
|
|
34
|
+
onSessionClose: "onSessionClose";
|
|
35
|
+
}>;
|
|
36
|
+
pluginName: z4.ZodString;
|
|
37
|
+
}, z4.core.$strip>;
|
|
38
|
+
session_handler_completed: z4.ZodObject<{
|
|
39
|
+
handlerName: z4.ZodEnum<{
|
|
40
|
+
onSessionReady: "onSessionReady";
|
|
41
|
+
onSessionClose: "onSessionClose";
|
|
42
|
+
}>;
|
|
43
|
+
pluginName: z4.ZodString;
|
|
44
|
+
durationMs: z4.ZodNumber;
|
|
45
|
+
error: z4.ZodOptional<z4.ZodString>;
|
|
46
|
+
}, z4.core.$strip>;
|
|
47
|
+
}>;
|
|
48
|
+
export type SessionCreatedEvent = (typeof sessionEvents)['Events']['session_created'];
|
|
49
|
+
export type SessionClosedEvent = (typeof sessionEvents)['Events']['session_closed'];
|
|
50
|
+
export type SessionReopenedEvent = (typeof sessionEvents)['Events']['session_reopened'];
|
|
51
|
+
export type SessionRestartedEvent = (typeof sessionEvents)['Events']['session_restarted'];
|
|
52
|
+
export type SessionMetadataSetEvent = (typeof sessionEvents)['Events']['session_metadata_set'];
|
|
53
|
+
export type SessionHandlerStartedEvent = (typeof sessionEvents)['Events']['session_handler_started'];
|
|
54
|
+
export type SessionHandlerCompletedEvent = (typeof sessionEvents)['Events']['session_handler_completed'];
|
|
55
|
+
/**
|
|
56
|
+
* Core session state.
|
|
57
|
+
*
|
|
58
|
+
* Plugin-owned fields (todos, workers, services, skills, agentLimits, etc.)
|
|
59
|
+
* are stored as dynamic keys managed by each plugin's state slice.
|
|
60
|
+
* Use `selectPluginState()` from reducer.ts to access them.
|
|
61
|
+
*/
|
|
62
|
+
export interface SessionState {
|
|
63
|
+
id: SessionId;
|
|
64
|
+
presetId: string;
|
|
65
|
+
status: 'active' | 'closed';
|
|
66
|
+
agents: Map<AgentId, AgentState>;
|
|
67
|
+
createdAt: number;
|
|
68
|
+
closedAt?: number;
|
|
69
|
+
/** Counter for agent IDs per definition name */
|
|
70
|
+
agentCounters: Map<string, number>;
|
|
71
|
+
/** Workspace directory path, if configured */
|
|
72
|
+
workspaceDir?: string;
|
|
73
|
+
/** Generic key-value metadata store (tool sets use their own keys) */
|
|
74
|
+
metadata: Map<string, unknown>;
|
|
75
|
+
/** If this session was forked from another session */
|
|
76
|
+
forkedFrom?: {
|
|
77
|
+
sessionId: SessionId;
|
|
78
|
+
eventIndex: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare const createSessionState: (id: SessionId, presetId: string, timestamp: number) => SessionState;
|
|
82
|
+
interface ToolCall {
|
|
83
|
+
id: ToolCallId;
|
|
84
|
+
name: string;
|
|
85
|
+
input: unknown;
|
|
86
|
+
}
|
|
87
|
+
export declare const fromLLMToolCall: (tc: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
input: unknown;
|
|
91
|
+
}) => ToolCall;
|
|
92
|
+
export declare const fromLLMToolCalls: (llmToolCalls: Array<{
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
input: unknown;
|
|
96
|
+
}>) => ToolCall[];
|
|
97
|
+
export declare const coreReducer: import("./reducer.js").SessionReducer;
|
|
98
|
+
export declare const isSessionCreatedEvent: (event: DomainEvent) => event is SessionCreatedEvent;
|
|
99
|
+
export declare const reconstructSessionState: (events: DomainEvent[], reducer: (state: SessionState, event: DomainEvent) => SessionState) => SessionState | null;
|
|
100
|
+
export declare const checkRecoveryNeeded: (state: SessionState) => {
|
|
101
|
+
resetAgentIds: AgentId[];
|
|
102
|
+
clearedToolAgentIds: AgentId[];
|
|
103
|
+
} | null;
|
|
104
|
+
export declare const getOrchestratorId: (state: SessionState) => AgentId | null;
|
|
105
|
+
export declare const getCommunicatorId: (state: SessionState) => AgentId | null;
|
|
106
|
+
export declare const getEntryAgentId: (state: SessionState) => AgentId | null;
|
|
107
|
+
export declare const getAgentState: (state: SessionState, agentId: AgentId) => AgentState | null;
|
|
108
|
+
export declare const getNextAgentSeq: (state: SessionState, definitionName: string) => number;
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/sessions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAKtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAmB,MAAM,2BAA2B,CAAA;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,KAAK,EAAE,UAAU,EAAmC,MAAM,oBAAoB,CAAA;AAOrF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,gBAAgB,CAAA;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AAI,OAAO,YAAY,KAAG,OAAO,GAAG,IAKjE,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,YAAY,KAAG,OAAO,GAAG,IAE/D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,YAAY,EAAE,SAAS,OAAO,KAAG,UAAU,GAAG,IAElF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,YAAY,EAAE,gBAAgB,MAAM,KAAG,MAE7E,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System — Composition Root
|
|
3
|
+
*
|
|
4
|
+
* createSystem() is the main entry point that:
|
|
5
|
+
* - Accepts all plugin definitions and infrastructure dependencies
|
|
6
|
+
* - Composes plugins, creates SessionManager internally
|
|
7
|
+
* - Exposes typed method registry for RPC type inference
|
|
8
|
+
*/
|
|
9
|
+
import type z4 from 'zod/v4';
|
|
10
|
+
import type { Logger } from '../lib/logger/logger.js';
|
|
11
|
+
import type { Platform } from '../platform/index.js';
|
|
12
|
+
import type { PortPool } from '../plugins/services/port-pool.js';
|
|
13
|
+
import type { PreprocessorRegistry } from '../plugins/uploads/preprocessor.js';
|
|
14
|
+
import type { EventStore } from './events/event-store.js';
|
|
15
|
+
import type { FileStore } from './file-store/types.js';
|
|
16
|
+
import type { LLMLogger } from './llm/logger.js';
|
|
17
|
+
import type { LLMProvider } from './llm/provider.js';
|
|
18
|
+
import type { PluginDefinition } from './plugins/plugin-builder.js';
|
|
19
|
+
import type { Preset } from './preset/index.js';
|
|
20
|
+
import { SessionManager } from './sessions/session-manager.js';
|
|
21
|
+
import type { UserOutputCallback } from './sessions/session.js';
|
|
22
|
+
import type { ToolExecutor } from './tools/executor.js';
|
|
23
|
+
export type MethodSchema = {
|
|
24
|
+
input: z4.ZodType;
|
|
25
|
+
output: z4.ZodType;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Extract manager method schemas from a single PluginDefinition.
|
|
29
|
+
* Uses indexed access on type brands (P['name'], P['_managerMethods'])
|
|
30
|
+
* instead of conditional `infer` — avoids expensive pattern matching on 5-param generic.
|
|
31
|
+
*/
|
|
32
|
+
type ManagerMethodSchemas<P extends PluginDefinition<string, any, any, any, any>> = {
|
|
33
|
+
[K in string & keyof NonNullable<P['_managerMethods']> as `${P['name']}.${K}`]: NonNullable<P['_managerMethods']>[K];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Extract session-level method schemas from a single PluginDefinition.
|
|
37
|
+
* The `__session` marker enables RpcInput<M> to automatically add `sessionId: string`
|
|
38
|
+
* for session methods (the RPC dispatcher requires sessionId for routing).
|
|
39
|
+
*/
|
|
40
|
+
type SessionMethodSchemas<P extends PluginDefinition<string, any, any, any, any>> = {
|
|
41
|
+
[K in string & keyof NonNullable<P['_methods']> as `${P['name']}.${K}`]: NonNullable<P['_methods']>[K] & {
|
|
42
|
+
__session: true;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/** Merge manager + session method schemas from a single plugin into one object */
|
|
46
|
+
type PluginSchemas<P extends PluginDefinition<string, any, any, any, any>> = ManagerMethodSchemas<P> & SessionMethodSchemas<P>;
|
|
47
|
+
/**
|
|
48
|
+
* Merge method schemas from an array of PluginDefinitions.
|
|
49
|
+
* Recursive tuple traversal — directly accumulates intersections without
|
|
50
|
+
* UnionToIntersection (which uses expensive contravariant inference over distributive conditionals).
|
|
51
|
+
*/
|
|
52
|
+
type MergePluginSchemas<TPlugins extends readonly PluginDefinition<string, any, any, any, any>[], Acc = {}> = TPlugins extends readonly [
|
|
53
|
+
infer Head extends PluginDefinition<string, any, any, any, any>,
|
|
54
|
+
...infer Tail extends readonly PluginDefinition<string, any, any, any, any>[]
|
|
55
|
+
] ? MergePluginSchemas<Tail, Acc & PluginSchemas<Head>> : Acc;
|
|
56
|
+
export type AllMethodSchemas<TPlugins extends readonly PluginDefinition<string, any, any, any, any>[]> = MergePluginSchemas<TPlugins>;
|
|
57
|
+
/**
|
|
58
|
+
* Maps an array of PluginDefinitions to a record keyed by plugin name.
|
|
59
|
+
* Enables `system.plugins.todo` → typed PluginDefinition accessor.
|
|
60
|
+
*/
|
|
61
|
+
type PluginsAccessor<TPlugins extends readonly PluginDefinition<string, any, any, any, any>[]> = {
|
|
62
|
+
[P in TPlugins[number] as P extends PluginDefinition<infer N, any, any, any, any> ? N : never]: P;
|
|
63
|
+
};
|
|
64
|
+
export interface System<TMethodSchemas = Record<string, MethodSchema>, TPlugins extends readonly PluginDefinition<string, any, any, any, any>[] = readonly PluginDefinition[]> {
|
|
65
|
+
/** SessionManager wrapped internally */
|
|
66
|
+
sessionManager: SessionManager;
|
|
67
|
+
/** Typed method registry (inferred from all plugins) */
|
|
68
|
+
methodSchemas: TMethodSchemas;
|
|
69
|
+
/** Typed accessor for all registered plugins */
|
|
70
|
+
plugins: PluginsAccessor<TPlugins>;
|
|
71
|
+
/** Shutdown all sessions */
|
|
72
|
+
shutdown(): Promise<void>;
|
|
73
|
+
/** Load all sessions from event store */
|
|
74
|
+
loadAllSessions(): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
export interface CreateSystemOptions<TPlugins extends readonly PluginDefinition<string, any, any, any, any>[]> {
|
|
77
|
+
/** All plugin definitions */
|
|
78
|
+
plugins: TPlugins;
|
|
79
|
+
eventStore: EventStore;
|
|
80
|
+
llmProvider: LLMProvider;
|
|
81
|
+
/** Named provider instances for middleware routing */
|
|
82
|
+
llmProviders?: ReadonlyMap<string, LLMProvider>;
|
|
83
|
+
toolExecutor: ToolExecutor;
|
|
84
|
+
presets: Map<string, Preset>;
|
|
85
|
+
logger: Logger;
|
|
86
|
+
basePath: string;
|
|
87
|
+
dataFileStore: FileStore;
|
|
88
|
+
onUserOutput?: UserOutputCallback;
|
|
89
|
+
preprocessorRegistry?: PreprocessorRegistry;
|
|
90
|
+
llmLogger?: LLMLogger;
|
|
91
|
+
portPool?: PortPool;
|
|
92
|
+
/** Host-environment adapters (filesystem, process). */
|
|
93
|
+
platform: Platform;
|
|
94
|
+
}
|
|
95
|
+
export declare function createSystem<const TPlugins extends readonly PluginDefinition<string, any, any, any, any>[]>(options: CreateSystemOptions<TPlugins>): System<AllMethodSchemas<TPlugins>, TPlugins>;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/core/system.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAMvD,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC;IAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAA;CAAE,CAAA;AAEpE;;;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ecutionCallback } from './schema';
|
|
3
|
+
export type ToolDefinition<TInput = unknown> = {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input: z4.ZodType<TInput>;
|
|
7
|
+
execute: ToolExecutionCallback<TInput>;
|
|
8
|
+
};
|
|
9
|
+
export declare function createTool<TInput = unknown>(args: ToolDefinition<TInput>): ToolDefinition<TInput>;
|
|
10
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/core/tools/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEhD,MAAM,MAAM,cAAc,CAAC,MAAM,GAAG,OAAO,IAAI;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACzB,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;CACtC,CAAA;AAED,wBAAgB,UAAU,CAAC,MAAM,GAAG,OAAO,EAC1C,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAC1B,cAAc,CAAC,MAAM,CAAC,CAExB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ToolResultContent } from '../../core/llm/llm-log-types.js';
|
|
2
|
+
import { SessionEnvironment } from '../../core/sessions/session-environment';
|
|
3
|
+
import type { Logger } from '../../lib/logger/logger.js';
|
|
4
|
+
import { Result } from '../../lib/utils/result.js';
|
|
5
|
+
import { ToolContext } from './context.js';
|
|
6
|
+
import { ToolDefinition } from './definition.js';
|
|
7
|
+
export type { SessionEnvironment };
|
|
8
|
+
/**
|
|
9
|
+
* Tool execution error
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolError {
|
|
12
|
+
message: string;
|
|
13
|
+
recoverable: boolean;
|
|
14
|
+
details?: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* ToolExecutor - executes tools with logging and error handling
|
|
18
|
+
*/
|
|
19
|
+
export declare class ToolExecutor {
|
|
20
|
+
private readonly logger;
|
|
21
|
+
constructor(logger: Logger);
|
|
22
|
+
/**
|
|
23
|
+
* Execute a tool with given input.
|
|
24
|
+
* Validates input against the tool's schema before execution.
|
|
25
|
+
*/
|
|
26
|
+
execute(tool: ToolDefinition<any>, input: unknown, context: ToolContext): Promise<Result<ToolResultContent, ToolError>>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/core/tools/executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAW,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,YAAY,EAAE,kBAAkB,EAAE,CAAA;AAMlC;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB;AAMD;;GAEG;AACH,qBAAa,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;OAGG;IACG,OAAO,CACZ,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,EACzB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;CA2EhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../../src/core/tools/executor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool domain types and schemas
|
|
3
|
+
*
|
|
4
|
+
* Contains all types related to tools:
|
|
5
|
+
* - Branded ID type and constructor
|
|
6
|
+
* - Tool definition types
|
|
7
|
+
* - Zod schemas for validation
|
|
8
|
+
*/
|
|
9
|
+
import z from 'zod/v4';
|
|
10
|
+
import type { ToolResultContent } from '../../core/llm/llm-log-types.js';
|
|
11
|
+
import { ToolContext } from './context';
|
|
12
|
+
/** ToolCallId schema - validates any string and brands as ToolCallId. */
|
|
13
|
+
export declare const toolCallIdSchema: z.core.$ZodBranded<z.ZodString, "ToolCallId", "out">;
|
|
14
|
+
/** Branded ToolCallId type */
|
|
15
|
+
export type ToolCallId = z.infer<typeof toolCallIdSchema>;
|
|
16
|
+
/** Constructor for ToolCallId */
|
|
17
|
+
export declare const ToolCallId: (id: string) => ToolCallId;
|
|
18
|
+
/** Generate a new ToolCallId (UUIDv7) */
|
|
19
|
+
export declare const generateToolCallId: () => ToolCallId;
|
|
20
|
+
/**
|
|
21
|
+
* Tool call in agent state.
|
|
22
|
+
*/
|
|
23
|
+
export interface ToolCall {
|
|
24
|
+
id: ToolCallId;
|
|
25
|
+
name: string;
|
|
26
|
+
input: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Tool result in agent state.
|
|
30
|
+
*/
|
|
31
|
+
export interface ToolResult {
|
|
32
|
+
toolCallId: ToolCallId;
|
|
33
|
+
result: unknown;
|
|
34
|
+
isError: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Pending tool result awaiting LLM processing.
|
|
38
|
+
* Stored after tool_completed/tool_failed, moved to conversationHistory by inference_completed.
|
|
39
|
+
*/
|
|
40
|
+
export interface PendingToolResult {
|
|
41
|
+
toolCallId: ToolCallId;
|
|
42
|
+
toolName: string;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
isError: boolean;
|
|
45
|
+
content: ToolResultContent;
|
|
46
|
+
}
|
|
47
|
+
export type ToolOkResponse = {
|
|
48
|
+
ok: true;
|
|
49
|
+
value: ToolResultContent;
|
|
50
|
+
};
|
|
51
|
+
export type ToolErrorResponse = {
|
|
52
|
+
ok: false;
|
|
53
|
+
error: {
|
|
54
|
+
message: string;
|
|
55
|
+
recoverable: boolean;
|
|
56
|
+
details?: unknown;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type ToolResponse = ToolOkResponse | ToolErrorResponse;
|
|
60
|
+
export type ToolExecutionCallback<TInput = unknown> = (input: TInput, context: ToolContext) => Promise<ToolResponse>;
|
|
61
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/core/tools/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAMvC,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,sDAAiC,CAAA;AAE9D,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,iCAAiC;AACjC,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,KAAG,UAA8B,CAAA;AAEtE,yCAAyC;AACzC,eAAO,MAAM,kBAAkB,QAAO,UAAkC,CAAA;AASxE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,UAAU,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,iBAAiB,CAAA;CAC1B;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,EAAE,EAAE,IAAI,CAAA;IACR,KAAK,EAAE,iBAAiB,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CACnE,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,iBAAiB,CAAA;AAE7D,MAAM,MAAM,qBAAqB,CAAC,MAAM,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import z4 from 'zod/v4';
|
|
2
|
+
import type { ToolResultContent } from '../../core/llm/llm-log-types.js';
|
|
3
|
+
export declare const toolEvents: import("../events/types").EventsFactory<{
|
|
4
|
+
tool_started: z4.ZodObject<{
|
|
5
|
+
agentId: z4.core.$ZodBranded<z4.ZodString, "AgentId", "out">;
|
|
6
|
+
toolCallId: z4.core.$ZodBranded<z4.ZodString, "ToolCallId", "out">;
|
|
7
|
+
toolName: z4.ZodString;
|
|
8
|
+
input: z4.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
9
|
+
}, z4.core.$strip>;
|
|
10
|
+
tool_completed: z4.ZodObject<{
|
|
11
|
+
agentId: z4.core.$ZodBranded<z4.ZodString, "AgentId", "out">;
|
|
12
|
+
toolCallId: z4.core.$ZodBranded<z4.ZodString, "ToolCallId", "out">;
|
|
13
|
+
result: z4.ZodCustom<ToolResultContent, ToolResultContent>;
|
|
14
|
+
workspaceRef: z4.ZodOptional<z4.ZodString>;
|
|
15
|
+
sessionRef: z4.ZodOptional<z4.ZodString>;
|
|
16
|
+
}, z4.core.$strip>;
|
|
17
|
+
tool_failed: z4.ZodObject<{
|
|
18
|
+
agentId: z4.core.$ZodBranded<z4.ZodString, "AgentId", "out">;
|
|
19
|
+
toolCallId: z4.core.$ZodBranded<z4.ZodString, "ToolCallId", "out">;
|
|
20
|
+
error: z4.ZodString;
|
|
21
|
+
workspaceRef: z4.ZodOptional<z4.ZodString>;
|
|
22
|
+
sessionRef: z4.ZodOptional<z4.ZodString>;
|
|
23
|
+
}, z4.core.$strip>;
|
|
24
|
+
}>;
|
|
25
|
+
export type ToolStartedEvent = (typeof toolEvents)['Events']['tool_started'];
|
|
26
|
+
export type ToolCompletedEvent = (typeof toolEvents)['Events']['tool_completed'];
|
|
27
|
+
export type ToolFailedEvent = (typeof toolEvents)['Events']['tool_failed'];
|
|
28
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/tools/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAIpE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EAuBrB,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAA;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAChF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAA"}
|