ai-agentmanager 1.40.0 → 1.41.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.41.0 (2026-11-11)
4
+
5
+ - **Estimate.** A human time estimate for planning any Jira fix or feature: how long one experienced developer would take to do it by hand, without an AI agent. It's split into tasks of a day or less, each with optimistic, likely, pessimistic and expected hours and a total. Work over about 3 days gets a suggested split into tickets, and it lists the roles, assumptions and risks.
6
+ - **Documentation.** The docs for the change, written from the actual diff: what's new, how to use it, configuration, upgrade notes and which docs to add or update. When the change touches an HTTP API, it includes an OpenAPI 3.0 spec of the changed endpoints; **Download OpenAPI** saves it as a .yaml file.
7
+ - Both sit with the other documents (Analysis, Design and the rest), and are included in **Write all**, `agentmgr doc`, Google Drive publishing and the side pane.
8
+
3
9
  ## 1.40.0 (2026-11-11)
4
10
 
5
11
  - **A calmer agent list.** No summary line under each name (it's the name's tooltip, and search still finds it); the engine, container, assistant and playbook tags move to the line below. The project name shows where the branch was (the branch is in its tooltip).
package/README.md CHANGED
@@ -26,7 +26,7 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
26
26
  - **Backlog.** Queue asks as work orders. Agents pick them up one by one, up to N in parallel per project, until each is done. You accept or reopen each one.
27
27
  - **Slack alerts.** A message in your channel when an agent needs input, finishes a backlog item, or fails.
28
28
  - **Priority.** Mark agents P0–P3. P0 and P1 are highlighted, and lists sort by priority.
29
- - **Share for review.** One click writes an **Analysis**, **Design**, **Flow** or **Proposal** document from the agent's work. Copy it as Markdown, download it, or print it to PDF with diagrams.
29
+ - **Share for review.** One click writes an **Analysis**, **Design**, **Flow** or **Proposal** document from the agent's work, a human time **Estimate** for planning, or the change's **Documentation** with an OpenAPI spec of any API changes. Copy it as Markdown, download it, or print it to PDF with diagrams.
30
30
  - **Human vs AI.** It splits the open questions about the work into the top 5 that need your judgment and the ones a model can answer from the evidence. It answers those, then a second model double-checks every answer.
31
31
  - **Review changes.** Each agent's diff file by file, line comments sent back to the agent as one message, then **Commit all** and **Push & open PR**, without leaving the page.
32
32
  - **Standup.** Each weekday at 9:00 (or whenever you press **Standup**, or `p`), each agent with news since the last one is read aloud in a sentence or two, each in its own voice: what it did, what it's on, what it needs from you. Agents that need you go first and quiet ones are left out. It stops on an agent that needs you, with its questions beside it to answer by tap, or by voice when **Answer by voice** is on (what you say is read back, then sent when you say "send"). The wording comes from one short tool-less model call, plain wording if that fails. A Slack alert says when it's ready (Alerts). Change the time, weekends and wording in the player, or in config.json: `"standup": { "at": "09:00", "weekends": false, "ai": true, "notify": true }`. Speech is your browser's own; voice answers may be sent to your browser's maker to be turned into text.
@@ -173,8 +173,8 @@ agentmgr attach <agent> # live terminal here; Ctrl-] detac
173
173
  agentmgr shell <agent> [-n 2] # a shell in the agent's folder (-n picks another one); Ctrl-] detaches
174
174
  agentmgr brief <agent> # print the agent's brief (Markdown)
175
175
  agentmgr priority <agent> P0 # P0 urgent, P1 high, P2 normal (default), P3 low
176
- agentmgr doc <agent> proposal -o p.md # analysis | design | flow | proposal, for stakeholders
177
- agentmgr doc <agent> all --background # write all four in the background
176
+ agentmgr doc <agent> proposal -o p.md # analysis | design | flow | proposal | estimate | documentation
177
+ agentmgr doc <agent> all --background # write them all (and Human vs AI) in the background
178
178
  agentmgr insights <agent> # Why / What / How / Now, three points each
179
179
  agentmgr explain <agent> # full briefing: ask, status, plan, solution, conclusions, needs
180
180
  agentmgr remote on | off | status | rotate # phone / remote access (see below)
@@ -340,6 +340,8 @@ The Brief panel's **Share for review** buttons, or `agentmgr doc <agent> <kind>`
340
340
  | **Flow** | Summary, end-to-end flowchart with a step-by-step walk-through, key interactions as a sequence diagram, failure and edge cases |
341
341
  | **Proposal** | Summary, problem, recommendation, scope, plan, effort and dependencies, risks, decisions needed |
342
342
  | **Human vs AI** | Your top 5 decisions, each with why it needs you, the stakes, options and what the work suggests, plus a box for your answer. Up to 5 questions the AI answers, each with its confidence, evidence and how to check it. A second model's verdict on each. |
343
+ | **Estimate** | Human time estimate for planning: summary with a range and confidence, a task breakdown with optimistic, likely, pessimistic and expected hours, a suggested split into tickets, roles and skills, assumptions, risks and unknowns |
344
+ | **Documentation** | Summary, what's new or changed, how to use it, configuration, upgrade and operations notes, docs to add or update, and API changes with an OpenAPI 3.0 spec of the changed endpoints |
343
345
  | **Diagrams** | Diagrams only, for a quick grasp: the problem, the architecture (with what changes highlighted), the design, the data flow (animated) and the key interaction, plus the plan. Drawn from the documents already written and the agent's work. Optional: **Write all** leaves it out. |
344
346
 
345
347
  Each drawn diagram has **Copy image** (paste it into Slack, a PR comment or a doc), **PNG** and **SVG**, and a document with diagrams also downloads as one **.html** file. **šŸ”Š Listen** reads Explain, documents and the change walkthrough aloud with the browser's own voices; the walkthrough is read change by change, showing each as it goes.
@@ -352,6 +354,10 @@ The second model is another installed engine by default (Codex or Antigravity fo
352
354
 
353
355
  Type your answers in the viewer, or tap an option to fill one in. **Send my answers to the agent** passes them on, together with any AI conclusions the second model doubted, so the agent re-checks those.
354
356
 
357
+ **Estimate.** A human time estimate for planning: how long one experienced developer who knows the codebase would take to do the ticket by hand, without an AI agent. It's split into tasks of a day or less (understanding, design, each part of the implementation, tests, docs, review, QA, release), each with optimistic, likely and pessimistic hours and the expected (PERT) figure, and a total. Larger work also gets a suggested split into tickets that can ship on their own, with their dependencies. Then come the roles needed, the assumptions, and the risks that could move the number. It's sized from the ticket, the brief and the changes so far.
358
+
359
+ **Documentation.** The docs for the change: what's new, how to use it, configuration, upgrade and operations notes, and which docs in the repository to add or update. It's written from the actual diff. When the change touches an HTTP API, it adds a table of the changed endpoints and an OpenAPI 3.0 spec covering only those endpoints. **Download OpenAPI** saves the spec as a .yaml file for Swagger, Postman or your API portal.
360
+
355
361
  **How they're written.** Documents name the real files, tickets and docs, separate facts from proposals, and say "To be confirmed" where the context doesn't. They're written for reviewers: no mention of the agent or its tools.
356
362
 
357
363
  **Sharing.** Each document opens in a viewer:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "Run background coding agents (Claude Code, Codex) per intent, and keep track of them from a web UI, your phone or the CLI",
5
5
  "keywords": [
6
6
  "claude",
package/public/app.js CHANGED
@@ -501,10 +501,17 @@ const INSIGHT_ICONS = { why: 'šŸŽÆ', what: 'šŸ“¦', how: 'šŸ› ', now: 'šŸ“' };
501
501
 
502
502
  // ------------------------------------------------------------------ stakeholder documents
503
503
 
504
- const DOCS = { analysis: 'Analysis', design: 'Design', flow: 'Flow', proposal: 'Proposal', humanai: 'Human vs AI', diagrams: 'Diagrams', scorecard: 'Scorecard' };
504
+ const DOCS = { analysis: 'Analysis', design: 'Design', flow: 'Flow', proposal: 'Proposal', humanai: 'Human vs AI', estimate: 'Estimate', documentation: 'Documentation', diagrams: 'Diagrams', scorecard: 'Scorecard' };
505
+ // What a document is before it's written, where "Write a … document for stakeholders" doesn't say it.
506
+ const DOC_HINTS = {
507
+ estimate: 'For planning: how long a person would take to do this work by hand, split into tasks with optimistic, likely and pessimistic hours, a suggested split into tickets, the roles needed and the risks',
508
+ documentation: 'The documentation for this change: what is new, how to use it, configuration, upgrade notes, which docs to add or update, and an OpenAPI spec of any API changes',
509
+ };
510
+ /** The OpenAPI spec in a Documentation document (its ```yaml block), if the change has API changes. */
511
+ const openApiOf = (markdown) => (markdown ?? '').match(/```ya?ml\s*\n((?:#.*\n|\s*\n)*openapi:[\s\S]*?)```/)?.[1] ?? null;
505
512
  // Optional extras that "Write all" leaves out.
506
513
  const DOC_EXTRAS = new Set(['diagrams', 'scorecard']);
507
- const DOC_TITLES = { ...DOCS, eval: 'Eval', plan: 'Plan', intent: 'Intent', spec: 'Spec', designdoc: 'Design doc', benchmark: 'Benchmark' };
514
+ const DOC_TITLES = { ...DOCS, estimate: 'Human time estimate', eval: 'Eval', plan: 'Plan', intent: 'Intent', spec: 'Spec', designdoc: 'Design doc', benchmark: 'Benchmark' };
508
515
  // The agent's intent, spec and plan files (read from the daemon when opened; kept here by agent and kind).
509
516
  const SPEC_KINDS = { intent: 'Intent', spec: 'Spec', plan: 'Plan', designdoc: 'Design doc', benchmark: 'Benchmark' };
510
517
  // What each optional file is, for its button before it's written.
@@ -589,7 +596,7 @@ function docButtons(a) {
589
596
  const d = a.docs?.[k];
590
597
  const stale = d?.markdown && a.brief?.updatedAt && d.briefUpdatedAt !== a.brief.updatedAt;
591
598
  return `<button class="small doc-btn ${d?.markdown ? 'has' : ''}" data-doc="${k}" ${d?.pending ? 'disabled' : ''}
592
- title="${k === 'scorecard' ? (d?.markdown ? `Open the review scorecard: ${d.data?.overall ?? '—'}/100` : 'Score the changes for review: intent, spec, scope, plan, tests and safety, with an overall readiness and where to look') : k === 'diagrams' ? (d?.markdown ? `Open the diagrams${stale ? ' (the brief changed since)' : ''}` : 'Draw the problem and its solution for a quick grasp: architecture, design, data flow (animated) and the key interaction, diagrams only. Built from the documents already written and the agent\'s work') : d?.markdown ? `Open the ${label.toLowerCase()} document${stale ? ' (the brief changed since)' : ''}` : `Write a ${label.toLowerCase()} document for stakeholders`}">${d?.pending ? `${label}…` : label}${d?.markdown ? (stale ? ' •' : ' āœ“') : ''}</button>`;
599
+ title="${k === 'scorecard' ? (d?.markdown ? `Open the review scorecard: ${d.data?.overall ?? '—'}/100` : 'Score the changes for review: intent, spec, scope, plan, tests and safety, with an overall readiness and where to look') : k === 'diagrams' ? (d?.markdown ? `Open the diagrams${stale ? ' (the brief changed since)' : ''}` : 'Draw the problem and its solution for a quick grasp: architecture, design, data flow (animated) and the key interaction, diagrams only. Built from the documents already written and the agent\'s work') : d?.markdown ? `Open the ${label.toLowerCase()} document${stale ? ' (the brief changed since)' : ''}` : DOC_HINTS[k] ?? `Write a ${label.toLowerCase()} document for stakeholders`}">${d?.pending ? `${label}…` : label}${d?.markdown ? (stale ? ' •' : ' āœ“') : ''}</button>`;
593
600
  })
594
601
  .join('')}</span>${specButtons(a)}${driveButton(a)}`;
595
602
  }
@@ -660,6 +667,7 @@ function renderDocDialog() {
660
667
  for (const id of ['doc-copy', 'doc-download', 'doc-print']) $(`#${id}`).disabled = !d?.markdown;
661
668
  // Diagrams: the whole document as one HTML file with every diagram (each also has Copy / PNG / SVG).
662
669
  $('#doc-html').hidden = !/```mermaid/.test(d?.markdown ?? '');
670
+ $('#doc-openapi').hidden = docView.kind !== 'documentation' || !openApiOf(d?.markdown);
663
671
  $('#doc-listen').innerHTML = d?.markdown && docView.kind !== 'diagrams' ? listenHtml(docView.kind === 'scorecard' ? `score:${docView.agentId}` : `doc:${docView.agentId}:${docView.kind}`, { title: 'Read the document aloud' }) : '';
664
672
  $('#doc-print').hidden = plan || specKind;
665
673
  $('#doc-regen').hidden = plan || specKind;
@@ -704,6 +712,7 @@ function renderEval(a, body, d) {
704
712
  $('#doc-meta').textContent = ev?.at ? `Worked out ${ago(ev.at)}${ev.postedTo ? ' Ā· posted on the pull request' : ''}` : '';
705
713
  for (const id of ['doc-copy', 'doc-download', 'doc-print']) $(`#${id}`).disabled = !d?.markdown;
706
714
  $('#doc-html').hidden = true;
715
+ $('#doc-openapi').hidden = true;
707
716
  $('#doc-listen').innerHTML = '';
708
717
  $('#doc-print').hidden = true;
709
718
  $('#doc-regen').hidden = true;
@@ -784,6 +793,13 @@ $('#doc-download').onclick = () => {
784
793
  link.click();
785
794
  setTimeout(() => URL.revokeObjectURL(link.href), 1000);
786
795
  };
796
+ $('#doc-openapi').onclick = () => {
797
+ const a = agents.get(docView.agentId);
798
+ const blob = new Blob([openApiOf(docOf(a, docView.kind)?.markdown)], { type: 'application/yaml' });
799
+ const link = Object.assign(document.createElement('a'), { href: URL.createObjectURL(blob), download: `${a.slug}-openapi.yaml` });
800
+ link.click();
801
+ setTimeout(() => URL.revokeObjectURL(link.href), 1000);
802
+ };
787
803
  const haAnswers = () => Object.fromEntries([...document.querySelectorAll('#doc-body [data-ha]')].map((t) => [t.dataset.ha, t.value]));
788
804
  $('#doc-body').addEventListener('click', (e) => {
789
805
  const pick = e.target.closest('[data-ha-pick]');
package/public/index.html CHANGED
@@ -483,6 +483,7 @@
483
483
  <button type="button" id="doc-copy" class="small" title="Copy as Markdown">Copy Markdown</button>
484
484
  <span id="doc-listen"></span>
485
485
  <button type="button" id="doc-download" class="small">Download .md</button>
486
+ <button type="button" id="doc-openapi" class="small" hidden title="The OpenAPI 3 spec of the API changes, as a YAML file for Swagger, Postman or your API docs">Download OpenAPI</button>
486
487
  <button type="button" id="doc-html" class="small" hidden title="One HTML file with every diagram: open it anywhere, attach it, or print it">Download .html</button>
487
488
  <button type="button" id="doc-print" class="small primary" title="Open a print-ready page (Save as PDF)">Print / PDF</button>
488
489
  <button type="button" id="doc-close" class="small ghost">Close</button>
package/public/side.js CHANGED
@@ -13,6 +13,8 @@ const DOCS = [
13
13
  ['flow', 'Flow'],
14
14
  ['analysis', 'Analysis'],
15
15
  ['proposal', 'Proposal'],
16
+ ['estimate', 'Estimate'],
17
+ ['documentation', 'Documentation'],
16
18
  ['explain', 'Explain'],
17
19
  ];
18
20
  const pref = {
package/src/brief.js CHANGED
@@ -307,9 +307,52 @@ export const DOC_KINDS = {
307
307
  ],
308
308
  diagram: 'Include one small diagram if it helps the decision.',
309
309
  },
310
+ estimate: {
311
+ title: 'Human time estimate',
312
+ sections: [
313
+ ['Summary', 'The total in hours and working days (6 focused hours a day) for one experienced developer who knows the codebase, the likely figure with its range, and how confident the estimate is.'],
314
+ [
315
+ 'Breakdown',
316
+ 'A Markdown table with columns: #, Task, What it covers, Optimistic (h), Likely (h), Pessimistic (h), Expected (h). Split the work into tasks of at most about 8 likely hours each: understanding the ticket and code, design, each part of the implementation (one row per component or module), tests (unit, integration, end-to-end), documentation, code review and fixes, QA and verification, release or rollout. Expected = (optimistic + 4 Ɨ likely + pessimistic) / 6, rounded to the nearest half hour. End with a bold Total row.',
317
+ ],
318
+ ['Suggested split', 'If the total is more than about 3 days, how to split it into tickets or sub-tasks that can be delivered and reviewed on their own: each with a one-line scope, its estimate and what it depends on. Otherwise say that one ticket is enough.'],
319
+ ['Roles and skills', 'Who is needed (for example backend, frontend, QA, DevOps, a reviewer who knows a component) and the hours for each.'],
320
+ ['Assumptions', 'What the estimate takes as given.'],
321
+ ['Risks and unknowns', 'What could move the estimate, by how much, and how to reduce the uncertainty early.'],
322
+ ],
323
+ diagram: 'No diagram unless a ```mermaid gantt chart of the tasks helps the plan.',
324
+ rules: [
325
+ 'This is for planning: estimate the time a person would take to do this work by hand, without an AI agent. Never give the agent\'s own time.',
326
+ 'Size it from the evidence: the ticket and intent, the files and lines changed so far (diffstat) and the brief. Where the work is not done yet, estimate what is left as well as what is done, and say which.',
327
+ 'Use hours. Keep the numbers consistent: the Total row is the sum of the rows above it.',
328
+ ],
329
+ words: '300-900',
330
+ },
331
+ documentation: {
332
+ title: 'Documentation',
333
+ diff: true,
334
+ sections: [
335
+ ['Summary', 'What changed and who it is for, in two or three sentences.'],
336
+ ['What is new or changed', 'The changes as users see them, as bullets.'],
337
+ ['How to use it', 'Steps, commands, UI paths or code examples for the main uses.'],
338
+ ['Configuration', 'Settings, environment variables, flags and their defaults that were added or changed, as a table; or "No configuration changes."'],
339
+ ['Upgrade and operations notes', 'Migrations, compatibility, permissions, rollout and rollback, monitoring; or "None."'],
340
+ ['Docs to add or update', 'Each documentation file or page in the repository (README, docs/, changelog, help text) that should be added or changed, with what goes in it.'],
341
+ [
342
+ 'API changes',
343
+ 'If the work adds, changes or removes HTTP API endpoints, parameters, request or response fields or status codes, a summary table of the endpoints (method, path, change), then one ```yaml block with an OpenAPI 3.0.3 document covering only those endpoints: paths, parameters, request bodies, responses and component schemas, with descriptions and examples. Mark removed or deprecated endpoints with deprecated: true. If there are no API changes, write "No API changes."',
344
+ ],
345
+ ],
346
+ diagram: 'No diagram unless one makes the usage clearer.',
347
+ rules: [
348
+ 'Write it from the actual changes in <diff> and the brief: only document behaviour the code has. Read routes, handlers, schemas and validation in the diff to get the API right (paths, methods, field names and types).',
349
+ 'The OpenAPI block must be valid YAML that an OpenAPI 3.0 tool can load on its own: openapi, info (title and version), paths and, when used, components.',
350
+ ],
351
+ words: '400-1500',
352
+ },
310
353
  };
311
354
 
312
- export function docPrompt(kind, { intent, status, digest, repo, briefMarkdown, agentName }) {
355
+ export function docPrompt(kind, { intent, status, digest, repo, briefMarkdown, agentName, diff }) {
313
356
  const d = DOC_KINDS[kind];
314
357
  return [
315
358
  `Write a ${d.title} document about an AI coding agent's work, for stakeholders who will review it.`,
@@ -323,7 +366,8 @@ export function docPrompt(kind, { intent, status, digest, repo, briefMarkdown, a
323
366
  `- ${d.diagram} Diagrams go in \`\`\`mermaid code blocks with valid Mermaid syntax; keep node labels short and quote labels that contain punctuation.`,
324
367
  '- Be specific: name the real files, components, tickets and documents from the context.',
325
368
  '- Separate facts from proposals. Where the context does not say, write "To be confirmed" rather than guessing.',
326
- '- Clear, neutral, professional prose; bullets where they help. Roughly 400-900 words.',
369
+ ...(d.rules ?? []).map((r) => `- ${r}`),
370
+ `- Clear, neutral, professional prose; bullets where they help. Roughly ${d.words ?? '400-900'} words${d.rules ? ' (not counting tables and code)' : ''}.`,
327
371
  '- Output only the Markdown document.',
328
372
  '',
329
373
  '<agent_status>',
@@ -341,6 +385,7 @@ export function docPrompt(kind, { intent, status, digest, repo, briefMarkdown, a
341
385
  '<brief>',
342
386
  briefMarkdown || '(no brief yet)',
343
387
  '</brief>',
388
+ ...(diff == null ? [] : ['<diff>', diff || '(no changes yet)', '</diff>']),
344
389
  ].join('\n');
345
390
  }
346
391
 
package/src/cli.js CHANGED
@@ -475,18 +475,18 @@ export async function main(argv) {
475
475
 
476
476
  program
477
477
  .command('doc')
478
- .description('Write a stakeholder document from the agent work: analysis, design, flow, proposal, humanai (Human vs AI), diagrams (diagrams only), walkthrough (its changes explained one by one) or scorecard (its changes scored for review)')
478
+ .description('Write a stakeholder document from the agent work: analysis, design, flow, proposal, humanai (Human vs AI), estimate (human time estimate for planning), documentation (user, developer and OpenAPI docs), diagrams (diagrams only), walkthrough (its changes explained one by one) or scorecard (its changes scored for review)')
479
479
  .argument('<agent>')
480
- .argument('<kind>', 'analysis, design, flow, proposal, humanai, diagrams, walkthrough, scorecard, or all (background; diagrams, walkthrough and scorecard not included)')
480
+ .argument('<kind>', 'analysis, design, flow, proposal, humanai, estimate, documentation, diagrams, walkthrough, scorecard, or all (background; diagrams, walkthrough and scorecard not included)')
481
481
  .option('-o, --output <file>', 'also save the Markdown to this file')
482
482
  .option('--cached', 'print the last version instead of writing a new one')
483
- .option('-b, --background', 'start writing and return at once (kind "all" writes all five)')
483
+ .option('-b, --background', 'start writing and return at once (kind "all" writes all seven)')
484
484
  .action(async (ref, kind, opts) => {
485
485
  await daemon();
486
486
  const a = await resolveAgent(ref);
487
487
  if (opts.background || kind === 'all') {
488
488
  const res = await api('POST', `/agents/${a.id}/docs/${encodeURIComponent(kind)}?background=1`);
489
- const kinds = kind === 'all' ? ['analysis', 'design', 'flow', 'proposal', 'humanai'] : [kind];
489
+ const kinds = kind === 'all' ? ['analysis', 'design', 'flow', 'proposal', 'humanai', 'estimate', 'documentation'] : [kind];
490
490
  console.log(`${green('…')} writing ${kinds.join(', ')} for ${res.name} in the background`);
491
491
  console.log(dim(` read it when ready: agentmgr doc ${a.id} ${kinds[0]} --cached (or open the agent in the UI)`));
492
492
  return;
package/src/drive.js CHANGED
@@ -23,6 +23,8 @@ export const DRIVE_DOCS = [
23
23
  ['design', 'Design'],
24
24
  ['flow', 'Flow'],
25
25
  ['proposal', 'Proposal'],
26
+ ['estimate', 'Human time estimate'],
27
+ ['documentation', 'Documentation'],
26
28
  ['diagrams', 'Diagrams'],
27
29
  ['walkthrough', 'Change walkthrough'],
28
30
  ['scorecard', 'Review scorecard'],
package/src/manager.js CHANGED
@@ -2407,7 +2407,7 @@ export class AgentManager extends EventEmitter {
2407
2407
  return this.view(this.store.get(agent.id));
2408
2408
  }
2409
2409
 
2410
- /** A stakeholder document: analysis, design, flow or proposal. */
2410
+ /** A stakeholder document: analysis, design, flow, proposal, estimate or documentation. */
2411
2411
  document(ref, kind) {
2412
2412
  if (!SUMMARIES[kind]?.doc) throw Object.assign(new Error(`Unknown document "${kind}"`), { status: 400 });
2413
2413
  return this.summarize(ref, kind);
@@ -2422,6 +2422,7 @@ export class AgentManager extends EventEmitter {
2422
2422
  const run = this.summarySlot()
2423
2423
  .then((release) =>
2424
2424
  this.explainContext(agent)
2425
+ .then(async (ctx) => (DOC_KINDS[kind]?.diff ? { ...ctx, diff: await this.docDiff(agent) } : ctx))
2425
2426
  .then((ctx) => (SUMMARIES[kind].run ? this[SUMMARIES[kind].run](agent, ctx) : this.runExplain(agent, { ...ctx, agentName: agent.name }, kind)))
2426
2427
  .finally(release),
2427
2428
  )
@@ -2435,6 +2436,13 @@ export class AgentManager extends EventEmitter {
2435
2436
  return run;
2436
2437
  }
2437
2438
 
2439
+ /** The agent's changes for a document that needs the code itself (Documentation: the API), cut to fit a prompt. */
2440
+ async docDiff(agent, max = 80_000) {
2441
+ if (!this.changesSource || NO_REPO.has(agent.kind) || !agent.workdir) return null;
2442
+ const diff = (await this.changesSource(agent.id).catch(() => null))?.diff ?? '';
2443
+ return diff.length > max ? `${diff.slice(0, max)}\n… (the rest of the diff was cut)` : diff;
2444
+ }
2445
+
2438
2446
  /** What the agent is actually doing: its session, repo changes, live status and brief. */
2439
2447
  async explainContext(agent) {
2440
2448
  const v = this.view(agent);
package/src/server.js CHANGED
@@ -396,7 +396,7 @@ export async function startServer({ port = PORT, host = HOST, evalTimer = true }
396
396
  const bg = (req) => req.query.background === '1' || req.body?.background === true;
397
397
  api.post('/agents/:id/explain', wrap((req) => (bg(req) ? manager.summarizeInBackground(req.params.id, ['explain']) : manager.explain(req.params.id))));
398
398
  api.post('/agents/:id/insights', wrap((req) => (bg(req) ? manager.summarizeInBackground(req.params.id, ['insights']) : manager.insights(req.params.id))));
399
- const DOC_LIST = ['analysis', 'design', 'flow', 'proposal', 'humanai'];
399
+ const DOC_LIST = ['analysis', 'design', 'flow', 'proposal', 'humanai', 'estimate', 'documentation'];
400
400
  api.post('/agents/:id/humanai/answers', wrap((req) => manager.humanAiAnswers(req.params.id, req.body?.answers, { send: req.body?.send === true })));
401
401
  api.post(
402
402
  '/agents/:id/docs/:kind',