@h-rig/contracts 0.0.6-alpha.135 → 0.0.6-alpha.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +318 -267
- package/dist/index.mjs +318 -267
- package/dist/src/config.d.ts +34 -22
- package/dist/src/config.js +33 -12
- package/dist/src/help-catalog.js +1 -1
- package/dist/src/index.js +318 -267
- package/dist/src/kernel.d.ts +5 -22
- package/dist/src/kernel.js +1 -16
- package/dist/src/plugin-hooks.js +33 -12
- package/dist/src/plugin.d.ts +97 -3
- package/dist/src/plugin.js +36 -12
- package/dist/src/run-journal.d.ts +166 -0
- package/dist/src/run-journal.js +252 -122
- package/dist/src/run-session-journal.d.ts +4 -0
- package/dist/src/run-session-journal.js +260 -124
- package/dist/src/run-timeline.js +246 -124
- package/dist/src/stage.d.ts +3 -3
- package/dist/src/stage.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/contracts/src/run-journal.ts
|
|
3
|
-
import { Schema as
|
|
3
|
+
import { Schema as Schema6 } from "effect";
|
|
4
4
|
|
|
5
5
|
// packages/contracts/src/baseSchemas.ts
|
|
6
6
|
import { Schema } from "effect";
|
|
@@ -1035,12 +1035,116 @@ var WorktreeSummary = Schema4.Struct({
|
|
|
1035
1035
|
cleanedAt: Schema4.NullOr(IsoDateTime)
|
|
1036
1036
|
});
|
|
1037
1037
|
|
|
1038
|
+
// packages/contracts/src/stage.ts
|
|
1039
|
+
import { Schema as Schema5 } from "effect";
|
|
1040
|
+
var StageKind = Schema5.Literals(["transform", "gate", "observe"]);
|
|
1041
|
+
var StageId = TrimmedNonEmptyString.pipe(Schema5.brand("StageId"));
|
|
1042
|
+
var StageContext = Schema5.Struct({
|
|
1043
|
+
runId: RunId,
|
|
1044
|
+
taskId: Schema5.optional(Schema5.NullOr(TaskId)),
|
|
1045
|
+
state: Schema5.Unknown,
|
|
1046
|
+
metadata: Schema5.optional(Schema5.Record(Schema5.String, Schema5.Unknown))
|
|
1047
|
+
});
|
|
1048
|
+
var StageDescriptor = Schema5.Struct({
|
|
1049
|
+
id: StageId,
|
|
1050
|
+
kind: StageKind,
|
|
1051
|
+
before: Schema5.optional(Schema5.Array(StageId)),
|
|
1052
|
+
after: Schema5.optional(Schema5.Array(StageId)),
|
|
1053
|
+
priority: Schema5.Number.pipe(Schema5.withDecodingDefault(() => 0)),
|
|
1054
|
+
protected: Schema5.Boolean.pipe(Schema5.withDecodingDefault(() => false))
|
|
1055
|
+
});
|
|
1056
|
+
var StageContinueResult = Schema5.Struct({
|
|
1057
|
+
kind: Schema5.Literal("continue"),
|
|
1058
|
+
ctx: StageContext
|
|
1059
|
+
});
|
|
1060
|
+
var StageAllowResult = Schema5.Struct({
|
|
1061
|
+
kind: Schema5.Literal("allow")
|
|
1062
|
+
});
|
|
1063
|
+
var StageBlockResult = Schema5.Struct({
|
|
1064
|
+
kind: Schema5.Literal("block"),
|
|
1065
|
+
reason: TrimmedNonEmptyString
|
|
1066
|
+
});
|
|
1067
|
+
var StageResult = Schema5.Union([
|
|
1068
|
+
StageContinueResult,
|
|
1069
|
+
StageAllowResult,
|
|
1070
|
+
StageBlockResult
|
|
1071
|
+
]);
|
|
1072
|
+
var StageWrapperDescriptor = Schema5.Struct({
|
|
1073
|
+
id: TrimmedNonEmptyString,
|
|
1074
|
+
priority: Schema5.Number.pipe(Schema5.withDecodingDefault(() => 0))
|
|
1075
|
+
});
|
|
1076
|
+
var StageMutationOp = Schema5.Literals(["insert", "remove", "replace", "wrap", "reorder"]);
|
|
1077
|
+
var InsertStageMutation = Schema5.Struct({
|
|
1078
|
+
op: Schema5.Literal("insert"),
|
|
1079
|
+
stage: StageDescriptor,
|
|
1080
|
+
contributedBy: Schema5.optional(TrimmedNonEmptyString)
|
|
1081
|
+
});
|
|
1082
|
+
var RemoveStageMutation = Schema5.Struct({
|
|
1083
|
+
op: Schema5.Literal("remove"),
|
|
1084
|
+
id: StageId,
|
|
1085
|
+
contributedBy: Schema5.optional(TrimmedNonEmptyString)
|
|
1086
|
+
});
|
|
1087
|
+
var ReplaceStageMutation = Schema5.Struct({
|
|
1088
|
+
op: Schema5.Literal("replace"),
|
|
1089
|
+
id: StageId,
|
|
1090
|
+
stage: StageDescriptor,
|
|
1091
|
+
contributedBy: Schema5.optional(TrimmedNonEmptyString)
|
|
1092
|
+
});
|
|
1093
|
+
var WrapStageMutation = Schema5.Struct({
|
|
1094
|
+
op: Schema5.Literal("wrap"),
|
|
1095
|
+
id: StageId,
|
|
1096
|
+
around: StageWrapperDescriptor,
|
|
1097
|
+
contributedBy: Schema5.optional(TrimmedNonEmptyString)
|
|
1098
|
+
});
|
|
1099
|
+
var ReorderStageMutation = Schema5.Struct({
|
|
1100
|
+
op: Schema5.Literal("reorder"),
|
|
1101
|
+
id: StageId,
|
|
1102
|
+
before: Schema5.optional(Schema5.Array(StageId)),
|
|
1103
|
+
after: Schema5.optional(Schema5.Array(StageId)),
|
|
1104
|
+
contributedBy: Schema5.optional(TrimmedNonEmptyString)
|
|
1105
|
+
});
|
|
1106
|
+
var StageMutation = Schema5.Union([
|
|
1107
|
+
InsertStageMutation,
|
|
1108
|
+
RemoveStageMutation,
|
|
1109
|
+
ReplaceStageMutation,
|
|
1110
|
+
WrapStageMutation,
|
|
1111
|
+
ReorderStageMutation
|
|
1112
|
+
]);
|
|
1113
|
+
var ResolutionGrantUse = Schema5.Struct({
|
|
1114
|
+
kind: Schema5.Literal("kernel-replacement"),
|
|
1115
|
+
target: TrimmedNonEmptyString,
|
|
1116
|
+
pluginId: TrimmedNonEmptyString
|
|
1117
|
+
});
|
|
1118
|
+
var ResolutionRecordEntry = Schema5.Struct({
|
|
1119
|
+
stageId: StageId,
|
|
1120
|
+
contributedBy: TrimmedNonEmptyString,
|
|
1121
|
+
removedBy: Schema5.optional(TrimmedNonEmptyString),
|
|
1122
|
+
replacedBy: Schema5.optional(TrimmedNonEmptyString),
|
|
1123
|
+
wrappedBy: Schema5.optional(Schema5.Array(TrimmedNonEmptyString)),
|
|
1124
|
+
droppedAnchors: Schema5.optional(Schema5.Array(StageId)),
|
|
1125
|
+
isProtected: Schema5.Boolean
|
|
1126
|
+
});
|
|
1127
|
+
var ResolvedPipeline = Schema5.Struct({
|
|
1128
|
+
runId: Schema5.optional(RunId),
|
|
1129
|
+
order: Schema5.Array(StageId),
|
|
1130
|
+
record: Schema5.Array(ResolutionRecordEntry),
|
|
1131
|
+
cycles: Schema5.Array(Schema5.Array(StageId)),
|
|
1132
|
+
grantUses: Schema5.optional(Schema5.Array(ResolutionGrantUse)),
|
|
1133
|
+
resolvedAt: Schema5.optional(IsoDateTime)
|
|
1134
|
+
});
|
|
1135
|
+
var StageRunOutcome = Schema5.Struct({
|
|
1136
|
+
stageId: StageId,
|
|
1137
|
+
result: StageResult,
|
|
1138
|
+
startedAt: IsoDateTime,
|
|
1139
|
+
finishedAt: IsoDateTime
|
|
1140
|
+
});
|
|
1141
|
+
|
|
1038
1142
|
// packages/contracts/src/run-journal.ts
|
|
1039
|
-
var RunActor =
|
|
1040
|
-
kind:
|
|
1041
|
-
id:
|
|
1143
|
+
var RunActor = Schema6.Struct({
|
|
1144
|
+
kind: Schema6.Literals(["operator", "agent", "server", "system"]),
|
|
1145
|
+
id: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString))
|
|
1042
1146
|
});
|
|
1043
|
-
var RunCloseoutPhase =
|
|
1147
|
+
var RunCloseoutPhase = Schema6.Literals([
|
|
1044
1148
|
"queued",
|
|
1045
1149
|
"commit",
|
|
1046
1150
|
"push",
|
|
@@ -1050,102 +1154,102 @@ var RunCloseoutPhase = Schema5.Literals([
|
|
|
1050
1154
|
"close-source",
|
|
1051
1155
|
"completed"
|
|
1052
1156
|
]);
|
|
1053
|
-
var RunCloseoutPhaseOutcome =
|
|
1054
|
-
var RunCloseoutStatus =
|
|
1157
|
+
var RunCloseoutPhaseOutcome = Schema6.Literals(["started", "completed", "failed"]);
|
|
1158
|
+
var RunCloseoutStatus = Schema6.Literals([
|
|
1055
1159
|
"pending",
|
|
1056
1160
|
"running",
|
|
1057
1161
|
"completed",
|
|
1058
1162
|
"needs-attention",
|
|
1059
1163
|
"failed"
|
|
1060
1164
|
]);
|
|
1061
|
-
var RunCloseoutState =
|
|
1165
|
+
var RunCloseoutState = Schema6.Struct({
|
|
1062
1166
|
phase: RunCloseoutPhase,
|
|
1063
1167
|
status: RunCloseoutStatus,
|
|
1064
1168
|
updatedAt: IsoDateTime,
|
|
1065
|
-
taskId:
|
|
1066
|
-
runtimeWorkspace:
|
|
1067
|
-
branch:
|
|
1068
|
-
prUrl:
|
|
1069
|
-
artifactRoot:
|
|
1070
|
-
iterations:
|
|
1071
|
-
feedback:
|
|
1072
|
-
error:
|
|
1073
|
-
reason:
|
|
1074
|
-
merged:
|
|
1075
|
-
resumedAt:
|
|
1076
|
-
completedAt:
|
|
1077
|
-
});
|
|
1078
|
-
var ApprovalDecision =
|
|
1169
|
+
taskId: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1170
|
+
runtimeWorkspace: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1171
|
+
branch: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1172
|
+
prUrl: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1173
|
+
artifactRoot: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1174
|
+
iterations: Schema6.optional(Schema6.NullOr(Schema6.Int)),
|
|
1175
|
+
feedback: Schema6.optional(Schema6.Array(Schema6.String)),
|
|
1176
|
+
error: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1177
|
+
reason: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1178
|
+
merged: Schema6.optional(Schema6.Boolean),
|
|
1179
|
+
resumedAt: Schema6.optional(Schema6.NullOr(IsoDateTime)),
|
|
1180
|
+
completedAt: Schema6.optional(Schema6.NullOr(IsoDateTime))
|
|
1181
|
+
});
|
|
1182
|
+
var ApprovalDecision = Schema6.Literals(["approve", "reject"]);
|
|
1079
1183
|
var runRecordFields = {
|
|
1080
1184
|
runId: TrimmedNonEmptyString,
|
|
1081
1185
|
workspaceId: TrimmedNonEmptyString,
|
|
1082
|
-
taskId:
|
|
1083
|
-
threadId:
|
|
1084
|
-
mode:
|
|
1085
|
-
runtimeAdapter:
|
|
1186
|
+
taskId: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1187
|
+
threadId: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1188
|
+
mode: Schema6.Literals(["local", "remote"]),
|
|
1189
|
+
runtimeAdapter: Schema6.Literal("pi"),
|
|
1086
1190
|
createdAt: IsoDateTime,
|
|
1087
|
-
startedAt:
|
|
1088
|
-
completedAt:
|
|
1089
|
-
endpointId:
|
|
1090
|
-
hostId:
|
|
1091
|
-
worktreePath:
|
|
1092
|
-
artifactRoot:
|
|
1093
|
-
logRoot:
|
|
1094
|
-
sessionPath:
|
|
1095
|
-
sessionLogPath:
|
|
1096
|
-
pid:
|
|
1097
|
-
piSession:
|
|
1098
|
-
piSessionPrivate:
|
|
1191
|
+
startedAt: Schema6.NullOr(IsoDateTime),
|
|
1192
|
+
completedAt: Schema6.NullOr(IsoDateTime),
|
|
1193
|
+
endpointId: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1194
|
+
hostId: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1195
|
+
worktreePath: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1196
|
+
artifactRoot: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1197
|
+
logRoot: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1198
|
+
sessionPath: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1199
|
+
sessionLogPath: Schema6.NullOr(TrimmedNonEmptyString),
|
|
1200
|
+
pid: Schema6.optional(Schema6.NullOr(Schema6.Int)),
|
|
1201
|
+
piSession: Schema6.optional(Schema6.Unknown),
|
|
1202
|
+
piSessionPrivate: Schema6.optional(Schema6.Unknown),
|
|
1099
1203
|
updatedAt: IsoDateTime,
|
|
1100
1204
|
title: TrimmedNonEmptyString,
|
|
1101
|
-
projectRoot:
|
|
1102
|
-
errorText:
|
|
1103
|
-
latestMessageId:
|
|
1104
|
-
prUrl:
|
|
1105
|
-
leaseId:
|
|
1106
|
-
serverCloseout:
|
|
1107
|
-
model:
|
|
1108
|
-
runtimeMode:
|
|
1109
|
-
interactionMode:
|
|
1110
|
-
runMode:
|
|
1111
|
-
initialPrompt:
|
|
1112
|
-
baselineMode:
|
|
1113
|
-
prMode:
|
|
1114
|
-
initiatedBy:
|
|
1115
|
-
sourceTask:
|
|
1116
|
-
serverPid:
|
|
1117
|
-
latestSteeringAt:
|
|
1118
|
-
latestSteeringDeliveredAt:
|
|
1119
|
-
statusDetail:
|
|
1120
|
-
planning:
|
|
1121
|
-
branch:
|
|
1205
|
+
projectRoot: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1206
|
+
errorText: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1207
|
+
latestMessageId: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1208
|
+
prUrl: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1209
|
+
leaseId: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1210
|
+
serverCloseout: Schema6.optional(Schema6.NullOr(RunCloseoutState)),
|
|
1211
|
+
model: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1212
|
+
runtimeMode: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1213
|
+
interactionMode: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1214
|
+
runMode: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1215
|
+
initialPrompt: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1216
|
+
baselineMode: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1217
|
+
prMode: Schema6.optional(Schema6.NullOr(Schema6.Literals(["auto", "ask", "off"]))),
|
|
1218
|
+
initiatedBy: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1219
|
+
sourceTask: Schema6.optional(Schema6.Unknown),
|
|
1220
|
+
serverPid: Schema6.optional(Schema6.NullOr(Schema6.Int)),
|
|
1221
|
+
latestSteeringAt: Schema6.optional(Schema6.NullOr(IsoDateTime)),
|
|
1222
|
+
latestSteeringDeliveredAt: Schema6.optional(Schema6.NullOr(IsoDateTime)),
|
|
1223
|
+
statusDetail: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1224
|
+
planning: Schema6.optional(Schema6.Unknown),
|
|
1225
|
+
branch: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString))
|
|
1122
1226
|
};
|
|
1123
|
-
var RunJournalRecord =
|
|
1227
|
+
var RunJournalRecord = Schema6.Struct({
|
|
1124
1228
|
...runRecordFields,
|
|
1125
1229
|
status: RunStatus
|
|
1126
1230
|
});
|
|
1127
|
-
var RunRecordPatch =
|
|
1128
|
-
runId:
|
|
1129
|
-
workspaceId:
|
|
1130
|
-
taskId:
|
|
1131
|
-
threadId:
|
|
1132
|
-
mode:
|
|
1133
|
-
runtimeAdapter:
|
|
1134
|
-
createdAt:
|
|
1135
|
-
startedAt:
|
|
1136
|
-
completedAt:
|
|
1137
|
-
endpointId:
|
|
1138
|
-
hostId:
|
|
1139
|
-
worktreePath:
|
|
1140
|
-
artifactRoot:
|
|
1141
|
-
logRoot:
|
|
1142
|
-
sessionPath:
|
|
1143
|
-
sessionLogPath:
|
|
1231
|
+
var RunRecordPatch = Schema6.Struct({
|
|
1232
|
+
runId: Schema6.optional(runRecordFields.runId),
|
|
1233
|
+
workspaceId: Schema6.optional(runRecordFields.workspaceId),
|
|
1234
|
+
taskId: Schema6.optional(runRecordFields.taskId),
|
|
1235
|
+
threadId: Schema6.optional(runRecordFields.threadId),
|
|
1236
|
+
mode: Schema6.optional(runRecordFields.mode),
|
|
1237
|
+
runtimeAdapter: Schema6.optional(runRecordFields.runtimeAdapter),
|
|
1238
|
+
createdAt: Schema6.optional(runRecordFields.createdAt),
|
|
1239
|
+
startedAt: Schema6.optional(runRecordFields.startedAt),
|
|
1240
|
+
completedAt: Schema6.optional(runRecordFields.completedAt),
|
|
1241
|
+
endpointId: Schema6.optional(runRecordFields.endpointId),
|
|
1242
|
+
hostId: Schema6.optional(runRecordFields.hostId),
|
|
1243
|
+
worktreePath: Schema6.optional(runRecordFields.worktreePath),
|
|
1244
|
+
artifactRoot: Schema6.optional(runRecordFields.artifactRoot),
|
|
1245
|
+
logRoot: Schema6.optional(runRecordFields.logRoot),
|
|
1246
|
+
sessionPath: Schema6.optional(runRecordFields.sessionPath),
|
|
1247
|
+
sessionLogPath: Schema6.optional(runRecordFields.sessionLogPath),
|
|
1144
1248
|
pid: runRecordFields.pid,
|
|
1145
1249
|
piSession: runRecordFields.piSession,
|
|
1146
1250
|
piSessionPrivate: runRecordFields.piSessionPrivate,
|
|
1147
|
-
updatedAt:
|
|
1148
|
-
title:
|
|
1251
|
+
updatedAt: Schema6.optional(runRecordFields.updatedAt),
|
|
1252
|
+
title: Schema6.optional(runRecordFields.title),
|
|
1149
1253
|
projectRoot: runRecordFields.projectRoot,
|
|
1150
1254
|
errorText: runRecordFields.errorText,
|
|
1151
1255
|
latestMessageId: runRecordFields.latestMessageId,
|
|
@@ -1169,88 +1273,98 @@ var RunRecordPatch = Schema5.Struct({
|
|
|
1169
1273
|
branch: runRecordFields.branch
|
|
1170
1274
|
});
|
|
1171
1275
|
var journalEnvelopeFields = {
|
|
1172
|
-
v:
|
|
1276
|
+
v: Schema6.Literal(1),
|
|
1173
1277
|
seq: PositiveInt,
|
|
1174
1278
|
at: IsoDateTime,
|
|
1175
1279
|
runId: RunId
|
|
1176
1280
|
};
|
|
1177
|
-
var RunStatusChangedEvent =
|
|
1281
|
+
var RunStatusChangedEvent = Schema6.Struct({
|
|
1178
1282
|
...journalEnvelopeFields,
|
|
1179
|
-
type:
|
|
1180
|
-
from:
|
|
1283
|
+
type: Schema6.Literal("status-changed"),
|
|
1284
|
+
from: Schema6.NullOr(RunStatus),
|
|
1181
1285
|
to: RunStatus,
|
|
1182
|
-
reason:
|
|
1183
|
-
actor:
|
|
1286
|
+
reason: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1287
|
+
actor: Schema6.optional(RunActor)
|
|
1184
1288
|
});
|
|
1185
|
-
var RunRecordPatchEvent =
|
|
1289
|
+
var RunRecordPatchEvent = Schema6.Struct({
|
|
1186
1290
|
...journalEnvelopeFields,
|
|
1187
|
-
type:
|
|
1291
|
+
type: Schema6.Literal("record-patch"),
|
|
1188
1292
|
patch: RunRecordPatch
|
|
1189
1293
|
});
|
|
1190
|
-
var RunTimelineEntryEvent =
|
|
1294
|
+
var RunTimelineEntryEvent = Schema6.Struct({
|
|
1191
1295
|
...journalEnvelopeFields,
|
|
1192
|
-
type:
|
|
1193
|
-
payload:
|
|
1296
|
+
type: Schema6.Literal("timeline-entry"),
|
|
1297
|
+
payload: Schema6.Unknown
|
|
1194
1298
|
});
|
|
1195
|
-
var RunLogEntryEvent =
|
|
1299
|
+
var RunLogEntryEvent = Schema6.Struct({
|
|
1196
1300
|
...journalEnvelopeFields,
|
|
1197
|
-
type:
|
|
1198
|
-
payload:
|
|
1301
|
+
type: Schema6.Literal("log-entry"),
|
|
1302
|
+
payload: Schema6.Unknown
|
|
1199
1303
|
});
|
|
1200
|
-
var RunApprovalRequestedEvent =
|
|
1304
|
+
var RunApprovalRequestedEvent = Schema6.Struct({
|
|
1201
1305
|
...journalEnvelopeFields,
|
|
1202
|
-
type:
|
|
1306
|
+
type: Schema6.Literal("approval-requested"),
|
|
1203
1307
|
requestId: TrimmedNonEmptyString,
|
|
1204
1308
|
requestKind: TrimmedNonEmptyString,
|
|
1205
|
-
actionId:
|
|
1206
|
-
payload:
|
|
1309
|
+
actionId: Schema6.optional(Schema6.NullOr(TrimmedNonEmptyString)),
|
|
1310
|
+
payload: Schema6.Unknown
|
|
1207
1311
|
});
|
|
1208
|
-
var RunApprovalResolvedEvent =
|
|
1312
|
+
var RunApprovalResolvedEvent = Schema6.Struct({
|
|
1209
1313
|
...journalEnvelopeFields,
|
|
1210
|
-
type:
|
|
1314
|
+
type: Schema6.Literal("approval-resolved"),
|
|
1211
1315
|
requestId: TrimmedNonEmptyString,
|
|
1212
1316
|
decision: ApprovalDecision,
|
|
1213
|
-
note:
|
|
1317
|
+
note: Schema6.optional(Schema6.NullOr(Schema6.String)),
|
|
1214
1318
|
actor: RunActor
|
|
1215
1319
|
});
|
|
1216
|
-
var RunInputRequestedEvent =
|
|
1320
|
+
var RunInputRequestedEvent = Schema6.Struct({
|
|
1217
1321
|
...journalEnvelopeFields,
|
|
1218
|
-
type:
|
|
1322
|
+
type: Schema6.Literal("input-requested"),
|
|
1219
1323
|
requestId: TrimmedNonEmptyString,
|
|
1220
|
-
payload:
|
|
1324
|
+
payload: Schema6.Unknown
|
|
1221
1325
|
});
|
|
1222
|
-
var RunInputResolvedEvent =
|
|
1326
|
+
var RunInputResolvedEvent = Schema6.Struct({
|
|
1223
1327
|
...journalEnvelopeFields,
|
|
1224
|
-
type:
|
|
1328
|
+
type: Schema6.Literal("input-resolved"),
|
|
1225
1329
|
requestId: TrimmedNonEmptyString,
|
|
1226
|
-
answers:
|
|
1330
|
+
answers: Schema6.Record(Schema6.String, Schema6.String),
|
|
1227
1331
|
actor: RunActor
|
|
1228
1332
|
});
|
|
1229
|
-
var RunSteeringEvent =
|
|
1333
|
+
var RunSteeringEvent = Schema6.Struct({
|
|
1230
1334
|
...journalEnvelopeFields,
|
|
1231
|
-
type:
|
|
1335
|
+
type: Schema6.Literal("steering"),
|
|
1232
1336
|
actor: RunActor,
|
|
1233
|
-
text:
|
|
1337
|
+
text: Schema6.String
|
|
1234
1338
|
});
|
|
1235
|
-
var RunAdoptedEvent =
|
|
1339
|
+
var RunAdoptedEvent = Schema6.Struct({
|
|
1236
1340
|
...journalEnvelopeFields,
|
|
1237
|
-
type:
|
|
1238
|
-
pid:
|
|
1239
|
-
serverPid:
|
|
1341
|
+
type: Schema6.Literal("adopted"),
|
|
1342
|
+
pid: Schema6.NullOr(Schema6.Int),
|
|
1343
|
+
serverPid: Schema6.Int
|
|
1240
1344
|
});
|
|
1241
|
-
var RunStallDetectedEvent =
|
|
1345
|
+
var RunStallDetectedEvent = Schema6.Struct({
|
|
1242
1346
|
...journalEnvelopeFields,
|
|
1243
|
-
type:
|
|
1244
|
-
detail:
|
|
1347
|
+
type: Schema6.Literal("stall-detected"),
|
|
1348
|
+
detail: Schema6.String
|
|
1245
1349
|
});
|
|
1246
|
-
var RunCloseoutPhaseEvent =
|
|
1350
|
+
var RunCloseoutPhaseEvent = Schema6.Struct({
|
|
1247
1351
|
...journalEnvelopeFields,
|
|
1248
|
-
type:
|
|
1352
|
+
type: Schema6.Literal("closeout-phase"),
|
|
1249
1353
|
phase: RunCloseoutPhase,
|
|
1250
1354
|
outcome: RunCloseoutPhaseOutcome,
|
|
1251
|
-
detail:
|
|
1355
|
+
detail: Schema6.optional(Schema6.NullOr(Schema6.String))
|
|
1252
1356
|
});
|
|
1253
|
-
var
|
|
1357
|
+
var RunPipelineResolvedEvent = Schema6.Struct({
|
|
1358
|
+
...journalEnvelopeFields,
|
|
1359
|
+
type: Schema6.Literal("pipeline-resolved"),
|
|
1360
|
+
pipeline: ResolvedPipeline
|
|
1361
|
+
});
|
|
1362
|
+
var RunStageOutcomeEvent = Schema6.Struct({
|
|
1363
|
+
...journalEnvelopeFields,
|
|
1364
|
+
type: Schema6.Literal("stage-outcome"),
|
|
1365
|
+
outcome: StageRunOutcome
|
|
1366
|
+
});
|
|
1367
|
+
var RunJournalEvent = Schema6.Union([
|
|
1254
1368
|
RunStatusChangedEvent,
|
|
1255
1369
|
RunRecordPatchEvent,
|
|
1256
1370
|
RunTimelineEntryEvent,
|
|
@@ -1262,9 +1376,11 @@ var RunJournalEvent = Schema5.Union([
|
|
|
1262
1376
|
RunSteeringEvent,
|
|
1263
1377
|
RunAdoptedEvent,
|
|
1264
1378
|
RunStallDetectedEvent,
|
|
1265
|
-
RunCloseoutPhaseEvent
|
|
1379
|
+
RunCloseoutPhaseEvent,
|
|
1380
|
+
RunPipelineResolvedEvent,
|
|
1381
|
+
RunStageOutcomeEvent
|
|
1266
1382
|
]);
|
|
1267
|
-
var decodeRunJournalEvent =
|
|
1383
|
+
var decodeRunJournalEvent = Schema6.decodeUnknownSync(RunJournalEvent);
|
|
1268
1384
|
var RUN_STATUS_TRANSITIONS = {
|
|
1269
1385
|
created: ["queued", "preparing", "running", "failed", "stopped"],
|
|
1270
1386
|
queued: ["preparing", "running", "failed", "stopped"],
|
|
@@ -1314,6 +1430,8 @@ function reduceRunJournal(events, runId = null) {
|
|
|
1314
1430
|
const pendingUserInputs = new Map;
|
|
1315
1431
|
const resolvedUserInputs = [];
|
|
1316
1432
|
const closeoutPhases = [];
|
|
1433
|
+
let resolvedPipeline = null;
|
|
1434
|
+
const stageOutcomes = [];
|
|
1317
1435
|
const anomalies = [];
|
|
1318
1436
|
let steeringCount = 0;
|
|
1319
1437
|
let stallCount = 0;
|
|
@@ -1447,6 +1565,14 @@ function reduceRunJournal(events, runId = null) {
|
|
|
1447
1565
|
});
|
|
1448
1566
|
break;
|
|
1449
1567
|
}
|
|
1568
|
+
case "pipeline-resolved": {
|
|
1569
|
+
resolvedPipeline = event.pipeline;
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
case "stage-outcome": {
|
|
1573
|
+
stageOutcomes.push({ seq: event.seq, at: event.at, outcome: event.outcome });
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1450
1576
|
case "timeline-entry":
|
|
1451
1577
|
case "log-entry":
|
|
1452
1578
|
break;
|
|
@@ -1464,6 +1590,8 @@ function reduceRunJournal(events, runId = null) {
|
|
|
1464
1590
|
steeringCount,
|
|
1465
1591
|
stallCount,
|
|
1466
1592
|
closeoutPhases,
|
|
1593
|
+
resolvedPipeline,
|
|
1594
|
+
stageOutcomes,
|
|
1467
1595
|
lastSeq,
|
|
1468
1596
|
lastEventAt,
|
|
1469
1597
|
anomalies
|
|
@@ -1483,6 +1611,8 @@ var RIG_RUN_STEERING = "rig.run.steering";
|
|
|
1483
1611
|
var RIG_RUN_ADOPTED = "rig.run.adopted";
|
|
1484
1612
|
var RIG_RUN_STALL_DETECTED = "rig.run.stall-detected";
|
|
1485
1613
|
var RIG_RUN_CLOSEOUT_PHASE = "rig.run.closeout-phase";
|
|
1614
|
+
var RIG_RUN_PIPELINE_RESOLVED = "rig.run.pipeline-resolved";
|
|
1615
|
+
var RIG_RUN_STAGE_OUTCOME = "rig.run.stage-outcome";
|
|
1486
1616
|
var RIG_STOP_SENTINEL = "<<RIG_STOP";
|
|
1487
1617
|
var RIG_STOP_SENTINEL_END = ">>";
|
|
1488
1618
|
function buildStopSentinel(runId, reason, requestedBy = "rig") {
|
|
@@ -1599,7 +1729,9 @@ var CUSTOM_TYPE_FOR = {
|
|
|
1599
1729
|
steering: RIG_RUN_STEERING,
|
|
1600
1730
|
adopted: RIG_RUN_ADOPTED,
|
|
1601
1731
|
"stall-detected": RIG_RUN_STALL_DETECTED,
|
|
1602
|
-
"closeout-phase": RIG_RUN_CLOSEOUT_PHASE
|
|
1732
|
+
"closeout-phase": RIG_RUN_CLOSEOUT_PHASE,
|
|
1733
|
+
"pipeline-resolved": RIG_RUN_PIPELINE_RESOLVED,
|
|
1734
|
+
"stage-outcome": RIG_RUN_STAGE_OUTCOME
|
|
1603
1735
|
};
|
|
1604
1736
|
var TYPE_FOR_CUSTOM = {
|
|
1605
1737
|
[RIG_RUN_STATUS_CHANGED]: "status-changed",
|
|
@@ -1613,7 +1745,9 @@ var TYPE_FOR_CUSTOM = {
|
|
|
1613
1745
|
[RIG_RUN_STEERING]: "steering",
|
|
1614
1746
|
[RIG_RUN_ADOPTED]: "adopted",
|
|
1615
1747
|
[RIG_RUN_STALL_DETECTED]: "stall-detected",
|
|
1616
|
-
[RIG_RUN_CLOSEOUT_PHASE]: "closeout-phase"
|
|
1748
|
+
[RIG_RUN_CLOSEOUT_PHASE]: "closeout-phase",
|
|
1749
|
+
[RIG_RUN_PIPELINE_RESOLVED]: "pipeline-resolved",
|
|
1750
|
+
[RIG_RUN_STAGE_OUTCOME]: "stage-outcome"
|
|
1617
1751
|
};
|
|
1618
1752
|
function isRunSessionCustomType(customType) {
|
|
1619
1753
|
return customType !== undefined && Object.hasOwn(TYPE_FOR_CUSTOM, customType);
|
|
@@ -1657,7 +1791,9 @@ export {
|
|
|
1657
1791
|
RIG_RUN_STEERING,
|
|
1658
1792
|
RIG_RUN_STATUS_CHANGED,
|
|
1659
1793
|
RIG_RUN_STALL_DETECTED,
|
|
1794
|
+
RIG_RUN_STAGE_OUTCOME,
|
|
1660
1795
|
RIG_RUN_RECORD_PATCH,
|
|
1796
|
+
RIG_RUN_PIPELINE_RESOLVED,
|
|
1661
1797
|
RIG_RUN_LOG_ENTRY,
|
|
1662
1798
|
RIG_RUN_INPUT_RESOLVED,
|
|
1663
1799
|
RIG_RUN_INPUT_REQUESTED,
|