@solidxai/core-ui 0.1.21-beta.2 → 0.1.21

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.
Files changed (40) hide show
  1. package/dist/components/core/extension/solid-core/agentSession/AgentSessionChatFormWidget.d.ts.map +1 -1
  2. package/dist/components/core/extension/solid-core/agentSession/AgentSessionChatFormWidget.js +2 -1
  3. package/dist/components/core/extension/solid-core/agentSession/AgentSessionChatFormWidget.js.map +1 -1
  4. package/dist/components/core/extension/solid-core/agentSession/AgentSessionChatFormWidget.tsx +5 -1
  5. package/dist/components/core/solid-agent/AgentContextPill.js.map +1 -1
  6. package/dist/components/core/solid-agent/AgentContextPill.tsx +1 -1
  7. package/dist/components/core/solid-agent/SolidAgentChat.d.ts +2 -1
  8. package/dist/components/core/solid-agent/SolidAgentChat.d.ts.map +1 -1
  9. package/dist/components/core/solid-agent/SolidAgentChat.js +56 -45
  10. package/dist/components/core/solid-agent/SolidAgentChat.js.map +1 -1
  11. package/dist/components/core/solid-agent/SolidAgentChat.tsx +40 -12
  12. package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts +1 -0
  13. package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts.map +1 -1
  14. package/dist/components/core/solid-agent/SolidAgentEmbedded.js +4 -4
  15. package/dist/components/core/solid-agent/SolidAgentEmbedded.js.map +1 -1
  16. package/dist/components/core/solid-agent/SolidAgentEmbedded.tsx +2 -0
  17. package/dist/components/core/solid-agent/agentMarkdown.d.ts +20 -0
  18. package/dist/components/core/solid-agent/agentMarkdown.d.ts.map +1 -0
  19. package/dist/components/core/solid-agent/agentMarkdown.js +140 -0
  20. package/dist/components/core/solid-agent/agentMarkdown.js.map +1 -0
  21. package/dist/components/core/solid-agent/agentMarkdown.ts +140 -0
  22. package/dist/components/core/solid-agent/client/agentRuntime.d.ts +1 -1
  23. package/dist/components/core/solid-agent/client/agentRuntime.d.ts.map +1 -1
  24. package/dist/components/core/solid-agent/client/agentRuntime.js +6 -5
  25. package/dist/components/core/solid-agent/client/agentRuntime.js.map +1 -1
  26. package/dist/components/core/solid-agent/client/agentRuntime.ts +6 -4
  27. package/dist/components/core/solid-agent/thread/AgentThread.d.ts.map +1 -1
  28. package/dist/components/core/solid-agent/thread/AgentThread.js +1 -1
  29. package/dist/components/core/solid-agent/thread/AgentThread.js.map +1 -1
  30. package/dist/components/core/solid-agent/thread/AgentThread.tsx +3 -2
  31. package/dist/components/core/solid-agent/useAgentChat.d.ts +1 -1
  32. package/dist/components/core/solid-agent/useAgentChat.d.ts.map +1 -1
  33. package/dist/components/core/solid-agent/useAgentChat.js +4 -3
  34. package/dist/components/core/solid-agent/useAgentChat.js.map +1 -1
  35. package/dist/components/core/solid-agent/useAgentChat.ts +4 -3
  36. package/dist/routes/pages/embed/AgentEmbedPage.d.ts.map +1 -1
  37. package/dist/routes/pages/embed/AgentEmbedPage.js +1 -1
  38. package/dist/routes/pages/embed/AgentEmbedPage.js.map +1 -1
  39. package/dist/routes/pages/embed/AgentEmbedPage.tsx +3 -1
  40. package/package.json +1 -1
@@ -65,6 +65,7 @@ type Props = {
65
65
  inputs?: Record<string, unknown>;
66
66
  requiredInputs?: AgentInputDefinition[];
67
67
  externalEmbed?: boolean;
68
+ sessionOwnerKey?: string;
68
69
  onInputsLocked?: (locked: boolean) => void;
69
70
  beforeSend?: (request: BeforeUserMessageSendRequest, signal: AbortSignal) => Promise<EmbedMessageContext | AgentInputContext | undefined>;
70
71
  /** Rendered inside a page (tab/form widget) instead of the floating window: no window controls. */
@@ -154,6 +155,7 @@ export function SolidAgentChat({
154
155
  inputs,
155
156
  requiredInputs = [],
156
157
  externalEmbed = false,
158
+ sessionOwnerKey,
157
159
  onInputsLocked,
158
160
  beforeSend,
159
161
  embedded = false,
@@ -162,7 +164,7 @@ export function SolidAgentChat({
162
164
  suggestions,
163
165
  windowControls,
164
166
  }: Props) {
165
- const { agent, dispatch, runtime } = useAgentChat(agentRuntime, agentUrl, externalEmbed);
167
+ const { agent, dispatch, runtime } = useAgentChat(agentRuntime, agentUrl, externalEmbed, sessionOwnerKey);
166
168
  // Agent login (API key → agentToken in sessionStorage); the chat is usable once signed in.
167
169
  const agentAuth = useAgentAuth(agentUrl, agentRuntime === "agentHub");
168
170
  const signedIn = agentAuth.status === "signedIn";
@@ -171,6 +173,7 @@ export function SolidAgentChat({
171
173
 
172
174
  const [showHistory, setShowHistory] = useState(false);
173
175
  const [sessions, setSessions] = useState<AgentSessionSummary[]>([]);
176
+ const [sessionToDelete, setSessionToDelete] = useState<AgentSessionSummary | null>(null);
174
177
  const startingNewChatRef = useRef(false);
175
178
  const [historySearchQuery, setHistorySearchQuery] = useState("");
176
179
  const [editingSessionId, setEditingSessionId] = useState<string | null>(null);
@@ -830,6 +833,33 @@ export function SolidAgentChat({
830
833
  </form>
831
834
  </SolidDialogBody>
832
835
  </SolidDialog>}
836
+ <SolidDialog
837
+ open={!!sessionToDelete}
838
+ onOpenChange={(open) => { if (!open) setSessionToDelete(null); }}
839
+ className={styles.inputDialog}
840
+ overlayClassName={styles.inputDialogOverlay}
841
+ header="Delete conversation?"
842
+ ariaLabel="Confirm conversation deletion"
843
+ style={{ width: "min(28rem, 94vw)" }}
844
+ >
845
+ <SolidDialogBody>
846
+ <p>This conversation will be permanently deleted.</p>
847
+ <div className={styles.inputActions}>
848
+ <SolidButton variant="secondary" onClick={() => setSessionToDelete(null)}>Cancel</SolidButton>
849
+ <SolidButton
850
+ variant="destructive"
851
+ onClick={async () => {
852
+ const session = sessionToDelete;
853
+ if (!session) return;
854
+ await deleteSession(agentUrl, session.session_id);
855
+ setSessions((prev) => prev.filter((item) => item.session_id !== session.session_id));
856
+ if (session.session_id === agent.historySessionId) runtime?.newChat();
857
+ setSessionToDelete(null);
858
+ }}
859
+ >Delete</SolidButton>
860
+ </div>
861
+ </SolidDialogBody>
862
+ </SolidDialog>
833
863
  <div className={`${styles.header} ${externalEmbed ? styles.externalEmbedHeader : ""}`}>
834
864
  <div className={styles.headerMark}>
835
865
  <Sparkles size={15} />
@@ -1072,12 +1102,8 @@ export function SolidAgentChat({
1072
1102
  {filteredSessions.map((session) => (
1073
1103
  <div key={session.session_id} className={styles.historyRow}>
1074
1104
  {editingSessionId === session.session_id ? (
1075
- <form
1105
+ <div
1076
1106
  className={styles.historyRenameForm}
1077
- onSubmit={(e) => {
1078
- e.preventDefault();
1079
- void handleSaveRename(session.session_id, editingTitle);
1080
- }}
1081
1107
  >
1082
1108
  <input
1083
1109
  type="text"
@@ -1087,6 +1113,10 @@ export function SolidAgentChat({
1087
1113
  autoFocus
1088
1114
  onFocus={(e) => e.target.select()}
1089
1115
  onKeyDown={(e) => {
1116
+ if (e.key === "Enter") {
1117
+ e.preventDefault();
1118
+ void handleSaveRename(session.session_id, editingTitle);
1119
+ }
1090
1120
  if (e.key === "Escape") {
1091
1121
  e.stopPropagation();
1092
1122
  setEditingSessionId(null);
@@ -1095,10 +1125,11 @@ export function SolidAgentChat({
1095
1125
  aria-label="Rename conversation"
1096
1126
  />
1097
1127
  <button
1098
- type="submit"
1128
+ type="button"
1099
1129
  className={styles.iconBtn}
1100
1130
  aria-label="Save title"
1101
1131
  title="Save"
1132
+ onClick={() => void handleSaveRename(session.session_id, editingTitle)}
1102
1133
  >
1103
1134
  <Check size={14} />
1104
1135
  </button>
@@ -1111,7 +1142,7 @@ export function SolidAgentChat({
1111
1142
  >
1112
1143
  <X size={14} />
1113
1144
  </button>
1114
- </form>
1145
+ </div>
1115
1146
  ) : (
1116
1147
  <>
1117
1148
  <button
@@ -1154,10 +1185,7 @@ export function SolidAgentChat({
1154
1185
  title="Delete"
1155
1186
  onClick={async (e) => {
1156
1187
  e.stopPropagation();
1157
- if (!window.confirm("Delete this conversation?")) return;
1158
- await deleteSession(agentUrl, session.session_id);
1159
- setSessions((prev) => prev.filter((s) => s.session_id !== session.session_id));
1160
- if (session.session_id === agent.historySessionId) runtime?.newChat();
1188
+ setSessionToDelete(session);
1161
1189
  }}
1162
1190
  >
1163
1191
  <Trash2 size={14} />
@@ -12,6 +12,7 @@ type SharedProps = {
12
12
  /** External bootstrap: the standalone route registers credentials for this private URL. */
13
13
  externalEmbed?: {
14
14
  agentUrl: string;
15
+ sessionOwnerKey?: string;
15
16
  onInputsLocked?: (locked: boolean) => void;
16
17
  beforeSend?: (request: BeforeUserMessageSendRequest, signal: AbortSignal) => Promise<EmbedMessageContext>;
17
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SolidAgentEmbedded.d.ts","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/SolidAgentEmbedded.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,KAAK,WAAW,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACxC,2FAA2F;IAC3F,aAAa,CAAC,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QAC3C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KAC7G,CAAC;IACF,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,cAAc,CAAC,EAAE;QACb,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;QAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,IAAI,CAAC;KACvB,CAAC;CACL,CAAC;AAEF,KAAK,KAAK,GAAG,WAAW,GAAG,CACrB;IACE,4EAA4E;IAC5E,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GACC;IACE,oFAAoF;IACpF,YAAY,EAAE,UAAU,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACnB,CACJ,CAAC;AAIF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,kDAsD9C"}
1
+ {"version":3,"file":"SolidAgentEmbedded.d.ts","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/SolidAgentEmbedded.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,KAAK,WAAW,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACxC,2FAA2F;IAC3F,aAAa,CAAC,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QAC3C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KAC7G,CAAC;IACF,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,cAAc,CAAC,EAAE;QACb,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;QAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,IAAI,CAAC;KACvB,CAAC;CACL,CAAC;AAEF,KAAK,KAAK,GAAG,WAAW,GAAG,CACrB;IACE,4EAA4E;IAC5E,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GACC;IACE,oFAAoF;IACpF,YAAY,EAAE,UAAU,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACnB,CACJ,CAAC;AAIF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,kDAuD9C"}
@@ -22,10 +22,10 @@ var AGENT_LABEL = { solidx: "SolidX Agent", agentHub: "AgentHub Agent" };
22
22
  * With agentRuntime "solidx" it shares the same connection and thread as the launcher.
23
23
  */
24
24
  export function SolidAgentEmbedded(props) {
25
- var _a, _b, _c, _d, _e, _f;
26
- var _g = props.agentRuntime, agentRuntime = _g === void 0 ? "solidx" : _g, agentId = props.agentId, suppliedInputContext = props.inputContext, _h = props.height, height = _h === void 0 ? 560 : _h, suggestions = props.suggestions, className = props.className, windowControls = props.windowControls;
25
+ var _a, _b, _c, _d, _e, _f, _g;
26
+ var _h = props.agentRuntime, agentRuntime = _h === void 0 ? "solidx" : _h, agentId = props.agentId, suppliedInputContext = props.inputContext, _j = props.height, height = _j === void 0 ? 560 : _j, suggestions = props.suggestions, className = props.className, windowControls = props.windowControls;
27
27
  var title = (_a = props.title) !== null && _a !== void 0 ? _a : AGENT_LABEL[agentRuntime];
28
- var _j = useAgentAvailability(!props.externalEmbed), ready = _j.ready, enabled = _j.enabled, loadFailed = _j.loadFailed, agentUrls = _j.agentUrls, canUse = _j.canUse;
28
+ var _k = useAgentAvailability(!props.externalEmbed), ready = _k.ready, enabled = _k.enabled, loadFailed = _k.loadFailed, agentUrls = _k.agentUrls, canUse = _k.canUse;
29
29
  var inferredInputContext = useAdminInputContext();
30
30
  var inputContext = props.externalEmbed ? (suppliedInputContext !== null && suppliedInputContext !== void 0 ? suppliedInputContext : {}) : __assign(__assign({}, inferredInputContext), (suppliedInputContext !== null && suppliedInputContext !== void 0 ? suppliedInputContext : {}));
31
31
  if (!props.externalEmbed && !ready)
@@ -47,6 +47,6 @@ export function SolidAgentEmbedded(props) {
47
47
  if (unavailable) {
48
48
  return (_jsxs("div", { className: "".concat(styles.root, " ").concat(styles.unavailableRoot, " ").concat(className !== null && className !== void 0 ? className : ""), style: { height: height }, children: [windowControls && (_jsxs("div", { className: styles.unavailableHeader, children: [_jsx("strong", { children: title }), _jsx("button", { type: "button", className: styles.iconBtn, "aria-label": "Close test agent", title: "Close test agent", onClick: windowControls.onClose, children: _jsx(X, { size: 16 }) })] })), _jsx("div", { className: styles.unavailableBody, children: _jsxs("div", { className: styles.unavailableCard, role: "status", children: [_jsx("span", { className: styles.unavailableIcon, children: _jsx(MessageSquareText, { size: 21 }) }), _jsx("h3", { className: styles.unavailableTitle, children: unavailable.heading }), _jsx("p", { className: styles.unavailableDescription, children: unavailable.detail })] }) })] }));
49
49
  }
50
- return (_jsx("div", { className: "".concat(styles.root, " ").concat(className !== null && className !== void 0 ? className : ""), style: { height: height, display: "flex", flexDirection: "column", border: "1px solid var(--solid-agent-border)", borderRadius: 12, overflow: "hidden", background: "var(--solid-agent-bg)" }, children: _jsx(SolidAgentChat, { agentUrl: agentUrl, agentRuntime: agentRuntime, title: title, agentVersion: props.agentVersion, inputContext: inputContext, inputs: props.inputs, requiredInputs: props.requiredInputs, externalEmbed: !!props.externalEmbed, onInputsLocked: (_e = props.externalEmbed) === null || _e === void 0 ? void 0 : _e.onInputsLocked, beforeSend: (_f = props.externalEmbed) === null || _f === void 0 ? void 0 : _f.beforeSend, embedded: true, suggestions: suggestions, windowControls: windowControls }, agentUrl) }));
50
+ return (_jsx("div", { className: "".concat(styles.root, " ").concat(className !== null && className !== void 0 ? className : ""), style: { height: height, display: "flex", flexDirection: "column", border: "1px solid var(--solid-agent-border)", borderRadius: 12, overflow: "hidden", background: "var(--solid-agent-bg)" }, children: _jsx(SolidAgentChat, { agentUrl: agentUrl, agentRuntime: agentRuntime, title: title, agentVersion: props.agentVersion, inputContext: inputContext, inputs: props.inputs, requiredInputs: props.requiredInputs, externalEmbed: !!props.externalEmbed, onInputsLocked: (_e = props.externalEmbed) === null || _e === void 0 ? void 0 : _e.onInputsLocked, sessionOwnerKey: (_f = props.externalEmbed) === null || _f === void 0 ? void 0 : _f.sessionOwnerKey, beforeSend: (_g = props.externalEmbed) === null || _g === void 0 ? void 0 : _g.beforeSend, embedded: true, suggestions: suggestions, windowControls: windowControls }, agentUrl) }));
51
51
  }
52
52
  //# sourceMappingURL=SolidAgentEmbedded.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolidAgentEmbedded.js","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/SolidAgentEmbedded.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,MAAM,MAAM,yBAA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E,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,cAAc,EAAE,MAAA,KAAK,CAAC,aAAa,0CAAE,cAAc,EACrJ,UAAU,EAAE,MAAA,KAAK,CAAC,aAAa,0CAAE,UAAU,EAC3C,QAAQ,QAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,IAH5C,QAAQ,CAGwC,GACvE,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from \"react\";\nimport { MessageSquareText, X } from \"lucide-react\";\nimport styles from \"./SolidAgent.module.css\";\nimport { SolidAgentChat } from \"./SolidAgentChat\";\nimport { useAgentAvailability } from \"./useAgentAvailability\";\nimport type { AgentRuntimeType } from \"./types\";\nimport { withAgentId } from \"./client/agentUrls\";\nimport { useAdminInputContext, type AgentInputContext } from \"./useAdminInputContext\";\nimport type { AgentInputDefinition } from \"./embed/agentEmbedProtocol\";\nimport type { BeforeUserMessageSendRequest, EmbedMessageContext } from \"./embed/agentEmbedProtocol\";\n\ntype SharedProps = {\n title?: string;\n /** Additional key/value context sent with each message to the agent. */\n inputContext?: AgentInputContext;\n /** Values for the AgentHub agent's declared requiredInputs. */\n inputs?: Record<string, unknown>;\n /** AgentHub input schema; used by the admin test surface when no values were supplied. */\n requiredInputs?: AgentInputDefinition[];\n /** External bootstrap: the standalone route registers credentials for this private URL. */\n externalEmbed?: {\n agentUrl: string;\n onInputsLocked?: (locked: boolean) => void;\n beforeSend?: (request: BeforeUserMessageSendRequest, signal: AbortSignal) => Promise<EmbedMessageContext>;\n };\n /** Container height; the chat fills it. */\n height?: number | string;\n suggestions?: string[];\n className?: string;\n /** AgentHub configuration version to display in the header. */\n agentVersion?: number;\n /** Adds the standard chat window controls with actions managed by the embedding surface. */\n windowControls?: {\n mode: \"docked\" | \"maximized\";\n onDock: () => void;\n onMaximize: () => void;\n onRestore: () => void;\n onClose: () => void;\n };\n};\n\ntype Props = SharedProps & (\n | {\n /** SolidX runtime (setting solidxAgentBackendUrl); agent ID is optional. */\n agentRuntime?: \"solidx\";\n agentId?: number;\n }\n | {\n /** AgentHub runtime (setting solidxAgentHubBackendUrl); an agent ID is required. */\n agentRuntime: \"agentHub\";\n agentId: number;\n }\n);\n\nconst AGENT_LABEL: Record<AgentRuntimeType, string> = { solidx: \"SolidX Agent\", agentHub: \"AgentHub Agent\" };\n\n/**\n * The agent chat rendered inside a page (a tab or form widget) instead of the floating window.\n * With agentRuntime \"solidx\" it shares the same connection and thread as the launcher.\n */\nexport function SolidAgentEmbedded(props: Props) {\n const { agentRuntime = \"solidx\", agentId, inputContext: suppliedInputContext, height = 560, suggestions, className, windowControls } = props;\n const title = props.title ?? AGENT_LABEL[agentRuntime];\n const { ready, enabled, loadFailed, agentUrls, canUse } = useAgentAvailability(!props.externalEmbed);\n const inferredInputContext = useAdminInputContext();\n const inputContext = props.externalEmbed ? (suppliedInputContext ?? {}) : { ...inferredInputContext, ...(suppliedInputContext ?? {}) };\n if (!props.externalEmbed && !ready) return null;\n const backendUrl = agentUrls[agentRuntime] ?? null;\n // The chat URL names the agent, so each agent has its own login.\n const agentUrl = props.externalEmbed?.agentUrl ?? (backendUrl ? withAgentId(backendUrl, agentId) : null);\n const unavailable = !props.externalEmbed && loadFailed\n ? { heading: \"Could not check agent availability\", detail: \"The agent settings could not be loaded. Close this window and try again.\" }\n : !props.externalEmbed && !enabled\n ? { heading: \"Agent chat is disabled\", detail: \"Enable SolidX Agent Enabled in Settings to test this agent.\" }\n : !props.externalEmbed && !canUse\n ? { heading: \"Permission required\", detail: \"Your account needs the agent:invoke permission to test this agent.\" }\n : agentRuntime === \"agentHub\" && agentId === undefined\n ? { heading: \"No agent selected\", detail: \"Select an agent to start a test conversation.\" }\n : !agentUrl\n ? { heading: \"Backend URL is missing\", detail: `Configure the ${agentRuntime === \"agentHub\" ? \"SolidX Agent Hub\" : \"SolidX Agent\"} Backend URL in Settings to use this agent.` }\n : null;\n if (unavailable) {\n return (\n <div className={`${styles.root} ${styles.unavailableRoot} ${className ?? \"\"}`} style={{ height }}>\n {windowControls && (\n <div className={styles.unavailableHeader}>\n <strong>{title}</strong>\n <button type=\"button\" className={styles.iconBtn} aria-label=\"Close test agent\" title=\"Close test agent\" onClick={windowControls.onClose}>\n <X size={16} />\n </button>\n </div>\n )}\n <div className={styles.unavailableBody}>\n <div className={styles.unavailableCard} role=\"status\">\n <span className={styles.unavailableIcon}><MessageSquareText size={21} /></span>\n <h3 className={styles.unavailableTitle}>{unavailable.heading}</h3>\n <p className={styles.unavailableDescription}>{unavailable.detail}</p>\n </div>\n </div>\n </div>\n );\n }\n return (\n <div\n className={`${styles.root} ${className ?? \"\"}`}\n style={{ height, display: \"flex\", flexDirection: \"column\", border: \"1px solid var(--solid-agent-border)\", borderRadius: 12, overflow: \"hidden\", background: \"var(--solid-agent-bg)\" }}\n >\n {/* key: switching type remounts the chat onto the other backend's conversation. */}\n <SolidAgentChat key={agentUrl} agentUrl={agentUrl!!} agentRuntime={agentRuntime} title={title} agentVersion={props.agentVersion} inputContext={inputContext}\n inputs={props.inputs} requiredInputs={props.requiredInputs} externalEmbed={!!props.externalEmbed} onInputsLocked={props.externalEmbed?.onInputsLocked}\n beforeSend={props.externalEmbed?.beforeSend}\n embedded suggestions={suggestions} windowControls={windowControls} />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"SolidAgentEmbedded.js","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/SolidAgentEmbedded.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EA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rD,UAAU,EAAE,MAAA,KAAK,CAAC,aAAa,0CAAE,UAAU,EAC3C,QAAQ,QAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,IAJ5C,QAAQ,CAIwC,GACvE,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from \"react\";\nimport { MessageSquareText, X } from \"lucide-react\";\nimport styles from \"./SolidAgent.module.css\";\nimport { SolidAgentChat } from \"./SolidAgentChat\";\nimport { useAgentAvailability } from \"./useAgentAvailability\";\nimport type { AgentRuntimeType } from \"./types\";\nimport { withAgentId } from \"./client/agentUrls\";\nimport { useAdminInputContext, type AgentInputContext } from \"./useAdminInputContext\";\nimport type { AgentInputDefinition } from \"./embed/agentEmbedProtocol\";\nimport type { BeforeUserMessageSendRequest, EmbedMessageContext } from \"./embed/agentEmbedProtocol\";\n\ntype SharedProps = {\n title?: string;\n /** Additional key/value context sent with each message to the agent. */\n inputContext?: AgentInputContext;\n /** Values for the AgentHub agent's declared requiredInputs. */\n inputs?: Record<string, unknown>;\n /** AgentHub input schema; used by the admin test surface when no values were supplied. */\n requiredInputs?: AgentInputDefinition[];\n /** External bootstrap: the standalone route registers credentials for this private URL. */\n externalEmbed?: {\n agentUrl: string;\n sessionOwnerKey?: string;\n onInputsLocked?: (locked: boolean) => void;\n beforeSend?: (request: BeforeUserMessageSendRequest, signal: AbortSignal) => Promise<EmbedMessageContext>;\n };\n /** Container height; the chat fills it. */\n height?: number | string;\n suggestions?: string[];\n className?: string;\n /** AgentHub configuration version to display in the header. */\n agentVersion?: number;\n /** Adds the standard chat window controls with actions managed by the embedding surface. */\n windowControls?: {\n mode: \"docked\" | \"maximized\";\n onDock: () => void;\n onMaximize: () => void;\n onRestore: () => void;\n onClose: () => void;\n };\n};\n\ntype Props = SharedProps & (\n | {\n /** SolidX runtime (setting solidxAgentBackendUrl); agent ID is optional. */\n agentRuntime?: \"solidx\";\n agentId?: number;\n }\n | {\n /** AgentHub runtime (setting solidxAgentHubBackendUrl); an agent ID is required. */\n agentRuntime: \"agentHub\";\n agentId: number;\n }\n);\n\nconst AGENT_LABEL: Record<AgentRuntimeType, string> = { solidx: \"SolidX Agent\", agentHub: \"AgentHub Agent\" };\n\n/**\n * The agent chat rendered inside a page (a tab or form widget) instead of the floating window.\n * With agentRuntime \"solidx\" it shares the same connection and thread as the launcher.\n */\nexport function SolidAgentEmbedded(props: Props) {\n const { agentRuntime = \"solidx\", agentId, inputContext: suppliedInputContext, height = 560, suggestions, className, windowControls } = props;\n const title = props.title ?? AGENT_LABEL[agentRuntime];\n const { ready, enabled, loadFailed, agentUrls, canUse } = useAgentAvailability(!props.externalEmbed);\n const inferredInputContext = useAdminInputContext();\n const inputContext = props.externalEmbed ? (suppliedInputContext ?? {}) : { ...inferredInputContext, ...(suppliedInputContext ?? {}) };\n if (!props.externalEmbed && !ready) return null;\n const backendUrl = agentUrls[agentRuntime] ?? null;\n // The chat URL names the agent, so each agent has its own login.\n const agentUrl = props.externalEmbed?.agentUrl ?? (backendUrl ? withAgentId(backendUrl, agentId) : null);\n const unavailable = !props.externalEmbed && loadFailed\n ? { heading: \"Could not check agent availability\", detail: \"The agent settings could not be loaded. Close this window and try again.\" }\n : !props.externalEmbed && !enabled\n ? { heading: \"Agent chat is disabled\", detail: \"Enable SolidX Agent Enabled in Settings to test this agent.\" }\n : !props.externalEmbed && !canUse\n ? { heading: \"Permission required\", detail: \"Your account needs the agent:invoke permission to test this agent.\" }\n : agentRuntime === \"agentHub\" && agentId === undefined\n ? { heading: \"No agent selected\", detail: \"Select an agent to start a test conversation.\" }\n : !agentUrl\n ? { heading: \"Backend URL is missing\", detail: `Configure the ${agentRuntime === \"agentHub\" ? \"SolidX Agent Hub\" : \"SolidX Agent\"} Backend URL in Settings to use this agent.` }\n : null;\n if (unavailable) {\n return (\n <div className={`${styles.root} ${styles.unavailableRoot} ${className ?? \"\"}`} style={{ height }}>\n {windowControls && (\n <div className={styles.unavailableHeader}>\n <strong>{title}</strong>\n <button type=\"button\" className={styles.iconBtn} aria-label=\"Close test agent\" title=\"Close test agent\" onClick={windowControls.onClose}>\n <X size={16} />\n </button>\n </div>\n )}\n <div className={styles.unavailableBody}>\n <div className={styles.unavailableCard} role=\"status\">\n <span className={styles.unavailableIcon}><MessageSquareText size={21} /></span>\n <h3 className={styles.unavailableTitle}>{unavailable.heading}</h3>\n <p className={styles.unavailableDescription}>{unavailable.detail}</p>\n </div>\n </div>\n </div>\n );\n }\n return (\n <div\n className={`${styles.root} ${className ?? \"\"}`}\n style={{ height, display: \"flex\", flexDirection: \"column\", border: \"1px solid var(--solid-agent-border)\", borderRadius: 12, overflow: \"hidden\", background: \"var(--solid-agent-bg)\" }}\n >\n {/* key: switching type remounts the chat onto the other backend's conversation. */}\n <SolidAgentChat key={agentUrl} agentUrl={agentUrl!!} agentRuntime={agentRuntime} title={title} agentVersion={props.agentVersion} inputContext={inputContext}\n inputs={props.inputs} requiredInputs={props.requiredInputs} externalEmbed={!!props.externalEmbed} onInputsLocked={props.externalEmbed?.onInputsLocked}\n sessionOwnerKey={props.externalEmbed?.sessionOwnerKey}\n beforeSend={props.externalEmbed?.beforeSend}\n embedded suggestions={suggestions} windowControls={windowControls} />\n </div>\n );\n}\n"]}
@@ -20,6 +20,7 @@ type SharedProps = {
20
20
  /** External bootstrap: the standalone route registers credentials for this private URL. */
21
21
  externalEmbed?: {
22
22
  agentUrl: string;
23
+ sessionOwnerKey?: string;
23
24
  onInputsLocked?: (locked: boolean) => void;
24
25
  beforeSend?: (request: BeforeUserMessageSendRequest, signal: AbortSignal) => Promise<EmbedMessageContext>;
25
26
  };
@@ -108,6 +109,7 @@ export function SolidAgentEmbedded(props: Props) {
108
109
  {/* key: switching type remounts the chat onto the other backend's conversation. */}
109
110
  <SolidAgentChat key={agentUrl} agentUrl={agentUrl!!} agentRuntime={agentRuntime} title={title} agentVersion={props.agentVersion} inputContext={inputContext}
110
111
  inputs={props.inputs} requiredInputs={props.requiredInputs} externalEmbed={!!props.externalEmbed} onInputsLocked={props.externalEmbed?.onInputsLocked}
112
+ sessionOwnerKey={props.externalEmbed?.sessionOwnerKey}
111
113
  beforeSend={props.externalEmbed?.beforeSend}
112
114
  embedded suggestions={suggestions} windowControls={windowControls} />
113
115
  </div>
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Pre-render fixes for table mistakes LLMs commonly make, which GFM parses strictly.
3
+ * Fenced code is never touched.
4
+ */
5
+ /**
6
+ * - Starts a table on its own block, so it is not swallowed by a preceding list item.
7
+ * - Escapes pipes inside inline code on table rows.
8
+ * - Drops blank lines between rows of one table.
9
+ * - Pads or trims the separator row to the header's column count.
10
+ */
11
+ export declare function normalizeAgentMarkdown(markdown: string): string;
12
+ type MarkdownNode = {
13
+ type: string;
14
+ value?: string;
15
+ children?: MarkdownNode[];
16
+ };
17
+ /** Remark plugin: renders `<br>` as a line break (LLMs use it inside table cells) while other raw HTML stays escaped. */
18
+ export declare function remarkHtmlBreaks(): (tree: MarkdownNode) => void;
19
+ export {};
20
+ //# sourceMappingURL=agentMarkdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/agentMarkdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwDH;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqD/D;AAED,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC;AAchF,yHAAyH;AACzH,wBAAgB,gBAAgB,WACd,YAAY,UAG7B"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Pre-render fixes for table mistakes LLMs commonly make, which GFM parses strictly.
3
+ * Fenced code is never touched.
4
+ */
5
+ var FENCE = /^\s*(`{3,}|~{3,})(.*)$/;
6
+ // A row needs a leading pipe and at least one more; tables without a leading pipe already parse fine.
7
+ var ROW = /^ {0,3}\|.*\|/;
8
+ var SEPARATOR_CELL = /^\s*:?-+:?\s*$/;
9
+ var CODE_SPAN = /(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/g;
10
+ /** Splits a table row on unescaped pipes, ignoring the optional outer pipes. */
11
+ function splitCells(line) {
12
+ var s = line.trim();
13
+ if (s.charAt(0) === "|")
14
+ s = s.slice(1);
15
+ if (s.length && s.charAt(s.length - 1) === "|" && s.charAt(s.length - 2) !== "\\")
16
+ s = s.slice(0, -1);
17
+ var cells = [];
18
+ var current = "";
19
+ for (var i = 0; i < s.length; i++) {
20
+ var ch = s.charAt(i);
21
+ if (ch === "\\" && i + 1 < s.length) {
22
+ current += ch + s.charAt(i + 1);
23
+ i++;
24
+ }
25
+ else if (ch === "|") {
26
+ cells.push(current);
27
+ current = "";
28
+ }
29
+ else {
30
+ current += ch;
31
+ }
32
+ }
33
+ cells.push(current);
34
+ return cells;
35
+ }
36
+ function isSeparator(line) {
37
+ if (!line || line.indexOf("|") === -1 || /^ {4,}/.test(line))
38
+ return false;
39
+ return splitCells(line).every(function (cell) { return SEPARATOR_CELL.test(cell); });
40
+ }
41
+ function isTableHeader(lines, i) {
42
+ return ROW.test(lines[i]) && isSeparator(lines[i + 1]);
43
+ }
44
+ /** GFM splits cells on every pipe, even inside code spans, unless the pipe is escaped. */
45
+ function escapeCodePipes(line) {
46
+ if (line.indexOf("`") === -1)
47
+ return line;
48
+ return line.replace(CODE_SPAN, function (span) { return span.replace(/\\?\|/g, function (pipe) { return (pipe.length === 1 ? "\\|" : pipe); }); });
49
+ }
50
+ /** GFM rejects the whole table when the separator's column count differs from the header's. */
51
+ function fixSeparator(line, columns) {
52
+ var cells = splitCells(line);
53
+ if (cells.length === columns)
54
+ return line;
55
+ var indent = /^\s*/.exec(line)[0];
56
+ var fixed = [];
57
+ for (var i = 0; i < columns; i++)
58
+ fixed.push(i < cells.length ? cells[i].trim() : "---");
59
+ return "".concat(indent, "| ").concat(fixed.join(" | "), " |");
60
+ }
61
+ /**
62
+ * - Starts a table on its own block, so it is not swallowed by a preceding list item.
63
+ * - Escapes pipes inside inline code on table rows.
64
+ * - Drops blank lines between rows of one table.
65
+ * - Pads or trims the separator row to the header's column count.
66
+ */
67
+ export function normalizeAgentMarkdown(markdown) {
68
+ if (markdown.indexOf("|") === -1)
69
+ return markdown;
70
+ var lines = markdown.replace(/\r\n?/g, "\n").split("\n");
71
+ var out = [];
72
+ var fence = null;
73
+ var inTable = false;
74
+ for (var i = 0; i < lines.length; i++) {
75
+ var line = lines[i];
76
+ var fenceMatch = FENCE.exec(line);
77
+ if (fence) {
78
+ if (fenceMatch && fenceMatch[1].charAt(0) === fence.char && fenceMatch[1].length >= fence.size && !fenceMatch[2].trim()) {
79
+ fence = null;
80
+ }
81
+ out.push(line);
82
+ continue;
83
+ }
84
+ if (fenceMatch) {
85
+ fence = { char: fenceMatch[1].charAt(0), size: fenceMatch[1].length };
86
+ inTable = false;
87
+ out.push(line);
88
+ continue;
89
+ }
90
+ if (inTable) {
91
+ if (ROW.test(line) && !isTableHeader(lines, i)) {
92
+ out.push(escapeCodePipes(line));
93
+ continue;
94
+ }
95
+ if (!line.trim()) {
96
+ var next = i;
97
+ while (next < lines.length && !lines[next].trim())
98
+ next++;
99
+ if (next < lines.length && ROW.test(lines[next]) && !isTableHeader(lines, next)) {
100
+ i = next - 1;
101
+ continue;
102
+ }
103
+ }
104
+ inTable = false;
105
+ }
106
+ if (isTableHeader(lines, i)) {
107
+ var header = escapeCodePipes(line);
108
+ // An indented table belongs to the list item above it; leave its placement alone.
109
+ if (!/^\s/.test(header) && out.length && out[out.length - 1].trim())
110
+ out.push("");
111
+ out.push(header, fixSeparator(lines[i + 1], splitCells(header).length));
112
+ inTable = true;
113
+ i++;
114
+ continue;
115
+ }
116
+ out.push(line);
117
+ }
118
+ return out.join("\n");
119
+ }
120
+ var BR_TAG = /^<br\s*\/?>$/i;
121
+ function replaceBreaks(node) {
122
+ var _a;
123
+ var children = node.children;
124
+ if (!children)
125
+ return;
126
+ for (var i = 0; i < children.length; i++) {
127
+ var child = children[i];
128
+ if (child.type === "html" && BR_TAG.test(((_a = child.value) !== null && _a !== void 0 ? _a : "").trim()))
129
+ children[i] = { type: "break" };
130
+ else
131
+ replaceBreaks(child);
132
+ }
133
+ }
134
+ /** Remark plugin: renders `<br>` as a line break (LLMs use it inside table cells) while other raw HTML stays escaped. */
135
+ export function remarkHtmlBreaks() {
136
+ return function (tree) {
137
+ replaceBreaks(tree);
138
+ };
139
+ }
140
+ //# sourceMappingURL=agentMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentMarkdown.js","sourceRoot":"","sources":["../../../../src/components/core/solid-agent/agentMarkdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,IAAM,KAAK,GAAG,wBAAwB,CAAC;AACvC,sGAAsG;AACtG,IAAM,GAAG,GAAG,eAAe,CAAC;AAC5B,IAAM,cAAc,GAAG,gBAAgB,CAAC;AACxC,IAAM,SAAS,GAAG,qCAAqC,CAAC;AAExD,gFAAgF;AAChF,SAAS,UAAU,CAAC,IAAY;IAC5B,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtG,IAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAA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C,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,MAAA,KAAK,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;YACjG,aAAa,CAAC,KAAK,CAAC,CAAC;KAC7B;AACL,CAAC;AAED,yHAAyH;AACzH,MAAM,UAAU,gBAAgB;IAC5B,OAAO,UAAC,IAAkB;QACtB,aAAa,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;AACN,CAAC","sourcesContent":["/**\n * Pre-render fixes for table mistakes LLMs commonly make, which GFM parses strictly.\n * Fenced code is never touched.\n */\n\nconst FENCE = /^\\s*(`{3,}|~{3,})(.*)$/;\n// A row needs a leading pipe and at least one more; tables without a leading pipe already parse fine.\nconst ROW = /^ {0,3}\\|.*\\|/;\nconst SEPARATOR_CELL = /^\\s*:?-+:?\\s*$/;\nconst CODE_SPAN = /(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/g;\n\n/** Splits a table row on unescaped pipes, ignoring the optional outer pipes. */\nfunction splitCells(line: string): string[] {\n let s = line.trim();\n if (s.charAt(0) === \"|\") s = s.slice(1);\n if (s.length && s.charAt(s.length - 1) === \"|\" && s.charAt(s.length - 2) !== \"\\\\\") s = s.slice(0, -1);\n const cells: string[] = [];\n let current = \"\";\n for (let i = 0; i < s.length; i++) {\n const ch = s.charAt(i);\n if (ch === \"\\\\\" && i + 1 < s.length) {\n current += ch + s.charAt(i + 1);\n i++;\n } else if (ch === \"|\") {\n cells.push(current);\n current = \"\";\n } else {\n current += ch;\n }\n }\n cells.push(current);\n return cells;\n}\n\nfunction isSeparator(line: string | undefined): boolean {\n if (!line || line.indexOf(\"|\") === -1 || /^ {4,}/.test(line)) return false;\n return splitCells(line).every((cell) => SEPARATOR_CELL.test(cell));\n}\n\nfunction isTableHeader(lines: string[], i: number): boolean {\n return ROW.test(lines[i]) && isSeparator(lines[i + 1]);\n}\n\n/** GFM splits cells on every pipe, even inside code spans, unless the pipe is escaped. */\nfunction escapeCodePipes(line: string): string {\n if (line.indexOf(\"`\") === -1) return line;\n return line.replace(CODE_SPAN, (span) => span.replace(/\\\\?\\|/g, (pipe) => (pipe.length === 1 ? \"\\\\|\" : pipe)));\n}\n\n/** GFM rejects the whole table when the separator's column count differs from the header's. */\nfunction fixSeparator(line: string, columns: number): string {\n const cells = splitCells(line);\n if (cells.length === columns) return line;\n const indent = /^\\s*/.exec(line)![0];\n const fixed: string[] = [];\n for (let i = 0; i < columns; i++) fixed.push(i < cells.length ? cells[i].trim() : \"---\");\n return `${indent}| ${fixed.join(\" | \")} |`;\n}\n\n/**\n * - Starts a table on its own block, so it is not swallowed by a preceding list item.\n * - Escapes pipes inside inline code on table rows.\n * - Drops blank lines between rows of one table.\n * - Pads or trims the separator row to the header's column count.\n */\nexport function normalizeAgentMarkdown(markdown: string): string {\n if (markdown.indexOf(\"|\") === -1) return markdown;\n const lines = markdown.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n const out: string[] = [];\n let fence: { char: string; size: number } | null = null;\n let inTable = false;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const fenceMatch = FENCE.exec(line);\n if (fence) {\n if (fenceMatch && fenceMatch[1].charAt(0) === fence.char && fenceMatch[1].length >= fence.size && !fenceMatch[2].trim()) {\n fence = null;\n }\n out.push(line);\n continue;\n }\n if (fenceMatch) {\n fence = { char: fenceMatch[1].charAt(0), size: fenceMatch[1].length };\n inTable = false;\n out.push(line);\n continue;\n }\n\n if (inTable) {\n if (ROW.test(line) && !isTableHeader(lines, i)) {\n out.push(escapeCodePipes(line));\n continue;\n }\n if (!line.trim()) {\n let next = i;\n while (next < lines.length && !lines[next].trim()) next++;\n if (next < lines.length && ROW.test(lines[next]) && !isTableHeader(lines, next)) {\n i = next - 1;\n continue;\n }\n }\n inTable = false;\n }\n\n if (isTableHeader(lines, i)) {\n const header = escapeCodePipes(line);\n // An indented table belongs to the list item above it; leave its placement alone.\n if (!/^\\s/.test(header) && out.length && out[out.length - 1].trim()) out.push(\"\");\n out.push(header, fixSeparator(lines[i + 1], splitCells(header).length));\n inTable = true;\n i++;\n continue;\n }\n\n out.push(line);\n }\n return out.join(\"\\n\");\n}\n\ntype MarkdownNode = { type: string; value?: string; children?: MarkdownNode[] };\n\nconst BR_TAG = /^<br\\s*\\/?>$/i;\n\nfunction replaceBreaks(node: MarkdownNode) {\n const children = node.children;\n if (!children) return;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.type === \"html\" && BR_TAG.test((child.value ?? \"\").trim())) children[i] = { type: \"break\" };\n else replaceBreaks(child);\n }\n}\n\n/** Remark plugin: renders `<br>` as a line break (LLMs use it inside table cells) while other raw HTML stays escaped. */\nexport function remarkHtmlBreaks() {\n return (tree: MarkdownNode) => {\n replaceBreaks(tree);\n };\n}\n"]}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Pre-render fixes for table mistakes LLMs commonly make, which GFM parses strictly.
3
+ * Fenced code is never touched.
4
+ */
5
+
6
+ const FENCE = /^\s*(`{3,}|~{3,})(.*)$/;
7
+ // A row needs a leading pipe and at least one more; tables without a leading pipe already parse fine.
8
+ const ROW = /^ {0,3}\|.*\|/;
9
+ const SEPARATOR_CELL = /^\s*:?-+:?\s*$/;
10
+ const CODE_SPAN = /(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/g;
11
+
12
+ /** Splits a table row on unescaped pipes, ignoring the optional outer pipes. */
13
+ function splitCells(line: string): string[] {
14
+ let s = line.trim();
15
+ if (s.charAt(0) === "|") s = s.slice(1);
16
+ if (s.length && s.charAt(s.length - 1) === "|" && s.charAt(s.length - 2) !== "\\") s = s.slice(0, -1);
17
+ const cells: string[] = [];
18
+ let current = "";
19
+ for (let i = 0; i < s.length; i++) {
20
+ const ch = s.charAt(i);
21
+ if (ch === "\\" && i + 1 < s.length) {
22
+ current += ch + s.charAt(i + 1);
23
+ i++;
24
+ } else if (ch === "|") {
25
+ cells.push(current);
26
+ current = "";
27
+ } else {
28
+ current += ch;
29
+ }
30
+ }
31
+ cells.push(current);
32
+ return cells;
33
+ }
34
+
35
+ function isSeparator(line: string | undefined): boolean {
36
+ if (!line || line.indexOf("|") === -1 || /^ {4,}/.test(line)) return false;
37
+ return splitCells(line).every((cell) => SEPARATOR_CELL.test(cell));
38
+ }
39
+
40
+ function isTableHeader(lines: string[], i: number): boolean {
41
+ return ROW.test(lines[i]) && isSeparator(lines[i + 1]);
42
+ }
43
+
44
+ /** GFM splits cells on every pipe, even inside code spans, unless the pipe is escaped. */
45
+ function escapeCodePipes(line: string): string {
46
+ if (line.indexOf("`") === -1) return line;
47
+ return line.replace(CODE_SPAN, (span) => span.replace(/\\?\|/g, (pipe) => (pipe.length === 1 ? "\\|" : pipe)));
48
+ }
49
+
50
+ /** GFM rejects the whole table when the separator's column count differs from the header's. */
51
+ function fixSeparator(line: string, columns: number): string {
52
+ const cells = splitCells(line);
53
+ if (cells.length === columns) return line;
54
+ const indent = /^\s*/.exec(line)![0];
55
+ const fixed: string[] = [];
56
+ for (let i = 0; i < columns; i++) fixed.push(i < cells.length ? cells[i].trim() : "---");
57
+ return `${indent}| ${fixed.join(" | ")} |`;
58
+ }
59
+
60
+ /**
61
+ * - Starts a table on its own block, so it is not swallowed by a preceding list item.
62
+ * - Escapes pipes inside inline code on table rows.
63
+ * - Drops blank lines between rows of one table.
64
+ * - Pads or trims the separator row to the header's column count.
65
+ */
66
+ export function normalizeAgentMarkdown(markdown: string): string {
67
+ if (markdown.indexOf("|") === -1) return markdown;
68
+ const lines = markdown.replace(/\r\n?/g, "\n").split("\n");
69
+ const out: string[] = [];
70
+ let fence: { char: string; size: number } | null = null;
71
+ let inTable = false;
72
+
73
+ for (let i = 0; i < lines.length; i++) {
74
+ const line = lines[i];
75
+ const fenceMatch = FENCE.exec(line);
76
+ if (fence) {
77
+ if (fenceMatch && fenceMatch[1].charAt(0) === fence.char && fenceMatch[1].length >= fence.size && !fenceMatch[2].trim()) {
78
+ fence = null;
79
+ }
80
+ out.push(line);
81
+ continue;
82
+ }
83
+ if (fenceMatch) {
84
+ fence = { char: fenceMatch[1].charAt(0), size: fenceMatch[1].length };
85
+ inTable = false;
86
+ out.push(line);
87
+ continue;
88
+ }
89
+
90
+ if (inTable) {
91
+ if (ROW.test(line) && !isTableHeader(lines, i)) {
92
+ out.push(escapeCodePipes(line));
93
+ continue;
94
+ }
95
+ if (!line.trim()) {
96
+ let next = i;
97
+ while (next < lines.length && !lines[next].trim()) next++;
98
+ if (next < lines.length && ROW.test(lines[next]) && !isTableHeader(lines, next)) {
99
+ i = next - 1;
100
+ continue;
101
+ }
102
+ }
103
+ inTable = false;
104
+ }
105
+
106
+ if (isTableHeader(lines, i)) {
107
+ const header = escapeCodePipes(line);
108
+ // An indented table belongs to the list item above it; leave its placement alone.
109
+ if (!/^\s/.test(header) && out.length && out[out.length - 1].trim()) out.push("");
110
+ out.push(header, fixSeparator(lines[i + 1], splitCells(header).length));
111
+ inTable = true;
112
+ i++;
113
+ continue;
114
+ }
115
+
116
+ out.push(line);
117
+ }
118
+ return out.join("\n");
119
+ }
120
+
121
+ type MarkdownNode = { type: string; value?: string; children?: MarkdownNode[] };
122
+
123
+ const BR_TAG = /^<br\s*\/?>$/i;
124
+
125
+ function replaceBreaks(node: MarkdownNode) {
126
+ const children = node.children;
127
+ if (!children) return;
128
+ for (let i = 0; i < children.length; i++) {
129
+ const child = children[i];
130
+ if (child.type === "html" && BR_TAG.test((child.value ?? "").trim())) children[i] = { type: "break" };
131
+ else replaceBreaks(child);
132
+ }
133
+ }
134
+
135
+ /** Remark plugin: renders `<br>` as a line break (LLMs use it inside table cells) while other raw HTML stays escaped. */
136
+ export function remarkHtmlBreaks() {
137
+ return (tree: MarkdownNode) => {
138
+ replaceBreaks(tree);
139
+ };
140
+ }
@@ -42,7 +42,7 @@ export declare class AgentRuntime {
42
42
  private loadingHistoryPages;
43
43
  private loadedHistoryPages;
44
44
  private readonly sessionKey;
45
- constructor(agentUrl: string, dispatch: Dispatch, getState: GetAgentState, agentRuntime?: AgentRuntimeType, persistSession?: boolean);
45
+ constructor(agentUrl: string, dispatch: Dispatch, getState: GetAgentState, agentRuntime?: AgentRuntimeType, persistSession?: boolean, sessionOwnerKey?: string);
46
46
  updateStore(dispatch: Dispatch, getState: GetAgentState): void;
47
47
  /**
48
48
  * Uploads files into SolidX media storage first, then sends their IDs with the socket message.
@@ -1 +1 @@
1
- {"version":3,"file":"agentRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/components/core/solid-agent/client/agentRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,UAAU,EAClB,MAAM,uCAAuC,CAAC;AAM/C,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAuB,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,mBAAmB,EAAuB,MAAM,UAAU,CAAC;AAIzM,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;;;;;GAMG;AAEH,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;AACrC,KAAK,aAAa,GAAG,MAAM,UAAU,GAAG,SAAS,CAAC;AAyBlD,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,QAOzE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO3D;AAED,wBAAgB,kBAAkB,CAAC,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oBAAoB,CAAC,IAAI,EAAE,mBAAmB;IAM9C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,mBAAmB;IAgBjF,SAAS;IAMf,OAAO,CAAC,iBAAiB;IAOzB,OAAO;YASO,WAAW;IAqCzB,OAAO,CAAC,WAAW;IAwDnB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,uBAAuB,CAAuB;IACtD,OAAO,CAAC,oBAAoB,CAAK;IAEjC,OAAO,CAAC,aAAa;IAoCrB,OAAO,CAAC,WAAW;CAUtB;AAID,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,YAAY,CAQ9G;AAED,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAErD;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,SAIlC"}
@@ -59,12 +59,13 @@ import { clearAllAgentAuth } from "./agentAuth";
59
59
  import { fetchSessionHistory, uploadAgentAttachments } from "./agentRest";
60
60
  import { AgentSocket } from "./agentSocket";
61
61
  import { agentIdOf } from "./agentUrls";
62
- /** Keep the original SolidX storage key; Agent Hub keeps one per agent (its agent URL names the agent). */
63
- function sessionKey(agentRuntime, agentUrl) {
62
+ /** Keep the original SolidX key; AgentHub embeds also scope saved sessions to their authenticated user. */
63
+ function sessionKey(agentRuntime, agentUrl, ownerKey) {
64
64
  if (agentRuntime === "solidx")
65
65
  return "solid-agent.session_id";
66
66
  var agentId = agentIdOf(agentUrl);
67
- return agentId === undefined ? "solid-agent.".concat(agentRuntime, ".session_id") : "solid-agent.".concat(agentRuntime, ".").concat(agentId, ".session_id");
67
+ var ownerSuffix = ownerKey ? ".".concat(encodeURIComponent(ownerKey)) : "";
68
+ return agentId === undefined ? "solid-agent.".concat(agentRuntime).concat(ownerSuffix, ".session_id") : "solid-agent.".concat(agentRuntime, ".").concat(agentId).concat(ownerSuffix, ".session_id");
68
69
  }
69
70
  function readSessionId(key) {
70
71
  try {
@@ -160,7 +161,7 @@ export function setStoredSessionOptions(provider, opts) {
160
161
  }
161
162
  }
162
163
  var AgentRuntime = /** @class */ (function () {
163
- function AgentRuntime(agentUrl, dispatch, getState, agentRuntime, persistSession) {
164
+ function AgentRuntime(agentUrl, dispatch, getState, agentRuntime, persistSession, sessionOwnerKey) {
164
165
  var _this = this;
165
166
  if (agentRuntime === void 0) { agentRuntime = "solidx"; }
166
167
  if (persistSession === void 0) { persistSession = true; }
@@ -285,7 +286,7 @@ var AgentRuntime = /** @class */ (function () {
285
286
  writable: true,
286
287
  value: 0
287
288
  });
288
- this.sessionKey = sessionKey(agentRuntime, agentUrl);
289
+ this.sessionKey = sessionKey(agentRuntime, agentUrl, sessionOwnerKey);
289
290
  var initialProvider = getStoredProvider();
290
291
  var initialModel = getStoredModel(initialProvider);
291
292
  var initialOptions = {