@boboddy/sdk 0.2.15-alpha → 0.4.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/client.js CHANGED
@@ -867,6 +867,18 @@ class Api extends HeyApiClient {
867
867
  }
868
868
 
869
869
  class Projects extends HeyApiClient {
870
+ resolveProjectBySlug(options) {
871
+ return (options.client ?? this.client).get({ url: "/api/projects/resolve", ...options });
872
+ }
873
+ listProjectWorkItems(options) {
874
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-items", ...options });
875
+ }
876
+ listProjectWorkItemFieldOptions(options) {
877
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-field-options", ...options });
878
+ }
879
+ getProject(options) {
880
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
881
+ }
870
882
  listProjects(options) {
871
883
  return (options?.client ?? this.client).get({ url: "/api/projects", ...options });
872
884
  }
@@ -880,18 +892,6 @@ class Projects extends HeyApiClient {
880
892
  }
881
893
  });
882
894
  }
883
- resolveProjectBySlug(options) {
884
- return (options.client ?? this.client).get({ url: "/api/projects/resolve", ...options });
885
- }
886
- listProjectWorkItems(options) {
887
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-items", ...options });
888
- }
889
- listProjectWorkItemFieldOptions(options) {
890
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-field-options", ...options });
891
- }
892
- getProject(options) {
893
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
894
- }
895
895
  updateProjectDefaultPipelineAssignment(options) {
896
896
  return (options.client ?? this.client).put({
897
897
  url: "/api/projects/{projectId}/default-pipeline-assignment",
@@ -950,32 +950,6 @@ class StepDefinitions extends HeyApiClient {
950
950
  }
951
951
 
952
952
  class StepExecutions extends HeyApiClient {
953
- createArtifactUploadUrl(options) {
954
- return (options.client ?? this.client).post({
955
- url: "/api/step-executions/{stepExecutionId}/artifact-upload-url",
956
- ...options,
957
- headers: {
958
- "Content-Type": "application/json",
959
- ...options.headers
960
- }
961
- });
962
- }
963
- listStepExecutionArtifacts(options) {
964
- return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts", ...options });
965
- }
966
- recordStepExecutionArtifact(options) {
967
- return (options.client ?? this.client).post({
968
- url: "/api/step-executions/{stepExecutionId}/artifacts",
969
- ...options,
970
- headers: {
971
- "Content-Type": "application/json",
972
- ...options.headers
973
- }
974
- });
975
- }
976
- getArtifactDownloadUrl(options) {
977
- return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts/{artifactId}/download-url", ...options });
978
- }
979
953
  claimStepExecutions(options) {
980
954
  return (options.client ?? this.client).post({
981
955
  url: "/api/step-executions/claims",
@@ -1045,9 +1019,6 @@ class StepExecutions extends HeyApiClient {
1045
1019
  extractStepExecutionSignals(options) {
1046
1020
  return (options.client ?? this.client).post({ url: "/api/step-execution-results/{stepExecutionResultId}/signals/extract", ...options });
1047
1021
  }
1048
- getStepExecution(options) {
1049
- return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1050
- }
1051
1022
  readStepExecutionLogs(options) {
1052
1023
  return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
1053
1024
  }
@@ -1061,15 +1032,44 @@ class StepExecutions extends HeyApiClient {
1061
1032
  }
1062
1033
  });
1063
1034
  }
1035
+ getStepExecution(options) {
1036
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1037
+ }
1064
1038
  getStepExecutionLogArchive(options) {
1065
1039
  return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
1066
1040
  }
1041
+ createArtifactUploadUrl(options) {
1042
+ return (options.client ?? this.client).post({
1043
+ url: "/api/step-executions/{stepExecutionId}/artifact-upload-url",
1044
+ ...options,
1045
+ headers: {
1046
+ "Content-Type": "application/json",
1047
+ ...options.headers
1048
+ }
1049
+ });
1050
+ }
1051
+ listStepExecutionArtifacts(options) {
1052
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts", ...options });
1053
+ }
1054
+ recordStepExecutionArtifact(options) {
1055
+ return (options.client ?? this.client).post({
1056
+ url: "/api/step-executions/{stepExecutionId}/artifacts",
1057
+ ...options,
1058
+ headers: {
1059
+ "Content-Type": "application/json",
1060
+ ...options.headers
1061
+ }
1062
+ });
1063
+ }
1064
+ getArtifactDownloadUrl(options) {
1065
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts/{artifactId}/download-url", ...options });
1066
+ }
1067
1067
  }
1068
1068
 
1069
1069
  class PipelineDefinitions extends HeyApiClient {
1070
1070
  createPipelineDefinition(options) {
1071
1071
  return (options.client ?? this.client).post({
1072
- url: "/api/linear-pipeline-definitions",
1072
+ url: "/api/pipeline-definitions",
1073
1073
  ...options,
1074
1074
  headers: {
1075
1075
  "Content-Type": "application/json",
@@ -1079,7 +1079,7 @@ class PipelineDefinitions extends HeyApiClient {
1079
1079
  }
1080
1080
  upsertPipelineDefinition(options) {
1081
1081
  return (options.client ?? this.client).put({
1082
- url: "/api/linear-pipeline-definitions",
1082
+ url: "/api/pipeline-definitions",
1083
1083
  ...options,
1084
1084
  headers: {
1085
1085
  "Content-Type": "application/json",
@@ -1087,21 +1087,15 @@ class PipelineDefinitions extends HeyApiClient {
1087
1087
  }
1088
1088
  });
1089
1089
  }
1090
- getPipelineDefinition(options) {
1091
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}", ...options });
1092
- }
1093
- listPipelineDefinitions(options) {
1094
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/linear-pipeline-definitions", ...options });
1095
- }
1096
1090
  archivePipelineDefinition(options) {
1097
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/archive", ...options });
1091
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/archive", ...options });
1098
1092
  }
1099
1093
  unarchivePipelineDefinition(options) {
1100
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/unarchive", ...options });
1094
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/unarchive", ...options });
1101
1095
  }
1102
1096
  addPipelineStep(options) {
1103
1097
  return (options.client ?? this.client).post({
1104
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps",
1098
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps",
1105
1099
  ...options,
1106
1100
  headers: {
1107
1101
  "Content-Type": "application/json",
@@ -1110,11 +1104,11 @@ class PipelineDefinitions extends HeyApiClient {
1110
1104
  });
1111
1105
  }
1112
1106
  removePipelineStep(options) {
1113
- return (options.client ?? this.client).delete({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1107
+ return (options.client ?? this.client).delete({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}", ...options });
1114
1108
  }
1115
1109
  updatePipelineStep(options) {
1116
1110
  return (options.client ?? this.client).put({
1117
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}",
1111
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}",
1118
1112
  ...options,
1119
1113
  headers: {
1120
1114
  "Content-Type": "application/json",
@@ -1124,7 +1118,7 @@ class PipelineDefinitions extends HeyApiClient {
1124
1118
  }
1125
1119
  setPipelineStepAdvancementPolicy(options) {
1126
1120
  return (options.client ?? this.client).put({
1127
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}/advancement-policy",
1121
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/steps/{pipelineStepDefinitionId}/advancement-policy",
1128
1122
  ...options,
1129
1123
  headers: {
1130
1124
  "Content-Type": "application/json",
@@ -1132,15 +1126,21 @@ class PipelineDefinitions extends HeyApiClient {
1132
1126
  }
1133
1127
  });
1134
1128
  }
1129
+ getPipelineDefinition(options) {
1130
+ return (options.client ?? this.client).get({ url: "/api/pipeline-definitions/{pipelineDefinitionId}", ...options });
1131
+ }
1132
+ listPipelineDefinitions(options) {
1133
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/pipeline-definitions", ...options });
1134
+ }
1135
1135
  }
1136
1136
 
1137
1137
  class PipelineExecutions extends HeyApiClient {
1138
1138
  listPipelineExecutions(options) {
1139
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions", ...options });
1139
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions", ...options });
1140
1140
  }
1141
1141
  createPipelineExecution(options) {
1142
1142
  return (options.client ?? this.client).post({
1143
- url: "/api/linear-pipeline-executions",
1143
+ url: "/api/pipeline-executions",
1144
1144
  ...options,
1145
1145
  headers: {
1146
1146
  "Content-Type": "application/json",
@@ -1149,17 +1149,17 @@ class PipelineExecutions extends HeyApiClient {
1149
1149
  });
1150
1150
  }
1151
1151
  startPipelineExecution(options) {
1152
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/start", ...options });
1152
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/start", ...options });
1153
1153
  }
1154
1154
  queueFirstPipelineStepRun(options) {
1155
- return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/first", ...options });
1155
+ return (options.client ?? this.client).post({ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/first", ...options });
1156
1156
  }
1157
1157
  markPipelineStepRunRunning(options) {
1158
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/running", ...options });
1158
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/running", ...options });
1159
1159
  }
1160
1160
  applyPipelineStepResult(options) {
1161
1161
  return (options.client ?? this.client).post({
1162
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/results",
1162
+ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/results",
1163
1163
  ...options,
1164
1164
  headers: {
1165
1165
  "Content-Type": "application/json",
@@ -1169,7 +1169,17 @@ class PipelineExecutions extends HeyApiClient {
1169
1169
  }
1170
1170
  acceptPipelineStepRun(options) {
1171
1171
  return (options.client ?? this.client).post({
1172
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/accept",
1172
+ url: "/api/pipeline-executions/{pipelineExecutionId}/step-runs/{pipelineStepRunId}/accept",
1173
+ ...options,
1174
+ headers: {
1175
+ "Content-Type": "application/json",
1176
+ ...options.headers
1177
+ }
1178
+ });
1179
+ }
1180
+ acceptPipelineCohort(options) {
1181
+ return (options.client ?? this.client).post({
1182
+ url: "/api/pipeline-executions/{pipelineExecutionId}/cohorts/{originNodeDefinitionId}/accept",
1173
1183
  ...options,
1174
1184
  headers: {
1175
1185
  "Content-Type": "application/json",
@@ -1179,7 +1189,7 @@ class PipelineExecutions extends HeyApiClient {
1179
1189
  }
1180
1190
  rerunPipelineExecution(options) {
1181
1191
  return (options.client ?? this.client).post({
1182
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/rerun",
1192
+ url: "/api/pipeline-executions/{pipelineExecutionId}/rerun",
1183
1193
  ...options,
1184
1194
  headers: {
1185
1195
  "Content-Type": "application/json",
@@ -1188,23 +1198,32 @@ class PipelineExecutions extends HeyApiClient {
1188
1198
  });
1189
1199
  }
1190
1200
  cancelPipelineExecution(options) {
1191
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/cancel", ...options });
1201
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/cancel", ...options });
1192
1202
  }
1193
1203
  getPipelineExecution(options) {
1194
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}", ...options });
1204
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}", ...options });
1205
+ }
1206
+ getPipelineExecutionRoutedChain(options) {
1207
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}/routed-chain", ...options });
1195
1208
  }
1196
1209
  countPipelineExecutionsByPipeline(options) {
1197
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/counts/by-pipeline", ...options });
1210
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/counts/by-pipeline", ...options });
1198
1211
  }
1199
1212
  listPipelineDefinitionStepRollups(options) {
1200
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/step-rollups/by-definition/{linearPipelineDefinitionId}", ...options });
1213
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/step-rollups/by-definition/{pipelineDefinitionId}", ...options });
1201
1214
  }
1202
1215
  listPipelineDefinitionStepRuns(options) {
1203
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/step-runs/by-definition/{linearPipelineDefinitionId}", ...options });
1216
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/step-runs/by-definition/{pipelineDefinitionId}", ...options });
1204
1217
  }
1205
1218
  }
1206
1219
 
1207
1220
  class WorkItems extends HeyApiClient {
1221
+ deleteWorkItem(options) {
1222
+ return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1223
+ }
1224
+ getWorkItem(options) {
1225
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1226
+ }
1208
1227
  createWorkItem(options) {
1209
1228
  return (options.client ?? this.client).post({
1210
1229
  url: "/api/work-items",
@@ -1255,12 +1274,6 @@ class WorkItems extends HeyApiClient {
1255
1274
  }
1256
1275
  });
1257
1276
  }
1258
- deleteWorkItem(options) {
1259
- return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1260
- }
1261
- getWorkItem(options) {
1262
- return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1263
- }
1264
1277
  }
1265
1278
 
1266
1279
  class WorkItemComments extends HeyApiClient {
@@ -0,0 +1,117 @@
1
+ /** Restricted outcome domain for both `advanceEach` and `advanceAll`. */
2
+ export declare const cohortAdvancementEventTypeValues: readonly ["continue", "block"];
3
+ export type CohortAdvancementEventType = (typeof cohortAdvancementEventTypeValues)[number];
4
+ export type StepSignalsListConditionOperator = "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive" | "in" | "notIn" | "contains" | "doesNotContain";
5
+ export type StepSignalsListTransformOp = {
6
+ op: "pluck";
7
+ signalKey: string;
8
+ } | {
9
+ op: "filter";
10
+ operator: StepSignalsListConditionOperator;
11
+ value: unknown;
12
+ } | {
13
+ op: "sortBy";
14
+ direction: "asc" | "desc";
15
+ } | {
16
+ op: "unique";
17
+ };
18
+ export type StepSignalsListReducerOp = {
19
+ op: "count";
20
+ } | {
21
+ op: "sum";
22
+ } | {
23
+ op: "avg";
24
+ } | {
25
+ op: "min";
26
+ } | {
27
+ op: "max";
28
+ } | {
29
+ op: "booleanAll";
30
+ } | {
31
+ op: "booleanAny";
32
+ } | {
33
+ op: "join";
34
+ separator: string;
35
+ } | {
36
+ op: "first";
37
+ } | {
38
+ op: "last";
39
+ };
40
+ /** Wire-format `ctx.stepSignalsList`-derived value, hoisted onto the `cohortGate` node. */
41
+ export type SerializedStepSignalsListDefinition = {
42
+ key: string;
43
+ ops: StepSignalsListTransformOp[];
44
+ reducer: StepSignalsListReducerOp;
45
+ };
46
+ /**
47
+ * An inline `ctx.stepSignalsList`-derived token, embedded in a rule's
48
+ * condition tree at the position a signal key would normally go. At
49
+ * serialize time, hoisted into the `cohortGate` node's
50
+ * `stepSignalsListDefinitions` and replaced by its bare `key` — the same
51
+ * "author inline, hoist, replace with bare key" discipline
52
+ * `extractInlineComputedSignals` already runs for `Computed.*`.
53
+ */
54
+ export type InlineStepSignalsListValue<TKey extends string = string> = {
55
+ readonly _tag: "step_signals_list";
56
+ readonly key: TKey;
57
+ readonly ops: StepSignalsListTransformOp[];
58
+ readonly reducer: StepSignalsListReducerOp;
59
+ };
60
+ /**
61
+ * A leaf condition, restricted to the cohort's own fact vocabulary: a bare
62
+ * fact name (`branchOutcomes.total()`/`.count(outcome)`, or a
63
+ * `ctx.stepSignalsList`-derived key) or an inline `InlineStepSignalsListValue`
64
+ * token (hoisted at serialize time). `value` may itself be a dynamic
65
+ * fact-reference (`{ fact: "branchCount" }`) — the same
66
+ * json-rules-engine-native mechanism `branchOutcomes.every()` compiles to.
67
+ */
68
+ export type CohortSignalCondition = {
69
+ readonly _tag: "signal";
70
+ signal: string | InlineStepSignalsListValue;
71
+ operator: StepSignalsListConditionOperator;
72
+ value: unknown;
73
+ };
74
+ export type CohortAllCondition = {
75
+ readonly _tag: "all";
76
+ conditions: CohortRuleCondition[];
77
+ };
78
+ export type CohortAnyCondition = {
79
+ readonly _tag: "any";
80
+ conditions: CohortRuleCondition[];
81
+ };
82
+ export type CohortRuleCondition = CohortSignalCondition | CohortAllCondition | CohortAnyCondition;
83
+ export type CohortRule = {
84
+ readonly _tag: "rule";
85
+ mode: "all" | "any";
86
+ conditions: CohortRuleCondition[];
87
+ outcome: CohortAdvancementEventType;
88
+ outcomeJson?: Record<string, unknown> | null;
89
+ };
90
+ export type SerializedCohortRule = {
91
+ conditions: Record<string, unknown>;
92
+ event: {
93
+ type: CohortAdvancementEventType;
94
+ params?: Record<string, unknown>;
95
+ };
96
+ };
97
+ /** Serialized shape expected by core's `CohortAdvancementPolicyDefinition`. */
98
+ export type SerializedCohortAdvancementPolicy = {
99
+ rules: SerializedCohortRule[];
100
+ defaultEventType: CohortAdvancementEventType;
101
+ defaultEventParamsJson: Record<string, unknown> | null;
102
+ };
103
+ export type CohortAdvancementPolicy = {
104
+ default: CohortAdvancementEventType;
105
+ defaultParamsJson?: Record<string, unknown> | null;
106
+ rules?: CohortRule[];
107
+ };
108
+ /** Serializes an authored `CohortAdvancementPolicy` (`advanceEach`/`advanceAll`) to its wire shape. */
109
+ export declare function serializeCohortAdvancementPolicy(policy: CohortAdvancementPolicy | undefined): SerializedCohortAdvancementPolicy;
110
+ /**
111
+ * Walks a `CohortAdvancementPolicy`'s rules tree, extracts every inline
112
+ * `ctx.stepSignalsList`-derived token embedded in a `CohortSignalCondition
113
+ * .signal` position, dedupes by key, and returns the resulting
114
+ * `stepSignalsListDefinitions` — the `cohortGate` node's counterpart to
115
+ * `extractInlineComputedSignals`.
116
+ */
117
+ export declare function extractInlineStepSignalsListDefinitions(policy: CohortAdvancementPolicy | undefined): SerializedStepSignalsListDefinition[];
@@ -0,0 +1,126 @@
1
+ import { type CohortAdvancementEventType, type CohortRule, type CohortRuleCondition, type CohortSignalCondition, type StepSignalsListConditionOperator } from "./cohort-advancement-policy";
2
+ declare const LEAF_BRAND: unique symbol;
3
+ declare const GROUP_BRAND: unique symbol;
4
+ /**
5
+ * A leaf condition + outcome attacher for the cohort scope
6
+ * (`advanceEach`/`advanceAll`). Built by `signal(key).<op>(value)`,
7
+ * `stepSignalsList.pluck(...).<reducer>()`, or `branchOutcomes.total()`/
8
+ * `.count(...)` chained with a comparator. Nestable inside `all()`/`any()`,
9
+ * or terminable with `.then(outcome)` — restricted to `continue`/`block`
10
+ * (AC4: no `route`/`complete`, unlike a regular step's `RuleLeaf`).
11
+ */
12
+ export interface CohortRuleLeaf {
13
+ readonly [LEAF_BRAND]: CohortSignalCondition;
14
+ then(outcome: CohortAdvancementEventType, paramsJson?: Record<string, unknown>): CohortRule;
15
+ }
16
+ /** A grouped condition + outcome attacher. Built by `all(...)` or `any(...)`. */
17
+ export interface CohortRuleGroup {
18
+ readonly [GROUP_BRAND]: {
19
+ mode: "all" | "any";
20
+ conditions: CohortRuleCondition[];
21
+ };
22
+ then(outcome: CohortAdvancementEventType, paramsJson?: Record<string, unknown>): CohortRule;
23
+ }
24
+ type CohortNestable = CohortRuleLeaf | CohortRuleGroup;
25
+ /**
26
+ * A comparator-bound reference into the cohort scope's facts — a branch's
27
+ * own signal (`advanceEach`), a `branchOutcomes.total()`/`.count(outcome)`
28
+ * aggregate, or a `stepSignalsList` reducer's result (`advanceAll`).
29
+ * Calling any comparator produces a `CohortRuleLeaf`.
30
+ */
31
+ export interface CohortSignalRef<TValue = unknown> {
32
+ eq(value: TValue): CohortRuleLeaf;
33
+ ne(value: TValue): CohortRuleLeaf;
34
+ gt(value: number): CohortRuleLeaf;
35
+ gte(value: number): CohortRuleLeaf;
36
+ lt(value: number): CohortRuleLeaf;
37
+ lte(value: number): CohortRuleLeaf;
38
+ in(values: ReadonlyArray<TValue>): CohortRuleLeaf;
39
+ notIn(values: ReadonlyArray<TValue>): CohortRuleLeaf;
40
+ contains(value: unknown): CohortRuleLeaf;
41
+ doesNotContain(value: unknown): CohortRuleLeaf;
42
+ }
43
+ type SignalValue<TSignalKeys extends string, TSignalTypeMap extends Partial<Record<string, unknown>>, K extends TSignalKeys> = K extends keyof TSignalTypeMap ? TSignalTypeMap[K] : unknown;
44
+ /**
45
+ * `advanceEach`'s callback context: one fan-out branch's own step result,
46
+ * evaluated the same way a regular step's `.advance()` evaluates its own
47
+ * signals (`evaluateBranchAgainstPolicy` — the same shared rules-engine
48
+ * pass, just restricted to `continue`/`block`). No `route`/`complete`, and
49
+ * — unlike `.advance()`'s `AdvanceCtx` — no `avg`/`sum`/`min`/`max`/`count`/
50
+ * `booleanAny`/`booleanAll` computed-signal factories: core's `fanOut` node
51
+ * config has no `computedSignalDefinitions` field to hoist them onto and
52
+ * `evaluateBranchAgainstPolicy` never resolves them, so exposing them here
53
+ * would silently produce dead wire fields. A later ticket can add that
54
+ * support to core first, then extend this ctx to match.
55
+ */
56
+ export interface AdvanceEachCtx<TSignalKeys extends string = string, TSignalTypeMap extends Partial<Record<string, unknown>> = Record<string, unknown>> {
57
+ signal<K extends TSignalKeys>(key: K): CohortSignalRef<SignalValue<TSignalKeys, TSignalTypeMap, K>>;
58
+ stepSignals: {
59
+ [K in TSignalKeys]: CohortSignalRef<SignalValue<TSignalKeys, TSignalTypeMap, K>>;
60
+ };
61
+ all(...refs: CohortNestable[]): CohortRuleGroup;
62
+ any(...refs: CohortNestable[]): CohortRuleGroup;
63
+ }
64
+ export interface AdvanceEachResult {
65
+ default: CohortAdvancementEventType;
66
+ rules?: CohortRule[];
67
+ }
68
+ export declare function makeAdvanceEachCtx<TSignalKeys extends string, TSignalTypeMap extends Partial<Record<string, unknown>> = Record<string, unknown>>(): AdvanceEachCtx<TSignalKeys, TSignalTypeMap>;
69
+ /** The 4-value branch outcome classification (mirrors core's `branchOutcomeValues`). */
70
+ export declare const branchOutcomeValues: readonly ["continue", "block", "error", "abandoned"];
71
+ export type BranchOutcome = (typeof branchOutcomeValues)[number];
72
+ /**
73
+ * A `ctx.stepSignalsList`-derived op-list builder: seeded by `.pluck(key)`,
74
+ * optionally narrowed/reshaped by `.filter()`/`.sortBy()`/`.unique()`, then
75
+ * finalized by exactly one reducer into a comparator-bound
76
+ * `CohortSignalRef` — the same "author fluently, hoist to a serializable
77
+ * definition" shape `Computed.*` uses, but resolved server-side against a
78
+ * cohort's real per-branch signals (`resolveStepSignalsListValue`) rather
79
+ * than a single step's own signals.
80
+ */
81
+ export interface StepSignalsListValueRef {
82
+ filter(operator: StepSignalsListConditionOperator, value: unknown): StepSignalsListValueRef;
83
+ sortBy(direction?: "asc" | "desc"): StepSignalsListValueRef;
84
+ unique(): StepSignalsListValueRef;
85
+ count(): CohortSignalRef;
86
+ sum(): CohortSignalRef;
87
+ avg(): CohortSignalRef;
88
+ min(): CohortSignalRef;
89
+ max(): CohortSignalRef;
90
+ booleanAll(): CohortSignalRef;
91
+ booleanAny(): CohortSignalRef;
92
+ join(separator?: string): CohortSignalRef;
93
+ first(): CohortSignalRef;
94
+ last(): CohortSignalRef;
95
+ }
96
+ /**
97
+ * `advanceAll`'s callback context: the whole cohort's aggregate branch
98
+ * outcomes (`branchOutcomes`) and any per-branch signal aggregation
99
+ * (`stepSignalsList`) — evaluated exactly once per cohort
100
+ * (`evaluateCohortAgainstPolicy`). Restricted to `continue`/`block`, no
101
+ * `stepSignals`/`route` (this is a whole-cohort decision, not one step's
102
+ * own).
103
+ */
104
+ export interface AdvanceAllCtx {
105
+ branchOutcomes: {
106
+ /** The cohort's total branch count. Compiles to fact `branchCount`. */
107
+ total(): CohortSignalRef<number>;
108
+ /** A single outcome's count across the cohort. Compiles to fact `${outcome}Count`. */
109
+ count(outcome: BranchOutcome): CohortSignalRef<number>;
110
+ /** True iff every branch resolved to this outcome. */
111
+ every(outcome: BranchOutcome): CohortRuleLeaf;
112
+ /** True iff at least one branch resolved to this outcome. */
113
+ some(outcome: BranchOutcome): CohortRuleLeaf;
114
+ };
115
+ stepSignalsList: {
116
+ pluck(signalKey: string): StepSignalsListValueRef;
117
+ };
118
+ all(...refs: CohortNestable[]): CohortRuleGroup;
119
+ any(...refs: CohortNestable[]): CohortRuleGroup;
120
+ }
121
+ export interface AdvanceAllResult {
122
+ default: CohortAdvancementEventType;
123
+ rules?: CohortRule[];
124
+ }
125
+ export declare function makeAdvanceAllCtx(): AdvanceAllCtx;
126
+ export {};
@@ -1,2 +1,4 @@
1
1
  export * from "./define-advancement-policy";
2
2
  export * from "./fluent-rules";
3
+ export * from "./cohort-advancement-policy";
4
+ export * from "./cohort-fluent-rules";