@gracefultools/astrid-sdk 0.8.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -127
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +41 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +361 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +89 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +216 -0
- package/dist/client.js.map +1 -0
- package/dist/config/api-base.d.ts +21 -0
- package/dist/config/api-base.d.ts.map +1 -0
- package/dist/config/api-base.js +41 -0
- package/dist/config/api-base.js.map +1 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -57
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/verdict.d.ts +88 -0
- package/dist/verdict.d.ts.map +1 -0
- package/dist/verdict.js +90 -0
- package/dist/verdict.js.map +1 -0
- package/package.json +56 -65
- package/dist/adapters/astrid-oauth.d.ts +0 -114
- package/dist/adapters/astrid-oauth.d.ts.map +0 -1
- package/dist/adapters/astrid-oauth.js +0 -287
- package/dist/adapters/astrid-oauth.js.map +0 -1
- package/dist/channel/channel.d.ts +0 -33
- package/dist/channel/channel.d.ts.map +0 -1
- package/dist/channel/channel.js +0 -90
- package/dist/channel/channel.js.map +0 -1
- package/dist/channel/index.d.ts +0 -13
- package/dist/channel/index.d.ts.map +0 -1
- package/dist/channel/index.js +0 -23
- package/dist/channel/index.js.map +0 -1
- package/dist/channel/message-formatter.d.ts +0 -14
- package/dist/channel/message-formatter.d.ts.map +0 -1
- package/dist/channel/message-formatter.js +0 -71
- package/dist/channel/message-formatter.js.map +0 -1
- package/dist/channel/oauth-client.d.ts +0 -15
- package/dist/channel/oauth-client.d.ts.map +0 -1
- package/dist/channel/oauth-client.js +0 -45
- package/dist/channel/oauth-client.js.map +0 -1
- package/dist/channel/rest-client.d.ts +0 -16
- package/dist/channel/rest-client.d.ts.map +0 -1
- package/dist/channel/rest-client.js +0 -66
- package/dist/channel/rest-client.js.map +0 -1
- package/dist/channel/session-mapper.d.ts +0 -14
- package/dist/channel/session-mapper.d.ts.map +0 -1
- package/dist/channel/session-mapper.js +0 -37
- package/dist/channel/session-mapper.js.map +0 -1
- package/dist/channel/sse-client.d.ts +0 -33
- package/dist/channel/sse-client.d.ts.map +0 -1
- package/dist/channel/sse-client.js +0 -204
- package/dist/channel/sse-client.js.map +0 -1
- package/dist/channel/types.d.ts +0 -65
- package/dist/channel/types.d.ts.map +0 -1
- package/dist/channel/types.js +0 -3
- package/dist/channel/types.js.map +0 -1
- package/dist/config/agent-workflow.d.ts +0 -78
- package/dist/config/agent-workflow.d.ts.map +0 -1
- package/dist/config/agent-workflow.js +0 -217
- package/dist/config/agent-workflow.js.map +0 -1
- package/dist/config/index.d.ts +0 -194
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -284
- package/dist/config/index.js.map +0 -1
- package/dist/deploy/vercel.d.ts +0 -27
- package/dist/deploy/vercel.d.ts.map +0 -1
- package/dist/deploy/vercel.js +0 -268
- package/dist/deploy/vercel.js.map +0 -1
- package/dist/types/index.d.ts +0 -157
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
- package/dist/utils/agent-config.d.ts +0 -56
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/agent-config.js +0 -138
- package/dist/utils/agent-config.js.map +0 -1
- package/templates/.astrid.config.json +0 -60
- package/templates/ASTRID.template.md +0 -74
package/README.md
CHANGED
|
@@ -1,127 +1,173 @@
|
|
|
1
|
-
# @gracefultools/astrid-sdk
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
1
|
+
# @gracefultools/astrid-sdk
|
|
2
|
+
|
|
3
|
+
The Astrid agent runner: the `astrid-agent` command that a scheduler or a CI job
|
|
4
|
+
runs to check for work, claim it and give it back, plus the typed REST client
|
|
5
|
+
that command is built on.
|
|
6
|
+
|
|
7
|
+
It is **not** a library for building agents. Your agent is whatever harness you
|
|
8
|
+
already run (Claude Code, Copilot CLI, Codex, your own service). This package
|
|
9
|
+
answers three questions around it: is there work, is it mine, and what happens
|
|
10
|
+
if the run dies.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @gracefultools/astrid-sdk # puts astrid-agent on PATH
|
|
16
|
+
# or, in a CI step:
|
|
17
|
+
npx -p @gracefultools/astrid-sdk astrid-agent queue --agent claude
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Node 18 or later.
|
|
21
|
+
|
|
22
|
+
## Credentials
|
|
23
|
+
|
|
24
|
+
Read from the environment and never printed:
|
|
25
|
+
|
|
26
|
+
| Variable | Meaning |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `ASTRID_TOKEN` | An agent-bound token (`astrid_mcp_…` or an agent consent token), sent as `Authorization: Bearer`. Preferred. Writes are signed as that agent, and the claim route knows which agent is claiming. |
|
|
29
|
+
| `ASTRID_CLIENT_ID`, `ASTRID_CLIENT_SECRET` | OAuth client credentials, exchanged for a one-hour token and sent as `X-OAuth-Token`. `ASTRID_OAUTH_CLIENT_ID` and `ASTRID_OAUTH_CLIENT_SECRET` work too. |
|
|
30
|
+
| `ASTRID_API_URL` | Server origin. Default `https://www.astrid.cc`. `--origin` overrides it. |
|
|
31
|
+
|
|
32
|
+
## The command
|
|
33
|
+
|
|
34
|
+
Exit codes are the interface, so a shell `if` or a workflow `if:` can branch on them.
|
|
35
|
+
|
|
36
|
+
### `astrid-agent queue`
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
astrid-agent queue --agent <mailbox> [--list <listId>] [--include-unassigned] \
|
|
40
|
+
[--seen <file> [--write-seen]]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Reads `GET /api/v1/agent-queue` and decides whether a run should start.
|
|
44
|
+
|
|
45
|
+
| Exit | Meaning |
|
|
46
|
+
|---|---|
|
|
47
|
+
| 0 | There is work: a Ready task, or a reply nobody has answered that this runner has not already woken for. Start a run. |
|
|
48
|
+
| 3 | Nothing to do. Skip this tick. |
|
|
49
|
+
| 1 | Could not tell (network, auth, server error). **Never treat this as idle.** |
|
|
50
|
+
|
|
51
|
+
stdout is one JSON document (`work`, `reason`, `summary`, `wakeKeys`, `snapshot`),
|
|
52
|
+
so you can pipe it to `jq`. The one-line `QUEUE:` summary goes to stderr.
|
|
53
|
+
|
|
54
|
+
Waking is bounded. `--seen <file>` holds the reply keys that have already woken
|
|
55
|
+
a run, and a key in that file does not wake another. `--write-seen` saves the
|
|
56
|
+
current keys after the decision. Ready tasks are never muted this way: a Ready
|
|
57
|
+
task stays work until someone moves it.
|
|
58
|
+
|
|
59
|
+
### `astrid-agent claim <taskId>`
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
astrid-agent claim <taskId> [--agent <mailbox>] [--resume] [--lease-seconds <n>]
|
|
63
|
+
astrid-agent claim <taskId> --fixall [--agent <mailbox>] [--list <listId>]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
An atomic claim through `POST /api/v1/tasks/:id/claim`
|
|
67
|
+
([contract](https://github.com/Graceful-Tools/astrid-web/blob/main/docs/AGENT_CLAIM_API.md)),
|
|
68
|
+
on any board. The claim holds a lease (15 minutes, or `--lease-seconds` from 60
|
|
69
|
+
to 3600): run `astrid-agent heartbeat` while you work, or the task returns to
|
|
70
|
+
Ready. With client credentials, `--agent` names the agent you claim for.
|
|
71
|
+
`--resume` checks that a Doing claim still belongs to you after a restart.
|
|
72
|
+
`--fixall` claims through `/claim-fixall` instead: that route serves Astrid's
|
|
73
|
+
own scheduled loops on its allowlisted boards and accepts client credentials.
|
|
74
|
+
If `ASTRID_FIXALL_CLAIMS_FILE` is set, each claimed id is appended to it, so the
|
|
75
|
+
runner can release leftover claims after the run.
|
|
76
|
+
|
|
77
|
+
| Exit | Meaning |
|
|
78
|
+
|---|---|
|
|
79
|
+
| 0 | Claimed (or, with `--resume`, still yours). Start the task. |
|
|
80
|
+
| 2 | Another worker has it, or it is no longer Ready. Move on to the next task. |
|
|
81
|
+
| 1 | Error, including a server too old to have the claim API. |
|
|
82
|
+
|
|
83
|
+
A claim that answers `already_yours` exits 2: another worker on the same mailbox
|
|
84
|
+
holds the task.
|
|
85
|
+
|
|
86
|
+
### `astrid-agent heartbeat <taskId>`
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
astrid-agent heartbeat <taskId> [--agent <mailbox>] [--lease-seconds <n>]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Renews your claim lease. Send it every few minutes while working. Exit 0
|
|
93
|
+
renewed; 2 the claim is gone (the lease expired and the task went back to
|
|
94
|
+
Ready, or someone else holds it), so stop work; 1 error.
|
|
95
|
+
|
|
96
|
+
### `astrid-agent release <taskId>`
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
astrid-agent release <taskId> [--agent <mailbox>] [--comment <text>]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Gives a Doing claim back: the task returns to Ready and this agent is
|
|
103
|
+
unassigned. `--comment` posts the reason first. Exit 0 released, 2 not your
|
|
104
|
+
Doing claim, 1 error.
|
|
105
|
+
|
|
106
|
+
### Example: a GitHub Actions gate
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
- name: Is there work?
|
|
110
|
+
id: queue
|
|
111
|
+
env:
|
|
112
|
+
ASTRID_TOKEN: ${{ secrets.ASTRID_CLAUDE_MCP_TOKEN }}
|
|
113
|
+
run: |
|
|
114
|
+
set +e
|
|
115
|
+
npx -y -p @gracefultools/astrid-sdk@1 astrid-agent queue --agent claude > queue.json
|
|
116
|
+
code=$?
|
|
117
|
+
case $code in
|
|
118
|
+
0) echo "has-work=true" >> "$GITHUB_OUTPUT" ;;
|
|
119
|
+
3) echo "has-work=false" >> "$GITHUB_OUTPUT" ;;
|
|
120
|
+
*) exit 1 ;; # could not tell: fail loudly, never skip silently
|
|
121
|
+
esac
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## The client
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { AstridClient } from '@gracefultools/astrid-sdk'
|
|
128
|
+
|
|
129
|
+
const astrid = new AstridClient({ auth: { token: process.env.ASTRID_TOKEN! } })
|
|
130
|
+
|
|
131
|
+
const snapshot = await astrid.getQueue({ agent: 'claude', listId })
|
|
132
|
+
for (const task of snapshot.queue) {
|
|
133
|
+
const claim = await astrid.claimTask(task.id, { action: 'claim' })
|
|
134
|
+
if (claim.outcome !== 'claimed') continue
|
|
135
|
+
// ...run your harness...
|
|
136
|
+
await astrid.addComment(task.id, 'Done: ...')
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| Method | Endpoint |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `getQueue({ agent, listId?, includeUnassigned? })` | `GET /api/v1/agent-queue` |
|
|
143
|
+
| `claimTask(id, { action, agentMailbox?, leaseSeconds? })` | `POST /api/v1/tasks/:id/claim`. Returns every documented outcome; `outcome: 'unavailable'` when the route is absent. |
|
|
144
|
+
| `heartbeatTask(id, { agentMailbox?, leaseSeconds? })` | the same route, `action: 'heartbeat'`; `outcome: 'renewed'` means keep going |
|
|
145
|
+
| `releaseTask(id, agentMailbox?)` | the same route, `action: 'release'` |
|
|
146
|
+
| `claimFixallTask(id, { action, agent?, listId?, commentWatermark? })` | `POST /api/v1/tasks/:id/claim-fixall` |
|
|
147
|
+
| `getTask(id)`, `getComments(id)` | `GET /api/v1/tasks/:id`, `…/comments` |
|
|
148
|
+
| `addComment(id, content, { aiAgentId? })` | `POST /api/v1/tasks/:id/comments` |
|
|
149
|
+
| `setStatus(id, statusRole)` | `PUT /api/v1/tasks/:id` |
|
|
150
|
+
| `handBack(id, personId)` | `PUT /api/v1/tasks/:id` with `{ statusRole: null, assigneeId }`: back to that person's Inbox |
|
|
151
|
+
|
|
152
|
+
A refused request throws `AstridApiError`, with `status` and the server's reason.
|
|
153
|
+
`decideQueueVerdict` and `wakeKeys` are exported too: they hold the wake rule
|
|
154
|
+
that `astrid-agent queue` applies.
|
|
155
|
+
|
|
156
|
+
## Upgrading from 0.x
|
|
157
|
+
|
|
158
|
+
1.0.0 removes the library half of the package:
|
|
159
|
+
|
|
160
|
+
| Removed | Replacement |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `AstridChannel`, `SSEClient`, `ChannelRestClient`, `ChannelOAuthClient`, `SessionMapper`, message formatters | Moved to `@gracefultools/openclaw-astrid-channel`, which was their only user. |
|
|
163
|
+
| `AstridOAuthClient` | `AstridClient`. Its `claimTask` returns `{ status, outcome, task }`. |
|
|
164
|
+
| `deployToVercel`, `isVercelConfigured` | None. Deploy with your own tooling. |
|
|
165
|
+
| `loadAstridConfig`, `getAgentWorkflowConfig`, `.astrid.config.json` templates, platform detection | None. These belonged to the removed built-in executors. |
|
|
166
|
+
| `AI_AGENT_CONFIG`, `getAgentModel` and the agent registry | None. Ask the server (`/api/v1/users/me/available-agents`). |
|
|
167
|
+
| Executor types (`CodeGenerationRequest`, `ImplementationPlan`, …) | None. |
|
|
168
|
+
|
|
169
|
+
0.8.x stays on npm for anyone who still needs it (`npm install @gracefultools/astrid-sdk@0.8`).
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const cli_js_1 = require("./cli.js");
|
|
5
|
+
(0, cli_js_1.runCli)(process.argv.slice(2), {
|
|
6
|
+
env: process.env,
|
|
7
|
+
stdout: line => process.stdout.write(`${line}\n`),
|
|
8
|
+
stderr: line => process.stderr.write(`${line}\n`),
|
|
9
|
+
}).then(code => { process.exitCode = code; }, error => {
|
|
10
|
+
process.stderr.write(`astrid-agent: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
11
|
+
process.exitCode = 1;
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,qCAAiC;AAEjC,IAAA,eAAM,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC5B,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;IACjD,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;CAClD,CAAC,CAAC,IAAI,CACL,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA,CAAC,CAAC,EACnC,KAAK,CAAC,EAAE;IACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACjG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC,CACF,CAAA"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `astrid-agent`: the runner command a scheduler or a GitHub Actions job calls.
|
|
3
|
+
* Its exit codes are the interface:
|
|
4
|
+
*
|
|
5
|
+
* queue 0 there is work, start a run
|
|
6
|
+
* 3 nothing to do, skip this tick
|
|
7
|
+
* 1 could not tell (network, auth); never treat this as idle
|
|
8
|
+
* claim 0 claimed, start the task
|
|
9
|
+
* heartbeat 0 lease renewed, keep working
|
|
10
|
+
* release 0 released
|
|
11
|
+
* 2 someone else has it, or it is no longer eligible; move on
|
|
12
|
+
* 1 error
|
|
13
|
+
*
|
|
14
|
+
* These match astrid-web's scripts/agent-queue-status.ts and
|
|
15
|
+
* scripts/claim-fixall-task.ts, which this command is meant to replace.
|
|
16
|
+
*
|
|
17
|
+
* Credentials come from the environment and are never printed:
|
|
18
|
+
* ASTRID_TOKEN an agent-bound token (preferred)
|
|
19
|
+
* ASTRID_CLIENT_ID + ASTRID_CLIENT_SECRET client credentials
|
|
20
|
+
* (ASTRID_OAUTH_CLIENT_ID / ASTRID_OAUTH_CLIENT_SECRET are accepted too)
|
|
21
|
+
* ASTRID_API_URL the server origin
|
|
22
|
+
*/
|
|
23
|
+
export declare const EXIT: {
|
|
24
|
+
/** Work to do / the write succeeded. */
|
|
25
|
+
readonly WORK: 0;
|
|
26
|
+
readonly ERROR: 1;
|
|
27
|
+
/** Claim or release refused: another worker has it, or it is not eligible. */
|
|
28
|
+
readonly CONFLICT: 2;
|
|
29
|
+
/** The queue is idle. */
|
|
30
|
+
readonly IDLE: 3;
|
|
31
|
+
};
|
|
32
|
+
export interface CliIO {
|
|
33
|
+
env: Record<string, string | undefined>;
|
|
34
|
+
fetch?: typeof fetch;
|
|
35
|
+
stdout: (line: string) => void;
|
|
36
|
+
stderr: (line: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare const USAGE = "Usage: astrid-agent <command> [options]\n\nCommands:\n queue --agent <mailbox> [--list <listId>] [--include-unassigned]\n [--seen <file> [--write-seen]] [--require-polling]\n Print the queue verdict as JSON. Exit 0 work, 3 idle, 1 could not tell.\n --require-polling exits 1 unless the agent is in polling mode.\n claim <taskId> [--agent <mailbox>] [--resume] [--lease-seconds <n>]\n Atomic claim (POST /api/v1/tasks/:id/claim). Exit 0 claimed, 2 taken, 1 error.\n The claim holds a lease (15 min by default): heartbeat while you work.\n heartbeat <taskId> [--agent <mailbox>] [--lease-seconds <n>]\n Renew the claim lease. Exit 0 renewed, 2 the claim is gone (stop), 1 error.\n claim <taskId> --fixall [--agent <mailbox>] [--list <listId>]\n Claim through /claim-fixall (Astrid's allowlisted boards).\n claim <taskId> --fixall --resume --watermark <commentId>\n [--resume-context <json> | --resume-context-file <path>] [--agent <mailbox>] [--list <listId>]\n Answer a human reply to your own handback.\n release <taskId> [--agent <mailbox>] [--comment <text>]\n Give a Doing claim back to Ready. Exit 0 released, 2 not yours, 1 error.\n\nOptions:\n --origin <url> Server origin (default: ASTRID_API_URL, then production)\n -h, --help Show this help\n -v, --version Show the version\n\nEnvironment:\n ASTRID_TOKEN, or ASTRID_CLIENT_ID and ASTRID_CLIENT_SECRET";
|
|
39
|
+
/** Runs one command and resolves to its exit code. Never calls process.exit. */
|
|
40
|
+
export declare function runCli(argv: string[], io: CliIO): Promise<number>;
|
|
41
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH,eAAO,MAAM,IAAI;IACf,wCAAwC;;;IAGxC,8EAA8E;;IAE9E,yBAAyB;;CAEjB,CAAA;AAEV,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAED,eAAO,MAAM,KAAK,09CA0B2C,CAAA;AA0P7D,gFAAgF;AAChF,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCvE"}
|