@hiper2d/ai-agents 0.37.0 → 0.39.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.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1401,7 +1401,14 @@ declare abstract class AbstractAgent {
|
|
|
1401
1401
|
* invalidResponseRetries policy. Subclasses implement doAskWithZodSchema/doAskText and
|
|
1402
1402
|
* must NOT override these.
|
|
1403
1403
|
*/
|
|
1404
|
-
|
|
1404
|
+
/**
|
|
1405
|
+
* `reject` is the host's own check on a schema-valid answer: return why it is unusable
|
|
1406
|
+
* (a required field left as an empty string, say) and the answer is treated exactly like
|
|
1407
|
+
* a malformed one: a ModelInvalidResponseError, re-sent under invalidResponseRetries.
|
|
1408
|
+
* It exists because a check written into the zod schema would change the JSON schema
|
|
1409
|
+
* the provider sees.
|
|
1410
|
+
*/
|
|
1411
|
+
askWithZodSchema<T>(zodSchema: z.ZodSchema<T>, messages: AIMessage[], reject?: (answer: T) => string | null | undefined): Promise<[T, string, TokenUsage$1?, string?]>;
|
|
1405
1412
|
askText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1406
1413
|
/**
|
|
1407
1414
|
* One attempt per loop; an empty or malformed answer (ModelInvalidResponseError, not
|
package/dist/index.d.ts
CHANGED
|
@@ -1401,7 +1401,14 @@ declare abstract class AbstractAgent {
|
|
|
1401
1401
|
* invalidResponseRetries policy. Subclasses implement doAskWithZodSchema/doAskText and
|
|
1402
1402
|
* must NOT override these.
|
|
1403
1403
|
*/
|
|
1404
|
-
|
|
1404
|
+
/**
|
|
1405
|
+
* `reject` is the host's own check on a schema-valid answer: return why it is unusable
|
|
1406
|
+
* (a required field left as an empty string, say) and the answer is treated exactly like
|
|
1407
|
+
* a malformed one: a ModelInvalidResponseError, re-sent under invalidResponseRetries.
|
|
1408
|
+
* It exists because a check written into the zod schema would change the JSON schema
|
|
1409
|
+
* the provider sees.
|
|
1410
|
+
*/
|
|
1411
|
+
askWithZodSchema<T>(zodSchema: z.ZodSchema<T>, messages: AIMessage[], reject?: (answer: T) => string | null | undefined): Promise<[T, string, TokenUsage$1?, string?]>;
|
|
1405
1412
|
askText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1406
1413
|
/**
|
|
1407
1414
|
* One attempt per loop; an empty or malformed answer (ModelInvalidResponseError, not
|
package/dist/index.js
CHANGED
|
@@ -1462,16 +1462,25 @@ var SupportedAiModels = {
|
|
|
1462
1462
|
// Speed tags from the 2026-08-05 live measurements (two samples each): plus 17.4s/14.5s,
|
|
1463
1463
|
// flash 14.3s/16.4s (both slow); max 30.6s/100.5s — its latency tracks how long it decides
|
|
1464
1464
|
// to think (4.2K reasoning tokens on the slow run), hence the budget cap below.
|
|
1465
|
+
//
|
|
1466
|
+
// `qwen-max` repointed 2026-11-16 from qwen3.8-max ($2/$6, hits $0.25) to qwen4-max
|
|
1467
|
+
// ($1.50/$4.50, hits $0.075; not yet in GET /models, but the chat endpoint serves it and
|
|
1468
|
+
// echoes the name). Probe on a real day-4 prompt (32K-char system prompt, ~10K tokens in,
|
|
1469
|
+
// cold cache, budget 1024, one call at a time): discussion 7-9s vs 5-7s, vote 9s vs 24s
|
|
1470
|
+
// (3.8 Max spent ~1,000 output tokens on a vote, 4 Max ~220), night action 12s vs 17s,
|
|
1471
|
+
// end-of-day notes 33s vs 34s; every answer valid through the shared schema. Three
|
|
1472
|
+
// identical calls sent AT ONCE timed out on both models (night action, notes) — the account
|
|
1473
|
+
// under a burst, not the model. The 'slow' tag is 3.8 Max's production grade (p90 26.2s);
|
|
1474
|
+
// re-grade from production turns once 4 Max has 100+.
|
|
1465
1475
|
[LLM_CONSTANTS.QWEN_MAX]: {
|
|
1466
|
-
displayName: "
|
|
1467
|
-
modelApiName: "
|
|
1476
|
+
displayName: "Qwen4 Max",
|
|
1477
|
+
modelApiName: "qwen4-max",
|
|
1468
1478
|
apiKeyName: API_KEY_CONSTANTS.QWEN,
|
|
1469
1479
|
hasThinking: true,
|
|
1470
1480
|
temperature: 0.7,
|
|
1471
|
-
// Caps `thinking_budget` to bound the
|
|
1472
|
-
//
|
|
1481
|
+
// Caps `thinking_budget` to bound the latency variance (3.8 Max swung 30–100s without
|
|
1482
|
+
// it). Uncapped, 4 Max's vote went 9s → 14s.
|
|
1473
1483
|
thinkingBudgetTokens: 1024,
|
|
1474
|
-
// Capped it measures 25-26s → the >25s tier.
|
|
1475
1484
|
tags: ["slow"]
|
|
1476
1485
|
},
|
|
1477
1486
|
// qwen3.8-flash replaced qwen3.7-flash on 2026-08-30 (same 1M context, 128k max output);
|
|
@@ -1825,10 +1834,11 @@ var MODEL_PRICING = {
|
|
|
1825
1834
|
// $0.016. Neither has input-length tiers (the tier column is "-" for both). These
|
|
1826
1835
|
// published cached rates supersede the 20%-of-input rule charged before 2026-08-30; we
|
|
1827
1836
|
// still don't send explicit cache_control.
|
|
1837
|
+
// qwen4-max (2026-11-16, same page): $1.50/$4.50, implicit-cache hits $0.075, no tiers.
|
|
1828
1838
|
[SupportedAiModels[LLM_CONSTANTS.QWEN_MAX].modelApiName]: {
|
|
1829
|
-
inputPrice:
|
|
1830
|
-
outputPrice:
|
|
1831
|
-
cacheHitPrice: 0.
|
|
1839
|
+
inputPrice: 1.5,
|
|
1840
|
+
outputPrice: 4.5,
|
|
1841
|
+
cacheHitPrice: 0.075
|
|
1832
1842
|
},
|
|
1833
1843
|
[SupportedAiModels[LLM_CONSTANTS.QWEN_FLASH].modelApiName]: {
|
|
1834
1844
|
inputPrice: 0.15,
|
|
@@ -2669,8 +2679,20 @@ var AbstractAgent = class {
|
|
|
2669
2679
|
* invalidResponseRetries policy. Subclasses implement doAskWithZodSchema/doAskText and
|
|
2670
2680
|
* must NOT override these.
|
|
2671
2681
|
*/
|
|
2672
|
-
|
|
2673
|
-
|
|
2682
|
+
/**
|
|
2683
|
+
* `reject` is the host's own check on a schema-valid answer: return why it is unusable
|
|
2684
|
+
* (a required field left as an empty string, say) and the answer is treated exactly like
|
|
2685
|
+
* a malformed one: a ModelInvalidResponseError, re-sent under invalidResponseRetries.
|
|
2686
|
+
* It exists because a check written into the zod schema would change the JSON schema
|
|
2687
|
+
* the provider sees.
|
|
2688
|
+
*/
|
|
2689
|
+
async askWithZodSchema(zodSchema, messages, reject) {
|
|
2690
|
+
return this.askWithRetries(async () => {
|
|
2691
|
+
const result = await this.doAskWithZodSchema(zodSchema, messages);
|
|
2692
|
+
const reason = reject?.(result[0]);
|
|
2693
|
+
if (reason) throw new ModelInvalidResponseError(this.model, reason);
|
|
2694
|
+
return result;
|
|
2695
|
+
});
|
|
2674
2696
|
}
|
|
2675
2697
|
async askText(messages) {
|
|
2676
2698
|
return this.askWithRetries(() => this.doAskText(messages));
|