@agentforge-io/sdk-server 4.48.0 → 4.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
5
5
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
6
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
6
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,10 +1,19 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput } from '../types';
2
+ import type { CaseClosingReport, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput } from '../types';
3
3
  export declare class CasesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
6
6
  /** `GET /api/v1/cases` — most recently active first. */
7
7
  list(input?: ListCasesInput): Promise<CaseView[]>;
8
+ /**
9
+ * `GET /api/v1/cases/reports/closing` — AGF-CASH-REGISTER: a closing between two
10
+ * instants, (`from`, `to`], so consecutive closings never count a payment twice
11
+ * nor miss one. 400 on a bad range; at most 400 days.
12
+ */
13
+ closingReport(input: {
14
+ from: string | Date;
15
+ to: string | Date;
16
+ }): Promise<CaseClosingReport>;
8
17
  /** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
9
18
  get(caseId: string): Promise<CaseView>;
10
19
  /**
@@ -71,11 +80,13 @@ export declare class CasesResource {
71
80
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
72
81
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
73
82
  * `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
83
+ * `accountId` with `paid`: how the money came in, one of the business's accounts.
74
84
  * The customer is told of paid, rejected and refunds.
75
85
  */
76
86
  setPayment(caseId: string, status: CasePaymentStatus, opts?: {
77
87
  note?: string;
78
88
  amountCents?: number;
89
+ accountId?: string;
79
90
  }): Promise<CaseView>;
80
91
  /**
81
92
  * `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
@@ -32,6 +32,16 @@ class CasesResource {
32
32
  const q = qs.toString();
33
33
  return (await this.client.request('GET', `/api/v1/cases${q ? `?${q}` : ''}`)).items;
34
34
  }
35
+ /**
36
+ * `GET /api/v1/cases/reports/closing` — AGF-CASH-REGISTER: a closing between two
37
+ * instants, (`from`, `to`], so consecutive closings never count a payment twice
38
+ * nor miss one. 400 on a bad range; at most 400 days.
39
+ */
40
+ async closingReport(input) {
41
+ const at = (v) => (v instanceof Date ? v.toISOString() : v);
42
+ const qs = new URLSearchParams({ from: at(input.from), to: at(input.to) });
43
+ return this.client.request('GET', `/api/v1/cases/reports/closing?${qs}`);
44
+ }
35
45
  /** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
36
46
  async get(caseId) {
37
47
  return this.client.request('GET', `/api/v1/cases/${encodeURIComponent(caseId)}`);
@@ -118,6 +128,7 @@ class CasesResource {
118
128
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
119
129
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
120
130
  * `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
131
+ * `accountId` with `paid`: how the money came in, one of the business's accounts.
121
132
  * The customer is told of paid, rejected and refunds.
122
133
  */
123
134
  async setPayment(caseId, status, opts = {}) {
@@ -125,6 +136,7 @@ class CasesResource {
125
136
  status,
126
137
  ...(opts.note ? { note: opts.note } : {}),
127
138
  ...(opts.amountCents ? { amountCents: opts.amountCents } : {}),
139
+ ...(opts.accountId ? { accountId: opts.accountId } : {}),
128
140
  });
129
141
  }
130
142
  /**
package/dist/types.d.ts CHANGED
@@ -1184,7 +1184,10 @@ export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductI
1184
1184
  export interface CatalogBookingRule {
1185
1185
  durationMinutes: number;
1186
1186
  bufferMinutes?: number;
1187
+ /** AGF-DELIVERY D0 — where it is performed; left out: at the business. */
1188
+ attendedAt?: CatalogAttendedAt;
1187
1189
  }
1190
+ export type CatalogAttendedAt = 'business' | 'customer' | 'both';
1188
1191
  /** AGF-UNITS U2 — how a product is sold. */
1189
1192
  export interface CatalogSaleRule {
1190
1193
  by: 'unit' | 'measure';
@@ -1808,6 +1811,10 @@ export interface PlacesScope {
1808
1811
  national: boolean;
1809
1812
  /** A customer may search outside the area (`area: 'country'`). */
1810
1813
  canWiden: boolean;
1814
+ /** A customer may pick the order up at the business. */
1815
+ pickup: boolean;
1816
+ /** It has delivery settings: without them, `local`, `national` and `pickup` say nothing about what it offers. */
1817
+ configured: boolean;
1811
1818
  }
1812
1819
  /** A geocoded address: a confirmed pin, never static text. */
1813
1820
  export interface AddressValue {
@@ -2036,6 +2043,22 @@ export interface CaseStateStep {
2036
2043
  /** Who moved it; null when only the case itself tells (older cases, a move just made). */
2037
2044
  by: 'assistant' | 'business' | 'system' | 'customer' | null;
2038
2045
  }
2046
+ /**
2047
+ * AGF-DELIVERY D0 — where an order is taken or a service performed. `lat`/`lng` are
2048
+ * null for an address nobody located. `quote` is what the delivery costs the
2049
+ * customer: the receipt shows it apart and adds it to the total (`CaseReceipt.delivery`).
2050
+ */
2051
+ export interface CaseDestination {
2052
+ address: string;
2053
+ lat?: number | null;
2054
+ lng?: number | null;
2055
+ placeId?: string;
2056
+ distanceKm?: number;
2057
+ quote?: {
2058
+ feeCents: number;
2059
+ currency: string;
2060
+ };
2061
+ }
2039
2062
  export interface CaseView {
2040
2063
  id: string;
2041
2064
  /** Per workspace, sequential (ordering). People read `code`. */
@@ -2107,6 +2130,8 @@ export interface CaseView {
2107
2130
  slot: (CaseSlot & {
2108
2131
  label: string;
2109
2132
  }) | null;
2133
+ /** AGF-DELIVERY D0 — where it is taken or performed (absent on an older platform). */
2134
+ destination?: CaseDestination | null;
2110
2135
  openedAt: string;
2111
2136
  reviewedAt: string | null;
2112
2137
  submittedAt: string | null;
@@ -2251,6 +2276,11 @@ export interface CaseReceipt {
2251
2276
  issuedAt: string;
2252
2277
  lines: CaseReceiptLine[];
2253
2278
  /** Σ of the lines; null when a line has no fixed price or there are no lines. */
2279
+ /** The delivery the total includes (0: free); absent when there is none. */
2280
+ delivery?: {
2281
+ feeCents: number;
2282
+ distanceKm?: number;
2283
+ };
2254
2284
  totalCents: number | null;
2255
2285
  currency: string | null;
2256
2286
  fields: Array<{
@@ -2356,6 +2386,8 @@ export interface CreateDirectOrderInput {
2356
2386
  accountId: string;
2357
2387
  cashTenderedCents?: number;
2358
2388
  };
2389
+ /** AGF-DELIVERY D0 — where it is taken, set by your server. Not with `place`. */
2390
+ destination?: CaseDestination;
2359
2391
  }
2360
2392
  /** A payment method a checkout offers (no account data — that is on the receipt once the order is sent). */
2361
2393
  export interface DirectPaymentOption {
@@ -2388,6 +2420,113 @@ export interface DirectOrderForm {
2388
2420
  options: DirectPaymentOption[];
2389
2421
  };
2390
2422
  }
2423
+ /** AGF-CASH-REGISTER — one payment method in a closing. */
2424
+ export interface CaseClosingMethod {
2425
+ /** The method's key; null when the payment has no account. */
2426
+ method: string | null;
2427
+ methodName: string;
2428
+ /** Paid before it is sent, or on delivery; null when the payment has no account. */
2429
+ when: 'before' | 'on_delivery' | null;
2430
+ /** Payments confirmed in the range. */
2431
+ count: number;
2432
+ collectedCents: number;
2433
+ refundedCents: number;
2434
+ netCents: number;
2435
+ }
2436
+ /** AGF-CASH-REGISTER — one order sent in a closing's range. */
2437
+ export interface CaseClosingOrder {
2438
+ code: string;
2439
+ submittedAt: string;
2440
+ customerFirstName: string | null;
2441
+ place: string | null;
2442
+ channel: CaseOriginChannel | null;
2443
+ method: string | null;
2444
+ paymentStatus: CasePaymentStatus | null;
2445
+ totalCents: number | null;
2446
+ deliveryCents: number;
2447
+ state: string;
2448
+ stateLabel: string;
2449
+ }
2450
+ /**
2451
+ * AGF-CASH-REGISTER — a register's closing between two instants, (`from`, `to`]:
2452
+ * `sold` by when the order was sent, without deliveries; `collected` by when each
2453
+ * payment moved, with them. Two numbers on purpose.
2454
+ */
2455
+ export interface CaseClosingReport {
2456
+ from: string;
2457
+ to: string;
2458
+ timeZone: string;
2459
+ currency: string | null;
2460
+ sold: {
2461
+ orders: {
2462
+ total: number;
2463
+ completed: number;
2464
+ inProgress: number;
2465
+ cancelled: number;
2466
+ };
2467
+ revenueCents: {
2468
+ completed: number;
2469
+ inProgress: number;
2470
+ };
2471
+ deliveryCents: {
2472
+ completed: number;
2473
+ inProgress: number;
2474
+ };
2475
+ averageTicketCents: number | null;
2476
+ /** Orders whose total is not known (a line priced on request). */
2477
+ unpricedOrders: number;
2478
+ topProducts: Array<{
2479
+ title: string;
2480
+ qty: number;
2481
+ revenueCents: number | null;
2482
+ }>;
2483
+ /** Absent when no order carries a place. */
2484
+ byPlace?: Array<{
2485
+ place: string | null;
2486
+ orders: number;
2487
+ revenueCents: number;
2488
+ }>;
2489
+ byChannel: Array<{
2490
+ channel: CaseOriginChannel | null;
2491
+ label: string | null;
2492
+ orders: number;
2493
+ revenueCents: number;
2494
+ }>;
2495
+ };
2496
+ collected: {
2497
+ byMethod: CaseClosingMethod[];
2498
+ collectedCents: number;
2499
+ refundedCents: number;
2500
+ netCents: number;
2501
+ /** Payments confirmed whose order has no known total: in no sum. */
2502
+ unpricedPayments: number;
2503
+ };
2504
+ /** The cash the register should have received, for the count. */
2505
+ cash: {
2506
+ collectedCents: number;
2507
+ refundedCents: number;
2508
+ netCents: number;
2509
+ };
2510
+ /** As of now, whenever those orders were sent: what the next closing inherits. */
2511
+ pending: {
2512
+ toCollect: {
2513
+ count: number;
2514
+ cents: number;
2515
+ };
2516
+ reported: {
2517
+ count: number;
2518
+ cents: number;
2519
+ };
2520
+ refundDue: {
2521
+ count: number;
2522
+ cents: number;
2523
+ };
2524
+ inProgress: number;
2525
+ };
2526
+ /** Oldest first, at most 2000 (`ordersTruncated`); the sums always cover every order. */
2527
+ orders: CaseClosingOrder[];
2528
+ ordersTruncated: boolean;
2529
+ }
2391
2530
  export interface ListCasesInput {
2392
2531
  state?: CaseState[];
2393
2532
  type?: string;
@@ -2446,6 +2585,8 @@ export interface CreateDirectBookingInput {
2446
2585
  conversationId?: string;
2447
2586
  /** Same key → same booking. 8–80 of [A-Za-z0-9_.:-]. */
2448
2587
  idempotencyKey: string;
2588
+ /** AGF-DELIVERY D0 — where it is performed: required for a service `attendedAt: 'customer'`, refused for one at the business. */
2589
+ destination?: CaseDestination;
2449
2590
  }
2450
2591
  /** `POST /api/v1/cases/:id/slot` — the new time (you already hold it), optionally another member. */
2451
2592
  export interface MoveCaseSlotInput {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.48.0",
3
+ "version": "4.50.0",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",