deepclause-sdk 0.0.1 → 0.0.2
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/README.md +16 -25
- package/dist/cli/compile.d.ts +10 -5
- package/dist/cli/compile.d.ts.map +1 -1
- package/dist/cli/compile.js +495 -131
- package/dist/cli/compile.js.map +1 -1
- package/dist/cli/index.js +13 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/prompt.d.ts +1 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +169 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/run.js +2 -2
- package/dist/cli/run.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# DeepClause
|
|
1
|
+
# DeepClause CLI and SDK
|
|
2
2
|
|
|
3
|
-
Compile markdown specs into
|
|
3
|
+
Compile markdown specs into executable logic programs. Guaranteed execution semantics for agentic workflows.
|
|
4
4
|
|
|
5
5
|
## What This Is
|
|
6
6
|
|
|
7
7
|
AI skills and tools are everywhere—but most are just prompts. When a prompt fails, you tweak it. When you need branching logic, you write wrapper code. When you want retry behavior, you build it yourself.
|
|
8
8
|
|
|
9
|
-
DeepClause takes a different approach: **compile task descriptions into Prolog-based
|
|
9
|
+
DeepClause takes a different approach: **compile task descriptions into DML programs**—a Prolog-based language that handles control flow, error recovery, and tool orchestration automatically.
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
```
|
|
12
|
-
Markdown description → compile → Logic program
|
|
13
|
+
Markdown description → compile → Logic program → run → Output
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
## Sandboxed by Default
|
|
@@ -19,7 +20,7 @@ Everything runs in WebAssembly—no native code execution, no container setup re
|
|
|
19
20
|
- **[AgentVM](https://github.com/deepclause/agentvm)**: A lightweight WASM-based Linux environment for shell commands, file operations, and Python/Node execution
|
|
20
21
|
- **Prolog runtime**: The logic engine itself runs in WASM (SWI-Prolog compiled to WebAssembly)
|
|
21
22
|
|
|
22
|
-
This means that DML tools and agents can execute arbitrary shell commands
|
|
23
|
+
This means that DML tools and agents can execute arbitrary shell commands with minimal chance of escaping to your host system.
|
|
23
24
|
|
|
24
25
|
## Beyond Markdown: Why Logic Programming?
|
|
25
26
|
|
|
@@ -122,12 +123,12 @@ deepclause run .deepclause/tools/explain.dml "function fib(n) { return n < 2 ? n
|
|
|
122
123
|
|
|
123
124
|
## Use Cases
|
|
124
125
|
|
|
125
|
-
###
|
|
126
|
+
### Reliable tools for coding agents
|
|
126
127
|
|
|
127
|
-
AI coding
|
|
128
|
+
Give your AI coding assistant more deterministic, inspectable tools instead of hoping prompts work:
|
|
128
129
|
|
|
129
130
|
```bash
|
|
130
|
-
#
|
|
131
|
+
# Define a tool the agent can use
|
|
131
132
|
cat > .deepclause/tools/api-docs.md << 'EOF'
|
|
132
133
|
# API Documentation Lookup
|
|
133
134
|
Search for API documentation and summarize usage patterns.
|
|
@@ -143,14 +144,14 @@ Search for API documentation and summarize usage patterns.
|
|
|
143
144
|
- Summarize usage patterns and examples
|
|
144
145
|
EOF
|
|
145
146
|
|
|
146
|
-
# Compile it
|
|
147
|
+
# Compile it once
|
|
147
148
|
deepclause compile .deepclause/tools/api-docs.md
|
|
148
149
|
|
|
149
|
-
#
|
|
150
|
+
# Now your coding agent can run it reliably
|
|
150
151
|
deepclause run .deepclause/tools/api-docs.dml "Stripe PaymentIntent"
|
|
151
152
|
```
|
|
152
153
|
|
|
153
|
-
The compiled `.dml` files
|
|
154
|
+
The compiled `.dml` files execute the same way every time—no prompt variance, no skipped steps. Build up a library of tools your agent can trust.
|
|
154
155
|
|
|
155
156
|
### Automation pipelines
|
|
156
157
|
|
|
@@ -234,6 +235,8 @@ Skills can use these built-in tools:
|
|
|
234
235
|
|
|
235
236
|
Configure tools in `.deepclause/config.json`.
|
|
236
237
|
|
|
238
|
+
MCP support is on the roadmap.
|
|
239
|
+
|
|
237
240
|
## CLI Reference
|
|
238
241
|
|
|
239
242
|
```bash
|
|
@@ -250,7 +253,7 @@ deepclause set-model <model> # Change default model
|
|
|
250
253
|
|
|
251
254
|
```bash
|
|
252
255
|
deepclause run skill.dml "input" \
|
|
253
|
-
--model google/gemini-2.5-flash \ # Override model
|
|
256
|
+
--model google/gemini-2.5-flash \ # Override model (e.g. use cheaper model for execution, SOTA model for planning/compilation)
|
|
254
257
|
--stream \ # Stream output
|
|
255
258
|
--verbose \ # Show tool calls
|
|
256
259
|
--workspace ./data # Set working directory
|
|
@@ -327,7 +330,7 @@ agent_main(Question) :-
|
|
|
327
330
|
answer("Done").
|
|
328
331
|
```
|
|
329
332
|
|
|
330
|
-
If `validate_answer` fails, Prolog backtracks and tries the second clause. No explicit if/else needed.
|
|
333
|
+
If `validate_answer` fails, Prolog backtracks and tries the second clause. No explicit if/else needed. Backtracking resets the execution state (including LLM context) to the original choice point!
|
|
331
334
|
|
|
332
335
|
### Recursion: Processing Lists
|
|
333
336
|
|
|
@@ -402,18 +405,6 @@ agent_main(Topic) :-
|
|
|
402
405
|
answer(Final).
|
|
403
406
|
```
|
|
404
407
|
|
|
405
|
-
### When to Use DML Directly
|
|
406
|
-
|
|
407
|
-
| Use Markdown When... | Use DML When... |
|
|
408
|
-
|---------------------|-----------------|
|
|
409
|
-
| Linear, single-task workflow | Complex control flow needed |
|
|
410
|
-
| No error handling needed | Need retry/fallback logic |
|
|
411
|
-
| Simple input → output | Processing collections |
|
|
412
|
-
| Quick prototyping | Production reliability |
|
|
413
|
-
| Non-programmers writing skills | Fine-grained tool control |
|
|
414
|
-
|
|
415
|
-
Start with Markdown. Graduate to DML when you need the power.
|
|
416
|
-
|
|
417
408
|
## Using as a Library
|
|
418
409
|
|
|
419
410
|
Embed DeepClause in your own applications:
|
package/dist/cli/compile.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DeepClause CLI - Compilation Module
|
|
3
3
|
*
|
|
4
|
-
* Compiles Markdown task descriptions to DML programs using
|
|
4
|
+
* Compiles Markdown task descriptions to DML programs using an agentic loop
|
|
5
|
+
* with LLM generation and Prolog validation.
|
|
5
6
|
*/
|
|
6
7
|
import { type Provider } from './config.js';
|
|
7
8
|
export interface CompileOptions {
|
|
@@ -10,6 +11,9 @@ export interface CompileOptions {
|
|
|
10
11
|
model?: string;
|
|
11
12
|
provider?: Provider;
|
|
12
13
|
temperature?: number;
|
|
14
|
+
maxAttempts?: number;
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
stream?: boolean;
|
|
13
17
|
}
|
|
14
18
|
export interface CompileResult {
|
|
15
19
|
output: string;
|
|
@@ -18,6 +22,8 @@ export interface CompileResult {
|
|
|
18
22
|
valid: boolean;
|
|
19
23
|
dml?: string;
|
|
20
24
|
meta?: MetaFile;
|
|
25
|
+
explanation?: string;
|
|
26
|
+
attempts?: number;
|
|
21
27
|
}
|
|
22
28
|
export interface CompileAllResult {
|
|
23
29
|
compiled: number;
|
|
@@ -53,7 +59,7 @@ export interface MetaFile {
|
|
|
53
59
|
}>;
|
|
54
60
|
}
|
|
55
61
|
/**
|
|
56
|
-
* Compile a Markdown task description to DML
|
|
62
|
+
* Compile a Markdown task description to DML using an agentic loop
|
|
57
63
|
*/
|
|
58
64
|
export declare function compile(sourcePath: string, outputDir: string, options?: CompileOptions): Promise<CompileResult>;
|
|
59
65
|
/**
|
|
@@ -62,7 +68,6 @@ export declare function compile(sourcePath: string, outputDir: string, options?:
|
|
|
62
68
|
export declare function compileAll(sourceDir: string, outputDir: string, options?: CompileOptions): Promise<CompileAllResult>;
|
|
63
69
|
/**
|
|
64
70
|
* Extract tool dependencies from DML code
|
|
65
|
-
* Only extracts external tools called via exec/2
|
|
66
71
|
*/
|
|
67
72
|
export declare function extractToolDependencies(dml: string): string[];
|
|
68
73
|
/**
|
|
@@ -75,11 +80,11 @@ export declare function extractParameters(dml: string): Array<{
|
|
|
75
80
|
required?: boolean;
|
|
76
81
|
}>;
|
|
77
82
|
/**
|
|
78
|
-
* Extract description from markdown
|
|
83
|
+
* Extract description from markdown
|
|
79
84
|
*/
|
|
80
85
|
export declare function extractDescription(markdown: string): string;
|
|
81
86
|
/**
|
|
82
|
-
* Basic DML syntax validation
|
|
87
|
+
* Basic DML syntax validation (exported for backwards compatibility)
|
|
83
88
|
*/
|
|
84
89
|
export declare function validateDMLSyntax(dml: string): {
|
|
85
90
|
valid: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/cli/compile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/cli/compile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AASrE,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;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