@skaile/workspaces 6.8.0 → 6.9.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/CHANGELOG.md +52 -0
- package/dist/ai-sdk.js +5 -5
- package/dist/{asset-feeds-NU5UOO5F.js → asset-feeds-JWRIWLVX.js} +19 -19
- package/dist/{asset-feeds-NU5UOO5F.js.map → asset-feeds-JWRIWLVX.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +4 -4
- package/dist/asset-manager/history.js +19 -1
- package/dist/asset-manager/index.js +11 -11
- package/dist/asset-manager/installer.js +7 -7
- package/dist/asset-manager/renderers.js +6 -6
- package/dist/asset-manager/src/history.d.ts.map +1 -1
- package/dist/asset-manager/src/index.d.ts +65 -3
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/bridge/harnesses/claude-sdk.js +9 -9
- package/dist/bridge/harnesses/codex.js +29 -12
- package/dist/bridge/harnesses/codex.js.map +1 -1
- package/dist/bridge/harnesses/continue.js +8 -8
- package/dist/bridge/harnesses/echo.js +3 -3
- package/dist/bridge/harnesses/gemini.js +8 -8
- package/dist/bridge/harnesses/goose.js +8 -8
- package/dist/bridge/harnesses/omp.js +156 -24
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +8 -8
- package/dist/bridge/harnesses/qwen.js +8 -8
- package/dist/bridge/index.js +14 -14
- package/dist/bridge/src/codex/friendly-error.d.ts +7 -1
- package/dist/bridge/src/codex/friendly-error.d.ts.map +1 -1
- package/dist/bridge/src/codex/login-fallback.d.ts +5 -0
- package/dist/bridge/src/codex/login-fallback.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/codex.d.ts +2 -0
- package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/omp.d.ts +17 -0
- package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
- package/dist/{chunk-757G6TTZ.js → chunk-23Q5LT4U.js} +331 -59
- package/dist/chunk-23Q5LT4U.js.map +1 -0
- package/dist/{chunk-SBNUXJ6E.js → chunk-3AIEJSQR.js} +3 -3
- package/dist/{chunk-SBNUXJ6E.js.map → chunk-3AIEJSQR.js.map} +1 -1
- package/dist/{chunk-KHWGUXSF.js → chunk-3EPRTMXY.js} +5 -5
- package/dist/{chunk-KHWGUXSF.js.map → chunk-3EPRTMXY.js.map} +1 -1
- package/dist/{chunk-TMJBEGS4.js → chunk-4KPQ6ILH.js} +5 -34
- package/dist/chunk-4KPQ6ILH.js.map +1 -0
- package/dist/{chunk-G7NMF5WQ.js → chunk-4ROXSQEG.js} +3 -3
- package/dist/{chunk-G7NMF5WQ.js.map → chunk-4ROXSQEG.js.map} +1 -1
- package/dist/{chunk-I6XH46Q6.js → chunk-4WB4KSSQ.js} +3 -3
- package/dist/{chunk-I6XH46Q6.js.map → chunk-4WB4KSSQ.js.map} +1 -1
- package/dist/{chunk-NW7Y5SNK.js → chunk-5AQLCRR7.js} +4 -4
- package/dist/{chunk-NW7Y5SNK.js.map → chunk-5AQLCRR7.js.map} +1 -1
- package/dist/{chunk-WFK4MUBL.js → chunk-5J6JWGY4.js} +3 -3
- package/dist/{chunk-WFK4MUBL.js.map → chunk-5J6JWGY4.js.map} +1 -1
- package/dist/{chunk-O5Y7VMVQ.js → chunk-5KWQMCH7.js} +3 -3
- package/dist/{chunk-O5Y7VMVQ.js.map → chunk-5KWQMCH7.js.map} +1 -1
- package/dist/{chunk-YHNPWSSH.js → chunk-5NTB64PW.js} +45 -13
- package/dist/chunk-5NTB64PW.js.map +1 -0
- package/dist/{chunk-QGA2OBUJ.js → chunk-72BDCGBB.js} +3 -3
- package/dist/{chunk-QGA2OBUJ.js.map → chunk-72BDCGBB.js.map} +1 -1
- package/dist/{chunk-KTBKW2FI.js → chunk-7QYBKUAS.js} +4 -3
- package/dist/chunk-7QYBKUAS.js.map +1 -0
- package/dist/{chunk-E3KABQS3.js → chunk-AERQFD6T.js} +4 -4
- package/dist/{chunk-E3KABQS3.js.map → chunk-AERQFD6T.js.map} +1 -1
- package/dist/{chunk-XIIIGLSL.js → chunk-AVRTZAH2.js} +9 -9
- package/dist/{chunk-XIIIGLSL.js.map → chunk-AVRTZAH2.js.map} +1 -1
- package/dist/{chunk-2I5HNM7K.js → chunk-B2DGCYVC.js} +18 -18
- package/dist/chunk-B2DGCYVC.js.map +1 -0
- package/dist/{chunk-3QX2X77G.js → chunk-C7L5MFUL.js} +3 -3
- package/dist/{chunk-3QX2X77G.js.map → chunk-C7L5MFUL.js.map} +1 -1
- package/dist/{chunk-ORXV3UB6.js → chunk-CFTTXUM2.js} +3 -3
- package/dist/{chunk-ORXV3UB6.js.map → chunk-CFTTXUM2.js.map} +1 -1
- package/dist/{chunk-DRHJRTAS.js → chunk-DZRN3SNG.js} +5 -5
- package/dist/{chunk-DRHJRTAS.js.map → chunk-DZRN3SNG.js.map} +1 -1
- package/dist/{chunk-QCR5AE5E.js → chunk-E675QKFG.js} +5 -5
- package/dist/{chunk-QCR5AE5E.js.map → chunk-E675QKFG.js.map} +1 -1
- package/dist/{chunk-O7ADRMCR.js → chunk-FZO64PLQ.js} +45 -16
- package/dist/chunk-FZO64PLQ.js.map +1 -0
- package/dist/{chunk-Y6LC5PEZ.js → chunk-GYBDWW6K.js} +14 -5
- package/dist/chunk-GYBDWW6K.js.map +1 -0
- package/dist/{chunk-CMXDFTA2.js → chunk-GYPPVANR.js} +3 -3
- package/dist/{chunk-CMXDFTA2.js.map → chunk-GYPPVANR.js.map} +1 -1
- package/dist/{chunk-G44FFUMA.js → chunk-GZL6RN4Z.js} +92 -14
- package/dist/chunk-GZL6RN4Z.js.map +1 -0
- package/dist/{chunk-DFP476EU.js → chunk-JY2JXCL6.js} +89 -4
- package/dist/chunk-JY2JXCL6.js.map +1 -0
- package/dist/{chunk-ZBA4P5TD.js → chunk-LMADWO4Q.js} +9 -6
- package/dist/chunk-LMADWO4Q.js.map +1 -0
- package/dist/{chunk-3HSLJAMJ.js → chunk-LYVLDGML.js} +3 -3
- package/dist/{chunk-3HSLJAMJ.js.map → chunk-LYVLDGML.js.map} +1 -1
- package/dist/{chunk-YZD7DUEF.js → chunk-M4G2SVXI.js} +3 -3
- package/dist/{chunk-YZD7DUEF.js.map → chunk-M4G2SVXI.js.map} +1 -1
- package/dist/{chunk-SGI5MRKP.js → chunk-MDCI4RSG.js} +40 -5
- package/dist/chunk-MDCI4RSG.js.map +1 -0
- package/dist/{chunk-LJ6PLEDU.js → chunk-MPRWVZXF.js} +316 -51
- package/dist/chunk-MPRWVZXF.js.map +1 -0
- package/dist/{chunk-KO3VSZQP.js → chunk-NDBHEOIA.js} +6 -6
- package/dist/{chunk-KO3VSZQP.js.map → chunk-NDBHEOIA.js.map} +1 -1
- package/dist/{chunk-HKRME377.js → chunk-NJVHGS7X.js} +4 -4
- package/dist/{chunk-HKRME377.js.map → chunk-NJVHGS7X.js.map} +1 -1
- package/dist/{chunk-Q6FKWPRO.js → chunk-O3FYOS64.js} +93 -14
- package/dist/chunk-O3FYOS64.js.map +1 -0
- package/dist/{chunk-RDIGVPXX.js → chunk-PTJZCOBH.js} +2 -2
- package/dist/{chunk-RDIGVPXX.js.map → chunk-PTJZCOBH.js.map} +1 -1
- package/dist/{chunk-4CD2R4MJ.js → chunk-QBUJTVMY.js} +4 -4
- package/dist/{chunk-4CD2R4MJ.js.map → chunk-QBUJTVMY.js.map} +1 -1
- package/dist/{chunk-LL5GMUQG.js → chunk-SE6OL7Y5.js} +7 -7
- package/dist/{chunk-LL5GMUQG.js.map → chunk-SE6OL7Y5.js.map} +1 -1
- package/dist/{chunk-SILFO5RY.js → chunk-SQMDFM4N.js} +2 -2
- package/dist/{chunk-SILFO5RY.js.map → chunk-SQMDFM4N.js.map} +1 -1
- package/dist/{chunk-REAF7ZFA.js → chunk-T5EIWWEJ.js} +398 -36
- package/dist/chunk-T5EIWWEJ.js.map +1 -0
- package/dist/{chunk-QW5B3TEO.js → chunk-TMQFOJ6F.js} +3 -3
- package/dist/{chunk-QW5B3TEO.js.map → chunk-TMQFOJ6F.js.map} +1 -1
- package/dist/{chunk-BB5EJLKZ.js → chunk-TUOHA6BM.js} +2 -2
- package/dist/{chunk-BB5EJLKZ.js.map → chunk-TUOHA6BM.js.map} +1 -1
- package/dist/{chunk-HLAEYFUN.js → chunk-U3FI4DVT.js} +3 -3
- package/dist/{chunk-HLAEYFUN.js.map → chunk-U3FI4DVT.js.map} +1 -1
- package/dist/{chunk-237BMOZW.js → chunk-UWD7YBDR.js} +4 -4
- package/dist/{chunk-237BMOZW.js.map → chunk-UWD7YBDR.js.map} +1 -1
- package/dist/{chunk-6ZM5X2XW.js → chunk-V2CONXKD.js} +3 -3
- package/dist/{chunk-6ZM5X2XW.js.map → chunk-V2CONXKD.js.map} +1 -1
- package/dist/{chunk-3NJFPGEB.js → chunk-V3EJYOP2.js} +6 -6
- package/dist/{chunk-3NJFPGEB.js.map → chunk-V3EJYOP2.js.map} +1 -1
- package/dist/{chunk-K7ZGY2BY.js → chunk-WPLZGT5Z.js} +4095 -3888
- package/dist/chunk-WPLZGT5Z.js.map +1 -0
- package/dist/{chunk-VT6G5AJV.js → chunk-WS3BOCAT.js} +4 -3
- package/dist/chunk-WS3BOCAT.js.map +1 -0
- package/dist/{chunk-7YOHUX2M.js → chunk-X2B5GMJO.js} +18 -9
- package/dist/chunk-X2B5GMJO.js.map +1 -0
- package/dist/{chunk-YGP6XEPA.js → chunk-XPKUFOS3.js} +6 -6
- package/dist/{chunk-YGP6XEPA.js.map → chunk-XPKUFOS3.js.map} +1 -1
- package/dist/{chunk-XCGDRLMH.js → chunk-Y242OE4B.js} +3 -3
- package/dist/{chunk-XCGDRLMH.js.map → chunk-Y242OE4B.js.map} +1 -1
- package/dist/{chunk-K6HCOTOZ.js → chunk-Y2BQWZXT.js} +41 -35
- package/dist/chunk-Y2BQWZXT.js.map +1 -0
- package/dist/{chunk-5TLMHB2U.js → chunk-YGT3CGPD.js} +6 -3
- package/dist/chunk-YGT3CGPD.js.map +1 -0
- package/dist/{claude-code-AESK7XO4.js → claude-code-YRJIGXTL.js} +5 -5
- package/dist/{claude-code-AESK7XO4.js.map → claude-code-YRJIGXTL.js.map} +1 -1
- package/dist/cli/index.js +277 -143
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/agent-pins.d.ts +8 -0
- package/dist/cli/src/agent-pins.d.ts.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +4 -4
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/connector.d.ts.map +1 -1
- package/dist/cli/src/commands/deploy.d.ts.map +1 -1
- package/dist/cli/src/commands/flow.d.ts.map +1 -1
- package/dist/cli/src/commands/harness.d.ts.map +1 -1
- package/dist/cli/src/commands/integration.d.ts.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-index.d.ts +42 -0
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
- package/dist/cli/src/commands/npx.d.ts.map +1 -1
- package/dist/cli/src/commands/patch.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/serve-preflight.d.ts +10 -0
- package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts +5 -3
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/cli/src/commands/session.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/store.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/config-checks.d.ts +13 -0
- package/dist/cli/src/config-checks.d.ts.map +1 -1
- package/dist/cli/src/group-help.d.ts +11 -0
- package/dist/cli/src/group-help.d.ts.map +1 -0
- package/dist/connectors/config.js +2 -2
- package/dist/connectors/index.js +17 -17
- package/dist/connectors/src/config.d.ts.map +1 -1
- package/dist/connectors/src/connector-manager.d.ts +66 -2
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/connector-prompt.d.ts.map +1 -1
- package/dist/connectors/src/connector-types.d.ts +6 -0
- package/dist/connectors/src/connector-types.d.ts.map +1 -1
- package/dist/connectors/src/fleet-utils.d.ts +33 -0
- package/dist/connectors/src/fleet-utils.d.ts.map +1 -1
- package/dist/connectors/src/index.d.ts +2 -2
- package/dist/connectors/src/index.d.ts.map +1 -1
- package/dist/{connectors-5ZZRVAPD.js → connectors-JKT32HZT.js} +20 -20
- package/dist/{connectors-5ZZRVAPD.js.map → connectors-JKT32HZT.js.map} +1 -1
- package/dist/core/index.js +4 -4
- package/dist/core/logging.js +1 -1
- package/dist/core/runtime-assets.js +2 -2
- package/dist/core/src/index.d.ts +1 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/logging/config.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +6 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/run-state-ignore.d.ts +6 -4
- package/dist/core/src/run-state-ignore.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +6 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +1 -1
- package/dist/deploy/index.js +4 -4
- package/dist/discovery/index.js +2 -2
- package/dist/{ensure-sources-VLJ7AUUK.js → ensure-sources-GUJODKY5.js} +23 -23
- package/dist/{ensure-sources-VLJ7AUUK.js.map → ensure-sources-GUJODKY5.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +17 -17
- package/dist/factory-assets/connectors/deploy.js +17 -17
- package/dist/factory-assets/connectors/devserver.js +17 -17
- package/dist/factory-assets/connectors/flow/adapter.js +17 -17
- package/dist/factory-assets/connectors/flow/engine.js +5 -5
- package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
- package/dist/factory-assets/connectors/flow.js +17 -17
- package/dist/factory-assets/connectors/git.js +17 -17
- package/dist/factory-assets/connectors/gmail.js +17 -17
- package/dist/factory-assets/connectors/googledrive.js +17 -17
- package/dist/factory-assets/connectors/local.js +17 -17
- package/dist/factory-assets/connectors/mattermost.js +17 -17
- package/dist/factory-assets/connectors/memory.js +17 -17
- package/dist/factory-assets/connectors/minio.js +17 -17
- package/dist/factory-assets/connectors/postgres.js +17 -17
- package/dist/factory-assets/connectors/s3.js +17 -17
- package/dist/factory-assets/connectors/sharepoint.js +17 -17
- package/dist/factory-assets/connectors/sqlite.js +17 -17
- package/dist/factory-assets/connectors/static-server.js +17 -17
- package/dist/factory-assets/connectors/tunnel.js +17 -17
- package/dist/factory-assets/connectors/webdav.js +17 -17
- package/dist/factory-assets/connectors/xstate-store.js +17 -17
- package/dist/factory-assets/connectors/xstate.js +17 -17
- package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +4 -4
- package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +10 -10
- package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +15 -15
- package/dist/factory-assets/skills/manifest-compliance/SKILL.md +1 -1
- package/dist/{flows-I6ODIPZZ.js → flows-UCP6ZUYS.js} +7 -7
- package/dist/{flows-I6ODIPZZ.js.map → flows-UCP6ZUYS.js.map} +1 -1
- package/dist/{helpers-APXGTZ5A.js → helpers-SO53MRHF.js} +23 -23
- package/dist/{helpers-APXGTZ5A.js.map → helpers-SO53MRHF.js.map} +1 -1
- package/dist/library/index.js +7 -7
- package/dist/library/src/index.d.ts +1 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/remote/index.d.ts +1 -1
- package/dist/library/src/remote/index.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts +33 -2
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/{library-publish-B5HL4OBE.js → library-publish-Z5E3YZCZ.js} +61 -47
- package/dist/library-publish-Z5E3YZCZ.js.map +1 -0
- package/dist/model-endpoint/index.js +7 -7
- package/dist/model-endpoint/src/index.d.ts +1 -1
- package/dist/model-endpoint/src/index.d.ts.map +1 -1
- package/dist/model-endpoint/src/openai-agent.d.ts +60 -0
- package/dist/model-endpoint/src/openai-agent.d.ts.map +1 -0
- package/dist/model-endpoint/src/resolve.d.ts +12 -3
- package/dist/model-endpoint/src/resolve.d.ts.map +1 -1
- package/dist/model-endpoint/src/server.d.ts.map +1 -1
- package/dist/model-endpoint/src/types.d.ts +33 -0
- package/dist/model-endpoint/src/types.d.ts.map +1 -1
- package/dist/model-endpoint/src/upstream-models.d.ts +20 -0
- package/dist/model-endpoint/src/upstream-models.d.ts.map +1 -0
- package/dist/{open-library-F56D46K7.js → open-library-A5OB72FD.js} +26 -26
- package/dist/{open-library-F56D46K7.js.map → open-library-A5OB72FD.js.map} +1 -1
- package/dist/{open-registry-RZW2AFD6.js → open-registry-BHBHQMBA.js} +11 -11
- package/dist/{open-registry-RZW2AFD6.js.map → open-registry-BHBHQMBA.js.map} +1 -1
- package/dist/{paths-RPK5PNZQ.js → paths-77PXOXZY.js} +7 -7
- package/dist/{paths-RPK5PNZQ.js.map → paths-77PXOXZY.js.map} +1 -1
- package/dist/{plugin-store-OJTERUEZ.js → plugin-store-XQP2CRYH.js} +7 -7
- package/dist/{plugin-store-OJTERUEZ.js.map → plugin-store-XQP2CRYH.js.map} +1 -1
- package/dist/{project-GLTP6VFV.js → project-KTEUN7KR.js} +39 -40
- package/dist/{project-GLTP6VFV.js.map → project-KTEUN7KR.js.map} +1 -1
- package/dist/resolver/index.js +4 -4
- package/dist/runner/index.js +28 -28
- package/dist/runner/src/agent-loop.d.ts +42 -0
- package/dist/runner/src/agent-loop.d.ts.map +1 -0
- package/dist/runner/src/agents/in-process-host.d.ts +9 -6
- package/dist/runner/src/agents/in-process-host.d.ts.map +1 -1
- package/dist/runner/src/model-endpoint-discovery.d.ts +3 -0
- package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -1
- package/dist/runner/src/resource-handler.d.ts +1 -1
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts +1 -0
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +6 -4
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/runner/src/session-resource-handlers.d.ts.map +1 -1
- package/dist/runner/src/turn-scheduler.d.ts +29 -2
- package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +11 -11
- package/dist/sdk/bridge.js +14 -14
- package/dist/sdk/core.js +4 -4
- package/dist/sdk/flow.js +5 -5
- package/dist/sdk/index.js +28 -28
- package/dist/sdk/resolver.js +4 -4
- package/dist/sdk/runner.js +28 -28
- package/dist/sdk/transport/ws/server.js +5 -5
- package/dist/sdk/transport/ws.js +5 -5
- package/dist/sdk/transport.js +5 -5
- package/dist/{serve-preflight-EHLBSNUE.js → serve-preflight-ODQGVUFL.js} +27 -26
- package/dist/{serve-preflight-EHLBSNUE.js.map → serve-preflight-ODQGVUFL.js.map} +1 -1
- package/dist/{setup-PMZLMFCD.js → setup-QJDI5YAW.js} +24 -24
- package/dist/{setup-PMZLMFCD.js.map → setup-QJDI5YAW.js.map} +1 -1
- package/dist/{skills-KHHW3RZ3.js → skills-DE2BDQ6G.js} +6 -6
- package/dist/{skills-KHHW3RZ3.js.map → skills-DE2BDQ6G.js.map} +1 -1
- package/dist/{source-QNSGAM3S.js → source-FKOUYMEM.js} +39 -39
- package/dist/{source-QNSGAM3S.js.map → source-FKOUYMEM.js.map} +1 -1
- package/dist/{source-manifest-publish-AI725AVE.js → source-manifest-publish-JA4TY4Z6.js} +41 -41
- package/dist/{source-manifest-publish-AI725AVE.js.map → source-manifest-publish-JA4TY4Z6.js.map} +1 -1
- package/dist/transport/index.js +5 -5
- package/dist/transport/ws/server.js +5 -5
- package/dist/transport/ws.js +5 -5
- package/dist/tui/index.js +29 -29
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/manifests/scaffold-body.d.ts +1 -1
- package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +20 -20
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +2 -2
- package/dist/workspace-plugin/src/tools/connectors.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2I5HNM7K.js.map +0 -1
- package/dist/chunk-5TLMHB2U.js.map +0 -1
- package/dist/chunk-757G6TTZ.js.map +0 -1
- package/dist/chunk-7YOHUX2M.js.map +0 -1
- package/dist/chunk-DFP476EU.js.map +0 -1
- package/dist/chunk-G44FFUMA.js.map +0 -1
- package/dist/chunk-K6HCOTOZ.js.map +0 -1
- package/dist/chunk-K7ZGY2BY.js.map +0 -1
- package/dist/chunk-KTBKW2FI.js.map +0 -1
- package/dist/chunk-LJ6PLEDU.js.map +0 -1
- package/dist/chunk-O7ADRMCR.js.map +0 -1
- package/dist/chunk-PMZMG3HC.js +0 -83
- package/dist/chunk-PMZMG3HC.js.map +0 -1
- package/dist/chunk-Q6FKWPRO.js.map +0 -1
- package/dist/chunk-REAF7ZFA.js.map +0 -1
- package/dist/chunk-SGI5MRKP.js.map +0 -1
- package/dist/chunk-TMJBEGS4.js.map +0 -1
- package/dist/chunk-VT6G5AJV.js.map +0 -1
- package/dist/chunk-Y6LC5PEZ.js.map +0 -1
- package/dist/chunk-YHNPWSSH.js.map +0 -1
- package/dist/chunk-ZBA4P5TD.js.map +0 -1
- package/dist/library-publish-B5HL4OBE.js.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-
|
|
2
|
-
import { entryCredentialValue } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { selectableEntries, entryModelIds, entrySurface, entryBaseUrl } from './chunk-4WB4KSSQ.js';
|
|
2
|
+
import { entryCredentialValue } from './chunk-SQMDFM4N.js';
|
|
3
|
+
import { buildCredentialHeaders } from './chunk-6UP2EDFN.js';
|
|
4
|
+
import { listenWithProbe, loadHarnessSdkSubpath, loadHarnessSdk } from './chunk-4KPQ6ILH.js';
|
|
4
5
|
import { parseModelRef } from './chunk-RXGPFAMN.js';
|
|
5
6
|
import { createHash, timingSafeEqual, randomUUID } from 'crypto';
|
|
6
7
|
import { createServer } from 'http';
|
|
7
8
|
|
|
8
9
|
// model-endpoint/src/types.ts
|
|
10
|
+
var AGENT_MODEL_ID = "skaile-agent";
|
|
9
11
|
var ModelEndpointError = class extends Error {
|
|
10
12
|
status;
|
|
11
13
|
type;
|
|
@@ -35,16 +37,17 @@ function piBaseUrl(_surface, registryBaseUrl) {
|
|
|
35
37
|
}
|
|
36
38
|
function resolveModel(selector, deps) {
|
|
37
39
|
assertKnownProviderPrefix(selector, deps);
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
+
const parsed = parseModelRef(selector, deps.registry, deps.roles);
|
|
41
|
+
if (!parsed || parsed.modelId === void 0) {
|
|
40
42
|
throw new ModelEndpointError(404, `model '${selector}' not found`, "model_not_found");
|
|
41
43
|
}
|
|
44
|
+
const logicalId = parsed.modelId;
|
|
45
|
+
const ref = parsed.fallback ? placeUndeclaredBareId(selector, logicalId, parsed, deps) : parsed;
|
|
42
46
|
const found = selectableEntries(deps.registry).find(([id]) => id === ref.providerId);
|
|
43
47
|
if (!found) {
|
|
44
48
|
throw new ModelEndpointError(404, `model '${selector}' not found`, "model_not_found");
|
|
45
49
|
}
|
|
46
50
|
const [providerId, entry] = found;
|
|
47
|
-
const logicalId = ref.modelId;
|
|
48
51
|
const declared = entryModelIds(entry);
|
|
49
52
|
if (declared.length > 0 && !declared.some(([id]) => id === logicalId)) {
|
|
50
53
|
throw new ModelEndpointError(
|
|
@@ -86,6 +89,24 @@ function resolveModel(selector, deps) {
|
|
|
86
89
|
...entry.headers ? { headers: entry.headers } : {}
|
|
87
90
|
};
|
|
88
91
|
}
|
|
92
|
+
function needsUpstreamModels(selector, deps) {
|
|
93
|
+
const ref = parseModelRef(selector, deps.registry, deps.roles);
|
|
94
|
+
return ref?.modelId !== void 0 && ref.fallback === true;
|
|
95
|
+
}
|
|
96
|
+
function placeUndeclaredBareId(selector, modelId, ref, deps) {
|
|
97
|
+
const owner = selectableEntries(deps.registry).find(
|
|
98
|
+
([id, entry]) => entryModelIds(entry).length === 0 && deps.upstreamModels?.[id]?.has(modelId)
|
|
99
|
+
);
|
|
100
|
+
if (owner) {
|
|
101
|
+
return { ...ref, providerId: owner[0], providerModelId: modelId, fallback: void 0 };
|
|
102
|
+
}
|
|
103
|
+
const providers = selectableEntries(deps.registry).map(([id]) => id);
|
|
104
|
+
throw new ModelEndpointError(
|
|
105
|
+
404,
|
|
106
|
+
`model '${selector}' not found: no provider of this endpoint declares or lists '${modelId}'; name it '<provider>/<model>' (providers: ${providers.join(", ")}) or add it to a model_map`,
|
|
107
|
+
"model_not_found"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
89
110
|
function assertKnownProviderPrefix(selector, deps) {
|
|
90
111
|
let target = selector.trim();
|
|
91
112
|
if (target.startsWith("@")) target = deps.roles?.[target.slice(1)]?.trim() ?? "";
|
|
@@ -111,14 +132,195 @@ function isKeyless(entry) {
|
|
|
111
132
|
function listPassThroughProviders(registry) {
|
|
112
133
|
return selectableEntries(registry).filter(([, entry]) => entryModelIds(entry).length === 0).map(([providerId]) => providerId);
|
|
113
134
|
}
|
|
114
|
-
function listModels(registry) {
|
|
115
|
-
return selectableEntries(registry).flatMap(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
135
|
+
function listModels(registry, upstreamModels = {}) {
|
|
136
|
+
return selectableEntries(registry).flatMap(([providerId, entry]) => {
|
|
137
|
+
const ids = entryModelIds(entry).map(([logicalId]) => logicalId);
|
|
138
|
+
if (ids.length === 0) ids.push(...upstreamModels[providerId] ?? []);
|
|
139
|
+
return ids.map((logicalId) => ({ id: `${providerId}/${logicalId}`, owned_by: providerId }));
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// model-endpoint/src/openai-agent.ts
|
|
144
|
+
var MAX_INPUT_CHARS = 200;
|
|
145
|
+
function agentPromptText(request) {
|
|
146
|
+
const messages = request.context.messages;
|
|
147
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
148
|
+
const message = messages[i];
|
|
149
|
+
if (message?.role !== "user") continue;
|
|
150
|
+
if (typeof message.content === "string") return message.content;
|
|
151
|
+
let text = "";
|
|
152
|
+
for (const part of message.content) {
|
|
153
|
+
if (part.type === "image") {
|
|
154
|
+
throw new ModelEndpointError(400, "skaile-agent takes text only", "unsupported_content");
|
|
155
|
+
}
|
|
156
|
+
text += part.text;
|
|
157
|
+
}
|
|
158
|
+
return text;
|
|
159
|
+
}
|
|
160
|
+
throw new ModelEndpointError(
|
|
161
|
+
400,
|
|
162
|
+
"messages must contain a message with role 'user'",
|
|
163
|
+
"missing_user_message"
|
|
120
164
|
);
|
|
121
165
|
}
|
|
166
|
+
function truncated(text) {
|
|
167
|
+
return text.length > MAX_INPUT_CHARS ? `${text.slice(0, MAX_INPUT_CHARS)}\u2026` : text;
|
|
168
|
+
}
|
|
169
|
+
function activityLine(event) {
|
|
170
|
+
switch (event.type) {
|
|
171
|
+
case "tool_call": {
|
|
172
|
+
const input = JSON.stringify(event.input);
|
|
173
|
+
return `\u2192 ${event.tool}${input === void 0 ? "" : ` ${truncated(input)}`}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
case "tool_result":
|
|
177
|
+
return `\u2190 ${event.tool}
|
|
178
|
+
`;
|
|
179
|
+
case "error":
|
|
180
|
+
return event.fatal ? void 0 : `! ${event.message}
|
|
181
|
+
`;
|
|
182
|
+
default:
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function questionText(event) {
|
|
187
|
+
const options = event.options ?? [];
|
|
188
|
+
if (options.length === 0) return event.question;
|
|
189
|
+
return `${event.question}
|
|
190
|
+
${options.map((option, i) => `${i + 1}. ${option}`).join("\n")}`;
|
|
191
|
+
}
|
|
192
|
+
function endsAgentTurn(event) {
|
|
193
|
+
return event.type === "finished" || event.type === "question";
|
|
194
|
+
}
|
|
195
|
+
function toAgentUsage(finished) {
|
|
196
|
+
const tokens = finished?.tokens;
|
|
197
|
+
const prompt = tokens?.inputTokens ?? 0;
|
|
198
|
+
const completion = tokens?.outputTokens ?? 0;
|
|
199
|
+
const usage = {
|
|
200
|
+
prompt_tokens: prompt,
|
|
201
|
+
completion_tokens: completion,
|
|
202
|
+
total_tokens: tokens?.totalTokens ?? prompt + completion,
|
|
203
|
+
prompt_tokens_details: { cached_tokens: tokens?.cacheReadTokens ?? 0 }
|
|
204
|
+
};
|
|
205
|
+
if (tokens?.reasoningTokens !== void 0) {
|
|
206
|
+
usage.completion_tokens_details = { reasoning_tokens: tokens.reasoningTokens };
|
|
207
|
+
}
|
|
208
|
+
if (finished !== void 0 && finished.costUsd > 0) usage.cost = finished.costUsd;
|
|
209
|
+
return usage;
|
|
210
|
+
}
|
|
211
|
+
async function toAgentCompletion(events, meta) {
|
|
212
|
+
let content = "";
|
|
213
|
+
let reasoning = "";
|
|
214
|
+
let failure;
|
|
215
|
+
let finished;
|
|
216
|
+
for await (const event of events) {
|
|
217
|
+
if (event.type === "text") {
|
|
218
|
+
content += event.content;
|
|
219
|
+
} else if (event.type === "text_retract") {
|
|
220
|
+
if (event.content.length > 0 && content.endsWith(event.content)) {
|
|
221
|
+
content = content.slice(0, -event.content.length);
|
|
222
|
+
}
|
|
223
|
+
} else if (event.type === "error" && event.fatal) {
|
|
224
|
+
failure ??= event.message;
|
|
225
|
+
} else if (event.type === "question") {
|
|
226
|
+
content += content.length > 0 ? `
|
|
227
|
+
${questionText(event)}` : questionText(event);
|
|
228
|
+
} else if (event.type === "finished") {
|
|
229
|
+
finished = event;
|
|
230
|
+
} else {
|
|
231
|
+
reasoning += activityLine(event) ?? "";
|
|
232
|
+
}
|
|
233
|
+
if (endsAgentTurn(event)) break;
|
|
234
|
+
}
|
|
235
|
+
if (failure !== void 0) {
|
|
236
|
+
throw new ModelEndpointError(502, failure, "turn_failed", "upstream_error");
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
id: meta.id,
|
|
240
|
+
object: "chat.completion",
|
|
241
|
+
created: meta.created,
|
|
242
|
+
model: meta.model,
|
|
243
|
+
choices: [
|
|
244
|
+
{
|
|
245
|
+
index: 0,
|
|
246
|
+
message: {
|
|
247
|
+
role: "assistant",
|
|
248
|
+
content: content.length > 0 ? content : null,
|
|
249
|
+
...reasoning.length > 0 ? { reasoning_content: reasoning } : {}
|
|
250
|
+
},
|
|
251
|
+
finish_reason: "stop"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
usage: toAgentUsage(finished)
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function createAgentStreamState(init) {
|
|
258
|
+
return { ...init, started: false, closed: false, hasContent: false };
|
|
259
|
+
}
|
|
260
|
+
function chunk(state, delta, finish = null) {
|
|
261
|
+
return {
|
|
262
|
+
id: state.id,
|
|
263
|
+
object: "chat.completion.chunk",
|
|
264
|
+
created: state.created,
|
|
265
|
+
model: state.model,
|
|
266
|
+
choices: [{ index: 0, delta, finish_reason: finish }]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function closingChunks(state, finished) {
|
|
270
|
+
state.closed = true;
|
|
271
|
+
const chunks = [chunk(state, {}, "stop")];
|
|
272
|
+
if (state.includeUsage) {
|
|
273
|
+
chunks.push({
|
|
274
|
+
id: state.id,
|
|
275
|
+
object: "chat.completion.chunk",
|
|
276
|
+
created: state.created,
|
|
277
|
+
model: state.model,
|
|
278
|
+
choices: [],
|
|
279
|
+
usage: toAgentUsage(finished)
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return chunks;
|
|
283
|
+
}
|
|
284
|
+
function agentDeltas(event, state) {
|
|
285
|
+
switch (event.type) {
|
|
286
|
+
case "text":
|
|
287
|
+
if (event.content.length === 0) return [];
|
|
288
|
+
state.hasContent = true;
|
|
289
|
+
return [chunk(state, { content: event.content })];
|
|
290
|
+
case "text_retract":
|
|
291
|
+
return [chunk(state, { reasoning_content: `~ retracted ${event.content.length} chars
|
|
292
|
+
` })];
|
|
293
|
+
case "question": {
|
|
294
|
+
const text = questionText(event);
|
|
295
|
+
const content = state.hasContent ? `
|
|
296
|
+
${text}` : text;
|
|
297
|
+
return [chunk(state, { content }), ...closingChunks(state, void 0)];
|
|
298
|
+
}
|
|
299
|
+
case "finished":
|
|
300
|
+
return closingChunks(state, event);
|
|
301
|
+
default: {
|
|
302
|
+
if (event.type === "error" && event.fatal) {
|
|
303
|
+
state.error ??= event.message;
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
const line = activityLine(event);
|
|
307
|
+
return line === void 0 ? [] : [chunk(state, { reasoning_content: line })];
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function agentCompletionChunks(event, state) {
|
|
312
|
+
const chunks = agentDeltas(event, state);
|
|
313
|
+
if (chunks.length === 0 || state.started) return chunks;
|
|
314
|
+
state.started = true;
|
|
315
|
+
return [chunk(state, { role: "assistant", content: "" }), ...chunks];
|
|
316
|
+
}
|
|
317
|
+
function agentCompletionEnd(state) {
|
|
318
|
+
if (state.closed) return [];
|
|
319
|
+
const chunks = closingChunks(state, void 0);
|
|
320
|
+
if (state.started) return chunks;
|
|
321
|
+
state.started = true;
|
|
322
|
+
return [chunk(state, { role: "assistant", content: "" }), ...chunks];
|
|
323
|
+
}
|
|
122
324
|
|
|
123
325
|
// model-endpoint/src/openai-shared.ts
|
|
124
326
|
var THINKING_LEVELS = [
|
|
@@ -528,7 +730,7 @@ function toChatCompletion(message, meta, cost) {
|
|
|
528
730
|
function createChatStreamState(init) {
|
|
529
731
|
return { ...init, nextToolIndex: 0, toolIndexByContent: /* @__PURE__ */ new Map() };
|
|
530
732
|
}
|
|
531
|
-
function
|
|
733
|
+
function chunk2(state, delta, finish = null) {
|
|
532
734
|
return {
|
|
533
735
|
id: state.id,
|
|
534
736
|
object: "chat.completion.chunk",
|
|
@@ -540,11 +742,11 @@ function chunk(state, delta, finish = null) {
|
|
|
540
742
|
function chatCompletionChunks(event, state) {
|
|
541
743
|
switch (event.type) {
|
|
542
744
|
case "start":
|
|
543
|
-
return [
|
|
745
|
+
return [chunk2(state, { role: "assistant", content: "" })];
|
|
544
746
|
case "text_delta":
|
|
545
|
-
return event.delta.length > 0 ? [
|
|
747
|
+
return event.delta.length > 0 ? [chunk2(state, { content: event.delta })] : [];
|
|
546
748
|
case "thinking_delta":
|
|
547
|
-
return event.delta.length > 0 ? [
|
|
749
|
+
return event.delta.length > 0 ? [chunk2(state, { reasoning_content: event.delta })] : [];
|
|
548
750
|
case "toolcall_start":
|
|
549
751
|
state.toolIndexByContent.set(event.contentIndex, state.nextToolIndex++);
|
|
550
752
|
return [];
|
|
@@ -555,7 +757,7 @@ function chatCompletionChunks(event, state) {
|
|
|
555
757
|
state.toolIndexByContent.set(event.contentIndex, index);
|
|
556
758
|
}
|
|
557
759
|
return [
|
|
558
|
-
|
|
760
|
+
chunk2(state, {
|
|
559
761
|
tool_calls: [
|
|
560
762
|
{
|
|
561
763
|
index,
|
|
@@ -571,7 +773,7 @@ function chatCompletionChunks(event, state) {
|
|
|
571
773
|
];
|
|
572
774
|
}
|
|
573
775
|
case "done": {
|
|
574
|
-
const chunks = [
|
|
776
|
+
const chunks = [chunk2(state, {}, finishReason(event.reason, void 0))];
|
|
575
777
|
if (state.includeUsage) {
|
|
576
778
|
chunks.push({
|
|
577
779
|
id: state.id,
|
|
@@ -1025,6 +1227,73 @@ function responsesEvents(event, state) {
|
|
|
1025
1227
|
}
|
|
1026
1228
|
}
|
|
1027
1229
|
|
|
1230
|
+
// model-endpoint/src/upstream-models.ts
|
|
1231
|
+
var LIST_TIMEOUT_MS = 5e3;
|
|
1232
|
+
var CACHE_TTL_MS = 6e4;
|
|
1233
|
+
var ANTHROPIC_VERSION = "2023-06-01";
|
|
1234
|
+
var UpstreamModelCache = class {
|
|
1235
|
+
cache = /* @__PURE__ */ new Map();
|
|
1236
|
+
async list(registry, lookupEnv, fetchFn) {
|
|
1237
|
+
const open = selectableEntries(registry).filter(
|
|
1238
|
+
([, entry]) => entryModelIds(entry).length === 0
|
|
1239
|
+
);
|
|
1240
|
+
const lists = await Promise.all(
|
|
1241
|
+
open.map(async ([providerId, entry]) => {
|
|
1242
|
+
const surface = entrySurface(entry);
|
|
1243
|
+
const baseUrl = entryBaseUrl(entry);
|
|
1244
|
+
if (!surface || !baseUrl) return [providerId, /* @__PURE__ */ new Set()];
|
|
1245
|
+
const key = `${providerId}
|
|
1246
|
+
${baseUrl}`;
|
|
1247
|
+
const hit = this.cache.get(key);
|
|
1248
|
+
if (hit && Date.now() - hit.at < CACHE_TTL_MS) return [providerId, hit.ids];
|
|
1249
|
+
const apiKey = entryCredentialValue(providerId, entry, {
|
|
1250
|
+
env: lookupEnv,
|
|
1251
|
+
allowCommand: false
|
|
1252
|
+
});
|
|
1253
|
+
const ids = await fetchIds(
|
|
1254
|
+
surface,
|
|
1255
|
+
baseUrl,
|
|
1256
|
+
buildCredentialHeaders(entry, apiKey),
|
|
1257
|
+
entry.headers,
|
|
1258
|
+
fetchFn
|
|
1259
|
+
);
|
|
1260
|
+
if (!ids) return [providerId, /* @__PURE__ */ new Set()];
|
|
1261
|
+
this.cache.set(key, { at: Date.now(), ids });
|
|
1262
|
+
return [providerId, ids];
|
|
1263
|
+
})
|
|
1264
|
+
);
|
|
1265
|
+
return Object.fromEntries(lists);
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
async function fetchIds(surface, baseUrl, credentialHeaders, entryHeaders, fetchFn) {
|
|
1269
|
+
const anthropic = surface === "anthropic-messages";
|
|
1270
|
+
if (!anthropic && surface !== "openai-completions" && surface !== "openai-responses") {
|
|
1271
|
+
return void 0;
|
|
1272
|
+
}
|
|
1273
|
+
const url = anthropic ? `${baseUrl}/v1/models?limit=1000` : `${baseUrl}/models`;
|
|
1274
|
+
const headers = {
|
|
1275
|
+
accept: "application/json",
|
|
1276
|
+
...entryHeaders,
|
|
1277
|
+
...credentialHeaders
|
|
1278
|
+
};
|
|
1279
|
+
if (anthropic) headers["anthropic-version"] = ANTHROPIC_VERSION;
|
|
1280
|
+
try {
|
|
1281
|
+
const res = await fetchFn(url, { headers, signal: AbortSignal.timeout(LIST_TIMEOUT_MS) });
|
|
1282
|
+
if (!res.ok) return void 0;
|
|
1283
|
+
const body = await res.json();
|
|
1284
|
+
const data = body?.data;
|
|
1285
|
+
if (!Array.isArray(data)) return void 0;
|
|
1286
|
+
return new Set(
|
|
1287
|
+
data.flatMap((item) => {
|
|
1288
|
+
const id = item?.id;
|
|
1289
|
+
return typeof id === "string" && id !== "" ? [id] : [];
|
|
1290
|
+
})
|
|
1291
|
+
);
|
|
1292
|
+
} catch {
|
|
1293
|
+
return void 0;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1028
1297
|
// model-endpoint/src/usage-cost.ts
|
|
1029
1298
|
function costOf(payload) {
|
|
1030
1299
|
if (typeof payload !== "object" || payload === null || !("usage" in payload)) return void 0;
|
|
@@ -1098,11 +1367,32 @@ async function startModelEndpoint(options) {
|
|
|
1098
1367
|
const projectDir = options.projectDir ?? process.cwd();
|
|
1099
1368
|
const loadApi = options.loadApi ?? ((surface) => defaultLoadApi(surface, projectDir));
|
|
1100
1369
|
const tokenDigest = digest(options.token);
|
|
1370
|
+
const upstreamModels = new UpstreamModelCache();
|
|
1371
|
+
async function resolveWithUpstream(selector) {
|
|
1372
|
+
const current = deps();
|
|
1373
|
+
if (needsUpstreamModels(selector, current)) {
|
|
1374
|
+
current.upstreamModels = await upstreamModels.list(
|
|
1375
|
+
current.registry,
|
|
1376
|
+
current.lookupEnv,
|
|
1377
|
+
options.fetch ?? globalThis.fetch
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
return resolveModel(selector, current);
|
|
1381
|
+
}
|
|
1101
1382
|
const deps = () => ({
|
|
1102
1383
|
registry: options.getRegistry(),
|
|
1103
1384
|
lookupEnv: options.getLookupEnv(),
|
|
1104
1385
|
roles: options.getRoles?.()
|
|
1105
1386
|
});
|
|
1387
|
+
function rejectAgentSurface(model) {
|
|
1388
|
+
if (model === AGENT_MODEL_ID && options.getAgentLoop?.()) {
|
|
1389
|
+
throw new ModelEndpointError(
|
|
1390
|
+
400,
|
|
1391
|
+
`${AGENT_MODEL_ID} is served on /v1/chat/completions only`,
|
|
1392
|
+
"agent_model_unsupported_surface"
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1106
1396
|
function authenticate(req) {
|
|
1107
1397
|
const match = /^Bearer\s+(.+)$/i.exec(req.headers.authorization ?? "");
|
|
1108
1398
|
if (!match || !timingSafeEqual(digest(match[1] ?? ""), tokenDigest)) {
|
|
@@ -1151,7 +1441,9 @@ async function startModelEndpoint(options) {
|
|
|
1151
1441
|
}
|
|
1152
1442
|
async function handleChat(req, res, signal, trace) {
|
|
1153
1443
|
const request = parseChatCompletionRequest(await readJson(req));
|
|
1154
|
-
const
|
|
1444
|
+
const agentLoop = request.model === AGENT_MODEL_ID ? options.getAgentLoop?.() : void 0;
|
|
1445
|
+
if (agentLoop) return handleAgentChat(res, request, agentLoop, signal, trace);
|
|
1446
|
+
const resolved = await resolveWithUpstream(request.model);
|
|
1155
1447
|
trace.target = `${resolved.providerId}/${resolved.logicalId}`;
|
|
1156
1448
|
const { events, cost } = await startUpstream(request, resolved, signal, true);
|
|
1157
1449
|
const id = `chatcmpl-${randomUUID().replaceAll("-", "")}`;
|
|
@@ -1176,13 +1468,46 @@ async function startModelEndpoint(options) {
|
|
|
1176
1468
|
if (event.type === "done" && state.includeUsage) state.cost = await cost();
|
|
1177
1469
|
return chatCompletionChunks(event, state);
|
|
1178
1470
|
},
|
|
1179
|
-
errorFrame:
|
|
1471
|
+
errorFrame: upstreamErrorFrame,
|
|
1180
1472
|
terminator: "[DONE]"
|
|
1181
1473
|
});
|
|
1182
1474
|
}
|
|
1475
|
+
async function handleAgentChat(res, request, loop, signal, trace) {
|
|
1476
|
+
trace.target = AGENT_MODEL_ID;
|
|
1477
|
+
const text = agentPromptText(request);
|
|
1478
|
+
const run = await loop.prompt({ text, requestId: randomUUID() });
|
|
1479
|
+
const abort = () => {
|
|
1480
|
+
run.abort().catch((cause) => log(`agent abort failed: ${errorText(cause)}`));
|
|
1481
|
+
};
|
|
1482
|
+
if (signal.aborted) abort();
|
|
1483
|
+
else signal.addEventListener("abort", abort, { once: true });
|
|
1484
|
+
try {
|
|
1485
|
+
const id = `chatcmpl-${randomUUID().replaceAll("-", "")}`;
|
|
1486
|
+
const created = Math.floor(Date.now() / 1e3);
|
|
1487
|
+
if (!request.stream) {
|
|
1488
|
+
const completion = await toAgentCompletion(run.events, {
|
|
1489
|
+
id,
|
|
1490
|
+
created,
|
|
1491
|
+
model: AGENT_MODEL_ID
|
|
1492
|
+
});
|
|
1493
|
+
sendJson(res, 200, completion);
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
const state = createAgentStreamState({
|
|
1497
|
+
id,
|
|
1498
|
+
created,
|
|
1499
|
+
model: AGENT_MODEL_ID,
|
|
1500
|
+
includeUsage: request.includeUsage
|
|
1501
|
+
});
|
|
1502
|
+
await pipeAgentSse(res, run.events, state);
|
|
1503
|
+
} finally {
|
|
1504
|
+
signal.removeEventListener("abort", abort);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1183
1507
|
async function handleResponses(req, res, signal, trace) {
|
|
1184
1508
|
const request = parseResponsesRequest(await readJson(req));
|
|
1185
|
-
|
|
1509
|
+
rejectAgentSurface(request.model);
|
|
1510
|
+
const resolved = await resolveWithUpstream(request.model);
|
|
1186
1511
|
trace.target = `${resolved.providerId}/${resolved.logicalId}`;
|
|
1187
1512
|
const { events } = await startUpstream(request, resolved, signal);
|
|
1188
1513
|
const id = `resp_${randomUUID().replaceAll("-", "")}`;
|
|
@@ -1204,7 +1529,8 @@ async function startModelEndpoint(options) {
|
|
|
1204
1529
|
if (!isRecord2(body) || typeof body.model !== "string" || body.model === "") {
|
|
1205
1530
|
throw new ModelEndpointError(400, "`model` is required", "missing_model");
|
|
1206
1531
|
}
|
|
1207
|
-
|
|
1532
|
+
rejectAgentSurface(body.model);
|
|
1533
|
+
const resolved = await resolveWithUpstream(body.model);
|
|
1208
1534
|
trace.target = `${resolved.providerId}/${resolved.logicalId}`;
|
|
1209
1535
|
if (!EMBEDDING_SURFACES.has(resolved.model.api)) {
|
|
1210
1536
|
throw new ModelEndpointError(
|
|
@@ -1245,19 +1571,30 @@ async function startModelEndpoint(options) {
|
|
|
1245
1571
|
if (!path.startsWith("/v1/")) throw notFound(path);
|
|
1246
1572
|
authenticate(req);
|
|
1247
1573
|
switch (`${req.method} ${path}`) {
|
|
1248
|
-
case "GET /v1/models":
|
|
1574
|
+
case "GET /v1/models": {
|
|
1575
|
+
const registry = options.getRegistry();
|
|
1576
|
+
const upstream = await upstreamModels.list(
|
|
1577
|
+
registry,
|
|
1578
|
+
options.getLookupEnv(),
|
|
1579
|
+
options.fetch ?? globalThis.fetch
|
|
1580
|
+
);
|
|
1249
1581
|
sendJson(res, 200, {
|
|
1250
1582
|
object: "list",
|
|
1251
|
-
data:
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1583
|
+
data: [
|
|
1584
|
+
...listModels(registry, upstream).map((m) => ({
|
|
1585
|
+
id: m.id,
|
|
1586
|
+
object: "model",
|
|
1587
|
+
created: 0,
|
|
1588
|
+
owned_by: m.owned_by
|
|
1589
|
+
})),
|
|
1590
|
+
...options.getAgentLoop?.() ? [{ id: AGENT_MODEL_ID, object: "model", created: 0, owned_by: "skaile" }] : []
|
|
1591
|
+
],
|
|
1592
|
+
// Entries that declare no models forward any `<id>/<model>`, also one their upstream
|
|
1593
|
+
// does not list.
|
|
1594
|
+
pass_through_providers: listPassThroughProviders(registry)
|
|
1259
1595
|
});
|
|
1260
1596
|
return;
|
|
1597
|
+
}
|
|
1261
1598
|
case "POST /v1/chat/completions":
|
|
1262
1599
|
return handleChat(req, res, signal, trace);
|
|
1263
1600
|
case "POST /v1/responses":
|
|
@@ -1404,6 +1741,31 @@ async function pipeSse(res, events, pipe) {
|
|
|
1404
1741
|
if (pipe.terminator) await sse.raw(pipe.terminator);
|
|
1405
1742
|
res.end();
|
|
1406
1743
|
}
|
|
1744
|
+
async function pipeAgentSse(res, events, state) {
|
|
1745
|
+
let sse;
|
|
1746
|
+
const sendAll = async (frames) => {
|
|
1747
|
+
for (const frame of frames) {
|
|
1748
|
+
sse ??= openSse(res);
|
|
1749
|
+
await sse.send(frame);
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
try {
|
|
1753
|
+
for await (const event of events) {
|
|
1754
|
+
await sendAll(agentCompletionChunks(event, state));
|
|
1755
|
+
if (endsAgentTurn(event)) break;
|
|
1756
|
+
}
|
|
1757
|
+
await sendAll(agentCompletionEnd(state));
|
|
1758
|
+
} catch (err) {
|
|
1759
|
+
if (!sse) throw err;
|
|
1760
|
+
state.error ??= errorText(err);
|
|
1761
|
+
}
|
|
1762
|
+
if (state.error !== void 0) await sendAll([upstreamErrorFrame(state.error)]);
|
|
1763
|
+
await sse?.raw("[DONE]");
|
|
1764
|
+
res.end();
|
|
1765
|
+
}
|
|
1766
|
+
function upstreamErrorFrame(message) {
|
|
1767
|
+
return { error: { message, type: "upstream_error" } };
|
|
1768
|
+
}
|
|
1407
1769
|
function openSse(res) {
|
|
1408
1770
|
res.writeHead(200, {
|
|
1409
1771
|
"content-type": "text/event-stream",
|
|
@@ -1474,8 +1836,8 @@ async function readJson(req) {
|
|
|
1474
1836
|
if (Number(req.headers["content-length"]) > MAX_BODY_BYTES) throw tooLarge();
|
|
1475
1837
|
const chunks = [];
|
|
1476
1838
|
let size = 0;
|
|
1477
|
-
for await (const
|
|
1478
|
-
const buffer =
|
|
1839
|
+
for await (const chunk3 of req) {
|
|
1840
|
+
const buffer = chunk3;
|
|
1479
1841
|
size += buffer.length;
|
|
1480
1842
|
if (size > MAX_BODY_BYTES) throw tooLarge();
|
|
1481
1843
|
chunks.push(buffer);
|
|
@@ -1498,6 +1860,6 @@ function errorText(err) {
|
|
|
1498
1860
|
return err instanceof Error ? err.message : String(err);
|
|
1499
1861
|
}
|
|
1500
1862
|
|
|
1501
|
-
export { ModelEndpointError, checkPiAiInstalled, listModels, resolveModel, startModelEndpoint };
|
|
1502
|
-
//# sourceMappingURL=chunk-
|
|
1503
|
-
//# sourceMappingURL=chunk-
|
|
1863
|
+
export { AGENT_MODEL_ID, ModelEndpointError, checkPiAiInstalled, listModels, resolveModel, startModelEndpoint };
|
|
1864
|
+
//# sourceMappingURL=chunk-T5EIWWEJ.js.map
|
|
1865
|
+
//# sourceMappingURL=chunk-T5EIWWEJ.js.map
|