@agentforge-io/sdk-server 4.49.0 → 4.51.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, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, 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, DeliveryRoute, DeliveryRouteInput, 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
  /**
@@ -57,6 +66,13 @@ export declare class CasesResource {
57
66
  * duration. A retried `idempotencyKey` returns the same booking.
58
67
  */
59
68
  createDirectBooking(input: CreateDirectBookingInput): Promise<CaseView>;
69
+ /**
70
+ * `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
71
+ * conversation's channel. The same `key` never says it twice.
72
+ */
73
+ notice(caseId: string, text: string, key: string): Promise<{
74
+ result: string;
75
+ }>;
60
76
  /**
61
77
  * `POST /api/v1/cases/:id/assign` — AGF-AGENDA: who of the business attends any
62
78
  * open request (your member reference), or null to leave it unassigned.
@@ -71,11 +87,13 @@ export declare class CasesResource {
71
87
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
72
88
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
73
89
  * `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
90
+ * `accountId` with `paid`: how the money came in, one of the business's accounts.
74
91
  * The customer is told of paid, rejected and refunds.
75
92
  */
76
93
  setPayment(caseId: string, status: CasePaymentStatus, opts?: {
77
94
  note?: string;
78
95
  amountCents?: number;
96
+ accountId?: string;
79
97
  }): Promise<CaseView>;
80
98
  /**
81
99
  * `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)}`);
@@ -99,6 +109,13 @@ class CasesResource {
99
109
  async createDirectBooking(input) {
100
110
  return this.client.request('POST', '/api/v1/cases/bookings', input);
101
111
  }
112
+ /**
113
+ * `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
114
+ * conversation's channel. The same `key` never says it twice.
115
+ */
116
+ async notice(caseId, text, key) {
117
+ return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/notice`, { text, key });
118
+ }
102
119
  /**
103
120
  * `POST /api/v1/cases/:id/assign` — AGF-AGENDA: who of the business attends any
104
121
  * open request (your member reference), or null to leave it unassigned.
@@ -118,6 +135,7 @@ class CasesResource {
118
135
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
119
136
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
120
137
  * `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
138
+ * `accountId` with `paid`: how the money came in, one of the business's accounts.
121
139
  * The customer is told of paid, rejected and refunds.
122
140
  */
123
141
  async setPayment(caseId, status, opts = {}) {
@@ -125,6 +143,7 @@ class CasesResource {
125
143
  status,
126
144
  ...(opts.note ? { note: opts.note } : {}),
127
145
  ...(opts.amountCents ? { amountCents: opts.amountCents } : {}),
146
+ ...(opts.accountId ? { accountId: opts.accountId } : {}),
128
147
  });
129
148
  }
130
149
  /**
@@ -1,8 +1,14 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { DeliveryQuote, DeliveryQuoteInput } from '../types';
2
+ import type { DeliveryQuote, DeliveryQuoteInput, DeliveryRoute, DeliveryRouteInput } from '../types';
3
3
  export declare class DeliveryResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
6
6
  /** `POST /api/v1/delivery/quote` — 404 when the workspace has no delivery settings. */
7
7
  quote(input: DeliveryQuoteInput): Promise<DeliveryQuote>;
8
+ /**
9
+ * `POST /api/v1/delivery/route` — the road through some stops, from `from` (else the
10
+ * business), to draw on a Google map (Google's terms bar other maps). Google orders the
11
+ * stops in between. `route` is null when there is no road.
12
+ */
13
+ route(input: DeliveryRouteInput): Promise<DeliveryRoute>;
8
14
  }
@@ -12,5 +12,13 @@ class DeliveryResource {
12
12
  async quote(input) {
13
13
  return this.client.request('POST', '/api/v1/delivery/quote', input);
14
14
  }
15
+ /**
16
+ * `POST /api/v1/delivery/route` — the road through some stops, from `from` (else the
17
+ * business), to draw on a Google map (Google's terms bar other maps). Google orders the
18
+ * stops in between. `route` is null when there is no road.
19
+ */
20
+ async route(input) {
21
+ return this.client.request('POST', '/api/v1/delivery/route', input);
22
+ }
15
23
  }
16
24
  exports.DeliveryResource = DeliveryResource;
package/dist/types.d.ts CHANGED
@@ -1811,6 +1811,10 @@ export interface PlacesScope {
1811
1811
  national: boolean;
1812
1812
  /** A customer may search outside the area (`area: 'country'`). */
1813
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;
1814
1818
  }
1815
1819
  /** A geocoded address: a confirmed pin, never static text. */
1816
1820
  export interface AddressValue {
@@ -1961,6 +1965,35 @@ export type StructuredConfigEntry = ({
1961
1965
  updatedAt: string;
1962
1966
  };
1963
1967
  export type DeliveryQuoteStatus = 'free' | 'paid' | 'national' | 'pickup_only' | 'out_of_coverage' | 'no_delivery' | 'needs_confirmation';
1968
+ export interface DeliveryRouteInput {
1969
+ /** Where the courier is now; default: the business. */
1970
+ from?: {
1971
+ lat: number;
1972
+ lng: number;
1973
+ };
1974
+ stops: Array<{
1975
+ lat: number;
1976
+ lng: number;
1977
+ }>;
1978
+ }
1979
+ /** The road through some stops. `order`: the stops' indexes as driven; `legs` the same way. */
1980
+ export interface DeliveryRoute {
1981
+ origin: {
1982
+ lat: number;
1983
+ lng: number;
1984
+ formatted: string;
1985
+ } | null;
1986
+ route: {
1987
+ distanceMeters: number;
1988
+ durationSeconds: number;
1989
+ polyline: string;
1990
+ order: number[];
1991
+ legs: Array<{
1992
+ distanceMeters: number;
1993
+ durationSeconds: number;
1994
+ }>;
1995
+ } | null;
1996
+ }
1964
1997
  export interface DeliveryQuoteInput {
1965
1998
  /** What the customer typed… */
1966
1999
  address?: string;
@@ -2416,6 +2449,113 @@ export interface DirectOrderForm {
2416
2449
  options: DirectPaymentOption[];
2417
2450
  };
2418
2451
  }
2452
+ /** AGF-CASH-REGISTER — one payment method in a closing. */
2453
+ export interface CaseClosingMethod {
2454
+ /** The method's key; null when the payment has no account. */
2455
+ method: string | null;
2456
+ methodName: string;
2457
+ /** Paid before it is sent, or on delivery; null when the payment has no account. */
2458
+ when: 'before' | 'on_delivery' | null;
2459
+ /** Payments confirmed in the range. */
2460
+ count: number;
2461
+ collectedCents: number;
2462
+ refundedCents: number;
2463
+ netCents: number;
2464
+ }
2465
+ /** AGF-CASH-REGISTER — one order sent in a closing's range. */
2466
+ export interface CaseClosingOrder {
2467
+ code: string;
2468
+ submittedAt: string;
2469
+ customerFirstName: string | null;
2470
+ place: string | null;
2471
+ channel: CaseOriginChannel | null;
2472
+ method: string | null;
2473
+ paymentStatus: CasePaymentStatus | null;
2474
+ totalCents: number | null;
2475
+ deliveryCents: number;
2476
+ state: string;
2477
+ stateLabel: string;
2478
+ }
2479
+ /**
2480
+ * AGF-CASH-REGISTER — a register's closing between two instants, (`from`, `to`]:
2481
+ * `sold` by when the order was sent, without deliveries; `collected` by when each
2482
+ * payment moved, with them. Two numbers on purpose.
2483
+ */
2484
+ export interface CaseClosingReport {
2485
+ from: string;
2486
+ to: string;
2487
+ timeZone: string;
2488
+ currency: string | null;
2489
+ sold: {
2490
+ orders: {
2491
+ total: number;
2492
+ completed: number;
2493
+ inProgress: number;
2494
+ cancelled: number;
2495
+ };
2496
+ revenueCents: {
2497
+ completed: number;
2498
+ inProgress: number;
2499
+ };
2500
+ deliveryCents: {
2501
+ completed: number;
2502
+ inProgress: number;
2503
+ };
2504
+ averageTicketCents: number | null;
2505
+ /** Orders whose total is not known (a line priced on request). */
2506
+ unpricedOrders: number;
2507
+ topProducts: Array<{
2508
+ title: string;
2509
+ qty: number;
2510
+ revenueCents: number | null;
2511
+ }>;
2512
+ /** Absent when no order carries a place. */
2513
+ byPlace?: Array<{
2514
+ place: string | null;
2515
+ orders: number;
2516
+ revenueCents: number;
2517
+ }>;
2518
+ byChannel: Array<{
2519
+ channel: CaseOriginChannel | null;
2520
+ label: string | null;
2521
+ orders: number;
2522
+ revenueCents: number;
2523
+ }>;
2524
+ };
2525
+ collected: {
2526
+ byMethod: CaseClosingMethod[];
2527
+ collectedCents: number;
2528
+ refundedCents: number;
2529
+ netCents: number;
2530
+ /** Payments confirmed whose order has no known total: in no sum. */
2531
+ unpricedPayments: number;
2532
+ };
2533
+ /** The cash the register should have received, for the count. */
2534
+ cash: {
2535
+ collectedCents: number;
2536
+ refundedCents: number;
2537
+ netCents: number;
2538
+ };
2539
+ /** As of now, whenever those orders were sent: what the next closing inherits. */
2540
+ pending: {
2541
+ toCollect: {
2542
+ count: number;
2543
+ cents: number;
2544
+ };
2545
+ reported: {
2546
+ count: number;
2547
+ cents: number;
2548
+ };
2549
+ refundDue: {
2550
+ count: number;
2551
+ cents: number;
2552
+ };
2553
+ inProgress: number;
2554
+ };
2555
+ /** Oldest first, at most 2000 (`ordersTruncated`); the sums always cover every order. */
2556
+ orders: CaseClosingOrder[];
2557
+ ordersTruncated: boolean;
2558
+ }
2419
2559
  export interface ListCasesInput {
2420
2560
  state?: CaseState[];
2421
2561
  type?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.49.0",
3
+ "version": "4.51.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",