@llmnative/runner 1.4.0 → 2.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.
@@ -2,10 +2,10 @@
2
2
  # Then, in the terminal of the service: node src/cli.ts pair
3
3
  services:
4
4
  runner:
5
- image: ghcr.io/sherpadvisorylab/llmnative-runner:1.4.0
5
+ image: ghcr.io/sherpadvisorylab/llmnative-runner:2.0.0
6
6
  restart: unless-stopped
7
7
  environment:
8
- AGENT_IMAGE: ghcr.io/sherpadvisorylab/llmnative-runner-agent:1.4.0
8
+ AGENT_IMAGE: ghcr.io/sherpadvisorylab/llmnative-runner-agent:2.0.0
9
9
  PUBLIC_URL: ${SERVICE_FQDN_RUNNER_8080}
10
10
  MAX_CHATS: ${MAX_CHATS:-6}
11
11
  volumes:
@@ -11,7 +11,7 @@
11
11
  # For a machine reading it, some lines are `NAME=value`: STEP=<phase>, RUNNER_URL=, PAIRING_CODE=, RUNNER_ERROR=.
12
12
  set -eu
13
13
 
14
- VERSION="1.4.0"
14
+ VERSION="2.0.0"
15
15
  DIR="/opt/llmnative-runner"
16
16
  DOMAIN=""
17
17
  MAX_CHATS=""
package/llms.txt CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  ## Model
6
6
  - Keys: admin token (machine, /data/admin-token: console, POST /v1/admin/pairing), platform key rk_platform_ (from POST /v1/pair with an 8-char code valid 15 min, once, or by device flow: POST /v1/pair/requests → {request, code, approveUrl}, the admin approves at /console/?approve=<code> (GET /v1/admin/pairing/requests, POST …/<code>/approve|deny), POST /v1/pair/requests/poll {request} → the key once; manages tenants and keys, acts for a tenant with X-Runner-Tenant), project key rk_ (one tenant; permissions complete, chat, chat:tools, accounts, accounts:tenant, act-as-user, keys). Stored as sha256 only.
7
+ - Tenants (2.0) are organizations, shared by the apps of a suite: a platform key paired for an app ({app} in /v1/pair, /v1/pair/requests) sees the tenants it made and those granted to it; making one another app made → 409 needs-grant {grant}, the admin answers (GET /v1/admin/grants, POST …/<id>/approve|deny; PUT|DELETE /v1/admin/tenants/<t>/platforms/<key>). X-Runner-App and X-Runner-Project label complete and chats in the log (never choose accounts). Before 2.0, keys of a project owned <project> and <project>-…; POST /v1/admin/migrate-tenants {apply?, map?} (CLI `node src/cli.ts migrate-tenants [--apply] [from=to]`) renames <app>-<org> → <org>, merges accounts of the same organization (same token once, order of the one there first), moves its keys and module data (RunnerModule.renameTenant), turns the keys of a project into keys of the app keeping what they saw.
7
8
  - Person: X-Runner-User (needs act-as-user with a project key). Accounts by scope: tenant (shared) or person (theirs only). A request runs with the person's accounts first, then the tenant's (ids u:<id>, t:<id>); out of credit = skipped until the reset (per tenant, file), the next one tried; none left: 409 no-credit with until, or chat event error "no-credit:<iso>".
8
9
  - Providers: claude-code (token from `claude setup-token`, signed in through POST /v1/accounts/claude-code/login then /login/code), opencode-go and opencode (keys). complete: claude-code | opencode-go.
9
10
  - Chats: POST /v1/chats {id: 8 hex, tools?} → container per chat; POST /v1/chats/<id>/messages → NDJSON ChatEvent (text, reasoning, step, tool-call, done, error, ping); tools of the client via MCP in the container, answered with POST /v1/chats/<id>/calls/<call>. A chat belongs to its person.
package/openapi/v1.yaml CHANGED
@@ -8,8 +8,11 @@ info:
8
8
  the admin token of the machine, a platform key (`rk_platform_…`, from pairing) or a project key of a tenant (`rk_…`).
9
9
  A platform key (or the admin token) names the tenant with `X-Runner-Tenant`. The person a request is for is
10
10
  `X-Runner-User` (with the permission `act-as-user` for a project key). Errors are `{ "error": "<code>" }`.
11
- A platform key paired with a `project` owns only the tenants `<project>` and `<project>-<tenant>`: any other is
12
- answered as missing (403 `outside project` when it tries to make one).
11
+ A tenant is an organization (2.0), shared by the apps that work for it. A platform key paired for an `app` sees the
12
+ tenants it made and those the admin granted it; making one another app made answers 409 `needs-grant` and leaves a
13
+ request the admin answers in the console. `X-Runner-App` and `X-Runner-Project` label a completion or a chat in the
14
+ log. Before 2.0 a platform key paired with a `project` owned only `<project>` and `<project>-<tenant>` (still
15
+ honoured until `POST /v1/admin/migrate-tenants`; 403 `outside project` when it tries to make another).
13
16
  Modules of the image (RUNNER_MODULES) serve `/v1/modules/<name>/…` for one tenant (a project key with the
14
17
  permission `modules`, or a platform key with `X-Runner-Tenant`) and `/hooks/<name>/…` in public.
15
18
  servers:
@@ -39,14 +42,15 @@ components:
39
42
  required: [provider, id, at, scope]
40
43
  Tenant:
41
44
  type: object
42
- properties: { id: { type: string }, name: { type: string }, createdAt: { type: string, format: date-time }, usersWithAccounts: { type: integer } }
45
+ properties: { id: { type: string }, name: { type: string }, createdAt: { type: string, format: date-time }, usersWithAccounts: { type: integer }, platforms: { type: array, items: { type: string }, description: 'The platform keys that see it (2.0): the one that made it and those granted' } }
43
46
  Key:
44
47
  type: object
45
48
  properties:
46
49
  id: { type: string }
47
50
  kind: { type: string, enum: [platform, project] }
48
51
  tenant: { type: string }
49
- project: { type: string, description: 'Platform keys: the project whose tenants it owns (<project>, <project>-…); none, every tenant' }
52
+ app: { type: string, description: 'Platform keys (2.0): the app it is for; it sees the tenants it made or was granted' }
53
+ project: { type: string, description: 'Platform keys before 2.0: the project whose tenants it owns (<project>, <project>-…); with neither, every tenant' }
50
54
  name: { type: string }
51
55
  permissions: { type: array, items: { type: string, enum: [complete, chat, 'chat:tools', accounts, 'accounts:tenant', act-as-user, keys, modules] } }
52
56
  createdAt: { type: string, format: date-time }
@@ -73,7 +77,7 @@ paths:
73
77
  post:
74
78
  security: []
75
79
  summary: A pairing code (printed by the installer) gives a platform key, shown once
76
- requestBody: { content: { application/json: { schema: { type: object, properties: { code: { type: string }, name: { type: string }, project: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'The project the platform key owns the tenants of (<project>, <project>-…); none, every tenant' } }, required: [code] } } } }
80
+ requestBody: { content: { application/json: { schema: { type: object, properties: { code: { type: string }, name: { type: string }, app: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'The app the platform key is for (2.0)' }, project: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'Before 2.0: the project the platform key owns the tenants of (<project>, <project>-…)' } }, required: [code] } } } }
77
81
  responses:
78
82
  '200': { description: The key, content: { application/json: { schema: { type: object, properties: { key: { type: string }, record: { $ref: '#/components/schemas/Key' }, version: { type: string } } } } } }
79
83
  '401': { description: bad code }
@@ -82,7 +86,7 @@ paths:
82
86
  post:
83
87
  security: []
84
88
  summary: A platform asks to connect (device flow); the admin approves it in the console at approveUrl
85
- requestBody: { content: { application/json: { schema: { type: object, properties: { name: { type: string }, project: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'The project the platform key owns the tenants of (<project>, <project>-…); none, every tenant' } } } } } }
89
+ requestBody: { content: { application/json: { schema: { type: object, properties: { name: { type: string }, app: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'The app the platform key is for (2.0)' }, project: { type: string, pattern: '^[a-z0-9]{1,32}$', description: 'Before 2.0: the project the platform key owns the tenants of' } } } } } }
86
90
  responses:
87
91
  '201': { description: '{ request (secret of the platform), code (shown on both sides), approveUrl, expiresAt, interval }' }
88
92
  '429': { description: busy (too many requests waiting) }
@@ -96,10 +100,35 @@ paths:
96
100
  /v1/admin/pairing/requests:
97
101
  get:
98
102
  summary: (admin token) The pairing requests waiting
99
- responses: { '200': { description: '{ requests: [{ code, name, project?, from?, createdAt, expiresAt }] }' } }
103
+ responses: { '200': { description: '{ requests: [{ code, name, app?, project?, from?, createdAt, expiresAt }] }' } }
104
+ /v1/admin/grants:
105
+ get:
106
+ summary: (admin token) The apps waiting for an organization another app made
107
+ responses: { '200': { description: '{ grants: [{ id, tenant, key, keyName, app?, createdAt }] }' } }
108
+ /v1/admin/grants/{grant}/{answer}:
109
+ post:
110
+ summary: (admin token) Grants the organization to the app, or refuses
111
+ parameters:
112
+ - { name: grant, in: path, required: true, schema: { type: string } }
113
+ - { name: answer, in: path, required: true, schema: { type: string, enum: [approve, deny] } }
114
+ responses: { '200': { description: '{ grant }' }, '404': { description: no such request } }
115
+ /v1/admin/tenants/{tenant}/platforms/{key}:
116
+ put:
117
+ summary: (admin token) A platform key sees the tenant
118
+ parameters: [{ name: tenant, in: path, required: true, schema: { type: string } }, { name: key, in: path, required: true, schema: { type: string } }]
119
+ responses: { '200': { description: '{ tenant }' }, '404': { description: not found } }
120
+ delete:
121
+ summary: (admin token) A platform key no longer sees the tenant
122
+ parameters: [{ name: tenant, in: path, required: true, schema: { type: string } }, { name: key, in: path, required: true, schema: { type: string } }]
123
+ responses: { '200': { description: '{ tenant }' }, '404': { description: not found } }
124
+ /v1/admin/migrate-tenants:
125
+ post:
126
+ summary: (admin token) 2.0 migration of the tenants, `<app>-<org>` → `<org>` (accounts merged when the organization is there); a dry run unless apply
127
+ requestBody: { content: { application/json: { schema: { type: object, properties: { apply: { type: boolean }, map: { type: object, additionalProperties: { type: string }, description: 'Other names, e.g. { "crm": "consuletica" } for the tenant of the app itself' } } } } } }
128
+ responses: { '200': { description: '{ applied, moves: [{ from, to, merge, platforms }], skipped: [{ tenant, reason }], keys }' } }
100
129
  /v1/admin/keys/{key}/project:
101
130
  put:
102
- summary: (admin token) The project of a platform key; null, every tenant (as keys made before 1.2)
131
+ summary: (admin token) The project of a platform key before 2.0; null, every tenant (as keys made before 1.2)
103
132
  parameters: [{ name: key, in: path, required: true, schema: { type: string } }]
104
133
  requestBody: { content: { application/json: { schema: { type: object, properties: { project: { type: [string, 'null'] } }, required: [project] } } } }
105
134
  responses: { '200': { description: '{ record }' }, '400': { description: invalid project }, '404': { description: not found } }
@@ -125,7 +154,7 @@ paths:
125
154
  post:
126
155
  summary: (platform) A tenant, with its first project key unless key is false
127
156
  requestBody: { content: { application/json: { schema: { type: object, properties: { id: { type: string }, name: { type: string }, key: { type: boolean }, keyPermissions: { type: array, items: { type: string } } }, required: [id] } } } }
128
- responses: { '201': { description: '{ tenant, key?, keyRecord? }' }, '409': { description: exists } }
157
+ responses: { '201': { description: '{ tenant, key?, keyRecord? }' }, '409': { description: 'exists, or needs-grant { grant } when another app made it' } }
129
158
  /v1/platform/tenants/{tenant}:
130
159
  delete:
131
160
  summary: (platform) Removes a tenant, its keys and chats
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmnative/runner",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "description": "LLMNative Runner: Claude Code and opencode on your own VPS, for many tenants, with subscriptions per person. Client, management UI and installer of the runner.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "packageManager": "npm@11.11.0",
76
76
  "peerDependencies": {
77
- "@llmnative/react": "^3.2.0",
77
+ "@llmnative/react": "^3.22.0",
78
78
  "react": "^19.2.0",
79
79
  "react-dom": "^19.2.0"
80
80
  },
@@ -93,7 +93,7 @@
93
93
  "ssh2": "^1.16.0"
94
94
  },
95
95
  "devDependencies": {
96
- "@llmnative/react": "^3.2.0",
96
+ "@llmnative/react": "^3.22.0",
97
97
  "@phosphor-icons/react": "^2.1.10",
98
98
  "@supabase/supabase-js": "^2.119.0",
99
99
  "@testing-library/jest-dom": "^7.0.1",