@dot-agent/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Setup Node.js
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: '24.x'
22
+ registry-url: 'https://registry.npmjs.org'
23
+
24
+ - name: Install dependencies
25
+ run: npm ci
26
+
27
+ - name: Publish package to npm
28
+ run: npm publish
package/AGENTS.md ADDED
@@ -0,0 +1,94 @@
1
+ # Agent Dependencies
2
+
3
+ This document tracks dependencies between agents built with the `dot-agent` CLI and external agent services.
4
+
5
+ ## Structure
6
+
7
+ Each agent that requires services from other agents or external APIs should be documented below with:
8
+ - **Agent ID** — Qualified name (domain/name:version)
9
+ - **Requires** — List of agent services or APIs needed
10
+ - **Status** — Deployment or development status
11
+ - **Notes** — Additional context or constraints
12
+
13
+ ## Template
14
+
15
+ When adding a new agent, use this format:
16
+
17
+ ```markdown
18
+ ### agent-name (domain/agent-name:v1.0)
19
+
20
+ **Requires:**
21
+ - `ServiceAgent` — Provides X functionality
22
+ - External API: `https://api.example.com` — Rate limited to 100 req/min
23
+
24
+ **Status:** Development
25
+
26
+ **Notes:** Add any important integration notes, authentication requirements, or deployment constraints.
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Example Agents
32
+
33
+ ### doctor (entelekheia.ai/doctor:v1.0)
34
+
35
+ **Requires:**
36
+ - `UserProfile` — Patient data and medical history
37
+ - EMR API — Electronic medical records system
38
+
39
+ **Status:** Production
40
+
41
+ **Notes:**
42
+ - Requires HIPAA compliance verification
43
+ - Patient consent tokens must be present in context
44
+ - Knowledge base includes latest clinical guidelines
45
+
46
+ ---
47
+
48
+ ### assistant (example.com/assistant:v1.0)
49
+
50
+ **Requires:**
51
+ - `FileSystem` — Read/write operations
52
+ - `SearchAPI` — Query external knowledge bases
53
+
54
+ **Status:** Development
55
+
56
+ **Notes:** Early prototype, not for production use yet
57
+
58
+ ---
59
+
60
+ ## Common Dependencies
61
+
62
+ ### System Capabilities
63
+
64
+ - **UserProfile** — User identity, preferences, history
65
+ - **FileSystem** — Disk I/O, document storage
66
+ - **Memory** — Session/context memory (internal)
67
+ - **Clock** — Time-aware features
68
+
69
+ ### External Integrations
70
+
71
+ - **SearchAPI** — Web search or knowledge base queries
72
+ - **EmailService** — Send/receive emails
73
+ - **SlackBot** — Slack workspace integration
74
+ - **PaymentGateway** — Transaction processing
75
+
76
+ ---
77
+
78
+ ## Orchestration Rules
79
+
80
+ When composing agents that have dependencies:
81
+
82
+ 1. **Initialization Order** — Load agents bottom-up (services before clients)
83
+ 2. **Error Handling** — Graceful degradation if optional dependencies unavailable
84
+ 3. **Timeout Policy** — Set reasonable timeouts for inter-agent calls
85
+ 4. **Logging** — Log all external service calls for debugging
86
+
87
+ ---
88
+
89
+ ## Notes for Developers
90
+
91
+ - Update this file when adding new agents or changing dependencies
92
+ - Document breaking changes when upgrading agent versions
93
+ - Use semantic versioning (v1.0, v2.1, etc.) for reproducibility
94
+ - Keep a `requires[]` field in your agent's `.description` file in sync with this document
package/README.md ADDED
@@ -0,0 +1,263 @@
1
+ # dot-agent CLI
2
+
3
+ The official command-line interface for the **dot-agent** specification. Build, validate, package, and execute AI agents with a simple, declarative DSL.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g dot-agent
9
+ ```
10
+
11
+ Or use directly with `npx`:
12
+
13
+ ```bash
14
+ npx dot-agent <command>
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Initialize a new agent project
20
+
21
+ ```bash
22
+ dot-agent init --name my-agent --domain example.com --dir ./my-agent
23
+ ```
24
+
25
+ This creates a scaffold with:
26
+ - `agent.description` — Agent manifest (domain, name, capabilities)
27
+ - `agent.behavior` — FSM state machine definition
28
+ - `SOUL.md` — Agent persona and voice
29
+ - `README.md`, `LICENSE` — Project metadata
30
+ - `behaviors/`, `guides/`, `knowledge/` — Content directories
31
+
32
+ ### 2. Edit your agent
33
+
34
+ Customize the generated files:
35
+ - Describe your agent in `agent.description`
36
+ - Define behavior states and transitions in `agent.behavior`
37
+ - Add knowledge and guides as needed
38
+
39
+ ### 3. Package your agent
40
+
41
+ ```bash
42
+ dot-agent pack --dir ./my-agent --version v1.0.0
43
+ ```
44
+
45
+ This validates the DSL and creates `my-agent.agent` (a ZIP archive) with:
46
+ - `.agent/aboutme.json` — Agent metadata
47
+ - `.agent/files.json` — File manifest
48
+ - Source files and content
49
+
50
+ ### 4. Run your agent
51
+
52
+ ```bash
53
+ dot-agent run ./my-agent.agent
54
+ ```
55
+
56
+ Loads the agent and returns an `AgentContext` for execution in Electron, Node, or another runtime.
57
+
58
+ ### 5. Extract an agent (optional)
59
+
60
+ ```bash
61
+ dot-agent unpack my-agent.agent --out ./unpacked
62
+ ```
63
+
64
+ Restores the original source files from a `.agent` package.
65
+
66
+ ---
67
+
68
+ ## Commands
69
+
70
+ | Command | Purpose | Example |
71
+ |---------|---------|---------|
72
+ | `init` | Scaffold a new agent project | `dot-agent init --name myagent --domain example.com` |
73
+ | `pack` | Validate and package agent into `.agent` ZIP | `dot-agent pack --dir . --version v1.0.0` |
74
+ | `unpack` | Extract `.agent` file to sources | `dot-agent unpack myagent.agent --out ./src` |
75
+ | `run` | Load agent and return AgentContext | `dot-agent run myagent.agent` |
76
+
77
+ ---
78
+
79
+ ## Agent Definition
80
+
81
+ ### `agent.description`
82
+
83
+ Declares the agent's identity, capabilities, and requirements:
84
+
85
+ ```
86
+ agent MyAgent
87
+ domain example.com
88
+ license Apache-2.0
89
+
90
+ description
91
+ A helpful AI assistant for customer support.
92
+
93
+ behavior agent.behavior
94
+
95
+ capabilities
96
+ RespondToQuery "Answer customer questions"
97
+ EscalateToHuman "Transfer to human agent when needed"
98
+ ```
99
+
100
+ ### `agent.behavior`
101
+
102
+ Defines the finite state machine (FSM) that governs agent behavior:
103
+
104
+ ```
105
+ state init
106
+ transition to ready
107
+
108
+ state ready
109
+ goal "Help the user with their query."
110
+ interact
111
+ on intent "ask-question" transition to answering
112
+ on intent "escalate" transition to escalated
113
+
114
+ state answering
115
+ goal "Provide a helpful answer."
116
+ interact
117
+ on intent "follow-up" transition to answering
118
+ on intent "resolved" transition to ready
119
+
120
+ state escalated
121
+ goal "Transfer conversation to human support."
122
+ transition to ready
123
+ ```
124
+
125
+ ---
126
+
127
+ ## API Usage
128
+
129
+ Use `dot-agent` as a module in Node.js or Electron:
130
+
131
+ ```typescript
132
+ import { init, pack, unpack, run } from 'dot-agent'
133
+
134
+ // Initialize a project
135
+ const initResult = await init({
136
+ name: 'my-agent',
137
+ domain: 'example.com',
138
+ dir: './agents/my-agent'
139
+ })
140
+
141
+ // Package an agent
142
+ const packResult = await pack({
143
+ dir: './agents/my-agent',
144
+ version: 'v1.0.0'
145
+ })
146
+ console.log(`Agent packaged: ${packResult.id}`)
147
+
148
+ // Load an agent
149
+ const context = await run({
150
+ source: './my-agent.agent'
151
+ })
152
+
153
+ // Listen to loading progress
154
+ context.on('progress', (event) => {
155
+ console.log(`${event.step}: ${event.pct}%`)
156
+ })
157
+
158
+ context.on('ready', (ctx) => {
159
+ console.log(`Agent ready: ${ctx.id}`)
160
+ })
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Package Format (.agent)
166
+
167
+ A `.agent` file is a ZIP archive containing:
168
+
169
+ ```
170
+ my-agent.agent (ZIP)
171
+ ├── .agent/
172
+ │ ├── aboutme.json ← Agent metadata (required)
173
+ │ ├── files.json ← File manifest
174
+ │ └── types.json ← Type definitions (optional)
175
+ ├── agent.description ← Agent manifest
176
+ ├── agent.behavior ← FSM definition
177
+ ├── behaviors/ ← Behavior includes
178
+ ├── guides/ ← Procedural guides
179
+ ├── knowledge/ ← Knowledge base / RAG
180
+ └── SOUL.md ← Agent persona
181
+ ```
182
+
183
+ ### `aboutme.json`
184
+
185
+ ```json
186
+ {
187
+ "schemaVersion": "dot-agent/1.0",
188
+ "id": "example.com/my-agent:v1.0.0~a1b2c3d4",
189
+ "name": "My Agent",
190
+ "description": "A helpful AI assistant",
191
+ "version": "v1.0.0",
192
+ "domain": "example.com",
193
+ "license": "Apache-2.0",
194
+ "persona": "SOUL.md",
195
+ "compiler": "dot-agent/1.0.0",
196
+ "skills": [],
197
+ "requires": [],
198
+ "integrity": {
199
+ "sha256": "...",
200
+ "files": ".agent/files.json"
201
+ }
202
+ }
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Validation & Linting
208
+
209
+ The `pack` command validates:
210
+
211
+ 1. **Syntax** — `.description` and `.behavior` DSL structure (tree-sitter)
212
+ 2. **Semantics** — FSM state references, memory access, capability definitions (kernel-dsl)
213
+ 3. **Files** — All referenced files exist and are readable
214
+
215
+ Error codes:
216
+ - `E001` — Missing required field in `.description`
217
+ - `E003` — `.description` file not found
218
+ - `E004` — Syntax error in `.behavior` DSL
219
+ - `E006` — Semantic parse error in FSM
220
+ - `E007` — `.behavior` file not found
221
+ - `W003` — Domain still set to default `example.com`
222
+
223
+ ---
224
+
225
+ ## Requirements
226
+
227
+ - **Node.js** 18.0.0 or higher
228
+ - **npm** or compatible package manager
229
+
230
+ ## Dependencies
231
+
232
+ - `@dot-agent/tree-sitter` — WASM-based DSL parser
233
+ - `@dot-agent/kernel-dsl` — WASM-based FSM execution engine
234
+ - `web-tree-sitter` — Tree-sitter bindings for web/Node.js
235
+ - `jszip` — ZIP file creation and extraction
236
+
237
+ ---
238
+
239
+ ## Specification
240
+
241
+ For the complete dot-agent specification, see:
242
+ - [plan.md](./plan.md) — CLI design and implementation details
243
+ - [file structure.md](./file%20structure.md) — `.agent` package format and semantics
244
+
245
+ ---
246
+
247
+ ## License
248
+
249
+ Apache License 2.0 — See [LICENSE](./LICENSE) file
250
+
251
+ ## Author
252
+
253
+ Danilo Borges — [https://daniloborg.es](https://daniloborg.es)
254
+
255
+ ---
256
+
257
+ ## Contributing
258
+
259
+ Contributions welcome! Please file issues and PRs at the [main repository](https://github.com/dot-agent-spec/dot-agent).
260
+
261
+ ## Status
262
+
263
+ **V1 Release Candidate** — All 4 core commands (`init`, `pack`, `unpack`, `run`) implemented and tested.