@handsforbots/copilotkit 0.0.0-stage → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/README.md +22 -2
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 Alex Lana and Hands for Bots contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @handsforbots/copilotkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
UI. CopilotKit bridge for Hands for Bots: actions as frontend tools, context, and voice/menu/sensor input through the CopilotKit agent.
|
|
4
|
+
|
|
5
|
+
Part of [Hands for Bots](https://github.com/handsforbots/handsforbots), a headless multimodal and action layer between users, GUIs and agents.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @handsforbots/copilotkit@alpha @handsforbots/core@alpha @handsforbots/react@alpha
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Also needs: `@copilotkit/react-core`, `react`.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
- [This package](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#copilotkit)
|
|
18
|
+
- [Getting started](https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/getting-started.md)
|
|
19
|
+
- [Documentação em português](https://github.com/handsforbots/handsforbots/blob/main/docs/pt-br/README.md)
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type ActionDefinition, type H4B, type StandardSchemaV1, type Stimulus, type Transport } from '@handsforbots/core';
|
|
2
|
+
export type CopilotKitBridgeOptions = {
|
|
3
|
+
agentId?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Make the CopilotKit agent H4B's transport, so voice, menu fallbacks,
|
|
6
|
+
* sensors and other signals reach it and its answers can be spoken.
|
|
7
|
+
* Default true. Set false if H4B has its own transport.
|
|
8
|
+
*/
|
|
9
|
+
transport?: boolean;
|
|
10
|
+
/** How H4B context signals are described to the agent. */
|
|
11
|
+
contextDescription?: string;
|
|
12
|
+
};
|
|
13
|
+
type AgentLike = {
|
|
14
|
+
addMessages(messages: any[]): void;
|
|
15
|
+
subscribe(subscriber: {
|
|
16
|
+
onEvent?(params: {
|
|
17
|
+
event: any;
|
|
18
|
+
}): void;
|
|
19
|
+
}): {
|
|
20
|
+
unsubscribe(): void;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type CopilotLike = {
|
|
24
|
+
runAgent(params: {
|
|
25
|
+
agent: any;
|
|
26
|
+
}): Promise<unknown>;
|
|
27
|
+
stopAgent?(params: {
|
|
28
|
+
agent: any;
|
|
29
|
+
}): void;
|
|
30
|
+
};
|
|
31
|
+
/** Lets tool handlers report results to the H4B turn that is waiting on the agent. */
|
|
32
|
+
type RunChannel = {
|
|
33
|
+
push(stimulus: Stimulus): void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Connects H4B to CopilotKit (mode A: CopilotKit owns the chat and the agent
|
|
37
|
+
* connection). Render inside both <CopilotKitProvider> and <H4BProvider>.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useCopilotKitBridge(options?: CopilotKitBridgeOptions): void;
|
|
40
|
+
/** Component form of `useCopilotKitBridge`. */
|
|
41
|
+
export declare function CopilotKitBridge(props: CopilotKitBridgeOptions): null;
|
|
42
|
+
export declare function toFrontendTool(h4b: H4B, action: ActionDefinition, channel: {
|
|
43
|
+
current?: RunChannel;
|
|
44
|
+
}): {
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
parameters: StandardSchemaV1<unknown, unknown>;
|
|
48
|
+
webmcp: boolean;
|
|
49
|
+
handler: (args: unknown, context: {
|
|
50
|
+
toolCall?: {
|
|
51
|
+
id: string;
|
|
52
|
+
};
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
}) => Promise<unknown>;
|
|
55
|
+
};
|
|
56
|
+
/** CopilotKit needs a Standard Schema; wrap plain JSON Schema with the Standard JSON Schema extension. */
|
|
57
|
+
export declare function toStandardSchema(action: ActionDefinition): StandardSchemaV1;
|
|
58
|
+
/** H4B transport backed by the CopilotKit agent: messages also appear in CopilotKit's chat. */
|
|
59
|
+
export declare function createCopilotKitTransport(getAgent: () => AgentLike, copilotkit: CopilotLike, channel: {
|
|
60
|
+
current?: RunChannel;
|
|
61
|
+
}, { toolResultTimeoutMs }?: {
|
|
62
|
+
toolResultTimeoutMs?: number | undefined;
|
|
63
|
+
}): Transport;
|
|
64
|
+
/** Copies turns resolved without the agent (menu, browser agents) into its history. */
|
|
65
|
+
export declare function mirrorDirectTurns(h4b: H4B, getAgent: () => AgentLike): () => void;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EAGR,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAA;AAK3B,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,KAAK,SAAS,GAAG;IACf,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAClC,SAAS,CAAC,UAAU,EAAE;QAAE,OAAO,CAAC,CAAC,MAAM,EAAE;YAAE,KAAK,EAAE,GAAG,CAAA;SAAE,GAAG,IAAI,CAAA;KAAE,GAAG;QAAE,WAAW,IAAI,IAAI,CAAA;KAAE,CAAA;CAC3F,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,SAAS,CAAC,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,sFAAsF;AACtF,KAAK,UAAU,GAAG;IAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAA;AAEpD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,uBAA4B,GAAG,IAAI,CAiC/E;AAED,+CAA+C;AAC/C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,QAG9D;AAeD,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,CAAA;CAAE;IAEhG,IAAI;IACJ,WAAW;IACX,UAAU;IAEV,MAAM;IAGN,OAAO,SAAe,OAAO,WAAW;QAAE,QAAQ,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;EAe9F;AAED,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAW3E;AAaD,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,SAAS,EACzB,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,CAAA;CAAE,EACjC,EAAE,mBAA4B,EAAE;;CAAK,GACpC,SAAS,CAmEX;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,GAAG,MAAM,IAAI,CAYjF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { useAgent, useAgentContext, useCopilotKit, useFrontendTools } from '@copilotkit/react-core/v2';
|
|
2
|
+
import { createId, } from '@handsforbots/core';
|
|
3
|
+
import { useH4B, useH4BState } from '@handsforbots/react';
|
|
4
|
+
import { createEventMapper, toAguiMessages } from '@handsforbots/transport-agui';
|
|
5
|
+
import { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Connects H4B to CopilotKit (mode A: CopilotKit owns the chat and the agent
|
|
8
|
+
* connection). Render inside both <CopilotKitProvider> and <H4BProvider>.
|
|
9
|
+
*/
|
|
10
|
+
export function useCopilotKitBridge(options = {}) {
|
|
11
|
+
const h4b = useH4B();
|
|
12
|
+
const { agent } = useAgent(options.agentId ? { agentId: options.agentId } : undefined);
|
|
13
|
+
const { copilotkit } = useCopilotKit();
|
|
14
|
+
const channel = useRef(undefined);
|
|
15
|
+
const agentRef = useRef(agent);
|
|
16
|
+
agentRef.current = agent;
|
|
17
|
+
// 1. H4B actions → CopilotKit frontend tools.
|
|
18
|
+
const version = useRegistryVersion(h4b);
|
|
19
|
+
const tools = useMemo(() => h4b.actions.list('assistant').map((action) => toFrontendTool(h4b, action, channel)), [h4b, version]);
|
|
20
|
+
useFrontendTools(tools, [tools]);
|
|
21
|
+
// 2. H4B context signals (what is on screen, sensors…) → agent context.
|
|
22
|
+
const context = useH4BState((s) => s.context);
|
|
23
|
+
const contextValue = useMemo(() => contextToJson(context), [context]);
|
|
24
|
+
useAgentContext({
|
|
25
|
+
description: options.contextDescription ?? 'What the user sees and does in the app (Hands for Bots context signals)',
|
|
26
|
+
value: contextValue,
|
|
27
|
+
});
|
|
28
|
+
// 3. Voice, menu fallbacks and other H4B triggers → the CopilotKit agent.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (options.transport === false)
|
|
31
|
+
return;
|
|
32
|
+
const transport = createCopilotKitTransport(() => agentRef.current, copilotkit, channel);
|
|
33
|
+
return h4b.provide('transport', transport, 'copilotkit-bridge');
|
|
34
|
+
}, [h4b, copilotkit, options.transport]);
|
|
35
|
+
// 4. Direct commands and browser-agent actions also belong in the agent's history.
|
|
36
|
+
useEffect(() => mirrorDirectTurns(h4b, () => agentRef.current), [h4b]);
|
|
37
|
+
}
|
|
38
|
+
/** Component form of `useCopilotKitBridge`. */
|
|
39
|
+
export function CopilotKitBridge(props) {
|
|
40
|
+
useCopilotKitBridge(props);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function useRegistryVersion(h4b) {
|
|
44
|
+
const counter = useRef(0);
|
|
45
|
+
return useSyncExternalStore((onChange) => h4b.actions.subscribe(() => {
|
|
46
|
+
counter.current++;
|
|
47
|
+
onChange();
|
|
48
|
+
}), () => counter.current, () => counter.current);
|
|
49
|
+
}
|
|
50
|
+
export function toFrontendTool(h4b, action, channel) {
|
|
51
|
+
return {
|
|
52
|
+
name: action.name,
|
|
53
|
+
description: action.description,
|
|
54
|
+
parameters: toStandardSchema(action),
|
|
55
|
+
// H4B already publishes to WebMCP (expose-webmcp); avoid double registration.
|
|
56
|
+
webmcp: false,
|
|
57
|
+
// Invoked directly (not through the H4B queue: the turn may be waiting on this
|
|
58
|
+
// very agent run). Validation, interceptors and confirmation still apply.
|
|
59
|
+
handler: async (args, context) => {
|
|
60
|
+
const callId = context?.toolCall?.id ?? createId('call');
|
|
61
|
+
try {
|
|
62
|
+
const result = await h4b.actions.invoke(action.name, args, { origin: 'assistant', callId, signal: context?.signal });
|
|
63
|
+
h4b.emit('action.invoked', { name: action.name, origin: 'assistant', callId, result });
|
|
64
|
+
channel.current?.push({ type: 'action.result', callId, name: action.name, result });
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const message = error?.message ?? String(error);
|
|
69
|
+
h4b.emit('action.invoked', { name: action.name, origin: 'assistant', callId, error: message });
|
|
70
|
+
channel.current?.push({ type: 'action.result', callId, name: action.name, result: { error: message } });
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** CopilotKit needs a Standard Schema; wrap plain JSON Schema with the Standard JSON Schema extension. */
|
|
77
|
+
export function toStandardSchema(action) {
|
|
78
|
+
if (action.input)
|
|
79
|
+
return action.input;
|
|
80
|
+
const json = action.parameters ?? { type: 'object', properties: {} };
|
|
81
|
+
return {
|
|
82
|
+
'~standard': {
|
|
83
|
+
version: 1,
|
|
84
|
+
vendor: 'handsforbots',
|
|
85
|
+
validate: (value) => ({ value }), // H4B validates when the action runs
|
|
86
|
+
jsonSchema: { input: () => json, output: () => json },
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function contextToJson(signals) {
|
|
91
|
+
const value = {};
|
|
92
|
+
for (const signal of signals) {
|
|
93
|
+
const parts = signal.parts.map((p) => p.type === 'text' ? p.text : p.type === 'data' ? p.value : `[${p.type}]`);
|
|
94
|
+
value[signal.key ?? signal.source] = parts.length === 1 ? parts[0] : parts;
|
|
95
|
+
}
|
|
96
|
+
return JSON.parse(JSON.stringify(value));
|
|
97
|
+
}
|
|
98
|
+
/** H4B transport backed by the CopilotKit agent: messages also appear in CopilotKit's chat. */
|
|
99
|
+
export function createCopilotKitTransport(getAgent, copilotkit, channel, { toolResultTimeoutMs = 30_000 } = {}) {
|
|
100
|
+
return {
|
|
101
|
+
name: 'copilotkit',
|
|
102
|
+
capabilities: { streaming: true, tools: true },
|
|
103
|
+
async *run(request, signal) {
|
|
104
|
+
const last = request.messages.at(-1);
|
|
105
|
+
// CopilotKit runs the tool loop itself; H4B only forwards new user input.
|
|
106
|
+
if (last?.role !== 'user')
|
|
107
|
+
return;
|
|
108
|
+
const agent = getAgent();
|
|
109
|
+
agent.addMessages(await toAguiMessages([last]));
|
|
110
|
+
const queue = [];
|
|
111
|
+
const pendingCalls = new Set();
|
|
112
|
+
let finished = false;
|
|
113
|
+
let failure;
|
|
114
|
+
let wake;
|
|
115
|
+
const push = (stimulus) => {
|
|
116
|
+
if (stimulus.type === 'action.call')
|
|
117
|
+
pendingCalls.add(stimulus.callId);
|
|
118
|
+
if (stimulus.type === 'action.result')
|
|
119
|
+
pendingCalls.delete(stimulus.callId);
|
|
120
|
+
queue.push(stimulus);
|
|
121
|
+
wake?.();
|
|
122
|
+
};
|
|
123
|
+
const mapper = createEventMapper();
|
|
124
|
+
const subscription = agent.subscribe({ onEvent: ({ event }) => mapper(event).forEach(push) });
|
|
125
|
+
channel.current = { push };
|
|
126
|
+
const onAbort = () => copilotkit.stopAgent?.({ agent });
|
|
127
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
128
|
+
copilotkit.runAgent({ agent }).then(() => {
|
|
129
|
+
finished = true;
|
|
130
|
+
wake?.();
|
|
131
|
+
}, (error) => {
|
|
132
|
+
failure = error;
|
|
133
|
+
finished = true;
|
|
134
|
+
wake?.();
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
while (true) {
|
|
138
|
+
if (queue.length) {
|
|
139
|
+
yield queue.shift();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (finished)
|
|
143
|
+
break;
|
|
144
|
+
await new Promise((resolve) => (wake = resolve));
|
|
145
|
+
}
|
|
146
|
+
// Tool handlers may report just after the run settles.
|
|
147
|
+
const deadline = Date.now() + toolResultTimeoutMs;
|
|
148
|
+
while (pendingCalls.size && Date.now() < deadline && !signal.aborted) {
|
|
149
|
+
await new Promise((r) => setTimeout(r, 20));
|
|
150
|
+
while (queue.length)
|
|
151
|
+
yield queue.shift();
|
|
152
|
+
}
|
|
153
|
+
// Never let the kernel execute a call CopilotKit owns.
|
|
154
|
+
for (const callId of pendingCalls) {
|
|
155
|
+
yield { type: 'action.result', callId, result: { error: 'Not executed by CopilotKit' } };
|
|
156
|
+
}
|
|
157
|
+
if (failure && !signal.aborted)
|
|
158
|
+
throw failure;
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
signal.removeEventListener('abort', onAbort);
|
|
162
|
+
subscription.unsubscribe();
|
|
163
|
+
if (channel.current?.push === push)
|
|
164
|
+
channel.current = undefined;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/** Copies turns resolved without the agent (menu, browser agents) into its history. */
|
|
170
|
+
export function mirrorDirectTurns(h4b, getAgent) {
|
|
171
|
+
const starts = new Map();
|
|
172
|
+
return h4b.on('turn.status', async (status) => {
|
|
173
|
+
// First status of a turn comes before any of its messages is appended.
|
|
174
|
+
if (!starts.has(status.turnId))
|
|
175
|
+
starts.set(status.turnId, h4b.messages.length);
|
|
176
|
+
if (status.phase !== 'done' && status.phase !== 'error')
|
|
177
|
+
return;
|
|
178
|
+
const start = starts.get(status.turnId) ?? h4b.messages.length;
|
|
179
|
+
starts.delete(status.turnId);
|
|
180
|
+
if (status.route !== 'direct' && status.route !== 'agent')
|
|
181
|
+
return;
|
|
182
|
+
const messages = h4b.messages.slice(start);
|
|
183
|
+
if (messages.length)
|
|
184
|
+
getAgent().addMessages(await toAguiMessages(messages));
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACtG,OAAO,EACL,QAAQ,GAQT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AA2BxE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAO,GAA4B,EAAE;IACvE,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;IACpB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAyB,CAAA;IAC9G,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAA4C,CAAA;IAChF,MAAM,OAAO,GAAG,MAAM,CAAyB,SAAS,CAAC,CAAA;IACzD,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AAC,QAAQ,CAAC,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsforbots/copilotkit",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "UI. CopilotKit bridge for Hands for Bots: actions as frontend tools, context, and voice/menu/sensor input through the CopilotKit agent.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"handsforbots",
|
|
7
|
+
"h4b",
|
|
8
|
+
"h4b-ui"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"homepage": "https://github.com/handsforbots/handsforbots/blob/main/docs/en-us/plugins.md#copilotkit",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/handsforbots/handsforbots.git",
|
|
15
|
+
"directory": "packages/copilotkit"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/handsforbots/handsforbots/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@copilotkit/react-core": ">=1.77",
|
|
36
|
+
"react": ">=18",
|
|
37
|
+
"@handsforbots/react": "^2.0.0-alpha.1",
|
|
38
|
+
"@handsforbots/core": "^2.0.0-alpha.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@copilotkit/react-core": "^1.77.0",
|
|
42
|
+
"@testing-library/react": "^16.3.0",
|
|
43
|
+
"@types/react": "^19.1.0",
|
|
44
|
+
"jsdom": "^27.0.0",
|
|
45
|
+
"react": "^19.3.0",
|
|
46
|
+
"react-dom": "^19.3.0",
|
|
47
|
+
"rxjs": "7.8.1",
|
|
48
|
+
"@handsforbots/react": "^2.0.0-alpha.1",
|
|
49
|
+
"@handsforbots/core": "^2.0.0-alpha.1"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@handsforbots/transport-agui": "^2.0.0-alpha.1"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc -p tsconfig.build.json",
|
|
56
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
57
|
+
}
|
|
6
58
|
}
|