@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,136 @@
|
|
|
1
|
+
import type { RetrievalEvalTask } from "./index.js";
|
|
2
|
+
|
|
3
|
+
export interface CreativeContextGoldDocument {
|
|
4
|
+
key: string;
|
|
5
|
+
kind: "slide" | "figma-frame" | "notion-section" | "web-page" | "image";
|
|
6
|
+
title: string;
|
|
7
|
+
text: string;
|
|
8
|
+
imageBase64?: string;
|
|
9
|
+
owner: "personal" | "organization" | "other-organization";
|
|
10
|
+
status: "active" | "deprecated";
|
|
11
|
+
revisionOf?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CREATIVE_CONTEXT_PURPLE_IMAGE_BASE64 =
|
|
15
|
+
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEUlEQVR4nGOI9n+JFTEMLQkAOpFkwUU6BmIAAAAASUVORK5CYII=";
|
|
16
|
+
export const CREATIVE_CONTEXT_INK_IMAGE_BASE64 =
|
|
17
|
+
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEUlEQVR4nGPg5hbAihiGlgQAtbUJgThTKnUAAAAASUVORK5CYII=";
|
|
18
|
+
|
|
19
|
+
export const CREATIVE_CONTEXT_GOLD_DOCUMENTS: readonly CreativeContextGoldDocument[] =
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
key: "slide:metrics-v2",
|
|
23
|
+
kind: "slide",
|
|
24
|
+
title: "Weekly metrics scorecard",
|
|
25
|
+
text: "Dark scorecard with four KPI tiles, a purple trend line, and a concise takeaway.",
|
|
26
|
+
owner: "organization",
|
|
27
|
+
status: "active",
|
|
28
|
+
revisionOf: "slide:metrics-v1",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: "slide:metrics-v1",
|
|
32
|
+
kind: "slide",
|
|
33
|
+
title: "Weekly metrics scorecard old",
|
|
34
|
+
text: "Previous scorecard with four KPI tiles.",
|
|
35
|
+
owner: "organization",
|
|
36
|
+
status: "deprecated",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "figma:pricing-hero",
|
|
40
|
+
kind: "figma-frame",
|
|
41
|
+
title: "Pricing hero",
|
|
42
|
+
text: "1440 by 820 dark hero, Inter 56 heading, three pricing cards, primary trial button.",
|
|
43
|
+
imageBase64: CREATIVE_CONTEXT_INK_IMAGE_BASE64,
|
|
44
|
+
owner: "organization",
|
|
45
|
+
status: "active",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "notion:dense-guidelines",
|
|
49
|
+
kind: "notion-section",
|
|
50
|
+
title: "Dense launch system guidance",
|
|
51
|
+
text: "For launch narratives, lead with the user outcome, name the concrete workflow, support claims with one metric, keep headings under eight words, use direct active voice, avoid inflated superlatives, preserve the primary purple and ink palette, use compact scorecards for quantitative proof, and close with one explicit trial action. Product screenshots should center the working surface, annotations should identify the changed behavior, and supporting copy should remain subordinate to the artifact. For executive reviews, pair each KPI with a trend and a one-sentence interpretation. For campaign variants, retain the same hierarchy while adapting the evidence and call to action to the audience segment.",
|
|
52
|
+
owner: "organization",
|
|
53
|
+
status: "active",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "notion:voice",
|
|
57
|
+
kind: "notion-section",
|
|
58
|
+
title: "Launch writing principles",
|
|
59
|
+
text: "Direct, concise, optimistic product writing. Prefer concrete verbs and short sentences.",
|
|
60
|
+
owner: "organization",
|
|
61
|
+
status: "active",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "web:palette",
|
|
65
|
+
kind: "web-page",
|
|
66
|
+
title: "Brand home page",
|
|
67
|
+
text: "Primary #5B4FE9, ink #0B0B10, Inter headings, twelve-pixel radii.",
|
|
68
|
+
owner: "organization",
|
|
69
|
+
status: "active",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: "image:campaign",
|
|
73
|
+
kind: "image",
|
|
74
|
+
title: "Launch campaign hero",
|
|
75
|
+
text: "Purple gradient product hero with a centered device render and compact white headline.",
|
|
76
|
+
imageBase64: CREATIVE_CONTEXT_PURPLE_IMAGE_BASE64,
|
|
77
|
+
owner: "organization",
|
|
78
|
+
status: "active",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "private:other-org",
|
|
82
|
+
kind: "slide",
|
|
83
|
+
title: "Confidential acquisition plan",
|
|
84
|
+
text: "Restricted content owned by another organization.",
|
|
85
|
+
owner: "other-organization",
|
|
86
|
+
status: "active",
|
|
87
|
+
},
|
|
88
|
+
] as const;
|
|
89
|
+
|
|
90
|
+
export const CREATIVE_CONTEXT_GOLD_TASKS: readonly RetrievalEvalTask[] = [
|
|
91
|
+
{
|
|
92
|
+
id: "exact-metrics-layout",
|
|
93
|
+
query: { text: "weekly metrics scorecard with four KPI tiles" },
|
|
94
|
+
relevantKeys: ["slide:metrics-v2"],
|
|
95
|
+
forbiddenKeys: ["private:other-org"],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "visual-pricing-match",
|
|
99
|
+
query: { text: "dark pricing hero with three cards" },
|
|
100
|
+
relevantKeys: ["figma:pricing-hero"],
|
|
101
|
+
forbiddenKeys: ["private:other-org"],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "voice-match",
|
|
105
|
+
query: { text: "direct concise optimistic launch copy" },
|
|
106
|
+
relevantKeys: ["notion:voice"],
|
|
107
|
+
forbiddenKeys: ["private:other-org"],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "text-to-image-campaign-match",
|
|
111
|
+
query: { text: "purple campaign hero with centered device" },
|
|
112
|
+
relevantKeys: ["image:campaign"],
|
|
113
|
+
forbiddenKeys: ["private:other-org"],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "image-to-image-campaign-match",
|
|
117
|
+
query: {
|
|
118
|
+
images: [
|
|
119
|
+
{
|
|
120
|
+
mimeType: "image/png",
|
|
121
|
+
base64: CREATIVE_CONTEXT_PURPLE_IMAGE_BASE64,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
relevantKeys: ["image:campaign"],
|
|
126
|
+
forbiddenKeys: ["private:other-org"],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "dense-guidance-match",
|
|
130
|
+
query: {
|
|
131
|
+
text: "executive launch KPI trend interpretation active voice purple ink compact scorecard",
|
|
132
|
+
},
|
|
133
|
+
relevantKeys: ["notion:dense-guidelines"],
|
|
134
|
+
forbiddenKeys: ["private:other-org"],
|
|
135
|
+
},
|
|
136
|
+
] as const;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EmbeddingFamily,
|
|
3
|
+
MultimodalEmbeddingInput,
|
|
4
|
+
} from "../embeddings/types.js";
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
assertContextAcceptanceGates,
|
|
8
|
+
ContextAcceptanceReportSchema,
|
|
9
|
+
createBlindPreferencePacket,
|
|
10
|
+
runContextAcceptanceEvaluation,
|
|
11
|
+
scoreBlindPreferences,
|
|
12
|
+
type BlindPreferenceAnswerKey,
|
|
13
|
+
type BlindPreferenceWorksheetRow,
|
|
14
|
+
type ContextAcceptanceArtifact,
|
|
15
|
+
type ContextAcceptanceCase,
|
|
16
|
+
type ContextAcceptanceReport,
|
|
17
|
+
type ContextAcceptanceThresholds,
|
|
18
|
+
} from "./acceptance.js";
|
|
19
|
+
export { CREATIVE_CONTEXT_ACCEPTANCE_CASES } from "./acceptance-fixtures.js";
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
CREATIVE_CONTEXT_INK_IMAGE_BASE64,
|
|
23
|
+
CREATIVE_CONTEXT_GOLD_DOCUMENTS,
|
|
24
|
+
CREATIVE_CONTEXT_GOLD_TASKS,
|
|
25
|
+
CREATIVE_CONTEXT_PURPLE_IMAGE_BASE64,
|
|
26
|
+
type CreativeContextGoldDocument,
|
|
27
|
+
} from "./fixtures.js";
|
|
28
|
+
|
|
29
|
+
export interface RetrievalEvalTask {
|
|
30
|
+
id: string;
|
|
31
|
+
query: MultimodalEmbeddingInput;
|
|
32
|
+
relevantKeys: readonly string[];
|
|
33
|
+
forbiddenKeys?: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RetrievalEvalMetrics {
|
|
37
|
+
taskCount: number;
|
|
38
|
+
top5Recall: number;
|
|
39
|
+
meanReciprocalRank: number;
|
|
40
|
+
permissionLeaks: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ContextQualityTrial {
|
|
44
|
+
id: string;
|
|
45
|
+
preferred: "context-on" | "context-off" | "tie";
|
|
46
|
+
baselineEditDistance: number;
|
|
47
|
+
contextEditDistance: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ContextQualityMetrics {
|
|
51
|
+
trialCount: number;
|
|
52
|
+
contextPreferenceRate: number;
|
|
53
|
+
meanEditDistanceReduction: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface CreativeContextCorrectnessEvidence {
|
|
57
|
+
permissionLeaks: number;
|
|
58
|
+
generationsMissingPacks: number;
|
|
59
|
+
generationsMissingProvenance: number;
|
|
60
|
+
importsResumable: boolean;
|
|
61
|
+
importsIdempotent: boolean;
|
|
62
|
+
importsDeterministic: boolean;
|
|
63
|
+
revocationRemovesAccess: boolean;
|
|
64
|
+
lexicalLaneRebuilds: boolean;
|
|
65
|
+
vectorLaneRebuilds: boolean;
|
|
66
|
+
connectorsPassing: readonly string[];
|
|
67
|
+
consumersUsingReuseLadder: readonly string[];
|
|
68
|
+
nativeCodeRetrievalPassing: readonly string[];
|
|
69
|
+
nativeCloneFidelityPassing: readonly string[];
|
|
70
|
+
nativeCloneVersionsPinned: boolean;
|
|
71
|
+
supportedNativeElementsEditable: boolean;
|
|
72
|
+
runtimeExcludesFullResolutionReferenceRenders: boolean;
|
|
73
|
+
contextOptOutExcludesAllContext: boolean;
|
|
74
|
+
contextOnBeatsContextOff: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const REQUIRED_CONNECTORS = [
|
|
78
|
+
"upload",
|
|
79
|
+
"website",
|
|
80
|
+
"figma",
|
|
81
|
+
"notion",
|
|
82
|
+
"google-slides",
|
|
83
|
+
] as const;
|
|
84
|
+
const REQUIRED_CONSUMERS = ["slides", "assets", "design", "content"] as const;
|
|
85
|
+
const REQUIRED_NATIVE_CONSUMERS = ["slides", "design"] as const;
|
|
86
|
+
|
|
87
|
+
export function evaluateRankings(
|
|
88
|
+
tasks: readonly RetrievalEvalTask[],
|
|
89
|
+
rankings: Readonly<Record<string, readonly string[]>>,
|
|
90
|
+
): RetrievalEvalMetrics {
|
|
91
|
+
if (tasks.length === 0) {
|
|
92
|
+
return {
|
|
93
|
+
taskCount: 0,
|
|
94
|
+
top5Recall: 0,
|
|
95
|
+
meanReciprocalRank: 0,
|
|
96
|
+
permissionLeaks: 0,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
let top5 = 0;
|
|
100
|
+
let reciprocalRank = 0;
|
|
101
|
+
let permissionLeaks = 0;
|
|
102
|
+
for (const task of tasks) {
|
|
103
|
+
const ranking = rankings[task.id] ?? [];
|
|
104
|
+
const relevant = new Set(task.relevantKeys);
|
|
105
|
+
if (ranking.slice(0, 5).some((key) => relevant.has(key))) top5 += 1;
|
|
106
|
+
const first = ranking.findIndex((key) => relevant.has(key));
|
|
107
|
+
if (first >= 0) reciprocalRank += 1 / (first + 1);
|
|
108
|
+
const forbidden = new Set(task.forbiddenKeys ?? []);
|
|
109
|
+
permissionLeaks += ranking.filter((key) => forbidden.has(key)).length;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
taskCount: tasks.length,
|
|
113
|
+
top5Recall: top5 / tasks.length,
|
|
114
|
+
meanReciprocalRank: reciprocalRank / tasks.length,
|
|
115
|
+
permissionLeaks,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function evaluateContextQuality(
|
|
120
|
+
trials: readonly ContextQualityTrial[],
|
|
121
|
+
): ContextQualityMetrics {
|
|
122
|
+
if (!trials.length) {
|
|
123
|
+
return {
|
|
124
|
+
trialCount: 0,
|
|
125
|
+
contextPreferenceRate: 0,
|
|
126
|
+
meanEditDistanceReduction: 0,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const preferred = trials.filter(
|
|
130
|
+
(trial) => trial.preferred === "context-on",
|
|
131
|
+
).length;
|
|
132
|
+
const reduction = trials.reduce((total, trial) => {
|
|
133
|
+
if (trial.baselineEditDistance <= 0) return total;
|
|
134
|
+
return (
|
|
135
|
+
total +
|
|
136
|
+
(trial.baselineEditDistance - trial.contextEditDistance) /
|
|
137
|
+
trial.baselineEditDistance
|
|
138
|
+
);
|
|
139
|
+
}, 0);
|
|
140
|
+
return {
|
|
141
|
+
trialCount: trials.length,
|
|
142
|
+
contextPreferenceRate: preferred / trials.length,
|
|
143
|
+
meanEditDistanceReduction: reduction / trials.length,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function creativeContextCompletionFailures(
|
|
148
|
+
evidence: CreativeContextCorrectnessEvidence,
|
|
149
|
+
): string[] {
|
|
150
|
+
const failures: string[] = [];
|
|
151
|
+
if (evidence.permissionLeaks !== 0) failures.push("permission leaks");
|
|
152
|
+
if (evidence.generationsMissingPacks !== 0)
|
|
153
|
+
failures.push("generations missing context packs");
|
|
154
|
+
if (evidence.generationsMissingProvenance !== 0)
|
|
155
|
+
failures.push("generations missing provenance");
|
|
156
|
+
if (!evidence.importsResumable) failures.push("imports are not resumable");
|
|
157
|
+
if (!evidence.importsIdempotent) failures.push("imports are not idempotent");
|
|
158
|
+
if (!evidence.importsDeterministic)
|
|
159
|
+
failures.push("imports are not deterministic");
|
|
160
|
+
if (!evidence.revocationRemovesAccess)
|
|
161
|
+
failures.push("revocation does not remove retrieval access");
|
|
162
|
+
if (!evidence.lexicalLaneRebuilds)
|
|
163
|
+
failures.push("lexical retrieval cannot rebuild from canonical data");
|
|
164
|
+
if (!evidence.vectorLaneRebuilds)
|
|
165
|
+
failures.push("vector retrieval cannot rebuild from canonical data");
|
|
166
|
+
const connectorSet = new Set(evidence.connectorsPassing);
|
|
167
|
+
const missingConnectors = REQUIRED_CONNECTORS.filter(
|
|
168
|
+
(connector) => !connectorSet.has(connector),
|
|
169
|
+
);
|
|
170
|
+
if (missingConnectors.length)
|
|
171
|
+
failures.push(`connectors missing: ${missingConnectors.join(", ")}`);
|
|
172
|
+
const consumerSet = new Set(evidence.consumersUsingReuseLadder);
|
|
173
|
+
const missingConsumers = REQUIRED_CONSUMERS.filter(
|
|
174
|
+
(consumer) => !consumerSet.has(consumer),
|
|
175
|
+
);
|
|
176
|
+
if (missingConsumers.length)
|
|
177
|
+
failures.push(`reuse ladder missing: ${missingConsumers.join(", ")}`);
|
|
178
|
+
const nativeRetrievalSet = new Set(evidence.nativeCodeRetrievalPassing);
|
|
179
|
+
const missingNativeRetrieval = REQUIRED_NATIVE_CONSUMERS.filter(
|
|
180
|
+
(consumer) => !nativeRetrievalSet.has(consumer),
|
|
181
|
+
);
|
|
182
|
+
if (missingNativeRetrieval.length) {
|
|
183
|
+
failures.push(
|
|
184
|
+
`native code retrieval missing: ${missingNativeRetrieval.join(", ")}`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
const nativeFidelitySet = new Set(evidence.nativeCloneFidelityPassing);
|
|
188
|
+
const missingNativeFidelity = REQUIRED_NATIVE_CONSUMERS.filter(
|
|
189
|
+
(consumer) => !nativeFidelitySet.has(consumer),
|
|
190
|
+
);
|
|
191
|
+
if (missingNativeFidelity.length) {
|
|
192
|
+
failures.push(
|
|
193
|
+
`native clone fidelity missing: ${missingNativeFidelity.join(", ")}`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
if (!evidence.nativeCloneVersionsPinned) {
|
|
197
|
+
failures.push("native clone versions are not pinned");
|
|
198
|
+
}
|
|
199
|
+
if (!evidence.supportedNativeElementsEditable) {
|
|
200
|
+
failures.push("supported native elements are not editable");
|
|
201
|
+
}
|
|
202
|
+
if (!evidence.runtimeExcludesFullResolutionReferenceRenders) {
|
|
203
|
+
failures.push("runtime context includes full-resolution reference renders");
|
|
204
|
+
}
|
|
205
|
+
if (!evidence.contextOptOutExcludesAllContext)
|
|
206
|
+
failures.push("context opt-out does not exclude all context");
|
|
207
|
+
if (!evidence.contextOnBeatsContextOff)
|
|
208
|
+
failures.push("context-on does not beat context-off");
|
|
209
|
+
return failures;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function assertCreativeContextCompletionGates(
|
|
213
|
+
evidence: CreativeContextCorrectnessEvidence,
|
|
214
|
+
): void {
|
|
215
|
+
const failures = creativeContextCompletionFailures(evidence);
|
|
216
|
+
if (failures.length) {
|
|
217
|
+
throw new Error(
|
|
218
|
+
`Creative context completion gates failed: ${failures.join("; ")}`,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function cosine(left: readonly number[], right: readonly number[]): number {
|
|
224
|
+
if (left.length !== right.length) return Number.NEGATIVE_INFINITY;
|
|
225
|
+
let dot = 0;
|
|
226
|
+
let leftNorm = 0;
|
|
227
|
+
let rightNorm = 0;
|
|
228
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
229
|
+
const a = left[index] ?? 0;
|
|
230
|
+
const b = right[index] ?? 0;
|
|
231
|
+
dot += a * b;
|
|
232
|
+
leftNorm += a * a;
|
|
233
|
+
rightNorm += b * b;
|
|
234
|
+
}
|
|
235
|
+
if (!leftNorm || !rightNorm) return Number.NEGATIVE_INFINITY;
|
|
236
|
+
return dot / Math.sqrt(leftNorm * rightNorm);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export async function bakeOffEmbeddingFamilies(input: {
|
|
240
|
+
families: readonly EmbeddingFamily[];
|
|
241
|
+
documents: Readonly<Record<string, MultimodalEmbeddingInput>>;
|
|
242
|
+
tasks: readonly RetrievalEvalTask[];
|
|
243
|
+
allowedDocumentKeys?: readonly string[];
|
|
244
|
+
topK?: number;
|
|
245
|
+
}): Promise<{ family: EmbeddingFamily; metrics: RetrievalEvalMetrics }[]> {
|
|
246
|
+
const documentEntries = Object.entries(input.documents);
|
|
247
|
+
const allowed = input.allowedDocumentKeys
|
|
248
|
+
? new Set(input.allowedDocumentKeys)
|
|
249
|
+
: null;
|
|
250
|
+
const results = await Promise.all(
|
|
251
|
+
input.families.map(async (family) => {
|
|
252
|
+
const documentVectors = await family.embed(
|
|
253
|
+
documentEntries.map(([, value]) => value),
|
|
254
|
+
"document",
|
|
255
|
+
);
|
|
256
|
+
const queryVectors = await family.embed(
|
|
257
|
+
input.tasks.map((task) => task.query),
|
|
258
|
+
"query",
|
|
259
|
+
);
|
|
260
|
+
const rankings: Record<string, string[]> = {};
|
|
261
|
+
input.tasks.forEach((task, taskIndex) => {
|
|
262
|
+
const query = queryVectors[taskIndex] ?? [];
|
|
263
|
+
rankings[task.id] = documentEntries
|
|
264
|
+
.filter(([key]) => !allowed || allowed.has(key))
|
|
265
|
+
.map(([key], index) => ({
|
|
266
|
+
key,
|
|
267
|
+
score: cosine(query, documentVectors[index] ?? []),
|
|
268
|
+
}))
|
|
269
|
+
.sort((a, b) => b.score - a.score || a.key.localeCompare(b.key))
|
|
270
|
+
.slice(0, Math.max(5, input.topK ?? 20))
|
|
271
|
+
.map((entry) => entry.key);
|
|
272
|
+
});
|
|
273
|
+
return { family, metrics: evaluateRankings(input.tasks, rankings) };
|
|
274
|
+
}),
|
|
275
|
+
);
|
|
276
|
+
return results.sort(
|
|
277
|
+
(a, b) =>
|
|
278
|
+
a.metrics.permissionLeaks - b.metrics.permissionLeaks ||
|
|
279
|
+
b.metrics.top5Recall - a.metrics.top5Recall ||
|
|
280
|
+
b.metrics.meanReciprocalRank - a.metrics.meanReciprocalRank,
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export function embeddingBakeoffPasses(metrics: RetrievalEvalMetrics): boolean {
|
|
285
|
+
return (
|
|
286
|
+
metrics.taskCount >= 6 &&
|
|
287
|
+
metrics.permissionLeaks === 0 &&
|
|
288
|
+
metrics.top5Recall >= 0.8 &&
|
|
289
|
+
metrics.meanReciprocalRank >= 0.35
|
|
290
|
+
);
|
|
291
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
|
+
import { describe, expect, it, vi } from "vitest";
|
|
6
|
+
|
|
7
|
+
vi.mock("@agent-native/core/client", () => ({
|
|
8
|
+
getBrowserTabId: () => "acceptance-tab",
|
|
9
|
+
readClientAppState: vi.fn(),
|
|
10
|
+
setClientAppState: vi.fn(),
|
|
11
|
+
useActionMutation: vi.fn(),
|
|
12
|
+
useActionQuery: vi.fn(),
|
|
13
|
+
useChangeVersion: () => 0,
|
|
14
|
+
useT: () => (key: string) =>
|
|
15
|
+
({
|
|
16
|
+
"creativeContext.off": "Off",
|
|
17
|
+
"creativeContext.automatic": "Automatic",
|
|
18
|
+
})[key] ?? key,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const { CreativeContextChip } =
|
|
22
|
+
await import("../client/CreativeContextChip.js");
|
|
23
|
+
const { normalizeCreativeContextState } =
|
|
24
|
+
await import("../client/application-state.js");
|
|
25
|
+
const { UploadContextConnector } = await import("../connectors/upload.js");
|
|
26
|
+
|
|
27
|
+
describe("credential-free Library acceptance", () => {
|
|
28
|
+
it("imports usable PPTX items, displays their pack chip, and structurally opts out", async () => {
|
|
29
|
+
const bytes = new Uint8Array(
|
|
30
|
+
await readFile(
|
|
31
|
+
new URL("./fixtures/launch-system-v2.pptx", import.meta.url),
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
const handle = {
|
|
35
|
+
id: "acceptance-pptx",
|
|
36
|
+
provider: "fixture",
|
|
37
|
+
opaque: true as const,
|
|
38
|
+
encrypted: true,
|
|
39
|
+
mimeType:
|
|
40
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
41
|
+
};
|
|
42
|
+
const config = {
|
|
43
|
+
items: [
|
|
44
|
+
{
|
|
45
|
+
id: "launch-system",
|
|
46
|
+
title: "Launch system",
|
|
47
|
+
fileName: "launch-system.pptx",
|
|
48
|
+
mimeType: handle.mimeType,
|
|
49
|
+
blobHandle: handle,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
const context = {
|
|
54
|
+
appId: "content",
|
|
55
|
+
ownerEmail: "owner@example.com",
|
|
56
|
+
readPrivateBlob: async () => ({ data: bytes, handle }),
|
|
57
|
+
putPrivateBlob: async (input: {
|
|
58
|
+
data: Uint8Array;
|
|
59
|
+
mimeType?: string;
|
|
60
|
+
}) => ({
|
|
61
|
+
id: createHash("sha256").update(input.data).digest("hex").slice(0, 20),
|
|
62
|
+
provider: "fixture",
|
|
63
|
+
opaque: true as const,
|
|
64
|
+
encrypted: true,
|
|
65
|
+
mimeType: input.mimeType,
|
|
66
|
+
}),
|
|
67
|
+
} as never;
|
|
68
|
+
const connector = new UploadContextConnector();
|
|
69
|
+
const inventory = await connector.inventory(
|
|
70
|
+
{ sourceId: "library-source", config },
|
|
71
|
+
context,
|
|
72
|
+
);
|
|
73
|
+
const imported = await connector.fetch(
|
|
74
|
+
{
|
|
75
|
+
sourceId: "library-source",
|
|
76
|
+
config,
|
|
77
|
+
item: inventory.items[0]!,
|
|
78
|
+
},
|
|
79
|
+
context,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
expect(imported.items).toHaveLength(4);
|
|
83
|
+
expect(imported.items.every((item) => item.parseStatus === "parsed")).toBe(
|
|
84
|
+
true,
|
|
85
|
+
);
|
|
86
|
+
expect(imported.items[0]).toMatchObject({
|
|
87
|
+
externalId: "launch-system",
|
|
88
|
+
metadata: {
|
|
89
|
+
childExternalIds: [
|
|
90
|
+
"launch-system:slide-1",
|
|
91
|
+
"launch-system:slide-2",
|
|
92
|
+
"launch-system:slide-3",
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
expect(imported.items[1]?.chunks?.length).toBeGreaterThan(0);
|
|
97
|
+
|
|
98
|
+
const pack = {
|
|
99
|
+
id: "pack:launch-system",
|
|
100
|
+
name: "Launch system",
|
|
101
|
+
description: "Imported approved launch evidence",
|
|
102
|
+
derivedFromPackId: null,
|
|
103
|
+
brandDnaVersionId: null,
|
|
104
|
+
contextMode: "auto",
|
|
105
|
+
request: {},
|
|
106
|
+
memberCount: imported.items.length,
|
|
107
|
+
pinned: true,
|
|
108
|
+
archivedAt: null,
|
|
109
|
+
visibility: "private" as const,
|
|
110
|
+
createdAt: "2026-07-16T00:00:00.000Z",
|
|
111
|
+
};
|
|
112
|
+
const enabledMarkup = renderToStaticMarkup(
|
|
113
|
+
<CreativeContextChip
|
|
114
|
+
state={{
|
|
115
|
+
contextMode: "auto",
|
|
116
|
+
currentPackId: pack.id,
|
|
117
|
+
pinnedPackId: pack.id,
|
|
118
|
+
}}
|
|
119
|
+
packs={[pack]}
|
|
120
|
+
/>,
|
|
121
|
+
);
|
|
122
|
+
expect(enabledMarkup).toContain("Launch system");
|
|
123
|
+
expect(enabledMarkup).toContain("Imported approved launch evidence");
|
|
124
|
+
|
|
125
|
+
const off = normalizeCreativeContextState({
|
|
126
|
+
contextMode: "off",
|
|
127
|
+
currentPackId: pack.id,
|
|
128
|
+
pinnedPackId: pack.id,
|
|
129
|
+
});
|
|
130
|
+
expect(off).toEqual({
|
|
131
|
+
contextMode: "off",
|
|
132
|
+
currentPackId: null,
|
|
133
|
+
pinnedPackId: null,
|
|
134
|
+
});
|
|
135
|
+
const offMarkup = renderToStaticMarkup(
|
|
136
|
+
<CreativeContextChip state={off} packs={[pack]} />,
|
|
137
|
+
);
|
|
138
|
+
expect(offMarkup).toContain("Off");
|
|
139
|
+
expect(offMarkup).not.toContain("Launch system");
|
|
140
|
+
});
|
|
141
|
+
});
|
package/src/index.ts
ADDED