hypercore-cli 1.1.1 → 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-D4PUN5BN.js +0 -162
  92. package/dist/auth-UTR4I6QY.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-77FRUHTU.js +0 -271
  98. package/dist/chunk-7ZYMJFCA.js +0 -251
  99. package/dist/chunk-BE46C7JW.js +0 -46
  100. package/dist/chunk-CM423E2U.js +0 -133
  101. package/dist/chunk-E4NKO2KI.js +0 -263
  102. package/dist/chunk-GH7E2OJE.js +0 -223
  103. package/dist/chunk-GMLQ7GZ5.js +0 -134
  104. package/dist/chunk-GU2FZQ6A.js +0 -69
  105. package/dist/chunk-IOPKN5GD.js +0 -190
  106. package/dist/chunk-LWDNLX6B.js +0 -2025
  107. package/dist/chunk-MGLJ53QN.js +0 -219
  108. package/dist/chunk-NHPDLYEW.js +0 -139
  109. package/dist/chunk-OGQGKMDX.js +0 -173
  110. package/dist/chunk-OPZYEVYR.js +0 -150
  111. package/dist/chunk-OWAOKDIN.js +0 -1505
  112. package/dist/chunk-R3GPQC7I.js +0 -393
  113. package/dist/chunk-RKB2JOV2.js +0 -43
  114. package/dist/chunk-RNG3K465.js +0 -80
  115. package/dist/chunk-SHJQMIJL.js +0 -288
  116. package/dist/chunk-SVF2VWOZ.js +0 -145
  117. package/dist/chunk-TGTYKBGC.js +0 -86
  118. package/dist/chunk-V2EBSFPU.js +0 -575
  119. package/dist/chunk-VJDQNNSO.js +0 -681
  120. package/dist/chunk-VQ35XX7B.js +0 -167
  121. package/dist/chunk-WHLVZCQY.js +0 -245
  122. package/dist/chunk-XMGHVNH2.js +0 -66
  123. package/dist/chunk-YWOSOTUO.js +0 -58
  124. package/dist/chunk-ZQRNV2US.js +0 -166
  125. package/dist/chunk-ZSBHUGWR.js +0 -262
  126. package/dist/claude-O5FSOXZC.js +0 -12
  127. package/dist/commands-43PLOWRU.js +0 -128
  128. package/dist/commands-5YVUSUMP.js +0 -232
  129. package/dist/commands-VZMZJFZF.js +0 -1044
  130. package/dist/config-WXXEEEVW.js +0 -8
  131. package/dist/config-loader-SXO674TF.js +0 -24
  132. package/dist/diagnose-BX45APUZ.js +0 -12
  133. package/dist/display-IIUBEYWN.js +0 -58
  134. package/dist/extractor-R5ABXNTJ.js +0 -129
  135. package/dist/history-JPXZEOT3.js +0 -180
  136. package/dist/index.d.ts +0 -1
  137. package/dist/instance-registry-6NJTCAE4.js +0 -15
  138. package/dist/keybindings-ADWNOX5M.js +0 -15
  139. package/dist/loader-AXDDCB2G.js +0 -58
  140. package/dist/network-V3O4UZYZ.js +0 -279
  141. package/dist/notify-HPTALZDC.js +0 -14
  142. package/dist/openai-compat-UFDV2SCK.js +0 -12
  143. package/dist/permissions-JUKXMNDH.js +0 -10
  144. package/dist/prompt-5CZ34WGA.js +0 -166
  145. package/dist/quality-ST7PPNFR.js +0 -16
  146. package/dist/repl-EOWP6AAB.js +0 -3374
  147. package/dist/roadmap-5OBEKROY.js +0 -17
  148. package/dist/server-BB5AENWU.js +0 -57
  149. package/dist/session-5NDKKFLN.js +0 -21
  150. package/dist/skills-JVLIQVJN.js +0 -175
  151. package/dist/store-G7KRD4PN.js +0 -25
  152. package/dist/team-FVNNVDBY.js +0 -385
  153. package/dist/telemetry-6R4EIE6O.js +0 -30
  154. package/dist/test-runner-REKSVPPY.js +0 -619
  155. package/dist/theme-3SYJ3UQA.js +0 -14
  156. package/dist/upgrade-YSXCO63I.js +0 -83
  157. package/dist/verify-JUDKTPKZ.js +0 -14
  158. package/dist/web-H2BJXUBZ.js +0 -39
@@ -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-VJDQNNSO.js";
12
- import "./chunk-VQ35XX7B.js";
13
- import "./chunk-OGQGKMDX.js";
14
- import {
15
- loadLocalToken
16
- } from "./chunk-XMGHVNH2.js";
17
- import {
18
- showError
19
- } from "./chunk-R3GPQC7I.js";
20
- import "./chunk-BE46C7JW.js";
21
- import "./chunk-RNG3K465.js";
22
- import "./chunk-E4NKO2KI.js";
23
- import "./chunk-77FRUHTU.js";
24
- import "./chunk-NHPDLYEW.js";
25
- import {
26
- loadConfig
27
- } from "./chunk-SVF2VWOZ.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-77FRUHTU.js";
6
- import "./chunk-NHPDLYEW.js";
7
- import "./chunk-SVF2VWOZ.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-OWAOKDIN.js";
5
- import "./chunk-7ZYMJFCA.js";
6
- import "./chunk-GU2FZQ6A.js";
7
- import {
8
- createLLMClient,
9
- streamCallLLM
10
- } from "./chunk-E4NKO2KI.js";
11
- import {
12
- createOpenAIClient,
13
- streamOpenAIChat
14
- } from "./chunk-77FRUHTU.js";
15
- import "./chunk-NHPDLYEW.js";
16
- import {
17
- HYPERCORE_DIR,
18
- loadConfig
19
- } from "./chunk-SVF2VWOZ.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-5NDKKFLN.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
- };