@modelzen/feishu-codex-bridge 0.3.6 → 0.3.7

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.js +20 -37
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1111,7 +1111,7 @@ async function registerNewBot(desiredName) {
1111
1111
  await addBot({ name, appId: app.id, tenant: app.tenant, botName: v.botName, createdAt: Date.now() });
1112
1112
  console.log(`\u2713 \u5DF2\u521B\u5EFA\u673A\u5668\u4EBA\u300C${name}\u300D bot: ${v.botName ?? "-"} appId: ${app.id}`);
1113
1113
  log.info("onboard", "bot-created", { name, appId: app.id, bot: v.botName ?? null });
1114
- showScopeGrant(cfg, v.missingScopes);
1114
+ noticeMissingScopes(cfg, v.missingScopes);
1115
1115
  const secret = await resolveAppSecret(cfg);
1116
1116
  return { cfg, secret, missingScopes: v.missingScopes };
1117
1117
  }
@@ -1125,28 +1125,12 @@ async function validateAndReport(cfg) {
1125
1125
  }
1126
1126
  console.log(`\u2713 \u51ED\u636E\u6821\u9A8C\u901A\u8FC7 bot: ${v.botName ?? "-"} appId: ${cfg.accounts.app.id}`);
1127
1127
  log.info("onboard", "credentials-ok", { appId: cfg.accounts.app.id, bot: v.botName ?? null });
1128
- showScopeGrant(cfg, v.missingScopes);
1128
+ noticeMissingScopes(cfg, v.missingScopes);
1129
1129
  return { secret, missingScopes: v.missingScopes };
1130
1130
  }
1131
1131
  async function confirmReadyForDaemon(result) {
1132
1132
  if (!process.stdin.isTTY) return true;
1133
1133
  const { app } = result.cfg.accounts;
1134
- let missing = result.missingScopes;
1135
- while (missing && missing.length > 0) {
1136
- const url = buildScopeGrantUrl(app.id, app.tenant);
1137
- console.log(`
1138
- \u23F3 \u8FD8\u5DEE ${missing.length} \u9879\u6743\u9650\u672A\u5F00\u901A\uFF0C\u540E\u53F0\u670D\u52A1\u6682\u4E0D\u5B89\u88C5\u3002`);
1139
- console.log(` \u5F00\u901A\u9875\uFF1A${url}`);
1140
- await promptEnter(" \u5728\u6D4F\u89C8\u5668\u52FE\u9009\u5168\u90E8\u6743\u9650\u5E76\u786E\u8BA4\u540E\uFF0C\u6309 Enter \u91CD\u65B0\u68C0\u6D4B\uFF08Ctrl+C \u53D6\u6D88\uFF09\u2026 ");
1141
- const v = await validateAppCredentials(app.id, result.secret, app.tenant);
1142
- if (!v.ok) {
1143
- console.error(`\u2717 \u51ED\u636E\u6821\u9A8C\u5931\u8D25\uFF1A${v.reason}`);
1144
- return false;
1145
- }
1146
- missing = v.missingScopes;
1147
- if (missing && missing.length > 0) console.log(` \u4ECD\u7F3A\uFF1A${missing.join(" ")}`);
1148
- }
1149
- console.log("\u2713 \u6743\u9650\u5DF2\u5F00\u901A\u3002");
1150
1134
  const eventUrl = buildEventConfigUrl(app.id, app.tenant);
1151
1135
  const opened = openUrl(eventUrl);
1152
1136
  console.log("\n\u6700\u540E\u8FD9\u51E0\u6B65\u98DE\u4E66\u6CA1\u6709 API/\u6DF1\u94FE\u53EF\u4EE3\u529E\uFF08\u8FDE\u67E5\u8BE2\u8BA2\u9605\u72B6\u6001\u7684\u63A5\u53E3\u90FD\u6CA1\u6709\uFF09\uFF0C\u9700\u4F60\u624B\u52A8\u70B9\uFF1A\n");
@@ -1178,27 +1162,26 @@ async function promptEnter(message) {
1178
1162
  rl.close();
1179
1163
  }
1180
1164
  }
1181
- function showScopeGrant(cfg, missingScopes) {
1182
- if (missingScopes && missingScopes.length > 0) {
1183
- const url = buildScopeGrantUrl(cfg.accounts.app.id, cfg.accounts.app.tenant);
1184
- const rule = "\u2500".repeat(64);
1185
- const opened = openUrl(url);
1186
- console.log(`
1187
- ${rule}`);
1188
- console.log(`\u26A0\uFE0F \u8FD8\u5DEE ${missingScopes.length} \u9879\u6743\u9650\u672A\u5F00\u901A \u2014\u2014 \u4E0D\u5F00\u901A\u5219\u6536\u4E0D\u5230\u6D88\u606F\u3001\u53D1\u4E0D\u51FA\u5361\u7247`);
1189
- console.log(" \u98DE\u4E66\u6CA1\u6709\u300C\u626B\u7801\u5373\u6388\u6743\u300D\u7684\u63A5\u53E3\uFF0C\u53EA\u80FD\u5728\u6D4F\u89C8\u5668\u5F00\u901A\uFF08\u5373\u65F6\u751F\u6548\uFF0C\u65E0\u9700\u91CD\u542F\uFF09\uFF1A");
1190
- console.log(
1191
- opened ? "\n \u{1F310} \u5DF2\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\u6388\u6743\u9875\u3002\u82E5\u6CA1\u5F39\u51FA\uFF0C\u624B\u52A8\u590D\u5236\u4E0B\u9762\u94FE\u63A5\u6253\u5F00\uFF1A" : "\n \u{1F310} \u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4E0B\u9762\u94FE\u63A5\uFF0C\u52FE\u9009\u5168\u90E8\u6743\u9650 \u2192 \u786E\u8BA4\uFF1A"
1192
- );
1193
- console.log(`
1194
- \u{1F449} ${url}
1195
- `);
1196
- console.log(` \uFF08\u672C\u6B21\u7F3A\u5931\uFF1A${missingScopes.join(" ")}\uFF09`);
1197
- console.log(`${rule}
1198
- `);
1199
- } else if (missingScopes === void 0) {
1165
+ function noticeMissingScopes(cfg, missingScopes) {
1166
+ if (missingScopes === void 0) {
1200
1167
  log.info("onboard", "scope-check-skipped", { reason: "scope list unavailable" });
1168
+ return;
1201
1169
  }
1170
+ if (missingScopes.length === 0) return;
1171
+ const url = buildScopeGrantUrl(cfg.accounts.app.id, cfg.accounts.app.tenant);
1172
+ const opened = openUrl(url);
1173
+ const rule = "-".repeat(64);
1174
+ console.log(`
1175
+ ${rule}`);
1176
+ console.log(`\u26A0\uFE0F \u7F3A ${missingScopes.length} \u9879\u6743\u9650\uFF08\u4E0D\u5F71\u54CD\u542F\u52A8\uFF0C\u4F46\u8FD9\u4E9B\u529F\u80FD\u5F00\u901A\u524D\u7528\u4E0D\u4E86\uFF09\uFF1A`);
1177
+ for (const s of missingScopes) console.log(` \xB7 ${labelScope(s)}`);
1178
+ console.log(
1179
+ opened ? "\u{1F310} \u5DF2\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\u6388\u6743\u9875\uFF08\u5373\u65F6\u751F\u6548\u3001\u65E0\u9700\u91CD\u542F\uFF09\uFF1A" : " \u53BB\u8FD9\u91CC\u7533\u8BF7\uFF08\u52FE\u9009 \u2192 \u786E\u8BA4\uFF0C\u5373\u65F6\u751F\u6548\u3001\u65E0\u9700\u91CD\u542F\uFF09\uFF1A"
1180
+ );
1181
+ console.log(` \u{1F449} ${url}`);
1182
+ console.log(" \u4E0D\u60F3\u73B0\u5728\u5F04\u4E5F\u884C\uFF1A\u4E4B\u540E\u79C1\u804A\u673A\u5668\u4EBA \u2192\u300C\u{1FA7A} \u8BCA\u65AD\u300D\u53EF\u968F\u65F6\u518D\u7533\u8BF7\u3002");
1183
+ console.log(`${rule}
1184
+ `);
1202
1185
  }
1203
1186
 
1204
1187
  // src/bot/bridge.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelzen/feishu-codex-bridge",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Bridge Feishu/Lark messenger with local Codex via app-server (project=group, thread=session)",
5
5
  "type": "module",
6
6
  "bin": {