@agent-native/core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/create.d.ts +1 -1
- package/dist/cli/create.js +2 -2
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/client/{fusion-chat.d.ts → agent-chat.d.ts} +6 -6
- package/dist/client/agent-chat.d.ts.map +1 -0
- package/dist/client/agent-chat.js +32 -0
- package/dist/client/agent-chat.js.map +1 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/use-agent-chat.d.ts +14 -0
- package/dist/client/use-agent-chat.d.ts.map +1 -0
- package/dist/client/{use-fusion-chat.js → use-agent-chat.js} +6 -6
- package/dist/client/use-agent-chat.js.map +1 -0
- package/dist/index.browser.d.ts +3 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +6 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/scripts/runner.d.ts +1 -1
- package/dist/scripts/runner.js +1 -1
- package/dist/shared/{fusion-chat.d.ts → agent-chat.d.ts} +10 -10
- package/dist/shared/agent-chat.d.ts.map +1 -0
- package/dist/shared/{fusion-chat.js → agent-chat.js} +11 -11
- package/dist/shared/agent-chat.js.map +1 -0
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/vite/client.js +1 -1
- package/dist/vite/client.js.map +1 -1
- package/package.json +6 -3
- package/src/templates/default/AGENTS.md +7 -7
- package/src/templates/default/client/App.tsx +1 -1
- package/src/templates/default/client/lib/utils.ts +1 -1
- package/src/templates/default/scripts/hello.ts +4 -4
- package/src/templates/default/scripts/run.ts +1 -1
- package/src/templates/default/server/index.ts +1 -1
- package/src/templates/default/server/node-build.ts +1 -1
- package/dist/client/fusion-chat.d.ts.map +0 -1
- package/dist/client/fusion-chat.js +0 -19
- package/dist/client/fusion-chat.js.map +0 -1
- package/dist/client/use-fusion-chat.d.ts +0 -14
- package/dist/client/use-fusion-chat.d.ts.map +0 -1
- package/dist/client/use-fusion-chat.js.map +0 -1
- package/dist/shared/fusion-chat.d.ts.map +0 -1
- package/dist/shared/fusion-chat.js.map +0 -1
package/dist/cli/create.d.ts
CHANGED
package/dist/cli/create.js
CHANGED
|
@@ -4,11 +4,11 @@ import { fileURLToPath } from "url";
|
|
|
4
4
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = path.dirname(__filename);
|
|
6
6
|
/**
|
|
7
|
-
* Scaffold a new
|
|
7
|
+
* Scaffold a new agent-native app from the default template.
|
|
8
8
|
*/
|
|
9
9
|
export function createApp(name) {
|
|
10
10
|
if (!name) {
|
|
11
|
-
console.error("Usage:
|
|
11
|
+
console.error("Usage: agent-native create <app-name>");
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
// Validate name
|
package/dist/cli/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,
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IACxC,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Agent Chat Bridge (browser)
|
|
3
3
|
*
|
|
4
|
-
* Sends structured messages to the
|
|
4
|
+
* Sends structured messages to the agent chat from UI interactions.
|
|
5
5
|
* Messages are sent via postMessage to the parent window (or self if top-level).
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface AgentChatMessage {
|
|
8
8
|
/** The visible prompt message sent to the chat */
|
|
9
9
|
message: string;
|
|
10
10
|
/** Hidden context appended to the message (not shown in chat UI) */
|
|
@@ -21,7 +21,7 @@ export interface FusionChatMessage {
|
|
|
21
21
|
uploadedReferenceImages?: string[];
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Send a message to the
|
|
24
|
+
* Send a message to the agent chat via postMessage.
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
//# sourceMappingURL=
|
|
26
|
+
export declare function sendToAgentChat(opts: AgentChatMessage): void;
|
|
27
|
+
//# sourceMappingURL=agent-chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,yCAAyC;IACzC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAoBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAQ5D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Chat Bridge (browser)
|
|
3
|
+
*
|
|
4
|
+
* Sends structured messages to the agent chat from UI interactions.
|
|
5
|
+
* Messages are sent via postMessage to the parent window (or self if top-level).
|
|
6
|
+
*/
|
|
7
|
+
const AGENT_CHAT_MESSAGE_TYPE = "builder.submitChat";
|
|
8
|
+
/**
|
|
9
|
+
* Listen for chatRunning messages from the harness (postMessage)
|
|
10
|
+
* and re-dispatch as a CustomEvent so hooks like useAgentChatGenerating() work.
|
|
11
|
+
*/
|
|
12
|
+
if (typeof window !== "undefined") {
|
|
13
|
+
window.addEventListener("message", (event) => {
|
|
14
|
+
if (event.data?.type === "builder.fusion.chatRunning") {
|
|
15
|
+
window.dispatchEvent(new CustomEvent("builder.fusion.chatRunning", {
|
|
16
|
+
detail: event.data.detail,
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Send a message to the agent chat via postMessage.
|
|
23
|
+
*/
|
|
24
|
+
export function sendToAgentChat(opts) {
|
|
25
|
+
const payload = {
|
|
26
|
+
type: AGENT_CHAT_MESSAGE_TYPE,
|
|
27
|
+
data: opts,
|
|
28
|
+
};
|
|
29
|
+
const target = window.parent !== window ? window.parent : window;
|
|
30
|
+
target.postMessage(payload, "*");
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=agent-chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat.js","sourceRoot":"","sources":["../../src/client/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAErD;;;GAGG;AACH,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3C,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,4BAA4B,EAAE,CAAC;YACtD,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,4BAA4B,EAAE;gBAC5C,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM;aAC1B,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAsB;IACpD,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { sendToAgentChat, type AgentChatMessage } from "./agent-chat.js";
|
|
2
|
+
export { useAgentChatGenerating } from "./use-agent-chat.js";
|
|
3
3
|
export { useFileWatcher } from "./use-file-watcher.js";
|
|
4
4
|
export { cn } from "./utils.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { sendToAgentChat } from "./agent-chat.js";
|
|
2
|
+
export { useAgentChatGenerating } from "./use-agent-chat.js";
|
|
3
3
|
export { useFileWatcher } from "./use-file-watcher.js";
|
|
4
4
|
export { cn } from "./utils.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AgentChatMessage } from "./agent-chat.js";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that wraps sendToAgentChat with a loading state.
|
|
4
|
+
*
|
|
5
|
+
* Returns [isGenerating, send] where:
|
|
6
|
+
* - isGenerating: true after send() is called, false when the
|
|
7
|
+
* builder.fusion.chatRunning event fires with detail.isRunning === false
|
|
8
|
+
* - send: wrapper around sendToAgentChat that sets isGenerating to true
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAgentChatGenerating(): [
|
|
11
|
+
boolean,
|
|
12
|
+
(opts: AgentChatMessage) => void
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=use-agent-chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-agent-chat.d.ts","sourceRoot":"","sources":["../../src/client/use-agent-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,OAAO;IACP,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI;CACjC,CAqBA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { sendToAgentChat } from "./agent-chat.js";
|
|
3
3
|
/**
|
|
4
|
-
* Hook that wraps
|
|
4
|
+
* Hook that wraps sendToAgentChat with a loading state.
|
|
5
5
|
*
|
|
6
6
|
* Returns [isGenerating, send] where:
|
|
7
7
|
* - isGenerating: true after send() is called, false when the
|
|
8
8
|
* builder.fusion.chatRunning event fires with detail.isRunning === false
|
|
9
|
-
* - send: wrapper around
|
|
9
|
+
* - send: wrapper around sendToAgentChat that sets isGenerating to true
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function useAgentChatGenerating() {
|
|
12
12
|
const [isGenerating, setIsGenerating] = useState(false);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
const handler = (e) => {
|
|
@@ -22,8 +22,8 @@ export function useFusionChatGenerating() {
|
|
|
22
22
|
}, []);
|
|
23
23
|
const send = useCallback((opts) => {
|
|
24
24
|
setIsGenerating(true);
|
|
25
|
-
|
|
25
|
+
sendToAgentChat(opts);
|
|
26
26
|
}, []);
|
|
27
27
|
return [isGenerating, send];
|
|
28
28
|
}
|
|
29
|
-
//# sourceMappingURL=use-
|
|
29
|
+
//# sourceMappingURL=use-agent-chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-agent-chat.js","sourceRoot":"","sources":["../../src/client/use-agent-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,eAAe,EAAyB,MAAM,iBAAiB,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB;IAIpC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAI,CAAiB,CAAC,MAAM,CAAC;YACzC,IAAI,MAAM,EAAE,SAAS,KAAK,KAAK,EAAE,CAAC;gBAChC,eAAe,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,GAAG,EAAE,CACV,MAAM,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,IAAsB,EAAE,EAAE;QAClD,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,EAAE,EACF,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Browser-safe entry — only client & shared exports (no Node/Express/chokidar).
|
|
2
|
+
// Client
|
|
3
|
+
export { sendToAgentChat, useAgentChatGenerating, useFileWatcher, cn, } from "./client/index.js";
|
|
4
|
+
// Shared (isomorphic)
|
|
5
|
+
export { agentChat } from "./shared/index.js";
|
|
6
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,SAAS;AACT,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,EAAE,GAEH,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { createServer, createFileWatcher, createSSEHandler, createProductionServer, } from "./server/index.js";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { createServer, createFileWatcher, createSSEHandler, createProductionServer, type CreateServerOptions, type FileWatcherOptions, type SSEHandlerOptions, type ProductionServerOptions, } from "./server/index.js";
|
|
2
|
+
export { sendToAgentChat, useAgentChatGenerating, useFileWatcher, cn, type AgentChatMessage, } from "./client/index.js";
|
|
3
|
+
export { agentChat } from "./shared/index.js";
|
|
4
4
|
export { runScript, loadEnv, parseArgs, camelCaseArgs, isValidPath, isValidProjectPath, ensureDir, fail, } from "./scripts/index.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,EAAE,EACF,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Framework for agent-native apps.
|
|
2
|
+
// Import everything from "@agent-native/core".
|
|
3
|
+
// Server
|
|
4
4
|
export { createServer, createFileWatcher, createSSEHandler, createProductionServer, } from "./server/index.js";
|
|
5
|
-
|
|
6
|
-
export {
|
|
5
|
+
// Client
|
|
6
|
+
export { sendToAgentChat, useAgentChatGenerating, useFileWatcher, cn, } from "./client/index.js";
|
|
7
|
+
// Shared (isomorphic)
|
|
8
|
+
export { agentChat } from "./shared/index.js";
|
|
9
|
+
// Scripts
|
|
7
10
|
export { runScript, loadEnv, parseArgs, camelCaseArgs, isValidPath, isValidProjectPath, ensureDir, fail, } from "./scripts/index.js";
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,SAAS;AACT,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GAKvB,MAAM,mBAAmB,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,EAAE,GAEH,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,UAAU;AACV,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC"}
|
package/dist/scripts/runner.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Run the script dispatcher. Call this from your app's scripts/run.ts:
|
|
11
11
|
*
|
|
12
|
-
* import { runScript } from "@agent-native/core
|
|
12
|
+
* import { runScript } from "@agent-native/core";
|
|
13
13
|
* runScript();
|
|
14
14
|
*/
|
|
15
15
|
export declare function runScript(): Promise<void>;
|
package/dist/scripts/runner.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Isomorphic
|
|
2
|
+
* Isomorphic Agent Chat Utility
|
|
3
3
|
*
|
|
4
4
|
* Works in both browser and Node.js contexts:
|
|
5
5
|
* - Browser: sends via postMessage to the parent window
|
|
6
6
|
* - Node.js (scripts): sends via BUILDER_PARENT_MESSAGE stdout format,
|
|
7
7
|
* which the Electron host translates to postMessage
|
|
8
8
|
*/
|
|
9
|
-
export interface
|
|
9
|
+
export interface AgentChatMessage {
|
|
10
10
|
/** The visible prompt text shown in the chat input */
|
|
11
11
|
message: string;
|
|
12
12
|
/** Hidden context appended to the prompt (not shown to user, but sent to AI) */
|
|
@@ -15,25 +15,25 @@ export interface FusionChatMessage {
|
|
|
15
15
|
submit?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Send a structured message to
|
|
18
|
+
* Send a structured message to the agent chat.
|
|
19
19
|
* Automatically detects environment (browser vs Node.js) and uses the right transport.
|
|
20
20
|
*/
|
|
21
|
-
declare function send(data:
|
|
21
|
+
declare function send(data: AgentChatMessage): void;
|
|
22
22
|
/**
|
|
23
|
-
* Submit a message to
|
|
23
|
+
* Submit a message to the agent chat (auto-submits by default).
|
|
24
24
|
*/
|
|
25
25
|
declare function submit(message: string, context?: string): void;
|
|
26
26
|
/**
|
|
27
|
-
* Prefill the
|
|
27
|
+
* Prefill the agent chat input without submitting (user reviews first).
|
|
28
28
|
*/
|
|
29
29
|
declare function prefill(message: string, context?: string): void;
|
|
30
|
-
export declare const
|
|
31
|
-
/** Send raw
|
|
30
|
+
export declare const agentChat: {
|
|
31
|
+
/** Send raw AgentChatMessage — full control over all fields */
|
|
32
32
|
send: typeof send;
|
|
33
|
-
/** Auto-submit a message to
|
|
33
|
+
/** Auto-submit a message to agent chat */
|
|
34
34
|
submit: typeof submit;
|
|
35
35
|
/** Prefill the chat input for user review before sending */
|
|
36
36
|
prefill: typeof prefill;
|
|
37
37
|
};
|
|
38
38
|
export {};
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=agent-chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat.d.ts","sourceRoot":"","sources":["../../src/shared/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAOD;;;GAGG;AACH,iBAAS,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAiB1C;AAED;;GAEG;AACH,iBAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,eAAO,MAAM,SAAS;IACpB,+DAA+D;;IAE/D,0CAA0C;;IAE1C,4DAA4D;;CAE7D,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Isomorphic
|
|
2
|
+
* Isomorphic Agent Chat Utility
|
|
3
3
|
*
|
|
4
4
|
* Works in both browser and Node.js contexts:
|
|
5
5
|
* - Browser: sends via postMessage to the parent window
|
|
6
6
|
* - Node.js (scripts): sends via BUILDER_PARENT_MESSAGE stdout format,
|
|
7
7
|
* which the Electron host translates to postMessage
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const AGENT_CHAT_MESSAGE_TYPE = "builder.submitChat";
|
|
10
10
|
const isBrowser = typeof window !== "undefined" && typeof window.postMessage === "function";
|
|
11
11
|
/**
|
|
12
|
-
* Send a structured message to
|
|
12
|
+
* Send a structured message to the agent chat.
|
|
13
13
|
* Automatically detects environment (browser vs Node.js) and uses the right transport.
|
|
14
14
|
*/
|
|
15
15
|
function send(data) {
|
|
16
|
-
const payload = { type:
|
|
16
|
+
const payload = { type: AGENT_CHAT_MESSAGE_TYPE, data };
|
|
17
17
|
if (isBrowser) {
|
|
18
18
|
const target = window.parent !== window ? window.parent : window;
|
|
19
19
|
try {
|
|
20
20
|
target.postMessage(payload, "*");
|
|
21
21
|
}
|
|
22
22
|
catch (err) {
|
|
23
|
-
console.error("[
|
|
23
|
+
console.error("[agentChat] postMessage failed:", err);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
@@ -30,23 +30,23 @@ function send(data) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Submit a message to
|
|
33
|
+
* Submit a message to the agent chat (auto-submits by default).
|
|
34
34
|
*/
|
|
35
35
|
function submit(message, context) {
|
|
36
36
|
send({ message, context, submit: true });
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Prefill the
|
|
39
|
+
* Prefill the agent chat input without submitting (user reviews first).
|
|
40
40
|
*/
|
|
41
41
|
function prefill(message, context) {
|
|
42
42
|
send({ message, context, submit: false });
|
|
43
43
|
}
|
|
44
|
-
export const
|
|
45
|
-
/** Send raw
|
|
44
|
+
export const agentChat = {
|
|
45
|
+
/** Send raw AgentChatMessage — full control over all fields */
|
|
46
46
|
send,
|
|
47
|
-
/** Auto-submit a message to
|
|
47
|
+
/** Auto-submit a message to agent chat */
|
|
48
48
|
submit,
|
|
49
49
|
/** Prefill the chat input for user review before sending */
|
|
50
50
|
prefill,
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=agent-chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat.js","sourceRoot":"","sources":["../../src/shared/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAErD,MAAM,SAAS,GACb,OAA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
|
|
1
|
+
export { agentChat, type AgentChatMessage } from "./agent-chat.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/shared/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { agentChat } from "./agent-chat.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/shared/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,iBAAiB,CAAC"}
|
package/dist/vite/client.js
CHANGED
package/dist/vite/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/vite/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAmB/E;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,UAA+B,EAAE;IAC5D,qCAAqC;IACrC,IAAI,WAAgB,CAAC;IACrB,IAAI,CAAC;QACH,WAAW,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAClD,IAAI,WAAW,CAAC,OAAO;YAAE,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC;IAC7D,CAAC;I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a,CAAC,OAAO,CAAC,OAAO,CAAC;YAC9B,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;SAC3B,CAAC,MAAM,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;gBAClC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;gBACxC,GAAG,OAAO,CAAC,OAAO;aACnB;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Framework for agent-native application development — where AI agents and UI share state via files",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
|
-
"agent-native": "./dist/cli/index.js"
|
|
8
|
+
"create-agent-native": "./dist/cli/index.js"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
|
-
".":
|
|
11
|
+
".": {
|
|
12
|
+
"browser": "./dist/index.browser.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
12
15
|
"./vite": "./dist/vite/index.js",
|
|
13
16
|
"./server": "./dist/server/index.js",
|
|
14
17
|
"./client": "./dist/client/index.js",
|
|
@@ -7,7 +7,7 @@ This is an **@agent-native/core** application — the AI agent and UI share stat
|
|
|
7
7
|
### Core Principles
|
|
8
8
|
|
|
9
9
|
1. **Files as database** — All app state lives in files. Both UI and agent read/write the same files.
|
|
10
|
-
2. **All AI through agent chat** — No inline LLM calls. UI delegates to the AI via `
|
|
10
|
+
2. **All AI through agent chat** — No inline LLM calls. UI delegates to the AI via `sendToAgentChat()` / `agentChat.submit()`.
|
|
11
11
|
3. **Scripts for agent operations** — `pnpm script <name>` dispatches to callable script files in `scripts/`.
|
|
12
12
|
4. **Bidirectional SSE events** — The file watcher keeps the UI in sync when the agent modifies files.
|
|
13
13
|
5. **Agent can update code** — The agent can modify this app's source code directly.
|
|
@@ -43,16 +43,16 @@ Edit `server/index.ts`, add your route to `createAppServer()`.
|
|
|
43
43
|
Create `scripts/my-script.ts` exporting `default async function(args: string[])`.
|
|
44
44
|
Run with: `pnpm script my-script --arg value`
|
|
45
45
|
|
|
46
|
-
**Sending to
|
|
46
|
+
**Sending to agent chat from UI:**
|
|
47
47
|
```ts
|
|
48
|
-
import {
|
|
49
|
-
|
|
48
|
+
import { sendToAgentChat } from "@agent-native/core";
|
|
49
|
+
sendToAgentChat({ message: "Generate something", context: "...", submit: true });
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
**Sending to
|
|
52
|
+
**Sending to agent chat from scripts:**
|
|
53
53
|
```ts
|
|
54
|
-
import {
|
|
55
|
-
|
|
54
|
+
import { agentChat } from "@agent-native/core";
|
|
55
|
+
agentChat.submit("Generate something");
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Tech Stack
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StrictMode } from "react";
|
|
2
2
|
import { createRoot } from "react-dom/client";
|
|
3
3
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
-
import { useFileWatcher } from "@agent-native/core
|
|
4
|
+
import { useFileWatcher } from "@agent-native/core";
|
|
5
5
|
import "./global.css";
|
|
6
6
|
|
|
7
7
|
const queryClient = new QueryClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cn } from "@agent-native/core
|
|
1
|
+
export { cn } from "@agent-native/core";
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Scripts export a default async function that receives CLI args.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { parseArgs } from "@agent-native/core
|
|
8
|
-
import {
|
|
7
|
+
import { parseArgs } from "@agent-native/core";
|
|
8
|
+
import { agentChat } from "@agent-native/core";
|
|
9
9
|
|
|
10
10
|
export default async function hello(args: string[]) {
|
|
11
11
|
const parsed = parseArgs(args);
|
|
@@ -13,8 +13,8 @@ export default async function hello(args: string[]) {
|
|
|
13
13
|
|
|
14
14
|
console.log(`Hello, ${name}!`);
|
|
15
15
|
|
|
16
|
-
// Example: send a message to
|
|
16
|
+
// Example: send a message to agent chat (works in Electron context)
|
|
17
17
|
if (parsed["send-chat"] === "true") {
|
|
18
|
-
|
|
18
|
+
agentChat.submit(`Hello from the script system! Name: ${name}`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import { createServer, createFileWatcher, createSSEHandler } from "@agent-native/core
|
|
2
|
+
import { createServer, createFileWatcher, createSSEHandler } from "@agent-native/core";
|
|
3
3
|
|
|
4
4
|
export function createAppServer() {
|
|
5
5
|
const app = createServer();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion-chat.d.ts","sourceRoot":"","sources":["../../src/client/fusion-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,yCAAyC;IACzC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAQ9D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fusion Chat Bridge (browser)
|
|
3
|
-
*
|
|
4
|
-
* Sends structured messages to the Fusion AI chat from UI interactions.
|
|
5
|
-
* Messages are sent via postMessage to the parent window (or self if top-level).
|
|
6
|
-
*/
|
|
7
|
-
const FUSION_MESSAGE_TYPE = "builder.submitChat";
|
|
8
|
-
/**
|
|
9
|
-
* Send a message to the Fusion AI chat via postMessage.
|
|
10
|
-
*/
|
|
11
|
-
export function sendToFusionChat(opts) {
|
|
12
|
-
const payload = {
|
|
13
|
-
type: FUSION_MESSAGE_TYPE,
|
|
14
|
-
data: opts,
|
|
15
|
-
};
|
|
16
|
-
const target = window.parent !== window ? window.parent : window;
|
|
17
|
-
target.postMessage(payload, "*");
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=fusion-chat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion-chat.js","sourceRoot":"","sources":["../../src/client/fusion-chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAuB;IACtD,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type FusionChatMessage } from "./fusion-chat.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook that wraps sendToFusionChat with a loading state.
|
|
4
|
-
*
|
|
5
|
-
* Returns [isGenerating, send] where:
|
|
6
|
-
* - isGenerating: true after send() is called, false when the
|
|
7
|
-
* builder.fusion.chatRunning event fires with detail.isRunning === false
|
|
8
|
-
* - send: wrapper around sendToFusionChat that sets isGenerating to true
|
|
9
|
-
*/
|
|
10
|
-
export declare function useFusionChatGenerating(): [
|
|
11
|
-
boolean,
|
|
12
|
-
(opts: FusionChatMessage) => void
|
|
13
|
-
];
|
|
14
|
-
//# sourceMappingURL=use-fusion-chat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-fusion-chat.d.ts","sourceRoot":"","sources":["../../src/client/use-fusion-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI;IACzC,OAAO;IACP,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI;CAClC,CAqBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-fusion-chat.js","sourceRoot":"","sources":["../../src/client/use-fusion-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB;IAIrC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAI,CAAiB,CAAC,MAAM,CAAC;YACzC,IAAI,MAAM,EAAE,SAAS,KAAK,KAAK,EAAE,CAAC;gBAChC,eAAe,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,GAAG,EAAE,CACV,MAAM,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,IAAuB,EAAE,EAAE;QACnD,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion-chat.d.ts","sourceRoot":"","sources":["../../src/shared/fusion-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAOD;;;GAGG;AACH,iBAAS,IAAI,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAiB3C;AAED;;GAEG;AACH,iBAAS,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,eAAO,MAAM,UAAU;IACrB,gEAAgE;;IAEhE,2CAA2C;;IAE3C,4DAA4D;;CAE7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion-chat.js","sourceRoot":"","sources":["../../src/shared/fusion-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,M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