Phase C of vendor-agnostic model-access (ADR 0050/0054). Two TypeScript runtime modules: - anthropic-manager: the refresh token is sealed at rest to the manager node's own key (atrest.ts, envelope encryption over X25519) and opened ONLY on the manager node. adopt seals the first envelope; refresh opens it, calls the Anthropic OAuth token endpoint, re-seals a rotated refresh token, and hands the control plane only the access token plus the opaque envelope. Also polls licence-grain usage (ADR 0054). - anthropic-consumer: writes the delivered access token to ~/.claude/.credentials.json, access-token-only, atomically (the refresh token is never delivered); reports session-grain usage from the CLI transcripts; a fail-closed identity guard (expected-uuid plumbing is a flagged TODO). Both run as scheduled containers (ADR 0053). Pure logic covered by node --test fixtures (at-rest round-trip, credential strip, transcript sum, refresh merge). Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
92 lines
2.5 KiB
JSON
92 lines
2.5 KiB
JSON
{
|
|
"module": "anthropic-consumer",
|
|
"version": "1",
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"requires": [
|
|
"model-access"
|
|
],
|
|
"binds": {
|
|
"model-access": "/var/lib/anthropic-consumer/model.json"
|
|
},
|
|
"secrets": {
|
|
"model-access": "/var/lib/anthropic-consumer/access-token"
|
|
},
|
|
"own-secrets": {
|
|
"broker": "/var/lib/mesh/anthropic-consumer/broker"
|
|
},
|
|
"emits": [
|
|
"module.anthropic-consumer.usage.session"
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "mesh-state",
|
|
"type": "directory",
|
|
"path": "/var/lib/mesh/anthropic-consumer",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"path": "/var/lib/anthropic-consumer",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "claude-home",
|
|
"type": "directory",
|
|
"path": "/var/lib/anthropic-consumer/claude",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "out",
|
|
"type": "directory",
|
|
"path": "/var/lib/anthropic-consumer/out",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "apply",
|
|
"type": "container",
|
|
"name": "mesh-anthropic-consumer-apply",
|
|
"image": "mesh-runtime-anthropic-consumer@sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
"network": "host",
|
|
"schedule": "*/5 * * * *",
|
|
"args": [
|
|
"run",
|
|
"/app/modules/anthropic-consumer/dist/apply/index.js"
|
|
],
|
|
"volumes": [
|
|
"/var/lib/anthropic-consumer:/run/state"
|
|
],
|
|
"env": {
|
|
"MESH_MODEL_ACCESS_SECRET_FILE": "/run/state/access-token",
|
|
"MESH_MODEL_ACCESS_BIND_FILE": "/run/state/model.json",
|
|
"MESH_CLAUDE_CREDENTIALS_FILE": "/run/state/claude/.credentials.json",
|
|
"MESH_CLAUDE_IDENTITY_FILE": "/run/state/claude/.claude.json"
|
|
}
|
|
},
|
|
{
|
|
"id": "usage",
|
|
"type": "container",
|
|
"name": "mesh-anthropic-consumer-usage",
|
|
"image": "mesh-runtime-anthropic-consumer@sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
"network": "host",
|
|
"schedule": "*/5 * * * *",
|
|
"args": [
|
|
"run",
|
|
"/app/modules/anthropic-consumer/dist/usage/index.js"
|
|
],
|
|
"volumes": [
|
|
"/var/lib/mesh/anthropic-consumer/broker:/run/secrets/broker:ro",
|
|
"/var/lib/anthropic-consumer:/run/state"
|
|
],
|
|
"env": {
|
|
"MESH_BROKER_FILE": "/run/secrets/broker",
|
|
"MESH_CLAUDE_PROJECTS_DIR": "/run/state/claude/projects",
|
|
"MESH_ANTHROPIC_USAGE_OUT": "/run/state/out/session-usage.json",
|
|
"MESH_TOOLS_MAIN": "/app/dist/main.js"
|
|
}
|
|
}
|
|
]
|
|
}
|