aai-lark-bridge 0.2.17 → 0.2.18

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/cli.js CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "aai-lark-bridge",
7
- version: "0.2.17",
7
+ version: "0.2.18",
8
8
  description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
9
9
  type: "module",
10
10
  main: "./dist/index.js",
@@ -7105,6 +7105,7 @@ import { join as join19 } from "path";
7105
7105
  var LOGOUT_TEXT = "\u9000\u51FA Claude \u767B\u5F55";
7106
7106
  var MIN_TOKEN_LEFT_MS = 2 * 60 * 6e4;
7107
7107
  var LOGIN_MAX_MS = 10 * 6e4;
7108
+ var SUBMIT_MAX_MS = 3e4;
7108
7109
  function readCredentials(dir) {
7109
7110
  const f = join19(dir, ".credentials.json");
7110
7111
  if (!existsSync6(f)) return void 0;
@@ -7330,11 +7331,25 @@ function realClaudeCli(binary = process.env.SDLC_REAL_CLAUDE || "claude") {
7330
7331
  return {
7331
7332
  url,
7332
7333
  async submit(code) {
7334
+ const before = out.length;
7333
7335
  p3.stdin.end(`${code}
7334
7336
  `);
7335
- const rc = await exited;
7337
+ const verdict = await new Promise((resolve3) => {
7338
+ const check2 = () => {
7339
+ if (/Invalid code/i.test(out.slice(before))) resolve3("invalid");
7340
+ };
7341
+ p3.stdout.on("data", check2);
7342
+ p3.stderr.on("data", check2);
7343
+ check2();
7344
+ void exited.then(resolve3);
7345
+ setTimeout(() => resolve3("invalid"), SUBMIT_MAX_MS).unref();
7346
+ });
7336
7347
  clearTimeout(timer);
7337
- return rc === 0 && /Login successful/i.test(out);
7348
+ if (verdict === "invalid") {
7349
+ p3.kill("SIGTERM");
7350
+ return false;
7351
+ }
7352
+ return verdict === 0 && /Login successful/i.test(out);
7338
7353
  },
7339
7354
  cancel() {
7340
7355
  clearTimeout(timer);