@surfishs/dsh-prompt-enhance 0.0.2 → 0.0.3
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/lib/client.js +672 -445
- package/lib/index.js +9 -2
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
- package/src/client/ActionIcons.tsx +61 -0
- package/src/client/EnhanceButton.tsx +24 -56
- package/src/client/ResultDock.tsx +261 -0
- package/src/client/ResultPanel.tsx +149 -177
- package/src/client/SparkleFishIcon.tsx +41 -0
- package/src/client/SparkleIcon.tsx +33 -0
- package/src/client/UndoBar.tsx +4 -0
- package/src/client/index.tsx +16 -0
- package/src/client/locales.ts +18 -4
- package/src/client/styles.ts +75 -48
- package/src/client/ui-state.ts +7 -2
- package/src/enhancer.ts +11 -2
- package/src/shared/protocol.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -556,7 +556,13 @@ async function enhanceText(llm, options) {
|
|
|
556
556
|
const rejected = isEffortRejectionFinish(attempt.assembler.finish);
|
|
557
557
|
if (!rejected) {
|
|
558
558
|
const detail = finishToDetail(attempt.assembler.finish);
|
|
559
|
-
|
|
559
|
+
if (detail === void 0) {
|
|
560
|
+
return { ok: true, blocks: attempt.assembler.blocks(), usage: attempt.assembler.usage, truncated: false };
|
|
561
|
+
}
|
|
562
|
+
if (attempt.assembler.finish.kind === "max-tokens") {
|
|
563
|
+
return { ok: true, blocks: attempt.assembler.blocks(), usage: attempt.assembler.usage, truncated: true };
|
|
564
|
+
}
|
|
565
|
+
return { ok: false, detail };
|
|
560
566
|
}
|
|
561
567
|
if (requestedEffort === "inherit" || retriedWithoutEffort) {
|
|
562
568
|
const detail = finishToDetail(attempt.assembler.finish) ?? { code: "upstream", params: { reason: "effort-unsupported" } };
|
|
@@ -594,7 +600,8 @@ async function enhanceText(llm, options) {
|
|
|
594
600
|
provider: options.route.provider,
|
|
595
601
|
model: options.route.model,
|
|
596
602
|
elapsedMs: Date.now() - started,
|
|
597
|
-
...reportedUsage === void 0 ? {} : { usage: reportedUsage }
|
|
603
|
+
...reportedUsage === void 0 ? {} : { usage: reportedUsage },
|
|
604
|
+
...outcome.truncated ? { truncated: true } : {}
|
|
598
605
|
};
|
|
599
606
|
} catch (error) {
|
|
600
607
|
if (error instanceof EnhanceFailure) throw error;
|