@snoglobe/helios 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/acp/entry.d.ts +7 -0
- package/dist/acp/entry.d.ts.map +1 -0
- package/dist/acp/entry.js +46 -0
- package/dist/acp/entry.js.map +1 -0
- package/dist/acp/server.d.ts +57 -0
- package/dist/acp/server.d.ts.map +1 -0
- package/dist/acp/server.js +434 -0
- package/dist/acp/server.js.map +1 -0
- package/dist/acp/transport.d.ts +31 -0
- package/dist/acp/transport.d.ts.map +1 -0
- package/dist/acp/transport.js +116 -0
- package/dist/acp/transport.js.map +1 -0
- package/dist/acp/types.d.ts +213 -0
- package/dist/acp/types.d.ts.map +1 -0
- package/dist/acp/types.js +3 -0
- package/dist/acp/types.js.map +1 -0
- package/dist/app.d.ts +8 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +51 -281
- package/dist/app.js.map +1 -1
- package/dist/bootstrap.d.ts +3 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +26 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/cli/auth.d.ts +20 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +62 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/doctor.d.ts +9 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +368 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +16 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/export.d.ts +11 -0
- package/dist/cli/export.d.ts.map +1 -0
- package/dist/cli/export.js +103 -0
- package/dist/cli/export.js.map +1 -0
- package/dist/cli/index.d.ts +22 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +71 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-cmd.d.ts +11 -0
- package/dist/cli/init-cmd.d.ts.map +1 -0
- package/dist/cli/init-cmd.js +37 -0
- package/dist/cli/init-cmd.js.map +1 -0
- package/dist/cli/kill.d.ts +8 -0
- package/dist/cli/kill.d.ts.map +1 -0
- package/dist/cli/kill.js +46 -0
- package/dist/cli/kill.js.map +1 -0
- package/dist/cli/options.d.ts +18 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +24 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/replay.d.ts +9 -0
- package/dist/cli/replay.d.ts.map +1 -0
- package/dist/cli/replay.js +65 -0
- package/dist/cli/replay.js.map +1 -0
- package/dist/cli/report.d.ts +11 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +70 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +120 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/search.d.ts +9 -0
- package/dist/cli/search.d.ts.map +1 -0
- package/dist/cli/search.js +52 -0
- package/dist/cli/search.js.map +1 -0
- package/dist/cli/sessions.d.ts +8 -0
- package/dist/cli/sessions.d.ts.map +1 -0
- package/dist/cli/sessions.js +38 -0
- package/dist/cli/sessions.js.map +1 -0
- package/dist/cli/watch.d.ts +8 -0
- package/dist/cli/watch.d.ts.map +1 -0
- package/dist/cli/watch.js +81 -0
- package/dist/cli/watch.js.map +1 -0
- package/dist/config/project.d.ts +63 -0
- package/dist/config/project.d.ts.map +1 -0
- package/dist/config/project.js +112 -0
- package/dist/config/project.js.map +1 -0
- package/dist/core/orchestrator.d.ts +4 -2
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js +8 -3
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/task-poller.d.ts +43 -0
- package/dist/core/task-poller.d.ts.map +1 -0
- package/dist/core/task-poller.js +98 -0
- package/dist/core/task-poller.js.map +1 -0
- package/dist/experiments/branching.d.ts +38 -0
- package/dist/experiments/branching.d.ts.map +1 -0
- package/dist/experiments/branching.js +80 -0
- package/dist/experiments/branching.js.map +1 -0
- package/dist/hub/client.d.ts +70 -0
- package/dist/hub/client.d.ts.map +1 -0
- package/dist/hub/client.js +140 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/hub/config.d.ts +9 -0
- package/dist/hub/config.d.ts.map +1 -0
- package/dist/hub/config.js +38 -0
- package/dist/hub/config.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +44 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +387 -0
- package/dist/init.js.map +1 -0
- package/dist/memory/context-gate.d.ts.map +1 -1
- package/dist/memory/context-gate.js +1 -1
- package/dist/memory/context-gate.js.map +1 -1
- package/dist/memory/experiment-tracker.d.ts.map +1 -1
- package/dist/memory/experiment-tracker.js +2 -6
- package/dist/memory/experiment-tracker.js.map +1 -1
- package/dist/memory/memory-store.d.ts.map +1 -1
- package/dist/memory/memory-store.js +16 -20
- package/dist/memory/memory-store.js.map +1 -1
- package/dist/metrics/collector.d.ts.map +1 -1
- package/dist/metrics/collector.js +7 -7
- package/dist/metrics/collector.js.map +1 -1
- package/dist/metrics/resources.d.ts +44 -0
- package/dist/metrics/resources.d.ts.map +1 -0
- package/dist/metrics/resources.js +382 -0
- package/dist/metrics/resources.js.map +1 -0
- package/dist/metrics/store.d.ts +10 -2
- package/dist/metrics/store.d.ts.map +1 -1
- package/dist/metrics/store.js +91 -27
- package/dist/metrics/store.js.map +1 -1
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notifier.d.ts +36 -0
- package/dist/notifications/notifier.d.ts.map +1 -0
- package/dist/notifications/notifier.js +102 -0
- package/dist/notifications/notifier.js.map +1 -0
- package/dist/paths.d.ts +3 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +5 -0
- package/dist/paths.js.map +1 -0
- package/dist/providers/claude/provider.d.ts +7 -3
- package/dist/providers/claude/provider.d.ts.map +1 -1
- package/dist/providers/claude/provider.js +48 -8
- package/dist/providers/claude/provider.js.map +1 -1
- package/dist/providers/openai/callback-server.d.ts +5 -1
- package/dist/providers/openai/callback-server.d.ts.map +1 -1
- package/dist/providers/openai/callback-server.js +42 -20
- package/dist/providers/openai/callback-server.js.map +1 -1
- package/dist/providers/openai/oauth.d.ts +4 -0
- package/dist/providers/openai/oauth.d.ts.map +1 -1
- package/dist/providers/openai/oauth.js +35 -14
- package/dist/providers/openai/oauth.js.map +1 -1
- package/dist/providers/openai/provider.d.ts +6 -3
- package/dist/providers/openai/provider.d.ts.map +1 -1
- package/dist/providers/openai/provider.js +35 -9
- package/dist/providers/openai/provider.js.map +1 -1
- package/dist/providers/types.d.ts +9 -1
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js.map +1 -1
- package/dist/remote/config.d.ts.map +1 -1
- package/dist/remote/config.js +4 -8
- package/dist/remote/config.js.map +1 -1
- package/dist/remote/connection-pool.d.ts.map +1 -1
- package/dist/remote/connection-pool.js +9 -5
- package/dist/remote/connection-pool.js.map +1 -1
- package/dist/store/database.d.ts.map +1 -1
- package/dist/store/database.js +2 -2
- package/dist/store/database.js.map +1 -1
- package/dist/store/migrations.d.ts.map +1 -1
- package/dist/store/migrations.js +27 -0
- package/dist/store/migrations.js.map +1 -1
- package/dist/store/preferences.d.ts +2 -0
- package/dist/store/preferences.d.ts.map +1 -1
- package/dist/store/preferences.js +2 -2
- package/dist/store/preferences.js.map +1 -1
- package/dist/store/session-store.d.ts +6 -0
- package/dist/store/session-store.d.ts.map +1 -1
- package/dist/store/session-store.js +20 -5
- package/dist/store/session-store.js.map +1 -1
- package/dist/tools/env-snapshot.d.ts +5 -0
- package/dist/tools/env-snapshot.d.ts.map +1 -0
- package/dist/tools/env-snapshot.js +174 -0
- package/dist/tools/env-snapshot.js.map +1 -0
- package/dist/tools/experiment-branch.d.ts +7 -0
- package/dist/tools/experiment-branch.d.ts.map +1 -0
- package/dist/tools/experiment-branch.js +167 -0
- package/dist/tools/experiment-branch.js.map +1 -0
- package/dist/tools/file-ops.d.ts.map +1 -1
- package/dist/tools/file-ops.js +1 -3
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/tools/hub.d.ts +5 -0
- package/dist/tools/hub.d.ts.map +1 -0
- package/dist/tools/hub.js +298 -0
- package/dist/tools/hub.js.map +1 -0
- package/dist/tools/sweep.d.ts +6 -0
- package/dist/tools/sweep.d.ts.map +1 -0
- package/dist/tools/sweep.js +153 -0
- package/dist/tools/sweep.js.map +1 -0
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +2 -1
- package/dist/tools/web-fetch.js.map +1 -1
- package/dist/tools/writeup.d.ts +11 -0
- package/dist/tools/writeup.d.ts.map +1 -0
- package/dist/tools/writeup.js +102 -0
- package/dist/tools/writeup.js.map +1 -0
- package/dist/ui/commands.d.ts +36 -0
- package/dist/ui/commands.d.ts.map +1 -1
- package/dist/ui/commands.js +501 -1
- package/dist/ui/commands.js.map +1 -1
- package/dist/ui/components/input-bar.js.map +1 -1
- package/dist/ui/components/overlay-header.d.ts.map +1 -1
- package/dist/ui/components/overlay-header.js.map +1 -1
- package/dist/ui/components/status-bar.js +1 -1
- package/dist/ui/components/status-bar.js.map +1 -1
- package/dist/ui/format.d.ts +4 -0
- package/dist/ui/format.d.ts.map +1 -1
- package/dist/ui/format.js +16 -0
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/layout.d.ts +7 -42
- package/dist/ui/layout.d.ts.map +1 -1
- package/dist/ui/layout.js +71 -543
- package/dist/ui/layout.js.map +1 -1
- package/dist/ui/overlays/metrics-overlay.js.map +1 -1
- package/dist/ui/overlays/task-overlay.d.ts +1 -1
- package/dist/ui/overlays/task-overlay.d.ts.map +1 -1
- package/dist/ui/overlays/task-overlay.js.map +1 -1
- package/dist/ui/panels/conversation.d.ts +1 -1
- package/dist/ui/panels/conversation.d.ts.map +1 -1
- package/dist/ui/panels/conversation.js +1 -2
- package/dist/ui/panels/conversation.js.map +1 -1
- package/dist/ui/panels/metrics-dashboard.d.ts.map +1 -1
- package/dist/ui/panels/metrics-dashboard.js.map +1 -1
- package/dist/ui/panels/sleep-panel.js.map +1 -1
- package/dist/ui/panels/sticky-notes.d.ts.map +1 -1
- package/dist/ui/panels/sticky-notes.js.map +1 -1
- package/dist/ui/panels/task-list.d.ts +4 -2
- package/dist/ui/panels/task-list.d.ts.map +1 -1
- package/dist/ui/panels/task-list.js +41 -9
- package/dist/ui/panels/task-list.js.map +1 -1
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js.map +1 -1
- package/dist/ui/types.d.ts +22 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +2 -0
- package/dist/ui/types.js.map +1 -0
- package/package.json +19 -6
package/dist/app.js
CHANGED
|
@@ -1,289 +1,59 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef } from "react";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
4
|
import { Layout } from "./ui/layout.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { MetricCollector } from "./metrics/collector.js";
|
|
17
|
-
import { createRemoteExecTool, createRemoteExecBackgroundTool, } from "./tools/remote-exec.js";
|
|
18
|
-
import { createUploadTool, createDownloadTool, } from "./tools/remote-sync.js";
|
|
19
|
-
import { createSleepTool } from "./tools/sleep.js";
|
|
20
|
-
import { createListMachinesTool } from "./tools/list-machines.js";
|
|
21
|
-
import { createTaskOutputTool } from "./tools/task-output.js";
|
|
22
|
-
import { createCompareRunsTool } from "./tools/compare-runs.js";
|
|
23
|
-
import { createShowMetricsTool } from "./tools/show-metrics.js";
|
|
24
|
-
import { createClearMetricsTool } from "./tools/clear-metrics.js";
|
|
25
|
-
import { createKillTaskTool } from "./tools/kill-task.js";
|
|
26
|
-
import { createReadFileTool, createWriteFileTool, createPatchFileTool } from "./tools/file-ops.js";
|
|
27
|
-
import { createWebFetchTool } from "./tools/web-fetch.js";
|
|
28
|
-
import { createStartMonitorTool, createStopMonitorTool } from "./tools/monitor.js";
|
|
29
|
-
import { createConsultTool } from "./tools/consult.js";
|
|
30
|
-
import { MonitorManager } from "./core/monitor.js";
|
|
31
|
-
import { loadMachines } from "./remote/config.js";
|
|
32
|
-
import { loadPreferences } from "./store/preferences.js";
|
|
33
|
-
import { MemoryStore } from "./memory/memory-store.js";
|
|
34
|
-
import { ContextGate } from "./memory/context-gate.js";
|
|
35
|
-
import { ExperimentTracker } from "./memory/experiment-tracker.js";
|
|
36
|
-
import { createMemoryTools } from "./tools/memory-tools.js";
|
|
37
|
-
import { StickyManager } from "./core/stickies.js";
|
|
38
|
-
const SYSTEM_PROMPT = `You are Helios, an autonomous ML research agent. You help researchers design, run, and monitor machine learning experiments on local and remote machines.
|
|
39
|
-
|
|
40
|
-
## Machines
|
|
41
|
-
- "local" is always available — it runs commands on the user's machine directly (no SSH).
|
|
42
|
-
- Remote machines are added by the user via /machine add. Use list_machines to see what's available.
|
|
43
|
-
- Prefer remote machines for heavy compute (training, GPU workloads). Use "local" for lightweight tasks or when no remote machines are configured.
|
|
44
|
-
|
|
45
|
-
## Capabilities
|
|
46
|
-
- Execute quick commands locally or remotely (remote_exec) — ONLY for short commands like ls, cat, pip install, git clone
|
|
47
|
-
- Launch and monitor training runs (remote_exec_background) — ALL training, evaluation, and long-running processes
|
|
48
|
-
- Track metrics like loss, accuracy, rewards (show_metrics)
|
|
49
|
-
- Transfer files between local and remote machines (remote_upload, remote_download)
|
|
50
|
-
- Read, write, and edit files on any machine (read_file, write_file, patch_file)
|
|
51
|
-
- Fetch web pages, documentation, and papers (web_fetch)
|
|
52
|
-
- Clear metrics from discarded runs (clear_metrics)
|
|
53
|
-
- Sleep and set triggers to wake on conditions (sleep)
|
|
54
|
-
- List configured machines (list_machines)
|
|
55
|
-
- Consult the other AI provider for a second opinion (consult)
|
|
56
|
-
|
|
57
|
-
## MANDATORY: Use remote_exec_background for ALL Runs
|
|
58
|
-
**EVERY training run, evaluation, benchmark, or process that takes more than a few seconds MUST use remote_exec_background.** Never use remote_exec for these — it blocks, produces no dashboard output, and breaks the entire monitoring pipeline.
|
|
59
|
-
|
|
60
|
-
remote_exec_background:
|
|
61
|
-
- Returns a pid and log_path
|
|
62
|
-
- Automatically appears in the TASKS panel
|
|
63
|
-
- Stdout/stderr is captured — Helios parses it for live metrics in the dashboard
|
|
64
|
-
- **DO NOT redirect stdout in your command** (no > file, no tee, no logging to file). Redirecting stdout breaks metric collection.
|
|
65
|
-
- To check output, use task_output — do NOT manually tail or cat the log file.
|
|
66
|
-
|
|
67
|
-
remote_exec is ONLY for quick one-shot commands (installing packages, checking files, git operations).
|
|
68
|
-
|
|
69
|
-
## Metric Tracking
|
|
70
|
-
When calling remote_exec_background, pass **metric_names** or **metric_patterns** to enable live dashboard charts:
|
|
71
|
-
|
|
72
|
-
- **metric_names**: List of names to parse in key=value or key: value format from stdout.
|
|
73
|
-
Example: metric_names=["loss", "acc", "lr"] matches "loss=0.234 acc=0.95 lr=1e-4"
|
|
74
|
-
- **metric_patterns**: Map of name → regex with one capture group for the numeric value.
|
|
75
|
-
Example: metric_patterns={"loss": "Loss:\\\\s*([\\\\d.e+-]+)"} matches "Loss: 0.234"
|
|
76
|
-
|
|
77
|
-
If neither is provided, no metrics will be tracked. ALWAYS specify metrics when launching a training run.
|
|
78
|
-
|
|
79
|
-
Training scripts MUST print metrics to stdout (one line per step/epoch). Do not redirect stdout.
|
|
80
|
-
|
|
81
|
-
Use **clear_metrics** to wipe stale data when discarding a failed run before starting a new one.
|
|
82
|
-
|
|
83
|
-
## Viewing Task Output
|
|
84
|
-
Use task_output to check on running tasks:
|
|
85
|
-
- task_output(machine_id, pid) — shows recent stdout/stderr
|
|
86
|
-
- task_output(machine_id, pid, lines=100) — show more lines
|
|
87
|
-
This is the preferred way to check task progress. Do not use remote_exec to manually tail logs.
|
|
88
|
-
|
|
89
|
-
## Monitoring Loop — PREFERRED APPROACH
|
|
90
|
-
After launching a background task, use **start_monitor** to set up periodic check-ins:
|
|
91
|
-
- start_monitor(goal="Train TinyStories to loss < 5.0", interval_minutes=2)
|
|
92
|
-
- The system will re-invoke you every N minutes with a status update containing:
|
|
93
|
-
- Elapsed time, current interval, task statuses, latest metric values, your goal
|
|
94
|
-
- On each check-in, review progress, take actions if needed (check output, adjust, launch new runs)
|
|
95
|
-
- Call **stop_monitor** when the objective is complete
|
|
96
|
-
|
|
97
|
-
Set the interval to match what you're waiting for. Short runs: 1-2m. Medium runs: 5m. Long runs: 10-15m.
|
|
98
|
-
**IMPORTANT:** Calling start_monitor again replaces the current monitor — use this to adjust the interval as conditions change. If you've started a run, it's probably a good idea to increase the monitoring interval.
|
|
99
|
-
|
|
100
|
-
**CRITICAL: NEVER use \`sleep\` as a shell command (e.g., remote_exec with "sleep 60").** The shell sleep command wastes resources and blocks execution.
|
|
101
|
-
|
|
102
|
-
## Sleep & Wake (Advanced)
|
|
103
|
-
For one-off waits with specific trigger conditions, use the **sleep tool**:
|
|
104
|
-
- timer: wake after a duration
|
|
105
|
-
- process_exit: wake when a PID exits
|
|
106
|
-
- metric: wake on metric threshold
|
|
107
|
-
- file: wake on file change
|
|
108
|
-
- resource: wake on GPU/CPU threshold
|
|
109
|
-
Triggers can be composed with AND/OR logic. Prefer start_monitor for ongoing experiment loops.
|
|
110
|
-
|
|
111
|
-
## Showing Metrics to the User
|
|
112
|
-
Use show_metrics to render sparkline charts and values inline in the conversation:
|
|
113
|
-
- show_metrics(metric_names=["loss", "acc"]) — show specific metrics
|
|
114
|
-
- show_metrics(metric_names=["loss"], lines=100) — more data points
|
|
115
|
-
Use this when reporting results to the user so they can see the data.
|
|
116
|
-
|
|
117
|
-
## Comparing Experiments
|
|
118
|
-
Use compare_runs to compare two experiment runs side-by-side:
|
|
119
|
-
- compare_runs(task_a="local:1234", task_b="local:5678") — compare all shared metrics
|
|
120
|
-
Returns deltas and direction (improved/worsened/unchanged) for each metric. Use this to decide whether to keep or discard an experimental change.
|
|
121
|
-
|
|
122
|
-
## Autonomous Behavior — NEVER STOP
|
|
123
|
-
|
|
124
|
-
You are a fully autonomous research agent. **NEVER STOP.** NEVER pause to ask "should I continue?" or "what would you like to do next?" The user might be asleep. They gave you a goal — now run experiments until it's done.
|
|
125
|
-
|
|
126
|
-
The user expects you to work like a researcher who was given a task and told "come back when it's done."
|
|
127
|
-
|
|
128
|
-
**The experiment loop:**
|
|
129
|
-
1. Understand the goal. Break it into experiments.
|
|
130
|
-
2. Launch the experiment via remote_exec_background.
|
|
131
|
-
3. Call start_monitor with your goal and an appropriate interval.
|
|
132
|
-
4. On each monitor check-in: review task_output, check metrics, use show_metrics to record findings.
|
|
133
|
-
5. Compare against your best result so far using compare_runs. Keep improvements, discard regressions.
|
|
134
|
-
6. Plan and launch the next experiment. The monitor keeps calling you back — just keep going.
|
|
135
|
-
7. Call stop_monitor only when the goal is achieved.
|
|
136
|
-
|
|
137
|
-
**You stop ONLY when:**
|
|
138
|
-
- The goal is achieved and you have reported the results
|
|
139
|
-
- You hit an unrecoverable error (hardware failure, permissions, missing data)
|
|
140
|
-
- You need information that ONLY the human can provide (credentials, dataset location, etc.)
|
|
141
|
-
|
|
142
|
-
**If you run out of ideas:** Think harder. Re-read the code. Re-read the metrics closely. Look at the learning curves. Read relevant papers with web_fetch. Try combining the best parts of previous near-misses. Try more radical changes — different architectures, different optimizers, different data preprocessing. Try ablations of what worked. Try the opposite of what failed. Try something you haven't tried. Ask yourself: "What would a senior ML researcher do here?" The loop runs until the human interrupts you.
|
|
143
|
-
|
|
144
|
-
**Keep/discard discipline:** After each experiment, explicitly compare metrics to your current best. If improved, keep and record it. If equal or worse, discard/revert. Always know what your current best result is and why.
|
|
145
|
-
|
|
146
|
-
## Memory System
|
|
147
|
-
You have a persistent virtual filesystem for storing knowledge across context checkpoints.
|
|
148
|
-
When the conversation gets too long, your context will be checkpointed: history is archived and you'll receive a briefing with your memory tree.
|
|
149
|
-
|
|
150
|
-
**Tools**: memory_ls, memory_read, memory_write, memory_rm
|
|
151
|
-
|
|
152
|
-
**CRITICAL: Proactively store important findings as you work.** Don't wait for a checkpoint — write to memory as you go:
|
|
153
|
-
- Store the goal at /goal
|
|
154
|
-
- Store your current best result at /best
|
|
155
|
-
- Store observations at /observations/<name>
|
|
156
|
-
- Store hypotheses at /hypotheses/<name>
|
|
157
|
-
- Store decisions at /decisions/<name>
|
|
158
|
-
- Experiments are auto-tracked at /experiments/ when you use remote_exec_background
|
|
159
|
-
|
|
160
|
-
After a checkpoint, you'll see a tree listing of all your stored knowledge. Use memory_read(path) to retrieve details, and memory_ls to explore.
|
|
161
|
-
|
|
162
|
-
**The gist is the key**: When listing nodes, you see path + gist. Make gists informative enough that you can decide whether to read the full content.
|
|
163
|
-
|
|
164
|
-
## Consulting the Other Provider
|
|
165
|
-
Use **consult** if you find yourself stuck. It sends a question to the other AI (Claude if you're OpenAI, OpenAI if you're Claude) and returns their response. Good for getting a second opinion on experiment design, debugging, or when you've exhausted your own ideas.
|
|
166
|
-
|
|
167
|
-
## Approach
|
|
168
|
-
- Think step-by-step about experiment design
|
|
169
|
-
- Monitor for common issues: loss divergence, NaN, OOM, dead GPUs
|
|
170
|
-
- Proactively suggest improvements based on observed metrics
|
|
171
|
-
- Be concise in responses but thorough in analysis
|
|
172
|
-
- Always check exit codes and stderr for errors when executing commands`;
|
|
173
|
-
export function App({ defaultProvider, claudeMode, mouseEmitter }) {
|
|
174
|
-
// CLI arg takes priority, then saved preference, then "claude"
|
|
175
|
-
const prefs = loadPreferences();
|
|
176
|
-
const initialProvider = defaultProvider ?? prefs.lastProvider ?? "claude";
|
|
177
|
-
const initialClaudeMode = claudeMode ?? prefs.claudeAuthMode;
|
|
178
|
-
const [orchestrator, setOrchestrator] = useState(null);
|
|
179
|
-
const [sleepManager, setSleepManager] = useState(null);
|
|
180
|
-
const [connectionPool, setConnectionPool] = useState(null);
|
|
181
|
-
const [executor, setExecutor] = useState(null);
|
|
182
|
-
const [metricCollector, setMetricCollector] = useState(null);
|
|
183
|
-
const [metricStore, setMetricStore] = useState(null);
|
|
184
|
-
const [monitorManager, setMonitorManager] = useState(null);
|
|
185
|
-
const [experimentTracker, setExperimentTracker] = useState(null);
|
|
186
|
-
const [memoryStoreState, setMemoryStoreState] = useState(null);
|
|
187
|
-
const [stickyManager, setStickyManager] = useState(null);
|
|
5
|
+
import { createRuntime } from "./init.js";
|
|
6
|
+
export function App({ defaultProvider, claudeMode, mouseEmitter, headless, initialPrompt, initialAttachments, resumeSessionId, continueSession, model, }) {
|
|
7
|
+
const [runtime, setRuntime] = useState(null);
|
|
8
|
+
const [error, setError] = useState(null);
|
|
9
|
+
// Stable refs for values used in the effect but that shouldn't trigger re-init
|
|
10
|
+
const modelRef = useRef(model);
|
|
11
|
+
modelRef.current = model;
|
|
12
|
+
const resumeRef = useRef(resumeSessionId);
|
|
13
|
+
resumeRef.current = resumeSessionId;
|
|
14
|
+
const continueRef = useRef(continueSession);
|
|
15
|
+
continueRef.current = continueSession;
|
|
188
16
|
useEffect(() => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
contextGate.setMetricStore(metricStore);
|
|
221
|
-
const expTracker = new ExperimentTracker(memoryStore);
|
|
222
|
-
// Stickies
|
|
223
|
-
const stickies = new StickyManager();
|
|
224
|
-
// Orchestrator
|
|
225
|
-
const orch = new Orchestrator({
|
|
226
|
-
defaultProvider: initialProvider,
|
|
227
|
-
systemPrompt: SYSTEM_PROMPT,
|
|
17
|
+
let aborted = false;
|
|
18
|
+
let cleanup;
|
|
19
|
+
createRuntime({ provider: defaultProvider, claudeMode }).then(async (rt) => {
|
|
20
|
+
if (aborted) {
|
|
21
|
+
rt.cleanup();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
cleanup = rt.cleanup;
|
|
25
|
+
// Apply model override before session start
|
|
26
|
+
if (modelRef.current) {
|
|
27
|
+
await rt.orchestrator.setModel(modelRef.current);
|
|
28
|
+
}
|
|
29
|
+
// Resume or continue session if requested
|
|
30
|
+
if (resumeRef.current) {
|
|
31
|
+
await rt.orchestrator.resumeSession(resumeRef.current).catch((err) => {
|
|
32
|
+
process.stderr.write(`Failed to resume session: ${err}\n`);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else if (continueRef.current) {
|
|
36
|
+
const sessions = rt.orchestrator.sessionStore.listSessions(1);
|
|
37
|
+
if (sessions.length > 0) {
|
|
38
|
+
await rt.orchestrator.resumeSession(sessions[0].id).catch((err) => {
|
|
39
|
+
process.stderr.write(`Failed to continue session: ${err}\n`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!aborted)
|
|
44
|
+
setRuntime(rt);
|
|
45
|
+
}).catch((err) => {
|
|
46
|
+
if (!aborted)
|
|
47
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
228
48
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
createRemoteExecTool(executor),
|
|
236
|
-
createRemoteExecBackgroundTool(executor, metricCollector),
|
|
237
|
-
createUploadTool(fileSync),
|
|
238
|
-
createDownloadTool(fileSync),
|
|
239
|
-
createListMachinesTool(connPool),
|
|
240
|
-
createTaskOutputTool(executor, connPool),
|
|
241
|
-
createShowMetricsTool(metricStore),
|
|
242
|
-
createCompareRunsTool(metricStore),
|
|
243
|
-
createClearMetricsTool(metricStore, metricCollector),
|
|
244
|
-
createKillTaskTool(executor, connPool, metricCollector),
|
|
245
|
-
createReadFileTool(connPool),
|
|
246
|
-
createWriteFileTool(connPool),
|
|
247
|
-
createPatchFileTool(connPool),
|
|
248
|
-
createWebFetchTool(),
|
|
249
|
-
...createMemoryTools(memoryStore),
|
|
250
|
-
createConsultTool(() => orch.currentProvider?.name ?? null, (name) => orch.getProvider(name)),
|
|
251
|
-
]);
|
|
252
|
-
// Scheduler
|
|
253
|
-
const triggerScheduler = new TriggerScheduler(connPool);
|
|
254
|
-
const sleepMgr = new SleepManager(triggerScheduler, orch);
|
|
255
|
-
sleepMgr.setExecutor(executor);
|
|
256
|
-
sleepMgr.setConnectionPool(connPool);
|
|
257
|
-
sleepMgr.setMetricStore(metricStore);
|
|
258
|
-
// Register sleep tool
|
|
259
|
-
orch.registerTool(createSleepTool(sleepMgr));
|
|
260
|
-
// Monitor
|
|
261
|
-
const monitorMgr = new MonitorManager();
|
|
262
|
-
orch.registerTools([
|
|
263
|
-
createStartMonitorTool(monitorMgr),
|
|
264
|
-
createStopMonitorTool(monitorMgr),
|
|
265
|
-
]);
|
|
266
|
-
// Eagerly activate the default provider so the status bar shows provider/model immediately
|
|
267
|
-
orch.switchProvider(initialProvider).catch(() => { });
|
|
268
|
-
setOrchestrator(orch);
|
|
269
|
-
setSleepManager(sleepMgr);
|
|
270
|
-
setConnectionPool(connPool);
|
|
271
|
-
setExecutor(executor);
|
|
272
|
-
setMetricCollector(metricCollector);
|
|
273
|
-
setMetricStore(metricStore);
|
|
274
|
-
setMonitorManager(monitorMgr);
|
|
275
|
-
setExperimentTracker(expTracker);
|
|
276
|
-
setMemoryStoreState(memoryStore);
|
|
277
|
-
setStickyManager(stickies);
|
|
278
|
-
return () => {
|
|
279
|
-
monitorMgr.stop();
|
|
280
|
-
triggerScheduler.stopAll();
|
|
281
|
-
connPool.disconnectAll();
|
|
282
|
-
};
|
|
283
|
-
}, [initialProvider]);
|
|
284
|
-
if (!orchestrator || !sleepManager || !connectionPool || !executor || !metricStore || !metricCollector || !monitorManager || !experimentTracker || !memoryStoreState || !stickyManager) {
|
|
49
|
+
return () => { aborted = true; cleanup?.(); };
|
|
50
|
+
}, [defaultProvider, claudeMode]);
|
|
51
|
+
if (error) {
|
|
52
|
+
return (_jsx(Box, { padding: 1, children: _jsxs(Text, { color: "red", children: ["Failed to start Helios: ", error] }) }));
|
|
53
|
+
}
|
|
54
|
+
if (!runtime) {
|
|
285
55
|
return (_jsx(Box, { padding: 1, children: _jsx(Text, { color: "yellow", children: "Starting Helios..." }) }));
|
|
286
56
|
}
|
|
287
|
-
return (_jsx(Layout, {
|
|
57
|
+
return (_jsx(Layout, { runtime: runtime, mouseEmitter: mouseEmitter, headless: headless, initialPrompt: initialPrompt, initialAttachments: initialAttachments }));
|
|
288
58
|
}
|
|
289
59
|
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,MA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O,EAAE,CAAC,YACb,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,yCAA0B,KAAK,IAAQ,GACpD,CACP,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CACL,KAAC,GAAG,IAAC,OAAO,EAAE,CAAC,YACb,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,mCAA0B,GAC1C,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,MAAM,IACL,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Bootstrap: set env vars from CLI flags BEFORE any module imports.
|
|
3
|
+
// paths.ts, hub/config.ts, etc. read env vars at module load time,
|
|
4
|
+
// so these must be set before the main entry point imports them.
|
|
5
|
+
const argv = process.argv;
|
|
6
|
+
const envFlags = [
|
|
7
|
+
["--home", "HELIOS_HOME"],
|
|
8
|
+
["--hub-url", "AGENTHUB_URL"],
|
|
9
|
+
["--hub-key", "AGENTHUB_KEY"],
|
|
10
|
+
["--agent", "AGENTHUB_AGENT"],
|
|
11
|
+
];
|
|
12
|
+
for (const [flag, envVar] of envFlags) {
|
|
13
|
+
const i = argv.indexOf(flag);
|
|
14
|
+
if (i >= 0 && argv[i + 1] && !argv[i + 1].startsWith("-")) {
|
|
15
|
+
process.env[envVar] = argv[i + 1];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// ACP mode: JSON-RPC over stdio, no TUI — separate entry point
|
|
19
|
+
if (argv.includes("--acp")) {
|
|
20
|
+
await import("./acp/entry.js");
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
await import("./cli/index.js");
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";AAEA,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AAEjE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAC1B,MAAM,QAAQ,GAAuB;IACnC,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,WAAW,EAAE,cAAc,CAAC;IAC7B,CAAC,WAAW,EAAE,cAAc,CAAC;IAC7B,CAAC,SAAS,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3B,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACjC,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `helios auth` subcommands — login, logout, status.
|
|
3
|
+
*/
|
|
4
|
+
import { Option } from "effect";
|
|
5
|
+
import { Command } from "@effect/cli";
|
|
6
|
+
export declare const login: Command.Command<"login", never, never, {
|
|
7
|
+
readonly provider: Option.Option<"claude" | "openai">;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const logout: Command.Command<"logout", never, never, {
|
|
10
|
+
readonly provider: Option.Option<"claude" | "openai">;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const status: Command.Command<"status", never, never, {}>;
|
|
13
|
+
export declare const auth: Command.Command<"auth", never, never, {
|
|
14
|
+
readonly subcommand: Option.Option<{
|
|
15
|
+
readonly provider: Option.Option<"claude" | "openai">;
|
|
16
|
+
} | {
|
|
17
|
+
readonly provider: Option.Option<"claude" | "openai">;
|
|
18
|
+
} | {}>;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/cli/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAW,MAAM,aAAa,CAAC;AAU/C,eAAO,MAAM,KAAK;;EA6BjB,CAAC;AAUF,eAAO,MAAM,MAAM;;EAiBlB,CAAC;AAIF,eAAO,MAAM,MAAM,6CAmBlB,CAAC;AAIF,eAAO,MAAM,IAAI;;;;;;EAEhB,CAAC"}
|
package/dist/cli/auth.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `helios auth` subcommands — login, logout, status.
|
|
3
|
+
*/
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
|
+
import { Command, Options } from "@effect/cli";
|
|
6
|
+
// ── helios auth login ────────────────────────────────────
|
|
7
|
+
const loginProvider = Options.choice("provider", ["claude", "openai"]).pipe(Options.withAlias("P"), Options.withDescription("Provider to authenticate with"), Options.optional);
|
|
8
|
+
export const login = Command.make("login", { provider: loginProvider }, ({ provider }) => Effect.promise(async () => {
|
|
9
|
+
const providerName = Option.getOrElse(provider, () => "claude");
|
|
10
|
+
const { AuthManager } = await import("../providers/auth/auth-manager.js");
|
|
11
|
+
const { OpenAIOAuth } = await import("../providers/openai/oauth.js");
|
|
12
|
+
const { ClaudeProvider } = await import("../providers/claude/provider.js");
|
|
13
|
+
const { OpenAIProvider } = await import("../providers/openai/provider.js");
|
|
14
|
+
const authManager = new AuthManager();
|
|
15
|
+
if (providerName === "openai") {
|
|
16
|
+
const oauth = new OpenAIOAuth(authManager);
|
|
17
|
+
authManager.registerRefreshHandler("openai", (rt) => oauth.refresh(rt));
|
|
18
|
+
console.log("Starting OpenAI OAuth flow...");
|
|
19
|
+
await oauth.login();
|
|
20
|
+
console.log("OpenAI authentication successful.");
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const openaiOAuth = new OpenAIOAuth(authManager);
|
|
24
|
+
authManager.registerRefreshHandler("openai", (rt) => openaiOAuth.refresh(rt));
|
|
25
|
+
const claude = new ClaudeProvider(authManager);
|
|
26
|
+
console.log("Authenticating with Claude...");
|
|
27
|
+
await claude.authenticate();
|
|
28
|
+
console.log("Claude authentication successful.");
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
// ── helios auth logout ───────────────────────────────────
|
|
32
|
+
const logoutProvider = Options.choice("provider", ["claude", "openai"]).pipe(Options.withAlias("P"), Options.withDescription("Provider to log out from (omit to clear all)"), Options.optional);
|
|
33
|
+
export const logout = Command.make("logout", { provider: logoutProvider }, ({ provider }) => Effect.promise(async () => {
|
|
34
|
+
const { AuthManager } = await import("../providers/auth/auth-manager.js");
|
|
35
|
+
const authManager = new AuthManager();
|
|
36
|
+
if (Option.isSome(provider)) {
|
|
37
|
+
authManager.tokenStore.clear(provider.value);
|
|
38
|
+
console.log(`Logged out from ${provider.value}.`);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
authManager.tokenStore.clear("claude");
|
|
42
|
+
authManager.tokenStore.clear("openai");
|
|
43
|
+
console.log("Logged out from all providers.");
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
// ── helios auth status ───────────────────────────────────
|
|
47
|
+
export const status = Command.make("status", {}, () => Effect.promise(async () => {
|
|
48
|
+
const { AuthManager } = await import("../providers/auth/auth-manager.js");
|
|
49
|
+
const authManager = new AuthManager();
|
|
50
|
+
const result = {
|
|
51
|
+
claude: {
|
|
52
|
+
authenticated: authManager.isAuthenticated("claude"),
|
|
53
|
+
},
|
|
54
|
+
openai: {
|
|
55
|
+
authenticated: authManager.isAuthenticated("openai"),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
console.log(JSON.stringify(result, null, 2));
|
|
59
|
+
}));
|
|
60
|
+
// ── helios auth (parent command) ─────────────────────────
|
|
61
|
+
export const auth = Command.make("auth").pipe(Command.withSubcommands([login, logout, status]));
|
|
62
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/cli/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/C,4DAA4D;AAE5D,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CACzE,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,eAAe,CAAC,+BAA+B,CAAC,EACxD,OAAO,CAAC,QAAQ,CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAC/B,OAAO,EACP,EAAE,QAAQ,EAAE,aAAa,EAAE,EAC3B,CAAC,EAAE,QAAQ,EAAE,EAAE,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,CACH,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;IACxB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAEtC,MAAM,MAAM,GAAG;QACb,MAAM,EAAE;YACN,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC;SACrD;QACD,MAAM,EAAE;YACN,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC;SACrD;KACF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC,CACL,CAAC;AAEF,4DAA4D;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAC3C,OAAO,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CACjD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `helios doctor` — diagnose the full Helios setup.
|
|
3
|
+
*
|
|
4
|
+
* Checks auth, machines, storage, project config, and dependencies,
|
|
5
|
+
* printing a clear report with pass/fail/warn indicators.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "@effect/cli";
|
|
8
|
+
export declare const doctor: Command.Command<"doctor", never, never, {}>;
|
|
9
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA0XtC,eAAO,MAAM,MAAM,6CAelB,CAAC"}
|