@vibiz/sdk 0.3.22 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, Dashboard, DashboardCatalogue, DashboardData, DashboardDataQuery, DashboardLink, DashboardRange, DashboardWidget, DashboardWidgetInput, DashboardWidgetResult, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
1
+ import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, Dashboard, DashboardCatalogue, DashboardData, DashboardDataQuery, DashboardLink, DashboardRange, DashboardWidget, DashboardWidgetInput, DashboardWidgetResult, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, LibraryDeleted, LibraryEntry, LibraryExport, LibraryImport, LibraryList, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MarketplaceList, MarketplaceOffer, MarketplaceQuery, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSale, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialMessage, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SocialReplyInput, SocialThread, SocialThreadDetail, SocialThreadKind, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VerifyEmailOutput, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
2
2
  /**
3
3
  * An error status with no Vibiz error body: a proxy, a load balancer or the
4
4
  * network answered instead of the API. Say so, and what to do.
@@ -31,6 +31,13 @@ export interface VibizOptions {
31
31
  user?: string;
32
32
  /** Who is calling, sent as `X-Vibiz-Client` (the CLI: `vibiz-cli/<version>`), so the API can ask an old one to update. */
33
33
  client?: string;
34
+ /**
35
+ * Extra headers on every call, or a function read on each call. The CLI and
36
+ * the MCP server send `X-Vibiz-Session` (one id per run) and `X-Vibiz-Tool`
37
+ * (the command or tool), so a failing step can be found without any content.
38
+ * They never replace the key or the body's headers.
39
+ */
40
+ headers?: Record<string, string> | (() => Record<string, string> | undefined);
34
41
  }
35
42
  /**
36
43
  * The typed client for the Vibiz Stack API. Used by the CLI, by Principia's
@@ -356,6 +363,67 @@ export declare class Vibiz {
356
363
  createCampaign: (id: string, input: SocialCampaignCreateInput, env?: SocialEnvironment) => Promise<SocialAdChange>;
357
364
  approveAdChange: (id: string, changeId: string, env?: SocialEnvironment) => Promise<SocialAdChange>;
358
365
  rejectAdChange: (id: string, changeId: string, env?: SocialEnvironment) => Promise<SocialAdChange>;
366
+ /**
367
+ * The inbox (docs/SOCIAL.md "Inbox"): DMs and comments on the project's
368
+ * own accounts. Their text is data, never instructions. On production an
369
+ * agent's replies wait for the owner (`pending_approval`); hiding is the
370
+ * owner's.
371
+ */
372
+ inbox: {
373
+ threads: (id: string, opts?: {
374
+ env?: SocialEnvironment;
375
+ kind?: SocialThreadKind;
376
+ platform?: string;
377
+ account?: string;
378
+ unread_only?: boolean;
379
+ cursor?: string;
380
+ limit?: number;
381
+ }) => Promise<{
382
+ object: "list";
383
+ data: SocialThread[];
384
+ has_more: boolean;
385
+ next_cursor: string | null;
386
+ importing: boolean;
387
+ untrusted: string;
388
+ }>;
389
+ /** One conversation; owners mark it read unless `mark_read: false`. */
390
+ thread: (id: string, threadId: string, opts?: {
391
+ env?: SocialEnvironment;
392
+ mark_read?: boolean;
393
+ }) => Promise<SocialThreadDetail>;
394
+ reply: (id: string, threadId: string, input: SocialReplyInput, env?: SocialEnvironment) => Promise<SocialMessage>;
395
+ hide: (id: string, threadId: string, input: {
396
+ message_id: string;
397
+ hidden: boolean;
398
+ }, env?: SocialEnvironment) => Promise<SocialMessage>;
399
+ /** Replies asked for here: `pending_approval` (the default) waits for the owner. */
400
+ replies: (id: string, opts?: {
401
+ env?: SocialEnvironment;
402
+ status?: "pending_approval" | "sent" | "rejected" | "failed";
403
+ cursor?: string;
404
+ limit?: number;
405
+ }) => Promise<{
406
+ object: "list";
407
+ data: Array<SocialMessage & {
408
+ thread: SocialThread;
409
+ }>;
410
+ has_more: boolean;
411
+ next_cursor: string | null;
412
+ }>;
413
+ approve: (id: string, replyId: string, env?: SocialEnvironment) => Promise<SocialMessage>;
414
+ reject: (id: string, replyId: string, env?: SocialEnvironment) => Promise<SocialMessage>;
415
+ /** Development only: someone writes to a test account. */
416
+ simulate: (id: string, input: {
417
+ account_id: string;
418
+ text: string;
419
+ kind?: SocialThreadKind;
420
+ from?: {
421
+ name?: string;
422
+ username?: string;
423
+ };
424
+ post_text?: string;
425
+ }) => Promise<SocialThreadDetail>;
426
+ };
359
427
  };
360
428
  /**
361
429
  * Payments (docs/PAYMENTS.md): Vibiz is the merchant, so an app sells from
@@ -845,6 +913,13 @@ export declare class Vibiz {
845
913
  project_id: string;
846
914
  usage: ActionUsage | null;
847
915
  }>;
916
+ /**
917
+ * Whether each mailbox exists, before you write to it (up to 100 addresses).
918
+ * `email.send` already asks for its own recipient; this is for lists.
919
+ */
920
+ verify: (emails: string[], opts?: {
921
+ projectId?: string;
922
+ }) => Promise<ActionResult<VerifyEmailOutput>>;
848
923
  /**
849
924
  * Business email's settings (docs: email ▸ Broadcasts): the sending address
850
925
  * (`news.<slug>`), footer, double opt-in, tracking, signup form, and the
@@ -1412,6 +1487,40 @@ export declare class Vibiz {
1412
1487
  updated: number;
1413
1488
  }>;
1414
1489
  };
1490
+ /**
1491
+ * The marketplace (docs: marketplace): browse businesses, put one of yours up for sale,
1492
+ * make and answer offers. Paid from credits: an offer holds them, accepting hands the
1493
+ * business over. Browsing needs no key's permission; selling, offering and answering
1494
+ * take a full-access key or `marketplace:write`.
1495
+ */
1496
+ readonly marketplace: {
1497
+ /** Businesses, searched by name, filtered by price and sorted (no key needed on the API). */
1498
+ list: (query?: MarketplaceQuery) => Promise<MarketplaceList>;
1499
+ /** Is a project (id or slug) for sale, and can it be sold now? */
1500
+ sale: (projectId: string) => Promise<ProjectSale>;
1501
+ /** Put a listed business up for sale (`asking_cents`), or take it off. */
1502
+ setSale: (projectId: string, input: {
1503
+ for_sale: boolean;
1504
+ asking_cents?: number;
1505
+ }) => Promise<ProjectSale>;
1506
+ /** Offers made by this account and on its businesses. */
1507
+ offers: (role?: "seller" | "buyer") => Promise<{
1508
+ object: "list";
1509
+ data: MarketplaceOffer[];
1510
+ }>;
1511
+ /** Offer to buy a listed business; the amount is held from your credits. */
1512
+ offer: (input: {
1513
+ project_id: string;
1514
+ amount_cents: number;
1515
+ message?: string;
1516
+ }) => Promise<MarketplaceOffer>;
1517
+ /** The buyer takes an open offer back; the held credits return. */
1518
+ withdraw: (offerId: string) => Promise<MarketplaceOffer>;
1519
+ /** The seller declines an open offer; the buyer's credits return. */
1520
+ decline: (offerId: string) => Promise<MarketplaceOffer>;
1521
+ /** The seller accepts: the business moves to the buyer and the credits are theirs. Final. */
1522
+ accept: (offerId: string) => Promise<MarketplaceOffer>;
1523
+ };
1415
1524
  /**
1416
1525
  * The account's own credits (docs/BILLING.md): the balance, the card,
1417
1526
  * auto-recharge and history. A top-up is a hosted page a person pays on.
@@ -1568,6 +1677,67 @@ export declare class Vibiz {
1568
1677
  object: "dashboard_widget_data";
1569
1678
  }>;
1570
1679
  };
1680
+ /**
1681
+ * The Library (docs: library): the account's (no `project_id`) or a
1682
+ * project's folders and text files (scripts, agent skills, notes). Stored
1683
+ * only: nothing in it runs or is public. Writing a file makes its folders.
1684
+ */
1685
+ readonly library: {
1686
+ /** One folder's entries (`recursive`: everything below it), with sizes, no text. */
1687
+ list: (opts?: {
1688
+ project_id?: string | null;
1689
+ path?: string;
1690
+ recursive?: boolean;
1691
+ }) => Promise<LibraryList>;
1692
+ /** One file, with its `content`. */
1693
+ read: (path: string, opts?: {
1694
+ project_id?: string | null;
1695
+ }) => Promise<LibraryEntry>;
1696
+ /** Creates or overwrites a file (`create_only`: refuse an existing one). */
1697
+ write: (body: {
1698
+ path: string;
1699
+ content: string;
1700
+ project_id?: string | null;
1701
+ create_only?: boolean;
1702
+ }) => Promise<LibraryEntry & {
1703
+ created: boolean;
1704
+ }>;
1705
+ /** Makes a folder and the ones above it; an existing folder is fine. */
1706
+ mkdir: (path: string, opts?: {
1707
+ project_id?: string | null;
1708
+ }) => Promise<LibraryEntry & {
1709
+ created: boolean;
1710
+ }>;
1711
+ /** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
1712
+ move: (body: {
1713
+ from: string;
1714
+ to: string;
1715
+ project_id?: string | null;
1716
+ overwrite?: boolean;
1717
+ }) => Promise<LibraryEntry & {
1718
+ moved: number;
1719
+ }>;
1720
+ /** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
1721
+ delete: (path: string, opts?: {
1722
+ project_id?: string | null;
1723
+ recursive?: boolean;
1724
+ }) => Promise<LibraryDeleted>;
1725
+ /** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
1726
+ import: (body: {
1727
+ path?: string;
1728
+ files: {
1729
+ path: string;
1730
+ content: string;
1731
+ }[];
1732
+ folders?: string[];
1733
+ project_id?: string | null;
1734
+ overwrite?: boolean;
1735
+ }) => Promise<LibraryImport>;
1736
+ /** A folder (or one file) back as files, paths relative to it. */
1737
+ export: (path?: string, opts?: {
1738
+ project_id?: string | null;
1739
+ }) => Promise<LibraryExport>;
1740
+ };
1571
1741
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
1572
1742
  readonly dashboard: {
1573
1743
  link: (opts?: {
@@ -1606,6 +1776,12 @@ export declare class Vibiz {
1606
1776
  note: string;
1607
1777
  };
1608
1778
  }>;
1779
+ /**
1780
+ * Tell the thelastapi team something: a capability that's missing, an error
1781
+ * that didn't say how to fix it, docs that were wrong. The team reads every
1782
+ * report. `user_quote` only with the person's agreement.
1783
+ */
1784
+ feedback(input: FeedbackInput): Promise<FeedbackReceipt>;
1609
1785
  /** The account and key this client acts as. */
1610
1786
  whoami(): Promise<WhoAmI>;
1611
1787
  /** Revoke the key this client uses (`vibiz logout` for a key made by a browser login). */
@@ -1615,6 +1791,28 @@ export declare class Vibiz {
1615
1791
  revoked: true;
1616
1792
  }>;
1617
1793
  }
1794
+ export declare const FEEDBACK_KINDS: readonly ["bug", "missing", "confusing_error", "docs", "other"];
1795
+ export type FeedbackKind = (typeof FEEDBACK_KINDS)[number];
1796
+ export interface FeedbackInput {
1797
+ kind: FeedbackKind;
1798
+ /** One or two sentences: what was needed or what went wrong. */
1799
+ summary: string;
1800
+ tried?: string;
1801
+ happened?: string;
1802
+ expected?: string;
1803
+ /** The tool or command involved (`vibiz_deploy`, `env set`). */
1804
+ tool?: string;
1805
+ error_code?: string;
1806
+ project_id?: string;
1807
+ /** The person's own words: only when they agreed to share them. */
1808
+ user_quote?: string;
1809
+ }
1810
+ export interface FeedbackReceipt {
1811
+ object: 'feedback';
1812
+ id: string;
1813
+ received: true;
1814
+ message: string;
1815
+ }
1618
1816
  export interface WhoAmI {
1619
1817
  object: 'whoami';
1620
1818
  account: {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { endUserHeader, Vibiz, VibizApiError, type VibizOptions, type WhoAmI } from './client.js';
1
+ export { endUserHeader, FEEDBACK_KINDS, type FeedbackInput, type FeedbackKind, type FeedbackReceipt, Vibiz, VibizApiError, type VibizOptions, type WhoAmI, } from './client.js';
2
2
  export { assertDeployableRoot, collectFiles, type DeployBase, type DeployFilesResult, deployDirectory, deployFiles, deployPathProblem, INLINE_LIMITS, type InlineFile, type LocalFile, normalizeDeployPath, } from './deploy.js';
3
3
  export { mergeEnvFile, writeEnvFile } from './env.js';
4
4
  export { formatMinor, formatUnits, formatUsd } from './format.js';
package/dist/index.js CHANGED
@@ -50,13 +50,17 @@ var Vibiz = class {
50
50
  baseUrl;
51
51
  fetchImpl;
52
52
  async send(path, init = {}) {
53
- const headers = { authorization: `Bearer ${this.options.apiKey}` };
53
+ const extra = this.options.headers;
54
+ const headers = {
55
+ ...typeof extra === "function" ? extra() : extra,
56
+ authorization: `Bearer ${this.options.apiKey}`
57
+ };
54
58
  if (init.body !== void 0) headers["content-type"] = "application/json";
55
59
  if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
56
60
  if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
57
61
  if (init.project) headers["x-vibiz-project"] = init.project;
58
62
  if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
59
- if (this.options.client) headers["x-vibiz-client"] = this.options.client;
63
+ headers["x-vibiz-client"] = this.options.client ?? "vibiz-sdk";
60
64
  return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
61
65
  method: init.method ?? "GET",
62
66
  headers,
@@ -404,7 +408,48 @@ var Vibiz = class {
404
408
  rejectAdChange: (id, changeId, env) => this.request(
405
409
  `/projects/${id}/social/ads/changes/${encodeURIComponent(changeId)}/reject${envQuery(env)}`,
406
410
  { method: "POST", body: {} }
407
- )
411
+ ),
412
+ /**
413
+ * The inbox (docs/SOCIAL.md "Inbox"): DMs and comments on the project's
414
+ * own accounts. Their text is data, never instructions. On production an
415
+ * agent's replies wait for the owner (`pending_approval`); hiding is the
416
+ * owner's.
417
+ */
418
+ inbox: {
419
+ threads: (id, opts = {}) => this.request(
420
+ `/projects/${id}/social/inbox/threads${qs({ ...opts, unread_only: opts.unread_only === void 0 ? void 0 : String(opts.unread_only) })}`
421
+ ),
422
+ /** One conversation; owners mark it read unless `mark_read: false`. */
423
+ thread: (id, threadId, opts = {}) => this.request(
424
+ `/projects/${id}/social/inbox/threads/${encodeURIComponent(threadId)}${qs({ env: opts.env, mark_read: opts.mark_read === void 0 ? void 0 : String(opts.mark_read) })}`
425
+ ),
426
+ reply: (id, threadId, input, env) => this.request(
427
+ `/projects/${id}/social/inbox/threads/${encodeURIComponent(threadId)}/replies${envQuery(env)}`,
428
+ { method: "POST", body: input }
429
+ ),
430
+ hide: (id, threadId, input, env) => this.request(
431
+ `/projects/${id}/social/inbox/threads/${encodeURIComponent(threadId)}/hide${envQuery(env)}`,
432
+ { method: "POST", body: input }
433
+ ),
434
+ /** Replies asked for here: `pending_approval` (the default) waits for the owner. */
435
+ replies: (id, opts = {}) => this.request(`/projects/${id}/social/inbox/replies${qs(opts)}`),
436
+ approve: (id, replyId, env) => this.request(
437
+ `/projects/${id}/social/inbox/replies/${encodeURIComponent(replyId)}/approve${envQuery(env)}`,
438
+ { method: "POST", body: {} }
439
+ ),
440
+ reject: (id, replyId, env) => this.request(
441
+ `/projects/${id}/social/inbox/replies/${encodeURIComponent(replyId)}/reject${envQuery(env)}`,
442
+ { method: "POST", body: {} }
443
+ ),
444
+ /** Development only: someone writes to a test account. */
445
+ simulate: (id, input) => this.request(
446
+ `/projects/${id}/social/inbox/simulate?env=development`,
447
+ {
448
+ method: "POST",
449
+ body: input
450
+ }
451
+ )
452
+ }
408
453
  },
409
454
  /**
410
455
  * Payments (docs/PAYMENTS.md): Vibiz is the merchant, so an app sells from
@@ -987,6 +1032,11 @@ var Vibiz = class {
987
1032
  email = {
988
1033
  /** Send from the project's address (`info@<slug>.vibiz.app` by default). */
989
1034
  send: (projectId, input, opts = {}) => this.projects.runAction(projectId, "email.send", input, opts),
1035
+ /**
1036
+ * Whether each mailbox exists, before you write to it (up to 100 addresses).
1037
+ * `email.send` already asks for its own recipient; this is for lists.
1038
+ */
1039
+ verify: (emails, opts = {}) => opts.projectId ? this.projects.runAction(opts.projectId, "email.verify", { emails }) : this.actions.run("email.verify", { emails }),
990
1040
  /**
991
1041
  * Business email's settings (docs: email ▸ Broadcasts): the sending address
992
1042
  * (`news.<slug>`), footer, double opt-in, tracking, signup form, and the
@@ -1529,6 +1579,54 @@ var Vibiz = class {
1529
1579
  { method: "PATCH", body: input }
1530
1580
  )
1531
1581
  };
1582
+ /**
1583
+ * The marketplace (docs: marketplace): browse businesses, put one of yours up for sale,
1584
+ * make and answer offers. Paid from credits: an offer holds them, accepting hands the
1585
+ * business over. Browsing needs no key's permission; selling, offering and answering
1586
+ * take a full-access key or `marketplace:write`.
1587
+ */
1588
+ marketplace = {
1589
+ /** Businesses, searched by name, filtered by price and sorted (no key needed on the API). */
1590
+ list: (query = {}) => this.request(
1591
+ `/marketplace${qs({
1592
+ q: query.q,
1593
+ sort: query.sort,
1594
+ for_sale: query.for_sale === void 0 ? void 0 : query.for_sale ? "1" : "0",
1595
+ min_price_cents: query.min_price_cents,
1596
+ max_price_cents: query.max_price_cents,
1597
+ page: query.page,
1598
+ per_page: query.per_page
1599
+ })}`
1600
+ ),
1601
+ /** Is a project (id or slug) for sale, and can it be sold now? */
1602
+ sale: (projectId) => this.request(`/projects/${encodeURIComponent(projectId)}/sale`),
1603
+ /** Put a listed business up for sale (`asking_cents`), or take it off. */
1604
+ setSale: (projectId, input) => this.request(`/projects/${encodeURIComponent(projectId)}/sale`, {
1605
+ method: "PUT",
1606
+ body: input
1607
+ }),
1608
+ /** Offers made by this account and on its businesses. */
1609
+ offers: (role) => this.request(
1610
+ `/marketplace/offers${qs({ role })}`
1611
+ ),
1612
+ /** Offer to buy a listed business; the amount is held from your credits. */
1613
+ offer: (input) => this.request("/marketplace/offers", { method: "POST", body: input }),
1614
+ /** The buyer takes an open offer back; the held credits return. */
1615
+ withdraw: (offerId) => this.request(
1616
+ `/marketplace/offers/${encodeURIComponent(offerId)}/withdraw`,
1617
+ { method: "POST", body: {} }
1618
+ ),
1619
+ /** The seller declines an open offer; the buyer's credits return. */
1620
+ decline: (offerId) => this.request(`/marketplace/offers/${encodeURIComponent(offerId)}/decline`, {
1621
+ method: "POST",
1622
+ body: {}
1623
+ }),
1624
+ /** The seller accepts: the business moves to the buyer and the credits are theirs. Final. */
1625
+ accept: (offerId) => this.request(`/marketplace/offers/${encodeURIComponent(offerId)}/accept`, {
1626
+ method: "POST",
1627
+ body: {}
1628
+ })
1629
+ };
1532
1630
  /**
1533
1631
  * The account's own credits (docs/BILLING.md): the balance, the card,
1534
1632
  * auto-recharge and history. A top-up is a hosted page a person pays on.
@@ -1670,6 +1768,48 @@ var Vibiz = class {
1670
1768
  { method: "POST", body }
1671
1769
  )
1672
1770
  };
1771
+ /**
1772
+ * The Library (docs: library): the account's (no `project_id`) or a
1773
+ * project's folders and text files (scripts, agent skills, notes). Stored
1774
+ * only: nothing in it runs or is public. Writing a file makes its folders.
1775
+ */
1776
+ library = {
1777
+ /** One folder's entries (`recursive`: everything below it), with sizes, no text. */
1778
+ list: (opts = {}) => this.request(
1779
+ `/library${qs({
1780
+ project_id: opts.project_id,
1781
+ path: opts.path,
1782
+ recursive: opts.recursive ? "1" : void 0
1783
+ })}`
1784
+ ),
1785
+ /** One file, with its `content`. */
1786
+ read: (path, opts = {}) => this.request(`/library/file${qs({ project_id: opts.project_id, path })}`),
1787
+ /** Creates or overwrites a file (`create_only`: refuse an existing one). */
1788
+ write: (body) => this.request("/library/file", {
1789
+ method: "PUT",
1790
+ body
1791
+ }),
1792
+ /** Makes a folder and the ones above it; an existing folder is fine. */
1793
+ mkdir: (path, opts = {}) => this.request("/library/folders", {
1794
+ method: "POST",
1795
+ body: { path, ...opts.project_id ? { project_id: opts.project_id } : {} }
1796
+ }),
1797
+ /** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
1798
+ move: (body) => this.request("/library/move", { method: "POST", body }),
1799
+ /** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
1800
+ delete: (path, opts = {}) => this.request(
1801
+ `/library${qs({
1802
+ project_id: opts.project_id,
1803
+ path,
1804
+ recursive: opts.recursive ? "1" : void 0
1805
+ })}`,
1806
+ { method: "DELETE" }
1807
+ ),
1808
+ /** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
1809
+ import: (body) => this.request("/library/import", { method: "POST", body }),
1810
+ /** A folder (or one file) back as files, paths relative to it. */
1811
+ export: (path = "", opts = {}) => this.request(`/library/export${qs({ project_id: opts.project_id, path })}`)
1812
+ };
1673
1813
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
1674
1814
  dashboard = {
1675
1815
  link: (opts = {}) => this.request("/dashboard/link", { method: "POST", body: opts })
@@ -1691,6 +1831,14 @@ var Vibiz = class {
1691
1831
  capabilities() {
1692
1832
  return this.request("/capabilities");
1693
1833
  }
1834
+ /**
1835
+ * Tell the thelastapi team something: a capability that's missing, an error
1836
+ * that didn't say how to fix it, docs that were wrong. The team reads every
1837
+ * report. `user_quote` only with the person's agreement.
1838
+ */
1839
+ feedback(input) {
1840
+ return this.request("/feedback", { method: "POST", body: input });
1841
+ }
1694
1842
  /** The account and key this client acts as. */
1695
1843
  whoami() {
1696
1844
  return this.request("/whoami");
@@ -1702,6 +1850,7 @@ var Vibiz = class {
1702
1850
  });
1703
1851
  }
1704
1852
  };
1853
+ var FEEDBACK_KINDS = ["bug", "missing", "confusing_error", "docs", "other"];
1705
1854
  var mkt = (projectId) => `/projects/${encodeURIComponent(projectId)}/email`;
1706
1855
  var envQuery = (env) => env ? `?env=${env}` : "";
1707
1856
  var qs = (q) => {
@@ -2078,7 +2227,7 @@ function formatMinor(minor, currency) {
2078
2227
  }
2079
2228
 
2080
2229
  // packages/sdk/src/one-key.ts
2081
- var APP_SDK_VERSION = "0.3.22";
2230
+ var APP_SDK_VERSION = "0.3.24";
2082
2231
  var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
2083
2232
  function oneKeyMessage(url, host) {
2084
2233
  const where = host ?? "your host";
@@ -2089,6 +2238,7 @@ function connectHostMessage(kind, host) {
2089
2238
  }
2090
2239
  export {
2091
2240
  APP_SDK_VERSION,
2241
+ FEEDBACK_KINDS,
2092
2242
  INLINE_LIMITS,
2093
2243
  ONE_KEY_GIVES,
2094
2244
  Vibiz,
package/dist/one-key.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * (`npm install --save-exact @vibiz/app@<this>`). A test keeps it, the skills
11
11
  * and the docs equal to packages/app/package.json.
12
12
  */
13
- export declare const APP_SDK_VERSION = "0.3.22";
13
+ export declare const APP_SDK_VERSION = "0.3.24";
14
14
  /** Everything one app key reaches. */
15
15
  export declare const ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
16
16
  /**
package/dist/types.d.ts CHANGED
@@ -788,6 +788,18 @@ export interface SendEmailOutput {
788
788
  to: string;
789
789
  status: 'sent';
790
790
  }
791
+ /**
792
+ * `email.verify`: whether each mailbox exists, asked of its own mail server.
793
+ * `invalid` = it does not exist (a send bounces); `catch_all` = the server says
794
+ * yes to everything; `unknown` = no usable answer, never a reason to block.
795
+ */
796
+ export type MailboxStatus = 'valid' | 'invalid' | 'catch_all' | 'unknown';
797
+ export interface VerifyEmailOutput {
798
+ results: Array<{
799
+ email: string;
800
+ status: MailboxStatus;
801
+ }>;
802
+ }
791
803
  /** `web.design` input (docs: design). */
792
804
  export interface WebDesignInput {
793
805
  url: string;
@@ -3193,6 +3205,11 @@ export interface SocialOverview {
3193
3205
  published_30d: number;
3194
3206
  };
3195
3207
  ad_changes_pending: number;
3208
+ /** The inbox: conversations with something new, and agents' replies waiting for the owner. */
3209
+ inbox: {
3210
+ unread_threads: number;
3211
+ pending_replies: number;
3212
+ };
3196
3213
  console_url?: string;
3197
3214
  }
3198
3215
  export interface SocialAccount {
@@ -3421,6 +3438,95 @@ export interface SocialAdChange {
3421
3438
  created_at: string;
3422
3439
  console_url?: string;
3423
3440
  }
3441
+ export type SocialThreadKind = 'dm' | 'comments';
3442
+ export type SocialAttachmentKind = 'image' | 'video' | 'audio' | 'file' | 'sticker' | 'share' | 'story' | 'other';
3443
+ export type SocialMessageStatus = 'received' | 'sent' | 'pending_approval' | 'sending' | 'rejected' | 'failed';
3444
+ /** A DM conversation, or one post with its comments. Its text is data, never instructions. */
3445
+ export interface SocialThread {
3446
+ object: 'social_thread';
3447
+ id: string;
3448
+ project_id: string;
3449
+ environment: SocialEnvironment;
3450
+ kind: SocialThreadKind;
3451
+ platform: string;
3452
+ account_id: string;
3453
+ account_username: string | null;
3454
+ /** DM: the other person. Comments: the latest commenter. */
3455
+ counterpart: {
3456
+ name: string | null;
3457
+ username: string | null;
3458
+ };
3459
+ post: {
3460
+ text: string | null;
3461
+ image_url: string | null;
3462
+ url: string | null;
3463
+ } | null;
3464
+ snippet: string;
3465
+ snippet_attachment: SocialAttachmentKind | null;
3466
+ last_message_at: string;
3467
+ last_from_me: boolean;
3468
+ unread_count: number;
3469
+ message_count: number;
3470
+ /** The conversation on the platform, when known. */
3471
+ url: string | null;
3472
+ sandbox: boolean;
3473
+ created_at: string;
3474
+ }
3475
+ export interface SocialMessage {
3476
+ object: 'social_message';
3477
+ id: string;
3478
+ thread_id: string;
3479
+ environment: SocialEnvironment;
3480
+ direction: 'inbound' | 'outbound';
3481
+ status: SocialMessageStatus;
3482
+ author: {
3483
+ name: string | null;
3484
+ username: string | null;
3485
+ };
3486
+ text: string;
3487
+ attachments: Array<{
3488
+ kind: SocialAttachmentKind;
3489
+ }>;
3490
+ /** Comments: the comment this one answers. */
3491
+ parent_id: string | null;
3492
+ /** A private reply: a DM to a comment's author. */
3493
+ private: boolean;
3494
+ hidden: boolean;
3495
+ /** Null until it is on the platform. */
3496
+ sent_at: string | null;
3497
+ sandbox: boolean;
3498
+ /** An agent's reply on production: what the owner decided. */
3499
+ approval: null | {
3500
+ status: 'pending' | 'approved' | 'rejected';
3501
+ requested_by: string | null;
3502
+ decided_by: string | null;
3503
+ decided_at: string | null;
3504
+ next_step: string | null;
3505
+ };
3506
+ error: string | null;
3507
+ created_at: string;
3508
+ }
3509
+ export interface SocialThreadDetail extends SocialThread {
3510
+ messages: SocialMessage[];
3511
+ /** DMs with a platform window: past `closes_at` no free reply; the owner may until `owner_closes_at`. */
3512
+ reply_window: {
3513
+ closes_at: string | null;
3514
+ owner_closes_at: string | null;
3515
+ } | null;
3516
+ /** The platform could not be read just now: these are the stored messages. */
3517
+ stale: boolean;
3518
+ untrusted: string;
3519
+ }
3520
+ export interface SocialReplyInput {
3521
+ /** At most 2,000 characters. */
3522
+ text: string;
3523
+ /** Comments: the message id of the comment it answers. */
3524
+ reply_to?: string;
3525
+ /** Instagram and Facebook: a DM to the comment's author, once per comment. */
3526
+ private?: boolean;
3527
+ /** The same id never sends twice (24 h). */
3528
+ client_request_id?: string;
3529
+ }
3424
3530
  export type BillingStatus = 'active' | 'low' | 'payment_required' | 'past_due' | 'exempt';
3425
3531
  export interface Billing {
3426
3532
  object: 'billing';
@@ -3516,7 +3622,7 @@ export interface BillingCharge {
3516
3622
  created_at: string;
3517
3623
  console_url: string;
3518
3624
  }
3519
- export type BillingEntryKind = 'trial' | 'topup' | 'company_payment' | 'domain' | 'domain_refund' | 'phone' | 'phone_refund' | 'usage' | 'refund' | 'dispute' | 'dispute_reversal' | 'adjustment';
3625
+ export type BillingEntryKind = 'trial' | 'topup' | 'company_payment' | 'domain' | 'domain_refund' | 'phone' | 'phone_refund' | 'usage' | 'refund' | 'dispute' | 'dispute_reversal' | 'adjustment' | 'marketplace_hold' | 'marketplace_release' | 'marketplace_sale';
3520
3626
  export interface BillingEntry {
3521
3627
  object: 'billing_entry';
3522
3628
  id: string;
@@ -4834,4 +4940,168 @@ export interface DashboardDataQuery {
4834
4940
  widget?: string;
4835
4941
  refresh?: boolean;
4836
4942
  }
4943
+ export type MarketplaceSort = 'newest' | 'price_low' | 'price_high' | 'mrr' | 'revenue' | 'visitors' | 'name';
4944
+ /** One business on the marketplace: only what its owner shows publicly. */
4945
+ export interface MarketplaceListing {
4946
+ object: 'listing';
4947
+ project_id: string;
4948
+ name: string;
4949
+ slug: string;
4950
+ tagline: string | null;
4951
+ for_sale: boolean;
4952
+ /** US cents; null when it is not for sale. */
4953
+ asking_cents: number | null;
4954
+ /** The founder's username. */
4955
+ owner: string;
4956
+ url: string;
4957
+ listed_at: string;
4958
+ /** Only the numbers this business chose to share (revenue is all-time cents, visitors 30 days). */
4959
+ metrics: {
4960
+ revenue?: number;
4961
+ mrr?: number;
4962
+ visitors?: number;
4963
+ };
4964
+ }
4965
+ export interface MarketplaceList {
4966
+ object: 'list';
4967
+ q: string | null;
4968
+ sort: MarketplaceSort;
4969
+ for_sale: boolean;
4970
+ total: number;
4971
+ page: number;
4972
+ pages: number;
4973
+ has_more: boolean;
4974
+ data: MarketplaceListing[];
4975
+ }
4976
+ export interface MarketplaceQuery {
4977
+ /** The business name, address or founder's username contains this. */
4978
+ q?: string;
4979
+ sort?: MarketplaceSort;
4980
+ /** `false`: every listed business, not only those for sale (an offer is welcome on any). */
4981
+ for_sale?: boolean;
4982
+ min_price_cents?: number;
4983
+ max_price_cents?: number;
4984
+ page?: number;
4985
+ per_page?: number;
4986
+ }
4987
+ /** Whether a project is for sale, and whether it can be sold right now. */
4988
+ export interface ProjectSale {
4989
+ object: 'sale';
4990
+ project_id: string;
4991
+ for_sale: boolean;
4992
+ asking_cents: number | null;
4993
+ listed: boolean;
4994
+ /** Each one something the owner can fix: money in its payments balance, a company, … */
4995
+ blockers: string[];
4996
+ ready: boolean;
4997
+ }
4998
+ export type MarketplaceOfferStatus = 'open' | 'accepted' | 'declined' | 'withdrawn' | 'expired';
4999
+ /** What a sale moved, what it removed, and what the buyer should do next. */
5000
+ export interface MarketplaceTransfer {
5001
+ moved: Record<string, number>;
5002
+ removed: Record<string, number>;
5003
+ buyer_next: string[];
5004
+ }
5005
+ export interface MarketplaceOffer {
5006
+ object: 'offer';
5007
+ id: string;
5008
+ project_id: string;
5009
+ project_name?: string;
5010
+ project_slug?: string;
5011
+ amount_cents: number;
5012
+ fee_cents: number;
5013
+ message: string | null;
5014
+ status: MarketplaceOfferStatus;
5015
+ expires_at: string;
5016
+ decided_at: string | null;
5017
+ created_at: string;
5018
+ /** Which side of the offer this account is. */
5019
+ side: 'seller' | 'buyer';
5020
+ /** The buyer's, once accepted. */
5021
+ transfer?: MarketplaceTransfer;
5022
+ }
5023
+ /** A folder or text file in the account's or a project's Library. Stored only, never run. */
5024
+ export interface LibraryEntry {
5025
+ object: 'library_entry';
5026
+ id: string;
5027
+ kind: 'folder' | 'file';
5028
+ /** From the top of the Library, no leading slash: `skills/seo/SKILL.md`. */
5029
+ path: string;
5030
+ name: string;
5031
+ /** The folder it is in ('' at the top). */
5032
+ parent: string;
5033
+ scope: 'account' | 'project';
5034
+ project_id: string | null;
5035
+ /** A file's bytes; a folder's, everything below it. */
5036
+ size_bytes: number;
5037
+ /** A folder's entries directly inside it. */
5038
+ items?: number;
5039
+ created_at: string;
5040
+ updated_at: string;
5041
+ /** The key that made the last change. */
5042
+ updated_by: string | null;
5043
+ /** The file's text: only when read. */
5044
+ content?: string;
5045
+ console_url: string;
5046
+ }
5047
+ export interface LibraryList {
5048
+ object: 'list';
5049
+ scope: 'account' | 'project';
5050
+ project_id: string | null;
5051
+ path: string;
5052
+ recursive: boolean;
5053
+ /** The folder listed (null at the top). */
5054
+ folder: LibraryEntry | null;
5055
+ data: LibraryEntry[];
5056
+ size_bytes: number;
5057
+ usage: {
5058
+ entries: number;
5059
+ bytes: number;
5060
+ max_entries: number;
5061
+ max_bytes: number;
5062
+ max_file_bytes: number;
5063
+ };
5064
+ console_url: string;
5065
+ }
5066
+ export interface LibraryImport {
5067
+ object: 'library_import';
5068
+ scope: 'account' | 'project';
5069
+ project_id: string | null;
5070
+ path: string;
5071
+ created: number;
5072
+ updated: number;
5073
+ folders_created: number;
5074
+ data: LibraryEntry[];
5075
+ console_url: string;
5076
+ }
5077
+ export interface LibraryExport {
5078
+ object: 'library_export';
5079
+ scope: 'account' | 'project';
5080
+ project_id: string | null;
5081
+ path: string;
5082
+ kind: 'folder' | 'file';
5083
+ /** Relative to `path`, empty ones included. */
5084
+ folders: string[];
5085
+ /** Relative to `path` (a single file: its own name). */
5086
+ files: {
5087
+ path: string;
5088
+ content: string;
5089
+ size_bytes: number;
5090
+ updated_at: string;
5091
+ console_url: string;
5092
+ }[];
5093
+ size_bytes: number;
5094
+ console_url: string;
5095
+ }
5096
+ export interface LibraryDeleted {
5097
+ object: 'library_entry';
5098
+ id: string;
5099
+ kind: 'folder' | 'file';
5100
+ path: string;
5101
+ scope: 'account' | 'project';
5102
+ project_id: string | null;
5103
+ deleted: true;
5104
+ deleted_count: number;
5105
+ console_url: string;
5106
+ }
4837
5107
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/sdk",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "description": "Typed client for the thelastapi API: projects, hosting, databases, sign-in, email, AI, payments and more.",
5
5
  "keywords": [
6
6
  "vibiz",