@arcproof/sdk-elizaos 0.1.0 → 0.2.0

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
@@ -1,6 +1,16 @@
1
1
  # @arcproof/sdk-elizaos
2
2
 
3
- ElizaOS plugin adapter for [`@arcproof/sdk`](../sdk): expose a bonded, independently-verified, real-payment flow as a real ElizaOS `Action`/`Plugin`.
3
+ ElizaOS adapter for [`@arcproof/sdk`](../sdk): the full orchestrator specialists → evaluator → real-payment flow, as a real ElizaOS `Action`/`Plugin`.
4
+
5
+ **A standalone alternative to [`@arcproof/sdk-langchain`](../sdk-langchain), not an add-on.** This package ships its own native orchestrator + specialist builders (`createElizaOrchestrator`, `createElizaClaimGatherer`) that run entirely on ElizaOS's own model API (`runtime.useModel`) -- **zero LangChain dependency**. So `@arcproof/sdk` + `@arcproof/sdk-elizaos` alone gives you the complete pipeline; you never need `@arcproof/sdk-langchain` unless you specifically want LangChain.
6
+
7
+ ```text
8
+ orchestrator (createElizaOrchestrator) -- picks which specialists a request needs
9
+ specialist (createElizaClaimGatherer) -- runs its tools, drafts claims via runtime.useModel
10
+ evaluator (@arcproof/sdk's VerifierRegistry) -- independently verifies, zero LLM calls
11
+ ```
12
+
13
+ Pick this or `@arcproof/sdk-langchain` based purely on which agent framework your product already runs on -- the trust layer (verification + on-chain payment, in `@arcproof/sdk` core) is identical either way.
4
14
 
5
15
  ## Install
6
16
 
@@ -8,26 +18,81 @@ ElizaOS plugin adapter for [`@arcproof/sdk`](../sdk): expose a bonded, independe
8
18
  npm install @arcproof/sdk @arcproof/sdk-elizaos @elizaos/core
9
19
  ```
10
20
 
11
- ## Usage
21
+ ## Usage A -- standalone (native ElizaOS, no LangChain)
22
+
23
+ Real, working code from [`examples/defi-diligence-agent`](../../examples/defi-diligence-agent) (`src/shared-native.ts` + `src/elizaos-native.ts`). The three specialists (`onchain-agent-v1`, `news-agent-v1`, `compliance-agent-v1`) are built with this package's own `createElizaClaimGatherer`, and the orchestrator with `createElizaOrchestrator` -- all on `runtime.useModel`, no LangChain anywhere. Verified live on Arc testnet: orchestrator plan → specialists → deterministic verification against live DefiLlama/CoinGecko/Snapshot data → real per-specialist payout, `ACCEPT`.
24
+
25
+ ```ts
26
+ import { createElizaClaimGatherer, createElizaOrchestrator, createArcProofAction, type ElizaTool } from "@arcproof/sdk-elizaos";
27
+ import { VerifierRegistry, ARC_TESTNET } from "@arcproof/sdk";
28
+
29
+ // A tool is a plain async fn returning a text result (or an "ERROR: ..." line
30
+ // the model is told to skip) -- no LangChain tool() wrapper.
31
+ const fetchTvl: ElizaTool = {
32
+ name: "fetch_tvl",
33
+ description: "Fetch a protocol's live TVL in USD.",
34
+ run: async (ctx) => `tvl_usd=${await lookUpTvl(ctx.protocolSlug)} source=... simulated=false`,
35
+ };
36
+
37
+ const onchain = createElizaClaimGatherer({
38
+ agentId: "onchain-agent-v1",
39
+ tools: [fetchTvl /*, ... */],
40
+ claimTypes: ["tvl", "price_change", "wallet_flow", "token_concentration"],
41
+ systemPrompt: "You are the on-chain data specialist. Draft one claim per metric your tools returned; copy values verbatim.",
42
+ });
43
+
44
+ // Orchestrator picks which specialists a given request needs.
45
+ const gatherClaims = createElizaOrchestrator({
46
+ specialists: [{ id: "onchain-agent-v1", description: "On-chain data: TVL, price, wallet flow, concentration.", gatherClaims: onchain } /*, news, compliance */],
47
+ });
48
+
49
+ const action = createArcProofAction({
50
+ name: "DEFI_TREASURY_DILIGENCE",
51
+ description: "Independently verifies protocol claims before treasury deployment, paying each specialist only if its claims check out.",
52
+ trustedAgentConfig: { network: ARC_TESTNET, contractAddress, verifiers /* VerifierRegistry, one entry per claim_type */ },
53
+ requester, settler, providerAddresses,
54
+ budgetAmount: 0.3,
55
+ gatherClaims, // the native ElizaOS orchestrator -- createArcProofAction injects runtime.useModel into its context automatically
56
+ buildContext: (message) => ({ protocolSlug: "uniswap", requestText: message.content.text }),
57
+ });
58
+ ```
59
+
60
+ `createArcProofAction`'s handler injects the ElizaOS `runtime` it receives into the job context, so the native gatherers reach `runtime.useModel` without you wiring anything -- the `gatherClaims(context)` signature stays framework-agnostic.
61
+
62
+ ## Usage B -- reuse a LangChain orchestrator (if you already have one)
63
+
64
+ If your specialists are already built with [`@arcproof/sdk-langchain`](../sdk-langchain), you can pass its orchestrator straight into `createArcProofAction` -- ElizaOS never has to know the difference. Real, working code from [`examples/lending-apr-agent`](../../examples/lending-apr-agent) (`src/elizaos-demo.ts` + `src/shared.ts`), verified live.
12
65
 
13
66
  ```ts
14
67
  import { createArcProofAction, createArcProofPlugin } from "@arcproof/sdk-elizaos";
68
+ import { createLangChainOrchestrator } from "@arcproof/sdk-langchain";
15
69
  import { VerifierRegistry, ARC_TESTNET } from "@arcproof/sdk";
70
+ import { getModel, makeSpecialists, makeVerifiers } from "./shared.js"; // same file the LangChain-only entrypoint uses
71
+
72
+ const model = await getModel();
73
+ const specialists = makeSpecialists(model); // lending-apr-agent-v1 + lending-eligibility-agent-v1
74
+ const verifiers = makeVerifiers(); // one VerifierRegistry entry per claim_type, deterministic
75
+
76
+ // The orchestrator IS the gatherClaims the ElizaOS action calls -- no
77
+ // separate ElizaOS-specific planning logic needed. Could just as easily be
78
+ // a single createLangChainClaimGatherer() instead of a full orchestrator;
79
+ // ElizaOS never has to know the difference, it just sees the reply either way.
80
+ const gatherClaims = createLangChainOrchestrator({
81
+ model,
82
+ specialists,
83
+ buildPlanningMessage: (context) => `Request: ${context.requestText}\nLoan id: ${context.loanId}`,
84
+ });
16
85
 
17
86
  const action = createArcProofAction({
18
87
  name: "CHECK_TRUE_APR",
19
- description: "Independently verifies a loan's true APR before answering, paying the specialist only if it checks out.",
20
- trustedAgentConfig: { network: ARC_TESTNET, contractAddress, verifiers: myVerifierRegistry },
88
+ description: "Independently verifies a loan's true APR and borrower eligibility before answering, paying each specialist only if their claim checks out.",
89
+ trustedAgentConfig: { network: ARC_TESTNET, contractAddress, verifiers },
21
90
  requester, // WalletCredential
22
91
  settler, // WalletCredential
23
92
  providerAddresses: { "lending-apr-agent-v1": "0x...", "lending-eligibility-agent-v1": "0x..." },
24
- budgetAmount: 0.05,
25
- // gatherClaims can be a single @arcproof/sdk-langchain gatherer, or a full
26
- // orchestrator (createLangChainOrchestrator) that itself decides which
27
- // specialists this specific request needs -- ElizaOS never has to know
28
- // the difference, it just sees the natural-language reply either way.
29
- gatherClaims: myOrchestratorOrGatherer,
30
- buildContext: (message) => ({ loanId: extractLoanId(message.content.text), requestText: message.content.text }),
93
+ budgetAmount: 0.06,
94
+ gatherClaims,
95
+ buildContext: (message) => ({ loanId: "loan-001", requestText: message.content.text }),
31
96
  });
32
97
 
33
98
  const plugin = createArcProofPlugin({
@@ -45,6 +110,13 @@ const plugin = createArcProofPlugin({
45
110
 
46
111
  This package defines structurally-identical local types (`ElizaAction`, `ElizaPlugin`, etc.) instead of depending on that fragile export path. TypeScript's structural typing makes the objects this package builds assignable to the real `Action`/`Plugin` types wherever your actual ElizaOS runtime code expects them -- `@elizaos/core` is still a declared peer dependency because you need the real package installed to run an agent at all.
47
112
 
113
+ ## Worked examples (real, verified live)
114
+
115
+ Both ship an `elizaos-demo.ts` that drives the exact same specialists as their LangChain entrypoint through a real `ElizaAction.handler` -- proving the two adapters are interchangeable, not two different products:
116
+
117
+ - [`examples/defi-diligence-agent`](../../examples/defi-diligence-agent) -- the real `onchain-agent-v1`/`news-agent-v1`/`compliance-agent-v1` DeFi specialists.
118
+ - [`examples/lending-apr-agent`](../../examples/lending-apr-agent) -- a different vertical (lending true-APR + eligibility).
119
+
48
120
  ## License
49
121
 
50
122
  MIT
@@ -0,0 +1,59 @@
1
+ import type { Claim } from "@arcproof/sdk";
2
+ /** The one ElizaOS runtime method these builders need. `@elizaos/core`'s
3
+ * IAgentRuntime satisfies this structurally -- kept as a minimal local
4
+ * type for the same import-ambiguity reason documented in index.ts. */
5
+ export interface ElizaModelRuntime {
6
+ useModel: (modelType: string, params: {
7
+ prompt: string;
8
+ schema?: unknown;
9
+ output?: "object" | "array" | "enum";
10
+ temperature?: number;
11
+ }) => Promise<unknown>;
12
+ }
13
+ /** Key under which createArcProofAction stashes the ElizaOS runtime in the job context. */
14
+ export declare const ELIZA_RUNTIME_CONTEXT_KEY = "__elizaRuntime";
15
+ /** A plain data-fetching tool -- returns a text result (same "tool output"
16
+ * convention as the LangChain adapter: state the value, or an "ERROR: ..."
17
+ * line the model is told to treat as "skip that data point"). */
18
+ export interface ElizaTool {
19
+ name: string;
20
+ description: string;
21
+ run: (context: Record<string, unknown>) => Promise<string>;
22
+ }
23
+ export interface ElizaClaimGathererOptions {
24
+ /** Becomes claim.provider_agent_id on every claim this specialist drafts. */
25
+ agentId: string;
26
+ tools: ElizaTool[];
27
+ /** Restrict claim_type to this set (documented in the prompt) -- optional. */
28
+ claimTypes?: string[];
29
+ systemPrompt: string;
30
+ /** Builds the request line from the job context. Defaults to JSON.stringify(context minus the runtime). */
31
+ buildUserMessage?: (context: Record<string, unknown>) => string;
32
+ }
33
+ /**
34
+ * Wraps a set of tools + a prompt as a `gatherClaims()` function that runs
35
+ * on ElizaOS's own model runtime. Resilient by design: if the model call
36
+ * fails, it logs and returns zero claims rather than throwing --
37
+ * runTrustedJob's hasCheckableClaims guard turns "this provider produced
38
+ * nothing" into a refund, not a false accept.
39
+ */
40
+ export declare function createElizaClaimGatherer(options: ElizaClaimGathererOptions): (context: Record<string, unknown>) => Promise<Claim[]>;
41
+ export interface ElizaSpecialistDescriptor {
42
+ id: string;
43
+ description: string;
44
+ gatherClaims: (context: Record<string, unknown>) => Promise<Claim[]>;
45
+ }
46
+ export interface ElizaOrchestratorOptions {
47
+ specialists: ElizaSpecialistDescriptor[];
48
+ buildPlanningMessage?: (context: Record<string, unknown>) => string;
49
+ systemPromptPrefix?: string;
50
+ }
51
+ /**
52
+ * Builds a `gatherClaims()` that first asks ElizaOS's model which
53
+ * registered specialists this specific request needs, then runs only
54
+ * those and merges their claims -- the ElizaOS-native equivalent of
55
+ * @arcproof/sdk-langchain's createLangChainOrchestrator, with no LangChain
56
+ * dependency. A genuine planning failure propagates (runTrustedJob refunds);
57
+ * a successful-but-empty plan defaults to engaging every specialist.
58
+ */
59
+ export declare function createElizaOrchestrator(options: ElizaOrchestratorOptions): (context: Record<string, unknown>) => Promise<Claim[]>;
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Native ElizaOS orchestrator + specialist builders -- the piece that
3
+ * makes @arcproof/sdk-elizaos a genuine STANDALONE alternative to
4
+ * @arcproof/sdk-langchain, not an add-on that requires it.
5
+ *
6
+ * These build claim-gathering functions that run entirely on ElizaOS's
7
+ * own model API (`runtime.useModel(ModelType.OBJECT_LARGE, ...)`), with
8
+ * zero LangChain dependency. So `@arcproof/sdk` + `@arcproof/sdk-elizaos`
9
+ * alone gives the full orchestrator -> specialists -> evaluator pipeline:
10
+ * orchestrator (createElizaOrchestrator) -- picks which specialists a request needs
11
+ * specialist (createElizaClaimGatherer) -- runs its tools, drafts claims
12
+ * evaluator (@arcproof/sdk's VerifierRegistry) -- independently verifies, zero LLM
13
+ *
14
+ * How the ElizaOS model runtime reaches these functions: createArcProofAction
15
+ * injects the `runtime` it receives in its handler into the job `context`
16
+ * (context.__elizaRuntime), and these read it back out. That keeps the
17
+ * gatherClaims signature `(context) => Promise<Claim[]>` identical to the
18
+ * LangChain adapter's, so an ArcProof action doesn't care which framework
19
+ * built its gatherer.
20
+ *
21
+ * Design note -- deterministic tool invocation, LLM claim drafting: unlike
22
+ * LangChain's createReactAgent (an LLM tool-*calling* loop where the model
23
+ * chooses which tools to invoke), a specialist here runs all its declared
24
+ * tools, then hands the raw results to one structured-output model call
25
+ * that drafts claims. This is deliberate: it's far more reliable than
26
+ * parsing multi-turn tool-call JSON out of ElizaOS's plain useModel, and
27
+ * for these specialists the tool choice is trivial anyway (the on-chain
28
+ * agent calls all four of its tools every time). The genuinely LLM-shaped
29
+ * work -- deciding how to phrase each claim, copying values verbatim,
30
+ * omitting data points a tool couldn't produce -- still runs through the
31
+ * model, exactly as in the LangChain path.
32
+ */
33
+ import { randomUUID } from "node:crypto";
34
+ const OBJECT_LARGE = "OBJECT_LARGE"; // ModelType.OBJECT_LARGE
35
+ /** Key under which createArcProofAction stashes the ElizaOS runtime in the job context. */
36
+ export const ELIZA_RUNTIME_CONTEXT_KEY = "__elizaRuntime";
37
+ function runtimeFrom(context) {
38
+ const rt = context[ELIZA_RUNTIME_CONTEXT_KEY];
39
+ if (!rt || typeof rt.useModel !== "function") {
40
+ throw new Error("no ElizaOS runtime in context -- createEliza* gatherers must be run through createArcProofAction " +
41
+ "(which injects runtime), or you must set context." + ELIZA_RUNTIME_CONTEXT_KEY + " yourself.");
42
+ }
43
+ return rt;
44
+ }
45
+ const CLAIMS_SCHEMA = {
46
+ type: "object",
47
+ properties: {
48
+ claims: {
49
+ type: "array",
50
+ items: {
51
+ type: "object",
52
+ properties: {
53
+ claim_type: { type: "string" },
54
+ claim_text: { type: "string" },
55
+ // claim_value / simulated are strings on purpose (not JSON boolean/
56
+ // number) -- same defensive convention the LangChain adapter uses,
57
+ // so a provider that stringifies "false"/"182000000" round-trips
58
+ // cleanly. @arcproof/sdk's toBool/toNumber coerce them back.
59
+ claim_value: { type: "string" },
60
+ provider_source: { type: "string" },
61
+ simulated: { type: "string" },
62
+ },
63
+ required: ["claim_type", "claim_text", "claim_value", "provider_source"],
64
+ },
65
+ },
66
+ },
67
+ required: ["claims"],
68
+ };
69
+ /**
70
+ * Wraps a set of tools + a prompt as a `gatherClaims()` function that runs
71
+ * on ElizaOS's own model runtime. Resilient by design: if the model call
72
+ * fails, it logs and returns zero claims rather than throwing --
73
+ * runTrustedJob's hasCheckableClaims guard turns "this provider produced
74
+ * nothing" into a refund, not a false accept.
75
+ */
76
+ export function createElizaClaimGatherer(options) {
77
+ return async function gatherClaims(context) {
78
+ const jobId = context.jobId ?? randomUUID();
79
+ let drafts = [];
80
+ try {
81
+ const runtime = runtimeFrom(context);
82
+ // Run every tool, collect its text result.
83
+ const toolResults = await Promise.all(options.tools.map(async (t) => {
84
+ try {
85
+ return `${t.name}: ${await t.run(context)}`;
86
+ }
87
+ catch (e) {
88
+ return `${t.name}: ERROR: ${e}`;
89
+ }
90
+ }));
91
+ const userMsg = options.buildUserMessage
92
+ ? options.buildUserMessage(context)
93
+ : JSON.stringify(Object.fromEntries(Object.entries(context).filter(([k]) => k !== ELIZA_RUNTIME_CONTEXT_KEY)));
94
+ const claimTypeHint = options.claimTypes?.length
95
+ ? `\n\nUse only these claim_type values: ${options.claimTypes.join(", ")}.`
96
+ : "";
97
+ const prompt = `${options.systemPrompt}${claimTypeHint}\n\n` +
98
+ `Request:\n${userMsg}\n\n` +
99
+ `Data gathered from your tools (copy values verbatim; if a line starts with ERROR, omit that claim):\n` +
100
+ `${toolResults.join("\n")}\n\n` +
101
+ `Return a JSON object with a "claims" array. For claim_value and simulated, write the literal string ` +
102
+ `form (e.g. "182000000", "true", "false") copied verbatim -- never a paraphrase.`;
103
+ const result = (await runtime.useModel(OBJECT_LARGE, { prompt, schema: CLAIMS_SCHEMA, output: "object", temperature: 0 }));
104
+ drafts = Array.isArray(result?.claims) ? result.claims : [];
105
+ }
106
+ catch (e) {
107
+ console.log(`[${options.agentId}] ! ElizaOS model call failed (${e}) -- no claims produced this call`);
108
+ drafts = [];
109
+ }
110
+ return drafts.map((d) => {
111
+ const simulated = String(d.simulated ?? "false").toLowerCase() === "true";
112
+ // Defensive: `response_format: json_object` guarantees valid JSON but
113
+ // NOT schema adherence, so some models omit claim_text even though the
114
+ // schema marks it required (observed with gpt-oss-20b). Synthesize a
115
+ // readable one from the fields that are present rather than surfacing
116
+ // "undefined" in the memo. claim_value is what verification actually
117
+ // uses, so a missing claim_text is cosmetic, not a correctness issue.
118
+ const claimText = d.claim_text || `${d.claim_type} = ${d.claim_value}`;
119
+ console.log(`[${options.agentId}] ${d.claim_type} claim: ${claimText} (simulated=${simulated})`);
120
+ return {
121
+ claim_id: randomUUID(),
122
+ job_id: jobId,
123
+ provider_agent_id: options.agentId,
124
+ claim_type: d.claim_type,
125
+ claim_text: claimText,
126
+ claim_value: d.claim_value,
127
+ provider_source: d.provider_source,
128
+ simulated,
129
+ verification_status: "pending",
130
+ };
131
+ });
132
+ };
133
+ }
134
+ const PLAN_SCHEMA = {
135
+ type: "object",
136
+ properties: {
137
+ specialist_ids: { type: "array", items: { type: "string" } },
138
+ reasoning: { type: "string" },
139
+ },
140
+ required: ["specialist_ids", "reasoning"],
141
+ };
142
+ /**
143
+ * Builds a `gatherClaims()` that first asks ElizaOS's model which
144
+ * registered specialists this specific request needs, then runs only
145
+ * those and merges their claims -- the ElizaOS-native equivalent of
146
+ * @arcproof/sdk-langchain's createLangChainOrchestrator, with no LangChain
147
+ * dependency. A genuine planning failure propagates (runTrustedJob refunds);
148
+ * a successful-but-empty plan defaults to engaging every specialist.
149
+ */
150
+ export function createElizaOrchestrator(options) {
151
+ const specialistIds = options.specialists.map((s) => s.id);
152
+ if (specialistIds.length === 0)
153
+ throw new Error("createElizaOrchestrator: at least one specialist is required");
154
+ return async function gatherClaims(context) {
155
+ const runtime = runtimeFrom(context);
156
+ const systemPrompt = (options.systemPromptPrefix ?? "You are the orchestrator for a bonded, independently-verified agent network. ") +
157
+ "Given a request, decide which specialist agents to engage. Each specialist costs the requester's budget, " +
158
+ "so only pick ones actually relevant to the request:\n\n" +
159
+ options.specialists.map((s) => `- ${s.id}: ${s.description}`).join("\n") +
160
+ `\n\nReturn a JSON object: specialist_ids (array, a subset of the ids above) and reasoning (one sentence).`;
161
+ const userMsg = options.buildPlanningMessage
162
+ ? options.buildPlanningMessage(context)
163
+ : (context.requestText ?? JSON.stringify(context));
164
+ // No try/catch: a genuine planning failure should reach runTrustedJob's refund path.
165
+ const plan = (await runtime.useModel(OBJECT_LARGE, {
166
+ prompt: `${systemPrompt}\n\nRequest:\n${userMsg}`,
167
+ schema: PLAN_SCHEMA,
168
+ output: "object",
169
+ temperature: 0,
170
+ }));
171
+ let selectedIds = (plan.specialist_ids ?? []).filter((id) => specialistIds.includes(id));
172
+ if (!selectedIds.length)
173
+ selectedIds = specialistIds;
174
+ console.log(`[orchestrator] plan: [${selectedIds.join(", ")}] -- ${plan.reasoning ?? ""}`);
175
+ const chosen = options.specialists.filter((s) => selectedIds.includes(s.id));
176
+ const results = await Promise.all(chosen.map((s) => s.gatherClaims(context).catch((e) => {
177
+ console.log(`[orchestrator] ! ${s.id} threw (${e}) -- treating as zero claims from it`);
178
+ return [];
179
+ })));
180
+ return results.flat();
181
+ };
182
+ }
183
+ //# sourceMappingURL=elizaAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elizaAgent.js","sourceRoot":"","sources":["../src/elizaAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAazC,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,yBAAyB;AAE9D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAE1D,SAAS,WAAW,CAAC,OAAgC;IACnD,MAAM,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAkC,CAAC;IAC/E,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,mGAAmG;YACjG,mDAAmD,GAAG,yBAAyB,GAAG,YAAY,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAgCD,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;o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,CAAC,CAAC;QAC7E,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACf,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YAClC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,EAAE,WAAW,CAAC,sCAAsC,CAAC,CAAC;YAC1F,OAAO,EAAa,CAAC;QACvB,CAAC,CAAC,CACH,CACF,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type TrustedAgentConfig, type SettlementResult, type Claim, type WalletCredential } from "@arcproof/sdk";
2
+ export * from "./elizaAgent.js";
2
3
  export interface ElizaContent {
3
4
  text?: string;
4
5
  [key: string]: unknown;
package/dist/index.js CHANGED
@@ -28,6 +28,8 @@
28
28
  */
29
29
  import { randomUUID } from "node:crypto";
30
30
  import { runTrustedJob } from "@arcproof/sdk";
31
+ import { ELIZA_RUNTIME_CONTEXT_KEY } from "./elizaAgent.js";
32
+ export * from "./elizaAgent.js";
31
33
  function defaultFormatResponse(result) {
32
34
  const lines = [`Verdict: ${result.overall_verdict.toUpperCase()} (paid ${result.total_paid_usdc.toFixed(4)})`, ""];
33
35
  for (const c of result.claims) {
@@ -49,9 +51,13 @@ export function createArcProofAction(options) {
49
51
  similes: options.similes ?? [],
50
52
  examples: options.examples ?? [],
51
53
  validate: options.validate ?? (async () => true),
52
- handler: async (_runtime, message, state, _handlerOptions, callback) => {
54
+ handler: async (runtime, message, state, _handlerOptions, callback) => {
53
55
  const jobId = randomUUID();
54
- const context = { jobId, ...options.buildContext(message, state) };
56
+ // Inject the ElizaOS runtime into the job context so native
57
+ // createEliza* gatherers can reach runtime.useModel without changing
58
+ // the framework-agnostic gatherClaims(context) signature. A LangChain
59
+ // gatherer simply ignores this key; an ElizaOS-native one reads it.
60
+ const context = { jobId, [ELIZA_RUNTIME_CONTEXT_KEY]: runtime, ...options.buildContext(message, state) };
55
61
  try {
56
62
  const params = {
57
63
  jobId,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAwG,MAAM,eAAe,CAAC;AAyEpJ,SAAS,qBAAqB,CAAC,MAAwB;IACrD,MAAM,KAAK,GAAG,CAAC,YAAY,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnH,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,OAAO,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzI,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA8B;IACjE,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;QAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,I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E,CAAC;gBACX,MAAM,IAAI,GAAG,4CAA4C,CAAC,EAAE,CAAC;gBAC7D,IAAI,QAAQ;oBAAE,MAAM,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7E,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,oBAAoB,CAAC,OAAsE;IACzG,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcproof/sdk-elizaos",
3
- "version": "0.1.0",
4
- "description": "ElizaOS plugin for @arcproof/sdk -- expose a bonded, independently-verified, real-payment action inside an ElizaOS agent.",
3
+ "version": "0.2.0",
4
+ "description": "ElizaOS plugin for @arcproof/sdk -- native orchestrator + specialist builders (runtime.useModel, no LangChain needed) plus the Action/Plugin wrapper, for a bonded, independently-verified, real-payment agent.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",