@surfishs/dsh-prompt-enhance 0.1.0 → 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/lib/index.js CHANGED
@@ -79,7 +79,11 @@ var DEFAULT_VALUES = {
79
79
  streaming: true,
80
80
  contextAware: true,
81
81
  contextMaxMessages: 8,
82
- contextMaxChars: 4e3
82
+ contextMaxChars: 4e3,
83
+ /** Play the card's expand/collapse transition. */
84
+ foldAnimation: true,
85
+ /** Fold the card after Apply, and re-open it after Undo. */
86
+ autoFold: true
83
87
  };
84
88
 
85
89
  // src/shared/limits.ts
@@ -112,6 +116,8 @@ var Config = z.object({
112
116
  maxConcurrent: z.number().step(1).min(FIELD_LIMITS.maxConcurrent.min).max(FIELD_LIMITS.maxConcurrent.max).default(DEFAULT_CONFIG.maxConcurrent).description("\u5BBF\u4E3B\u4FA7\u5E76\u53D1\u4E0A\u9650\uFF1A\u540C\u65F6\u8FDB\u884C\u7684\u589E\u5F3A\u8C03\u7528\u6570\uFF0C\u8D85\u51FA\u7684\u8BF7\u6C42\u8FD4\u56DE 429").volatile(),
113
117
  rateLimitPerMinute: z.number().step(1).min(FIELD_LIMITS.rateLimitPerMinute.min).max(FIELD_LIMITS.rateLimitPerMinute.max).default(DEFAULT_CONFIG.rateLimitPerMinute).description("\u6BCF\u5206\u949F\u589E\u5F3A\u6B21\u6570\u4E0A\u9650\uFF08\u6ED1\u52A8\u7A97\u53E3\uFF09\uFF0C\u8D85\u51FA\u8FD4\u56DE 429").volatile(),
114
118
  streaming: z.boolean().default(DEFAULT_CONFIG.streaming).description("\u589E\u91CF\u5C55\u793A\uFF1A\u6A21\u578B\u8FB9\u5199\u8FB9\u5728\u9762\u677F\u663E\u793A\uFF08\u4EC5\u5F71\u54CD\u663E\u793A\u8282\u594F\uFF0C\u6700\u7EC8\u7ED3\u679C\u4E0D\u53D8\uFF1B\u5BBF\u4E3B\u6216\u7F51\u7EDC\u4E0D\u652F\u6301\u65F6\u81EA\u52A8\u56DE\u9000\u4E3A\u4E00\u6B21\u6027\u8FD4\u56DE\uFF09").volatile(),
119
+ foldAnimation: z.boolean().default(DEFAULT_CONFIG.foldAnimation).description("\u5361\u7247\u6298\u53E0\u52A8\u753B\uFF1A\u5C55\u5F00/\u6536\u8D77\u65F6\u64AD\u653E\u8FC7\u6E21\uFF1B\u5173\u95ED\u540E\u7ACB\u5373\u5207\u6362\uFF08\u7CFB\u7EDF\u300C\u51CF\u5C11\u52A8\u6001\u6548\u679C\u300D\u504F\u597D\u59CB\u7EC8\u4F18\u5148\uFF09").volatile(),
120
+ autoFold: z.boolean().default(DEFAULT_CONFIG.autoFold).description("\u81EA\u52A8\u6536\u7EB3\u5361\u7247\uFF1A\u56DE\u586B\u5230\u8F93\u5165\u6846\u540E\u81EA\u52A8\u6536\u8D77\u5361\u7247\uFF0C\u64A4\u9500\u540E\u81EA\u52A8\u5C55\u5F00\uFF1B\u5173\u95ED\u540E\u5361\u7247\u4FDD\u6301\u5F53\u524D\u5C55\u5F00\u72B6\u6001").volatile(),
115
121
  contextAware: z.boolean().default(DEFAULT_CONFIG.contextAware).description("\u4E0A\u4E0B\u6587\u611F\u77E5\uFF1A\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u8FD1\u671F\u5BF9\u8BDD\uFF0C\u7528\u4E8E\u6D88\u89E3\u6307\u4EE3\u3001\u8865\u5168\u7701\u7565\u4E0E\u672F\u8BED\u7EA6\u675F\uFF1B\u65E0\u5386\u53F2\u6216\u5386\u53F2\u4E0D\u8DB3\u65F6\u81EA\u52A8\u56DE\u9000\u4E3A\u5355\u6761\u589E\u5F3A\uFF0C\u4E0D\u81C6\u9020\u4FE1\u606F").volatile(),
116
122
  contextMaxMessages: z.number().step(1).min(FIELD_LIMITS.contextMaxMessages.min).max(FIELD_LIMITS.contextMaxMessages.max).default(DEFAULT_CONFIG.contextMaxMessages).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u6761\u6570\uFF09\uFF1A\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u6761 user/assistant \u8F6E\u6B21\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile(),
117
123
  contextMaxChars: z.number().step(1).min(FIELD_LIMITS.contextMaxChars.min).max(FIELD_LIMITS.contextMaxChars.max).default(DEFAULT_CONFIG.contextMaxChars).description("\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF08\u5B57\u6570\uFF09\uFF1A\u5386\u53F2\u7247\u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF0C\u4ECE\u6700\u65B0\u4E00\u6761\u5411\u524D\u88C5\u914D\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003").volatile()
@@ -166,6 +172,8 @@ function resolveConfig(config) {
166
172
  maxConcurrent: intInRange(config.maxConcurrent, "maxConcurrent", FIELD_LIMITS.maxConcurrent),
167
173
  rateLimitPerMinute: intInRange(config.rateLimitPerMinute, "rateLimitPerMinute", FIELD_LIMITS.rateLimitPerMinute),
168
174
  streaming: typeof config.streaming === "boolean" ? config.streaming : DEFAULT_CONFIG.streaming,
175
+ foldAnimation: typeof config.foldAnimation === "boolean" ? config.foldAnimation : DEFAULT_CONFIG.foldAnimation,
176
+ autoFold: typeof config.autoFold === "boolean" ? config.autoFold : DEFAULT_CONFIG.autoFold,
169
177
  contextAware: typeof config.contextAware === "boolean" ? config.contextAware : DEFAULT_CONFIG.contextAware,
170
178
  contextMaxMessages: intInRange(config.contextMaxMessages, "contextMaxMessages", FIELD_LIMITS.contextMaxMessages),
171
179
  contextMaxChars: intInRange(config.contextMaxChars, "contextMaxChars", FIELD_LIMITS.contextMaxChars)
@@ -680,6 +688,9 @@ async function enhanceText(llm, options) {
680
688
  provider: options.route.provider,
681
689
  model: options.route.model,
682
690
  elapsedMs: Date.now() - started,
691
+ // What was actually sent: a rejected tier is retried without the field, so
692
+ // the retry path reports inherit rather than the tier that never ran.
693
+ reasoningEffort: retriedWithoutEffort ? "inherit" : requestedEffort,
683
694
  ...reportedUsage === void 0 ? {} : { usage: reportedUsage },
684
695
  ...outcome.truncated ? { truncated: true } : {}
685
696
  };