@spotpatch/shared 1.2.0 → 1.4.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.cts CHANGED
@@ -19,7 +19,17 @@ declare const ERROR_CODES: {
19
19
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
20
20
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
21
21
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
22
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
23
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
24
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
25
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
26
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
27
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
22
28
  readonly TOOL_DENIED: "TOOL_DENIED";
29
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
30
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
31
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
32
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
23
33
  readonly PATCH_REJECTED: "PATCH_REJECTED";
24
34
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
25
35
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -143,6 +153,7 @@ interface EditorOpenResult {
143
153
  type AiProviderProtocol = "responses" | "chat-completions";
144
154
  type AiProviderAuthentication = "bearer" | "x-api-key";
145
155
  type AgentApplyMode = "review" | "auto";
156
+ type AgentWorkingTreeMode = "require-clean" | "include-local-changes";
146
157
  interface AiModelProfile {
147
158
  readonly label: string;
148
159
  readonly model: string;
@@ -274,6 +285,26 @@ interface AgentCapabilitySnapshot {
274
285
  readonly checkedAt?: string;
275
286
  readonly errorCode?: ErrorCode;
276
287
  }
288
+ declare const AGENT_WORKSPACE_STATES: readonly ["ready", "consent-required", "blocked"];
289
+ declare const AGENT_WORKSPACE_SNAPSHOT_LIMITS: Readonly<{
290
+ maxUntrackedFiles: 1000;
291
+ maxUntrackedBytes: number;
292
+ }>;
293
+ type AgentWorkspaceState = (typeof AGENT_WORKSPACE_STATES)[number];
294
+ interface AgentWorkspaceChangeSummary {
295
+ readonly staged: number;
296
+ readonly unstaged: number;
297
+ readonly untracked: number;
298
+ readonly conflicted: number;
299
+ readonly total: number;
300
+ }
301
+ interface AgentWorkspaceHealthSnapshot {
302
+ readonly state: AgentWorkspaceState;
303
+ readonly checkedAt: string;
304
+ readonly changes: AgentWorkspaceChangeSummary;
305
+ readonly canIncludeLocalChanges: boolean;
306
+ readonly errorCode?: ErrorCode;
307
+ }
277
308
  declare const AGENT_FILE_CHANGE_KINDS: readonly ["added", "modified", "deleted"];
278
309
  type AgentFileChangeKind = (typeof AGENT_FILE_CHANGE_KINDS)[number];
279
310
  declare const AGENT_CHECK_STATUSES: readonly ["passed", "failed", "cancelled", "timed-out"];
@@ -333,6 +364,7 @@ declare const SPOTPATCH_ENDPOINTS: Readonly<{
333
364
  sourceContext: "/__spotpatch/v1/source-context";
334
365
  openEditor: "/__spotpatch/v1/open-editor";
335
366
  agentCapability: "/__spotpatch/v1/agent/capability";
367
+ agentWorkspaceHealth: "/__spotpatch/v1/agent/workspace-health";
336
368
  agentJobs: "/__spotpatch/v1/agent/jobs";
337
369
  }>;
338
370
  type AgentJobAction = "events" | "result" | "cancel" | "apply" | "revert";
@@ -540,6 +572,7 @@ declare const agentCapabilityRequestSchema: z.ZodObject<{
540
572
  providerProfileId: z.ZodString;
541
573
  modelProfileId: z.ZodString;
542
574
  }, z.core.$strict>;
575
+ declare const agentWorkspaceHealthRequestSchema: z.ZodObject<{}, z.core.$strict>;
543
576
  declare const agentJobCreateRequestSchema: z.ZodObject<{
544
577
  annotation: z.ZodObject<{
545
578
  schemaVersion: z.ZodLiteral<3>;
@@ -646,6 +679,10 @@ declare const agentJobCreateRequestSchema: z.ZodObject<{
646
679
  providerProfileId: z.ZodString;
647
680
  modelProfileId: z.ZodString;
648
681
  providerDataConsent: z.ZodLiteral<true>;
682
+ workingTreeMode: z.ZodDefault<z.ZodEnum<{
683
+ "require-clean": "require-clean";
684
+ "include-local-changes": "include-local-changes";
685
+ }>>;
649
686
  }, z.core.$strict>;
650
687
  declare const agentJobActionRequestSchema: z.ZodObject<{}, z.core.$strict>;
651
688
  type SourceContextRequest = z.infer<typeof sourceContextRequestSchema>;
@@ -656,10 +693,11 @@ interface AgentJobCreateRequest {
656
693
  readonly providerProfileId: string;
657
694
  readonly modelProfileId: string;
658
695
  readonly providerDataConsent: true;
696
+ readonly workingTreeMode: "require-clean" | "include-local-changes";
659
697
  }
660
698
 
661
699
  interface AgentJobEventBase {
662
- readonly schemaVersion: 1;
700
+ readonly schemaVersion: 2;
663
701
  readonly sequence: number;
664
702
  readonly jobId: string;
665
703
  readonly status: AgentJobStatus;
@@ -678,6 +716,7 @@ type AgentJobEvent = (AgentJobEventBase & {
678
716
  }) | (AgentJobEventBase & {
679
717
  readonly type: "tool";
680
718
  readonly data: Readonly<{
719
+ turn: number;
681
720
  toolCallId: string;
682
721
  toolName: string;
683
722
  state: "started" | "succeeded" | "failed";
@@ -743,7 +782,68 @@ declare const agentCapabilitySnapshotSchema: z.ZodObject<{
743
782
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
744
783
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
745
784
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
785
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
786
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
787
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
788
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
789
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
790
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
791
+ readonly TOOL_DENIED: "TOOL_DENIED";
792
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
793
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
794
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
795
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
796
+ readonly PATCH_REJECTED: "PATCH_REJECTED";
797
+ readonly VALIDATION_FAILED: "VALIDATION_FAILED";
798
+ readonly APPLY_CONFLICT: "APPLY_CONFLICT";
799
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
800
+ }>>;
801
+ }, z.core.$strict>;
802
+ declare const agentWorkspaceHealthSnapshotSchema: z.ZodObject<{
803
+ state: z.ZodEnum<{
804
+ ready: "ready";
805
+ "consent-required": "consent-required";
806
+ blocked: "blocked";
807
+ }>;
808
+ checkedAt: z.ZodISODateTime;
809
+ changes: z.ZodObject<{
810
+ staged: z.ZodNumber;
811
+ unstaged: z.ZodNumber;
812
+ untracked: z.ZodNumber;
813
+ conflicted: z.ZodNumber;
814
+ total: z.ZodNumber;
815
+ }, z.core.$strict>;
816
+ canIncludeLocalChanges: z.ZodBoolean;
817
+ errorCode: z.ZodOptional<z.ZodEnum<{
818
+ readonly INVALID_REQUEST: "INVALID_REQUEST";
819
+ readonly INVALID_TOKEN: "INVALID_TOKEN";
820
+ readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
821
+ readonly SOURCE_NOT_FOUND: "SOURCE_NOT_FOUND";
822
+ readonly SOURCE_OUTSIDE_ROOT: "SOURCE_OUTSIDE_ROOT";
823
+ readonly SOURCE_TOO_LARGE: "SOURCE_TOO_LARGE";
824
+ readonly EDITOR_OPEN_FAILED: "EDITOR_OPEN_FAILED";
825
+ readonly AI_DISABLED: "AI_DISABLED";
826
+ readonly PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED";
827
+ readonly PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED";
828
+ readonly PROVIDER_PROTOCOL_UNSUPPORTED: "PROVIDER_PROTOCOL_UNSUPPORTED";
829
+ readonly MODEL_NOT_ALLOWED: "MODEL_NOT_ALLOWED";
830
+ readonly MODEL_TOOL_CALL_UNSUPPORTED: "MODEL_TOOL_CALL_UNSUPPORTED";
831
+ readonly PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED";
832
+ readonly AGENT_BUSY: "AGENT_BUSY";
833
+ readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
834
+ readonly AGENT_CANCELLED: "AGENT_CANCELLED";
835
+ readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
836
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
837
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
838
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
839
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
840
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
841
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
746
842
  readonly TOOL_DENIED: "TOOL_DENIED";
843
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
844
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
845
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
846
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
747
847
  readonly PATCH_REJECTED: "PATCH_REJECTED";
748
848
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
749
849
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -818,7 +918,17 @@ declare const agentJobSnapshotSchema: z.ZodObject<{
818
918
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
819
919
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
820
920
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
921
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
922
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
923
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
924
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
925
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
926
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
821
927
  readonly TOOL_DENIED: "TOOL_DENIED";
928
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
929
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
930
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
931
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
822
932
  readonly PATCH_REJECTED: "PATCH_REJECTED";
823
933
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
824
934
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -899,7 +1009,17 @@ declare const agentJobResultResponseSchema: z.ZodObject<{
899
1009
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
900
1010
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
901
1011
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1012
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1013
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1014
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1015
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1016
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1017
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
902
1018
  readonly TOOL_DENIED: "TOOL_DENIED";
1019
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1020
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1021
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1022
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
903
1023
  readonly PATCH_REJECTED: "PATCH_REJECTED";
904
1024
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
905
1025
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -935,7 +1055,7 @@ declare const agentJobResultResponseSchema: z.ZodObject<{
935
1055
  }, z.core.$strict>>;
936
1056
  }, z.core.$strict>;
937
1057
  declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
938
- schemaVersion: z.ZodLiteral<1>;
1058
+ schemaVersion: z.ZodLiteral<2>;
939
1059
  sequence: z.ZodNumber;
940
1060
  jobId: z.ZodString;
941
1061
  status: z.ZodEnum<{
@@ -1002,7 +1122,17 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1002
1122
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
1003
1123
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
1004
1124
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1125
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1126
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1127
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1128
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1129
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1130
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
1005
1131
  readonly TOOL_DENIED: "TOOL_DENIED";
1132
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1133
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1134
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1135
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
1006
1136
  readonly PATCH_REJECTED: "PATCH_REJECTED";
1007
1137
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1008
1138
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -1011,7 +1141,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1011
1141
  }, z.core.$strict>;
1012
1142
  }, z.core.$strict>;
1013
1143
  }, z.core.$strict>, z.ZodObject<{
1014
- schemaVersion: z.ZodLiteral<1>;
1144
+ schemaVersion: z.ZodLiteral<2>;
1015
1145
  sequence: z.ZodNumber;
1016
1146
  jobId: z.ZodString;
1017
1147
  status: z.ZodEnum<{
@@ -1035,7 +1165,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1035
1165
  message: z.ZodString;
1036
1166
  }, z.core.$strict>;
1037
1167
  }, z.core.$strict>, z.ZodObject<{
1038
- schemaVersion: z.ZodLiteral<1>;
1168
+ schemaVersion: z.ZodLiteral<2>;
1039
1169
  sequence: z.ZodNumber;
1040
1170
  jobId: z.ZodString;
1041
1171
  status: z.ZodEnum<{
@@ -1056,6 +1186,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1056
1186
  timestamp: z.ZodISODateTime;
1057
1187
  type: z.ZodLiteral<"tool">;
1058
1188
  data: z.ZodObject<{
1189
+ turn: z.ZodNumber;
1059
1190
  toolCallId: z.ZodString;
1060
1191
  toolName: z.ZodString;
1061
1192
  state: z.ZodEnum<{
@@ -1067,7 +1198,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1067
1198
  checkLabel: z.ZodOptional<z.ZodString>;
1068
1199
  }, z.core.$strict>;
1069
1200
  }, z.core.$strict>, z.ZodObject<{
1070
- schemaVersion: z.ZodLiteral<1>;
1201
+ schemaVersion: z.ZodLiteral<2>;
1071
1202
  sequence: z.ZodNumber;
1072
1203
  jobId: z.ZodString;
1073
1204
  status: z.ZodEnum<{
@@ -1102,7 +1233,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1102
1233
  }, z.core.$strict>;
1103
1234
  }, z.core.$strict>;
1104
1235
  }, z.core.$strict>, z.ZodObject<{
1105
- schemaVersion: z.ZodLiteral<1>;
1236
+ schemaVersion: z.ZodLiteral<2>;
1106
1237
  sequence: z.ZodNumber;
1107
1238
  jobId: z.ZodString;
1108
1239
  status: z.ZodEnum<{
@@ -1126,7 +1257,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1126
1257
  hasResult: z.ZodLiteral<true>;
1127
1258
  }, z.core.$strict>;
1128
1259
  }, z.core.$strict>, z.ZodObject<{
1129
- schemaVersion: z.ZodLiteral<1>;
1260
+ schemaVersion: z.ZodLiteral<2>;
1130
1261
  sequence: z.ZodNumber;
1131
1262
  jobId: z.ZodString;
1132
1263
  status: z.ZodEnum<{
@@ -1166,7 +1297,17 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1166
1297
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
1167
1298
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
1168
1299
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1300
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1301
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1302
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1303
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1304
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1305
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
1169
1306
  readonly TOOL_DENIED: "TOOL_DENIED";
1307
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1308
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1309
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1310
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
1170
1311
  readonly PATCH_REJECTED: "PATCH_REJECTED";
1171
1312
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1172
1313
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -1191,4 +1332,4 @@ type ApiResponse<T> = ApiSuccess<T> | ApiFailure;
1191
1332
 
1192
1333
  declare const SPOTPATCH_REPOSITORY_URL: "https://github.com/huanglvjing/spotpatch";
1193
1334
 
1194
- export { AGENT_CAPABILITY_STATES, AGENT_CHECK_STATUSES, AGENT_FILE_CHANGE_KINDS, AGENT_JOB_STATUSES, type AgentApplyMode, type AgentCapabilityRequest, type AgentCapabilitySnapshot, type AgentCapabilityState, type AgentChangedFile, type AgentCheckDefinition, type AgentCheckResult, type AgentCheckStatus, type AgentFileChangeKind, type AgentJobAction, type AgentJobCreateRequest, type AgentJobEvent, type AgentJobResult, type AgentJobResultResponse, type AgentJobSnapshot, type AgentJobStatus, type AgentLimits, type AiExecutionOptions, type AiModelProfile, type AiOptions, type AiProviderAuthentication, type AiProviderProtocol, type ApiFailure, type ApiResponse, type ApiSuccess, type CodeContext, type ContextBudget, DEFAULT_AGENT_LIMITS, ERROR_CODES, type EditorOpenResult, type ElementContext, type ErrorCode, MAX_ANNOTATION_INSTRUCTION_CHARACTERS, MAX_ANNOTATION_TARGETS, MAX_TARGET_INSTRUCTION_CHARACTERS, type MatchedStyleRule, type OpenAICompatibleProviderOptions, type OpenEditorRequest, type PageContext, type ReactContext, type ResolvedAgentCheckDefinition, type ResolvedAiExecutionOptions, type ResolvedAiModelProfile, type ResolvedAiOptions, type ResolvedOpenAICompatibleProviderOptions, type RuntimeAiConfig, type RuntimeAiModelProfile, type RuntimeAiProviderProfile, SOURCE_MARKER_ATTRIBUTE, SPOTPATCH_API_BASE, SPOTPATCH_EDITOR_PREFERENCES, SPOTPATCH_ENDPOINTS, SPOTPATCH_LOCALES, SPOTPATCH_LOCALE_PREFERENCES, SPOTPATCH_REPOSITORY_URL, SPOTPATCH_TOKEN_HEADER, type SourceConfidence, type SourceContextRequest, type SourceMarker, type SourceOrigin, type SourceRef, type SpotAnnotation, type SpotPatchEditorPreference, SpotPatchError, type SpotPatchLocale, type SpotPatchLocalePreference, type SpotTargetContext, type StyleContext, agentCapabilityRequestSchema, agentCapabilitySnapshotSchema, agentChangedFileSchema, agentCheckResultSchema, agentJobActionRequestSchema, agentJobCreateRequestSchema, agentJobEventSchema, agentJobResultResponseSchema, agentJobResultSchema, agentJobSnapshotSchema, formatSourceMarker, getAgentJobEndpoint, isSensitiveName, openEditorRequestSchema, parseSourceMarker, redactSensitiveText, sanitizeUrl, sourceContextRequestSchema, spotAnnotationRequestSchema, spotTargetContextRequestSchema };
1335
+ export { AGENT_CAPABILITY_STATES, AGENT_CHECK_STATUSES, AGENT_FILE_CHANGE_KINDS, AGENT_JOB_STATUSES, AGENT_WORKSPACE_SNAPSHOT_LIMITS, AGENT_WORKSPACE_STATES, type AgentApplyMode, type AgentCapabilityRequest, type AgentCapabilitySnapshot, type AgentCapabilityState, type AgentChangedFile, type AgentCheckDefinition, type AgentCheckResult, type AgentCheckStatus, type AgentFileChangeKind, type AgentJobAction, type AgentJobCreateRequest, type AgentJobEvent, type AgentJobResult, type AgentJobResultResponse, type AgentJobSnapshot, type AgentJobStatus, type AgentLimits, type AgentWorkingTreeMode, type AgentWorkspaceChangeSummary, type AgentWorkspaceHealthSnapshot, type AgentWorkspaceState, type AiExecutionOptions, type AiModelProfile, type AiOptions, type AiProviderAuthentication, type AiProviderProtocol, type ApiFailure, type ApiResponse, type ApiSuccess, type CodeContext, type ContextBudget, DEFAULT_AGENT_LIMITS, ERROR_CODES, type EditorOpenResult, type ElementContext, type ErrorCode, MAX_ANNOTATION_INSTRUCTION_CHARACTERS, MAX_ANNOTATION_TARGETS, MAX_TARGET_INSTRUCTION_CHARACTERS, type MatchedStyleRule, type OpenAICompatibleProviderOptions, type OpenEditorRequest, type PageContext, type ReactContext, type ResolvedAgentCheckDefinition, type ResolvedAiExecutionOptions, type ResolvedAiModelProfile, type ResolvedAiOptions, type ResolvedOpenAICompatibleProviderOptions, type RuntimeAiConfig, type RuntimeAiModelProfile, type RuntimeAiProviderProfile, SOURCE_MARKER_ATTRIBUTE, SPOTPATCH_API_BASE, SPOTPATCH_EDITOR_PREFERENCES, SPOTPATCH_ENDPOINTS, SPOTPATCH_LOCALES, SPOTPATCH_LOCALE_PREFERENCES, SPOTPATCH_REPOSITORY_URL, SPOTPATCH_TOKEN_HEADER, type SourceConfidence, type SourceContextRequest, type SourceMarker, type SourceOrigin, type SourceRef, type SpotAnnotation, type SpotPatchEditorPreference, SpotPatchError, type SpotPatchLocale, type SpotPatchLocalePreference, type SpotTargetContext, type StyleContext, agentCapabilityRequestSchema, agentCapabilitySnapshotSchema, agentChangedFileSchema, agentCheckResultSchema, agentJobActionRequestSchema, agentJobCreateRequestSchema, agentJobEventSchema, agentJobResultResponseSchema, agentJobResultSchema, agentJobSnapshotSchema, agentWorkspaceHealthRequestSchema, agentWorkspaceHealthSnapshotSchema, formatSourceMarker, getAgentJobEndpoint, isSensitiveName, openEditorRequestSchema, parseSourceMarker, redactSensitiveText, sanitizeUrl, sourceContextRequestSchema, spotAnnotationRequestSchema, spotTargetContextRequestSchema };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,17 @@ declare const ERROR_CODES: {
19
19
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
20
20
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
21
21
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
22
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
23
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
24
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
25
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
26
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
27
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
22
28
  readonly TOOL_DENIED: "TOOL_DENIED";
29
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
30
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
31
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
32
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
23
33
  readonly PATCH_REJECTED: "PATCH_REJECTED";
24
34
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
25
35
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -143,6 +153,7 @@ interface EditorOpenResult {
143
153
  type AiProviderProtocol = "responses" | "chat-completions";
144
154
  type AiProviderAuthentication = "bearer" | "x-api-key";
145
155
  type AgentApplyMode = "review" | "auto";
156
+ type AgentWorkingTreeMode = "require-clean" | "include-local-changes";
146
157
  interface AiModelProfile {
147
158
  readonly label: string;
148
159
  readonly model: string;
@@ -274,6 +285,26 @@ interface AgentCapabilitySnapshot {
274
285
  readonly checkedAt?: string;
275
286
  readonly errorCode?: ErrorCode;
276
287
  }
288
+ declare const AGENT_WORKSPACE_STATES: readonly ["ready", "consent-required", "blocked"];
289
+ declare const AGENT_WORKSPACE_SNAPSHOT_LIMITS: Readonly<{
290
+ maxUntrackedFiles: 1000;
291
+ maxUntrackedBytes: number;
292
+ }>;
293
+ type AgentWorkspaceState = (typeof AGENT_WORKSPACE_STATES)[number];
294
+ interface AgentWorkspaceChangeSummary {
295
+ readonly staged: number;
296
+ readonly unstaged: number;
297
+ readonly untracked: number;
298
+ readonly conflicted: number;
299
+ readonly total: number;
300
+ }
301
+ interface AgentWorkspaceHealthSnapshot {
302
+ readonly state: AgentWorkspaceState;
303
+ readonly checkedAt: string;
304
+ readonly changes: AgentWorkspaceChangeSummary;
305
+ readonly canIncludeLocalChanges: boolean;
306
+ readonly errorCode?: ErrorCode;
307
+ }
277
308
  declare const AGENT_FILE_CHANGE_KINDS: readonly ["added", "modified", "deleted"];
278
309
  type AgentFileChangeKind = (typeof AGENT_FILE_CHANGE_KINDS)[number];
279
310
  declare const AGENT_CHECK_STATUSES: readonly ["passed", "failed", "cancelled", "timed-out"];
@@ -333,6 +364,7 @@ declare const SPOTPATCH_ENDPOINTS: Readonly<{
333
364
  sourceContext: "/__spotpatch/v1/source-context";
334
365
  openEditor: "/__spotpatch/v1/open-editor";
335
366
  agentCapability: "/__spotpatch/v1/agent/capability";
367
+ agentWorkspaceHealth: "/__spotpatch/v1/agent/workspace-health";
336
368
  agentJobs: "/__spotpatch/v1/agent/jobs";
337
369
  }>;
338
370
  type AgentJobAction = "events" | "result" | "cancel" | "apply" | "revert";
@@ -540,6 +572,7 @@ declare const agentCapabilityRequestSchema: z.ZodObject<{
540
572
  providerProfileId: z.ZodString;
541
573
  modelProfileId: z.ZodString;
542
574
  }, z.core.$strict>;
575
+ declare const agentWorkspaceHealthRequestSchema: z.ZodObject<{}, z.core.$strict>;
543
576
  declare const agentJobCreateRequestSchema: z.ZodObject<{
544
577
  annotation: z.ZodObject<{
545
578
  schemaVersion: z.ZodLiteral<3>;
@@ -646,6 +679,10 @@ declare const agentJobCreateRequestSchema: z.ZodObject<{
646
679
  providerProfileId: z.ZodString;
647
680
  modelProfileId: z.ZodString;
648
681
  providerDataConsent: z.ZodLiteral<true>;
682
+ workingTreeMode: z.ZodDefault<z.ZodEnum<{
683
+ "require-clean": "require-clean";
684
+ "include-local-changes": "include-local-changes";
685
+ }>>;
649
686
  }, z.core.$strict>;
650
687
  declare const agentJobActionRequestSchema: z.ZodObject<{}, z.core.$strict>;
651
688
  type SourceContextRequest = z.infer<typeof sourceContextRequestSchema>;
@@ -656,10 +693,11 @@ interface AgentJobCreateRequest {
656
693
  readonly providerProfileId: string;
657
694
  readonly modelProfileId: string;
658
695
  readonly providerDataConsent: true;
696
+ readonly workingTreeMode: "require-clean" | "include-local-changes";
659
697
  }
660
698
 
661
699
  interface AgentJobEventBase {
662
- readonly schemaVersion: 1;
700
+ readonly schemaVersion: 2;
663
701
  readonly sequence: number;
664
702
  readonly jobId: string;
665
703
  readonly status: AgentJobStatus;
@@ -678,6 +716,7 @@ type AgentJobEvent = (AgentJobEventBase & {
678
716
  }) | (AgentJobEventBase & {
679
717
  readonly type: "tool";
680
718
  readonly data: Readonly<{
719
+ turn: number;
681
720
  toolCallId: string;
682
721
  toolName: string;
683
722
  state: "started" | "succeeded" | "failed";
@@ -743,7 +782,68 @@ declare const agentCapabilitySnapshotSchema: z.ZodObject<{
743
782
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
744
783
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
745
784
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
785
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
786
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
787
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
788
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
789
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
790
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
791
+ readonly TOOL_DENIED: "TOOL_DENIED";
792
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
793
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
794
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
795
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
796
+ readonly PATCH_REJECTED: "PATCH_REJECTED";
797
+ readonly VALIDATION_FAILED: "VALIDATION_FAILED";
798
+ readonly APPLY_CONFLICT: "APPLY_CONFLICT";
799
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
800
+ }>>;
801
+ }, z.core.$strict>;
802
+ declare const agentWorkspaceHealthSnapshotSchema: z.ZodObject<{
803
+ state: z.ZodEnum<{
804
+ ready: "ready";
805
+ "consent-required": "consent-required";
806
+ blocked: "blocked";
807
+ }>;
808
+ checkedAt: z.ZodISODateTime;
809
+ changes: z.ZodObject<{
810
+ staged: z.ZodNumber;
811
+ unstaged: z.ZodNumber;
812
+ untracked: z.ZodNumber;
813
+ conflicted: z.ZodNumber;
814
+ total: z.ZodNumber;
815
+ }, z.core.$strict>;
816
+ canIncludeLocalChanges: z.ZodBoolean;
817
+ errorCode: z.ZodOptional<z.ZodEnum<{
818
+ readonly INVALID_REQUEST: "INVALID_REQUEST";
819
+ readonly INVALID_TOKEN: "INVALID_TOKEN";
820
+ readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
821
+ readonly SOURCE_NOT_FOUND: "SOURCE_NOT_FOUND";
822
+ readonly SOURCE_OUTSIDE_ROOT: "SOURCE_OUTSIDE_ROOT";
823
+ readonly SOURCE_TOO_LARGE: "SOURCE_TOO_LARGE";
824
+ readonly EDITOR_OPEN_FAILED: "EDITOR_OPEN_FAILED";
825
+ readonly AI_DISABLED: "AI_DISABLED";
826
+ readonly PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED";
827
+ readonly PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED";
828
+ readonly PROVIDER_PROTOCOL_UNSUPPORTED: "PROVIDER_PROTOCOL_UNSUPPORTED";
829
+ readonly MODEL_NOT_ALLOWED: "MODEL_NOT_ALLOWED";
830
+ readonly MODEL_TOOL_CALL_UNSUPPORTED: "MODEL_TOOL_CALL_UNSUPPORTED";
831
+ readonly PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED";
832
+ readonly AGENT_BUSY: "AGENT_BUSY";
833
+ readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
834
+ readonly AGENT_CANCELLED: "AGENT_CANCELLED";
835
+ readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
836
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
837
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
838
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
839
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
840
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
841
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
746
842
  readonly TOOL_DENIED: "TOOL_DENIED";
843
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
844
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
845
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
846
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
747
847
  readonly PATCH_REJECTED: "PATCH_REJECTED";
748
848
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
749
849
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -818,7 +918,17 @@ declare const agentJobSnapshotSchema: z.ZodObject<{
818
918
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
819
919
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
820
920
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
921
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
922
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
923
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
924
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
925
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
926
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
821
927
  readonly TOOL_DENIED: "TOOL_DENIED";
928
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
929
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
930
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
931
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
822
932
  readonly PATCH_REJECTED: "PATCH_REJECTED";
823
933
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
824
934
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -899,7 +1009,17 @@ declare const agentJobResultResponseSchema: z.ZodObject<{
899
1009
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
900
1010
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
901
1011
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1012
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1013
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1014
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1015
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1016
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1017
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
902
1018
  readonly TOOL_DENIED: "TOOL_DENIED";
1019
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1020
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1021
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1022
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
903
1023
  readonly PATCH_REJECTED: "PATCH_REJECTED";
904
1024
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
905
1025
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -935,7 +1055,7 @@ declare const agentJobResultResponseSchema: z.ZodObject<{
935
1055
  }, z.core.$strict>>;
936
1056
  }, z.core.$strict>;
937
1057
  declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
938
- schemaVersion: z.ZodLiteral<1>;
1058
+ schemaVersion: z.ZodLiteral<2>;
939
1059
  sequence: z.ZodNumber;
940
1060
  jobId: z.ZodString;
941
1061
  status: z.ZodEnum<{
@@ -1002,7 +1122,17 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1002
1122
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
1003
1123
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
1004
1124
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1125
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1126
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1127
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1128
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1129
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1130
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
1005
1131
  readonly TOOL_DENIED: "TOOL_DENIED";
1132
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1133
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1134
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1135
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
1006
1136
  readonly PATCH_REJECTED: "PATCH_REJECTED";
1007
1137
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1008
1138
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -1011,7 +1141,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1011
1141
  }, z.core.$strict>;
1012
1142
  }, z.core.$strict>;
1013
1143
  }, z.core.$strict>, z.ZodObject<{
1014
- schemaVersion: z.ZodLiteral<1>;
1144
+ schemaVersion: z.ZodLiteral<2>;
1015
1145
  sequence: z.ZodNumber;
1016
1146
  jobId: z.ZodString;
1017
1147
  status: z.ZodEnum<{
@@ -1035,7 +1165,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1035
1165
  message: z.ZodString;
1036
1166
  }, z.core.$strict>;
1037
1167
  }, z.core.$strict>, z.ZodObject<{
1038
- schemaVersion: z.ZodLiteral<1>;
1168
+ schemaVersion: z.ZodLiteral<2>;
1039
1169
  sequence: z.ZodNumber;
1040
1170
  jobId: z.ZodString;
1041
1171
  status: z.ZodEnum<{
@@ -1056,6 +1186,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1056
1186
  timestamp: z.ZodISODateTime;
1057
1187
  type: z.ZodLiteral<"tool">;
1058
1188
  data: z.ZodObject<{
1189
+ turn: z.ZodNumber;
1059
1190
  toolCallId: z.ZodString;
1060
1191
  toolName: z.ZodString;
1061
1192
  state: z.ZodEnum<{
@@ -1067,7 +1198,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1067
1198
  checkLabel: z.ZodOptional<z.ZodString>;
1068
1199
  }, z.core.$strict>;
1069
1200
  }, z.core.$strict>, z.ZodObject<{
1070
- schemaVersion: z.ZodLiteral<1>;
1201
+ schemaVersion: z.ZodLiteral<2>;
1071
1202
  sequence: z.ZodNumber;
1072
1203
  jobId: z.ZodString;
1073
1204
  status: z.ZodEnum<{
@@ -1102,7 +1233,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1102
1233
  }, z.core.$strict>;
1103
1234
  }, z.core.$strict>;
1104
1235
  }, z.core.$strict>, z.ZodObject<{
1105
- schemaVersion: z.ZodLiteral<1>;
1236
+ schemaVersion: z.ZodLiteral<2>;
1106
1237
  sequence: z.ZodNumber;
1107
1238
  jobId: z.ZodString;
1108
1239
  status: z.ZodEnum<{
@@ -1126,7 +1257,7 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1126
1257
  hasResult: z.ZodLiteral<true>;
1127
1258
  }, z.core.$strict>;
1128
1259
  }, z.core.$strict>, z.ZodObject<{
1129
- schemaVersion: z.ZodLiteral<1>;
1260
+ schemaVersion: z.ZodLiteral<2>;
1130
1261
  sequence: z.ZodNumber;
1131
1262
  jobId: z.ZodString;
1132
1263
  status: z.ZodEnum<{
@@ -1166,7 +1297,17 @@ declare const agentJobEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1166
1297
  readonly AGENT_LIMIT_EXCEEDED: "AGENT_LIMIT_EXCEEDED";
1167
1298
  readonly AGENT_CANCELLED: "AGENT_CANCELLED";
1168
1299
  readonly WORKTREE_DIRTY: "WORKTREE_DIRTY";
1300
+ readonly WORKTREE_NOT_REPOSITORY: "WORKTREE_NOT_REPOSITORY";
1301
+ readonly WORKTREE_OPERATION_IN_PROGRESS: "WORKTREE_OPERATION_IN_PROGRESS";
1302
+ readonly WORKTREE_CONFLICTED: "WORKTREE_CONFLICTED";
1303
+ readonly WORKTREE_LOCAL_CHANGES_TOO_LARGE: "WORKTREE_LOCAL_CHANGES_TOO_LARGE";
1304
+ readonly WORKTREE_UNTRACKED_UNSUPPORTED: "WORKTREE_UNTRACKED_UNSUPPORTED";
1305
+ readonly WORKTREE_LOCAL_CHANGES_UNSUPPORTED: "WORKTREE_LOCAL_CHANGES_UNSUPPORTED";
1169
1306
  readonly TOOL_DENIED: "TOOL_DENIED";
1307
+ readonly TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID";
1308
+ readonly TOOL_ARGUMENTS_INVALID: "TOOL_ARGUMENTS_INVALID";
1309
+ readonly TOOL_CALL_ID_CONFLICT: "TOOL_CALL_ID_CONFLICT";
1310
+ readonly TOOL_PATH_DENIED: "TOOL_PATH_DENIED";
1170
1311
  readonly PATCH_REJECTED: "PATCH_REJECTED";
1171
1312
  readonly VALIDATION_FAILED: "VALIDATION_FAILED";
1172
1313
  readonly APPLY_CONFLICT: "APPLY_CONFLICT";
@@ -1191,4 +1332,4 @@ type ApiResponse<T> = ApiSuccess<T> | ApiFailure;
1191
1332
 
1192
1333
  declare const SPOTPATCH_REPOSITORY_URL: "https://github.com/huanglvjing/spotpatch";
1193
1334
 
1194
- export { AGENT_CAPABILITY_STATES, AGENT_CHECK_STATUSES, AGENT_FILE_CHANGE_KINDS, AGENT_JOB_STATUSES, type AgentApplyMode, type AgentCapabilityRequest, type AgentCapabilitySnapshot, type AgentCapabilityState, type AgentChangedFile, type AgentCheckDefinition, type AgentCheckResult, type AgentCheckStatus, type AgentFileChangeKind, type AgentJobAction, type AgentJobCreateRequest, type AgentJobEvent, type AgentJobResult, type AgentJobResultResponse, type AgentJobSnapshot, type AgentJobStatus, type AgentLimits, type AiExecutionOptions, type AiModelProfile, type AiOptions, type AiProviderAuthentication, type AiProviderProtocol, type ApiFailure, type ApiResponse, type ApiSuccess, type CodeContext, type ContextBudget, DEFAULT_AGENT_LIMITS, ERROR_CODES, type EditorOpenResult, type ElementContext, type ErrorCode, MAX_ANNOTATION_INSTRUCTION_CHARACTERS, MAX_ANNOTATION_TARGETS, MAX_TARGET_INSTRUCTION_CHARACTERS, type MatchedStyleRule, type OpenAICompatibleProviderOptions, type OpenEditorRequest, type PageContext, type ReactContext, type ResolvedAgentCheckDefinition, type ResolvedAiExecutionOptions, type ResolvedAiModelProfile, type ResolvedAiOptions, type ResolvedOpenAICompatibleProviderOptions, type RuntimeAiConfig, type RuntimeAiModelProfile, type RuntimeAiProviderProfile, SOURCE_MARKER_ATTRIBUTE, SPOTPATCH_API_BASE, SPOTPATCH_EDITOR_PREFERENCES, SPOTPATCH_ENDPOINTS, SPOTPATCH_LOCALES, SPOTPATCH_LOCALE_PREFERENCES, SPOTPATCH_REPOSITORY_URL, SPOTPATCH_TOKEN_HEADER, type SourceConfidence, type SourceContextRequest, type SourceMarker, type SourceOrigin, type SourceRef, type SpotAnnotation, type SpotPatchEditorPreference, SpotPatchError, type SpotPatchLocale, type SpotPatchLocalePreference, type SpotTargetContext, type StyleContext, agentCapabilityRequestSchema, agentCapabilitySnapshotSchema, agentChangedFileSchema, agentCheckResultSchema, agentJobActionRequestSchema, agentJobCreateRequestSchema, agentJobEventSchema, agentJobResultResponseSchema, agentJobResultSchema, agentJobSnapshotSchema, formatSourceMarker, getAgentJobEndpoint, isSensitiveName, openEditorRequestSchema, parseSourceMarker, redactSensitiveText, sanitizeUrl, sourceContextRequestSchema, spotAnnotationRequestSchema, spotTargetContextRequestSchema };
1335
+ export { AGENT_CAPABILITY_STATES, AGENT_CHECK_STATUSES, AGENT_FILE_CHANGE_KINDS, AGENT_JOB_STATUSES, AGENT_WORKSPACE_SNAPSHOT_LIMITS, AGENT_WORKSPACE_STATES, type AgentApplyMode, type AgentCapabilityRequest, type AgentCapabilitySnapshot, type AgentCapabilityState, type AgentChangedFile, type AgentCheckDefinition, type AgentCheckResult, type AgentCheckStatus, type AgentFileChangeKind, type AgentJobAction, type AgentJobCreateRequest, type AgentJobEvent, type AgentJobResult, type AgentJobResultResponse, type AgentJobSnapshot, type AgentJobStatus, type AgentLimits, type AgentWorkingTreeMode, type AgentWorkspaceChangeSummary, type AgentWorkspaceHealthSnapshot, type AgentWorkspaceState, type AiExecutionOptions, type AiModelProfile, type AiOptions, type AiProviderAuthentication, type AiProviderProtocol, type ApiFailure, type ApiResponse, type ApiSuccess, type CodeContext, type ContextBudget, DEFAULT_AGENT_LIMITS, ERROR_CODES, type EditorOpenResult, type ElementContext, type ErrorCode, MAX_ANNOTATION_INSTRUCTION_CHARACTERS, MAX_ANNOTATION_TARGETS, MAX_TARGET_INSTRUCTION_CHARACTERS, type MatchedStyleRule, type OpenAICompatibleProviderOptions, type OpenEditorRequest, type PageContext, type ReactContext, type ResolvedAgentCheckDefinition, type ResolvedAiExecutionOptions, type ResolvedAiModelProfile, type ResolvedAiOptions, type ResolvedOpenAICompatibleProviderOptions, type RuntimeAiConfig, type RuntimeAiModelProfile, type RuntimeAiProviderProfile, SOURCE_MARKER_ATTRIBUTE, SPOTPATCH_API_BASE, SPOTPATCH_EDITOR_PREFERENCES, SPOTPATCH_ENDPOINTS, SPOTPATCH_LOCALES, SPOTPATCH_LOCALE_PREFERENCES, SPOTPATCH_REPOSITORY_URL, SPOTPATCH_TOKEN_HEADER, type SourceConfidence, type SourceContextRequest, type SourceMarker, type SourceOrigin, type SourceRef, type SpotAnnotation, type SpotPatchEditorPreference, SpotPatchError, type SpotPatchLocale, type SpotPatchLocalePreference, type SpotTargetContext, type StyleContext, agentCapabilityRequestSchema, agentCapabilitySnapshotSchema, agentChangedFileSchema, agentCheckResultSchema, agentJobActionRequestSchema, agentJobCreateRequestSchema, agentJobEventSchema, agentJobResultResponseSchema, agentJobResultSchema, agentJobSnapshotSchema, agentWorkspaceHealthRequestSchema, agentWorkspaceHealthSnapshotSchema, formatSourceMarker, getAgentJobEndpoint, isSensitiveName, openEditorRequestSchema, parseSourceMarker, redactSensitiveText, sanitizeUrl, sourceContextRequestSchema, spotAnnotationRequestSchema, spotTargetContextRequestSchema };