@agentforge-io/sdk-server 4.90.0 → 4.92.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.
@@ -1,6 +1,6 @@
1
1
  import type { AgentForgeClient } from '../client';
2
2
  import { AgentForgeError } from '../errors';
3
- import type { AttachCatalogCategoryImageInput, AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, CatalogUnit, SaveCatalogUnitInput, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, HideProductReviewInput, ListProductReviewsForOwnerInput, ListProductReviewsInput, ProductLikeResult, ProductReviewOwner, ProductReviewsOwnerPage, ProductReviewsPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
3
+ import type { AttachCatalogCategoryImageInput, AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, CatalogUnit, SaveCatalogUnitInput, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogPhotoStudioAttachResult, CatalogPhotoStudioCreated, CatalogPhotoStudioJob, CatalogPhotoStudioQuote, CatalogPhotoStudioSkills, CatalogPhotoStudioRequest, CreateCatalogPhotoStudioJobInput, CatalogProduct, CatalogProductPage, HideProductReviewInput, ListProductReviewsForOwnerInput, ListProductReviewsInput, ProductLikeResult, ProductReviewOwner, ProductReviewsOwnerPage, ProductReviewsPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
4
4
  /** Max structured items per `import.preview/apply` call (platform cap). */
5
5
  export declare const CATALOG_IMPORT_MAX_ITEMS = 200;
6
6
  /** Thrown client-side, before any request, when `items` exceeds the cap. */
@@ -50,6 +50,42 @@ export declare class CatalogPhotosResource {
50
50
  /** `PATCH …/photos/cover` */
51
51
  setCover(productId: string, url: string): Promise<CatalogProduct>;
52
52
  }
53
+ /**
54
+ * PDK-HIGGSFIELD — the catalog photo studio (`products.studio`): turns a REAL product photo into a
55
+ * catalog-ready transparent PNG through the workspace's own Higgsfield account. Owner/admin flow of the
56
+ * host App — who may call it is the host's decision; the platform only knows the tenant. Nothing is
57
+ * published by itself: a ready candidate is previewed, then `attach`ed (the cover only changes on request).
58
+ *
59
+ * Errors carry the platform's stable `error.code` (`PHOTO_REQUIRED`, `SOURCE_NOT_IN_PRODUCT`,
60
+ * `IDEMPOTENCY_KEY_REQUIRED`, `PRICE_CHANGED` 409, `INSUFFICIENT_CREDITS` 409, `ACTIVE_JOB_EXISTS` 409 (`jobId`),
61
+ * `HIGGSFIELD_NOT_CONFIGURED` / `HIGGSFIELD_NOT_CONNECTED` / `HIGGSFIELD_RECONNECT` 409, `TENANT_JOB_CAP` 429, `JOB_NOT_READY` 409, `NOT_RESUMABLE` 409, `JOB_NOT_FOUND` 404…).
62
+ */
63
+ export declare class CatalogPhotoStudioResource {
64
+ private readonly client;
65
+ constructor(client: AgentForgeClient);
66
+ private path;
67
+ /** `GET api/v1/catalog/studio/skills` — the image skills (slug, label, purpose, aspect, output). Tenant-level: no product. */
68
+ skills(): Promise<CatalogPhotoStudioSkills>;
69
+ /** `POST …/studio/quote` — price and workspace balance before spending. cutout has `credits: null`. */
70
+ quote(productId: string, input: CatalogPhotoStudioRequest): Promise<CatalogPhotoStudioQuote>;
71
+ /** `POST …/studio/jobs` — start a job (spends Higgsfield credits). `replayed` is true when the same
72
+ * `idempotencyKey` had already created it. */
73
+ create(productId: string, input: CreateCatalogPhotoStudioJobInput): Promise<CatalogPhotoStudioCreated>;
74
+ /** `GET …/studio/jobs` — this product's jobs, newest first (max 20). */
75
+ list(productId: string): Promise<CatalogPhotoStudioJob[]>;
76
+ /** `GET …/studio/jobs/:jobId` — status, stage, error code and (when ready) the candidate `resultUrl`. */
77
+ get(productId: string, jobId: string): Promise<CatalogPhotoStudioJob>;
78
+ /** `POST …/studio/jobs/:jobId/attach` — add the ready candidate to the product photos. Idempotent;
79
+ * the cover only changes with `isCover: true`. `JOB_NOT_READY` 409 otherwise. */
80
+ attach(productId: string, jobId: string, input?: {
81
+ isCover?: boolean;
82
+ }): Promise<CatalogPhotoStudioAttachResult>;
83
+ /** `POST …/studio/jobs/:jobId/resume` — continue a job the platform can safely continue (see the job's
84
+ * `resumable`). `NOT_RESUMABLE` 409 otherwise. */
85
+ resume(productId: string, jobId: string): Promise<CatalogPhotoStudioJob>;
86
+ /** `DELETE …/studio/jobs/:jobId` — drop a candidate (and its stored object). The product photos are not touched. */
87
+ discard(productId: string, jobId: string): Promise<CatalogPhotoStudioJob>;
88
+ }
53
89
  /** AGF-UNITS U1 — units of measure: the standard ones and the business's own. */
54
90
  export declare class CatalogUnitsResource {
55
91
  private readonly client;
@@ -126,6 +162,8 @@ export declare class CatalogReviewsResource {
126
162
  export declare class CatalogProductsResource {
127
163
  private readonly client;
128
164
  readonly photos: CatalogPhotosResource;
165
+ /** PDK-HIGGSFIELD — catalog photos from the owner's Higgsfield account. */
166
+ readonly studio: CatalogPhotoStudioResource;
129
167
  /** AGF-PDK-PRODUCT-REVIEWS — a product's public reviews and rating. */
130
168
  readonly reviews: CatalogProductReviewsResource;
131
169
  /** AGF-PDK-PRODUCT-REVIEWS — likes of signed-in customers. */
@@ -16,7 +16,7 @@
16
16
  // machine-readable code (`CATALOG_NOT_FOUND`, `FILE_EMPTY_FILE`,
17
17
  // `INVALID_MAPPING`, `TOO_MANY_ITEMS`, …).
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogReviewsResource = exports.CatalogProductLikesResource = exports.CatalogProductReviewsResource = exports.CatalogOptionGroupsResource = exports.CatalogUnitsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
19
+ exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogReviewsResource = exports.CatalogProductLikesResource = exports.CatalogProductReviewsResource = exports.CatalogOptionGroupsResource = exports.CatalogUnitsResource = exports.CatalogPhotoStudioResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
20
20
  const errors_1 = require("../errors");
21
21
  const BASE = '/api/v1/catalog';
22
22
  const TENANT_AUTH = { forceApiKey: true };
@@ -129,6 +129,60 @@ class CatalogPhotosResource {
129
129
  }
130
130
  }
131
131
  exports.CatalogPhotosResource = CatalogPhotosResource;
132
+ /**
133
+ * PDK-HIGGSFIELD — the catalog photo studio (`products.studio`): turns a REAL product photo into a
134
+ * catalog-ready transparent PNG through the workspace's own Higgsfield account. Owner/admin flow of the
135
+ * host App — who may call it is the host's decision; the platform only knows the tenant. Nothing is
136
+ * published by itself: a ready candidate is previewed, then `attach`ed (the cover only changes on request).
137
+ *
138
+ * Errors carry the platform's stable `error.code` (`PHOTO_REQUIRED`, `SOURCE_NOT_IN_PRODUCT`,
139
+ * `IDEMPOTENCY_KEY_REQUIRED`, `PRICE_CHANGED` 409, `INSUFFICIENT_CREDITS` 409, `ACTIVE_JOB_EXISTS` 409 (`jobId`),
140
+ * `HIGGSFIELD_NOT_CONFIGURED` / `HIGGSFIELD_NOT_CONNECTED` / `HIGGSFIELD_RECONNECT` 409, `TENANT_JOB_CAP` 429, `JOB_NOT_READY` 409, `NOT_RESUMABLE` 409, `JOB_NOT_FOUND` 404…).
141
+ */
142
+ class CatalogPhotoStudioResource {
143
+ constructor(client) {
144
+ this.client = client;
145
+ }
146
+ path(productId, tail = '') {
147
+ return `${BASE}/products/${seg(productId)}/studio${tail}`;
148
+ }
149
+ /** `GET api/v1/catalog/studio/skills` — the image skills (slug, label, purpose, aspect, output). Tenant-level: no product. */
150
+ async skills() {
151
+ return this.client.request('GET', `${BASE}/studio/skills`, undefined, TENANT_AUTH);
152
+ }
153
+ /** `POST …/studio/quote` — price and workspace balance before spending. cutout has `credits: null`. */
154
+ async quote(productId, input) {
155
+ return this.client.request('POST', this.path(productId, '/quote'), input, TENANT_AUTH);
156
+ }
157
+ /** `POST …/studio/jobs` — start a job (spends Higgsfield credits). `replayed` is true when the same
158
+ * `idempotencyKey` had already created it. */
159
+ async create(productId, input) {
160
+ return this.client.request('POST', this.path(productId, '/jobs'), input, TENANT_AUTH);
161
+ }
162
+ /** `GET …/studio/jobs` — this product's jobs, newest first (max 20). */
163
+ async list(productId) {
164
+ return this.client.request('GET', this.path(productId, '/jobs'), undefined, TENANT_AUTH);
165
+ }
166
+ /** `GET …/studio/jobs/:jobId` — status, stage, error code and (when ready) the candidate `resultUrl`. */
167
+ async get(productId, jobId) {
168
+ return this.client.request('GET', this.path(productId, `/jobs/${seg(jobId)}`), undefined, TENANT_AUTH);
169
+ }
170
+ /** `POST …/studio/jobs/:jobId/attach` — add the ready candidate to the product photos. Idempotent;
171
+ * the cover only changes with `isCover: true`. `JOB_NOT_READY` 409 otherwise. */
172
+ async attach(productId, jobId, input = {}) {
173
+ return this.client.request('POST', this.path(productId, `/jobs/${seg(jobId)}/attach`), input, TENANT_AUTH);
174
+ }
175
+ /** `POST …/studio/jobs/:jobId/resume` — continue a job the platform can safely continue (see the job's
176
+ * `resumable`). `NOT_RESUMABLE` 409 otherwise. */
177
+ async resume(productId, jobId) {
178
+ return this.client.request('POST', this.path(productId, `/jobs/${seg(jobId)}/resume`), {}, TENANT_AUTH);
179
+ }
180
+ /** `DELETE …/studio/jobs/:jobId` — drop a candidate (and its stored object). The product photos are not touched. */
181
+ async discard(productId, jobId) {
182
+ return this.client.request('DELETE', this.path(productId, `/jobs/${seg(jobId)}`), undefined, TENANT_AUTH);
183
+ }
184
+ }
185
+ exports.CatalogPhotoStudioResource = CatalogPhotoStudioResource;
132
186
  /** AGF-UNITS U1 — units of measure: the standard ones and the business's own. */
133
187
  class CatalogUnitsResource {
134
188
  constructor(client) {
@@ -254,6 +308,7 @@ class CatalogProductsResource {
254
308
  constructor(client) {
255
309
  this.client = client;
256
310
  this.photos = new CatalogPhotosResource(client);
311
+ this.studio = new CatalogPhotoStudioResource(client);
257
312
  this.reviews = new CatalogProductReviewsResource(client);
258
313
  this.likes = new CatalogProductLikesResource(client);
259
314
  }