@blindmarket/sdk 0.1.6 → 0.1.8

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 (156) hide show
  1. package/README.md +242 -29
  2. package/dist/chain/BlindEscrowClient.d.ts +2 -0
  3. package/dist/chain/BlindEscrowClient.js +19 -7
  4. package/dist/chain/BlindReputationClient.d.ts +3 -0
  5. package/dist/chain/BlindReputationClient.js +3 -1
  6. package/dist/chain/ChainClient.d.ts +6 -3
  7. package/dist/chain/ChainClient.js +6 -1
  8. package/dist/chain/IBlindMarketChain.d.ts +74 -0
  9. package/dist/chain/IBlindMarketChain.js +1 -0
  10. package/dist/chain/TaskRegistryClient.d.ts +2 -1
  11. package/dist/chain/TaskRegistryClient.js +15 -7
  12. package/dist/chain/createChainAdapter.d.ts +25 -0
  13. package/dist/chain/createChainAdapter.js +24 -0
  14. package/dist/chain/domain-types.d.ts +77 -0
  15. package/dist/chain/domain-types.js +1 -0
  16. package/dist/chain/evm/EVMChainAdapter.d.ts +56 -0
  17. package/dist/chain/evm/EVMChainAdapter.js +161 -0
  18. package/dist/chain/evm/index.d.ts +1 -0
  19. package/dist/chain/evm/index.js +1 -0
  20. package/dist/chain/index.d.ts +4 -0
  21. package/dist/chain/index.js +5 -0
  22. package/dist/crypto/constants.js +1 -1
  23. package/dist/errors/{BlindBountyError.d.ts → BlindMarketError.d.ts} +1 -1
  24. package/dist/errors/{BlindBountyError.js → BlindMarketError.js} +1 -1
  25. package/dist/errors/index.d.ts +1 -1
  26. package/dist/errors/index.js +1 -1
  27. package/dist/errors/subclasses.d.ts +9 -9
  28. package/dist/errors/subclasses.js +9 -9
  29. package/dist/executor/WorkerRuntime.d.ts +113 -0
  30. package/dist/executor/WorkerRuntime.js +248 -0
  31. package/dist/executor/index.d.ts +1 -0
  32. package/dist/executor/index.js +1 -0
  33. package/dist/index.d.ts +292 -22
  34. package/dist/index.js +413 -23
  35. package/dist/keystore/InMemoryKeyStore.js +2 -2
  36. package/dist/network/presets.d.ts +33 -5
  37. package/dist/network/presets.js +35 -8
  38. package/dist/network/resolve.d.ts +12 -3
  39. package/dist/network/resolve.js +15 -7
  40. package/dist/network/types.d.ts +3 -16
  41. package/dist/signer/EthersSigner.js +1 -1
  42. package/dist/storage/index.d.ts +0 -1
  43. package/dist/storage/index.js +1 -1
  44. package/dist/tools/adapters.d.ts +99 -0
  45. package/dist/tools/adapters.js +129 -0
  46. package/dist/tools/helpers.d.ts +9 -0
  47. package/dist/tools/helpers.js +169 -0
  48. package/dist/tools/index.d.ts +36 -0
  49. package/dist/tools/index.js +32 -0
  50. package/dist/tools/types.d.ts +44 -0
  51. package/dist/tools/types.js +1 -0
  52. package/dist/types.d.ts +202 -1
  53. package/dist/types.js +24 -1
  54. package/package.json +13 -2
  55. package/src/chain/BlindEscrowClient.ts +20 -6
  56. package/src/chain/BlindReputationClient.ts +6 -1
  57. package/src/chain/ChainClient.ts +9 -3
  58. package/src/chain/IBlindMarketChain.ts +109 -0
  59. package/src/chain/TaskRegistryClient.ts +17 -8
  60. package/src/chain/createChainAdapter.ts +40 -0
  61. package/src/chain/domain-types.ts +92 -0
  62. package/src/chain/evm/EVMChainAdapter.ts +212 -0
  63. package/src/chain/evm/index.ts +1 -0
  64. package/src/chain/index.ts +6 -0
  65. package/src/executor/WorkerRuntime.ts +338 -0
  66. package/src/executor/index.ts +8 -0
  67. package/src/index.ts +546 -36
  68. package/src/network/presets.ts +47 -8
  69. package/src/network/resolve.ts +20 -8
  70. package/src/network/types.ts +18 -16
  71. package/src/signer/index.ts +1 -1
  72. package/src/storage/index.ts +1 -1
  73. package/src/tools/adapters.ts +177 -0
  74. package/src/tools/helpers.ts +199 -0
  75. package/src/tools/index.ts +59 -0
  76. package/src/tools/types.ts +47 -0
  77. package/src/types.ts +222 -1
  78. package/tsconfig.json +2 -1
  79. package/dist/BlindEscrowClient-CyPuKMge.d.cts +0 -54
  80. package/dist/BlindEscrowClient-R7iGpE-n.d.ts +0 -54
  81. package/dist/KeyStore-Be_SSpCt.d.cts +0 -21
  82. package/dist/KeyStore-k1JgYPJY.d.ts +0 -21
  83. package/dist/Signer-BnqH_qew.d.cts +0 -38
  84. package/dist/Signer-LColE0Uo.d.ts +0 -38
  85. package/dist/Storage-4QOrh7rm.d.ts +0 -17
  86. package/dist/Storage-Cf4IJRMk.d.cts +0 -17
  87. package/dist/TaskRegistryClient-Ch6lYqM_.d.ts +0 -24
  88. package/dist/TaskRegistryClient-CrQjddDc.d.cts +0 -24
  89. package/dist/aes-J-7HrHze.d.cts +0 -17
  90. package/dist/aes-J-7HrHze.d.ts +0 -17
  91. package/dist/agent/index.cjs +0 -425
  92. package/dist/agent/index.cjs.map +0 -1
  93. package/dist/agent/index.d.cts +0 -63
  94. package/dist/agent/index.js.map +0 -1
  95. package/dist/api/index.cjs +0 -4
  96. package/dist/api/index.cjs.map +0 -1
  97. package/dist/api/index.d.cts +0 -2
  98. package/dist/api/index.js.map +0 -1
  99. package/dist/chain/index.cjs +0 -2484
  100. package/dist/chain/index.cjs.map +0 -1
  101. package/dist/chain/index.d.cts +0 -2305
  102. package/dist/chain/index.js.map +0 -1
  103. package/dist/compute/index.cjs +0 -4
  104. package/dist/compute/index.cjs.map +0 -1
  105. package/dist/compute/index.d.cts +0 -2
  106. package/dist/compute/index.js.map +0 -1
  107. package/dist/crypto/index.cjs +0 -424
  108. package/dist/crypto/index.cjs.map +0 -1
  109. package/dist/crypto/index.d.cts +0 -74
  110. package/dist/crypto/index.js.map +0 -1
  111. package/dist/errors/index.cjs +0 -136
  112. package/dist/errors/index.cjs.map +0 -1
  113. package/dist/errors/index.d.cts +0 -60
  114. package/dist/errors/index.js.map +0 -1
  115. package/dist/events/index.cjs +0 -41
  116. package/dist/events/index.cjs.map +0 -1
  117. package/dist/events/index.d.cts +0 -61
  118. package/dist/events/index.js.map +0 -1
  119. package/dist/index.cjs +0 -4
  120. package/dist/index.cjs.map +0 -1
  121. package/dist/index.d.cts +0 -2
  122. package/dist/index.js.map +0 -1
  123. package/dist/keystore/index.cjs +0 -335
  124. package/dist/keystore/index.cjs.map +0 -1
  125. package/dist/keystore/index.d.cts +0 -23
  126. package/dist/keystore/index.js.map +0 -1
  127. package/dist/network/index.cjs +0 -74
  128. package/dist/network/index.cjs.map +0 -1
  129. package/dist/network/index.d.cts +0 -36
  130. package/dist/network/index.js.map +0 -1
  131. package/dist/signer/index.cjs +0 -121
  132. package/dist/signer/index.cjs.map +0 -1
  133. package/dist/signer/index.d.cts +0 -40
  134. package/dist/signer/index.js.map +0 -1
  135. package/dist/storage/ZgStorage.d.ts +0 -24
  136. package/dist/storage/ZgStorage.js +0 -102
  137. package/dist/storage/index.cjs +0 -221
  138. package/dist/storage/index.cjs.map +0 -1
  139. package/dist/storage/index.d.cts +0 -44
  140. package/dist/storage/index.js.map +0 -1
  141. package/dist/testing/index.cjs +0 -4
  142. package/dist/testing/index.cjs.map +0 -1
  143. package/dist/testing/index.d.cts +0 -2
  144. package/dist/testing/index.js.map +0 -1
  145. package/dist/types-BOG5Ub1z.d.cts +0 -31
  146. package/dist/types-BOG5Ub1z.d.ts +0 -31
  147. package/dist/types-V7_ZmUb-.d.cts +0 -19
  148. package/dist/types-hAsITUQ7.d.ts +0 -19
  149. package/dist/verifier/index.cjs +0 -4
  150. package/dist/verifier/index.cjs.map +0 -1
  151. package/dist/verifier/index.d.cts +0 -2
  152. package/dist/verifier/index.js.map +0 -1
  153. package/dist/worker/index.cjs +0 -382
  154. package/dist/worker/index.cjs.map +0 -1
  155. package/dist/worker/index.d.cts +0 -58
  156. package/dist/worker/index.js.map +0 -1
@@ -1,16 +1,3 @@
1
- import type { Address } from '../types.js';
2
- export interface NetworkContracts {
3
- escrow: Address;
4
- registry: Address;
5
- reputation: Address;
6
- usdc: Address;
7
- }
8
- export interface Network {
9
- name: string;
10
- chainId: bigint;
11
- rpc: string[];
12
- contracts: NetworkContracts;
13
- indexer: string;
14
- broker: string;
15
- explorer?: string;
16
- }
1
+ import type { NetworkName } from './presets.js';
2
+ export type { Network, EVMNetwork, NetworkBase, BlockchainType, CreateTaskParams, DomainTask, DomainTaskMeta, DomainReputation, DomainTxReceipt, ChainSigner, } from '../chain/domain-types.js';
3
+ export type { NetworkName };
@@ -59,7 +59,7 @@ export class EthersSigner {
59
59
  return this.publicKeyCache;
60
60
  }
61
61
  // Slow path: sign a probe message and recover the public key.
62
- const probe = 'BlindBounty-PublicKey-Recovery-v1';
62
+ const probe = 'BlindMarket-PublicKey-Recovery-v1';
63
63
  const sig = await this.inner.signMessage(probe);
64
64
  const recovered = ethers.SigningKey.recoverPublicKey(ethers.hashMessage(probe), sig);
65
65
  this.publicKeyCache = recovered;
@@ -1,3 +1,2 @@
1
1
  export * from './Storage.js';
2
2
  export * from './MemoryStorage.js';
3
- export * from './ZgStorage.js';
@@ -1,3 +1,3 @@
1
1
  export * from './Storage.js';
2
2
  export * from './MemoryStorage.js';
3
- export * from './ZgStorage.js';
3
+ // ZgStorage excluded — requires @0gfoundation/0g-ts-sdk optional dep
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Framework adapters — convert BlindMarket tools into ready-to-use tool arrays
3
+ * for each major agent SDK. No manual schema conversion needed.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // LangChain
8
+ * import { toLangChainTools } from '@blindmarket/sdk/tools';
9
+ * const tools = toLangChainTools(bb);
10
+ *
11
+ * // Vercel AI SDK
12
+ * import { toVercelTools } from '@blindmarket/sdk/tools';
13
+ * const tools = toVercelTools(bb);
14
+ * ```
15
+ */
16
+ import type { BlindMarket } from '../index.js';
17
+ export type { Tool, ToolKit, ToolDefinition } from './types.js';
18
+ export interface LangChainStructuredTool {
19
+ name: string;
20
+ description: string;
21
+ schema: {
22
+ shape: Record<string, unknown>;
23
+ parse: (raw: unknown) => Record<string, unknown>;
24
+ };
25
+ func: (args: Record<string, unknown>) => Promise<string>;
26
+ }
27
+ /**
28
+ * Convert BlindMarket tools to LangChain `DynamicStructuredTool`-compatible objects.
29
+ * Pass them directly into `createReactAgent`, `initializeAgentExecutorWithOptions`, etc.
30
+ *
31
+ * ```ts
32
+ * import { ChatOpenAI } from '@langchain/openai';
33
+ * import { createReactAgent } from '@langchain/langgraph/prebuilt';
34
+ *
35
+ * const tools = toLangChainTools(bb);
36
+ * const agent = createReactAgent({ llm: new ChatOpenAI({ model: 'gpt-4' }), tools });
37
+ * ```
38
+ */
39
+ export declare function toLangChainTools(bb: BlindMarket): LangChainStructuredTool[];
40
+ export interface VercelTool {
41
+ description: string;
42
+ parameters: {
43
+ type: 'object';
44
+ properties: Record<string, {
45
+ type: string;
46
+ description?: string;
47
+ enum?: string[];
48
+ }>;
49
+ required?: string[];
50
+ };
51
+ execute: (args: Record<string, unknown>) => Promise<unknown>;
52
+ }
53
+ /**
54
+ * Convert BlindMarket tools to Vercel AI SDK `tool()` compatible objects.
55
+ *
56
+ * ```ts
57
+ * import { generateText } from 'ai';
58
+ * import { openai } from '@ai-sdk/openai';
59
+ *
60
+ * const tools = toVercelTools(bb);
61
+ * const { text } = await generateText({ model: openai('gpt-4'), tools });
62
+ * ```
63
+ */
64
+ export declare function toVercelTools(bb: BlindMarket): Record<string, VercelTool>;
65
+ /**
66
+ * Get raw OpenAI-compatible tool definitions.
67
+ *
68
+ * ```ts
69
+ * const tools = toOpenAITools(bb);
70
+ * const response = await openai.chat.completions.create({ model: 'gpt-4', tools });
71
+ * ```
72
+ */
73
+ export declare function toOpenAITools(bb: BlindMarket): import("./types.js").ToolDefinition[];
74
+ export interface ClaudeTool {
75
+ name: string;
76
+ description: string;
77
+ input_schema: {
78
+ type: 'object';
79
+ properties: Record<string, {
80
+ type: string;
81
+ description?: string;
82
+ enum?: string[];
83
+ }>;
84
+ required?: string[];
85
+ };
86
+ }
87
+ /**
88
+ * Convert BlindMarket tools to Claude SDK tool format.
89
+ *
90
+ * ```ts
91
+ * const tools = toClaudeTools(bb);
92
+ * const response = await anthropic.messages.create({
93
+ * model: 'claude-sonnet-4-20250514',
94
+ * tools,
95
+ * messages: [{ role: 'user', content: 'Find tasks' }],
96
+ * });
97
+ * ```
98
+ */
99
+ export declare function toClaudeTools(bb: BlindMarket): ClaudeTool[];
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Framework adapters — convert BlindMarket tools into ready-to-use tool arrays
3
+ * for each major agent SDK. No manual schema conversion needed.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // LangChain
8
+ * import { toLangChainTools } from '@blindmarket/sdk/tools';
9
+ * const tools = toLangChainTools(bb);
10
+ *
11
+ * // Vercel AI SDK
12
+ * import { toVercelTools } from '@blindmarket/sdk/tools';
13
+ * const tools = toVercelTools(bb);
14
+ * ```
15
+ */
16
+ import { createBlindMarketTools } from './helpers.js';
17
+ /**
18
+ * Convert BlindMarket tools to LangChain `DynamicStructuredTool`-compatible objects.
19
+ * Pass them directly into `createReactAgent`, `initializeAgentExecutorWithOptions`, etc.
20
+ *
21
+ * ```ts
22
+ * import { ChatOpenAI } from '@langchain/openai';
23
+ * import { createReactAgent } from '@langchain/langgraph/prebuilt';
24
+ *
25
+ * const tools = toLangChainTools(bb);
26
+ * const agent = createReactAgent({ llm: new ChatOpenAI({ model: 'gpt-4' }), tools });
27
+ * ```
28
+ */
29
+ export function toLangChainTools(bb) {
30
+ return createBlindMarketTools(bb).map(mapToLangChain);
31
+ }
32
+ function mapToLangChain(t) {
33
+ const shape = {};
34
+ const props = t.definition.function.parameters.properties;
35
+ const required = t.definition.function.parameters.required ?? [];
36
+ for (const [key, prop] of Object.entries(props)) {
37
+ const p = prop;
38
+ const type = p.type === 'number' ? 'number'
39
+ : p.type === 'array' ? 'array'
40
+ : 'string';
41
+ shape[key] = { type, enum: p.enum, required: required.includes(key) };
42
+ }
43
+ return {
44
+ name: t.definition.function.name,
45
+ description: t.definition.function.description,
46
+ schema: {
47
+ shape,
48
+ parse: (raw) => raw,
49
+ },
50
+ func: async (args) => JSON.stringify(await t.execute(args)),
51
+ };
52
+ }
53
+ /**
54
+ * Convert BlindMarket tools to Vercel AI SDK `tool()` compatible objects.
55
+ *
56
+ * ```ts
57
+ * import { generateText } from 'ai';
58
+ * import { openai } from '@ai-sdk/openai';
59
+ *
60
+ * const tools = toVercelTools(bb);
61
+ * const { text } = await generateText({ model: openai('gpt-4'), tools });
62
+ * ```
63
+ */
64
+ export function toVercelTools(bb) {
65
+ const result = {};
66
+ for (const t of createBlindMarketTools(bb)) {
67
+ const props = t.definition.function.parameters.properties;
68
+ const required = t.definition.function.parameters.required;
69
+ const converted = {};
70
+ for (const [key, prop] of Object.entries(props)) {
71
+ const p = prop;
72
+ converted[key] = {
73
+ type: p.type === 'number' ? 'number' : p.type === 'array' ? 'array' : 'string',
74
+ description: p.description,
75
+ ...(p.enum ? { enum: p.enum } : {}),
76
+ };
77
+ }
78
+ result[t.definition.function.name] = {
79
+ description: t.definition.function.description,
80
+ parameters: { type: 'object', properties: converted, required },
81
+ execute: (args) => t.execute(args),
82
+ };
83
+ }
84
+ return result;
85
+ }
86
+ // ── OpenAI adapter ──────────────────────────────────────────────────────────
87
+ /**
88
+ * Get raw OpenAI-compatible tool definitions.
89
+ *
90
+ * ```ts
91
+ * const tools = toOpenAITools(bb);
92
+ * const response = await openai.chat.completions.create({ model: 'gpt-4', tools });
93
+ * ```
94
+ */
95
+ export function toOpenAITools(bb) {
96
+ return createBlindMarketTools(bb).map(t => t.definition);
97
+ }
98
+ /**
99
+ * Convert BlindMarket tools to Claude SDK tool format.
100
+ *
101
+ * ```ts
102
+ * const tools = toClaudeTools(bb);
103
+ * const response = await anthropic.messages.create({
104
+ * model: 'claude-sonnet-4-20250514',
105
+ * tools,
106
+ * messages: [{ role: 'user', content: 'Find tasks' }],
107
+ * });
108
+ * ```
109
+ */
110
+ export function toClaudeTools(bb) {
111
+ return createBlindMarketTools(bb).map(t => {
112
+ const props = t.definition.function.parameters.properties;
113
+ const required = t.definition.function.parameters.required;
114
+ const converted = {};
115
+ for (const [key, prop] of Object.entries(props)) {
116
+ const p = prop;
117
+ converted[key] = {
118
+ type: p.type === 'number' ? 'number' : p.type === 'array' ? 'array' : 'string',
119
+ description: p.description,
120
+ ...(p.enum ? { enum: p.enum } : {}),
121
+ };
122
+ }
123
+ return {
124
+ name: t.definition.function.name,
125
+ description: t.definition.function.description,
126
+ input_schema: { type: 'object', properties: converted, required },
127
+ };
128
+ });
129
+ }
@@ -0,0 +1,9 @@
1
+ import { BlindMarket } from '../index.js';
2
+ import type { Tool, ToolKit } from './types.js';
3
+ export declare function tool<T>(_bb: BlindMarket, name: string, description: string, properties: Record<string, unknown>, execute: (args: Record<string, any>) => Promise<T>, required?: string[]): Tool<Record<string, any>, T>;
4
+ export declare function kit(name: string, description: string, all: Tool[], names: string[]): ToolKit;
5
+ export declare function createBlindMarketTools(bb: BlindMarket): Tool[];
6
+ export declare function createTaskTools(bb: BlindMarket): ToolKit;
7
+ export declare function createAgentManagementTools(bb: BlindMarket): ToolKit;
8
+ export declare function createA2ATools(bb: BlindMarket): ToolKit;
9
+ export type { Tool, ToolKit, ToolDefinition } from './types.js';
@@ -0,0 +1,169 @@
1
+ import { AgentCap } from '../types.js';
2
+ const CAP_ENUM = Object.values(AgentCap);
3
+ function def(name, description, properties, required) {
4
+ return {
5
+ type: 'function',
6
+ function: { name, description, parameters: { type: 'object', properties: properties, required } },
7
+ };
8
+ }
9
+ function str(desc, e) {
10
+ return e ? { type: 'string', description: desc, enum: e } : { type: 'string', description: desc };
11
+ }
12
+ function num(desc) {
13
+ return { type: 'number', description: desc };
14
+ }
15
+ function arr(desc, items) {
16
+ return items ? { type: 'array', description: desc, items } : { type: 'array', description: desc };
17
+ }
18
+ export function tool(_bb, name, description, properties, execute, required) {
19
+ return { definition: def(name, description, properties, required), execute };
20
+ }
21
+ export function kit(name, description, all, names) {
22
+ const namesSet = new Set(names);
23
+ return { name, description, tools: all.filter((t) => namesSet.has(t.definition.function.name)) };
24
+ }
25
+ export function createBlindMarketTools(bb) {
26
+ return [
27
+ tool(bb, 'list_open_tasks', 'List open tasks available for assignment', {}, async () => {
28
+ return bb.listTasks();
29
+ }),
30
+ tool(bb, 'get_task', 'Get full task details by ID', { taskId: str('Numeric or 0x task ID') }, async (a) => {
31
+ return bb.getTask(a.taskId);
32
+ }, ['taskId']),
33
+ tool(bb, 'search_agents', 'Search registered agents by capability or rating', {
34
+ capability: str('Agent capability filter'),
35
+ minRating: num('Minimum rating (1-5)'),
36
+ }, async (a) => {
37
+ return bb.searchAgents(a);
38
+ }),
39
+ tool(bb, 'create_agent', 'One-shot agent creation: generates wallet + registers as A2A executor', {
40
+ displayName: str('Display name for the agent'),
41
+ capabilities: arr('List of capabilities', str('Capability', CAP_ENUM)),
42
+ minReward: str('Minimum reward per task in wei (optional)'),
43
+ preferredCapabilities: arr('Preferred subset of capabilities (optional)', str('Capability', CAP_ENUM)),
44
+ agentCardUrl: str('Agent card URL for marketplace display (optional)'),
45
+ mcpEndpointUrl: str('MCP endpoint URL (optional)'),
46
+ }, async (a) => {
47
+ return bb.createAgent(a);
48
+ }, ['displayName', 'capabilities']),
49
+ tool(bb, 'register_as_executor', 'Register as an A2A executor to receive task offers', {
50
+ address: str('Your wallet address (0x...)'),
51
+ displayName: str('Human-readable display name'),
52
+ capabilities: arr('List of capabilities', str('Capability', CAP_ENUM)),
53
+ publicKey: str('Your uncompressed secp256k1 public key'),
54
+ minReward: str('Minimum reward in wei (optional)'),
55
+ preferredCapabilities: arr('Preferred subset of capabilities (optional)', str('Capability', CAP_ENUM)),
56
+ }, async (a) => {
57
+ return bb.registerExecutor(a);
58
+ }, ['address', 'displayName', 'capabilities', 'publicKey']),
59
+ tool(bb, 'browse_a2a_tasks', 'Browse tasks available for A2A execution', {
60
+ capabilities: arr('Required capabilities filter'),
61
+ minReputation: num('Minimum reputation filter'),
62
+ }, async (a) => {
63
+ return bb.browseA2ATasks(a);
64
+ }),
65
+ tool(bb, 'bid_on_task', 'Register bid intent on an A2A task', {
66
+ taskId: str('Task ID'),
67
+ }, async (a) => {
68
+ await bb.bidOnTask(a.taskId);
69
+ return { success: true };
70
+ }, ['taskId']),
71
+ tool(bb, 'accept_task', 'Accept a task and get the wrapped AES key', {
72
+ taskId: str('Task ID'),
73
+ }, async (a) => {
74
+ return bb.acceptTask(a.taskId);
75
+ }, ['taskId']),
76
+ tool(bb, 'submit_result', 'Submit execution result for an accepted task', {
77
+ taskId: str('Task ID'),
78
+ output: str('Result output text'),
79
+ }, async (a) => {
80
+ return bb.submitResult(a.taskId, { output: a.output });
81
+ }, ['taskId', 'output']),
82
+ tool(bb, 'deploy_agent', 'Deploy a new AI agent on BlindMarket', {
83
+ name: str('Agent name'),
84
+ instructions: str('System prompt / instructions'),
85
+ provider: str('LLM provider', ['openai', 'anthropic', 'groq', 'gemini']),
86
+ model: str('Model name (e.g. gpt-4, claude-sonnet-4-5)'),
87
+ apiKey: str('Provider API key'),
88
+ ownerAddress: str('Owner wallet address (0x...)'),
89
+ ownerPublicKey: str('Owner public key'),
90
+ }, async (a) => {
91
+ return bb.deployAgent(a);
92
+ }, ['name', 'instructions', 'provider', 'model', 'apiKey', 'ownerAddress', 'ownerPublicKey']),
93
+ tool(bb, 'list_agents', 'List deployed agents', {
94
+ ownerAddress: str('Filter by owner address'),
95
+ }, async (a) => {
96
+ return bb.listAgents(a.ownerAddress);
97
+ }),
98
+ tool(bb, 'get_agent', 'Get single deployed agent details', {
99
+ agentId: str('Agent ID'),
100
+ }, async (a) => {
101
+ return bb.getAgent(a.agentId);
102
+ }, ['agentId']),
103
+ tool(bb, 'start_agent', 'Start a deployed agent', {
104
+ agentId: str('Agent ID'),
105
+ }, async (a) => {
106
+ return bb.startAgent(a.agentId);
107
+ }, ['agentId']),
108
+ tool(bb, 'stop_agent', 'Stop a deployed agent', {
109
+ agentId: str('Agent ID'),
110
+ }, async (a) => {
111
+ return bb.stopAgent(a.agentId);
112
+ }, ['agentId']),
113
+ tool(bb, 'restart_agent', 'Restart a deployed agent', {
114
+ agentId: str('Agent ID'),
115
+ }, async (a) => {
116
+ return bb.restartAgent(a.agentId);
117
+ }, ['agentId']),
118
+ tool(bb, 'update_agent', "Update a deployed agent's config", {
119
+ agentId: str('Agent ID'),
120
+ instructions: str('New instructions'),
121
+ model: str('New model name'),
122
+ capabilities: arr('New capabilities list', str('Capability')),
123
+ }, async (a) => {
124
+ return bb.updateAgent(a.agentId, a);
125
+ }, ['agentId']),
126
+ tool(bb, 'verify_task', 'Trigger AI/TEE verification for a submitted task result', {
127
+ taskId: num('Numeric task ID'),
128
+ taskCategory: str('Task category (e.g. photography, research)'),
129
+ taskRequirements: str('What the task required'),
130
+ evidenceSummary: str('Summary of submitted evidence'),
131
+ }, async (a) => {
132
+ return bb.verify(a);
133
+ }, ['taskId', 'taskCategory', 'taskRequirements', 'evidenceSummary']),
134
+ tool(bb, 'get_reputation', "Get an address's on-chain + off-chain reputation", {
135
+ address: str('Wallet address (0x...)'),
136
+ }, async (a) => {
137
+ return bb.getReputation(a.address);
138
+ }, ['address']),
139
+ tool(bb, 'send_message', 'Send a message to a task participant', {
140
+ taskId: str('Task ID'),
141
+ to: str('Recipient address or "poster"/"agent" shortcut'),
142
+ content: str('Message content'),
143
+ }, async (a) => {
144
+ return bb.sendMessage(a);
145
+ }, ['taskId', 'to', 'content']),
146
+ tool(bb, 'get_inbox', 'Read inbox messages', {}, async () => {
147
+ return bb.getInbox();
148
+ }),
149
+ tool(bb, 'get_unread_count', 'Get unread message count', {}, async () => {
150
+ return bb.getUnreadCount();
151
+ }),
152
+ ];
153
+ }
154
+ export function createTaskTools(bb) {
155
+ return kit('tasks', 'Browse and manage tasks', createBlindMarketTools(bb), [
156
+ 'list_open_tasks', 'get_task', 'bid_on_task', 'accept_task', 'submit_result',
157
+ ]);
158
+ }
159
+ export function createAgentManagementTools(bb) {
160
+ return kit('agents', 'Deploy and manage agents', createBlindMarketTools(bb), [
161
+ 'deploy_agent', 'list_agents', 'get_agent', 'start_agent', 'stop_agent',
162
+ 'restart_agent', 'update_agent', 'create_agent', 'register_as_executor',
163
+ ]);
164
+ }
165
+ export function createA2ATools(bb) {
166
+ return kit('a2a', 'Agent-to-agent task execution', createBlindMarketTools(bb), [
167
+ 'create_agent', 'register_as_executor', 'browse_a2a_tasks', 'bid_on_task', 'accept_task', 'submit_result',
168
+ ]);
169
+ }
@@ -0,0 +1,36 @@
1
+ import { BlindMarket } from '../index.js';
2
+ import { toLangChainTools, toVercelTools, toClaudeTools } from './adapters.js';
3
+ import type { ToolDefinition } from './types.js';
4
+ /**
5
+ * Returns all framework tool formats from one call. No need to remember
6
+ * `toLangChainTools`, `toVercelTools`, etc. — just pick a property.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { BlindMarket, tools } from '@blindmarket/sdk';
11
+ * const bb = new BlindMarket({ apiKey });
12
+ *
13
+ * // OpenAI / Vercel
14
+ * openai.chat.completions.create({ model: 'gpt-4', tools: tools(bb).definitions });
15
+ *
16
+ * // LangChain
17
+ * createReactAgent({ llm, tools: tools(bb).langchain });
18
+ *
19
+ * // Claude
20
+ * anthropic.messages.create({ model, tools: tools(bb).claude });
21
+ * ```
22
+ */
23
+ export declare function tools(bb: BlindMarket): BlindMarketTools;
24
+ export interface BlindMarketTools {
25
+ /** OpenAI-compatible tool definitions (array of `{type, function}`). */
26
+ definitions: ToolDefinition[];
27
+ /** LangChain `StructuredTool` instances. */
28
+ langchain: ReturnType<typeof toLangChainTools>;
29
+ /** Vercel AI SDK tool map (`Record<string, VercelTool>`). */
30
+ vercel: ReturnType<typeof toVercelTools>;
31
+ /** Claude tool shapes (`{name, description, input_schema}[]`). */
32
+ claude: ReturnType<typeof toClaudeTools>;
33
+ }
34
+ export type { Tool, ToolKit, ToolDefinition } from './types.js';
35
+ export { createBlindMarketTools, createTaskTools, createAgentManagementTools, createA2ATools, } from './helpers.js';
36
+ export { toLangChainTools, toVercelTools, toOpenAITools, toClaudeTools, } from './adapters.js';
@@ -0,0 +1,32 @@
1
+ import { createBlindMarketTools, } from './helpers.js';
2
+ import { toLangChainTools, toVercelTools, toClaudeTools, } from './adapters.js';
3
+ // ── Single entry-point ───────────────────────────────────────────────────────
4
+ /**
5
+ * Returns all framework tool formats from one call. No need to remember
6
+ * `toLangChainTools`, `toVercelTools`, etc. — just pick a property.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { BlindMarket, tools } from '@blindmarket/sdk';
11
+ * const bb = new BlindMarket({ apiKey });
12
+ *
13
+ * // OpenAI / Vercel
14
+ * openai.chat.completions.create({ model: 'gpt-4', tools: tools(bb).definitions });
15
+ *
16
+ * // LangChain
17
+ * createReactAgent({ llm, tools: tools(bb).langchain });
18
+ *
19
+ * // Claude
20
+ * anthropic.messages.create({ model, tools: tools(bb).claude });
21
+ * ```
22
+ */
23
+ export function tools(bb) {
24
+ const all = createBlindMarketTools(bb);
25
+ const definitions = all.map(t => t.definition);
26
+ const langchain = toLangChainTools(bb);
27
+ const vercel = toVercelTools(bb);
28
+ const claude = toClaudeTools(bb);
29
+ return { definitions, langchain, vercel, claude };
30
+ }
31
+ export { createBlindMarketTools, createTaskTools, createAgentManagementTools, createA2ATools, } from './helpers.js';
32
+ export { toLangChainTools, toVercelTools, toOpenAITools, toClaudeTools, } from './adapters.js';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * OpenAI-compatible function tool definition.
3
+ * Every major agent SDK can consume this format:
4
+ * - **OpenAI** — native function calling
5
+ * - **Claude** — tool_use format (convert name → tool name)
6
+ * - **Vercel AI SDK** — pass into `toolset` helper
7
+ * - **LangChain** — convert via `DynamicStructuredTool`
8
+ * - **OpenAI Agents SDK** — pass as `FunctionTool`
9
+ */
10
+ export interface ToolDefinition {
11
+ type: 'function';
12
+ function: {
13
+ name: string;
14
+ description: string;
15
+ parameters: {
16
+ type: 'object';
17
+ properties: Record<string, JSONSchemaProperty>;
18
+ required?: string[];
19
+ };
20
+ };
21
+ }
22
+ export type JSONSchemaProperty = {
23
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
24
+ description?: string;
25
+ enum?: string[];
26
+ items?: JSONSchemaProperty;
27
+ properties?: Record<string, JSONSchemaProperty>;
28
+ required?: string[];
29
+ };
30
+ /**
31
+ * A bound tool — ready to invoke with parsed args.
32
+ */
33
+ export interface Tool<TArgs = Record<string, unknown>, TResult = unknown> {
34
+ definition: ToolDefinition;
35
+ execute: (args: TArgs) => Promise<TResult>;
36
+ }
37
+ /**
38
+ * Collection of tools grouped by domain.
39
+ */
40
+ export interface ToolKit {
41
+ name: string;
42
+ description: string;
43
+ tools: Tool[];
44
+ }
@@ -0,0 +1 @@
1
+ export {};