superagent-skill 0.5.1 → 0.5.2
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 +2 -2
- package/lib/cli.mjs +35 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,8 +154,8 @@ pnpm install && pnpm build
|
|
|
154
154
|
ln -sf "$PWD/bin/superagent.js" ~/.local/bin/superagent # a directory on PATH
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
Start the loop from that directory: `superagent poll` keeps running, and `superagent poll --once` runs one round,
|
|
158
|
-
is what a cron entry calls each minute.
|
|
157
|
+
Start the loop from that directory: `superagent poll` keeps running, and `superagent poll . --once` runs one round,
|
|
158
|
+
waits for the turns it started, posts their reports, and exits — which is what a cron entry calls each minute.
|
|
159
159
|
|
|
160
160
|
`checkout` names the repository the tickets change, and `executor.agent` names the coding agent. The Sources are
|
|
161
161
|
optional, but at least one must be on; `github` and `gitlab` cannot both be, because one installation serves one forge.
|
package/lib/cli.mjs
CHANGED
|
@@ -2261,6 +2261,17 @@ var AgentExecutor = class {
|
|
|
2261
2261
|
}
|
|
2262
2262
|
});
|
|
2263
2263
|
}
|
|
2264
|
+
/** Resolves when no turn runs and none waits for a slot, which a one-round process waits on before it exits. */
|
|
2265
|
+
idle() {
|
|
2266
|
+
if (!this.active.size && !this.pending.length) return Promise.resolve();
|
|
2267
|
+
return new Promise((resolve) => {
|
|
2268
|
+
const timer = setInterval(() => {
|
|
2269
|
+
if (this.active.size || this.pending.length) return;
|
|
2270
|
+
clearInterval(timer);
|
|
2271
|
+
resolve();
|
|
2272
|
+
}, 50);
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2264
2275
|
async execute(ticket, assignment, controller) {
|
|
2265
2276
|
const { settings, runner, stateDir, accounts, site, repo, log } = this.options;
|
|
2266
2277
|
const directory = ticket.execution?.directory ?? join(stateDir, "work", ticket.id);
|
|
@@ -2495,6 +2506,18 @@ async function runLoop(options) {
|
|
|
2495
2506
|
await writeEnvironment(accounts, settings.executor.blockedCommands);
|
|
2496
2507
|
const standing = await standingRules();
|
|
2497
2508
|
const channel = outbox(repo);
|
|
2509
|
+
const destinations = {
|
|
2510
|
+
...github ? { github: github.cli } : {},
|
|
2511
|
+
...gitlab ? { gitlab: {
|
|
2512
|
+
cli: gitlab.cli,
|
|
2513
|
+
host: gitlab.host
|
|
2514
|
+
} } : {},
|
|
2515
|
+
...feishu ? { feishu: feishu.cli } : {},
|
|
2516
|
+
...twitter ? { twitter: twitter.cli } : {}
|
|
2517
|
+
};
|
|
2518
|
+
const markSent = (id) => {
|
|
2519
|
+
repo.setMeta(`outbox:${id}`, true);
|
|
2520
|
+
};
|
|
2498
2521
|
const scope = sourceScope(settings);
|
|
2499
2522
|
const decided = new WorkQueue();
|
|
2500
2523
|
const finished = new WorkQueue();
|
|
@@ -2819,15 +2842,7 @@ async function runLoop(options) {
|
|
|
2819
2842
|
inRound.clear();
|
|
2820
2843
|
deliver(engine, repo, delivered, log);
|
|
2821
2844
|
await repo.flush();
|
|
2822
|
-
await send(channel,
|
|
2823
|
-
...github ? { github: github.cli } : {},
|
|
2824
|
-
...gitlab ? { gitlab: {
|
|
2825
|
-
cli: gitlab.cli,
|
|
2826
|
-
host: gitlab.host
|
|
2827
|
-
} } : {},
|
|
2828
|
-
...feishu ? { feishu: feishu.cli } : {},
|
|
2829
|
-
...twitter ? { twitter: twitter.cli } : {}
|
|
2830
|
-
}, log, settings.attention, (id) => repo.setMeta(`outbox:${id}`, true));
|
|
2845
|
+
await send(channel, destinations, log, settings.attention, markSent);
|
|
2831
2846
|
await repo.flush();
|
|
2832
2847
|
await sync();
|
|
2833
2848
|
} catch (error) {
|
|
@@ -2844,6 +2859,13 @@ async function runLoop(options) {
|
|
|
2844
2859
|
left -= Date.now() - began;
|
|
2845
2860
|
}
|
|
2846
2861
|
}
|
|
2862
|
+
if (options.once && options.finish) {
|
|
2863
|
+
await executor.idle();
|
|
2864
|
+
deliver(engine, repo, delivered, log);
|
|
2865
|
+
await repo.flush();
|
|
2866
|
+
await send(channel, destinations, log, settings.attention, markSent);
|
|
2867
|
+
await repo.flush();
|
|
2868
|
+
}
|
|
2847
2869
|
stop.abort();
|
|
2848
2870
|
if (options.once && !process.env.VITEST) setImmediate(() => process.exit(process.exitCode ?? 0));
|
|
2849
2871
|
}
|
|
@@ -3424,7 +3446,10 @@ async function poll(dir, once) {
|
|
|
3424
3446
|
repo,
|
|
3425
3447
|
signal: controller.signal,
|
|
3426
3448
|
log,
|
|
3427
|
-
...once ? {
|
|
3449
|
+
...once ? {
|
|
3450
|
+
once: true,
|
|
3451
|
+
finish: true
|
|
3452
|
+
} : {}
|
|
3428
3453
|
});
|
|
3429
3454
|
return 0;
|
|
3430
3455
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superagent-skill",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A headless, file-backed agent that turns requests from GitHub issues, Feishu chats, or Twitter mentions into tickets and runs each ticket on a configurable coding agent: Claude Code, Codex or opencode.",
|
|
6
6
|
"bin": {
|