@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,29 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ pnpm-debug.log*
6
+
7
+ node_modules
8
+ dist
9
+ dist-ssr
10
+ *.local
11
+
12
+ # Editor directories and files
13
+ .vscode/*
14
+ !.vscode/extensions.json
15
+ .idea
16
+ .DS_Store
17
+ *.suo
18
+ *.ntvs*
19
+ *.njsproj
20
+ *.sln
21
+ *.sw?
22
+
23
+ # Environment
24
+ .env
25
+ .env.*
26
+ !.env.example
27
+
28
+ # Data
29
+ data/uploads/
@@ -0,0 +1,54 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
+ import { useFileWatcher } from "@agent-native/core/client";
5
+ import "./global.css";
6
+
7
+ const queryClient = new QueryClient();
8
+
9
+ function App() {
10
+ return (
11
+ <QueryClientProvider client={queryClient}>
12
+ <Main />
13
+ </QueryClientProvider>
14
+ );
15
+ }
16
+
17
+ function Main() {
18
+ useFileWatcher({ queryClient });
19
+
20
+ return (
21
+ <div className="min-h-screen bg-background text-foreground flex items-center justify-center">
22
+ <div className="text-center space-y-4">
23
+ <h1 className="text-4xl font-bold">Agent-Native App</h1>
24
+ <p className="text-muted-foreground">
25
+ Edit <code className="bg-muted px-2 py-1 rounded">client/App.tsx</code> to get started.
26
+ </p>
27
+ <p className="text-sm text-muted-foreground">
28
+ API health: <HealthCheck />
29
+ </p>
30
+ </div>
31
+ </div>
32
+ );
33
+ }
34
+
35
+ function HealthCheck() {
36
+ return (
37
+ <span
38
+ className="text-primary cursor-pointer hover:underline"
39
+ onClick={async () => {
40
+ const res = await fetch("/api/ping");
41
+ const data = await res.json();
42
+ alert(data.message);
43
+ }}
44
+ >
45
+ /api/ping
46
+ </span>
47
+ );
48
+ }
49
+
50
+ createRoot(document.getElementById("root")!).render(
51
+ <StrictMode>
52
+ <App />
53
+ </StrictMode>,
54
+ );
@@ -0,0 +1,72 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+ --background: 240 6% 4%;
8
+ --foreground: 240 6% 93%;
9
+
10
+ --card: 240 5% 8%;
11
+ --card-foreground: 240 6% 93%;
12
+
13
+ --popover: 240 5% 10%;
14
+ --popover-foreground: 240 6% 93%;
15
+
16
+ --primary: 211 100% 64%;
17
+ --primary-foreground: 0 0% 0%;
18
+
19
+ --secondary: 240 4% 14%;
20
+ --secondary-foreground: 240 6% 93%;
21
+
22
+ --muted: 240 4% 14%;
23
+ --muted-foreground: 240 4% 55%;
24
+
25
+ --accent: 240 4% 14%;
26
+ --accent-foreground: 240 6% 93%;
27
+
28
+ --destructive: 0 72% 51%;
29
+ --destructive-foreground: 0 0% 100%;
30
+
31
+ --border: 240 4% 16%;
32
+ --input: 240 4% 16%;
33
+ --ring: 211 100% 64%;
34
+
35
+ --radius: 0.5rem;
36
+
37
+ --sidebar-background: 240 5% 6%;
38
+ --sidebar-foreground: 240 6% 93%;
39
+ --sidebar-primary: 211 100% 64%;
40
+ --sidebar-primary-foreground: 0 0% 0%;
41
+ --sidebar-accent: 240 4% 14%;
42
+ --sidebar-accent-foreground: 240 6% 93%;
43
+ --sidebar-border: 240 4% 16%;
44
+ --sidebar-ring: 211 100% 64%;
45
+ }
46
+ }
47
+
48
+ @layer base {
49
+ * {
50
+ @apply border-border;
51
+ }
52
+
53
+ body {
54
+ @apply bg-background text-foreground antialiased;
55
+ font-family: system-ui, -apple-system, sans-serif;
56
+ }
57
+
58
+ ::-webkit-scrollbar {
59
+ width: 6px;
60
+ height: 6px;
61
+ }
62
+ ::-webkit-scrollbar-track {
63
+ background: transparent;
64
+ }
65
+ ::-webkit-scrollbar-thumb {
66
+ background: hsl(240 4% 20%);
67
+ border-radius: 3px;
68
+ }
69
+ ::-webkit-scrollbar-thumb:hover {
70
+ background: hsl(240 4% 28%);
71
+ }
72
+ }
@@ -0,0 +1 @@
1
+ export { cn } from "@agent-native/core/client";
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "default",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.ts",
8
+ "css": "client/global.css",
9
+ "baseColor": "slate",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{APP_TITLE}}</title>
7
+ </head>
8
+
9
+ <body>
10
+ <div id="root"></div>
11
+
12
+ <script type="module" src="/client/App.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "{{APP_NAME}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "npm run build:client && npm run build:server",
8
+ "build:client": "vite build",
9
+ "build:server": "vite build --config vite.config.server.ts",
10
+ "start": "node dist/server/production.mjs",
11
+ "typecheck": "tsc",
12
+ "format.fix": "prettier --write .",
13
+ "script": "tsx scripts/run.ts"
14
+ },
15
+ "dependencies": {
16
+ "@agent-native/core": "^0.1.0",
17
+ "dotenv": "^17.2.1",
18
+ "express": "^5.1.0"
19
+ },
20
+ "devDependencies": {
21
+ "@tanstack/react-query": "^5.84.2",
22
+ "@types/cors": "^2.8.19",
23
+ "@types/express": "^5.0.3",
24
+ "@types/node": "^24.2.1",
25
+ "@types/react": "^18.3.23",
26
+ "@types/react-dom": "^18.3.7",
27
+ "@vitejs/plugin-react-swc": "^4.0.0",
28
+ "autoprefixer": "^10.4.21",
29
+ "class-variance-authority": "^0.7.1",
30
+ "clsx": "^2.1.1",
31
+ "cors": "^2.8.5",
32
+ "lucide-react": "^0.539.0",
33
+ "postcss": "^8.5.6",
34
+ "prettier": "^3.6.2",
35
+ "react": "^18.3.1",
36
+ "react-dom": "^18.3.1",
37
+ "react-router-dom": "^6.30.1",
38
+ "sonner": "^1.7.4",
39
+ "tailwind-merge": "^2.6.0",
40
+ "tailwindcss": "^3.4.17",
41
+ "tailwindcss-animate": "^1.0.7",
42
+ "tsx": "^4.20.3",
43
+ "typescript": "^5.9.2",
44
+ "vite": "^7.1.2"
45
+ }
46
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Example script — callable via `pnpm script hello`
3
+ *
4
+ * Scripts export a default async function that receives CLI args.
5
+ */
6
+
7
+ import { parseArgs } from "@agent-native/core/scripts";
8
+ import { fusionChat } from "@agent-native/core/shared";
9
+
10
+ export default async function hello(args: string[]) {
11
+ const parsed = parseArgs(args);
12
+ const name = parsed.name ?? "world";
13
+
14
+ console.log(`Hello, ${name}!`);
15
+
16
+ // Example: send a message to Fusion chat (works in Electron context)
17
+ if (parsed["send-chat"] === "true") {
18
+ fusionChat.submit(`Hello from the script system! Name: ${name}`);
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Script dispatcher — runs any script in the scripts/ folder.
4
+ * Usage: pnpm script <script-name> [--args]
5
+ */
6
+
7
+ import { runScript } from "@agent-native/core/scripts";
8
+
9
+ runScript();
@@ -0,0 +1,18 @@
1
+ import "dotenv/config";
2
+ import { createServer, createFileWatcher, createSSEHandler } from "@agent-native/core/server";
3
+
4
+ export function createAppServer() {
5
+ const app = createServer();
6
+ const watcher = createFileWatcher("./data");
7
+
8
+ // --- Add your API routes here ---
9
+
10
+ app.get("/api/hello", (_req, res) => {
11
+ res.json({ message: "Hello from your @agent-native/core app!" });
12
+ });
13
+
14
+ // SSE events (keep this last)
15
+ app.get("/api/events", createSSEHandler(watcher));
16
+
17
+ return app;
18
+ }
@@ -0,0 +1,4 @@
1
+ import { createProductionServer } from "@agent-native/core/server";
2
+ import { createAppServer } from "./index.js";
3
+
4
+ createProductionServer(createAppServer());
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared API types and constants.
3
+ * Importable from both client (@shared/api) and server.
4
+ */
5
+
6
+ export const API_BASE = "/api";
@@ -0,0 +1,7 @@
1
+ import type { Config } from "tailwindcss";
2
+ import preset from "@agent-native/core/tailwind";
3
+
4
+ export default {
5
+ presets: [preset],
6
+ content: ["./client/**/*.{ts,tsx}"],
7
+ } satisfies Config;
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@agent-native/core/tsconfig.base.json"
3
+ }
@@ -0,0 +1,3 @@
1
+ import { defineServerConfig } from "@agent-native/core/vite";
2
+
3
+ export default defineServerConfig();
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from "@agent-native/core/vite";
2
+
3
+ export default defineConfig();
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "compilerOptions": {
4
+ "target": "ES2020",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+ "esModuleInterop": true,
17
+ "allowSyntheticDefaultImports": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+
20
+ "strict": false,
21
+ "noUnusedLocals": false,
22
+ "noUnusedParameters": false,
23
+ "noImplicitAny": false,
24
+ "noFallthroughCasesInSwitch": false,
25
+ "strictNullChecks": false,
26
+
27
+ "baseUrl": ".",
28
+ "paths": {
29
+ "@/*": ["./client/*"],
30
+ "@shared/*": ["./shared/*"]
31
+ }
32
+ },
33
+ "include": [
34
+ "client/**/*",
35
+ "server/**/*",
36
+ "shared/**/*",
37
+ "vite.config.ts",
38
+ "vite.config.server.ts"
39
+ ],
40
+ "exclude": ["node_modules", "dist"]
41
+ }