@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/index.js
CHANGED
|
@@ -420,7 +420,12 @@ var init_webhooks = __esm({
|
|
|
420
420
|
"capability.published",
|
|
421
421
|
"capability.delisted",
|
|
422
422
|
"execution.completed",
|
|
423
|
-
"execution.failed"
|
|
423
|
+
"execution.failed",
|
|
424
|
+
"reward_payout.created",
|
|
425
|
+
"reward_payout.provider_pending",
|
|
426
|
+
"reward_paid",
|
|
427
|
+
"reward_payout.failed",
|
|
428
|
+
"reward_payout.cancelled"
|
|
424
429
|
];
|
|
425
430
|
WEBHOOK_EVENT_SET = new Set(WEBHOOK_EVENT_TYPES);
|
|
426
431
|
InMemoryWebhookDedupe = class {
|
|
@@ -1714,6 +1719,23 @@ function validatePricingPlanFloor(plan, defaultCurrency) {
|
|
|
1714
1719
|
function pricingPlanHasItems(plan) {
|
|
1715
1720
|
return isRecord2(plan) && Array.isArray(plan.items) && plan.items.length > 0;
|
|
1716
1721
|
}
|
|
1722
|
+
function validateListingTextLengths(payload) {
|
|
1723
|
+
const limits = {
|
|
1724
|
+
short_description: LISTING_SHORT_DESCRIPTION_MAX_LENGTH,
|
|
1725
|
+
job_to_be_done: LISTING_JOB_TO_BE_DONE_MAX_LENGTH,
|
|
1726
|
+
description: LISTING_DESCRIPTION_MAX_LENGTH
|
|
1727
|
+
};
|
|
1728
|
+
for (const [fieldName, maxLength] of Object.entries(limits)) {
|
|
1729
|
+
const value = payload[fieldName];
|
|
1730
|
+
if (value === void 0 || value === null) continue;
|
|
1731
|
+
if (typeof value !== "string") {
|
|
1732
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be a string when provided.`);
|
|
1733
|
+
}
|
|
1734
|
+
if (Array.from(value).length > maxLength) {
|
|
1735
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be at most ${maxLength} characters.`);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1717
1739
|
function buildToolManualQualityReport(payload) {
|
|
1718
1740
|
const qualityBlock = isRecord2(payload.quality) ? payload.quality : payload;
|
|
1719
1741
|
const issues = [];
|
|
@@ -2271,257 +2293,6 @@ function parseInstalledToolReceiptStep(data) {
|
|
|
2271
2293
|
raw: { ...data }
|
|
2272
2294
|
};
|
|
2273
2295
|
}
|
|
2274
|
-
function toRecordList(value) {
|
|
2275
|
-
return Array.isArray(value) ? value.filter((item) => isRecord2(item)).map((item) => ({ ...item })) : [];
|
|
2276
|
-
}
|
|
2277
|
-
function parsePartnerDashboard(data) {
|
|
2278
|
-
return {
|
|
2279
|
-
partner_id: String(data.partner_id ?? data.user_id ?? ""),
|
|
2280
|
-
company_name: stringOrNull2(data.company_name) ?? void 0,
|
|
2281
|
-
plan: stringOrNull2(data.plan) ?? void 0,
|
|
2282
|
-
plan_label: stringOrNull2(data.plan_label) ?? void 0,
|
|
2283
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
2284
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
2285
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
2286
|
-
total_source_items: Math.trunc(Number(data.total_source_items ?? 0)),
|
|
2287
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2288
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
2289
|
-
raw: { ...data }
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
function parsePartnerUsage(data) {
|
|
2293
|
-
return {
|
|
2294
|
-
plan: stringOrNull2(data.plan) ?? void 0,
|
|
2295
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
2296
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
2297
|
-
month_bytes_remaining: Math.trunc(Number(data.month_bytes_remaining ?? 0)),
|
|
2298
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
2299
|
-
raw: { ...data }
|
|
2300
|
-
};
|
|
2301
|
-
}
|
|
2302
|
-
function parsePartnerApiKey(data) {
|
|
2303
|
-
return {
|
|
2304
|
-
credential_id: String(data.credential_id ?? data.id ?? ""),
|
|
2305
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2306
|
-
key_id: stringOrNull2(data.key_id) ?? void 0,
|
|
2307
|
-
allowed_source_types: Array.isArray(data.allowed_source_types) ? data.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
2308
|
-
last_used_at: stringOrNull2(data.last_used_at) ?? void 0,
|
|
2309
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2310
|
-
revoked: Boolean(data.revoked ?? false),
|
|
2311
|
-
raw: { ...data }
|
|
2312
|
-
};
|
|
2313
|
-
}
|
|
2314
|
-
function parsePartnerApiKeyHandle(data) {
|
|
2315
|
-
const raw = Object.fromEntries(
|
|
2316
|
-
Object.entries(data).filter(([key]) => key !== "ingest_key" && key !== "full_key")
|
|
2317
|
-
);
|
|
2318
|
-
return {
|
|
2319
|
-
credential_id: String(raw.credential_id ?? raw.id ?? ""),
|
|
2320
|
-
name: stringOrNull2(raw.name) ?? void 0,
|
|
2321
|
-
key_id: stringOrNull2(raw.key_id) ?? void 0,
|
|
2322
|
-
allowed_source_types: Array.isArray(raw.allowed_source_types) ? raw.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
2323
|
-
masked_key_hint: stringOrNull2(raw.masked_key_hint) ?? void 0,
|
|
2324
|
-
raw
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
function parseAdsBilling(data) {
|
|
2328
|
-
return {
|
|
2329
|
-
currency: stringOrNull2(data.currency) ?? void 0,
|
|
2330
|
-
billing_mode: stringOrNull2(data.billing_mode) ?? void 0,
|
|
2331
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2332
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2333
|
-
all_time_spend_jpy: Math.trunc(Number(data.all_time_spend_jpy ?? 0)),
|
|
2334
|
-
all_time_spend_usd: Math.trunc(Number(data.all_time_spend_usd ?? 0)),
|
|
2335
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2336
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2337
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2338
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
2339
|
-
invoices: toRecordList(data.invoices),
|
|
2340
|
-
wallet: isRecord2(data.wallet) ? { ...data.wallet } : null,
|
|
2341
|
-
balances: toRecordList(data.balances),
|
|
2342
|
-
supported_tokens: toRecordList(data.supported_tokens),
|
|
2343
|
-
funding_instructions: isRecord2(data.funding_instructions) ? { ...data.funding_instructions } : null,
|
|
2344
|
-
mandate: isRecord2(data.mandate) ? parsePlanWeb3Mandate(data.mandate) : null,
|
|
2345
|
-
raw: { ...data }
|
|
2346
|
-
};
|
|
2347
|
-
}
|
|
2348
|
-
function parseAdsBillingSettlement(data) {
|
|
2349
|
-
return {
|
|
2350
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2351
|
-
message: stringOrNull2(data.message ?? data.detail) ?? void 0,
|
|
2352
|
-
settles_automatically: typeof data.settles_automatically === "boolean" ? data.settles_automatically : typeof data.auto_settles === "boolean" ? data.auto_settles : void 0,
|
|
2353
|
-
cycle_key: stringOrNull2(data.cycle_key) ?? void 0,
|
|
2354
|
-
settled_at: stringOrNull2(data.settled_at) ?? void 0,
|
|
2355
|
-
raw: { ...data }
|
|
2356
|
-
};
|
|
2357
|
-
}
|
|
2358
|
-
function parseAdsProfile(data) {
|
|
2359
|
-
return {
|
|
2360
|
-
has_profile: Boolean(data.has_profile ?? false),
|
|
2361
|
-
company_name: stringOrNull2(data.company_name) ?? void 0,
|
|
2362
|
-
ad_currency: stringOrNull2(data.ad_currency) ?? void 0,
|
|
2363
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2364
|
-
raw: { ...data }
|
|
2365
|
-
};
|
|
2366
|
-
}
|
|
2367
|
-
function parseAdsCampaign(data) {
|
|
2368
|
-
return {
|
|
2369
|
-
campaign_id: String(data.campaign_id ?? data.id ?? ""),
|
|
2370
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2371
|
-
target_url: stringOrNull2(data.target_url) ?? void 0,
|
|
2372
|
-
content_brief: stringOrNull2(data.content_brief) ?? void 0,
|
|
2373
|
-
target_topics: Array.isArray(data.target_topics) ? data.target_topics.filter((item) => typeof item === "string") : [],
|
|
2374
|
-
posting_interval_minutes: Math.trunc(Number(data.posting_interval_minutes ?? 360)),
|
|
2375
|
-
max_posts_per_day: Math.trunc(Number(data.max_posts_per_day ?? 4)),
|
|
2376
|
-
currency: stringOrNull2(data.currency) ?? void 0,
|
|
2377
|
-
monthly_budget_jpy: Math.trunc(Number(data.monthly_budget_jpy ?? 0)),
|
|
2378
|
-
cpm_jpy: Math.trunc(Number(data.cpm_jpy ?? 0)),
|
|
2379
|
-
cpr_jpy: Math.trunc(Number(data.cpr_jpy ?? 0)),
|
|
2380
|
-
monthly_budget_usd: Math.trunc(Number(data.monthly_budget_usd ?? 0)),
|
|
2381
|
-
cpm_usd: Math.trunc(Number(data.cpm_usd ?? 0)),
|
|
2382
|
-
cpr_usd: Math.trunc(Number(data.cpr_usd ?? 0)),
|
|
2383
|
-
status: String(data.status ?? "active").trim().toLowerCase() || "active",
|
|
2384
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2385
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2386
|
-
total_posts: Math.trunc(Number(data.total_posts ?? 0)),
|
|
2387
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2388
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2389
|
-
next_post_at: stringOrNull2(data.next_post_at) ?? void 0,
|
|
2390
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2391
|
-
raw: { ...data }
|
|
2392
|
-
};
|
|
2393
|
-
}
|
|
2394
|
-
function parseAdsCampaignPost(data) {
|
|
2395
|
-
return {
|
|
2396
|
-
post_id: String(data.post_id ?? data.id ?? ""),
|
|
2397
|
-
content_id: stringOrNull2(data.content_id) ?? void 0,
|
|
2398
|
-
cost_jpy: Math.trunc(Number(data.cost_jpy ?? 0)),
|
|
2399
|
-
cost_usd: Math.trunc(Number(data.cost_usd ?? 0)),
|
|
2400
|
-
impressions: Math.trunc(Number(data.impressions ?? 0)),
|
|
2401
|
-
replies: Math.trunc(Number(data.replies ?? 0)),
|
|
2402
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2403
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2404
|
-
raw: { ...data }
|
|
2405
|
-
};
|
|
2406
|
-
}
|
|
2407
|
-
function parseWorksCategory(data) {
|
|
2408
|
-
return {
|
|
2409
|
-
key: String(data.key ?? ""),
|
|
2410
|
-
name_ja: stringOrNull2(data.name_ja) ?? void 0,
|
|
2411
|
-
name_en: stringOrNull2(data.name_en) ?? void 0,
|
|
2412
|
-
description_ja: stringOrNull2(data.description_ja) ?? void 0,
|
|
2413
|
-
description_en: stringOrNull2(data.description_en) ?? void 0,
|
|
2414
|
-
icon_url: stringOrNull2(data.icon_url) ?? void 0,
|
|
2415
|
-
open_job_count: Math.trunc(Number(data.open_job_count ?? 0)),
|
|
2416
|
-
display_order: Math.trunc(Number(data.display_order ?? 0)),
|
|
2417
|
-
raw: { ...data }
|
|
2418
|
-
};
|
|
2419
|
-
}
|
|
2420
|
-
function parseWorksRegistration(data) {
|
|
2421
|
-
const result = isRecord2(data.result) ? data.result : {};
|
|
2422
|
-
const status = String(data.status ?? "completed").trim().toLowerCase() || "completed";
|
|
2423
|
-
return {
|
|
2424
|
-
agent_id: String(result.agent_id ?? data.agent_id ?? ""),
|
|
2425
|
-
works_registered: typeof result.works_registered === "boolean" ? result.works_registered : Boolean(result.works_registered ?? false),
|
|
2426
|
-
tagline: stringOrNull2(result.tagline) ?? void 0,
|
|
2427
|
-
categories: Array.isArray(result.categories) ? result.categories.filter((item) => typeof item === "string") : [],
|
|
2428
|
-
capabilities: Array.isArray(result.capabilities) ? result.capabilities.filter((item) => typeof item === "string") : [],
|
|
2429
|
-
description: stringOrNull2(result.description) ?? void 0,
|
|
2430
|
-
execution_status: status,
|
|
2431
|
-
approval_required: typeof data.approval_required === "boolean" ? data.approval_required : status === "approval_required",
|
|
2432
|
-
intent_id: stringOrNull2(data.intent_id) ?? void 0,
|
|
2433
|
-
approval_status: stringOrNull2(data.approval_status) ?? void 0,
|
|
2434
|
-
approval_snapshot_hash: stringOrNull2(data.approval_snapshot_hash) ?? void 0,
|
|
2435
|
-
approval_preview: toRecord2(result.preview),
|
|
2436
|
-
raw: { ...data }
|
|
2437
|
-
};
|
|
2438
|
-
}
|
|
2439
|
-
function parseWorksOwnerDashboardAgent(data) {
|
|
2440
|
-
return {
|
|
2441
|
-
agent_id: String(data.id ?? data.agent_id ?? ""),
|
|
2442
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2443
|
-
reputation: toRecord2(data.reputation),
|
|
2444
|
-
capabilities: Array.isArray(data.capabilities) ? data.capabilities.filter((item) => typeof item === "string") : [],
|
|
2445
|
-
raw: { ...data }
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
function parseWorksOwnerDashboardPitch(data) {
|
|
2449
|
-
return {
|
|
2450
|
-
proposal_id: String(data.proposal_id ?? data.id ?? ""),
|
|
2451
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2452
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2453
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2454
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2455
|
-
raw: { ...data }
|
|
2456
|
-
};
|
|
2457
|
-
}
|
|
2458
|
-
function parseWorksOwnerDashboardOrder(data) {
|
|
2459
|
-
return {
|
|
2460
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2461
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2462
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2463
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2464
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2465
|
-
raw: { ...data }
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
function parseWorksOwnerDashboardStats(data) {
|
|
2469
|
-
return {
|
|
2470
|
-
total_agents: Math.trunc(Number(data.total_agents ?? 0)),
|
|
2471
|
-
total_pending: Math.trunc(Number(data.total_pending ?? 0)),
|
|
2472
|
-
total_active: Math.trunc(Number(data.total_active ?? 0)),
|
|
2473
|
-
raw: { ...data }
|
|
2474
|
-
};
|
|
2475
|
-
}
|
|
2476
|
-
function parseWorksOwnerDashboard(data) {
|
|
2477
|
-
return {
|
|
2478
|
-
agents: Array.isArray(data.agents) ? data.agents.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardAgent(item)) : [],
|
|
2479
|
-
pending_pitches: Array.isArray(data.pending_pitches) ? data.pending_pitches.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardPitch(item)) : [],
|
|
2480
|
-
active_orders: Array.isArray(data.active_orders) ? data.active_orders.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2481
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2482
|
-
stats: isRecord2(data.stats) ? parseWorksOwnerDashboardStats(data.stats) : parseWorksOwnerDashboardStats({}),
|
|
2483
|
-
raw: { ...data }
|
|
2484
|
-
};
|
|
2485
|
-
}
|
|
2486
|
-
function parseWorksPosterDashboardJob(data) {
|
|
2487
|
-
return {
|
|
2488
|
-
job_id: String(data.id ?? data.job_id ?? ""),
|
|
2489
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2490
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2491
|
-
proposal_count: Math.trunc(Number(data.proposal_count ?? 0)),
|
|
2492
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2493
|
-
raw: { ...data }
|
|
2494
|
-
};
|
|
2495
|
-
}
|
|
2496
|
-
function parseWorksPosterDashboardOrder(data) {
|
|
2497
|
-
return {
|
|
2498
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2499
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2500
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2501
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2502
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2503
|
-
has_deliverable: typeof data.has_deliverable === "boolean" ? data.has_deliverable : Boolean(data.has_deliverable ?? false),
|
|
2504
|
-
deliverable_count: Math.trunc(Number(data.deliverable_count ?? 0)),
|
|
2505
|
-
awaiting_buyer_action: typeof data.awaiting_buyer_action === "boolean" ? data.awaiting_buyer_action : Boolean(data.awaiting_buyer_action ?? false),
|
|
2506
|
-
raw: { ...data }
|
|
2507
|
-
};
|
|
2508
|
-
}
|
|
2509
|
-
function parseWorksPosterDashboardStats(data) {
|
|
2510
|
-
return {
|
|
2511
|
-
total_posted: Math.trunc(Number(data.total_posted ?? 0)),
|
|
2512
|
-
total_completed: Math.trunc(Number(data.total_completed ?? 0)),
|
|
2513
|
-
raw: { ...data }
|
|
2514
|
-
};
|
|
2515
|
-
}
|
|
2516
|
-
function parseWorksPosterDashboard(data) {
|
|
2517
|
-
return {
|
|
2518
|
-
open_jobs: Array.isArray(data.open_jobs) ? data.open_jobs.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardJob(item)) : [],
|
|
2519
|
-
in_progress_orders: Array.isArray(data.in_progress_orders) ? data.in_progress_orders.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2520
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2521
|
-
stats: isRecord2(data.stats) ? parseWorksPosterDashboardStats(data.stats) : parseWorksPosterDashboardStats({}),
|
|
2522
|
-
raw: { ...data }
|
|
2523
|
-
};
|
|
2524
|
-
}
|
|
2525
2296
|
function parseMarketProposal(data) {
|
|
2526
2297
|
const reasonCodes = Array.isArray(data.reason_codes) ? data.reason_codes : Array.isArray(data.reason_codes_jsonb) ? data.reason_codes_jsonb : [];
|
|
2527
2298
|
return {
|
|
@@ -2902,7 +2673,7 @@ function cloneJsonLike(value) {
|
|
|
2902
2673
|
}
|
|
2903
2674
|
return value;
|
|
2904
2675
|
}
|
|
2905
|
-
var DEFAULT_SIGLUME_API_BASE, RETRYABLE_STATUS_CODES, MINIMUM_JPY_OPERATION_PRICE_CURRENCIES, CursorPageResult, SiglumeClient;
|
|
2676
|
+
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;
|
|
2906
2677
|
var init_client = __esm({
|
|
2907
2678
|
"src/client.ts"() {
|
|
2908
2679
|
"use strict";
|
|
@@ -2915,6 +2686,9 @@ var init_client = __esm({
|
|
|
2915
2686
|
DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
|
|
2916
2687
|
RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
2917
2688
|
MINIMUM_JPY_OPERATION_PRICE_CURRENCIES = /* @__PURE__ */ new Set(["JPY", "JPYC"]);
|
|
2689
|
+
LISTING_SHORT_DESCRIPTION_MAX_LENGTH = 60;
|
|
2690
|
+
LISTING_JOB_TO_BE_DONE_MAX_LENGTH = 240;
|
|
2691
|
+
LISTING_DESCRIPTION_MAX_LENGTH = 1e3;
|
|
2918
2692
|
CursorPageResult = class {
|
|
2919
2693
|
items;
|
|
2920
2694
|
next_cursor;
|
|
@@ -3068,6 +2842,7 @@ var init_client = __esm({
|
|
|
3068
2842
|
if (payload.pricing_plan !== void 0) {
|
|
3069
2843
|
validatePricingPlanFloor(payload.pricing_plan, currency);
|
|
3070
2844
|
}
|
|
2845
|
+
validateListingTextLengths(payload);
|
|
3071
2846
|
const priceModel = String(payload.price_model ?? "free").trim().toLowerCase();
|
|
3072
2847
|
if ((priceModel === "usage_based" || priceModel === "per_action") && !pricingPlanHasItems(payload.pricing_plan)) {
|
|
3073
2848
|
throw new SiglumeClientError("AppManifest.pricing_plan.items is required for usage_based/per_action pricing.");
|
|
@@ -3959,94 +3734,6 @@ var init_client = __esm({
|
|
|
3959
3734
|
);
|
|
3960
3735
|
return parseMarketNeed(execution.result);
|
|
3961
3736
|
}
|
|
3962
|
-
// `works.*` also uses the public owner-operation execute route. The
|
|
3963
|
-
// categories list returns a top-level array in `result`, so these
|
|
3964
|
-
// wrappers call the execute endpoint directly instead of relying on
|
|
3965
|
-
// execute_owner_operation()'s object-only `result` parser.
|
|
3966
|
-
async list_works_categories(options = {}) {
|
|
3967
|
-
const [data] = await this.requestOwnerOperation(
|
|
3968
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3969
|
-
"works.categories.list",
|
|
3970
|
-
{},
|
|
3971
|
-
{ lang: options.lang }
|
|
3972
|
-
);
|
|
3973
|
-
return Array.isArray(data.result) ? data.result.filter((item) => isRecord2(item)).map((item) => parseWorksCategory(item)) : [];
|
|
3974
|
-
}
|
|
3975
|
-
async get_works_registration(options = {}) {
|
|
3976
|
-
const [data] = await this.requestOwnerOperation(
|
|
3977
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3978
|
-
"works.registration.get",
|
|
3979
|
-
{},
|
|
3980
|
-
{ lang: options.lang }
|
|
3981
|
-
);
|
|
3982
|
-
return parseWorksRegistration(data);
|
|
3983
|
-
}
|
|
3984
|
-
async register_for_works(options = {}) {
|
|
3985
|
-
const payload = {};
|
|
3986
|
-
if (options.tagline !== void 0) {
|
|
3987
|
-
payload.tagline = String(options.tagline).trim();
|
|
3988
|
-
}
|
|
3989
|
-
if (options.description !== void 0) {
|
|
3990
|
-
payload.description = String(options.description).trim();
|
|
3991
|
-
}
|
|
3992
|
-
if (options.categories !== void 0) {
|
|
3993
|
-
if (!Array.isArray(options.categories)) {
|
|
3994
|
-
throw new SiglumeClientError("categories must be a list of strings.");
|
|
3995
|
-
}
|
|
3996
|
-
const normalizedCategories = [];
|
|
3997
|
-
for (const item of options.categories) {
|
|
3998
|
-
if (typeof item !== "string") {
|
|
3999
|
-
throw new SiglumeClientError("categories must contain only strings.");
|
|
4000
|
-
}
|
|
4001
|
-
const normalized = item.trim();
|
|
4002
|
-
if (normalized) {
|
|
4003
|
-
normalizedCategories.push(normalized);
|
|
4004
|
-
}
|
|
4005
|
-
}
|
|
4006
|
-
payload.categories = normalizedCategories;
|
|
4007
|
-
}
|
|
4008
|
-
if (options.capabilities !== void 0) {
|
|
4009
|
-
if (!Array.isArray(options.capabilities)) {
|
|
4010
|
-
throw new SiglumeClientError("capabilities must be a list of strings.");
|
|
4011
|
-
}
|
|
4012
|
-
const normalizedCapabilities = [];
|
|
4013
|
-
for (const item of options.capabilities) {
|
|
4014
|
-
if (typeof item !== "string") {
|
|
4015
|
-
throw new SiglumeClientError("capabilities must contain only strings.");
|
|
4016
|
-
}
|
|
4017
|
-
const normalized = item.trim();
|
|
4018
|
-
if (normalized) {
|
|
4019
|
-
normalizedCapabilities.push(normalized);
|
|
4020
|
-
}
|
|
4021
|
-
}
|
|
4022
|
-
payload.capabilities = normalizedCapabilities;
|
|
4023
|
-
}
|
|
4024
|
-
const [data] = await this.requestOwnerOperation(
|
|
4025
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4026
|
-
"works.registration.register",
|
|
4027
|
-
payload,
|
|
4028
|
-
{ lang: options.lang }
|
|
4029
|
-
);
|
|
4030
|
-
return parseWorksRegistration(data);
|
|
4031
|
-
}
|
|
4032
|
-
async get_works_owner_dashboard(options = {}) {
|
|
4033
|
-
const [data] = await this.requestOwnerOperation(
|
|
4034
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4035
|
-
"works.owner_dashboard.get",
|
|
4036
|
-
{},
|
|
4037
|
-
{ lang: options.lang }
|
|
4038
|
-
);
|
|
4039
|
-
return parseWorksOwnerDashboard(isRecord2(data.result) ? data.result : {});
|
|
4040
|
-
}
|
|
4041
|
-
async get_works_poster_dashboard(options = {}) {
|
|
4042
|
-
const [data] = await this.requestOwnerOperation(
|
|
4043
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4044
|
-
"works.poster_dashboard.get",
|
|
4045
|
-
{},
|
|
4046
|
-
{ lang: options.lang }
|
|
4047
|
-
);
|
|
4048
|
-
return parseWorksPosterDashboard(isRecord2(data.result) ? data.result : {});
|
|
4049
|
-
}
|
|
4050
3737
|
async list_installed_tools(options = {}) {
|
|
4051
3738
|
const resolvedAgentId = await this.resolveOwnerOperationAgentId(options.agent_id);
|
|
4052
3739
|
const [data] = await this.requestOwnerOperation(
|
|
@@ -4210,115 +3897,6 @@ var init_client = __esm({
|
|
|
4210
3897
|
);
|
|
4211
3898
|
return Array.isArray(data.result) ? data.result.filter((item) => isRecord2(item)).map((item) => parseInstalledToolReceiptStep(item)) : [];
|
|
4212
3899
|
}
|
|
4213
|
-
async get_partner_dashboard(options = {}) {
|
|
4214
|
-
const execution = await this.execute_owner_operation(
|
|
4215
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4216
|
-
"partner.dashboard.get",
|
|
4217
|
-
{},
|
|
4218
|
-
{ lang: options.lang }
|
|
4219
|
-
);
|
|
4220
|
-
return parsePartnerDashboard(execution.result);
|
|
4221
|
-
}
|
|
4222
|
-
async get_partner_usage(options = {}) {
|
|
4223
|
-
const execution = await this.execute_owner_operation(
|
|
4224
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4225
|
-
"partner.usage.get",
|
|
4226
|
-
{},
|
|
4227
|
-
{ lang: options.lang }
|
|
4228
|
-
);
|
|
4229
|
-
return parsePartnerUsage(execution.result);
|
|
4230
|
-
}
|
|
4231
|
-
async list_partner_api_keys(options = {}) {
|
|
4232
|
-
const execution = await this.execute_owner_operation(
|
|
4233
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4234
|
-
"partner.keys.list",
|
|
4235
|
-
{},
|
|
4236
|
-
{ lang: options.lang }
|
|
4237
|
-
);
|
|
4238
|
-
return Array.isArray(execution.result.keys) ? execution.result.keys.filter((item) => isRecord2(item)).map((item) => parsePartnerApiKey(item)) : [];
|
|
4239
|
-
}
|
|
4240
|
-
async create_partner_api_key(options = {}) {
|
|
4241
|
-
const payload = {};
|
|
4242
|
-
if (options.name !== void 0) {
|
|
4243
|
-
const normalizedName = String(options.name).trim();
|
|
4244
|
-
if (!normalizedName) {
|
|
4245
|
-
throw new SiglumeClientError("name cannot be empty.");
|
|
4246
|
-
}
|
|
4247
|
-
payload.name = normalizedName;
|
|
4248
|
-
}
|
|
4249
|
-
if (options.allowed_source_types !== void 0) {
|
|
4250
|
-
if (!Array.isArray(options.allowed_source_types)) {
|
|
4251
|
-
throw new SiglumeClientError("allowed_source_types must be a list of strings.");
|
|
4252
|
-
}
|
|
4253
|
-
payload.allowed_source_types = options.allowed_source_types.flatMap((item) => {
|
|
4254
|
-
if (typeof item !== "string") {
|
|
4255
|
-
throw new SiglumeClientError("allowed_source_types must contain only strings.");
|
|
4256
|
-
}
|
|
4257
|
-
const normalizedItem = item.trim();
|
|
4258
|
-
return normalizedItem ? [normalizedItem] : [];
|
|
4259
|
-
});
|
|
4260
|
-
}
|
|
4261
|
-
const execution = await this.execute_owner_operation(
|
|
4262
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4263
|
-
"partner.keys.create",
|
|
4264
|
-
payload,
|
|
4265
|
-
{ lang: options.lang }
|
|
4266
|
-
);
|
|
4267
|
-
return parsePartnerApiKeyHandle(execution.result);
|
|
4268
|
-
}
|
|
4269
|
-
async get_ads_billing(options = {}) {
|
|
4270
|
-
const payload = {};
|
|
4271
|
-
if (options.rail !== void 0 && String(options.rail).trim()) {
|
|
4272
|
-
payload.rail = String(options.rail).trim().toLowerCase();
|
|
4273
|
-
}
|
|
4274
|
-
const execution = await this.execute_owner_operation(
|
|
4275
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4276
|
-
"ads.billing.get",
|
|
4277
|
-
payload,
|
|
4278
|
-
{ lang: options.lang }
|
|
4279
|
-
);
|
|
4280
|
-
return parseAdsBilling(execution.result);
|
|
4281
|
-
}
|
|
4282
|
-
async settle_ads_billing(options = {}) {
|
|
4283
|
-
const execution = await this.execute_owner_operation(
|
|
4284
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4285
|
-
"ads.billing.settle",
|
|
4286
|
-
{},
|
|
4287
|
-
{ lang: options.lang }
|
|
4288
|
-
);
|
|
4289
|
-
return parseAdsBillingSettlement(execution.result);
|
|
4290
|
-
}
|
|
4291
|
-
async get_ads_profile(options = {}) {
|
|
4292
|
-
const execution = await this.execute_owner_operation(
|
|
4293
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4294
|
-
"ads.profile.get",
|
|
4295
|
-
{},
|
|
4296
|
-
{ lang: options.lang }
|
|
4297
|
-
);
|
|
4298
|
-
return parseAdsProfile(execution.result);
|
|
4299
|
-
}
|
|
4300
|
-
async list_ads_campaigns(options = {}) {
|
|
4301
|
-
const execution = await this.execute_owner_operation(
|
|
4302
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4303
|
-
"ads.campaigns.list",
|
|
4304
|
-
{},
|
|
4305
|
-
{ lang: options.lang }
|
|
4306
|
-
);
|
|
4307
|
-
return Array.isArray(execution.result.campaigns) ? execution.result.campaigns.filter((item) => isRecord2(item)).map((item) => parseAdsCampaign(item)) : [];
|
|
4308
|
-
}
|
|
4309
|
-
async list_ads_campaign_posts(campaign_id, options = {}) {
|
|
4310
|
-
const normalizedCampaignId = String(campaign_id ?? "").trim();
|
|
4311
|
-
if (!normalizedCampaignId) {
|
|
4312
|
-
throw new SiglumeClientError("campaign_id is required.");
|
|
4313
|
-
}
|
|
4314
|
-
const execution = await this.execute_owner_operation(
|
|
4315
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4316
|
-
"ads.campaign_posts.list",
|
|
4317
|
-
{ campaign_id: normalizedCampaignId },
|
|
4318
|
-
{ lang: options.lang }
|
|
4319
|
-
);
|
|
4320
|
-
return Array.isArray(execution.result.posts) ? execution.result.posts.filter((item) => isRecord2(item)).map((item) => parseAdsCampaignPost(item)) : [];
|
|
4321
|
-
}
|
|
4322
3900
|
// `market.proposals.*` currently rides on the public owner-operation execute
|
|
4323
3901
|
// route. Read helpers return typed proposal records; guarded mutations return
|
|
4324
3902
|
// the approval envelope without treating it as an error.
|
|
@@ -7125,12 +6703,15 @@ function validate_tool_manual(manualInput) {
|
|
|
7125
6703
|
pushError("INVALID_TOOL_NAME", "tool_name must be alphanumeric + underscore, 3-64 chars", "tool_name");
|
|
7126
6704
|
}
|
|
7127
6705
|
for (const [fieldName, minLength, maxLength] of [
|
|
7128
|
-
["job_to_be_done", 10,
|
|
6706
|
+
["job_to_be_done", 10, 240],
|
|
7129
6707
|
["summary_for_model", 10, 300]
|
|
7130
6708
|
]) {
|
|
7131
6709
|
const value = manual[fieldName];
|
|
7132
|
-
if (typeof value === "string"
|
|
7133
|
-
|
|
6710
|
+
if (typeof value === "string") {
|
|
6711
|
+
const length = Array.from(value).length;
|
|
6712
|
+
if (length < minLength || length > maxLength) {
|
|
6713
|
+
pushError("INVALID_TYPE", `${fieldName} must be ${minLength}-${maxLength} characters`, fieldName);
|
|
6714
|
+
}
|
|
7134
6715
|
}
|
|
7135
6716
|
}
|
|
7136
6717
|
const triggerConditions = manual.trigger_conditions;
|
|
@@ -8806,7 +8387,7 @@ function normalizeSchema(value) {
|
|
|
8806
8387
|
function buildToolManualSchema(permissionClass, fields) {
|
|
8807
8388
|
const properties = {
|
|
8808
8389
|
tool_name: { type: "string", minLength: 3, maxLength: 64 },
|
|
8809
|
-
job_to_be_done: { type: "string", minLength: 10, maxLength:
|
|
8390
|
+
job_to_be_done: { type: "string", minLength: 10, maxLength: 240 },
|
|
8810
8391
|
summary_for_model: { type: "string", minLength: 10, maxLength: 300 },
|
|
8811
8392
|
trigger_conditions: {
|
|
8812
8393
|
type: "array",
|