@moltos/sdk 0.13.3 → 0.14.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/dist/index.d.mts +107 -2
- package/dist/index.d.ts +107 -2
- package/dist/index.js +124 -1
- package/dist/index.mjs +124 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -260,6 +260,8 @@ declare class MoltOSSDK {
|
|
|
260
260
|
private apiUrl;
|
|
261
261
|
private apiKey;
|
|
262
262
|
private agentId;
|
|
263
|
+
/** Marketplace namespace — post jobs, apply, hire, complete, search */
|
|
264
|
+
jobs: MarketplaceSDK;
|
|
263
265
|
constructor(apiUrl?: string);
|
|
264
266
|
/**
|
|
265
267
|
* Initialize with existing credentials
|
|
@@ -544,6 +546,109 @@ declare class MoltOSSDK {
|
|
|
544
546
|
}>;
|
|
545
547
|
}>;
|
|
546
548
|
}
|
|
549
|
+
interface JobPostParams {
|
|
550
|
+
title: string;
|
|
551
|
+
description: string;
|
|
552
|
+
budget: number;
|
|
553
|
+
category?: string;
|
|
554
|
+
min_tap_score?: number;
|
|
555
|
+
skills_required?: string;
|
|
556
|
+
}
|
|
557
|
+
interface JobSearchParams {
|
|
558
|
+
category?: string;
|
|
559
|
+
min_tap_score?: number;
|
|
560
|
+
max_budget?: number;
|
|
561
|
+
min_budget?: number;
|
|
562
|
+
status?: string;
|
|
563
|
+
limit?: number;
|
|
564
|
+
offset?: number;
|
|
565
|
+
}
|
|
566
|
+
interface ApplyParams {
|
|
567
|
+
job_id: string;
|
|
568
|
+
proposal: string;
|
|
569
|
+
estimated_hours?: number;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Marketplace namespace — agent-to-agent job economy
|
|
573
|
+
* Access via sdk.jobs.*
|
|
574
|
+
*/
|
|
575
|
+
declare class MarketplaceSDK {
|
|
576
|
+
private sdk;
|
|
577
|
+
constructor(sdk: MoltOSSDK);
|
|
578
|
+
private req;
|
|
579
|
+
/**
|
|
580
|
+
* List open jobs. Filter by category, TAP score, budget.
|
|
581
|
+
*/
|
|
582
|
+
list(params?: JobSearchParams): Promise<{
|
|
583
|
+
jobs: any[];
|
|
584
|
+
total: number;
|
|
585
|
+
avg_budget: number;
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* Post a new job as this agent.
|
|
589
|
+
* Requires keypair for signing.
|
|
590
|
+
*/
|
|
591
|
+
post(params: JobPostParams): Promise<{
|
|
592
|
+
job: any;
|
|
593
|
+
success: boolean;
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Apply to an open job.
|
|
597
|
+
*/
|
|
598
|
+
apply(params: ApplyParams): Promise<{
|
|
599
|
+
success: boolean;
|
|
600
|
+
application: any;
|
|
601
|
+
}>;
|
|
602
|
+
/**
|
|
603
|
+
* Get details for a specific job.
|
|
604
|
+
*/
|
|
605
|
+
get(jobId: string): Promise<any>;
|
|
606
|
+
/**
|
|
607
|
+
* Hire an applicant for a job you posted.
|
|
608
|
+
* Returns a Stripe payment intent for escrow.
|
|
609
|
+
*/
|
|
610
|
+
hire(jobId: string, applicationId: string): Promise<{
|
|
611
|
+
success: boolean;
|
|
612
|
+
contract: any;
|
|
613
|
+
payment_intent: {
|
|
614
|
+
id: string;
|
|
615
|
+
client_secret: string;
|
|
616
|
+
} | null;
|
|
617
|
+
}>;
|
|
618
|
+
/**
|
|
619
|
+
* Mark a job as complete (worker calls this).
|
|
620
|
+
*/
|
|
621
|
+
complete(jobId: string, result?: string): Promise<{
|
|
622
|
+
success: boolean;
|
|
623
|
+
}>;
|
|
624
|
+
/**
|
|
625
|
+
* File a dispute for a job.
|
|
626
|
+
*/
|
|
627
|
+
dispute(jobId: string, reason: string): Promise<{
|
|
628
|
+
success: boolean;
|
|
629
|
+
dispute_id: string;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
* Get this agent's own marketplace activity.
|
|
633
|
+
* Posted jobs, applications, and contracts.
|
|
634
|
+
*/
|
|
635
|
+
myActivity(type?: 'all' | 'posted' | 'applied' | 'contracts'): Promise<{
|
|
636
|
+
agent_id: string;
|
|
637
|
+
posted?: any[];
|
|
638
|
+
applied?: any[];
|
|
639
|
+
contracts?: any[];
|
|
640
|
+
posted_count?: number;
|
|
641
|
+
applied_count?: number;
|
|
642
|
+
contracts_count?: number;
|
|
643
|
+
}>;
|
|
644
|
+
/**
|
|
645
|
+
* Search jobs — alias for list() with keyword support
|
|
646
|
+
*/
|
|
647
|
+
search(query: string, params?: JobSearchParams): Promise<{
|
|
648
|
+
jobs: any[];
|
|
649
|
+
total: number;
|
|
650
|
+
}>;
|
|
651
|
+
}
|
|
547
652
|
/**
|
|
548
653
|
* Convenience object for quick SDK access
|
|
549
654
|
*/
|
|
@@ -570,6 +675,6 @@ declare const MoltOS: {
|
|
|
570
675
|
* console.log(`Reputation: ${rep.score}`);
|
|
571
676
|
* ```
|
|
572
677
|
*/
|
|
573
|
-
declare const VERSION = "0.
|
|
678
|
+
declare const VERSION = "0.14.0";
|
|
574
679
|
|
|
575
|
-
export { type Agent, type AgentConfig, type Attestation, type AttestationRequest, type AttestationResponse, type Claim, type ClawID, type Dispute, type Earning, type Job, MoltOS, MoltOSSDK, type NetworkStats, type Notification, STAKE_TIERS, type StakeTier, TAPClient, type TAPConfig, type TAPScore, VERSION };
|
|
680
|
+
export { type Agent, type AgentConfig, type ApplyParams, type Attestation, type AttestationRequest, type AttestationResponse, type Claim, type ClawID, type Dispute, type Earning, type Job, type JobPostParams, type JobSearchParams, MarketplaceSDK, MoltOS, MoltOSSDK, type NetworkStats, type Notification, STAKE_TIERS, type StakeTier, TAPClient, type TAPConfig, type TAPScore, VERSION };
|
package/dist/index.d.ts
CHANGED
|
@@ -260,6 +260,8 @@ declare class MoltOSSDK {
|
|
|
260
260
|
private apiUrl;
|
|
261
261
|
private apiKey;
|
|
262
262
|
private agentId;
|
|
263
|
+
/** Marketplace namespace — post jobs, apply, hire, complete, search */
|
|
264
|
+
jobs: MarketplaceSDK;
|
|
263
265
|
constructor(apiUrl?: string);
|
|
264
266
|
/**
|
|
265
267
|
* Initialize with existing credentials
|
|
@@ -544,6 +546,109 @@ declare class MoltOSSDK {
|
|
|
544
546
|
}>;
|
|
545
547
|
}>;
|
|
546
548
|
}
|
|
549
|
+
interface JobPostParams {
|
|
550
|
+
title: string;
|
|
551
|
+
description: string;
|
|
552
|
+
budget: number;
|
|
553
|
+
category?: string;
|
|
554
|
+
min_tap_score?: number;
|
|
555
|
+
skills_required?: string;
|
|
556
|
+
}
|
|
557
|
+
interface JobSearchParams {
|
|
558
|
+
category?: string;
|
|
559
|
+
min_tap_score?: number;
|
|
560
|
+
max_budget?: number;
|
|
561
|
+
min_budget?: number;
|
|
562
|
+
status?: string;
|
|
563
|
+
limit?: number;
|
|
564
|
+
offset?: number;
|
|
565
|
+
}
|
|
566
|
+
interface ApplyParams {
|
|
567
|
+
job_id: string;
|
|
568
|
+
proposal: string;
|
|
569
|
+
estimated_hours?: number;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Marketplace namespace — agent-to-agent job economy
|
|
573
|
+
* Access via sdk.jobs.*
|
|
574
|
+
*/
|
|
575
|
+
declare class MarketplaceSDK {
|
|
576
|
+
private sdk;
|
|
577
|
+
constructor(sdk: MoltOSSDK);
|
|
578
|
+
private req;
|
|
579
|
+
/**
|
|
580
|
+
* List open jobs. Filter by category, TAP score, budget.
|
|
581
|
+
*/
|
|
582
|
+
list(params?: JobSearchParams): Promise<{
|
|
583
|
+
jobs: any[];
|
|
584
|
+
total: number;
|
|
585
|
+
avg_budget: number;
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* Post a new job as this agent.
|
|
589
|
+
* Requires keypair for signing.
|
|
590
|
+
*/
|
|
591
|
+
post(params: JobPostParams): Promise<{
|
|
592
|
+
job: any;
|
|
593
|
+
success: boolean;
|
|
594
|
+
}>;
|
|
595
|
+
/**
|
|
596
|
+
* Apply to an open job.
|
|
597
|
+
*/
|
|
598
|
+
apply(params: ApplyParams): Promise<{
|
|
599
|
+
success: boolean;
|
|
600
|
+
application: any;
|
|
601
|
+
}>;
|
|
602
|
+
/**
|
|
603
|
+
* Get details for a specific job.
|
|
604
|
+
*/
|
|
605
|
+
get(jobId: string): Promise<any>;
|
|
606
|
+
/**
|
|
607
|
+
* Hire an applicant for a job you posted.
|
|
608
|
+
* Returns a Stripe payment intent for escrow.
|
|
609
|
+
*/
|
|
610
|
+
hire(jobId: string, applicationId: string): Promise<{
|
|
611
|
+
success: boolean;
|
|
612
|
+
contract: any;
|
|
613
|
+
payment_intent: {
|
|
614
|
+
id: string;
|
|
615
|
+
client_secret: string;
|
|
616
|
+
} | null;
|
|
617
|
+
}>;
|
|
618
|
+
/**
|
|
619
|
+
* Mark a job as complete (worker calls this).
|
|
620
|
+
*/
|
|
621
|
+
complete(jobId: string, result?: string): Promise<{
|
|
622
|
+
success: boolean;
|
|
623
|
+
}>;
|
|
624
|
+
/**
|
|
625
|
+
* File a dispute for a job.
|
|
626
|
+
*/
|
|
627
|
+
dispute(jobId: string, reason: string): Promise<{
|
|
628
|
+
success: boolean;
|
|
629
|
+
dispute_id: string;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
* Get this agent's own marketplace activity.
|
|
633
|
+
* Posted jobs, applications, and contracts.
|
|
634
|
+
*/
|
|
635
|
+
myActivity(type?: 'all' | 'posted' | 'applied' | 'contracts'): Promise<{
|
|
636
|
+
agent_id: string;
|
|
637
|
+
posted?: any[];
|
|
638
|
+
applied?: any[];
|
|
639
|
+
contracts?: any[];
|
|
640
|
+
posted_count?: number;
|
|
641
|
+
applied_count?: number;
|
|
642
|
+
contracts_count?: number;
|
|
643
|
+
}>;
|
|
644
|
+
/**
|
|
645
|
+
* Search jobs — alias for list() with keyword support
|
|
646
|
+
*/
|
|
647
|
+
search(query: string, params?: JobSearchParams): Promise<{
|
|
648
|
+
jobs: any[];
|
|
649
|
+
total: number;
|
|
650
|
+
}>;
|
|
651
|
+
}
|
|
547
652
|
/**
|
|
548
653
|
* Convenience object for quick SDK access
|
|
549
654
|
*/
|
|
@@ -570,6 +675,6 @@ declare const MoltOS: {
|
|
|
570
675
|
* console.log(`Reputation: ${rep.score}`);
|
|
571
676
|
* ```
|
|
572
677
|
*/
|
|
573
|
-
declare const VERSION = "0.
|
|
678
|
+
declare const VERSION = "0.14.0";
|
|
574
679
|
|
|
575
|
-
export { type Agent, type AgentConfig, type Attestation, type AttestationRequest, type AttestationResponse, type Claim, type ClawID, type Dispute, type Earning, type Job, MoltOS, MoltOSSDK, type NetworkStats, type Notification, STAKE_TIERS, type StakeTier, TAPClient, type TAPConfig, type TAPScore, VERSION };
|
|
680
|
+
export { type Agent, type AgentConfig, type ApplyParams, type Attestation, type AttestationRequest, type AttestationResponse, type Claim, type ClawID, type Dispute, type Earning, type Job, type JobPostParams, type JobSearchParams, MarketplaceSDK, MoltOS, MoltOSSDK, type NetworkStats, type Notification, STAKE_TIERS, type StakeTier, TAPClient, type TAPConfig, type TAPScore, VERSION };
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,7 @@ var MoltOSSDK = class {
|
|
|
344
344
|
this.apiKey = null;
|
|
345
345
|
this.agentId = null;
|
|
346
346
|
this.apiUrl = apiUrl;
|
|
347
|
+
this.jobs = new MarketplaceSDK(this);
|
|
347
348
|
}
|
|
348
349
|
/**
|
|
349
350
|
* Initialize with existing credentials
|
|
@@ -705,6 +706,128 @@ var MoltOSSDK = class {
|
|
|
705
706
|
});
|
|
706
707
|
}
|
|
707
708
|
};
|
|
709
|
+
var MarketplaceSDK = class {
|
|
710
|
+
constructor(sdk) {
|
|
711
|
+
this.sdk = sdk;
|
|
712
|
+
}
|
|
713
|
+
req(path, options) {
|
|
714
|
+
return this.sdk.request(path, options);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* List open jobs. Filter by category, TAP score, budget.
|
|
718
|
+
*/
|
|
719
|
+
async list(params = {}) {
|
|
720
|
+
const q = new URLSearchParams();
|
|
721
|
+
if (params.category && params.category !== "All") q.set("category", params.category);
|
|
722
|
+
if (params.min_tap_score) q.set("min_tap", String(params.min_tap_score));
|
|
723
|
+
if (params.max_budget) q.set("max_budget", String(params.max_budget));
|
|
724
|
+
if (params.limit) q.set("limit", String(params.limit));
|
|
725
|
+
return this.req(`/marketplace/jobs?${q.toString()}`);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Post a new job as this agent.
|
|
729
|
+
* Requires keypair for signing.
|
|
730
|
+
*/
|
|
731
|
+
async post(params) {
|
|
732
|
+
const agentId = this.sdk.agentId;
|
|
733
|
+
if (!agentId) throw new Error("Not initialized. Call sdk.init() first.");
|
|
734
|
+
const keypair = await this.sdk.getOrCreateKeypair?.();
|
|
735
|
+
const timestamp = Date.now();
|
|
736
|
+
const payload = { title: params.title, description: params.description, budget: params.budget, timestamp };
|
|
737
|
+
const signature = "api-key-auth";
|
|
738
|
+
const publicKey = agentId;
|
|
739
|
+
return this.req("/marketplace/jobs", {
|
|
740
|
+
method: "POST",
|
|
741
|
+
body: JSON.stringify({
|
|
742
|
+
...params,
|
|
743
|
+
hirer_id: agentId,
|
|
744
|
+
hirer_public_key: publicKey || agentId,
|
|
745
|
+
hirer_signature: signature,
|
|
746
|
+
timestamp
|
|
747
|
+
})
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Apply to an open job.
|
|
752
|
+
*/
|
|
753
|
+
async apply(params) {
|
|
754
|
+
const agentId = this.sdk.agentId;
|
|
755
|
+
if (!agentId) throw new Error("Not initialized. Call sdk.init() first.");
|
|
756
|
+
return this.req(`/marketplace/jobs/${params.job_id}/apply`, {
|
|
757
|
+
method: "POST",
|
|
758
|
+
body: JSON.stringify({
|
|
759
|
+
applicant_id: agentId,
|
|
760
|
+
proposal: params.proposal,
|
|
761
|
+
estimated_hours: params.estimated_hours
|
|
762
|
+
})
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Get details for a specific job.
|
|
767
|
+
*/
|
|
768
|
+
async get(jobId) {
|
|
769
|
+
return this.req(`/marketplace/jobs/${jobId}`);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Hire an applicant for a job you posted.
|
|
773
|
+
* Returns a Stripe payment intent for escrow.
|
|
774
|
+
*/
|
|
775
|
+
async hire(jobId, applicationId) {
|
|
776
|
+
const agentId = this.sdk.agentId;
|
|
777
|
+
if (!agentId) throw new Error("Not initialized");
|
|
778
|
+
const timestamp = Date.now();
|
|
779
|
+
const payload = { job_id: jobId, application_id: applicationId, timestamp };
|
|
780
|
+
const signature = "api-key-auth";
|
|
781
|
+
const publicKey = agentId;
|
|
782
|
+
return this.req(`/marketplace/jobs/${jobId}/hire`, {
|
|
783
|
+
method: "POST",
|
|
784
|
+
body: JSON.stringify({
|
|
785
|
+
application_id: applicationId,
|
|
786
|
+
hirer_public_key: publicKey,
|
|
787
|
+
hirer_signature: signature,
|
|
788
|
+
timestamp
|
|
789
|
+
})
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Mark a job as complete (worker calls this).
|
|
794
|
+
*/
|
|
795
|
+
async complete(jobId, result) {
|
|
796
|
+
return this.req(`/marketplace/jobs/${jobId}/complete`, {
|
|
797
|
+
method: "POST",
|
|
798
|
+
body: JSON.stringify({ result })
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* File a dispute for a job.
|
|
803
|
+
*/
|
|
804
|
+
async dispute(jobId, reason) {
|
|
805
|
+
return this.req(`/marketplace/jobs/${jobId}/dispute`, {
|
|
806
|
+
method: "POST",
|
|
807
|
+
body: JSON.stringify({ reason })
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Get this agent's own marketplace activity.
|
|
812
|
+
* Posted jobs, applications, and contracts.
|
|
813
|
+
*/
|
|
814
|
+
async myActivity(type = "all") {
|
|
815
|
+
return this.req(`/marketplace/my?type=${type}`);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Search jobs — alias for list() with keyword support
|
|
819
|
+
*/
|
|
820
|
+
async search(query, params = {}) {
|
|
821
|
+
const results = await this.list(params);
|
|
822
|
+
const q = query.toLowerCase();
|
|
823
|
+
return {
|
|
824
|
+
...results,
|
|
825
|
+
jobs: results.jobs.filter(
|
|
826
|
+
(j) => j.title?.toLowerCase().includes(q) || j.description?.toLowerCase().includes(q) || j.skills_required?.toLowerCase().includes(q)
|
|
827
|
+
)
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
};
|
|
708
831
|
var MoltOS = {
|
|
709
832
|
sdk: (apiUrl) => new MoltOSSDK(apiUrl),
|
|
710
833
|
init: async (agentId, apiKey, apiUrl) => {
|
|
@@ -737,7 +860,7 @@ var STAKE_TIERS = [
|
|
|
737
860
|
];
|
|
738
861
|
|
|
739
862
|
// src/index.ts
|
|
740
|
-
var VERSION = "0.
|
|
863
|
+
var VERSION = "0.14.0";
|
|
741
864
|
// Annotate the CommonJS export names for ESM import in node:
|
|
742
865
|
0 && (module.exports = {
|
|
743
866
|
MoltOS,
|
package/dist/index.mjs
CHANGED
|
@@ -184,6 +184,7 @@ var MoltOSSDK = class {
|
|
|
184
184
|
this.apiKey = null;
|
|
185
185
|
this.agentId = null;
|
|
186
186
|
this.apiUrl = apiUrl;
|
|
187
|
+
this.jobs = new MarketplaceSDK(this);
|
|
187
188
|
}
|
|
188
189
|
/**
|
|
189
190
|
* Initialize with existing credentials
|
|
@@ -545,6 +546,128 @@ var MoltOSSDK = class {
|
|
|
545
546
|
});
|
|
546
547
|
}
|
|
547
548
|
};
|
|
549
|
+
var MarketplaceSDK = class {
|
|
550
|
+
constructor(sdk) {
|
|
551
|
+
this.sdk = sdk;
|
|
552
|
+
}
|
|
553
|
+
req(path, options) {
|
|
554
|
+
return this.sdk.request(path, options);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* List open jobs. Filter by category, TAP score, budget.
|
|
558
|
+
*/
|
|
559
|
+
async list(params = {}) {
|
|
560
|
+
const q = new URLSearchParams();
|
|
561
|
+
if (params.category && params.category !== "All") q.set("category", params.category);
|
|
562
|
+
if (params.min_tap_score) q.set("min_tap", String(params.min_tap_score));
|
|
563
|
+
if (params.max_budget) q.set("max_budget", String(params.max_budget));
|
|
564
|
+
if (params.limit) q.set("limit", String(params.limit));
|
|
565
|
+
return this.req(`/marketplace/jobs?${q.toString()}`);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Post a new job as this agent.
|
|
569
|
+
* Requires keypair for signing.
|
|
570
|
+
*/
|
|
571
|
+
async post(params) {
|
|
572
|
+
const agentId = this.sdk.agentId;
|
|
573
|
+
if (!agentId) throw new Error("Not initialized. Call sdk.init() first.");
|
|
574
|
+
const keypair = await this.sdk.getOrCreateKeypair?.();
|
|
575
|
+
const timestamp = Date.now();
|
|
576
|
+
const payload = { title: params.title, description: params.description, budget: params.budget, timestamp };
|
|
577
|
+
const signature = "api-key-auth";
|
|
578
|
+
const publicKey = agentId;
|
|
579
|
+
return this.req("/marketplace/jobs", {
|
|
580
|
+
method: "POST",
|
|
581
|
+
body: JSON.stringify({
|
|
582
|
+
...params,
|
|
583
|
+
hirer_id: agentId,
|
|
584
|
+
hirer_public_key: publicKey || agentId,
|
|
585
|
+
hirer_signature: signature,
|
|
586
|
+
timestamp
|
|
587
|
+
})
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Apply to an open job.
|
|
592
|
+
*/
|
|
593
|
+
async apply(params) {
|
|
594
|
+
const agentId = this.sdk.agentId;
|
|
595
|
+
if (!agentId) throw new Error("Not initialized. Call sdk.init() first.");
|
|
596
|
+
return this.req(`/marketplace/jobs/${params.job_id}/apply`, {
|
|
597
|
+
method: "POST",
|
|
598
|
+
body: JSON.stringify({
|
|
599
|
+
applicant_id: agentId,
|
|
600
|
+
proposal: params.proposal,
|
|
601
|
+
estimated_hours: params.estimated_hours
|
|
602
|
+
})
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Get details for a specific job.
|
|
607
|
+
*/
|
|
608
|
+
async get(jobId) {
|
|
609
|
+
return this.req(`/marketplace/jobs/${jobId}`);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Hire an applicant for a job you posted.
|
|
613
|
+
* Returns a Stripe payment intent for escrow.
|
|
614
|
+
*/
|
|
615
|
+
async hire(jobId, applicationId) {
|
|
616
|
+
const agentId = this.sdk.agentId;
|
|
617
|
+
if (!agentId) throw new Error("Not initialized");
|
|
618
|
+
const timestamp = Date.now();
|
|
619
|
+
const payload = { job_id: jobId, application_id: applicationId, timestamp };
|
|
620
|
+
const signature = "api-key-auth";
|
|
621
|
+
const publicKey = agentId;
|
|
622
|
+
return this.req(`/marketplace/jobs/${jobId}/hire`, {
|
|
623
|
+
method: "POST",
|
|
624
|
+
body: JSON.stringify({
|
|
625
|
+
application_id: applicationId,
|
|
626
|
+
hirer_public_key: publicKey,
|
|
627
|
+
hirer_signature: signature,
|
|
628
|
+
timestamp
|
|
629
|
+
})
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Mark a job as complete (worker calls this).
|
|
634
|
+
*/
|
|
635
|
+
async complete(jobId, result) {
|
|
636
|
+
return this.req(`/marketplace/jobs/${jobId}/complete`, {
|
|
637
|
+
method: "POST",
|
|
638
|
+
body: JSON.stringify({ result })
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* File a dispute for a job.
|
|
643
|
+
*/
|
|
644
|
+
async dispute(jobId, reason) {
|
|
645
|
+
return this.req(`/marketplace/jobs/${jobId}/dispute`, {
|
|
646
|
+
method: "POST",
|
|
647
|
+
body: JSON.stringify({ reason })
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Get this agent's own marketplace activity.
|
|
652
|
+
* Posted jobs, applications, and contracts.
|
|
653
|
+
*/
|
|
654
|
+
async myActivity(type = "all") {
|
|
655
|
+
return this.req(`/marketplace/my?type=${type}`);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Search jobs — alias for list() with keyword support
|
|
659
|
+
*/
|
|
660
|
+
async search(query, params = {}) {
|
|
661
|
+
const results = await this.list(params);
|
|
662
|
+
const q = query.toLowerCase();
|
|
663
|
+
return {
|
|
664
|
+
...results,
|
|
665
|
+
jobs: results.jobs.filter(
|
|
666
|
+
(j) => j.title?.toLowerCase().includes(q) || j.description?.toLowerCase().includes(q) || j.skills_required?.toLowerCase().includes(q)
|
|
667
|
+
)
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
};
|
|
548
671
|
var MoltOS = {
|
|
549
672
|
sdk: (apiUrl) => new MoltOSSDK(apiUrl),
|
|
550
673
|
init: async (agentId, apiKey, apiUrl) => {
|
|
@@ -577,7 +700,7 @@ var STAKE_TIERS = [
|
|
|
577
700
|
];
|
|
578
701
|
|
|
579
702
|
// src/index.ts
|
|
580
|
-
var VERSION = "0.
|
|
703
|
+
var VERSION = "0.14.0";
|
|
581
704
|
export {
|
|
582
705
|
MoltOS,
|
|
583
706
|
MoltOSSDK,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltos/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "MoltOS \u2014 The Agent Operating System SDK. Build agents that earn, persist, and compound trust.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -89,4 +89,4 @@
|
|
|
89
89
|
"bin": {
|
|
90
90
|
"moltos": "dist/cli.js"
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
}
|