@agent-native/core 0.7.22 → 0.7.24

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 (140) hide show
  1. package/README.md +2 -2
  2. package/dist/a2a/client.d.ts +10 -4
  3. package/dist/a2a/client.d.ts.map +1 -1
  4. package/dist/a2a/client.js +16 -1
  5. package/dist/a2a/client.js.map +1 -1
  6. package/dist/a2a/handlers.d.ts.map +1 -1
  7. package/dist/a2a/handlers.js +20 -17
  8. package/dist/a2a/handlers.js.map +1 -1
  9. package/dist/cli/create.d.ts +3 -1
  10. package/dist/cli/create.d.ts.map +1 -1
  11. package/dist/cli/create.js +33 -32
  12. package/dist/cli/create.js.map +1 -1
  13. package/dist/cli/index.js +23 -0
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/cli/workspace-dev.d.ts +3 -0
  16. package/dist/cli/workspace-dev.d.ts.map +1 -0
  17. package/dist/cli/workspace-dev.js +323 -0
  18. package/dist/cli/workspace-dev.js.map +1 -0
  19. package/dist/cli/workspacify.d.ts +3 -3
  20. package/dist/cli/workspacify.js +4 -4
  21. package/dist/cli/workspacify.js.map +1 -1
  22. package/dist/client/AgentPanel.d.ts.map +1 -1
  23. package/dist/client/AgentPanel.js +10 -9
  24. package/dist/client/AgentPanel.js.map +1 -1
  25. package/dist/client/AssistantChat.d.ts.map +1 -1
  26. package/dist/client/AssistantChat.js +2 -1
  27. package/dist/client/AssistantChat.js.map +1 -1
  28. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  29. package/dist/client/MultiTabAssistantChat.js +2 -1
  30. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  31. package/dist/client/components/ui/tooltip.d.ts +8 -0
  32. package/dist/client/components/ui/tooltip.d.ts.map +1 -0
  33. package/dist/client/components/ui/tooltip.js +11 -0
  34. package/dist/client/components/ui/tooltip.js.map +1 -0
  35. package/dist/client/resources/ResourceTree.d.ts.map +1 -1
  36. package/dist/client/resources/ResourceTree.js +21 -17
  37. package/dist/client/resources/ResourceTree.js.map +1 -1
  38. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
  39. package/dist/client/resources/ResourcesPanel.js +13 -11
  40. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  41. package/dist/deploy/workspace-core.d.ts +1 -1
  42. package/dist/deploy/workspace-core.d.ts.map +1 -1
  43. package/dist/deploy/workspace-core.js +14 -11
  44. package/dist/deploy/workspace-core.js.map +1 -1
  45. package/dist/integrations/a2a-continuation-processor.d.ts +10 -0
  46. package/dist/integrations/a2a-continuation-processor.d.ts.map +1 -0
  47. package/dist/integrations/a2a-continuation-processor.js +150 -0
  48. package/dist/integrations/a2a-continuation-processor.js.map +1 -0
  49. package/dist/integrations/a2a-continuations-store.d.ts +41 -0
  50. package/dist/integrations/a2a-continuations-store.d.ts.map +1 -0
  51. package/dist/integrations/a2a-continuations-store.js +214 -0
  52. package/dist/integrations/a2a-continuations-store.js.map +1 -0
  53. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  54. package/dist/integrations/adapters/slack.js +4 -1
  55. package/dist/integrations/adapters/slack.js.map +1 -1
  56. package/dist/integrations/plugin.d.ts.map +1 -1
  57. package/dist/integrations/plugin.js +52 -0
  58. package/dist/integrations/plugin.js.map +1 -1
  59. package/dist/integrations/types.d.ts +5 -0
  60. package/dist/integrations/types.d.ts.map +1 -1
  61. package/dist/integrations/types.js.map +1 -1
  62. package/dist/integrations/webhook-handler.d.ts +6 -0
  63. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  64. package/dist/integrations/webhook-handler.js +69 -15
  65. package/dist/integrations/webhook-handler.js.map +1 -1
  66. package/dist/org/handlers.d.ts.map +1 -1
  67. package/dist/org/handlers.js +22 -16
  68. package/dist/org/handlers.js.map +1 -1
  69. package/dist/scripts/call-agent.d.ts.map +1 -1
  70. package/dist/scripts/call-agent.js +91 -30
  71. package/dist/scripts/call-agent.js.map +1 -1
  72. package/dist/server/agent-discovery.d.ts.map +1 -1
  73. package/dist/server/agent-discovery.js +17 -105
  74. package/dist/server/agent-discovery.js.map +1 -1
  75. package/dist/server/agents-bundle.js +1 -1
  76. package/dist/server/agents-bundle.js.map +1 -1
  77. package/dist/server/auth.d.ts.map +1 -1
  78. package/dist/server/auth.js +29 -120
  79. package/dist/server/auth.js.map +1 -1
  80. package/dist/server/better-auth-instance.d.ts +1 -0
  81. package/dist/server/better-auth-instance.d.ts.map +1 -1
  82. package/dist/server/better-auth-instance.js.map +1 -1
  83. package/dist/server/builder-browser.d.ts.map +1 -1
  84. package/dist/server/builder-browser.js +7 -5
  85. package/dist/server/builder-browser.js.map +1 -1
  86. package/dist/server/framework-request-handler.js +1 -1
  87. package/dist/server/framework-request-handler.js.map +1 -1
  88. package/dist/server/onboarding-html.d.ts +1 -8
  89. package/dist/server/onboarding-html.d.ts.map +1 -1
  90. package/dist/server/onboarding-html.js +321 -152
  91. package/dist/server/onboarding-html.js.map +1 -1
  92. package/dist/server/request-context.d.ts +14 -3
  93. package/dist/server/request-context.d.ts.map +1 -1
  94. package/dist/server/request-context.js +3 -0
  95. package/dist/server/request-context.js.map +1 -1
  96. package/dist/templates/default/_gitignore +2 -0
  97. package/dist/templates/workspace-core/AGENTS.md +18 -71
  98. package/dist/templates/workspace-core/package.json +2 -20
  99. package/dist/templates/workspace-core/src/client/index.ts +2 -26
  100. package/dist/templates/workspace-core/src/index.ts +1 -21
  101. package/dist/templates/workspace-core/src/server/index.ts +3 -22
  102. package/dist/templates/workspace-root/.prettierignore +19 -0
  103. package/dist/templates/workspace-root/README.md +17 -20
  104. package/dist/templates/workspace-root/_gitignore +8 -0
  105. package/dist/templates/workspace-root/package.json +8 -4
  106. package/dist/templates/workspace-root/pnpm-workspace.yaml +5 -2
  107. package/dist/vite/agents-bundle-plugin.js +2 -2
  108. package/dist/vite/agents-bundle-plugin.js.map +1 -1
  109. package/docs/content/authentication.md +3 -5
  110. package/docs/content/multi-app-workspace.md +38 -50
  111. package/package.json +1 -1
  112. package/src/templates/default/_gitignore +2 -0
  113. package/src/templates/workspace-core/AGENTS.md +18 -71
  114. package/src/templates/workspace-core/package.json +2 -20
  115. package/src/templates/workspace-core/src/client/index.ts +2 -26
  116. package/src/templates/workspace-core/src/index.ts +1 -21
  117. package/src/templates/workspace-core/src/server/index.ts +3 -22
  118. package/src/templates/workspace-root/.prettierignore +19 -0
  119. package/src/templates/workspace-root/README.md +17 -20
  120. package/src/templates/workspace-root/_gitignore +8 -0
  121. package/src/templates/workspace-root/package.json +8 -4
  122. package/src/templates/workspace-root/pnpm-workspace.yaml +5 -2
  123. package/dist/templates/default/.claude/settings.json +0 -100
  124. package/dist/templates/workspace-core/.agents/skills/company-policies/SKILL.md +0 -42
  125. package/dist/templates/workspace-core/actions/company-directory.ts +0 -38
  126. package/dist/templates/workspace-core/src/client/AuthenticatedLayout.tsx +0 -37
  127. package/dist/templates/workspace-core/src/credentials.ts +0 -67
  128. package/dist/templates/workspace-core/src/server/agent-chat-plugin.ts +0 -30
  129. package/dist/templates/workspace-core/src/server/auth-plugin.ts +0 -35
  130. package/dist/templates/workspace-core/styles/tokens.css +0 -22
  131. package/dist/templates/workspace-root/scripts/workspace-dev.ts +0 -377
  132. package/src/templates/default/.claude/settings.json +0 -100
  133. package/src/templates/workspace-core/.agents/skills/company-policies/SKILL.md +0 -42
  134. package/src/templates/workspace-core/actions/company-directory.ts +0 -38
  135. package/src/templates/workspace-core/src/client/AuthenticatedLayout.tsx +0 -37
  136. package/src/templates/workspace-core/src/credentials.ts +0 -67
  137. package/src/templates/workspace-core/src/server/agent-chat-plugin.ts +0 -30
  138. package/src/templates/workspace-core/src/server/auth-plugin.ts +0 -35
  139. package/src/templates/workspace-core/styles/tokens.css +0 -22
  140. package/src/templates/workspace-root/scripts/workspace-dev.ts +0 -377
@@ -1,23 +1,21 @@
1
1
  # {{APP_TITLE}} — Agent-Native Workspace
2
2
 
3
3
  A monorepo hosting multiple agent-native apps that all inherit from a single
4
- private **workspace core** package. The core module provides shared auth,
5
- agent instructions, skills, components, and plugins; each app just ships its
6
- own screens and template-specific actions.
4
+ private **shared** package. The framework provides the defaults; this package
5
+ is only for code, instructions, and policies that are genuinely shared by more
6
+ than one app.
7
7
 
8
8
  ## Layout
9
9
 
10
10
  ```
11
11
  {{APP_NAME}}/
12
12
  ├── packages/
13
- │ └── core-module/ # @{{APP_NAME}}/core-modulethe shared mid-layer
14
- │ ├── src/server/ # Auth / org / agent-chat plugin overrides
15
- │ ├── src/client/ # Shared React components (org switcher, layouts…)
16
- ├── actions/ # Shared agent-callable actions
17
- │ ├── skills/ # Shared .agents skills baked into every app
18
- │ └── AGENTS.md # Enterprise-wide agent instructions
13
+ │ └── shared/ # @{{APP_NAME}}/sharedoptional shared code
14
+ │ ├── src/server/ # Add plugin overrides only when needed
15
+ │ ├── src/client/ # Add shared React code only when needed
16
+ └── AGENTS.md # Workspace-wide agent instructions
19
17
  └── apps/
20
- └── example/ # Sample app demonstrating inheritance
18
+ └── example/ # App-specific routes, actions, and state
21
19
  ```
22
20
 
23
21
  ## Three-layer inheritance
@@ -26,14 +24,14 @@ Every app in this workspace inherits cross-cutting behavior automatically:
26
24
 
27
25
  1. **App local** (highest priority) — anything under `apps/<name>/server/plugins/`,
28
26
  `apps/<name>/actions/`, `apps/<name>/.agents/skills/`, `apps/<name>/AGENTS.md`.
29
- 2. **Workspace core** (middle) — `packages/core-module/src/server/`,
30
- `packages/core-module/actions/`, `packages/core-module/skills/`,
31
- `packages/core-module/AGENTS.md`.
27
+ 2. **Workspace shared** (middle) — `packages/shared/src/server/`,
28
+ `packages/shared/src/client/`, `packages/shared/actions/`,
29
+ `packages/shared/.agents/skills/`, `packages/shared/AGENTS.md`.
32
30
  3. **Framework** (lowest) — `@agent-native/core` defaults.
33
31
 
34
32
  Apps don't need any configuration to opt in. Discovery happens via the
35
33
  `agent-native.workspaceCore` field in this root `package.json`, which names
36
- the workspace core package (`@{{APP_NAME}}/core-module`).
34
+ the shared package (`@{{APP_NAME}}/shared`).
37
35
 
38
36
  ## Getting started
39
37
 
@@ -54,12 +52,11 @@ pnpm exec agent-native create crm --template=starter
54
52
  ```
55
53
 
56
54
  The CLI detects the workspace root and scaffolds a minimal app that already
57
- depends on `@{{APP_NAME}}/core-module`. Edit only the routes you care about;
58
- auth, org switching, skills, and instructions come from the core module.
55
+ depends on `@{{APP_NAME}}/shared`. Edit only the routes you care about;
56
+ auth, org switching, skills, and instructions come from the shared package.
59
57
 
60
58
  ## Editing shared behavior
61
59
 
62
- Everything cross-cutting lives in `packages/core-module/`. A change to
63
- `packages/core-module/src/server/auth-plugin.ts`, for example, is picked up
64
- by every app in the workspace on the next dev reload — no need to touch any
65
- individual app.
60
+ Put cross-cutting code in `packages/shared/` when more than one app needs it.
61
+ For example, exporting an `authPlugin` from `packages/shared/src/server/index.ts`
62
+ lets every app use the same auth customization on the next dev reload.
@@ -1,6 +1,14 @@
1
1
  node_modules/
2
2
  dist/
3
3
  build/
4
+ apps/*/dist/
5
+ apps/*/build/
6
+ apps/*/.output/
7
+ apps/*/.netlify/
8
+ apps/*/.vercel/
9
+ packages/*/node_modules/
10
+ packages/*/dist/
11
+ packages/*/build/
4
12
  .deploy-tmp/
5
13
 
6
14
  # Env files — never commit secrets
@@ -3,17 +3,21 @@
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "scripts": {
6
- "dev": "tsx scripts/workspace-dev.ts",
6
+ "dev": "agent-native dev",
7
7
  "build": "pnpm -r build",
8
- "typecheck": "pnpm -r typecheck"
8
+ "typecheck": "pnpm -r typecheck",
9
+ "fmt:check": "prettier --check .",
10
+ "lint": "pnpm fmt:check"
9
11
  },
10
12
  "agent-native": {
11
- "workspaceCore": "@{{APP_NAME}}/core-module"
13
+ "workspaceCore": "@{{APP_NAME}}/shared"
14
+ },
15
+ "dependencies": {
16
+ "@agent-native/core": "latest"
12
17
  },
13
18
  "devDependencies": {
14
19
  "@types/node": "^24.2.1",
15
20
  "prettier": "^3.6.2",
16
- "tsx": "catalog:",
17
21
  "typescript": "^6.0.3"
18
22
  },
19
23
  "packageManager": "pnpm@10.14.0"
@@ -3,7 +3,10 @@ packages:
3
3
  - "apps/*"
4
4
 
5
5
  onlyBuiltDependencies:
6
- - esbuild
6
+ - "@swc/core"
7
7
  - better-sqlite3
8
+ - canvas
9
+ - electron
10
+ - esbuild
8
11
  - lightningcss
9
- - "@swc/core"
12
+ - node-pty
@@ -41,7 +41,7 @@ async function emitBundleModule(projectRoot) {
41
41
  // analyze and tree-shake if nothing imports it.
42
42
  return `// AUTO-GENERATED by @agent-native/core/vite/agents-bundle-plugin
43
43
  // Contains the inlined AGENTS.md + .agents/skills/ content from the template,
44
- // merged with any workspace-core AGENTS.md + skills/ when present.
44
+ // merged with any workspace AGENTS.md + .agents/skills/ when present.
45
45
  const bundle = ${JSON.stringify(bundle)};
46
46
  export default bundle;
47
47
  `;
@@ -68,7 +68,7 @@ export function agentsBundlePlugin() {
68
68
  async configureServer(server) {
69
69
  // Watch AGENTS.md + any SKILL.md changes and invalidate the virtual
70
70
  // module so the next request picks up fresh content. Also watches
71
- // the workspace core's AGENTS.md + skills/ directory (if present)
71
+ // the workspace core's AGENTS.md + skills directory (if present)
72
72
  // so edits to the enterprise mid-layer propagate to every app.
73
73
  const watcher = server.watcher;
74
74
  // Resolve the workspace core up front so we can tell which files
@@ -1 +1 @@
1
- {"version":3,"file":"agents-bundle-plugin.js","sourceRoot":"","sources":["../../src/vite/agents-bundle-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EACL,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,UAAU,CAAC;AAEtC,KAAK,UAAU,gBAAgB,CAAC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C","sourcesContent":["/**\n * Vite plugin that resolves `virtual:agents-bundle` to a statically-inlined\n * ES module containing the template's AGENTS.md + .agents/skills/ content.\n *\n * This is how the framework's agent gets its instructions and skills into the\n * system prompt on EVERY deployment target — Node, Netlify Functions, Vercel\n * serverless, and Cloudflare Workers. The content is baked into the server\n * bundle at build time, so nothing needs to exist on the runtime filesystem.\n *\n * In dev mode, the plugin re-reads from disk on each import and triggers HMR\n * when any AGENTS.md or SKILL.md file changes, so edits show up instantly\n * without restarting the server.\n */\nimport path from \"path\";\nimport fs from \"fs\";\nimport type { Plugin } from \"vite\";\nimport {\n readAgentsBundleFromFs,\n type WorkspaceAgentsSource,\n} from \"../server/agents-bundle.js\";\nimport { getWorkspaceCoreExports } from \"../deploy/workspace-core.js\";\n\nconst VIRTUAL_ID = \"virtual:agents-bundle\";\nconst RESOLVED_ID = \"\\0\" + VIRTUAL_ID;\n\nasync function emitBundleModule(projectRoot: string): Promise<string> {\n // If the project is inside an enterprise monorepo with a workspace core,\n // merge in its AGENTS.md + skills. Template skills override workspace\n // core skills on name collision.\n let workspaceSource: WorkspaceAgentsSource | null = null;\n try {\n const ws = await getWorkspaceCoreExports(projectRoot);\n if (ws) {\n workspaceSource = {\n skillsDir: ws.skillsDir,\n agentsMdPath: ws.agentsMdPath,\n rootDir: ws.packageDir,\n };\n }\n } catch {\n // fall back to template-only\n }\n\n const bundle = readAgentsBundleFromFs(projectRoot, workspaceSource);\n // Serialize as JSON and wrap in `export default` — this produces a valid\n // ES module that any bundler (Rollup, esbuild, Rolldown) can statically\n // analyze and tree-shake if nothing imports it.\n return `// AUTO-GENERATED by @agent-native/core/vite/agents-bundle-plugin\n// Contains the inlined AGENTS.md + .agents/skills/ content from the template,\n// merged with any workspace-core AGENTS.md + skills/ when present.\nconst bundle = ${JSON.stringify(bundle)};\nexport default bundle;\n`;\n}\n\nexport function agentsBundlePlugin(): Plugin {\n let projectRoot = \"\";\n\n return {\n name: \"agent-native-agents-bundle\",\n\n configResolved(config) {\n projectRoot = config.root;\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID) return RESOLVED_ID;\n return null;\n },\n\n async load(id) {\n if (id !== RESOLVED_ID) return null;\n if (!projectRoot) projectRoot = process.cwd();\n return await emitBundleModule(projectRoot);\n },\n\n async configureServer(server) {\n // Watch AGENTS.md + any SKILL.md changes and invalidate the virtual\n // module so the next request picks up fresh content. Also watches\n // the workspace core's AGENTS.md + skills/ directory (if present)\n // so edits to the enterprise mid-layer propagate to every app.\n const watcher = server.watcher;\n\n // Resolve the workspace core up front so we can tell which files\n // outside projectRoot should trigger invalidation.\n let workspaceAgentsMdPath: string | null = null;\n let workspaceSkillsDir: string | null = null;\n try {\n const ws = await getWorkspaceCoreExports(projectRoot);\n if (ws) {\n workspaceAgentsMdPath = ws.agentsMdPath;\n workspaceSkillsDir = ws.skillsDir;\n }\n } catch {\n // ignore\n }\n\n const shouldInvalidate = (file: string): boolean => {\n const rel = path.relative(projectRoot, file);\n if (!rel.startsWith(\"..\")) {\n if (rel === \"AGENTS.md\") return true;\n if (\n rel.startsWith(\".agents\" + path.sep + \"skills\") &&\n rel.endsWith(\"SKILL.md\")\n )\n return true;\n }\n // Workspace-core files\n if (workspaceAgentsMdPath && file === workspaceAgentsMdPath) {\n return true;\n }\n if (\n workspaceSkillsDir &&\n file.startsWith(workspaceSkillsDir + path.sep) &&\n file.endsWith(\"SKILL.md\")\n ) {\n return true;\n }\n return false;\n };\n\n const invalidate = (file: string) => {\n if (!shouldInvalidate(file)) return;\n const mod = server.moduleGraph.getModuleById(RESOLVED_ID);\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({ type: \"full-reload\" });\n }\n };\n\n // Explicitly add template + workspace-core paths to the watcher so\n // edits outside the normal Vite watch set still trigger invalidation.\n const agentsMdPath = path.join(projectRoot, \"AGENTS.md\");\n const skillsDir = path.join(projectRoot, \".agents\", \"skills\");\n if (fs.existsSync(agentsMdPath)) watcher.add(agentsMdPath);\n if (fs.existsSync(skillsDir)) watcher.add(skillsDir);\n if (workspaceAgentsMdPath && fs.existsSync(workspaceAgentsMdPath)) {\n watcher.add(workspaceAgentsMdPath);\n }\n if (workspaceSkillsDir && fs.existsSync(workspaceSkillsDir)) {\n watcher.add(workspaceSkillsDir);\n }\n\n watcher.on(\"change\", invalidate);\n watcher.on(\"add\", invalidate);\n watcher.on(\"unlink\", invalidate);\n },\n };\n}\n"]}
1
+ {"version":3,"file":"agents-bundle-plugin.js","sourceRoot":"","sources":["../../src/vite/agents-bundle-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EACL,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,UAAU,CAAC;AAEtC,KAAK,UAAU,gBAAgB,CAAC,WAAmB;IACjD,yEAAyE;IACzE,sEAAsE;IACtE,iCAAiC;IACjC,IAAI,eAAe,GAAiC,IAAI,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,EAAE,EAAE,CAAC;YACP,eAAe,GAAG;gBAChB,SAAS,EAAE,EAAE,CAAC,SAAS;gBACvB,YAAY,EAAE,EAAE,CAAC,YAAY;gBAC7B,OAAO,EAAE,EAAE,CAAC,UAAU;aACvB,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,6BAA6B;IAC/B,CAAC;IAED,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACpE,yEAAyE;IACzE,wEAAwE;IACxE,gDAAgD;IAChD,OAAO;;;iBAGQ,IAAI,CAAC,SAAS,C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C,UAAU,CAAC,YAAY,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC3D,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACrD,IAAI,qBAAqB,IAAI,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;gBAClE,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACrC,CAAC;YACD,IAAI,kBAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC5D,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAClC,CAAC;YAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Vite plugin that resolves `virtual:agents-bundle` to a statically-inlined\n * ES module containing the template's AGENTS.md + .agents/skills/ content.\n *\n * This is how the framework's agent gets its instructions and skills into the\n * system prompt on EVERY deployment target — Node, Netlify Functions, Vercel\n * serverless, and Cloudflare Workers. The content is baked into the server\n * bundle at build time, so nothing needs to exist on the runtime filesystem.\n *\n * In dev mode, the plugin re-reads from disk on each import and triggers HMR\n * when any AGENTS.md or SKILL.md file changes, so edits show up instantly\n * without restarting the server.\n */\nimport path from \"path\";\nimport fs from \"fs\";\nimport type { Plugin } from \"vite\";\nimport {\n readAgentsBundleFromFs,\n type WorkspaceAgentsSource,\n} from \"../server/agents-bundle.js\";\nimport { getWorkspaceCoreExports } from \"../deploy/workspace-core.js\";\n\nconst VIRTUAL_ID = \"virtual:agents-bundle\";\nconst RESOLVED_ID = \"\\0\" + VIRTUAL_ID;\n\nasync function emitBundleModule(projectRoot: string): Promise<string> {\n // If the project is inside an enterprise monorepo with a workspace core,\n // merge in its AGENTS.md + skills. Template skills override workspace\n // core skills on name collision.\n let workspaceSource: WorkspaceAgentsSource | null = null;\n try {\n const ws = await getWorkspaceCoreExports(projectRoot);\n if (ws) {\n workspaceSource = {\n skillsDir: ws.skillsDir,\n agentsMdPath: ws.agentsMdPath,\n rootDir: ws.packageDir,\n };\n }\n } catch {\n // fall back to template-only\n }\n\n const bundle = readAgentsBundleFromFs(projectRoot, workspaceSource);\n // Serialize as JSON and wrap in `export default` — this produces a valid\n // ES module that any bundler (Rollup, esbuild, Rolldown) can statically\n // analyze and tree-shake if nothing imports it.\n return `// AUTO-GENERATED by @agent-native/core/vite/agents-bundle-plugin\n// Contains the inlined AGENTS.md + .agents/skills/ content from the template,\n// merged with any workspace AGENTS.md + .agents/skills/ when present.\nconst bundle = ${JSON.stringify(bundle)};\nexport default bundle;\n`;\n}\n\nexport function agentsBundlePlugin(): Plugin {\n let projectRoot = \"\";\n\n return {\n name: \"agent-native-agents-bundle\",\n\n configResolved(config) {\n projectRoot = config.root;\n },\n\n resolveId(id) {\n if (id === VIRTUAL_ID) return RESOLVED_ID;\n return null;\n },\n\n async load(id) {\n if (id !== RESOLVED_ID) return null;\n if (!projectRoot) projectRoot = process.cwd();\n return await emitBundleModule(projectRoot);\n },\n\n async configureServer(server) {\n // Watch AGENTS.md + any SKILL.md changes and invalidate the virtual\n // module so the next request picks up fresh content. Also watches\n // the workspace core's AGENTS.md + skills directory (if present)\n // so edits to the enterprise mid-layer propagate to every app.\n const watcher = server.watcher;\n\n // Resolve the workspace core up front so we can tell which files\n // outside projectRoot should trigger invalidation.\n let workspaceAgentsMdPath: string | null = null;\n let workspaceSkillsDir: string | null = null;\n try {\n const ws = await getWorkspaceCoreExports(projectRoot);\n if (ws) {\n workspaceAgentsMdPath = ws.agentsMdPath;\n workspaceSkillsDir = ws.skillsDir;\n }\n } catch {\n // ignore\n }\n\n const shouldInvalidate = (file: string): boolean => {\n const rel = path.relative(projectRoot, file);\n if (!rel.startsWith(\"..\")) {\n if (rel === \"AGENTS.md\") return true;\n if (\n rel.startsWith(\".agents\" + path.sep + \"skills\") &&\n rel.endsWith(\"SKILL.md\")\n )\n return true;\n }\n // Workspace-core files\n if (workspaceAgentsMdPath && file === workspaceAgentsMdPath) {\n return true;\n }\n if (\n workspaceSkillsDir &&\n file.startsWith(workspaceSkillsDir + path.sep) &&\n file.endsWith(\"SKILL.md\")\n ) {\n return true;\n }\n return false;\n };\n\n const invalidate = (file: string) => {\n if (!shouldInvalidate(file)) return;\n const mod = server.moduleGraph.getModuleById(RESOLVED_ID);\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({ type: \"full-reload\" });\n }\n };\n\n // Explicitly add template + workspace-core paths to the watcher so\n // edits outside the normal Vite watch set still trigger invalidation.\n const agentsMdPath = path.join(projectRoot, \"AGENTS.md\");\n const skillsDir = path.join(projectRoot, \".agents\", \"skills\");\n if (fs.existsSync(agentsMdPath)) watcher.add(agentsMdPath);\n if (fs.existsSync(skillsDir)) watcher.add(skillsDir);\n if (workspaceAgentsMdPath && fs.existsSync(workspaceAgentsMdPath)) {\n watcher.add(workspaceAgentsMdPath);\n }\n if (workspaceSkillsDir && fs.existsSync(workspaceSkillsDir)) {\n watcher.add(workspaceSkillsDir);\n }\n\n watcher.on(\"change\", invalidate);\n watcher.on(\"add\", invalidate);\n watcher.on(\"unlink\", invalidate);\n },\n };\n}\n"]}
@@ -35,22 +35,20 @@ Better Auth routes are mounted at `/_agent-native/auth/ba/*`. The framework also
35
35
 
36
36
  ## Development Mode {#dev-mode}
37
37
 
38
- In development (`NODE_ENV=development`), auth is automatically bypassed. If no other auth method succeeds (no account, no token, no local mode marker), `getSession()` returns `{ email: "local@localhost" }` so you can use the app immediately without any configuration.
38
+ In development (`NODE_ENV=development`), auth is automatically bypassed. If no other auth method succeeds (no account, no token), `getSession()` returns `{ email: "local@localhost" }` so you can use the app immediately without any configuration.
39
39
 
40
40
  This means you can run any template app locally and start using it right away — no account creation, no environment variables needed.
41
41
 
42
42
  ## Local Mode {#local-mode}
43
43
 
44
- For explicit no-auth in any environment (including production), set `AUTH_MODE=local` in your `.env` file. This returns `{ email: "local@localhost" }` for all requests, skipping all other auth checks.
45
-
46
- You can also enable local mode from the onboarding page by clicking "Use locally without an account". This writes a marker file that persists across server restarts.
44
+ For explicit no-auth in local development, set `AUTH_MODE=local` in your local shell or `.env` file. This returns `{ email: "local@localhost" }` for all requests, skipping all other auth checks.
47
45
 
48
46
  ```bash
49
47
  # .env
50
48
  AUTH_MODE=local
51
49
  ```
52
50
 
53
- To switch back to real auth, remove the line from `.env` (or clear the marker file by calling `POST /_agent-native/auth/exit-local-mode`).
51
+ To switch back to real auth, remove the line from `.env` and restart the dev server. The old `.agent-native/auth-mode` marker file is no longer read or generated.
54
52
 
55
53
  ## QA Accounts {#qa-accounts}
56
54
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: "Multi-App Workspace"
3
- description: "Host many agent-native apps in one monorepo with shared auth, RBAC, skills, instructions, components, and credentials."
3
+ description: "Host many agent-native apps in one monorepo with shared auth, RBAC, instructions, skills, components, and credentials."
4
4
  ---
5
5
 
6
6
  # Multi-App Workspace
@@ -9,25 +9,25 @@ When vibe-coding an internal tool takes an afternoon, you don't stop at one. A t
9
9
 
10
10
  At that point every app has its own `AGENTS.md`, its own auth plugin, its own copy-pasted layout component, its own hard-coded Slack token, its own idea of what an "organization" is. A compliance rule change means ten PRs. Rotating an API key means ten redeployments. A brand refresh means ten different headers drifting out of sync. The thing that made it easy to build them is now making it hard to manage them.
11
11
 
12
- The **multi-app workspace** pattern is how agent-native solves this. You host all your apps in one monorepo alongside a private **workspace core** package. The core owns everything cross-cutting auth, RBAC, agent skills, `AGENTS.md`, React components, design tokens, shared credentials, shared actions. Each app shrinks down to the handful of screens that make it unique. Change the core once; every app inherits the change on the next dev reload.
12
+ The **multi-app workspace** pattern is how agent-native solves this. You host all your apps in one monorepo alongside a private `packages/shared` package. The framework owns the common defaults; `packages/shared` is only for the code, instructions, skills, components, or plugin overrides that are genuinely custom to your workspace. Each app shrinks down to the handful of screens and actions that make it unique.
13
13
 
14
14
  ## What gets shared {#what-gets-shared}
15
15
 
16
- Anything every app in your org should agree on lives in the workspace core:
16
+ Anything every app in your org should agree on can live in `packages/shared`:
17
17
 
18
- | Shared thing | Where it lives in the core |
19
- | ----------------------------- | ---------------------------------------------------------------------------- |
20
- | Auth (login, session, social) | `src/server/auth-plugin.ts` |
21
- | Org / RBAC rules | Better Auth organizations, optionally wrapped in `src/server/auth-plugin.ts` |
22
- | Agent chat system prompt | `src/server/agent-chat-plugin.ts` |
23
- | Enterprise agent instructions | `AGENTS.md` |
24
- | Agent skills | `skills/<skill-name>/SKILL.md` |
25
- | Shared agent actions | `actions/*.ts` |
26
- | Shared React components | `src/client/*.tsx` (e.g. `AuthenticatedLayout`) |
27
- | Design tokens / brand | `styles/tokens.css` |
28
- | Shared API credentials | `src/credentials.ts` `resolveCompanyCredential()` |
18
+ | Shared thing | Where it lives |
19
+ | ----------------------------- | ----------------------------------------------------------------------------- |
20
+ | Auth / SSO override | Export `authPlugin` from `src/server/index.ts` |
21
+ | Org / RBAC rules | Better Auth organizations, optionally wrapped by that `authPlugin` |
22
+ | Agent chat override | Export `agentChatPlugin` from `src/server/index.ts` |
23
+ | Enterprise agent instructions | `AGENTS.md` |
24
+ | Agent skills | `.agents/skills/<skill-name>/SKILL.md` |
25
+ | Shared agent actions | `actions/*.ts` |
26
+ | Shared React components | Export from `src/client/index.ts` |
27
+ | Design tokens / brand | Add a shared CSS file and import it from each app |
28
+ | Shared API credentials | Prefer framework scoped credentials; add helpers only if you need namespacing |
29
29
 
30
- Each individual app becomes _just a set of screens_ — routes, dashboards, views, domain-specific actions. Everything else is inherited. If you're building ten tools for the same org, nine of them are 80% the same package, and the workspace core is where that 80% lives.
30
+ Each individual app becomes _just a set of screens_ — routes, dashboards, views, domain-specific actions. Framework defaults cover the rest until you add a real workspace customization.
31
31
 
32
32
  ## Getting started {#getting-started}
33
33
 
@@ -37,9 +37,9 @@ Workspace is the default shape of an agent-native project. Scaffold one with:
37
37
  pnpm dlx @agent-native/core create my-company-platform
38
38
  ```
39
39
 
40
- The CLI shows a multi-select picker of every first-party template. Pick as many as you want — Mail + Calendar + Forms, for example — and they all get scaffolded into the same workspace sharing auth, brand, and agent config.
40
+ The CLI shows a multi-select picker of every first-party template. Pick as many as you want — Mail + Calendar + Forms, for example — and they all get scaffolded into the same workspace sharing auth and database defaults.
41
41
 
42
- You get a pnpm monorepo with the private core package, a root `package.json` that wires up workspace discovery, a shared `.env`, and one sub-directory per app you picked:
42
+ You get a pnpm monorepo with the private shared package, a root `package.json` that wires up workspace discovery, a shared `.env`, and one sub-directory per app you picked:
43
43
 
44
44
  ```text
45
45
  my-company-platform/
@@ -48,15 +48,11 @@ my-company-platform/
48
48
  ├── .env.example # shared ANTHROPIC_API_KEY, BUILDER_PRIVATE_KEY,
49
49
  │ # A2A_SECRET, DATABASE_URL, ...
50
50
  ├── packages/
51
- │ └── core-module/ # @my-company-platform/core-module
51
+ │ └── shared/ # @my-company-platform/shared
52
52
  │ ├── src/
53
- │ │ ├── server/ # auth / agent-chat plugin overrides
54
- │ │ ├── client/ # shared React components
55
- └── credentials.ts # resolveCompanyCredential()
56
- │ ├── actions/ # shared agent-callable actions
57
- │ ├── skills/ # shared agent skills
58
- │ ├── AGENTS.md # enterprise-wide instructions
59
- │ └── styles/tokens.css # brand tokens (Tailwind v4 @theme + CSS vars)
53
+ │ │ ├── server/ # plugin overrides only when needed
54
+ │ │ └── client/ # shared React code only when needed
55
+ │ └── AGENTS.md # workspace-wide instructions
60
56
  └── apps/
61
57
  ├── mail/
62
58
  ├── calendar/
@@ -72,13 +68,13 @@ pnpm install
72
68
  pnpm dev # runs every app
73
69
  ```
74
70
 
75
- Every app renders through `<AuthenticatedLayout>` from the core. Every agent chat already sees the shared `AGENTS.md` and skills. Every app already knows how to log in and can call shared actions. You didn't wire any of that up — the framework auto-discovered the core via the `agent-native.workspaceCore` field in the root `package.json`:
71
+ Every app already knows how to log in, share the same database, and load the workspace `AGENTS.md`. You didn't wire any of that up — the framework auto-discovered the shared package via the `agent-native.workspaceCore` field in the root `package.json`:
76
72
 
77
73
  ```json
78
74
  {
79
75
  "name": "my-company-platform",
80
76
  "agent-native": {
81
- "workspaceCore": "@my-company-platform/core-module"
77
+ "workspaceCore": "@my-company-platform/shared"
82
78
  }
83
79
  }
84
80
  ```
@@ -97,24 +93,24 @@ The CLI shows the template picker again with apps you've already installed filte
97
93
  agent-native add-app crm --template content
98
94
  ```
99
95
 
100
- Any first-party template works as a workspace app — the CLI runs a small **workspacify** transform on the template that adds the workspace core as a dep and resolves `workspace:*` references. No parallel "workspace-app" scaffold to maintain.
96
+ Any first-party template works as a workspace app — the CLI runs a small **workspacify** transform on the template that adds the shared package as a dep and resolves `workspace:*` references. No parallel "workspace-app" scaffold to maintain.
101
97
 
102
98
  ```bash
103
99
  pnpm install # at the workspace root
104
- pnpm --filter crm dev
100
+ pnpm dev
105
101
  ```
106
102
 
107
- That's it. The new app has the same login as every other app in the workspace, the same agent instructions, the same brand, the same actions, the same shared credentials. All you add is the domain-specific screens.
103
+ That's it. The new app has the same login and workspace instructions as every other app. Add shared brand, actions, or credentials only when the workspace actually needs them.
108
104
 
109
105
  ## What you override where {#layering}
110
106
 
111
107
  Agent-native apps inside a workspace resolve cross-cutting behavior from three places, in this order:
112
108
 
113
109
  1. **App local** — files inside `apps/<name>/` (highest priority)
114
- 2. **Workspace core** — files inside `packages/core-module/` (the shared mid-layer)
110
+ 2. **Workspace shared** — files inside `packages/shared/` (the shared mid-layer)
115
111
  3. **Framework default** — `@agent-native/core` (lowest)
116
112
 
117
- The merge happens by file name. If an app provides a local file that also exists upstream, the local one wins. If it doesn't, the workspace core's version applies. If the core doesn't provide one either, the framework default kicks in. This applies to plugins, skills, actions, and `AGENTS.md`.
113
+ The merge happens by file name. If an app provides a local file that also exists upstream, the local one wins. If it doesn't, the workspace shared version applies. If shared doesn't provide one either, the framework default kicks in. This applies to plugins, skills, actions, and `AGENTS.md`.
118
114
 
119
115
  When one app needs something different, drop a local file:
120
116
 
@@ -130,15 +126,15 @@ No wiring, no config. Create the file and it takes over.
130
126
 
131
127
  ## Editing shared behavior {#editing-shared-behavior}
132
128
 
133
- Everything cross-cutting lives in `packages/core-module/`. Change `src/server/auth-plugin.ts` and every app in the workspace picks it up on the next dev reload. Add a new file to `skills/` and every app's agent instantly has access to the new skill. Add an action to `actions/` and every app's agent can call it.
129
+ Everything cross-cutting you customize lives in `packages/shared/`. Export an `authPlugin` from `src/server/index.ts` and every app picks it up on the next dev reload. Add a skill under `.agents/skills/` and every app's agent sees it. Add an action to `actions/` and every app's agent can call it.
134
130
 
135
- Because the core is a `workspace:*` dependency, pnpm symlinks it into each app's `node_modules/`. You never build or publish it — the apps bundle whatever they need from it at build time.
131
+ Because the shared package is a `workspace:*` dependency, pnpm symlinks it into each app's `node_modules/`. You never build or publish it — the apps bundle whatever they need from it at build time.
136
132
 
137
133
  ## Authentication and RBAC {#auth-and-rbac}
138
134
 
139
135
  Every agent-native app already ships with [Better Auth](/docs/authentication) and its organizations plugin — users, organizations, members, and the `owner` / `admin` / `member` roles are all first-class, shared across every template. In a workspace, you get that for free in every app, backed by the same database.
140
136
 
141
- For enterprise-specific rules (allow-list domains, SSO enforcement, extra role checks), wrap the framework auth plugin in `src/server/auth-plugin.ts` and re-export it. Every app in the workspace now enforces those rules.
137
+ For enterprise-specific rules (allow-list domains, SSO enforcement, extra role checks), export an `authPlugin` from `packages/shared/src/server/index.ts`. Every app in the workspace now enforces those rules.
142
138
 
143
139
  Active organization flows automatically: `session.orgId` → `AGENT_ORG_ID` → SQL row scoping, so data tagged with `org_id` is invisible to other orgs even to the agent. See [Security & Data Scoping](/docs/security) for the full model.
144
140
 
@@ -169,23 +165,15 @@ See [MCP Clients](/docs/mcp-clients) for the config schema, precedence rules, re
169
165
 
170
166
  ## Shared credentials {#shared-credentials}
171
167
 
172
- Rotate a third-party API key in one place and every app picks it up:
173
-
174
- ```ts
175
- import { resolveCompanyCredential } from "@my-company-platform/core-module/credentials";
176
-
177
- const slackToken = await resolveCompanyCredential("SLACK_BOT_TOKEN");
178
- ```
179
-
180
- Under the hood this wraps `@agent-native/core`'s `resolveCredential()`, which checks `process.env` first and then falls back to the shared `settings` table. Apps in the same workspace point at the same `DATABASE_URL` by default, so storing a credential in settings once makes it available to every app — no per-app config.
168
+ Apps in the same workspace point at the same `DATABASE_URL` by default, so framework credential storage can make a credential available to every app without per-app config. Use `@agent-native/core/credentials` directly, or add a thin helper in `packages/shared` if your workspace wants a stricter naming convention.
181
169
 
182
170
  ## Shared design tokens {#design-tokens}
183
171
 
184
- The framework is on Tailwind v4. The core ships a shared CSS file with the standard `@theme` tokens each app imports it from its `app/global.css`:
172
+ The framework is on Tailwind v4. Add a shared CSS file to `packages/shared` only when the workspace has real brand tokens to share, then import it from each app's `app/global.css`:
185
173
 
186
174
  ```css
187
175
  @import "tailwindcss";
188
- @import "@my-company-platform/core-module/styles/tokens.css";
176
+ @import "@my-company-platform/shared/styles/tokens.css";
189
177
  @source "./**/*.{ts,tsx}";
190
178
 
191
179
  :root {
@@ -196,7 +184,7 @@ The framework is on Tailwind v4. The core ships a shared CSS file with the stand
196
184
  }
197
185
  ```
198
186
 
199
- Brand colors, typography, spacing scales, and any shared component classes live in that one CSS file. Update it in the core and every app rebrands on the next build. Shared React components in `src/client/` pick up the same tokens automatically.
187
+ Brand colors, typography, spacing scales, and any shared component classes can live in that one CSS file. Update it in `packages/shared` and every app rebrands on the next build.
200
188
 
201
189
  ## Deployment {#deployment}
202
190
 
@@ -235,7 +223,7 @@ Prefer each app on its own domain (`mail.company.com`, `calendar.company.com`)?
235
223
 
236
224
  Whatever you pick, point every app at the same `DATABASE_URL` for cross-app state out of the box: one set of user accounts, one set of organizations, one set of shared settings. If each app has its own database, the workspace pattern still works — you just lose that shared-state story.
237
225
 
238
- The workspace core itself is never built or deployed standalone. It's a `workspace:*` dep that pnpm symlinks into each app's `node_modules/`, so every app transparently bundles whatever it needs from the core at build time.
226
+ The shared package itself is never deployed standalone. It's a `workspace:*` dep that pnpm symlinks into each app's `node_modules/`, so every app transparently bundles whatever it needs at build time.
239
227
 
240
228
  ## Out of scope (for now) {#out-of-scope}
241
229
 
@@ -243,5 +231,5 @@ The workspace pattern is intentionally narrow. A few things it deliberately does
243
231
 
244
232
  - **Cross-domain SSO.** The unified `agent-native deploy` flow solves the common case (one origin, many apps at `/mail`, `/calendar`, …). If you need `mail.company.com` and `calendar.company.com` on _different_ domains to share a session, that requires a shared cookie domain or a central auth app with OAuth redirects — both supported by the underlying stack but neither scaffolded out of the box.
245
233
  - **Encrypted credential vault.** Shared credentials live in the `settings` table as plain text today. Rotate responsibly.
246
- - **Publishing the core to private npm.** The core is `workspace:*` only; multi-repo sharing via a private registry is doable but not scaffolded.
247
- - **Opinionated component library.** The core is where _you_ put shared components. The framework doesn't force shadcn/ui or any other system into that slot.
234
+ - **Publishing shared code to private npm.** The shared package is `workspace:*` only; multi-repo sharing via a private registry is doable but not scaffolded.
235
+ - **Opinionated component library.** `packages/shared` is where _you_ put shared components. The framework doesn't force shadcn/ui or any other system into that slot.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.7.22",
3
+ "version": "0.7.24",
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",
@@ -40,3 +40,5 @@ data/.sessions.json
40
40
 
41
41
  # Learnings (personal preferences and memory — use learnings.defaults.md for tracked defaults)
42
42
  learnings.md
43
+
44
+ .vercel/
@@ -1,78 +1,25 @@
1
- # {{APP_TITLE}} Enterprise Agent Instructions
1
+ # {{APP_TITLE}} Workspace Instructions
2
2
 
3
- These instructions apply to **every app** in the {{APP_TITLE}} workspace. The
4
- framework auto-injects this file into each app's agent system prompt as a
5
- `<resource name="AGENTS.md" scope="workspace">` block. Individual apps can
6
- add their own template-specific AGENTS.md on top.
3
+ These instructions apply to every app in the {{APP_TITLE}} workspace. Keep
4
+ only rules that should be shared across all apps here. App-specific behavior
5
+ belongs in that app's own `AGENTS.md` or `.agents/skills/` directory.
7
6
 
8
- ## Company context
7
+ ## Shared Context
9
8
 
10
- Write a short paragraph here describing your company and what you do. The
11
- agent reads this first so every response can be grounded in the same
12
- business context without you having to repeat it per app.
9
+ Add company, product, compliance, or support-context notes that every app
10
+ agent should know.
13
11
 
14
- ## Shared conventions
12
+ ## Shared Conventions
15
13
 
16
- - **All cross-app state lives in the shared database.** Apps in this
17
- workspace share `DATABASE_URL` by default, so a record created by one
18
- app can be read by another as long as it respects the `owner_email` and
19
- `org_id` scoping conventions.
20
- - **All API secrets come from scoped credential storage.** Never hardcode a
21
- token or read `process.env` for user/org credentials in production. Call
22
- `resolveCompanyCredential("KEY", { userEmail, orgId })` from
23
- `@{{APP_NAME}}/core-module/credentials`, or omit the context only when the
24
- current request/action already has agent-native request context. The helper
25
- reads per-user credentials first and org-shared credentials second.
26
- - **UI chrome comes from the workspace core.** Wrap every screen in
27
- `<AuthenticatedLayout>` from `@{{APP_NAME}}/core-module/client`. Don't
28
- re-implement the brand header, sidebar, or org switcher per app.
29
- - **Design system.** If the app needs a button, dialog, or form control,
30
- import from our internal design system package (if you have one) or
31
- from the shared UI re-exports in `@{{APP_NAME}}/core-module/client`.
14
+ - Put shared code in `packages/shared` only when multiple apps need it.
15
+ - Keep app-specific screens, actions, state, and skills inside `apps/<app>`.
16
+ - Store shared runtime configuration in the workspace root `.env`; use
17
+ `apps/<app>/.env` only for app-specific overrides.
18
+ - Prefer framework defaults until the workspace has a real custom rule,
19
+ component, plugin, action, or skill to share.
32
20
 
33
- ## Compliance and policy
21
+ ## Adding Apps
34
22
 
35
- List any enterprise-wide rules the agent must follow data handling, PII
36
- guidelines, approval flows, deployment constraints. The agent will apply
37
- these to every decision it makes in every app.
38
-
39
- Example rules:
40
-
41
- - Never expose raw customer email addresses in logs.
42
- - Any action that modifies data must first be shown to the user with a
43
- preview and wait for confirmation.
44
- - Never make network calls to anything outside `*.{{APP_NAME}}.com` or
45
- the approved third-party allowlist.
46
-
47
- ## How to add a new app
48
-
49
- ```bash
50
- pnpm exec agent-native create <app-name> --template=starter
51
- ```
52
-
53
- Run this from the workspace root. The CLI detects the workspace and creates
54
- `apps/<app-name>` with the workspace core module already connected. Use a
55
- different template when useful, for example `--template=analytics` or
56
- `--template=forms`.
57
-
58
- The workspace dev command is a gateway:
59
-
60
- ```bash
61
- pnpm dev
62
- ```
63
-
64
- It opens Dispatch at `/dispatch`, serves every app at `/<app-name>`, and
65
- auto-detects newly-created app directories. After creating an app, do not
66
- restart the dev server unless the gateway reports an error; wait for it to
67
- start the new app process, then open `/<app-name>`.
68
-
69
- The new app will automatically inherit:
70
-
71
- 1. The workspace auth plugin (Better Auth + company SSO)
72
- 2. The agent chat plugin with this AGENTS.md pre-loaded
73
- 3. Every skill in `packages/core-module/skills/`
74
- 4. Every action in `packages/core-module/actions/`
75
- 5. The shared Tailwind preset and React components
76
-
77
- The only files the new app needs to own are its own routes/screens and any
78
- template-specific actions.
23
+ Run `pnpm exec agent-native create <app-name> --template=starter` from the
24
+ workspace root. The workspace dev gateway (`pnpm dev`) detects new
25
+ `apps/<app-name>` directories automatically.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "@{{APP_NAME}}/core-module",
2
+ "name": "@{{APP_NAME}}/shared",
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "type": "module",
@@ -18,19 +18,11 @@
18
18
  "types": "./src/client/index.ts",
19
19
  "development": "./src/client/index.ts",
20
20
  "default": "./dist/client/index.js"
21
- },
22
- "./credentials": {
23
- "types": "./src/credentials.ts",
24
- "development": "./src/credentials.ts",
25
- "default": "./dist/credentials.js"
26
- },
27
- "./styles/tokens.css": "./styles/tokens.css"
21
+ }
28
22
  },
29
23
  "files": [
30
24
  "dist",
31
25
  "src",
32
- "styles",
33
- "actions",
34
26
  "AGENTS.md"
35
27
  ],
36
28
  "scripts": {
@@ -39,17 +31,7 @@
39
31
  "typecheck": "tsc --noEmit",
40
32
  "prepare": "tsc"
41
33
  },
42
- "dependencies": {
43
- "@agent-native/core": "latest",
44
- "zod": "^4.3.6"
45
- },
46
34
  "devDependencies": {
47
- "@types/node": "^24.2.1",
48
- "@types/react": "^19.2.14",
49
- "react": "^19.2.5",
50
35
  "typescript": "^6.0.3"
51
- },
52
- "peerDependencies": {
53
- "react": "^19.2.5"
54
36
  }
55
37
  }
@@ -1,26 +1,2 @@
1
- /**
2
- * Client-side entry for @{{APP_NAME}}/core-module.
3
- *
4
- * This is where shared React components, hooks, and providers that EVERY
5
- * app in your workspace needs live. Think of it as the "app shell" layer
6
- * between the framework's primitives (@agent-native/core/client) and the
7
- * individual app's screens:
8
- *
9
- * - Authenticated layouts (header / sidebar / footer with brand)
10
- * - Org switchers wired to your company's org plugin
11
- * - Common chrome: loading states, error boundaries, empty states
12
- * - Wrappers around @agent-native/core components that apply your
13
- * enterprise design tokens
14
- *
15
- * Apps import from here instead of re-implementing or copy-pasting:
16
- *
17
- * import { AuthenticatedLayout } from "@{{APP_NAME}}/core-module/client";
18
- *
19
- * NOTE: This package does not ship shadcn/ui or a generic design system
20
- * by default. If you already have an internal `@{{APP_NAME}}/design-system`
21
- * package, add it as a dep here and re-export from this file. Otherwise
22
- * you can drop any shadcn components the apps share into `./ui/` and
23
- * export them from this index.
24
- */
25
-
26
- export { AuthenticatedLayout } from "./AuthenticatedLayout.js";
1
+ // Export shared React components and hooks here when multiple apps need them.
2
+ export {};