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 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: `phase:${phase}`, kind }, () => fn(...args));
1274
+ return tracer.startSpan({ name, kind }, () => fn(...args));
1275
1275
  });
1276
1276
  };
1277
1277
  }
1278
- function traceThink(fn) {
1279
- return phaseWrapper("think" /* THINK */, "think" /* THINK */, fn);
1280
- }
1281
- function traceDecide(fn) {
1282
- return phaseWrapper("decide" /* DECIDE */, "decide" /* DECIDE */, fn);
1283
- }
1284
- function traceAct(fn) {
1285
- return phaseWrapper("act" /* ACT */, "tool_call" /* TOOL_CALL */, fn);
1286
- }
1287
- function traceObserve(fn) {
1288
- return phaseWrapper("observe" /* OBSERVE */, "observe" /* OBSERVE */, fn);
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