@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 };
@@ -24,6 +24,7 @@ __export(index_typings_exports, {
24
24
  ActivitySource: () => ActivitySource,
25
25
  ActivityWorkflow: () => ActivityWorkflow,
26
26
  AttachmentType: () => AttachmentType,
27
+ CancelReason: () => CancelReason,
27
28
  JobStatus: () => JobStatus,
28
29
  JobType: () => JobType,
29
30
  Platform: () => Platform,
@@ -40,6 +41,7 @@ __export(index_typings_exports, {
40
41
  queryProjectJobActivity: () => queryProjectJobActivity2,
41
42
  queryProjectJobs: () => queryProjectJobs2,
42
43
  reportProjectJobActivity: () => reportProjectJobActivity2,
44
+ stopProjectJob: () => stopProjectJob2,
43
45
  typedQueryProjectJobs: () => typedQueryProjectJobs,
44
46
  updateProjectJobStatus: () => updateProjectJobStatus2,
45
47
  utils: () => utils
@@ -287,6 +289,33 @@ function cancelProjectJob(payload) {
287
289
  }
288
290
  return __cancelProjectJob;
289
291
  }
292
+ function stopProjectJob(payload) {
293
+ function __stopProjectJob({ host }) {
294
+ const metadata = {
295
+ entityFqdn: "wix.containers.project_jobs.v1.project_job",
296
+ method: "POST",
297
+ methodFqn: "wix.containers.project.jobs.v1.ContainersProjectJobs.StopProjectJob",
298
+ packageName: PACKAGE_NAME,
299
+ migrationOptions: {
300
+ optInTransformResponse: true
301
+ },
302
+ url: resolveWixContainersProjectJobsV1ContainersProjectJobsUrl({
303
+ protoPath: "/v1/project-jobs/{projectJobId}/stop",
304
+ data: payload,
305
+ host
306
+ }),
307
+ data: payload,
308
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
309
+ {
310
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
311
+ paths: TRANSFORM_PATHS_0
312
+ }
313
+ ])
314
+ };
315
+ return metadata;
316
+ }
317
+ return __stopProjectJob;
318
+ }
290
319
  function getLatestProjectJob(payload) {
291
320
  function __getLatestProjectJob({ host }) {
292
321
  const metadata = {
@@ -436,6 +465,10 @@ var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
436
465
  AttachmentType2["URL"] = "URL";
437
466
  return AttachmentType2;
438
467
  })(AttachmentType || {});
468
+ var CancelReason = /* @__PURE__ */ ((CancelReason2) => {
469
+ CancelReason2["USER_STOPPED"] = "USER_STOPPED";
470
+ return CancelReason2;
471
+ })(CancelReason || {});
439
472
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
440
473
  SortOrder2["ASC"] = "ASC";
441
474
  SortOrder2["DESC"] = "DESC";
@@ -720,6 +753,31 @@ async function cancelProjectJob2(projectJobId, revision) {
720
753
  throw transformedError;
721
754
  }
722
755
  }
756
+ async function stopProjectJob2(projectJobId) {
757
+ const { httpClient, sideEffects } = arguments[1];
758
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
759
+ projectJobId
760
+ });
761
+ const reqOpts = stopProjectJob(payload);
762
+ sideEffects?.onSiteCall?.();
763
+ try {
764
+ const result = await httpClient.request(reqOpts);
765
+ sideEffects?.onSuccess?.(result);
766
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
767
+ } catch (err) {
768
+ const transformedError = (0, import_transform_error.transformError)(
769
+ err,
770
+ {
771
+ spreadPathsToArguments: {},
772
+ explicitPathsToArguments: { projectJobId: "$[0]" },
773
+ singleArgumentUnchanged: false
774
+ },
775
+ ["projectJobId"]
776
+ );
777
+ sideEffects?.onError?.(err);
778
+ throw transformedError;
779
+ }
780
+ }
723
781
  async function getLatestProjectJob2(projectId) {
724
782
  const { httpClient, sideEffects } = arguments[1];
725
783
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -875,6 +933,7 @@ async function queryProjectJobActivity2(projectJobId, options) {
875
933
  ActivitySource,
876
934
  ActivityWorkflow,
877
935
  AttachmentType,
936
+ CancelReason,
878
937
  JobStatus,
879
938
  JobType,
880
939
  Platform,
@@ -891,6 +950,7 @@ async function queryProjectJobActivity2(projectJobId, options) {
891
950
  queryProjectJobActivity,
892
951
  queryProjectJobs,
893
952
  reportProjectJobActivity,
953
+ stopProjectJob,
894
954
  typedQueryProjectJobs,
895
955
  updateProjectJobStatus,
896
956
  utils