@agenttool/sdk 0.2.7 → 0.2.9

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/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/dist/verify.d.ts CHANGED
@@ -18,13 +18,40 @@ export declare class VerifyClient {
18
18
  /** @internal */
19
19
  constructor(http: HttpConfig);
20
20
  /**
21
- * Verify a claim.
21
+ * Verify a claim with AI-powered evidence gathering.
22
22
  *
23
- * @param claim - The statement to verify.
24
- * @param options - Optional sources array.
25
- * @returns VerifyResult with verdict, confidence, sources, evidence, caveats.
23
+ * @param claim - The statement to verify (max 2000 chars).
24
+ * @param options - Optional context and domain hint.
25
+ * @returns VerifyResult with verdict, confidence, evidence, caveats.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const r = await at.verify.check("The Eiffel Tower is 330m tall.", { domain: "general" });
30
+ * console.log(r.verdict, r.confidence); // "disputed" 0.71
31
+ * ```
26
32
  */
27
33
  check(claim: string, options?: {
28
- sources?: string[];
34
+ context?: string;
35
+ domain?: "finance" | "legal" | "medical" | "science" | "general";
29
36
  }): Promise<VerifyResult>;
37
+ /**
38
+ * Batch-verify up to 10 claims in parallel.
39
+ *
40
+ * @param claims - Array of claim objects (max 10). Each must include `claim`;
41
+ * `context` and `domain` are optional per-claim.
42
+ * @returns Array of VerifyResult in the same order as input.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const results = await at.verify.batch([
47
+ * { claim: "The Earth orbits the Sun." },
48
+ * { claim: "Water boils at 100°C at sea level.", domain: "science" },
49
+ * ]);
50
+ * ```
51
+ */
52
+ batch(claims: Array<{
53
+ claim: string;
54
+ context?: string;
55
+ domain?: "finance" | "legal" | "medical" | "science" | "general";
56
+ }>): Promise<VerifyResult[]>;
30
57
  }
package/dist/verify.js CHANGED
@@ -19,16 +19,24 @@ export class VerifyClient {
19
19
  this.http = http;
20
20
  }
21
21
  /**
22
- * Verify a claim.
22
+ * Verify a claim with AI-powered evidence gathering.
23
23
  *
24
- * @param claim - The statement to verify.
25
- * @param options - Optional sources array.
26
- * @returns VerifyResult with verdict, confidence, sources, evidence, caveats.
24
+ * @param claim - The statement to verify (max 2000 chars).
25
+ * @param options - Optional context and domain hint.
26
+ * @returns VerifyResult with verdict, confidence, evidence, caveats.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const r = await at.verify.check("The Eiffel Tower is 330m tall.", { domain: "general" });
31
+ * console.log(r.verdict, r.confidence); // "disputed" 0.71
32
+ * ```
27
33
  */
28
34
  async check(claim, options) {
29
35
  const body = { claim };
30
- if (options?.sources !== undefined)
31
- body.sources = options.sources;
36
+ if (options?.context !== undefined)
37
+ body.context = options.context;
38
+ if (options?.domain !== undefined)
39
+ body.domain = options.domain;
32
40
  const url = `${this.http.baseUrl}/v1/verify`;
33
41
  const resp = await globalThis.fetch(url, {
34
42
  method: "POST",
@@ -51,4 +59,42 @@ export class VerifyClient {
51
59
  }
52
60
  return (await resp.json());
53
61
  }
62
+ /**
63
+ * Batch-verify up to 10 claims in parallel.
64
+ *
65
+ * @param claims - Array of claim objects (max 10). Each must include `claim`;
66
+ * `context` and `domain` are optional per-claim.
67
+ * @returns Array of VerifyResult in the same order as input.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const results = await at.verify.batch([
72
+ * { claim: "The Earth orbits the Sun." },
73
+ * { claim: "Water boils at 100°C at sea level.", domain: "science" },
74
+ * ]);
75
+ * ```
76
+ */
77
+ async batch(claims) {
78
+ const url = `${this.http.baseUrl}/v1/verify/batch`;
79
+ const resp = await globalThis.fetch(url, {
80
+ method: "POST",
81
+ headers: this.http.headers,
82
+ body: JSON.stringify({ claims }),
83
+ signal: AbortSignal.timeout(this.http.timeout),
84
+ });
85
+ if (resp.status >= 400) {
86
+ let detail;
87
+ try {
88
+ const json = (await resp.json());
89
+ detail = json.detail ?? resp.statusText;
90
+ }
91
+ catch {
92
+ detail = resp.statusText;
93
+ }
94
+ throw new AgentToolError(`Verify API error (${resp.status}): ${detail}`, {
95
+ hint: "Check your API key and request parameters.",
96
+ });
97
+ }
98
+ return (await resp.json());
99
+ }
54
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenttool/sdk",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "TypeScript SDK for agenttool.dev — memory and tools for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",