@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.cjs
CHANGED
|
@@ -442,7 +442,12 @@ var init_webhooks = __esm({
|
|
|
442
442
|
"capability.published",
|
|
443
443
|
"capability.delisted",
|
|
444
444
|
"execution.completed",
|
|
445
|
-
"execution.failed"
|
|
445
|
+
"execution.failed",
|
|
446
|
+
"reward_payout.created",
|
|
447
|
+
"reward_payout.provider_pending",
|
|
448
|
+
"reward_paid",
|
|
449
|
+
"reward_payout.failed",
|
|
450
|
+
"reward_payout.cancelled"
|
|
446
451
|
];
|
|
447
452
|
WEBHOOK_EVENT_SET = new Set(WEBHOOK_EVENT_TYPES);
|
|
448
453
|
InMemoryWebhookDedupe = class {
|
|
@@ -1736,6 +1741,23 @@ function validatePricingPlanFloor(plan, defaultCurrency) {
|
|
|
1736
1741
|
function pricingPlanHasItems(plan) {
|
|
1737
1742
|
return isRecord2(plan) && Array.isArray(plan.items) && plan.items.length > 0;
|
|
1738
1743
|
}
|
|
1744
|
+
function validateListingTextLengths(payload) {
|
|
1745
|
+
const limits = {
|
|
1746
|
+
short_description: LISTING_SHORT_DESCRIPTION_MAX_LENGTH,
|
|
1747
|
+
job_to_be_done: LISTING_JOB_TO_BE_DONE_MAX_LENGTH,
|
|
1748
|
+
description: LISTING_DESCRIPTION_MAX_LENGTH
|
|
1749
|
+
};
|
|
1750
|
+
for (const [fieldName, maxLength] of Object.entries(limits)) {
|
|
1751
|
+
const value = payload[fieldName];
|
|
1752
|
+
if (value === void 0 || value === null) continue;
|
|
1753
|
+
if (typeof value !== "string") {
|
|
1754
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be a string when provided.`);
|
|
1755
|
+
}
|
|
1756
|
+
if (Array.from(value).length > maxLength) {
|
|
1757
|
+
throw new SiglumeClientError(`AppManifest.${fieldName} must be at most ${maxLength} characters.`);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1739
1761
|
function buildToolManualQualityReport(payload) {
|
|
1740
1762
|
const qualityBlock = isRecord2(payload.quality) ? payload.quality : payload;
|
|
1741
1763
|
const issues = [];
|
|
@@ -2293,257 +2315,6 @@ function parseInstalledToolReceiptStep(data) {
|
|
|
2293
2315
|
raw: { ...data }
|
|
2294
2316
|
};
|
|
2295
2317
|
}
|
|
2296
|
-
function toRecordList(value) {
|
|
2297
|
-
return Array.isArray(value) ? value.filter((item) => isRecord2(item)).map((item) => ({ ...item })) : [];
|
|
2298
|
-
}
|
|
2299
|
-
function parsePartnerDashboard(data) {
|
|
2300
|
-
return {
|
|
2301
|
-
partner_id: String(data.partner_id ?? data.user_id ?? ""),
|
|
2302
|
-
company_name: stringOrNull2(data.company_name) ?? void 0,
|
|
2303
|
-
plan: stringOrNull2(data.plan) ?? void 0,
|
|
2304
|
-
plan_label: stringOrNull2(data.plan_label) ?? void 0,
|
|
2305
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
2306
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
2307
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
2308
|
-
total_source_items: Math.trunc(Number(data.total_source_items ?? 0)),
|
|
2309
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2310
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
2311
|
-
raw: { ...data }
|
|
2312
|
-
};
|
|
2313
|
-
}
|
|
2314
|
-
function parsePartnerUsage(data) {
|
|
2315
|
-
return {
|
|
2316
|
-
plan: stringOrNull2(data.plan) ?? void 0,
|
|
2317
|
-
month_bytes_used: Math.trunc(Number(data.month_bytes_used ?? 0)),
|
|
2318
|
-
month_bytes_limit: Math.trunc(Number(data.month_bytes_limit ?? 0)),
|
|
2319
|
-
month_bytes_remaining: Math.trunc(Number(data.month_bytes_remaining ?? 0)),
|
|
2320
|
-
month_usage_pct: Number(data.month_usage_pct ?? 0),
|
|
2321
|
-
raw: { ...data }
|
|
2322
|
-
};
|
|
2323
|
-
}
|
|
2324
|
-
function parsePartnerApiKey(data) {
|
|
2325
|
-
return {
|
|
2326
|
-
credential_id: String(data.credential_id ?? data.id ?? ""),
|
|
2327
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2328
|
-
key_id: stringOrNull2(data.key_id) ?? void 0,
|
|
2329
|
-
allowed_source_types: Array.isArray(data.allowed_source_types) ? data.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
2330
|
-
last_used_at: stringOrNull2(data.last_used_at) ?? void 0,
|
|
2331
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2332
|
-
revoked: Boolean(data.revoked ?? false),
|
|
2333
|
-
raw: { ...data }
|
|
2334
|
-
};
|
|
2335
|
-
}
|
|
2336
|
-
function parsePartnerApiKeyHandle(data) {
|
|
2337
|
-
const raw = Object.fromEntries(
|
|
2338
|
-
Object.entries(data).filter(([key]) => key !== "ingest_key" && key !== "full_key")
|
|
2339
|
-
);
|
|
2340
|
-
return {
|
|
2341
|
-
credential_id: String(raw.credential_id ?? raw.id ?? ""),
|
|
2342
|
-
name: stringOrNull2(raw.name) ?? void 0,
|
|
2343
|
-
key_id: stringOrNull2(raw.key_id) ?? void 0,
|
|
2344
|
-
allowed_source_types: Array.isArray(raw.allowed_source_types) ? raw.allowed_source_types.filter((item) => typeof item === "string") : [],
|
|
2345
|
-
masked_key_hint: stringOrNull2(raw.masked_key_hint) ?? void 0,
|
|
2346
|
-
raw
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
function parseAdsBilling(data) {
|
|
2350
|
-
return {
|
|
2351
|
-
currency: stringOrNull2(data.currency) ?? void 0,
|
|
2352
|
-
billing_mode: stringOrNull2(data.billing_mode) ?? void 0,
|
|
2353
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2354
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2355
|
-
all_time_spend_jpy: Math.trunc(Number(data.all_time_spend_jpy ?? 0)),
|
|
2356
|
-
all_time_spend_usd: Math.trunc(Number(data.all_time_spend_usd ?? 0)),
|
|
2357
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2358
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2359
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2360
|
-
has_subscription: Boolean(data.has_subscription ?? false),
|
|
2361
|
-
invoices: toRecordList(data.invoices),
|
|
2362
|
-
wallet: isRecord2(data.wallet) ? { ...data.wallet } : null,
|
|
2363
|
-
balances: toRecordList(data.balances),
|
|
2364
|
-
supported_tokens: toRecordList(data.supported_tokens),
|
|
2365
|
-
funding_instructions: isRecord2(data.funding_instructions) ? { ...data.funding_instructions } : null,
|
|
2366
|
-
mandate: isRecord2(data.mandate) ? parsePlanWeb3Mandate(data.mandate) : null,
|
|
2367
|
-
raw: { ...data }
|
|
2368
|
-
};
|
|
2369
|
-
}
|
|
2370
|
-
function parseAdsBillingSettlement(data) {
|
|
2371
|
-
return {
|
|
2372
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2373
|
-
message: stringOrNull2(data.message ?? data.detail) ?? void 0,
|
|
2374
|
-
settles_automatically: typeof data.settles_automatically === "boolean" ? data.settles_automatically : typeof data.auto_settles === "boolean" ? data.auto_settles : void 0,
|
|
2375
|
-
cycle_key: stringOrNull2(data.cycle_key) ?? void 0,
|
|
2376
|
-
settled_at: stringOrNull2(data.settled_at) ?? void 0,
|
|
2377
|
-
raw: { ...data }
|
|
2378
|
-
};
|
|
2379
|
-
}
|
|
2380
|
-
function parseAdsProfile(data) {
|
|
2381
|
-
return {
|
|
2382
|
-
has_profile: Boolean(data.has_profile ?? false),
|
|
2383
|
-
company_name: stringOrNull2(data.company_name) ?? void 0,
|
|
2384
|
-
ad_currency: stringOrNull2(data.ad_currency) ?? void 0,
|
|
2385
|
-
has_billing: Boolean(data.has_billing ?? false),
|
|
2386
|
-
raw: { ...data }
|
|
2387
|
-
};
|
|
2388
|
-
}
|
|
2389
|
-
function parseAdsCampaign(data) {
|
|
2390
|
-
return {
|
|
2391
|
-
campaign_id: String(data.campaign_id ?? data.id ?? ""),
|
|
2392
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2393
|
-
target_url: stringOrNull2(data.target_url) ?? void 0,
|
|
2394
|
-
content_brief: stringOrNull2(data.content_brief) ?? void 0,
|
|
2395
|
-
target_topics: Array.isArray(data.target_topics) ? data.target_topics.filter((item) => typeof item === "string") : [],
|
|
2396
|
-
posting_interval_minutes: Math.trunc(Number(data.posting_interval_minutes ?? 360)),
|
|
2397
|
-
max_posts_per_day: Math.trunc(Number(data.max_posts_per_day ?? 4)),
|
|
2398
|
-
currency: stringOrNull2(data.currency) ?? void 0,
|
|
2399
|
-
monthly_budget_jpy: Math.trunc(Number(data.monthly_budget_jpy ?? 0)),
|
|
2400
|
-
cpm_jpy: Math.trunc(Number(data.cpm_jpy ?? 0)),
|
|
2401
|
-
cpr_jpy: Math.trunc(Number(data.cpr_jpy ?? 0)),
|
|
2402
|
-
monthly_budget_usd: Math.trunc(Number(data.monthly_budget_usd ?? 0)),
|
|
2403
|
-
cpm_usd: Math.trunc(Number(data.cpm_usd ?? 0)),
|
|
2404
|
-
cpr_usd: Math.trunc(Number(data.cpr_usd ?? 0)),
|
|
2405
|
-
status: String(data.status ?? "active").trim().toLowerCase() || "active",
|
|
2406
|
-
month_spend_jpy: Math.trunc(Number(data.month_spend_jpy ?? 0)),
|
|
2407
|
-
month_spend_usd: Math.trunc(Number(data.month_spend_usd ?? 0)),
|
|
2408
|
-
total_posts: Math.trunc(Number(data.total_posts ?? 0)),
|
|
2409
|
-
total_impressions: Math.trunc(Number(data.total_impressions ?? 0)),
|
|
2410
|
-
total_replies: Math.trunc(Number(data.total_replies ?? 0)),
|
|
2411
|
-
next_post_at: stringOrNull2(data.next_post_at) ?? void 0,
|
|
2412
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2413
|
-
raw: { ...data }
|
|
2414
|
-
};
|
|
2415
|
-
}
|
|
2416
|
-
function parseAdsCampaignPost(data) {
|
|
2417
|
-
return {
|
|
2418
|
-
post_id: String(data.post_id ?? data.id ?? ""),
|
|
2419
|
-
content_id: stringOrNull2(data.content_id) ?? void 0,
|
|
2420
|
-
cost_jpy: Math.trunc(Number(data.cost_jpy ?? 0)),
|
|
2421
|
-
cost_usd: Math.trunc(Number(data.cost_usd ?? 0)),
|
|
2422
|
-
impressions: Math.trunc(Number(data.impressions ?? 0)),
|
|
2423
|
-
replies: Math.trunc(Number(data.replies ?? 0)),
|
|
2424
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2425
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2426
|
-
raw: { ...data }
|
|
2427
|
-
};
|
|
2428
|
-
}
|
|
2429
|
-
function parseWorksCategory(data) {
|
|
2430
|
-
return {
|
|
2431
|
-
key: String(data.key ?? ""),
|
|
2432
|
-
name_ja: stringOrNull2(data.name_ja) ?? void 0,
|
|
2433
|
-
name_en: stringOrNull2(data.name_en) ?? void 0,
|
|
2434
|
-
description_ja: stringOrNull2(data.description_ja) ?? void 0,
|
|
2435
|
-
description_en: stringOrNull2(data.description_en) ?? void 0,
|
|
2436
|
-
icon_url: stringOrNull2(data.icon_url) ?? void 0,
|
|
2437
|
-
open_job_count: Math.trunc(Number(data.open_job_count ?? 0)),
|
|
2438
|
-
display_order: Math.trunc(Number(data.display_order ?? 0)),
|
|
2439
|
-
raw: { ...data }
|
|
2440
|
-
};
|
|
2441
|
-
}
|
|
2442
|
-
function parseWorksRegistration(data) {
|
|
2443
|
-
const result = isRecord2(data.result) ? data.result : {};
|
|
2444
|
-
const status = String(data.status ?? "completed").trim().toLowerCase() || "completed";
|
|
2445
|
-
return {
|
|
2446
|
-
agent_id: String(result.agent_id ?? data.agent_id ?? ""),
|
|
2447
|
-
works_registered: typeof result.works_registered === "boolean" ? result.works_registered : Boolean(result.works_registered ?? false),
|
|
2448
|
-
tagline: stringOrNull2(result.tagline) ?? void 0,
|
|
2449
|
-
categories: Array.isArray(result.categories) ? result.categories.filter((item) => typeof item === "string") : [],
|
|
2450
|
-
capabilities: Array.isArray(result.capabilities) ? result.capabilities.filter((item) => typeof item === "string") : [],
|
|
2451
|
-
description: stringOrNull2(result.description) ?? void 0,
|
|
2452
|
-
execution_status: status,
|
|
2453
|
-
approval_required: typeof data.approval_required === "boolean" ? data.approval_required : status === "approval_required",
|
|
2454
|
-
intent_id: stringOrNull2(data.intent_id) ?? void 0,
|
|
2455
|
-
approval_status: stringOrNull2(data.approval_status) ?? void 0,
|
|
2456
|
-
approval_snapshot_hash: stringOrNull2(data.approval_snapshot_hash) ?? void 0,
|
|
2457
|
-
approval_preview: toRecord2(result.preview),
|
|
2458
|
-
raw: { ...data }
|
|
2459
|
-
};
|
|
2460
|
-
}
|
|
2461
|
-
function parseWorksOwnerDashboardAgent(data) {
|
|
2462
|
-
return {
|
|
2463
|
-
agent_id: String(data.id ?? data.agent_id ?? ""),
|
|
2464
|
-
name: stringOrNull2(data.name) ?? void 0,
|
|
2465
|
-
reputation: toRecord2(data.reputation),
|
|
2466
|
-
capabilities: Array.isArray(data.capabilities) ? data.capabilities.filter((item) => typeof item === "string") : [],
|
|
2467
|
-
raw: { ...data }
|
|
2468
|
-
};
|
|
2469
|
-
}
|
|
2470
|
-
function parseWorksOwnerDashboardPitch(data) {
|
|
2471
|
-
return {
|
|
2472
|
-
proposal_id: String(data.proposal_id ?? data.id ?? ""),
|
|
2473
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2474
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2475
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2476
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2477
|
-
raw: { ...data }
|
|
2478
|
-
};
|
|
2479
|
-
}
|
|
2480
|
-
function parseWorksOwnerDashboardOrder(data) {
|
|
2481
|
-
return {
|
|
2482
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2483
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2484
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2485
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2486
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2487
|
-
raw: { ...data }
|
|
2488
|
-
};
|
|
2489
|
-
}
|
|
2490
|
-
function parseWorksOwnerDashboardStats(data) {
|
|
2491
|
-
return {
|
|
2492
|
-
total_agents: Math.trunc(Number(data.total_agents ?? 0)),
|
|
2493
|
-
total_pending: Math.trunc(Number(data.total_pending ?? 0)),
|
|
2494
|
-
total_active: Math.trunc(Number(data.total_active ?? 0)),
|
|
2495
|
-
raw: { ...data }
|
|
2496
|
-
};
|
|
2497
|
-
}
|
|
2498
|
-
function parseWorksOwnerDashboard(data) {
|
|
2499
|
-
return {
|
|
2500
|
-
agents: Array.isArray(data.agents) ? data.agents.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardAgent(item)) : [],
|
|
2501
|
-
pending_pitches: Array.isArray(data.pending_pitches) ? data.pending_pitches.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardPitch(item)) : [],
|
|
2502
|
-
active_orders: Array.isArray(data.active_orders) ? data.active_orders.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2503
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord2(item)).map((item) => parseWorksOwnerDashboardOrder(item)) : [],
|
|
2504
|
-
stats: isRecord2(data.stats) ? parseWorksOwnerDashboardStats(data.stats) : parseWorksOwnerDashboardStats({}),
|
|
2505
|
-
raw: { ...data }
|
|
2506
|
-
};
|
|
2507
|
-
}
|
|
2508
|
-
function parseWorksPosterDashboardJob(data) {
|
|
2509
|
-
return {
|
|
2510
|
-
job_id: String(data.id ?? data.job_id ?? ""),
|
|
2511
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2512
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2513
|
-
proposal_count: Math.trunc(Number(data.proposal_count ?? 0)),
|
|
2514
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2515
|
-
raw: { ...data }
|
|
2516
|
-
};
|
|
2517
|
-
}
|
|
2518
|
-
function parseWorksPosterDashboardOrder(data) {
|
|
2519
|
-
return {
|
|
2520
|
-
order_id: String(data.order_id ?? data.id ?? ""),
|
|
2521
|
-
need_id: stringOrNull2(data.need_id) ?? void 0,
|
|
2522
|
-
title: stringOrNull2(data.title) ?? void 0,
|
|
2523
|
-
title_en: stringOrNull2(data.title_en) ?? void 0,
|
|
2524
|
-
status: stringOrNull2(data.status) ?? void 0,
|
|
2525
|
-
has_deliverable: typeof data.has_deliverable === "boolean" ? data.has_deliverable : Boolean(data.has_deliverable ?? false),
|
|
2526
|
-
deliverable_count: Math.trunc(Number(data.deliverable_count ?? 0)),
|
|
2527
|
-
awaiting_buyer_action: typeof data.awaiting_buyer_action === "boolean" ? data.awaiting_buyer_action : Boolean(data.awaiting_buyer_action ?? false),
|
|
2528
|
-
raw: { ...data }
|
|
2529
|
-
};
|
|
2530
|
-
}
|
|
2531
|
-
function parseWorksPosterDashboardStats(data) {
|
|
2532
|
-
return {
|
|
2533
|
-
total_posted: Math.trunc(Number(data.total_posted ?? 0)),
|
|
2534
|
-
total_completed: Math.trunc(Number(data.total_completed ?? 0)),
|
|
2535
|
-
raw: { ...data }
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
function parseWorksPosterDashboard(data) {
|
|
2539
|
-
return {
|
|
2540
|
-
open_jobs: Array.isArray(data.open_jobs) ? data.open_jobs.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardJob(item)) : [],
|
|
2541
|
-
in_progress_orders: Array.isArray(data.in_progress_orders) ? data.in_progress_orders.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2542
|
-
completed_orders: Array.isArray(data.completed_orders) ? data.completed_orders.filter((item) => isRecord2(item)).map((item) => parseWorksPosterDashboardOrder(item)) : [],
|
|
2543
|
-
stats: isRecord2(data.stats) ? parseWorksPosterDashboardStats(data.stats) : parseWorksPosterDashboardStats({}),
|
|
2544
|
-
raw: { ...data }
|
|
2545
|
-
};
|
|
2546
|
-
}
|
|
2547
2318
|
function parseMarketProposal(data) {
|
|
2548
2319
|
const reasonCodes = Array.isArray(data.reason_codes) ? data.reason_codes : Array.isArray(data.reason_codes_jsonb) ? data.reason_codes_jsonb : [];
|
|
2549
2320
|
return {
|
|
@@ -2924,7 +2695,7 @@ function cloneJsonLike(value) {
|
|
|
2924
2695
|
}
|
|
2925
2696
|
return value;
|
|
2926
2697
|
}
|
|
2927
|
-
var DEFAULT_SIGLUME_API_BASE, RETRYABLE_STATUS_CODES, MINIMUM_JPY_OPERATION_PRICE_CURRENCIES, CursorPageResult, SiglumeClient;
|
|
2698
|
+
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;
|
|
2928
2699
|
var init_client = __esm({
|
|
2929
2700
|
"src/client.ts"() {
|
|
2930
2701
|
"use strict";
|
|
@@ -2937,6 +2708,9 @@ var init_client = __esm({
|
|
|
2937
2708
|
DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
|
|
2938
2709
|
RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
2939
2710
|
MINIMUM_JPY_OPERATION_PRICE_CURRENCIES = /* @__PURE__ */ new Set(["JPY", "JPYC"]);
|
|
2711
|
+
LISTING_SHORT_DESCRIPTION_MAX_LENGTH = 60;
|
|
2712
|
+
LISTING_JOB_TO_BE_DONE_MAX_LENGTH = 240;
|
|
2713
|
+
LISTING_DESCRIPTION_MAX_LENGTH = 1e3;
|
|
2940
2714
|
CursorPageResult = class {
|
|
2941
2715
|
items;
|
|
2942
2716
|
next_cursor;
|
|
@@ -3090,6 +2864,7 @@ var init_client = __esm({
|
|
|
3090
2864
|
if (payload.pricing_plan !== void 0) {
|
|
3091
2865
|
validatePricingPlanFloor(payload.pricing_plan, currency);
|
|
3092
2866
|
}
|
|
2867
|
+
validateListingTextLengths(payload);
|
|
3093
2868
|
const priceModel = String(payload.price_model ?? "free").trim().toLowerCase();
|
|
3094
2869
|
if ((priceModel === "usage_based" || priceModel === "per_action") && !pricingPlanHasItems(payload.pricing_plan)) {
|
|
3095
2870
|
throw new SiglumeClientError("AppManifest.pricing_plan.items is required for usage_based/per_action pricing.");
|
|
@@ -3981,94 +3756,6 @@ var init_client = __esm({
|
|
|
3981
3756
|
);
|
|
3982
3757
|
return parseMarketNeed(execution.result);
|
|
3983
3758
|
}
|
|
3984
|
-
// `works.*` also uses the public owner-operation execute route. The
|
|
3985
|
-
// categories list returns a top-level array in `result`, so these
|
|
3986
|
-
// wrappers call the execute endpoint directly instead of relying on
|
|
3987
|
-
// execute_owner_operation()'s object-only `result` parser.
|
|
3988
|
-
async list_works_categories(options = {}) {
|
|
3989
|
-
const [data] = await this.requestOwnerOperation(
|
|
3990
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
3991
|
-
"works.categories.list",
|
|
3992
|
-
{},
|
|
3993
|
-
{ lang: options.lang }
|
|
3994
|
-
);
|
|
3995
|
-
return Array.isArray(data.result) ? data.result.filter((item) => isRecord2(item)).map((item) => parseWorksCategory(item)) : [];
|
|
3996
|
-
}
|
|
3997
|
-
async get_works_registration(options = {}) {
|
|
3998
|
-
const [data] = await this.requestOwnerOperation(
|
|
3999
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4000
|
-
"works.registration.get",
|
|
4001
|
-
{},
|
|
4002
|
-
{ lang: options.lang }
|
|
4003
|
-
);
|
|
4004
|
-
return parseWorksRegistration(data);
|
|
4005
|
-
}
|
|
4006
|
-
async register_for_works(options = {}) {
|
|
4007
|
-
const payload = {};
|
|
4008
|
-
if (options.tagline !== void 0) {
|
|
4009
|
-
payload.tagline = String(options.tagline).trim();
|
|
4010
|
-
}
|
|
4011
|
-
if (options.description !== void 0) {
|
|
4012
|
-
payload.description = String(options.description).trim();
|
|
4013
|
-
}
|
|
4014
|
-
if (options.categories !== void 0) {
|
|
4015
|
-
if (!Array.isArray(options.categories)) {
|
|
4016
|
-
throw new SiglumeClientError("categories must be a list of strings.");
|
|
4017
|
-
}
|
|
4018
|
-
const normalizedCategories = [];
|
|
4019
|
-
for (const item of options.categories) {
|
|
4020
|
-
if (typeof item !== "string") {
|
|
4021
|
-
throw new SiglumeClientError("categories must contain only strings.");
|
|
4022
|
-
}
|
|
4023
|
-
const normalized = item.trim();
|
|
4024
|
-
if (normalized) {
|
|
4025
|
-
normalizedCategories.push(normalized);
|
|
4026
|
-
}
|
|
4027
|
-
}
|
|
4028
|
-
payload.categories = normalizedCategories;
|
|
4029
|
-
}
|
|
4030
|
-
if (options.capabilities !== void 0) {
|
|
4031
|
-
if (!Array.isArray(options.capabilities)) {
|
|
4032
|
-
throw new SiglumeClientError("capabilities must be a list of strings.");
|
|
4033
|
-
}
|
|
4034
|
-
const normalizedCapabilities = [];
|
|
4035
|
-
for (const item of options.capabilities) {
|
|
4036
|
-
if (typeof item !== "string") {
|
|
4037
|
-
throw new SiglumeClientError("capabilities must contain only strings.");
|
|
4038
|
-
}
|
|
4039
|
-
const normalized = item.trim();
|
|
4040
|
-
if (normalized) {
|
|
4041
|
-
normalizedCapabilities.push(normalized);
|
|
4042
|
-
}
|
|
4043
|
-
}
|
|
4044
|
-
payload.capabilities = normalizedCapabilities;
|
|
4045
|
-
}
|
|
4046
|
-
const [data] = await this.requestOwnerOperation(
|
|
4047
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4048
|
-
"works.registration.register",
|
|
4049
|
-
payload,
|
|
4050
|
-
{ lang: options.lang }
|
|
4051
|
-
);
|
|
4052
|
-
return parseWorksRegistration(data);
|
|
4053
|
-
}
|
|
4054
|
-
async get_works_owner_dashboard(options = {}) {
|
|
4055
|
-
const [data] = await this.requestOwnerOperation(
|
|
4056
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4057
|
-
"works.owner_dashboard.get",
|
|
4058
|
-
{},
|
|
4059
|
-
{ lang: options.lang }
|
|
4060
|
-
);
|
|
4061
|
-
return parseWorksOwnerDashboard(isRecord2(data.result) ? data.result : {});
|
|
4062
|
-
}
|
|
4063
|
-
async get_works_poster_dashboard(options = {}) {
|
|
4064
|
-
const [data] = await this.requestOwnerOperation(
|
|
4065
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4066
|
-
"works.poster_dashboard.get",
|
|
4067
|
-
{},
|
|
4068
|
-
{ lang: options.lang }
|
|
4069
|
-
);
|
|
4070
|
-
return parseWorksPosterDashboard(isRecord2(data.result) ? data.result : {});
|
|
4071
|
-
}
|
|
4072
3759
|
async list_installed_tools(options = {}) {
|
|
4073
3760
|
const resolvedAgentId = await this.resolveOwnerOperationAgentId(options.agent_id);
|
|
4074
3761
|
const [data] = await this.requestOwnerOperation(
|
|
@@ -4232,115 +3919,6 @@ var init_client = __esm({
|
|
|
4232
3919
|
);
|
|
4233
3920
|
return Array.isArray(data.result) ? data.result.filter((item) => isRecord2(item)).map((item) => parseInstalledToolReceiptStep(item)) : [];
|
|
4234
3921
|
}
|
|
4235
|
-
async get_partner_dashboard(options = {}) {
|
|
4236
|
-
const execution = await this.execute_owner_operation(
|
|
4237
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4238
|
-
"partner.dashboard.get",
|
|
4239
|
-
{},
|
|
4240
|
-
{ lang: options.lang }
|
|
4241
|
-
);
|
|
4242
|
-
return parsePartnerDashboard(execution.result);
|
|
4243
|
-
}
|
|
4244
|
-
async get_partner_usage(options = {}) {
|
|
4245
|
-
const execution = await this.execute_owner_operation(
|
|
4246
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4247
|
-
"partner.usage.get",
|
|
4248
|
-
{},
|
|
4249
|
-
{ lang: options.lang }
|
|
4250
|
-
);
|
|
4251
|
-
return parsePartnerUsage(execution.result);
|
|
4252
|
-
}
|
|
4253
|
-
async list_partner_api_keys(options = {}) {
|
|
4254
|
-
const execution = await this.execute_owner_operation(
|
|
4255
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4256
|
-
"partner.keys.list",
|
|
4257
|
-
{},
|
|
4258
|
-
{ lang: options.lang }
|
|
4259
|
-
);
|
|
4260
|
-
return Array.isArray(execution.result.keys) ? execution.result.keys.filter((item) => isRecord2(item)).map((item) => parsePartnerApiKey(item)) : [];
|
|
4261
|
-
}
|
|
4262
|
-
async create_partner_api_key(options = {}) {
|
|
4263
|
-
const payload = {};
|
|
4264
|
-
if (options.name !== void 0) {
|
|
4265
|
-
const normalizedName = String(options.name).trim();
|
|
4266
|
-
if (!normalizedName) {
|
|
4267
|
-
throw new SiglumeClientError("name cannot be empty.");
|
|
4268
|
-
}
|
|
4269
|
-
payload.name = normalizedName;
|
|
4270
|
-
}
|
|
4271
|
-
if (options.allowed_source_types !== void 0) {
|
|
4272
|
-
if (!Array.isArray(options.allowed_source_types)) {
|
|
4273
|
-
throw new SiglumeClientError("allowed_source_types must be a list of strings.");
|
|
4274
|
-
}
|
|
4275
|
-
payload.allowed_source_types = options.allowed_source_types.flatMap((item) => {
|
|
4276
|
-
if (typeof item !== "string") {
|
|
4277
|
-
throw new SiglumeClientError("allowed_source_types must contain only strings.");
|
|
4278
|
-
}
|
|
4279
|
-
const normalizedItem = item.trim();
|
|
4280
|
-
return normalizedItem ? [normalizedItem] : [];
|
|
4281
|
-
});
|
|
4282
|
-
}
|
|
4283
|
-
const execution = await this.execute_owner_operation(
|
|
4284
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4285
|
-
"partner.keys.create",
|
|
4286
|
-
payload,
|
|
4287
|
-
{ lang: options.lang }
|
|
4288
|
-
);
|
|
4289
|
-
return parsePartnerApiKeyHandle(execution.result);
|
|
4290
|
-
}
|
|
4291
|
-
async get_ads_billing(options = {}) {
|
|
4292
|
-
const payload = {};
|
|
4293
|
-
if (options.rail !== void 0 && String(options.rail).trim()) {
|
|
4294
|
-
payload.rail = String(options.rail).trim().toLowerCase();
|
|
4295
|
-
}
|
|
4296
|
-
const execution = await this.execute_owner_operation(
|
|
4297
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4298
|
-
"ads.billing.get",
|
|
4299
|
-
payload,
|
|
4300
|
-
{ lang: options.lang }
|
|
4301
|
-
);
|
|
4302
|
-
return parseAdsBilling(execution.result);
|
|
4303
|
-
}
|
|
4304
|
-
async settle_ads_billing(options = {}) {
|
|
4305
|
-
const execution = await this.execute_owner_operation(
|
|
4306
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4307
|
-
"ads.billing.settle",
|
|
4308
|
-
{},
|
|
4309
|
-
{ lang: options.lang }
|
|
4310
|
-
);
|
|
4311
|
-
return parseAdsBillingSettlement(execution.result);
|
|
4312
|
-
}
|
|
4313
|
-
async get_ads_profile(options = {}) {
|
|
4314
|
-
const execution = await this.execute_owner_operation(
|
|
4315
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4316
|
-
"ads.profile.get",
|
|
4317
|
-
{},
|
|
4318
|
-
{ lang: options.lang }
|
|
4319
|
-
);
|
|
4320
|
-
return parseAdsProfile(execution.result);
|
|
4321
|
-
}
|
|
4322
|
-
async list_ads_campaigns(options = {}) {
|
|
4323
|
-
const execution = await this.execute_owner_operation(
|
|
4324
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4325
|
-
"ads.campaigns.list",
|
|
4326
|
-
{},
|
|
4327
|
-
{ lang: options.lang }
|
|
4328
|
-
);
|
|
4329
|
-
return Array.isArray(execution.result.campaigns) ? execution.result.campaigns.filter((item) => isRecord2(item)).map((item) => parseAdsCampaign(item)) : [];
|
|
4330
|
-
}
|
|
4331
|
-
async list_ads_campaign_posts(campaign_id, options = {}) {
|
|
4332
|
-
const normalizedCampaignId = String(campaign_id ?? "").trim();
|
|
4333
|
-
if (!normalizedCampaignId) {
|
|
4334
|
-
throw new SiglumeClientError("campaign_id is required.");
|
|
4335
|
-
}
|
|
4336
|
-
const execution = await this.execute_owner_operation(
|
|
4337
|
-
await this.resolveOwnerOperationAgentId(options.agent_id),
|
|
4338
|
-
"ads.campaign_posts.list",
|
|
4339
|
-
{ campaign_id: normalizedCampaignId },
|
|
4340
|
-
{ lang: options.lang }
|
|
4341
|
-
);
|
|
4342
|
-
return Array.isArray(execution.result.posts) ? execution.result.posts.filter((item) => isRecord2(item)).map((item) => parseAdsCampaignPost(item)) : [];
|
|
4343
|
-
}
|
|
4344
3922
|
// `market.proposals.*` currently rides on the public owner-operation execute
|
|
4345
3923
|
// route. Read helpers return typed proposal records; guarded mutations return
|
|
4346
3924
|
// the approval envelope without treating it as an error.
|
|
@@ -7232,12 +6810,15 @@ function validate_tool_manual(manualInput) {
|
|
|
7232
6810
|
pushError("INVALID_TOOL_NAME", "tool_name must be alphanumeric + underscore, 3-64 chars", "tool_name");
|
|
7233
6811
|
}
|
|
7234
6812
|
for (const [fieldName, minLength, maxLength] of [
|
|
7235
|
-
["job_to_be_done", 10,
|
|
6813
|
+
["job_to_be_done", 10, 240],
|
|
7236
6814
|
["summary_for_model", 10, 300]
|
|
7237
6815
|
]) {
|
|
7238
6816
|
const value = manual[fieldName];
|
|
7239
|
-
if (typeof value === "string"
|
|
7240
|
-
|
|
6817
|
+
if (typeof value === "string") {
|
|
6818
|
+
const length = Array.from(value).length;
|
|
6819
|
+
if (length < minLength || length > maxLength) {
|
|
6820
|
+
pushError("INVALID_TYPE", `${fieldName} must be ${minLength}-${maxLength} characters`, fieldName);
|
|
6821
|
+
}
|
|
7241
6822
|
}
|
|
7242
6823
|
}
|
|
7243
6824
|
const triggerConditions = manual.trigger_conditions;
|
|
@@ -8913,7 +8494,7 @@ function normalizeSchema(value) {
|
|
|
8913
8494
|
function buildToolManualSchema(permissionClass, fields) {
|
|
8914
8495
|
const properties = {
|
|
8915
8496
|
tool_name: { type: "string", minLength: 3, maxLength: 64 },
|
|
8916
|
-
job_to_be_done: { type: "string", minLength: 10, maxLength:
|
|
8497
|
+
job_to_be_done: { type: "string", minLength: 10, maxLength: 240 },
|
|
8917
8498
|
summary_for_model: { type: "string", minLength: 10, maxLength: 300 },
|
|
8918
8499
|
trigger_conditions: {
|
|
8919
8500
|
type: "array",
|