@commonlyai/cli 0.1.27 → 0.1.28
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/package.json +1 -1
- package/src/commands/agent.js +15 -2
- package/src/lib/api.js +2 -1
- package/src/lib/enforcement.js +6 -2
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -1001,8 +1001,9 @@ export const performRun = ({
|
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
|
+
let turnResult;
|
|
1004
1005
|
try {
|
|
1005
|
-
|
|
1006
|
+
turnResult = await runTurn({
|
|
1006
1007
|
event,
|
|
1007
1008
|
eventPodId,
|
|
1008
1009
|
prompt: peerFrame ? `${peerFrame}\n\n${prompt}` : prompt,
|
|
@@ -1011,8 +1012,20 @@ export const performRun = ({
|
|
|
1011
1012
|
claimKeeper,
|
|
1012
1013
|
trigger,
|
|
1013
1014
|
});
|
|
1015
|
+
return turnResult;
|
|
1014
1016
|
} finally {
|
|
1015
|
-
|
|
1017
|
+
// A silent, normally completed human wake is an explicit decline, not
|
|
1018
|
+
// a successful answer. Tell the kernel so it can hand the message to
|
|
1019
|
+
// exactly one remaining original listener. Any posted reply, refusal
|
|
1020
|
+
// with a reason, or thrown spawn retains completion/legacy semantics:
|
|
1021
|
+
// re-offering those would duplicate a visible response or defeat normal
|
|
1022
|
+
// at-least-once redelivery after an infrastructure failure.
|
|
1023
|
+
const claimOutcome = event.type === 'message.posted'
|
|
1024
|
+
&& event.payload?.senderIsHuman === true
|
|
1025
|
+
&& turnResult?.outcome === 'no_action' && !turnResult?.reason
|
|
1026
|
+
? 'declined'
|
|
1027
|
+
: (turnResult ? 'completed' : undefined);
|
|
1028
|
+
await claimKeeper?.release(claimOutcome);
|
|
1016
1029
|
}
|
|
1017
1030
|
};
|
|
1018
1031
|
|
package/src/lib/api.js
CHANGED
|
@@ -63,9 +63,10 @@ export const createClient = ({ instance = null, token = undefined } = {}) => {
|
|
|
63
63
|
body: JSON.stringify(body),
|
|
64
64
|
}).then((res) => handleResponse(res, session));
|
|
65
65
|
|
|
66
|
-
const del = (path) => fetch(`${baseUrl}${path}`, {
|
|
66
|
+
const del = (path, body) => fetch(`${baseUrl}${path}`, {
|
|
67
67
|
method: 'DELETE',
|
|
68
68
|
headers: headers(authToken),
|
|
69
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
69
70
|
}).then((res) => handleResponse(res, session));
|
|
70
71
|
|
|
71
72
|
// Multipart upload via native FormData/Blob (Node 18+) — no runtime deps.
|
package/src/lib/enforcement.js
CHANGED
|
@@ -420,11 +420,15 @@ export const createClaimKeeper = (client, {
|
|
|
420
420
|
if (timer && typeof timer.unref === 'function') timer.unref();
|
|
421
421
|
},
|
|
422
422
|
|
|
423
|
-
async release() {
|
|
423
|
+
async release(outcome) {
|
|
424
424
|
stopRenewal();
|
|
425
425
|
if (!acquired || lost) return;
|
|
426
426
|
try {
|
|
427
|
-
|
|
427
|
+
// Preserve the one-argument legacy call when there is no explicit
|
|
428
|
+
// outcome. Besides keeping old clients' DELETE shape intact, callers
|
|
429
|
+
// that assert their transport arguments must not see a synthetic
|
|
430
|
+
// `undefined` body. An explicit outcome is the new D6.1 contract.
|
|
431
|
+
await (outcome ? client.del(path, { outcome }) : client.del(path));
|
|
428
432
|
} catch {
|
|
429
433
|
// Best-effort: a miss just means the lease already expired.
|
|
430
434
|
}
|