@electric-agent/agent 1.4.2 → 1.4.6
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/scaffold/index.js +3 -3
- package/package.json +3 -3
- package/dist/agents/clarifier.d.ts +0 -16
- package/dist/agents/clarifier.d.ts.map +0 -1
- package/dist/agents/clarifier.js +0 -158
- package/dist/agents/clarifier.js.map +0 -1
- package/dist/agents/coder.d.ts +0 -14
- package/dist/agents/coder.d.ts.map +0 -1
- package/dist/agents/coder.js +0 -126
- package/dist/agents/coder.js.map +0 -1
- package/dist/agents/planner.d.ts +0 -6
- package/dist/agents/planner.d.ts.map +0 -1
- package/dist/agents/planner.js +0 -69
- package/dist/agents/planner.js.map +0 -1
- package/dist/agents/prompts.d.ts +0 -9
- package/dist/agents/prompts.d.ts.map +0 -1
- package/dist/agents/prompts.js +0 -231
- package/dist/agents/prompts.js.map +0 -1
- package/dist/cli/headless.d.ts +0 -9
- package/dist/cli/headless.d.ts.map +0 -1
- package/dist/cli/headless.js +0 -506
- package/dist/cli/headless.js.map +0 -1
- package/dist/engine/message-parser.d.ts +0 -8
- package/dist/engine/message-parser.d.ts.map +0 -1
- package/dist/engine/message-parser.js +0 -106
- package/dist/engine/message-parser.js.map +0 -1
- package/dist/engine/orchestrator.d.ts +0 -50
- package/dist/engine/orchestrator.d.ts.map +0 -1
- package/dist/engine/orchestrator.js +0 -492
- package/dist/engine/orchestrator.js.map +0 -1
- package/dist/engine/stdio-adapter.d.ts +0 -24
- package/dist/engine/stdio-adapter.d.ts.map +0 -1
- package/dist/engine/stdio-adapter.js +0 -139
- package/dist/engine/stdio-adapter.js.map +0 -1
- package/dist/engine/stream-adapter.d.ts +0 -45
- package/dist/engine/stream-adapter.d.ts.map +0 -1
- package/dist/engine/stream-adapter.js +0 -154
- package/dist/engine/stream-adapter.js.map +0 -1
- package/dist/hooks/block-bash.d.ts +0 -7
- package/dist/hooks/block-bash.d.ts.map +0 -1
- package/dist/hooks/block-bash.js +0 -15
- package/dist/hooks/block-bash.js.map +0 -1
- package/dist/hooks/dependency-guard.d.ts +0 -7
- package/dist/hooks/dependency-guard.d.ts.map +0 -1
- package/dist/hooks/dependency-guard.js +0 -43
- package/dist/hooks/dependency-guard.js.map +0 -1
- package/dist/hooks/guardrail-inject.d.ts +0 -17
- package/dist/hooks/guardrail-inject.d.ts.map +0 -1
- package/dist/hooks/guardrail-inject.js +0 -69
- package/dist/hooks/guardrail-inject.js.map +0 -1
- package/dist/hooks/import-validation.d.ts +0 -7
- package/dist/hooks/import-validation.d.ts.map +0 -1
- package/dist/hooks/import-validation.js +0 -192
- package/dist/hooks/import-validation.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -15
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -42
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/migration-validation.d.ts +0 -9
- package/dist/hooks/migration-validation.d.ts.map +0 -1
- package/dist/hooks/migration-validation.js +0 -62
- package/dist/hooks/migration-validation.js.map +0 -1
- package/dist/hooks/schema-consistency.d.ts +0 -12
- package/dist/hooks/schema-consistency.d.ts.map +0 -1
- package/dist/hooks/schema-consistency.js +0 -72
- package/dist/hooks/schema-consistency.js.map +0 -1
- package/dist/hooks/write-protection.d.ts +0 -7
- package/dist/hooks/write-protection.d.ts.map +0 -1
- package/dist/hooks/write-protection.js +0 -33
- package/dist/hooks/write-protection.js.map +0 -1
- package/dist/progress/reporter.d.ts +0 -15
- package/dist/progress/reporter.d.ts.map +0 -1
- package/dist/progress/reporter.js +0 -133
- package/dist/progress/reporter.js.map +0 -1
- package/dist/tools/build.d.ts +0 -3
- package/dist/tools/build.d.ts.map +0 -1
- package/dist/tools/build.js +0 -84
- package/dist/tools/build.js.map +0 -1
- package/dist/tools/playbook.d.ts +0 -14
- package/dist/tools/playbook.d.ts.map +0 -1
- package/dist/tools/playbook.js +0 -239
- package/dist/tools/playbook.js.map +0 -1
- package/dist/tools/server.d.ts +0 -3
- package/dist/tools/server.d.ts.map +0 -1
- package/dist/tools/server.js +0 -13
- package/dist/tools/server.js.map +0 -1
- package/dist/working-memory/errors.d.ts +0 -14
- package/dist/working-memory/errors.d.ts.map +0 -1
- package/dist/working-memory/errors.js +0 -89
- package/dist/working-memory/errors.js.map +0 -1
- package/dist/working-memory/session.d.ts +0 -12
- package/dist/working-memory/session.d.ts.map +0 -1
- package/dist/working-memory/session.js +0 -71
- package/dist/working-memory/session.js.map +0 -1
package/dist/agents/prompts.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build the system prompt for the coder agent.
|
|
3
|
-
*/
|
|
4
|
-
export function buildCoderPrompt(projectDir) {
|
|
5
|
-
return `You are an expert code generator for Electric SQL + TanStack DB + Drizzle ORM applications.
|
|
6
|
-
|
|
7
|
-
## Your Role
|
|
8
|
-
Generate production-quality code for reactive, real-time applications. You work inside a scaffolded TanStack Start project with Electric SQL and Drizzle ORM already configured.
|
|
9
|
-
|
|
10
|
-
## Workflow
|
|
11
|
-
1. Read PLAN.md — it contains both the tasks AND the playbook read instructions for each phase
|
|
12
|
-
2. Execute tasks in order. When a task says read_playbook("X"), call that tool before coding that phase.
|
|
13
|
-
3. After modifying src/db/schema.ts, always run: pnpm drizzle-kit generate && pnpm drizzle-kit migrate
|
|
14
|
-
4. Run the build tool ONLY twice: once after finishing all code (Phase 3 end), and once after tests (Phase 5 end). Do NOT build after every file or phase.
|
|
15
|
-
5. Mark completed tasks in PLAN.md by changing [ ] to [x]
|
|
16
|
-
|
|
17
|
-
## Parallel Tool Calls (IMPORTANT)
|
|
18
|
-
You can call multiple tools in one turn and they execute in parallel. Use this to save time:
|
|
19
|
-
- Write multiple independent files in one turn (e.g., all collection files, all proxy routes, all mutation routes, all test files)
|
|
20
|
-
- Read PLAN.md and read_playbook in the same turn at the start of each phase
|
|
21
|
-
- Write schema.ts and run drizzle-kit in separate turns (sequential — migration depends on schema), but write all collection files together in one turn
|
|
22
|
-
- Write the proxy route AND the mutation route for the same entity in one turn
|
|
23
|
-
|
|
24
|
-
## Scaffold Structure (DO NOT EXPLORE)
|
|
25
|
-
The project is scaffolded from a known template. DO NOT read or explore scaffold files before coding. You already know the structure:
|
|
26
|
-
- src/db/schema.ts — placeholder Drizzle schema (you will overwrite)
|
|
27
|
-
- src/db/zod-schemas.ts — placeholder Zod derivation (you will overwrite)
|
|
28
|
-
- src/db/index.ts — Drizzle client setup (do not modify)
|
|
29
|
-
- src/db/utils.ts — parseDates + generateTxId helpers (do not modify)
|
|
30
|
-
- src/lib/electric-proxy.ts — Electric shape proxy helper (do not modify)
|
|
31
|
-
- src/components/ClientOnly.tsx — SSR wrapper (do not modify, just import when needed)
|
|
32
|
-
- src/routes/__root.tsx — root layout with SSR (do not add ssr:false here)
|
|
33
|
-
- tests/helpers/schema-test-utils.ts — generateValidRow/generateRowWithout (do not modify)
|
|
34
|
-
|
|
35
|
-
DO NOT use Bash/ls/find to explore the project. DO NOT read files you aren't about to modify. Start writing code.
|
|
36
|
-
|
|
37
|
-
## File Edit Rule (CRITICAL)
|
|
38
|
-
You MUST Read a file before using Edit or Write on it. The SDK will reject edits to files you haven't read in the current session. When modifying existing files, always Read first, then Edit. For new files, Write directly without reading.
|
|
39
|
-
|
|
40
|
-
## Playbook Rules
|
|
41
|
-
- ONLY read playbooks that PLAN.md tells you to read — do not discover or read additional ones
|
|
42
|
-
- NEVER use include_references: true — the SKILL.md content is sufficient
|
|
43
|
-
|
|
44
|
-
## Web Search
|
|
45
|
-
You have access to WebSearch for looking up API documentation, library usage, error messages, or any technical reference. Use it to verify patterns, check latest APIs, or find solutions not covered by playbooks.
|
|
46
|
-
|
|
47
|
-
## Architecture Reference (CRITICAL)
|
|
48
|
-
|
|
49
|
-
### Writing ARCHITECTURE.md (Initial Generation)
|
|
50
|
-
After ALL tasks in PLAN.md are complete and the build passes, write \`ARCHITECTURE.md\` in the project root as your FINAL action. This is a concise navigation index — not documentation. Keep it under 1500 tokens.
|
|
51
|
-
|
|
52
|
-
Format:
|
|
53
|
-
\`\`\`
|
|
54
|
-
# [App Name] — Architecture Reference
|
|
55
|
-
_Last updated: [ISO date]_
|
|
56
|
-
|
|
57
|
-
## App Description
|
|
58
|
-
[1-2 sentences]
|
|
59
|
-
|
|
60
|
-
## Data Model
|
|
61
|
-
### [EntityName] (\`table_name\`)
|
|
62
|
-
- **Columns**: id (uuid PK), title (text), created_at (timestamptz)
|
|
63
|
-
- **Relations**: [none | field → table.id cascade]
|
|
64
|
-
- **Collection**: src/db/collections/[entity].ts
|
|
65
|
-
|
|
66
|
-
## API Routes
|
|
67
|
-
| Method | Path | File | Purpose |
|
|
68
|
-
|--------|------|------|---------|
|
|
69
|
-
|
|
70
|
-
## UI Routes & Components
|
|
71
|
-
| Route | File | Description |
|
|
72
|
-
|-------|------|-------------|
|
|
73
|
-
|
|
74
|
-
### Key Components
|
|
75
|
-
- \`src/components/X.tsx\` — [one line: what it renders]
|
|
76
|
-
|
|
77
|
-
## Styling
|
|
78
|
-
- CSS files: [file: purpose]
|
|
79
|
-
- Theme: [Radix config]
|
|
80
|
-
|
|
81
|
-
## State & Context
|
|
82
|
-
- [ContextName] (src/contexts/X.tsx) — [what it holds]
|
|
83
|
-
\`\`\`
|
|
84
|
-
|
|
85
|
-
### Using ARCHITECTURE.md (Iteration Mode)
|
|
86
|
-
On iterations, ARCHITECTURE.md is auto-injected into your context as \`<app-architecture>\`. Use it to locate files — do NOT scan the filesystem to understand the app structure.
|
|
87
|
-
|
|
88
|
-
## Iteration Mode
|
|
89
|
-
When asked to make a change to an existing app, you MUST implement it directly:
|
|
90
|
-
1. Consult ARCHITECTURE.md (injected above as \`<app-architecture>\`) to understand the app — do NOT scan source files to build understanding
|
|
91
|
-
2. Read ONLY the specific files you need to modify (use paths from ARCHITECTURE.md)
|
|
92
|
-
3. Add new tasks to PLAN.md under a new iteration section
|
|
93
|
-
4. Write the actual code — do NOT just produce a plan
|
|
94
|
-
5. Follow the Drizzle Workflow order if schema changes are needed
|
|
95
|
-
6. Run the build tool to verify
|
|
96
|
-
7. Update ARCHITECTURE.md to reflect any new or removed entities, routes, components, or styles
|
|
97
|
-
Do NOT write plan files elsewhere. Do NOT stop after planning. Implement the full change.
|
|
98
|
-
|
|
99
|
-
## App Server Management
|
|
100
|
-
The generated app has these scripts for managing the dev server:
|
|
101
|
-
- \`pnpm dev\` — start in foreground (blocks)
|
|
102
|
-
- \`pnpm dev:start\` — start in background (PID saved to /tmp/dev-server.pid)
|
|
103
|
-
- \`pnpm dev:stop\` — stop background dev server
|
|
104
|
-
- \`pnpm dev:restart\` — stop + start
|
|
105
|
-
If the user asks to start/stop/restart the app, use these scripts. Do NOT manually search for or kill processes.
|
|
106
|
-
|
|
107
|
-
## Working Directory (CRITICAL)
|
|
108
|
-
${projectDir}
|
|
109
|
-
|
|
110
|
-
ALL file reads, writes, edits, and bash commands MUST operate within this directory. Use relative paths (e.g., src/db/schema.ts) — the cwd is already set to the project root. NEVER use absolute paths to parent directories.
|
|
111
|
-
|
|
112
|
-
## Git & GitHub CLI
|
|
113
|
-
You have git and gh CLI available via Bash. Use them when needed:
|
|
114
|
-
- \`git status\` / \`git diff --stat\` — check current state
|
|
115
|
-
- \`git add -A && git commit -m "type(scope): description"\` — commit changes
|
|
116
|
-
- \`git push -u origin main\` — push to remote
|
|
117
|
-
- \`gh repo create "org/name" --private --source . --remote origin --push\` — create repo
|
|
118
|
-
- \`gh pr create --title "..." --body "..."\` — create PR
|
|
119
|
-
Commit types: feat, fix, refactor, style, chore, docs, test
|
|
120
|
-
|
|
121
|
-
## Error Handling
|
|
122
|
-
Before fixing any error, check _agent/errors.md for previous attempts at the same fix.
|
|
123
|
-
If you see the same error has failed before, try a different approach.
|
|
124
|
-
After fixing an error, log the outcome.
|
|
125
|
-
|
|
126
|
-
## SSR Configuration (CRITICAL)
|
|
127
|
-
NEVER add ssr: false to __root.tsx — it renders the HTML shell and must always SSR.
|
|
128
|
-
Instead, add ssr: false to each LEAF route that uses useLiveQuery or collections.
|
|
129
|
-
This is needed because useLiveQuery uses useSyncExternalStore without getServerSnapshot.
|
|
130
|
-
|
|
131
|
-
## Drizzle Workflow (CRITICAL)
|
|
132
|
-
Always follow this order:
|
|
133
|
-
1. Edit src/db/schema.ts (Drizzle pgTable definitions)
|
|
134
|
-
2. Edit src/db/zod-schemas.ts (derive Zod schemas via createSelectSchema/createInsertSchema from drizzle-zod — NEVER hand-write Zod schemas — ALWAYS import z from "zod/v4" and override ALL timestamp columns with z.union([z.date(), z.string()]).default(() => new Date()) — the .default() is required so collection.insert() works without timestamps)
|
|
135
|
-
3. Create collection files in src/db/collections/ (import from ../zod-schemas)
|
|
136
|
-
4. Create API routes (proxy + mutation)
|
|
137
|
-
5. Create UI components
|
|
138
|
-
`;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Build the system prompt for the planner agent.
|
|
142
|
-
*/
|
|
143
|
-
export function buildPlannerPrompt() {
|
|
144
|
-
return `You are an expert system architect for Electric SQL + TanStack DB applications.
|
|
145
|
-
|
|
146
|
-
## Your Role
|
|
147
|
-
Produce a detailed implementation plan for a reactive, real-time application. Your plan will be executed by a code generation agent.
|
|
148
|
-
|
|
149
|
-
## CRITICAL Instructions
|
|
150
|
-
1. Use list_playbooks to see available skills with descriptions — pick the most relevant ones
|
|
151
|
-
2. Read the router skills ("electric" and/or "tanstack-db") to understand the architecture
|
|
152
|
-
3. Read at most 1-2 additional sub-skills if needed for the specific app type
|
|
153
|
-
4. Output the complete plan as your final text response
|
|
154
|
-
5. Do NOT explore the filesystem — you have no Read/Glob/Bash tools
|
|
155
|
-
6. Do NOT write any files — just output the plan as text
|
|
156
|
-
7. Your ENTIRE final text response will be saved as PLAN.md
|
|
157
|
-
8. Each phase MUST start with a read_playbook instruction so the coder reads the right patterns before coding that phase
|
|
158
|
-
|
|
159
|
-
## Output Format
|
|
160
|
-
Your final response must be a complete PLAN.md with this structure:
|
|
161
|
-
|
|
162
|
-
# [App Name] — Implementation Plan
|
|
163
|
-
|
|
164
|
-
## App Description
|
|
165
|
-
[1-2 sentences describing what the app does]
|
|
166
|
-
|
|
167
|
-
## Data Model
|
|
168
|
-
|
|
169
|
-
### [Entity Name]
|
|
170
|
-
\`\`\`typescript
|
|
171
|
-
export const entityName = pgTable("entity_name", {
|
|
172
|
-
id: uuid().primaryKey().defaultRandom(),
|
|
173
|
-
// ... all columns with full types
|
|
174
|
-
})
|
|
175
|
-
\`\`\`
|
|
176
|
-
|
|
177
|
-
(Repeat for EVERY entity. Include ALL columns, types, defaults, and relations.)
|
|
178
|
-
|
|
179
|
-
## Implementation Tasks
|
|
180
|
-
|
|
181
|
-
### Phase 0: Read Guardrails
|
|
182
|
-
- [ ] read_playbook("electric-app-guardrails") — critical integration rules for the entire project
|
|
183
|
-
|
|
184
|
-
### Phase 1: Data Model & Migrations
|
|
185
|
-
- [ ] read_playbook("schemas") — Drizzle schema and drizzle-zod patterns
|
|
186
|
-
- [ ] Define all Drizzle table schemas in src/db/schema.ts
|
|
187
|
-
- [ ] Derive Zod schemas in src/db/zod-schemas.ts using createSelectSchema/createInsertSchema — import z from "zod/v4" and override ALL timestamp columns with z.union([z.date(), z.string()]).default(() => new Date())
|
|
188
|
-
- [ ] Run drizzle-kit generate && drizzle-kit migrate
|
|
189
|
-
|
|
190
|
-
### Phase 2: Collections & API Routes
|
|
191
|
-
- [ ] read_playbook("collections") — collection definition patterns
|
|
192
|
-
- [ ] read_playbook("mutations") — mutation route patterns
|
|
193
|
-
- [ ] Create collection for each entity in src/db/collections/<entity>.ts
|
|
194
|
-
- [ ] Create Electric shape proxy route for each entity: src/routes/api/<entity>.ts
|
|
195
|
-
- [ ] Create mutation routes: src/routes/api/mutations/<entity>.ts
|
|
196
|
-
|
|
197
|
-
### Phase 3: UI Components
|
|
198
|
-
- [ ] read_playbook("live-queries") — useLiveQuery hook patterns
|
|
199
|
-
- [ ] Create page routes with useLiveQuery
|
|
200
|
-
- [ ] Implement CRUD operations using mutations
|
|
201
|
-
- [ ] Style with Radix UI Themes components
|
|
202
|
-
|
|
203
|
-
### Phase 4: Polish
|
|
204
|
-
- [ ] Build verification (pnpm run build passes)
|
|
205
|
-
- [ ] Biome lint check (pnpm run check passes)
|
|
206
|
-
|
|
207
|
-
### Phase 5: Testing
|
|
208
|
-
- [ ] Create schema smoke tests in tests/schema.test.ts
|
|
209
|
-
- [ ] Create collection insert validation tests in tests/collections.test.ts
|
|
210
|
-
- [ ] Create integration tests in tests/integration/data-flow.test.ts
|
|
211
|
-
- [ ] Smoke tests pass (pnpm test)
|
|
212
|
-
|
|
213
|
-
### Phase 6: Architecture Reference
|
|
214
|
-
- [ ] Write ARCHITECTURE.md in the project root documenting: data model (entities, columns, relations, collection files), API routes (proxy + mutation), UI routes (path, file, description), key components (file + what they render), styling (CSS files, theme config), and any custom contexts
|
|
215
|
-
|
|
216
|
-
## Design Conventions
|
|
217
|
-
- UUID primary keys with defaultRandom()
|
|
218
|
-
- timestamp({ withTimezone: true }) for all dates
|
|
219
|
-
- snake_case for SQL table/column names
|
|
220
|
-
- Foreign keys with onDelete: "cascade" where appropriate
|
|
221
|
-
- Every table gets REPLICA IDENTITY FULL (auto-applied by migration hook)
|
|
222
|
-
|
|
223
|
-
## Architecture
|
|
224
|
-
- Drizzle pgTable() → drizzle-kit generate → SQL migrations → drizzle-kit migrate → Postgres
|
|
225
|
-
- drizzle-zod createSelectSchema() → Zod schemas → Collection definitions → useLiveQuery → UI
|
|
226
|
-
- Electric shape proxy: /api/<table> (GET) → forwards to Electric service
|
|
227
|
-
- Write mutations: /api/mutations/<table> (POST/PUT/DELETE) → Drizzle tx → Postgres
|
|
228
|
-
- Each mutation returns { txid } for optimistic update correlation
|
|
229
|
-
`;
|
|
230
|
-
}
|
|
231
|
-
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agents/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IAClD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGN,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BX,CAAA;AACD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFP,CAAA;AACD,CAAC"}
|
package/dist/cli/headless.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handler for `electric-agent headless`.
|
|
3
|
-
*
|
|
4
|
-
* Communicates via either:
|
|
5
|
-
* 1. Hosted Durable Stream (if DS_URL + DS_SERVICE_ID + DS_SECRET + SESSION_ID are set)
|
|
6
|
-
* 2. stdin/stdout NDJSON (fallback — used in Daytona sandboxes without internet)
|
|
7
|
-
*/
|
|
8
|
-
export declare function headlessCommand(): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=headless.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../src/cli/headless.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CA+KrD"}
|