feishu-codex-console 1.0.0-beta.6

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 (113) hide show
  1. package/.env.example +101 -0
  2. package/.feishu-codex-policy.example.json +11 -0
  3. package/.feishu-codex-runbooks.example.json +36 -0
  4. package/CHANGELOG.md +129 -0
  5. package/CODE_OF_CONDUCT.md +7 -0
  6. package/CONTRIBUTING.md +52 -0
  7. package/LICENSE +21 -0
  8. package/README.en.md +81 -0
  9. package/README.md +398 -0
  10. package/ROADMAP.md +40 -0
  11. package/SECURITY.md +53 -0
  12. package/dist/account-quota-card.js +233 -0
  13. package/dist/account-quota.js +125 -0
  14. package/dist/app-server-client.js +281 -0
  15. package/dist/card-session.js +166 -0
  16. package/dist/codex-events.js +1 -0
  17. package/dist/codex-runner.js +875 -0
  18. package/dist/config.js +198 -0
  19. package/dist/confirmation-card.js +135 -0
  20. package/dist/control-card.js +345 -0
  21. package/dist/conversation-turn-session.js +209 -0
  22. package/dist/data-maintenance.js +71 -0
  23. package/dist/device-card.js +460 -0
  24. package/dist/device-health.js +94 -0
  25. package/dist/diagnostics.js +253 -0
  26. package/dist/doctor.js +250 -0
  27. package/dist/fallback-card-session.js +37 -0
  28. package/dist/health-file.js +75 -0
  29. package/dist/index.js +4330 -0
  30. package/dist/lark-cli.js +558 -0
  31. package/dist/lark-retry.js +34 -0
  32. package/dist/maintenance.js +140 -0
  33. package/dist/model-capabilities.js +31 -0
  34. package/dist/onboarding-card.js +312 -0
  35. package/dist/permission-lease.js +22 -0
  36. package/dist/policy.js +506 -0
  37. package/dist/progress.js +267 -0
  38. package/dist/project-card.js +303 -0
  39. package/dist/project-overview-card.js +182 -0
  40. package/dist/project-overview.js +278 -0
  41. package/dist/project-policy.js +160 -0
  42. package/dist/project-registry.js +259 -0
  43. package/dist/project-status.js +45 -0
  44. package/dist/project-workspace.js +55 -0
  45. package/dist/quota-card.js +94 -0
  46. package/dist/recovery-policy.js +26 -0
  47. package/dist/redaction.js +67 -0
  48. package/dist/remote-ready.js +112 -0
  49. package/dist/response-card.js +139 -0
  50. package/dist/result-card.js +166 -0
  51. package/dist/review-card.js +452 -0
  52. package/dist/runbook-card.js +272 -0
  53. package/dist/runbooks.js +191 -0
  54. package/dist/runtime-card.js +337 -0
  55. package/dist/session-card.js +128 -0
  56. package/dist/session-naming.js +14 -0
  57. package/dist/smoke.js +28 -0
  58. package/dist/state-backup.js +302 -0
  59. package/dist/state-store.js +874 -0
  60. package/dist/task-card.js +640 -0
  61. package/dist/task-center-card.js +176 -0
  62. package/dist/task-failure.js +43 -0
  63. package/dist/task-intent.js +76 -0
  64. package/dist/task-queue.js +187 -0
  65. package/dist/task-reconciliation.js +80 -0
  66. package/dist/task-review.js +497 -0
  67. package/dist/team-card.js +275 -0
  68. package/dist/team-directory.js +54 -0
  69. package/dist/team-policy.js +93 -0
  70. package/dist/types.js +1 -0
  71. package/dist/version.js +9 -0
  72. package/dist/workspace-session.js +64 -0
  73. package/docs/ARCHITECTURE.md +54 -0
  74. package/docs/COMPATIBILITY.md +55 -0
  75. package/docs/CONFIGURATION.md +88 -0
  76. package/docs/DEMO.md +45 -0
  77. package/docs/GOOD_FIRST_ISSUES.md +23 -0
  78. package/docs/INSTALLATION.md +207 -0
  79. package/docs/OPEN_SOURCE_PRODUCT_PLAN.md +113 -0
  80. package/docs/PRODUCT_REQUIREMENTS_MAP.md +591 -0
  81. package/docs/RELEASE_CHECKLIST.md +65 -0
  82. package/docs/TEAM_DEPLOYMENT.md +35 -0
  83. package/docs/TROUBLESHOOTING.md +130 -0
  84. package/docs/V4_WORKSPACE_SESSION_FLOW.md +232 -0
  85. package/docs/requirements/D10_MAINTENANCE_AND_ECOSYSTEM.md +103 -0
  86. package/docs/requirements/D1_INSTALLATION_AND_FIRST_CONNECTION.md +479 -0
  87. package/docs/requirements/D2_DEVICE_AND_CONNECTIVITY.md +54 -0
  88. package/docs/requirements/D3_PROJECTS_AND_SESSIONS.md +107 -0
  89. package/docs/requirements/D4_REMOTE_TASK_EXECUTION.md +102 -0
  90. package/docs/requirements/D5_CODEX_NATIVE_INTERACTIONS.md +99 -0
  91. package/docs/requirements/D6_RESULTS_AND_CODE_REVIEW.md +100 -0
  92. package/docs/requirements/D7_SECURITY_GOVERNANCE.md +106 -0
  93. package/docs/requirements/D8_RELIABILITY_AND_RECOVERY.md +182 -0
  94. package/docs/requirements/D9_TEAM_COLLABORATION.md +129 -0
  95. package/package.json +76 -0
  96. package/scripts/capability-probe.mjs +113 -0
  97. package/scripts/cli.mjs +919 -0
  98. package/scripts/config-file.mjs +137 -0
  99. package/scripts/discovery-lib.mjs +78 -0
  100. package/scripts/install-card.mjs +37 -0
  101. package/scripts/install-detection.mjs +126 -0
  102. package/scripts/install-state.mjs +107 -0
  103. package/scripts/launchd.mjs +161 -0
  104. package/scripts/migrate-legacy.mjs +97 -0
  105. package/scripts/package-smoke.mjs +163 -0
  106. package/scripts/release-dist-tag.mjs +7 -0
  107. package/scripts/runbook-template.mjs +36 -0
  108. package/scripts/service-health.mjs +110 -0
  109. package/scripts/service.mjs +24 -0
  110. package/scripts/setup-lib.mjs +118 -0
  111. package/scripts/systemd.mjs +96 -0
  112. package/scripts/upgrade-lib.mjs +99 -0
  113. package/scripts/verify-release.mjs +37 -0
@@ -0,0 +1,99 @@
1
+ export function assessUpgradeReadiness(options) {
2
+ const currentVersion = normalizeVersion(options.currentVersion);
3
+ const targetVersion = normalizeVersion(options.targetVersion);
4
+ const activeTasks = Math.max(
5
+ Number(options.healthActiveTasks ?? 0),
6
+ Number(options.databaseActiveTasks ?? 0),
7
+ );
8
+ const warnings = [];
9
+ if (activeTasks > 0) {
10
+ return {
11
+ allowed: false,
12
+ reason: `仍有 ${activeTasks} 个运行任务;请等待完成或在飞书停止后再升级`,
13
+ currentVersion,
14
+ targetVersion,
15
+ warnings,
16
+ };
17
+ }
18
+ if (currentVersion === "unknown") {
19
+ warnings.push("当前服务未报告产品版本;数据仍会先备份,但失败时可能需要手工恢复旧包");
20
+ } else {
21
+ const direction = compareVersions(targetVersion, currentVersion);
22
+ if (direction < 0 && !options.allowDowngrade) {
23
+ return {
24
+ allowed: false,
25
+ reason: `目标 ${targetVersion} 低于当前 ${currentVersion};降级需要 --allow-downgrade`,
26
+ currentVersion,
27
+ targetVersion,
28
+ warnings,
29
+ };
30
+ }
31
+ if (direction === 0 && !options.force) {
32
+ return {
33
+ allowed: false,
34
+ upToDate: true,
35
+ reason: `当前服务已经是 ${targetVersion}`,
36
+ currentVersion,
37
+ targetVersion,
38
+ warnings,
39
+ };
40
+ }
41
+ }
42
+ return {
43
+ allowed: true,
44
+ currentVersion,
45
+ targetVersion,
46
+ warnings,
47
+ };
48
+ }
49
+
50
+ export function parseBackupId(output) {
51
+ const match = String(output).match(/备份 ID[::]\s*([^\s]+)/);
52
+ return match?.[1] ?? null;
53
+ }
54
+
55
+ export function compareVersions(left, right) {
56
+ const a = versionParts(left);
57
+ const b = versionParts(right);
58
+ for (let index = 0; index < 3; index += 1) {
59
+ const delta = (a.core[index] ?? 0) - (b.core[index] ?? 0);
60
+ if (delta !== 0) return Math.sign(delta);
61
+ }
62
+ if (a.pre.length === 0 && b.pre.length > 0) return 1;
63
+ if (a.pre.length > 0 && b.pre.length === 0) return -1;
64
+ const length = Math.max(a.pre.length, b.pre.length);
65
+ for (let index = 0; index < length; index += 1) {
66
+ const leftPart = a.pre[index];
67
+ const rightPart = b.pre[index];
68
+ if (leftPart === undefined) return -1;
69
+ if (rightPart === undefined) return 1;
70
+ if (leftPart === rightPart) continue;
71
+ const leftNumber = Number(leftPart);
72
+ const rightNumber = Number(rightPart);
73
+ if (Number.isFinite(leftNumber) && Number.isFinite(rightNumber)) {
74
+ return Math.sign(leftNumber - rightNumber);
75
+ }
76
+ if (Number.isFinite(leftNumber)) return -1;
77
+ if (Number.isFinite(rightNumber)) return 1;
78
+ return leftPart.localeCompare(rightPart);
79
+ }
80
+ return 0;
81
+ }
82
+
83
+ function normalizeVersion(value) {
84
+ if (!value || value === "unknown") return "unknown";
85
+ const normalized = String(value).trim().replace(/^v/, "");
86
+ versionParts(normalized);
87
+ return normalized;
88
+ }
89
+
90
+ function versionParts(value) {
91
+ const match = String(value).match(
92
+ /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/,
93
+ );
94
+ if (!match) throw new Error(`无效版本号:${value}`);
95
+ return {
96
+ core: [Number(match[1]), Number(match[2]), Number(match[3])],
97
+ pre: match[4]?.split(".") ?? [],
98
+ };
99
+ }
@@ -0,0 +1,37 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
6
+ const manifest = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
7
+ const tag = (process.env.GITHUB_REF_NAME ?? process.argv[2] ?? "").trim();
8
+
9
+ if (!tag) throw new Error("Release tag is required through GITHUB_REF_NAME or the first argument.");
10
+ if (tag !== `v${manifest.version}`) {
11
+ throw new Error(`Tag ${tag} does not match package version ${manifest.version}. Expected v${manifest.version}.`);
12
+ }
13
+ if (manifest.private) throw new Error("package.json is still marked private.");
14
+ if (!manifest.bin?.["feishu-codex-bridge"]) {
15
+ throw new Error("package.json does not expose the feishu-codex-bridge binary.");
16
+ }
17
+ if (!manifest.bin?.[manifest.name]) {
18
+ throw new Error(`package.json does not expose a binary matching ${manifest.name}.`);
19
+ }
20
+ const compatibility = await readFile(path.join(packageRoot, "docs", "COMPATIBILITY.md"), "utf8");
21
+ for (const expected of [
22
+ `@openai/codex \`${manifest.dependencies?.["@openai/codex"]}\``,
23
+ `@larksuite/cli \`${manifest.dependencies?.["@larksuite/cli"]}\``,
24
+ "BRIDGE_CONFIG_VERSION=1",
25
+ "persisted state v6",
26
+ "SQLite schema v1",
27
+ ]) {
28
+ if (!compatibility.includes(expected)) {
29
+ throw new Error(`docs/COMPATIBILITY.md is missing release contract: ${expected}`);
30
+ }
31
+ }
32
+ for (const required of ["README.en.md", "ROADMAP.md", "CONTRIBUTING.md"]) {
33
+ if (!manifest.files?.includes(required)) {
34
+ throw new Error(`Published file allowlist is missing ${required}.`);
35
+ }
36
+ }
37
+ console.log(`Release metadata verified for ${manifest.name}@${manifest.version}.`);