@ours.network/fleet 2.2.6 → 2.3.1

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 (140) hide show
  1. package/README.md +1 -1
  2. package/dist/application/harness-capabilities.d.ts +60 -0
  3. package/dist/application/harness-capabilities.js +96 -0
  4. package/dist/application/model-catalog.d.ts +17 -0
  5. package/dist/application/model-catalog.js +32 -9
  6. package/dist/application/preset-provenance.d.ts +1 -1
  7. package/dist/application/preset-provenance.js +18 -3
  8. package/dist/application/role-creation-service.d.ts +3 -1
  9. package/dist/application/role-creation-service.js +4 -1
  10. package/dist/application/task-room-service.d.ts +12 -1
  11. package/dist/application/task-room-service.js +39 -16
  12. package/dist/atomic-file.d.ts +2 -0
  13. package/dist/atomic-file.js +2 -1
  14. package/dist/build-info.json +4 -4
  15. package/dist/config.d.ts +6 -0
  16. package/dist/config.js +6 -3
  17. package/dist/docs.d.ts +1 -1
  18. package/dist/docs.js +37 -0
  19. package/dist/harness/claude-code.js +7 -0
  20. package/dist/harness/codex.js +7 -0
  21. package/dist/harness/hermes.js +2 -0
  22. package/dist/harness/types.d.ts +20 -0
  23. package/dist/init-wizard.d.ts +19 -12
  24. package/dist/init-wizard.js +122 -104
  25. package/dist/owner-channel/commands.js +25 -12
  26. package/dist/reports/tasks.js +4 -3
  27. package/dist/rooms-tasks/add-member.d.ts +15 -1
  28. package/dist/rooms-tasks/add-member.js +44 -10
  29. package/dist/rooms-tasks/cli.js +79 -5
  30. package/dist/rooms-tasks/config.js +11 -0
  31. package/dist/rooms-tasks/layout-member-retirement.d.ts +15 -0
  32. package/dist/rooms-tasks/layout-member-retirement.js +26 -1
  33. package/dist/rooms-tasks/layout-service.d.ts +2 -1
  34. package/dist/rooms-tasks/layout-service.js +10 -4
  35. package/dist/rooms-tasks/layout.d.ts +4 -2
  36. package/dist/rooms-tasks/layout.js +21 -4
  37. package/dist/rooms-tasks/member-naming.d.ts +43 -0
  38. package/dist/rooms-tasks/member-naming.js +186 -0
  39. package/dist/rooms-tasks/member-overrides.js +1 -0
  40. package/dist/rooms-tasks/mission-keys.d.ts +83 -0
  41. package/dist/rooms-tasks/mission-keys.js +250 -0
  42. package/dist/rooms-tasks/provision.d.ts +4 -0
  43. package/dist/rooms-tasks/provision.js +37 -3
  44. package/dist/rooms-tasks/task-lists.d.ts +18 -2
  45. package/dist/rooms-tasks/task-lists.js +60 -5
  46. package/dist/rooms-tasks/task-room-name.d.ts +7 -2
  47. package/dist/rooms-tasks/task-room-name.js +13 -4
  48. package/dist/rooms-tasks/task-state.d.ts +40 -0
  49. package/dist/rooms-tasks/task-state.js +288 -45
  50. package/dist/rooms-tasks/types.d.ts +35 -1
  51. package/dist/rooms-tasks/types.js +1 -1
  52. package/dist/web/runtime.js +4 -1
  53. package/dist/web/server.js +116 -50
  54. package/package.json +1 -1
  55. package/presets/README.md +38 -18
  56. package/presets/brain-catalog.json +19 -19
  57. package/presets/legacy/generated-brains-rev4.json +497 -0
  58. package/presets/manifest.json +1 -1
  59. package/presets/fleet/brains/claude-fable-5-1-high.yaml +0 -5
  60. package/presets/fleet/brains/claude-fable-5-1-low.yaml +0 -5
  61. package/presets/fleet/brains/claude-fable-5-1-max.yaml +0 -5
  62. package/presets/fleet/brains/claude-fable-5-1-medium.yaml +0 -5
  63. package/presets/fleet/brains/claude-fable-5-1-xhigh.yaml +0 -5
  64. package/presets/fleet/brains/claude-fable-5-high.yaml +0 -5
  65. package/presets/fleet/brains/claude-fable-5-low.yaml +0 -5
  66. package/presets/fleet/brains/claude-fable-5-max.yaml +0 -5
  67. package/presets/fleet/brains/claude-fable-5-medium.yaml +0 -5
  68. package/presets/fleet/brains/claude-fable-5-xhigh.yaml +0 -5
  69. package/presets/fleet/brains/claude-haiku-4-5-20251001-default.yaml +0 -4
  70. package/presets/fleet/brains/claude-opus-5-5-high.yaml +0 -5
  71. package/presets/fleet/brains/claude-opus-5-5-low.yaml +0 -5
  72. package/presets/fleet/brains/claude-opus-5-5-max.yaml +0 -5
  73. package/presets/fleet/brains/claude-opus-5-5-medium.yaml +0 -5
  74. package/presets/fleet/brains/claude-opus-5-5-xhigh.yaml +0 -5
  75. package/presets/fleet/brains/claude-opus-5-high.yaml +0 -5
  76. package/presets/fleet/brains/claude-opus-5-low.yaml +0 -5
  77. package/presets/fleet/brains/claude-opus-5-max.yaml +0 -5
  78. package/presets/fleet/brains/claude-opus-5-medium.yaml +0 -5
  79. package/presets/fleet/brains/claude-opus-5-xhigh.yaml +0 -5
  80. package/presets/fleet/brains/claude-sonnet-5-high.yaml +0 -5
  81. package/presets/fleet/brains/claude-sonnet-5-low.yaml +0 -5
  82. package/presets/fleet/brains/claude-sonnet-5-max.yaml +0 -5
  83. package/presets/fleet/brains/claude-sonnet-5-medium.yaml +0 -5
  84. package/presets/fleet/brains/claude-sonnet-5-xhigh.yaml +0 -5
  85. package/presets/fleet/brains/codex-gpt-5-3-codex-spark-high.yaml +0 -5
  86. package/presets/fleet/brains/codex-gpt-5-3-codex-spark-low.yaml +0 -5
  87. package/presets/fleet/brains/codex-gpt-5-3-codex-spark-medium.yaml +0 -5
  88. package/presets/fleet/brains/codex-gpt-5-3-codex-spark-xhigh.yaml +0 -5
  89. package/presets/fleet/brains/codex-gpt-5-4-high.yaml +0 -5
  90. package/presets/fleet/brains/codex-gpt-5-4-low.yaml +0 -5
  91. package/presets/fleet/brains/codex-gpt-5-4-medium.yaml +0 -5
  92. package/presets/fleet/brains/codex-gpt-5-4-mini-high.yaml +0 -5
  93. package/presets/fleet/brains/codex-gpt-5-4-mini-low.yaml +0 -5
  94. package/presets/fleet/brains/codex-gpt-5-4-mini-medium.yaml +0 -5
  95. package/presets/fleet/brains/codex-gpt-5-4-mini-xhigh.yaml +0 -5
  96. package/presets/fleet/brains/codex-gpt-5-4-xhigh.yaml +0 -5
  97. package/presets/fleet/brains/codex-gpt-5-5-high.yaml +0 -5
  98. package/presets/fleet/brains/codex-gpt-5-5-low.yaml +0 -5
  99. package/presets/fleet/brains/codex-gpt-5-5-medium.yaml +0 -5
  100. package/presets/fleet/brains/codex-gpt-5-5-xhigh.yaml +0 -5
  101. package/presets/fleet/brains/codex-gpt-5-6-luna-high.yaml +0 -5
  102. package/presets/fleet/brains/codex-gpt-5-6-luna-low.yaml +0 -5
  103. package/presets/fleet/brains/codex-gpt-5-6-luna-max.yaml +0 -5
  104. package/presets/fleet/brains/codex-gpt-5-6-luna-medium.yaml +0 -5
  105. package/presets/fleet/brains/codex-gpt-5-6-luna-xhigh.yaml +0 -5
  106. package/presets/fleet/brains/codex-gpt-5-6-sol-high.yaml +0 -5
  107. package/presets/fleet/brains/codex-gpt-5-6-sol-low.yaml +0 -5
  108. package/presets/fleet/brains/codex-gpt-5-6-sol-max.yaml +0 -5
  109. package/presets/fleet/brains/codex-gpt-5-6-sol-medium.yaml +0 -5
  110. package/presets/fleet/brains/codex-gpt-5-6-sol-ultra.yaml +0 -5
  111. package/presets/fleet/brains/codex-gpt-5-6-sol-xhigh.yaml +0 -5
  112. package/presets/fleet/brains/codex-gpt-5-6-terra-high.yaml +0 -5
  113. package/presets/fleet/brains/codex-gpt-5-6-terra-low.yaml +0 -5
  114. package/presets/fleet/brains/codex-gpt-5-6-terra-max.yaml +0 -5
  115. package/presets/fleet/brains/codex-gpt-5-6-terra-medium.yaml +0 -5
  116. package/presets/fleet/brains/codex-gpt-5-6-terra-ultra.yaml +0 -5
  117. package/presets/fleet/brains/codex-gpt-5-6-terra-xhigh.yaml +0 -5
  118. package/presets/fleet/brains/codex-gpt-6-1-sol-high.yaml +0 -5
  119. package/presets/fleet/brains/codex-gpt-6-1-sol-low.yaml +0 -5
  120. package/presets/fleet/brains/codex-gpt-6-1-sol-max.yaml +0 -5
  121. package/presets/fleet/brains/codex-gpt-6-1-sol-medium.yaml +0 -5
  122. package/presets/fleet/brains/codex-gpt-6-1-sol-ultra.yaml +0 -5
  123. package/presets/fleet/brains/codex-gpt-6-1-sol-xhigh.yaml +0 -5
  124. package/presets/fleet/brains/codex-gpt-6-astra-high.yaml +0 -5
  125. package/presets/fleet/brains/codex-gpt-6-astra-low.yaml +0 -5
  126. package/presets/fleet/brains/codex-gpt-6-astra-max.yaml +0 -5
  127. package/presets/fleet/brains/codex-gpt-6-astra-medium.yaml +0 -5
  128. package/presets/fleet/brains/codex-gpt-6-astra-ultra.yaml +0 -5
  129. package/presets/fleet/brains/codex-gpt-6-astra-xhigh.yaml +0 -5
  130. package/presets/fleet/brains/codex-gpt-6-luna-high.yaml +0 -5
  131. package/presets/fleet/brains/codex-gpt-6-luna-low.yaml +0 -5
  132. package/presets/fleet/brains/codex-gpt-6-luna-max.yaml +0 -5
  133. package/presets/fleet/brains/codex-gpt-6-luna-medium.yaml +0 -5
  134. package/presets/fleet/brains/codex-gpt-6-luna-xhigh.yaml +0 -5
  135. package/presets/fleet/brains/codex-gpt-6-sol-high.yaml +0 -5
  136. package/presets/fleet/brains/codex-gpt-6-sol-low.yaml +0 -5
  137. package/presets/fleet/brains/codex-gpt-6-sol-max.yaml +0 -5
  138. package/presets/fleet/brains/codex-gpt-6-sol-medium.yaml +0 -5
  139. package/presets/fleet/brains/codex-gpt-6-sol-ultra.yaml +0 -5
  140. package/presets/fleet/brains/codex-gpt-6-sol-xhigh.yaml +0 -5
@@ -2,19 +2,18 @@ import type { Stats } from 'node:fs';
2
2
  import type { ReadStream, WriteStream } from 'node:tty';
3
3
  export type Subscription = 'codex' | 'claude';
4
4
  export type WorkKind = 'development' | 'review' | 'coordination';
5
- export type ReasoningPreference = 'quick' | 'balanced' | 'thorough';
6
5
  export type AssignmentStrategy = 'one-model' | 'per-job';
7
- export interface CatalogModel {
6
+ /** The exact harness, model and effort chosen for one purpose; `effort: null` only for a model without effort. */
7
+ export interface PurposeChoice {
8
8
  harness: 'codex' | 'claude-code';
9
9
  session: 'acp';
10
10
  model: string;
11
- efforts: string[];
11
+ effort: string | null;
12
12
  }
13
13
  export interface InitAnswers {
14
14
  subscriptions: Subscription[];
15
15
  assignmentStrategy: AssignmentStrategy;
16
- models: Record<WorkKind, CatalogModel>;
17
- reasoning: ReasoningPreference;
16
+ models: Record<WorkKind, PurposeChoice>;
18
17
  }
19
18
  export interface Choice<T> {
20
19
  label: string;
@@ -26,10 +25,6 @@ export interface InitPrompter {
26
25
  select<T>(message: string, choices: Choice<T>[], initial?: number): Promise<T | undefined>;
27
26
  note(message: string): void;
28
27
  }
29
- export interface BrainCatalog {
30
- schema_version: number;
31
- models: CatalogModel[];
32
- }
33
28
  export interface GeneratedSetup {
34
29
  files: Map<string, string>;
35
30
  answers: InitAnswers;
@@ -48,15 +43,27 @@ export interface InitExecutionDeps {
48
43
  generate?(answers: InitAnswers): GeneratedSetup;
49
44
  preflight?(configuration: string): InitPathState;
50
45
  }
51
- export declare function validateCatalog(value: BrainCatalog, path?: string): BrainCatalog;
46
+ /** The three editable purpose Brains setup creates, by kind of work. */
47
+ export declare const PURPOSE_BRAINS: Record<WorkKind, {
48
+ id: string;
49
+ label: string;
50
+ }>;
52
51
  /** Read and validate the complete public InitAnswers JSON shape without side effects. */
53
52
  export declare function readInitSettings(path: string): InitAnswers;
54
53
  export declare function askInitQuestions(prompter: InitPrompter, configuration: string): Promise<InitAnswers | undefined>;
55
54
  export declare function formatSetupSummary(answers: InitAnswers, configuration: string): string;
56
- /** The packaged Brain preset for a catalog model at one effort; the same naming the presets are generated with. */
57
- export declare function brainPresetId(model: Pick<CatalogModel, 'harness' | 'model'>, effort: string): string;
55
+ /** The YAML of one purpose Brain holding exactly the chosen triple. */
56
+ export declare function purposeBrainYaml(work: WorkKind, choice: PurposeChoice): string;
58
57
  /** Build the exact, deterministic default experience without writing to disk. */
59
58
  export declare function generateSetup(answers: InitAnswers): GeneratedSetup;
59
+ /** Setup stopped because an existing purpose Brain holds other settings than the chosen ones. */
60
+ export declare class PurposeBrainConflictError extends Error {
61
+ }
62
+ /**
63
+ * Setup preserves existing files. A purpose Brain that already exists with a different
64
+ * harness, session, model or effort is never overwritten; setup stops and says so.
65
+ */
66
+ export declare function purposeBrainConflicts(configuration: string, answers: InitAnswers): string[];
60
67
  /** Run the mutation boundary only after the complete questionnaire is accepted. */
61
68
  export declare function executeInitWizard(prompter: InitPrompter, configuration: string, deps: InitExecutionDeps): Promise<InitPublishResult | undefined>;
62
69
  /** Execute already-collected answers through the same validation and mutation boundary. */
@@ -4,58 +4,25 @@ import { basename, dirname, join, resolve } from 'node:path';
4
4
  import { replaceFileAtomically, withFileLock } from './atomic-file.js';
5
5
  import { loadConfig, splitRootFor } from './config.js';
6
6
  import { packagedPresetRoot } from './preset-bootstrap.js';
7
+ import { packagedModelCatalog } from './application/model-catalog.js';
8
+ import { parse as parseYaml } from 'yaml';
7
9
  import { listTemplates } from './rooms-tasks/templates.js';
8
10
  const WORK_KINDS = ['development', 'review', 'coordination'];
9
11
  const ROLE_WORK = {
10
12
  Developer: 'development', Engineer: 'development', Critic: 'review',
11
13
  LocalCoordinator: 'coordination', Coordinator: 'coordination', FleetCoordinator: 'coordination',
12
14
  };
13
- const REASONING_EFFORT = {
14
- quick: 'low', balanced: 'medium', thorough: 'high',
15
+ /** The three editable purpose Brains setup creates, by kind of work. */
16
+ export const PURPOSE_BRAINS = {
17
+ development: { id: 'development', label: 'Development' },
18
+ review: { id: 'critic', label: 'Critic' },
19
+ coordination: { id: 'coordination', label: 'Coordination' },
15
20
  };
16
- const MODEL_LABELS = {
17
- 'gpt-6.1-sol': 'GPT-6.1 Sol',
18
- 'gpt-6-sol': 'GPT-6 Sol',
19
- 'gpt-6-luna': 'GPT-6 Luna',
20
- 'claude-fable-5-1': 'Claude Fable 5.1',
21
- 'claude-opus-5-5': 'Claude Opus 5.5',
22
- 'claude-haiku-4-5-20251001': 'Claude Haiku 4.5',
23
- 'gpt-6-astra': 'GPT-6 Astra',
24
- 'gpt-5.6-sol': 'GPT-5.6 Sol',
25
- 'gpt-5.6-terra': 'GPT-5.6 Terra',
26
- 'gpt-5.6-luna': 'GPT-5.6 Luna',
27
- 'gpt-5.5': 'GPT-5.5',
28
- 'gpt-5.4': 'GPT-5.4',
29
- 'gpt-5.4-mini': 'GPT-5.4 Mini',
30
- 'gpt-5.3-codex-spark': 'GPT-5.3 Codex Spark',
31
- 'claude-fable-5': 'Claude Fable 5',
32
- 'claude-opus-5': 'Claude Opus 5',
33
- 'claude-sonnet-5': 'Claude Sonnet 5',
34
- };
35
- export function validateCatalog(value, path = 'supported model catalog') {
36
- if (value.schema_version !== 1 || !Array.isArray(value.models) || value.models.length === 0)
37
- throw new Error(`invalid supported model catalog: ${path}`);
38
- const tuples = new Set();
39
- for (const model of value.models) {
40
- if (!['codex', 'claude-code'].includes(model.harness) || model.session !== 'acp'
41
- || typeof model.model !== 'string' || !MODEL_LABELS[model.model]
42
- || !Array.isArray(model.efforts)
43
- || new Set(model.efforts).size !== model.efforts.length
44
- || model.efforts.some(effort => !['low', 'medium', 'high', 'xhigh', 'max', 'ultra'].includes(effort))
45
- || (model.efforts.length > 0 && !['low', 'medium', 'high'].every(effort => model.efforts.includes(effort))))
46
- throw new Error(`unsupported model state in ${path}`);
47
- const tuple = `${model.harness}\0${model.session}\0${model.model}`;
48
- if (tuples.has(tuple))
49
- throw new Error(`duplicate supported model in ${path}: ${model.model}`);
50
- tuples.add(tuple);
51
- }
52
- return value;
53
- }
54
- function catalog() {
55
- const path = join(packagedPresetRoot(), 'brain-catalog.json');
56
- return validateCatalog(JSON.parse(readFileSync(path, 'utf8')), path);
57
- }
21
+ // Legacy --settings files chose one reasoning level for every purpose.
22
+ const LEGACY_REASONING = { quick: 'low', balanced: 'medium', thorough: 'high' };
23
+ const labelOf = (choice) => packagedModelCatalog().find(model => model.harness === choice.harness && model.model === choice.model)?.label ?? choice.model;
58
24
  const hasExactKeys = (value, keys) => Object.keys(value).sort().join('\0') === [...keys].sort().join('\0');
25
+ const isObject = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
59
26
  /** Read and validate the complete public InitAnswers JSON shape without side effects. */
60
27
  export function readInitSettings(path) {
61
28
  let value;
@@ -65,21 +32,38 @@ export function readInitSettings(path) {
65
32
  catch (error) {
66
33
  throw new Error(`cannot read valid Fleet init settings ${path}: ${error.message}`, { cause: error });
67
34
  }
68
- if (!value || typeof value !== 'object' || Array.isArray(value)
69
- || !hasExactKeys(value, ['subscriptions', 'assignmentStrategy', 'models', 'reasoning']))
70
- throw new Error('Fleet init settings must contain exactly subscriptions, assignmentStrategy, models, and reasoning');
71
- const candidate = value;
72
- const models = candidate.models;
73
- if (!models || typeof models !== 'object' || Array.isArray(models)
74
- || !hasExactKeys(models, WORK_KINDS))
35
+ if (!isObject(value))
36
+ throw new Error('Fleet init settings must be a JSON object');
37
+ const legacy = hasExactKeys(value, ['subscriptions', 'assignmentStrategy', 'models', 'reasoning']);
38
+ if (!legacy && !hasExactKeys(value, ['subscriptions', 'assignmentStrategy', 'models']))
39
+ throw new Error('Fleet init settings must contain exactly subscriptions, assignmentStrategy, and models');
40
+ const models = value.models;
41
+ if (!isObject(models) || !hasExactKeys(models, WORK_KINDS))
75
42
  throw new Error('Fleet init settings models must contain exactly development, review, and coordination');
43
+ const chosen = {};
76
44
  for (const work of WORK_KINDS) {
77
45
  const model = models[work];
78
- if (!model || typeof model !== 'object' || Array.isArray(model)
79
- || !hasExactKeys(model, ['harness', 'session', 'model', 'efforts']))
80
- throw new Error(`Fleet init settings ${work} model must contain exactly harness, session, model, and efforts`);
46
+ if (legacy) {
47
+ // The earlier shape: catalog entries plus one reasoning level; each purpose gets that exact effort.
48
+ if (!isObject(model) || !hasExactKeys(model, ['harness', 'session', 'model', 'efforts']))
49
+ throw new Error(`Fleet init settings ${work} model must contain exactly harness, session, model, and efforts`);
50
+ const effort = LEGACY_REASONING[String(value.reasoning)];
51
+ if (!effort)
52
+ throw new Error(`unsupported reasoning preference: ${String(value.reasoning)}`);
53
+ chosen[work] = { harness: model.harness, session: model.session,
54
+ model: model.model, effort };
55
+ }
56
+ else {
57
+ if (!isObject(model) || !hasExactKeys(model, ['harness', 'session', 'model', 'effort']))
58
+ throw new Error(`Fleet init settings ${work} model must contain exactly harness, session, model, and effort`);
59
+ chosen[work] = model;
60
+ }
81
61
  }
82
- const answers = value;
62
+ const answers = {
63
+ subscriptions: value.subscriptions,
64
+ assignmentStrategy: value.assignmentStrategy,
65
+ models: chosen,
66
+ };
83
67
  // Generation is the single semantic/catalog validator for wizard and file input.
84
68
  generateSetup(answers);
85
69
  return answers;
@@ -96,9 +80,7 @@ export async function askInitQuestions(prompter, configuration) {
96
80
  return undefined;
97
81
  if (subscriptions.length === 0)
98
82
  throw new Error('Select at least one subscription.');
99
- // The wizard assigns low/medium/high; no-effort models remain available as named presets.
100
- const available = catalog().models.filter(model => subscriptions.includes(subscriptionFor(model))
101
- && model.efforts.length > 0);
83
+ const available = packagedModelCatalog().filter(model => subscriptions.includes(subscriptionFor(model)));
102
84
  if (!available.length)
103
85
  throw new Error('None of the selected subscriptions has a supported model.');
104
86
  prompter.note([
@@ -112,35 +94,41 @@ export async function askInitQuestions(prompter, configuration) {
112
94
  if (!assignmentStrategy)
113
95
  return undefined;
114
96
  const choices = available.map(model => ({
115
- label: `${MODEL_LABELS[model.model]} (${subscriptionFor(model) === 'codex' ? 'Codex' : 'Claude'}) — ${model.model}; supported catalog ID, not a recommendation`,
97
+ label: `${model.label} (${subscriptionFor(model) === 'codex' ? 'Codex' : 'Claude'}) — ${model.model}; supported catalog ID, not a recommendation`,
116
98
  value: model,
117
99
  }));
100
+ const askEffort = async (purpose, model) => {
101
+ if (!model.efforts.length) {
102
+ prompter.note(`${model.label} has no effort setting; the ${purpose} Brain sets none.`);
103
+ return null;
104
+ }
105
+ const initial = Math.max(0, model.efforts.indexOf('medium'));
106
+ return prompter.select(`Which effort should the ${purpose} Brain use with ${model.label}?`, model.efforts.map(effort => ({ label: effort, value: effort })), initial);
107
+ };
118
108
  const selected = {};
119
109
  if (assignmentStrategy === 'one-model') {
120
110
  const model = await prompter.select('Which model should handle every job?', choices, 0);
121
111
  if (!model)
122
112
  return undefined;
123
- for (const work of WORK_KINDS)
124
- selected[work] = model;
113
+ for (const work of WORK_KINDS) {
114
+ const effort = await askEffort(PURPOSE_BRAINS[work].label, model);
115
+ if (effort === undefined)
116
+ return undefined;
117
+ selected[work] = { harness: model.harness, session: model.session, model: model.model, effort };
118
+ }
125
119
  }
126
120
  else {
127
121
  for (const work of WORK_KINDS) {
128
- const model = await prompter.select(`Which model should handle ${work}?`, choices, 0);
122
+ const model = await prompter.select(`Which model should the ${PURPOSE_BRAINS[work].label} Brain use?`, choices, 0);
129
123
  if (!model)
130
124
  return undefined;
131
- selected[work] = model;
125
+ const effort = await askEffort(PURPOSE_BRAINS[work].label, model);
126
+ if (effort === undefined)
127
+ return undefined;
128
+ selected[work] = { harness: model.harness, session: model.session, model: model.model, effort };
132
129
  }
133
130
  }
134
- const reasoning = await prompter.select('How much reasoning should Fleet use?', [
135
- { label: 'Quick — favor speed', value: 'quick' },
136
- { label: 'Balanced — everyday work', value: 'balanced' },
137
- { label: 'Thorough — harder work', value: 'thorough' },
138
- ], 1);
139
- if (!reasoning)
140
- return undefined;
141
- const answers = {
142
- subscriptions: [...subscriptions].sort(), assignmentStrategy, models: selected, reasoning,
143
- };
131
+ const answers = { subscriptions: [...subscriptions].sort(), assignmentStrategy, models: selected };
144
132
  const summary = formatSetupSummary(answers, configuration);
145
133
  const finalized = await prompter.confirm('Create this default Fleet setup?', `${summary}\n\nNo changes have been made yet.`);
146
134
  return finalized ? answers : undefined;
@@ -153,18 +141,17 @@ export function formatSetupSummary(answers, configuration) {
153
141
  const existing = configExists && rootExists ? 'both targets exist'
154
142
  : configExists ? 'only the manifest exists'
155
143
  : rootExists ? 'only the split configuration directory exists' : 'neither target exists';
156
- const friendly = (work) => `${MODEL_LABELS[answers.models[work].model]} (${subscriptionFor(answers.models[work]) === 'codex' ? 'Codex' : 'Claude'}, ${answers.models[work].model})`;
157
- const effort = REASONING_EFFORT[answers.reasoning];
144
+ const friendly = (work) => {
145
+ const choice = answers.models[work];
146
+ return `${PURPOSE_BRAINS[work].label} Brain (${PURPOSE_BRAINS[work].id}): ${labelOf(choice)} (${subscriptionFor(choice) === 'codex' ? 'Codex' : 'Claude'}, ${choice.model}), effort ${choice.effort ?? 'none (model has no effort setting)'}`;
147
+ };
158
148
  return [
159
149
  'Your default Fleet setup:',
160
150
  ` Manifest: ${configPath}`,
161
151
  ` Split configuration: ${splitRoot}`,
162
152
  ` Existing state: ${existing}`,
163
153
  ` Model assignment: ${answers.assignmentStrategy === 'one-model' ? 'one model for every job' : 'different models by job'}`,
164
- ` Development: ${friendly('development')}`,
165
- ` Review: ${friendly('review')}`,
166
- ` Coordination: ${friendly('coordination')}`,
167
- ` Reasoning: ${answers.reasoning[0].toUpperCase()}${answers.reasoning.slice(1)} -> ${effort}`,
154
+ ...WORK_KINDS.map(work => ` ${friendly(work)}`),
168
155
  ' Availability: catalog support is not a recommendation or entitlement claim',
169
156
  ' Entitlement check: run ours-fleet doctor for Codex; Claude is validated when a role launches',
170
157
  ' Automatic model fallback: none (no model_chain is generated)',
@@ -172,8 +159,8 @@ export function formatSetupSummary(answers, configuration) {
172
159
  ' Reviewed pair: Developer + independent Critic',
173
160
  ' Team: LocalCoordinator + Developer + Critic',
174
161
  ' Gated engineering: Engineer (gate pipeline) + independent Critic',
175
- ' FleetCoordinator: coordination model',
176
- ' Brains: the packaged presets; each prepared agent references the preset of its chosen model',
162
+ ' FleetCoordinator: Coordination Brain',
163
+ ' Brains: three editable purpose Brains (development, critic, coordination); change them or add more in Settings > Brains',
177
164
  '',
178
165
  'After the final Yes, Fleet performs host service setup before publishing the complete configuration.',
179
166
  'A hard termination after that Yes can leave host integration or private stage/recovery evidence to inspect.',
@@ -182,23 +169,26 @@ export function formatSetupSummary(answers, configuration) {
182
169
  function preset(relative) {
183
170
  return readFileSync(join(packagedPresetRoot(), 'fleet', relative), 'utf8');
184
171
  }
185
- /** The packaged Brain preset for a catalog model at one effort; the same naming the presets are generated with. */
186
- export function brainPresetId(model, effort) {
187
- return `${model.harness === 'claude-code' ? 'claude' : 'codex'}-${model.model
188
- .replace(/^claude-/, '').replace(/\./g, '-').toLowerCase()}-${effort}`;
172
+ /** The YAML of one purpose Brain holding exactly the chosen triple. */
173
+ export function purposeBrainYaml(work, choice) {
174
+ return [
175
+ `# ${PURPOSE_BRAINS[work].label} Brain created by Fleet setup. Edit it in Settings > Brains.`,
176
+ `harness: ${choice.harness}`,
177
+ `session: ${choice.session}`,
178
+ `model: ${choice.model}`,
179
+ ...(choice.effort === null ? [] : [`effort: ${choice.effort}`]),
180
+ '',
181
+ ].join('\n');
189
182
  }
190
183
  /** Build the exact, deterministic default experience without writing to disk. */
191
184
  export function generateSetup(answers) {
192
- const effort = REASONING_EFFORT[answers.reasoning];
193
- if (!effort)
194
- throw new Error(`unsupported reasoning preference: ${String(answers.reasoning)}`);
195
185
  if (!['one-model', 'per-job'].includes(answers.assignmentStrategy))
196
186
  throw new Error(`unsupported model assignment strategy: ${String(answers.assignmentStrategy)}`);
197
187
  if (!Array.isArray(answers.subscriptions) || answers.subscriptions.length === 0
198
188
  || new Set(answers.subscriptions).size !== answers.subscriptions.length
199
189
  || answers.subscriptions.some(subscription => !['codex', 'claude'].includes(subscription)))
200
190
  throw new Error('subscriptions must be a non-empty unique selection of Codex and/or Claude');
201
- const supported = catalog().models;
191
+ const supported = packagedModelCatalog();
202
192
  const files = new Map();
203
193
  files.set('fleet.yaml', [
204
194
  'api_version: ours.network/fleet/v2',
@@ -207,9 +197,8 @@ export function generateSetup(answers) {
207
197
  ' permissions: { approval: ask, filesystem: workspace, unattended: deny }',
208
198
  '',
209
199
  ].join('\n'));
210
- const assigned = {};
211
200
  for (const work of WORK_KINDS) {
212
- const proposed = answers.models[work];
201
+ const proposed = answers.models?.[work];
213
202
  if (!proposed || !answers.subscriptions.includes(subscriptionFor(proposed)))
214
203
  throw new Error(`${work} uses a model outside the selected subscriptions`);
215
204
  const matches = supported.filter(model => model.harness === proposed.harness
@@ -217,18 +206,16 @@ export function generateSetup(answers) {
217
206
  if (matches.length !== 1)
218
207
  throw new Error(`${work} uses an unknown or ambiguous supported model`);
219
208
  const model = matches[0];
220
- if (JSON.stringify(proposed.efforts) !== JSON.stringify(model.efforts))
221
- throw new Error(`${work} contains tampered model capabilities`);
222
- if (!model.efforts.includes(effort))
223
- throw new Error(`${MODEL_LABELS[model.model]} does not support ${answers.reasoning} reasoning`);
224
- // The chosen model is assigned by reference to its packaged Brain preset; setup defines no Brain of its own.
225
- const id = brainPresetId(model, effort);
226
- if (!existsSync(join(packagedPresetRoot(), 'fleet', 'brains', `${id}.yaml`)))
227
- throw new Error(`no packaged Brain preset for ${MODEL_LABELS[model.model]} at ${effort} reasoning`);
228
- assigned[work] = id;
209
+ // The chosen effort is kept exactly; nothing is substituted.
210
+ if (model.efforts.length === 0) {
211
+ if (proposed.effort !== null)
212
+ throw new Error(`${model.label} has no effort setting; ${work} effort must be null`);
213
+ }
214
+ else if (typeof proposed.effort !== 'string' || !model.efforts.includes(proposed.effort)) {
215
+ throw new Error(`${model.label} does not support effort '${String(proposed.effort)}' for ${work}; choose one of: ${model.efforts.join(', ')}`);
216
+ }
217
+ files.set(`brains/${PURPOSE_BRAINS[work].id}.yaml`, purposeBrainYaml(work, proposed));
229
218
  }
230
- for (const name of readdirSync(join(packagedPresetRoot(), 'fleet', 'brains')).filter(name => name.endsWith('.yaml')).sort())
231
- files.set(`brains/${name}`, preset(`brains/${name}`));
232
219
  if (answers.assignmentStrategy === 'one-model') {
233
220
  const tuples = new Set(WORK_KINDS.map(work => {
234
221
  const model = answers.models[work];
@@ -243,7 +230,7 @@ export function generateSetup(answers) {
243
230
  continue;
244
231
  files.set(`agent_templates/${role}.yaml`, [
245
232
  `role: { ref: ${role} }`,
246
- `brain: { ref: ${assigned[ROLE_WORK[role]]} }`,
233
+ `brain: { ref: ${PURPOSE_BRAINS[ROLE_WORK[role]].id} }`,
247
234
  'coordinator: FleetCoordinator',
248
235
  // Temporary default while the product is being tested: prepared agents work without asking.
249
236
  'permissions: { approval: allow, filesystem: unrestricted, unattended: deny }',
@@ -252,13 +239,40 @@ export function generateSetup(answers) {
252
239
  ].join('\n'));
253
240
  }
254
241
  files.set('agents/FleetCoordinator.yaml', preset('agents/FleetCoordinator.yaml')
255
- .replace('brain: { ref: claude-default }', `brain: { ref: ${assigned.coordination} }`));
242
+ .replace('brain: { ref: claude-default }', `brain: { ref: ${PURPOSE_BRAINS.coordination.id} }`));
256
243
  for (const name of ['single', 'pair', 'team', 'engineering']) {
257
244
  files.set(`room_templates/${name}.yaml`, preset(`room_templates/${name}.yaml`));
258
245
  files.set(`room_layouts/${name}.yaml`, preset(`room_layouts/${name}.yaml`));
259
246
  }
260
247
  return { files, answers };
261
248
  }
249
+ /** Setup stopped because an existing purpose Brain holds other settings than the chosen ones. */
250
+ export class PurposeBrainConflictError extends Error {
251
+ }
252
+ /**
253
+ * Setup preserves existing files. A purpose Brain that already exists with a different
254
+ * harness, session, model or effort is never overwritten; setup stops and says so.
255
+ */
256
+ export function purposeBrainConflicts(configuration, answers) {
257
+ const brains = join(splitRootFor(resolve(configuration)), 'brains');
258
+ return WORK_KINDS.flatMap(work => {
259
+ const { id } = PURPOSE_BRAINS[work];
260
+ const path = join(brains, `${id}.yaml`);
261
+ if (!existsSync(path))
262
+ return [];
263
+ let value;
264
+ try {
265
+ value = (parseYaml(readFileSync(path, 'utf8')) ?? {});
266
+ }
267
+ catch {
268
+ return [`brains/${id}.yaml exists and cannot be read`];
269
+ }
270
+ const wanted = answers.models[work];
271
+ const same = value.harness === wanted.harness && (value.session ?? 'acp') === wanted.session
272
+ && value.model === wanted.model && (value.effort ?? null) === wanted.effort;
273
+ return same ? [] : [`brains/${id}.yaml already exists with different settings`];
274
+ });
275
+ }
262
276
  /** Run the mutation boundary only after the complete questionnaire is accepted. */
263
277
  export async function executeInitWizard(prompter, configuration, deps) {
264
278
  const answers = await askInitQuestions(prompter, configuration);
@@ -273,6 +287,10 @@ export async function executeInitAnswers(answers, configuration, deps) {
273
287
  // deterministically in tests.
274
288
  const setup = (deps.generate ?? generateSetup)(answers);
275
289
  (deps.preflight ?? preflightInitPaths)(configuration);
290
+ const conflicts = purposeBrainConflicts(configuration, answers);
291
+ if (conflicts.length)
292
+ throw new PurposeBrainConflictError(`Setup would not use the chosen models: ${conflicts.join('; ')}. `
293
+ + 'Existing Brains are kept; change them in Settings > Brains or choose matching models.');
276
294
  try {
277
295
  await deps.hostSetup();
278
296
  }
@@ -1,7 +1,19 @@
1
1
  import { execFile, spawn } from 'node:child_process';
2
2
  import { launchFleetWorker } from '../rooms-tasks/external-worker.js';
3
3
  import { RoomStateError } from '../rooms-tasks/room-state.js';
4
- import { TaskStateError } from '../rooms-tasks/task-state.js';
4
+ import { resolveTaskRef, TaskStateError } from '../rooms-tasks/task-state.js';
5
+ import { MissionKeyError } from '../rooms-tasks/mission-keys.js';
6
+ /** Canonical ID for an authenticated Owner's task argument (ID or mission key). */
7
+ function ownerTaskRef(value, allowDeleted = false) {
8
+ try {
9
+ return resolveTaskRef(value, { allowDeleted });
10
+ }
11
+ catch (error) {
12
+ if (error instanceof MissionKeyError)
13
+ throw new TaskStateError(error.message);
14
+ throw error;
15
+ }
16
+ }
5
17
  import { markdownCode, markdownProse, renderMarkdownFailure, renderMarkdownList, renderMarkdownResult, roomStatus, taskStatus, } from '../rooms-tasks/markdown.js';
6
18
  import { OWNER_COMMENT_LABEL, ownerNotices } from './notices.js';
7
19
  import { TaskRoomApplicationError } from '../application/task-room-service.js';
@@ -21,7 +33,7 @@ class OwnerCommandUsageError extends Error {
21
33
  }
22
34
  const MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
23
35
  const REPLY_MAX_CHARS = 3_500;
24
- const taskListRecord = (task) => `${taskStatus(task.state)} ${markdownCode(task.task_id)} — ${markdownProse(task.title)}`
36
+ const taskListRecord = (task) => `${taskStatus(task.state)} ${task.key ? `${markdownCode(task.key)} ` : ''}${markdownCode(task.task_id)} — ${markdownProse(task.title)}`
25
37
  + ` — List ${markdownCode(task.list_name ?? 'default')}`
26
38
  + (task.blocked ? ` — 🚧 Blocked: ${markdownProse(task.blocked.reason)}` : '');
27
39
  const roomListRecord = (room) => `${roomStatus(room.state)} ${markdownCode(room.room_id)} — ${markdownProse(room.room_name)}`
@@ -106,6 +118,7 @@ function ownerRoomFailure(error) {
106
118
  const taskAction = (title, task, fields = []) => renderMarkdownResult({
107
119
  icon: '📋', title,
108
120
  fields: [
121
+ ...(task.key ? [{ label: 'Key', value: task.key, kind: 'code' }] : []),
109
122
  { label: 'ID', value: task.task_id, kind: 'code' },
110
123
  { label: 'Status', value: taskStatus(task.state), kind: 'markdown' },
111
124
  ...fields,
@@ -437,19 +450,19 @@ export const ownerCommands = [
437
450
  const destination = trailingLines ?? rest.find(r => r.startsWith('--list='))?.slice('--list='.length);
438
451
  if (!rest[0] || !destination)
439
452
  throw new OwnerCommandUsageError('usage: /task move <id> --list=<name>');
440
- await showTask((await ctx.moveTask(rest[0], destination)).task_id);
453
+ await showTask((await ctx.moveTask(ownerTaskRef(rest[0]), destination)).task_id);
441
454
  break;
442
455
  }
443
456
  case 'show': {
444
457
  if (rest.length !== 1 || rest[0].startsWith('--'))
445
458
  throw new OwnerCommandUsageError('usage: /task show <id>');
446
- await showTask(rest[0]);
459
+ await showTask(ownerTaskRef(rest[0]));
447
460
  break;
448
461
  }
449
462
  case 'start': {
450
463
  if (!rest[0])
451
464
  throw new OwnerCommandUsageError('usage: /task start <id>');
452
- const started = await ctx.startTask(rest[0]);
465
+ const started = await ctx.startTask(ownerTaskRef(rest[0]));
453
466
  await ctx.reply('kind' in started
454
467
  ? taskProvisioningAction(started) : taskAction('Task started', started));
455
468
  break;
@@ -458,21 +471,21 @@ export const ownerCommands = [
458
471
  if (!rest[0] || !rest[1])
459
472
  throw new OwnerCommandUsageError('usage: /task block <id> <reason>');
460
473
  const reason = rest.slice(1).join(' ');
461
- const t = ctx.blockTask(rest[0], reason);
474
+ const t = ctx.blockTask(ownerTaskRef(rest[0]), reason);
462
475
  await ctx.reply(taskAction('Task blocked', t, [{ label: 'Reason', value: reason }]));
463
476
  break;
464
477
  }
465
478
  case 'unblock': {
466
479
  if (!rest[0])
467
480
  throw new OwnerCommandUsageError('usage: /task unblock <id>');
468
- const t = ctx.unblockTask(rest[0]);
481
+ const t = ctx.unblockTask(ownerTaskRef(rest[0]));
469
482
  await ctx.reply(taskAction('Task unblocked', t));
470
483
  break;
471
484
  }
472
485
  case 'review': {
473
486
  if (!rest[0])
474
487
  throw new OwnerCommandUsageError('usage: /task review <id>');
475
- const t = ctx.reviewTask(rest[0]);
488
+ const t = ctx.reviewTask(ownerTaskRef(rest[0]));
476
489
  await ctx.reply(taskAction('Task ready for review', t));
477
490
  break;
478
491
  }
@@ -480,26 +493,26 @@ export const ownerCommands = [
480
493
  if (!rest[0])
481
494
  throw new OwnerCommandUsageError('usage: /task done <id> [summary]');
482
495
  const summary = rest.slice(1).join(' ') || undefined;
483
- await ctx.terminalTask(rest[0], 'done', summary ? { summary } : undefined);
496
+ await ctx.terminalTask(ownerTaskRef(rest[0]), 'done', summary ? { summary } : undefined);
484
497
  break;
485
498
  }
486
499
  case 'cancel': {
487
500
  if (rest.length < 2 || rest[0] !== rest[1])
488
501
  throw new OwnerCommandUsageError('destructive: /task cancel <id> <id> — provide the task ID twice');
489
- await ctx.terminalTask(rest[0], 'cancelled');
502
+ await ctx.terminalTask(ownerTaskRef(rest[0]), 'cancelled');
490
503
  break;
491
504
  }
492
505
  case 'delete': {
493
506
  if (rest.length !== 2 || rest[0] !== rest[1])
494
507
  throw new OwnerCommandUsageError('destructive: /task delete <id> <id> — provide the task ID twice');
495
- await ctx.deleteTask(rest[0]);
508
+ await ctx.deleteTask(ownerTaskRef(rest[0], true));
496
509
  break;
497
510
  }
498
511
  default:
499
512
  // bare /task <id> → show
500
513
  if (sub === 'recover' || sub === 'await' || rest.length)
501
514
  throw new OwnerCommandUsageError(`unknown task subcommand: ${sub}`);
502
- await showTask(sub);
515
+ await showTask(ownerTaskRef(sub));
503
516
  }
504
517
  }
505
518
  catch (e) {
@@ -29,7 +29,7 @@ const allowlistList = (list) => ({
29
29
  list_id: list.list_id, name: bounded(list.name) ?? 'Unnamed list', built_in: list.built_in,
30
30
  });
31
31
  const allowlistTask = (task) => ({
32
- task_id: task.task_id, list_id: task.list_id, list_name: bounded(task.list_name) ?? 'default',
32
+ task_id: task.task_id, ...(task.key ? { key: task.key } : {}), list_id: task.list_id, list_name: bounded(task.list_name) ?? 'default',
33
33
  title: bounded(task.title) ?? 'Untitled task', ...(task.brief === undefined ? {} : { brief: bounded(task.brief) ?? '' }),
34
34
  state: task.state, ...(task.blocked ? { blocked: { reason: bounded(task.blocked.reason) ?? 'Blocked' } } : {}),
35
35
  ...(task.room_id ? { room_id: bounded(task.room_id) ?? undefined } : {}),
@@ -41,11 +41,12 @@ const allowlistTask = (task) => ({
41
41
  });
42
42
  function safeTask(task) {
43
43
  const status = STATUS_LABEL[task.state];
44
- const title = bounded(task.title) ?? 'Untitled task';
44
+ // The mission key leads the title so it is discoverable; the opaque ID stays as the record ID.
45
+ const title = `${task.key ? `${task.key} · ` : ''}${bounded(task.title) ?? 'Untitled task'}`;
45
46
  const brief = briefPreview(task.brief);
46
47
  const groups = [
47
48
  { title: '1. Identity and lifecycle', values: [
48
- field('Task ID', task.task_id), field('Title', title),
49
+ ...(task.key ? [field('Mission key', task.key)] : []), field('Task ID', task.task_id), field('Title', bounded(task.title) ?? 'Untitled task'),
49
50
  field('Lifecycle status', status, STATUS_TONE[task.state]), field('List', task.list_name),
50
51
  field('Blocked indicator', task.blocked ? bounded(task.blocked.reason) : 'No — unblocked', task.blocked ? 'warning' : undefined),
51
52
  ] },
@@ -6,13 +6,25 @@ import type { TaskLayouts } from '../application/task-layouts.js';
6
6
  export declare class MemberAdditionRejected extends TaskStateError {
7
7
  readonly accepted = false;
8
8
  }
9
+ /** A one-off harness/model/effort for this member only; no Brain is saved. Omitted model/effort keep the harness default. */
10
+ export interface ManualBrain {
11
+ harness: string;
12
+ session?: string;
13
+ model?: string;
14
+ effort?: string;
15
+ }
16
+ /** `brain` omitted: the member uses its Agent Template's own Brain, unchanged. */
9
17
  export interface AddMemberRequest {
10
18
  requestId: string;
11
19
  slot: string;
12
20
  role: string;
13
- brain: string;
21
+ brain?: string | {
22
+ inline: ManualBrain;
23
+ };
14
24
  agentTemplate: string;
15
25
  }
26
+ /** No Brain, a saved Brain name, or exactly one manual harness/model/effort. */
27
+ export declare function validMemberBrain(brain: unknown): brain is AddMemberRequest['brain'];
16
28
  export declare function memberAddition(taskId: string, requestId: string): {
17
29
  requestId: string;
18
30
  taskId: string;
@@ -35,6 +47,8 @@ export declare function requestMemberAddition(input: {
35
47
  binPath: string;
36
48
  provision?: typeof provisionMembers;
37
49
  layouts?: TaskLayouts;
50
+ /** Checks a new request only; a retry of an accepted request returns its receipt. */
51
+ checkNewRequest?: (request: AddMemberRequest) => Promise<void>;
38
52
  }): Promise<{
39
53
  requestId: string;
40
54
  taskId: string;