@genesislcap/ai-assistant 15.35.4-FUI-0.9 → 15.35.4-FUI-0.10
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/dist/ai-assistant.api.json +23 -0
- package/dist/ai-assistant.d.ts +25 -0
- package/dist/custom-elements.json +213 -205
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts +18 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts +15 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/esm/components/chat-bubble/chat-bubble.js +24 -5
- package/dist/esm/index.js +3 -1
- package/dist/esm/main/main.template.js +21 -6
- package/docs/styling.md +40 -7
- package/package.json +18 -18
|
@@ -17523,6 +17523,29 @@
|
|
|
17523
17523
|
],
|
|
17524
17524
|
"extendsTokenRanges": []
|
|
17525
17525
|
},
|
|
17526
|
+
{
|
|
17527
|
+
"kind": "Variable",
|
|
17528
|
+
"canonicalReference": "@genesislcap/ai-assistant!MARKDOWN_EXPORTPARTS:var",
|
|
17529
|
+
"docComment": "/**\n * Every part this component exposes, as an `exportparts` value.\n *\n * `::part()` crosses exactly one shadow boundary, so a host that renders `<ai-chat-markdown>` in its own shadow root has to forward these for an app to reach them at all. Built from the map above rather than written out, so the forwarded list cannot drift from what is emitted.\n */\n",
|
|
17530
|
+
"excerptTokens": [
|
|
17531
|
+
{
|
|
17532
|
+
"kind": "Content",
|
|
17533
|
+
"text": "MARKDOWN_EXPORTPARTS: "
|
|
17534
|
+
},
|
|
17535
|
+
{
|
|
17536
|
+
"kind": "Content",
|
|
17537
|
+
"text": "string"
|
|
17538
|
+
}
|
|
17539
|
+
],
|
|
17540
|
+
"fileUrlPath": "src/components/chat-markdown/chat-markdown.ts",
|
|
17541
|
+
"isReadonly": true,
|
|
17542
|
+
"releaseTag": "Public",
|
|
17543
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
17544
|
+
"variableTypeTokenRange": {
|
|
17545
|
+
"startIndex": 1,
|
|
17546
|
+
"endIndex": 2
|
|
17547
|
+
}
|
|
17548
|
+
},
|
|
17526
17549
|
{
|
|
17527
17550
|
"kind": "Variable",
|
|
17528
17551
|
"canonicalReference": "@genesislcap/ai-assistant!messageTimestampTemplate:var",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -1178,6 +1178,22 @@ export declare interface AssistantAppSettingsToggle {
|
|
|
1178
1178
|
*/
|
|
1179
1179
|
export declare const assistantSettingsSectionTitleStyles: ElementStyles;
|
|
1180
1180
|
|
|
1181
|
+
/**
|
|
1182
|
+
* Part names for one avatar element: the bare name, a role-level name, and — on the assistant
|
|
1183
|
+
* side, whose rows vary — the message type.
|
|
1184
|
+
*
|
|
1185
|
+
* The role-level name is the one an app usually wants. `messageType` splits the assistant across
|
|
1186
|
+
* `ai`, `ai-thinking`, `ai-function` and `interaction`, so without it "style the assistant's
|
|
1187
|
+
* avatar, not the user's" takes four selectors and silently misses any type added later.
|
|
1188
|
+
* `::part()` names cannot be chained, so each has to be a name of its own rather than a
|
|
1189
|
+
* combination. The user side needs no extra name — its role and its type are both `user`.
|
|
1190
|
+
*
|
|
1191
|
+
* Exported for the unit test that pins the vocabulary; not part of the element API.
|
|
1192
|
+
*
|
|
1193
|
+
* @internal
|
|
1194
|
+
*/
|
|
1195
|
+
export declare const avatarPartsFor: (base: string, type: string) => string;
|
|
1196
|
+
|
|
1181
1197
|
declare interface BaseAgentConfig {
|
|
1182
1198
|
/**
|
|
1183
1199
|
* Stable identity for this agent. Used for classifier routing, manual
|
|
@@ -5076,6 +5092,15 @@ export declare interface ManualSelectionConfig {
|
|
|
5076
5092
|
hint?: string;
|
|
5077
5093
|
}
|
|
5078
5094
|
|
|
5095
|
+
/**
|
|
5096
|
+
* Every part this component exposes, as an `exportparts` value.
|
|
5097
|
+
*
|
|
5098
|
+
* `::part()` crosses exactly one shadow boundary, so a host that renders `<ai-chat-markdown>` in
|
|
5099
|
+
* its own shadow root has to forward these for an app to reach them at all. Built from the map
|
|
5100
|
+
* above rather than written out, so the forwarded list cannot drift from what is emitted.
|
|
5101
|
+
*/
|
|
5102
|
+
export declare const MARKDOWN_EXPORTPARTS: string;
|
|
5103
|
+
|
|
5079
5104
|
/**
|
|
5080
5105
|
* The timestamp shown beside the sender name (GENC-1257).
|
|
5081
5106
|
*
|
|
@@ -893,6 +893,14 @@
|
|
|
893
893
|
"name": "AiChatMarkdown",
|
|
894
894
|
"module": "./components/chat-markdown/chat-markdown"
|
|
895
895
|
}
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"kind": "js",
|
|
899
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
900
|
+
"declaration": {
|
|
901
|
+
"name": "MARKDOWN_EXPORTPARTS",
|
|
902
|
+
"module": "./components/chat-markdown/chat-markdown"
|
|
903
|
+
}
|
|
896
904
|
}
|
|
897
905
|
]
|
|
898
906
|
},
|
|
@@ -1634,6 +1642,211 @@
|
|
|
1634
1642
|
}
|
|
1635
1643
|
]
|
|
1636
1644
|
},
|
|
1645
|
+
{
|
|
1646
|
+
"kind": "javascript-module",
|
|
1647
|
+
"path": "src/config/config.ts",
|
|
1648
|
+
"declarations": [
|
|
1649
|
+
{
|
|
1650
|
+
"kind": "function",
|
|
1651
|
+
"name": "defineAgent",
|
|
1652
|
+
"description": "Identity helper that infers the narrowest possible type for an agent config,\npreserving string literal types (including `name`) without requiring `as const`.\n\nUse this when you need `typeof myAgent` to carry the literal `name` type —\nfor example, when wiring `ChatToolHandlers<typeof myAgent>`.\n\n```ts\nconst myAgent = defineAgent({ name: 'my_agent', ... });\ntype Handlers = ChatToolHandlers<typeof myAgent>;\n// requestSubAgent name param is now typed as 'my_agent'\n```"
|
|
1653
|
+
}
|
|
1654
|
+
],
|
|
1655
|
+
"exports": [
|
|
1656
|
+
{
|
|
1657
|
+
"kind": "js",
|
|
1658
|
+
"name": "CachePolicy",
|
|
1659
|
+
"declaration": {
|
|
1660
|
+
"name": "CachePolicy",
|
|
1661
|
+
"module": "src/config/config.ts"
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
"kind": "js",
|
|
1666
|
+
"name": "ChatFallback",
|
|
1667
|
+
"declaration": {
|
|
1668
|
+
"name": "ChatFallback",
|
|
1669
|
+
"module": "src/config/config.ts"
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
"kind": "js",
|
|
1674
|
+
"name": "ChatInputDuringExecutionMode",
|
|
1675
|
+
"declaration": {
|
|
1676
|
+
"name": "ChatInputDuringExecutionMode",
|
|
1677
|
+
"module": "src/config/config.ts"
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"kind": "js",
|
|
1682
|
+
"name": "ChatThinkingPolicy",
|
|
1683
|
+
"declaration": {
|
|
1684
|
+
"name": "ChatThinkingPolicy",
|
|
1685
|
+
"module": "src/config/config.ts"
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
"kind": "js",
|
|
1690
|
+
"name": "ChatToolChoice",
|
|
1691
|
+
"declaration": {
|
|
1692
|
+
"name": "ChatToolChoice",
|
|
1693
|
+
"module": "src/config/config.ts"
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
"kind": "js",
|
|
1698
|
+
"name": "defineAgent",
|
|
1699
|
+
"declaration": {
|
|
1700
|
+
"name": "defineAgent",
|
|
1701
|
+
"module": "src/config/config.ts"
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
]
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
"kind": "javascript-module",
|
|
1708
|
+
"path": "src/config/define-stateful-agent.ts",
|
|
1709
|
+
"declarations": [
|
|
1710
|
+
{
|
|
1711
|
+
"kind": "function",
|
|
1712
|
+
"name": "restoreMachine",
|
|
1713
|
+
"return": {
|
|
1714
|
+
"type": {
|
|
1715
|
+
"text": "void"
|
|
1716
|
+
}
|
|
1717
|
+
},
|
|
1718
|
+
"parameters": [
|
|
1719
|
+
{
|
|
1720
|
+
"name": "machine",
|
|
1721
|
+
"type": {
|
|
1722
|
+
"text": "{ stop: () => void; start: (options?: { state?: unknown }) => void }"
|
|
1723
|
+
},
|
|
1724
|
+
"description": "the machine to restore (already constructed/started)."
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
"name": "restored",
|
|
1728
|
+
"type": {
|
|
1729
|
+
"text": "unknown"
|
|
1730
|
+
},
|
|
1731
|
+
"description": "the agent's serialized image (`ctx.restored` in `init`)."
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
"name": "key",
|
|
1735
|
+
"default": "'machine'",
|
|
1736
|
+
"description": "the property the machine occupies in the snapshot; defaults to\n`'machine'` to match the conventional `{ machine }` state bag."
|
|
1737
|
+
}
|
|
1738
|
+
],
|
|
1739
|
+
"description": "Restore a foundation-state-machine instance from a snapshot produced by the\ndefault serializer (or `machine.getPersistedSnapshot()`). Call inside a\nstateful agent's `init` to resume the machine in its exact prior place:\n\n```ts\ninit: ({ restored }) => {\n const machine = new MyMachine();\n restoreMachine(machine, restored); // resume, or no-op on a fresh start\n return { machine };\n}\n```\n\nNo-ops when there is nothing to restore (a fresh session), leaving the\nfreshly-constructed machine in its initial state."
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
"kind": "function",
|
|
1743
|
+
"name": "defineStatefulAgent",
|
|
1744
|
+
"return": {
|
|
1745
|
+
"type": {
|
|
1746
|
+
"text": "AgentConfig"
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
"parameters": [
|
|
1750
|
+
{
|
|
1751
|
+
"name": "opts",
|
|
1752
|
+
"type": {
|
|
1753
|
+
"text": "StatefulAgentInit<S>"
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
],
|
|
1757
|
+
"description": "Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool\nhandlers all close over a long-lived state object created on activation.\n\nThe framework wires the lifecycle: `init` on `onActivate`, `dispose` on\n`onDeactivate`. State is held inside the helper's closure — never exposed on\nthe resulting `AgentConfig` — so the redux serializer doesn't see it."
|
|
1758
|
+
}
|
|
1759
|
+
],
|
|
1760
|
+
"exports": [
|
|
1761
|
+
{
|
|
1762
|
+
"kind": "js",
|
|
1763
|
+
"name": "restoreMachine",
|
|
1764
|
+
"declaration": {
|
|
1765
|
+
"name": "restoreMachine",
|
|
1766
|
+
"module": "src/config/define-stateful-agent.ts"
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
"kind": "js",
|
|
1771
|
+
"name": "defineStatefulAgent",
|
|
1772
|
+
"declaration": {
|
|
1773
|
+
"name": "defineStatefulAgent",
|
|
1774
|
+
"module": "src/config/define-stateful-agent.ts"
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
]
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
"kind": "javascript-module",
|
|
1781
|
+
"path": "src/config/fallback-agents.ts",
|
|
1782
|
+
"declarations": [
|
|
1783
|
+
{
|
|
1784
|
+
"kind": "variable",
|
|
1785
|
+
"name": "friendlyFallbackAgent",
|
|
1786
|
+
"type": {
|
|
1787
|
+
"text": "FallbackAgentConfig"
|
|
1788
|
+
},
|
|
1789
|
+
"default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a warm, friendly assistant. For general conversation like \"Hi\" or \"How are you\", you can have a friendly chat. For anything more complex, you cannot directly help, but you can explain what specialists are available. The available specialists are:\\n\\n{{agents}}\\n\\nPolitely let the user know what you can help with and invite them to rephrase their request if it is outside your scope.`,\n}",
|
|
1790
|
+
"description": "A warm, conversational fallback agent. Acknowledges it can't help directly,\nexplains what the available specialists can do, and invites the user to retry.\n\nThe system prompt is generated at runtime by `OrchestratingDriver` from the\nspecialist list — no manual authoring required."
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
"kind": "variable",
|
|
1794
|
+
"name": "strictFallbackAgent",
|
|
1795
|
+
"type": {
|
|
1796
|
+
"text": "FallbackAgentConfig"
|
|
1797
|
+
},
|
|
1798
|
+
"default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a concise assistant. The user's request is outside your scope. The available specialists are: {{agents}}.\n\n{{unroutable}}\n\nAnswer in a single short sentence. Do not elaborate.`,\n}",
|
|
1799
|
+
"description": "A brief, professional fallback agent. States what is available without\nelaboration. The `{{agents}}` placeholder is replaced at runtime by\n`OrchestratingDriver` with the generated specialist list.\n\nThe `{{unroutable}}` placeholder positions `UNROUTABLE_INSTRUCTION` — the framework's\ninstruction for a substantive request no specialist covers, which is otherwise APPENDED to a\nstring-form prompt. Positioned rather than appended for one reason: this preset's whole point is\nbrevity, and appended text would be the last thing the model reads. Putting the block above the\nbrevity rule leaves \"a single short sentence\" with the recency, so the two compose instead of\ncompeting. A prompt whose tone rules matter should do the same."
|
|
1800
|
+
}
|
|
1801
|
+
],
|
|
1802
|
+
"exports": [
|
|
1803
|
+
{
|
|
1804
|
+
"kind": "js",
|
|
1805
|
+
"name": "friendlyFallbackAgent",
|
|
1806
|
+
"declaration": {
|
|
1807
|
+
"name": "friendlyFallbackAgent",
|
|
1808
|
+
"module": "src/config/fallback-agents.ts"
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
"kind": "js",
|
|
1813
|
+
"name": "strictFallbackAgent",
|
|
1814
|
+
"declaration": {
|
|
1815
|
+
"name": "strictFallbackAgent",
|
|
1816
|
+
"module": "src/config/fallback-agents.ts"
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
]
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
"kind": "javascript-module",
|
|
1823
|
+
"path": "src/config/index.ts",
|
|
1824
|
+
"declarations": [],
|
|
1825
|
+
"exports": [
|
|
1826
|
+
{
|
|
1827
|
+
"kind": "js",
|
|
1828
|
+
"name": "*",
|
|
1829
|
+
"declaration": {
|
|
1830
|
+
"name": "*",
|
|
1831
|
+
"package": "./config"
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
"kind": "js",
|
|
1836
|
+
"name": "*",
|
|
1837
|
+
"declaration": {
|
|
1838
|
+
"name": "*",
|
|
1839
|
+
"package": "./fallback-agents"
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
]
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
"kind": "javascript-module",
|
|
1846
|
+
"path": "src/config/validate-providers.ts",
|
|
1847
|
+
"declarations": [],
|
|
1848
|
+
"exports": []
|
|
1849
|
+
},
|
|
1637
1850
|
{
|
|
1638
1851
|
"kind": "javascript-module",
|
|
1639
1852
|
"path": "src/genesis/config.ts",
|
|
@@ -2083,211 +2296,6 @@
|
|
|
2083
2296
|
}
|
|
2084
2297
|
]
|
|
2085
2298
|
},
|
|
2086
|
-
{
|
|
2087
|
-
"kind": "javascript-module",
|
|
2088
|
-
"path": "src/config/config.ts",
|
|
2089
|
-
"declarations": [
|
|
2090
|
-
{
|
|
2091
|
-
"kind": "function",
|
|
2092
|
-
"name": "defineAgent",
|
|
2093
|
-
"description": "Identity helper that infers the narrowest possible type for an agent config,\npreserving string literal types (including `name`) without requiring `as const`.\n\nUse this when you need `typeof myAgent` to carry the literal `name` type —\nfor example, when wiring `ChatToolHandlers<typeof myAgent>`.\n\n```ts\nconst myAgent = defineAgent({ name: 'my_agent', ... });\ntype Handlers = ChatToolHandlers<typeof myAgent>;\n// requestSubAgent name param is now typed as 'my_agent'\n```"
|
|
2094
|
-
}
|
|
2095
|
-
],
|
|
2096
|
-
"exports": [
|
|
2097
|
-
{
|
|
2098
|
-
"kind": "js",
|
|
2099
|
-
"name": "CachePolicy",
|
|
2100
|
-
"declaration": {
|
|
2101
|
-
"name": "CachePolicy",
|
|
2102
|
-
"module": "src/config/config.ts"
|
|
2103
|
-
}
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
"kind": "js",
|
|
2107
|
-
"name": "ChatFallback",
|
|
2108
|
-
"declaration": {
|
|
2109
|
-
"name": "ChatFallback",
|
|
2110
|
-
"module": "src/config/config.ts"
|
|
2111
|
-
}
|
|
2112
|
-
},
|
|
2113
|
-
{
|
|
2114
|
-
"kind": "js",
|
|
2115
|
-
"name": "ChatInputDuringExecutionMode",
|
|
2116
|
-
"declaration": {
|
|
2117
|
-
"name": "ChatInputDuringExecutionMode",
|
|
2118
|
-
"module": "src/config/config.ts"
|
|
2119
|
-
}
|
|
2120
|
-
},
|
|
2121
|
-
{
|
|
2122
|
-
"kind": "js",
|
|
2123
|
-
"name": "ChatThinkingPolicy",
|
|
2124
|
-
"declaration": {
|
|
2125
|
-
"name": "ChatThinkingPolicy",
|
|
2126
|
-
"module": "src/config/config.ts"
|
|
2127
|
-
}
|
|
2128
|
-
},
|
|
2129
|
-
{
|
|
2130
|
-
"kind": "js",
|
|
2131
|
-
"name": "ChatToolChoice",
|
|
2132
|
-
"declaration": {
|
|
2133
|
-
"name": "ChatToolChoice",
|
|
2134
|
-
"module": "src/config/config.ts"
|
|
2135
|
-
}
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
"kind": "js",
|
|
2139
|
-
"name": "defineAgent",
|
|
2140
|
-
"declaration": {
|
|
2141
|
-
"name": "defineAgent",
|
|
2142
|
-
"module": "src/config/config.ts"
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
]
|
|
2146
|
-
},
|
|
2147
|
-
{
|
|
2148
|
-
"kind": "javascript-module",
|
|
2149
|
-
"path": "src/config/define-stateful-agent.ts",
|
|
2150
|
-
"declarations": [
|
|
2151
|
-
{
|
|
2152
|
-
"kind": "function",
|
|
2153
|
-
"name": "restoreMachine",
|
|
2154
|
-
"return": {
|
|
2155
|
-
"type": {
|
|
2156
|
-
"text": "void"
|
|
2157
|
-
}
|
|
2158
|
-
},
|
|
2159
|
-
"parameters": [
|
|
2160
|
-
{
|
|
2161
|
-
"name": "machine",
|
|
2162
|
-
"type": {
|
|
2163
|
-
"text": "{ stop: () => void; start: (options?: { state?: unknown }) => void }"
|
|
2164
|
-
},
|
|
2165
|
-
"description": "the machine to restore (already constructed/started)."
|
|
2166
|
-
},
|
|
2167
|
-
{
|
|
2168
|
-
"name": "restored",
|
|
2169
|
-
"type": {
|
|
2170
|
-
"text": "unknown"
|
|
2171
|
-
},
|
|
2172
|
-
"description": "the agent's serialized image (`ctx.restored` in `init`)."
|
|
2173
|
-
},
|
|
2174
|
-
{
|
|
2175
|
-
"name": "key",
|
|
2176
|
-
"default": "'machine'",
|
|
2177
|
-
"description": "the property the machine occupies in the snapshot; defaults to\n`'machine'` to match the conventional `{ machine }` state bag."
|
|
2178
|
-
}
|
|
2179
|
-
],
|
|
2180
|
-
"description": "Restore a foundation-state-machine instance from a snapshot produced by the\ndefault serializer (or `machine.getPersistedSnapshot()`). Call inside a\nstateful agent's `init` to resume the machine in its exact prior place:\n\n```ts\ninit: ({ restored }) => {\n const machine = new MyMachine();\n restoreMachine(machine, restored); // resume, or no-op on a fresh start\n return { machine };\n}\n```\n\nNo-ops when there is nothing to restore (a fresh session), leaving the\nfreshly-constructed machine in its initial state."
|
|
2181
|
-
},
|
|
2182
|
-
{
|
|
2183
|
-
"kind": "function",
|
|
2184
|
-
"name": "defineStatefulAgent",
|
|
2185
|
-
"return": {
|
|
2186
|
-
"type": {
|
|
2187
|
-
"text": "AgentConfig"
|
|
2188
|
-
}
|
|
2189
|
-
},
|
|
2190
|
-
"parameters": [
|
|
2191
|
-
{
|
|
2192
|
-
"name": "opts",
|
|
2193
|
-
"type": {
|
|
2194
|
-
"text": "StatefulAgentInit<S>"
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
],
|
|
2198
|
-
"description": "Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool\nhandlers all close over a long-lived state object created on activation.\n\nThe framework wires the lifecycle: `init` on `onActivate`, `dispose` on\n`onDeactivate`. State is held inside the helper's closure — never exposed on\nthe resulting `AgentConfig` — so the redux serializer doesn't see it."
|
|
2199
|
-
}
|
|
2200
|
-
],
|
|
2201
|
-
"exports": [
|
|
2202
|
-
{
|
|
2203
|
-
"kind": "js",
|
|
2204
|
-
"name": "restoreMachine",
|
|
2205
|
-
"declaration": {
|
|
2206
|
-
"name": "restoreMachine",
|
|
2207
|
-
"module": "src/config/define-stateful-agent.ts"
|
|
2208
|
-
}
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
"kind": "js",
|
|
2212
|
-
"name": "defineStatefulAgent",
|
|
2213
|
-
"declaration": {
|
|
2214
|
-
"name": "defineStatefulAgent",
|
|
2215
|
-
"module": "src/config/define-stateful-agent.ts"
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
]
|
|
2219
|
-
},
|
|
2220
|
-
{
|
|
2221
|
-
"kind": "javascript-module",
|
|
2222
|
-
"path": "src/config/fallback-agents.ts",
|
|
2223
|
-
"declarations": [
|
|
2224
|
-
{
|
|
2225
|
-
"kind": "variable",
|
|
2226
|
-
"name": "friendlyFallbackAgent",
|
|
2227
|
-
"type": {
|
|
2228
|
-
"text": "FallbackAgentConfig"
|
|
2229
|
-
},
|
|
2230
|
-
"default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a warm, friendly assistant. For general conversation like \"Hi\" or \"How are you\", you can have a friendly chat. For anything more complex, you cannot directly help, but you can explain what specialists are available. The available specialists are:\\n\\n{{agents}}\\n\\nPolitely let the user know what you can help with and invite them to rephrase their request if it is outside your scope.`,\n}",
|
|
2231
|
-
"description": "A warm, conversational fallback agent. Acknowledges it can't help directly,\nexplains what the available specialists can do, and invites the user to retry.\n\nThe system prompt is generated at runtime by `OrchestratingDriver` from the\nspecialist list — no manual authoring required."
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
"kind": "variable",
|
|
2235
|
-
"name": "strictFallbackAgent",
|
|
2236
|
-
"type": {
|
|
2237
|
-
"text": "FallbackAgentConfig"
|
|
2238
|
-
},
|
|
2239
|
-
"default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a concise assistant. The user's request is outside your scope. The available specialists are: {{agents}}.\n\n{{unroutable}}\n\nAnswer in a single short sentence. Do not elaborate.`,\n}",
|
|
2240
|
-
"description": "A brief, professional fallback agent. States what is available without\nelaboration. The `{{agents}}` placeholder is replaced at runtime by\n`OrchestratingDriver` with the generated specialist list.\n\nThe `{{unroutable}}` placeholder positions `UNROUTABLE_INSTRUCTION` — the framework's\ninstruction for a substantive request no specialist covers, which is otherwise APPENDED to a\nstring-form prompt. Positioned rather than appended for one reason: this preset's whole point is\nbrevity, and appended text would be the last thing the model reads. Putting the block above the\nbrevity rule leaves \"a single short sentence\" with the recency, so the two compose instead of\ncompeting. A prompt whose tone rules matter should do the same."
|
|
2241
|
-
}
|
|
2242
|
-
],
|
|
2243
|
-
"exports": [
|
|
2244
|
-
{
|
|
2245
|
-
"kind": "js",
|
|
2246
|
-
"name": "friendlyFallbackAgent",
|
|
2247
|
-
"declaration": {
|
|
2248
|
-
"name": "friendlyFallbackAgent",
|
|
2249
|
-
"module": "src/config/fallback-agents.ts"
|
|
2250
|
-
}
|
|
2251
|
-
},
|
|
2252
|
-
{
|
|
2253
|
-
"kind": "js",
|
|
2254
|
-
"name": "strictFallbackAgent",
|
|
2255
|
-
"declaration": {
|
|
2256
|
-
"name": "strictFallbackAgent",
|
|
2257
|
-
"module": "src/config/fallback-agents.ts"
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
]
|
|
2261
|
-
},
|
|
2262
|
-
{
|
|
2263
|
-
"kind": "javascript-module",
|
|
2264
|
-
"path": "src/config/index.ts",
|
|
2265
|
-
"declarations": [],
|
|
2266
|
-
"exports": [
|
|
2267
|
-
{
|
|
2268
|
-
"kind": "js",
|
|
2269
|
-
"name": "*",
|
|
2270
|
-
"declaration": {
|
|
2271
|
-
"name": "*",
|
|
2272
|
-
"package": "./config"
|
|
2273
|
-
}
|
|
2274
|
-
},
|
|
2275
|
-
{
|
|
2276
|
-
"kind": "js",
|
|
2277
|
-
"name": "*",
|
|
2278
|
-
"declaration": {
|
|
2279
|
-
"name": "*",
|
|
2280
|
-
"package": "./fallback-agents"
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
]
|
|
2284
|
-
},
|
|
2285
|
-
{
|
|
2286
|
-
"kind": "javascript-module",
|
|
2287
|
-
"path": "src/config/validate-providers.ts",
|
|
2288
|
-
"declarations": [],
|
|
2289
|
-
"exports": []
|
|
2290
|
-
},
|
|
2291
2299
|
{
|
|
2292
2300
|
"kind": "javascript-module",
|
|
2293
2301
|
"path": "src/main/attachment-controller.ts",
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { GenesisElement } from '@genesislcap/web-core';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `el` still has an animation that will fire `animationend`.
|
|
4
|
+
*
|
|
5
|
+
* `dialog` is an exposed part, so an app's rules reach it and can leave the close waiting on an
|
|
6
|
+
* event that never arrives. Two shapes of that, both plausible customisations:
|
|
7
|
+
*
|
|
8
|
+
* - `::part(dialog) { animation: none }` to drop the bounce — no animation at all.
|
|
9
|
+
* - `::part(dialog) { animation: my-in 0.3s both }` to swap in its own entrance — that beats
|
|
10
|
+
* `.closing` in the cascade, so the exit never runs, and the entrance stays in `getAnimations()`
|
|
11
|
+
* as a finished animation held in effect by its fill mode.
|
|
12
|
+
*
|
|
13
|
+
* So presence in `getAnimations()` is not the question — whether anything is still going is.
|
|
14
|
+
* Tested for `running` rather than against `finished` so a paused animation, which will not fire
|
|
15
|
+
* either, is also treated as nothing to wait for.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasRunningAnimation(el: Element): boolean;
|
|
2
20
|
/**
|
|
3
21
|
* Floating chat bubble component that provides a draggable orb and dialog panel
|
|
4
22
|
* for embedding an AI assistant without a full-page layout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bubble.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-bubble/chat-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAoB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-bubble.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-bubble/chat-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAoB,MAAM,uBAAuB,CAAC;AAK9F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAExD;AAkCD;;;;;;;;;GASG;AACH,qBAOa,YAAa,SAAQ,cAAc;IAChB,KAAK,EAAE,MAAM,CAAkB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IACP,kBAAkB,EAAE,MAAM,CAAW;IAElF,gBAAgB;IACJ,aAAa,EAAE,WAAW,EAAE,CAAM;IAC9C,gBAAgB;IACJ,oBAAoB,EAAE,MAAM,CAAK;IAC7C,iFAAiF;IACrE,UAAU,EAAE,MAAM,CAAK;IACnC,+EAA+E;IACnE,SAAS,EAAE,MAAM,CAAK;IAClC,mFAAmF;IACvE,UAAU,EAAE,MAAM,CAAK;IACnC,iFAAiF;IACrE,SAAS,EAAE,MAAM,CAAK;IAClC,iEAAiE;IACrD,WAAW,EAAE,MAAM,CAAwB;IACvD,kEAAkE;IACtD,YAAY,EAAE,MAAM,CAAyB;IACzD,4DAA4D;IAChD,UAAU,EAAE,OAAO,CAAS;IACxC,6DAA6D;IACjD,OAAO,EAAE,OAAO,CAAS;IAErC,gBAAgB;IAChB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,gBAAgB;IAChB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,WAAW,CAAC;IAEvB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,gBAAgB,CAAC,CAAU;IACnC,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAkB;IAErC,iBAAiB;IAoCjB,kBAAkB;IAWlB,kBAAkB;IAIlB,oBAAoB;IAmBpB,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;IAoC3C,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAc1D,OAAO,CAAC,iBAAiB;IAczB,iBAAiB,CAAC,CAAC,EAAE,UAAU;IAa/B,uBAAuB,CAAC,CAAC,EAAE,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAkB5E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAO9D,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,gBAAgB;IAkCxB,OAAO,CAAC,cAAc,CAOpB;IASF,OAAO,CAAC,cAAc,CAuBpB;IAMF,OAAO,CAAC,YAAY,CA0ClB;IAEF,QAAQ;IAIR,aAAa;IAiBb,IAAI,YAAY,IAAI,MAAM,CAazB;CACF"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export type { ResolvedDebugLogNoteConfig } from './utils/resolve-debug-log-note'
|
|
|
27
27
|
export type { ModelTagAppearance } from '@genesislcap/foundation-ai';
|
|
28
28
|
export type { AiChatInteraction, AiChatWidget } from './types/ai-chat-widget';
|
|
29
29
|
export type { InteractionContext } from './types/interaction-context';
|
|
30
|
-
export { AiChatMarkdown } from './components/chat-markdown/chat-markdown';
|
|
30
|
+
export { AiChatMarkdown, MARKDOWN_EXPORTPARTS } from './components/chat-markdown/chat-markdown';
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,YAAY,EACV,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,gEAAgE,CAAC;AACxE,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,YAAY,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACjF,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,YAAY,EACV,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,gEAAgE,CAAC;AACxE,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,YAAY,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACjF,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -17,6 +17,21 @@
|
|
|
17
17
|
import type { ChatMessage } from '@genesislcap/foundation-ai';
|
|
18
18
|
import { ViewTemplate } from '@genesislcap/web-core';
|
|
19
19
|
import type { FoundationAiAssistant } from './main';
|
|
20
|
+
/**
|
|
21
|
+
* Part names for one avatar element: the bare name, a role-level name, and — on the assistant
|
|
22
|
+
* side, whose rows vary — the message type.
|
|
23
|
+
*
|
|
24
|
+
* The role-level name is the one an app usually wants. `messageType` splits the assistant across
|
|
25
|
+
* `ai`, `ai-thinking`, `ai-function` and `interaction`, so without it "style the assistant's
|
|
26
|
+
* avatar, not the user's" takes four selectors and silently misses any type added later.
|
|
27
|
+
* `::part()` names cannot be chained, so each has to be a name of its own rather than a
|
|
28
|
+
* combination. The user side needs no extra name — its role and its type are both `user`.
|
|
29
|
+
*
|
|
30
|
+
* Exported for the unit test that pins the vocabulary; not part of the element API.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare const avatarPartsFor: (base: string, type: string) => string;
|
|
20
35
|
/**
|
|
21
36
|
* The timestamp shown beside the sender name (GENC-1257).
|
|
22
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAuC,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAU1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAuC,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAU1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAkDpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAC4B,CAAC;AAsGzF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,kDAWpC,CAAC;AAoJF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,qBAAqB,KAAG,MAYlD,CAAC;AAEf;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,qBAAqB,KAAG,MAAM,GAAG,IACpB,CAAC;AAyJrD,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CAisBpC,CAAC"}
|
|
@@ -3,6 +3,26 @@ import { attr, customElement, GenesisElement, html, observable } from '@genesisl
|
|
|
3
3
|
import { agenticActivityBus } from '../../channel/ai-activity-bus';
|
|
4
4
|
import { styles } from './chat-bubble.styles';
|
|
5
5
|
import { AiChatBubbleTemplate } from './chat-bubble.template';
|
|
6
|
+
/**
|
|
7
|
+
* Whether `el` still has an animation that will fire `animationend`.
|
|
8
|
+
*
|
|
9
|
+
* `dialog` is an exposed part, so an app's rules reach it and can leave the close waiting on an
|
|
10
|
+
* event that never arrives. Two shapes of that, both plausible customisations:
|
|
11
|
+
*
|
|
12
|
+
* - `::part(dialog) { animation: none }` to drop the bounce — no animation at all.
|
|
13
|
+
* - `::part(dialog) { animation: my-in 0.3s both }` to swap in its own entrance — that beats
|
|
14
|
+
* `.closing` in the cascade, so the exit never runs, and the entrance stays in `getAnimations()`
|
|
15
|
+
* as a finished animation held in effect by its fill mode.
|
|
16
|
+
*
|
|
17
|
+
* So presence in `getAnimations()` is not the question — whether anything is still going is.
|
|
18
|
+
* Tested for `running` rather than against `finished` so a paused animation, which will not fire
|
|
19
|
+
* either, is also treated as nothing to wait for.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export function hasRunningAnimation(el) {
|
|
24
|
+
return el.getAnimations().some((a) => a.playState === 'running');
|
|
25
|
+
}
|
|
6
26
|
/** Default dimensions of the dialog panel */
|
|
7
27
|
const DIALOG_DEFAULT_WIDTH = 400;
|
|
8
28
|
const DIALOG_DEFAULT_HEIGHT = 520;
|
|
@@ -329,11 +349,10 @@ let AiChatBubble = class AiChatBubble extends GenesisElement {
|
|
|
329
349
|
}
|
|
330
350
|
this.closeAbort = new AbortController();
|
|
331
351
|
this.dialogEl.classList.add('closing');
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
|
|
336
|
-
if (this.dialogEl.getAnimations().length === 0) {
|
|
352
|
+
// Nothing running means nothing will fire `animationend`, so close now rather than wait for
|
|
353
|
+
// an event that is not coming. getAnimations() flushes style, so the class added above is
|
|
354
|
+
// already accounted for.
|
|
355
|
+
if (!hasRunningAnimation(this.dialogEl)) {
|
|
337
356
|
this.dialogOpen = false;
|
|
338
357
|
return;
|
|
339
358
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -18,4 +18,6 @@ export * from './provider/tiered-provider-switcher';
|
|
|
18
18
|
export * from './provider/assistant-app-settings';
|
|
19
19
|
export * from './utils/tool-fold';
|
|
20
20
|
export { assistantSettingsSectionTitleStyles } from './styles/settings-section';
|
|
21
|
-
|
|
21
|
+
// MARKDOWN_EXPORTPARTS travels with the component: a host rendering `<ai-chat-markdown>` in its
|
|
22
|
+
// own shadow root has to forward its parts, and hand-copying the list is how it drifts.
|
|
23
|
+
export { AiChatMarkdown, MARKDOWN_EXPORTPARTS } from './components/chat-markdown/chat-markdown';
|
|
@@ -67,6 +67,21 @@ const messageType = (m) => {
|
|
|
67
67
|
return 'ai';
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Part names for one avatar element: the bare name, a role-level name, and — on the assistant
|
|
72
|
+
* side, whose rows vary — the message type.
|
|
73
|
+
*
|
|
74
|
+
* The role-level name is the one an app usually wants. `messageType` splits the assistant across
|
|
75
|
+
* `ai`, `ai-thinking`, `ai-function` and `interaction`, so without it "style the assistant's
|
|
76
|
+
* avatar, not the user's" takes four selectors and silently misses any type added later.
|
|
77
|
+
* `::part()` names cannot be chained, so each has to be a name of its own rather than a
|
|
78
|
+
* combination. The user side needs no extra name — its role and its type are both `user`.
|
|
79
|
+
*
|
|
80
|
+
* Exported for the unit test that pins the vocabulary; not part of the element API.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export const avatarPartsFor = (base, type) => type === 'user' ? `${base} ${base}-user` : `${base} ${base}-assistant ${base}-${type}`;
|
|
70
85
|
// Avatar markup is owned by the component (`assistantIconSafe` / `userIconSafe`),
|
|
71
86
|
// which holds the sanitized SVG string for the default or any consumer override
|
|
72
87
|
// and is injected via `:innerHTML`. A raster `image-src` / `user-image-src`
|
|
@@ -89,13 +104,13 @@ const assistantAvatarMarkup = (parent, type) => parent.imageSrc
|
|
|
89
104
|
src="${() => parent.imageSrc}"
|
|
90
105
|
alt="Assistant"
|
|
91
106
|
class="avatar-img"
|
|
92
|
-
part="${() =>
|
|
107
|
+
part="${() => avatarPartsFor('avatar-img', type)}"
|
|
93
108
|
/>
|
|
94
109
|
`
|
|
95
110
|
: html `
|
|
96
111
|
<span
|
|
97
112
|
class="avatar-icon"
|
|
98
|
-
part="${() =>
|
|
113
|
+
part="${() => avatarPartsFor('avatar-icon', type)}"
|
|
99
114
|
:innerHTML="${() => parent.assistantIconSafe}"
|
|
100
115
|
></span>
|
|
101
116
|
`;
|
|
@@ -111,13 +126,13 @@ const userAvatarTemplate = html `
|
|
|
111
126
|
src="${() => parent.userImageSrc}"
|
|
112
127
|
alt="You"
|
|
113
128
|
class="avatar-img"
|
|
114
|
-
part="avatar-img
|
|
129
|
+
part="${() => avatarPartsFor('avatar-img', 'user')}"
|
|
115
130
|
/>
|
|
116
131
|
`
|
|
117
132
|
: html `
|
|
118
133
|
<span
|
|
119
134
|
class="avatar-icon"
|
|
120
|
-
part="avatar-icon
|
|
135
|
+
part="${() => avatarPartsFor('avatar-icon', 'user')}"
|
|
121
136
|
:innerHTML="${() => parent.userIconSafe}"
|
|
122
137
|
></span>
|
|
123
138
|
`;
|
|
@@ -544,7 +559,7 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
544
559
|
>
|
|
545
560
|
<div
|
|
546
561
|
class="avatar ${(m) => messageType(m)}"
|
|
547
|
-
part="${(m) =>
|
|
562
|
+
part="${(m) => avatarPartsFor('avatar', messageType(m))}"
|
|
548
563
|
>
|
|
549
564
|
${when(
|
|
550
565
|
// Keyed on messageType (not raw role) so a synthetic-user message,
|
|
@@ -946,7 +961,7 @@ ${(tc) => { var _a; return (((_a = tc.foldPath) === null || _a === void 0 ? void
|
|
|
946
961
|
LOADING_STYLE_ANIMATIONS.some((s) => x.enabledAnimations.includes(s)));
|
|
947
962
|
}, html `
|
|
948
963
|
<div class="message-row ai" part="thinking">
|
|
949
|
-
<div class="avatar ai" part="avatar
|
|
964
|
+
<div class="avatar ai" part="${avatarPartsFor('avatar', 'ai')}">
|
|
950
965
|
${(x) => assistantAvatarMarkup(x, 'ai')}
|
|
951
966
|
</div>
|
|
952
967
|
${(x) => selectThinkingTemplate(x)}
|
package/docs/styling.md
CHANGED
|
@@ -61,17 +61,43 @@ Parts on the conversation area (the outer frame exposes many more — e.g.
|
|
|
61
61
|
| `message-interaction-<presentation>` | An interaction bubble in one presentation: `message-interaction-label`, `message-interaction-bare`, `message-interaction-bubble` |
|
|
62
62
|
| `thinking` | The loading-indicator row |
|
|
63
63
|
| `avatar` | The avatar box beside a message (and beside the loading indicator) |
|
|
64
|
-
| `avatar
|
|
65
|
-
| `avatar
|
|
66
|
-
| `avatar-
|
|
64
|
+
| `avatar-user` / `avatar-assistant` | That box, by **role** — `avatar-assistant` covers every assistant row whatever its type |
|
|
65
|
+
| `avatar-<type>` | That box for one kind of row: `avatar-user`, `avatar-ai`, `avatar-ai-thinking`, `avatar-ai-function`, `avatar-interaction` |
|
|
66
|
+
| `avatar-img` | The avatar image, when `image-src` / `user-image-src` is set |
|
|
67
|
+
| `avatar-img-user` / `avatar-img-assistant` | That image, by role |
|
|
68
|
+
| `avatar-img-<type>` | That image, by row type |
|
|
69
|
+
| `avatar-icon` | The inline SVG mark, when no image is set |
|
|
70
|
+
| `avatar-icon-user` / `avatar-icon-assistant` | That mark, by role |
|
|
71
|
+
| `avatar-icon-<type>` | That mark, by row type |
|
|
67
72
|
| `sender` | The name + timestamp row at the top of a bubble |
|
|
68
73
|
| `sender-label` | Just the name |
|
|
69
74
|
| `content` | The bubble's body (markdown, tool calls, interaction widgets) |
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
Each avatar element carries all three names at once, because `::part()` names
|
|
77
|
+
cannot be chained — `::part(avatar-assistant) ::part(avatar-img)` does not exist,
|
|
78
|
+
so every combination you might want to select has to be a name of its own.
|
|
79
|
+
|
|
80
|
+
**Reach for the role name first.** The assistant is split across four row types,
|
|
81
|
+
so `avatar-icon-ai` is only the *plain reply* — thinking, tool-call and
|
|
82
|
+
interaction rows are `avatar-icon-ai-thinking`, `avatar-icon-ai-function` and
|
|
83
|
+
`avatar-icon-interaction`. `avatar-icon-assistant` is all of them, and keeps
|
|
84
|
+
working if a row type is added later:
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
/* Every assistant mark, never the user's */
|
|
88
|
+
foundation-ai-assistant::part(avatar-icon-assistant) {
|
|
89
|
+
color: var(--accent-fill-rest);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Just the thinking rows */
|
|
93
|
+
foundation-ai-assistant::part(avatar-icon-ai-thinking) {
|
|
94
|
+
opacity: 0.6;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The loading-indicator row uses the same avatar as a plain reply, so it answers to
|
|
99
|
+
`avatar`, `avatar-assistant` and `avatar-ai` like any other assistant row — hiding
|
|
100
|
+
avatars no longer leaves that one behind.
|
|
75
101
|
|
|
76
102
|
Target them from an app stylesheet with `::part()`:
|
|
77
103
|
|
|
@@ -260,6 +286,13 @@ foundation-ai-assistant::part(md-ul-level-2) {
|
|
|
260
286
|
}
|
|
261
287
|
```
|
|
262
288
|
|
|
289
|
+
If you render `<ai-chat-markdown>` yourself, inside your own shadow root, you
|
|
290
|
+
have the same forwarding problem — import the list rather than retyping it:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { MARKDOWN_EXPORTPARTS } from '@genesislcap/ai-assistant';
|
|
294
|
+
```
|
|
295
|
+
|
|
263
296
|
Two caveats. **List levels stop at 3**: `exportparts` has no wildcard, so the
|
|
264
297
|
forwarded vocabulary has to be finite — a list nested four deep is tagged
|
|
265
298
|
`md-ul-level-3`, i.e. the deepest level means "this deep or deeper". And the part
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ai-assistant",
|
|
3
3
|
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
-
"version": "15.35.4-FUI-0.
|
|
4
|
+
"version": "15.35.4-FUI-0.10",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/ai-assistant.d.ts",
|
|
@@ -82,32 +82,32 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@genesislcap/foundation-comms": "15.35.4-FUI-0.
|
|
86
|
-
"@genesislcap/foundation-testing": "15.35.4-FUI-0.
|
|
87
|
-
"@genesislcap/genx": "15.35.4-FUI-0.
|
|
88
|
-
"@genesislcap/rollup-builder": "15.35.4-FUI-0.
|
|
89
|
-
"@genesislcap/ts-builder": "15.35.4-FUI-0.
|
|
90
|
-
"@genesislcap/uvu-playwright-builder": "15.35.4-FUI-0.
|
|
91
|
-
"@genesislcap/vite-builder": "15.35.4-FUI-0.
|
|
92
|
-
"@genesislcap/webpack-builder": "15.35.4-FUI-0.
|
|
85
|
+
"@genesislcap/foundation-comms": "15.35.4-FUI-0.10",
|
|
86
|
+
"@genesislcap/foundation-testing": "15.35.4-FUI-0.10",
|
|
87
|
+
"@genesislcap/genx": "15.35.4-FUI-0.10",
|
|
88
|
+
"@genesislcap/rollup-builder": "15.35.4-FUI-0.10",
|
|
89
|
+
"@genesislcap/ts-builder": "15.35.4-FUI-0.10",
|
|
90
|
+
"@genesislcap/uvu-playwright-builder": "15.35.4-FUI-0.10",
|
|
91
|
+
"@genesislcap/vite-builder": "15.35.4-FUI-0.10",
|
|
92
|
+
"@genesislcap/webpack-builder": "15.35.4-FUI-0.10",
|
|
93
93
|
"@types/dompurify": "^3.0.5",
|
|
94
94
|
"@types/marked": "^5.0.2",
|
|
95
95
|
"esbuild": "0.25.12"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@genesislcap/foundation-ai": "15.35.4-FUI-0.
|
|
99
|
-
"@genesislcap/foundation-logger": "15.35.4-FUI-0.
|
|
100
|
-
"@genesislcap/foundation-notifications": "15.35.4-FUI-0.
|
|
101
|
-
"@genesislcap/foundation-redux": "15.35.4-FUI-0.
|
|
102
|
-
"@genesislcap/foundation-ui": "15.35.4-FUI-0.
|
|
103
|
-
"@genesislcap/foundation-utils": "15.35.4-FUI-0.
|
|
104
|
-
"@genesislcap/rapid-design-system": "15.35.4-FUI-0.
|
|
105
|
-
"@genesislcap/web-core": "15.35.4-FUI-0.
|
|
98
|
+
"@genesislcap/foundation-ai": "15.35.4-FUI-0.10",
|
|
99
|
+
"@genesislcap/foundation-logger": "15.35.4-FUI-0.10",
|
|
100
|
+
"@genesislcap/foundation-notifications": "15.35.4-FUI-0.10",
|
|
101
|
+
"@genesislcap/foundation-redux": "15.35.4-FUI-0.10",
|
|
102
|
+
"@genesislcap/foundation-ui": "15.35.4-FUI-0.10",
|
|
103
|
+
"@genesislcap/foundation-utils": "15.35.4-FUI-0.10",
|
|
104
|
+
"@genesislcap/rapid-design-system": "15.35.4-FUI-0.10",
|
|
105
|
+
"@genesislcap/web-core": "15.35.4-FUI-0.10",
|
|
106
106
|
"dompurify": "^3.3.1",
|
|
107
107
|
"marked": "^17.0.3"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
|
-
"@genesislcap/foundation-comms": "^15.35.4-FUI-0.
|
|
110
|
+
"@genesislcap/foundation-comms": "^15.35.4-FUI-0.10"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|
|
113
113
|
"@genesislcap/foundation-comms": {
|