hypercore-cli 1.1.2 → 1.3.0

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 (158) hide show
  1. package/LICENSE +92 -21
  2. package/README.md +8 -1
  3. package/dist/App-YMX7FSXR.js +1 -0
  4. package/dist/api-Q2TX5JJL.js +1 -0
  5. package/dist/auth-X6CUT3DW.js +1 -0
  6. package/dist/background-ACODXSUG.js +1 -0
  7. package/dist/backlog-JD2IM336.js +1 -0
  8. package/dist/chunk-2QI2IU2V.js +1 -0
  9. package/dist/chunk-3KFRDIPQ.js +1 -0
  10. package/dist/chunk-42C5J7PN.js +1 -0
  11. package/dist/chunk-4D7XVJ7Q.js +1 -0
  12. package/dist/chunk-545IGTXV.js +1 -0
  13. package/dist/chunk-5KUSGQP2.js +1 -0
  14. package/dist/chunk-AUQ64BK2.js +1 -0
  15. package/dist/chunk-AV244H5C.js +1 -0
  16. package/dist/chunk-BQVBEFS4.js +1 -0
  17. package/dist/chunk-BYWQLFP2.js +1 -0
  18. package/dist/chunk-COITWWZJ.js +1 -0
  19. package/dist/chunk-CR7UUJVX.js +1 -0
  20. package/dist/chunk-E3MULLBX.js +1 -0
  21. package/dist/chunk-EWBV7YPP.js +1 -0
  22. package/dist/chunk-EZHYVJGQ.js +1 -0
  23. package/dist/chunk-FAKXBY7Q.js +1 -0
  24. package/dist/chunk-FHGATV5B.js +1 -0
  25. package/dist/chunk-I2G27Y5P.js +1 -0
  26. package/dist/chunk-IKF43TX2.js +1 -0
  27. package/dist/chunk-INSPHCBN.js +1 -0
  28. package/dist/chunk-LQMDUKIE.js +1 -0
  29. package/dist/chunk-M3MTKGA5.js +1 -0
  30. package/dist/chunk-MPO54FU3.js +1 -0
  31. package/dist/chunk-PVKCZI6A.js +1 -0
  32. package/dist/chunk-Q7KEPCYL.js +1 -0
  33. package/dist/chunk-R5XD3NT2.js +1 -0
  34. package/dist/chunk-ROBZ6PAL.js +1 -0
  35. package/dist/chunk-RXB5BS2N.js +1 -0
  36. package/dist/chunk-RZ3HNYMT.js +1 -0
  37. package/dist/chunk-UCGLRMTG.js +1 -0
  38. package/dist/chunk-UEHJVRKB.js +1 -0
  39. package/dist/chunk-UZYX5GGF.js +1 -0
  40. package/dist/chunk-XQJBB725.js +1 -0
  41. package/dist/chunk-ZB5ZQSXH.js +1 -0
  42. package/dist/claude-US2QPRBA.js +1 -0
  43. package/dist/commands-5TFN74MD.js +1 -0
  44. package/dist/commands-EKPWCB3T.js +1 -0
  45. package/dist/commands-QHJLREPM.js +1 -0
  46. package/dist/config-2OUL5FLS.js +1 -0
  47. package/dist/config-loader-N7IBWN2P.js +1 -0
  48. package/dist/diagnose-NLHN4SAJ.js +1 -0
  49. package/dist/display-TB5YACJV.js +1 -0
  50. package/dist/extractor-3KTM2IUL.js +1 -0
  51. package/dist/feature-flag-VVIF5FJG.js +1 -0
  52. package/dist/history-GVNDPXXQ.js +1 -0
  53. package/dist/index.js +1 -402
  54. package/dist/instance-registry-I5AIVJE2.js +1 -0
  55. package/dist/keybindings-RN3A7CRW.js +1 -0
  56. package/dist/loader-3IKPXP4R.js +1 -0
  57. package/dist/network-GI2F3IDE.js +1 -0
  58. package/dist/notify-O6FNVHC4.js +1 -0
  59. package/dist/openai-compat-IPCMINVF.js +1 -0
  60. package/dist/permissions-5O7KVAXU.js +1 -0
  61. package/dist/prompt-VWFPFM4N.js +1 -0
  62. package/dist/quality-GPQD25UL.js +1 -0
  63. package/dist/repl-YNXCDVU4.js +1 -0
  64. package/dist/roadmap-QRZODSNJ.js +1 -0
  65. package/dist/server-USQP4GC4.js +1 -0
  66. package/dist/session-5HDDQQP6.js +1 -0
  67. package/dist/skills-DXWSVJSU.js +1 -0
  68. package/dist/store-WXXTKTTL.js +1 -0
  69. package/dist/team-VTPJ3WRT.js +1 -0
  70. package/dist/telemetry-NT4UZLBS.js +1 -0
  71. package/dist/test-runner-F6B6RH3S.js +1 -0
  72. package/dist/theme-JJJ6ABR2.js +1 -0
  73. package/dist/upgrade-RUG3R7R5.js +1 -0
  74. package/dist/verify-6OGRY2PR.js +1 -0
  75. package/dist/version-DLROA5JN.js +1 -0
  76. package/dist/web/static/app.js +1 -562
  77. package/dist/web/static/index.html +114 -126
  78. package/dist/web/static/mirror.css +1 -1001
  79. package/dist/web/static/mirror.html +155 -178
  80. package/dist/web/static/mirror.js +1 -1125
  81. package/dist/web/static/onboard.css +1 -302
  82. package/dist/web/static/onboard.html +121 -145
  83. package/dist/web/static/onboard.js +1 -300
  84. package/dist/web/static/style.css +1 -602
  85. package/dist/web/static/utils.js +1 -0
  86. package/dist/web/static/workspace.css +1 -1568
  87. package/dist/web/static/workspace.html +369 -402
  88. package/dist/web/static/workspace.js +1 -1683
  89. package/dist/web-P5YUKEAU.js +1 -0
  90. package/package.json +25 -4
  91. package/dist/api-JHHOZTL6.js +0 -162
  92. package/dist/auth-5QFJLW7J.js +0 -21
  93. package/dist/background-2EGCAAQH.js +0 -14
  94. package/dist/backlog-Q2NZCLNY.js +0 -24
  95. package/dist/chunk-2CMSCWQW.js +0 -162
  96. package/dist/chunk-4DVYJAJL.js +0 -57
  97. package/dist/chunk-5GDYH676.js +0 -271
  98. package/dist/chunk-5NLVGLD7.js +0 -66
  99. package/dist/chunk-6XTEAFZQ.js +0 -575
  100. package/dist/chunk-AQBSMYLT.js +0 -2025
  101. package/dist/chunk-BE46C7JW.js +0 -46
  102. package/dist/chunk-CLKIMCXZ.js +0 -139
  103. package/dist/chunk-DN4ASQ26.js +0 -167
  104. package/dist/chunk-DUWREZXK.js +0 -173
  105. package/dist/chunk-FCW3K6F2.js +0 -263
  106. package/dist/chunk-GFORWAMW.js +0 -251
  107. package/dist/chunk-GH7E2OJE.js +0 -223
  108. package/dist/chunk-GU2FZQ6A.js +0 -69
  109. package/dist/chunk-I7WI3BMB.js +0 -161
  110. package/dist/chunk-IOPKN5GD.js +0 -190
  111. package/dist/chunk-LBVHDGZE.js +0 -133
  112. package/dist/chunk-MGLJ53QN.js +0 -219
  113. package/dist/chunk-NETIY5UB.js +0 -134
  114. package/dist/chunk-NP47L7LG.js +0 -288
  115. package/dist/chunk-O6MG7TOH.js +0 -58
  116. package/dist/chunk-OPZYEVYR.js +0 -150
  117. package/dist/chunk-R3GPQC7I.js +0 -393
  118. package/dist/chunk-R5T3A2NQ.js +0 -166
  119. package/dist/chunk-RKB2JOV2.js +0 -43
  120. package/dist/chunk-RNG3K465.js +0 -80
  121. package/dist/chunk-TGTYKBGC.js +0 -86
  122. package/dist/chunk-UCX4VZCT.js +0 -681
  123. package/dist/chunk-WHLVZCQY.js +0 -245
  124. package/dist/chunk-Y6HMJZDJ.js +0 -1505
  125. package/dist/chunk-ZSBHUGWR.js +0 -262
  126. package/dist/claude-4BX3MJSK.js +0 -12
  127. package/dist/commands-2X4OB5RF.js +0 -128
  128. package/dist/commands-GLBCEVQK.js +0 -1044
  129. package/dist/commands-IINRNBYX.js +0 -232
  130. package/dist/config-RSNQJQPS.js +0 -8
  131. package/dist/config-loader-SXO674TF.js +0 -24
  132. package/dist/diagnose-7UPLS7I4.js +0 -12
  133. package/dist/display-IIUBEYWN.js +0 -58
  134. package/dist/extractor-D3XWOAXI.js +0 -129
  135. package/dist/history-6I6FADAU.js +0 -180
  136. package/dist/index.d.ts +0 -1
  137. package/dist/instance-registry-J7UJ7U4Z.js +0 -15
  138. package/dist/keybindings-PDXIOV3O.js +0 -15
  139. package/dist/loader-GKEYT6Y7.js +0 -58
  140. package/dist/network-JYGHQXAR.js +0 -279
  141. package/dist/notify-HPTALZDC.js +0 -14
  142. package/dist/openai-compat-R7EKWG6Z.js +0 -12
  143. package/dist/permissions-JUKXMNDH.js +0 -10
  144. package/dist/prompt-UWHSZU4P.js +0 -166
  145. package/dist/quality-ST7PPNFR.js +0 -16
  146. package/dist/repl-QHIZ2JGF.js +0 -3374
  147. package/dist/roadmap-5OBEKROY.js +0 -17
  148. package/dist/server-HCNIP7ZQ.js +0 -57
  149. package/dist/session-5EBECDUP.js +0 -21
  150. package/dist/skills-HBQQTYO4.js +0 -175
  151. package/dist/store-FKUTR7GW.js +0 -25
  152. package/dist/team-7BBBP5YQ.js +0 -385
  153. package/dist/telemetry-6R4EIE6O.js +0 -30
  154. package/dist/test-runner-AUAGIBNM.js +0 -619
  155. package/dist/theme-3SYJ3UQA.js +0 -14
  156. package/dist/upgrade-MZFH7OCN.js +0 -83
  157. package/dist/verify-JUDKTPKZ.js +0 -14
  158. package/dist/web-KS3FUGJA.js +0 -39
@@ -1,58 +0,0 @@
1
- import {
2
- CATEGORY_LABELS,
3
- DEFAULT_EXTRACTION_CONFIG,
4
- loadStore
5
- } from "./chunk-GFORWAMW.js";
6
- import "./chunk-I7WI3BMB.js";
7
-
8
- // src/memory/loader.ts
9
- async function loadMemoryForSystemPrompt(opts) {
10
- const maxChars = opts?.maxChars || DEFAULT_EXTRACTION_CONFIG.maxSystemPromptChars;
11
- const loadedLayers = [];
12
- const summaries = [];
13
- const personalSummary = await buildLayerSummary("personal");
14
- if (personalSummary) {
15
- summaries.push(personalSummary);
16
- loadedLayers.push("personal");
17
- }
18
- const projectSummary = await buildLayerSummary("project", { projectPath: opts?.projectPath });
19
- if (projectSummary) {
20
- summaries.push(projectSummary);
21
- loadedLayers.push("project");
22
- }
23
- if (opts?.teamId) {
24
- const teamSummary = await buildLayerSummary("team", { teamId: opts.teamId });
25
- if (teamSummary) {
26
- summaries.push(teamSummary);
27
- loadedLayers.push("team");
28
- }
29
- }
30
- if (summaries.length === 0) {
31
- return { memoryBlock: "", layers: [] };
32
- }
33
- let combined = "\n\n--- Persistent Memory ---\n" + summaries.join("\n") + "\n\u5982\u9700\u8BE6\u60C5\u8BF7\u8C03\u7528 memory_search \u5DE5\u5177\u68C0\u7D22\u3002\n\u53D1\u73B0\u91CD\u8981\u4FE1\u606F\u65F6\u8BF7\u4E3B\u52A8\u8C03\u7528 memory_save \u5DE5\u5177\u4FDD\u5B58\u3002\n--- End Persistent Memory ---\n";
34
- if (combined.length > maxChars) {
35
- combined = combined.slice(0, maxChars - 50) + "\n... [\u6458\u8981\u5DF2\u622A\u65AD\uFF0C\u7528 memory_search \u67E5\u8BE2\u8BE6\u60C5] ...\n--- End Persistent Memory ---\n";
36
- }
37
- return { memoryBlock: combined, layers: loadedLayers };
38
- }
39
- async function buildLayerSummary(layer, opts) {
40
- const store = await loadStore(layer, opts);
41
- if (store.records.length === 0) return null;
42
- const grouped = {};
43
- for (const r of store.records) {
44
- if (!grouped[r.category]) grouped[r.category] = [];
45
- grouped[r.category].push(r);
46
- }
47
- const lines = [`[${layer} \u8BB0\u5FC6 \xB7 ${store.records.length} \u6761]`];
48
- for (const [category, records] of Object.entries(grouped)) {
49
- const label = CATEGORY_LABELS[category] || category;
50
- const top = records.sort((a, b) => b.confidence - a.confidence).slice(0, 2).map((r) => r.content);
51
- const extra = records.length > 2 ? ` (+${records.length - 2}\u6761)` : "";
52
- lines.push(` ${label}: ${top.join("; ")}${extra}`);
53
- }
54
- return lines.join("\n");
55
- }
56
- export {
57
- loadMemoryForSystemPrompt
58
- };
@@ -1,279 +0,0 @@
1
- import {
2
- executeRound,
3
- gatherProfile,
4
- getLatestRound,
5
- listRounds,
6
- loadNetworkConfig,
7
- saveNetworkConfig,
8
- startAutoRound,
9
- stopAutoRound,
10
- updateProfileField
11
- } from "./chunk-UCX4VZCT.js";
12
- import "./chunk-DN4ASQ26.js";
13
- import "./chunk-DUWREZXK.js";
14
- import {
15
- loadLocalToken
16
- } from "./chunk-5NLVGLD7.js";
17
- import {
18
- showError
19
- } from "./chunk-R3GPQC7I.js";
20
- import "./chunk-BE46C7JW.js";
21
- import "./chunk-RNG3K465.js";
22
- import "./chunk-FCW3K6F2.js";
23
- import "./chunk-5GDYH676.js";
24
- import "./chunk-CLKIMCXZ.js";
25
- import {
26
- loadConfig
27
- } from "./chunk-I7WI3BMB.js";
28
-
29
- // src/commands/network.ts
30
- import chalk from "chalk";
31
- async function requireToken() {
32
- const token = await loadLocalToken();
33
- if (!token) {
34
- showError("\u672A\u52A0\u5165\u4EFB\u4F55\u56E2\u961F\u3002\u8BF7\u5148 hyper team create \u6216 hyper team join");
35
- return null;
36
- }
37
- return token;
38
- }
39
- async function networkProfileCommand(field, values) {
40
- const token = await requireToken();
41
- if (!token) return;
42
- if (!field) {
43
- const profile2 = await gatherProfile(token.teamId, token.memberId, token.memberName);
44
- displayProfile(profile2);
45
- return;
46
- }
47
- const validFields = ["skills", "needs", "offerings", "customNote"];
48
- if (!validFields.includes(field)) {
49
- console.log(chalk.dim(`
50
- \u7528\u6CD5: hyper network profile [${validFields.join("|")}] <\u503C>
51
- `));
52
- return;
53
- }
54
- if (!values || values.length === 0) {
55
- showError(`\u8BF7\u63D0\u4F9B ${field} \u7684\u503C`);
56
- return;
57
- }
58
- const valueStr = values.join(" ");
59
- let parsedValue;
60
- if (field === "customNote") {
61
- parsedValue = valueStr;
62
- } else {
63
- parsedValue = valueStr.split(/[,,]/).map((s) => s.trim()).filter(Boolean);
64
- }
65
- const profile = await updateProfileField(
66
- token.teamId,
67
- token.memberId,
68
- field,
69
- parsedValue
70
- );
71
- if (!profile) {
72
- await gatherProfile(token.teamId, token.memberId, token.memberName);
73
- const updated = await updateProfileField(
74
- token.teamId,
75
- token.memberId,
76
- field,
77
- parsedValue
78
- );
79
- if (updated) displayProfile(updated);
80
- } else {
81
- displayProfile(profile);
82
- }
83
- }
84
- async function networkRunCommand() {
85
- const token = await requireToken();
86
- if (!token) return;
87
- const config = await loadConfig();
88
- console.log(chalk.cyan("\n \u{1F310} Hyper Network \u2014 \u6267\u884C\u7F51\u7EDC\u5339\u914D\u8F6E\u6B21\n"));
89
- try {
90
- const round = await executeRound(token.teamId, token.memberId, config, (stage, detail) => {
91
- const icons = {
92
- gather: "\u{1F4CB}",
93
- match: "\u{1F50D}",
94
- dialogue: "\u{1F4AC}",
95
- digest: "\u{1F4DD}",
96
- done: "\u2705"
97
- };
98
- console.log(` ${icons[stage] || "\xB7"} ${chalk.dim(detail || stage)}`);
99
- });
100
- console.log();
101
- displayRoundSummary(round);
102
- } catch (err) {
103
- showError(`\u6267\u884C\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
104
- }
105
- }
106
- async function networkDigestCommand() {
107
- const token = await requireToken();
108
- if (!token) return;
109
- const latestRound = await getLatestRound(token.teamId);
110
- if (!latestRound) {
111
- console.log(chalk.dim("\n \u6682\u65E0\u7F51\u7EDC\u5339\u914D\u8BB0\u5F55\u3002\u8BF7\u5148\u8FD0\u884C hyper network run\n"));
112
- return;
113
- }
114
- const myDigest = latestRound.digests.find((d) => d.memberId === token.memberId);
115
- if (!myDigest) {
116
- console.log(chalk.dim("\n \u6700\u8FD1\u4E00\u8F6E\u6CA1\u6709\u4F60\u7684\u5339\u914D\u7ED3\u679C\n"));
117
- return;
118
- }
119
- displayDigest(myDigest);
120
- }
121
- async function networkAutoCommand(action) {
122
- const token = await requireToken();
123
- if (!token) return;
124
- const netConfig = await loadNetworkConfig(token.teamId);
125
- if (action === "on") {
126
- netConfig.autoEnabled = true;
127
- await saveNetworkConfig(token.teamId, netConfig);
128
- const config = await loadConfig();
129
- await startAutoRound(token.teamId, config);
130
- const hours = netConfig.autoIntervalMs / (60 * 60 * 1e3);
131
- console.log(chalk.green(`
132
- \u2705 \u81EA\u52A8\u7F51\u7EDC\u5339\u914D\u5DF2\u5F00\u542F\uFF08\u6BCF ${hours} \u5C0F\u65F6\uFF09
133
- `));
134
- } else if (action === "off") {
135
- netConfig.autoEnabled = false;
136
- await saveNetworkConfig(token.teamId, netConfig);
137
- stopAutoRound();
138
- console.log(chalk.dim("\n \u81EA\u52A8\u7F51\u7EDC\u5339\u914D\u5DF2\u5173\u95ED\n"));
139
- } else {
140
- console.log(chalk.dim("\n \u7528\u6CD5: hyper network auto [on|off]\n"));
141
- }
142
- }
143
- async function networkRoundsCommand() {
144
- const token = await requireToken();
145
- if (!token) return;
146
- const rounds = await listRounds(token.teamId);
147
- if (rounds.length === 0) {
148
- console.log(chalk.dim("\n \u6682\u65E0\u8F6E\u6B21\u8BB0\u5F55\n"));
149
- return;
150
- }
151
- console.log(chalk.bold("\n \u{1F4CB} \u7F51\u7EDC\u5339\u914D\u5386\u53F2\n"));
152
- for (const round of rounds.slice(0, 10)) {
153
- const status = round.status === "completed" ? chalk.green("\u2713") : round.status === "failed" ? chalk.red("\u2717") : chalk.yellow("\u2026");
154
- const time = new Date(round.startedAt).toLocaleString("zh-CN");
155
- const trigger = round.triggeredBy === "auto" ? "\u81EA\u52A8" : "\u624B\u52A8";
156
- console.log(` ${status} ${chalk.white(round.id.slice(0, 8))} ${chalk.dim(time)} ${chalk.dim(trigger)} ${round.matches.length}\u5BF9\u5339\u914D ${round.dialogues.length}\u573A\u5BF9\u8BDD`);
157
- if (round.error) {
158
- console.log(` ${chalk.red(round.error)}`);
159
- }
160
- }
161
- console.log();
162
- }
163
- async function networkConfigCommand(key, value) {
164
- const token = await requireToken();
165
- if (!token) return;
166
- const netConfig = await loadNetworkConfig(token.teamId);
167
- if (!key) {
168
- console.log(chalk.bold("\n \u2699\uFE0F Network \u914D\u7F6E\n"));
169
- console.log(` ${chalk.dim("\u81EA\u52A8\u8F6E\u6B21:")} ${netConfig.autoEnabled ? chalk.green("\u5F00\u542F") : chalk.dim("\u5173\u95ED")}`);
170
- console.log(` ${chalk.dim("\u95F4\u9694\u65F6\u95F4:")} ${netConfig.autoIntervalMs / (60 * 60 * 1e3)} \u5C0F\u65F6`);
171
- console.log(` ${chalk.dim("\u8F6E\u6B21\u9884\u7B97:")} $${netConfig.budgetPerRoundUSD}`);
172
- console.log(` ${chalk.dim("\u5339\u914D\u6A21\u578B:")} ${netConfig.matchmakerModel}`);
173
- console.log(` ${chalk.dim("\u5BF9\u8BDD\u6A21\u578B:")} ${netConfig.dialogueModel}`);
174
- console.log(` ${chalk.dim("\u5BF9\u8BDD\u8F6E\u6570:")} ${netConfig.maxDialogueTurns}`);
175
- console.log(` ${chalk.dim("\u6700\u5927\u914D\u5BF9:")} ${netConfig.maxMatchPairs}`);
176
- console.log();
177
- return;
178
- }
179
- if (!value) {
180
- showError(`\u8BF7\u63D0\u4F9B ${key} \u7684\u503C`);
181
- return;
182
- }
183
- const configMap = {
184
- model: (v) => {
185
- netConfig.matchmakerModel = v;
186
- netConfig.dialogueModel = v;
187
- },
188
- matchModel: (v) => {
189
- netConfig.matchmakerModel = v;
190
- },
191
- dialogueModel: (v) => {
192
- netConfig.dialogueModel = v;
193
- },
194
- budget: (v) => {
195
- netConfig.budgetPerRoundUSD = parseFloat(v);
196
- },
197
- interval: (v) => {
198
- netConfig.autoIntervalMs = parseFloat(v) * 60 * 60 * 1e3;
199
- },
200
- turns: (v) => {
201
- netConfig.maxDialogueTurns = parseInt(v, 10);
202
- },
203
- maxPairs: (v) => {
204
- netConfig.maxMatchPairs = parseInt(v, 10);
205
- }
206
- };
207
- if (!configMap[key]) {
208
- console.log(chalk.dim(`
209
- \u53EF\u914D\u7F6E\u9879: ${Object.keys(configMap).join(", ")}
210
- `));
211
- return;
212
- }
213
- configMap[key](value);
214
- await saveNetworkConfig(token.teamId, netConfig);
215
- console.log(chalk.green(`
216
- \u2705 ${key} \u5DF2\u66F4\u65B0
217
- `));
218
- }
219
- function displayProfile(profile) {
220
- console.log(chalk.bold(`
221
- \u{1F9EC} Agent Profile \u2014 ${profile.memberName}
222
- `));
223
- console.log(` ${chalk.dim("\u6280\u80FD:")} ${profile.skills.length > 0 ? profile.skills.join(", ") : chalk.dim("\u672A\u8BBE\u7F6E")}`);
224
- console.log(` ${chalk.dim("\u9700\u6C42:")} ${profile.needs.length > 0 ? profile.needs.join(", ") : chalk.dim("\u672A\u8BBE\u7F6E")}`);
225
- console.log(` ${chalk.dim("\u53EF\u63D0\u4F9B:")} ${profile.offerings.length > 0 ? profile.offerings.join(", ") : chalk.dim("\u672A\u8BBE\u7F6E")}`);
226
- console.log(` ${chalk.dim("\u8FD1\u671F:")} ${profile.recentContext}`);
227
- if (profile.customNote) {
228
- console.log(` ${chalk.dim("\u5907\u6CE8:")} ${profile.customNote}`);
229
- }
230
- console.log(` ${chalk.dim("\u4EFB\u52A1\u6570:")} ${profile.currentTasks.length}`);
231
- console.log();
232
- }
233
- function displayDigest(digest) {
234
- console.log(chalk.bold(`
235
- \u{1F4E8} Hyper Network \u6458\u8981 \u2014 ${digest.memberName}
236
- `));
237
- console.log(chalk.dim(` \u751F\u6210\u65F6\u95F4: ${new Date(digest.generatedAt).toLocaleString("zh-CN")}
238
- `));
239
- for (const match of digest.matches) {
240
- console.log(` ${chalk.cyan("\u2194")} \u4E0E ${chalk.bold(match.partnerName)} \u7684\u4EA4\u6D41`);
241
- console.log(` ${chalk.dim("\u5339\u914D\u539F\u56E0:")} ${match.reason}`);
242
- console.log(` ${chalk.dim("\u5BF9\u4F60\u7684\u4EF7\u503C:")} ${match.valueForMe}`);
243
- if (match.keyInsights.length > 0) {
244
- console.log(` ${chalk.dim("\u5173\u952E\u4FE1\u606F:")}`);
245
- for (const insight of match.keyInsights) {
246
- console.log(` \xB7 ${insight}`);
247
- }
248
- }
249
- if (match.actionItems.length > 0) {
250
- console.log(` ${chalk.dim("\u5EFA\u8BAE\u884C\u52A8:")}`);
251
- for (const item of match.actionItems) {
252
- console.log(` \u2192 ${item}`);
253
- }
254
- }
255
- console.log();
256
- }
257
- }
258
- function displayRoundSummary(round) {
259
- const duration = round.completedAt ? ((new Date(round.completedAt).getTime() - new Date(round.startedAt).getTime()) / 1e3).toFixed(1) : "?";
260
- console.log(chalk.bold(` \u{1F4CA} \u8F6E\u6B21\u603B\u7ED3 #${round.id.slice(0, 8)}`));
261
- console.log(` ${chalk.dim("\u72B6\u6001:")} ${round.status === "completed" ? chalk.green("\u5B8C\u6210") : chalk.red(round.status)}`);
262
- console.log(` ${chalk.dim("\u8017\u65F6:")} ${duration}s`);
263
- console.log(` ${chalk.dim("\u5339\u914D:")} ${round.matches.length} \u5BF9`);
264
- console.log(` ${chalk.dim("\u5BF9\u8BDD:")} ${round.dialogues.length} \u573A`);
265
- console.log(` ${chalk.dim("\u6458\u8981:")} ${round.digests.length} \u4EFD`);
266
- console.log(` ${chalk.dim("Token:")} ${round.totalTokenUsage.inputTokens + round.totalTokenUsage.outputTokens} (in: ${round.totalTokenUsage.inputTokens}, out: ${round.totalTokenUsage.outputTokens})`);
267
- if (round.error) {
268
- console.log(` ${chalk.red("\u9519\u8BEF:")} ${round.error}`);
269
- }
270
- console.log();
271
- }
272
- export {
273
- networkAutoCommand,
274
- networkConfigCommand,
275
- networkDigestCommand,
276
- networkProfileCommand,
277
- networkRoundsCommand,
278
- networkRunCommand
279
- };
@@ -1,14 +0,0 @@
1
- import {
2
- bellNotify,
3
- isNotificationsEnabled,
4
- notifyIfLong,
5
- sendNotification,
6
- setNotificationsEnabled
7
- } from "./chunk-4DVYJAJL.js";
8
- export {
9
- bellNotify,
10
- isNotificationsEnabled,
11
- notifyIfLong,
12
- sendNotification,
13
- setNotificationsEnabled
14
- };
@@ -1,12 +0,0 @@
1
- import {
2
- callOpenAILLM,
3
- createOpenAIClient,
4
- streamOpenAIChat
5
- } from "./chunk-5GDYH676.js";
6
- import "./chunk-CLKIMCXZ.js";
7
- import "./chunk-I7WI3BMB.js";
8
- export {
9
- callOpenAILLM,
10
- createOpenAIClient,
11
- streamOpenAIChat
12
- };
@@ -1,10 +0,0 @@
1
- import {
2
- applyPermissions,
3
- getToolPermission,
4
- wrapToolWithPermission
5
- } from "./chunk-GU2FZQ6A.js";
6
- export {
7
- applyPermissions,
8
- getToolPermission,
9
- wrapToolWithPermission
10
- };
@@ -1,166 +0,0 @@
1
- import {
2
- closeMCPConnections,
3
- createToolRegistry
4
- } from "./chunk-Y6HMJZDJ.js";
5
- import "./chunk-GFORWAMW.js";
6
- import "./chunk-GU2FZQ6A.js";
7
- import {
8
- createLLMClient,
9
- streamCallLLM
10
- } from "./chunk-FCW3K6F2.js";
11
- import {
12
- createOpenAIClient,
13
- streamOpenAIChat
14
- } from "./chunk-5GDYH676.js";
15
- import "./chunk-CLKIMCXZ.js";
16
- import {
17
- HYPERCORE_DIR,
18
- loadConfig
19
- } from "./chunk-I7WI3BMB.js";
20
- import "./chunk-TGTYKBGC.js";
21
-
22
- // src/commands/prompt.ts
23
- import { existsSync, readdirSync } from "fs";
24
- import { readFile } from "fs/promises";
25
- import { join, basename } from "path";
26
- async function runPrompt(options) {
27
- if (!existsSync(HYPERCORE_DIR)) {
28
- console.error("\u9519\u8BEF: \u8BF7\u5148\u8FD0\u884C hypercore init \u521D\u59CB\u5316");
29
- process.exit(1);
30
- }
31
- const config = await loadConfig();
32
- const tools = await createToolRegistry(config);
33
- let systemPrompt = "";
34
- const hyperPath = join(HYPERCORE_DIR, "HYPER.md");
35
- if (existsSync(hyperPath)) {
36
- try {
37
- systemPrompt = await readFile(hyperPath, "utf-8");
38
- } catch {
39
- }
40
- }
41
- if (!systemPrompt) {
42
- systemPrompt = "\u4F60\u662F\u8D85\u534F\u4F53 AI \u52A9\u624B\u3002\u7B80\u6D01\u3001\u4E13\u4E1A\u5730\u56DE\u7B54\u95EE\u9898\u3002";
43
- }
44
- systemPrompt += `
45
- \u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55: ${process.cwd()}`;
46
- const cwd = process.cwd();
47
- const rulesDirs = [
48
- join(HYPERCORE_DIR, "rules"),
49
- join(cwd, ".hyper", "rules")
50
- ];
51
- for (const rulesDir of rulesDirs) {
52
- if (existsSync(rulesDir)) {
53
- try {
54
- const files = readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
55
- for (const file of files) {
56
- try {
57
- const content = await readFile(join(rulesDir, file), "utf-8");
58
- systemPrompt += `
59
-
60
- ---
61
- <!-- rule: ${file} -->
62
- ${content}`;
63
- } catch {
64
- }
65
- }
66
- } catch {
67
- }
68
- }
69
- }
70
- const pkgPath = join(process.cwd(), "package.json");
71
- if (existsSync(pkgPath)) {
72
- try {
73
- const pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
74
- systemPrompt += `
75
- \u9879\u76EE: ${pkg.name || basename(process.cwd())}`;
76
- } catch {
77
- }
78
- }
79
- let history = [];
80
- if (options.continueSession || options.resumeId) {
81
- try {
82
- const { loadSession, listSessions } = await import("./session-5EBECDUP.js");
83
- if (options.resumeId) {
84
- const msgs = await loadSession(options.resumeId);
85
- history = msgs;
86
- } else {
87
- const sessions = await listSessions();
88
- if (sessions.length > 0) {
89
- const msgs = await loadSession(sessions[0].id);
90
- history = msgs;
91
- }
92
- }
93
- } catch {
94
- }
95
- }
96
- try {
97
- if (config.modelConfig.sdkType === "openai") {
98
- const client = createOpenAIClient(config.modelConfig);
99
- const messages = [
100
- { role: "system", content: systemPrompt },
101
- ...history.map((m) => ({
102
- role: m.role,
103
- content: m.content
104
- })),
105
- { role: "user", content: options.prompt }
106
- ];
107
- const result = await streamOpenAIChat(client, messages, {
108
- model: config.modelConfig.model,
109
- tools,
110
- onChunk: (text) => {
111
- if (options.outputFormat !== "json") {
112
- process.stdout.write(text);
113
- }
114
- },
115
- onToolCall: () => {
116
- }
117
- });
118
- if (options.outputFormat === "json") {
119
- console.log(JSON.stringify({
120
- result: result.content,
121
- token_usage: result.tokenUsage
122
- }, null, 2));
123
- } else {
124
- console.log();
125
- }
126
- } else {
127
- const client = createLLMClient(config.modelConfig);
128
- const result = await streamCallLLM(client, {
129
- systemPrompt,
130
- userPrompt: options.prompt,
131
- history,
132
- tools,
133
- model: config.modelConfig.model,
134
- onText: (text) => {
135
- if (options.outputFormat !== "json") {
136
- process.stdout.write(text);
137
- }
138
- },
139
- onToolCall: () => {
140
- }
141
- });
142
- if (options.outputFormat === "json") {
143
- console.log(JSON.stringify({
144
- result: result.output,
145
- response_text: result.responseText,
146
- tool_calls: result.toolCalls,
147
- token_usage: result.tokenUsage
148
- }, null, 2));
149
- } else {
150
- console.log();
151
- }
152
- }
153
- } catch (err) {
154
- const msg = err instanceof Error ? err.message : String(err);
155
- if (options.outputFormat === "json") {
156
- console.log(JSON.stringify({ error: msg }));
157
- } else {
158
- console.error(`\u9519\u8BEF: ${msg}`);
159
- }
160
- process.exit(1);
161
- }
162
- await closeMCPConnections();
163
- }
164
- export {
165
- runPrompt
166
- };
@@ -1,16 +0,0 @@
1
- import {
2
- checkBuild,
3
- checkDeps,
4
- checkPackageSize,
5
- checkTests,
6
- checkTodos,
7
- runQualityReport
8
- } from "./chunk-ZSBHUGWR.js";
9
- export {
10
- checkBuild,
11
- checkDeps,
12
- checkPackageSize,
13
- checkTests,
14
- checkTodos,
15
- runQualityReport
16
- };