@lobehub/cli 0.0.101 → 0.0.102
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/index.js +55 -34
- package/man/man1/lh.1 +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -63240,6 +63240,11 @@ const createCodexAgentHandle = async (options) => {
|
|
|
63240
63240
|
let nativeSessionId;
|
|
63241
63241
|
let cancelledSignal;
|
|
63242
63242
|
let nativeTurnInterrupted = false;
|
|
63243
|
+
let markTurnStarted;
|
|
63244
|
+
const turnStarted = new Promise((resolve) => {
|
|
63245
|
+
markTurnStarted = resolve;
|
|
63246
|
+
});
|
|
63247
|
+
let runEnded = false;
|
|
63243
63248
|
const provenance = pickCodexRunProvenance({
|
|
63244
63249
|
...options.env,
|
|
63245
63250
|
LOBEHUB_OPERATION_ID: options.operationId
|
|
@@ -63261,7 +63266,9 @@ const createCodexAgentHandle = async (options) => {
|
|
|
63261
63266
|
if (batch.some((event) => event.type === "agent_runtime_end" && event.data?.reason === "interrupted")) nativeTurnInterrupted = true;
|
|
63262
63267
|
events.push(batch);
|
|
63263
63268
|
},
|
|
63264
|
-
onRuntimeStatus: () => {
|
|
63269
|
+
onRuntimeStatus: (status) => {
|
|
63270
|
+
if (status.state === "running") markTurnStarted();
|
|
63271
|
+
},
|
|
63265
63272
|
onSessionId: (id) => {
|
|
63266
63273
|
nativeSessionId = id;
|
|
63267
63274
|
},
|
|
@@ -63284,37 +63291,39 @@ const createCodexAgentHandle = async (options) => {
|
|
|
63284
63291
|
operationId: options.operationId,
|
|
63285
63292
|
provenance
|
|
63286
63293
|
};
|
|
63294
|
+
const exit = (cancelledSignal ? Promise.resolve() : session.run(turnOptions)).then(() => {
|
|
63295
|
+
if (cancelledSignal) return {
|
|
63296
|
+
code: null,
|
|
63297
|
+
signal: cancelledSignal
|
|
63298
|
+
};
|
|
63299
|
+
if (!nativeTurnInterrupted) return {
|
|
63300
|
+
code: 0,
|
|
63301
|
+
signal: null
|
|
63302
|
+
};
|
|
63303
|
+
stderr.write("Codex app-server interrupted the turn before it completed\n");
|
|
63304
|
+
return {
|
|
63305
|
+
code: 1,
|
|
63306
|
+
signal: null
|
|
63307
|
+
};
|
|
63308
|
+
}, (error) => {
|
|
63309
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
63310
|
+
stderr.write(`${detail}\n`);
|
|
63311
|
+
return {
|
|
63312
|
+
code: cancelledSignal ? null : 1,
|
|
63313
|
+
signal: cancelledSignal ?? null
|
|
63314
|
+
};
|
|
63315
|
+
}).finally(() => {
|
|
63316
|
+
runEnded = true;
|
|
63317
|
+
session.close();
|
|
63318
|
+
client.close();
|
|
63319
|
+
stopStderr();
|
|
63320
|
+
events.close();
|
|
63321
|
+
stderr.end();
|
|
63322
|
+
jwtFile?.cleanup();
|
|
63323
|
+
});
|
|
63287
63324
|
return {
|
|
63288
63325
|
events,
|
|
63289
|
-
exit
|
|
63290
|
-
if (cancelledSignal) return {
|
|
63291
|
-
code: null,
|
|
63292
|
-
signal: cancelledSignal
|
|
63293
|
-
};
|
|
63294
|
-
if (!nativeTurnInterrupted) return {
|
|
63295
|
-
code: 0,
|
|
63296
|
-
signal: null
|
|
63297
|
-
};
|
|
63298
|
-
stderr.write("Codex app-server interrupted the turn before it completed\n");
|
|
63299
|
-
return {
|
|
63300
|
-
code: 1,
|
|
63301
|
-
signal: null
|
|
63302
|
-
};
|
|
63303
|
-
}, (error) => {
|
|
63304
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
63305
|
-
stderr.write(`${detail}\n`);
|
|
63306
|
-
return {
|
|
63307
|
-
code: cancelledSignal ? null : 1,
|
|
63308
|
-
signal: cancelledSignal ?? null
|
|
63309
|
-
};
|
|
63310
|
-
}).finally(() => {
|
|
63311
|
-
session.close();
|
|
63312
|
-
client.close();
|
|
63313
|
-
stopStderr();
|
|
63314
|
-
events.close();
|
|
63315
|
-
stderr.end();
|
|
63316
|
-
jwtFile?.cleanup();
|
|
63317
|
-
}),
|
|
63326
|
+
exit,
|
|
63318
63327
|
kill: (signal = "SIGINT") => {
|
|
63319
63328
|
cancel(signal).catch(() => {
|
|
63320
63329
|
session.close();
|
|
@@ -63322,6 +63331,17 @@ const createCodexAgentHandle = async (options) => {
|
|
|
63322
63331
|
});
|
|
63323
63332
|
},
|
|
63324
63333
|
pid: void 0,
|
|
63334
|
+
/**
|
|
63335
|
+
* Add a follow-up to the running turn (`turn/steer`). The app-server echoes it
|
|
63336
|
+
* as a user message carrying `uuid`, which confirms the delivery. Resolves
|
|
63337
|
+
* false when the turn takes no input (it ended, or a review or compaction
|
|
63338
|
+
* turn), so the caller sends the message as the next run instead.
|
|
63339
|
+
*/
|
|
63340
|
+
sendUserMessage: async (prompt, sendOptions) => {
|
|
63341
|
+
if (!await Promise.race([turnStarted.then(() => true), exit.then(() => false)]) || runEnded) return false;
|
|
63342
|
+
const plan = await buildAgentInput("codex", prompt);
|
|
63343
|
+
return await session.steer(buildCodexAppServerInput(plan), sendOptions?.uuid ?? randomUUID()) === "accepted";
|
|
63344
|
+
},
|
|
63325
63345
|
get sessionId() {
|
|
63326
63346
|
return nativeSessionId;
|
|
63327
63347
|
},
|
|
@@ -581637,13 +581657,14 @@ const isPermanentRefusal = (error) => {
|
|
|
581637
581657
|
const isUserMessageReplay = (event) => event.type === "step_complete" && event.data?.phase === "user_message" && typeof event.data?.uuid === "string";
|
|
581638
581658
|
const isMainStreamStart = (event) => event.type === "stream_start" && !event.data?.subagent;
|
|
581639
581659
|
/**
|
|
581640
|
-
* Stream a Claude Code run's events while typing the
|
|
581641
|
-
* queues behind it into the live session (steer), instead
|
|
581642
|
-
* the next turn.
|
|
581660
|
+
* Stream a Claude Code or native Codex run's events while typing the
|
|
581661
|
+
* follow-ups the user queues behind it into the live session (steer), instead
|
|
581662
|
+
* of leaving them for the next turn.
|
|
581643
581663
|
*
|
|
581644
581664
|
* Polls `aiAgent.waitHeteroSteer` for as long as the run streams and its
|
|
581645
581665
|
* session takes input; a message the session refuses goes back with
|
|
581646
|
-
* `aiAgent.returnHeteroSteer`.
|
|
581666
|
+
* `aiAgent.returnHeteroSteer`. The agent reports every message it picks up
|
|
581667
|
+
* (Claude Code replays it, Codex echoes its client id):
|
|
581647
581668
|
* the replay of a delivery is forwarded for the server to write the message
|
|
581648
581669
|
* into the conversation; any other replay (the run's own prompt) is dropped.
|
|
581649
581670
|
* Once the server answered, the next main `stream_start` carries `liveSteer`
|
package/man/man1/lh.1
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
|
|
2
2
|
.\" Manual command details come from the Commander command tree.
|
|
3
|
-
.TH LH 1 "" "@lobehub/cli 0.0.
|
|
3
|
+
.TH LH 1 "" "@lobehub/cli 0.0.102" "User Commands"
|
|
4
4
|
.SH NAME
|
|
5
5
|
lh \- LobeHub CLI \- manage and connect to LobeHub services
|
|
6
6
|
.SH SYNOPSIS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.102",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/lobehub/lobehub",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"access": "public",
|
|
84
84
|
"registry": "https://registry.npmjs.org"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "6933028268f628a950b855ba02dc28d1e384210b"
|
|
87
87
|
}
|