@copilotkit/angular 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injectable, DestroyRef, afterRenderEffect, input, viewChild, ElementRef, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component, computed, signal, effect, untracked, Injector, runInInjectionContext, TemplateRef, ViewContainerRef, ViewChild, Inject, Input, Directive, output, HostListener, ViewEncapsulation, ContentChild, Optional, linkedSignal, ChangeDetectorRef, PLATFORM_ID, contentChild, forwardRef, Renderer2 } from '@angular/core';
3
- import { CopilotKitCoreRuntimeConnectionStatus, CopilotKitCore, ProxiedCopilotRuntimeAgent, completePartialMarkdown } from '@copilotkit/core';
4
- import { A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_DEFAULT_DESIGN_GUIDELINES, schemaToJsonSchema, partialJSONParse, DEFAULT_AGENT_ID, TranscriptionErrorCode, copyToClipboard, getSourceUrl, getDocumentIcon, formatFileSize, matchesAcceptFilter, exceedsMaxSize, randomUUID, getModalityFromMimeType, readFileAsBase64, generateVideoThumbnail } from '@copilotkit/shared';
2
+ import { InjectionToken, inject, Injectable, DestroyRef, afterRenderEffect, input, viewChild, ElementRef, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component, computed, signal, effect, untracked, Injector, runInInjectionContext, TemplateRef, ViewContainerRef, ViewChild, Inject, Input, Directive, output, HostListener, ViewEncapsulation, ContentChild, Optional, linkedSignal, ChangeDetectorRef, PLATFORM_ID, contentChild, forwardRef, Renderer2, EventEmitter, Output } from '@angular/core';
3
+ import { CopilotKitCoreRuntimeConnectionStatus, CopilotKitCore, ProxiedCopilotRuntimeAgent, ɵcreateThreadStore as _createThreadStore, ɵselectThreads as _selectThreads, ɵselectThreadsIsLoading as _selectThreadsIsLoading, ɵselectThreadsError as _selectThreadsError, ɵselectFetchMoreError as _selectFetchMoreError, ɵselectHasNextPage as _selectHasNextPage, ɵselectIsFetchingNextPage as _selectIsFetchingNextPage, ɵselectIsMutating as _selectIsMutating, ɵselectMemories as _selectMemories, ɵselectMemoriesIsLoading as _selectMemoriesIsLoading, ɵselectMemoriesError as _selectMemoriesError, ɵselectMemoriesAvailable as _selectMemoriesAvailable, ɵselectMemoriesRealtimeStatus as _selectMemoriesRealtimeStatus, completePartialMarkdown } from '@copilotkit/core';
4
+ import { A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_DEFAULT_DESIGN_GUIDELINES, schemaToJsonSchema, partialJSONParse, DEFAULT_AGENT_ID, randomUUID, TranscriptionErrorCode, copyToClipboard, getSourceUrl, getDocumentIcon, formatFileSize, matchesAcceptFilter, exceedsMaxSize, getModalityFromMimeType, readFileAsBase64, generateVideoThumbnail, createLicenseContextValue } from '@copilotkit/shared';
5
5
  export { TranscriptionErrorCode } from '@copilotkit/shared';
6
6
  import { buildCatalogContextValue, extractCatalogComponentSchemas, A2UI_SCHEMA_CONTEXT_DESCRIPTION } from '@copilotkit/a2ui-renderer/web-components';
7
7
  import { Subject, lastValueFrom, filter, take, BehaviorSubject, merge, fromEvent, animationFrameScheduler } from 'rxjs';
@@ -14,6 +14,7 @@ import * as i1 from '@angular/cdk/scrolling';
14
14
  import { ScrollingModule } from '@angular/cdk/scrolling';
15
15
  import { clsx } from 'clsx';
16
16
  import { twMerge } from 'tailwind-merge';
17
+ import { toSignal } from '@angular/core/rxjs-interop';
17
18
  import { Overlay, OverlayPositionBuilder, OverlayModule } from '@angular/cdk/overlay';
18
19
  import { ComponentPortal } from '@angular/cdk/portal';
19
20
  import { Marked } from 'marked';
@@ -24,6 +25,7 @@ import { LucideAngularModule, Copy, Check, ThumbsUp, ThumbsDown, Volume2, Refres
24
25
  import * as i1$2 from '@angular/cdk/menu';
25
26
  import { CdkMenuModule } from '@angular/cdk/menu';
26
27
  import { HttpAgent, AGUIConnectNotImplementedError } from '@ag-ui/client';
28
+ import { defineCopilotKitThreadsDrawer } from '@copilotkit/web-components/threads-drawer';
27
29
 
28
30
  // The license watermark is currently disabled. The implementation below is
29
31
  // kept intact so it can be re-enabled by flipping this flag back to `true`.
@@ -1389,6 +1391,31 @@ class CopilotKit {
1389
1391
  runtimeTransport = this.#runtimeTransport.asReadonly();
1390
1392
  #headers = signal({}, ...(ngDevMode ? [{ debugName: "#headers" }] : /* istanbul ignore next */ []));
1391
1393
  headers = this.#headers.asReadonly();
1394
+ #threadEndpoints = signal(undefined, ...(ngDevMode ? [{ debugName: "#threadEndpoints" }] : /* istanbul ignore next */ []));
1395
+ /**
1396
+ * Thread-endpoint capability advertised by the connected runtime's `/info`
1397
+ * response, or `undefined` before the runtime reports `Connected`. Exposed
1398
+ * as a signal (rather than a plain `core.threadEndpoints` read) so reactive
1399
+ * consumers re-run when `/info` lands.
1400
+ */
1401
+ threadEndpoints = this.#threadEndpoints.asReadonly();
1402
+ #intelligence = signal(undefined, ...(ngDevMode ? [{ debugName: "#intelligence" }] : /* istanbul ignore next */ []));
1403
+ /**
1404
+ * Intelligence runtime info advertised by the connected runtime's `/info`
1405
+ * response, or `undefined` before the runtime reports `Connected`. Carries
1406
+ * the realtime `wsUrl`. Exposed as a signal so reactive consumers re-run
1407
+ * when `/info` populates it — even if the connection status does not
1408
+ * transition in the same turn.
1409
+ */
1410
+ intelligence = this.#intelligence.asReadonly();
1411
+ #licenseStatus = signal(undefined, ...(ngDevMode ? [{ debugName: "#licenseStatus" }] : /* istanbul ignore next */ []));
1412
+ /**
1413
+ * Server-reported license status from the connected runtime's `/info`
1414
+ * response, or `undefined` before the runtime reports it. Exposed as a signal
1415
+ * (rather than a plain `core.licenseStatus` read) so reactive consumers — e.g.
1416
+ * the threads drawer's license gate — re-run once the status resolves.
1417
+ */
1418
+ licenseStatus = this.#licenseStatus.asReadonly();
1392
1419
  #suggestionsByAgent = signal({}, ...(ngDevMode ? [{ debugName: "#suggestionsByAgent" }] : /* istanbul ignore next */ []));
1393
1420
  suggestionsByAgent = this.#suggestionsByAgent.asReadonly();
1394
1421
  core = new CopilotKitCore({
@@ -1431,6 +1458,9 @@ class CopilotKit {
1431
1458
  this.#runtimeUrl.set(this.core.runtimeUrl);
1432
1459
  this.#runtimeTransport.set(this.core.runtimeTransport);
1433
1460
  this.#headers.set(this.core.headers);
1461
+ this.#threadEndpoints.set(this.core.threadEndpoints);
1462
+ this.#intelligence.set(this.core.intelligence);
1463
+ this.#licenseStatus.set(this.core.licenseStatus);
1434
1464
  this.#config.renderToolCalls?.forEach((renderConfig) => {
1435
1465
  this.addRenderToolCall(renderConfig);
1436
1466
  });
@@ -1458,7 +1488,15 @@ class CopilotKit {
1458
1488
  this.#agents.set(this.core.agents);
1459
1489
  },
1460
1490
  onRuntimeConnectionStatusChanged: ({ status }) => {
1491
+ // Core assigns `threadEndpoints`/`intelligence` synchronously before it
1492
+ // notifies this callback (see agent-registry `ensureRuntimeMode`), so
1493
+ // mirroring them here keeps the signals in lockstep with the status
1494
+ // signal and lets reactive consumers observe `intelligence.wsUrl` once
1495
+ // `/info` resolves.
1461
1496
  this.#runtimeConnectionStatus.set(status);
1497
+ this.#threadEndpoints.set(this.core.threadEndpoints);
1498
+ this.#intelligence.set(this.core.intelligence);
1499
+ this.#licenseStatus.set(this.core.licenseStatus);
1462
1500
  this.#syncBuiltInActivityMessageRenderers();
1463
1501
  this.#syncBuiltInOpenGenerativeUI();
1464
1502
  },
@@ -2080,6 +2118,354 @@ function injectAgentStore(agentId) {
2080
2118
  return agentFactory.createAgentStoreSignal(agentIdSignal, destroyRef);
2081
2119
  }
2082
2120
 
2121
+ /** Normalizes a value-or-signal field into a no-arg accessor. */
2122
+ function toAccessor(value) {
2123
+ return typeof value === "function" ? value : () => value;
2124
+ }
2125
+ /**
2126
+ * Projects a core {@link ɵThread} record down to the public {@link Thread}
2127
+ * shape, omitting `lastRunAt` entirely when the source value is absent so the
2128
+ * field stays optional rather than `undefined`.
2129
+ */
2130
+ function projectThread(thread) {
2131
+ const { id, agentId, name, archived, createdAt, updatedAt, lastRunAt } = thread;
2132
+ return {
2133
+ id,
2134
+ agentId,
2135
+ name,
2136
+ archived,
2137
+ createdAt,
2138
+ updatedAt,
2139
+ ...(lastRunAt !== undefined ? { lastRunAt } : {}),
2140
+ };
2141
+ }
2142
+ /**
2143
+ * Owns a single core thread store, bridges its selector observables onto
2144
+ * Angular writable signals, keeps the store's runtime context in sync with the
2145
+ * ambient {@link CopilotKit} configuration, and registers/unregisters the
2146
+ * store with core for the active agent.
2147
+ *
2148
+ * One instance backs each {@link injectThreads} call. Tear-down (selector
2149
+ * unsubscribe, store stop, core unregister) runs on the host's
2150
+ * {@link DestroyRef}.
2151
+ */
2152
+ class ThreadsStore {
2153
+ #copilotkit = inject(CopilotKit);
2154
+ #store = _createThreadStore({
2155
+ // Cast to `typeof fetch`: the wrapper preserves correct `this` binding for
2156
+ // globalThis.fetch but does not re-expose static members (e.g. `preconnect`)
2157
+ // that newer DOM libs add and that the store never calls.
2158
+ fetch: ((...args) => globalThis.fetch(...args)),
2159
+ });
2160
+ #subscriptions = [];
2161
+ #threads = signal([], ...(ngDevMode ? [{ debugName: "#threads" }] : /* istanbul ignore next */ []));
2162
+ #storeIsLoading = signal(false, ...(ngDevMode ? [{ debugName: "#storeIsLoading" }] : /* istanbul ignore next */ []));
2163
+ #storeError = signal(null, ...(ngDevMode ? [{ debugName: "#storeError" }] : /* istanbul ignore next */ []));
2164
+ #fetchMoreError = signal(null, ...(ngDevMode ? [{ debugName: "#fetchMoreError" }] : /* istanbul ignore next */ []));
2165
+ #hasMoreThreads = signal(false, ...(ngDevMode ? [{ debugName: "#hasMoreThreads" }] : /* istanbul ignore next */ []));
2166
+ #isFetchingMoreThreads = signal(false, ...(ngDevMode ? [{ debugName: "#isFetchingMoreThreads" }] : /* istanbul ignore next */ []));
2167
+ #isMutating = signal(false, ...(ngDevMode ? [{ debugName: "#isMutating" }] : /* istanbul ignore next */ []));
2168
+ /**
2169
+ * Tracks whether a real runtime context has been dispatched to the store
2170
+ * yet. The store itself starts `isLoading: false`, so before the first
2171
+ * dispatch consumers would otherwise see an empty, non-loading list (the
2172
+ * empty-list flash). While a runtime URL is configured and the endpoints
2173
+ * are available but no context has been dispatched, we synthesize loading.
2174
+ */
2175
+ #hasDispatchedContext = signal(false, ...(ngDevMode ? [{ debugName: "#hasDispatchedContext" }] : /* istanbul ignore next */ []));
2176
+ threads = this.#threads.asReadonly();
2177
+ error;
2178
+ listError;
2179
+ fetchMoreError = this.#fetchMoreError.asReadonly();
2180
+ isLoading;
2181
+ hasMoreThreads = this.#hasMoreThreads.asReadonly();
2182
+ isFetchingMoreThreads = this.#isFetchingMoreThreads.asReadonly();
2183
+ isMutating = this.#isMutating.asReadonly();
2184
+ constructor(input, destroyRef) {
2185
+ const agentId = toAccessor(input.agentId);
2186
+ const includeArchived = toAccessor(input.includeArchived);
2187
+ const limit = toAccessor(input.limit);
2188
+ const enabled = toAccessor(input.enabled);
2189
+ // `enabled` defaults to `true`; only an explicit `false` keeps the store
2190
+ // inert. An unset/`undefined` input is treated as enabled.
2191
+ const isEnabled = () => enabled() !== false;
2192
+ this.#bridgeSelectors();
2193
+ this.#store.start();
2194
+ // Synthesized error/loading reconcile the core store's internal state with
2195
+ // configuration-level conditions (no runtime URL, unavailable endpoints),
2196
+ // mirroring react-core's useThreads.
2197
+ const runtimeUrl = this.#copilotkit.runtimeUrl;
2198
+ const runtimeStatus = this.#copilotkit.runtimeConnectionStatus;
2199
+ // Read `threadEndpoints`/`intelligence.wsUrl` through the CopilotKit
2200
+ // signals (not plain `core.*` getters) so the computeds/effect re-run when
2201
+ // `/info` populates them — even if it lands without a connection-status
2202
+ // transition. This mirrors react-core, which lists both in its effect deps.
2203
+ const threadEndpoints = this.#copilotkit.threadEndpoints;
2204
+ const threadListSupported = () => threadEndpoints()?.list !== false;
2205
+ const threadMutationsSupported = () => threadEndpoints()?.mutations !== false;
2206
+ const threadEndpointsUnavailable = () => !!runtimeUrl() &&
2207
+ runtimeStatus() === CopilotKitCoreRuntimeConnectionStatus.Connected &&
2208
+ !threadListSupported();
2209
+ const runtimeError = () => runtimeUrl() ? null : new Error("Runtime URL is not configured");
2210
+ const endpointsError = () => threadEndpointsUnavailable()
2211
+ ? new Error("Thread endpoints are not available on this CopilotKit runtime")
2212
+ : null;
2213
+ const mutationsError = () => threadMutationsSupported()
2214
+ ? null
2215
+ : new Error("Thread mutations are not available on this CopilotKit runtime");
2216
+ const preConnectLoading = () => isEnabled() &&
2217
+ !!runtimeUrl() &&
2218
+ !threadEndpointsUnavailable() &&
2219
+ !this.#hasDispatchedContext();
2220
+ // Synthesized error/loading combine configuration-level conditions with
2221
+ // the core store's own state; expressed as pure derived signals.
2222
+ this.error = computed(() => runtimeError() ?? endpointsError() ?? this.#storeError(), ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
2223
+ // listError exposes only genuine fetch/mutation errors, excluding the
2224
+ // dev/config errors (missing runtime URL, runtime without thread
2225
+ // endpoints). Use this for user-facing error display so dev strings are
2226
+ // never shown to end users.
2227
+ this.listError = computed(() => this.#storeError(), ...(ngDevMode ? [{ debugName: "listError" }] : /* istanbul ignore next */ []));
2228
+ this.isLoading = computed(() => runtimeError() || endpointsError()
2229
+ ? false
2230
+ : preConnectLoading() || this.#storeIsLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
2231
+ // Register/unregister this store with core for the active agent so core can
2232
+ // route realtime/agent-driven thread updates to it. Re-runs when the agent
2233
+ // id changes; the previous registration is cleared first.
2234
+ let registeredAgentId;
2235
+ effect(() => {
2236
+ const nextAgentId = agentId();
2237
+ const enabled = isEnabled();
2238
+ untracked(() => {
2239
+ // Disabled (e.g. unlicensed): ensure this store is NOT registered. The
2240
+ // registry is single-slot/last-writer-wins, so an inert store claiming
2241
+ // the agentId slot would evict — and on destroy tear down — a co-mounted
2242
+ // live store for the same agent. Mirrors react-core's use-threads gate.
2243
+ if (!enabled) {
2244
+ if (registeredAgentId !== undefined) {
2245
+ this.#copilotkit.core.unregisterThreadStore(registeredAgentId);
2246
+ registeredAgentId = undefined;
2247
+ }
2248
+ return;
2249
+ }
2250
+ if (registeredAgentId === nextAgentId) {
2251
+ return;
2252
+ }
2253
+ if (registeredAgentId !== undefined) {
2254
+ this.#copilotkit.core.unregisterThreadStore(registeredAgentId);
2255
+ }
2256
+ this.#copilotkit.core.registerThreadStore(nextAgentId, this.#store);
2257
+ registeredAgentId = nextAgentId;
2258
+ });
2259
+ });
2260
+ // Sync the runtime context. Defer until the runtime reports Connected so
2261
+ // the initial context carries `intelligence.wsUrl` and avoids a redundant
2262
+ // second list fetch + subscribe round-trip (mirrors react-core).
2263
+ //
2264
+ // The store dispatches `setContext` onto an `asapScheduler` queue, and its
2265
+ // bootstrap effect issues a list fetch for every queued `contextChanged`
2266
+ // whose state is non-null at drain time. So if this effect runs once with
2267
+ // no URL (clearing to `null`) and again once Connected (the real context)
2268
+ // before that queue drains, BOTH queued actions observe the latest
2269
+ // (non-null) state and two identical list fetches fire — the second
2270
+ // clobbering the first response. We therefore dispatch only on a
2271
+ // meaningful change: skip a clear-to-`null` when nothing was ever
2272
+ // dispatched (the store already holds `null`), and skip a re-dispatch of
2273
+ // an unchanged context. This collapses the benign URL→Connected transition
2274
+ // to a single dispatch and matches react-core's dependency-gated effect.
2275
+ let lastDispatchedContext = null;
2276
+ effect(() => {
2277
+ // Track every reactive input the dispatched context depends on, so the
2278
+ // effect re-runs when any of them changes — including `wsUrl`, which
2279
+ // arrives with `/info` and (via the dedup signature below) triggers a
2280
+ // single re-dispatch carrying the realtime URL.
2281
+ const active = isEnabled();
2282
+ const url = runtimeUrl();
2283
+ const status = runtimeStatus();
2284
+ const headers = this.#copilotkit.headers();
2285
+ const id = agentId();
2286
+ const archived = includeArchived();
2287
+ const pageLimit = limit();
2288
+ const listSupported = threadListSupported();
2289
+ const wsUrl = this.#copilotkit.intelligence()?.wsUrl;
2290
+ untracked(() => {
2291
+ const clearContext = () => {
2292
+ if (this.#hasDispatchedContext()) {
2293
+ this.#store.setContext(null);
2294
+ }
2295
+ lastDispatchedContext = null;
2296
+ this.#hasDispatchedContext.set(false);
2297
+ };
2298
+ // Disabled: stay inert. Clear any previously-dispatched context so an
2299
+ // in-flight subscription is torn down and no further fetch is issued.
2300
+ if (!active) {
2301
+ clearContext();
2302
+ return;
2303
+ }
2304
+ if (!url) {
2305
+ clearContext();
2306
+ return;
2307
+ }
2308
+ if (status !== CopilotKitCoreRuntimeConnectionStatus.Connected) {
2309
+ return;
2310
+ }
2311
+ if (!listSupported) {
2312
+ clearContext();
2313
+ return;
2314
+ }
2315
+ const context = {
2316
+ runtimeUrl: url,
2317
+ headers: { ...headers },
2318
+ wsUrl,
2319
+ agentId: id,
2320
+ includeArchived: archived,
2321
+ limit: pageLimit,
2322
+ };
2323
+ // Build the dedup signature with header entries sorted, so a
2324
+ // same-content header map with a different key order does not trigger
2325
+ // a redundant setContext (and the refetch + resubscribe it causes).
2326
+ // Mirrors react-core's `headersKey`. The dispatched context keeps its
2327
+ // original header order; only the signature is normalized.
2328
+ const signature = JSON.stringify({
2329
+ ...context,
2330
+ headers: Object.entries(headers).sort(([left], [right]) => left.localeCompare(right)),
2331
+ });
2332
+ if (signature === lastDispatchedContext) {
2333
+ return;
2334
+ }
2335
+ lastDispatchedContext = signature;
2336
+ this.#store.setContext(context);
2337
+ this.#hasDispatchedContext.set(true);
2338
+ });
2339
+ });
2340
+ this.renameThread = this.#guardMutation(mutationsError, (threadId, name) => this.#store.renameThread(threadId, name));
2341
+ this.archiveThread = this.#guardMutation(mutationsError, (threadId) => this.#store.archiveThread(threadId));
2342
+ this.unarchiveThread = this.#guardMutation(mutationsError, (threadId) => this.#store.unarchiveThread(threadId));
2343
+ this.deleteThread = this.#guardMutation(mutationsError, (threadId, _name) => this.#store.deleteThread(threadId));
2344
+ destroyRef.onDestroy(() => {
2345
+ this.teardown();
2346
+ if (registeredAgentId !== undefined) {
2347
+ this.#copilotkit.core.unregisterThreadStore(registeredAgentId);
2348
+ registeredAgentId = undefined;
2349
+ }
2350
+ });
2351
+ }
2352
+ renameThread;
2353
+ archiveThread;
2354
+ unarchiveThread;
2355
+ deleteThread;
2356
+ // Arrow-bound instance fields (not prototype methods) so they keep working
2357
+ // when destructured off the result — matching the mutation members above and
2358
+ // react-core's standalone callbacks.
2359
+ fetchMoreThreads = () => {
2360
+ this.#store.fetchNextPage();
2361
+ };
2362
+ refetchThreads = () => {
2363
+ this.#store.refetchThreads();
2364
+ };
2365
+ startNewThread = () => {
2366
+ this.#store.startNewThread();
2367
+ };
2368
+ /** Unsubscribes all selector bridges and stops the underlying core store. */
2369
+ teardown() {
2370
+ for (const subscription of this.#subscriptions) {
2371
+ subscription.unsubscribe();
2372
+ }
2373
+ this.#subscriptions.length = 0;
2374
+ this.#store.stop();
2375
+ }
2376
+ /**
2377
+ * Subscribes each core selector to its mirroring writable signal. The
2378
+ * `select` operator emits the current value synchronously on subscribe, so
2379
+ * the signals are seeded immediately and stay current thereafter.
2380
+ */
2381
+ #bridgeSelectors() {
2382
+ this.#subscriptions.push(this.#store.select(_selectThreads).subscribe((threads) => {
2383
+ this.#threads.set(threads.map(projectThread));
2384
+ }), this.#store.select(_selectThreadsIsLoading).subscribe((value) => {
2385
+ this.#storeIsLoading.set(value);
2386
+ }), this.#store.select(_selectThreadsError).subscribe((value) => {
2387
+ this.#storeError.set(value);
2388
+ }), this.#store.select(_selectFetchMoreError).subscribe((value) => {
2389
+ this.#fetchMoreError.set(value);
2390
+ }), this.#store.select(_selectHasNextPage).subscribe((value) => {
2391
+ this.#hasMoreThreads.set(value);
2392
+ }), this.#store.select(_selectIsFetchingNextPage).subscribe((value) => {
2393
+ this.#isFetchingMoreThreads.set(value);
2394
+ }), this.#store.select(_selectIsMutating).subscribe((value) => {
2395
+ this.#isMutating.set(value);
2396
+ }));
2397
+ }
2398
+ /**
2399
+ * Wraps a mutation so that, when thread mutations are unavailable on the
2400
+ * connected runtime, the call rejects with a descriptive error instead of
2401
+ * issuing a request doomed to fail.
2402
+ */
2403
+ #guardMutation(mutationsError, mutation) {
2404
+ return (threadId, name = "") => {
2405
+ const error = mutationsError();
2406
+ if (error) {
2407
+ return Promise.reject(error);
2408
+ }
2409
+ return mutation(threadId, name);
2410
+ };
2411
+ }
2412
+ }
2413
+ /**
2414
+ * Factory for {@link ThreadsStore} instances. Provided at the root so the
2415
+ * ambient {@link CopilotKit} configuration is resolved from the application's
2416
+ * injector.
2417
+ */
2418
+ class CopilotkitThreadsFactory {
2419
+ /**
2420
+ * Creates a {@link ThreadsStore} bound to the given input and host
2421
+ * `DestroyRef`.
2422
+ *
2423
+ * @param input - Agent identifier and optional list controls.
2424
+ * @param destroyRef - Host lifetime; tears the store down on destroy.
2425
+ */
2426
+ create(input, destroyRef) {
2427
+ return new ThreadsStore(input, destroyRef);
2428
+ }
2429
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotkitThreadsFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2430
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotkitThreadsFactory, providedIn: "root" });
2431
+ }
2432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotkitThreadsFactory, decorators: [{
2433
+ type: Injectable,
2434
+ args: [{ providedIn: "root" }]
2435
+ }] });
2436
+ /**
2437
+ * Angular threads-list API over the platform-agnostic core thread store —
2438
+ * the signal-based counterpart to react-core's `useThreads`.
2439
+ *
2440
+ * On creation the store fetches the thread list for the runtime-authenticated
2441
+ * user and the given `agentId`. When the Intelligence platform exposes a
2442
+ * WebSocket URL it also opens a realtime subscription so the `threads` signal
2443
+ * stays current without polling. Mutation methods return promises that resolve
2444
+ * once the platform confirms the operation and reject with an `Error` on
2445
+ * failure.
2446
+ *
2447
+ * Must be called within an injection context (component/directive constructor
2448
+ * or field initializer). The underlying store is torn down on the host's
2449
+ * `DestroyRef`.
2450
+ *
2451
+ * @param input - Agent identifier and optional list controls. Each field
2452
+ * accepts a plain value or a `Signal`.
2453
+ * @returns Thread list state as signals plus stable mutation callbacks.
2454
+ *
2455
+ * @example
2456
+ * ```ts
2457
+ * @Component({ ... })
2458
+ * class ThreadList {
2459
+ * readonly threads = injectThreads({ agentId: "agent-1" });
2460
+ * }
2461
+ * ```
2462
+ */
2463
+ function injectThreads(input) {
2464
+ const factory = inject(CopilotkitThreadsFactory);
2465
+ const destroyRef = inject(DestroyRef);
2466
+ return factory.create(input, destroyRef);
2467
+ }
2468
+
2083
2469
  // Default labels constant
2084
2470
  const COPILOT_CHAT_DEFAULT_LABELS = {
2085
2471
  chatInputPlaceholder: "Type a message...",
@@ -2115,6 +2501,219 @@ function provideCopilotChatLabels(config) {
2115
2501
  };
2116
2502
  }
2117
2503
 
2504
+ /**
2505
+ * Angular service that holds the runtime chat configuration state.
2506
+ *
2507
+ * Active-thread resolution mirrors the React
2508
+ * `CopilotChatConfigurationProvider` precedence (prop → override → minted)
2509
+ * without parent-provider branches (PR1 has no nested providers).
2510
+ */
2511
+ class CopilotChatConfiguration {
2512
+ #options = inject(COPILOT_CHAT_CONFIGURATION_OPTIONS);
2513
+ /** Imperative override set by internal runtime helpers (e.g. thread-switch). */
2514
+ #override = signal(null, ...(ngDevMode ? [{ debugName: "#override" }] : /* istanbul ignore next */ []));
2515
+ /**
2516
+ * Auto-minted UUID used when neither a prop-driven nor an imperative
2517
+ * override thread id is present. Generated once per service instance.
2518
+ */
2519
+ #mintedFallback = randomUUID();
2520
+ /**
2521
+ * Whether the host application is driving `threadId` authoritatively.
2522
+ * A prop-driven `threadId` without an explicit `hasExplicitThreadId: false`
2523
+ * override locks the session to that value and prevents imperative overrides.
2524
+ */
2525
+ #propIsAuthoritative = this.#options.threadId !== undefined &&
2526
+ this.#options.hasExplicitThreadId !== false;
2527
+ /**
2528
+ * The resolved agent id for this chat session.
2529
+ * Falls back to {@link DEFAULT_AGENT_ID} when no agent id is provided.
2530
+ */
2531
+ agentId = computed(() => this.#options.agentId ?? DEFAULT_AGENT_ID, ...(ngDevMode ? [{ debugName: "agentId" }] : /* istanbul ignore next */ []));
2532
+ /**
2533
+ * The resolved thread id for this chat session.
2534
+ *
2535
+ * Precedence (highest → lowest):
2536
+ * 1. Prop-driven `threadId` when `#propIsAuthoritative` is true.
2537
+ * 2. Imperative `#override` set by internal helpers.
2538
+ * 3. Non-authoritative seed `threadId` from options.
2539
+ * 4. Auto-minted UUID fallback.
2540
+ */
2541
+ threadId = computed(() => {
2542
+ if (this.#propIsAuthoritative) {
2543
+ return this.#options.threadId;
2544
+ }
2545
+ const o = this.#override();
2546
+ if (o) {
2547
+ return o.threadId;
2548
+ }
2549
+ if (this.#options.threadId) {
2550
+ return this.#options.threadId;
2551
+ }
2552
+ return this.#mintedFallback;
2553
+ }, ...(ngDevMode ? [{ debugName: "threadId" }] : /* istanbul ignore next */ []));
2554
+ /**
2555
+ * Whether the current thread id was supplied explicitly by the host
2556
+ * application (as opposed to being auto-minted or seeded without intent).
2557
+ */
2558
+ hasExplicitThreadId = computed(() => {
2559
+ if (this.#propIsAuthoritative) {
2560
+ return true;
2561
+ }
2562
+ return (this.#override()?.explicit ?? this.#options.hasExplicitThreadId ?? false);
2563
+ }, ...(ngDevMode ? [{ debugName: "hasExplicitThreadId" }] : /* istanbul ignore next */ []));
2564
+ /** Returns `true` when the host application controls the thread id via props. */
2565
+ get isControlled() {
2566
+ return this.#propIsAuthoritative;
2567
+ }
2568
+ /**
2569
+ * Sets an imperative thread override. No-ops when the session is
2570
+ * controlled by the host application via props.
2571
+ *
2572
+ * @param threadId - The thread id to activate.
2573
+ * @param explicit - Whether the override represents a deliberate user choice.
2574
+ */
2575
+ _setOverride(threadId, explicit) {
2576
+ if (this.isControlled) {
2577
+ return;
2578
+ }
2579
+ this.#override.set({ threadId, explicit });
2580
+ }
2581
+ /**
2582
+ * Switches the active thread to the given id.
2583
+ *
2584
+ * By default the switch is treated as an explicit user-driven choice
2585
+ * (`explicit` defaults to `true`). Pass `{ explicit: false }` to mark it as
2586
+ * a non-explicit seed that the runtime may replace.
2587
+ *
2588
+ * No-ops when the threadId is controlled by the host application via props.
2589
+ *
2590
+ * @param threadId - The thread id to activate.
2591
+ * @param options - Optional overrides; `explicit` defaults to `true`.
2592
+ */
2593
+ setActiveThreadId(threadId, options) {
2594
+ this._setOverride(threadId, options?.explicit ?? true);
2595
+ }
2596
+ /**
2597
+ * Abandons the current thread and starts a fresh one by minting a new UUID.
2598
+ *
2599
+ * The new thread is marked as non-explicit so the runtime may assign a
2600
+ * server-side thread id once the first message is sent.
2601
+ *
2602
+ * No-ops when the threadId is controlled by the host application via props.
2603
+ */
2604
+ startNewThread() {
2605
+ this._setOverride(randomUUID(), false);
2606
+ }
2607
+ // ─── Drawer open-state coordination ──────────────────────────────────────
2608
+ // Consumed by CopilotThreadsDrawer to drive the element's controlled `open`
2609
+ // property and to announce drawer presence (so a future header launcher can
2610
+ // render). A future popup/sidebar can additionally use these for mobile
2611
+ // mutual-exclusion between the drawer and other overlays.
2612
+ /** Tracks whether the drawer open-state is currently `true`. */
2613
+ #drawerOpen = signal(false, ...(ngDevMode ? [{ debugName: "#drawerOpen" }] : /* istanbul ignore next */ []));
2614
+ /** Count of registered drawer instances. Used to derive {@link drawerRegistered}. */
2615
+ #drawerCount = signal(0, ...(ngDevMode ? [{ debugName: "#drawerCount" }] : /* istanbul ignore next */ []));
2616
+ /**
2617
+ * Read-only signal reflecting the current drawer open-state.
2618
+ *
2619
+ * @remarks
2620
+ * Consumed by {@link CopilotThreadsDrawer} to drive the element's controlled
2621
+ * `open` property; a future popup or sidebar component may also toggle it to
2622
+ * implement mobile mutual-exclusion between the drawer and other overlays.
2623
+ */
2624
+ drawerOpen = this.#drawerOpen.asReadonly();
2625
+ /**
2626
+ * Sets the drawer open-state imperatively.
2627
+ *
2628
+ * @remarks
2629
+ * Called by {@link CopilotThreadsDrawer} in response to the element's
2630
+ * `open-change` event to keep the shared open-state coordinated.
2631
+ *
2632
+ * @param open - `true` to mark the drawer as open, `false` to close it.
2633
+ */
2634
+ setDrawerOpen(open) {
2635
+ this.#drawerOpen.set(open);
2636
+ }
2637
+ /**
2638
+ * Computed signal that is `true` when at least one drawer instance has
2639
+ * registered itself via {@link registerDrawer}.
2640
+ */
2641
+ drawerRegistered = computed(() => this.#drawerCount() > 0, ...(ngDevMode ? [{ debugName: "drawerRegistered" }] : /* istanbul ignore next */ []));
2642
+ /**
2643
+ * Registers a drawer instance and returns an idempotent unregister function.
2644
+ *
2645
+ * Increments the internal drawer count so that {@link drawerRegistered}
2646
+ * becomes `true`. The returned function decrements the count when called;
2647
+ * calling it more than once is safe — subsequent calls are no-ops (guarded
2648
+ * by an `active` flag, floor at 0).
2649
+ *
2650
+ * @remarks
2651
+ * Called by {@link CopilotThreadsDrawer} on construction with cleanup on
2652
+ * destroy. Intended for future popup/sidebar coordination as well.
2653
+ *
2654
+ * @returns An idempotent cleanup function that unregisters this drawer.
2655
+ */
2656
+ registerDrawer() {
2657
+ this.#drawerCount.update((n) => n + 1);
2658
+ let active = true;
2659
+ return () => {
2660
+ if (!active)
2661
+ return;
2662
+ active = false;
2663
+ this.#drawerCount.update((n) => Math.max(0, n - 1));
2664
+ };
2665
+ }
2666
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotChatConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2667
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotChatConfiguration });
2668
+ }
2669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotChatConfiguration, decorators: [{
2670
+ type: Injectable
2671
+ }] });
2672
+ /**
2673
+ * Injection token for the {@link CopilotChatConfiguration} service instance.
2674
+ * Use {@link injectChatConfiguration} to retrieve it from the injector.
2675
+ */
2676
+ const COPILOT_CHAT_CONFIGURATION = new InjectionToken("COPILOT_CHAT_CONFIGURATION");
2677
+ /**
2678
+ * Injection token for the raw {@link CopilotChatConfigurationOptions} value
2679
+ * supplied to {@link provideCopilotChatConfiguration}.
2680
+ */
2681
+ const COPILOT_CHAT_CONFIGURATION_OPTIONS = new InjectionToken("COPILOT_CHAT_CONFIGURATION_OPTIONS");
2682
+ /**
2683
+ * Registers the {@link CopilotChatConfiguration} service and its options into
2684
+ * the current injector.
2685
+ *
2686
+ * `CopilotChatConfiguration` is registered as the canonical class provider.
2687
+ * `COPILOT_CHAT_CONFIGURATION` is aliased to the same instance via
2688
+ * `useExisting`, so both `inject(COPILOT_CHAT_CONFIGURATION)` (via
2689
+ * {@link injectChatConfiguration}) and a direct `inject(CopilotChatConfiguration)`
2690
+ * resolve to the **same object** with shared signal state.
2691
+ *
2692
+ * @param options - Optional chat configuration overrides.
2693
+ * @returns An array of Angular providers to pass to `providers` or
2694
+ * `TestBed.configureTestingModule`.
2695
+ */
2696
+ function provideCopilotChatConfiguration(options = {}) {
2697
+ return [
2698
+ { provide: COPILOT_CHAT_CONFIGURATION_OPTIONS, useValue: options },
2699
+ CopilotChatConfiguration,
2700
+ {
2701
+ provide: COPILOT_CHAT_CONFIGURATION,
2702
+ useExisting: CopilotChatConfiguration,
2703
+ },
2704
+ ];
2705
+ }
2706
+ /**
2707
+ * Retrieves the {@link CopilotChatConfiguration} service from the current
2708
+ * injection context.
2709
+ *
2710
+ * Must be called inside an injection context (component constructor, factory
2711
+ * function, or `TestBed.runInInjectionContext`).
2712
+ */
2713
+ function injectChatConfiguration() {
2714
+ return inject(COPILOT_CHAT_CONFIGURATION);
2715
+ }
2716
+
2118
2717
  class ChatState {
2119
2718
  attachments = signal([], ...(ngDevMode ? [{ debugName: "attachments" }] : /* istanbul ignore next */ []));
2120
2719
  attachmentsEnabled = signal(false, ...(ngDevMode ? [{ debugName: "attachmentsEnabled" }] : /* istanbul ignore next */ []));
@@ -2560,6 +3159,72 @@ function connectAgentContext(context, config) {
2560
3159
  });
2561
3160
  }
2562
3161
 
3162
+ /**
3163
+ * Angular injection function for listing and managing platform memories — the
3164
+ * signal-based counterpart to react-core's `useMemories`.
3165
+ *
3166
+ * Reads the user-scoped memory store owned and wired by `CopilotKitCore`. The
3167
+ * binding does not create, register, start, or stop the store: core owns its
3168
+ * lifecycle and opens its own `user_meta:memories:<joinCode>` channel, applying
3169
+ * `memory_metadata` deltas to the list. The binding only bridges the store's
3170
+ * selectors onto Angular signals and forwards the stable mutation callbacks.
3171
+ *
3172
+ * Mutations are server-authoritative: each resolves once the platform confirms
3173
+ * the operation and rejects with an `Error` on failure. You can still call
3174
+ * `refresh()` to re-pull the REST snapshot on demand.
3175
+ *
3176
+ * Must be called inside an injection context (component constructor, field
3177
+ * initializer, `inject` callback, or `TestBed.runInInjectionContext`) so the
3178
+ * selector→signal bridges (`toSignal`) tear down with the host.
3179
+ *
3180
+ * @returns Signals for memory state and stable mutation callbacks.
3181
+ *
3182
+ * @example
3183
+ * ```ts
3184
+ * import { injectMemories } from "@copilotkit/angular";
3185
+ *
3186
+ * @Component({ ... })
3187
+ * class MemoryList {
3188
+ * readonly #m = injectMemories();
3189
+ * memories = this.#m.memories;
3190
+ * isLoading = this.#m.isLoading;
3191
+ * isAvailable = this.#m.isAvailable;
3192
+ *
3193
+ * remove(id: string) { this.#m.removeMemory(id); }
3194
+ * }
3195
+ * ```
3196
+ */
3197
+ function injectMemories() {
3198
+ const store = inject(CopilotKit).core.getMemoryStore();
3199
+ const initialState = store.getState();
3200
+ const memories = toSignal(store.select(_selectMemories), {
3201
+ initialValue: _selectMemories(initialState),
3202
+ });
3203
+ const isLoading = toSignal(store.select(_selectMemoriesIsLoading), {
3204
+ initialValue: _selectMemoriesIsLoading(initialState),
3205
+ });
3206
+ const error = toSignal(store.select(_selectMemoriesError), {
3207
+ initialValue: _selectMemoriesError(initialState),
3208
+ });
3209
+ const isAvailable = toSignal(store.select(_selectMemoriesAvailable), {
3210
+ initialValue: _selectMemoriesAvailable(initialState),
3211
+ });
3212
+ const realtimeStatus = toSignal(store.select(_selectMemoriesRealtimeStatus), {
3213
+ initialValue: _selectMemoriesRealtimeStatus(initialState),
3214
+ });
3215
+ return {
3216
+ memories,
3217
+ isLoading,
3218
+ error,
3219
+ isAvailable,
3220
+ realtimeStatus,
3221
+ refresh: () => store.refresh(),
3222
+ addMemory: (input) => store.addMemory(input),
3223
+ updateMemory: (id, changes) => store.updateMemory(id, changes),
3224
+ removeMemory: (id) => store.removeMemory(id),
3225
+ };
3226
+ }
3227
+
2563
3228
  /**
2564
3229
  * Injection token for slot configuration
2565
3230
  */
@@ -5987,7 +6652,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
5987
6652
  }]
5988
6653
  }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }] } });
5989
6654
 
5990
- const suggestionViewClass = cn("cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:sm:px-0", "cpk:pointer-events-none");
6655
+ const suggestionViewClass = cn("cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:sm:gap-2 cpk:pl-0 cpk:pr-4 cpk:@3xl:px-0", "cpk:pointer-events-none");
5991
6656
  class CopilotChatSuggestionView {
5992
6657
  suggestions = input([], ...(ngDevMode ? [{ debugName: "suggestions" }] : /* istanbul ignore next */ []));
5993
6658
  inputClass = input(...(ngDevMode ? [undefined, { debugName: "inputClass" }] : /* istanbul ignore next */ []));
@@ -6175,7 +6840,7 @@ class CopilotChatViewScrollView {
6175
6840
  };
6176
6841
  }
6177
6842
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotChatViewScrollView, deps: [], target: i0.ɵɵFactoryTarget.Component });
6178
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: CopilotChatViewScrollView, isStandalone: true, selector: "copilot-chat-view-scroll-view", inputs: { autoScroll: { classPropertyName: "autoScroll", publicName: "autoScroll", isSignal: true, isRequired: false, transformFunction: null }, inputContainerHeight: { classPropertyName: "inputContainerHeight", publicName: "inputContainerHeight", isSignal: true, isRequired: false, transformFunction: null }, isResizing: { classPropertyName: "isResizing", publicName: "isResizing", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, agentId: { classPropertyName: "agentId", publicName: "agentId", isSignal: true, isRequired: false, transformFunction: null }, messageView: { classPropertyName: "messageView", publicName: "messageView", isSignal: true, isRequired: false, transformFunction: null }, messageViewClass: { classPropertyName: "messageViewClass", publicName: "messageViewClass", isSignal: true, isRequired: false, transformFunction: null }, showCursor: { classPropertyName: "showCursor", publicName: "showCursor", isSignal: true, isRequired: false, transformFunction: null }, scrollToBottomButton: { classPropertyName: "scrollToBottomButton", publicName: "scrollToBottomButton", isSignal: true, isRequired: false, transformFunction: null }, scrollToBottomButtonClass: { classPropertyName: "scrollToBottomButtonClass", publicName: "scrollToBottomButtonClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { assistantMessageThumbsUp: "assistantMessageThumbsUp", assistantMessageThumbsDown: "assistantMessageThumbsDown", assistantMessageReadAloud: "assistantMessageReadAloud", assistantMessageRegenerate: "assistantMessageRegenerate", userMessageCopy: "userMessageCopy", userMessageEdit: "userMessageEdit" }, host: { classAttribute: "cpk:block cpk:flex-1 cpk:min-h-0" }, providers: [ScrollPosition], viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, read: ElementRef }, { propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, read: ElementRef }, { propertyName: "stickToBottomDirective", first: true, predicate: StickToBottom, descendants: true }], ngImport: i0, template: "<ng-template #scrollContent>\n <div [style.padding-bottom.px]=\"paddingBottom()\">\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n @if (messageView()) {\n <copilot-slot\n [slot]=\"messageView()\"\n [context]=\"messageViewContext()\"\n [defaultComponent]=\"defaultMessageViewComponent\"\n >\n </copilot-slot>\n } @else {\n <copilot-chat-message-view\n [messages]=\"messages()\"\n [agentId]=\"agentId()\"\n [inputClass]=\"messageViewClass()\"\n [showCursor]=\"showCursor()\"\n (assistantMessageThumbsUp)=\"assistantMessageThumbsUp.emit($event)\"\n (assistantMessageThumbsDown)=\"assistantMessageThumbsDown.emit($event)\"\n (assistantMessageReadAloud)=\"assistantMessageReadAloud.emit($event)\"\n (assistantMessageRegenerate)=\"assistantMessageRegenerate.emit($event)\"\n (userMessageCopy)=\"userMessageCopy.emit($event)\"\n (userMessageEdit)=\"userMessageEdit.emit($event)\"\n >\n </copilot-chat-message-view>\n } @if (hasSuggestions()) {\n <div class=\"cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:mt-4\">\n <copilot-chat-suggestion-view\n [suggestions]=\"chatState?.suggestions?.() ?? []\"\n inputClass=\"cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0\"\n (selectSuggestion)=\"\n chatState?.selectSuggestion($event.suggestion, $event.index)\n \"\n />\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n@if (!hasMounted()) {\n<!-- SSR/Initial render without stick-to-bottom -->\n<div\n class=\"cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n>\n <div class=\"cpk:px-4 cpk:sm:px-0\">\n <ng-content></ng-content>\n </div>\n</div>\n} @else {\n<div\n class=\"cpk:h-[calc(100vh-9rem)] cpk:flex cpk:flex-col cpk:min-h-0 cpk:relative\"\n>\n @if (autoScroll()) {\n <!-- Auto-scroll mode with StickToBottom directive -->\n <div\n #scrollContainer\n cdkScrollable\n copilotStickToBottom\n [enabled]=\"autoScroll()\"\n [threshold]=\"10\"\n [debounceMs]=\"0\"\n [initialBehavior]=\"'smooth'\"\n [resizeBehavior]=\"'smooth'\"\n (isAtBottomChange)=\"onIsAtBottomChange($event)\"\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <!-- Scrollable content wrapper -->\n <div class=\"cpk:px-4 cpk:sm:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @else {\n <!-- Manual scroll mode -->\n <div\n #scrollContainer\n cdkScrollable\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <div #contentContainer class=\"cpk:px-4 cpk:sm:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @if ((autoScroll() ? !isAtBottom() : showScrollButton()) && !isResizing()) {\n <div\n class=\"cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30\"\n [style.bottom.px]=\"inputContainerHeight() + 16\"\n >\n <copilot-slot\n [slot]=\"scrollToBottomButton()\"\n [context]=\"\n autoScroll()\n ? scrollToBottomFromStickContext()\n : scrollToBottomContext()\n \"\n [defaultComponent]=\"defaultScrollToBottomButtonComponent\"\n [outputs]=\"\n autoScroll() ? scrollToBottomFromStickOutputs : scrollToBottomOutputs\n \"\n >\n </copilot-slot>\n </div>\n }\n</div>\n}\n", dependencies: [{ kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CopilotSlot, selector: "copilot-slot", inputs: ["slot", "context", "defaultComponent", "outputs"] }, { kind: "component", type: CopilotChatMessageView, selector: "copilot-chat-message-view", inputs: ["messages", "showCursor", "isLoading", "inputClass", "agentId", "assistantMessageComponent", "assistantMessageTemplate", "assistantMessageClass", "userMessageComponent", "userMessageTemplate", "userMessageClass", "cursorComponent", "cursorTemplate", "cursorClass"], outputs: ["assistantMessageThumbsUp", "assistantMessageThumbsDown", "assistantMessageReadAloud", "assistantMessageRegenerate", "userMessageCopy", "userMessageEdit"] }, { kind: "component", type: CopilotChatSuggestionView, selector: "copilot-chat-suggestion-view", inputs: ["suggestions", "inputClass"], outputs: ["selectSuggestion"] }, { kind: "directive", type: StickToBottom, selector: "[copilotStickToBottom]", inputs: ["enabled", "threshold", "initialBehavior", "resizeBehavior", "debounceMs"], outputs: ["isAtBottomChange", "scrollToBottomRequested"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6843
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: CopilotChatViewScrollView, isStandalone: true, selector: "copilot-chat-view-scroll-view", inputs: { autoScroll: { classPropertyName: "autoScroll", publicName: "autoScroll", isSignal: true, isRequired: false, transformFunction: null }, inputContainerHeight: { classPropertyName: "inputContainerHeight", publicName: "inputContainerHeight", isSignal: true, isRequired: false, transformFunction: null }, isResizing: { classPropertyName: "isResizing", publicName: "isResizing", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, agentId: { classPropertyName: "agentId", publicName: "agentId", isSignal: true, isRequired: false, transformFunction: null }, messageView: { classPropertyName: "messageView", publicName: "messageView", isSignal: true, isRequired: false, transformFunction: null }, messageViewClass: { classPropertyName: "messageViewClass", publicName: "messageViewClass", isSignal: true, isRequired: false, transformFunction: null }, showCursor: { classPropertyName: "showCursor", publicName: "showCursor", isSignal: true, isRequired: false, transformFunction: null }, scrollToBottomButton: { classPropertyName: "scrollToBottomButton", publicName: "scrollToBottomButton", isSignal: true, isRequired: false, transformFunction: null }, scrollToBottomButtonClass: { classPropertyName: "scrollToBottomButtonClass", publicName: "scrollToBottomButtonClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { assistantMessageThumbsUp: "assistantMessageThumbsUp", assistantMessageThumbsDown: "assistantMessageThumbsDown", assistantMessageReadAloud: "assistantMessageReadAloud", assistantMessageRegenerate: "assistantMessageRegenerate", userMessageCopy: "userMessageCopy", userMessageEdit: "userMessageEdit" }, host: { classAttribute: "cpk:block cpk:flex-1 cpk:min-h-0" }, providers: [ScrollPosition], viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, read: ElementRef }, { propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, read: ElementRef }, { propertyName: "stickToBottomDirective", first: true, predicate: StickToBottom, descendants: true }], ngImport: i0, template: "<ng-template #scrollContent>\n <div [style.padding-bottom.px]=\"paddingBottom()\">\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n @if (messageView()) {\n <copilot-slot\n [slot]=\"messageView()\"\n [context]=\"messageViewContext()\"\n [defaultComponent]=\"defaultMessageViewComponent\"\n >\n </copilot-slot>\n } @else {\n <copilot-chat-message-view\n [messages]=\"messages()\"\n [agentId]=\"agentId()\"\n [inputClass]=\"messageViewClass()\"\n [showCursor]=\"showCursor()\"\n (assistantMessageThumbsUp)=\"assistantMessageThumbsUp.emit($event)\"\n (assistantMessageThumbsDown)=\"assistantMessageThumbsDown.emit($event)\"\n (assistantMessageReadAloud)=\"assistantMessageReadAloud.emit($event)\"\n (assistantMessageRegenerate)=\"assistantMessageRegenerate.emit($event)\"\n (userMessageCopy)=\"userMessageCopy.emit($event)\"\n (userMessageEdit)=\"userMessageEdit.emit($event)\"\n >\n </copilot-chat-message-view>\n } @if (hasSuggestions()) {\n <div class=\"cpk:pl-0 cpk:pr-4 cpk:@3xl:px-0 cpk:mt-4\">\n <copilot-chat-suggestion-view\n [suggestions]=\"chatState?.suggestions?.() ?? []\"\n inputClass=\"cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0\"\n (selectSuggestion)=\"\n chatState?.selectSuggestion($event.suggestion, $event.index)\n \"\n />\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n@if (!hasMounted()) {\n<!-- SSR/Initial render without stick-to-bottom -->\n<div\n class=\"cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n>\n <div class=\"cpk:px-4 cpk:@3xl:px-0\">\n <ng-content></ng-content>\n </div>\n</div>\n} @else {\n<div\n class=\"cpk:h-[calc(100vh-9rem)] cpk:flex cpk:flex-col cpk:min-h-0 cpk:relative\"\n>\n @if (autoScroll()) {\n <!-- Auto-scroll mode with StickToBottom directive -->\n <div\n #scrollContainer\n cdkScrollable\n copilotStickToBottom\n [enabled]=\"autoScroll()\"\n [threshold]=\"10\"\n [debounceMs]=\"0\"\n [initialBehavior]=\"'smooth'\"\n [resizeBehavior]=\"'smooth'\"\n (isAtBottomChange)=\"onIsAtBottomChange($event)\"\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <!-- Scrollable content wrapper -->\n <div class=\"cpk:px-4 cpk:@3xl:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @else {\n <!-- Manual scroll mode -->\n <div\n #scrollContainer\n cdkScrollable\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <div #contentContainer class=\"cpk:px-4 cpk:@3xl:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @if ((autoScroll() ? !isAtBottom() : showScrollButton()) && !isResizing()) {\n <div\n class=\"cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30\"\n [style.bottom.px]=\"inputContainerHeight() + 16\"\n >\n <copilot-slot\n [slot]=\"scrollToBottomButton()\"\n [context]=\"\n autoScroll()\n ? scrollToBottomFromStickContext()\n : scrollToBottomContext()\n \"\n [defaultComponent]=\"defaultScrollToBottomButtonComponent\"\n [outputs]=\"\n autoScroll() ? scrollToBottomFromStickOutputs : scrollToBottomOutputs\n \"\n >\n </copilot-slot>\n </div>\n }\n</div>\n}\n", dependencies: [{ kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CopilotSlot, selector: "copilot-slot", inputs: ["slot", "context", "defaultComponent", "outputs"] }, { kind: "component", type: CopilotChatMessageView, selector: "copilot-chat-message-view", inputs: ["messages", "showCursor", "isLoading", "inputClass", "agentId", "assistantMessageComponent", "assistantMessageTemplate", "assistantMessageClass", "userMessageComponent", "userMessageTemplate", "userMessageClass", "cursorComponent", "cursorTemplate", "cursorClass"], outputs: ["assistantMessageThumbsUp", "assistantMessageThumbsDown", "assistantMessageReadAloud", "assistantMessageRegenerate", "userMessageCopy", "userMessageEdit"] }, { kind: "component", type: CopilotChatSuggestionView, selector: "copilot-chat-suggestion-view", inputs: ["suggestions", "inputClass"], outputs: ["selectSuggestion"] }, { kind: "directive", type: StickToBottom, selector: "[copilotStickToBottom]", inputs: ["enabled", "threshold", "initialBehavior", "resizeBehavior", "debounceMs"], outputs: ["isAtBottomChange", "scrollToBottomRequested"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6179
6844
  }
6180
6845
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotChatViewScrollView, decorators: [{
6181
6846
  type: Component,
@@ -6186,7 +6851,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
6186
6851
  CopilotChatMessageView,
6187
6852
  CopilotChatSuggestionView,
6188
6853
  StickToBottom,
6189
- ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [ScrollPosition], template: "<ng-template #scrollContent>\n <div [style.padding-bottom.px]=\"paddingBottom()\">\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n @if (messageView()) {\n <copilot-slot\n [slot]=\"messageView()\"\n [context]=\"messageViewContext()\"\n [defaultComponent]=\"defaultMessageViewComponent\"\n >\n </copilot-slot>\n } @else {\n <copilot-chat-message-view\n [messages]=\"messages()\"\n [agentId]=\"agentId()\"\n [inputClass]=\"messageViewClass()\"\n [showCursor]=\"showCursor()\"\n (assistantMessageThumbsUp)=\"assistantMessageThumbsUp.emit($event)\"\n (assistantMessageThumbsDown)=\"assistantMessageThumbsDown.emit($event)\"\n (assistantMessageReadAloud)=\"assistantMessageReadAloud.emit($event)\"\n (assistantMessageRegenerate)=\"assistantMessageRegenerate.emit($event)\"\n (userMessageCopy)=\"userMessageCopy.emit($event)\"\n (userMessageEdit)=\"userMessageEdit.emit($event)\"\n >\n </copilot-chat-message-view>\n } @if (hasSuggestions()) {\n <div class=\"cpk:pl-0 cpk:pr-4 cpk:sm:px-0 cpk:mt-4\">\n <copilot-chat-suggestion-view\n [suggestions]=\"chatState?.suggestions?.() ?? []\"\n inputClass=\"cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0\"\n (selectSuggestion)=\"\n chatState?.selectSuggestion($event.suggestion, $event.index)\n \"\n />\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n@if (!hasMounted()) {\n<!-- SSR/Initial render without stick-to-bottom -->\n<div\n class=\"cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n>\n <div class=\"cpk:px-4 cpk:sm:px-0\">\n <ng-content></ng-content>\n </div>\n</div>\n} @else {\n<div\n class=\"cpk:h-[calc(100vh-9rem)] cpk:flex cpk:flex-col cpk:min-h-0 cpk:relative\"\n>\n @if (autoScroll()) {\n <!-- Auto-scroll mode with StickToBottom directive -->\n <div\n #scrollContainer\n cdkScrollable\n copilotStickToBottom\n [enabled]=\"autoScroll()\"\n [threshold]=\"10\"\n [debounceMs]=\"0\"\n [initialBehavior]=\"'smooth'\"\n [resizeBehavior]=\"'smooth'\"\n (isAtBottomChange)=\"onIsAtBottomChange($event)\"\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <!-- Scrollable content wrapper -->\n <div class=\"cpk:px-4 cpk:sm:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @else {\n <!-- Manual scroll mode -->\n <div\n #scrollContainer\n cdkScrollable\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <div #contentContainer class=\"cpk:px-4 cpk:sm:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @if ((autoScroll() ? !isAtBottom() : showScrollButton()) && !isResizing()) {\n <div\n class=\"cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30\"\n [style.bottom.px]=\"inputContainerHeight() + 16\"\n >\n <copilot-slot\n [slot]=\"scrollToBottomButton()\"\n [context]=\"\n autoScroll()\n ? scrollToBottomFromStickContext()\n : scrollToBottomContext()\n \"\n [defaultComponent]=\"defaultScrollToBottomButtonComponent\"\n [outputs]=\"\n autoScroll() ? scrollToBottomFromStickOutputs : scrollToBottomOutputs\n \"\n >\n </copilot-slot>\n </div>\n }\n</div>\n}\n" }]
6854
+ ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [ScrollPosition], template: "<ng-template #scrollContent>\n <div [style.padding-bottom.px]=\"paddingBottom()\">\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n @if (messageView()) {\n <copilot-slot\n [slot]=\"messageView()\"\n [context]=\"messageViewContext()\"\n [defaultComponent]=\"defaultMessageViewComponent\"\n >\n </copilot-slot>\n } @else {\n <copilot-chat-message-view\n [messages]=\"messages()\"\n [agentId]=\"agentId()\"\n [inputClass]=\"messageViewClass()\"\n [showCursor]=\"showCursor()\"\n (assistantMessageThumbsUp)=\"assistantMessageThumbsUp.emit($event)\"\n (assistantMessageThumbsDown)=\"assistantMessageThumbsDown.emit($event)\"\n (assistantMessageReadAloud)=\"assistantMessageReadAloud.emit($event)\"\n (assistantMessageRegenerate)=\"assistantMessageRegenerate.emit($event)\"\n (userMessageCopy)=\"userMessageCopy.emit($event)\"\n (userMessageEdit)=\"userMessageEdit.emit($event)\"\n >\n </copilot-chat-message-view>\n } @if (hasSuggestions()) {\n <div class=\"cpk:pl-0 cpk:pr-4 cpk:@3xl:px-0 cpk:mt-4\">\n <copilot-chat-suggestion-view\n [suggestions]=\"chatState?.suggestions?.() ?? []\"\n inputClass=\"cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0\"\n (selectSuggestion)=\"\n chatState?.selectSuggestion($event.suggestion, $event.index)\n \"\n />\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n@if (!hasMounted()) {\n<!-- SSR/Initial render without stick-to-bottom -->\n<div\n class=\"cpk:h-full cpk:max-h-full cpk:flex cpk:flex-col cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n>\n <div class=\"cpk:px-4 cpk:@3xl:px-0\">\n <ng-content></ng-content>\n </div>\n</div>\n} @else {\n<div\n class=\"cpk:h-[calc(100vh-9rem)] cpk:flex cpk:flex-col cpk:min-h-0 cpk:relative\"\n>\n @if (autoScroll()) {\n <!-- Auto-scroll mode with StickToBottom directive -->\n <div\n #scrollContainer\n cdkScrollable\n copilotStickToBottom\n [enabled]=\"autoScroll()\"\n [threshold]=\"10\"\n [debounceMs]=\"0\"\n [initialBehavior]=\"'smooth'\"\n [resizeBehavior]=\"'smooth'\"\n (isAtBottomChange)=\"onIsAtBottomChange($event)\"\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <!-- Scrollable content wrapper -->\n <div class=\"cpk:px-4 cpk:@3xl:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @else {\n <!-- Manual scroll mode -->\n <div\n #scrollContainer\n cdkScrollable\n [class]=\"computedClass()\"\n class=\"cpk:flex-1 cpk:min-h-0 cpk:overflow-y-auto cpk:overflow-x-hidden\"\n >\n <div #contentContainer class=\"cpk:px-4 cpk:@3xl:px-0\">\n <!-- Content with padding-bottom matching React -->\n <ng-container [ngTemplateOutlet]=\"scrollContent\"></ng-container>\n </div>\n </div>\n } @if ((autoScroll() ? !isAtBottom() : showScrollButton()) && !isResizing()) {\n <div\n class=\"cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30\"\n [style.bottom.px]=\"inputContainerHeight() + 16\"\n >\n <copilot-slot\n [slot]=\"scrollToBottomButton()\"\n [context]=\"\n autoScroll()\n ? scrollToBottomFromStickContext()\n : scrollToBottomContext()\n \"\n [defaultComponent]=\"defaultScrollToBottomButtonComponent\"\n [outputs]=\"\n autoScroll() ? scrollToBottomFromStickOutputs : scrollToBottomOutputs\n \"\n >\n </copilot-slot>\n </div>\n }\n</div>\n}\n" }]
6190
6855
  }], propDecorators: { autoScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoScroll", required: false }] }], inputContainerHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputContainerHeight", required: false }] }], isResizing: [{ type: i0.Input, args: [{ isSignal: true, alias: "isResizing", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], agentId: [{ type: i0.Input, args: [{ isSignal: true, alias: "agentId", required: false }] }], messageView: [{ type: i0.Input, args: [{ isSignal: true, alias: "messageView", required: false }] }], messageViewClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "messageViewClass", required: false }] }], showCursor: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCursor", required: false }] }], scrollToBottomButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollToBottomButton", required: false }] }], scrollToBottomButtonClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollToBottomButtonClass", required: false }] }], assistantMessageThumbsUp: [{ type: i0.Output, args: ["assistantMessageThumbsUp"] }], assistantMessageThumbsDown: [{ type: i0.Output, args: ["assistantMessageThumbsDown"] }], assistantMessageReadAloud: [{ type: i0.Output, args: ["assistantMessageReadAloud"] }], assistantMessageRegenerate: [{ type: i0.Output, args: ["assistantMessageRegenerate"] }], userMessageCopy: [{ type: i0.Output, args: ["userMessageCopy"] }], userMessageEdit: [{ type: i0.Output, args: ["userMessageEdit"] }], scrollContainer: [{
6191
6856
  type: ViewChild,
6192
6857
  args: ["scrollContainer", { read: ElementRef }]
@@ -7376,6 +8041,11 @@ class CopilotChatInput {
7376
8041
  }
7377
8042
  }
7378
8043
  handleKeyDown(event) {
8044
+ // Skip key handling during IME composition (e.g. CJK input).
8045
+ // The compositionend event will fire separately when composition ends.
8046
+ if (event.isComposing || event.keyCode === 229) {
8047
+ return;
8048
+ }
7379
8049
  if (event.key === "Enter" && !event.shiftKey) {
7380
8050
  event.preventDefault();
7381
8051
  this.send();
@@ -8137,7 +8807,7 @@ class CopilotChatViewInputContainer extends ElementRef {
8137
8807
  </div>
8138
8808
  }
8139
8809
 
8140
- <div class="cpk:max-w-3xl cpk:mx-auto cpk:py-0 cpk:px-4 cpk:sm:px-0">
8810
+ <div class="cpk:max-w-3xl cpk:mx-auto cpk:py-0 cpk:px-4 cpk:@3xl:px-0">
8141
8811
  <copilot-slot
8142
8812
  [slot]="input()"
8143
8813
  [context]="{ inputClass: inputClass() }"
@@ -8182,7 +8852,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
8182
8852
  </div>
8183
8853
  }
8184
8854
 
8185
- <div class="cpk:max-w-3xl cpk:mx-auto cpk:py-0 cpk:px-4 cpk:sm:px-0">
8855
+ <div class="cpk:max-w-3xl cpk:mx-auto cpk:py-0 cpk:px-4 cpk:@3xl:px-0">
8186
8856
  <copilot-slot
8187
8857
  [slot]="input()"
8188
8858
  [context]="{ inputClass: inputClass() }"
@@ -8296,7 +8966,7 @@ class CopilotChatView {
8296
8966
  isResizing = signal(false, ...(ngDevMode ? [{ debugName: "isResizing" }] : /* istanbul ignore next */ []));
8297
8967
  shouldShowWelcomeScreen = computed(() => this.messagesValue().length === 0 && !this.hasExplicitThreadId(), ...(ngDevMode ? [{ debugName: "shouldShowWelcomeScreen" }] : /* istanbul ignore next */ []));
8298
8968
  // Computed signals
8299
- computedClass = computed(() => cn("copilotKitChat cpk:relative cpk:h-full cpk:flex cpk:flex-col"), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
8969
+ computedClass = computed(() => cn("copilotKitChat cpk:@container cpk:relative cpk:h-full cpk:flex cpk:flex-col"), ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
8300
8970
  dropOverlayClass = computed(() => cn("cpk:absolute cpk:inset-0 cpk:z-50 cpk:pointer-events-none", "cpk:flex cpk:items-center cpk:justify-center", "cpk:bg-primary/5 cpk:backdrop-blur-[2px]", "cpk:border-2 cpk:border-dashed cpk:border-primary/40 cpk:rounded-lg cpk:m-2"), ...(ngDevMode ? [{ debugName: "dropOverlayClass" }] : /* istanbul ignore next */ []));
8301
8971
  // Slot resolution computed signals
8302
8972
  messageViewSlot = computed(() => this.messageViewTemplate() || this.messageViewComponent(), ...(ngDevMode ? [{ debugName: "messageViewSlot" }] : /* istanbul ignore next */ []));
@@ -8981,6 +9651,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
8981
9651
  args: ["document:paste", ["$event"]]
8982
9652
  }] } });
8983
9653
 
9654
+ /**
9655
+ * Wires the active chat thread to the live agent.
9656
+ *
9657
+ * Reactively observes the resolved thread id (and whether it was chosen
9658
+ * explicitly) from {@link CopilotChatConfiguration} and the current agent from
9659
+ * the agent-store signal. On every change it pins the thread onto
9660
+ * `agent.threadId`, then:
9661
+ *
9662
+ * - **Explicit switch** (user picked a thread): connects the agent to that
9663
+ * thread via {@link ConnectAgentFn}, owning the loading-cursor + abort +
9664
+ * detach lifecycle of the standalone `<copilot-chat>` `connectToAgent` path.
9665
+ * (Connect-error *logging* is the one intentional divergence — see below.)
9666
+ * Before connecting it installs a per-run `AbortController` on the
9667
+ * agent (only when the agent is an {@link HttpAgent}) and calls
9668
+ * {@link ConnectActiveThreadCursorHooks.onConnectStart}. When that connect
9669
+ * settles it calls {@link ConnectActiveThreadCursorHooks.onConnectSettle} —
9670
+ * but only if the run was not superseded (the `detached` staleness guard), so
9671
+ * a stale connect cannot clear the cursor out from under a newer one. The
9672
+ * connect's promise is caught before its `finally` so a rejecting connect
9673
+ * never produces an unhandled rejection. Connect errors surface via the
9674
+ * AgentStore's run/error subscription and are intentionally NOT re-logged here
9675
+ * — the deliberate divergence from `connectToAgent`, which additionally
9676
+ * `console.error`s unexpected (non-`AGUIConnectNotImplementedError`) failures.
9677
+ * On the next effect re-run
9678
+ * (thread/agent switch) and on destroy, the cleanup aborts the in-flight
9679
+ * request via the per-run controller AND detaches the run via
9680
+ * `agent.detachActiveRun()`, mirroring the standalone teardown so a rapid
9681
+ * switch or component destroy does not leak a prior run.
9682
+ * - **Fresh / non-explicit switch** (e.g. {@link CopilotChatConfiguration.startNewThread}):
9683
+ * clears the agent's messages via `agent.setMessages([])` and skips the
9684
+ * connect — the runtime assigns the server thread id on first send. The clear
9685
+ * fires only on an actual transition to a *new* fresh thread id, never on the
9686
+ * initial mount nor on an agent-store swap that leaves the thread id unchanged
9687
+ * (which would otherwise wipe a resumed/shared agent's existing history).
9688
+ *
9689
+ * Tracked reads happen in the effect's reactive scope; all mutation and the
9690
+ * connect call run inside `untracked()` so they do not register as
9691
+ * dependencies (mirrors the effect/untracked idiom in `threads.ts`).
9692
+ *
9693
+ * @param config - The chat configuration exposing the resolved thread signals.
9694
+ * @param agentStore - Signal yielding the current {@link AgentStore}.
9695
+ * @param connectAgent - The raw `CopilotKitCore.connectAgent` implementation.
9696
+ * @param hooks - Optional loading-cursor hooks driven around the explicit connect.
9697
+ */
9698
+ function connectActiveThread(config, agentStore, connectAgent, hooks) {
9699
+ // Tracks the thread id observed on the previous effect run so the
9700
+ // non-explicit branch can distinguish a genuine new-thread transition from
9701
+ // the initial mount (`undefined`) or an agent-store swap that left the thread
9702
+ // unchanged. Clearing only on a real transition prevents wiping a
9703
+ // resumed/shared agent's existing message history.
9704
+ let lastThreadId;
9705
+ effect((onCleanup) => {
9706
+ const threadId = config.threadId();
9707
+ const explicit = config.hasExplicitThreadId();
9708
+ const store = agentStore();
9709
+ untracked(() => {
9710
+ const agent = store.agent;
9711
+ agent.threadId = threadId;
9712
+ if (explicit) {
9713
+ // Mirror the standalone `connectToAgent` cursor/abort/detach lifecycle:
9714
+ // a per-run staleness flag, a per-run AbortController installed on
9715
+ // HttpAgents, cursor-on, a single caught connect chain, and an
9716
+ // abort+detach cleanup. (Connect-error logging is intentionally omitted
9717
+ // here — errors surface via the AgentStore run/error subscription.)
9718
+ let detached = false;
9719
+ const abortController = new AbortController();
9720
+ if (agent instanceof HttpAgent) {
9721
+ agent.abortController = abortController;
9722
+ }
9723
+ hooks?.onConnectStart?.();
9724
+ const result = connectAgent({ agent });
9725
+ Promise.resolve(result)
9726
+ .catch(() => {
9727
+ // connect errors surface via the AgentStore's run/error
9728
+ // subscription, not here.
9729
+ })
9730
+ .finally(() => {
9731
+ if (!detached)
9732
+ hooks?.onConnectSettle?.();
9733
+ });
9734
+ // Mirror the standalone `<copilot-chat>` teardown: mark the run stale,
9735
+ // abort the in-flight request, and detach the run for the agent
9736
+ // connected this run. Fires on the next effect re-run (thread/agent
9737
+ // switch) and on destroy so a prior run does not leak.
9738
+ onCleanup(() => {
9739
+ detached = true;
9740
+ abortController.abort();
9741
+ agent.detachActiveRun().catch(() => { });
9742
+ });
9743
+ }
9744
+ else if (lastThreadId !== undefined && threadId !== lastThreadId) {
9745
+ // Real switch to a new fresh thread; not mount and not a same-thread swap.
9746
+ agent.setMessages([]);
9747
+ }
9748
+ lastThreadId = threadId;
9749
+ });
9750
+ });
9751
+ }
9752
+
8984
9753
  /**
8985
9754
  * CopilotChat component - Angular equivalent of React's <CopilotChat>
8986
9755
  * Provides a complete chat interface that wires an agent to the chat view
@@ -8997,16 +9766,25 @@ class CopilotChat extends ChatState {
8997
9766
  threadId = input(...(ngDevMode ? [undefined, { debugName: "threadId" }] : /* istanbul ignore next */ []));
8998
9767
  inputComponent = input(...(ngDevMode ? [undefined, { debugName: "inputComponent" }] : /* istanbul ignore next */ []));
8999
9768
  attachmentsConfig = input(undefined, { ...(ngDevMode ? { debugName: "attachmentsConfig" } : /* istanbul ignore next */ {}), alias: "attachments" });
9000
- resolvedAgentId = computed(() => this.agentId() ?? DEFAULT_AGENT_ID, ...(ngDevMode ? [{ debugName: "resolvedAgentId" }] : /* istanbul ignore next */ []));
9769
+ /**
9770
+ * Ambient chat configuration, when a {@link provideCopilotChatConfiguration}
9771
+ * provider is in scope. Absent (`null`) for standalone
9772
+ * `<copilot-chat [threadId]>` usage, which has no provider — resolved via the
9773
+ * optional inject so the component does not throw without one.
9774
+ */
9775
+ config = inject(COPILOT_CHAT_CONFIGURATION, {
9776
+ optional: true,
9777
+ });
9778
+ resolvedAgentId = computed(() => this.agentId() ?? this.config?.agentId() ?? DEFAULT_AGENT_ID, ...(ngDevMode ? [{ debugName: "resolvedAgentId" }] : /* istanbul ignore next */ []));
9001
9779
  agentStore = injectAgentStore(this.resolvedAgentId);
9002
9780
  copilotKit = inject(CopilotKit);
9003
- // readonly chatConfig = injectChatConfig();
9004
9781
  cdr = inject(ChangeDetectorRef);
9005
9782
  injector = inject(Injector);
9006
9783
  destroyRef = inject(DestroyRef);
9007
9784
  messages = computed(() => this.agentStore().messages(), ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
9008
9785
  isRunning = computed(() => this.agentStore().isRunning(), ...(ngDevMode ? [{ debugName: "isRunning" }] : /* istanbul ignore next */ []));
9009
- hasExplicitThreadId = computed(() => Boolean(this.threadId()), ...(ngDevMode ? [{ debugName: "hasExplicitThreadId" }] : /* istanbul ignore next */ []));
9786
+ hasExplicitThreadId = this.config?.hasExplicitThreadId ??
9787
+ computed(() => Boolean(this.threadId()));
9010
9788
  agentRef = computed(() => this.agentStore().agent, ...(ngDevMode ? [{ debugName: "agentRef" }] : /* istanbul ignore next */ []));
9011
9789
  resolvedThreadId = computed(() => this.threadId() || this.generatedThreadId, ...(ngDevMode ? [{ debugName: "resolvedThreadId" }] : /* istanbul ignore next */ []));
9012
9790
  attachmentsEnabled = computed(() => this.attachmentsConfig()?.enabled ?? false, ...(ngDevMode ? [{ debugName: "attachmentsEnabled" }] : /* istanbul ignore next */ []));
@@ -9056,24 +9834,61 @@ class CopilotChat extends ChatState {
9056
9834
  this.syncSuggestionsFromCore(agentId);
9057
9835
  this.copilotKit.reloadSuggestions(agentId);
9058
9836
  });
9059
- effect((onCleanup) => {
9060
- const agent = this.agentRef();
9061
- const threadId = this.resolvedThreadId();
9062
- agent.threadId = threadId;
9063
- if (!this.hasExplicitThreadId())
9064
- return;
9065
- let detached = false;
9066
- const abortController = new AbortController();
9067
- if (agent instanceof HttpAgent) {
9068
- agent.abortController = abortController;
9069
- }
9070
- void this.connectToAgent(agent, () => detached);
9071
- onCleanup(() => {
9072
- detached = true;
9073
- abortController.abort();
9074
- void agent.detachActiveRun().catch(() => { });
9837
+ if (this.config) {
9838
+ // A set `[threadId]` input seeds the ambient config so the input
9839
+ // actually drives the active thread (not just the welcome flag). When
9840
+ // the config is controlled by a host-provided `threadId` option,
9841
+ // `setActiveThreadId` no-ops — so a controlled config wins over the
9842
+ // input, matching React's prop-precedence. When `[threadId]` is unset,
9843
+ // the effect does nothing and the config drives as before.
9844
+ effect(() => {
9845
+ const inputThreadId = this.threadId();
9846
+ if (inputThreadId) {
9847
+ this.config.setActiveThreadId(inputThreadId, { explicit: true });
9848
+ }
9075
9849
  });
9076
- });
9850
+ // Ambient configuration drives the active thread: the connector pins
9851
+ // `agent.threadId` from the config's resolved thread signal and connects
9852
+ // on explicit switches (or clears messages on a fresh thread).
9853
+ //
9854
+ // The connector receives the RAW `core.connectAgent` and owns the loading
9855
+ // cursor + abort + detach lifecycle, matching the standalone
9856
+ // `connectToAgent` path exactly: cursor on at connect start, off when the
9857
+ // connect settles (guarded against a superseded run). Connect errors still
9858
+ // surface via the AgentStore's run/error subscription, not here.
9859
+ connectActiveThread(this.config, this.agentStore, (params) => this.copilotKit.core.connectAgent(params), {
9860
+ onConnectStart: () => {
9861
+ this.showCursor.set(true);
9862
+ this.cdr.markForCheck();
9863
+ },
9864
+ onConnectSettle: () => {
9865
+ this.showCursor.set(false);
9866
+ this.cdr.markForCheck();
9867
+ },
9868
+ });
9869
+ }
9870
+ else {
9871
+ // Standalone `<copilot-chat [threadId]>` usage with no configuration
9872
+ // provider: the active thread is input-driven exactly as before.
9873
+ effect((onCleanup) => {
9874
+ const agent = this.agentRef();
9875
+ const threadId = this.resolvedThreadId();
9876
+ agent.threadId = threadId;
9877
+ if (!this.hasExplicitThreadId())
9878
+ return;
9879
+ let detached = false;
9880
+ const abortController = new AbortController();
9881
+ if (agent instanceof HttpAgent) {
9882
+ agent.abortController = abortController;
9883
+ }
9884
+ void this.connectToAgent(agent, () => detached);
9885
+ onCleanup(() => {
9886
+ detached = true;
9887
+ abortController.abort();
9888
+ void agent.detachActiveRun().catch(() => { });
9889
+ });
9890
+ });
9891
+ }
9077
9892
  }
9078
9893
  async connectToAgent(agent, isDetached) {
9079
9894
  this.showCursor.set(true);
@@ -9294,9 +10109,573 @@ class CopilotChatInputDefaults {
9294
10109
  static ToolsMenu = CopilotChatToolsMenu;
9295
10110
  }
9296
10111
 
10112
+ /**
10113
+ * Maps a {@link Thread} from the platform store onto the minimal
10114
+ * {@link DrawerThread} shape the `<copilotkit-threads-drawer>` element accepts.
10115
+ *
10116
+ * `lastRunAt` is spread conditionally so the key is absent (rather than
10117
+ * `undefined`) when the source thread has never been run — matching the
10118
+ * element's optional typing and avoiding spurious property pollution.
10119
+ */
10120
+ function toDrawerThread(thread) {
10121
+ return {
10122
+ id: thread.id,
10123
+ name: thread.name,
10124
+ archived: thread.archived,
10125
+ createdAt: thread.createdAt,
10126
+ updatedAt: thread.updatedAt,
10127
+ ...(thread.lastRunAt !== undefined ? { lastRunAt: thread.lastRunAt } : {}),
10128
+ };
10129
+ }
10130
+ /**
10131
+ * The Angular chat view container's element selector. Used to scope the
10132
+ * focus-return lookup so a multi-chat page focuses THIS drawer's composer.
10133
+ */
10134
+ const CHAT_CONTAINER_SELECTOR = "copilot-chat-view";
10135
+ /**
10136
+ * The Angular chat input's element selector (`<textarea copilotChatTextarea>`).
10137
+ * Note: this is the Angular chat input, NOT React's `copilot-chat-textarea` or
10138
+ * Vue's `copilot-chat-input-textarea` `data-testid` — the Angular chat
10139
+ * components identify by element/attribute selector rather than `data-testid`.
10140
+ */
10141
+ const CHAT_INPUT_SELECTOR = "textarea[copilotChatTextarea]";
10142
+ /**
10143
+ * Returns the chat input element for focus-return after a thread is selected.
10144
+ *
10145
+ * Best-effort and SCOPED: walks up from the drawer element looking for an
10146
+ * ancestor chat-view container ({@link CHAT_CONTAINER_SELECTOR}), then returns
10147
+ * the chat input ({@link CHAT_INPUT_SELECTOR}) within that subtree. This avoids
10148
+ * focusing the wrong composer on a page hosting more than one chat, where a
10149
+ * document-global lookup would grab whichever input appears first in DOM order.
10150
+ *
10151
+ * Falls back to a document-global lookup when no scoping ancestor is found
10152
+ * (e.g. the drawer and chat share no common container, or headless usage), and
10153
+ * returns `null` when there is no chat input at all. Mirrors the React and Vue
10154
+ * wrappers' `findChatInput`, scoped to the Angular chat selectors.
10155
+ *
10156
+ * @param origin - The drawer element to scope the search from.
10157
+ */
10158
+ function findChatInput(origin) {
10159
+ if (typeof document === "undefined")
10160
+ return null;
10161
+ const container = origin?.closest?.(CHAT_CONTAINER_SELECTOR);
10162
+ if (container) {
10163
+ const scoped = container.querySelector(CHAT_INPUT_SELECTOR);
10164
+ if (scoped)
10165
+ return scoped;
10166
+ }
10167
+ return document.querySelector(CHAT_INPUT_SELECTOR);
10168
+ }
10169
+ /**
10170
+ * Structural directive that captures a per-row template for projection into
10171
+ * the `<copilotkit-threads-drawer>` element as light-DOM children with
10172
+ * `slot="row:{id}"`.
10173
+ *
10174
+ * Apply it to an `<ng-template>` that is a direct child of `<copilot-threads-drawer>`.
10175
+ * The implicit context variable (`let-t`) receives the full {@link Thread}
10176
+ * record for that row.
10177
+ *
10178
+ * @example
10179
+ * ```html
10180
+ * <copilot-threads-drawer>
10181
+ * <ng-template copilotThreadsDrawerRow let-t>
10182
+ * <span>{{ t.name }}</span>
10183
+ * </ng-template>
10184
+ * </copilot-threads-drawer>
10185
+ * ```
10186
+ */
10187
+ class CopilotThreadsDrawerRow {
10188
+ /** The captured template reference for the per-row content. */
10189
+ template = inject(TemplateRef);
10190
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotThreadsDrawerRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
10191
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.15", type: CopilotThreadsDrawerRow, isStandalone: true, selector: "[copilotThreadsDrawerRow]", ngImport: i0 });
10192
+ }
10193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotThreadsDrawerRow, decorators: [{
10194
+ type: Directive,
10195
+ args: [{ selector: "[copilotThreadsDrawerRow]", standalone: true }]
10196
+ }] });
10197
+ /**
10198
+ * Angular wrapper around the `<copilotkit-threads-drawer>` Lit web component.
10199
+ *
10200
+ * Registers the custom element on construction (idempotent; SSR-guarded
10201
+ * internally by {@link defineCopilotKitThreadsDrawer}) and projects it into the DOM
10202
+ * via the `CUSTOM_ELEMENTS_SCHEMA`-enabled template.
10203
+ *
10204
+ * Thread list state is fetched from the Intelligence platform via
10205
+ * {@link injectThreads} and pushed onto the element's JS properties via an
10206
+ * `effect`, following the imperative property-assignment pattern used elsewhere
10207
+ * in this package (see `CopilotA2UIActivityRenderer`).
10208
+ *
10209
+ * DOM events emitted by the element are routed back to the chat configuration
10210
+ * and thread mutation methods via declarative Angular event bindings.
10211
+ *
10212
+ * @example
10213
+ * ```html
10214
+ * <copilot-threads-drawer data-testid="my-drawer" />
10215
+ * ```
10216
+ */
10217
+ class CopilotThreadsDrawer {
10218
+ /**
10219
+ * Optional agent id whose threads this drawer lists/manages. Scopes the
10220
+ * {@link injectThreads} store (via the resolved-agent precedence: this input
10221
+ * → ambient config's `agentId` → {@link DEFAULT_AGENT_ID}). NOT forwarded to
10222
+ * the element (the element has no `agentId` property).
10223
+ */
10224
+ agentId = input(...(ngDevMode ? [undefined, { debugName: "agentId" }] : /* istanbul ignore next */ []));
10225
+ /**
10226
+ * Value applied as the `data-testid` attribute on the inner
10227
+ * `<copilotkit-threads-drawer>` element. Defaults to `"copilot-threads-drawer"`.
10228
+ */
10229
+ dataTestId = input("copilot-threads-drawer", { ...(ngDevMode ? { debugName: "dataTestId" } : /* istanbul ignore next */ {}), alias: "data-testid" });
10230
+ /**
10231
+ * Optional accessible/region + default-header label forwarded to the element's
10232
+ * `label` property; defaults to the element's own `"Threads"` when unset.
10233
+ */
10234
+ label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
10235
+ /**
10236
+ * Optional heading for the "Recent Conversations" section, forwarded to the
10237
+ * element's `recent-label` attribute; defaults to the element's own
10238
+ * `"Recent Conversations"` when unset.
10239
+ */
10240
+ recentLabel = input(...(ngDevMode ? [undefined, { debugName: "recentLabel" }] : /* istanbul ignore next */ []));
10241
+ /**
10242
+ * Whether the drawer offers a collapse toggle. Pushed onto the element's
10243
+ * `collapsible` PROPERTY (a default-true boolean, exactly like `licensed` — a
10244
+ * string attribute cannot represent it since any non-empty value is truthy).
10245
+ * When `false`, the drawer has no collapse toggle and is always expanded.
10246
+ * Defaults to the element's own `true` when unset.
10247
+ */
10248
+ collapsible = input(...(ngDevMode ? [undefined, { debugName: "collapsible" }] : /* istanbul ignore next */ []));
10249
+ /**
10250
+ * Emits the new collapsed state whenever the drawer's collapsed state changes
10251
+ * (mirrors the element's `collapse-change` event).
10252
+ */
10253
+ collapseChange = new EventEmitter();
10254
+ /**
10255
+ * Optional host override for the thread-select action.
10256
+ *
10257
+ * When provided, this callback is invoked instead of driving
10258
+ * `config.setActiveThreadId`. Bound via `[onThreadSelect]="fn"`.
10259
+ */
10260
+ threadSelectHandler = input(undefined, { ...(ngDevMode ? { debugName: "threadSelectHandler" } : /* istanbul ignore next */ {}), alias: "onThreadSelect" });
10261
+ /**
10262
+ * Optional host override for the new-thread action.
10263
+ *
10264
+ * When provided, this callback is invoked instead of driving
10265
+ * `config.startNewThread`. The core `threads.startNewThread()` reset is
10266
+ * always called regardless. Bound via `[onNewThread]="fn"`.
10267
+ */
10268
+ newThreadHandler = input(undefined, { ...(ngDevMode ? { debugName: "newThreadHandler" } : /* istanbul ignore next */ {}), alias: "onNewThread" });
10269
+ /**
10270
+ * Page size for thread pagination. When set, threads load in pages of this
10271
+ * size and the element shows a "Load more" control while more remain. When
10272
+ * unset, the full list loads at once and no pagination control shows.
10273
+ */
10274
+ limit = input(...(ngDevMode ? [undefined, { debugName: "limit" }] : /* istanbul ignore next */ []));
10275
+ /**
10276
+ * Destination the locked view's Upgrade CTA opens in a new tab. Forwarded to
10277
+ * the element's `licenseUrl` property; defaults to the element's built-in
10278
+ * CopilotKit Intelligence docs URL when unset. Set to an empty string to
10279
+ * suppress the default navigation and handle the click via `onLicensed`.
10280
+ */
10281
+ licenseUrl = input(...(ngDevMode ? [undefined, { debugName: "licenseUrl" }] : /* istanbul ignore next */ []));
10282
+ /**
10283
+ * Optional host hook fired when the locked view's Upgrade CTA is clicked. The
10284
+ * element still performs its default navigation unless `licenseUrl` is blank;
10285
+ * use this for telemetry or to drive your own upgrade flow. Bound via
10286
+ * `[onLicensed]="fn"`.
10287
+ */
10288
+ licensedHandler = input(undefined, { ...(ngDevMode ? { debugName: "licensedHandler" } : /* istanbul ignore next */ {}), alias: "onLicensed" });
10289
+ config = inject(COPILOT_CHAT_CONFIGURATION, {
10290
+ optional: true,
10291
+ });
10292
+ copilotkit = inject(CopilotKit);
10293
+ drawerRef = viewChild("drawer", { ...(ngDevMode ? { debugName: "drawerRef" } : /* istanbul ignore next */ {}), read: ElementRef });
10294
+ /**
10295
+ * Optional per-row template directive projected as a direct child of this
10296
+ * component. When present, a `<div slot="row:{id}">` is rendered inside the
10297
+ * `<copilotkit-threads-drawer>` element for each thread, allowing the host to inject
10298
+ * custom light-DOM content into each row slot.
10299
+ */
10300
+ rowDirective = contentChild(CopilotThreadsDrawerRow, ...(ngDevMode ? [{ debugName: "rowDirective" }] : /* istanbul ignore next */ []));
10301
+ /**
10302
+ * The resolved agent id for the threads store. Precedence:
10303
+ * 1. `agentId` input prop.
10304
+ * 2. Ambient `CopilotChatConfiguration.agentId`.
10305
+ * 3. {@link DEFAULT_AGENT_ID}.
10306
+ */
10307
+ resolvedAgentId = computed(() => this.agentId() ?? this.config?.agentId() ?? DEFAULT_AGENT_ID, ...(ngDevMode ? [{ debugName: "resolvedAgentId" }] : /* istanbul ignore next */ []));
10308
+ /**
10309
+ * Normalized license context derived from the core's runtime-reported status,
10310
+ * via the same `@copilotkit/shared` helper the React provider uses.
10311
+ */
10312
+ licenseContext = computed(() => createLicenseContextValue(this.copilotkit.licenseStatus()), ...(ngDevMode ? [{ debugName: "licenseContext" }] : /* istanbul ignore next */ []));
10313
+ /**
10314
+ * Two-pronged license gate, mirroring the React wrapper. `checkFeature` fails
10315
+ * OPEN (returns true) when no license is configured, so it cannot by itself
10316
+ * detect the no-license case; we therefore also require a positive
10317
+ * license-present signal. Only a resolved `valid`/`expiring` status counts as
10318
+ * present — a resolved `none`/`expired`/`invalid` gates the drawer to the
10319
+ * locked view.
10320
+ */
10321
+ licensed = computed(() => {
10322
+ const ctx = this.licenseContext();
10323
+ const licensePresent = ctx.status === "valid" || ctx.status === "expiring";
10324
+ return licensePresent && ctx.checkFeature("threads");
10325
+ }, ...(ngDevMode ? [{ debugName: "licensed" }] : /* istanbul ignore next */ []));
10326
+ /**
10327
+ * Whether the runtime has not yet reported a license status. The status is
10328
+ * `null` until the first `/info` response lands; treat that window as
10329
+ * "not yet unlicensed" — show the loading state, never the locked view — so a
10330
+ * licensed drawer never flashes (or strands) the Upgrade CTA mid-resolution.
10331
+ */
10332
+ licensePending = computed(() => this.licenseContext().status === null, ...(ngDevMode ? [{ debugName: "licensePending" }] : /* istanbul ignore next */ []));
10333
+ /** Live thread list from the Intelligence platform for the resolved agent. */
10334
+ threads = injectThreads({
10335
+ agentId: this.resolvedAgentId,
10336
+ includeArchived: true,
10337
+ limit: this.limit,
10338
+ // While unlicensed, skip the thread fetch entirely: the element shows only
10339
+ // its locked view and no `/threads` request is issued.
10340
+ enabled: this.licensed,
10341
+ });
10342
+ /** Thread records mapped to the element's {@link DrawerThread} shape. */
10343
+ drawerThreads = computed(() => this.threads.threads().map(toDrawerThread), ...(ngDevMode ? [{ debugName: "drawerThreads" }] : /* istanbul ignore next */ []));
10344
+ /**
10345
+ * User-facing error message from the filtered list error signal, or `null`
10346
+ * when there is no error. Uses `listError` (not `error`) so developer/config
10347
+ * errors (missing runtime URL, runtime without thread endpoints) are excluded
10348
+ * and never displayed to end users.
10349
+ */
10350
+ errorMessage = computed(() => this.threads.listError()?.message ?? null, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
10351
+ /**
10352
+ * The currently-active thread id, sourced from the ambient chat
10353
+ * configuration, or `null` when no configuration is present.
10354
+ */
10355
+ activeThreadId = computed(() => this.config?.threadId() ?? null, ...(ngDevMode ? [{ debugName: "activeThreadId" }] : /* istanbul ignore next */ []));
10356
+ /**
10357
+ * User-facing fetch-more error message from the dedicated fetch-more error
10358
+ * signal, or `null`. Drives the element's inline "couldn't load more — retry"
10359
+ * panel without disturbing the loaded list or the initial-list `error`.
10360
+ */
10361
+ fetchMoreErrorMessage = computed(() => this.threads.fetchMoreError()?.message ?? null, ...(ngDevMode ? [{ debugName: "fetchMoreErrorMessage" }] : /* istanbul ignore next */ []));
10362
+ destroyRef = inject(DestroyRef);
10363
+ /**
10364
+ * Provider-less fallback open-state. Without a surrounding chat configuration
10365
+ * there is no shared open-state to bind to, so the wrapper keeps its own
10366
+ * local state. Starts CLOSED — matching the configuration's own default — so
10367
+ * the element does not spring open (and scroll-lock the page on mobile) on
10368
+ * load, and the element's `open-change` events still toggle it.
10369
+ */
10370
+ localDrawerOpen = signal(false, ...(ngDevMode ? [{ debugName: "localDrawerOpen" }] : /* istanbul ignore next */ []));
10371
+ /**
10372
+ * The effective drawer open-state: the ambient chat configuration's
10373
+ * `drawerOpen` when present, else the provider-less {@link localDrawerOpen}.
10374
+ * Pushed onto the element's controlled `open` property in the effect below.
10375
+ */
10376
+ drawerOpen = computed(() => this.config ? this.config.drawerOpen() : this.localDrawerOpen(), ...(ngDevMode ? [{ debugName: "drawerOpen" }] : /* istanbul ignore next */ []));
10377
+ constructor() {
10378
+ defineCopilotKitThreadsDrawer();
10379
+ // Announce drawer presence to the surrounding chat configuration so a
10380
+ // future header launcher can render, and de-register on destroy. Mirrors
10381
+ // the React (`registerDrawer()` effect) and Vue (`onScopeDispose`) wrappers.
10382
+ const unregisterDrawer = this.config?.registerDrawer();
10383
+ if (unregisterDrawer) {
10384
+ this.destroyRef.onDestroy(unregisterDrawer);
10385
+ }
10386
+ // Push signal-derived values onto the element's JS properties every time
10387
+ // any reactive dependency changes. Using an effect (rather than template
10388
+ // bindings) is required because Lit elements accept object/boolean domains
10389
+ // only as JS properties, not as HTML attributes.
10390
+ effect(() => {
10391
+ const el = this.drawerRef()?.nativeElement;
10392
+ if (!el)
10393
+ return;
10394
+ el.threads = this.drawerThreads();
10395
+ // While the license is still resolving, force the loading state so the
10396
+ // element shows its spinner instead of an empty/locked body.
10397
+ el.loading = this.threads.isLoading() || this.licensePending();
10398
+ el.error = this.errorMessage();
10399
+ el.fetchMoreError = this.fetchMoreErrorMessage();
10400
+ el.activeThreadId = this.activeThreadId();
10401
+ el.hasMore = this.threads.hasMoreThreads();
10402
+ el.fetchingMore = this.threads.isFetchingMoreThreads();
10403
+ // Drive the element's controlled `open` from the (config-backed or local)
10404
+ // open-state so the element does not default open=true on load.
10405
+ el.open = this.drawerOpen();
10406
+ // Pending counts as licensed for rendering: the element shows the locked
10407
+ // view only when `licensed` is false, so keeping it true until the status
10408
+ // resolves prevents the locked view from flashing mid-resolution.
10409
+ el.licensed = this.licensed() || this.licensePending();
10410
+ if (this.label() !== undefined)
10411
+ el.label = this.label();
10412
+ const licenseUrl = this.licenseUrl();
10413
+ if (licenseUrl !== undefined)
10414
+ el.licenseUrl = licenseUrl;
10415
+ // `collapsible` is a default-true boolean PROPERTY (like `licensed`);
10416
+ // leave the element's own default in place when the input is unset.
10417
+ const collapsible = this.collapsible();
10418
+ if (collapsible !== undefined) {
10419
+ // TODO(ENT-1051): drop the intersection cast once the published element
10420
+ // type declares `collapsible` (see the local CollapseChangeDetail note).
10421
+ el.collapsible = collapsible;
10422
+ }
10423
+ });
10424
+ }
10425
+ /**
10426
+ * Handles the `thread-selected` event from the drawer element.
10427
+ *
10428
+ * When a `threadSelectHandler` override is provided by the host, it is called
10429
+ * exclusively. Otherwise, the ambient chat configuration is driven directly so
10430
+ * a bare `<copilot-threads-drawer>` works without any host wiring.
10431
+ *
10432
+ * @param event - The raw DOM event; cast to `CustomEvent<ThreadSelectedDetail>` to extract `threadId`.
10433
+ */
10434
+ onThreadSelected(event) {
10435
+ const { threadId } = event.detail;
10436
+ const handler = this.threadSelectHandler();
10437
+ if (handler) {
10438
+ handler(threadId);
10439
+ }
10440
+ else {
10441
+ this.config?.setActiveThreadId(threadId, { explicit: true });
10442
+ }
10443
+ // Return focus to the chat input so keyboard users land in the composer.
10444
+ // Scope the lookup to this drawer's own chat (not document-global). Mirrors
10445
+ // the React (`findChatInput(...).focus()`) and Vue (`focusChatInput()`)
10446
+ // wrappers.
10447
+ findChatInput(this.drawerRef()?.nativeElement ?? null)?.focus();
10448
+ }
10449
+ /**
10450
+ * Handles the `open-change` event from the drawer element.
10451
+ *
10452
+ * Drives the ambient chat configuration's `setDrawerOpen` when present, else
10453
+ * the provider-less {@link localDrawerOpen} fallback — mirroring the React
10454
+ * and Vue wrappers so the element's open-state stays coordinated.
10455
+ *
10456
+ * @param event - The raw DOM event; cast to `CustomEvent<OpenChangeDetail>` to extract `open`.
10457
+ */
10458
+ onOpenChange(event) {
10459
+ const { open } = event.detail;
10460
+ if (this.config) {
10461
+ this.config.setDrawerOpen(open);
10462
+ }
10463
+ else {
10464
+ this.localDrawerOpen.set(open);
10465
+ }
10466
+ }
10467
+ /**
10468
+ * Handles the `new-thread` event from the drawer element.
10469
+ *
10470
+ * Always resets the core thread store to a fresh, non-explicit client-side
10471
+ * thread first. When a `newThreadHandler` override is provided by the host,
10472
+ * it is called exclusively. Otherwise, the ambient chat configuration is
10473
+ * driven directly so a bare `<copilot-threads-drawer>` works without any host wiring.
10474
+ */
10475
+ onNewThread() {
10476
+ this.threads.startNewThread();
10477
+ const handler = this.newThreadHandler();
10478
+ if (handler) {
10479
+ handler();
10480
+ }
10481
+ else {
10482
+ this.config?.startNewThread();
10483
+ }
10484
+ }
10485
+ /**
10486
+ * Handles the `archive` event from the drawer element.
10487
+ *
10488
+ * Delegates to the threads mutation and logs any failure to the console.
10489
+ *
10490
+ * @param event - The raw DOM event; cast to `CustomEvent<ArchiveDetail>` to extract `threadId`.
10491
+ */
10492
+ onArchive(event) {
10493
+ const { threadId } = event.detail;
10494
+ this.threads.archiveThread(threadId).catch((err) => {
10495
+ console.error("CopilotThreadsDrawer: archiveThread failed", err);
10496
+ });
10497
+ }
10498
+ /**
10499
+ * Handles the `unarchive` event from the drawer element.
10500
+ *
10501
+ * Delegates to the threads mutation and logs any failure to the console.
10502
+ *
10503
+ * @param event - The raw DOM event; cast to `CustomEvent<UnarchiveDetail>` to extract `threadId`.
10504
+ */
10505
+ onUnarchive(event) {
10506
+ const { threadId } = event.detail;
10507
+ this.threads.unarchiveThread(threadId).catch((err) => {
10508
+ console.error("CopilotThreadsDrawer: unarchiveThread failed", err);
10509
+ });
10510
+ }
10511
+ /**
10512
+ * Handles the `delete` event from the drawer element.
10513
+ *
10514
+ * Deleting the active thread resets to a fresh, non-explicit thread so the
10515
+ * user is not stranded on a now-gone conversation. Archiving the active
10516
+ * thread keeps the user viewing it.
10517
+ *
10518
+ * The core `threads.startNewThread()` reset is always called when the deleted
10519
+ * thread was active. When a `newThreadHandler` override is provided by the
10520
+ * host, it is called exclusively; otherwise the ambient chat configuration is
10521
+ * driven directly.
10522
+ *
10523
+ * @param event - The raw DOM event; cast to `CustomEvent<DeleteDetail>` to extract `threadId`.
10524
+ */
10525
+ onDelete(event) {
10526
+ const { threadId } = event.detail;
10527
+ const wasActive = threadId === this.activeThreadId();
10528
+ this.threads
10529
+ .deleteThread(threadId)
10530
+ .then(() => {
10531
+ if (wasActive) {
10532
+ this.threads.startNewThread();
10533
+ const handler = this.newThreadHandler();
10534
+ if (handler) {
10535
+ handler();
10536
+ }
10537
+ else {
10538
+ this.config?.startNewThread();
10539
+ }
10540
+ }
10541
+ })
10542
+ .catch((err) => {
10543
+ console.error("CopilotThreadsDrawer: deleteThread failed", err);
10544
+ });
10545
+ }
10546
+ /**
10547
+ * Handles the `filter-change` event from the drawer element.
10548
+ *
10549
+ * The element owns the Active/All filter; on change we refetch so the list
10550
+ * reflects the server.
10551
+ */
10552
+ onFilterChange() {
10553
+ this.threads.refetchThreads();
10554
+ }
10555
+ /**
10556
+ * Handles the `collapse-change` event from the drawer element — re-emits the
10557
+ * new collapsed state through the component's `collapseChange` output so hosts
10558
+ * can observe (or persist) the drawer's collapsed state.
10559
+ *
10560
+ * @param event - The raw DOM event; cast to `CustomEvent<CollapseChangeDetail>` to extract `collapsed`.
10561
+ */
10562
+ onCollapseChange(event) {
10563
+ const { collapsed } = event.detail;
10564
+ this.collapseChange.emit(collapsed);
10565
+ }
10566
+ /**
10567
+ * Handles the `retry` event from the drawer element.
10568
+ *
10569
+ * `scope` distinguishes an initial fetch retry from a fetch-more retry so
10570
+ * the correct pagination operation is invoked.
10571
+ *
10572
+ * @param event - The raw DOM event; cast to `CustomEvent<RetryDetail>` to extract `scope`.
10573
+ */
10574
+ onRetry(event) {
10575
+ const { scope } = event.detail;
10576
+ if (scope === "fetch-more") {
10577
+ this.threads.fetchMoreThreads();
10578
+ }
10579
+ else {
10580
+ this.threads.refetchThreads();
10581
+ }
10582
+ }
10583
+ /**
10584
+ * Handles the `load-more` event from the drawer element — advances pagination
10585
+ * by fetching the next page. No-op when there is no next page (the element
10586
+ * only surfaces the "Load more" control while `hasMoreThreads` is true).
10587
+ */
10588
+ onLoadMore() {
10589
+ this.threads.fetchMoreThreads();
10590
+ }
10591
+ /**
10592
+ * Handles the `licensed` event from the drawer element (Upgrade CTA click).
10593
+ *
10594
+ * The element performs its own default navigation to `licenseUrl`; this hook
10595
+ * lets the host observe the click (e.g. for telemetry) or drive a custom
10596
+ * upgrade flow when provided via `[onLicensed]`.
10597
+ */
10598
+ onLicensed() {
10599
+ this.licensedHandler()?.();
10600
+ }
10601
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotThreadsDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
10602
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: CopilotThreadsDrawer, isStandalone: true, selector: "copilot-threads-drawer", inputs: { agentId: { classPropertyName: "agentId", publicName: "agentId", isSignal: true, isRequired: false, transformFunction: null }, dataTestId: { classPropertyName: "dataTestId", publicName: "data-testid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, recentLabel: { classPropertyName: "recentLabel", publicName: "recentLabel", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, threadSelectHandler: { classPropertyName: "threadSelectHandler", publicName: "onThreadSelect", isSignal: true, isRequired: false, transformFunction: null }, newThreadHandler: { classPropertyName: "newThreadHandler", publicName: "onNewThread", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, licenseUrl: { classPropertyName: "licenseUrl", publicName: "licenseUrl", isSignal: true, isRequired: false, transformFunction: null }, licensedHandler: { classPropertyName: "licensedHandler", publicName: "onLicensed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapseChange: "collapseChange" }, queries: [{ propertyName: "rowDirective", first: true, predicate: CopilotThreadsDrawerRow, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "drawerRef", first: true, predicate: ["drawer"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
10603
+ <copilotkit-threads-drawer
10604
+ #drawer
10605
+ [attr.data-testid]="dataTestId()"
10606
+ [attr.recent-label]="recentLabel() ?? null"
10607
+ (thread-selected)="onThreadSelected($event)"
10608
+ (new-thread)="onNewThread()"
10609
+ (archive)="onArchive($event)"
10610
+ (unarchive)="onUnarchive($event)"
10611
+ (delete)="onDelete($event)"
10612
+ (filter-change)="onFilterChange()"
10613
+ (collapse-change)="onCollapseChange($event)"
10614
+ (retry)="onRetry($event)"
10615
+ (load-more)="onLoadMore()"
10616
+ (open-change)="onOpenChange($event)"
10617
+ (licensed)="onLicensed()"
10618
+ ><ng-content></ng-content>
10619
+ @if (rowDirective(); as row) {
10620
+ @for (t of threads.threads(); track t.id) {
10621
+ <div [attr.slot]="'row:' + t.id">
10622
+ <ng-container
10623
+ [ngTemplateOutlet]="row.template"
10624
+ [ngTemplateOutletContext]="{ $implicit: t }"
10625
+ ></ng-container>
10626
+ </div>
10627
+ }
10628
+ }
10629
+ </copilotkit-threads-drawer>
10630
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10631
+ }
10632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: CopilotThreadsDrawer, decorators: [{
10633
+ type: Component,
10634
+ args: [{
10635
+ selector: "copilot-threads-drawer",
10636
+ standalone: true,
10637
+ changeDetection: ChangeDetectionStrategy.OnPush,
10638
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
10639
+ imports: [NgTemplateOutlet],
10640
+ template: `
10641
+ <copilotkit-threads-drawer
10642
+ #drawer
10643
+ [attr.data-testid]="dataTestId()"
10644
+ [attr.recent-label]="recentLabel() ?? null"
10645
+ (thread-selected)="onThreadSelected($event)"
10646
+ (new-thread)="onNewThread()"
10647
+ (archive)="onArchive($event)"
10648
+ (unarchive)="onUnarchive($event)"
10649
+ (delete)="onDelete($event)"
10650
+ (filter-change)="onFilterChange()"
10651
+ (collapse-change)="onCollapseChange($event)"
10652
+ (retry)="onRetry($event)"
10653
+ (load-more)="onLoadMore()"
10654
+ (open-change)="onOpenChange($event)"
10655
+ (licensed)="onLicensed()"
10656
+ ><ng-content></ng-content>
10657
+ @if (rowDirective(); as row) {
10658
+ @for (t of threads.threads(); track t.id) {
10659
+ <div [attr.slot]="'row:' + t.id">
10660
+ <ng-container
10661
+ [ngTemplateOutlet]="row.template"
10662
+ [ngTemplateOutletContext]="{ $implicit: t }"
10663
+ ></ng-container>
10664
+ </div>
10665
+ }
10666
+ }
10667
+ </copilotkit-threads-drawer>
10668
+ `,
10669
+ }]
10670
+ }], ctorParameters: () => [], propDecorators: { agentId: [{ type: i0.Input, args: [{ isSignal: true, alias: "agentId", required: false }] }], dataTestId: [{ type: i0.Input, args: [{ isSignal: true, alias: "data-testid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], recentLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "recentLabel", required: false }] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], collapseChange: [{
10671
+ type: Output
10672
+ }], threadSelectHandler: [{ type: i0.Input, args: [{ isSignal: true, alias: "onThreadSelect", required: false }] }], newThreadHandler: [{ type: i0.Input, args: [{ isSignal: true, alias: "onNewThread", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }], licenseUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "licenseUrl", required: false }] }], licensedHandler: [{ type: i0.Input, args: [{ isSignal: true, alias: "onLicensed", required: false }] }], drawerRef: [{ type: i0.ViewChild, args: ["drawer", { ...{
10673
+ read: ElementRef,
10674
+ }, isSignal: true }] }], rowDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CopilotThreadsDrawerRow), { isSignal: true }] }] } });
10675
+
9297
10676
  /**
9298
10677
  * Generated bundle index. Do not edit.
9299
10678
  */
9300
10679
 
9301
- export { AGUI_SEND_STATE_SNAPSHOT_TOOL_NAME, AgentStore, AudioRecorderError, COPILOT_CHAT_DEFAULT_LABELS, COPILOT_CHAT_LABELS, COPILOT_KIT_CONFIG, ChatState, CopilotA2UIActivityRenderer, CopilotA2UIProgress, CopilotA2UIToolRenderer, CopilotChat, CopilotChatAddFileButton, CopilotChatAssistantMessage, CopilotChatAssistantMessageCopyButton, CopilotChatAssistantMessageReadAloudButton, CopilotChatAssistantMessageRegenerateButton, CopilotChatAssistantMessageRenderer, CopilotChatAssistantMessageThumbsDownButton, CopilotChatAssistantMessageThumbsUpButton, CopilotChatAssistantMessageToolbar, CopilotChatAssistantMessageToolbarButton, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAttachmentsDirective, CopilotChatAudioRecorder, CopilotChatCancelTranscribeButton, CopilotChatFinishTranscribeButton, CopilotChatInput, CopilotChatInputDefaults, CopilotChatMessageView, CopilotChatMessageViewCursor, CopilotChatReasoningMessage, CopilotChatSendButton, CopilotChatStartTranscribeButton, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatTextarea, CopilotChatToolCallsView, CopilotChatToolbar, CopilotChatToolbarButton, CopilotChatToolsMenu, CopilotChatUserMessage, CopilotChatUserMessageBranchNavigation, CopilotChatUserMessageCopyButton, CopilotChatUserMessageEditButton, CopilotChatUserMessageRenderer, CopilotChatUserMessageToolbar, CopilotChatUserMessageToolbarButton, CopilotChatView, CopilotChatViewDisclaimer, CopilotChatViewFeather, CopilotChatViewHandlers, CopilotChatViewInputContainer, CopilotChatViewScrollToBottomButton, CopilotChatViewScrollView, CopilotKit, CopilotKitAgentContext, CopilotOpenGenerativeUIActivityRenderer, CopilotOpenGenerativeUIRenderer, CopilotOpenGenerativeUIToolRenderer, CopilotSlot, CopilotTooltip, CopilotkitAgentFactory, DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATE_SANDBOXED_UI_TOOL_NAME, GenerateSandboxedUiArgsSchema, OPEN_GENERATIVE_UI_ACTIVITY_TYPE, OPEN_GENERATIVE_UI_WEBSANDBOX_LOADER, OpenGenerativeUIContentSchema, RENDER_A2UI_TOOL_NAME, RenderA2UIArgsSchema, RenderToolCalls, ResizeObserverService, SLOT_CONFIG, ScrollPosition, StickToBottom, TooltipContent, TranscriptionError, anyActivityContentSchema, cn, connectAgentContext, createSlotConfig, createSlotRenderer, getSlotConfig, injectAgentStore, injectChatLabels, injectChatState, injectCopilotKitConfig, isComponentType, isSlotValue, normalizeSlotValue, provideCopilotChatLabels, provideCopilotKit, provideSlots, registerFrontendTool, registerHumanInTheLoop, registerRenderToolCall, renderSlot, transcribeAudio };
10680
+ export { AGUI_SEND_STATE_SNAPSHOT_TOOL_NAME, AgentStore, AudioRecorderError, COPILOT_CHAT_CONFIGURATION, COPILOT_CHAT_CONFIGURATION_OPTIONS, COPILOT_CHAT_DEFAULT_LABELS, COPILOT_CHAT_LABELS, COPILOT_KIT_CONFIG, ChatState, CopilotA2UIActivityRenderer, CopilotA2UIProgress, CopilotA2UIToolRenderer, CopilotChat, CopilotChatAddFileButton, CopilotChatAssistantMessage, CopilotChatAssistantMessageCopyButton, CopilotChatAssistantMessageReadAloudButton, CopilotChatAssistantMessageRegenerateButton, CopilotChatAssistantMessageRenderer, CopilotChatAssistantMessageThumbsDownButton, CopilotChatAssistantMessageThumbsUpButton, CopilotChatAssistantMessageToolbar, CopilotChatAssistantMessageToolbarButton, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAttachmentsDirective, CopilotChatAudioRecorder, CopilotChatCancelTranscribeButton, CopilotChatConfiguration, CopilotChatFinishTranscribeButton, CopilotChatInput, CopilotChatInputDefaults, CopilotChatMessageView, CopilotChatMessageViewCursor, CopilotChatReasoningMessage, CopilotChatSendButton, CopilotChatStartTranscribeButton, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatTextarea, CopilotChatToolCallsView, CopilotChatToolbar, CopilotChatToolbarButton, CopilotChatToolsMenu, CopilotChatUserMessage, CopilotChatUserMessageBranchNavigation, CopilotChatUserMessageCopyButton, CopilotChatUserMessageEditButton, CopilotChatUserMessageRenderer, CopilotChatUserMessageToolbar, CopilotChatUserMessageToolbarButton, CopilotChatView, CopilotChatViewDisclaimer, CopilotChatViewFeather, CopilotChatViewHandlers, CopilotChatViewInputContainer, CopilotChatViewScrollToBottomButton, CopilotChatViewScrollView, CopilotKit, CopilotKitAgentContext, CopilotOpenGenerativeUIActivityRenderer, CopilotOpenGenerativeUIRenderer, CopilotOpenGenerativeUIToolRenderer, CopilotSlot, CopilotThreadsDrawer, CopilotThreadsDrawerRow, CopilotTooltip, CopilotkitAgentFactory, CopilotkitThreadsFactory, DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATE_SANDBOXED_UI_TOOL_NAME, GenerateSandboxedUiArgsSchema, OPEN_GENERATIVE_UI_ACTIVITY_TYPE, OPEN_GENERATIVE_UI_WEBSANDBOX_LOADER, OpenGenerativeUIContentSchema, RENDER_A2UI_TOOL_NAME, RenderA2UIArgsSchema, RenderToolCalls, ResizeObserverService, SLOT_CONFIG, ScrollPosition, StickToBottom, ThreadsStore, TooltipContent, TranscriptionError, anyActivityContentSchema, cn, connectAgentContext, createSlotConfig, createSlotRenderer, getSlotConfig, injectAgentStore, injectChatConfiguration, injectChatLabels, injectChatState, injectCopilotKitConfig, injectMemories, injectThreads, isComponentType, isSlotValue, normalizeSlotValue, provideCopilotChatConfiguration, provideCopilotChatLabels, provideCopilotKit, provideSlots, registerFrontendTool, registerHumanInTheLoop, registerRenderToolCall, renderSlot, transcribeAudio };
9302
10681
  //# sourceMappingURL=copilotkit-angular.mjs.map