@agent-native/core 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.
Files changed (127) hide show
  1. package/dist/adapters/firestore/config.d.ts +20 -0
  2. package/dist/adapters/firestore/config.d.ts.map +1 -0
  3. package/dist/adapters/firestore/config.js +50 -0
  4. package/dist/adapters/firestore/config.js.map +1 -0
  5. package/dist/adapters/firestore/index.d.ts +4 -0
  6. package/dist/adapters/firestore/index.d.ts.map +1 -0
  7. package/dist/adapters/firestore/index.js +4 -0
  8. package/dist/adapters/firestore/index.js.map +1 -0
  9. package/dist/adapters/firestore/merge.d.ts +21 -0
  10. package/dist/adapters/firestore/merge.d.ts.map +1 -0
  11. package/dist/adapters/firestore/merge.js +132 -0
  12. package/dist/adapters/firestore/merge.js.map +1 -0
  13. package/dist/adapters/firestore/sync.d.ts +91 -0
  14. package/dist/adapters/firestore/sync.d.ts.map +1 -0
  15. package/dist/adapters/firestore/sync.js +340 -0
  16. package/dist/adapters/firestore/sync.js.map +1 -0
  17. package/dist/cli/create.d.ts +5 -0
  18. package/dist/cli/create.d.ts.map +1 -0
  19. package/dist/cli/create.js +87 -0
  20. package/dist/cli/create.js.map +1 -0
  21. package/dist/cli/index.d.ts +3 -0
  22. package/dist/cli/index.d.ts.map +1 -0
  23. package/dist/cli/index.js +27 -0
  24. package/dist/cli/index.js.map +1 -0
  25. package/dist/client/fusion-chat.d.ts +27 -0
  26. package/dist/client/fusion-chat.d.ts.map +1 -0
  27. package/dist/client/fusion-chat.js +19 -0
  28. package/dist/client/fusion-chat.js.map +1 -0
  29. package/dist/client/index.d.ts +5 -0
  30. package/dist/client/index.d.ts.map +1 -0
  31. package/dist/client/index.js +5 -0
  32. package/dist/client/index.js.map +1 -0
  33. package/dist/client/use-file-watcher.d.ts +23 -0
  34. package/dist/client/use-file-watcher.d.ts.map +1 -0
  35. package/dist/client/use-file-watcher.js +40 -0
  36. package/dist/client/use-file-watcher.js.map +1 -0
  37. package/dist/client/use-fusion-chat.d.ts +14 -0
  38. package/dist/client/use-fusion-chat.d.ts.map +1 -0
  39. package/dist/client/use-fusion-chat.js +29 -0
  40. package/dist/client/use-fusion-chat.js.map +1 -0
  41. package/dist/client/utils.d.ts +4 -0
  42. package/dist/client/utils.d.ts.map +1 -0
  43. package/dist/client/utils.js +7 -0
  44. package/dist/client/utils.js.map +1 -0
  45. package/dist/index.d.ts +5 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +8 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/scripts/index.d.ts +3 -0
  50. package/dist/scripts/index.d.ts.map +1 -0
  51. package/dist/scripts/index.js +3 -0
  52. package/dist/scripts/index.js.map +1 -0
  53. package/dist/scripts/runner.d.ts +16 -0
  54. package/dist/scripts/runner.d.ts.map +1 -0
  55. package/dist/scripts/runner.js +42 -0
  56. package/dist/scripts/runner.js.map +1 -0
  57. package/dist/scripts/utils.d.ts +30 -0
  58. package/dist/scripts/utils.d.ts.map +1 -0
  59. package/dist/scripts/utils.js +88 -0
  60. package/dist/scripts/utils.js.map +1 -0
  61. package/dist/server/create-server.d.ts +21 -0
  62. package/dist/server/create-server.d.ts.map +1 -0
  63. package/dist/server/create-server.js +27 -0
  64. package/dist/server/create-server.js.map +1 -0
  65. package/dist/server/index.d.ts +4 -0
  66. package/dist/server/index.d.ts.map +1 -0
  67. package/dist/server/index.js +4 -0
  68. package/dist/server/index.js.map +1 -0
  69. package/dist/server/production.d.ts +18 -0
  70. package/dist/server/production.d.ts.map +1 -0
  71. package/dist/server/production.js +37 -0
  72. package/dist/server/production.js.map +1 -0
  73. package/dist/server/sse.d.ts +30 -0
  74. package/dist/server/sse.d.ts.map +1 -0
  75. package/dist/server/sse.js +44 -0
  76. package/dist/server/sse.js.map +1 -0
  77. package/dist/shared/fusion-chat.d.ts +39 -0
  78. package/dist/shared/fusion-chat.d.ts.map +1 -0
  79. package/dist/shared/fusion-chat.js +52 -0
  80. package/dist/shared/fusion-chat.js.map +1 -0
  81. package/dist/shared/index.d.ts +2 -0
  82. package/dist/shared/index.d.ts.map +1 -0
  83. package/dist/shared/index.js +2 -0
  84. package/dist/shared/index.js.map +1 -0
  85. package/dist/tailwind.preset.d.ts +13 -0
  86. package/dist/tailwind.preset.d.ts.map +1 -0
  87. package/dist/tailwind.preset.js +92 -0
  88. package/dist/tailwind.preset.js.map +1 -0
  89. package/dist/vite/client.d.ts +24 -0
  90. package/dist/vite/client.d.ts.map +1 -0
  91. package/dist/vite/client.js +52 -0
  92. package/dist/vite/client.js.map +1 -0
  93. package/dist/vite/express-plugin.d.ts +11 -0
  94. package/dist/vite/express-plugin.d.ts.map +1 -0
  95. package/dist/vite/express-plugin.js +22 -0
  96. package/dist/vite/express-plugin.js.map +1 -0
  97. package/dist/vite/index.d.ts +4 -0
  98. package/dist/vite/index.d.ts.map +1 -0
  99. package/dist/vite/index.js +4 -0
  100. package/dist/vite/index.js.map +1 -0
  101. package/dist/vite/server.d.ts +21 -0
  102. package/dist/vite/server.d.ts.map +1 -0
  103. package/dist/vite/server.js +68 -0
  104. package/dist/vite/server.js.map +1 -0
  105. package/package.json +82 -0
  106. package/src/templates/default/.env.example +5 -0
  107. package/src/templates/default/.prettierrc +5 -0
  108. package/src/templates/default/AGENTS.md +65 -0
  109. package/src/templates/default/_gitignore +29 -0
  110. package/src/templates/default/client/App.tsx +54 -0
  111. package/src/templates/default/client/global.css +72 -0
  112. package/src/templates/default/client/lib/utils.ts +1 -0
  113. package/src/templates/default/client/vite-env.d.ts +1 -0
  114. package/src/templates/default/components.json +20 -0
  115. package/src/templates/default/index.html +14 -0
  116. package/src/templates/default/package.json +46 -0
  117. package/src/templates/default/postcss.config.js +6 -0
  118. package/src/templates/default/scripts/hello.ts +20 -0
  119. package/src/templates/default/scripts/run.ts +9 -0
  120. package/src/templates/default/server/index.ts +18 -0
  121. package/src/templates/default/server/node-build.ts +4 -0
  122. package/src/templates/default/shared/api.ts +6 -0
  123. package/src/templates/default/tailwind.config.ts +7 -0
  124. package/src/templates/default/tsconfig.json +3 -0
  125. package/src/templates/default/vite.config.server.ts +3 -0
  126. package/src/templates/default/vite.config.ts +3 -0
  127. package/tsconfig.base.json +41 -0
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Isomorphic Fusion Chat Utility
3
+ *
4
+ * Works in both browser and Node.js contexts:
5
+ * - Browser: sends via postMessage to the parent window
6
+ * - Node.js (scripts): sends via BUILDER_PARENT_MESSAGE stdout format,
7
+ * which the Electron host translates to postMessage
8
+ */
9
+ export interface FusionChatMessage {
10
+ /** The visible prompt text shown in the chat input */
11
+ message: string;
12
+ /** Hidden context appended to the prompt (not shown to user, but sent to AI) */
13
+ context?: string;
14
+ /** true = auto-submit, false = prefill only, omit = use project setting */
15
+ submit?: boolean;
16
+ }
17
+ /**
18
+ * Send a structured message to Fusion AI chat.
19
+ * Automatically detects environment (browser vs Node.js) and uses the right transport.
20
+ */
21
+ declare function send(data: FusionChatMessage): void;
22
+ /**
23
+ * Submit a message to Fusion chat (auto-submits by default).
24
+ */
25
+ declare function submit(message: string, context?: string): void;
26
+ /**
27
+ * Prefill the Fusion chat input without submitting (user reviews first).
28
+ */
29
+ declare function prefill(message: string, context?: string): void;
30
+ export declare const fusionChat: {
31
+ /** Send raw FusionChatMessage — full control over all fields */
32
+ send: typeof send;
33
+ /** Auto-submit a message to Fusion chat */
34
+ submit: typeof submit;
35
+ /** Prefill the chat input for user review before sending */
36
+ prefill: typeof prefill;
37
+ };
38
+ export {};
39
+ //# sourceMappingURL=fusion-chat.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Isomorphic Fusion Chat Utility
3
+ *
4
+ * Works in both browser and Node.js contexts:
5
+ * - Browser: sends via postMessage to the parent window
6
+ * - Node.js (scripts): sends via BUILDER_PARENT_MESSAGE stdout format,
7
+ * which the Electron host translates to postMessage
8
+ */
9
+ const FUSION_MESSAGE_TYPE = "builder.submitChat";
10
+ const isBrowser = typeof window !== "undefined" && typeof window.postMessage === "function";
11
+ /**
12
+ * Send a structured message to Fusion AI chat.
13
+ * Automatically detects environment (browser vs Node.js) and uses the right transport.
14
+ */
15
+ function send(data) {
16
+ const payload = { type: FUSION_MESSAGE_TYPE, data };
17
+ if (isBrowser) {
18
+ const target = window.parent !== window ? window.parent : window;
19
+ try {
20
+ target.postMessage(payload, "*");
21
+ }
22
+ catch (err) {
23
+ console.error("[fusionChat] postMessage failed:", err);
24
+ }
25
+ }
26
+ else {
27
+ // Node.js: use BUILDER_PARENT_MESSAGE stdout format for Electron integration
28
+ console.log("BUILDER_PARENT_MESSAGE:" +
29
+ JSON.stringify({ message: payload, targetOrigin: "*" }));
30
+ }
31
+ }
32
+ /**
33
+ * Submit a message to Fusion chat (auto-submits by default).
34
+ */
35
+ function submit(message, context) {
36
+ send({ message, context, submit: true });
37
+ }
38
+ /**
39
+ * Prefill the Fusion chat input without submitting (user reviews first).
40
+ */
41
+ function prefill(message, context) {
42
+ send({ message, context, submit: false });
43
+ }
44
+ export const fusionChat = {
45
+ /** Send raw FusionChatMessage — full control over all fields */
46
+ send,
47
+ /** Auto-submit a message to Fusion chat */
48
+ submit,
49
+ /** Prefill the chat input for user review before sending */
50
+ prefill,
51
+ };
52
+ //# sourceMappingURL=fusion-chat.js.map
@@ -0,0 +1 @@
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,MAAM,CAAC,WAAW,KAAK,UAAU,CAAC;AAE5E;;;GAGG;AACH,SAAS,IAAI,CAAC,IAAuB;IACnC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IAEpD,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,6EAA6E;QAC7E,OAAO,CAAC,GAAG,CACT,yBAAyB;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAC1D,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,OAAe,EAAE,OAAgB;IAC/C,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,OAAe,EAAE,OAAgB;IAChD,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,gEAAgE;IAChE,IAAI;IACJ,2CAA2C;IAC3C,MAAM;IACN,4DAA4D;IAC5D,OAAO;CACR,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { fusionChat, type FusionChatMessage } from "./fusion-chat.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { fusionChat } from "./fusion-chat.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Config } from "tailwindcss";
2
+ /**
3
+ * Agent-native Tailwind preset.
4
+ * Provides the standard HSL variable-based color system, shadcn/ui compatible
5
+ * theme tokens, sidebar colors, border radius, and accordion animations.
6
+ *
7
+ * Usage in tailwind.config.ts:
8
+ * import preset from "@agent-native/core/tailwind";
9
+ * export default { presets: [preset], content: ["./client/**\/*.{ts,tsx}"] };
10
+ */
11
+ declare const preset: Config;
12
+ export default preset;
13
+ //# sourceMappingURL=tailwind.preset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind.preset.d.ts","sourceRoot":"","sources":["../src/tailwind.preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,MAgFb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Agent-native Tailwind preset.
3
+ * Provides the standard HSL variable-based color system, shadcn/ui compatible
4
+ * theme tokens, sidebar colors, border radius, and accordion animations.
5
+ *
6
+ * Usage in tailwind.config.ts:
7
+ * import preset from "@agent-native/core/tailwind";
8
+ * export default { presets: [preset], content: ["./client/**\/*.{ts,tsx}"] };
9
+ */
10
+ const preset = {
11
+ darkMode: ["class"],
12
+ content: [],
13
+ prefix: "",
14
+ theme: {
15
+ container: {
16
+ center: true,
17
+ padding: "2rem",
18
+ screens: {
19
+ "2xl": "1400px",
20
+ },
21
+ },
22
+ extend: {
23
+ colors: {
24
+ border: "hsl(var(--border))",
25
+ input: "hsl(var(--input))",
26
+ ring: "hsl(var(--ring))",
27
+ background: "hsl(var(--background))",
28
+ foreground: "hsl(var(--foreground))",
29
+ primary: {
30
+ DEFAULT: "hsl(var(--primary))",
31
+ foreground: "hsl(var(--primary-foreground))",
32
+ },
33
+ secondary: {
34
+ DEFAULT: "hsl(var(--secondary))",
35
+ foreground: "hsl(var(--secondary-foreground))",
36
+ },
37
+ destructive: {
38
+ DEFAULT: "hsl(var(--destructive))",
39
+ foreground: "hsl(var(--destructive-foreground))",
40
+ },
41
+ muted: {
42
+ DEFAULT: "hsl(var(--muted))",
43
+ foreground: "hsl(var(--muted-foreground))",
44
+ },
45
+ accent: {
46
+ DEFAULT: "hsl(var(--accent))",
47
+ foreground: "hsl(var(--accent-foreground))",
48
+ },
49
+ popover: {
50
+ DEFAULT: "hsl(var(--popover))",
51
+ foreground: "hsl(var(--popover-foreground))",
52
+ },
53
+ card: {
54
+ DEFAULT: "hsl(var(--card))",
55
+ foreground: "hsl(var(--card-foreground))",
56
+ },
57
+ sidebar: {
58
+ DEFAULT: "hsl(var(--sidebar-background))",
59
+ foreground: "hsl(var(--sidebar-foreground))",
60
+ primary: "hsl(var(--sidebar-primary))",
61
+ "primary-foreground": "hsl(var(--sidebar-primary-foreground))",
62
+ accent: "hsl(var(--sidebar-accent))",
63
+ "accent-foreground": "hsl(var(--sidebar-accent-foreground))",
64
+ border: "hsl(var(--sidebar-border))",
65
+ ring: "hsl(var(--sidebar-ring))",
66
+ },
67
+ },
68
+ borderRadius: {
69
+ lg: "var(--radius)",
70
+ md: "calc(var(--radius) - 2px)",
71
+ sm: "calc(var(--radius) - 4px)",
72
+ },
73
+ keyframes: {
74
+ "accordion-down": {
75
+ from: { height: "0" },
76
+ to: { height: "var(--radix-accordion-content-height)" },
77
+ },
78
+ "accordion-up": {
79
+ from: { height: "var(--radix-accordion-content-height)" },
80
+ to: { height: "0" },
81
+ },
82
+ },
83
+ animation: {
84
+ "accordion-down": "accordion-down 0.2s ease-out",
85
+ "accordion-up": "accordion-up 0.2s ease-out",
86
+ },
87
+ },
88
+ },
89
+ plugins: [require("tailwindcss-animate")],
90
+ };
91
+ export default preset;
92
+ //# sourceMappingURL=tailwind.preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind.preset.js","sourceRoot":"","sources":["../src/tailwind.preset.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAW;IACrB,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,KAAK,EAAE;QACL,SAAS,EAAE;YACT,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,OAAO,EAAE;gBACP,KAAK,EAAE,QAAQ;aAChB;SACF;QACD,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,MAAM,EAAE,oBAAoB;gBAC5B,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE,kBAAkB;gBACxB,UAAU,EAAE,wBAAwB;gBACpC,UAAU,EAAE,wBAAwB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T,gBAAgB,EAAE,8BAA8B;gBAChD,cAAc,EAAE,4BAA4B;aAC7C;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { UserConfig } from "vite";
2
+ import { type ExpressPluginOptions } from "./express-plugin.js";
3
+ export interface ClientConfigOptions {
4
+ /** Port for dev server. Default: 8080 */
5
+ port?: number;
6
+ /** Additional Vite plugins */
7
+ plugins?: any[];
8
+ /** Express plugin options (serverEntry, etc) */
9
+ express?: ExpressPluginOptions;
10
+ /** Override resolve aliases */
11
+ aliases?: Record<string, string>;
12
+ /** Override build.outDir. Default: "dist/spa" */
13
+ outDir?: string;
14
+ /** Additional fs.allow paths */
15
+ fsAllow?: string[];
16
+ /** Additional fs.deny patterns */
17
+ fsDeny?: string[];
18
+ }
19
+ /**
20
+ * Create the client/SPA Vite config with sensible agent-native defaults.
21
+ * Includes React SWC, path aliases, fs restrictions, and the Express dev plugin.
22
+ */
23
+ export declare function defineConfig(options?: ClientConfigOptions): UserConfig;
24
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/vite/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,gDAAgD;IAChD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CA4C1E"}
@@ -0,0 +1,52 @@
1
+ import path from "path";
2
+ import { expressPlugin } from "./express-plugin.js";
3
+ /**
4
+ * Create the client/SPA Vite config with sensible agent-native defaults.
5
+ * Includes React SWC, path aliases, fs restrictions, and the Express dev plugin.
6
+ */
7
+ export function defineConfig(options = {}) {
8
+ // Dynamic import to keep it optional
9
+ let reactPlugin;
10
+ try {
11
+ reactPlugin = require("@vitejs/plugin-react-swc");
12
+ if (reactPlugin.default)
13
+ reactPlugin = reactPlugin.default;
14
+ }
15
+ catch {
16
+ // Will be resolved at runtime by Vite
17
+ }
18
+ const cwd = process.cwd();
19
+ return {
20
+ server: {
21
+ host: "::",
22
+ port: options.port ?? 8080,
23
+ fs: {
24
+ allow: ["./client", "./shared", ...(options.fsAllow ?? [])],
25
+ deny: [
26
+ ".env",
27
+ ".env.*",
28
+ "*.{crt,pem}",
29
+ "**/.git/**",
30
+ "server/**",
31
+ ...(options.fsDeny ?? []),
32
+ ],
33
+ },
34
+ },
35
+ build: {
36
+ outDir: options.outDir ?? "dist/spa",
37
+ },
38
+ plugins: [
39
+ reactPlugin?.(),
40
+ expressPlugin(options.express),
41
+ ...(options.plugins ?? []),
42
+ ].filter(Boolean),
43
+ resolve: {
44
+ alias: {
45
+ "@": path.resolve(cwd, "./client"),
46
+ "@shared": path.resolve(cwd, "./shared"),
47
+ ...options.aliases,
48
+ },
49
+ },
50
+ };
51
+ }
52
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/vite/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AA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F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from "vite";
2
+ export interface ExpressPluginOptions {
3
+ /** Path to the module that exports createServer(). Default: "./server" */
4
+ serverEntry?: string;
5
+ }
6
+ /**
7
+ * Vite plugin that mounts the Express app as middleware during dev.
8
+ * Only active in serve mode (not during build).
9
+ */
10
+ export declare function expressPlugin(options?: ExpressPluginOptions): Plugin;
11
+ //# sourceMappingURL=express-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express-plugin.d.ts","sourceRoot":"","sources":["../../src/vite/express-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAsBxE"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Vite plugin that mounts the Express app as middleware during dev.
3
+ * Only active in serve mode (not during build).
4
+ */
5
+ export function expressPlugin(options = {}) {
6
+ const serverEntry = options.serverEntry ?? "./server";
7
+ return {
8
+ name: "agent-native-express",
9
+ apply: "serve",
10
+ async configureServer(server) {
11
+ const mod = await server.ssrLoadModule(serverEntry);
12
+ const createServer = mod.createServer ?? mod.createAppServer ?? mod.default;
13
+ if (typeof createServer !== "function") {
14
+ throw new Error(`[@agent-native/core] Could not find createServer export in "${serverEntry}". ` +
15
+ `Export a createServer() function that returns an Express app.`);
16
+ }
17
+ const app = createServer();
18
+ server.middlewares.use(app);
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=express-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express-plugin.js","sourceRoot":"","sources":["../../src/vite/express-plugin.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,UAAgC,EAAE;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,UAAU,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,OAAO;QACd,KAAK,CAAC,eAAe,CAAC,MAAM;YAC1B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACpD,MAAM,YAAY,GAChB,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,OAAO,CAAC;YAEzD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CACb,+DAA+D,WAAW,KAAK;oBAC7E,+DAA+D,CAClE,CAAC;YACJ,CAAC;YAED,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;YAC3B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { defineConfig, type ClientConfigOptions } from "./client.js";
2
+ export { defineServerConfig, type ServerConfigOptions } from "./server.js";
3
+ export { expressPlugin, type ExpressPluginOptions } from "./express-plugin.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { defineConfig } from "./client.js";
2
+ export { defineServerConfig } from "./server.js";
3
+ export { expressPlugin } from "./express-plugin.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAA4B,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { UserConfig } from "vite";
2
+ export interface ServerConfigOptions {
3
+ /** Server entry file. Default: "server/node-build.ts" */
4
+ entry?: string;
5
+ /** Output directory. Default: "dist/server" */
6
+ outDir?: string;
7
+ /** Output filename (without extension). Default: "production" */
8
+ fileName?: string;
9
+ /** Node target. Default: "node22" */
10
+ target?: string;
11
+ /** Additional external packages to exclude from bundle */
12
+ external?: string[];
13
+ /** Override resolve aliases */
14
+ aliases?: Record<string, string>;
15
+ }
16
+ /**
17
+ * Create the server build Vite config.
18
+ * Builds the Node.js server entry as an ES module with externalized dependencies.
19
+ */
20
+ export declare function defineServerConfig(options?: ServerConfigOptions): UserConfig;
21
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAwBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,mBAAwB,GAChC,UAAU,CAyCZ"}
@@ -0,0 +1,68 @@
1
+ import path from "path";
2
+ const NODE_BUILTINS = [
3
+ "fs",
4
+ "path",
5
+ "url",
6
+ "http",
7
+ "https",
8
+ "os",
9
+ "crypto",
10
+ "stream",
11
+ "util",
12
+ "events",
13
+ "buffer",
14
+ "querystring",
15
+ "child_process",
16
+ "net",
17
+ "tls",
18
+ "dns",
19
+ "zlib",
20
+ "assert",
21
+ "worker_threads",
22
+ ];
23
+ /**
24
+ * Create the server build Vite config.
25
+ * Builds the Node.js server entry as an ES module with externalized dependencies.
26
+ */
27
+ export function defineServerConfig(options = {}) {
28
+ const cwd = process.cwd();
29
+ const entry = options.entry ?? "server/node-build.ts";
30
+ return {
31
+ build: {
32
+ lib: {
33
+ entry: path.resolve(cwd, entry),
34
+ name: "server",
35
+ fileName: options.fileName ?? "production",
36
+ formats: ["es"],
37
+ },
38
+ outDir: options.outDir ?? "dist/server",
39
+ target: options.target ?? "node22",
40
+ ssr: true,
41
+ rollupOptions: {
42
+ external: [
43
+ ...NODE_BUILTINS,
44
+ "express",
45
+ "cors",
46
+ ...(options.external ?? []),
47
+ ],
48
+ output: {
49
+ format: "es",
50
+ entryFileNames: "[name].mjs",
51
+ },
52
+ },
53
+ minify: false,
54
+ sourcemap: true,
55
+ },
56
+ resolve: {
57
+ alias: {
58
+ "@": path.resolve(cwd, "./client"),
59
+ "@shared": path.resolve(cwd, "./shared"),
60
+ ...options.aliases,
61
+ },
62
+ },
63
+ define: {
64
+ "process.env.NODE_ENV": '"production"',
65
+ },
66
+ };
67
+ }
68
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAkBxB,MAAM,aAAa,GAAG;IACpB,IAAI;IACJ,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,I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C;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@agent-native/core",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Framework for agent-native application development — where AI agents and UI share state via files",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "agent-native": "./dist/cli/index.js"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./vite": "./dist/vite/index.js",
13
+ "./server": "./dist/server/index.js",
14
+ "./client": "./dist/client/index.js",
15
+ "./shared": "./dist/shared/index.js",
16
+ "./scripts": "./dist/scripts/index.js",
17
+ "./adapters/firestore": "./dist/adapters/firestore/index.js",
18
+ "./tailwind": "./dist/tailwind.preset.js",
19
+ "./tsconfig.base.json": "./tsconfig.base.json"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "tsconfig.base.json",
24
+ "src/templates"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "dev": "tsc --watch",
29
+ "typecheck": "tsc --noEmit",
30
+ "prepublishOnly": "npm run build"
31
+ },
32
+ "dependencies": {
33
+ "chokidar": "^4.0.0",
34
+ "clsx": "^2.1.1",
35
+ "dotenv": "^17.2.1",
36
+ "minimatch": "^10.0.0",
37
+ "tailwind-merge": "^2.6.0"
38
+ },
39
+ "peerDependencies": {
40
+ "@tanstack/react-query": ">=5",
41
+ "@vitejs/plugin-react-swc": ">=4",
42
+ "autoprefixer": ">=10",
43
+ "cors": ">=2",
44
+ "express": ">=5",
45
+ "postcss": ">=8",
46
+ "react": ">=18",
47
+ "react-dom": ">=18",
48
+ "tailwindcss": ">=3",
49
+ "tailwindcss-animate": ">=1",
50
+ "typescript": ">=5",
51
+ "vite": ">=6"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@tanstack/react-query": { "optional": true },
55
+ "tailwindcss": { "optional": true },
56
+ "tailwindcss-animate": { "optional": true },
57
+ "autoprefixer": { "optional": true },
58
+ "postcss": { "optional": true },
59
+ "cors": { "optional": true },
60
+ "express": { "optional": true },
61
+ "@vitejs/plugin-react-swc": { "optional": true },
62
+ "vite": { "optional": true }
63
+ },
64
+ "devDependencies": {
65
+ "@tanstack/react-query": "^5.84.2",
66
+ "@types/cors": "^2.8.19",
67
+ "@types/express": "^5.0.3",
68
+ "@types/node": "^24.2.1",
69
+ "@types/react": "^18.3.23",
70
+ "@vitejs/plugin-react-swc": "^4.0.0",
71
+ "autoprefixer": "^10.4.21",
72
+ "cors": "^2.8.5",
73
+ "express": "^5.1.0",
74
+ "firebase-admin": "^13.0.0",
75
+ "postcss": "^8.5.6",
76
+ "react": "^18.3.1",
77
+ "tailwindcss": "^3.4.17",
78
+ "tailwindcss-animate": "^1.0.7",
79
+ "typescript": "^5.9.2",
80
+ "vite": "^7.1.2"
81
+ }
82
+ }
@@ -0,0 +1,5 @@
1
+ # Server port (production)
2
+ PORT=3000
3
+
4
+ # Custom health check message
5
+ PING_MESSAGE=pong
@@ -0,0 +1,5 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": false,
4
+ "trailingComma": "all"
5
+ }
@@ -0,0 +1,65 @@
1
+ # {{APP_NAME}} — Agent-Native App
2
+
3
+ ## Architecture
4
+
5
+ This is an **@agent-native/core** application — the AI agent and UI share state through files, not a traditional database.
6
+
7
+ ### Core Principles
8
+
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 `sendToFusionChat()` / `fusionChat.submit()`.
11
+ 3. **Scripts for agent operations** — `pnpm script <name>` dispatches to callable script files in `scripts/`.
12
+ 4. **Bidirectional SSE events** — The file watcher keeps the UI in sync when the agent modifies files.
13
+ 5. **Agent can update code** — The agent can modify this app's source code directly.
14
+
15
+ ### Directory Structure
16
+
17
+ ```
18
+ client/ # React frontend (Vite SPA)
19
+ App.tsx # Entry point
20
+ components/ # UI components
21
+ hooks/ # React hooks
22
+ lib/ # Utilities (cn, etc)
23
+
24
+ server/ # Express backend
25
+ index.ts # createAppServer() — routes + middleware
26
+ node-build.ts # Production entry point
27
+
28
+ shared/ # Isomorphic code (imported by both client & server)
29
+
30
+ scripts/ # Agent-callable scripts
31
+ run.ts # Script dispatcher
32
+ *.ts # Individual scripts (pnpm script <name>)
33
+
34
+ data/ # App data files (watched by SSE)
35
+ ```
36
+
37
+ ### Key Patterns
38
+
39
+ **Adding an API route:**
40
+ Edit `server/index.ts`, add your route to `createAppServer()`.
41
+
42
+ **Adding a script:**
43
+ Create `scripts/my-script.ts` exporting `default async function(args: string[])`.
44
+ Run with: `pnpm script my-script --arg value`
45
+
46
+ **Sending to Fusion chat from UI:**
47
+ ```ts
48
+ import { sendToFusionChat } from "@agent-native/core/client";
49
+ sendToFusionChat({ message: "Generate something", context: "...", submit: true });
50
+ ```
51
+
52
+ **Sending to Fusion chat from scripts:**
53
+ ```ts
54
+ import { fusionChat } from "@agent-native/core/shared";
55
+ fusionChat.submit("Generate something");
56
+ ```
57
+
58
+ ### Tech Stack
59
+
60
+ - **Framework:** @agent-native/core
61
+ - **Frontend:** React 18, Vite, TailwindCSS, shadcn/ui
62
+ - **Backend:** Express 5
63
+ - **State:** File-based (SSE for real-time updates)
64
+ - **Build:** `pnpm build` (client SPA + server bundle)
65
+ - **Dev:** `pnpm dev` (Vite dev server with Express middleware)