agenr 3.2.0 → 2026.6.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +104 -3
  2. package/README.md +40 -42
  3. package/dist/adapters/skeln/index.d.ts +629 -51
  4. package/dist/adapters/skeln/index.js +782 -2039
  5. package/dist/build-before-turn-artifact-NPUHVWFE.js +71 -0
  6. package/dist/build-recall-artifact-F3LS3PZX.js +62 -0
  7. package/dist/chunk-5AYIXQRF.js +4452 -0
  8. package/dist/{chunk-FMQTRTWE.js → chunk-5TIP2EPP.js} +1453 -2563
  9. package/dist/{chunk-5LADPJ4C.js → chunk-GAERET5Q.js} +138 -504
  10. package/dist/chunk-GF3PX3VM.js +41 -0
  11. package/dist/chunk-GKZQ5AG5.js +44 -0
  12. package/dist/chunk-LDJN7CVU.js +3231 -0
  13. package/dist/{chunk-ZYADFKX3.js → chunk-MC3C2XM5.js} +34 -1
  14. package/dist/{chunk-KL6X2E3I.js → chunk-NBS62ES5.js} +1168 -816
  15. package/dist/chunk-NSLTJBUC.js +270 -0
  16. package/dist/chunk-OJSIZDZD.js +9 -0
  17. package/dist/chunk-OWGQWQUP.js +45 -0
  18. package/dist/{chunk-ZAX3YSTU.js → chunk-Q5UTJXHZ.js} +2 -140
  19. package/dist/{chunk-TMDNFBBC.js → chunk-SOQW7356.js} +271 -1935
  20. package/dist/chunk-VBPYU7GO.js +597 -0
  21. package/dist/chunk-VTHBPXDQ.js +1750 -0
  22. package/dist/{chunk-UEGURBBW.js → chunk-XFJ4S4G2.js} +844 -39
  23. package/dist/chunk-Y5NB3FTH.js +106 -0
  24. package/dist/{chunk-6HY5F5FE.js → chunk-ZX55JBV2.js} +1704 -314
  25. package/dist/cli.js +1125 -9537
  26. package/dist/core/recall/index.d.ts +64 -6
  27. package/dist/core/recall/index.js +8 -1
  28. package/dist/internal-eval-server.js +9 -6
  29. package/dist/internal-recall-eval-server.js +9 -6
  30. package/dist/lifecycle-checkpoint-IAC5FCQU.js +154 -0
  31. package/dist/{ports-CpzWESmZ.d.ts → ports-C4QkwDBS.d.ts} +114 -69
  32. package/dist/scan-6JKPOQHD.js +6 -0
  33. package/dist/service-EKFACEN6.js +15 -0
  34. package/dist/service-RHNB5AEQ.js +861 -0
  35. package/dist/sink-AUAAWC5O.js +8 -0
  36. package/package.json +7 -4
  37. package/dist/adapters/openclaw/index.d.ts +0 -32
  38. package/dist/adapters/openclaw/index.js +0 -3112
  39. /package/dist/{chunk-GELCEVFA.js → chunk-5AXMFBHR.js} +0 -0
@@ -0,0 +1,71 @@
1
+ import {
2
+ BEFORE_TURN_DEBUG_ARTIFACT_DEFAULT_TOP_K,
3
+ BEFORE_TURN_DEBUG_ARTIFACT_MAX_TOP_K
4
+ } from "./chunk-5AXMFBHR.js";
5
+
6
+ // src/adapters/openclaw/debug/build-before-turn-artifact.ts
7
+ function buildLiveBeforeTurnDebugArtifact(params) {
8
+ const { caseId, patch, currentTurnText, trigger, eventLevel, maxTopCandidates } = params;
9
+ const diagnostics = patch.diagnostics;
10
+ const includeCandidateBreakdown = eventLevel === "detailed";
11
+ const topK = includeCandidateBreakdown ? clampTopK(maxTopCandidates) : 0;
12
+ const durableTopCandidates = includeCandidateBreakdown ? buildDurableCandidates(patch, topK) : [];
13
+ const procedureTopCandidates = includeCandidateBreakdown ? buildProcedureCandidates(patch, topK) : [];
14
+ const normalizedTrigger = trigger?.trim() || "unspecified";
15
+ return {
16
+ schemaVersion: "before-turn-debug-artifact.v1",
17
+ caseId,
18
+ input: {
19
+ trigger: normalizedTrigger,
20
+ currentTurnText
21
+ },
22
+ ...diagnostics.queryPolicy ? { queryPolicy: diagnostics.queryPolicy } : {},
23
+ ...diagnostics.queryVariants.length > 0 ? { queryVariants: [...diagnostics.queryVariants] } : {},
24
+ ...diagnostics.abstentionReasons.length > 0 ? { abstentionReasons: [...diagnostics.abstentionReasons] } : {},
25
+ selectedEntryIds: patch.durableMemory.map((item) => item.entry.id),
26
+ selectedProcedureKey: patch.procedure?.procedure.procedure_key ?? null,
27
+ ...durableTopCandidates.length > 0 ? { durableRecallTopCandidates: durableTopCandidates } : {},
28
+ ...procedureTopCandidates.length > 0 ? { procedureTopCandidates } : {}
29
+ };
30
+ }
31
+ function clampTopK(requested) {
32
+ if (!Number.isFinite(requested) || !Number.isInteger(requested)) {
33
+ return BEFORE_TURN_DEBUG_ARTIFACT_DEFAULT_TOP_K;
34
+ }
35
+ if (requested < 1) {
36
+ return 0;
37
+ }
38
+ if (requested > BEFORE_TURN_DEBUG_ARTIFACT_MAX_TOP_K) {
39
+ return BEFORE_TURN_DEBUG_ARTIFACT_MAX_TOP_K;
40
+ }
41
+ return requested;
42
+ }
43
+ function buildDurableCandidates(patch, topK) {
44
+ if (topK < 1) {
45
+ return [];
46
+ }
47
+ return patch.durableMemory.slice(0, topK).map((item) => {
48
+ const reasons = item.whySurfaced.reasons.length > 0 ? [...item.whySurfaced.reasons] : void 0;
49
+ return {
50
+ id: item.entry.id,
51
+ score: item.score,
52
+ ...reasons ? { reasons } : {}
53
+ };
54
+ });
55
+ }
56
+ function buildProcedureCandidates(patch, topK) {
57
+ if (!patch.procedure || topK < 1) {
58
+ return [];
59
+ }
60
+ const reasons = patch.procedure.whySurfaced.reasons.length > 0 ? [...patch.procedure.whySurfaced.reasons] : void 0;
61
+ return [
62
+ {
63
+ procedureKey: patch.procedure.procedure.procedure_key,
64
+ score: patch.procedure.score,
65
+ ...reasons ? { reasons } : {}
66
+ }
67
+ ];
68
+ }
69
+ export {
70
+ buildLiveBeforeTurnDebugArtifact
71
+ };
@@ -0,0 +1,62 @@
1
+ import {
2
+ RECALL_DEBUG_ARTIFACT_DEFAULT_TOP_K,
3
+ RECALL_DEBUG_ARTIFACT_MAX_TOP_K
4
+ } from "./chunk-5AXMFBHR.js";
5
+
6
+ // src/adapters/openclaw/debug/build-recall-artifact.ts
7
+ function buildLiveRecallDebugArtifact(params) {
8
+ const { caseId, query, result, eventLevel, maxTopCandidates } = params;
9
+ const selectedEntryIds = result.entries.map((entry) => entry.entry.id);
10
+ const includeCandidateBreakdown = eventLevel === "detailed";
11
+ const topK = includeCandidateBreakdown ? clampTopK(maxTopCandidates) : 0;
12
+ const reasonsByEntryId = /* @__PURE__ */ new Map();
13
+ for (const projected of result.projectedEntries) {
14
+ if (projected.whySurfaced.reasons.length > 0) {
15
+ reasonsByEntryId.set(projected.entryId, [...projected.whySurfaced.reasons]);
16
+ }
17
+ }
18
+ const topCandidates = includeCandidateBreakdown ? buildTopCandidates(result, reasonsByEntryId, topK) : [];
19
+ return {
20
+ schemaVersion: "recall-debug-artifact.v1",
21
+ caseId,
22
+ request: {
23
+ recallPath: "unified",
24
+ query
25
+ },
26
+ routing: result.routing,
27
+ selectedEntryIds,
28
+ ...topCandidates.length > 0 ? { topCandidates } : {}
29
+ };
30
+ }
31
+ function clampTopK(requested) {
32
+ if (!Number.isFinite(requested) || !Number.isInteger(requested)) {
33
+ return RECALL_DEBUG_ARTIFACT_DEFAULT_TOP_K;
34
+ }
35
+ if (requested < 1) {
36
+ return 0;
37
+ }
38
+ if (requested > RECALL_DEBUG_ARTIFACT_MAX_TOP_K) {
39
+ return RECALL_DEBUG_ARTIFACT_MAX_TOP_K;
40
+ }
41
+ return requested;
42
+ }
43
+ function buildTopCandidates(result, reasonsByEntryId, topK) {
44
+ if (topK < 1) {
45
+ return [];
46
+ }
47
+ return result.entries.slice(0, topK).map((entry) => {
48
+ const reasons = reasonsByEntryId.get(entry.entry.id);
49
+ return {
50
+ id: entry.entry.id,
51
+ score: entry.score,
52
+ lexicalScore: entry.scores.lexical,
53
+ vectorScore: entry.scores.vector,
54
+ recencyScore: entry.scores.recency,
55
+ importanceScore: entry.scores.importance,
56
+ ...reasons && reasons.length > 0 ? { reasons } : {}
57
+ };
58
+ });
59
+ }
60
+ export {
61
+ buildLiveRecallDebugArtifact
62
+ };