@tetsuo-ai/marketplace-react 0.4.0 → 0.5.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +93 -47
  3. package/dist/chunk-7NKRSPPN.js +227 -0
  4. package/dist/chunk-7NKRSPPN.js.map +1 -0
  5. package/dist/{chunk-BNILOX3O.js → chunk-CDDHUFMG.js} +38 -6
  6. package/dist/chunk-CDDHUFMG.js.map +1 -0
  7. package/dist/chunk-FIDFPM5A.cjs +40 -0
  8. package/dist/chunk-FIDFPM5A.cjs.map +1 -0
  9. package/dist/chunk-IJKWKY4H.cjs +1370 -0
  10. package/dist/chunk-IJKWKY4H.cjs.map +1 -0
  11. package/dist/chunk-JTSG5FGC.cjs +397 -0
  12. package/dist/chunk-JTSG5FGC.cjs.map +1 -0
  13. package/dist/chunk-ONC6L3IX.cjs +97 -0
  14. package/dist/chunk-ONC6L3IX.cjs.map +1 -0
  15. package/dist/chunk-R76EUYDI.cjs +233 -0
  16. package/dist/chunk-R76EUYDI.cjs.map +1 -0
  17. package/dist/chunk-RG5JZ6JL.js +378 -0
  18. package/dist/chunk-RG5JZ6JL.js.map +1 -0
  19. package/dist/components/index.cjs +158 -1513
  20. package/dist/components/index.cjs.map +1 -1
  21. package/dist/components/index.d.cts +2 -2
  22. package/dist/components/index.d.ts +2 -2
  23. package/dist/components/index.js +2 -2
  24. package/dist/hooks/index.cjs +693 -457
  25. package/dist/hooks/index.cjs.map +1 -1
  26. package/dist/hooks/index.d.cts +109 -28
  27. package/dist/hooks/index.d.ts +109 -28
  28. package/dist/hooks/index.js +659 -178
  29. package/dist/hooks/index.js.map +1 -1
  30. package/dist/{index-DQ3Xovkq.d.ts → index-BAyr1ODZ.d.ts} +76 -6
  31. package/dist/{index-UxuvIlmD.d.cts → index-C20NVU7_.d.cts} +76 -6
  32. package/dist/index.cjs +284 -1752
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +7 -8
  35. package/dist/index.d.ts +7 -8
  36. package/dist/index.js +64 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/signers/index.cjs +22 -161
  39. package/dist/signers/index.cjs.map +1 -1
  40. package/dist/signers/index.d.cts +16 -11
  41. package/dist/signers/index.d.ts +16 -11
  42. package/dist/signers/index.js +1 -1
  43. package/dist/testing/index.d.cts +1 -1
  44. package/dist/testing/index.d.ts +1 -1
  45. package/dist/theme/agenc-tailwind-preset.cjs +134 -108
  46. package/dist/{types-jvISR6bc.d.cts → types-B10rndEI.d.cts} +16 -7
  47. package/dist/{types-jvISR6bc.d.ts → types-B10rndEI.d.ts} +16 -7
  48. package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-Ch7gHTFj.d.cts} +40 -3
  49. package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-Ch7gHTFj.d.ts} +40 -3
  50. package/package.json +6 -3
  51. package/src/components/GuaranteedBadge.tsx +73 -0
  52. package/src/components/HireCheckoutModal.tsx +5 -2
  53. package/src/components/index.ts +4 -0
  54. package/src/components/strings.ts +8 -0
  55. package/src/hooks/index.ts +14 -0
  56. package/src/hooks/internal.ts +179 -22
  57. package/src/hooks/useAgentTrackRecord.ts +5 -2
  58. package/src/hooks/useCompletionBond.ts +191 -0
  59. package/src/hooks/useDispute.ts +46 -9
  60. package/src/hooks/useHire.ts +113 -23
  61. package/src/hooks/useHumanlessHireFlow.ts +335 -115
  62. package/src/hooks/useListing.ts +2 -2
  63. package/src/hooks/useListings.ts +2 -2
  64. package/src/hooks/useRateHire.ts +32 -5
  65. package/src/hooks/useReferrerEarnings.ts +4 -1
  66. package/src/hooks/useSubmissionReview.ts +95 -32
  67. package/src/hooks/useTaskActivation.ts +51 -9
  68. package/src/hooks/useTaskGuarantee.ts +123 -0
  69. package/src/hooks/useTaskLifecycle.ts +104 -24
  70. package/src/hooks/useTaskStatus.ts +121 -26
  71. package/src/hooks/useTaskWork.ts +76 -12
  72. package/src/hooks/useWalletSigner.ts +11 -16
  73. package/src/index.ts +5 -0
  74. package/src/provider/AgencProvider.tsx +95 -3
  75. package/src/provider/referrer.ts +1 -1
  76. package/src/signers/README.md +13 -7
  77. package/src/signers/index.ts +6 -1
  78. package/src/signers/strings.ts +13 -1
  79. package/src/signers/types.ts +16 -5
  80. package/src/signers/wallet-account.ts +115 -29
  81. package/src/signers/wallet-adapter.ts +38 -4
  82. package/src/theme/agenc-tailwind-preset.cjs +134 -108
  83. package/src/types.ts +32 -3
  84. package/dist/chunk-BNILOX3O.js.map +0 -1
  85. package/dist/chunk-BTAVED7S.js +0 -226
  86. package/dist/chunk-BTAVED7S.js.map +0 -1
  87. package/dist/chunk-ON6XR4XO.js +0 -128
  88. package/dist/chunk-ON6XR4XO.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
1
+ import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade, HireAndActivateProgress } from '@tetsuo-ai/marketplace-sdk';
2
2
  import { Address, TransactionSigner } from '@solana/kit';
3
- import { H as HumanlessHireInput } from '../useAgentTrackRecord-BCvRHYM2.cjs';
4
- export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions, j as UseAgentTrackRecordResult, k as UseDisputeOptions, l as UseDisputeResult, m as UseHireResult, n as UseSubmissionReviewResult, p as projectTrackRecord, u as useAgentTrackRecord, o as useDispute, q as useHire, r as useSubmissionReview } from '../useAgentTrackRecord-BCvRHYM2.cjs';
3
+ import { H as HumanlessHireInput } from '../useAgentTrackRecord-Ch7gHTFj.cjs';
4
+ export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TaskGuaranteeReader, j as TrackRecordOutcome, U as UseAgentTrackRecordOptions, k as UseAgentTrackRecordResult, l as UseDisputeOptions, m as UseDisputeResult, n as UseHireResult, o as UseSubmissionReviewResult, p as UseTaskGuaranteeOptions, q as UseTaskGuaranteeResult, r as projectTrackRecord, u as useAgentTrackRecord, s as useDispute, t as useHire, v as useSubmissionReview, w as useTaskGuarantee } from '../useAgentTrackRecord-Ch7gHTFj.cjs';
5
5
 
6
6
  /** A decoded active listing row (address + decoded account). */
7
7
  type ListingRow = DecodedProgramAccount<ServiceListing>;
@@ -112,11 +112,24 @@ type TaskReader = (pda: Address | string) => Promise<Task | null>;
112
112
  */
113
113
  type ObservedEvent = unknown;
114
114
  /**
115
- * An async source of coordination events for the watched task. Pass the result
116
- * of the SDK's `subscribeMarketplaceEvents(...)` (already address-filtered) or
117
- * any async iterable. Optional.
115
+ * Original coordination-event stream API.
116
+ *
117
+ * @deprecated Prefer {@link TaskEventsSourceFactory}. A pre-created iterable
118
+ * cannot pass this hook's abort signal into its subscription transport. Legacy
119
+ * streams remain cancellation-safe at the iterator boundary through an abort
120
+ * race and best-effort `iterator.return()` cleanup.
118
121
  */
119
122
  type TaskEventsSource = AsyncIterable<ObservedEvent>;
123
+ /**
124
+ * Abort-aware coordination-event factory. Implementations should pass the
125
+ * signal to their subscription transport. The task identity lets a factory
126
+ * construct an address-filtered stream. This form is preferred over the
127
+ * deprecated pre-created {@link TaskEventsSource}.
128
+ */
129
+ type TaskEventsSourceFactory = (options: {
130
+ signal: AbortSignal;
131
+ taskPda: Address | string;
132
+ }) => AsyncIterable<ObservedEvent>;
120
133
  /** Options for {@link useTaskStatus}. */
121
134
  interface UseTaskStatusOptions {
122
135
  /**
@@ -125,17 +138,24 @@ interface UseTaskStatusOptions {
125
138
  */
126
139
  taskReader?: TaskReader;
127
140
  /**
128
- * Optional event source. When given, observed events are appended to
129
- * `events` and each triggers a refetch. Drained in a browser-only effect and
130
- * aborted on unmount.
141
+ * Optional event stream. Prefer an abort-aware factory; the deprecated
142
+ * pre-created AsyncIterable form remains supported for compatibility. Each
143
+ * event triggers a refetch.
131
144
  */
132
- events?: TaskEventsSource;
145
+ events?: TaskEventsSourceFactory | TaskEventsSource;
146
+ /** Maximum recent events retained in memory (default `256`). */
147
+ maxEvents?: number;
133
148
  /**
134
149
  * Stop polling once the task reaches this status (in addition to terminal
135
150
  * statuses). Useful to await a specific transition (e.g. `Completed`).
136
151
  */
137
152
  targetStatus?: TaskStatus;
138
- /** Poll interval in ms while non-terminal. Default `2000`. */
153
+ /**
154
+ * Poll interval in ms while non-terminal. Default `2000`.
155
+ *
156
+ * Must be a non-negative integer no greater than `2_147_483_647`, the
157
+ * maximum portable JavaScript timer delay; invalid values throw RangeError.
158
+ */
139
159
  pollIntervalMs?: number;
140
160
  /** Disable the hook entirely. Default `true` when `taskPda` + reader exist. */
141
161
  enabled?: boolean;
@@ -174,8 +194,9 @@ declare function useTaskStatus(taskPda: Address | string | undefined | null, opt
174
194
  declare const QUERY_KEY_ROOT: "agenc";
175
195
  /**
176
196
  * Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
177
- * this factory so a consumer (or a hook) can invalidate a whole sub-tree
178
- * (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
197
+ * this factory so a consumer (or a hook) can invalidate a deployment sub-tree
198
+ * (`["agenc", namespace, "listings"]`) or one entity
199
+ * (`["agenc", namespace, "listing", pda]`).
179
200
  *
180
201
  * `JSON.stringify` is intentionally NOT used — TanStack compares keys
181
202
  * structurally, so passing the raw filter object keeps equality correct for
@@ -183,17 +204,19 @@ declare const QUERY_KEY_ROOT: "agenc";
183
204
  */
184
205
  declare const queryKeys: {
185
206
  /** All listings list queries (with their filter object as the leaf). */
186
- readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
207
+ readonly listings: (filter?: unknown, cacheNamespace?: string) => readonly ["agenc", string, "listings", {} | null];
187
208
  /** One listing + its joined provider/track-record/moderation. */
188
- readonly listing: (pda: string) => readonly ["agenc", "listing", string];
209
+ readonly listing: (pda: string, cacheNamespace?: string) => readonly ["agenc", string, "listing", string];
189
210
  /** One agent's indexer track record. */
190
- readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
211
+ readonly agentTrackRecord: (agentPda: string, cacheNamespace?: string) => readonly ["agenc", string, "agentTrackRecord", string];
191
212
  /** One task's status (read via transport / svm decode). */
192
- readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
213
+ readonly taskStatus: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "taskStatus", string];
193
214
  /** One task's dispute record. */
194
- readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
215
+ readonly dispute: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "dispute", string];
216
+ /** One task's completion-bond ("Guaranteed Hire") state. */
217
+ readonly taskGuarantee: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "taskGuarantee", string];
195
218
  /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
196
- readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
219
+ readonly referrerEarnings: (wallet: string, cacheNamespace?: string) => readonly ["agenc", string, "referrerEarnings", string];
197
220
  };
198
221
  type MutationStatus = "idle" | "pending" | "success" | "error";
199
222
 
@@ -213,7 +236,10 @@ declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobS
213
236
 
214
237
  type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
215
238
  type HumanlessHireFlowStatus = MutationStatus;
216
- type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
239
+ type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps" | "listingSpecHash"> & {
240
+ /** Exact non-zero listing commitment required by durable SDK recovery. */
241
+ listingSpecHash: NonNullable<HumanlessHireInput["listingSpecHash"]>;
242
+ };
217
243
  type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri" | "moderator"> & {
218
244
  /**
219
245
  * Override the activation `moderator` (P1.2). Defaults to the `moderator`
@@ -222,7 +248,7 @@ type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "j
222
248
  */
223
249
  moderator?: TaskActivationInput["moderator"];
224
250
  };
225
- type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
251
+ type HumanlessHireFlowCreator = NonNullable<HumanlessHireInput["creator"]>;
226
252
  type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
227
253
  interface HumanlessHireFlowModerationResult {
228
254
  jobSpecHash: HumanlessHireFlowJobSpecHash;
@@ -242,6 +268,8 @@ interface HumanlessHireFlowHostInput<TJobSpec> {
242
268
  listing: HumanlessHireFlowHireInput["listing"];
243
269
  jobSpec: TJobSpec;
244
270
  hireSignature: string;
271
+ /** True when finalized account state, rather than a wire response, proved the hire. */
272
+ hireReconciled?: boolean;
245
273
  referrerInjected: boolean;
246
274
  }
247
275
  type HumanlessHireFlowHost<TJobSpec> = (input: HumanlessHireFlowHostInput<TJobSpec>) => Promise<HumanlessHireFlowModerationResult>;
@@ -259,6 +287,12 @@ interface HumanlessHireFlowProgress {
259
287
  jobSpecHash: HumanlessHireFlowJobSpecHash | null;
260
288
  jobSpecUri: string | null;
261
289
  referrerInjected: boolean;
290
+ /**
291
+ * Durable SDK resume token. Persist this token before retrying a failed
292
+ * post-submission flow; pass it to `resumeHireAndActivate`, never to the
293
+ * funded `hireAndActivate` entry point.
294
+ */
295
+ recovery: HireAndActivateProgress | null;
262
296
  }
263
297
  interface HumanlessHireFlowResult {
264
298
  taskPda: Address;
@@ -267,10 +301,14 @@ interface HumanlessHireFlowResult {
267
301
  jobSpecHash: HumanlessHireFlowJobSpecHash;
268
302
  jobSpecUri: string;
269
303
  referrerInjected: boolean;
304
+ hireReconciled?: boolean;
305
+ activationReconciled?: boolean;
270
306
  moderation?: unknown;
271
307
  }
272
308
  interface UseHumanlessHireFlowResult<TJobSpec = unknown> {
273
309
  hireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>) => Promise<HumanlessHireFlowResult>;
310
+ /** Resume an exact durable SDK token without submitting another hire. */
311
+ resumeHireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>, recovery: HireAndActivateProgress) => Promise<HumanlessHireFlowResult>;
274
312
  phase: HumanlessHireFlowPhase;
275
313
  status: HumanlessHireFlowStatus;
276
314
  progress: HumanlessHireFlowProgress;
@@ -332,10 +370,54 @@ interface UseRateHireResult {
332
370
  declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
333
371
 
334
372
  /**
335
- * The minimal adapter shape this hook bridges. The forthcoming
336
- * `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
337
- * (its `signerFromWalletAccount(...)` resolves the `signer`); until it ships,
338
- * any object matching this interface works.
373
+ * Per-call input for `post` (task auto-bound; the bonding `authority` signer
374
+ * defaults to the client's signer). `role` stays explicit: 1 = worker (the
375
+ * guarantee), 0 = creator.
376
+ */
377
+ type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
378
+ /** Override the bonding authority signer (defaults to the client signer). */
379
+ authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
380
+ };
381
+ /**
382
+ * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
383
+ * the refund returns to — defaults to the client signer's address). The
384
+ * instruction is a permissionless crank, so any fee payer may run it.
385
+ */
386
+ type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
387
+ /** Override the bond's posting wallet (defaults to the client signer). */
388
+ party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
389
+ };
390
+ /** Lifecycle status of a bond verb. */
391
+ type CompletionBondStatus = MutationStatus;
392
+ /** Return value of {@link useCompletionBond}. */
393
+ interface UseCompletionBondResult {
394
+ /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
395
+ post: (input: PostCompletionBondInput) => Promise<string>;
396
+ /** Reclaim a settled-but-live bond. Resolves to the tx signature. */
397
+ reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
398
+ /** Aggregate status: `pending` if either verb is in flight, else last settled. */
399
+ status: CompletionBondStatus;
400
+ /** The most recent error across the two verbs, or null. */
401
+ error: Error | null;
402
+ /** Signature of the last successful action, or null. */
403
+ signature: string | null;
404
+ /** True while either verb is in flight. */
405
+ isPending: boolean;
406
+ /** Reset both mutations to idle. */
407
+ reset: () => void;
408
+ }
409
+ /**
410
+ * Completion-bond actions for one task.
411
+ *
412
+ * @param taskPda - The Task PDA (bound to both verbs).
413
+ * @returns {@link UseCompletionBondResult}.
414
+ */
415
+ declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
416
+
417
+ /**
418
+ * The minimal adapter shape this hook bridges. Any wallet connection hook can
419
+ * return this shape after resolving its signer with `signerFromWalletAccount`
420
+ * or `signerFromWalletAdapter`.
339
421
  */
340
422
  interface WalletSignerAdapter {
341
423
  /** The resolved kit signer, or null when no wallet is connected. */
@@ -370,8 +452,7 @@ interface UseWalletSignerResult {
370
452
  *
371
453
  * @example
372
454
  * ```tsx
373
- * // Once @tetsuo-ai/signer-adapters ships:
374
- * const adapter = useWalletStandardSigner(); // returns WalletSignerAdapter
455
+ * const adapter = useMyWalletConnection(); // returns WalletSignerAdapter
375
456
  * const { signer, connected, connect } = useWalletSigner({ adapter });
376
457
  * ```
377
458
  */
@@ -426,4 +507,4 @@ interface UseReferrerEarningsResult {
426
507
  */
427
508
  declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
428
509
 
429
- export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
510
+ export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type CompletionBondStatus, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, type PostCompletionBondInput, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReclaimCompletionBondInput, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskEventsSourceFactory, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseCompletionBondResult, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useCompletionBond, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
@@ -1,7 +1,7 @@
1
- import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
1
+ import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade, HireAndActivateProgress } from '@tetsuo-ai/marketplace-sdk';
2
2
  import { Address, TransactionSigner } from '@solana/kit';
3
- import { H as HumanlessHireInput } from '../useAgentTrackRecord-BCvRHYM2.js';
4
- export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions, j as UseAgentTrackRecordResult, k as UseDisputeOptions, l as UseDisputeResult, m as UseHireResult, n as UseSubmissionReviewResult, p as projectTrackRecord, u as useAgentTrackRecord, o as useDispute, q as useHire, r as useSubmissionReview } from '../useAgentTrackRecord-BCvRHYM2.js';
3
+ import { H as HumanlessHireInput } from '../useAgentTrackRecord-Ch7gHTFj.js';
4
+ export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TaskGuaranteeReader, j as TrackRecordOutcome, U as UseAgentTrackRecordOptions, k as UseAgentTrackRecordResult, l as UseDisputeOptions, m as UseDisputeResult, n as UseHireResult, o as UseSubmissionReviewResult, p as UseTaskGuaranteeOptions, q as UseTaskGuaranteeResult, r as projectTrackRecord, u as useAgentTrackRecord, s as useDispute, t as useHire, v as useSubmissionReview, w as useTaskGuarantee } from '../useAgentTrackRecord-Ch7gHTFj.js';
5
5
 
6
6
  /** A decoded active listing row (address + decoded account). */
7
7
  type ListingRow = DecodedProgramAccount<ServiceListing>;
@@ -112,11 +112,24 @@ type TaskReader = (pda: Address | string) => Promise<Task | null>;
112
112
  */
113
113
  type ObservedEvent = unknown;
114
114
  /**
115
- * An async source of coordination events for the watched task. Pass the result
116
- * of the SDK's `subscribeMarketplaceEvents(...)` (already address-filtered) or
117
- * any async iterable. Optional.
115
+ * Original coordination-event stream API.
116
+ *
117
+ * @deprecated Prefer {@link TaskEventsSourceFactory}. A pre-created iterable
118
+ * cannot pass this hook's abort signal into its subscription transport. Legacy
119
+ * streams remain cancellation-safe at the iterator boundary through an abort
120
+ * race and best-effort `iterator.return()` cleanup.
118
121
  */
119
122
  type TaskEventsSource = AsyncIterable<ObservedEvent>;
123
+ /**
124
+ * Abort-aware coordination-event factory. Implementations should pass the
125
+ * signal to their subscription transport. The task identity lets a factory
126
+ * construct an address-filtered stream. This form is preferred over the
127
+ * deprecated pre-created {@link TaskEventsSource}.
128
+ */
129
+ type TaskEventsSourceFactory = (options: {
130
+ signal: AbortSignal;
131
+ taskPda: Address | string;
132
+ }) => AsyncIterable<ObservedEvent>;
120
133
  /** Options for {@link useTaskStatus}. */
121
134
  interface UseTaskStatusOptions {
122
135
  /**
@@ -125,17 +138,24 @@ interface UseTaskStatusOptions {
125
138
  */
126
139
  taskReader?: TaskReader;
127
140
  /**
128
- * Optional event source. When given, observed events are appended to
129
- * `events` and each triggers a refetch. Drained in a browser-only effect and
130
- * aborted on unmount.
141
+ * Optional event stream. Prefer an abort-aware factory; the deprecated
142
+ * pre-created AsyncIterable form remains supported for compatibility. Each
143
+ * event triggers a refetch.
131
144
  */
132
- events?: TaskEventsSource;
145
+ events?: TaskEventsSourceFactory | TaskEventsSource;
146
+ /** Maximum recent events retained in memory (default `256`). */
147
+ maxEvents?: number;
133
148
  /**
134
149
  * Stop polling once the task reaches this status (in addition to terminal
135
150
  * statuses). Useful to await a specific transition (e.g. `Completed`).
136
151
  */
137
152
  targetStatus?: TaskStatus;
138
- /** Poll interval in ms while non-terminal. Default `2000`. */
153
+ /**
154
+ * Poll interval in ms while non-terminal. Default `2000`.
155
+ *
156
+ * Must be a non-negative integer no greater than `2_147_483_647`, the
157
+ * maximum portable JavaScript timer delay; invalid values throw RangeError.
158
+ */
139
159
  pollIntervalMs?: number;
140
160
  /** Disable the hook entirely. Default `true` when `taskPda` + reader exist. */
141
161
  enabled?: boolean;
@@ -174,8 +194,9 @@ declare function useTaskStatus(taskPda: Address | string | undefined | null, opt
174
194
  declare const QUERY_KEY_ROOT: "agenc";
175
195
  /**
176
196
  * Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
177
- * this factory so a consumer (or a hook) can invalidate a whole sub-tree
178
- * (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
197
+ * this factory so a consumer (or a hook) can invalidate a deployment sub-tree
198
+ * (`["agenc", namespace, "listings"]`) or one entity
199
+ * (`["agenc", namespace, "listing", pda]`).
179
200
  *
180
201
  * `JSON.stringify` is intentionally NOT used — TanStack compares keys
181
202
  * structurally, so passing the raw filter object keeps equality correct for
@@ -183,17 +204,19 @@ declare const QUERY_KEY_ROOT: "agenc";
183
204
  */
184
205
  declare const queryKeys: {
185
206
  /** All listings list queries (with their filter object as the leaf). */
186
- readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
207
+ readonly listings: (filter?: unknown, cacheNamespace?: string) => readonly ["agenc", string, "listings", {} | null];
187
208
  /** One listing + its joined provider/track-record/moderation. */
188
- readonly listing: (pda: string) => readonly ["agenc", "listing", string];
209
+ readonly listing: (pda: string, cacheNamespace?: string) => readonly ["agenc", string, "listing", string];
189
210
  /** One agent's indexer track record. */
190
- readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
211
+ readonly agentTrackRecord: (agentPda: string, cacheNamespace?: string) => readonly ["agenc", string, "agentTrackRecord", string];
191
212
  /** One task's status (read via transport / svm decode). */
192
- readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
213
+ readonly taskStatus: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "taskStatus", string];
193
214
  /** One task's dispute record. */
194
- readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
215
+ readonly dispute: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "dispute", string];
216
+ /** One task's completion-bond ("Guaranteed Hire") state. */
217
+ readonly taskGuarantee: (taskPda: string, cacheNamespace?: string) => readonly ["agenc", string, "taskGuarantee", string];
195
218
  /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
196
- readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
219
+ readonly referrerEarnings: (wallet: string, cacheNamespace?: string) => readonly ["agenc", string, "referrerEarnings", string];
197
220
  };
198
221
  type MutationStatus = "idle" | "pending" | "success" | "error";
199
222
 
@@ -213,7 +236,10 @@ declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobS
213
236
 
214
237
  type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
215
238
  type HumanlessHireFlowStatus = MutationStatus;
216
- type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
239
+ type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps" | "listingSpecHash"> & {
240
+ /** Exact non-zero listing commitment required by durable SDK recovery. */
241
+ listingSpecHash: NonNullable<HumanlessHireInput["listingSpecHash"]>;
242
+ };
217
243
  type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri" | "moderator"> & {
218
244
  /**
219
245
  * Override the activation `moderator` (P1.2). Defaults to the `moderator`
@@ -222,7 +248,7 @@ type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "j
222
248
  */
223
249
  moderator?: TaskActivationInput["moderator"];
224
250
  };
225
- type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
251
+ type HumanlessHireFlowCreator = NonNullable<HumanlessHireInput["creator"]>;
226
252
  type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
227
253
  interface HumanlessHireFlowModerationResult {
228
254
  jobSpecHash: HumanlessHireFlowJobSpecHash;
@@ -242,6 +268,8 @@ interface HumanlessHireFlowHostInput<TJobSpec> {
242
268
  listing: HumanlessHireFlowHireInput["listing"];
243
269
  jobSpec: TJobSpec;
244
270
  hireSignature: string;
271
+ /** True when finalized account state, rather than a wire response, proved the hire. */
272
+ hireReconciled?: boolean;
245
273
  referrerInjected: boolean;
246
274
  }
247
275
  type HumanlessHireFlowHost<TJobSpec> = (input: HumanlessHireFlowHostInput<TJobSpec>) => Promise<HumanlessHireFlowModerationResult>;
@@ -259,6 +287,12 @@ interface HumanlessHireFlowProgress {
259
287
  jobSpecHash: HumanlessHireFlowJobSpecHash | null;
260
288
  jobSpecUri: string | null;
261
289
  referrerInjected: boolean;
290
+ /**
291
+ * Durable SDK resume token. Persist this token before retrying a failed
292
+ * post-submission flow; pass it to `resumeHireAndActivate`, never to the
293
+ * funded `hireAndActivate` entry point.
294
+ */
295
+ recovery: HireAndActivateProgress | null;
262
296
  }
263
297
  interface HumanlessHireFlowResult {
264
298
  taskPda: Address;
@@ -267,10 +301,14 @@ interface HumanlessHireFlowResult {
267
301
  jobSpecHash: HumanlessHireFlowJobSpecHash;
268
302
  jobSpecUri: string;
269
303
  referrerInjected: boolean;
304
+ hireReconciled?: boolean;
305
+ activationReconciled?: boolean;
270
306
  moderation?: unknown;
271
307
  }
272
308
  interface UseHumanlessHireFlowResult<TJobSpec = unknown> {
273
309
  hireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>) => Promise<HumanlessHireFlowResult>;
310
+ /** Resume an exact durable SDK token without submitting another hire. */
311
+ resumeHireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>, recovery: HireAndActivateProgress) => Promise<HumanlessHireFlowResult>;
274
312
  phase: HumanlessHireFlowPhase;
275
313
  status: HumanlessHireFlowStatus;
276
314
  progress: HumanlessHireFlowProgress;
@@ -332,10 +370,54 @@ interface UseRateHireResult {
332
370
  declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
333
371
 
334
372
  /**
335
- * The minimal adapter shape this hook bridges. The forthcoming
336
- * `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
337
- * (its `signerFromWalletAccount(...)` resolves the `signer`); until it ships,
338
- * any object matching this interface works.
373
+ * Per-call input for `post` (task auto-bound; the bonding `authority` signer
374
+ * defaults to the client's signer). `role` stays explicit: 1 = worker (the
375
+ * guarantee), 0 = creator.
376
+ */
377
+ type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
378
+ /** Override the bonding authority signer (defaults to the client signer). */
379
+ authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
380
+ };
381
+ /**
382
+ * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
383
+ * the refund returns to — defaults to the client signer's address). The
384
+ * instruction is a permissionless crank, so any fee payer may run it.
385
+ */
386
+ type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
387
+ /** Override the bond's posting wallet (defaults to the client signer). */
388
+ party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
389
+ };
390
+ /** Lifecycle status of a bond verb. */
391
+ type CompletionBondStatus = MutationStatus;
392
+ /** Return value of {@link useCompletionBond}. */
393
+ interface UseCompletionBondResult {
394
+ /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
395
+ post: (input: PostCompletionBondInput) => Promise<string>;
396
+ /** Reclaim a settled-but-live bond. Resolves to the tx signature. */
397
+ reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
398
+ /** Aggregate status: `pending` if either verb is in flight, else last settled. */
399
+ status: CompletionBondStatus;
400
+ /** The most recent error across the two verbs, or null. */
401
+ error: Error | null;
402
+ /** Signature of the last successful action, or null. */
403
+ signature: string | null;
404
+ /** True while either verb is in flight. */
405
+ isPending: boolean;
406
+ /** Reset both mutations to idle. */
407
+ reset: () => void;
408
+ }
409
+ /**
410
+ * Completion-bond actions for one task.
411
+ *
412
+ * @param taskPda - The Task PDA (bound to both verbs).
413
+ * @returns {@link UseCompletionBondResult}.
414
+ */
415
+ declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
416
+
417
+ /**
418
+ * The minimal adapter shape this hook bridges. Any wallet connection hook can
419
+ * return this shape after resolving its signer with `signerFromWalletAccount`
420
+ * or `signerFromWalletAdapter`.
339
421
  */
340
422
  interface WalletSignerAdapter {
341
423
  /** The resolved kit signer, or null when no wallet is connected. */
@@ -370,8 +452,7 @@ interface UseWalletSignerResult {
370
452
  *
371
453
  * @example
372
454
  * ```tsx
373
- * // Once @tetsuo-ai/signer-adapters ships:
374
- * const adapter = useWalletStandardSigner(); // returns WalletSignerAdapter
455
+ * const adapter = useMyWalletConnection(); // returns WalletSignerAdapter
375
456
  * const { signer, connected, connect } = useWalletSigner({ adapter });
376
457
  * ```
377
458
  */
@@ -426,4 +507,4 @@ interface UseReferrerEarningsResult {
426
507
  */
427
508
  declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
428
509
 
429
- export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
510
+ export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type CompletionBondStatus, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, type PostCompletionBondInput, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReclaimCompletionBondInput, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskEventsSourceFactory, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseCompletionBondResult, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useCompletionBond, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };