@agentforge-io/sdk-server 4.43.0 → 4.44.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, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, 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, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogBookingRule, DirectOrderForm, 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,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectOrderInput, DirectOrderForm, ListCasesInput } from '../types';
2
+ import type { 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);
@@ -49,6 +49,24 @@ export declare class CasesResource {
49
49
  * 400 for a bad order or missing fields, 409 when a product lacks stock.
50
50
  */
51
51
  createDirect(input: CreateDirectOrderInput): Promise<CaseView>;
52
+ /**
53
+ * `POST /api/v1/cases/bookings` — AGF-AGENDA: a booking from your App's agenda
54
+ * (hold the time in your own ledger first). Created sent (`submitted`), or
55
+ * `accepted` at once with `confirmation: 'instant'`, with receipt and events like
56
+ * a direct order. 400 when the service is not bookable or the span is not its
57
+ * duration. A retried `idempotencyKey` returns the same booking.
58
+ */
59
+ createDirectBooking(input: CreateDirectBookingInput): Promise<CaseView>;
60
+ /**
61
+ * `POST /api/v1/cases/:id/assign` — AGF-AGENDA: who of the business attends any
62
+ * open request (your member reference), or null to leave it unassigned.
63
+ * `memberName` updates a booking's «Profesional».
64
+ */
65
+ assign(caseId: string, assigneeRef: string | null, opts?: {
66
+ memberName?: string;
67
+ }): Promise<CaseView>;
68
+ /** `POST /api/v1/cases/:id/slot` — AGF-AGENDA: moves a booking to a time you already hold. */
69
+ updateSlot(caseId: string, input: MoveCaseSlotInput): Promise<CaseView>;
52
70
  /**
53
71
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
54
72
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
@@ -22,6 +22,13 @@ class CasesResource {
22
22
  qs.set('since', input.since instanceof Date ? input.since.toISOString() : input.since);
23
23
  if (input.limit !== undefined)
24
24
  qs.set('limit', String(input.limit));
25
+ const at = (v) => (v instanceof Date ? v.toISOString() : v);
26
+ if (input.slotFrom)
27
+ qs.set('slotFrom', at(input.slotFrom));
28
+ if (input.slotTo)
29
+ qs.set('slotTo', at(input.slotTo));
30
+ if (input.assignee)
31
+ qs.set('assignee', input.assignee);
25
32
  const q = qs.toString();
26
33
  return (await this.client.request('GET', `/api/v1/cases${q ? `?${q}` : ''}`)).items;
27
34
  }
@@ -82,6 +89,31 @@ class CasesResource {
82
89
  async createDirect(input) {
83
90
  return this.client.request('POST', '/api/v1/cases/direct', input);
84
91
  }
92
+ /**
93
+ * `POST /api/v1/cases/bookings` — AGF-AGENDA: a booking from your App's agenda
94
+ * (hold the time in your own ledger first). Created sent (`submitted`), or
95
+ * `accepted` at once with `confirmation: 'instant'`, with receipt and events like
96
+ * a direct order. 400 when the service is not bookable or the span is not its
97
+ * duration. A retried `idempotencyKey` returns the same booking.
98
+ */
99
+ async createDirectBooking(input) {
100
+ return this.client.request('POST', '/api/v1/cases/bookings', input);
101
+ }
102
+ /**
103
+ * `POST /api/v1/cases/:id/assign` — AGF-AGENDA: who of the business attends any
104
+ * open request (your member reference), or null to leave it unassigned.
105
+ * `memberName` updates a booking's «Profesional».
106
+ */
107
+ async assign(caseId, assigneeRef, opts = {}) {
108
+ return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/assign`, {
109
+ assigneeRef,
110
+ ...(opts.memberName ? { memberName: opts.memberName } : {}),
111
+ });
112
+ }
113
+ /** `POST /api/v1/cases/:id/slot` — AGF-AGENDA: moves a booking to a time you already hold. */
114
+ async updateSlot(caseId, input) {
115
+ return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/slot`, input);
116
+ }
85
117
  /**
86
118
  * `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
87
119
  * payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
package/dist/types.d.ts CHANGED
@@ -802,6 +802,13 @@ export type TeamProfileBlock = {
802
802
  kind: 'catalog';
803
803
  catalogId: string;
804
804
  [field: string]: unknown;
805
+ }
806
+ /** AGF-AGENDA — the business's agenda: free times of its bookable services (the host computes them). */
807
+ | {
808
+ kind: 'agenda';
809
+ serviceIds?: string[];
810
+ customerPicksMember?: boolean;
811
+ layout?: 'chips' | 'list';
805
812
  });
806
813
  /** `GET /api/v1/teams/:id` — the team with its page settings, and its members. */
807
814
  export interface TeamDetail {
@@ -874,6 +881,9 @@ export interface TemplateSummary {
874
881
  * ask the owner for products (`af.catalog`) instead of a product field.
875
882
  * Absent on platforms older than the field: treat as `false`. */
876
883
  usesCatalog?: boolean;
884
+ /** AGF-AGENDA — the template books times (an enabled `agenda` block or a case type marked
885
+ * `booking`); the host should give the business an agenda. Always derived. Absent on older platforms: `false`. */
886
+ usesAgenda?: boolean;
877
887
  installsCount: number;
878
888
  /** AGF-PDK-TEMPLATE-PAGE. Average of the visible reviews (one decimal),
879
889
  * null with none. Absent on platforms older than reviews. */
@@ -1118,6 +1128,8 @@ export interface CatalogProduct {
1118
1128
  /** AGF-UNITS U2 — how it is sold; null = by unit. Sold by measure, `stock` counts the unit
1119
1129
  * kind's base (g, ml, cm): divide by the unit's `base` to read it in the product's unit. */
1120
1130
  saleRule?: CatalogSaleRule | null;
1131
+ /** AGF-AGENDA — a service's duration and buffer; null = not bookable. */
1132
+ booking?: CatalogBookingRule | null;
1121
1133
  lastSoldAt?: string | null;
1122
1134
  demandCount: number;
1123
1135
  createdAt: string;
@@ -1143,6 +1155,9 @@ export interface CreateCatalogProductInput {
1143
1155
  attributes?: Record<string, unknown>;
1144
1156
  availability?: CatalogAvailability | null;
1145
1157
  lockedFields?: CatalogLockableField[];
1158
+ /** AGF-AGENDA — a service's `{ durationMinutes, bufferMinutes? }`; null makes it not bookable.
1159
+ * Only `kind: 'service'` (400 NOT_A_SERVICE), 5–720 and 0–120 minutes (400 INVALID_BOOKING). */
1160
+ booking?: CatalogBookingRule | null;
1146
1161
  }
1147
1162
  export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductInput> {
1148
1163
  sortOrder?: number;
@@ -1152,6 +1167,11 @@ export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductI
1152
1167
  * Switching converts the stock; a measure needs a weight/volume/length/area/time unit. */
1153
1168
  saleRule?: CatalogSaleRule;
1154
1169
  }
1170
+ /** AGF-AGENDA — how long a bookable service takes, and the time after it before the next. */
1171
+ export interface CatalogBookingRule {
1172
+ durationMinutes: number;
1173
+ bufferMinutes?: number;
1174
+ }
1155
1175
  /** AGF-UNITS U2 — how a product is sold. */
1156
1176
  export interface CatalogSaleRule {
1157
1177
  by: 'unit' | 'measure';
@@ -1993,7 +2013,8 @@ export interface CaseType {
1993
2013
  * `submitted` (with the business) → `accepted` → the type's business states →
1994
2014
  * `completed` | `cancelled` | `rejected` | `abandoned`.
1995
2015
  */
1996
- export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | (string & {});
2016
+ /** `no_show`: a booking whose customer did not come (AGF-AGENDA-LIFECYCLE). */
2017
+ export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | 'no_show' | (string & {});
1997
2018
  export interface CaseView {
1998
2019
  id: string;
1999
2020
  /** Per workspace, sequential (ordering). People read `code`. */
@@ -2055,6 +2076,12 @@ export interface CaseView {
2055
2076
  } | null;
2056
2077
  /** AGF-PAYMENT-ACCOUNTS — how it is paid: null before the business took it (or closed undone with nothing chosen). */
2057
2078
  payment: CasePayment | null;
2079
+ /** AGF-AGENDA — who of the business attends it: your member reference (set with `cases.assign`). */
2080
+ assigneeRef: string | null;
2081
+ /** AGF-AGENDA — the time a booking holds, and how it reads («lunes, 9 de noviembre, 10:00–10:45»). */
2082
+ slot: (CaseSlot & {
2083
+ label: string;
2084
+ }) | null;
2058
2085
  openedAt: string;
2059
2086
  reviewedAt: string | null;
2060
2087
  submittedAt: string | null;
@@ -2270,6 +2297,64 @@ export interface ListCasesInput {
2270
2297
  since?: string | Date;
2271
2298
  /** 1–200, default 50. */
2272
2299
  limit?: number;
2300
+ /** AGF-AGENDA — bookings whose time starts in [slotFrom, slotTo), earliest first. */
2301
+ slotFrom?: string | Date;
2302
+ slotTo?: string | Date;
2303
+ /** AGF-AGENDA — one member's requests (your reference), or `none` for unassigned ones. */
2304
+ assignee?: string;
2305
+ }
2306
+ /** The time a booking holds (a snapshot: your App's agenda decides what is free). */
2307
+ export interface CaseSlot {
2308
+ /** ISO instants. */
2309
+ startsAt: string;
2310
+ endsAt: string;
2311
+ /** IANA zone the business reads it in. */
2312
+ timezone: string;
2313
+ serviceId?: string;
2314
+ serviceName?: string;
2315
+ /** Who attends, as you named them when you booked. */
2316
+ memberName?: string;
2317
+ }
2318
+ /**
2319
+ * `POST /api/v1/cases/bookings` — a booking from your App's agenda. Reserve the
2320
+ * time in your own ledger first; the platform checks the service is a bookable
2321
+ * one of the business (`booking.durationMinutes`) and that the span is exactly
2322
+ * that duration.
2323
+ */
2324
+ export interface CreateDirectBookingInput {
2325
+ customer: {
2326
+ ref: string;
2327
+ name: string;
2328
+ phone: string;
2329
+ };
2330
+ /** A catalog service of the business with a `booking` rule. */
2331
+ serviceId: string;
2332
+ /** ISO instants with their offset (Z or ±hh:mm). */
2333
+ startsAt: string;
2334
+ endsAt: string;
2335
+ /** IANA zone (the business's opening hours' zone). */
2336
+ timezone: string;
2337
+ /** Your member reference of who attends, and their name for the request («Profesional»). */
2338
+ assigneeRef?: string;
2339
+ assigneeName?: string;
2340
+ /** `review` (default): the business accepts it; `instant`: accepted as booked. */
2341
+ confirmation?: 'review' | 'instant';
2342
+ /** The booking type's other fields (notas…), by key. */
2343
+ fields?: Record<string, unknown>;
2344
+ /** The team's booking type; default: its first type marked `booking`, else the built-in «cita». */
2345
+ type?: string;
2346
+ /** The customer's chat conversation, when booked from the chat. */
2347
+ conversationId?: string;
2348
+ /** Same key → same booking. 8–80 of [A-Za-z0-9_.:-]. */
2349
+ idempotencyKey: string;
2350
+ }
2351
+ /** `POST /api/v1/cases/:id/slot` — the new time (you already hold it), optionally another member. */
2352
+ export interface MoveCaseSlotInput {
2353
+ startsAt: string;
2354
+ endsAt: string;
2355
+ timezone?: string;
2356
+ assigneeRef?: string | null;
2357
+ assigneeName?: string;
2273
2358
  }
2274
2359
  export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed';
2275
2360
  export interface AppWebhook {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.43.0",
3
+ "version": "4.44.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",