@the_ro_show/agent-ads-sdk 0.17.0 → 0.18.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/README.md +30 -14
- package/dist/index.d.mts +741 -2
- package/dist/index.d.ts +741 -2
- package/dist/index.js +594 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +591 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -14,6 +14,10 @@ interface AgentSignupResponse {
|
|
|
14
14
|
agent_id: string;
|
|
15
15
|
api_key: string;
|
|
16
16
|
test_api_key: string;
|
|
17
|
+
/** Live API key (v2 field, same value as api_key) */
|
|
18
|
+
api_key_live?: string;
|
|
19
|
+
/** Test API key (v2 field, same value as test_api_key) */
|
|
20
|
+
api_key_test?: string;
|
|
17
21
|
created_at: string;
|
|
18
22
|
}
|
|
19
23
|
interface DecideRequest {
|
|
@@ -166,6 +170,12 @@ interface DecideFromContextRequest {
|
|
|
166
170
|
* optimizeFor: 'relevance' // Prioritize best semantic match over highest bid
|
|
167
171
|
*/
|
|
168
172
|
optimizeFor?: 'revenue' | 'relevance';
|
|
173
|
+
/**
|
|
174
|
+
* Maximum time in milliseconds to wait for an ad response.
|
|
175
|
+
* Useful for latency-sensitive applications.
|
|
176
|
+
* @since v0.18.0
|
|
177
|
+
*/
|
|
178
|
+
maxWaitMs?: number;
|
|
169
179
|
}
|
|
170
180
|
interface DecideResponse {
|
|
171
181
|
request_id?: string;
|
|
@@ -279,7 +289,7 @@ interface ToolCall {
|
|
|
279
289
|
url: string;
|
|
280
290
|
headers?: Record<string, string>;
|
|
281
291
|
}
|
|
282
|
-
type EventType = 'impression' | 'click' | 'action' | 'conversion' | 'dismiss' | 'hide_advertiser' | 'report' | 'feedback';
|
|
292
|
+
type EventType = 'impression' | 'click' | 'action' | 'conversion' | 'dismiss' | 'hide_advertiser' | 'report' | 'feedback' | 'ad_shown' | 'ad_dismissed' | 'agent_call';
|
|
283
293
|
interface EventIngestRequest {
|
|
284
294
|
event_id: string;
|
|
285
295
|
occurred_at: string;
|
|
@@ -381,6 +391,36 @@ interface FeedbackResponse {
|
|
|
381
391
|
*/
|
|
382
392
|
analysis_mode?: 'auto' | 'fallback';
|
|
383
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Rate the delivery quality of an ad after a verified click.
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* await client.rateBusinessDelivery({
|
|
400
|
+
* tracking_token: ad.tracking_token,
|
|
401
|
+
* ad_unit_id: ad._ad.unit_id,
|
|
402
|
+
* rating: 4,
|
|
403
|
+
* context: 'Relevant product, good landing page'
|
|
404
|
+
* });
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
interface BusinessRatingRequest {
|
|
408
|
+
/** Tracking token from the ad (required) */
|
|
409
|
+
tracking_token: string;
|
|
410
|
+
/** Ad unit ID from the ad response (required) */
|
|
411
|
+
ad_unit_id: string;
|
|
412
|
+
/** Delivery quality rating: 1 (poor) to 5 (excellent) */
|
|
413
|
+
rating: 1 | 2 | 3 | 4 | 5;
|
|
414
|
+
/** Optional context about the rating (max 500 chars) */
|
|
415
|
+
context?: string;
|
|
416
|
+
/** Idempotency key for safe retries (optional) */
|
|
417
|
+
idempotency_key?: string;
|
|
418
|
+
}
|
|
419
|
+
interface BusinessRatingResponse {
|
|
420
|
+
status: 'received';
|
|
421
|
+
rating_id: string;
|
|
422
|
+
campaign_id: string;
|
|
423
|
+
}
|
|
384
424
|
interface PolicyResponse {
|
|
385
425
|
version: string;
|
|
386
426
|
disclosure: {
|
|
@@ -393,6 +433,12 @@ interface PolicyResponse {
|
|
|
393
433
|
blocked_categories: string[];
|
|
394
434
|
};
|
|
395
435
|
unit_rules: Record<string, unknown>;
|
|
436
|
+
/** Rate limits (optional, returned by expanded backend) */
|
|
437
|
+
rate_limits?: Record<string, unknown>;
|
|
438
|
+
/** Supported ad types (optional) */
|
|
439
|
+
supported_ad_types?: string[];
|
|
440
|
+
/** Feature flags (optional) */
|
|
441
|
+
features?: Record<string, boolean>;
|
|
396
442
|
}
|
|
397
443
|
interface APIError {
|
|
398
444
|
error: string;
|
|
@@ -744,6 +790,624 @@ interface GetCategoriesParams {
|
|
|
744
790
|
/** Search by name or path (case-insensitive) */
|
|
745
791
|
search?: string;
|
|
746
792
|
}
|
|
793
|
+
interface CapabilitySessionInitiateRequest {
|
|
794
|
+
/** Type of capability session */
|
|
795
|
+
capability_type: string;
|
|
796
|
+
/** Initial configuration for the session */
|
|
797
|
+
config?: Record<string, unknown>;
|
|
798
|
+
/** Optional metadata */
|
|
799
|
+
metadata?: Record<string, unknown>;
|
|
800
|
+
}
|
|
801
|
+
interface CapabilitySessionInitiateResponse {
|
|
802
|
+
session_id: string;
|
|
803
|
+
status: 'initiated' | 'ready';
|
|
804
|
+
capability_type: string;
|
|
805
|
+
created_at: string;
|
|
806
|
+
}
|
|
807
|
+
interface CapabilitySessionMessageRequest {
|
|
808
|
+
/** Session ID from initiate response */
|
|
809
|
+
session_id: string;
|
|
810
|
+
/** Message content to send */
|
|
811
|
+
message: string;
|
|
812
|
+
/** Optional attachments or context */
|
|
813
|
+
attachments?: Record<string, unknown>[];
|
|
814
|
+
}
|
|
815
|
+
interface CapabilitySessionMessageResponse {
|
|
816
|
+
session_id: string;
|
|
817
|
+
message_id: string;
|
|
818
|
+
response: string;
|
|
819
|
+
/** Structured data from the capability */
|
|
820
|
+
data?: Record<string, unknown>;
|
|
821
|
+
status: 'completed' | 'pending' | 'error';
|
|
822
|
+
}
|
|
823
|
+
interface CapabilitySessionEndRequest {
|
|
824
|
+
/** Session ID to end */
|
|
825
|
+
session_id: string;
|
|
826
|
+
/** Optional reason for ending */
|
|
827
|
+
reason?: string;
|
|
828
|
+
}
|
|
829
|
+
interface CapabilitySessionEndResponse {
|
|
830
|
+
session_id: string;
|
|
831
|
+
status: 'ended';
|
|
832
|
+
/** Summary of the session */
|
|
833
|
+
summary?: string;
|
|
834
|
+
/** Total messages exchanged */
|
|
835
|
+
message_count?: number;
|
|
836
|
+
}
|
|
837
|
+
interface CapabilitySessionConnectGitHubRequest {
|
|
838
|
+
/** Session ID */
|
|
839
|
+
session_id: string;
|
|
840
|
+
/** GitHub repository URL or owner/repo */
|
|
841
|
+
repository: string;
|
|
842
|
+
/** Optional branch */
|
|
843
|
+
branch?: string;
|
|
844
|
+
}
|
|
845
|
+
interface CapabilitySessionConnectGitHubResponse {
|
|
846
|
+
session_id: string;
|
|
847
|
+
status: 'connected' | 'error';
|
|
848
|
+
repository: string;
|
|
849
|
+
branch?: string;
|
|
850
|
+
}
|
|
851
|
+
interface DeveloperLoginRequest {
|
|
852
|
+
email: string;
|
|
853
|
+
password: string;
|
|
854
|
+
}
|
|
855
|
+
interface DeveloperLoginResponse {
|
|
856
|
+
session_token: string;
|
|
857
|
+
developer_id: string;
|
|
858
|
+
email: string;
|
|
859
|
+
expires_at: string;
|
|
860
|
+
}
|
|
861
|
+
interface DeveloperDataResponse {
|
|
862
|
+
developer_id: string;
|
|
863
|
+
email: string;
|
|
864
|
+
agent_name: string;
|
|
865
|
+
created_at: string;
|
|
866
|
+
api_key_live: string;
|
|
867
|
+
api_key_test: string;
|
|
868
|
+
settings?: Record<string, unknown>;
|
|
869
|
+
}
|
|
870
|
+
interface DeveloperEarningsResponse {
|
|
871
|
+
balances: {
|
|
872
|
+
available: number;
|
|
873
|
+
pending: number;
|
|
874
|
+
lifetime: number;
|
|
875
|
+
};
|
|
876
|
+
payout_info: {
|
|
877
|
+
method?: string;
|
|
878
|
+
last_payout_at?: string;
|
|
879
|
+
next_payout_at?: string;
|
|
880
|
+
};
|
|
881
|
+
recent_earnings: Array<{
|
|
882
|
+
date: string;
|
|
883
|
+
amount: number;
|
|
884
|
+
source: string;
|
|
885
|
+
campaign_id?: string;
|
|
886
|
+
}>;
|
|
887
|
+
payouts: Array<{
|
|
888
|
+
id: string;
|
|
889
|
+
amount: number;
|
|
890
|
+
status: string;
|
|
891
|
+
created_at: string;
|
|
892
|
+
}>;
|
|
893
|
+
}
|
|
894
|
+
interface DeveloperStatsRequest {
|
|
895
|
+
/** Time period for stats */
|
|
896
|
+
period?: '7d' | '30d' | '90d' | 'all';
|
|
897
|
+
}
|
|
898
|
+
interface DeveloperStatsResponse {
|
|
899
|
+
period: string;
|
|
900
|
+
impressions: number;
|
|
901
|
+
clicks: number;
|
|
902
|
+
conversions: number;
|
|
903
|
+
earnings: number;
|
|
904
|
+
ctr: number;
|
|
905
|
+
fill_rate: number;
|
|
906
|
+
}
|
|
907
|
+
interface DeveloperAnalyticsRequest {
|
|
908
|
+
session_token: string;
|
|
909
|
+
/** Start date (ISO 8601) */
|
|
910
|
+
start_date?: string;
|
|
911
|
+
/** End date (ISO 8601) */
|
|
912
|
+
end_date?: string;
|
|
913
|
+
/** Group by dimension */
|
|
914
|
+
group_by?: 'day' | 'week' | 'month' | 'campaign';
|
|
915
|
+
}
|
|
916
|
+
interface DeveloperAnalyticsResponse {
|
|
917
|
+
data: Array<{
|
|
918
|
+
period: string;
|
|
919
|
+
impressions: number;
|
|
920
|
+
clicks: number;
|
|
921
|
+
conversions: number;
|
|
922
|
+
earnings: number;
|
|
923
|
+
}>;
|
|
924
|
+
totals: {
|
|
925
|
+
impressions: number;
|
|
926
|
+
clicks: number;
|
|
927
|
+
conversions: number;
|
|
928
|
+
earnings: number;
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
interface RegenerateKeysRequest {
|
|
932
|
+
session_token: string;
|
|
933
|
+
/** Which key to regenerate */
|
|
934
|
+
key_type: 'live' | 'test' | 'both';
|
|
935
|
+
}
|
|
936
|
+
interface RegenerateKeysResponse {
|
|
937
|
+
api_key_live?: string;
|
|
938
|
+
api_key_test?: string;
|
|
939
|
+
regenerated_at: string;
|
|
940
|
+
}
|
|
941
|
+
interface AdvertiserSignupRequest {
|
|
942
|
+
email: string;
|
|
943
|
+
password: string;
|
|
944
|
+
company_name: string;
|
|
945
|
+
website?: string;
|
|
946
|
+
}
|
|
947
|
+
interface AdvertiserSignupResponse {
|
|
948
|
+
advertiser_id: string;
|
|
949
|
+
email: string;
|
|
950
|
+
company_name: string;
|
|
951
|
+
session_token: string;
|
|
952
|
+
created_at: string;
|
|
953
|
+
}
|
|
954
|
+
interface AdvertiserLoginRequest {
|
|
955
|
+
email: string;
|
|
956
|
+
password: string;
|
|
957
|
+
}
|
|
958
|
+
interface AdvertiserLoginResponse {
|
|
959
|
+
session_token: string;
|
|
960
|
+
advertiser_id: string;
|
|
961
|
+
email: string;
|
|
962
|
+
company_name: string;
|
|
963
|
+
expires_at: string;
|
|
964
|
+
}
|
|
965
|
+
interface AdvertiserStatsRequest {
|
|
966
|
+
/** Advertiser API key or ID for lookup */
|
|
967
|
+
advertiser_key?: string;
|
|
968
|
+
/** Time period */
|
|
969
|
+
period?: '7d' | '30d' | '90d' | 'all';
|
|
970
|
+
}
|
|
971
|
+
interface AdvertiserStatsResponse {
|
|
972
|
+
budget: {
|
|
973
|
+
total: number;
|
|
974
|
+
spent: number;
|
|
975
|
+
remaining: number;
|
|
976
|
+
};
|
|
977
|
+
metrics: {
|
|
978
|
+
impressions: number;
|
|
979
|
+
clicks: number;
|
|
980
|
+
conversions: number;
|
|
981
|
+
ctr: number;
|
|
982
|
+
cpc_avg: number;
|
|
983
|
+
};
|
|
984
|
+
campaigns: Array<{
|
|
985
|
+
campaign_id: string;
|
|
986
|
+
name: string;
|
|
987
|
+
status: string;
|
|
988
|
+
budget_spent: number;
|
|
989
|
+
impressions: number;
|
|
990
|
+
clicks: number;
|
|
991
|
+
}>;
|
|
992
|
+
}
|
|
993
|
+
interface AdvertiserAnalyticsRequest {
|
|
994
|
+
session_token: string;
|
|
995
|
+
start_date?: string;
|
|
996
|
+
end_date?: string;
|
|
997
|
+
group_by?: 'day' | 'week' | 'month' | 'campaign';
|
|
998
|
+
}
|
|
999
|
+
interface AdvertiserAnalyticsResponse {
|
|
1000
|
+
data: Array<{
|
|
1001
|
+
period: string;
|
|
1002
|
+
impressions: number;
|
|
1003
|
+
clicks: number;
|
|
1004
|
+
conversions: number;
|
|
1005
|
+
spend: number;
|
|
1006
|
+
}>;
|
|
1007
|
+
totals: {
|
|
1008
|
+
impressions: number;
|
|
1009
|
+
clicks: number;
|
|
1010
|
+
conversions: number;
|
|
1011
|
+
spend: number;
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
interface CampaignCreateRequest {
|
|
1015
|
+
/** Campaign name */
|
|
1016
|
+
name: string;
|
|
1017
|
+
/** Ad type */
|
|
1018
|
+
ad_type: AdType;
|
|
1019
|
+
/** Daily budget in cents */
|
|
1020
|
+
daily_budget: number;
|
|
1021
|
+
/** Bid amount in cents */
|
|
1022
|
+
bid_amount: number;
|
|
1023
|
+
/** Target taxonomy/categories */
|
|
1024
|
+
target_categories?: string[];
|
|
1025
|
+
/** Target countries */
|
|
1026
|
+
target_countries?: string[];
|
|
1027
|
+
/** Creative content */
|
|
1028
|
+
creative: {
|
|
1029
|
+
title: string;
|
|
1030
|
+
body: string;
|
|
1031
|
+
cta: string;
|
|
1032
|
+
landing_url: string;
|
|
1033
|
+
};
|
|
1034
|
+
/** Recommendation ad fields */
|
|
1035
|
+
teaser?: string;
|
|
1036
|
+
promo_code?: string;
|
|
1037
|
+
/** Service ad fields */
|
|
1038
|
+
service_endpoint?: string;
|
|
1039
|
+
service_description?: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface CampaignCreateResponse {
|
|
1042
|
+
campaign_id: string;
|
|
1043
|
+
status: 'active' | 'pending_review';
|
|
1044
|
+
created_at: string;
|
|
1045
|
+
}
|
|
1046
|
+
interface CampaignUpdateRequest {
|
|
1047
|
+
/** Campaign ID to update */
|
|
1048
|
+
campaign_id: string;
|
|
1049
|
+
/** Session token for auth */
|
|
1050
|
+
session_token: string;
|
|
1051
|
+
/** Fields to update (partial) */
|
|
1052
|
+
updates: Partial<Omit<CampaignCreateRequest, 'ad_type'>>;
|
|
1053
|
+
/** Set campaign status */
|
|
1054
|
+
status?: 'active' | 'paused';
|
|
1055
|
+
}
|
|
1056
|
+
interface CampaignUpdateResponse {
|
|
1057
|
+
campaign_id: string;
|
|
1058
|
+
status: string;
|
|
1059
|
+
updated_at: string;
|
|
1060
|
+
}
|
|
1061
|
+
interface ScrapeSiteRequest {
|
|
1062
|
+
/** URL to scrape */
|
|
1063
|
+
url: string;
|
|
1064
|
+
/** Maximum depth of pages to follow */
|
|
1065
|
+
max_depth?: number;
|
|
1066
|
+
/** Maximum number of pages */
|
|
1067
|
+
max_pages?: number;
|
|
1068
|
+
/** CSS selectors to extract */
|
|
1069
|
+
selectors?: string[];
|
|
1070
|
+
}
|
|
1071
|
+
interface ScrapeSiteResponse {
|
|
1072
|
+
job_id: string;
|
|
1073
|
+
status: 'queued' | 'processing' | 'completed' | 'failed';
|
|
1074
|
+
pages_scraped?: number;
|
|
1075
|
+
content?: Array<{
|
|
1076
|
+
url: string;
|
|
1077
|
+
title: string;
|
|
1078
|
+
text: string;
|
|
1079
|
+
}>;
|
|
1080
|
+
}
|
|
1081
|
+
interface TrainAgentRequest {
|
|
1082
|
+
/** Agent ID to train */
|
|
1083
|
+
agent_id: string;
|
|
1084
|
+
/** Training data: documents, Q&A pairs, etc. */
|
|
1085
|
+
training_data: Array<{
|
|
1086
|
+
type: 'document' | 'qa_pair' | 'instruction';
|
|
1087
|
+
content: string;
|
|
1088
|
+
metadata?: Record<string, unknown>;
|
|
1089
|
+
}>;
|
|
1090
|
+
/** Training configuration */
|
|
1091
|
+
config?: {
|
|
1092
|
+
/** Override existing training */
|
|
1093
|
+
replace?: boolean;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
interface TrainAgentResponse {
|
|
1097
|
+
job_id: string;
|
|
1098
|
+
status: 'queued' | 'processing' | 'completed' | 'failed';
|
|
1099
|
+
items_processed?: number;
|
|
1100
|
+
message?: string;
|
|
1101
|
+
}
|
|
1102
|
+
interface AgentSignupV2Request {
|
|
1103
|
+
owner_email: string;
|
|
1104
|
+
agent_name: string;
|
|
1105
|
+
/** Agent description */
|
|
1106
|
+
description?: string;
|
|
1107
|
+
/** Agent website URL */
|
|
1108
|
+
website?: string;
|
|
1109
|
+
/** SDK platform */
|
|
1110
|
+
sdk?: 'typescript' | 'python' | 'other';
|
|
1111
|
+
/** Deployment environment */
|
|
1112
|
+
environment?: 'test' | 'live';
|
|
1113
|
+
/** Declared ad placements */
|
|
1114
|
+
declared_placements?: PlacementType[];
|
|
1115
|
+
/** Declared capabilities */
|
|
1116
|
+
declared_capabilities?: string[];
|
|
1117
|
+
/** Monthly estimated traffic */
|
|
1118
|
+
estimated_traffic?: number;
|
|
1119
|
+
}
|
|
1120
|
+
interface AgentSignupV2Response {
|
|
1121
|
+
agent_id: string;
|
|
1122
|
+
api_key_live: string;
|
|
1123
|
+
api_key_test: string;
|
|
1124
|
+
/** @deprecated Use api_key_live */
|
|
1125
|
+
api_key: string;
|
|
1126
|
+
/** @deprecated Use api_key_test */
|
|
1127
|
+
test_api_key: string;
|
|
1128
|
+
created_at: string;
|
|
1129
|
+
status: 'active' | 'pending_review';
|
|
1130
|
+
}
|
|
1131
|
+
interface TrackCallRequest {
|
|
1132
|
+
/** Tracking token from the ad */
|
|
1133
|
+
token: string;
|
|
1134
|
+
/** Optional metadata about the call */
|
|
1135
|
+
metadata?: Record<string, unknown>;
|
|
1136
|
+
}
|
|
1137
|
+
interface TrackCallResponse {
|
|
1138
|
+
status: 'tracked';
|
|
1139
|
+
token: string;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* HTTP client with retry logic, timeout handling, and authentication.
|
|
1144
|
+
* Retry policy: only on 408, 429, 500, 502, 503, 504
|
|
1145
|
+
* Max retries: 2 (configurable)
|
|
1146
|
+
* Backoff: exponential with jitter
|
|
1147
|
+
*/
|
|
1148
|
+
interface HTTPClientConfig {
|
|
1149
|
+
apiKey?: string;
|
|
1150
|
+
supabaseAnonKey?: string;
|
|
1151
|
+
baseUrl: string;
|
|
1152
|
+
timeoutMs: number;
|
|
1153
|
+
maxRetries: number;
|
|
1154
|
+
}
|
|
1155
|
+
declare class HTTPClient {
|
|
1156
|
+
private config;
|
|
1157
|
+
constructor(config: HTTPClientConfig);
|
|
1158
|
+
/** Expose the API key so sub-clients can re-use it in different headers */
|
|
1159
|
+
get apiKey(): string | undefined;
|
|
1160
|
+
request<T>(method: 'GET' | 'POST', path: string, options?: {
|
|
1161
|
+
body?: unknown;
|
|
1162
|
+
headers?: Record<string, string>;
|
|
1163
|
+
idempotencyKey?: string;
|
|
1164
|
+
skipDefaultAuth?: boolean;
|
|
1165
|
+
}): Promise<T>;
|
|
1166
|
+
private makeRequest;
|
|
1167
|
+
private shouldRetry;
|
|
1168
|
+
private backoff;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Capability Session sub-client.
|
|
1173
|
+
* Manages multi-turn AI sessions via the capability-session endpoint.
|
|
1174
|
+
* All methods use standard X-AM-API-Key auth.
|
|
1175
|
+
*/
|
|
1176
|
+
|
|
1177
|
+
declare class SessionClient {
|
|
1178
|
+
private http;
|
|
1179
|
+
constructor(http: HTTPClient);
|
|
1180
|
+
/**
|
|
1181
|
+
* Initiate a new capability session.
|
|
1182
|
+
*
|
|
1183
|
+
* @example
|
|
1184
|
+
* ```typescript
|
|
1185
|
+
* const session = await client.sessions.initiate({
|
|
1186
|
+
* capability_type: 'code_review',
|
|
1187
|
+
* config: { language: 'typescript' }
|
|
1188
|
+
* });
|
|
1189
|
+
* console.log(session.session_id);
|
|
1190
|
+
* ```
|
|
1191
|
+
*/
|
|
1192
|
+
initiate(request: CapabilitySessionInitiateRequest): Promise<CapabilitySessionInitiateResponse>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Send a message within an existing capability session.
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```typescript
|
|
1198
|
+
* const response = await client.sessions.sendMessage({
|
|
1199
|
+
* session_id: 'sess_abc123',
|
|
1200
|
+
* message: 'Review this function for bugs'
|
|
1201
|
+
* });
|
|
1202
|
+
* console.log(response.response);
|
|
1203
|
+
* ```
|
|
1204
|
+
*/
|
|
1205
|
+
sendMessage(request: CapabilitySessionMessageRequest): Promise<CapabilitySessionMessageResponse>;
|
|
1206
|
+
/**
|
|
1207
|
+
* End a capability session.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```typescript
|
|
1211
|
+
* const result = await client.sessions.end({
|
|
1212
|
+
* session_id: 'sess_abc123',
|
|
1213
|
+
* reason: 'task_completed'
|
|
1214
|
+
* });
|
|
1215
|
+
* ```
|
|
1216
|
+
*/
|
|
1217
|
+
end(request: CapabilitySessionEndRequest): Promise<CapabilitySessionEndResponse>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Connect a GitHub repository to the capability session.
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* ```typescript
|
|
1223
|
+
* const result = await client.sessions.connectGitHub({
|
|
1224
|
+
* session_id: 'sess_abc123',
|
|
1225
|
+
* repository: 'owner/repo',
|
|
1226
|
+
* branch: 'main'
|
|
1227
|
+
* });
|
|
1228
|
+
* ```
|
|
1229
|
+
*/
|
|
1230
|
+
connectGitHub(request: CapabilitySessionConnectGitHubRequest): Promise<CapabilitySessionConnectGitHubResponse>;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Developer Portal sub-client.
|
|
1235
|
+
* Manages developer authentication, data, earnings, stats, and analytics.
|
|
1236
|
+
* Mixed auth patterns: some endpoints need no auth, others use X-API-Key or X-AM-API-Key.
|
|
1237
|
+
*/
|
|
1238
|
+
|
|
1239
|
+
declare class DeveloperClient {
|
|
1240
|
+
private http;
|
|
1241
|
+
constructor(http: HTTPClient);
|
|
1242
|
+
/**
|
|
1243
|
+
* Log in as a developer. Returns a session token for subsequent calls.
|
|
1244
|
+
* No API key auth needed for this endpoint.
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* ```typescript
|
|
1248
|
+
* const session = await client.developer.login({
|
|
1249
|
+
* email: 'dev@example.com',
|
|
1250
|
+
* password: 'secret'
|
|
1251
|
+
* });
|
|
1252
|
+
* console.log(session.session_token);
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
login(request: DeveloperLoginRequest): Promise<DeveloperLoginResponse>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Get developer account data using a session token.
|
|
1258
|
+
* No default API key auth — uses session token in body.
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* const data = await client.developer.getData('session_token_here');
|
|
1263
|
+
* console.log(data.agent_name);
|
|
1264
|
+
* ```
|
|
1265
|
+
*/
|
|
1266
|
+
getData(sessionToken: string): Promise<DeveloperDataResponse>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Get developer earnings. Uses X-API-Key header (not X-AM-API-Key).
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```typescript
|
|
1272
|
+
* const earnings = await client.developer.getEarnings();
|
|
1273
|
+
* console.log(earnings.balances.available);
|
|
1274
|
+
* ```
|
|
1275
|
+
*/
|
|
1276
|
+
getEarnings(): Promise<DeveloperEarningsResponse>;
|
|
1277
|
+
/**
|
|
1278
|
+
* Get developer stats. Uses standard X-AM-API-Key auth.
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* ```typescript
|
|
1282
|
+
* const stats = await client.developer.getStats({ period: '30d' });
|
|
1283
|
+
* console.log(stats.impressions, stats.clicks);
|
|
1284
|
+
* ```
|
|
1285
|
+
*/
|
|
1286
|
+
getStats(params?: DeveloperStatsRequest): Promise<DeveloperStatsResponse>;
|
|
1287
|
+
/**
|
|
1288
|
+
* Get developer analytics. Uses session token in body (no default auth).
|
|
1289
|
+
*
|
|
1290
|
+
* @example
|
|
1291
|
+
* ```typescript
|
|
1292
|
+
* const analytics = await client.developer.getAnalytics('session_token', {
|
|
1293
|
+
* start_date: '2026-01-01',
|
|
1294
|
+
* group_by: 'week'
|
|
1295
|
+
* });
|
|
1296
|
+
* ```
|
|
1297
|
+
*/
|
|
1298
|
+
getAnalytics(sessionToken: string, params?: Omit<DeveloperAnalyticsRequest, 'session_token'>): Promise<DeveloperAnalyticsResponse>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Regenerate API keys. Uses session token in body (no default auth).
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```typescript
|
|
1304
|
+
* const newKeys = await client.developer.regenerateKeys({
|
|
1305
|
+
* session_token: 'session_token_here',
|
|
1306
|
+
* key_type: 'test'
|
|
1307
|
+
* });
|
|
1308
|
+
* console.log(newKeys.api_key_test);
|
|
1309
|
+
* ```
|
|
1310
|
+
*/
|
|
1311
|
+
regenerateKeys(request: RegenerateKeysRequest): Promise<RegenerateKeysResponse>;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Advertiser Portal sub-client.
|
|
1316
|
+
* Manages advertiser authentication, stats, analytics, and campaign management.
|
|
1317
|
+
* Mixed auth patterns including JWT for campaign creation.
|
|
1318
|
+
*/
|
|
1319
|
+
|
|
1320
|
+
declare class AdvertiserClient {
|
|
1321
|
+
private http;
|
|
1322
|
+
constructor(http: HTTPClient);
|
|
1323
|
+
/**
|
|
1324
|
+
* Sign up as a new advertiser. No API key auth needed.
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const account = await client.advertiser.signup({
|
|
1329
|
+
* email: 'ads@company.com',
|
|
1330
|
+
* password: 'secure123',
|
|
1331
|
+
* company_name: 'Acme Corp'
|
|
1332
|
+
* });
|
|
1333
|
+
* console.log(account.advertiser_id);
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
signup(request: AdvertiserSignupRequest): Promise<AdvertiserSignupResponse>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Log in as an advertiser. Returns a session token.
|
|
1339
|
+
* No API key auth needed.
|
|
1340
|
+
*
|
|
1341
|
+
* @example
|
|
1342
|
+
* ```typescript
|
|
1343
|
+
* const session = await client.advertiser.login({
|
|
1344
|
+
* email: 'ads@company.com',
|
|
1345
|
+
* password: 'secure123'
|
|
1346
|
+
* });
|
|
1347
|
+
* console.log(session.session_token);
|
|
1348
|
+
* ```
|
|
1349
|
+
*/
|
|
1350
|
+
login(request: AdvertiserLoginRequest): Promise<AdvertiserLoginResponse>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Get advertiser stats. Uses X-Advertiser-Key header or query param.
|
|
1353
|
+
*
|
|
1354
|
+
* @example
|
|
1355
|
+
* ```typescript
|
|
1356
|
+
* const stats = await client.advertiser.getStats({
|
|
1357
|
+
* advertiser_key: 'adv_key_123',
|
|
1358
|
+
* period: '30d'
|
|
1359
|
+
* });
|
|
1360
|
+
* console.log(stats.budget.remaining);
|
|
1361
|
+
* ```
|
|
1362
|
+
*/
|
|
1363
|
+
getStats(params?: AdvertiserStatsRequest): Promise<AdvertiserStatsResponse>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Get advertiser analytics. Uses session token in body (no default auth).
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* ```typescript
|
|
1369
|
+
* const analytics = await client.advertiser.getAnalytics('session_token', {
|
|
1370
|
+
* start_date: '2026-01-01',
|
|
1371
|
+
* group_by: 'week'
|
|
1372
|
+
* });
|
|
1373
|
+
* ```
|
|
1374
|
+
*/
|
|
1375
|
+
getAnalytics(sessionToken: string, params?: Omit<AdvertiserAnalyticsRequest, 'session_token'>): Promise<AdvertiserAnalyticsResponse>;
|
|
1376
|
+
/**
|
|
1377
|
+
* Create a new campaign. Uses JWT bearer token for auth.
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```typescript
|
|
1381
|
+
* const campaign = await client.advertiser.createCampaign('jwt_token', {
|
|
1382
|
+
* name: 'Summer Sale',
|
|
1383
|
+
* ad_type: 'link',
|
|
1384
|
+
* daily_budget: 5000,
|
|
1385
|
+
* bid_amount: 100,
|
|
1386
|
+
* creative: {
|
|
1387
|
+
* title: 'Summer Sale - 50% Off',
|
|
1388
|
+
* body: 'Limited time offer',
|
|
1389
|
+
* cta: 'Shop Now',
|
|
1390
|
+
* landing_url: 'https://example.com/sale'
|
|
1391
|
+
* }
|
|
1392
|
+
* });
|
|
1393
|
+
* ```
|
|
1394
|
+
*/
|
|
1395
|
+
createCampaign(jwt: string, request: CampaignCreateRequest): Promise<CampaignCreateResponse>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Update an existing campaign. Uses session token in body (no default auth).
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* ```typescript
|
|
1401
|
+
* const result = await client.advertiser.updateCampaign({
|
|
1402
|
+
* campaign_id: 'camp_123',
|
|
1403
|
+
* session_token: 'session_token',
|
|
1404
|
+
* updates: { name: 'Updated Campaign Name' },
|
|
1405
|
+
* status: 'paused'
|
|
1406
|
+
* });
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
updateCampaign(request: CampaignUpdateRequest): Promise<CampaignUpdateResponse>;
|
|
1410
|
+
}
|
|
747
1411
|
|
|
748
1412
|
/**
|
|
749
1413
|
* Utility functions for the AttentionMarket SDK.
|
|
@@ -878,6 +1542,12 @@ declare class AttentionMarketClient {
|
|
|
878
1542
|
private http;
|
|
879
1543
|
private agentId;
|
|
880
1544
|
private appId;
|
|
1545
|
+
/** Capability session management (multi-turn AI sessions) */
|
|
1546
|
+
readonly sessions: SessionClient;
|
|
1547
|
+
/** Developer portal (login, earnings, stats, analytics) */
|
|
1548
|
+
readonly developer: DeveloperClient;
|
|
1549
|
+
/** Advertiser portal (signup, login, campaigns, stats) */
|
|
1550
|
+
readonly advertiser: AdvertiserClient;
|
|
881
1551
|
constructor(config: SDKConfig);
|
|
882
1552
|
/**
|
|
883
1553
|
* Validate SDK configuration for security
|
|
@@ -960,6 +1630,22 @@ declare class AttentionMarketClient {
|
|
|
960
1630
|
* ```
|
|
961
1631
|
*/
|
|
962
1632
|
sendFeedback(request: FeedbackRequest): Promise<FeedbackResponse>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Rate the delivery quality of an ad after a verified click.
|
|
1635
|
+
* Requires a prior click event for the tracking_token. Ratings feed
|
|
1636
|
+
* into quality scores (minimum 5 unique raters per campaign).
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```typescript
|
|
1640
|
+
* await client.rateBusinessDelivery({
|
|
1641
|
+
* tracking_token: ad.tracking_token,
|
|
1642
|
+
* ad_unit_id: ad._ad.unit_id,
|
|
1643
|
+
* rating: 4,
|
|
1644
|
+
* context: 'Relevant product, good landing page'
|
|
1645
|
+
* });
|
|
1646
|
+
* ```
|
|
1647
|
+
*/
|
|
1648
|
+
rateBusinessDelivery(request: BusinessRatingRequest): Promise<BusinessRatingResponse>;
|
|
963
1649
|
/**
|
|
964
1650
|
* Fetch default policy constraints and formatting requirements.
|
|
965
1651
|
*/
|
|
@@ -1157,6 +1843,59 @@ declare class AttentionMarketClient {
|
|
|
1157
1843
|
* ```
|
|
1158
1844
|
*/
|
|
1159
1845
|
getCategories(params?: GetCategoriesParams): Promise<CategoryTaxonomyResponse>;
|
|
1846
|
+
/**
|
|
1847
|
+
* Sign up a new agent using the v2 endpoint.
|
|
1848
|
+
* Static method — no API key needed.
|
|
1849
|
+
*
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```typescript
|
|
1852
|
+
* const agent = await AttentionMarketClient.signupAgentV2({
|
|
1853
|
+
* owner_email: 'dev@example.com',
|
|
1854
|
+
* agent_name: 'My Agent',
|
|
1855
|
+
* sdk: 'typescript'
|
|
1856
|
+
* });
|
|
1857
|
+
* console.log(agent.api_key_live);
|
|
1858
|
+
* ```
|
|
1859
|
+
*/
|
|
1860
|
+
static signupAgentV2(request: AgentSignupV2Request, baseUrl?: string): Promise<AgentSignupV2Response>;
|
|
1861
|
+
/**
|
|
1862
|
+
* Track an agent-to-agent call using a tracking token.
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```typescript
|
|
1866
|
+
* await client.trackCall('trk_abc123', { model: 'gpt-4' });
|
|
1867
|
+
* ```
|
|
1868
|
+
*/
|
|
1869
|
+
trackCall(token: string, metadata?: Record<string, unknown>): Promise<TrackCallResponse>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Scrape a website for knowledge base content.
|
|
1872
|
+
* Requires Bearer JWT and an OpenAI API key header.
|
|
1873
|
+
*
|
|
1874
|
+
* @example
|
|
1875
|
+
* ```typescript
|
|
1876
|
+
* const result = await client.scrapeSite(
|
|
1877
|
+
* { url: 'https://example.com', max_pages: 10 },
|
|
1878
|
+
* 'jwt_token',
|
|
1879
|
+
* 'sk-openai-key'
|
|
1880
|
+
* );
|
|
1881
|
+
* ```
|
|
1882
|
+
*/
|
|
1883
|
+
scrapeSite(request: ScrapeSiteRequest, jwt: string, openaiKey: string): Promise<ScrapeSiteResponse>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Train an agent with custom knowledge.
|
|
1886
|
+
* No default auth — agent ID is in the request body.
|
|
1887
|
+
*
|
|
1888
|
+
* @example
|
|
1889
|
+
* ```typescript
|
|
1890
|
+
* const result = await client.trainAgent({
|
|
1891
|
+
* agent_id: 'agt_123',
|
|
1892
|
+
* training_data: [
|
|
1893
|
+
* { type: 'document', content: 'Product FAQ...' }
|
|
1894
|
+
* ]
|
|
1895
|
+
* });
|
|
1896
|
+
* ```
|
|
1897
|
+
*/
|
|
1898
|
+
trainAgent(request: TrainAgentRequest): Promise<TrainAgentResponse>;
|
|
1160
1899
|
}
|
|
1161
1900
|
|
|
1162
1901
|
/**
|
|
@@ -1561,4 +2300,4 @@ declare function getVertical(taxonomy: string): string | null;
|
|
|
1561
2300
|
*/
|
|
1562
2301
|
declare function suggestTaxonomies(query: string): string[];
|
|
1563
2302
|
|
|
1564
|
-
export { type APIError, APIRequestError, type AdResponse, type AdScore, type AdUnit, type AgentSignupRequest, type AgentSignupResponse, AttentionMarketClient, AttentionMarketError, type Constraints, type Context, type CreateImpressionEventParams, type CreateOpportunityParams, type DecideFromContextRequest, type DecideRequest, type DecideResponse, type Disclosure, type EventIngestRequest, type EventIngestResponse, type EventType, type FormattedAd, type Intent, MockAttentionMarketClient, type MockClientConfig, type NaturalFormatOptions, NetworkError, type OfferResponse, type Opportunity, type ParsedTaxonomy, type Placement, type PlacementType, type PolicyResponse, type Privacy, type RequestOfferFromContextParams, type RequestOfferParams, type SDKConfig, type SanitizeURLOptions, type SponsoredSuggestion, type SponsoredTool, type TaxonomyIntent, TimeoutError, type ToolCall, type Tracking, buildTaxonomy, createImpressionEvent, createOpportunity, detectIntent, escapeHTML, formatInlineMention, formatNatural, generateTimestamp, generateUUID, getBaseTaxonomy, getVertical, isValidTaxonomy, matchesTaxonomy, parseTaxonomy, sanitizeURL, suggestTaxonomies, validateAdFits };
|
|
2303
|
+
export { type APIError, APIRequestError, type AdResponse, type AdScore, type AdUnit, type AdvertiserAnalyticsRequest, type AdvertiserAnalyticsResponse, AdvertiserClient, type AdvertiserLoginRequest, type AdvertiserLoginResponse, type AdvertiserSignupRequest, type AdvertiserSignupResponse, type AdvertiserStatsRequest, type AdvertiserStatsResponse, type AgentSignupRequest, type AgentSignupResponse, type AgentSignupV2Request, type AgentSignupV2Response, AttentionMarketClient, AttentionMarketError, type CampaignCreateRequest, type CampaignCreateResponse, type CampaignUpdateRequest, type CampaignUpdateResponse, type CapabilitySessionConnectGitHubRequest, type CapabilitySessionConnectGitHubResponse, type CapabilitySessionEndRequest, type CapabilitySessionEndResponse, type CapabilitySessionInitiateRequest, type CapabilitySessionInitiateResponse, type CapabilitySessionMessageRequest, type CapabilitySessionMessageResponse, type Constraints, type Context, type CreateImpressionEventParams, type CreateOpportunityParams, type DecideFromContextRequest, type DecideRequest, type DecideResponse, type DeveloperAnalyticsRequest, type DeveloperAnalyticsResponse, DeveloperClient, type DeveloperDataResponse, type DeveloperEarningsResponse, type DeveloperLoginRequest, type DeveloperLoginResponse, type DeveloperStatsRequest, type DeveloperStatsResponse, type Disclosure, type EventIngestRequest, type EventIngestResponse, type EventType, type FormattedAd, type Intent, MockAttentionMarketClient, type MockClientConfig, type NaturalFormatOptions, NetworkError, type OfferResponse, type Opportunity, type ParsedTaxonomy, type Placement, type PlacementType, type PolicyResponse, type Privacy, type RegenerateKeysRequest, type RegenerateKeysResponse, type RequestOfferFromContextParams, type RequestOfferParams, type SDKConfig, type SanitizeURLOptions, type ScrapeSiteRequest, type ScrapeSiteResponse, SessionClient, type SponsoredSuggestion, type SponsoredTool, type TaxonomyIntent, TimeoutError, type ToolCall, type TrackCallRequest, type TrackCallResponse, type Tracking, type TrainAgentRequest, type TrainAgentResponse, buildTaxonomy, createImpressionEvent, createOpportunity, detectIntent, escapeHTML, formatInlineMention, formatNatural, generateTimestamp, generateUUID, getBaseTaxonomy, getVertical, isValidTaxonomy, matchesTaxonomy, parseTaxonomy, sanitizeURL, suggestTaxonomies, validateAdFits };
|