harnery 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +84 -2
- package/bin/agent-coord +42 -0
- package/bin/agent-hook +44 -0
- package/bin/harn +40 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/commander.d.ts +128 -0
- package/dist/commander.d.ts.map +1 -0
- package/dist/commander.js +126 -0
- package/dist/commands/agents.d.ts +18 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +3946 -0
- package/dist/commands/backup.d.ts +22 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +262 -0
- package/dist/commands/browse-ai.d.ts +4 -0
- package/dist/commands/browse-ai.d.ts.map +1 -0
- package/dist/commands/browse-ai.js +156 -0
- package/dist/commands/browse.d.ts +4 -0
- package/dist/commands/browse.d.ts.map +1 -0
- package/dist/commands/browse.js +590 -0
- package/dist/commands/callers.d.ts +4 -0
- package/dist/commands/callers.d.ts.map +1 -0
- package/dist/commands/callers.js +276 -0
- package/dist/commands/completion.d.ts +17 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +158 -0
- package/dist/commands/config-get.d.ts +4 -0
- package/dist/commands/config-get.d.ts.map +1 -0
- package/dist/commands/config-get.js +131 -0
- package/dist/commands/context.d.ts +11 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +185 -0
- package/dist/commands/cookies.d.ts +4 -0
- package/dist/commands/cookies.d.ts.map +1 -0
- package/dist/commands/cookies.js +140 -0
- package/dist/commands/docs.d.ts +4 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +137 -0
- package/dist/commands/doctor.d.ts +25 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +200 -0
- package/dist/commands/edit-batch.d.ts +18 -0
- package/dist/commands/edit-batch.d.ts.map +1 -0
- package/dist/commands/edit-batch.js +172 -0
- package/dist/commands/eml.d.ts +4 -0
- package/dist/commands/eml.d.ts.map +1 -0
- package/dist/commands/eml.js +428 -0
- package/dist/commands/env.d.ts +4 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +201 -0
- package/dist/commands/fetch.d.ts +4 -0
- package/dist/commands/fetch.d.ts.map +1 -0
- package/dist/commands/fetch.js +99 -0
- package/dist/commands/file-history.d.ts +4 -0
- package/dist/commands/file-history.d.ts.map +1 -0
- package/dist/commands/file-history.js +152 -0
- package/dist/commands/grep.d.ts +4 -0
- package/dist/commands/grep.d.ts.map +1 -0
- package/dist/commands/grep.js +317 -0
- package/dist/commands/init.d.ts +82 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +288 -0
- package/dist/commands/outline.d.ts +4 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +494 -0
- package/dist/commands/presence.d.ts +12 -0
- package/dist/commands/presence.d.ts.map +1 -0
- package/dist/commands/presence.js +123 -0
- package/dist/commands/read.d.ts +7 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +46 -0
- package/dist/commands/scratch.d.ts +4 -0
- package/dist/commands/scratch.d.ts.map +1 -0
- package/dist/commands/scratch.js +426 -0
- package/dist/commands/session.d.ts +4 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +162 -0
- package/dist/commands/sync.d.ts +24 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +275 -0
- package/dist/commands/toc.d.ts +5 -0
- package/dist/commands/toc.d.ts.map +1 -0
- package/dist/commands/toc.js +153 -0
- package/dist/commands/tokens.d.ts +4 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +48 -0
- package/dist/commands/tunnel.d.ts +4 -0
- package/dist/commands/tunnel.d.ts.map +1 -0
- package/dist/commands/tunnel.js +513 -0
- package/dist/commands/uninstall.d.ts +22 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +126 -0
- package/dist/commands/web.d.ts +4 -0
- package/dist/commands/web.d.ts.map +1 -0
- package/dist/commands/web.js +165 -0
- package/dist/core/agents/canonical-emit.d.ts +27 -0
- package/dist/core/agents/canonical-emit.d.ts.map +1 -0
- package/dist/core/agents/canonical-emit.js +72 -0
- package/dist/core/agents/cli-emit.d.ts +27 -0
- package/dist/core/agents/cli-emit.d.ts.map +1 -0
- package/dist/core/agents/cli-emit.js +57 -0
- package/dist/core/agents/cli.d.ts +10 -0
- package/dist/core/agents/cli.d.ts.map +1 -0
- package/dist/core/agents/cli.js +757 -0
- package/dist/core/agents/codex-replay.d.ts +29 -0
- package/dist/core/agents/codex-replay.d.ts.map +1 -0
- package/dist/core/agents/codex-replay.js +138 -0
- package/dist/core/agents/coord-client.d.ts +98 -0
- package/dist/core/agents/coord-client.d.ts.map +1 -0
- package/dist/core/agents/coord-client.js +212 -0
- package/dist/core/agents/events/consume.d.ts +59 -0
- package/dist/core/agents/events/consume.d.ts.map +1 -0
- package/dist/core/agents/events/consume.js +147 -0
- package/dist/core/agents/events/emit.d.ts +42 -0
- package/dist/core/agents/events/emit.d.ts.map +1 -0
- package/dist/core/agents/events/emit.js +70 -0
- package/dist/core/agents/events/ulid.d.ts +11 -0
- package/dist/core/agents/events/ulid.d.ts.map +1 -0
- package/dist/core/agents/events/ulid.js +47 -0
- package/dist/core/agents/index.d.ts +14 -0
- package/dist/core/agents/index.d.ts.map +1 -0
- package/dist/core/agents/index.js +13 -0
- package/dist/core/agents/paths.d.ts +6 -0
- package/dist/core/agents/paths.d.ts.map +1 -0
- package/dist/core/agents/paths.js +17 -0
- package/dist/core/agents/render/prompt-context.d.ts +43 -0
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -0
- package/dist/core/agents/render/prompt-context.js +335 -0
- package/dist/core/agents/render/session-context.d.ts +39 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -0
- package/dist/core/agents/render/session-context.js +283 -0
- package/dist/core/agents/rules/claim-conflict.d.ts +35 -0
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -0
- package/dist/core/agents/rules/claim-conflict.js +244 -0
- package/dist/core/agents/rules/commit-conflict.d.ts +59 -0
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -0
- package/dist/core/agents/rules/commit-conflict.js +244 -0
- package/dist/core/agents/rules/stop-hook.d.ts +44 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -0
- package/dist/core/agents/rules/stop-hook.js +161 -0
- package/dist/core/agents/session-events.d.ts +41 -0
- package/dist/core/agents/session-events.d.ts.map +1 -0
- package/dist/core/agents/session-events.js +205 -0
- package/dist/core/agents/state/activity-log.d.ts +18 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -0
- package/dist/core/agents/state/activity-log.js +34 -0
- package/dist/core/agents/state/council.d.ts +39 -0
- package/dist/core/agents/state/council.d.ts.map +1 -0
- package/dist/core/agents/state/council.js +216 -0
- package/dist/core/agents/state/heartbeat-projector.d.ts +59 -0
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-projector.js +436 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts +64 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-writer.js +271 -0
- package/dist/core/agents/state/names.d.ts +35 -0
- package/dist/core/agents/state/names.d.ts.map +1 -0
- package/dist/core/agents/state/names.js +376 -0
- package/dist/core/agents/state/pidmap.d.ts +11 -0
- package/dist/core/agents/state/pidmap.d.ts.map +1 -0
- package/dist/core/agents/state/pidmap.js +32 -0
- package/dist/core/agents/state/scratch.d.ts +27 -0
- package/dist/core/agents/state/scratch.d.ts.map +1 -0
- package/dist/core/agents/state/scratch.js +90 -0
- package/dist/core/agents/state/shell-mutation.d.ts +17 -0
- package/dist/core/agents/state/shell-mutation.d.ts.map +1 -0
- package/dist/core/agents/state/shell-mutation.js +41 -0
- package/dist/core/agents/state/stale-sweep.d.ts +16 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -0
- package/dist/core/agents/state/stale-sweep.js +166 -0
- package/dist/core/config.d.ts +29 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +108 -0
- package/dist/core/hooks/cli.d.ts +21 -0
- package/dist/core/hooks/cli.d.ts.map +1 -0
- package/dist/core/hooks/cli.js +1123 -0
- package/dist/core/hooks/effects/image-capture.d.ts +43 -0
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -0
- package/dist/core/hooks/effects/image-capture.js +288 -0
- package/dist/core/hooks/effects/index.d.ts +64 -0
- package/dist/core/hooks/effects/index.d.ts.map +1 -0
- package/dist/core/hooks/effects/index.js +197 -0
- package/dist/core/hooks/events/emit.d.ts +31 -0
- package/dist/core/hooks/events/emit.d.ts.map +1 -0
- package/dist/core/hooks/events/emit.js +89 -0
- package/dist/core/hooks/events/schema.d.ts +235 -0
- package/dist/core/hooks/events/schema.d.ts.map +1 -0
- package/dist/core/hooks/events/schema.js +12 -0
- package/dist/core/hooks/events/ulid.d.ts +10 -0
- package/dist/core/hooks/events/ulid.d.ts.map +1 -0
- package/dist/core/hooks/events/ulid.js +47 -0
- package/dist/core/hooks/harness/detect.d.ts +9 -0
- package/dist/core/hooks/harness/detect.d.ts.map +1 -0
- package/dist/core/hooks/harness/detect.js +29 -0
- package/dist/core/hooks/harness/events.d.ts +45 -0
- package/dist/core/hooks/harness/events.d.ts.map +1 -0
- package/dist/core/hooks/harness/events.js +71 -0
- package/dist/core/hooks/harness/output.d.ts +46 -0
- package/dist/core/hooks/harness/output.d.ts.map +1 -0
- package/dist/core/hooks/harness/output.js +87 -0
- package/dist/core/hooks/harness/parse.d.ts +67 -0
- package/dist/core/hooks/harness/parse.d.ts.map +1 -0
- package/dist/core/hooks/harness/parse.js +132 -0
- package/dist/core/hooks/index.d.ts +8 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +7 -0
- package/dist/core/hooks/resolve/anchor.d.ts +37 -0
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -0
- package/dist/core/hooks/resolve/anchor.js +48 -0
- package/dist/core/hooks/resolve/coord-root.d.ts +6 -0
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -0
- package/dist/core/hooks/resolve/coord-root.js +27 -0
- package/dist/core/hooks/resolve/intent.d.ts +33 -0
- package/dist/core/hooks/resolve/intent.d.ts.map +1 -0
- package/dist/core/hooks/resolve/intent.js +79 -0
- package/dist/core/hooks/resolve/owner.d.ts +42 -0
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -0
- package/dist/core/hooks/resolve/owner.js +140 -0
- package/dist/core/hooks/resolve/transcript.d.ts +26 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -0
- package/dist/core/hooks/resolve/transcript.js +73 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/lib/agent-browser/client.d.ts +99 -0
- package/dist/lib/agent-browser/client.d.ts.map +1 -0
- package/dist/lib/agent-browser/client.js +177 -0
- package/dist/lib/agent-browser/index.d.ts +2 -0
- package/dist/lib/agent-browser/index.d.ts.map +1 -0
- package/dist/lib/agent-browser/index.js +1 -0
- package/dist/lib/browser/client.d.ts +193 -0
- package/dist/lib/browser/client.d.ts.map +1 -0
- package/dist/lib/browser/client.js +325 -0
- package/dist/lib/browser/dev-overlay.d.ts +23 -0
- package/dist/lib/browser/dev-overlay.d.ts.map +1 -0
- package/dist/lib/browser/dev-overlay.js +153 -0
- package/dist/lib/browser/index.d.ts +5 -0
- package/dist/lib/browser/index.d.ts.map +1 -0
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/browser/layout.d.ts +79 -0
- package/dist/lib/browser/layout.d.ts.map +1 -0
- package/dist/lib/browser/layout.js +220 -0
- package/dist/lib/browser/visibility.d.ts +86 -0
- package/dist/lib/browser/visibility.d.ts.map +1 -0
- package/dist/lib/browser/visibility.js +333 -0
- package/dist/lib/browser/visual-diff.d.ts +38 -0
- package/dist/lib/browser/visual-diff.d.ts.map +1 -0
- package/dist/lib/browser/visual-diff.js +107 -0
- package/dist/lib/completion/bash.d.ts +25 -0
- package/dist/lib/completion/bash.d.ts.map +1 -0
- package/dist/lib/completion/bash.js +284 -0
- package/dist/lib/completion/fish.d.ts +16 -0
- package/dist/lib/completion/fish.d.ts.map +1 -0
- package/dist/lib/completion/fish.js +118 -0
- package/dist/lib/completion/index.d.ts +5 -0
- package/dist/lib/completion/index.d.ts.map +1 -0
- package/dist/lib/completion/index.js +4 -0
- package/dist/lib/completion/walk.d.ts +68 -0
- package/dist/lib/completion/walk.d.ts.map +1 -0
- package/dist/lib/completion/walk.js +102 -0
- package/dist/lib/completion/zsh.d.ts +13 -0
- package/dist/lib/completion/zsh.d.ts.map +1 -0
- package/dist/lib/completion/zsh.js +249 -0
- package/dist/lib/context/index.d.ts +107 -0
- package/dist/lib/context/index.d.ts.map +1 -0
- package/dist/lib/context/index.js +275 -0
- package/dist/lib/cookies/client.d.ts +131 -0
- package/dist/lib/cookies/client.d.ts.map +1 -0
- package/dist/lib/cookies/client.js +239 -0
- package/dist/lib/cookies/index.d.ts +2 -0
- package/dist/lib/cookies/index.d.ts.map +1 -0
- package/dist/lib/cookies/index.js +1 -0
- package/dist/lib/council/index.d.ts +266 -0
- package/dist/lib/council/index.d.ts.map +1 -0
- package/dist/lib/council/index.js +674 -0
- package/dist/lib/docs-index.d.ts +28 -0
- package/dist/lib/docs-index.d.ts.map +1 -0
- package/dist/lib/docs-index.js +169 -0
- package/dist/lib/docs-lint.d.ts +26 -0
- package/dist/lib/docs-lint.d.ts.map +1 -0
- package/dist/lib/docs-lint.js +378 -0
- package/dist/lib/docs-sweep.d.ts +34 -0
- package/dist/lib/docs-sweep.d.ts.map +1 -0
- package/dist/lib/docs-sweep.js +304 -0
- package/dist/lib/docs.d.ts +27 -0
- package/dist/lib/docs.d.ts.map +1 -0
- package/dist/lib/docs.js +142 -0
- package/dist/lib/env.d.ts +11 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/env.js +12 -0
- package/dist/lib/exec.d.ts +32 -0
- package/dist/lib/exec.d.ts.map +1 -0
- package/dist/lib/exec.js +54 -0
- package/dist/lib/format.d.ts +29 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +139 -0
- package/dist/lib/http/client.d.ts +56 -0
- package/dist/lib/http/client.d.ts.map +1 -0
- package/dist/lib/http/client.js +160 -0
- package/dist/lib/http/index.d.ts +2 -0
- package/dist/lib/http/index.d.ts.map +1 -0
- package/dist/lib/http/index.js +1 -0
- package/dist/lib/identities/index.d.ts +77 -0
- package/dist/lib/identities/index.d.ts.map +1 -0
- package/dist/lib/identities/index.js +190 -0
- package/dist/lib/machine.d.ts +19 -0
- package/dist/lib/machine.d.ts.map +1 -0
- package/dist/lib/machine.js +61 -0
- package/dist/lib/presence.d.ts +48 -0
- package/dist/lib/presence.d.ts.map +1 -0
- package/dist/lib/presence.js +123 -0
- package/dist/lib/readability/client.d.ts +32 -0
- package/dist/lib/readability/client.d.ts.map +1 -0
- package/dist/lib/readability/client.js +119 -0
- package/dist/lib/readability/index.d.ts +2 -0
- package/dist/lib/readability/index.d.ts.map +1 -0
- package/dist/lib/readability/index.js +1 -0
- package/dist/lib/scratch/index.d.ts +74 -0
- package/dist/lib/scratch/index.d.ts.map +1 -0
- package/dist/lib/scratch/index.js +393 -0
- package/dist/lib/tunnel/gate.d.ts +12 -0
- package/dist/lib/tunnel/gate.d.ts.map +1 -0
- package/dist/lib/tunnel/gate.js +101 -0
- package/dist/lib/tunnel/state.d.ts +34 -0
- package/dist/lib/tunnel/state.d.ts.map +1 -0
- package/dist/lib/tunnel/state.js +132 -0
- package/package.json +160 -8
- package/schemas/.gitkeep +0 -0
- package/schemas/config.schema.json +109 -0
- package/src/cli.ts +22 -0
- package/src/commander.ts +242 -0
- package/src/commands/.gitkeep +0 -0
- package/src/commands/agents.ts +4567 -0
- package/src/commands/backup.ts +305 -0
- package/src/commands/browse-ai.ts +198 -0
- package/src/commands/browse.ts +849 -0
- package/src/commands/callers.ts +363 -0
- package/src/commands/completion.ts +193 -0
- package/src/commands/config-get.ts +161 -0
- package/src/commands/context.ts +209 -0
- package/src/commands/cookies.ts +198 -0
- package/src/commands/docs.ts +174 -0
- package/src/commands/doctor.ts +231 -0
- package/src/commands/edit-batch.ts +233 -0
- package/src/commands/eml.ts +519 -0
- package/src/commands/env.ts +254 -0
- package/src/commands/fetch.ts +136 -0
- package/src/commands/file-history.ts +202 -0
- package/src/commands/grep.ts +371 -0
- package/src/commands/init.ts +335 -0
- package/src/commands/outline.ts +564 -0
- package/src/commands/presence.ts +152 -0
- package/src/commands/read.ts +64 -0
- package/src/commands/scratch.ts +445 -0
- package/src/commands/session.ts +187 -0
- package/src/commands/sync.ts +306 -0
- package/src/commands/toc.ts +218 -0
- package/src/commands/tokens.ts +79 -0
- package/src/commands/tunnel.ts +633 -0
- package/src/commands/uninstall.ts +144 -0
- package/src/commands/web.ts +193 -0
- package/src/core/agents/canonical-emit.ts +77 -0
- package/src/core/agents/cli-emit.ts +64 -0
- package/src/core/agents/cli.ts +838 -0
- package/src/core/agents/codex-replay.ts +163 -0
- package/src/core/agents/coord-client.ts +249 -0
- package/src/core/agents/events/consume.ts +196 -0
- package/src/core/agents/events/emit.ts +108 -0
- package/src/core/agents/events/ulid.ts +51 -0
- package/src/core/agents/index.ts +14 -0
- package/src/core/agents/paths.ts +16 -0
- package/src/core/agents/render/prompt-context.ts +401 -0
- package/src/core/agents/render/session-context.ts +341 -0
- package/src/core/agents/rules/claim-conflict.ts +282 -0
- package/src/core/agents/rules/commit-conflict.ts +303 -0
- package/src/core/agents/rules/stop-hook.ts +229 -0
- package/src/core/agents/session-events.ts +228 -0
- package/src/core/agents/state/activity-log.ts +33 -0
- package/src/core/agents/state/council.ts +265 -0
- package/src/core/agents/state/heartbeat-projector.ts +488 -0
- package/src/core/agents/state/heartbeat-writer.ts +333 -0
- package/src/core/agents/state/names.ts +399 -0
- package/src/core/agents/state/pidmap.ts +38 -0
- package/src/core/agents/state/scratch.ts +121 -0
- package/src/core/agents/state/shell-mutation.ts +44 -0
- package/src/core/agents/state/stale-sweep.ts +190 -0
- package/src/core/config.ts +111 -0
- package/src/core/hooks/cli.ts +1247 -0
- package/src/core/hooks/effects/image-capture.ts +330 -0
- package/src/core/hooks/effects/index.ts +210 -0
- package/src/core/hooks/events/emit.ts +120 -0
- package/src/core/hooks/events/schema.ts +430 -0
- package/src/core/hooks/events/ulid.ts +51 -0
- package/src/core/hooks/harness/detect.ts +30 -0
- package/src/core/hooks/harness/events.ts +102 -0
- package/src/core/hooks/harness/output.ts +100 -0
- package/src/core/hooks/harness/parse.ts +180 -0
- package/src/core/hooks/index.ts +16 -0
- package/src/core/hooks/resolve/anchor.ts +51 -0
- package/src/core/hooks/resolve/coord-root.ts +25 -0
- package/src/core/hooks/resolve/intent.ts +89 -0
- package/src/core/hooks/resolve/owner.ts +140 -0
- package/src/core/hooks/resolve/transcript.ts +72 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/index.ts +15 -0
- package/src/lib/agent-browser/client.ts +239 -0
- package/src/lib/agent-browser/index.ts +1 -0
- package/src/lib/browser/client.ts +449 -0
- package/src/lib/browser/dev-overlay.ts +207 -0
- package/src/lib/browser/index.ts +24 -0
- package/src/lib/browser/layout.ts +288 -0
- package/src/lib/browser/visibility.ts +419 -0
- package/src/lib/browser/visual-diff.ts +150 -0
- package/src/lib/completion/bash.ts +291 -0
- package/src/lib/completion/fish.ts +134 -0
- package/src/lib/completion/index.ts +10 -0
- package/src/lib/completion/walk.ts +184 -0
- package/src/lib/completion/zsh.ts +262 -0
- package/src/lib/context/index.ts +386 -0
- package/src/lib/cookies/client.ts +301 -0
- package/src/lib/cookies/index.ts +13 -0
- package/src/lib/council/index.ts +803 -0
- package/src/lib/docs-index.ts +216 -0
- package/src/lib/docs-lint.ts +413 -0
- package/src/lib/docs-sweep.ts +348 -0
- package/src/lib/docs.ts +199 -0
- package/src/lib/env.ts +12 -0
- package/src/lib/exec.ts +74 -0
- package/src/lib/format.ts +147 -0
- package/src/lib/http/client.ts +211 -0
- package/src/lib/http/index.ts +1 -0
- package/src/lib/identities/index.ts +210 -0
- package/src/lib/machine.ts +61 -0
- package/src/lib/presence.ts +154 -0
- package/src/lib/readability/client.ts +156 -0
- package/src/lib/readability/index.ts +5 -0
- package/src/lib/readability/turndown-plugin-gfm.d.ts +10 -0
- package/src/lib/scratch/index.ts +470 -0
- package/src/lib/tunnel/gate.ts +113 -0
- package/src/lib/tunnel/state.ts +167 -0
- package/src/web/.gitkeep +0 -0
- package/index.js +0 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
/**
|
|
6
|
+
* `harn web`: Next.js dashboard for harnery's coord state.
|
|
7
|
+
*
|
|
8
|
+
* Subcommands:
|
|
9
|
+
* up [--prod]: start the server (dev mode default; --prod runs next start)
|
|
10
|
+
* build: next build (production bundle)
|
|
11
|
+
* start: next start (must `harn web build` first)
|
|
12
|
+
*
|
|
13
|
+
* Launches the Next.js app under `harnery/web/` against the user's current
|
|
14
|
+
* working directory. The web app reads `.harnery/` via `HARNERY_COORD_ROOT`;
|
|
15
|
+
* passing cwd here lets the dashboard show the right project regardless
|
|
16
|
+
* of where the user invokes `harn web up` from.
|
|
17
|
+
*
|
|
18
|
+
* Localhost-only by default. Network exposure is intentionally out of
|
|
19
|
+
* scope for v1.
|
|
20
|
+
*/
|
|
21
|
+
function webRoot() {
|
|
22
|
+
// src/commands/web.ts → src/ → harnery/ → harnery/web/
|
|
23
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
return path.resolve(here, "..", "..", "web");
|
|
25
|
+
}
|
|
26
|
+
function checkWebPresent(emit) {
|
|
27
|
+
const root = webRoot();
|
|
28
|
+
if (!existsSync(path.join(root, "package.json"))) {
|
|
29
|
+
emit.error({
|
|
30
|
+
code: "web_missing",
|
|
31
|
+
message: `harnery/web/ not found at ${root}`,
|
|
32
|
+
hint: "The dashboard ships with the harnery git repo, not the npm package (which is the CLI + " +
|
|
33
|
+
"coord engine only). Clone https://github.com/ryanjkelly/harnery, run `bun install`, then " +
|
|
34
|
+
"`harn web up --coord-root <your-project>` (or run it from inside that project). " +
|
|
35
|
+
"See https://harnery.com/cli/web/.",
|
|
36
|
+
});
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return root;
|
|
40
|
+
}
|
|
41
|
+
function runner() {
|
|
42
|
+
// Prefer bun when available; fall back to npx/npm for plain Node installs.
|
|
43
|
+
const r = spawnSync("bun", ["--version"], { stdio: "ignore" });
|
|
44
|
+
return r.status === 0 ? "bun" : "npx";
|
|
45
|
+
}
|
|
46
|
+
export function registerWebCommand(program, emit) {
|
|
47
|
+
const web = program
|
|
48
|
+
.command("web")
|
|
49
|
+
.description("Standalone read-only dashboard for harnery's coord state");
|
|
50
|
+
web
|
|
51
|
+
.command("up")
|
|
52
|
+
.description("Start the dashboard. Default: dev mode (HMR, no build needed). With " +
|
|
53
|
+
"--prod, runs next start (requires a prior `harn web build`).")
|
|
54
|
+
.option("-p, --port <port>", "Listen port", "9000")
|
|
55
|
+
.option("--coord-root <dir>", "Override the coord root (default: cwd; web walks up looking for .harnery/)")
|
|
56
|
+
.option("--prod", "Use next start instead of next dev (requires prior build)")
|
|
57
|
+
.action(async (opts) => {
|
|
58
|
+
const root = checkWebPresent(emit);
|
|
59
|
+
if (!root) {
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const coordRoot = opts.coordRoot ?? process.cwd();
|
|
64
|
+
const port = String(opts.port);
|
|
65
|
+
const mode = opts.prod ? "start" : "dev";
|
|
66
|
+
if (opts.prod) {
|
|
67
|
+
const nextDir = path.join(root, ".next");
|
|
68
|
+
if (!existsSync(nextDir)) {
|
|
69
|
+
emit.error({
|
|
70
|
+
code: "no_build",
|
|
71
|
+
message: `--prod requires a prior build (no .next at ${nextDir})`,
|
|
72
|
+
hint: "Run `harn web build` first.",
|
|
73
|
+
});
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
emit.log(`harn web · http://localhost:${port} (${mode})`, "info");
|
|
79
|
+
emit.log(`reading .harnery/ from: ${coordRoot}`, "info");
|
|
80
|
+
const child = spawn(runner(), ["run", mode], {
|
|
81
|
+
cwd: root,
|
|
82
|
+
env: {
|
|
83
|
+
...process.env,
|
|
84
|
+
HARNERY_COORD_ROOT: coordRoot,
|
|
85
|
+
HARNERY_WEB_PORT: port,
|
|
86
|
+
},
|
|
87
|
+
stdio: "inherit",
|
|
88
|
+
});
|
|
89
|
+
const cleanup = (sig) => {
|
|
90
|
+
if (!child.killed)
|
|
91
|
+
child.kill(sig);
|
|
92
|
+
};
|
|
93
|
+
process.on("SIGINT", () => cleanup("SIGINT"));
|
|
94
|
+
process.on("SIGTERM", () => cleanup("SIGTERM"));
|
|
95
|
+
child.on("exit", (code, sig) => {
|
|
96
|
+
if (sig) {
|
|
97
|
+
emit.log(`web exited on ${sig}`, "info");
|
|
98
|
+
}
|
|
99
|
+
else if (code !== 0) {
|
|
100
|
+
emit.error({ code: "web_exit", message: `next exited with code ${code}` });
|
|
101
|
+
process.exitCode = code ?? 1;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
web
|
|
106
|
+
.command("build")
|
|
107
|
+
.description("Build the production bundle (next build).")
|
|
108
|
+
.action(() => {
|
|
109
|
+
const root = checkWebPresent(emit);
|
|
110
|
+
if (!root) {
|
|
111
|
+
process.exitCode = 1;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
emit.log("running next build…", "info");
|
|
115
|
+
const r = spawnSync(runner(), ["run", "build"], {
|
|
116
|
+
cwd: root,
|
|
117
|
+
stdio: "inherit",
|
|
118
|
+
});
|
|
119
|
+
process.exitCode = r.status ?? 1;
|
|
120
|
+
});
|
|
121
|
+
web
|
|
122
|
+
.command("start")
|
|
123
|
+
.description("Start the production server (next start). Requires prior `harn web build`.")
|
|
124
|
+
.option("-p, --port <port>", "Listen port", "9000")
|
|
125
|
+
.option("--coord-root <dir>", "Override the coord root")
|
|
126
|
+
.action((opts) => {
|
|
127
|
+
const root = checkWebPresent(emit);
|
|
128
|
+
if (!root) {
|
|
129
|
+
process.exitCode = 1;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const nextDir = path.join(root, ".next");
|
|
133
|
+
if (!existsSync(nextDir)) {
|
|
134
|
+
emit.error({
|
|
135
|
+
code: "no_build",
|
|
136
|
+
message: `no .next/ found at ${nextDir}`,
|
|
137
|
+
hint: "Run `harn web build` first.",
|
|
138
|
+
});
|
|
139
|
+
process.exitCode = 1;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const coordRoot = opts.coordRoot ?? process.cwd();
|
|
143
|
+
const port = String(opts.port);
|
|
144
|
+
emit.log(`harn web · http://localhost:${port} (start)`, "info");
|
|
145
|
+
emit.log(`reading .harnery/ from: ${coordRoot}`, "info");
|
|
146
|
+
const child = spawn(runner(), ["run", "start"], {
|
|
147
|
+
cwd: root,
|
|
148
|
+
env: {
|
|
149
|
+
...process.env,
|
|
150
|
+
HARNERY_COORD_ROOT: coordRoot,
|
|
151
|
+
HARNERY_WEB_PORT: port,
|
|
152
|
+
},
|
|
153
|
+
stdio: "inherit",
|
|
154
|
+
});
|
|
155
|
+
const cleanup = (sig) => {
|
|
156
|
+
if (!child.killed)
|
|
157
|
+
child.kill(sig);
|
|
158
|
+
};
|
|
159
|
+
process.on("SIGINT", () => cleanup("SIGINT"));
|
|
160
|
+
process.on("SIGTERM", () => cleanup("SIGTERM"));
|
|
161
|
+
child.on("exit", (code) => {
|
|
162
|
+
process.exitCode = code ?? 0;
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emit canonical events by spawning `agent-coord emit-event`. Used by every
|
|
3
|
+
* `agents …` / `scratch` / `presence` write that has a canonical state event.
|
|
4
|
+
*
|
|
5
|
+
* Soft-fails: never throws into the caller. A failed emit logs to stderr
|
|
6
|
+
* (visible to operators in their terminal) but never breaks the CLI flow.
|
|
7
|
+
*
|
|
8
|
+
* Synchronous spawn: the projector runs before the CLI returns. ~20ms
|
|
9
|
+
* latency budget per call.
|
|
10
|
+
*/
|
|
11
|
+
export interface CanonicalEmitInput {
|
|
12
|
+
type: string;
|
|
13
|
+
owner: string;
|
|
14
|
+
session: string;
|
|
15
|
+
harness: "claude-code" | "cursor" | "codex";
|
|
16
|
+
data: Record<string, unknown>;
|
|
17
|
+
turnId?: string;
|
|
18
|
+
parentSessionId?: string;
|
|
19
|
+
parentTurnId?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function emitCanonical(input: CanonicalEmitInput): void;
|
|
22
|
+
/**
|
|
23
|
+
* Normalize the heartbeat's `platform` field (which uses snake_case
|
|
24
|
+
* `claude_code`) to the canonical kebab-case Harness type.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeHarness(platform: string | undefined): "claude-code" | "cursor" | "codex";
|
|
27
|
+
//# sourceMappingURL=canonical-emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-emit.d.ts","sourceRoot":"","sources":["../../../src/core/agents/canonical-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CA8B7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,CAIjG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emit canonical events by spawning `agent-coord emit-event`. Used by every
|
|
3
|
+
* `agents …` / `scratch` / `presence` write that has a canonical state event.
|
|
4
|
+
*
|
|
5
|
+
* Soft-fails: never throws into the caller. A failed emit logs to stderr
|
|
6
|
+
* (visible to operators in their terminal) but never breaks the CLI flow.
|
|
7
|
+
*
|
|
8
|
+
* Synchronous spawn: the projector runs before the CLI returns. ~20ms
|
|
9
|
+
* latency budget per call.
|
|
10
|
+
*/
|
|
11
|
+
import { spawnSync } from "node:child_process";
|
|
12
|
+
import { existsSync } from "node:fs";
|
|
13
|
+
import { dirname, join, resolve } from "node:path";
|
|
14
|
+
export function emitCanonical(input) {
|
|
15
|
+
const root = findRepoRoot();
|
|
16
|
+
if (!root)
|
|
17
|
+
return;
|
|
18
|
+
const binary = resolve(root, "harnery", "bin", "agent-coord");
|
|
19
|
+
if (!existsSync(binary))
|
|
20
|
+
return;
|
|
21
|
+
try {
|
|
22
|
+
const args = [
|
|
23
|
+
"emit-event",
|
|
24
|
+
"--type",
|
|
25
|
+
input.type,
|
|
26
|
+
"--owner",
|
|
27
|
+
input.owner,
|
|
28
|
+
"--session",
|
|
29
|
+
input.session,
|
|
30
|
+
"--harness",
|
|
31
|
+
input.harness,
|
|
32
|
+
"--data-json",
|
|
33
|
+
JSON.stringify(input.data),
|
|
34
|
+
];
|
|
35
|
+
if (input.turnId)
|
|
36
|
+
args.push("--turn-id", input.turnId);
|
|
37
|
+
if (input.parentSessionId)
|
|
38
|
+
args.push("--parent-session-id", input.parentSessionId);
|
|
39
|
+
if (input.parentTurnId)
|
|
40
|
+
args.push("--parent-turn-id", input.parentTurnId);
|
|
41
|
+
spawnSync(binary, args, {
|
|
42
|
+
encoding: "utf8",
|
|
43
|
+
stdio: "ignore",
|
|
44
|
+
timeout: 3000,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
/* never break the caller */
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Normalize the heartbeat's `platform` field (which uses snake_case
|
|
53
|
+
* `claude_code`) to the canonical kebab-case Harness type.
|
|
54
|
+
*/
|
|
55
|
+
export function normalizeHarness(platform) {
|
|
56
|
+
if (platform === "cursor")
|
|
57
|
+
return "cursor";
|
|
58
|
+
if (platform === "codex")
|
|
59
|
+
return "codex";
|
|
60
|
+
return "claude-code";
|
|
61
|
+
}
|
|
62
|
+
function findRepoRoot(start = process.cwd()) {
|
|
63
|
+
let dir = resolve(start);
|
|
64
|
+
while (true) {
|
|
65
|
+
if (existsSync(join(dir, ".harnery")))
|
|
66
|
+
return dir;
|
|
67
|
+
const parent = dirname(dir);
|
|
68
|
+
if (parent === dir)
|
|
69
|
+
return null;
|
|
70
|
+
dir = parent;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-side canonical event emission helper. Importable from any CLI surface
|
|
3
|
+
* to emit-then-project in one call.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: every state-changing CLI command appends its event first, then
|
|
6
|
+
* runs the projector synchronously for the affected owner.
|
|
7
|
+
*/
|
|
8
|
+
import { type EmitInput, type Envelope } from "./events/emit.js";
|
|
9
|
+
export interface EmitAndProjectResult {
|
|
10
|
+
envelope: Envelope;
|
|
11
|
+
projected: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Emit a canonical event AND synchronously project it into the owner's v2
|
|
15
|
+
* heartbeat. Idempotent on event_id: replays don't double-apply.
|
|
16
|
+
*
|
|
17
|
+
* Returns the emitted envelope so callers can inspect / log.
|
|
18
|
+
*
|
|
19
|
+
* Soft-fails on any internal error: never throws into the caller, because
|
|
20
|
+
* this runs inside operator-facing CLI commands and a corrupt events.ndjson
|
|
21
|
+
* line shouldn't break `agents set-task`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function emitAndProject(input: EmitInput, opts?: {
|
|
24
|
+
coordRoot?: string;
|
|
25
|
+
skipProject?: boolean;
|
|
26
|
+
}): EmitAndProjectResult | null;
|
|
27
|
+
//# sourceMappingURL=cli-emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-emit.d.ts","sourceRoot":"","sources":["../../../src/core/agents/cli-emit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAIvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,EAChB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACvD,oBAAoB,GAAG,IAAI,CAiC7B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-side canonical event emission helper. Importable from any CLI surface
|
|
3
|
+
* to emit-then-project in one call.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: every state-changing CLI command appends its event first, then
|
|
6
|
+
* runs the projector synchronously for the affected owner.
|
|
7
|
+
*/
|
|
8
|
+
import { emit } from "./events/emit.js";
|
|
9
|
+
import { findCoordRoot } from "./paths.js";
|
|
10
|
+
import { projectHeartbeats } from "./state/heartbeat-projector.js";
|
|
11
|
+
/**
|
|
12
|
+
* Emit a canonical event AND synchronously project it into the owner's v2
|
|
13
|
+
* heartbeat. Idempotent on event_id: replays don't double-apply.
|
|
14
|
+
*
|
|
15
|
+
* Returns the emitted envelope so callers can inspect / log.
|
|
16
|
+
*
|
|
17
|
+
* Soft-fails on any internal error: never throws into the caller, because
|
|
18
|
+
* this runs inside operator-facing CLI commands and a corrupt events.ndjson
|
|
19
|
+
* line shouldn't break `agents set-task`.
|
|
20
|
+
*/
|
|
21
|
+
export function emitAndProject(input, opts = {}) {
|
|
22
|
+
const root = opts.coordRoot ?? findCoordRoot();
|
|
23
|
+
if (!root)
|
|
24
|
+
return null;
|
|
25
|
+
try {
|
|
26
|
+
const envelope = emit(root, input);
|
|
27
|
+
let projected = false;
|
|
28
|
+
if (!opts.skipProject) {
|
|
29
|
+
try {
|
|
30
|
+
projectHeartbeats(root, [
|
|
31
|
+
{
|
|
32
|
+
schema_version: envelope.schema_version,
|
|
33
|
+
event_id: envelope.event_id,
|
|
34
|
+
event_type: envelope.event_type,
|
|
35
|
+
ts: envelope.ts,
|
|
36
|
+
instance_id: envelope.instance_id,
|
|
37
|
+
session_id: envelope.session_id,
|
|
38
|
+
parent_session_id: envelope.parent_session_id,
|
|
39
|
+
turn_id: envelope.turn_id,
|
|
40
|
+
parent_turn_id: envelope.parent_turn_id,
|
|
41
|
+
harness: envelope.harness,
|
|
42
|
+
source: envelope.source,
|
|
43
|
+
data: envelope.data,
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
projected = true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
/* projector failure is non-fatal; next agent-coord project run catches up */
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { envelope, projected };
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent-coord` CLI entry point. Phase 1: every subcommand no-ops with a
|
|
3
|
+
* structured debug log. The one exception is `verdict`, which replies
|
|
4
|
+
* fail-open so adapters can already wire it up without affecting flow.
|
|
5
|
+
*
|
|
6
|
+
* Phase 2 replaces the no-op branches with real state projection + CLI
|
|
7
|
+
* handlers; Phase 4 flips the default so `harn agents …` shims through here.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/core/agents/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|