@agenttool/sdk 0.2.8 → 0.2.10

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 CHANGED
@@ -110,6 +110,13 @@ const r = await at.verify.check("Bitcoin was created in 2009.", {
110
110
  domain: "finance", // "finance" | "science" | "medical" | "legal" | "general"
111
111
  context: "On the whitepaper publication date",
112
112
  });
113
+
114
+ // Batch verify up to 10 claims in parallel
115
+ const results = await at.verify.batch([
116
+ { claim: "The Earth orbits the Sun." },
117
+ { claim: "Water boils at 100°C at sea level.", domain: "science" },
118
+ ]);
119
+ // returns VerifyResult[] in same order
113
120
  ```
114
121
 
115
122
  ### Economy (wallets & escrows)
package/dist/traces.js CHANGED
@@ -37,32 +37,42 @@ export class TracesClient {
37
37
  * @returns The created Trace object with its trace_id.
38
38
  */
39
39
  async store(options) {
40
- const body = {
40
+ // API expects nested decision + reasoning objects
41
+ const decision = {
42
+ type: options.decision_type ?? "decision",
43
+ summary: options.decision_summary ?? options.conclusion.slice(0, 120),
44
+ };
45
+ if (options.output_ref !== undefined)
46
+ decision.output_ref = options.output_ref;
47
+ const reasoning = {
41
48
  observations: options.observations,
42
49
  conclusion: options.conclusion,
43
- decision_type: options.decision_type ?? "decision",
44
- decision_summary: options.decision_summary ?? options.conclusion.slice(0, 120),
45
50
  };
51
+ if (options.hypothesis !== undefined)
52
+ reasoning.hypothesis = options.hypothesis;
53
+ if (options.confidence !== undefined)
54
+ reasoning.confidence = options.confidence;
55
+ if (options.alternatives !== undefined)
56
+ reasoning.alternatives_considered = options.alternatives.map((a) => ({ option: a }));
57
+ if (options.key_facts !== undefined)
58
+ reasoning.signals = options.key_facts;
59
+ const body = { decision, reasoning };
46
60
  if (options.agent_id !== undefined)
47
61
  body.agent_id = options.agent_id;
48
62
  if (options.session_id !== undefined)
49
63
  body.session_id = options.session_id;
50
- if (options.output_ref !== undefined)
51
- body.output_ref = options.output_ref;
52
- if (options.hypothesis !== undefined)
53
- body.hypothesis = options.hypothesis;
54
- if (options.confidence !== undefined)
55
- body.confidence = options.confidence;
56
- if (options.alternatives !== undefined)
57
- body.alternatives = options.alternatives;
58
64
  if (options.tags !== undefined)
59
65
  body.tags = options.tags;
60
66
  if (options.parent_trace_id !== undefined)
61
67
  body.parent_trace_id = options.parent_trace_id;
62
- if (options.files_read !== undefined)
63
- body.files_read = options.files_read;
64
- if (options.key_facts !== undefined)
65
- body.key_facts = options.key_facts;
68
+ if (options.files_read !== undefined || options.key_facts !== undefined) {
69
+ const ctx = {};
70
+ if (options.files_read !== undefined)
71
+ ctx.files_read = options.files_read;
72
+ if (options.key_facts !== undefined)
73
+ ctx.key_facts = options.key_facts;
74
+ body.context = ctx;
75
+ }
66
76
  const resp = await globalThis.fetch(`${this.http.baseUrl}/v1/traces`, {
67
77
  method: "POST",
68
78
  headers: this.http.headers,
package/dist/types.d.ts CHANGED
@@ -78,13 +78,42 @@ export interface ExecuteResult {
78
78
  exit_code: number;
79
79
  duration_ms: number;
80
80
  }
81
+ /** A single source returned by agent-verify. */
82
+ export interface VerifySource {
83
+ url: string;
84
+ title: string;
85
+ date?: string;
86
+ reliability: number;
87
+ }
88
+ /** Evidence grouped by position. */
89
+ export interface VerifyEvidence {
90
+ supporting: Array<{
91
+ url: string;
92
+ title: string;
93
+ snippet: string;
94
+ reliability: number;
95
+ }>;
96
+ contradicting: Array<{
97
+ url: string;
98
+ title: string;
99
+ snippet: string;
100
+ reliability: number;
101
+ }>;
102
+ neutral: Array<{
103
+ url: string;
104
+ title: string;
105
+ snippet: string;
106
+ reliability: number;
107
+ }>;
108
+ }
81
109
  /** Result of a verification request. */
82
110
  export interface VerifyResult {
83
- verdict: string;
111
+ verdict: "verified" | "false" | "disputed" | "unverifiable";
84
112
  confidence: number;
85
- sources: string[];
86
- evidence: string;
113
+ sources: VerifySource[];
114
+ evidence: VerifyEvidence;
87
115
  caveats: string[];
116
+ processingMs?: number;
88
117
  }
89
118
  /** A wallet object. */
90
119
  export interface Wallet {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenttool/sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "TypeScript SDK for agenttool.dev — memory and tools for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",