184 lines
4.2 KiB
JSON
184 lines
4.2 KiB
JSON
{
|
|
"module": "claude-licence-manager",
|
|
"version": "1",
|
|
"slug": "licmgr",
|
|
"requires": [
|
|
"postgres-database",
|
|
"secret"
|
|
],
|
|
"contributes": {
|
|
"postgres-database": {
|
|
"name": "claude_licences",
|
|
"readable": [
|
|
"audit",
|
|
"binding"
|
|
]
|
|
}
|
|
},
|
|
"binds": {
|
|
"postgres-database": "${dir:state}/database.json"
|
|
},
|
|
"secrets": {
|
|
"postgres-database": "${dir:state}/database.secret",
|
|
"secret": {
|
|
"grant-key": "${dir:state}/grant.key"
|
|
}
|
|
},
|
|
"seats": [
|
|
{
|
|
"name": "anthropic-licence-manager",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"licences",
|
|
"bindings",
|
|
"bind",
|
|
"switch",
|
|
"release",
|
|
"refresh",
|
|
"usage",
|
|
"adopt",
|
|
"current",
|
|
"public-key"
|
|
]
|
|
}
|
|
],
|
|
"claims": [
|
|
{
|
|
"name": "anthropic-licence-manager",
|
|
"scope": "mesh",
|
|
"serves": [
|
|
"licences",
|
|
"bindings",
|
|
"bind",
|
|
"switch",
|
|
"release",
|
|
"refresh",
|
|
"usage",
|
|
"adopt",
|
|
"current",
|
|
"public-key"
|
|
]
|
|
}
|
|
],
|
|
"emits": [
|
|
"licence.adopted",
|
|
"licence.refused",
|
|
"licence.bound",
|
|
"licence.switched",
|
|
"licence.released",
|
|
"licence.rotated",
|
|
"licence.failing",
|
|
"usage.read"
|
|
],
|
|
"state": [
|
|
"bindings"
|
|
],
|
|
"reads": [
|
|
"claude-code.holdings"
|
|
],
|
|
"config": {
|
|
"cadence_minutes": {
|
|
"type": "number",
|
|
"description": "How old a licence's grant may grow before it is rotated, in minutes; 0 keeps 240.",
|
|
"minimum": 0,
|
|
"trusted": true,
|
|
"default": 240
|
|
},
|
|
"floor_minutes": {
|
|
"type": "number",
|
|
"description": "How little time a grant may have left before it is refreshed in any case, in minutes; 0 keeps 60.",
|
|
"minimum": 0,
|
|
"trusted": true,
|
|
"default": 60
|
|
},
|
|
"failures_to_notify": {
|
|
"type": "number",
|
|
"description": "How many refreshes of a licence fail in a row before the operator is told, a count; 0 keeps 3.",
|
|
"minimum": 0,
|
|
"trusted": true,
|
|
"default": 3
|
|
},
|
|
"cooldown_hours": {
|
|
"type": "number",
|
|
"description": "How long after telling the operator about a licence nothing more is said about it, in hours; 0 keeps 24.",
|
|
"minimum": 0,
|
|
"trusted": true,
|
|
"default": 24
|
|
},
|
|
"refresh_warn_days": {
|
|
"type": "number",
|
|
"description": "How long before a licence's refresh token itself expires the operator is warned, in days; 0 keeps 3.",
|
|
"minimum": 0,
|
|
"trusted": true,
|
|
"default": 3
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "database-url",
|
|
"type": "file",
|
|
"path": "${dir:state}/database.url",
|
|
"mode": "0600",
|
|
"template": "files/database.url"
|
|
},
|
|
{
|
|
"id": "settings",
|
|
"type": "file",
|
|
"path": "${dir:state}/settings.json",
|
|
"mode": "0600",
|
|
"takes-config": ["cadence_minutes", "floor_minutes", "failures_to_notify", "cooldown_hours", "refresh_warn_days"],
|
|
"merge": "json",
|
|
"template": "files/settings.json"
|
|
},
|
|
{
|
|
"id": "prepare",
|
|
"type": "process",
|
|
"name": "claude-licence-manager-prepare",
|
|
"artifact": "code",
|
|
"run": [
|
|
"./claude-licence-manager",
|
|
"prepare"
|
|
],
|
|
"run-once": true,
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url"
|
|
},
|
|
"restart-on": [
|
|
"database-url"
|
|
]
|
|
}
|
|
],
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "code",
|
|
"kind": "bundle",
|
|
"language": "go",
|
|
"system": "arch",
|
|
"from": "cmd/claude-licence-manager",
|
|
"binary": "claude-licence-manager",
|
|
"loads": [
|
|
"claude-licence-manager"
|
|
],
|
|
"env": {
|
|
"DATABASE_URL_FILE": "${dir:state}/database.url",
|
|
"MESH_LICENCE_STATE": "${dir:state}",
|
|
"MESH_LICENCE_KEY_FILE": "${dir:state}/grant.key",
|
|
"MESH_LICENCE_SETTINGS": "${dir:state}/settings.json"
|
|
}
|
|
},
|
|
{
|
|
"name": "files",
|
|
"kind": "archive",
|
|
"from": "files"
|
|
}
|
|
]
|
|
}
|
|
}
|