@tetsuo-ai/marketplace-react 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -3
- package/README.md +50 -20
- package/dist/{chunk-ABS77JB2.js → chunk-D2TDU3TJ.js} +3 -3
- package/dist/{chunk-ABS77JB2.js.map → chunk-D2TDU3TJ.js.map} +1 -1
- package/dist/{chunk-GN5DYVN5.js → chunk-ECU7HGO3.js} +6 -5
- package/dist/chunk-ECU7HGO3.js.map +1 -0
- package/dist/{chunk-YORZNYZZ.js → chunk-FAIRTAIB.js} +53 -17
- package/dist/chunk-FAIRTAIB.js.map +1 -0
- package/dist/{chunk-5OTKSRHM.js → chunk-MNJ2EQDJ.js} +3 -3
- package/dist/{chunk-5OTKSRHM.js.map → chunk-MNJ2EQDJ.js.map} +1 -1
- package/dist/{chunk-A7ETZFNH.js → chunk-WJUVTFJ7.js} +6 -6
- package/dist/chunk-WJUVTFJ7.js.map +1 -0
- package/dist/components/index.cjs +47 -16
- 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 +3 -3
- package/dist/hooks/index.cjs +350 -28
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +160 -36
- package/dist/hooks/index.d.ts +160 -36
- package/dist/hooks/index.js +299 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-zLJX8XdK.d.ts → index-C9R3B80j.d.ts} +29 -37
- package/dist/{index-DUsGVhDz.d.cts → index-CTTh1ZPg.d.cts} +29 -37
- package/dist/index.cjs +68 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -19
- package/dist/index.d.ts +10 -19
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/signers/index.cjs +4 -3
- package/dist/signers/index.cjs.map +1 -1
- package/dist/signers/index.js +2 -2
- package/dist/{useAgentTrackRecord-BLf1nrbu.d.cts → useAgentTrackRecord-BCvRHYM2.d.cts} +7 -7
- package/dist/{useAgentTrackRecord-BLf1nrbu.d.ts → useAgentTrackRecord-BCvRHYM2.d.ts} +7 -7
- package/package.json +3 -2
- package/src/components/HireButton.tsx +1 -2
- package/src/components/HireCheckoutModal.tsx +8 -9
- package/src/components/ReferrerDisclosure.tsx +8 -12
- package/src/components/strings.ts +2 -2
- package/src/hooks/index.ts +47 -4
- package/src/hooks/internal.ts +74 -2
- package/src/hooks/useHire.ts +30 -38
- package/src/hooks/useHumanlessHireFlow.ts +259 -0
- package/src/hooks/useRateHire.ts +52 -0
- package/src/hooks/useReferrerEarnings.ts +32 -33
- package/src/hooks/useTaskActivation.ts +58 -0
- package/src/hooks/useTaskLifecycle.ts +110 -0
- package/src/hooks/useTaskWork.ts +76 -0
- package/src/index.ts +2 -2
- package/src/provider/AgencProvider.tsx +3 -3
- package/src/provider/referrer.ts +24 -32
- package/src/strings/index.ts +5 -3
- package/src/types.ts +7 -10
- package/dist/chunk-A7ETZFNH.js.map +0 -1
- package/dist/chunk-GN5DYVN5.js.map +0 -1
- package/dist/chunk-YORZNYZZ.js.map +0 -1
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus } from '@tetsuo-ai/marketplace-sdk';
|
|
1
|
+
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
|
|
2
2
|
import { Address, TransactionSigner } from '@solana/kit';
|
|
3
|
-
|
|
3
|
+
import { H as HumanlessHireInput } from '../useAgentTrackRecord-BCvRHYM2.cjs';
|
|
4
|
+
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions, j as UseAgentTrackRecordResult, k as UseDisputeOptions, l as UseDisputeResult, m as UseHireResult, n as UseSubmissionReviewResult, p as projectTrackRecord, u as useAgentTrackRecord, o as useDispute, q as useHire, r as useSubmissionReview } from '../useAgentTrackRecord-BCvRHYM2.cjs';
|
|
4
5
|
|
|
5
6
|
/** A decoded active listing row (address + decoded account). */
|
|
6
7
|
type ListingRow = DecodedProgramAccount<ServiceListing>;
|
|
@@ -169,6 +170,154 @@ interface UseTaskStatusResult {
|
|
|
169
170
|
*/
|
|
170
171
|
declare function useTaskStatus(taskPda: Address | string | undefined | null, options?: UseTaskStatusOptions): UseTaskStatusResult;
|
|
171
172
|
|
|
173
|
+
/** Root namespace for every cache key this package writes. */
|
|
174
|
+
declare const QUERY_KEY_ROOT: "agenc";
|
|
175
|
+
/**
|
|
176
|
+
* Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
|
|
177
|
+
* this factory so a consumer (or a hook) can invalidate a whole sub-tree
|
|
178
|
+
* (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
|
|
179
|
+
*
|
|
180
|
+
* `JSON.stringify` is intentionally NOT used — TanStack compares keys
|
|
181
|
+
* structurally, so passing the raw filter object keeps equality correct for
|
|
182
|
+
* `bigint`/`Address` values without a serialization step.
|
|
183
|
+
*/
|
|
184
|
+
declare const queryKeys: {
|
|
185
|
+
/** All listings list queries (with their filter object as the leaf). */
|
|
186
|
+
readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
|
|
187
|
+
/** One listing + its joined provider/track-record/moderation. */
|
|
188
|
+
readonly listing: (pda: string) => readonly ["agenc", "listing", string];
|
|
189
|
+
/** One agent's indexer track record. */
|
|
190
|
+
readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
|
|
191
|
+
/** One task's status (read via transport / svm decode). */
|
|
192
|
+
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
193
|
+
/** One task's dispute record. */
|
|
194
|
+
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
195
|
+
/** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
|
|
196
|
+
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
197
|
+
};
|
|
198
|
+
type MutationStatus = "idle" | "pending" | "success" | "error";
|
|
199
|
+
|
|
200
|
+
type TaskActivationInput = Omit<Parameters<typeof facade.setTaskJobSpec>[0], "task" | "creator"> & {
|
|
201
|
+
creator?: Parameters<typeof facade.setTaskJobSpec>[0]["creator"];
|
|
202
|
+
};
|
|
203
|
+
type TaskActivationStatus = MutationStatus;
|
|
204
|
+
interface UseTaskActivationResult {
|
|
205
|
+
activate: (input: TaskActivationInput) => Promise<string>;
|
|
206
|
+
status: TaskActivationStatus;
|
|
207
|
+
signature: string | null;
|
|
208
|
+
error: Error | null;
|
|
209
|
+
isPending: boolean;
|
|
210
|
+
reset: () => void;
|
|
211
|
+
}
|
|
212
|
+
declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobSpec>[0]["task"]): UseTaskActivationResult;
|
|
213
|
+
|
|
214
|
+
type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
|
|
215
|
+
type HumanlessHireFlowStatus = MutationStatus;
|
|
216
|
+
type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
|
|
217
|
+
type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri">;
|
|
218
|
+
type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
|
|
219
|
+
type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
|
|
220
|
+
interface HumanlessHireFlowModerationResult {
|
|
221
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash;
|
|
222
|
+
jobSpecUri: string;
|
|
223
|
+
moderationAttested: boolean;
|
|
224
|
+
moderation?: unknown;
|
|
225
|
+
}
|
|
226
|
+
interface HumanlessHireFlowHostInput<TJobSpec> {
|
|
227
|
+
taskPda: Address;
|
|
228
|
+
taskId: HumanlessHireFlowHireInput["taskId"];
|
|
229
|
+
listing: HumanlessHireFlowHireInput["listing"];
|
|
230
|
+
jobSpec: TJobSpec;
|
|
231
|
+
hireSignature: string;
|
|
232
|
+
referrerInjected: boolean;
|
|
233
|
+
}
|
|
234
|
+
type HumanlessHireFlowHost<TJobSpec> = (input: HumanlessHireFlowHostInput<TJobSpec>) => Promise<HumanlessHireFlowModerationResult>;
|
|
235
|
+
interface HumanlessHireFlowInput<TJobSpec = unknown> {
|
|
236
|
+
hire: HumanlessHireFlowHireInput;
|
|
237
|
+
jobSpec: TJobSpec;
|
|
238
|
+
hostAndModerateJobSpec: HumanlessHireFlowHost<TJobSpec>;
|
|
239
|
+
activation?: HumanlessHireFlowActivationInput;
|
|
240
|
+
creator?: HumanlessHireFlowCreator;
|
|
241
|
+
}
|
|
242
|
+
interface HumanlessHireFlowProgress {
|
|
243
|
+
taskPda: Address | null;
|
|
244
|
+
hireSignature: string | null;
|
|
245
|
+
activationSignature: string | null;
|
|
246
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash | null;
|
|
247
|
+
jobSpecUri: string | null;
|
|
248
|
+
referrerInjected: boolean;
|
|
249
|
+
}
|
|
250
|
+
interface HumanlessHireFlowResult {
|
|
251
|
+
taskPda: Address;
|
|
252
|
+
hireSignature: string;
|
|
253
|
+
activationSignature: string;
|
|
254
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash;
|
|
255
|
+
jobSpecUri: string;
|
|
256
|
+
referrerInjected: boolean;
|
|
257
|
+
moderation?: unknown;
|
|
258
|
+
}
|
|
259
|
+
interface UseHumanlessHireFlowResult<TJobSpec = unknown> {
|
|
260
|
+
hireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>) => Promise<HumanlessHireFlowResult>;
|
|
261
|
+
phase: HumanlessHireFlowPhase;
|
|
262
|
+
status: HumanlessHireFlowStatus;
|
|
263
|
+
progress: HumanlessHireFlowProgress;
|
|
264
|
+
result: HumanlessHireFlowResult | null;
|
|
265
|
+
error: Error | null;
|
|
266
|
+
isPending: boolean;
|
|
267
|
+
reset: () => void;
|
|
268
|
+
}
|
|
269
|
+
declare function useHumanlessHireFlow<TJobSpec = unknown>(): UseHumanlessHireFlowResult<TJobSpec>;
|
|
270
|
+
|
|
271
|
+
type ClaimTaskInput = Omit<Parameters<typeof facade.claimTaskWithJobSpec>[0], "task">;
|
|
272
|
+
type SubmitTaskResultInput = Omit<Parameters<typeof facade.submitTaskResult>[0], "task">;
|
|
273
|
+
type TaskWorkStatus = MutationStatus;
|
|
274
|
+
interface UseTaskWorkResult {
|
|
275
|
+
claim: (input: ClaimTaskInput) => Promise<string>;
|
|
276
|
+
submit: (input: SubmitTaskResultInput) => Promise<string>;
|
|
277
|
+
status: TaskWorkStatus;
|
|
278
|
+
signature: string | null;
|
|
279
|
+
error: Error | null;
|
|
280
|
+
isPending: boolean;
|
|
281
|
+
reset: () => void;
|
|
282
|
+
}
|
|
283
|
+
declare function useTaskWork(taskPda: Parameters<typeof facade.claimTaskWithJobSpec>[0]["task"]): UseTaskWorkResult;
|
|
284
|
+
|
|
285
|
+
type CancelTaskInput = Omit<Parameters<typeof facade.cancelTask>[0], "task" | "authority"> & {
|
|
286
|
+
authority?: Parameters<typeof facade.cancelTask>[0]["authority"];
|
|
287
|
+
};
|
|
288
|
+
type CloseTaskInput = Omit<Parameters<typeof facade.closeTask>[0], "task" | "authority"> & {
|
|
289
|
+
authority?: Parameters<typeof facade.closeTask>[0]["authority"];
|
|
290
|
+
};
|
|
291
|
+
type AutoAcceptTaskResultInput = Omit<Parameters<typeof facade.autoAcceptTaskResult>[0], "task" | "authority"> & {
|
|
292
|
+
authority?: Parameters<typeof facade.autoAcceptTaskResult>[0]["authority"];
|
|
293
|
+
};
|
|
294
|
+
type TaskLifecycleStatus = MutationStatus;
|
|
295
|
+
interface UseTaskLifecycleResult {
|
|
296
|
+
cancel: (input?: CancelTaskInput) => Promise<string>;
|
|
297
|
+
close: (input?: CloseTaskInput) => Promise<string>;
|
|
298
|
+
autoAccept: (input: AutoAcceptTaskResultInput) => Promise<string>;
|
|
299
|
+
status: TaskLifecycleStatus;
|
|
300
|
+
signature: string | null;
|
|
301
|
+
error: Error | null;
|
|
302
|
+
isPending: boolean;
|
|
303
|
+
reset: () => void;
|
|
304
|
+
}
|
|
305
|
+
declare function useTaskLifecycle(taskPda: Parameters<typeof facade.cancelTask>[0]["task"]): UseTaskLifecycleResult;
|
|
306
|
+
|
|
307
|
+
type RateHireInput = Omit<Parameters<typeof facade.rateHire>[0], "task" | "buyer"> & {
|
|
308
|
+
buyer?: Parameters<typeof facade.rateHire>[0]["buyer"];
|
|
309
|
+
};
|
|
310
|
+
type RateHireStatus = MutationStatus;
|
|
311
|
+
interface UseRateHireResult {
|
|
312
|
+
rate: (input: RateHireInput) => Promise<string>;
|
|
313
|
+
status: RateHireStatus;
|
|
314
|
+
signature: string | null;
|
|
315
|
+
error: Error | null;
|
|
316
|
+
isPending: boolean;
|
|
317
|
+
reset: () => void;
|
|
318
|
+
}
|
|
319
|
+
declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
|
|
320
|
+
|
|
172
321
|
/**
|
|
173
322
|
* The minimal adapter shape this hook bridges. The forthcoming
|
|
174
323
|
* `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
|
|
@@ -215,7 +364,7 @@ interface UseWalletSignerResult {
|
|
|
215
364
|
*/
|
|
216
365
|
declare function useWalletSigner(options?: UseWalletSignerOptions): UseWalletSignerResult;
|
|
217
366
|
|
|
218
|
-
/** A single referral-earning hire (shape defined now; populated
|
|
367
|
+
/** A single referral-earning hire (shape defined now; populated once the earnings indexer ships). */
|
|
219
368
|
interface ReferrerHire {
|
|
220
369
|
/** The minted Task PDA of the referred hire. */
|
|
221
370
|
taskPda: string;
|
|
@@ -229,16 +378,16 @@ interface ReferrerHire {
|
|
|
229
378
|
/** Return value of {@link useReferrerEarnings}. */
|
|
230
379
|
interface UseReferrerEarningsResult {
|
|
231
380
|
/**
|
|
232
|
-
* Whether referral
|
|
233
|
-
*
|
|
234
|
-
* zero state, not real data.
|
|
381
|
+
* Whether aggregated referral earnings are live. Settlement may be live even
|
|
382
|
+
* when this is false; false means the numbers below are the documented
|
|
383
|
+
* not-live zero state, not real data.
|
|
235
384
|
*/
|
|
236
385
|
live: boolean;
|
|
237
386
|
/** Total lamports earned. `0n` while not live (never fabricated). */
|
|
238
387
|
totalLamports: bigint;
|
|
239
388
|
/** Per-hire earnings. `[]` while not live. */
|
|
240
389
|
hires: ReferrerHire[];
|
|
241
|
-
/** True while a
|
|
390
|
+
/** True while a fetch is in flight. Always false until the earnings indexer ships. */
|
|
242
391
|
isLoading: boolean;
|
|
243
392
|
/** The fetch error, or null. */
|
|
244
393
|
error: Error | null;
|
|
@@ -255,40 +404,15 @@ interface UseReferrerEarningsResult {
|
|
|
255
404
|
*
|
|
256
405
|
* @param wallet - The referrer wallet (base58 / Address). Falsy disables the
|
|
257
406
|
* (future) fetch; the not-live state is still returned.
|
|
258
|
-
|
|
407
|
+
* @returns {@link UseReferrerEarningsResult} — the not-live zero state until
|
|
408
|
+
* the earnings indexer ships.
|
|
259
409
|
*
|
|
260
410
|
* @example
|
|
261
411
|
* ```tsx
|
|
262
412
|
* const { live, totalLamports, hires, reason } = useReferrerEarnings(myWallet);
|
|
263
|
-
|
|
413
|
+
* // until the earnings indexer ships: live === false, totalLamports === 0n, hires === []
|
|
264
414
|
* ```
|
|
265
415
|
*/
|
|
266
416
|
declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
|
|
267
417
|
|
|
268
|
-
|
|
269
|
-
declare const QUERY_KEY_ROOT: "agenc";
|
|
270
|
-
/**
|
|
271
|
-
* Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
|
|
272
|
-
* this factory so a consumer (or a hook) can invalidate a whole sub-tree
|
|
273
|
-
* (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
|
|
274
|
-
*
|
|
275
|
-
* `JSON.stringify` is intentionally NOT used — TanStack compares keys
|
|
276
|
-
* structurally, so passing the raw filter object keeps equality correct for
|
|
277
|
-
* `bigint`/`Address` values without a serialization step.
|
|
278
|
-
*/
|
|
279
|
-
declare const queryKeys: {
|
|
280
|
-
/** All listings list queries (with their filter object as the leaf). */
|
|
281
|
-
readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
|
|
282
|
-
/** One listing + its joined provider/track-record/moderation. */
|
|
283
|
-
readonly listing: (pda: string) => readonly ["agenc", "listing", string];
|
|
284
|
-
/** One agent's indexer track record. */
|
|
285
|
-
readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
|
|
286
|
-
/** One task's status (read via transport / svm decode). */
|
|
287
|
-
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
288
|
-
/** One task's dispute record. */
|
|
289
|
-
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
290
|
-
/** One referrer wallet's earnings (P6.2-gated; see useReferrerEarnings). */
|
|
291
|
-
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export { type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type ReferrerHire, type TaskEventsSource, type TaskReader, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseReferrerEarningsResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useListing, useListings, useReferrerEarnings, useTaskStatus, useWalletSigner };
|
|
418
|
+
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus } from '@tetsuo-ai/marketplace-sdk';
|
|
1
|
+
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
|
|
2
2
|
import { Address, TransactionSigner } from '@solana/kit';
|
|
3
|
-
|
|
3
|
+
import { H as HumanlessHireInput } from '../useAgentTrackRecord-BCvRHYM2.js';
|
|
4
|
+
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions, j as UseAgentTrackRecordResult, k as UseDisputeOptions, l as UseDisputeResult, m as UseHireResult, n as UseSubmissionReviewResult, p as projectTrackRecord, u as useAgentTrackRecord, o as useDispute, q as useHire, r as useSubmissionReview } from '../useAgentTrackRecord-BCvRHYM2.js';
|
|
4
5
|
|
|
5
6
|
/** A decoded active listing row (address + decoded account). */
|
|
6
7
|
type ListingRow = DecodedProgramAccount<ServiceListing>;
|
|
@@ -169,6 +170,154 @@ interface UseTaskStatusResult {
|
|
|
169
170
|
*/
|
|
170
171
|
declare function useTaskStatus(taskPda: Address | string | undefined | null, options?: UseTaskStatusOptions): UseTaskStatusResult;
|
|
171
172
|
|
|
173
|
+
/** Root namespace for every cache key this package writes. */
|
|
174
|
+
declare const QUERY_KEY_ROOT: "agenc";
|
|
175
|
+
/**
|
|
176
|
+
* Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
|
|
177
|
+
* this factory so a consumer (or a hook) can invalidate a whole sub-tree
|
|
178
|
+
* (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
|
|
179
|
+
*
|
|
180
|
+
* `JSON.stringify` is intentionally NOT used — TanStack compares keys
|
|
181
|
+
* structurally, so passing the raw filter object keeps equality correct for
|
|
182
|
+
* `bigint`/`Address` values without a serialization step.
|
|
183
|
+
*/
|
|
184
|
+
declare const queryKeys: {
|
|
185
|
+
/** All listings list queries (with their filter object as the leaf). */
|
|
186
|
+
readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
|
|
187
|
+
/** One listing + its joined provider/track-record/moderation. */
|
|
188
|
+
readonly listing: (pda: string) => readonly ["agenc", "listing", string];
|
|
189
|
+
/** One agent's indexer track record. */
|
|
190
|
+
readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
|
|
191
|
+
/** One task's status (read via transport / svm decode). */
|
|
192
|
+
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
193
|
+
/** One task's dispute record. */
|
|
194
|
+
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
195
|
+
/** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
|
|
196
|
+
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
197
|
+
};
|
|
198
|
+
type MutationStatus = "idle" | "pending" | "success" | "error";
|
|
199
|
+
|
|
200
|
+
type TaskActivationInput = Omit<Parameters<typeof facade.setTaskJobSpec>[0], "task" | "creator"> & {
|
|
201
|
+
creator?: Parameters<typeof facade.setTaskJobSpec>[0]["creator"];
|
|
202
|
+
};
|
|
203
|
+
type TaskActivationStatus = MutationStatus;
|
|
204
|
+
interface UseTaskActivationResult {
|
|
205
|
+
activate: (input: TaskActivationInput) => Promise<string>;
|
|
206
|
+
status: TaskActivationStatus;
|
|
207
|
+
signature: string | null;
|
|
208
|
+
error: Error | null;
|
|
209
|
+
isPending: boolean;
|
|
210
|
+
reset: () => void;
|
|
211
|
+
}
|
|
212
|
+
declare function useTaskActivation(taskPda: Parameters<typeof facade.setTaskJobSpec>[0]["task"]): UseTaskActivationResult;
|
|
213
|
+
|
|
214
|
+
type HumanlessHireFlowPhase = "idle" | "hiring" | "moderating" | "activating" | "activated" | "error";
|
|
215
|
+
type HumanlessHireFlowStatus = MutationStatus;
|
|
216
|
+
type HumanlessHireFlowHireInput = Omit<HumanlessHireInput, "humanless" | "creator" | "referrer" | "referrerFeeBps">;
|
|
217
|
+
type HumanlessHireFlowActivationInput = Omit<TaskActivationInput, "creator" | "jobSpecHash" | "jobSpecUri">;
|
|
218
|
+
type HumanlessHireFlowCreator = HumanlessHireInput["creator"];
|
|
219
|
+
type HumanlessHireFlowJobSpecHash = Parameters<typeof facade.setTaskJobSpec>[0]["jobSpecHash"];
|
|
220
|
+
interface HumanlessHireFlowModerationResult {
|
|
221
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash;
|
|
222
|
+
jobSpecUri: string;
|
|
223
|
+
moderationAttested: boolean;
|
|
224
|
+
moderation?: unknown;
|
|
225
|
+
}
|
|
226
|
+
interface HumanlessHireFlowHostInput<TJobSpec> {
|
|
227
|
+
taskPda: Address;
|
|
228
|
+
taskId: HumanlessHireFlowHireInput["taskId"];
|
|
229
|
+
listing: HumanlessHireFlowHireInput["listing"];
|
|
230
|
+
jobSpec: TJobSpec;
|
|
231
|
+
hireSignature: string;
|
|
232
|
+
referrerInjected: boolean;
|
|
233
|
+
}
|
|
234
|
+
type HumanlessHireFlowHost<TJobSpec> = (input: HumanlessHireFlowHostInput<TJobSpec>) => Promise<HumanlessHireFlowModerationResult>;
|
|
235
|
+
interface HumanlessHireFlowInput<TJobSpec = unknown> {
|
|
236
|
+
hire: HumanlessHireFlowHireInput;
|
|
237
|
+
jobSpec: TJobSpec;
|
|
238
|
+
hostAndModerateJobSpec: HumanlessHireFlowHost<TJobSpec>;
|
|
239
|
+
activation?: HumanlessHireFlowActivationInput;
|
|
240
|
+
creator?: HumanlessHireFlowCreator;
|
|
241
|
+
}
|
|
242
|
+
interface HumanlessHireFlowProgress {
|
|
243
|
+
taskPda: Address | null;
|
|
244
|
+
hireSignature: string | null;
|
|
245
|
+
activationSignature: string | null;
|
|
246
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash | null;
|
|
247
|
+
jobSpecUri: string | null;
|
|
248
|
+
referrerInjected: boolean;
|
|
249
|
+
}
|
|
250
|
+
interface HumanlessHireFlowResult {
|
|
251
|
+
taskPda: Address;
|
|
252
|
+
hireSignature: string;
|
|
253
|
+
activationSignature: string;
|
|
254
|
+
jobSpecHash: HumanlessHireFlowJobSpecHash;
|
|
255
|
+
jobSpecUri: string;
|
|
256
|
+
referrerInjected: boolean;
|
|
257
|
+
moderation?: unknown;
|
|
258
|
+
}
|
|
259
|
+
interface UseHumanlessHireFlowResult<TJobSpec = unknown> {
|
|
260
|
+
hireAndActivate: (input: HumanlessHireFlowInput<TJobSpec>) => Promise<HumanlessHireFlowResult>;
|
|
261
|
+
phase: HumanlessHireFlowPhase;
|
|
262
|
+
status: HumanlessHireFlowStatus;
|
|
263
|
+
progress: HumanlessHireFlowProgress;
|
|
264
|
+
result: HumanlessHireFlowResult | null;
|
|
265
|
+
error: Error | null;
|
|
266
|
+
isPending: boolean;
|
|
267
|
+
reset: () => void;
|
|
268
|
+
}
|
|
269
|
+
declare function useHumanlessHireFlow<TJobSpec = unknown>(): UseHumanlessHireFlowResult<TJobSpec>;
|
|
270
|
+
|
|
271
|
+
type ClaimTaskInput = Omit<Parameters<typeof facade.claimTaskWithJobSpec>[0], "task">;
|
|
272
|
+
type SubmitTaskResultInput = Omit<Parameters<typeof facade.submitTaskResult>[0], "task">;
|
|
273
|
+
type TaskWorkStatus = MutationStatus;
|
|
274
|
+
interface UseTaskWorkResult {
|
|
275
|
+
claim: (input: ClaimTaskInput) => Promise<string>;
|
|
276
|
+
submit: (input: SubmitTaskResultInput) => Promise<string>;
|
|
277
|
+
status: TaskWorkStatus;
|
|
278
|
+
signature: string | null;
|
|
279
|
+
error: Error | null;
|
|
280
|
+
isPending: boolean;
|
|
281
|
+
reset: () => void;
|
|
282
|
+
}
|
|
283
|
+
declare function useTaskWork(taskPda: Parameters<typeof facade.claimTaskWithJobSpec>[0]["task"]): UseTaskWorkResult;
|
|
284
|
+
|
|
285
|
+
type CancelTaskInput = Omit<Parameters<typeof facade.cancelTask>[0], "task" | "authority"> & {
|
|
286
|
+
authority?: Parameters<typeof facade.cancelTask>[0]["authority"];
|
|
287
|
+
};
|
|
288
|
+
type CloseTaskInput = Omit<Parameters<typeof facade.closeTask>[0], "task" | "authority"> & {
|
|
289
|
+
authority?: Parameters<typeof facade.closeTask>[0]["authority"];
|
|
290
|
+
};
|
|
291
|
+
type AutoAcceptTaskResultInput = Omit<Parameters<typeof facade.autoAcceptTaskResult>[0], "task" | "authority"> & {
|
|
292
|
+
authority?: Parameters<typeof facade.autoAcceptTaskResult>[0]["authority"];
|
|
293
|
+
};
|
|
294
|
+
type TaskLifecycleStatus = MutationStatus;
|
|
295
|
+
interface UseTaskLifecycleResult {
|
|
296
|
+
cancel: (input?: CancelTaskInput) => Promise<string>;
|
|
297
|
+
close: (input?: CloseTaskInput) => Promise<string>;
|
|
298
|
+
autoAccept: (input: AutoAcceptTaskResultInput) => Promise<string>;
|
|
299
|
+
status: TaskLifecycleStatus;
|
|
300
|
+
signature: string | null;
|
|
301
|
+
error: Error | null;
|
|
302
|
+
isPending: boolean;
|
|
303
|
+
reset: () => void;
|
|
304
|
+
}
|
|
305
|
+
declare function useTaskLifecycle(taskPda: Parameters<typeof facade.cancelTask>[0]["task"]): UseTaskLifecycleResult;
|
|
306
|
+
|
|
307
|
+
type RateHireInput = Omit<Parameters<typeof facade.rateHire>[0], "task" | "buyer"> & {
|
|
308
|
+
buyer?: Parameters<typeof facade.rateHire>[0]["buyer"];
|
|
309
|
+
};
|
|
310
|
+
type RateHireStatus = MutationStatus;
|
|
311
|
+
interface UseRateHireResult {
|
|
312
|
+
rate: (input: RateHireInput) => Promise<string>;
|
|
313
|
+
status: RateHireStatus;
|
|
314
|
+
signature: string | null;
|
|
315
|
+
error: Error | null;
|
|
316
|
+
isPending: boolean;
|
|
317
|
+
reset: () => void;
|
|
318
|
+
}
|
|
319
|
+
declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
|
|
320
|
+
|
|
172
321
|
/**
|
|
173
322
|
* The minimal adapter shape this hook bridges. The forthcoming
|
|
174
323
|
* `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
|
|
@@ -215,7 +364,7 @@ interface UseWalletSignerResult {
|
|
|
215
364
|
*/
|
|
216
365
|
declare function useWalletSigner(options?: UseWalletSignerOptions): UseWalletSignerResult;
|
|
217
366
|
|
|
218
|
-
/** A single referral-earning hire (shape defined now; populated
|
|
367
|
+
/** A single referral-earning hire (shape defined now; populated once the earnings indexer ships). */
|
|
219
368
|
interface ReferrerHire {
|
|
220
369
|
/** The minted Task PDA of the referred hire. */
|
|
221
370
|
taskPda: string;
|
|
@@ -229,16 +378,16 @@ interface ReferrerHire {
|
|
|
229
378
|
/** Return value of {@link useReferrerEarnings}. */
|
|
230
379
|
interface UseReferrerEarningsResult {
|
|
231
380
|
/**
|
|
232
|
-
* Whether referral
|
|
233
|
-
*
|
|
234
|
-
* zero state, not real data.
|
|
381
|
+
* Whether aggregated referral earnings are live. Settlement may be live even
|
|
382
|
+
* when this is false; false means the numbers below are the documented
|
|
383
|
+
* not-live zero state, not real data.
|
|
235
384
|
*/
|
|
236
385
|
live: boolean;
|
|
237
386
|
/** Total lamports earned. `0n` while not live (never fabricated). */
|
|
238
387
|
totalLamports: bigint;
|
|
239
388
|
/** Per-hire earnings. `[]` while not live. */
|
|
240
389
|
hires: ReferrerHire[];
|
|
241
|
-
/** True while a
|
|
390
|
+
/** True while a fetch is in flight. Always false until the earnings indexer ships. */
|
|
242
391
|
isLoading: boolean;
|
|
243
392
|
/** The fetch error, or null. */
|
|
244
393
|
error: Error | null;
|
|
@@ -255,40 +404,15 @@ interface UseReferrerEarningsResult {
|
|
|
255
404
|
*
|
|
256
405
|
* @param wallet - The referrer wallet (base58 / Address). Falsy disables the
|
|
257
406
|
* (future) fetch; the not-live state is still returned.
|
|
258
|
-
|
|
407
|
+
* @returns {@link UseReferrerEarningsResult} — the not-live zero state until
|
|
408
|
+
* the earnings indexer ships.
|
|
259
409
|
*
|
|
260
410
|
* @example
|
|
261
411
|
* ```tsx
|
|
262
412
|
* const { live, totalLamports, hires, reason } = useReferrerEarnings(myWallet);
|
|
263
|
-
|
|
413
|
+
* // until the earnings indexer ships: live === false, totalLamports === 0n, hires === []
|
|
264
414
|
* ```
|
|
265
415
|
*/
|
|
266
416
|
declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
|
|
267
417
|
|
|
268
|
-
|
|
269
|
-
declare const QUERY_KEY_ROOT: "agenc";
|
|
270
|
-
/**
|
|
271
|
-
* Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through
|
|
272
|
-
* this factory so a consumer (or a hook) can invalidate a whole sub-tree
|
|
273
|
-
* (`["agenc", "listings"]`) or one entity (`["agenc", "listing", pda]`).
|
|
274
|
-
*
|
|
275
|
-
* `JSON.stringify` is intentionally NOT used — TanStack compares keys
|
|
276
|
-
* structurally, so passing the raw filter object keeps equality correct for
|
|
277
|
-
* `bigint`/`Address` values without a serialization step.
|
|
278
|
-
*/
|
|
279
|
-
declare const queryKeys: {
|
|
280
|
-
/** All listings list queries (with their filter object as the leaf). */
|
|
281
|
-
readonly listings: (filter?: unknown) => readonly ["agenc", "listings", {} | null];
|
|
282
|
-
/** One listing + its joined provider/track-record/moderation. */
|
|
283
|
-
readonly listing: (pda: string) => readonly ["agenc", "listing", string];
|
|
284
|
-
/** One agent's indexer track record. */
|
|
285
|
-
readonly agentTrackRecord: (agentPda: string) => readonly ["agenc", "agentTrackRecord", string];
|
|
286
|
-
/** One task's status (read via transport / svm decode). */
|
|
287
|
-
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
288
|
-
/** One task's dispute record. */
|
|
289
|
-
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
290
|
-
/** One referrer wallet's earnings (P6.2-gated; see useReferrerEarnings). */
|
|
291
|
-
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export { type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type ReferrerHire, type TaskEventsSource, type TaskReader, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseReferrerEarningsResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useListing, useListings, useReferrerEarnings, useTaskStatus, useWalletSigner };
|
|
418
|
+
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|