@usine/orchestrator 0.1.0 → 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 +44 -21
- 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 +6 -5
- package/dist/board/projection.d.ts.map +1 -1
- package/dist/board/projection.js +25 -65
- package/dist/board/projection.js.map +1 -1
- 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 +6 -6
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +6 -6
- package/dist/credentials.js.map +1 -1
- package/dist/exe-dev.d.ts +5 -4
- package/dist/exe-dev.d.ts.map +1 -1
- package/dist/exe-dev.js +5 -4
- package/dist/exe-dev.js.map +1 -1
- package/dist/idle-triggers.d.ts +1 -1
- package/dist/idle-triggers.d.ts.map +1 -1
- package/dist/idle-triggers.js +3 -1
- package/dist/idle-triggers.js.map +1 -1
- 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 +17 -12
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +20 -13
- package/dist/local.js.map +1 -1
- 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/{service.js → operator.js} +147 -32
- 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 +9 -9
- package/dist/operator/projection.d.ts.map +1 -1
- package/dist/operator/projection.js +18 -10
- package/dist/operator/projection.js.map +1 -1
- 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 +3 -2
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +1 -1
- package/dist/orchestrator.js.map +1 -1
- 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 +3 -39
- package/dist/polling-triggers.d.ts.map +1 -1
- package/dist/polling-triggers.js +3 -393
- package/dist/polling-triggers.js.map +1 -1
- package/dist/schedule-triggers.d.ts +17 -15
- package/dist/schedule-triggers.d.ts.map +1 -1
- package/dist/schedule-triggers.js +53 -43
- package/dist/schedule-triggers.js.map +1 -1
- package/dist/scheduler.d.ts +5 -5
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +28 -43
- package/dist/scheduler.js.map +1 -1
- package/dist/trigger-submission.d.ts +33 -24
- package/dist/trigger-submission.d.ts.map +1 -1
- package/dist/trigger-submission.js +32 -29
- package/dist/trigger-submission.js.map +1 -1
- package/package.json +50 -14
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/operator/model.d.ts +0 -280
- package/dist/operator/model.d.ts.map +0 -1
- package/dist/operator/model.js +0 -242
- package/dist/operator/model.js.map +0 -1
- package/dist/operator/service.d.ts +0 -36
- package/dist/operator/service.d.ts.map +0 -1
- package/dist/operator/service.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AttemptFailure
|
|
2
|
-
import {
|
|
1
|
+
import { AttemptFailure } from "@usine/core/attempt/failure";
|
|
2
|
+
import { LoopName } from "@usine/core/loop";
|
|
3
|
+
import { type RunSnapshot, type RunSummary, RunReader } from "@usine/engine/run-reader";
|
|
4
|
+
import type { RunStoreError } from "@usine/engine/engine";
|
|
3
5
|
import { Effect } from "effect";
|
|
4
|
-
import { type FailureView
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const failureView: (failure: AttemptFailure.AttemptFailure) => FailureView;
|
|
10
|
-
export declare const runView: (snapshot: RunSummary, pausedLoops: ReadonlySet<Loop.LoopName>) => RunView;
|
|
6
|
+
import { type FailureView } from "./attempt.ts";
|
|
7
|
+
import { type TranscriptRequest, TranscriptAttemptNotFoundError, TranscriptPageCursor, TranscriptEventView } from "./transcript.ts";
|
|
8
|
+
import { RunView } from "./run.ts";
|
|
9
|
+
export declare const failureView: (failure: AttemptFailure) => FailureView;
|
|
10
|
+
export declare const runView: (snapshot: RunSummary, pausedLoops: ReadonlySet<LoopName>) => RunView;
|
|
11
11
|
interface TranscriptRead {
|
|
12
12
|
readonly events: ReadonlyArray<TranscriptEventView>;
|
|
13
13
|
readonly earlier: ReadonlyArray<TranscriptPageCursor>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/operator/projection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/operator/projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EAAY,MAAM,EAAiB,MAAM,QAAQ,CAAC;AACzD,OAAO,EAOL,KAAK,WAAW,EAIjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,iBAAiB,EACtB,8BAA8B,EAC9B,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAOnC,eAAO,MAAM,WAAW,YAAa,cAAc,KAAG,WAQlD,CAAC;AAuBL,eAAO,MAAM,OAAO,aAAc,UAAU,eAAe,WAAW,CAAC,QAAQ,CAAC,KAAG,OAoBlF,CAAC;AAwBF,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACvD;AAyCD,eAAO,MAAM,cAAc,EAAE,CAC3B,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EAC1B,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,iBAAiB,KACvB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,aAAa,GAAG,8BAA8B,CAgD/E,CAAC"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
2
|
+
import { AttemptFailure } from "@usine/core/attempt/failure";
|
|
3
|
+
import { AttemptOutcome } from "@usine/core/attempt/outcome";
|
|
4
|
+
import { LoopName } from "@usine/core/loop";
|
|
5
|
+
import * as RunState from "@usine/core/run/state";
|
|
6
|
+
import { PullRequest } from "@usine/core/step/result";
|
|
7
|
+
import { RunReader } from "@usine/engine/run-reader";
|
|
8
|
+
import { TranscriptPageQuery, TranscriptTailQuery, } from "@usine/engine/transcript";
|
|
3
9
|
import { DateTime, Effect, Match, Option } from "effect";
|
|
4
|
-
import { AgentFailureView, AttemptView, CanceledAttemptView,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
10
|
+
import { AgentFailureView, AttemptView, CanceledAttemptView, ChildSessionBudgetFailureView, DefectFailureView, FailedAttemptView, InfraFailureView, RunawayFailureView, SucceededAttemptView, } from "./attempt.js";
|
|
11
|
+
import { FailedTranscriptView, TranscriptAttemptNotFoundError, TranscriptPageCursor, TranscriptEventView, } from "./transcript.js";
|
|
12
|
+
import { RunView } from "./run.js";
|
|
13
|
+
/** How many newest rows one cold drawer open loads per Attempt. */
|
|
14
|
+
const COLD_TRANSCRIPT_LIMIT = 500;
|
|
15
|
+
/** The row cap for one live catch-up response across all Attempts. */
|
|
16
|
+
const TAIL_TRANSCRIPT_LIMIT = 500;
|
|
9
17
|
export const failureView = (failure) => Match.valueTags(failure, {
|
|
10
18
|
InfraFailure: ({ message }) => new InfraFailureView({ message }),
|
|
19
|
+
DefectFailure: ({ message }) => new DefectFailureView({ message }),
|
|
11
20
|
AgentFailure: ({ message }) => new AgentFailureView({ message }),
|
|
12
21
|
RunawayFailure: ({ ceiling }) => new RunawayFailureView({ ceiling }),
|
|
22
|
+
ChildSessionBudgetFailure: ({ attemptedChildren, maxChildren }) => new ChildSessionBudgetFailureView({ attemptedChildren, maxChildren }),
|
|
13
23
|
});
|
|
14
24
|
const attemptOutcomeView = (outcome) => Match.valueTags(outcome, {
|
|
15
25
|
Succeeded: () => new SucceededAttemptView(),
|
|
@@ -45,9 +55,7 @@ export const runView = (snapshot, pausedLoops) => {
|
|
|
45
55
|
attempts: snapshot.attempts.map(attemptView),
|
|
46
56
|
resultMessage: result?.message ?? null,
|
|
47
57
|
pullRequestUrl: pullRequest?.url.toString() ?? null,
|
|
48
|
-
|
|
49
|
-
canRetry: snapshot.run.state._tag === "Failed",
|
|
50
|
-
canCancel: RunState.isOpen(snapshot.run.state),
|
|
58
|
+
...RunState.operatorActions(snapshot.run.state),
|
|
51
59
|
});
|
|
52
60
|
};
|
|
53
61
|
const transcriptPayload = (payload) => Match.valueTags(payload, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/operator/projection.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/operator/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ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,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACnF,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,CAAC;KACF,CAAC,CAAC;IACH,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,EAAE;QACjD,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;QAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;KAC7B,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { AttemptView } from "./attempt.ts";
|
|
3
|
+
import { TranscriptEventView, TranscriptPageCursor } from "./transcript.ts";
|
|
4
|
+
/** The persisted Run lifecycle state as exposed in operator views. */
|
|
5
|
+
export declare const RunStateTag: Schema.Literals<readonly ["Pending", "Waiting", "Queued", "Running", "Succeeded", "Failed", "Canceled"]>;
|
|
6
|
+
export type RunStateTag = typeof RunStateTag.Type;
|
|
7
|
+
declare const RunView_base: Schema.Class<RunView, Schema.Struct<{
|
|
8
|
+
readonly id: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
9
|
+
readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
|
|
10
|
+
readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
11
|
+
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
12
|
+
readonly agent: Schema.brand<Schema.String, "AgentName">;
|
|
13
|
+
readonly state: Schema.Literals<readonly ["Pending", "Waiting", "Queued", "Running", "Succeeded", "Failed", "Canceled"]>;
|
|
14
|
+
readonly loopPaused: Schema.Boolean;
|
|
15
|
+
readonly openedAt: Schema.String;
|
|
16
|
+
readonly task: Schema.String;
|
|
17
|
+
readonly attempts: Schema.$Array<typeof AttemptView>;
|
|
18
|
+
readonly resultMessage: Schema.NullOr<Schema.String>;
|
|
19
|
+
readonly pullRequestUrl: Schema.NullOr<Schema.String>;
|
|
20
|
+
readonly canApprove: Schema.Boolean;
|
|
21
|
+
readonly canRetry: Schema.Boolean;
|
|
22
|
+
readonly canCancel: Schema.Boolean;
|
|
23
|
+
}>, {}>;
|
|
24
|
+
/** A Run summary with its Attempts, result links, and currently available operator actions. */
|
|
25
|
+
export declare class RunView extends RunView_base {
|
|
26
|
+
}
|
|
27
|
+
declare const RunDetailView_base: Schema.Class<RunDetailView, Schema.Struct<{
|
|
28
|
+
readonly run: typeof RunView;
|
|
29
|
+
readonly eventDedupKey: Schema.String;
|
|
30
|
+
readonly eventPayload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
31
|
+
readonly transcript: Schema.$Array<typeof TranscriptEventView>;
|
|
32
|
+
readonly earlierTranscript: Schema.$Array<typeof TranscriptPageCursor>;
|
|
33
|
+
}>, {}>;
|
|
34
|
+
/** A Run summary with its triggering Event payload and a bounded portion of its transcript. */
|
|
35
|
+
export declare class RunDetailView extends RunDetailView_base {
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/operator/run.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,sEAAsE;AACtE,eAAO,MAAM,WAAW,0GAAuC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;AAIlD,+FAA+F;AAC/F,qBAAa,OAAQ,SAAQ,YAgB3B;CAAG;;;;;;;;AAEL,+FAA+F;AAC/F,qBAAa,aAAc,SAAQ,kBAQlC;CAAG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AgentName } from "@usine/core/agent";
|
|
2
|
+
import { ItemKey } from "@usine/core/item";
|
|
3
|
+
import { LoopName } from "@usine/core/loop";
|
|
4
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
5
|
+
import { RunId } from "@usine/core/run";
|
|
6
|
+
import * as RunState from "@usine/core/run/state";
|
|
7
|
+
import { Schema } from "effect";
|
|
8
|
+
import { AttemptView } from "./attempt.js";
|
|
9
|
+
import { TranscriptEventView, TranscriptPageCursor } from "./transcript.js";
|
|
10
|
+
/** The persisted Run lifecycle state as exposed in operator views. */
|
|
11
|
+
export const RunStateTag = Schema.Literals(RunState.STATE_TAGS);
|
|
12
|
+
const NullableString = Schema.NullOr(Schema.String);
|
|
13
|
+
/** A Run summary with its Attempts, result links, and currently available operator actions. */
|
|
14
|
+
export class RunView extends Schema.Class("@usine/orchestrator/RunView")({
|
|
15
|
+
id: RunId,
|
|
16
|
+
itemKey: ItemKey,
|
|
17
|
+
loop: LoopName,
|
|
18
|
+
repository: RepositoryName,
|
|
19
|
+
agent: AgentName,
|
|
20
|
+
state: RunStateTag,
|
|
21
|
+
loopPaused: Schema.Boolean,
|
|
22
|
+
openedAt: Schema.String,
|
|
23
|
+
task: Schema.String,
|
|
24
|
+
attempts: Schema.Array(AttemptView),
|
|
25
|
+
resultMessage: NullableString,
|
|
26
|
+
pullRequestUrl: NullableString,
|
|
27
|
+
canApprove: Schema.Boolean,
|
|
28
|
+
canRetry: Schema.Boolean,
|
|
29
|
+
canCancel: Schema.Boolean,
|
|
30
|
+
}) {
|
|
31
|
+
}
|
|
32
|
+
/** A Run summary with its triggering Event payload and a bounded portion of its transcript. */
|
|
33
|
+
export class RunDetailView extends Schema.Class("@usine/orchestrator/RunDetailView")({
|
|
34
|
+
run: RunView,
|
|
35
|
+
eventDedupKey: Schema.String,
|
|
36
|
+
eventPayload: Schema.Json,
|
|
37
|
+
transcript: Schema.Array(TranscriptEventView),
|
|
38
|
+
earlierTranscript: Schema.Array(TranscriptPageCursor),
|
|
39
|
+
}) {
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/operator/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAGhE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEpD,+FAA+F;AAC/F,MAAM,OAAO,OAAQ,SAAQ,MAAM,CAAC,KAAK,CAAU,6BAA6B,CAAC,CAAC;IAChF,EAAE,EAAE,KAAK;IACT,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,MAAM,CAAC,OAAO;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;IACnC,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC,OAAO;IAC1B,QAAQ,EAAE,MAAM,CAAC,OAAO;IACxB,SAAS,EAAE,MAAM,CAAC,OAAO;CAC1B,CAAC;CAAG;AAEL,+FAA+F;AAC/F,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,mCAAmC,CAAC,CACjG;IACE,GAAG,EAAE,OAAO;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM;IAC5B,YAAY,EAAE,MAAM,CAAC,IAAI;IACzB,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAC7C,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACtD,CACF;CAAG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
declare const FailedTranscriptView_base: Schema.Class<FailedTranscriptView, Schema.TaggedStruct<"Failed", {
|
|
4
|
+
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]>;
|
|
5
|
+
}>, {}>;
|
|
6
|
+
/** An Attempt failure recorded in the transcript with displayable details only. */
|
|
7
|
+
export declare class FailedTranscriptView extends FailedTranscriptView_base {
|
|
8
|
+
}
|
|
9
|
+
/** Attempt channel messages exposed to the operator, with defect causes removed from failures. */
|
|
10
|
+
export declare const TranscriptPayload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt]>;
|
|
11
|
+
export type TranscriptPayload = typeof TranscriptPayload.Type;
|
|
12
|
+
declare const TranscriptEventView_base: Schema.Class<TranscriptEventView, Schema.Struct<{
|
|
13
|
+
readonly sequence: Schema.brand<Schema.Int, "TranscriptSequence">;
|
|
14
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
15
|
+
readonly receivedAt: Schema.String;
|
|
16
|
+
readonly direction: Schema.Literals<readonly ["inbound", "outbound"]>;
|
|
17
|
+
readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt]>;
|
|
18
|
+
}>, {}>;
|
|
19
|
+
/** A persisted Attempt channel message with its sequence, direction, and receipt time. */
|
|
20
|
+
export declare class TranscriptEventView extends TranscriptEventView_base {
|
|
21
|
+
}
|
|
22
|
+
declare const TranscriptPageCursor_base: Schema.Class<TranscriptPageCursor, Schema.Struct<{
|
|
23
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
24
|
+
readonly before: Schema.brand<Schema.Int, "TranscriptSequence">;
|
|
25
|
+
}>, {}>;
|
|
26
|
+
/** Where the next earlier transcript page starts, scoped to one Attempt. */
|
|
27
|
+
export declare class TranscriptPageCursor extends TranscriptPageCursor_base {
|
|
28
|
+
}
|
|
29
|
+
declare const ColdTranscriptRequest_base: Schema.Class<ColdTranscriptRequest, Schema.TaggedStruct<"ColdTranscriptRequest", {}>, {}>;
|
|
30
|
+
/** Requests the newest bounded transcript window when opening a Run. */
|
|
31
|
+
export declare class ColdTranscriptRequest extends ColdTranscriptRequest_base {
|
|
32
|
+
}
|
|
33
|
+
declare const TailTranscriptRequest_base: Schema.Class<TailTranscriptRequest, Schema.TaggedStruct<"TailTranscriptRequest", {
|
|
34
|
+
readonly after: Schema.brand<Schema.Int, "TranscriptSequence">;
|
|
35
|
+
}>, {}>;
|
|
36
|
+
/** Requests transcript events after the last observed sequence. */
|
|
37
|
+
export declare class TailTranscriptRequest extends TailTranscriptRequest_base {
|
|
38
|
+
}
|
|
39
|
+
declare const EarlierTranscriptRequest_base: Schema.Class<EarlierTranscriptRequest, Schema.TaggedStruct<"EarlierTranscriptRequest", {
|
|
40
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
41
|
+
readonly before: Schema.brand<Schema.Int, "TranscriptSequence">;
|
|
42
|
+
}>, {}>;
|
|
43
|
+
/** Requests an earlier page before a sequence within one Attempt. */
|
|
44
|
+
export declare class EarlierTranscriptRequest extends EarlierTranscriptRequest_base {
|
|
45
|
+
}
|
|
46
|
+
/** Selects the initial window, live tail, or earlier page of a Run transcript. */
|
|
47
|
+
export declare const TranscriptRequest: Schema.Union<readonly [typeof ColdTranscriptRequest, typeof TailTranscriptRequest, typeof EarlierTranscriptRequest]>;
|
|
48
|
+
export type TranscriptRequest = typeof TranscriptRequest.Type;
|
|
49
|
+
declare const TranscriptAttemptNotFoundError_base: Schema.Class<TranscriptAttemptNotFoundError, Schema.TaggedStruct<"TranscriptAttemptNotFoundError", {
|
|
50
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
51
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
52
|
+
}>, import("effect/Cause").YieldableError>;
|
|
53
|
+
/** The requested Attempt is absent from the Run whose transcript is being read. */
|
|
54
|
+
export declare class TranscriptAttemptNotFoundError extends TranscriptAttemptNotFoundError_base {
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../src/operator/transcript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAGhC,mFAAmF;AACnF,qBAAa,oBAAqB,SAAQ,yBAEL;CAAG;AAExC,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,uPAQ5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;;;;AAE9D,0FAA0F;AAC1F,qBAAa,mBAAoB,SAAQ,wBAQvC;CAAG;;;;;AAEL,4EAA4E;AAC5E,qBAAa,oBAAqB,SAAQ,yBAKxC;CAAG;;AAEL,wEAAwE;AACxE,qBAAa,qBAAsB,SAAQ,0BAEb;CAAG;;;;AAEjC,mEAAmE;AACnE,qBAAa,qBAAsB,SAAQ,0BAEc;CAAG;;;;;AAE5D,qEAAqE;AACrE,qBAAa,wBAAyB,SAAQ,6BAK5C;CAAG;AAEL,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,sHAI5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;AAE9D,mFAAmF;AACnF,qBAAa,8BAA+B,SAAQ,mCAKlD;CAAG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AttemptId } from "@usine/core/attempt";
|
|
2
|
+
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
3
|
+
import { RunId } from "@usine/core/run";
|
|
4
|
+
import { TranscriptSequence } from "@usine/engine/transcript";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
import { FailureView } from "./attempt.js";
|
|
7
|
+
/** An Attempt failure recorded in the transcript with displayable details only. */
|
|
8
|
+
export class FailedTranscriptView extends Schema.TaggedClass("@usine/orchestrator/FailedTranscriptView")("Failed", { failure: FailureView }) {
|
|
9
|
+
}
|
|
10
|
+
/** Attempt channel messages exposed to the operator, with defect causes removed from failures. */
|
|
11
|
+
export const TranscriptPayload = Schema.Union([
|
|
12
|
+
AttemptChannel.Started,
|
|
13
|
+
AttemptChannel.SessionEvent,
|
|
14
|
+
AttemptChannel.Final,
|
|
15
|
+
FailedTranscriptView,
|
|
16
|
+
AttemptChannel.Interrupted,
|
|
17
|
+
AttemptChannel.Steer,
|
|
18
|
+
AttemptChannel.Interrupt,
|
|
19
|
+
]);
|
|
20
|
+
/** A persisted Attempt channel message with its sequence, direction, and receipt time. */
|
|
21
|
+
export class TranscriptEventView extends Schema.Class("@usine/orchestrator/TranscriptEventView")({
|
|
22
|
+
sequence: TranscriptSequence,
|
|
23
|
+
attemptId: AttemptId,
|
|
24
|
+
receivedAt: Schema.String,
|
|
25
|
+
direction: AttemptChannel.Direction,
|
|
26
|
+
payload: TranscriptPayload,
|
|
27
|
+
}) {
|
|
28
|
+
}
|
|
29
|
+
/** Where the next earlier transcript page starts, scoped to one Attempt. */
|
|
30
|
+
export class TranscriptPageCursor extends Schema.Class("@usine/orchestrator/TranscriptPageCursor")({
|
|
31
|
+
attemptId: AttemptId,
|
|
32
|
+
before: TranscriptSequence,
|
|
33
|
+
}) {
|
|
34
|
+
}
|
|
35
|
+
/** Requests the newest bounded transcript window when opening a Run. */
|
|
36
|
+
export class ColdTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/ColdTranscriptRequest")("ColdTranscriptRequest", {}) {
|
|
37
|
+
}
|
|
38
|
+
/** Requests transcript events after the last observed sequence. */
|
|
39
|
+
export class TailTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/TailTranscriptRequest")("TailTranscriptRequest", { after: TranscriptSequence }) {
|
|
40
|
+
}
|
|
41
|
+
/** Requests an earlier page before a sequence within one Attempt. */
|
|
42
|
+
export class EarlierTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/EarlierTranscriptRequest")("EarlierTranscriptRequest", {
|
|
43
|
+
attemptId: AttemptId,
|
|
44
|
+
before: TranscriptSequence,
|
|
45
|
+
}) {
|
|
46
|
+
}
|
|
47
|
+
/** Selects the initial window, live tail, or earlier page of a Run transcript. */
|
|
48
|
+
export const TranscriptRequest = Schema.Union([
|
|
49
|
+
ColdTranscriptRequest,
|
|
50
|
+
TailTranscriptRequest,
|
|
51
|
+
EarlierTranscriptRequest,
|
|
52
|
+
]);
|
|
53
|
+
/** The requested Attempt is absent from the Run whose transcript is being read. */
|
|
54
|
+
export class TranscriptAttemptNotFoundError extends Schema.TaggedError("@usine/orchestrator/TranscriptAttemptNotFoundError")("TranscriptAttemptNotFoundError", {
|
|
55
|
+
runId: RunId,
|
|
56
|
+
attemptId: AttemptId,
|
|
57
|
+
}) {
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../src/operator/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,mFAAmF;AACnF,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,CAC1D,0CAA0C,CAC3C,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;CAAG;AAExC,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5C,cAAc,CAAC,OAAO;IACtB,cAAc,CAAC,YAAY;IAC3B,cAAc,CAAC,KAAK;IACpB,oBAAoB;IAC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C,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,SAAS;CACrB,CAAC;CAAG"}
|
package/dist/orchestrator.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { LoadedInstance } from "@usine/config";
|
|
1
|
+
import type { LoadedInstance } from "@usine/config/instance";
|
|
2
2
|
import { Context, Effect, Layer } from "effect";
|
|
3
3
|
import { PollingTriggers } from "./polling-triggers.ts";
|
|
4
4
|
import { ScheduleTriggers } from "./schedule-triggers.ts";
|
|
5
5
|
declare const Orchestrator_base: Context.ServiceClass<Orchestrator, "@usine/orchestrator/Orchestrator", {
|
|
6
|
+
/** Evaluates the supplied instance's triggers until interrupted, using that snapshot of its Loops and roster. */
|
|
6
7
|
readonly run: (instance: LoadedInstance) => Effect.Effect<never>;
|
|
7
8
|
}>;
|
|
8
|
-
/**
|
|
9
|
+
/** Coordinates polling and schedule triggers for one loaded factory instance. */
|
|
9
10
|
export declare class Orchestrator extends Orchestrator_base {
|
|
10
11
|
static readonly layer: Layer.Layer<Orchestrator, never, PollingTriggers | ScheduleTriggers>;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;;IAgBtD,iHAAiH;kBACnG,CAAC,QAAQ,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;AALpE,iFAAiF;AACjF,qBAAa,YAAa,SAAQ,iBAMK;IACrC,MAAM,CAAC,QAAQ,CAAC,KAAK,uEAAgD;CACtE"}
|
package/dist/orchestrator.js
CHANGED
|
@@ -7,7 +7,7 @@ const makeOrchestrator = Effect.gen(function* () {
|
|
|
7
7
|
const run = (instance) => Effect.raceFirst(polling.run(instance), schedules.run(instance));
|
|
8
8
|
return { run };
|
|
9
9
|
});
|
|
10
|
-
/**
|
|
10
|
+
/** Coordinates polling and schedule triggers for one loaded factory instance. */
|
|
11
11
|
export class Orchestrator extends Context.Service()("@usine/orchestrator/Orchestrator") {
|
|
12
12
|
static layer = Layer.effect(Orchestrator, makeOrchestrator);
|
|
13
13
|
}
|
package/dist/orchestrator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;IAE1C,MAAM,GAAG,GAAG,CAAC,QAAwB,EAAwB,EAAE,CAC7D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,GAAG,EAAW,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;IAE1C,MAAM,GAAG,GAAG,CAAC,QAAwB,EAAwB,EAAE,CAC7D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,GAAG,EAAW,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,iFAAiF;AACjF,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAM9C,CAAC,kCAAkC,CAAC;IACrC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;CACtE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ConfigFileError } from "@usine/config/file";
|
|
2
|
+
import { type RunEngineError } from "@usine/engine/engine";
|
|
3
|
+
import type { ExpressionError } from "@usine/expression/expression-engine";
|
|
4
|
+
import type { GitHubAppError } from "@usine/github/github-app";
|
|
5
|
+
import { DateTime, Option, Schema } from "effect";
|
|
6
|
+
import { LabelPreflightFinding } from "../label-reconciler.ts";
|
|
7
|
+
declare const RepositoryPollFailure_base: Schema.Class<RepositoryPollFailure, Schema.Struct<{
|
|
8
|
+
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
9
|
+
readonly errorTag: Schema.NonEmptyString;
|
|
10
|
+
readonly message: Schema.String;
|
|
11
|
+
}>, {}>;
|
|
12
|
+
/** One repository whose cycle failed; its siblings finished normally. */
|
|
13
|
+
export declare class RepositoryPollFailure extends RepositoryPollFailure_base {
|
|
14
|
+
}
|
|
15
|
+
declare const PollCycle_base: Schema.Class<PollCycle, Schema.Struct<{
|
|
16
|
+
readonly repositories: Schema.Int;
|
|
17
|
+
readonly changedItems: Schema.Int;
|
|
18
|
+
readonly submissions: Schema.$Array<Schema.Union<readonly [typeof import("@usine/engine/engine").Claimed, typeof import("@usine/engine/engine").Queued, typeof import("@usine/engine/engine").Ignored, typeof import("@usine/engine/engine").CycleBlocked]>>;
|
|
19
|
+
/** How many Runs this cycle revoked because their item stopped matching. */
|
|
20
|
+
readonly revokedRuns: Schema.Int;
|
|
21
|
+
readonly failures: Schema.$Array<typeof RepositoryPollFailure>;
|
|
22
|
+
readonly preflightFindings: Schema.$Array<typeof LabelPreflightFinding>;
|
|
23
|
+
readonly nextPollAt: Schema.Option<Schema.DateTimeUtc>;
|
|
24
|
+
}>, {}>;
|
|
25
|
+
/** Outcomes of one poll over all managed repositories, including isolated failures and backoff. */
|
|
26
|
+
export declare class PollCycle extends PollCycle_base {
|
|
27
|
+
}
|
|
28
|
+
/** Recoverable failures that leave a repository eligible for another poll. */
|
|
29
|
+
export type RepositoryPollError = ConfigFileError | ExpressionError | GitHubAppError | RunEngineError;
|
|
30
|
+
/** Safe diagnostic fields for a failed repository operation. */
|
|
31
|
+
export declare const repositoryFailureLogFields: (error: RepositoryPollError) => {
|
|
32
|
+
errorTag: "AppPermissionError" | "AttemptCancellationError" | "ConfigFileError" | "EnginePersistenceError" | "ExpressionCheckError" | "ExpressionEvaluationError" | "GitHubApiError" | "GitHubRateLimitError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "RunNotFoundError" | "RunOperationRejectedError";
|
|
33
|
+
message: string;
|
|
34
|
+
} | {
|
|
35
|
+
errorTag: "AppPermissionError" | "AttemptCancellationError" | "ConfigFileError" | "EnginePersistenceError" | "ExpressionCheckError" | "ExpressionEvaluationError" | "GitHubApiError" | "GitHubRateLimitError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "RunNotFoundError" | "RunOperationRejectedError";
|
|
36
|
+
message: string;
|
|
37
|
+
expression: string & import("effect/Brand").Brand<"ExpressionSource">;
|
|
38
|
+
};
|
|
39
|
+
/** A cycle whose preflight finished but whose repository poll failed. */
|
|
40
|
+
export interface InterruptedRepositoryCycle {
|
|
41
|
+
readonly _tag: "InterruptedRepositoryCycle";
|
|
42
|
+
readonly error: RepositoryPollError;
|
|
43
|
+
/** Preflight failures such as a failed catalog request, kept through the interruption. */
|
|
44
|
+
readonly failures: ReadonlyArray<RepositoryPollFailure>;
|
|
45
|
+
readonly preflightFindings: ReadonlyArray<LabelPreflightFinding>;
|
|
46
|
+
readonly nextPollAt: Option.Option<DateTime.Utc>;
|
|
47
|
+
}
|
|
48
|
+
/** The latest requested backoff; no recommendation leaves the configured interval in charge. */
|
|
49
|
+
export declare const latestPollAt: (values: ReadonlyArray<Option.Option<DateTime.Utc>>) => Option.Option<DateTime.Utc>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycle.d.ts","sourceRoot":"","sources":["../../src/polling/cycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;;;;;;AAG/D,yEAAyE;AACzE,qBAAa,qBAAsB,SAAQ,0BAMzC;CAAG;;;;;IAOH,4EAA4E;;;;;;AAL9E,mGAAmG;AACnG,qBAAa,SAAU,SAAQ,cAS7B;CAAG;AAEL,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,eAAe,GACf,cAAc,GACd,cAAc,CAAC;AAEnB,gEAAgE;AAChE,eAAO,MAAM,0BAA0B,UAAW,mBAAmB;;;;;;;CASpE,CAAC;AAEF,yEAAyE;AACzE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACxD,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;CAClD;AAED,gGAAgG;AAChG,eAAO,MAAM,YAAY,WACf,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KACjD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAQ5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { SubmissionResult } from "@usine/engine/engine";
|
|
3
|
+
import { DateTime, Option, Schema } from "effect";
|
|
4
|
+
import { LabelPreflightFinding } from "../label-reconciler.js";
|
|
5
|
+
import { configFileErrorLogFields } from "../trigger-submission.js";
|
|
6
|
+
/** One repository whose cycle failed; its siblings finished normally. */
|
|
7
|
+
export class RepositoryPollFailure extends Schema.Class("@usine/orchestrator/RepositoryPollFailure")({
|
|
8
|
+
repository: RepositoryName,
|
|
9
|
+
errorTag: Schema.NonEmptyString,
|
|
10
|
+
message: Schema.String,
|
|
11
|
+
}) {
|
|
12
|
+
}
|
|
13
|
+
/** Outcomes of one poll over all managed repositories, including isolated failures and backoff. */
|
|
14
|
+
export class PollCycle extends Schema.Class("@usine/orchestrator/PollCycle")({
|
|
15
|
+
repositories: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
16
|
+
changedItems: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
17
|
+
submissions: Schema.Array(SubmissionResult),
|
|
18
|
+
/** How many Runs this cycle revoked because their item stopped matching. */
|
|
19
|
+
revokedRuns: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
20
|
+
failures: Schema.Array(RepositoryPollFailure),
|
|
21
|
+
preflightFindings: Schema.Array(LabelPreflightFinding),
|
|
22
|
+
nextPollAt: Schema.Option(Schema.DateTimeUtc),
|
|
23
|
+
}) {
|
|
24
|
+
}
|
|
25
|
+
/** Safe diagnostic fields for a failed repository operation. */
|
|
26
|
+
export const repositoryFailureLogFields = (error) => {
|
|
27
|
+
const common = { errorTag: error._tag, message: error.message };
|
|
28
|
+
if (error._tag === "ConfigFileError") {
|
|
29
|
+
return { ...common, ...configFileErrorLogFields(error) };
|
|
30
|
+
}
|
|
31
|
+
if (error._tag === "ExpressionCheckError" || error._tag === "ExpressionEvaluationError") {
|
|
32
|
+
return { ...common, expression: error.source };
|
|
33
|
+
}
|
|
34
|
+
return common;
|
|
35
|
+
};
|
|
36
|
+
/** The latest requested backoff; no recommendation leaves the configured interval in charge. */
|
|
37
|
+
export const latestPollAt = (values) => {
|
|
38
|
+
const epochs = values.flatMap((value) => Option.match(value, {
|
|
39
|
+
onNone: () => [],
|
|
40
|
+
onSome: (dateTime) => [DateTime.toEpochMillis(dateTime)],
|
|
41
|
+
}));
|
|
42
|
+
return epochs.length === 0 ? Option.none() : DateTime.make(Math.max(...epochs));
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=cycle.js.map
|
|
@@ -0,0 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ine/github/polling";
|
|
3
|
+
import { Context, DateTime, Effect, Layer, Option } from "effect";
|
|
4
|
+
/** A self-write identifies an Item to fetch; its payload still comes from GitHub. */
|
|
5
|
+
export interface ItemHint {
|
|
6
|
+
readonly repository: RepositoryName;
|
|
7
|
+
readonly item: ChangedItem;
|
|
8
|
+
}
|
|
9
|
+
declare const ItemHints_base: Context.ServiceClass<ItemHints, "@usine/orchestrator/ItemHints", {
|
|
10
|
+
offer: (repository: string & import("effect/Brand").Brand<"RepositoryName">, item: import("@usine/github/polling").ChangedIssue | import("@usine/github/polling").ChangedPullRequest, requestBackoff?: Option.Option<DateTime.Utc> | undefined) => Effect.Effect<void, never, never>;
|
|
11
|
+
take: Effect.Effect<ItemHint, never, never>;
|
|
12
|
+
defer: (until: Option.Option<DateTime.Utc>) => Effect.Effect<void, never, never>;
|
|
13
|
+
awaitBackoff: Effect.Effect<void, never, never>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Private pending Hint and request-backoff state owned by a polling runtime. */
|
|
16
|
+
export declare class ItemHints extends ItemHints_base {
|
|
17
|
+
static readonly layer: Layer.Layer<ItemHints, never, never>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../src/polling/hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAS,OAAO,EAAE,QAAQ,EAAY,MAAM,EAAE,KAAK,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AAE/F,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;;;;mBAUuB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;;;AAwDnD,iFAAiF;AACjF,qBAAa,SAAU,SAAQ,cAE9B;IACC,MAAM,CAAC,QAAQ,CAAC,KAAK,uCAAiC;CACvD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { canonicalRepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { Clock, Context, DateTime, Duration, Effect, Layer, Option, Queue, Ref } from "effect";
|
|
3
|
+
/** Pending Hints are bounded and coalesced; the normal poll repairs dropped nudges. */
|
|
4
|
+
const make = Effect.gen(function* () {
|
|
5
|
+
const pending = new Set();
|
|
6
|
+
const queue = yield* Queue.make({ capacity: 128, strategy: "dropping" });
|
|
7
|
+
const backoffUntil = yield* Ref.make(0);
|
|
8
|
+
const key = ({ repository, item }) => `${canonicalRepositoryName(repository)}:${item.number}`;
|
|
9
|
+
const defer = (until) => Option.match(until, {
|
|
10
|
+
onNone: () => Effect.void,
|
|
11
|
+
onSome: (value) => Ref.update(backoffUntil, (current) => Math.max(current, DateTime.toEpochMillis(value))),
|
|
12
|
+
});
|
|
13
|
+
const offer = Effect.fn("PollingTriggers.hint")(function* (repository, item, requestBackoff = Option.none()) {
|
|
14
|
+
yield* Effect.annotateCurrentSpan({ repository, item: item.number });
|
|
15
|
+
yield* defer(requestBackoff);
|
|
16
|
+
const hint = { repository, item };
|
|
17
|
+
const id = key(hint);
|
|
18
|
+
if (pending.has(id)) {
|
|
19
|
+
yield* Effect.logDebug("Self-write Hint coalesced with a pending Item fetch", {
|
|
20
|
+
repository,
|
|
21
|
+
item: item.number,
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
pending.add(id);
|
|
26
|
+
if (yield* Queue.offer(queue, hint)) {
|
|
27
|
+
yield* Effect.logDebug("Self-write Hint queued", { repository, item: item.number });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
pending.delete(id);
|
|
31
|
+
yield* Effect.logWarning("Self-write Hint queue full; the normal poll will refresh the Item", { repository, item: item.number });
|
|
32
|
+
}
|
|
33
|
+
}, Effect.uninterruptible);
|
|
34
|
+
const take = Effect.uninterruptibleMask((restore) => restore(Queue.take(queue)).pipe(Effect.tap((hint) => Effect.sync(() => pending.delete(key(hint))))));
|
|
35
|
+
const awaitBackoff = Effect.gen(function* () {
|
|
36
|
+
while (true) {
|
|
37
|
+
const until = yield* Ref.get(backoffUntil);
|
|
38
|
+
const now = yield* Clock.currentTimeMillis;
|
|
39
|
+
if (until <= now)
|
|
40
|
+
return;
|
|
41
|
+
yield* Effect.logInfo("GitHub request backoff delays polling and self-write Hints", {
|
|
42
|
+
sleepMs: until - now,
|
|
43
|
+
});
|
|
44
|
+
yield* Effect.sleep(Duration.millis(until - now));
|
|
45
|
+
// An operator write can extend the deadline while this consumer waits.
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return { offer, take, defer, awaitBackoff };
|
|
49
|
+
});
|
|
50
|
+
/** Private pending Hint and request-backoff state owned by a polling runtime. */
|
|
51
|
+
export class ItemHints extends Context.Service()("@usine/orchestrator/ItemHints") {
|
|
52
|
+
static layer = Layer.effect(ItemHints, make);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../../src/polling/hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAuB,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAQ/F,uFAAuF;AACvF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,KAAK,GAA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CAAC;YAC3C,IAAI,KAAK,IAAI,GAAG;gBAAE,OAAO;YACzB,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,4DAA4D,EAAE;gBAClF,OAAO,EAAE,KAAK,GAAG,GAAG;aACrB,CAAC,CAAC;YACH,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;YAClD,uEAAuE;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH,iFAAiF;AACjF,MAAM,OAAO,SAAU,SAAQ,OAAO,CAAC,OAAO,EAA0C,CACtF,+BAA+B,CAChC;IACC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;CACvD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ManagedRepo } from "@usine/config/factory";
|
|
2
|
+
import { ConfigParser } from "@usine/config/parser";
|
|
3
|
+
import { RunEngine } from "@usine/engine/engine";
|
|
4
|
+
import type { ObservedItem } from "./repository-sync.ts";
|
|
5
|
+
import { ExpressionEngine } from "@usine/expression/expression-engine";
|
|
6
|
+
import { InvalidGitHubResponseError } from "@usine/github/github-app";
|
|
7
|
+
import { Effect } from "effect";
|
|
8
|
+
import { type ResolvedLoop } from "../trigger-submission.ts";
|
|
9
|
+
import { RepositoryPollFailure } from "./cycle.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Evaluates an already projected Item against its repository's active Loops,
|
|
12
|
+
* renders matching prompts, and submits or revokes Runs. Prompt-render failures
|
|
13
|
+
* are reported per Loop; expression and Run failures stop the repository before
|
|
14
|
+
* its cursor commits. Schedule Ticks have separate evaluation semantics.
|
|
15
|
+
*/
|
|
16
|
+
export declare const evaluateItem: (repository: ManagedRepo, resolved: readonly ResolvedLoop[], observed: ObservedItem) => Effect.Effect<{
|
|
17
|
+
submissions: (import("@usine/engine/engine").Claimed | import("@usine/engine/engine").CycleBlocked | import("@usine/engine/engine").Ignored | import("@usine/engine/engine").Queued)[];
|
|
18
|
+
revokedRuns: number;
|
|
19
|
+
failures: RepositoryPollFailure[];
|
|
20
|
+
}, import("@usine/engine/engine").AttemptCancellationError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/expression/expression-engine").ExpressionCheckError | import("@usine/expression/expression-engine").ExpressionEvaluationError | InvalidGitHubResponseError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError, ConfigParser | ExpressionEngine | RunEngine>;
|
|
21
|
+
//# sourceMappingURL=loop-evaluation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-evaluation.d.ts","sourceRoot":"","sources":["../../src/polling/loop-evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAY,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAGL,KAAK,YAAY,EAGlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA0BnD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;ybA4HvB,CAAC"}
|