@automattic/agenttic-client 0.1.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/README.md +409 -0
- package/dist/MockSalesGraph-ORPXGMCD.js +7 -0
- package/dist/chunk-LAB4XYXR.js +688 -0
- package/dist/chunk-ZDG7Y2LU.js +39 -0
- package/dist/client/index.d.ts +44 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2137 -0
- package/dist/message-actions/factories.d.ts.map +1 -0
- package/dist/message-actions/index.d.ts.map +1 -0
- package/dist/message-actions/resolver.d.ts.map +1 -0
- package/dist/message-actions/useMessageActions.d.ts.map +1 -0
- package/dist/mocks/index.js +288 -0
- package/dist/react/agentManager.d.ts.map +1 -0
- package/dist/react/useAgentChat.d.ts.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BarChart
|
|
3
|
+
} from "./chunk-LAB4XYXR.js";
|
|
4
|
+
|
|
5
|
+
// src/mocks/MockSalesGraph.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var MockSalesGraph = ({
|
|
8
|
+
title,
|
|
9
|
+
data,
|
|
10
|
+
timeframe
|
|
11
|
+
}) => {
|
|
12
|
+
const chartData = [
|
|
13
|
+
{
|
|
14
|
+
name: title,
|
|
15
|
+
label: title,
|
|
16
|
+
// SeriesData requires a label property
|
|
17
|
+
data: data.map((item) => ({
|
|
18
|
+
label: item.product,
|
|
19
|
+
value: item.sales
|
|
20
|
+
}))
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
const totalSales = data.reduce((sum, item) => sum + item.sales, 0);
|
|
24
|
+
const avgSales = Math.round(totalSales / data.length);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
BarChart,
|
|
27
|
+
{
|
|
28
|
+
data: chartData,
|
|
29
|
+
mode: "item-comparison",
|
|
30
|
+
truncateLabels: true,
|
|
31
|
+
maxLabelLength: 15,
|
|
32
|
+
showLegend: false
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
MockSalesGraph
|
|
39
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Client, ClientConfig, SendMessageParams, TaskUpdate } from './types/index';
|
|
2
|
+
/**
|
|
3
|
+
* Create an agent client instance
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const toolProvider: ToolProvider = {
|
|
8
|
+
* async getAvailableTools() {
|
|
9
|
+
* return [{ id: 'calculator', name: 'Calculator', description: 'Perform calculations', input_schema: { type: 'object', properties: {} } }];
|
|
10
|
+
* },
|
|
11
|
+
* async executeTool(toolId: string, args: any) {
|
|
12
|
+
* if (toolId === 'calculator') {
|
|
13
|
+
* return { result: calc(args.expression) };
|
|
14
|
+
* }
|
|
15
|
+
* throw new Error(`Unknown tool: ${toolId}`);
|
|
16
|
+
* }
|
|
17
|
+
* // Tool results are automatically sent back to agent with conversation history
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* const client = createClient({
|
|
21
|
+
* agentId: 'big-sky',
|
|
22
|
+
* toolProvider
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Send a message - tools are handled automatically
|
|
26
|
+
* const response = await client.sendMessage({ message, sessionId });
|
|
27
|
+
*
|
|
28
|
+
* // Handle human input requests (no tool calls in input-required state)
|
|
29
|
+
* if (response.status.state === 'input-required') {
|
|
30
|
+
* const userInput = await promptUser(response.status.message);
|
|
31
|
+
* const finalResponse = await client.continueTask(response.id, userInput, sessionId);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param config
|
|
36
|
+
*/
|
|
37
|
+
export declare function createClient(config: ClientConfig): Client;
|
|
38
|
+
/**
|
|
39
|
+
* Helper function to send a message and wait for completion
|
|
40
|
+
* @param client
|
|
41
|
+
* @param params
|
|
42
|
+
*/
|
|
43
|
+
export declare function sendMessageAndWait(client: Client, params: SendMessageParams): Promise<TaskUpdate>;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EAGZ,iBAAiB,EAEjB,UAAU,EAIV,MAAM,eAAe,CAAC;AAymBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,YAAY,CAAE,MAAM,EAAE,YAAY,GAAI,MAAM,CA+T3D;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,iBAAiB,GACvB,OAAO,CAAE,UAAU,CAAE,CAavB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EACN,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,YAAY,EAEX,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,OAAO,EACP,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,iBAAiB,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