@lobehub/cli 0.0.221 → 0.0.223

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 CHANGED
@@ -9513,6 +9513,14 @@ var init_channel = __esmMin((() => {
9513
9513
  ];
9514
9514
  }));
9515
9515
 
9516
+ //#endregion
9517
+ //#region ../../packages/types/src/channelAsk.ts
9518
+ var init_channelAsk = __esmMin((() => {}));
9519
+
9520
+ //#endregion
9521
+ //#region ../../packages/types/src/channelMessage.ts
9522
+ var init_channelMessage = __esmMin((() => {}));
9523
+
9516
9524
  //#endregion
9517
9525
  //#region ../../packages/types/src/channelMessageCard.ts
9518
9526
  var init_channelMessageCard = __esmMin((() => {}));
@@ -12572,6 +12580,8 @@ var init_src$2 = __esmMin((() => {
12572
12580
  init_auth();
12573
12581
  init_brief();
12574
12582
  init_channel();
12583
+ init_channelAsk();
12584
+ init_channelMessage();
12575
12585
  init_channelMessageCard();
12576
12586
  init_chunk$1();
12577
12587
  init_contact();
@@ -75936,6 +75946,87 @@ var AcpAgentSession = class {
75936
75946
  }
75937
75947
  };
75938
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
+
75939
76030
  //#endregion
75940
76031
  //#region ../../packages/heterogeneous-agents/src/spawn/traeAcpSession.ts
75941
76032
  const NOTIFICATION_DRAIN_QUIET_MS$2 = 250;
@@ -76393,6 +76484,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
76393
76484
  buildInitializeParams() {
76394
76485
  return {
76395
76486
  clientCapabilities: {
76487
+ ...this.options.askUserBridge && { elicitation: { form: {} } },
76396
76488
  fs: {
76397
76489
  readTextFile: false,
76398
76490
  writeTextFile: false
@@ -76494,6 +76586,8 @@ var AntigravityAcpSession = class extends AcpAgentSession {
76494
76586
  const params = isRecord$8(message.params) ? message.params : void 0;
76495
76587
  if (!isRecord$8(params?.update)) return;
76496
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;
76497
76591
  await this.pushToPipeline(params.update);
76498
76592
  }
76499
76593
  /**
@@ -76501,6 +76595,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
76501
76595
  * still ask, approve as the print-mode runs did.
76502
76596
  */
76503
76597
  handleServerRequest(message) {
76598
+ if (message.method === "elicitation/create") return this.handleElicitation(message.params);
76504
76599
  if (message.method !== "session/request_permission") throw new AcpServerRequestError(-32601, `Unsupported ACP client request: ${message.method}`);
76505
76600
  const optionId = selectAcpPermissionOption(message.params, [(option) => option.kind === "allow_always", (option) => option.kind === "allow_once"]);
76506
76601
  return optionId ? { outcome: {
@@ -76508,6 +76603,28 @@ var AntigravityAcpSession = class extends AcpAgentSession {
76508
76603
  outcome: "selected"
76509
76604
  } } : { outcome: { outcome: "cancelled" } };
76510
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
+ }
76511
76628
  /**
76512
76629
  * Resume without replaying history; agy points sessions it cannot resume to
76513
76630
  * `session/load`, whose replay arrives before the prompt and is dropped.
@@ -76550,7 +76667,7 @@ var AntigravityAcpSession = class extends AcpAgentSession {
76550
76667
  const { effort, mode } = this.launch;
76551
76668
  const model = this.launch.model && this.launch.model !== "default" ? resolveModelValue(this.launch.model, effort, sessionResult) : void 0;
76552
76669
  if (model) await set("model", model);
76553
- if (effort && findConfigOption(configOptions, "thought_level")) await set("thought_level", effort);
76670
+ if (effort && configOptionValues(configOptions, "thought_level").includes(effort)) await set("thought_level", effort);
76554
76671
  if (mode) await set("mode", mode);
76555
76672
  const family = configValue(configOptions, "model");
76556
76673
  if (!family) return model;
@@ -80098,6 +80215,7 @@ const spawnAntigravityAcpAgent = async (options, command, cwd) => {
80098
80215
  const bridge = createAcpSpawnBridge();
80099
80216
  const session = new AntigravityAcpSession({
80100
80217
  args: options.extraArgs ?? [],
80218
+ askUserBridge: options.askUserBridge,
80101
80219
  clientVersion: "lobehub-cli",
80102
80220
  commandPath: command,
80103
80221
  cwd,
@@ -568033,11 +568151,12 @@ var AskUserBridge = class {
568033
568151
  const startedAt = Date.now();
568034
568152
  const expires = Number.isFinite(timeoutMs);
568035
568153
  const deadline = startedAt + (expires ? timeoutMs : NO_DEADLINE_MS);
568154
+ const emit = options.onEvent ?? ((event) => this.emit(event));
568036
568155
  return new Promise((resolve, reject) => {
568037
568156
  const onTimeout = () => {
568038
568157
  this.pending_.delete(toolCallId);
568039
568158
  clearInterval(progressTimer);
568040
- this.emitResponse(toolCallId, {
568159
+ this.emitResponse(emit, toolCallId, {
568041
568160
  cancelReason: "timeout",
568042
568161
  cancelled: true
568043
568162
  });
@@ -568057,20 +568176,20 @@ var AskUserBridge = class {
568057
568176
  };
568058
568177
  this.pending_.set(toolCallId, {
568059
568178
  cleanup,
568179
+ emit,
568060
568180
  reject,
568061
568181
  resolve
568062
568182
  });
568063
- const data = {
568064
- apiName: "askUserQuestion",
568065
- arguments: JSON.stringify(args.arguments ?? {}),
568066
- deadline,
568067
- identifier: this.identifier,
568068
- interactionKind: args.interactionKind ?? "question",
568069
- provider: this.provider,
568070
- toolCallId
568071
- };
568072
- this.emit({
568073
- 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
+ },
568074
568193
  operationId: this.operationId,
568075
568194
  stepIndex: this.getStepIndex(),
568076
568195
  timestamp: startedAt,
@@ -568088,7 +568207,7 @@ var AskUserBridge = class {
568088
568207
  if (!entry) return;
568089
568208
  this.pending_.delete(toolCallId);
568090
568209
  entry.cleanup();
568091
- this.emitResponse(toolCallId, {
568210
+ this.emitResponse(entry.emit, toolCallId, {
568092
568211
  cancelReason: payload.cancelled ? payload.cancelReason ?? "user_cancelled" : void 0,
568093
568212
  cancelled: payload.cancelled,
568094
568213
  result: payload.cancelled ? void 0 : payload.result,
@@ -568119,7 +568238,7 @@ var AskUserBridge = class {
568119
568238
  if (this.closed) return;
568120
568239
  for (const [toolCallId, entry] of this.pending_) {
568121
568240
  entry.cleanup();
568122
- this.emitResponse(toolCallId, {
568241
+ this.emitResponse(entry.emit, toolCallId, {
568123
568242
  cancelReason: reason,
568124
568243
  cancelled: true
568125
568244
  });
@@ -568173,17 +568292,16 @@ var AskUserBridge = class {
568173
568292
  });
568174
568293
  else this.outboundQueue.push(event);
568175
568294
  }
568176
- emitResponse(toolCallId, payload) {
568177
- const data = {
568178
- cancelled: payload.cancelled,
568179
- cancelReason: payload.cancelReason,
568180
- producerAck: true,
568181
- result: payload.result,
568182
- resolutionRequestId: payload.resolutionRequestId,
568183
- toolCallId
568184
- };
568185
- this.emit({
568186
- 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
+ },
568187
568305
  operationId: this.operationId,
568188
568306
  stepIndex: this.getStepIndex(),
568189
568307
  timestamp: Date.now(),
@@ -584853,11 +584971,11 @@ var WebStandardStreamableHTTPServerTransport = class {
584853
584971
  };
584854
584972
 
584855
584973
  //#endregion
584856
- //#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.20/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
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
584857
584975
  const X_ALREADY_SENT = "x-hono-already-sent";
584858
584976
 
584859
584977
  //#endregion
584860
- //#region node_modules/.pnpm/hono@4.13.20/node_modules/hono/dist/helper/websocket/index.js
584978
+ //#region node_modules/.pnpm/hono@4.13.21/node_modules/hono/dist/helper/websocket/index.js
584861
584979
  /**
584862
584980
  * Create a WebSocket adapter/helper
584863
584981
  */
@@ -584882,7 +585000,7 @@ const defineWebSocketHelper = (handler) => {
584882
585000
  };
584883
585001
 
584884
585002
  //#endregion
584885
- //#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.20/node_modules/@hono/node-server/dist/index.mjs
585003
+ //#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.21/node_modules/@hono/node-server/dist/index.mjs
584886
585004
  var RequestError = class extends Error {
584887
585005
  constructor(message, options) {
584888
585006
  super(message, options);
@@ -588931,17 +589049,19 @@ const exec = async (options) => {
588931
589049
  let askBridge;
588932
589050
  let askMcpConfigPath;
588933
589051
  const askPollAbort = new AbortController();
588934
- if (serverIngest && (agentType === "claude-code" || agentType === "codex" && options.codexAppServer || agentType === "copilot" || agentType === "cursor" || agentType === "droid" || agentType === "devin" || agentType === "qoder") && serverIngester) {
588935
- if (agentType === "codex" || agentType === "copilot" || agentType === "cursor" || agentType === "devin" || agentType === "droid") askBridge = new AskUserBridge(operationId, {
588936
- identifier: agentType === "cursor" ? "claude-code" : agentType,
588937
- provider: agentType
588938
- });
588939
- else {
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) {
588940
589060
  askServer = new LobeBuiltinMcpServer();
588941
589061
  await askServer.start();
588942
589062
  askBridge = askServer.registerOperation(operationId, new AskUserBridge(operationId, {
588943
- identifier: agentType,
588944
- provider: agentType
589063
+ identifier: mcpAskUserProvider,
589064
+ provider: mcpAskUserProvider
588945
589065
  }));
588946
589066
  askMcpConfigPath = path.join(os.tmpdir(), `lobe-cc-mcp-${operationId}.json`);
588947
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.221" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.223" "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.221",
3
+ "version": "0.0.223",
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": "cf20ca9970b80cd751e590206e9f20b3707005f7"
86
+ "gitHead": "4be931285b05cfbeff01508631a36e646f099eb1"
87
87
  }