@m6d/cortex-angular 1.8.0 → 1.8.1

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.
@@ -1353,8 +1353,7 @@ class CortexChatService {
1353
1353
  return unansweredToolCalls(chat.messages()).length > 0;
1354
1354
  }, ...ngDevMode ? [{ debugName: "hasPendingToolCalls" }] : []);
1355
1355
  messageMetadata = signal(new Map, ...ngDevMode ? [{ debugName: "messageMetadata" }] : []);
1356
- attachmentsEnabled = computed(() => this.config().attachments !== false && this.serverAcceptsAttachments(), ...ngDevMode ? [{ debugName: "attachmentsEnabled" }] : []);
1357
- serverAcceptsAttachments = signal(true, ...ngDevMode ? [{ debugName: "serverAcceptsAttachments" }] : []);
1356
+ capabilities = signal(undefined, ...ngDevMode ? [{ debugName: "capabilities" }] : []);
1358
1357
  events = new Subject;
1359
1358
  selectedThreadSnapshot = signal(undefined, ...ngDevMode ? [{ debugName: "selectedThreadSnapshot" }] : []);
1360
1359
  config = inject(CORTEX_CLIENT_CONFIG);
@@ -1377,7 +1376,7 @@ class CortexChatService {
1377
1376
  this.threadService.start();
1378
1377
  this.subscribeToWsEvents();
1379
1378
  this.subscribeToWsConnections();
1380
- this.api.getCapabilities().then((capabilities) => this.serverAcceptsAttachments.set(capabilities.attachments)).catch(() => {});
1379
+ this.api.getCapabilities().then((capabilities) => this.capabilities.set(capabilities)).catch(() => {});
1381
1380
  }
1382
1381
  get events$() {
1383
1382
  return this.events.asObservable();
@@ -1816,7 +1815,7 @@ class ChatComposerComponent {
1816
1815
  translateService = inject(TranslateService);
1817
1816
  text = model("", ...ngDevMode ? [{ debugName: "text" }] : []);
1818
1817
  dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : []);
1819
- attachmentsEnabled = this.chatService.attachmentsEnabled;
1818
+ attachmentsEnabled = computed(() => this.chatService.capabilities()?.attachments ?? false, ...ngDevMode ? [{ debugName: "attachmentsEnabled" }] : []);
1820
1819
  acceptedTypes = ATTACHMENT_MIME_TYPES.join(",");
1821
1820
  canSend = computed(() => !this.queue.busy() && (Boolean(this.text().trim()) || this.queue.hasReady()), ...ngDevMode ? [{ debugName: "canSend" }] : []);
1822
1821
  messageInput = viewChild("messageInput", ...ngDevMode ? [{ debugName: "messageInput" }] : []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-angular",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Reusable AI agent chat UI library for Angular",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -52,6 +52,13 @@ export type ClientToolBinding = {
52
52
  surface: "inline" | "modal";
53
53
  embedOrigin: string;
54
54
  };
55
+ /**
56
+ * What the server offers this agent's clients, fetched once at widget startup.
57
+ * The widget hides UI for anything absent; enforcement stays server-side.
58
+ */
59
+ export type AgentCapabilities = {
60
+ attachments: boolean;
61
+ };
55
62
  export type MessageMetadata = {
56
63
  modelId?: string;
57
64
  providerMetadata?: unknown;
@@ -124,12 +131,6 @@ export type CortexConfig = {
124
131
  /** Prompt chips on the blank-chat landing; clicking one sends it as the first message. */
125
132
  suggestions?: Localized<string[]>;
126
133
  showDebugButton?: boolean;
127
- /**
128
- * Embedder override for the file-upload controls (attach button, drop,
129
- * paste). The widget already hides them when the server's capability
130
- * handshake says the agent refuses uploads; `false` hides them regardless.
131
- */
132
- attachments?: boolean;
133
134
  /**
134
135
  * Render embedded tool pages served from this page's own origin with their
135
136
  * full identity — which, same-origin, means no effective sandbox at all: such
@@ -220,13 +221,8 @@ declare class CortexChatService {
220
221
  * the stream, and are merged back in by message id at render time.
221
222
  */
222
223
  readonly messageMetadata: _angular_core.WritableSignal<ReadonlyMap<string, MessageMetadata>>;
223
- /**
224
- * Server capability AND the embedder's `config.attachments` override.
225
- * Optimistically true until the handshake answers; most agents accept files
226
- * and a briefly hidden button would flicker for them.
227
- */
228
- readonly attachmentsEnabled: _angular_core.Signal<boolean>;
229
- private readonly serverAcceptsAttachments;
224
+ /** What the server offers this agent's clients; undefined until the handshake answers. */
225
+ readonly capabilities: _angular_core.WritableSignal<AgentCapabilities | undefined>;
230
226
  private readonly events;
231
227
  private readonly selectedThreadSnapshot;
232
228
  private readonly config;