@tetsuo-ai/marketplace-react 0.3.2 → 0.4.1

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 (42) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/{chunk-ZAMIL27X.js → chunk-JVXGNW3Q.js} +35 -4
  3. package/dist/chunk-JVXGNW3Q.js.map +1 -0
  4. package/dist/chunk-XLA7DARS.js +255 -0
  5. package/dist/chunk-XLA7DARS.js.map +1 -0
  6. package/dist/components/index.cjs +179 -43
  7. package/dist/components/index.cjs.map +1 -1
  8. package/dist/components/index.d.cts +2 -2
  9. package/dist/components/index.d.ts +2 -2
  10. package/dist/components/index.js +2 -2
  11. package/dist/hooks/index.cjs +206 -40
  12. package/dist/hooks/index.cjs.map +1 -1
  13. package/dist/hooks/index.d.cts +64 -4
  14. package/dist/hooks/index.d.ts +64 -4
  15. package/dist/hooks/index.js +98 -46
  16. package/dist/hooks/index.js.map +1 -1
  17. package/dist/{index-DQ3Xovkq.d.ts → index-CmVz0OOm.d.ts} +50 -5
  18. package/dist/{index-UxuvIlmD.d.cts → index-DAZzhuO4.d.cts} +50 -5
  19. package/dist/index.cjs +168 -33
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +3 -3
  24. package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-DPt3SfYz.d.cts} +39 -2
  25. package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-DPt3SfYz.d.ts} +39 -2
  26. package/package.json +2 -2
  27. package/src/components/GuaranteedBadge.tsx +73 -0
  28. package/src/components/index.ts +4 -0
  29. package/src/components/strings.ts +8 -0
  30. package/src/hooks/index.ts +13 -0
  31. package/src/hooks/internal.ts +3 -0
  32. package/src/hooks/moderation-attestor.ts +176 -57
  33. package/src/hooks/useCompletionBond.ts +156 -0
  34. package/src/hooks/useHire.ts +27 -0
  35. package/src/hooks/useHumanlessHireFlow.ts +74 -17
  36. package/src/hooks/useTaskActivation.ts +19 -13
  37. package/src/hooks/useTaskGuarantee.ts +120 -0
  38. package/src/index.ts +2 -0
  39. package/src/types.ts +5 -2
  40. package/dist/chunk-2Y6JN2VZ.js +0 -143
  41. package/dist/chunk-2Y6JN2VZ.js.map +0 -1
  42. package/dist/chunk-ZAMIL27X.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } 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-DPt3SfYz.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-DPt3SfYz.cjs';
5
5
 
6
6
  /** A decoded active listing row (address + decoded account). */
7
7
  type ListingRow = DecodedProgramAccount<ServiceListing>;
@@ -192,6 +192,8 @@ declare const queryKeys: {
192
192
  readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
193
193
  /** One task's dispute record. */
194
194
  readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
195
+ /** One task's completion-bond ("Guaranteed Hire") state. */
196
+ readonly taskGuarantee: (taskPda: string) => readonly ["agenc", "taskGuarantee", string];
195
197
  /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
196
198
  readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
197
199
  };
@@ -214,13 +216,26 @@ declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobS
214
216
  type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
215
217
  type HumanlessHireFlowStatus = MutationStatus;
216
218
  type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
217
- type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri">;
219
+ type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri" | "moderator"> & {
220
+ /**
221
+ * Override the activation `moderator` (P1.2). Defaults to the `moderator`
222
+ * returned by `hostAndModerateJobSpec` — the attestation service that
223
+ * signed the task moderation is whose record the publish gate consumes.
224
+ */
225
+ moderator?: TaskActivationInput["moderator"];
226
+ };
218
227
  type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
219
228
  type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
220
229
  interface HumanlessHireFlowModerationResult {
221
230
  jobSpecHash: HumanlessHireFlowJobSpecHash;
222
231
  jobSpecUri: string;
223
232
  moderationAttested: boolean;
233
+ /**
234
+ * The pubkey that signed/recorded the task attestation (P1.2) — the
235
+ * attestation service's signer (e.g. attest.agenc.ag `GET /v1/info` →
236
+ * `moderator`). Names whose record the publish gate consumes.
237
+ */
238
+ moderator: Address;
224
239
  moderation?: unknown;
225
240
  }
226
241
  interface HumanlessHireFlowHostInput<TJobSpec> {
@@ -318,6 +333,51 @@ interface UseRateHireResult {
318
333
  }
319
334
  declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
320
335
 
336
+ /**
337
+ * Per-call input for `post` (task auto-bound; the bonding `authority` signer
338
+ * defaults to the client's signer). `role` stays explicit: 1 = worker (the
339
+ * guarantee), 0 = creator.
340
+ */
341
+ type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
342
+ /** Override the bonding authority signer (defaults to the client signer). */
343
+ authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
344
+ };
345
+ /**
346
+ * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
347
+ * the refund returns to — defaults to the client signer's address). The
348
+ * instruction is a permissionless crank, so any fee payer may run it.
349
+ */
350
+ type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
351
+ /** Override the bond's posting wallet (defaults to the client signer). */
352
+ party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
353
+ };
354
+ /** Lifecycle status of a bond verb. */
355
+ type CompletionBondStatus = MutationStatus;
356
+ /** Return value of {@link useCompletionBond}. */
357
+ interface UseCompletionBondResult {
358
+ /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
359
+ post: (input: PostCompletionBondInput) => Promise<string>;
360
+ /** Reclaim a settled-but-live bond. Resolves to the tx signature. */
361
+ reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
362
+ /** Aggregate status: `pending` if either verb is in flight, else last settled. */
363
+ status: CompletionBondStatus;
364
+ /** The most recent error across the two verbs, or null. */
365
+ error: Error | null;
366
+ /** Signature of the last successful action, or null. */
367
+ signature: string | null;
368
+ /** True while either verb is in flight. */
369
+ isPending: boolean;
370
+ /** Reset both mutations to idle. */
371
+ reset: () => void;
372
+ }
373
+ /**
374
+ * Completion-bond actions for one task.
375
+ *
376
+ * @param taskPda - The Task PDA (bound to both verbs).
377
+ * @returns {@link UseCompletionBondResult}.
378
+ */
379
+ declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
380
+
321
381
  /**
322
382
  * The minimal adapter shape this hook bridges. The forthcoming
323
383
  * `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
@@ -413,4 +473,4 @@ interface UseReferrerEarningsResult {
413
473
  */
414
474
  declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
415
475
 
416
- 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 };
476
+ 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 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
1
  import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } 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-DPt3SfYz.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-DPt3SfYz.js';
5
5
 
6
6
  /** A decoded active listing row (address + decoded account). */
7
7
  type ListingRow = DecodedProgramAccount<ServiceListing>;
@@ -192,6 +192,8 @@ declare const queryKeys: {
192
192
  readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
193
193
  /** One task's dispute record. */
194
194
  readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
195
+ /** One task's completion-bond ("Guaranteed Hire") state. */
196
+ readonly taskGuarantee: (taskPda: string) => readonly ["agenc", "taskGuarantee", string];
195
197
  /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
196
198
  readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
197
199
  };
@@ -214,13 +216,26 @@ declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobS
214
216
  type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
215
217
  type HumanlessHireFlowStatus = MutationStatus;
216
218
  type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
217
- type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri">;
219
+ type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri" | "moderator"> & {
220
+ /**
221
+ * Override the activation `moderator` (P1.2). Defaults to the `moderator`
222
+ * returned by `hostAndModerateJobSpec` — the attestation service that
223
+ * signed the task moderation is whose record the publish gate consumes.
224
+ */
225
+ moderator?: TaskActivationInput["moderator"];
226
+ };
218
227
  type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
219
228
  type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
220
229
  interface HumanlessHireFlowModerationResult {
221
230
  jobSpecHash: HumanlessHireFlowJobSpecHash;
222
231
  jobSpecUri: string;
223
232
  moderationAttested: boolean;
233
+ /**
234
+ * The pubkey that signed/recorded the task attestation (P1.2) — the
235
+ * attestation service's signer (e.g. attest.agenc.ag `GET /v1/info` →
236
+ * `moderator`). Names whose record the publish gate consumes.
237
+ */
238
+ moderator: Address;
224
239
  moderation?: unknown;
225
240
  }
226
241
  interface HumanlessHireFlowHostInput<TJobSpec> {
@@ -318,6 +333,51 @@ interface UseRateHireResult {
318
333
  }
319
334
  declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
320
335
 
336
+ /**
337
+ * Per-call input for `post` (task auto-bound; the bonding `authority` signer
338
+ * defaults to the client's signer). `role` stays explicit: 1 = worker (the
339
+ * guarantee), 0 = creator.
340
+ */
341
+ type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
342
+ /** Override the bonding authority signer (defaults to the client signer). */
343
+ authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
344
+ };
345
+ /**
346
+ * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
347
+ * the refund returns to — defaults to the client signer's address). The
348
+ * instruction is a permissionless crank, so any fee payer may run it.
349
+ */
350
+ type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
351
+ /** Override the bond's posting wallet (defaults to the client signer). */
352
+ party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
353
+ };
354
+ /** Lifecycle status of a bond verb. */
355
+ type CompletionBondStatus = MutationStatus;
356
+ /** Return value of {@link useCompletionBond}. */
357
+ interface UseCompletionBondResult {
358
+ /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
359
+ post: (input: PostCompletionBondInput) => Promise<string>;
360
+ /** Reclaim a settled-but-live bond. Resolves to the tx signature. */
361
+ reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
362
+ /** Aggregate status: `pending` if either verb is in flight, else last settled. */
363
+ status: CompletionBondStatus;
364
+ /** The most recent error across the two verbs, or null. */
365
+ error: Error | null;
366
+ /** Signature of the last successful action, or null. */
367
+ signature: string | null;
368
+ /** True while either verb is in flight. */
369
+ isPending: boolean;
370
+ /** Reset both mutations to idle. */
371
+ reset: () => void;
372
+ }
373
+ /**
374
+ * Completion-bond actions for one task.
375
+ *
376
+ * @param taskPda - The Task PDA (bound to both verbs).
377
+ * @returns {@link UseCompletionBondResult}.
378
+ */
379
+ declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
380
+
321
381
  /**
322
382
  * The minimal adapter shape this hook bridges. The forthcoming
323
383
  * `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
@@ -413,4 +473,4 @@ interface UseReferrerEarningsResult {
413
473
  */
414
474
  declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
415
475
 
416
- 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 };
476
+ 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 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,11 +1,10 @@
1
1
  import { ReadTransportUnsupportedError } from '../chunk-AKPPKMQ2.js';
2
- import { useAgencContext, queryKeys, pdaKey, requireClient, mutationStatusOf, resolveReferrerArgs, withoutReferrerArgs, signerAddress } from '../chunk-2Y6JN2VZ.js';
3
- export { QUERY_KEY_ROOT, queryKeys, useHire, useWalletSigner } from '../chunk-2Y6JN2VZ.js';
2
+ import { useAgencContext, queryKeys, pdaKey, requireClient, resolveActivationModerationAccounts, mutationStatusOf, resolveReferrerArgs, withoutReferrerArgs, resolveHireListingModerationAccounts, signerAddress } from '../chunk-XLA7DARS.js';
3
+ export { QUERY_KEY_ROOT, queryKeys, useHire, useTaskGuarantee, useWalletSigner } from '../chunk-XLA7DARS.js';
4
4
  import { t } from '../chunk-H6PJIDQR.js';
5
- import { useQuery, useMutation } from '@tanstack/react-query';
5
+ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
6
6
  import { useState, useMemo, useCallback, useRef, useEffect } from 'react';
7
- import { TaskStatus, facade, findTaskPda, findTaskModerationPda, fetchMaybeTaskModeration, findModerationConfigPda, fetchMaybeModerationConfig, findModerationAttestorPda } from '@tetsuo-ai/marketplace-sdk';
8
- import { createSolanaRpc } from '@solana/kit';
7
+ import { TaskStatus, facade, findTaskPda } from '@tetsuo-ai/marketplace-sdk';
9
8
 
10
9
  var DEFAULT_PAGE_SIZE = 12;
11
10
  function useListings(filter, options) {
@@ -261,50 +260,21 @@ function useSubmissionReview(taskPda) {
261
260
  }
262
261
  };
263
262
  }
264
- async function resolveActivationModerationAttestor(input) {
265
- try {
266
- const rpc = input.rpc ?? (input.rpcUrl ? createSolanaRpc(input.rpcUrl) : null);
267
- if (!rpc) return void 0;
268
- const [taskModerationPda] = await findTaskModerationPda({
269
- task: input.task,
270
- jobSpecHash: input.jobSpecHash
271
- });
272
- const taskModeration = await fetchMaybeTaskModeration(
273
- rpc,
274
- taskModerationPda
275
- );
276
- if (!taskModeration.exists) return void 0;
277
- const [moderationConfigPda] = await findModerationConfigPda();
278
- const moderationConfig = await fetchMaybeModerationConfig(
279
- rpc,
280
- moderationConfigPda
281
- );
282
- if (moderationConfig.exists && taskModeration.data.moderator === moderationConfig.data.moderationAuthority) {
283
- return void 0;
284
- }
285
- const [rosterPda] = await findModerationAttestorPda({
286
- attestor: taskModeration.data.moderator
287
- });
288
- return rosterPda;
289
- } catch {
290
- return void 0;
291
- }
292
- }
293
-
294
- // src/hooks/useTaskActivation.ts
295
263
  function useTaskActivation(taskPda) {
296
264
  const ctx = useAgencContext();
297
265
  const mutation = useMutation({
298
266
  mutationFn: async (input) => {
299
267
  const client = requireClient(ctx.client);
300
- const moderationAttestor = input.moderationAttestor ?? await resolveActivationModerationAttestor({
268
+ const callerResolved = input.moderationAttestor !== void 0 || input.moderatorIsAttestor !== void 0 || input.taskModeration !== void 0;
269
+ const resolved = callerResolved ? {} : await resolveActivationModerationAccounts({
301
270
  rpcUrl: ctx.rpcUrl,
302
271
  task: taskPda,
303
- jobSpecHash: input.jobSpecHash
272
+ jobSpecHash: input.jobSpecHash,
273
+ moderator: input.moderator
304
274
  });
305
275
  const { signature } = await client.setTaskJobSpec({
306
276
  ...input,
307
- ...moderationAttestor !== void 0 ? { moderationAttestor } : {},
277
+ ...resolved,
308
278
  task: taskPda,
309
279
  creator: input.creator ?? client.signer
310
280
  });
@@ -351,7 +321,16 @@ function validateModerationResult(result) {
351
321
  "Task moderation returned an empty jobSpecUri; activation was not signed."
352
322
  );
353
323
  }
354
- return { jobSpecHash: result.jobSpecHash, jobSpecUri };
324
+ if (typeof result.moderator !== "string" || !result.moderator.trim()) {
325
+ throw new Error(
326
+ "Task moderation returned no moderator pubkey; activation was not signed."
327
+ );
328
+ }
329
+ return {
330
+ jobSpecHash: result.jobSpecHash,
331
+ jobSpecUri,
332
+ moderator: result.moderator
333
+ };
355
334
  }
356
335
  function useHumanlessHireFlow() {
357
336
  const ctx = useAgencContext();
@@ -367,8 +346,19 @@ function useHumanlessHireFlow() {
367
346
  setPhase("hiring");
368
347
  setProgress(emptyProgress());
369
348
  try {
349
+ const hireListingSpecHash = input.hire.listingSpecHash;
350
+ let hireModerationArgs = {};
351
+ if (input.hire.moderationAttestor === void 0 && input.hire.moderatorIsAttestor === void 0 && input.hire.listingModeration === void 0 && hireListingSpecHash !== void 0) {
352
+ hireModerationArgs = await resolveHireListingModerationAccounts({
353
+ rpcUrl: ctx.rpcUrl,
354
+ listing: input.hire.listing,
355
+ listingSpecHash: hireListingSpecHash,
356
+ moderator: input.hire.moderator
357
+ });
358
+ }
370
359
  const hireResult = await client.hireFromListingHumanless({
371
360
  ...hireInput,
361
+ ...hireModerationArgs,
372
362
  creator,
373
363
  ...referrerArgs
374
364
  });
@@ -391,25 +381,29 @@ function useHumanlessHireFlow() {
391
381
  hireSignature: hireResult.signature,
392
382
  referrerInjected
393
383
  });
394
- const { jobSpecHash, jobSpecUri } = validateModerationResult(moderation);
384
+ const { jobSpecHash, jobSpecUri, moderator } = validateModerationResult(moderation);
395
385
  setProgress((current) => ({
396
386
  ...current,
397
387
  jobSpecHash,
398
388
  jobSpecUri
399
389
  }));
400
390
  setPhase("activating");
401
- const moderationAttestor = input.activation?.moderationAttestor ?? await resolveActivationModerationAttestor({
391
+ const activationModerator = input.activation?.moderator ?? moderator;
392
+ const activationCallerResolved = input.activation?.moderationAttestor !== void 0 || input.activation?.moderatorIsAttestor !== void 0 || input.activation?.taskModeration !== void 0;
393
+ const activationModerationArgs = activationCallerResolved ? {} : await resolveActivationModerationAccounts({
402
394
  rpcUrl: ctx.rpcUrl,
403
395
  task: taskPda,
404
- jobSpecHash
396
+ jobSpecHash,
397
+ moderator: activationModerator
405
398
  });
406
399
  const activationResult = await client.setTaskJobSpec({
407
400
  ...input.activation ?? {},
408
- ...moderationAttestor !== void 0 ? { moderationAttestor } : {},
401
+ ...activationModerationArgs,
409
402
  task: taskPda,
410
403
  creator,
411
404
  jobSpecHash,
412
- jobSpecUri
405
+ jobSpecUri,
406
+ moderator: activationModerator
413
407
  });
414
408
  const result = {
415
409
  taskPda,
@@ -628,6 +622,64 @@ function useDispute(taskPda, options) {
628
622
  reset: mutation.reset
629
623
  };
630
624
  }
625
+ function useCompletionBond(taskPda) {
626
+ const ctx = useAgencContext();
627
+ const queryClient = useQueryClient();
628
+ const invalidateGuarantee = useCallback(() => {
629
+ void queryClient.invalidateQueries({
630
+ queryKey: queryKeys.taskGuarantee(pdaKey(taskPda))
631
+ });
632
+ }, [queryClient, taskPda]);
633
+ const postMut = useMutation({
634
+ mutationFn: async (input) => {
635
+ const client = requireClient(ctx.client);
636
+ const { signature } = await client.postCompletionBond({
637
+ ...input,
638
+ task: taskPda,
639
+ authority: input.authority ?? client.signer
640
+ });
641
+ invalidateGuarantee();
642
+ return signature;
643
+ }
644
+ });
645
+ const reclaimMut = useMutation({
646
+ mutationFn: async (input) => {
647
+ const client = requireClient(ctx.client);
648
+ const { signature } = await client.reclaimCompletionBond({
649
+ ...input,
650
+ task: taskPda,
651
+ party: input.party ?? client.signer.address
652
+ });
653
+ invalidateGuarantee();
654
+ return signature;
655
+ }
656
+ });
657
+ const post = useCallback(
658
+ (input) => postMut.mutateAsync(input),
659
+ [postMut]
660
+ );
661
+ const reclaim = useCallback(
662
+ (input) => reclaimMut.mutateAsync(input),
663
+ [reclaimMut]
664
+ );
665
+ const isPending = postMut.isPending || reclaimMut.isPending;
666
+ const status = isPending ? "pending" : mutationStatusOf(
667
+ // Surface the most recently-touched verb's terminal state.
668
+ [postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut
669
+ );
670
+ return {
671
+ post,
672
+ reclaim,
673
+ status,
674
+ error: postMut.error ?? reclaimMut.error ?? null,
675
+ signature: postMut.data ?? reclaimMut.data ?? null,
676
+ isPending,
677
+ reset: () => {
678
+ postMut.reset();
679
+ reclaimMut.reset();
680
+ }
681
+ };
682
+ }
631
683
  var EARNINGS_INDEXER_DEFAULTS = {
632
684
  mainnet: "https://api.agenc.ag"
633
685
  };
@@ -691,6 +743,6 @@ function useReferrerEarnings(wallet) {
691
743
  };
692
744
  }
693
745
 
694
- export { projectTrackRecord, useAgentTrackRecord, useDispute, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useSubmissionReview, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork };
746
+ export { projectTrackRecord, useAgentTrackRecord, useCompletionBond, useDispute, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useSubmissionReview, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork };
695
747
  //# sourceMappingURL=index.js.map
696
748
  //# sourceMappingURL=index.js.map