@wix/auto_sdk_containers_project-jobs 1.0.3 → 1.0.4

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.
@@ -95,6 +95,14 @@ interface ProjectJob {
95
95
  * @maxLength 20
96
96
  */
97
97
  creditsCostUsd?: string;
98
+ /**
99
+ * The AI-credits cost (in USD) of this edit if the user stops it after the agent started work,
100
+ * resolved at creation time with credits_cost_usd. Set only for USER_REQUEST jobs. Empty for other
101
+ * job types and for jobs created before this field existed, which are not charged when stopped.
102
+ * @readonly
103
+ * @maxLength 20
104
+ */
105
+ creditsStoppedCostUsd?: string | null;
98
106
  /**
99
107
  * Chat suggestion chips proposed by a GENERATE_SUGGESTIONS job. Empty for every other job type.
100
108
  * Set only via UpdateProjectJobStatus, alongside AGENT_DONE — never at creation time.
@@ -116,6 +124,13 @@ interface ProjectJob {
116
124
  * @format GUID
117
125
  */
118
126
  initiatingMetaSiteId?: string;
127
+ /**
128
+ * Why a CANCELLED job was cancelled. Set only by StopProjectJob (USER_STOPPED); every other
129
+ * cancellation leaves it unset. containers-projects reads it to cancel the stopped chat turn
130
+ * instead of closing it as an error.
131
+ * @readonly
132
+ */
133
+ cancelReason?: CancelReasonWithLiterals;
119
134
  }
120
135
  declare enum JobType {
121
136
  INITIAL_GENERATION = "INITIAL_GENERATION",
@@ -184,6 +199,12 @@ interface Suggestion {
184
199
  */
185
200
  prompt?: string;
186
201
  }
202
+ declare enum CancelReason {
203
+ /** The user stopped the edit from the chat. The worker discards the run; its chat turn is cancelled. */
204
+ USER_STOPPED = "USER_STOPPED"
205
+ }
206
+ /** @enumType */
207
+ type CancelReasonWithLiterals = CancelReason | 'USER_STOPPED';
187
208
  interface CreateProjectJobRequest {
188
209
  /** ProjectJob to be created. */
189
210
  projectJob: ProjectJob;
@@ -374,6 +395,17 @@ interface CancelProjectJobResponse {
374
395
  /** The cancelled job. */
375
396
  projectJob?: ProjectJob;
376
397
  }
398
+ interface StopProjectJobRequest {
399
+ /**
400
+ * ID of the job to stop.
401
+ * @format GUID
402
+ */
403
+ projectJobId: string;
404
+ }
405
+ interface StopProjectJobResponse {
406
+ /** The stopped job. */
407
+ projectJob?: ProjectJob;
408
+ }
377
409
  interface GetLatestProjectJobRequest {
378
410
  /**
379
411
  * ID of the project to get the latest job for.
@@ -387,6 +419,11 @@ interface GetLatestProjectJobResponse {
387
419
  * if the project has no jobs yet.
388
420
  */
389
421
  projectJob?: ProjectJob;
422
+ /**
423
+ * Whether Stop Project Job can stop `projectJob` now. Clients show a stop control only when
424
+ * this is true; false when there is no job.
425
+ */
426
+ stopAvailable?: boolean;
390
427
  }
391
428
  interface CreateSuggestionsJobRequest {
392
429
  /**
@@ -864,7 +901,7 @@ interface ProjectJobsQueryBuilder {
864
901
  * @requiredField query
865
902
  * @requiredField options
866
903
  */
867
- declare function typedQueryProjectJobs(query: ProjectJobQuery, options: QueryProjectJobsOptions): Promise<NonNullablePaths<QueryProjectJobsResponse, `projectJobs` | `projectJobs.${number}.projectId` | `projectJobs.${number}.jobType` | `projectJobs.${number}.platform` | `projectJobs.${number}.jobStatus` | `projectJobs.${number}.prompt` | `projectJobs.${number}.codingAgentSessionId` | `projectJobs.${number}.failureReason` | `projectJobs.${number}.creditsExempt` | `projectJobs.${number}.creditsCostUsd` | `projectJobs.${number}.initiatingUserId` | `projectJobs.${number}.initiatingMetaSiteId`, 2>>;
904
+ declare function typedQueryProjectJobs(query: ProjectJobQuery, options: QueryProjectJobsOptions): Promise<NonNullablePaths<QueryProjectJobsResponse, `projectJobs` | `projectJobs.${number}.projectId` | `projectJobs.${number}.jobType` | `projectJobs.${number}.platform` | `projectJobs.${number}.jobStatus` | `projectJobs.${number}.prompt` | `projectJobs.${number}.codingAgentSessionId` | `projectJobs.${number}.failureReason` | `projectJobs.${number}.creditsExempt` | `projectJobs.${number}.creditsCostUsd` | `projectJobs.${number}.initiatingUserId` | `projectJobs.${number}.initiatingMetaSiteId` | `projectJobs.${number}.cancelReason`, 2>>;
868
905
  interface ProjectJobQuerySpec extends QuerySpec {
869
906
  paging: 'cursor';
870
907
  wql: [
@@ -954,4 +991,4 @@ interface QueryProjectJobActivityOptions {
954
991
  limit?: number;
955
992
  }
956
993
 
957
- export { type AccountInfo, type ActionEvent, type ActivityBatch, type ActivityEvent, ActivityEventType, type ActivityEventTypeWithLiterals, ActivitySource, type ActivitySourceWithLiterals, ActivityWorkflow, type ActivityWorkflowWithLiterals, type Attachment, AttachmentType, type AttachmentTypeWithLiterals, type CancelProjectJobRequest, type CancelProjectJobResponse, type ClearProjectJobAssistantResponseRequest, type ClearProjectJobAssistantResponseResponse, type CommonQueryWithEntityContext, type CreateProjectJobRequest, type CreateProjectJobResponse, type CreateSuggestionsJobOptions, type CreateSuggestionsJobRequest, type CreateSuggestionsJobResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type GetCurrentProjectJobRequest, type GetCurrentProjectJobResponse, type GetLatestProjectJobRequest, type GetLatestProjectJobResponse, type GetProjectJobRequest, type GetProjectJobResponse, type IdentificationData, type IdentificationDataIdOneOf, JobStatus, type JobStatusWithLiterals, JobType, type JobTypeWithLiterals, type MessageEnvelope, type OpenProjectJobActivityRequest, type OpenProjectJobActivityResponse, Platform, type PlatformWithLiterals, type ProjectJob, type ProjectJobQuery, type ProjectJobQuerySpec, type ProjectJobsQueryBuilder, type ProjectJobsQueryResult, type QueryProjectJobActivityOptions, type QueryProjectJobActivityRequest, type QueryProjectJobActivityResponse, type QueryProjectJobsOptions, type QueryProjectJobsRequest, type QueryProjectJobsResponse, type ReportProjectJobActivityRequest, type ReportProjectJobActivityResponse, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, type Suggestion, type UpdateProjectJobStatusOptions, type UpdateProjectJobStatusRequest, type UpdateProjectJobStatusResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, typedQueryProjectJobs, utils };
994
+ export { type AccountInfo, type ActionEvent, type ActivityBatch, type ActivityEvent, ActivityEventType, type ActivityEventTypeWithLiterals, ActivitySource, type ActivitySourceWithLiterals, ActivityWorkflow, type ActivityWorkflowWithLiterals, type Attachment, AttachmentType, type AttachmentTypeWithLiterals, type CancelProjectJobRequest, type CancelProjectJobResponse, CancelReason, type CancelReasonWithLiterals, type ClearProjectJobAssistantResponseRequest, type ClearProjectJobAssistantResponseResponse, type CommonQueryWithEntityContext, type CreateProjectJobRequest, type CreateProjectJobResponse, type CreateSuggestionsJobOptions, type CreateSuggestionsJobRequest, type CreateSuggestionsJobResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type GetCurrentProjectJobRequest, type GetCurrentProjectJobResponse, type GetLatestProjectJobRequest, type GetLatestProjectJobResponse, type GetProjectJobRequest, type GetProjectJobResponse, type IdentificationData, type IdentificationDataIdOneOf, JobStatus, type JobStatusWithLiterals, JobType, type JobTypeWithLiterals, type MessageEnvelope, type OpenProjectJobActivityRequest, type OpenProjectJobActivityResponse, Platform, type PlatformWithLiterals, type ProjectJob, type ProjectJobQuery, type ProjectJobQuerySpec, type ProjectJobsQueryBuilder, type ProjectJobsQueryResult, type QueryProjectJobActivityOptions, type QueryProjectJobActivityRequest, type QueryProjectJobActivityResponse, type QueryProjectJobsOptions, type QueryProjectJobsRequest, type QueryProjectJobsResponse, type ReportProjectJobActivityRequest, type ReportProjectJobActivityResponse, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, type StopProjectJobRequest, type StopProjectJobResponse, type Suggestion, type UpdateProjectJobStatusOptions, type UpdateProjectJobStatusRequest, type UpdateProjectJobStatusResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, typedQueryProjectJobs, utils };
@@ -242,6 +242,33 @@ function cancelProjectJob(payload) {
242
242
  }
243
243
  return __cancelProjectJob;
244
244
  }
245
+ function stopProjectJob(payload) {
246
+ function __stopProjectJob({ host }) {
247
+ const metadata = {
248
+ entityFqdn: "wix.containers.project_jobs.v1.project_job",
249
+ method: "POST",
250
+ methodFqn: "wix.containers.project.jobs.v1.ContainersProjectJobs.StopProjectJob",
251
+ packageName: PACKAGE_NAME,
252
+ migrationOptions: {
253
+ optInTransformResponse: true
254
+ },
255
+ url: resolveWixContainersProjectJobsV1ContainersProjectJobsUrl({
256
+ protoPath: "/v1/project-jobs/{projectJobId}/stop",
257
+ data: payload,
258
+ host
259
+ }),
260
+ data: payload,
261
+ transformResponse: (payload2) => transformPaths(payload2, [
262
+ {
263
+ transformFn: transformRESTTimestampToSDKTimestamp,
264
+ paths: TRANSFORM_PATHS_0
265
+ }
266
+ ])
267
+ };
268
+ return metadata;
269
+ }
270
+ return __stopProjectJob;
271
+ }
245
272
  function getLatestProjectJob(payload) {
246
273
  function __getLatestProjectJob({ host }) {
247
274
  const metadata = {
@@ -391,6 +418,10 @@ var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
391
418
  AttachmentType2["URL"] = "URL";
392
419
  return AttachmentType2;
393
420
  })(AttachmentType || {});
421
+ var CancelReason = /* @__PURE__ */ ((CancelReason2) => {
422
+ CancelReason2["USER_STOPPED"] = "USER_STOPPED";
423
+ return CancelReason2;
424
+ })(CancelReason || {});
394
425
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
395
426
  SortOrder2["ASC"] = "ASC";
396
427
  SortOrder2["DESC"] = "DESC";
@@ -675,6 +706,31 @@ async function cancelProjectJob2(projectJobId, revision) {
675
706
  throw transformedError;
676
707
  }
677
708
  }
709
+ async function stopProjectJob2(projectJobId) {
710
+ const { httpClient, sideEffects } = arguments[1];
711
+ const payload = renameKeysFromSDKRequestToRESTRequest({
712
+ projectJobId
713
+ });
714
+ const reqOpts = stopProjectJob(payload);
715
+ sideEffects?.onSiteCall?.();
716
+ try {
717
+ const result = await httpClient.request(reqOpts);
718
+ sideEffects?.onSuccess?.(result);
719
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
720
+ } catch (err) {
721
+ const transformedError = sdkTransformError(
722
+ err,
723
+ {
724
+ spreadPathsToArguments: {},
725
+ explicitPathsToArguments: { projectJobId: "$[0]" },
726
+ singleArgumentUnchanged: false
727
+ },
728
+ ["projectJobId"]
729
+ );
730
+ sideEffects?.onError?.(err);
731
+ throw transformedError;
732
+ }
733
+ }
678
734
  async function getLatestProjectJob2(projectId) {
679
735
  const { httpClient, sideEffects } = arguments[1];
680
736
  const payload = renameKeysFromSDKRequestToRESTRequest({
@@ -829,6 +885,7 @@ export {
829
885
  ActivitySource,
830
886
  ActivityWorkflow,
831
887
  AttachmentType,
888
+ CancelReason,
832
889
  JobStatus,
833
890
  JobType,
834
891
  Platform,
@@ -845,6 +902,7 @@ export {
845
902
  queryProjectJobActivity2 as queryProjectJobActivity,
846
903
  queryProjectJobs2 as queryProjectJobs,
847
904
  reportProjectJobActivity2 as reportProjectJobActivity,
905
+ stopProjectJob2 as stopProjectJob,
848
906
  typedQueryProjectJobs,
849
907
  updateProjectJobStatus2 as updateProjectJobStatus,
850
908
  utils