diff --git a/bun.lock b/bun.lock index 3274f42..045a6c1 100644 --- a/bun.lock +++ b/bun.lock @@ -19,8 +19,8 @@ "name": "@cortexkit/claustrum-auth-core", "version": "0.0.0", "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0", }, @@ -32,8 +32,8 @@ "claustrum-auth": "./dist/setup-bin.js", }, "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0", }, @@ -53,8 +53,8 @@ "name": "@cortexkit/pi-claustrum-auth", "version": "0.2.0", "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0", }, @@ -152,9 +152,9 @@ "@cortexkit/claustrum-auth-core": ["@cortexkit/claustrum-auth-core@workspace:packages/core"], - "@cortexkit/claustrum-client": ["@cortexkit/claustrum-client@0.16.0", "", { "dependencies": { "@cortexkit/store": "^0.2.3", "@cortexkit/subc-client": "^0.24.0" } }, "sha512-K2iY0j0pJscnmjs3Z5cXxL2sJPuAuf/EnaYM1/6CCmMGgenibp8yaaPu0ijxOztWxxyJwtzIrHCdVKtzMtdmSw=="], + "@cortexkit/claustrum-client": ["@cortexkit/claustrum-client@0.17.0", "", { "dependencies": { "@cortexkit/store": "^0.2.3", "@cortexkit/subc-client": "^0.24.0" } }, "sha512-8PF7fI8pnRyZWgLpzO8zeywc3dGaYYDIhU3ztrJtfwDkw+dq9o2UQtCaoHo776d2aHo+JPZXFfN+7E2VaG75vw=="], - "@cortexkit/common-auth": ["@cortexkit/common-auth@0.41.1", "", { "dependencies": { "@cortexkit/private-files": "^0.2.2", "jsonc-parser": "^3.3.1" }, "peerDependencies": { "@cortexkit/claustrum-client": ">=0.6.2", "@cortexkit/subc-client": "^0.16.0 || ^0.22.0 || ^0.24.0", "@opencode/plugin": ">=2.0.21", "@opentui/core": ">=0.4.5", "@opentui/solid": ">=0.4.5", "solid-js": ">=1.9.12 <2" }, "optionalPeers": ["@cortexkit/claustrum-client", "@cortexkit/subc-client", "@opencode/plugin", "@opentui/core", "@opentui/solid", "solid-js"] }, "sha512-P8yBv4Chqr9lAqbs3ndCFfDy5gWKnnqrNg7hcuJE3Tc60sbk9gji64IXyze2casSgLR3LVFC4kml5jJORJlg2A=="], + "@cortexkit/common-auth": ["@cortexkit/common-auth@0.43.0", "", { "dependencies": { "@cortexkit/private-files": "^0.2.2", "jsonc-parser": "^3.3.1" }, "peerDependencies": { "@cortexkit/claustrum-client": ">=0.6.2", "@cortexkit/opencode-sidebar": "~0.1.0", "@cortexkit/subc-client": "^0.16.0 || ^0.22.0 || ^0.24.0", "@opencode/plugin": ">=2.0.21", "@opentui/core": ">=0.4.5", "@opentui/solid": ">=0.4.5", "solid-js": ">=1.9.12 <2" }, "optionalPeers": ["@cortexkit/claustrum-client", "@cortexkit/opencode-sidebar", "@cortexkit/subc-client", "@opencode/plugin", "@opentui/core", "@opentui/solid", "solid-js"] }, "sha512-J0vA1VHliTdDhBghn/G5oR6oRcm5sA0ScL/6ghwqMEsQjlSZ5K8q40vYVbW15gZcw69hcmVuA6Gbq1/26yKR4A=="], "@cortexkit/opencode-claustrum-auth": ["@cortexkit/opencode-claustrum-auth@workspace:packages/opencode"], diff --git a/docs/setup.md b/docs/setup.md index 2ca2891..c2e047a 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -38,7 +38,9 @@ Vault mode is always on. `--claustrum` is accepted for compatibility; ## Approve enrollment and grant access -Approve each host's separate enrollment in `ck auth`. Setup prints the exact +Approve each host's separate enrollment in `ck auth`. The apps show +"Model API keys for OpenCode" or "Model API keys for Pi" when you approve the +connection. Setup prints the exact approval and grant commands and the resolved state paths. Enrollment alone does not grant credential access: follow the printed grant command for the `llm-provider` category before activating a provider. diff --git a/packages/core/package.json b/packages/core/package.json index 10d7d79..53f6165 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -12,8 +12,8 @@ "test": "bun test" }, "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0" } diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 859608f..811c138 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -33,8 +33,8 @@ "test": "bun test" }, "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0" }, diff --git a/packages/opencode/src/setup.ts b/packages/opencode/src/setup.ts index 868ebd7..da1a613 100644 --- a/packages/opencode/src/setup.ts +++ b/packages/opencode/src/setup.ts @@ -103,9 +103,14 @@ export async function runClaustrumSetup( hosts: { opencode: { name: opencodeEnrollment, + displayName: 'Model API keys for OpenCode', paths: { stateDir: states.opencode, host: 'opencode' }, }, - pi: { name: piEnrollment, paths: { stateDir: '', host: 'pi' } }, + pi: { + name: piEnrollment, + displayName: 'Model API keys for Pi', + paths: { stateDir: '', host: 'pi' }, + }, }, }, beforeSignIn: async (host, context) => { diff --git a/packages/opencode/test/setup-harness.ts b/packages/opencode/test/setup-harness.ts index 4fccd31..c4e2e2d 100644 --- a/packages/opencode/test/setup-harness.ts +++ b/packages/opencode/test/setup-harness.ts @@ -1,6 +1,7 @@ import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs' import path from 'node:path' import { Readable, Writable } from 'node:stream' +import type { ClaustrumEnrollmentClient } from '@cortexkit/common-auth/claustrum' import type { SetupIO } from '@cortexkit/common-auth/setup' import { bundleOptions } from '../../../scripts/build-options.ts' import type { runFixtureSetup } from '../setup-test-entry.ts' @@ -67,6 +68,9 @@ export function setupIO( PATH: bin, } const proposals: string[] = [] + const proposalInputs: Parameters< + ClaustrumEnrollmentClient['enrollPropose'] + >[0][] = [] const commands: { file: string; args: readonly string[] }[] = [] let output = '' const isLauncher = (file: string) => @@ -120,7 +124,9 @@ export function setupIO( }, }, connect: async () => ({ - async enrollPropose({ name }) { + async enrollPropose(input) { + proposalInputs.push(input) + const { name } = input proposals.push(name) return { requestId: name } }, @@ -135,5 +141,5 @@ export function setupIO( close() {}, }), } - return { io, env, proposals, commands, output: () => output } + return { io, env, proposals, proposalInputs, commands, output: () => output } } diff --git a/packages/opencode/test/setup.test.ts b/packages/opencode/test/setup.test.ts index 3901acd..2b2c8ca 100644 --- a/packages/opencode/test/setup.test.ts +++ b/packages/opencode/test/setup.test.ts @@ -298,6 +298,27 @@ test('test setup build enrolls once per host, discovers rows, prints provider ac ) }) +test('setup proposes a person-facing display name for each vault host', async () => { + const root = await profile() + const h = setupIO(root) + await runClaustrumSetup( + ['setup', '--yes', '--enroll-only', '--host=opencode', '--host=pi'], + h.io, + ) + expect(h.proposalInputs).toEqual([ + { + name: 'claustrum-auth-opencode', + displayName: 'Model API keys for OpenCode', + requestSecretHash: expect.stringMatching(/^[a-f0-9]{64}$/u), + }, + { + name: 'claustrum-auth-pi', + displayName: 'Model API keys for Pi', + requestSecretHash: expect.stringMatching(/^[a-f0-9]{64}$/u), + }, + ]) +}) + test('setup refuses local sign-in and delegates enroll-only without host registration or credential reads', async () => { const root = await profile() const h = setupIO(root) diff --git a/packages/pi/package.json b/packages/pi/package.json index af27990..feb10e5 100644 --- a/packages/pi/package.json +++ b/packages/pi/package.json @@ -31,8 +31,8 @@ "test": "bun test" }, "dependencies": { - "@cortexkit/claustrum-client": "^0.16.0", - "@cortexkit/common-auth": "^0.41.1", + "@cortexkit/claustrum-client": "^0.17.0", + "@cortexkit/common-auth": "^0.43.0", "@cortexkit/private-files": "^0.2.2", "@cortexkit/subc-client": "^0.24.0" },