kompass-sdk 0.1.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/dist/a2a/agent-card.d.ts +13 -0
- package/dist/a2a/agent-card.d.ts.map +1 -0
- package/dist/a2a/agent-card.js +52 -0
- package/dist/a2a/agent-card.js.map +1 -0
- package/dist/a2a/bridge.d.ts +52 -0
- package/dist/a2a/bridge.d.ts.map +1 -0
- package/dist/a2a/bridge.js +123 -0
- package/dist/a2a/bridge.js.map +1 -0
- package/dist/a2a/client.d.ts +34 -0
- package/dist/a2a/client.d.ts.map +1 -0
- package/dist/a2a/client.js +65 -0
- package/dist/a2a/client.js.map +1 -0
- package/dist/a2a/server.d.ts +17 -0
- package/dist/a2a/server.d.ts.map +1 -0
- package/dist/a2a/server.js +194 -0
- package/dist/a2a/server.js.map +1 -0
- package/dist/abi.d.ts +1068 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +1372 -0
- package/dist/abi.js.map +1 -0
- package/dist/adapters/agentkit.d.ts +41 -0
- package/dist/adapters/agentkit.d.ts.map +1 -0
- package/dist/adapters/agentkit.js +67 -0
- package/dist/adapters/agentkit.js.map +1 -0
- package/dist/adapters/generic.d.ts +35 -0
- package/dist/adapters/generic.d.ts.map +1 -0
- package/dist/adapters/generic.js +47 -0
- package/dist/adapters/generic.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +5 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/langchain.d.ts +26 -0
- package/dist/adapters/langchain.d.ts.map +1 -0
- package/dist/adapters/langchain.js +228 -0
- package/dist/adapters/langchain.js.map +1 -0
- package/dist/adapters/openclaw.d.ts +18 -0
- package/dist/adapters/openclaw.d.ts.map +1 -0
- package/dist/adapters/openclaw.js +168 -0
- package/dist/adapters/openclaw.js.map +1 -0
- package/dist/aggregator.d.ts +36 -0
- package/dist/aggregator.d.ts.map +1 -0
- package/dist/aggregator.js +168 -0
- package/dist/aggregator.js.map +1 -0
- package/dist/backends/acp.d.ts +29 -0
- package/dist/backends/acp.d.ts.map +1 -0
- package/dist/backends/acp.js +126 -0
- package/dist/backends/acp.js.map +1 -0
- package/dist/backends/types.d.ts +59 -0
- package/dist/backends/types.d.ts.map +1 -0
- package/dist/backends/types.js +2 -0
- package/dist/backends/types.js.map +1 -0
- package/dist/bridge.d.ts +35 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +192 -0
- package/dist/bridge.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +331 -0
- package/dist/cli.js.map +1 -0
- package/dist/discover.d.ts +15 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +163 -0
- package/dist/discover.js.map +1 -0
- package/dist/escrow.d.ts +45 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +243 -0
- package/dist/escrow.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/intents.d.ts +28 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +111 -0
- package/dist/intents.js.map +1 -0
- package/dist/matching.d.ts +29 -0
- package/dist/matching.d.ts.map +1 -0
- package/dist/matching.js +147 -0
- package/dist/matching.js.map +1 -0
- package/dist/pipelineAbi.d.ts +113 -0
- package/dist/pipelineAbi.d.ts.map +1 -0
- package/dist/pipelineAbi.js +74 -0
- package/dist/pipelineAbi.js.map +1 -0
- package/dist/pipelines.d.ts +42 -0
- package/dist/pipelines.d.ts.map +1 -0
- package/dist/pipelines.js +185 -0
- package/dist/pipelines.js.map +1 -0
- package/dist/registry.d.ts +36 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +187 -0
- package/dist/registry.js.map +1 -0
- package/dist/reputation.d.ts +10 -0
- package/dist/reputation.d.ts.map +1 -0
- package/dist/reputation.js +33 -0
- package/dist/reputation.js.map +1 -0
- package/dist/router.d.ts +72 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +190 -0
- package/dist/router.js.map +1 -0
- package/dist/simple.d.ts +160 -0
- package/dist/simple.d.ts.map +1 -0
- package/dist/simple.js +237 -0
- package/dist/simple.js.map +1 -0
- package/dist/sources/a2a-wellknown.d.ts +8 -0
- package/dist/sources/a2a-wellknown.d.ts.map +1 -0
- package/dist/sources/a2a-wellknown.js +104 -0
- package/dist/sources/a2a-wellknown.js.map +1 -0
- package/dist/sources/acp.d.ts +7 -0
- package/dist/sources/acp.d.ts.map +1 -0
- package/dist/sources/acp.js +86 -0
- package/dist/sources/acp.js.map +1 -0
- package/dist/sources/adp.d.ts +7 -0
- package/dist/sources/adp.d.ts.map +1 -0
- package/dist/sources/adp.js +59 -0
- package/dist/sources/adp.js.map +1 -0
- package/dist/sources/erc8004.d.ts +7 -0
- package/dist/sources/erc8004.d.ts.map +1 -0
- package/dist/sources/erc8004.js +150 -0
- package/dist/sources/erc8004.js.map +1 -0
- package/dist/sources/index.d.ts +17 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +35 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/kompass-registry.d.ts +8 -0
- package/dist/sources/kompass-registry.d.ts.map +1 -0
- package/dist/sources/kompass-registry.js +62 -0
- package/dist/sources/kompass-registry.js.map +1 -0
- package/dist/sources/l402-directory.d.ts +7 -0
- package/dist/sources/l402-directory.d.ts.map +1 -0
- package/dist/sources/l402-directory.js +42 -0
- package/dist/sources/l402-directory.js.map +1 -0
- package/dist/sources/mcp-registry.d.ts +8 -0
- package/dist/sources/mcp-registry.d.ts.map +1 -0
- package/dist/sources/mcp-registry.js +85 -0
- package/dist/sources/mcp-registry.js.map +1 -0
- package/dist/sources/skills.d.ts +8 -0
- package/dist/sources/skills.d.ts.map +1 -0
- package/dist/sources/skills.js +153 -0
- package/dist/sources/skills.js.map +1 -0
- package/dist/sources/types.d.ts +72 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +8 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/sources/x402-ecosystem.d.ts +7 -0
- package/dist/sources/x402-ecosystem.d.ts.map +1 -0
- package/dist/sources/x402-ecosystem.js +78 -0
- package/dist/sources/x402-ecosystem.js.map +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/unified.d.ts +90 -0
- package/dist/unified.d.ts.map +1 -0
- package/dist/unified.js +107 -0
- package/dist/unified.js.map +1 -0
- package/dist/x402.d.ts +30 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +79 -0
- package/dist/x402.js.map +1 -0
- package/package.json +61 -0
- package/scripts/bootstrap-agents.mjs +246 -0
- package/src/.gitkeep +0 -0
- package/src/a2a/agent-card.ts +66 -0
- package/src/a2a/bridge.ts +168 -0
- package/src/a2a/client.ts +92 -0
- package/src/a2a/server.ts +234 -0
- package/src/abi.ts +1373 -0
- package/src/adapters/agentkit.ts +83 -0
- package/src/adapters/generic.ts +62 -0
- package/src/adapters/index.ts +4 -0
- package/src/adapters/langchain.ts +282 -0
- package/src/adapters/openclaw.ts +203 -0
- package/src/aggregator.ts +203 -0
- package/src/backends/acp.ts +199 -0
- package/src/backends/types.ts +78 -0
- package/src/bridge.ts +263 -0
- package/src/cli.ts +397 -0
- package/src/discover.ts +187 -0
- package/src/escrow.ts +284 -0
- package/src/index.ts +245 -0
- package/src/intents.ts +166 -0
- package/src/matching.ts +192 -0
- package/src/pipelineAbi.ts +74 -0
- package/src/pipelines.ts +253 -0
- package/src/registry.ts +232 -0
- package/src/reputation.ts +43 -0
- package/src/router.ts +279 -0
- package/src/simple.ts +366 -0
- package/src/sources/a2a-wellknown.ts +120 -0
- package/src/sources/acp.ts +91 -0
- package/src/sources/adp.ts +64 -0
- package/src/sources/erc8004.ts +166 -0
- package/src/sources/index.ts +52 -0
- package/src/sources/kompass-registry.ts +67 -0
- package/src/sources/l402-directory.ts +51 -0
- package/src/sources/mcp-registry.ts +104 -0
- package/src/sources/skills.ts +161 -0
- package/src/sources/types.ts +82 -0
- package/src/sources/x402-ecosystem.ts +86 -0
- package/src/types.ts +147 -0
- package/src/unified.ts +155 -0
- package/src/x402.ts +122 -0
- package/tests/pipelineFlow.test.ts +239 -0
- package/tsconfig.json +20 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { formatUnits, formatEther } from "viem";
|
|
2
|
+
import { discover, getAgent, findEvaluator } from "./discover.js";
|
|
3
|
+
import { createJob, setBudget, fund, submit, complete, completePartial, reject, getJob, getMilestones } from "./escrow.js";
|
|
4
|
+
import { register, updateProfile, deregister } from "./registry.js";
|
|
5
|
+
import { getReputation } from "./reputation.js";
|
|
6
|
+
import { routeYieldIntent } from "./intents.js";
|
|
7
|
+
import { requestWithX402 } from "./x402.js";
|
|
8
|
+
import { buildYieldPipelinePlan, createYieldPipeline } from "./pipelines.js";
|
|
9
|
+
export class Kompass {
|
|
10
|
+
config;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
}
|
|
14
|
+
// ── Discovery ──────────────────────────────────────
|
|
15
|
+
async discover(options) {
|
|
16
|
+
return discover(this.config, options);
|
|
17
|
+
}
|
|
18
|
+
async getAgent(address) {
|
|
19
|
+
return getAgent(this.config, address);
|
|
20
|
+
}
|
|
21
|
+
async findEvaluator(domain) {
|
|
22
|
+
return findEvaluator(this.config, domain);
|
|
23
|
+
}
|
|
24
|
+
async routeYieldIntent(intent, options) {
|
|
25
|
+
const agents = await discover(this.config, {
|
|
26
|
+
verifiedOnly: true,
|
|
27
|
+
...options,
|
|
28
|
+
});
|
|
29
|
+
return routeYieldIntent(agents, intent);
|
|
30
|
+
}
|
|
31
|
+
async requestWithX402(url, init, options) {
|
|
32
|
+
return requestWithX402(url, init, options);
|
|
33
|
+
}
|
|
34
|
+
buildYieldPipelinePlan(route) {
|
|
35
|
+
const token = this.config.paymentTokenAddress;
|
|
36
|
+
if (!token) {
|
|
37
|
+
throw new Error("paymentTokenAddress is required in KompassConfig");
|
|
38
|
+
}
|
|
39
|
+
return buildYieldPipelinePlan(route, { token });
|
|
40
|
+
}
|
|
41
|
+
async createYieldPipeline(route) {
|
|
42
|
+
return createYieldPipeline(this.config, route);
|
|
43
|
+
}
|
|
44
|
+
// ── Escrow ─────────────────────────────────────────
|
|
45
|
+
async createJob(options) {
|
|
46
|
+
return createJob(this.config, options);
|
|
47
|
+
}
|
|
48
|
+
async setBudget(jobId, amount) {
|
|
49
|
+
return setBudget(this.config, jobId, amount);
|
|
50
|
+
}
|
|
51
|
+
async fund(jobId) {
|
|
52
|
+
return fund(this.config, jobId);
|
|
53
|
+
}
|
|
54
|
+
async submit(jobId, deliverable, milestoneIndex) {
|
|
55
|
+
return submit(this.config, jobId, deliverable, milestoneIndex);
|
|
56
|
+
}
|
|
57
|
+
async complete(jobId, reason, milestoneIndex) {
|
|
58
|
+
return complete(this.config, jobId, reason, milestoneIndex);
|
|
59
|
+
}
|
|
60
|
+
async completePartial(jobId, percentageBps, reason) {
|
|
61
|
+
return completePartial(this.config, jobId, percentageBps, reason);
|
|
62
|
+
}
|
|
63
|
+
async reject(jobId, reason) {
|
|
64
|
+
return reject(this.config, jobId, reason);
|
|
65
|
+
}
|
|
66
|
+
async getJob(jobId) {
|
|
67
|
+
return getJob(this.config, jobId);
|
|
68
|
+
}
|
|
69
|
+
async getMilestones(jobId) {
|
|
70
|
+
return getMilestones(this.config, jobId);
|
|
71
|
+
}
|
|
72
|
+
// ── Registry ───────────────────────────────────────
|
|
73
|
+
async register(profile) {
|
|
74
|
+
return register(this.config, profile);
|
|
75
|
+
}
|
|
76
|
+
async updateProfile(ensNode, updates) {
|
|
77
|
+
return updateProfile(this.config, ensNode, updates);
|
|
78
|
+
}
|
|
79
|
+
async deregister() {
|
|
80
|
+
return deregister(this.config);
|
|
81
|
+
}
|
|
82
|
+
// ── Reputation ─────────────────────────────────────
|
|
83
|
+
async getReputation(agentId, tag1, tag2) {
|
|
84
|
+
return getReputation(this.config, agentId, tag1, tag2);
|
|
85
|
+
}
|
|
86
|
+
// ── Token Operations ─────────────────────────────────
|
|
87
|
+
async approveToken(spender, amount) {
|
|
88
|
+
if (!this.config.walletClient)
|
|
89
|
+
throw new Error("WalletClient required for approveToken");
|
|
90
|
+
const tokenAddress = this.config.paymentTokenAddress;
|
|
91
|
+
if (!tokenAddress)
|
|
92
|
+
throw new Error("paymentTokenAddress required in KompassConfig");
|
|
93
|
+
const txHash = await this.config.walletClient.writeContract({
|
|
94
|
+
address: tokenAddress,
|
|
95
|
+
abi: [{ type: "function", name: "approve", inputs: [{ name: "spender", type: "address" }, { name: "value", type: "uint256" }], outputs: [{ name: "", type: "bool" }], stateMutability: "nonpayable" }],
|
|
96
|
+
functionName: "approve",
|
|
97
|
+
args: [spender, amount],
|
|
98
|
+
});
|
|
99
|
+
await this.config.publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
100
|
+
return { txHash };
|
|
101
|
+
}
|
|
102
|
+
async getBalance() {
|
|
103
|
+
const address = this.config.walletClient?.account?.address;
|
|
104
|
+
if (!address)
|
|
105
|
+
throw new Error("WalletClient required for getBalance");
|
|
106
|
+
const ethBalance = await this.config.publicClient.getBalance({ address });
|
|
107
|
+
let usdcBalance = 0n;
|
|
108
|
+
if (this.config.paymentTokenAddress) {
|
|
109
|
+
usdcBalance = await this.config.publicClient.readContract({
|
|
110
|
+
address: this.config.paymentTokenAddress,
|
|
111
|
+
abi: [{ type: "function", name: "balanceOf", inputs: [{ name: "account", type: "address" }], outputs: [{ name: "", type: "uint256" }], stateMutability: "view" }],
|
|
112
|
+
functionName: "balanceOf",
|
|
113
|
+
args: [address],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
address,
|
|
118
|
+
eth: formatEther(ethBalance),
|
|
119
|
+
usdc: formatUnits(usdcBalance, 6),
|
|
120
|
+
usdcRaw: usdcBalance.toString(),
|
|
121
|
+
ethRaw: ethBalance.toString(),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export { discover, getAgent, findEvaluator } from "./discover.js";
|
|
126
|
+
export { createJob, setBudget, fund, submit, complete, completePartial, reject, getJob, getMilestones } from "./escrow.js";
|
|
127
|
+
export { register, updateProfile, deregister, computeENSIP25Key, setENSIP25Record } from "./registry.js";
|
|
128
|
+
export { getReputation } from "./reputation.js";
|
|
129
|
+
export { routeYieldIntent } from "./intents.js";
|
|
130
|
+
export { parseX402Requirement, requestWithX402 } from "./x402.js";
|
|
131
|
+
export { buildYieldPipelinePlan, createYieldPipeline } from "./pipelines.js";
|
|
132
|
+
// Framework adapters
|
|
133
|
+
export * as adapters from "./adapters/index.js";
|
|
134
|
+
// Simplified API (Kompass intelligence layer on top of ACP)
|
|
135
|
+
export { KompassSimple } from "./simple.js";
|
|
136
|
+
// Backend adapters
|
|
137
|
+
export { AcpEscrowBackend } from "./backends/acp.js";
|
|
138
|
+
// Universal Discovery (Kompass v2 — cross-protocol)
|
|
139
|
+
export { KompassUnified } from "./unified.js";
|
|
140
|
+
export { Aggregator } from "./aggregator.js";
|
|
141
|
+
export { rankAgents } from "./matching.js";
|
|
142
|
+
export { ProtocolBridge } from "./bridge.js";
|
|
143
|
+
export { CapabilityRouter } from "./router.js";
|
|
144
|
+
export { createAllSources } from "./sources/index.js";
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAA0B,MAAM,MAAM,CAAC;AAqBxE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,S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AAEhD,4DAA4D;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,oDAAoD;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentProfile, PaymentMode } from "./types.js";
|
|
2
|
+
export type YieldRiskTolerance = "conservative" | "balanced" | "aggressive";
|
|
3
|
+
export type YieldObjective = "best-yield" | "best-risk-adjusted";
|
|
4
|
+
export type AgentCapabilityRole = "research" | "premium-data" | "risk" | "execution";
|
|
5
|
+
export interface YieldIntent {
|
|
6
|
+
amount: bigint;
|
|
7
|
+
riskTolerance: YieldRiskTolerance;
|
|
8
|
+
objective?: YieldObjective;
|
|
9
|
+
stablecoin?: string;
|
|
10
|
+
chain?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RouteStep {
|
|
13
|
+
role: AgentCapabilityRole;
|
|
14
|
+
title: string;
|
|
15
|
+
summary: string;
|
|
16
|
+
requiredPaymentMode: PaymentMode | "any";
|
|
17
|
+
categories: string[];
|
|
18
|
+
agent: AgentProfile | null;
|
|
19
|
+
}
|
|
20
|
+
export interface IntentRoute {
|
|
21
|
+
intent: YieldIntent;
|
|
22
|
+
steps: RouteStep[];
|
|
23
|
+
recommendedAgents: AgentProfile[];
|
|
24
|
+
missingCapabilities: AgentCapabilityRole[];
|
|
25
|
+
summary: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function routeYieldIntent(agents: AgentProfile[], intent: YieldIntent): IntentRoute;
|
|
28
|
+
//# sourceMappingURL=intents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../src/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,oBAAoB,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,cAAc,GAAG,MAAM,GAAG,WAAW,CAAC;AAErF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,kBAAkB,CAAC;IAClC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,WAAW,GAAG,KAAK,CAAC;IACzC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,iBAAiB,EAAE,YAAY,EAAE,CAAC;IAClC,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAwGD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,WAAW,CAgCzF"}
|
package/dist/intents.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const ROLE_CONFIG = {
|
|
2
|
+
research: {
|
|
3
|
+
title: "Research",
|
|
4
|
+
summary: "Find candidate Base strategies and estimate raw yield.",
|
|
5
|
+
categories: ["defi", "analytics", "research", "yield"],
|
|
6
|
+
requiredPaymentMode: "any",
|
|
7
|
+
preferredType: "provider",
|
|
8
|
+
},
|
|
9
|
+
"premium-data": {
|
|
10
|
+
title: "Premium Data",
|
|
11
|
+
summary: "Buy market, protocol, or yield data over x402.",
|
|
12
|
+
categories: ["data", "analytics", "signals"],
|
|
13
|
+
requiredPaymentMode: "x402",
|
|
14
|
+
preferredType: "provider",
|
|
15
|
+
},
|
|
16
|
+
risk: {
|
|
17
|
+
title: "Risk Review",
|
|
18
|
+
summary: "Evaluate strategy safety, policy fit, and execution readiness.",
|
|
19
|
+
categories: ["risk", "security", "defi"],
|
|
20
|
+
requiredPaymentMode: "any",
|
|
21
|
+
preferredType: "evaluator",
|
|
22
|
+
},
|
|
23
|
+
execution: {
|
|
24
|
+
title: "Execution",
|
|
25
|
+
summary: "Prepare or submit the final Base execution plan.",
|
|
26
|
+
categories: ["yield", "swap", "bridge", "defi"],
|
|
27
|
+
requiredPaymentMode: "escrow",
|
|
28
|
+
preferredType: "provider",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
function parseCategories(value) {
|
|
32
|
+
return value
|
|
33
|
+
.split(",")
|
|
34
|
+
.map((item) => item.trim().toLowerCase())
|
|
35
|
+
.filter(Boolean);
|
|
36
|
+
}
|
|
37
|
+
function scoreAgent(agent, role) {
|
|
38
|
+
const config = ROLE_CONFIG[role];
|
|
39
|
+
const categories = parseCategories(agent.categories);
|
|
40
|
+
let score = 0;
|
|
41
|
+
for (const category of config.categories) {
|
|
42
|
+
if (categories.includes(category)) {
|
|
43
|
+
score += 3;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (config.preferredType && (agent.agentType === config.preferredType || agent.agentType === "both")) {
|
|
47
|
+
score += 3;
|
|
48
|
+
}
|
|
49
|
+
if (agent.identityVerified) {
|
|
50
|
+
score += 2;
|
|
51
|
+
}
|
|
52
|
+
if (config.requiredPaymentMode === "x402" && agent.x402Enabled) {
|
|
53
|
+
score += 4;
|
|
54
|
+
}
|
|
55
|
+
if (config.requiredPaymentMode === "escrow" && (agent.paymentMode === "escrow" || agent.paymentMode === "hybrid")) {
|
|
56
|
+
score += 2;
|
|
57
|
+
}
|
|
58
|
+
if (agent.paymentMode === "hybrid") {
|
|
59
|
+
score += 1;
|
|
60
|
+
}
|
|
61
|
+
return score;
|
|
62
|
+
}
|
|
63
|
+
function supportsPaymentMode(agent, required) {
|
|
64
|
+
if (required === "any")
|
|
65
|
+
return true;
|
|
66
|
+
if (required === "x402") {
|
|
67
|
+
return agent.x402Enabled || agent.paymentMode === "x402" || agent.paymentMode === "hybrid";
|
|
68
|
+
}
|
|
69
|
+
if (required === "escrow") {
|
|
70
|
+
return agent.paymentMode === "escrow" || agent.paymentMode === "hybrid";
|
|
71
|
+
}
|
|
72
|
+
return agent.paymentMode === required;
|
|
73
|
+
}
|
|
74
|
+
function selectBestAgent(agents, role) {
|
|
75
|
+
const candidates = agents
|
|
76
|
+
.filter((agent) => supportsPaymentMode(agent, ROLE_CONFIG[role].requiredPaymentMode))
|
|
77
|
+
.map((agent) => ({ agent, score: scoreAgent(agent, role) }))
|
|
78
|
+
.filter((entry) => entry.score > 0)
|
|
79
|
+
.sort((a, b) => b.score - a.score);
|
|
80
|
+
return candidates[0]?.agent ?? null;
|
|
81
|
+
}
|
|
82
|
+
export function routeYieldIntent(agents, intent) {
|
|
83
|
+
const orderedRoles = ["research", "premium-data", "risk", "execution"];
|
|
84
|
+
const steps = orderedRoles.map((role) => {
|
|
85
|
+
const config = ROLE_CONFIG[role];
|
|
86
|
+
return {
|
|
87
|
+
role,
|
|
88
|
+
title: config.title,
|
|
89
|
+
summary: config.summary,
|
|
90
|
+
requiredPaymentMode: config.requiredPaymentMode,
|
|
91
|
+
categories: config.categories,
|
|
92
|
+
agent: selectBestAgent(agents, role),
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const missingCapabilities = steps
|
|
96
|
+
.filter((step) => !step.agent)
|
|
97
|
+
.map((step) => step.role);
|
|
98
|
+
const recommendedAgents = steps
|
|
99
|
+
.map((step) => step.agent)
|
|
100
|
+
.filter((agent) => agent !== null);
|
|
101
|
+
const stablecoin = intent.stablecoin ?? "USDC";
|
|
102
|
+
const objective = intent.objective ?? "best-risk-adjusted";
|
|
103
|
+
return {
|
|
104
|
+
intent,
|
|
105
|
+
steps,
|
|
106
|
+
recommendedAgents,
|
|
107
|
+
missingCapabilities,
|
|
108
|
+
summary: `Route ${stablecoin} capital on ${intent.chain ?? "Base"} for ${objective} yield using ${recommendedAgents.length} discovered agents.`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.js","sourceRoot":"","sources":["../src/intents.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,GASb;IACF,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,wDAAwD;QACjE,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;QACtD,mBAAmB,EAAE,KAAK;QAC1B,aAAa,EAAE,UAAU;KAC1B;IACD,cAAc,EAAE;QACd,KAAK,EAAE,cAAc;QACrB,OAAO,EAAE,gDAAgD;QACzD,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC;QAC5C,mBAAmB,EAAE,MAAM;QAC3B,aAAa,EAAE,UAAU;KAC1B;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,gEAAgE;QACzE,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC;QACxC,mBAAmB,EAAE,KAAK;QAC1B,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AiB;QACjB,mBAAmB;QACnB,OAAO,EAAE,SAAS,UAAU,eAAe,MAAM,CAAC,KAAK,IAAI,MAAM,QAAQ,SAAS,gBAAgB,iBAAiB,CAAC,MAAM,qBAAqB;KAChJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kompass Multi-Layer Agent Matching
|
|
3
|
+
*
|
|
4
|
+
* Layer A: Structured capability matching (ontology-style)
|
|
5
|
+
* Layer B: BM25 text relevance scoring
|
|
6
|
+
* Layer C: LLM re-ranking (optional, for top candidates)
|
|
7
|
+
* Layer D: Multi-criteria scoring (reputation, price, protocol, recency)
|
|
8
|
+
*/
|
|
9
|
+
import type { UnifiedAgent } from "./sources/types.js";
|
|
10
|
+
interface ParsedIntent {
|
|
11
|
+
domain: string | null;
|
|
12
|
+
actions: string[];
|
|
13
|
+
protocols: string[];
|
|
14
|
+
chains: string[];
|
|
15
|
+
priceMax: number | null;
|
|
16
|
+
}
|
|
17
|
+
declare function parseIntent(query: string): ParsedIntent;
|
|
18
|
+
export interface MatchResult {
|
|
19
|
+
agent: UnifiedAgent;
|
|
20
|
+
scores: {
|
|
21
|
+
structured: number;
|
|
22
|
+
bm25: number;
|
|
23
|
+
multiCriteria: number;
|
|
24
|
+
total: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function rankAgents(agents: UnifiedAgent[], query: string): MatchResult[];
|
|
28
|
+
export { parseIntent, type ParsedIntent };
|
|
29
|
+
//# sourceMappingURL=matching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matching.d.ts","sourceRoot":"","sources":["../src/matching.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AA8BD,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CA0BhD;AAuFD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAiB/E;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/matching.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kompass Multi-Layer Agent Matching
|
|
3
|
+
*
|
|
4
|
+
* Layer A: Structured capability matching (ontology-style)
|
|
5
|
+
* Layer B: BM25 text relevance scoring
|
|
6
|
+
* Layer C: LLM re-ranking (optional, for top candidates)
|
|
7
|
+
* Layer D: Multi-criteria scoring (reputation, price, protocol, recency)
|
|
8
|
+
*/
|
|
9
|
+
const DOMAIN_KEYWORDS = {
|
|
10
|
+
defi: ["defi", "yield", "swap", "liquidity", "pool", "lending", "borrow", "stake", "vault", "farm"],
|
|
11
|
+
data: ["data", "analytics", "research", "market", "price", "chart", "feed", "api"],
|
|
12
|
+
trading: ["trade", "trading", "buy", "sell", "order", "exchange", "dex", "cex"],
|
|
13
|
+
risk: ["risk", "audit", "security", "vulnerability", "safe", "score"],
|
|
14
|
+
content: ["content", "write", "generate", "image", "video", "text", "create"],
|
|
15
|
+
development: ["code", "develop", "build", "deploy", "smart contract", "solidity"],
|
|
16
|
+
ai: ["ai", "llm", "model", "inference", "embedding", "prompt"],
|
|
17
|
+
social: ["social", "twitter", "post", "tweet", "farcaster"],
|
|
18
|
+
};
|
|
19
|
+
const PROTOCOL_KEYWORDS = {
|
|
20
|
+
x402: ["x402", "micropayment", "http 402", "pay per call"],
|
|
21
|
+
acp: ["acp", "virtuals", "escrow", "marketplace"],
|
|
22
|
+
mcp: ["mcp", "tool", "server", "model context"],
|
|
23
|
+
a2a: ["a2a", "agent to agent", "google"],
|
|
24
|
+
l402: ["l402", "lightning", "bitcoin", "sats"],
|
|
25
|
+
};
|
|
26
|
+
const CHAIN_KEYWORDS = {
|
|
27
|
+
base: ["base", "coinbase"],
|
|
28
|
+
ethereum: ["ethereum", "eth", "mainnet"],
|
|
29
|
+
solana: ["solana", "sol"],
|
|
30
|
+
bnb: ["bnb", "bsc", "binance"],
|
|
31
|
+
arbitrum: ["arbitrum", "arb"],
|
|
32
|
+
polygon: ["polygon", "matic"],
|
|
33
|
+
};
|
|
34
|
+
function parseIntent(query) {
|
|
35
|
+
const lower = query.toLowerCase();
|
|
36
|
+
let domain = null;
|
|
37
|
+
for (const [d, keywords] of Object.entries(DOMAIN_KEYWORDS)) {
|
|
38
|
+
if (keywords.some((k) => lower.includes(k))) {
|
|
39
|
+
domain = d;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const actions = Object.entries(DOMAIN_KEYWORDS)
|
|
44
|
+
.flatMap(([, keywords]) => keywords.filter((k) => lower.includes(k)));
|
|
45
|
+
const protocols = Object.entries(PROTOCOL_KEYWORDS)
|
|
46
|
+
.filter(([, keywords]) => keywords.some((k) => lower.includes(k)))
|
|
47
|
+
.map(([p]) => p);
|
|
48
|
+
const chains = Object.entries(CHAIN_KEYWORDS)
|
|
49
|
+
.filter(([, keywords]) => keywords.some((k) => lower.includes(k)))
|
|
50
|
+
.map(([c]) => c);
|
|
51
|
+
const priceMatch = lower.match(/under\s*\$?(\d+(?:\.\d+)?)/);
|
|
52
|
+
const priceMax = priceMatch ? parseFloat(priceMatch[1]) : null;
|
|
53
|
+
return { domain, actions, protocols, chains, priceMax };
|
|
54
|
+
}
|
|
55
|
+
function structuredScore(agent, intent) {
|
|
56
|
+
let score = 0;
|
|
57
|
+
// Domain match
|
|
58
|
+
if (intent.domain && agent.categories.includes(intent.domain))
|
|
59
|
+
score += 15;
|
|
60
|
+
// Action keyword matches
|
|
61
|
+
const agentText = `${agent.name} ${agent.description} ${agent.categories.join(" ")}`.toLowerCase();
|
|
62
|
+
for (const action of intent.actions) {
|
|
63
|
+
if (agentText.includes(action))
|
|
64
|
+
score += 3;
|
|
65
|
+
}
|
|
66
|
+
// Protocol match
|
|
67
|
+
if (intent.protocols.length > 0) {
|
|
68
|
+
if (intent.protocols.includes(agent.protocol))
|
|
69
|
+
score += 20;
|
|
70
|
+
}
|
|
71
|
+
// Price filter
|
|
72
|
+
if (intent.priceMax && agent.pricing?.amount) {
|
|
73
|
+
const price = parseFloat(agent.pricing.amount);
|
|
74
|
+
if (price <= intent.priceMax)
|
|
75
|
+
score += 10;
|
|
76
|
+
else
|
|
77
|
+
score -= 10; // Penalize over budget
|
|
78
|
+
}
|
|
79
|
+
return score;
|
|
80
|
+
}
|
|
81
|
+
// ── Layer B: BM25-lite Text Relevance ────────────────────
|
|
82
|
+
function bm25Score(agent, queryTerms) {
|
|
83
|
+
const doc = `${agent.name} ${agent.description} ${agent.categories.join(" ")} ${agent.capabilities.join(" ")}`.toLowerCase();
|
|
84
|
+
const docTerms = doc.split(/\s+/);
|
|
85
|
+
const docLen = docTerms.length;
|
|
86
|
+
const avgDocLen = 50; // Approximate average
|
|
87
|
+
const k1 = 1.5;
|
|
88
|
+
const b = 0.75;
|
|
89
|
+
let score = 0;
|
|
90
|
+
for (const term of queryTerms) {
|
|
91
|
+
const tf = docTerms.filter((t) => t.includes(term)).length;
|
|
92
|
+
if (tf === 0)
|
|
93
|
+
continue;
|
|
94
|
+
// Simplified BM25
|
|
95
|
+
const numerator = tf * (k1 + 1);
|
|
96
|
+
const denominator = tf + k1 * (1 - b + b * (docLen / avgDocLen));
|
|
97
|
+
score += numerator / denominator;
|
|
98
|
+
}
|
|
99
|
+
return score * 10; // Scale up
|
|
100
|
+
}
|
|
101
|
+
// ── Layer D: Multi-Criteria Scoring ──────────────────────
|
|
102
|
+
function multiCriteriaScore(agent) {
|
|
103
|
+
let score = 0;
|
|
104
|
+
// Reputation
|
|
105
|
+
if (agent.reputation) {
|
|
106
|
+
score += Math.min(agent.reputation.score * 0.2, 20);
|
|
107
|
+
score += Math.min(agent.reputation.count * 0.5, 10);
|
|
108
|
+
}
|
|
109
|
+
// Verified identity
|
|
110
|
+
if (agent.verified)
|
|
111
|
+
score += 5;
|
|
112
|
+
// Pricing transparency
|
|
113
|
+
if (agent.pricing && agent.pricing.model !== "unknown")
|
|
114
|
+
score += 3;
|
|
115
|
+
// Endpoint richness (more protocols = more interoperable)
|
|
116
|
+
const endpointCount = Object.values(agent.endpoints).filter(Boolean).length;
|
|
117
|
+
score += endpointCount * 2;
|
|
118
|
+
// Recency
|
|
119
|
+
if (agent.lastSeen) {
|
|
120
|
+
const hoursSince = (Date.now() - agent.lastSeen) / (1000 * 60 * 60);
|
|
121
|
+
if (hoursSince < 1)
|
|
122
|
+
score += 5;
|
|
123
|
+
else if (hoursSince < 24)
|
|
124
|
+
score += 3;
|
|
125
|
+
else if (hoursSince < 168)
|
|
126
|
+
score += 1;
|
|
127
|
+
}
|
|
128
|
+
return score;
|
|
129
|
+
}
|
|
130
|
+
export function rankAgents(agents, query) {
|
|
131
|
+
const intent = parseIntent(query);
|
|
132
|
+
const queryTerms = query.toLowerCase().split(/\s+/).filter((t) => t.length > 2);
|
|
133
|
+
return agents
|
|
134
|
+
.map((agent) => {
|
|
135
|
+
const structured = structuredScore(agent, intent);
|
|
136
|
+
const bm25 = bm25Score(agent, queryTerms);
|
|
137
|
+
const multi = multiCriteriaScore(agent);
|
|
138
|
+
const total = structured + bm25 + multi;
|
|
139
|
+
return {
|
|
140
|
+
agent,
|
|
141
|
+
scores: { structured, bm25, multiCriteria: multi, total },
|
|
142
|
+
};
|
|
143
|
+
})
|
|
144
|
+
.sort((a, b) => b.scores.total - a.scores.total);
|
|
145
|
+
}
|
|
146
|
+
export { parseIntent };
|
|
147
|
+
//# sourceMappingURL=matching.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matching.js","sourceRoot":"","sources":["../src/matching.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,MAAM,eAAe,GAA6B;IAChD,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;IACnG,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;IAClF,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC;IAC/E,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC;IACrE,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC7E,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,CAAC;IACjF,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC;IAC9D,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC;CAC5D,CAAC;AAEF,MAAM,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G,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC;QAExC,OAAO;YACL,KAAK;YACL,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE;SAC1D,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,OAAO,EAAE,WAAW,EAAqB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export declare const PipelineOrchestratorAbi: readonly [{
|
|
2
|
+
readonly type: "event";
|
|
3
|
+
readonly name: "PipelineCreated";
|
|
4
|
+
readonly anonymous: false;
|
|
5
|
+
readonly inputs: readonly [{
|
|
6
|
+
readonly indexed: true;
|
|
7
|
+
readonly name: "pipelineId";
|
|
8
|
+
readonly type: "uint256";
|
|
9
|
+
}, {
|
|
10
|
+
readonly indexed: true;
|
|
11
|
+
readonly name: "client";
|
|
12
|
+
readonly type: "address";
|
|
13
|
+
}, {
|
|
14
|
+
readonly indexed: false;
|
|
15
|
+
readonly name: "intentHash";
|
|
16
|
+
readonly type: "bytes32";
|
|
17
|
+
}];
|
|
18
|
+
}, {
|
|
19
|
+
readonly type: "function";
|
|
20
|
+
readonly name: "createPipeline";
|
|
21
|
+
readonly stateMutability: "nonpayable";
|
|
22
|
+
readonly inputs: readonly [{
|
|
23
|
+
readonly name: "token";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "intentHash";
|
|
27
|
+
readonly type: "bytes32";
|
|
28
|
+
}];
|
|
29
|
+
readonly outputs: readonly [{
|
|
30
|
+
readonly name: "pipelineId";
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}];
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
readonly name: "createPipelineWithHook";
|
|
36
|
+
readonly stateMutability: "nonpayable";
|
|
37
|
+
readonly inputs: readonly [{
|
|
38
|
+
readonly name: "token";
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "intentHash";
|
|
42
|
+
readonly type: "bytes32";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "defaultHook";
|
|
45
|
+
readonly type: "address";
|
|
46
|
+
}];
|
|
47
|
+
readonly outputs: readonly [{
|
|
48
|
+
readonly name: "pipelineId";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}];
|
|
51
|
+
}, {
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
readonly name: "addSubTask";
|
|
54
|
+
readonly stateMutability: "nonpayable";
|
|
55
|
+
readonly inputs: readonly [{
|
|
56
|
+
readonly name: "pipelineId";
|
|
57
|
+
readonly type: "uint256";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "provider";
|
|
60
|
+
readonly type: "address";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "evaluator";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "budget";
|
|
66
|
+
readonly type: "uint256";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "descriptionHash";
|
|
69
|
+
readonly type: "bytes32";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "dependencies";
|
|
72
|
+
readonly type: "uint256[]";
|
|
73
|
+
}];
|
|
74
|
+
readonly outputs: readonly [{
|
|
75
|
+
readonly name: "subTaskIndex";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}];
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "function";
|
|
80
|
+
readonly name: "fundPipeline";
|
|
81
|
+
readonly stateMutability: "nonpayable";
|
|
82
|
+
readonly inputs: readonly [{
|
|
83
|
+
readonly name: "pipelineId";
|
|
84
|
+
readonly type: "uint256";
|
|
85
|
+
}];
|
|
86
|
+
readonly outputs: readonly [];
|
|
87
|
+
}, {
|
|
88
|
+
readonly type: "function";
|
|
89
|
+
readonly name: "activateNextTasks";
|
|
90
|
+
readonly stateMutability: "nonpayable";
|
|
91
|
+
readonly inputs: readonly [{
|
|
92
|
+
readonly name: "pipelineId";
|
|
93
|
+
readonly type: "uint256";
|
|
94
|
+
}];
|
|
95
|
+
readonly outputs: readonly [];
|
|
96
|
+
}];
|
|
97
|
+
export declare const Erc20ApproveAbi: readonly [{
|
|
98
|
+
readonly type: "function";
|
|
99
|
+
readonly name: "approve";
|
|
100
|
+
readonly stateMutability: "nonpayable";
|
|
101
|
+
readonly inputs: readonly [{
|
|
102
|
+
readonly name: "spender";
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "value";
|
|
106
|
+
readonly type: "uint256";
|
|
107
|
+
}];
|
|
108
|
+
readonly outputs: readonly [{
|
|
109
|
+
readonly name: "";
|
|
110
|
+
readonly type: "bool";
|
|
111
|
+
}];
|
|
112
|
+
}];
|
|
113
|
+
//# sourceMappingURL=pipelineAbi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipelineAbi.d.ts","sourceRoot":"","sources":["../src/pipelineAbi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4D1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAWlB,CAAC"}
|