@appsforgood/agent-kit-runtime 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # @appsforgood/agent-kit-runtime
2
+
3
+ ## 0.1.0
4
+
5
+ - Add the optional local LangGraph runtime with SQLite checkpoints, provider and MCP adapters, risk-tiered approvals, Docker-isolated mutations, Git worktrees, redacted evidence, CLI commands, and Agent Studio integration.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Skills Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # Agent Kit Runtime
2
+
3
+ Optional local execution runtime for `@appsforgood/next-supabase-kit`. It compiles validated council workflows into bounded LangGraph runs, persists SQLite checkpoints, brokers provider and MCP tools through explicit policy, and confines mutation-capable work to isolated Git worktrees.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save-dev @appsforgood/next-supabase-kit @appsforgood/agent-kit-runtime
9
+ agent-kit orchestrate validate
10
+ ```
11
+
12
+ The baseline kit works without this package. Fresh installs include a disabled `.agent-kit/orchestrator.json`; enabling it requires at least one valid provider, model alias, and default alias.
13
+
14
+ ## Configure
15
+
16
+ Provider credentials are references, never values:
17
+
18
+ ```json
19
+ {
20
+ "schemaVersion": 1,
21
+ "enabled": true,
22
+ "defaultWorkflow": "planning",
23
+ "defaultAlias": "balanced",
24
+ "providers": {
25
+ "primary": {
26
+ "kind": "openai",
27
+ "credentialRef": "env:OPENAI_API_KEY"
28
+ },
29
+ "fallback": {
30
+ "kind": "anthropic",
31
+ "credentialRef": "keychain:team-anthropic"
32
+ }
33
+ },
34
+ "modelAliases": {
35
+ "balanced": {
36
+ "requiredCapabilities": ["text", "tools"],
37
+ "maxAttempts": 2,
38
+ "candidates": [
39
+ { "provider": "primary", "model": "replace-with-verified-provider-model-id" },
40
+ { "provider": "fallback", "model": "replace-with-verified-provider-model-id" }
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ Use model IDs verified for the project’s current provider account. The runtime does not invent, upgrade, or silently substitute model names. Candidates are attempted in order; capability mismatches are skipped and provider failures are recorded.
48
+
49
+ Supported provider kinds: `openai`, `anthropic`, `gemini`, `xai`, `deepseek`, `kimi`, `glm`, `openrouter`, `ollama`, `lm-studio`, `vllm`, and `openai-compatible`.
50
+
51
+ Credential commands accept keychain references only. Values come from a masked prompt or stdin, never a CLI flag:
52
+
53
+ ```bash
54
+ agent-kit credential set keychain:team-openai
55
+ agent-kit credential delete keychain:team-openai
56
+ ```
57
+
58
+ ## Run
59
+
60
+ ```bash
61
+ agent-kit orchestrate plan "Implement the approved change" --workflow core-change
62
+ agent-kit orchestrate run "Implement the approved change" --workflow core-change
63
+ agent-kit orchestrate approve <run-id>
64
+ agent-kit orchestrate resume <run-id> --decision approve
65
+ agent-kit orchestrate status <run-id>
66
+ agent-kit orchestrate export <run-id> --output .agent-kit/runtime-export.md
67
+ ```
68
+
69
+ The runtime pauses at applicable plan, network, worktree-write, host-execution, and final-commit gates. Approval IDs are deterministic per run gate and survive process restarts through SQLite checkpoints.
70
+
71
+ If the source checkout is dirty, `run` fails unless `--acknowledge-dirty-base` is supplied. Dirty changes are never copied into the worktree.
72
+
73
+ ## Isolation
74
+
75
+ - Mutation commands run in Docker by default.
76
+ - The configured image tag must already exist locally and is resolved to an immutable image ID before execution.
77
+ - Containers use a read-only root, dropped Linux capabilities, `no-new-privileges`, PID/CPU/memory limits, bounded output/time, and no network by default.
78
+ - File tools reject absolute paths, traversal, symlink escapes, Git internals, environment files, private keys, package-manager credentials, and runtime evidence paths.
79
+ - Tracked sensitive filenames block worktree creation.
80
+ - One approved scoped commit may be created on branch `agent-kit/<run-id>`.
81
+ - The runtime never merges, pushes, opens a pull request, deploys, or applies a migration automatically.
82
+
83
+ SQLite uses the `better-sqlite3` native addon. This repository pins install-script approval to the reviewed addon and build-tool versions; downstream supply-chain policy must permit the matching reviewed native installation.
84
+
85
+ ## MCP
86
+
87
+ Remote Streamable HTTP servers require explicit host and tool allowlists. HTTPS is required except for literal loopback, redirects are rejected, and DNS results are checked for private or special-use addresses unless `allowPrivateNetwork` is explicitly enabled.
88
+
89
+ Stdio MCP servers are host processes. They are disabled unless `allowHostExecution` and global `sandbox.allowHostMutations` are both true; each run then pauses at the host-execution gate. Commands use argv spawning with a minimal inherited environment and credential references.
90
+
91
+ ```bash
92
+ agent-kit mcp probe <server-name>
93
+ ```
94
+
95
+ MCP annotations inform risk classification but do not grant authorization. Empty `allowedTools` means no tools are exposed.
96
+
97
+ ## Cursor Executor
98
+
99
+ Provider-backed model agents are the default. To route a roster agent through Cursor CLI, set `agentExecutors.<agent-id>` to `cursor`, enable `cursor.enabled`, enable `sandbox.allowHostMutations`, and approve the run’s host gate. Cursor runs with argv spawning, no shell, minimal environment, bounded output/time, and the isolated worktree as its working directory.
100
+
101
+ ## Studio And Evidence
102
+
103
+ `agent-kit studio serve` adds a Runs tab for starting runs, reading status/events, approving or rejecting gates, and cancelling local work.
104
+
105
+ - Checkpoints: `.agent-kit/runtime/runtime.sqlite`
106
+ - Run record: `.agent-kit/runtime/runs/<run-id>/run.json`
107
+ - Redacted event log: `.agent-kit/runtime/runs/<run-id>/events.jsonl`
108
+ - Worktree: platform cache under `agent-kit/worktrees/`
109
+
110
+ Runtime files are ignored by Git. Evidence redaction covers provider keys, bearer tokens, credential assignments, database URLs, private keys, and nested structured values. Do not treat redaction as permission to put customer data or secrets in prompts.
111
+
112
+ ## Probes And Recovery
113
+
114
+ ```bash
115
+ agent-kit provider probe [provider-id]
116
+ agent-kit mcp probe <server-name>
117
+ agent-kit orchestrate cancel <run-id>
118
+ ```
119
+
120
+ Provider and MCP probes are explicit external operations. A rejected gate cancels the run. A failed run preserves its checkpoint, evidence, worktree, and branch for inspection. Remove or merge worktrees manually after reviewing the scoped commit; Agent Kit does not perform that final repository operation.