@cabane/companion 0.6.201 → 0.6.202
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/cli.js +13 -5
- package/dist/runtime.js +9 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1314,6 +1314,11 @@ function isTurnEndedRefusal(err) {
|
|
|
1314
1314
|
const body = err.body;
|
|
1315
1315
|
return typeof body === "object" && body !== null && body.reason === "turn_ended";
|
|
1316
1316
|
}
|
|
1317
|
+
function turnEndedOutcome(err) {
|
|
1318
|
+
if (!isTurnEndedRefusal(err)) return void 0;
|
|
1319
|
+
const outcome = err.body.outcome;
|
|
1320
|
+
return typeof outcome === "string" ? outcome : void 0;
|
|
1321
|
+
}
|
|
1317
1322
|
function describeErrorBody(body) {
|
|
1318
1323
|
if (body === void 0 || body === null) return void 0;
|
|
1319
1324
|
let text;
|
|
@@ -1705,9 +1710,11 @@ var init_api = __esm({
|
|
|
1705
1710
|
signal: AbortSignal.timeout(this.opts.leaseCheckTimeoutMs ?? LEASE_CHECK_TIMEOUT_MS)
|
|
1706
1711
|
}
|
|
1707
1712
|
);
|
|
1708
|
-
|
|
1713
|
+
if (res?.state === "ended") return res.outcome === "stopped" ? "stopped" : "ended";
|
|
1714
|
+
return res?.state === "running" ? "running" : "unknown";
|
|
1709
1715
|
} catch (err) {
|
|
1710
|
-
|
|
1716
|
+
if (!isTurnEndedRefusal(err)) return "unknown";
|
|
1717
|
+
return turnEndedOutcome(err) === "stopped" ? "stopped" : "ended";
|
|
1711
1718
|
}
|
|
1712
1719
|
}
|
|
1713
1720
|
// Flips `active_run_started_at` and optionally captures the SDK session
|
|
@@ -10241,11 +10248,11 @@ var init_turn_execution = __esm({
|
|
|
10241
10248
|
payload.agentId,
|
|
10242
10249
|
turnId
|
|
10243
10250
|
);
|
|
10244
|
-
if (state !== "ended") return;
|
|
10251
|
+
if (state !== "ended" && state !== "stopped") return;
|
|
10245
10252
|
if (abortController.signal.aborted) return;
|
|
10246
|
-
o.leaseLost = true;
|
|
10253
|
+
if (state === "ended") o.leaseLost = true;
|
|
10247
10254
|
turnLog.debug(
|
|
10248
|
-
{ turnId, trigger },
|
|
10255
|
+
{ turnId, trigger, state },
|
|
10249
10256
|
"dispatcher: this turn is no longer running server-side \u2014 aborting the loop"
|
|
10250
10257
|
);
|
|
10251
10258
|
abortController.abort();
|
|
@@ -10382,6 +10389,7 @@ var init_turn_execution = __esm({
|
|
|
10382
10389
|
o.resultReason = "cancelled";
|
|
10383
10390
|
}
|
|
10384
10391
|
const userCancelled = abortController.signal.aborted && o.timeoutReason === null && !o.leaseLost && !terminated;
|
|
10392
|
+
if (userCancelled && !o.okResult) o.resultReason = "cancelled";
|
|
10385
10393
|
if (o.timeoutReason !== null) {
|
|
10386
10394
|
o.resultReason = o.timeoutReason;
|
|
10387
10395
|
o.okResult = false;
|
package/dist/runtime.js
CHANGED
|
@@ -1802,6 +1802,11 @@ function isTurnEndedRefusal(err) {
|
|
|
1802
1802
|
const body = err.body;
|
|
1803
1803
|
return typeof body === "object" && body !== null && body.reason === "turn_ended";
|
|
1804
1804
|
}
|
|
1805
|
+
function turnEndedOutcome(err) {
|
|
1806
|
+
if (!isTurnEndedRefusal(err)) return void 0;
|
|
1807
|
+
const outcome = err.body.outcome;
|
|
1808
|
+
return typeof outcome === "string" ? outcome : void 0;
|
|
1809
|
+
}
|
|
1805
1810
|
var ERROR_BODY_LOG_CAP = 2e3;
|
|
1806
1811
|
function describeErrorBody(body) {
|
|
1807
1812
|
if (body === void 0 || body === null) return void 0;
|
|
@@ -2133,9 +2138,11 @@ var CabaneApi = class {
|
|
|
2133
2138
|
signal: AbortSignal.timeout(this.opts.leaseCheckTimeoutMs ?? LEASE_CHECK_TIMEOUT_MS)
|
|
2134
2139
|
}
|
|
2135
2140
|
);
|
|
2136
|
-
|
|
2141
|
+
if (res?.state === "ended") return res.outcome === "stopped" ? "stopped" : "ended";
|
|
2142
|
+
return res?.state === "running" ? "running" : "unknown";
|
|
2137
2143
|
} catch (err) {
|
|
2138
|
-
|
|
2144
|
+
if (!isTurnEndedRefusal(err)) return "unknown";
|
|
2145
|
+
return turnEndedOutcome(err) === "stopped" ? "stopped" : "ended";
|
|
2139
2146
|
}
|
|
2140
2147
|
}
|
|
2141
2148
|
// Flips `active_run_started_at` and optionally captures the SDK session
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabane/companion",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.202",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Cabane Companion (headless): connect an agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
|
|
6
6
|
"license": "UNLICENSED",
|