chore: remove the persistent /agents-panel; keep /agents overlay and live widget

This commit is contained in:
Emil
2026-08-01 00:03:11 +03:00
parent 8f308ecea3
commit 4f630183fd
30 changed files with 10597 additions and 99 deletions
-8
View File
@@ -43,14 +43,6 @@
tree glyphs (├─/└─/│), colored statuses and icons, live elapsed time,
keyboard navigation (↑/↓), and a detail pane (Enter) showing each agent's
task and result. The live widget header now hints at `/agents`.
- New `/agents-panel` command toggles a persistent OpenCode-style right-side
panel with the live agent tree: non-capturing (typing keeps working),
auto-refreshed every 1.5 s, hidden on terminals narrower than 100 columns,
and closed automatically on shutdown.
- The right-side panel now fills the whole right column (width 40%, full
height) and shows each running subagent's most recent activity under its
row — the last tool call with its query or the last assistant text — read
from the tail of the agent's session file (cached by file size).
## 0.1.1 — 2026-07-31
+23
View File
@@ -0,0 +1,23 @@
{
"0": "Community 0",
"1": "Community 1",
"2": "Community 2",
"3": "Community 3",
"4": "Community 4",
"5": "Community 5",
"6": "Community 6",
"8": "Community 8",
"9": "Community 9",
"10": "Community 10",
"11": "Community 11",
"12": "Community 12",
"13": "Community 13",
"14": "Community 14",
"15": "Community 15",
"16": "Community 16",
"17": "Community 17",
"18": "Community 18",
"19": "Community 19",
"20": "Community 20",
"21": "Community 21"
}
+1
View File
@@ -0,0 +1 @@
.
+141
View File
@@ -0,0 +1,141 @@
# Graph Report - hypothesis-machine (2026-08-01)
## Corpus Check
- 45 files · ~18,068 words
- Verdict: corpus is large enough that graph structure adds value.
## Summary
- 331 nodes · 619 edges · 21 communities (14 shown, 7 thin omitted)
- Extraction: 100% EXTRACTED · 0% INFERRED · 0% AMBIGUOUS
- Token cost: 0 input · 0 output
## Graph Freshness
- Built from commit: `8f308ece`
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost).
## Community Hubs (Navigation)
- [[_COMMUNITY_Community 0|Community 0]]
- [[_COMMUNITY_Community 1|Community 1]]
- [[_COMMUNITY_Community 2|Community 2]]
- [[_COMMUNITY_Community 3|Community 3]]
- [[_COMMUNITY_Community 4|Community 4]]
- [[_COMMUNITY_Community 5|Community 5]]
- [[_COMMUNITY_Community 6|Community 6]]
- [[_COMMUNITY_Community 8|Community 8]]
- [[_COMMUNITY_Community 9|Community 9]]
- [[_COMMUNITY_Community 10|Community 10]]
- [[_COMMUNITY_Community 11|Community 11]]
- [[_COMMUNITY_Community 12|Community 12]]
- [[_COMMUNITY_Community 13|Community 13]]
- [[_COMMUNITY_Community 14|Community 14]]
- [[_COMMUNITY_Community 15|Community 15]]
- [[_COMMUNITY_Community 16|Community 16]]
- [[_COMMUNITY_Community 17|Community 17]]
- [[_COMMUNITY_Community 18|Community 18]]
- [[_COMMUNITY_Community 19|Community 19]]
- [[_COMMUNITY_Community 20|Community 20]]
## God Nodes (most connected - your core abstractions)
1. `AgentTree` - 44 edges
2. `ResearchMemory` - 22 edges
3. `SupervisorIntegration` - 22 edges
4. `RunStore` - 21 edges
5. `WebGateway` - 18 edges
6. `AgentRecord` - 18 edges
7. `ResearchLoop` - 14 edges
8. `ExperimentRunner` - 14 edges
9. `compilerOptions` - 13 edges
10. `HypothesisMachineConfig` - 10 edges
## Surprising Connections (you probably didn't know these)
- `FakeRuntime` --implements--> `AgentRuntime` [EXTRACTED]
tests/helpers.ts → src/types.ts
- `TreeRow` --references--> `AgentRecord` [EXTRACTED]
src/agent-tree-ui.ts → src/types.ts
- `FakeRuntimeFactory` --implements--> `AgentRuntimeFactory` [EXTRACTED]
tests/helpers.ts → src/types.ts
- `AgentTree` --references--> `AgentFactory` [EXTRACTED]
src/agent-tree.ts → src/agent-factory.ts
- `AgentTree` --references--> `RunManifest` [EXTRACTED]
src/agent-tree.ts → src/run-store.ts
## Import Cycles
- None detected.
## Communities (21 total, 7 thin omitted)
### Community 0 - "Community 0"
Cohesion: 0.06
Nodes (34): DEFAULT_CONFIG, HypothesisMachineConfig, loadConfig(), hypothesisMachine(), PiRuntimeDependencies, frontmatterDocument(), MEMORY_STATUSES, MEMORY_TYPES (+26 more)
### Community 1 - "Community 1"
Cohesion: 0.12
Nodes (3): AgentTree, PiAgentRuntimeFactory, AgentResult
### Community 2 - "Community 2"
Cohesion: 0.07
Nodes (25): Browser Use adapter contract, Contributing, Local setup, Pull requests, Architecture, Development, Assumptions corrected after verification, Implemented here (+17 more)
### Community 3 - "Community 3"
Cohesion: 0.06
Nodes (33): dependencies, @earendil-works/pi-agent-core, @earendil-works/pi-ai, @earendil-works/pi-coding-agent, @earendil-works/pi-tui, typebox, yaml, description (+25 more)
### Community 4 - "Community 4"
Cohesion: 0.18
Nodes (8): activityCache, agentLastActivity(), collapse(), createAgentPanelComponent(), createAgentTreeOverlay(), STATUS_COLOR, STATUS_ICON, TreeRow
### Community 6 - "Community 6"
Cohesion: 0.12
Nodes (15): AgentFactory, taskFingerprint(), AgentTreeError, TreeOptions, RunManifest, RunStore, AgentRecord, AgentRuntime (+7 more)
### Community 8 - "Community 8"
Cohesion: 0.27
Nodes (9): AgentSpecError, ALLOWED_TOOLS, parseAgentSpec(), readAgentSpec(), REQUIRED_SECTIONS, section(), serializeAgentSpec(), writeAgentSpec() (+1 more)
### Community 9 - "Community 9"
Cohesion: 0.22
Nodes (4): IterationReport, LoopStatus, ResearchLoop, ResearchLoopState
### Community 11 - "Community 11"
Cohesion: 0.13
Nodes (14): compilerOptions, esModuleInterop, exactOptionalPropertyTypes, module, moduleResolution, noUncheckedIndexedAccess, outDir, resolveJsonModule (+6 more)
### Community 13 - "Community 13"
Cohesion: 0.25
Nodes (7): compilerOptions, declaration, outDir, rootDir, exclude, extends, include
### Community 14 - "Community 14"
Cohesion: 0.40
Nodes (4): 0.1.0 — 2026-07-31, 0.1.1 — 2026-07-31, Changelog, Unreleased
### Community 15 - "Community 15"
Cohesion: 0.50
Nodes (3): Security and data, Summary, Verification
### Community 16 - "Community 16"
Cohesion: 0.50
Nodes (3): child, commands, responses
## Knowledge Gaps
- **105 isolated node(s):** `name`, `version`, `description`, `keywords`, `type` (+100 more)
These have ≤1 connection - possible missing edges or undocumented components.
- **7 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **Why does `AgentTree` connect `Community 1` to `Community 0`, `Community 10`, `Community 4`, `Community 6`?**
_High betweenness centrality (0.107) - this node is a cross-community bridge._
- **Why does `SupervisorIntegration` connect `Community 10` to `Community 0`, `Community 1`, `Community 9`?**
_High betweenness centrality (0.063) - this node is a cross-community bridge._
- **Why does `ResearchMemory` connect `Community 0` to `Community 10`?**
_High betweenness centrality (0.045) - this node is a cross-community bridge._
- **What connects `name`, `version`, `description` to the rest of the system?**
_105 weakly-connected nodes found - possible documentation gaps or missing edges._
- **Should `Community 0` be split into smaller, more focused modules?**
_Cohesion score 0.058596491228070174 - nodes in this community are weakly interconnected._
- **Should `Community 1` be split into smaller, more focused modules?**
_Cohesion score 0.11942959001782531 - nodes in this community are weakly interconnected._
- **Should `Community 2` be split into smaller, more focused modules?**
_Cohesion score 0.0677361853832442 - nodes in this community are weakly interconnected._
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_changelog_md", "label": "CHANGELOG.md", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L1"}, {"id": "hypothesis_machine_changelog_changelog", "label": "Changelog", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L1"}, {"id": "hypothesis_machine_changelog_unreleased", "label": "Unreleased", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L3"}, {"id": "hypothesis_machine_changelog_0_1_1_2026_07_31", "label": "0.1.1 \u2014 2026-07-31", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L65"}, {"id": "hypothesis_machine_changelog_0_1_0_2026_07_31", "label": "0.1.0 \u2014 2026-07-31", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L78"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_changelog_md", "target": "hypothesis_machine_changelog_changelog", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L1", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_unreleased", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_0_1_1_2026_07_31", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L65", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_0_1_0_2026_07_31", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L78", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "label": "tsconfig.build.json", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L1"}, {"id": "hypothesis_machine_tsconfig_build_extends", "label": "extends", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L2"}, {"id": "hypothesis_machine_tsconfig_build_compileroptions", "label": "compilerOptions", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L3"}, {"id": "hypothesis_machine_tsconfig_build_compileroptions_rootdir", "label": "rootDir", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L3"}, {"id": "hypothesis_machine_tsconfig_build_compileroptions_outdir", "label": "outDir", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L3"}, {"id": "hypothesis_machine_tsconfig_build_compileroptions_declaration", "label": "declaration", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L3"}, {"id": "hypothesis_machine_tsconfig_build_include", "label": "include", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L4"}, {"id": "hypothesis_machine_tsconfig_build_exclude", "label": "exclude", "file_type": "code", "source_file": "tsconfig.build.json", "source_location": "L5"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "target": "hypothesis_machine_tsconfig_build_extends", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L2", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "target": "ref_tsconfig_json", "relation": "extends", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L2", "weight": 1.0, "context": "import"}, {"source": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "target": "hypothesis_machine_tsconfig_build_compileroptions", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_tsconfig_build_compileroptions", "target": "hypothesis_machine_tsconfig_build_compileroptions_rootdir", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_tsconfig_build_compileroptions", "target": "hypothesis_machine_tsconfig_build_compileroptions_outdir", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_tsconfig_build_compileroptions", "target": "hypothesis_machine_tsconfig_build_compileroptions_declaration", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L3", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "target": "hypothesis_machine_tsconfig_build_include", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L4", "weight": 1.0}, {"source": "hypothesis_machine_tsconfig_build_include", "target": "ref_src_ts", "relation": "extends", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L4", "weight": 1.0, "context": "import"}, {"source": "home_emil_desktop_hypothesis_machine_tsconfig_build_json", "target": "hypothesis_machine_tsconfig_build_exclude", "relation": "contains", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L5", "weight": 1.0}, {"source": "hypothesis_machine_tsconfig_build_exclude", "target": "ref_tests", "relation": "extends", "confidence": "EXTRACTED", "source_file": "tsconfig.build.json", "source_location": "L5", "weight": 1.0, "context": "import"}]}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_docs_pi_capabilities_md", "label": "pi-capabilities.md", "file_type": "document", "source_file": "docs/pi-capabilities.md", "source_location": "L1"}, {"id": "docs_pi_capabilities_verified_pi_capabilities_0_83_0", "label": "Verified Pi capabilities (0.83.0)", "file_type": "document", "source_file": "docs/pi-capabilities.md", "source_location": "L1"}, {"id": "docs_pi_capabilities_reused_from_pi", "label": "Reused from Pi", "file_type": "document", "source_file": "docs/pi-capabilities.md", "source_location": "L8"}, {"id": "docs_pi_capabilities_implemented_here", "label": "Implemented here", "file_type": "document", "source_file": "docs/pi-capabilities.md", "source_location": "L34"}, {"id": "docs_pi_capabilities_assumptions_corrected_after_verification", "label": "Assumptions corrected after verification", "file_type": "document", "source_file": "docs/pi-capabilities.md", "source_location": "L48"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_docs_pi_capabilities_md", "target": "docs_pi_capabilities_verified_pi_capabilities_0_83_0", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/pi-capabilities.md", "source_location": "L1", "weight": 1.0}, {"source": "docs_pi_capabilities_verified_pi_capabilities_0_83_0", "target": "docs_pi_capabilities_reused_from_pi", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/pi-capabilities.md", "source_location": "L8", "weight": 1.0}, {"source": "docs_pi_capabilities_verified_pi_capabilities_0_83_0", "target": "docs_pi_capabilities_implemented_here", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/pi-capabilities.md", "source_location": "L34", "weight": 1.0}, {"source": "docs_pi_capabilities_verified_pi_capabilities_0_83_0", "target": "docs_pi_capabilities_assumptions_corrected_after_verification", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/pi-capabilities.md", "source_location": "L48", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_prompts_synthesis_md", "label": "synthesis.md", "file_type": "document", "source_file": "prompts/synthesis.md", "source_location": "L1"}, {"id": "prompts_synthesis_synthesis", "label": "Synthesis", "file_type": "document", "source_file": "prompts/synthesis.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_prompts_synthesis_md", "target": "prompts_synthesis_synthesis", "relation": "contains", "confidence": "EXTRACTED", "source_file": "prompts/synthesis.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_prompts_agent_base_md", "label": "agent-base.md", "file_type": "document", "source_file": "prompts/agent-base.md", "source_location": "L1"}, {"id": "prompts_agent_base_recursive_research_agent", "label": "Recursive research agent", "file_type": "document", "source_file": "prompts/agent-base.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_prompts_agent_base_md", "target": "prompts_agent_base_recursive_research_agent", "relation": "contains", "confidence": "EXTRACTED", "source_file": "prompts/agent-base.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_changelog_md", "label": "CHANGELOG.md", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L1"}, {"id": "hypothesis_machine_changelog_changelog", "label": "Changelog", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L1"}, {"id": "hypothesis_machine_changelog_unreleased", "label": "Unreleased", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L3"}, {"id": "hypothesis_machine_changelog_0_1_1_2026_07_31", "label": "0.1.1 \u2014 2026-07-31", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L55"}, {"id": "hypothesis_machine_changelog_0_1_0_2026_07_31", "label": "0.1.0 \u2014 2026-07-31", "file_type": "document", "source_file": "CHANGELOG.md", "source_location": "L68"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_changelog_md", "target": "hypothesis_machine_changelog_changelog", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L1", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_unreleased", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_0_1_1_2026_07_31", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L55", "weight": 1.0}, {"source": "hypothesis_machine_changelog_changelog", "target": "hypothesis_machine_changelog_0_1_0_2026_07_31", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CHANGELOG.md", "source_location": "L68", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_prompts_supervisor_md", "label": "supervisor.md", "file_type": "document", "source_file": "prompts/supervisor.md", "source_location": "L1"}, {"id": "prompts_supervisor_hypothesis_machine_supervisor", "label": "Hypothesis Machine Supervisor", "file_type": "document", "source_file": "prompts/supervisor.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_prompts_supervisor_md", "target": "prompts_supervisor_hypothesis_machine_supervisor", "relation": "contains", "confidence": "EXTRACTED", "source_file": "prompts/supervisor.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_security_md", "label": "SECURITY.md", "file_type": "document", "source_file": "SECURITY.md", "source_location": "L1"}, {"id": "hypothesis_machine_security_security_policy", "label": "Security policy", "file_type": "document", "source_file": "SECURITY.md", "source_location": "L1"}, {"id": "hypothesis_machine_security_supported_versions", "label": "Supported versions", "file_type": "document", "source_file": "SECURITY.md", "source_location": "L3"}, {"id": "hypothesis_machine_security_reporting_a_vulnerability", "label": "Reporting a vulnerability", "file_type": "document", "source_file": "SECURITY.md", "source_location": "L8"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_security_md", "target": "hypothesis_machine_security_security_policy", "relation": "contains", "confidence": "EXTRACTED", "source_file": "SECURITY.md", "source_location": "L1", "weight": 1.0}, {"source": "hypothesis_machine_security_security_policy", "target": "hypothesis_machine_security_supported_versions", "relation": "contains", "confidence": "EXTRACTED", "source_file": "SECURITY.md", "source_location": "L3", "weight": 1.0}, {"source": "hypothesis_machine_security_security_policy", "target": "hypothesis_machine_security_reporting_a_vulnerability", "relation": "contains", "confidence": "EXTRACTED", "source_file": "SECURITY.md", "source_location": "L8", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_security_md", "target": "home_emil_desktop_hypothesis_machine_docs_security_md", "relation": "references", "confidence": "EXTRACTED", "source_file": "SECURITY.md", "source_location": "L20", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_docs_releasing_md", "label": "releasing.md", "file_type": "document", "source_file": "docs/releasing.md", "source_location": "L1"}, {"id": "docs_releasing_releasing", "label": "Releasing", "file_type": "document", "source_file": "docs/releasing.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_docs_releasing_md", "target": "docs_releasing_releasing", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/releasing.md", "source_location": "L1", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_docs_releasing_md", "target": "home_emil_desktop_hypothesis_machine_docs_security_md", "relation": "references", "confidence": "EXTRACTED", "source_file": "docs/releasing.md", "source_location": "L27", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_contributing_md", "label": "CONTRIBUTING.md", "file_type": "document", "source_file": "CONTRIBUTING.md", "source_location": "L1"}, {"id": "hypothesis_machine_contributing_contributing", "label": "Contributing", "file_type": "document", "source_file": "CONTRIBUTING.md", "source_location": "L1"}, {"id": "hypothesis_machine_contributing_local_setup", "label": "Local setup", "file_type": "document", "source_file": "CONTRIBUTING.md", "source_location": "L7"}, {"id": "hypothesis_machine_contributing_pull_requests", "label": "Pull requests", "file_type": "document", "source_file": "CONTRIBUTING.md", "source_location": "L22"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_contributing_md", "target": "hypothesis_machine_contributing_contributing", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L1", "weight": 1.0}, {"source": "hypothesis_machine_contributing_contributing", "target": "hypothesis_machine_contributing_local_setup", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L7", "weight": 1.0}, {"source": "hypothesis_machine_contributing_contributing", "target": "hypothesis_machine_contributing_pull_requests", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L22", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_contributing_md", "target": "home_emil_desktop_hypothesis_machine_docs_development_md", "relation": "references", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L37", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_contributing_md", "target": "home_emil_desktop_hypothesis_machine_docs_architecture_md", "relation": "references", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L38", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_contributing_md", "target": "home_emil_desktop_hypothesis_machine_docs_security_md", "relation": "references", "confidence": "EXTRACTED", "source_file": "CONTRIBUTING.md", "source_location": "L39", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_docs_security_md", "label": "security.md", "file_type": "document", "source_file": "docs/security.md", "source_location": "L1"}, {"id": "docs_security_security_model", "label": "Security model", "file_type": "document", "source_file": "docs/security.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_docs_security_md", "target": "docs_security_security_model", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/security.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_docs_architecture_md", "label": "architecture.md", "file_type": "document", "source_file": "docs/architecture.md", "source_location": "L1"}, {"id": "docs_architecture_architecture", "label": "Architecture", "file_type": "document", "source_file": "docs/architecture.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_docs_architecture_md", "target": "docs_architecture_architecture", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/architecture.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_github_pull_request_template_md", "label": "pull_request_template.md", "file_type": "document", "source_file": ".github/pull_request_template.md", "source_location": "L1"}, {"id": "github_pull_request_template_summary", "label": "Summary", "file_type": "document", "source_file": ".github/pull_request_template.md", "source_location": "L1"}, {"id": "github_pull_request_template_verification", "label": "Verification", "file_type": "document", "source_file": ".github/pull_request_template.md", "source_location": "L5"}, {"id": "github_pull_request_template_security_and_data", "label": "Security and data", "file_type": "document", "source_file": ".github/pull_request_template.md", "source_location": "L12"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_github_pull_request_template_md", "target": "github_pull_request_template_summary", "relation": "contains", "confidence": "EXTRACTED", "source_file": ".github/pull_request_template.md", "source_location": "L1", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_github_pull_request_template_md", "target": "github_pull_request_template_verification", "relation": "contains", "confidence": "EXTRACTED", "source_file": ".github/pull_request_template.md", "source_location": "L5", "weight": 1.0}, {"source": "home_emil_desktop_hypothesis_machine_github_pull_request_template_md", "target": "github_pull_request_template_security_and_data", "relation": "contains", "confidence": "EXTRACTED", "source_file": ".github/pull_request_template.md", "source_location": "L12", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_prompts_retrospective_md", "label": "retrospective.md", "file_type": "document", "source_file": "prompts/retrospective.md", "source_location": "L1"}, {"id": "prompts_retrospective_team_retrospective", "label": "Team retrospective", "file_type": "document", "source_file": "prompts/retrospective.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_prompts_retrospective_md", "target": "prompts_retrospective_team_retrospective", "relation": "contains", "confidence": "EXTRACTED", "source_file": "prompts/retrospective.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_services_browser_worker_readme_md", "label": "README.md", "file_type": "document", "source_file": "services/browser-worker/README.md", "source_location": "L1"}, {"id": "browser_worker_readme_browser_use_adapter_contract", "label": "Browser Use adapter contract", "file_type": "document", "source_file": "services/browser-worker/README.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_services_browser_worker_readme_md", "target": "browser_worker_readme_browser_use_adapter_contract", "relation": "contains", "confidence": "EXTRACTED", "source_file": "services/browser-worker/README.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
@@ -0,0 +1 @@
{"nodes": [{"id": "home_emil_desktop_hypothesis_machine_docs_development_md", "label": "development.md", "file_type": "document", "source_file": "docs/development.md", "source_location": "L1"}, {"id": "docs_development_development", "label": "Development", "file_type": "document", "source_file": "docs/development.md", "source_location": "L1"}], "edges": [{"source": "home_emil_desktop_hypothesis_machine_docs_development_md", "target": "docs_development_development", "relation": "contains", "confidence": "EXTRACTED", "source_file": "docs/development.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"/home/emil/Desktop/hypothesis-machine/package.json":{"size":1331,"mtime_ns":1785526465209535381,"hash":"f7514b7033a121f12b8960b05cad5a29bb4636b9641740561adc3b75352f95cb"},"/home/emil/Desktop/hypothesis-machine/tsconfig.build.json":{"size":171,"mtime_ns":1785523498961599333,"hash":"25868e1e77377761e5f756724739440927cdecf3d48c2800816407ef81b79222"},"/home/emil/Desktop/hypothesis-machine/tsconfig.json":{"size":430,"mtime_ns":1785523498961599333,"hash":"49863ef1ecd0b134189964c301f95090bf082241233c16055decd9aca6a9a314"},"/home/emil/Desktop/hypothesis-machine/.github/pull_request_template.md":{"size":534,"mtime_ns":1785526202969401851,"hash":"d76aeee1b42b19491e04604e657c0115b9b34df747f02b126e162df16538df1a"},"/home/emil/Desktop/hypothesis-machine/CHANGELOG.md":{"size":4559,"mtime_ns":1785531669243473488,"hash":"769d7b6bd162d14987cbe61d8f4563221c8450f44f201224c92c874efb2081c6"},"/home/emil/Desktop/hypothesis-machine/CONTRIBUTING.md":{"size":1522,"mtime_ns":1785526465210535393,"hash":"991a374ba1a32e74466f14e615736dec364ef2e22af71d3721a13e9f7779fd2c"},"/home/emil/Desktop/hypothesis-machine/README.md":{"size":6441,"mtime_ns":1785526465209535381,"hash":"d0ba5495074caf139af024082008ec136d4609995f58d431d716d24953bd7c07"},"/home/emil/Desktop/hypothesis-machine/SECURITY.md":{"size":974,"mtime_ns":1785526202966401815,"hash":"7870d4b34102270e45e1453c6052b25af09f1fe13bfdc4f244108b66a1e9a34b"},"/home/emil/Desktop/hypothesis-machine/docs/architecture.md":{"size":2002,"mtime_ns":1785524693984370854,"hash":"c04eb13e5a1728dc27f72e94bf88c179d26719c684e7f5f6129222910ae795cf"},"/home/emil/Desktop/hypothesis-machine/docs/development.md":{"size":1283,"mtime_ns":1785526465211535405,"hash":"f4af7af03f18576be7dbfec448e1443911d7fe43eabe9dc8ea0240052ff3383e"},"/home/emil/Desktop/hypothesis-machine/docs/pi-capabilities.md":{"size":4716,"mtime_ns":1785525665668981602,"hash":"32246de16c8fb36b826cb70b489f91ee0b3e5073bcbde729853ca04813fda9e4"},"/home/emil/Desktop/hypothesis-machine/docs/releasing.md":{"size":1269,"mtime_ns":1785526465213535429,"hash":"902bf6e8f541fbce500197fb303fb0ccfa2571998ee5bc57d7227e0f8d059b5a"},"/home/emil/Desktop/hypothesis-machine/docs/security.md":{"size":2817,"mtime_ns":1785526465213535429,"hash":"b8e428dd89560c6487d0177ae3f0b168dec24ef7727ad959e06f58dff206c5a1"},"/home/emil/Desktop/hypothesis-machine/prompts/agent-base.md":{"size":309,"mtime_ns":1785524192916593472,"hash":"6290b9307d35d28616e10d0043fd69150fac94ec4489b7a27a7fa1bbe830edf0"},"/home/emil/Desktop/hypothesis-machine/prompts/retrospective.md":{"size":244,"mtime_ns":1785524192917593484,"hash":"e16601b436e781f625c271fe5637d73c23a61780d3022ba0368503fc3b0516a9"},"/home/emil/Desktop/hypothesis-machine/prompts/supervisor.md":{"size":326,"mtime_ns":1785524192916593472,"hash":"78358e240ac6321433f93b14f138b6de917bba392078cb2e831f0276721968f3"},"/home/emil/Desktop/hypothesis-machine/prompts/synthesis.md":{"size":203,"mtime_ns":1785524192916593472,"hash":"33a91ff7d9ddc51110b59f673dea6bf954c48a6fc880f9a06b713dacb6c2c109"},"/home/emil/Desktop/hypothesis-machine/services/browser-worker/README.md":{"size":945,"mtime_ns":1785524192915593461,"hash":"eac3a08976ae79cb79300181be5b1b6cb8d0dd4a27aa8940e4e473a8429a15b8"}}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+272
View File
@@ -0,0 +1,272 @@
{
"eslint.config.js": {
"mtime": 1785523498.9615993,
"ast_hash": "c7b81de2b61a96038029263253de6367",
"semantic_hash": ""
},
"package.json": {
"mtime": 1785526465.2095354,
"ast_hash": "2175d7849ad80beeb50a48fa8e8fe318",
"semantic_hash": ""
},
"src/agent-factory.ts": {
"mtime": 1785524670.1400938,
"ast_hash": "858e097f20b3c5dab9fe95a9487bae46",
"semantic_hash": ""
},
"src/agent-spec.ts": {
"mtime": 1785524686.056277,
"ast_hash": "c2ed4093a8b133a2901f3299f815dffd",
"semantic_hash": ""
},
"src/agent-tree-ui.ts": {
"mtime": 1785531669.2444735,
"ast_hash": "46092f42e39c542b5322ba4801ae1610",
"semantic_hash": ""
},
"src/agent-tree.ts": {
"mtime": 1785529482.8530595,
"ast_hash": "23c628c8f9408da01a358077811f9303",
"semantic_hash": ""
},
"src/config.ts": {
"mtime": 1785529455.9927368,
"ast_hash": "09356c0841160e09eda09a1a121c079a",
"semantic_hash": ""
},
"src/index.ts": {
"mtime": 1785530491.219887,
"ast_hash": "1846411ba1b6d03e16a11f5aaf768c6c",
"semantic_hash": ""
},
"src/pi-runtime.ts": {
"mtime": 1785529526.7125866,
"ast_hash": "dca78aafefc1c1d5721fb964aa39d1fb",
"semantic_hash": ""
},
"src/research-loop.ts": {
"mtime": 1785527477.5546405,
"ast_hash": "6d9e857205ff9a7aab3f6e386fceae2c",
"semantic_hash": ""
},
"src/research-memory.ts": {
"mtime": 1785527426.9387124,
"ast_hash": "323a51ca7362d3169141bf33fc1a3916",
"semantic_hash": ""
},
"src/run-store.ts": {
"mtime": 1785523571.639435,
"ast_hash": "2ef9c439c53b389a429f2b7325da8770",
"semantic_hash": ""
},
"src/supervisor.ts": {
"mtime": 1785531669.2444735,
"ast_hash": "6985f08ed3c8641da3c66e36106e77a1",
"semantic_hash": ""
},
"src/tools/experiment.ts": {
"mtime": 1785528116.7027404,
"ast_hash": "d5544b772fac8c3a282857c8f8dc5814",
"semantic_hash": ""
},
"src/tools/index.ts": {
"mtime": 1785529489.207136,
"ast_hash": "8e4fe9e60b37d7d7038bafd25fd47039",
"semantic_hash": ""
},
"src/tools/web.ts": {
"mtime": 1785528095.958494,
"ast_hash": "9dfcfe616c79f4447f993d03ef1a7988",
"semantic_hash": ""
},
"src/types.ts": {
"mtime": 1785529455.9937367,
"ast_hash": "892d91ef98379ef8f733657cb032eadd",
"semantic_hash": ""
},
"tests/agent-spec.test.ts": {
"mtime": 1785524051.1689599,
"ast_hash": "4b3a62766fa2bbdf1e3f5abdd1b20f7e",
"semantic_hash": ""
},
"tests/agent-tree.test.ts": {
"mtime": 1785529507.101351,
"ast_hash": "022be88810f2c08b83c811aec1e47421",
"semantic_hash": ""
},
"tests/confine.test.ts": {
"mtime": 1785528537.6857417,
"ast_hash": "3058a15651ede931efecbeb0ca724058",
"semantic_hash": ""
},
"tests/experiment.test.ts": {
"mtime": 1785528151.0541484,
"ast_hash": "fefe14e591263f9817ee924126de59b0",
"semantic_hash": ""
},
"tests/extension-smoke.test.ts": {
"mtime": 1785524899.0848217,
"ast_hash": "39058644b66fd3e0e77b08c34a6a6d78",
"semantic_hash": ""
},
"tests/helpers.ts": {
"mtime": 1785524553.6187508,
"ast_hash": "4cb1d4b681689d5d8e0451769b986017",
"semantic_hash": ""
},
"tests/memory.test.ts": {
"mtime": 1785527462.459164,
"ast_hash": "ffd5cc871a84d750369265c86b7da7d8",
"semantic_hash": ""
},
"tests/pi-agent-runtime.integration.test.ts": {
"mtime": 1785524511.7732685,
"ast_hash": "db245b752d56fc3df2355ec6536875c7",
"semantic_hash": ""
},
"tests/pi-rpc-smoke.mjs": {
"mtime": 1785525841.187079,
"ast_hash": "306c7daf2ba5be3110bbbd42c47cc73e",
"semantic_hash": ""
},
"tests/research-loop.test.ts": {
"mtime": 1785527442.5569394,
"ast_hash": "99d84fb8ec594697e4c998f14f5cc717",
"semantic_hash": ""
},
"tests/web-security.test.ts": {
"mtime": 1785524051.1699598,
"ast_hash": "760ce533f33a782fa2d803ddb753d60f",
"semantic_hash": ""
},
"tsconfig.build.json": {
"mtime": 1785523498.9615993,
"ast_hash": "33ea7a02db9bb2bb05e7af22fcac9192",
"semantic_hash": ""
},
"tsconfig.json": {
"mtime": 1785523498.9615993,
"ast_hash": "bff06dd08c20cf6987e5be1a174fae07",
"semantic_hash": ""
},
".github/ISSUE_TEMPLATE/bug_report.yml": {
"mtime": 1785526202.9694018,
"ast_hash": "3d38949573d8e9afbfab15d7aec80208",
"semantic_hash": ""
},
".github/ISSUE_TEMPLATE/config.yml": {
"mtime": 1785526202.9694018,
"ast_hash": "74c7aebcc7755d1241890df4fd87c662",
"semantic_hash": ""
},
".github/ISSUE_TEMPLATE/feature_request.yml": {
"mtime": 1785526202.9694018,
"ast_hash": "34406f2d63d0509d67ab199c17f3cf9d",
"semantic_hash": ""
},
".github/dependabot.yml": {
"mtime": 1785526202.968402,
"ast_hash": "9ae2a4d0a6a13b0e77e3f1608ecc515a",
"semantic_hash": ""
},
".github/pull_request_template.md": {
"mtime": 1785526202.9694018,
"ast_hash": "838d15d4640fefb60f534e611607b080",
"semantic_hash": ""
},
".github/workflows/ci.yml": {
"mtime": 1785526202.968402,
"ast_hash": "3f93d66df2cec7c5b6d9f523b7a9b8bb",
"semantic_hash": ""
},
".github/workflows/codeql.yml": {
"mtime": 1785526202.968402,
"ast_hash": "4e919838522fc9dc44909e4c2d09aa0d",
"semantic_hash": ""
},
".hypothesis-machine.example.yaml": {
"mtime": 1785529501.9182887,
"ast_hash": "630dc679669c48ff3578e2d9ed03ad2d",
"semantic_hash": ""
},
"CHANGELOG.md": {
"mtime": 1785531669.2434735,
"ast_hash": "3d4a048fe013eeba0548c01f00a8504a",
"semantic_hash": ""
},
"CONTRIBUTING.md": {
"mtime": 1785526465.2105353,
"ast_hash": "ba26a233b0388cf3bc15d68ca1423392",
"semantic_hash": ""
},
"README.md": {
"mtime": 1785526465.2095354,
"ast_hash": "4f95cd827dc617ee12a1e0f5edfc5f33",
"semantic_hash": ""
},
"SECURITY.md": {
"mtime": 1785526202.9664018,
"ast_hash": "0a275d04059cdb2913d147ba5a8c11eb",
"semantic_hash": ""
},
"docs/architecture.md": {
"mtime": 1785524693.984371,
"ast_hash": "4978fcd79045c6ad10f61fbd2de070cb",
"semantic_hash": ""
},
"docs/development.md": {
"mtime": 1785526465.2115355,
"ast_hash": "aa39cad6227fc294c0b8d4444ef98f09",
"semantic_hash": ""
},
"docs/pi-capabilities.md": {
"mtime": 1785525665.6689816,
"ast_hash": "3c3098e82aa840cdc4e50eebbc342f5d",
"semantic_hash": ""
},
"docs/releasing.md": {
"mtime": 1785526465.2135355,
"ast_hash": "8b59c0d5138f4e24b28b1be187c8cd0f",
"semantic_hash": ""
},
"docs/security.md": {
"mtime": 1785526465.2135355,
"ast_hash": "d1a39881546c3c2a6c80008cf59c3483",
"semantic_hash": ""
},
"infra/compose.yaml": {
"mtime": 1785525739.1668599,
"ast_hash": "d5264ae5950629e067955aa66cbba7f4",
"semantic_hash": ""
},
"infra/searxng/settings.yml": {
"mtime": 1785524192.9155934,
"ast_hash": "4d89744864f680a763838d70ff9c8a7c",
"semantic_hash": ""
},
"prompts/agent-base.md": {
"mtime": 1785524192.9165936,
"ast_hash": "ebc60ed24957c9de9f4dd6087f0e49b1",
"semantic_hash": ""
},
"prompts/retrospective.md": {
"mtime": 1785524192.9175935,
"ast_hash": "e3f0e1d34e6039038cf6f4f06b08a3e4",
"semantic_hash": ""
},
"prompts/supervisor.md": {
"mtime": 1785524192.9165936,
"ast_hash": "95a5ee67953ae0f91dc643add2a32db0",
"semantic_hash": ""
},
"prompts/synthesis.md": {
"mtime": 1785524192.9165936,
"ast_hash": "ce979b164004bdd4d94dcbefd7b00f52",
"semantic_hash": ""
},
"services/browser-worker/README.md": {
"mtime": 1785524192.9155934,
"ast_hash": "8fa8ac55e56b270cd41ee3608c92928e",
"semantic_hash": ""
}
}
-74
View File
@@ -1,5 +1,4 @@
import { Key, matchesKey, truncateToWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
import { closeSync, openSync, readSync, statSync } from "node:fs";
import type { Theme } from "@earendil-works/pi-coding-agent";
import type { AgentTree } from "./agent-tree.js";
import type { AgentRecord } from "./types.js";
@@ -45,79 +44,6 @@ function elapsed(record: AgentRecord, now: number): string {
return `${String(Math.floor(span / 60)).padStart(2, "0")}:${String(span % 60).padStart(2, "0")}`;
}
/** Cache of the last observed session-file size and its extracted activity line. */
const activityCache = new Map<string, { size: number; line: string }>();
function collapse(text: string): string { return text.replace(/\s+/g, " ").trim(); }
/** Read the tail of an agent session file and extract its most recent activity: last tool call (name + query) or last assistant text. */
export function agentLastActivity(sessionFile: string | undefined): string | undefined {
if (!sessionFile) return undefined;
let size: number;
try { size = statSync(sessionFile).size; } catch { return undefined; }
const cached = activityCache.get(sessionFile);
if (cached && cached.size === size) return cached.line || undefined;
let text = "";
try {
const fd = openSync(sessionFile, "r");
try { const start = Math.max(0, size - 65536); const buf = Buffer.alloc(size - start); readSync(fd, buf, 0, buf.length, start); text = buf.toString("utf8"); } finally { closeSync(fd); }
} catch { return cached?.line || undefined; }
const queries = new Map<string, string | undefined>();
let toolName: string | undefined; let toolId: string | undefined; let lastText: string | undefined;
for (const raw of text.split("\n")) {
let entry: { message?: { role?: string; toolName?: string; toolCallId?: string; content?: Array<{ type?: string; id?: string; name?: string; arguments?: unknown; text?: string }> } };
try { entry = JSON.parse(raw) as typeof entry; } catch { continue; }
const msg = entry?.message; if (!msg) continue;
if (msg.role === "toolResult") { toolName = msg.toolName; toolId = msg.toolCallId; }
if (msg.role === "assistant" && Array.isArray(msg.content)) {
for (const part of msg.content) {
if (part?.type === "toolCall" && typeof part.id === "string") {
const args = part.arguments as Record<string, unknown> | undefined;
const query = typeof args?.query === "string" ? args.query : args ? String(Object.values(args)[0] ?? "") : "";
queries.set(part.id, query);
}
if (part?.type === "text" && typeof part.text === "string" && part.text.trim()) lastText = collapse(part.text);
}
}
}
const line = toolName ? ` ${toolName}${toolId && queries.get(toolId) ? `: \"${queries.get(toolId)}\"` : ""}` : lastText ? ` ${lastText}` : "";
activityCache.set(sessionFile, { size, line });
return line || undefined;
}
/** Persistent non-capturing right-side panel: live agent tree without keyboard navigation. */
export function createAgentPanelComponent(
tree: AgentTree,
tui: { requestRender(): void },
theme: Theme,
done: () => void,
): { render(width: number): string[]; invalidate(): void; handleInput(data: string): void; dispose(): void } {
const timer = setInterval(() => tui.requestRender(), 1500);
return {
render(width) {
const rows = buildRows(tree).filter((row) => row.depth > 0);
const now = Date.now();
const active = rows.filter((row) => row.record.status === "running" || row.record.status === "waiting").length;
const lines: string[] = [theme.fg("accent", `◆ agents`) + theme.fg("dim", ` · ${tree.runId}`), theme.fg("dim", `${active} active · ${rows.length} agents`), ""];
for (const { record, prefix } of rows) {
const icon = STATUS_ICON[record.status];
const status = STATUS_COLOR[record.status](theme, record.status);
const time = elapsed(record, now);
lines.push(`${prefix}${theme.fg("text", icon)} ${theme.fg("text", shortName(record.id))} ${status}${time ? ` ${theme.fg("dim", time)}` : ""}`);
if (record.status === "running" || record.status === "waiting") {
const activity = agentLastActivity(record.sessionFile);
if (activity) lines.push(theme.fg("dim", ` ${truncateToWidth(activity, Math.max(20, width - 8))}`));
}
}
lines.push("", theme.fg("dim", "/agents — details · /agents-panel — hide"));
return lines.map((line) => truncateToWidth(line, width));
},
invalidate() { /* rebuilt fresh on every render */ },
handleInput() { /* non-capturing: keys go to the editor */ },
dispose() { clearInterval(timer); },
};
}
/** Interactive overlay showing the full agent tree with live statuses, keyboard navigation, and a detail pane. */
export function createAgentTreeOverlay(
tree: AgentTree,
-1
View File
@@ -12,7 +12,6 @@ export default function hypothesisMachine(pi: ExtensionAPI): void {
pi.registerCommand("team", { description: "Show the recursive research team", handler: async (_args, ctx) => { ctx.ui.notify(supervisor.team(), "info"); } });
pi.registerCommand("agents", { description: "Show the interactive agent tree overlay", handler: async (_args, ctx) => { await supervisor.showAgentTree(ctx); } });
pi.registerCommand("agents-panel", { description: "Toggle a persistent right-side agent panel", handler: async (_args, ctx) => { if (supervisor.agentPanelClose) { supervisor.agentPanelClose(); ctx.ui.notify("Agent panel closed", "info"); return; } if (!supervisor.tree) { ctx.ui.notify("Hypothesis Machine is not initialized", "warning"); return; } void supervisor.showAgentPanel(ctx); ctx.ui.notify("Agent panel opened (needs a wide terminal)", "info"); } });
pi.registerCommand("research", { description: "Start a bounded research run", handler: async (args, ctx) => { const goal = args.trim(); if (!goal) { ctx.ui.notify("Usage: /research <goal>", "warning"); return; } const state = supervisor.loop; if (!state || !supervisor.tree) throw new Error("Not initialized"); supervisor.tree.setGoal(goal); state.setGoal(goal); state.start(); const prompt = `Research goal: ${goal}\nUse research_control and the recursive agent tools. Create specialized children only when useful. Record each iteration and stop on the coded conditions. Report important progress without flooding the chat.`; if (ctx.isIdle()) pi.sendUserMessage(prompt); else pi.sendUserMessage(prompt, { deliverAs: "followUp" }); } });
pi.registerCommand("research-status", { description: "Show research loop state", handler: async (_args, ctx) => { ctx.ui.notify(JSON.stringify(supervisor.loop?.snapshot() ?? {}, null, 2), "info"); } });
pi.registerCommand("research-pause", { description: "Pause spawning and the loop", handler: async (_args, ctx) => { if (supervisor.loop?.snapshot().status !== "running") { ctx.ui.notify("Cannot pause a non-running loop", "warning"); return; } supervisor.loop?.pause(); supervisor.tree?.pause(); ctx.ui.notify("Research paused", "info"); } });
+2 -16
View File
@@ -1,7 +1,7 @@
import { resolve } from "node:path";
import { defineTool, ModelRuntime, type ExtensionAPI, type ExtensionContext, type ModelRegistry, type Theme, type ToolDefinition } from "@earendil-works/pi-coding-agent";
import { Text, truncateToWidth } from "@earendil-works/pi-tui";
import { createAgentPanelComponent, createAgentTreeOverlay } from "./agent-tree-ui.js";
import { createAgentTreeOverlay } from "./agent-tree-ui.js";
import { Type } from "typebox";
import { StringEnum } from "@earendil-works/pi-ai";
import { AgentTree } from "./agent-tree.js";
@@ -24,8 +24,6 @@ export class SupervisorIntegration {
private lastScheduledIteration = 0;
private widgetTimer: NodeJS.Timeout | undefined;
private requestAgentRender: (() => void) | undefined;
/** Closes the persistent right-side agent panel if it is open. */
agentPanelClose: (() => void) | undefined;
constructor(private readonly pi: ExtensionAPI) {}
async start(ctx: ExtensionContext): Promise<void> {
@@ -75,18 +73,6 @@ export class SupervisorIntegration {
});
}
/** Open a persistent non-capturing agent panel on the right side (OpenCode-style). */
async showAgentPanel(ctx: ExtensionContext): Promise<void> {
const tree = this.required().tree;
await ctx.ui.custom<undefined>((tui, theme, _kb, done) => {
this.agentPanelClose = () => done(undefined);
return createAgentPanelComponent(tree, tui, theme, () => { this.agentPanelClose = undefined; done(undefined); });
}, {
overlay: true,
overlayOptions: { width: "40%", minWidth: 44, maxHeight: "100%", anchor: "top-right", margin: 1, nonCapturing: true, visible: (termWidth) => termWidth >= 100 },
});
}
/** Live subagent dashboard widget above the editor, refreshed on a light timer. */
private installAgentWidget(ctx: ExtensionContext): void {
ctx.ui.setWidget("hm-agents", (tui, theme) => {
@@ -122,5 +108,5 @@ export class SupervisorIntegration {
private shortName(id: string): string { return id.replace(/-[a-f0-9]{8}$/, ""); }
continueIfNeeded(ctx: ExtensionContext): void { const loop = this.loop; if (!loop || !ctx.isIdle()) return; const state = loop.snapshot(); if (state.status !== "running" || state.iteration <= this.lastScheduledIteration) return; this.lastScheduledIteration = state.iteration; if (ctx.hasUI) ctx.ui.setStatus("hypothesis-machine", `HM ${state.runId} · iteration ${state.iteration + 1}`); this.pi.sendUserMessage(`Continue bounded research run ${state.runId} with iteration ${state.iteration + 1}. Reassess unknowns and contradictions, use agents only where they add information, then call research_control record_iteration. Stop when its coded state is no longer running.`); }
async shutdown(): Promise<void> { this.agentPanelClose?.(); this.agentPanelClose = undefined; if (this.widgetTimer) { clearInterval(this.widgetTimer); this.widgetTimer = undefined; } this.requestAgentRender = undefined; await this.tree?.shutdown(); this.memory?.close(); this.tree = undefined; }
async shutdown(): Promise<void> { if (this.widgetTimer) { clearInterval(this.widgetTimer); this.widgetTimer = undefined; } this.requestAgentRender = undefined; await this.tree?.shutdown(); this.memory?.close(); this.tree = undefined; }
}