rvlib-shipkit 2.33.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 +36 -0
- package/README.md +7 -0
- package/package.json +1 -1
- package/src/advisors/advisor-view.ts +1 -0
- package/src/advisors/sync.ts +4 -1
- package/src/agent-time/accounts-usage.ts +5 -0
- package/src/agent-time/render.ts +4 -2
- package/src/cli/cmd_BackupTargets.ts +49 -8
- package/src/cli/cmd_Commands.ts +3 -2
- package/src/cli/cmd_Init.ts +1 -1
- package/src/cli/cmd_Media.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 +2 -2
- package/src/cli/cmd_Start.ts +6 -6
- 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/core/memory-watch.ts +1 -1
- package/src/gate/gate-checks.ts +7 -5
- package/src/home/backup-status.ts +54 -13
- package/src/home/backup-verdict.ts +1 -0
- package/src/home/configuration-route.ts +281 -0
- package/src/home/configuration-shape.ts +167 -0
- package/src/home/daemon-jobs.ts +5 -0
- package/src/home/home-routes.ts +9 -2
- package/src/home/house-bucket.ts +14 -0
- package/src/home/serve-web.ts +1 -1
- package/src/home/this-house.ts +68 -0
- package/src/home/via-hub.ts +2 -1
- package/src/hq/backup-targets.ts +58 -5
- package/src/hq/hq-local.ts +1 -1
- package/src/http/owner-word.ts +1 -0
- package/src/media-store/backup/bucket-target.ts +58 -0
- package/src/media-store/backup/target-send.ts +7 -4
- package/src/media-store/space.ts +2 -0
- package/src/review/cells.ts +6 -2
- package/src/review/store.ts +2 -1
- package/src/scaffold/project-scaffold.ts +2 -2
- package/src/scaffold/starter-house.ts +8 -6
- package/src/secrets/read.ts +1 -1
- package/src/serve/hub-app/auto-text.tsx +3 -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/review/review-thread.tsx +2 -1
- package/src/serve/hub-app/review/thread-st.ts +8 -2
- package/src/serve/hub-app/review/tone-bar.tsx +4 -2
- 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 +9 -9
- package/src/start-repo.ts +27 -30
package/src/home/home-routes.ts
CHANGED
|
@@ -161,12 +161,13 @@ export const projectsOrder = (rows: readonly Pick<ProjectRow, 'name' | 'activity
|
|
|
161
161
|
[...rows].sort((x, y) => (y.activity ?? -Infinity) - (x.activity ?? -Infinity) || x.name.localeCompare(y.name)).map((p) => p.name).join(',')
|
|
162
162
|
|
|
163
163
|
/** the house's backup targets the first time: the buckets its config names */
|
|
164
|
-
async function targetSeed(): Promise<
|
|
164
|
+
async function targetSeed(): Promise<import('../hq/backup-targets.ts').SeedFrom> {
|
|
165
165
|
const { houseRootOf } = await import('./home-start.ts')
|
|
166
166
|
const { loadRepoConfig } = await import('../repo-config.ts')
|
|
167
167
|
const house = houseRootOf(process.cwd())
|
|
168
168
|
const serve = house == null ? undefined : (await loadRepoConfig(house).catch(() => null))?.serve
|
|
169
|
-
|
|
169
|
+
const of = (b: { endpoint?: string; region: string } | undefined) => (b == null ? null : { region: b.region, ...(b.endpoint == null ? {} : { endpoint: b.endpoint }) })
|
|
170
|
+
return { mediaSpace: of(serve?.mediaSpace), spaceCopy: of(serve?.spaceCopy) }
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
export function homeRoutes(d: HomeDeps) {
|
|
@@ -435,6 +436,12 @@ export function homeRoutes(d: HomeDeps) {
|
|
|
435
436
|
const { vaultRoute } = await import('./vault-page.ts')
|
|
436
437
|
return vaultRoute(d.root, { fresh: new URL(req.url).searchParams.has('fresh') })
|
|
437
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
|
+
}
|
|
438
445
|
// the Space of the house, for the Space page: what its kept listing holds, a folder, a file's link, a listing
|
|
439
446
|
// asked of the daemon's job; never a listing in the request (home/space-route.ts)
|
|
440
447
|
if (path === '/api/home/space' || path.startsWith('/api/home/space/')) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// a bucket added by hand (media-store/backup/bucket-target.ts) with its key read on this machine: through the house's
|
|
2
|
+
// own secret manager where it declares one, else the house store
|
|
3
|
+
import type { BucketAddress } from '../hq/backup-targets.ts'
|
|
4
|
+
import { bucketConfig } from '../media-store/backup/bucket-target.ts'
|
|
5
|
+
import type { SpaceConfig } from '../media-store/space.ts'
|
|
6
|
+
import { loadRepoConfig } from '../repo-config.ts'
|
|
7
|
+
import { readThrough } from '../secrets/read.ts'
|
|
8
|
+
import { houseRootOf } from './home-start.ts'
|
|
9
|
+
|
|
10
|
+
export async function houseBucket(a: BucketAddress): Promise<SpaceConfig | { why: string }> {
|
|
11
|
+
const house = houseRootOf(process.cwd())
|
|
12
|
+
const template = house == null ? undefined : (await loadRepoConfig(house).catch(() => null))?.credsReadCommand
|
|
13
|
+
return bucketConfig(a, (name) => readThrough(template, name))
|
|
14
|
+
}
|
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
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// which house this machine runs, seen from any folder: what `sk start` writes as line 1 of a new repo's CLAUDE.md, and
|
|
2
|
+
// where the house's `start.skip` is read. No house is named in this file: it ships on npm
|
|
3
|
+
import { existsSync, readdirSync, readFileSync, realpathSync } from 'fs'
|
|
4
|
+
import { homedir } from 'os'
|
|
5
|
+
import { dirname, join, relative, resolve, sep } from 'path'
|
|
6
|
+
import { homeRepo } from '../house/project-gutter.ts'
|
|
7
|
+
import { HOUSE_WIKI_INDEX, STARTER_MARK } from '../scaffold/starter-house.ts'
|
|
8
|
+
import { installedHouseRoot, plistPath } from './home-launchd.ts'
|
|
9
|
+
|
|
10
|
+
const inside = (p: string, root: string): boolean => p === root || p.startsWith(`${root}${sep}`)
|
|
11
|
+
const hosts = (dir: string): boolean => existsSync(join(dir, HOUSE_WIKI_INDEX)) && existsSync(join(dir, 'repo.config.ts'))
|
|
12
|
+
|
|
13
|
+
/** a house that `sk setup` made, whose owner chose no policy for their agents yet */
|
|
14
|
+
export function isStarterHouse(dir: string): boolean {
|
|
15
|
+
try {
|
|
16
|
+
return readFileSync(join(dir, 'README.md'), 'utf8').includes(STARTER_MARK)
|
|
17
|
+
} catch {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** the one house that `sk setup` made among the folders of `root`, null with none or several: none is guessed */
|
|
23
|
+
function starterHouseIn(root: string): string | null {
|
|
24
|
+
let names: string[]
|
|
25
|
+
try {
|
|
26
|
+
names = readdirSync(root)
|
|
27
|
+
} catch {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
const made = names.map((n) => join(root, n)).filter((d) => hosts(d) && isStarterHouse(d))
|
|
31
|
+
return made.length === 1 ? made[0]! : null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type HouseLookup = {
|
|
35
|
+
home?: string
|
|
36
|
+
/** the folder the repos sit in, where a starter house is looked for */
|
|
37
|
+
root?: string
|
|
38
|
+
/** the checkout this lib runs from, a house when shipkit is developed in one. Injected by tests */
|
|
39
|
+
lib?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** the house root of this machine: the one its pm runs from, else the checkout this lib runs from, else the one
|
|
43
|
+
* `sk setup` made beside the repos. The lib's checkout counts only under this home: a scratch home is another machine */
|
|
44
|
+
export function thisHouse(o: HouseLookup = {}): string | null {
|
|
45
|
+
const home = o.home ?? homedir()
|
|
46
|
+
const pm = installedHouseRoot(plistPath(home))
|
|
47
|
+
if (pm != null && hosts(pm)) return pm
|
|
48
|
+
const lib = homeRepo(resolve(o.lib ?? join(import.meta.dir, '../../../..')))
|
|
49
|
+
if (hosts(lib) && inside(lib, resolve(home))) return lib
|
|
50
|
+
return starterHouseIn(o.root ?? join(home, 'dev'))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** the folder a new repo goes in: the house's own, since a house finds its repos among its siblings, else ~/dev */
|
|
54
|
+
export const reposRoot = (house: string | null, home: string): string => (house != null ? dirname(house) : join(home, 'dev'))
|
|
55
|
+
|
|
56
|
+
/** the line 1 a wired repo's CLAUDE.md carries: the house index, `~/` relative when it sits under the home */
|
|
57
|
+
export function houseLine(house: string, home: string): string {
|
|
58
|
+
const index = join(house, HOUSE_WIKI_INDEX)
|
|
59
|
+
const real = (p: string): string => {
|
|
60
|
+
try {
|
|
61
|
+
return realpathSync(p)
|
|
62
|
+
} catch {
|
|
63
|
+
return resolve(p)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// a home behind a symlink (/var → /private/var) would expand `~/` to another spelling of the path
|
|
67
|
+
return inside(index, home) && real(home) === home ? `@~/${relative(home, index)}` : `@${index}`
|
|
68
|
+
}
|
package/src/home/via-hub.ts
CHANGED
|
@@ -20,10 +20,11 @@ import { TRACE_ENV } from '../trace/tracer.ts'
|
|
|
20
20
|
import { FRESH_ENV } from '../ledger/store.ts'
|
|
21
21
|
import { LEDGER_ENV } from '../ledger/ledger.ts'
|
|
22
22
|
import { PARALLEL_ENV } from '../core/parallel.ts'
|
|
23
|
+
import { SUITE_SELECT_ENV } from '../suite/reads-env.ts'
|
|
23
24
|
|
|
24
25
|
/** the env switches a gate reads, which a terminal may set for one run: the
|
|
25
26
|
* job the home starts runs with the daemon's env, so they travel with it */
|
|
26
|
-
export const FORWARDED_ENV = [TRACE_ENV, FRESH_ENV, LEDGER_ENV, PARALLEL_ENV] as const
|
|
27
|
+
export const FORWARDED_ENV = [TRACE_ENV, FRESH_ENV, LEDGER_ENV, PARALLEL_ENV, SUITE_SELECT_ENV] as const
|
|
27
28
|
|
|
28
29
|
/** the forwarded switches this env sets */
|
|
29
30
|
export const forwardedEnv = (env: Env = process.env): Record<string, string> =>
|
package/src/hq/backup-targets.ts
CHANGED
|
@@ -3,31 +3,72 @@
|
|
|
3
3
|
//
|
|
4
4
|
// The constraint a reader breaks first: a row never holds a secret, and never a second copy of an address the house
|
|
5
5
|
// config already owns. A bucket the config names (the Space, its second place) is a row that names that config key;
|
|
6
|
-
// only a place with no other owner (an ssh machine, a bucket added by hand) holds its own address
|
|
6
|
+
// only a place with no other owner (an ssh machine, a bucket added by hand) holds its own address, and the names of the
|
|
7
|
+
// two secrets of its key
|
|
7
8
|
import type { Database } from 'bun:sqlite'
|
|
9
|
+
import type { KeyPairNames } from '../secrets/key-pair.ts'
|
|
10
|
+
import { SECRET_NAME } from '../secrets/name.ts'
|
|
8
11
|
|
|
9
12
|
/** where a target's address lives: a key of the house config's `serve`, or the row itself */
|
|
10
13
|
export type TargetAddress =
|
|
11
14
|
| { kind: 's3'; config: 'mediaSpace' | 'spaceCopy' }
|
|
15
|
+
| BucketAddress
|
|
12
16
|
| { kind: 'ssh'; host: string; folder: string }
|
|
13
17
|
|
|
18
|
+
/** a bucket added by hand, at any S3 server: its origin, and the names of the two secrets of its key */
|
|
19
|
+
export type BucketAddress = {
|
|
20
|
+
kind: 's3'
|
|
21
|
+
/** the origin, the bucket in its host or in its path (`path`) */
|
|
22
|
+
endpoint: string
|
|
23
|
+
bucket: string
|
|
24
|
+
region: string
|
|
25
|
+
/** the bucket in the path, not the host: MinIO, R2 and any server at one origin want it */
|
|
26
|
+
path?: boolean
|
|
27
|
+
key: KeyPairNames
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** the bucket a row holds itself, null for a machine and for a bucket the house config owns */
|
|
31
|
+
export const ownBucket = (a: TargetAddress): BucketAddress | null => (a.kind === 's3' && !('config' in a) ? a : null)
|
|
32
|
+
/** the config key that owns a row's bucket, null for a machine and for a bucket the row holds itself */
|
|
33
|
+
export const configBucket = (a: TargetAddress): 'mediaSpace' | 'spaceCopy' | null => (a.kind === 's3' && 'config' in a ? a.config : null)
|
|
34
|
+
|
|
14
35
|
export type BackupTarget = { id: string; label: string; on: boolean; at: number; address: TargetAddress }
|
|
15
36
|
|
|
16
37
|
export const TARGETS_SCHEMA = 'create table if not exists backup_targets (id text primary key, label text not null, address text not null, on_ integer not null, at integer not null) without rowid;'
|
|
17
38
|
|
|
18
39
|
const ID = /^[a-z0-9][a-z0-9-]{0,39}$/
|
|
40
|
+
const BUCKET = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/
|
|
41
|
+
const REGION = /^[A-Za-z0-9-]{1,40}$/
|
|
19
42
|
const HOST = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/
|
|
20
43
|
/** a folder under the target's home: `~/` then plain names, never `..` */
|
|
21
44
|
const FOLDER = /^~\/(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+$/
|
|
22
45
|
|
|
23
46
|
/** why an address cannot be stored, null when it can */
|
|
24
47
|
export function addressProblem(a: TargetAddress): string | null {
|
|
25
|
-
if (a.kind === 's3') return a.config === 'mediaSpace' || a.config === 'spaceCopy' ? null : 'an s3 target names serve.mediaSpace or serve.spaceCopy'
|
|
48
|
+
if (a.kind === 's3') return 'config' in a ? (a.config === 'mediaSpace' || a.config === 'spaceCopy' ? null : 'an s3 target names serve.mediaSpace or serve.spaceCopy') : bucketProblemOf(a)
|
|
26
49
|
if (!HOST.test(a.host)) return `${JSON.stringify(a.host)}: an ssh host of letters, digits, dots, dashes`
|
|
27
50
|
if (!FOLDER.test(a.folder) || a.folder.split('/').includes('..')) return `${JSON.stringify(a.folder)}: a folder under the home, ~/a/b`
|
|
28
51
|
return null
|
|
29
52
|
}
|
|
30
53
|
|
|
54
|
+
const LOOPBACK = new Set(['127.0.0.1', 'localhost', '[::1]'])
|
|
55
|
+
/** why a bucket's address cannot be stored, null when it can: a copy of the house's data never goes over plain http */
|
|
56
|
+
function bucketProblemOf(a: BucketAddress): string | null {
|
|
57
|
+
let origin: URL
|
|
58
|
+
try {
|
|
59
|
+
origin = new URL(a.endpoint)
|
|
60
|
+
} catch {
|
|
61
|
+
return `${JSON.stringify(a.endpoint)}: the origin of an S3 server, https://s3.example.com`
|
|
62
|
+
}
|
|
63
|
+
if (origin.protocol !== 'https:' && !(origin.protocol === 'http:' && LOOPBACK.has(origin.hostname))) return `${a.endpoint}: not https`
|
|
64
|
+
if (origin.username !== '' || origin.password !== '') return 'the endpoint carries a password: store it as a secret and name it'
|
|
65
|
+
if (origin.origin !== a.endpoint.replace(/\/$/, '')) return `${a.endpoint}: the origin alone, ${origin.origin}, with no path`
|
|
66
|
+
if (!BUCKET.test(a.bucket)) return `${JSON.stringify(a.bucket)}: a bucket of 3 to 63 lowercase letters, digits, dots, dashes`
|
|
67
|
+
if (!REGION.test(a.region)) return `${JSON.stringify(a.region)}: a region of letters, digits, dashes (auto, us-east-1)`
|
|
68
|
+
for (const n of [a.key?.accessKeyId, a.key?.secretAccessKey]) if (typeof n !== 'string' || !SECRET_NAME.test(n)) return 'a bucket names the two secrets of its key: the access key id and the secret access key'
|
|
69
|
+
return null
|
|
70
|
+
}
|
|
71
|
+
|
|
31
72
|
/** every target, in the order they were added */
|
|
32
73
|
export function listTargets(db: Database): BackupTarget[] {
|
|
33
74
|
const has = db.query("select 1 from sqlite_master where type = 'table' and name = 'backup_targets'").get() != null
|
|
@@ -57,9 +98,21 @@ export function removeTarget(db: Database, id: string): { removed: boolean } {
|
|
|
57
98
|
return { removed: db.query('delete from backup_targets where id = ?').run(id).changes > 0 }
|
|
58
99
|
}
|
|
59
100
|
|
|
101
|
+
/** what the config says of a bucket it names, for the first label of its row; null for a bucket it does not name */
|
|
102
|
+
export type SeedBucket = { endpoint?: string; region: string }
|
|
103
|
+
export type SeedFrom = { mediaSpace: SeedBucket | null; spaceCopy: SeedBucket | null }
|
|
104
|
+
|
|
105
|
+
/** the id and label a provider's bucket starts with, read from its origin; `auto` is the region of R2 alone */
|
|
106
|
+
function seedName(b: SeedBucket, other: { id: string; label: string }): { id: string; label: string } {
|
|
107
|
+
const host = b.endpoint == null || !URL.canParse(b.endpoint) ? '' : new URL(b.endpoint).hostname
|
|
108
|
+
if (host.endsWith('.digitaloceanspaces.com')) return { id: 'do-space', label: 'DigitalOcean Space' }
|
|
109
|
+
if (host.endsWith('.r2.cloudflarestorage.com') || (host === '' && b.region === 'auto')) return { id: 'cf-r2', label: 'Cloudflare R2' }
|
|
110
|
+
return other
|
|
111
|
+
}
|
|
112
|
+
|
|
60
113
|
/** the house's targets the first time: the Space, and its second place when the config names one; a machine is added
|
|
61
114
|
* by hand. Only into an empty table, so a row the owner removed never comes back by itself */
|
|
62
|
-
export function seedTargets(db: Database, o:
|
|
115
|
+
export function seedTargets(db: Database, o: SeedFrom & { now: number }): BackupTarget[] {
|
|
63
116
|
if (listTargets(db).length > 0) return []
|
|
64
117
|
const out: BackupTarget[] = []
|
|
65
118
|
const put = (t: Parameters<typeof putTarget>[1], at: number): void => {
|
|
@@ -67,8 +120,8 @@ export function seedTargets(db: Database, o: { mediaSpace: boolean; spaceCopy: b
|
|
|
67
120
|
if (!('refused' in r)) out.push(r)
|
|
68
121
|
}
|
|
69
122
|
db.transaction(() => {
|
|
70
|
-
if (o.mediaSpace) put({ id: '
|
|
71
|
-
if (o.spaceCopy) put({ id: '
|
|
123
|
+
if (o.mediaSpace) put({ ...seedName(o.mediaSpace, { id: 'space', label: 'the Space' }), address: { kind: 's3', config: 'mediaSpace' } }, o.now)
|
|
124
|
+
if (o.spaceCopy) put({ ...seedName(o.spaceCopy, { id: 'space-copy', label: 'the second place' }), address: { kind: 's3', config: 'spaceCopy' } }, o.now + 1)
|
|
72
125
|
}).immediate()
|
|
73
126
|
return out
|
|
74
127
|
}
|
package/src/hq/hq-local.ts
CHANGED
|
@@ -355,7 +355,7 @@ export function setHqPort(open: boolean): { open: boolean; port: number } | Refu
|
|
|
355
355
|
* writer of its file: the door opened or closed, a join code for another machine, the end of a node, a prompt
|
|
356
356
|
* forgotten, a switch wanted of another machine */
|
|
357
357
|
/** what the first list of backup targets is seeded from, which the daemon reads in the house (backup-targets.ts) */
|
|
358
|
-
export type TargetSeed = () => Promise<
|
|
358
|
+
export type TargetSeed = () => Promise<import('./backup-targets.ts').SeedFrom>
|
|
359
359
|
|
|
360
360
|
export async function hqAdminRoute(req: Request, path: string, now: number = Date.now(), o: { seed?: TargetSeed } = {}): Promise<Response | null> {
|
|
361
361
|
if (!path.startsWith('/api/home/hq/') || req.method !== 'POST') return null
|
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" },
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// a bucket added by hand as a place for copies (wiki tools/shipkit/media-store-backup.md, Targets): any S3 server, its
|
|
2
|
+
// address in the hq's row, its key pair read through the house store and held in memory only. A copy goes up under
|
|
3
|
+
// `_snapshots/<store>/<machine>/`, its name carrying 12 of its sha, and a copy read back is compared with that name.
|
|
4
|
+
import { mkdirSync } from 'node:fs'
|
|
5
|
+
import { join } from 'node:path'
|
|
6
|
+
import { atomicWrite } from '../../core/atomic-write.ts'
|
|
7
|
+
import type { BucketAddress } from '../../hq/backup-targets.ts'
|
|
8
|
+
import { readKeyPair } from '../../secrets/key-pair.ts'
|
|
9
|
+
import { putStream } from '../copy/stream.ts'
|
|
10
|
+
import { signedFetch, spaceOf, type SpaceConfig } from '../space.ts'
|
|
11
|
+
import { COPY_NAME, SAFE, sha256 } from './ssh-target.ts'
|
|
12
|
+
|
|
13
|
+
/** the bucket as a config the S3 calls sign with, or why it cannot be reached: a key half that is not stored */
|
|
14
|
+
export async function bucketConfig(a: BucketAddress, read: (name: string) => Promise<string>): Promise<SpaceConfig | { why: string }> {
|
|
15
|
+
try {
|
|
16
|
+
return { endpoint: a.endpoint, bucket: a.bucket, region: a.region, ...(a.path === true ? { path: true } : {}), cdn: null, creds: await readKeyPair(a.key, read) }
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return { why: `no key yet: ${(e as Error).message}` }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const bucketPut = async (c: SpaceConfig, key: string, bytes: Uint8Array): Promise<void> => void (await putStream(c, key, new Blob([bytes.slice()]).stream(), { max: bytes.length }))
|
|
23
|
+
|
|
24
|
+
/** the folder of one store's copies of one machine */
|
|
25
|
+
export const copiesDir = (store: string, machine: string): string => `_snapshots/${store}/${machine}/`
|
|
26
|
+
|
|
27
|
+
/** what a bucket answers to one small object written and read back: null when it gave the same bytes */
|
|
28
|
+
export async function bucketProblem(c: SpaceConfig, machine: string, now = Date.now()): Promise<string | null> {
|
|
29
|
+
if (!SAFE.test(machine)) return `${machine}: not a safe folder name`
|
|
30
|
+
const key = `${copiesDir('check', machine)}check.txt`
|
|
31
|
+
const bytes = new TextEncoder().encode(`shipkit ${now}\n`)
|
|
32
|
+
try {
|
|
33
|
+
await bucketPut(c, key, bytes)
|
|
34
|
+
const r = await signedFetch(c, 'GET', key, {})
|
|
35
|
+
if (!r.ok) return `it took an object and does not read it back: ${r.status}`
|
|
36
|
+
return sha256(new Uint8Array(await r.arrayBuffer())) === sha256(bytes) ? null : 'it gave other bytes back than the ones written'
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return (e as Error).message
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** the newest copy of a store written back under `to`, its bytes compared with the sha its name carries; an `.gz` one
|
|
43
|
+
* is gunzipped beside it. Throws with its reason, and leaves no file of a copy that did not match */
|
|
44
|
+
export async function getNewest(c: SpaceConfig, o: { store: string; machine: string; to: string }): Promise<{ key: string; file: string; bytes: number }> {
|
|
45
|
+
const names = (await spaceOf(c).list(copiesDir(o.store, o.machine))).map((x) => x.key.slice(copiesDir(o.store, o.machine).length)).filter((n) => COPY_NAME.test(n)).sort()
|
|
46
|
+
const name = names.at(-1)
|
|
47
|
+
if (name == null) throw new Error(`no copy of ${o.store} from ${o.machine} in ${c.bucket}`)
|
|
48
|
+
const key = `${copiesDir(o.store, o.machine)}${name}`
|
|
49
|
+
const r = await signedFetch(c, 'GET', key, {})
|
|
50
|
+
if (!r.ok) throw new Error(`${key} does not read back: ${r.status}`)
|
|
51
|
+
const bytes = new Uint8Array(await r.arrayBuffer())
|
|
52
|
+
if (sha256(bytes).slice(0, 12) !== COPY_NAME.exec(name)![2]) throw new Error(`${key} came back with other bytes than the ones that went up`)
|
|
53
|
+
const out = name.endsWith('.gz') ? Bun.gunzipSync(bytes) : bytes
|
|
54
|
+
const file = join(o.to, `${o.store}-${name.replace(/\.gz$/, '')}`)
|
|
55
|
+
mkdirSync(o.to, { recursive: true })
|
|
56
|
+
atomicWrite(file, out, { mode: 0o600 })
|
|
57
|
+
return { key, file, bytes: out.length }
|
|
58
|
+
}
|
|
@@ -9,7 +9,7 @@ import { readdirSync, readFileSync, mkdtempSync, rmSync, statSync } from 'node:f
|
|
|
9
9
|
import { tmpdir } from 'node:os'
|
|
10
10
|
import { join } from 'node:path'
|
|
11
11
|
import { machineGet, machineSet } from '../../core/machine-db.ts'
|
|
12
|
-
import type
|
|
12
|
+
import { configBucket, ownBucket, type BackupTarget, type BucketAddress } from '../../hq/backup-targets.ts'
|
|
13
13
|
import type { ReplicaPlace } from '../../hq/replica.ts'
|
|
14
14
|
import type { BackupRetention } from './retention.ts'
|
|
15
15
|
import { copyName, homeRelative, houseSsh, SAFE, sha256, sshPrune, sshPut, type Ssh } from './ssh-target.ts'
|
|
@@ -30,7 +30,7 @@ export const HQ_EVERY_MS = 60 * 60_000
|
|
|
30
30
|
const RETRY_MS = 10 * 60_000
|
|
31
31
|
|
|
32
32
|
/** the targets this job sends to: every one on, except the Space, which each store reaches its own way */
|
|
33
|
-
export const sealedTargets = (targets: readonly BackupTarget[]): BackupTarget[] => targets.filter((t) => t.on &&
|
|
33
|
+
export const sealedTargets = (targets: readonly BackupTarget[]): BackupTarget[] => targets.filter((t) => t.on && configBucket(t.address) !== 'mediaSpace')
|
|
34
34
|
|
|
35
35
|
/** the vault's newest sealed snapshot beside it, null when none */
|
|
36
36
|
export function newestVaultSnap(dir: string): { file: string; mtime: number } | null {
|
|
@@ -56,6 +56,8 @@ export type SendDeps = {
|
|
|
56
56
|
policy: BackupRetention | null
|
|
57
57
|
/** the second place's bucket, or why there is none (copy/config.ts houseCopy) */
|
|
58
58
|
secondPlace: () => Promise<{ put: (key: string, bytes: Uint8Array) => Promise<void> } | { why: string }>
|
|
59
|
+
/** a bucket a row holds itself, or why it cannot be reached (bucket-target.ts) */
|
|
60
|
+
bucket: (a: BucketAddress) => Promise<{ put: (key: string, bytes: Uint8Array) => Promise<void> } | { why: string }>
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/** one file of one store to one target, the send kept for the status. The line to print */
|
|
@@ -80,7 +82,8 @@ export async function sendTo(store: StoreId, t: BackupTarget, f: { name: string;
|
|
|
80
82
|
if (d.policy != null) pruned = await sshPrune({ ssh, peer: t.address.host, dir, now: at, policy: d.policy }).then((n) => `, ${n} pruned`, (e: Error) => `; the old copies were not pruned: ${e.message}`)
|
|
81
83
|
return `ok: ${store} to ${t.label}: ${t.address.host}:~/${dir}/${f.name}, ${(f.bytes.length / 1e6).toFixed(1)} MB, checked by its sha there${pruned}`
|
|
82
84
|
}
|
|
83
|
-
const
|
|
85
|
+
const own = ownBucket(t.address)
|
|
86
|
+
const place = own == null ? await d.secondPlace() : await d.bucket(own)
|
|
84
87
|
if ('why' in place) return fail(place.why)
|
|
85
88
|
const key = `_snapshots/${store}/${d.machine}/${f.name}`
|
|
86
89
|
await place.put(key, f.bytes)
|
|
@@ -95,7 +98,7 @@ export async function sendTo(store: StoreId, t: BackupTarget, f: { name: string;
|
|
|
95
98
|
* hour old. Cheap: rows of the machine db and one directory read */
|
|
96
99
|
export function targetsDue(targets: readonly BackupTarget[], o: { vaultDir: string | null; carriesHq: boolean; now: number; stream?: ReplicaPlace | null }): { vault: BackupTarget[]; hq: BackupTarget[] } {
|
|
97
100
|
const to = sealedTargets(targets)
|
|
98
|
-
const streamed = (t: BackupTarget): boolean =>
|
|
101
|
+
const streamed = (t: BackupTarget): boolean => o.stream != null && configBucket(t.address) === o.stream
|
|
99
102
|
const snap = o.vaultDir == null ? null : newestVaultSnap(o.vaultDir)
|
|
100
103
|
return {
|
|
101
104
|
vault: snap == null ? [] : to.filter((t) => vaultDueTo(lastSentTo('vault', t.id), snap.mtime, o.now)),
|
package/src/media-store/space.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface MediaSpace {
|
|
|
14
14
|
endpoint: string
|
|
15
15
|
bucket: string
|
|
16
16
|
region: string
|
|
17
|
+
/** the bucket in the path, not the host: MinIO and any server at one origin want it, its `endpoint` then the origin alone */
|
|
18
|
+
path?: boolean
|
|
17
19
|
/** the CDN edge a signed URL is handed out on */
|
|
18
20
|
cdn?: string
|
|
19
21
|
/** the two secrets of its key, read through the house store */
|
package/src/review/cells.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// reply, note and state change is one cell, in time order, built at read time from the store's files (a supersedes chain
|
|
3
3
|
// folds into one thread, nothing is rewritten). The paged list's rows and its query. Pure and browser safe: the routes
|
|
4
4
|
// send these shapes, the hub page draws them
|
|
5
|
+
import { findLast } from '../core/es2022.ts'
|
|
5
6
|
import {
|
|
6
7
|
type AnswerKind,
|
|
7
8
|
canonicalAddress,
|
|
@@ -184,6 +185,9 @@ export interface ReplyCell extends CellOf<'reply'> {
|
|
|
184
185
|
recap?: true
|
|
185
186
|
/** his request for a recap */
|
|
186
187
|
recapAsk?: true
|
|
188
|
+
/** a person's ok or fix on a version that waits for the owner, on their own view (advisors/sync.ts pendingCells): its
|
|
189
|
+
* tone and the version it judges, which their answer bar draws lit */
|
|
190
|
+
advice?: { status: 'approved' | 'approved-with-fix'; on: string }
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
export interface Linked {
|
|
@@ -390,11 +394,11 @@ function messageCells(x: ReviewItem, n: number, opening: Message | undefined, go
|
|
|
390
394
|
const re = reOn ? { id: `${id}/${m.re}`, k: rk + 1, state: reOn.state } : undefined
|
|
391
395
|
const said = update ? `${UPDATE_WORDS[update.state]}: ` : re ? `on update ${re.k}: ` : ''
|
|
392
396
|
// the newest answer: a person with a direct pick may change theirs
|
|
393
|
-
const reply = x.thread
|
|
397
|
+
const reply = findLast(x.thread, (y) => y.re === m.id && y.answer !== undefined && partyOf(y.who) === 'owner')
|
|
394
398
|
// the owner's words alone in a choice's own box answer it as none of the options; a plain reply never does
|
|
395
399
|
const words = reply === undefined && m.ask ? answersTo(x.thread, m).find(wordsAlone) : undefined
|
|
396
400
|
const answers = m.ask ? x.thread.filter((y) => y.re === m.id && y.answer?.option !== undefined) : []
|
|
397
|
-
const ownerPick =
|
|
401
|
+
const ownerPick = findLast(answers, (y) => y.who === 'owner')?.answer?.option
|
|
398
402
|
const people = new Map<string, PersonPick>()
|
|
399
403
|
for (const y of m.ask ? x.thread : []) {
|
|
400
404
|
if (y.who !== 'player' || y.at < m.at) continue
|
package/src/review/store.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// (item-rows.ts), its head and each message, never rewritten; its media wait in the spool beside that file (item-db.ts
|
|
3
3
|
// spoolOf) until the media store sent them up. A view's files are written in a dot folder and land whole, so no reader
|
|
4
4
|
// sees half of one. `io` is the one way in: every function here reads and writes through it
|
|
5
|
+
import { findLast } from '../core/es2022.ts'
|
|
5
6
|
import { ownerCursorAt } from './owner-read.ts'
|
|
6
7
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
7
8
|
import { basename, dirname, extname, join, resolve } from 'node:path'
|
|
@@ -1254,7 +1255,7 @@ export function postAction(dir: string, id: string, a: { name: string; text?: st
|
|
|
1254
1255
|
const text = words === '' ? a.name : words
|
|
1255
1256
|
const now = a.now ?? new Date()
|
|
1256
1257
|
// the same click twice (a double click, a second press while the first was on its way): one act, the first one
|
|
1257
|
-
const twice = x.thread
|
|
1258
|
+
const twice = findLast(x.thread, (m) => m.action !== undefined && partyOf(m.who) === 'owner' && m.re === a.re)
|
|
1258
1259
|
if (twice?.action?.name === a.name && twice.text === text && now.getTime() - Date.parse(twice.at) < SAME_ACT_MS) return twice
|
|
1259
1260
|
return appendMessage(dir, id, { who: 'owner', action: { name: a.name }, text, ...(a.re !== undefined ? { re: a.re } : {}) }, { now })
|
|
1260
1261
|
}
|
|
@@ -175,11 +175,11 @@ function writeHouseFiles(write: (rel: string, body: string) => void, vars: Recor
|
|
|
175
175
|
* include lines pull it into the house contract, so it gets the house half
|
|
176
176
|
* of the day-one shape and nothing that says what the repo IS. Create-only,
|
|
177
177
|
* so every file the repo already holds wins. Returns the paths it wrote */
|
|
178
|
-
export function adoptHouse(root: string, opts: { name: string; today?: string; print?: (line: string) => void; cli?: boolean }): string[] {
|
|
178
|
+
export function adoptHouse(root: string, opts: { name: string; today?: string; print?: (line: string) => void; cli?: boolean; claudePolicy: boolean }): string[] {
|
|
179
179
|
const p = opts.print ?? console.log
|
|
180
180
|
const vars = { NAME: opts.name, PORT: String(defaultHubPort(opts.name)), DATE: opts.today ?? dayStamp(), ...cliIndexVars(opts.name, opts.cli === true) }
|
|
181
181
|
const written: string[] = []
|
|
182
|
-
writeHouseFiles((rel, body) => { if (put(root, rel, body)) written.push(rel) }, vars,
|
|
182
|
+
writeHouseFiles((rel, body) => { if (put(root, rel, body)) written.push(rel) }, vars, opts.claudePolicy, written, p)
|
|
183
183
|
if (written.length > 0) p(`ok: adopted into the house, ${written.length} file(s) seeded: ${written.join(', ')}`)
|
|
184
184
|
return written
|
|
185
185
|
}
|
|
@@ -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
|
|
@@ -207,7 +207,9 @@ class Twin {
|
|
|
207
207
|
const cs = t.ownerDocument.defaultView?.getComputedStyle?.(t)
|
|
208
208
|
if (cs) for (const p of TWIN_COPIES) this.el.style.setProperty(p, cs.getPropertyValue(p))
|
|
209
209
|
this.el.style.width = `${t.clientWidth}px`
|
|
210
|
-
|
|
210
|
+
// the borders as css says them: under a page zoom (WebKit, sk gui) offsetHeight and clientHeight round apart by a
|
|
211
|
+
// px that depends on the height just set, so the box flipped between two heights each frame
|
|
212
|
+
this.edge = cs ? parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth) : t.offsetHeight - t.clientHeight
|
|
211
213
|
const max = parseFloat(cs?.maxHeight ?? '')
|
|
212
214
|
this.max = Number.isFinite(max) ? max : Infinity
|
|
213
215
|
this.rows = rows
|
|
@@ -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') })
|