keystone-cli 0.8.0 → 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.
- package/README.md +486 -54
- package/package.json +8 -2
- package/src/__fixtures__/index.ts +100 -0
- package/src/cli.ts +809 -90
- package/src/db/memory-db.ts +35 -1
- package/src/db/workflow-db.test.ts +24 -0
- package/src/db/workflow-db.ts +469 -14
- package/src/expression/evaluator.ts +68 -4
- package/src/parser/agent-parser.ts +6 -3
- package/src/parser/config-schema.ts +38 -2
- package/src/parser/schema.ts +192 -7
- package/src/parser/test-schema.ts +29 -0
- package/src/parser/workflow-parser.test.ts +54 -0
- package/src/parser/workflow-parser.ts +153 -7
- package/src/runner/aggregate-error.test.ts +57 -0
- package/src/runner/aggregate-error.ts +46 -0
- package/src/runner/audit-verification.test.ts +2 -2
- package/src/runner/auto-heal.test.ts +1 -1
- package/src/runner/blueprint-executor.test.ts +63 -0
- package/src/runner/blueprint-executor.ts +157 -0
- package/src/runner/concurrency-limit.test.ts +82 -0
- package/src/runner/debug-repl.ts +18 -3
- package/src/runner/durable-timers.test.ts +200 -0
- package/src/runner/engine-executor.test.ts +464 -0
- package/src/runner/engine-executor.ts +491 -0
- package/src/runner/foreach-executor.ts +30 -12
- package/src/runner/llm-adapter.test.ts +282 -5
- package/src/runner/llm-adapter.ts +581 -8
- package/src/runner/llm-clarification.test.ts +79 -21
- package/src/runner/llm-errors.ts +83 -0
- package/src/runner/llm-executor.test.ts +258 -219
- package/src/runner/llm-executor.ts +226 -29
- package/src/runner/mcp-client.ts +70 -3
- package/src/runner/mcp-manager.test.ts +52 -52
- package/src/runner/mcp-manager.ts +12 -5
- package/src/runner/mcp-server.test.ts +117 -78
- package/src/runner/mcp-server.ts +13 -4
- package/src/runner/optimization-runner.ts +48 -31
- package/src/runner/reflexion.test.ts +1 -1
- package/src/runner/resource-pool.test.ts +113 -0
- package/src/runner/resource-pool.ts +164 -0
- package/src/runner/shell-executor.ts +130 -32
- package/src/runner/standard-tools-integration.test.ts +36 -36
- package/src/runner/standard-tools.test.ts +18 -0
- package/src/runner/standard-tools.ts +110 -37
- package/src/runner/step-executor.test.ts +176 -16
- package/src/runner/step-executor.ts +530 -86
- package/src/runner/stream-utils.test.ts +14 -0
- package/src/runner/subflow-outputs.test.ts +103 -0
- package/src/runner/test-harness.ts +161 -0
- package/src/runner/tool-integration.test.ts +73 -79
- package/src/runner/workflow-runner.test.ts +492 -15
- package/src/runner/workflow-runner.ts +1438 -79
- package/src/runner/workflow-subflows.test.ts +255 -0
- package/src/templates/agents/keystone-architect.md +17 -12
- package/src/templates/agents/tester.md +21 -0
- package/src/templates/child-rollback.yaml +11 -0
- package/src/templates/decompose-implement.yaml +53 -0
- package/src/templates/decompose-problem.yaml +159 -0
- package/src/templates/decompose-research.yaml +52 -0
- package/src/templates/decompose-review.yaml +51 -0
- package/src/templates/dev.yaml +134 -0
- package/src/templates/engine-example.yaml +33 -0
- package/src/templates/fan-out-fan-in.yaml +61 -0
- package/src/templates/memory-service.yaml +1 -1
- package/src/templates/parent-rollback.yaml +16 -0
- package/src/templates/robust-automation.yaml +1 -1
- package/src/templates/scaffold-feature.yaml +29 -27
- package/src/templates/scaffold-generate.yaml +41 -0
- package/src/templates/scaffold-plan.yaml +53 -0
- package/src/types/status.ts +3 -0
- package/src/ui/dashboard.tsx +4 -3
- package/src/utils/assets.macro.ts +36 -0
- package/src/utils/auth-manager.ts +585 -8
- package/src/utils/blueprint-utils.test.ts +49 -0
- package/src/utils/blueprint-utils.ts +80 -0
- package/src/utils/circuit-breaker.test.ts +177 -0
- package/src/utils/circuit-breaker.ts +160 -0
- package/src/utils/config-loader.test.ts +100 -13
- package/src/utils/config-loader.ts +44 -17
- package/src/utils/constants.ts +62 -0
- package/src/utils/error-renderer.test.ts +267 -0
- package/src/utils/error-renderer.ts +320 -0
- package/src/utils/json-parser.test.ts +4 -0
- package/src/utils/json-parser.ts +18 -1
- package/src/utils/mermaid.ts +4 -0
- package/src/utils/paths.test.ts +46 -0
- package/src/utils/paths.ts +70 -0
- package/src/utils/process-sandbox.test.ts +128 -0
- package/src/utils/process-sandbox.ts +293 -0
- package/src/utils/rate-limiter.test.ts +143 -0
- package/src/utils/rate-limiter.ts +221 -0
- package/src/utils/redactor.test.ts +23 -15
- package/src/utils/redactor.ts +65 -25
- package/src/utils/resource-loader.test.ts +54 -0
- package/src/utils/resource-loader.ts +158 -0
- package/src/utils/sandbox.test.ts +69 -4
- package/src/utils/sandbox.ts +69 -6
- package/src/utils/schema-validator.ts +65 -0
- package/src/utils/workflow-registry.test.ts +57 -0
- package/src/utils/workflow-registry.ts +45 -25
- /package/src/expression/{evaluator.audit.test.ts → evaluator-audit.test.ts} +0 -0
- /package/src/runner/{mcp-client.audit.test.ts → mcp-client-audit.test.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keystone-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A local-first, declarative, agentic workflow orchestrator built on Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@jsep-plugin/object": "^1.2.2",
|
|
28
28
|
"@types/react": "^19.0.0",
|
|
29
29
|
"@xenova/transformers": "^2.17.2",
|
|
30
|
+
"ajv": "^8.12.0",
|
|
30
31
|
"commander": "^12.1.0",
|
|
31
32
|
"dagre": "^0.8.5",
|
|
32
33
|
"ink": "^6.5.1",
|
|
@@ -34,16 +35,21 @@
|
|
|
34
35
|
"ink-spinner": "^5.0.0",
|
|
35
36
|
"js-yaml": "^4.1.0",
|
|
36
37
|
"jsep": "^1.4.0",
|
|
38
|
+
"glob": "^10.4.5",
|
|
37
39
|
"react": "^19.0.0",
|
|
38
40
|
"sqlite-vec": "0.1.6",
|
|
39
41
|
"zod": "^3.23.8"
|
|
40
42
|
},
|
|
43
|
+
"optionalDependencies": {
|
|
44
|
+
"re2": "^1.21.4"
|
|
45
|
+
},
|
|
41
46
|
"devDependencies": {
|
|
42
47
|
"@biomejs/biome": "^1.9.4",
|
|
43
48
|
"@types/bun": "^1.3.5",
|
|
44
49
|
"@types/dagre": "^0.7.53",
|
|
45
50
|
"@types/js-yaml": "^4.0.9",
|
|
46
|
-
"@types/node": "^25.0.3"
|
|
51
|
+
"@types/node": "^25.0.3",
|
|
52
|
+
"react-devtools-core": "^7.0.1"
|
|
47
53
|
},
|
|
48
54
|
"engines": {
|
|
49
55
|
"bun": ">=1.0.0"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test fixtures for Keystone CLI tests.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes mock agents, workflows, and configs to reduce duplication
|
|
5
|
+
* across test files.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mock agent content for test-agent.md
|
|
10
|
+
*/
|
|
11
|
+
export const TEST_AGENT_CONTENT = `---
|
|
12
|
+
name: test-agent
|
|
13
|
+
model: gpt-4
|
|
14
|
+
tools:
|
|
15
|
+
- name: test-tool
|
|
16
|
+
execution:
|
|
17
|
+
type: shell
|
|
18
|
+
run: echo "tool executed with \${{ args.val }}"
|
|
19
|
+
---
|
|
20
|
+
You are a test agent.`;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Mock agent without tools
|
|
24
|
+
*/
|
|
25
|
+
export const SIMPLE_AGENT_CONTENT = `---
|
|
26
|
+
name: simple-agent
|
|
27
|
+
model: gpt-4
|
|
28
|
+
---
|
|
29
|
+
You are a simple test agent.`;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Basic workflow fixture
|
|
33
|
+
*/
|
|
34
|
+
export const BASIC_WORKFLOW_CONTENT = `name: test-workflow
|
|
35
|
+
steps:
|
|
36
|
+
- id: step1
|
|
37
|
+
type: shell
|
|
38
|
+
run: echo "hello"
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Workflow with LLM step
|
|
43
|
+
*/
|
|
44
|
+
export const LLM_WORKFLOW_CONTENT = `name: llm-test-workflow
|
|
45
|
+
steps:
|
|
46
|
+
- id: ask
|
|
47
|
+
type: llm
|
|
48
|
+
agent: test-agent
|
|
49
|
+
prompt: "Test prompt"
|
|
50
|
+
maxIterations: 5
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Default test config
|
|
55
|
+
*/
|
|
56
|
+
export const TEST_CONFIG = {
|
|
57
|
+
providers: {
|
|
58
|
+
openai: { type: 'openai' as const, api_key_env: 'OPENAI_API_KEY' },
|
|
59
|
+
},
|
|
60
|
+
default_provider: 'openai',
|
|
61
|
+
model_mappings: {},
|
|
62
|
+
storage: { retention_days: 30, redact_secrets_at_rest: true },
|
|
63
|
+
mcp_servers: {},
|
|
64
|
+
engines: { allowlist: {}, denylist: [] },
|
|
65
|
+
concurrency: { default: 10, pools: { llm: 2, shell: 5, http: 10, engine: 2 } },
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Create a mock LLM response
|
|
70
|
+
*/
|
|
71
|
+
export function createMockLLMResponse(content: string) {
|
|
72
|
+
return {
|
|
73
|
+
message: { role: 'assistant' as const, content },
|
|
74
|
+
usage: { prompt_tokens: 10, completion_tokens: 10, total_tokens: 20 },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Create a mock tool call response
|
|
80
|
+
*/
|
|
81
|
+
export function createMockToolCallResponse(
|
|
82
|
+
toolName: string,
|
|
83
|
+
args: Record<string, unknown>,
|
|
84
|
+
callId = 'call-1'
|
|
85
|
+
) {
|
|
86
|
+
return {
|
|
87
|
+
message: {
|
|
88
|
+
role: 'assistant' as const,
|
|
89
|
+
content: null,
|
|
90
|
+
tool_calls: [
|
|
91
|
+
{
|
|
92
|
+
id: callId,
|
|
93
|
+
type: 'function' as const,
|
|
94
|
+
function: { name: toolName, arguments: JSON.stringify(args) },
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
usage: { prompt_tokens: 10, completion_tokens: 10, total_tokens: 20 },
|
|
99
|
+
};
|
|
100
|
+
}
|