@agent-native/creative-context 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/agent-native.package.json +104 -0
- package/dist/actions/confirm-canonical-logo.d.ts +6 -0
- package/dist/actions/confirm-canonical-logo.d.ts.map +1 -0
- package/dist/actions/confirm-canonical-logo.js +19 -0
- package/dist/actions/confirm-canonical-logo.js.map +1 -0
- package/dist/actions/continue-context-import.d.ts +7 -0
- package/dist/actions/continue-context-import.d.ts.map +1 -0
- package/dist/actions/continue-context-import.js +10 -0
- package/dist/actions/continue-context-import.js.map +1 -0
- package/dist/actions/creative-context-a2a.d.ts +10 -0
- package/dist/actions/creative-context-a2a.d.ts.map +1 -0
- package/dist/actions/creative-context-a2a.js +66 -0
- package/dist/actions/creative-context-a2a.js.map +1 -0
- package/dist/actions/get-brand-profile.d.ts +33 -0
- package/dist/actions/get-brand-profile.d.ts.map +1 -0
- package/dist/actions/get-brand-profile.js +13 -0
- package/dist/actions/get-brand-profile.js.map +1 -0
- package/dist/actions/get-context-import-status.d.ts +22 -0
- package/dist/actions/get-context-import-status.d.ts.map +1 -0
- package/dist/actions/get-context-import-status.js +12 -0
- package/dist/actions/get-context-import-status.js.map +1 -0
- package/dist/actions/get-context-item.d.ts +2 -0
- package/dist/actions/get-context-item.d.ts.map +1 -0
- package/dist/actions/get-context-item.js +2 -0
- package/dist/actions/get-context-item.js.map +1 -0
- package/dist/actions/get-context-pack.d.ts +7 -0
- package/dist/actions/get-context-pack.d.ts.map +1 -0
- package/dist/actions/get-context-pack.js +12 -0
- package/dist/actions/get-context-pack.js.map +1 -0
- package/dist/actions/get-creative-context.d.ts +119 -0
- package/dist/actions/get-creative-context.d.ts.map +1 -0
- package/dist/actions/get-creative-context.js +112 -0
- package/dist/actions/get-creative-context.js.map +1 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +63 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/infer-brand-dna.d.ts +52 -0
- package/dist/actions/infer-brand-dna.d.ts.map +1 -0
- package/dist/actions/infer-brand-dna.js +13 -0
- package/dist/actions/infer-brand-dna.js.map +1 -0
- package/dist/actions/list-canonical-logo-candidates.d.ts +9 -0
- package/dist/actions/list-canonical-logo-candidates.d.ts.map +1 -0
- package/dist/actions/list-canonical-logo-candidates.js +82 -0
- package/dist/actions/list-canonical-logo-candidates.js.map +1 -0
- package/dist/actions/list-context-connections.d.ts +22 -0
- package/dist/actions/list-context-connections.d.ts.map +1 -0
- package/dist/actions/list-context-connections.js +43 -0
- package/dist/actions/list-context-connections.js.map +1 -0
- package/dist/actions/list-context-packs.d.ts +10 -0
- package/dist/actions/list-context-packs.d.ts.map +1 -0
- package/dist/actions/list-context-packs.js +16 -0
- package/dist/actions/list-context-packs.js.map +1 -0
- package/dist/actions/list-context-sources.d.ts +12 -0
- package/dist/actions/list-context-sources.d.ts.map +1 -0
- package/dist/actions/list-context-sources.js +20 -0
- package/dist/actions/list-context-sources.js.map +1 -0
- package/dist/actions/list-context-suggestions.d.ts +13 -0
- package/dist/actions/list-context-suggestions.d.ts.map +1 -0
- package/dist/actions/list-context-suggestions.js +28 -0
- package/dist/actions/list-context-suggestions.js.map +1 -0
- package/dist/actions/manage-brand-profile.d.ts +28 -0
- package/dist/actions/manage-brand-profile.d.ts.map +1 -0
- package/dist/actions/manage-brand-profile.js +47 -0
- package/dist/actions/manage-brand-profile.js.map +1 -0
- package/dist/actions/manage-context-pack.d.ts +33 -0
- package/dist/actions/manage-context-pack.d.ts.map +1 -0
- package/dist/actions/manage-context-pack.js +65 -0
- package/dist/actions/manage-context-pack.js.map +1 -0
- package/dist/actions/manage-context-source.d.ts +51 -0
- package/dist/actions/manage-context-source.d.ts.map +1 -0
- package/dist/actions/manage-context-source.js +137 -0
- package/dist/actions/manage-context-source.js.map +1 -0
- package/dist/actions/manage-layout-template.d.ts +13 -0
- package/dist/actions/manage-layout-template.d.ts.map +1 -0
- package/dist/actions/manage-layout-template.js +43 -0
- package/dist/actions/manage-layout-template.js.map +1 -0
- package/dist/actions/preview-context-import.d.ts +23 -0
- package/dist/actions/preview-context-import.d.ts.map +1 -0
- package/dist/actions/preview-context-import.js +57 -0
- package/dist/actions/preview-context-import.js.map +1 -0
- package/dist/actions/process-context-purge.d.ts +22 -0
- package/dist/actions/process-context-purge.d.ts.map +1 -0
- package/dist/actions/process-context-purge.js +19 -0
- package/dist/actions/process-context-purge.js.map +1 -0
- package/dist/actions/propose-brand-dna.d.ts +15 -0
- package/dist/actions/propose-brand-dna.d.ts.map +1 -0
- package/dist/actions/propose-brand-dna.js +19 -0
- package/dist/actions/propose-brand-dna.js.map +1 -0
- package/dist/actions/propose-canonical-logo.d.ts +9 -0
- package/dist/actions/propose-canonical-logo.d.ts.map +1 -0
- package/dist/actions/propose-canonical-logo.js +16 -0
- package/dist/actions/propose-canonical-logo.js.map +1 -0
- package/dist/actions/publish-brand-dna.d.ts +13 -0
- package/dist/actions/publish-brand-dna.d.ts.map +1 -0
- package/dist/actions/publish-brand-dna.js +23 -0
- package/dist/actions/publish-brand-dna.js.map +1 -0
- package/dist/actions/recommend-context-roots.d.ts +14 -0
- package/dist/actions/recommend-context-roots.d.ts.map +1 -0
- package/dist/actions/recommend-context-roots.js +22 -0
- package/dist/actions/recommend-context-roots.js.map +1 -0
- package/dist/actions/record-context-feedback.d.ts +10 -0
- package/dist/actions/record-context-feedback.d.ts.map +1 -0
- package/dist/actions/record-context-feedback.js +14 -0
- package/dist/actions/record-context-feedback.js.map +1 -0
- package/dist/actions/review-context-items.d.ts +35 -0
- package/dist/actions/review-context-items.d.ts.map +1 -0
- package/dist/actions/review-context-items.js +65 -0
- package/dist/actions/review-context-items.js.map +1 -0
- package/dist/actions/run-embedding-bakeoff.d.ts +15 -0
- package/dist/actions/run-embedding-bakeoff.d.ts.map +1 -0
- package/dist/actions/run-embedding-bakeoff.js +72 -0
- package/dist/actions/run-embedding-bakeoff.js.map +1 -0
- package/dist/actions/search-creative-context.d.ts +75 -0
- package/dist/actions/search-creative-context.d.ts.map +1 -0
- package/dist/actions/search-creative-context.js +41 -0
- package/dist/actions/search-creative-context.js.map +1 -0
- package/dist/actions/set-brand-dna.d.ts +15 -0
- package/dist/actions/set-brand-dna.d.ts.map +1 -0
- package/dist/actions/set-brand-dna.js +19 -0
- package/dist/actions/set-brand-dna.js.map +1 -0
- package/dist/actions/start-context-enrichment.d.ts +10 -0
- package/dist/actions/start-context-enrichment.d.ts.map +1 -0
- package/dist/actions/start-context-enrichment.js +46 -0
- package/dist/actions/start-context-enrichment.js.map +1 -0
- package/dist/actions/start-context-import.d.ts +9 -0
- package/dist/actions/start-context-import.d.ts.map +1 -0
- package/dist/actions/start-context-import.js +36 -0
- package/dist/actions/start-context-import.js.map +1 -0
- package/dist/client/CreativeContextChip.d.ts +13 -0
- package/dist/client/CreativeContextChip.d.ts.map +1 -0
- package/dist/client/CreativeContextChip.js +45 -0
- package/dist/client/CreativeContextChip.js.map +1 -0
- package/dist/client/CreativeContextPanel.d.ts +131 -0
- package/dist/client/CreativeContextPanel.d.ts.map +1 -0
- package/dist/client/CreativeContextPanel.js +778 -0
- package/dist/client/CreativeContextPanel.js.map +1 -0
- package/dist/client/CreativeContextSettingsLink.d.ts +4 -0
- package/dist/client/CreativeContextSettingsLink.d.ts.map +1 -0
- package/dist/client/CreativeContextSettingsLink.js +8 -0
- package/dist/client/CreativeContextSettingsLink.js.map +1 -0
- package/dist/client/actions.d.ts +256 -0
- package/dist/client/actions.d.ts.map +1 -0
- package/dist/client/actions.js +89 -0
- package/dist/client/actions.js.map +1 -0
- package/dist/client/agent-tab.d.ts +9 -0
- package/dist/client/agent-tab.d.ts.map +1 -0
- package/dist/client/agent-tab.js +32 -0
- package/dist/client/agent-tab.js.map +1 -0
- package/dist/client/application-state.d.ts +22 -0
- package/dist/client/application-state.d.ts.map +1 -0
- package/dist/client/application-state.js +88 -0
- package/dist/client/application-state.js.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +8 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/messages.d.ts +5 -0
- package/dist/client/messages.d.ts.map +1 -0
- package/dist/client/messages.js +1059 -0
- package/dist/client/messages.js.map +1 -0
- package/dist/connectors/context.d.ts +9 -0
- package/dist/connectors/context.d.ts.map +1 -0
- package/dist/connectors/context.js +59 -0
- package/dist/connectors/context.js.map +1 -0
- package/dist/connectors/document-parser.d.ts +2 -0
- package/dist/connectors/document-parser.d.ts.map +1 -0
- package/dist/connectors/document-parser.js +2 -0
- package/dist/connectors/document-parser.js.map +1 -0
- package/dist/connectors/figma-native.d.ts +18 -0
- package/dist/connectors/figma-native.d.ts.map +1 -0
- package/dist/connectors/figma-native.js +883 -0
- package/dist/connectors/figma-native.js.map +1 -0
- package/dist/connectors/figma.d.ts +10 -0
- package/dist/connectors/figma.d.ts.map +1 -0
- package/dist/connectors/figma.js +166 -0
- package/dist/connectors/figma.js.map +1 -0
- package/dist/connectors/google-slides-native.d.ts +58 -0
- package/dist/connectors/google-slides-native.d.ts.map +1 -0
- package/dist/connectors/google-slides-native.js +1118 -0
- package/dist/connectors/google-slides-native.js.map +1 -0
- package/dist/connectors/google-slides.d.ts +15 -0
- package/dist/connectors/google-slides.d.ts.map +1 -0
- package/dist/connectors/google-slides.js +896 -0
- package/dist/connectors/google-slides.js.map +1 -0
- package/dist/connectors/index.d.ts +20 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +44 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/manual.d.ts +9 -0
- package/dist/connectors/manual.d.ts.map +1 -0
- package/dist/connectors/manual.js +91 -0
- package/dist/connectors/manual.js.map +1 -0
- package/dist/connectors/normalize.d.ts +35 -0
- package/dist/connectors/normalize.d.ts.map +1 -0
- package/dist/connectors/normalize.js +216 -0
- package/dist/connectors/normalize.js.map +1 -0
- package/dist/connectors/notion.d.ts +10 -0
- package/dist/connectors/notion.d.ts.map +1 -0
- package/dist/connectors/notion.js +393 -0
- package/dist/connectors/notion.js.map +1 -0
- package/dist/connectors/private-artifacts.d.ts +39 -0
- package/dist/connectors/private-artifacts.d.ts.map +1 -0
- package/dist/connectors/private-artifacts.js +175 -0
- package/dist/connectors/private-artifacts.js.map +1 -0
- package/dist/connectors/provider-response.d.ts +20 -0
- package/dist/connectors/provider-response.d.ts.map +1 -0
- package/dist/connectors/provider-response.js +98 -0
- package/dist/connectors/provider-response.js.map +1 -0
- package/dist/connectors/recommendations.d.ts +25 -0
- package/dist/connectors/recommendations.d.ts.map +1 -0
- package/dist/connectors/recommendations.js +172 -0
- package/dist/connectors/recommendations.js.map +1 -0
- package/dist/connectors/registry.d.ts +10 -0
- package/dist/connectors/registry.d.ts.map +1 -0
- package/dist/connectors/registry.js +34 -0
- package/dist/connectors/registry.js.map +1 -0
- package/dist/connectors/rendered-page.d.ts +101 -0
- package/dist/connectors/rendered-page.d.ts.map +1 -0
- package/dist/connectors/rendered-page.js +504 -0
- package/dist/connectors/rendered-page.js.map +1 -0
- package/dist/connectors/smart-defaults.d.ts +9 -0
- package/dist/connectors/smart-defaults.d.ts.map +1 -0
- package/dist/connectors/smart-defaults.js +72 -0
- package/dist/connectors/smart-defaults.js.map +1 -0
- package/dist/connectors/types.d.ts +79 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/connectors/types.js +2 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/connectors/upload.d.ts +9 -0
- package/dist/connectors/upload.d.ts.map +1 -0
- package/dist/connectors/upload.js +440 -0
- package/dist/connectors/upload.js.map +1 -0
- package/dist/connectors/website.d.ts +20 -0
- package/dist/connectors/website.d.ts.map +1 -0
- package/dist/connectors/website.js +616 -0
- package/dist/connectors/website.js.map +1 -0
- package/dist/embeddings/index.d.ts +3 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +3 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/providers.d.ts +7 -0
- package/dist/embeddings/providers.d.ts.map +1 -0
- package/dist/embeddings/providers.js +176 -0
- package/dist/embeddings/providers.js.map +1 -0
- package/dist/embeddings/types.d.ts +19 -0
- package/dist/embeddings/types.d.ts.map +1 -0
- package/dist/embeddings/types.js +2 -0
- package/dist/embeddings/types.js.map +1 -0
- package/dist/eval/acceptance-fixtures.d.ts +3 -0
- package/dist/eval/acceptance-fixtures.d.ts.map +1 -0
- package/dist/eval/acceptance-fixtures.js +84 -0
- package/dist/eval/acceptance-fixtures.js.map +1 -0
- package/dist/eval/acceptance.d.ts +114 -0
- package/dist/eval/acceptance.d.ts.map +1 -0
- package/dist/eval/acceptance.js +260 -0
- package/dist/eval/acceptance.js.map +1 -0
- package/dist/eval/fixtures.d.ts +16 -0
- package/dist/eval/fixtures.d.ts.map +1 -0
- package/dist/eval/fixtures.js +119 -0
- package/dist/eval/fixtures.js.map +1 -0
- package/dist/eval/index.d.ts +63 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +174 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/background-worker.d.ts +31 -0
- package/dist/jobs/background-worker.d.ts.map +1 -0
- package/dist/jobs/background-worker.js +315 -0
- package/dist/jobs/background-worker.js.map +1 -0
- package/dist/jobs/import-runner.d.ts +3 -0
- package/dist/jobs/import-runner.d.ts.map +1 -0
- package/dist/jobs/import-runner.js +613 -0
- package/dist/jobs/import-runner.js.map +1 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +8 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/progress.d.ts +3 -0
- package/dist/jobs/progress.d.ts.map +1 -0
- package/dist/jobs/progress.js +30 -0
- package/dist/jobs/progress.js.map +1 -0
- package/dist/jobs/rebuild.d.ts +13 -0
- package/dist/jobs/rebuild.d.ts.map +1 -0
- package/dist/jobs/rebuild.js +178 -0
- package/dist/jobs/rebuild.js.map +1 -0
- package/dist/jobs/server-worker.d.ts +16 -0
- package/dist/jobs/server-worker.d.ts.map +1 -0
- package/dist/jobs/server-worker.js +252 -0
- package/dist/jobs/server-worker.js.map +1 -0
- package/dist/jobs/store-adapter.d.ts +3 -0
- package/dist/jobs/store-adapter.d.ts.map +1 -0
- package/dist/jobs/store-adapter.js +37 -0
- package/dist/jobs/store-adapter.js.map +1 -0
- package/dist/jobs/types.d.ts +138 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/types.js +2 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/jobs/worker.d.ts +27 -0
- package/dist/jobs/worker.d.ts.map +1 -0
- package/dist/jobs/worker.js +90 -0
- package/dist/jobs/worker.js.map +1 -0
- package/dist/media-url.d.ts +7 -0
- package/dist/media-url.d.ts.map +1 -0
- package/dist/media-url.js +15 -0
- package/dist/media-url.js.map +1 -0
- package/dist/native-artifact-reassembly.d.ts +25 -0
- package/dist/native-artifact-reassembly.d.ts.map +1 -0
- package/dist/native-artifact-reassembly.js +262 -0
- package/dist/native-artifact-reassembly.js.map +1 -0
- package/dist/native-artifact.d.ts +88 -0
- package/dist/native-artifact.d.ts.map +1 -0
- package/dist/native-artifact.js +86 -0
- package/dist/native-artifact.js.map +1 -0
- package/dist/schema/index.d.ts +5519 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +374 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/migrations.d.ts +10 -0
- package/dist/schema/migrations.d.ts.map +1 -0
- package/dist/schema/migrations.js +253 -0
- package/dist/schema/migrations.js.map +1 -0
- package/dist/search/fusion.d.ts +15 -0
- package/dist/search/fusion.d.ts.map +1 -0
- package/dist/search/fusion.js +25 -0
- package/dist/search/fusion.js.map +1 -0
- package/dist/search/mode.d.ts +4 -0
- package/dist/search/mode.d.ts.map +1 -0
- package/dist/search/mode.js +13 -0
- package/dist/search/mode.js.map +1 -0
- package/dist/search/postgres-fts.d.ts +22 -0
- package/dist/search/postgres-fts.d.ts.map +1 -0
- package/dist/search/postgres-fts.js +83 -0
- package/dist/search/postgres-fts.js.map +1 -0
- package/dist/server/brand-context.d.ts +15 -0
- package/dist/server/brand-context.d.ts.map +1 -0
- package/dist/server/brand-context.js +149 -0
- package/dist/server/brand-context.js.map +1 -0
- package/dist/server/context.d.ts +77 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +63 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/enrichment.d.ts +23 -0
- package/dist/server/enrichment.d.ts.map +1 -0
- package/dist/server/enrichment.js +136 -0
- package/dist/server/enrichment.js.map +1 -0
- package/dist/server/generation-artifact-access.d.ts +21 -0
- package/dist/server/generation-artifact-access.d.ts.map +1 -0
- package/dist/server/generation-artifact-access.js +111 -0
- package/dist/server/generation-artifact-access.js.map +1 -0
- package/dist/server/generation-context.d.ts +204 -0
- package/dist/server/generation-context.d.ts.map +1 -0
- package/dist/server/generation-context.js +310 -0
- package/dist/server/generation-context.js.map +1 -0
- package/dist/server/index.d.ts +22 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +96 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/isolated-a2a.d.ts +172 -0
- package/dist/server/isolated-a2a.d.ts.map +1 -0
- package/dist/server/isolated-a2a.js +310 -0
- package/dist/server/isolated-a2a.js.map +1 -0
- package/dist/server/media.d.ts +15 -0
- package/dist/server/media.d.ts.map +1 -0
- package/dist/server/media.js +93 -0
- package/dist/server/media.js.map +1 -0
- package/dist/server/prompt-provider.d.ts +5 -0
- package/dist/server/prompt-provider.d.ts.map +1 -0
- package/dist/server/prompt-provider.js +59 -0
- package/dist/server/prompt-provider.js.map +1 -0
- package/dist/server/public-serialization.d.ts +160 -0
- package/dist/server/public-serialization.d.ts.map +1 -0
- package/dist/server/public-serialization.js +108 -0
- package/dist/server/public-serialization.js.map +1 -0
- package/dist/server/resource-paths.d.ts +3 -0
- package/dist/server/resource-paths.d.ts.map +1 -0
- package/dist/server/resource-paths.js +5 -0
- package/dist/server/resource-paths.js.map +1 -0
- package/dist/server/retrieval.d.ts +78 -0
- package/dist/server/retrieval.d.ts.map +1 -0
- package/dist/server/retrieval.js +443 -0
- package/dist/server/retrieval.js.map +1 -0
- package/dist/server/untrusted-reference.d.ts +8 -0
- package/dist/server/untrusted-reference.d.ts.map +1 -0
- package/dist/server/untrusted-reference.js +19 -0
- package/dist/server/untrusted-reference.js.map +1 -0
- package/dist/store/brand.d.ts +47 -0
- package/dist/store/brand.d.ts.map +1 -0
- package/dist/store/brand.js +360 -0
- package/dist/store/brand.js.map +1 -0
- package/dist/store/content.d.ts +120 -0
- package/dist/store/content.d.ts.map +1 -0
- package/dist/store/content.js +1437 -0
- package/dist/store/content.js.map +1 -0
- package/dist/store/generation.d.ts +28 -0
- package/dist/store/generation.d.ts.map +1 -0
- package/dist/store/generation.js +140 -0
- package/dist/store/generation.js.map +1 -0
- package/dist/store/helpers.d.ts +12 -0
- package/dist/store/helpers.d.ts.map +1 -0
- package/dist/store/helpers.js +41 -0
- package/dist/store/helpers.js.map +1 -0
- package/dist/store/index.d.ts +10 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +10 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/inference.d.ts +57 -0
- package/dist/store/inference.d.ts.map +1 -0
- package/dist/store/inference.js +279 -0
- package/dist/store/inference.js.map +1 -0
- package/dist/store/jobs.d.ts +80 -0
- package/dist/store/jobs.d.ts.map +1 -0
- package/dist/store/jobs.js +428 -0
- package/dist/store/jobs.js.map +1 -0
- package/dist/store/packs.d.ts +33 -0
- package/dist/store/packs.d.ts.map +1 -0
- package/dist/store/packs.js +321 -0
- package/dist/store/packs.js.map +1 -0
- package/dist/store/purge.d.ts +16 -0
- package/dist/store/purge.d.ts.map +1 -0
- package/dist/store/purge.js +256 -0
- package/dist/store/purge.js.map +1 -0
- package/dist/store/sources.d.ts +76 -0
- package/dist/store/sources.d.ts.map +1 -0
- package/dist/store/sources.js +538 -0
- package/dist/store/sources.js.map +1 -0
- package/dist/store/suggestions.d.ts +28 -0
- package/dist/store/suggestions.d.ts.map +1 -0
- package/dist/store/suggestions.js +250 -0
- package/dist/store/suggestions.js.map +1 -0
- package/dist/types.d.ts +493 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/index.js +2 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/pgvector.d.ts +28 -0
- package/dist/vector/pgvector.d.ts.map +1 -0
- package/dist/vector/pgvector.js +117 -0
- package/dist/vector/pgvector.js.map +1 -0
- package/docs/evaluation.md +92 -0
- package/docs/llms-full.txt +168 -0
- package/docs/llms.txt +76 -0
- package/docs/skills/creative-context/SKILL.md +74 -0
- package/package.json +91 -0
- package/src/actions/agent-input-schemas.spec.ts +46 -0
- package/src/actions/confirm-canonical-logo.ts +20 -0
- package/src/actions/continue-context-import.ts +12 -0
- package/src/actions/creative-context-a2a.spec.ts +64 -0
- package/src/actions/creative-context-a2a.ts +88 -0
- package/src/actions/get-brand-profile.ts +16 -0
- package/src/actions/get-context-import-status.ts +13 -0
- package/src/actions/get-context-item.ts +1 -0
- package/src/actions/get-context-pack.ts +14 -0
- package/src/actions/get-creative-context.spec.ts +315 -0
- package/src/actions/get-creative-context.ts +148 -0
- package/src/actions/index.ts +65 -0
- package/src/actions/infer-brand-dna.ts +15 -0
- package/src/actions/list-canonical-logo-candidates.ts +121 -0
- package/src/actions/list-context-connections.spec.ts +23 -0
- package/src/actions/list-context-connections.ts +51 -0
- package/src/actions/list-context-packs.ts +17 -0
- package/src/actions/list-context-sources.ts +21 -0
- package/src/actions/list-context-suggestions.ts +30 -0
- package/src/actions/manage-brand-profile.ts +58 -0
- package/src/actions/manage-context-pack.ts +75 -0
- package/src/actions/manage-context-source.ts +154 -0
- package/src/actions/manage-layout-template.ts +51 -0
- package/src/actions/preview-context-import.spec.ts +64 -0
- package/src/actions/preview-context-import.ts +61 -0
- package/src/actions/process-context-purge.ts +25 -0
- package/src/actions/propose-brand-dna.ts +22 -0
- package/src/actions/propose-canonical-logo.ts +19 -0
- package/src/actions/publish-brand-dna.ts +25 -0
- package/src/actions/recommend-context-roots.ts +24 -0
- package/src/actions/record-context-feedback.ts +16 -0
- package/src/actions/review-context-items.ts +69 -0
- package/src/actions/run-embedding-bakeoff.ts +90 -0
- package/src/actions/search-creative-context.ts +47 -0
- package/src/actions/set-brand-dna.ts +22 -0
- package/src/actions/start-context-enrichment.ts +50 -0
- package/src/actions/start-context-import.ts +37 -0
- package/src/client/CreativeContextChip.tsx +162 -0
- package/src/client/CreativeContextPanel.tsx +2442 -0
- package/src/client/CreativeContextSettingsLink.tsx +30 -0
- package/src/client/actions.ts +438 -0
- package/src/client/agent-tab.tsx +58 -0
- package/src/client/application-state.spec.ts +41 -0
- package/src/client/application-state.ts +130 -0
- package/src/client/index.ts +62 -0
- package/src/client/messages.ts +1240 -0
- package/src/client/source-config.spec.ts +152 -0
- package/src/connectors/connectors.spec.ts +778 -0
- package/src/connectors/context.ts +83 -0
- package/src/connectors/document-parser.ts +5 -0
- package/src/connectors/figma-native.ts +1192 -0
- package/src/connectors/figma-native.visual.spec.ts +221 -0
- package/src/connectors/figma.spec.ts +812 -0
- package/src/connectors/figma.ts +257 -0
- package/src/connectors/fixtures/google-slides-native.json +353 -0
- package/src/connectors/google-slides-native.spec.ts +804 -0
- package/src/connectors/google-slides-native.ts +1656 -0
- package/src/connectors/google-slides-native.visual.spec.ts +119 -0
- package/src/connectors/google-slides.ts +1172 -0
- package/src/connectors/index.ts +103 -0
- package/src/connectors/manual.ts +132 -0
- package/src/connectors/normalize.ts +277 -0
- package/src/connectors/notion.ts +529 -0
- package/src/connectors/private-artifacts.spec.ts +95 -0
- package/src/connectors/private-artifacts.ts +248 -0
- package/src/connectors/provider-response.ts +144 -0
- package/src/connectors/recommendations.ts +237 -0
- package/src/connectors/registry.ts +48 -0
- package/src/connectors/rendered-page.ts +705 -0
- package/src/connectors/smart-defaults.spec.ts +135 -0
- package/src/connectors/smart-defaults.ts +87 -0
- package/src/connectors/types.ts +115 -0
- package/src/connectors/upload.spec.ts +175 -0
- package/src/connectors/upload.ts +548 -0
- package/src/connectors/website.spec.ts +509 -0
- package/src/connectors/website.ts +777 -0
- package/src/embeddings/index.ts +2 -0
- package/src/embeddings/providers.spec.ts +73 -0
- package/src/embeddings/providers.ts +228 -0
- package/src/embeddings/types.ts +24 -0
- package/src/eval/acceptance-fixtures.ts +97 -0
- package/src/eval/acceptance.spec.ts +92 -0
- package/src/eval/acceptance.ts +371 -0
- package/src/eval/connectors-golden.spec.ts +421 -0
- package/src/eval/eval.spec.ts +166 -0
- package/src/eval/fixtures/README.md +17 -0
- package/src/eval/fixtures/figma-brand-system-v1.json +140 -0
- package/src/eval/fixtures/figma-brand-system-v2.json +127 -0
- package/src/eval/fixtures/launch-hero.png +0 -0
- package/src/eval/fixtures/launch-system-v1.pptx +0 -0
- package/src/eval/fixtures/launch-system-v2.pptx +0 -0
- package/src/eval/fixtures/notion-brand-root.json +218 -0
- package/src/eval/fixtures/pricing-hero.png +0 -0
- package/src/eval/fixtures/rendered-brand-page.html +76 -0
- package/src/eval/fixtures.spec.ts +43 -0
- package/src/eval/fixtures.ts +136 -0
- package/src/eval/index.ts +291 -0
- package/src/eval/library-flow.acceptance.spec.tsx +141 -0
- package/src/index.ts +4 -0
- package/src/jobs/background-worker.ts +423 -0
- package/src/jobs/import-runner.spec.ts +582 -0
- package/src/jobs/import-runner.ts +792 -0
- package/src/jobs/index.ts +40 -0
- package/src/jobs/progress.ts +37 -0
- package/src/jobs/rebuild.ts +245 -0
- package/src/jobs/server-worker.spec.ts +159 -0
- package/src/jobs/server-worker.ts +344 -0
- package/src/jobs/store-adapter.ts +52 -0
- package/src/jobs/types.ts +147 -0
- package/src/jobs/worker.ts +152 -0
- package/src/manifest.spec.ts +26 -0
- package/src/media-url.ts +17 -0
- package/src/native-artifact-reassembly.spec.ts +386 -0
- package/src/native-artifact-reassembly.ts +406 -0
- package/src/native-artifact.ts +102 -0
- package/src/schema/index.ts +411 -0
- package/src/schema/migrations.spec.ts +41 -0
- package/src/schema/migrations.ts +258 -0
- package/src/search/fusion.spec.ts +21 -0
- package/src/search/fusion.ts +39 -0
- package/src/search/mode.spec.ts +28 -0
- package/src/search/mode.ts +21 -0
- package/src/search/postgres-fts.spec.ts +71 -0
- package/src/search/postgres-fts.ts +112 -0
- package/src/server/brand-context.spec.ts +43 -0
- package/src/server/brand-context.ts +160 -0
- package/src/server/context.ts +162 -0
- package/src/server/enrichment.ts +163 -0
- package/src/server/generation-artifact-access.ts +216 -0
- package/src/server/generation-context-a2a.spec.ts +131 -0
- package/src/server/generation-context-off.spec.ts +213 -0
- package/src/server/generation-context.spec.ts +124 -0
- package/src/server/generation-context.ts +493 -0
- package/src/server/index.ts +135 -0
- package/src/server/isolated-a2a.spec.ts +164 -0
- package/src/server/isolated-a2a.ts +413 -0
- package/src/server/media.spec.ts +92 -0
- package/src/server/media.ts +117 -0
- package/src/server/prompt-provider.spec.ts +78 -0
- package/src/server/prompt-provider.ts +73 -0
- package/src/server/public-serialization.spec.ts +149 -0
- package/src/server/public-serialization.ts +130 -0
- package/src/server/resource-paths.spec.ts +9 -0
- package/src/server/resource-paths.ts +5 -0
- package/src/server/retrieval-vector.spec.ts +180 -0
- package/src/server/retrieval.ts +587 -0
- package/src/server/untrusted-reference.spec.ts +22 -0
- package/src/server/untrusted-reference.ts +24 -0
- package/src/store/access.integration.spec.ts +1922 -0
- package/src/store/brand.ts +477 -0
- package/src/store/content.ts +1900 -0
- package/src/store/generation.ts +226 -0
- package/src/store/helpers.ts +53 -0
- package/src/store/index.ts +9 -0
- package/src/store/inference.spec.ts +84 -0
- package/src/store/inference.ts +339 -0
- package/src/store/invariants.spec.ts +119 -0
- package/src/store/jobs.ts +672 -0
- package/src/store/packs.ts +466 -0
- package/src/store/purge.ts +321 -0
- package/src/store/sources.spec.ts +102 -0
- package/src/store/sources.ts +708 -0
- package/src/store/suggestions.ts +333 -0
- package/src/types.ts +571 -0
- package/src/vector/index.ts +1 -0
- package/src/vector/pgvector.spec.ts +98 -0
- package/src/vector/pgvector.ts +164 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { createGeminiEmbeddingFamily } from "./providers.js";
|
|
4
|
+
|
|
5
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
6
|
+
|
|
7
|
+
describe("Gemini embedding request contract", () => {
|
|
8
|
+
it("uses current REST dimension casing and retrieval prefixes", async () => {
|
|
9
|
+
const fetchMock = vi.fn(async (_url: string, init: RequestInit) => {
|
|
10
|
+
const body = JSON.parse(String(init.body));
|
|
11
|
+
return new Response(
|
|
12
|
+
JSON.stringify({ embedding: { values: [0.1, 0.2, 0.3] } }),
|
|
13
|
+
{ status: 200, headers: { "content-type": "application/json" } },
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
17
|
+
const family = createGeminiEmbeddingFamily("test-key", 3);
|
|
18
|
+
await family.embed([{ text: "pricing hero" }], "query");
|
|
19
|
+
await family.embed([{ text: "three pricing cards" }], "document");
|
|
20
|
+
const queryBody = JSON.parse(
|
|
21
|
+
String((fetchMock.mock.calls[0]?.[1] as RequestInit).body),
|
|
22
|
+
);
|
|
23
|
+
const documentBody = JSON.parse(
|
|
24
|
+
String((fetchMock.mock.calls[1]?.[1] as RequestInit).body),
|
|
25
|
+
);
|
|
26
|
+
expect(queryBody.output_dimensionality).toBe(3);
|
|
27
|
+
expect(queryBody).not.toHaveProperty("outputDimensionality");
|
|
28
|
+
expect(queryBody.content.parts[0].text).toBe(
|
|
29
|
+
"task: search result | query: pricing hero",
|
|
30
|
+
);
|
|
31
|
+
expect(documentBody.content.parts[0].text).toBe(
|
|
32
|
+
"title: none | text: three pricing cards",
|
|
33
|
+
);
|
|
34
|
+
expect(family.supportedImageMimeTypes).toEqual(["image/png", "image/jpeg"]);
|
|
35
|
+
expect((fetchMock.mock.calls[0]?.[1] as RequestInit).signal).toBeDefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("never echoes provider response bodies into errors", async () => {
|
|
39
|
+
vi.stubGlobal(
|
|
40
|
+
"fetch",
|
|
41
|
+
vi.fn(
|
|
42
|
+
async () =>
|
|
43
|
+
new Response("secret customer content from imported corpus", {
|
|
44
|
+
status: 400,
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
const family = createGeminiEmbeddingFamily("test-key", 3);
|
|
49
|
+
await expect(
|
|
50
|
+
family.embed([{ text: "private customer phrase" }], "document"),
|
|
51
|
+
).rejects.toThrow("gemini/gemini-embedding-2 failed with status 400");
|
|
52
|
+
await expect(
|
|
53
|
+
family.embed([{ text: "private customer phrase" }], "document"),
|
|
54
|
+
).rejects.not.toThrow(/secret customer content|private customer phrase/);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("rejects oversized successful provider responses before JSON parsing", async () => {
|
|
58
|
+
vi.stubGlobal(
|
|
59
|
+
"fetch",
|
|
60
|
+
vi.fn(
|
|
61
|
+
async () =>
|
|
62
|
+
new Response("{}", {
|
|
63
|
+
status: 200,
|
|
64
|
+
headers: { "content-length": "1000001" },
|
|
65
|
+
}),
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
const family = createGeminiEmbeddingFamily("test-key", 3);
|
|
69
|
+
await expect(family.embed([{ text: "pricing" }], "query")).rejects.toThrow(
|
|
70
|
+
/exceeds 1000000 bytes/,
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { readBoundedResponseBytes } from "@agent-native/core/ingestion";
|
|
2
|
+
import { resolveSecret } from "@agent-native/core/server";
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
EmbeddingFamily,
|
|
6
|
+
EmbeddingImageInput,
|
|
7
|
+
EmbeddingInputPurpose,
|
|
8
|
+
MultimodalEmbeddingInput,
|
|
9
|
+
} from "./types.js";
|
|
10
|
+
|
|
11
|
+
const DEFAULT_DIMENSIONS = 1024;
|
|
12
|
+
|
|
13
|
+
function dataUrl(image: EmbeddingImageInput): string {
|
|
14
|
+
return `data:${image.mimeType};base64,${image.base64}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function normalizedInput(input: MultimodalEmbeddingInput) {
|
|
18
|
+
const text = input.text?.trim();
|
|
19
|
+
const images = input.images ?? [];
|
|
20
|
+
if (!text && images.length === 0) {
|
|
21
|
+
throw new Error("Embedding input needs text, an image, or both.");
|
|
22
|
+
}
|
|
23
|
+
return { text, images };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function postJson(
|
|
27
|
+
url: string,
|
|
28
|
+
headers: Record<string, string>,
|
|
29
|
+
body: unknown,
|
|
30
|
+
providerModel: string,
|
|
31
|
+
): Promise<Record<string, unknown>> {
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const timeout = setTimeout(() => controller.abort(), 30_000);
|
|
34
|
+
try {
|
|
35
|
+
const response = await fetch(url, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
38
|
+
body: JSON.stringify(body),
|
|
39
|
+
signal: controller.signal,
|
|
40
|
+
});
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Embedding provider ${providerModel} failed with status ${response.status}.`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const bytes = await readBoundedResponseBytes(response, 1_000_000);
|
|
47
|
+
return JSON.parse(new TextDecoder().decode(bytes)) as Record<
|
|
48
|
+
string,
|
|
49
|
+
unknown
|
|
50
|
+
>;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (controller.signal.aborted) {
|
|
53
|
+
throw new Error(`Embedding provider ${providerModel} timed out.`);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
} finally {
|
|
57
|
+
clearTimeout(timeout);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function numberVectors(value: unknown): number[][] {
|
|
62
|
+
if (!Array.isArray(value))
|
|
63
|
+
throw new Error("Embedding response was malformed.");
|
|
64
|
+
return value.map((vector) => {
|
|
65
|
+
if (
|
|
66
|
+
!Array.isArray(vector) ||
|
|
67
|
+
vector.some((entry) => !Number.isFinite(entry))
|
|
68
|
+
) {
|
|
69
|
+
throw new Error("Embedding response contained an invalid vector.");
|
|
70
|
+
}
|
|
71
|
+
return vector.map(Number);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function createGeminiEmbeddingFamily(
|
|
76
|
+
apiKey: string,
|
|
77
|
+
dimensions = DEFAULT_DIMENSIONS,
|
|
78
|
+
): EmbeddingFamily {
|
|
79
|
+
const model = "gemini-embedding-2";
|
|
80
|
+
return {
|
|
81
|
+
id: `gemini:${model}:${dimensions}`,
|
|
82
|
+
provider: "gemini",
|
|
83
|
+
model,
|
|
84
|
+
version: "stable-2026-04",
|
|
85
|
+
dimensions,
|
|
86
|
+
supportedImageMimeTypes: ["image/png", "image/jpeg"],
|
|
87
|
+
async embed(inputs, purpose) {
|
|
88
|
+
const vectors: number[][] = [];
|
|
89
|
+
for (const raw of inputs) {
|
|
90
|
+
const input = normalizedInput(raw);
|
|
91
|
+
const instruction =
|
|
92
|
+
purpose === "query"
|
|
93
|
+
? "task: search result | query:"
|
|
94
|
+
: "title: none | text:";
|
|
95
|
+
const parts: Record<string, unknown>[] = [
|
|
96
|
+
{ text: `${instruction} ${input.text ?? ""}`.trim() },
|
|
97
|
+
...input.images.map((image) => ({
|
|
98
|
+
inlineData: { mimeType: image.mimeType, data: image.base64 },
|
|
99
|
+
})),
|
|
100
|
+
];
|
|
101
|
+
const result = await postJson(
|
|
102
|
+
`https://generativelanguage.googleapis.com/v1beta/models/${model}:embedContent`,
|
|
103
|
+
{ "x-goog-api-key": apiKey },
|
|
104
|
+
{
|
|
105
|
+
content: { parts },
|
|
106
|
+
output_dimensionality: dimensions,
|
|
107
|
+
},
|
|
108
|
+
`gemini/${model}`,
|
|
109
|
+
);
|
|
110
|
+
const embedding = result.embedding as { values?: unknown } | undefined;
|
|
111
|
+
vectors.push(...numberVectors([embedding?.values]));
|
|
112
|
+
}
|
|
113
|
+
return vectors;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function createCohereEmbeddingFamily(
|
|
119
|
+
apiKey: string,
|
|
120
|
+
dimensions = DEFAULT_DIMENSIONS,
|
|
121
|
+
): EmbeddingFamily {
|
|
122
|
+
const model = "embed-v4.0";
|
|
123
|
+
return {
|
|
124
|
+
id: `cohere:${model}:${dimensions}`,
|
|
125
|
+
provider: "cohere",
|
|
126
|
+
model,
|
|
127
|
+
version: "v4.0",
|
|
128
|
+
dimensions,
|
|
129
|
+
supportedImageMimeTypes: [
|
|
130
|
+
"image/png",
|
|
131
|
+
"image/jpeg",
|
|
132
|
+
"image/webp",
|
|
133
|
+
"image/gif",
|
|
134
|
+
],
|
|
135
|
+
async embed(inputs, purpose) {
|
|
136
|
+
const contentInputs = inputs.map((raw) => {
|
|
137
|
+
const input = normalizedInput(raw);
|
|
138
|
+
return {
|
|
139
|
+
content: [
|
|
140
|
+
...(input.text ? [{ type: "text", text: input.text }] : []),
|
|
141
|
+
...input.images.map((image) => ({
|
|
142
|
+
type: "image_url",
|
|
143
|
+
image_url: { url: dataUrl(image) },
|
|
144
|
+
})),
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
const result = await postJson(
|
|
149
|
+
"https://api.cohere.com/v2/embed",
|
|
150
|
+
{ Authorization: `Bearer ${apiKey}` },
|
|
151
|
+
{
|
|
152
|
+
model,
|
|
153
|
+
inputs: contentInputs,
|
|
154
|
+
input_type: purpose === "query" ? "search_query" : "search_document",
|
|
155
|
+
embedding_types: ["float"],
|
|
156
|
+
output_dimension: dimensions,
|
|
157
|
+
},
|
|
158
|
+
`cohere/${model}`,
|
|
159
|
+
);
|
|
160
|
+
const embeddings = result.embeddings as
|
|
161
|
+
| { float?: unknown; float_?: unknown }
|
|
162
|
+
| undefined;
|
|
163
|
+
return numberVectors(embeddings?.float ?? embeddings?.float_);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function createVoyageEmbeddingFamily(apiKey: string): EmbeddingFamily {
|
|
169
|
+
const model = "voyage-multimodal-3.5";
|
|
170
|
+
return {
|
|
171
|
+
id: `voyage:${model}:1024`,
|
|
172
|
+
provider: "voyage",
|
|
173
|
+
model,
|
|
174
|
+
version: "3.5",
|
|
175
|
+
dimensions: 1024,
|
|
176
|
+
supportedImageMimeTypes: [
|
|
177
|
+
"image/png",
|
|
178
|
+
"image/jpeg",
|
|
179
|
+
"image/webp",
|
|
180
|
+
"image/gif",
|
|
181
|
+
],
|
|
182
|
+
async embed(inputs, purpose) {
|
|
183
|
+
const voyageInputs = inputs.map((raw) => {
|
|
184
|
+
const input = normalizedInput(raw);
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
...(input.text ? [{ type: "text", text: input.text }] : []),
|
|
188
|
+
...input.images.map((image) => ({
|
|
189
|
+
type: "image_base64",
|
|
190
|
+
image_base64: dataUrl(image),
|
|
191
|
+
})),
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
const result = await postJson(
|
|
196
|
+
"https://api.voyageai.com/v1/multimodalembeddings",
|
|
197
|
+
{ Authorization: `Bearer ${apiKey}` },
|
|
198
|
+
{
|
|
199
|
+
model,
|
|
200
|
+
inputs: voyageInputs,
|
|
201
|
+
input_type: purpose,
|
|
202
|
+
truncation: true,
|
|
203
|
+
},
|
|
204
|
+
`voyage/${model}`,
|
|
205
|
+
);
|
|
206
|
+
return numberVectors(result.embeddings);
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export async function availableEmbeddingFamilies(): Promise<EmbeddingFamily[]> {
|
|
212
|
+
const [gemini, cohere, voyage] = await Promise.all([
|
|
213
|
+
resolveSecret("GEMINI_API_KEY").catch(() => null),
|
|
214
|
+
resolveSecret("COHERE_API_KEY").catch(() => null),
|
|
215
|
+
resolveSecret("VOYAGE_API_KEY").catch(() => null),
|
|
216
|
+
]);
|
|
217
|
+
return [
|
|
218
|
+
...(gemini ? [createGeminiEmbeddingFamily(gemini)] : []),
|
|
219
|
+
...(cohere ? [createCohereEmbeddingFamily(cohere)] : []),
|
|
220
|
+
...(voyage ? [createVoyageEmbeddingFamily(voyage)] : []),
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function defaultEmbeddingFamily(
|
|
225
|
+
families: readonly EmbeddingFamily[],
|
|
226
|
+
): EmbeddingFamily | null {
|
|
227
|
+
return families.length === 1 ? (families[0] ?? null) : null;
|
|
228
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type EmbeddingInputPurpose = "query" | "document";
|
|
2
|
+
|
|
3
|
+
export interface EmbeddingImageInput {
|
|
4
|
+
mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
5
|
+
base64: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface MultimodalEmbeddingInput {
|
|
9
|
+
text?: string;
|
|
10
|
+
images?: EmbeddingImageInput[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface EmbeddingFamily {
|
|
14
|
+
id: string;
|
|
15
|
+
provider: "gemini" | "cohere" | "voyage" | (string & {});
|
|
16
|
+
model: string;
|
|
17
|
+
version: string;
|
|
18
|
+
dimensions: number;
|
|
19
|
+
supportedImageMimeTypes?: readonly EmbeddingImageInput["mimeType"][];
|
|
20
|
+
embed(
|
|
21
|
+
inputs: readonly MultimodalEmbeddingInput[],
|
|
22
|
+
purpose: EmbeddingInputPurpose,
|
|
23
|
+
): Promise<number[][]>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ContextAcceptanceCase } from "./acceptance.js";
|
|
2
|
+
|
|
3
|
+
const forbidden = [
|
|
4
|
+
"INJECTION_EXECUTED",
|
|
5
|
+
"system prompt",
|
|
6
|
+
"secret token",
|
|
7
|
+
] as const;
|
|
8
|
+
|
|
9
|
+
export const CREATIVE_CONTEXT_ACCEPTANCE_CASES: readonly ContextAcceptanceCase[] =
|
|
10
|
+
[
|
|
11
|
+
{
|
|
12
|
+
id: "launch-scorecard-slide",
|
|
13
|
+
prompt: "Draft an executive launch scorecard slide.",
|
|
14
|
+
reference:
|
|
15
|
+
"Launch scorecard with four KPI tiles, a purple trend line, and one sentence of interpretation for each trend.",
|
|
16
|
+
expectedContextKeys: ["upload:launch-system-v2"],
|
|
17
|
+
requiredTerms: ["four KPI tiles", "purple trend line", "interpretation"],
|
|
18
|
+
forbiddenTerms: forbidden,
|
|
19
|
+
contextOff: {
|
|
20
|
+
output: "Executive launch scorecard with key business metrics.",
|
|
21
|
+
usedContextKeys: [],
|
|
22
|
+
},
|
|
23
|
+
contextOn: {
|
|
24
|
+
output:
|
|
25
|
+
"Launch scorecard with four KPI tiles, a purple trend line, and one sentence of interpretation for each trend.",
|
|
26
|
+
usedContextKeys: ["upload:launch-system-v2"],
|
|
27
|
+
contextPackId: "pack:launch-scorecard",
|
|
28
|
+
provenanceKeys: ["upload:launch-system-v2"],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "pricing-hero-frame",
|
|
33
|
+
prompt: "Design a pricing hero for the website.",
|
|
34
|
+
reference:
|
|
35
|
+
"Use an ink background, Inter 56 heading, three pricing cards, and one purple Start free trial button.",
|
|
36
|
+
expectedContextKeys: ["figma:brand-system-v2"],
|
|
37
|
+
requiredTerms: ["Inter 56", "three pricing cards", "Start free trial"],
|
|
38
|
+
forbiddenTerms: forbidden,
|
|
39
|
+
contextOff: {
|
|
40
|
+
output: "A modern pricing hero with a headline, cards, and a button.",
|
|
41
|
+
usedContextKeys: [],
|
|
42
|
+
},
|
|
43
|
+
contextOn: {
|
|
44
|
+
output:
|
|
45
|
+
"Use an ink background, Inter 56 heading, three pricing cards, and one purple Start free trial button.",
|
|
46
|
+
usedContextKeys: ["figma:brand-system-v2"],
|
|
47
|
+
contextPackId: "pack:pricing-hero",
|
|
48
|
+
provenanceKeys: ["figma:brand-system-v2"],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "launch-voice-copy",
|
|
53
|
+
prompt: "Write the launch announcement opening and CTA.",
|
|
54
|
+
reference:
|
|
55
|
+
"Lead with the user outcome in direct active voice, support it with one verified metric, and close with one explicit trial action.",
|
|
56
|
+
expectedContextKeys: ["notion:launch-narrative-v2"],
|
|
57
|
+
requiredTerms: ["user outcome", "verified metric", "trial action"],
|
|
58
|
+
forbiddenTerms: forbidden,
|
|
59
|
+
contextOff: {
|
|
60
|
+
output:
|
|
61
|
+
"We are thrilled to announce our revolutionary best-in-class platform. Learn more today.",
|
|
62
|
+
usedContextKeys: [],
|
|
63
|
+
},
|
|
64
|
+
contextOn: {
|
|
65
|
+
output:
|
|
66
|
+
"Lead with the user outcome in direct active voice, support it with one verified metric, and close with one explicit trial action.",
|
|
67
|
+
usedContextKeys: ["notion:launch-narrative-v2"],
|
|
68
|
+
contextPackId: "pack:launch-voice",
|
|
69
|
+
provenanceKeys: ["notion:launch-narrative-v2"],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "rendered-campaign-page",
|
|
74
|
+
prompt: "Create a campaign page that proves adoption.",
|
|
75
|
+
reference:
|
|
76
|
+
"Use the purple and ink palette, show activation plus 18 percent in a four-metric proof grid, and end with Start free trial.",
|
|
77
|
+
expectedContextKeys: ["web:rendered-brand-page"],
|
|
78
|
+
requiredTerms: [
|
|
79
|
+
"purple and ink",
|
|
80
|
+
"activation plus 18 percent",
|
|
81
|
+
"Start free trial",
|
|
82
|
+
],
|
|
83
|
+
forbiddenTerms: forbidden,
|
|
84
|
+
contextOff: {
|
|
85
|
+
output:
|
|
86
|
+
"Use an attractive palette, a collection of metrics, and a compelling call to action.",
|
|
87
|
+
usedContextKeys: [],
|
|
88
|
+
},
|
|
89
|
+
contextOn: {
|
|
90
|
+
output:
|
|
91
|
+
"Use the purple and ink palette, show activation plus 18 percent in a four-metric proof grid, and end with Start free trial.",
|
|
92
|
+
usedContextKeys: ["web:rendered-brand-page"],
|
|
93
|
+
contextPackId: "pack:campaign-page",
|
|
94
|
+
provenanceKeys: ["web:rendered-brand-page"],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
] as const;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { CREATIVE_CONTEXT_ACCEPTANCE_CASES } from "./acceptance-fixtures.js";
|
|
4
|
+
import {
|
|
5
|
+
assertContextAcceptanceGates,
|
|
6
|
+
ContextAcceptanceReportSchema,
|
|
7
|
+
createBlindPreferencePacket,
|
|
8
|
+
runContextAcceptanceEvaluation,
|
|
9
|
+
scoreBlindPreferences,
|
|
10
|
+
} from "./acceptance.js";
|
|
11
|
+
|
|
12
|
+
describe("deterministic context-on versus context-off acceptance", () => {
|
|
13
|
+
it("emits a stable schema-valid report and passes correctness gates", () => {
|
|
14
|
+
const input = {
|
|
15
|
+
corpusId: "creative-context-realistic-v1",
|
|
16
|
+
cases: CREATIVE_CONTEXT_ACCEPTANCE_CASES,
|
|
17
|
+
};
|
|
18
|
+
const first = runContextAcceptanceEvaluation(input);
|
|
19
|
+
const repeated = runContextAcceptanceEvaluation(input);
|
|
20
|
+
|
|
21
|
+
expect(repeated).toEqual(first);
|
|
22
|
+
expect(ContextAcceptanceReportSchema.parse(first)).toEqual(first);
|
|
23
|
+
expect(first).toMatchObject({
|
|
24
|
+
schemaVersion: 1,
|
|
25
|
+
runId: expect.stringMatching(/^cc-eval-[a-f0-9]{16}$/),
|
|
26
|
+
summary: {
|
|
27
|
+
caseCount: 4,
|
|
28
|
+
contextOnWins: 4,
|
|
29
|
+
contextOffWins: 0,
|
|
30
|
+
ties: 0,
|
|
31
|
+
contextOnWinRate: 1,
|
|
32
|
+
contextOnRequiredTermCoverage: 1,
|
|
33
|
+
forbiddenOutputHits: 0,
|
|
34
|
+
missingContextPacks: 0,
|
|
35
|
+
missingProvenance: 0,
|
|
36
|
+
optOutContamination: 0,
|
|
37
|
+
},
|
|
38
|
+
gates: { passed: true, failures: [] },
|
|
39
|
+
manualBlindPreference: {
|
|
40
|
+
status: "pending",
|
|
41
|
+
scoredTrials: 0,
|
|
42
|
+
contextOnPreferenceRate: null,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
expect(() => assertContextAcceptanceGates(first)).not.toThrow();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("fails on injection output, missing provenance, or context-off contamination", () => {
|
|
49
|
+
const broken = structuredClone(CREATIVE_CONTEXT_ACCEPTANCE_CASES);
|
|
50
|
+
broken[0]!.contextOn.output += " INJECTION_EXECUTED";
|
|
51
|
+
broken[1]!.contextOn.provenanceKeys = [];
|
|
52
|
+
broken[2]!.contextOff.usedContextKeys = ["notion:leaked-context"];
|
|
53
|
+
const report = runContextAcceptanceEvaluation({
|
|
54
|
+
corpusId: "creative-context-adversarial-failure",
|
|
55
|
+
cases: broken,
|
|
56
|
+
thresholds: { minimumContextOnWinRate: 0 },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(report.gates).toMatchObject({ passed: false });
|
|
60
|
+
expect(report.gates.failures).toEqual(
|
|
61
|
+
expect.arrayContaining([
|
|
62
|
+
"forbidden output was emitted",
|
|
63
|
+
"provenance is incomplete",
|
|
64
|
+
"context-off contains context evidence",
|
|
65
|
+
]),
|
|
66
|
+
);
|
|
67
|
+
expect(() => assertContextAcceptanceGates(report)).toThrow(
|
|
68
|
+
/forbidden output.*provenance.*context-off/i,
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("creates a repeatable blind packet while keeping the answer key separate", () => {
|
|
73
|
+
const packet = createBlindPreferencePacket(
|
|
74
|
+
CREATIVE_CONTEXT_ACCEPTANCE_CASES,
|
|
75
|
+
);
|
|
76
|
+
expect(
|
|
77
|
+
createBlindPreferencePacket(CREATIVE_CONTEXT_ACCEPTANCE_CASES),
|
|
78
|
+
).toEqual(packet);
|
|
79
|
+
expect(packet.worksheet).toHaveLength(4);
|
|
80
|
+
expect(packet.answerKey).toHaveLength(4);
|
|
81
|
+
expect(JSON.stringify(packet.worksheet)).not.toContain(
|
|
82
|
+
"contextOnCandidate",
|
|
83
|
+
);
|
|
84
|
+
const preferences = Object.fromEntries(
|
|
85
|
+
packet.answerKey.map((entry) => [entry.caseId, entry.contextOnCandidate]),
|
|
86
|
+
);
|
|
87
|
+
expect(scoreBlindPreferences(packet.answerKey, preferences)).toEqual({
|
|
88
|
+
scoredTrials: 4,
|
|
89
|
+
contextOnPreferenceRate: 1,
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|