@agent-native/core 0.49.10 → 0.49.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/skills.d.ts +5 -5
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +195 -15
- package/dist/cli/skills.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +10 -2
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/actions.js +1 -1
- package/dist/extensions/actions.js.map +1 -1
- package/dist/local-artifacts/index.d.ts +101 -0
- package/dist/local-artifacts/index.d.ts.map +1 -0
- package/dist/local-artifacts/index.js +507 -0
- package/dist/local-artifacts/index.js.map +1 -0
- package/dist/secrets/substitution.js +2 -2
- package/dist/secrets/substitution.js.map +1 -1
- package/dist/server/auth-marketing.d.ts +1 -0
- package/dist/server/auth-marketing.d.ts.map +1 -1
- package/dist/server/auth-marketing.js +5 -0
- package/dist/server/auth-marketing.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +2 -2
- package/dist/server/auth.js.map +1 -1
- package/dist/server/entry-server.d.ts +27 -4
- package/dist/server/entry-server.d.ts.map +1 -1
- package/dist/server/entry-server.js +63 -43
- package/dist/server/entry-server.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +3 -3
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/social-og-image.d.ts +2 -0
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +20 -7
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +2 -2
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/social-meta.d.ts +2 -0
- package/dist/shared/social-meta.d.ts.map +1 -1
- package/dist/shared/social-meta.js +5 -0
- package/dist/shared/social-meta.js.map +1 -1
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +3 -1
- package/dist/templates/default/app/entry.server.tsx +8 -2
- package/dist/templates/starter-shell-sync.spec.ts +4 -3
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +3 -2
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +3 -1
- package/dist/vite/client.d.ts +11 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +26 -1
- package/dist/vite/client.js.map +1 -1
- package/docs/content/local-file-mode.md +225 -0
- package/docs/content/template-content.md +11 -0
- package/package.json +5 -1
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +3 -1
- package/src/templates/default/app/entry.server.tsx +8 -2
- package/src/templates/starter-shell-sync.spec.ts +4 -3
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +3 -2
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +3 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Local File Mode"
|
|
3
|
+
description: "Run agent-native apps with local Markdown, MDX, and other repo files as the source of truth instead of SQL-backed records."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Local File Mode
|
|
7
|
+
|
|
8
|
+
Local File Mode lets an agent-native app attach its normal UI and action surface
|
|
9
|
+
directly to files in a repo or workspace. The app still feels like the hosted
|
|
10
|
+
product, but its list views, editor, and agent tools read and write local files
|
|
11
|
+
instead of SQL-backed app records.
|
|
12
|
+
|
|
13
|
+
The first implementation is in the Content template: the left sidebar is
|
|
14
|
+
populated from local `.md` and `.mdx` files, selecting a page opens the standard
|
|
15
|
+
Content editor, and saving writes back to the selected file. The same files can
|
|
16
|
+
also be edited by Codex, Claude Code, the Agent-Native sidebar agent, or a normal
|
|
17
|
+
editor.
|
|
18
|
+
|
|
19
|
+
Use Local File Mode when you want a repo-first workflow:
|
|
20
|
+
|
|
21
|
+
- a docs repo with `docs/*.mdx`
|
|
22
|
+
- a blog with `blog/*.mdx`
|
|
23
|
+
- resources such as positioning, messaging, or team notes in `resources/*.md`
|
|
24
|
+
- a personal Obsidian-style knowledge base with a richer MDX editor
|
|
25
|
+
- app artifacts that should be easy for coding agents to inspect and patch
|
|
26
|
+
|
|
27
|
+
Use database mode when you want the hosted collaborative app experience:
|
|
28
|
+
multi-user sharing, SQL-backed permissions, comments, version history, and
|
|
29
|
+
production hosting without local filesystem access.
|
|
30
|
+
|
|
31
|
+
## The Mental Model
|
|
32
|
+
|
|
33
|
+
There are two source-of-truth modes:
|
|
34
|
+
|
|
35
|
+
| Mode | Source of truth | Best for |
|
|
36
|
+
| --------------- | ------------------------------------------ | ------------------------------------------------------------------------ |
|
|
37
|
+
| Database mode | SQL rows through Drizzle | Hosted apps, collaboration, sharing, comments, version history |
|
|
38
|
+
| Local File Mode | Repo files declared by `agent-native.json` | Local/dev workflows, Git review, coding-agent edits, file-native content |
|
|
39
|
+
|
|
40
|
+
The UI and agent actions should stay the same shape in both modes. A Content
|
|
41
|
+
editor still edits documents; the difference is whether those documents resolve
|
|
42
|
+
to SQL rows or local files.
|
|
43
|
+
|
|
44
|
+
## Example Repo
|
|
45
|
+
|
|
46
|
+
A Content workspace can be as small as this:
|
|
47
|
+
|
|
48
|
+
```txt
|
|
49
|
+
my-content-repo/
|
|
50
|
+
agent-native.json
|
|
51
|
+
docs/
|
|
52
|
+
getting-started.mdx
|
|
53
|
+
guides/
|
|
54
|
+
custom-components.mdx
|
|
55
|
+
blog/
|
|
56
|
+
launch-post.mdx
|
|
57
|
+
resources/
|
|
58
|
+
messaging/
|
|
59
|
+
positioning.md
|
|
60
|
+
components/
|
|
61
|
+
FrameworkTabs.tsx
|
|
62
|
+
Callout.tsx
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
In Local File Mode, the Content sidebar shows the `docs/`, `blog/`, and
|
|
66
|
+
`resources/` trees as pages. Selecting `docs/getting-started.mdx` opens that
|
|
67
|
+
file in the standard Content editor; editing in the UI writes back to
|
|
68
|
+
`docs/getting-started.mdx`.
|
|
69
|
+
|
|
70
|
+
`components/` is not a content root. It is a preview component library that MDX
|
|
71
|
+
files can import or reference. The editor can render simple local MDX components
|
|
72
|
+
without requiring you to clone or fork the entire Content app.
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
Add `agent-native.json` to the repo or workspace root:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"version": 1,
|
|
81
|
+
"apps": {
|
|
82
|
+
"content": {
|
|
83
|
+
"mode": "local-files",
|
|
84
|
+
"roots": [
|
|
85
|
+
{
|
|
86
|
+
"name": "Docs",
|
|
87
|
+
"path": "docs",
|
|
88
|
+
"kind": "docs",
|
|
89
|
+
"extensions": [".md", ".mdx"]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "Blog",
|
|
93
|
+
"path": "blog",
|
|
94
|
+
"kind": "blog",
|
|
95
|
+
"extensions": [".md", ".mdx"]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "Resources",
|
|
99
|
+
"path": "resources",
|
|
100
|
+
"kind": "resources",
|
|
101
|
+
"extensions": [".md", ".mdx"]
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"components": "components",
|
|
105
|
+
"hide": ["**/_*.md", "**/_*.mdx"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
You can also enable local files with `AGENT_NATIVE_MODE=local-files` or
|
|
112
|
+
`AGENT_NATIVE_DATA_MODE=local-files`; the manifest is preferred because it
|
|
113
|
+
documents the folder contract in the repo itself.
|
|
114
|
+
|
|
115
|
+
## Content File Format
|
|
116
|
+
|
|
117
|
+
Content reads Markdown and MDX. Frontmatter holds page metadata, and the body is
|
|
118
|
+
the editable document:
|
|
119
|
+
|
|
120
|
+
```mdx
|
|
121
|
+
---
|
|
122
|
+
title: "Getting Started"
|
|
123
|
+
icon: "sparkles"
|
|
124
|
+
isFavorite: true
|
|
125
|
+
updatedAt: "2026-06-12T20:00:00.000Z"
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
# Getting Started
|
|
129
|
+
|
|
130
|
+
Use <FrameworkTabs value="react" /> to show framework-specific code.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The title comes from `title` frontmatter when present, otherwise from the
|
|
134
|
+
filename. The editor preserves MDX source that it cannot visually edit yet, so
|
|
135
|
+
coding agents and normal text editors remain safe escape hatches.
|
|
136
|
+
|
|
137
|
+
## Custom MDX Components
|
|
138
|
+
|
|
139
|
+
Content can preview local components from the configured `components` folder.
|
|
140
|
+
This is meant for docs-style MDX components such as tabs, callouts, package
|
|
141
|
+
install snippets, or framework-specific code blocks.
|
|
142
|
+
|
|
143
|
+
Simple component tags with literal props can preview inline:
|
|
144
|
+
|
|
145
|
+
```mdx
|
|
146
|
+
<FrameworkTabs value="react" />
|
|
147
|
+
|
|
148
|
+
<Callout type="warning">This setting affects production deploys.</Callout>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Complex JSX expressions are preserved in source. If the editor cannot safely
|
|
152
|
+
preview a component prop yet, it shows a warning placeholder rather than
|
|
153
|
+
silently dropping data.
|
|
154
|
+
|
|
155
|
+
## How Apps Use It
|
|
156
|
+
|
|
157
|
+
Local File Mode is implemented through the framework's local artifact helpers.
|
|
158
|
+
An app declares roots for the artifact types it owns, then reads and writes
|
|
159
|
+
through the same action surface its UI and agent already use.
|
|
160
|
+
|
|
161
|
+
For Content, that means:
|
|
162
|
+
|
|
163
|
+
- `list-documents` lists configured `.md` and `.mdx` files.
|
|
164
|
+
- `get-document` reads a selected local file.
|
|
165
|
+
- `update-document` writes the selected local file.
|
|
166
|
+
- `create-document` creates a new local `.mdx` file in the selected folder.
|
|
167
|
+
- `delete-document` deletes the local file.
|
|
168
|
+
- search runs across the configured local files.
|
|
169
|
+
|
|
170
|
+
Moving, renaming, and reordering local-file pages from the Content UI is not
|
|
171
|
+
supported yet. Do those operations in the workspace or with a coding agent; the
|
|
172
|
+
Content sidebar will reflect the resulting file tree.
|
|
173
|
+
|
|
174
|
+
This keeps the agent contract simple: the agent can keep using Content actions,
|
|
175
|
+
and those actions decide whether the target is SQL-backed or file-backed.
|
|
176
|
+
|
|
177
|
+
Other apps can adopt the same pattern over time. A Slides app can map
|
|
178
|
+
`slides/*.mdx` to decks, a Plans app can map `plans/*` to plan documents, and a
|
|
179
|
+
Dashboards app can map `dashboards/*.mdx` to dashboards. Those app-specific
|
|
180
|
+
folders are conventions layered on top of the same local artifact contract.
|
|
181
|
+
|
|
182
|
+
## Local Files vs. Export/Import
|
|
183
|
+
|
|
184
|
+
Content has two different file workflows:
|
|
185
|
+
|
|
186
|
+
| Workflow | What happens |
|
|
187
|
+
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
188
|
+
| `/local-files` export/import | Database mode remains the source of truth. Files are an explicit sync surface you export, edit, preview, and import. |
|
|
189
|
+
| Local File Mode | Files are the source of truth. The Content sidebar and editor operate directly on local files. |
|
|
190
|
+
|
|
191
|
+
Use export/import when you want occasional file review around a hosted workspace.
|
|
192
|
+
Use Local File Mode when the repo itself is the workspace.
|
|
193
|
+
|
|
194
|
+
## History And Collaboration
|
|
195
|
+
|
|
196
|
+
Local File Mode leans on file-native history:
|
|
197
|
+
|
|
198
|
+
- commit important changes to Git
|
|
199
|
+
- use pull requests for review
|
|
200
|
+
- let coding agents edit the same files directly
|
|
201
|
+
- use normal file diffs to understand changes
|
|
202
|
+
|
|
203
|
+
Database mode remains the better fit for hosted collaboration features such as
|
|
204
|
+
sharing, comments, SQL-backed version history, and live multi-user editing.
|
|
205
|
+
|
|
206
|
+
Provider sync can be layered on top of either mode. For example, a docs repo can
|
|
207
|
+
add actions that pull content from a CMS into local MDX files or push selected
|
|
208
|
+
local files back to that CMS.
|
|
209
|
+
|
|
210
|
+
## Production Safety
|
|
211
|
+
|
|
212
|
+
Local File Mode gives app actions direct write access to configured workspace
|
|
213
|
+
files. That is appropriate for local development and trusted single-tenant file
|
|
214
|
+
bridges, but it is not the default production security model.
|
|
215
|
+
|
|
216
|
+
When `NODE_ENV=production`, the framework refuses `local-files` mode unless you
|
|
217
|
+
set:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
AGENT_NATIVE_ALLOW_LOCAL_FILES_IN_PRODUCTION=true
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Only set that for a trusted single-tenant deployment where everyone who can use
|
|
224
|
+
the app is allowed to read and write the configured files. For normal hosted,
|
|
225
|
+
multi-user apps, use database mode and SQL-backed sharing.
|
|
@@ -64,6 +64,17 @@ as the review surface. The hosted app remains the source of truth for sharing,
|
|
|
64
64
|
comments, permissions, and live collaboration; the local folder is an explicit
|
|
65
65
|
sync surface.
|
|
66
66
|
|
|
67
|
+
Content can also run in **Local File Mode**, where files are the source of
|
|
68
|
+
truth instead of SQL documents. Add `agent-native.json` to a repo, set
|
|
69
|
+
`mode: "local-files"`, and configure roots such as `docs/`, `blog/`,
|
|
70
|
+
`content/`, and `resources/`. The standard Content editor then populates its
|
|
71
|
+
left sidebar from those local `.md`/`.mdx` files and writes edits back to the
|
|
72
|
+
selected file through the normal document actions. Use this for repo-first docs,
|
|
73
|
+
blogs, resource libraries, or Obsidian-style personal content; switch back to
|
|
74
|
+
database mode when you want hosted collaboration and SQL-backed sharing. See
|
|
75
|
+
[Local File Mode](/docs/local-file-mode) for the standalone repo layout,
|
|
76
|
+
configuration, custom MDX component, and production safety guide.
|
|
77
|
+
|
|
67
78
|
## Why it's interesting
|
|
68
79
|
|
|
69
80
|
Three things make Content a good showcase of the framework:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -114,6 +114,10 @@
|
|
|
114
114
|
"./provider-api/actions/query-staged-dataset": "./dist/provider-api/actions/query-staged-dataset.js",
|
|
115
115
|
"./provider-api/actions/list-staged-datasets": "./dist/provider-api/actions/list-staged-datasets.js",
|
|
116
116
|
"./provider-api/actions/delete-staged-dataset": "./dist/provider-api/actions/delete-staged-dataset.js",
|
|
117
|
+
"./local-artifacts": {
|
|
118
|
+
"types": "./dist/local-artifacts/index.d.ts",
|
|
119
|
+
"default": "./dist/local-artifacts/index.js"
|
|
120
|
+
},
|
|
117
121
|
"./workspace-files": "./dist/workspace-files/index.js",
|
|
118
122
|
"./code-agents": "./dist/code-agents/index.js",
|
|
119
123
|
"./code-agents/transcript-normalizer": "./dist/code-agents/transcript-normalizer.js",
|
|
@@ -12,7 +12,9 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
## Rule
|
|
14
14
|
|
|
15
|
-
All application data lives in **SQL** (SQLite locally, persistent database in production). The agent and UI share the same database. Do not store durable app data in the filesystem.
|
|
15
|
+
All application data lives in **SQL** (SQLite locally, persistent database in production). The agent and UI share the same database. Do not store durable app data in the filesystem unless the app is explicitly running a Local File Mode artifact flow described below.
|
|
16
|
+
|
|
17
|
+
**Local File Mode exception:** some artifact apps (Content, Plans, Slides, Dashboards, Designs, etc.) can intentionally use repo files as the source of truth for the artifact itself. This must be explicit via `agent-native.json`, `AGENT_NATIVE_MODE=local-files`, or an app-owned local-file action helper. In that mode, the UI and agent still go through app actions, but those actions read/write scoped files through `@agent-native/core/local-artifacts` instead of SQL rows. App state, auth, settings, credentials, collaboration metadata, and hosted database mode remain SQL. File-to-database or file-to-provider synchronization is an explicit sync step, not an implicit side effect of editing.
|
|
16
18
|
|
|
17
19
|
When you add a data model, a list, or a read path, also follow the `performance` skill: project only the columns a list renders, index the columns hot queries filter/sort on, and avoid query waterfalls — so apps stay fast as data grows.
|
|
18
20
|
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ServerRouter } from "react-router";
|
|
2
|
+
import {
|
|
3
|
+
createDocumentRequestHandler,
|
|
3
4
|
streamTimeout,
|
|
4
5
|
} from "@agent-native/core/server/entry-server";
|
|
6
|
+
|
|
7
|
+
const handleDocumentRequest = createDocumentRequestHandler(ServerRouter);
|
|
8
|
+
|
|
9
|
+
export { streamTimeout };
|
|
10
|
+
export default handleDocumentRequest;
|
|
@@ -53,15 +53,16 @@ function readFile(dir: string, filename: string): string {
|
|
|
53
53
|
/**
|
|
54
54
|
* Shell files that must be byte-identical between scaffold and starter.
|
|
55
55
|
* Each entry is [filename, reason]:
|
|
56
|
-
* entry.server.tsx — both
|
|
57
|
-
*
|
|
56
|
+
* entry.server.tsx — both import the app-local React Router ServerRouter
|
|
57
|
+
* and pass it into the shared core handler; any future change to the
|
|
58
|
+
* pattern must land in both places at once.
|
|
58
59
|
* entry.client.tsx — lightweight hydration entry that sets basename from
|
|
59
60
|
* APP_BASE_PATH; must stay in sync for workspace-mount correctness.
|
|
60
61
|
*/
|
|
61
62
|
const SHELL_FILES: Array<[string, string]> = [
|
|
62
63
|
[
|
|
63
64
|
"entry.server.tsx",
|
|
64
|
-
"
|
|
65
|
+
"uses app-local ServerRouter with core entry-server; must be identical",
|
|
65
66
|
],
|
|
66
67
|
[
|
|
67
68
|
"entry.client.tsx",
|
|
@@ -363,8 +363,9 @@ end up rendering nonsense like the literal text `true`.
|
|
|
363
363
|
2. **Call an LLM directly via `extensionFetch`.** Requires a real key the
|
|
364
364
|
user has set up. Reference it via `${keys.OPENAI_API_KEY}` /
|
|
365
365
|
`${keys.ANTHROPIC_API_KEY}` and surface a clear error if the proxy
|
|
366
|
-
reports the key isn't configured. Tell the user where to add the key
|
|
367
|
-
|
|
366
|
+
reports the key isn't configured. Tell the user where to add the key:
|
|
367
|
+
Dispatch Vault for workspace apps, or app Settings → API Keys & Connections
|
|
368
|
+
for standalone apps.
|
|
368
369
|
|
|
369
370
|
If you're not sure a key is configured, ask the user before generating an
|
|
370
371
|
extension whose primary value is the AI step.
|
|
@@ -12,7 +12,9 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
## Rule
|
|
14
14
|
|
|
15
|
-
All application data lives in **SQL** (SQLite locally, persistent database in production). The agent and UI share the same database. Do not store durable app data in the filesystem.
|
|
15
|
+
All application data lives in **SQL** (SQLite locally, persistent database in production). The agent and UI share the same database. Do not store durable app data in the filesystem unless the app is explicitly running a Local File Mode artifact flow described below.
|
|
16
|
+
|
|
17
|
+
**Local File Mode exception:** some artifact apps (Content, Plans, Slides, Dashboards, Designs, etc.) can intentionally use repo files as the source of truth for the artifact itself. This must be explicit via `agent-native.json`, `AGENT_NATIVE_MODE=local-files`, or an app-owned local-file action helper. In that mode, the UI and agent still go through app actions, but those actions read/write scoped files through `@agent-native/core/local-artifacts` instead of SQL rows. App state, auth, settings, credentials, collaboration metadata, and hosted database mode remain SQL. File-to-database or file-to-provider synchronization is an explicit sync step, not an implicit side effect of editing.
|
|
16
18
|
|
|
17
19
|
When you add a data model, a list, or a read path, also follow the `performance` skill: project only the columns a list renders, index the columns hot queries filter/sort on, and avoid query waterfalls — so apps stay fast as data grows.
|
|
18
20
|
|