risicare 0.2.0 → 0.2.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/dist/index.cjs +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -8
- package/dist/index.d.ts +28 -8
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1264,28 +1264,36 @@ function withPhase(phase, fn) {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
1266
|
// src/decorators/phase.ts
|
|
1267
|
-
function phaseWrapper(phase, kind, fn) {
|
|
1267
|
+
function phaseWrapper(phase, kind, name, fn) {
|
|
1268
1268
|
return (...args) => {
|
|
1269
1269
|
const tracer = getTracer2();
|
|
1270
1270
|
if (!tracer) {
|
|
1271
1271
|
return fn(...args);
|
|
1272
1272
|
}
|
|
1273
1273
|
return withPhase(phase, () => {
|
|
1274
|
-
return tracer.startSpan({ name
|
|
1274
|
+
return tracer.startSpan({ name, kind }, () => fn(...args));
|
|
1275
1275
|
});
|
|
1276
1276
|
};
|
|
1277
1277
|
}
|
|
1278
|
-
function traceThink(
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1278
|
+
function traceThink(fnOrName, maybeFn) {
|
|
1279
|
+
const name = typeof fnOrName === "string" ? fnOrName : `phase:think`;
|
|
1280
|
+
const fn = typeof fnOrName === "function" ? fnOrName : maybeFn;
|
|
1281
|
+
return phaseWrapper("think" /* THINK */, "think" /* THINK */, name, fn);
|
|
1282
|
+
}
|
|
1283
|
+
function traceDecide(fnOrName, maybeFn) {
|
|
1284
|
+
const name = typeof fnOrName === "string" ? fnOrName : `phase:decide`;
|
|
1285
|
+
const fn = typeof fnOrName === "function" ? fnOrName : maybeFn;
|
|
1286
|
+
return phaseWrapper("decide" /* DECIDE */, "decide" /* DECIDE */, name, fn);
|
|
1287
|
+
}
|
|
1288
|
+
function traceAct(fnOrName, maybeFn) {
|
|
1289
|
+
const name = typeof fnOrName === "string" ? fnOrName : `phase:act`;
|
|
1290
|
+
const fn = typeof fnOrName === "function" ? fnOrName : maybeFn;
|
|
1291
|
+
return phaseWrapper("act" /* ACT */, "tool_call" /* TOOL_CALL */, name, fn);
|
|
1292
|
+
}
|
|
1293
|
+
function traceObserve(fnOrName, maybeFn) {
|
|
1294
|
+
const name = typeof fnOrName === "string" ? fnOrName : `phase:observe`;
|
|
1295
|
+
const fn = typeof fnOrName === "function" ? fnOrName : maybeFn;
|
|
1296
|
+
return phaseWrapper("observe" /* OBSERVE */, "observe" /* OBSERVE */, name, fn);
|
|
1289
1297
|
}
|
|
1290
1298
|
|
|
1291
1299
|
// src/decorators/multi-agent.ts
|