rvlib-shipkit 2.34.0 → 2.35.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.
- package/CHANGELOG.md +14 -0
- package/README.md +7 -0
- package/package.json +1 -1
- package/src/agent-time/accounts-usage.ts +5 -0
- package/src/agent-time/render.ts +4 -2
- package/src/cli/cmd_Commands.ts +3 -2
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Orchestrator.ts +3 -3
- package/src/cli/cmd_Setup.ts +11 -2
- package/src/cli/cmd_Shot.ts +1 -1
- package/src/cli/cmd_Start.ts +4 -4
- package/src/cli/cmd_Time.ts +4 -2
- package/src/cli/family-pages.ts +11 -1
- package/src/cli/house-pages.ts +34 -0
- package/src/home/backup-status.ts +21 -8
- package/src/home/backup-verdict.ts +1 -1
- package/src/home/configuration-route.ts +281 -0
- package/src/home/configuration-shape.ts +167 -0
- package/src/home/home-routes.ts +6 -0
- package/src/home/serve-web.ts +1 -1
- package/src/http/owner-word.ts +1 -0
- package/src/scaffold/starter-house.ts +8 -6
- package/src/secrets/read.ts +1 -1
- package/src/serve/hub-app/backups-view.tsx +4 -2
- package/src/serve/hub-app/columns.ts +5 -0
- package/src/serve/hub-app/configuration-st.ts +102 -0
- package/src/serve/hub-app/configuration-view.tsx +145 -0
- package/src/serve/hub-app/configuration.css +27 -0
- package/src/serve/hub-app/configure-link.tsx +16 -0
- package/src/serve/hub-app/database-view.tsx +3 -3
- package/src/serve/hub-app/home-pages.ts +2 -0
- package/src/serve/hub-app/home-st.ts +15 -4
- package/src/serve/hub-app/home.html +1 -0
- package/src/serve/hub-app/hub-app.tsx +2 -0
- package/src/serve/hub-app/icons.tsx +2 -0
- package/src/serve/hub-app/identities-view.tsx +2 -1
- package/src/serve/hub-app/index.html +1 -0
- package/src/serve/hub-app/machines-view.tsx +2 -0
- package/src/serve/hub-app/place-path.ts +1 -1
- package/src/serve/hub-app/projects-svc.ts +2 -1
- package/src/serve/hub-app/secrets-page.tsx +2 -0
- package/src/serve/hub-app/space-view.tsx +2 -0
- package/src/serve/hub-app/vault-view.tsx +2 -0
- package/src/setup-house.ts +8 -2
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// the configuration page's routes on the home: what is set on this machine (GET, read only), and two acts of his click,
|
|
2
|
+
// a secret stored and a backup target added, tried or switched. Every act is the owning store's own verb.
|
|
3
|
+
//
|
|
4
|
+
// The one constraint a reader breaks first: an act never replaces anything in silence. A secret already held, and a
|
|
5
|
+
// target whose id exists, are refused unless the click says so (a secret) or never from here (a target's address). A
|
|
6
|
+
// value is a word of the one request: never in an answer, a log, an error or a url
|
|
7
|
+
import { homedir } from 'os'
|
|
8
|
+
import { existsSync, readFileSync } from 'fs'
|
|
9
|
+
import { basename, dirname, join } from 'path'
|
|
10
|
+
import { accountProblem, storeValue } from '../collections/actions.ts'
|
|
11
|
+
import { addressProblem, ownBucket, type BackupTarget, type BucketAddress, type TargetAddress, type TargetRefused } from '../hq/backup-targets.ts'
|
|
12
|
+
import { DOOR_KEY_HEADER } from '../http/door-forward.ts'
|
|
13
|
+
import { HOP_HEADER } from '../http/hop-names.ts'
|
|
14
|
+
import type { SecretStore } from '../secrets/manager.ts'
|
|
15
|
+
import { SECRET_NAME } from '../secrets/name.ts'
|
|
16
|
+
import { isTemplate } from '../secrets/name-template.ts'
|
|
17
|
+
import type { Held } from '../secrets/held.ts'
|
|
18
|
+
import { terminalRefusal } from '../serve/terminal-guard.ts'
|
|
19
|
+
import { configurationPage, type ConfigInputs, type ConfigPage, type ConfigTarget } from './configuration-shape.ts'
|
|
20
|
+
|
|
21
|
+
export const CONFIGURATION_PATH = '/api/home/configuration'
|
|
22
|
+
|
|
23
|
+
const VALUE_MAX = 16_384
|
|
24
|
+
const NO_STORE = { 'cache-control': 'no-store' }
|
|
25
|
+
const answer = (body: unknown, status = 200): Response => Response.json(body, { status, headers: NO_STORE })
|
|
26
|
+
const refuse = (why: string, status = 400): Response => answer({ refused: why }, status)
|
|
27
|
+
|
|
28
|
+
/** why a click may not change a setting here, null when it may: this machine's own browser on its own hub alone */
|
|
29
|
+
export function configurationRefusal(req: Request, peer: string | null): string | null {
|
|
30
|
+
if (req.headers.has(HOP_HEADER) || req.headers.has(DOOR_KEY_HEADER)) return "refused: a setting of this machine is changed at this machine's own hub, never through the hq's proxy or a hop"
|
|
31
|
+
return terminalRefusal(req, peer, 'a setting of this machine')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** the reads and the stores the acts go through; a test passes its own */
|
|
35
|
+
export type ConfigurationDeps = {
|
|
36
|
+
page: () => Promise<ConfigPage>
|
|
37
|
+
held: (name: string) => Promise<Held>
|
|
38
|
+
/** the house repo the secrets are stored for */
|
|
39
|
+
root: string
|
|
40
|
+
store: SecretStore
|
|
41
|
+
targets: () => BackupTarget[] | null
|
|
42
|
+
put: (t: { id: string; label: string; address: TargetAddress }) => BackupTarget | TargetRefused | null
|
|
43
|
+
on: (id: string, on: boolean) => BackupTarget | TargetRefused | null
|
|
44
|
+
/** an object written and read back: null when it came back the same, else why */
|
|
45
|
+
tryBucket: (a: BucketAddress) => Promise<string | null>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const text = (v: unknown): string => (typeof v === 'string' ? v.trim() : '')
|
|
49
|
+
|
|
50
|
+
/** why a value is not stored, null when it may be */
|
|
51
|
+
function valueProblem(name: string, value: string): string | null {
|
|
52
|
+
if (value === '') return `${name}: an empty value is not stored`
|
|
53
|
+
if (value.length > VALUE_MAX) return `${name}: longer than ${VALUE_MAX} characters; store it with sk secret set ${name} < <file>`
|
|
54
|
+
return /[\r\n]/.test(value) ? `${name}: a value of several lines; store it with sk secret set ${name} < <file>` : null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function storeSecret(d: ConfigurationDeps, b: Record<string, unknown>): Promise<Response> {
|
|
58
|
+
const name = text(b['name'])
|
|
59
|
+
const value = text(b['value'])
|
|
60
|
+
const account = text(b['account'])
|
|
61
|
+
if (!SECRET_NAME.test(name) || isTemplate(name)) return refuse('a secret is named with letters, digits, dots, dashes and slashes: backup/key')
|
|
62
|
+
const problem = valueProblem(name, value) ?? (account === '' ? null : accountProblem(account))
|
|
63
|
+
if (problem != null) return refuse(problem)
|
|
64
|
+
const held = await d.held(name)
|
|
65
|
+
if (held.held === 'unknown') return refuse(`${name}: whether it is stored could not be read (${held.why}), so nothing was stored`, 409)
|
|
66
|
+
if (held.held === 'stored' && b['replace'] !== true) return refuse(`${name} is stored already: tick replace to store a new value over it`, 409)
|
|
67
|
+
try {
|
|
68
|
+
await storeValue({ root: d.root, name, value, account: account === '' ? undefined : account, store: d.store })
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// storeValue throws a fixed line that holds no value
|
|
71
|
+
return refuse((e as Error).message, 502)
|
|
72
|
+
}
|
|
73
|
+
return answer({ stored: name })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** a bucket with its key: both halves stored under `backup/<id>/`, then the row that names them */
|
|
77
|
+
async function addBucket(d: ConfigurationDeps, b: Record<string, unknown>): Promise<Response> {
|
|
78
|
+
const id = text(b['id'])
|
|
79
|
+
const keyId = text(b['keyId'])
|
|
80
|
+
const keySecret = text(b['keySecret'])
|
|
81
|
+
const all = d.targets()
|
|
82
|
+
if (all == null) return refuse('this machine carries no hq: add the target on the one that does', 409)
|
|
83
|
+
if (all.some((t) => t.id === id)) return refuse(`a target ${JSON.stringify(id)} exists: its address is changed with sk backup targets add`, 409)
|
|
84
|
+
const key = { accessKeyId: `backup/${id}/key-id`, secretAccessKey: `backup/${id}/key-secret` }
|
|
85
|
+
const address: BucketAddress = { kind: 's3', endpoint: text(b['endpoint']).replace(/\/$/, ''), bucket: text(b['bucket']), region: text(b['region']) === '' ? 'auto' : text(b['region']), ...(b['inHost'] === true ? {} : { path: true }), key }
|
|
86
|
+
const problem = (/^[a-z0-9][a-z0-9-]{0,39}$/.test(id) ? null : 'a name of lowercase letters, digits and dashes') ?? addressProblem(address) ?? valueProblem('the access key id', keyId) ?? valueProblem('the secret access key', keySecret)
|
|
87
|
+
if (problem != null) return refuse(problem)
|
|
88
|
+
for (const [name, value] of [[key.accessKeyId, keyId], [key.secretAccessKey, keySecret]] as const) {
|
|
89
|
+
const held = await d.held(name)
|
|
90
|
+
if (held.held !== 'missing') return refuse(`${name} is ${held.held === 'stored' ? 'stored already' : 'not readable here'}: pick another name for the target`, 409)
|
|
91
|
+
try {
|
|
92
|
+
await storeValue({ root: d.root, name, value, store: d.store })
|
|
93
|
+
} catch (e) {
|
|
94
|
+
return refuse(`${(e as Error).message}; the target was not added`, 502)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const r = d.put({ id, label: text(b['label']) === '' ? id : text(b['label']), address })
|
|
98
|
+
if (r == null) return refuse('this machine carries no hq: the key is stored, the target was not added', 409)
|
|
99
|
+
return 'refused' in r ? refuse(`${r.refused}; its key is stored, the target was not added`) : answer({ added: r.id })
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function addMachine(d: ConfigurationDeps, b: Record<string, unknown>): Response {
|
|
103
|
+
const id = text(b['id'])
|
|
104
|
+
const all = d.targets()
|
|
105
|
+
if (all == null) return refuse('this machine carries no hq: add the target on the one that does', 409)
|
|
106
|
+
if (all.some((t) => t.id === id)) return refuse(`a target ${JSON.stringify(id)} exists: its address is changed with sk backup targets add`, 409)
|
|
107
|
+
const r = d.put({ id, label: text(b['label']) === '' ? id : text(b['label']), address: { kind: 'ssh', host: text(b['host']), folder: text(b['folder']) } })
|
|
108
|
+
return r == null ? refuse('this machine carries no hq', 409) : 'refused' in r ? refuse(r.refused) : answer({ added: r.id })
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** `GET` the page; `POST /secret`, `/bucket`, `/machine`, `/switch`, `/try`: his click. Null for any other path */
|
|
112
|
+
export async function configurationRoute(req: Request, path: string, peer: string | null, deps: () => Promise<ConfigurationDeps>): Promise<Response | null> {
|
|
113
|
+
if (path !== CONFIGURATION_PATH && !path.startsWith(`${CONFIGURATION_PATH}/`)) return null
|
|
114
|
+
if (req.method === 'GET' && path === CONFIGURATION_PATH) {
|
|
115
|
+
try {
|
|
116
|
+
return answer(await (await deps()).page())
|
|
117
|
+
} catch {
|
|
118
|
+
// our own words: an error of a store may quote what it read
|
|
119
|
+
return refuse('the settings of this machine could not be read: sk check says why', 503)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const why = configurationRefusal(req, peer)
|
|
123
|
+
if (why != null) return refuse(why, 403)
|
|
124
|
+
const b = (await req.json().catch(() => null)) as Record<string, unknown> | null
|
|
125
|
+
if (b == null || typeof b !== 'object' || Array.isArray(b)) return refuse('the body is no json object')
|
|
126
|
+
const d = await deps()
|
|
127
|
+
switch (path.slice(CONFIGURATION_PATH.length + 1)) {
|
|
128
|
+
case 'secret':
|
|
129
|
+
return storeSecret(d, b)
|
|
130
|
+
case 'bucket':
|
|
131
|
+
return addBucket(d, b)
|
|
132
|
+
case 'machine':
|
|
133
|
+
return addMachine(d, b)
|
|
134
|
+
case 'switch': {
|
|
135
|
+
const r = typeof b['id'] === 'string' && typeof b['on'] === 'boolean' ? d.on(b['id'], b['on']) : { refused: 'a switch names its target and on or off' }
|
|
136
|
+
return r == null ? refuse('this machine carries no hq', 409) : 'refused' in r ? refuse(r.refused) : answer({ id: r.id, on: r.on })
|
|
137
|
+
}
|
|
138
|
+
case 'try': {
|
|
139
|
+
const t = d.targets()?.find((x) => x.id === b['id'])
|
|
140
|
+
const own = t == null ? null : ownBucket(t.address)
|
|
141
|
+
if (own == null) return refuse('only a bucket added by hand is tried from here')
|
|
142
|
+
const problem = await d.tryBucket(own)
|
|
143
|
+
return problem == null ? answer({ tried: t!.id }) : refuse(problem, 502)
|
|
144
|
+
}
|
|
145
|
+
default:
|
|
146
|
+
return refuse('no such act', 404)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** « missing » of `heldHere` proven by the stores a write would change, else unknown. `heldHere` says missing of any
|
|
151
|
+
* read that gave no value, a refused keychain item and a vault that does not answer included, and a keychain write
|
|
152
|
+
* deletes the other items of the name: a write that must not replace needs the absence itself. `vaultLacks`: null with
|
|
153
|
+
* no vault in reach */
|
|
154
|
+
export async function provenHeld(first: Held, o: { manager: boolean; vaultLacks: (() => Promise<boolean>) | null; keychainLacks: () => boolean }): Promise<Held> {
|
|
155
|
+
if (first.held !== 'missing') return first
|
|
156
|
+
const unknown = (why: string): Held => ({ held: 'unknown', why })
|
|
157
|
+
if (o.manager) return unknown("this house's own secret manager never says why it gives no value: use sk secret set")
|
|
158
|
+
try {
|
|
159
|
+
if (o.vaultLacks != null && !(await o.vaultLacks())) return unknown('the vault holds it, or has no place for it')
|
|
160
|
+
return o.keychainLacks() ? first : unknown('the keychain holds an item of this name that was not read')
|
|
161
|
+
} catch {
|
|
162
|
+
// our own words: a store's error may quote what it read
|
|
163
|
+
return unknown('its store did not answer')
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** the logins gh keeps, from its hosts file: the `user:` lines alone, never a token */
|
|
168
|
+
export const ghUsers = (hosts: string): string[] => [...new Set([...hosts.matchAll(/^\s+user:\s*([A-Za-z0-9-]+)\s*$/gm)].map((m) => m[1]!))]
|
|
169
|
+
|
|
170
|
+
const tilde = (p: string, home: string): string => (p === home || p.startsWith(`${home}/`) ? `~${p.slice(home.length)}` : p)
|
|
171
|
+
const whereOf = (a: TargetAddress): string => {
|
|
172
|
+
const own = ownBucket(a)
|
|
173
|
+
if (own != null) return `the bucket ${own.bucket} at ${new URL(own.endpoint).host}`
|
|
174
|
+
return a.kind === 'ssh' ? `${a.host}:${a.folder}` : 'config' in a ? `the bucket of serve.${a.config}` : ''
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** every input of the page on this machine, for the house at `root`; each part fails alone */
|
|
178
|
+
export async function readConfigInputs(root: string): Promise<ConfigInputs> {
|
|
179
|
+
const home = homedir()
|
|
180
|
+
const [{ loadRepoConfig }, { houseRepos }, hq, local, { machineName, tailnetName }, { discoverConfigRoots }, { vaultHere, vaultReach, heldHere }, { accountLabel }, { readAccounts }] = await Promise.all([
|
|
181
|
+
import('../repo-config.ts'),
|
|
182
|
+
import('../house/project-gutter.ts'),
|
|
183
|
+
import('../hq/hq-role.ts'),
|
|
184
|
+
import('../hq/hq-local.ts'),
|
|
185
|
+
import('./machine-host.ts'),
|
|
186
|
+
import('../reflect/prompt-corpus.ts'),
|
|
187
|
+
import('../secrets/read.ts'),
|
|
188
|
+
import('../agent-time/accounts-usage.ts'),
|
|
189
|
+
import('../agent-time/accounts-usage-disk.ts'),
|
|
190
|
+
])
|
|
191
|
+
const accounts = readAccounts()
|
|
192
|
+
let configWhy: string | null = null
|
|
193
|
+
const config = await loadRepoConfig(root).catch((e: unknown) => ((configWhy = (e as Error).message.split('\n')[0] ?? 'it throws'), null))
|
|
194
|
+
const { listTargets } = await import('../hq/backup-targets.ts')
|
|
195
|
+
const store = hq.carriesHq() ? local.carriedHq() : null
|
|
196
|
+
const rows = store == null ? null : listTargets(store.db)
|
|
197
|
+
const targets: ConfigTarget[] | null = rows?.map((t) => ({ id: t.id, label: t.label, on: t.on, where: whereOf(t.address), own: ownBucket(t.address) != null })) ?? null
|
|
198
|
+
const s = config?.serve
|
|
199
|
+
const named = new Map<string, string>()
|
|
200
|
+
const name = (key: { accessKeyId: string; secretAccessKey: string } | undefined, by: string): void => {
|
|
201
|
+
for (const x of key == null ? [] : [key.accessKeyId, key.secretAccessKey]) if (!named.has(x)) named.set(x, by)
|
|
202
|
+
}
|
|
203
|
+
for (const t of rows ?? []) name(ownBucket(t.address)?.key, `the target ${t.label}`)
|
|
204
|
+
name(s?.mediaSpace?.key, 'the media store')
|
|
205
|
+
name(s?.spaceCopy?.key, 'its copy')
|
|
206
|
+
name(s?.hqReplica?.key, "the hq's live copy")
|
|
207
|
+
const held = await heldHere({ names: [...named.keys()], cwd: root }).catch((): Record<string, Held> => ({}))
|
|
208
|
+
const backups = await import('./backup-status.ts').then(async ({ backupsHere }) => backupsHere()).catch(() => null)
|
|
209
|
+
const { verdictWords } = await import('./backup-verdict.ts')
|
|
210
|
+
const machines = await local.machinesPage().then((r) => ('refused' in r ? null : r.machines.length), () => null)
|
|
211
|
+
const identities = await import('../identities/identities.ts').then(({ loadIdentities }) => loadIdentities({ cwd: root })).then((r) => r.identities.map((x) => x.id), () => [])
|
|
212
|
+
const hosts = join(home, '.config', 'gh', 'hosts.yml')
|
|
213
|
+
return {
|
|
214
|
+
machine: machineName(),
|
|
215
|
+
house: existsSync(root) ? { path: tilde(root, home), repos: houseRepos(root, home).repos.length } : null,
|
|
216
|
+
configWhy,
|
|
217
|
+
identities,
|
|
218
|
+
targets,
|
|
219
|
+
backups: backups == null ? null : { words: verdictWords(backups), worst: backups.worst, notSetUp: backups.notSetUp === true },
|
|
220
|
+
named: [...named].map(([n, by]) => ({ name: n, by, held: held[n]?.held === 'stored' ? true : held[n]?.held === 'missing' ? false : null })),
|
|
221
|
+
registered: config?.creds?.length ?? 0,
|
|
222
|
+
claude: { bin: Bun.which('claude') != null, accounts: discoverConfigRoots(home).map((r) => basename(dirname(r.projects))).map((folder) => ({ name: accountLabel(folder, accounts), folder })) },
|
|
223
|
+
github: { bin: Bun.which('gh') != null, users: existsSync(hosts) ? ghUsers(readFileSync(hosts, 'utf8')) : [] },
|
|
224
|
+
hq: { role: hq.hqRole(), machines },
|
|
225
|
+
media: s?.mediaSpace == null ? null : { bucket: s.mediaSpace.bucket, region: s.mediaSpace.region },
|
|
226
|
+
vault: vaultHere() ? 'here' : (await vaultReach().catch(() => null)) != null ? 'master' : 'none',
|
|
227
|
+
remote: tailnetName(),
|
|
228
|
+
notify: (config?.notifyCommand ?? '') !== '',
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** the acts and the reads of this machine, for the house at `root` */
|
|
233
|
+
export async function configurationHere(root: string): Promise<ConfigurationDeps> {
|
|
234
|
+
const [{ carriesHq }, { carriedHq }, t, { managerStore, managerTemplate, secretsWhere }, { heldHere, vaultApi, vaultPathFor, vaultReach }, { keychainReader }, { KV_MOUNT }] = await Promise.all([
|
|
235
|
+
import('../hq/hq-role.ts'),
|
|
236
|
+
import('../hq/hq-local.ts'),
|
|
237
|
+
import('../hq/backup-targets.ts'),
|
|
238
|
+
import('../secrets/manager.ts'),
|
|
239
|
+
import('../secrets/read.ts'),
|
|
240
|
+
import('../secrets/keychain.ts'),
|
|
241
|
+
import('../vault/layout.ts'),
|
|
242
|
+
])
|
|
243
|
+
const db = () => (carriesHq() ? (carriedHq()?.db ?? null) : null)
|
|
244
|
+
return {
|
|
245
|
+
root,
|
|
246
|
+
page: async () => configurationPage(await readConfigInputs(root)),
|
|
247
|
+
held: async (name) => {
|
|
248
|
+
const first = (await heldHere({ names: [name], cwd: root }))[name] ?? { held: 'unknown' as const, why: 'the store did not answer' }
|
|
249
|
+
const w = await secretsWhere(root)
|
|
250
|
+
const reach = await vaultReach()
|
|
251
|
+
return provenHeld(first, {
|
|
252
|
+
manager: managerTemplate(w, 'credsReadCommand') != null || managerTemplate(w, 'credsCommand') != null,
|
|
253
|
+
vaultLacks: reach == null ? null : async () => {
|
|
254
|
+
const path = vaultPathFor(w, name)
|
|
255
|
+
const vault = await vaultApi()
|
|
256
|
+
if (vault == null) throw new Error('no vault answers')
|
|
257
|
+
return path != null && (await vault.writtenAt(KV_MOUNT, path)) == null
|
|
258
|
+
},
|
|
259
|
+
keychainLacks: () => keychainReader().read(name) == null,
|
|
260
|
+
})
|
|
261
|
+
},
|
|
262
|
+
store: managerStore(root),
|
|
263
|
+
targets: () => {
|
|
264
|
+
const d = db()
|
|
265
|
+
return d == null ? null : t.listTargets(d)
|
|
266
|
+
},
|
|
267
|
+
put: (x) => {
|
|
268
|
+
const d = db()
|
|
269
|
+
return d == null ? null : t.putTarget(d, x, Date.now())
|
|
270
|
+
},
|
|
271
|
+
on: (id, on) => {
|
|
272
|
+
const d = db()
|
|
273
|
+
return d == null ? null : t.setTargetOn(d, id, on)
|
|
274
|
+
},
|
|
275
|
+
tryBucket: async (a) => {
|
|
276
|
+
const [{ bucketProblem }, { houseBucket }, { machineName }] = await Promise.all([import('../media-store/backup/bucket-target.ts'), import('./house-bucket.ts'), import('./machine-host.ts')])
|
|
277
|
+
const c = await houseBucket(a)
|
|
278
|
+
return 'why' in c ? c.why : bucketProblem(c, machineName())
|
|
279
|
+
},
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// the configuration page's answer: every thing a person can set on this machine, its state now, and the act that sets
|
|
2
|
+
// it. Pure: the route reads (configuration-route.ts), the hub draws, a test feeds made up inputs.
|
|
3
|
+
//
|
|
4
|
+
// The one constraint a reader breaks first: no second store. A topic's state is read from the store that owns it, and
|
|
5
|
+
// its act is that store's own verb. No value of a secret is ever an input here: names and whether each is held
|
|
6
|
+
import type { Fact } from './vault-words.ts'
|
|
7
|
+
|
|
8
|
+
/** the topics, in the order a new person meets them; each id is its address, `/configuration#<id>` */
|
|
9
|
+
export const CONFIG_TOPICS = ['backups', 'secrets', 'claude', 'github', 'house', 'identities', 'machines', 'media', 'vault', 'remote', 'notifications'] as const
|
|
10
|
+
export type ConfigTopicId = (typeof CONFIG_TOPICS)[number]
|
|
11
|
+
|
|
12
|
+
/** set: it works as far as this machine can read; missing: shipkit is poorer without it; optional: fine as it is;
|
|
13
|
+
* broken: set, and not working */
|
|
14
|
+
export type ConfigState = 'set' | 'missing' | 'optional' | 'broken'
|
|
15
|
+
|
|
16
|
+
export type ConfigTopic = {
|
|
17
|
+
id: ConfigTopicId
|
|
18
|
+
state: ConfigState
|
|
19
|
+
/** one line: where it stands */
|
|
20
|
+
line: string
|
|
21
|
+
facts: Fact[]
|
|
22
|
+
/** the acts that set it, in the console; a form of the page when the topic has one stands before them */
|
|
23
|
+
acts: { what: string; command: string }[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ConfigTarget = { id: string; label: string; on: boolean; where: string; /** a bucket the row holds itself: the page can try it */ own: boolean }
|
|
27
|
+
|
|
28
|
+
export type ConfigInputs = {
|
|
29
|
+
machine: string
|
|
30
|
+
house: { path: string; repos: number } | null
|
|
31
|
+
/** the house config did not load, and why */
|
|
32
|
+
configWhy: string | null
|
|
33
|
+
identities: string[]
|
|
34
|
+
/** null: the list is another machine's (this one joined its hq) or could not be read */
|
|
35
|
+
targets: ConfigTarget[] | null
|
|
36
|
+
/** the backup status: its headline, its worst, whether anything was ever set up */
|
|
37
|
+
backups: { words: string; worst: 'ok' | 'warn' | 'danger' | 'dim'; notSetUp: boolean } | null
|
|
38
|
+
/** the secrets the places set here name, and whether each is held; never a value */
|
|
39
|
+
named: { name: string; by: string; held: boolean | null }[]
|
|
40
|
+
/** how many names the house registers */
|
|
41
|
+
registered: number
|
|
42
|
+
claude: { bin: boolean; accounts: { name: string; folder: string }[] }
|
|
43
|
+
github: { bin: boolean; users: string[] }
|
|
44
|
+
hq: { role: 'carries' | 'joined' | null; machines: number | null }
|
|
45
|
+
media: { bucket: string; region: string } | null
|
|
46
|
+
vault: 'here' | 'master' | 'none'
|
|
47
|
+
remote: string | null
|
|
48
|
+
notify: boolean
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type ConfigPage = { at: number; machine: string; targets: ConfigTarget[] | null; topics: ConfigTopic[] }
|
|
52
|
+
|
|
53
|
+
const ok = (text: string): Fact => ({ text, tone: 'ok' })
|
|
54
|
+
const dim = (text: string): Fact => ({ text, tone: 'dim' })
|
|
55
|
+
const warn = (text: string): Fact => ({ text, tone: 'warn' })
|
|
56
|
+
const list = (xs: readonly string[]): string => xs.join(', ')
|
|
57
|
+
const n = (count: number, one: string, many = `${one}s`): string => `${count} ${count === 1 ? one : many}`
|
|
58
|
+
|
|
59
|
+
function backups(i: ConfigInputs): ConfigTopic {
|
|
60
|
+
const acts = [
|
|
61
|
+
{ what: 'the newest copy, back on the disk', command: 'sk backup targets get <id> --to ~/restored' },
|
|
62
|
+
]
|
|
63
|
+
if (i.targets == null) return { id: 'backups', state: i.hq.role === 'joined' ? 'optional' : 'broken', line: i.hq.role === 'joined' ? 'the list is kept on the machine that carries the hq' : 'the list of targets could not be read', facts: [dim('open this page on the machine that carries the hq to change it')], acts: [] }
|
|
64
|
+
const facts = i.targets.map((t) => (t.on ? ok : dim)(`${t.label}, ${t.where}${t.on ? '' : ': off'}`))
|
|
65
|
+
const b = i.backups
|
|
66
|
+
// the status judges: the list alone never says that a copy works
|
|
67
|
+
const state: ConfigState = i.targets.length === 0 || b?.notSetUp === true ? 'missing' : b?.worst === 'ok' ? 'set' : 'broken'
|
|
68
|
+
const first = i.targets.some((t) => t.on) ? 'no copy has left this machine yet: the daemon sends the first one at its next look' : 'every target is off: no copy leaves this machine'
|
|
69
|
+
return { id: 'backups', state, line: i.targets.length === 0 ? 'no target yet: what this machine keeps is on its own disk alone' : b == null ? 'the backup status does not answer' : b.notSetUp ? first : b.words, facts, acts }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function secrets(i: ConfigInputs): ConfigTopic {
|
|
73
|
+
const missing = i.named.filter((x) => x.held === false)
|
|
74
|
+
const unread = i.named.filter((x) => x.held == null)
|
|
75
|
+
const where = i.vault === 'none' ? "this Mac's keychain" : i.vault === 'here' ? 'the vault on this machine' : 'the vault on the machine that carries the hq'
|
|
76
|
+
return {
|
|
77
|
+
id: 'secrets',
|
|
78
|
+
state: missing.length > 0 ? 'broken' : 'set',
|
|
79
|
+
line: missing.length > 0 ? `${n(missing.length, 'secret')} named by a setting ${missing.length === 1 ? 'is' : 'are'} not stored` : `kept in ${where}`,
|
|
80
|
+
facts: [
|
|
81
|
+
...(i.registered === 0 ? [] : [dim(`${n(i.registered, 'name')} in the house registry`)]),
|
|
82
|
+
...i.named.map((x): Fact => (x.held === true ? ok(`${x.name}: stored, for ${x.by}`) : x.held == null ? dim(`${x.name}: not read, for ${x.by}`) : warn(`${x.name}: not stored, for ${x.by}`))),
|
|
83
|
+
...(unread.length > 0 ? [dim('a name not read is out of the reach of this house, or its store did not answer')] : []),
|
|
84
|
+
],
|
|
85
|
+
acts: [{ what: 'store one from a terminal, its value asked and never shown', command: 'sk secret set <name>' }, { what: 'the names this repo may read', command: 'sk secret list' }],
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function claude(i: ConfigInputs): ConfigTopic {
|
|
90
|
+
const { bin, accounts } = i.claude
|
|
91
|
+
return {
|
|
92
|
+
id: 'claude',
|
|
93
|
+
state: accounts.length > 0 ? 'set' : 'missing',
|
|
94
|
+
line: accounts.length > 0 ? `${n(accounts.length, 'account')} on this machine` : bin ? 'Claude Code is installed, no session was started yet' : 'Claude Code is not installed',
|
|
95
|
+
facts: accounts.map((a) => ok(`${a.name}, in ~/${a.folder}`)),
|
|
96
|
+
acts: [
|
|
97
|
+
{ what: 'another account: start Claude Code once in its own folder and log in; shipkit finds every ~/.claude-<name>', command: 'CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude' },
|
|
98
|
+
],
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** the page, from what was read */
|
|
103
|
+
export function configurationPage(i: ConfigInputs, at = Date.now()): ConfigPage {
|
|
104
|
+
const config = i.configWhy == null ? [] : [warn(`the house config does not load: ${i.configWhy}`)]
|
|
105
|
+
const topics: ConfigTopic[] = [
|
|
106
|
+
backups(i),
|
|
107
|
+
secrets(i),
|
|
108
|
+
claude(i),
|
|
109
|
+
{
|
|
110
|
+
id: 'github',
|
|
111
|
+
state: i.github.users.length > 0 ? 'set' : 'optional',
|
|
112
|
+
line: i.github.users.length > 0 ? `logged in as ${list(i.github.users)}` : i.github.bin ? 'gh is installed, no account is logged in' : 'gh is not installed: a repo takes any git remote by hand',
|
|
113
|
+
facts: [],
|
|
114
|
+
acts: [...(i.github.bin ? [] : [{ what: 'the GitHub cli', command: 'brew install gh' }]), { what: 'log in', command: 'gh auth login' }, { what: 'a remote of any host, for a repo', command: 'git remote add origin <url>' }],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'house',
|
|
118
|
+
state: i.house == null ? 'missing' : i.configWhy != null ? 'broken' : 'set',
|
|
119
|
+
line: i.house == null ? 'no house on this machine' : `${i.house.path}, ${n(i.house.repos, 'repo')}`,
|
|
120
|
+
facts: [...config, ...(i.house == null ? [] : [dim('its wiki loads first in every repo; its repo.config.ts holds the settings of every topic with no form here')])],
|
|
121
|
+
acts: [{ what: 'make one, and wire the repo you stand in', command: 'sk setup' }, { what: 'every key of its config', command: 'sk config-keys' }],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: 'identities',
|
|
125
|
+
state: i.identities.length > 0 ? 'set' : 'optional',
|
|
126
|
+
line: i.identities.length > 0 ? list(i.identities) : 'none: no repo has to name one',
|
|
127
|
+
facts: [dim('an identity is a folder of the house wiki: the name, the handles and the voice a repo uses in public')],
|
|
128
|
+
acts: [{ what: 'the identities of this house', command: 'sk identities' }],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'machines',
|
|
132
|
+
state: i.hq.role == null ? 'broken' : 'set',
|
|
133
|
+
line: i.hq.role === 'carries' ? `this machine carries the hq${i.hq.machines == null ? '' : `, ${n(i.hq.machines, 'machine')} in it`}` : i.hq.role === 'joined' ? 'this machine joined the hq of another' : 'its role toward an hq is not known yet: the daemon settles it at its start',
|
|
134
|
+
facts: [],
|
|
135
|
+
acts: [{ what: 'a join code for another Mac, here', command: 'sk hq invite' }, { what: 'join, on the other Mac', command: 'sk hq join <url> <code>' }],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'media',
|
|
139
|
+
state: i.media == null ? 'optional' : 'set',
|
|
140
|
+
line: i.media == null ? 'no bucket: every file stays on this machine' : `the bucket ${i.media.bucket}, ${i.media.region}`,
|
|
141
|
+
facts: [dim('a private S3 bucket that keeps the media of every repo')],
|
|
142
|
+
acts: [{ what: 'in the house config', command: "serve: { mediaSpace: { endpoint: 'https://s3.example.com', bucket: 'my-media', region: 'us-east-1', path: true, key: { accessKeyId: 'media/id', secretAccessKey: 'media/secret' } } }" }],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'vault',
|
|
146
|
+
state: i.vault === 'none' ? 'optional' : 'set',
|
|
147
|
+
line: i.vault === 'here' ? 'runs on this machine' : i.vault === 'master' ? 'read from the machine that carries the hq' : "none: secrets are in this Mac's keychain, which is enough for one Mac",
|
|
148
|
+
facts: [dim('a vault is for several machines that share their secrets')],
|
|
149
|
+
acts: [{ what: 'how it stands', command: 'sk vault status' }],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'remote',
|
|
153
|
+
state: i.remote == null ? 'optional' : 'set',
|
|
154
|
+
line: i.remote == null ? 'this machine only: no tailnet name is known' : `reached at ${i.remote} on your tailnet`,
|
|
155
|
+
facts: [dim('with Tailscale on this Mac and on a phone, the hub opens on the phone')],
|
|
156
|
+
acts: [{ what: 'Tailscale, once installed', command: 'tailscale up' }],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'notifications',
|
|
160
|
+
state: i.notify ? 'set' : 'optional',
|
|
161
|
+
line: i.notify ? 'a command of the house config sends them' : 'none off this machine',
|
|
162
|
+
facts: [],
|
|
163
|
+
acts: [{ what: 'in the house config: a command that takes a line', command: "notifyCommand: 'my-notify {message}'" }],
|
|
164
|
+
},
|
|
165
|
+
]
|
|
166
|
+
return { at, machine: i.machine, targets: i.targets, topics }
|
|
167
|
+
}
|
package/src/home/home-routes.ts
CHANGED
|
@@ -436,6 +436,12 @@ export function homeRoutes(d: HomeDeps) {
|
|
|
436
436
|
const { vaultRoute } = await import('./vault-page.ts')
|
|
437
437
|
return vaultRoute(d.root, { fresh: new URL(req.url).searchParams.has('fresh') })
|
|
438
438
|
}
|
|
439
|
+
// what is set on this machine and the acts of his click that set the rest (home/configuration-route.ts)
|
|
440
|
+
if (path === '/api/home/configuration' || path.startsWith('/api/home/configuration/')) {
|
|
441
|
+
const { configurationHere, configurationRoute } = await import('./configuration-route.ts')
|
|
442
|
+
const r = await configurationRoute(req, path, srv?.requestIP(req)?.address ?? null, () => configurationHere(d.root))
|
|
443
|
+
if (r != null) return r
|
|
444
|
+
}
|
|
439
445
|
// the Space of the house, for the Space page: what its kept listing holds, a folder, a file's link, a listing
|
|
440
446
|
// asked of the daemon's job; never a listing in the request (home/space-route.ts)
|
|
441
447
|
if (path === '/api/home/space' || path.startsWith('/api/home/space/')) {
|
package/src/home/serve-web.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { type PlaceTarget, placeHops } from './web-places.ts'
|
|
|
32
32
|
/** the page routes: ONE app for the overview, the plan, and the hub page of
|
|
33
33
|
* each known repo, which moves between them in place (home-st.ts) */
|
|
34
34
|
export function pageRoutes<T>(names: string[], page: T): Record<string, T> {
|
|
35
|
-
const out: Record<string, T> = { '/': page, '/live': page, '/wiki': page, '/inbox': page, '/machines': page, '/database': page, '/vault': page, '/space': page, '/advisors': page, '/planned': page, '/activity': page, '/running': page, '/archived': page, '/insights': page, '/time': page, '/recordings': page, '/identities': page }
|
|
35
|
+
const out: Record<string, T> = { '/': page, '/live': page, '/wiki': page, '/inbox': page, '/machines': page, '/database': page, '/vault': page, '/space': page, '/advisors': page, '/planned': page, '/activity': page, '/running': page, '/archived': page, '/insights': page, '/time': page, '/recordings': page, '/configuration': page, '/identities': page }
|
|
36
36
|
for (const n of names) out[`${hubBase(n)}/`] = page
|
|
37
37
|
return out
|
|
38
38
|
}
|
package/src/http/owner-word.ts
CHANGED
|
@@ -36,6 +36,7 @@ export const OWNER_WORD_ROUTES: readonly OwnerRoutes[] = [
|
|
|
36
36
|
{ under: '/api/home/advisors', what: "the advisors: a person made or removed, a thread shared or its share ended, a project's access, the rights, an advice confirmed, a proposal accepted, the advisors page set up" },
|
|
37
37
|
{ under: '/api/home/quiet', what: 'his quiet mode: no push to his phone' },
|
|
38
38
|
{ under: '/api/home/switches', what: "a switch that opens this machine to the hq's (its terminals, its urls), at this machine's own hub" },
|
|
39
|
+
{ under: '/api/home/configuration', what: 'a setting of this machine: a secret stored, a backup target added, tried or switched' },
|
|
39
40
|
{ under: '/api/home/follow', what: 'a place asked to follow main at once (« update now »)', not: ['/api/home/follow/ask'] },
|
|
40
41
|
{ under: '/api/urls', what: 'a url added, edited or removed, how it opens, a login typed, a url opened in Chrome', not: ['/api/urls/copy'] },
|
|
41
42
|
{ under: '/api/drives', what: "a share added, its words, a share removed, a Google login begun" },
|
|
@@ -14,16 +14,16 @@ export const HOUSE_WIKI_INDEX = 'wiki/index.md'
|
|
|
14
14
|
/** the line in a house file that says `sk setup` made it, so a second run knows the folder is its own */
|
|
15
15
|
export const STARTER_MARK = 'made by `sk setup`'
|
|
16
16
|
|
|
17
|
-
const index = (name: string): string => `# ${name}: what every repo of this house loads first
|
|
17
|
+
const index = (name: string, pages: readonly string[]): string => `# ${name}: what every repo of this house loads first
|
|
18
18
|
|
|
19
19
|
Every repo that \`sk setup\` wired loads this page first: line 1 of its CLAUDE.md names it. An agent in any of those repos starts with what is written here, so keep it short. A page that names where things are costs less than a page that explains.
|
|
20
20
|
|
|
21
21
|
@how-we-work.md
|
|
22
|
-
|
|
22
|
+
${pages.map((p) => `@${p}\n`).join('')}
|
|
23
23
|
## Pages
|
|
24
24
|
|
|
25
25
|
- → how-we-work.md: the gate, threads, asks and secrets, the shipkit way (loaded above)
|
|
26
|
-
- → identities/README.md: who speaks for your repos (none yet)
|
|
26
|
+
${pages.map((p) => `- → ${p}: generated by shipkit (loaded above)\n`).join('')}- → identities/README.md: who speaks for your repos (none yet)
|
|
27
27
|
|
|
28
28
|
## Add a rule
|
|
29
29
|
|
|
@@ -70,16 +70,18 @@ const GITIGNORE = `node_modules/
|
|
|
70
70
|
.DS_Store
|
|
71
71
|
`
|
|
72
72
|
|
|
73
|
-
/** every file of a starter house, by its path relative to the house root
|
|
74
|
-
|
|
73
|
+
/** every file of a starter house, by its path relative to the house root. `generated`: the pages shipkit generates
|
|
74
|
+
* (cli/house-pages.ts), which the index loads */
|
|
75
|
+
export function starterHouseFiles(name: string, generated: Readonly<Record<string, string>> = {}): Record<string, string> {
|
|
75
76
|
return {
|
|
76
77
|
'README.md': readme(name),
|
|
77
78
|
'CLAUDE.md': `@./${HOUSE_WIKI_INDEX}\n`,
|
|
78
|
-
[HOUSE_WIKI_INDEX]: index(name),
|
|
79
|
+
[HOUSE_WIKI_INDEX]: index(name, Object.keys(generated).map((p) => p.replace(/^wiki\//, ''))),
|
|
79
80
|
'wiki/how-we-work.md': HOW_WE_WORK,
|
|
80
81
|
'wiki/identities/README.md': IDENTITIES,
|
|
81
82
|
'package.json': `${JSON.stringify({ name, private: true, type: 'module' }, null, 4)}\n`,
|
|
82
83
|
'repo.config.ts': config(name),
|
|
83
84
|
'.gitignore': GITIGNORE,
|
|
85
|
+
...generated,
|
|
84
86
|
}
|
|
85
87
|
}
|
package/src/secrets/read.ts
CHANGED
|
@@ -69,7 +69,7 @@ const vaultWords = (r: VaultReach): string => (r.at === 'here' ? 'the vault' : `
|
|
|
69
69
|
let api: { token: string; url: string; vault: VaultApi } | null = null
|
|
70
70
|
/** the vault as this daemon's token reads it. The token is read from its file again when it changed (the vault job
|
|
71
71
|
* renews it each 12 h and the hq revokes the old one), so a process that lives long never keeps a dead token */
|
|
72
|
-
async function vaultApi(fresh = false): Promise<VaultApi | null> {
|
|
72
|
+
export async function vaultApi(fresh = false): Promise<VaultApi | null> {
|
|
73
73
|
const { readVaultToken } = await import('../hq/hq-local.ts')
|
|
74
74
|
const reach = await vaultReach()
|
|
75
75
|
if (api != null && !fresh && api.url === reach?.url) return api.vault
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// detail lines. The table is the hq machine's, the same on every hub; a client says it reads it from the hq.
|
|
4
4
|
// The constraint a reader breaks first: colour is state only, and every word is the status's own, the same as
|
|
5
5
|
// `sk backup status` prints
|
|
6
|
+
import { Configure } from './configure-link.tsx'
|
|
7
|
+
import type { HomeSt } from './home-st.ts'
|
|
6
8
|
import { observer } from 'mobx-react-lite'
|
|
7
9
|
import type { BackupStatus, Cell, CellState, StoreRow } from '../../home/backup-status.ts'
|
|
8
10
|
import { judgedWords, rowName, verdictWords } from '../../home/backup-verdict.ts'
|
|
@@ -94,14 +96,14 @@ const Details = observer(({ s }: { s: BackupStatus }) => (
|
|
|
94
96
|
))
|
|
95
97
|
|
|
96
98
|
/** the « backups » subject of the database page */
|
|
97
|
-
export const BackupsSubject = observer(({ st }: { st: BackupsSt }) => {
|
|
99
|
+
export const BackupsSubject = observer(({ app, st }: { app: HomeSt; st: BackupsSt }) => {
|
|
98
100
|
const s = st.status
|
|
99
101
|
if (s == null) return <div className={st.res.error === '' ? 'rv-dim' : 'hnote dberr'}>{st.res.error === '' ? 'reading the backups…' : st.res.error}</div>
|
|
100
102
|
return (
|
|
101
103
|
<div className="bkpage">
|
|
102
104
|
<div className="bkhead">
|
|
103
105
|
<h2 className="so-h so-big">backups · <span className={TONE[s.stale != null || s.worst === 'dim' ? 'warn' : s.worst]}>{verdictWords(s)}</span></h2>
|
|
104
|
-
<div className="rv-dim">{judgedWords(s, clock)} · in the console: sk backup status · the places: sk backup targets
|
|
106
|
+
<div className="rv-dim">{judgedWords(s, clock)} · in the console: sk backup status · the places: sk backup targets <Configure app={app} topic="backups" /></div>
|
|
105
107
|
</div>
|
|
106
108
|
{s.alarms.length === 0 ? null : (
|
|
107
109
|
<ul className="bkalarms" role="alert">
|
|
@@ -13,6 +13,7 @@ import { railOf } from './rail-groups.ts'
|
|
|
13
13
|
export { PROFILE_KEY } from './panel-walk.ts'
|
|
14
14
|
import type { RepoSt } from './repo-st.ts'
|
|
15
15
|
import { SPACE_ENTRIES, type SpaceEntry } from './space-st.ts'
|
|
16
|
+
import { CONFIG_TOPICS, type ConfigTopicId } from '../../home/configuration-shape.ts'
|
|
16
17
|
import { entriesOf } from './time-pages.tsx'
|
|
17
18
|
import { TIME_ENTRIES, type TimeEntry } from './time-st.ts'
|
|
18
19
|
import { VAULT_ENTRIES, type VaultEntry } from './vault-st.ts'
|
|
@@ -61,6 +62,10 @@ export function listColumn(home: HomeSt): SideList | null {
|
|
|
61
62
|
const v = home.vault
|
|
62
63
|
return sideOf({ ids: () => [...VAULT_ENTRIES], current: () => v.entry, open: (id) => v.open(id as VaultEntry, 'replace') })
|
|
63
64
|
}
|
|
65
|
+
if (home.page === 'configuration') {
|
|
66
|
+
const c = home.configuration
|
|
67
|
+
return sideOf({ ids: () => [...CONFIG_TOPICS], current: () => c.topic, open: (id) => c.open(id as ConfigTopicId, 'replace') })
|
|
68
|
+
}
|
|
64
69
|
if (home.page === 'space') {
|
|
65
70
|
const s = home.space
|
|
66
71
|
return sideOf({ ids: () => [...SPACE_ENTRIES], current: () => s.entry, open: (id) => s.open(id as SpaceEntry, 'replace') })
|