@usine/engine 0.1.0 → 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.
Files changed (156) hide show
  1. package/README.md +39 -12
  2. package/dist/cursor/{store.d.ts → cursor.d.ts} +9 -7
  3. package/dist/cursor/cursor.d.ts.map +1 -0
  4. package/dist/cursor/{store.js → cursor.js} +8 -7
  5. package/dist/cursor/cursor.js.map +1 -0
  6. package/dist/cycle-budget/cycle-budget.d.ts +25 -0
  7. package/dist/cycle-budget/cycle-budget.d.ts.map +1 -0
  8. package/dist/cycle-budget/cycle-budget.js +117 -0
  9. package/dist/cycle-budget/cycle-budget.js.map +1 -0
  10. package/dist/cycle-budget/model.d.ts +26 -0
  11. package/dist/cycle-budget/model.d.ts.map +1 -0
  12. package/dist/cycle-budget/model.js +20 -0
  13. package/dist/cycle-budget/model.js.map +1 -0
  14. package/dist/cycle-budget/queries.d.ts +27 -0
  15. package/dist/cycle-budget/queries.d.ts.map +1 -0
  16. package/dist/cycle-budget/queries.js +175 -0
  17. package/dist/cycle-budget/queries.js.map +1 -0
  18. package/dist/database/database.d.ts +1 -1
  19. package/dist/database/database.d.ts.map +1 -1
  20. package/dist/database/local-sqlite.d.ts +32 -12
  21. package/dist/database/local-sqlite.d.ts.map +1 -1
  22. package/dist/database/local-sqlite.js +121 -16
  23. package/dist/database/local-sqlite.js.map +1 -1
  24. package/dist/database/schema.d.ts +302 -9
  25. package/dist/database/schema.d.ts.map +1 -1
  26. package/dist/database/schema.js +69 -12
  27. package/dist/database/schema.js.map +1 -1
  28. package/dist/engine/engine.d.ts +59 -0
  29. package/dist/engine/engine.d.ts.map +1 -0
  30. package/dist/{engine.js → engine/engine.js} +80 -32
  31. package/dist/engine/engine.js.map +1 -0
  32. package/dist/engine/error.d.ts +45 -0
  33. package/dist/engine/error.d.ts.map +1 -0
  34. package/dist/engine/error.js +49 -0
  35. package/dist/engine/error.js.map +1 -0
  36. package/dist/engine/lifecycle.d.ts +112 -0
  37. package/dist/engine/lifecycle.d.ts.map +1 -0
  38. package/dist/engine/lifecycle.js +132 -0
  39. package/dist/engine/lifecycle.js.map +1 -0
  40. package/dist/engine/shutdown.d.ts +12 -0
  41. package/dist/engine/shutdown.d.ts.map +1 -0
  42. package/dist/engine/shutdown.js +10 -0
  43. package/dist/engine/shutdown.js.map +1 -0
  44. package/dist/engine/submission.d.ts +58 -0
  45. package/dist/engine/submission.d.ts.map +1 -0
  46. package/dist/engine/submission.js +54 -0
  47. package/dist/engine/submission.js.map +1 -0
  48. package/dist/item-projection/{service.d.ts → item-projection.d.ts} +6 -6
  49. package/dist/item-projection/item-projection.d.ts.map +1 -0
  50. package/dist/item-projection/{service.js → item-projection.js} +7 -5
  51. package/dist/item-projection/item-projection.js.map +1 -0
  52. package/dist/item-projection/model.d.ts +2 -5
  53. package/dist/item-projection/model.d.ts.map +1 -1
  54. package/dist/item-projection/model.js +5 -5
  55. package/dist/item-projection/model.js.map +1 -1
  56. package/dist/loop-control/loop-control.d.ts +21 -0
  57. package/dist/loop-control/loop-control.d.ts.map +1 -0
  58. package/dist/{loop-control.js → loop-control/loop-control.js} +7 -5
  59. package/dist/loop-control/loop-control.js.map +1 -0
  60. package/dist/loop-control/model.d.ts +10 -0
  61. package/dist/loop-control/model.d.ts.map +1 -0
  62. package/dist/loop-control/model.js +9 -0
  63. package/dist/loop-control/model.js.map +1 -0
  64. package/dist/repository-label-projection/model.d.ts +12 -3
  65. package/dist/repository-label-projection/model.d.ts.map +1 -1
  66. package/dist/repository-label-projection/model.js +14 -5
  67. package/dist/repository-label-projection/model.js.map +1 -1
  68. package/dist/repository-label-projection/{service.d.ts → repository-label-projection.d.ts} +5 -5
  69. package/dist/repository-label-projection/repository-label-projection.d.ts.map +1 -0
  70. package/dist/repository-label-projection/{service.js → repository-label-projection.js} +17 -7
  71. package/dist/repository-label-projection/repository-label-projection.js.map +1 -0
  72. package/dist/run-reader/model.d.ts +46 -0
  73. package/dist/run-reader/model.d.ts.map +1 -0
  74. package/dist/run-reader/model.js +44 -0
  75. package/dist/run-reader/model.js.map +1 -0
  76. package/dist/run-reader/run-reader.d.ts +29 -0
  77. package/dist/run-reader/run-reader.d.ts.map +1 -0
  78. package/dist/run-reader/run-reader.js +44 -0
  79. package/dist/run-reader/run-reader.js.map +1 -0
  80. package/dist/step-executor.d.ts +36 -12
  81. package/dist/step-executor.d.ts.map +1 -1
  82. package/dist/step-executor.js +22 -5
  83. package/dist/step-executor.js.map +1 -1
  84. package/dist/store/codec.d.ts +278 -40
  85. package/dist/store/codec.d.ts.map +1 -1
  86. package/dist/store/codec.js +72 -44
  87. package/dist/store/codec.js.map +1 -1
  88. package/dist/store/queries.d.ts +49 -16
  89. package/dist/store/queries.d.ts.map +1 -1
  90. package/dist/store/queries.js +104 -91
  91. package/dist/store/queries.js.map +1 -1
  92. package/dist/store/store.d.ts +44 -26
  93. package/dist/store/store.d.ts.map +1 -1
  94. package/dist/store/store.js +199 -128
  95. package/dist/store/store.js.map +1 -1
  96. package/dist/store/transcript.d.ts +9 -0
  97. package/dist/store/transcript.d.ts.map +1 -0
  98. package/dist/store/transcript.js +71 -0
  99. package/dist/store/transcript.js.map +1 -0
  100. package/dist/transcript.d.ts +86 -0
  101. package/dist/transcript.d.ts.map +1 -0
  102. package/dist/transcript.js +77 -0
  103. package/dist/transcript.js.map +1 -0
  104. package/dist/workflow/admission.d.ts +13 -0
  105. package/dist/workflow/admission.d.ts.map +1 -0
  106. package/dist/workflow/admission.js +55 -0
  107. package/dist/workflow/admission.js.map +1 -0
  108. package/dist/workflow/command.d.ts +13 -0
  109. package/dist/workflow/command.d.ts.map +1 -0
  110. package/dist/workflow/command.js +17 -0
  111. package/dist/workflow/command.js.map +1 -0
  112. package/dist/workflow/workflow.d.ts +18 -0
  113. package/dist/workflow/workflow.d.ts.map +1 -0
  114. package/dist/workflow/workflow.js +108 -0
  115. package/dist/workflow/workflow.js.map +1 -0
  116. package/drizzle/20260903091940_queued_approved_runs/migration.sql +3 -0
  117. package/drizzle/20260903091940_queued_approved_runs/snapshot.json +1147 -0
  118. package/drizzle/20260905150403_item_cycle_budgets/migration.sql +58 -0
  119. package/drizzle/20260905150403_item_cycle_budgets/snapshot.json +1417 -0
  120. package/drizzle/20260905174009_item_run_history/migration.sql +1 -0
  121. package/drizzle/20260905174009_item_run_history/snapshot.json +1431 -0
  122. package/drizzle/20260912111855_operator_intervention/migration.sql +42 -0
  123. package/drizzle/20260912111855_operator_intervention/snapshot.json +1461 -0
  124. package/package.json +41 -5
  125. package/dist/cursor/model.d.ts +0 -5
  126. package/dist/cursor/model.d.ts.map +0 -1
  127. package/dist/cursor/model.js +0 -4
  128. package/dist/cursor/model.js.map +0 -1
  129. package/dist/cursor/store.d.ts.map +0 -1
  130. package/dist/cursor/store.js.map +0 -1
  131. package/dist/engine.d.ts +0 -39
  132. package/dist/engine.d.ts.map +0 -1
  133. package/dist/engine.js.map +0 -1
  134. package/dist/index.d.ts +0 -20
  135. package/dist/index.d.ts.map +0 -1
  136. package/dist/index.js +0 -20
  137. package/dist/index.js.map +0 -1
  138. package/dist/item-projection/service.d.ts.map +0 -1
  139. package/dist/item-projection/service.js.map +0 -1
  140. package/dist/loop-control.d.ts +0 -16
  141. package/dist/loop-control.d.ts.map +0 -1
  142. package/dist/loop-control.js.map +0 -1
  143. package/dist/model.d.ts +0 -185
  144. package/dist/model.d.ts.map +0 -1
  145. package/dist/model.js +0 -174
  146. package/dist/model.js.map +0 -1
  147. package/dist/repository-label-projection/service.d.ts.map +0 -1
  148. package/dist/repository-label-projection/service.js.map +0 -1
  149. package/dist/run-reader.d.ts +0 -20
  150. package/dist/run-reader.d.ts.map +0 -1
  151. package/dist/run-reader.js +0 -19
  152. package/dist/run-reader.js.map +0 -1
  153. package/dist/workflow.d.ts +0 -14
  154. package/dist/workflow.d.ts.map +0 -1
  155. package/dist/workflow.js +0 -105
  156. package/dist/workflow.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ import { Context, Effect, Layer, Option } from "effect";
2
+ import { RunId } from "@usine/core/run";
3
+ import { ItemKey } from "@usine/core/item";
4
+ import { RunDatabase } from "../database/database.ts";
5
+ import { ProjectionRevision, RunEvidence, RunSnapshot, RunSummary } from "./model.ts";
6
+ import { TranscriptEntry, TranscriptQuery } from "../transcript.ts";
7
+ import type { RunStoreError } from "../engine/error.ts";
8
+ declare const RunReader_base: Context.ServiceClass<RunReader, "@usine/engine/RunReader", {
9
+ /** Reads a Run's current state, effective task and Agent, Step result, and Attempt history. */
10
+ readonly inspect: (runId: RunId) => Effect.Effect<RunSnapshot, RunStoreError>;
11
+ /** Reads one consistent Run snapshot and every saved transcript entry, in append order without a page limit. */
12
+ readonly evidence: (runId: RunId) => Effect.Effect<RunEvidence, RunStoreError>;
13
+ /** Every open Run plus the newest `closedLimit` settled ones, newest first. */
14
+ readonly list: (options: {
15
+ readonly closedLimit: number;
16
+ }) => Effect.Effect<ReadonlyArray<RunSummary>, RunStoreError>;
17
+ /** Every saved Run for the supplied Items, newest first, including all their Attempts. */
18
+ readonly forItems: (itemKeys: ReadonlyArray<ItemKey>) => Effect.Effect<ReadonlyArray<RunSummary>, RunStoreError>;
19
+ /** `None` means the invalidation row is absent: treat every cached projection as stale. */
20
+ readonly revision: () => Effect.Effect<Option.Option<ProjectionRevision>, RunStoreError>;
21
+ /** Reads the requested portion of one Attempt's saved transcript in append order. */
22
+ readonly transcript: (query: TranscriptQuery) => Effect.Effect<ReadonlyArray<TranscriptEntry>, RunStoreError>;
23
+ }>;
24
+ /** Reads saved Run state and transcripts without starting or recovering execution. */
25
+ export declare class RunReader extends RunReader_base {
26
+ static readonly layer: Layer.Layer<RunReader, never, RunDatabase>;
27
+ }
28
+ export { RunEvidence, RunSnapshot, RunSummary, ProjectionRevision } from "./model.ts";
29
+ //# sourceMappingURL=run-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-reader.d.ts","sourceRoot":"","sources":["../../src/run-reader/run-reader.ts"],"names":[],"mappings":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D;IAC5B,MAAM,CAAC,QAAQ,CAAC,KAAK,6CAA0C;CAChE;AAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Context, Effect, Layer, Option } from "effect";
2
+ import { RunId } from "@usine/core/run";
3
+ import { ItemKey } from "@usine/core/item";
4
+ import { RunDatabase } from "../database/database.js";
5
+ import { ProjectionRevision, RunEvidence, RunSnapshot, RunSummary } from "./model.js";
6
+ import { TranscriptAllQuery, TranscriptEntry, TranscriptQuery } from "../transcript.js";
7
+ import { persistence } from "../store/codec.js";
8
+ import { queriesFor } from "../store/queries.js";
9
+ const makeRunReader = Effect.gen(function* () {
10
+ const database = yield* RunDatabase;
11
+ const queries = queriesFor(database);
12
+ const inspect = Effect.fn("RunReader.inspect")((runId) => queries.snapshot(runId).pipe(persistence("read run")));
13
+ const evidence = Effect.fn("RunReader.evidence")(function* (runId) {
14
+ yield* Effect.annotateCurrentSpan({ runId });
15
+ const evidence = yield* database
16
+ .transaction((transaction) => Effect.gen(function* () {
17
+ const queries = queriesFor(transaction);
18
+ const snapshot = yield* queries.snapshot(runId);
19
+ const transcripts = yield* Effect.forEach(snapshot.attempts, ({ id }) => queries.transcript(new TranscriptAllQuery({ attemptId: id })));
20
+ return new RunEvidence({
21
+ snapshot,
22
+ transcript: transcripts.flat().sort((left, right) => left.sequence - right.sequence),
23
+ });
24
+ }))
25
+ .pipe(persistence("read Run evidence"));
26
+ yield* Effect.logDebug("Run evidence read", {
27
+ runId,
28
+ attempts: evidence.snapshot.attempts.length,
29
+ transcriptRows: evidence.transcript.length,
30
+ });
31
+ return evidence;
32
+ });
33
+ const list = Effect.fn("RunReader.list")((options) => queries.runSummaries(options.closedLimit).pipe(persistence("list runs")));
34
+ const revision = Effect.fn("RunReader.revision")(() => queries.revision().pipe(persistence("read projection revision")));
35
+ const forItems = Effect.fn("RunReader.forItems")((itemKeys) => queries.itemRunSummaries(itemKeys).pipe(persistence("read Item Run histories")));
36
+ const transcript = Effect.fn("RunReader.transcript")((query) => queries.transcript(query).pipe(persistence("read Attempt transcript")));
37
+ return { inspect, evidence, list, forItems, revision, transcript };
38
+ });
39
+ /** Reads saved Run state and transcripts without starting or recovering execution. */
40
+ export class RunReader extends Context.Service()("@usine/engine/RunReader") {
41
+ static layer = Layer.effect(RunReader, makeRunReader);
42
+ }
43
+ export { RunEvidence, RunSnapshot, RunSummary, ProjectionRevision } from "./model.js";
44
+ //# sourceMappingURL=run-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-reader.js","sourceRoot":"","sources":["../../src/run-reader/run-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAY,EAAE,EAAE,CAC9D,OAAO,CAAC,QAAQ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,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,20 +1,44 @@
1
- import type { Attempt, AttemptChannel, AttemptFailure, StepResult, Worker } from "@usine/core";
2
- import { Context, Effect } from "effect";
3
- import type { StepExecution, Submission } from "./model.ts";
4
- /** A worker-capacity reservation held while one Attempt runs. */
1
+ import { Agent } from "@usine/core/agent";
2
+ import { Attempt, type AttemptId } from "@usine/core/attempt";
3
+ import { Event } from "@usine/core/event";
4
+ import { Run } from "@usine/core/run";
5
+ import { Step } from "@usine/core/step";
6
+ import { Schema, Context, Effect } from "effect";
7
+ import type * as AttemptChannel from "@usine/core/attempt/channel";
8
+ import type { AttemptFailure } from "@usine/core/attempt/failure";
9
+ import type { WorkerName } from "@usine/core/worker";
10
+ import type { StepResult } from "@usine/core/step/result";
11
+ import type { Submission } from "./engine/submission.ts";
12
+ declare const StepExecution_base: Schema.Class<StepExecution, Schema.Struct<{
13
+ readonly attempt: typeof Attempt;
14
+ readonly event: typeof Event;
15
+ readonly run: typeof Run;
16
+ readonly step: typeof Step;
17
+ readonly repository: Schema.brand<Schema.String, "RepositoryName">;
18
+ readonly revision: Schema.brand<Schema.String, "RepositoryRevision">;
19
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
20
+ readonly agent: typeof Agent;
21
+ readonly parentModel: Schema.Option<Schema.brand<Schema.String, "ModelId">>;
22
+ }>, {}>;
23
+ /** The saved Event, effective task and Agent, and Step being tried in one Attempt. */
24
+ export declare class StepExecution extends StepExecution_base {
25
+ }
26
+ /** A reservation of one Worker's capacity for the length of an Attempt. Call `release` when the Attempt ends. */
5
27
  export interface WorkerLease {
6
- readonly worker: Worker.Name;
28
+ readonly worker: WorkerName;
7
29
  readonly release: Effect.Effect<void>;
8
30
  }
9
31
  declare const StepExecutor_base: Context.ServiceClass<StepExecutor, "@usine/engine/StepExecutor", {
10
- readonly interrupt: (attemptId: Attempt.AttemptId) => Effect.Effect<void, AttemptFailure.AttemptFailure>;
11
- readonly reserve: (submission: Submission) => Effect.Effect<WorkerLease, AttemptFailure.AttemptFailure>;
12
- readonly execute: (execution: StepExecution, io: AttemptChannel.Sink) => Effect.Effect<StepResult.StepResult, AttemptFailure.AttemptFailure>;
32
+ /** Requests that the identified Attempt stop its current work. */
33
+ readonly interrupt: (attemptId: AttemptId) => Effect.Effect<void, AttemptFailure>;
34
+ /** Sends a nonterminal operator action to a live session in the identified Attempt. */
35
+ readonly intervene: (attemptId: AttemptId, intervention: AttemptChannel.Intervention) => Effect.Effect<void, AttemptFailure>;
36
+ /** Waits for Worker capacity; the returned lease must be released after execution or cancellation. */
37
+ readonly reserve: (submission: Submission) => Effect.Effect<WorkerLease, AttemptFailure>;
38
+ /** Runs the reserved Attempt, recording channel activity through `io`, and waits for its result. */
39
+ readonly execute: (execution: StepExecution, io: AttemptChannel.Sink) => Effect.Effect<StepResult, AttemptFailure>;
13
40
  }>;
14
- /**
15
- * Port for one Attempt. #29 supplies the worker-backed adapter; #26 exercises
16
- * the durable engine against implementations of this interface.
17
- */
41
+ /** Runs one Attempt on a Worker: reserve capacity, execute the step, interrupt on cancel. */
18
42
  export declare class StepExecutor extends StepExecutor_base {
19
43
  }
20
44
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"step-executor.d.ts","sourceRoot":"","sources":["../src/step-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACvC;;wBASuB,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MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACvC;;IAMG,kEAAkE;wBAC9C,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC;IACjF,uFAAuF;wBACnE,CAClB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,cAAc,CAAC,YAAY,KACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC;IACxC,sGAAsG;sBACpF,CAAC,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC;IACxF,oGAAoG;sBAClF,CAChB,SAAS,EAAE,aAAa,EACxB,EAAE,EAAE,cAAc,CAAC,IAAI,KACpB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC;;AAjBlD,6FAA6F;AAC7F,qBAAa,YAAa,SAAQ,iBAkBD;CAAG"}
@@ -1,8 +1,25 @@
1
- import { Context, Effect } from "effect";
2
- /**
3
- * Port for one Attempt. #29 supplies the worker-backed adapter; #26 exercises
4
- * the durable engine against implementations of this interface.
5
- */
1
+ import { Agent } from "@usine/core/agent";
2
+ import { ModelId } from "@usine/core/agent/brain";
3
+ import { Attempt, AttemptTask } from "@usine/core/attempt";
4
+ import { Event } from "@usine/core/event";
5
+ import { RepositoryName, RepositoryRevision } from "@usine/core/repository";
6
+ import { Run } from "@usine/core/run";
7
+ import { Step } from "@usine/core/step";
8
+ import { Schema, Context, Effect } from "effect";
9
+ /** The saved Event, effective task and Agent, and Step being tried in one Attempt. */
10
+ export class StepExecution extends Schema.Class("@usine/engine/StepExecution")({
11
+ attempt: Attempt,
12
+ event: Event,
13
+ run: Run,
14
+ step: Step,
15
+ repository: RepositoryName,
16
+ revision: RepositoryRevision,
17
+ task: AttemptTask,
18
+ agent: Agent,
19
+ parentModel: Schema.Option(ModelId),
20
+ }) {
21
+ }
22
+ /** Runs one Attempt on a Worker: reserve capacity, execute the step, interrupt on cancel. */
6
23
  export class StepExecutor extends Context.Service()("@usine/engine/StepExecutor") {
7
24
  }
8
25
  //# sourceMappingURL=step-executor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"step-executor.js","sourceRoot":"","sources":["../src/step-executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASzC;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAc9C,CAAC,4BAA4B,CAAC;CAAG"}
1
+ {"version":3,"file":"step-executor.js","sourceRoot":"","sources":["../src/step-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOjD,sFAAsF;AACtF,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,6BAA6B,CAAC,CAAC;IAC5F,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,cAAc;IAC1B,QAAQ,EAAE,kBAAkB;IAC5B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;CACpC,CAAC;CAAG;AAQL,6FAA6F;AAC7F,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAkB9C,CAAC,4BAA4B,CAAC;CAAG"}