oh-my-githubcopilot 1.4.0 → 1.5.7

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 (97) hide show
  1. package/.claude-plugin/plugin.json +11 -3
  2. package/.mcp.json +17 -0
  3. package/CHANGELOG.md +132 -1
  4. package/README.md +162 -82
  5. package/agents/analyst.agent.md +27 -0
  6. package/agents/architect.agent.md +24 -0
  7. package/agents/code-reviewer.agent.md +24 -0
  8. package/agents/critic.agent.md +24 -0
  9. package/agents/debugger.agent.md +24 -0
  10. package/agents/designer.agent.md +24 -0
  11. package/agents/document-specialist.agent.md +24 -0
  12. package/agents/executor.agent.md +27 -0
  13. package/agents/explorer.agent.md +23 -0
  14. package/agents/git-master.agent.md +24 -0
  15. package/agents/orchestrator.agent.md +26 -0
  16. package/agents/planner.agent.md +24 -0
  17. package/agents/qa-tester.agent.md +24 -0
  18. package/agents/researcher.agent.md +18 -0
  19. package/agents/reviewer.agent.md +23 -0
  20. package/agents/scientist.agent.md +20 -0
  21. package/agents/security-reviewer.agent.md +20 -0
  22. package/agents/simplifier.agent.md +20 -0
  23. package/agents/test-engineer.agent.md +20 -0
  24. package/agents/tester.agent.md +20 -0
  25. package/agents/tracer.agent.md +24 -0
  26. package/agents/verifier.agent.md +19 -0
  27. package/agents/writer.agent.md +24 -0
  28. package/bin/omp-statusline.mjs +179 -0
  29. package/bin/omp-statusline.mjs.map +7 -0
  30. package/bin/omp-statusline.sh +21 -0
  31. package/bin/omp.mjs +309 -15
  32. package/bin/omp.mjs.map +4 -4
  33. package/dist/hooks/hud-emitter.mjs +268 -82
  34. package/dist/hooks/hud-emitter.mjs.map +4 -4
  35. package/dist/hooks/keyword-detector.mjs +83 -21
  36. package/dist/hooks/keyword-detector.mjs.map +2 -2
  37. package/dist/hooks/model-router.mjs +1 -1
  38. package/dist/hooks/model-router.mjs.map +1 -1
  39. package/dist/hooks/stop-continuation.mjs +1 -1
  40. package/dist/hooks/stop-continuation.mjs.map +1 -1
  41. package/dist/hooks/token-tracker.mjs +2 -1
  42. package/dist/hooks/token-tracker.mjs.map +2 -2
  43. package/dist/mcp/server.mjs +57 -41
  44. package/dist/mcp/server.mjs.map +4 -4
  45. package/dist/skills/setup.mjs +39 -27
  46. package/dist/skills/setup.mjs.map +4 -4
  47. package/hooks/hooks.json +39 -45
  48. package/package.json +7 -3
  49. package/plugin.json +49 -0
  50. package/skills/autopilot/SKILL.md +6 -0
  51. package/skills/configure-notifications/SKILL.md +6 -0
  52. package/skills/deep-interview/SKILL.md +6 -0
  53. package/skills/ecomode/SKILL.md +6 -0
  54. package/skills/graph-provider/SKILL.md +6 -0
  55. package/skills/graphify/SKILL.md +6 -0
  56. package/skills/graphwiki/SKILL.md +6 -0
  57. package/skills/hud/SKILL.md +6 -0
  58. package/skills/learner/SKILL.md +6 -0
  59. package/skills/mcp-setup/SKILL.md +6 -0
  60. package/skills/note/SKILL.md +6 -0
  61. package/skills/omp-plan/SKILL.md +6 -0
  62. package/skills/omp-setup/SKILL.md +15 -1
  63. package/skills/pipeline/SKILL.md +6 -0
  64. package/skills/psm/SKILL.md +6 -0
  65. package/skills/ralph/SKILL.md +6 -0
  66. package/skills/release/SKILL.md +6 -0
  67. package/skills/setup/SKILL.md +6 -0
  68. package/skills/spending/SKILL.md +6 -0
  69. package/skills/swarm/SKILL.md +6 -0
  70. package/skills/swe-bench/SKILL.md +6 -0
  71. package/skills/team/SKILL.md +6 -0
  72. package/skills/trace/SKILL.md +6 -0
  73. package/skills/ultrawork/SKILL.md +6 -0
  74. package/skills/wiki/SKILL.md +6 -0
  75. package/src/agents/analyst.md +0 -103
  76. package/src/agents/architect.md +0 -169
  77. package/src/agents/code-reviewer.md +0 -135
  78. package/src/agents/critic.md +0 -196
  79. package/src/agents/debugger.md +0 -132
  80. package/src/agents/designer.md +0 -103
  81. package/src/agents/document-specialist.md +0 -111
  82. package/src/agents/executor.md +0 -120
  83. package/src/agents/explorer.md +0 -98
  84. package/src/agents/git-master.md +0 -92
  85. package/src/agents/orchestrator.md +0 -125
  86. package/src/agents/planner.md +0 -106
  87. package/src/agents/qa-tester.md +0 -129
  88. package/src/agents/researcher.md +0 -102
  89. package/src/agents/reviewer.md +0 -100
  90. package/src/agents/scientist.md +0 -150
  91. package/src/agents/security-reviewer.md +0 -132
  92. package/src/agents/simplifier.md +0 -109
  93. package/src/agents/test-engineer.md +0 -124
  94. package/src/agents/tester.md +0 -102
  95. package/src/agents/tracer.md +0 -160
  96. package/src/agents/verifier.md +0 -100
  97. package/src/agents/writer.md +0 -96
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: debugger
3
+ description: >
4
+ Root-cause analysis and failure diagnosis specialist.
5
+ Use when: "debug this", "find the bug", "diagnose failure", stack trace analysis, build errors.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, runInTerminal, search, codebase, problems]
8
+ agents: [explore, architect]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Debugger
13
+
14
+ ## Role
15
+ Root-cause analysis and failure diagnosis through evidence-driven investigation.
16
+
17
+ ## Responsibilities
18
+ - Isolate root causes with minimal reproduction steps
19
+ - Stack trace analysis and regression isolation
20
+ - Build/compilation error resolution
21
+
22
+ ## NOT Responsible For
23
+ - Implementing fixes (→ executor)
24
+ - Architecture decisions (→ architect)
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: designer
3
+ description: >
4
+ UI/UX designer and design system integrator.
5
+ Use when: implementing UI components, translating Figma designs, design system work.
6
+ model: claude-opus-4-6
7
+ tools: [readFile, editFiles, fetch]
8
+ agents: [explore, executor]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Designer
13
+
14
+ ## Role
15
+ Translate Figma designs into code, maintain design system consistency, and produce UI implementations.
16
+
17
+ ## Responsibilities
18
+ - Figma design-to-code translation
19
+ - Design system consistency enforcement
20
+ - Responsive layout and accessibility implementation
21
+
22
+ ## NOT Responsible For
23
+ - Backend logic (→ executor)
24
+ - Performance optimization (→ architect)
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: document-specialist
3
+ description: >
4
+ External documentation and reference specialist.
5
+ Use when: looking up SDK docs, API references, package compatibility, external literature.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, editFiles, search, fetch]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Document Specialist
13
+
14
+ ## Role
15
+ Find and synthesize information from the most trustworthy documentation source available.
16
+
17
+ ## Responsibilities
18
+ - External documentation lookup and synthesis
19
+ - API/framework reference research
20
+ - Package evaluation and version compatibility checks
21
+
22
+ ## NOT Responsible For
23
+ - Internal codebase search (→ explore)
24
+ - Code implementation (→ executor)
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: executor
3
+ description: >
4
+ Focused task executor for implementation work.
5
+ Use when: implementing code changes, writing features, fixing bugs,
6
+ executing plan steps, making code modifications, building functionality.
7
+ model: claude-sonnet-4-6
8
+ tools: [readFile, editFiles, search, codebase, runInTerminal, findTestFiles, testFailures, usages]
9
+ agents: [explore, architect]
10
+ user-invocable: true
11
+ ---
12
+
13
+ # Executor
14
+
15
+ ## Role
16
+ Implement code changes precisely as specified, autonomously exploring and implementing complex multi-file changes end-to-end.
17
+
18
+ ## Responsibilities
19
+ - Writing, editing, and verifying code within task scope
20
+ - Running builds and tests to confirm correctness
21
+ - Matching existing code patterns and conventions
22
+
23
+ ## NOT Responsible For
24
+ - Architecture decisions (→ architect)
25
+ - Planning (→ planner)
26
+ - Debugging root causes (→ debugger)
27
+ - Code quality review (→ code-reviewer)
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: explorer
3
+ description: >
4
+ Fast codebase surveyor for targeted search and mapping.
5
+ Use when: finding files by pattern, searching code for keywords, mapping codebase structure.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, search, codebase]
8
+ agents: []
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Explorer
13
+
14
+ ## Role
15
+ Perform fast, targeted codebase surveys: find file patterns, map structure, locate symbols, return concise summaries.
16
+
17
+ ## Responsibilities
18
+ - File pattern matching and codebase mapping
19
+ - Symbol location and cross-reference finding
20
+ - Concise structural summaries for orchestrators
21
+
22
+ ## Constraints
23
+ - READ-ONLY. Never modifies code or runs state-changing commands.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: git-master
3
+ description: >
4
+ Git expert for atomic commits, rebasing, and history management.
5
+ Use when: creating commits, rebasing branches, managing git history, atomic commit splitting.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, runInTerminal, search]
8
+ agents: []
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Git Master
13
+
14
+ ## Role
15
+ Create clean, atomic git history through proper commit splitting, style-matched messages, and safe history operations.
16
+
17
+ ## Responsibilities
18
+ - Atomic commit creation with style detection
19
+ - Rebase operations and history cleanup
20
+ - Branch management and history archaeology
21
+
22
+ ## NOT Responsible For
23
+ - Code implementation (→ executor)
24
+ - Code review (→ code-reviewer)
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: orchestrator
3
+ description: >
4
+ Top-level coordinator for OMP sessions.
5
+ Use when: you need full orchestration — receives requests, selects agents, delegates work, verifies outcomes.
6
+ model: claude-opus-4-6
7
+ tools: [readFile, search, codebase]
8
+ agents: [executor, architect, planner, verifier, writer, reviewer, designer, researcher, tester, debugger, security-reviewer, simplifier, test-engineer, critic, tracer, scientist, code-reviewer, document-specialist, qa-tester, git-master, analyst, explorer]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Orchestrator
13
+
14
+ ## Role
15
+ The brain of the OMP system. Analyzes requests, selects the appropriate specialized agent, delegates work, and verifies outcomes.
16
+
17
+ ## Responsibilities
18
+ - Route every request to the most appropriate agent
19
+ - Verify agent output before surfacing to user
20
+ - Enforce delegation rules and model tier selection
21
+ - Track context budget and trigger HUD/eco mode as needed
22
+
23
+ ## Constraints
24
+ - NEVER writes code, docs, or configs directly
25
+ - ALWAYS delegates to a specialized agent
26
+ - ALWAYS verifies before claiming completion
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: planner
3
+ description: >
4
+ Architecture designer and task sequencer.
5
+ Use when: decomposing complex requests, designing architecture, sequencing implementation steps, risk assessment.
6
+ model: claude-opus-4-6
7
+ tools: [readFile, editFiles, search]
8
+ agents: [explore, analyst, architect]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Planner
13
+
14
+ ## Role
15
+ Decompose complex requests into ordered, implementable tasks: design architecture, sequence steps, assess risks, produce implementation roadmaps.
16
+
17
+ ## Responsibilities
18
+ - Architecture design and task decomposition
19
+ - Risk identification and mitigation planning
20
+ - Clear implementation roadmaps for executors
21
+
22
+ ## NOT Responsible For
23
+ - Writing production code (→ executor)
24
+ - Verifying implementations (→ verifier)
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: qa-tester
3
+ description: >
4
+ Interactive CLI testing specialist with tmux session management.
5
+ Use when: "QA this", "manual test", "runtime validation", interactive CLI testing.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, runInTerminal, findTestFiles, testFailures]
8
+ agents: []
9
+ user-invocable: true
10
+ ---
11
+
12
+ # QA Tester
13
+
14
+ ## Role
15
+ Runtime and manual validation specialist using interactive CLI testing.
16
+
17
+ ## Responsibilities
18
+ - Interactive CLI and service testing
19
+ - Runtime validation and regression verification
20
+ - Test scenario execution with evidence collection
21
+
22
+ ## NOT Responsible For
23
+ - Writing test code (→ test-engineer)
24
+ - Architecture analysis (→ architect)
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: researcher
3
+ description: >
4
+ External knowledge researcher for SDK docs, library references, and technology comparisons.
5
+ Use when: looking up external docs, comparing libraries, researching APIs.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, search, fetch]
8
+ agents: []
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Researcher
13
+
14
+ ## Role
15
+ Find and synthesize external knowledge: SDK docs, library references, API docs, dependency information, technology comparisons.
16
+
17
+ ## Constraints
18
+ - READ-ONLY. Does not implement — finds and summarizes.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: reviewer
3
+ description: >
4
+ Code quality reviewer and style enforcer.
5
+ Use when: code review, style enforcement, catching bugs before merge.
6
+ model: claude-opus-4-6
7
+ tools: [readFile, search, codebase, usages, problems]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Reviewer
13
+
14
+ ## Role
15
+ Thorough code reviews: enforce style, catch bugs, identify quality issues, and gate merges.
16
+
17
+ ## Responsibilities
18
+ - Style enforcement and pattern consistency
19
+ - Bug identification with LSP precision
20
+ - Merge gate verdicts
21
+
22
+ ## NOT Responsible For
23
+ - Implementing fixes (→ executor)
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: scientist
3
+ description: >
4
+ Data analysis and research execution specialist.
5
+ Use when: "analyze this data", "find patterns", "statistical analysis", experimental design.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, editFiles, runInTerminal]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Scientist
13
+
14
+ ## Role
15
+ Data analysis and research execution through experimental design and hypothesis testing.
16
+
17
+ ## Responsibilities
18
+ - Experimental design and hypothesis testing
19
+ - Data analysis and pattern identification
20
+ - Statistical reasoning and evidence synthesis
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: security-reviewer
3
+ description: >
4
+ Security vulnerability detection specialist (OWASP Top 10, secrets, unsafe patterns).
5
+ Use when: "security review", "find vulnerabilities", "check for secrets", auth/crypto changes.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, search, codebase]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Security Reviewer
13
+
14
+ ## Role
15
+ Detect security vulnerabilities: OWASP Top 10, exposed secrets, unsafe code patterns, dependency audits.
16
+
17
+ ## Responsibilities
18
+ - OWASP Top 10 vulnerability scanning
19
+ - Secret and credential exposure detection
20
+ - Unsafe pattern identification and remediation guidance
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: simplifier
3
+ description: >
4
+ Code simplification and refactoring specialist.
5
+ Use when: simplifying code, improving clarity, removing dead code, reducing complexity.
6
+ model: claude-opus-4-6
7
+ tools: [readFile, editFiles, search]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Simplifier
13
+
14
+ ## Role
15
+ Simplify and refine code for clarity, consistency, and maintainability while preserving exact functionality.
16
+
17
+ ## Responsibilities
18
+ - Dead code removal and duplication elimination
19
+ - Complexity reduction without behavior change
20
+ - Naming, structure, and pattern consistency
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: test-engineer
3
+ description: >
4
+ Test strategy, integration/e2e coverage, and TDD workflows.
5
+ Use when: "add tests", "improve test coverage", "design testing strategy", TDD implementation.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, editFiles, runInTerminal, findTestFiles, testFailures]
8
+ agents: [explore, architect]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Test Engineer
13
+
14
+ ## Role
15
+ Test strategy, integration/e2e coverage analysis, flaky test hardening, and TDD workflows.
16
+
17
+ ## Responsibilities
18
+ - Test strategy design and coverage gap analysis
19
+ - Integration and e2e test implementation
20
+ - Flaky test diagnosis and hardening
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: tester
3
+ description: >
4
+ Test author and coverage analyzer.
5
+ Use when: writing unit tests, executing test suites, analyzing coverage, CI integration.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, editFiles, runInTerminal, findTestFiles, testFailures]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Tester
13
+
14
+ ## Role
15
+ Author tests, execute test suites, analyze coverage, and integrate tests into CI pipelines.
16
+
17
+ ## Responsibilities
18
+ - Unit and integration test authoring
19
+ - Coverage analysis and gap identification
20
+ - CI pipeline integration
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: tracer
3
+ description: >
4
+ Evidence-driven causal tracing with competing hypotheses and uncertainty tracking.
5
+ Use when: explaining unexpected behavior, tracing causation chains, competing hypothesis analysis.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, runInTerminal, search]
8
+ agents: [explore, architect]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Tracer
13
+
14
+ ## Role
15
+ Explain observed outcomes through disciplined, evidence-driven causal tracing.
16
+
17
+ ## Responsibilities
18
+ - Competing hypothesis generation and ranking
19
+ - Evidence collection for and against each hypothesis
20
+ - Next-probe recommendations to collapse uncertainty fastest
21
+
22
+ ## Constraints
23
+ - Never defaults to implementation
24
+ - Never bluffs certainty where evidence is incomplete
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: verifier
3
+ description: >
4
+ Verification and evidence collection specialist.
5
+ Use when: confirming task completion, running tests, collecting diagnostics, validating command outputs.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, runInTerminal, search, findTestFiles, testFailures]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Verifier
13
+
14
+ ## Role
15
+ Run tests, collect diagnostics, validate command outputs, and produce evidence that a task is truly complete.
16
+
17
+ ## Constraints
18
+ - NEVER implements — only confirms or denies
19
+ - Last line of defense before marking any task done
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: writer
3
+ description: >
4
+ Technical documentation author.
5
+ Use when: writing README, API docs, changelogs, code comments, guides.
6
+ model: claude-sonnet-4-6
7
+ tools: [readFile, editFiles, search]
8
+ agents: [explore]
9
+ user-invocable: true
10
+ ---
11
+
12
+ # Writer
13
+
14
+ ## Role
15
+ Produce clear, accurate technical documentation: README files, API docs, guides, code comments, and changelogs.
16
+
17
+ ## Responsibilities
18
+ - README and getting started guides
19
+ - API documentation and code comments
20
+ - Changelog and release notes
21
+
22
+ ## Constraints
23
+ - Matches existing documentation style
24
+ - Never documents code that does not exist
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/hud/statusline.mts
4
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
5
+ import { homedir } from "os";
6
+ import { dirname, join } from "path";
7
+ import { fileURLToPath } from "url";
8
+
9
+ // src/hud/renderer.mts
10
+ function formatAge(startedAt) {
11
+ const elapsed = Date.now() - startedAt;
12
+ const mins = Math.floor(elapsed / 6e4);
13
+ if (mins < 60) return `${mins}m`;
14
+ const hours = Math.floor(mins / 60);
15
+ const remainingMins = mins % 60;
16
+ return `${hours}h${remainingMins}m`;
17
+ }
18
+ function formatTokens(tokens) {
19
+ if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1)}M`;
20
+ if (tokens >= 1e3) return `${(tokens / 1e3).toFixed(1)}k`;
21
+ return `${tokens}`;
22
+ }
23
+ function renderPlain(state) {
24
+ const age = formatAge(state.startedAt);
25
+ const tokens = formatTokens(state.tokensUsed);
26
+ const ctx = state.contextPct;
27
+ const mode = state.activeMode || "-";
28
+ const model = state.activeModel || "sonnet";
29
+ const reqWarningPlain = state.warningActive ? " !!" : "";
30
+ const reqStrPlain = `req:${state.premiumRequests ?? 0}/${state.premiumRequestsTotal ?? 1500}${reqWarningPlain}`;
31
+ return `[OMP v${state.version}] ${mode} | ${model} | ctx:${ctx}% | tok:~${tokens}/${state.tokensTotal} | ${reqStrPlain} | ${age} | tools:${state.toolsUsed?.size || 0}/${state.toolsTotal ?? 13} | skills:${state.skillsUsed?.size || 0}/${state.skillsTotal ?? 25} | agents:${state.cumulativeAgentsUsed}/${state.agentsTotal ?? 23} | ${state.status}`;
32
+ }
33
+
34
+ // src/hud/statusline.mts
35
+ var DEFAULT_VERSION = "0.0.0";
36
+ var DEFAULT_STATUSLINE = "OMP | hud: no active session";
37
+ var DEFAULT_TOKEN_BUDGET = 2e5;
38
+ var DEFAULT_PREMIUM_REQUESTS_TOTAL = 1500;
39
+ function getStatuslinePaths(home = process.env["HOME"] || homedir()) {
40
+ const ompDir = join(home, ".omp");
41
+ const hudDir = join(ompDir, "hud");
42
+ return {
43
+ legacyLinePath: join(ompDir, "hud.line"),
44
+ hudDir,
45
+ statusJsonPath: join(hudDir, "status.json"),
46
+ displayPath: join(hudDir, "display.txt"),
47
+ tmuxSegmentPath: join(hudDir, "tmux-segment.sh")
48
+ };
49
+ }
50
+ function ensureParent(filePath) {
51
+ mkdirSync(dirname(filePath), { recursive: true });
52
+ }
53
+ function writeAtomic(filePath, content, mode) {
54
+ ensureParent(filePath);
55
+ const tempPath = `${filePath}.tmp`;
56
+ writeFileSync(tempPath, content, mode === void 0 ? "utf-8" : { encoding: "utf-8", mode });
57
+ renameSync(tempPath, filePath);
58
+ }
59
+ function normalizeStringArray(value) {
60
+ if (!Array.isArray(value)) return [];
61
+ return value.filter((item) => typeof item === "string");
62
+ }
63
+ function serializeHudState(state) {
64
+ return {
65
+ ...state,
66
+ toolsUsed: Array.from(state.toolsUsed),
67
+ skillsUsed: Array.from(state.skillsUsed)
68
+ };
69
+ }
70
+ function deserializeHudState(raw) {
71
+ if (!raw || typeof raw !== "object") return null;
72
+ const value = raw;
73
+ const toolsUsed = new Set(normalizeStringArray(value.toolsUsed));
74
+ const skillsUsed = new Set(normalizeStringArray(value.skillsUsed));
75
+ const agentsActive = normalizeStringArray(value.agentsActive);
76
+ const status = typeof value.status === "string" ? value.status : "idle";
77
+ return {
78
+ sessionId: typeof value.sessionId === "string" ? value.sessionId : "default",
79
+ activeMode: typeof value.activeMode === "string" ? value.activeMode : null,
80
+ activeModel: typeof value.activeModel === "string" ? value.activeModel : "sonnet",
81
+ contextPct: typeof value.contextPct === "number" ? value.contextPct : 0,
82
+ tokensUsed: typeof value.tokensUsed === "number" ? value.tokensUsed : 0,
83
+ tokensTotal: typeof value.tokensTotal === "number" ? value.tokensTotal : DEFAULT_TOKEN_BUDGET,
84
+ agentsActive,
85
+ lastAgent: typeof value.lastAgent === "string" ? value.lastAgent : agentsActive.at(-1) ?? "-",
86
+ lastOutput: typeof value.lastOutput === "string" ? value.lastOutput : "",
87
+ taskProgress: typeof value.taskProgress === "number" ? value.taskProgress : 0,
88
+ startedAt: typeof value.startedAt === "number" ? value.startedAt : Date.now(),
89
+ updatedAt: typeof value.updatedAt === "number" ? value.updatedAt : Date.now(),
90
+ version: typeof value.version === "string" ? value.version : DEFAULT_VERSION,
91
+ status,
92
+ sessionDurationMs: typeof value.sessionDurationMs === "number" ? value.sessionDurationMs : 0,
93
+ cumulativeAgentsUsed: typeof value.cumulativeAgentsUsed === "number" ? value.cumulativeAgentsUsed : agentsActive.length,
94
+ toolsUsed,
95
+ skillsUsed,
96
+ toolsTotal: typeof value.toolsTotal === "number" ? value.toolsTotal : 13,
97
+ skillsTotal: typeof value.skillsTotal === "number" ? value.skillsTotal : 25,
98
+ agentsTotal: typeof value.agentsTotal === "number" ? value.agentsTotal : 23,
99
+ premiumRequests: typeof value.premiumRequests === "number" ? value.premiumRequests : 0,
100
+ premiumRequestsTotal: typeof value.premiumRequestsTotal === "number" ? value.premiumRequestsTotal : DEFAULT_PREMIUM_REQUESTS_TOTAL,
101
+ warningActive: typeof value.warningActive === "boolean" ? value.warningActive : false
102
+ };
103
+ }
104
+ function buildHudState(snapshot, now = Date.now()) {
105
+ const startedAt = snapshot.started_at ?? now;
106
+ const updatedAt = snapshot.updated_at ?? now;
107
+ const toolsUsed = new Set(normalizeStringArray(snapshot.tools_used));
108
+ const skillsUsed = new Set(normalizeStringArray(snapshot.skills_used));
109
+ const agentsActive = normalizeStringArray(snapshot.agents_used);
110
+ return {
111
+ sessionId: snapshot.session_id ?? "default",
112
+ activeMode: snapshot.active_mode ?? null,
113
+ activeModel: snapshot.model ?? "sonnet",
114
+ contextPct: snapshot.context_pct ?? 0,
115
+ tokensUsed: snapshot.tokens_estimated ?? 0,
116
+ tokensTotal: snapshot.token_budget ?? DEFAULT_TOKEN_BUDGET,
117
+ agentsActive,
118
+ lastAgent: agentsActive.at(-1) ?? "-",
119
+ lastOutput: snapshot.last_output ?? "",
120
+ taskProgress: snapshot.task_progress ?? 0,
121
+ startedAt,
122
+ updatedAt,
123
+ version: snapshot.version ?? DEFAULT_VERSION,
124
+ status: snapshot.status ?? "idle",
125
+ sessionDurationMs: Math.max(0, updatedAt - startedAt),
126
+ cumulativeAgentsUsed: agentsActive.length,
127
+ toolsUsed,
128
+ skillsUsed,
129
+ toolsTotal: 13,
130
+ skillsTotal: 25,
131
+ agentsTotal: 23,
132
+ premiumRequests: snapshot.premium_requests ?? 0,
133
+ premiumRequestsTotal: snapshot.premium_requests_total ?? DEFAULT_PREMIUM_REQUESTS_TOTAL,
134
+ warningActive: snapshot.warning_active ?? false
135
+ };
136
+ }
137
+ function writeHudArtifacts(snapshot, paths = getStatuslinePaths()) {
138
+ const state = buildHudState(snapshot);
139
+ const line = renderPlain(state);
140
+ const serializedState = `${JSON.stringify(serializeHudState(state), null, 2)}
141
+ `;
142
+ writeAtomic(paths.statusJsonPath, serializedState);
143
+ writeAtomic(paths.displayPath, `${line}
144
+ `);
145
+ writeAtomic(paths.tmuxSegmentPath, `${line}
146
+ `, 493);
147
+ writeAtomic(paths.legacyLinePath, `${line}
148
+ `);
149
+ return { line, state, paths };
150
+ }
151
+ function readStatusline(paths = getStatuslinePaths()) {
152
+ try {
153
+ const line = readFileSync(paths.displayPath, "utf-8").trim();
154
+ if (line) return line;
155
+ } catch {
156
+ }
157
+ try {
158
+ const parsed = JSON.parse(readFileSync(paths.statusJsonPath, "utf-8"));
159
+ const state = deserializeHudState(parsed);
160
+ if (state) return renderPlain(state);
161
+ } catch {
162
+ }
163
+ try {
164
+ const line = readFileSync(paths.legacyLinePath, "utf-8").trim();
165
+ if (line) return line;
166
+ } catch {
167
+ }
168
+ return DEFAULT_STATUSLINE;
169
+ }
170
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
171
+ console.log(readStatusline());
172
+ }
173
+ export {
174
+ buildHudState,
175
+ getStatuslinePaths,
176
+ readStatusline,
177
+ writeHudArtifacts
178
+ };
179
+ //# sourceMappingURL=omp-statusline.mjs.map