@eightkk/vue-weave 0.0.0-stage → 1.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +517 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/LICENSE +21 -0
  4. package/README.ja.md +275 -0
  5. package/README.md +272 -2
  6. package/THIRD_PARTY_NOTICES.md +25 -0
  7. package/dist/core-BH5rTsKp.js +13606 -0
  8. package/dist/core.js +1 -0
  9. package/dist/index.js +8022 -0
  10. package/dist/style.css +2 -0
  11. package/dist/types/components/GanttChart.vue.d.ts +339 -0
  12. package/dist/types/components/NetworkGraph.vue.d.ts +252 -0
  13. package/dist/types/components/types.d.ts +27 -0
  14. package/dist/types/composables/useAsyncGraphLayout.d.ts +163 -0
  15. package/dist/types/composables/useEditHistory.d.ts +13 -0
  16. package/dist/types/composables/useEditTransaction.d.ts +46 -0
  17. package/dist/types/composables/useLinkedSelection.d.ts +118 -0
  18. package/dist/types/composables/useTimelineView.d.ts +24 -0
  19. package/dist/types/composables/useWindowedData.d.ts +83 -0
  20. package/dist/types/core/actuals.d.ts +170 -0
  21. package/dist/types/core/calendarFormat.d.ts +65 -0
  22. package/dist/types/core/editTransaction.d.ts +96 -0
  23. package/dist/types/core/exportSvg.d.ts +236 -0
  24. package/dist/types/core/fieldEditing.d.ts +114 -0
  25. package/dist/types/core/graph.d.ts +196 -0
  26. package/dist/types/core/graphAlgorithms.d.ts +51 -0
  27. package/dist/types/core/graphAnalysis.d.ts +96 -0
  28. package/dist/types/core/graphCollapse.d.ts +62 -0
  29. package/dist/types/core/graphCrossings.d.ts +25 -0
  30. package/dist/types/core/graphEditing.d.ts +52 -0
  31. package/dist/types/core/graphExpansion.d.ts +71 -0
  32. package/dist/types/core/graphFlow.d.ts +184 -0
  33. package/dist/types/core/graphForce.d.ts +29 -0
  34. package/dist/types/core/graphGeometry.d.ts +31 -0
  35. package/dist/types/core/graphIncremental.d.ts +93 -0
  36. package/dist/types/core/graphLasso.d.ts +15 -0
  37. package/dist/types/core/graphLayoutRequests.d.ts +218 -0
  38. package/dist/types/core/graphLayouts.d.ts +81 -0
  39. package/dist/types/core/graphObstacleRouting.d.ts +68 -0
  40. package/dist/types/core/graphPortRules.d.ts +111 -0
  41. package/dist/types/core/graphRouting.d.ts +84 -0
  42. package/dist/types/core/graphSnapping.d.ts +34 -0
  43. package/dist/types/core/graphSpatial.d.ts +49 -0
  44. package/dist/types/core/graphSwimlanes.d.ts +77 -0
  45. package/dist/types/core/graphTraversal.d.ts +51 -0
  46. package/dist/types/core/graphView.d.ts +73 -0
  47. package/dist/types/core/index.d.ts +75 -0
  48. package/dist/types/core/interchange.d.ts +6 -0
  49. package/dist/types/core/interchangeCsv.d.ts +75 -0
  50. package/dist/types/core/interchangeICalendar.d.ts +111 -0
  51. package/dist/types/core/interchangeMsProject.d.ts +339 -0
  52. package/dist/types/core/leveling.d.ts +57 -0
  53. package/dist/types/core/pert.d.ts +62 -0
  54. package/dist/types/core/placement.d.ts +100 -0
  55. package/dist/types/core/planComparison.d.ts +275 -0
  56. package/dist/types/core/resourceLoad.d.ts +65 -0
  57. package/dist/types/core/resourceTimeline.d.ts +179 -0
  58. package/dist/types/core/rowHierarchy.d.ts +25 -0
  59. package/dist/types/core/scheduleDiagnostics.d.ts +37 -0
  60. package/dist/types/core/scheduleModel.d.ts +187 -0
  61. package/dist/types/core/scheduleTrace.d.ts +118 -0
  62. package/dist/types/core/scheduling.d.ts +194 -0
  63. package/dist/types/core/snapshot.d.ts +388 -0
  64. package/dist/types/core/statusDate.d.ts +36 -0
  65. package/dist/types/core/timeRangeTargets.d.ts +67 -0
  66. package/dist/types/core/timeline.d.ts +194 -0
  67. package/dist/types/core/timelineView.d.ts +101 -0
  68. package/dist/types/core/types.d.ts +783 -0
  69. package/dist/types/core/viewBindings.d.ts +112 -0
  70. package/dist/types/core/windowedData.d.ts +255 -0
  71. package/dist/types/core/workCalendar.d.ts +41 -0
  72. package/dist/types/core/workingTimeScale.d.ts +33 -0
  73. package/dist/types/index.d.ts +52 -0
  74. package/docs/api.md +1989 -0
  75. package/docs/architecture.md +112 -0
  76. package/docs/code-of-conduct.md +24 -0
  77. package/docs/integration.md +931 -0
  78. package/docs/scheduling.md +586 -0
  79. package/docs/security.md +26 -0
  80. package/docs/third-party-licenses.md +33 -0
  81. package/package.json +79 -4
@@ -0,0 +1,37 @@
1
+ import type { LevelResourcesResult } from './leveling.js';
2
+ import type { ResourceLoadSegment } from './resourceLoad.js';
3
+ import type { ScheduleConstraintName, ScheduleResult } from './scheduling.js';
4
+ import type { TimeRange } from './timeline.js';
5
+ import type { EntityRef } from './viewBindings.js';
6
+ export type PlanningDiagnosticSeverity = 'info' | 'warning' | 'error';
7
+ /**
8
+ * `schedule-cycle`: dependencies form a cycle. `schedule-infeasible`: a task has no date that meets its bounds.
9
+ * `resource-overload`: a resource has more load than capacity in `range`. `leveling-unresolved`: leveling found no
10
+ * capacity-feasible placement for a task. `manual-conflict`: a link into a manually scheduled task is violated by its
11
+ * manual dates (an entry of `manualConflicts`); the plan is still valid, so it is a warning.
12
+ */
13
+ export type PlanningDiagnosticCode = 'schedule-cycle' | 'schedule-infeasible' | 'resource-overload' | 'leveling-unresolved' | 'manual-conflict';
14
+ /**
15
+ * One problem of a calculated plan, as data for an application's own list. Entities use the kinds `task`,
16
+ * `dependency` and `resource`. The ID and code do not depend on any display language.
17
+ */
18
+ export interface PlanningDiagnostic {
19
+ /** Stable for the same problem across recalculations: a JSON array of the code and the identifying values. */
20
+ id: string;
21
+ code: PlanningDiagnosticCode;
22
+ severity: PlanningDiagnosticSeverity;
23
+ entities: readonly EntityRef[];
24
+ range?: TimeRange;
25
+ /** For `schedule-infeasible`: the conflicting bound names of `ScheduleFailure.constraints`. */
26
+ constraints?: readonly ScheduleConstraintName[];
27
+ /** IDs of related reasons in the result's `trace`, when the result was calculated with `explain`. */
28
+ reasonIds: readonly string[];
29
+ }
30
+ /**
31
+ * Turn the failures, cycles, manual conflicts, overloads and unresolved tasks of a `scheduleTasks` or `levelResources`
32
+ * result into one list. A success lists its manual conflicts first (in `manualConflicts` order), then unresolved tasks,
33
+ * then overloads. `load` (for example from `calculateResourceLoad`) supplies the overloads and then replaces the result's own
34
+ * `overloads`; only segments with `overload > 0` become diagnostics. A failure yields only its own diagnostics, never
35
+ * the overloads of an earlier plan. The arguments are not modified.
36
+ */
37
+ export declare function toPlanningDiagnostics(result: ScheduleResult | LevelResourcesResult, load?: readonly ResourceLoadSegment[]): PlanningDiagnostic[];
@@ -0,0 +1,187 @@
1
+ import type { ScheduleConstraintName, ScheduleCycle, ScheduleInput, ScheduleLink, ScheduleTask, ScheduleFailure } from './scheduling.js';
2
+ import type { TimeRange } from './timeline.js';
3
+ export type Limits = {
4
+ startLower: number;
5
+ endLower: number;
6
+ startUpper: number;
7
+ endUpper: number;
8
+ };
9
+ export type LimitKey = keyof Limits;
10
+ /**
11
+ * A bound without a constraint or dependency is a leveling horizon bound. `summaryId` names the summary task that a
12
+ * subtask inherits a constraint from. `linkTo` names the successor whose dates give an upper dependency bound: a link
13
+ * into a summary task is attached to each of its leaves under the same ID, so the ID alone does not name the leaf.
14
+ */
15
+ export type Bound = {
16
+ value: number;
17
+ constraint?: ScheduleConstraintName;
18
+ dependencyId?: string;
19
+ summaryId?: string;
20
+ linkTo?: string;
21
+ };
22
+ export type Bounds = Record<LimitKey, Bound[]>;
23
+ export type Slot = TimeRange & {
24
+ workStart: number;
25
+ };
26
+ /** Work starts and finishes have different inverses at shift boundaries. */
27
+ export declare function workClock(periods: readonly TimeRange[], quantum: number): {
28
+ periods: readonly TimeRange[];
29
+ total: number;
30
+ workAt: (time: number) => number;
31
+ dateAt: (work: number, finish: boolean) => number;
32
+ minFinishWork: (time: number) => number;
33
+ maxStartWork: (time: number) => number;
34
+ slices: (interval: TimeRange) => TimeRange[];
35
+ };
36
+ export type WorkClock = ReturnType<typeof workClock>;
37
+ export declare function slotFor(clock: WorkClock, duration: number, limits: Limits, latest: boolean): Slot | undefined;
38
+ export declare function sourceFinish(link: ScheduleLink): boolean;
39
+ export declare function targetFinish(link: ScheduleLink): boolean;
40
+ export interface ModelTask {
41
+ id: string;
42
+ index: number;
43
+ source: ScheduleTask;
44
+ clock: WorkClock;
45
+ duration: number;
46
+ alap: boolean;
47
+ bounds: Bounds;
48
+ /** Links that bind this task: every link into it, unless the task is manual. */
49
+ incoming: ScheduleLink[];
50
+ /** Links to tasks that are not manual. */
51
+ outgoing: ScheduleLink[];
52
+ /** For a manual task: the links into it, which no pass applies. They still count for cycle detection. */
53
+ manualIncoming: ScheduleLink[];
54
+ /** Links to manual tasks. No pass applies them, except an ALAP placement that already meets them. */
55
+ manualOutgoing: ScheduleLink[];
56
+ /** The manually scheduled dates of a manual task. */
57
+ manual?: TimeRange;
58
+ /** Only when explaining: the continuous clock, the task's calendar clock without its pauses, and the calendar's ID. */
59
+ calendar?: {
60
+ continuous: WorkClock;
61
+ clock: WorkClock;
62
+ id: string | undefined;
63
+ };
64
+ /** The active summary task this task belongs to. */
65
+ parent?: string;
66
+ /**
67
+ * Present for a summary task: its active children in input order, and its active leaf descendants as the slice
68
+ * `[first, last)` of `ScheduleModel.leaves`. A summary has no incoming links: links into it are attached to its leaves.
69
+ */
70
+ summary?: {
71
+ children: string[];
72
+ first: number;
73
+ last: number;
74
+ };
75
+ }
76
+ export interface ScheduleModel {
77
+ range: TimeRange;
78
+ quantum: number;
79
+ tasks: Map<string, ModelTask>;
80
+ continuous: WorkClock;
81
+ linkIndex: Map<string, number>;
82
+ validateTime: (value: number | undefined) => void;
83
+ /** IDs of inactive tasks. They are validated but are not in `tasks`, and their links are attached to no task. */
84
+ inactive: ReadonlySet<string>;
85
+ /** Active leaf tasks in hierarchy order, so that the leaves of each summary are contiguous. Empty without hierarchy. */
86
+ leaves: readonly string[];
87
+ /** Active summary tasks, each after all of its subtasks (post-order). Empty without hierarchy. */
88
+ summaries: readonly string[];
89
+ /** The input links by ID. */
90
+ links: ReadonlyMap<string, ScheduleLink>;
91
+ }
92
+ /**
93
+ * Subtasks whose start has happened, keyed by the input object they belong to. They do not inherit the start bounds of
94
+ * their summary tasks (links into a summary and its `startNoEarlierThan`). Only `rescheduleFromStatusDate` and
95
+ * `rescheduleFromActuals` set it.
96
+ */
97
+ export declare const startedSubtasks: WeakMap<ScheduleInput, ReadonlySet<string>>;
98
+ /** `input`, with `started` recorded as its started subtasks when there are any. */
99
+ export declare function withStartedSubtasks(input: ScheduleInput, started: ReadonlySet<string>): ScheduleInput;
100
+ /** Check the status date of `rescheduleFromStatusDate` and `rescheduleFromActuals` against a model. */
101
+ export declare function checkStatusDate(model: ScheduleModel, statusDate: number): void;
102
+ /**
103
+ * Check a recorded interval of scheduling input that needs positive length inside the schedule range, with the
104
+ * scheduler's own messages: both endpoints as `validateTime` checks every scheduling date (finite, integer, aligned with
105
+ * the horizon and quantum), then positive length as for working periods and pauses, then the range. Callers add which
106
+ * interval it is with `withContext`.
107
+ */
108
+ export declare function checkScheduleInterval(model: ScheduleModel, interval: TimeRange): void;
109
+ /** Whether a value can be read like a `ReadonlyMap`: it has `get` and is iterable. */
110
+ export declare function isMapLike(value: unknown): value is ReadonlyMap<unknown, unknown>;
111
+ /**
112
+ * Validate a scheduling input and index it. Throws for malformed input. With `explain`, each task also keeps its
113
+ * calendar clock without pauses, so that a trace can tell calendar time off from pauses.
114
+ */
115
+ export declare function buildScheduleModel(input: ScheduleInput, explain?: boolean): ScheduleModel;
116
+ /** Check the `parentId` of one task as `buildScheduleModel` does: absent, or a non-empty string. */
117
+ export declare function checkParentId(task: ScheduleTask): void;
118
+ /**
119
+ * Check the summary task hierarchy of `parentId` with the scheduler's errors: unknown parents, parent cycles, and what a
120
+ * summary task cannot have. Returns the children of each summary in input order and the top-level tasks. Expects task
121
+ * IDs and `parentId` values that are already checked. Iterative.
122
+ */
123
+ export declare function checkSummaryHierarchy(list: readonly ScheduleTask[]): {
124
+ children: Map<string, ScheduleTask[]>;
125
+ roots: ScheduleTask[];
126
+ };
127
+ /**
128
+ * Check a link against a valid summary task hierarchy with the scheduler's errors: it must not link a summary with its
129
+ * own subtask, and only FS and SS links can end at a summary.
130
+ */
131
+ export declare function checkSummaryLink(link: ScheduleLink, hierarchy: {
132
+ isSummary: (id: string) => boolean;
133
+ isAncestor: (ancestor: string, id: string) => boolean;
134
+ }): void;
135
+ /** The span of a summary's children in `slots`. */
136
+ export declare function summarySlot(task: ModelTask, slots: ReadonlyMap<string, TimeRange>): Slot;
137
+ /** Roll up the summaries of `slots` from their children, in topological order. */
138
+ export declare function rollUpSummaries(model: ScheduleModel, order: readonly string[], slots: Map<string, Slot>): void;
139
+ /**
140
+ * Upper bounds that a summary passes down to its subtasks. `end` binds the finish of every subtask; `start` binds only
141
+ * the subtasks whose earliest start is the summary's earliest start, because the summary starts with the earliest one.
142
+ */
143
+ export type SummaryUpper = {
144
+ end: Bound[];
145
+ start: Bound[];
146
+ };
147
+ /**
148
+ * The upper bounds of a summary: those its parent passes down, plus those of its outgoing links measured against the
149
+ * successors in `placed`. With `meetManual`, a link into a manual task also binds when the summary's earliest dates
150
+ * already meet it (as for ALAP placement); otherwise links into manual tasks bind nothing.
151
+ */
152
+ export declare function summaryUpper(model: ScheduleModel, task: ModelTask, placed: ReadonlyMap<string, TimeRange>, inherited: ReadonlyMap<string, SummaryUpper>, earliest: ReadonlyMap<string, TimeRange>, meetManual?: boolean): SummaryUpper;
153
+ /**
154
+ * Push the upper bounds of a task's links into manual tasks to `end` or `start`, but only those that its earliest dates
155
+ * `own` already meet, so that placing the task later adds no manual conflict.
156
+ */
157
+ export declare function addManualUpper(model: ScheduleModel, task: ModelTask, own: TimeRange, end: Bound[], start: Bound[]): void;
158
+ /** Add the upper bounds that a leaf inherits from its summary tasks. */
159
+ export declare function addSummaryUpper(bounds: Bounds, task: ModelTask, inherited: ReadonlyMap<string, SummaryUpper>, earliest: ReadonlyMap<string, TimeRange>): Bounds;
160
+ /** The slot of a manual task: its manual dates. */
161
+ export declare function manualSlot(task: ModelTask): Slot;
162
+ /** Every outgoing link of a task, including those to manual tasks. */
163
+ export declare function allOutgoing(task: ModelTask): ScheduleLink[];
164
+ /** Kahn order, or the strongly connected components that block it. */
165
+ export declare function topologicalOrder(model: ScheduleModel): {
166
+ order: string[];
167
+ } | {
168
+ cycles: ScheduleCycle[];
169
+ };
170
+ export declare function cloneBounds(bounds: Bounds): Bounds;
171
+ export declare function limitsOf(bounds: Bounds): Limits;
172
+ /** Own bounds plus lower bounds from placed predecessors. */
173
+ export declare function lowerBounds(task: ModelTask, placed: ReadonlyMap<string, TimeRange>): Bounds;
174
+ /** Add upper bounds from placed successors and an optional project finish. */
175
+ export declare function addUpperBounds(bounds: Bounds, task: ModelTask, placed: ReadonlyMap<string, TimeRange>, finish?: number): Bounds;
176
+ /**
177
+ * The lower and upper limits that decide a slot. Ties are all kept. Lower and upper limits are compared in working
178
+ * time on the task's clock, the same way `slotFor` places the task; milestones compare elapsed values.
179
+ */
180
+ export declare function bindingKeys(clock: WorkClock, duration: number, limits: Limits): {
181
+ lower: LimitKey[];
182
+ upper: LimitKey[];
183
+ };
184
+ /** The bounds of one key at its limit. `range` is dropped when another bound has the same value. */
185
+ export declare function bindingBounds(bounds: Bounds, limits: Limits, key: LimitKey): Bound[];
186
+ /** Name the bounds that conflict for a task without a feasible slot. */
187
+ export declare function diagnose(model: ScheduleModel, task: ModelTask, bounds: Bounds): ScheduleFailure;
@@ -0,0 +1,118 @@
1
+ import { type Bounds, type Limits, type ModelTask } from './scheduleModel.js';
2
+ import type { LevelResourcesSuccess } from './leveling.js';
3
+ import type { ScheduleConstraintName, ScheduleFailure, ScheduleLink, ScheduleSuccess } from './scheduling.js';
4
+ import type { TimeRange } from './timeline.js';
5
+ /**
6
+ * The calculation step a reason belongs to. `earliest` and `latest` are the forward and backward passes of
7
+ * `scheduleTasks`, `placement` places `mode: 'alap'` tasks, and `leveling` is the reservation loop of `levelResources`.
8
+ */
9
+ export type ScheduleReasonPhase = 'earliest' | 'latest' | 'placement' | 'leveling';
10
+ /**
11
+ * What a reason is about. `dependency` is a predecessor or successor link, `constraint` a task constraint
12
+ * (`startNoEarlierThan`, `startNoLaterThan`, `finishNoEarlierThan`, `finishNoLaterThan`, `fixedStart`),
13
+ * `project-bound` the scheduling range, the input `deadline`, the project finish or a leveling horizon, `calendar` time
14
+ * off in the task's calendar, `pause` one of the task's pauses, `capacity` a resource without enough capacity, and
15
+ * `manual` the manually scheduled dates of a task with `manual`, which no other bound moves.
16
+ */
17
+ export type ScheduleReasonKind = 'dependency' | 'constraint' | 'calendar' | 'pause' | 'capacity' | 'project-bound' | 'manual';
18
+ /** The limit of the task that a reason acts on. */
19
+ export type ScheduleReasonBound = 'startLower' | 'endLower' | 'startUpper' | 'endUpper';
20
+ /** One structured cause of a task's dates. Every field is data; nothing is worded for display. */
21
+ export interface ScheduleReason {
22
+ /** Unique within its trace. */
23
+ id: string;
24
+ taskId: string;
25
+ phase: ScheduleReasonPhase;
26
+ kind: ScheduleReasonKind;
27
+ bound: ScheduleReasonBound;
28
+ /** The time the cause asks for, before calendars, pauses or capacity. */
29
+ candidateTime?: number;
30
+ /**
31
+ * The start or end (as `bound` says) the task got in this phase. In `leveling`, bound reasons describe the earliest
32
+ * placement before capacity is checked, and `capacity` reasons the placement after it.
33
+ */
34
+ placedTime?: number;
35
+ dependencyId?: string;
36
+ /** The constraint name, as `ScheduleFailure.constraints` names it. A leveling horizon bound has none. */
37
+ constraint?: ScheduleConstraintName;
38
+ /** The calendar of a `calendar` reason; absent for the default continuous calendar. */
39
+ calendarId?: string;
40
+ resourceId?: string;
41
+ /** Units of the resource the task needs. */
42
+ demand?: number;
43
+ /** Capacity of the resource in `range`, before any reservation. */
44
+ capacity?: number;
45
+ /**
46
+ * The other end of a dependency, the tasks that finish the project, the tasks holding the capacity, or the summary
47
+ * task that a subtask inherits a `constraint` from.
48
+ */
49
+ relatedTaskIds?: readonly string[];
50
+ /** The interval in which a resource lacked capacity. */
51
+ range?: TimeRange;
52
+ /** Reasons that explain this one, for example the reasons of a predecessor. */
53
+ parentReasonIds: readonly string[];
54
+ }
55
+ export interface ScheduleTrace {
56
+ /** All reasons, each after its parents. */
57
+ reasons: readonly ScheduleReason[];
58
+ /** The IDs of each task's own reasons, in input order of the tasks. */
59
+ taskReasonIds: ReadonlyMap<string, readonly string[]>;
60
+ }
61
+ export interface ScheduleOptions {
62
+ /** Record why each task got its dates and return them as `trace`. Does not change any date. Defaults to false. */
63
+ explain?: boolean;
64
+ }
65
+ /** A successful `scheduleTasks` result with its trace. */
66
+ export type ExplainedScheduleSuccess = ScheduleSuccess & {
67
+ trace: ScheduleTrace;
68
+ };
69
+ export type ExplainedScheduleResult = ExplainedScheduleSuccess | ScheduleFailure;
70
+ /** A successful `levelResources` result with its trace. */
71
+ export type ExplainedLevelResourcesSuccess = LevelResourcesSuccess & {
72
+ trace: ScheduleTrace;
73
+ };
74
+ export type ExplainedLevelResourcesResult = ExplainedLevelResourcesSuccess | ScheduleFailure;
75
+ export interface CollectScheduleReasonsOptions {
76
+ /** Start only from the task's reasons in these phases. Parents are followed in every phase. */
77
+ phases?: readonly ScheduleReasonPhase[];
78
+ }
79
+ /**
80
+ * The reasons of one task followed by all their ancestors, breadth first. Each reason appears once even when many
81
+ * paths share it. Throws for an unknown task or parent reason.
82
+ */
83
+ export declare function collectScheduleReasons(trace: ScheduleTrace, taskId: string, options?: CollectScheduleReasonsOptions): ScheduleReason[];
84
+ /** Read and check the options argument of `scheduleTasks` and `levelResources`. */
85
+ export declare function explainOption(options: ScheduleOptions | undefined): boolean;
86
+ type ReasonData = Omit<ScheduleReason, 'id'>;
87
+ /** Collects reasons while a schedule is calculated. Created only when explaining. */
88
+ export declare class ScheduleTraceRecorder {
89
+ private readonly reasons;
90
+ private readonly byTask;
91
+ private readonly byPhase;
92
+ constructor(taskIds: Iterable<string>);
93
+ add(data: ReasonData): string;
94
+ ids(phase: ScheduleReasonPhase, taskId: string): readonly string[];
95
+ trace(): ScheduleTrace;
96
+ }
97
+ /** Record the `manual` reason of a manual task in one phase: its start, which its manual dates fix. */
98
+ export declare function recordManualReason(recorder: ScheduleTraceRecorder, phase: ScheduleReasonPhase, task: ModelTask): string;
99
+ /** Where the reasons of a slot's binding bounds point to. */
100
+ export interface SlotReasonContext {
101
+ /** Parent reasons of a dependency bound: the other task's reasons in the relevant phase. */
102
+ linkParents(link: ScheduleLink, upper: boolean): readonly string[];
103
+ /** Parents and tasks of the `projectFinish` bound. */
104
+ finish?: {
105
+ parents: readonly string[];
106
+ taskIds: readonly string[];
107
+ };
108
+ /** Parents of the unnamed leveling horizon bounds. */
109
+ horizon?: readonly string[];
110
+ /** All links by ID, for the links of a summary task that bind its subtasks. */
111
+ links?: ReadonlyMap<string, ScheduleLink>;
112
+ }
113
+ /**
114
+ * Record the binding bounds of a placed slot: the lower ones for an earliest placement, the upper ones for a latest
115
+ * placement. Tied bounds are all recorded. A shift by calendar time off or by pauses becomes its own reason.
116
+ */
117
+ export declare function recordSlotReasons(recorder: ScheduleTraceRecorder, phase: ScheduleReasonPhase, task: ModelTask, bounds: Bounds, limits: Limits, slot: TimeRange, latest: boolean, context: SlotReasonContext): void;
118
+ export {};
@@ -0,0 +1,194 @@
1
+ import { type ExplainedScheduleResult, type ScheduleOptions } from './scheduleTrace.js';
2
+ import type { WorkCalendar } from './workCalendar.js';
3
+ import type { TimeRange } from './timeline.js';
4
+ import type { TimelineDependency } from './types.js';
5
+ export interface ScheduleTask {
6
+ id: string;
7
+ /**
8
+ * Makes this task a subtask of the summary task with this ID. A task that other tasks name as their parent is a
9
+ * summary task: its dates are the span of its subtasks and its own `duration`, `calendarId`, `pauses`, `splittable`
10
+ * and `priority` are ignored. It cannot have `fixedStart`, `startNoLaterThan`, `finishNoEarlierThan`, `manual` or
11
+ * `mode: 'alap'`. Its `startNoEarlierThan` and `finishNoLaterThan` apply to every subtask, and an inactive summary
12
+ * makes all of its subtasks inactive. See "Summary tasks" in docs/scheduling.md.
13
+ */
14
+ parentId?: string;
15
+ duration: number;
16
+ calendarId?: string;
17
+ startNoEarlierThan?: number;
18
+ startNoLaterThan?: number;
19
+ finishNoEarlierThan?: number;
20
+ finishNoLaterThan?: number;
21
+ fixedStart?: number;
22
+ /**
23
+ * Placement mode. `'alap'` places the task at the latest dates that move no other task
24
+ * and keep the project finish. Defaults to `'asap'`.
25
+ */
26
+ mode?: 'asap' | 'alap';
27
+ /** Elapsed half-open intervals in which this task does no work, in addition to its calendar's time off. */
28
+ pauses?: readonly TimeRange[];
29
+ /** Allows `levelResources` to interrupt the task's work. `scheduleTasks` ignores it. */
30
+ splittable?: boolean;
31
+ /** Leveling priority; higher values are placed first. `scheduleTasks` ignores it. Defaults to 0. */
32
+ priority?: number;
33
+ /**
34
+ * Manually scheduled dates, like a manually scheduled task in Microsoft Project: the task stays at exactly
35
+ * `[manual.start, manual.end)` in elapsed time. Its predecessors, own bounds, `mode` and calendar do not move it, and
36
+ * `duration` is ignored; successors still follow it through their links. Both dates must align with the horizon and
37
+ * quantum and lie inside `range`, with `end >= start`; equal dates make a milestone.
38
+ */
39
+ manual?: TimeRange;
40
+ /**
41
+ * Leaves the task out of the calculation, like an inactive task in Microsoft Project: it, every dependency that
42
+ * touches it and its resource assignments are ignored, and it is not in the result's `tasks`. It is still validated.
43
+ */
44
+ inactive?: boolean;
45
+ }
46
+ export interface ScheduleLink extends TimelineDependency {
47
+ /** Elapsed time. Negative values allow overlap. */
48
+ lag?: number;
49
+ }
50
+ export interface ScheduleInput {
51
+ range: TimeRange;
52
+ quantum?: number;
53
+ calendars?: readonly WorkCalendar[];
54
+ defaultCalendarId?: string;
55
+ tasks: readonly ScheduleTask[];
56
+ dependencies?: readonly ScheduleLink[];
57
+ deadline?: number;
58
+ }
59
+ export interface ScheduledTask extends TimeRange {
60
+ id: string;
61
+ work: readonly TimeRange[];
62
+ latestStart: number;
63
+ latestEnd: number;
64
+ totalFloat: number;
65
+ /** Float in working time on the task's calendar. Unlike `totalFloat`, this is also working time for milestones. */
66
+ workFloat: number;
67
+ critical: boolean;
68
+ /** Present only for `mode: 'alap'` tasks: the earliest start that `totalFloat` is measured from. */
69
+ earliestStart?: number;
70
+ /** Present only for `mode: 'alap'` tasks: the earliest finish. */
71
+ earliestEnd?: number;
72
+ /**
73
+ * Present (true) only for tasks with `manual` dates. Their latest dates are their own dates, their float is 0 and
74
+ * they are never critical.
75
+ */
76
+ manual?: true;
77
+ /**
78
+ * Present (true) only for summary tasks. Their dates are the span of their subtasks' dates, their latest dates the
79
+ * span of their subtasks' latest dates, `work` is empty, `totalFloat` and `workFloat` are the smallest of their
80
+ * subtasks that are not manual (0 when every subtask is manual), and they are critical when a subtask is critical.
81
+ */
82
+ summary?: true;
83
+ /** The `parentId` of the input task. Present only for a subtask. */
84
+ parentId?: string;
85
+ }
86
+ /**
87
+ * A link into a manual task that the task's manual dates violate. For a link into a summary task, each manual subtask
88
+ * whose dates violate it is listed.
89
+ */
90
+ export interface ScheduleManualConflict {
91
+ /** The manual task. */
92
+ taskId: string;
93
+ dependencyId: string;
94
+ }
95
+ /** Names of the bounds that can make a task infeasible. `calendar` covers the task's working time after pauses. */
96
+ export type ScheduleConstraintName = 'range' | 'startNoEarlierThan' | 'startNoLaterThan' | 'finishNoEarlierThan' | 'finishNoLaterThan' | 'fixedStart' | 'deadline' | 'projectFinish' | 'calendar';
97
+ /** A strongly connected group of tasks. Every listed dependency lies on at least one cycle. */
98
+ export interface ScheduleCycle {
99
+ taskIds: readonly string[];
100
+ dependencyIds: readonly string[];
101
+ }
102
+ export interface ScheduleSuccess {
103
+ ok: true;
104
+ finish: number;
105
+ /** One entry per task in input order, without inactive tasks. */
106
+ tasks: readonly ScheduledTask[];
107
+ criticalDependencyIds: readonly string[];
108
+ /**
109
+ * Links into manual tasks whose manual dates violate them, measured against the predecessor's dates in `tasks`, in
110
+ * link order. Present only when not empty.
111
+ */
112
+ manualConflicts?: readonly ScheduleManualConflict[];
113
+ /** IDs of the inactive tasks of the input, in input order. Present only when not empty. */
114
+ inactiveTaskIds?: readonly string[];
115
+ }
116
+ export type ScheduleFailure = {
117
+ ok: false;
118
+ code: 'cycle';
119
+ cycles: readonly ScheduleCycle[];
120
+ } | {
121
+ ok: false;
122
+ code: 'infeasible';
123
+ taskId: string;
124
+ /** Binding bounds of the task that conflict, in a fixed order. */
125
+ constraints: readonly ScheduleConstraintName[];
126
+ /** Binding dependencies of the task that conflict, in input order. */
127
+ dependencyIds: readonly string[];
128
+ };
129
+ export type ScheduleResult = ScheduleSuccess | ScheduleFailure;
130
+ /**
131
+ * Calculate earliest and latest feasible dates without changing the supplied plan. With `{ explain: true }`, a
132
+ * successful result also has a `trace` of why each task got its dates; the dates themselves do not change.
133
+ *
134
+ * A task with `manual` dates keeps them in every pass; links into it bind nothing (they still count for cycles), and
135
+ * each one its dates violate is listed in `manualConflicts`. A manual task that ends after the `deadline` makes the plan
136
+ * infeasible. An `inactive` task, its links and its result entry are left out.
137
+ *
138
+ * Tasks with a `parentId` form a summary hierarchy: a summary task's dates roll up from its subtasks, a link into it
139
+ * binds the start of every subtask, and a link from it uses its rolled-up dates.
140
+ */
141
+ export declare function scheduleTasks(input: ScheduleInput, options?: ScheduleOptions & {
142
+ explain?: false;
143
+ }): ScheduleResult;
144
+ export declare function scheduleTasks(input: ScheduleInput, options: ScheduleOptions & {
145
+ explain: true;
146
+ }): ExplainedScheduleResult;
147
+ export declare function scheduleTasks(input: ScheduleInput, options?: ScheduleOptions): ScheduleResult | ExplainedScheduleResult;
148
+ /** A proposed new start, and optionally a new end, of one task for `propagateEdit`. */
149
+ export interface ScheduleEdit {
150
+ id: string;
151
+ start: number;
152
+ /**
153
+ * When supplied, the task's working duration becomes the working time in [start, end) on its calendar. For a manual
154
+ * task, it is the new end of its manual dates.
155
+ */
156
+ end?: number;
157
+ }
158
+ /** A task whose dates differ between two schedules. */
159
+ export interface ScheduleChange {
160
+ id: string;
161
+ before: TimeRange;
162
+ after: TimeRange;
163
+ }
164
+ export interface PropagateEditSuccess {
165
+ ok: true;
166
+ /** The full schedule with the edited task pinned. */
167
+ schedule: ScheduleSuccess;
168
+ /** Every task whose start or end differs from `scheduleTasks(input)`, in input order. */
169
+ changes: ScheduleChange[];
170
+ }
171
+ export type PropagateEditResult = PropagateEditSuccess | ScheduleFailure;
172
+ /**
173
+ * Reschedule a plan after one task is moved or resized, for example to preview or apply a GanttChart edit together
174
+ * with its downstream effects. The edited task gets `fixedStart` at the new start (replacing any fixed start it had)
175
+ * and, with `end`, the working duration of [start, end) on its calendar; every other bound and dependency still
176
+ * applies. A manual task gets new manual dates instead: the new start and `end`, or the new start and its previous
177
+ * elapsed length; dates outside the range make the edited plan infeasible (`range`). Returns the new schedule and the
178
+ * tasks whose dates changed, or the failure of the edited plan (or of the unedited plan when only that fails). Editing
179
+ * an inactive, unknown or summary task throws an Error; edit the subtasks of a summary instead, and its rolled-up dates
180
+ * follow them in `changes`. The input is not modified.
181
+ */
182
+ export declare function propagateEdit(input: ScheduleInput, edit: ScheduleEdit): PropagateEditResult;
183
+ /** The `TimelineBar` fields that `scheduledBarFields` derives from a scheduled task. */
184
+ export interface ScheduledBarFields extends TimeRange {
185
+ critical: boolean;
186
+ latestEnd: number;
187
+ /** Present only when the task works in more than one segment. */
188
+ segments?: TimeRange[];
189
+ }
190
+ /**
191
+ * Derive the GanttChart bar fields of a `scheduleTasks` result task: its dates, critical flag, latest finish for the
192
+ * float line and, for work split by breaks or pauses, its work segments. Spread the result into a `TimelineBar`.
193
+ */
194
+ export declare function scheduledBarFields(task: ScheduledTask): ScheduledBarFields;