dsh-lowtide 0.1.2
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/README.md +141 -0
- package/cordis.patch.yml +39 -0
- package/lib/client.js +4793 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +7423 -0
- package/lib/types/client/api.d.ts +169 -0
- package/lib/types/client/components/CandidatesView.d.ts +8 -0
- package/lib/types/client/components/ConfirmGate.d.ts +6 -0
- package/lib/types/client/components/DroppedRow.d.ts +6 -0
- package/lib/types/client/components/InterceptCard.d.ts +17 -0
- package/lib/types/client/components/MorningReport.d.ts +6 -0
- package/lib/types/client/components/NewTaskModal.d.ts +9 -0
- package/lib/types/client/components/PriceBand.d.ts +17 -0
- package/lib/types/client/components/PricePill.d.ts +8 -0
- package/lib/types/client/components/QueueDock.d.ts +8 -0
- package/lib/types/client/components/TaskDetail.d.ts +7 -0
- package/lib/types/client/components/TaskForm.d.ts +85 -0
- package/lib/types/client/components/TaskRow.d.ts +7 -0
- package/lib/types/client/components/WindowEditorModal.d.ts +6 -0
- package/lib/types/client/components/atoms.d.ts +25 -0
- package/lib/types/client/hooks/useInterceptDraft.d.ts +13 -0
- package/lib/types/client/i18n.d.ts +348 -0
- package/lib/types/client/index.d.ts +15 -0
- package/lib/types/client/lib/taskMeta.d.ts +10 -0
- package/lib/types/client/settings.d.ts +5 -0
- package/lib/types/client/store.d.ts +188 -0
- package/lib/types/src/api-trust.d.ts +18 -0
- package/lib/types/src/git.d.ts +16 -0
- package/lib/types/src/index.d.ts +10 -0
- package/lib/types/src/intake.d.ts +54 -0
- package/lib/types/src/models.d.ts +38 -0
- package/lib/types/src/routes.d.ts +15 -0
- package/lib/types/src/runner.d.ts +89 -0
- package/lib/types/src/scheduler.d.ts +37 -0
- package/lib/types/src/session-picker.d.ts +14 -0
- package/lib/types/src/state-machine.d.ts +13 -0
- package/lib/types/src/store.d.ts +116 -0
- package/lib/types/src/strategies/review-dimensions.d.ts +14 -0
- package/lib/types/src/strategies/smart-iterative.d.ts +61 -0
- package/lib/types/src/turns.d.ts +97 -0
- package/package.json +105 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-lowtide client dictionaries (zh / en).
|
|
3
|
+
*
|
|
4
|
+
* Registered through the host locale service (`ctx.locale.register`) under
|
|
5
|
+
* the `dsh-lowtide` namespace; every slot entry declares `locale: NS` so
|
|
6
|
+
* components receive the framework-synthesized `t` seat on their props.
|
|
7
|
+
* Keys use `{name}` template placeholders.
|
|
8
|
+
*
|
|
9
|
+
* Terminology (PLAN v2 §3): zh uses 闲时/忙时 ("off-peak"/"busy") and
|
|
10
|
+
* "执行报告" (execution report); en keeps the standard peak/off-peak pair.
|
|
11
|
+
* Internal identifiers (package name, status enums, keys) are unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NS = "dsh-lowtide";
|
|
14
|
+
declare const zh: {
|
|
15
|
+
'pill.loading': string;
|
|
16
|
+
'pill.disconnected': string;
|
|
17
|
+
'pill.peak': string;
|
|
18
|
+
'pill.off': string;
|
|
19
|
+
'pill.custom': string;
|
|
20
|
+
'pill.running': string;
|
|
21
|
+
'tooltip.time': string;
|
|
22
|
+
'tooltip.timeNoWindow': string;
|
|
23
|
+
'tooltip.queue': string;
|
|
24
|
+
'tooltip.queueRunning': string;
|
|
25
|
+
'tooltip.ledger': string;
|
|
26
|
+
'tooltip.ledgerSaved': string;
|
|
27
|
+
'tooltip.ledgerSpent': string;
|
|
28
|
+
'status.pending-review': string;
|
|
29
|
+
'status.queued': string;
|
|
30
|
+
'status.deferred': string;
|
|
31
|
+
'status.dropped': string;
|
|
32
|
+
'status.running': string;
|
|
33
|
+
'status.preflight': string;
|
|
34
|
+
'status.done': string;
|
|
35
|
+
'status.failed': string;
|
|
36
|
+
'status.stale': string;
|
|
37
|
+
'status.timeout': string;
|
|
38
|
+
'status.cancelled': string;
|
|
39
|
+
'dock.loading': string;
|
|
40
|
+
'dock.disconnected': string;
|
|
41
|
+
'dock.retry': string;
|
|
42
|
+
'dock.title': string;
|
|
43
|
+
'dock.pending': string;
|
|
44
|
+
'pill.queued': string;
|
|
45
|
+
'dock.report': string;
|
|
46
|
+
'dock.new': string;
|
|
47
|
+
'dock.expand': string;
|
|
48
|
+
'dock.collapse': string;
|
|
49
|
+
'onboarding.text': string;
|
|
50
|
+
'onboarding.dismiss': string;
|
|
51
|
+
'empty.title': string;
|
|
52
|
+
'empty.cta': string;
|
|
53
|
+
'footer.approveAndRun': string;
|
|
54
|
+
'footer.runNow': string;
|
|
55
|
+
'action.approve': string;
|
|
56
|
+
'action.defer': string;
|
|
57
|
+
'action.drop': string;
|
|
58
|
+
'action.retry': string;
|
|
59
|
+
'action.delete': string;
|
|
60
|
+
'action.deleteConfirm': string;
|
|
61
|
+
'action.deleteConfirmShort': string;
|
|
62
|
+
'action.restore': string;
|
|
63
|
+
'action.clearFinished': string;
|
|
64
|
+
'action.clearFinishedConfirm': string;
|
|
65
|
+
'action.clearFinishedConfirmShort': string;
|
|
66
|
+
'toast.finishedCleared': string;
|
|
67
|
+
'toast.clearFailed': string;
|
|
68
|
+
'toast.deleted': string;
|
|
69
|
+
'toast.deleteFailed': string;
|
|
70
|
+
'toast.requeued': string;
|
|
71
|
+
'toast.submitted': string;
|
|
72
|
+
'toast.submitFailed': string;
|
|
73
|
+
'toast.restored': string;
|
|
74
|
+
'section.running': string;
|
|
75
|
+
'section.done': string;
|
|
76
|
+
'section.dropped': string;
|
|
77
|
+
'detail.title': string;
|
|
78
|
+
'detail.close': string;
|
|
79
|
+
'detail.workspace': string;
|
|
80
|
+
'detail.priority': string;
|
|
81
|
+
'detail.permission': string;
|
|
82
|
+
'detail.created': string;
|
|
83
|
+
'detail.triaged': string;
|
|
84
|
+
'detail.triagedAuto': string;
|
|
85
|
+
'detail.triagedUser': string;
|
|
86
|
+
'detail.continuesFromSession': string;
|
|
87
|
+
'detail.model': string;
|
|
88
|
+
'detail.estimateKnown': string;
|
|
89
|
+
'detail.estimateUnknown': string;
|
|
90
|
+
'detail.files': string;
|
|
91
|
+
'detail.lastRun': string;
|
|
92
|
+
'detail.error': string;
|
|
93
|
+
'detail.resumed': string;
|
|
94
|
+
'detail.forked': string;
|
|
95
|
+
'detail.minutes': string;
|
|
96
|
+
'detail.bytes': string;
|
|
97
|
+
'detail.fileCount': string;
|
|
98
|
+
'modal.title': string;
|
|
99
|
+
'modal.desc': string;
|
|
100
|
+
'modal.cancel': string;
|
|
101
|
+
'modal.submit': string;
|
|
102
|
+
'modal.promptPlaceholderSingle': string;
|
|
103
|
+
'modal.promptPlaceholderIterative': string;
|
|
104
|
+
'modal.promptPlaceholderSampling': string;
|
|
105
|
+
'modal.promptPlaceholderReview': string;
|
|
106
|
+
'modal.workspace': string;
|
|
107
|
+
'modal.workspacePlaceholder': string;
|
|
108
|
+
'modal.workspaceDefault': string;
|
|
109
|
+
'modal.workspaceCustom': string;
|
|
110
|
+
'modal.priority': string;
|
|
111
|
+
'modal.priorityHint': string;
|
|
112
|
+
'modal.strategy': string;
|
|
113
|
+
'modal.rounds': string;
|
|
114
|
+
'modal.advanced': string;
|
|
115
|
+
'modal.advancedTitle': string;
|
|
116
|
+
'modal.advancedDone': string;
|
|
117
|
+
'modal.files': string;
|
|
118
|
+
'modal.filesPlaceholder': string;
|
|
119
|
+
'modal.filesAdvancedHint': string;
|
|
120
|
+
'modal.reasoning': string;
|
|
121
|
+
'modal.reasoningHint': string;
|
|
122
|
+
'modal.model': string;
|
|
123
|
+
'modal.modelHint': string;
|
|
124
|
+
'modal.modelFollowGlobal': string;
|
|
125
|
+
'modal.strategyHintIterative': string;
|
|
126
|
+
'modal.strategyHintSampling': string;
|
|
127
|
+
'modal.strategyHintReview': string;
|
|
128
|
+
'modal.sessionMode': string;
|
|
129
|
+
'modal.sessionNew': string;
|
|
130
|
+
'modal.sessionContinue': string;
|
|
131
|
+
'modal.sessionNewHint': string;
|
|
132
|
+
'modal.sessionContinueHint': string;
|
|
133
|
+
'modal.selectConversation': string;
|
|
134
|
+
'modal.selectConversationPlaceholder': string;
|
|
135
|
+
'modal.noConversations': string;
|
|
136
|
+
'modal.continueHint': string;
|
|
137
|
+
'modal.time.justNow': string;
|
|
138
|
+
'modal.time.minutesAgo': string;
|
|
139
|
+
'modal.time.hoursAgo': string;
|
|
140
|
+
strategyHintPlaceholderIterative: string;
|
|
141
|
+
strategyHintPlaceholderSampling: string;
|
|
142
|
+
strategyHintPlaceholderReview: string;
|
|
143
|
+
'modal.autonomy': string;
|
|
144
|
+
'autonomy.l1': string;
|
|
145
|
+
'autonomy.l2': string;
|
|
146
|
+
'autonomy.l3': string;
|
|
147
|
+
'autonomy.l1Hint': string;
|
|
148
|
+
'autonomy.l2Hint': string;
|
|
149
|
+
'autonomy.l3Hint': string;
|
|
150
|
+
'autonomy.l1Desc': string;
|
|
151
|
+
'autonomy.l2Desc': string;
|
|
152
|
+
'autonomy.l3Desc': string;
|
|
153
|
+
'strategy.single': string;
|
|
154
|
+
'strategy.iterative': string;
|
|
155
|
+
'strategy.sampling': string;
|
|
156
|
+
'strategy.review': string;
|
|
157
|
+
'reasoning.follow': string;
|
|
158
|
+
'reasoning.off': string;
|
|
159
|
+
'reasoning.minimal': string;
|
|
160
|
+
'reasoning.low': string;
|
|
161
|
+
'reasoning.medium': string;
|
|
162
|
+
'reasoning.high': string;
|
|
163
|
+
'reasoning.xhigh': string;
|
|
164
|
+
'reasoning.max': string;
|
|
165
|
+
'strategy.singleHint': string;
|
|
166
|
+
'strategy.iterativeHint': string;
|
|
167
|
+
'strategy.samplingHint': string;
|
|
168
|
+
'strategy.reviewHint': string;
|
|
169
|
+
'intercept.title': string;
|
|
170
|
+
'intercept.tierPeak': string;
|
|
171
|
+
'intercept.tierCustom': string;
|
|
172
|
+
'intercept.inputPlaceholder': string;
|
|
173
|
+
'intercept.workspaceLabel': string;
|
|
174
|
+
'intercept.workspacePlaceholder': string;
|
|
175
|
+
'intercept.workspaceWarning': string;
|
|
176
|
+
'intercept.priceNowPeak': string;
|
|
177
|
+
'intercept.priceNowCustom': string;
|
|
178
|
+
'intercept.priceTonight': string;
|
|
179
|
+
'intercept.priceUnknown': string;
|
|
180
|
+
'intercept.runNow': string;
|
|
181
|
+
'intercept.enqueue': string;
|
|
182
|
+
'intercept.dismiss': string;
|
|
183
|
+
'intercept.closeTitle': string;
|
|
184
|
+
'intercept.queueStatus': string;
|
|
185
|
+
'toast.enqueued': string;
|
|
186
|
+
'gate.title': string;
|
|
187
|
+
'gate.startsAt': string;
|
|
188
|
+
'gate.closeTitle': string;
|
|
189
|
+
'gate.meta': string;
|
|
190
|
+
'gate.more': string;
|
|
191
|
+
'gate.approveAll': string;
|
|
192
|
+
'gate.defer': string;
|
|
193
|
+
'gate.removeTitle': string;
|
|
194
|
+
'toast.gateApproved': string;
|
|
195
|
+
'toast.gateDeferred': string;
|
|
196
|
+
'toast.deferFailed': string;
|
|
197
|
+
'toast.runStarted': string;
|
|
198
|
+
'toast.windowsSaved': string;
|
|
199
|
+
'editor.title': string;
|
|
200
|
+
'editor.localTz': string;
|
|
201
|
+
'editor.hint': string;
|
|
202
|
+
'editor.typePeak': string;
|
|
203
|
+
'editor.typeOff': string;
|
|
204
|
+
'editor.add': string;
|
|
205
|
+
'editor.remove': string;
|
|
206
|
+
'editor.restoreOfficial': string;
|
|
207
|
+
'editor.allOff': string;
|
|
208
|
+
'editor.daysWeekday': string;
|
|
209
|
+
'editor.daysWeekend': string;
|
|
210
|
+
'editor.daysCustom': string;
|
|
211
|
+
'editor.empty': string;
|
|
212
|
+
'editor.save': string;
|
|
213
|
+
'report.title': string;
|
|
214
|
+
'report.saved': string;
|
|
215
|
+
'report.meta': string;
|
|
216
|
+
'report.metaDeferred': string;
|
|
217
|
+
'report.stale': string;
|
|
218
|
+
'report.timeout': string;
|
|
219
|
+
'report.failed': string;
|
|
220
|
+
'report.priceUnknown': string;
|
|
221
|
+
'report.retry': string;
|
|
222
|
+
'report.more': string;
|
|
223
|
+
'report.copyMarkdown': string;
|
|
224
|
+
'report.history': string;
|
|
225
|
+
'report.historyDesc': string;
|
|
226
|
+
'report.historyEmpty': string;
|
|
227
|
+
'report.back': string;
|
|
228
|
+
'report.close': string;
|
|
229
|
+
'report.delete': string;
|
|
230
|
+
'report.clearAll': string;
|
|
231
|
+
'report.clearAllConfirm': string;
|
|
232
|
+
'report.showingLatest': string;
|
|
233
|
+
'report.totalCount': string;
|
|
234
|
+
'toast.reportDeleted': string;
|
|
235
|
+
'toast.reportDeleteFailed': string;
|
|
236
|
+
'toast.reportsCleared': string;
|
|
237
|
+
'report.strategyIterative': string;
|
|
238
|
+
'report.strategySampling': string;
|
|
239
|
+
'report.strategyReview': string;
|
|
240
|
+
'report.reviewed': string;
|
|
241
|
+
'report.historyRow': string;
|
|
242
|
+
'report.reviewExcerpt': string;
|
|
243
|
+
'report.candidates': string;
|
|
244
|
+
'report.candidate': string;
|
|
245
|
+
'report.pickThis': string;
|
|
246
|
+
'report.picked': string;
|
|
247
|
+
'report.minutes': string;
|
|
248
|
+
'toast.historyFailed': string;
|
|
249
|
+
'report.mdTitle': string;
|
|
250
|
+
'report.mdSummary': string;
|
|
251
|
+
'settings.title': string;
|
|
252
|
+
'settings.loading': string;
|
|
253
|
+
'settings.onboardingTitle': string;
|
|
254
|
+
'settings.step1': string;
|
|
255
|
+
'settings.step2': string;
|
|
256
|
+
'settings.step3': string;
|
|
257
|
+
'settings.step4': string;
|
|
258
|
+
'settings.language': string;
|
|
259
|
+
'settings.weekday1': string;
|
|
260
|
+
'settings.weekday2': string;
|
|
261
|
+
'settings.weekday3': string;
|
|
262
|
+
'settings.weekday4': string;
|
|
263
|
+
'settings.weekday5': string;
|
|
264
|
+
'settings.weekday6': string;
|
|
265
|
+
'settings.weekday7': string;
|
|
266
|
+
'settings.priceTierPeak': string;
|
|
267
|
+
'settings.priceTierOff': string;
|
|
268
|
+
'settings.officialTitle': string;
|
|
269
|
+
'settings.officialBody': string;
|
|
270
|
+
'settings.localTz': string;
|
|
271
|
+
'settings.officialPeakLocal': string;
|
|
272
|
+
'settings.officialWeekend': string;
|
|
273
|
+
'settings.crossDay': string;
|
|
274
|
+
'settings.localTimesHint': string;
|
|
275
|
+
'settings.adoptOfficial': string;
|
|
276
|
+
'settings.adoptAlready': string;
|
|
277
|
+
'settings.bandTitle': string;
|
|
278
|
+
'settings.bandNow': string;
|
|
279
|
+
'settings.batchTitle': string;
|
|
280
|
+
'settings.start': string;
|
|
281
|
+
'settings.end': string;
|
|
282
|
+
'settings.tz': string;
|
|
283
|
+
'settings.gateLeadMin': string;
|
|
284
|
+
'settings.maxTasksPerNight': string;
|
|
285
|
+
'settings.maxDurationMin': string;
|
|
286
|
+
'settings.maxConcurrency': string;
|
|
287
|
+
'settings.budgetDailyYuan': string;
|
|
288
|
+
'settings.budgetHint': string;
|
|
289
|
+
'settings.autonomy': string;
|
|
290
|
+
'settings.l1': string;
|
|
291
|
+
'settings.l2': string;
|
|
292
|
+
'settings.l3': string;
|
|
293
|
+
'settings.l3Confirm': string;
|
|
294
|
+
'settings.confirm': string;
|
|
295
|
+
'settings.cancel': string;
|
|
296
|
+
'settings.paused': string;
|
|
297
|
+
'settings.dataManagement': string;
|
|
298
|
+
'settings.maxReportHistory': string;
|
|
299
|
+
'settings.maxReportHistoryHint': string;
|
|
300
|
+
'settings.unlimited': string;
|
|
301
|
+
'settings.windowsTitle': string;
|
|
302
|
+
'settings.addWindow': string;
|
|
303
|
+
'settings.windowsHint': string;
|
|
304
|
+
'settings.windowLabelName': string;
|
|
305
|
+
'settings.windowMultiplier': string;
|
|
306
|
+
'settings.windowDays': string;
|
|
307
|
+
'settings.windowDelete': string;
|
|
308
|
+
'settings.windowLevelPeak': string;
|
|
309
|
+
'settings.windowLevelOff': string;
|
|
310
|
+
'settings.windowLevelCustom': string;
|
|
311
|
+
'settings.noWindows': string;
|
|
312
|
+
'settings.bandPeak': string;
|
|
313
|
+
'settings.bandOff': string;
|
|
314
|
+
'settings.bandCustom': string;
|
|
315
|
+
'settings.pricesTitle': string;
|
|
316
|
+
'settings.pricesHint': string;
|
|
317
|
+
'settings.expandPrices': string;
|
|
318
|
+
'settings.collapsePrices': string;
|
|
319
|
+
'settings.priceModel': string;
|
|
320
|
+
'settings.priceTier': string;
|
|
321
|
+
'settings.priceInput': string;
|
|
322
|
+
'settings.priceCached': string;
|
|
323
|
+
'settings.priceOutput': string;
|
|
324
|
+
'settings.restore': string;
|
|
325
|
+
'settings.export': string;
|
|
326
|
+
'settings.save': string;
|
|
327
|
+
'settings.saving': string;
|
|
328
|
+
'settings.configError': string;
|
|
329
|
+
'toast.restoredDefaults': string;
|
|
330
|
+
'toast.exported': string;
|
|
331
|
+
'toast.saved': string;
|
|
332
|
+
'toast.saveFailed': string;
|
|
333
|
+
'settings.exportHint': string;
|
|
334
|
+
};
|
|
335
|
+
export type NsKey = keyof typeof zh;
|
|
336
|
+
export type NsKeyOf = NsKey;
|
|
337
|
+
export declare const DICTS: Record<'zh' | 'en', Record<NsKey, string>>;
|
|
338
|
+
/** LocaleNamespaceMap merge so the typed `locale:` slot option accepts NS. */
|
|
339
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
340
|
+
interface LocaleNamespaceMap {
|
|
341
|
+
'dsh-lowtide': NsKey;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/** Translate function type bound to this namespace. */
|
|
345
|
+
export type NsTranslate = (key: NsKey, params?: Record<string, unknown>) => string;
|
|
346
|
+
/** Simple template fill for standalone use (settings label thunks etc.). */
|
|
347
|
+
export declare function fill(template: string, params: Record<string, unknown> | undefined): string;
|
|
348
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-lowtide browser half (Phase 1 assembly + review round 1 polish).
|
|
3
|
+
* Six-surface registrations: ① PricePill (header utilities), ② InterceptCard
|
|
4
|
+
* (composer chain), ③ QueueDock (input dock), ⑤ MorningReport (shell overlay).
|
|
5
|
+
* ④ ConfirmGate and ⑥ Settings land in the same overlay/settings slots.
|
|
6
|
+
* Polling drives the entry store (SSE is the live path, polling the fallback).
|
|
7
|
+
*
|
|
8
|
+
* Locale: the `dsh-lowtide` namespace registers zh/en dictionaries through
|
|
9
|
+
* the host locale service; every slot entry declares `locale: NS` so the
|
|
10
|
+
* framework injects the typed `t` seat into component props.
|
|
11
|
+
*/
|
|
12
|
+
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
|
|
13
|
+
/** Required services before this client module materializes. */
|
|
14
|
+
export declare const inject: string[];
|
|
15
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared task metadata helpers (Phase D split): status labels and strategy
|
|
3
|
+
* labels used by the queue rows, task detail, and the execution report.
|
|
4
|
+
* Pure functions over the i18n seat — no CSS, no component state.
|
|
5
|
+
*/
|
|
6
|
+
import { type NsTranslate } from '../i18n.ts';
|
|
7
|
+
/** Localized status label ("待裁定" / "Queued" …). */
|
|
8
|
+
export declare function statusLabel(t: NsTranslate, status: string): string;
|
|
9
|
+
/** 策略标签:迭代 N 轮 / 采样 N 份 / 复核 / 单次(空)。 */
|
|
10
|
+
export declare function strategyLabel(t: NsTranslate, strategy: string | undefined, roundsRun: number | undefined): string;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
export interface HostState {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
time: string;
|
|
4
|
+
autonomy: string;
|
|
5
|
+
level: {
|
|
6
|
+
level: string;
|
|
7
|
+
multiplier: number;
|
|
8
|
+
window: {
|
|
9
|
+
id: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
start: string;
|
|
12
|
+
end: string;
|
|
13
|
+
};
|
|
14
|
+
} | null;
|
|
15
|
+
price: {
|
|
16
|
+
model: string;
|
|
17
|
+
input: number;
|
|
18
|
+
inputCached: number;
|
|
19
|
+
output: number;
|
|
20
|
+
/** Real current level: 'peak' | 'off' | 'custom' (display = charge). */
|
|
21
|
+
tier: 'peak' | 'off' | 'custom';
|
|
22
|
+
/** Window price multiplier over the off row (custom windows). */
|
|
23
|
+
multiplier: number;
|
|
24
|
+
/** Whether the model has an explicit price entry (false = default estimate). */
|
|
25
|
+
priceKnown: boolean;
|
|
26
|
+
peakInput: number;
|
|
27
|
+
peakOutput: number;
|
|
28
|
+
offInput: number;
|
|
29
|
+
offOutput: number;
|
|
30
|
+
};
|
|
31
|
+
nextBatchAt: number;
|
|
32
|
+
countdownMs: number;
|
|
33
|
+
nextOffPeakAt: number | null;
|
|
34
|
+
/** System IANA timezone + official peak windows converted to local clock
|
|
35
|
+
* (settings explainer + one-click adopt). */
|
|
36
|
+
systemTz: string;
|
|
37
|
+
officialInLocal: Array<{
|
|
38
|
+
label: string;
|
|
39
|
+
start: string;
|
|
40
|
+
end: string;
|
|
41
|
+
crossesDay: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
batch: {
|
|
44
|
+
window: string;
|
|
45
|
+
paused: boolean;
|
|
46
|
+
running: boolean;
|
|
47
|
+
startedAt: string | null;
|
|
48
|
+
maxConcurrency: number;
|
|
49
|
+
};
|
|
50
|
+
queue: {
|
|
51
|
+
total: number;
|
|
52
|
+
pendingReview: number;
|
|
53
|
+
queued: number;
|
|
54
|
+
running: number;
|
|
55
|
+
};
|
|
56
|
+
gate: {
|
|
57
|
+
windowStartAt: number;
|
|
58
|
+
pendingReview: number;
|
|
59
|
+
} | null;
|
|
60
|
+
digest: {
|
|
61
|
+
groups: Array<{
|
|
62
|
+
workspace: string;
|
|
63
|
+
tasks: unknown[];
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
tasks: HostTask[];
|
|
67
|
+
latestReport: HostReport | null;
|
|
68
|
+
dismissedPeakToday: boolean;
|
|
69
|
+
ledger: {
|
|
70
|
+
spentToday: number;
|
|
71
|
+
savedToday: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface HostCandidate {
|
|
75
|
+
excerpt: string;
|
|
76
|
+
costYuan: number;
|
|
77
|
+
elapsedMs: number;
|
|
78
|
+
}
|
|
79
|
+
export interface HostTask {
|
|
80
|
+
id: string;
|
|
81
|
+
prompt: string;
|
|
82
|
+
files: Array<{
|
|
83
|
+
path: string;
|
|
84
|
+
sha256?: string;
|
|
85
|
+
size?: number;
|
|
86
|
+
}>;
|
|
87
|
+
workspace: string;
|
|
88
|
+
gitRef?: {
|
|
89
|
+
sha: string;
|
|
90
|
+
branch: string;
|
|
91
|
+
};
|
|
92
|
+
priority: number;
|
|
93
|
+
deadline?: string;
|
|
94
|
+
permissionPreset: 'lt-readonly' | 'lt-standard' | 'lt-trusted';
|
|
95
|
+
status: string;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
triagedAt?: string;
|
|
98
|
+
triagedBy?: string;
|
|
99
|
+
estimateYuan?: number;
|
|
100
|
+
estimateMinutes?: number;
|
|
101
|
+
strategy?: 'single' | 'iterative' | 'sampling' | 'review';
|
|
102
|
+
rounds?: number;
|
|
103
|
+
reasoning?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
104
|
+
/** Task-level batch model override (any model id from this machine's dsh). */
|
|
105
|
+
model?: string;
|
|
106
|
+
/** Provider for the task-level model override. */
|
|
107
|
+
modelProvider?: string;
|
|
108
|
+
strategyHint?: string;
|
|
109
|
+
autonomy?: 'l1' | 'l2' | 'l3';
|
|
110
|
+
continuesFromSession?: string;
|
|
111
|
+
chosenCandidateIndex?: number;
|
|
112
|
+
lastError?: string;
|
|
113
|
+
lastRun?: {
|
|
114
|
+
at: string;
|
|
115
|
+
status: string;
|
|
116
|
+
elapsedMs: number;
|
|
117
|
+
costYuan: number;
|
|
118
|
+
diffStat?: string | null;
|
|
119
|
+
error?: string;
|
|
120
|
+
assistantExcerpt?: string;
|
|
121
|
+
strategy?: 'single' | 'iterative' | 'sampling' | 'review';
|
|
122
|
+
roundsRun?: number;
|
|
123
|
+
candidates?: HostCandidate[];
|
|
124
|
+
reviewExcerpt?: string;
|
|
125
|
+
/** True when the run CONTINUED the requested conversation in place. */
|
|
126
|
+
resumed?: boolean;
|
|
127
|
+
/** True when the run ran in a NEW session seeded with the source's full
|
|
128
|
+
* history (fork-style continuation). */
|
|
129
|
+
forked?: boolean;
|
|
130
|
+
/** Set when the requested conversation resume failed and a fresh session was used. */
|
|
131
|
+
resumeNote?: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export interface HostReport {
|
|
135
|
+
id: string;
|
|
136
|
+
date: string;
|
|
137
|
+
dateLabel?: string;
|
|
138
|
+
window: string;
|
|
139
|
+
startedAt: string;
|
|
140
|
+
finishedAt: string;
|
|
141
|
+
tasks: Array<{
|
|
142
|
+
taskId: string;
|
|
143
|
+
prompt: string;
|
|
144
|
+
workspace: string;
|
|
145
|
+
status: 'done' | 'failed' | 'timeout' | 'stale';
|
|
146
|
+
costYuan?: number;
|
|
147
|
+
elapsedMs?: number;
|
|
148
|
+
diffStat?: string | null;
|
|
149
|
+
error?: string;
|
|
150
|
+
strategy?: 'single' | 'iterative' | 'sampling' | 'review';
|
|
151
|
+
roundsRun?: number;
|
|
152
|
+
candidates?: HostCandidate[];
|
|
153
|
+
reviewExcerpt?: string;
|
|
154
|
+
}>;
|
|
155
|
+
totalCostYuan: number;
|
|
156
|
+
savedYuan: number;
|
|
157
|
+
deferredCount?: number;
|
|
158
|
+
summary: string;
|
|
159
|
+
}
|
|
160
|
+
export interface ClientUiState {
|
|
161
|
+
host: HostState | null;
|
|
162
|
+
connected: boolean;
|
|
163
|
+
/** Last state-fetch error message (null when the last poll succeeded). */
|
|
164
|
+
error: string | null;
|
|
165
|
+
queueOpen: boolean;
|
|
166
|
+
reportOpen: boolean;
|
|
167
|
+
reportHistoryOpen: boolean;
|
|
168
|
+
reportUnread: boolean;
|
|
169
|
+
toast: {
|
|
170
|
+
seq: number;
|
|
171
|
+
text: string;
|
|
172
|
+
} | null;
|
|
173
|
+
lastReportId: string | null;
|
|
174
|
+
/** Active locale id ('zh' | 'en'), synced from the host locale service. */
|
|
175
|
+
activeLocale: string;
|
|
176
|
+
}
|
|
177
|
+
export declare const lowtideStore: import("@deepseek-ai/dsh-client-runtime/client").SnapshotStore<ClientUiState>;
|
|
178
|
+
export declare function showToast(text: string): void;
|
|
179
|
+
export declare function clearToast(): void;
|
|
180
|
+
/** Trigger one immediate poll (used after write actions for fast refresh). */
|
|
181
|
+
export declare function refreshNow(): void;
|
|
182
|
+
export declare function startPolling(): () => void;
|
|
183
|
+
export declare function useHost<T>(selector: (host: HostState) => T): T | undefined;
|
|
184
|
+
export declare function useLowtide<T>(selector: (state: ClientUiState) => T): T;
|
|
185
|
+
/** Called from apply(ctx) to wire up the host locale service. */
|
|
186
|
+
export declare function wireLocale(setLocale: (id: string) => void, active: string): void;
|
|
187
|
+
/** Toggle between zh and en. Components call this directly. */
|
|
188
|
+
export declare function switchLocale(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host/Origin trust fence for /ds-lowtide (PLAN B2 / §7.3).
|
|
3
|
+
* 抄写自 dsh-client-connection 的 isTrustedApiRequest 逻辑(该包不公开导出,
|
|
4
|
+
* 只能复制,不能 import)。防御 DNS rebinding 与跨站请求:
|
|
5
|
+
* - Host 必须命中 loopback(本插件当前只以 loopback 部署);
|
|
6
|
+
* - `sec-fetch-site: cross-site` 一律拒绝;
|
|
7
|
+
* - 带 Origin 的请求必须与 Host 同源;`null` Origin 拒绝。
|
|
8
|
+
* trustedHosts 扩展(LAN/SSH 隧道部署)留待 Phase 4。
|
|
9
|
+
*/
|
|
10
|
+
import type { IncomingHttpHeaders } from 'node:http';
|
|
11
|
+
/** 127/8、localhost、[::1] 均视为 loopback(与上游同语义)。 */
|
|
12
|
+
export declare function isLoopbackHostname(hostname: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 判定一个 /ds-lowtide 请求是否可信。
|
|
15
|
+
* @param headers - Node HTTP 请求头。
|
|
16
|
+
* @returns true 时请求可继续;false 时调用方应回 403。
|
|
17
|
+
*/
|
|
18
|
+
export declare function isTrustedApiRequest(headers: IncomingHttpHeaders): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Current HEAD short sha + branch, or null when the workspace is no git repo. */
|
|
2
|
+
export declare function gitRef(workspace: string): Promise<{
|
|
3
|
+
sha: string;
|
|
4
|
+
branch: string;
|
|
5
|
+
} | null>;
|
|
6
|
+
/**
|
|
7
|
+
* `git diff --stat HEAD` covering modified + staged changes against HEAD,
|
|
8
|
+
* e.g. "3 files changed, 124 insertions(+), 67 deletions(-)".
|
|
9
|
+
* Untracked files are not part of any diff — collect them with
|
|
10
|
+
* {@link gitUntrackedFiles} and compose in the report.
|
|
11
|
+
* Returns null when the workspace is no git repo. Use with the session cwd
|
|
12
|
+
* pinned to task.workspace (PLAN C7) or the diff reads the wrong tree.
|
|
13
|
+
*/
|
|
14
|
+
export declare function gitDiffStat(workspace: string): Promise<string | null>;
|
|
15
|
+
/** New untracked files (one path per line), or null on a non-git workspace. */
|
|
16
|
+
export declare function gitUntrackedFiles(workspace: string): Promise<string[] | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-lowtide host half (Phase 1 assembly).
|
|
3
|
+
* Load the store, start the scheduler, register the HTTP API.
|
|
4
|
+
* Spike routes from Phase 0 are gone — the formal intake/routes API replaces
|
|
5
|
+
* them (PLAN G0 directive).
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
8
|
+
/** Cordis service dependencies for the host half. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
export declare function apply(ctx: Context): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Task } from 'lowtide-core';
|
|
3
|
+
export declare const taskInputSchema: z.ZodObject<{
|
|
4
|
+
prompt: z.ZodString;
|
|
5
|
+
files: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
6
|
+
path: z.ZodString;
|
|
7
|
+
}, z.core.$strip>]>>>;
|
|
8
|
+
workspace: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
|
+
priority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
deadline: z.ZodOptional<z.ZodString>;
|
|
11
|
+
permissionPreset: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
"lt-readonly": "lt-readonly";
|
|
13
|
+
"lt-standard": "lt-standard";
|
|
14
|
+
"lt-trusted": "lt-trusted";
|
|
15
|
+
}>>>;
|
|
16
|
+
strategy: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
single: "single";
|
|
18
|
+
iterative: "iterative";
|
|
19
|
+
sampling: "sampling";
|
|
20
|
+
review: "review";
|
|
21
|
+
}>>>;
|
|
22
|
+
rounds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
23
|
+
reasoning: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
off: "off";
|
|
25
|
+
minimal: "minimal";
|
|
26
|
+
low: "low";
|
|
27
|
+
medium: "medium";
|
|
28
|
+
high: "high";
|
|
29
|
+
xhigh: "xhigh";
|
|
30
|
+
max: "max";
|
|
31
|
+
}>>;
|
|
32
|
+
model: z.ZodOptional<z.ZodString>;
|
|
33
|
+
modelProvider: z.ZodOptional<z.ZodString>;
|
|
34
|
+
strategyHint: z.ZodOptional<z.ZodString>;
|
|
35
|
+
autonomy: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
l1: "l1";
|
|
37
|
+
l2: "l2";
|
|
38
|
+
l3: "l3";
|
|
39
|
+
}>>;
|
|
40
|
+
continuesFromSession: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type TaskInput = z.infer<typeof taskInputSchema>;
|
|
43
|
+
export interface IntakeResult {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
task?: Task;
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function intake(input: unknown, defaultWorkspace: string, options?: {
|
|
49
|
+
autonomy?: 'l1' | 'l2' | 'l3';
|
|
50
|
+
/** Model used for the estimate (defaults to flash). */
|
|
51
|
+
modelId?: string;
|
|
52
|
+
/** Price overrides; merged over the official table. */
|
|
53
|
+
prices?: Record<string, unknown>;
|
|
54
|
+
}): Promise<IntakeResult>;
|