@tetsuo-ai/marketplace-react 0.4.0 → 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.
- package/CHANGELOG.md +22 -0
- package/dist/{chunk-BNILOX3O.js → chunk-JVXGNW3Q.js} +35 -4
- package/dist/chunk-JVXGNW3Q.js.map +1 -0
- package/dist/{chunk-BTAVED7S.js → chunk-XLA7DARS.js} +35 -6
- package/dist/chunk-XLA7DARS.js.map +1 -0
- package/dist/components/index.cjs +129 -48
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/hooks/index.cjs +89 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +50 -3
- package/dist/hooks/index.d.ts +50 -3
- package/dist/hooks/index.js +62 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-DQ3Xovkq.d.ts → index-CmVz0OOm.d.ts} +50 -5
- package/dist/{index-UxuvIlmD.d.cts → index-DAZzhuO4.d.cts} +50 -5
- package/dist/index.cjs +119 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-DPt3SfYz.d.cts} +39 -2
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-DPt3SfYz.d.ts} +39 -2
- package/package.json +1 -1
- package/src/components/GuaranteedBadge.tsx +73 -0
- package/src/components/index.ts +4 -0
- package/src/components/strings.ts +8 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/internal.ts +3 -0
- package/src/hooks/useCompletionBond.ts +156 -0
- package/src/hooks/useTaskGuarantee.ts +120 -0
- package/src/index.ts +2 -0
- package/src/types.ts +5 -2
- package/dist/chunk-BNILOX3O.js.map +0 -1
- package/dist/chunk-BTAVED7S.js.map +0 -1
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useListings.ts","../../src/hooks/useListing.ts","../../src/hooks/useAgentTrackRecord.ts","../../src/hooks/useTaskStatus.ts","../../src/hooks/useSubmissionReview.ts","../../src/hooks/useTaskActivation.ts","../../src/hooks/useHumanlessHireFlow.ts","../../src/hooks/useTaskWork.ts","../../src/hooks/useTaskLifecycle.ts","../../src/hooks/useRateHire.ts","../../src/hooks/useDispute.ts","../../src/hooks/useReferrerEarnings.ts"],"names":["useQuery","useState","task","signature","useCallback","useMutation","useRef"],"mappings":";;;;;;;;AAuEA,IAAM,iBAAA,GAAoB,EAAA;AAgBnB,SAAS,WAAA,CACd,QACA,OAAA,EACmB;AACnB,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,eAAA,EAAgB;AACjC,EAAA,MAAM,QAAA,GAAW,SAAS,QAAA,IAAY,iBAAA;AACtC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,IAAW,IAAA;AAEpC,EAAA,MAAM,QAAQ,QAAA,CAA8B;AAAA,IAC1C,QAAA,EAAU,SAAA,CAAU,QAAA,CAAS,MAAM,CAAA;AAAA,IACnC,OAAA,EAAS,MAAM,IAAA,CAAK,kBAAA,CAAmB,MAAM,CAAA;AAAA,IAC7C;AAAA,GACD,CAAA;AAID,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,QAAQ,CAAA;AAE/C,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,IAAA,IAAQ,EAAC;AAG3B,EAAA,MAAM,UAAA,GAAa,KAAK,GAAA,CAAI,IAAA,CAAK,IAAI,OAAA,EAAS,QAAQ,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA;AACnE,EAAA,MAAM,QAAA,GAAW,OAAA;AAAA,IACf,MAAM,GAAA,CAAI,KAAA,CAAM,CAAA,EAAG,UAAU,CAAA;AAAA,IAC7B,CAAC,KAA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AAA,UAC/B,aAAA,EAAe,MAAA,CAAO,CAAA,CAAE,aAAA,IAAiB,EAAE,CAAA;AAAA,UAC3C,WAAA,EAAa,MAAA,CAAO,CAAA,CAAE,WAAA,IAAe,GAAG,CAAA;AAAA,UACxC,SAAA,EAAW,MAAA,CAAO,CAAA,CAAE,SAAA,IAAa,EAAE;AAAA,SACrC,CAAE,CAAA;AACF,QAAA,OAAO;AAAA,UACL,aAAA,EAAe,MAAA,CAAO,IAAA,CAAK,aAAA,IAAiB,GAAG,CAAA;AAAA,UAC/C;AAAA,SACF;AAAA,MACF;AAAA;AACF,GACF;AAEA,EAAA,IAAI,CAAC,OAAA,EAAS;AAGZ,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,KAAA;AAAA,MACN,aAAA,EAAe,EAAA;AAAA,MACf,OAAO,EAAC;AAAA,MACR,SAAA,EAAW,KAAA;AAAA,MACX,KAAA,EAAO,IAAA;AAAA,MACP,MAAA,EAAQ,WAAW,IAAA,GACf,CAAA,CAAE,gCAAgC,CAAA,GACjC,UAAA,CAAW,MAAA,IAAU,CAAA,CAAE,wBAAwB,CAAA;AAAA,MACpD,SAAS,MAAM;AAAA,MAEf;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAA;AAAA,IACN,aAAA,EAAe,KAAA,CAAM,IAAA,EAAM,aAAA,IAAiB,EAAA;AAAA,IAC5C,KAAA,EAAO,KAAA,CAAM,IAAA,EAAM,KAAA,IAAS,EAAC;AAAA,IAC7B,WAAW,KAAA,CAAM,SAAA;AAAA,IACjB,KAAA,EAAO,MAAM,KAAA,IAAS,IAAA;AAAA,IACtB,OAAA,EAAS,MAAM,KAAK,KAAA,CAAM,OAAA;AAAQ,GACpC;AACF","file":"index.js","sourcesContent":["/**\n * `useListings(filter?)` — the listing-grid read hook.\n *\n * Fetches active service listings through the provider's unified read transport\n * (indexer-first, gPA fallback — the hook never branches on which is live) and\n * caches them via TanStack Query. Filters (`provider`, `category`, `state`) are\n * forwarded verbatim to the transport, which applies server-side memcmp filters\n * (indexer/gPA) and the client-side state filter exactly as the SDK does.\n *\n * ## Pagination model (honest about the transport)\n *\n * The v1 read transport returns the FULL active-listing set in one call — there\n * is no server cursor in either backend (the gPA path can't have one; the\n * indexer's `listActiveListings` is a drop-in of it). So pagination here is a\n * client-side WINDOW over the already-fetched array: `listings` grows by\n * `pageSize` each time `fetchMore()` is called, `hasMore` reflects whether more\n * rows remain in the fetched set. This keeps one network round-trip while still\n * giving a grid an incremental-reveal API. When a future transport gains a\n * cursor, `fetchMore` can swap to `fetchNextPage` without changing this\n * surface.\n *\n * SSR-safe: no `window`/`document`; the query simply does not run until mounted\n * if the host disables it.\n *\n * @module hooks/useListings\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type {\n DecodedProgramAccount,\n ListActiveListingsOptions,\n ServiceListing,\n} from \"../types.js\";\nimport { queryKeys } from \"./internal.js\";\n\n/** A decoded active listing row (address + decoded account). */\nexport type ListingRow = DecodedProgramAccount<ServiceListing>;\n\n/** Filter for {@link useListings}. Mirrors the SDK's `ListActiveListingsOptions`. */\nexport type UseListingsFilter = ListActiveListingsOptions;\n\n/** Options for {@link useListings}. */\nexport interface UseListingsOptions {\n /** Rows revealed per page / per `fetchMore()` call. Default `12`. */\n pageSize?: number;\n /**\n * Disable the query (e.g. until a filter is ready). When `false` the hook\n * returns the idle state and makes no request. Default `true`.\n */\n enabled?: boolean;\n}\n\n/** Return value of {@link useListings}. */\nexport interface UseListingsResult {\n /** The currently-revealed window of listings (grows via `fetchMore`). */\n listings: ListingRow[];\n /** Total active listings the transport returned (the full fetched set). */\n total: number;\n /** True while the underlying fetch is in flight (first load / refetch). */\n isLoading: boolean;\n /** The fetch error (typed `AgencError` for on-chain failures), or null. */\n error: Error | null;\n /** Whether more rows remain in the fetched set to reveal. */\n hasMore: boolean;\n /** Reveal the next `pageSize` rows from the fetched set. No-op when exhausted. */\n fetchMore: () => void;\n /** Force a fresh fetch from the transport. */\n refetch: () => void;\n}\n\nconst DEFAULT_PAGE_SIZE = 12;\n\n/**\n * Read active service listings for a grid.\n *\n * @param filter - Optional provider/category/state filter (SDK semantics).\n * @param options - Page size + enabled flag.\n * @returns {@link UseListingsResult}.\n *\n * @example\n * ```tsx\n * const { listings, isLoading, fetchMore, hasMore } = useListings({\n * category: \"code-generation\",\n * });\n * ```\n */\nexport function useListings(\n filter?: UseListingsFilter,\n options?: UseListingsOptions,\n): UseListingsResult {\n const { read } = useAgencContext();\n const pageSize = options?.pageSize ?? DEFAULT_PAGE_SIZE;\n const enabled = options?.enabled ?? true;\n\n const query = useQuery<ListingRow[], Error>({\n queryKey: queryKeys.listings(filter),\n queryFn: () => read.listActiveListings(filter),\n enabled,\n });\n\n // Client-side reveal window. Reset to one page whenever the underlying data\n // changes (new fetch / filter change resets the key, which remounts data).\n const [visible, setVisible] = useState(pageSize);\n\n const all = query.data ?? [];\n // Clamp the window to [pageSize, all.length] so a filter change that shrinks\n // the set never strands `visible` above the available rows.\n const windowSize = Math.min(Math.max(visible, pageSize), all.length);\n const listings = useMemo(\n () => all.slice(0, windowSize),\n [all, windowSize],\n );\n\n const fetchMore = useCallback(() => {\n setVisible((current) => current + pageSize);\n }, [pageSize]);\n\n const refetch = useCallback(() => {\n setVisible(pageSize);\n void query.refetch();\n }, [pageSize, query]);\n\n return {\n listings,\n total: all.length,\n isLoading: query.isLoading,\n error: query.error ?? null,\n hasMore: windowSize < all.length,\n fetchMore,\n refetch,\n };\n}\n","/**\n * `useListing(pda)` — single-listing detail hook.\n *\n * Joins, in ONE cached query, the three things a listing detail / checkout view\n * needs:\n * - the decoded `ServiceListing` (via `read.getListing`);\n * - the provider's track record (via `read.agentTrackRecord(providerAgent)`),\n * keyed off the listing's `providerAgent` — indexer-native, so it is fetched\n * only when the indexer backend is live and resolves to `null` under the gPA\n * fallback (which has no trustless aggregated track record — the transport\n * throws `ReadTransportUnsupportedError`, which the hook swallows to `null`\n * rather than failing the whole join);\n * - the moderation/attestation state (see the moderation note below).\n *\n * ## Moderation (v1 scope, honest)\n *\n * The read transport does not yet expose a dedicated listing-moderation read\n * (the indexer's listing projection carries the pinned `specHash` but not an\n * attestation verdict). So `moderation` is the listing's indexer projection when\n * present (callers can read `indexer.metadataValid` / `metadataIssues` and the\n * pinned `specHash`) and `null` under the gPA fallback. A dedicated attestation\n * read lands when the indexer projects it; this hook's surface does not change.\n *\n * @module hooks/useListing\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { ReadTransportUnsupportedError } from \"../transport/index.js\";\nimport type {\n Address,\n IndexerAgentTrackRecord,\n IndexerListing,\n ServiceListing,\n} from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** The joined detail payload {@link useListing} resolves. */\nexport interface ListingDetail {\n /** The listing PDA. */\n address: Address;\n /** The decoded on-chain `ServiceListing`. */\n listing: ServiceListing;\n /** The provider's agent PDA (`ServiceListing.providerAgent`). */\n provider: Address;\n /**\n * The provider's indexer track record, or `null` when unavailable (the gPA\n * fallback has no trustless aggregated equivalent).\n */\n trackRecord: IndexerAgentTrackRecord | null;\n /**\n * The listing's indexer projection (carries `metadataValid`,\n * `metadataIssues`, the pinned `specHash`), or `null` under the gPA fallback.\n * The v1 read model does not yet project a standalone attestation verdict.\n */\n moderation: IndexerListing | null;\n}\n\n/** Options for {@link useListing}. */\nexport interface UseListingOptions {\n /** Disable the query (no `pda` yet, etc.). Default `true` when `pda` is set. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useListing}. */\nexport interface UseListingResult {\n /** The joined detail, or null until loaded. */\n detail: ListingDetail | null;\n /** The decoded listing, or null until loaded (convenience projection). */\n listing: ServiceListing | null;\n /** The provider agent PDA, or null until loaded. */\n provider: Address | null;\n /** The provider's track record, or null (unavailable / not yet loaded). */\n trackRecord: IndexerAgentTrackRecord | null;\n /** The listing's indexer/moderation projection, or null. */\n moderation: IndexerListing | null;\n /** True while loading. */\n isLoading: boolean;\n /** The error, or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/**\n * Read one listing and join its provider track record + moderation projection.\n *\n * @param pda - The ServiceListing PDA (string or Address). When falsy the query\n * is disabled.\n * @param options - `enabled` override.\n * @returns {@link UseListingResult}.\n */\nexport function useListing(\n pda: Address | string | undefined | null,\n options?: UseListingOptions,\n): UseListingResult {\n const { read } = useAgencContext();\n const enabled = (options?.enabled ?? true) && Boolean(pda);\n\n const query = useQuery<ListingDetail, Error>({\n queryKey: queryKeys.listing(pda ? pdaKey(pda) : \"\"),\n enabled,\n queryFn: async () => {\n // 1) The listing itself.\n const result = await read.getListing(pda as Address | string);\n const provider = result.account.providerAgent;\n\n // 2) The provider's track record — indexer-native. Swallow the\n // gPA-fallback \"unsupported\" rejection to null so the join still\n // resolves the listing + moderation (degrade, don't fail).\n let trackRecord: IndexerAgentTrackRecord | null = null;\n try {\n trackRecord = await read.agentTrackRecord(provider);\n } catch (err) {\n if (!(err instanceof ReadTransportUnsupportedError)) throw err;\n }\n\n return {\n address: result.address,\n listing: result.account,\n provider,\n trackRecord,\n moderation: result.indexer ?? null,\n };\n },\n });\n\n const detail = query.data ?? null;\n return {\n detail,\n listing: detail?.listing ?? null,\n provider: detail?.provider ?? null,\n trackRecord: detail?.trackRecord ?? null,\n moderation: detail?.moderation ?? null,\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useAgentTrackRecord(agentPda)` — provider reputation hook (PARTIAL, P6.6).\n *\n * Reads the indexer's reconstructed track record for an agent and projects the\n * `{ completionRate, disputeRate, slashHistory, recentOutcomes }` contract.\n *\n * ## P6.6 scope (honest about what is and isn't available)\n *\n * The v1 indexer record (`IndexerAgentTrackRecord`) is event-reconstructed and\n * exposes raw COUNTS: `completions`, `disputesInitiated`, `disputesLost`, and a\n * `slashHistory`. It does NOT yet expose the denominators a true RATE needs\n * (total tasks taken, total disputes faced) — that aggregation lands in\n * PLAN.md P6.6. So:\n * - `slashHistory` and the dispute COUNTS are real today (passed through);\n * - `completionRate` / `disputeRate` are RATIOS and are only meaningful once a\n * denominator exists. Today they are computed from the available counts where\n * a denominator is inferable (completions vs. completions+disputesLost as a\n * conservative proxy) and otherwise `null`. Treat them as provisional until\n * P6.6. The `partial` flag is the audit signal — `true` today.\n * - `recentOutcomes` is reconstructed from `slashHistory` (the only per-event\n * stream in v1); a richer outcome feed lands with P6.6.\n *\n * Indexer-native: the gPA fallback has no aggregated track record, so under it\n * `read.agentTrackRecord` throws `ReadTransportUnsupportedError` and this hook\n * surfaces that error (a track record is not reconstructable trustlessly).\n *\n * @module hooks/useAgentTrackRecord\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address, IndexerAgentTrackRecord } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** A reconstructed outcome event (v1: derived from the slash history). */\nexport interface TrackRecordOutcome {\n /** Outcome kind. v1 only reconstructs slashes from the event stream. */\n kind: \"slash\";\n /** The raw slash event from the indexer record. */\n event: IndexerAgentTrackRecord[\"slashHistory\"][number];\n}\n\n/** The projected track record {@link useAgentTrackRecord} returns. */\nexport interface AgentTrackRecord {\n /** The agent PDA. */\n agent: Address | string;\n /** Completed-task count (real today). */\n completions: number;\n /** Disputes the agent initiated (real today). */\n disputesInitiated: number;\n /** Disputes the agent lost (real today). */\n disputesLost: number;\n /**\n * Completion rate in `[0,1]`, or `null` when no denominator is inferable.\n * PROVISIONAL until P6.6 supplies the true total-tasks denominator.\n */\n completionRate: number | null;\n /**\n * Dispute rate in `[0,1]`, or `null` when no denominator is inferable.\n * PROVISIONAL until P6.6.\n */\n disputeRate: number | null;\n /** Reconstructed slash history (real today). */\n slashHistory: IndexerAgentTrackRecord[\"slashHistory\"];\n /** Reconstructed recent outcomes (v1: from slash history). */\n recentOutcomes: TrackRecordOutcome[];\n /** True while any rate is provisional/derived (P6.6 audit signal). */\n partial: boolean;\n}\n\n/** Options for {@link useAgentTrackRecord}. */\nexport interface UseAgentTrackRecordOptions {\n /** Disable the query. Default `true` when `agentPda` is set. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useAgentTrackRecord}. */\nexport interface UseAgentTrackRecordResult {\n /** The projected track record, or null until loaded. */\n trackRecord: AgentTrackRecord | null;\n /** Convenience: `trackRecord?.completionRate ?? null`. */\n completionRate: number | null;\n /** Convenience: `trackRecord?.disputeRate ?? null`. */\n disputeRate: number | null;\n /** Convenience: `trackRecord?.slashHistory ?? []`. */\n slashHistory: IndexerAgentTrackRecord[\"slashHistory\"];\n /** Convenience: `trackRecord?.recentOutcomes ?? []`. */\n recentOutcomes: TrackRecordOutcome[];\n /** True while loading. */\n isLoading: boolean;\n /** The error (e.g. `ReadTransportUnsupportedError` under gPA), or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/**\n * Project the raw indexer record into the partial track-record contract. Kept\n * exported + pure so structural tests can assert the projection directly.\n */\nexport function projectTrackRecord(\n raw: IndexerAgentTrackRecord,\n): AgentTrackRecord {\n const completions = raw.completions;\n const disputesLost = raw.disputesLost;\n // Conservative proxy denominator: settled outcomes we can SEE (completions +\n // lost disputes). This is NOT the true total-tasks denominator (P6.6); when\n // it is zero there is nothing to rate, so the rates are null.\n const settledKnown = completions + disputesLost;\n const completionRate =\n settledKnown > 0 ? completions / settledKnown : null;\n const disputeRate =\n settledKnown > 0 ? disputesLost / settledKnown : null;\n\n return {\n agent: raw.agent,\n completions,\n disputesInitiated: raw.disputesInitiated,\n disputesLost,\n completionRate,\n disputeRate,\n slashHistory: raw.slashHistory,\n recentOutcomes: raw.slashHistory.map((event) => ({\n kind: \"slash\" as const,\n event,\n })),\n // Always partial in v1: every rate is a proxy until P6.6 lands the real\n // denominators and outcome feed.\n partial: true,\n };\n}\n\n/**\n * Read an agent's (partial) track record.\n *\n * @param agentPda - The AgentRegistration PDA (falsy disables the hook).\n * @param options - `enabled` override.\n * @returns {@link UseAgentTrackRecordResult}.\n */\nexport function useAgentTrackRecord(\n agentPda: Address | string | undefined | null,\n options?: UseAgentTrackRecordOptions,\n): UseAgentTrackRecordResult {\n const { read } = useAgencContext();\n const enabled = (options?.enabled ?? true) && Boolean(agentPda);\n\n const query = useQuery<AgentTrackRecord, Error>({\n queryKey: queryKeys.agentTrackRecord(agentPda ? pdaKey(agentPda) : \"\"),\n enabled,\n queryFn: async () => {\n const raw = await read.agentTrackRecord(agentPda as Address | string);\n return projectTrackRecord(raw);\n },\n });\n\n const tr = query.data ?? null;\n return {\n trackRecord: tr,\n completionRate: tr?.completionRate ?? null,\n disputeRate: tr?.disputeRate ?? null,\n slashHistory: tr?.slashHistory ?? [],\n recentOutcomes: tr?.recentOutcomes ?? [],\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useTaskStatus(taskPda)` — live task status with a poll fallback.\n *\n * Tracks a Task account's {@link TaskStatus} (and optionally its submission and\n * the coordination events seen for it) after a hire. It is built to satisfy the\n * PLAN_2 A2 contract `{ task, status, submission, events }` while staying SSR-\n * and transport-agnostic.\n *\n * ## How it reads (the seam)\n *\n * The unified read transport intentionally has NO raw account fetch, and the\n * litesvm e2e harness has no RPC — so a task read cannot be assumed from\n * context. `useTaskStatus` therefore takes a **`taskReader`**: an async\n * `(pda) => Promise<Task | null>`. Callers wire it from whatever they have:\n * - a kit RPC: `(pda) => getTaskDecoder().decode(...)` over `getAccountInfo`\n * (the SDK's `waitForTaskStatus` uses exactly this `getAccountInfo` shape);\n * - litesvm e2e: `(pda) => decode(svm.getAccount(pda))`.\n * A reader-less call returns the idle state (and a clear `error` if `poll` was\n * requested) rather than guessing a transport.\n *\n * ## Polling vs. subscription (SSR-safe, cleaned up)\n *\n * - Polling: TanStack Query `refetchInterval` re-runs `taskReader` until the\n * task reaches a terminal status (`Completed`/`Cancelled`/`RejectFrozen`) or\n * the optional `targetStatus` — then stops.\n * - Subscription: when an `events` async-iterable is supplied (e.g. from the\n * SDK's `subscribeMarketplaceEvents`), a `useEffect` (browser-only; never runs\n * during SSR) drains it, appends each event to `events`, and triggers a\n * refetch so status stays fresh without tight polling. The effect aborts the\n * iterable and clears state on unmount.\n *\n * @module hooks/useTaskStatus\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { TaskStatus, type Task } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** Reads a Task account, returning the decoded {@link Task} or null if absent. */\nexport type TaskReader = (pda: Address | string) => Promise<Task | null>;\n\n/**\n * A single coordination event observed for the watched task. Kept loosely typed\n * (the SDK's `AgencEvent` union) so this hook does not pin the event schema.\n */\nexport type ObservedEvent = unknown;\n\n/**\n * An async source of coordination events for the watched task. Pass the result\n * of the SDK's `subscribeMarketplaceEvents(...)` (already address-filtered) or\n * any async iterable. Optional.\n */\nexport type TaskEventsSource = AsyncIterable<ObservedEvent>;\n\n/** Options for {@link useTaskStatus}. */\nexport interface UseTaskStatusOptions {\n /**\n * How to read the Task account. REQUIRED for any live status — without it the\n * hook stays idle. See the module doc for wiring patterns.\n */\n taskReader?: TaskReader;\n /**\n * Optional event source. When given, observed events are appended to\n * `events` and each triggers a refetch. Drained in a browser-only effect and\n * aborted on unmount.\n */\n events?: TaskEventsSource;\n /**\n * Stop polling once the task reaches this status (in addition to terminal\n * statuses). Useful to await a specific transition (e.g. `Completed`).\n */\n targetStatus?: TaskStatus;\n /** Poll interval in ms while non-terminal. Default `2000`. */\n pollIntervalMs?: number;\n /** Disable the hook entirely. Default `true` when `taskPda` + reader exist. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useTaskStatus}. */\nexport interface UseTaskStatusResult {\n /** The decoded Task, or null until first read. */\n task: Task | null;\n /** The task status, or null until first read. */\n status: TaskStatus | null;\n /**\n * The submission projection. v1 surfaces the task's on-chain `result` bytes\n * (the worker's submitted result) once present; a richer submission read\n * lands with the indexer projection. `null` until a result exists.\n */\n submission: Uint8Array | null;\n /** Coordination events observed for this task (chronological). */\n events: ObservedEvent[];\n /** True while the first read is in flight. */\n isLoading: boolean;\n /** The read error, or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/** Statuses after which no further transition is possible (stop polling). */\nconst TERMINAL_STATUSES: ReadonlySet<TaskStatus> = new Set([\n TaskStatus.Completed,\n TaskStatus.Cancelled,\n TaskStatus.RejectFrozen,\n]);\n\n/** True when the task's `result` bytes are present and non-empty. */\nfunction hasResult(task: Task | null): boolean {\n return task !== null && task.result.length > 0 && task.result.some((b) => b !== 0);\n}\n\n/**\n * Watch a task's status.\n *\n * @param taskPda - The Task PDA to watch (falsy disables the hook).\n * @param options - Reader, event source, target status, poll interval.\n * @returns {@link UseTaskStatusResult}.\n */\nexport function useTaskStatus(\n taskPda: Address | string | undefined | null,\n options?: UseTaskStatusOptions,\n): UseTaskStatusResult {\n // Touch context so the hook is provider-bound (and throws clearly outside it),\n // matching every other hook's contract even though reads come via the reader.\n useAgencContext();\n\n const reader = options?.taskReader;\n const enabled =\n (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);\n const pollIntervalMs = options?.pollIntervalMs ?? 2000;\n\n const [events, setEvents] = useState<ObservedEvent[]>([]);\n\n const query = useQuery<Task | null, Error>({\n queryKey: queryKeys.taskStatus(taskPda ? pdaKey(taskPda) : \"\"),\n enabled,\n queryFn: () => reader!(taskPda as Address | string),\n // Poll until terminal / target reached; then stop (return `false`).\n refetchInterval: (q) => {\n const task = q.state.data ?? null;\n if (task === null) return pollIntervalMs;\n if (TERMINAL_STATUSES.has(task.status)) return false;\n if (\n options?.targetStatus !== undefined &&\n task.status === options.targetStatus\n ) {\n return false;\n }\n return pollIntervalMs;\n },\n });\n\n // Drain the optional event source in a browser-only effect (never during SSR;\n // effects don't run on the server). Abort + reset on unmount / source change.\n const refetchRef = useRef(query.refetch);\n refetchRef.current = query.refetch;\n const eventsSource = options?.events;\n useEffect(() => {\n if (!eventsSource) return;\n let cancelled = false;\n (async () => {\n try {\n for await (const ev of eventsSource) {\n if (cancelled) break;\n setEvents((prev) => [...prev, ev]);\n // A status-changing event landed — pull a fresh read.\n void refetchRef.current();\n }\n } catch {\n // A torn-down subscription (unmount) surfaces as an iterator throw;\n // swallow it — the read query owns the surfaced error channel.\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [eventsSource]);\n\n const task = query.data ?? null;\n return {\n task,\n status: task?.status ?? null,\n submission: hasResult(task) ? Uint8Array.from(task!.result) : null,\n events,\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useSubmissionReview(taskPda)` — buyer-side settlement actions.\n *\n * Exposes the three creator review verbs for a task in `PendingValidation`:\n * - `accept(...)` — accept the result and settle the escrow to the worker\n * (`client.acceptTaskResult`, a named client convenience);\n * - `reject(...)` — reject the result with a rejection hash\n * (`facade.rejectTaskResult` -> `client.send`);\n * - `requestChanges(...)` — return the task to the worker with a changes hash\n * (`facade.requestChanges` -> `client.send`).\n *\n * Each verb is its own mutation so a UI can show independent\n * pending/error/success per button. Typed `AgencError`s surface UNTOUCHED.\n *\n * The `task` PDA is bound at hook construction; callers pass only the per-call\n * settlement parties (worker / treasury / hashes) the SDK cannot derive.\n *\n * @module hooks/useSubmissionReview\n */\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { facade, type facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { requireClient } from \"./internal.js\";\n\n/** Per-call input for `accept` (task auto-bound; signer defaults to the client). */\nexport type AcceptInput = Omit<\n Parameters<typeof facadeNs.acceptTaskResult>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.acceptTaskResult>[0][\"creator\"];\n};\n\n/** Per-call input for `reject`. */\nexport type RejectInput = Omit<\n Parameters<typeof facadeNs.rejectTaskResult>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.rejectTaskResult>[0][\"creator\"];\n};\n\n/** Per-call input for `requestChanges`. */\nexport type RequestChangesInput = Omit<\n Parameters<typeof facadeNs.requestChanges>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.requestChanges>[0][\"creator\"];\n};\n\n/** Lifecycle status of a review verb. */\nexport type ReviewStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\n/** A single review verb's surface. */\nexport interface ReviewAction<TInput> {\n /** Run the action. Resolves to the tx signature; rejects with `AgencError`. */\n (input: TInput): Promise<string>;\n}\n\n/** Return value of {@link useSubmissionReview}. */\nexport interface UseSubmissionReviewResult {\n /** Accept the result and settle to the worker. */\n accept: ReviewAction<AcceptInput>;\n /** Reject the result (with a rejection hash). */\n reject: ReviewAction<RejectInput>;\n /** Request changes (with a changes hash), returning the task to the worker. */\n requestChanges: ReviewAction<RequestChangesInput>;\n /** Aggregate status: `pending` if any verb is in flight, else last settled. */\n status: ReviewStatus;\n /** The most recent error across the three verbs, or null. */\n error: Error | null;\n /** Signature of the last successful action, or null. */\n signature: string | null;\n /** Reset all three mutations to idle. */\n reset: () => void;\n}\n\nfunction statusOf(m: {\n isPending: boolean;\n isError: boolean;\n isSuccess: boolean;\n}): ReviewStatus {\n if (m.isPending) return \"pending\";\n if (m.isError) return \"error\";\n if (m.isSuccess) return \"success\";\n return \"idle\";\n}\n\n/**\n * Buyer-side review actions for one task.\n *\n * @param taskPda - The Task PDA under review (bound to every verb).\n * @returns {@link UseSubmissionReviewResult}.\n */\nexport function useSubmissionReview(\n taskPda: Parameters<typeof facadeNs.acceptTaskResult>[0][\"task\"],\n): UseSubmissionReviewResult {\n const ctx = useAgencContext();\n\n const acceptMut = useMutation<string, Error, AcceptInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.acceptTaskResult({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.acceptTaskResult>[0]);\n return signature;\n },\n });\n\n const rejectMut = useMutation<string, Error, RejectInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const ix = await facade.rejectTaskResult({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.rejectTaskResult>[0]);\n const { signature } = await client.send([ix]);\n return signature;\n },\n });\n\n const requestChangesMut = useMutation<string, Error, RequestChangesInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const ix = await facade.requestChanges({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.requestChanges>[0]);\n const { signature } = await client.send([ix]);\n return signature;\n },\n });\n\n const accept = useCallback<ReviewAction<AcceptInput>>(\n (input) => acceptMut.mutateAsync(input),\n [acceptMut],\n );\n const reject = useCallback<ReviewAction<RejectInput>>(\n (input) => rejectMut.mutateAsync(input),\n [rejectMut],\n );\n const requestChanges = useCallback<ReviewAction<RequestChangesInput>>(\n (input) => requestChangesMut.mutateAsync(input),\n [requestChangesMut],\n );\n\n const anyPending =\n acceptMut.isPending || rejectMut.isPending || requestChangesMut.isPending;\n const status: ReviewStatus = anyPending\n ? \"pending\"\n : statusOf(\n // Surface the most recently-touched verb's terminal state.\n [acceptMut, rejectMut, requestChangesMut].find(\n (m) => m.isError || m.isSuccess,\n ) ?? acceptMut,\n );\n\n const error =\n acceptMut.error ?? rejectMut.error ?? requestChangesMut.error ?? null;\n const signature =\n acceptMut.data ?? rejectMut.data ?? requestChangesMut.data ?? null;\n\n return {\n accept,\n reject,\n requestChanges,\n status,\n error,\n signature,\n reset: () => {\n acceptMut.reset();\n rejectMut.reset();\n requestChangesMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\nimport { resolveActivationModerationAccounts } from \"./moderation-attestor.js\";\n\nexport type TaskActivationInput = Omit<\n Parameters<typeof facadeNs.setTaskJobSpec>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.setTaskJobSpec>[0][\"creator\"];\n};\n\nexport type TaskActivationStatus = MutationStatus;\n\nexport interface UseTaskActivationResult {\n activate: (input: TaskActivationInput) => Promise<string>;\n status: TaskActivationStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskActivation(\n taskPda: Parameters<typeof facadeNs.setTaskJobSpec>[0][\"task\"],\n): UseTaskActivationResult {\n const ctx = useAgencContext();\n const mutation = useMutation<string, Error, TaskActivationInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n // P1.2: the publish gate names an explicit `moderator` (supplied by the\n // caller — the trust decision) and needs the roster-entry PDA when that\n // moderator is a registered attestor, plus a record override when the\n // attestation predates the upgrade (legacy grace window). Resolve the\n // mechanics automatically unless the caller supplied any of them.\n const callerResolved =\n input.moderationAttestor !== undefined ||\n input.moderatorIsAttestor !== undefined ||\n input.taskModeration !== undefined;\n const resolved = callerResolved\n ? {}\n : await resolveActivationModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n task: taskPda,\n jobSpecHash: input.jobSpecHash,\n moderator: input.moderator,\n });\n const { signature } = await client.setTaskJobSpec({\n ...input,\n ...resolved,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.setTaskJobSpec>[0]);\n return signature;\n },\n });\n\n const activate = useCallback(\n (input: TaskActivationInput) => mutation.mutateAsync(input),\n [mutation],\n );\n\n return {\n activate,\n status: mutationStatusOf(mutation),\n signature: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset: mutation.reset,\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { findTaskPda } from \"@tetsuo-ai/marketplace-sdk\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport {\n mutationStatusOf,\n requireClient,\n resolveReferrerArgs,\n signerAddress,\n withoutReferrerArgs,\n type MutationStatus,\n} from \"./internal.js\";\nimport {\n resolveActivationModerationAccounts,\n resolveHireListingModerationAccounts,\n type HireListingModerationAccounts,\n} from \"./moderation-attestor.js\";\nimport type { HumanlessHireInput } from \"./useHire.js\";\nimport type { TaskActivationInput } from \"./useTaskActivation.js\";\n\nexport type HumanlessHireFlowPhase =\n | \"idle\"\n | \"hiring\"\n | \"moderating\"\n | \"activating\"\n | \"activated\"\n | \"error\";\n\nexport type HumanlessHireFlowStatus = MutationStatus;\n\nexport type HumanlessHireFlowHireInput = Omit<\n HumanlessHireInput,\n \"humanless\" | \"creator\" | \"referrer\" | \"referrerFeeBps\"\n>;\n\nexport type HumanlessHireFlowActivationInput = Omit<\n TaskActivationInput,\n \"creator\" | \"jobSpecHash\" | \"jobSpecUri\" | \"moderator\"\n> & {\n /**\n * Override the activation `moderator` (P1.2). Defaults to the `moderator`\n * returned by `hostAndModerateJobSpec` — the attestation service that\n * signed the task moderation is whose record the publish gate consumes.\n */\n moderator?: TaskActivationInput[\"moderator\"];\n};\n\nexport type HumanlessHireFlowCreator = HumanlessHireInput[\"creator\"];\n\nexport type HumanlessHireFlowJobSpecHash =\n Parameters<typeof facadeNs.setTaskJobSpec>[0][\"jobSpecHash\"];\n\nexport interface HumanlessHireFlowModerationResult {\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n moderationAttested: boolean;\n /**\n * The pubkey that signed/recorded the task attestation (P1.2) — the\n * attestation service's signer (e.g. attest.agenc.ag `GET /v1/info` →\n * `moderator`). Names whose record the publish gate consumes.\n */\n moderator: Address;\n moderation?: unknown;\n}\n\nexport interface HumanlessHireFlowHostInput<TJobSpec> {\n taskPda: Address;\n taskId: HumanlessHireFlowHireInput[\"taskId\"];\n listing: HumanlessHireFlowHireInput[\"listing\"];\n jobSpec: TJobSpec;\n hireSignature: string;\n referrerInjected: boolean;\n}\n\nexport type HumanlessHireFlowHost<TJobSpec> = (\n input: HumanlessHireFlowHostInput<TJobSpec>,\n) => Promise<HumanlessHireFlowModerationResult>;\n\nexport interface HumanlessHireFlowInput<TJobSpec = unknown> {\n hire: HumanlessHireFlowHireInput;\n jobSpec: TJobSpec;\n hostAndModerateJobSpec: HumanlessHireFlowHost<TJobSpec>;\n activation?: HumanlessHireFlowActivationInput;\n creator?: HumanlessHireFlowCreator;\n}\n\nexport interface HumanlessHireFlowProgress {\n taskPda: Address | null;\n hireSignature: string | null;\n activationSignature: string | null;\n jobSpecHash: HumanlessHireFlowJobSpecHash | null;\n jobSpecUri: string | null;\n referrerInjected: boolean;\n}\n\nexport interface HumanlessHireFlowResult {\n taskPda: Address;\n hireSignature: string;\n activationSignature: string;\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n referrerInjected: boolean;\n moderation?: unknown;\n}\n\nexport interface UseHumanlessHireFlowResult<TJobSpec = unknown> {\n hireAndActivate: (\n input: HumanlessHireFlowInput<TJobSpec>,\n ) => Promise<HumanlessHireFlowResult>;\n phase: HumanlessHireFlowPhase;\n status: HumanlessHireFlowStatus;\n progress: HumanlessHireFlowProgress;\n result: HumanlessHireFlowResult | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nfunction emptyProgress(): HumanlessHireFlowProgress {\n return {\n taskPda: null,\n hireSignature: null,\n activationSignature: null,\n jobSpecHash: null,\n jobSpecUri: null,\n referrerInjected: false,\n };\n}\n\nfunction validateModerationResult(\n result: HumanlessHireFlowModerationResult,\n): {\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n moderator: Address;\n} {\n if (result.moderationAttested !== true) {\n throw new Error(\n \"Task moderation was not attested; activation was not signed.\",\n );\n }\n if (\n !(result.jobSpecHash instanceof Uint8Array) ||\n result.jobSpecHash.byteLength !== 32\n ) {\n throw new Error(\n \"Task moderation returned an invalid jobSpecHash; activation was not signed.\",\n );\n }\n const jobSpecUri = result.jobSpecUri.trim();\n if (!jobSpecUri) {\n throw new Error(\n \"Task moderation returned an empty jobSpecUri; activation was not signed.\",\n );\n }\n if (typeof result.moderator !== \"string\" || !result.moderator.trim()) {\n throw new Error(\n \"Task moderation returned no moderator pubkey; activation was not signed.\",\n );\n }\n return {\n jobSpecHash: result.jobSpecHash,\n jobSpecUri,\n moderator: result.moderator,\n };\n}\n\nexport function useHumanlessHireFlow<TJobSpec = unknown>(): UseHumanlessHireFlowResult<TJobSpec> {\n const ctx = useAgencContext();\n const [phase, setPhase] = useState<HumanlessHireFlowPhase>(\"idle\");\n const [progress, setProgress] =\n useState<HumanlessHireFlowProgress>(emptyProgress);\n const flowInFlight = useRef(false);\n\n const mutation = useMutation<\n HumanlessHireFlowResult,\n Error,\n HumanlessHireFlowInput<TJobSpec>\n >({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const creator = input.creator ?? client.signer;\n const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);\n const hireInput = withoutReferrerArgs(input.hire);\n\n setPhase(\"hiring\");\n setProgress(emptyProgress());\n\n try {\n // P1.2: resolve the hire gate's moderation mechanics (roster PDA /\n // legacy record override) unless the caller supplied any of them.\n const hireListingSpecHash = input.hire.listingSpecHash;\n let hireModerationArgs: HireListingModerationAccounts = {};\n if (\n input.hire.moderationAttestor === undefined &&\n input.hire.moderatorIsAttestor === undefined &&\n input.hire.listingModeration === undefined &&\n hireListingSpecHash !== undefined\n ) {\n hireModerationArgs = await resolveHireListingModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n listing: input.hire.listing,\n listingSpecHash: hireListingSpecHash,\n moderator: input.hire.moderator,\n });\n }\n const hireResult = await client.hireFromListingHumanless({\n ...hireInput,\n ...hireModerationArgs,\n creator,\n ...referrerArgs,\n } as Parameters<typeof facadeNs.hireFromListingHumanless>[0]);\n\n const [taskPda] = await findTaskPda({\n creator: signerAddress(creator),\n taskId: input.hire.taskId,\n });\n\n setProgress({\n ...emptyProgress(),\n taskPda,\n hireSignature: hireResult.signature,\n referrerInjected,\n });\n\n setPhase(\"moderating\");\n const moderation = await input.hostAndModerateJobSpec({\n taskPda,\n taskId: input.hire.taskId,\n listing: input.hire.listing,\n jobSpec: input.jobSpec,\n hireSignature: hireResult.signature,\n referrerInjected,\n });\n const { jobSpecHash, jobSpecUri, moderator } =\n validateModerationResult(moderation);\n\n setProgress((current) => ({\n ...current,\n jobSpecHash,\n jobSpecUri,\n }));\n\n setPhase(\"activating\");\n // P1.2: the publish gate consumes the record of the moderator that\n // signed the attestation (the host callback's service by default).\n // Resolve the gate mechanics (roster PDA / legacy record override)\n // unless the caller supplied any of them.\n const activationModerator = input.activation?.moderator ?? moderator;\n const activationCallerResolved =\n input.activation?.moderationAttestor !== undefined ||\n input.activation?.moderatorIsAttestor !== undefined ||\n input.activation?.taskModeration !== undefined;\n const activationModerationArgs = activationCallerResolved\n ? {}\n : await resolveActivationModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n task: taskPda,\n jobSpecHash,\n moderator: activationModerator,\n });\n const activationResult = await client.setTaskJobSpec({\n ...(input.activation ?? {}),\n ...activationModerationArgs,\n task: taskPda,\n creator,\n jobSpecHash,\n jobSpecUri,\n moderator: activationModerator,\n } as Parameters<typeof facadeNs.setTaskJobSpec>[0]);\n\n const result: HumanlessHireFlowResult = {\n taskPda,\n hireSignature: hireResult.signature,\n activationSignature: activationResult.signature,\n jobSpecHash,\n jobSpecUri,\n referrerInjected,\n moderation: moderation.moderation,\n };\n\n setProgress((current) => ({\n ...current,\n activationSignature: activationResult.signature,\n }));\n setPhase(\"activated\");\n return result;\n } catch (error) {\n setPhase(\"error\");\n throw error;\n }\n },\n });\n\n const hireAndActivate = useCallback(\n async (input: HumanlessHireFlowInput<TJobSpec>) => {\n if (flowInFlight.current) {\n throw new Error(\"A humanless hire flow is already in progress.\");\n }\n flowInFlight.current = true;\n try {\n return await mutation.mutateAsync(input);\n } finally {\n flowInFlight.current = false;\n }\n },\n [mutation],\n );\n\n const reset = useCallback(() => {\n mutation.reset();\n setPhase(\"idle\");\n setProgress(emptyProgress());\n }, [mutation]);\n\n return {\n hireAndActivate,\n phase,\n status: mutationStatusOf(mutation),\n progress,\n result: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset,\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type ClaimTaskInput = Omit<\n Parameters<typeof facadeNs.claimTaskWithJobSpec>[0],\n \"task\"\n>;\nexport type SubmitTaskResultInput = Omit<\n Parameters<typeof facadeNs.submitTaskResult>[0],\n \"task\"\n>;\nexport type TaskWorkStatus = MutationStatus;\n\nexport interface UseTaskWorkResult {\n claim: (input: ClaimTaskInput) => Promise<string>;\n submit: (input: SubmitTaskResultInput) => Promise<string>;\n status: TaskWorkStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskWork(\n taskPda: Parameters<typeof facadeNs.claimTaskWithJobSpec>[0][\"task\"],\n): UseTaskWorkResult {\n const ctx = useAgencContext();\n const claimMut = useMutation<string, Error, ClaimTaskInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.claimTaskWithJobSpec({\n ...input,\n task: taskPda,\n } as Parameters<typeof facadeNs.claimTaskWithJobSpec>[0]);\n return signature;\n },\n });\n const submitMut = useMutation<string, Error, SubmitTaskResultInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.submitTaskResult({\n ...input,\n task: taskPda,\n } as Parameters<typeof facadeNs.submitTaskResult>[0]);\n return signature;\n },\n });\n\n const claim = useCallback((input: ClaimTaskInput) => claimMut.mutateAsync(input), [claimMut]);\n const submit = useCallback(\n (input: SubmitTaskResultInput) => submitMut.mutateAsync(input),\n [submitMut],\n );\n const active = claimMut.isPending || submitMut.isPending;\n const latest = [claimMut, submitMut].find((m) => m.isError || m.isSuccess) ?? claimMut;\n\n return {\n claim,\n submit,\n status: active ? \"pending\" : mutationStatusOf(latest),\n signature: latest.data ?? null,\n error: claimMut.error ?? submitMut.error ?? null,\n isPending: active,\n reset: () => {\n claimMut.reset();\n submitMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type CancelTaskInput = Omit<\n Parameters<typeof facadeNs.cancelTask>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.cancelTask>[0][\"authority\"];\n};\nexport type CloseTaskInput = Omit<\n Parameters<typeof facadeNs.closeTask>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.closeTask>[0][\"authority\"];\n};\nexport type AutoAcceptTaskResultInput = Omit<\n Parameters<typeof facadeNs.autoAcceptTaskResult>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.autoAcceptTaskResult>[0][\"authority\"];\n};\nexport type TaskLifecycleStatus = MutationStatus;\n\nexport interface UseTaskLifecycleResult {\n cancel: (input?: CancelTaskInput) => Promise<string>;\n close: (input?: CloseTaskInput) => Promise<string>;\n autoAccept: (input: AutoAcceptTaskResultInput) => Promise<string>;\n status: TaskLifecycleStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskLifecycle(\n taskPda: Parameters<typeof facadeNs.cancelTask>[0][\"task\"],\n): UseTaskLifecycleResult {\n const ctx = useAgencContext();\n const cancelMut = useMutation<string, Error, CancelTaskInput | undefined>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.cancelTask({\n ...(input ?? {}),\n task: taskPda,\n authority: input?.authority ?? client.signer,\n } as Parameters<typeof facadeNs.cancelTask>[0]);\n return signature;\n },\n });\n const closeMut = useMutation<string, Error, CloseTaskInput | undefined>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.closeTask({\n ...(input ?? {}),\n task: taskPda,\n authority: input?.authority ?? client.signer,\n } as Parameters<typeof facadeNs.closeTask>[0]);\n return signature;\n },\n });\n const autoAcceptMut = useMutation<string, Error, AutoAcceptTaskResultInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.autoAcceptTaskResult({\n ...input,\n task: taskPda,\n authority: input.authority ?? client.signer,\n } as Parameters<typeof facadeNs.autoAcceptTaskResult>[0]);\n return signature;\n },\n });\n\n const cancel = useCallback(\n (input?: CancelTaskInput) => cancelMut.mutateAsync(input),\n [cancelMut],\n );\n const close = useCallback(\n (input?: CloseTaskInput) => closeMut.mutateAsync(input),\n [closeMut],\n );\n const autoAccept = useCallback(\n (input: AutoAcceptTaskResultInput) => autoAcceptMut.mutateAsync(input),\n [autoAcceptMut],\n );\n const active = cancelMut.isPending || closeMut.isPending || autoAcceptMut.isPending;\n const latest =\n [cancelMut, closeMut, autoAcceptMut].find((m) => m.isError || m.isSuccess) ?? cancelMut;\n\n return {\n cancel,\n close,\n autoAccept,\n status: active ? \"pending\" : mutationStatusOf(latest),\n signature: latest.data ?? null,\n error: cancelMut.error ?? closeMut.error ?? autoAcceptMut.error ?? null,\n isPending: active,\n reset: () => {\n cancelMut.reset();\n closeMut.reset();\n autoAcceptMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type RateHireInput = Omit<\n Parameters<typeof facadeNs.rateHire>[0],\n \"task\" | \"buyer\"\n> & {\n buyer?: Parameters<typeof facadeNs.rateHire>[0][\"buyer\"];\n};\nexport type RateHireStatus = MutationStatus;\n\nexport interface UseRateHireResult {\n rate: (input: RateHireInput) => Promise<string>;\n status: RateHireStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useRateHire(\n taskPda: Parameters<typeof facadeNs.rateHire>[0][\"task\"],\n): UseRateHireResult {\n const ctx = useAgencContext();\n const mutation = useMutation<string, Error, RateHireInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.rateHire({\n ...input,\n task: taskPda,\n buyer: input.buyer ?? client.signer,\n } as Parameters<typeof facadeNs.rateHire>[0]);\n return signature;\n },\n });\n const rate = useCallback((input: RateHireInput) => mutation.mutateAsync(input), [mutation]);\n return {\n rate,\n status: mutationStatusOf(mutation),\n signature: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset: mutation.reset,\n };\n}\n","/**\n * `useDispute(taskPda)` — dispute entry point + state for one task.\n *\n * Reads the task's `Dispute` account (via an injected reader seam — same reason\n * as `useTaskStatus`: the unified read transport has no raw account fetch and\n * litesvm has no RPC) and exposes `initiate(...)` which opens a dispute through\n * the write client (`client.initiateDispute`). Typed `AgencError`s surface\n * UNTOUCHED.\n *\n * @module hooks/useDispute\n */\nimport { useMutation, useQuery } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport {\n type Dispute,\n type facade as facadeNs,\n} from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport { pdaKey, queryKeys, requireClient } from \"./internal.js\";\n\n/** Reads a Dispute account for a task, returning the decoded value or null. */\nexport type DisputeReader = (\n taskPda: Address | string,\n) => Promise<Dispute | null>;\n\n/**\n * Per-call input for `initiate(...)`. This is the SDK `facade.initiateDispute`\n * input minus the fee-payer `authority` signer (defaulted to the client's\n * signer; pass it to override). `task` is bound at hook construction.\n */\nexport type InitiateDisputeInput = Omit<\n Parameters<typeof facadeNs.initiateDispute>[0],\n \"task\" | \"authority\"\n> & {\n /** Override the initiator authority signer (defaults to the client signer). */\n authority?: Parameters<typeof facadeNs.initiateDispute>[0][\"authority\"];\n};\n\n/** Lifecycle status of the initiate mutation. */\nexport type DisputeStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\n/** Options for {@link useDispute}. */\nexport interface UseDisputeOptions {\n /** How to read the Dispute account. Without it the read stays idle. */\n disputeReader?: DisputeReader;\n /** Disable the read query. Default `true` when `taskPda` + reader exist. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useDispute}. */\nexport interface UseDisputeResult {\n /** The decoded dispute, or null (none open / not yet read). */\n dispute: Dispute | null;\n /** Open a dispute. Resolves to the tx signature; rejects with `AgencError`. */\n initiate: (input: InitiateDisputeInput) => Promise<string>;\n /** Status of the initiate mutation. */\n status: DisputeStatus;\n /** Signature of the last successful initiate, or null. */\n signature: string | null;\n /** The read OR initiate error, or null. */\n error: Error | null;\n /** True while reading the dispute. */\n isLoading: boolean;\n /** Force a dispute refetch. */\n refetch: () => void;\n /** Reset the initiate mutation. */\n reset: () => void;\n}\n\n/**\n * Dispute entry + state for one task.\n *\n * @param taskPda - The Task PDA (falsy disables the read).\n * @param options - Reader + enabled.\n * @returns {@link UseDisputeResult}.\n */\nexport function useDispute(\n taskPda: Address | string | undefined | null,\n options?: UseDisputeOptions,\n): UseDisputeResult {\n const ctx = useAgencContext();\n const reader = options?.disputeReader;\n const enabled =\n (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);\n\n const read = useQuery<Dispute | null, Error>({\n queryKey: queryKeys.dispute(taskPda ? pdaKey(taskPda) : \"\"),\n enabled,\n queryFn: () => reader!(taskPda as Address | string),\n });\n\n const mutation = useMutation<string, Error, InitiateDisputeInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.initiateDispute({\n ...input,\n task: taskPda as Address,\n authority: input.authority ?? client.signer,\n } as Parameters<typeof facadeNs.initiateDispute>[0]);\n // A new dispute exists — refresh the read.\n void read.refetch();\n return signature;\n },\n });\n\n const initiate = useCallback(\n (input: InitiateDisputeInput) => mutation.mutateAsync(input),\n [mutation],\n );\n\n const status: DisputeStatus = mutation.isPending\n ? \"pending\"\n : mutation.isError\n ? \"error\"\n : mutation.isSuccess\n ? \"success\"\n : \"idle\";\n\n return {\n dispute: read.data ?? null,\n initiate,\n status,\n signature: mutation.data ?? null,\n error: mutation.error ?? read.error ?? null,\n isLoading: read.isLoading,\n refetch: () => void read.refetch(),\n reset: mutation.reset,\n };\n}\n","/**\n * `useReferrerEarnings(wallet)` — aggregated referrer earnings (P3.8).\n *\n * ## Data source\n *\n * `GET <earningsBase>/api/explorer/referrers/:wallet/hires` — the hosted\n * explorer endpoint that sums the referrer leg over SETTLED hires with the\n * program's own split math (shipped 2026-07-03; ground-truthed against the\n * cross-node canary's on-chain legs). `earningsBase` resolves from\n * `config.indexer.baseUrl` when set, else the per-network hosted default\n * (mainnet only). When no base resolves (localnet/devnet without an indexer),\n * the hook returns the documented not-live zero state and makes NO network\n * request — it NEVER fabricates earnings; a fetch failure surfaces as\n * `error` with zero totals, never invented numbers.\n *\n * @module hooks/useReferrerEarnings\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { t } from \"../strings/index.js\";\nimport type { Address, AgencContextValue, AgencNetwork } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/**\n * Hosted explorer bases serving the earnings endpoints, per network. Only\n * mainnet has one today; an explicit `config.indexer.baseUrl` always wins.\n */\nconst EARNINGS_INDEXER_DEFAULTS: Partial<Record<AgencNetwork, string>> = {\n mainnet: \"https://api.agenc.ag\",\n};\n\n/** Resolve the earnings endpoint base, or `null` (not live) when none. */\nfunction resolveEarningsBaseUrl(ctx: AgencContextValue): string | null {\n return ctx.indexerBaseUrl ?? EARNINGS_INDEXER_DEFAULTS[ctx.network] ?? null;\n}\n\n/** A single referral-earning hire. */\nexport interface ReferrerHire {\n /** The minted Task PDA of the referred hire. */\n taskPda: string;\n /** The HireRecord PDA carrying the snapshotted referrer fields. */\n hireRecordPda: string;\n /** Referral fee earned on this hire, in lamports. */\n feeLamports: bigint;\n /** Transaction signature of the hire (empty until event indexing lands). */\n signature: string;\n}\n\n/** Return value of {@link useReferrerEarnings}. */\nexport interface UseReferrerEarningsResult {\n /**\n * Whether aggregated referral earnings are live. Settlement may be live even\n * when this is false; false means the numbers below are the documented\n * not-live zero state, not real data.\n */\n live: boolean;\n /** Total lamports earned. `0n` while not live (never fabricated). */\n totalLamports: bigint;\n /** Per-hire earnings. `[]` while not live. */\n hires: ReferrerHire[];\n /** True while a fetch is in flight. */\n isLoading: boolean;\n /** The fetch error, or null. */\n error: Error | null;\n /**\n * Human-readable reason the data is not live (the capability reason). Present\n * while `live` is false.\n */\n reason?: string;\n /** Force a refetch (no-op while not live). */\n refetch: () => void;\n}\n\n/** The endpoint's wire shape (lamports as decimal strings). */\ninterface EarningsWire {\n totalLamports?: string;\n hires?: Array<{\n taskPda?: string;\n hireRecordPda?: string;\n feeLamports?: string;\n signature?: string;\n }>;\n}\n\n/**\n * Read a referrer wallet's aggregated earnings from the hosted explorer.\n *\n * @param wallet - The referrer wallet (base58 / Address). Falsy disables the\n * fetch; the not-live state is still returned.\n * @returns {@link UseReferrerEarningsResult}\n *\n * @example\n * ```tsx\n * const { live, totalLamports, hires, reason } = useReferrerEarnings(myWallet);\n * ```\n */\nexport function useReferrerEarnings(\n wallet: Address | string | undefined | null,\n): UseReferrerEarningsResult {\n const ctx = useAgencContext();\n const capability = ctx.resolveReferrerCapability();\n const earningsBase = resolveEarningsBaseUrl(ctx);\n\n // Live only when settlement capability holds AND an earnings endpoint base\n // resolves. No base (localnet/devnet without an indexer) = the documented\n // not-live zero state, zero network requests.\n const enabled = capability.live && earningsBase !== null && Boolean(wallet);\n\n const query = useQuery<{ totalLamports: bigint; hires: ReferrerHire[] }, Error>(\n {\n queryKey: queryKeys.referrerEarnings(wallet ? pdaKey(wallet) : \"\"),\n enabled,\n queryFn: async () => {\n const url = `${earningsBase}/api/explorer/referrers/${encodeURIComponent(\n String(wallet),\n )}/hires`;\n const response = await fetch(url, {\n headers: { accept: \"application/json\" },\n });\n if (!response.ok) {\n throw new Error(\n t(\"referrer.earningsFetchFailed\") + ` (HTTP ${response.status})`,\n );\n }\n const body = (await response.json()) as EarningsWire;\n // Lamports arrive as decimal strings; parse to bigint. Anything\n // malformed throws (surfaces as `error`) — never silently coerced.\n const hires: ReferrerHire[] = (body.hires ?? []).map((h) => ({\n taskPda: String(h.taskPda ?? \"\"),\n hireRecordPda: String(h.hireRecordPda ?? \"\"),\n feeLamports: BigInt(h.feeLamports ?? \"0\"),\n signature: String(h.signature ?? \"\"),\n }));\n return {\n totalLamports: BigInt(body.totalLamports ?? \"0\"),\n hires,\n };\n },\n },\n );\n\n if (!enabled) {\n // The documented not-live state. Zeroes are HONEST (no data was read),\n // not fabricated, and no request was made.\n return {\n live: false,\n totalLamports: 0n,\n hires: [],\n isLoading: false,\n error: null,\n reason: capability.live\n ? t(\"referrer.earningsNotLiveReason\")\n : (capability.reason ?? t(\"referrer.notLiveReason\")),\n refetch: () => {\n /* no-op while not live */\n },\n };\n }\n\n return {\n live: true,\n totalLamports: query.data?.totalLamports ?? 0n,\n hires: query.data?.hires ?? [],\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useListings.ts","../../src/hooks/useListing.ts","../../src/hooks/useAgentTrackRecord.ts","../../src/hooks/useTaskStatus.ts","../../src/hooks/useSubmissionReview.ts","../../src/hooks/useTaskActivation.ts","../../src/hooks/useHumanlessHireFlow.ts","../../src/hooks/useTaskWork.ts","../../src/hooks/useTaskLifecycle.ts","../../src/hooks/useRateHire.ts","../../src/hooks/useDispute.ts","../../src/hooks/useCompletionBond.ts","../../src/hooks/useReferrerEarnings.ts"],"names":["useQuery","useState","task","signature","useCallback","useMutation","useRef"],"mappings":";;;;;;;;AAuEA,IAAM,iBAAA,GAAoB,EAAA;AAgBnB,SAAS,WAAA,CACd,QACA,OAAA,EACmB;AACnB,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,eAAA,EAAgB;AACjC,EAAA,MAAM,QAAA,GAAW,SAAS,QAAA,IAAY,iBAAA;AACtC,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,IAAW,IAAA;AAEpC,EAAA,MAAM,QAAQ,QAAA,CAA8B;AAAA,IAC1C,QAAA,EAAU,SAAA,CAAU,QAAA,CAAS,MAAM,CAAA;AAAA,IACnC,OAAA,EAAS,MAAM,IAAA,CAAK,kBAAA,CAAmB,MAAM,CAAA;AAAA,IAC7C;AAAA,GACD,CAAA;AAID,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,QAAQ,CAAA;AAE/C,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,IAAA,IAAQ,EAAC;AAG3B,EAAA,MAAM,UAAA,GAAa,KAAK,GAAA,CAAI,IAAA,CAAK,IAAI,OAAA,EAAS,QAAQ,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA;AACnE,EAAA,MAAM,QAAA,GAAW,OAAA;AAAA,IACf,MAAM,GAAA,CAAI,KAAA,CAAM,CAAA,EAAG,UAAU,CAAA;AAAA,IAC7B,CAAC,KAAK,UAAU;AAAA,GAClB;AAEA,EAAA,MAAM,SAAA,GAAY,YAAY,MAAM;AAClC,IAAA,UAAA,CAAW,CAAC,OA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OAAO;AAAA,MACL,IAAA,EAAM,KAAA;AAAA,MACN,aAAA,EAAe,EAAA;AAAA,MACf,OAAO,EAAC;AAAA,MACR,SAAA,EAAW,KAAA;AAAA,MACX,KAAA,EAAO,IAAA;AAAA,MACP,MAAA,EAAQ,WAAW,IAAA,GACf,CAAA,CAAE,gCAAgC,CAAA,GACjC,UAAA,CAAW,MAAA,IAAU,CAAA,CAAE,wBAAwB,CAAA;AAAA,MACpD,SAAS,MAAM;AAAA,MAEf;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAA;AAAA,IACN,aAAA,EAAe,KAAA,CAAM,IAAA,EAAM,aAAA,IAAiB,EAAA;AAAA,IAC5C,KAAA,EAAO,KAAA,CAAM,IAAA,EAAM,KAAA,IAAS,EAAC;AAAA,IAC7B,WAAW,KAAA,CAAM,SAAA;AAAA,IACjB,KAAA,EAAO,MAAM,KAAA,IAAS,IAAA;AAAA,IACtB,OAAA,EAAS,MAAM,KAAK,KAAA,CAAM,OAAA;AAAQ,GACpC;AACF","file":"index.js","sourcesContent":["/**\n * `useListings(filter?)` — the listing-grid read hook.\n *\n * Fetches active service listings through the provider's unified read transport\n * (indexer-first, gPA fallback — the hook never branches on which is live) and\n * caches them via TanStack Query. Filters (`provider`, `category`, `state`) are\n * forwarded verbatim to the transport, which applies server-side memcmp filters\n * (indexer/gPA) and the client-side state filter exactly as the SDK does.\n *\n * ## Pagination model (honest about the transport)\n *\n * The v1 read transport returns the FULL active-listing set in one call — there\n * is no server cursor in either backend (the gPA path can't have one; the\n * indexer's `listActiveListings` is a drop-in of it). So pagination here is a\n * client-side WINDOW over the already-fetched array: `listings` grows by\n * `pageSize` each time `fetchMore()` is called, `hasMore` reflects whether more\n * rows remain in the fetched set. This keeps one network round-trip while still\n * giving a grid an incremental-reveal API. When a future transport gains a\n * cursor, `fetchMore` can swap to `fetchNextPage` without changing this\n * surface.\n *\n * SSR-safe: no `window`/`document`; the query simply does not run until mounted\n * if the host disables it.\n *\n * @module hooks/useListings\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type {\n DecodedProgramAccount,\n ListActiveListingsOptions,\n ServiceListing,\n} from \"../types.js\";\nimport { queryKeys } from \"./internal.js\";\n\n/** A decoded active listing row (address + decoded account). */\nexport type ListingRow = DecodedProgramAccount<ServiceListing>;\n\n/** Filter for {@link useListings}. Mirrors the SDK's `ListActiveListingsOptions`. */\nexport type UseListingsFilter = ListActiveListingsOptions;\n\n/** Options for {@link useListings}. */\nexport interface UseListingsOptions {\n /** Rows revealed per page / per `fetchMore()` call. Default `12`. */\n pageSize?: number;\n /**\n * Disable the query (e.g. until a filter is ready). When `false` the hook\n * returns the idle state and makes no request. Default `true`.\n */\n enabled?: boolean;\n}\n\n/** Return value of {@link useListings}. */\nexport interface UseListingsResult {\n /** The currently-revealed window of listings (grows via `fetchMore`). */\n listings: ListingRow[];\n /** Total active listings the transport returned (the full fetched set). */\n total: number;\n /** True while the underlying fetch is in flight (first load / refetch). */\n isLoading: boolean;\n /** The fetch error (typed `AgencError` for on-chain failures), or null. */\n error: Error | null;\n /** Whether more rows remain in the fetched set to reveal. */\n hasMore: boolean;\n /** Reveal the next `pageSize` rows from the fetched set. No-op when exhausted. */\n fetchMore: () => void;\n /** Force a fresh fetch from the transport. */\n refetch: () => void;\n}\n\nconst DEFAULT_PAGE_SIZE = 12;\n\n/**\n * Read active service listings for a grid.\n *\n * @param filter - Optional provider/category/state filter (SDK semantics).\n * @param options - Page size + enabled flag.\n * @returns {@link UseListingsResult}.\n *\n * @example\n * ```tsx\n * const { listings, isLoading, fetchMore, hasMore } = useListings({\n * category: \"code-generation\",\n * });\n * ```\n */\nexport function useListings(\n filter?: UseListingsFilter,\n options?: UseListingsOptions,\n): UseListingsResult {\n const { read } = useAgencContext();\n const pageSize = options?.pageSize ?? DEFAULT_PAGE_SIZE;\n const enabled = options?.enabled ?? true;\n\n const query = useQuery<ListingRow[], Error>({\n queryKey: queryKeys.listings(filter),\n queryFn: () => read.listActiveListings(filter),\n enabled,\n });\n\n // Client-side reveal window. Reset to one page whenever the underlying data\n // changes (new fetch / filter change resets the key, which remounts data).\n const [visible, setVisible] = useState(pageSize);\n\n const all = query.data ?? [];\n // Clamp the window to [pageSize, all.length] so a filter change that shrinks\n // the set never strands `visible` above the available rows.\n const windowSize = Math.min(Math.max(visible, pageSize), all.length);\n const listings = useMemo(\n () => all.slice(0, windowSize),\n [all, windowSize],\n );\n\n const fetchMore = useCallback(() => {\n setVisible((current) => current + pageSize);\n }, [pageSize]);\n\n const refetch = useCallback(() => {\n setVisible(pageSize);\n void query.refetch();\n }, [pageSize, query]);\n\n return {\n listings,\n total: all.length,\n isLoading: query.isLoading,\n error: query.error ?? null,\n hasMore: windowSize < all.length,\n fetchMore,\n refetch,\n };\n}\n","/**\n * `useListing(pda)` — single-listing detail hook.\n *\n * Joins, in ONE cached query, the three things a listing detail / checkout view\n * needs:\n * - the decoded `ServiceListing` (via `read.getListing`);\n * - the provider's track record (via `read.agentTrackRecord(providerAgent)`),\n * keyed off the listing's `providerAgent` — indexer-native, so it is fetched\n * only when the indexer backend is live and resolves to `null` under the gPA\n * fallback (which has no trustless aggregated track record — the transport\n * throws `ReadTransportUnsupportedError`, which the hook swallows to `null`\n * rather than failing the whole join);\n * - the moderation/attestation state (see the moderation note below).\n *\n * ## Moderation (v1 scope, honest)\n *\n * The read transport does not yet expose a dedicated listing-moderation read\n * (the indexer's listing projection carries the pinned `specHash` but not an\n * attestation verdict). So `moderation` is the listing's indexer projection when\n * present (callers can read `indexer.metadataValid` / `metadataIssues` and the\n * pinned `specHash`) and `null` under the gPA fallback. A dedicated attestation\n * read lands when the indexer projects it; this hook's surface does not change.\n *\n * @module hooks/useListing\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { ReadTransportUnsupportedError } from \"../transport/index.js\";\nimport type {\n Address,\n IndexerAgentTrackRecord,\n IndexerListing,\n ServiceListing,\n} from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** The joined detail payload {@link useListing} resolves. */\nexport interface ListingDetail {\n /** The listing PDA. */\n address: Address;\n /** The decoded on-chain `ServiceListing`. */\n listing: ServiceListing;\n /** The provider's agent PDA (`ServiceListing.providerAgent`). */\n provider: Address;\n /**\n * The provider's indexer track record, or `null` when unavailable (the gPA\n * fallback has no trustless aggregated equivalent).\n */\n trackRecord: IndexerAgentTrackRecord | null;\n /**\n * The listing's indexer projection (carries `metadataValid`,\n * `metadataIssues`, the pinned `specHash`), or `null` under the gPA fallback.\n * The v1 read model does not yet project a standalone attestation verdict.\n */\n moderation: IndexerListing | null;\n}\n\n/** Options for {@link useListing}. */\nexport interface UseListingOptions {\n /** Disable the query (no `pda` yet, etc.). Default `true` when `pda` is set. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useListing}. */\nexport interface UseListingResult {\n /** The joined detail, or null until loaded. */\n detail: ListingDetail | null;\n /** The decoded listing, or null until loaded (convenience projection). */\n listing: ServiceListing | null;\n /** The provider agent PDA, or null until loaded. */\n provider: Address | null;\n /** The provider's track record, or null (unavailable / not yet loaded). */\n trackRecord: IndexerAgentTrackRecord | null;\n /** The listing's indexer/moderation projection, or null. */\n moderation: IndexerListing | null;\n /** True while loading. */\n isLoading: boolean;\n /** The error, or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/**\n * Read one listing and join its provider track record + moderation projection.\n *\n * @param pda - The ServiceListing PDA (string or Address). When falsy the query\n * is disabled.\n * @param options - `enabled` override.\n * @returns {@link UseListingResult}.\n */\nexport function useListing(\n pda: Address | string | undefined | null,\n options?: UseListingOptions,\n): UseListingResult {\n const { read } = useAgencContext();\n const enabled = (options?.enabled ?? true) && Boolean(pda);\n\n const query = useQuery<ListingDetail, Error>({\n queryKey: queryKeys.listing(pda ? pdaKey(pda) : \"\"),\n enabled,\n queryFn: async () => {\n // 1) The listing itself.\n const result = await read.getListing(pda as Address | string);\n const provider = result.account.providerAgent;\n\n // 2) The provider's track record — indexer-native. Swallow the\n // gPA-fallback \"unsupported\" rejection to null so the join still\n // resolves the listing + moderation (degrade, don't fail).\n let trackRecord: IndexerAgentTrackRecord | null = null;\n try {\n trackRecord = await read.agentTrackRecord(provider);\n } catch (err) {\n if (!(err instanceof ReadTransportUnsupportedError)) throw err;\n }\n\n return {\n address: result.address,\n listing: result.account,\n provider,\n trackRecord,\n moderation: result.indexer ?? null,\n };\n },\n });\n\n const detail = query.data ?? null;\n return {\n detail,\n listing: detail?.listing ?? null,\n provider: detail?.provider ?? null,\n trackRecord: detail?.trackRecord ?? null,\n moderation: detail?.moderation ?? null,\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useAgentTrackRecord(agentPda)` — provider reputation hook (PARTIAL, P6.6).\n *\n * Reads the indexer's reconstructed track record for an agent and projects the\n * `{ completionRate, disputeRate, slashHistory, recentOutcomes }` contract.\n *\n * ## P6.6 scope (honest about what is and isn't available)\n *\n * The v1 indexer record (`IndexerAgentTrackRecord`) is event-reconstructed and\n * exposes raw COUNTS: `completions`, `disputesInitiated`, `disputesLost`, and a\n * `slashHistory`. It does NOT yet expose the denominators a true RATE needs\n * (total tasks taken, total disputes faced) — that aggregation lands in\n * PLAN.md P6.6. So:\n * - `slashHistory` and the dispute COUNTS are real today (passed through);\n * - `completionRate` / `disputeRate` are RATIOS and are only meaningful once a\n * denominator exists. Today they are computed from the available counts where\n * a denominator is inferable (completions vs. completions+disputesLost as a\n * conservative proxy) and otherwise `null`. Treat them as provisional until\n * P6.6. The `partial` flag is the audit signal — `true` today.\n * - `recentOutcomes` is reconstructed from `slashHistory` (the only per-event\n * stream in v1); a richer outcome feed lands with P6.6.\n *\n * Indexer-native: the gPA fallback has no aggregated track record, so under it\n * `read.agentTrackRecord` throws `ReadTransportUnsupportedError` and this hook\n * surfaces that error (a track record is not reconstructable trustlessly).\n *\n * @module hooks/useAgentTrackRecord\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address, IndexerAgentTrackRecord } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** A reconstructed outcome event (v1: derived from the slash history). */\nexport interface TrackRecordOutcome {\n /** Outcome kind. v1 only reconstructs slashes from the event stream. */\n kind: \"slash\";\n /** The raw slash event from the indexer record. */\n event: IndexerAgentTrackRecord[\"slashHistory\"][number];\n}\n\n/** The projected track record {@link useAgentTrackRecord} returns. */\nexport interface AgentTrackRecord {\n /** The agent PDA. */\n agent: Address | string;\n /** Completed-task count (real today). */\n completions: number;\n /** Disputes the agent initiated (real today). */\n disputesInitiated: number;\n /** Disputes the agent lost (real today). */\n disputesLost: number;\n /**\n * Completion rate in `[0,1]`, or `null` when no denominator is inferable.\n * PROVISIONAL until P6.6 supplies the true total-tasks denominator.\n */\n completionRate: number | null;\n /**\n * Dispute rate in `[0,1]`, or `null` when no denominator is inferable.\n * PROVISIONAL until P6.6.\n */\n disputeRate: number | null;\n /** Reconstructed slash history (real today). */\n slashHistory: IndexerAgentTrackRecord[\"slashHistory\"];\n /** Reconstructed recent outcomes (v1: from slash history). */\n recentOutcomes: TrackRecordOutcome[];\n /** True while any rate is provisional/derived (P6.6 audit signal). */\n partial: boolean;\n}\n\n/** Options for {@link useAgentTrackRecord}. */\nexport interface UseAgentTrackRecordOptions {\n /** Disable the query. Default `true` when `agentPda` is set. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useAgentTrackRecord}. */\nexport interface UseAgentTrackRecordResult {\n /** The projected track record, or null until loaded. */\n trackRecord: AgentTrackRecord | null;\n /** Convenience: `trackRecord?.completionRate ?? null`. */\n completionRate: number | null;\n /** Convenience: `trackRecord?.disputeRate ?? null`. */\n disputeRate: number | null;\n /** Convenience: `trackRecord?.slashHistory ?? []`. */\n slashHistory: IndexerAgentTrackRecord[\"slashHistory\"];\n /** Convenience: `trackRecord?.recentOutcomes ?? []`. */\n recentOutcomes: TrackRecordOutcome[];\n /** True while loading. */\n isLoading: boolean;\n /** The error (e.g. `ReadTransportUnsupportedError` under gPA), or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/**\n * Project the raw indexer record into the partial track-record contract. Kept\n * exported + pure so structural tests can assert the projection directly.\n */\nexport function projectTrackRecord(\n raw: IndexerAgentTrackRecord,\n): AgentTrackRecord {\n const completions = raw.completions;\n const disputesLost = raw.disputesLost;\n // Conservative proxy denominator: settled outcomes we can SEE (completions +\n // lost disputes). This is NOT the true total-tasks denominator (P6.6); when\n // it is zero there is nothing to rate, so the rates are null.\n const settledKnown = completions + disputesLost;\n const completionRate =\n settledKnown > 0 ? completions / settledKnown : null;\n const disputeRate =\n settledKnown > 0 ? disputesLost / settledKnown : null;\n\n return {\n agent: raw.agent,\n completions,\n disputesInitiated: raw.disputesInitiated,\n disputesLost,\n completionRate,\n disputeRate,\n slashHistory: raw.slashHistory,\n recentOutcomes: raw.slashHistory.map((event) => ({\n kind: \"slash\" as const,\n event,\n })),\n // Always partial in v1: every rate is a proxy until P6.6 lands the real\n // denominators and outcome feed.\n partial: true,\n };\n}\n\n/**\n * Read an agent's (partial) track record.\n *\n * @param agentPda - The AgentRegistration PDA (falsy disables the hook).\n * @param options - `enabled` override.\n * @returns {@link UseAgentTrackRecordResult}.\n */\nexport function useAgentTrackRecord(\n agentPda: Address | string | undefined | null,\n options?: UseAgentTrackRecordOptions,\n): UseAgentTrackRecordResult {\n const { read } = useAgencContext();\n const enabled = (options?.enabled ?? true) && Boolean(agentPda);\n\n const query = useQuery<AgentTrackRecord, Error>({\n queryKey: queryKeys.agentTrackRecord(agentPda ? pdaKey(agentPda) : \"\"),\n enabled,\n queryFn: async () => {\n const raw = await read.agentTrackRecord(agentPda as Address | string);\n return projectTrackRecord(raw);\n },\n });\n\n const tr = query.data ?? null;\n return {\n trackRecord: tr,\n completionRate: tr?.completionRate ?? null,\n disputeRate: tr?.disputeRate ?? null,\n slashHistory: tr?.slashHistory ?? [],\n recentOutcomes: tr?.recentOutcomes ?? [],\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useTaskStatus(taskPda)` — live task status with a poll fallback.\n *\n * Tracks a Task account's {@link TaskStatus} (and optionally its submission and\n * the coordination events seen for it) after a hire. It is built to satisfy the\n * PLAN_2 A2 contract `{ task, status, submission, events }` while staying SSR-\n * and transport-agnostic.\n *\n * ## How it reads (the seam)\n *\n * The unified read transport intentionally has NO raw account fetch, and the\n * litesvm e2e harness has no RPC — so a task read cannot be assumed from\n * context. `useTaskStatus` therefore takes a **`taskReader`**: an async\n * `(pda) => Promise<Task | null>`. Callers wire it from whatever they have:\n * - a kit RPC: `(pda) => getTaskDecoder().decode(...)` over `getAccountInfo`\n * (the SDK's `waitForTaskStatus` uses exactly this `getAccountInfo` shape);\n * - litesvm e2e: `(pda) => decode(svm.getAccount(pda))`.\n * A reader-less call returns the idle state (and a clear `error` if `poll` was\n * requested) rather than guessing a transport.\n *\n * ## Polling vs. subscription (SSR-safe, cleaned up)\n *\n * - Polling: TanStack Query `refetchInterval` re-runs `taskReader` until the\n * task reaches a terminal status (`Completed`/`Cancelled`/`RejectFrozen`) or\n * the optional `targetStatus` — then stops.\n * - Subscription: when an `events` async-iterable is supplied (e.g. from the\n * SDK's `subscribeMarketplaceEvents`), a `useEffect` (browser-only; never runs\n * during SSR) drains it, appends each event to `events`, and triggers a\n * refetch so status stays fresh without tight polling. The effect aborts the\n * iterable and clears state on unmount.\n *\n * @module hooks/useTaskStatus\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { TaskStatus, type Task } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/** Reads a Task account, returning the decoded {@link Task} or null if absent. */\nexport type TaskReader = (pda: Address | string) => Promise<Task | null>;\n\n/**\n * A single coordination event observed for the watched task. Kept loosely typed\n * (the SDK's `AgencEvent` union) so this hook does not pin the event schema.\n */\nexport type ObservedEvent = unknown;\n\n/**\n * An async source of coordination events for the watched task. Pass the result\n * of the SDK's `subscribeMarketplaceEvents(...)` (already address-filtered) or\n * any async iterable. Optional.\n */\nexport type TaskEventsSource = AsyncIterable<ObservedEvent>;\n\n/** Options for {@link useTaskStatus}. */\nexport interface UseTaskStatusOptions {\n /**\n * How to read the Task account. REQUIRED for any live status — without it the\n * hook stays idle. See the module doc for wiring patterns.\n */\n taskReader?: TaskReader;\n /**\n * Optional event source. When given, observed events are appended to\n * `events` and each triggers a refetch. Drained in a browser-only effect and\n * aborted on unmount.\n */\n events?: TaskEventsSource;\n /**\n * Stop polling once the task reaches this status (in addition to terminal\n * statuses). Useful to await a specific transition (e.g. `Completed`).\n */\n targetStatus?: TaskStatus;\n /** Poll interval in ms while non-terminal. Default `2000`. */\n pollIntervalMs?: number;\n /** Disable the hook entirely. Default `true` when `taskPda` + reader exist. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useTaskStatus}. */\nexport interface UseTaskStatusResult {\n /** The decoded Task, or null until first read. */\n task: Task | null;\n /** The task status, or null until first read. */\n status: TaskStatus | null;\n /**\n * The submission projection. v1 surfaces the task's on-chain `result` bytes\n * (the worker's submitted result) once present; a richer submission read\n * lands with the indexer projection. `null` until a result exists.\n */\n submission: Uint8Array | null;\n /** Coordination events observed for this task (chronological). */\n events: ObservedEvent[];\n /** True while the first read is in flight. */\n isLoading: boolean;\n /** The read error, or null. */\n error: Error | null;\n /** Force a refetch. */\n refetch: () => void;\n}\n\n/** Statuses after which no further transition is possible (stop polling). */\nconst TERMINAL_STATUSES: ReadonlySet<TaskStatus> = new Set([\n TaskStatus.Completed,\n TaskStatus.Cancelled,\n TaskStatus.RejectFrozen,\n]);\n\n/** True when the task's `result` bytes are present and non-empty. */\nfunction hasResult(task: Task | null): boolean {\n return task !== null && task.result.length > 0 && task.result.some((b) => b !== 0);\n}\n\n/**\n * Watch a task's status.\n *\n * @param taskPda - The Task PDA to watch (falsy disables the hook).\n * @param options - Reader, event source, target status, poll interval.\n * @returns {@link UseTaskStatusResult}.\n */\nexport function useTaskStatus(\n taskPda: Address | string | undefined | null,\n options?: UseTaskStatusOptions,\n): UseTaskStatusResult {\n // Touch context so the hook is provider-bound (and throws clearly outside it),\n // matching every other hook's contract even though reads come via the reader.\n useAgencContext();\n\n const reader = options?.taskReader;\n const enabled =\n (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);\n const pollIntervalMs = options?.pollIntervalMs ?? 2000;\n\n const [events, setEvents] = useState<ObservedEvent[]>([]);\n\n const query = useQuery<Task | null, Error>({\n queryKey: queryKeys.taskStatus(taskPda ? pdaKey(taskPda) : \"\"),\n enabled,\n queryFn: () => reader!(taskPda as Address | string),\n // Poll until terminal / target reached; then stop (return `false`).\n refetchInterval: (q) => {\n const task = q.state.data ?? null;\n if (task === null) return pollIntervalMs;\n if (TERMINAL_STATUSES.has(task.status)) return false;\n if (\n options?.targetStatus !== undefined &&\n task.status === options.targetStatus\n ) {\n return false;\n }\n return pollIntervalMs;\n },\n });\n\n // Drain the optional event source in a browser-only effect (never during SSR;\n // effects don't run on the server). Abort + reset on unmount / source change.\n const refetchRef = useRef(query.refetch);\n refetchRef.current = query.refetch;\n const eventsSource = options?.events;\n useEffect(() => {\n if (!eventsSource) return;\n let cancelled = false;\n (async () => {\n try {\n for await (const ev of eventsSource) {\n if (cancelled) break;\n setEvents((prev) => [...prev, ev]);\n // A status-changing event landed — pull a fresh read.\n void refetchRef.current();\n }\n } catch {\n // A torn-down subscription (unmount) surfaces as an iterator throw;\n // swallow it — the read query owns the surfaced error channel.\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [eventsSource]);\n\n const task = query.data ?? null;\n return {\n task,\n status: task?.status ?? null,\n submission: hasResult(task) ? Uint8Array.from(task!.result) : null,\n events,\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n","/**\n * `useSubmissionReview(taskPda)` — buyer-side settlement actions.\n *\n * Exposes the three creator review verbs for a task in `PendingValidation`:\n * - `accept(...)` — accept the result and settle the escrow to the worker\n * (`client.acceptTaskResult`, a named client convenience);\n * - `reject(...)` — reject the result with a rejection hash\n * (`facade.rejectTaskResult` -> `client.send`);\n * - `requestChanges(...)` — return the task to the worker with a changes hash\n * (`facade.requestChanges` -> `client.send`).\n *\n * Each verb is its own mutation so a UI can show independent\n * pending/error/success per button. Typed `AgencError`s surface UNTOUCHED.\n *\n * The `task` PDA is bound at hook construction; callers pass only the per-call\n * settlement parties (worker / treasury / hashes) the SDK cannot derive.\n *\n * @module hooks/useSubmissionReview\n */\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { facade, type facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { requireClient } from \"./internal.js\";\n\n/** Per-call input for `accept` (task auto-bound; signer defaults to the client). */\nexport type AcceptInput = Omit<\n Parameters<typeof facadeNs.acceptTaskResult>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.acceptTaskResult>[0][\"creator\"];\n};\n\n/** Per-call input for `reject`. */\nexport type RejectInput = Omit<\n Parameters<typeof facadeNs.rejectTaskResult>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.rejectTaskResult>[0][\"creator\"];\n};\n\n/** Per-call input for `requestChanges`. */\nexport type RequestChangesInput = Omit<\n Parameters<typeof facadeNs.requestChanges>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.requestChanges>[0][\"creator\"];\n};\n\n/** Lifecycle status of a review verb. */\nexport type ReviewStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\n/** A single review verb's surface. */\nexport interface ReviewAction<TInput> {\n /** Run the action. Resolves to the tx signature; rejects with `AgencError`. */\n (input: TInput): Promise<string>;\n}\n\n/** Return value of {@link useSubmissionReview}. */\nexport interface UseSubmissionReviewResult {\n /** Accept the result and settle to the worker. */\n accept: ReviewAction<AcceptInput>;\n /** Reject the result (with a rejection hash). */\n reject: ReviewAction<RejectInput>;\n /** Request changes (with a changes hash), returning the task to the worker. */\n requestChanges: ReviewAction<RequestChangesInput>;\n /** Aggregate status: `pending` if any verb is in flight, else last settled. */\n status: ReviewStatus;\n /** The most recent error across the three verbs, or null. */\n error: Error | null;\n /** Signature of the last successful action, or null. */\n signature: string | null;\n /** Reset all three mutations to idle. */\n reset: () => void;\n}\n\nfunction statusOf(m: {\n isPending: boolean;\n isError: boolean;\n isSuccess: boolean;\n}): ReviewStatus {\n if (m.isPending) return \"pending\";\n if (m.isError) return \"error\";\n if (m.isSuccess) return \"success\";\n return \"idle\";\n}\n\n/**\n * Buyer-side review actions for one task.\n *\n * @param taskPda - The Task PDA under review (bound to every verb).\n * @returns {@link UseSubmissionReviewResult}.\n */\nexport function useSubmissionReview(\n taskPda: Parameters<typeof facadeNs.acceptTaskResult>[0][\"task\"],\n): UseSubmissionReviewResult {\n const ctx = useAgencContext();\n\n const acceptMut = useMutation<string, Error, AcceptInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.acceptTaskResult({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.acceptTaskResult>[0]);\n return signature;\n },\n });\n\n const rejectMut = useMutation<string, Error, RejectInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const ix = await facade.rejectTaskResult({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.rejectTaskResult>[0]);\n const { signature } = await client.send([ix]);\n return signature;\n },\n });\n\n const requestChangesMut = useMutation<string, Error, RequestChangesInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const ix = await facade.requestChanges({\n ...input,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.requestChanges>[0]);\n const { signature } = await client.send([ix]);\n return signature;\n },\n });\n\n const accept = useCallback<ReviewAction<AcceptInput>>(\n (input) => acceptMut.mutateAsync(input),\n [acceptMut],\n );\n const reject = useCallback<ReviewAction<RejectInput>>(\n (input) => rejectMut.mutateAsync(input),\n [rejectMut],\n );\n const requestChanges = useCallback<ReviewAction<RequestChangesInput>>(\n (input) => requestChangesMut.mutateAsync(input),\n [requestChangesMut],\n );\n\n const anyPending =\n acceptMut.isPending || rejectMut.isPending || requestChangesMut.isPending;\n const status: ReviewStatus = anyPending\n ? \"pending\"\n : statusOf(\n // Surface the most recently-touched verb's terminal state.\n [acceptMut, rejectMut, requestChangesMut].find(\n (m) => m.isError || m.isSuccess,\n ) ?? acceptMut,\n );\n\n const error =\n acceptMut.error ?? rejectMut.error ?? requestChangesMut.error ?? null;\n const signature =\n acceptMut.data ?? rejectMut.data ?? requestChangesMut.data ?? null;\n\n return {\n accept,\n reject,\n requestChanges,\n status,\n error,\n signature,\n reset: () => {\n acceptMut.reset();\n rejectMut.reset();\n requestChangesMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\nimport { resolveActivationModerationAccounts } from \"./moderation-attestor.js\";\n\nexport type TaskActivationInput = Omit<\n Parameters<typeof facadeNs.setTaskJobSpec>[0],\n \"task\" | \"creator\"\n> & {\n creator?: Parameters<typeof facadeNs.setTaskJobSpec>[0][\"creator\"];\n};\n\nexport type TaskActivationStatus = MutationStatus;\n\nexport interface UseTaskActivationResult {\n activate: (input: TaskActivationInput) => Promise<string>;\n status: TaskActivationStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskActivation(\n taskPda: Parameters<typeof facadeNs.setTaskJobSpec>[0][\"task\"],\n): UseTaskActivationResult {\n const ctx = useAgencContext();\n const mutation = useMutation<string, Error, TaskActivationInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n // P1.2: the publish gate names an explicit `moderator` (supplied by the\n // caller — the trust decision) and needs the roster-entry PDA when that\n // moderator is a registered attestor, plus a record override when the\n // attestation predates the upgrade (legacy grace window). Resolve the\n // mechanics automatically unless the caller supplied any of them.\n const callerResolved =\n input.moderationAttestor !== undefined ||\n input.moderatorIsAttestor !== undefined ||\n input.taskModeration !== undefined;\n const resolved = callerResolved\n ? {}\n : await resolveActivationModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n task: taskPda,\n jobSpecHash: input.jobSpecHash,\n moderator: input.moderator,\n });\n const { signature } = await client.setTaskJobSpec({\n ...input,\n ...resolved,\n task: taskPda,\n creator: input.creator ?? client.signer,\n } as Parameters<typeof facadeNs.setTaskJobSpec>[0]);\n return signature;\n },\n });\n\n const activate = useCallback(\n (input: TaskActivationInput) => mutation.mutateAsync(input),\n [mutation],\n );\n\n return {\n activate,\n status: mutationStatusOf(mutation),\n signature: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset: mutation.reset,\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { findTaskPda } from \"@tetsuo-ai/marketplace-sdk\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport {\n mutationStatusOf,\n requireClient,\n resolveReferrerArgs,\n signerAddress,\n withoutReferrerArgs,\n type MutationStatus,\n} from \"./internal.js\";\nimport {\n resolveActivationModerationAccounts,\n resolveHireListingModerationAccounts,\n type HireListingModerationAccounts,\n} from \"./moderation-attestor.js\";\nimport type { HumanlessHireInput } from \"./useHire.js\";\nimport type { TaskActivationInput } from \"./useTaskActivation.js\";\n\nexport type HumanlessHireFlowPhase =\n | \"idle\"\n | \"hiring\"\n | \"moderating\"\n | \"activating\"\n | \"activated\"\n | \"error\";\n\nexport type HumanlessHireFlowStatus = MutationStatus;\n\nexport type HumanlessHireFlowHireInput = Omit<\n HumanlessHireInput,\n \"humanless\" | \"creator\" | \"referrer\" | \"referrerFeeBps\"\n>;\n\nexport type HumanlessHireFlowActivationInput = Omit<\n TaskActivationInput,\n \"creator\" | \"jobSpecHash\" | \"jobSpecUri\" | \"moderator\"\n> & {\n /**\n * Override the activation `moderator` (P1.2). Defaults to the `moderator`\n * returned by `hostAndModerateJobSpec` — the attestation service that\n * signed the task moderation is whose record the publish gate consumes.\n */\n moderator?: TaskActivationInput[\"moderator\"];\n};\n\nexport type HumanlessHireFlowCreator = HumanlessHireInput[\"creator\"];\n\nexport type HumanlessHireFlowJobSpecHash =\n Parameters<typeof facadeNs.setTaskJobSpec>[0][\"jobSpecHash\"];\n\nexport interface HumanlessHireFlowModerationResult {\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n moderationAttested: boolean;\n /**\n * The pubkey that signed/recorded the task attestation (P1.2) — the\n * attestation service's signer (e.g. attest.agenc.ag `GET /v1/info` →\n * `moderator`). Names whose record the publish gate consumes.\n */\n moderator: Address;\n moderation?: unknown;\n}\n\nexport interface HumanlessHireFlowHostInput<TJobSpec> {\n taskPda: Address;\n taskId: HumanlessHireFlowHireInput[\"taskId\"];\n listing: HumanlessHireFlowHireInput[\"listing\"];\n jobSpec: TJobSpec;\n hireSignature: string;\n referrerInjected: boolean;\n}\n\nexport type HumanlessHireFlowHost<TJobSpec> = (\n input: HumanlessHireFlowHostInput<TJobSpec>,\n) => Promise<HumanlessHireFlowModerationResult>;\n\nexport interface HumanlessHireFlowInput<TJobSpec = unknown> {\n hire: HumanlessHireFlowHireInput;\n jobSpec: TJobSpec;\n hostAndModerateJobSpec: HumanlessHireFlowHost<TJobSpec>;\n activation?: HumanlessHireFlowActivationInput;\n creator?: HumanlessHireFlowCreator;\n}\n\nexport interface HumanlessHireFlowProgress {\n taskPda: Address | null;\n hireSignature: string | null;\n activationSignature: string | null;\n jobSpecHash: HumanlessHireFlowJobSpecHash | null;\n jobSpecUri: string | null;\n referrerInjected: boolean;\n}\n\nexport interface HumanlessHireFlowResult {\n taskPda: Address;\n hireSignature: string;\n activationSignature: string;\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n referrerInjected: boolean;\n moderation?: unknown;\n}\n\nexport interface UseHumanlessHireFlowResult<TJobSpec = unknown> {\n hireAndActivate: (\n input: HumanlessHireFlowInput<TJobSpec>,\n ) => Promise<HumanlessHireFlowResult>;\n phase: HumanlessHireFlowPhase;\n status: HumanlessHireFlowStatus;\n progress: HumanlessHireFlowProgress;\n result: HumanlessHireFlowResult | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nfunction emptyProgress(): HumanlessHireFlowProgress {\n return {\n taskPda: null,\n hireSignature: null,\n activationSignature: null,\n jobSpecHash: null,\n jobSpecUri: null,\n referrerInjected: false,\n };\n}\n\nfunction validateModerationResult(\n result: HumanlessHireFlowModerationResult,\n): {\n jobSpecHash: HumanlessHireFlowJobSpecHash;\n jobSpecUri: string;\n moderator: Address;\n} {\n if (result.moderationAttested !== true) {\n throw new Error(\n \"Task moderation was not attested; activation was not signed.\",\n );\n }\n if (\n !(result.jobSpecHash instanceof Uint8Array) ||\n result.jobSpecHash.byteLength !== 32\n ) {\n throw new Error(\n \"Task moderation returned an invalid jobSpecHash; activation was not signed.\",\n );\n }\n const jobSpecUri = result.jobSpecUri.trim();\n if (!jobSpecUri) {\n throw new Error(\n \"Task moderation returned an empty jobSpecUri; activation was not signed.\",\n );\n }\n if (typeof result.moderator !== \"string\" || !result.moderator.trim()) {\n throw new Error(\n \"Task moderation returned no moderator pubkey; activation was not signed.\",\n );\n }\n return {\n jobSpecHash: result.jobSpecHash,\n jobSpecUri,\n moderator: result.moderator,\n };\n}\n\nexport function useHumanlessHireFlow<TJobSpec = unknown>(): UseHumanlessHireFlowResult<TJobSpec> {\n const ctx = useAgencContext();\n const [phase, setPhase] = useState<HumanlessHireFlowPhase>(\"idle\");\n const [progress, setProgress] =\n useState<HumanlessHireFlowProgress>(emptyProgress);\n const flowInFlight = useRef(false);\n\n const mutation = useMutation<\n HumanlessHireFlowResult,\n Error,\n HumanlessHireFlowInput<TJobSpec>\n >({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const creator = input.creator ?? client.signer;\n const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);\n const hireInput = withoutReferrerArgs(input.hire);\n\n setPhase(\"hiring\");\n setProgress(emptyProgress());\n\n try {\n // P1.2: resolve the hire gate's moderation mechanics (roster PDA /\n // legacy record override) unless the caller supplied any of them.\n const hireListingSpecHash = input.hire.listingSpecHash;\n let hireModerationArgs: HireListingModerationAccounts = {};\n if (\n input.hire.moderationAttestor === undefined &&\n input.hire.moderatorIsAttestor === undefined &&\n input.hire.listingModeration === undefined &&\n hireListingSpecHash !== undefined\n ) {\n hireModerationArgs = await resolveHireListingModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n listing: input.hire.listing,\n listingSpecHash: hireListingSpecHash,\n moderator: input.hire.moderator,\n });\n }\n const hireResult = await client.hireFromListingHumanless({\n ...hireInput,\n ...hireModerationArgs,\n creator,\n ...referrerArgs,\n } as Parameters<typeof facadeNs.hireFromListingHumanless>[0]);\n\n const [taskPda] = await findTaskPda({\n creator: signerAddress(creator),\n taskId: input.hire.taskId,\n });\n\n setProgress({\n ...emptyProgress(),\n taskPda,\n hireSignature: hireResult.signature,\n referrerInjected,\n });\n\n setPhase(\"moderating\");\n const moderation = await input.hostAndModerateJobSpec({\n taskPda,\n taskId: input.hire.taskId,\n listing: input.hire.listing,\n jobSpec: input.jobSpec,\n hireSignature: hireResult.signature,\n referrerInjected,\n });\n const { jobSpecHash, jobSpecUri, moderator } =\n validateModerationResult(moderation);\n\n setProgress((current) => ({\n ...current,\n jobSpecHash,\n jobSpecUri,\n }));\n\n setPhase(\"activating\");\n // P1.2: the publish gate consumes the record of the moderator that\n // signed the attestation (the host callback's service by default).\n // Resolve the gate mechanics (roster PDA / legacy record override)\n // unless the caller supplied any of them.\n const activationModerator = input.activation?.moderator ?? moderator;\n const activationCallerResolved =\n input.activation?.moderationAttestor !== undefined ||\n input.activation?.moderatorIsAttestor !== undefined ||\n input.activation?.taskModeration !== undefined;\n const activationModerationArgs = activationCallerResolved\n ? {}\n : await resolveActivationModerationAccounts({\n rpcUrl: ctx.rpcUrl,\n task: taskPda,\n jobSpecHash,\n moderator: activationModerator,\n });\n const activationResult = await client.setTaskJobSpec({\n ...(input.activation ?? {}),\n ...activationModerationArgs,\n task: taskPda,\n creator,\n jobSpecHash,\n jobSpecUri,\n moderator: activationModerator,\n } as Parameters<typeof facadeNs.setTaskJobSpec>[0]);\n\n const result: HumanlessHireFlowResult = {\n taskPda,\n hireSignature: hireResult.signature,\n activationSignature: activationResult.signature,\n jobSpecHash,\n jobSpecUri,\n referrerInjected,\n moderation: moderation.moderation,\n };\n\n setProgress((current) => ({\n ...current,\n activationSignature: activationResult.signature,\n }));\n setPhase(\"activated\");\n return result;\n } catch (error) {\n setPhase(\"error\");\n throw error;\n }\n },\n });\n\n const hireAndActivate = useCallback(\n async (input: HumanlessHireFlowInput<TJobSpec>) => {\n if (flowInFlight.current) {\n throw new Error(\"A humanless hire flow is already in progress.\");\n }\n flowInFlight.current = true;\n try {\n return await mutation.mutateAsync(input);\n } finally {\n flowInFlight.current = false;\n }\n },\n [mutation],\n );\n\n const reset = useCallback(() => {\n mutation.reset();\n setPhase(\"idle\");\n setProgress(emptyProgress());\n }, [mutation]);\n\n return {\n hireAndActivate,\n phase,\n status: mutationStatusOf(mutation),\n progress,\n result: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset,\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type ClaimTaskInput = Omit<\n Parameters<typeof facadeNs.claimTaskWithJobSpec>[0],\n \"task\"\n>;\nexport type SubmitTaskResultInput = Omit<\n Parameters<typeof facadeNs.submitTaskResult>[0],\n \"task\"\n>;\nexport type TaskWorkStatus = MutationStatus;\n\nexport interface UseTaskWorkResult {\n claim: (input: ClaimTaskInput) => Promise<string>;\n submit: (input: SubmitTaskResultInput) => Promise<string>;\n status: TaskWorkStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskWork(\n taskPda: Parameters<typeof facadeNs.claimTaskWithJobSpec>[0][\"task\"],\n): UseTaskWorkResult {\n const ctx = useAgencContext();\n const claimMut = useMutation<string, Error, ClaimTaskInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.claimTaskWithJobSpec({\n ...input,\n task: taskPda,\n } as Parameters<typeof facadeNs.claimTaskWithJobSpec>[0]);\n return signature;\n },\n });\n const submitMut = useMutation<string, Error, SubmitTaskResultInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.submitTaskResult({\n ...input,\n task: taskPda,\n } as Parameters<typeof facadeNs.submitTaskResult>[0]);\n return signature;\n },\n });\n\n const claim = useCallback((input: ClaimTaskInput) => claimMut.mutateAsync(input), [claimMut]);\n const submit = useCallback(\n (input: SubmitTaskResultInput) => submitMut.mutateAsync(input),\n [submitMut],\n );\n const active = claimMut.isPending || submitMut.isPending;\n const latest = [claimMut, submitMut].find((m) => m.isError || m.isSuccess) ?? claimMut;\n\n return {\n claim,\n submit,\n status: active ? \"pending\" : mutationStatusOf(latest),\n signature: latest.data ?? null,\n error: claimMut.error ?? submitMut.error ?? null,\n isPending: active,\n reset: () => {\n claimMut.reset();\n submitMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type CancelTaskInput = Omit<\n Parameters<typeof facadeNs.cancelTask>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.cancelTask>[0][\"authority\"];\n};\nexport type CloseTaskInput = Omit<\n Parameters<typeof facadeNs.closeTask>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.closeTask>[0][\"authority\"];\n};\nexport type AutoAcceptTaskResultInput = Omit<\n Parameters<typeof facadeNs.autoAcceptTaskResult>[0],\n \"task\" | \"authority\"\n> & {\n authority?: Parameters<typeof facadeNs.autoAcceptTaskResult>[0][\"authority\"];\n};\nexport type TaskLifecycleStatus = MutationStatus;\n\nexport interface UseTaskLifecycleResult {\n cancel: (input?: CancelTaskInput) => Promise<string>;\n close: (input?: CloseTaskInput) => Promise<string>;\n autoAccept: (input: AutoAcceptTaskResultInput) => Promise<string>;\n status: TaskLifecycleStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useTaskLifecycle(\n taskPda: Parameters<typeof facadeNs.cancelTask>[0][\"task\"],\n): UseTaskLifecycleResult {\n const ctx = useAgencContext();\n const cancelMut = useMutation<string, Error, CancelTaskInput | undefined>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.cancelTask({\n ...(input ?? {}),\n task: taskPda,\n authority: input?.authority ?? client.signer,\n } as Parameters<typeof facadeNs.cancelTask>[0]);\n return signature;\n },\n });\n const closeMut = useMutation<string, Error, CloseTaskInput | undefined>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.closeTask({\n ...(input ?? {}),\n task: taskPda,\n authority: input?.authority ?? client.signer,\n } as Parameters<typeof facadeNs.closeTask>[0]);\n return signature;\n },\n });\n const autoAcceptMut = useMutation<string, Error, AutoAcceptTaskResultInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.autoAcceptTaskResult({\n ...input,\n task: taskPda,\n authority: input.authority ?? client.signer,\n } as Parameters<typeof facadeNs.autoAcceptTaskResult>[0]);\n return signature;\n },\n });\n\n const cancel = useCallback(\n (input?: CancelTaskInput) => cancelMut.mutateAsync(input),\n [cancelMut],\n );\n const close = useCallback(\n (input?: CloseTaskInput) => closeMut.mutateAsync(input),\n [closeMut],\n );\n const autoAccept = useCallback(\n (input: AutoAcceptTaskResultInput) => autoAcceptMut.mutateAsync(input),\n [autoAcceptMut],\n );\n const active = cancelMut.isPending || closeMut.isPending || autoAcceptMut.isPending;\n const latest =\n [cancelMut, closeMut, autoAcceptMut].find((m) => m.isError || m.isSuccess) ?? cancelMut;\n\n return {\n cancel,\n close,\n autoAccept,\n status: active ? \"pending\" : mutationStatusOf(latest),\n signature: latest.data ?? null,\n error: cancelMut.error ?? closeMut.error ?? autoAcceptMut.error ?? null,\n isPending: active,\n reset: () => {\n cancelMut.reset();\n closeMut.reset();\n autoAcceptMut.reset();\n },\n };\n}\n","import { useMutation } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\nexport type RateHireInput = Omit<\n Parameters<typeof facadeNs.rateHire>[0],\n \"task\" | \"buyer\"\n> & {\n buyer?: Parameters<typeof facadeNs.rateHire>[0][\"buyer\"];\n};\nexport type RateHireStatus = MutationStatus;\n\nexport interface UseRateHireResult {\n rate: (input: RateHireInput) => Promise<string>;\n status: RateHireStatus;\n signature: string | null;\n error: Error | null;\n isPending: boolean;\n reset: () => void;\n}\n\nexport function useRateHire(\n taskPda: Parameters<typeof facadeNs.rateHire>[0][\"task\"],\n): UseRateHireResult {\n const ctx = useAgencContext();\n const mutation = useMutation<string, Error, RateHireInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.rateHire({\n ...input,\n task: taskPda,\n buyer: input.buyer ?? client.signer,\n } as Parameters<typeof facadeNs.rateHire>[0]);\n return signature;\n },\n });\n const rate = useCallback((input: RateHireInput) => mutation.mutateAsync(input), [mutation]);\n return {\n rate,\n status: mutationStatusOf(mutation),\n signature: mutation.data ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset: mutation.reset,\n };\n}\n","/**\n * `useDispute(taskPda)` — dispute entry point + state for one task.\n *\n * Reads the task's `Dispute` account (via an injected reader seam — same reason\n * as `useTaskStatus`: the unified read transport has no raw account fetch and\n * litesvm has no RPC) and exposes `initiate(...)` which opens a dispute through\n * the write client (`client.initiateDispute`). Typed `AgencError`s surface\n * UNTOUCHED.\n *\n * @module hooks/useDispute\n */\nimport { useMutation, useQuery } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport {\n type Dispute,\n type facade as facadeNs,\n} from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport { pdaKey, queryKeys, requireClient } from \"./internal.js\";\n\n/** Reads a Dispute account for a task, returning the decoded value or null. */\nexport type DisputeReader = (\n taskPda: Address | string,\n) => Promise<Dispute | null>;\n\n/**\n * Per-call input for `initiate(...)`. This is the SDK `facade.initiateDispute`\n * input minus the fee-payer `authority` signer (defaulted to the client's\n * signer; pass it to override). `task` is bound at hook construction.\n */\nexport type InitiateDisputeInput = Omit<\n Parameters<typeof facadeNs.initiateDispute>[0],\n \"task\" | \"authority\"\n> & {\n /** Override the initiator authority signer (defaults to the client signer). */\n authority?: Parameters<typeof facadeNs.initiateDispute>[0][\"authority\"];\n};\n\n/** Lifecycle status of the initiate mutation. */\nexport type DisputeStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\n/** Options for {@link useDispute}. */\nexport interface UseDisputeOptions {\n /** How to read the Dispute account. Without it the read stays idle. */\n disputeReader?: DisputeReader;\n /** Disable the read query. Default `true` when `taskPda` + reader exist. */\n enabled?: boolean;\n}\n\n/** Return value of {@link useDispute}. */\nexport interface UseDisputeResult {\n /** The decoded dispute, or null (none open / not yet read). */\n dispute: Dispute | null;\n /** Open a dispute. Resolves to the tx signature; rejects with `AgencError`. */\n initiate: (input: InitiateDisputeInput) => Promise<string>;\n /** Status of the initiate mutation. */\n status: DisputeStatus;\n /** Signature of the last successful initiate, or null. */\n signature: string | null;\n /** The read OR initiate error, or null. */\n error: Error | null;\n /** True while reading the dispute. */\n isLoading: boolean;\n /** Force a dispute refetch. */\n refetch: () => void;\n /** Reset the initiate mutation. */\n reset: () => void;\n}\n\n/**\n * Dispute entry + state for one task.\n *\n * @param taskPda - The Task PDA (falsy disables the read).\n * @param options - Reader + enabled.\n * @returns {@link UseDisputeResult}.\n */\nexport function useDispute(\n taskPda: Address | string | undefined | null,\n options?: UseDisputeOptions,\n): UseDisputeResult {\n const ctx = useAgencContext();\n const reader = options?.disputeReader;\n const enabled =\n (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);\n\n const read = useQuery<Dispute | null, Error>({\n queryKey: queryKeys.dispute(taskPda ? pdaKey(taskPda) : \"\"),\n enabled,\n queryFn: () => reader!(taskPda as Address | string),\n });\n\n const mutation = useMutation<string, Error, InitiateDisputeInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.initiateDispute({\n ...input,\n task: taskPda as Address,\n authority: input.authority ?? client.signer,\n } as Parameters<typeof facadeNs.initiateDispute>[0]);\n // A new dispute exists — refresh the read.\n void read.refetch();\n return signature;\n },\n });\n\n const initiate = useCallback(\n (input: InitiateDisputeInput) => mutation.mutateAsync(input),\n [mutation],\n );\n\n const status: DisputeStatus = mutation.isPending\n ? \"pending\"\n : mutation.isError\n ? \"error\"\n : mutation.isSuccess\n ? \"success\"\n : \"idle\";\n\n return {\n dispute: read.data ?? null,\n initiate,\n status,\n signature: mutation.data ?? null,\n error: mutation.error ?? read.error ?? null,\n isLoading: read.isLoading,\n refetch: () => void read.refetch(),\n reset: mutation.reset,\n };\n}\n","/**\n * `useCompletionBond(taskPda)` — the completion-bond (\"Guaranteed Hire\")\n * mutations for one task.\n *\n * Two verbs over the write client, each its own mutation (independent\n * pending/error per button, like `useSubmissionReview`):\n * - `post(...)` — post a completion bond (`client.postCompletionBond`). The\n * bond PDA is auto-derived from (task, signing wallet); size is fixed\n * on-chain at 25% of the reward (`BOND_BPS`), SOL-only in v1. A worker\n * posting the role-1 bond is what makes the task read as GUARANTEED.\n * - `reclaim(...)` — the recovery crank (`client.reclaimCompletionBond`) for a\n * bond a settlement left live; refunds to the recorded posting wallet.\n *\n * A successful verb invalidates the task's `useTaskGuarantee` cache entry so\n * badges refresh without manual wiring. Typed `AgencError`s surface UNTOUCHED.\n *\n * HONEST BOUNDARY (phase 1 — do not overclaim in UI copy): a FORFEITED bond\n * pays the protocol **treasury**, not the harmed party; the buyer's protection\n * is the escrow refund plus the worker's skin in the game. Phase 2 (batch-2\n * program work) redirects forfeiture to the harmed party.\n *\n * @module hooks/useCompletionBond\n */\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport {\n mutationStatusOf,\n pdaKey,\n queryKeys,\n requireClient,\n type MutationStatus,\n} from \"./internal.js\";\n\n/**\n * Per-call input for `post` (task auto-bound; the bonding `authority` signer\n * defaults to the client's signer). `role` stays explicit: 1 = worker (the\n * guarantee), 0 = creator.\n */\nexport type PostCompletionBondInput = Omit<\n Parameters<typeof facadeNs.postCompletionBond>[0],\n \"task\" | \"authority\"\n> & {\n /** Override the bonding authority signer (defaults to the client signer). */\n authority?: Parameters<typeof facadeNs.postCompletionBond>[0][\"authority\"];\n};\n\n/**\n * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet\n * the refund returns to — defaults to the client signer's address). The\n * instruction is a permissionless crank, so any fee payer may run it.\n */\nexport type ReclaimCompletionBondInput = Omit<\n Parameters<typeof facadeNs.reclaimCompletionBond>[0],\n \"task\" | \"party\"\n> & {\n /** Override the bond's posting wallet (defaults to the client signer). */\n party?: Parameters<typeof facadeNs.reclaimCompletionBond>[0][\"party\"];\n};\n\n/** Lifecycle status of a bond verb. */\nexport type CompletionBondStatus = MutationStatus;\n\n/** Return value of {@link useCompletionBond}. */\nexport interface UseCompletionBondResult {\n /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */\n post: (input: PostCompletionBondInput) => Promise<string>;\n /** Reclaim a settled-but-live bond. Resolves to the tx signature. */\n reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;\n /** Aggregate status: `pending` if either verb is in flight, else last settled. */\n status: CompletionBondStatus;\n /** The most recent error across the two verbs, or null. */\n error: Error | null;\n /** Signature of the last successful action, or null. */\n signature: string | null;\n /** True while either verb is in flight. */\n isPending: boolean;\n /** Reset both mutations to idle. */\n reset: () => void;\n}\n\n/**\n * Completion-bond actions for one task.\n *\n * @param taskPda - The Task PDA (bound to both verbs).\n * @returns {@link UseCompletionBondResult}.\n */\nexport function useCompletionBond(\n taskPda: Parameters<typeof facadeNs.postCompletionBond>[0][\"task\"],\n): UseCompletionBondResult {\n const ctx = useAgencContext();\n const queryClient = useQueryClient();\n\n const invalidateGuarantee = useCallback(() => {\n void queryClient.invalidateQueries({\n queryKey: queryKeys.taskGuarantee(pdaKey(taskPda)),\n });\n }, [queryClient, taskPda]);\n\n const postMut = useMutation<string, Error, PostCompletionBondInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.postCompletionBond({\n ...input,\n task: taskPda,\n authority: input.authority ?? client.signer,\n } as Parameters<typeof facadeNs.postCompletionBond>[0]);\n invalidateGuarantee();\n return signature;\n },\n });\n\n const reclaimMut = useMutation<string, Error, ReclaimCompletionBondInput>({\n mutationFn: async (input) => {\n const client = requireClient(ctx.client);\n const { signature } = await client.reclaimCompletionBond({\n ...input,\n task: taskPda,\n party: input.party ?? client.signer.address,\n } as Parameters<typeof facadeNs.reclaimCompletionBond>[0]);\n invalidateGuarantee();\n return signature;\n },\n });\n\n const post = useCallback(\n (input: PostCompletionBondInput) => postMut.mutateAsync(input),\n [postMut],\n );\n const reclaim = useCallback(\n (input: ReclaimCompletionBondInput) => reclaimMut.mutateAsync(input),\n [reclaimMut],\n );\n\n const isPending = postMut.isPending || reclaimMut.isPending;\n const status: CompletionBondStatus = isPending\n ? \"pending\"\n : mutationStatusOf(\n // Surface the most recently-touched verb's terminal state.\n [postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut,\n );\n\n return {\n post,\n reclaim,\n status,\n error: postMut.error ?? reclaimMut.error ?? null,\n signature: postMut.data ?? reclaimMut.data ?? null,\n isPending,\n reset: () => {\n postMut.reset();\n reclaimMut.reset();\n },\n };\n}\n","/**\n * `useReferrerEarnings(wallet)` — aggregated referrer earnings (P3.8).\n *\n * ## Data source\n *\n * `GET <earningsBase>/api/explorer/referrers/:wallet/hires` — the hosted\n * explorer endpoint that sums the referrer leg over SETTLED hires with the\n * program's own split math (shipped 2026-07-03; ground-truthed against the\n * cross-node canary's on-chain legs). `earningsBase` resolves from\n * `config.indexer.baseUrl` when set, else the per-network hosted default\n * (mainnet only). When no base resolves (localnet/devnet without an indexer),\n * the hook returns the documented not-live zero state and makes NO network\n * request — it NEVER fabricates earnings; a fetch failure surfaces as\n * `error` with zero totals, never invented numbers.\n *\n * @module hooks/useReferrerEarnings\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { t } from \"../strings/index.js\";\nimport type { Address, AgencContextValue, AgencNetwork } from \"../types.js\";\nimport { pdaKey, queryKeys } from \"./internal.js\";\n\n/**\n * Hosted explorer bases serving the earnings endpoints, per network. Only\n * mainnet has one today; an explicit `config.indexer.baseUrl` always wins.\n */\nconst EARNINGS_INDEXER_DEFAULTS: Partial<Record<AgencNetwork, string>> = {\n mainnet: \"https://api.agenc.ag\",\n};\n\n/** Resolve the earnings endpoint base, or `null` (not live) when none. */\nfunction resolveEarningsBaseUrl(ctx: AgencContextValue): string | null {\n return ctx.indexerBaseUrl ?? EARNINGS_INDEXER_DEFAULTS[ctx.network] ?? null;\n}\n\n/** A single referral-earning hire. */\nexport interface ReferrerHire {\n /** The minted Task PDA of the referred hire. */\n taskPda: string;\n /** The HireRecord PDA carrying the snapshotted referrer fields. */\n hireRecordPda: string;\n /** Referral fee earned on this hire, in lamports. */\n feeLamports: bigint;\n /** Transaction signature of the hire (empty until event indexing lands). */\n signature: string;\n}\n\n/** Return value of {@link useReferrerEarnings}. */\nexport interface UseReferrerEarningsResult {\n /**\n * Whether aggregated referral earnings are live. Settlement may be live even\n * when this is false; false means the numbers below are the documented\n * not-live zero state, not real data.\n */\n live: boolean;\n /** Total lamports earned. `0n` while not live (never fabricated). */\n totalLamports: bigint;\n /** Per-hire earnings. `[]` while not live. */\n hires: ReferrerHire[];\n /** True while a fetch is in flight. */\n isLoading: boolean;\n /** The fetch error, or null. */\n error: Error | null;\n /**\n * Human-readable reason the data is not live (the capability reason). Present\n * while `live` is false.\n */\n reason?: string;\n /** Force a refetch (no-op while not live). */\n refetch: () => void;\n}\n\n/** The endpoint's wire shape (lamports as decimal strings). */\ninterface EarningsWire {\n totalLamports?: string;\n hires?: Array<{\n taskPda?: string;\n hireRecordPda?: string;\n feeLamports?: string;\n signature?: string;\n }>;\n}\n\n/**\n * Read a referrer wallet's aggregated earnings from the hosted explorer.\n *\n * @param wallet - The referrer wallet (base58 / Address). Falsy disables the\n * fetch; the not-live state is still returned.\n * @returns {@link UseReferrerEarningsResult}\n *\n * @example\n * ```tsx\n * const { live, totalLamports, hires, reason } = useReferrerEarnings(myWallet);\n * ```\n */\nexport function useReferrerEarnings(\n wallet: Address | string | undefined | null,\n): UseReferrerEarningsResult {\n const ctx = useAgencContext();\n const capability = ctx.resolveReferrerCapability();\n const earningsBase = resolveEarningsBaseUrl(ctx);\n\n // Live only when settlement capability holds AND an earnings endpoint base\n // resolves. No base (localnet/devnet without an indexer) = the documented\n // not-live zero state, zero network requests.\n const enabled = capability.live && earningsBase !== null && Boolean(wallet);\n\n const query = useQuery<{ totalLamports: bigint; hires: ReferrerHire[] }, Error>(\n {\n queryKey: queryKeys.referrerEarnings(wallet ? pdaKey(wallet) : \"\"),\n enabled,\n queryFn: async () => {\n const url = `${earningsBase}/api/explorer/referrers/${encodeURIComponent(\n String(wallet),\n )}/hires`;\n const response = await fetch(url, {\n headers: { accept: \"application/json\" },\n });\n if (!response.ok) {\n throw new Error(\n t(\"referrer.earningsFetchFailed\") + ` (HTTP ${response.status})`,\n );\n }\n const body = (await response.json()) as EarningsWire;\n // Lamports arrive as decimal strings; parse to bigint. Anything\n // malformed throws (surfaces as `error`) — never silently coerced.\n const hires: ReferrerHire[] = (body.hires ?? []).map((h) => ({\n taskPda: String(h.taskPda ?? \"\"),\n hireRecordPda: String(h.hireRecordPda ?? \"\"),\n feeLamports: BigInt(h.feeLamports ?? \"0\"),\n signature: String(h.signature ?? \"\"),\n }));\n return {\n totalLamports: BigInt(body.totalLamports ?? \"0\"),\n hires,\n };\n },\n },\n );\n\n if (!enabled) {\n // The documented not-live state. Zeroes are HONEST (no data was read),\n // not fabricated, and no request was made.\n return {\n live: false,\n totalLamports: 0n,\n hires: [],\n isLoading: false,\n error: null,\n reason: capability.live\n ? t(\"referrer.earningsNotLiveReason\")\n : (capability.reason ?? t(\"referrer.notLiveReason\")),\n refetch: () => {\n /* no-op while not live */\n },\n };\n }\n\n return {\n live: true,\n totalLamports: query.data?.totalLamports ?? 0n,\n hires: query.data?.hires ?? [],\n isLoading: query.isLoading,\n error: query.error ?? null,\n refetch: () => void query.refetch(),\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, ButtonHTMLAttributes, HTMLAttributes, RefObject } from 'react';
|
|
2
|
-
import { ListActiveListingsOptions, DecodedProgramAccount, ServiceListing, IndexerListing, IndexerHire, IndexerAgentTrackRecord, MarketplaceClient, ProgramAccountsTransport, CreateIndexerClientOptions, TaskStatus, fetchMaybeAgentVerification, AgentVerification } from '@tetsuo-ai/marketplace-sdk';
|
|
2
|
+
import { ListActiveListingsOptions, DecodedProgramAccount, ServiceListing, IndexerListing, IndexerHire, IndexerAgentTrackRecord, MarketplaceClient, ProgramAccountsTransport, CreateIndexerClientOptions, TaskGuarantee, TaskStatus, fetchMaybeAgentVerification, AgentVerification } from '@tetsuo-ai/marketplace-sdk';
|
|
3
|
+
import { T as TaskGuaranteeReader, f as HireStatus, b as AnyHireInput, i as ReviewStatus, c as DisputeStatus, a as AgentTrackRecord } from './useAgentTrackRecord-DPt3SfYz.js';
|
|
3
4
|
import { Address, TransactionSigner, Rpc, GetProgramAccountsApi } from '@solana/kit';
|
|
4
|
-
import { f as HireStatus, b as AnyHireInput, i as ReviewStatus, c as DisputeStatus, a as AgentTrackRecord } from './useAgentTrackRecord-BCvRHYM2.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shared types for `@tetsuo-ai/marketplace-react`.
|
|
@@ -174,9 +174,12 @@ interface AgencContextValue {
|
|
|
174
174
|
client: MarketplaceClient | null;
|
|
175
175
|
/**
|
|
176
176
|
* The resolved HTTP RPC endpoint (config override or the network default),
|
|
177
|
-
* or `null` when none resolves. Hooks use it for
|
|
177
|
+
* or `null` when none resolves. Hooks use it for targeted per-task reads —
|
|
178
178
|
* e.g. resolving the WP-A1 `moderation_attestor` roster account during
|
|
179
|
-
* activation
|
|
179
|
+
* activation, and the `useTaskGuarantee` completion-bond read (a
|
|
180
|
+
* task-scoped `getProgramAccounts` with no single-account equivalent; the
|
|
181
|
+
* RPC must allow gPA, and an injected reader seam bypasses it). LIST
|
|
182
|
+
* queries stay with the read transport.
|
|
180
183
|
*/
|
|
181
184
|
rpcUrl: string | null;
|
|
182
185
|
/**
|
|
@@ -438,6 +441,46 @@ interface VerifiedBadgeProps extends ThemableProps {
|
|
|
438
441
|
*/
|
|
439
442
|
declare function VerifiedBadge({ verified, unstyled, className, }: VerifiedBadgeProps): ReactNode;
|
|
440
443
|
|
|
444
|
+
/**
|
|
445
|
+
* `<GuaranteedBadge task={...} />` — the Guaranteed Hire badge (WP-H3).
|
|
446
|
+
*
|
|
447
|
+
* Renders NOTHING unless the task is guaranteed (a live worker completion
|
|
448
|
+
* bond: the worker staked 25% of the reward on passing review). When it is,
|
|
449
|
+
* shows a small success-tone badge with plain-English copy; the full detail
|
|
450
|
+
* sentence rides on `title`/`aria-label`.
|
|
451
|
+
*
|
|
452
|
+
* Connected by default: given `task`, it reads through {@link useTaskGuarantee}
|
|
453
|
+
* (provider `rpcUrl` gPA read, or the `guaranteeReader` seam). Pass a
|
|
454
|
+
* pre-resolved `guarantee` to use it presentationally (no read at all) — an
|
|
455
|
+
* explicit `guarantee` (including `null`) wins over the `task` read.
|
|
456
|
+
*
|
|
457
|
+
* HONEST BOUNDARY (phase 1): the copy says the buyer is refunded and the
|
|
458
|
+
* worker FORFEITS the bond — it deliberately does NOT promise the buyer the
|
|
459
|
+
* bond itself, because a forfeited bond pays the protocol treasury until
|
|
460
|
+
* phase 2 redirects it to the harmed party. Keep host copy within that line.
|
|
461
|
+
*
|
|
462
|
+
* @module components/GuaranteedBadge
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
/** Props for {@link GuaranteedBadge}. */
|
|
466
|
+
interface GuaranteedBadgeProps extends ThemableProps {
|
|
467
|
+
/** The Task PDA to read the guarantee for (connected mode). */
|
|
468
|
+
task?: Address | string | null;
|
|
469
|
+
/**
|
|
470
|
+
* Pre-resolved guarantee state (presentational mode — overrides the `task`
|
|
471
|
+
* read entirely; pass `null` for a known-unguaranteed task).
|
|
472
|
+
*/
|
|
473
|
+
guarantee?: TaskGuarantee | null;
|
|
474
|
+
/** Injected reader seam forwarded to {@link useTaskGuarantee} (tests/litesvm). */
|
|
475
|
+
guaranteeReader?: TaskGuaranteeReader;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Show that a task's result is backed by the worker's 25% completion bond.
|
|
479
|
+
* Renders nothing while loading, on read errors, and for unguaranteed tasks —
|
|
480
|
+
* the badge only ever ASSERTS a live guarantee, never its absence.
|
|
481
|
+
*/
|
|
482
|
+
declare function GuaranteedBadge({ task, guarantee, guaranteeReader, unstyled, className, }: GuaranteedBadgeProps): ReactNode;
|
|
483
|
+
|
|
441
484
|
/**
|
|
442
485
|
* Component-layer string catalog (PLAN_2 A3).
|
|
443
486
|
*
|
|
@@ -533,6 +576,8 @@ declare const EN_COMPONENT_STRINGS: {
|
|
|
533
576
|
readonly "components.provider.verifiedDomainLabel": "Verified domain {domain}";
|
|
534
577
|
readonly "components.provider.claimedDomain": "Claims: {domain}";
|
|
535
578
|
readonly "components.provider.claimedDomainLabel": "Claimed domain {domain} (not verified on-chain)";
|
|
579
|
+
readonly "components.guarantee.badge": "Guaranteed — worker has 25% at stake";
|
|
580
|
+
readonly "components.guarantee.detail": "Worker has 25% at stake — if the result fails review you're refunded and the worker forfeits the bond.";
|
|
536
581
|
readonly "components.poweredBy.label": "Powered by AgenC";
|
|
537
582
|
readonly "components.poweredBy.trustLink": "Learn how this works";
|
|
538
583
|
};
|
|
@@ -1269,4 +1314,4 @@ interface PoweredByAgenCProps extends ThemableProps {
|
|
|
1269
1314
|
*/
|
|
1270
1315
|
declare function PoweredByAgenC({ href, newTab, label, unstyled, className, }: PoweredByAgenCProps): ReactNode;
|
|
1271
1316
|
|
|
1272
|
-
export {
|
|
1317
|
+
export { Spinner as $, type AgencProviderConfig as A, Badge as B, type CreateReadTransportConfig as C, DEFAULT_TRUST_HREF as D, EN_COMPONENT_STRINGS as E, ListingGrid as F, type GpaReadSource as G, HireButton as H, type IndexerConfig as I, type ListingGridProps as J, type ModalProps as K, ListingCard as L, Modal as M, ModerationBadge as N, type ModerationBadgeProps as O, type ModerationState as P, PoweredByAgenC as Q, type ReferrerCapability as R, type PoweredByAgenCProps as S, ProviderCard as T, type ProviderCardProps as U, type ValidatedReferrerConfig as V, type ReadListingResult as W, ReferrerDisclosure as X, type ReferrerDisclosureProps as Y, ReviewPanel as Z, type ReviewPanelProps as _, type AgencContextValue as a, type SpinnerProps as a0, type StateKind as a1, StateMessage as a2, type StateMessageProps as a3, type StringCatalog as a4, type StringId as a5, type StringVars as a6, TaskTimeline as a7, type TaskTimelineProps as a8, type ThemableProps as a9, type TranslateOptions as aa, UNVERIFIED as ab, type UseAgentVerificationOptions as ac, type UseAgentVerificationResult as ad, VerifiedBadge as ae, type VerifiedBadgeProps as af, agentVerificationReaderFromRpc as ag, cx as ah, decodeListingCategory as ai, decodeListingName as aj, decodeListingTags as ak, elementClass as al, evaluateAgentVerification as am, formatPriceSol as an, formatRate as ao, formatSol as ap, moderationStateOf as aq, rootClass as ar, t as as, tc as at, toHex as au, truncateAddress as av, useAgentVerification as aw, useFocusTrap as ax, type ReferrerConfig as b, type AgencNetwork as c, type ReadTransport as d, type AgentVerificationReader as e, type AgentVerificationReaderOptions as f, type AgentVerificationResult as g, type AgentVerificationRpc as h, type BadgeProps as i, type BadgeTone as j, Button as k, type ButtonProps as l, type ButtonVariant as m, COMPONENT_CATALOG as n, type ComponentStringId as o, DisputeBanner as p, type DisputeBannerProps as q, EN_STRINGS as r, GuaranteedBadge as s, type GuaranteedBadgeProps as t, type HireButtonProps as u, type HireCheckoutListing as v, HireCheckoutModal as w, type HireCheckoutModalProps as x, type ListingCardData as y, type ListingCardProps as z };
|