@usine/orchestrator 0.2.1 → 0.3.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 +151 -52
- package/dist/board/items.d.ts +9 -1
- package/dist/board/items.d.ts.map +1 -1
- package/dist/board/items.js +16 -4
- package/dist/board/items.js.map +1 -1
- package/dist/board/projection.d.ts +7 -1
- package/dist/board/projection.d.ts.map +1 -1
- package/dist/board/projection.js +53 -14
- package/dist/board/projection.js.map +1 -1
- package/dist/board/tasks.d.ts +14 -2
- package/dist/board/tasks.d.ts.map +1 -1
- package/dist/board/tasks.js +23 -8
- package/dist/board/tasks.js.map +1 -1
- package/dist/credentials.d.ts +5 -6
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +22 -15
- package/dist/credentials.js.map +1 -1
- package/dist/current-instance/changes.d.ts +87 -0
- package/dist/current-instance/changes.d.ts.map +1 -0
- package/dist/current-instance/changes.js +138 -0
- package/dist/current-instance/changes.js.map +1 -0
- package/dist/current-instance/current-instance.d.ts +89 -0
- package/dist/current-instance/current-instance.d.ts.map +1 -0
- package/dist/current-instance/current-instance.js +163 -0
- package/dist/current-instance/current-instance.js.map +1 -0
- package/dist/exe-dev.d.ts +6 -2
- package/dist/exe-dev.d.ts.map +1 -1
- package/dist/exe-dev.js +7 -8
- 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 +1 -1
- package/dist/idle-triggers.js.map +1 -1
- package/dist/label-reconciler.d.ts +5 -2
- package/dist/label-reconciler.d.ts.map +1 -1
- package/dist/label-reconciler.js.map +1 -1
- package/dist/local.d.ts +4 -18
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +7 -45
- package/dist/local.js.map +1 -1
- package/dist/loop-matches.d.ts +28 -0
- package/dist/loop-matches.d.ts.map +1 -0
- package/dist/loop-matches.js +74 -0
- package/dist/loop-matches.js.map +1 -0
- package/dist/operator/attempt.d.ts +57 -10
- package/dist/operator/attempt.d.ts.map +1 -1
- package/dist/operator/attempt.js +49 -10
- package/dist/operator/attempt.js.map +1 -1
- package/dist/operator/board.d.ts +43 -16
- package/dist/operator/board.d.ts.map +1 -1
- package/dist/operator/board.js +43 -16
- package/dist/operator/board.js.map +1 -1
- package/dist/operator/configuration.d.ts +258 -0
- package/dist/operator/configuration.d.ts.map +1 -0
- package/dist/operator/configuration.js +410 -0
- package/dist/operator/configuration.js.map +1 -0
- package/dist/operator/desk.d.ts +181 -0
- package/dist/operator/desk.d.ts.map +1 -0
- package/dist/operator/desk.js +463 -0
- package/dist/operator/desk.js.map +1 -0
- package/dist/operator/github-changes.d.ts +88 -0
- package/dist/operator/github-changes.d.ts.map +1 -0
- package/dist/operator/github-changes.js +266 -0
- package/dist/operator/github-changes.js.map +1 -0
- package/dist/operator/http.d.ts +152 -57
- package/dist/operator/http.d.ts.map +1 -1
- package/dist/operator/http.js +140 -21
- package/dist/operator/http.js.map +1 -1
- package/dist/operator/need.d.ts +44 -11
- package/dist/operator/need.d.ts.map +1 -1
- package/dist/operator/need.js +46 -9
- package/dist/operator/need.js.map +1 -1
- package/dist/operator/operator.d.ts +109 -29
- package/dist/operator/operator.d.ts.map +1 -1
- package/dist/operator/operator.js +254 -52
- package/dist/operator/operator.js.map +1 -1
- package/dist/operator/overview.d.ts +7 -7
- package/dist/operator/overview.d.ts.map +1 -1
- package/dist/operator/overview.js +5 -5
- package/dist/operator/overview.js.map +1 -1
- package/dist/operator/projection.d.ts +54 -5
- package/dist/operator/projection.d.ts.map +1 -1
- package/dist/operator/projection.js +100 -9
- package/dist/operator/projection.js.map +1 -1
- package/dist/operator/run.d.ts +71 -6
- package/dist/operator/run.d.ts.map +1 -1
- package/dist/operator/run.js +69 -6
- package/dist/operator/run.js.map +1 -1
- package/dist/operator/task.d.ts +93 -0
- package/dist/operator/task.d.ts.map +1 -0
- package/dist/operator/task.js +204 -0
- package/dist/operator/task.js.map +1 -0
- package/dist/operator/transcript.d.ts +12 -12
- package/dist/operator/transcript.d.ts.map +1 -1
- package/dist/operator/transcript.js +11 -9
- package/dist/operator/transcript.js.map +1 -1
- package/dist/operator/usage.d.ts +111 -0
- package/dist/operator/usage.d.ts.map +1 -0
- package/dist/operator/usage.js +219 -0
- package/dist/operator/usage.js.map +1 -0
- package/dist/orchestrator.d.ts +8 -5
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +4 -2
- package/dist/orchestrator.js.map +1 -1
- package/dist/polling/cycle.d.ts +28 -10
- package/dist/polling/cycle.d.ts.map +1 -1
- package/dist/polling/cycle.js +20 -6
- package/dist/polling/cycle.js.map +1 -1
- package/dist/polling/evaluation-failures.d.ts +42 -0
- package/dist/polling/evaluation-failures.d.ts.map +1 -0
- package/dist/polling/evaluation-failures.js +103 -0
- package/dist/polling/evaluation-failures.js.map +1 -0
- package/dist/polling/hints.d.ts +2 -2
- package/dist/polling/hints.d.ts.map +1 -1
- package/dist/polling/hints.js +2 -2
- package/dist/polling/hints.js.map +1 -1
- package/dist/polling/loop-evaluation.d.ts +21 -11
- package/dist/polling/loop-evaluation.d.ts.map +1 -1
- package/dist/polling/loop-evaluation.js +70 -27
- package/dist/polling/loop-evaluation.js.map +1 -1
- package/dist/polling/open-issues.d.ts +23 -0
- package/dist/polling/open-issues.d.ts.map +1 -0
- package/dist/polling/open-issues.js +77 -0
- package/dist/polling/open-issues.js.map +1 -0
- package/dist/polling/polling.d.ts +20 -11
- package/dist/polling/polling.d.ts.map +1 -1
- package/dist/polling/polling.js +201 -51
- package/dist/polling/polling.js.map +1 -1
- package/dist/polling/repository-sync.d.ts +20 -14
- package/dist/polling/repository-sync.d.ts.map +1 -1
- package/dist/polling/repository-sync.js +34 -27
- package/dist/polling/repository-sync.js.map +1 -1
- package/dist/polling-triggers.d.ts +1 -1
- package/dist/polling-triggers.d.ts.map +1 -1
- package/dist/polling-triggers.js +1 -1
- package/dist/polling-triggers.js.map +1 -1
- package/dist/reloads.d.ts +14 -0
- package/dist/reloads.d.ts.map +1 -0
- package/dist/reloads.js +7 -0
- package/dist/reloads.js.map +1 -0
- package/dist/runtime.d.ts +24 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +58 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schedule-triggers.d.ts +14 -10
- package/dist/schedule-triggers.d.ts.map +1 -1
- package/dist/schedule-triggers.js +36 -31
- package/dist/schedule-triggers.js.map +1 -1
- package/dist/scheduler.d.ts +35 -4
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +327 -41
- package/dist/scheduler.js.map +1 -1
- package/dist/ssh.d.ts +39 -0
- package/dist/ssh.d.ts.map +1 -0
- package/dist/ssh.js +75 -0
- package/dist/ssh.js.map +1 -0
- package/dist/trigger-condition.d.ts +12 -0
- package/dist/trigger-condition.d.ts.map +1 -0
- package/dist/trigger-condition.js +88 -0
- package/dist/trigger-condition.js.map +1 -0
- package/dist/trigger-submission.d.ts +16 -13
- package/dist/trigger-submission.d.ts.map +1 -1
- package/dist/trigger-submission.js +19 -14
- package/dist/trigger-submission.js.map +1 -1
- package/dist/worker-engine.d.ts +10 -0
- package/dist/worker-engine.d.ts.map +1 -0
- package/dist/worker-engine.js +25 -0
- package/dist/worker-engine.js.map +1 -0
- package/dist/worker-status.d.ts +70 -0
- package/dist/worker-status.d.ts.map +1 -0
- package/dist/worker-status.js +55 -0
- package/dist/worker-status.js.map +1 -0
- package/package.json +31 -10
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { InstanceFolder } from "@usine/config/instance-folder";
|
|
2
|
+
import { AgentName } from "@usine/core/agent";
|
|
3
|
+
import { WorkerName } from "@usine/core/worker";
|
|
4
|
+
import { ExecutorError } from "@usine/executor";
|
|
5
|
+
import { Array as EffectArray, Context, Effect, Layer, Match, Option, Ref, Schema, Semaphore, SubscriptionRef, } from "effect";
|
|
6
|
+
import { agentsWithNewBrains, InstanceReload, instanceReload, RestartBlock, restartChanges, } from "./changes.js";
|
|
7
|
+
/** A reload changed `usine.yaml` in a way that needs a restart, so the running instance is kept. */
|
|
8
|
+
export class RestartRequiredError extends Schema.TaggedError("@usine/orchestrator/RestartRequiredError")("RestartRequiredError", {
|
|
9
|
+
blocks: Schema.NonEmptyArray(RestartBlock),
|
|
10
|
+
/**
|
|
11
|
+
* The changed fields as paths into `usine.yaml`, such as `webhooks` or
|
|
12
|
+
* `workers.build-1.destination`.
|
|
13
|
+
*/
|
|
14
|
+
fields: Schema.NonEmptyArray(Schema.NonEmptyString),
|
|
15
|
+
/** An operator summary of each change, stating that the running configuration is kept. */
|
|
16
|
+
message: Schema.NonEmptyString,
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
/** Returns the refusal for a reload that makes `changes`. */
|
|
20
|
+
export const restartRequired = (changes) => new RestartRequiredError({
|
|
21
|
+
blocks: EffectArray.dedupe(EffectArray.map(changes, ({ block }) => block)),
|
|
22
|
+
fields: EffectArray.map(changes, ({ field }) => field),
|
|
23
|
+
message: `These usine.yaml changes require a restart: ${changes.map(({ reason }) => reason).join("; ")}. The running configuration is unchanged. Restart usine up to apply them.`,
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* A reload adds Workers, slots, or brains that failed Worker preflight, so the running instance is
|
|
27
|
+
* kept.
|
|
28
|
+
*/
|
|
29
|
+
export class ReloadPreflightError extends Schema.TaggedError("@usine/orchestrator/ReloadPreflightError")("ReloadPreflightError", {
|
|
30
|
+
/**
|
|
31
|
+
* The reloaded Agents with brains that no running Agent has, which preflight checked on every
|
|
32
|
+
* Worker.
|
|
33
|
+
*/
|
|
34
|
+
agents: Schema.Array(AgentName),
|
|
35
|
+
/**
|
|
36
|
+
* The Workers added or given more slots by the reload, which preflight checked with every
|
|
37
|
+
* rostered brain.
|
|
38
|
+
*/
|
|
39
|
+
workers: Schema.Array(WorkerName),
|
|
40
|
+
/**
|
|
41
|
+
* An operator summary of the additions and the failed check, stating that the running
|
|
42
|
+
* configuration is kept.
|
|
43
|
+
*/
|
|
44
|
+
message: Schema.NonEmptyString,
|
|
45
|
+
cause: ExecutorError,
|
|
46
|
+
}) {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the refusal for a reload whose preflight of `agents` and `workers` failed with `cause`.
|
|
50
|
+
*/
|
|
51
|
+
export const reloadPreflightFailed = (agents, workers, cause) => {
|
|
52
|
+
const quoted = (names) => names.map((name) => `"${name}"`).join(", ");
|
|
53
|
+
const subjects = [
|
|
54
|
+
...(agents.length === 0
|
|
55
|
+
? []
|
|
56
|
+
: [`${agents.length === 1 ? "agent" : "agents"} ${quoted(agents)}`]),
|
|
57
|
+
...(workers.length === 0
|
|
58
|
+
? []
|
|
59
|
+
: [
|
|
60
|
+
`${workers.length === 1 ? "worker" : "workers"} ${quoted(workers)} (added or given more slots by the reload)`,
|
|
61
|
+
]),
|
|
62
|
+
];
|
|
63
|
+
const detail = cause._tag === "WorkerCapabilityError"
|
|
64
|
+
? `Worker "${cause.worker}": ${cause.message}`
|
|
65
|
+
: cause.message;
|
|
66
|
+
const sentence = `${detail.charAt(0).toUpperCase()}${detail.slice(1)}`.replace(/\.$/u, "");
|
|
67
|
+
return new ReloadPreflightError({
|
|
68
|
+
agents,
|
|
69
|
+
workers,
|
|
70
|
+
message: `Worker preflight failed for ${subjects.join(" and ")}. ${sentence}. The running configuration is unchanged. Fix the worker, usine.yaml, or the agent file, then reload again.`,
|
|
71
|
+
cause,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const rejectionLogFields = (error) => Match.valueTags(error, {
|
|
75
|
+
FactoryConfigError: ({ _tag, file, stage, message }) => ({
|
|
76
|
+
errorTag: _tag,
|
|
77
|
+
file,
|
|
78
|
+
stage,
|
|
79
|
+
message,
|
|
80
|
+
}),
|
|
81
|
+
RestartRequiredError: ({ _tag, blocks, fields, message }) => ({
|
|
82
|
+
errorTag: _tag,
|
|
83
|
+
blocks,
|
|
84
|
+
fields,
|
|
85
|
+
message,
|
|
86
|
+
}),
|
|
87
|
+
ReloadPreflightError: ({ _tag, agents, workers, message, cause }) => ({
|
|
88
|
+
errorTag: _tag,
|
|
89
|
+
agents,
|
|
90
|
+
workers,
|
|
91
|
+
causeTag: cause._tag,
|
|
92
|
+
message,
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* The instance folder snapshot that the orchestrator runs, replaced by each reload. Consumers read
|
|
97
|
+
* it each time they act; a Run keeps the Agent, task, and parent model it opened with.
|
|
98
|
+
*/
|
|
99
|
+
export class CurrentInstance extends Context.Service()("@usine/orchestrator/CurrentInstance") {
|
|
100
|
+
/**
|
|
101
|
+
* Starts from `initial`, the folder that `usine up` loaded at startup, and reloads `directory`.
|
|
102
|
+
*/
|
|
103
|
+
static layer = (directory, initial) => Layer.effect(CurrentInstance, Effect.gen(function* () {
|
|
104
|
+
const folder = yield* InstanceFolder;
|
|
105
|
+
const current = yield* SubscriptionRef.make(initial);
|
|
106
|
+
const registered = yield* Ref.make(Option.none());
|
|
107
|
+
const reloading = yield* Semaphore.make(1);
|
|
108
|
+
const beforeWorkersStart = Effect.fn("CurrentInstance.beforeWorkersStart")(function* (running, loaded) {
|
|
109
|
+
const agents = agentsWithNewBrains(running, loaded).map(({ name }) => name);
|
|
110
|
+
if (agents.length > 0) {
|
|
111
|
+
yield* Effect.logInfo("The reload adds brains before the Workers start; their startup preflight checks them", { agents });
|
|
112
|
+
}
|
|
113
|
+
return Effect.void;
|
|
114
|
+
});
|
|
115
|
+
// Once the Workers have prepared the reload, it runs to completion, so their additions are
|
|
116
|
+
// applied.
|
|
117
|
+
const reload = Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
118
|
+
const running = yield* SubscriptionRef.get(current);
|
|
119
|
+
const loaded = yield* restore(folder.load(directory));
|
|
120
|
+
const workers = yield* Ref.get(registered);
|
|
121
|
+
const restart = restartChanges(running, loaded, Option.isSome(workers));
|
|
122
|
+
if (EffectArray.isReadonlyArrayNonEmpty(restart)) {
|
|
123
|
+
return yield* restartRequired(restart);
|
|
124
|
+
}
|
|
125
|
+
const applyWorkers = yield* restore(Option.isSome(workers)
|
|
126
|
+
? workers.value(running, loaded)
|
|
127
|
+
: beforeWorkersStart(running, loaded));
|
|
128
|
+
const changes = instanceReload(running, loaded);
|
|
129
|
+
yield* SubscriptionRef.set(current, loaded).pipe(Effect.andThen(applyWorkers));
|
|
130
|
+
yield* Effect.logInfo("Instance folder reloaded; new Runs use the new configuration", {
|
|
131
|
+
loopsAdded: changes.loops.added,
|
|
132
|
+
loopsRemoved: changes.loops.removed,
|
|
133
|
+
loopsChanged: changes.loops.changed,
|
|
134
|
+
agentsAdded: changes.agents.added,
|
|
135
|
+
agentsRemoved: changes.agents.removed,
|
|
136
|
+
agentsChanged: changes.agents.changed,
|
|
137
|
+
labelsAdded: changes.labels.added,
|
|
138
|
+
labelsRemoved: changes.labels.removed,
|
|
139
|
+
labelsChanged: changes.labels.changed,
|
|
140
|
+
reposAdded: changes.repos.added,
|
|
141
|
+
reposRemoved: changes.repos.removed,
|
|
142
|
+
reposChanged: changes.repos.changed,
|
|
143
|
+
workersAdded: changes.workers.added,
|
|
144
|
+
workersRemoved: changes.workers.removed,
|
|
145
|
+
workersChanged: changes.workers.changed,
|
|
146
|
+
settingsChanged: changes.settingsChanged,
|
|
147
|
+
operatorChanged: changes.operatorChanged,
|
|
148
|
+
quarantinedLoops: changes.quarantinedLoops.map(({ file }) => file),
|
|
149
|
+
invalidAgents: changes.invalidAgents.map(({ file }) => file),
|
|
150
|
+
});
|
|
151
|
+
return changes;
|
|
152
|
+
})).pipe(Effect.tapError((error) => Effect.logWarning("Instance folder reload rejected; the running configuration is unchanged", rejectionLogFields(error))), reloading.withPermits(1), Effect.withSpan("CurrentInstance.reload", { attributes: { directory } }));
|
|
153
|
+
const registerWorkers = (workers) => Effect.acquireRelease(Ref.set(registered, Option.some(workers)), () => Ref.set(registered, Option.none()));
|
|
154
|
+
return {
|
|
155
|
+
get: SubscriptionRef.get(current),
|
|
156
|
+
changes: SubscriptionRef.changes(current),
|
|
157
|
+
reload,
|
|
158
|
+
registerWorkers,
|
|
159
|
+
};
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
export { InstanceReload, RestartBlock } from "./changes.js";
|
|
163
|
+
//# sourceMappingURL=current-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-instance.js","sourceRoot":"","sources":["../../src/current-instance/current-instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,GAAG,EACH,MAAM,EAEN,SAAS,EAET,eAAe,GAChB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,YAAY,EAEZ,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,oGAAoG;AACpG,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,CAC1D,0CAA0C,CAC3C,CAAC,sBAAsB,EAAE;IACxB,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;IAC1C;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC;IACnD,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAAyD,EACnC,EAAE,CACxB,IAAI,oBAAoB,CAAC;IACvB,MAAM,EAAE,WA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C,CAC1B,CACF,EACD,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EACxB,MAAM,CAAC,QAAQ,CAAC,wBAAwB,EAAE,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CACzE,CAAC;QAEF,MAAM,eAAe,GAAG,CAAC,OAAqB,EAAE,EAAE,CAChD,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CACpE,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CACnC,CAAC;QAEJ,OAAO;YACL,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;YACjC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC;YACzC,MAAM;YACN,eAAe;SAChB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;CACL;AAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/exe-dev.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { UsineConfig } from "@usine/config/factory";
|
|
|
3
3
|
import type { InstanceDirectory } from "@usine/core/instance";
|
|
4
4
|
import { type ExeDevExecutorOptions } from "@usine/executor/exe-dev";
|
|
5
5
|
import { Layer } from "effect";
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Provides the full engine and `WorkerStatus` for exe.dev Workers. Requires `GitHubApp`,
|
|
8
|
+
* `TriggerCondition`, `AttemptRuntime` (built before the engine), `ClaudeLoginLock`, and
|
|
9
|
+
* `CurrentInstance`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const layer: (instanceDirectory: InstanceDirectory, config: UsineConfig, brains: ReadonlyArray<BrainSpec>, options: ExeDevExecutorOptions) => Layer.Layer<import("@usine/engine/board-moves").BoardMoves | import("@usine/engine/cursor").CursorStore | import("@usine/engine/cycle-budget").CycleBudgets | import("@usine/engine/item-projection").ItemProjectionReader | import("@usine/engine/item-projection").ItemProjectionWriter | import("@usine/engine/loop-control").LoopControl | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionReader | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionWriter | import("@usine/engine/engine").RunEngine | import("@usine/engine/run-reader").RunReader | import("@usine/engine/step-executor").StepExecutor | import("./worker-status.ts").WorkerStatus, import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("@usine/engine/engine").RunRetryBlockedError | import("./scheduler.ts").UnsupportedWorkerError | import("@usine/executor").WorkerCapabilityError, import("@usine/durable/attempt-runtime").AttemptRuntime | import("@usine/agents/runtime").ClaudeLoginLock | import("./current-instance/current-instance.ts").CurrentInstance | import("@usine/github/github-app").GitHubApp | import("@usine/engine/trigger-condition").TriggerCondition>;
|
|
8
12
|
//# sourceMappingURL=exe-dev.d.ts.map
|
package/dist/exe-dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exe-dev.d.ts","sourceRoot":"","sources":["../src/exe-dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"exe-dev.d.ts","sourceRoot":"","sources":["../src/exe-dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAG/B;;;;GAIG;AACH,eAAO,MAAM,KAAK,sBACG,iBAAiB,UAC5B,WAAW,UACX,aAAa,CAAC,SAAS,CAAC,WACvB,qBAAqB,m/CAK/B,CAAC"}
|
package/dist/exe-dev.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { NodeServices } from "@effect/platform-node";
|
|
2
2
|
import { layer as exeDevExecutorLayer } from "@usine/executor/exe-dev";
|
|
3
|
-
import { CredentialGrantMinutes } from "@usine/executor/exe-dev";
|
|
4
3
|
import { layer as localEngineLayer } from "@usine/engine/local-sqlite";
|
|
5
4
|
import { Layer } from "effect";
|
|
6
5
|
import { stepExecutorLayer } from "./scheduler.js";
|
|
7
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Provides the full engine and `WorkerStatus` for exe.dev Workers. Requires `GitHubApp`,
|
|
8
|
+
* `TriggerCondition`, `AttemptRuntime` (built before the engine), `ClaudeLoginLock`, and
|
|
9
|
+
* `CurrentInstance`.
|
|
10
|
+
*/
|
|
8
11
|
export const layer = (instanceDirectory, config, brains, options) => {
|
|
9
|
-
const executor = exeDevExecutorLayer(
|
|
10
|
-
...options,
|
|
11
|
-
credentialGrantMinutes: options.credentialGrantMinutes ??
|
|
12
|
-
CredentialGrantMinutes.make(config.settings.maxAttemptMinutes + 5),
|
|
13
|
-
}).pipe(Layer.provide(NodeServices.layer));
|
|
12
|
+
const executor = exeDevExecutorLayer(options).pipe(Layer.provide(NodeServices.layer));
|
|
14
13
|
const stepExecutor = stepExecutorLayer(config, brains).pipe(Layer.provide(executor));
|
|
15
|
-
return localEngineLayer(instanceDirectory).pipe(Layer.
|
|
14
|
+
return localEngineLayer(instanceDirectory).pipe(Layer.provideMerge(stepExecutor));
|
|
16
15
|
};
|
|
17
16
|
//# sourceMappingURL=exe-dev.js.map
|
package/dist/exe-dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exe-dev.js","sourceRoot":"","sources":["../src/exe-dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,KAAK,IAAI,mBAAmB,
|
|
1
|
+
{"version":3,"file":"exe-dev.js","sourceRoot":"","sources":["../src/exe-dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,KAAK,IAAI,mBAAmB,EAA8B,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,iBAAoC,EACpC,MAAmB,EACnB,MAAgC,EAChC,OAA8B,EAC9B,EAAE;IACF,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACtF,MAAM,YAAY,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AACpF,CAAC,CAAC"}
|
package/dist/idle-triggers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
2
|
import { PollingTriggers } from "./polling-triggers.ts";
|
|
3
3
|
import { ScheduleTriggers } from "./schedule-triggers.ts";
|
|
4
|
-
/** Trigger services that never poll or tick, for
|
|
4
|
+
/** Trigger services that never poll or tick, for an instance that still needs setup. */
|
|
5
5
|
export declare const idleTriggersLayer: Layer.Layer<PollingTriggers | ScheduleTriggers, never, never>;
|
|
6
6
|
//# sourceMappingURL=idle-triggers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idle-triggers.d.ts","sourceRoot":"","sources":["../src/idle-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAiB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzE,
|
|
1
|
+
{"version":3,"file":"idle-triggers.d.ts","sourceRoot":"","sources":["../src/idle-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAiB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzE,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,+DAkC7B,CAAC"}
|
package/dist/idle-triggers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Layer, Option } from "effect";
|
|
2
2
|
import { PollCycle, PollingTriggers } from "./polling-triggers.js";
|
|
3
3
|
import { ScheduleCycle, ScheduleTriggers } from "./schedule-triggers.js";
|
|
4
|
-
/** Trigger services that never poll or tick, for
|
|
4
|
+
/** Trigger services that never poll or tick, for an instance that still needs setup. */
|
|
5
5
|
export const idleTriggersLayer = Layer.mergeAll(Layer.succeed(PollingTriggers)({
|
|
6
6
|
hint: () => Effect.void,
|
|
7
7
|
latest: Effect.succeed(Option.none()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idle-triggers.js","sourceRoot":"","sources":["../src/idle-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzE,
|
|
1
|
+
{"version":3,"file":"idle-triggers.js","sourceRoot":"","sources":["../src/idle-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzE,wFAAwF;AACxF,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAC7C,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI;IACvB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,EAAE,GAAG,EAAE,CACT,MAAM,CAAC,OAAO,CACZ,IAAI,SAAS,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE;KAC1B,CAAC,CACH;IACH,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK;CACxB,CAAC,EACF,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,EAAE,GAAG,EAAE,CACT,MAAM,CAAC,OAAO,CACZ,IAAI,aAAa,CAAC;QAChB,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE;KAC1B,CAAC,CACH;IACH,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK;CACxB,CAAC,CACH,CAAC"}
|
|
@@ -14,9 +14,12 @@ export declare class LabelPreflightFinding extends LabelPreflightFinding_base {
|
|
|
14
14
|
export interface LabelReconciliation {
|
|
15
15
|
readonly labels: ReadonlyArray<StoredRepositoryLabel>;
|
|
16
16
|
readonly findings: ReadonlyArray<LabelPreflightFinding>;
|
|
17
|
-
/**
|
|
17
|
+
/** Whether a label was created, so the poll cursor must drop its catalog ETag. */
|
|
18
18
|
readonly catalogChanged: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The time a creation rate limit asks the next cycle to wait until. This cycle's triggers still
|
|
21
|
+
* run.
|
|
22
|
+
*/
|
|
20
23
|
readonly nextPollAt: Option.Option<DateTime.Utc>;
|
|
21
24
|
}
|
|
22
25
|
declare const LabelReconciler_base: Context.ServiceClass<LabelReconciler, "@usine/orchestrator/LabelReconciler", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-reconciler.d.ts","sourceRoot":"","sources":["../src/label-reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,aAAa,EAAmB,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,2CAA2C,CAAC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AAa,CAAC,aAAa,CAAC,EACtC,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,KAC3C,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;;AAR3C,wFAAwF;AACxF,qBAAa,eAAgB,SAAQ,oBASK;IACxC,MAAM,CAAC,QAAQ,CAAC,KAAK,yDAkGnB;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-reconciler.js","sourceRoot":"","sources":["../src/label-reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAElF,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,KAAK,CACrD,2CAA2C,CAC5C,CAAC;IACA,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,MAAM,CAAC,cAAc;IAC/B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;
|
|
1
|
+
{"version":3,"file":"label-reconciler.js","sourceRoot":"","sources":["../src/label-reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAsB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM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,KAAK,CAAC,IAAI;qBAClB,CAAC,CAAC;gBACL,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAClE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAgC,CAAC;YACxF,CAAC,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;CACH"}
|
package/dist/local.d.ts
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
import { BrainSpec } from "@usine/core/agent/brain";
|
|
2
|
-
import type { LoadedInstance } from "@usine/config/instance";
|
|
1
|
+
import type { BrainSpec } from "@usine/core/agent/brain";
|
|
3
2
|
import type { UsineConfig } from "@usine/config/factory";
|
|
4
|
-
import { ConfigParser } from "@usine/config/parser";
|
|
5
3
|
import type { InstanceDirectory } from "@usine/core/instance";
|
|
6
4
|
import { type LocalExecutorOptions } from "@usine/executor/local";
|
|
7
|
-
import { GitHubItemWriter } from "@usine/github/item-writer";
|
|
8
|
-
import { GitHubPolling } from "@usine/github/polling";
|
|
9
5
|
import { Layer } from "effect";
|
|
10
|
-
import { LabelReconciler } from "./label-reconciler.ts";
|
|
11
|
-
import { Operator, OperatorObservation } from "./operator/operator.ts";
|
|
12
|
-
import { Orchestrator } from "./orchestrator.ts";
|
|
13
|
-
import { PollingTriggers } from "./polling-triggers.ts";
|
|
14
|
-
import { ScheduleTriggers } from "./schedule-triggers.ts";
|
|
15
|
-
/** The full engine composition for local Workers. Supply the roster’s brains for startup preflight and provide the credential provider. */
|
|
16
|
-
export declare const layer: (instanceDirectory: InstanceDirectory, config: UsineConfig, brains: ReadonlyArray<BrainSpec>, options: Omit<LocalExecutorOptions, "instanceDirectory" | "runHost"> & Partial<Pick<LocalExecutorOptions, "runHost">>) => Layer.Layer<import("@usine/engine/cursor").CursorStore | import("@usine/engine/cycle-budget").CycleBudgets | import("@usine/engine/item-projection").ItemProjectionReader | import("@usine/engine/item-projection").ItemProjectionWriter | import("@usine/engine/loop-control").LoopControl | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionReader | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionWriter | import("@usine/engine/engine").RunEngine | import("@usine/engine/run-reader").RunReader, import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("./scheduler.ts").UnsupportedWorkerError | import("@usine/executor").WorkerCapabilityError, import("@usine/executor").CredentialProvider>;
|
|
17
|
-
/** A read-only operator composition for when trigger credentials are not available yet. */
|
|
18
|
-
export declare const operatorObservationLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<OperatorObservation, import("@usine/engine/engine").AttemptCancellationError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError, never>;
|
|
19
6
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* The caller supplies the GitHub credentials.
|
|
7
|
+
* Provides the full engine and `WorkerStatus` for local Workers. Requires the credential provider,
|
|
8
|
+
* `GitHubApp`, `TriggerCondition`, `AttemptRuntime`, `ClaudeLoginLock`, and `CurrentInstance`.
|
|
23
9
|
*/
|
|
24
|
-
export declare const
|
|
10
|
+
export declare const layer: (instanceDirectory: InstanceDirectory, config: UsineConfig, brains: ReadonlyArray<BrainSpec>, options: Omit<LocalExecutorOptions, "instanceDirectory">) => Layer.Layer<import("@usine/engine/board-moves").BoardMoves | import("@usine/engine/cursor").CursorStore | import("@usine/engine/cycle-budget").CycleBudgets | import("@usine/engine/item-projection").ItemProjectionReader | import("@usine/engine/item-projection").ItemProjectionWriter | import("@usine/engine/loop-control").LoopControl | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionReader | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionWriter | import("@usine/engine/engine").RunEngine | import("@usine/engine/run-reader").RunReader | import("@usine/engine/step-executor").StepExecutor | import("./worker-status.ts").WorkerStatus, import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("@usine/engine/engine").RunRetryBlockedError | import("./scheduler.ts").UnsupportedWorkerError | import("@usine/executor").WorkerCapabilityError, import("@usine/durable/attempt-runtime").AttemptRuntime | import("@usine/agents/runtime").ClaudeLoginLock | import("@usine/executor").CredentialProvider | import("./current-instance/current-instance.ts").CurrentInstance | import("@usine/github/github-app").GitHubApp | import("@usine/engine/trigger-condition").TriggerCondition>;
|
|
25
11
|
//# sourceMappingURL=local.d.ts.map
|
package/dist/local.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAA+B,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAG/B;;;GAGG;AACH,eAAO,MAAM,KAAK,sBACG,iBAAiB,UAC5B,WAAW,UACX,aAAa,CAAC,SAAS,CAAC,WACvB,IAAI,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,kiDAOzD,CAAC"}
|
package/dist/local.js
CHANGED
|
@@ -1,53 +1,15 @@
|
|
|
1
|
-
import { BrainSpec } from "@usine/core/agent/brain";
|
|
2
1
|
import { NodeServices } from "@effect/platform-node";
|
|
3
|
-
import { ConfigParser } from "@usine/config/parser";
|
|
4
2
|
import { layer as localExecutorLayer } from "@usine/executor/local";
|
|
5
|
-
import { layer as localEngineLayer
|
|
6
|
-
import { MarcbachmannCelLayer } from "@usine/expression/marcbachmann-cel";
|
|
7
|
-
import { GitHubApp } from "@usine/github/github-app";
|
|
8
|
-
import { GitHubItemWriter } from "@usine/github/item-writer";
|
|
9
|
-
import { GitHubLabelWriter } from "@usine/github/label-writer";
|
|
10
|
-
import { GitHubPolling } from "@usine/github/polling";
|
|
11
|
-
import { executableCommand } from "@usine/run-host/executable";
|
|
3
|
+
import { layer as localEngineLayer } from "@usine/engine/local-sqlite";
|
|
12
4
|
import { Layer } from "effect";
|
|
13
|
-
import { FetchHttpClient } from "effect/unstable/http";
|
|
14
|
-
import { gitHubCredentialLayer } from "./credentials.js";
|
|
15
|
-
import { idleTriggersLayer } from "./idle-triggers.js";
|
|
16
|
-
import { LabelReconciler } from "./label-reconciler.js";
|
|
17
|
-
import { Operator, OperatorObservation } from "./operator/operator.js";
|
|
18
|
-
import { Orchestrator } from "./orchestrator.js";
|
|
19
|
-
import { PollingTriggers } from "./polling-triggers.js";
|
|
20
|
-
import { ScheduleTriggers } from "./schedule-triggers.js";
|
|
21
5
|
import { stepExecutorLayer } from "./scheduler.js";
|
|
22
|
-
/** The full engine composition for local Workers. Supply the roster’s brains for startup preflight and provide the credential provider. */
|
|
23
|
-
export const layer = (instanceDirectory, config, brains, options) => {
|
|
24
|
-
const executor = localExecutorLayer({
|
|
25
|
-
runHost: options.runHost ?? executableCommand(),
|
|
26
|
-
...options,
|
|
27
|
-
instanceDirectory,
|
|
28
|
-
}).pipe(Layer.provide(NodeServices.layer));
|
|
29
|
-
const stepExecutor = stepExecutorLayer(config, brains).pipe(Layer.provide(executor));
|
|
30
|
-
return localEngineLayer(instanceDirectory).pipe(Layer.provide(stepExecutor));
|
|
31
|
-
};
|
|
32
|
-
/** A read-only operator composition for when trigger credentials are not available yet. */
|
|
33
|
-
export const operatorObservationLayer = (instanceDirectory) => OperatorObservation.layer.pipe(Layer.provide(Layer.mergeAll(localObservationLayer(instanceDirectory), idleTriggersLayer)));
|
|
34
6
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* The caller supplies the GitHub credentials.
|
|
7
|
+
* Provides the full engine and `WorkerStatus` for local Workers. Requires the credential provider,
|
|
8
|
+
* `GitHubApp`, `TriggerCondition`, `AttemptRuntime`, `ClaudeLoginLock`, and `CurrentInstance`.
|
|
38
9
|
*/
|
|
39
|
-
export const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const polling = GitHubPolling.layer.pipe(Layer.provide(app), Layer.provide(FetchHttpClient.layer), Layer.provide(NodeServices.layer));
|
|
44
|
-
const itemWriter = GitHubItemWriter.layer.pipe(Layer.provide(app), Layer.provide(FetchHttpClient.layer));
|
|
45
|
-
const labelWriter = GitHubLabelWriter.layer.pipe(Layer.provide(app), Layer.provide(FetchHttpClient.layer));
|
|
46
|
-
const labelReconciler = LabelReconciler.layer.pipe(Layer.provide(labelWriter));
|
|
47
|
-
const parser = ConfigParser.layer.pipe(Layer.provide(MarcbachmannCelLayer));
|
|
48
|
-
const dependencies = Layer.mergeAll(engine, itemWriter, labelReconciler, MarcbachmannCelLayer, parser, polling);
|
|
49
|
-
const triggers = Layer.mergeAll(PollingTriggers.layer, ScheduleTriggers.layer).pipe(Layer.provide(dependencies));
|
|
50
|
-
const services = Layer.mergeAll(Operator.layer, Orchestrator.layer).pipe(Layer.provide(Layer.mergeAll(dependencies, triggers)));
|
|
51
|
-
return Layer.mergeAll(dependencies, triggers, services);
|
|
10
|
+
export const layer = (instanceDirectory, config, brains, options) => {
|
|
11
|
+
const executor = localExecutorLayer({ ...options, instanceDirectory }).pipe(Layer.provide(NodeServices.layer));
|
|
12
|
+
const stepExecutor = stepExecutorLayer(config, brains).pipe(Layer.provide(executor));
|
|
13
|
+
return localEngineLayer(instanceDirectory).pipe(Layer.provideMerge(stepExecutor));
|
|
52
14
|
};
|
|
53
15
|
//# sourceMappingURL=local.js.map
|
package/dist/local.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,KAAK,IAAI,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,iBAAoC,EACpC,MAAmB,EACnB,MAAgC,EAChC,OAAwD,EACxD,EAAE;IACF,MAAM,QAAQ,GAAG,kBAAkB,CAAC,EAAE,GAAG,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC,IAAI,CACzE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAClC,CAAC;IACF,MAAM,YAAY,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AACpF,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ManagedRepo } from "@usine/config/factory";
|
|
2
|
+
import type { LoadedInstance } from "@usine/config/instance";
|
|
3
|
+
import type { LoopFile } from "@usine/config/loop";
|
|
4
|
+
import type { ItemProjection } from "@usine/engine/item-projection";
|
|
5
|
+
import { ExpressionEngine } from "@usine/expression/expression-engine";
|
|
6
|
+
import { Context, Effect, Layer } from "effect";
|
|
7
|
+
/** A Loop whose trigger currently matches one stored Item. */
|
|
8
|
+
export interface LoopItemMatch {
|
|
9
|
+
readonly loop: LoopFile;
|
|
10
|
+
readonly item: ItemProjection;
|
|
11
|
+
}
|
|
12
|
+
declare const LoopMatches_base: Context.ServiceClass<LoopMatches, "@usine/orchestrator/LoopMatches", {
|
|
13
|
+
/**
|
|
14
|
+
* Returns each issue and pull request Loop that applies to `repository`, paired with the
|
|
15
|
+
* `items` its trigger matches. Includes paused Loops; excludes gone Items and Loops whose `if:`
|
|
16
|
+
* fails.
|
|
17
|
+
*/
|
|
18
|
+
readonly matching: (instance: LoadedInstance, repository: ManagedRepo, items: ReadonlyArray<ItemProjection>) => Effect.Effect<ReadonlyArray<LoopItemMatch>>;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* The stored Items each Loop's trigger currently matches, evaluated as the poll does: stream and
|
|
22
|
+
* selector, then `if:` against the stored payload slice.
|
|
23
|
+
*/
|
|
24
|
+
export declare class LoopMatches extends LoopMatches_base {
|
|
25
|
+
static readonly layer: Layer.Layer<LoopMatches, never, ExpressionEngine>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=loop-matches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-matches.d.ts","sourceRoot":"","sources":["../src/loop-matches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAgB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AAG9E,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;;IASG;;;;OAIG;uBACgB,CACjB,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,WAAW,EACvB,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,KACjC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;;AAhBpD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,gBAcK;IACpC,MAAM,CAAC,QAAQ,CAAC,KAAK,oDAkFnB;CACH"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { matchesSelector } from "@usine/config/selector";
|
|
2
|
+
import { ExpressionEngine } from "@usine/expression/expression-engine";
|
|
3
|
+
import { Array as Arr, Context, Effect, Layer, Option, Result } from "effect";
|
|
4
|
+
import { evaluateTriggerOnEach } from "./polling/loop-evaluation.js";
|
|
5
|
+
/**
|
|
6
|
+
* The stored Items each Loop's trigger currently matches, evaluated as the poll does: stream and
|
|
7
|
+
* selector, then `if:` against the stored payload slice.
|
|
8
|
+
*/
|
|
9
|
+
export class LoopMatches extends Context.Service()("@usine/orchestrator/LoopMatches") {
|
|
10
|
+
static layer = Layer.effect(LoopMatches, Effect.gen(function* () {
|
|
11
|
+
const expressions = yield* ExpressionEngine;
|
|
12
|
+
const matching = Effect.fn("LoopMatches.matching")(function* (instance, repository, items) {
|
|
13
|
+
yield* Effect.annotateCurrentSpan({ repository: repository.name, items: items.length });
|
|
14
|
+
const loops = instance.loops.filter((loop) => loop.trigger.on !== "schedule" && matchesSelector(loop.selector, repository));
|
|
15
|
+
const present = items.filter(({ goneAt }) => Option.isNone(goneAt));
|
|
16
|
+
// Each Loop's trigger is checked once and evaluated on all of its stream's Items in one
|
|
17
|
+
// call, because the overview and desk match every Loop on every Board Item on each read
|
|
18
|
+
// (#464).
|
|
19
|
+
const matched = new Map();
|
|
20
|
+
let failures = 0;
|
|
21
|
+
for (const loop of loops) {
|
|
22
|
+
const candidates = present.filter(({ source }) => source === loop.trigger.on);
|
|
23
|
+
if (candidates.length === 0)
|
|
24
|
+
continue;
|
|
25
|
+
const evaluated = yield* Effect.result(evaluateTriggerOnEach(loop, repository, candidates.map(({ payload }) => payload)));
|
|
26
|
+
if (Result.isFailure(evaluated)) {
|
|
27
|
+
failures += candidates.length;
|
|
28
|
+
yield* Effect.logDebug("Loop trigger could not be checked; it matches no stored Item", {
|
|
29
|
+
repository: repository.name,
|
|
30
|
+
loop: loop.name,
|
|
31
|
+
items: candidates.length,
|
|
32
|
+
errorTag: evaluated.failure._tag,
|
|
33
|
+
message: evaluated.failure.message,
|
|
34
|
+
});
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const hits = new Set();
|
|
38
|
+
for (const [item, result] of Arr.zip(candidates, evaluated.success)) {
|
|
39
|
+
if (Result.isSuccess(result)) {
|
|
40
|
+
if (result.success)
|
|
41
|
+
hits.add(item);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
failures += 1;
|
|
45
|
+
yield* Effect.logDebug("Loop trigger could not be evaluated on a stored Item", {
|
|
46
|
+
repository: repository.name,
|
|
47
|
+
loop: loop.name,
|
|
48
|
+
item: item.number,
|
|
49
|
+
errorTag: result.failure._tag,
|
|
50
|
+
message: result.failure.message,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
matched.set(loop, hits);
|
|
54
|
+
}
|
|
55
|
+
const matches = [];
|
|
56
|
+
for (const item of present) {
|
|
57
|
+
for (const loop of loops) {
|
|
58
|
+
if (matched.get(loop)?.has(item) === true)
|
|
59
|
+
matches.push({ loop, item });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
yield* Effect.logDebug("Matched Loop triggers against stored Items", {
|
|
63
|
+
repository: repository.name,
|
|
64
|
+
loops: loops.length,
|
|
65
|
+
items: items.length,
|
|
66
|
+
matches: matches.length,
|
|
67
|
+
failures,
|
|
68
|
+
});
|
|
69
|
+
return matches;
|
|
70
|
+
}, Effect.provideService(ExpressionEngine, expressions));
|
|
71
|
+
return { matching };
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=loop-matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-matches.js","sourceRoot":"","sources":["../src/loop-matches.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQrE;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAc7C,CAAC,iCAAiC,CAAC;IACpC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAClC,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAChD,QAAQ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