aai-lark-bridge 0.2.26 → 0.2.27

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.26",
7
+ version: "0.2.27",
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",
@@ -7304,6 +7304,16 @@ function seatFromEnv(env) {
7304
7304
  const list = (env.SDLC_CLAUDE_SEAT_LIST ?? "").split(",").map((s) => s.trim()).filter((s) => /^ou_[A-Za-z0-9_-]{1,100}$/.test(s));
7305
7305
  return { mode, list };
7306
7306
  }
7307
+ function codeShape(code) {
7308
+ const c = code.trim();
7309
+ const i = c.indexOf("#");
7310
+ return i < 0 ? `len=${c.length} hash=no` : `len=${c.length} hash=yes head=${i} tail=${c.length - i - 1}`;
7311
+ }
7312
+ function scrub(text, code) {
7313
+ let t = text;
7314
+ for (const part of code.trim().split("#")) if (part.length >= 6) t = t.split(part).join("<code>");
7315
+ return t.replace(/[A-Za-z0-9_-]{40,}/g, "<long>").replace(/\s+/g, " ").trim().slice(0, 300);
7316
+ }
7307
7317
  function realClaudeCli(binary = process.env.SDLC_REAL_CLAUDE || "claude") {
7308
7318
  const baseEnv = (dir) => {
7309
7319
  const keep = Object.fromEntries(Object.entries(process.env).filter(([k]) => /^(PATH|LANG|https?_proxy|no_proxy|HTTPS?_PROXY|NO_PROXY)$/.test(k)));
@@ -7362,11 +7372,16 @@ function realClaudeCli(binary = process.env.SDLC_REAL_CLAUDE || "claude") {
7362
7372
  setTimeout(() => resolve3("invalid"), SUBMIT_MAX_MS).unref();
7363
7373
  });
7364
7374
  clearTimeout(timer);
7365
- if (verdict === "invalid") {
7366
- p3.kill("SIGTERM");
7367
- return false;
7375
+ const ok = verdict !== "invalid" && verdict === 0 && /Login successful/i.test(out);
7376
+ if (!ok) {
7377
+ log.warn("user-gateway", "claude.login-submit-failed", {
7378
+ verdict: verdict === "invalid" ? "invalid-or-timeout" : `exit-${verdict}`,
7379
+ codeShape: codeShape(code),
7380
+ cliOutput: scrub(out.slice(before), code)
7381
+ });
7368
7382
  }
7369
- return verdict === 0 && /Login successful/i.test(out);
7383
+ if (verdict === "invalid") p3.kill("SIGTERM");
7384
+ return ok;
7370
7385
  },
7371
7386
  cancel() {
7372
7387
  clearTimeout(timer);