@alwith/module-chat 0.5.19 → 0.5.20
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/README.md +240 -1
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/assets/catalogs/alwith/models.json +72 -0
- package/assets/catalogs/custom/models.json +604 -0
- package/assets/catalogs/custom/sources.json +168 -0
- package/assets/catalogs/deepseek/models.json +139 -0
- package/assets/catalogs/openrouter/models.json +231 -0
- package/assets/catalogs/qwen/models.json +253 -0
- package/assets/catalogs/xai/models.json +129 -0
- package/assets/provider-catalog.json +127 -0
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/choice-schema.js +1 -1
- package/dist/approval/permission-options.js +1 -1
- package/dist/approval/permission-view.js +1 -1
- package/dist/approval/schema-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/chunk-0643swd4.js +2 -0
- package/dist/chunk-06zh85wp.js +3 -0
- package/dist/chunk-0p6y2t9b.js +2 -0
- package/dist/{chunk-tzyc5myt.js → chunk-0wa9yjg3.js} +2 -2
- package/dist/chunk-0whxm2f0.js +2 -0
- package/dist/chunk-11484wvv.js +2 -0
- package/dist/{chunk-5n4mefej.js → chunk-1fggcrvs.js} +2 -2
- package/dist/chunk-1k21j77z.js +2 -0
- package/dist/chunk-1k697ncv.js +2 -0
- package/dist/chunk-1mn2t6ga.js +2 -0
- package/dist/chunk-1qyxrh0n.js +3 -0
- package/dist/chunk-1r25anvg.js +2 -0
- package/dist/chunk-1rg3nab3.js +2 -0
- package/dist/chunk-20k9syde.js +1 -0
- package/dist/chunk-28f3zv6v.js +2 -0
- package/dist/{chunk-h3antqdd.js → chunk-2f9vjmxz.js} +2 -2
- package/dist/{chunk-k9mbpf0g.js → chunk-2t9j90mw.js} +2 -2
- package/dist/{chunk-2hk04fh3.js → chunk-36m8zstj.js} +2 -2
- package/dist/chunk-3gk86w24.js +2 -0
- package/dist/chunk-3ka3bt0t.js +2 -0
- package/dist/{chunk-210b2kk6.js → chunk-3s94ekrs.js} +2 -2
- package/dist/chunk-3vsc49pt.js +2 -0
- package/dist/{chunk-9ej4c7a8.js → chunk-3yxjh7b1.js} +2 -2
- package/dist/{chunk-dj4e0q7k.js → chunk-42atrgm1.js} +2 -2
- package/dist/{chunk-fgzq0ktw.js → chunk-48fj5m0p.js} +2 -2
- package/dist/{chunk-jx1cngyb.js → chunk-4bb6dzzs.js} +2 -2
- package/dist/chunk-4d853988.js +2 -0
- package/dist/chunk-4gyd9hx9.js +2 -0
- package/dist/chunk-4p6svs37.js +2 -0
- package/dist/chunk-4ygyb91q.js +2 -0
- package/dist/{chunk-ekd97p2x.js → chunk-581e33tz.js} +2 -2
- package/dist/{chunk-m2hpfdch.js → chunk-5a6xc345.js} +2 -2
- package/dist/chunk-5ap6fvrp.js +2 -0
- package/dist/chunk-5m7vc4s6.js +2 -0
- package/dist/{chunk-yjhypkmc.js → chunk-615a0yhh.js} +2 -2
- package/dist/chunk-62jm1gct.js +2 -0
- package/dist/{chunk-6p41wmgs.js → chunk-667z0pac.js} +2 -2
- package/dist/chunk-6syhjege.js +2 -0
- package/dist/{chunk-jt8h82c2.js → chunk-6t5war9h.js} +2 -2
- package/dist/{chunk-4xhvh2dn.js → chunk-7z4gtfkd.js} +2 -2
- package/dist/{chunk-f8wzz84b.js → chunk-855w49k0.js} +2 -2
- package/dist/chunk-8akwfgkq.js +2 -0
- package/dist/chunk-8c8ncw1m.js +2 -0
- package/dist/chunk-8mgypdap.js +2 -0
- package/dist/chunk-95mynf7q.js +1289 -0
- package/dist/chunk-9jp5t3qq.js +5 -0
- package/dist/chunk-9mky3b7v.js +2 -0
- package/dist/chunk-a63k8tht.js +2 -0
- package/dist/chunk-acb8t4jt.js +2 -0
- package/dist/chunk-adk7aeyt.js +2 -0
- package/dist/{chunk-0vy6cqmw.js → chunk-agqnt7xq.js} +2 -2
- package/dist/chunk-annzfgfq.js +4 -0
- package/dist/{chunk-9ebnn34t.js → chunk-azfmr99x.js} +2 -2
- package/dist/chunk-b12v22de.js +2 -0
- package/dist/{chunk-fcy4sv9f.js → chunk-b18zr059.js} +2 -2
- package/dist/chunk-bbyscgdd.js +2 -0
- package/dist/chunk-bfhfbrzt.js +2 -0
- package/dist/{chunk-jc52024g.js → chunk-bg03czcx.js} +2 -2
- package/dist/chunk-bvgqsaey.js +2 -0
- package/dist/chunk-c32z3wjq.js +2 -0
- package/dist/{chunk-ww223tm5.js → chunk-ckyat78p.js} +2 -2
- package/dist/chunk-cvz3k5gk.js +2 -0
- package/dist/chunk-d0vhdr07.js +2 -0
- package/dist/chunk-d257n8gj.js +2 -0
- package/dist/chunk-dfgak1md.js +2 -0
- package/dist/{chunk-e44hny11.js → chunk-drhzcs6e.js} +2 -2
- package/dist/{chunk-a4wrn6ep.js → chunk-dte0n4kf.js} +2 -2
- package/dist/chunk-erjscd1r.js +4 -0
- package/dist/{chunk-kjswq0tx.js → chunk-f1x483c9.js} +2 -2
- package/dist/chunk-f2w2sct6.js +2 -0
- package/dist/{chunk-0zp04d1m.js → chunk-f5gsffbv.js} +2 -2
- package/dist/chunk-feg5rp9g.js +2 -0
- package/dist/chunk-ffspd86m.js +2 -0
- package/dist/chunk-fh3pjhe6.js +2 -0
- package/dist/{chunk-rsfwc38x.js → chunk-fnpf84rf.js} +3 -3
- package/dist/chunk-g2qcyqc6.js +2 -0
- package/dist/chunk-g44hhdha.js +2 -0
- package/dist/chunk-g9t2d8hg.js +2 -0
- package/dist/chunk-g9yg36dh.js +3 -0
- package/dist/{chunk-nkqe2e8s.js → chunk-gha517v4.js} +2 -2
- package/dist/chunk-grr1k5zn.js +2 -0
- package/dist/chunk-gsfgdnfp.js +2 -0
- package/dist/chunk-h491shsg.js +2 -0
- package/dist/chunk-ha46rhzj.js +2 -0
- package/dist/chunk-hd7bk591.js +2 -0
- package/dist/{chunk-a9s3m9fs.js → chunk-heyqzkxq.js} +2 -2
- package/dist/chunk-hp4a0e8c.js +2 -0
- package/dist/{chunk-qmc18ejg.js → chunk-j69t1f4a.js} +2 -2
- package/dist/chunk-j8v3sfpv.js +2 -0
- package/dist/{chunk-z5tstgsh.js → chunk-jgd6dcgy.js} +2 -2
- package/dist/chunk-jmb8r6aj.js +2 -0
- package/dist/chunk-jwt7q6yx.js +4 -0
- package/dist/chunk-jxntqarp.js +2 -0
- package/dist/chunk-k64wvbbc.js +2 -0
- package/dist/{chunk-eeq8d3x7.js → chunk-k7ye738q.js} +2 -2
- package/dist/chunk-kbeme4w0.js +3 -0
- package/dist/{chunk-cdrmg9jj.js → chunk-kc56dhwd.js} +2 -2
- package/dist/{chunk-9xkp5x7h.js → chunk-kmdag4vy.js} +2 -2
- package/dist/chunk-kq48hbd5.js +2 -0
- package/dist/chunk-ktvh4yb5.js +2 -0
- package/dist/{chunk-c2h76vnt.js → chunk-kz1kjzmq.js} +2 -2
- package/dist/{chunk-eyf9bxyx.js → chunk-m271yxxm.js} +2 -2
- package/dist/chunk-mj7094yh.js +2 -0
- package/dist/chunk-mr6k70s4.js +2 -0
- package/dist/chunk-mv51zgj1.js +2 -0
- package/dist/{chunk-gcx4fk1a.js → chunk-mvs2dzyt.js} +2 -2
- package/dist/chunk-mz8a6292.js +2 -0
- package/dist/chunk-n5v1h0sk.js +2 -0
- package/dist/{chunk-01rfnabj.js → chunk-n66yy1m1.js} +2 -2
- package/dist/chunk-n9gq2wbz.js +3 -0
- package/dist/chunk-nxyrrmz8.js +2 -0
- package/dist/chunk-p7dd93e5.js +2 -0
- package/dist/chunk-p8g927x6.js +2 -0
- package/dist/chunk-pk2rvqd0.js +2 -0
- package/dist/{chunk-hwh88n0v.js → chunk-pprt7ntb.js} +4 -4
- package/dist/{chunk-gr1nnczz.js → chunk-pwjz3yxb.js} +2 -2
- package/dist/{chunk-sf1z4r7v.js → chunk-px1ehzwc.js} +2 -2
- package/dist/chunk-pzjag1mt.js +4 -0
- package/dist/chunk-q2gfd4jk.js +2 -0
- package/dist/chunk-q9ef9n7b.js +2 -0
- package/dist/chunk-q9zawfn1.js +2 -0
- package/dist/{chunk-b53ky6rb.js → chunk-qd1z91fm.js} +2 -2
- package/dist/chunk-qdg5zphd.js +2 -0
- package/dist/chunk-qn6ppn0r.js +2 -0
- package/dist/{chunk-09r35ts9.js → chunk-qwfw4xpn.js} +2 -2
- package/dist/chunk-r7s7kx38.js +3 -0
- package/dist/chunk-r9sweaq4.js +2 -0
- package/dist/chunk-rbv1scqm.js +2 -0
- package/dist/{chunk-yjtq166b.js → chunk-rjkpe1fw.js} +3 -3
- package/dist/{chunk-0zph0gwq.js → chunk-rjw63t34.js} +3 -3
- package/dist/chunk-rkfq0c0p.js +2 -0
- package/dist/chunk-rq5e0922.js +2 -0
- package/dist/chunk-s4wjckd1.js +7 -0
- package/dist/chunk-s8s65pj2.js +2 -0
- package/dist/chunk-ssxbxanb.js +2 -0
- package/dist/{chunk-qy2prx7m.js → chunk-swpy2b9a.js} +2 -2
- package/dist/chunk-t7drk9ja.js +2 -0
- package/dist/chunk-tpbqg729.js +2 -0
- package/dist/chunk-ttn8ss6b.js +2 -0
- package/dist/chunk-tv0fwt2g.js +2 -0
- package/dist/chunk-v5pbaf9x.js +2 -0
- package/dist/chunk-vbab9hc4.js +2 -0
- package/dist/{chunk-5nj2fjej.js → chunk-vfhxerxt.js} +2 -2
- package/dist/chunk-vnsgjnp3.js +2 -0
- package/dist/{chunk-kvx8fv1e.js → chunk-vt6cyes7.js} +2 -2
- package/dist/chunk-vzgv360q.js +2 -0
- package/dist/{chunk-5e10bzg2.js → chunk-wccx911q.js} +2 -2
- package/dist/{chunk-q4q4f03j.js → chunk-wgrmjfyp.js} +2 -2
- package/dist/chunk-wvry7t79.js +2 -0
- package/dist/chunk-x2nemdjf.js +2 -0
- package/dist/chunk-x99fyd88.js +2 -0
- package/dist/chunk-xdm2are3.js +2 -0
- package/dist/chunk-xft0s40a.js +3 -0
- package/dist/chunk-y0q6jwq4.js +2 -0
- package/dist/chunk-y6kzbbya.js +2 -0
- package/dist/chunk-y97ne5kj.js +2 -0
- package/dist/chunk-yakar0e2.js +2 -0
- package/dist/chunk-yg3xhn5m.js +2 -0
- package/dist/chunk-z3nybrbb.js +2 -0
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +1 -1
- package/dist/codex/async-question-card.js +1 -1
- package/dist/codex/disclosure-state.js +1 -1
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +1 -1
- package/dist/codex/navigation-audio.js +1 -1
- package/dist/codex/navigation-preview.js +1 -1
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/patch-view.js +1 -1
- package/dist/codex/plan.js +1 -1
- package/dist/codex/timeline-virtualizer.js +1 -1
- package/dist/codex/turn-activity.js +1 -1
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/collections/collection-emoji.d.ts +4 -0
- package/dist/collections/collection-emoji.js +1 -0
- package/dist/collections/collection-menu.d.ts +15 -0
- package/dist/collections/collection-menu.js +1 -0
- package/dist/collections/collection-panel.d.ts +11 -0
- package/dist/collections/collection-panel.js +1 -0
- package/dist/collections/collections.d.ts +6 -0
- package/dist/collections/collections.js +1 -0
- package/dist/collections/host.d.ts +19 -0
- package/dist/collections/host.js +1 -0
- package/dist/collections/locales.d.ts +71 -0
- package/dist/collections/locales.js +1 -0
- package/dist/collections/model.d.ts +95 -0
- package/dist/collections/model.js +1 -0
- package/dist/collections/store.d.ts +30 -0
- package/dist/collections/store.js +1 -0
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.js +1 -1
- package/dist/composer/completion-trigger.js +1 -1
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.js +1 -1
- package/dist/composer/prompt-input.js +1 -1
- package/dist/conversation/action-card.js +1 -1
- package/dist/conversation/composer/composer.js +1 -1
- package/dist/conversation/composer/config-options.js +1 -1
- package/dist/conversation/composer/context.js +1 -1
- package/dist/conversation/composer/drafts.js +1 -1
- package/dist/conversation/composer/file-items.js +1 -1
- package/dist/conversation/composer/long-text.js +1 -1
- package/dist/conversation/composer/mention-chips.js +1 -1
- package/dist/conversation/composer/mention-uri.js +1 -1
- package/dist/conversation/composer/model-menu.js +1 -1
- package/dist/conversation/composer/pasted-text-attachment.js +1 -1
- package/dist/conversation/composer/permission-mode-menu.js +1 -1
- package/dist/conversation/composer/prediction.js +1 -1
- package/dist/conversation/composer/slash-command-button.js +1 -1
- package/dist/conversation/composer/submit-button.js +1 -1
- package/dist/conversation/composer/usage-meter.js +1 -1
- package/dist/conversation/connection-notice.d.ts +8 -0
- package/dist/conversation/connection-notice.js +1 -0
- package/dist/conversation/context.js +1 -1
- package/dist/conversation/conversation-body.js +1 -1
- package/dist/conversation/conversation-search.d.ts +8 -0
- package/dist/conversation/conversation-search.js +1 -0
- package/dist/conversation/conversation-view.d.ts +1 -0
- package/dist/conversation/conversation-view.js +1 -1
- package/dist/conversation/conversation.d.ts +3 -0
- package/dist/conversation/conversation.js +1 -1
- package/dist/conversation/diff-modal.js +1 -1
- package/dist/conversation/draft-project-picker.d.ts +7 -0
- package/dist/conversation/draft-project-picker.js +1 -0
- package/dist/conversation/session-actions.js +1 -1
- package/dist/conversation/subagent-sessions.js +1 -1
- package/dist/conversation/types.d.ts +6 -1
- package/dist/image-lightbox.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/lib/code-highlighter.js +1 -1
- package/dist/lib/fuzzy.js +1 -1
- package/dist/lib/group-blocks.js +1 -1
- package/dist/lib/image-encode.js +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-rules.js +1 -1
- package/dist/lib/model-name.js +1 -1
- package/dist/lib/pointer-centered-zoom.js +1 -1
- package/dist/lib/prepare-prompt-files.js +1 -1
- package/dist/lib/stream-style.js +1 -1
- package/dist/lib/streaming-markdown.js +1 -1
- package/dist/locales.d.ts +1914 -0
- package/dist/locales.js +1 -1
- package/dist/plugins/catalog-header.d.ts +6 -0
- package/dist/plugins/catalog-header.js +1 -0
- package/dist/plugins/catalog-skeleton.d.ts +3 -0
- package/dist/plugins/catalog-skeleton.js +1 -0
- package/dist/plugins/host.d.ts +49 -0
- package/dist/plugins/host.js +1 -0
- package/dist/plugins/locales.d.ts +1136 -0
- package/dist/plugins/locales.js +1 -0
- package/dist/plugins/new-chat-directory.d.ts +2 -0
- package/dist/plugins/new-chat-directory.js +1 -0
- package/dist/plugins/pane.d.ts +12 -0
- package/dist/plugins/pane.js +1 -0
- package/dist/plugins/panel-item.d.ts +8 -0
- package/dist/plugins/panel-item.js +1 -0
- package/dist/plugins/plugin-detail-page.d.ts +5 -0
- package/dist/plugins/plugin-detail-page.js +1 -0
- package/dist/plugins/plugin-icon.d.ts +7 -0
- package/dist/plugins/plugin-icon.js +1 -0
- package/dist/plugins/plugin-icons.d.ts +1 -0
- package/dist/plugins/plugin-icons.js +1 -0
- package/dist/plugins/plugins-page.d.ts +12 -0
- package/dist/plugins/plugins-page.js +1 -0
- package/dist/plugins/plugins.css +199 -0
- package/dist/plugins/plugins.d.ts +14 -0
- package/dist/plugins/plugins.js +1 -0
- package/dist/plugins/read-skill-document.d.ts +2 -0
- package/dist/plugins/read-skill-document.js +1 -0
- package/dist/plugins/skill-document.d.ts +7 -0
- package/dist/plugins/skill-document.js +1 -0
- package/dist/plugins/skills-tab.d.ts +6 -0
- package/dist/plugins/skills-tab.js +1 -0
- package/dist/plugins/store.d.ts +62 -0
- package/dist/plugins/store.js +1 -0
- package/dist/plugins/toolbox-layout.d.ts +7 -0
- package/dist/plugins/toolbox-layout.js +1 -0
- package/dist/search/chat-search.css +9 -0
- package/dist/search/chat-search.d.ts +1 -0
- package/dist/search/chat-search.js +1 -1
- package/dist/search/codex-source-matches.d.ts +4 -0
- package/dist/search/codex-source-matches.js +1 -0
- package/dist/search/dom-matches.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/search/literal-matches.js +1 -1
- package/dist/session-list/account-menu.d.ts +26 -0
- package/dist/session-list/account-menu.js +1 -0
- package/dist/session-list/activity-list.d.ts +11 -0
- package/dist/session-list/activity-list.js +1 -0
- package/dist/session-list/archived-sessions.js +1 -1
- package/dist/session-list/help-menu.d.ts +5 -0
- package/dist/session-list/help-menu.js +1 -0
- package/dist/session-list/highlight.js +1 -1
- package/dist/session-list/host.d.ts +2 -0
- package/dist/session-list/host.js +1 -1
- package/dist/session-list/hover-info-card.js +1 -1
- package/dist/session-list/locales.d.ts +91 -0
- package/dist/session-list/locales.js +1 -1
- package/dist/session-list/navigation-header.d.ts +14 -0
- package/dist/session-list/navigation-header.js +1 -0
- package/dist/session-list/navigation-store.d.ts +19 -0
- package/dist/session-list/navigation-store.js +1 -0
- package/dist/session-list/navigation-tabs.d.ts +20 -0
- package/dist/session-list/navigation-tabs.js +1 -0
- package/dist/session-list/navigation.js +1 -1
- package/dist/session-list/overflow-marquee.js +1 -1
- package/dist/session-list/platform.d.ts +2 -0
- package/dist/session-list/platform.js +1 -0
- package/dist/session-list/row-stop-button.js +1 -1
- package/dist/session-list/session-groups.js +1 -1
- package/dist/session-list/session-info-card.js +1 -1
- package/dist/session-list/session-list.d.ts +10 -0
- package/dist/session-list/session-list.js +1 -1
- package/dist/session-list/session-row.js +1 -1
- package/dist/session-list/session-state-dot.js +1 -1
- package/dist/session-list/session-state-menu.js +1 -1
- package/dist/session-list/shortcut-hint.d.ts +14 -0
- package/dist/session-list/shortcut-hint.js +1 -0
- package/dist/session-list/shortcut.d.ts +2 -0
- package/dist/session-list/shortcut.js +1 -0
- package/dist/session-list/sidebar-overlay.js +1 -1
- package/dist/session-list/trailing-swap.js +1 -1
- package/dist/session-list/use-activity-notification.d.ts +1 -0
- package/dist/session-list/use-activity-notification.js +1 -0
- package/dist/session-list/use-activity-preview.js +1 -1
- package/dist/session-list/use-cmd-held.d.ts +1 -0
- package/dist/session-list/use-cmd-held.js +1 -0
- package/dist/session-list/use-project-sessions.js +1 -1
- package/dist/session-list/virtual-session-rows.js +1 -1
- package/dist/session-timeline/activity-group.js +1 -1
- package/dist/session-timeline/activity-projection.js +1 -1
- package/dist/session-timeline/assistant-content.js +1 -1
- package/dist/session-timeline/assistant-turn.js +1 -1
- package/dist/session-timeline/async-questions.js +1 -1
- package/dist/session-timeline/edited-files-card.js +1 -1
- package/dist/session-timeline/history-timeline.js +1 -1
- package/dist/session-timeline/host.js +1 -1
- package/dist/session-timeline/navigation-rail.js +1 -1
- package/dist/session-timeline/plan.js +1 -1
- package/dist/session-timeline/question-reply.js +1 -1
- package/dist/session-timeline/resource-content.js +1 -1
- package/dist/session-timeline/session-timeline.js +1 -1
- package/dist/session-timeline/timeline-registry.js +1 -1
- package/dist/session-timeline/turn-activity.js +1 -1
- package/dist/session-timeline/turn-error.js +1 -1
- package/dist/session-timeline/turn-retry.js +1 -1
- package/dist/session-timeline/turn-time.js +1 -1
- package/dist/session-timeline/turns.js +1 -1
- package/dist/session-timeline/use-timeline-scroll.js +1 -1
- package/dist/session-timeline/user-message.js +1 -1
- package/dist/settings/codex-account-card.d.ts +18 -0
- package/dist/settings/codex-account-card.js +1 -0
- package/dist/settings/login-card.d.ts +6 -0
- package/dist/settings/login-card.js +1 -0
- package/dist/settings/model-alias-settings.d.ts +6 -0
- package/dist/settings/model-alias-settings.js +1 -0
- package/dist/settings/model-aliases.d.ts +17 -0
- package/dist/settings/model-aliases.js +1 -0
- package/dist/settings/provider-logos.d.ts +5 -0
- package/dist/settings/provider-logos.js +1 -0
- package/dist/settings/provider-section.d.ts +52 -0
- package/dist/settings/provider-section.js +1 -0
- package/dist/settings/providers-port.d.ts +32 -0
- package/dist/settings/providers-port.js +1 -0
- package/dist/settings/providers.d.ts +92 -0
- package/dist/settings/providers.js +1 -0
- package/dist/settings/settings-bridge.d.ts +39 -0
- package/dist/settings/settings-bridge.js +1 -0
- package/dist/settings/settings.d.ts +9 -0
- package/dist/settings/settings.js +1 -0
- package/dist/stage.d.ts +1 -0
- package/dist/stage.js +1 -1
- package/emojibase/LICENSE +21 -0
- package/emojibase/en/data.json +51183 -0
- package/emojibase/en/messages.json +124 -0
- package/emojibase/zh/data.json +48992 -0
- package/emojibase/zh/messages.json +124 -0
- package/licenses/_dnd-kit_core-LICENSE +21 -0
- package/licenses/_dnd-kit_sortable-LICENSE +21 -0
- package/licenses/_dnd-kit_utilities-LICENSE +21 -0
- package/licenses/_solar-icons_react-LICENSE +11 -0
- package/licenses/_solar-icons_react-LICENSE-THIRD-PARTY +14 -0
- package/licenses/frimousse-LICENSE +21 -0
- package/package.json +35 -3
- package/rust/Cargo.lock +3844 -0
- package/rust/Cargo.toml +29 -0
- package/rust/build.rs +16 -0
- package/rust/permissions/autogenerated/reference.md +296 -0
- package/rust/permissions/default.toml +20 -0
- package/rust/permissions/schemas/schema.json +292 -0
- package/rust/src/lib.rs +79 -0
- package/rust/src/providers/managed.rs +801 -0
- package/rust/src/providers/tests.rs +681 -0
- package/rust/src/providers.rs +984 -0
- package/rust/src/skills.rs +130 -0
- package/dist/chunk-04mj5ftg.js +0 -7
- package/dist/chunk-0jvfabsq.js +0 -2
- package/dist/chunk-107y8e8x.js +0 -2
- package/dist/chunk-22h5rh2h.js +0 -2
- package/dist/chunk-31yt34hy.js +0 -2
- package/dist/chunk-3hp5t5wf.js +0 -2
- package/dist/chunk-3jcx1ns0.js +0 -2
- package/dist/chunk-3jjc06nd.js +0 -3
- package/dist/chunk-3z8ajtxp.js +0 -2
- package/dist/chunk-4b3g7acq.js +0 -2
- package/dist/chunk-4jkg9p4g.js +0 -2
- package/dist/chunk-4xmbve71.js +0 -4
- package/dist/chunk-50mckd2p.js +0 -2
- package/dist/chunk-54qxv3er.js +0 -2
- package/dist/chunk-5bz1bzsw.js +0 -2
- package/dist/chunk-5dk4xga8.js +0 -2
- package/dist/chunk-5my9w4vd.js +0 -2
- package/dist/chunk-5tqygmg9.js +0 -2
- package/dist/chunk-7dd374an.js +0 -2
- package/dist/chunk-7s7txz2j.js +0 -2
- package/dist/chunk-8hbwf0qe.js +0 -2
- package/dist/chunk-8yj3q7n2.js +0 -2
- package/dist/chunk-9eqezb4k.js +0 -2
- package/dist/chunk-9xfv8jdn.js +0 -2
- package/dist/chunk-a3s36z4s.js +0 -3
- package/dist/chunk-a414w7ah.js +0 -3
- package/dist/chunk-am6tss41.js +0 -2
- package/dist/chunk-b65w6x23.js +0 -2
- package/dist/chunk-cv2j9sjp.js +0 -2
- package/dist/chunk-d1trg76g.js +0 -2
- package/dist/chunk-d6c0mnth.js +0 -2
- package/dist/chunk-dgm4gxkj.js +0 -2
- package/dist/chunk-e6ddpdxn.js +0 -2
- package/dist/chunk-e92r4g3v.js +0 -2
- package/dist/chunk-e9znmqdj.js +0 -2
- package/dist/chunk-eyfdn4p3.js +0 -2
- package/dist/chunk-fcqwzmkd.js +0 -2
- package/dist/chunk-fkwafga0.js +0 -2
- package/dist/chunk-gap8n0vv.js +0 -5
- package/dist/chunk-j5rd55qs.js +0 -3
- package/dist/chunk-j9q2s4kq.js +0 -2
- package/dist/chunk-jnena0v6.js +0 -2
- package/dist/chunk-kkps1qd4.js +0 -4
- package/dist/chunk-mpnv2rht.js +0 -2
- package/dist/chunk-mtydzse4.js +0 -2
- package/dist/chunk-mw9k08ky.js +0 -3
- package/dist/chunk-px6nrr87.js +0 -2
- package/dist/chunk-pzmd5d3m.js +0 -2
- package/dist/chunk-q5az5kp2.js +0 -4
- package/dist/chunk-qqm07rfv.js +0 -2
- package/dist/chunk-qv7kkv47.js +0 -2
- package/dist/chunk-rq04p6pn.js +0 -3
- package/dist/chunk-rx9sdjtn.js +0 -2
- package/dist/chunk-s0b5g8nc.js +0 -2
- package/dist/chunk-syp06z39.js +0 -2
- package/dist/chunk-t6cfjn19.js +0 -2
- package/dist/chunk-vsff9djs.js +0 -2
- package/dist/chunk-vvq50011.js +0 -2
- package/dist/chunk-wkvm8f2e.js +0 -2
- package/dist/chunk-x0tbzjqc.js +0 -2
- package/dist/chunk-x480gyp7.js +0 -2
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
use super::*;
|
|
2
|
+
#[test]
|
|
3
|
+
fn region_change_preserves_private_key_and_public_snapshot_never_contains_it() {
|
|
4
|
+
let saved = update(
|
|
5
|
+
&Saved::default(),
|
|
6
|
+
"qwen".into(),
|
|
7
|
+
Some(Input { api_key: Some("private-test-secret".into()), region: Some("intl".into()), base_url: None }),
|
|
8
|
+
0,
|
|
9
|
+
)
|
|
10
|
+
.unwrap();
|
|
11
|
+
let saved =
|
|
12
|
+
update(&saved, "qwen".into(), Some(Input { api_key: None, region: Some("cn".into()), base_url: None }), 1)
|
|
13
|
+
.unwrap();
|
|
14
|
+
assert_eq!(saved.credentials["qwen"].api_key, "private-test-secret");
|
|
15
|
+
assert_eq!(saved.credentials["qwen"].region.as_deref(), Some("cn"));
|
|
16
|
+
let inner = Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None };
|
|
17
|
+
let public = serde_json::to_string(&inner.snapshot()).unwrap();
|
|
18
|
+
assert!(!public.contains("private-test-secret"));
|
|
19
|
+
assert!(!public.contains("apiKey"));
|
|
20
|
+
assert!(public.contains("pending"));
|
|
21
|
+
}
|
|
22
|
+
#[test]
|
|
23
|
+
fn stale_edits_and_invalid_regions_do_not_replace_credentials() {
|
|
24
|
+
let saved = Saved::default();
|
|
25
|
+
assert!(update(&saved, "qwen".into(), None, 1).is_err());
|
|
26
|
+
assert!(
|
|
27
|
+
update(
|
|
28
|
+
&saved,
|
|
29
|
+
"qwen".into(),
|
|
30
|
+
Some(Input { api_key: Some("test".into()), region: Some("invalid".into()), base_url: None }),
|
|
31
|
+
0
|
|
32
|
+
)
|
|
33
|
+
.is_err()
|
|
34
|
+
);
|
|
35
|
+
assert!(saved.credentials.is_empty());
|
|
36
|
+
}
|
|
37
|
+
#[test]
|
|
38
|
+
fn atomic_storage_roundtrips_and_is_private() {
|
|
39
|
+
let dir = tempfile::tempdir().unwrap();
|
|
40
|
+
let path = dir.path().join("providers.json");
|
|
41
|
+
let saved = update(
|
|
42
|
+
&Saved::default(),
|
|
43
|
+
"deepseek".into(),
|
|
44
|
+
Some(Input { api_key: Some("test".into()), region: None, base_url: None }),
|
|
45
|
+
0,
|
|
46
|
+
)
|
|
47
|
+
.unwrap();
|
|
48
|
+
persist(&path, &saved).unwrap();
|
|
49
|
+
let loaded: Saved = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
|
|
50
|
+
assert_eq!(loaded.revision, 1);
|
|
51
|
+
assert_eq!(loaded.credentials["deepseek"].api_key, "test");
|
|
52
|
+
#[cfg(unix)]
|
|
53
|
+
{
|
|
54
|
+
use std::os::unix::fs::PermissionsExt;
|
|
55
|
+
assert_eq!(std::fs::metadata(path).unwrap().permissions().mode() & 0o777, 0o600);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#[test]
|
|
60
|
+
fn legacy_provider_file_without_page_configuration_still_loads() {
|
|
61
|
+
let saved: Saved = serde_json::from_str(
|
|
62
|
+
r#"{"revision":4,"credentials":{"deepseek":{"apiKey":"private-test-secret","region":null}}}"#,
|
|
63
|
+
)
|
|
64
|
+
.unwrap();
|
|
65
|
+
assert_eq!(saved.revision, 4);
|
|
66
|
+
assert_eq!(saved.credentials["deepseek"].base_url, None);
|
|
67
|
+
assert!(saved.custom_providers.is_empty());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#[test]
|
|
71
|
+
fn built_in_base_url_override_is_normalized_and_keeps_the_private_key() {
|
|
72
|
+
let saved = update(
|
|
73
|
+
&Saved::default(),
|
|
74
|
+
"deepseek".into(),
|
|
75
|
+
Some(Input {
|
|
76
|
+
api_key: Some("private-test-secret".into()),
|
|
77
|
+
region: None,
|
|
78
|
+
base_url: Some("https://gateway.example.test/v1/".into()),
|
|
79
|
+
}),
|
|
80
|
+
0,
|
|
81
|
+
)
|
|
82
|
+
.unwrap();
|
|
83
|
+
assert_eq!(saved.credentials["deepseek"].base_url.as_deref(), Some("https://gateway.example.test/v1"));
|
|
84
|
+
assert!(
|
|
85
|
+
!serde_json::to_string(
|
|
86
|
+
&Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None }
|
|
87
|
+
.snapshot()
|
|
88
|
+
)
|
|
89
|
+
.unwrap()
|
|
90
|
+
.contains("private-test-secret")
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[test]
|
|
95
|
+
fn custom_provider_requires_a_responses_url_and_unique_non_empty_models() {
|
|
96
|
+
let input = CustomInput {
|
|
97
|
+
id: Some("custom_existing".into()),
|
|
98
|
+
name: "Private gateway".into(),
|
|
99
|
+
api_key: Some("private-test-secret".into()),
|
|
100
|
+
base_url: "https://gateway.example.test/v1/".into(),
|
|
101
|
+
models: vec![CustomModel {
|
|
102
|
+
label: "Model A".into(),
|
|
103
|
+
api_id: "model-a".into(),
|
|
104
|
+
context_window: Some(128_000),
|
|
105
|
+
description: Some("Fast".into()),
|
|
106
|
+
}],
|
|
107
|
+
};
|
|
108
|
+
let saved = update_custom(&Saved::default(), input, 0).unwrap();
|
|
109
|
+
let provider = &saved.custom_providers["custom_existing"];
|
|
110
|
+
assert_eq!(provider.base_url, "https://gateway.example.test/v1");
|
|
111
|
+
assert_eq!(provider.models[0].api_id, "model-a");
|
|
112
|
+
assert!(
|
|
113
|
+
!serde_json::to_string(
|
|
114
|
+
&Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None }
|
|
115
|
+
.snapshot()
|
|
116
|
+
)
|
|
117
|
+
.unwrap()
|
|
118
|
+
.contains("private-test-secret")
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
let duplicate = CustomInput {
|
|
122
|
+
id: None,
|
|
123
|
+
name: "Duplicate".into(),
|
|
124
|
+
api_key: Some("key".into()),
|
|
125
|
+
base_url: "https://gateway.example.test/v1".into(),
|
|
126
|
+
models: vec![
|
|
127
|
+
CustomModel { label: "A".into(), api_id: "same".into(), context_window: None, description: None },
|
|
128
|
+
CustomModel { label: "B".into(), api_id: "same".into(), context_window: None, description: None },
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
assert_eq!(update_custom(&Saved::default(), duplicate, 0).unwrap_err(), "Model IDs must be unique");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#[test]
|
|
135
|
+
fn custom_model_json_keeps_the_desktop_api_id_field() {
|
|
136
|
+
let input: CustomInput = serde_json::from_value(json!({
|
|
137
|
+
"id": "custom_private",
|
|
138
|
+
"name": "Private gateway",
|
|
139
|
+
"apiKey": "private-test-secret",
|
|
140
|
+
"baseUrl": "https://gateway.example.test/v1",
|
|
141
|
+
"models": [{"label":"Model A","api_id":"model-a","contextWindow":128000}]
|
|
142
|
+
}))
|
|
143
|
+
.unwrap();
|
|
144
|
+
assert_eq!(input.models[0].api_id, "model-a");
|
|
145
|
+
assert_eq!(serde_json::to_value(&input.models[0]).unwrap()["api_id"], "model-a");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#[test]
|
|
149
|
+
fn removing_a_custom_provider_builds_a_new_revision_without_mutating_the_saved_snapshot() {
|
|
150
|
+
let saved = update_custom(
|
|
151
|
+
&Saved::default(),
|
|
152
|
+
CustomInput {
|
|
153
|
+
id: Some("custom_private".into()),
|
|
154
|
+
name: "Private gateway".into(),
|
|
155
|
+
api_key: Some("private-test-secret".into()),
|
|
156
|
+
base_url: "https://gateway.example.test/v1".into(),
|
|
157
|
+
models: vec![CustomModel {
|
|
158
|
+
label: "Model A".into(),
|
|
159
|
+
api_id: "model-a".into(),
|
|
160
|
+
context_window: None,
|
|
161
|
+
description: None,
|
|
162
|
+
}],
|
|
163
|
+
},
|
|
164
|
+
0,
|
|
165
|
+
)
|
|
166
|
+
.unwrap();
|
|
167
|
+
let next = remove_custom(&saved, "custom_private", 1).unwrap();
|
|
168
|
+
assert_eq!(next.revision, 2);
|
|
169
|
+
assert!(next.custom_providers.is_empty());
|
|
170
|
+
assert!(saved.custom_providers.contains_key("custom_private"));
|
|
171
|
+
assert!(remove_custom(&saved, "custom_private", 0).is_err());
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
#[test]
|
|
175
|
+
fn response_errors_are_classified_and_secrets_are_redacted() {
|
|
176
|
+
let body = r#"{"error":{"message":"Invalid key private-test-secret"}}"#;
|
|
177
|
+
let failure = classify_response_failure(401, body, "private-test-secret");
|
|
178
|
+
assert_eq!(failure.code, "unauthorized");
|
|
179
|
+
assert_eq!(failure.status, Some(401));
|
|
180
|
+
assert!(!failure.message.contains("private-test-secret"));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#[test]
|
|
184
|
+
fn a_success_status_with_a_non_responses_body_is_not_reported_as_connected() {
|
|
185
|
+
let result = classify_success_response(200, "<html>proxy login</html>", 12);
|
|
186
|
+
assert!(!result.ok);
|
|
187
|
+
assert_eq!(result.code, "invalid_response");
|
|
188
|
+
assert_eq!(result.status, Some(200));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#[test]
|
|
192
|
+
fn failed_or_pending_responses_are_not_reported_as_connected() {
|
|
193
|
+
for body in [
|
|
194
|
+
r#"{"object":"response","status":"failed","error":{"message":"Invalid API key"}}"#,
|
|
195
|
+
r#"{"object":"response","status":"completed","error":{"message":"Upstream failed"}}"#,
|
|
196
|
+
r#"{"object":"response","status":"in_progress"}"#,
|
|
197
|
+
r#"{"object":"response"}"#,
|
|
198
|
+
] {
|
|
199
|
+
assert!(!classify_success_response(200, body, 12).ok);
|
|
200
|
+
}
|
|
201
|
+
for status in ["completed", "incomplete"] {
|
|
202
|
+
let body = json!({"object":"response","status":status,"error":null}).to_string();
|
|
203
|
+
assert!(classify_success_response(200, &body, 12).ok);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#[tokio::test]
|
|
208
|
+
async fn unchanged_catalog_acknowledges_revision_while_another_turn_runs() {
|
|
209
|
+
use std::sync::atomic::AtomicBool;
|
|
210
|
+
let (client, calls) = fake_runtime(Arc::new(AtomicBool::new(true)), Arc::new(AtomicBool::new(false)));
|
|
211
|
+
let mut inner = Inner {
|
|
212
|
+
managed_active: false,
|
|
213
|
+
saved: Saved::default(),
|
|
214
|
+
applied: BTreeMap::new(),
|
|
215
|
+
applied_revision: None,
|
|
216
|
+
error: None,
|
|
217
|
+
};
|
|
218
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
219
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
220
|
+
assert!(calls.lock().unwrap().is_empty());
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
#[tokio::test]
|
|
224
|
+
async fn draft_catalog_read_does_not_wait_for_another_sessions_admission() {
|
|
225
|
+
let admission = tokio::sync::Mutex::new(());
|
|
226
|
+
let sending = admission.lock().await;
|
|
227
|
+
let error = try_apply_admission(&admission).unwrap_err();
|
|
228
|
+
assert!(application_pending(&error));
|
|
229
|
+
drop(sending);
|
|
230
|
+
assert!(try_apply_admission(&admission).is_ok());
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
fn pending_provider() -> Inner {
|
|
234
|
+
let saved = update(
|
|
235
|
+
&Saved::default(),
|
|
236
|
+
"qwen".into(),
|
|
237
|
+
Some(Input { api_key: Some("private-test-secret".into()), region: Some("cn".into()), base_url: None }),
|
|
238
|
+
0,
|
|
239
|
+
)
|
|
240
|
+
.unwrap();
|
|
241
|
+
Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#[tokio::test]
|
|
245
|
+
async fn custom_provider_routes_direct_tools_without_changing_built_in_catalogs() {
|
|
246
|
+
use std::sync::atomic::AtomicBool;
|
|
247
|
+
let (client, calls) = fake_runtime(Arc::new(AtomicBool::new(false)), Arc::new(AtomicBool::new(false)));
|
|
248
|
+
let mut inner = pending_provider();
|
|
249
|
+
inner.saved.custom_providers.insert(
|
|
250
|
+
"custom_test".into(),
|
|
251
|
+
CustomProvider {
|
|
252
|
+
id: "custom_test".into(),
|
|
253
|
+
name: "Custom".into(),
|
|
254
|
+
base_url: "https://example.com/v1".into(),
|
|
255
|
+
api_key: "private-test-secret".into(),
|
|
256
|
+
models: vec![CustomModel {
|
|
257
|
+
label: "Model".into(),
|
|
258
|
+
api_id: "model".into(),
|
|
259
|
+
context_window: None,
|
|
260
|
+
description: None,
|
|
261
|
+
}],
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
265
|
+
let calls = calls.lock().unwrap();
|
|
266
|
+
let custom = calls.iter().find(|call| call["params"]["params"]["_meta"]["codex"]["name"] == "Custom").unwrap();
|
|
267
|
+
assert_eq!(
|
|
268
|
+
custom["params"]["params"]["_meta"]["codex"]["config"]["features"],
|
|
269
|
+
json!({"code_mode": false, "code_mode_only": false})
|
|
270
|
+
);
|
|
271
|
+
let catalog_path = custom["params"]["params"]["_meta"]["codex"]["config"]["model_catalog_json"].as_str().unwrap();
|
|
272
|
+
let catalog: Value = serde_json::from_slice(&std::fs::read(catalog_path).unwrap()).unwrap();
|
|
273
|
+
assert_eq!(catalog["models"][0]["slug"], "model");
|
|
274
|
+
assert_eq!(catalog["models"][0]["tool_mode"], "direct");
|
|
275
|
+
let built_in = calls.iter().find(|call| call["params"]["params"]["_meta"]["codex"]["id"] == "qwen").unwrap();
|
|
276
|
+
assert!(built_in["params"]["params"]["_meta"]["codex"]["config"]["features"].is_null());
|
|
277
|
+
}
|
|
278
|
+
fn fake_runtime(
|
|
279
|
+
active: Arc<std::sync::atomic::AtomicBool>, fail: Arc<std::sync::atomic::AtomicBool>,
|
|
280
|
+
) -> (RuntimeClient, Arc<std::sync::Mutex<Vec<Value>>>) {
|
|
281
|
+
fake_runtime_with_busy(active, fail, Arc::new(std::sync::atomic::AtomicBool::new(false)))
|
|
282
|
+
}
|
|
283
|
+
fn fake_runtime_with_busy(
|
|
284
|
+
active: Arc<std::sync::atomic::AtomicBool>, fail: Arc<std::sync::atomic::AtomicBool>,
|
|
285
|
+
busy: Arc<std::sync::atomic::AtomicBool>,
|
|
286
|
+
) -> (RuntimeClient, Arc<std::sync::Mutex<Vec<Value>>>) {
|
|
287
|
+
fake_runtime_state(active, fail, busy, None)
|
|
288
|
+
}
|
|
289
|
+
fn fake_runtime_with_interruption(
|
|
290
|
+
active: Arc<std::sync::atomic::AtomicBool>, fail: Arc<std::sync::atomic::AtomicBool>,
|
|
291
|
+
interruption: Option<&'static str>,
|
|
292
|
+
) -> (RuntimeClient, Arc<std::sync::Mutex<Vec<Value>>>) {
|
|
293
|
+
fake_runtime_state(active, fail, Arc::new(std::sync::atomic::AtomicBool::new(false)), interruption)
|
|
294
|
+
}
|
|
295
|
+
fn fake_runtime_state(
|
|
296
|
+
active: Arc<std::sync::atomic::AtomicBool>, fail: Arc<std::sync::atomic::AtomicBool>,
|
|
297
|
+
busy: Arc<std::sync::atomic::AtomicBool>, interruption: Option<&'static str>,
|
|
298
|
+
) -> (RuntimeClient, Arc<std::sync::Mutex<Vec<Value>>>) {
|
|
299
|
+
use std::sync::atomic::Ordering;
|
|
300
|
+
use tokio::io::{AsyncBufReadExt, AsyncWriteExt};
|
|
301
|
+
let (host, peer) = tokio::io::duplex(16384);
|
|
302
|
+
let (reader, writer) = tokio::io::split(host);
|
|
303
|
+
let client = RuntimeClient::over(reader, writer);
|
|
304
|
+
let calls = Arc::new(std::sync::Mutex::new(Vec::new()));
|
|
305
|
+
let recorded = Arc::clone(&calls);
|
|
306
|
+
tokio::spawn(async move {
|
|
307
|
+
let (reader, mut writer) = tokio::io::split(peer);
|
|
308
|
+
let mut lines = tokio::io::BufReader::new(reader).lines();
|
|
309
|
+
while let Ok(Some(line)) = lines.next_line().await {
|
|
310
|
+
let frame: Value = serde_json::from_str(&line).unwrap();
|
|
311
|
+
let (result, error) = if frame["method"] == "runStates" {
|
|
312
|
+
(
|
|
313
|
+
if active.load(Ordering::SeqCst) {
|
|
314
|
+
json!([{"sessionId":"active","state":if interruption.is_some() { "requires_action" } else { "running" },"version":1,"interruption":interruption,"reusableDraft":false,"owner":"u","cwd":"/tmp","title":"","since":0,"tasks":[],"listeningPorts":[],"executionId":null,"executionRole":null,"lastActivityAt":0}])
|
|
315
|
+
} else {
|
|
316
|
+
json!([])
|
|
317
|
+
},
|
|
318
|
+
Value::Null,
|
|
319
|
+
)
|
|
320
|
+
} else {
|
|
321
|
+
recorded.lock().unwrap().push(frame.clone());
|
|
322
|
+
if busy.load(Ordering::SeqCst) && frame["params"]["params"]["_meta"]["codex"]["id"] == "qwen" {
|
|
323
|
+
(
|
|
324
|
+
Value::Null,
|
|
325
|
+
json!({"code":-32600,"message":"Invalid request: Wait for affected sessions to finish before changing their provider"}),
|
|
326
|
+
)
|
|
327
|
+
} else if fail.load(Ordering::SeqCst) {
|
|
328
|
+
(Value::Null, json!({"code":-32000,"message":"private-test-secret upstream failure"}))
|
|
329
|
+
} else {
|
|
330
|
+
(json!({}), Value::Null)
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
let response = json!({"id":frame["id"],"result":result,"error":error}).to_string() + "\n";
|
|
334
|
+
if writer.write_all(response.as_bytes()).await.is_err() {
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
(client, calls)
|
|
340
|
+
}
|
|
341
|
+
#[tokio::test]
|
|
342
|
+
async fn restored_interrupted_session_allows_saved_provider_application() {
|
|
343
|
+
use std::sync::atomic::AtomicBool;
|
|
344
|
+
let (client, calls) = fake_runtime_with_interruption(
|
|
345
|
+
Arc::new(AtomicBool::new(true)),
|
|
346
|
+
Arc::new(AtomicBool::new(false)),
|
|
347
|
+
Some("runtime_stopped"),
|
|
348
|
+
);
|
|
349
|
+
let mut inner = pending_provider();
|
|
350
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
351
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
352
|
+
assert_eq!(calls.lock().unwrap().len(), 1);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#[tokio::test]
|
|
356
|
+
async fn auxiliary_catalog_targets_only_ephemeral_agent_while_main_turn_runs() {
|
|
357
|
+
use std::sync::atomic::AtomicBool;
|
|
358
|
+
let (client, calls) = fake_runtime(Arc::new(AtomicBool::new(true)), Arc::new(AtomicBool::new(false)));
|
|
359
|
+
let main = pending_provider();
|
|
360
|
+
let before = serde_json::to_value(main.snapshot()).unwrap();
|
|
361
|
+
let mut ephemeral = Inner {
|
|
362
|
+
managed_active: false,
|
|
363
|
+
saved: main.saved.clone(),
|
|
364
|
+
applied: BTreeMap::new(),
|
|
365
|
+
applied_revision: None,
|
|
366
|
+
error: None,
|
|
367
|
+
};
|
|
368
|
+
reconcile_target(&mut ephemeral, &client, std::path::Path::new("/resources"), "gamepad-config-test").await.unwrap();
|
|
369
|
+
assert_eq!(serde_json::to_value(main.snapshot()).unwrap(), before);
|
|
370
|
+
let calls = calls.lock().unwrap();
|
|
371
|
+
assert_eq!(calls.len(), 1);
|
|
372
|
+
assert_eq!(calls[0]["params"]["agentId"], "gamepad-config-test");
|
|
373
|
+
assert_eq!(calls[0]["params"]["method"], "providers/set");
|
|
374
|
+
assert_eq!(ephemeral.applied_revision, Some(main.saved.revision));
|
|
375
|
+
assert_eq!(main.applied_revision, None);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
#[tokio::test]
|
|
379
|
+
async fn unrelated_active_turn_does_not_block_new_provider() {
|
|
380
|
+
use std::sync::atomic::AtomicBool;
|
|
381
|
+
let (client, calls) = fake_runtime(Arc::new(AtomicBool::new(true)), Arc::new(AtomicBool::new(false)));
|
|
382
|
+
let mut inner = pending_provider();
|
|
383
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
384
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
385
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
386
|
+
assert_eq!(inner.applied_revision, Some(1));
|
|
387
|
+
assert_eq!(calls.lock().unwrap().len(), 1);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
#[tokio::test]
|
|
391
|
+
async fn busy_provider_does_not_block_independent_changes_and_retries_only_pending() {
|
|
392
|
+
use std::sync::atomic::{AtomicBool, Ordering};
|
|
393
|
+
let busy = Arc::new(AtomicBool::new(true));
|
|
394
|
+
let (client, calls) =
|
|
395
|
+
fake_runtime_with_busy(Arc::new(AtomicBool::new(false)), Arc::new(AtomicBool::new(false)), busy.clone());
|
|
396
|
+
let mut inner = pending_provider();
|
|
397
|
+
let mut key = inner.saved.credentials["qwen"].clone();
|
|
398
|
+
key.region = None;
|
|
399
|
+
inner.saved.credentials.insert("xai".into(), key);
|
|
400
|
+
assert!(reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.is_err());
|
|
401
|
+
assert_eq!(inner.snapshot().status, "pending");
|
|
402
|
+
assert!(inner.error.is_none());
|
|
403
|
+
assert!(inner.applied.contains_key("xai"));
|
|
404
|
+
assert!(!inner.applied.contains_key("qwen"));
|
|
405
|
+
busy.store(false, Ordering::SeqCst);
|
|
406
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
407
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
408
|
+
let calls = calls.lock().unwrap();
|
|
409
|
+
let ids: Vec<_> =
|
|
410
|
+
calls.iter().map(|call| call["params"]["params"]["_meta"]["codex"]["id"].as_str().unwrap()).collect();
|
|
411
|
+
assert_eq!(ids, vec!["qwen", "xai", "qwen"]);
|
|
412
|
+
}
|
|
413
|
+
#[tokio::test]
|
|
414
|
+
async fn busy_removal_keeps_routing_while_other_removals_apply() {
|
|
415
|
+
use std::sync::atomic::{AtomicBool, Ordering};
|
|
416
|
+
let busy = Arc::new(AtomicBool::new(true));
|
|
417
|
+
let (client, calls) =
|
|
418
|
+
fake_runtime_with_busy(Arc::new(AtomicBool::new(false)), Arc::new(AtomicBool::new(false)), busy.clone());
|
|
419
|
+
let mut inner = pending_provider();
|
|
420
|
+
let old = AppliedProvider::BuiltIn(inner.saved.credentials["qwen"].clone());
|
|
421
|
+
inner.applied.insert("qwen".into(), old.clone());
|
|
422
|
+
inner.applied.insert("xai".into(), old);
|
|
423
|
+
inner.applied_revision = Some(0);
|
|
424
|
+
inner.saved.credentials.clear();
|
|
425
|
+
assert!(reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.is_err());
|
|
426
|
+
assert_eq!(inner.snapshot().status, "pending");
|
|
427
|
+
assert!(inner.applied.contains_key("qwen"));
|
|
428
|
+
assert!(!inner.applied.contains_key("xai"));
|
|
429
|
+
busy.store(false, Ordering::SeqCst);
|
|
430
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
431
|
+
assert!(inner.applied.is_empty());
|
|
432
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
433
|
+
let calls = calls.lock().unwrap();
|
|
434
|
+
assert_eq!(calls.len(), 3);
|
|
435
|
+
assert!(calls.iter().all(|call| call["params"]["method"] == "providers/disable"));
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
#[test]
|
|
439
|
+
fn only_the_adapter_busy_response_is_pending_and_raw_errors_stay_private() {
|
|
440
|
+
let mut pending = false;
|
|
441
|
+
let mut failures = Vec::new();
|
|
442
|
+
record_application_error(
|
|
443
|
+
"qwen",
|
|
444
|
+
"apply",
|
|
445
|
+
&ResponseError::new(-32600, "private-test-secret"),
|
|
446
|
+
&mut pending,
|
|
447
|
+
&mut failures,
|
|
448
|
+
);
|
|
449
|
+
assert!(!pending);
|
|
450
|
+
assert_eq!(failures.len(), 1);
|
|
451
|
+
assert!(!failures[0].contains("private-test-secret"));
|
|
452
|
+
assert!(application_pending(PROVIDERS_PENDING));
|
|
453
|
+
assert!(!application_pending(&failures[0]));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
#[tokio::test]
|
|
457
|
+
async fn failed_apply_is_not_acknowledged_and_can_retry_without_exposing_private_error() {
|
|
458
|
+
use std::sync::atomic::{AtomicBool, Ordering};
|
|
459
|
+
let fail = Arc::new(AtomicBool::new(true));
|
|
460
|
+
let (client, calls) = fake_runtime(Arc::new(AtomicBool::new(false)), fail.clone());
|
|
461
|
+
let mut inner = pending_provider();
|
|
462
|
+
assert!(reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.is_err());
|
|
463
|
+
assert_eq!(inner.applied_revision, None);
|
|
464
|
+
assert!(inner.applied.is_empty());
|
|
465
|
+
assert_eq!(inner.snapshot().status, "failed");
|
|
466
|
+
assert!(!serde_json::to_string(&inner.snapshot()).unwrap().contains("private-test-secret"));
|
|
467
|
+
fail.store(false, Ordering::SeqCst);
|
|
468
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
469
|
+
assert_eq!(inner.snapshot().status, "applied");
|
|
470
|
+
inner.saved = update(&inner.saved, "qwen".into(), None, 1).unwrap();
|
|
471
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
472
|
+
assert_eq!(calls.lock().unwrap().last().unwrap()["params"]["method"], "providers/disable");
|
|
473
|
+
assert!(inner.applied.is_empty());
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
#[tokio::test]
|
|
477
|
+
async fn custom_provider_models_are_mapped_from_page_schema_to_adapter_schema() {
|
|
478
|
+
let saved = update_custom(
|
|
479
|
+
&Saved::default(),
|
|
480
|
+
CustomInput {
|
|
481
|
+
id: Some("custom_private".into()),
|
|
482
|
+
name: "Private gateway".into(),
|
|
483
|
+
api_key: Some("private-test-secret".into()),
|
|
484
|
+
base_url: "https://gateway.example.test/v1".into(),
|
|
485
|
+
models: vec![CustomModel {
|
|
486
|
+
label: "Model A".into(),
|
|
487
|
+
api_id: "model-a".into(),
|
|
488
|
+
context_window: Some(128_000),
|
|
489
|
+
description: Some("Fast".into()),
|
|
490
|
+
}],
|
|
491
|
+
},
|
|
492
|
+
0,
|
|
493
|
+
)
|
|
494
|
+
.unwrap();
|
|
495
|
+
let (client, calls) = fake_runtime(
|
|
496
|
+
Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
|
497
|
+
Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
|
498
|
+
);
|
|
499
|
+
let mut inner =
|
|
500
|
+
Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None };
|
|
501
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
502
|
+
{
|
|
503
|
+
let recorded = calls.lock().unwrap();
|
|
504
|
+
let params = &recorded[0]["params"]["params"];
|
|
505
|
+
let runtime_id = params["_meta"]["codex"]["id"].as_str().unwrap();
|
|
506
|
+
assert!(runtime_id.bytes().all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit() || byte == b'-'));
|
|
507
|
+
assert_eq!(runtime_id, "custom-637573746f6d5f70726976617465");
|
|
508
|
+
assert_eq!(params["baseUrl"], "https://gateway.example.test/v1");
|
|
509
|
+
assert_eq!(params["_meta"]["codex"]["name"], "Private gateway");
|
|
510
|
+
let config = ¶ms["_meta"]["codex"]["config"];
|
|
511
|
+
assert_eq!(config["features"], json!({"code_mode": false, "code_mode_only": false}));
|
|
512
|
+
let catalog: Value =
|
|
513
|
+
serde_json::from_slice(&std::fs::read(config["model_catalog_json"].as_str().unwrap()).unwrap()).unwrap();
|
|
514
|
+
assert_eq!(catalog["models"][0]["slug"], "model-a");
|
|
515
|
+
assert_eq!(catalog["models"][0]["context_window"], 128000);
|
|
516
|
+
assert_eq!(
|
|
517
|
+
params["_meta"]["alwith"]["models"],
|
|
518
|
+
json!([{
|
|
519
|
+
"id": "model-a",
|
|
520
|
+
"label": "Model A",
|
|
521
|
+
"description": "Fast",
|
|
522
|
+
"contextWindow": 128000
|
|
523
|
+
}])
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
inner.saved = remove_custom(&inner.saved, "custom_private", 1).unwrap();
|
|
527
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
528
|
+
let calls = calls.lock().unwrap();
|
|
529
|
+
assert_eq!(calls[1]["params"]["params"]["_meta"]["codex"]["id"], "custom-637573746f6d5f70726976617465");
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
#[tokio::test]
|
|
533
|
+
async fn recognized_custom_models_receive_their_catalog_without_changing_routing() {
|
|
534
|
+
let provider = CustomProvider {
|
|
535
|
+
id: "custom_profile".into(),
|
|
536
|
+
name: "Zhipu".into(),
|
|
537
|
+
base_url: "https://open.bigmodel.cn/api/v1".into(),
|
|
538
|
+
api_key: "private-test-secret".into(),
|
|
539
|
+
models: vec![CustomModel {
|
|
540
|
+
label: "My GLM".into(),
|
|
541
|
+
api_id: "glm-5.3".into(),
|
|
542
|
+
context_window: None,
|
|
543
|
+
description: None,
|
|
544
|
+
}],
|
|
545
|
+
};
|
|
546
|
+
let saved = Saved { custom_providers: BTreeMap::from([(provider.id.clone(), provider)]), ..Saved::default() };
|
|
547
|
+
let (client, calls) = fake_runtime(
|
|
548
|
+
Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
|
549
|
+
Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
|
550
|
+
);
|
|
551
|
+
let mut inner =
|
|
552
|
+
Inner { managed_active: false, saved, applied: BTreeMap::new(), applied_revision: None, error: None };
|
|
553
|
+
reconcile(&mut inner, &client, std::path::Path::new("/resources")).await.unwrap();
|
|
554
|
+
let calls = calls.lock().unwrap();
|
|
555
|
+
let params = &calls[0]["params"]["params"];
|
|
556
|
+
assert_eq!(params["baseUrl"], "https://open.bigmodel.cn/api/v1");
|
|
557
|
+
assert_eq!(params["_meta"]["alwith"]["models"][0]["id"], "glm-5.3");
|
|
558
|
+
assert_eq!(params["_meta"]["alwith"]["models"][0]["label"], "My GLM");
|
|
559
|
+
assert_eq!(params["_meta"]["codex"]["config"]["model_catalog_json"], "/resources/custom/models.json");
|
|
560
|
+
assert_eq!(params["_meta"]["codex"]["config"]["web_search"], "disabled");
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
#[test]
|
|
564
|
+
fn connection_test_builds_a_minimal_authenticated_responses_request() {
|
|
565
|
+
let client = reqwest::Client::new();
|
|
566
|
+
let request = build_test_request(
|
|
567
|
+
&client,
|
|
568
|
+
&TestConfig {
|
|
569
|
+
base_url: "http://127.0.0.1:43210/v1".into(),
|
|
570
|
+
api_key: "private-test-secret".into(),
|
|
571
|
+
model: "model-a".into(),
|
|
572
|
+
},
|
|
573
|
+
)
|
|
574
|
+
.unwrap();
|
|
575
|
+
assert_eq!(request.method(), reqwest::Method::POST);
|
|
576
|
+
assert_eq!(request.url().as_str(), "http://127.0.0.1:43210/v1/responses");
|
|
577
|
+
assert_eq!(request.headers()[reqwest::header::AUTHORIZATION], "Bearer private-test-secret");
|
|
578
|
+
let body = request.body().and_then(reqwest::Body::as_bytes).unwrap();
|
|
579
|
+
let body: Value = serde_json::from_slice(body).unwrap();
|
|
580
|
+
assert_eq!(body, json!({"model":"model-a","input":"Reply with OK.","max_output_tokens":16,"store":false}));
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
#[cfg(test)]
|
|
584
|
+
mod managed_tests {
|
|
585
|
+
use super::super::*;
|
|
586
|
+
|
|
587
|
+
#[test]
|
|
588
|
+
fn account_provider_cannot_be_configured_with_a_manual_key() {
|
|
589
|
+
assert_eq!(managed_definition()["source"], "account");
|
|
590
|
+
assert!(definition(managed::ID).is_err());
|
|
591
|
+
assert!(
|
|
592
|
+
update(
|
|
593
|
+
&Saved::default(),
|
|
594
|
+
managed::ID.into(),
|
|
595
|
+
Some(Input { api_key: Some("manual-key".into()), region: None, base_url: None }),
|
|
596
|
+
0
|
|
597
|
+
)
|
|
598
|
+
.is_err()
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
#[test]
|
|
603
|
+
fn source_metadata_only_overrides_issued_models() {
|
|
604
|
+
let mut models = json!([
|
|
605
|
+
{"id":"deepseek-V4.1-flash","label":"Account name","contextWindow":123},
|
|
606
|
+
{"id":"unknown","label":"Account-only model","contextWindow":456}
|
|
607
|
+
]);
|
|
608
|
+
apply_managed_model_overrides(&mut models);
|
|
609
|
+
assert_eq!(models.as_array().unwrap().len(), 2);
|
|
610
|
+
assert_eq!(models[0]["id"], "deepseek-V4.1-flash");
|
|
611
|
+
assert_eq!(models[0]["label"], "DeepSeek-Flash");
|
|
612
|
+
assert_eq!(models[0]["contextWindow"], 1048576);
|
|
613
|
+
assert_eq!(models[1], json!({"id":"unknown","label":"Account-only model","contextWindow":456}));
|
|
614
|
+
let mut unissued = json!([]);
|
|
615
|
+
apply_managed_model_overrides(&mut unissued);
|
|
616
|
+
assert_eq!(unissued, json!([]));
|
|
617
|
+
let root = tempfile::tempdir().unwrap();
|
|
618
|
+
write_model_catalogs(root.path()).unwrap();
|
|
619
|
+
assert!(catalog_paths(root.path()).unwrap().contains(&root.path().join("alwith/models.json")));
|
|
620
|
+
assert_eq!(
|
|
621
|
+
std::fs::read_to_string(root.path().join("custom/models.json")).unwrap(),
|
|
622
|
+
bundled_catalog("custom/models.json")
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
#[test]
|
|
627
|
+
fn managed_catalog_filters_unissued_hidden_and_other_protocols() {
|
|
628
|
+
let body = json!([
|
|
629
|
+
{"provider_id":"litellm","name":"ALwith","base_url":"https://gateway.test/v1","api_key":"secret-key","hidden":false,"models":[{"api_id":"ds-pro","label":"DS Pro","context_window":1000000}]},
|
|
630
|
+
{"provider_id":"openrouter","api_key":"other-secret"}
|
|
631
|
+
]);
|
|
632
|
+
let provider = managed::parse_catalog(&body.to_string()).unwrap().unwrap();
|
|
633
|
+
assert_eq!(provider.id, "litellm");
|
|
634
|
+
assert_eq!(provider.models[0].context_window, Some(1000000));
|
|
635
|
+
let mut hidden = body.clone();
|
|
636
|
+
hidden[0]["hidden"] = json!(true);
|
|
637
|
+
assert!(managed::parse_catalog(&hidden.to_string()).unwrap().is_none());
|
|
638
|
+
hidden[0]["hidden"] = json!(false);
|
|
639
|
+
hidden[0]["api_key"] = json!(" ");
|
|
640
|
+
assert!(managed::parse_catalog(&hidden.to_string()).unwrap().is_none());
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
#[test]
|
|
644
|
+
fn managed_cache_stays_private_and_user_edits_preserve_it() {
|
|
645
|
+
let saved = Saved { managed: Some(managed::Cache {
|
|
646
|
+
account: managed::Account { api_base_url: "https://api.alwith.ai/service".into(), user_uuid: "account-a".into() },
|
|
647
|
+
provider: managed::parse_catalog(&json!([{"provider_id":"litellm","name":"ALwith","base_url":"https://gateway.test/v1","api_key":"private-model-key","hidden":false,"models":[{"api_id":"m","label":"Model"}]}]).to_string()).unwrap(),
|
|
648
|
+
}), ..Saved::default() };
|
|
649
|
+
let edited = update(
|
|
650
|
+
&saved,
|
|
651
|
+
"deepseek".into(),
|
|
652
|
+
Some(Input { api_key: Some("user-key".into()), region: None, base_url: None }),
|
|
653
|
+
0,
|
|
654
|
+
)
|
|
655
|
+
.unwrap();
|
|
656
|
+
assert_eq!(edited.managed.as_ref().unwrap().account.user_uuid, "account-a");
|
|
657
|
+
let mut inner = Inner {
|
|
658
|
+
managed_active: false,
|
|
659
|
+
saved: edited,
|
|
660
|
+
applied: BTreeMap::new(),
|
|
661
|
+
applied_revision: None,
|
|
662
|
+
error: None,
|
|
663
|
+
};
|
|
664
|
+
assert!(inner.snapshot().managed_providers.is_empty());
|
|
665
|
+
inner.managed_active = true;
|
|
666
|
+
assert_eq!(inner.snapshot().managed_providers[0].models[0].api_id, "m");
|
|
667
|
+
let snapshot = serde_json::to_string(&inner.snapshot()).unwrap();
|
|
668
|
+
assert!(!snapshot.contains("private-model-key"));
|
|
669
|
+
assert!(!snapshot.contains("user-key"));
|
|
670
|
+
let legacy: Saved = serde_json::from_str(r#"{"revision":0,"credentials":{}}"#).unwrap();
|
|
671
|
+
assert!(legacy.managed.is_none());
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
#[test]
|
|
675
|
+
fn malformed_managed_catalog_never_echoes_keys_and_rejects_duplicate_models() {
|
|
676
|
+
let body = json!([{"provider_id":"litellm","name":"ALwith","base_url":"https://gateway.test/v1","api_key":"private-secret","hidden":false,"models":[{"api_id":"same","label":"One"},{"api_id":"same","label":"Two"}]}]);
|
|
677
|
+
let error = managed::parse_catalog(&body.to_string()).unwrap_err();
|
|
678
|
+
assert!(!error.contains("private-secret"));
|
|
679
|
+
assert!(managed::parse_catalog("not-json").is_err());
|
|
680
|
+
}
|
|
681
|
+
}
|