@agentuity/cli 0.0.101 → 0.0.102
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/AGENTS.md +19 -188
- package/bin/cli.ts +13 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +41 -12
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/index.d.ts.map +1 -1
- package/dist/cmd/ai/index.js +6 -1
- package/dist/cmd/ai/index.js.map +1 -1
- package/dist/cmd/ai/prompt/agent.d.ts +7 -0
- package/dist/cmd/ai/prompt/agent.d.ts.map +1 -1
- package/dist/cmd/ai/prompt/agent.js +12 -323
- package/dist/cmd/ai/prompt/agent.js.map +1 -1
- package/dist/cmd/ai/prompt/api.d.ts +7 -0
- package/dist/cmd/ai/prompt/api.d.ts.map +1 -1
- package/dist/cmd/ai/prompt/api.js +12 -260
- package/dist/cmd/ai/prompt/api.js.map +1 -1
- package/dist/cmd/ai/prompt/version.d.ts +35 -0
- package/dist/cmd/ai/prompt/version.d.ts.map +1 -0
- package/dist/cmd/ai/prompt/version.js +55 -0
- package/dist/cmd/ai/prompt/version.js.map +1 -0
- package/dist/cmd/ai/prompt/web.d.ts +7 -0
- package/dist/cmd/ai/prompt/web.d.ts.map +1 -1
- package/dist/cmd/ai/prompt/web.js +12 -283
- package/dist/cmd/ai/prompt/web.js.map +1 -1
- package/dist/cmd/ai/skills/generate.d.ts +3 -0
- package/dist/cmd/ai/skills/generate.d.ts.map +1 -0
- package/dist/cmd/ai/skills/generate.js +65 -0
- package/dist/cmd/ai/skills/generate.js.map +1 -0
- package/dist/cmd/ai/skills/generator.d.ts +4 -0
- package/dist/cmd/ai/skills/generator.d.ts.map +1 -0
- package/dist/cmd/ai/skills/generator.js +402 -0
- package/dist/cmd/ai/skills/generator.js.map +1 -0
- package/dist/cmd/ai/skills/index.d.ts +4 -0
- package/dist/cmd/ai/skills/index.d.ts.map +1 -0
- package/dist/cmd/ai/skills/index.js +21 -0
- package/dist/cmd/ai/skills/index.js.map +1 -0
- package/dist/cmd/auth/signup.d.ts.map +1 -1
- package/dist/cmd/auth/signup.js +1 -0
- package/dist/cmd/auth/signup.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +40 -5
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.d.ts +7 -1
- package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.js +52 -26
- package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.js +58 -7
- package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
- package/dist/cmd/build/vite/prompt-generator.d.ts +23 -0
- package/dist/cmd/build/vite/prompt-generator.d.ts.map +1 -0
- package/dist/cmd/build/vite/prompt-generator.js +123 -0
- package/dist/cmd/build/vite/prompt-generator.js.map +1 -0
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +28 -11
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/server-bundler.d.ts +4 -0
- package/dist/cmd/build/vite/server-bundler.d.ts.map +1 -1
- package/dist/cmd/build/vite/server-bundler.js +45 -16
- package/dist/cmd/build/vite/server-bundler.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +4 -0
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +99 -87
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +78 -27
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/create-namespace.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/create-namespace.js +3 -1
- package/dist/cmd/cloud/keyvalue/create-namespace.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.js +3 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete.js +3 -1
- package/dist/cmd/cloud/keyvalue/delete.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/set.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/set.js +4 -2
- package/dist/cmd/cloud/keyvalue/set.js.map +1 -1
- package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/get.js +2 -13
- package/dist/cmd/cloud/stream/get.js.map +1 -1
- package/dist/cmd/cloud/vector/delete-namespace.d.ts +3 -0
- package/dist/cmd/cloud/vector/delete-namespace.d.ts.map +1 -0
- package/dist/cmd/cloud/vector/delete-namespace.js +77 -0
- package/dist/cmd/cloud/vector/delete-namespace.js.map +1 -0
- package/dist/cmd/cloud/vector/index.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/index.js +21 -4
- package/dist/cmd/cloud/vector/index.js.map +1 -1
- package/dist/cmd/cloud/vector/list-namespaces.d.ts +3 -0
- package/dist/cmd/cloud/vector/list-namespaces.d.ts.map +1 -0
- package/dist/cmd/cloud/vector/list-namespaces.js +42 -0
- package/dist/cmd/cloud/vector/list-namespaces.js.map +1 -0
- package/dist/cmd/cloud/vector/stats.d.ts +3 -0
- package/dist/cmd/cloud/vector/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/vector/stats.js +142 -0
- package/dist/cmd/cloud/vector/stats.js.map +1 -0
- package/dist/cmd/cloud/vector/upsert.d.ts +3 -0
- package/dist/cmd/cloud/vector/upsert.d.ts.map +1 -0
- package/dist/cmd/cloud/vector/upsert.js +192 -0
- package/dist/cmd/cloud/vector/upsert.js.map +1 -0
- package/dist/cmd/dev/file-watcher.d.ts.map +1 -1
- package/dist/cmd/dev/file-watcher.js +90 -31
- package/dist/cmd/dev/file-watcher.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +213 -57
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/dev/skills.d.ts +10 -0
- package/dist/cmd/dev/skills.d.ts.map +1 -0
- package/dist/cmd/dev/skills.js +57 -0
- package/dist/cmd/dev/skills.js.map +1 -0
- package/dist/cmd/dev/sync.js +7 -7
- package/dist/cmd/dev/sync.js.map +1 -1
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +1 -0
- package/dist/cmd/index.js.map +1 -1
- package/dist/cmd/project/create.d.ts.map +1 -1
- package/dist/cmd/project/create.js +3 -0
- package/dist/cmd/project/create.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +1 -0
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +30 -5
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/cmd/setup/index.d.ts.map +1 -1
- package/dist/cmd/setup/index.js +1 -0
- package/dist/cmd/setup/index.js.map +1 -1
- package/dist/cmd/upgrade/index.d.ts +15 -0
- package/dist/cmd/upgrade/index.d.ts.map +1 -1
- package/dist/cmd/upgrade/index.js +59 -4
- package/dist/cmd/upgrade/index.js.map +1 -1
- package/dist/domain.d.ts +45 -0
- package/dist/domain.d.ts.map +1 -0
- package/dist/domain.js +200 -0
- package/dist/domain.js.map +1 -0
- package/dist/schema-generator.d.ts +2 -0
- package/dist/schema-generator.d.ts.map +1 -1
- package/dist/schema-generator.js +18 -0
- package/dist/schema-generator.js.map +1 -1
- package/dist/steps.d.ts +1 -1
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +16 -5
- package/dist/steps.js.map +1 -1
- package/dist/tui/prompt.d.ts +1 -2
- package/dist/tui/prompt.d.ts.map +1 -1
- package/dist/tui/prompt.js +8 -4
- package/dist/tui/prompt.js.map +1 -1
- package/dist/tui.d.ts +16 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +23 -2
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +9 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +47 -12
- package/src/cmd/ai/index.ts +6 -1
- package/src/cmd/ai/prompt/agent.md +306 -0
- package/src/cmd/ai/prompt/agent.ts +12 -322
- package/src/cmd/ai/prompt/api.md +360 -0
- package/src/cmd/ai/prompt/api.ts +13 -260
- package/src/cmd/ai/prompt/version.ts +61 -0
- package/src/cmd/ai/prompt/web.md +509 -0
- package/src/cmd/ai/prompt/web.ts +12 -282
- package/src/cmd/ai/skills/generate.ts +75 -0
- package/src/cmd/ai/skills/generator.ts +519 -0
- package/src/cmd/ai/skills/index.ts +23 -0
- package/src/cmd/auth/signup.ts +1 -0
- package/src/cmd/build/entry-generator.ts +43 -7
- package/src/cmd/build/vite/bun-dev-server.ts +57 -27
- package/src/cmd/build/vite/metadata-generator.ts +73 -7
- package/src/cmd/build/vite/prompt-generator.ts +169 -0
- package/src/cmd/build/vite/registry-generator.ts +33 -10
- package/src/cmd/build/vite/server-bundler.ts +53 -22
- package/src/cmd/build/vite/vite-asset-server-config.ts +5 -0
- package/src/cmd/build/vite/vite-builder.ts +107 -87
- package/src/cmd/cloud/deploy.ts +99 -31
- package/src/cmd/cloud/keyvalue/create-namespace.ts +3 -1
- package/src/cmd/cloud/keyvalue/delete-namespace.ts +3 -1
- package/src/cmd/cloud/keyvalue/delete.ts +3 -1
- package/src/cmd/cloud/keyvalue/set.ts +4 -2
- package/src/cmd/cloud/stream/get.ts +2 -9
- package/src/cmd/cloud/vector/delete-namespace.ts +89 -0
- package/src/cmd/cloud/vector/index.ts +21 -4
- package/src/cmd/cloud/vector/list-namespaces.ts +46 -0
- package/src/cmd/cloud/vector/stats.ts +160 -0
- package/src/cmd/cloud/vector/upsert.ts +216 -0
- package/src/cmd/dev/file-watcher.ts +101 -32
- package/src/cmd/dev/index.ts +304 -111
- package/src/cmd/dev/skills.ts +82 -0
- package/src/cmd/dev/sync.ts +7 -7
- package/src/cmd/index.ts +1 -0
- package/src/cmd/project/create.ts +3 -0
- package/src/cmd/project/template-flow.ts +37 -5
- package/src/cmd/setup/index.ts +1 -0
- package/src/cmd/upgrade/index.ts +68 -4
- package/src/domain.ts +273 -0
- package/src/schema-generator.ts +23 -0
- package/src/steps.ts +16 -5
- package/src/tui/prompt.ts +11 -5
- package/src/tui.ts +21 -2
- package/src/types/md.d.ts +8 -0
- package/src/types.ts +12 -3
- package/dist/cmd/cloud/domain.d.ts +0 -17
- package/dist/cmd/cloud/domain.d.ts.map +0 -1
- package/dist/cmd/cloud/domain.js +0 -79
- package/dist/cmd/cloud/domain.js.map +0 -1
- package/src/cmd/cloud/domain.ts +0 -100
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/agent.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,yCAU1B,CAAC;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createSubcommand } from '../../../types';
|
|
2
2
|
import { getCommand } from '../../../command-prefix';
|
|
3
|
+
import { appendHashComment } from './version';
|
|
4
|
+
import agentPromptContent from './agent.md' with { type: 'text' };
|
|
3
5
|
export const agentSubcommand = createSubcommand({
|
|
4
6
|
name: 'agent',
|
|
5
7
|
description: 'Generate a comprehensive prompt for LLM agents for the agents folder',
|
|
@@ -11,329 +13,16 @@ export const agentSubcommand = createSubcommand({
|
|
|
11
13
|
console.log(prompt);
|
|
12
14
|
},
|
|
13
15
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Directory Structure
|
|
20
|
-
|
|
21
|
-
Each agent folder must contain:
|
|
22
|
-
- **agent.ts** (required) - Agent definition with metadata, schema, and handler
|
|
23
|
-
- **route.ts** (optional) - HTTP routes for the agent endpoint
|
|
24
|
-
|
|
25
|
-
Example structure:
|
|
26
|
-
\`\`\`
|
|
27
|
-
src/agent/
|
|
28
|
-
├── hello/
|
|
29
|
-
│ ├── agent.ts
|
|
30
|
-
│ └── route.ts
|
|
31
|
-
├── process-data/
|
|
32
|
-
│ ├── agent.ts
|
|
33
|
-
│ └── route.ts
|
|
34
|
-
└── registry.generated.ts (auto-generated)
|
|
35
|
-
\`\`\`
|
|
36
|
-
|
|
37
|
-
## Creating an Agent
|
|
38
|
-
|
|
39
|
-
### Basic Agent (agent.ts)
|
|
40
|
-
|
|
41
|
-
\`\`\`typescript
|
|
42
|
-
import { createAgent } from '@agentuity/runtime';
|
|
43
|
-
import { s } from '@agentuity/schema';
|
|
44
|
-
|
|
45
|
-
const agent = createAgent({
|
|
46
|
-
metadata: {
|
|
47
|
-
name: 'My Agent',
|
|
48
|
-
description: 'What this agent does',
|
|
49
|
-
},
|
|
50
|
-
schema: {
|
|
51
|
-
input: s.object({
|
|
52
|
-
name: s.string(),
|
|
53
|
-
age: s.number()
|
|
54
|
-
}),
|
|
55
|
-
output: s.string(),
|
|
56
|
-
},
|
|
57
|
-
handler: async (c, input) => {
|
|
58
|
-
// Access context: c.app, c.config, c.logger, c.kv, c.vector, c.stream
|
|
59
|
-
return \`Hello, \${input.name}! You are \${input.age} years old.\`;
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export default agent;
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
### Agent with Lifecycle (setup/shutdown)
|
|
67
|
-
|
|
68
|
-
\`\`\`typescript
|
|
69
|
-
import { createAgent, type AppState } from '@agentuity/runtime';
|
|
70
|
-
import { s } from '@agentuity/schema';
|
|
71
|
-
|
|
72
|
-
const agent = createAgent({
|
|
73
|
-
metadata: {
|
|
74
|
-
name: 'Lifecycle Agent',
|
|
75
|
-
description: 'Agent with setup and shutdown',
|
|
76
|
-
},
|
|
77
|
-
schema: {
|
|
78
|
-
input: s.object({ message: s.string() }),
|
|
79
|
-
output: s.object({ result: s.string() }),
|
|
80
|
-
},
|
|
81
|
-
setup: async (app: AppState) => {
|
|
82
|
-
// Initialize resources (runs once on startup)
|
|
83
|
-
console.log('Setting up agent for app:', app.appName);
|
|
84
|
-
return {
|
|
85
|
-
agentId: \`agent-\${Math.random().toString(36).substr(2, 9)}\`,
|
|
86
|
-
connectionPool: ['conn-1', 'conn-2'],
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
handler: async (ctx, input) => {
|
|
90
|
-
// Access setup config via ctx.config (fully typed)
|
|
91
|
-
console.log('Agent ID:', ctx.config.agentId);
|
|
92
|
-
console.log('Connections:', ctx.config.connectionPool);
|
|
93
|
-
return { result: \`Processed: \${input.message}\` };
|
|
94
|
-
},
|
|
95
|
-
shutdown: async (app, config) => {
|
|
96
|
-
// Cleanup resources (runs on shutdown)
|
|
97
|
-
console.log('Shutting down agent:', config.agentId);
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export default agent;
|
|
102
|
-
\`\`\`
|
|
103
|
-
|
|
104
|
-
### Agent with Event Listeners
|
|
105
|
-
|
|
106
|
-
\`\`\`typescript
|
|
107
|
-
const agent = createAgent({
|
|
108
|
-
// ... configuration
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
agent.addEventListener('started', (eventName, agent, ctx) => {
|
|
112
|
-
console.log('Agent started:', ctx.config.agentId);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
agent.addEventListener('completed', (eventName, agent, ctx) => {
|
|
116
|
-
console.log('Agent completed');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
export default agent;
|
|
120
|
-
\`\`\`
|
|
121
|
-
|
|
122
|
-
## Creating Routes (route.ts)
|
|
123
|
-
|
|
124
|
-
Routes expose HTTP endpoints for your agent:
|
|
125
|
-
|
|
126
|
-
\`\`\`typescript
|
|
127
|
-
import { createRouter } from '@agentuity/runtime';
|
|
128
|
-
import agent from './agent';
|
|
129
|
-
|
|
130
|
-
const router = createRouter();
|
|
131
|
-
|
|
132
|
-
// GET /agent/hello
|
|
133
|
-
router.get('/', async (c) => {
|
|
134
|
-
const result = await c.agent.hello.run({ name: 'World', age: 25 });
|
|
135
|
-
return c.text(result);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// POST /agent/hello with validation
|
|
139
|
-
router.post('/', agent.validator(), async (c) => {
|
|
140
|
-
const data = c.req.valid('json');
|
|
141
|
-
const result = await c.agent.hello.run(data);
|
|
142
|
-
return c.text(result);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export default router;
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
## Agent Context (c)
|
|
149
|
-
|
|
150
|
-
The handler receives a context object with:
|
|
151
|
-
|
|
152
|
-
- **c.app** - Application state (appName, version, startedAt, config)
|
|
153
|
-
- **c.config** - Agent-specific config (from setup return value, fully typed)
|
|
154
|
-
- **c.logger** - Structured logger (info, warn, error, debug, trace)
|
|
155
|
-
- **c.kv** - Key-value storage
|
|
156
|
-
- **c.vector** - Vector storage
|
|
157
|
-
- **c.stream** - Stream management (create, list, delete)
|
|
158
|
-
- **c.agent** - Access to other agents (c.agent.otherAgent.run())
|
|
159
|
-
|
|
160
|
-
## Context in Routes (c)
|
|
161
|
-
|
|
162
|
-
Route handlers have additional context:
|
|
163
|
-
|
|
164
|
-
- **c.req** - Hono request object
|
|
165
|
-
- **c.var.logger** - Logger instance
|
|
166
|
-
- **Import agents directly** - Import and call agents directly instead of using c.var.agent
|
|
167
|
-
|
|
168
|
-
## Examples
|
|
169
|
-
|
|
170
|
-
### Using Key-Value Storage
|
|
171
|
-
|
|
172
|
-
\`\`\`typescript
|
|
173
|
-
handler: async (c, input) => {
|
|
174
|
-
await c.kv.set('user:123', { name: 'Alice', age: 30 });
|
|
175
|
-
const user = await c.kv.get('user:123');
|
|
176
|
-
return user;
|
|
177
|
-
}
|
|
178
|
-
\`\`\`
|
|
179
|
-
|
|
180
|
-
### Using Streams
|
|
181
|
-
|
|
182
|
-
\`\`\`typescript
|
|
183
|
-
handler: async (c, input) => {
|
|
184
|
-
const stream = await c.stream.create('output', {
|
|
185
|
-
metadata: { createdBy: 'my-agent' },
|
|
186
|
-
contentType: 'text/plain',
|
|
187
|
-
});
|
|
188
|
-
await stream.write('Hello from stream');
|
|
189
|
-
await stream.close();
|
|
190
|
-
return { streamId: stream.id, url: stream.url };
|
|
16
|
+
/**
|
|
17
|
+
* Get the raw prompt content without hash.
|
|
18
|
+
*/
|
|
19
|
+
export function getPromptContent() {
|
|
20
|
+
return agentPromptContent;
|
|
191
21
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
handler: async (c, input) => {
|
|
198
|
-
const result = await c.agent.otherAgent.run({ data: input.value });
|
|
199
|
-
return \`Other agent returned: \${result}\`;
|
|
200
|
-
}
|
|
201
|
-
\`\`\`
|
|
202
|
-
|
|
203
|
-
## Subagents (Nested Agents)
|
|
204
|
-
|
|
205
|
-
Agents can have subagents organized one level deep. This is useful for grouping related functionality.
|
|
206
|
-
|
|
207
|
-
### Directory Structure for Subagents
|
|
208
|
-
|
|
209
|
-
\`\`\`
|
|
210
|
-
src/agent/
|
|
211
|
-
└── team/ # Parent agent
|
|
212
|
-
├── agent.ts # Parent agent
|
|
213
|
-
├── route.ts # Parent routes
|
|
214
|
-
├── members/ # Subagent
|
|
215
|
-
│ ├── agent.ts
|
|
216
|
-
│ └── route.ts
|
|
217
|
-
└── tasks/ # Subagent
|
|
218
|
-
├── agent.ts
|
|
219
|
-
└── route.ts
|
|
220
|
-
\`\`\`
|
|
221
|
-
|
|
222
|
-
### Parent Agent
|
|
223
|
-
|
|
224
|
-
\`\`\`typescript
|
|
225
|
-
import { createAgent } from '@agentuity/runtime';
|
|
226
|
-
import { s } from '@agentuity/schema';
|
|
227
|
-
|
|
228
|
-
const agent = createAgent({
|
|
229
|
-
metadata: {
|
|
230
|
-
name: 'Team Manager',
|
|
231
|
-
},
|
|
232
|
-
schema: {
|
|
233
|
-
input: s.object({ action: s.union([s.literal('info'), s.literal('count')]) }),
|
|
234
|
-
output: s.object({
|
|
235
|
-
message: s.string(),
|
|
236
|
-
timestamp: s.string()
|
|
237
|
-
}),
|
|
238
|
-
},
|
|
239
|
-
handler: async (ctx, { action }) => {
|
|
240
|
-
return {
|
|
241
|
-
message: 'Team parent agent - manages members and tasks',
|
|
242
|
-
timestamp: new Date().toISOString(),
|
|
243
|
-
};
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
export default agent;
|
|
248
|
-
\`\`\`
|
|
249
|
-
|
|
250
|
-
### Subagent (Accessing Parent)
|
|
251
|
-
|
|
252
|
-
\`\`\`typescript
|
|
253
|
-
import { createAgent } from '@agentuity/runtime';
|
|
254
|
-
import { s } from '@agentuity/schema';
|
|
255
|
-
|
|
256
|
-
const agent = createAgent({
|
|
257
|
-
metadata: {
|
|
258
|
-
name: 'Members Subagent',
|
|
259
|
-
},
|
|
260
|
-
schema: {
|
|
261
|
-
input: s.object({
|
|
262
|
-
action: s.union([s.literal('list'), s.literal('add'), s.literal('remove')]),
|
|
263
|
-
name: s.optional(s.string()),
|
|
264
|
-
}),
|
|
265
|
-
output: s.object({
|
|
266
|
-
members: s.array(s.string()),
|
|
267
|
-
parentInfo: s.optional(s.string()),
|
|
268
|
-
}),
|
|
269
|
-
},
|
|
270
|
-
handler: async (ctx, { action, name }) => {
|
|
271
|
-
// Access parent agent
|
|
272
|
-
const parentResult = await ctx.agent.team.run({ action: 'info' });
|
|
273
|
-
const parentInfo = \`Parent says: \${parentResult.message}\`;
|
|
274
|
-
|
|
275
|
-
// Subagent logic here
|
|
276
|
-
let members = ['Alice', 'Bob'];
|
|
277
|
-
if (action === 'add' && name) {
|
|
278
|
-
members.push(name);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return { members, parentInfo };
|
|
282
|
-
},
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
export default agent;
|
|
286
|
-
\`\`\`
|
|
287
|
-
|
|
288
|
-
### Accessing Subagents from Routes
|
|
289
|
-
|
|
290
|
-
\`\`\`typescript
|
|
291
|
-
import { createRouter } from '@agentuity/runtime';
|
|
292
|
-
|
|
293
|
-
const router = createRouter();
|
|
294
|
-
|
|
295
|
-
router.get('/', async (c) => {
|
|
296
|
-
// Call parent agent
|
|
297
|
-
const teamInfo = await c.agent.team.run({ action: 'info' });
|
|
298
|
-
|
|
299
|
-
// Call subagents (nested access)
|
|
300
|
-
const members = await c.agent.team.members.run({ action: 'list' });
|
|
301
|
-
const tasks = await c.agent.team.tasks.run({ action: 'list' });
|
|
302
|
-
|
|
303
|
-
return c.json({ teamInfo, members, tasks });
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
export default router;
|
|
307
|
-
\`\`\`
|
|
308
|
-
|
|
309
|
-
### Subagent Routes
|
|
310
|
-
|
|
311
|
-
Routes for subagents automatically mount under the parent path:
|
|
312
|
-
|
|
313
|
-
- Parent: \`/agent/team\`
|
|
314
|
-
- Subagent: \`/agent/team/members\`
|
|
315
|
-
- Subagent: \`/agent/team/tasks\`
|
|
316
|
-
|
|
317
|
-
### Key Points About Subagents
|
|
318
|
-
|
|
319
|
-
- **One level deep**: Only one level of nesting is supported (no nested subagents)
|
|
320
|
-
- **Access parent**: Subagents can call their parent via \`ctx.agent.parentName.run()\`
|
|
321
|
-
- **Agent names**: Subagents have dotted names like \`"team.members"\`
|
|
322
|
-
- **Route hierarchy**: Routes inherit parent path structure
|
|
323
|
-
- **Shared context**: Subagents share the same app context (kv, logger, etc.)
|
|
324
|
-
|
|
325
|
-
## Rules
|
|
326
|
-
|
|
327
|
-
- Each agent folder name becomes the agent's route name (e.g., \`hello/\` → \`/agent/hello\`)
|
|
328
|
-
- **agent.ts** must export default the agent instance
|
|
329
|
-
- **route.ts** must export default the router instance
|
|
330
|
-
- Input/output schemas are enforced with @agentuity/schema validation
|
|
331
|
-
- Setup return value type automatically flows to ctx.config (fully typed)
|
|
332
|
-
- Use c.logger for logging, not console.log
|
|
333
|
-
- Agent names in routes are accessed via c.agent.{folderName}
|
|
334
|
-
- Subagents are one level deep only (team/members/, not team/members/subagent/)
|
|
335
|
-
- Subagent routes mount under parent path (/agent/team/members)
|
|
336
|
-
- Agents do not necessary need a route.ts file if they aren't exposed externally
|
|
337
|
-
`;
|
|
22
|
+
/**
|
|
23
|
+
* Generate the agent prompt with hash comment.
|
|
24
|
+
*/
|
|
25
|
+
export function generateLLMPrompt() {
|
|
26
|
+
return appendHashComment(agentPromptContent);
|
|
338
27
|
}
|
|
339
28
|
//# sourceMappingURL=agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,kBAAkB,MAAM,YAAY,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAElE,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;IAC/C,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,sEAAsE;IACnF,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACrF,KAAK,CAAC,OAAO,CAAC,IAAoB;QACjC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;CACD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export declare const apiSubcommand: import("../../..").SubcommandDefinition;
|
|
2
|
+
/**
|
|
3
|
+
* Get the raw prompt content without hash.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getPromptContent(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Generate the API prompt with hash comment.
|
|
8
|
+
*/
|
|
2
9
|
export declare function generateLLMPrompt(): string;
|
|
3
10
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/api.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,yCAUxB,CAAC;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createSubcommand } from '../../../types';
|
|
2
2
|
import { getCommand } from '../../../command-prefix';
|
|
3
|
+
import { appendHashComment } from './version';
|
|
4
|
+
import apiPromptContent from './api.md' with { type: 'text' };
|
|
3
5
|
export const apiSubcommand = createSubcommand({
|
|
4
6
|
name: 'api',
|
|
5
7
|
description: 'Generate a comprehensive prompt for LLM agents for the apis folder',
|
|
@@ -11,266 +13,16 @@ export const apiSubcommand = createSubcommand({
|
|
|
11
13
|
console.log(prompt);
|
|
12
14
|
},
|
|
13
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Get the raw prompt content without hash.
|
|
18
|
+
*/
|
|
19
|
+
export function getPromptContent() {
|
|
20
|
+
return apiPromptContent;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generate the API prompt with hash comment.
|
|
24
|
+
*/
|
|
14
25
|
export function generateLLMPrompt() {
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
This folder contains REST API routes for your Agentuity application. Each API is organized in its own subdirectory.
|
|
18
|
-
|
|
19
|
-
## Directory Structure
|
|
20
|
-
|
|
21
|
-
Each API folder must contain:
|
|
22
|
-
- **route.ts** (required) - HTTP route definitions using Hono router
|
|
23
|
-
|
|
24
|
-
Example structure:
|
|
25
|
-
\`\`\`
|
|
26
|
-
src/api/
|
|
27
|
-
├── index.ts (optional, mounted at /api)
|
|
28
|
-
├── status/
|
|
29
|
-
│ └── route.ts (mounted at /api/status)
|
|
30
|
-
├── users/
|
|
31
|
-
│ └── route.ts (mounted at /api/users)
|
|
32
|
-
├── agent-call/
|
|
33
|
-
└── route.ts (mounted at /api/agent-call)
|
|
34
|
-
\`\`\`
|
|
35
|
-
|
|
36
|
-
## Creating an API
|
|
37
|
-
|
|
38
|
-
### Basic API (route.ts)
|
|
39
|
-
|
|
40
|
-
\`\`\`typescript
|
|
41
|
-
import { createRouter } from '@agentuity/runtime';
|
|
42
|
-
|
|
43
|
-
const router = createRouter();
|
|
44
|
-
|
|
45
|
-
// GET /api/status
|
|
46
|
-
router.get('/', (c) => {
|
|
47
|
-
return c.json({
|
|
48
|
-
status: 'ok',
|
|
49
|
-
timestamp: new Date().toISOString(),
|
|
50
|
-
version: '1.0.0',
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// POST /api/status
|
|
55
|
-
router.post('/', async (c) => {
|
|
56
|
-
const body = await c.req.json();
|
|
57
|
-
return c.json({ received: body });
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export default router;
|
|
61
|
-
\`\`\`
|
|
62
|
-
|
|
63
|
-
### API with Request Validation
|
|
64
|
-
|
|
65
|
-
\`\`\`typescript
|
|
66
|
-
import { createRouter } from '@agentuity/runtime';
|
|
67
|
-
import { s } from '@agentuity/schema';
|
|
68
|
-
|
|
69
|
-
const router = createRouter();
|
|
70
|
-
|
|
71
|
-
const createUserSchema = s.object({
|
|
72
|
-
name: s.string(),
|
|
73
|
-
email: s.string(),
|
|
74
|
-
age: s.number(),
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const validator = createRouter.validator({
|
|
78
|
-
input: createUserSchema,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
router.post('/', validator, async (c) => {
|
|
82
|
-
const data = c.req.valid('json');
|
|
83
|
-
// data is fully typed: { name: string, email: string, age: number }
|
|
84
|
-
return c.json({
|
|
85
|
-
success: true,
|
|
86
|
-
user: data
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
export default router;
|
|
91
|
-
\`\`\`
|
|
92
|
-
|
|
93
|
-
### API Calling Agents
|
|
94
|
-
|
|
95
|
-
APIs can call agents directly:
|
|
96
|
-
|
|
97
|
-
\`\`\`typescript
|
|
98
|
-
import { createRouter } from '@agentuity/runtime';
|
|
99
|
-
|
|
100
|
-
const router = createRouter();
|
|
101
|
-
|
|
102
|
-
router.get('/', async (c) => {
|
|
103
|
-
// Call an agent from the agents/ folder
|
|
104
|
-
const result = await c.agent.hello.run({ name: 'API Caller', age: 42 });
|
|
105
|
-
|
|
106
|
-
return c.json({
|
|
107
|
-
success: true,
|
|
108
|
-
agentResult: result,
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
router.post('/with-input', async (c) => {
|
|
113
|
-
const body = await c.req.json();
|
|
114
|
-
const { name, age } = body;
|
|
115
|
-
|
|
116
|
-
// Call agent with dynamic input
|
|
117
|
-
const result = await c.agent.simple.run({ name, age });
|
|
118
|
-
|
|
119
|
-
return c.json({
|
|
120
|
-
success: true,
|
|
121
|
-
agentResult: result,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
export default router;
|
|
126
|
-
\`\`\`
|
|
127
|
-
|
|
128
|
-
### API with Logging
|
|
129
|
-
|
|
130
|
-
\`\`\`typescript
|
|
131
|
-
import { createRouter } from '@agentuity/runtime';
|
|
132
|
-
|
|
133
|
-
const router = createRouter();
|
|
134
|
-
|
|
135
|
-
router.get('/log-test', (c) => {
|
|
136
|
-
c.var.logger.info('Info message');
|
|
137
|
-
c.var.logger.error('Error message');
|
|
138
|
-
c.var.logger.warn('Warning message');
|
|
139
|
-
c.var.logger.debug('Debug message');
|
|
140
|
-
c.var.logger.trace('Trace message');
|
|
141
|
-
|
|
142
|
-
return c.text('Check logs');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export default router;
|
|
146
|
-
\`\`\`
|
|
147
|
-
|
|
148
|
-
## Route Context (c)
|
|
149
|
-
|
|
150
|
-
The route handler receives a Hono context object with:
|
|
151
|
-
|
|
152
|
-
- **c.req** - Request object (c.req.json(), c.req.param(), c.req.query(), etc.)
|
|
153
|
-
- **c.json()** - Return JSON response
|
|
154
|
-
- **c.text()** - Return text response
|
|
155
|
-
- **c.html()** - Return HTML response
|
|
156
|
-
- **c.redirect()** - Redirect to URL
|
|
157
|
-
- **c.var.logger** - Structured logger (info, warn, error, debug, trace)
|
|
158
|
-
- **Import agents directly** - Import and call agents directly instead of using c.var.agent
|
|
159
|
-
- **c.var.kv** - Key-value storage
|
|
160
|
-
- **c.var.vector** - Vector storage
|
|
161
|
-
- **c.var.stream** - Stream management
|
|
162
|
-
|
|
163
|
-
## HTTP Methods
|
|
164
|
-
|
|
165
|
-
\`\`\`typescript
|
|
166
|
-
const router = createRouter();
|
|
167
|
-
|
|
168
|
-
router.get('/path', (c) => { /* ... */ });
|
|
169
|
-
router.post('/path', (c) => { /* ... */ });
|
|
170
|
-
router.put('/path', (c) => { /* ... */ });
|
|
171
|
-
router.patch('/path', (c) => { /* ... */ });
|
|
172
|
-
router.delete('/path', (c) => { /* ... */ });
|
|
173
|
-
router.options('/path', (c) => { /* ... */ });
|
|
174
|
-
\`\`\`
|
|
175
|
-
|
|
176
|
-
## Path Parameters
|
|
177
|
-
|
|
178
|
-
\`\`\`typescript
|
|
179
|
-
// GET /api/users/:id
|
|
180
|
-
router.get('/:id', (c) => {
|
|
181
|
-
const id = c.req.param('id');
|
|
182
|
-
return c.json({ userId: id });
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// GET /api/posts/:postId/comments/:commentId
|
|
186
|
-
router.get('/:postId/comments/:commentId', (c) => {
|
|
187
|
-
const postId = c.req.param('postId');
|
|
188
|
-
const commentId = c.req.param('commentId');
|
|
189
|
-
return c.json({ postId, commentId });
|
|
190
|
-
});
|
|
191
|
-
\`\`\`
|
|
192
|
-
|
|
193
|
-
## Query Parameters
|
|
194
|
-
|
|
195
|
-
\`\`\`typescript
|
|
196
|
-
// GET /api/search?q=hello&limit=10
|
|
197
|
-
router.get('/search', (c) => {
|
|
198
|
-
const query = c.req.query('q');
|
|
199
|
-
const limit = c.req.query('limit') || '20';
|
|
200
|
-
return c.json({ query, limit: parseInt(limit) });
|
|
201
|
-
});
|
|
202
|
-
\`\`\`
|
|
203
|
-
|
|
204
|
-
## Request Body
|
|
205
|
-
|
|
206
|
-
\`\`\`typescript
|
|
207
|
-
// JSON body
|
|
208
|
-
router.post('/', async (c) => {
|
|
209
|
-
const body = await c.req.json();
|
|
210
|
-
return c.json({ received: body });
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// Form data
|
|
214
|
-
router.post('/upload', async (c) => {
|
|
215
|
-
const formData = await c.req.formData();
|
|
216
|
-
const file = formData.get('file');
|
|
217
|
-
return c.json({ fileName: file?.name });
|
|
218
|
-
});
|
|
219
|
-
\`\`\`
|
|
220
|
-
|
|
221
|
-
## Error Handling
|
|
222
|
-
|
|
223
|
-
\`\`\`typescript
|
|
224
|
-
router.get('/', async (c) => {
|
|
225
|
-
try {
|
|
226
|
-
const result = await c.agent.myAgent.run({ data: 'test' });
|
|
227
|
-
return c.json({ success: true, result });
|
|
228
|
-
} catch (error) {
|
|
229
|
-
c.var.logger.error('Agent call failed:', error);
|
|
230
|
-
return c.json(
|
|
231
|
-
{
|
|
232
|
-
success: false,
|
|
233
|
-
error: error instanceof Error ? error.message : String(error),
|
|
234
|
-
},
|
|
235
|
-
500
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
\`\`\`
|
|
240
|
-
|
|
241
|
-
## Response Types
|
|
242
|
-
|
|
243
|
-
\`\`\`typescript
|
|
244
|
-
// JSON response
|
|
245
|
-
return c.json({ data: 'value' });
|
|
246
|
-
|
|
247
|
-
// Text response
|
|
248
|
-
return c.text('Hello World');
|
|
249
|
-
|
|
250
|
-
// HTML response
|
|
251
|
-
return c.html('<h1>Hello</h1>');
|
|
252
|
-
|
|
253
|
-
// Custom status code
|
|
254
|
-
return c.json({ error: 'Not found' }, 404);
|
|
255
|
-
|
|
256
|
-
// Redirect
|
|
257
|
-
return c.redirect('/new-path');
|
|
258
|
-
|
|
259
|
-
// Headers
|
|
260
|
-
return c.json({ data: 'value' }, 200, {
|
|
261
|
-
'X-Custom-Header': 'value',
|
|
262
|
-
});
|
|
263
|
-
\`\`\`
|
|
264
|
-
|
|
265
|
-
## Rules
|
|
266
|
-
|
|
267
|
-
- Each API folder name becomes the route name (e.g., \`status/\` → \`/api/status\`)
|
|
268
|
-
- **route.ts** must export default the router instance
|
|
269
|
-
- Use c.var.logger for logging, not console.log
|
|
270
|
-
- All agents are accessible via c.agent.{agentName}
|
|
271
|
-
- Validation should use @agentuity/schema or any Standard Schema compatible library
|
|
272
|
-
- Return appropriate HTTP status codes
|
|
273
|
-
- APIs run at \`/api/{folderName}\` by default
|
|
274
|
-
`;
|
|
26
|
+
return appendHashComment(apiPromptContent);
|
|
275
27
|
}
|
|
276
28
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,gBAAgB,MAAM,UAAU,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;IAC7C,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,oEAAoE;IACjF,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjF,KAAK,CAAC,OAAO,CAAC,IAAoB;QACjC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;CACD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt file versioning utilities.
|
|
3
|
+
*
|
|
4
|
+
* Hash format at end of file: <!-- prompt_hash: [hash] -->
|
|
5
|
+
*
|
|
6
|
+
* - hash: SHA256 of file content (excluding the hash line)
|
|
7
|
+
*
|
|
8
|
+
* This allows detecting if the source template has changed.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Compute SHA256 hash of content using Bun's built-in hasher.
|
|
12
|
+
*/
|
|
13
|
+
export declare function computeHash(content: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Strip the hash comment from content.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stripHashComment(content: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Extract hash from file content.
|
|
20
|
+
* Returns null if no hash comment found.
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractHash(content: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Generate content with hash comment appended.
|
|
25
|
+
*/
|
|
26
|
+
export declare function appendHashComment(content: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a file needs to be updated based on hash comparison.
|
|
29
|
+
*
|
|
30
|
+
* @param fileContent - Current file content (with hash comment)
|
|
31
|
+
* @param sourceContent - Source template content (without hash comment)
|
|
32
|
+
* @returns true if file needs to be updated (hashes differ)
|
|
33
|
+
*/
|
|
34
|
+
export declare function needsUpdate(fileContent: string, sourceContent: string): boolean;
|
|
35
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/cmd/ai/prompt/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAQ/E"}
|