openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
36 lines (35 loc) • 1.1 kB
JavaScript
//#region extensions/anthropic/cli-runtime-status.ts
/** Local facts only: this adapter never writes to the native transport. */
function createClaudeTurnStatus(e, t, n) {
return { capture() {
const r = t.handle.generation;
const i = n.promptInputUuid;
const a = n.submittedInputUuids.size;
const o = n.inputStarted;
const isCurrent = () => {
e.assertCurrent?.();
return !e.abortSignal?.aborted && !n.interrupted && t.handle.generation === r && n.promptInputUuid === i && n.submittedInputUuids.size === a && n.inputStarted === o && (t.currentTurn === n || t.closed && n.error !== void 0);
};
if (!isCurrent()) return;
return {
isCurrent,
async assess({ signal: e }) {
e.throwIfAborted();
if (!isCurrent()) return {
state: "unknown",
basis: "status_unsupported"
};
if (t.closed) return {
state: "closed",
basis: "transport_closed"
};
return {
state: "unknown",
basis: t.hasInputLifecycle && !o ? "status_unsupported" : "process_present"
};
}
};
} };
}
//#endregion
export { createClaudeTurnStatus as t };