@fixerorg/schemas 1.0.1 → 1.0.3

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
@@ -55,10 +55,14 @@ declare const TASKS: {
55
55
  readonly detail: (taskId: string | number) => string;
56
56
  /** 更新 Task */
57
57
  readonly update: (taskId: string | number) => string;
58
+ /** 启动/重新启动工作流 */
59
+ readonly start: (taskId: string | number) => string;
58
60
  /** 取消 Task */
59
61
  readonly cancel: (taskId: string | number) => string;
60
62
  /** 删除 Task */
61
63
  readonly delete: (taskId: string | number) => string;
64
+ /** SSE 实时推送工作流状态 */
65
+ readonly stream: (taskId: string | number) => string;
62
66
  };
63
67
  declare const GITHUB: {
64
68
  /** 获取仓库列表 */
@@ -415,6 +419,50 @@ declare const TaskResponseSchema: z.ZodObject<{
415
419
  completedAt: z.ZodNullable<z.ZodDate>;
416
420
  createdAt: z.ZodDate;
417
421
  updatedAt: z.ZodDate;
422
+ issue: z.ZodOptional<z.ZodNullable<z.ZodObject<{
423
+ issueId: z.ZodString;
424
+ title: z.ZodString;
425
+ description: z.ZodNullable<z.ZodString>;
426
+ status: z.ZodEnum<["open", "in_progress", "in_review", "done"]>;
427
+ priority: z.ZodEnum<["high", "medium", "low"]>;
428
+ tags: z.ZodNullable<z.ZodString>;
429
+ projectId: z.ZodString;
430
+ createdAt: z.ZodDate;
431
+ updatedAt: z.ZodDate;
432
+ project: z.ZodNullable<z.ZodObject<{
433
+ name: z.ZodString;
434
+ }, "strip", z.ZodTypeAny, {
435
+ name: string;
436
+ }, {
437
+ name: string;
438
+ }>>;
439
+ }, "strip", z.ZodTypeAny, {
440
+ status: "open" | "in_progress" | "in_review" | "done";
441
+ projectId: string;
442
+ description: string | null;
443
+ createdAt: Date;
444
+ updatedAt: Date;
445
+ issueId: string;
446
+ title: string;
447
+ priority: "high" | "medium" | "low";
448
+ tags: string | null;
449
+ project: {
450
+ name: string;
451
+ } | null;
452
+ }, {
453
+ status: "open" | "in_progress" | "in_review" | "done";
454
+ projectId: string;
455
+ description: string | null;
456
+ createdAt: Date;
457
+ updatedAt: Date;
458
+ issueId: string;
459
+ title: string;
460
+ priority: "high" | "medium" | "low";
461
+ tags: string | null;
462
+ project: {
463
+ name: string;
464
+ } | null;
465
+ }>>>;
418
466
  }, "strip", z.ZodTypeAny, {
419
467
  status: "error" | "pending" | "active" | "completed" | "cancelled";
420
468
  id: number;
@@ -425,6 +473,20 @@ declare const TaskResponseSchema: z.ZodObject<{
425
473
  startedAt: Date | null;
426
474
  completedAt: Date | null;
427
475
  output?: unknown;
476
+ issue?: {
477
+ status: "open" | "in_progress" | "in_review" | "done";
478
+ projectId: string;
479
+ description: string | null;
480
+ createdAt: Date;
481
+ updatedAt: Date;
482
+ issueId: string;
483
+ title: string;
484
+ priority: "high" | "medium" | "low";
485
+ tags: string | null;
486
+ project: {
487
+ name: string;
488
+ } | null;
489
+ } | null | undefined;
428
490
  }, {
429
491
  status: "error" | "pending" | "active" | "completed" | "cancelled";
430
492
  id: number;
@@ -435,6 +497,20 @@ declare const TaskResponseSchema: z.ZodObject<{
435
497
  startedAt: Date | null;
436
498
  completedAt: Date | null;
437
499
  output?: unknown;
500
+ issue?: {
501
+ status: "open" | "in_progress" | "in_review" | "done";
502
+ projectId: string;
503
+ description: string | null;
504
+ createdAt: Date;
505
+ updatedAt: Date;
506
+ issueId: string;
507
+ title: string;
508
+ priority: "high" | "medium" | "low";
509
+ tags: string | null;
510
+ project: {
511
+ name: string;
512
+ } | null;
513
+ } | null | undefined;
438
514
  }>;
439
515
  type TaskResponse = z.infer<typeof TaskResponseSchema>;
440
516
  /** 创建 Task */
@@ -472,6 +548,50 @@ declare const TaskListResponseSchema: z.ZodObject<{
472
548
  completedAt: z.ZodNullable<z.ZodDate>;
473
549
  createdAt: z.ZodDate;
474
550
  updatedAt: z.ZodDate;
551
+ issue: z.ZodOptional<z.ZodNullable<z.ZodObject<{
552
+ issueId: z.ZodString;
553
+ title: z.ZodString;
554
+ description: z.ZodNullable<z.ZodString>;
555
+ status: z.ZodEnum<["open", "in_progress", "in_review", "done"]>;
556
+ priority: z.ZodEnum<["high", "medium", "low"]>;
557
+ tags: z.ZodNullable<z.ZodString>;
558
+ projectId: z.ZodString;
559
+ createdAt: z.ZodDate;
560
+ updatedAt: z.ZodDate;
561
+ project: z.ZodNullable<z.ZodObject<{
562
+ name: z.ZodString;
563
+ }, "strip", z.ZodTypeAny, {
564
+ name: string;
565
+ }, {
566
+ name: string;
567
+ }>>;
568
+ }, "strip", z.ZodTypeAny, {
569
+ status: "open" | "in_progress" | "in_review" | "done";
570
+ projectId: string;
571
+ description: string | null;
572
+ createdAt: Date;
573
+ updatedAt: Date;
574
+ issueId: string;
575
+ title: string;
576
+ priority: "high" | "medium" | "low";
577
+ tags: string | null;
578
+ project: {
579
+ name: string;
580
+ } | null;
581
+ }, {
582
+ status: "open" | "in_progress" | "in_review" | "done";
583
+ projectId: string;
584
+ description: string | null;
585
+ createdAt: Date;
586
+ updatedAt: Date;
587
+ issueId: string;
588
+ title: string;
589
+ priority: "high" | "medium" | "low";
590
+ tags: string | null;
591
+ project: {
592
+ name: string;
593
+ } | null;
594
+ }>>>;
475
595
  }, "strip", z.ZodTypeAny, {
476
596
  status: "error" | "pending" | "active" | "completed" | "cancelled";
477
597
  id: number;
@@ -482,6 +602,20 @@ declare const TaskListResponseSchema: z.ZodObject<{
482
602
  startedAt: Date | null;
483
603
  completedAt: Date | null;
484
604
  output?: unknown;
605
+ issue?: {
606
+ status: "open" | "in_progress" | "in_review" | "done";
607
+ projectId: string;
608
+ description: string | null;
609
+ createdAt: Date;
610
+ updatedAt: Date;
611
+ issueId: string;
612
+ title: string;
613
+ priority: "high" | "medium" | "low";
614
+ tags: string | null;
615
+ project: {
616
+ name: string;
617
+ } | null;
618
+ } | null | undefined;
485
619
  }, {
486
620
  status: "error" | "pending" | "active" | "completed" | "cancelled";
487
621
  id: number;
@@ -492,6 +626,20 @@ declare const TaskListResponseSchema: z.ZodObject<{
492
626
  startedAt: Date | null;
493
627
  completedAt: Date | null;
494
628
  output?: unknown;
629
+ issue?: {
630
+ status: "open" | "in_progress" | "in_review" | "done";
631
+ projectId: string;
632
+ description: string | null;
633
+ createdAt: Date;
634
+ updatedAt: Date;
635
+ issueId: string;
636
+ title: string;
637
+ priority: "high" | "medium" | "low";
638
+ tags: string | null;
639
+ project: {
640
+ name: string;
641
+ } | null;
642
+ } | null | undefined;
495
643
  }>, "many">;
496
644
  total: z.ZodNumber;
497
645
  page: z.ZodNumber;
@@ -510,6 +658,20 @@ declare const TaskListResponseSchema: z.ZodObject<{
510
658
  startedAt: Date | null;
511
659
  completedAt: Date | null;
512
660
  output?: unknown;
661
+ issue?: {
662
+ status: "open" | "in_progress" | "in_review" | "done";
663
+ projectId: string;
664
+ description: string | null;
665
+ createdAt: Date;
666
+ updatedAt: Date;
667
+ issueId: string;
668
+ title: string;
669
+ priority: "high" | "medium" | "low";
670
+ tags: string | null;
671
+ project: {
672
+ name: string;
673
+ } | null;
674
+ } | null | undefined;
513
675
  }[];
514
676
  total: number;
515
677
  pages: number;
@@ -526,6 +688,20 @@ declare const TaskListResponseSchema: z.ZodObject<{
526
688
  startedAt: Date | null;
527
689
  completedAt: Date | null;
528
690
  output?: unknown;
691
+ issue?: {
692
+ status: "open" | "in_progress" | "in_review" | "done";
693
+ projectId: string;
694
+ description: string | null;
695
+ createdAt: Date;
696
+ updatedAt: Date;
697
+ issueId: string;
698
+ title: string;
699
+ priority: "high" | "medium" | "low";
700
+ tags: string | null;
701
+ project: {
702
+ name: string;
703
+ } | null;
704
+ } | null | undefined;
529
705
  }[];
530
706
  total: number;
531
707
  pages: number;
@@ -1373,4 +1549,394 @@ declare const WorktreeStatusResponseSchema: z.ZodObject<{
1373
1549
  }>;
1374
1550
  type WorktreeStatusResponse = z.infer<typeof WorktreeStatusResponseSchema>;
1375
1551
 
1376
- export { AI, type AIChatRequest, AIChatRequestSchema, type AIChatResponse, AIChatResponseSchema, type AIMessage, AIMessageSchema, type AISessionResponse, AISessionResponseSchema, API_BASE, API_ROUTES, 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 WorktreeCreateRequest, WorktreeCreateRequestSchema, type WorktreeDeleteRequest, WorktreeDeleteRequestSchema, type WorktreeStatus, type WorktreeStatusResponse, WorktreeStatusResponseSchema, WorktreeStatusSchema };
1552
+ /**
1553
+ * Code Factory 工作流 Schema 定义
1554
+ */
1555
+
1556
+ declare const WorkflowStateSchema: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1557
+ type WorkflowState = z.infer<typeof WorkflowStateSchema>;
1558
+ /** 工作流状态响应 */
1559
+ declare const WorkflowStatusResponseSchema: z.ZodObject<{
1560
+ workflowId: z.ZodNumber;
1561
+ taskId: z.ZodNumber;
1562
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1563
+ phase: z.ZodNullable<z.ZodString>;
1564
+ currentAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1565
+ progress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1566
+ phase: z.ZodString;
1567
+ current: z.ZodNumber;
1568
+ total: z.ZodNumber;
1569
+ percentage: z.ZodNumber;
1570
+ }, "strip", z.ZodTypeAny, {
1571
+ total: number;
1572
+ phase: string;
1573
+ current: number;
1574
+ percentage: number;
1575
+ }, {
1576
+ total: number;
1577
+ phase: string;
1578
+ current: number;
1579
+ percentage: number;
1580
+ }>>>;
1581
+ iterations: z.ZodOptional<z.ZodObject<{
1582
+ design: z.ZodNumber;
1583
+ plan: z.ZodNumber;
1584
+ task: z.ZodRecord<z.ZodString, z.ZodNumber>;
1585
+ finalTest: z.ZodNumber;
1586
+ }, "strip", z.ZodTypeAny, {
1587
+ design: number;
1588
+ plan: number;
1589
+ task: Record<string, number>;
1590
+ finalTest: number;
1591
+ }, {
1592
+ design: number;
1593
+ plan: number;
1594
+ task: Record<string, number>;
1595
+ finalTest: number;
1596
+ }>>;
1597
+ taskExecutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
1598
+ taskId: z.ZodString;
1599
+ title: z.ZodString;
1600
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
1601
+ attempts: z.ZodNumber;
1602
+ }, "strip", z.ZodTypeAny, {
1603
+ status: "in_progress" | "pending" | "completed" | "failed" | "skipped";
1604
+ title: string;
1605
+ taskId: string;
1606
+ attempts: number;
1607
+ }, {
1608
+ status: "in_progress" | "pending" | "completed" | "failed" | "skipped";
1609
+ title: string;
1610
+ taskId: string;
1611
+ attempts: number;
1612
+ }>, "many">>;
1613
+ agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
1614
+ role: z.ZodString;
1615
+ status: z.ZodEnum<["idle", "active", "done"]>;
1616
+ }, "strip", z.ZodTypeAny, {
1617
+ status: "done" | "active" | "idle";
1618
+ role: string;
1619
+ }, {
1620
+ status: "done" | "active" | "idle";
1621
+ role: string;
1622
+ }>, "many">>;
1623
+ createdAt: z.ZodDate;
1624
+ updatedAt: z.ZodDate;
1625
+ }, "strip", z.ZodTypeAny, {
1626
+ createdAt: Date;
1627
+ updatedAt: Date;
1628
+ workflowId: number;
1629
+ taskId: number;
1630
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1631
+ phase: string | null;
1632
+ currentAgent?: string | null | undefined;
1633
+ progress?: {
1634
+ total: number;
1635
+ phase: string;
1636
+ current: number;
1637
+ percentage: number;
1638
+ } | null | undefined;
1639
+ iterations?: {
1640
+ design: number;
1641
+ plan: number;
1642
+ task: Record<string, number>;
1643
+ finalTest: number;
1644
+ } | undefined;
1645
+ taskExecutions?: {
1646
+ status: "in_progress" | "pending" | "completed" | "failed" | "skipped";
1647
+ title: string;
1648
+ taskId: string;
1649
+ attempts: number;
1650
+ }[] | undefined;
1651
+ agents?: {
1652
+ status: "done" | "active" | "idle";
1653
+ role: string;
1654
+ }[] | undefined;
1655
+ }, {
1656
+ createdAt: Date;
1657
+ updatedAt: Date;
1658
+ workflowId: number;
1659
+ taskId: number;
1660
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1661
+ phase: string | null;
1662
+ currentAgent?: string | null | undefined;
1663
+ progress?: {
1664
+ total: number;
1665
+ phase: string;
1666
+ current: number;
1667
+ percentage: number;
1668
+ } | null | undefined;
1669
+ iterations?: {
1670
+ design: number;
1671
+ plan: number;
1672
+ task: Record<string, number>;
1673
+ finalTest: number;
1674
+ } | undefined;
1675
+ taskExecutions?: {
1676
+ status: "in_progress" | "pending" | "completed" | "failed" | "skipped";
1677
+ title: string;
1678
+ taskId: string;
1679
+ attempts: number;
1680
+ }[] | undefined;
1681
+ agents?: {
1682
+ status: "done" | "active" | "idle";
1683
+ role: string;
1684
+ }[] | undefined;
1685
+ }>;
1686
+ type WorkflowStatusResponse = z.infer<typeof WorkflowStatusResponseSchema>;
1687
+ /** Agent 日志条目 */
1688
+ declare const AgentLogEntrySchema: z.ZodObject<{
1689
+ id: z.ZodNumber;
1690
+ workflowId: z.ZodNumber;
1691
+ agent: z.ZodString;
1692
+ phase: z.ZodString;
1693
+ level: z.ZodEnum<["info", "warn", "error"]>;
1694
+ message: z.ZodString;
1695
+ data: z.ZodNullable<z.ZodUnknown>;
1696
+ timestamp: z.ZodDate;
1697
+ }, "strip", z.ZodTypeAny, {
1698
+ message: string;
1699
+ id: number;
1700
+ workflowId: number;
1701
+ phase: string;
1702
+ agent: string;
1703
+ level: "error" | "info" | "warn";
1704
+ timestamp: Date;
1705
+ data?: unknown;
1706
+ }, {
1707
+ message: string;
1708
+ id: number;
1709
+ workflowId: number;
1710
+ phase: string;
1711
+ agent: string;
1712
+ level: "error" | "info" | "warn";
1713
+ timestamp: Date;
1714
+ data?: unknown;
1715
+ }>;
1716
+ type AgentLogEntry = z.infer<typeof AgentLogEntrySchema>;
1717
+ /** Agent 日志列表响应 */
1718
+ declare const AgentLogListResponseSchema: z.ZodObject<{
1719
+ items: z.ZodArray<z.ZodObject<{
1720
+ id: z.ZodNumber;
1721
+ workflowId: z.ZodNumber;
1722
+ agent: z.ZodString;
1723
+ phase: z.ZodString;
1724
+ level: z.ZodEnum<["info", "warn", "error"]>;
1725
+ message: z.ZodString;
1726
+ data: z.ZodNullable<z.ZodUnknown>;
1727
+ timestamp: z.ZodDate;
1728
+ }, "strip", z.ZodTypeAny, {
1729
+ message: string;
1730
+ id: number;
1731
+ workflowId: number;
1732
+ phase: string;
1733
+ agent: string;
1734
+ level: "error" | "info" | "warn";
1735
+ timestamp: Date;
1736
+ data?: unknown;
1737
+ }, {
1738
+ message: string;
1739
+ id: number;
1740
+ workflowId: number;
1741
+ phase: string;
1742
+ agent: string;
1743
+ level: "error" | "info" | "warn";
1744
+ timestamp: Date;
1745
+ data?: unknown;
1746
+ }>, "many">;
1747
+ total: z.ZodNumber;
1748
+ page: z.ZodNumber;
1749
+ per_page: z.ZodNumber;
1750
+ pages: z.ZodNumber;
1751
+ }, "strip", z.ZodTypeAny, {
1752
+ page: number;
1753
+ per_page: number;
1754
+ items: {
1755
+ message: string;
1756
+ id: number;
1757
+ workflowId: number;
1758
+ phase: string;
1759
+ agent: string;
1760
+ level: "error" | "info" | "warn";
1761
+ timestamp: Date;
1762
+ data?: unknown;
1763
+ }[];
1764
+ total: number;
1765
+ pages: number;
1766
+ }, {
1767
+ page: number;
1768
+ per_page: number;
1769
+ items: {
1770
+ message: string;
1771
+ id: number;
1772
+ workflowId: number;
1773
+ phase: string;
1774
+ agent: string;
1775
+ level: "error" | "info" | "warn";
1776
+ timestamp: Date;
1777
+ data?: unknown;
1778
+ }[];
1779
+ total: number;
1780
+ pages: number;
1781
+ }>;
1782
+ type AgentLogListResponse = z.infer<typeof AgentLogListResponseSchema>;
1783
+ /** 工作流 SSE 事件 */
1784
+ declare const WorkflowSSEEventSchema: z.ZodUnion<[z.ZodObject<{
1785
+ type: z.ZodLiteral<"status">;
1786
+ data: z.ZodObject<{
1787
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1788
+ phase: z.ZodNullable<z.ZodString>;
1789
+ 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"]>>;
1790
+ }, "strip", z.ZodTypeAny, {
1791
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1792
+ phase: string | null;
1793
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1794
+ }, {
1795
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1796
+ phase: string | null;
1797
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1798
+ }>;
1799
+ }, "strip", z.ZodTypeAny, {
1800
+ type: "status";
1801
+ data: {
1802
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1803
+ phase: string | null;
1804
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1805
+ };
1806
+ }, {
1807
+ type: "status";
1808
+ data: {
1809
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1810
+ phase: string | null;
1811
+ previousState?: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED" | undefined;
1812
+ };
1813
+ }>, z.ZodObject<{
1814
+ type: z.ZodLiteral<"agent_status">;
1815
+ data: z.ZodObject<{
1816
+ agent: z.ZodString;
1817
+ status: z.ZodEnum<["idle", "active", "done"]>;
1818
+ }, "strip", z.ZodTypeAny, {
1819
+ status: "done" | "active" | "idle";
1820
+ agent: string;
1821
+ }, {
1822
+ status: "done" | "active" | "idle";
1823
+ agent: string;
1824
+ }>;
1825
+ }, "strip", z.ZodTypeAny, {
1826
+ type: "agent_status";
1827
+ data: {
1828
+ status: "done" | "active" | "idle";
1829
+ agent: string;
1830
+ };
1831
+ }, {
1832
+ type: "agent_status";
1833
+ data: {
1834
+ status: "done" | "active" | "idle";
1835
+ agent: string;
1836
+ };
1837
+ }>, z.ZodObject<{
1838
+ type: z.ZodLiteral<"log">;
1839
+ data: z.ZodObject<{
1840
+ id: z.ZodNumber;
1841
+ workflowId: z.ZodNumber;
1842
+ agent: z.ZodString;
1843
+ phase: z.ZodString;
1844
+ level: z.ZodEnum<["info", "warn", "error"]>;
1845
+ message: z.ZodString;
1846
+ data: z.ZodNullable<z.ZodUnknown>;
1847
+ timestamp: z.ZodDate;
1848
+ }, "strip", z.ZodTypeAny, {
1849
+ message: string;
1850
+ id: number;
1851
+ workflowId: number;
1852
+ phase: string;
1853
+ agent: string;
1854
+ level: "error" | "info" | "warn";
1855
+ timestamp: Date;
1856
+ data?: unknown;
1857
+ }, {
1858
+ message: string;
1859
+ id: number;
1860
+ workflowId: number;
1861
+ phase: string;
1862
+ agent: string;
1863
+ level: "error" | "info" | "warn";
1864
+ timestamp: Date;
1865
+ data?: unknown;
1866
+ }>;
1867
+ }, "strip", z.ZodTypeAny, {
1868
+ type: "log";
1869
+ data: {
1870
+ message: string;
1871
+ id: number;
1872
+ workflowId: number;
1873
+ phase: string;
1874
+ agent: string;
1875
+ level: "error" | "info" | "warn";
1876
+ timestamp: Date;
1877
+ data?: unknown;
1878
+ };
1879
+ }, {
1880
+ type: "log";
1881
+ data: {
1882
+ message: string;
1883
+ id: number;
1884
+ workflowId: number;
1885
+ phase: string;
1886
+ agent: string;
1887
+ level: "error" | "info" | "warn";
1888
+ timestamp: Date;
1889
+ data?: unknown;
1890
+ };
1891
+ }>, z.ZodObject<{
1892
+ type: z.ZodLiteral<"complete">;
1893
+ data: z.ZodObject<{
1894
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1895
+ result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
1896
+ }, "strip", z.ZodTypeAny, {
1897
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1898
+ result?: unknown;
1899
+ }, {
1900
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1901
+ result?: unknown;
1902
+ }>;
1903
+ }, "strip", z.ZodTypeAny, {
1904
+ type: "complete";
1905
+ data: {
1906
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1907
+ result?: unknown;
1908
+ };
1909
+ }, {
1910
+ type: "complete";
1911
+ data: {
1912
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1913
+ result?: unknown;
1914
+ };
1915
+ }>, z.ZodObject<{
1916
+ type: z.ZodLiteral<"error">;
1917
+ data: z.ZodObject<{
1918
+ message: z.ZodString;
1919
+ state: z.ZodEnum<["IDLE", "DESIGNING", "DESIGN_REVIEW", "PLANNING", "PLAN_REVIEW", "WRITING_TESTS", "COVERAGE_REVIEW", "EXECUTING_TASK", "TASK_REVIEW", "FINAL_TESTING", "COMPLETED", "FAILED", "CANCELLED"]>;
1920
+ }, "strip", z.ZodTypeAny, {
1921
+ message: string;
1922
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1923
+ }, {
1924
+ message: string;
1925
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1926
+ }>;
1927
+ }, "strip", z.ZodTypeAny, {
1928
+ type: "error";
1929
+ data: {
1930
+ message: string;
1931
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1932
+ };
1933
+ }, {
1934
+ type: "error";
1935
+ data: {
1936
+ message: string;
1937
+ state: "IDLE" | "DESIGNING" | "DESIGN_REVIEW" | "PLANNING" | "PLAN_REVIEW" | "WRITING_TESTS" | "COVERAGE_REVIEW" | "EXECUTING_TASK" | "TASK_REVIEW" | "FINAL_TESTING" | "COMPLETED" | "FAILED" | "CANCELLED";
1938
+ };
1939
+ }>]>;
1940
+ type WorkflowSSEEvent = z.infer<typeof WorkflowSSEEventSchema>;
1941
+
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 };
package/dist/index.js CHANGED
@@ -46,10 +46,14 @@ var TASKS = {
46
46
  detail: (taskId) => `${API_BASE}/tasks/${taskId}`,
47
47
  /** 更新 Task */
48
48
  update: (taskId) => `${API_BASE}/tasks/${taskId}`,
49
+ /** 启动/重新启动工作流 */
50
+ start: (taskId) => `${API_BASE}/tasks/${taskId}/start`,
49
51
  /** 取消 Task */
50
52
  cancel: (taskId) => `${API_BASE}/tasks/${taskId}/cancel`,
51
53
  /** 删除 Task */
52
- delete: (taskId) => `${API_BASE}/tasks/${taskId}`
54
+ delete: (taskId) => `${API_BASE}/tasks/${taskId}`,
55
+ /** SSE 实时推送工作流状态 */
56
+ stream: (taskId) => `${API_BASE}/tasks/${taskId}/stream`
53
57
  };
54
58
  var GITHUB = {
55
59
  /** 获取仓库列表 */
@@ -137,6 +141,21 @@ var ProjectListResponseSchema = PaginatedResponseSchema(ProjectResponseSchema);
137
141
 
138
142
  // src/task.ts
139
143
  import { z as z3 } from "zod";
144
+ var TaskIssueProjectSchema = z3.object({
145
+ name: z3.string()
146
+ });
147
+ var TaskIssueSchema = z3.object({
148
+ issueId: z3.string(),
149
+ title: z3.string(),
150
+ description: z3.string().nullable(),
151
+ status: IssueStatusSchema,
152
+ priority: IssuePrioritySchema,
153
+ tags: z3.string().nullable(),
154
+ projectId: z3.string(),
155
+ createdAt: z3.coerce.date(),
156
+ updatedAt: z3.coerce.date(),
157
+ project: TaskIssueProjectSchema.nullable()
158
+ });
140
159
  var TaskResponseSchema = z3.object({
141
160
  id: z3.number().int(),
142
161
  issueId: z3.string(),
@@ -146,7 +165,8 @@ var TaskResponseSchema = z3.object({
146
165
  startedAt: z3.coerce.date().nullable(),
147
166
  completedAt: z3.coerce.date().nullable(),
148
167
  createdAt: z3.coerce.date(),
149
- updatedAt: z3.coerce.date()
168
+ updatedAt: z3.coerce.date(),
169
+ issue: TaskIssueSchema.nullable().optional()
150
170
  });
151
171
  var TaskCreateSchema = z3.object({
152
172
  name: z3.string().min(1),
@@ -370,6 +390,106 @@ var WorktreeStatusResponseSchema = z10.object({
370
390
  branchName: z10.string().nullable(),
371
391
  error: z10.string().nullable()
372
392
  });
393
+
394
+ // src/code-factory.ts
395
+ import { z as z11 } from "zod";
396
+ var WorkflowStateSchema = z11.enum([
397
+ "IDLE",
398
+ "DESIGNING",
399
+ "DESIGN_REVIEW",
400
+ "PLANNING",
401
+ "PLAN_REVIEW",
402
+ "WRITING_TESTS",
403
+ "COVERAGE_REVIEW",
404
+ "EXECUTING_TASK",
405
+ "TASK_REVIEW",
406
+ "FINAL_TESTING",
407
+ "COMPLETED",
408
+ "FAILED",
409
+ "CANCELLED"
410
+ ]);
411
+ var WorkflowStatusResponseSchema = z11.object({
412
+ workflowId: z11.number().int(),
413
+ taskId: z11.number().int(),
414
+ state: WorkflowStateSchema,
415
+ phase: z11.string().nullable(),
416
+ currentAgent: z11.string().nullable().optional(),
417
+ progress: z11.object({
418
+ phase: z11.string(),
419
+ current: z11.number(),
420
+ total: z11.number(),
421
+ percentage: z11.number()
422
+ }).nullable().optional(),
423
+ iterations: z11.object({
424
+ design: z11.number(),
425
+ plan: z11.number(),
426
+ task: z11.record(z11.string(), z11.number()),
427
+ finalTest: z11.number()
428
+ }).optional(),
429
+ taskExecutions: z11.array(z11.object({
430
+ taskId: z11.string(),
431
+ title: z11.string(),
432
+ status: z11.enum(["pending", "in_progress", "completed", "failed", "skipped"]),
433
+ attempts: z11.number()
434
+ })).optional(),
435
+ agents: z11.array(z11.object({
436
+ role: z11.string(),
437
+ status: z11.enum(["idle", "active", "done"])
438
+ })).optional(),
439
+ createdAt: z11.coerce.date(),
440
+ updatedAt: z11.coerce.date()
441
+ });
442
+ var AgentLogEntrySchema = z11.object({
443
+ id: z11.number().int(),
444
+ workflowId: z11.number().int(),
445
+ agent: z11.string(),
446
+ phase: z11.string(),
447
+ level: z11.enum(["info", "warn", "error"]),
448
+ message: z11.string(),
449
+ data: z11.unknown().nullable(),
450
+ timestamp: z11.coerce.date()
451
+ });
452
+ var AgentLogListResponseSchema = PaginatedResponseSchema(AgentLogEntrySchema);
453
+ var WorkflowSSEEventSchema = z11.union([
454
+ // 状态变更事件
455
+ z11.object({
456
+ type: z11.literal("status"),
457
+ data: z11.object({
458
+ state: WorkflowStateSchema,
459
+ phase: z11.string().nullable(),
460
+ previousState: WorkflowStateSchema.optional()
461
+ })
462
+ }),
463
+ // Agent 状态变更
464
+ z11.object({
465
+ type: z11.literal("agent_status"),
466
+ data: z11.object({
467
+ agent: z11.string(),
468
+ status: z11.enum(["idle", "active", "done"])
469
+ })
470
+ }),
471
+ // 增量日志
472
+ z11.object({
473
+ type: z11.literal("log"),
474
+ data: AgentLogEntrySchema
475
+ }),
476
+ // 工作流完成
477
+ z11.object({
478
+ type: z11.literal("complete"),
479
+ data: z11.object({
480
+ state: WorkflowStateSchema,
481
+ result: z11.unknown().nullable().optional()
482
+ })
483
+ }),
484
+ // 错误事件
485
+ z11.object({
486
+ type: z11.literal("error"),
487
+ data: z11.object({
488
+ message: z11.string(),
489
+ state: WorkflowStateSchema
490
+ })
491
+ })
492
+ ]);
373
493
  export {
374
494
  AI,
375
495
  AIChatRequestSchema,
@@ -378,6 +498,8 @@ export {
378
498
  AISessionResponseSchema,
379
499
  API_BASE,
380
500
  API_ROUTES,
501
+ AgentLogEntrySchema,
502
+ AgentLogListResponseSchema,
381
503
  BranchOptionSchema,
382
504
  BranchSchema,
383
505
  ContentDeltaEventSchema,
@@ -428,6 +550,9 @@ export {
428
550
  ToolResultEventSchema,
429
551
  ToolStartEventSchema,
430
552
  WORKTREE,
553
+ WorkflowSSEEventSchema,
554
+ WorkflowStateSchema,
555
+ WorkflowStatusResponseSchema,
431
556
  WorktreeCreateRequestSchema,
432
557
  WorktreeDeleteRequestSchema,
433
558
  WorktreeStatusResponseSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fixerorg/schemas",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared schemas for Fixer - AI-powered Issue Management System",
5
5
  "author": "zhangyingwei",
6
6
  "license": "MIT",
@@ -16,11 +16,6 @@
16
16
  "files": [
17
17
  "dist"
18
18
  ],
19
- "scripts": {
20
- "build": "tsup src/index.ts --format esm --dts",
21
- "dev": "tsup src/index.ts --format esm --dts --watch",
22
- "prepublishOnly": "pnpm build"
23
- },
24
19
  "publishConfig": {
25
20
  "access": "public"
26
21
  },
@@ -35,5 +30,9 @@
35
30
  "devDependencies": {
36
31
  "tsup": "^8.0.0",
37
32
  "typescript": "^5.7.0"
33
+ },
34
+ "scripts": {
35
+ "build": "tsup src/index.ts --format esm --dts",
36
+ "dev": "tsup src/index.ts --format esm --dts --watch"
38
37
  }
39
- }
38
+ }