@grackle-ai/runtime-claude-code 0.108.3 → 0.110.1

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 (2) hide show
  1. package/README.md +51 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @grackle-ai/runtime-claude-code
2
+
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/@grackle-ai/runtime-claude-code"><img src="https://img.shields.io/npm/v/@grackle-ai/runtime-claude-code.svg" alt="npm version" /></a>
5
+ <a href="https://github.com/nick-pape/grackle/actions/workflows/ci.yml"><img src="https://github.com/nick-pape/grackle/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" /></a>
6
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <img src="https://raw.githubusercontent.com/nick-pape/grackle/main/apps/docs-site/static/img/grackle-logo.png" alt="Grackle" width="200" />
11
+ </p>
12
+
13
+ Grackle runtime that drives Anthropic's Claude Code agent via the Claude Agent SDK.
14
+
15
+ ## Overview
16
+
17
+ This package implements the `@grackle-ai/runtime-sdk` `AgentRuntime` interface for Claude Code. It exports `ClaudeCodeRuntime`, which extends `BaseAgentRuntime` and is registered with the PowerLine process under the runtime name `claude-code`. When a session is spawned, the runtime drives a Claude Code conversation through the [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) `query()` API, maps the SDK's streaming messages onto Grackle `AgentEvent`s (text, tool use, tool results, system, errors, usage), and reports token/cost usage back to the server.
18
+
19
+ The Claude Agent SDK is **not** a direct dependency. It is installed lazily at spawn time into an isolated per-runtime directory and imported dynamically (falling back to the legacy `@anthropic-ai/claude-code` package if present), so the package stays lightweight until a Claude Code session actually runs.
20
+
21
+ ## Models
22
+
23
+ The model is chosen per session — Grackle passes the model selected for the task (via the spawn request) straight through to the SDK as the `model` option. This package does not hardcode or restrict the model list; any model the installed Claude Agent SDK accepts can be used.
24
+
25
+ ## Credentials
26
+
27
+ The runtime authenticates using whatever credentials the Claude Agent SDK finds in its environment. Either path works:
28
+
29
+ | Credential | How it's provided | Notes |
30
+ |------------|-------------------|-------|
31
+ | Anthropic API key | `ANTHROPIC_API_KEY` environment variable | Console / pay-per-use access |
32
+ | Claude subscription | `~/.claude/.credentials.json` (OAuth file) | Generated by signing in with the Claude Code CLI |
33
+
34
+ Grackle delivers the credential to the PowerLine at task start, so nothing needs to be baked into the environment ahead of time. If `~/.claude` is read-only (common with bind-mounted host config in Docker), the runtime redirects session storage to a writable fallback directory and copies the credential/settings files so multi-turn conversations can still resume.
35
+
36
+ ## Behavior
37
+
38
+ - **Persistent process mode** — keeps a single `query()` alive across turns using the SDK's async-iterable prompt mode, falling back to resume-per-input when persistence is unavailable.
39
+ - **Tools** — enables Claude Code's built-in tools (Bash, Read, Write, Edit, Glob, Grep, WebSearch, WebFetch, Task, Agent, NotebookEdit) and any MCP servers configured for the session, including the injected Grackle MCP server.
40
+ - **Usage tracking** — converts the SDK's cumulative token and cost totals into per-turn deltas before reporting them.
41
+ - **System context** — injected via the SDK-native `systemPrompt` (appended to Claude Code's built-in prompt), and caller-supplied hooks (e.g. Stop hooks) are passed through unchanged.
42
+
43
+ ## Requirements
44
+
45
+ - Node.js >= 22
46
+ - `@anthropic-ai/claude-agent-sdk` (installed automatically at spawn time)
47
+ - An Anthropic API key (`ANTHROPIC_API_KEY`) **or** Claude subscription credentials (`~/.claude/.credentials.json`)
48
+
49
+ ## License
50
+
51
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/runtime-claude-code",
3
- "version": "0.108.3",
3
+ "version": "0.110.1",
4
4
  "description": "Grackle Claude Code runtime implementation",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "dist/"
29
29
  ],
30
30
  "dependencies": {
31
- "@grackle-ai/common": "0.108.3",
32
- "@grackle-ai/runtime-sdk": "0.108.3"
31
+ "@grackle-ai/common": "0.110.1",
32
+ "@grackle-ai/runtime-sdk": "0.110.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@rushstack/heft": "1.2.7",