@agentforge-io/sdk-server 4.85.0 → 4.87.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,12 +3,13 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, AgentForgeDuplicateContactError, AgentForgeBillingError, AGENTFORGE_BILLING_ERROR_CODES, AgentForgeCreditError, AGENTFORGE_CREDIT_ERROR_CODES, } from './errors';
4
4
  export type { AgentForgeBillingErrorCode, AgentForgeCreditErrorCode } from './errors';
5
5
  export { CreditResource, CreditAccountsResource } from './resources/credit';
6
+ export type { CreateDirectRentalInput, UpdateCaseRentalInput, CaseRental, RentalPeriodUnit } from './types';
6
7
  export type { CreditEntryKind, CreditAgingBucket, CreditAccountStatus, CreditEntry, CreditAllocation, CreditDebt, CreditAccount, CreditWriteResult, CreditStatementRow, CreditAccountListRow, CreditAccountsQuery, CreditAccountsPage, CreditStatementQuery, CreditStatement, UpdateCreditAccountInput, CreditPayInput, CreditReversePaymentInput, CreditWriteOffInput, CreditOpeningInput, CreditPayoutInput, } from './resources/credit';
7
8
  export { BillingResource } from './resources/billing';
8
9
  export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
9
10
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
10
11
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
11
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, 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, ThemedColor, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, CaseOffCatalogLine, CaseOffCatalogView, ConfirmCaseLineInput, CreateOffCatalogLineInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, 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, ReferenceMatchItemInput, ReferenceMatchDecisionKind, ReferenceMatchCandidate, ReferenceMatchDecision, ReferenceMatchInput, ReferenceMatchResult, ReferenceProductInput, ReferenceProductsBulkInput, ReferenceProductsBulkResult, ReferenceProduct, ListReferenceProductsInput, ReferenceProductPage, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
12
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, 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, ThemedColor, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, SetSystemAppProfileResult, SystemAppProfileView, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, CaseOffCatalogLine, CaseOffCatalogView, ConfirmCaseLineInput, CreateOffCatalogLineInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, 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, ReferenceMatchItemInput, ReferenceMatchDecisionKind, ReferenceMatchCandidate, ReferenceMatchDecision, ReferenceMatchInput, ReferenceMatchResult, ReferenceProductInput, ReferenceProductsBulkInput, ReferenceProductsBulkResult, ReferenceProduct, ListReferenceProductsInput, ReferenceProductPage, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
12
13
  export { AgentsResource } from './resources/agents';
13
14
  export { AnalyticsResource } from './resources/analytics';
14
15
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult } from '../types';
2
+ import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
3
3
  export declare class CasesResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -161,6 +161,7 @@ export declare class CasesResource {
161
161
  */
162
162
  directForm(opts?: {
163
163
  type?: string;
164
+ rental?: boolean;
164
165
  }): Promise<DirectOrderForm>;
165
166
  /**
166
167
  * `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
@@ -178,6 +179,24 @@ export declare class CasesResource {
178
179
  * duration. A retried `idempotencyKey` returns the same booking.
179
180
  */
180
181
  createDirectBooking(input: CreateDirectBookingInput): Promise<CaseView>;
182
+ /**
183
+ * `POST /api/v1/cases/direct-rental` — PDK-RENTAL-AVAILABILITY: an order of items rented over a time range (a machine
184
+ * Friday to Sunday). A direct order (holds, receipt, `case.submitted`, same errors) plus `rental`. The platform prices
185
+ * each line from the catalog — price of one period (options included) × units × `rental.periods.count` — and writes it on
186
+ * the receipt («2 × Retroexcavadora 320 × 3 días»); `CaseView.rental` carries the range. Hold the units in YOUR ledger
187
+ * first: the platform keeps what was rented, you own availability. Created `submitted`, or `confirmed` at once with
188
+ * `confirmation: 'instant'`. 400 for a bad range (end ≤ start, > 366 days, a count below what the range spans) or a
189
+ * line with `variantId`/`amountCents`; 409 when a product lacks stock. A retried `idempotencyKey` returns the same rental.
190
+ * R2d: `lines[].periodRateCents` (App sk_ key) prices a line with YOUR rate of one period instead of the catalog; still multiplied here.
191
+ */
192
+ createDirectRental(input: CreateDirectRentalInput): Promise<CaseView>;
193
+ /**
194
+ * `PATCH /api/v1/cases/:id/rental` — PDK-RENTAL-AVAILABILITY: reschedule or extend a rental you already moved in your
195
+ * ledger. Periods and prices are recomputed from the catalog and the receipt is re-issued (same link, revision + 1).
196
+ * Allowed after it is confirmed (an extension on site); 400 once it is closed or when the case is not a rental.
197
+ * R2d: `lines[].periodRateCents` re-prices a product (e.g. after changing `periods.unit` from `hora` to `dia`).
198
+ */
199
+ updateRental(caseId: string, input: UpdateCaseRentalInput): Promise<CaseView>;
181
200
  /**
182
201
  * `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
183
202
  * conversation's channel. The same `key` never says it twice.
@@ -28,6 +28,10 @@ class CasesResource {
28
28
  qs.set('slotFrom', at(input.slotFrom));
29
29
  if (input.slotTo)
30
30
  qs.set('slotTo', at(input.slotTo));
31
+ if (input.rentalFrom)
32
+ qs.set('rentalFrom', at(input.rentalFrom));
33
+ if (input.rentalTo)
34
+ qs.set('rentalTo', at(input.rentalTo));
31
35
  if (input.assignee)
32
36
  qs.set('assignee', input.assignee);
33
37
  if (input.contactId)
@@ -225,7 +229,14 @@ class CasesResource {
225
229
  * and the phone: the order type and its other fields (chips for a closed choice).
226
230
  */
227
231
  async directForm(opts = {}) {
228
- return this.client.request('GET', `/api/v1/cases/direct/form${opts.type ? `?type=${encodeURIComponent(opts.type)}` : ''}`);
232
+ const qs = new URLSearchParams();
233
+ if (opts.type)
234
+ qs.set('type', opts.type);
235
+ // PDK-RENTAL-AVAILABILITY: the form of a rental order's type («Reserva»).
236
+ if (opts.rental)
237
+ qs.set('rental', 'true');
238
+ const q = qs.toString();
239
+ return this.client.request('GET', `/api/v1/cases/direct/form${q ? `?${q}` : ''}`);
229
240
  }
230
241
  /**
231
242
  * `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
@@ -247,6 +258,28 @@ class CasesResource {
247
258
  async createDirectBooking(input) {
248
259
  return this.client.request('POST', '/api/v1/cases/bookings', input);
249
260
  }
261
+ /**
262
+ * `POST /api/v1/cases/direct-rental` — PDK-RENTAL-AVAILABILITY: an order of items rented over a time range (a machine
263
+ * Friday to Sunday). A direct order (holds, receipt, `case.submitted`, same errors) plus `rental`. The platform prices
264
+ * each line from the catalog — price of one period (options included) × units × `rental.periods.count` — and writes it on
265
+ * the receipt («2 × Retroexcavadora 320 × 3 días»); `CaseView.rental` carries the range. Hold the units in YOUR ledger
266
+ * first: the platform keeps what was rented, you own availability. Created `submitted`, or `confirmed` at once with
267
+ * `confirmation: 'instant'`. 400 for a bad range (end ≤ start, > 366 days, a count below what the range spans) or a
268
+ * line with `variantId`/`amountCents`; 409 when a product lacks stock. A retried `idempotencyKey` returns the same rental.
269
+ * R2d: `lines[].periodRateCents` (App sk_ key) prices a line with YOUR rate of one period instead of the catalog; still multiplied here.
270
+ */
271
+ async createDirectRental(input) {
272
+ return this.client.request('POST', '/api/v1/cases/direct-rental', input);
273
+ }
274
+ /**
275
+ * `PATCH /api/v1/cases/:id/rental` — PDK-RENTAL-AVAILABILITY: reschedule or extend a rental you already moved in your
276
+ * ledger. Periods and prices are recomputed from the catalog and the receipt is re-issued (same link, revision + 1).
277
+ * Allowed after it is confirmed (an extension on site); 400 once it is closed or when the case is not a rental.
278
+ * R2d: `lines[].periodRateCents` re-prices a product (e.g. after changing `periods.unit` from `hora` to `dia`).
279
+ */
280
+ async updateRental(caseId, input) {
281
+ return this.client.request('PATCH', `/api/v1/cases/${encodeURIComponent(caseId)}/rental`, input);
282
+ }
250
283
  /**
251
284
  * `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
252
285
  * conversation's channel. The same `key` never says it twice.
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { CheckSystemTemplateResult, CreateTemplateReportInput, UpsertSystemTemplateInput, UpsertSystemTemplateResult, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateDetail, TemplateInstallResult, TemplateReview, TemplateReviewsPage, TemplateSummary } from '../types';
2
+ import type { CheckSystemTemplateResult, CreateTemplateReportInput, SetSystemAppProfileResult, SystemAppProfileView, UpsertSystemTemplateInput, UpsertSystemTemplateResult, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateDetail, TemplateInstallResult, TemplateReview, TemplateReviewsPage, TemplateSummary } from '../types';
3
3
  export interface ListTemplatesInput {
4
4
  kind?: 'agent' | 'team';
5
5
  /** Every tag must match (AND), e.g. ['type:food']. */
@@ -63,6 +63,25 @@ export declare class TemplatesResource {
63
63
  checkSystem(slug: string, input: UpsertSystemTemplateInput, opts?: {
64
64
  strict?: boolean;
65
65
  }): Promise<CheckSystemTemplateResult>;
66
+ /**
67
+ * PDK-PAGE-THEMES — `GET /api/v1/templates/system/:slug/app-profile`: the
68
+ * calling App's OWN metadata blob on one of its system templates
69
+ * (`{ profile: null }` when it has none). App secret only; 404 when `slug`
70
+ * is not a system template of this App.
71
+ */
72
+ getSystemAppProfile(slug: string): Promise<SystemAppProfileView>;
73
+ /**
74
+ * PDK-PAGE-THEMES — `PUT /api/v1/templates/system/:slug/app-profile`: writes
75
+ * ONLY the calling App's blob (a JSON object, <= 32 KB; `null` removes it) on
76
+ * one of its system templates, live — no draft or publish step, and the
77
+ * other Apps' blobs are untouched. Same blob again = `action: 'unchanged'`.
78
+ * `opts.ifAbsent` leaves an existing blob alone (`'unchanged'`, returning it).
79
+ * App secret only (a tenant key gets 403); 400 on a bad blob; 404 when `slug`
80
+ * is not a system template of this App.
81
+ */
82
+ setSystemAppProfile(slug: string, profile: Record<string, unknown> | null, opts?: {
83
+ ifAbsent?: boolean;
84
+ }): Promise<SetSystemAppProfileResult>;
66
85
  /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
67
86
  get(templateId: string): Promise<TemplateDetail>;
68
87
  /** `POST /api/v1/templates/:id/install` — clone into the caller's tenant. */
@@ -82,6 +82,27 @@ class TemplatesResource {
82
82
  async checkSystem(slug, input, opts = {}) {
83
83
  return this.client.request('POST', `/api/v1/templates/system/${encodeURIComponent(slug)}/check${opts.strict ? '?strict=true' : ''}`, input);
84
84
  }
85
+ /**
86
+ * PDK-PAGE-THEMES — `GET /api/v1/templates/system/:slug/app-profile`: the
87
+ * calling App's OWN metadata blob on one of its system templates
88
+ * (`{ profile: null }` when it has none). App secret only; 404 when `slug`
89
+ * is not a system template of this App.
90
+ */
91
+ async getSystemAppProfile(slug) {
92
+ return this.client.request('GET', `/api/v1/templates/system/${encodeURIComponent(slug)}/app-profile`);
93
+ }
94
+ /**
95
+ * PDK-PAGE-THEMES — `PUT /api/v1/templates/system/:slug/app-profile`: writes
96
+ * ONLY the calling App's blob (a JSON object, <= 32 KB; `null` removes it) on
97
+ * one of its system templates, live — no draft or publish step, and the
98
+ * other Apps' blobs are untouched. Same blob again = `action: 'unchanged'`.
99
+ * `opts.ifAbsent` leaves an existing blob alone (`'unchanged'`, returning it).
100
+ * App secret only (a tenant key gets 403); 400 on a bad blob; 404 when `slug`
101
+ * is not a system template of this App.
102
+ */
103
+ async setSystemAppProfile(slug, profile, opts = {}) {
104
+ return this.client.request('PUT', `/api/v1/templates/system/${encodeURIComponent(slug)}/app-profile${opts.ifAbsent ? '?ifAbsent=true' : ''}`, { profile });
105
+ }
85
106
  /** `GET /api/v1/templates/:id` — summary + payload. 404 → `AgentForgeNotFoundError`. An unlisted template is readable by id only from its own tenant / App. */
86
107
  async get(templateId) {
87
108
  return this.client.request('GET', `/api/v1/templates/${encodeURIComponent(templateId)}`);
package/dist/types.d.ts CHANGED
@@ -1126,6 +1126,15 @@ export interface CheckSystemTemplateResult {
1126
1126
  errors: TemplatePublishIssue[];
1127
1127
  warnings: TemplatePublishIssue[];
1128
1128
  }
1129
+ /** PDK-PAGE-THEMES. `templates.getSystemAppProfile` result: the calling App's own blob, or `null`. */
1130
+ export interface SystemAppProfileView {
1131
+ profile: Record<string, unknown> | null;
1132
+ }
1133
+ /** PDK-PAGE-THEMES. `templates.setSystemAppProfile` result. `unchanged`: the App's blob was already exactly this. */
1134
+ export interface SetSystemAppProfileResult {
1135
+ action: 'updated' | 'unchanged';
1136
+ profile: Record<string, unknown> | null;
1137
+ }
1129
1138
  /** `created`: new template (v1). `updated`: a new version was published, or
1130
1139
  * display fields changed (compare `template.currentVersion`). `unchanged`:
1131
1140
  * the same definition was already there — nothing written. */
@@ -2556,6 +2565,10 @@ export interface CaseView {
2556
2565
  slot: (CaseSlot & {
2557
2566
  label: string;
2558
2567
  }) | null;
2568
+ /** PDK-RENTAL-AVAILABILITY — the time range a rental order holds and what it is charged for; null for any other case (absent on an older platform). */
2569
+ rental?: (CaseRental & {
2570
+ label: string;
2571
+ }) | null;
2559
2572
  /** AGF-DELIVERY D0 — where it is taken or performed (absent on an older platform). */
2560
2573
  destination?: CaseDestination | null;
2561
2574
  openedAt: string;
@@ -2739,6 +2752,16 @@ export interface CaseReceiptLine {
2739
2752
  currency: string;
2740
2753
  priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
2741
2754
  unit?: string;
2755
+ /**
2756
+ * PDK-RENTAL-AVAILABILITY — a rented line (receipt of `cases.createDirectRental`): charged for `count` periods of `unit`.
2757
+ * `unitCents` of the line is then the price of ONE unit over the whole range (rate × count); `periods.unitCents` is the rate
2758
+ * per period. Show it as «{qty} × {title} × {count} {unit}».
2759
+ */
2760
+ periods?: {
2761
+ unit: RentalPeriodUnit;
2762
+ count: number;
2763
+ unitCents: number | null;
2764
+ };
2742
2765
  /** AGF-UNITS U2 — sold by measure: `qty` is in `unit` (0.75 lb), not a count of items. */
2743
2766
  measured?: boolean;
2744
2767
  /** PDK-SERVICE-CART — the line is a service. Absent: a product, a receipt issued before, or an older platform. */
@@ -3362,6 +3385,9 @@ export interface ListCasesInput {
3362
3385
  /** AGF-AGENDA — bookings whose time starts in [slotFrom, slotTo), earliest first. */
3363
3386
  slotFrom?: string | Date;
3364
3387
  slotTo?: string | Date;
3388
+ /** PDK-RENTAL-AVAILABILITY — rentals whose range overlaps [rentalFrom, rentalTo), earliest first. */
3389
+ rentalFrom?: string | Date;
3390
+ rentalTo?: string | Date;
3365
3391
  /** AGF-AGENDA — one member's requests (your reference), or `none` for unassigned ones. */
3366
3392
  assignee?: string;
3367
3393
  /** PDK-LOYALTY-CRM L1 — one business contact's cases (also those of contacts merged into it). */
@@ -3415,6 +3441,85 @@ export interface CreateDirectBookingInput {
3415
3441
  /** AGF-DELIVERY D0 — where it is performed: required for a service `attendedAt: 'customer'`, refused for one at the business. */
3416
3442
  destination?: CaseDestination;
3417
3443
  }
3444
+ /** The billing period of a rental. */
3445
+ export type RentalPeriodUnit = 'hora' | 'dia' | 'semana' | 'mes';
3446
+ /** The time a rental holds and what it is charged for (a snapshot: your App's rentals ledger decides what is free). */
3447
+ export interface CaseRental {
3448
+ /** ISO instants. */
3449
+ startsAt: string;
3450
+ endsAt: string;
3451
+ /** IANA zone the business reads it in. */
3452
+ timezone: string;
3453
+ /** The period and how many of them the range is charged for. */
3454
+ periods: {
3455
+ unit: RentalPeriodUnit;
3456
+ count: number;
3457
+ };
3458
+ /** The rate of ONE period of ONE unit per product id when your App priced the lines (`periodRateCents`); absent: the catalog price. */
3459
+ periodRates?: Record<string, number>;
3460
+ }
3461
+ /**
3462
+ * `POST /api/v1/cases/direct-rental` — an order of items rented over a time range. The body of `CreateDirectOrderInput`
3463
+ * (customer, lines, fields, destination, origin, payment, type, idempotencyKey…) plus `rental`. Without the options
3464
+ * that make no sense for a rental: no free lines, no value lines (`amountCents`), no redo (`reopens`).
3465
+ *
3466
+ * Each line's `quantity` is UNITS of the item; its price is computed by the platform from the catalog:
3467
+ * price of ONE period (with the chosen `options`) × units × `rental.periods.count`. Never send totals; an App that owns a rate
3468
+ * table sends only the rate of one period per line (`lines[].periodRateCents`, R2d).
3469
+ */
3470
+ export interface CreateDirectRentalInput extends Omit<CreateDirectOrderInput, 'lines' | 'reopens' | 'allowOffCatalog' | 'maxOffCatalogLines' | 'offCatalogLines'> {
3471
+ lines: Array<{
3472
+ productId: string;
3473
+ /** Units of the item (2 backhoes). */
3474
+ quantity: number;
3475
+ /** The choice for a product with option groups (con operador, combustible, transporte…). */
3476
+ options?: CatalogOptionChoice[];
3477
+ /**
3478
+ * PDK-RENTAL-AVAILABILITY R2d — the rate of ONE unit for ONE period (cents) from YOUR rate table (a machine is
3479
+ * $135.000/hora, $1.000.000/día, …). It replaces the catalog price; the chosen `options` deltas are still added and
3480
+ * the platform multiplies by units × `rental.periods.count`. Only for an App (an sk_ key bound to an App): 403 without it.
3481
+ * A positive integer; 400 `price overflow` when rate × units × periods would exceed 2147483647 cents (int32).
3482
+ * The same product on two lines must use the same rate. Send the SAME unit as `rental.periods.unit`.
3483
+ */
3484
+ periodRateCents?: number;
3485
+ }>;
3486
+ rental: {
3487
+ /** ISO instants with their offset (Z or ±hh:mm); at most 366 days apart. */
3488
+ startsAt: string;
3489
+ endsAt: string;
3490
+ /** IANA zone the business reads the range in. */
3491
+ timezone: string;
3492
+ periods: {
3493
+ /** The unit the product is priced in. */
3494
+ unit: RentalPeriodUnit;
3495
+ /** Optional: defaults to the periods the range spans (the last partial one counted). May be higher (a minimum of 3 days), never lower. */
3496
+ count?: number;
3497
+ };
3498
+ };
3499
+ /** `review` (default): the business accepts it (`submitted`); `instant`: `confirmed` as it is made (your ledger guarantees the units). */
3500
+ confirmation?: 'review' | 'instant';
3501
+ }
3502
+ /** `PATCH /api/v1/cases/:id/rental` — reschedule or extend: the new range (you already hold it). */
3503
+ export interface UpdateCaseRentalInput {
3504
+ startsAt: string;
3505
+ endsAt: string;
3506
+ /** Default: the rental's own zone. */
3507
+ timezone?: string;
3508
+ /** Default: the rental's own unit, count derived from the new range. */
3509
+ periods?: {
3510
+ unit?: RentalPeriodUnit;
3511
+ count?: number;
3512
+ };
3513
+ /**
3514
+ * R2d — the rate of one period for the new `periods.unit` (App sk_ key only). Rates sent earlier stay for the products
3515
+ * not listed; after a change of period unit send the new rate or the old one (of the other unit) is kept. Same validation as on create.
3516
+ */
3517
+ lines?: Array<{
3518
+ productId: string;
3519
+ periodRateCents: number;
3520
+ quantity?: number;
3521
+ }>;
3522
+ }
3418
3523
  /** `POST /api/v1/cases/:id/slot` — the new time (you already hold it), optionally another member. */
3419
3524
  export interface MoveCaseSlotInput {
3420
3525
  startsAt: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.85.0",
3
+ "version": "4.87.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",