@aexol/spectral 0.8.2 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -55
- package/README.md +80 -82
- package/dist/agent/agents.d.ts +37 -0
- package/dist/agent/agents.d.ts.map +1 -0
- package/dist/agent/index.d.ts +29 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +11 -11
- package/dist/cli.d.ts +17 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/commands/bind.d.ts +12 -0
- package/dist/commands/bind.d.ts.map +1 -0
- package/dist/commands/login-oauth.d.ts +15 -0
- package/dist/commands/login-oauth.d.ts.map +1 -0
- package/dist/commands/login.d.ts +37 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/logout.d.ts +8 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/serve.d.ts +112 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +5 -2
- package/dist/commands/unbind.d.ts +8 -0
- package/dist/commands/unbind.d.ts.map +1 -0
- package/dist/config.d.ts +49 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -1
- package/dist/designer/guidelines.d.ts +23 -0
- package/dist/designer/guidelines.d.ts.map +1 -0
- package/dist/designer/index.d.ts +26 -0
- package/dist/designer/index.d.ts.map +1 -0
- package/dist/designer/index.js +9 -9
- package/dist/designer/philosophies.d.ts +33 -0
- package/dist/designer/philosophies.d.ts.map +1 -0
- package/dist/designer/skills.d.ts +27 -0
- package/dist/designer/skills.d.ts.map +1 -0
- package/dist/designer/systems.d.ts +36 -0
- package/dist/designer/systems.d.ts.map +1 -0
- package/dist/extensions/aexol-mcp.d.ts +25 -0
- package/dist/extensions/aexol-mcp.d.ts.map +1 -0
- package/dist/extensions/aexol-mcp.js +12 -12
- package/dist/extensions/kanban-bridge.d.ts +24 -0
- package/dist/extensions/kanban-bridge.d.ts.map +1 -0
- package/dist/extensions/kanban-bridge.js +3 -3
- package/dist/extensions/openrouter-attribution.d.ts +12 -0
- package/dist/extensions/openrouter-attribution.d.ts.map +1 -0
- package/dist/extensions/openrouter-attribution.js +2 -2
- package/dist/extensions/spectral-vision-fallback.d.ts +23 -0
- package/dist/extensions/spectral-vision-fallback.d.ts.map +1 -0
- package/dist/extensions/spectral-vision-fallback.js +32 -23
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/mcp/agent-dir.d.ts +3 -0
- package/dist/mcp/agent-dir.d.ts.map +1 -0
- package/dist/mcp/commands.d.ts +9 -0
- package/dist/mcp/commands.d.ts.map +1 -0
- package/dist/mcp/commands.js +1 -1
- package/dist/mcp/config.d.ts +78 -0
- package/dist/mcp/config.d.ts.map +1 -0
- package/dist/mcp/config.js +15 -15
- package/dist/mcp/consent-manager.d.ts +14 -0
- package/dist/mcp/consent-manager.d.ts.map +1 -0
- package/dist/mcp/direct-tools.d.ts +11 -0
- package/dist/mcp/direct-tools.d.ts.map +1 -0
- package/dist/mcp/errors.d.ts +100 -0
- package/dist/mcp/errors.d.ts.map +1 -0
- package/dist/mcp/glimpse-ui.d.ts +10 -0
- package/dist/mcp/glimpse-ui.d.ts.map +1 -0
- package/dist/mcp/host-html-template.d.ts +17 -0
- package/dist/mcp/host-html-template.d.ts.map +1 -0
- package/dist/mcp/host-html-template.js +3 -3
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +15 -13
- package/dist/mcp/init.d.ts +10 -0
- package/dist/mcp/init.d.ts.map +1 -0
- package/dist/mcp/init.js +4 -4
- package/dist/mcp/lifecycle.d.ts +30 -0
- package/dist/mcp/lifecycle.d.ts.map +1 -0
- package/dist/mcp/logger.d.ts +52 -0
- package/dist/mcp/logger.d.ts.map +1 -0
- package/dist/mcp/mcp-auth-flow.d.ts +69 -0
- package/dist/mcp/mcp-auth-flow.d.ts.map +1 -0
- package/dist/mcp/mcp-auth.d.ts +100 -0
- package/dist/mcp/mcp-auth.d.ts.map +1 -0
- package/dist/mcp/mcp-callback-server.d.ts +40 -0
- package/dist/mcp/mcp-callback-server.d.ts.map +1 -0
- package/dist/mcp/mcp-oauth-provider.d.ts +101 -0
- package/dist/mcp/mcp-oauth-provider.d.ts.map +1 -0
- package/dist/mcp/mcp-oauth-provider.js +1 -1
- package/dist/mcp/metadata-cache.d.ts +32 -0
- package/dist/mcp/metadata-cache.d.ts.map +1 -0
- package/dist/mcp/npx-resolver.d.ts +7 -0
- package/dist/mcp/npx-resolver.d.ts.map +1 -0
- package/dist/mcp/oauth-handler.d.ts +19 -0
- package/dist/mcp/oauth-handler.d.ts.map +1 -0
- package/dist/mcp/onboarding-state.d.ts +13 -0
- package/dist/mcp/onboarding-state.d.ts.map +1 -0
- package/dist/mcp/proxy-modes.d.ts +12 -0
- package/dist/mcp/proxy-modes.d.ts.map +1 -0
- package/dist/mcp/proxy-modes.js +2 -2
- package/dist/mcp/resource-tools.d.ts +2 -0
- package/dist/mcp/resource-tools.d.ts.map +1 -0
- package/dist/mcp/sampling-handler.d.ts +16 -0
- package/dist/mcp/sampling-handler.d.ts.map +1 -0
- package/dist/mcp/server-manager.d.ts +42 -0
- package/dist/mcp/server-manager.d.ts.map +1 -0
- package/dist/mcp/server-manager.js +2 -2
- package/dist/mcp/state-getter.d.ts +14 -0
- package/dist/mcp/state-getter.d.ts.map +1 -0
- package/dist/mcp/state-getter.js +21 -0
- package/dist/mcp/state.d.ts +41 -0
- package/dist/mcp/state.d.ts.map +1 -0
- package/dist/mcp/tool-metadata.d.ts +11 -0
- package/dist/mcp/tool-metadata.d.ts.map +1 -0
- package/dist/mcp/tool-registrar.d.ts +9 -0
- package/dist/mcp/tool-registrar.d.ts.map +1 -0
- package/dist/mcp/tool-registrar.js +1 -1
- package/dist/mcp/types.d.ts +263 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/ui-resource-handler.d.ts +10 -0
- package/dist/mcp/ui-resource-handler.d.ts.map +1 -0
- package/dist/mcp/ui-server.d.ts +37 -0
- package/dist/mcp/ui-server.d.ts.map +1 -0
- package/dist/mcp/ui-server.js +1 -1
- package/dist/mcp/ui-session.d.ts +27 -0
- package/dist/mcp/ui-session.d.ts.map +1 -0
- package/dist/mcp/ui-stream-types.d.ts +197 -0
- package/dist/mcp/ui-stream-types.d.ts.map +1 -0
- package/dist/mcp/ui-stream-types.js +5 -5
- package/dist/mcp/utils.d.ts +17 -0
- package/dist/mcp/utils.d.ts.map +1 -0
- package/dist/mcp/utils.js +10 -10
- package/dist/mcp/vitest.config.d.ts +3 -0
- package/dist/mcp/vitest.config.d.ts.map +1 -0
- package/dist/mcp-client.d.ts +58 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +3 -2
- package/dist/memory/branch.d.ts +124 -0
- package/dist/memory/branch.d.ts.map +1 -0
- package/dist/memory/commands/status.d.ts +4 -0
- package/dist/memory/commands/status.d.ts.map +1 -0
- package/dist/memory/commands/status.js +2 -2
- package/dist/memory/commands/view.d.ts +4 -0
- package/dist/memory/commands/view.d.ts.map +1 -0
- package/dist/memory/commands/view.js +2 -2
- package/dist/memory/compaction.d.ts +113 -0
- package/dist/memory/compaction.d.ts.map +1 -0
- package/dist/memory/config.d.ts +27 -0
- package/dist/memory/config.d.ts.map +1 -0
- package/dist/memory/debug-log.d.ts +12 -0
- package/dist/memory/debug-log.d.ts.map +1 -0
- package/dist/memory/hooks/compaction-hook.d.ts +4 -0
- package/dist/memory/hooks/compaction-hook.d.ts.map +1 -0
- package/dist/memory/hooks/compaction-hook.js +5 -5
- package/dist/memory/hooks/compaction-trigger.d.ts +4 -0
- package/dist/memory/hooks/compaction-trigger.d.ts.map +1 -0
- package/dist/memory/hooks/compaction-trigger.js +3 -3
- package/dist/memory/hooks/observer-trigger.d.ts +4 -0
- package/dist/memory/hooks/observer-trigger.d.ts.map +1 -0
- package/dist/memory/hooks/observer-trigger.js +4 -4
- package/dist/memory/ids.d.ts +2 -0
- package/dist/memory/ids.d.ts.map +1 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +9 -9
- package/dist/memory/model-budget.d.ts +4 -0
- package/dist/memory/model-budget.d.ts.map +1 -0
- package/dist/memory/observer.d.ts +21 -0
- package/dist/memory/observer.d.ts.map +1 -0
- package/dist/memory/project-observations-store.d.ts +24 -0
- package/dist/memory/project-observations-store.d.ts.map +1 -0
- package/dist/memory/prompts.d.ts +11 -0
- package/dist/memory/prompts.d.ts.map +1 -0
- package/dist/memory/relevance.d.ts +4 -0
- package/dist/memory/relevance.d.ts.map +1 -0
- package/dist/memory/runtime.d.ts +40 -0
- package/dist/memory/runtime.d.ts.map +1 -0
- package/dist/memory/serialize.d.ts +26 -0
- package/dist/memory/serialize.d.ts.map +1 -0
- package/dist/memory/tokens.d.ts +8 -0
- package/dist/memory/tokens.d.ts.map +1 -0
- package/dist/memory/tools/read-project-observations.d.ts +8 -0
- package/dist/memory/tools/read-project-observations.d.ts.map +1 -0
- package/dist/memory/tools/read-project-observations.js +2 -2
- package/dist/memory/tools/recall-observation.d.ts +63 -0
- package/dist/memory/tools/recall-observation.d.ts.map +1 -0
- package/dist/memory/tools/recall-observation.js +2 -2
- package/dist/memory/tools/write-project-observation.d.ts +9 -0
- package/dist/memory/tools/write-project-observation.d.ts.map +1 -0
- package/dist/memory/tools/write-project-observation.js +2 -2
- package/dist/memory/types.d.ts +65 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/preflight.d.ts +27 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +4 -2
- package/dist/relay/auto-research.d.ts +64 -0
- package/dist/relay/auto-research.d.ts.map +1 -0
- package/dist/relay/auto-research.js +184 -79
- package/dist/relay/client.d.ts +126 -0
- package/dist/relay/client.d.ts.map +1 -0
- package/dist/relay/dispatcher.d.ts +216 -0
- package/dist/relay/dispatcher.d.ts.map +1 -0
- package/dist/relay/dispatcher.js +33 -6
- package/dist/relay/machine-store.d.ts +68 -0
- package/dist/relay/machine-store.d.ts.map +1 -0
- package/dist/relay/models-fetch.d.ts +75 -0
- package/dist/relay/models-fetch.d.ts.map +1 -0
- package/dist/relay/registration.d.ts +81 -0
- package/dist/relay/registration.d.ts.map +1 -0
- package/dist/sdk/agent-core/agent-loop.d.ts +24 -0
- package/dist/sdk/agent-core/agent-loop.d.ts.map +1 -0
- package/dist/sdk/agent-core/agent.d.ts +125 -0
- package/dist/sdk/agent-core/agent.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/agent-harness.d.ts +92 -0
- package/dist/sdk/agent-core/harness/agent-harness.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/compaction/branch-summarization.d.ts +53 -0
- package/dist/sdk/agent-core/harness/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/compaction/compaction.d.ts +95 -0
- package/dist/sdk/agent-core/harness/compaction/compaction.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/compaction/utils.d.ts +25 -0
- package/dist/sdk/agent-core/harness/compaction/utils.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/env/nodejs.d.ts +51 -0
- package/dist/sdk/agent-core/harness/env/nodejs.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/messages.d.ts +51 -0
- package/dist/sdk/agent-core/harness/messages.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/prompt-templates.d.ts +48 -0
- package/dist/sdk/agent-core/harness/prompt-templates.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts +26 -0
- package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts +33 -0
- package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/memory-repo.d.ts +18 -0
- package/dist/sdk/agent-core/harness/session/memory-repo.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/memory-storage.d.ts +25 -0
- package/dist/sdk/agent-core/harness/session/memory-storage.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/repo-utils.d.ts +11 -0
- package/dist/sdk/agent-core/harness/session/repo-utils.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/session.d.ts +32 -0
- package/dist/sdk/agent-core/harness/session/session.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/session/uuid.d.ts +2 -0
- package/dist/sdk/agent-core/harness/session/uuid.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/skills.d.ts +44 -0
- package/dist/sdk/agent-core/harness/skills.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/system-prompt.d.ts +3 -0
- package/dist/sdk/agent-core/harness/system-prompt.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/types.d.ts +601 -0
- package/dist/sdk/agent-core/harness/types.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/utils/shell-output.d.ts +14 -0
- package/dist/sdk/agent-core/harness/utils/shell-output.d.ts.map +1 -0
- package/dist/sdk/agent-core/harness/utils/truncate.d.ts +70 -0
- package/dist/sdk/agent-core/harness/utils/truncate.d.ts.map +1 -0
- package/dist/sdk/agent-core/index.d.ts +20 -0
- package/dist/sdk/agent-core/index.d.ts.map +1 -0
- package/dist/sdk/agent-core/node.d.ts +3 -0
- package/dist/sdk/agent-core/node.d.ts.map +1 -0
- package/dist/sdk/agent-core/proxy.d.ts +69 -0
- package/dist/sdk/agent-core/proxy.d.ts.map +1 -0
- package/dist/sdk/agent-core/types.d.ts +393 -0
- package/dist/sdk/agent-core/types.d.ts.map +1 -0
- package/dist/sdk/ai/api-registry.d.ts +20 -0
- package/dist/sdk/ai/api-registry.d.ts.map +1 -0
- package/dist/sdk/ai/cli.d.ts +3 -0
- package/dist/sdk/ai/cli.d.ts.map +1 -0
- package/dist/sdk/ai/env-api-keys.d.ts +18 -0
- package/dist/sdk/ai/env-api-keys.d.ts.map +1 -0
- package/dist/sdk/ai/image-models.d.ts +10 -0
- package/dist/sdk/ai/image-models.d.ts.map +1 -0
- package/dist/sdk/ai/image-models.generated.d.ts +440 -0
- package/dist/sdk/ai/image-models.generated.d.ts.map +1 -0
- package/dist/sdk/ai/images-api-registry.d.ts +14 -0
- package/dist/sdk/ai/images-api-registry.d.ts.map +1 -0
- package/dist/sdk/ai/images.d.ts +4 -0
- package/dist/sdk/ai/images.d.ts.map +1 -0
- package/dist/sdk/ai/index.d.ts +21 -0
- package/dist/sdk/ai/index.d.ts.map +1 -0
- package/dist/sdk/ai/models.d.ts +18 -0
- package/dist/sdk/ai/models.d.ts.map +1 -0
- package/dist/sdk/ai/models.generated.d.ts +17349 -0
- package/dist/sdk/ai/models.generated.d.ts.map +1 -0
- package/dist/sdk/ai/oauth.d.ts +2 -0
- package/dist/sdk/ai/oauth.d.ts.map +1 -0
- package/dist/sdk/ai/providers/anthropic.d.ts +54 -0
- package/dist/sdk/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/sdk/ai/providers/faux.d.ts +56 -0
- package/dist/sdk/ai/providers/faux.d.ts.map +1 -0
- package/dist/sdk/ai/providers/github-copilot-headers.d.ts +8 -0
- package/dist/sdk/ai/providers/github-copilot-headers.d.ts.map +1 -0
- package/dist/sdk/ai/providers/openai-completions.d.ts +19 -0
- package/dist/sdk/ai/providers/openai-completions.d.ts.map +1 -0
- package/dist/sdk/ai/providers/openai-prompt-cache.d.ts +3 -0
- package/dist/sdk/ai/providers/openai-prompt-cache.d.ts.map +1 -0
- package/dist/sdk/ai/providers/register-builtins.d.ts +15 -0
- package/dist/sdk/ai/providers/register-builtins.d.ts.map +1 -0
- package/dist/sdk/ai/providers/simple-options.d.ts +8 -0
- package/dist/sdk/ai/providers/simple-options.d.ts.map +1 -0
- package/dist/sdk/ai/providers/transform-messages.d.ts +8 -0
- package/dist/sdk/ai/providers/transform-messages.d.ts.map +1 -0
- package/dist/sdk/ai/session-resources.d.ts +4 -0
- package/dist/sdk/ai/session-resources.d.ts.map +1 -0
- package/dist/sdk/ai/stream.d.ts +8 -0
- package/dist/sdk/ai/stream.d.ts.map +1 -0
- package/dist/sdk/ai/types.d.ts +488 -0
- package/dist/sdk/ai/types.d.ts.map +1 -0
- package/dist/sdk/ai/utils/diagnostics.d.ts +19 -0
- package/dist/sdk/ai/utils/diagnostics.d.ts.map +1 -0
- package/dist/sdk/ai/utils/event-stream.d.ts +21 -0
- package/dist/sdk/ai/utils/event-stream.d.ts.map +1 -0
- package/dist/sdk/ai/utils/hash.d.ts +3 -0
- package/dist/sdk/ai/utils/hash.d.ts.map +1 -0
- package/dist/sdk/ai/utils/headers.d.ts +2 -0
- package/dist/sdk/ai/utils/headers.d.ts.map +1 -0
- package/dist/sdk/ai/utils/json-parse.d.ts +16 -0
- package/dist/sdk/ai/utils/json-parse.d.ts.map +1 -0
- package/dist/sdk/ai/utils/node-http-proxy.d.ts +10 -0
- package/dist/sdk/ai/utils/node-http-proxy.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/anthropic.d.ts +25 -0
- package/dist/sdk/ai/utils/oauth/anthropic.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/device-code.d.ts +19 -0
- package/dist/sdk/ai/utils/oauth/device-code.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/github-copilot.d.ts +30 -0
- package/dist/sdk/ai/utils/oauth/github-copilot.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/index.d.ts +58 -0
- package/dist/sdk/ai/utils/oauth/index.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/oauth-page.d.ts +3 -0
- package/dist/sdk/ai/utils/oauth/oauth-page.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/openai-codex.d.ts +34 -0
- package/dist/sdk/ai/utils/oauth/openai-codex.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/openai-codex.js +2 -2
- package/dist/sdk/ai/utils/oauth/pkce.d.ts +13 -0
- package/dist/sdk/ai/utils/oauth/pkce.d.ts.map +1 -0
- package/dist/sdk/ai/utils/oauth/types.d.ts +64 -0
- package/dist/sdk/ai/utils/oauth/types.d.ts.map +1 -0
- package/dist/sdk/ai/utils/overflow.d.ts +56 -0
- package/dist/sdk/ai/utils/overflow.d.ts.map +1 -0
- package/dist/sdk/ai/utils/sanitize-unicode.d.ts +22 -0
- package/dist/sdk/ai/utils/sanitize-unicode.d.ts.map +1 -0
- package/dist/sdk/ai/utils/typebox-helpers.d.ts +17 -0
- package/dist/sdk/ai/utils/typebox-helpers.d.ts.map +1 -0
- package/dist/sdk/ai/utils/validation.d.ts +18 -0
- package/dist/sdk/ai/utils/validation.d.ts.map +1 -0
- package/dist/sdk/coding-agent/cli.d.ts +3 -0
- package/dist/sdk/coding-agent/cli.d.ts.map +1 -0
- package/dist/sdk/coding-agent/config.d.ts +71 -0
- package/dist/sdk/coding-agent/config.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/agent-session-runtime.d.ts +117 -0
- package/dist/sdk/coding-agent/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/agent-session-services.d.ts +86 -0
- package/dist/sdk/coding-agent/core/agent-session-services.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/agent-session.d.ts +626 -0
- package/dist/sdk/coding-agent/core/agent-session.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/agent-session.js +3 -3
- package/dist/sdk/coding-agent/core/auth-guidance.d.ts +5 -0
- package/dist/sdk/coding-agent/core/auth-guidance.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/auth-storage.d.ts +145 -0
- package/dist/sdk/coding-agent/core/auth-storage.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/auth-storage.js +2 -2
- package/dist/sdk/coding-agent/core/bash-executor.d.ts +32 -0
- package/dist/sdk/coding-agent/core/bash-executor.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/bash-executor.js +1 -1
- package/dist/sdk/coding-agent/core/compaction/branch-summarization.d.ts +88 -0
- package/dist/sdk/coding-agent/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/compaction/branch-summarization.js +1 -1
- package/dist/sdk/coding-agent/core/compaction/compaction.d.ts +142 -0
- package/dist/sdk/coding-agent/core/compaction/compaction.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/compaction/compaction.js +1 -1
- package/dist/sdk/coding-agent/core/compaction/index.d.ts +7 -0
- package/dist/sdk/coding-agent/core/compaction/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/compaction/utils.d.ts +38 -0
- package/dist/sdk/coding-agent/core/compaction/utils.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/defaults.d.ts +3 -0
- package/dist/sdk/coding-agent/core/defaults.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/diagnostics.d.ts +15 -0
- package/dist/sdk/coding-agent/core/diagnostics.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/event-bus.d.ts +9 -0
- package/dist/sdk/coding-agent/core/event-bus.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/exec.d.ts +29 -0
- package/dist/sdk/coding-agent/core/exec.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/extensions/index.d.ts +12 -0
- package/dist/sdk/coding-agent/core/extensions/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/extensions/loader.d.ts +24 -0
- package/dist/sdk/coding-agent/core/extensions/loader.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/extensions/loader.js +18 -21
- package/dist/sdk/coding-agent/core/extensions/runner.d.ts +161 -0
- package/dist/sdk/coding-agent/core/extensions/runner.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/extensions/runner.js +1 -1
- package/dist/sdk/coding-agent/core/extensions/types.d.ts +1181 -0
- package/dist/sdk/coding-agent/core/extensions/types.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/extensions/wrapper.d.ts +20 -0
- package/dist/sdk/coding-agent/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/http-dispatcher.d.ts +21 -0
- package/dist/sdk/coding-agent/core/http-dispatcher.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/index.d.ts +12 -0
- package/dist/sdk/coding-agent/core/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/keybindings.d.ts +371 -0
- package/dist/sdk/coding-agent/core/keybindings.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/messages.d.ts +77 -0
- package/dist/sdk/coding-agent/core/messages.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/model-registry.d.ts +150 -0
- package/dist/sdk/coding-agent/core/model-registry.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/model-resolver-utils.d.ts +7 -0
- package/dist/sdk/coding-agent/core/model-resolver-utils.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/model-resolver.d.ts +110 -0
- package/dist/sdk/coding-agent/core/model-resolver.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/output-guard.d.ts +6 -0
- package/dist/sdk/coding-agent/core/output-guard.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/package-manager.d.ts +204 -0
- package/dist/sdk/coding-agent/core/package-manager.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/package-manager.js +14 -14
- package/dist/sdk/coding-agent/core/prompt-templates.d.ts +52 -0
- package/dist/sdk/coding-agent/core/prompt-templates.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/provider-display-names.d.ts +2 -0
- package/dist/sdk/coding-agent/core/provider-display-names.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/resolve-config-value.d.ts +23 -0
- package/dist/sdk/coding-agent/core/resolve-config-value.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/resource-loader.d.ts +194 -0
- package/dist/sdk/coding-agent/core/resource-loader.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/sdk.d.ts +107 -0
- package/dist/sdk/coding-agent/core/sdk.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/sdk.js +2 -2
- package/dist/sdk/coding-agent/core/session-cwd.d.ts +19 -0
- package/dist/sdk/coding-agent/core/session-cwd.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/session-manager.d.ts +333 -0
- package/dist/sdk/coding-agent/core/session-manager.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/settings-manager.d.ts +209 -0
- package/dist/sdk/coding-agent/core/settings-manager.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/skills.d.ts +60 -0
- package/dist/sdk/coding-agent/core/skills.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/slash-commands.d.ts +14 -0
- package/dist/sdk/coding-agent/core/slash-commands.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/source-info.d.ts +18 -0
- package/dist/sdk/coding-agent/core/source-info.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/system-prompt.d.ts +28 -0
- package/dist/sdk/coding-agent/core/system-prompt.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/system-prompt.js +7 -7
- package/dist/sdk/coding-agent/core/telemetry.d.ts +3 -0
- package/dist/sdk/coding-agent/core/telemetry.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/theme.d.ts +28 -0
- package/dist/sdk/coding-agent/core/theme.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/timings.d.ts +8 -0
- package/dist/sdk/coding-agent/core/timings.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/bash.d.ts +63 -0
- package/dist/sdk/coding-agent/core/tools/bash.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/bash.js +3 -3
- package/dist/sdk/coding-agent/core/tools/edit-diff.d.ts +87 -0
- package/dist/sdk/coding-agent/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/edit.d.ts +39 -0
- package/dist/sdk/coding-agent/core/tools/edit.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/sdk/coding-agent/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/find.d.ts +35 -0
- package/dist/sdk/coding-agent/core/tools/find.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/grep.d.ts +37 -0
- package/dist/sdk/coding-agent/core/tools/grep.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/index.d.ts +40 -0
- package/dist/sdk/coding-agent/core/tools/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/ls.d.ts +37 -0
- package/dist/sdk/coding-agent/core/tools/ls.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/output-accumulator.d.ts +52 -0
- package/dist/sdk/coding-agent/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/output-accumulator.js +1 -1
- package/dist/sdk/coding-agent/core/tools/path-utils.d.ts +8 -0
- package/dist/sdk/coding-agent/core/tools/path-utils.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/read.d.ts +35 -0
- package/dist/sdk/coding-agent/core/tools/read.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/read.js +18 -10
- package/dist/sdk/coding-agent/core/tools/render-diff.d.ts +17 -0
- package/dist/sdk/coding-agent/core/tools/render-diff.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/render-utils.d.ts +21 -0
- package/dist/sdk/coding-agent/core/tools/render-utils.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/truncate.d.ts +70 -0
- package/dist/sdk/coding-agent/core/tools/truncate.d.ts.map +1 -0
- package/dist/sdk/coding-agent/core/tools/write.d.ts +26 -0
- package/dist/sdk/coding-agent/core/tools/write.d.ts.map +1 -0
- package/dist/sdk/coding-agent/index.d.ts +29 -0
- package/dist/sdk/coding-agent/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/main.d.ts +2 -0
- package/dist/sdk/coding-agent/main.d.ts.map +1 -0
- package/dist/sdk/coding-agent/migrations.d.ts +33 -0
- package/dist/sdk/coding-agent/migrations.d.ts.map +1 -0
- package/dist/sdk/coding-agent/migrations.js +4 -4
- package/dist/sdk/coding-agent/modes/index.d.ts +8 -0
- package/dist/sdk/coding-agent/modes/index.d.ts.map +1 -0
- package/dist/sdk/coding-agent/modes/print-mode.d.ts +28 -0
- package/dist/sdk/coding-agent/modes/print-mode.d.ts.map +1 -0
- package/dist/sdk/coding-agent/modes/print-mode.js +2 -2
- package/dist/sdk/coding-agent/modes/rpc/jsonl.d.ts +17 -0
- package/dist/sdk/coding-agent/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-client.d.ts +224 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-types.d.ts +419 -0
- package/dist/sdk/coding-agent/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/ansi.d.ts +2 -0
- package/dist/sdk/coding-agent/utils/ansi.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/changelog.d.ts +21 -0
- package/dist/sdk/coding-agent/utils/changelog.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/child-process.d.ts +15 -0
- package/dist/sdk/coding-agent/utils/child-process.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/clipboard-image.d.ts +11 -0
- package/dist/sdk/coding-agent/utils/clipboard-image.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/clipboard-image.js +1 -1
- package/dist/sdk/coding-agent/utils/clipboard-native.d.ts +8 -0
- package/dist/sdk/coding-agent/utils/clipboard-native.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/clipboard.d.ts +2 -0
- package/dist/sdk/coding-agent/utils/clipboard.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/exif-orientation.d.ts +5 -0
- package/dist/sdk/coding-agent/utils/exif-orientation.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/frontmatter.d.ts +8 -0
- package/dist/sdk/coding-agent/utils/frontmatter.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/fs-watch.d.ts +5 -0
- package/dist/sdk/coding-agent/utils/fs-watch.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/git.d.ts +26 -0
- package/dist/sdk/coding-agent/utils/git.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/html.d.ts +7 -0
- package/dist/sdk/coding-agent/utils/html.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/image-convert.d.ts +9 -0
- package/dist/sdk/coding-agent/utils/image-convert.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/image-resize.d.ts +36 -0
- package/dist/sdk/coding-agent/utils/image-resize.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/mime.d.ts +3 -0
- package/dist/sdk/coding-agent/utils/mime.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/paths.d.ts +31 -0
- package/dist/sdk/coding-agent/utils/paths.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/photon.d.ts +13 -0
- package/dist/sdk/coding-agent/utils/photon.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/shell.d.ts +30 -0
- package/dist/sdk/coding-agent/utils/shell.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/sleep.d.ts +5 -0
- package/dist/sdk/coding-agent/utils/sleep.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/spectral-user-agent.d.ts +2 -0
- package/dist/sdk/coding-agent/utils/spectral-user-agent.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/spectral-user-agent.js +3 -0
- package/dist/sdk/coding-agent/utils/syntax-highlight.d.ts +12 -0
- package/dist/sdk/coding-agent/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/tools-manager.d.ts +3 -0
- package/dist/sdk/coding-agent/utils/tools-manager.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/version-check.d.ts +15 -0
- package/dist/sdk/coding-agent/utils/version-check.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/version-check.js +7 -7
- package/dist/sdk/coding-agent/utils/windows-self-update.d.ts +3 -0
- package/dist/sdk/coding-agent/utils/windows-self-update.d.ts.map +1 -0
- package/dist/sdk/coding-agent/utils/windows-self-update.js +1 -1
- package/dist/server/agent-bridge.d.ts +308 -0
- package/dist/server/agent-bridge.d.ts.map +1 -0
- package/dist/server/agent-bridge.js +58 -58
- package/dist/server/handlers/errors.d.ts +26 -0
- package/dist/server/handlers/errors.d.ts.map +1 -0
- package/dist/server/handlers/mcp-status.d.ts +21 -0
- package/dist/server/handlers/mcp-status.d.ts.map +1 -0
- package/dist/server/handlers/mcp-status.js +52 -0
- package/dist/server/handlers/paths-autocomplete.d.ts +45 -0
- package/dist/server/handlers/paths-autocomplete.d.ts.map +1 -0
- package/dist/server/handlers/projects.d.ts +58 -0
- package/dist/server/handlers/projects.d.ts.map +1 -0
- package/dist/server/handlers/queue.d.ts +27 -0
- package/dist/server/handlers/queue.d.ts.map +1 -0
- package/dist/server/handlers/sessions.d.ts +50 -0
- package/dist/server/handlers/sessions.d.ts.map +1 -0
- package/dist/server/handlers/sessions.js +1 -1
- package/dist/server/handlers/settings.d.ts +30 -0
- package/dist/server/handlers/settings.d.ts.map +1 -0
- package/dist/server/handlers/settings.js +123 -0
- package/dist/server/paths.d.ts +51 -0
- package/dist/server/paths.d.ts.map +1 -0
- package/dist/server/paths.js +2 -2
- package/dist/server/session-stream.d.ts +379 -0
- package/dist/server/session-stream.d.ts.map +1 -0
- package/dist/server/session-stream.js +43 -34
- package/dist/server/shutdown.d.ts +102 -0
- package/dist/server/shutdown.d.ts.map +1 -0
- package/dist/server/shutdown.js +3 -3
- package/dist/server/storage.d.ts +287 -0
- package/dist/server/storage.d.ts.map +1 -0
- package/dist/server/storage.js +6 -6
- package/dist/server/title-generator.d.ts +25 -0
- package/dist/server/title-generator.d.ts.map +1 -0
- package/dist/server/wire.d.ts +448 -0
- package/dist/server/wire.d.ts.map +1 -0
- package/dist/server/wire.js +1 -1
- package/dist/studio-binding.d.ts +44 -0
- package/dist/studio-binding.d.ts.map +1 -0
- package/dist/studio-binding.js +1 -1
- package/package.json +11 -1
- package/dist/sdk/coding-agent/utils/pi-user-agent.js +0 -3
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-connection spectral SDK lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* One `AgentBridge` instance per active WebSocket connection. Wraps:
|
|
5
|
+
* - `createAgentSession` (in-memory session manager — we own persistence in
|
|
6
|
+
* SQLite; spectral doesn't need to write its own JSONL files).
|
|
7
|
+
* - `subscribe` listener that translates spectral `AgentSessionEvent`s into our
|
|
8
|
+
* own `ServerEvent` wire format and pushes them through a caller-supplied
|
|
9
|
+
* sink.
|
|
10
|
+
* - `prompt(text)` to send user input.
|
|
11
|
+
* - `dispose()` for clean teardown on WS close.
|
|
12
|
+
*
|
|
13
|
+
* Event mapping (agent → wire):
|
|
14
|
+
* - `message_start` (assistant) → emit our own `message_start` with a
|
|
15
|
+
* fresh UUID `messageId`. spectral's AssistantMessage has no stable id field, so
|
|
16
|
+
* we mint one per turn and use it for all subsequent deltas/tool events
|
|
17
|
+
* until `message_end`.
|
|
18
|
+
* - `message_update` w/ inner text_delta / thinking_delta → wire `text_delta`
|
|
19
|
+
* or `thinking_delta` carrying the `delta` and our `messageId`.
|
|
20
|
+
* - `tool_execution_start` → wire `tool_call`.
|
|
21
|
+
* - `tool_execution_end` → wire `tool_result`.
|
|
22
|
+
* - `message_end` (assistant) → wire `message_end` and persist the
|
|
23
|
+
* final assembled text + JSONL of every WIRE event we emitted for this
|
|
24
|
+
* message into SQLite. Content is taken from the final
|
|
25
|
+
* `AssistantMessage.content` (concatenating `text` blocks); we fall back
|
|
26
|
+
* to the `text_delta` accumulator when the provider didn't populate
|
|
27
|
+
* final blocks (e.g. deepseek via openai-compatible).
|
|
28
|
+
* - `agent_end` → wire `agent_end`.
|
|
29
|
+
*
|
|
30
|
+
* Persistence shape:
|
|
31
|
+
* `events_jsonl` is the newline-delimited JSON of the wire-format
|
|
32
|
+
* `ServerEvent`s we emitted for this message — NOT raw spectral
|
|
33
|
+
* `AgentSessionEvent`s. This guarantees the client's `parseWireEvents`
|
|
34
|
+
* reducer can rehydrate the turn after a refresh using the exact same
|
|
35
|
+
* reducer it uses for the live broadcast.
|
|
36
|
+
*
|
|
37
|
+
* Errors thrown synchronously from `session.prompt()` (e.g. no model
|
|
38
|
+
* configured) are caught by the caller in `routes.ts` and re-emitted as
|
|
39
|
+
* `{type:"error"}`.
|
|
40
|
+
*
|
|
41
|
+
* History rehydration:
|
|
42
|
+
* On first attach to a previously-created session (e.g. after a server
|
|
43
|
+
* restart), the SessionStreamManager passes the full SQLite transcript
|
|
44
|
+
* to the AgentBridge via `AgentBridgeOptions.history`. Before
|
|
45
|
+
* `createAgentSession` is called, each message is appended to the
|
|
46
|
+
* in-memory SessionManager so the LLM sees the full conversation
|
|
47
|
+
* context from the very first prompt. Multi-turn conversations within
|
|
48
|
+
* a single spectral session also work normally (the same AgentSession
|
|
49
|
+
* instance is reused across `prompt()` calls).
|
|
50
|
+
*/
|
|
51
|
+
import { type AgentSessionEvent } from "../sdk/coding-agent/index.js";
|
|
52
|
+
import { fetchAllowedModels as defaultFetchAllowedModels } from "../relay/models-fetch.js";
|
|
53
|
+
import type { SessionMemorySnapshot } from "./storage.js";
|
|
54
|
+
import type { ImageAttachment, ServerEvent, WireMessage } from "./wire.js";
|
|
55
|
+
/** Optional override for fetchAllowedModels (tests inject a mock). */
|
|
56
|
+
export type FetchAllowedModelsFn = typeof defaultFetchAllowedModels;
|
|
57
|
+
export interface AgentBridgeOptions {
|
|
58
|
+
/** Working directory spectral will operate in (used by built-in tools). */
|
|
59
|
+
cwd: string;
|
|
60
|
+
/** spectral config / agent dir. Defaults to ~/.spectral/agent (spectral default). */
|
|
61
|
+
agentDir?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Backend base URL (no trailing slash). All inference is proxied through
|
|
64
|
+
* `${backendUrl}/v1` — spectral NEVER reads `~/.spectral/agent/auth.json` and NEVER
|
|
65
|
+
* holds raw provider API keys; the backend authenticates the machine via
|
|
66
|
+
* `machineJwt` and uses its own centralized provider credentials.
|
|
67
|
+
*/
|
|
68
|
+
backendUrl: string;
|
|
69
|
+
/**
|
|
70
|
+
* Bearer token used to authenticate with the backend's `/v1/*` endpoints
|
|
71
|
+
* AND with the GraphQL `availableBaseModels` query. Issued by
|
|
72
|
+
* `ensureMachineRegistered` and persisted in `machine.json`.
|
|
73
|
+
*/
|
|
74
|
+
machineJwt: string;
|
|
75
|
+
/** Sink for outbound wire events. Synchronous; the bridge does not buffer. */
|
|
76
|
+
emit: (event: ServerEvent) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Called when an assistant message completes, after `message_end` is
|
|
79
|
+
* emitted. The bridge passes the accumulated text content and the JSONL
|
|
80
|
+
* of every agent events captured for this message. Caller is expected to
|
|
81
|
+
* persist this to SQLite.
|
|
82
|
+
*/
|
|
83
|
+
onAssistantMessageComplete: (msg: {
|
|
84
|
+
messageId: string;
|
|
85
|
+
content: string;
|
|
86
|
+
eventsJsonl: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Called when the bridge decides to skip persisting an empty intermediate
|
|
90
|
+
* message. Caller should clean up any stub row inserted at message_start.
|
|
91
|
+
*/
|
|
92
|
+
onAssistantMessageSkipped?: (messageId: string) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Called when spectral or an extension throws asynchronously (e.g. from
|
|
95
|
+
* `prompt`). Caller can choose how to surface to the client. The bridge
|
|
96
|
+
* also emits `{type:"error"}` on the wire as a fallback.
|
|
97
|
+
*/
|
|
98
|
+
onError?: (err: Error) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Optional session history to rehydrate into spectral's in-memory session
|
|
101
|
+
* before the first prompt. Populated from SQLite by the session-stream
|
|
102
|
+
* manager when attaching to a previously-created session (so the LLM
|
|
103
|
+
* sees the full conversation transcript from the beginning). Omitted for
|
|
104
|
+
* brand-new sessions (no history) and for tests that don't need it.
|
|
105
|
+
*/
|
|
106
|
+
history?: WireMessage[];
|
|
107
|
+
/**
|
|
108
|
+
* Optional persisted observational-memory snapshot restored after message
|
|
109
|
+
* history rehydration so the next prompt still sees compacted memory after
|
|
110
|
+
* reconnect/server restart.
|
|
111
|
+
*/
|
|
112
|
+
memorySnapshot?: SessionMemorySnapshot | null;
|
|
113
|
+
/**
|
|
114
|
+
* Test seam — override the model whitelist fetch. Production code never
|
|
115
|
+
* sets this; tests inject a stub returning a synthetic list so `start()`
|
|
116
|
+
* can run without a live backend.
|
|
117
|
+
*/
|
|
118
|
+
fetchAllowedModels?: FetchAllowedModelsFn;
|
|
119
|
+
}
|
|
120
|
+
export declare class AgentBridge {
|
|
121
|
+
private session?;
|
|
122
|
+
private sessionManager?;
|
|
123
|
+
private unsubscribe?;
|
|
124
|
+
private pending?;
|
|
125
|
+
private disposed;
|
|
126
|
+
private readonly opts;
|
|
127
|
+
/**
|
|
128
|
+
* spectral's model registry. Built lazily in `start()` so we can resolve a
|
|
129
|
+
* `modelId` (envelope-supplied or SQLite-persisted) to a concrete `Model`
|
|
130
|
+
* via `registry.getAll().find(m => m.id === modelId)` before invoking
|
|
131
|
+
* `session.setModel()`. Phase 3 (Available Models whitelist).
|
|
132
|
+
*/
|
|
133
|
+
private modelRegistry?;
|
|
134
|
+
/**
|
|
135
|
+
* Raw allowed models list from the backend, preserved in sortOrder.
|
|
136
|
+
* Used by `getFirstAvailableModelId()` to return the backend-curated
|
|
137
|
+
* top pick when no explicit model selection is made.
|
|
138
|
+
*/
|
|
139
|
+
private allowedModels?;
|
|
140
|
+
/**
|
|
141
|
+
* Last `modelId` we successfully applied via `session.setModel()`, or
|
|
142
|
+
* `undefined` if we never applied one (spectral falls back to its own settings
|
|
143
|
+
* file in that case, matching pre-Phase-3 behaviour). Tracked so repeated
|
|
144
|
+
* envelopes carrying the same modelId don't churn spectral's internal state.
|
|
145
|
+
*/
|
|
146
|
+
private lastAppliedModelId?;
|
|
147
|
+
/** Current model's credit rates (from availableBaseModels), used for token_usage. */
|
|
148
|
+
private activeCreditRates;
|
|
149
|
+
private readonly memoryRuntime;
|
|
150
|
+
private memoryPhase;
|
|
151
|
+
constructor(opts: AgentBridgeOptions);
|
|
152
|
+
/**
|
|
153
|
+
* Create the spectral session, wire up subscription, and return.
|
|
154
|
+
* Throws on creation failure (caller should surface to client).
|
|
155
|
+
*/
|
|
156
|
+
start(): Promise<void>;
|
|
157
|
+
private proxyProviderForAllowedModel;
|
|
158
|
+
private refreshAllowedModels;
|
|
159
|
+
/**
|
|
160
|
+
* Register one synthetic provider per upstream API shape. Anthropic models
|
|
161
|
+
* go to `${backendUrl}/v1/messages` (Messages API); everything else (OpenAI,
|
|
162
|
+
* Google, Cerebras, etc.) goes to `${backendUrl}/v1/chat/completions`
|
|
163
|
+
* (OpenAI-compatible API). The backend supports both endpoints natively
|
|
164
|
+
* (verified in F1).
|
|
165
|
+
*
|
|
166
|
+
* spectral will send `Authorization: Bearer ${apiKey}` (because `authHeader: true`)
|
|
167
|
+
* which carries the machine JWT — the only credential the backend trusts.
|
|
168
|
+
*
|
|
169
|
+
* The `id` we register is the raw `modelId` (e.g. `claude-3-5-haiku-latest`),
|
|
170
|
+
* which is exactly what the backend expects in `body.model`.
|
|
171
|
+
*/
|
|
172
|
+
private registerSyntheticProviders;
|
|
173
|
+
/**
|
|
174
|
+
* Apply a sticky model selection to the underlying spectral session, if it
|
|
175
|
+
* differs from what was last applied. No-ops when:
|
|
176
|
+
* - `modelId` is null/undefined (caller passed nothing to apply)
|
|
177
|
+
* - the same modelId was already applied to this session
|
|
178
|
+
* - the registry can't resolve the modelId (emits an `error` wire event
|
|
179
|
+
* so the client surfaces the failure, but does NOT throw — the caller
|
|
180
|
+
* is expected to drop the prompt)
|
|
181
|
+
*
|
|
182
|
+
* Returns true when the requested model is now in effect (either because
|
|
183
|
+
* we just applied it or because it was already applied). Returns false
|
|
184
|
+
* on resolution failure so the caller can skip `prompt()` and avoid
|
|
185
|
+
* driving spectral against the wrong model.
|
|
186
|
+
*
|
|
187
|
+
* Phase 3 (Available Models whitelist).
|
|
188
|
+
*/
|
|
189
|
+
/**
|
|
190
|
+
* Return the modelId of the first available model from the backend
|
|
191
|
+
* whitelist (preserving the backend's sortOrder, which is the same
|
|
192
|
+
* ordering the frontend uses in its model picker). Returns `undefined`
|
|
193
|
+
* when no models are available (e.g. backend unreachable at startup).
|
|
194
|
+
*
|
|
195
|
+
* Used by `SessionStreamManager.prompt()` as a defense-in-depth
|
|
196
|
+
* default when neither the envelope nor SQLite supply a modelId.
|
|
197
|
+
*/
|
|
198
|
+
getFirstAvailableModelId(): string | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Return current session context usage from spectral's built-in estimator.
|
|
201
|
+
* Used after compaction and session start to push updated context-window
|
|
202
|
+
* stats to the frontend without waiting for the next assistant turn.
|
|
203
|
+
*/
|
|
204
|
+
getContextUsage(): {
|
|
205
|
+
tokens: number | null;
|
|
206
|
+
contextWindow: number;
|
|
207
|
+
percent: number | null;
|
|
208
|
+
} | undefined;
|
|
209
|
+
getSessionBranch(): Array<{
|
|
210
|
+
type: string;
|
|
211
|
+
id: string;
|
|
212
|
+
timestamp?: string;
|
|
213
|
+
message?: unknown;
|
|
214
|
+
content?: unknown;
|
|
215
|
+
customType?: string;
|
|
216
|
+
summary?: unknown;
|
|
217
|
+
fromId?: string;
|
|
218
|
+
data?: unknown;
|
|
219
|
+
details?: unknown;
|
|
220
|
+
firstKeptEntryId?: string;
|
|
221
|
+
}>;
|
|
222
|
+
getMemoryActivity(): {
|
|
223
|
+
phase: "idle" | "observing" | "compacting" | "reflecting" | "pruning";
|
|
224
|
+
inFlight: {
|
|
225
|
+
observer: boolean;
|
|
226
|
+
compaction: boolean;
|
|
227
|
+
reflection: boolean;
|
|
228
|
+
pruner: boolean;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
private updateMemoryPhase;
|
|
232
|
+
setModel(modelId: string | null | undefined): Promise<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* Map a frontend reasoning-effort string to spectral's ThinkingLevel.
|
|
235
|
+
* Frontend sends: xhigh | high | medium | low | minimal | none | undefined
|
|
236
|
+
* spectral expects: "high" | "medium" | "low" | "minimal" | "off"
|
|
237
|
+
*
|
|
238
|
+
* Mapping:
|
|
239
|
+
* xhigh → high (spectral doesn't have xhigh, default to max)
|
|
240
|
+
* high → high
|
|
241
|
+
* medium → medium
|
|
242
|
+
* low → low
|
|
243
|
+
* minimal → minimal
|
|
244
|
+
* none → off
|
|
245
|
+
* undefined → no-op (spectral keeps whatever it has currently)
|
|
246
|
+
*/
|
|
247
|
+
private mapReasoningEffortToThinkingLevel;
|
|
248
|
+
/**
|
|
249
|
+
* Set the reasoning/thinking effort level for the next prompt.
|
|
250
|
+
* Pass `undefined` to leave spectral's current level unchanged.
|
|
251
|
+
*
|
|
252
|
+
* The caller (SessionStreamManager) is responsible for persisting the
|
|
253
|
+
* value to SQLite; this method only applies it to spectral's in-memory session.
|
|
254
|
+
*/
|
|
255
|
+
setReasoningEffort(effort: string | undefined): void;
|
|
256
|
+
/**
|
|
257
|
+
* Forward a user message to ext. Resolves when the full turn ends.
|
|
258
|
+
* The caller is responsible for persisting the user message to SQLite
|
|
259
|
+
* BEFORE invoking this — we don't do it here because spectral's `prompt` may
|
|
260
|
+
* fail and we still want the user message recorded.
|
|
261
|
+
*
|
|
262
|
+
* When `images` is non-empty, each base64-encoded attachment is converted
|
|
263
|
+
* to a spectral `ImageContent` block and passed as `options.images` to
|
|
264
|
+
* `session.prompt()`. If the current model does not support image inputs,
|
|
265
|
+
* images are instead converted to text placeholders so the conversation
|
|
266
|
+
* can continue without errors.
|
|
267
|
+
*/
|
|
268
|
+
prompt(text: string, images?: ImageAttachment[]): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Manually compact the session context via spectral's built-in compaction.
|
|
271
|
+
* Pi generates a summary of older conversation history, preserving the
|
|
272
|
+
* most recent ~20K tokens verbatim. Compaction events are forwarded to
|
|
273
|
+
* the wire through `handleEvent()`.
|
|
274
|
+
*
|
|
275
|
+
* `customInstructions` can inject guidance into the compaction prompt
|
|
276
|
+
* so the summary captures information relevant to the current task.
|
|
277
|
+
*/
|
|
278
|
+
compact(customInstructions?: string): Promise<void>;
|
|
279
|
+
dispose(): void;
|
|
280
|
+
/**
|
|
281
|
+
* Emit a wire event AND record it in the pending message's audit log so
|
|
282
|
+
* the persisted JSONL exactly matches the live broadcast. Use this in
|
|
283
|
+
* place of `this.opts.emit` for any event that should appear in
|
|
284
|
+
* `events_jsonl` for the current assistant message.
|
|
285
|
+
*/
|
|
286
|
+
private emitAndBuffer;
|
|
287
|
+
/**
|
|
288
|
+
* Finalize the current `pending` assistant message: persist its assembled
|
|
289
|
+
* content + wire events (including any tool_call / tool_result events that
|
|
290
|
+
* arrived after `message_end`) to SQLite via `onAssistantMessageComplete`.
|
|
291
|
+
*
|
|
292
|
+
* Idempotent: marks the pending as `finalized` on first call; subsequent
|
|
293
|
+
* calls are no-ops (guards against double-persisting when both
|
|
294
|
+
* `message_start` and `agent_end` would otherwise finalize the same pending).
|
|
295
|
+
*
|
|
296
|
+
* Skips empty framing-only messages (messages with no text, thinking, or
|
|
297
|
+
* tool events that contribute nothing the client can render).
|
|
298
|
+
*/
|
|
299
|
+
private finalizePendingMessage;
|
|
300
|
+
/**
|
|
301
|
+
* Subscriber callback. Public so tests can drive event flow without
|
|
302
|
+
* spinning up a real spectral session — production code never calls this
|
|
303
|
+
* directly; spectral's `subscribe()` does, via the closure registered in
|
|
304
|
+
* `start()`.
|
|
305
|
+
*/
|
|
306
|
+
handleEvent(ev: AgentSessionEvent): void;
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=agent-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-bridge.d.ts","sourceRoot":"","sources":["../../src/server/agent-bridge.ts"],"names":[],"mappings":"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"}
|