duckhunt-runner 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 +135 -0
- package/README.md +96 -0
- package/dist/aws.d.ts +2 -0
- package/dist/aws.d.ts.map +1 -0
- package/dist/aws.js +60 -0
- package/dist/aws.js.map +1 -0
- package/dist/claude.d.ts +27 -0
- package/dist/claude.d.ts.map +1 -0
- package/dist/claude.js +68 -0
- package/dist/claude.js.map +1 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +59 -0
- package/dist/config.js.map +1 -0
- package/dist/daemon.d.ts +26 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +356 -0
- package/dist/daemon.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth.d.ts +12 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +90 -0
- package/dist/oauth.js.map +1 -0
- package/dist/repos.d.ts +3 -0
- package/dist/repos.d.ts.map +1 -0
- package/dist/repos.js +190 -0
- package/dist/repos.js.map +1 -0
- package/dist/status.d.ts +2 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +59 -0
- package/dist/status.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license
|
|
25
|
+
to distribute copies of the software. Your license
|
|
26
|
+
to distribute covers distributing the software with
|
|
27
|
+
changes and new works permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to
|
|
43
|
+
make changes and new works based on the software for any
|
|
44
|
+
permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Noncommercial Purposes
|
|
53
|
+
|
|
54
|
+
Any noncommercial purpose is a permitted purpose.
|
|
55
|
+
|
|
56
|
+
## Personal Uses
|
|
57
|
+
|
|
58
|
+
Personal use for research, experiment, and testing for
|
|
59
|
+
the benefit of public knowledge, personal study, private
|
|
60
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
61
|
+
observance, without any anticipated commercial application,
|
|
62
|
+
is use for a permitted purpose.
|
|
63
|
+
|
|
64
|
+
## Noncommercial Organizations
|
|
65
|
+
|
|
66
|
+
Use by any charitable organization, educational institution,
|
|
67
|
+
public research organization, public safety or health
|
|
68
|
+
organization, environmental protection organization,
|
|
69
|
+
or government institution is use for a permitted purpose
|
|
70
|
+
regardless of the source of funding or obligations resulting
|
|
71
|
+
from the funding.
|
|
72
|
+
|
|
73
|
+
## Fair Use
|
|
74
|
+
|
|
75
|
+
You may have "fair use" rights for the software under the
|
|
76
|
+
law. These terms do not limit them.
|
|
77
|
+
|
|
78
|
+
## No Other Rights
|
|
79
|
+
|
|
80
|
+
These terms do not allow you to sublicense or transfer any of
|
|
81
|
+
your licenses to anyone else, or prevent the licensor from
|
|
82
|
+
granting licenses to anyone else. These terms do not imply
|
|
83
|
+
any other licenses.
|
|
84
|
+
|
|
85
|
+
## Patent Defense
|
|
86
|
+
|
|
87
|
+
If you make any written claim that the software infringes or
|
|
88
|
+
contributes to infringement of any patent, your patent license
|
|
89
|
+
for the software granted under these terms ends immediately. If
|
|
90
|
+
your company makes such a claim, your patent license ends
|
|
91
|
+
immediately for work on behalf of your company.
|
|
92
|
+
|
|
93
|
+
## Violations
|
|
94
|
+
|
|
95
|
+
The first time you are notified in writing that you have
|
|
96
|
+
violated any of these terms, or done anything with the software
|
|
97
|
+
not covered by your licenses, your licenses can nonetheless
|
|
98
|
+
continue if you come into full compliance with these terms,
|
|
99
|
+
and take practical steps to correct past violations, within
|
|
100
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
101
|
+
end immediately.
|
|
102
|
+
|
|
103
|
+
## No Liability
|
|
104
|
+
|
|
105
|
+
***As far as the law allows, the software comes as is, without
|
|
106
|
+
any warranty or condition, and the licensor will not be liable
|
|
107
|
+
to you for any damages arising out of these terms or the use
|
|
108
|
+
or nature of the software, under any kind of legal claim.***
|
|
109
|
+
|
|
110
|
+
## Definitions
|
|
111
|
+
|
|
112
|
+
The **licensor** is the individual or entity offering these
|
|
113
|
+
terms, and the **software** is the software the licensor makes
|
|
114
|
+
available under these terms.
|
|
115
|
+
|
|
116
|
+
**You** refers to the individual or entity agreeing to these
|
|
117
|
+
terms.
|
|
118
|
+
|
|
119
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
120
|
+
or other kind of organization that you work for, plus all
|
|
121
|
+
organizations that have control over, are under the control of,
|
|
122
|
+
or are under common control with that organization. **Control**
|
|
123
|
+
means ownership of substantially all the assets of an entity,
|
|
124
|
+
or the power to direct its management and policies by vote,
|
|
125
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
126
|
+
|
|
127
|
+
**Your licenses** are all the licenses granted to you for the
|
|
128
|
+
software under these terms.
|
|
129
|
+
|
|
130
|
+
**Use** means anything you do with the software requiring one
|
|
131
|
+
of your licenses.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
Required Notice: Copyright 2026 miermontoto (https://github.com/miermontoto)
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# duckhunt-runner
|
|
2
|
+
|
|
3
|
+
Local daemon for [duckhunt](https://duckhunt.info) agent runs.
|
|
4
|
+
|
|
5
|
+
When something needs investigating — a CloudWatch alarm, a failing check, an issue — duckhunt
|
|
6
|
+
queues an *agent run*. This daemon claims it and launches **Claude Code headless on your own
|
|
7
|
+
machine**, so the agent works with your Claude login, your git checkouts and your AWS CLI. It
|
|
8
|
+
writes the verdict back to duckhunt as a work note, which reaches you as a push notification.
|
|
9
|
+
|
|
10
|
+
The server never sees your credentials, your filesystem paths or your git tokens. It only ever
|
|
11
|
+
learns a repo's `workspace/slug` key and, optionally, an AWS account id — never where they live on
|
|
12
|
+
disk.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- **Node 22+**
|
|
17
|
+
- **[Claude Code](https://claude.com/claude-code)** installed and logged in on this machine
|
|
18
|
+
(`claude`). The daemon runs `claude -p` with your session.
|
|
19
|
+
- A duckhunt account on the instance you are connecting to.
|
|
20
|
+
|
|
21
|
+
> `ANTHROPIC_API_KEY` in your environment silently shadows your Claude subscription login. If it is
|
|
22
|
+
> set and you did not mean to bill the API, unset it for the daemon's environment.
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx duckhunt-runner login https://duckhunt.info
|
|
28
|
+
npx duckhunt-runner repos discover ~/dev
|
|
29
|
+
npx duckhunt-runner start
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
That is the whole thing. Step by step:
|
|
33
|
+
|
|
34
|
+
| Command | What it does |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `login <base-url> [label]` | Connects the daemon to your account. Opens the browser, you paste the code back. The label distinguishes machines if you run more than one. |
|
|
37
|
+
| `repos discover [dir]` | Scans a directory for git checkouts and maps each one by its `origin` remote, so an agent can read the code behind an alarm. Add `--dry-run` to see what it would map. Only the `workspace/slug` key reaches the server. |
|
|
38
|
+
| `repos list\|add\|remove` | Manage that map by hand: `repos add <workspace/slug> <path>`. |
|
|
39
|
+
| `aws add <accountId> <profile>` | Optional. Binds an AWS account id to a profile of your local AWS CLI, so the agent can read metrics, logs and resource state for that account. |
|
|
40
|
+
| `aws list\|remove` | Manage the AWS map. |
|
|
41
|
+
| `status` | Reports this machine's kit: Claude version, which credential it will use, AWS profiles and mapped repos. Run this first when something does not work. |
|
|
42
|
+
| `start [--verbose]` | Starts the claim loop. |
|
|
43
|
+
|
|
44
|
+
Configuration lives in `~/.duckhunt-runner.json`. It holds the base URL, the OAuth credential, the
|
|
45
|
+
repo and AWS maps, and optional defaults (`model`, `maxBudgetUsd`).
|
|
46
|
+
|
|
47
|
+
### Keeping it running
|
|
48
|
+
|
|
49
|
+
`start` runs in the foreground and has to stay alive to claim runs. Use whatever your machine
|
|
50
|
+
already does for this — a `screen`/`tmux` session, a systemd user service, `launchd`:
|
|
51
|
+
|
|
52
|
+
```ini
|
|
53
|
+
# ~/.config/systemd/user/duckhunt-runner.service
|
|
54
|
+
[Unit]
|
|
55
|
+
Description=duckhunt runner
|
|
56
|
+
|
|
57
|
+
[Service]
|
|
58
|
+
ExecStart=/usr/bin/npx duckhunt-runner start
|
|
59
|
+
Restart=always
|
|
60
|
+
|
|
61
|
+
[Install]
|
|
62
|
+
WantedBy=default.target
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## How a run works
|
|
66
|
+
|
|
67
|
+
1. **A run is queued** from duckhunt: the *investigate with agent* action on an entry, the same
|
|
68
|
+
button on an alert notification, or an automation rule with that action.
|
|
69
|
+
2. **The daemon claims it** and gets a prompt, a tool profile and a short-lived MCP token scoped to
|
|
70
|
+
that single run. It launches `claude -p` in the mapped checkout (or a scratch directory when the
|
|
71
|
+
alarm has no repo).
|
|
72
|
+
3. **The agent investigates** and leaves its verdict as a work note on the entry. You get a push
|
|
73
|
+
with a one-line summary on top and can reply to it straight from the notification.
|
|
74
|
+
4. **If it needs a decision from you**, it asks and ends its turn. Your answer resumes it in the
|
|
75
|
+
*same* Claude session, so nothing it had already found is lost.
|
|
76
|
+
|
|
77
|
+
### What an agent is allowed to touch
|
|
78
|
+
|
|
79
|
+
Permission is derived from the conversation, and the server enforces it on the run's token:
|
|
80
|
+
|
|
81
|
+
| The run | Can |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Started automatically | Read only. |
|
|
84
|
+
| Born from an instruction of yours | Also write inside duckhunt (create tasks, snooze the inbox, label). |
|
|
85
|
+
| Born from a yes/no you confirmed | Also touch the outside world — the ticket, AWS. |
|
|
86
|
+
|
|
87
|
+
So an unattended run can never change anything, and anything that leaves duckhunt needs you to have
|
|
88
|
+
said yes to that specific action, spelled out with the literal command.
|
|
89
|
+
|
|
90
|
+
## Licence
|
|
91
|
+
|
|
92
|
+
Copyright © 2026 miermontoto.
|
|
93
|
+
|
|
94
|
+
Licensed under [PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/):
|
|
95
|
+
you may use, modify and share it for any noncommercial purpose, keeping this notice with any copy.
|
|
96
|
+
Commercial use needs a separate licence. See [`LICENSE`](./LICENSE).
|
package/dist/aws.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../src/aws.ts"],"names":[],"mappings":"AAcA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAoD/C"}
|
package/dist/aws.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// subcomandos `duckhunt-runner aws ...`: mapa id de cuenta aws → perfil local de la aws cli. el
|
|
2
|
+
// claim trae solo el id de cuenta (y región) de la conexión del entry; el daemon lo traduce a
|
|
3
|
+
// AWS_PROFILE/AWS_DEFAULT_REGION del proceso claude. el server nunca ve perfiles ni credenciales.
|
|
4
|
+
import { configPath, loadConfig, saveConfig } from './config.js';
|
|
5
|
+
const ACCOUNT_ID_RE = /^\d{12}$/;
|
|
6
|
+
const USAGE = `uso:
|
|
7
|
+
duckhunt-runner aws list
|
|
8
|
+
duckhunt-runner aws add <account-id> <profile> [region]
|
|
9
|
+
duckhunt-runner aws remove <account-id>
|
|
10
|
+
`;
|
|
11
|
+
export function awsCommand(args) {
|
|
12
|
+
const cfg = loadConfig();
|
|
13
|
+
if (!cfg) {
|
|
14
|
+
console.error('sin config: ejecuta `duckhunt-runner login <base-url>` primero');
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const [sub, ...rest] = args;
|
|
19
|
+
if (sub === 'list') {
|
|
20
|
+
const entries = Object.entries(cfg.aws);
|
|
21
|
+
if (entries.length === 0) {
|
|
22
|
+
console.log('sin cuentas aws mapeadas. añade con `duckhunt-runner aws add <account-id> <profile> [region]`');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
entries.forEach(([account, a]) => console.log(` ${account} → perfil ${a.profile}${a.region ? ` (${a.region})` : ''}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (sub === 'add') {
|
|
29
|
+
const [account, profile, region] = rest;
|
|
30
|
+
if (!account || !profile) {
|
|
31
|
+
console.error(USAGE);
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!ACCOUNT_ID_RE.test(account)) {
|
|
36
|
+
console.error(`id de cuenta inválido: "${account}" (12 dígitos)`);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
cfg.aws[account] = { profile, ...(region ? { region } : {}) };
|
|
41
|
+
saveConfig(cfg);
|
|
42
|
+
console.log(`mapeada la cuenta ${account} → perfil ${profile}${region ? ` (${region})` : ''} en ${configPath()}`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (sub === 'remove') {
|
|
46
|
+
const [account] = rest;
|
|
47
|
+
if (!account || !(account in cfg.aws)) {
|
|
48
|
+
console.error(account ? `cuenta no mapeada: ${account}` : USAGE);
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
delete cfg.aws[account];
|
|
53
|
+
saveConfig(cfg);
|
|
54
|
+
console.log(`eliminada la cuenta ${account}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.error(USAGE);
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=aws.js.map
|
package/dist/aws.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws.js","sourceRoot":"","sources":["../src/aws.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,8FAA8F;AAC9F,kGAAkG;AAElG,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC,MAAM,KAAK,GAAG;;;;CAIb,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,IAA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CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9D,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,aAAa,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,UAAU,EAAE,EAAE,CAAC,CAAC;QAClH,OAAO;IACT,CAAC;IAED,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxB,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
|
package/dist/claude.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const OPTIONAL_FLAGS: readonly ["--max-turns", "--max-budget-usd", "--strict-mcp-config", "--permission-mode", "--disallowedTools", "--verbose"];
|
|
2
|
+
export type OptionalFlag = (typeof OPTIONAL_FLAGS)[number];
|
|
3
|
+
export interface ClaudeInfo {
|
|
4
|
+
version: string | null;
|
|
5
|
+
supported: Set<OptionalFlag>;
|
|
6
|
+
}
|
|
7
|
+
/** `claude --version` + flags soportados según `claude --help`. version null si el cli no arranca. */
|
|
8
|
+
export declare function detectClaude(): Promise<ClaudeInfo>;
|
|
9
|
+
export interface StreamResult {
|
|
10
|
+
subtype: string | null;
|
|
11
|
+
isError: boolean;
|
|
12
|
+
result: string | null;
|
|
13
|
+
costUsd: number | null;
|
|
14
|
+
numTurns: number | null;
|
|
15
|
+
sessionId: string | null;
|
|
16
|
+
model: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface StreamState {
|
|
19
|
+
toolCalls: number;
|
|
20
|
+
sawAssistant: boolean;
|
|
21
|
+
sessionId: string | null;
|
|
22
|
+
result: StreamResult | null;
|
|
23
|
+
}
|
|
24
|
+
export declare function newStreamState(): StreamState;
|
|
25
|
+
/** consume una línea de stdout (stream-json). ignora líneas que no son json. */
|
|
26
|
+
export declare function consumeStreamLine(state: StreamState, line: string): void;
|
|
27
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../src/claude.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,cAAc,4HAA6H,CAAC;AACzJ,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;CAC9B;AAED,sGAAsG;AACtG,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CAexD;AAGD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAGlB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAkBD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA2BxE"}
|
package/dist/claude.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// integración con el cli de claude code: detección de flags soportados (el cli cambia entre
|
|
2
|
+
// versiones; los flags opcionales se pasan solo si `claude --help` los lista) y parseo del
|
|
3
|
+
// stream-json de un run headless (contadores de tool calls, objeto result final).
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
const execFileP = promisify(execFile);
|
|
7
|
+
// flags que el daemon quiere pasar pero que no todas las versiones del cli aceptan; un flag
|
|
8
|
+
// desconocido aborta el proceso, así que se detectan una vez por arranque.
|
|
9
|
+
export const OPTIONAL_FLAGS = ['--max-turns', '--max-budget-usd', '--strict-mcp-config', '--permission-mode', '--disallowedTools', '--verbose'];
|
|
10
|
+
/** `claude --version` + flags soportados según `claude --help`. version null si el cli no arranca. */
|
|
11
|
+
export async function detectClaude() {
|
|
12
|
+
const supported = new Set();
|
|
13
|
+
let version = null;
|
|
14
|
+
try {
|
|
15
|
+
version = (await execFileP('claude', ['--version'], { encoding: 'utf-8' })).stdout.trim() || null;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return { version: null, supported };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const help = (await execFileP('claude', ['--help'], { encoding: 'utf-8', maxBuffer: 4 * 1024 * 1024 })).stdout;
|
|
22
|
+
OPTIONAL_FLAGS.filter((f) => help.includes(f)).forEach((f) => supported.add(f));
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.error(`[runner] claude --help falló (se asumen flags mínimos): ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
return { version, supported };
|
|
28
|
+
}
|
|
29
|
+
export function newStreamState() {
|
|
30
|
+
return { toolCalls: 0, sawAssistant: false, sessionId: null, result: null };
|
|
31
|
+
}
|
|
32
|
+
function num(v) {
|
|
33
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : null;
|
|
34
|
+
}
|
|
35
|
+
/** consume una línea de stdout (stream-json). ignora líneas que no son json. */
|
|
36
|
+
export function consumeStreamLine(state, line) {
|
|
37
|
+
if (!line.startsWith('{'))
|
|
38
|
+
return;
|
|
39
|
+
let ev;
|
|
40
|
+
try {
|
|
41
|
+
ev = JSON.parse(line);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (typeof ev.session_id === 'string' && ev.session_id)
|
|
47
|
+
state.sessionId = ev.session_id;
|
|
48
|
+
if (ev.type === 'assistant') {
|
|
49
|
+
state.sawAssistant = true;
|
|
50
|
+
const content = ev.message?.content;
|
|
51
|
+
if (Array.isArray(content))
|
|
52
|
+
state.toolCalls += content.filter((c) => c?.type === 'tool_use').length;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (ev.type === 'result') {
|
|
56
|
+
const models = ev.modelUsage ? Object.keys(ev.modelUsage) : [];
|
|
57
|
+
state.result = {
|
|
58
|
+
subtype: ev.subtype ?? null,
|
|
59
|
+
isError: ev.is_error === true,
|
|
60
|
+
result: typeof ev.result === 'string' ? ev.result : null,
|
|
61
|
+
costUsd: num(ev.total_cost_usd),
|
|
62
|
+
numTurns: num(ev.num_turns),
|
|
63
|
+
sessionId: typeof ev.session_id === 'string' ? ev.session_id : state.sessionId,
|
|
64
|
+
model: models[0] ?? null,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../src/claude.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2FAA2F;AAC3F,kFAAkF;AAElF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEtC,4FAA4F;AAC5F,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,CAAU,CAAC;AAQzJ,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgB,CAAC;IAC1C,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IACpG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG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
|
|
5
|
+
}
|
|
6
|
+
export interface AwsAccountConfig {
|
|
7
|
+
profile: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RunnerDefaults {
|
|
11
|
+
model?: string;
|
|
12
|
+
maxConcurrent?: number;
|
|
13
|
+
maxBudgetUsd?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RunnerConfig {
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
refreshToken: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
repos: Record<string, RepoConfig>;
|
|
21
|
+
aws: Record<string, AwsAccountConfig>;
|
|
22
|
+
defaults: RunnerDefaults;
|
|
23
|
+
}
|
|
24
|
+
export declare function configPath(): string;
|
|
25
|
+
/** directorio de estado del daemon (scratch + logs). */
|
|
26
|
+
export declare function runnerHome(): string;
|
|
27
|
+
/** cwd FIJO de los runs sin repo: la auto-memory de claude code se indexa por ruta, así el
|
|
28
|
+
* conocimiento de infra (alarmas sin código) acumula entre runs. */
|
|
29
|
+
export declare function scratchDir(): string;
|
|
30
|
+
export declare function logsDir(): string;
|
|
31
|
+
/** carga la config; null si no existe (login pendiente). lanza si el json es inválido. */
|
|
32
|
+
export declare function loadConfig(): RunnerConfig | null;
|
|
33
|
+
/** persiste la config con permisos 600 (contiene el refresh token). */
|
|
34
|
+
export declare function saveConfig(cfg: RunnerConfig): void;
|
|
35
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,UAAU;IAEzB,IAAI,EAAE,MAAM,CAAC;IAEb,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAE/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAE7B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,aAAa,CAAC,EAAE,MAAM,CAAC;IAIvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAElC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtC,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wDAAwD;AACxD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;qEACqE;AACrE,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAED,wBAAgB,OAAO,IAAI,MAAM,CAIhC;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,IAAI,YAAY,GAAG,IAAI,CAuBhD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAGlD"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// config del daemon (~/.duckhunt-runner.json): credencial oauth + mapa repo→path local + mapa
|
|
2
|
+
// cuenta aws→perfil local + defaults. el server jamás ve estos paths ni perfiles — la resolución
|
|
3
|
+
// repo→checkout y cuenta→perfil vive SOLO aquí. ~/.duckhunt-runner/ guarda el scratch dir (runs
|
|
4
|
+
// sin repo, donde claude code acumula memoria) y los logs opcionales.
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
export function configPath() {
|
|
9
|
+
return process.env.DUCKHUNT_RUNNER_CONFIG ?? path.join(os.homedir(), '.duckhunt-runner.json');
|
|
10
|
+
}
|
|
11
|
+
/** directorio de estado del daemon (scratch + logs). */
|
|
12
|
+
export function runnerHome() {
|
|
13
|
+
return process.env.DUCKHUNT_RUNNER_HOME ?? path.join(os.homedir(), '.duckhunt-runner');
|
|
14
|
+
}
|
|
15
|
+
/** cwd FIJO de los runs sin repo: la auto-memory de claude code se indexa por ruta, así el
|
|
16
|
+
* conocimiento de infra (alarmas sin código) acumula entre runs. */
|
|
17
|
+
export function scratchDir() {
|
|
18
|
+
const dir = path.join(runnerHome(), 'scratch');
|
|
19
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
20
|
+
return dir;
|
|
21
|
+
}
|
|
22
|
+
export function logsDir() {
|
|
23
|
+
const dir = path.join(runnerHome(), 'logs');
|
|
24
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
25
|
+
return dir;
|
|
26
|
+
}
|
|
27
|
+
/** carga la config; null si no existe (login pendiente). lanza si el json es inválido. */
|
|
28
|
+
export function loadConfig() {
|
|
29
|
+
const file = configPath();
|
|
30
|
+
if (!fs.existsSync(file))
|
|
31
|
+
return null;
|
|
32
|
+
const raw = fs.readFileSync(file, 'utf-8');
|
|
33
|
+
let parsed;
|
|
34
|
+
try {
|
|
35
|
+
parsed = JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
throw new Error(`config inválida en ${file}: ${err.message}`);
|
|
39
|
+
}
|
|
40
|
+
const cfg = parsed;
|
|
41
|
+
if (!cfg.baseUrl || !cfg.clientId || !cfg.refreshToken) {
|
|
42
|
+
throw new Error(`config incompleta en ${file}: ejecuta \`duckhunt-runner login <base-url>\``);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
baseUrl: cfg.baseUrl,
|
|
46
|
+
clientId: cfg.clientId,
|
|
47
|
+
refreshToken: cfg.refreshToken,
|
|
48
|
+
label: cfg.label,
|
|
49
|
+
repos: cfg.repos ?? {},
|
|
50
|
+
aws: cfg.aws ?? {},
|
|
51
|
+
defaults: cfg.defaults ?? {},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** persiste la config con permisos 600 (contiene el refresh token). */
|
|
55
|
+
export function saveConfig(cfg) {
|
|
56
|
+
const file = configPath();
|
|
57
|
+
fs.writeFileSync(file, `${JSON.stringify(cfg, null, 2)}\n`, { mode: 0o600 });
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iGAAiG;AACjG,gGAAgG;AAChG,sEAAsE;AAEtE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAyC7B,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,uBAAuB,CAAC,CAAC;AAChG,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACzF,CAAC;AAED;qEACqE;AACrE,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,SAAS,CAAC,CAAC;IAC/C,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5C,EAAE,CAAC,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AC1B,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/daemon.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type RunnerConfig } from './config.js';
|
|
2
|
+
export interface DaemonOptions {
|
|
3
|
+
verboseLog?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class RunnerDaemon {
|
|
6
|
+
private readonly cfg;
|
|
7
|
+
private readonly opts;
|
|
8
|
+
private access;
|
|
9
|
+
private claude;
|
|
10
|
+
private hasAws;
|
|
11
|
+
constructor(cfg: RunnerConfig, opts?: DaemonOptions);
|
|
12
|
+
private accessToken;
|
|
13
|
+
private api;
|
|
14
|
+
private label;
|
|
15
|
+
/** loop principal: claim → ejecutar → repetir. nunca retorna (ctrl-c para salir). */
|
|
16
|
+
run(): Promise<never>;
|
|
17
|
+
private prepareWorkdir;
|
|
18
|
+
private removeWorktree;
|
|
19
|
+
private envFor;
|
|
20
|
+
private claudeArgs;
|
|
21
|
+
private executeRun;
|
|
22
|
+
private reportFor;
|
|
23
|
+
private spawnClaude;
|
|
24
|
+
private postStatus;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=daemon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"AAcA,OAAO,EAAwC,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAoEtF,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,YAAY;IAMrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IANvB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,MAAM,CAAuD;IACrE,OAAO,CAAC,MAAM,CAAS;gBAGJ,GAAG,EAAE,YAAY,EACjB,IAAI,GAAE,aAAkB;YAG7B,WAAW;YAQX,GAAG;IAgBjB,OAAO,CAAC,KAAK;IAIb,qFAAqF;IAC/E,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;YAqCb,cAAc;YA2Bd,cAAc;IAQ5B,OAAO,CAAC,MAAM;IAed,OAAO,CAAC,UAAU;YAwBJ,UAAU;IAuDxB,OAAO,CAAC,SAAS;IA0BjB,OAAO,CAAC,WAAW;YAyFL,UAAU;CAUzB"}
|