@jinn-network/client 0.1.3-canary.2d6b2676 → 0.1.3-canary.8e61ba74

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 (289) hide show
  1. package/dist/adapters/adapter.d.ts +15 -4
  2. package/dist/adapters/local/adapter.d.ts +9 -8
  3. package/dist/adapters/local/adapter.js +47 -74
  4. package/dist/adapters/local/adapter.js.map +1 -1
  5. package/dist/adapters/mech/adapter.d.ts +29 -13
  6. package/dist/adapters/mech/adapter.js +316 -311
  7. package/dist/adapters/mech/adapter.js.map +1 -1
  8. package/dist/adapters/mech/contracts.d.ts +62 -16
  9. package/dist/adapters/mech/contracts.js +226 -92
  10. package/dist/adapters/mech/contracts.js.map +1 -1
  11. package/dist/adapters/mech/safe-revert.js +0 -6
  12. package/dist/adapters/mech/safe-revert.js.map +1 -1
  13. package/dist/adapters/mech/types.d.ts +237 -84
  14. package/dist/adapters/mech/types.js +125 -50
  15. package/dist/adapters/mech/types.js.map +1 -1
  16. package/dist/agent/agent-ws.d.ts +1 -0
  17. package/dist/agent/agent-ws.js +13 -1
  18. package/dist/agent/agent-ws.js.map +1 -1
  19. package/dist/agent/operator-claude.js +4 -0
  20. package/dist/agent/operator-claude.js.map +1 -1
  21. package/dist/api/gather-status.d.ts +0 -1
  22. package/dist/api/gather-status.js +0 -1
  23. package/dist/api/gather-status.js.map +1 -1
  24. package/dist/api/setup-endpoints.d.ts +20 -0
  25. package/dist/api/setup-endpoints.js +110 -3
  26. package/dist/api/setup-endpoints.js.map +1 -1
  27. package/dist/build-info.json +4 -4
  28. package/dist/build-meta.json +1 -1
  29. package/dist/cli/commands/auth.js +6 -3
  30. package/dist/cli/commands/auth.js.map +1 -1
  31. package/dist/cli/commands/bootstrap.js +0 -1
  32. package/dist/cli/commands/bootstrap.js.map +1 -1
  33. package/dist/cli/commands/create.js +3 -3
  34. package/dist/cli/commands/doctor.js +4 -12
  35. package/dist/cli/commands/doctor.js.map +1 -1
  36. package/dist/cli/commands/fleet-scale.js +0 -1
  37. package/dist/cli/commands/fleet-scale.js.map +1 -1
  38. package/dist/cli/commands/fund-requirements.js +0 -1
  39. package/dist/cli/commands/fund-requirements.js.map +1 -1
  40. package/dist/cli/commands/migrate-agent-id.js +0 -1
  41. package/dist/cli/commands/migrate-agent-id.js.map +1 -1
  42. package/dist/cli/commands/solver-nets.js +1 -1
  43. package/dist/cli/commands/solver-plugins.js +3 -1
  44. package/dist/cli/commands/solver-plugins.js.map +1 -1
  45. package/dist/cli/commands/tasks.js +20 -11
  46. package/dist/cli/commands/tasks.js.map +1 -1
  47. package/dist/cli/commands/version.js +0 -1
  48. package/dist/cli/commands/version.js.map +1 -1
  49. package/dist/cli/deployment-digest.js +0 -5
  50. package/dist/cli/deployment-digest.js.map +1 -1
  51. package/dist/cli/execution-context.js +0 -1
  52. package/dist/cli/execution-context.js.map +1 -1
  53. package/dist/cli/introspection-context.js +0 -1
  54. package/dist/cli/introspection-context.js.map +1 -1
  55. package/dist/config.d.ts +410 -22
  56. package/dist/config.js +41 -30
  57. package/dist/config.js.map +1 -1
  58. package/dist/daemon/creator.d.ts +3 -3
  59. package/dist/daemon/creator.js +3 -3
  60. package/dist/daemon/creator.js.map +1 -1
  61. package/dist/daemon/daemon.d.ts +3 -6
  62. package/dist/daemon/daemon.js +30 -9
  63. package/dist/daemon/daemon.js.map +1 -1
  64. package/dist/daemon/jinn-claim-loop-canonical.d.ts +11 -11
  65. package/dist/daemon/jinn-claim-loop-canonical.js +17 -17
  66. package/dist/daemon/jinn-claim-loop-canonical.js.map +1 -1
  67. package/dist/daemon/jinn-claim-loop-mock.d.ts +4 -4
  68. package/dist/daemon/jinn-claim-loop-mock.js +7 -7
  69. package/dist/daemon/jinn-claim-loop-mock.js.map +1 -1
  70. package/dist/daemon/jinn-claim-loop.d.ts +4 -4
  71. package/dist/daemon/jinn-claim-loop.js +3 -3
  72. package/dist/dashboard/assets/{index-Bxlk5qpa.js → index-CaUOdCs6.js} +6 -6
  73. package/dist/dashboard/index.html +1 -1
  74. package/dist/earning/bootstrap.d.ts +0 -1
  75. package/dist/earning/bootstrap.js +0 -1
  76. package/dist/earning/bootstrap.js.map +1 -1
  77. package/dist/earning/contracts.d.ts +18 -20
  78. package/dist/earning/contracts.js +18 -29
  79. package/dist/earning/contracts.js.map +1 -1
  80. package/dist/earning/funding-plan.d.ts +0 -1
  81. package/dist/earning/funding-plan.js +0 -1
  82. package/dist/earning/funding-plan.js.map +1 -1
  83. package/dist/earning/migrate-agent-id.d.ts +0 -1
  84. package/dist/earning/migrate-agent-id.js +0 -1
  85. package/dist/earning/migrate-agent-id.js.map +1 -1
  86. package/dist/erc8004/reputation.d.ts +2 -2
  87. package/dist/erc8004/reputation.js +2 -2
  88. package/dist/events/types.d.ts +2 -2
  89. package/dist/harnesses/engine/delivery.d.ts +10 -6
  90. package/dist/harnesses/engine/delivery.js +10 -6
  91. package/dist/harnesses/engine/delivery.js.map +1 -1
  92. package/dist/harnesses/engine/engine.d.ts +16 -29
  93. package/dist/harnesses/engine/engine.js +67 -106
  94. package/dist/harnesses/engine/engine.js.map +1 -1
  95. package/dist/harnesses/engine/persistence.d.ts +5 -1
  96. package/dist/harnesses/engine/persistence.js +10 -2
  97. package/dist/harnesses/engine/persistence.js.map +1 -1
  98. package/dist/harnesses/external-impls/loader.d.ts +1 -1
  99. package/dist/harnesses/impls/claude-code-learner/types.d.ts +1 -1
  100. package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +1 -1
  101. package/dist/harnesses/impls/claude-mcp-prediction/index.js +6 -6
  102. package/dist/harnesses/impls/claude-mcp-prediction/types.d.ts +1 -1
  103. package/dist/harnesses/impls/claude-mcp-prediction/types.js +1 -1
  104. package/dist/harnesses/impls/index.js +5 -5
  105. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +1 -1
  106. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
  107. package/dist/harnesses/impls/prediction-v0-baseline/index.d.ts +4 -4
  108. package/dist/harnesses/impls/prediction-v0-baseline/index.js +10 -10
  109. package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.d.ts +3 -3
  110. package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.d.ts +1 -1
  111. package/dist/harnesses/impls/prediction-v0-evaluator/index.d.ts +4 -4
  112. package/dist/harnesses/impls/prediction-v0-evaluator/index.js +11 -11
  113. package/dist/harnesses/impls/prediction-v1-baseline/index.d.ts +31 -0
  114. package/dist/harnesses/impls/prediction-v1-baseline/index.js +79 -0
  115. package/dist/harnesses/impls/prediction-v1-baseline/index.js.map +1 -0
  116. package/dist/harnesses/impls/prediction-v1-evaluator/index.d.ts +32 -0
  117. package/dist/harnesses/impls/prediction-v1-evaluator/index.js +198 -0
  118. package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -0
  119. package/dist/harnesses/manifest/types.d.ts +1 -1
  120. package/dist/harnesses/manifest/types.js +1 -1
  121. package/dist/harnesses/types.d.ts +2 -1
  122. package/dist/harnesses/types.js.map +1 -1
  123. package/dist/main.js +2 -26
  124. package/dist/main.js.map +1 -1
  125. package/dist/mcp/operator-server.js +1 -1
  126. package/dist/mcp/operator-server.js.map +1 -1
  127. package/dist/mcp/server.js +2 -2
  128. package/dist/plugins/manifest.d.ts +1 -1
  129. package/dist/plugins/manifest.js +1 -1
  130. package/dist/plugins/manifest.js.map +1 -1
  131. package/dist/plugins/registry.js +1 -1
  132. package/dist/plugins/registry.js.map +1 -1
  133. package/dist/plugins/resolvers.js +2 -1
  134. package/dist/plugins/resolvers.js.map +1 -1
  135. package/dist/plugins/types.d.ts +4 -8
  136. package/dist/plugins/validator.js +5 -7
  137. package/dist/plugins/validator.js.map +1 -1
  138. package/dist/preflight/claude-auth.d.ts +3 -1
  139. package/dist/preflight/claude-auth.js +5 -5
  140. package/dist/preflight/claude-auth.js.map +1 -1
  141. package/dist/setup/claude-code-install.d.ts +19 -0
  142. package/dist/setup/claude-code-install.js +51 -0
  143. package/dist/setup/claude-code-install.js.map +1 -0
  144. package/dist/solver-nets/contracts.d.ts +2 -0
  145. package/dist/solver-nets/contracts.js +2 -0
  146. package/dist/solver-nets/contracts.js.map +1 -0
  147. package/dist/solver-nets/registry.d.ts +2 -0
  148. package/dist/solver-nets/registry.js +13 -5
  149. package/dist/solver-nets/registry.js.map +1 -1
  150. package/dist/solver-types/constants.d.ts +1 -1
  151. package/dist/solver-types/constants.js +1 -1
  152. package/dist/solver-types/index.d.ts +5 -5
  153. package/dist/solver-types/index.js +5 -5
  154. package/dist/solver-types/prediction-apy-v0-auto.js +12 -0
  155. package/dist/solver-types/prediction-apy-v0-auto.js.map +1 -1
  156. package/dist/solver-types/prediction-v0-auto.d.ts +4 -4
  157. package/dist/solver-types/prediction-v0-auto.js +22 -10
  158. package/dist/solver-types/prediction-v0-auto.js.map +1 -1
  159. package/dist/solver-types/prediction-v0-template.d.ts +10 -10
  160. package/dist/solver-types/prediction-v0-template.js +16 -16
  161. package/dist/solver-types/prediction-v0-template.js.map +1 -1
  162. package/dist/solver-types/prediction-v0.d.ts +2 -2
  163. package/dist/solver-types/prediction-v0.js +11 -11
  164. package/dist/solver-types/prediction-v1-auto.d.ts +22 -0
  165. package/dist/solver-types/prediction-v1-auto.js +211 -0
  166. package/dist/solver-types/prediction-v1-auto.js.map +1 -0
  167. package/dist/solver-types/prediction-v1.d.ts +3 -0
  168. package/dist/solver-types/prediction-v1.js +29 -0
  169. package/dist/solver-types/prediction-v1.js.map +1 -0
  170. package/dist/solver-types/solver-type.d.ts +5 -4
  171. package/dist/store/store.d.ts +4 -0
  172. package/dist/store/store.js +28 -4
  173. package/dist/store/store.js.map +1 -1
  174. package/dist/tasks/posting-service.d.ts +5 -2
  175. package/dist/tasks/posting-service.js +12 -6
  176. package/dist/tasks/posting-service.js.map +1 -1
  177. package/dist/tasks/sources.d.ts +2 -2
  178. package/dist/tasks/sources.js +10 -7
  179. package/dist/tasks/sources.js.map +1 -1
  180. package/dist/templates/harnesses/alternative-harness/package.json.tmpl +1 -1
  181. package/dist/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +1 -1
  182. package/dist/templates/harnesses/alternative-harness/src/index.ts.tmpl +1 -1
  183. package/dist/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +1 -1
  184. package/dist/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +1 -1
  185. package/dist/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +1 -1
  186. package/dist/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +1 -1
  187. package/dist/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +1 -1
  188. package/dist/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +1 -1
  189. package/dist/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +1 -1
  190. package/dist/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +1 -1
  191. package/dist/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +1 -1
  192. package/dist/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +1 -1
  193. package/dist/templates/harnesses/evaluator/package.json.tmpl +1 -1
  194. package/dist/templates/harnesses/evaluator/src/index.ts.tmpl +1 -1
  195. package/dist/templates/harnesses/evaluator/test/unit.test.ts.tmpl +1 -1
  196. package/dist/templates/harnesses/forecaster/package.json.tmpl +1 -1
  197. package/dist/templates/harnesses/forecaster/src/index.ts.tmpl +1 -1
  198. package/dist/templates/harnesses/forecaster/test/unit.test.ts.tmpl +1 -1
  199. package/dist/trajectory/schema.d.ts +10 -10
  200. package/dist/types/index.d.ts +2 -2
  201. package/dist/types/index.js +1 -1
  202. package/dist/types/index.js.map +1 -1
  203. package/dist/types/payloads/index.d.ts +1 -0
  204. package/dist/types/payloads/index.js +6 -0
  205. package/dist/types/payloads/index.js.map +1 -1
  206. package/dist/types/payloads/prediction-v1.d.ts +2 -0
  207. package/dist/types/payloads/prediction-v1.js +2 -0
  208. package/dist/types/payloads/prediction-v1.js.map +1 -0
  209. package/dist/types/prediction-v1.d.ts +2 -0
  210. package/dist/types/prediction-v1.js +2 -0
  211. package/dist/types/prediction-v1.js.map +1 -0
  212. package/dist/types/prediction.d.ts +559 -19
  213. package/dist/types/prediction.js +12 -9
  214. package/dist/types/prediction.js.map +1 -1
  215. package/dist/types/task-document.d.ts +389 -0
  216. package/dist/types/task-document.js +11 -0
  217. package/dist/types/task-document.js.map +1 -1
  218. package/dist/types/task.d.ts +285 -1
  219. package/dist/types/task.js +6 -1
  220. package/dist/types/task.js.map +1 -1
  221. package/dist/vendor/@jinn-network/sdk/README.md +61 -0
  222. package/dist/vendor/@jinn-network/sdk/dist/capabilities.d.ts +52 -0
  223. package/dist/vendor/@jinn-network/sdk/dist/capabilities.js +1 -0
  224. package/dist/vendor/@jinn-network/sdk/dist/contracts.d.ts +105 -0
  225. package/dist/vendor/@jinn-network/sdk/dist/contracts.js +147 -0
  226. package/dist/vendor/@jinn-network/sdk/dist/harness.d.ts +69 -0
  227. package/dist/vendor/@jinn-network/sdk/dist/harness.js +1 -0
  228. package/dist/vendor/@jinn-network/sdk/dist/index.d.ts +2 -0
  229. package/dist/vendor/@jinn-network/sdk/dist/index.js +5 -0
  230. package/dist/vendor/@jinn-network/sdk/dist/manifest.d.ts +69 -0
  231. package/dist/vendor/@jinn-network/sdk/dist/manifest.js +3 -0
  232. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.d.ts +223 -0
  233. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +64 -0
  234. package/dist/vendor/@jinn-network/sdk/dist/plugins.d.ts +36 -0
  235. package/dist/vendor/@jinn-network/sdk/dist/plugins.js +54 -0
  236. package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.d.ts +870 -0
  237. package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.js +80 -0
  238. package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.d.ts +2 -0
  239. package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.js +1 -0
  240. package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.d.ts +6 -0
  241. package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.js +3 -0
  242. package/dist/vendor/@jinn-network/sdk/dist/types.d.ts +116 -0
  243. package/dist/vendor/@jinn-network/sdk/dist/types.js +21 -0
  244. package/dist/vendor/@jinn-network/sdk/package.json +34 -0
  245. package/dist/venues/polymarket/client.d.ts +77 -0
  246. package/dist/venues/polymarket/client.js +309 -0
  247. package/dist/venues/polymarket/client.js.map +1 -0
  248. package/dist/withdraw/run-withdraw-plan.js +0 -2
  249. package/dist/withdraw/run-withdraw-plan.js.map +1 -1
  250. package/package.json +8 -6
  251. package/plugins/jinn-prediction-plugin/.claude-plugin/plugin.json +13 -86
  252. package/plugins/jinn-prediction-plugin/.mcp.json +8 -0
  253. package/plugins/jinn-prediction-plugin/GEMINI.md +3 -0
  254. package/plugins/jinn-prediction-plugin/gemini-extension.json +13 -0
  255. package/plugins/jinn-prediction-plugin/jinn.plugin.json +23 -0
  256. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-solution.schema.json +34 -0
  257. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-task.schema.json +118 -0
  258. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-verdict.schema.json +84 -0
  259. package/templates/harnesses/alternative-harness/package.json.tmpl +1 -1
  260. package/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +1 -1
  261. package/templates/harnesses/alternative-harness/src/index.ts.tmpl +1 -1
  262. package/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +1 -1
  263. package/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +1 -1
  264. package/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +1 -1
  265. package/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +1 -1
  266. package/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +1 -1
  267. package/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +1 -1
  268. package/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +1 -1
  269. package/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +1 -1
  270. package/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +1 -1
  271. package/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +1 -1
  272. package/templates/harnesses/evaluator/package.json.tmpl +1 -1
  273. package/templates/harnesses/evaluator/src/index.ts.tmpl +1 -1
  274. package/templates/harnesses/evaluator/test/unit.test.ts.tmpl +1 -1
  275. package/templates/harnesses/forecaster/package.json.tmpl +1 -1
  276. package/templates/harnesses/forecaster/src/index.ts.tmpl +1 -1
  277. package/templates/harnesses/forecaster/test/unit.test.ts.tmpl +1 -1
  278. package/dist/adapters/claim-registry/abi.d.ts +0 -127
  279. package/dist/adapters/claim-registry/abi.js +0 -93
  280. package/dist/adapters/claim-registry/abi.js.map +0 -1
  281. package/dist/adapters/claim-registry/client.d.ts +0 -98
  282. package/dist/adapters/claim-registry/client.js +0 -225
  283. package/dist/adapters/claim-registry/client.js.map +0 -1
  284. package/dist/adapters/mech/claim-policy.d.ts +0 -40
  285. package/dist/adapters/mech/claim-policy.js +0 -104
  286. package/dist/adapters/mech/claim-policy.js.map +0 -1
  287. package/dist/harnesses/engine/claim.d.ts +0 -69
  288. package/dist/harnesses/engine/claim.js +0 -111
  289. package/dist/harnesses/engine/claim.js.map +0 -1
@@ -4,7 +4,7 @@ import { createMockHarness } from '../src/mock-harness.js';
4
4
  import type {
5
5
  ExternalHarnessEnv,
6
6
  HarnessContext,
7
- } from '@jinn-network/harness-sdk';
7
+ } from '@jinn-network/sdk/harness';
8
8
  import type { HarnessAdapter, HarnessPromptArgs } from '../src/harness.js';
9
9
 
10
10
  const env: ExternalHarnessEnv = {
@@ -3,7 +3,7 @@ import createHarness from '../src/index.js';
3
3
  import type {
4
4
  ExternalHarnessEnv,
5
5
  HarnessContext,
6
- } from '@jinn-network/harness-sdk';
6
+ } from '@jinn-network/sdk/harness';
7
7
 
8
8
  const env: ExternalHarnessEnv = {
9
9
  implName: '{{packageName}}',
@@ -17,7 +17,7 @@
17
17
  "test": "vitest run"
18
18
  },
19
19
  "dependencies": {
20
- "@jinn-network/harness-sdk": "^1.0.0"
20
+ "@jinn-network/sdk": "^0.1.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^5.4.0",
@@ -3,7 +3,7 @@ import type {
3
3
  ExternalHarnessEnv,
4
4
  HarnessContext,
5
5
  Solution,
6
- } from '@jinn-network/harness-sdk';
6
+ } from '@jinn-network/sdk/harness';
7
7
 
8
8
  export default function createEvaluator(env: ExternalHarnessEnv): Harness {
9
9
  return {
@@ -3,7 +3,7 @@ import createEvaluator from '../src/index.js';
3
3
  import type {
4
4
  ExternalHarnessEnv,
5
5
  HarnessContext,
6
- } from '@jinn-network/harness-sdk';
6
+ } from '@jinn-network/sdk/harness';
7
7
 
8
8
  const env: ExternalHarnessEnv = {
9
9
  implName: '{{packageName}}',
@@ -17,7 +17,7 @@
17
17
  "test": "vitest run"
18
18
  },
19
19
  "dependencies": {
20
- "@jinn-network/harness-sdk": "^1.0.0"
20
+ "@jinn-network/sdk": "^0.1.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^5.4.0",
@@ -3,7 +3,7 @@ import type {
3
3
  ExternalHarnessEnv,
4
4
  HarnessContext,
5
5
  Solution,
6
- } from '@jinn-network/harness-sdk';
6
+ } from '@jinn-network/sdk/harness';
7
7
 
8
8
  export default function createHarness(env: ExternalHarnessEnv): Harness {
9
9
  return {
@@ -3,7 +3,7 @@ import createHarness from '../src/index.js';
3
3
  import type {
4
4
  ExternalHarnessEnv,
5
5
  HarnessContext,
6
- } from '@jinn-network/harness-sdk';
6
+ } from '@jinn-network/sdk/harness';
7
7
 
8
8
  const env: ExternalHarnessEnv = {
9
9
  implName: '{{packageName}}',
@@ -1,127 +0,0 @@
1
- /**
2
- * Typed ABI fragments for ClaimRegistry.
3
- *
4
- * Mirrors the Solidity interface in contracts/src/claiming/ClaimRegistry.sol.
5
- * Use these instead of the inline fragment in adapters/mech/types.ts when
6
- * constructing a ClaimRegistryClient — they include the full event set.
7
- */
8
- export declare const CLAIM_REGISTRY_ABI: readonly [{
9
- readonly name: "claimJob";
10
- readonly type: "function";
11
- readonly stateMutability: "nonpayable";
12
- readonly inputs: readonly [{
13
- readonly name: "requestId";
14
- readonly type: "bytes32";
15
- }];
16
- readonly outputs: readonly [];
17
- }, {
18
- readonly name: "releaseClaim";
19
- readonly type: "function";
20
- readonly stateMutability: "nonpayable";
21
- readonly inputs: readonly [{
22
- readonly name: "requestId";
23
- readonly type: "bytes32";
24
- }];
25
- readonly outputs: readonly [];
26
- }, {
27
- readonly name: "expireClaim";
28
- readonly type: "function";
29
- readonly stateMutability: "nonpayable";
30
- readonly inputs: readonly [{
31
- readonly name: "requestId";
32
- readonly type: "bytes32";
33
- }];
34
- readonly outputs: readonly [];
35
- }, {
36
- readonly name: "getJobClaim";
37
- readonly type: "function";
38
- readonly stateMutability: "view";
39
- readonly inputs: readonly [{
40
- readonly name: "requestId";
41
- readonly type: "bytes32";
42
- }];
43
- readonly outputs: readonly [{
44
- readonly name: "claimer";
45
- readonly type: "address";
46
- }, {
47
- readonly name: "expiresAt";
48
- readonly type: "uint256";
49
- }];
50
- }, {
51
- readonly name: "claims";
52
- readonly type: "function";
53
- readonly stateMutability: "view";
54
- readonly inputs: readonly [{
55
- readonly name: "";
56
- readonly type: "bytes32";
57
- }];
58
- readonly outputs: readonly [{
59
- readonly name: "claimer";
60
- readonly type: "address";
61
- }, {
62
- readonly name: "expiresAt";
63
- readonly type: "uint256";
64
- }];
65
- }, {
66
- readonly name: "claimTTL";
67
- readonly type: "function";
68
- readonly stateMutability: "view";
69
- readonly inputs: readonly [];
70
- readonly outputs: readonly [{
71
- readonly name: "";
72
- readonly type: "uint256";
73
- }];
74
- }, {
75
- readonly name: "expiredClaimCount";
76
- readonly type: "function";
77
- readonly stateMutability: "view";
78
- readonly inputs: readonly [{
79
- readonly name: "";
80
- readonly type: "address";
81
- }];
82
- readonly outputs: readonly [{
83
- readonly name: "";
84
- readonly type: "uint256";
85
- }];
86
- }, {
87
- readonly name: "JobClaimed";
88
- readonly type: "event";
89
- readonly inputs: readonly [{
90
- readonly name: "requestId";
91
- readonly type: "bytes32";
92
- readonly indexed: true;
93
- }, {
94
- readonly name: "claimer";
95
- readonly type: "address";
96
- readonly indexed: true;
97
- }, {
98
- readonly name: "expiresAt";
99
- readonly type: "uint256";
100
- readonly indexed: false;
101
- }];
102
- }, {
103
- readonly name: "ClaimExpired";
104
- readonly type: "event";
105
- readonly inputs: readonly [{
106
- readonly name: "requestId";
107
- readonly type: "bytes32";
108
- readonly indexed: true;
109
- }, {
110
- readonly name: "previousClaimer";
111
- readonly type: "address";
112
- readonly indexed: true;
113
- }];
114
- }, {
115
- readonly name: "ClaimReleased";
116
- readonly type: "event";
117
- readonly inputs: readonly [{
118
- readonly name: "requestId";
119
- readonly type: "bytes32";
120
- readonly indexed: true;
121
- }, {
122
- readonly name: "claimer";
123
- readonly type: "address";
124
- readonly indexed: true;
125
- }];
126
- }];
127
- export type ClaimRegistryAbi = typeof CLAIM_REGISTRY_ABI;
@@ -1,93 +0,0 @@
1
- /**
2
- * Typed ABI fragments for ClaimRegistry.
3
- *
4
- * Mirrors the Solidity interface in contracts/src/claiming/ClaimRegistry.sol.
5
- * Use these instead of the inline fragment in adapters/mech/types.ts when
6
- * constructing a ClaimRegistryClient — they include the full event set.
7
- */
8
- export const CLAIM_REGISTRY_ABI = [
9
- // ── Write functions ──────────────────────────────────────────────────────────
10
- {
11
- name: 'claimJob',
12
- type: 'function',
13
- stateMutability: 'nonpayable',
14
- inputs: [{ name: 'requestId', type: 'bytes32' }],
15
- outputs: [],
16
- },
17
- {
18
- name: 'releaseClaim',
19
- type: 'function',
20
- stateMutability: 'nonpayable',
21
- inputs: [{ name: 'requestId', type: 'bytes32' }],
22
- outputs: [],
23
- },
24
- {
25
- name: 'expireClaim',
26
- type: 'function',
27
- stateMutability: 'nonpayable',
28
- inputs: [{ name: 'requestId', type: 'bytes32' }],
29
- outputs: [],
30
- },
31
- // ── Read functions ───────────────────────────────────────────────────────────
32
- {
33
- name: 'getJobClaim',
34
- type: 'function',
35
- stateMutability: 'view',
36
- inputs: [{ name: 'requestId', type: 'bytes32' }],
37
- outputs: [
38
- { name: 'claimer', type: 'address' },
39
- { name: 'expiresAt', type: 'uint256' },
40
- ],
41
- },
42
- {
43
- name: 'claims',
44
- type: 'function',
45
- stateMutability: 'view',
46
- inputs: [{ name: '', type: 'bytes32' }],
47
- outputs: [
48
- { name: 'claimer', type: 'address' },
49
- { name: 'expiresAt', type: 'uint256' },
50
- ],
51
- },
52
- {
53
- name: 'claimTTL',
54
- type: 'function',
55
- stateMutability: 'view',
56
- inputs: [],
57
- outputs: [{ name: '', type: 'uint256' }],
58
- },
59
- {
60
- name: 'expiredClaimCount',
61
- type: 'function',
62
- stateMutability: 'view',
63
- inputs: [{ name: '', type: 'address' }],
64
- outputs: [{ name: '', type: 'uint256' }],
65
- },
66
- // ── Events ───────────────────────────────────────────────────────────────────
67
- {
68
- name: 'JobClaimed',
69
- type: 'event',
70
- inputs: [
71
- { name: 'requestId', type: 'bytes32', indexed: true },
72
- { name: 'claimer', type: 'address', indexed: true },
73
- { name: 'expiresAt', type: 'uint256', indexed: false },
74
- ],
75
- },
76
- {
77
- name: 'ClaimExpired',
78
- type: 'event',
79
- inputs: [
80
- { name: 'requestId', type: 'bytes32', indexed: true },
81
- { name: 'previousClaimer', type: 'address', indexed: true },
82
- ],
83
- },
84
- {
85
- name: 'ClaimReleased',
86
- type: 'event',
87
- inputs: [
88
- { name: 'requestId', type: 'bytes32', indexed: true },
89
- { name: 'claimer', type: 'address', indexed: true },
90
- ],
91
- },
92
- ];
93
- //# sourceMappingURL=abi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abi.js","sourceRoot":"","sources":["../../../src/adapters/claim-registry/abi.ts"],"names":[],"mappings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,EAAE;YACrD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;SACpD;KACF;CACO,CAAC"}
@@ -1,98 +0,0 @@
1
- /**
2
- * ClaimRegistryClient — typed wrapper for the ClaimRegistry contract.
3
- *
4
- * Wraps the read/write surfaces of ClaimRegistry with proper types and
5
- * idiomatic async interfaces.
6
- *
7
- * Write operations (claimJob, releaseClaim) go through the Safe multisig via
8
- * executeSafeTransaction. This is required so that the on-chain claimer address
9
- * matches the Safe — our canonical OLAS/staking identity. Using the raw EOA
10
- * would cause a mismatch: OnChainClaimPolicy already claims through the Safe,
11
- * so `weAlreadyClaimed()` would return false even when the Safe holds the claim,
12
- * triggering a redundant on-chain write that reverts as JobAlreadyClaimed.
13
- *
14
- * expireClaim() is permissionless (anyone can GC others' expired claims) and
15
- * is kept as a direct EOA call — the gas payer does not affect claim ownership.
16
- */
17
- import { type Address, type Hex, type PublicClient, type WalletClient } from 'viem';
18
- export declare const ZERO_ADDRESS: Address;
19
- export interface JobClaimInfo {
20
- claimer: Address;
21
- /** Unix timestamp (seconds) when the claim expires. 0 if no active claim. */
22
- expiresAt: bigint;
23
- /** True if claimer !== ZERO_ADDRESS and expiresAt > 0 (claim is still active per contract). */
24
- isActive: boolean;
25
- }
26
- export interface ClaimJobResult {
27
- /** Transaction hash. Empty string when skipped (already ours or failed). */
28
- txHash: string;
29
- /** True if we now hold the claim (new or pre-existing). */
30
- claimed: boolean;
31
- /**
32
- * Set when claimed=false. Disambiguates between:
33
- * - 'lost-race': another operator holds the claim (decoded from JobAlreadyClaimed)
34
- * - 'ineligible': eligibility checker rejected
35
- * - 'reverted': tx reverted for an unknown reason
36
- */
37
- reason?: 'lost-race' | 'ineligible' | 'reverted';
38
- /** When reason='lost-race', the address that won the race (if recoverable). */
39
- competitor?: Address;
40
- }
41
- export declare class ClaimRegistryClient {
42
- private readonly publicClient;
43
- private readonly walletClient;
44
- private readonly contractAddress;
45
- /**
46
- * The Safe multisig address — used as the canonical claimer identity.
47
- * claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
48
- * is the Safe address, matching the OLAS staking identity.
49
- */
50
- private readonly safeAddress;
51
- constructor(publicClient: PublicClient, walletClient: WalletClient, contractAddress: Address,
52
- /**
53
- * The Safe multisig address — used as the canonical claimer identity.
54
- * claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
55
- * is the Safe address, matching the OLAS staking identity.
56
- */
57
- safeAddress: Address);
58
- /**
59
- * Read the active claim for a request.
60
- * Returns `(ZERO_ADDRESS, 0, false)` if no active claim (contract returns
61
- * (address(0), 0) for expired/non-existent claims).
62
- */
63
- getJobClaim(requestId: Hex): Promise<JobClaimInfo>;
64
- /**
65
- * Check whether the Safe already holds an active claim for this request.
66
- * Used for idempotency on resume.
67
- */
68
- weAlreadyClaimed(requestId: Hex): Promise<boolean>;
69
- /**
70
- * Claim a marketplace request through the Safe multisig.
71
- *
72
- * Idempotent: if the Safe already holds an active claim, returns
73
- * `{ txHash: '', claimed: true }` without submitting a transaction.
74
- *
75
- * Returns `{ txHash: '', claimed: false }` when:
76
- * - Another address holds an active claim
77
- * - The eligibility check fails (IneligibleToClaim)
78
- * - The tx reverts for any other handled reason
79
- *
80
- * Throws on unrecognised RPC errors.
81
- */
82
- claimJob(requestId: Hex): Promise<ClaimJobResult>;
83
- /**
84
- * Voluntarily release a claim through the Safe multisig (no punishment).
85
- * Should only be called when the Safe holds the claim.
86
- * No-op (returns false) if the Safe doesn't hold the claim.
87
- */
88
- releaseClaim(requestId: Hex): Promise<boolean>;
89
- /**
90
- * Garbage-collect a stale (expired) claim.
91
- *
92
- * expireClaim is permissionless — anyone can call it to GC others' expired
93
- * claims. The caller gets no reward; the previous claimer gets an
94
- * expiredClaimCount increment. Since the gas payer doesn't affect claim
95
- * ownership, this is sent directly from the EOA (cheaper than a Safe tx).
96
- */
97
- expireClaim(requestId: Hex): Promise<boolean>;
98
- }
@@ -1,225 +0,0 @@
1
- /**
2
- * ClaimRegistryClient — typed wrapper for the ClaimRegistry contract.
3
- *
4
- * Wraps the read/write surfaces of ClaimRegistry with proper types and
5
- * idiomatic async interfaces.
6
- *
7
- * Write operations (claimJob, releaseClaim) go through the Safe multisig via
8
- * executeSafeTransaction. This is required so that the on-chain claimer address
9
- * matches the Safe — our canonical OLAS/staking identity. Using the raw EOA
10
- * would cause a mismatch: OnChainClaimPolicy already claims through the Safe,
11
- * so `weAlreadyClaimed()` would return false even when the Safe holds the claim,
12
- * triggering a redundant on-chain write that reverts as JobAlreadyClaimed.
13
- *
14
- * expireClaim() is permissionless (anyone can GC others' expired claims) and
15
- * is kept as a direct EOA call — the gas payer does not affect claim ownership.
16
- */
17
- import { encodeFunctionData, } from 'viem';
18
- import { CLAIM_REGISTRY_ABI } from './abi.js';
19
- import { executeSafeTransaction } from '../mech/safe.js';
20
- import { SafeInnerRevertError } from '../mech/safe-revert.js';
21
- import { waitForTransactionReceiptWithRetry } from '../../tx-retry.js';
22
- export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
23
- // ── ClaimRegistryClient ───────────────────────────────────────────────────────
24
- export class ClaimRegistryClient {
25
- publicClient;
26
- walletClient;
27
- contractAddress;
28
- safeAddress;
29
- constructor(publicClient, walletClient, contractAddress,
30
- /**
31
- * The Safe multisig address — used as the canonical claimer identity.
32
- * claimJob/releaseClaim are routed through Safe so that msg.sender on-chain
33
- * is the Safe address, matching the OLAS staking identity.
34
- */
35
- safeAddress) {
36
- this.publicClient = publicClient;
37
- this.walletClient = walletClient;
38
- this.contractAddress = contractAddress;
39
- this.safeAddress = safeAddress;
40
- }
41
- // ── Read methods ─────────────────────────────────────────────────────────────
42
- /**
43
- * Read the active claim for a request.
44
- * Returns `(ZERO_ADDRESS, 0, false)` if no active claim (contract returns
45
- * (address(0), 0) for expired/non-existent claims).
46
- */
47
- async getJobClaim(requestId) {
48
- const result = await this.publicClient.readContract({
49
- address: this.contractAddress,
50
- abi: CLAIM_REGISTRY_ABI,
51
- functionName: 'getJobClaim',
52
- args: [requestId],
53
- });
54
- const claimer = result[0];
55
- const expiresAt = result[1];
56
- return {
57
- claimer,
58
- expiresAt,
59
- isActive: claimer !== ZERO_ADDRESS && expiresAt > 0n,
60
- };
61
- }
62
- /**
63
- * Check whether the Safe already holds an active claim for this request.
64
- * Used for idempotency on resume.
65
- */
66
- async weAlreadyClaimed(requestId) {
67
- const info = await this.getJobClaim(requestId);
68
- return (info.isActive &&
69
- info.claimer.toLowerCase() === this.safeAddress.toLowerCase());
70
- }
71
- // ── Write methods ─────────────────────────────────────────────────────────────
72
- /**
73
- * Claim a marketplace request through the Safe multisig.
74
- *
75
- * Idempotent: if the Safe already holds an active claim, returns
76
- * `{ txHash: '', claimed: true }` without submitting a transaction.
77
- *
78
- * Returns `{ txHash: '', claimed: false }` when:
79
- * - Another address holds an active claim
80
- * - The eligibility check fails (IneligibleToClaim)
81
- * - The tx reverts for any other handled reason
82
- *
83
- * Throws on unrecognised RPC errors.
84
- */
85
- async claimJob(requestId) {
86
- // Idempotency: already claimed by our Safe
87
- const existing = await this.getJobClaim(requestId);
88
- if (existing.isActive) {
89
- if (existing.claimer.toLowerCase() === this.safeAddress.toLowerCase()) {
90
- return { txHash: '', claimed: true };
91
- }
92
- // Someone else has an active claim
93
- return { txHash: '', claimed: false, reason: 'lost-race', competitor: existing.claimer };
94
- }
95
- const data = encodeFunctionData({
96
- abi: CLAIM_REGISTRY_ABI,
97
- functionName: 'claimJob',
98
- args: [requestId],
99
- });
100
- try {
101
- const txHash = await executeSafeTransaction(this.publicClient, this.walletClient, {
102
- safeAddress: this.safeAddress,
103
- to: this.contractAddress,
104
- value: 0n,
105
- data,
106
- });
107
- // executeSafeTransaction waits for the receipt internally, but does not
108
- // inspect its status. Wait again with full retry and throw if reverted so
109
- // callers don't see a false-positive claimed=true on a reverted claim.
110
- const receipt = await waitForTransactionReceiptWithRetry(this.publicClient, txHash, {
111
- onRetry: ({ attempt, message }) => {
112
- console.error(`[claim-registry] wait claimJob receipt retry ${attempt}: ${message}`);
113
- },
114
- });
115
- if (receipt.status !== 'success') {
116
- throw new Error(`claimJob transaction reverted (status=${receipt.status}, txHash=${txHash})`);
117
- }
118
- return { txHash, claimed: true };
119
- }
120
- catch (err) {
121
- // Decoded inner revert from Safe's GS013 wrapper — the actual on-chain
122
- // failure cause is now legible.
123
- if (err instanceof SafeInnerRevertError) {
124
- if (err.decodedName === 'JobAlreadyClaimed') {
125
- const competitor = err.decodedArgs?.[1];
126
- // RPC eventual-consistency case: a prior attempt's tx mined but
127
- // the daemon retried (e.g. waitForTransactionReceipt timed out),
128
- // and the retry's gas-estimate reverts because the Safe already
129
- // holds the claim. Treat as success.
130
- if (competitor && competitor.toLowerCase() === this.safeAddress.toLowerCase()) {
131
- return { txHash: '', claimed: true };
132
- }
133
- return { txHash: '', claimed: false, reason: 'lost-race', competitor };
134
- }
135
- if (err.decodedName === 'IneligibleToClaim') {
136
- return { txHash: '', claimed: false, reason: 'ineligible' };
137
- }
138
- return { txHash: '', claimed: false, reason: 'reverted' };
139
- }
140
- const message = err instanceof Error ? err.message : String(err);
141
- if (message.includes('JobAlreadyClaimed') ||
142
- message.includes('IneligibleToClaim') ||
143
- message.includes('execution reverted')) {
144
- return { txHash: '', claimed: false, reason: 'reverted' };
145
- }
146
- throw err;
147
- }
148
- }
149
- /**
150
- * Voluntarily release a claim through the Safe multisig (no punishment).
151
- * Should only be called when the Safe holds the claim.
152
- * No-op (returns false) if the Safe doesn't hold the claim.
153
- */
154
- async releaseClaim(requestId) {
155
- // Verify the Safe holds the claim before sending a tx that would revert
156
- const existing = await this.getJobClaim(requestId);
157
- if (!existing.isActive ||
158
- existing.claimer.toLowerCase() !== this.safeAddress.toLowerCase()) {
159
- return false;
160
- }
161
- const data = encodeFunctionData({
162
- abi: CLAIM_REGISTRY_ABI,
163
- functionName: 'releaseClaim',
164
- args: [requestId],
165
- });
166
- try {
167
- await executeSafeTransaction(this.publicClient, this.walletClient, {
168
- safeAddress: this.safeAddress,
169
- to: this.contractAddress,
170
- value: 0n,
171
- data,
172
- });
173
- return true;
174
- }
175
- catch (err) {
176
- const message = err instanceof Error ? err.message : String(err);
177
- // NotClaimOwner or NoClaimExists — claim was already gone
178
- if (message.includes('NotClaimOwner') || message.includes('NoClaimExists')) {
179
- return false;
180
- }
181
- throw err;
182
- }
183
- }
184
- /**
185
- * Garbage-collect a stale (expired) claim.
186
- *
187
- * expireClaim is permissionless — anyone can call it to GC others' expired
188
- * claims. The caller gets no reward; the previous claimer gets an
189
- * expiredClaimCount increment. Since the gas payer doesn't affect claim
190
- * ownership, this is sent directly from the EOA (cheaper than a Safe tx).
191
- */
192
- async expireClaim(requestId) {
193
- const account = this.walletClient.account;
194
- if (!account)
195
- throw new Error('[ClaimRegistryClient] walletClient has no account');
196
- const data = encodeFunctionData({
197
- abi: CLAIM_REGISTRY_ABI,
198
- functionName: 'expireClaim',
199
- args: [requestId],
200
- });
201
- try {
202
- const txHash = await this.walletClient.sendTransaction({
203
- account,
204
- chain: null,
205
- to: this.contractAddress,
206
- data,
207
- value: 0n,
208
- });
209
- await waitForTransactionReceiptWithRetry(this.publicClient, txHash, {
210
- onRetry: ({ attempt, message }) => {
211
- console.error(`[claim-registry] wait expireClaim receipt retry ${attempt}: ${message}`);
212
- },
213
- });
214
- return true;
215
- }
216
- catch (err) {
217
- const message = err instanceof Error ? err.message : String(err);
218
- if (message.includes('NoClaimExists') || message.includes('ClaimNotExpired')) {
219
- return false;
220
- }
221
- throw err;
222
- }
223
- }
224
- }
225
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/adapters/claim-registry/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,kBAAkB,GAKnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,i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