@andrew.ng/symbion 0.1.0
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 +125 -0
- package/apps/daemon/dist/boot/menu.d.ts +11 -0
- package/apps/daemon/dist/boot/menu.d.ts.map +1 -0
- package/apps/daemon/dist/boot/menu.js +32 -0
- package/apps/daemon/dist/boot/menu.js.map +1 -0
- package/apps/daemon/dist/fs/folderPick.d.ts +13 -0
- package/apps/daemon/dist/fs/folderPick.d.ts.map +1 -0
- package/apps/daemon/dist/fs/folderPick.js +4 -0
- package/apps/daemon/dist/fs/folderPick.js.map +1 -0
- package/apps/daemon/dist/fs/listDir.d.ts +13 -0
- package/apps/daemon/dist/fs/listDir.d.ts.map +1 -0
- package/apps/daemon/dist/fs/listDir.js +121 -0
- package/apps/daemon/dist/fs/listDir.js.map +1 -0
- package/apps/daemon/dist/fs/readTargetFiles.d.ts +20 -0
- package/apps/daemon/dist/fs/readTargetFiles.d.ts.map +1 -0
- package/apps/daemon/dist/fs/readTargetFiles.js +76 -0
- package/apps/daemon/dist/fs/readTargetFiles.js.map +1 -0
- package/apps/daemon/dist/fs/writeFiles.d.ts +32 -0
- package/apps/daemon/dist/fs/writeFiles.d.ts.map +1 -0
- package/apps/daemon/dist/fs/writeFiles.js +93 -0
- package/apps/daemon/dist/fs/writeFiles.js.map +1 -0
- package/apps/daemon/dist/git/status.d.ts +11 -0
- package/apps/daemon/dist/git/status.d.ts.map +1 -0
- package/apps/daemon/dist/git/status.js +30 -0
- package/apps/daemon/dist/git/status.js.map +1 -0
- package/apps/daemon/dist/index.d.ts +2 -0
- package/apps/daemon/dist/index.d.ts.map +1 -0
- package/apps/daemon/dist/index.js +69 -0
- package/apps/daemon/dist/index.js.map +1 -0
- package/apps/daemon/dist/llm/anthropicProvider.d.ts +26 -0
- package/apps/daemon/dist/llm/anthropicProvider.d.ts.map +1 -0
- package/apps/daemon/dist/llm/anthropicProvider.js +90 -0
- package/apps/daemon/dist/llm/anthropicProvider.js.map +1 -0
- package/apps/daemon/dist/llm/geminiProvider.d.ts +25 -0
- package/apps/daemon/dist/llm/geminiProvider.d.ts.map +1 -0
- package/apps/daemon/dist/llm/geminiProvider.js +89 -0
- package/apps/daemon/dist/llm/geminiProvider.js.map +1 -0
- package/apps/daemon/dist/llm/installInstructions.d.ts +40 -0
- package/apps/daemon/dist/llm/installInstructions.d.ts.map +1 -0
- package/apps/daemon/dist/llm/installInstructions.js +80 -0
- package/apps/daemon/dist/llm/installInstructions.js.map +1 -0
- package/apps/daemon/dist/llm/ollamaProvider.d.ts +55 -0
- package/apps/daemon/dist/llm/ollamaProvider.d.ts.map +1 -0
- package/apps/daemon/dist/llm/ollamaProvider.js +213 -0
- package/apps/daemon/dist/llm/ollamaProvider.js.map +1 -0
- package/apps/daemon/dist/llm/openaiProvider.d.ts +25 -0
- package/apps/daemon/dist/llm/openaiProvider.d.ts.map +1 -0
- package/apps/daemon/dist/llm/openaiProvider.js +90 -0
- package/apps/daemon/dist/llm/openaiProvider.js.map +1 -0
- package/apps/daemon/dist/llm/providerStatus.d.ts +60 -0
- package/apps/daemon/dist/llm/providerStatus.d.ts.map +1 -0
- package/apps/daemon/dist/llm/providerStatus.js +88 -0
- package/apps/daemon/dist/llm/providerStatus.js.map +1 -0
- package/apps/daemon/dist/llm/registry.d.ts +14 -0
- package/apps/daemon/dist/llm/registry.d.ts.map +1 -0
- package/apps/daemon/dist/llm/registry.js +35 -0
- package/apps/daemon/dist/llm/registry.js.map +1 -0
- package/apps/daemon/dist/llm/remoteProvider.d.ts +25 -0
- package/apps/daemon/dist/llm/remoteProvider.d.ts.map +1 -0
- package/apps/daemon/dist/llm/remoteProvider.js +88 -0
- package/apps/daemon/dist/llm/remoteProvider.js.map +1 -0
- package/apps/daemon/dist/llm/secrets.d.ts +55 -0
- package/apps/daemon/dist/llm/secrets.d.ts.map +1 -0
- package/apps/daemon/dist/llm/secrets.js +167 -0
- package/apps/daemon/dist/llm/secrets.js.map +1 -0
- package/apps/daemon/dist/llm/types.d.ts +50 -0
- package/apps/daemon/dist/llm/types.d.ts.map +1 -0
- package/apps/daemon/dist/llm/types.js +16 -0
- package/apps/daemon/dist/llm/types.js.map +1 -0
- package/apps/daemon/dist/net/findOpenPort.d.ts +26 -0
- package/apps/daemon/dist/net/findOpenPort.d.ts.map +1 -0
- package/apps/daemon/dist/net/findOpenPort.js +37 -0
- package/apps/daemon/dist/net/findOpenPort.js.map +1 -0
- package/apps/daemon/dist/rpc/contract.d.ts +10 -0
- package/apps/daemon/dist/rpc/contract.d.ts.map +1 -0
- package/apps/daemon/dist/rpc/contract.js +2 -0
- package/apps/daemon/dist/rpc/contract.js.map +1 -0
- package/apps/daemon/dist/rpc/guard.d.ts +18 -0
- package/apps/daemon/dist/rpc/guard.d.ts.map +1 -0
- package/apps/daemon/dist/rpc/guard.js +75 -0
- package/apps/daemon/dist/rpc/guard.js.map +1 -0
- package/apps/daemon/dist/rpc/handlers.d.ts +118 -0
- package/apps/daemon/dist/rpc/handlers.d.ts.map +1 -0
- package/apps/daemon/dist/rpc/handlers.js +694 -0
- package/apps/daemon/dist/rpc/handlers.js.map +1 -0
- package/apps/daemon/dist/rpc/pathStyle.d.ts +27 -0
- package/apps/daemon/dist/rpc/pathStyle.d.ts.map +1 -0
- package/apps/daemon/dist/rpc/pathStyle.js +43 -0
- package/apps/daemon/dist/rpc/pathStyle.js.map +1 -0
- package/apps/daemon/dist/rpc/rpcError.d.ts +13 -0
- package/apps/daemon/dist/rpc/rpcError.d.ts.map +1 -0
- package/apps/daemon/dist/rpc/rpcError.js +16 -0
- package/apps/daemon/dist/rpc/rpcError.js.map +1 -0
- package/apps/daemon/dist/server.d.ts +18 -0
- package/apps/daemon/dist/server.d.ts.map +1 -0
- package/apps/daemon/dist/server.js +208 -0
- package/apps/daemon/dist/server.js.map +1 -0
- package/apps/daemon/dist/store/publishLog.d.ts +6 -0
- package/apps/daemon/dist/store/publishLog.d.ts.map +1 -0
- package/apps/daemon/dist/store/publishLog.js +27 -0
- package/apps/daemon/dist/store/publishLog.js.map +1 -0
- package/apps/daemon/dist/store/store.d.ts +35 -0
- package/apps/daemon/dist/store/store.d.ts.map +1 -0
- package/apps/daemon/dist/store/store.js +129 -0
- package/apps/daemon/dist/store/store.js.map +1 -0
- package/apps/daemon/dist/templates/githubFetch.d.ts +49 -0
- package/apps/daemon/dist/templates/githubFetch.d.ts.map +1 -0
- package/apps/daemon/dist/templates/githubFetch.js +168 -0
- package/apps/daemon/dist/templates/githubFetch.js.map +1 -0
- package/apps/web/out/404.html +1 -0
- package/apps/web/out/_next/static/IIw50lkv8jQuwHOBZJifS/_buildManifest.js +1 -0
- package/apps/web/out/_next/static/IIw50lkv8jQuwHOBZJifS/_ssgManifest.js +1 -0
- package/apps/web/out/_next/static/chunks/1dd3208c-6a745fea7bd2124a.js +1 -0
- package/apps/web/out/_next/static/chunks/426-deb95a16531d3b4b.js +25 -0
- package/apps/web/out/_next/static/chunks/528-6e64508688610bfe.js +2 -0
- package/apps/web/out/_next/static/chunks/656-fd1628581ad77b01.js +1 -0
- package/apps/web/out/_next/static/chunks/777-d587bc7cc0fc6be8.js +1 -0
- package/apps/web/out/_next/static/chunks/990-f2445c68c17fa077.js +1 -0
- package/apps/web/out/_next/static/chunks/app/_not-found/page-e0d77774c4eb9aef.js +1 -0
- package/apps/web/out/_next/static/chunks/app/layout-e5023aba6634ce53.js +1 -0
- package/apps/web/out/_next/static/chunks/app/page-a545c902535ac2e3.js +1 -0
- package/apps/web/out/_next/static/chunks/app/settings/page-a68ed4ae2ccb8840.js +1 -0
- package/apps/web/out/_next/static/chunks/app/templates/page-e5f0cefb905e5b72.js +1 -0
- package/apps/web/out/_next/static/chunks/baeaa4ff-28d2e32e4dd119b9.js +1 -0
- package/apps/web/out/_next/static/chunks/eb0351e1-329719bc902eaf71.js +1 -0
- package/apps/web/out/_next/static/chunks/framework-3664cab31236a9fa.js +1 -0
- package/apps/web/out/_next/static/chunks/main-app-d515c42ecb17b8e8.js +1 -0
- package/apps/web/out/_next/static/chunks/main-ff24788874d4ec1b.js +1 -0
- package/apps/web/out/_next/static/chunks/pages/_app-10a93ab5b7c32eb3.js +1 -0
- package/apps/web/out/_next/static/chunks/pages/_error-2d792b2a41857be4.js +1 -0
- package/apps/web/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/apps/web/out/_next/static/chunks/webpack-ae7ee8fe97fdceba.js +1 -0
- package/apps/web/out/_next/static/css/0a42edcfc2beb916.css +3 -0
- package/apps/web/out/_next/static/css/a275cc2b185e04f8.css +1 -0
- package/apps/web/out/_next/static/media/011e180705008d6f-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/20535187d867b7b9-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/26d4368bf94c0ec4-s.p.woff2 +0 -0
- package/apps/web/out/_next/static/media/2801417b65625cf5-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/28793f5c5e3d822d-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/5356a6a4f2c8c8d8-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/58f386aa6b1a2a92-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/73cb51aac9c97f90-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/7b19b489dc6743ba-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/7ba5fb2a8c88521c-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/92eeb95d069020cc-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/98e207f02528a563-s.p.woff2 +0 -0
- package/apps/web/out/_next/static/media/99dcf268bda04fe5-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/b3bf17a9041d9433-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/c9c3823090ec8b55-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/d26bbd13d6b70f89-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/d29838c109ef09b4-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/d3ebbfd689654d3a-s.p.woff2 +0 -0
- package/apps/web/out/_next/static/media/db96af6b531dc71f-s.p.woff2 +0 -0
- package/apps/web/out/_next/static/media/e40af3453d7c920a-s.woff2 +0 -0
- package/apps/web/out/_next/static/media/ef4d5661765d0e49-s.woff2 +0 -0
- package/apps/web/out/index.html +1 -0
- package/apps/web/out/index.txt +6 -0
- package/apps/web/out/settings.html +1 -0
- package/apps/web/out/settings.txt +6 -0
- package/apps/web/out/templates.html +1 -0
- package/apps/web/out/templates.txt +6 -0
- package/bin/symbion.mjs +41 -0
- package/node_modules/@symbion/core/dist/adapters/claude.d.ts +3 -0
- package/node_modules/@symbion/core/dist/adapters/claude.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/claude.js +43 -0
- package/node_modules/@symbion/core/dist/adapters/claude.js.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/codex.d.ts +3 -0
- package/node_modules/@symbion/core/dist/adapters/codex.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/codex.js +58 -0
- package/node_modules/@symbion/core/dist/adapters/codex.js.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/registry.d.ts +5 -0
- package/node_modules/@symbion/core/dist/adapters/registry.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/registry.js +14 -0
- package/node_modules/@symbion/core/dist/adapters/registry.js.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/types.d.ts +34 -0
- package/node_modules/@symbion/core/dist/adapters/types.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/adapters/types.js +2 -0
- package/node_modules/@symbion/core/dist/adapters/types.js.map +1 -0
- package/node_modules/@symbion/core/dist/diff/conflict.d.ts +19 -0
- package/node_modules/@symbion/core/dist/diff/conflict.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/diff/conflict.js +20 -0
- package/node_modules/@symbion/core/dist/diff/conflict.js.map +1 -0
- package/node_modules/@symbion/core/dist/diff/diff.d.ts +44 -0
- package/node_modules/@symbion/core/dist/diff/diff.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/diff/diff.js +124 -0
- package/node_modules/@symbion/core/dist/diff/diff.js.map +1 -0
- package/node_modules/@symbion/core/dist/generate/bodyPrompt.d.ts +27 -0
- package/node_modules/@symbion/core/dist/generate/bodyPrompt.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/generate/bodyPrompt.js +55 -0
- package/node_modules/@symbion/core/dist/generate/bodyPrompt.js.map +1 -0
- package/node_modules/@symbion/core/dist/generate/description.d.ts +18 -0
- package/node_modules/@symbion/core/dist/generate/description.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/generate/description.js +164 -0
- package/node_modules/@symbion/core/dist/generate/description.js.map +1 -0
- package/node_modules/@symbion/core/dist/index.d.ts +23 -0
- package/node_modules/@symbion/core/dist/index.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/index.js +24 -0
- package/node_modules/@symbion/core/dist/index.js.map +1 -0
- package/node_modules/@symbion/core/dist/ir/refs.d.ts +11 -0
- package/node_modules/@symbion/core/dist/ir/refs.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/ir/refs.js +25 -0
- package/node_modules/@symbion/core/dist/ir/refs.js.map +1 -0
- package/node_modules/@symbion/core/dist/ir/types.d.ts +107 -0
- package/node_modules/@symbion/core/dist/ir/types.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/ir/types.js +19 -0
- package/node_modules/@symbion/core/dist/ir/types.js.map +1 -0
- package/node_modules/@symbion/core/dist/ir/validate.d.ts +13 -0
- package/node_modules/@symbion/core/dist/ir/validate.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/ir/validate.js +114 -0
- package/node_modules/@symbion/core/dist/ir/validate.js.map +1 -0
- package/node_modules/@symbion/core/dist/parse/scan.d.ts +47 -0
- package/node_modules/@symbion/core/dist/parse/scan.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/parse/scan.js +109 -0
- package/node_modules/@symbion/core/dist/parse/scan.js.map +1 -0
- package/node_modules/@symbion/core/dist/render/frontmatter.d.ts +29 -0
- package/node_modules/@symbion/core/dist/render/frontmatter.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/render/frontmatter.js +99 -0
- package/node_modules/@symbion/core/dist/render/frontmatter.js.map +1 -0
- package/node_modules/@symbion/core/dist/render/marker.d.ts +30 -0
- package/node_modules/@symbion/core/dist/render/marker.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/render/marker.js +48 -0
- package/node_modules/@symbion/core/dist/render/marker.js.map +1 -0
- package/node_modules/@symbion/core/dist/render/render.d.ts +12 -0
- package/node_modules/@symbion/core/dist/render/render.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/render/render.js +10 -0
- package/node_modules/@symbion/core/dist/render/render.js.map +1 -0
- package/node_modules/@symbion/core/dist/runcommand/render.d.ts +13 -0
- package/node_modules/@symbion/core/dist/runcommand/render.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/runcommand/render.js +19 -0
- package/node_modules/@symbion/core/dist/runcommand/render.js.map +1 -0
- package/node_modules/@symbion/core/dist/templates/authorSource.d.ts +55 -0
- package/node_modules/@symbion/core/dist/templates/authorSource.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/templates/authorSource.js +24 -0
- package/node_modules/@symbion/core/dist/templates/authorSource.js.map +1 -0
- package/node_modules/@symbion/core/dist/templates/matchAuthorFolders.d.ts +28 -0
- package/node_modules/@symbion/core/dist/templates/matchAuthorFolders.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/templates/matchAuthorFolders.js +54 -0
- package/node_modules/@symbion/core/dist/templates/matchAuthorFolders.js.map +1 -0
- package/node_modules/@symbion/core/dist/templates/parseTemplate.d.ts +42 -0
- package/node_modules/@symbion/core/dist/templates/parseTemplate.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/templates/parseTemplate.js +56 -0
- package/node_modules/@symbion/core/dist/templates/parseTemplate.js.map +1 -0
- package/node_modules/@symbion/core/dist/templates/templateListItem.d.ts +39 -0
- package/node_modules/@symbion/core/dist/templates/templateListItem.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/templates/templateListItem.js +2 -0
- package/node_modules/@symbion/core/dist/templates/templateListItem.js.map +1 -0
- package/node_modules/@symbion/core/dist/util/sha256.d.ts +9 -0
- package/node_modules/@symbion/core/dist/util/sha256.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/util/sha256.js +91 -0
- package/node_modules/@symbion/core/dist/util/sha256.js.map +1 -0
- package/node_modules/@symbion/core/dist/version/semver.d.ts +18 -0
- package/node_modules/@symbion/core/dist/version/semver.d.ts.map +1 -0
- package/node_modules/@symbion/core/dist/version/semver.js +53 -0
- package/node_modules/@symbion/core/dist/version/semver.js.map +1 -0
- package/node_modules/@symbion/core/package.json +14 -0
- package/node_modules/@symbion/rpc-types/dist/index.d.ts +444 -0
- package/node_modules/@symbion/rpc-types/dist/index.d.ts.map +1 -0
- package/node_modules/@symbion/rpc-types/dist/index.js +2 -0
- package/node_modules/@symbion/rpc-types/dist/index.js.map +1 -0
- package/node_modules/@symbion/rpc-types/package.json +11 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +20 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +39 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OllamaProvider — calls a local Ollama instance over HTTP using Node's native
|
|
3
|
+
* fetch + AbortController. No API key. The v1 default provider (STATE §9).
|
|
4
|
+
*
|
|
5
|
+
* listModels() queries the real local Ollama's `GET /api/tags` per
|
|
6
|
+
* docs/loops/ollama-dynamic-models-STATE.md §6.2 — the old hardcoded 3-entry
|
|
7
|
+
* placeholder constant has been removed entirely (no fallback to it on any
|
|
8
|
+
* failure path, per that STATE's §3 "never silently fail" constraint).
|
|
9
|
+
*/
|
|
10
|
+
import { LlmError } from "./types.js";
|
|
11
|
+
export const OLLAMA_DEFAULT_BASE_URL = "http://127.0.0.1:11434";
|
|
12
|
+
/** Same 3000ms convention as `checkOllamaReachable` (providerStatus.ts) — this is a
|
|
13
|
+
* cheap "what's there" probe, not a generate() call, per STATE §6.1/§6.2. */
|
|
14
|
+
const OLLAMA_LIST_MODELS_TIMEOUT_MS = 3000;
|
|
15
|
+
/** Matches a parameter-count hint at the end of an Ollama tag, e.g. "8b", "1b", "70b",
|
|
16
|
+
* "3.8b", "0.5b" — case-insensitive. Per STATE §6.3. */
|
|
17
|
+
const PARAM_SIZE_RE = /(\d+(?:\.\d+)?)\s*b\b/i;
|
|
18
|
+
/**
|
|
19
|
+
* inferTierFromTag — infers a coarse speed/capability tier from an Ollama tag's
|
|
20
|
+
* parameter-count hint when one is confidently parseable; otherwise returns
|
|
21
|
+
* `undefined` rather than guessing (STATE §6.3 — "omit tier" over "invent a default").
|
|
22
|
+
* Thresholds: <=3b fast, <=13b balanced, >13b best.
|
|
23
|
+
*/
|
|
24
|
+
function inferTierFromTag(tag) {
|
|
25
|
+
const match = tag.match(PARAM_SIZE_RE);
|
|
26
|
+
if (!match)
|
|
27
|
+
return undefined;
|
|
28
|
+
const billions = parseFloat(match[1]);
|
|
29
|
+
if (Number.isNaN(billions))
|
|
30
|
+
return undefined;
|
|
31
|
+
if (billions <= 3)
|
|
32
|
+
return "fast";
|
|
33
|
+
if (billions <= 13)
|
|
34
|
+
return "balanced";
|
|
35
|
+
return "best";
|
|
36
|
+
}
|
|
37
|
+
/** Maps a raw Ollama tag string (e.g. "llama3.1:8b") to an `LlmModelOption` — label is
|
|
38
|
+
* the raw tag itself (no attempt at vendor-name prettification, STATE §6.3). */
|
|
39
|
+
function ollamaTagToModelOption(tag) {
|
|
40
|
+
return { id: tag, label: tag, tier: inferTierFromTag(tag) };
|
|
41
|
+
}
|
|
42
|
+
const LOOPBACK_HOSTNAMES = new Set(["127.0.0.1", "localhost", "::1"]);
|
|
43
|
+
/**
|
|
44
|
+
* isLoopbackUrl — true iff `value` parses as a URL whose hostname is one of
|
|
45
|
+
* 127.0.0.1 / localhost / ::1 (case-insensitive). Used to confine the
|
|
46
|
+
* env-var-sourced Ollama base URL to loopback only, since that path is
|
|
47
|
+
* influenceable by anything that can set the daemon process's environment
|
|
48
|
+
* (see docs/loops/auto-generate-body-STATE.md §13 — SSRF finding).
|
|
49
|
+
*/
|
|
50
|
+
function isLoopbackUrl(value) {
|
|
51
|
+
try {
|
|
52
|
+
const url = new URL(value);
|
|
53
|
+
const hostname = url.hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
54
|
+
return LOOPBACK_HOSTNAMES.has(hostname);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* resolveOllamaBaseUrl — the env-var/loopback-guard/default resolution logic that used to
|
|
62
|
+
* live inline in `OllamaProvider`'s constructor (extracted per
|
|
63
|
+
* docs/loops/connect-providers-STATE.md §10.3, a structure-only refactor, no behavior
|
|
64
|
+
* change). Exported so `providerStatus.ts`'s reachability check reuses the exact same
|
|
65
|
+
* SSRF-guarded resolution instead of re-implementing it — one implementation, not two.
|
|
66
|
+
*
|
|
67
|
+
* Throws `LlmError("provider-not-running", ...)` if `SYMBION_OLLAMA_BASE_URL` is set to a
|
|
68
|
+
* non-loopback host (see `isLoopbackUrl` doc comment for the threat this guards against).
|
|
69
|
+
*/
|
|
70
|
+
export function resolveOllamaBaseUrl() {
|
|
71
|
+
// Env override (SYMBION_OLLAMA_BASE_URL) lets tests/dev tooling point this at a fake
|
|
72
|
+
// server without needing to thread a constructor param through the registry factory.
|
|
73
|
+
// Because this path is influenceable by anything that can set the daemon process's
|
|
74
|
+
// environment (poisoned .env, malicious postinstall, misconfigured deploy), it MUST be
|
|
75
|
+
// restricted to loopback hosts — never silently fall back to OLLAMA_DEFAULT_BASE_URL,
|
|
76
|
+
// since that would mask a misconfiguration as "everything's fine, just using localhost."
|
|
77
|
+
const envBaseUrl = process.env["SYMBION_OLLAMA_BASE_URL"];
|
|
78
|
+
if (envBaseUrl !== undefined) {
|
|
79
|
+
if (!isLoopbackUrl(envBaseUrl)) {
|
|
80
|
+
throw new LlmError("provider-not-running", `SYMBION_OLLAMA_BASE_URL phải là một địa chỉ loopback (127.0.0.1/localhost/::1); giá trị hiện tại không hợp lệ và bị từ chối: "${envBaseUrl}".`);
|
|
81
|
+
}
|
|
82
|
+
return envBaseUrl;
|
|
83
|
+
}
|
|
84
|
+
return OLLAMA_DEFAULT_BASE_URL;
|
|
85
|
+
}
|
|
86
|
+
export class OllamaProvider {
|
|
87
|
+
id = "ollama";
|
|
88
|
+
baseUrl;
|
|
89
|
+
constructor(opts = {}) {
|
|
90
|
+
// An explicit constructor `baseUrl` (only ever set by trusted code, e.g. test
|
|
91
|
+
// fixtures) always wins and is NOT subject to the loopback check below — it is
|
|
92
|
+
// not reachable by an external actor.
|
|
93
|
+
if (opts.baseUrl !== undefined) {
|
|
94
|
+
this.baseUrl = opts.baseUrl;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.baseUrl = resolveOllamaBaseUrl();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* listModels — queries Ollama's real `GET /api/tags` (per
|
|
101
|
+
* docs/loops/ollama-dynamic-models-STATE.md §6.2), bounded by a 3000ms
|
|
102
|
+
* AbortController timeout (same convention as `checkOllamaReachable`). Uses
|
|
103
|
+
* `this.baseUrl`, already resolved through the SAME loopback-guarded
|
|
104
|
+
* `resolveOllamaBaseUrl()` the constructor uses — no second SSRF-guard
|
|
105
|
+
* implementation.
|
|
106
|
+
*
|
|
107
|
+
* Error mapping:
|
|
108
|
+
* - connection-refused / DNS failure / our own abort-on-timeout all collapse to
|
|
109
|
+
* `LlmError("provider-not-running", ...)` — both mean "ModelPicker cannot get a
|
|
110
|
+
* model list from Ollama right now," and AC4 only requires the existing
|
|
111
|
+
* "unreachable" shape be unregressed, not a distinct timeout code (STATE §9.1).
|
|
112
|
+
* - non-2xx HTTP status -> `LlmError("invalid-response", ...)`.
|
|
113
|
+
* - non-JSON body -> `LlmError("invalid-response", ...)`.
|
|
114
|
+
* - missing/wrong-type `models` field on an otherwise-200 response ->
|
|
115
|
+
* `LlmError("invalid-response", ...)` — distinct from "genuinely zero models,"
|
|
116
|
+
* which is a well-formed `{ models: [] }` that resolves normally (empty array,
|
|
117
|
+
* no throw) per STATE §3's "never silently fail ... not an empty array
|
|
118
|
+
* indistinguishable from genuinely zero" constraint.
|
|
119
|
+
*/
|
|
120
|
+
async listModels() {
|
|
121
|
+
const controller = new AbortController();
|
|
122
|
+
const timer = setTimeout(() => controller.abort(), OLLAMA_LIST_MODELS_TIMEOUT_MS);
|
|
123
|
+
try {
|
|
124
|
+
let res;
|
|
125
|
+
try {
|
|
126
|
+
res = await fetch(`${this.baseUrl}/api/tags`, { signal: controller.signal });
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
throw new LlmError("provider-not-running", "Không thể kết nối tới Ollama — đảm bảo Ollama đang chạy trên máy.");
|
|
130
|
+
}
|
|
131
|
+
if (!res.ok) {
|
|
132
|
+
throw new LlmError("invalid-response", `Ollama trả về lỗi HTTP ${res.status} khi lấy danh sách mô hình.`);
|
|
133
|
+
}
|
|
134
|
+
let json;
|
|
135
|
+
try {
|
|
136
|
+
json = (await res.json());
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ Ollama (không phải JSON) khi lấy danh sách mô hình.");
|
|
140
|
+
}
|
|
141
|
+
if (!Array.isArray(json.models)) {
|
|
142
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ Ollama (thiếu trường models) khi lấy danh sách mô hình.");
|
|
143
|
+
}
|
|
144
|
+
return json.models
|
|
145
|
+
.map((m) => m.name ?? m.model)
|
|
146
|
+
.filter((name) => typeof name === "string" && name.length > 0)
|
|
147
|
+
.map(ollamaTagToModelOption);
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
clearTimeout(timer);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async generate(req) {
|
|
154
|
+
const controller = new AbortController();
|
|
155
|
+
const timer = setTimeout(() => controller.abort(), req.timeoutMs);
|
|
156
|
+
try {
|
|
157
|
+
let res;
|
|
158
|
+
try {
|
|
159
|
+
res = await fetch(`${this.baseUrl}/api/generate`, {
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers: { "Content-Type": "application/json" },
|
|
162
|
+
body: JSON.stringify({
|
|
163
|
+
model: req.model,
|
|
164
|
+
prompt: req.userPrompt,
|
|
165
|
+
system: req.systemPrompt,
|
|
166
|
+
stream: false,
|
|
167
|
+
// Important for Qwen3 reasoning models:
|
|
168
|
+
// prevents long thinking output that can exceed Symbion's timeout.
|
|
169
|
+
think: false,
|
|
170
|
+
// Keep generation bounded for paraphrase / short text rewrite use cases.
|
|
171
|
+
// Nhanh, ngắn, ổn định — hợp cho UI form/autofill
|
|
172
|
+
options: {
|
|
173
|
+
num_ctx: 2048, //size of context window
|
|
174
|
+
num_predict: 256, //maximum number of tokens to predict when generating text
|
|
175
|
+
temperature: 0.5, //creative level
|
|
176
|
+
},
|
|
177
|
+
// Keeps the model warm after the first request.
|
|
178
|
+
keep_alive: "10m",
|
|
179
|
+
}),
|
|
180
|
+
signal: controller.signal,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
if (controller.signal.aborted) {
|
|
185
|
+
throw new LlmError("timeout", `Quá thời gian chờ (${req.timeoutMs}ms) khi gọi Ollama.`);
|
|
186
|
+
}
|
|
187
|
+
throw new LlmError("provider-not-running", "Không thể kết nối tới Ollama — đảm bảo Ollama đang chạy trên máy.");
|
|
188
|
+
}
|
|
189
|
+
if (res.status === 404) {
|
|
190
|
+
throw new LlmError("invalid-response", `Mô hình "${req.model}" không tồn tại trên Ollama (404).`);
|
|
191
|
+
}
|
|
192
|
+
if (!res.ok) {
|
|
193
|
+
const text = await res.text().catch(() => "");
|
|
194
|
+
throw new LlmError("invalid-response", `Ollama trả về lỗi HTTP ${res.status}${text ? `: ${text}` : "."}`);
|
|
195
|
+
}
|
|
196
|
+
let json;
|
|
197
|
+
try {
|
|
198
|
+
json = (await res.json());
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ Ollama (không phải JSON).");
|
|
202
|
+
}
|
|
203
|
+
if (typeof json.response !== "string") {
|
|
204
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ Ollama (thiếu trường response).");
|
|
205
|
+
}
|
|
206
|
+
return { text: json.response };
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
clearTimeout(timer);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=ollamaProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ollamaProvider.js","sourceRoot":"","sources":["../../src/llm/ollamaProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAA0F,MAAM,YAAY,CAAC;AAE9H,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAEhE;8EAC8E;AAC9E,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAE3C;yDACyD;AACzD,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAE/C;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IACjC,IAAI,QAAQ,IAAI,EAAE;QAAE,OAAO,UAAU,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;iFACiF;AACjF,SAAS,sBAAsB,CAAC,GAAW;IACzC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAA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H,CAAC;CAEF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAiProvider — LlmProvider implementation for OpenAI, per
|
|
3
|
+
* docs/loops/multi-provider-settings-STATE.md §3.2. Reads its API key from
|
|
4
|
+
* the secrets store (apps/daemon/src/llm/secrets.ts) at construction time —
|
|
5
|
+
* never from process.env, never persisted by this class. Calls the
|
|
6
|
+
* `/v1/chat/completions` endpoint with `Authorization: Bearer <key>` (dev's
|
|
7
|
+
* call on exact endpoint per STATE §3.2 — not an architecture decision).
|
|
8
|
+
*
|
|
9
|
+
* Model ids below are placeholder/dev-time content decisions (same framing
|
|
10
|
+
* as ollamaProvider.ts's model list) — Checker should independently verify
|
|
11
|
+
* these are reasonable current OpenAI model ids at review time.
|
|
12
|
+
*/
|
|
13
|
+
import { type LlmGenerateRequest, type LlmGenerateResult, type LlmModelOption, type LlmProvider } from "./types.js";
|
|
14
|
+
export interface OpenAiProviderOptions {
|
|
15
|
+
/** injectable for tests; defaults to the real OpenAI chat-completions endpoint. */
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class OpenAiProvider implements LlmProvider {
|
|
19
|
+
readonly id: "openai";
|
|
20
|
+
private readonly baseUrl;
|
|
21
|
+
constructor(opts?: OpenAiProviderOptions);
|
|
22
|
+
listModels(): Promise<LlmModelOption[]>;
|
|
23
|
+
generate(req: LlmGenerateRequest): Promise<LlmGenerateResult>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=openaiProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openaiProvider.d.ts","sourceRoot":"","sources":["../../src/llm/openaiProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAY,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAW9H,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,IAAI,GAAE,qBAA0B;IAItC,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIvC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8DpE"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAiProvider — LlmProvider implementation for OpenAI, per
|
|
3
|
+
* docs/loops/multi-provider-settings-STATE.md §3.2. Reads its API key from
|
|
4
|
+
* the secrets store (apps/daemon/src/llm/secrets.ts) at construction time —
|
|
5
|
+
* never from process.env, never persisted by this class. Calls the
|
|
6
|
+
* `/v1/chat/completions` endpoint with `Authorization: Bearer <key>` (dev's
|
|
7
|
+
* call on exact endpoint per STATE §3.2 — not an architecture decision).
|
|
8
|
+
*
|
|
9
|
+
* Model ids below are placeholder/dev-time content decisions (same framing
|
|
10
|
+
* as ollamaProvider.ts's model list) — Checker should independently verify
|
|
11
|
+
* these are reasonable current OpenAI model ids at review time.
|
|
12
|
+
*/
|
|
13
|
+
import { LlmError } from "./types.js";
|
|
14
|
+
import { loadProvidersConfig } from "./secrets.js";
|
|
15
|
+
const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1/chat/completions";
|
|
16
|
+
const OPENAI_MODELS = [
|
|
17
|
+
{ id: "gpt-4o-mini", label: "GPT-4o mini (nhanh)", tier: "fast" },
|
|
18
|
+
{ id: "gpt-4o", label: "GPT-4o (cân bằng)", tier: "balanced" },
|
|
19
|
+
{ id: "gpt-4.1", label: "GPT-4.1 (tốt nhất)", tier: "best" },
|
|
20
|
+
];
|
|
21
|
+
export class OpenAiProvider {
|
|
22
|
+
id = "openai";
|
|
23
|
+
baseUrl;
|
|
24
|
+
constructor(opts = {}) {
|
|
25
|
+
this.baseUrl = opts.baseUrl ?? OPENAI_DEFAULT_BASE_URL;
|
|
26
|
+
}
|
|
27
|
+
async listModels() {
|
|
28
|
+
return OPENAI_MODELS;
|
|
29
|
+
}
|
|
30
|
+
async generate(req) {
|
|
31
|
+
const apiKey = loadProvidersConfig().providers.openai?.apiKey;
|
|
32
|
+
if (!apiKey) {
|
|
33
|
+
throw new LlmError("not-configured", "Chưa cấu hình API key cho OpenAI.");
|
|
34
|
+
}
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => controller.abort(), req.timeoutMs);
|
|
37
|
+
try {
|
|
38
|
+
let res;
|
|
39
|
+
try {
|
|
40
|
+
res = await fetch(this.baseUrl, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
Authorization: `Bearer ${apiKey}`,
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
model: req.model,
|
|
48
|
+
messages: [
|
|
49
|
+
{ role: "system", content: req.systemPrompt },
|
|
50
|
+
{ role: "user", content: req.userPrompt },
|
|
51
|
+
],
|
|
52
|
+
...(req.maxTokens != null ? { max_tokens: req.maxTokens } : {}),
|
|
53
|
+
}),
|
|
54
|
+
signal: controller.signal,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
if (controller.signal.aborted) {
|
|
59
|
+
throw new LlmError("timeout", `Quá thời gian chờ (${req.timeoutMs}ms) khi gọi OpenAI.`);
|
|
60
|
+
}
|
|
61
|
+
throw new LlmError("network", "Lỗi mạng khi gọi OpenAI.");
|
|
62
|
+
}
|
|
63
|
+
if (res.status === 401 || res.status === 403) {
|
|
64
|
+
throw new LlmError("auth", "Thiếu hoặc sai cấu hình API key cho OpenAI.");
|
|
65
|
+
}
|
|
66
|
+
if (res.status === 429) {
|
|
67
|
+
throw new LlmError("rate-limit", "Bị giới hạn tần suất gọi — thử lại sau.");
|
|
68
|
+
}
|
|
69
|
+
if (!res.ok) {
|
|
70
|
+
throw new LlmError("invalid-response", `OpenAI trả về lỗi HTTP ${res.status}.`);
|
|
71
|
+
}
|
|
72
|
+
let json;
|
|
73
|
+
try {
|
|
74
|
+
json = (await res.json());
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ OpenAI (không phải JSON).");
|
|
78
|
+
}
|
|
79
|
+
const text = json.choices?.[0]?.message?.content;
|
|
80
|
+
if (typeof text !== "string") {
|
|
81
|
+
throw new LlmError("invalid-response", "Phản hồi không hợp lệ từ OpenAI.");
|
|
82
|
+
}
|
|
83
|
+
return { text };
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=openaiProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openaiProvider.js","sourceRoot":"","sources":["../../src/llm/openaiProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAA0F,MAAM,YAAY,CAAC;AAC9H,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,uBAAuB,GAAG,4CAA4C,CAAC;AAE7E,MAAM,aAAa,GAAqB;IACtC,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,EAAE;IACjE,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE;IAC9D,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE;CAC7D,CAAC;AAOF,MAAM,OAAO,cAAc;IAChB,EAAE,GAAG,QA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AE,IAAI,EAAE,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* providerStatus — lightweight reachability checks backing the
|
|
3
|
+
* `checkProviderStatus` RPC. Ollama path (docs/loops/connect-providers-STATE.md
|
|
4
|
+
* §10.3) is unchanged: deliberately does NOT go through
|
|
5
|
+
* `getProvider("ollama")`/`OllamaProvider.generate()` — a real `generate()` call loads a
|
|
6
|
+
* model and can take seconds-to-minutes, the wrong shape for "is anything listening."
|
|
7
|
+
* Instead: a single `GET {baseUrl}/` with a short AbortController timeout.
|
|
8
|
+
*
|
|
9
|
+
* Reuses `resolveOllamaBaseUrl()` exported from `ollamaProvider.ts` — the same
|
|
10
|
+
* env-var/loopback-guarded resolution `OllamaProvider`'s constructor uses — so the
|
|
11
|
+
* SSRF/loopback discipline has exactly one implementation, not two independently
|
|
12
|
+
* maintained copies.
|
|
13
|
+
*
|
|
14
|
+
* `checkApiKeyProviderReachable` (new, docs/loops/multi-provider-settings-STATE.md §3.2/§4b)
|
|
15
|
+
* is the sibling check for the 3 api-key-kind providers: ONE cheap authenticated call
|
|
16
|
+
* (reuses `listModels()`'s static list plus a minimal authenticated POST — same
|
|
17
|
+
* "generate" call shape but with a tiny prompt/short token budget, since none of the 3
|
|
18
|
+
* vendors' SDKs expose a free no-op auth-check endpoint that doesn't also require picking
|
|
19
|
+
* SOME model id; dev's call on exact endpoint per provider, not an architecture decision),
|
|
20
|
+
* mapped through the same LlmErrorCode taxonomy generate() already uses.
|
|
21
|
+
*/
|
|
22
|
+
import { resolveOllamaBaseUrl } from "./ollamaProvider.js";
|
|
23
|
+
import { type LlmErrorCode, type LlmProvider } from "./types.js";
|
|
24
|
+
export { resolveOllamaBaseUrl as resolveOllamaBaseUrlForStatusCheck };
|
|
25
|
+
/**
|
|
26
|
+
* checkOllamaReachable — resolves `true` if `GET {baseUrl}/` returns ANY HTTP response
|
|
27
|
+
* (200, 404, whatever — Ollama responding at all to the root path proves a process is
|
|
28
|
+
* listening and speaking HTTP, which is the only claim this check makes; NOT gated on
|
|
29
|
+
* status===200 specifically, since that risks a false "not reachable" if Ollama's
|
|
30
|
+
* root-path response shape changes across versions).
|
|
31
|
+
*
|
|
32
|
+
* Resolves `false` (never throws) on connection-refused, DNS failure, abort/timeout, or
|
|
33
|
+
* any other fetch rejection — a not-running/unreachable provider is an expected steady
|
|
34
|
+
* state for this check, not an exceptional one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkOllamaReachable(baseUrl: string, timeoutMs: number): Promise<boolean>;
|
|
37
|
+
export interface ApiKeyProviderReachability {
|
|
38
|
+
reachable: boolean;
|
|
39
|
+
errorCode?: LlmErrorCode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* checkApiKeyProviderReachable — performs ONE cheap authenticated call against
|
|
43
|
+
* an already-constructed api-key-kind LlmProvider (the caller is responsible
|
|
44
|
+
* for first checking secrets.ts has a key for that provider — see handlers.ts's
|
|
45
|
+
* `checkProviderStatus`, which short-circuits to `not-configured` WITHOUT
|
|
46
|
+
* calling this function at all when no key is stored, per STATE §4b step 3a).
|
|
47
|
+
*
|
|
48
|
+
* Uses the provider's own `generate()` with a minimal prompt and the first
|
|
49
|
+
* model from its `listModels()` — the smallest "real" authenticated call
|
|
50
|
+
* every adapter already implements, instead of duplicating bespoke
|
|
51
|
+
* ping/list-models HTTP logic per vendor. Maps the outcome through the exact
|
|
52
|
+
* same LlmErrorCode taxonomy generate() already uses; never throws.
|
|
53
|
+
*
|
|
54
|
+
* `maxTokens: 1` caps output cost — this call only needs to observe whether
|
|
55
|
+
* the request was accepted (auth/billing valid), not read the response text,
|
|
56
|
+
* per the cost-risk finding raised in `/review` (a 401/403 check call should
|
|
57
|
+
* not risk burning a full generate-call's worth of output tokens).
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkApiKeyProviderReachable(provider: LlmProvider, timeoutMs: number): Promise<ApiKeyProviderReachability>;
|
|
60
|
+
//# sourceMappingURL=providerStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerStatus.d.ts","sourceRoot":"","sources":["../../src/llm/providerStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAY,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,OAAO,EAAE,oBAAoB,IAAI,kCAAkC,EAAE,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAW/F;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,0BAA0B,CAAC,CAkBrC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* providerStatus — lightweight reachability checks backing the
|
|
3
|
+
* `checkProviderStatus` RPC. Ollama path (docs/loops/connect-providers-STATE.md
|
|
4
|
+
* §10.3) is unchanged: deliberately does NOT go through
|
|
5
|
+
* `getProvider("ollama")`/`OllamaProvider.generate()` — a real `generate()` call loads a
|
|
6
|
+
* model and can take seconds-to-minutes, the wrong shape for "is anything listening."
|
|
7
|
+
* Instead: a single `GET {baseUrl}/` with a short AbortController timeout.
|
|
8
|
+
*
|
|
9
|
+
* Reuses `resolveOllamaBaseUrl()` exported from `ollamaProvider.ts` — the same
|
|
10
|
+
* env-var/loopback-guarded resolution `OllamaProvider`'s constructor uses — so the
|
|
11
|
+
* SSRF/loopback discipline has exactly one implementation, not two independently
|
|
12
|
+
* maintained copies.
|
|
13
|
+
*
|
|
14
|
+
* `checkApiKeyProviderReachable` (new, docs/loops/multi-provider-settings-STATE.md §3.2/§4b)
|
|
15
|
+
* is the sibling check for the 3 api-key-kind providers: ONE cheap authenticated call
|
|
16
|
+
* (reuses `listModels()`'s static list plus a minimal authenticated POST — same
|
|
17
|
+
* "generate" call shape but with a tiny prompt/short token budget, since none of the 3
|
|
18
|
+
* vendors' SDKs expose a free no-op auth-check endpoint that doesn't also require picking
|
|
19
|
+
* SOME model id; dev's call on exact endpoint per provider, not an architecture decision),
|
|
20
|
+
* mapped through the same LlmErrorCode taxonomy generate() already uses.
|
|
21
|
+
*/
|
|
22
|
+
import { resolveOllamaBaseUrl } from "./ollamaProvider.js";
|
|
23
|
+
import { LlmError } from "./types.js";
|
|
24
|
+
export { resolveOllamaBaseUrl as resolveOllamaBaseUrlForStatusCheck };
|
|
25
|
+
/**
|
|
26
|
+
* checkOllamaReachable — resolves `true` if `GET {baseUrl}/` returns ANY HTTP response
|
|
27
|
+
* (200, 404, whatever — Ollama responding at all to the root path proves a process is
|
|
28
|
+
* listening and speaking HTTP, which is the only claim this check makes; NOT gated on
|
|
29
|
+
* status===200 specifically, since that risks a false "not reachable" if Ollama's
|
|
30
|
+
* root-path response shape changes across versions).
|
|
31
|
+
*
|
|
32
|
+
* Resolves `false` (never throws) on connection-refused, DNS failure, abort/timeout, or
|
|
33
|
+
* any other fetch rejection — a not-running/unreachable provider is an expected steady
|
|
34
|
+
* state for this check, not an exceptional one.
|
|
35
|
+
*/
|
|
36
|
+
export async function checkOllamaReachable(baseUrl, timeoutMs) {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
39
|
+
try {
|
|
40
|
+
await fetch(`${baseUrl}/`, { signal: controller.signal });
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* checkApiKeyProviderReachable — performs ONE cheap authenticated call against
|
|
52
|
+
* an already-constructed api-key-kind LlmProvider (the caller is responsible
|
|
53
|
+
* for first checking secrets.ts has a key for that provider — see handlers.ts's
|
|
54
|
+
* `checkProviderStatus`, which short-circuits to `not-configured` WITHOUT
|
|
55
|
+
* calling this function at all when no key is stored, per STATE §4b step 3a).
|
|
56
|
+
*
|
|
57
|
+
* Uses the provider's own `generate()` with a minimal prompt and the first
|
|
58
|
+
* model from its `listModels()` — the smallest "real" authenticated call
|
|
59
|
+
* every adapter already implements, instead of duplicating bespoke
|
|
60
|
+
* ping/list-models HTTP logic per vendor. Maps the outcome through the exact
|
|
61
|
+
* same LlmErrorCode taxonomy generate() already uses; never throws.
|
|
62
|
+
*
|
|
63
|
+
* `maxTokens: 1` caps output cost — this call only needs to observe whether
|
|
64
|
+
* the request was accepted (auth/billing valid), not read the response text,
|
|
65
|
+
* per the cost-risk finding raised in `/review` (a 401/403 check call should
|
|
66
|
+
* not risk burning a full generate-call's worth of output tokens).
|
|
67
|
+
*/
|
|
68
|
+
export async function checkApiKeyProviderReachable(provider, timeoutMs) {
|
|
69
|
+
const models = await provider.listModels();
|
|
70
|
+
const modelId = models[0]?.id ?? "";
|
|
71
|
+
try {
|
|
72
|
+
await provider.generate({
|
|
73
|
+
systemPrompt: "ping",
|
|
74
|
+
userPrompt: "ping",
|
|
75
|
+
model: modelId,
|
|
76
|
+
timeoutMs,
|
|
77
|
+
maxTokens: 1,
|
|
78
|
+
});
|
|
79
|
+
return { reachable: true };
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err instanceof LlmError) {
|
|
83
|
+
return { reachable: false, errorCode: err.code };
|
|
84
|
+
}
|
|
85
|
+
return { reachable: false, errorCode: "unknown" };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=providerStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerStatus.js","sourceRoot":"","sources":["../../src/llm/providerStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAuC,MAAM,YAAY,CAAC;AAE3E,OAAO,EAAE,oBAAoB,IAAI,kCAAkC,EAAE,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IAC3E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAAqB,EACrB,SAAiB;IAEjB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,QAAQ,CAAC;YACtB,YAAY,EAAE,MAAM;YACpB,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,OAAO;YACd,SAAS;YACT,SAAS,EAAE,CAAC;SACb,CAAC,CAAC;QACH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QACnD,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LlmProvider } from "./types.js";
|
|
2
|
+
export interface ProviderDescriptorInternal {
|
|
3
|
+
id: LlmProvider["id"];
|
|
4
|
+
label: string;
|
|
5
|
+
kind: "local" | "api-key";
|
|
6
|
+
factory: () => LlmProvider;
|
|
7
|
+
}
|
|
8
|
+
export declare function getProvider(id: LlmProvider["id"]): LlmProvider;
|
|
9
|
+
export declare function listProviderDescriptors(): Array<{
|
|
10
|
+
id: LlmProvider["id"];
|
|
11
|
+
label: string;
|
|
12
|
+
kind: "local" | "api-key";
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/llm/registry.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,WAAW,CAAC;CAC5B;AASD,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,CAM9D;AAED,wBAAgB,uBAAuB,IAAI,KAAK,CAAC;IAAE,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC,CAEpH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getProvider — registry-driven factory resolving a provider id to its
|
|
3
|
+
* LlmProvider implementation. Generalized per
|
|
4
|
+
* docs/loops/multi-provider-settings-STATE.md §3.2/§3.4: a descriptor array
|
|
5
|
+
* replaces the hardcoded switch so `listProviders` (RPC) and the registry
|
|
6
|
+
* share one source of truth for id/label/kind metadata.
|
|
7
|
+
*
|
|
8
|
+
* Each api-key-kind provider's constructor calls secrets.ts's
|
|
9
|
+
* loadProvidersConfig() internally to read its own key/model at construction
|
|
10
|
+
* time (mirrors OllamaProvider's existing "resolve config in the
|
|
11
|
+
* constructor" pattern) — getProvider() itself stays a pure id->instance
|
|
12
|
+
* lookup with no secrets-file knowledge, keeping the registry/secrets
|
|
13
|
+
* responsibilities separated.
|
|
14
|
+
*/
|
|
15
|
+
import { OllamaProvider } from "./ollamaProvider.js";
|
|
16
|
+
import { OpenAiProvider } from "./openaiProvider.js";
|
|
17
|
+
import { AnthropicProvider } from "./anthropicProvider.js";
|
|
18
|
+
import { GeminiProvider } from "./geminiProvider.js";
|
|
19
|
+
const REGISTRY = [
|
|
20
|
+
{ id: "ollama", label: "Ollama", kind: "local", factory: () => new OllamaProvider() },
|
|
21
|
+
{ id: "openai", label: "OpenAI", kind: "api-key", factory: () => new OpenAiProvider() },
|
|
22
|
+
{ id: "anthropic", label: "Anthropic", kind: "api-key", factory: () => new AnthropicProvider() },
|
|
23
|
+
{ id: "gemini", label: "Gemini", kind: "api-key", factory: () => new GeminiProvider() },
|
|
24
|
+
];
|
|
25
|
+
export function getProvider(id) {
|
|
26
|
+
const descriptor = REGISTRY.find((d) => d.id === id);
|
|
27
|
+
if (!descriptor) {
|
|
28
|
+
throw new Error(`Unknown LLM provider id: ${id}`);
|
|
29
|
+
}
|
|
30
|
+
return descriptor.factory();
|
|
31
|
+
}
|
|
32
|
+
export function listProviderDescriptors() {
|
|
33
|
+
return REGISTRY.map(({ id, label, kind }) => ({ id, label, kind }));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/llm/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAUrD,MAAM,QAAQ,GAAiC;IAC7C,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAE;IACrF,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAE;IACvF,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,EAAE,EAAE;IAChG,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAE;CACxF,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,EAAqB;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RemoteProvider — stub-grade in v1 per STATE §9 ("doesn't need a finished
|
|
3
|
+
* provider-switch UI" but the interface/seam must be real, not a TODO).
|
|
4
|
+
* Implements the same LlmProvider interface against Anthropic's Messages API
|
|
5
|
+
* shape, as a concrete placeholder for "some remote vendor."
|
|
6
|
+
*
|
|
7
|
+
* The API key is read EXCLUSIVELY from process.env.SYMBION_REMOTE_LLM_API_KEY
|
|
8
|
+
* at call time — never persisted to disk, never accepted as a request param,
|
|
9
|
+
* never read from apps/web. If unset, generate() throws LlmError("auth", ...)
|
|
10
|
+
* immediately, with NO network call attempted (TC-D7).
|
|
11
|
+
*/
|
|
12
|
+
import { type LlmGenerateRequest, type LlmGenerateResult, type LlmModelOption, type LlmProvider } from "./types.js";
|
|
13
|
+
export declare const REMOTE_API_KEY_ENV_VAR = "SYMBION_REMOTE_LLM_API_KEY";
|
|
14
|
+
export interface RemoteProviderOptions {
|
|
15
|
+
/** injectable for tests; defaults to the real Anthropic Messages endpoint. */
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class RemoteProvider implements LlmProvider {
|
|
19
|
+
readonly id: "remote";
|
|
20
|
+
private readonly baseUrl;
|
|
21
|
+
constructor(opts?: RemoteProviderOptions);
|
|
22
|
+
listModels(): LlmModelOption[];
|
|
23
|
+
generate(req: LlmGenerateRequest): Promise<LlmGenerateResult>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=remoteProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteProvider.d.ts","sourceRoot":"","sources":["../../src/llm/remoteProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAY,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9H,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAUnE,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,IAAI,GAAE,qBAA0B;IAI5C,UAAU,IAAI,cAAc,EAAE;IAIxB,QAAQ,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA6DpE"}
|