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.
Files changed (103) hide show
  1. package/README.md +486 -54
  2. package/package.json +8 -2
  3. package/src/__fixtures__/index.ts +100 -0
  4. package/src/cli.ts +809 -90
  5. package/src/db/memory-db.ts +35 -1
  6. package/src/db/workflow-db.test.ts +24 -0
  7. package/src/db/workflow-db.ts +469 -14
  8. package/src/expression/evaluator.ts +68 -4
  9. package/src/parser/agent-parser.ts +6 -3
  10. package/src/parser/config-schema.ts +38 -2
  11. package/src/parser/schema.ts +192 -7
  12. package/src/parser/test-schema.ts +29 -0
  13. package/src/parser/workflow-parser.test.ts +54 -0
  14. package/src/parser/workflow-parser.ts +153 -7
  15. package/src/runner/aggregate-error.test.ts +57 -0
  16. package/src/runner/aggregate-error.ts +46 -0
  17. package/src/runner/audit-verification.test.ts +2 -2
  18. package/src/runner/auto-heal.test.ts +1 -1
  19. package/src/runner/blueprint-executor.test.ts +63 -0
  20. package/src/runner/blueprint-executor.ts +157 -0
  21. package/src/runner/concurrency-limit.test.ts +82 -0
  22. package/src/runner/debug-repl.ts +18 -3
  23. package/src/runner/durable-timers.test.ts +200 -0
  24. package/src/runner/engine-executor.test.ts +464 -0
  25. package/src/runner/engine-executor.ts +491 -0
  26. package/src/runner/foreach-executor.ts +30 -12
  27. package/src/runner/llm-adapter.test.ts +282 -5
  28. package/src/runner/llm-adapter.ts +581 -8
  29. package/src/runner/llm-clarification.test.ts +79 -21
  30. package/src/runner/llm-errors.ts +83 -0
  31. package/src/runner/llm-executor.test.ts +258 -219
  32. package/src/runner/llm-executor.ts +226 -29
  33. package/src/runner/mcp-client.ts +70 -3
  34. package/src/runner/mcp-manager.test.ts +52 -52
  35. package/src/runner/mcp-manager.ts +12 -5
  36. package/src/runner/mcp-server.test.ts +117 -78
  37. package/src/runner/mcp-server.ts +13 -4
  38. package/src/runner/optimization-runner.ts +48 -31
  39. package/src/runner/reflexion.test.ts +1 -1
  40. package/src/runner/resource-pool.test.ts +113 -0
  41. package/src/runner/resource-pool.ts +164 -0
  42. package/src/runner/shell-executor.ts +130 -32
  43. package/src/runner/standard-tools-integration.test.ts +36 -36
  44. package/src/runner/standard-tools.test.ts +18 -0
  45. package/src/runner/standard-tools.ts +110 -37
  46. package/src/runner/step-executor.test.ts +176 -16
  47. package/src/runner/step-executor.ts +530 -86
  48. package/src/runner/stream-utils.test.ts +14 -0
  49. package/src/runner/subflow-outputs.test.ts +103 -0
  50. package/src/runner/test-harness.ts +161 -0
  51. package/src/runner/tool-integration.test.ts +73 -79
  52. package/src/runner/workflow-runner.test.ts +492 -15
  53. package/src/runner/workflow-runner.ts +1438 -79
  54. package/src/runner/workflow-subflows.test.ts +255 -0
  55. package/src/templates/agents/keystone-architect.md +17 -12
  56. package/src/templates/agents/tester.md +21 -0
  57. package/src/templates/child-rollback.yaml +11 -0
  58. package/src/templates/decompose-implement.yaml +53 -0
  59. package/src/templates/decompose-problem.yaml +159 -0
  60. package/src/templates/decompose-research.yaml +52 -0
  61. package/src/templates/decompose-review.yaml +51 -0
  62. package/src/templates/dev.yaml +134 -0
  63. package/src/templates/engine-example.yaml +33 -0
  64. package/src/templates/fan-out-fan-in.yaml +61 -0
  65. package/src/templates/memory-service.yaml +1 -1
  66. package/src/templates/parent-rollback.yaml +16 -0
  67. package/src/templates/robust-automation.yaml +1 -1
  68. package/src/templates/scaffold-feature.yaml +29 -27
  69. package/src/templates/scaffold-generate.yaml +41 -0
  70. package/src/templates/scaffold-plan.yaml +53 -0
  71. package/src/types/status.ts +3 -0
  72. package/src/ui/dashboard.tsx +4 -3
  73. package/src/utils/assets.macro.ts +36 -0
  74. package/src/utils/auth-manager.ts +585 -8
  75. package/src/utils/blueprint-utils.test.ts +49 -0
  76. package/src/utils/blueprint-utils.ts +80 -0
  77. package/src/utils/circuit-breaker.test.ts +177 -0
  78. package/src/utils/circuit-breaker.ts +160 -0
  79. package/src/utils/config-loader.test.ts +100 -13
  80. package/src/utils/config-loader.ts +44 -17
  81. package/src/utils/constants.ts +62 -0
  82. package/src/utils/error-renderer.test.ts +267 -0
  83. package/src/utils/error-renderer.ts +320 -0
  84. package/src/utils/json-parser.test.ts +4 -0
  85. package/src/utils/json-parser.ts +18 -1
  86. package/src/utils/mermaid.ts +4 -0
  87. package/src/utils/paths.test.ts +46 -0
  88. package/src/utils/paths.ts +70 -0
  89. package/src/utils/process-sandbox.test.ts +128 -0
  90. package/src/utils/process-sandbox.ts +293 -0
  91. package/src/utils/rate-limiter.test.ts +143 -0
  92. package/src/utils/rate-limiter.ts +221 -0
  93. package/src/utils/redactor.test.ts +23 -15
  94. package/src/utils/redactor.ts +65 -25
  95. package/src/utils/resource-loader.test.ts +54 -0
  96. package/src/utils/resource-loader.ts +158 -0
  97. package/src/utils/sandbox.test.ts +69 -4
  98. package/src/utils/sandbox.ts +69 -6
  99. package/src/utils/schema-validator.ts +65 -0
  100. package/src/utils/workflow-registry.test.ts +57 -0
  101. package/src/utils/workflow-registry.ts +45 -25
  102. /package/src/expression/{evaluator.audit.test.ts → evaluator-audit.test.ts} +0 -0
  103. /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.8.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
+ }