@siglume/api-sdk 1.2.2 → 2.0.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/README.md +19 -2
- package/dist/bin/siglume.cjs +63 -470
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +63 -470
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +63 -470
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +29 -268
- package/dist/cli/index.d.ts +29 -268
- package/dist/cli/index.js +63 -470
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +35 -454
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -332
- package/dist/index.d.ts +30 -332
- package/dist/index.js +35 -454
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -355,7 +355,12 @@ var init_webhooks = __esm({
|
|
|
355
355
|
"capability.published",
|
|
356
356
|
"capability.delisted",
|
|
357
357
|
"execution.completed",
|
|
358
|
-
"execution.failed"
|
|
358
|
+
"execution.failed",
|
|
359
|
+
"reward_payout.created",
|
|
360
|
+
"reward_payout.provider_pending",
|
|
361
|
+
"reward_paid",
|
|
362
|
+
"reward_payout.failed",
|
|
363
|
+
"reward_payout.cancelled"
|
|
359
364
|
];
|
|
360
365
|
WEBHOOK_EVENT_SET = new Set(WEBHOOK_EVENT_TYPES);
|
|
361
366
|
}
|
|
@@ -1405,6 +1410,23 @@ function validatePricingPlanFloor(plan, defaultCurrency) {
|
|
|
1405
1410
|
function pricingPlanHasItems(plan) {
|
|
1406
1411
|
return isRecord(plan) && Array.isArray(plan.items) && plan.items.length > 0;
|
|
1407
1412
|
}
|
|
1413
|
+
function validateListingTextLengths(payload) {
|
|
1414
|
+
const limits = {
|
|
1415
|
+
short_description: LISTING_SHORT_DESCRIPTION_MAX_LENGTH,
|
|
1416
|
+
job_to_be_done: LISTING_JOB_TO_BE_DONE_MAX_LENGTH,
|
|
1417
|
+
description: LISTING_DESCRIPTION_MAX_LENGTH
|
|
1418
|
+
};
|
|
1419
|
+
for (const [fieldName, maxLength] of Object.entries(limits)) {
|
|
1420
|
+
const value = payload[fieldName];
|
|
1421
|
+
if (value === void 0 || value === null) continue;
|
|
1422
|
+
if (typeof value !== "string") {
|
|
1423
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be a string when provided.`);
|
|
1424
|
+
}
|
|
1425
|
+
if (Array.from(value).length > maxLength) {
|
|
1426
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be at most ${maxLength} characters.`);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1408
1430
|
function buildToolManualQualityReport(payload) {
|
|
1409
1431
|
const qualityBlock = isRecord(payload.quality) ? payload.quality : payload;
|
|
1410
1432
|
const issues = [];
|
|
@@ -1962,257 +1984,6 @@ function parseInstalledToolReceiptStep(data) {
|
|
|
1962
1984
|
raw: { ...data }
|
|
1963
1985
|
};
|
|
1964
1986
|
}
|
|
1965
|
-
function toRecordList(value) {
|
|
1966
|
-
return Array.isArray(value) ? value.filter((item) => isRecord(item)).map((item) => ({ ...item })) : [];
|
|
1967
|
-
}
|
|
1968
|
-
function parsePartnerDashboard(data) {
|
|
1969
|
-
return {
|
|
1970
|
-
partner_id: String(data.partner_id ?? data.user_id ?? ""),
|
|
1971
|
-
company_name: stringOrNull(data.company_name) ?? void 0,
|
|
1972
|
-
plan: stringOrNull(data.plan) ?? void 0,
|
|
1973
|
-
plan_label: stringOrNull(data.plan_label) ?? void 0,
|
|
1974
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
1975
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
1976
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
1977
|
-
total_source_items: Math.trunc(Number(data.total_source_items ?? 0)),
|
|
1978
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
1979
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
1980
|
-
raw: { ...data }
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
function parsePartnerUsage(data) {
|
|
1984
|
-
return {
|
|
1985
|
-
plan: stringOrNull(data.plan) ?? void 0,
|
|
1986
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
1987
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
1988
|
-
month_bytes_remaining: Math.trunc(Number(data.month_bytes_remaining ?? 0)),
|
|
1989
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
1990
|
-
raw: { ...data }
|
|
1991
|
-
};
|
|
1992
|
-
}
|
|
1993
|
-
function parsePartnerApiKey(data) {
|
|
1994
|
-
return {
|
|
1995
|
-
credential_id: String(data.credential_id ?? data.id ?? ""),
|
|
1996
|
-
name: stringOrNull(data.name) ?? void 0,
|
|
1997
|
-
key_id: stringOrNull(data.key_id) ?? void 0,
|
|
1998
|
-
allowed_source_types: Array.isArray(data.allowed_source_types) ? data.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
1999
|
-
last_used_at: stringOrNull(data.last_used_at) ?? void 0,
|
|
2000
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2001
|
-
revoked: Boolean(data.revoked ?? false),
|
|
2002
|
-
raw: { ...data }
|
|
2003
|
-
};
|
|
2004
|
-
}
|
|
2005
|
-
function parsePartnerApiKeyHandle(data) {
|
|
2006
|
-
const raw = Object.fromEntries(
|
|
2007
|
-
Object.entries(data).filter(([key]) => key !== "ingest_key" && key !== "full_key")
|
|
2008
|
-
);
|
|
2009
|
-
return {
|
|
2010
|
-
credential_id: String(raw.credential_id ?? raw.id ?? ""),
|
|
2011
|
-
name: stringOrNull(raw.name) ?? void 0,
|
|
2012
|
-
key_id: stringOrNull(raw.key_id) ?? void 0,
|
|
2013
|
-
allowed_source_types: Array.isArray(raw.allowed_source_types) ? raw.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
2014
|
-
masked_key_hint: stringOrNull(raw.masked_key_hint) ?? void 0,
|
|
2015
|
-
raw
|
|
2016
|
-
};
|
|
2017
|
-
}
|
|
2018
|
-
function parseAdsBilling(data) {
|
|
2019
|
-
return {
|
|
2020
|
-
currency: stringOrNull(data.currency) ?? void 0,
|
|
2021
|
-
billing_mode: stringOrNull(data.billing_mode) ?? void 0,
|
|
2022
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2023
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2024
|
-
all_time_spend_jpy: Math.trunc(Number(data.all_time_spend_jpy ?? 0)),
|
|
2025
|
-
all_time_spend_usd: Math.trunc(Number(data.all_time_spend_usd ?? 0)),
|
|
2026
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2027
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2028
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2029
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
2030
|
-
invoices: toRecordList(data.invoices),
|
|
2031
|
-
wallet: isRecord(data.wallet) ? { ...data.wallet } : null,
|
|
2032
|
-
balances: toRecordList(data.balances),
|
|
2033
|
-
supported_tokens: toRecordList(data.supported_tokens),
|
|
2034
|
-
funding_instructions: isRecord(data.funding_instructions) ? { ...data.funding_instructions } : null,
|
|
2035
|
-
mandate: isRecord(data.mandate) ? parsePlanWeb3Mandate(data.mandate) : null,
|
|
2036
|
-
raw: { ...data }
|
|
2037
|
-
};
|
|
2038
|
-
}
|
|
2039
|
-
function parseAdsBillingSettlement(data) {
|
|
2040
|
-
return {
|
|
2041
|
-
status: stringOrNull(data.status) ?? void 0,
|
|
2042
|
-
message: stringOrNull(data.message ?? data.detail) ?? void 0,
|
|
2043
|
-
settles_automatically: typeof data.settles_automatically === "boolean" ? data.settles_automatically : typeof data.auto_settles === "boolean" ? data.auto_settles : void 0,
|
|
2044
|
-
cycle_key: stringOrNull(data.cycle_key) ?? void 0,
|
|
2045
|
-
settled_at: stringOrNull(data.settled_at) ?? void 0,
|
|
2046
|
-
raw: { ...data }
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
function parseAdsProfile(data) {
|
|
2050
|
-
return {
|
|
2051
|
-
has_profile: Boolean(data.has_profile ?? false),
|
|
2052
|
-
company_name: stringOrNull(data.company_name) ?? void 0,
|
|
2053
|
-
ad_currency: stringOrNull(data.ad_currency) ?? void 0,
|
|
2054
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2055
|
-
raw: { ...data }
|
|
2056
|
-
};
|
|
2057
|
-
}
|
|
2058
|
-
function parseAdsCampaign(data) {
|
|
2059
|
-
return {
|
|
2060
|
-
campaign_id: String(data.campaign_id ?? data.id ?? ""),
|
|
2061
|
-
name: stringOrNull(data.name) ?? void 0,
|
|
2062
|
-
target_url: stringOrNull(data.target_url) ?? void 0,
|
|
2063
|
-
content_brief: stringOrNull(data.content_brief) ?? void 0,
|
|
2064
|
-
target_topics: Array.isArray(data.target_topics) ? data.target_topics.filter((item) => typeof item === "string") : [],
|
|
2065
|
-
posting_interval_minutes: Math.trunc(Number(data.posting_interval_minutes ?? 360)),
|
|
2066
|
-
max_posts_per_day: Math.trunc(Number(data.max_posts_per_day ?? 4)),
|
|
2067
|
-
currency: stringOrNull(data.currency) ?? void 0,
|
|
2068
|
-
monthly_budget_jpy: Math.trunc(Number(data.monthly_budget_jpy ?? 0)),
|
|
2069
|
-
cpm_jpy: Math.trunc(Number(data.cpm_jpy ?? 0)),
|
|
2070
|
-
cpr_jpy: Math.trunc(Number(data.cpr_jpy ?? 0)),
|
|
2071
|
-
monthly_budget_usd: Math.trunc(Number(data.monthly_budget_usd ?? 0)),
|
|
2072
|
-
cpm_usd: Math.trunc(Number(data.cpm_usd ?? 0)),
|
|
2073
|
-
cpr_usd: Math.trunc(Number(data.cpr_usd ?? 0)),
|
|
2074
|
-
status: String(data.status ?? "active").trim().toLowerCase() || "active",
|
|
2075
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2076
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2077
|
-
total_posts: Math.trunc(Number(data.total_posts ?? 0)),
|
|
2078
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2079
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2080
|
-
next_post_at: stringOrNull(data.next_post_at) ?? void 0,
|
|
2081
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2082
|
-
raw: { ...data }
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
function parseAdsCampaignPost(data) {
|
|
2086
|
-
return {
|
|
2087
|
-
post_id: String(data.post_id ?? data.id ?? ""),
|
|
2088
|
-
content_id: stringOrNull(data.content_id) ?? void 0,
|
|
2089
|
-
cost_jpy: Math.trunc(Number(data.cost_jpy ?? 0)),
|
|
2090
|
-
cost_usd: Math.trunc(Number(data.cost_usd ?? 0)),
|
|
2091
|
-
impressions: Math.trunc(Number(data.impressions ?? 0)),
|
|
2092
|
-
replies: Math.trunc(Number(data.replies ?? 0)),
|
|
2093
|
-
status: stringOrNull(data.status) ?? void 0,
|
|
2094
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2095
|
-
raw: { ...data }
|
|
2096
|
-
};
|
|
2097
|
-
}
|
|
2098
|
-
function parseWorksCategory(data) {
|
|
2099
|
-
return {
|
|
2100
|
-
key: String(data.key ?? ""),
|
|
2101
|
-
name_ja: stringOrNull(data.name_ja) ?? void 0,
|
|
2102
|
-
name_en: stringOrNull(data.name_en) ?? void 0,
|
|
2103
|
-
description_ja: stringOrNull(data.description_ja) ?? void 0,
|
|
2104
|
-
description_en: stringOrNull(data.description_en) ?? void 0,
|
|
2105
|
-
icon_url: stringOrNull(data.icon_url) ?? void 0,
|
|
2106
|
-
open_job_count: Math.trunc(Number(data.open_job_count ?? 0)),
|
|
2107
|
-
display_order: Math.trunc(Number(data.display_order ?? 0)),
|
|
2108
|
-
raw: { ...data }
|
|
2109
|
-
};
|
|
2110
|
-
}
|
|
2111
|
-
function parseWorksRegistration(data) {
|
|
2112
|
-
const result = isRecord(data.result) ? data.result : {};
|
|
2113
|
-
const status = String(data.status ?? "completed").trim().toLowerCase() || "completed";
|
|
2114
|
-
return {
|
|
2115
|
-
agent_id: String(result.agent_id ?? data.agent_id ?? ""),
|
|
2116
|
-
works_registered: typeof result.works_registered === "boolean" ? result.works_registered : Boolean(result.works_registered ?? false),
|
|
2117
|
-
tagline: stringOrNull(result.tagline) ?? void 0,
|
|
2118
|
-
categories: Array.isArray(result.categories) ? result.categories.filter((item) => typeof item === "string") : [],
|
|
2119
|
-
capabilities: Array.isArray(result.capabilities) ? result.capabilities.filter((item) => typeof item === "string") : [],
|
|
2120
|
-
description: stringOrNull(result.description) ?? void 0,
|
|
2121
|
-
execution_status: status,
|
|
2122
|
-
approval_required: typeof data.approval_required === "boolean" ? data.approval_required : status === "approval_required",
|
|
2123
|
-
intent_id: stringOrNull(data.intent_id) ?? void 0,
|
|
2124
|
-
approval_status: stringOrNull(data.approval_status) ?? void 0,
|
|
2125
|
-
approval_snapshot_hash: stringOrNull(data.approval_snapshot_hash) ?? void 0,
|
|
2126
|
-
approval_preview: toRecord(result.preview),
|
|
2127
|
-
raw: { ...data }
|
|
2128
|
-
};
|
|
2129
|
-
}
|
|
2130
|
-
function parseWorksOwnerDashboardAgent(data) {
|
|
2131
|
-
return {
|
|
2132
|
-
agent_id: String(data.id ?? data.agent_id ?? ""),
|
|
2133
|
-
name: stringOrNull(data.name) ?? void 0,
|
|
2134
|
-
reputation: toRecord(data.reputation),
|
|
2135
|
-
capabilities: Array.isArray(data.capabilities) ? data.capabilities.filter((item) => typeof item === "string") : [],
|
|
2136
|
-
raw: { ...data }
|
|
2137
|
-
};
|
|
2138
|
-
}
|
|
2139
|
-
function parseWorksOwnerDashboardPitch(data) {
|
|
2140
|
-
return {
|
|
2141
|
-
proposal_id: String(data.proposal_id ?? data.id ?? ""),
|
|
2142
|
-
need_id: stringOrNull(data.need_id) ?? void 0,
|
|
2143
|
-
title: stringOrNull(data.title) ?? void 0,
|
|
2144
|
-
title_en: stringOrNull(data.title_en) ?? void 0,
|
|
2145
|
-
status: stringOrNull(data.status) ?? void 0,
|
|
2146
|
-
raw: { ...data }
|
|
2147
|
-
};
|
|
2148
|
-
}
|
|
2149
|
-
function parseWorksOwnerDashboardOrder(data) {
|
|
2150
|
-
return {
|
|
2151
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2152
|
-
need_id: stringOrNull(data.need_id) ?? void 0,
|
|
2153
|
-
title: stringOrNull(data.title) ?? void 0,
|
|
2154
|
-
title_en: stringOrNull(data.title_en) ?? void 0,
|
|
2155
|
-
status: stringOrNull(data.status) ?? void 0,
|
|
2156
|
-
raw: { ...data }
|
|
2157
|
-
};
|
|
2158
|
-
}
|
|
2159
|
-
function parseWorksOwnerDashboardStats(data) {
|
|
2160
|
-
return {
|
|
2161
|
-
total_agents: Math.trunc(Number(data.total_agents ?? 0)),
|
|
2162
|
-
total_pending: Math.trunc(Number(data.total_pending ?? 0)),
|
|
2163
|
-
total_active: Math.trunc(Number(data.total_active ?? 0)),
|
|
2164
|
-
raw: { ...data }
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
|
-
function parseWorksOwnerDashboard(data) {
|
|
2168
|
-
return {
|
|
2169
|
-
agents: Array.isArray(data.agents) ? data.agents.filter((item) => isRecord(item)).map((item) => parseWorksOwnerDashboardAgent(item)) : [],
|
|
2170
|
-
pending_pitches: Array.isArray(data.pending_pitches) ? data.pending_pitches.filter((item) => isRecord(item)).map((item) => parseWorksOwnerDashboardPitch(item)) : [],
|
|
2171
|
-
active_orders: Array.isArray(data.active_orders) ? data.active_orders.filter((item) => isRecord(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2172
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2173
|
-
stats: isRecord(data.stats) ? parseWorksOwnerDashboardStats(data.stats) : parseWorksOwnerDashboardStats({}),
|
|
2174
|
-
raw: { ...data }
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
2177
|
-
function parseWorksPosterDashboardJob(data) {
|
|
2178
|
-
return {
|
|
2179
|
-
job_id: String(data.id ?? data.job_id ?? ""),
|
|
2180
|
-
title: stringOrNull(data.title) ?? void 0,
|
|
2181
|
-
title_en: stringOrNull(data.title_en) ?? void 0,
|
|
2182
|
-
proposal_count: Math.trunc(Number(data.proposal_count ?? 0)),
|
|
2183
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2184
|
-
raw: { ...data }
|
|
2185
|
-
};
|
|
2186
|
-
}
|
|
2187
|
-
function parseWorksPosterDashboardOrder(data) {
|
|
2188
|
-
return {
|
|
2189
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2190
|
-
need_id: stringOrNull(data.need_id) ?? void 0,
|
|
2191
|
-
title: stringOrNull(data.title) ?? void 0,
|
|
2192
|
-
title_en: stringOrNull(data.title_en) ?? void 0,
|
|
2193
|
-
status: stringOrNull(data.status) ?? void 0,
|
|
2194
|
-
has_deliverable: typeof data.has_deliverable === "boolean" ? data.has_deliverable : Boolean(data.has_deliverable ?? false),
|
|
2195
|
-
deliverable_count: Math.trunc(Number(data.deliverable_count ?? 0)),
|
|
2196
|
-
awaiting_buyer_action: typeof data.awaiting_buyer_action === "boolean" ? data.awaiting_buyer_action : Boolean(data.awaiting_buyer_action ?? false),
|
|
2197
|
-
raw: { ...data }
|
|
2198
|
-
};
|
|
2199
|
-
}
|
|
2200
|
-
function parseWorksPosterDashboardStats(data) {
|
|
2201
|
-
return {
|
|
2202
|
-
total_posted: Math.trunc(Number(data.total_posted ?? 0)),
|
|
2203
|
-
total_completed: Math.trunc(Number(data.total_completed ?? 0)),
|
|
2204
|
-
raw: { ...data }
|
|
2205
|
-
};
|
|
2206
|
-
}
|
|
2207
|
-
function parseWorksPosterDashboard(data) {
|
|
2208
|
-
return {
|
|
2209
|
-
open_jobs: Array.isArray(data.open_jobs) ? data.open_jobs.filter((item) => isRecord(item)).map((item) => parseWorksPosterDashboardJob(item)) : [],
|
|
2210
|
-
in_progress_orders: Array.isArray(data.in_progress_orders) ? data.in_progress_orders.filter((item) => isRecord(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2211
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2212
|
-
stats: isRecord(data.stats) ? parseWorksPosterDashboardStats(data.stats) : parseWorksPosterDashboardStats({}),
|
|
2213
|
-
raw: { ...data }
|
|
2214
|
-
};
|
|
2215
|
-
}
|
|
2216
1987
|
function parseMarketProposal(data) {
|
|
2217
1988
|
const reasonCodes = Array.isArray(data.reason_codes) ? data.reason_codes : Array.isArray(data.reason_codes_jsonb) ? data.reason_codes_jsonb : [];
|
|
2218
1989
|
return {
|
|
@@ -2593,7 +2364,7 @@ function cloneJsonLike(value) {
|
|
|
2593
2364
|
}
|
|
2594
2365
|
return value;
|
|
2595
2366
|
}
|
|
2596
|
-
var DEFAULT_SIGLUME_API_BASE, RETRYABLE_STATUS_CODES, MINIMUM_JPY_OPERATION_PRICE_CURRENCIES, CursorPageResult, SiglumeClient;
|
|
2367
|
+
var DEFAULT_SIGLUME_API_BASE, RETRYABLE_STATUS_CODES, MINIMUM_JPY_OPERATION_PRICE_CURRENCIES, LISTING_SHORT_DESCRIPTION_MAX_LENGTH, LISTING_JOB_TO_BE_DONE_MAX_LENGTH, LISTING_DESCRIPTION_MAX_LENGTH, CursorPageResult, SiglumeClient;
|
|
2597
2368
|
var init_client = __esm({
|
|
2598
2369
|
"src/client.ts"() {
|
|
2599
2370
|
"use strict";
|
|
@@ -2606,6 +2377,9 @@ var init_client = __esm({
|
|
|
2606
2377
|
DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
|
|
2607
2378
|
RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
2608
2379
|
MINIMUM_JPY_OPERATION_PRICE_CURRENCIES = /* @__PURE__ */ new Set(["JPY", "JPYC"]);
|
|
2380
|
+
LISTING_SHORT_DESCRIPTION_MAX_LENGTH = 60;
|
|
2381
|
+
LISTING_JOB_TO_BE_DONE_MAX_LENGTH = 240;
|
|
2382
|
+
LISTING_DESCRIPTION_MAX_LENGTH = 1e3;
|
|
2609
2383
|
CursorPageResult = class {
|
|
2610
2384
|
items;
|
|
2611
2385
|
next_cursor;
|
|
@@ -2759,6 +2533,7 @@ var init_client = __esm({
|
|
|
2759
2533
|
if (payload.pricing_plan !== void 0) {
|
|
2760
2534
|
validatePricingPlanFloor(payload.pricing_plan, currency);
|
|
2761
2535
|
}
|
|
2536
|
+
validateListingTextLengths(payload);
|
|
2762
2537
|
const priceModel = String(payload.price_model ?? "free").trim().toLowerCase();
|
|
2763
2538
|
if ((priceModel === "usage_based" || priceModel === "per_action") && !pricingPlanHasItems(payload.pricing_plan)) {
|
|
2764
2539
|
throw new SiglumeClientError("AppManifest.pricing_plan.items is required for usage_based/per_action pricing.");
|
|
@@ -3650,94 +3425,6 @@ var init_client = __esm({
|
|
|
3650
3425
|
);
|
|
3651
3426
|
return parseMarketNeed(execution.result);
|
|
3652
3427
|
}
|
|
3653
|
-
// `works.*` also uses the public owner-operation execute route. The
|
|
3654
|
-
// categories list returns a top-level array in `result`, so these
|
|
3655
|
-
// wrappers call the execute endpoint directly instead of relying on
|
|
3656
|
-
// execute_owner_operation()'s object-only `result` parser.
|
|
3657
|
-
async list_works_categories(options = {}) {
|
|
3658
|
-
const [data] = await this.requestOwnerOperation(
|
|
3659
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3660
|
-
"works.categories.list",
|
|
3661
|
-
{},
|
|
3662
|
-
{ lang: options.lang }
|
|
3663
|
-
);
|
|
3664
|
-
return Array.isArray(data.result) ? data.result.filter((item) => isRecord(item)).map((item) => parseWorksCategory(item)) : [];
|
|
3665
|
-
}
|
|
3666
|
-
async get_works_registration(options = {}) {
|
|
3667
|
-
const [data] = await this.requestOwnerOperation(
|
|
3668
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3669
|
-
"works.registration.get",
|
|
3670
|
-
{},
|
|
3671
|
-
{ lang: options.lang }
|
|
3672
|
-
);
|
|
3673
|
-
return parseWorksRegistration(data);
|
|
3674
|
-
}
|
|
3675
|
-
async register_for_works(options = {}) {
|
|
3676
|
-
const payload = {};
|
|
3677
|
-
if (options.tagline !== void 0) {
|
|
3678
|
-
payload.tagline = String(options.tagline).trim();
|
|
3679
|
-
}
|
|
3680
|
-
if (options.description !== void 0) {
|
|
3681
|
-
payload.description = String(options.description).trim();
|
|
3682
|
-
}
|
|
3683
|
-
if (options.categories !== void 0) {
|
|
3684
|
-
if (!Array.isArray(options.categories)) {
|
|
3685
|
-
throw new SiglumeClientError("categories must be a list of strings.");
|
|
3686
|
-
}
|
|
3687
|
-
const normalizedCategories = [];
|
|
3688
|
-
for (const item of options.categories) {
|
|
3689
|
-
if (typeof item !== "string") {
|
|
3690
|
-
throw new SiglumeClientError("categories must contain only strings.");
|
|
3691
|
-
}
|
|
3692
|
-
const normalized = item.trim();
|
|
3693
|
-
if (normalized) {
|
|
3694
|
-
normalizedCategories.push(normalized);
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
payload.categories = normalizedCategories;
|
|
3698
|
-
}
|
|
3699
|
-
if (options.capabilities !== void 0) {
|
|
3700
|
-
if (!Array.isArray(options.capabilities)) {
|
|
3701
|
-
throw new SiglumeClientError("capabilities must be a list of strings.");
|
|
3702
|
-
}
|
|
3703
|
-
const normalizedCapabilities = [];
|
|
3704
|
-
for (const item of options.capabilities) {
|
|
3705
|
-
if (typeof item !== "string") {
|
|
3706
|
-
throw new SiglumeClientError("capabilities must contain only strings.");
|
|
3707
|
-
}
|
|
3708
|
-
const normalized = item.trim();
|
|
3709
|
-
if (normalized) {
|
|
3710
|
-
normalizedCapabilities.push(normalized);
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
payload.capabilities = normalizedCapabilities;
|
|
3714
|
-
}
|
|
3715
|
-
const [data] = await this.requestOwnerOperation(
|
|
3716
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3717
|
-
"works.registration.register",
|
|
3718
|
-
payload,
|
|
3719
|
-
{ lang: options.lang }
|
|
3720
|
-
);
|
|
3721
|
-
return parseWorksRegistration(data);
|
|
3722
|
-
}
|
|
3723
|
-
async get_works_owner_dashboard(options = {}) {
|
|
3724
|
-
const [data] = await this.requestOwnerOperation(
|
|
3725
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3726
|
-
"works.owner_dashboard.get",
|
|
3727
|
-
{},
|
|
3728
|
-
{ lang: options.lang }
|
|
3729
|
-
);
|
|
3730
|
-
return parseWorksOwnerDashboard(isRecord(data.result) ? data.result : {});
|
|
3731
|
-
}
|
|
3732
|
-
async get_works_poster_dashboard(options = {}) {
|
|
3733
|
-
const [data] = await this.requestOwnerOperation(
|
|
3734
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3735
|
-
"works.poster_dashboard.get",
|
|
3736
|
-
{},
|
|
3737
|
-
{ lang: options.lang }
|
|
3738
|
-
);
|
|
3739
|
-
return parseWorksPosterDashboard(isRecord(data.result) ? data.result : {});
|
|
3740
|
-
}
|
|
3741
3428
|
async list_installed_tools(options = {}) {
|
|
3742
3429
|
const resolvedAgentId = await this.resolveOwnerOperationAgentId(options.agent_id);
|
|
3743
3430
|
const [data] = await this.requestOwnerOperation(
|
|
@@ -3901,115 +3588,6 @@ var init_client = __esm({
|
|
|
3901
3588
|
);
|
|
3902
3589
|
return Array.isArray(data.result) ? data.result.filter((item) => isRecord(item)).map((item) => parseInstalledToolReceiptStep(item)) : [];
|
|
3903
3590
|
}
|
|
3904
|
-
async get_partner_dashboard(options = {}) {
|
|
3905
|
-
const execution = await this.execute_owner_operation(
|
|
3906
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3907
|
-
"partner.dashboard.get",
|
|
3908
|
-
{},
|
|
3909
|
-
{ lang: options.lang }
|
|
3910
|
-
);
|
|
3911
|
-
return parsePartnerDashboard(execution.result);
|
|
3912
|
-
}
|
|
3913
|
-
async get_partner_usage(options = {}) {
|
|
3914
|
-
const execution = await this.execute_owner_operation(
|
|
3915
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3916
|
-
"partner.usage.get",
|
|
3917
|
-
{},
|
|
3918
|
-
{ lang: options.lang }
|
|
3919
|
-
);
|
|
3920
|
-
return parsePartnerUsage(execution.result);
|
|
3921
|
-
}
|
|
3922
|
-
async list_partner_api_keys(options = {}) {
|
|
3923
|
-
const execution = await this.execute_owner_operation(
|
|
3924
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3925
|
-
"partner.keys.list",
|
|
3926
|
-
{},
|
|
3927
|
-
{ lang: options.lang }
|
|
3928
|
-
);
|
|
3929
|
-
return Array.isArray(execution.result.keys) ? execution.result.keys.filter((item) => isRecord(item)).map((item) => parsePartnerApiKey(item)) : [];
|
|
3930
|
-
}
|
|
3931
|
-
async create_partner_api_key(options = {}) {
|
|
3932
|
-
const payload = {};
|
|
3933
|
-
if (options.name !== void 0) {
|
|
3934
|
-
const normalizedName = String(options.name).trim();
|
|
3935
|
-
if (!normalizedName) {
|
|
3936
|
-
throw new SiglumeClientError("name cannot be empty.");
|
|
3937
|
-
}
|
|
3938
|
-
payload.name = normalizedName;
|
|
3939
|
-
}
|
|
3940
|
-
if (options.allowed_source_types !== void 0) {
|
|
3941
|
-
if (!Array.isArray(options.allowed_source_types)) {
|
|
3942
|
-
throw new SiglumeClientError("allowed_source_types must be a list of strings.");
|
|
3943
|
-
}
|
|
3944
|
-
payload.allowed_source_types = options.allowed_source_types.flatMap((item) => {
|
|
3945
|
-
if (typeof item !== "string") {
|
|
3946
|
-
throw new SiglumeClientError("allowed_source_types must contain only strings.");
|
|
3947
|
-
}
|
|
3948
|
-
const normalizedItem = item.trim();
|
|
3949
|
-
return normalizedItem ? [normalizedItem] : [];
|
|
3950
|
-
});
|
|
3951
|
-
}
|
|
3952
|
-
const execution = await this.execute_owner_operation(
|
|
3953
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3954
|
-
"partner.keys.create",
|
|
3955
|
-
payload,
|
|
3956
|
-
{ lang: options.lang }
|
|
3957
|
-
);
|
|
3958
|
-
return parsePartnerApiKeyHandle(execution.result);
|
|
3959
|
-
}
|
|
3960
|
-
async get_ads_billing(options = {}) {
|
|
3961
|
-
const payload = {};
|
|
3962
|
-
if (options.rail !== void 0 && String(options.rail).trim()) {
|
|
3963
|
-
payload.rail = String(options.rail).trim().toLowerCase();
|
|
3964
|
-
}
|
|
3965
|
-
const execution = await this.execute_owner_operation(
|
|
3966
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3967
|
-
"ads.billing.get",
|
|
3968
|
-
payload,
|
|
3969
|
-
{ lang: options.lang }
|
|
3970
|
-
);
|
|
3971
|
-
return parseAdsBilling(execution.result);
|
|
3972
|
-
}
|
|
3973
|
-
async settle_ads_billing(options = {}) {
|
|
3974
|
-
const execution = await this.execute_owner_operation(
|
|
3975
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3976
|
-
"ads.billing.settle",
|
|
3977
|
-
{},
|
|
3978
|
-
{ lang: options.lang }
|
|
3979
|
-
);
|
|
3980
|
-
return parseAdsBillingSettlement(execution.result);
|
|
3981
|
-
}
|
|
3982
|
-
async get_ads_profile(options = {}) {
|
|
3983
|
-
const execution = await this.execute_owner_operation(
|
|
3984
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3985
|
-
"ads.profile.get",
|
|
3986
|
-
{},
|
|
3987
|
-
{ lang: options.lang }
|
|
3988
|
-
);
|
|
3989
|
-
return parseAdsProfile(execution.result);
|
|
3990
|
-
}
|
|
3991
|
-
async list_ads_campaigns(options = {}) {
|
|
3992
|
-
const execution = await this.execute_owner_operation(
|
|
3993
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3994
|
-
"ads.campaigns.list",
|
|
3995
|
-
{},
|
|
3996
|
-
{ lang: options.lang }
|
|
3997
|
-
);
|
|
3998
|
-
return Array.isArray(execution.result.campaigns) ? execution.result.campaigns.filter((item) => isRecord(item)).map((item) => parseAdsCampaign(item)) : [];
|
|
3999
|
-
}
|
|
4000
|
-
async list_ads_campaign_posts(campaign_id, options = {}) {
|
|
4001
|
-
const normalizedCampaignId = String(campaign_id ?? "").trim();
|
|
4002
|
-
if (!normalizedCampaignId) {
|
|
4003
|
-
throw new SiglumeClientError("campaign_id is required.");
|
|
4004
|
-
}
|
|
4005
|
-
const execution = await this.execute_owner_operation(
|
|
4006
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4007
|
-
"ads.campaign_posts.list",
|
|
4008
|
-
{ campaign_id: normalizedCampaignId },
|
|
4009
|
-
{ lang: options.lang }
|
|
4010
|
-
);
|
|
4011
|
-
return Array.isArray(execution.result.posts) ? execution.result.posts.filter((item) => isRecord(item)).map((item) => parseAdsCampaignPost(item)) : [];
|
|
4012
|
-
}
|
|
4013
3591
|
// `market.proposals.*` currently rides on the public owner-operation execute
|
|
4014
3592
|
// route. Read helpers return typed proposal records; guarded mutations return
|
|
4015
3593
|
// the approval envelope without treating it as an error.
|
|
@@ -5944,12 +5522,15 @@ function validate_tool_manual(manualInput) {
|
|
|
5944
5522
|
pushError("INVALID_TOOL_NAME", "tool_name must be alphanumeric + underscore, 3-64 chars", "tool_name");
|
|
5945
5523
|
}
|
|
5946
5524
|
for (const [fieldName, minLength, maxLength] of [
|
|
5947
|
-
["job_to_be_done", 10,
|
|
5525
|
+
["job_to_be_done", 10, 240],
|
|
5948
5526
|
["summary_for_model", 10, 300]
|
|
5949
5527
|
]) {
|
|
5950
5528
|
const value = manual[fieldName];
|
|
5951
|
-
if (typeof value === "string"
|
|
5952
|
-
|
|
5529
|
+
if (typeof value === "string") {
|
|
5530
|
+
const length = Array.from(value).length;
|
|
5531
|
+
if (length < minLength || length > maxLength) {
|
|
5532
|
+
pushError("INVALID_TYPE", `${fieldName} must be ${minLength}-${maxLength} characters`, fieldName);
|
|
5533
|
+
}
|
|
5953
5534
|
}
|
|
5954
5535
|
}
|
|
5955
5536
|
const triggerConditions = manual.trigger_conditions;
|
|
@@ -7137,8 +6718,12 @@ function buildRuntimeValidationTemplate(toolManual) {
|
|
|
7137
6718
|
healthcheck_url: "https://api.example.com/health",
|
|
7138
6719
|
invoke_url: "https://api.example.com/invoke",
|
|
7139
6720
|
invoke_method: "POST",
|
|
7140
|
-
|
|
7141
|
-
|
|
6721
|
+
// Shared secret Siglume attaches when it calls invoke_url at both
|
|
6722
|
+
// registration validation and production runtime. Use a strong random
|
|
6723
|
+
// value, keep it in the Git-ignored runtime_validation.json, and rotate it
|
|
6724
|
+
// if it leaks. (legacy aliases: test_auth_header_name/value)
|
|
6725
|
+
runtime_auth_header_name: "X-Siglume-Auth",
|
|
6726
|
+
runtime_auth_header_value: "replace-with-strong-random-runtime-auth-secret",
|
|
7142
6727
|
request_payload: requestPayload,
|
|
7143
6728
|
expected_response_fields: expectedFields.length > 0 ? expectedFields : ["summary"],
|
|
7144
6729
|
timeout_seconds: 10
|
|
@@ -7443,8 +7028,6 @@ function runtimePlaceholderIssues(runtimeValidation) {
|
|
|
7443
7028
|
"public_base_url",
|
|
7444
7029
|
"healthcheck_url",
|
|
7445
7030
|
"invoke_url",
|
|
7446
|
-
"test_auth_header_name",
|
|
7447
|
-
"test_auth_header_value",
|
|
7448
7031
|
"expected_response_fields"
|
|
7449
7032
|
]) {
|
|
7450
7033
|
if (!runtimeValidation[fieldName]) {
|
|
@@ -7457,9 +7040,19 @@ function runtimePlaceholderIssues(runtimeValidation) {
|
|
|
7457
7040
|
issues.push(`runtime_validation.${fieldName} must be replaced with your public production URL`);
|
|
7458
7041
|
}
|
|
7459
7042
|
}
|
|
7460
|
-
const
|
|
7043
|
+
const authName = String(
|
|
7044
|
+
runtimeValidation.runtime_auth_header_name || runtimeValidation.test_auth_header_name || ""
|
|
7045
|
+
).trim();
|
|
7046
|
+
if (!authName) {
|
|
7047
|
+
issues.push("runtime_validation.runtime_auth_header_name is required");
|
|
7048
|
+
}
|
|
7049
|
+
const authValue = String(
|
|
7050
|
+
runtimeValidation.runtime_auth_header_value || runtimeValidation.test_auth_header_value || ""
|
|
7051
|
+
).trim();
|
|
7461
7052
|
if (!authValue || authValue.startsWith("replace-with-")) {
|
|
7462
|
-
issues.push(
|
|
7053
|
+
issues.push(
|
|
7054
|
+
"runtime_validation.runtime_auth_header_value must be a strong, dedicated runtime auth secret, not a placeholder"
|
|
7055
|
+
);
|
|
7463
7056
|
}
|
|
7464
7057
|
const requestPayload = runtimeValidation.request_payload ?? runtimeValidation.test_request_body ?? runtimeValidation.runtime_sample ?? runtimeValidation.sample_request_payload ?? runtimeValidation.runtime_sample_request;
|
|
7465
7058
|
if (!isRecord(requestPayload)) {
|
|
@@ -7474,7 +7067,7 @@ function runtimePlaceholderIssues(runtimeValidation) {
|
|
|
7474
7067
|
function ensureRuntimeValidationReady(project) {
|
|
7475
7068
|
if (!project.runtime_validation) {
|
|
7476
7069
|
throw new SiglumeProjectError(
|
|
7477
|
-
"runtime_validation.json is required for `siglume register`. Create it with public_base_url, healthcheck_url, invoke_url,
|
|
7070
|
+
"runtime_validation.json is required for `siglume register`. Create it with public_base_url, healthcheck_url, invoke_url, runtime auth header (runtime_auth_header_name/value), request_payload, and expected_response_fields."
|
|
7478
7071
|
);
|
|
7479
7072
|
}
|
|
7480
7073
|
const issues = runtimePlaceholderIssues(project.runtime_validation);
|
|
@@ -8163,19 +7756,19 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8163
7756
|
"- `stubs.ts`: mock fallback used when `SIGLUME_API_KEY` is not set",
|
|
8164
7757
|
"- `manifest.json`: reviewable manifest snapshot",
|
|
8165
7758
|
"- `tool_manual.json`: machine-generated ToolManual scaffold",
|
|
8166
|
-
"- `runtime_validation.json`: local public endpoint
|
|
7759
|
+
"- `runtime_validation.json`: local public endpoint + runtime auth header checks used by auto-register",
|
|
8167
7760
|
"- `docs/api-usage.md`: publishable API usage guide template for `docs_url`",
|
|
8168
|
-
"- `.gitignore`: keeps runtime
|
|
7761
|
+
"- `.gitignore`: keeps the runtime auth secret out of Git",
|
|
8169
7762
|
"- `tests/test_adapter.ts`: smoke test for `AppTestHarness`",
|
|
8170
7763
|
"",
|
|
8171
7764
|
"Before registering, replace all generated placeholders:",
|
|
8172
7765
|
"- In `adapter.ts` and `manifest.json`, replace `docs_url` with a dedicated public API usage guide, not a homepage.",
|
|
8173
7766
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8174
7767
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8175
|
-
"- In the local `runtime_validation.json`, replace the public URL and
|
|
7768
|
+
"- In the local `runtime_validation.json`, replace the public URL and runtime auth header placeholders (runtime_auth_header_name/value).",
|
|
8176
7769
|
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8177
|
-
"- Do not commit real
|
|
8178
|
-
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit
|
|
7770
|
+
"- Do not commit the real runtime auth secret or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
7771
|
+
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit runtime auth secret values.",
|
|
8179
7772
|
"",
|
|
8180
7773
|
"## Commands",
|
|
8181
7774
|
"",
|
|
@@ -8244,7 +7837,7 @@ function apiUsageDocsTemplate(manifest) {
|
|
|
8244
7837
|
}
|
|
8245
7838
|
function generatedGitignore() {
|
|
8246
7839
|
return [
|
|
8247
|
-
"# Local secrets
|
|
7840
|
+
"# Local secrets (incl. the runtime auth shared secret) and runtime checks.",
|
|
8248
7841
|
".env",
|
|
8249
7842
|
".env.*",
|
|
8250
7843
|
"!.env.example",
|
|
@@ -8728,16 +8321,16 @@ function readmeTemplate(template) {
|
|
|
8728
8321
|
"- `tool_manual.json`: editable ToolManual draft for validation and registration",
|
|
8729
8322
|
"- `runtime_validation.json`: local live API smoke-test contract used during registration",
|
|
8730
8323
|
"- `docs/api-usage.md`: publish this page and use its public URL as `docs_url`",
|
|
8731
|
-
"- `.gitignore`: keeps runtime
|
|
8324
|
+
"- `.gitignore`: keeps the runtime auth secret out of Git",
|
|
8732
8325
|
"",
|
|
8733
8326
|
"Before registering, replace all generated placeholders:",
|
|
8734
8327
|
"- In `adapter.ts` and `manifest.json`, replace `docs_url` with a dedicated public API usage guide, not a homepage.",
|
|
8735
8328
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8736
8329
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8737
|
-
"- In the local `runtime_validation.json`, replace the public URL and
|
|
8330
|
+
"- In the local `runtime_validation.json`, replace the public URL and runtime auth header placeholders (runtime_auth_header_name/value).",
|
|
8738
8331
|
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8739
|
-
"- Do not commit real
|
|
8740
|
-
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit
|
|
8332
|
+
"- Do not commit the real runtime auth secret or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8333
|
+
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit runtime auth secret values.",
|
|
8741
8334
|
"",
|
|
8742
8335
|
"Suggested workflow:",
|
|
8743
8336
|
"",
|