@automattic/agenttic-client 0.1.0 → 0.1.2
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/auth/jetpack.d.ts +77 -0
- package/dist/auth/jetpack.d.ts.map +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types/index.d.ts +192 -0
- package/dist/client/types/index.d.ts.map +1 -0
- package/dist/client/utils/core.d.ts +82 -0
- package/dist/client/utils/core.d.ts.map +1 -0
- package/dist/client/utils/index.d.ts +8 -0
- package/dist/client/utils/index.d.ts.map +1 -0
- package/dist/client/utils/internal/errors.d.ts +43 -0
- package/dist/client/utils/internal/errors.d.ts.map +1 -0
- package/dist/client/utils/internal/messages.d.ts +27 -0
- package/dist/client/utils/internal/messages.d.ts.map +1 -0
- package/dist/client/utils/internal/requests.d.ts +54 -0
- package/dist/client/utils/internal/requests.d.ts.map +1 -0
- package/dist/client/utils/internal/streaming.d.ts +23 -0
- package/dist/client/utils/internal/streaming.d.ts.map +1 -0
- package/dist/client/utils/internal/tools.d.ts +16 -0
- package/dist/client/utils/internal/tools.d.ts.map +1 -0
- package/dist/client/utils/logger.d.ts +7 -0
- package/dist/client/utils/logger.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +146 -0
- package/dist/markdown-extensions/charts/BarChart.d.ts +16 -0
- package/dist/markdown-extensions/charts/BarChart.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/BaseChart.d.ts +36 -0
- package/dist/markdown-extensions/charts/BaseChart.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/ChartBlock.d.ts +34 -0
- package/dist/markdown-extensions/charts/ChartBlock.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/ChartError.d.ts +17 -0
- package/dist/markdown-extensions/charts/ChartError.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/ChartErrorBoundary.d.ts +30 -0
- package/dist/markdown-extensions/charts/ChartErrorBoundary.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/LineChart.d.ts +14 -0
- package/dist/markdown-extensions/charts/LineChart.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/index.d.ts +293 -0
- package/dist/markdown-extensions/charts/index.d.ts.map +1 -0
- package/dist/markdown-extensions/charts/utils/chartUtils.d.ts +56 -0
- package/dist/markdown-extensions/charts/utils/chartUtils.d.ts.map +1 -0
- package/dist/markdown-extensions/index.d.ts +34 -0
- package/dist/markdown-extensions/index.d.ts.map +1 -0
- package/dist/markdown-extensions/types.d.ts +52 -0
- package/dist/markdown-extensions/types.d.ts.map +1 -0
- package/dist/message-actions/factories.d.ts +16 -0
- package/dist/message-actions/index.d.ts +5 -0
- package/dist/message-actions/resolver.d.ts +9 -0
- package/dist/message-actions/useMessageActions.d.ts +9 -0
- package/dist/mocks/MockSalesGraph.d.ts +13 -0
- package/dist/mocks/MockSalesGraph.d.ts.map +1 -0
- package/dist/mocks/index.d.ts +12 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/mockContext.d.ts +187 -0
- package/dist/mocks/mockContext.d.ts.map +1 -0
- package/dist/mocks/mockTools.d.ts +44 -0
- package/dist/mocks/mockTools.d.ts.map +1 -0
- package/dist/react/agentManager.d.ts +27 -0
- package/dist/react/conversationStorage.d.ts +29 -0
- package/dist/react/conversationStorage.d.ts.map +1 -0
- package/dist/react/conversationUtils.d.ts +32 -0
- package/dist/react/conversationUtils.d.ts.map +1 -0
- package/dist/react/useAgentChat.d.ts +97 -0
- package/dist/react/useClientContext.d.ts +17 -0
- package/dist/react/useClientContext.d.ts.map +1 -0
- package/dist/react/useClientTools.d.ts +23 -0
- package/dist/react/useClientTools.d.ts.map +1 -0
- package/dist/utils/createMessageRenderer.d.ts +25 -0
- package/dist/utils/createMessageRenderer.d.ts.map +1 -0
- package/dist/utils/markdownParser.d.ts +25 -0
- package/dist/utils/markdownParser.d.ts.map +1 -0
- package/dist/utils/theme.d.ts +8 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/package.json +81 -73
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for chart components
|
|
3
|
+
*/
|
|
4
|
+
import type { SeriesData } from '@automattic/charts';
|
|
5
|
+
/**
|
|
6
|
+
* Calculate bottom margin for charts based on data and display requirements
|
|
7
|
+
* @param minMargin - Minimum margin to apply
|
|
8
|
+
* @param charWidth - Average character width for calculations
|
|
9
|
+
* @param padding - Additional padding
|
|
10
|
+
* @param labelLength - Optional label length for custom calculations
|
|
11
|
+
* @return Calculated bottom margin
|
|
12
|
+
*/
|
|
13
|
+
export declare const calculateBottomMargin: (minMargin?: number, charWidth?: number, padding?: number, labelLength?: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Generate time axis configuration for charts with date data
|
|
16
|
+
* @param data - Chart series data
|
|
17
|
+
* @return Axis configuration object
|
|
18
|
+
*/
|
|
19
|
+
export declare const getTimeAxisConfig: (data: SeriesData[]) => {
|
|
20
|
+
orientation?: undefined;
|
|
21
|
+
tickValues?: undefined;
|
|
22
|
+
tickFormat?: undefined;
|
|
23
|
+
tickLabelProps?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
orientation: "bottom";
|
|
26
|
+
tickValues: Date[];
|
|
27
|
+
tickFormat: (value: Date | string | number) => string;
|
|
28
|
+
tickLabelProps: () => {
|
|
29
|
+
fontSize: number;
|
|
30
|
+
textAnchor: "end";
|
|
31
|
+
angle: number;
|
|
32
|
+
dx: number;
|
|
33
|
+
dy: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Generate default chart margins with calculated bottom margin
|
|
38
|
+
* @param customMargin - Optional custom margin overrides
|
|
39
|
+
* @param customMargin.top - Top margin override
|
|
40
|
+
* @param customMargin.right - Right margin override
|
|
41
|
+
* @param customMargin.bottom - Bottom margin override
|
|
42
|
+
* @param customMargin.left - Left margin override
|
|
43
|
+
* @return Complete margin configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare const getDefaultChartMargins: (customMargin?: {
|
|
46
|
+
top?: number;
|
|
47
|
+
right?: number;
|
|
48
|
+
bottom?: number;
|
|
49
|
+
left?: number;
|
|
50
|
+
}) => {
|
|
51
|
+
bottom: number;
|
|
52
|
+
top: number;
|
|
53
|
+
right: number;
|
|
54
|
+
left: number;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=chartUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartUtils.d.ts","sourceRoot":"","sources":["../../../../src/markdown-extensions/charts/utils/chartUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GACjC,YAAW,MAAW,EACtB,YAAW,MAAU,EACrB,UAAS,MAAW,EACpB,cAAc,MAAM,KAClB,MAGF,CAAC;AAsBF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAK,MAAM,UAAU,EAAE;;;;;;;;wBAuD9B,IAAI,GAAG,MAAM,GAAG,MAAM;;;;;;;;CA+B5C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAK,eAAe;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;;SAJM,MAAM;WACJ,MAAM;UAEP,MAAM;CAcb,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Extensions Processor
|
|
3
|
+
*
|
|
4
|
+
* This module handles the processing of markdown extensions for agenttic-client.
|
|
5
|
+
* It provides a centralized way to register and process different types of
|
|
6
|
+
* markdown extensions like charts, tables, forms, etc.
|
|
7
|
+
*/
|
|
8
|
+
import type { Components } from 'react-markdown';
|
|
9
|
+
import type { PluggableList } from 'unified';
|
|
10
|
+
import type { MarkdownExtensions } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Result of processing markdown extensions
|
|
13
|
+
*/
|
|
14
|
+
export interface ProcessedMarkdownExtensions {
|
|
15
|
+
components: Components;
|
|
16
|
+
remarkPlugins: PluggableList;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Process markdown extensions and return components and plugins for react-markdown
|
|
20
|
+
* @param extensions - The markdown extensions configuration
|
|
21
|
+
* @return An object containing react-markdown components and remark plugins for the enabled extensions
|
|
22
|
+
*/
|
|
23
|
+
export declare function processMarkdownExtensions(extensions?: MarkdownExtensions): ProcessedMarkdownExtensions;
|
|
24
|
+
/**
|
|
25
|
+
* Merge extension components with user-provided markdown components
|
|
26
|
+
* User components take precedence over extension components
|
|
27
|
+
* @param extensionComponents - Components from extensions
|
|
28
|
+
* @param userComponents - User-provided components
|
|
29
|
+
* @return Merged components object
|
|
30
|
+
*/
|
|
31
|
+
export declare function mergeMarkdownComponents(extensionComponents: Components, userComponents?: Components): Components;
|
|
32
|
+
export type { DataPointDate } from '@automattic/charts';
|
|
33
|
+
export type { ChartData, ChartExtensionConfig, ChartSeries, MarkdownExtensionConfigBase, MarkdownExtensions, } from './types';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown-extensions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACxC,UAAU,CAAC,EAAE,kBAAkB,GAC7B,2BAA2B,CAe7B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,mBAAmB,EAAE,UAAU,EAC/B,cAAc,GAAE,UAAe,GAC7B,UAAU,CAKZ;AAGD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EACX,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,2BAA2B,EAC3B,kBAAkB,GAClB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for markdown extensions
|
|
3
|
+
*/
|
|
4
|
+
import type { CurrencyOptions } from './charts/BaseChart';
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for all markdown extension configurations
|
|
7
|
+
* All extensionshave an enabled flag and can add specific configuration options
|
|
8
|
+
* in their respective interfaces.
|
|
9
|
+
*/
|
|
10
|
+
export interface MarkdownExtensionConfigBase {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for chart extension
|
|
15
|
+
*/
|
|
16
|
+
export interface ChartExtensionConfig extends MarkdownExtensionConfigBase {
|
|
17
|
+
config?: {};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for GitHub Flavored Markdown extension
|
|
21
|
+
* Enables tables, strikethrough, task lists, and other GFM features
|
|
22
|
+
*/
|
|
23
|
+
export interface GfmExtensionConfig extends MarkdownExtensionConfigBase {
|
|
24
|
+
config?: {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for all available markdown extensions
|
|
28
|
+
*/
|
|
29
|
+
export interface MarkdownExtensions {
|
|
30
|
+
charts?: ChartExtensionConfig;
|
|
31
|
+
gfm?: GfmExtensionConfig;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Chart data structures as provided in JSON format
|
|
35
|
+
*/
|
|
36
|
+
export interface ChartDataPoint {
|
|
37
|
+
date?: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
value: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ChartSeries {
|
|
42
|
+
label: string;
|
|
43
|
+
data: ChartDataPoint[];
|
|
44
|
+
}
|
|
45
|
+
export interface ChartData {
|
|
46
|
+
chartType: 'line' | 'bar';
|
|
47
|
+
title?: string;
|
|
48
|
+
data: ChartSeries[];
|
|
49
|
+
currency?: CurrencyOptions;
|
|
50
|
+
mode?: 'time-comparison' | 'item-comparison';
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/markdown-extensions/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,2BAA2B;IACxE,MAAM,CAAC,EAAE,EAER,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,2BAA2B;IACtE,MAAM,CAAC,EAAE,EAER,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,GAAG,CAAC,EAAE,kBAAkB,CAAC;CAEzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACzB,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,IAAI,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;CAC7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FeedbackActionsConfig, MessageActionDefinition, UIMessage } from '../react/useAgentChat';
|
|
2
|
+
export interface FeedbackActionsManager {
|
|
3
|
+
getActionsForMessage: (message: UIMessage) => MessageActionDefinition[];
|
|
4
|
+
clearFeedback: (messageId: string) => void;
|
|
5
|
+
clearAllFeedback: () => void;
|
|
6
|
+
onChange: (listener: () => void) => void;
|
|
7
|
+
offChange: (listener: () => void) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a stateful feedback actions manager that tracks feedback state internally
|
|
11
|
+
*
|
|
12
|
+
* @param config - Configuration for feedback actions
|
|
13
|
+
* @return FeedbackActionsManager with methods to get actions and manage state
|
|
14
|
+
*/
|
|
15
|
+
export declare const createFeedbackActions: (config: FeedbackActionsConfig) => FeedbackActionsManager;
|
|
16
|
+
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MessageActionsRegistration, UIMessage, UIMessageAction } from '../react/useAgentChat';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves message actions for a specific message
|
|
4
|
+
* Evaluates dynamic conditions and filters out actions
|
|
5
|
+
* @param message
|
|
6
|
+
* @param registrations
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveActionsForMessage(message: UIMessage, registrations: MessageActionsRegistration[]): UIMessageAction[];
|
|
9
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MessageActionsRegistration, UseMessageActionsReturn } from '../react/useAgentChat';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for managing message actions registrations
|
|
4
|
+
* Provides methods to register, unregister, and create message actions
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMessageActions(): UseMessageActionsReturn & {
|
|
7
|
+
registrations: MessageActionsRegistration[];
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useMessageActions.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SalesData {
|
|
3
|
+
product: string;
|
|
4
|
+
sales: number;
|
|
5
|
+
}
|
|
6
|
+
interface MockSalesGraphProps {
|
|
7
|
+
title: string;
|
|
8
|
+
data: SalesData[];
|
|
9
|
+
timeframe?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const MockSalesGraph: React.FC<MockSalesGraphProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=MockSalesGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockSalesGraph.d.ts","sourceRoot":"","sources":["../../src/mocks/MockSalesGraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,SAAS;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAE,mBAAmB,CA6BzD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Mock implementations for development and testing
|
|
3
|
+
*
|
|
4
|
+
* This module exports mock implementations that should only be used
|
|
5
|
+
* in development, testing, and demo applications. These exports are
|
|
6
|
+
* intentionally separated from the main package entry point to prevent
|
|
7
|
+
* them from being bundled in production applications.
|
|
8
|
+
*/
|
|
9
|
+
export { getClientContext } from './mockContext';
|
|
10
|
+
export { getClientTools } from './mockTools';
|
|
11
|
+
export { MockSalesGraph } from './MockSalesGraph';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export declare const getClientContext: () => {
|
|
2
|
+
selectedBlockClientId: string;
|
|
3
|
+
currentPageContent: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
clientId: string;
|
|
7
|
+
innerBlocks: {
|
|
8
|
+
clientId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
originalContent: string;
|
|
12
|
+
validationIssues: never[];
|
|
13
|
+
attributes: {
|
|
14
|
+
tagName: string;
|
|
15
|
+
metadata: {
|
|
16
|
+
name: string;
|
|
17
|
+
patternCategory: string;
|
|
18
|
+
remotePatternId: number;
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
align: string;
|
|
22
|
+
className: string;
|
|
23
|
+
style: {
|
|
24
|
+
spacing: {
|
|
25
|
+
margin: {
|
|
26
|
+
top: string;
|
|
27
|
+
bottom: string;
|
|
28
|
+
};
|
|
29
|
+
padding: {
|
|
30
|
+
top: string;
|
|
31
|
+
bottom: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
layout: {
|
|
36
|
+
type: string;
|
|
37
|
+
justifyContent: string;
|
|
38
|
+
};
|
|
39
|
+
anchor: string;
|
|
40
|
+
};
|
|
41
|
+
innerBlocks: {
|
|
42
|
+
clientId: string;
|
|
43
|
+
name: string;
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
originalContent: string;
|
|
46
|
+
validationIssues: never[];
|
|
47
|
+
attributes: {
|
|
48
|
+
tagName: string;
|
|
49
|
+
metadata: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
52
|
+
align: string;
|
|
53
|
+
style: {
|
|
54
|
+
spacing: {
|
|
55
|
+
blockGap: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
layout: {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
innerBlocks: ({
|
|
63
|
+
clientId: string;
|
|
64
|
+
name: string;
|
|
65
|
+
isValid: boolean;
|
|
66
|
+
originalContent: string;
|
|
67
|
+
validationIssues: never[];
|
|
68
|
+
attributes: {
|
|
69
|
+
verticalAlignment: string;
|
|
70
|
+
isStackedOnMobile: boolean;
|
|
71
|
+
align: string;
|
|
72
|
+
style: {
|
|
73
|
+
spacing: {
|
|
74
|
+
blockGap: {
|
|
75
|
+
top: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
url?: undefined;
|
|
80
|
+
alt?: undefined;
|
|
81
|
+
caption?: undefined;
|
|
82
|
+
id?: undefined;
|
|
83
|
+
sizeSlug?: undefined;
|
|
84
|
+
linkDestination?: undefined;
|
|
85
|
+
className?: undefined;
|
|
86
|
+
};
|
|
87
|
+
innerBlocks: ({
|
|
88
|
+
clientId: string;
|
|
89
|
+
name: string;
|
|
90
|
+
isValid: boolean;
|
|
91
|
+
originalContent: string;
|
|
92
|
+
validationIssues: never[];
|
|
93
|
+
attributes: {
|
|
94
|
+
verticalAlignment: string;
|
|
95
|
+
width: string;
|
|
96
|
+
layout: {
|
|
97
|
+
type: string;
|
|
98
|
+
justifyContent: string;
|
|
99
|
+
contentSize: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
innerBlocks: {
|
|
103
|
+
clientId: string;
|
|
104
|
+
name: string;
|
|
105
|
+
isValid: boolean;
|
|
106
|
+
originalContent: string;
|
|
107
|
+
validationIssues: never[];
|
|
108
|
+
attributes: {
|
|
109
|
+
content: string;
|
|
110
|
+
level: number;
|
|
111
|
+
};
|
|
112
|
+
innerBlocks: never[];
|
|
113
|
+
}[];
|
|
114
|
+
} | {
|
|
115
|
+
clientId: string;
|
|
116
|
+
name: string;
|
|
117
|
+
isValid: boolean;
|
|
118
|
+
originalContent: string;
|
|
119
|
+
validationIssues: never[];
|
|
120
|
+
attributes: {
|
|
121
|
+
verticalAlignment: string;
|
|
122
|
+
width: string;
|
|
123
|
+
layout?: undefined;
|
|
124
|
+
};
|
|
125
|
+
innerBlocks: ({
|
|
126
|
+
clientId: string;
|
|
127
|
+
name: string;
|
|
128
|
+
isValid: boolean;
|
|
129
|
+
originalContent: string;
|
|
130
|
+
validationIssues: never[];
|
|
131
|
+
attributes: {
|
|
132
|
+
content: string;
|
|
133
|
+
dropCap: boolean;
|
|
134
|
+
};
|
|
135
|
+
innerBlocks: never[];
|
|
136
|
+
} | {
|
|
137
|
+
clientId: string;
|
|
138
|
+
name: string;
|
|
139
|
+
isValid: boolean;
|
|
140
|
+
originalContent: string;
|
|
141
|
+
validationIssues: never[];
|
|
142
|
+
attributes: {
|
|
143
|
+
content?: undefined;
|
|
144
|
+
dropCap?: undefined;
|
|
145
|
+
};
|
|
146
|
+
innerBlocks: {
|
|
147
|
+
clientId: string;
|
|
148
|
+
name: string;
|
|
149
|
+
isValid: boolean;
|
|
150
|
+
originalContent: string;
|
|
151
|
+
validationIssues: never[];
|
|
152
|
+
attributes: {
|
|
153
|
+
tagName: string;
|
|
154
|
+
type: string;
|
|
155
|
+
url: string;
|
|
156
|
+
text: string;
|
|
157
|
+
};
|
|
158
|
+
innerBlocks: never[];
|
|
159
|
+
}[];
|
|
160
|
+
})[];
|
|
161
|
+
})[];
|
|
162
|
+
} | {
|
|
163
|
+
clientId: string;
|
|
164
|
+
name: string;
|
|
165
|
+
isValid: boolean;
|
|
166
|
+
originalContent: string;
|
|
167
|
+
validationIssues: never[];
|
|
168
|
+
attributes: {
|
|
169
|
+
url: string;
|
|
170
|
+
alt: string;
|
|
171
|
+
caption: string;
|
|
172
|
+
id: number;
|
|
173
|
+
sizeSlug: string;
|
|
174
|
+
linkDestination: string;
|
|
175
|
+
align: string;
|
|
176
|
+
className: string;
|
|
177
|
+
verticalAlignment?: undefined;
|
|
178
|
+
isStackedOnMobile?: undefined;
|
|
179
|
+
style?: undefined;
|
|
180
|
+
};
|
|
181
|
+
innerBlocks: never[];
|
|
182
|
+
})[];
|
|
183
|
+
}[];
|
|
184
|
+
}[];
|
|
185
|
+
}[];
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=mockContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockContext.d.ts","sourceRoot":"","sources":["../../src/mocks/mockContext.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+M5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const getClientTools: (addMessage: (message: any) => void) => {
|
|
2
|
+
getAvailableTools: () => Promise<{
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
type: "string";
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
timeframe: {
|
|
14
|
+
type: "string";
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
data: {
|
|
18
|
+
type: "array";
|
|
19
|
+
description: string;
|
|
20
|
+
items: {
|
|
21
|
+
type: "object";
|
|
22
|
+
properties: {
|
|
23
|
+
product: {
|
|
24
|
+
type: "string";
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
sales: {
|
|
28
|
+
type: "number";
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
required: string[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
required: string[];
|
|
37
|
+
};
|
|
38
|
+
}[]>;
|
|
39
|
+
executeTool: (toolId: string, args: any, messageId: string, toolCallId: string) => Promise<{
|
|
40
|
+
result: string;
|
|
41
|
+
returnToAgent: boolean;
|
|
42
|
+
} | undefined>;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=mockTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockTools.d.ts","sourceRoot":"","sources":["../../src/mocks/mockTools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAK,YAAY,CAAE,OAAO,EAAE,GAAG,KAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA8CzD,MAAM,QACR,GAAG,aACE,MAAM,cACL,MAAM;;;;CA8CpB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Client, ClientConfig, Message, SendMessageParams, Task, TaskUpdate } from '../client/types/index';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for agent manager
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentManagerConfig extends ClientConfig {
|
|
6
|
+
key?: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Agent manager interface
|
|
11
|
+
*/
|
|
12
|
+
export interface AgentManager {
|
|
13
|
+
createAgent: (key: string, config: AgentManagerConfig) => Promise<Client>;
|
|
14
|
+
getAgent: (key: string) => Client | null;
|
|
15
|
+
hasAgent: (key: string) => boolean;
|
|
16
|
+
removeAgent: (key: string) => boolean;
|
|
17
|
+
sendMessage: (key: string, message: string, options?: Partial<SendMessageParams>) => Promise<Task>;
|
|
18
|
+
sendMessageStream: (key: string, message: string, options?: Partial<SendMessageParams>) => AsyncIterable<TaskUpdate>;
|
|
19
|
+
resetConversation: (key: string) => Promise<void>;
|
|
20
|
+
getConversationHistory: (key: string) => Message[];
|
|
21
|
+
clear: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the global agent manager instance
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAgentManager(): AgentManager;
|
|
27
|
+
//# sourceMappingURL=agentManager.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Message } from '../client/types/index';
|
|
2
|
+
/**
|
|
3
|
+
* Store conversation messages for a session
|
|
4
|
+
* @param sessionId - The session ID to store messages for
|
|
5
|
+
* @param messages - The array of messages to store
|
|
6
|
+
* @param conversationStorageKey - Optional custom storage key, defaults to sessionId
|
|
7
|
+
*/
|
|
8
|
+
export declare function storeConversation(sessionId: string, messages: Message[], conversationStorageKey?: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Load conversation messages for a session
|
|
11
|
+
* @param sessionId - The session ID to load messages for
|
|
12
|
+
* @param conversationStorageKey - Optional custom storage key, defaults to sessionId
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadConversation(sessionId: string, conversationStorageKey?: string): Promise<Message[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Clear conversation for a session
|
|
17
|
+
* @param sessionId - The session ID to clear
|
|
18
|
+
* @param conversationStorageKey - Optional custom storage key, defaults to sessionId
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearConversation(sessionId: string, conversationStorageKey?: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Clear all stored conversations
|
|
23
|
+
*/
|
|
24
|
+
export declare function clearAllConversations(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Get list of stored conversation session IDs
|
|
27
|
+
*/
|
|
28
|
+
export declare function getStoredSessionIds(): Promise<string[]>;
|
|
29
|
+
//# sourceMappingURL=conversationStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationStorage.d.ts","sourceRoot":"","sources":["../../src/react/conversationStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,OAAO,EAAY,MAAM,uBAAuB,CAAC;AAoJzE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAE,IAAI,CAAE,CA2CjB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,SAAS,EAAE,MAAM,EACjB,sBAAsB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAE,OAAO,EAAE,CAAE,CAuCtB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,sBAAsB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAE,IAAI,CAAE,CAsBjB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAE,IAAI,CAAE,CA+B7D;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAE,MAAM,EAAE,CAAE,CA8B/D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DataPart, Message } from '../client/types/index';
|
|
2
|
+
/**
|
|
3
|
+
* Extract only the new content (non-history) parts from a message
|
|
4
|
+
* This helps avoid storing history data parts in conversation history
|
|
5
|
+
*
|
|
6
|
+
* @param message - The message to extract new content from
|
|
7
|
+
* @return A clean message with only new content parts
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractNewContentFromMessage(message: Message): Message;
|
|
10
|
+
/**
|
|
11
|
+
* Convert conversation messages to data parts for history
|
|
12
|
+
*
|
|
13
|
+
* @param conversationMessages - Array of previous conversation messages
|
|
14
|
+
* @return Array of data parts representing conversation history
|
|
15
|
+
*/
|
|
16
|
+
export declare function conversationMessagesToDataParts(conversationMessages: Message[]): DataPart[];
|
|
17
|
+
/**
|
|
18
|
+
* Create A2A message with conversation history from Message array
|
|
19
|
+
*
|
|
20
|
+
* @param text - The user text message to send
|
|
21
|
+
* @param conversationMessages - Array of previous conversation messages
|
|
22
|
+
* @return A2A Message with history and current text
|
|
23
|
+
*/
|
|
24
|
+
export declare function createTextMessageWithHistory(text: string, conversationMessages?: Message[]): Message;
|
|
25
|
+
/**
|
|
26
|
+
* Extract tool results from a message
|
|
27
|
+
*
|
|
28
|
+
* @param message - The message to check for tool results
|
|
29
|
+
* @return Array of tool result parts
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractToolResultsFromMessage(message?: Message): DataPart[];
|
|
32
|
+
//# sourceMappingURL=conversationUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationUtils.d.ts","sourceRoot":"","sources":["../../src/react/conversationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAY,MAAM,uBAAuB,CAAC;AAGzE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAE,OAAO,EAAE,OAAO,GAAI,OAAO,CAqCxE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC9C,oBAAoB,EAAE,OAAO,EAAE,GAC7B,QAAQ,EAAE,CAuCZ;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,MAAM,EACZ,oBAAoB,GAAE,OAAO,EAAO,GAClC,OAAO,CAmBT;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAE,OAAO,CAAC,EAAE,OAAO,GAAI,QAAQ,EAAE,CAW7E"}
|