@boxxy/model 0.1.1 → 0.1.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/README.md +8 -6
- package/dist/closeouts/build-close-out-schema.d.ts +31 -0
- package/dist/closeouts/close-out-answer-schema.d.ts +3 -0
- package/dist/closeouts/close-out-schema.d.ts +3 -0
- package/dist/closeouts/design-close-out-schema.d.ts +30 -0
- package/dist/closeouts/friction-schema.d.ts +14 -0
- package/dist/closeouts/open-item-schema.d.ts +3 -0
- package/dist/closeouts/review-close-out-schema.d.ts +40 -0
- package/dist/closeouts/triage-close-out-schema.d.ts +40 -0
- package/dist/closeouts/types.d.ts +221 -0
- package/dist/dispatch/build-applied-change.d.ts +6 -0
- package/dist/dispatch/collect-seat-sync.d.ts +14 -0
- package/dist/dispatch/pick-seat-take.d.ts +10 -0
- package/dist/dispatch/types.d.ts +11 -0
- package/dist/facts/outbox-fact-schema.d.ts +3 -0
- package/dist/facts/parse-new-fact.d.ts +2 -0
- package/dist/facts/types.d.ts +191 -0
- package/dist/facts/work-fact-schemas.d.ts +293 -0
- package/dist/index.d.ts +64 -16
- package/dist/items/build-item-views.d.ts +4 -0
- package/dist/items/collect-retries.d.ts +3 -0
- package/dist/items/collect-settled.d.ts +3 -0
- package/dist/items/derive-item-state.d.ts +17 -0
- package/dist/{live-levers.d.ts → items/live-levers.d.ts} +1 -1
- package/dist/items/types.d.ts +12 -0
- package/dist/pipeline/advance.d.ts +10 -0
- package/dist/pipeline/constants.d.ts +2 -0
- package/dist/pipeline/count-trailing.d.ts +1 -0
- package/dist/pipeline/find-position.d.ts +9 -0
- package/dist/pipeline/find-step.d.ts +3 -0
- package/dist/pipeline/merge-by-time.d.ts +9 -0
- package/dist/pipeline/position-schema.d.ts +3 -0
- package/dist/pipeline/types.d.ts +28 -0
- package/dist/planning/define-admission.d.ts +3 -0
- package/dist/planning/define-gate.d.ts +3 -0
- package/dist/planning/define-signal.d.ts +3 -0
- package/dist/planning/is-filter-match.d.ts +3 -0
- package/dist/planning/limit-fill-schema.d.ts +3 -0
- package/dist/{signal-key.d.ts → planning/signal-key.d.ts} +1 -1
- package/dist/planning/types.d.ts +155 -0
- package/dist/ports/types.d.ts +289 -0
- package/dist/reports/constants.d.ts +3 -0
- package/dist/reports/cost-to-land-schema.d.ts +29 -0
- package/dist/reports/outbox-status.d.ts +16 -0
- package/dist/reports/stage-time-schema.d.ts +25 -0
- package/dist/reports/types.d.ts +5 -0
- package/dist/rows/actor-ref-schema.d.ts +2 -0
- package/dist/rows/attempt-row-schema.d.ts +3 -0
- package/dist/rows/attempt-session-row-schema.d.ts +3 -0
- package/dist/{brand-schemas.d.ts → rows/brand-schemas.d.ts} +5 -2
- package/dist/rows/caller-identity-schema.d.ts +3 -0
- package/dist/rows/criterion-schema.d.ts +3 -0
- package/dist/rows/decision-row-schema.d.ts +34 -0
- package/dist/rows/evidence-row-schema.d.ts +3 -0
- package/dist/rows/item-row-schema.d.ts +28 -0
- package/dist/rows/item-view-schema.d.ts +3 -0
- package/dist/rows/lease-row-schema.d.ts +3 -0
- package/dist/rows/lever-row-schema.d.ts +12 -0
- package/dist/rows/limit-schema.d.ts +3 -0
- package/dist/rows/limit-seat-row-schema.d.ts +3 -0
- package/dist/rows/note-row-schema.d.ts +3 -0
- package/dist/rows/notice-row-schema.d.ts +3 -0
- package/dist/rows/pull-request-row-schema.d.ts +3 -0
- package/dist/rows/relation-row-schema.d.ts +3 -0
- package/dist/rows/row-schemas.d.ts +5 -0
- package/dist/rows/runner-row-schema.d.ts +3 -0
- package/dist/rows/spawn-request-schema.d.ts +3 -0
- package/dist/rules/define-phase.d.ts +3 -0
- package/dist/rules/load-rejection-schema.d.ts +3 -0
- package/dist/rules/types.d.ts +244 -0
- package/dist/test-utils/build-mock-cost-to-land.d.ts +2 -0
- package/dist/test-utils/build-mock-evidence-row.d.ts +2 -0
- package/dist/test-utils/build-mock-fact-id.d.ts +2 -0
- package/dist/test-utils/build-mock-frame-item.d.ts +2 -0
- package/dist/test-utils/build-mock-frame.d.ts +2 -0
- package/dist/test-utils/build-mock-item-rules.d.ts +2 -0
- package/dist/test-utils/build-mock-lease-row.d.ts +1 -1
- package/dist/test-utils/build-mock-outbox-fact.d.ts +2 -0
- package/dist/test-utils/build-mock-phase-kind.d.ts +7 -0
- package/dist/test-utils/build-mock-pipeline.d.ts +7 -0
- package/dist/test-utils/build-mock-relation-row.d.ts +2 -0
- package/dist/test-utils/build-mock-settled.d.ts +9 -0
- package/dist/test-utils/build-mock-snapshot.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-attempt-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-item-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-item-view.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-lever-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-pull-request-row.d.ts +2 -0
- package/dist/test-utils/build-mock-work-fact.d.ts +12 -0
- package/dist/test-utils/create-fake-notifier.d.ts +9 -0
- package/dist/test-utils/create-fake-pepys-reader.d.ts +13 -0
- package/dist/test-utils/fact-sink-contract.d.ts +14 -0
- package/dist/test-utils/pepys-reader-contract.d.ts +17 -0
- package/dist/{types/core.d.ts → types.d.ts} +94 -36
- package/dist/utils/format-key-path.d.ts +1 -0
- package/dist/utils/to-json-value.d.ts +2 -0
- package/package.json +14 -3
- package/src/{build-close-out-schema.ts → closeouts/build-close-out-schema.ts} +5 -10
- package/src/closeouts/close-out-answer-schema.ts +42 -0
- package/src/closeouts/close-out-schema.ts +13 -0
- package/src/closeouts/design-close-out-schema.ts +20 -0
- package/src/closeouts/friction-schema.ts +11 -0
- package/src/closeouts/open-item-schema.ts +8 -0
- package/src/closeouts/review-close-out-schema.ts +38 -0
- package/src/closeouts/triage-close-out-schema.ts +29 -0
- package/src/closeouts/types.ts +230 -0
- package/src/dispatch/build-applied-change.ts +57 -0
- package/src/dispatch/collect-seat-sync.ts +86 -0
- package/src/dispatch/pick-seat-take.ts +39 -0
- package/src/dispatch/types.ts +14 -0
- package/src/facts/outbox-fact-schema.ts +22 -0
- package/src/facts/parse-new-fact.ts +16 -0
- package/src/facts/types.ts +235 -0
- package/src/facts/work-fact-schemas.ts +201 -0
- package/src/index.ts +147 -41
- package/src/items/build-item-views.ts +146 -0
- package/src/items/collect-retries.ts +12 -0
- package/src/items/collect-settled.ts +20 -0
- package/src/items/derive-item-state.ts +95 -0
- package/src/{live-levers.ts → items/live-levers.ts} +1 -1
- package/src/items/types.ts +26 -0
- package/src/pipeline/advance.ts +78 -0
- package/src/pipeline/constants.ts +12 -0
- package/src/pipeline/count-trailing.ts +16 -0
- package/src/pipeline/find-position.ts +74 -0
- package/src/pipeline/find-step.ts +6 -0
- package/src/pipeline/merge-by-time.ts +33 -0
- package/src/pipeline/position-schema.ts +27 -0
- package/src/pipeline/types.ts +47 -0
- package/src/{define-admission.ts → planning/define-admission.ts} +2 -2
- package/src/{define-gate.ts → planning/define-gate.ts} +2 -2
- package/src/{define-signal.ts → planning/define-signal.ts} +2 -2
- package/src/planning/is-filter-match.ts +10 -0
- package/src/planning/limit-fill-schema.ts +12 -0
- package/src/{signal-key.ts → planning/signal-key.ts} +1 -1
- package/src/planning/types.ts +216 -0
- package/src/ports/types.ts +412 -0
- package/src/reports/constants.ts +6 -0
- package/src/reports/cost-to-land-schema.ts +47 -0
- package/src/reports/outbox-status.ts +22 -0
- package/src/reports/stage-time-schema.ts +21 -0
- package/src/reports/types.ts +7 -0
- package/src/rows/actor-ref-schema.ts +17 -0
- package/src/rows/attempt-row-schema.ts +69 -0
- package/src/rows/attempt-session-row-schema.ts +12 -0
- package/src/{brand-schemas.ts → rows/brand-schemas.ts} +5 -2
- package/src/rows/caller-identity-schema.ts +7 -0
- package/src/rows/criterion-schema.ts +9 -0
- package/src/rows/decision-row-schema.ts +34 -0
- package/src/rows/evidence-row-schema.ts +13 -0
- package/src/rows/item-row-schema.ts +32 -0
- package/src/rows/item-view-schema.ts +31 -0
- package/src/rows/lease-row-schema.ts +12 -0
- package/src/rows/lever-row-schema.ts +17 -0
- package/src/rows/limit-schema.ts +12 -0
- package/src/rows/limit-seat-row-schema.ts +12 -0
- package/src/rows/note-row-schema.ts +12 -0
- package/src/rows/notice-row-schema.ts +17 -0
- package/src/rows/pull-request-row-schema.ts +15 -0
- package/src/rows/relation-row-schema.ts +13 -0
- package/src/rows/row-schemas.ts +30 -0
- package/src/rows/runner-row-schema.ts +9 -0
- package/src/rows/spawn-request-schema.ts +15 -0
- package/src/rules/define-phase.ts +12 -0
- package/src/rules/load-rejection-schema.ts +51 -0
- package/src/rules/types.ts +291 -0
- package/src/test-utils/build-mock-cost-to-land.ts +31 -0
- package/src/test-utils/build-mock-evidence-row.ts +17 -0
- package/src/test-utils/build-mock-fact-id.ts +7 -0
- package/src/test-utils/build-mock-frame-item.ts +14 -0
- package/src/test-utils/build-mock-frame.ts +13 -0
- package/src/test-utils/build-mock-item-rules.ts +17 -0
- package/src/test-utils/build-mock-lease-row.ts +2 -2
- package/src/test-utils/build-mock-outbox-fact.ts +22 -0
- package/src/test-utils/build-mock-phase-kind.ts +29 -0
- package/src/test-utils/build-mock-pipeline.ts +52 -0
- package/src/test-utils/{build-mock-link-row.ts → build-mock-relation-row.ts} +4 -4
- package/src/test-utils/build-mock-settled.ts +18 -0
- package/src/test-utils/build-mock-snapshot.ts +13 -0
- package/src/test-utils/{build-mock-attempt-row.ts → build-mock-v1-attempt-row.ts} +28 -9
- package/src/test-utils/{build-mock-item-row.ts → build-mock-v1-item-row.ts} +7 -3
- package/src/test-utils/build-mock-v1-item-view.ts +29 -0
- package/src/test-utils/{build-mock-lever-row.ts → build-mock-v1-lever-row.ts} +5 -3
- package/src/test-utils/build-mock-v1-pull-request-row.ts +26 -0
- package/src/test-utils/build-mock-work-fact.ts +179 -0
- package/src/test-utils/create-fake-notifier.ts +54 -0
- package/src/test-utils/create-fake-pepys-reader.ts +73 -0
- package/src/test-utils/fact-sink-contract.ts +103 -0
- package/src/test-utils/pepys-reader-contract.ts +117 -0
- package/src/{types/core.ts → types.ts} +184 -48
- package/src/utils/format-key-path.ts +19 -0
- package/src/utils/to-json-value.ts +25 -0
- package/dist/build-close-out-schema.d.ts +0 -3
- package/dist/define-admission.d.ts +0 -3
- package/dist/define-gate.d.ts +0 -3
- package/dist/define-signal.d.ts +0 -3
- package/dist/derive-item-state.d.ts +0 -2
- package/dist/fact-schemas.d.ts +0 -5
- package/dist/friction-schema.d.ts +0 -3
- package/dist/test-utils/build-mock-attempt-row.d.ts +0 -2
- package/dist/test-utils/build-mock-item-row.d.ts +0 -2
- package/dist/test-utils/build-mock-item-rows.d.ts +0 -2
- package/dist/test-utils/build-mock-lever-row.d.ts +0 -2
- package/dist/test-utils/build-mock-link-row.d.ts +0 -2
- package/dist/test-utils/build-mock-pull-request-row.d.ts +0 -2
- package/dist/types/dispatch.d.ts +0 -82
- package/dist/types/facts.d.ts +0 -154
- package/dist/types/planning.d.ts +0 -94
- package/dist/types/ports.d.ts +0 -218
- package/dist/types/registries.d.ts +0 -150
- package/src/derive-item-state.ts +0 -76
- package/src/fact-schemas.ts +0 -138
- package/src/friction-schema.ts +0 -10
- package/src/test-utils/build-mock-item-rows.ts +0 -14
- package/src/test-utils/build-mock-pull-request-row.ts +0 -16
- package/src/types/dispatch.ts +0 -95
- package/src/types/facts.ts +0 -166
- package/src/types/planning.ts +0 -136
- package/src/types/ports.ts +0 -262
- package/src/types/registries.ts +0 -185
- /package/dist/test-utils/{seed-faker.d.ts → pin-faker-seed.d.ts} +0 -0
- /package/src/test-utils/{seed-faker.ts → pin-faker-seed.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,14 +1,57 @@
|
|
|
1
1
|
export type { ContentHash, JsonValue } from '@boxxy/content-hash';
|
|
2
|
-
export { brandSchemas } from './brand-schemas.ts';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
2
|
+
export { brandSchemas } from './rows/brand-schemas.ts';
|
|
3
|
+
export { buildAppliedChange, type ChangeAssignments } from './dispatch/build-applied-change.ts';
|
|
4
|
+
export { advance } from './pipeline/advance.ts';
|
|
5
|
+
export { attemptRowSchema } from './rows/attempt-row-schema.ts';
|
|
6
|
+
export { attemptSessionRowSchema } from './rows/attempt-session-row-schema.ts';
|
|
7
|
+
export { buildCloseOutSchema } from './closeouts/build-close-out-schema.ts';
|
|
8
|
+
export { buildItemViews } from './items/build-item-views.ts';
|
|
9
|
+
export { collectRetries } from './items/collect-retries.ts';
|
|
10
|
+
export { collectSettled } from './items/collect-settled.ts';
|
|
11
|
+
export { closeOutAnswerSchema } from './closeouts/close-out-answer-schema.ts';
|
|
12
|
+
export { callerIdentitySchema } from './rows/caller-identity-schema.ts';
|
|
13
|
+
export { closeOutSchema } from './closeouts/close-out-schema.ts';
|
|
14
|
+
export { collectSeatSync, type SeatSync } from './dispatch/collect-seat-sync.ts';
|
|
15
|
+
export { costToLandSchema } from './reports/cost-to-land-schema.ts';
|
|
16
|
+
export { criterionSchema } from './rows/criterion-schema.ts';
|
|
17
|
+
export { decisionRowSchema } from './rows/decision-row-schema.ts';
|
|
18
|
+
export { defineAdmission } from './planning/define-admission.ts';
|
|
19
|
+
export { defineGate } from './planning/define-gate.ts';
|
|
20
|
+
export { definePhase } from './rules/define-phase.ts';
|
|
21
|
+
export { defineSignal } from './planning/define-signal.ts';
|
|
22
|
+
export { buildPhase, deriveItemState } from './items/derive-item-state.ts';
|
|
23
|
+
export { designCloseOutSchema } from './closeouts/design-close-out-schema.ts';
|
|
24
|
+
export { evidenceRowSchema } from './rows/evidence-row-schema.ts';
|
|
25
|
+
export { findPosition } from './pipeline/find-position.ts';
|
|
26
|
+
export { formatKeyPath } from './utils/format-key-path.ts';
|
|
27
|
+
export { frictionSchema } from './closeouts/friction-schema.ts';
|
|
28
|
+
export { isFilterMatch } from './planning/is-filter-match.ts';
|
|
29
|
+
export { itemRowSchema } from './rows/item-row-schema.ts';
|
|
30
|
+
export { itemViewSchema } from './rows/item-view-schema.ts';
|
|
31
|
+
export { leverRowSchema } from './rows/lever-row-schema.ts';
|
|
32
|
+
export { limitFillSchema } from './planning/limit-fill-schema.ts';
|
|
33
|
+
export { limitSchema } from './rows/limit-schema.ts';
|
|
34
|
+
export { limitSeatRowSchema } from './rows/limit-seat-row-schema.ts';
|
|
35
|
+
export { loadRejectionSchema } from './rules/load-rejection-schema.ts';
|
|
36
|
+
export { liveLevers } from './items/live-levers.ts';
|
|
37
|
+
export { noteRowSchema } from './rows/note-row-schema.ts';
|
|
38
|
+
export { noticeRowSchema } from './rows/notice-row-schema.ts';
|
|
39
|
+
export { outboxFactSchema } from './facts/outbox-fact-schema.ts';
|
|
40
|
+
export { positionSchema } from './pipeline/position-schema.ts';
|
|
41
|
+
export { parseNewFact } from './facts/parse-new-fact.ts';
|
|
42
|
+
export { pickSeatTake, type SeatTakeAnswer } from './dispatch/pick-seat-take.ts';
|
|
43
|
+
export { pullRequestRowSchema } from './rows/pull-request-row-schema.ts';
|
|
44
|
+
export { relationRowSchema } from './rows/relation-row-schema.ts';
|
|
45
|
+
export { reviewCloseOutSchema } from './closeouts/review-close-out-schema.ts';
|
|
46
|
+
export { rowSchemas } from './rows/row-schemas.ts';
|
|
47
|
+
export { signalKey } from './planning/signal-key.ts';
|
|
48
|
+
export { spawnRequestSchema } from './rows/spawn-request-schema.ts';
|
|
49
|
+
export { stageTimeSchema } from './reports/stage-time-schema.ts';
|
|
50
|
+
export { toJSONValue } from './utils/to-json-value.ts';
|
|
51
|
+
export { triageCloseOutSchema } from './closeouts/triage-close-out-schema.ts';
|
|
52
|
+
export { workFactSchemas } from './facts/work-fact-schemas.ts';
|
|
53
|
+
export { costBases, phaseSteps, stageSteps } from './reports/constants.ts';
|
|
54
|
+
export { engineHoldReasons, engineOutcomes } from './pipeline/constants.ts';
|
|
12
55
|
|
|
13
56
|
export type {
|
|
14
57
|
Actor,
|
|
@@ -19,6 +62,8 @@ export type {
|
|
|
19
62
|
AttemptRow,
|
|
20
63
|
AttemptSessionRow,
|
|
21
64
|
AttemptState,
|
|
65
|
+
CallerIdentity,
|
|
66
|
+
ClosingCause,
|
|
22
67
|
CommitSha,
|
|
23
68
|
ConceptPin,
|
|
24
69
|
Criterion,
|
|
@@ -26,81 +71,109 @@ export type {
|
|
|
26
71
|
DecisionId,
|
|
27
72
|
DecisionRow,
|
|
28
73
|
DerivedState,
|
|
74
|
+
DesignMode,
|
|
29
75
|
Effort,
|
|
76
|
+
EngineOutcome,
|
|
30
77
|
EvidenceKind,
|
|
31
78
|
EvidenceRow,
|
|
32
79
|
EvidenceSource,
|
|
33
80
|
FactId,
|
|
34
81
|
FaultRecord,
|
|
82
|
+
FieldValues,
|
|
35
83
|
ForcedFailure,
|
|
36
84
|
Instant,
|
|
85
|
+
ItemFields,
|
|
37
86
|
ItemId,
|
|
38
87
|
ItemKindName,
|
|
39
88
|
ItemRow,
|
|
40
|
-
ItemRows,
|
|
41
89
|
ItemState,
|
|
42
90
|
ItemView,
|
|
43
|
-
|
|
91
|
+
KeptSession,
|
|
44
92
|
KnownFailure,
|
|
45
93
|
LeaseRow,
|
|
46
94
|
LeverKind,
|
|
47
95
|
LeverRow,
|
|
48
|
-
|
|
49
|
-
|
|
96
|
+
LimitCount,
|
|
97
|
+
LimitName,
|
|
98
|
+
LimitSeatRow,
|
|
50
99
|
LiveAttemptState,
|
|
51
|
-
LoadedRecipe,
|
|
52
|
-
MaxAttemptsByKind,
|
|
53
100
|
Minutes,
|
|
101
|
+
NoteRow,
|
|
102
|
+
NoticeRow,
|
|
54
103
|
ObservationBoundary,
|
|
104
|
+
OutcomeName,
|
|
55
105
|
PhaseName,
|
|
56
106
|
PipelineName,
|
|
57
107
|
PoolName,
|
|
58
|
-
|
|
108
|
+
Product,
|
|
59
109
|
PullRequestRef,
|
|
60
110
|
PullRequestRow,
|
|
61
111
|
Recipe,
|
|
62
112
|
RecipeHash,
|
|
63
113
|
RecipeMaterial,
|
|
64
114
|
RecipeName,
|
|
115
|
+
RelationRow,
|
|
116
|
+
RelationTypeName,
|
|
65
117
|
RepoName,
|
|
66
118
|
ResolvedRecipe,
|
|
67
119
|
RulesVersion,
|
|
68
120
|
RunnerId,
|
|
69
121
|
RunnerRow,
|
|
122
|
+
SessionMode,
|
|
70
123
|
SnapshotHash,
|
|
71
124
|
SourceName,
|
|
72
125
|
StreamName,
|
|
73
126
|
WaitingReason,
|
|
74
127
|
WorkerKindName,
|
|
75
|
-
} from './types
|
|
128
|
+
} from './types.ts';
|
|
76
129
|
|
|
77
130
|
export type {
|
|
78
|
-
|
|
131
|
+
HoldReason,
|
|
132
|
+
Position,
|
|
133
|
+
RetryLever,
|
|
134
|
+
RulesHoldReason,
|
|
135
|
+
Settled,
|
|
136
|
+
} from './pipeline/types.ts';
|
|
137
|
+
|
|
138
|
+
export type {
|
|
139
|
+
AcceptanceInput,
|
|
140
|
+
BuildCloseOut,
|
|
141
|
+
BuildInput,
|
|
142
|
+
CloseOut,
|
|
143
|
+
CloseOutAnswer,
|
|
79
144
|
CloseOutContext,
|
|
80
145
|
CloseOutParse,
|
|
81
146
|
CloseOutParser,
|
|
82
147
|
CloseOutProblem,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
148
|
+
CloseOutWorld,
|
|
149
|
+
CriterionText,
|
|
150
|
+
DesignCloseOut,
|
|
151
|
+
DesignRef,
|
|
152
|
+
Effect,
|
|
153
|
+
Finding,
|
|
154
|
+
Friction,
|
|
155
|
+
FrictionTargetKind,
|
|
156
|
+
NoslopSummary,
|
|
157
|
+
OpenItem,
|
|
158
|
+
PullRequestLink,
|
|
159
|
+
RelationDraft,
|
|
160
|
+
ReviewCloseOut,
|
|
161
|
+
ReviewInput,
|
|
162
|
+
TriageCloseOut,
|
|
163
|
+
} from './closeouts/types.ts';
|
|
164
|
+
|
|
165
|
+
export type { Claim } from './dispatch/types.ts';
|
|
90
166
|
|
|
91
167
|
export type {
|
|
92
|
-
|
|
168
|
+
AnyNewFact,
|
|
93
169
|
EntityRef,
|
|
94
170
|
FactEnvelope,
|
|
95
171
|
FactType,
|
|
96
|
-
Friction,
|
|
97
|
-
FrictionTargetKind,
|
|
98
|
-
LinkPayload,
|
|
99
172
|
NewFact,
|
|
100
|
-
OpenItem,
|
|
101
173
|
OutboxFact,
|
|
102
|
-
|
|
103
|
-
|
|
174
|
+
RelationPayload,
|
|
175
|
+
WorkFacts,
|
|
176
|
+
} from './facts/types.ts';
|
|
104
177
|
|
|
105
178
|
export type {
|
|
106
179
|
Admission,
|
|
@@ -108,6 +181,7 @@ export type {
|
|
|
108
181
|
AdmissionName,
|
|
109
182
|
Decision,
|
|
110
183
|
Fault,
|
|
184
|
+
Filter,
|
|
111
185
|
Frame,
|
|
112
186
|
FrameItem,
|
|
113
187
|
FrameValues,
|
|
@@ -115,52 +189,78 @@ export type {
|
|
|
115
189
|
GateName,
|
|
116
190
|
Hold,
|
|
117
191
|
Lift,
|
|
192
|
+
Limit,
|
|
193
|
+
LimitFill,
|
|
118
194
|
Pick,
|
|
119
195
|
PlanContext,
|
|
120
196
|
Pool,
|
|
121
197
|
PropagationLine,
|
|
198
|
+
SeatRef,
|
|
199
|
+
SeatRelease,
|
|
200
|
+
SeatTake,
|
|
122
201
|
Signal,
|
|
123
202
|
SignalKey,
|
|
124
203
|
SignalName,
|
|
125
204
|
Snapshot,
|
|
205
|
+
StartPick,
|
|
126
206
|
View,
|
|
127
207
|
ViewName,
|
|
208
|
+
Wait,
|
|
209
|
+
WaitReason,
|
|
128
210
|
Waiver,
|
|
129
211
|
WaiverName,
|
|
130
|
-
|
|
212
|
+
Wake,
|
|
213
|
+
WakePick,
|
|
214
|
+
} from './planning/types.ts';
|
|
131
215
|
|
|
132
216
|
export type {
|
|
133
|
-
AnyNewFact,
|
|
134
217
|
ApplyResult,
|
|
218
|
+
Attention,
|
|
219
|
+
CallerProof,
|
|
220
|
+
CapacityBackoff,
|
|
135
221
|
ClaimStore,
|
|
136
222
|
Clock,
|
|
137
|
-
CostReader,
|
|
138
|
-
CostToLandInput,
|
|
139
|
-
CostToLandRow,
|
|
140
223
|
FactSink,
|
|
224
|
+
ForgetOutcome,
|
|
141
225
|
Forge,
|
|
226
|
+
HoldNotice,
|
|
142
227
|
ItemDetailRows,
|
|
143
228
|
ItemFilter,
|
|
144
229
|
NewId,
|
|
230
|
+
NoticeOutcome,
|
|
231
|
+
Notifier,
|
|
232
|
+
OutboxReader,
|
|
233
|
+
PepysAnswer,
|
|
234
|
+
PepysReader,
|
|
235
|
+
SinkAnswer,
|
|
145
236
|
PullRequestReading,
|
|
146
237
|
RowWrite,
|
|
147
238
|
SessionFault,
|
|
148
239
|
SessionReading,
|
|
149
240
|
SpawnRequest,
|
|
150
241
|
StartOutcome,
|
|
242
|
+
StopOutcome,
|
|
151
243
|
StoreChange,
|
|
152
244
|
StoreReader,
|
|
153
245
|
StoreTx,
|
|
246
|
+
SuspendOutcome,
|
|
154
247
|
TableName,
|
|
155
248
|
Tables,
|
|
249
|
+
WakeSource,
|
|
156
250
|
WorkerKind,
|
|
157
|
-
} from './types
|
|
251
|
+
} from './ports/types.ts';
|
|
252
|
+
|
|
253
|
+
export type { CostToLand, StageTime } from './reports/types.ts';
|
|
254
|
+
export type { OutboxStatus } from './reports/outbox-status.ts';
|
|
255
|
+
export type { ItemSetRows, ItemWithLevers } from './items/types.ts';
|
|
158
256
|
|
|
159
257
|
export type {
|
|
160
258
|
Concept,
|
|
161
259
|
ConceptEntry,
|
|
162
260
|
ConceptName,
|
|
261
|
+
Edge,
|
|
163
262
|
FilterField,
|
|
263
|
+
ItemRules,
|
|
164
264
|
KindRules,
|
|
165
265
|
LoadedRules,
|
|
166
266
|
LoadRejection,
|
|
@@ -168,6 +268,8 @@ export type {
|
|
|
168
268
|
LoadResult,
|
|
169
269
|
ParamKindName,
|
|
170
270
|
ParamKinds,
|
|
271
|
+
PhaseInputContext,
|
|
272
|
+
PhaseKind,
|
|
171
273
|
Pipeline,
|
|
172
274
|
PipelineStep,
|
|
173
275
|
PlainKinds,
|
|
@@ -175,8 +277,12 @@ export type {
|
|
|
175
277
|
PluginRef,
|
|
176
278
|
Registered,
|
|
177
279
|
Registry,
|
|
280
|
+
RelationType,
|
|
178
281
|
Resolved,
|
|
179
|
-
RulesFile,
|
|
180
282
|
Schema,
|
|
283
|
+
SettleInput,
|
|
284
|
+
Settlement,
|
|
181
285
|
SignalRef,
|
|
182
|
-
|
|
286
|
+
SkillsPin,
|
|
287
|
+
SleepRules,
|
|
288
|
+
} from './rules/types.ts';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { findPosition } from '../pipeline/find-position.ts';
|
|
2
|
+
import type { Position } from '../pipeline/types.ts';
|
|
3
|
+
import type { ItemRules } from '../rules/types.ts';
|
|
4
|
+
import type {
|
|
5
|
+
AttemptId,
|
|
6
|
+
AttemptRow,
|
|
7
|
+
DerivedState,
|
|
8
|
+
Instant,
|
|
9
|
+
ItemId,
|
|
10
|
+
ItemRow,
|
|
11
|
+
ItemState,
|
|
12
|
+
LeaseRow,
|
|
13
|
+
LeverRow,
|
|
14
|
+
PullRequestRow,
|
|
15
|
+
RelationRow,
|
|
16
|
+
} from '../types.ts';
|
|
17
|
+
import { collectRetries } from './collect-retries.ts';
|
|
18
|
+
import { collectSettled } from './collect-settled.ts';
|
|
19
|
+
import { deriveItemState } from './derive-item-state.ts';
|
|
20
|
+
import { liveLevers } from './live-levers.ts';
|
|
21
|
+
import type { ItemSetRows, ItemWithLevers } from './types.ts';
|
|
22
|
+
|
|
23
|
+
export function buildItemViews(
|
|
24
|
+
rows: ItemSetRows,
|
|
25
|
+
now: Instant,
|
|
26
|
+
rules: ItemRules,
|
|
27
|
+
): ItemWithLevers[] {
|
|
28
|
+
const groups = collectItemGroups(rows, rules);
|
|
29
|
+
|
|
30
|
+
// A blocking source counts only when it is done or archived, and no relation makes an item either,
|
|
31
|
+
// so each source's state derived without its relations settles its targets.
|
|
32
|
+
const ownStates = new Map<ItemId, ItemState>(
|
|
33
|
+
groups.map((group) => [
|
|
34
|
+
group.item.id,
|
|
35
|
+
deriveGroupState(group, rules, { relations: [], blockerStates: new Map() }).state,
|
|
36
|
+
]),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return groups.map((group) =>
|
|
40
|
+
buildItemWithLevers(
|
|
41
|
+
group,
|
|
42
|
+
deriveGroupState(group, rules, { relations: group.relations, blockerStates: ownStates }),
|
|
43
|
+
now,
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ItemGroup {
|
|
49
|
+
readonly item: ItemRow;
|
|
50
|
+
readonly relations: RelationRow[];
|
|
51
|
+
readonly attempts: AttemptRow[];
|
|
52
|
+
readonly pullRequests: PullRequestRow[];
|
|
53
|
+
readonly levers: LeverRow[];
|
|
54
|
+
liveLease: LeaseRow | null;
|
|
55
|
+
position: Position;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// in the order of `rows.items`
|
|
59
|
+
function collectItemGroups(rows: ItemSetRows, rules: ItemRules): ItemGroup[] {
|
|
60
|
+
const groups = new Map<ItemId, ItemGroup>(
|
|
61
|
+
rows.items.map((item) => [
|
|
62
|
+
item.id,
|
|
63
|
+
{
|
|
64
|
+
item,
|
|
65
|
+
relations: [],
|
|
66
|
+
attempts: [],
|
|
67
|
+
pullRequests: [],
|
|
68
|
+
levers: [],
|
|
69
|
+
liveLease: null,
|
|
70
|
+
position: { kind: 'end', reason: 'no-pipeline' },
|
|
71
|
+
},
|
|
72
|
+
]),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const attemptItems = new Map<AttemptId, ItemId>();
|
|
76
|
+
|
|
77
|
+
for (const relation of rows.relations) {
|
|
78
|
+
groups.get(relation.target)?.relations.push(relation);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (const attempt of rows.attempts) {
|
|
82
|
+
attemptItems.set(attempt.id, attempt.item);
|
|
83
|
+
groups.get(attempt.item)?.attempts.push(attempt);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (const pullRequest of rows.pullRequests) {
|
|
87
|
+
const item = attemptItems.get(pullRequest.attempt);
|
|
88
|
+
|
|
89
|
+
if (item !== undefined) {
|
|
90
|
+
groups.get(item)?.pullRequests.push(pullRequest);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const lever of rows.levers) {
|
|
95
|
+
groups.get(lever.item)?.levers.push(lever);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const lease of rows.liveLeases) {
|
|
99
|
+
const group = groups.get(lease.item);
|
|
100
|
+
|
|
101
|
+
if (group !== undefined) {
|
|
102
|
+
group.liveLease = lease;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
for (const group of groups.values()) {
|
|
107
|
+
group.position = findPosition({
|
|
108
|
+
pipeline: rules.kinds.get(group.item.kind)?.pipeline ?? null,
|
|
109
|
+
attempts: collectSettled(group.attempts),
|
|
110
|
+
retries: collectRetries(group.levers),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return [...groups.values()];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Blocking {
|
|
118
|
+
// the live relations whose target is the item
|
|
119
|
+
readonly relations: readonly RelationRow[];
|
|
120
|
+
readonly blockerStates: ReadonlyMap<ItemId, ItemState>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function deriveGroupState(group: ItemGroup, rules: ItemRules, blocking: Blocking): DerivedState {
|
|
124
|
+
return deriveItemState({
|
|
125
|
+
...blocking,
|
|
126
|
+
item: group.item,
|
|
127
|
+
position: group.position,
|
|
128
|
+
liveLease: group.liveLease,
|
|
129
|
+
phases: rules.phases,
|
|
130
|
+
attempts: group.attempts,
|
|
131
|
+
pullRequests: group.pullRequests,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildItemWithLevers(
|
|
136
|
+
group: ItemGroup,
|
|
137
|
+
derived: DerivedState,
|
|
138
|
+
now: Instant,
|
|
139
|
+
): ItemWithLevers {
|
|
140
|
+
return {
|
|
141
|
+
...group.item,
|
|
142
|
+
derived,
|
|
143
|
+
position: group.position,
|
|
144
|
+
levers: liveLevers(group.levers, now),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RetryLever } from '../pipeline/types.ts';
|
|
2
|
+
import type { LeverRow } from '../types.ts';
|
|
3
|
+
|
|
4
|
+
const retryKind = 'item.retry';
|
|
5
|
+
|
|
6
|
+
// every `item.retry` lever the item ever had, so the position never depends on the read's time
|
|
7
|
+
export function collectRetries(levers: readonly LeverRow[]): RetryLever[] {
|
|
8
|
+
return levers
|
|
9
|
+
.filter((lever) => lever.kind === retryKind)
|
|
10
|
+
.map((lever) => ({ at: lever.at, phase: lever.phase }))
|
|
11
|
+
.toSorted((first, second) => first.at - second.at);
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Settled } from '../pipeline/types.ts';
|
|
2
|
+
import type { AttemptRow } from '../types.ts';
|
|
3
|
+
|
|
4
|
+
// the settled attempts, oldest end first
|
|
5
|
+
export function collectSettled(attempts: readonly AttemptRow[]): Settled[] {
|
|
6
|
+
const settled = attempts.flatMap((attempt) =>
|
|
7
|
+
attempt.endedAt === null || attempt.outcome === null
|
|
8
|
+
? []
|
|
9
|
+
: [
|
|
10
|
+
{
|
|
11
|
+
phase: attempt.phase,
|
|
12
|
+
outcome: attempt.outcome,
|
|
13
|
+
endedAt: attempt.endedAt,
|
|
14
|
+
failure: attempt.failure,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return settled.toSorted((first, second) => first.endedAt - second.endedAt);
|
|
20
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Position } from '../pipeline/types.ts';
|
|
2
|
+
import type {
|
|
3
|
+
AttemptRow,
|
|
4
|
+
DerivedState,
|
|
5
|
+
ItemId,
|
|
6
|
+
ItemRow,
|
|
7
|
+
ItemState,
|
|
8
|
+
LeaseRow,
|
|
9
|
+
PhaseName,
|
|
10
|
+
PullRequestRow,
|
|
11
|
+
RelationRow,
|
|
12
|
+
} from '../types.ts';
|
|
13
|
+
|
|
14
|
+
interface DeriveItemStateInput {
|
|
15
|
+
readonly item: ItemRow;
|
|
16
|
+
readonly position: Position;
|
|
17
|
+
|
|
18
|
+
// the item's live item-phase lease, a sleeping or closing attempt's included
|
|
19
|
+
readonly liveLease: LeaseRow | null;
|
|
20
|
+
|
|
21
|
+
// the phase kinds loaded now, by name
|
|
22
|
+
readonly phases: ReadonlyMap<PhaseName, { readonly needsAcceptance: boolean }>;
|
|
23
|
+
readonly attempts: readonly AttemptRow[];
|
|
24
|
+
readonly pullRequests: readonly PullRequestRow[];
|
|
25
|
+
|
|
26
|
+
// the live relations whose target is the item
|
|
27
|
+
readonly relations: readonly RelationRow[];
|
|
28
|
+
readonly blockerStates: ReadonlyMap<ItemId, ItemState>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The table of section G of the engine sketch; the first match wins.
|
|
32
|
+
export function deriveItemState(input: DeriveItemStateInput): DerivedState {
|
|
33
|
+
const item = input.item;
|
|
34
|
+
const position = input.position;
|
|
35
|
+
|
|
36
|
+
if (item.closedAt !== null) {
|
|
37
|
+
return { state: 'archived' };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (input.liveLease !== null) {
|
|
41
|
+
return { state: 'running' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (position.kind === 'hold') {
|
|
45
|
+
return { state: 'waiting', reason: position.reason };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (position.kind === 'end') {
|
|
49
|
+
return deriveEndedState(collectBuildPullRequests(input.attempts, input.pullRequests));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (item.acceptance.length === 0 && input.phases.get(position.phase)?.needsAcceptance === true) {
|
|
53
|
+
return { state: 'idea' };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return hasOpenBlocker(input) ? { state: 'blocked' } : { state: 'ready' };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function deriveEndedState(linked: readonly PullRequestRow[]): DerivedState {
|
|
60
|
+
if (linked.some((pullRequest) => pullRequest.state === 'merged')) {
|
|
61
|
+
return { state: 'done' };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (linked.some((pullRequest) => pullRequest.state === 'open')) {
|
|
65
|
+
return { state: 'waiting', reason: 'pull request open' };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return linked.length === 0
|
|
69
|
+
? { state: 'waiting', reason: 'no pull request linked' }
|
|
70
|
+
: { state: 'waiting', reason: 'pull request closed unmerged' };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const buildPhase = 'build';
|
|
74
|
+
|
|
75
|
+
// the pull requests linked to a succeeded build attempt
|
|
76
|
+
function collectBuildPullRequests(
|
|
77
|
+
attempts: readonly AttemptRow[],
|
|
78
|
+
pullRequests: readonly PullRequestRow[],
|
|
79
|
+
): PullRequestRow[] {
|
|
80
|
+
const succeededBuilds = new Set(
|
|
81
|
+
attempts
|
|
82
|
+
.filter((attempt) => attempt.phase === buildPhase && attempt.state === 'succeeded')
|
|
83
|
+
.map((attempt) => attempt.id),
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return pullRequests.filter((pullRequest) => succeededBuilds.has(pullRequest.attempt));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function hasOpenBlocker(input: DeriveItemStateInput): boolean {
|
|
90
|
+
return input.relations.some((relation) => {
|
|
91
|
+
const blockerState = input.blockerStates.get(relation.source);
|
|
92
|
+
|
|
93
|
+
return relation.type === 'blocks' && blockerState !== 'done' && blockerState !== 'archived';
|
|
94
|
+
});
|
|
95
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Instant, LeverKind, LeverRow } from '
|
|
1
|
+
import type { Instant, LeverKind, LeverRow } from '../types.ts';
|
|
2
2
|
|
|
3
3
|
export function liveLevers(levers: readonly LeverRow[], now: Instant): LeverRow[] {
|
|
4
4
|
return levers.filter((lever) => !isExpired(lever, now) && !isUndone(lever, levers));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AttemptRow,
|
|
3
|
+
ItemRow,
|
|
4
|
+
ItemView,
|
|
5
|
+
LeaseRow,
|
|
6
|
+
LeverRow,
|
|
7
|
+
PullRequestRow,
|
|
8
|
+
RelationRow,
|
|
9
|
+
} from '../types.ts';
|
|
10
|
+
|
|
11
|
+
// the rows a store reads to derive a set of items, with each blocking source item
|
|
12
|
+
export interface ItemSetRows {
|
|
13
|
+
readonly items: readonly ItemRow[];
|
|
14
|
+
|
|
15
|
+
// live relations only
|
|
16
|
+
readonly relations: readonly RelationRow[];
|
|
17
|
+
readonly levers: readonly LeverRow[];
|
|
18
|
+
readonly attempts: readonly AttemptRow[];
|
|
19
|
+
readonly liveLeases: readonly LeaseRow[];
|
|
20
|
+
readonly pullRequests: readonly PullRequestRow[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ItemWithLevers extends ItemView {
|
|
24
|
+
// the live levers only
|
|
25
|
+
readonly levers: readonly LeverRow[];
|
|
26
|
+
}
|