@kitsy/coop-core 0.0.1 → 2.0.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
@@ -91,7 +91,7 @@ interface FilterSpec {
91
91
  search?: string;
92
92
  }
93
93
 
94
- type ValueOf<T> = T[keyof T];
94
+ type ValueOf$1<T> = T[keyof T];
95
95
  declare const TaskType: {
96
96
  readonly feature: "feature";
97
97
  readonly bug: "bug";
@@ -99,7 +99,7 @@ declare const TaskType: {
99
99
  readonly spike: "spike";
100
100
  readonly epic: "epic";
101
101
  };
102
- type TaskType = ValueOf<typeof TaskType>;
102
+ type TaskType = ValueOf$1<typeof TaskType>;
103
103
  declare const TaskStatus: {
104
104
  readonly todo: "todo";
105
105
  readonly blocked: "blocked";
@@ -108,14 +108,14 @@ declare const TaskStatus: {
108
108
  readonly done: "done";
109
109
  readonly canceled: "canceled";
110
110
  };
111
- type TaskStatus = ValueOf<typeof TaskStatus>;
111
+ type TaskStatus = ValueOf$1<typeof TaskStatus>;
112
112
  declare const TaskPriority: {
113
113
  readonly p0: "p0";
114
114
  readonly p1: "p1";
115
115
  readonly p2: "p2";
116
116
  readonly p3: "p3";
117
117
  };
118
- type TaskPriority = ValueOf<typeof TaskPriority>;
118
+ type TaskPriority = ValueOf$1<typeof TaskPriority>;
119
119
  declare const TaskComplexity: {
120
120
  readonly trivial: "trivial";
121
121
  readonly small: "small";
@@ -123,14 +123,14 @@ declare const TaskComplexity: {
123
123
  readonly large: "large";
124
124
  readonly unknown: "unknown";
125
125
  };
126
- type TaskComplexity = ValueOf<typeof TaskComplexity>;
126
+ type TaskComplexity = ValueOf$1<typeof TaskComplexity>;
127
127
  declare const TaskDeterminism: {
128
128
  readonly high: "high";
129
129
  readonly medium: "medium";
130
130
  readonly low: "low";
131
131
  readonly experimental: "experimental";
132
132
  };
133
- type TaskDeterminism = ValueOf<typeof TaskDeterminism>;
133
+ type TaskDeterminism = ValueOf$1<typeof TaskDeterminism>;
134
134
  declare const IdeaStatus: {
135
135
  readonly captured: "captured";
136
136
  readonly exploring: "exploring";
@@ -138,7 +138,7 @@ declare const IdeaStatus: {
138
138
  readonly parked: "parked";
139
139
  readonly rejected: "rejected";
140
140
  };
141
- type IdeaStatus = ValueOf<typeof IdeaStatus>;
141
+ type IdeaStatus = ValueOf$1<typeof IdeaStatus>;
142
142
  declare const DeliveryStatus: {
143
143
  readonly planning: "planning";
144
144
  readonly committed: "committed";
@@ -146,14 +146,14 @@ declare const DeliveryStatus: {
146
146
  readonly delivered: "delivered";
147
147
  readonly canceled: "canceled";
148
148
  };
149
- type DeliveryStatus = ValueOf<typeof DeliveryStatus>;
149
+ type DeliveryStatus = ValueOf$1<typeof DeliveryStatus>;
150
150
  declare const ExecutorType: {
151
151
  readonly human: "human";
152
152
  readonly ai: "ai";
153
153
  readonly ci: "ci";
154
154
  readonly hybrid: "hybrid";
155
155
  };
156
- type ExecutorType = ValueOf<typeof ExecutorType>;
156
+ type ExecutorType = ValueOf$1<typeof ExecutorType>;
157
157
  declare const RunbookAction: {
158
158
  readonly generate: "generate";
159
159
  readonly run: "run";
@@ -161,7 +161,7 @@ declare const RunbookAction: {
161
161
  readonly test: "test";
162
162
  readonly deploy: "deploy";
163
163
  };
164
- type RunbookAction = ValueOf<typeof RunbookAction>;
164
+ type RunbookAction = ValueOf$1<typeof RunbookAction>;
165
165
  declare const ArtifactType: {
166
166
  readonly pr: "pr";
167
167
  readonly migration: "migration";
@@ -169,14 +169,14 @@ declare const ArtifactType: {
169
169
  readonly document: "document";
170
170
  readonly config: "config";
171
171
  };
172
- type ArtifactType = ValueOf<typeof ArtifactType>;
172
+ type ArtifactType = ValueOf$1<typeof ArtifactType>;
173
173
  declare const RiskLevel: {
174
174
  readonly low: "low";
175
175
  readonly medium: "medium";
176
176
  readonly high: "high";
177
177
  readonly critical: "critical";
178
178
  };
179
- type RiskLevel = ValueOf<typeof RiskLevel>;
179
+ type RiskLevel = ValueOf$1<typeof RiskLevel>;
180
180
 
181
181
  interface DeliveryBudget {
182
182
  engineering_hours?: number;
@@ -286,6 +286,7 @@ interface TaskCore {
286
286
  updated: string;
287
287
  }
288
288
  interface TaskPlanning {
289
+ aliases?: string[];
289
290
  priority?: TaskPriority;
290
291
  track?: string;
291
292
  assignee?: string | null;
@@ -397,6 +398,18 @@ interface Track {
397
398
  };
398
399
  }
399
400
 
401
+ interface ExternalDependencyRef {
402
+ raw: string;
403
+ repo: string;
404
+ task_id: string;
405
+ }
406
+ type ExternalDependencyResolutionStatus = "resolved" | "blocked" | "unreachable" | "missing" | "unknown";
407
+ interface ExternalDependencyResolution {
408
+ dependency: ExternalDependencyRef;
409
+ status: ExternalDependencyResolutionStatus;
410
+ task_status?: string | null;
411
+ warning?: string;
412
+ }
400
413
  interface TaskGraph {
401
414
  nodes: Map<string, Task>;
402
415
  forward: Map<string, Set<string>>;
@@ -405,6 +418,7 @@ interface TaskGraph {
405
418
  tracks: Map<string, Track>;
406
419
  resources: Map<string, ResourceProfile>;
407
420
  deliveries: Map<string, Delivery>;
421
+ external_dependencies?: Map<string, ExternalDependencyRef[]>;
408
422
  }
409
423
  interface GraphValidationResult {
410
424
  level: "error" | "warning";
@@ -413,6 +427,26 @@ interface GraphValidationResult {
413
427
  task_ids?: string[];
414
428
  }
415
429
 
430
+ interface CriticalPathTaskMetrics {
431
+ id: string;
432
+ ES: number;
433
+ EF: number;
434
+ LS: number;
435
+ LF: number;
436
+ slack: number;
437
+ on_critical_path: boolean;
438
+ }
439
+ interface CriticalPathResult {
440
+ critical_path: string[];
441
+ project_duration_hours: number;
442
+ per_task: CriticalPathTaskMetrics[];
443
+ }
444
+ /**
445
+ * Computes CPM earliest/latest times and slack over delivery-scoped task subgraph.
446
+ * [SPEC: Scheduler v2.0 §6]
447
+ */
448
+ declare function compute_critical_path(delivery: Delivery, graph: TaskGraph): CriticalPathResult;
449
+
416
450
  interface BuildGraphContext {
417
451
  tracks?: Map<string, Track>;
418
452
  resources?: Map<string, ResourceProfile>;
@@ -424,18 +458,262 @@ declare function transitive_dependencies(graph: TaskGraph, taskId: string): Set<
424
458
  declare function transitive_dependents(graph: TaskGraph, taskId: string): Set<string>;
425
459
  declare function build_graph(tasks: Task[], context?: BuildGraphContext): TaskGraph;
426
460
 
461
+ type ExternalRepoConfig = {
462
+ base_url: string;
463
+ };
464
+ type ExternalDependencyResolverOptions = {
465
+ remotes: Record<string, ExternalRepoConfig>;
466
+ fetch_impl?: typeof fetch;
467
+ };
468
+ declare function is_external_dependency(value: string): boolean;
469
+ declare function parse_external_dependency(value: string): ExternalDependencyRef | null;
470
+ declare function external_dependencies_for_task(graph: TaskGraph, taskId: string): ExternalDependencyRef[];
471
+ declare function resolve_external_dependencies(graph: TaskGraph, options: ExternalDependencyResolverOptions): Promise<Map<string, ExternalDependencyResolution[]>>;
472
+
427
473
  declare function load_graph(coopDir: string): TaskGraph;
428
474
 
429
475
  declare function extract_subgraph(graph: TaskGraph, taskIds: string[]): TaskGraph;
430
476
  declare function find_external_dependencies(subgraph: TaskGraph, fullGraph: TaskGraph): string[];
431
477
 
432
- declare function validate_graph(graph: TaskGraph): GraphValidationResult[];
478
+ declare const COOP_EVENT_TYPES: readonly ["task.created", "task.transitioned", "task.assigned", "delivery.committed", "delivery.at_risk", "run.started", "run.completed", "run.failed", "graph.cycle_detected"];
479
+ type CoopEventType = (typeof COOP_EVENT_TYPES)[number];
480
+ type BaseEvent<TType extends CoopEventType, TPayload> = {
481
+ type: TType;
482
+ timestamp: string;
483
+ payload: TPayload;
484
+ };
485
+ type TaskCreated = BaseEvent<"task.created", {
486
+ task_id: string;
487
+ title?: string;
488
+ task_type?: string;
489
+ file_path?: string;
490
+ }>;
491
+ type TaskTransitioned = BaseEvent<"task.transitioned", {
492
+ task_id: string;
493
+ from: TaskStatus;
494
+ to: TaskStatus;
495
+ actor?: string;
496
+ }>;
497
+ type TaskAssigned = BaseEvent<"task.assigned", {
498
+ task_id: string;
499
+ from: string | null;
500
+ to: string | null;
501
+ actor?: string;
502
+ }>;
503
+ type DeliveryCommitted = BaseEvent<"delivery.committed", {
504
+ delivery_id: string;
505
+ from: DeliveryStatus;
506
+ to: DeliveryStatus;
507
+ actor?: string;
508
+ }>;
509
+ type DeliveryAtRisk = BaseEvent<"delivery.at_risk", {
510
+ delivery_id: string;
511
+ status: "FEASIBLE" | "NOT_FEASIBLE";
512
+ risks: string[];
513
+ }>;
514
+ type RunStarted = BaseEvent<"run.started", {
515
+ run_id: string;
516
+ task_id: string;
517
+ executor?: string;
518
+ }>;
519
+ type RunCompleted = BaseEvent<"run.completed", {
520
+ run_id: string;
521
+ task_id: string;
522
+ duration_ms?: number;
523
+ }>;
524
+ type RunFailed = BaseEvent<"run.failed", {
525
+ run_id: string;
526
+ task_id: string;
527
+ error: string;
528
+ }>;
529
+ type GraphCycleDetected = BaseEvent<"graph.cycle_detected", {
530
+ cycle: string[];
531
+ }>;
532
+ type CoopEvent = TaskCreated | TaskTransitioned | TaskAssigned | DeliveryCommitted | DeliveryAtRisk | RunStarted | RunCompleted | RunFailed | GraphCycleDetected;
533
+ type EventByType = {
534
+ "task.created": TaskCreated;
535
+ "task.transitioned": TaskTransitioned;
536
+ "task.assigned": TaskAssigned;
537
+ "delivery.committed": DeliveryCommitted;
538
+ "delivery.at_risk": DeliveryAtRisk;
539
+ "run.started": RunStarted;
540
+ "run.completed": RunCompleted;
541
+ "run.failed": RunFailed;
542
+ "graph.cycle_detected": GraphCycleDetected;
543
+ };
544
+
545
+ /**
546
+ * Minimal typed synchronous event emitter for core domain events.
547
+ * [SPEC: Architecture v2.0 §14]
548
+ */
549
+ declare class CoopEventEmitter {
550
+ private handlers;
551
+ on<TType extends CoopEventType>(eventType: TType, handler: (event: EventByType[TType]) => void): () => void;
552
+ emit(event: CoopEvent): void;
553
+ }
554
+
555
+ interface GraphValidationContext {
556
+ eventEmitter?: CoopEventEmitter;
557
+ }
558
+ declare function validate_graph(graph: TaskGraph, context?: GraphValidationContext): GraphValidationResult[];
559
+
560
+ type IndexStatus = {
561
+ exists: boolean;
562
+ stale: boolean;
563
+ graph_path: string;
564
+ source_max_mtime_ms: number;
565
+ changed_files: string[];
566
+ generated_at?: string;
567
+ reason?: string;
568
+ };
569
+ declare class IndexManager {
570
+ readonly coopDir: string;
571
+ readonly indexDir: string;
572
+ readonly graphPath: string;
573
+ readonly tasksPath: string;
574
+ readonly capacityPath: string;
575
+ constructor(coopDir: string);
576
+ is_stale(): boolean;
577
+ status(): IndexStatus;
578
+ load_indexed_graph(): TaskGraph | null;
579
+ build_full_index(): TaskGraph;
580
+ update_incremental(changedFiles: string[]): TaskGraph;
581
+ private ensureIndexDir;
582
+ private writeIndexFiles;
583
+ private readGraphIndexFile;
584
+ private serializeGraph;
585
+ private deserializeGraph;
586
+ private scanSources;
587
+ private normalizeChangedFile;
588
+ private fileKind;
589
+ private computeTaskIndexRows;
590
+ private computeCapacitySnapshot;
591
+ }
592
+
593
+ interface HookRunResult {
594
+ exitCode: number | null;
595
+ stdout: string;
596
+ stderr: string;
597
+ timedOut: boolean;
598
+ }
599
+ /**
600
+ * Executes a hook script with JSON event payload piped to stdin.
601
+ * [SPEC: Architecture v2.0 §14]
602
+ */
603
+ declare function run_hook(hookPath: string, event: CoopEvent, timeoutMs?: number): Promise<HookRunResult>;
604
+
605
+ type Role = "admin" | "lead" | "contributor" | "viewer";
606
+ type Permission = "all" | "read" | "comment" | "create_task" | "transition_task" | "transition_own_task" | "create_delivery" | "plan_delivery" | "assign_task" | "delete_task" | "commit_delivery" | "override_blocked";
607
+ type PolicyAction = "delete_task" | "commit_delivery" | "override_blocked" | "transition_task" | "create_delivery";
608
+ type AuthPolicy = {
609
+ action: PolicyAction;
610
+ requires: Role[];
611
+ };
612
+ type AuthConfig = {
613
+ enabled: boolean;
614
+ roles: Record<Role, {
615
+ permissions: Permission[];
616
+ }>;
617
+ assignments: Record<string, Role>;
618
+ policies: AuthPolicy[];
619
+ };
620
+ type PermissionContext = {
621
+ config: AuthConfig;
622
+ taskOwner?: string | null;
623
+ };
624
+ /**
625
+ * Loads authorization policy from config.yml-compatible object.
626
+ * [SPEC: Architecture v2.0 §20]
627
+ */
628
+ declare function load_auth_config(config: unknown): AuthConfig;
629
+ /**
630
+ * Returns mapped role for a user, defaulting to viewer.
631
+ * [SPEC: Architecture v2.0 §20]
632
+ */
633
+ declare function get_user_role(user: string, config: AuthConfig): Role;
634
+ /**
635
+ * Checks whether user is allowed to perform a given action in context.
636
+ * [SPEC: Architecture v2.0 §20]
637
+ */
638
+ declare function check_permission(user: string, action: Permission, context: PermissionContext): boolean;
639
+
640
+ type PluginActionWebhook = {
641
+ type: "webhook";
642
+ url: string;
643
+ template?: string;
644
+ headers?: Record<string, string>;
645
+ };
646
+ type PluginActionConsole = {
647
+ type: "console";
648
+ template: string;
649
+ };
650
+ type PluginActionGitHubPr = {
651
+ type: "github_pr";
652
+ operation: "create_or_update" | "merge";
653
+ branch?: string;
654
+ base_branch?: string;
655
+ draft?: boolean;
656
+ };
657
+ type PluginAction = PluginActionWebhook | PluginActionConsole | PluginActionGitHubPr;
658
+ type PluginTrigger = {
659
+ event: CoopEventType;
660
+ filter?: Record<string, unknown>;
661
+ action: PluginAction;
662
+ };
663
+ type PluginManifest = {
664
+ id: string;
665
+ name: string;
666
+ version: string;
667
+ triggers: PluginTrigger[];
668
+ secrets: string[];
669
+ file_path: string;
670
+ };
671
+ /**
672
+ * Loads and validates plugin manifests from .coop/plugins.
673
+ * [SPEC: Architecture v2.0 §19]
674
+ */
675
+ declare function load_plugins(coopDir: string): PluginManifest[];
676
+
677
+ type EnvMap = Record<string, string | undefined>;
678
+ type PluginRunRecord = {
679
+ plugin_id: string;
680
+ plugin_name: string;
681
+ trigger_event: string;
682
+ action_type: string;
683
+ success: boolean;
684
+ status_code?: number;
685
+ error?: string;
686
+ message?: string;
687
+ timestamp: string;
688
+ };
689
+ type PluginRunOptions = {
690
+ graph?: TaskGraph;
691
+ env?: EnvMap;
692
+ fetch_impl?: typeof fetch;
693
+ action_handlers?: Partial<Record<PluginAction["type"], PluginActionHandler>>;
694
+ };
695
+ type PluginActionHandlerResult = {
696
+ statusCode?: number;
697
+ message?: string;
698
+ };
699
+ type PluginActionHandler = (plugin: PluginManifest, trigger: PluginTrigger, action: PluginAction, context: TemplateContext, env: EnvMap) => Promise<PluginActionHandlerResult>;
700
+ type TemplateContext = {
701
+ event: Record<string, unknown>;
702
+ task?: Record<string, unknown>;
703
+ delivery?: Record<string, unknown>;
704
+ };
705
+ /**
706
+ * Runs matching plugin triggers for a single event.
707
+ * [SPEC: Architecture v2.0 §19]
708
+ */
709
+ declare function run_plugins_for_event(coopDir: string, event: CoopEvent, options?: PluginRunOptions): Promise<PluginRunRecord[]>;
433
710
 
434
711
  interface CoopConfig {
435
712
  version: number;
436
713
  project: {
437
714
  name: string;
438
715
  id: string;
716
+ aliases?: string[];
439
717
  };
440
718
  id_prefixes?: {
441
719
  idea?: string;
@@ -471,12 +749,20 @@ interface CoopConfig {
471
749
  on_task_transition?: string;
472
750
  on_delivery_complete?: string;
473
751
  };
752
+ api?: {
753
+ host?: string;
754
+ port?: number;
755
+ remotes?: Record<string, {
756
+ base_url: string;
757
+ }>;
758
+ };
474
759
  }
475
760
 
476
761
  interface Idea {
477
762
  id: string;
478
763
  title: string;
479
764
  created: string;
765
+ aliases?: string[];
480
766
  author: string;
481
767
  status: IdeaStatus;
482
768
  tags: string[];
@@ -484,6 +770,52 @@ interface Idea {
484
770
  linked_tasks: string[];
485
771
  }
486
772
 
773
+ type ValueOf<T> = T[keyof T];
774
+ declare const RunStatus: {
775
+ readonly pending: "pending";
776
+ readonly running: "running";
777
+ readonly paused: "paused";
778
+ readonly completed: "completed";
779
+ readonly failed: "failed";
780
+ readonly canceled: "canceled";
781
+ };
782
+ type RunStatus = ValueOf<typeof RunStatus>;
783
+ declare const RunStepStatus: {
784
+ readonly completed: "completed";
785
+ readonly failed: "failed";
786
+ readonly paused: "paused";
787
+ readonly skipped: "skipped";
788
+ };
789
+ type RunStepStatus = ValueOf<typeof RunStepStatus>;
790
+ interface RunStepResult {
791
+ step: string;
792
+ action: string;
793
+ status: RunStepStatus;
794
+ started: string;
795
+ completed?: string;
796
+ duration_seconds?: number;
797
+ output_summary?: string;
798
+ reviewer?: string;
799
+ notes?: string;
800
+ exit_code?: number;
801
+ tokens_used?: number;
802
+ }
803
+ interface RunResourcesConsumed {
804
+ ai_tokens: number;
805
+ compute_minutes: number;
806
+ file_changes: number;
807
+ }
808
+ interface Run {
809
+ id: string;
810
+ task: string;
811
+ executor: string;
812
+ status: RunStatus;
813
+ started: string;
814
+ completed?: string;
815
+ steps: RunStepResult[];
816
+ resources_consumed: RunResourcesConsumed;
817
+ }
818
+
487
819
  interface ParsedDelivery {
488
820
  delivery: Delivery;
489
821
  body: string;
@@ -520,11 +852,212 @@ interface WriteTaskOptions {
520
852
  body?: string;
521
853
  raw?: Record<string, unknown>;
522
854
  filePath?: string;
855
+ eventEmitter?: CoopEventEmitter;
523
856
  }
524
857
  declare function writeTask(task: Task, options?: WriteTaskOptions): string;
525
858
 
526
859
  declare function parseYamlContent<T extends object = Record<string, unknown>>(content: string, source?: string): T;
527
860
  declare function parseYamlFile<T extends object = Record<string, unknown>>(filePath: string): T;
861
+ declare function stringifyYamlContent(content: Record<string, unknown>): string;
862
+ declare function writeYamlFile(filePath: string, content: Record<string, unknown>): void;
863
+
864
+ interface CapacityLedger {
865
+ slots: Map<string, Map<number, number>>;
866
+ weeks: Map<number, {
867
+ start: string;
868
+ end: string;
869
+ }>;
870
+ ai_tokens: Map<string, number>;
871
+ ai_tokens_by_agent: Map<string, Map<string, number>>;
872
+ ai_tokens_consumed_by_agent: Map<string, Map<string, number>>;
873
+ }
874
+ interface AllocationResult {
875
+ success: boolean;
876
+ reason?: "capacity_exhausted" | "ai_capacity_exhausted";
877
+ start_week?: number;
878
+ end_week?: number;
879
+ duration_weeks?: number;
880
+ }
881
+ /**
882
+ * Computes net weekly human capacity after calendar and overhead adjustments.
883
+ * [SPEC: Architecture v2.0 §9]
884
+ */
885
+ declare function effective_weekly_hours(profile: HumanResource, week_start: string | Date, week_end: string | Date): number;
886
+ /**
887
+ * Builds per-track weekly capacity and AI token ledgers for a delivery horizon.
888
+ * [SPEC: Scheduler v2.0 §3 Stage 4]
889
+ */
890
+ declare function build_capacity_ledger(delivery: Delivery, resources: Map<string, ResourceProfile> | ResourceProfile[], today: string | Date): CapacityLedger;
891
+ /**
892
+ * Attempts to allocate task effort into contiguous weekly slots for its track.
893
+ * [SPEC: Scheduler v2.0 §3 Stage 4]
894
+ */
895
+ declare function allocate(ledger: CapacityLedger, task: Task, start_week: number): AllocationResult;
896
+ /**
897
+ * Validates current in-progress count against track max concurrent limit.
898
+ * [SPEC: Architecture v2.0 §8]
899
+ */
900
+ declare function check_wip(track: Track | undefined, graph: TaskGraph): boolean;
901
+ /**
902
+ * Reserves AI token budget for an AI/hybrid task on a given execution day.
903
+ * [SPEC: Scheduler v2.0 §4.6]
904
+ */
905
+ declare function allocate_ai(ledger: CapacityLedger, task: Task, day: string, fallback_tokens?: number): AllocationResult;
906
+ /**
907
+ * Reserves AI tokens for a specific agent on a specific day.
908
+ * [SPEC: Scheduler v2.0 §4.6]
909
+ */
910
+ declare function allocate_ai_tokens(ledger: CapacityLedger, agent: string, tokens: number, day: string): boolean;
911
+ /**
912
+ * Returns remaining AI tokens for an agent/day pair from the capacity ledger.
913
+ * [SPEC: Scheduler v2.0 §4.6]
914
+ */
915
+ declare function get_remaining_tokens(ledger: CapacityLedger, agent: string, day: string): number;
916
+
917
+ /**
918
+ * Returns PERT expected effort from optimistic/expected/pessimistic triplet.
919
+ * [SPEC: Scheduler v2.0 §4.2]
920
+ */
921
+ declare function pert_hours(estimate: TaskEstimate): number;
922
+ /**
923
+ * Returns PERT standard deviation used for uncertainty calculations.
924
+ * [SPEC: Scheduler v2.0 §4.2]
925
+ */
926
+ declare function pert_stddev(estimate: TaskEstimate): number;
927
+ /**
928
+ * Resolves effective task effort from estimate/resources/fallback heuristics.
929
+ * [SPEC: Scheduler v2.0 §4.1]
930
+ */
931
+ declare function task_effort_hours(task: Task): number;
932
+ /**
933
+ * Returns task effort with complexity-based defaults when explicit estimate is absent.
934
+ * [SPEC: Scheduler v2.0 §4.1]
935
+ */
936
+ declare function effort_or_default(task: Task, config: CoopConfig): number;
937
+
938
+ interface TaskScheduleEntry {
939
+ task_id: string;
940
+ track: string;
941
+ start_week: number | null;
942
+ end_week: number | null;
943
+ already_complete?: boolean;
944
+ }
945
+ interface TrackUtilization {
946
+ track: string;
947
+ allocated_hours: number;
948
+ capacity_hours: number;
949
+ utilization: number;
950
+ }
951
+ interface SimulationResult {
952
+ schedule: Record<string, TaskScheduleEntry>;
953
+ projected_completion: string | null;
954
+ total_weeks: number;
955
+ utilization_by_track: TrackUtilization[];
956
+ error?: {
957
+ code: "schedule_overflow";
958
+ task: string;
959
+ };
960
+ }
961
+ interface MonteCarloOptions {
962
+ iterations?: number;
963
+ workers?: number;
964
+ today?: string | Date;
965
+ rng?: () => number;
966
+ seed?: number;
967
+ }
968
+ interface MonteCarloHistogramBucket {
969
+ week_index: number;
970
+ start_date: string;
971
+ end_date: string;
972
+ count: number;
973
+ probability: number;
974
+ }
975
+ interface MonteCarloResult {
976
+ iterations: number;
977
+ successful_iterations: number;
978
+ p50: string | null;
979
+ p75: string | null;
980
+ p85: string | null;
981
+ p95: string | null;
982
+ mean_date: string | null;
983
+ stddev_days: number;
984
+ probability_by_target: number | null;
985
+ histogram: MonteCarloHistogramBucket[];
986
+ }
987
+ interface MonteCarloWorkerPayload {
988
+ delivery: Delivery;
989
+ graph: TaskGraph;
990
+ today: string;
991
+ iterations: number;
992
+ start_index: number;
993
+ seed: number;
994
+ }
995
+ /**
996
+ * Simulates week-by-week task placement under dependency, capacity, and WIP constraints.
997
+ * [SPEC: Scheduler v2.0 §5]
998
+ */
999
+ declare function simulate_schedule(tasks: Task[], graph: TaskGraph, delivery: Delivery, today: string | Date): SimulationResult;
1000
+ declare function create_seeded_rng(seed: number): () => number;
1001
+ declare function run_monte_carlo_chunk(delivery: Delivery, graph: TaskGraph, options: {
1002
+ today: string | Date;
1003
+ iterations: number;
1004
+ start_index?: number;
1005
+ seed?: number;
1006
+ rng?: () => number;
1007
+ }): number[];
1008
+ /**
1009
+ * Runs Monte Carlo schedule simulations and returns probabilistic completion forecasts.
1010
+ * [SPEC: Scheduler v2.0 §10.1]
1011
+ */
1012
+ declare function monte_carlo_forecast(delivery: Delivery, graph: TaskGraph, options?: MonteCarloOptions): Promise<MonteCarloResult>;
1013
+
1014
+ type FeasibilityStatus = "FEASIBLE" | "NOT_FEASIBLE";
1015
+ interface FeasibilityRisk {
1016
+ type: "budget_exceeded" | "cost_budget_exceeded" | "capacity_exceeded" | "schedule_exceeded" | "high_utilization" | "external_dependencies" | "schedule_overflow";
1017
+ message: string;
1018
+ overage_hours?: number;
1019
+ overage_days?: number;
1020
+ overage_cost_usd?: number;
1021
+ track?: string;
1022
+ tasks?: string[];
1023
+ utilization?: number;
1024
+ }
1025
+ interface FeasibilitySummary {
1026
+ total_tasks: number;
1027
+ completed: number;
1028
+ remaining: number;
1029
+ effort_hours: {
1030
+ required: number;
1031
+ budget: number;
1032
+ };
1033
+ capacity_hours: {
1034
+ available: number;
1035
+ by_track: Record<string, number>;
1036
+ };
1037
+ pert: {
1038
+ mean: number;
1039
+ stddev: number;
1040
+ };
1041
+ dates: {
1042
+ target: string | null;
1043
+ projected: string | null;
1044
+ buffer_days: number | null;
1045
+ };
1046
+ critical_path: string[];
1047
+ critical_path_hours: number;
1048
+ }
1049
+ interface FeasibilityResult {
1050
+ delivery: string;
1051
+ status: FeasibilityStatus;
1052
+ risks: FeasibilityRisk[];
1053
+ summary: FeasibilitySummary;
1054
+ simulation: SimulationResult;
1055
+ }
1056
+ /**
1057
+ * Evaluates delivery feasibility from scope, dependencies, capacity, and schedule simulation.
1058
+ * [SPEC: Scheduler v2.0 §9]
1059
+ */
1060
+ declare function analyze_feasibility(deliveryId: string, graph: TaskGraph, today: string | Date): FeasibilityResult;
528
1061
 
529
1062
  type ReadinessState = "ready" | "blocked" | "in_progress" | "waiting_review" | "done";
530
1063
  interface ReadinessPartitions {
@@ -557,6 +1090,213 @@ declare function compute_all_readiness(graph: TaskGraph): Map<string, ReadinessS
557
1090
  declare function partition_by_readiness(graph: TaskGraph): ReadinessPartitions;
558
1091
  declare function compute_readiness_with_corrections(graph: TaskGraph): ReadinessComputation;
559
1092
 
1093
+ type VelocityTrend = "accelerating" | "stable" | "decelerating";
1094
+ interface VelocityPoint {
1095
+ week_index: number;
1096
+ week_start: string;
1097
+ week_end: string;
1098
+ completed_tasks: number;
1099
+ delivered_hours: number;
1100
+ }
1101
+ interface VelocityMetrics {
1102
+ window_weeks: number;
1103
+ completed_runs: number;
1104
+ tasks_completed_total: number;
1105
+ delivered_hours_total: number;
1106
+ tasks_completed_per_week: number;
1107
+ hours_delivered_per_week: number;
1108
+ accuracy_ratio: number | null;
1109
+ trend: VelocityTrend;
1110
+ points: VelocityPoint[];
1111
+ }
1112
+ /**
1113
+ * Loads completed run logs from `.coop/runs/*.yml`.
1114
+ * [SPEC: Architecture v2.0 §12]
1115
+ */
1116
+ declare function load_completed_runs(coopDir: string): Run[];
1117
+ /**
1118
+ * Computes historical delivery velocity from completed run logs.
1119
+ * [SPEC: Scheduler v2.0 §5.3]
1120
+ */
1121
+ declare function compute_velocity(runs: Run[], windowWeeks: number, options?: {
1122
+ today?: string | Date;
1123
+ graph?: TaskGraph;
1124
+ }): VelocityMetrics;
1125
+
1126
+ type DeliveryRiskType = "behind_schedule" | "capacity_crunch" | "critical_path_not_started" | "high_risk_critical_path";
1127
+ interface DetectedDeliveryRisk {
1128
+ type: DeliveryRiskType;
1129
+ message: string;
1130
+ task_ids?: string[];
1131
+ track?: string;
1132
+ }
1133
+ /**
1134
+ * Detects delivery risks from feasibility, critical path, and historical velocity.
1135
+ * Emits `delivery.at_risk` when an emitter is provided and risks are found.
1136
+ * [SPEC: Scheduler v2.0 §5.3]
1137
+ */
1138
+ declare function detect_delivery_risks(delivery: Delivery, graph: TaskGraph, velocity: VelocityMetrics, options?: {
1139
+ today?: string | Date;
1140
+ eventEmitter?: CoopEventEmitter;
1141
+ }): DetectedDeliveryRisk[];
1142
+
1143
+ /**
1144
+ * Samples from the standard PERT-Beta distribution.
1145
+ * [SPEC: Scheduler v2.0 §10.1]
1146
+ */
1147
+ declare function sample_pert_beta(optimistic: number, expected: number, pessimistic: number, rng?: () => number): number;
1148
+ /**
1149
+ * Samples task effort for Monte Carlo simulation.
1150
+ * Tasks with estimates use PERT-Beta; others use +/-30% around fallback effort.
1151
+ * [SPEC: Scheduler v2.0 §10.1]
1152
+ */
1153
+ declare function sample_task_hours(task: Task, rng?: () => number): number;
1154
+
1155
+ interface ScheduleOptions {
1156
+ track?: string;
1157
+ delivery?: string;
1158
+ executor?: ExecutorType;
1159
+ limit?: number;
1160
+ today?: string | Date;
1161
+ config?: CoopConfig;
1162
+ }
1163
+ interface ScoredTask {
1164
+ task: Task;
1165
+ score: number;
1166
+ readiness: ReadinessState;
1167
+ fits_capacity: boolean;
1168
+ fits_wip: boolean;
1169
+ }
1170
+ /**
1171
+ * Returns ranked ready tasks with score, capacity-fit, and WIP-fit annotations.
1172
+ * [SPEC: Scheduler v2.0 §3 Stage 3-5]
1173
+ */
1174
+ declare function schedule_next(graph: TaskGraph, options?: ScheduleOptions): ScoredTask[];
1175
+
1176
+ interface ScoreWeights {
1177
+ priority: Record<TaskPriority, number>;
1178
+ urgency: {
1179
+ days_7: number;
1180
+ days_14: number;
1181
+ days_28: number;
1182
+ };
1183
+ dependency_unlock: {
1184
+ gte_5: number;
1185
+ gte_3: number;
1186
+ gte_1: number;
1187
+ transitive_cap: number;
1188
+ };
1189
+ critical_path: number;
1190
+ determinism: Record<TaskDeterminism, number>;
1191
+ executor_fit: {
1192
+ match: number;
1193
+ mismatch: number;
1194
+ ci_match: number;
1195
+ };
1196
+ type: Record<TaskType, number>;
1197
+ complexity_penalty: Record<TaskComplexity, number>;
1198
+ risk_penalty: Record<RiskLevel, number>;
1199
+ }
1200
+ interface ScoreContext {
1201
+ deliveries?: Map<string, Delivery> | Delivery[];
1202
+ cpm?: CriticalPathResult;
1203
+ today?: string | Date;
1204
+ target_executor?: ExecutorType;
1205
+ config?: CoopConfig;
1206
+ }
1207
+ /**
1208
+ * Default readiness ranking weights used by `compute_score`.
1209
+ * [SPEC: Scheduler v2.0 §4.6]
1210
+ */
1211
+ declare const DEFAULT_SCORE_WEIGHTS: ScoreWeights;
1212
+ /** [SPEC: Scheduler v2.0 §4.6] */
1213
+ declare function priority_weight(task: Task, config?: CoopConfig): number;
1214
+ /** [SPEC: Scheduler v2.0 §4.6] */
1215
+ declare function urgency_weight(task: Task, deliveries: Map<string, Delivery> | Delivery[], today: string | Date, config?: CoopConfig): number;
1216
+ /** [SPEC: Scheduler v2.0 §4.6] */
1217
+ declare function dependency_unlock_weight(taskId: string, graph: TaskGraph, config?: CoopConfig): number;
1218
+ /** [SPEC: Scheduler v2.0 §4.6] */
1219
+ declare function critical_path_weight(taskId: string, cpm: CriticalPathResult | undefined, config?: CoopConfig): number;
1220
+ /** [SPEC: Scheduler v2.0 §4.6] */
1221
+ declare function determinism_weight(task: Task, config?: CoopConfig): number;
1222
+ /** [SPEC: Scheduler v2.0 §4.6] */
1223
+ declare function executor_fit_weight(task: Task, targetExecutor?: ExecutorType, config?: CoopConfig): number;
1224
+ /** [SPEC: Scheduler v2.0 §4.6] */
1225
+ declare function type_weight(task: Task, config?: CoopConfig): number;
1226
+ /** [SPEC: Scheduler v2.0 §4.6] */
1227
+ declare function complexity_penalty(task: Task, config?: CoopConfig): number;
1228
+ /** [SPEC: Scheduler v2.0 §4.6] */
1229
+ declare function risk_penalty(task: Task, config?: CoopConfig): number;
1230
+ /**
1231
+ * Computes composite scheduling score for one ready task.
1232
+ * [SPEC: Scheduler v2.0 §4.6]
1233
+ */
1234
+ declare function compute_score(task: Task, graph: TaskGraph, context?: ScoreContext): number;
1235
+
1236
+ type WhatIfModification = {
1237
+ kind: "without";
1238
+ task_id: string;
1239
+ } | {
1240
+ kind: "add_member";
1241
+ target: string;
1242
+ hours_per_week?: number;
1243
+ } | {
1244
+ kind: "target";
1245
+ target_date: string;
1246
+ } | {
1247
+ kind: "set_priority";
1248
+ task_id: string;
1249
+ priority: NonNullable<Task["priority"]>;
1250
+ };
1251
+ interface WhatIfBaseline {
1252
+ delivery_id: string;
1253
+ graph: TaskGraph;
1254
+ today: string | Date;
1255
+ }
1256
+ interface ComparisonRow {
1257
+ metric: string;
1258
+ original: string;
1259
+ scenario: string;
1260
+ delta: string;
1261
+ }
1262
+ interface ComparisonResult {
1263
+ delivery: string;
1264
+ label: string;
1265
+ baseline: FeasibilityResult;
1266
+ scenario: FeasibilityResult;
1267
+ rows: ComparisonRow[];
1268
+ }
1269
+ /**
1270
+ * Runs a cloned-delivery feasibility analysis with one or more scenario modifications.
1271
+ * [SPEC: Scheduler v2.0 §9.2]
1272
+ */
1273
+ declare function analyze_what_if(baseline: WhatIfBaseline, modification: WhatIfModification | WhatIfModification[]): ComparisonResult;
1274
+
1275
+ interface MigrationContext {
1276
+ file_path?: string;
1277
+ file_mtime_iso?: string;
1278
+ }
1279
+ interface MigrationDefinition {
1280
+ from: number;
1281
+ to: number;
1282
+ description: string;
1283
+ migrate: (raw: Record<string, unknown>, context?: MigrationContext) => Record<string, unknown>;
1284
+ }
1285
+ interface MigrationReport {
1286
+ from_version: number;
1287
+ to_version: number;
1288
+ dry_run: boolean;
1289
+ files_scanned: number;
1290
+ files_changed: number;
1291
+ changed_files: string[];
1292
+ }
1293
+ interface MigrateRepositoryOptions {
1294
+ dry_run?: boolean;
1295
+ }
1296
+ declare const MIGRATIONS: MigrationDefinition[];
1297
+ declare function migrate_task(rawTask: Record<string, unknown>, fromVersion: number, toVersion: number, context?: MigrationContext): Record<string, unknown>;
1298
+ declare function migrate_repository(coopDir: string, targetVersion?: number, options?: MigrateRepositoryOptions): MigrationReport;
1299
+
560
1300
  declare const CURRENT_SCHEMA_VERSION = 2;
561
1301
  declare function read_schema_version(coopDir: string): number;
562
1302
  declare function write_schema_version(coopDir: string, version: number): void;
@@ -582,6 +1322,7 @@ type TransitionContext = {
582
1322
  actor?: string;
583
1323
  dependencyStatuses?: Map<string, TaskStatus> | Record<string, TaskStatus>;
584
1324
  now?: string | Date;
1325
+ eventEmitter?: CoopEventEmitter;
585
1326
  };
586
1327
  type TransitionResult = {
587
1328
  success: boolean;
@@ -645,6 +1386,43 @@ interface ValidationResult {
645
1386
  }
646
1387
  declare function validate(task: Task, context?: ValidationContext): ValidationResult;
647
1388
 
1389
+ type CoopWorkspaceConfig = {
1390
+ version?: number;
1391
+ current_project?: string;
1392
+ };
1393
+ type CoopProjectRef = {
1394
+ id: string;
1395
+ name: string;
1396
+ aliases: string[];
1397
+ root: string;
1398
+ repo_root: string;
1399
+ layout: "legacy" | "v2";
1400
+ };
1401
+ type ResolveProjectOptions = {
1402
+ project?: string;
1403
+ require?: boolean;
1404
+ };
1405
+ declare function coop_workspace_dir(repoRoot: string): string;
1406
+ declare function coop_projects_dir(repoRoot: string): string;
1407
+ declare function coop_workspace_config_path(repoRoot: string): string;
1408
+ declare function coop_project_root(repoRoot: string, projectId: string): string;
1409
+ declare function coop_project_config_path(projectRoot: string): string;
1410
+ declare function repo_default_project_id(repoRoot: string): string;
1411
+ declare function repo_default_project_name(repoRoot: string): string;
1412
+ declare function has_v2_projects_layout(repoRoot: string): boolean;
1413
+ declare function has_legacy_project_layout(repoRoot: string): boolean;
1414
+ declare function read_workspace_config(repoRoot: string): CoopWorkspaceConfig;
1415
+ declare function write_workspace_config(repoRoot: string, config: CoopWorkspaceConfig): void;
1416
+ declare function read_project_config(projectRoot: string): CoopConfig;
1417
+ declare function list_projects(repoRoot: string): CoopProjectRef[];
1418
+ declare function resolve_project(repoRoot: string, options?: ResolveProjectOptions): CoopProjectRef;
1419
+ declare function ensure_workspace_layout(repoRoot: string): string;
1420
+ declare function is_project_initialized(projectRoot: string): boolean;
1421
+
1422
+ /**
1423
+ * Finds the nearest workspace root that contains package + workspace metadata.
1424
+ * [SPEC: Architecture v2.0 §2]
1425
+ */
648
1426
  declare function findRepoRoot(cwd?: string): string | null;
649
1427
  interface CompletionResult {
650
1428
  item: BacklogItem;
@@ -652,19 +1430,59 @@ interface CompletionResult {
652
1430
  releaseFile?: string;
653
1431
  alreadyComplete: boolean;
654
1432
  }
1433
+ /**
1434
+ * Marks an item as done and appends release-note metadata when status changes.
1435
+ * [SPEC: Architecture v2.0 §2]
1436
+ */
655
1437
  declare function completeItem(rootDir: string, id: string): CompletionResult;
1438
+ /**
1439
+ * Ensures the canonical .coop workspace layout and default config exist.
1440
+ * [SPEC: Architecture v2.0 §2, §3]
1441
+ */
656
1442
  declare function ensureCoopLayout(rootDir: string): void;
1443
+ /**
1444
+ * Loads repository config and backlog state from disk into an indexed in-memory view.
1445
+ * [SPEC: Architecture v2.0 §2]
1446
+ */
657
1447
  declare function loadState(rootDir: string): RepoState;
1448
+ /**
1449
+ * Filters and sorts backlog items by status/owner/label/type/search.
1450
+ * [SPEC: Architecture v2.0 §23]
1451
+ */
658
1452
  declare function queryItems(state: RepoState, filter: FilterSpec): BacklogItem[];
1453
+ /**
1454
+ * Resolves an item by case-insensitive identifier.
1455
+ * [SPEC: Architecture v2.0 §2]
1456
+ */
659
1457
  declare function getItemById(state: RepoState, id: string): BacklogItem | null;
1458
+ /**
1459
+ * Creates and persists a new backlog item with generated or explicit identifier.
1460
+ * [SPEC: Schema v2.0 §3]
1461
+ */
660
1462
  declare function createItem(rootDir: string, params: CreateItemParams): BacklogItem;
1463
+ /**
1464
+ * Updates mutable backlog fields and rewrites frontmatter/body atomically.
1465
+ * [SPEC: Schema v2.0 §3]
1466
+ */
661
1467
  declare function updateItem(rootDir: string, id: string, patch: UpdateItemParams): BacklogItem;
1468
+ /**
1469
+ * Deletes an item if it has no remaining child references.
1470
+ * [SPEC: Architecture v2.0 §2]
1471
+ */
662
1472
  declare function deleteItem(rootDir: string, id: string): BacklogItem;
1473
+ /**
1474
+ * Renders a plain-text agent prompt from task metadata and acceptance criteria.
1475
+ * [SPEC: Architecture v2.0 §13]
1476
+ */
663
1477
  declare function renderAgentPrompt(item: BacklogItem): string;
1478
+ /**
1479
+ * Performs repository-wide structural and referential checks for backlog files.
1480
+ * [SPEC: Schema v2.0 §12]
1481
+ */
664
1482
  declare function validateRepo(rootDir: string): {
665
1483
  valid: boolean;
666
1484
  errors: string[];
667
1485
  warnings: string[];
668
1486
  };
669
1487
 
670
- export { type AIAgent, type AIResource, type AgentSpec, ArtifactType, type AutoTransitionResult, type AvailabilityWindow, type BacklogItem, type BacklogItemData, CURRENT_SCHEMA_VERSION, type ComputeNode, type ComputeResource, type CoopConfig, type CreateItemParams, type Delivery, type DeliveryBudget, type DeliveryGovernance, type DeliveryRisk, type DeliveryScope, DeliveryStatus, type EffectiveCapacity, type ExecutionConstraints, type ExecutionPermissions, ExecutorType, type FilterSpec, type FrontmatterParseResult, type GraphValidationResult, type HumanMember, type HumanResource, ITEM_STATUSES, ITEM_TYPES, type Idea, IdeaStatus, type ItemLinks, type ItemStatus, type ItemType, type ParsedDelivery, type ParsedIdea, type ParsedTask, type ReadinessComputation, type ReadinessPartitions, type ReadinessState, type ReadinessTransitionEvent, type ReadinessWarning, type ReferentialValidationContext, type RepoConfig, type RepoState, type ResourceProfile, RiskLevel, RunbookAction, type RunbookStep, type SemanticValidationContext, type StructuralValidationContext, type Task, TaskComplexity, type TaskComputed, type TaskCore, TaskDeterminism, type TaskEstimate, type TaskEstimation, type TaskExecution, type TaskGovernance, type TaskGraph, type TaskPlanning, TaskPriority, type TaskResources, TaskStatus, type TaskTransitionedEvent, TaskType, type Track, type TrackWip, type TransitionContext, type TransitionResult, type TransitionValidationContext, type UpdateItemParams, VALID_TASK_TRANSITIONS, VALID_TRANSITIONS, type ValidationContext, type ValidationError, type ValidationLevel, type ValidationResult, type WriteTaskOptions, build_graph, check_blocked, check_unblocked, completeItem, compute_all_readiness, compute_readiness, compute_readiness_with_corrections, createItem, deleteItem, detect_cycle, ensureCoopLayout, extract_subgraph, findRepoRoot, find_external_dependencies, getItemById, loadState, load_graph, parseDeliveryContent, parseDeliveryFile, parseFrontmatterContent, parseFrontmatterFile, parseIdeaContent, parseIdeaFile, parseTaskContent, parseTaskFile, parseYamlContent, parseYamlFile, partition_by_readiness, queryItems, read_schema_version, renderAgentPrompt, stringifyFrontmatter, topological_sort, transition, transitive_dependencies, transitive_dependents, updateItem, validate, validateReferential, validateRepo, validateSemantic, validateStructural, validateTransition, validate_graph, validate_transition, writeTask, write_schema_version };
1488
+ export { type AIAgent, type AIResource, type AgentSpec, type AllocationResult, ArtifactType, type AuthConfig, type AuthPolicy, type AutoTransitionResult, type AvailabilityWindow, type BacklogItem, type BacklogItemData, COOP_EVENT_TYPES, CURRENT_SCHEMA_VERSION, type CapacityLedger, type ComparisonResult, type ComparisonRow, type ComputeNode, type ComputeResource, type CoopConfig, type CoopEvent, CoopEventEmitter, type CoopEventType, type CoopProjectRef, type CoopWorkspaceConfig, type CreateItemParams, type CriticalPathResult, type CriticalPathTaskMetrics, DEFAULT_SCORE_WEIGHTS, type Delivery, type DeliveryAtRisk, type DeliveryBudget, type DeliveryCommitted, type DeliveryGovernance, type DeliveryRisk, type DeliveryRiskType, type DeliveryScope, DeliveryStatus, type DetectedDeliveryRisk, type EffectiveCapacity, type EventByType, type ExecutionConstraints, type ExecutionPermissions, ExecutorType, type ExternalDependencyRef, type ExternalDependencyResolution, type ExternalDependencyResolutionStatus, type ExternalDependencyResolverOptions, type ExternalRepoConfig, type FeasibilityResult, type FeasibilityRisk, type FeasibilityStatus, type FeasibilitySummary, type FilterSpec, type FrontmatterParseResult, type GraphCycleDetected, type GraphValidationContext, type GraphValidationResult, type HookRunResult, type HumanMember, type HumanResource, ITEM_STATUSES, ITEM_TYPES, type Idea, IdeaStatus, IndexManager, type IndexStatus, type ItemLinks, type ItemStatus, type ItemType, MIGRATIONS, type MigrateRepositoryOptions, type MigrationContext, type MigrationDefinition, type MigrationReport, type MonteCarloHistogramBucket, type MonteCarloOptions, type MonteCarloResult, type MonteCarloWorkerPayload, type ParsedDelivery, type ParsedIdea, type ParsedTask, type Permission, type PermissionContext, type PluginAction, type PluginActionConsole, type PluginActionGitHubPr, type PluginActionHandler, type PluginActionHandlerResult, type PluginActionWebhook, type PluginManifest, type PluginRunOptions, type PluginRunRecord, type PluginTrigger, type PolicyAction, type ReadinessComputation, type ReadinessPartitions, type ReadinessState, type ReadinessTransitionEvent, type ReadinessWarning, type ReferentialValidationContext, type RepoConfig, type RepoState, type ResourceProfile, RiskLevel, type Role, type Run, type RunCompleted, type RunFailed, type RunResourcesConsumed, type RunStarted, RunStatus, type RunStepResult, RunStepStatus, RunbookAction, type RunbookStep, type ScheduleOptions, type ScoreContext, type ScoredTask, type SemanticValidationContext, type SimulationResult, type StructuralValidationContext, type Task, type TaskAssigned, TaskComplexity, type TaskComputed, type TaskCore, type TaskCreated, TaskDeterminism, type TaskEstimate, type TaskEstimation, type TaskExecution, type TaskGovernance, type TaskGraph, type TaskPlanning, TaskPriority, type TaskResources, type TaskScheduleEntry, TaskStatus, type TaskTransitioned, type TaskTransitionedEvent, TaskType, type Track, type TrackUtilization, type TrackWip, type TransitionContext, type TransitionResult, type TransitionValidationContext, type UpdateItemParams, VALID_TASK_TRANSITIONS, VALID_TRANSITIONS, type ValidationContext, type ValidationError, type ValidationLevel, type ValidationResult, type VelocityMetrics, type VelocityPoint, type VelocityTrend, type WhatIfBaseline, type WhatIfModification, type WriteTaskOptions, allocate, allocate_ai, allocate_ai_tokens, analyze_feasibility, analyze_what_if, build_capacity_ledger, build_graph, check_blocked, check_permission, check_unblocked, check_wip, completeItem, complexity_penalty, compute_all_readiness, compute_critical_path, compute_readiness, compute_readiness_with_corrections, compute_score, compute_velocity, coop_project_config_path, coop_project_root, coop_projects_dir, coop_workspace_config_path, coop_workspace_dir, createItem, create_seeded_rng, critical_path_weight, deleteItem, dependency_unlock_weight, detect_cycle, detect_delivery_risks, determinism_weight, effective_weekly_hours, effort_or_default, ensureCoopLayout, ensure_workspace_layout, executor_fit_weight, external_dependencies_for_task, extract_subgraph, findRepoRoot, find_external_dependencies, getItemById, get_remaining_tokens, get_user_role, has_legacy_project_layout, has_v2_projects_layout, is_external_dependency, is_project_initialized, list_projects, loadState, load_auth_config, load_completed_runs, load_graph, load_plugins, migrate_repository, migrate_task, monte_carlo_forecast, parseDeliveryContent, parseDeliveryFile, parseFrontmatterContent, parseFrontmatterFile, parseIdeaContent, parseIdeaFile, parseTaskContent, parseTaskFile, parseYamlContent, parseYamlFile, parse_external_dependency, partition_by_readiness, pert_hours, pert_stddev, priority_weight, queryItems, read_project_config, read_schema_version, read_workspace_config, renderAgentPrompt, repo_default_project_id, repo_default_project_name, resolve_external_dependencies, resolve_project, risk_penalty, run_hook, run_monte_carlo_chunk, run_plugins_for_event, sample_pert_beta, sample_task_hours, schedule_next, simulate_schedule, stringifyFrontmatter, stringifyYamlContent, task_effort_hours, topological_sort, transition, transitive_dependencies, transitive_dependents, type_weight, updateItem, urgency_weight, validate, validateReferential, validateRepo, validateSemantic, validateStructural, validateTransition, validate_graph, validate_transition, writeTask, writeYamlFile, write_schema_version, write_workspace_config };