@dirgha/code 1.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 +101 -0
- package/README.md +674 -0
- package/dist/dirgha.mjs +2185 -0
- package/dist_v2/acp/index.d.ts +1 -0
- package/dist_v2/acp/index.js +2 -0
- package/dist_v2/acp/server.d.ts +31 -0
- package/dist_v2/acp/server.js +137 -0
- package/dist_v2/cli/auth-cmd.d.ts +10 -0
- package/dist_v2/cli/auth-cmd.js +69 -0
- package/dist_v2/cli/config.d.ts +46 -0
- package/dist_v2/cli/config.js +70 -0
- package/dist_v2/cli/flags.d.ts +10 -0
- package/dist_v2/cli/flags.js +49 -0
- package/dist_v2/cli/flows/full-cycle.d.ts +30 -0
- package/dist_v2/cli/flows/full-cycle.js +39 -0
- package/dist_v2/cli/flows/index.d.ts +2 -0
- package/dist_v2/cli/flows/index.js +3 -0
- package/dist_v2/cli/flows/tarball.d.ts +10 -0
- package/dist_v2/cli/flows/tarball.js +47 -0
- package/dist_v2/cli/index.d.ts +4 -0
- package/dist_v2/cli/index.js +5 -0
- package/dist_v2/cli/interactive.d.ts +21 -0
- package/dist_v2/cli/interactive.js +207 -0
- package/dist_v2/cli/main.d.ts +10 -0
- package/dist_v2/cli/main.js +173 -0
- package/dist_v2/cli/models-cmd.d.ts +6 -0
- package/dist_v2/cli/models-cmd.js +50 -0
- package/dist_v2/cli/setup.d.ts +13 -0
- package/dist_v2/cli/setup.js +128 -0
- package/dist_v2/cli/slash/account.d.ts +10 -0
- package/dist_v2/cli/slash/account.js +59 -0
- package/dist_v2/cli/slash/clear.d.ts +8 -0
- package/dist_v2/cli/slash/clear.js +15 -0
- package/dist_v2/cli/slash/compact.d.ts +7 -0
- package/dist_v2/cli/slash/compact.js +13 -0
- package/dist_v2/cli/slash/config.d.ts +8 -0
- package/dist_v2/cli/slash/config.js +49 -0
- package/dist_v2/cli/slash/exit.d.ts +7 -0
- package/dist_v2/cli/slash/exit.js +16 -0
- package/dist_v2/cli/slash/fleet.d.ts +7 -0
- package/dist_v2/cli/slash/fleet.js +22 -0
- package/dist_v2/cli/slash/help.d.ts +9 -0
- package/dist_v2/cli/slash/help.js +31 -0
- package/dist_v2/cli/slash/history.d.ts +7 -0
- package/dist_v2/cli/slash/history.js +42 -0
- package/dist_v2/cli/slash/index.d.ts +30 -0
- package/dist_v2/cli/slash/index.js +52 -0
- package/dist_v2/cli/slash/init.d.ts +8 -0
- package/dist_v2/cli/slash/init.js +57 -0
- package/dist_v2/cli/slash/keys.d.ts +8 -0
- package/dist_v2/cli/slash/keys.js +101 -0
- package/dist_v2/cli/slash/login.d.ts +10 -0
- package/dist_v2/cli/slash/login.js +47 -0
- package/dist_v2/cli/slash/memory.d.ts +8 -0
- package/dist_v2/cli/slash/memory.js +101 -0
- package/dist_v2/cli/slash/mode.d.ts +8 -0
- package/dist_v2/cli/slash/mode.js +30 -0
- package/dist_v2/cli/slash/models.d.ts +8 -0
- package/dist_v2/cli/slash/models.js +73 -0
- package/dist_v2/cli/slash/resume.d.ts +8 -0
- package/dist_v2/cli/slash/resume.js +24 -0
- package/dist_v2/cli/slash/session.d.ts +8 -0
- package/dist_v2/cli/slash/session.js +74 -0
- package/dist_v2/cli/slash/setup.d.ts +8 -0
- package/dist_v2/cli/slash/setup.js +50 -0
- package/dist_v2/cli/slash/status.d.ts +7 -0
- package/dist_v2/cli/slash/status.js +37 -0
- package/dist_v2/cli/slash/theme.d.ts +9 -0
- package/dist_v2/cli/slash/theme.js +53 -0
- package/dist_v2/cli/slash/types.d.ts +14 -0
- package/dist_v2/cli/slash/types.js +9 -0
- package/dist_v2/cli/slash/upgrade.d.ts +9 -0
- package/dist_v2/cli/slash/upgrade.js +66 -0
- package/dist_v2/cli/slash.d.ts +72 -0
- package/dist_v2/cli/slash.js +77 -0
- package/dist_v2/cli/subcommands/ask.d.ts +17 -0
- package/dist_v2/cli/subcommands/ask.js +76 -0
- package/dist_v2/cli/subcommands/audit.d.ts +15 -0
- package/dist_v2/cli/subcommands/audit.js +128 -0
- package/dist_v2/cli/subcommands/chat.d.ts +13 -0
- package/dist_v2/cli/subcommands/chat.js +72 -0
- package/dist_v2/cli/subcommands/compact.d.ts +14 -0
- package/dist_v2/cli/subcommands/compact.js +114 -0
- package/dist_v2/cli/subcommands/doctor.d.ts +11 -0
- package/dist_v2/cli/subcommands/doctor.js +103 -0
- package/dist_v2/cli/subcommands/export-session.d.ts +10 -0
- package/dist_v2/cli/subcommands/export-session.js +60 -0
- package/dist_v2/cli/subcommands/import-session.d.ts +11 -0
- package/dist_v2/cli/subcommands/import-session.js +77 -0
- package/dist_v2/cli/subcommands/index.d.ts +40 -0
- package/dist_v2/cli/subcommands/index.js +38 -0
- package/dist_v2/cli/subcommands/init.d.ts +10 -0
- package/dist_v2/cli/subcommands/init.js +74 -0
- package/dist_v2/cli/subcommands/keys.d.ts +12 -0
- package/dist_v2/cli/subcommands/keys.js +136 -0
- package/dist_v2/cli/subcommands/login.d.ts +10 -0
- package/dist_v2/cli/subcommands/login.js +60 -0
- package/dist_v2/cli/subcommands/logout.d.ts +10 -0
- package/dist_v2/cli/subcommands/logout.js +21 -0
- package/dist_v2/cli/subcommands/models.d.ts +14 -0
- package/dist_v2/cli/subcommands/models.js +144 -0
- package/dist_v2/cli/subcommands/setup.d.ts +11 -0
- package/dist_v2/cli/subcommands/setup.js +107 -0
- package/dist_v2/cli/subcommands/stats.d.ts +13 -0
- package/dist_v2/cli/subcommands/stats.js +148 -0
- package/dist_v2/cli/subcommands/status.d.ts +14 -0
- package/dist_v2/cli/subcommands/status.js +91 -0
- package/dist_v2/cli/submit-paper.d.ts +15 -0
- package/dist_v2/cli/submit-paper.js +68 -0
- package/dist_v2/context/_fts.d.ts +62 -0
- package/dist_v2/context/_fts.js +195 -0
- package/dist_v2/context/branch.d.ts +18 -0
- package/dist_v2/context/branch.js +66 -0
- package/dist_v2/context/compaction.d.ts +26 -0
- package/dist_v2/context/compaction.js +120 -0
- package/dist_v2/context/index.d.ts +5 -0
- package/dist_v2/context/index.js +6 -0
- package/dist_v2/context/knowledge.d.ts +38 -0
- package/dist_v2/context/knowledge.js +146 -0
- package/dist_v2/context/memory.d.ts +80 -0
- package/dist_v2/context/memory.js +276 -0
- package/dist_v2/context/mode.d.ts +25 -0
- package/dist_v2/context/mode.js +81 -0
- package/dist_v2/context/session.d.ts +56 -0
- package/dist_v2/context/session.js +108 -0
- package/dist_v2/daemon/index.d.ts +2 -0
- package/dist_v2/daemon/index.js +3 -0
- package/dist_v2/daemon/protocol.d.ts +73 -0
- package/dist_v2/daemon/protocol.js +6 -0
- package/dist_v2/daemon/server.d.ts +35 -0
- package/dist_v2/daemon/server.js +191 -0
- package/dist_v2/eval/index.d.ts +5 -0
- package/dist_v2/eval/index.js +6 -0
- package/dist_v2/eval/regression.d.ts +14 -0
- package/dist_v2/eval/regression.js +106 -0
- package/dist_v2/eval/reporter.d.ts +7 -0
- package/dist_v2/eval/reporter.js +34 -0
- package/dist_v2/eval/swe-bench.d.ts +18 -0
- package/dist_v2/eval/swe-bench.js +23 -0
- package/dist_v2/eval/terminal-bench.d.ts +13 -0
- package/dist_v2/eval/terminal-bench.js +19 -0
- package/dist_v2/eval/types.d.ts +36 -0
- package/dist_v2/eval/types.js +5 -0
- package/dist_v2/fleet/apply-back.d.ts +27 -0
- package/dist_v2/fleet/apply-back.js +191 -0
- package/dist_v2/fleet/cli-command.d.ts +61 -0
- package/dist_v2/fleet/cli-command.js +329 -0
- package/dist_v2/fleet/index.d.ts +21 -0
- package/dist_v2/fleet/index.js +21 -0
- package/dist_v2/fleet/runner.d.ts +28 -0
- package/dist_v2/fleet/runner.js +347 -0
- package/dist_v2/fleet/tripleshot.d.ts +21 -0
- package/dist_v2/fleet/tripleshot.js +222 -0
- package/dist_v2/fleet/types.d.ts +193 -0
- package/dist_v2/fleet/types.js +24 -0
- package/dist_v2/fleet/worktree.d.ts +51 -0
- package/dist_v2/fleet/worktree.js +176 -0
- package/dist_v2/hooks/index.d.ts +1 -0
- package/dist_v2/hooks/index.js +2 -0
- package/dist_v2/hooks/registry.d.ts +21 -0
- package/dist_v2/hooks/registry.js +40 -0
- package/dist_v2/index.d.ts +12 -0
- package/dist_v2/index.js +11 -0
- package/dist_v2/integrations/arniko-client.d.ts +42 -0
- package/dist_v2/integrations/arniko-client.js +86 -0
- package/dist_v2/integrations/auth.d.ts +45 -0
- package/dist_v2/integrations/auth.js +54 -0
- package/dist_v2/integrations/billing.d.ts +71 -0
- package/dist_v2/integrations/billing.js +107 -0
- package/dist_v2/integrations/bucky-client.d.ts +105 -0
- package/dist_v2/integrations/bucky-client.js +76 -0
- package/dist_v2/integrations/deploy-client.d.ts +60 -0
- package/dist_v2/integrations/deploy-client.js +87 -0
- package/dist_v2/integrations/device-auth.d.ts +48 -0
- package/dist_v2/integrations/device-auth.js +192 -0
- package/dist_v2/integrations/entitlements.d.ts +34 -0
- package/dist_v2/integrations/entitlements.js +43 -0
- package/dist_v2/integrations/http.d.ts +22 -0
- package/dist_v2/integrations/http.js +114 -0
- package/dist_v2/integrations/index.d.ts +8 -0
- package/dist_v2/integrations/index.js +15 -0
- package/dist_v2/intelligence/cost.d.ts +28 -0
- package/dist_v2/intelligence/cost.js +58 -0
- package/dist_v2/intelligence/error-classifier.d.ts +8 -0
- package/dist_v2/intelligence/error-classifier.js +71 -0
- package/dist_v2/intelligence/index.d.ts +5 -0
- package/dist_v2/intelligence/index.js +6 -0
- package/dist_v2/intelligence/prices.d.ts +13 -0
- package/dist_v2/intelligence/prices.js +26 -0
- package/dist_v2/intelligence/smart-router.d.ts +21 -0
- package/dist_v2/intelligence/smart-router.js +59 -0
- package/dist_v2/intelligence/telemetry.d.ts +22 -0
- package/dist_v2/intelligence/telemetry.js +31 -0
- package/dist_v2/kernel/agent-loop.d.ts +32 -0
- package/dist_v2/kernel/agent-loop.js +151 -0
- package/dist_v2/kernel/event-stream.d.ts +18 -0
- package/dist_v2/kernel/event-stream.js +102 -0
- package/dist_v2/kernel/index.d.ts +4 -0
- package/dist_v2/kernel/index.js +5 -0
- package/dist_v2/kernel/message.d.ts +29 -0
- package/dist_v2/kernel/message.js +118 -0
- package/dist_v2/kernel/types.d.ts +206 -0
- package/dist_v2/kernel/types.js +9 -0
- package/dist_v2/mcp/client.d.ts +44 -0
- package/dist_v2/mcp/client.js +63 -0
- package/dist_v2/mcp/index.d.ts +3 -0
- package/dist_v2/mcp/index.js +4 -0
- package/dist_v2/mcp/tool-bridge.d.ts +11 -0
- package/dist_v2/mcp/tool-bridge.js +33 -0
- package/dist_v2/mcp/transport.d.ts +29 -0
- package/dist_v2/mcp/transport.js +73 -0
- package/dist_v2/parity/index.d.ts +3 -0
- package/dist_v2/parity/index.js +4 -0
- package/dist_v2/parity/mock-openai-compat.d.ts +15 -0
- package/dist_v2/parity/mock-openai-compat.js +35 -0
- package/dist_v2/parity/runner.d.ts +21 -0
- package/dist_v2/parity/runner.js +76 -0
- package/dist_v2/parity/scenarios.d.ts +20 -0
- package/dist_v2/parity/scenarios.js +70 -0
- package/dist_v2/providers/anthropic.d.ts +21 -0
- package/dist_v2/providers/anthropic.js +191 -0
- package/dist_v2/providers/dispatch.d.ts +11 -0
- package/dist_v2/providers/dispatch.js +45 -0
- package/dist_v2/providers/fireworks.d.ts +18 -0
- package/dist_v2/providers/fireworks.js +44 -0
- package/dist_v2/providers/gemini.d.ts +19 -0
- package/dist_v2/providers/gemini.js +188 -0
- package/dist_v2/providers/http.d.ts +41 -0
- package/dist_v2/providers/http.js +188 -0
- package/dist_v2/providers/iface.d.ts +18 -0
- package/dist_v2/providers/iface.js +18 -0
- package/dist_v2/providers/index.d.ts +39 -0
- package/dist_v2/providers/index.js +51 -0
- package/dist_v2/providers/nvidia.d.ts +27 -0
- package/dist_v2/providers/nvidia.js +142 -0
- package/dist_v2/providers/ollama.d.ts +15 -0
- package/dist_v2/providers/ollama.js +37 -0
- package/dist_v2/providers/openai-compat.d.ts +29 -0
- package/dist_v2/providers/openai-compat.js +239 -0
- package/dist_v2/providers/openai.d.ts +20 -0
- package/dist_v2/providers/openai.js +107 -0
- package/dist_v2/providers/openrouter.d.ts +24 -0
- package/dist_v2/providers/openrouter.js +69 -0
- package/dist_v2/safety/approval-bus.d.ts +26 -0
- package/dist_v2/safety/approval-bus.js +48 -0
- package/dist_v2/safety/audit-log.d.ts +27 -0
- package/dist_v2/safety/audit-log.js +71 -0
- package/dist_v2/safety/index.d.ts +4 -0
- package/dist_v2/safety/index.js +5 -0
- package/dist_v2/safety/policy.d.ts +32 -0
- package/dist_v2/safety/policy.js +131 -0
- package/dist_v2/safety/sandbox/bwrap.d.ts +11 -0
- package/dist_v2/safety/sandbox/bwrap.js +52 -0
- package/dist_v2/safety/sandbox/iface.d.ts +29 -0
- package/dist_v2/safety/sandbox/iface.js +8 -0
- package/dist_v2/safety/sandbox/index.d.ts +7 -0
- package/dist_v2/safety/sandbox/index.js +8 -0
- package/dist_v2/safety/sandbox/landlock.d.ts +17 -0
- package/dist_v2/safety/sandbox/landlock.js +26 -0
- package/dist_v2/safety/sandbox/noop.d.ts +12 -0
- package/dist_v2/safety/sandbox/noop.js +52 -0
- package/dist_v2/safety/sandbox/seatbelt.d.ts +11 -0
- package/dist_v2/safety/sandbox/seatbelt.js +49 -0
- package/dist_v2/safety/sandbox/select.d.ts +6 -0
- package/dist_v2/safety/sandbox/select.js +42 -0
- package/dist_v2/safety/sandbox/windows.d.ts +13 -0
- package/dist_v2/safety/sandbox/windows.js +22 -0
- package/dist_v2/skills/index.d.ts +3 -0
- package/dist_v2/skills/index.js +4 -0
- package/dist_v2/skills/loader.d.ts +38 -0
- package/dist_v2/skills/loader.js +102 -0
- package/dist_v2/skills/matcher.d.ts +14 -0
- package/dist_v2/skills/matcher.js +72 -0
- package/dist_v2/skills/runtime.d.ts +13 -0
- package/dist_v2/skills/runtime.js +40 -0
- package/dist_v2/subagents/delegator.d.ts +36 -0
- package/dist_v2/subagents/delegator.js +82 -0
- package/dist_v2/subagents/index.d.ts +2 -0
- package/dist_v2/subagents/index.js +3 -0
- package/dist_v2/subagents/pool.d.ts +18 -0
- package/dist_v2/subagents/pool.js +31 -0
- package/dist_v2/tools/browser.d.ts +27 -0
- package/dist_v2/tools/browser.js +179 -0
- package/dist_v2/tools/checkpoint.d.ts +25 -0
- package/dist_v2/tools/checkpoint.js +222 -0
- package/dist_v2/tools/cron.d.ts +32 -0
- package/dist_v2/tools/cron.js +160 -0
- package/dist_v2/tools/diff.d.ts +18 -0
- package/dist_v2/tools/diff.js +117 -0
- package/dist_v2/tools/exec.d.ts +19 -0
- package/dist_v2/tools/exec.js +49 -0
- package/dist_v2/tools/fs-edit.d.ts +11 -0
- package/dist_v2/tools/fs-edit.js +81 -0
- package/dist_v2/tools/fs-ls.d.ts +7 -0
- package/dist_v2/tools/fs-ls.js +57 -0
- package/dist_v2/tools/fs-read.d.ts +7 -0
- package/dist_v2/tools/fs-read.js +60 -0
- package/dist_v2/tools/fs-write.d.ts +8 -0
- package/dist_v2/tools/fs-write.js +46 -0
- package/dist_v2/tools/git.d.ts +8 -0
- package/dist_v2/tools/git.js +57 -0
- package/dist_v2/tools/index.d.ts +25 -0
- package/dist_v2/tools/index.js +39 -0
- package/dist_v2/tools/multimodal.d.ts +41 -0
- package/dist_v2/tools/multimodal.js +381 -0
- package/dist_v2/tools/permission.d.ts +27 -0
- package/dist_v2/tools/permission.js +43 -0
- package/dist_v2/tools/registry.d.ts +44 -0
- package/dist_v2/tools/registry.js +62 -0
- package/dist_v2/tools/search-glob.d.ts +7 -0
- package/dist_v2/tools/search-glob.js +98 -0
- package/dist_v2/tools/search-grep.d.ts +7 -0
- package/dist_v2/tools/search-grep.js +109 -0
- package/dist_v2/tools/shell.d.ts +10 -0
- package/dist_v2/tools/shell.js +76 -0
- package/dist_v2/tools/task.d.ts +8 -0
- package/dist_v2/tools/task.js +37 -0
- package/dist_v2/tui/approval.d.ts +7 -0
- package/dist_v2/tui/approval.js +55 -0
- package/dist_v2/tui/index.d.ts +4 -0
- package/dist_v2/tui/index.js +5 -0
- package/dist_v2/tui/ink/App.d.ts +39 -0
- package/dist_v2/tui/ink/App.js +206 -0
- package/dist_v2/tui/ink/components/AtFileComplete.d.ts +25 -0
- package/dist_v2/tui/ink/components/AtFileComplete.js +158 -0
- package/dist_v2/tui/ink/components/HelpOverlay.d.ts +24 -0
- package/dist_v2/tui/ink/components/HelpOverlay.js +130 -0
- package/dist_v2/tui/ink/components/InputBox.d.ts +35 -0
- package/dist_v2/tui/ink/components/InputBox.js +153 -0
- package/dist_v2/tui/ink/components/Logo.d.ts +12 -0
- package/dist_v2/tui/ink/components/Logo.js +27 -0
- package/dist_v2/tui/ink/components/ModelPicker.d.ts +26 -0
- package/dist_v2/tui/ink/components/ModelPicker.js +80 -0
- package/dist_v2/tui/ink/components/PasteCollapse.d.ts +36 -0
- package/dist_v2/tui/ink/components/PasteCollapse.js +59 -0
- package/dist_v2/tui/ink/components/StatusBar.d.ts +18 -0
- package/dist_v2/tui/ink/components/StatusBar.js +41 -0
- package/dist_v2/tui/ink/components/StreamingText.d.ts +14 -0
- package/dist_v2/tui/ink/components/StreamingText.js +11 -0
- package/dist_v2/tui/ink/components/ThinkingBlock.d.ts +13 -0
- package/dist_v2/tui/ink/components/ThinkingBlock.js +13 -0
- package/dist_v2/tui/ink/components/ToolBox.d.ts +20 -0
- package/dist_v2/tui/ink/components/ToolBox.js +63 -0
- package/dist_v2/tui/ink/components/vim-bindings.d.ts +43 -0
- package/dist_v2/tui/ink/components/vim-bindings.js +135 -0
- package/dist_v2/tui/ink/index.d.ts +39 -0
- package/dist_v2/tui/ink/index.js +47 -0
- package/dist_v2/tui/ink/use-event-projection.d.ts +51 -0
- package/dist_v2/tui/ink/use-event-projection.js +126 -0
- package/dist_v2/tui/ink/use-overlays.d.ts +24 -0
- package/dist_v2/tui/ink/use-overlays.js +50 -0
- package/dist_v2/tui/renderer.d.ts +19 -0
- package/dist_v2/tui/renderer.js +64 -0
- package/dist_v2/tui/status-bar.d.ts +12 -0
- package/dist_v2/tui/status-bar.js +16 -0
- package/dist_v2/tui/theme.d.ts +27 -0
- package/dist_v2/tui/theme.js +56 -0
- package/dist_v2/utils/json-repair.d.ts +7 -0
- package/dist_v2/utils/json-repair.js +45 -0
- package/package.json +113 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon JSON-RPC protocol. Method + param types are declared here so
|
|
3
|
+
* the server and any future client share a single source of truth.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentEvent, Message, UsageTotal } from '../kernel/types.js';
|
|
6
|
+
export interface DaemonRequest<TParams = unknown> {
|
|
7
|
+
jsonrpc: '2.0';
|
|
8
|
+
id: number | string;
|
|
9
|
+
method: string;
|
|
10
|
+
params?: TParams;
|
|
11
|
+
}
|
|
12
|
+
export interface DaemonResponse<TResult = unknown> {
|
|
13
|
+
jsonrpc: '2.0';
|
|
14
|
+
id: number | string;
|
|
15
|
+
result?: TResult;
|
|
16
|
+
error?: {
|
|
17
|
+
code: number;
|
|
18
|
+
message: string;
|
|
19
|
+
data?: unknown;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface DaemonNotification<TParams = unknown> {
|
|
23
|
+
jsonrpc: '2.0';
|
|
24
|
+
method: string;
|
|
25
|
+
params?: TParams;
|
|
26
|
+
}
|
|
27
|
+
export type DaemonWire = DaemonRequest | DaemonResponse | DaemonNotification;
|
|
28
|
+
export interface SessionStartParams {
|
|
29
|
+
model?: string;
|
|
30
|
+
system?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SessionStartResult {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
model: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SessionResumeParams {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionResumeResult {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
turns: number;
|
|
42
|
+
}
|
|
43
|
+
export interface PromptSubmitParams {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
prompt: string;
|
|
46
|
+
}
|
|
47
|
+
export interface PromptSubmitResult {
|
|
48
|
+
streamId: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ApprovalRespondParams {
|
|
51
|
+
requestId: string;
|
|
52
|
+
decision: 'approve' | 'deny' | 'approve_once' | 'deny_always';
|
|
53
|
+
}
|
|
54
|
+
export interface EventNotification {
|
|
55
|
+
streamId: string;
|
|
56
|
+
event: AgentEvent;
|
|
57
|
+
}
|
|
58
|
+
export interface HealthResult {
|
|
59
|
+
uptimeMs: number;
|
|
60
|
+
sessionsActive: number;
|
|
61
|
+
usage: UsageTotal;
|
|
62
|
+
}
|
|
63
|
+
export interface SessionListResult {
|
|
64
|
+
sessions: Array<{
|
|
65
|
+
id: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
turns: number;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
export interface SessionMessagesResult {
|
|
71
|
+
sessionId: string;
|
|
72
|
+
messages: Message[];
|
|
73
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon server. Reads JSON-RPC messages from stdin, dispatches to
|
|
3
|
+
* method handlers, writes responses + event notifications to stdout.
|
|
4
|
+
* The stream id returned by prompt.submit correlates notifications for
|
|
5
|
+
* the client.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderRegistry } from '../providers/index.js';
|
|
8
|
+
import type { ToolRegistry } from '../tools/registry.js';
|
|
9
|
+
import type { SessionStore } from '../context/session.js';
|
|
10
|
+
import type { DirghaConfig } from '../cli/config.js';
|
|
11
|
+
export interface DaemonServerOptions {
|
|
12
|
+
registry: ToolRegistry;
|
|
13
|
+
providers: ProviderRegistry;
|
|
14
|
+
sessions: SessionStore;
|
|
15
|
+
config: DirghaConfig;
|
|
16
|
+
cwd: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class DaemonServer {
|
|
19
|
+
private opts;
|
|
20
|
+
private active;
|
|
21
|
+
private started;
|
|
22
|
+
private totalUsage;
|
|
23
|
+
constructor(opts: DaemonServerOptions);
|
|
24
|
+
start(): void;
|
|
25
|
+
private handle;
|
|
26
|
+
private healthResult;
|
|
27
|
+
private sessionStart;
|
|
28
|
+
private sessionResume;
|
|
29
|
+
private sessionList;
|
|
30
|
+
private sessionMessages;
|
|
31
|
+
private promptSubmit;
|
|
32
|
+
private writeResult;
|
|
33
|
+
private writeError;
|
|
34
|
+
private writeNotification;
|
|
35
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon server. Reads JSON-RPC messages from stdin, dispatches to
|
|
3
|
+
* method handlers, writes responses + event notifications to stdout.
|
|
4
|
+
* The stream id returned by prompt.submit correlates notifications for
|
|
5
|
+
* the client.
|
|
6
|
+
*/
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { stdin, stdout } from 'node:process';
|
|
9
|
+
import { createEventStream } from '../kernel/event-stream.js';
|
|
10
|
+
import { runAgentLoop } from '../kernel/agent-loop.js';
|
|
11
|
+
import { createToolExecutor } from '../tools/exec.js';
|
|
12
|
+
export class DaemonServer {
|
|
13
|
+
opts;
|
|
14
|
+
active = new Map();
|
|
15
|
+
started = Date.now();
|
|
16
|
+
totalUsage = { inputTokens: 0, outputTokens: 0, cachedTokens: 0, costUsd: 0 };
|
|
17
|
+
constructor(opts) {
|
|
18
|
+
this.opts = opts;
|
|
19
|
+
}
|
|
20
|
+
start() {
|
|
21
|
+
let buffer = '';
|
|
22
|
+
stdin.setEncoding('utf8');
|
|
23
|
+
stdin.on('data', chunk => {
|
|
24
|
+
buffer += chunk;
|
|
25
|
+
let idx;
|
|
26
|
+
while ((idx = buffer.indexOf('\n')) >= 0) {
|
|
27
|
+
const line = buffer.slice(0, idx);
|
|
28
|
+
buffer = buffer.slice(idx + 1);
|
|
29
|
+
if (!line.trim())
|
|
30
|
+
continue;
|
|
31
|
+
try {
|
|
32
|
+
const raw = JSON.parse(line);
|
|
33
|
+
void this.handle(raw);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
this.writeError(null, -32700, `Parse error: ${String(err)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async handle(req) {
|
|
42
|
+
try {
|
|
43
|
+
switch (req.method) {
|
|
44
|
+
case 'daemon.health':
|
|
45
|
+
this.writeResult(req.id, this.healthResult());
|
|
46
|
+
return;
|
|
47
|
+
case 'daemon.shutdown':
|
|
48
|
+
this.writeResult(req.id, { ok: true });
|
|
49
|
+
process.exit(0);
|
|
50
|
+
return;
|
|
51
|
+
case 'session.start':
|
|
52
|
+
this.writeResult(req.id, await this.sessionStart(req.params));
|
|
53
|
+
return;
|
|
54
|
+
case 'session.resume':
|
|
55
|
+
this.writeResult(req.id, await this.sessionResume(req.params));
|
|
56
|
+
return;
|
|
57
|
+
case 'session.list':
|
|
58
|
+
this.writeResult(req.id, await this.sessionList());
|
|
59
|
+
return;
|
|
60
|
+
case 'session.messages':
|
|
61
|
+
this.writeResult(req.id, await this.sessionMessages(req.params));
|
|
62
|
+
return;
|
|
63
|
+
case 'prompt.submit':
|
|
64
|
+
this.writeResult(req.id, await this.promptSubmit(req.params));
|
|
65
|
+
return;
|
|
66
|
+
default:
|
|
67
|
+
this.writeError(req.id, -32601, `Method not found: ${req.method}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
this.writeError(req.id, -32000, err instanceof Error ? err.message : String(err));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
healthResult() {
|
|
75
|
+
return {
|
|
76
|
+
uptimeMs: Date.now() - this.started,
|
|
77
|
+
sessionsActive: this.active.size,
|
|
78
|
+
usage: this.totalUsage,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async sessionStart(params) {
|
|
82
|
+
const sessionId = randomUUID();
|
|
83
|
+
const session = await this.opts.sessions.create(sessionId);
|
|
84
|
+
const model = params?.model ?? this.opts.config.model;
|
|
85
|
+
const history = [];
|
|
86
|
+
if (params?.system)
|
|
87
|
+
history.push({ role: 'system', content: params.system });
|
|
88
|
+
this.active.set(sessionId, { session, history, usage: emptyUsage() });
|
|
89
|
+
return { sessionId, model };
|
|
90
|
+
}
|
|
91
|
+
async sessionResume(params) {
|
|
92
|
+
const session = await this.opts.sessions.open(params.sessionId);
|
|
93
|
+
if (!session)
|
|
94
|
+
throw new Error(`Unknown session: ${params.sessionId}`);
|
|
95
|
+
const messages = await session.messages();
|
|
96
|
+
this.active.set(params.sessionId, { session, history: messages, usage: emptyUsage() });
|
|
97
|
+
return { sessionId: params.sessionId, turns: messages.filter(m => m.role === 'assistant').length };
|
|
98
|
+
}
|
|
99
|
+
async sessionList() {
|
|
100
|
+
const ids = await this.opts.sessions.list();
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const id of ids) {
|
|
103
|
+
const session = await this.opts.sessions.open(id);
|
|
104
|
+
if (!session)
|
|
105
|
+
continue;
|
|
106
|
+
const messages = await session.messages();
|
|
107
|
+
out.push({ id, createdAt: '', turns: messages.filter(m => m.role === 'assistant').length });
|
|
108
|
+
}
|
|
109
|
+
return { sessions: out };
|
|
110
|
+
}
|
|
111
|
+
async sessionMessages(params) {
|
|
112
|
+
const active = this.active.get(params.sessionId);
|
|
113
|
+
if (active)
|
|
114
|
+
return { sessionId: params.sessionId, messages: active.history };
|
|
115
|
+
const session = await this.opts.sessions.open(params.sessionId);
|
|
116
|
+
if (!session)
|
|
117
|
+
throw new Error(`Unknown session: ${params.sessionId}`);
|
|
118
|
+
return { sessionId: params.sessionId, messages: await session.messages() };
|
|
119
|
+
}
|
|
120
|
+
async promptSubmit(params) {
|
|
121
|
+
const active = this.active.get(params.sessionId);
|
|
122
|
+
if (!active)
|
|
123
|
+
throw new Error(`Unknown session: ${params.sessionId}`);
|
|
124
|
+
const streamId = randomUUID();
|
|
125
|
+
const events = createEventStream();
|
|
126
|
+
events.subscribe(event => {
|
|
127
|
+
const notif = { streamId, event };
|
|
128
|
+
this.writeNotification('event.stream', notif);
|
|
129
|
+
if (event.type === 'usage') {
|
|
130
|
+
active.usage.inputTokens += event.inputTokens;
|
|
131
|
+
active.usage.outputTokens += event.outputTokens;
|
|
132
|
+
this.totalUsage.inputTokens += event.inputTokens;
|
|
133
|
+
this.totalUsage.outputTokens += event.outputTokens;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
active.history.push({ role: 'user', content: params.prompt });
|
|
137
|
+
await active.session.append({
|
|
138
|
+
type: 'message',
|
|
139
|
+
ts: new Date().toISOString(),
|
|
140
|
+
message: { role: 'user', content: params.prompt },
|
|
141
|
+
});
|
|
142
|
+
const provider = this.opts.providers.forModel(this.opts.config.model);
|
|
143
|
+
const executor = createToolExecutor({
|
|
144
|
+
registry: this.opts.registry,
|
|
145
|
+
cwd: this.opts.cwd,
|
|
146
|
+
sessionId: params.sessionId,
|
|
147
|
+
});
|
|
148
|
+
const sanitized = this.opts.registry.sanitize({ descriptionLimit: 200 });
|
|
149
|
+
void runAgentLoop({
|
|
150
|
+
sessionId: params.sessionId,
|
|
151
|
+
model: this.opts.config.model,
|
|
152
|
+
messages: active.history,
|
|
153
|
+
tools: sanitized.definitions,
|
|
154
|
+
maxTurns: this.opts.config.maxTurns,
|
|
155
|
+
provider,
|
|
156
|
+
toolExecutor: executor,
|
|
157
|
+
events,
|
|
158
|
+
}).then(async (result) => {
|
|
159
|
+
active.history.length = 0;
|
|
160
|
+
active.history.push(...result.messages);
|
|
161
|
+
for (const msg of result.messages.slice(-4)) {
|
|
162
|
+
await active.session.append({ type: 'message', ts: new Date().toISOString(), message: msg });
|
|
163
|
+
}
|
|
164
|
+
}).catch(err => {
|
|
165
|
+
this.writeNotification('event.stream', {
|
|
166
|
+
streamId,
|
|
167
|
+
event: { type: 'error', message: err instanceof Error ? err.message : String(err) },
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
return { streamId };
|
|
171
|
+
}
|
|
172
|
+
writeResult(id, result) {
|
|
173
|
+
if (id === null)
|
|
174
|
+
return;
|
|
175
|
+
const out = { jsonrpc: '2.0', id, result };
|
|
176
|
+
stdout.write(`${JSON.stringify(out)}\n`);
|
|
177
|
+
}
|
|
178
|
+
writeError(id, code, message) {
|
|
179
|
+
if (id === null)
|
|
180
|
+
return;
|
|
181
|
+
const out = { jsonrpc: '2.0', id, error: { code, message } };
|
|
182
|
+
stdout.write(`${JSON.stringify(out)}\n`);
|
|
183
|
+
}
|
|
184
|
+
writeNotification(method, params) {
|
|
185
|
+
stdout.write(`${JSON.stringify({ jsonrpc: '2.0', method, params })}\n`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function emptyUsage() {
|
|
189
|
+
return { inputTokens: 0, outputTokens: 0, cachedTokens: 0, costUsd: 0 };
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal regression suite runner. Each task runs the full agent loop
|
|
3
|
+
* in a temp working directory; success criteria come from
|
|
4
|
+
* EvalTask.expectedArtifact. Suites ship as JSON under datasets/.
|
|
5
|
+
*/
|
|
6
|
+
import { ProviderRegistry } from '../providers/index.js';
|
|
7
|
+
import type { EvalReport, EvalTask } from './types.js';
|
|
8
|
+
export interface RegressionOptions {
|
|
9
|
+
model: string;
|
|
10
|
+
suiteName?: string;
|
|
11
|
+
providers?: ProviderRegistry;
|
|
12
|
+
}
|
|
13
|
+
export declare function runRegressionSuite(tasks: EvalTask[], opts: RegressionOptions): Promise<EvalReport>;
|
|
14
|
+
export declare function loadTasksFromJson(path: string): EvalTask[];
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal regression suite runner. Each task runs the full agent loop
|
|
3
|
+
* in a temp working directory; success criteria come from
|
|
4
|
+
* EvalTask.expectedArtifact. Suites ship as JSON under datasets/.
|
|
5
|
+
*/
|
|
6
|
+
import { mkdtempSync, readFileSync } from 'node:fs';
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { tmpdir } from 'node:os';
|
|
10
|
+
import { randomUUID } from 'node:crypto';
|
|
11
|
+
import { createEventStream } from '../kernel/event-stream.js';
|
|
12
|
+
import { runAgentLoop } from '../kernel/agent-loop.js';
|
|
13
|
+
import { ProviderRegistry } from '../providers/index.js';
|
|
14
|
+
import { builtInTools, createToolExecutor, createToolRegistry } from '../tools/index.js';
|
|
15
|
+
export async function runRegressionSuite(tasks, opts) {
|
|
16
|
+
const providers = opts.providers ?? new ProviderRegistry();
|
|
17
|
+
const results = [];
|
|
18
|
+
const started = Date.now();
|
|
19
|
+
for (const task of tasks) {
|
|
20
|
+
results.push(await runOne(task, providers, opts.model));
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
suite: opts.suiteName ?? 'regression',
|
|
24
|
+
model: opts.model,
|
|
25
|
+
runAt: new Date().toISOString(),
|
|
26
|
+
total: results.length,
|
|
27
|
+
passed: results.filter(r => r.ok).length,
|
|
28
|
+
failed: results.filter(r => !r.ok).length,
|
|
29
|
+
durationMs: Date.now() - started,
|
|
30
|
+
results,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function runOne(task, providers, model) {
|
|
34
|
+
const cwd = mkdtempSync(join(tmpdir(), 'dirgha-eval-'));
|
|
35
|
+
const sessionId = randomUUID();
|
|
36
|
+
const events = createEventStream();
|
|
37
|
+
const registry = createToolRegistry(builtInTools);
|
|
38
|
+
const executor = createToolExecutor({ registry, cwd, sessionId });
|
|
39
|
+
const sanitized = registry.sanitize({ descriptionLimit: 200 });
|
|
40
|
+
const started = Date.now();
|
|
41
|
+
let inputTokens = 0;
|
|
42
|
+
let outputTokens = 0;
|
|
43
|
+
events.subscribe(ev => {
|
|
44
|
+
if (ev.type === 'usage') {
|
|
45
|
+
inputTokens += ev.inputTokens;
|
|
46
|
+
outputTokens += ev.outputTokens;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const messages = [];
|
|
50
|
+
if (task.system)
|
|
51
|
+
messages.push({ role: 'system', content: task.system });
|
|
52
|
+
messages.push({ role: 'user', content: task.prompt });
|
|
53
|
+
let verdict;
|
|
54
|
+
try {
|
|
55
|
+
const result = await runAgentLoop({
|
|
56
|
+
sessionId,
|
|
57
|
+
model,
|
|
58
|
+
messages,
|
|
59
|
+
tools: sanitized.definitions,
|
|
60
|
+
maxTurns: task.maxTurns ?? 12,
|
|
61
|
+
provider: providers.forModel(model),
|
|
62
|
+
toolExecutor: executor,
|
|
63
|
+
events,
|
|
64
|
+
});
|
|
65
|
+
const check = await checkArtifact(cwd, task);
|
|
66
|
+
verdict = {
|
|
67
|
+
taskId: task.id,
|
|
68
|
+
ok: check.ok && result.stopReason !== 'error',
|
|
69
|
+
reason: check.reason,
|
|
70
|
+
durationMs: Date.now() - started,
|
|
71
|
+
usage: { inputTokens, outputTokens, costUsd: 0 },
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
verdict = {
|
|
76
|
+
taskId: task.id,
|
|
77
|
+
ok: false,
|
|
78
|
+
reason: `exception: ${err instanceof Error ? err.message : String(err)}`,
|
|
79
|
+
durationMs: Date.now() - started,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return verdict;
|
|
83
|
+
}
|
|
84
|
+
async function checkArtifact(cwd, task) {
|
|
85
|
+
const expected = task.expectedArtifact;
|
|
86
|
+
if (!expected)
|
|
87
|
+
return { ok: true, reason: 'no artifact check required' };
|
|
88
|
+
const content = await readFile(join(cwd, expected.path), 'utf8').catch(() => undefined);
|
|
89
|
+
if (content === undefined)
|
|
90
|
+
return { ok: false, reason: `artifact missing: ${expected.path}` };
|
|
91
|
+
const contains = expected.containsAnyOf ?? [];
|
|
92
|
+
if (contains.length > 0 && !contains.some(s => content.includes(s))) {
|
|
93
|
+
return { ok: false, reason: `artifact lacks any of expected markers` };
|
|
94
|
+
}
|
|
95
|
+
const excludes = expected.excludes ?? [];
|
|
96
|
+
for (const ex of excludes) {
|
|
97
|
+
if (content.includes(ex))
|
|
98
|
+
return { ok: false, reason: `artifact contains forbidden token: ${ex}` };
|
|
99
|
+
}
|
|
100
|
+
return { ok: true, reason: 'artifact passed' };
|
|
101
|
+
}
|
|
102
|
+
export function loadTasksFromJson(path) {
|
|
103
|
+
const text = readFileSync(path, 'utf8');
|
|
104
|
+
return JSON.parse(text);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=regression.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eval report renderer. Emits a compact Markdown summary plus optional
|
|
3
|
+
* JSON persistence.
|
|
4
|
+
*/
|
|
5
|
+
import type { EvalReport } from './types.js';
|
|
6
|
+
export declare function renderMarkdown(report: EvalReport): string;
|
|
7
|
+
export declare function writeReport(path: string, report: EvalReport): Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eval report renderer. Emits a compact Markdown summary plus optional
|
|
3
|
+
* JSON persistence.
|
|
4
|
+
*/
|
|
5
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
6
|
+
import { dirname } from 'node:path';
|
|
7
|
+
export function renderMarkdown(report) {
|
|
8
|
+
const passRate = report.total === 0 ? 0 : (report.passed / report.total) * 100;
|
|
9
|
+
const lines = [
|
|
10
|
+
`# Eval report: ${report.suite}`,
|
|
11
|
+
``,
|
|
12
|
+
`- model: \`${report.model}\``,
|
|
13
|
+
`- run: ${report.runAt}`,
|
|
14
|
+
`- duration: ${report.durationMs}ms`,
|
|
15
|
+
`- pass rate: ${report.passed}/${report.total} (${passRate.toFixed(1)}%)`,
|
|
16
|
+
``,
|
|
17
|
+
`## Results`,
|
|
18
|
+
``,
|
|
19
|
+
'| Task | Status | Duration | Reason |',
|
|
20
|
+
'| --- | --- | --- | --- |',
|
|
21
|
+
];
|
|
22
|
+
for (const r of report.results) {
|
|
23
|
+
lines.push(`| \`${r.taskId}\` | ${r.ok ? 'pass' : 'fail'} | ${r.durationMs}ms | ${r.reason} |`);
|
|
24
|
+
}
|
|
25
|
+
return lines.join('\n');
|
|
26
|
+
}
|
|
27
|
+
export async function writeReport(path, report) {
|
|
28
|
+
await mkdir(dirname(path), { recursive: true });
|
|
29
|
+
if (path.endsWith('.md'))
|
|
30
|
+
await writeFile(path, renderMarkdown(report), 'utf8');
|
|
31
|
+
else
|
|
32
|
+
await writeFile(path, JSON.stringify(report, null, 2), 'utf8');
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWE-Bench Lite runner stub.
|
|
3
|
+
*
|
|
4
|
+
* The full harness requires a dataset loader that clones each
|
|
5
|
+
* benchmark repository at the target commit, applies a base patch,
|
|
6
|
+
* runs the provided tests, and compares to the expected patch. That
|
|
7
|
+
* code ships in a follow-up sprint alongside the dataset manifest. The
|
|
8
|
+
* shape here declares the public surface so eval callers can wire it
|
|
9
|
+
* up without changing their own code later.
|
|
10
|
+
*/
|
|
11
|
+
import type { EvalReport } from './types.js';
|
|
12
|
+
export interface SweBenchConfig {
|
|
13
|
+
datasetPath: string;
|
|
14
|
+
model: string;
|
|
15
|
+
suite: 'lite' | 'full';
|
|
16
|
+
taskFilter?: (taskId: string) => boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function runSweBench(config: SweBenchConfig): Promise<EvalReport>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWE-Bench Lite runner stub.
|
|
3
|
+
*
|
|
4
|
+
* The full harness requires a dataset loader that clones each
|
|
5
|
+
* benchmark repository at the target commit, applies a base patch,
|
|
6
|
+
* runs the provided tests, and compares to the expected patch. That
|
|
7
|
+
* code ships in a follow-up sprint alongside the dataset manifest. The
|
|
8
|
+
* shape here declares the public surface so eval callers can wire it
|
|
9
|
+
* up without changing their own code later.
|
|
10
|
+
*/
|
|
11
|
+
export async function runSweBench(config) {
|
|
12
|
+
return {
|
|
13
|
+
suite: `swe-bench-${config.suite}`,
|
|
14
|
+
model: config.model,
|
|
15
|
+
runAt: new Date().toISOString(),
|
|
16
|
+
total: 0,
|
|
17
|
+
passed: 0,
|
|
18
|
+
failed: 0,
|
|
19
|
+
durationMs: 0,
|
|
20
|
+
results: [],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=swe-bench.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-Bench runner stub. Benchmarks agent terminal interactions
|
|
3
|
+
* against scripted scenarios (shell recipes, navigational tasks). The
|
|
4
|
+
* real runner requires a container harness to isolate state; that
|
|
5
|
+
* integration ships separately.
|
|
6
|
+
*/
|
|
7
|
+
import type { EvalReport } from './types.js';
|
|
8
|
+
export interface TerminalBenchConfig {
|
|
9
|
+
datasetPath: string;
|
|
10
|
+
model: string;
|
|
11
|
+
taskFilter?: (taskId: string) => boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function runTerminalBench(config: TerminalBenchConfig): Promise<EvalReport>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-Bench runner stub. Benchmarks agent terminal interactions
|
|
3
|
+
* against scripted scenarios (shell recipes, navigational tasks). The
|
|
4
|
+
* real runner requires a container harness to isolate state; that
|
|
5
|
+
* integration ships separately.
|
|
6
|
+
*/
|
|
7
|
+
export async function runTerminalBench(config) {
|
|
8
|
+
return {
|
|
9
|
+
suite: 'terminal-bench',
|
|
10
|
+
model: config.model,
|
|
11
|
+
runAt: new Date().toISOString(),
|
|
12
|
+
total: 0,
|
|
13
|
+
passed: 0,
|
|
14
|
+
failed: 0,
|
|
15
|
+
durationMs: 0,
|
|
16
|
+
results: [],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=terminal-bench.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eval harness shared types.
|
|
3
|
+
*/
|
|
4
|
+
export interface EvalTask {
|
|
5
|
+
id: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
system?: string;
|
|
8
|
+
expectedArtifact?: {
|
|
9
|
+
path: string;
|
|
10
|
+
containsAnyOf?: string[];
|
|
11
|
+
excludes?: string[];
|
|
12
|
+
};
|
|
13
|
+
maxTurns?: number;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface EvalResult {
|
|
17
|
+
taskId: string;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
reason: string;
|
|
20
|
+
durationMs: number;
|
|
21
|
+
usage?: {
|
|
22
|
+
inputTokens: number;
|
|
23
|
+
outputTokens: number;
|
|
24
|
+
costUsd: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface EvalReport {
|
|
28
|
+
suite: string;
|
|
29
|
+
model: string;
|
|
30
|
+
runAt: string;
|
|
31
|
+
total: number;
|
|
32
|
+
passed: number;
|
|
33
|
+
failed: number;
|
|
34
|
+
durationMs: number;
|
|
35
|
+
results: EvalResult[];
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fleet/apply-back.ts — Land a worktree's changes back into the parent
|
|
3
|
+
* working tree.
|
|
4
|
+
*
|
|
5
|
+
* Three strategies:
|
|
6
|
+
* - '3way' (default) — commit in worktree, `git diff base..HEAD`, then
|
|
7
|
+
* `git apply --3way` to the parent tree so the user reviews as
|
|
8
|
+
* UNSTAGED changes. Reversible; conflict markers are produced in
|
|
9
|
+
* files on mismatch rather than failing outright.
|
|
10
|
+
*
|
|
11
|
+
* - 'merge' — `git merge --no-ff <branch>` on the parent. Leaves a
|
|
12
|
+
* merge commit. Use when you want the history.
|
|
13
|
+
*
|
|
14
|
+
* - 'cherry-pick' — `git cherry-pick <base>..<HEAD>` replays every
|
|
15
|
+
* commit from the worktree onto the parent HEAD.
|
|
16
|
+
*
|
|
17
|
+
* Returns structured ApplyResult; does NOT throw on merge conflicts —
|
|
18
|
+
* caller inspects `conflicts`/`success` and decides.
|
|
19
|
+
*/
|
|
20
|
+
import type { ApplyOptions, ApplyResult, WorktreeHandle } from './types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Apply a worktree's changes back to the parent working tree.
|
|
23
|
+
*
|
|
24
|
+
* The worktree is expected to be in a clean-or-dirty state; any dirty
|
|
25
|
+
* changes are staged + committed transparently before the apply.
|
|
26
|
+
*/
|
|
27
|
+
export declare function applyBack(worktree: WorktreeHandle, options?: ApplyOptions): Promise<ApplyResult>;
|