@aislop-inc/opencode-mem 0.0.0-stage → 2.41.1
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/LICENSE +21 -0
- package/README.md +811 -2
- package/dist/config.d.ts +577 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1141 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1268 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +10 -0
- package/dist/services/ai/ai-provider-factory.d.ts +8 -0
- package/dist/services/ai/ai-provider-factory.d.ts.map +1 -0
- package/dist/services/ai/ai-provider-factory.js +61 -0
- package/dist/services/ai/api-key-placeholder.d.ts +2 -0
- package/dist/services/ai/api-key-placeholder.d.ts.map +1 -0
- package/dist/services/ai/api-key-placeholder.js +14 -0
- package/dist/services/ai/internal-capture-sessions.d.ts +7 -0
- package/dist/services/ai/internal-capture-sessions.d.ts.map +1 -0
- package/dist/services/ai/internal-capture-sessions.js +31 -0
- package/dist/services/ai/opencode-diagnostics.d.ts +8 -0
- package/dist/services/ai/opencode-diagnostics.d.ts.map +1 -0
- package/dist/services/ai/opencode-diagnostics.js +36 -0
- package/dist/services/ai/opencode-host-config.d.ts +11 -0
- package/dist/services/ai/opencode-host-config.d.ts.map +1 -0
- package/dist/services/ai/opencode-host-config.js +51 -0
- package/dist/services/ai/opencode-provider-loader.d.ts +4 -0
- package/dist/services/ai/opencode-provider-loader.d.ts.map +1 -0
- package/dist/services/ai/opencode-provider-loader.js +4 -0
- package/dist/services/ai/opencode-provider.d.ts +154 -0
- package/dist/services/ai/opencode-provider.d.ts.map +1 -0
- package/dist/services/ai/opencode-provider.js +731 -0
- package/dist/services/ai/opencode-sdk-client.d.ts +7 -0
- package/dist/services/ai/opencode-sdk-client.d.ts.map +1 -0
- package/dist/services/ai/opencode-sdk-client.js +38 -0
- package/dist/services/ai/profile-llm-client.d.ts +3 -0
- package/dist/services/ai/profile-llm-client.d.ts.map +1 -0
- package/dist/services/ai/profile-llm-client.js +29 -0
- package/dist/services/ai/provider-config.d.ts +19 -0
- package/dist/services/ai/provider-config.d.ts.map +1 -0
- package/dist/services/ai/provider-config.js +36 -0
- package/dist/services/ai/providers/anthropic-messages.d.ts +35 -0
- package/dist/services/ai/providers/anthropic-messages.d.ts.map +1 -0
- package/dist/services/ai/providers/anthropic-messages.js +220 -0
- package/dist/services/ai/providers/api-route.d.ts +49 -0
- package/dist/services/ai/providers/api-route.d.ts.map +1 -0
- package/dist/services/ai/providers/api-route.js +57 -0
- package/dist/services/ai/providers/atlas-cloud.d.ts +51 -0
- package/dist/services/ai/providers/atlas-cloud.d.ts.map +1 -0
- package/dist/services/ai/providers/atlas-cloud.js +59 -0
- package/dist/services/ai/providers/base-provider.d.ts +33 -0
- package/dist/services/ai/providers/base-provider.d.ts.map +1 -0
- package/dist/services/ai/providers/base-provider.js +24 -0
- package/dist/services/ai/providers/cheaper-inference.d.ts +50 -0
- package/dist/services/ai/providers/cheaper-inference.d.ts.map +1 -0
- package/dist/services/ai/providers/cheaper-inference.js +58 -0
- package/dist/services/ai/providers/cloudgpu.d.ts +52 -0
- package/dist/services/ai/providers/cloudgpu.d.ts.map +1 -0
- package/dist/services/ai/providers/cloudgpu.js +60 -0
- package/dist/services/ai/providers/google-gemini.d.ts +16 -0
- package/dist/services/ai/providers/google-gemini.d.ts.map +1 -0
- package/dist/services/ai/providers/google-gemini.js +228 -0
- package/dist/services/ai/providers/minimax.d.ts +38 -0
- package/dist/services/ai/providers/minimax.d.ts.map +1 -0
- package/dist/services/ai/providers/minimax.js +57 -0
- package/dist/services/ai/providers/openai-chat-completion.d.ts +30 -0
- package/dist/services/ai/providers/openai-chat-completion.d.ts.map +1 -0
- package/dist/services/ai/providers/openai-chat-completion.js +532 -0
- package/dist/services/ai/providers/openai-responses.d.ts +14 -0
- package/dist/services/ai/providers/openai-responses.d.ts.map +1 -0
- package/dist/services/ai/providers/openai-responses.js +182 -0
- package/dist/services/ai/providers/orcarouter.d.ts +52 -0
- package/dist/services/ai/providers/orcarouter.d.ts.map +1 -0
- package/dist/services/ai/providers/orcarouter.js +66 -0
- package/dist/services/ai/providers/runcrate.d.ts +49 -0
- package/dist/services/ai/providers/runcrate.d.ts.map +1 -0
- package/dist/services/ai/providers/runcrate.js +57 -0
- package/dist/services/ai/session/ai-session-manager.d.ts +25 -0
- package/dist/services/ai/session/ai-session-manager.d.ts.map +1 -0
- package/dist/services/ai/session/ai-session-manager.js +180 -0
- package/dist/services/ai/session/session-types.d.ts +43 -0
- package/dist/services/ai/session/session-types.d.ts.map +1 -0
- package/dist/services/ai/session/session-types.js +1 -0
- package/dist/services/ai/tools/tool-schema.d.ts +41 -0
- package/dist/services/ai/tools/tool-schema.d.ts.map +1 -0
- package/dist/services/ai/tools/tool-schema.js +24 -0
- package/dist/services/ai/validators/user-profile-validator.d.ts +13 -0
- package/dist/services/ai/validators/user-profile-validator.d.ts.map +1 -0
- package/dist/services/ai/validators/user-profile-validator.js +114 -0
- package/dist/services/api-handlers.d.ts +277 -0
- package/dist/services/api-handlers.d.ts.map +1 -0
- package/dist/services/api-handlers.js +1740 -0
- package/dist/services/auth-token.d.ts +11 -0
- package/dist/services/auth-token.d.ts.map +1 -0
- package/dist/services/auth-token.js +44 -0
- package/dist/services/auto-capture-config-status.d.ts +15 -0
- package/dist/services/auto-capture-config-status.d.ts.map +1 -0
- package/dist/services/auto-capture-config-status.js +31 -0
- package/dist/services/auto-capture.d.ts +33 -0
- package/dist/services/auto-capture.d.ts.map +1 -0
- package/dist/services/auto-capture.js +906 -0
- package/dist/services/auto-update.d.ts +28 -0
- package/dist/services/auto-update.d.ts.map +1 -0
- package/dist/services/auto-update.js +197 -0
- package/dist/services/capture-evidence-events.d.ts +3 -0
- package/dist/services/capture-evidence-events.d.ts.map +1 -0
- package/dist/services/capture-evidence-events.js +15 -0
- package/dist/services/capture-evidence.d.ts +21 -0
- package/dist/services/capture-evidence.d.ts.map +1 -0
- package/dist/services/capture-evidence.js +168 -0
- package/dist/services/capture-tool-evidence.d.ts +21 -0
- package/dist/services/capture-tool-evidence.d.ts.map +1 -0
- package/dist/services/capture-tool-evidence.js +109 -0
- package/dist/services/cleanup-service.d.ts +26 -0
- package/dist/services/cleanup-service.d.ts.map +1 -0
- package/dist/services/cleanup-service.js +199 -0
- package/dist/services/client.d.ts +167 -0
- package/dist/services/client.d.ts.map +1 -0
- package/dist/services/client.js +535 -0
- package/dist/services/context.d.ts +15 -0
- package/dist/services/context.d.ts.map +1 -0
- package/dist/services/context.js +44 -0
- package/dist/services/cors.d.ts +13 -0
- package/dist/services/cors.d.ts.map +1 -0
- package/dist/services/cors.js +52 -0
- package/dist/services/deduplication-service.d.ts +29 -0
- package/dist/services/deduplication-service.d.ts.map +1 -0
- package/dist/services/deduplication-service.js +113 -0
- package/dist/services/dreaming-lock.d.ts +6 -0
- package/dist/services/dreaming-lock.d.ts.map +1 -0
- package/dist/services/dreaming-lock.js +84 -0
- package/dist/services/dreaming-service.d.ts +96 -0
- package/dist/services/dreaming-service.d.ts.map +1 -0
- package/dist/services/dreaming-service.js +626 -0
- package/dist/services/embedding.d.ts +92 -0
- package/dist/services/embedding.d.ts.map +1 -0
- package/dist/services/embedding.js +467 -0
- package/dist/services/injected-prompt-filter.d.ts +49 -0
- package/dist/services/injected-prompt-filter.d.ts.map +1 -0
- package/dist/services/injected-prompt-filter.js +79 -0
- package/dist/services/jsonc.d.ts +7 -0
- package/dist/services/jsonc.d.ts.map +1 -0
- package/dist/services/jsonc.js +110 -0
- package/dist/services/language-detector.d.ts +3 -0
- package/dist/services/language-detector.d.ts.map +1 -0
- package/dist/services/language-detector.js +33 -0
- package/dist/services/logger.d.ts +15 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/logger.js +171 -0
- package/dist/services/markdown/backend.d.ts +35 -0
- package/dist/services/markdown/backend.d.ts.map +1 -0
- package/dist/services/markdown/backend.js +111 -0
- package/dist/services/markdown/document.d.ts +44 -0
- package/dist/services/markdown/document.d.ts.map +1 -0
- package/dist/services/markdown/document.js +159 -0
- package/dist/services/markdown/reconcile.d.ts +26 -0
- package/dist/services/markdown/reconcile.d.ts.map +1 -0
- package/dist/services/markdown/reconcile.js +333 -0
- package/dist/services/markdown/vault.d.ts +32 -0
- package/dist/services/markdown/vault.d.ts.map +1 -0
- package/dist/services/markdown/vault.js +142 -0
- package/dist/services/markdown/watcher.d.ts +22 -0
- package/dist/services/markdown/watcher.d.ts.map +1 -0
- package/dist/services/markdown/watcher.js +131 -0
- package/dist/services/memory-portability-service.d.ts +38 -0
- package/dist/services/memory-portability-service.d.ts.map +1 -0
- package/dist/services/memory-portability-service.js +372 -0
- package/dist/services/memory-provenance.d.ts +16 -0
- package/dist/services/memory-provenance.d.ts.map +1 -0
- package/dist/services/memory-provenance.js +115 -0
- package/dist/services/memory-recall.d.ts +49 -0
- package/dist/services/memory-recall.d.ts.map +1 -0
- package/dist/services/memory-recall.js +196 -0
- package/dist/services/memory-scope.d.ts +17 -0
- package/dist/services/memory-scope.d.ts.map +1 -0
- package/dist/services/memory-scope.js +43 -0
- package/dist/services/migration-service.d.ts +43 -0
- package/dist/services/migration-service.d.ts.map +1 -0
- package/dist/services/migration-service.js +333 -0
- package/dist/services/onnxruntime-resolve.d.ts +25 -0
- package/dist/services/onnxruntime-resolve.d.ts.map +1 -0
- package/dist/services/onnxruntime-resolve.js +176 -0
- package/dist/services/privacy.d.ts +38 -0
- package/dist/services/privacy.d.ts.map +1 -0
- package/dist/services/privacy.js +156 -0
- package/dist/services/request-timeouts.d.ts +4 -0
- package/dist/services/request-timeouts.d.ts.map +1 -0
- package/dist/services/request-timeouts.js +5 -0
- package/dist/services/runtime-require.d.ts +18 -0
- package/dist/services/runtime-require.d.ts.map +1 -0
- package/dist/services/runtime-require.js +75 -0
- package/dist/services/secret-resolver.d.ts +2 -0
- package/dist/services/secret-resolver.d.ts.map +1 -0
- package/dist/services/secret-resolver.js +65 -0
- package/dist/services/shard-inventory-service.d.ts +70 -0
- package/dist/services/shard-inventory-service.d.ts.map +1 -0
- package/dist/services/shard-inventory-service.js +315 -0
- package/dist/services/shard-path-migration-service.d.ts +32 -0
- package/dist/services/shard-path-migration-service.d.ts.map +1 -0
- package/dist/services/shard-path-migration-service.js +386 -0
- package/dist/services/skills/skills-manager.d.ts +39 -0
- package/dist/services/skills/skills-manager.d.ts.map +1 -0
- package/dist/services/skills/skills-manager.js +231 -0
- package/dist/services/skills/types.d.ts +32 -0
- package/dist/services/skills/types.d.ts.map +1 -0
- package/dist/services/skills/types.js +5 -0
- package/dist/services/stats-service.d.ts +71 -0
- package/dist/services/stats-service.d.ts.map +1 -0
- package/dist/services/stats-service.js +288 -0
- package/dist/services/tags.d.ts +30 -0
- package/dist/services/tags.d.ts.map +1 -0
- package/dist/services/tags.js +245 -0
- package/dist/services/transformers-resolve.d.ts +17 -0
- package/dist/services/transformers-resolve.d.ts.map +1 -0
- package/dist/services/transformers-resolve.js +142 -0
- package/dist/services/turso/connection-manager.d.ts +66 -0
- package/dist/services/turso/connection-manager.d.ts.map +1 -0
- package/dist/services/turso/connection-manager.js +408 -0
- package/dist/services/turso/encryption-key.d.ts +17 -0
- package/dist/services/turso/encryption-key.d.ts.map +1 -0
- package/dist/services/turso/encryption-key.js +111 -0
- package/dist/services/turso/encryption-migrator.d.ts +6 -0
- package/dist/services/turso/encryption-migrator.d.ts.map +1 -0
- package/dist/services/turso/encryption-migrator.js +234 -0
- package/dist/services/turso/engine-migrator.d.ts +6 -0
- package/dist/services/turso/engine-migrator.d.ts.map +1 -0
- package/dist/services/turso/engine-migrator.js +318 -0
- package/dist/services/turso/error-classifiers.d.ts +4 -0
- package/dist/services/turso/error-classifiers.d.ts.map +1 -0
- package/dist/services/turso/error-classifiers.js +19 -0
- package/dist/services/turso/legacy-migrator.d.ts +2 -0
- package/dist/services/turso/legacy-migrator.d.ts.map +1 -0
- package/dist/services/turso/legacy-migrator.js +535 -0
- package/dist/services/turso/lifecycle.d.ts +11 -0
- package/dist/services/turso/lifecycle.d.ts.map +1 -0
- package/dist/services/turso/lifecycle.js +32 -0
- package/dist/services/turso/operation-lock.d.ts +26 -0
- package/dist/services/turso/operation-lock.d.ts.map +1 -0
- package/dist/services/turso/operation-lock.js +188 -0
- package/dist/services/turso/plugin-refs.d.ts +13 -0
- package/dist/services/turso/plugin-refs.d.ts.map +1 -0
- package/dist/services/turso/plugin-refs.js +43 -0
- package/dist/services/turso/ready.d.ts +3 -0
- package/dist/services/turso/ready.d.ts.map +1 -0
- package/dist/services/turso/ready.js +32 -0
- package/dist/services/turso/schema-migrations.d.ts +24 -0
- package/dist/services/turso/schema-migrations.d.ts.map +1 -0
- package/dist/services/turso/schema-migrations.js +367 -0
- package/dist/services/turso/shard-manager.d.ts +41 -0
- package/dist/services/turso/shard-manager.d.ts.map +1 -0
- package/dist/services/turso/shard-manager.js +419 -0
- package/dist/services/turso/sqlite-handle-release.d.ts +31 -0
- package/dist/services/turso/sqlite-handle-release.d.ts.map +1 -0
- package/dist/services/turso/sqlite-handle-release.js +101 -0
- package/dist/services/turso/turso-db.d.ts +61 -0
- package/dist/services/turso/turso-db.d.ts.map +1 -0
- package/dist/services/turso/turso-db.js +214 -0
- package/dist/services/turso/types.d.ts +52 -0
- package/dist/services/turso/types.d.ts.map +1 -0
- package/dist/services/turso/types.js +1 -0
- package/dist/services/turso/vector-search.d.ts +63 -0
- package/dist/services/turso/vector-search.d.ts.map +1 -0
- package/dist/services/turso/vector-search.js +510 -0
- package/dist/services/turso/vector-utils.d.ts +16 -0
- package/dist/services/turso/vector-utils.d.ts.map +1 -0
- package/dist/services/turso/vector-utils.js +98 -0
- package/dist/services/turso/wal-index-recovery.d.ts +51 -0
- package/dist/services/turso/wal-index-recovery.d.ts.map +1 -0
- package/dist/services/turso/wal-index-recovery.js +248 -0
- package/dist/services/update-on-capture.d.ts +77 -0
- package/dist/services/update-on-capture.d.ts.map +1 -0
- package/dist/services/update-on-capture.js +116 -0
- package/dist/services/user-memory-learning.d.ts +137 -0
- package/dist/services/user-memory-learning.d.ts.map +1 -0
- package/dist/services/user-memory-learning.js +787 -0
- package/dist/services/user-profile/ai-cleanup.d.ts +59 -0
- package/dist/services/user-profile/ai-cleanup.d.ts.map +1 -0
- package/dist/services/user-profile/ai-cleanup.js +488 -0
- package/dist/services/user-profile/learning-lock.d.ts +41 -0
- package/dist/services/user-profile/learning-lock.d.ts.map +1 -0
- package/dist/services/user-profile/learning-lock.js +619 -0
- package/dist/services/user-profile/profile-context.d.ts +2 -0
- package/dist/services/user-profile/profile-context.d.ts.map +1 -0
- package/dist/services/user-profile/profile-context.js +105 -0
- package/dist/services/user-profile/profile-utils.d.ts +17 -0
- package/dist/services/user-profile/profile-utils.d.ts.map +1 -0
- package/dist/services/user-profile/profile-utils.js +77 -0
- package/dist/services/user-profile/types.d.ts +93 -0
- package/dist/services/user-profile/types.d.ts.map +1 -0
- package/dist/services/user-profile/types.js +1 -0
- package/dist/services/user-profile/user-profile-manager.d.ts +106 -0
- package/dist/services/user-profile/user-profile-manager.d.ts.map +1 -0
- package/dist/services/user-profile/user-profile-manager.js +1793 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts +64 -0
- package/dist/services/user-prompt/user-prompt-manager.d.ts.map +1 -0
- package/dist/services/user-prompt/user-prompt-manager.js +428 -0
- package/dist/services/web-api-auth.d.ts +4 -0
- package/dist/services/web-api-auth.d.ts.map +1 -0
- package/dist/services/web-api-auth.js +24 -0
- package/dist/services/web-auth.d.ts +47 -0
- package/dist/services/web-auth.d.ts.map +1 -0
- package/dist/services/web-auth.js +105 -0
- package/dist/services/web-server.d.ts +58 -0
- package/dist/services/web-server.d.ts.map +1 -0
- package/dist/services/web-server.js +774 -0
- package/dist/shared/api/index.d.ts +5 -0
- package/dist/shared/api/index.d.ts.map +1 -0
- package/dist/shared/api/index.js +2 -0
- package/dist/shared/api/portability-schemas.d.ts +57 -0
- package/dist/shared/api/portability-schemas.d.ts.map +1 -0
- package/dist/shared/api/portability-schemas.js +39 -0
- package/dist/shared/api/schemas.d.ts +296 -0
- package/dist/shared/api/schemas.d.ts.map +1 -0
- package/dist/shared/api/schemas.js +134 -0
- package/dist/shared/api/types.d.ts +29 -0
- package/dist/shared/api/types.d.ts.map +1 -0
- package/dist/shared/api/types.js +1 -0
- package/dist/tui.d.ts +10 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +17 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/context-limit.d.ts +11 -0
- package/dist/utils/context-limit.d.ts.map +1 -0
- package/dist/utils/context-limit.js +43 -0
- package/dist/utils/math.d.ts +8 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +48 -0
- package/dist/utils/profile.d.ts +3 -0
- package/dist/utils/profile.d.ts.map +1 -0
- package/dist/utils/profile.js +15 -0
- package/dist/v2/adapter.d.ts +3 -0
- package/dist/v2/adapter.d.ts.map +1 -0
- package/dist/v2/adapter.js +217 -0
- package/dist/v2/legacy-client.d.ts +22 -0
- package/dist/v2/legacy-client.d.ts.map +1 -0
- package/dist/v2/legacy-client.js +410 -0
- package/dist/v2/plugin.d.ts +4 -0
- package/dist/v2/plugin.d.ts.map +1 -0
- package/dist/v2/plugin.js +34 -0
- package/dist/v2/toast-rpc.d.ts +43 -0
- package/dist/v2/toast-rpc.d.ts.map +1 -0
- package/dist/v2/toast-rpc.js +26 -0
- package/dist/web/accent-preview.html +444 -0
- package/dist/web/assets/index-mTgxOb5l.css +2 -0
- package/dist/web/assets/index-ysje17yK.js +109 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +11 -0
- package/dist/web/index.html +29 -0
- package/dist/web/opencode-mem-icon.png +0 -0
- package/package.json +122 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OpencodeClient } from "@opencode-ai/sdk/v2/client";
|
|
2
|
+
export type HostTransport = {
|
|
3
|
+
readonly fetch?: typeof fetch;
|
|
4
|
+
readonly headers?: RequestInit["headers"];
|
|
5
|
+
};
|
|
6
|
+
export declare function createLazyV2Client(baseUrl: string, transport?: HostTransport): OpencodeClient;
|
|
7
|
+
//# sourceMappingURL=opencode-sdk-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-sdk-client.d.ts","sourceRoot":"","sources":["../../../src/services/ai/opencode-sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC;AAwBF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,cAAc,CA2B7F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function getOpencodeSdkClientSpecifier() {
|
|
2
|
+
return ["@opencode-ai/sdk", "/v2/client"].join("");
|
|
3
|
+
}
|
|
4
|
+
async function createSdkClient(baseUrl, transport) {
|
|
5
|
+
const sdk = (await import(getOpencodeSdkClientSpecifier()));
|
|
6
|
+
return sdk.createOpencodeClient({
|
|
7
|
+
baseUrl,
|
|
8
|
+
...(transport?.fetch ? { fetch: transport.fetch } : {}),
|
|
9
|
+
...(transport?.headers ? { headers: transport.headers } : {}),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function createLazyV2Client(baseUrl, transport) {
|
|
13
|
+
let sdkClientPromise;
|
|
14
|
+
const getSdkClient = () => {
|
|
15
|
+
sdkClientPromise ??= createSdkClient(baseUrl, transport);
|
|
16
|
+
return sdkClientPromise;
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
session: {
|
|
20
|
+
create: async (...args) => {
|
|
21
|
+
const client = await getSdkClient();
|
|
22
|
+
return client.session.create(...args);
|
|
23
|
+
},
|
|
24
|
+
prompt: async (...args) => {
|
|
25
|
+
const client = await getSdkClient();
|
|
26
|
+
return client.session.prompt(...args);
|
|
27
|
+
},
|
|
28
|
+
delete: async (...args) => {
|
|
29
|
+
const client = await getSdkClient();
|
|
30
|
+
return client.session.delete(...args);
|
|
31
|
+
},
|
|
32
|
+
abort: async (...args) => {
|
|
33
|
+
const client = await getSdkClient();
|
|
34
|
+
return client.session.abort(...args);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-llm-client.d.ts","sourceRoot":"","sources":["../../../src/services/ai/profile-llm-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQjE,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CA+BjE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CONFIG } from "../../config.js";
|
|
2
|
+
import { loadOpencodeProvider } from "./opencode-provider-loader.js";
|
|
3
|
+
let _cachedClient = null;
|
|
4
|
+
let _cachedProvider = null;
|
|
5
|
+
let _cachedModel = null;
|
|
6
|
+
export async function getOpenCodeClient() {
|
|
7
|
+
const provider = CONFIG.opencodeProvider;
|
|
8
|
+
const model = CONFIG.opencodeModel;
|
|
9
|
+
if (!provider || !model) {
|
|
10
|
+
throw new Error("opencode-mem: opencodeProvider and opencodeModel must be configured");
|
|
11
|
+
}
|
|
12
|
+
if (_cachedClient && _cachedProvider === provider && _cachedModel === model) {
|
|
13
|
+
return _cachedClient;
|
|
14
|
+
}
|
|
15
|
+
const { ensureProviderConnected, getV2Client } = await loadOpencodeProvider();
|
|
16
|
+
// One refresh-on-miss before failing: user-config providers register
|
|
17
|
+
// seconds after plugin setup, so the init snapshot may lag the host.
|
|
18
|
+
if (!(await ensureProviderConnected(provider))) {
|
|
19
|
+
throw new Error(`opencode provider '${provider}' is not connected. Check your opencode provider configuration.`);
|
|
20
|
+
}
|
|
21
|
+
const client = getV2Client();
|
|
22
|
+
if (!client) {
|
|
23
|
+
throw new Error("opencode-mem: v2 client not initialized");
|
|
24
|
+
}
|
|
25
|
+
_cachedClient = client;
|
|
26
|
+
_cachedProvider = provider;
|
|
27
|
+
_cachedModel = model;
|
|
28
|
+
return client;
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ProviderConfig } from "./providers/base-provider.js";
|
|
2
|
+
interface MemoryProviderRuntimeConfig {
|
|
3
|
+
memoryProvider?: string;
|
|
4
|
+
memoryModel?: string;
|
|
5
|
+
memoryApiUrl?: string;
|
|
6
|
+
memoryApiKey?: string;
|
|
7
|
+
memoryTemperature?: number | false;
|
|
8
|
+
forceToolChoice?: boolean;
|
|
9
|
+
memoryExtraParams?: Record<string, unknown>;
|
|
10
|
+
autoCaptureMaxIterations?: number;
|
|
11
|
+
autoCaptureIterationTimeout?: number;
|
|
12
|
+
}
|
|
13
|
+
interface ProviderConfigOverrides {
|
|
14
|
+
maxIterations?: number;
|
|
15
|
+
iterationTimeout?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildMemoryProviderConfig(config: MemoryProviderRuntimeConfig, overrides?: ProviderConfigOverrides): ProviderConfig;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=provider-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-config.d.ts","sourceRoot":"","sources":["../../../src/services/ai/provider-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,UAAU,2BAA2B;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,UAAU,uBAAuB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,2BAA2B,EACnC,SAAS,GAAE,uBAA4B,GACtC,cAAc,CAmChB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isPlaceholderApiKey } from "./api-key-placeholder.js";
|
|
2
|
+
export function buildMemoryProviderConfig(config, overrides = {}) {
|
|
3
|
+
const memoryModel = config.memoryModel;
|
|
4
|
+
const memoryApiUrl = config.memoryApiUrl;
|
|
5
|
+
const memoryApiKey = config.memoryApiKey;
|
|
6
|
+
const issues = [];
|
|
7
|
+
// Preset providers fill endpoint/model themselves, so memoryModel /
|
|
8
|
+
// memoryApiUrl are optional there. An API key is always required.
|
|
9
|
+
const isPresetProvider = config.memoryProvider === "orcarouter" ||
|
|
10
|
+
config.memoryProvider === "atlas-cloud" ||
|
|
11
|
+
config.memoryProvider === "cheaper-inference" ||
|
|
12
|
+
config.memoryProvider === "api-route" ||
|
|
13
|
+
config.memoryProvider === "runcrate" ||
|
|
14
|
+
config.memoryProvider === "cloudgpu";
|
|
15
|
+
if (!memoryModel && !isPresetProvider)
|
|
16
|
+
issues.push("missing memoryModel");
|
|
17
|
+
if (!memoryApiUrl && !isPresetProvider)
|
|
18
|
+
issues.push("missing memoryApiUrl");
|
|
19
|
+
if (!memoryApiKey)
|
|
20
|
+
issues.push("missing memoryApiKey");
|
|
21
|
+
if (isPlaceholderApiKey(memoryApiKey))
|
|
22
|
+
issues.push("replace the placeholder memoryApiKey value");
|
|
23
|
+
if (issues.length > 0) {
|
|
24
|
+
throw new Error(`External API not configured for memory provider: ${issues.join("; ")}`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
model: memoryModel || "",
|
|
28
|
+
apiUrl: memoryApiUrl || "",
|
|
29
|
+
apiKey: memoryApiKey || "",
|
|
30
|
+
memoryTemperature: config.memoryTemperature,
|
|
31
|
+
forceToolChoice: config.forceToolChoice,
|
|
32
|
+
extraParams: config.memoryExtraParams,
|
|
33
|
+
maxIterations: overrides.maxIterations ?? config.autoCaptureMaxIterations,
|
|
34
|
+
iterationTimeout: overrides.iterationTimeout ?? config.autoCaptureIterationTimeout,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseAIProvider, type ToolCallResult } from "./base-provider.js";
|
|
2
|
+
import { AISessionManager } from "../session/ai-session-manager.js";
|
|
3
|
+
import { type ChatCompletionTool } from "../tools/tool-schema.js";
|
|
4
|
+
import type { AIProviderType } from "../session/session-types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Base implementation for providers that speak the Anthropic Messages API
|
|
7
|
+
* (Anthropic itself plus Anthropic-compatible gateways such as MiniMax).
|
|
8
|
+
*
|
|
9
|
+
* Subclasses override the session provider tag and the resolved endpoint URL so
|
|
10
|
+
* the session store and request routing reflect the upstream provider while the
|
|
11
|
+
* message/tool-call handling stays shared.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AnthropicMessagesProvider extends BaseAIProvider {
|
|
14
|
+
private aiSessionManager;
|
|
15
|
+
constructor(config: any, aiSessionManager: AISessionManager);
|
|
16
|
+
getProviderName(): string;
|
|
17
|
+
supportsSession(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Provider tag stored on AI sessions so a subclass (e.g. MiniMax) records its
|
|
20
|
+
* own tag instead of the literal "anthropic" value.
|
|
21
|
+
*/
|
|
22
|
+
protected sessionProviderTag(): AIProviderType;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the Messages endpoint URL. The default appends `/messages` to the
|
|
25
|
+
* configured base URL, matching Anthropic's `https://api.anthropic.com/v1`
|
|
26
|
+
* base. Subclasses with a different path layout override this.
|
|
27
|
+
*/
|
|
28
|
+
protected resolveEndpoint(): string;
|
|
29
|
+
protected apiErrorLogLabel(): string;
|
|
30
|
+
protected toolValidationErrorLogLabel(): string;
|
|
31
|
+
protected timeoutLabel(): string;
|
|
32
|
+
executeToolCall(systemPrompt: string, userPrompt: string, toolSchema: ChatCompletionTool, sessionId: string): Promise<ToolCallResult>;
|
|
33
|
+
private extractToolUse;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=anthropic-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AA4BlE;;;;;;;GAOG;AACH,qBAAa,yBAA0B,SAAQ,cAAc;IAC3D,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB;IAK3D,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,OAAO;IAI1B;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,cAAc;IAI9C;;;;OAIG;IACH,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAIpC,SAAS,CAAC,2BAA2B,IAAI,MAAM;IAI/C,SAAS,CAAC,YAAY,IAAI,MAAM;IAI1B,eAAe,CACnB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAyL1B,OAAO,CAAC,cAAc;CAavB"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { applySafeExtraParams, BaseAIProvider } from "./base-provider.js";
|
|
2
|
+
import { AISessionManager } from "../session/ai-session-manager.js";
|
|
3
|
+
import { ToolSchemaConverter } from "../tools/tool-schema.js";
|
|
4
|
+
import { log } from "../../logger.js";
|
|
5
|
+
import { UserProfileValidator } from "../validators/user-profile-validator.js";
|
|
6
|
+
/**
|
|
7
|
+
* Base implementation for providers that speak the Anthropic Messages API
|
|
8
|
+
* (Anthropic itself plus Anthropic-compatible gateways such as MiniMax).
|
|
9
|
+
*
|
|
10
|
+
* Subclasses override the session provider tag and the resolved endpoint URL so
|
|
11
|
+
* the session store and request routing reflect the upstream provider while the
|
|
12
|
+
* message/tool-call handling stays shared.
|
|
13
|
+
*/
|
|
14
|
+
export class AnthropicMessagesProvider extends BaseAIProvider {
|
|
15
|
+
aiSessionManager;
|
|
16
|
+
constructor(config, aiSessionManager) {
|
|
17
|
+
super(config);
|
|
18
|
+
this.aiSessionManager = aiSessionManager;
|
|
19
|
+
}
|
|
20
|
+
getProviderName() {
|
|
21
|
+
return "anthropic";
|
|
22
|
+
}
|
|
23
|
+
supportsSession() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Provider tag stored on AI sessions so a subclass (e.g. MiniMax) records its
|
|
28
|
+
* own tag instead of the literal "anthropic" value.
|
|
29
|
+
*/
|
|
30
|
+
sessionProviderTag() {
|
|
31
|
+
return "anthropic";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the Messages endpoint URL. The default appends `/messages` to the
|
|
35
|
+
* configured base URL, matching Anthropic's `https://api.anthropic.com/v1`
|
|
36
|
+
* base. Subclasses with a different path layout override this.
|
|
37
|
+
*/
|
|
38
|
+
resolveEndpoint() {
|
|
39
|
+
return `${this.config.apiUrl}/messages`;
|
|
40
|
+
}
|
|
41
|
+
apiErrorLogLabel() {
|
|
42
|
+
return "Anthropic Messages API error";
|
|
43
|
+
}
|
|
44
|
+
toolValidationErrorLogLabel() {
|
|
45
|
+
return "Anthropic tool response validation failed";
|
|
46
|
+
}
|
|
47
|
+
timeoutLabel() {
|
|
48
|
+
return "Anthropic API request timeout";
|
|
49
|
+
}
|
|
50
|
+
async executeToolCall(systemPrompt, userPrompt, toolSchema, sessionId) {
|
|
51
|
+
const providerTag = this.sessionProviderTag();
|
|
52
|
+
let session = await this.aiSessionManager.getSession(sessionId, providerTag);
|
|
53
|
+
if (!session) {
|
|
54
|
+
session = await this.aiSessionManager.createSession({
|
|
55
|
+
provider: providerTag,
|
|
56
|
+
sessionId,
|
|
57
|
+
metadata: { systemPrompt },
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const storedMessages = await this.aiSessionManager.getMessages(session.id);
|
|
61
|
+
const messages = [];
|
|
62
|
+
for (const msg of storedMessages) {
|
|
63
|
+
if (msg.role === "system")
|
|
64
|
+
continue;
|
|
65
|
+
const anthropicMsg = {
|
|
66
|
+
role: msg.role,
|
|
67
|
+
content: msg.contentBlocks || msg.content,
|
|
68
|
+
};
|
|
69
|
+
messages.push(anthropicMsg);
|
|
70
|
+
}
|
|
71
|
+
const userSequence = (await this.aiSessionManager.getLastSequence(session.id)) + 1;
|
|
72
|
+
await this.aiSessionManager.addMessage({
|
|
73
|
+
aiSessionId: session.id,
|
|
74
|
+
sequence: userSequence,
|
|
75
|
+
role: "user",
|
|
76
|
+
content: userPrompt,
|
|
77
|
+
});
|
|
78
|
+
messages.push({ role: "user", content: userPrompt });
|
|
79
|
+
let iterations = 0;
|
|
80
|
+
const maxIterations = this.config.maxIterations ?? 5;
|
|
81
|
+
const iterationTimeout = this.config.iterationTimeout ?? 30000;
|
|
82
|
+
while (iterations < maxIterations) {
|
|
83
|
+
iterations++;
|
|
84
|
+
const controller = new AbortController();
|
|
85
|
+
const timeout = setTimeout(() => controller.abort(), iterationTimeout);
|
|
86
|
+
try {
|
|
87
|
+
const tool = ToolSchemaConverter.toAnthropic(toolSchema);
|
|
88
|
+
const requestBody = {
|
|
89
|
+
model: this.config.model,
|
|
90
|
+
max_tokens: this.config.maxTokens ?? 4096,
|
|
91
|
+
system: systemPrompt,
|
|
92
|
+
messages,
|
|
93
|
+
tools: [tool],
|
|
94
|
+
};
|
|
95
|
+
if (this.config.extraParams) {
|
|
96
|
+
applySafeExtraParams(requestBody, this.config.extraParams);
|
|
97
|
+
}
|
|
98
|
+
const headers = {
|
|
99
|
+
"Content-Type": "application/json",
|
|
100
|
+
"anthropic-version": "2023-06-01",
|
|
101
|
+
};
|
|
102
|
+
if (this.config.apiKey) {
|
|
103
|
+
headers["x-api-key"] = this.config.apiKey;
|
|
104
|
+
}
|
|
105
|
+
const response = await fetch(this.resolveEndpoint(), {
|
|
106
|
+
method: "POST",
|
|
107
|
+
headers,
|
|
108
|
+
body: JSON.stringify(requestBody),
|
|
109
|
+
signal: controller.signal,
|
|
110
|
+
});
|
|
111
|
+
clearTimeout(timeout);
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
const errorText = await response.text().catch(() => response.statusText);
|
|
114
|
+
log(this.apiErrorLogLabel(), {
|
|
115
|
+
provider: this.getProviderName(),
|
|
116
|
+
model: this.config.model,
|
|
117
|
+
status: response.status,
|
|
118
|
+
error: errorText,
|
|
119
|
+
iteration: iterations,
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
success: false,
|
|
123
|
+
error: `API error: ${response.status} - ${errorText}`,
|
|
124
|
+
iterations,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const data = (await response.json());
|
|
128
|
+
const assistantSequence = (await this.aiSessionManager.getLastSequence(session.id)) + 1;
|
|
129
|
+
await this.aiSessionManager.addMessage({
|
|
130
|
+
aiSessionId: session.id,
|
|
131
|
+
sequence: assistantSequence,
|
|
132
|
+
role: "assistant",
|
|
133
|
+
content: JSON.stringify(data.content),
|
|
134
|
+
contentBlocks: data.content,
|
|
135
|
+
});
|
|
136
|
+
messages.push({
|
|
137
|
+
role: "assistant",
|
|
138
|
+
content: data.content,
|
|
139
|
+
});
|
|
140
|
+
const toolUse = this.extractToolUse(data, toolSchema.function.name);
|
|
141
|
+
if (toolUse) {
|
|
142
|
+
try {
|
|
143
|
+
const result = UserProfileValidator.validate(toolUse);
|
|
144
|
+
if (!result.valid) {
|
|
145
|
+
throw new Error(result.errors.join(", "));
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
success: true,
|
|
149
|
+
data: result.data,
|
|
150
|
+
iterations,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (validationError) {
|
|
154
|
+
const errorStack = validationError instanceof Error ? validationError.stack : undefined;
|
|
155
|
+
log(this.toolValidationErrorLogLabel(), {
|
|
156
|
+
error: String(validationError),
|
|
157
|
+
stack: errorStack,
|
|
158
|
+
errorType: validationError instanceof Error
|
|
159
|
+
? validationError.constructor.name
|
|
160
|
+
: typeof validationError,
|
|
161
|
+
toolName: toolSchema.function.name,
|
|
162
|
+
iteration: iterations,
|
|
163
|
+
rawData: JSON.stringify(toolUse).slice(0, 500),
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
error: `Validation failed: ${String(validationError)}`,
|
|
168
|
+
iterations,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (data.stop_reason === "end_turn") {
|
|
173
|
+
const retrySequence = (await this.aiSessionManager.getLastSequence(session.id)) + 1;
|
|
174
|
+
const retryPrompt = "Please use the save_memories tool to extract and save the memories from the conversation as instructed.";
|
|
175
|
+
await this.aiSessionManager.addMessage({
|
|
176
|
+
aiSessionId: session.id,
|
|
177
|
+
sequence: retrySequence,
|
|
178
|
+
role: "user",
|
|
179
|
+
content: retryPrompt,
|
|
180
|
+
});
|
|
181
|
+
messages.push({ role: "user", content: retryPrompt });
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
clearTimeout(timeout);
|
|
189
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
190
|
+
return {
|
|
191
|
+
success: false,
|
|
192
|
+
error: `${this.timeoutLabel()} (${this.config.iterationTimeout}ms)`,
|
|
193
|
+
iterations,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
error: String(error),
|
|
199
|
+
iterations,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
success: false,
|
|
205
|
+
error: `Max iterations (${maxIterations}) reached without tool use`,
|
|
206
|
+
iterations,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
extractToolUse(data, expectedToolName) {
|
|
210
|
+
if (!data.content || !Array.isArray(data.content)) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
for (const block of data.content) {
|
|
214
|
+
if (block.type === "tool_use" && block.name === expectedToolName && block.input) {
|
|
215
|
+
return block.input;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import type { ProviderConfig } from "./base-provider.js";
|
|
3
|
+
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
|
+
import type { AIProviderType } from "../session/session-types.js";
|
|
5
|
+
/** API Route OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
+
export declare const API_ROUTE_API_URL = "https://global.api-route.com/v1";
|
|
7
|
+
/**
|
|
8
|
+
* Default model when `memoryModel` is omitted. API Route model IDs are
|
|
9
|
+
* sent unchanged (e.g. `gpt-6.1-sol`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const API_ROUTE_DEFAULT_MODEL = "gpt-6.1-sol";
|
|
12
|
+
/**
|
|
13
|
+
* API Route provider.
|
|
14
|
+
*
|
|
15
|
+
* [API Route](https://www.api-route.com/en/docs/quickstart) exposes an OpenAI-compatible
|
|
16
|
+
* Chat Completions API. This provider reuses the OpenAI Chat Completions request
|
|
17
|
+
* handling and only overrides the resolved endpoint, default model, and the
|
|
18
|
+
* session provider tag, so API Route sessions are distinguishable in the
|
|
19
|
+
* session store and diagnostics.
|
|
20
|
+
*
|
|
21
|
+
* Users configure it as:
|
|
22
|
+
* "memoryProvider": "api-route"
|
|
23
|
+
* "memoryApiKey": "env://API_ROUTE_API_KEY"
|
|
24
|
+
*
|
|
25
|
+
* `memoryApiUrl` and `memoryModel` are optional — they default to the API Route endpoint and `gpt-6.1-sol` respectively.
|
|
26
|
+
*
|
|
27
|
+
* When this provider is selected, auto-capture / profile prompts, model
|
|
28
|
+
* responses, and relevant conversation context are transmitted to
|
|
29
|
+
* `https://global.api-route.com`.
|
|
30
|
+
*/
|
|
31
|
+
export declare class APIRouteProvider extends OpenAIChatCompletionProvider {
|
|
32
|
+
constructor(config: ProviderConfig, aiSessionManager: AISessionManager);
|
|
33
|
+
getProviderName(): string;
|
|
34
|
+
protected sessionProviderTag(): AIProviderType;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the OpenAI-compatible endpoint.
|
|
37
|
+
*
|
|
38
|
+
* Defaults to the API Route API when `memoryApiUrl` is not configured,
|
|
39
|
+
* so a minimal config only needs `memoryProvider` + `memoryApiKey`.
|
|
40
|
+
*/
|
|
41
|
+
resolveEndpoint(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve the model ID to send to API Route.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `gpt-6.1-sol` when `memoryModel` is not configured.
|
|
46
|
+
*/
|
|
47
|
+
resolveModel(): string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=api-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-route.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/api-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,oCAAoC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAiB,SAAQ,4BAA4B;gBACpD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;OAIG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
/** API Route OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
+
export const API_ROUTE_API_URL = "https://global.api-route.com/v1";
|
|
4
|
+
/**
|
|
5
|
+
* Default model when `memoryModel` is omitted. API Route model IDs are
|
|
6
|
+
* sent unchanged (e.g. `gpt-6.1-sol`).
|
|
7
|
+
*/
|
|
8
|
+
export const API_ROUTE_DEFAULT_MODEL = "gpt-6.1-sol";
|
|
9
|
+
/**
|
|
10
|
+
* API Route provider.
|
|
11
|
+
*
|
|
12
|
+
* [API Route](https://www.api-route.com/en/docs/quickstart) exposes an OpenAI-compatible
|
|
13
|
+
* Chat Completions API. This provider reuses the OpenAI Chat Completions request
|
|
14
|
+
* handling and only overrides the resolved endpoint, default model, and the
|
|
15
|
+
* session provider tag, so API Route sessions are distinguishable in the
|
|
16
|
+
* session store and diagnostics.
|
|
17
|
+
*
|
|
18
|
+
* Users configure it as:
|
|
19
|
+
* "memoryProvider": "api-route"
|
|
20
|
+
* "memoryApiKey": "env://API_ROUTE_API_KEY"
|
|
21
|
+
*
|
|
22
|
+
* `memoryApiUrl` and `memoryModel` are optional — they default to the API Route endpoint and `gpt-6.1-sol` respectively.
|
|
23
|
+
*
|
|
24
|
+
* When this provider is selected, auto-capture / profile prompts, model
|
|
25
|
+
* responses, and relevant conversation context are transmitted to
|
|
26
|
+
* `https://global.api-route.com`.
|
|
27
|
+
*/
|
|
28
|
+
export class APIRouteProvider extends OpenAIChatCompletionProvider {
|
|
29
|
+
constructor(config, aiSessionManager) {
|
|
30
|
+
super(config, aiSessionManager);
|
|
31
|
+
}
|
|
32
|
+
getProviderName() {
|
|
33
|
+
return "api-route";
|
|
34
|
+
}
|
|
35
|
+
sessionProviderTag() {
|
|
36
|
+
return "api-route";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the OpenAI-compatible endpoint.
|
|
40
|
+
*
|
|
41
|
+
* Defaults to the API Route API when `memoryApiUrl` is not configured,
|
|
42
|
+
* so a minimal config only needs `memoryProvider` + `memoryApiKey`.
|
|
43
|
+
*/
|
|
44
|
+
resolveEndpoint() {
|
|
45
|
+
const base = (this.config.apiUrl || "").trim().replace(/\/+$/, "");
|
|
46
|
+
return base || API_ROUTE_API_URL;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the model ID to send to API Route.
|
|
50
|
+
*
|
|
51
|
+
* Defaults to `gpt-6.1-sol` when `memoryModel` is not configured.
|
|
52
|
+
*/
|
|
53
|
+
resolveModel() {
|
|
54
|
+
const model = (this.config.model || "").trim();
|
|
55
|
+
return model || API_ROUTE_DEFAULT_MODEL;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
import type { ProviderConfig } from "./base-provider.js";
|
|
3
|
+
import type { AISessionManager } from "../session/ai-session-manager.js";
|
|
4
|
+
import type { AIProviderType } from "../session/session-types.js";
|
|
5
|
+
/** Atlas Cloud OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
6
|
+
export declare const ATLAS_CLOUD_API_URL = "https://api.atlascloud.ai/v1";
|
|
7
|
+
/**
|
|
8
|
+
* Default model when `memoryModel` is omitted. Atlas Cloud model IDs are
|
|
9
|
+
* typically namespaced (e.g. `deepseek-ai/deepseek-v4-pro`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const ATLAS_CLOUD_DEFAULT_MODEL = "deepseek-ai/deepseek-v4-pro";
|
|
12
|
+
/**
|
|
13
|
+
* Atlas Cloud provider.
|
|
14
|
+
*
|
|
15
|
+
* [Atlas Cloud](https://www.atlascloud.ai) exposes an OpenAI-compatible Chat
|
|
16
|
+
* Completions API. This provider reuses the OpenAI Chat Completions request
|
|
17
|
+
* handling and only overrides the resolved endpoint, default model, and the
|
|
18
|
+
* session provider tag, so Atlas sessions are distinguishable in the session
|
|
19
|
+
* store and diagnostics.
|
|
20
|
+
*
|
|
21
|
+
* Users configure it as:
|
|
22
|
+
* "memoryProvider": "atlas-cloud"
|
|
23
|
+
* "memoryApiKey": "env://ATLASCLOUD_API_KEY"
|
|
24
|
+
*
|
|
25
|
+
* `memoryApiUrl` and `memoryModel` are optional — they default to the Atlas
|
|
26
|
+
* endpoint and `deepseek-ai/deepseek-v4-pro` respectively.
|
|
27
|
+
*
|
|
28
|
+
* When this provider is selected, auto-capture / profile prompts, model
|
|
29
|
+
* responses, and relevant conversation context are transmitted to
|
|
30
|
+
* `https://api.atlascloud.ai`.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AtlasCloudProvider extends OpenAIChatCompletionProvider {
|
|
33
|
+
constructor(config: ProviderConfig, aiSessionManager: AISessionManager);
|
|
34
|
+
getProviderName(): string;
|
|
35
|
+
protected sessionProviderTag(): AIProviderType;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the OpenAI-compatible endpoint.
|
|
38
|
+
*
|
|
39
|
+
* Defaults to the Atlas Cloud API when `memoryApiUrl` is not configured,
|
|
40
|
+
* so a minimal config only needs `memoryProvider` + `memoryApiKey`.
|
|
41
|
+
*/
|
|
42
|
+
resolveEndpoint(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the model ID to send to Atlas Cloud.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to `deepseek-ai/deepseek-v4-pro` when `memoryModel` is not
|
|
47
|
+
* configured.
|
|
48
|
+
*/
|
|
49
|
+
resolveModel(): string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=atlas-cloud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas-cloud.d.ts","sourceRoot":"","sources":["../../../../src/services/ai/providers/atlas-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,kBAAmB,SAAQ,4BAA4B;gBACtD,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI7D,eAAe,IAAI,MAAM;cAIf,kBAAkB,IAAI,cAAc;IAIvD;;;;;OAKG;IACM,eAAe,IAAI,MAAM;IAKlC;;;;;OAKG;IACM,YAAY,IAAI,MAAM;CAIhC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { OpenAIChatCompletionProvider } from "./openai-chat-completion.js";
|
|
2
|
+
/** Atlas Cloud OpenAI-compatible endpoint used when `memoryApiUrl` is omitted. */
|
|
3
|
+
export const ATLAS_CLOUD_API_URL = "https://api.atlascloud.ai/v1";
|
|
4
|
+
/**
|
|
5
|
+
* Default model when `memoryModel` is omitted. Atlas Cloud model IDs are
|
|
6
|
+
* typically namespaced (e.g. `deepseek-ai/deepseek-v4-pro`).
|
|
7
|
+
*/
|
|
8
|
+
export const ATLAS_CLOUD_DEFAULT_MODEL = "deepseek-ai/deepseek-v4-pro";
|
|
9
|
+
/**
|
|
10
|
+
* Atlas Cloud provider.
|
|
11
|
+
*
|
|
12
|
+
* [Atlas Cloud](https://www.atlascloud.ai) exposes an OpenAI-compatible Chat
|
|
13
|
+
* Completions API. This provider reuses the OpenAI Chat Completions request
|
|
14
|
+
* handling and only overrides the resolved endpoint, default model, and the
|
|
15
|
+
* session provider tag, so Atlas sessions are distinguishable in the session
|
|
16
|
+
* store and diagnostics.
|
|
17
|
+
*
|
|
18
|
+
* Users configure it as:
|
|
19
|
+
* "memoryProvider": "atlas-cloud"
|
|
20
|
+
* "memoryApiKey": "env://ATLASCLOUD_API_KEY"
|
|
21
|
+
*
|
|
22
|
+
* `memoryApiUrl` and `memoryModel` are optional — they default to the Atlas
|
|
23
|
+
* endpoint and `deepseek-ai/deepseek-v4-pro` respectively.
|
|
24
|
+
*
|
|
25
|
+
* When this provider is selected, auto-capture / profile prompts, model
|
|
26
|
+
* responses, and relevant conversation context are transmitted to
|
|
27
|
+
* `https://api.atlascloud.ai`.
|
|
28
|
+
*/
|
|
29
|
+
export class AtlasCloudProvider extends OpenAIChatCompletionProvider {
|
|
30
|
+
constructor(config, aiSessionManager) {
|
|
31
|
+
super(config, aiSessionManager);
|
|
32
|
+
}
|
|
33
|
+
getProviderName() {
|
|
34
|
+
return "atlas-cloud";
|
|
35
|
+
}
|
|
36
|
+
sessionProviderTag() {
|
|
37
|
+
return "atlas-cloud";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the OpenAI-compatible endpoint.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to the Atlas Cloud API when `memoryApiUrl` is not configured,
|
|
43
|
+
* so a minimal config only needs `memoryProvider` + `memoryApiKey`.
|
|
44
|
+
*/
|
|
45
|
+
resolveEndpoint() {
|
|
46
|
+
const base = (this.config.apiUrl || "").trim().replace(/\/+$/, "");
|
|
47
|
+
return base || ATLAS_CLOUD_API_URL;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolve the model ID to send to Atlas Cloud.
|
|
51
|
+
*
|
|
52
|
+
* Defaults to `deepseek-ai/deepseek-v4-pro` when `memoryModel` is not
|
|
53
|
+
* configured.
|
|
54
|
+
*/
|
|
55
|
+
resolveModel() {
|
|
56
|
+
const model = (this.config.model || "").trim();
|
|
57
|
+
return model || ATLAS_CLOUD_DEFAULT_MODEL;
|
|
58
|
+
}
|
|
59
|
+
}
|