Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
7 changes: 6 additions & 1 deletion packages/opencode/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
10 changes: 8 additions & 2 deletions packages/opencode/test/setup-harness.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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) =>
Expand Down Expand Up @@ -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 }
},
Expand All @@ -135,5 +141,5 @@ export function setupIO(
close() {},
}),
}
return { io, env, proposals, commands, output: () => output }
return { io, env, proposals, proposalInputs, commands, output: () => output }
}
21 changes: 21 additions & 0 deletions packages/opencode/test/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions packages/pi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Loading