@usine/orchestrator 0.0.1 → 0.2.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/README.md +146 -2
- package/dist/board/items.d.ts +18 -0
- package/dist/board/items.d.ts.map +1 -0
- package/dist/board/items.js +46 -0
- package/dist/board/items.js.map +1 -0
- package/dist/board/projection.d.ts +9 -0
- package/dist/board/projection.d.ts.map +1 -0
- package/dist/board/projection.js +111 -0
- package/dist/board/projection.js.map +1 -0
- package/dist/board/tasks.d.ts +8 -0
- package/dist/board/tasks.d.ts.map +1 -0
- package/dist/board/tasks.js +86 -0
- package/dist/board/tasks.js.map +1 -0
- package/dist/credentials.d.ts +12 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +62 -0
- package/dist/credentials.js.map +1 -0
- package/dist/exe-dev.d.ts +8 -0
- package/dist/exe-dev.d.ts.map +1 -0
- package/dist/exe-dev.js +17 -0
- package/dist/exe-dev.js.map +1 -0
- package/dist/idle-triggers.d.ts +6 -0
- package/dist/idle-triggers.d.ts.map +1 -0
- package/dist/idle-triggers.js +31 -0
- package/dist/idle-triggers.js.map +1 -0
- package/dist/label-reconciler.d.ts +30 -0
- package/dist/label-reconciler.d.ts.map +1 -0
- package/dist/label-reconciler.js +119 -0
- package/dist/label-reconciler.js.map +1 -0
- package/dist/local.d.ts +25 -0
- package/dist/local.d.ts.map +1 -0
- package/dist/local.js +53 -0
- package/dist/local.js.map +1 -0
- package/dist/operator/attempt.d.ts +66 -0
- package/dist/operator/attempt.d.ts.map +1 -0
- package/dist/operator/attempt.js +58 -0
- package/dist/operator/attempt.js.map +1 -0
- package/dist/operator/board.d.ts +119 -0
- package/dist/operator/board.d.ts.map +1 -0
- package/dist/operator/board.js +101 -0
- package/dist/operator/board.js.map +1 -0
- package/dist/operator/http.d.ts +114 -0
- package/dist/operator/http.d.ts.map +1 -0
- package/dist/operator/http.js +139 -0
- package/dist/operator/http.js.map +1 -0
- package/dist/operator/need.d.ts +66 -0
- package/dist/operator/need.d.ts.map +1 -0
- package/dist/operator/need.js +70 -0
- package/dist/operator/need.js.map +1 -0
- package/dist/operator/operator.d.ts +64 -0
- package/dist/operator/operator.d.ts.map +1 -0
- package/dist/operator/operator.js +363 -0
- package/dist/operator/operator.js.map +1 -0
- package/dist/operator/overview.d.ts +51 -0
- package/dist/operator/overview.d.ts.map +1 -0
- package/dist/operator/overview.js +48 -0
- package/dist/operator/overview.js.map +1 -0
- package/dist/operator/projection.d.ts +17 -0
- package/dist/operator/projection.d.ts.map +1 -0
- package/dist/operator/projection.js +138 -0
- package/dist/operator/projection.js.map +1 -0
- package/dist/operator/run.d.ts +38 -0
- package/dist/operator/run.d.ts.map +1 -0
- package/dist/operator/run.js +41 -0
- package/dist/operator/run.js.map +1 -0
- package/dist/operator/transcript.d.ts +57 -0
- package/dist/operator/transcript.d.ts.map +1 -0
- package/dist/operator/transcript.js +59 -0
- package/dist/operator/transcript.js.map +1 -0
- package/dist/orchestrator.d.ts +14 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +14 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/polling/cycle.d.ts +51 -0
- package/dist/polling/cycle.d.ts.map +1 -0
- package/dist/polling/cycle.js +44 -0
- package/dist/polling/cycle.js.map +1 -0
- package/dist/polling/hints.d.ts +20 -0
- package/dist/polling/hints.d.ts.map +1 -0
- package/dist/polling/hints.js +54 -0
- package/dist/polling/hints.js.map +1 -0
- package/dist/polling/loop-evaluation.d.ts +21 -0
- package/dist/polling/loop-evaluation.d.ts.map +1 -0
- package/dist/polling/loop-evaluation.js +131 -0
- package/dist/polling/loop-evaluation.js.map +1 -0
- package/dist/polling/polling.d.ts +36 -0
- package/dist/polling/polling.d.ts.map +1 -0
- package/dist/polling/polling.js +296 -0
- package/dist/polling/polling.js.map +1 -0
- package/dist/polling/repository-sync.d.ts +45 -0
- package/dist/polling/repository-sync.d.ts.map +1 -0
- package/dist/polling/repository-sync.js +169 -0
- package/dist/polling/repository-sync.js.map +1 -0
- package/dist/polling-triggers.d.ts +4 -0
- package/dist/polling-triggers.d.ts.map +1 -0
- package/dist/polling-triggers.js +4 -0
- package/dist/polling-triggers.js.map +1 -0
- package/dist/schedule-triggers.d.ts +67 -0
- package/dist/schedule-triggers.d.ts.map +1 -0
- package/dist/schedule-triggers.js +401 -0
- package/dist/schedule-triggers.js.map +1 -0
- package/dist/scheduler.d.ts +15 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +107 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/trigger-submission.d.ts +69 -0
- package/dist/trigger-submission.d.ts.map +1 -0
- package/dist/trigger-submission.js +108 -0
- package/dist/trigger-submission.js.map +1 -0
- package/package.json +67 -5
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ItemKey, ItemNumber } from "@usine/core/item";
|
|
2
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
3
|
+
import { GitHubLabelName } from "@usine/config/label";
|
|
4
|
+
import { LaneItemState, LaneName, LaneSource } from "@usine/config/board";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
import { RunView } from "./run.js";
|
|
7
|
+
/** Identifies a lane within a Project's Board for operator moves. */
|
|
8
|
+
export const BoardLaneId = Schema.NonEmptyString.pipe(Schema.brand("BoardLaneId"));
|
|
9
|
+
/** Whether a lane came from authored settings, a proposal, or default grouping. */
|
|
10
|
+
export const BoardLaneOrigin = Schema.Literals(["authored", "proposed", "fallback"]);
|
|
11
|
+
/** An Item linked to a Task, with its own title and external destination. */
|
|
12
|
+
export class BoardItemLink extends Schema.Class("@usine/orchestrator/BoardItemLink")({
|
|
13
|
+
itemKey: ItemKey,
|
|
14
|
+
kind: Schema.Literals(["issue", "pr"]),
|
|
15
|
+
number: ItemNumber,
|
|
16
|
+
title: Schema.String,
|
|
17
|
+
url: Schema.NonEmptyString,
|
|
18
|
+
}) {
|
|
19
|
+
}
|
|
20
|
+
/** A Task projected from linked Items. The current Item determines the key, lane, labels, and move destination; the first issue supplies the Task title. */
|
|
21
|
+
export class BoardTaskView extends Schema.Class("@usine/orchestrator/BoardTaskView")({
|
|
22
|
+
...BoardItemLink.fields,
|
|
23
|
+
state: LaneItemState,
|
|
24
|
+
labels: Schema.Array(GitHubLabelName),
|
|
25
|
+
items: Schema.Array(BoardItemLink).check(Schema.isNonEmpty()),
|
|
26
|
+
/** Every saved Run for the visible Items, ordered from earliest to latest. */
|
|
27
|
+
runs: Schema.Array(RunView),
|
|
28
|
+
run: Schema.NullOr(RunView),
|
|
29
|
+
needsYou: Schema.Boolean,
|
|
30
|
+
}) {
|
|
31
|
+
}
|
|
32
|
+
const BoardLaneViewFields = {
|
|
33
|
+
id: BoardLaneId,
|
|
34
|
+
name: LaneName,
|
|
35
|
+
sources: Schema.Array(LaneSource),
|
|
36
|
+
origin: BoardLaneOrigin,
|
|
37
|
+
items: Schema.Array(BoardTaskView),
|
|
38
|
+
};
|
|
39
|
+
/** An authored lane the operator can move Items into by applying its configured GitHub labels. */
|
|
40
|
+
export class WritableBoardLaneView extends Schema.TaggedClass("@usine/orchestrator/WritableBoardLaneView")("WritableBoardLane", {
|
|
41
|
+
...BoardLaneViewFields,
|
|
42
|
+
origin: Schema.Literal("authored"),
|
|
43
|
+
labels: Schema.Array(GitHubLabelName).check(Schema.isNonEmpty()),
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
/** A lane that groups Items without accepting label-based moves. */
|
|
47
|
+
export class ReadOnlyBoardLaneView extends Schema.TaggedClass("@usine/orchestrator/ReadOnlyBoardLaneView")("ReadOnlyBoardLane", BoardLaneViewFields) {
|
|
48
|
+
}
|
|
49
|
+
/** A displayed lane whose variant determines whether operator moves are supported. */
|
|
50
|
+
export const BoardLaneView = Schema.Union([WritableBoardLaneView, ReadOnlyBoardLaneView]);
|
|
51
|
+
/** An Item projection could not produce a Board card; other Items remain available. */
|
|
52
|
+
export class BoardProjectionError extends Schema.TaggedError("@usine/orchestrator/BoardProjectionError")("BoardProjectionError", {
|
|
53
|
+
repository: RepositoryName,
|
|
54
|
+
itemKey: ItemKey,
|
|
55
|
+
message: Schema.NonEmptyString,
|
|
56
|
+
}) {
|
|
57
|
+
}
|
|
58
|
+
/** The Project's lanes and the Item failures encountered while constructing their cards. */
|
|
59
|
+
export class BoardView extends Schema.Class("@usine/orchestrator/BoardView")({
|
|
60
|
+
lanes: Schema.Array(BoardLaneView),
|
|
61
|
+
failures: Schema.Array(BoardProjectionError),
|
|
62
|
+
}) {
|
|
63
|
+
}
|
|
64
|
+
/** A repository label as GitHub shows it. Color is null for catalogs stored before colors were kept. */
|
|
65
|
+
export class LabelView extends Schema.Class("@usine/orchestrator/LabelView")({
|
|
66
|
+
name: GitHubLabelName,
|
|
67
|
+
color: Schema.NullOr(Schema.String),
|
|
68
|
+
description: Schema.NullOr(Schema.String),
|
|
69
|
+
}) {
|
|
70
|
+
}
|
|
71
|
+
/** An operator request to move one Project Item into a destination lane. */
|
|
72
|
+
export class BoardMove extends Schema.Class("@usine/orchestrator/BoardMove")({
|
|
73
|
+
repository: RepositoryName,
|
|
74
|
+
item: ItemNumber,
|
|
75
|
+
toLane: BoardLaneId,
|
|
76
|
+
}) {
|
|
77
|
+
}
|
|
78
|
+
/** The requested Project is absent from the operator overview. */
|
|
79
|
+
export class BoardProjectNotFoundError extends Schema.TaggedError("@usine/orchestrator/BoardProjectNotFoundError")("BoardProjectNotFoundError", {
|
|
80
|
+
repository: RepositoryName,
|
|
81
|
+
}) {
|
|
82
|
+
}
|
|
83
|
+
/** The requested Item is absent from the Project's Board. */
|
|
84
|
+
export class BoardItemNotFoundError extends Schema.TaggedError("@usine/orchestrator/BoardItemNotFoundError")("BoardItemNotFoundError", {
|
|
85
|
+
repository: RepositoryName,
|
|
86
|
+
item: ItemNumber,
|
|
87
|
+
}) {
|
|
88
|
+
}
|
|
89
|
+
/** The requested destination lane is absent from the Project's Board. */
|
|
90
|
+
export class BoardLaneNotFoundError extends Schema.TaggedError("@usine/orchestrator/BoardLaneNotFoundError")("BoardLaneNotFoundError", {
|
|
91
|
+
repository: RepositoryName,
|
|
92
|
+
lane: BoardLaneId,
|
|
93
|
+
}) {
|
|
94
|
+
}
|
|
95
|
+
/** The requested destination lane does not accept label-based moves. */
|
|
96
|
+
export class BoardLaneReadOnlyError extends Schema.TaggedError("@usine/orchestrator/BoardLaneReadOnlyError")("BoardLaneReadOnlyError", {
|
|
97
|
+
repository: RepositoryName,
|
|
98
|
+
lane: BoardLaneId,
|
|
99
|
+
}) {
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/operator/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAGnF,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAGrF,6EAA6E;AAC7E,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC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AW,CAC/D,+CAA+C,CAChD,CAAC,2BAA2B,EAAE;IAC7B,UAAU,EAAE,cAAc;CAC3B,CAAC;CAAG;AAEL,6DAA6D;AAC7D,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,4CAA4C,CAC7C,CAAC,wBAAwB,EAAE;IAC1B,UAAU,EAAE,cAAc;IAC1B,IAAI,EAAE,UAAU;CACjB,CAAC;CAAG;AAEL,yEAAyE;AACzE,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,4CAA4C,CAC7C,CAAC,wBAAwB,EAAE;IAC1B,UAAU,EAAE,cAAc;IAC1B,IAAI,EAAE,WAAW;CAClB,CAAC;CAAG;AAEL,wEAAwE;AACxE,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,4CAA4C,CAC7C,CAAC,wBAAwB,EAAE;IAC1B,UAAU,EAAE,cAAc;IAC1B,IAAI,EAAE,WAAW;CAClB,CAAC;CAAG"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware } from "effect/unstable/httpapi";
|
|
3
|
+
import { ColdTranscriptRequest, EarlierTranscriptRequest, TailTranscriptRequest } from "./transcript.ts";
|
|
4
|
+
import { RunDetailView } from "./run.ts";
|
|
5
|
+
declare const OperatorHttpError_base: Schema.Class<OperatorHttpError, Schema.Struct<{
|
|
6
|
+
readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/**
|
|
10
|
+
* An operator request that could not be fulfilled. `error` preserves the domain
|
|
11
|
+
* failure's identity and `message` is safe to show to the operator; persistence
|
|
12
|
+
* details, credentials, and defect causes never travel in this envelope.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OperatorHttpError extends OperatorHttpError_base {
|
|
15
|
+
/** The existing HTTP status associated with this refusal or failure. */
|
|
16
|
+
get status(): 400 | 403 | 404 | 409 | 500 | 502 | 503;
|
|
17
|
+
}
|
|
18
|
+
declare const OperatorHttpPolicy_base: HttpApiMiddleware.ServiceClass<OperatorHttpPolicy, "@usine/orchestrator/OperatorHttpPolicy", {
|
|
19
|
+
requires: never;
|
|
20
|
+
provides: never;
|
|
21
|
+
error: Schema.decodeTo<Schema.declareConstructor<OperatorHttpError, {
|
|
22
|
+
readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}, readonly [Schema.Struct<{
|
|
25
|
+
readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
|
|
26
|
+
readonly message: Schema.String;
|
|
27
|
+
}>], {
|
|
28
|
+
readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
|
|
32
|
+
readonly message: Schema.String;
|
|
33
|
+
}>, never, never>[];
|
|
34
|
+
clientError: never;
|
|
35
|
+
requiredForClient: false;
|
|
36
|
+
security: never;
|
|
37
|
+
}, HttpApiMiddleware.HttpApiMiddleware<never, Schema.decodeTo<Schema.declareConstructor<OperatorHttpError, {
|
|
38
|
+
readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}, readonly [Schema.Struct<{
|
|
41
|
+
readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
|
|
42
|
+
readonly message: Schema.String;
|
|
43
|
+
}>], {
|
|
44
|
+
readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
|
|
45
|
+
readonly message: string;
|
|
46
|
+
}>, Schema.Struct<{
|
|
47
|
+
readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
|
|
48
|
+
readonly message: Schema.String;
|
|
49
|
+
}>, never, never>[], never>>;
|
|
50
|
+
/**
|
|
51
|
+
* Server policy for the operator transport: refuse cross-site origins before
|
|
52
|
+
* decoding or executing requests, and translate failures into operator envelopes.
|
|
53
|
+
* A server must supply this middleware; generated clients need no middleware layer.
|
|
54
|
+
*/
|
|
55
|
+
export declare class OperatorHttpPolicy extends OperatorHttpPolicy_base {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The operator's HTTP reads and interventions. Server handlers and generated
|
|
59
|
+
* clients derive URLs, request codecs, successful responses, and typed failures
|
|
60
|
+
* from this contract. Action acknowledgement means the request was accepted;
|
|
61
|
+
* subsequent observation reports execution and GitHub polling progress.
|
|
62
|
+
*
|
|
63
|
+
* This capability is platform-free (ADRs 0012 and 0020). Library consumers can
|
|
64
|
+
* continue using Operator directly without an HTTP server or client.
|
|
65
|
+
*/
|
|
66
|
+
export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.HttpApiGroup<"operator", HttpApiEndpoint.HttpApiEndpoint<"approve", "POST", "/api/runs/:runId/approve", Schema.toCodecStringTree<Schema.Struct<{
|
|
67
|
+
runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
68
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
69
|
+
readonly ok: Schema.Literal<true>;
|
|
70
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"cancel", "POST", "/api/runs/:runId/cancel", Schema.toCodecStringTree<Schema.Struct<{
|
|
71
|
+
runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
72
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
73
|
+
readonly ok: Schema.Literal<true>;
|
|
74
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"detail", "GET", "/api/runs/:runId", Schema.toCodecStringTree<Schema.Struct<{
|
|
75
|
+
runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
76
|
+
}>>, Schema.toCodecStringTree<Schema.Union<readonly [Schema.decodeTo<Schema.toType<typeof ColdTranscriptRequest>, Schema.Struct<{
|
|
77
|
+
readonly after: Schema.optionalKey<Schema.Never>;
|
|
78
|
+
readonly before: Schema.optionalKey<Schema.Never>;
|
|
79
|
+
readonly attempt: Schema.optionalKey<Schema.Never>;
|
|
80
|
+
}>, never, never>, Schema.decodeTo<Schema.toType<typeof TailTranscriptRequest>, Schema.Struct<{
|
|
81
|
+
readonly after: Schema.compose<Schema.brand<Schema.Int, "TranscriptSequence">, Schema.compose<Schema.FiniteFromString, Schema.Union<readonly [Schema.String, Schema.decodeTo<Schema.String, Schema.NonEmptyArray<Schema.String>, never, never>]>>>;
|
|
82
|
+
readonly before: Schema.optionalKey<Schema.Never>;
|
|
83
|
+
readonly attempt: Schema.optionalKey<Schema.Never>;
|
|
84
|
+
}>, never, never>, Schema.decodeTo<Schema.toType<typeof EarlierTranscriptRequest>, Schema.Struct<{
|
|
85
|
+
readonly after: Schema.optionalKey<Schema.Never>;
|
|
86
|
+
readonly before: Schema.compose<Schema.brand<Schema.Int, "TranscriptSequence">, Schema.compose<Schema.FiniteFromString, Schema.Union<readonly [Schema.String, Schema.decodeTo<Schema.String, Schema.NonEmptyArray<Schema.String>, never, never>]>>>;
|
|
87
|
+
readonly attempt: Schema.compose<Schema.brand<Schema.NonEmptyString, "AttemptId">, Schema.Union<readonly [Schema.String, Schema.decodeTo<Schema.String, Schema.NonEmptyArray<Schema.String>, never, never>]>>;
|
|
88
|
+
}>, never, never>]>>, never, never, Schema.toCodecJson<typeof RunDetailView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"moveBoardItem", "POST", "/api/projects/:owner/:repository/items/:item/lane", Schema.toCodecStringTree<Schema.Struct<{
|
|
89
|
+
owner: Schema.String;
|
|
90
|
+
repository: Schema.String;
|
|
91
|
+
item: Schema.compose<Schema.brand<Schema.Int, "ItemNumber">, Schema.FiniteFromString>;
|
|
92
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
93
|
+
readonly toLane: Schema.brand<Schema.NonEmptyString, "BoardLaneId">;
|
|
94
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
95
|
+
readonly ok: Schema.Literal<true>;
|
|
96
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"overview", "GET", "/api/overview", never, never, never, never, Schema.toCodecJson<Schema.Union<readonly [typeof import("./overview.ts").ReadyOverview, typeof import("./overview.ts").NeedsSetupOverview]>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"pause", "POST", "/api/loops/:loop/pause", Schema.toCodecStringTree<Schema.Struct<{
|
|
97
|
+
loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
98
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
99
|
+
readonly ok: Schema.Literal<true>;
|
|
100
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"resetCycleBudget", "POST", "/api/cycle-budgets/reset", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
101
|
+
readonly askId: Schema.brand<Schema.brand<Schema.NonEmptyString, "EventId">, "CycleBudgetAskId">;
|
|
102
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
103
|
+
readonly ok: Schema.Literal<true>;
|
|
104
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"retry", "POST", "/api/runs/:runId/retry", Schema.toCodecStringTree<Schema.Struct<{
|
|
105
|
+
runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
106
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
107
|
+
readonly ok: Schema.Literal<true>;
|
|
108
|
+
}>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"unpause", "POST", "/api/loops/:loop/unpause", Schema.toCodecStringTree<Schema.Struct<{
|
|
109
|
+
loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
110
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
111
|
+
readonly ok: Schema.Literal<true>;
|
|
112
|
+
}>>, never, OperatorHttpPolicy, never>, false>>;
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/operator/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,MAAM,EAAwB,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;;;;;AAyBzC;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,sBAE0C;IAC/E,wEAAwE;IACxE,IAAI,MAAM,4CAET;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUD;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,uBAGvC;CAAG;AAkEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAgDvB,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { AttemptId } from "@usine/core/attempt";
|
|
2
|
+
import { CycleBudgetAskId } from "@usine/core/cycle-budget";
|
|
3
|
+
import { ItemNumber } from "@usine/core/item";
|
|
4
|
+
import { LoopName } from "@usine/core/loop";
|
|
5
|
+
import { RunId } from "@usine/core/run";
|
|
6
|
+
import { TranscriptSequence } from "@usine/engine/transcript";
|
|
7
|
+
import { Record, Schema, SchemaTransformation } from "effect";
|
|
8
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware } from "effect/unstable/httpapi";
|
|
9
|
+
import { BoardLaneId } from "./board.js";
|
|
10
|
+
import { ColdTranscriptRequest, EarlierTranscriptRequest, TailTranscriptRequest, } from "./transcript.js";
|
|
11
|
+
import { FactoryOverview } from "./overview.js";
|
|
12
|
+
import { RunDetailView } from "./run.js";
|
|
13
|
+
const errorStatuses = {
|
|
14
|
+
SchemaError: 400,
|
|
15
|
+
InvalidRequestError: 400,
|
|
16
|
+
CrossSiteRequestError: 403,
|
|
17
|
+
RunNotFoundError: 404,
|
|
18
|
+
TranscriptAttemptNotFoundError: 404,
|
|
19
|
+
BoardProjectNotFoundError: 404,
|
|
20
|
+
BoardItemNotFoundError: 404,
|
|
21
|
+
BoardLaneNotFoundError: 404,
|
|
22
|
+
RunOperationRejectedError: 409,
|
|
23
|
+
CycleBudgetResetRejectedError: 409,
|
|
24
|
+
BoardLaneReadOnlyError: 409,
|
|
25
|
+
EnginePersistenceError: 500,
|
|
26
|
+
AttemptCancellationError: 500,
|
|
27
|
+
HttpBodyError: 500,
|
|
28
|
+
GitHubApiError: 502,
|
|
29
|
+
InvalidGitHubResponseError: 502,
|
|
30
|
+
BackendUnavailableError: 503,
|
|
31
|
+
InstallationDiscoveryError: 503,
|
|
32
|
+
AppPermissionError: 503,
|
|
33
|
+
GitHubRateLimitError: 503,
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* An operator request that could not be fulfilled. `error` preserves the domain
|
|
37
|
+
* failure's identity and `message` is safe to show to the operator; persistence
|
|
38
|
+
* details, credentials, and defect causes never travel in this envelope.
|
|
39
|
+
*/
|
|
40
|
+
export class OperatorHttpError extends Schema.Error("@usine/orchestrator/OperatorHttpError")({ error: Schema.Literals(Record.keys(errorStatuses)), message: Schema.String }) {
|
|
41
|
+
/** The existing HTTP status associated with this refusal or failure. */
|
|
42
|
+
get status() {
|
|
43
|
+
return errorStatuses[this.error];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// The established envelope uses `error` as its discriminator. Schema.Error keeps
|
|
47
|
+
// that wire shape while giving browser callers an Error with a validated identity.
|
|
48
|
+
const errors = [...new Set(Object.values(errorStatuses))].map((status) => OperatorHttpError.check(Schema.makeFilter((error) => error.status === status)).annotate({
|
|
49
|
+
httpApiStatus: status,
|
|
50
|
+
}));
|
|
51
|
+
/**
|
|
52
|
+
* Server policy for the operator transport: refuse cross-site origins before
|
|
53
|
+
* decoding or executing requests, and translate failures into operator envelopes.
|
|
54
|
+
* A server must supply this middleware; generated clients need no middleware layer.
|
|
55
|
+
*/
|
|
56
|
+
export class OperatorHttpPolicy extends HttpApiMiddleware.Service()("@usine/orchestrator/OperatorHttpPolicy", { error: errors }) {
|
|
57
|
+
}
|
|
58
|
+
const absent = Schema.optionalKey(Schema.Never);
|
|
59
|
+
// URLSearchParams.get previously selected the first occurrence of a query key.
|
|
60
|
+
// Preserve that convention when HttpApi supplies repeated keys as arrays.
|
|
61
|
+
const queryValue = Schema.Union([
|
|
62
|
+
Schema.String,
|
|
63
|
+
Schema.NonEmptyArray(Schema.String).pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
|
|
64
|
+
decode: (values) => values[0],
|
|
65
|
+
encode: (value) => [value],
|
|
66
|
+
}))),
|
|
67
|
+
]);
|
|
68
|
+
const sequence = queryValue.pipe(Schema.decodeTo(Schema.FiniteFromString), Schema.decodeTo(TranscriptSequence));
|
|
69
|
+
// Each wire variant rules out the other cursors before decoding into the existing
|
|
70
|
+
// domain request. Unknown search keys remain ignored, as in the original API.
|
|
71
|
+
const transcriptQuery = Schema.Union([
|
|
72
|
+
Schema.Struct({ after: absent, before: absent, attempt: absent }).pipe(Schema.decodeTo(Schema.toType(ColdTranscriptRequest), SchemaTransformation.transform({
|
|
73
|
+
decode: () => new ColdTranscriptRequest(),
|
|
74
|
+
encode: () => ({}),
|
|
75
|
+
}))),
|
|
76
|
+
Schema.Struct({ after: sequence, before: absent, attempt: absent }).pipe(Schema.decodeTo(Schema.toType(TailTranscriptRequest), SchemaTransformation.transform({
|
|
77
|
+
decode: ({ after }) => new TailTranscriptRequest({ after }),
|
|
78
|
+
encode: ({ after }) => ({ after }),
|
|
79
|
+
}))),
|
|
80
|
+
Schema.Struct({
|
|
81
|
+
after: absent,
|
|
82
|
+
before: sequence,
|
|
83
|
+
attempt: queryValue.pipe(Schema.decodeTo(AttemptId)),
|
|
84
|
+
}).pipe(Schema.decodeTo(Schema.toType(EarlierTranscriptRequest), SchemaTransformation.transform({
|
|
85
|
+
decode: ({ before, attempt }) => new EarlierTranscriptRequest({ before, attemptId: attempt }),
|
|
86
|
+
encode: ({ before, attemptId }) => ({ before, attempt: attemptId }),
|
|
87
|
+
}))),
|
|
88
|
+
]);
|
|
89
|
+
const repositoryPart = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_.-]+$/u, { message: "Expected a repository path segment" }));
|
|
90
|
+
const acknowledged = Schema.Struct({ ok: Schema.Literal(true) });
|
|
91
|
+
const runParams = { runId: RunId };
|
|
92
|
+
const loopParams = { loop: LoopName };
|
|
93
|
+
/**
|
|
94
|
+
* The operator's HTTP reads and interventions. Server handlers and generated
|
|
95
|
+
* clients derive URLs, request codecs, successful responses, and typed failures
|
|
96
|
+
* from this contract. Action acknowledgement means the request was accepted;
|
|
97
|
+
* subsequent observation reports execution and GitHub polling progress.
|
|
98
|
+
*
|
|
99
|
+
* This capability is platform-free (ADRs 0012 and 0020). Library consumers can
|
|
100
|
+
* continue using Operator directly without an HTTP server or client.
|
|
101
|
+
*/
|
|
102
|
+
export const OperatorApi = HttpApi.make("OperatorApi").add(HttpApiGroup.make("operator")
|
|
103
|
+
.add(HttpApiEndpoint.get("overview", "/api/overview", { success: FactoryOverview }), HttpApiEndpoint.post("resetCycleBudget", "/api/cycle-budgets/reset", {
|
|
104
|
+
payload: Schema.Struct({ askId: CycleBudgetAskId }).annotate({
|
|
105
|
+
parseOptions: { onExcessProperty: "error" },
|
|
106
|
+
}),
|
|
107
|
+
success: acknowledged,
|
|
108
|
+
}), HttpApiEndpoint.get("detail", "/api/runs/:runId", {
|
|
109
|
+
params: runParams,
|
|
110
|
+
query: transcriptQuery,
|
|
111
|
+
success: RunDetailView,
|
|
112
|
+
}), HttpApiEndpoint.post("approve", "/api/runs/:runId/approve", {
|
|
113
|
+
params: runParams,
|
|
114
|
+
success: acknowledged,
|
|
115
|
+
}), HttpApiEndpoint.post("retry", "/api/runs/:runId/retry", {
|
|
116
|
+
params: runParams,
|
|
117
|
+
success: acknowledged,
|
|
118
|
+
}), HttpApiEndpoint.post("cancel", "/api/runs/:runId/cancel", {
|
|
119
|
+
params: runParams,
|
|
120
|
+
success: acknowledged,
|
|
121
|
+
}), HttpApiEndpoint.post("moveBoardItem", "/api/projects/:owner/:repository/items/:item/lane", {
|
|
122
|
+
params: {
|
|
123
|
+
owner: repositoryPart,
|
|
124
|
+
repository: repositoryPart,
|
|
125
|
+
item: Schema.FiniteFromString.pipe(Schema.decodeTo(ItemNumber)),
|
|
126
|
+
},
|
|
127
|
+
payload: Schema.Struct({ toLane: BoardLaneId }).annotate({
|
|
128
|
+
parseOptions: { onExcessProperty: "error" },
|
|
129
|
+
}),
|
|
130
|
+
success: acknowledged,
|
|
131
|
+
}), HttpApiEndpoint.post("pause", "/api/loops/:loop/pause", {
|
|
132
|
+
params: loopParams,
|
|
133
|
+
success: acknowledged,
|
|
134
|
+
}), HttpApiEndpoint.post("unpause", "/api/loops/:loop/unpause", {
|
|
135
|
+
params: loopParams,
|
|
136
|
+
success: acknowledged,
|
|
137
|
+
}))
|
|
138
|
+
.middleware(OperatorHttpPolicy));
|
|
139
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/operator/http.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AE,UAAU;IAClB,OAAO,EAAE,YAAY;CACtB,CAAC,EACF,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE;IAC1D,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,YAAY;CACtB,CAAC,CACH;KACA,UAAU,CAAC,kBAAkB,CAAC,CAClC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CycleBudgetAsk } from "@usine/core/cycle-budget";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { LabelPreflightFinding } from "../label-reconciler.ts";
|
|
4
|
+
import { RepositoryPollFailure } from "../polling-triggers.ts";
|
|
5
|
+
import { BoardProjectionError } from "./board.ts";
|
|
6
|
+
declare const ApprovalNeed_base: Schema.Class<ApprovalNeed, Schema.TaggedStruct<"ApprovalNeed", {
|
|
7
|
+
readonly id: Schema.String;
|
|
8
|
+
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
9
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
10
|
+
readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
11
|
+
}>, {}>;
|
|
12
|
+
/** An operator approval is required before this Run can proceed. */
|
|
13
|
+
export declare class ApprovalNeed extends ApprovalNeed_base {
|
|
14
|
+
}
|
|
15
|
+
declare const RunFailureNeed_base: Schema.Class<RunFailureNeed, Schema.TaggedStruct<"RunFailureNeed", {
|
|
16
|
+
readonly id: Schema.String;
|
|
17
|
+
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
18
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
19
|
+
readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
20
|
+
readonly failure: Schema.Union<readonly [typeof import("./attempt.ts").InfraFailureView, typeof import("./attempt.ts").DefectFailureView, typeof import("./attempt.ts").AgentFailureView, typeof import("./attempt.ts").RunawayFailureView, typeof import("./attempt.ts").ChildSessionBudgetFailureView]>;
|
|
21
|
+
}>, {}>;
|
|
22
|
+
/** A failed Run requires an operator decision, with its displayable failure details. */
|
|
23
|
+
export declare class RunFailureNeed extends RunFailureNeed_base {
|
|
24
|
+
}
|
|
25
|
+
declare const PollFailureNeed_base: Schema.Class<PollFailureNeed, Schema.TaggedStruct<"PollFailureNeed", {
|
|
26
|
+
readonly id: Schema.String;
|
|
27
|
+
readonly failure: typeof RepositoryPollFailure;
|
|
28
|
+
}>, {}>;
|
|
29
|
+
/** Repository polling failed and needs operator attention. */
|
|
30
|
+
export declare class PollFailureNeed extends PollFailureNeed_base {
|
|
31
|
+
}
|
|
32
|
+
declare const PreflightFindingNeed_base: Schema.Class<PreflightFindingNeed, Schema.TaggedStruct<"PreflightFindingNeed", {
|
|
33
|
+
readonly id: Schema.String;
|
|
34
|
+
readonly finding: typeof LabelPreflightFinding;
|
|
35
|
+
}>, {}>;
|
|
36
|
+
/** A declared repository label could not be provisioned or confirmed. */
|
|
37
|
+
export declare class PreflightFindingNeed extends PreflightFindingNeed_base {
|
|
38
|
+
}
|
|
39
|
+
declare const BoardProjectionNeed_base: Schema.Class<BoardProjectionNeed, Schema.TaggedStruct<"BoardProjectionNeed", {
|
|
40
|
+
readonly id: Schema.String;
|
|
41
|
+
readonly failure: typeof BoardProjectionError;
|
|
42
|
+
}>, {}>;
|
|
43
|
+
/** An Item could not be displayed on its Board and needs operator attention. */
|
|
44
|
+
export declare class BoardProjectionNeed extends BoardProjectionNeed_base {
|
|
45
|
+
}
|
|
46
|
+
declare const ScheduleFailureNeed_base: Schema.Class<ScheduleFailureNeed, Schema.TaggedStruct<"ScheduleFailureNeed", {
|
|
47
|
+
readonly id: Schema.String;
|
|
48
|
+
readonly failure: Schema.Union<readonly [typeof import("../schedule-triggers.ts").ScheduleAgentFailure, typeof import("../schedule-triggers.ts").ScheduleCronFailure, typeof import("../schedule-triggers.ts").ScheduleTickFailure]>;
|
|
49
|
+
}>, {}>;
|
|
50
|
+
/** A scheduled Loop could not evaluate or submit its work. */
|
|
51
|
+
export declare class ScheduleFailureNeed extends ScheduleFailureNeed_base {
|
|
52
|
+
}
|
|
53
|
+
declare const CycleBudgetNeed_base: Schema.Class<CycleBudgetNeed, Schema.TaggedStruct<"CycleBudgetNeed", {
|
|
54
|
+
readonly id: Schema.String;
|
|
55
|
+
readonly ask: typeof CycleBudgetAsk;
|
|
56
|
+
readonly itemLabel: Schema.String;
|
|
57
|
+
readonly itemUrl: Schema.NullOr<Schema.String>;
|
|
58
|
+
}>, {}>;
|
|
59
|
+
/** An Item stopped opening Runs and requires an explicit reset of its shared cycle budget. */
|
|
60
|
+
export declare class CycleBudgetNeed extends CycleBudgetNeed_base {
|
|
61
|
+
}
|
|
62
|
+
/** One reason the factory asks for operator attention in the overview. */
|
|
63
|
+
export declare const NeedView: Schema.Union<readonly [typeof CycleBudgetNeed, typeof ApprovalNeed, typeof BoardProjectionNeed, typeof RunFailureNeed, typeof PollFailureNeed, typeof PreflightFindingNeed, typeof ScheduleFailureNeed]>;
|
|
64
|
+
export type NeedView = typeof NeedView.Type;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=need.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"need.d.ts","sourceRoot":"","sources":["../../src/operator/need.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;;;;;;;AAElD,oEAAoE;AACpE,qBAAa,YAAa,SAAQ,iBAOhC;CAAG;;;;;;;;AAEL,wFAAwF;AACxF,qBAAa,cAAe,SAAQ,mBAQlC;CAAG;;;;;AAEL,8DAA8D;AAC9D,qBAAa,eAAgB,SAAQ,oBAKnC;CAAG;;;;;AAEL,yEAAyE;AACzE,qBAAa,oBAAqB,SAAQ,yBAKxC;CAAG;;;;;AAEL,gFAAgF;AAChF,qBAAa,mBAAoB,SAAQ,wBAKvC;CAAG;;;;;AAEL,8DAA8D;AAC9D,qBAAa,mBAAoB,SAAQ,wBAKvC;CAAG;;;;;;;AAEL,8FAA8F;AAC9F,qBAAa,eAAgB,SAAQ,oBAQpC;CAAG;AAEJ,0EAA0E;AAC1E,eAAO,MAAM,QAAQ,0MAQnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { LoopName } from "@usine/core/loop";
|
|
2
|
+
import { CycleBudgetAsk } from "@usine/core/cycle-budget";
|
|
3
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
4
|
+
import { RunId } from "@usine/core/run";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
import { LabelPreflightFinding } from "../label-reconciler.js";
|
|
7
|
+
import { RepositoryPollFailure } from "../polling-triggers.js";
|
|
8
|
+
import { ScheduleFailure } from "../schedule-triggers.js";
|
|
9
|
+
import { FailureView } from "./attempt.js";
|
|
10
|
+
import { BoardProjectionError } from "./board.js";
|
|
11
|
+
/** An operator approval is required before this Run can proceed. */
|
|
12
|
+
export class ApprovalNeed extends Schema.TaggedClass("@usine/orchestrator/ApprovalNeed")("ApprovalNeed", {
|
|
13
|
+
id: Schema.String,
|
|
14
|
+
repository: RepositoryName,
|
|
15
|
+
runId: RunId,
|
|
16
|
+
loop: LoopName,
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
/** A failed Run requires an operator decision, with its displayable failure details. */
|
|
20
|
+
export class RunFailureNeed extends Schema.TaggedClass("@usine/orchestrator/RunFailureNeed")("RunFailureNeed", {
|
|
21
|
+
id: Schema.String,
|
|
22
|
+
repository: RepositoryName,
|
|
23
|
+
runId: RunId,
|
|
24
|
+
loop: LoopName,
|
|
25
|
+
failure: FailureView,
|
|
26
|
+
}) {
|
|
27
|
+
}
|
|
28
|
+
/** Repository polling failed and needs operator attention. */
|
|
29
|
+
export class PollFailureNeed extends Schema.TaggedClass("@usine/orchestrator/PollFailureNeed")("PollFailureNeed", {
|
|
30
|
+
id: Schema.String,
|
|
31
|
+
failure: RepositoryPollFailure,
|
|
32
|
+
}) {
|
|
33
|
+
}
|
|
34
|
+
/** A declared repository label could not be provisioned or confirmed. */
|
|
35
|
+
export class PreflightFindingNeed extends Schema.TaggedClass("@usine/orchestrator/PreflightFindingNeed")("PreflightFindingNeed", {
|
|
36
|
+
id: Schema.String,
|
|
37
|
+
finding: LabelPreflightFinding,
|
|
38
|
+
}) {
|
|
39
|
+
}
|
|
40
|
+
/** An Item could not be displayed on its Board and needs operator attention. */
|
|
41
|
+
export class BoardProjectionNeed extends Schema.TaggedClass("@usine/orchestrator/BoardProjectionNeed")("BoardProjectionNeed", {
|
|
42
|
+
id: Schema.String,
|
|
43
|
+
failure: BoardProjectionError,
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
/** A scheduled Loop could not evaluate or submit its work. */
|
|
47
|
+
export class ScheduleFailureNeed extends Schema.TaggedClass("@usine/orchestrator/ScheduleFailureNeed")("ScheduleFailureNeed", {
|
|
48
|
+
id: Schema.String,
|
|
49
|
+
failure: ScheduleFailure,
|
|
50
|
+
}) {
|
|
51
|
+
}
|
|
52
|
+
/** An Item stopped opening Runs and requires an explicit reset of its shared cycle budget. */
|
|
53
|
+
export class CycleBudgetNeed extends Schema.TaggedClass("CycleBudgetNeed")("CycleBudgetNeed", {
|
|
54
|
+
id: Schema.String,
|
|
55
|
+
ask: CycleBudgetAsk,
|
|
56
|
+
itemLabel: Schema.String,
|
|
57
|
+
itemUrl: Schema.NullOr(Schema.String),
|
|
58
|
+
}) {
|
|
59
|
+
}
|
|
60
|
+
/** One reason the factory asks for operator attention in the overview. */
|
|
61
|
+
export const NeedView = Schema.Union([
|
|
62
|
+
CycleBudgetNeed,
|
|
63
|
+
ApprovalNeed,
|
|
64
|
+
BoardProjectionNeed,
|
|
65
|
+
RunFailureNeed,
|
|
66
|
+
PollFailureNeed,
|
|
67
|
+
PreflightFindingNeed,
|
|
68
|
+
ScheduleFailureNeed,
|
|
69
|
+
]);
|
|
70
|
+
//# sourceMappingURL=need.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"need.js","sourceRoot":"","sources":["../../src/operator/need.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,oEAAoE;AACpE,MAAM,OAAO,YAAa,SAAQ,MAAM,CAAC,WAAW,CAClD,kCAAkC,CACnC,CAAC,cAAc,EAAE;IAChB,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,QAAQ;CACf,CAAC;CAAG;AAEL,wFAAwF;AACxF,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,CACpD,oCAAoC,CACrC,CAAC,gBAAgB,EAAE;IAClB,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,UAAU,EAAE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;IACf,YAAY;IACZ,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,mBAAmB;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LoadedInstance } from "@usine/config/instance";
|
|
2
|
+
import { CycleBudgetAskId } from "@usine/core/cycle-budget";
|
|
3
|
+
import { CycleBudgets, type CycleBudgetResetRejectedError } from "@usine/engine/cycle-budget";
|
|
4
|
+
import { LoopName } from "@usine/core/loop";
|
|
5
|
+
import { RunId } from "@usine/core/run";
|
|
6
|
+
import { RunEngine, type EnginePersistenceError, type RunEngineError, type RunStoreError } from "@usine/engine/engine";
|
|
7
|
+
import { ItemProjectionReader } from "@usine/engine/item-projection";
|
|
8
|
+
import { LoopControl, type LoopRuntimeState } from "@usine/engine/loop-control";
|
|
9
|
+
import { RunReader } from "@usine/engine/run-reader";
|
|
10
|
+
import { RepositoryLabelProjectionReader } from "@usine/engine/repository-label-projection";
|
|
11
|
+
import { GitHubItemWriter } from "@usine/github/item-writer";
|
|
12
|
+
import type { GitHubAppError } from "@usine/github/github-app";
|
|
13
|
+
import { Context, Effect, Layer } from "effect";
|
|
14
|
+
import { PollingTriggers } from "../polling-triggers.ts";
|
|
15
|
+
import { ScheduleTriggers } from "../schedule-triggers.ts";
|
|
16
|
+
import { type BoardItemNotFoundError, type BoardLaneNotFoundError, type BoardLaneReadOnlyError, type BoardMove, type BoardProjectNotFoundError } from "./board.ts";
|
|
17
|
+
import { type TranscriptAttemptNotFoundError, type TranscriptRequest } from "./transcript.ts";
|
|
18
|
+
import { ReadyOverview } from "./overview.ts";
|
|
19
|
+
import { RunDetailView } from "./run.ts";
|
|
20
|
+
export type BoardMoveError = BoardItemNotFoundError | BoardLaneNotFoundError | BoardLaneReadOnlyError | BoardProjectNotFoundError | EnginePersistenceError | GitHubAppError;
|
|
21
|
+
export type OperatorError = RunEngineError | TranscriptAttemptNotFoundError | BoardMoveError | CycleBudgetResetRejectedError;
|
|
22
|
+
export type OperatorObservationError = RunStoreError | TranscriptAttemptNotFoundError;
|
|
23
|
+
declare const OperatorObservation_base: Context.ServiceClass<OperatorObservation, "@usine/orchestrator/OperatorObservation", {
|
|
24
|
+
/** Builds the supplied instance's Projects, Boards, Runs, and items needing operator attention. */
|
|
25
|
+
readonly overview: (instance: LoadedInstance) => Effect.Effect<ReadyOverview, OperatorObservationError>;
|
|
26
|
+
/** Reads one Run and a bounded transcript page; `request` selects the latest, newer, or earlier activity. */
|
|
27
|
+
readonly detail: (runId: RunId, request?: TranscriptRequest) => Effect.Effect<RunDetailView, OperatorObservationError>;
|
|
28
|
+
}>;
|
|
29
|
+
/** The read-only operator surface. It needs no trigger execution to build. */
|
|
30
|
+
export declare class OperatorObservation extends OperatorObservation_base {
|
|
31
|
+
static readonly layer: Layer.Layer<OperatorObservation, never, CycleBudgets | ItemProjectionReader | LoopControl | PollingTriggers | RepositoryLabelProjectionReader | RunReader | ScheduleTriggers>;
|
|
32
|
+
}
|
|
33
|
+
declare const Operator_base: Context.ServiceClass<Operator, "@usine/orchestrator/Operator", {
|
|
34
|
+
/** Builds the supplied instance's Projects, Boards, Runs, and items needing operator attention. */
|
|
35
|
+
readonly overview: (instance: LoadedInstance) => Effect.Effect<ReadyOverview, OperatorObservationError>;
|
|
36
|
+
/** Reads one Run and a bounded transcript page; `request` selects the latest, newer, or earlier activity. */
|
|
37
|
+
readonly detail: (runId: RunId, request?: TranscriptRequest) => Effect.Effect<RunDetailView, OperatorObservationError>;
|
|
38
|
+
} & {
|
|
39
|
+
/** Answers the Item's current cycle Ask; polling refreshes its state before more Runs open. */
|
|
40
|
+
readonly resetCycleBudget: (askId: CycleBudgetAskId) => Effect.Effect<void, OperatorError>;
|
|
41
|
+
/** Records approval for a waiting Run; execution still waits for Worker capacity. */
|
|
42
|
+
readonly approve: (runId: RunId) => Effect.Effect<void, OperatorError>;
|
|
43
|
+
/** Requests a new Attempt for a failed Run using its effective task and Agent. */
|
|
44
|
+
readonly retry: (runId: RunId) => Effect.Effect<void, OperatorError>;
|
|
45
|
+
/** Cancels an open Run and interrupts its current Attempt; an already closed Run is unchanged. */
|
|
46
|
+
readonly cancel: (runId: RunId) => Effect.Effect<void, OperatorError>;
|
|
47
|
+
/** Swaps lane labels on GitHub and hints an authoritative refresh of its Board position and Loop matches. */
|
|
48
|
+
readonly moveBoardItem: (instance: LoadedInstance, move: BoardMove) => Effect.Effect<void, BoardMoveError>;
|
|
49
|
+
/** Pauses new work for a Loop while its existing Runs continue. */
|
|
50
|
+
readonly pause: (loop: LoopName) => Effect.Effect<LoopRuntimeState, EnginePersistenceError>;
|
|
51
|
+
/** Allows the Loop's triggers to open new Runs again. */
|
|
52
|
+
readonly unpause: (loop: LoopName) => Effect.Effect<LoopRuntimeState, EnginePersistenceError>;
|
|
53
|
+
}>;
|
|
54
|
+
/** The operator's view of the factory and actions for approving, retrying, canceling, and directing work. */
|
|
55
|
+
export declare class Operator extends Operator_base {
|
|
56
|
+
static readonly layer: Layer.Layer<Operator, never, CycleBudgets | GitHubItemWriter | ItemProjectionReader | LoopControl | PollingTriggers | RepositoryLabelProjectionReader | RunEngine | RunReader | ScheduleTriggers>;
|
|
57
|
+
}
|
|
58
|
+
export { ProjectStatus, ProjectView, LoopView, ReadyOverview, NeedsSetupOverview, FactoryOverview, } from "./overview.ts";
|
|
59
|
+
export { RunStateTag, RunView, RunDetailView } from "./run.ts";
|
|
60
|
+
export { InfraFailureView, DefectFailureView, AgentFailureView, RunawayFailureView, ChildSessionBudgetFailureView, FailureView, SucceededAttemptView, FailedAttemptView, CanceledAttemptView, AttemptOutcomeView, AttemptView, } from "./attempt.ts";
|
|
61
|
+
export { BoardLaneId, BoardLaneOrigin, BoardItemLink, BoardTaskView, WritableBoardLaneView, ReadOnlyBoardLaneView, BoardLaneView, BoardProjectionError, BoardView, LabelView, BoardMove, BoardProjectNotFoundError, BoardItemNotFoundError, BoardLaneNotFoundError, BoardLaneReadOnlyError, } from "./board.ts";
|
|
62
|
+
export { ApprovalNeed, CycleBudgetNeed, RunFailureNeed, PollFailureNeed, PreflightFindingNeed, BoardProjectionNeed, ScheduleFailureNeed, NeedView, } from "./need.ts";
|
|
63
|
+
export { FailedTranscriptView, TranscriptPayload, TranscriptEventView, TranscriptPageCursor, ColdTranscriptRequest, TailTranscriptRequest, EarlierTranscriptRequest, TranscriptRequest, TranscriptAttemptNotFoundError, } from "./transcript.ts";
|
|
64
|
+
//# sourceMappingURL=operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../src/operator/operator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,KAAK,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EAEnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAA2B,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAY,MAAM,EAAQ,KAAK,EAAmC,MAAM,QAAQ,CAAC;AAGjG,OAAO,EAAiB,eA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