@copilotkit/core 1.56.5 → 1.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +605 -557
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +417 -369
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +96 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +96 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _ag_ui_client0 from "@ag-ui/client";
|
|
2
2
|
import { AbstractAgent, AgentSubscriber, BaseEvent, Context, HttpAgent, HttpAgentConfig, Message, RunAgentInput, RunAgentParameters, RunAgentResult, State, Tool, ToolCall } from "@ag-ui/client";
|
|
3
3
|
import { DebugConfig, IntelligenceRuntimeInfo, IntelligenceRuntimeInfo as IntelligenceRuntimeInfo$1, ResolvedDebugConfig, RuntimeLicenseStatus, RuntimeLicenseStatus as RuntimeLicenseStatus$1, RuntimeMode, RuntimeMode as RuntimeMode$1, StandardSchemaV1 } from "@copilotkit/shared";
|
|
4
|
-
import { AgentCapabilities } from "@ag-ui/core";
|
|
5
4
|
import { Observable, OperatorFunction } from "rxjs";
|
|
5
|
+
import { AgentCapabilities } from "@ag-ui/core";
|
|
6
6
|
|
|
7
7
|
//#region src/types.d.ts
|
|
8
8
|
/**
|
|
@@ -375,208 +375,521 @@ declare function ensureObjectArgs(parsed: unknown, toolName: string): Record<str
|
|
|
375
375
|
*/
|
|
376
376
|
declare function parseToolArguments(rawArgs: unknown, toolName: string): Record<string, unknown>;
|
|
377
377
|
//#endregion
|
|
378
|
-
//#region src/
|
|
379
|
-
/**
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
runtimeTransport?: CopilotRuntimeTransport;
|
|
385
|
-
/** Mapping from agent name to its `AbstractAgent` instance. For development only - production requires CopilotRuntime. */
|
|
386
|
-
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
387
|
-
/** Headers appended to every HTTP request made by `CopilotKitCore`. */
|
|
388
|
-
headers?: Record<string, string>;
|
|
389
|
-
/** Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies). */
|
|
390
|
-
credentials?: RequestCredentials;
|
|
391
|
-
/** Properties sent as `forwardedProps` to the AG-UI agent. */
|
|
392
|
-
properties?: Record<string, unknown>;
|
|
393
|
-
/** Ordered collection of frontend tools available to the core. */
|
|
394
|
-
tools?: FrontendTool<any>[];
|
|
395
|
-
/** Suggestions config for the core. */
|
|
396
|
-
suggestionsConfig?: SuggestionsConfig[];
|
|
397
|
-
/** Enable debug logging for the client-side event pipeline. */
|
|
398
|
-
debug?: DebugConfig;
|
|
399
|
-
}
|
|
400
|
-
interface CopilotKitCoreStopAgentParams {
|
|
401
|
-
agent: AbstractAgent;
|
|
378
|
+
//#region src/utils/micro-redux.d.ts
|
|
379
|
+
/**
|
|
380
|
+
* The minimal action shape used by this micro-redux implementation.
|
|
381
|
+
*/
|
|
382
|
+
interface AnyAction {
|
|
383
|
+
type: string;
|
|
402
384
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
385
|
+
/**
|
|
386
|
+
* A typed action creator function with a `type` literal and runtime matcher.
|
|
387
|
+
*/
|
|
388
|
+
type ActionCreator<Type extends string, Args extends unknown[] = unknown[], Action extends AnyAction & {
|
|
389
|
+
type: Type;
|
|
390
|
+
} = {
|
|
391
|
+
type: Type;
|
|
392
|
+
}> = ((...args: Args) => Action) & {
|
|
393
|
+
type: Type;
|
|
394
|
+
match(action: AnyAction): action is Action;
|
|
406
395
|
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
* }}
|
|
429
|
-
* />
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
AGENT_THREAD_LOCKED = "agent_thread_locked",
|
|
433
|
-
TRANSCRIPTION_FAILED = "transcription_failed",
|
|
434
|
-
TRANSCRIPTION_SERVICE_NOT_CONFIGURED = "transcription_service_not_configured",
|
|
435
|
-
TRANSCRIPTION_INVALID_AUDIO = "transcription_invalid_audio",
|
|
436
|
-
TRANSCRIPTION_RATE_LIMITED = "transcription_rate_limited",
|
|
437
|
-
TRANSCRIPTION_AUTH_FAILED = "transcription_auth_failed",
|
|
438
|
-
TRANSCRIPTION_NETWORK_ERROR = "transcription_network_error",
|
|
439
|
-
SUBSCRIBER_CALLBACK_FAILED = "subscriber_callback_failed"
|
|
440
|
-
}
|
|
441
|
-
interface CopilotKitCoreSubscriber {
|
|
442
|
-
onRuntimeConnectionStatusChanged?: (event: {
|
|
443
|
-
copilotkit: CopilotKitCore;
|
|
444
|
-
status: CopilotKitCoreRuntimeConnectionStatus;
|
|
445
|
-
}) => void | Promise<void>;
|
|
446
|
-
onToolExecutionStart?: (event: {
|
|
447
|
-
copilotkit: CopilotKitCore;
|
|
448
|
-
toolCallId: string;
|
|
449
|
-
agentId: string;
|
|
450
|
-
toolName: string;
|
|
451
|
-
args: unknown;
|
|
452
|
-
}) => void | Promise<void>;
|
|
453
|
-
onToolExecutionEnd?: (event: {
|
|
454
|
-
copilotkit: CopilotKitCore;
|
|
455
|
-
toolCallId: string;
|
|
456
|
-
agentId: string;
|
|
457
|
-
toolName: string;
|
|
458
|
-
result: string;
|
|
459
|
-
error?: string;
|
|
460
|
-
}) => void | Promise<void>;
|
|
461
|
-
onAgentsChanged?: (event: {
|
|
462
|
-
copilotkit: CopilotKitCore;
|
|
463
|
-
agents: Readonly<Record<string, AbstractAgent>>;
|
|
464
|
-
}) => void | Promise<void>;
|
|
465
|
-
onContextChanged?: (event: {
|
|
466
|
-
copilotkit: CopilotKitCore;
|
|
467
|
-
context: Readonly<Record<string, Context>>;
|
|
468
|
-
}) => void | Promise<void>;
|
|
469
|
-
onSuggestionsConfigChanged?: (event: {
|
|
470
|
-
copilotkit: CopilotKitCore;
|
|
471
|
-
suggestionsConfig: Readonly<Record<string, SuggestionsConfig>>;
|
|
472
|
-
}) => void | Promise<void>;
|
|
473
|
-
onSuggestionsChanged?: (event: {
|
|
474
|
-
copilotkit: CopilotKitCore;
|
|
475
|
-
agentId: string;
|
|
476
|
-
suggestions: Suggestion[];
|
|
477
|
-
}) => void | Promise<void>;
|
|
478
|
-
onSuggestionsStartedLoading?: (event: {
|
|
479
|
-
copilotkit: CopilotKitCore;
|
|
480
|
-
agentId: string;
|
|
481
|
-
}) => void | Promise<void>;
|
|
482
|
-
onSuggestionsFinishedLoading?: (event: {
|
|
483
|
-
copilotkit: CopilotKitCore;
|
|
484
|
-
agentId: string;
|
|
485
|
-
}) => void | Promise<void>;
|
|
486
|
-
onPropertiesChanged?: (event: {
|
|
487
|
-
copilotkit: CopilotKitCore;
|
|
488
|
-
properties: Readonly<Record<string, unknown>>;
|
|
489
|
-
}) => void | Promise<void>;
|
|
490
|
-
onHeadersChanged?: (event: {
|
|
491
|
-
copilotkit: CopilotKitCore;
|
|
492
|
-
headers: Readonly<Record<string, string>>;
|
|
493
|
-
}) => void | Promise<void>;
|
|
494
|
-
onError?: (event: {
|
|
495
|
-
copilotkit: CopilotKitCore;
|
|
496
|
-
error: Error;
|
|
497
|
-
code: CopilotKitCoreErrorCode;
|
|
498
|
-
context: Record<string, any>;
|
|
499
|
-
}) => void | Promise<void>;
|
|
500
|
-
/**
|
|
501
|
-
* Fired when an agent run or connect begins. The `agent` may be a per-thread
|
|
502
|
-
* clone that is not present in `core.agents`. Subscribers (e.g. the inspector)
|
|
503
|
-
* can use this to subscribe to the clone's AG-UI events.
|
|
504
|
-
*/
|
|
505
|
-
onAgentRunStarted?: (event: {
|
|
506
|
-
copilotkit: CopilotKitCore;
|
|
507
|
-
agent: AbstractAgent;
|
|
508
|
-
}) => void | Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Extracts the action type produced by an action creator.
|
|
398
|
+
*/
|
|
399
|
+
type ActionFromCreator<T> = T extends ((...args: any[]) => infer A) ? A : never;
|
|
400
|
+
/**
|
|
401
|
+
* Extracts a union of actions produced by a tuple/array of action creators.
|
|
402
|
+
*/
|
|
403
|
+
type ActionFromCreators<Creators extends readonly ActionCreator<string, any[], any>[]> = ActionFromCreator<Creators[number]>;
|
|
404
|
+
/**
|
|
405
|
+
* A reducer transforms state in response to actions.
|
|
406
|
+
*/
|
|
407
|
+
type Reducer<State, Action extends AnyAction = AnyAction> = (state: State | undefined, action: Action) => State;
|
|
408
|
+
/**
|
|
409
|
+
* A selector derives a value from state.
|
|
410
|
+
*/
|
|
411
|
+
type Selector<State, Result> = (state: State) => Result;
|
|
412
|
+
/**
|
|
413
|
+
* Marker config for action creators that accept no payload.
|
|
414
|
+
*/
|
|
415
|
+
interface EmptyActionConfig {
|
|
416
|
+
readonly kind: "empty";
|
|
509
417
|
}
|
|
510
|
-
|
|
511
|
-
|
|
418
|
+
declare const PROPS_MARKER: unique symbol;
|
|
419
|
+
/**
|
|
420
|
+
* Marker config for action creators that require payload props.
|
|
421
|
+
*/
|
|
422
|
+
interface PropsActionConfig<Props extends Record<string, unknown>> {
|
|
423
|
+
readonly kind: "props";
|
|
424
|
+
readonly [PROPS_MARKER]?: Props;
|
|
512
425
|
}
|
|
513
426
|
/**
|
|
514
|
-
*
|
|
515
|
-
* This tuple is the single source of truth — both the
|
|
516
|
-
* `SubscribeToAgentSubscriber` type and the runtime `ALLOWED_KEYS` set
|
|
517
|
-
* are derived from it, so they cannot desynchronise.
|
|
427
|
+
* Supported action creator config node in an action group.
|
|
518
428
|
*/
|
|
519
|
-
|
|
429
|
+
type ActionConfig = EmptyActionConfig | PropsActionConfig<Record<string, unknown>>;
|
|
520
430
|
/**
|
|
521
|
-
*
|
|
522
|
-
* {@link CopilotKitCore.subscribeToAgentWithOptions}. Only the callbacks
|
|
523
|
-
* listed in {@link SUBSCRIBE_TO_AGENT_KEYS} are supported:
|
|
524
|
-
* `onMessagesChanged`, `onStateChanged`, and the four run lifecycle
|
|
525
|
-
* callbacks (`onRunInitialized`, `onRunFinalized`, `onRunFailed`,
|
|
526
|
-
* `onRunErrorEvent`).
|
|
527
|
-
*
|
|
528
|
-
* Two categories of `AgentSubscriber` members are excluded:
|
|
529
|
-
*
|
|
530
|
-
* - **AG-UI event handlers** (`onEvent`, `onToolCallStartEvent`, etc.)
|
|
531
|
-
* return `AgentStateMutation` with `stopPropagation` — semantics that
|
|
532
|
-
* the throttle and error-protection wrappers cannot safely mediate.
|
|
533
|
-
*
|
|
534
|
-
* - **Per-item notification callbacks** (`onNewMessage`, `onNewToolCall`)
|
|
535
|
-
* return `void` and have no mutation concerns, but are excluded to keep
|
|
536
|
-
* the surface area minimal — `onMessagesChanged` already covers the
|
|
537
|
-
* same data at a coarser granularity, and throttling per-item callbacks
|
|
538
|
-
* would have different semantic expectations.
|
|
539
|
-
*
|
|
540
|
-
* `onRunErrorEvent` is technically an AG-UI event handler (its return type
|
|
541
|
-
* includes `stopPropagation`), but it is included here because all
|
|
542
|
-
* framework consumers need it to reset `isRunning` on protocol-level
|
|
543
|
-
* `RUN_ERROR` events — distinct from `onRunFailed` which handles local
|
|
544
|
-
* exceptions like network errors. In practice, consumers return `void`
|
|
545
|
-
* from this callback, so the `stopPropagation` semantics are unused.
|
|
546
|
-
*
|
|
547
|
-
* Note: the included lifecycle callbacks return
|
|
548
|
-
* `Omit<AgentStateMutation, "stopPropagation">` (or full
|
|
549
|
-
* `AgentStateMutation` in the case of `onRunErrorEvent`). On the error
|
|
550
|
-
* path, `safeCall` discards those return values (see its inline
|
|
551
|
-
* documentation).
|
|
552
|
-
*
|
|
553
|
-
* Use `agent.subscribe()` directly when event mutation or per-item
|
|
554
|
-
* notification semantics are needed.
|
|
431
|
+
* Shape of an action group declaration object.
|
|
555
432
|
*/
|
|
556
|
-
type
|
|
557
|
-
/**
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
433
|
+
type ActionGroupConfig = Record<string, ActionConfig>;
|
|
434
|
+
/**
|
|
435
|
+
* Maps an action group declaration to a strongly typed action-creator object.
|
|
436
|
+
*/
|
|
437
|
+
type ActionGroupResult<Source extends string, Config extends ActionGroupConfig> = { [K in keyof Config & string]: Config[K] extends PropsActionConfig<infer P> ? ActionCreator<`[${Source}] ${K}`, [P], {
|
|
438
|
+
type: `[${Source}] ${K}`;
|
|
439
|
+
} & P> : ActionCreator<`[${Source}] ${K}`, [], {
|
|
440
|
+
type: `[${Source}] ${K}`;
|
|
441
|
+
}> };
|
|
442
|
+
interface OnReducerEntry<State, Action extends AnyAction = AnyAction, Creators extends readonly ActionCreator<string, any[], any>[] = readonly ActionCreator<string, any[], any>[]> {
|
|
443
|
+
creators: Creators;
|
|
444
|
+
reducer: (state: State, action: Action) => State;
|
|
565
445
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
446
|
+
type ActionFromOnReducerEntry<TEntry> = TEntry extends OnReducerEntry<any, infer TAction, any> ? TAction : never;
|
|
447
|
+
/**
|
|
448
|
+
* Effect contract for streams that emit actions to dispatch.
|
|
449
|
+
*/
|
|
450
|
+
interface DispatchingEffect<State, InputAction extends AnyAction = AnyAction, OutputAction extends AnyAction = AnyAction> {
|
|
451
|
+
run: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<OutputAction>;
|
|
452
|
+
dispatch: true;
|
|
571
453
|
}
|
|
572
454
|
/**
|
|
573
|
-
*
|
|
574
|
-
* This provides type safety while allowing controlled access to private functionality.
|
|
455
|
+
* Effect contract for side-effect-only streams whose emissions are ignored.
|
|
575
456
|
*/
|
|
576
|
-
interface
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
457
|
+
interface NonDispatchingEffect<State, InputAction extends AnyAction = AnyAction> {
|
|
458
|
+
run: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<unknown>;
|
|
459
|
+
dispatch: false;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Union of supported effect shapes.
|
|
463
|
+
*/
|
|
464
|
+
type Effect<State, InputAction extends AnyAction = AnyAction, OutputAction extends AnyAction = AnyAction> = DispatchingEffect<State, InputAction, OutputAction> | NonDispatchingEffect<State, InputAction>;
|
|
465
|
+
/**
|
|
466
|
+
* Lifecycle actions dispatched by the store.
|
|
467
|
+
*/
|
|
468
|
+
type StoreLifecycleAction = {
|
|
469
|
+
type: "@@micro-redux/init";
|
|
470
|
+
} | {
|
|
471
|
+
type: "@@micro-redux/stop";
|
|
472
|
+
};
|
|
473
|
+
/**
|
|
474
|
+
* Options for a dispatching effect.
|
|
475
|
+
*/
|
|
476
|
+
interface DispatchingEffectOptions {
|
|
477
|
+
dispatch?: true;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Options for a non-dispatching effect.
|
|
481
|
+
*/
|
|
482
|
+
interface NonDispatchingEffectOptions {
|
|
483
|
+
dispatch: false;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Declares a payload-based action config for `createActionGroup`.
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* const actions = createActionGroup("User", {
|
|
491
|
+
* loaded: props<{ id: string }>(),
|
|
492
|
+
* });
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
declare function props<Props extends Record<string, unknown>>(): PropsActionConfig<Props>;
|
|
496
|
+
/**
|
|
497
|
+
* Declares a no-payload action config for `createActionGroup`.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* const actions = createActionGroup("User", {
|
|
502
|
+
* reset: empty(),
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
declare function empty(): EmptyActionConfig;
|
|
507
|
+
/**
|
|
508
|
+
* Creates a namespaced group of typed action creators.
|
|
509
|
+
*
|
|
510
|
+
* Action types are formatted as: `[Source] actionName`.
|
|
511
|
+
*/
|
|
512
|
+
declare function createActionGroup<const Source extends string, const Config extends ActionGroupConfig>(source: Source, config: Config): ActionGroupResult<Source, Config>;
|
|
513
|
+
/**
|
|
514
|
+
* Registers one reducer handler for one or more action creators.
|
|
515
|
+
*
|
|
516
|
+
* @throws Error when called without at least one action creator and reducer.
|
|
517
|
+
*/
|
|
518
|
+
declare function on<State, const Creators extends readonly ActionCreator<string, any[], any>[], Action extends ActionFromCreators<Creators>>(...args: [...creators: Creators, reducer: (state: State, action: Action) => State]): OnReducerEntry<State, Action, Creators>;
|
|
519
|
+
/**
|
|
520
|
+
* Creates a reducer from an initial state and `on(...)` handler entries.
|
|
521
|
+
*
|
|
522
|
+
* Unknown action types return the current state unchanged.
|
|
523
|
+
*/
|
|
524
|
+
declare function createReducer<State, const Entries extends readonly OnReducerEntry<any, any, any>[]>(initialState: State, ...entries: Entries): Reducer<State, ActionFromOnReducerEntry<Entries[number]>>;
|
|
525
|
+
/**
|
|
526
|
+
* Creates a memoized selector from a single projector.
|
|
527
|
+
*/
|
|
528
|
+
declare function createSelector<State, Result>(projector: (state: State) => Result): Selector<State, Result>;
|
|
529
|
+
/**
|
|
530
|
+
* Creates a memoized selector from input selectors and a projector.
|
|
531
|
+
*
|
|
532
|
+
* Memoization uses one-entry caching over the latest input selector values.
|
|
533
|
+
*/
|
|
534
|
+
declare function createSelector<State, const Selectors extends readonly Selector<State, unknown>[], Result>(...args: [...selectors: Selectors, projector: (...inputs: { [K in keyof Selectors]: ReturnType<Selectors[K]> }) => Result]): Selector<State, Result>;
|
|
535
|
+
/**
|
|
536
|
+
* RxJS operator that maps state emissions through a selector and suppresses
|
|
537
|
+
* unchanged projected values via reference equality.
|
|
538
|
+
*/
|
|
539
|
+
declare function select<State, Result>(selector: Selector<State, Result>): OperatorFunction<State, Result>;
|
|
540
|
+
/**
|
|
541
|
+
* RxJS operator that filters an action stream by action creators and narrows
|
|
542
|
+
* the output action type to the matched creator union.
|
|
543
|
+
*
|
|
544
|
+
* @throws Error when called without at least one action creator.
|
|
545
|
+
*/
|
|
546
|
+
declare function ofType<const Creators extends readonly ActionCreator<string, any[], AnyAction>[]>(...creators: Creators): OperatorFunction<AnyAction, ActionFromCreators<Creators>>;
|
|
547
|
+
/**
|
|
548
|
+
* Creates a dispatching effect. Emitted actions are automatically dispatched.
|
|
549
|
+
*/
|
|
550
|
+
declare function createEffect<State, InputAction extends AnyAction, OutputAction extends AnyAction>(factory: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<OutputAction>, options?: DispatchingEffectOptions): DispatchingEffect<State, InputAction, OutputAction>;
|
|
551
|
+
/**
|
|
552
|
+
* Creates a non-dispatching effect. Emitted values are ignored.
|
|
553
|
+
*/
|
|
554
|
+
declare function createEffect<State, InputAction extends AnyAction>(factory: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<unknown>, options: NonDispatchingEffectOptions): NonDispatchingEffect<State, InputAction>;
|
|
555
|
+
/**
|
|
556
|
+
* Store interface returned by `createStore`.
|
|
557
|
+
*/
|
|
558
|
+
interface Store<State, Action extends AnyAction = AnyAction> {
|
|
559
|
+
dispatch(action: Action): void;
|
|
560
|
+
getState(): State;
|
|
561
|
+
readonly state$: Observable<State>;
|
|
562
|
+
readonly actions$: Observable<Action | StoreLifecycleAction>;
|
|
563
|
+
select<Result>(selector: Selector<State, Result>): Observable<Result>;
|
|
564
|
+
init(): void;
|
|
565
|
+
stop(): void;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Creates a small observable store with reducer + effects.
|
|
569
|
+
*
|
|
570
|
+
* Behavior:
|
|
571
|
+
* - `init()` starts effects and dispatches `@@micro-redux/init`.
|
|
572
|
+
* - `stop()` dispatches `@@micro-redux/stop` and unsubscribes all effects.
|
|
573
|
+
* - Effect action observation is scheduled on `asapScheduler` to avoid
|
|
574
|
+
* synchronous re-entrancy in the effect loop.
|
|
575
|
+
* - Any effect error triggers fail-fast teardown and errors both `actions$`
|
|
576
|
+
* and `state$`.
|
|
577
|
+
*/
|
|
578
|
+
declare function createStore<State, Action extends AnyAction = AnyAction>(options: {
|
|
579
|
+
reducer: Reducer<State, Action | StoreLifecycleAction>;
|
|
580
|
+
effects?: Array<Effect<State, Action | StoreLifecycleAction, Action>>;
|
|
581
|
+
}): Store<State, Action>;
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/threads.d.ts
|
|
584
|
+
interface ThreadRecord {
|
|
585
|
+
id: string;
|
|
586
|
+
organizationId: string;
|
|
587
|
+
agentId: string;
|
|
588
|
+
createdById: string;
|
|
589
|
+
name: string | null;
|
|
590
|
+
archived: boolean;
|
|
591
|
+
createdAt: string;
|
|
592
|
+
updatedAt: string;
|
|
593
|
+
lastRunAt?: string;
|
|
594
|
+
}
|
|
595
|
+
interface ThreadRuntimeContext {
|
|
596
|
+
runtimeUrl: string;
|
|
597
|
+
headers: Record<string, string>;
|
|
598
|
+
wsUrl?: string;
|
|
599
|
+
agentId: string;
|
|
600
|
+
includeArchived?: boolean;
|
|
601
|
+
limit?: number;
|
|
602
|
+
}
|
|
603
|
+
type ThreadMetadataEvent = {
|
|
604
|
+
operation: "created" | "renamed" | "archived" | "unarchived" | "updated";
|
|
605
|
+
threadId: string;
|
|
606
|
+
userId: string;
|
|
607
|
+
organizationId: string;
|
|
608
|
+
occurredAt: string;
|
|
609
|
+
thread: ThreadRecord;
|
|
610
|
+
} | {
|
|
611
|
+
operation: "deleted";
|
|
612
|
+
threadId: string;
|
|
613
|
+
userId: string;
|
|
614
|
+
organizationId: string;
|
|
615
|
+
occurredAt: string;
|
|
616
|
+
deleted: {
|
|
617
|
+
id: string;
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
interface ThreadEnvironment {
|
|
621
|
+
fetch: typeof fetch;
|
|
622
|
+
}
|
|
623
|
+
interface ThreadState {
|
|
624
|
+
threads: ThreadRecord[];
|
|
625
|
+
isLoading: boolean;
|
|
626
|
+
isFetchingNextPage: boolean;
|
|
627
|
+
error: Error | null;
|
|
628
|
+
context: ThreadRuntimeContext | null;
|
|
629
|
+
sessionId: number;
|
|
630
|
+
metadataCredentialsRequested: boolean;
|
|
631
|
+
metadataJoinCode: string | null;
|
|
632
|
+
nextCursor: string | null;
|
|
633
|
+
}
|
|
634
|
+
interface ThreadStore {
|
|
635
|
+
start(): void;
|
|
636
|
+
stop(): void;
|
|
637
|
+
setContext(context: ThreadRuntimeContext | null): void;
|
|
638
|
+
/** Re-fetches the thread list without resetting the current list to empty. */
|
|
639
|
+
refresh(): void;
|
|
640
|
+
fetchNextPage(): void;
|
|
641
|
+
renameThread(threadId: string, name: string): Promise<void>;
|
|
642
|
+
archiveThread(threadId: string): Promise<void>;
|
|
643
|
+
deleteThread(threadId: string): Promise<void>;
|
|
644
|
+
getState(): ThreadState;
|
|
645
|
+
select: Store<ThreadState>["select"];
|
|
646
|
+
}
|
|
647
|
+
declare function createThreadStore(environment: ThreadEnvironment): ThreadStore;
|
|
648
|
+
type ɵThread = ThreadRecord;
|
|
649
|
+
type ɵThreadRuntimeContext = ThreadRuntimeContext;
|
|
650
|
+
type ɵThreadMetadataEvent = ThreadMetadataEvent;
|
|
651
|
+
type ɵThreadEnvironment = ThreadEnvironment;
|
|
652
|
+
type ɵThreadStore = ThreadStore;
|
|
653
|
+
declare const ɵthreadAdapterEvents: any;
|
|
654
|
+
declare const ɵselectThreads: any;
|
|
655
|
+
declare const ɵselectThreadsIsLoading: any;
|
|
656
|
+
declare const ɵselectThreadsError: any;
|
|
657
|
+
declare const ɵselectHasNextPage: any;
|
|
658
|
+
declare const ɵselectIsFetchingNextPage: any;
|
|
659
|
+
/**
|
|
660
|
+
* Number of consecutive WebSocket connection failures after which the
|
|
661
|
+
* threads channel tears itself down rather than retrying indefinitely.
|
|
662
|
+
* Exposed for tests so they can assert teardown semantics without
|
|
663
|
+
* hardcoding the threshold separately from production.
|
|
664
|
+
*/
|
|
665
|
+
declare const ɵMAX_SOCKET_RETRIES = 5;
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/core/core.d.ts
|
|
668
|
+
/** Configuration options for `CopilotKitCore`. */
|
|
669
|
+
interface CopilotKitCoreConfig {
|
|
670
|
+
/** The endpoint of the CopilotRuntime. */
|
|
671
|
+
runtimeUrl?: string;
|
|
672
|
+
/** Transport style for CopilotRuntime endpoints. Defaults to REST. */
|
|
673
|
+
runtimeTransport?: CopilotRuntimeTransport;
|
|
674
|
+
/** Mapping from agent name to its `AbstractAgent` instance. For development only - production requires CopilotRuntime. */
|
|
675
|
+
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
676
|
+
/** Headers appended to every HTTP request made by `CopilotKitCore`. */
|
|
677
|
+
headers?: Record<string, string>;
|
|
678
|
+
/** Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies). */
|
|
679
|
+
credentials?: RequestCredentials;
|
|
680
|
+
/** Properties sent as `forwardedProps` to the AG-UI agent. */
|
|
681
|
+
properties?: Record<string, unknown>;
|
|
682
|
+
/** Ordered collection of frontend tools available to the core. */
|
|
683
|
+
tools?: FrontendTool<any>[];
|
|
684
|
+
/** Suggestions config for the core. */
|
|
685
|
+
suggestionsConfig?: SuggestionsConfig[];
|
|
686
|
+
/** Enable debug logging for the client-side event pipeline. */
|
|
687
|
+
debug?: DebugConfig;
|
|
688
|
+
}
|
|
689
|
+
interface CopilotKitCoreStopAgentParams {
|
|
690
|
+
agent: AbstractAgent;
|
|
691
|
+
}
|
|
692
|
+
type CopilotKitCoreGetSuggestionsResult = {
|
|
693
|
+
suggestions: Suggestion[];
|
|
694
|
+
isLoading: boolean;
|
|
695
|
+
};
|
|
696
|
+
declare enum CopilotKitCoreErrorCode {
|
|
697
|
+
RUNTIME_INFO_FETCH_FAILED = "runtime_info_fetch_failed",
|
|
698
|
+
AGENT_CONNECT_FAILED = "agent_connect_failed",
|
|
699
|
+
AGENT_RUN_FAILED = "agent_run_failed",
|
|
700
|
+
AGENT_RUN_FAILED_EVENT = "agent_run_failed_event",
|
|
701
|
+
AGENT_RUN_ERROR_EVENT = "agent_run_error_event",
|
|
702
|
+
TOOL_ARGUMENT_PARSE_FAILED = "tool_argument_parse_failed",
|
|
703
|
+
TOOL_HANDLER_FAILED = "tool_handler_failed",
|
|
704
|
+
TOOL_NOT_FOUND = "tool_not_found",
|
|
705
|
+
AGENT_NOT_FOUND = "agent_not_found",
|
|
706
|
+
/**
|
|
707
|
+
* Emitted when an agent run fails because the thread is already locked
|
|
708
|
+
* by another active run.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```tsx
|
|
712
|
+
* <CopilotKitProvider
|
|
713
|
+
* onError={({ code, error, context }) => {
|
|
714
|
+
* if (code === "agent_thread_locked") {
|
|
715
|
+
* // Show "Agent is busy, retry?" UI
|
|
716
|
+
* }
|
|
717
|
+
* }}
|
|
718
|
+
* />
|
|
719
|
+
* ```
|
|
720
|
+
*/
|
|
721
|
+
AGENT_THREAD_LOCKED = "agent_thread_locked",
|
|
722
|
+
TRANSCRIPTION_FAILED = "transcription_failed",
|
|
723
|
+
TRANSCRIPTION_SERVICE_NOT_CONFIGURED = "transcription_service_not_configured",
|
|
724
|
+
TRANSCRIPTION_INVALID_AUDIO = "transcription_invalid_audio",
|
|
725
|
+
TRANSCRIPTION_RATE_LIMITED = "transcription_rate_limited",
|
|
726
|
+
TRANSCRIPTION_AUTH_FAILED = "transcription_auth_failed",
|
|
727
|
+
TRANSCRIPTION_NETWORK_ERROR = "transcription_network_error",
|
|
728
|
+
SUBSCRIBER_CALLBACK_FAILED = "subscriber_callback_failed"
|
|
729
|
+
}
|
|
730
|
+
interface CopilotKitCoreSubscriber {
|
|
731
|
+
onRuntimeConnectionStatusChanged?: (event: {
|
|
732
|
+
copilotkit: CopilotKitCore;
|
|
733
|
+
status: CopilotKitCoreRuntimeConnectionStatus;
|
|
734
|
+
}) => void | Promise<void>;
|
|
735
|
+
onToolExecutionStart?: (event: {
|
|
736
|
+
copilotkit: CopilotKitCore;
|
|
737
|
+
toolCallId: string;
|
|
738
|
+
agentId: string;
|
|
739
|
+
toolName: string;
|
|
740
|
+
args: unknown;
|
|
741
|
+
}) => void | Promise<void>;
|
|
742
|
+
onToolExecutionEnd?: (event: {
|
|
743
|
+
copilotkit: CopilotKitCore;
|
|
744
|
+
toolCallId: string;
|
|
745
|
+
agentId: string;
|
|
746
|
+
toolName: string;
|
|
747
|
+
result: string;
|
|
748
|
+
error?: string;
|
|
749
|
+
}) => void | Promise<void>;
|
|
750
|
+
onAgentsChanged?: (event: {
|
|
751
|
+
copilotkit: CopilotKitCore;
|
|
752
|
+
agents: Readonly<Record<string, AbstractAgent>>;
|
|
753
|
+
}) => void | Promise<void>;
|
|
754
|
+
onContextChanged?: (event: {
|
|
755
|
+
copilotkit: CopilotKitCore;
|
|
756
|
+
context: Readonly<Record<string, Context>>;
|
|
757
|
+
}) => void | Promise<void>;
|
|
758
|
+
onSuggestionsConfigChanged?: (event: {
|
|
759
|
+
copilotkit: CopilotKitCore;
|
|
760
|
+
suggestionsConfig: Readonly<Record<string, SuggestionsConfig>>;
|
|
761
|
+
}) => void | Promise<void>;
|
|
762
|
+
onSuggestionsChanged?: (event: {
|
|
763
|
+
copilotkit: CopilotKitCore;
|
|
764
|
+
agentId: string;
|
|
765
|
+
suggestions: Suggestion[];
|
|
766
|
+
}) => void | Promise<void>;
|
|
767
|
+
onSuggestionsStartedLoading?: (event: {
|
|
768
|
+
copilotkit: CopilotKitCore;
|
|
769
|
+
agentId: string;
|
|
770
|
+
}) => void | Promise<void>;
|
|
771
|
+
onSuggestionsFinishedLoading?: (event: {
|
|
772
|
+
copilotkit: CopilotKitCore;
|
|
773
|
+
agentId: string;
|
|
774
|
+
}) => void | Promise<void>;
|
|
775
|
+
onPropertiesChanged?: (event: {
|
|
776
|
+
copilotkit: CopilotKitCore;
|
|
777
|
+
properties: Readonly<Record<string, unknown>>;
|
|
778
|
+
}) => void | Promise<void>;
|
|
779
|
+
onHeadersChanged?: (event: {
|
|
780
|
+
copilotkit: CopilotKitCore;
|
|
781
|
+
headers: Readonly<Record<string, string>>;
|
|
782
|
+
}) => void | Promise<void>;
|
|
783
|
+
onError?: (event: {
|
|
784
|
+
copilotkit: CopilotKitCore;
|
|
785
|
+
error: Error;
|
|
786
|
+
code: CopilotKitCoreErrorCode;
|
|
787
|
+
context: Record<string, any>;
|
|
788
|
+
}) => void | Promise<void>;
|
|
789
|
+
onThreadStoreRegistered?: (event: {
|
|
790
|
+
copilotkit: CopilotKitCore;
|
|
791
|
+
agentId: string;
|
|
792
|
+
store: ɵThreadStore;
|
|
793
|
+
}) => void | Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Fired when a thread store is removed from the registry, either by an
|
|
796
|
+
* explicit `unregister()` call or by a `register()` call that replaces an
|
|
797
|
+
* existing store for the same `agentId`.
|
|
798
|
+
*
|
|
799
|
+
* The previous store is delivered via `prevStore` so subscribers can tear
|
|
800
|
+
* down state that depends on the concrete instance (e.g. cancel an active
|
|
801
|
+
* subscription) without consulting the registry. By the time async
|
|
802
|
+
* subscribers resume after an `await`, a replacement `register()` may have
|
|
803
|
+
* already installed the new store under the same key, so calling
|
|
804
|
+
* `registry.get(agentId)` inside this callback is unsafe and may return
|
|
805
|
+
* the new store instead of the unregistered one.
|
|
806
|
+
*/
|
|
807
|
+
onThreadStoreUnregistered?: (event: {
|
|
808
|
+
copilotkit: CopilotKitCore;
|
|
809
|
+
agentId: string;
|
|
810
|
+
prevStore: ɵThreadStore;
|
|
811
|
+
}) => void | Promise<void>;
|
|
812
|
+
/**
|
|
813
|
+
* Fired immediately before each agent run, including per-thread clones that
|
|
814
|
+
* are not in the agent registry and therefore not surfaced via onAgentsChanged.
|
|
815
|
+
* Subscribers that track agent events (e.g. the web inspector) can use this
|
|
816
|
+
* to subscribe to the concrete agent instance that will emit events.
|
|
817
|
+
*/
|
|
818
|
+
onAgentRunStarted?: (event: {
|
|
819
|
+
copilotkit: CopilotKitCore;
|
|
820
|
+
agent: AbstractAgent;
|
|
821
|
+
}) => void | Promise<void>;
|
|
822
|
+
}
|
|
823
|
+
interface CopilotKitCoreSubscription {
|
|
824
|
+
unsubscribe: () => void;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* The callback keys accepted by {@link CopilotKitCore.subscribeToAgentWithOptions}.
|
|
828
|
+
* This tuple is the single source of truth — both the
|
|
829
|
+
* `SubscribeToAgentSubscriber` type and the runtime `ALLOWED_KEYS` set
|
|
830
|
+
* are derived from it, so they cannot desynchronise.
|
|
831
|
+
*/
|
|
832
|
+
declare const SUBSCRIBE_TO_AGENT_KEYS: readonly ["onMessagesChanged", "onStateChanged", "onRunInitialized", "onRunFinalized", "onRunFailed", "onRunErrorEvent"];
|
|
833
|
+
/**
|
|
834
|
+
* The subset of `AgentSubscriber` callbacks accepted by
|
|
835
|
+
* {@link CopilotKitCore.subscribeToAgentWithOptions}. Only the callbacks
|
|
836
|
+
* listed in {@link SUBSCRIBE_TO_AGENT_KEYS} are supported:
|
|
837
|
+
* `onMessagesChanged`, `onStateChanged`, and the four run lifecycle
|
|
838
|
+
* callbacks (`onRunInitialized`, `onRunFinalized`, `onRunFailed`,
|
|
839
|
+
* `onRunErrorEvent`).
|
|
840
|
+
*
|
|
841
|
+
* Two categories of `AgentSubscriber` members are excluded:
|
|
842
|
+
*
|
|
843
|
+
* - **AG-UI event handlers** (`onEvent`, `onToolCallStartEvent`, etc.)
|
|
844
|
+
* return `AgentStateMutation` with `stopPropagation` — semantics that
|
|
845
|
+
* the throttle and error-protection wrappers cannot safely mediate.
|
|
846
|
+
*
|
|
847
|
+
* - **Per-item notification callbacks** (`onNewMessage`, `onNewToolCall`)
|
|
848
|
+
* return `void` and have no mutation concerns, but are excluded to keep
|
|
849
|
+
* the surface area minimal — `onMessagesChanged` already covers the
|
|
850
|
+
* same data at a coarser granularity, and throttling per-item callbacks
|
|
851
|
+
* would have different semantic expectations.
|
|
852
|
+
*
|
|
853
|
+
* `onRunErrorEvent` is technically an AG-UI event handler (its return type
|
|
854
|
+
* includes `stopPropagation`), but it is included here because all
|
|
855
|
+
* framework consumers need it to reset `isRunning` on protocol-level
|
|
856
|
+
* `RUN_ERROR` events — distinct from `onRunFailed` which handles local
|
|
857
|
+
* exceptions like network errors. In practice, consumers return `void`
|
|
858
|
+
* from this callback, so the `stopPropagation` semantics are unused.
|
|
859
|
+
*
|
|
860
|
+
* Note: the included lifecycle callbacks return
|
|
861
|
+
* `Omit<AgentStateMutation, "stopPropagation">` (or full
|
|
862
|
+
* `AgentStateMutation` in the case of `onRunErrorEvent`). On the error
|
|
863
|
+
* path, `safeCall` discards those return values (see its inline
|
|
864
|
+
* documentation).
|
|
865
|
+
*
|
|
866
|
+
* Use `agent.subscribe()` directly when event mutation or per-item
|
|
867
|
+
* notification semantics are needed.
|
|
868
|
+
*/
|
|
869
|
+
type SubscribeToAgentSubscriber = Pick<AgentSubscriber, (typeof SUBSCRIBE_TO_AGENT_KEYS)[number]>;
|
|
870
|
+
/** Options for {@link CopilotKitCore.subscribeToAgentWithOptions}. */
|
|
871
|
+
interface SubscribeToAgentOptions {
|
|
872
|
+
/**
|
|
873
|
+
* Throttle interval (ms) for `onMessagesChanged` / `onStateChanged`.
|
|
874
|
+
* Non-negative finite number; `0` explicitly disables throttling.
|
|
875
|
+
* Falls back to `defaultThrottleMs` when `undefined`.
|
|
876
|
+
*/
|
|
877
|
+
throttleMs?: number;
|
|
878
|
+
}
|
|
879
|
+
declare enum CopilotKitCoreRuntimeConnectionStatus {
|
|
880
|
+
Disconnected = "disconnected",
|
|
881
|
+
Connected = "connected",
|
|
882
|
+
Connecting = "connecting",
|
|
883
|
+
Error = "error"
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Internal interface for delegate classes to access CopilotKitCore methods.
|
|
887
|
+
* This provides type safety while allowing controlled access to private functionality.
|
|
888
|
+
*/
|
|
889
|
+
interface CopilotKitCoreFriendsAccess {
|
|
890
|
+
notifySubscribers(handler: (subscriber: CopilotKitCoreSubscriber) => void | Promise<void>, errorMessage: string): Promise<void>;
|
|
891
|
+
emitError(params: {
|
|
892
|
+
error: Error;
|
|
580
893
|
code: CopilotKitCoreErrorCode;
|
|
581
894
|
context?: Record<string, any>;
|
|
582
895
|
}): Promise<void>;
|
|
@@ -615,6 +928,14 @@ declare class CopilotKitCore {
|
|
|
615
928
|
private suggestionEngine;
|
|
616
929
|
private runHandler;
|
|
617
930
|
private stateManager;
|
|
931
|
+
private threadStoreRegistry;
|
|
932
|
+
/**
|
|
933
|
+
* Tracks the agent IDs from the most recent `onAgentsChanged` notification.
|
|
934
|
+
* Used to gate thread-store auto-unregister so the FIRST empty-agents
|
|
935
|
+
* notification (before published agents are merged in) does not rip out a
|
|
936
|
+
* store that was registered prior to that initial notification.
|
|
937
|
+
*/
|
|
938
|
+
private previousAgentIds;
|
|
618
939
|
constructor({
|
|
619
940
|
runtimeUrl,
|
|
620
941
|
runtimeTransport,
|
|
@@ -694,6 +1015,13 @@ declare class CopilotKitCore {
|
|
|
694
1015
|
*/
|
|
695
1016
|
addContext(context: Context): string;
|
|
696
1017
|
removeContext(id: string): void;
|
|
1018
|
+
/**
|
|
1019
|
+
* Thread store registry (delegated to ThreadStoreRegistry)
|
|
1020
|
+
*/
|
|
1021
|
+
registerThreadStore(agentId: string, store: ɵThreadStore): void;
|
|
1022
|
+
unregisterThreadStore(agentId: string): void;
|
|
1023
|
+
getThreadStore(agentId: string): ɵThreadStore | undefined;
|
|
1024
|
+
getThreadStores(): Readonly<Record<string, ɵThreadStore>>;
|
|
697
1025
|
/**
|
|
698
1026
|
* Suggestions management (delegated to SuggestionEngine)
|
|
699
1027
|
*/
|
|
@@ -1025,297 +1353,92 @@ interface IntelligenceAgentSharedState {
|
|
|
1025
1353
|
declare class AgentThreadLockedError extends Error {
|
|
1026
1354
|
constructor(threadId?: string);
|
|
1027
1355
|
}
|
|
1028
|
-
interface IntelligenceAgentConfig {
|
|
1029
|
-
/** Phoenix websocket URL, e.g. "ws://localhost:4000/socket" */
|
|
1030
|
-
url: string;
|
|
1031
|
-
/** Runtime REST URL, e.g. "http://localhost:4000" */
|
|
1032
|
-
runtimeUrl: string;
|
|
1033
|
-
/** Agent identifier for REST endpoints */
|
|
1034
|
-
agentId: string;
|
|
1035
|
-
/** Optional params sent on socket connect (e.g. auth token) */
|
|
1036
|
-
socketParams?: Record<string, string>;
|
|
1037
|
-
/** Optional headers sent with REST requests */
|
|
1038
|
-
headers?: Record<string, string>;
|
|
1039
|
-
/** Optional credentials mode for fetch requests */
|
|
1040
|
-
credentials?: RequestCredentials;
|
|
1041
|
-
}
|
|
1042
|
-
declare class IntelligenceAgent extends AbstractAgent {
|
|
1043
|
-
private config;
|
|
1044
|
-
private socket;
|
|
1045
|
-
private activeChannel;
|
|
1046
|
-
private canonicalRunId;
|
|
1047
|
-
private sharedState;
|
|
1048
|
-
constructor(config: IntelligenceAgentConfig, sharedState?: IntelligenceAgentSharedState);
|
|
1049
|
-
clone(): IntelligenceAgent;
|
|
1050
|
-
/**
|
|
1051
|
-
* Override of AbstractAgent.connectAgent that removes the `verifyEvents` step.
|
|
1052
|
-
*
|
|
1053
|
-
* Background: AbstractAgent's connectAgent pipeline runs events through
|
|
1054
|
-
* `verifyEvents`, which validates that the stream follows the AG-UI protocol
|
|
1055
|
-
* lifecycle — specifically, it expects a RUN_STARTED event before any content
|
|
1056
|
-
* events and a RUN_FINISHED/RUN_ERROR event to complete the stream.
|
|
1057
|
-
*
|
|
1058
|
-
* IntelligenceAgent uses long-lived WebSocket connections rather than
|
|
1059
|
-
* request-scoped SSE streams. When connecting to replay historical messages
|
|
1060
|
-
* for an existing thread, the connection semantics don't map to a single
|
|
1061
|
-
* agent run start/stop cycle. The replayed events may not include
|
|
1062
|
-
* RUN_STARTED/RUN_FINISHED bookends (or may contain events from multiple
|
|
1063
|
-
* past runs), which causes verifyEvents to either never complete or to
|
|
1064
|
-
* error out.
|
|
1065
|
-
*
|
|
1066
|
-
* This override replicates the base connectAgent implementation exactly,
|
|
1067
|
-
* substituting only `transformChunks` (which is still needed for message
|
|
1068
|
-
* reassembly) and omitting `verifyEvents`.
|
|
1069
|
-
*
|
|
1070
|
-
* TODO: Remove this override once AG-UI's AbstractAgent supports opting out
|
|
1071
|
-
* of verifyEvents for transports with different connection life-cycles.
|
|
1072
|
-
*/
|
|
1073
|
-
connectAgent(parameters?: RunAgentParameters, subscriber?: AgentSubscriber): Promise<RunAgentResult>;
|
|
1074
|
-
abortRun(): void;
|
|
1075
|
-
/**
|
|
1076
|
-
* Trigger the run via REST, then join the realtime thread channel and relay
|
|
1077
|
-
* server-pushed AG-UI events to the Observable subscriber.
|
|
1078
|
-
*/
|
|
1079
|
-
run(input: RunAgentInput): Observable<BaseEvent>;
|
|
1080
|
-
/**
|
|
1081
|
-
* Reconnect to an existing thread by fetching websocket credentials and
|
|
1082
|
-
* joining the realtime thread channel.
|
|
1083
|
-
*/
|
|
1084
|
-
protected connect(input: RunAgentInput): Observable<BaseEvent>;
|
|
1085
|
-
/**
|
|
1086
|
-
* Tear down a specific channel + socket pair that belongs to one pipeline.
|
|
1087
|
-
* Only nulls instance references when they still point to the owned resource,
|
|
1088
|
-
* so a concurrent pipeline's resources are never clobbered.
|
|
1089
|
-
*/
|
|
1090
|
-
private cleanupOwned;
|
|
1091
|
-
private cleanup;
|
|
1092
|
-
private requestJoinCredentials$;
|
|
1093
|
-
private normalizeJoinCredentials;
|
|
1094
|
-
private observeThread$;
|
|
1095
|
-
private observeThreadSession$;
|
|
1096
|
-
private joinThreadChannel$;
|
|
1097
|
-
private observeSocketHealth$;
|
|
1098
|
-
private observeThreadEvents$;
|
|
1099
|
-
private observeControlEvent$;
|
|
1100
|
-
private observeChannelEvent$;
|
|
1101
|
-
private createThreadNotifications;
|
|
1102
|
-
private buildRuntimeUrl;
|
|
1103
|
-
private createThreadChannelParams;
|
|
1104
|
-
private getLastSeenEventId;
|
|
1105
|
-
private getReconnectCursor;
|
|
1106
|
-
private clearReconnectCursor;
|
|
1107
|
-
private updateLastSeenEventId;
|
|
1108
|
-
private updateLastSeenEventIdFromControl;
|
|
1109
|
-
private readEventId;
|
|
1110
|
-
private readControlEventId;
|
|
1111
|
-
private applyCanonicalRunIdentity;
|
|
1112
|
-
private isSocketReconnectExhaustedError;
|
|
1113
|
-
}
|
|
1114
|
-
//#endregion
|
|
1115
|
-
//#region src/utils/micro-redux.d.ts
|
|
1116
|
-
/**
|
|
1117
|
-
* The minimal action shape used by this micro-redux implementation.
|
|
1118
|
-
*/
|
|
1119
|
-
interface AnyAction {
|
|
1120
|
-
type: string;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* A typed action creator function with a `type` literal and runtime matcher.
|
|
1124
|
-
*/
|
|
1125
|
-
type ActionCreator<Type extends string, Args extends unknown[] = unknown[], Action extends AnyAction & {
|
|
1126
|
-
type: Type;
|
|
1127
|
-
} = {
|
|
1128
|
-
type: Type;
|
|
1129
|
-
}> = ((...args: Args) => Action) & {
|
|
1130
|
-
type: Type;
|
|
1131
|
-
match(action: AnyAction): action is Action;
|
|
1132
|
-
};
|
|
1133
|
-
/**
|
|
1134
|
-
* Extracts the action type produced by an action creator.
|
|
1135
|
-
*/
|
|
1136
|
-
type ActionFromCreator<T> = T extends ((...args: any[]) => infer A) ? A : never;
|
|
1137
|
-
/**
|
|
1138
|
-
* Extracts a union of actions produced by a tuple/array of action creators.
|
|
1139
|
-
*/
|
|
1140
|
-
type ActionFromCreators<Creators extends readonly ActionCreator<string, any[], any>[]> = ActionFromCreator<Creators[number]>;
|
|
1141
|
-
/**
|
|
1142
|
-
* A reducer transforms state in response to actions.
|
|
1143
|
-
*/
|
|
1144
|
-
type Reducer<State, Action extends AnyAction = AnyAction> = (state: State | undefined, action: Action) => State;
|
|
1145
|
-
/**
|
|
1146
|
-
* A selector derives a value from state.
|
|
1147
|
-
*/
|
|
1148
|
-
type Selector<State, Result> = (state: State) => Result;
|
|
1149
|
-
/**
|
|
1150
|
-
* Marker config for action creators that accept no payload.
|
|
1151
|
-
*/
|
|
1152
|
-
interface EmptyActionConfig {
|
|
1153
|
-
readonly kind: "empty";
|
|
1154
|
-
}
|
|
1155
|
-
declare const PROPS_MARKER: unique symbol;
|
|
1156
|
-
/**
|
|
1157
|
-
* Marker config for action creators that require payload props.
|
|
1158
|
-
*/
|
|
1159
|
-
interface PropsActionConfig<Props extends Record<string, unknown>> {
|
|
1160
|
-
readonly kind: "props";
|
|
1161
|
-
readonly [PROPS_MARKER]?: Props;
|
|
1162
|
-
}
|
|
1163
|
-
/**
|
|
1164
|
-
* Supported action creator config node in an action group.
|
|
1165
|
-
*/
|
|
1166
|
-
type ActionConfig = EmptyActionConfig | PropsActionConfig<Record<string, unknown>>;
|
|
1167
|
-
/**
|
|
1168
|
-
* Shape of an action group declaration object.
|
|
1169
|
-
*/
|
|
1170
|
-
type ActionGroupConfig = Record<string, ActionConfig>;
|
|
1171
|
-
/**
|
|
1172
|
-
* Maps an action group declaration to a strongly typed action-creator object.
|
|
1173
|
-
*/
|
|
1174
|
-
type ActionGroupResult<Source extends string, Config extends ActionGroupConfig> = { [K in keyof Config & string]: Config[K] extends PropsActionConfig<infer P> ? ActionCreator<`[${Source}] ${K}`, [P], {
|
|
1175
|
-
type: `[${Source}] ${K}`;
|
|
1176
|
-
} & P> : ActionCreator<`[${Source}] ${K}`, [], {
|
|
1177
|
-
type: `[${Source}] ${K}`;
|
|
1178
|
-
}> };
|
|
1179
|
-
interface OnReducerEntry<State, Action extends AnyAction = AnyAction, Creators extends readonly ActionCreator<string, any[], any>[] = readonly ActionCreator<string, any[], any>[]> {
|
|
1180
|
-
creators: Creators;
|
|
1181
|
-
reducer: (state: State, action: Action) => State;
|
|
1182
|
-
}
|
|
1183
|
-
type ActionFromOnReducerEntry<TEntry> = TEntry extends OnReducerEntry<any, infer TAction, any> ? TAction : never;
|
|
1184
|
-
/**
|
|
1185
|
-
* Effect contract for streams that emit actions to dispatch.
|
|
1186
|
-
*/
|
|
1187
|
-
interface DispatchingEffect<State, InputAction extends AnyAction = AnyAction, OutputAction extends AnyAction = AnyAction> {
|
|
1188
|
-
run: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<OutputAction>;
|
|
1189
|
-
dispatch: true;
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Effect contract for side-effect-only streams whose emissions are ignored.
|
|
1193
|
-
*/
|
|
1194
|
-
interface NonDispatchingEffect<State, InputAction extends AnyAction = AnyAction> {
|
|
1195
|
-
run: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<unknown>;
|
|
1196
|
-
dispatch: false;
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Union of supported effect shapes.
|
|
1200
|
-
*/
|
|
1201
|
-
type Effect<State, InputAction extends AnyAction = AnyAction, OutputAction extends AnyAction = AnyAction> = DispatchingEffect<State, InputAction, OutputAction> | NonDispatchingEffect<State, InputAction>;
|
|
1202
|
-
/**
|
|
1203
|
-
* Lifecycle actions dispatched by the store.
|
|
1204
|
-
*/
|
|
1205
|
-
type StoreLifecycleAction = {
|
|
1206
|
-
type: "@@micro-redux/init";
|
|
1207
|
-
} | {
|
|
1208
|
-
type: "@@micro-redux/stop";
|
|
1209
|
-
};
|
|
1210
|
-
/**
|
|
1211
|
-
* Options for a dispatching effect.
|
|
1212
|
-
*/
|
|
1213
|
-
interface DispatchingEffectOptions {
|
|
1214
|
-
dispatch?: true;
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
* Options for a non-dispatching effect.
|
|
1218
|
-
*/
|
|
1219
|
-
interface NonDispatchingEffectOptions {
|
|
1220
|
-
dispatch: false;
|
|
1221
|
-
}
|
|
1222
|
-
/**
|
|
1223
|
-
* Declares a payload-based action config for `createActionGroup`.
|
|
1224
|
-
*
|
|
1225
|
-
* @example
|
|
1226
|
-
* ```ts
|
|
1227
|
-
* const actions = createActionGroup("User", {
|
|
1228
|
-
* loaded: props<{ id: string }>(),
|
|
1229
|
-
* });
|
|
1230
|
-
* ```
|
|
1231
|
-
*/
|
|
1232
|
-
declare function props<Props extends Record<string, unknown>>(): PropsActionConfig<Props>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Declares a no-payload action config for `createActionGroup`.
|
|
1235
|
-
*
|
|
1236
|
-
* @example
|
|
1237
|
-
* ```ts
|
|
1238
|
-
* const actions = createActionGroup("User", {
|
|
1239
|
-
* reset: empty(),
|
|
1240
|
-
* });
|
|
1241
|
-
* ```
|
|
1242
|
-
*/
|
|
1243
|
-
declare function empty(): EmptyActionConfig;
|
|
1244
|
-
/**
|
|
1245
|
-
* Creates a namespaced group of typed action creators.
|
|
1246
|
-
*
|
|
1247
|
-
* Action types are formatted as: `[Source] actionName`.
|
|
1248
|
-
*/
|
|
1249
|
-
declare function createActionGroup<const Source extends string, const Config extends ActionGroupConfig>(source: Source, config: Config): ActionGroupResult<Source, Config>;
|
|
1250
|
-
/**
|
|
1251
|
-
* Registers one reducer handler for one or more action creators.
|
|
1252
|
-
*
|
|
1253
|
-
* @throws Error when called without at least one action creator and reducer.
|
|
1254
|
-
*/
|
|
1255
|
-
declare function on<State, const Creators extends readonly ActionCreator<string, any[], any>[], Action extends ActionFromCreators<Creators>>(...args: [...creators: Creators, reducer: (state: State, action: Action) => State]): OnReducerEntry<State, Action, Creators>;
|
|
1256
|
-
/**
|
|
1257
|
-
* Creates a reducer from an initial state and `on(...)` handler entries.
|
|
1258
|
-
*
|
|
1259
|
-
* Unknown action types return the current state unchanged.
|
|
1260
|
-
*/
|
|
1261
|
-
declare function createReducer<State, const Entries extends readonly OnReducerEntry<any, any, any>[]>(initialState: State, ...entries: Entries): Reducer<State, ActionFromOnReducerEntry<Entries[number]>>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Creates a memoized selector from a single projector.
|
|
1264
|
-
*/
|
|
1265
|
-
declare function createSelector<State, Result>(projector: (state: State) => Result): Selector<State, Result>;
|
|
1266
|
-
/**
|
|
1267
|
-
* Creates a memoized selector from input selectors and a projector.
|
|
1268
|
-
*
|
|
1269
|
-
* Memoization uses one-entry caching over the latest input selector values.
|
|
1270
|
-
*/
|
|
1271
|
-
declare function createSelector<State, const Selectors extends readonly Selector<State, unknown>[], Result>(...args: [...selectors: Selectors, projector: (...inputs: { [K in keyof Selectors]: ReturnType<Selectors[K]> }) => Result]): Selector<State, Result>;
|
|
1272
|
-
/**
|
|
1273
|
-
* RxJS operator that maps state emissions through a selector and suppresses
|
|
1274
|
-
* unchanged projected values via reference equality.
|
|
1275
|
-
*/
|
|
1276
|
-
declare function select<State, Result>(selector: Selector<State, Result>): OperatorFunction<State, Result>;
|
|
1277
|
-
/**
|
|
1278
|
-
* RxJS operator that filters an action stream by action creators and narrows
|
|
1279
|
-
* the output action type to the matched creator union.
|
|
1280
|
-
*
|
|
1281
|
-
* @throws Error when called without at least one action creator.
|
|
1282
|
-
*/
|
|
1283
|
-
declare function ofType<const Creators extends readonly ActionCreator<string, any[], AnyAction>[]>(...creators: Creators): OperatorFunction<AnyAction, ActionFromCreators<Creators>>;
|
|
1284
|
-
/**
|
|
1285
|
-
* Creates a dispatching effect. Emitted actions are automatically dispatched.
|
|
1286
|
-
*/
|
|
1287
|
-
declare function createEffect<State, InputAction extends AnyAction, OutputAction extends AnyAction>(factory: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<OutputAction>, options?: DispatchingEffectOptions): DispatchingEffect<State, InputAction, OutputAction>;
|
|
1288
|
-
/**
|
|
1289
|
-
* Creates a non-dispatching effect. Emitted values are ignored.
|
|
1290
|
-
*/
|
|
1291
|
-
declare function createEffect<State, InputAction extends AnyAction>(factory: (actions$: Observable<InputAction>, state$: Observable<State>) => Observable<unknown>, options: NonDispatchingEffectOptions): NonDispatchingEffect<State, InputAction>;
|
|
1292
|
-
/**
|
|
1293
|
-
* Store interface returned by `createStore`.
|
|
1294
|
-
*/
|
|
1295
|
-
interface Store<State, Action extends AnyAction = AnyAction> {
|
|
1296
|
-
dispatch(action: Action): void;
|
|
1297
|
-
getState(): State;
|
|
1298
|
-
readonly state$: Observable<State>;
|
|
1299
|
-
readonly actions$: Observable<Action | StoreLifecycleAction>;
|
|
1300
|
-
select<Result>(selector: Selector<State, Result>): Observable<Result>;
|
|
1301
|
-
init(): void;
|
|
1302
|
-
stop(): void;
|
|
1356
|
+
interface IntelligenceAgentConfig {
|
|
1357
|
+
/** Phoenix websocket URL, e.g. "ws://localhost:4000/socket" */
|
|
1358
|
+
url: string;
|
|
1359
|
+
/** Runtime REST URL, e.g. "http://localhost:4000" */
|
|
1360
|
+
runtimeUrl: string;
|
|
1361
|
+
/** Agent identifier for REST endpoints */
|
|
1362
|
+
agentId: string;
|
|
1363
|
+
/** Optional params sent on socket connect (e.g. auth token) */
|
|
1364
|
+
socketParams?: Record<string, string>;
|
|
1365
|
+
/** Optional headers sent with REST requests */
|
|
1366
|
+
headers?: Record<string, string>;
|
|
1367
|
+
/** Optional credentials mode for fetch requests */
|
|
1368
|
+
credentials?: RequestCredentials;
|
|
1369
|
+
}
|
|
1370
|
+
declare class IntelligenceAgent extends AbstractAgent {
|
|
1371
|
+
private config;
|
|
1372
|
+
private socket;
|
|
1373
|
+
private activeChannel;
|
|
1374
|
+
private canonicalRunId;
|
|
1375
|
+
private sharedState;
|
|
1376
|
+
constructor(config: IntelligenceAgentConfig, sharedState?: IntelligenceAgentSharedState);
|
|
1377
|
+
clone(): IntelligenceAgent;
|
|
1378
|
+
/**
|
|
1379
|
+
* Override of AbstractAgent.connectAgent that removes the `verifyEvents` step.
|
|
1380
|
+
*
|
|
1381
|
+
* Background: AbstractAgent's connectAgent pipeline runs events through
|
|
1382
|
+
* `verifyEvents`, which validates that the stream follows the AG-UI protocol
|
|
1383
|
+
* lifecycle — specifically, it expects a RUN_STARTED event before any content
|
|
1384
|
+
* events and a RUN_FINISHED/RUN_ERROR event to complete the stream.
|
|
1385
|
+
*
|
|
1386
|
+
* IntelligenceAgent uses long-lived WebSocket connections rather than
|
|
1387
|
+
* request-scoped SSE streams. When connecting to replay historical messages
|
|
1388
|
+
* for an existing thread, the connection semantics don't map to a single
|
|
1389
|
+
* agent run start/stop cycle. The replayed events may not include
|
|
1390
|
+
* RUN_STARTED/RUN_FINISHED bookends (or may contain events from multiple
|
|
1391
|
+
* past runs), which causes verifyEvents to either never complete or to
|
|
1392
|
+
* error out.
|
|
1393
|
+
*
|
|
1394
|
+
* This override replicates the base connectAgent implementation exactly,
|
|
1395
|
+
* substituting only `transformChunks` (which is still needed for message
|
|
1396
|
+
* reassembly) and omitting `verifyEvents`.
|
|
1397
|
+
*
|
|
1398
|
+
* TODO: Remove this override once AG-UI's AbstractAgent supports opting out
|
|
1399
|
+
* of verifyEvents for transports with different connection life-cycles.
|
|
1400
|
+
*/
|
|
1401
|
+
connectAgent(parameters?: RunAgentParameters, subscriber?: AgentSubscriber): Promise<RunAgentResult>;
|
|
1402
|
+
abortRun(): void;
|
|
1403
|
+
/**
|
|
1404
|
+
* Trigger the run via REST, then join the realtime thread channel and relay
|
|
1405
|
+
* server-pushed AG-UI events to the Observable subscriber.
|
|
1406
|
+
*/
|
|
1407
|
+
run(input: RunAgentInput): Observable<BaseEvent>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Reconnect to an existing thread by fetching websocket credentials and
|
|
1410
|
+
* joining the realtime thread channel.
|
|
1411
|
+
*/
|
|
1412
|
+
protected connect(input: RunAgentInput): Observable<BaseEvent>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Tear down a specific channel + socket pair that belongs to one pipeline.
|
|
1415
|
+
* Only nulls instance references when they still point to the owned resource,
|
|
1416
|
+
* so a concurrent pipeline's resources are never clobbered.
|
|
1417
|
+
*/
|
|
1418
|
+
private cleanupOwned;
|
|
1419
|
+
private cleanup;
|
|
1420
|
+
private requestJoinCredentials$;
|
|
1421
|
+
private normalizeJoinCredentials;
|
|
1422
|
+
private observeThread$;
|
|
1423
|
+
private observeThreadSession$;
|
|
1424
|
+
private joinThreadChannel$;
|
|
1425
|
+
private observeSocketHealth$;
|
|
1426
|
+
private observeThreadEvents$;
|
|
1427
|
+
private observeControlEvent$;
|
|
1428
|
+
private observeChannelEvent$;
|
|
1429
|
+
private createThreadNotifications;
|
|
1430
|
+
private buildRuntimeUrl;
|
|
1431
|
+
private createThreadChannelParams;
|
|
1432
|
+
private getLastSeenEventId;
|
|
1433
|
+
private getReconnectCursor;
|
|
1434
|
+
private clearReconnectCursor;
|
|
1435
|
+
private updateLastSeenEventId;
|
|
1436
|
+
private updateLastSeenEventIdFromControl;
|
|
1437
|
+
private readEventId;
|
|
1438
|
+
private readControlEventId;
|
|
1439
|
+
private applyCanonicalRunIdentity;
|
|
1440
|
+
private isSocketReconnectExhaustedError;
|
|
1303
1441
|
}
|
|
1304
|
-
/**
|
|
1305
|
-
* Creates a small observable store with reducer + effects.
|
|
1306
|
-
*
|
|
1307
|
-
* Behavior:
|
|
1308
|
-
* - `init()` starts effects and dispatches `@@micro-redux/init`.
|
|
1309
|
-
* - `stop()` dispatches `@@micro-redux/stop` and unsubscribes all effects.
|
|
1310
|
-
* - Effect action observation is scheduled on `asapScheduler` to avoid
|
|
1311
|
-
* synchronous re-entrancy in the effect loop.
|
|
1312
|
-
* - Any effect error triggers fail-fast teardown and errors both `actions$`
|
|
1313
|
-
* and `state$`.
|
|
1314
|
-
*/
|
|
1315
|
-
declare function createStore<State, Action extends AnyAction = AnyAction>(options: {
|
|
1316
|
-
reducer: Reducer<State, Action | StoreLifecycleAction>;
|
|
1317
|
-
effects?: Array<Effect<State, Action | StoreLifecycleAction, Action>>;
|
|
1318
|
-
}): Store<State, Action>;
|
|
1319
1442
|
//#endregion
|
|
1320
1443
|
//#region src/utils/phoenix-observable.d.ts
|
|
1321
1444
|
/**
|
|
@@ -1432,80 +1555,5 @@ declare function ɵobservePhoenixSocketSignals$(socket$: Observable<ɵPhoenixSoc
|
|
|
1432
1555
|
*/
|
|
1433
1556
|
declare function ɵobservePhoenixSocketHealth$(socketSignals$: Observable<ɵPhoenixSocketSignal>, maxConsecutiveErrors: number): Observable<never>;
|
|
1434
1557
|
//#endregion
|
|
1435
|
-
|
|
1436
|
-
interface ThreadRecord {
|
|
1437
|
-
id: string;
|
|
1438
|
-
organizationId: string;
|
|
1439
|
-
agentId: string;
|
|
1440
|
-
createdById: string;
|
|
1441
|
-
name: string | null;
|
|
1442
|
-
archived: boolean;
|
|
1443
|
-
createdAt: string;
|
|
1444
|
-
updatedAt: string;
|
|
1445
|
-
lastRunAt?: string;
|
|
1446
|
-
}
|
|
1447
|
-
interface ThreadRuntimeContext {
|
|
1448
|
-
runtimeUrl: string;
|
|
1449
|
-
headers: Record<string, string>;
|
|
1450
|
-
wsUrl?: string;
|
|
1451
|
-
agentId: string;
|
|
1452
|
-
includeArchived?: boolean;
|
|
1453
|
-
limit?: number;
|
|
1454
|
-
}
|
|
1455
|
-
type ThreadMetadataEvent = {
|
|
1456
|
-
operation: "created" | "renamed" | "archived" | "unarchived" | "updated";
|
|
1457
|
-
threadId: string;
|
|
1458
|
-
userId: string;
|
|
1459
|
-
organizationId: string;
|
|
1460
|
-
occurredAt: string;
|
|
1461
|
-
thread: ThreadRecord;
|
|
1462
|
-
} | {
|
|
1463
|
-
operation: "deleted";
|
|
1464
|
-
threadId: string;
|
|
1465
|
-
userId: string;
|
|
1466
|
-
organizationId: string;
|
|
1467
|
-
occurredAt: string;
|
|
1468
|
-
deleted: {
|
|
1469
|
-
id: string;
|
|
1470
|
-
};
|
|
1471
|
-
};
|
|
1472
|
-
interface ThreadEnvironment {
|
|
1473
|
-
fetch: typeof fetch;
|
|
1474
|
-
}
|
|
1475
|
-
interface ThreadState {
|
|
1476
|
-
threads: ThreadRecord[];
|
|
1477
|
-
isLoading: boolean;
|
|
1478
|
-
isFetchingNextPage: boolean;
|
|
1479
|
-
error: Error | null;
|
|
1480
|
-
context: ThreadRuntimeContext | null;
|
|
1481
|
-
sessionId: number;
|
|
1482
|
-
metadataCredentialsRequested: boolean;
|
|
1483
|
-
metadataJoinCode: string | null;
|
|
1484
|
-
nextCursor: string | null;
|
|
1485
|
-
}
|
|
1486
|
-
interface ThreadStore {
|
|
1487
|
-
start(): void;
|
|
1488
|
-
stop(): void;
|
|
1489
|
-
setContext(context: ThreadRuntimeContext | null): void;
|
|
1490
|
-
fetchNextPage(): void;
|
|
1491
|
-
renameThread(threadId: string, name: string): Promise<void>;
|
|
1492
|
-
archiveThread(threadId: string): Promise<void>;
|
|
1493
|
-
deleteThread(threadId: string): Promise<void>;
|
|
1494
|
-
getState(): ThreadState;
|
|
1495
|
-
select: Store<ThreadState>["select"];
|
|
1496
|
-
}
|
|
1497
|
-
declare function createThreadStore(environment: ThreadEnvironment): ThreadStore;
|
|
1498
|
-
type ɵThread = ThreadRecord;
|
|
1499
|
-
type ɵThreadRuntimeContext = ThreadRuntimeContext;
|
|
1500
|
-
type ɵThreadMetadataEvent = ThreadMetadataEvent;
|
|
1501
|
-
type ɵThreadEnvironment = ThreadEnvironment;
|
|
1502
|
-
type ɵThreadStore = ThreadStore;
|
|
1503
|
-
declare const ɵthreadAdapterEvents: any;
|
|
1504
|
-
declare const ɵselectThreads: any;
|
|
1505
|
-
declare const ɵselectThreadsIsLoading: any;
|
|
1506
|
-
declare const ɵselectThreadsError: any;
|
|
1507
|
-
declare const ɵselectHasNextPage: any;
|
|
1508
|
-
declare const ɵselectIsFetchingNextPage: any;
|
|
1509
|
-
//#endregion
|
|
1510
|
-
export { ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, type CopilotKitCoreRunToolParams, type CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, IntelligenceAgent, IntelligenceAgentConfig, type IntelligenceRuntimeInfo, NonDispatchingEffect, NonDispatchingEffectOptions, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunHandler, type RuntimeLicenseStatus, type RuntimeMode, Selector, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, ToolCallStatus, completePartialMarkdown, createActionGroup, createEffect, createReducer, createSelector, createStore, empty, ensureObjectArgs, ofType, on, parseToolArguments, props, select, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadStore, createThreadStore as ɵcreateThreadStore, ɵjoinPhoenixChannel$, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents };
|
|
1558
|
+
export { ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, type CopilotKitCoreRunToolParams, type CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, IntelligenceAgent, IntelligenceAgentConfig, type IntelligenceRuntimeInfo, NonDispatchingEffect, NonDispatchingEffectOptions, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunHandler, type RuntimeLicenseStatus, type RuntimeMode, Selector, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, ToolCallStatus, completePartialMarkdown, createActionGroup, createEffect, createReducer, createSelector, createStore, empty, ensureObjectArgs, ofType, on, parseToolArguments, props, select, ɵMAX_SOCKET_RETRIES, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadStore, createThreadStore as ɵcreateThreadStore, ɵjoinPhoenixChannel$, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents };
|
|
1511
1559
|
//# sourceMappingURL=index.d.cts.map
|