@hiper2d/ai-agents 0.3.0 → 0.3.1
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 +9 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2022,6 +2022,10 @@ var BudgetController = class {
|
|
|
2022
2022
|
};
|
|
2023
2023
|
|
|
2024
2024
|
// src/agents/abstract-agent.ts
|
|
2025
|
+
var beforeAskHook;
|
|
2026
|
+
function setBeforeAskHook(hook) {
|
|
2027
|
+
beforeAskHook = hook;
|
|
2028
|
+
}
|
|
2025
2029
|
var AbstractAgent = class {
|
|
2026
2030
|
name;
|
|
2027
2031
|
gameId;
|
|
@@ -2073,6 +2077,7 @@ var AbstractAgent = class {
|
|
|
2073
2077
|
* must NOT override these.
|
|
2074
2078
|
*/
|
|
2075
2079
|
async askWithZodSchema(zodSchema, messages) {
|
|
2080
|
+
if (beforeAskHook) await beforeAskHook(this);
|
|
2076
2081
|
const startedAt = Date.now();
|
|
2077
2082
|
try {
|
|
2078
2083
|
const [result, thinking, usage, signature] = await this.doAskWithZodSchema(zodSchema, messages);
|
|
@@ -2083,6 +2088,7 @@ var AbstractAgent = class {
|
|
|
2083
2088
|
}
|
|
2084
2089
|
}
|
|
2085
2090
|
async askText(messages) {
|
|
2091
|
+
if (beforeAskHook) await beforeAskHook(this);
|
|
2086
2092
|
const startedAt = Date.now();
|
|
2087
2093
|
try {
|
|
2088
2094
|
const [content, thinking, usage, signature] = await this.doAskText(messages);
|
|
@@ -4857,6 +4863,7 @@ export {
|
|
|
4857
4863
|
periodEnd,
|
|
4858
4864
|
periodKey,
|
|
4859
4865
|
safeValidateResponse,
|
|
4866
|
+
setBeforeAskHook,
|
|
4860
4867
|
setLlmLogger,
|
|
4861
4868
|
stableHashHex,
|
|
4862
4869
|
stripInlineThinking,
|