@bakers-build/addon-herdr-core 0.8.1-next.1 → 0.8.1-next.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/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +17 -9
- package/package.json +5 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export declare class HerdrCoreExecutor implements BbExecutor {
|
|
|
48
48
|
* leave an agent running.
|
|
49
49
|
*/
|
|
50
50
|
cleanupRun(branch: string, runId: number): Promise<void>;
|
|
51
|
+
/** Whether a terminal of the run still lives; an `hc` failure throws. */
|
|
52
|
+
runAlive(branch: string, runId: number): Promise<boolean>;
|
|
53
|
+
/** The run's terminals, found by its branch and run labels, finished ones included. */
|
|
54
|
+
private runTerminals;
|
|
51
55
|
/** `hc kill` (when live) then `hc rm`; each step best-effort. */
|
|
52
56
|
private drop;
|
|
53
57
|
private commandFor;
|
package/dist/src/index.js
CHANGED
|
@@ -145,15 +145,7 @@ export class HerdrCoreExecutor {
|
|
|
145
145
|
*/
|
|
146
146
|
async cleanupRun(branch, runId) {
|
|
147
147
|
try {
|
|
148
|
-
const terminals =
|
|
149
|
-
'ls',
|
|
150
|
-
'--all',
|
|
151
|
-
'--label',
|
|
152
|
-
`bakers.branch=${branch}`,
|
|
153
|
-
'--label',
|
|
154
|
-
`bakers.run=${runId}`,
|
|
155
|
-
'--json',
|
|
156
|
-
]));
|
|
148
|
+
const terminals = await this.runTerminals(branch, runId);
|
|
157
149
|
if (terminals.length === 0) {
|
|
158
150
|
this.logger.warn({ branch, runId }, 'no herdr-core terminal found for this run; its agent may still be running');
|
|
159
151
|
return;
|
|
@@ -165,6 +157,22 @@ export class HerdrCoreExecutor {
|
|
|
165
157
|
this.logger.warn({ branch, runId, err: String(err) }, 'herdr-core cleanup failed (best-effort)');
|
|
166
158
|
}
|
|
167
159
|
}
|
|
160
|
+
/** Whether a terminal of the run still lives; an `hc` failure throws. */
|
|
161
|
+
async runAlive(branch, runId) {
|
|
162
|
+
return (await this.runTerminals(branch, runId)).some((t) => t.live);
|
|
163
|
+
}
|
|
164
|
+
/** The run's terminals, found by its branch and run labels, finished ones included. */
|
|
165
|
+
async runTerminals(branch, runId) {
|
|
166
|
+
return parseTerminals(await this.hc([
|
|
167
|
+
'ls',
|
|
168
|
+
'--all',
|
|
169
|
+
'--label',
|
|
170
|
+
`bakers.branch=${branch}`,
|
|
171
|
+
'--label',
|
|
172
|
+
`bakers.run=${runId}`,
|
|
173
|
+
'--json',
|
|
174
|
+
]));
|
|
175
|
+
}
|
|
168
176
|
/** `hc kill` (when live) then `hc rm`; each step best-effort. */
|
|
169
177
|
async drop(terminal, live) {
|
|
170
178
|
if (live) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-herdr-core",
|
|
3
|
-
"version": "0.8.1-next.
|
|
3
|
+
"version": "0.8.1-next.2",
|
|
4
4
|
"description": "bakers.build herdr-core integration: executor running each agent in a herdr-core (hc) terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"directory": "bakers-cli/addons/herdr-core"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@bakers-build/addon-herdr": "^0.8.1-next.
|
|
25
|
+
"@bakers-build/addon-herdr": "^0.8.1-next.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@bakers-build/conductor": "^0.8.1-next.
|
|
29
|
-
"@bakers-build/core": "^0.8.1-next.
|
|
28
|
+
"@bakers-build/conductor": "^0.8.1-next.2",
|
|
29
|
+
"@bakers-build/core": "^0.8.1-next.2"
|
|
30
30
|
},
|
|
31
31
|
"bakersBuild": {
|
|
32
|
-
"commit": "
|
|
32
|
+
"commit": "0177880667693d1c36c65ffced82d2f3a17cbf2a",
|
|
33
33
|
"channel": "next"
|
|
34
34
|
}
|
|
35
35
|
}
|