fnloom 0.1.0 → 0.2.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.
Files changed (113) hide show
  1. package/README.md +31 -18
  2. package/package.json +2 -7
  3. package/packages/build/package.json +1 -1
  4. package/packages/cli/package.json +1 -1
  5. package/packages/cli/src/commands/available.ts +63 -22
  6. package/packages/cli/src/commands/install.ts +86 -28
  7. package/packages/cli/src/index.ts +3 -2
  8. package/packages/cli/src/local.ts +6 -0
  9. package/packages/cli/src/premade.ts +80 -0
  10. package/packages/core/package.json +1 -1
  11. package/packages/hub/package.json +1 -1
  12. package/packages/hub/src/link/process.ts +6 -1
  13. package/packages/sdk/package.json +1 -1
  14. package/packages/web/package.json +1 -1
  15. package/premade/claude.zip +0 -0
  16. package/premade/database.zip +0 -0
  17. package/premade/web.zip +0 -0
  18. package/scripts/dev-env.ts +4 -4
  19. package/scripts/stack.ts +42 -27
  20. package/scripts/start.ts +26 -16
  21. package/systems/api/package.json +1 -1
  22. package/systems/code/package.json +1 -1
  23. package/systems/embedder/package.json +1 -1
  24. package/systems/fs/package.json +1 -1
  25. package/systems/google-calendar/package.json +1 -1
  26. package/systems/input/package.json +1 -1
  27. package/systems/mcp/package.json +1 -1
  28. package/systems/ollama/package.json +1 -1
  29. package/systems/schedule/package.json +1 -1
  30. package/systems/template/package.json +1 -1
  31. package/systems/widgets/package.json +1 -1
  32. package/systems/claude/client/FleetPage.vue +0 -132
  33. package/systems/claude/client/NewSessionForm.vue +0 -62
  34. package/systems/claude/client/SessionList.vue +0 -64
  35. package/systems/claude/client/SessionPage.vue +0 -199
  36. package/systems/claude/client/TaskList.vue +0 -61
  37. package/systems/claude/client/fakes.ts +0 -186
  38. package/systems/claude/client/host.ts +0 -23
  39. package/systems/claude/client/index.ts +0 -15
  40. package/systems/claude/client/logic.ts +0 -270
  41. package/systems/claude/client/state.ts +0 -344
  42. package/systems/claude/package.json +0 -23
  43. package/systems/claude/server/agent-sdk.ts +0 -379
  44. package/systems/claude/server/driver.ts +0 -153
  45. package/systems/claude/server/env.ts +0 -64
  46. package/systems/claude/server/fake-driver.ts +0 -112
  47. package/systems/claude/server/fleet.ts +0 -376
  48. package/systems/claude/server/impl.ts +0 -568
  49. package/systems/claude/server/index.ts +0 -8
  50. package/systems/claude/server/main.ts +0 -38
  51. package/systems/claude/server/preview.ts +0 -76
  52. package/systems/claude/server/questions.ts +0 -117
  53. package/systems/claude/server/transcript.ts +0 -83
  54. package/systems/claude/shared/index.ts +0 -262
  55. package/systems/claude/shared/session.ts +0 -284
  56. package/systems/claude/shared/shapes.ts +0 -106
  57. package/systems/claude/system.json +0 -18
  58. package/systems/claude/tsconfig.json +0 -6
  59. package/systems/database/package.json +0 -25
  60. package/systems/database/server/author.ts +0 -41
  61. package/systems/database/server/authoring.ts +0 -322
  62. package/systems/database/server/catalog.ts +0 -117
  63. package/systems/database/server/compile.ts +0 -332
  64. package/systems/database/server/dialects.ts +0 -17
  65. package/systems/database/server/drivers/database.ts +0 -71
  66. package/systems/database/server/drivers/index.ts +0 -23
  67. package/systems/database/server/drivers/postgres.ts +0 -157
  68. package/systems/database/server/drivers/sqlite.ts +0 -151
  69. package/systems/database/server/drivers/sqlserver.ts +0 -176
  70. package/systems/database/server/env.ts +0 -35
  71. package/systems/database/server/fixture.ts +0 -169
  72. package/systems/database/server/impl.ts +0 -793
  73. package/systems/database/server/index.ts +0 -7
  74. package/systems/database/server/instance.ts +0 -398
  75. package/systems/database/server/main.ts +0 -47
  76. package/systems/database/server/pick.ts +0 -97
  77. package/systems/database/server/queries.ts +0 -390
  78. package/systems/database/server/results.ts +0 -39
  79. package/systems/database/server/schema.ts +0 -59
  80. package/systems/database/server/table-fns.ts +0 -237
  81. package/systems/database/server/types.ts +0 -253
  82. package/systems/database/shared/index.ts +0 -544
  83. package/systems/database/shared/shapes.ts +0 -413
  84. package/systems/database/system.json +0 -14
  85. package/systems/database/tsconfig.json +0 -6
  86. package/systems/web/client/ReadView.vue +0 -110
  87. package/systems/web/client/SearchView.vue +0 -215
  88. package/systems/web/client/StatusChip.vue +0 -38
  89. package/systems/web/client/fakes.ts +0 -48
  90. package/systems/web/client/index.ts +0 -15
  91. package/systems/web/client/view.ts +0 -131
  92. package/systems/web/package.json +0 -22
  93. package/systems/web/server/chrome.ts +0 -121
  94. package/systems/web/server/crawl.ts +0 -333
  95. package/systems/web/server/env.ts +0 -63
  96. package/systems/web/server/guard.ts +0 -60
  97. package/systems/web/server/http.ts +0 -89
  98. package/systems/web/server/impl.ts +0 -203
  99. package/systems/web/server/index.ts +0 -71
  100. package/systems/web/server/loader.ts +0 -104
  101. package/systems/web/server/main.ts +0 -70
  102. package/systems/web/server/mentions.ts +0 -111
  103. package/systems/web/server/problem.ts +0 -72
  104. package/systems/web/server/renderer.ts +0 -243
  105. package/systems/web/server/robots.ts +0 -75
  106. package/systems/web/server/searches.ts +0 -29
  107. package/systems/web/server/tavily.ts +0 -144
  108. package/systems/web/server/testing.ts +0 -165
  109. package/systems/web/server/uploads.ts +0 -33
  110. package/systems/web/shared/index.ts +0 -343
  111. package/systems/web/shared/urls.ts +0 -60
  112. package/systems/web/system.json +0 -15
  113. package/systems/web/tsconfig.json +0 -6
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "name": "@harness/web",
20
20
  "private": true,
21
- "version": "0.1.0",
21
+ "version": "0.2.0",
22
22
  "license": "Apache-2.0",
23
23
  "type": "module",
24
24
  "description": "The chat and admin web app: Vue 3, vue-router, ayepi client callers."
Binary file
Binary file
Binary file
@@ -9,14 +9,14 @@ import { z } from 'zod';
9
9
  import type { ComponentName } from './stack.ts';
10
10
 
11
11
  /** Every process `npm run dev` can run. */
12
- export const COMPONENTS = ['web', 'hub', 'fs', 'embedder', 'web-system', 'input', 'widgets', 'code', 'calendar', 'database', 'claude', 'ollama', 'schedule'] as const satisfies readonly ComponentName[];
12
+ export const COMPONENTS = ['web', 'hub', 'fs', 'embedder', 'web-system', 'input', 'widgets', 'code', 'calendar', 'database', 'claude', 'ollama', 'schedule', 'api'] as const satisfies readonly ComponentName[];
13
13
 
14
- /** What runs when `HARNESS_DEV_ONLY` isn't set: everything but the database and schedule, which run only when asked. */
15
- const DEFAULT_COMPONENTS = COMPONENTS.filter((component) => component !== 'database' && component !== 'schedule');
14
+ /** What runs when `HARNESS_DEV_ONLY` isn't set: everything but the database, schedule and api, which run only when asked. */
15
+ const DEFAULT_COMPONENTS = COMPONENTS.filter((component) => !['database', 'schedule', 'api'].includes(component));
16
16
 
17
17
  /** What `npm run dev` runs, and with what. */
18
18
  export const devEnv = env({
19
- HARNESS_DEV_ONLY: z.string().default(DEFAULT_COMPONENTS.join(',')).describe('npm run dev: a comma list of what to run (web, the build; hub; fs; embedder; web-system, which runs only with TAVILY_API_KEY; input; widgets; code, fns written as programs; claude, Claude Code sessions in the folders beside this repository; calendar, which runs only with GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET; ollama, which runs only with HARNESS_DEV_OLLAMA; schedule, scheduled runs of fns, only when listed; database, a new SQLite file, only when listed).'),
19
+ HARNESS_DEV_ONLY: z.string().default(DEFAULT_COMPONENTS.join(',')).describe('npm run dev: a comma list of what to run (web, the build; hub; fs; embedder; web-system, which runs only with TAVILY_API_KEY; input; widgets; code, fns written as programs; claude, Claude Code sessions in the folders beside this repository; calendar, which runs only with GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET; ollama, which runs only with HARNESS_DEV_OLLAMA; schedule, scheduled runs of fns, only when listed; api, fns that call web APIs, only when listed; database, a new SQLite file, only when listed).'),
20
20
  HARNESS_DEV_RESTART_DELAY: z.coerce.number().int().min(0).default(3_000).describe('npm run dev: how long to wait before restarting a crashed hub or system (ms).'),
21
21
  HARNESS_DEV_CHECK_EVERY: z.coerce.number().int().min(500).default(5_000).describe('npm run dev: how often to check that the hub and each system still answer (ms).'),
22
22
  HARNESS_DEV_START_TIMEOUT: z.coerce.number().int().min(1_000).default(60_000).describe('npm run dev: how long to wait for the hub and each system to start and connect (ms); raise it on a busy machine.'),
package/scripts/stack.ts CHANGED
@@ -11,22 +11,17 @@ import { mkdirSync } from 'node:fs';
11
11
  import { createRequire } from 'node:module';
12
12
  import { networkInterfaces } from 'node:os';
13
13
  import { basename, dirname, join, resolve } from 'node:path';
14
- import { fileURLToPath } from 'node:url';
14
+ import { fileURLToPath, pathToFileURL } from 'node:url';
15
15
  import { InstanceName, SystemName, type Json, type SystemView } from '@harness/core';
16
+ import { Type } from '@aeye/gin';
16
17
  import { encodeValue, type ConfigOf } from '@harness/sdk';
17
18
  import { SYSTEM_ENV } from '@harness/sdk/server';
18
- import { database, type DatabaseContract } from '../systems/database/shared/index.ts';
19
- import { embedderSystem, type EmbedderContract } from '../systems/embedder/shared/index.ts';
20
- import { fs } from '../systems/fs/shared/index.ts';
21
- import { googleCalendar, type CalendarContract } from '../systems/google-calendar/shared/index.ts';
22
- import { input } from '../systems/input/shared/index.ts';
23
- import { widgets } from '../systems/widgets/shared/index.ts';
24
- import { claude } from '../systems/claude/shared/index.ts';
25
- import { ollama, type OllamaConfigInput } from '../systems/ollama/shared/index.ts';
26
- import { code } from '../systems/code/shared/index.ts';
27
- import { schedule } from '../systems/schedule/shared/index.ts';
28
- import { api } from '../systems/api/shared/index.ts';
29
- import { web, type WebContract } from '../systems/web/shared/index.ts';
19
+ import type { DatabaseContract } from '../systems/database/shared/index.ts';
20
+ import type { EmbedderContract } from '../systems/embedder/shared/index.ts';
21
+ import type { fs } from '../systems/fs/shared/index.ts';
22
+ import type { CalendarContract } from '../systems/google-calendar/shared/index.ts';
23
+ import type { OllamaConfigInput } from '../systems/ollama/shared/index.ts';
24
+ import type { WebContract } from '../systems/web/shared/index.ts';
30
25
  import { Supervisor, type SuperviseOptions } from './supervise.ts';
31
26
  import { signIn, waitFor, type Credentials, type SignedIn } from './hub-client.ts';
32
27
 
@@ -178,6 +173,15 @@ async function systemOf(admin: SignedIn, name: SystemName, timeout: number): Pro
178
173
  return (await whileBusy(() => admin.hub.call('systems'), timeout)).find((s) => s.name === name);
179
174
  }
180
175
 
176
+ /** The config type of a system contract a module exports (`<contract>.defs.config`), or undefined. */
177
+ function configTypeOf(contract: unknown): Type | undefined {
178
+ if (typeof contract !== 'object' || contract === null || !('defs' in contract)) { return undefined; }
179
+ const { defs } = contract;
180
+ if (typeof defs !== 'object' || defs === null || !('config' in defs)) { return undefined; }
181
+ // a gin type, as every contract's config is (`system({ config })`)
182
+ return defs.config instanceof Type ? defs.config : undefined;
183
+ }
184
+
181
185
  /** Boot the stack. */
182
186
  export async function startStack(options: StackOptions): Promise<Stack> {
183
187
  const timeout = options.timeout ?? 60_000;
@@ -236,28 +240,38 @@ export async function startStack(options: StackOptions): Promise<Stack> {
236
240
  const admin = await signIn(url, options.admin);
237
241
 
238
242
  const link = `ws://127.0.0.1:${options.port}/link`;
243
+ // each system's contract is loaded only when it runs, so a copy of the harness without a system's folder (the
244
+ // published package leaves the heavy ones out: they install as package zips) runs the others
245
+ const configOf = (folder: string, exported: string, value: unknown) => async (): Promise<Json> => {
246
+ const loaded: unknown = await import(pathToFileURL(join(ROOT, 'systems', folder, 'shared', 'index.ts')).href);
247
+ const found: unknown = typeof loaded === 'object' && loaded !== null ? Reflect.get(loaded, exported) : undefined;
248
+ const config = configTypeOf(found);
249
+ if (config === undefined) { throw new Error(`systems/${folder}/shared/index.ts exports no ${exported} contract`); }
250
+ return encodeValue(config, value);
251
+ };
252
+ const entryOf = (folder: string): string => join(ROOT, 'systems', folder, 'server', 'main.ts');
239
253
  const systems = [
240
- { name: 'fs', entry: join(ROOT, 'systems', 'fs', 'server', 'main.ts'), config: encodeValue(fs.defs.config, options.systems.fs) },
241
- { name: 'embedder', entry: join(ROOT, 'systems', 'embedder', 'server', 'main.ts'), config: encodeValue(embedderSystem.defs.config, options.systems.embedder) },
242
- { name: 'web', entry: join(ROOT, 'systems', 'web', 'server', 'main.ts'), config: encodeValue(web.defs.config, options.systems.web ?? {}) },
243
- { name: 'input', system: input.name, entry: join(ROOT, 'systems', 'input', 'server', 'main.ts'), config: encodeValue(input.defs.config, {}) },
244
- { name: 'widgets', system: widgets.name, entry: join(ROOT, 'systems', 'widgets', 'server', 'main.ts'), config: encodeValue(widgets.defs.config, {}) },
245
- { name: 'code', system: code.name, entry: join(ROOT, 'systems', 'code', 'server', 'main.ts'), config: encodeValue(code.defs.config, {}) },
246
- { name: 'api', system: api.name, entry: join(ROOT, 'systems', 'api', 'server', 'main.ts'), config: encodeValue(api.defs.config, {}) },
254
+ { name: 'fs', entry: entryOf('fs'), config: configOf('fs', 'fs', options.systems.fs) },
255
+ { name: 'embedder', entry: entryOf('embedder'), config: configOf('embedder', 'embedderSystem', options.systems.embedder) },
256
+ { name: 'web', entry: entryOf('web'), config: configOf('web', 'web', options.systems.web ?? {}) },
257
+ { name: 'input', entry: entryOf('input'), config: configOf('input', 'input', {}) },
258
+ { name: 'widgets', entry: entryOf('widgets'), config: configOf('widgets', 'widgets', {}) },
259
+ { name: 'code', entry: entryOf('code'), config: configOf('code', 'code', {}) },
260
+ { name: 'api', entry: entryOf('api'), config: configOf('api', 'api', {}) },
247
261
  // Claude Code sessions may start in any folder beside this repository
248
- { name: 'claude', system: claude.name, entry: join(ROOT, 'systems', 'claude', 'server', 'main.ts'), config: encodeValue(claude.defs.config, { folders: [{ path: dirname(ROOT), label: basename(dirname(ROOT)) }] }) },
262
+ { name: 'claude', entry: entryOf('claude'), config: configOf('claude', 'claude', { folders: [{ path: dirname(ROOT), label: basename(dirname(ROOT)) }] }) },
249
263
  // scheduled runs, with the default limits; it runs only when listed (`only`)
250
- { name: 'schedule', system: schedule.name, entry: join(ROOT, 'systems', 'schedule', 'server', 'main.ts'), config: encodeValue(schedule.defs.config, {}) },
264
+ { name: 'schedule', entry: entryOf('schedule'), config: configOf('schedule', 'schedule', {}) },
251
265
  ...(options.systems.calendar === undefined ? [] : [{
252
- name: 'calendar', system: googleCalendar.name, entry: join(ROOT, 'systems', 'google-calendar', 'server', 'main.ts'), config: encodeValue(googleCalendar.defs.config, options.systems.calendar),
266
+ name: 'calendar', system: 'google-calendar', entry: entryOf('google-calendar'), config: configOf('google-calendar', 'googleCalendar', options.systems.calendar),
253
267
  } as const]),
254
268
  ...(options.systems.ollama === undefined ? [] : [{
255
- name: 'ollama', system: ollama.name, entry: join(ROOT, 'systems', 'ollama', 'server', 'main.ts'), config: encodeValue(ollama.defs.config, options.systems.ollama),
269
+ name: 'ollama', entry: entryOf('ollama'), config: configOf('ollama', 'ollama', options.systems.ollama),
256
270
  } as const]),
257
271
  ...Object.entries(options.systems.databases ?? {}).map(([instance, config]) => ({
258
- name: 'database', system: database.name, instance: InstanceName.parse(instance), entry: join(ROOT, 'systems', 'database', 'server', 'main.ts'), config: encodeValue(database.defs.config, config),
272
+ name: 'database', instance: InstanceName.parse(instance), entry: entryOf('database'), config: configOf('database', 'database', config),
259
273
  } as const)),
260
- ] as const satisfies ReadonlyArray<{ name: keyof typeof SYSTEM_COMPONENTS; system?: string; instance?: InstanceName; entry: string; config: Json }>;
274
+ ] as const satisfies ReadonlyArray<{ name: keyof typeof SYSTEM_COMPONENTS; system?: string; instance?: InstanceName; entry: string; config: () => Promise<Json> }>;
261
275
  for (const system of systems) {
262
276
  const component = SYSTEM_COMPONENTS[system.name];
263
277
  if (!options.only.has(component)) { continue; }
@@ -284,7 +298,8 @@ export async function startStack(options: StackOptions): Promise<Stack> {
284
298
  }, { timeout });
285
299
  // a new instance gets its config even when its defaults let it start without one (the embedder's service URL)
286
300
  if (seen.needsConfig || token !== undefined) {
287
- const result = await whileBusy(() => admin.hub.call('configureSystem', { system: name, config: system.config, ...(instance === undefined ? {} : { instance }) }), timeout);
301
+ const config = await system.config();
302
+ const result =await whileBusy(() => admin.hub.call('configureSystem', { system: name, config, ...(instance === undefined ? {} : { instance }) }), timeout);
288
303
  if ('problems' in result) { throw new Error(`${label} config refused: ${result.problems.join('; ')}`); }
289
304
  await waitFor(`${label} to be configured`, async () => ((await instanceOf(admin, name, instance, timeout))?.status === 'connected' ? true : undefined), { timeout });
290
305
  }
package/scripts/start.ts CHANGED
@@ -9,10 +9,13 @@
9
9
  * the folder it starts in); else the one this command made before, kept in `<data>/admin.json` (readable by its
10
10
  * owner only); else, on the first start, it makes one (`admin@harness.local` and a random password), saves it there
11
11
  * and prints it. The hub makes that account on its first start, as it does from `.env` in the repository.
12
- * - **Systems:** fs (serving `--root`, else `HARNESS_DEV_ROOT`, else the folder it starts in), input, widgets and code
13
- * always; web when `TAVILY_API_KEY` is set; google-calendar when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are;
14
- * embedder when `HARNESS_EMBEDDER_URL` names an EmbeddingGemma service. `--systems` (or `HARNESS_DEV_ONLY`) gives
15
- * the list instead. Every other premade system is installed on demand: `harness system install <name>`.
12
+ * - **Systems:** the lightweight premade systems `PREMADE` (packages/cli/src/premade.ts) marks to start: fs (serving
13
+ * `--root`, else `HARNESS_DEV_ROOT`, else the folder it starts in), input, code, schedule and api always;
14
+ * google-calendar when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are set; embedder when `HARNESS_EMBEDDER_URL`
15
+ * names an EmbeddingGemma service. `--systems` (or `HARNESS_DEV_ONLY`) gives the list instead. Every other premade
16
+ * system is installed on demand (`harness system install <name>`), and the heavy ones (database, web, claude) bring
17
+ * their own dependencies when they are: the published package carries only their package zips, so a heavy one
18
+ * listed in `--systems` is left out here with a word on how to install it.
16
19
  *
17
20
  * Values in `.env` in the starting folder reach the hub and the systems as if they were in the environment.
18
21
  */
@@ -20,19 +23,16 @@ import { chmodSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
20
23
  import { randomBytes } from 'node:crypto';
21
24
  import { join, resolve } from 'node:path';
22
25
  import { loadEnv } from '@ayepi/env/load';
23
- import { ADMIN_FILE, CLI_NAME, connectHub, dataFolder, goLiveWhenPaired, liveApi, readAdminFile, type AdminFile, type StartOptions } from '@harness/cli';
26
+ import {
27
+ ADMIN_FILE, BUNDLED_SYSTEMS_DIR, CLI_NAME, PREMADE, connectHub, dataFolder, goLiveWhenPaired, liveApi, readAdminFile, startComponents, systemOfComponent,
28
+ type AdminFile, type StartOptions,
29
+ } from '@harness/cli';
24
30
  import { SystemName } from '@harness/core';
25
31
  import { runStack, stackSettings } from './run-stack.ts';
26
32
 
27
33
  /** The account `harness start` makes on a first start with none given. */
28
34
  export const DEFAULT_ADMIN_EMAIL = 'admin@harness.local';
29
35
 
30
- /** What `harness start` runs when nothing says otherwise (`web-system`, `calendar` drop out without their keys). */
31
- export const START_SYSTEMS = ['hub', 'fs', 'input', 'widgets', 'code', 'web-system', 'calendar'] as const;
32
-
33
- /** Stack component names that differ from their system's name. */
34
- const STACK_TO_SYSTEM: Readonly<Record<string, string>> = { 'web-system': 'web', calendar: 'google-calendar' };
35
-
36
36
  /** Fill `process.env` from `.env` in the folder, without replacing what is set, so the hub and systems see it too. */
37
37
  function loadDotEnv(cwd: string): void {
38
38
  for (const [name, value] of Object.entries(loadEnv({ files: [join(cwd, '.env')] }))) {
@@ -73,8 +73,15 @@ export async function startHarness(options: StartOptions): Promise<number> {
73
73
  chmodSync(adminFile, 0o600);
74
74
  }
75
75
 
76
- const systems = options.systems ?? environment['HARNESS_DEV_ONLY']
77
- ?? [...START_SYSTEMS, ...(environment['HARNESS_EMBEDDER_URL'] === undefined ? [] : ['embedder'])].join(',');
76
+ const asked = (options.systems ?? environment['HARNESS_DEV_ONLY'] ?? startComponents(environment).join(','))
77
+ .split(',').map((name) => name.trim()).filter((name) => name !== '');
78
+ // a heavy premade system's folder is not in the published package (its package zip is): it runs once installed
79
+ // (`hub` and `web`, the app's build, are no systems)
80
+ const notHere = asked.filter((name) => !['hub', 'web'].includes(name) && PREMADE[systemOfComponent(name)] !== undefined && !existsSync(join(BUNDLED_SYSTEMS_DIR, systemOfComponent(name), 'system.json')));
81
+ for (const name of notHere) {
82
+ out.warn(`${systemOfComponent(name)} is not started by ${CLI_NAME} start here: ${CLI_NAME} system install ${systemOfComponent(name)} installs it, and it starts with the hub after that`);
83
+ }
84
+ const systems = asked.filter((name) => !notHere.includes(name)).join(',');
78
85
  Object.assign(process.env, {
79
86
  HARNESS_PORT: port, HARNESS_DATA: data, HARNESS_ADMIN_EMAIL: email, HARNESS_ADMIN_PASSWORD: password, HARNESS_DEV_ONLY: systems,
80
87
  HARNESS_DEV_ROOT: resolve(cwd, options.root ?? environment['HARNESS_DEV_ROOT'] ?? '.'),
@@ -83,11 +90,12 @@ export async function startHarness(options: StartOptions): Promise<number> {
83
90
  out.line(`Starting the harness on port ${port} (data in ${data}) ...`);
84
91
  const stack = await runStack({ name: 'start', watch: false }, stackSettings());
85
92
  // the premade systems it started go live as the admin would put them (they wait for review otherwise)
86
- const started = systems.split(',').map((name) => name.trim()).filter((name) => !['hub', 'web'].includes(name))
93
+ const started = systems.split(',').filter((name) => name !== '' && !['hub', 'web'].includes(name))
87
94
  // the stack leaves these out without their keys (run-stack.ts)
88
95
  .filter((name) => name !== 'web-system' || process.env['TAVILY_API_KEY'] !== undefined)
89
96
  .filter((name) => name !== 'calendar' || (process.env['GOOGLE_CLIENT_ID'] !== undefined && process.env['GOOGLE_CLIENT_SECRET'] !== undefined))
90
- .map((name) => SystemName.parse(STACK_TO_SYSTEM[name] ?? name));
97
+ .filter((name) => name !== 'ollama' || process.env['HARNESS_DEV_OLLAMA'] !== undefined)
98
+ .map((name) => SystemName.parse(systemOfComponent(name)));
91
99
  const hub = await connectHub({ url: local, admin: { email, password } });
92
100
  try {
93
101
  const unpaired = await goLiveWhenPaired(liveApi(hub.api), started, 60_000);
@@ -105,6 +113,8 @@ export async function startHarness(options: StartOptions): Promise<number> {
105
113
  out.line(` fs serves: ${process.env['HARNESS_DEV_ROOT']}`);
106
114
  out.line('');
107
115
  out.line('Add a model provider under Models > Providers (or set OPENROUTER_API_KEY before the first start).');
108
- out.line(`More systems: ${CLI_NAME} system available, then ${CLI_NAME} system install <name>. Ctrl+C stops everything.`);
116
+ out.line(`Systems running: ${started.join(', ') || 'none'}.`);
117
+ out.line(`More: ${CLI_NAME} system available lists them all; ${CLI_NAME} system install <name> adds one (database, with widgets, for`);
118
+ out.line(' your own tables and charts; web for search and page reading; claude for Claude Code sessions). Ctrl+C stops everything.');
109
119
  return 0;
110
120
  }
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "name": "@harness/system-api",
11
11
  "private": true,
12
- "version": "0.1.0",
12
+ "version": "0.2.0",
13
13
  "license": "Apache-2.0",
14
14
  "type": "module",
15
15
  "description": "Development only: system.json holds this system's name, version and entries. Build 9 skeleton (codeapi lane).",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "name": "@harness/system-code",
11
11
  "private": true,
12
- "version": "0.1.0",
12
+ "version": "0.2.0",
13
13
  "license": "Apache-2.0",
14
14
  "type": "module",
15
15
  "description": "Development only: system.json holds this system's name, version and entries. Build 9 skeleton (codeapi lane).",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "name": "@harness/system-embedder",
10
10
  "private": true,
11
- "version": "0.1.0",
11
+ "version": "0.2.0",
12
12
  "license": "Apache-2.0",
13
13
  "type": "module",
14
14
  "description": "The embedder system: product's EmbeddingGemma service (768 dimensions) as a harness embedder.",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "name": "@harness/system-fs",
18
18
  "private": true,
19
- "version": "0.1.0",
19
+ "version": "0.2.0",
20
20
  "license": "Apache-2.0",
21
21
  "type": "module",
22
22
  "description": "The fs system: files and a shell over chosen folders, served as resources. Can restart itself.",
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "name": "@harness/system-google-calendar",
9
9
  "private": true,
10
- "version": "0.1.0",
10
+ "version": "0.2.0",
11
11
  "license": "Apache-2.0",
12
12
  "type": "module",
13
13
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "name": "@harness/system-input",
12
12
  "private": true,
13
- "version": "0.1.0",
13
+ "version": "0.2.0",
14
14
  "license": "Apache-2.0",
15
15
  "type": "module",
16
16
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "name": "@harness/system-mcp",
12
12
  "private": true,
13
- "version": "0.1.0",
13
+ "version": "0.2.0",
14
14
  "license": "Apache-2.0",
15
15
  "type": "module",
16
16
  "description": "Development only: system.json holds this system's name, version and entries. Build 9 skeleton (mcp lane).",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "name": "@harness/system-ollama",
12
12
  "private": true,
13
- "version": "0.1.0",
13
+ "version": "0.2.0",
14
14
  "license": "Apache-2.0",
15
15
  "type": "module",
16
16
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "name": "@harness/system-schedule",
17
17
  "private": true,
18
- "version": "0.1.0",
18
+ "version": "0.2.0",
19
19
  "license": "Apache-2.0",
20
20
  "type": "module",
21
21
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "name": "@harness/system-template",
10
10
  "private": true,
11
- "version": "0.1.0",
11
+ "version": "0.2.0",
12
12
  "license": "Apache-2.0",
13
13
  "type": "module",
14
14
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "name": "@harness/system-widgets",
13
13
  "private": true,
14
- "version": "0.1.0",
14
+ "version": "0.2.0",
15
15
  "license": "Apache-2.0",
16
16
  "type": "module",
17
17
  "description": "Development only: system.json holds this system's name, version and entries.",
@@ -1,132 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * The Claude fleet (`/s/claude/sessions`): the person's Claude Code sessions on every machine, from the hub's
4
- * `claude/Session` records, searched by words and filtered by machine, folder and status in the hub's database, all in
5
- * the URL, newest change first and read again while the page is open. A session that waits on the person says so.
6
- * New session (`?new=1`) asks for a folder and what to do, starts it as the person's run, answers its approval in the
7
- * dialog when it asks first, then opens the session.
8
- */
9
- import type { Json, Remember } from '@harness/core';
10
- import type { PageViewOf, SelectChoice } from '@harness/sdk';
11
- import { computed, onBeforeUnmount, ref, watch } from 'vue';
12
- import { CLAUDE_PAGES, type ClaudeContract } from '../shared/index.ts';
13
- import NewSessionForm from './NewSessionForm.vue';
14
- import SessionList from './SessionList.vue';
15
- import { choicesOf, fleetUrl, folderName, STATUS_CHOICES, startDraft, type StartDraft } from './logic.ts';
16
- import { ClaudeFleet, ClaudeStarter } from './state.ts';
17
-
18
- /** How often the list is read again while the page is open (ms). */
19
- const REFRESH = 5_000;
20
- /** How long typing rests before the words go to the URL and the hub (ms). */
21
- const SETTLE = 250;
22
-
23
- const view = defineProps<PageViewOf<ClaudeContract>>();
24
- const host = view.host;
25
- const { Frame, Input, Select, Button, LoadState, Empty, Dialog, Approval } = host.components;
26
-
27
- const url = computed(() => fleetUrl(host.query.values));
28
- const machine = host.query.bind('machine');
29
- const folder = host.query.bind('folder');
30
- const status = host.query.bind('status');
31
-
32
- /** The words as typed: they reach the URL (and the hub) once typing rests, and follow the URL when it changes. */
33
- const words = ref(url.value.q ?? '');
34
- let settle: ReturnType<typeof setTimeout> | undefined;
35
- watch(words, (next) => {
36
- clearTimeout(settle);
37
- settle = setTimeout(() => { host.query.set({ q: next.trim() }); }, SETTLE);
38
- });
39
- watch(() => url.value.q ?? '', (next) => { if (next !== words.value.trim()) { words.value = next; } });
40
-
41
- const now = ref(Date.now());
42
- const fleet = new ClaudeFleet(host.hub);
43
- watch(() => JSON.stringify({ ...url.value, new: undefined }), () => { void fleet.show(url.value); }, { immediate: true });
44
- host.live(() => { now.value = Date.now(); void fleet.refresh(); }, REFRESH);
45
-
46
- const sessions = computed(() => fleet.items.value);
47
- const filtered = computed(() => url.value.q !== undefined || url.value.machine !== undefined || url.value.folder !== undefined || url.value.status !== undefined);
48
- const machines = computed((): SelectChoice[] => [{ value: '', label: 'Any machine' }, ...choicesOf(sessions.value, 'instance', url.value.machine).map((name) => ({ value: name, label: name }))]);
49
- const folders = computed((): SelectChoice[] => [{ value: '', label: 'Any folder' }, ...choicesOf(sessions.value, 'folder', url.value.folder).map((path) => ({ value: path, label: folderName(path) }))]);
50
-
51
- function clear(): void {
52
- words.value = '';
53
- host.query.set({ q: undefined, machine: undefined, folder: undefined, status: undefined });
54
- }
55
-
56
- // ── a new session ─────────────────────────────────────────────────────────────
57
-
58
- const starter = new ClaudeStarter((options) => host.runs(options));
59
- const draft = ref<StartDraft>(startDraft(url.value.folder, url.value.machine));
60
- const dialogOpen = computed({ get: () => url.value.new === '1', set: (open: boolean) => { host.query.set({ new: open ? '1' : undefined }, { push: open }); } });
61
- watch(dialogOpen, (open) => { if (open) { draft.value = startDraft(url.value.folder, url.value.machine); } else { starter.close(); } });
62
- onBeforeUnmount(() => { starter.close(); clearTimeout(settle); });
63
-
64
- const usedFolders = computed(() => choicesOf(sessions.value, 'folder', undefined));
65
- const usedMachines = computed(() => choicesOf(sessions.value, 'instance', undefined));
66
-
67
- async function start(): Promise<void> {
68
- const started = await starter.start(draft.value);
69
- if (started === undefined) {
70
- if (starter.problem.value !== '') { host.notify.error("Couldn't start the session", starter.problem.value); }
71
- return;
72
- }
73
- host.notify.ok('Session started');
74
- host.go({ page: CLAUDE_PAGES.session, path: [started.instance, started.session], query: {} });
75
- }
76
-
77
- async function decideStart(approve: boolean, remember: Remember, reason: string, answer: Json | undefined): Promise<void> {
78
- if (!(await starter.decide(approve, remember, reason, answer))) { host.notify.error("Couldn't send your answer", starter.problem.value); }
79
- }
80
- </script>
81
-
82
- <template>
83
- <Frame title="Claude" description="Your Claude Code sessions on every machine: what each is doing, and what waits on you." keep-title>
84
- <template #actions>
85
- <Button variant="primary" icon="plus" data-testid="claude-new" @click="dialogOpen = true">New session</Button>
86
- </template>
87
-
88
- <div class="filters" data-testid="claude-filters">
89
- <Input v-model="words" class="words" type="search" label="Search sessions" hide-label icon="search" placeholder="Search titles, folders and answers" clearable />
90
- <Select v-model="machine.value" :options="machines" label="Machine" hide-label />
91
- <Select v-model="folder.value" :options="folders" label="Folder" hide-label />
92
- <Select v-model="status.value" :options="STATUS_CHOICES" label="Status" hide-label />
93
- </div>
94
-
95
- <LoadState :loading="fleet.loading.value" :problem="fleet.problem.value" :ready="fleet.loaded.value" :empty="sessions.length === 0" @retry="fleet.show(url)">
96
- <SessionList :sessions="sessions" :now="now" />
97
- <div v-if="fleet.hasMore.value" class="more">
98
- <Button variant="ghost" size="sm" :loading="fleet.loadingMore.value" data-testid="claude-more" @click="fleet.more()">Show more</Button>
99
- </div>
100
- <template #empty>
101
- <Empty v-if="filtered" icon="search" title="No sessions match" body="Try other words, or clear the filters.">
102
- <template #actions><Button variant="secondary" @click="clear">Clear filters</Button></template>
103
- </Empty>
104
- <Empty v-else icon="code" title="No Claude sessions yet" body="Start one in a folder on a machine; it shows here with what it is doing and what it needs from you.">
105
- <template #actions><Button variant="primary" icon="plus" @click="dialogOpen = true">New session</Button></template>
106
- </Empty>
107
- </template>
108
- </LoadState>
109
-
110
- <Dialog v-model:open="dialogOpen" title="New Claude session" description="It starts in the folder and works on its own; you answer what it asks." width="600px">
111
- <div class="dialog" data-testid="claude-new-dialog">
112
- <NewSessionForm v-model="draft" :folders="usedFolders" :machines="usedMachines" :problems="starter.problems.value" :disabled="starter.busy.value" />
113
- <Approval v-if="starter.approval.value" :approval="starter.approval.value" in-chat description="Starting a session runs Claude Code on the machine." @decide="decideStart" />
114
- <p v-else-if="starter.phase.value === 'starting'" class="status">Starting the session…</p>
115
- </div>
116
- <template #footer>
117
- <Button variant="ghost" @click="dialogOpen = false">Cancel</Button>
118
- <Button variant="primary" icon="play" :loading="starter.busy.value" data-testid="claude-start" @click="start">Start</Button>
119
- </template>
120
- </Dialog>
121
- </Frame>
122
- </template>
123
-
124
- <style scoped>
125
- .filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
126
- .filters > * { flex: 1 1 140px; min-width: 0; max-width: 220px; }
127
- .filters > .words { flex: 1 1 320px; max-width: none; }
128
- @media (max-width: 759.98px) { .filters > * { max-width: none; } }
129
- .more { display: flex; justify-content: center; padding-top: var(--space-3); }
130
- .dialog { display: grid; gap: var(--space-4); min-width: 0; }
131
- .status { margin: 0; color: var(--text-dim); font-size: var(--text-sm); }
132
- </style>
@@ -1,62 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * The fields of a new Claude session: the machine it starts on (offered when there is more than one), the folder it
4
- * works in (the folders of the person's sessions offered as chips), what Claude should do, a title and the permission
5
- * mode. Problems show under their field.
6
- */
7
- import type { SelectChoice } from '@harness/sdk';
8
- import { computed } from 'vue';
9
- import { usePageHost } from './host.ts';
10
- import { folderName, MODE_CHOICES, type StartDraft } from './logic.ts';
11
-
12
- const props = defineProps<{
13
- /** Folders to offer (where the person's sessions work). */
14
- folders: readonly string[];
15
- /** Machines to offer (where the person's sessions run); the choice shows when there is more than one. */
16
- machines: readonly string[];
17
- problems: Readonly<Record<string, string>>;
18
- disabled?: boolean;
19
- }>();
20
- const draft = defineModel<StartDraft>({ required: true });
21
-
22
- const { Input, Select, Textarea } = usePageHost().components;
23
- const MODES: readonly SelectChoice[] = [{ value: '', label: 'The machine\'s default' }, ...MODE_CHOICES];
24
- const machineChoices = computed((): SelectChoice[] => [{ value: '', label: 'Any machine' }, ...props.machines.map((name) => ({ value: name, label: name }))]);
25
- const offered = computed(() => props.folders.filter((folder) => folder !== draft.value.folder).slice(0, 6));
26
- const set = <K extends keyof StartDraft>(key: K, value: StartDraft[K]): void => { draft.value = { ...draft.value, [key]: value }; };
27
- </script>
28
-
29
- <template>
30
- <div class="form" data-testid="claude-new-form">
31
- <Select
32
- v-if="machines.length > 1" :model-value="draft.machine" :options="machineChoices" label="Machine" :disabled="disabled"
33
- :error="problems['on'] ?? ''" data-testid="claude-machine" @update:model-value="set('machine', $event)"
34
- />
35
- <div class="folder">
36
- <Input
37
- :model-value="draft.folder" label="Folder" placeholder="C:/code/shop" icon="folder" :disabled="disabled"
38
- hint="Under one of the machine's folders." :error="problems['folder'] ?? ''" data-testid="claude-folder" @update:model-value="set('folder', $event)"
39
- />
40
- <div v-if="offered.length > 0" class="chips" aria-label="Folders you used">
41
- <button v-for="folder in offered" :key="folder" type="button" class="chip" :title="folder" :disabled="disabled" @click="set('folder', folder)">{{ folderName(folder) }}</button>
42
- </div>
43
- </div>
44
- <Textarea
45
- :model-value="draft.prompt" label="What should Claude do?" placeholder="Fix the failing checkout test and explain the cause." :rows="4" required :disabled="disabled"
46
- :error="problems['prompt'] ?? ''" data-testid="claude-prompt" @update:model-value="set('prompt', $event)"
47
- />
48
- <div class="pair">
49
- <Input :model-value="draft.title" label="Title" placeholder="From the folder when blank" :disabled="disabled" @update:model-value="set('title', $event)" />
50
- <Select :model-value="draft.mode" :options="MODES" label="Permission mode" :disabled="disabled" @update:model-value="set('mode', $event)" />
51
- </div>
52
- </div>
53
- </template>
54
-
55
- <style scoped>
56
- .form { display: grid; gap: var(--space-4); min-width: 0; }
57
- .folder { display: grid; gap: var(--space-2); min-width: 0; }
58
- .chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
59
- .chip { padding: 2px var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-dim); font: inherit; font-size: var(--text-xs); cursor: pointer; transition: border-color var(--fast, 120ms) var(--ease, ease), color var(--fast, 120ms) var(--ease, ease); }
60
- .chip:hover { border-color: var(--border-strong); color: var(--text); }
61
- .pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
62
- </style>
@@ -1,64 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * The fleet as a list: each session its title and status (how many things wait on the person, when some do), where it
4
- * works (folder and machine), the last thing Claude said, its tasks and when it last changed; each opens its page.
5
- */
6
- import { CLAUDE_PAGES } from '../shared/index.ts';
7
- import { plainClick, usePageHost } from './host.ts';
8
- import { folderName, statusLook, tasksLine, type FleetSession } from './logic.ts';
9
-
10
- defineProps<{ sessions: readonly FleetSession[]; now: number }>();
11
-
12
- const host = usePageHost();
13
- const { Badge, Icon } = host.components;
14
- const to = (item: FleetSession) => ({ page: CLAUDE_PAGES.session, path: [item.value.instance, item.value.session] });
15
-
16
- function open(event: MouseEvent, item: FleetSession): void {
17
- if (plainClick(event)) { host.go(to(item)); }
18
- }
19
- </script>
20
-
21
- <template>
22
- <ul class="list" data-testid="claude-sessions">
23
- <li v-for="item in sessions" :key="item.id" :data-session="item.value.session" :data-waiting="item.value.waiting.length">
24
- <a class="open" :href="host.href(to(item))" data-testid="claude-session-row" @click="open($event, item)">
25
- <span class="mark" aria-hidden="true"><Icon name="code" :size="16" /></span>
26
- <span class="main">
27
- <span class="top">
28
- <span class="name">{{ item.value.title || folderName(item.value.folder) }}</span>
29
- <Badge :tone="statusLook(item.value).tone" dot :live="statusLook(item.value).live" data-testid="status">{{ statusLook(item.value).word }}</Badge>
30
- </span>
31
- <span class="where"><code :title="item.value.folder">{{ item.value.folder }}</code><span class="sep">·</span>{{ item.value.instance }}</span>
32
- <span v-if="item.value.lastText" class="last">{{ item.value.lastText }}</span>
33
- </span>
34
- <span class="side">
35
- <span :title="host.format.fullTime(item.value.updatedAt)">{{ host.format.relativeTime(item.value.updatedAt, now) }}</span>
36
- <span v-if="item.value.costUsd > 0" class="cost">{{ host.format.cost(item.value.costUsd) }}</span>
37
- <span v-if="item.value.tasks.length > 0" class="tasks">{{ tasksLine(item.value.tasks) }}</span>
38
- </span>
39
- </a>
40
- </li>
41
- </ul>
42
- </template>
43
-
44
- <style scoped>
45
- .list { display: grid; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); list-style: none; overflow: hidden; }
46
- .list > li + li { border-top: 1px solid var(--border); }
47
- .open { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); color: var(--text); text-decoration: none; transition: background var(--fast, 120ms) var(--ease, ease); }
48
- .open:hover { background: var(--surface-2); text-decoration: none; }
49
- .open:focus-visible { outline: none; box-shadow: inset var(--ring); }
50
- .mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); background: var(--surface-2); color: var(--text-dim); }
51
- .main { display: grid; gap: 2px; min-width: 0; }
52
- .top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
53
- .name { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
54
- .where { display: flex; gap: var(--space-1); min-width: 0; color: var(--text-dim); font-size: var(--text-xs); white-space: nowrap; }
55
- .where code { overflow: hidden; text-overflow: ellipsis; }
56
- .sep { color: var(--text-faint); }
57
- .last { overflow: hidden; color: var(--text-faint); font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }
58
- .side { display: grid; justify-items: end; gap: 2px; color: var(--text-dim); font-size: var(--text-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
59
- .tasks { color: var(--accent); }
60
- @media (max-width: 559.98px) {
61
- .open { grid-template-columns: auto minmax(0, 1fr); }
62
- .side { grid-column: 2; display: flex; justify-content: flex-start; gap: var(--space-2); }
63
- }
64
- </style>