@prestyj/ai 5.27.0 → 5.28.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.
package/dist/index.js CHANGED
@@ -1033,7 +1033,7 @@ function isAdaptiveThinkingModel(model) {
1033
1033
  function toAnthropicThinking(level, maxTokens, model) {
1034
1034
  if (isAdaptiveThinkingModel(model)) {
1035
1035
  let effort = level;
1036
- if (effort === "xhigh" && !/opus-5|opus-4-8|opus-4-7/.test(model)) {
1036
+ if (effort === "xhigh" && !/opus-5|opus-4[-.]8|opus-4[-.]7|sonnet-5[-.]5/.test(model)) {
1037
1037
  effort = "high";
1038
1038
  }
1039
1039
  return {
@@ -2036,7 +2036,7 @@ async function* runStream2(options) {
2036
2036
  const endpointKey = reasoningFieldKey(providerName, options.baseUrl, options.model);
2037
2037
  const client = createClient2(options);
2038
2038
  const isLocal = options.provider === "local";
2039
- const isKimiK3 = options.provider === "moonshot" && options.model === "kimi-k3";
2039
+ const isKimiK3 = options.provider === "moonshot" && (options.model === "kimi-k3" || options.model === "kimi-for-coding");
2040
2040
  const isManagedKimiK3 = isKimiK3 && options.baseUrl?.replace(/\/+$/, "").endsWith("/coding/v1") === true;
2041
2041
  const k3Effort = options.thinking ? toKimiK3Effort(options.thinking) : void 0;
2042
2042
  const isKimiK27 = options.provider === "moonshot" && options.model.startsWith("kimi-k2.7-code");
@@ -4137,7 +4137,7 @@ function isMediaObject(value) {
4137
4137
  function redactValue(value, options = {}) {
4138
4138
  const maxDepth = options.maxDepth ?? 20;
4139
4139
  const maxEntries = options.maxEntries ?? 1e4;
4140
- const seen = /* @__PURE__ */ new WeakSet();
4140
+ const ancestors = /* @__PURE__ */ new WeakSet();
4141
4141
  let entries = 0;
4142
4142
  const visit = (current, depth, sensitive = false) => {
4143
4143
  if (typeof current === "string") {
@@ -4151,8 +4151,15 @@ function redactValue(value, options = {}) {
4151
4151
  if (isBinary(current)) return current;
4152
4152
  if (current instanceof Date) return new Date(current.getTime());
4153
4153
  if (depth >= maxDepth) return TRUNCATED;
4154
- if (seen.has(current)) return CIRCULAR;
4155
- seen.add(current);
4154
+ if (ancestors.has(current)) return CIRCULAR;
4155
+ ancestors.add(current);
4156
+ try {
4157
+ return cloneObject(current, depth);
4158
+ } finally {
4159
+ ancestors.delete(current);
4160
+ }
4161
+ };
4162
+ const cloneObject = (current, depth) => {
4156
4163
  if (current instanceof Error) {
4157
4164
  const error = {
4158
4165
  name: current.name,