deepseeker-code 1.0.67 → 1.0.68

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +32 -30
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -4599,16 +4599,17 @@ var init_listen = __esm({
4599
4599
  });
4600
4600
  };
4601
4601
  };
4602
- bootSdk = async (sdk, appId, secret, locale2, log) => {
4602
+ bootSdk = async (sdk, appId, secret, locale2, log, hooks) => {
4603
4603
  if (!sdk?.Client || !sdk?.WSClient || !sdk?.EventDispatcher) return null;
4604
4604
  const client = new sdk.Client({ appId, appSecret: secret });
4605
4605
  const loggerLevel = sdk.LoggerLevel?.info ?? "info";
4606
- const wsClient = new sdk.WSClient({ appId, appSecret: secret, loggerLevel });
4606
+ const wsClient = new sdk.WSClient({ appId, appSecret: secret, loggerLevel, ...hooks ?? {} });
4607
4607
  const dispatcher = new sdk.EventDispatcher({});
4608
4608
  let botOpenId;
4609
4609
  try {
4610
- const info = await client.bot.info();
4611
- botOpenId = info?.data?.open_id ?? info?.open_id ?? info?.data?.bot?.open_id;
4610
+ const resp = await client.request({ method: "GET", url: "/open-apis/bot/v3/info" });
4611
+ const body = resp?.data ?? resp;
4612
+ botOpenId = body?.bot?.open_id ?? body?.open_id ?? body?.data?.bot?.open_id;
4612
4613
  } catch (e) {
4613
4614
  log(msg6(locale2, "botInfoFail", String(e?.message ?? e)));
4614
4615
  }
@@ -4699,7 +4700,6 @@ var init_listen = __esm({
4699
4700
  };
4700
4701
  buildApprovalCard = (p) => JSON.stringify({
4701
4702
  schema: "2.0",
4702
- config: { update_multi: false },
4703
4703
  header: { title: { tag: "plain_text", content: "\u{1F510} \u6302\u673A\u4EFB\u52A1\u9AD8\u5371\u64CD\u4F5C\u5BA1\u6279" }, template: "red" },
4704
4704
  body: {
4705
4705
  elements: [
@@ -4709,27 +4709,22 @@ var init_listen = __esm({
4709
4709
  `**\u7968**\uFF1A${p.ticketId ?? "?"}${p.ticketTitle ? ` ${p.ticketTitle.slice(0, 60)}` : ""}`,
4710
4710
  `**\u5DE5\u5177**\uFF1A${p.tool}`,
4711
4711
  `**\u8BF7\u6C42**\uFF1A${p.summary.slice(0, 200)}`,
4712
- `**\u671F\u9650**\uFF1A${p.expiresAt}\uFF08\u8D85\u65F6\u81EA\u52A8\u62D2\u7EDD\uFF0Cfail-closed\uFF09`
4712
+ `**\u671F\u9650**\uFF1A${p.expiresAt}\uFF08\u8D85\u65F6\u81EA\u52A8\u62D2\u7EDD\uFF0Cfail-closed\uFF09`,
4713
+ `\u6279\u51C6 = allow-once \u5355\u6B21\u751F\u6548\uFF0C\u4E0D\u6539\u53D8\u5DE5\u5177\u767D\u540D\u5355\u3002`
4713
4714
  ].join("\n")
4714
4715
  },
4715
4716
  {
4716
- tag: "action",
4717
- actions: [
4718
- {
4719
- tag: "button",
4720
- text: { tag: "plain_text", content: "\u6279\u51C6\uFF08\u4EC5\u672C\u7968\u672C\u6B21\uFF09" },
4721
- type: "primary",
4722
- behaviors: [{ type: "callback", value: { approvalId: p.approvalId, decision: "allow" } }]
4723
- },
4724
- {
4725
- tag: "button",
4726
- text: { tag: "plain_text", content: "\u62D2\u7EDD" },
4727
- type: "danger",
4728
- behaviors: [{ type: "callback", value: { approvalId: p.approvalId, decision: "deny" } }]
4729
- }
4730
- ]
4717
+ tag: "button",
4718
+ text: { tag: "plain_text", content: "\u6279\u51C6\uFF08\u4EC5\u672C\u7968\u672C\u6B21\uFF09" },
4719
+ type: "primary",
4720
+ behaviors: [{ type: "callback", value: { approvalId: p.approvalId, decision: "allow" } }]
4731
4721
  },
4732
- { tag: "note", elements: [{ tag: "plain_text", content: "\u6279\u51C6 = allow-once \u5355\u6B21\u751F\u6548\uFF0C\u4E0D\u6539\u53D8\u5DE5\u5177\u767D\u540D\u5355\u3002" }] }
4722
+ {
4723
+ tag: "button",
4724
+ text: { tag: "plain_text", content: "\u62D2\u7EDD" },
4725
+ type: "danger",
4726
+ behaviors: [{ type: "callback", value: { approvalId: p.approvalId, decision: "deny" } }]
4727
+ }
4733
4728
  ]
4734
4729
  }
4735
4730
  });
@@ -4772,6 +4767,19 @@ var init_listen = __esm({
4772
4767
  log(msg6(locale2, "alreadyRunning", existing.pid));
4773
4768
  return { code: 1 };
4774
4769
  }
4770
+ let stopReason = null;
4771
+ const requestStop = (why) => {
4772
+ if (stopReason === null) stopReason = why;
4773
+ };
4774
+ let wsExitCode = 0;
4775
+ const wsHooks = {
4776
+ onReady: () => log(msg6(locale2, "started")),
4777
+ onError: (e) => {
4778
+ log(msg6(locale2, "wsFail", String(e?.message ?? e)));
4779
+ wsExitCode = 1;
4780
+ requestStop("ws error");
4781
+ }
4782
+ };
4775
4783
  let sdk;
4776
4784
  try {
4777
4785
  sdk = await (deps?.loadSdk ?? defaultLoadSdk)();
@@ -4779,7 +4787,7 @@ var init_listen = __esm({
4779
4787
  log(`${SDK_INSTALL_HINT}${e?.code ? `\uFF08${e.code}\uFF09` : ""}`);
4780
4788
  return { code: 1 };
4781
4789
  }
4782
- const bundle = await bootSdk(sdk, env.appId, env.secret, locale2, log);
4790
+ const bundle = await bootSdk(sdk, env.appId, env.secret, locale2, log, wsHooks);
4783
4791
  if (!bundle) {
4784
4792
  log(SDK_INSTALL_HINT);
4785
4793
  return { code: 1 };
@@ -4803,10 +4811,6 @@ var init_listen = __esm({
4803
4811
  projectRoot: deps?.projectRoot,
4804
4812
  locale: locale2
4805
4813
  };
4806
- let stopReason = null;
4807
- const requestStop = (why) => {
4808
- if (stopReason === null) stopReason = why;
4809
- };
4810
4814
  dispatcher.register({
4811
4815
  "im.message.receive_v1": async (data) => {
4812
4816
  try {
@@ -4850,9 +4854,7 @@ var init_listen = __esm({
4850
4854
  return { toast: { type: a.decision === "allow" ? "success" : "info", content: a.decision === "allow" ? "\u5DF2\u6279\u51C6\uFF08\u5355\u6B21\u751F\u6548\uFF09" : "\u5DF2\u62D2\u7EDD" } };
4851
4855
  }
4852
4856
  });
4853
- let wsExitCode = 0;
4854
- const wsStart = bundle.wsClient.start({ eventDispatcher: dispatcher });
4855
- void wsStart.then(() => requestStop("ws closed")).catch((e) => {
4857
+ void bundle.wsClient.start({ eventDispatcher: dispatcher }).catch((e) => {
4856
4858
  log(msg6(locale2, "wsFail", String(e?.message ?? e)));
4857
4859
  wsExitCode = 1;
4858
4860
  requestStop("ws error");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepseeker-code",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
4
4
  "description": "DeepSeeker-Code 终端客户端(React Ink,in-process 直驱 runAgent)",
5
5
  "homepage": "https://github.com/xknk/deepSeekCode#readme",
6
6
  "repository": {