@lobehub/cli 0.0.222 → 0.0.224
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 +147 -37
- package/man/man1/lh.1 +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -75946,6 +75946,87 @@ var AcpAgentSession = class {
|
|
|
75946
75946
|
}
|
|
75947
75947
|
};
|
|
75948
75948
|
|
|
75949
|
+
//#endregion
|
|
75950
|
+
//#region ../../packages/heterogeneous-agents/src/spawn/antigravityAcpElicitation.ts
|
|
75951
|
+
init_object$1();
|
|
75952
|
+
/** agy encodes each ask_question prompt as qN choices and a qN_other text field. */
|
|
75953
|
+
const parseAntigravityQuestions = (schema) => {
|
|
75954
|
+
if (!isRecord$8(schema) || schema.type !== "object" || !isRecord$8(schema.properties)) return;
|
|
75955
|
+
const { properties } = schema;
|
|
75956
|
+
const keys = Object.keys(properties).filter((key) => /^q[1-9]\d*$/.test(key));
|
|
75957
|
+
if (!keys.length || keys.length > 4 || Object.keys(properties).length !== keys.length * 2) return;
|
|
75958
|
+
const questions = [];
|
|
75959
|
+
const questionTexts = new Set([
|
|
75960
|
+
"__freeform__",
|
|
75961
|
+
"__supplement__",
|
|
75962
|
+
"__proto__"
|
|
75963
|
+
]);
|
|
75964
|
+
for (const key of keys) {
|
|
75965
|
+
const property = properties[key];
|
|
75966
|
+
const otherKey = `${key}_other`;
|
|
75967
|
+
const other = properties[otherKey];
|
|
75968
|
+
if (!isRecord$8(property) || !isRecord$8(other) || other.type !== "string") return;
|
|
75969
|
+
const title = property.title;
|
|
75970
|
+
if (typeof title !== "string" || !title.trim() || title.length > 4e3 || questionTexts.has(title)) return;
|
|
75971
|
+
questionTexts.add(title);
|
|
75972
|
+
const multiSelect = property.type === "array";
|
|
75973
|
+
const choices = multiSelect ? isRecord$8(property.items) && property.items.anyOf : property.type === "string" && property.oneOf;
|
|
75974
|
+
if (!Array.isArray(choices) || choices.length === 0 || choices.length > 16) return;
|
|
75975
|
+
const options = [];
|
|
75976
|
+
const ids = /* @__PURE__ */ new Set();
|
|
75977
|
+
for (const choice of choices) {
|
|
75978
|
+
if (!isRecord$8(choice)) return;
|
|
75979
|
+
const { const: id, title: label, description } = choice;
|
|
75980
|
+
if (typeof id !== "string" || !id.trim() || id.length >= 200 || ids.has(id)) return;
|
|
75981
|
+
if (typeof label !== "string" || !label.trim() || label.length > 200) return;
|
|
75982
|
+
ids.add(id);
|
|
75983
|
+
options.push({
|
|
75984
|
+
description: typeof description === "string" && description.length <= 1e3 ? description || void 0 : void 0,
|
|
75985
|
+
id: ` ${id}`,
|
|
75986
|
+
label
|
|
75987
|
+
});
|
|
75988
|
+
}
|
|
75989
|
+
questions.push({
|
|
75990
|
+
key,
|
|
75991
|
+
otherKey,
|
|
75992
|
+
question: {
|
|
75993
|
+
header: "",
|
|
75994
|
+
multiSelect,
|
|
75995
|
+
options,
|
|
75996
|
+
question: title
|
|
75997
|
+
}
|
|
75998
|
+
});
|
|
75999
|
+
}
|
|
76000
|
+
return questions;
|
|
76001
|
+
};
|
|
76002
|
+
const buildAntigravityElicitationResponse = (questions, answer) => {
|
|
76003
|
+
if (answer.cancelled) return { action: answer.cancelReason === "user_cancelled" ? "decline" : "cancel" };
|
|
76004
|
+
if (!isRecord$8(answer.result)) return { action: "decline" };
|
|
76005
|
+
const content = {};
|
|
76006
|
+
const freeform = typeof answer.result.__freeform__ === "string" ? answer.result.__freeform__.trim() : "";
|
|
76007
|
+
const supplement = typeof answer.result.__supplement__ === "string" ? answer.result.__supplement__.trim() : "";
|
|
76008
|
+
for (const { key, otherKey, question } of questions) {
|
|
76009
|
+
const value = answer.result[question.question];
|
|
76010
|
+
const ids = /* @__PURE__ */ new Set();
|
|
76011
|
+
const other = [];
|
|
76012
|
+
if (freeform) other.push(freeform);
|
|
76013
|
+
else {
|
|
76014
|
+
for (const selection of Array.isArray(value) ? value : [value]) {
|
|
76015
|
+
if (typeof selection !== "string" || !selection.trim()) continue;
|
|
76016
|
+
if (question.options.some(({ id }) => id === selection)) ids.add(selection.slice(1));
|
|
76017
|
+
else other.push(selection.trim());
|
|
76018
|
+
}
|
|
76019
|
+
if (supplement) other.push(supplement);
|
|
76020
|
+
}
|
|
76021
|
+
if (ids.size) content[key] = question.multiSelect ? [...ids] : [...ids][0];
|
|
76022
|
+
if (other.length) content[otherKey] = other.join("\n");
|
|
76023
|
+
}
|
|
76024
|
+
return Object.keys(content).length ? {
|
|
76025
|
+
action: "accept",
|
|
76026
|
+
content
|
|
76027
|
+
} : { action: "decline" };
|
|
76028
|
+
};
|
|
76029
|
+
|
|
75949
76030
|
//#endregion
|
|
75950
76031
|
//#region ../../packages/heterogeneous-agents/src/spawn/traeAcpSession.ts
|
|
75951
76032
|
const NOTIFICATION_DRAIN_QUIET_MS$2 = 250;
|
|
@@ -76403,6 +76484,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
|
|
|
76403
76484
|
buildInitializeParams() {
|
|
76404
76485
|
return {
|
|
76405
76486
|
clientCapabilities: {
|
|
76487
|
+
...this.options.askUserBridge && { elicitation: { form: {} } },
|
|
76406
76488
|
fs: {
|
|
76407
76489
|
readTextFile: false,
|
|
76408
76490
|
writeTextFile: false
|
|
@@ -76504,6 +76586,8 @@ var AntigravityAcpSession = class extends AcpAgentSession {
|
|
|
76504
76586
|
const params = isRecord$8(message.params) ? message.params : void 0;
|
|
76505
76587
|
if (!isRecord$8(params?.update)) return;
|
|
76506
76588
|
if (typeof params.sessionId === "string" && params.sessionId !== this.acpSessionId) return;
|
|
76589
|
+
const { name, sessionUpdate, status } = params.update;
|
|
76590
|
+
if (this.options.askUserBridge && name === "ask_question" && (sessionUpdate === "tool_call" || sessionUpdate === "tool_call_update") && (status === "in_progress" || status === "pending" || status === void 0)) return;
|
|
76507
76591
|
await this.pushToPipeline(params.update);
|
|
76508
76592
|
}
|
|
76509
76593
|
/**
|
|
@@ -76511,6 +76595,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
|
|
|
76511
76595
|
* still ask, approve as the print-mode runs did.
|
|
76512
76596
|
*/
|
|
76513
76597
|
handleServerRequest(message) {
|
|
76598
|
+
if (message.method === "elicitation/create") return this.handleElicitation(message.params);
|
|
76514
76599
|
if (message.method !== "session/request_permission") throw new AcpServerRequestError(-32601, `Unsupported ACP client request: ${message.method}`);
|
|
76515
76600
|
const optionId = selectAcpPermissionOption(message.params, [(option) => option.kind === "allow_always", (option) => option.kind === "allow_once"]);
|
|
76516
76601
|
return optionId ? { outcome: {
|
|
@@ -76518,6 +76603,28 @@ var AntigravityAcpSession = class extends AcpAgentSession {
|
|
|
76518
76603
|
outcome: "selected"
|
|
76519
76604
|
} } : { outcome: { outcome: "cancelled" } };
|
|
76520
76605
|
}
|
|
76606
|
+
async handleElicitation(params) {
|
|
76607
|
+
const bridge = this.options.askUserBridge;
|
|
76608
|
+
if (!bridge || !isRecord$8(params) || params.mode !== "form") throw new AcpServerRequestError(-32602, "Unsupported Antigravity elicitation mode");
|
|
76609
|
+
if (!this.steerable || params.sessionId !== this.acpSessionId) return { action: "cancel" };
|
|
76610
|
+
const { toolCallId } = params;
|
|
76611
|
+
const questions = parseAntigravityQuestions(params.requestedSchema);
|
|
76612
|
+
if (typeof toolCallId !== "string" || !toolCallId || !questions) return { action: "decline" };
|
|
76613
|
+
const args = { questions: questions.map(({ question }) => question) };
|
|
76614
|
+
await this.pushToPipeline({
|
|
76615
|
+
name: "askUserQuestion",
|
|
76616
|
+
rawInput: args,
|
|
76617
|
+
sessionUpdate: "tool_call",
|
|
76618
|
+
toolCallId
|
|
76619
|
+
});
|
|
76620
|
+
if (!this.steerable) return { action: "cancel" };
|
|
76621
|
+
return buildAntigravityElicitationResponse(questions, await bridge.pending({
|
|
76622
|
+
arguments: args,
|
|
76623
|
+
toolCallId
|
|
76624
|
+
}, { onEvent: (event) => {
|
|
76625
|
+
this.emitEvents([event]).catch(() => this.interrupt());
|
|
76626
|
+
} }));
|
|
76627
|
+
}
|
|
76521
76628
|
/**
|
|
76522
76629
|
* Resume without replaying history; agy points sessions it cannot resume to
|
|
76523
76630
|
* `session/load`, whose replay arrives before the prompt and is dropped.
|
|
@@ -76560,7 +76667,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
|
|
|
76560
76667
|
const { effort, mode } = this.launch;
|
|
76561
76668
|
const model = this.launch.model && this.launch.model !== "default" ? resolveModelValue(this.launch.model, effort, sessionResult) : void 0;
|
|
76562
76669
|
if (model) await set("model", model);
|
|
76563
|
-
if (effort &&
|
|
76670
|
+
if (effort && configOptionValues(configOptions, "thought_level").includes(effort)) await set("thought_level", effort);
|
|
76564
76671
|
if (mode) await set("mode", mode);
|
|
76565
76672
|
const family = configValue(configOptions, "model");
|
|
76566
76673
|
if (!family) return model;
|
|
@@ -80108,6 +80215,7 @@ const spawnAntigravityAcpAgent = async (options, command, cwd) => {
|
|
|
80108
80215
|
const bridge = createAcpSpawnBridge();
|
|
80109
80216
|
const session = new AntigravityAcpSession({
|
|
80110
80217
|
args: options.extraArgs ?? [],
|
|
80218
|
+
askUserBridge: options.askUserBridge,
|
|
80111
80219
|
clientVersion: "lobehub-cli",
|
|
80112
80220
|
commandPath: command,
|
|
80113
80221
|
cwd,
|
|
@@ -568043,11 +568151,12 @@ var AskUserBridge = class {
|
|
|
568043
568151
|
const startedAt = Date.now();
|
|
568044
568152
|
const expires = Number.isFinite(timeoutMs);
|
|
568045
568153
|
const deadline = startedAt + (expires ? timeoutMs : NO_DEADLINE_MS);
|
|
568154
|
+
const emit = options.onEvent ?? ((event) => this.emit(event));
|
|
568046
568155
|
return new Promise((resolve, reject) => {
|
|
568047
568156
|
const onTimeout = () => {
|
|
568048
568157
|
this.pending_.delete(toolCallId);
|
|
568049
568158
|
clearInterval(progressTimer);
|
|
568050
|
-
this.emitResponse(toolCallId, {
|
|
568159
|
+
this.emitResponse(emit, toolCallId, {
|
|
568051
568160
|
cancelReason: "timeout",
|
|
568052
568161
|
cancelled: true
|
|
568053
568162
|
});
|
|
@@ -568067,20 +568176,20 @@ var AskUserBridge = class {
|
|
|
568067
568176
|
};
|
|
568068
568177
|
this.pending_.set(toolCallId, {
|
|
568069
568178
|
cleanup,
|
|
568179
|
+
emit,
|
|
568070
568180
|
reject,
|
|
568071
568181
|
resolve
|
|
568072
568182
|
});
|
|
568073
|
-
|
|
568074
|
-
|
|
568075
|
-
|
|
568076
|
-
|
|
568077
|
-
|
|
568078
|
-
|
|
568079
|
-
|
|
568080
|
-
|
|
568081
|
-
|
|
568082
|
-
|
|
568083
|
-
data,
|
|
568183
|
+
emit({
|
|
568184
|
+
data: {
|
|
568185
|
+
apiName: "askUserQuestion",
|
|
568186
|
+
arguments: JSON.stringify(args.arguments ?? {}),
|
|
568187
|
+
deadline,
|
|
568188
|
+
identifier: this.identifier,
|
|
568189
|
+
interactionKind: args.interactionKind ?? "question",
|
|
568190
|
+
provider: this.provider,
|
|
568191
|
+
toolCallId
|
|
568192
|
+
},
|
|
568084
568193
|
operationId: this.operationId,
|
|
568085
568194
|
stepIndex: this.getStepIndex(),
|
|
568086
568195
|
timestamp: startedAt,
|
|
@@ -568098,7 +568207,7 @@ var AskUserBridge = class {
|
|
|
568098
568207
|
if (!entry) return;
|
|
568099
568208
|
this.pending_.delete(toolCallId);
|
|
568100
568209
|
entry.cleanup();
|
|
568101
|
-
this.emitResponse(toolCallId, {
|
|
568210
|
+
this.emitResponse(entry.emit, toolCallId, {
|
|
568102
568211
|
cancelReason: payload.cancelled ? payload.cancelReason ?? "user_cancelled" : void 0,
|
|
568103
568212
|
cancelled: payload.cancelled,
|
|
568104
568213
|
result: payload.cancelled ? void 0 : payload.result,
|
|
@@ -568129,7 +568238,7 @@ var AskUserBridge = class {
|
|
|
568129
568238
|
if (this.closed) return;
|
|
568130
568239
|
for (const [toolCallId, entry] of this.pending_) {
|
|
568131
568240
|
entry.cleanup();
|
|
568132
|
-
this.emitResponse(toolCallId, {
|
|
568241
|
+
this.emitResponse(entry.emit, toolCallId, {
|
|
568133
568242
|
cancelReason: reason,
|
|
568134
568243
|
cancelled: true
|
|
568135
568244
|
});
|
|
@@ -568183,17 +568292,16 @@ var AskUserBridge = class {
|
|
|
568183
568292
|
});
|
|
568184
568293
|
else this.outboundQueue.push(event);
|
|
568185
568294
|
}
|
|
568186
|
-
emitResponse(toolCallId, payload) {
|
|
568187
|
-
|
|
568188
|
-
|
|
568189
|
-
|
|
568190
|
-
|
|
568191
|
-
|
|
568192
|
-
|
|
568193
|
-
|
|
568194
|
-
|
|
568195
|
-
|
|
568196
|
-
data,
|
|
568295
|
+
emitResponse(emit, toolCallId, payload) {
|
|
568296
|
+
emit({
|
|
568297
|
+
data: {
|
|
568298
|
+
cancelled: payload.cancelled,
|
|
568299
|
+
cancelReason: payload.cancelReason,
|
|
568300
|
+
producerAck: true,
|
|
568301
|
+
result: payload.result,
|
|
568302
|
+
resolutionRequestId: payload.resolutionRequestId,
|
|
568303
|
+
toolCallId
|
|
568304
|
+
},
|
|
568197
568305
|
operationId: this.operationId,
|
|
568198
568306
|
stepIndex: this.getStepIndex(),
|
|
568199
568307
|
timestamp: Date.now(),
|
|
@@ -584863,11 +584971,11 @@ var WebStandardStreamableHTTPServerTransport = class {
|
|
|
584863
584971
|
};
|
|
584864
584972
|
|
|
584865
584973
|
//#endregion
|
|
584866
|
-
//#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.
|
|
584974
|
+
//#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.21/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
584867
584975
|
const X_ALREADY_SENT = "x-hono-already-sent";
|
|
584868
584976
|
|
|
584869
584977
|
//#endregion
|
|
584870
|
-
//#region node_modules/.pnpm/hono@4.13.
|
|
584978
|
+
//#region node_modules/.pnpm/hono@4.13.21/node_modules/hono/dist/helper/websocket/index.js
|
|
584871
584979
|
/**
|
|
584872
584980
|
* Create a WebSocket adapter/helper
|
|
584873
584981
|
*/
|
|
@@ -584892,7 +585000,7 @@ const defineWebSocketHelper = (handler) => {
|
|
|
584892
585000
|
};
|
|
584893
585001
|
|
|
584894
585002
|
//#endregion
|
|
584895
|
-
//#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.
|
|
585003
|
+
//#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.21/node_modules/@hono/node-server/dist/index.mjs
|
|
584896
585004
|
var RequestError = class extends Error {
|
|
584897
585005
|
constructor(message, options) {
|
|
584898
585006
|
super(message, options);
|
|
@@ -588941,17 +589049,19 @@ const exec = async (options) => {
|
|
|
588941
589049
|
let askBridge;
|
|
588942
589050
|
let askMcpConfigPath;
|
|
588943
589051
|
const askPollAbort = new AbortController();
|
|
588944
|
-
|
|
588945
|
-
|
|
588946
|
-
|
|
588947
|
-
|
|
588948
|
-
|
|
588949
|
-
|
|
589052
|
+
const mcpAskUserProvider = agentType === "claude-code" || agentType === "qoder" ? agentType : void 0;
|
|
589053
|
+
const nativeAskUserProvider = agentType === "antigravity" || agentType === "codex" && options.codexAppServer || agentType === "copilot" || agentType === "cursor" || agentType === "devin" || agentType === "droid" ? agentType : void 0;
|
|
589054
|
+
if (serverIngest && serverIngester && (mcpAskUserProvider || nativeAskUserProvider)) {
|
|
589055
|
+
if (nativeAskUserProvider) askBridge = new AskUserBridge(operationId, {
|
|
589056
|
+
identifier: nativeAskUserProvider === "cursor" ? "claude-code" : nativeAskUserProvider,
|
|
589057
|
+
provider: nativeAskUserProvider
|
|
589058
|
+
});
|
|
589059
|
+
else if (mcpAskUserProvider) {
|
|
588950
589060
|
askServer = new LobeBuiltinMcpServer();
|
|
588951
589061
|
await askServer.start();
|
|
588952
589062
|
askBridge = askServer.registerOperation(operationId, new AskUserBridge(operationId, {
|
|
588953
|
-
identifier:
|
|
588954
|
-
provider:
|
|
589063
|
+
identifier: mcpAskUserProvider,
|
|
589064
|
+
provider: mcpAskUserProvider
|
|
588955
589065
|
}));
|
|
588956
589066
|
askMcpConfigPath = path.join(os.tmpdir(), `lobe-cc-mcp-${operationId}.json`);
|
|
588957
589067
|
await writeFile(askMcpConfigPath, JSON.stringify({ mcpServers: { lobe_cc: {
|
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.224" "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.224",
|
|
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": "1177187a9ba37e6a2a3257fe86f8bf5a45ede503"
|
|
87
87
|
}
|