@fixerorg/schemas 1.0.4 → 1.0.5

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
@@ -1780,7 +1780,98 @@ declare const AgentLogListResponseSchema: z.ZodObject<{
1780
1780
  pages: number;
1781
1781
  }>;
1782
1782
  type AgentLogListResponse = z.infer<typeof AgentLogListResponseSchema>;
1783
- /** 工作流 SSE 事件 */
1783
+ /** 后端发送的 SSE 事件类型 */
1784
+ declare const BACKEND_SSE_EVENT_TYPES: readonly ["status", "log", "complete", "error", "phase_complete"];
1785
+ /** 前端应监听的 SSE 事件类型 */
1786
+ declare const FRONTEND_SSE_EVENT_TYPES: readonly ["status", "log", "complete", "error", "phase_complete"];
1787
+ type BackendSSEEventType = typeof BACKEND_SSE_EVENT_TYPES[number];
1788
+ type FrontendSSEEventType = typeof FRONTEND_SSE_EVENT_TYPES[number];
1789
+ /** 单个 SSE 事件数据 Schema(用于验证后端发送的每个事件) */
1790
+ /** status 事件数据 */
1791
+ declare const SSEStatusDataSchema: z.ZodObject<{
1792
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1793
+ phase: z.ZodNullable<z.ZodString>;
1794
+ previousState: z.ZodOptional<z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>>;
1795
+ }, "strip", z.ZodTypeAny, {
1796
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1797
+ phase: string | null;
1798
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1799
+ }, {
1800
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1801
+ phase: string | null;
1802
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1803
+ }>;
1804
+ type SSEStatusData = z.infer<typeof SSEStatusDataSchema>;
1805
+ /** log 事件数据 */
1806
+ declare const SSELogDataSchema: z.ZodObject<{
1807
+ id: z.ZodNumber;
1808
+ workflowId: z.ZodNumber;
1809
+ agent: z.ZodString;
1810
+ phase: z.ZodString;
1811
+ level: z.ZodEnum<["info", "warn", "error"]>;
1812
+ message: z.ZodString;
1813
+ data: z.ZodNullable<z.ZodUnknown>;
1814
+ timestamp: z.ZodDate;
1815
+ }, "strip", z.ZodTypeAny, {
1816
+ message: string;
1817
+ id: number;
1818
+ workflowId: number;
1819
+ phase: string;
1820
+ agent: string;
1821
+ level: "error" | "info" | "warn";
1822
+ timestamp: Date;
1823
+ data?: unknown;
1824
+ }, {
1825
+ message: string;
1826
+ id: number;
1827
+ workflowId: number;
1828
+ phase: string;
1829
+ agent: string;
1830
+ level: "error" | "info" | "warn";
1831
+ timestamp: Date;
1832
+ data?: unknown;
1833
+ }>;
1834
+ type SSELogData = z.infer<typeof SSELogDataSchema>;
1835
+ /** complete 事件数据 */
1836
+ declare const SSECompleteDataSchema: z.ZodObject<{
1837
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1838
+ result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
1839
+ }, "strip", z.ZodTypeAny, {
1840
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1841
+ result?: unknown;
1842
+ }, {
1843
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1844
+ result?: unknown;
1845
+ }>;
1846
+ type SSECompleteData = z.infer<typeof SSECompleteDataSchema>;
1847
+ /** error 事件数据 */
1848
+ declare const SSEErrorDataSchema: z.ZodObject<{
1849
+ message: z.ZodString;
1850
+ state: z.ZodOptional<z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>>;
1851
+ }, "strip", z.ZodTypeAny, {
1852
+ message: string;
1853
+ state?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1854
+ }, {
1855
+ message: string;
1856
+ state?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1857
+ }>;
1858
+ type SSEErrorData = z.infer<typeof SSEErrorDataSchema>;
1859
+ /** phase_complete 事件数据 */
1860
+ declare const SSEPhaseCompleteDataSchema: z.ZodObject<{
1861
+ phase: z.ZodString;
1862
+ result: z.ZodEnum<["approved", "rejected"]>;
1863
+ iterations: z.ZodOptional<z.ZodNumber>;
1864
+ }, "strip", z.ZodTypeAny, {
1865
+ phase: string;
1866
+ result: "approved" | "rejected";
1867
+ iterations?: number | undefined;
1868
+ }, {
1869
+ phase: string;
1870
+ result: "approved" | "rejected";
1871
+ iterations?: number | undefined;
1872
+ }>;
1873
+ type SSEPhaseCompleteData = z.infer<typeof SSEPhaseCompleteDataSchema>;
1874
+ /** 工作流 SSE 事件(完整事件结构) */
1784
1875
  declare const WorkflowSSEEventSchema: z.ZodUnion<[z.ZodObject<{
1785
1876
  type: z.ZodLiteral<"status">;
1786
1877
  data: z.ZodObject<{
@@ -1939,4 +2030,4 @@ declare const WorkflowSSEEventSchema: z.ZodUnion<[z.ZodObject<{
1939
2030
  }>]>;
1940
2031
  type WorkflowSSEEvent = z.infer<typeof WorkflowSSEEventSchema>;
1941
2032
 
1942
- export { AI, type AIChatRequest, AIChatRequestSchema, type AIChatResponse, AIChatResponseSchema, type AIMessage, AIMessageSchema, type AISessionResponse, AISessionResponseSchema, API_BASE, API_ROUTES, type AgentLogEntry, AgentLogEntrySchema, type AgentLogListResponse, AgentLogListResponseSchema, type Branch, type BranchOption, BranchOptionSchema, BranchSchema, ContentDeltaEventSchema, ErrorEventSchema, GITHUB, type GitHubBranchesResponse, GitHubBranchesResponseSchema, type GitHubReposResponse, GitHubReposResponseSchema, type GitHubVerifyRequest, GitHubVerifyRequestSchema, type GitHubVerifyResponse, GitHubVerifyResponseSchema, HEALTH, ISSUES, ISSUE_TEMPLATES, type IssueCreate, IssueCreateSchema, type IssueListResponse, IssueListResponseSchema, type IssuePriority, IssuePrioritySchema, type IssueResponse, IssueResponseSchema, type IssueStats, IssueStatsSchema, type IssueStatus, IssueStatusSchema, type IssueTemplate, type IssueTemplateListItem, IssueTemplateListItemSchema, type IssueTemplateListResponse, IssueTemplateListResponseSchema, IssueTemplateSchema, type IssueUpdate, IssueUpdateSchema, MessageDoneEventSchema, PROJECTS, PaginatedResponseSchema, type PaginationQuery, PaginationQuerySchema, type ProjectCreate, ProjectCreateSchema, type ProjectListResponse, ProjectListResponseSchema, type ProjectResponse, ProjectResponseSchema, type ProjectUpdate, ProjectUpdateSchema, type RepoOption, RepoOptionSchema, type Repository, RepositorySchema, type RetryOptions, RetryOptionsSchema, SETTINGS, type SSEEvent, SSEEventSchema, type SettingsResponse, SettingsResponseSchema, type SettingsUpdate, SettingsUpdateSchema, type SyncStatus, SyncStatusSchema, TASKS, type TaskCreate, TaskCreateSchema, type TaskListResponse, TaskListResponseSchema, type TaskResponse, TaskResponseSchema, type TaskStatus, TaskStatusSchema, type TaskUpdate, TaskUpdateSchema, ThinkingDeltaEventSchema, ThinkingEndEventSchema, ThinkingStartEventSchema, ToolResultEventSchema, ToolStartEventSchema, WORKTREE, type WorkflowSSEEvent, WorkflowSSEEventSchema, type WorkflowState, WorkflowStateSchema, type WorkflowStatusResponse, WorkflowStatusResponseSchema, type WorktreeCreateRequest, WorktreeCreateRequestSchema, type WorktreeDeleteRequest, WorktreeDeleteRequestSchema, type WorktreeStatus, type WorktreeStatusResponse, WorktreeStatusResponseSchema, WorktreeStatusSchema };
2033
+ export { AI, type AIChatRequest, AIChatRequestSchema, type AIChatResponse, AIChatResponseSchema, type AIMessage, AIMessageSchema, type AISessionResponse, AISessionResponseSchema, API_BASE, API_ROUTES, type AgentLogEntry, AgentLogEntrySchema, type AgentLogListResponse, AgentLogListResponseSchema, BACKEND_SSE_EVENT_TYPES, type BackendSSEEventType, type Branch, type BranchOption, BranchOptionSchema, BranchSchema, ContentDeltaEventSchema, ErrorEventSchema, FRONTEND_SSE_EVENT_TYPES, type FrontendSSEEventType, GITHUB, type GitHubBranchesResponse, GitHubBranchesResponseSchema, type GitHubReposResponse, GitHubReposResponseSchema, type GitHubVerifyRequest, GitHubVerifyRequestSchema, type GitHubVerifyResponse, GitHubVerifyResponseSchema, HEALTH, ISSUES, ISSUE_TEMPLATES, type IssueCreate, IssueCreateSchema, type IssueListResponse, IssueListResponseSchema, type IssuePriority, IssuePrioritySchema, type IssueResponse, IssueResponseSchema, type IssueStats, IssueStatsSchema, type IssueStatus, IssueStatusSchema, type IssueTemplate, type IssueTemplateListItem, IssueTemplateListItemSchema, type IssueTemplateListResponse, IssueTemplateListResponseSchema, IssueTemplateSchema, type IssueUpdate, IssueUpdateSchema, MessageDoneEventSchema, PROJECTS, PaginatedResponseSchema, type PaginationQuery, PaginationQuerySchema, type ProjectCreate, ProjectCreateSchema, type ProjectListResponse, ProjectListResponseSchema, type ProjectResponse, ProjectResponseSchema, type ProjectUpdate, ProjectUpdateSchema, type RepoOption, RepoOptionSchema, type Repository, RepositorySchema, type RetryOptions, RetryOptionsSchema, SETTINGS, type SSECompleteData, SSECompleteDataSchema, type SSEErrorData, SSEErrorDataSchema, type SSEEvent, SSEEventSchema, type SSELogData, SSELogDataSchema, type SSEPhaseCompleteData, SSEPhaseCompleteDataSchema, type SSEStatusData, SSEStatusDataSchema, type SettingsResponse, SettingsResponseSchema, type SettingsUpdate, SettingsUpdateSchema, type SyncStatus, SyncStatusSchema, TASKS, type TaskCreate, TaskCreateSchema, type TaskListResponse, TaskListResponseSchema, type TaskResponse, TaskResponseSchema, type TaskStatus, TaskStatusSchema, type TaskUpdate, TaskUpdateSchema, ThinkingDeltaEventSchema, ThinkingEndEventSchema, ThinkingStartEventSchema, ToolResultEventSchema, ToolStartEventSchema, WORKTREE, type WorkflowSSEEvent, WorkflowSSEEventSchema, type WorkflowState, WorkflowStateSchema, type WorkflowStatusResponse, WorkflowStatusResponseSchema, type WorktreeCreateRequest, WorktreeCreateRequestSchema, type WorktreeDeleteRequest, WorktreeDeleteRequestSchema, type WorktreeStatus, type WorktreeStatusResponse, WorktreeStatusResponseSchema, WorktreeStatusSchema };
package/dist/index.js CHANGED
@@ -450,6 +450,39 @@ var AgentLogEntrySchema = z11.object({
450
450
  timestamp: z11.coerce.date()
451
451
  });
452
452
  var AgentLogListResponseSchema = PaginatedResponseSchema(AgentLogEntrySchema);
453
+ var BACKEND_SSE_EVENT_TYPES = [
454
+ "status",
455
+ "log",
456
+ "complete",
457
+ "error",
458
+ "phase_complete"
459
+ ];
460
+ var FRONTEND_SSE_EVENT_TYPES = [
461
+ "status",
462
+ "log",
463
+ "complete",
464
+ "error",
465
+ "phase_complete"
466
+ ];
467
+ var SSEStatusDataSchema = z11.object({
468
+ state: WorkflowStateSchema,
469
+ phase: z11.string().nullable(),
470
+ previousState: WorkflowStateSchema.optional()
471
+ });
472
+ var SSELogDataSchema = AgentLogEntrySchema;
473
+ var SSECompleteDataSchema = z11.object({
474
+ state: WorkflowStateSchema,
475
+ result: z11.unknown().nullable().optional()
476
+ });
477
+ var SSEErrorDataSchema = z11.object({
478
+ message: z11.string(),
479
+ state: WorkflowStateSchema.optional()
480
+ });
481
+ var SSEPhaseCompleteDataSchema = z11.object({
482
+ phase: z11.string(),
483
+ result: z11.enum(["approved", "rejected"]),
484
+ iterations: z11.number().optional()
485
+ });
453
486
  var WorkflowSSEEventSchema = z11.union([
454
487
  // 状态变更事件
455
488
  z11.object({
@@ -500,10 +533,12 @@ export {
500
533
  API_ROUTES,
501
534
  AgentLogEntrySchema,
502
535
  AgentLogListResponseSchema,
536
+ BACKEND_SSE_EVENT_TYPES,
503
537
  BranchOptionSchema,
504
538
  BranchSchema,
505
539
  ContentDeltaEventSchema,
506
540
  ErrorEventSchema,
541
+ FRONTEND_SSE_EVENT_TYPES,
507
542
  GITHUB,
508
543
  GitHubBranchesResponseSchema,
509
544
  GitHubReposResponseSchema,
@@ -534,7 +569,12 @@ export {
534
569
  RepositorySchema,
535
570
  RetryOptionsSchema,
536
571
  SETTINGS,
572
+ SSECompleteDataSchema,
573
+ SSEErrorDataSchema,
537
574
  SSEEventSchema,
575
+ SSELogDataSchema,
576
+ SSEPhaseCompleteDataSchema,
577
+ SSEStatusDataSchema,
538
578
  SettingsResponseSchema,
539
579
  SettingsUpdateSchema,
540
580
  SyncStatusSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fixerorg/schemas",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Shared schemas for Fixer - AI-powered Issue Management System",
5
5
  "author": "zhangyingwei",
6
6
  "license": "MIT",
@@ -29,10 +29,13 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "tsup": "^8.0.0",
32
- "typescript": "^5.7.0"
32
+ "typescript": "^5.7.0",
33
+ "vitest": "^4.1.0"
33
34
  },
34
35
  "scripts": {
35
36
  "build": "tsup src/index.ts --format esm --dts",
36
- "dev": "tsup src/index.ts --format esm --dts --watch"
37
+ "dev": "tsup src/index.ts --format esm --dts --watch",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest"
37
40
  }
38
41
  }