@usine/engine 0.0.0 → 0.1.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/LICENSE +21 -0
- package/README.md +69 -1
- package/dist/cursor/model.d.ts +5 -0
- package/dist/cursor/model.d.ts.map +1 -0
- package/dist/cursor/model.js +4 -0
- package/dist/cursor/model.js.map +1 -0
- package/dist/cursor/store.d.ts +18 -0
- package/dist/cursor/store.d.ts.map +1 -0
- package/dist/cursor/store.js +54 -0
- package/dist/cursor/store.js.map +1 -0
- package/dist/database/database.d.ts +15 -0
- package/dist/database/database.d.ts.map +1 -0
- package/dist/database/database.js +5 -0
- package/dist/database/database.js.map +1 -0
- package/dist/database/local-sqlite.d.ts +17 -0
- package/dist/database/local-sqlite.d.ts.map +1 -0
- package/dist/database/local-sqlite.js +45 -0
- package/dist/database/local-sqlite.js.map +1 -0
- package/dist/database/schema.d.ts +1096 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +171 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/engine.d.ts +39 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +179 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/item-projection/model.d.ts +21 -0
- package/dist/item-projection/model.d.ts.map +1 -0
- package/dist/item-projection/model.js +16 -0
- package/dist/item-projection/model.js.map +1 -0
- package/dist/item-projection/service.d.ts +25 -0
- package/dist/item-projection/service.d.ts.map +1 -0
- package/dist/item-projection/service.js +98 -0
- package/dist/item-projection/service.js.map +1 -0
- package/dist/loop-control.d.ts +16 -0
- package/dist/loop-control.d.ts.map +1 -0
- package/dist/loop-control.js +69 -0
- package/dist/loop-control.js.map +1 -0
- package/dist/model.d.ts +185 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +174 -0
- package/dist/model.js.map +1 -0
- package/dist/repository-label-projection/model.d.ts +10 -0
- package/dist/repository-label-projection/model.d.ts.map +1 -0
- package/dist/repository-label-projection/model.js +11 -0
- package/dist/repository-label-projection/model.js.map +1 -0
- package/dist/repository-label-projection/service.d.ts +20 -0
- package/dist/repository-label-projection/service.d.ts.map +1 -0
- package/dist/repository-label-projection/service.js +73 -0
- package/dist/repository-label-projection/service.js.map +1 -0
- package/dist/run-reader.d.ts +20 -0
- package/dist/run-reader.d.ts.map +1 -0
- package/dist/run-reader.js +19 -0
- package/dist/run-reader.js.map +1 -0
- package/dist/step-executor.d.ts +21 -0
- package/dist/step-executor.d.ts.map +1 -0
- package/dist/step-executor.js +8 -0
- package/dist/step-executor.js.map +1 -0
- package/dist/store/codec.d.ts +431 -0
- package/dist/store/codec.d.ts.map +1 -0
- package/dist/store/codec.js +140 -0
- package/dist/store/codec.js.map +1 -0
- package/dist/store/queries.d.ts +75 -0
- package/dist/store/queries.d.ts.map +1 -0
- package/dist/store/queries.js +508 -0
- package/dist/store/queries.js.map +1 -0
- package/dist/store/store.d.ts +83 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +374 -0
- package/dist/store/store.js.map +1 -0
- package/dist/workflow.d.ts +14 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +105 -0
- package/dist/workflow.js.map +1 -0
- package/drizzle/20260825055549_initial_runtime/migration.sql +73 -0
- package/drizzle/20260825055549_initial_runtime/snapshot.json +592 -0
- package/drizzle/20260830191125_polling_cursors/migration.sql +5 -0
- package/drizzle/20260830191125_polling_cursors/snapshot.json +629 -0
- package/drizzle/20260831073158_attempt_channel/migration.sql +36 -0
- package/drizzle/20260831073158_attempt_channel/snapshot.json +845 -0
- package/drizzle/20260831133534_agent_context/migration.sql +49 -0
- package/drizzle/20260831133534_agent_context/snapshot.json +897 -0
- package/drizzle/20260831134612_attempt_brain/migration.sql +26 -0
- package/drizzle/20260831134612_attempt_brain/snapshot.json +923 -0
- package/drizzle/20260831194605_loop_runtime/migration.sql +4 -0
- package/drizzle/20260831194605_loop_runtime/snapshot.json +954 -0
- package/drizzle/20260901073233_projection_revision/migration.sql +55 -0
- package/drizzle/20260901073233_projection_revision/snapshot.json +991 -0
- package/drizzle/20260901180433_item_projections/migration.sql +22 -0
- package/drizzle/20260901180433_item_projections/snapshot.json +1110 -0
- package/drizzle/20260901185146_repository_label_projections/migration.sql +17 -0
- package/drizzle/20260901185146_repository_label_projections/snapshot.json +1147 -0
- package/package.json +53 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Repository } from "@usine/core";
|
|
2
|
+
import { eq, ne } from "drizzle-orm";
|
|
3
|
+
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
4
|
+
import { RunDatabase } from "../database/database.js";
|
|
5
|
+
import { repositoryLabelProjections } from "../database/schema.js";
|
|
6
|
+
import { EnginePersistenceError } from "../model.js";
|
|
7
|
+
import { RepositoryLabelProjection } from "./model.js";
|
|
8
|
+
const RepositoryLabelProjectionRow = Schema.Struct({
|
|
9
|
+
repository: Repository.Name,
|
|
10
|
+
labels: RepositoryLabelProjection.fields.labels,
|
|
11
|
+
});
|
|
12
|
+
const decodeRows = Schema.decodeUnknownEffect(Schema.Array(RepositoryLabelProjectionRow));
|
|
13
|
+
const encodeLabels = Schema.encodeSync(RepositoryLabelProjection.fields.labels);
|
|
14
|
+
const persistence = (operation) => (effect) => Effect.mapError(effect, (cause) => new EnginePersistenceError({ operation, cause }));
|
|
15
|
+
const makeReader = Effect.gen(function* () {
|
|
16
|
+
const database = yield* RunDatabase;
|
|
17
|
+
return {
|
|
18
|
+
get: Effect.fn("RepositoryLabelProjectionReader.get")(function* (repository) {
|
|
19
|
+
const rows = yield* database
|
|
20
|
+
.select({
|
|
21
|
+
repository: repositoryLabelProjections.repository,
|
|
22
|
+
labels: repositoryLabelProjections.labelsJson,
|
|
23
|
+
})
|
|
24
|
+
.from(repositoryLabelProjections)
|
|
25
|
+
.where(eq(repositoryLabelProjections.repository, repository))
|
|
26
|
+
.limit(1)
|
|
27
|
+
.execute();
|
|
28
|
+
const decoded = yield* decodeRows(rows, { onExcessProperty: "error" });
|
|
29
|
+
const row = decoded[0];
|
|
30
|
+
return row === undefined
|
|
31
|
+
? Option.none()
|
|
32
|
+
: Option.some(new RepositoryLabelProjection(row));
|
|
33
|
+
}, persistence("read repository label projection")),
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
const makeWriter = Effect.gen(function* () {
|
|
37
|
+
const database = yield* RunDatabase;
|
|
38
|
+
return {
|
|
39
|
+
replace: Effect.fn("RepositoryLabelProjectionWriter.replace")(function* (projection) {
|
|
40
|
+
yield* Effect.annotateCurrentSpan({ repository: projection.repository });
|
|
41
|
+
const labelsJson = encodeLabels(projection.labels);
|
|
42
|
+
const changed = yield* database
|
|
43
|
+
.insert(repositoryLabelProjections)
|
|
44
|
+
.values({ repository: projection.repository, labelsJson })
|
|
45
|
+
.onConflictDoUpdate({
|
|
46
|
+
target: repositoryLabelProjections.repository,
|
|
47
|
+
set: { labelsJson },
|
|
48
|
+
setWhere: ne(repositoryLabelProjections.labelsJson, labelsJson),
|
|
49
|
+
})
|
|
50
|
+
.returning({ repository: repositoryLabelProjections.repository })
|
|
51
|
+
.execute();
|
|
52
|
+
if (changed.length === 0) {
|
|
53
|
+
yield* Effect.logDebug("Repository label projection already matched GitHub", {
|
|
54
|
+
repository: projection.repository,
|
|
55
|
+
labels: projection.labels.length,
|
|
56
|
+
});
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
yield* Effect.logDebug("Repository label projection updated from trigger polling", {
|
|
60
|
+
repository: projection.repository,
|
|
61
|
+
labels: projection.labels.length,
|
|
62
|
+
});
|
|
63
|
+
return true;
|
|
64
|
+
}, persistence("write repository label projection")),
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
export class RepositoryLabelProjectionReader extends Context.Service()("@usine/engine/RepositoryLabelProjectionReader") {
|
|
68
|
+
static layer = Layer.effect(RepositoryLabelProjectionReader, makeReader);
|
|
69
|
+
}
|
|
70
|
+
export class RepositoryLabelProjectionWriter extends Context.Service()("@usine/engine/RepositoryLabelProjectionWriter") {
|
|
71
|
+
static layer = Layer.effect(RepositoryLabelProjectionWriter, makeWriter);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/repository-label-projection/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC;IACjD,UAAU,EAAE,UAAU,CAAC,IAAI;IAC3B,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC,MAAM;CAChD,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAC1F,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,yBAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEhF,MAAM,WAAW,GACf,CAAC,SAAiB,EAAE,EAAE,CACtB,CAAU,MAA8B,EAA+C,EAAE,CACvF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,s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ClD,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAC;CACnF;AAED,MAAM,OAAO,+BAAgC,SAAQ,OAAO,CAAC,OAAO,EAQjE,CAAC,+CAA+C,CAAC;IAClD,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAC;CACnF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Option } from "effect";
|
|
2
|
+
import { Run } from "@usine/core";
|
|
3
|
+
import { RunDatabase } from "./database/database.ts";
|
|
4
|
+
import { ProjectionRevision, RunSnapshot, RunSummary, TranscriptEntry, TranscriptQuery, type RunStoreError } from "./model.ts";
|
|
5
|
+
declare const RunReader_base: Context.ServiceClass<RunReader, "@usine/engine/RunReader", {
|
|
6
|
+
readonly inspect: (runId: Run.RunId) => Effect.Effect<RunSnapshot, RunStoreError>;
|
|
7
|
+
/** Every open Run plus the newest `closedLimit` settled ones, newest first. */
|
|
8
|
+
readonly list: (options: {
|
|
9
|
+
readonly closedLimit: number;
|
|
10
|
+
}) => Effect.Effect<ReadonlyArray<RunSummary>, RunStoreError>;
|
|
11
|
+
/** `None` means the invalidation singleton is absent: treat every cached projection as stale. */
|
|
12
|
+
readonly revision: () => Effect.Effect<Option.Option<ProjectionRevision>, RunStoreError>;
|
|
13
|
+
readonly transcript: (query: TranscriptQuery) => Effect.Effect<ReadonlyArray<TranscriptEntry>, RunStoreError>;
|
|
14
|
+
}>;
|
|
15
|
+
/** Read-only durable Run projection; safe to build while execution is idle. */
|
|
16
|
+
export declare class RunReader extends RunReader_base {
|
|
17
|
+
static readonly layer: Layer.Layer<RunReader, never, RunDatabase>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=run-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-reader.d.ts","sourceRoot":"","sources":["../src/run-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,eAAe,EACf,eAAe,EACf,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;;sBA2BE,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC;IACjF,+EAA+E;mBAChE,CAAC,OAAO,EAAE;QACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;KAC9B,KAAK,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;IAC7D,iGAAiG;uBAC9E,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC;yBACnE,CACnB,KAAK,EAAE,eAAe,KACnB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC;;AAbrE,+EAA+E;AAC/E,qBAAa,SAAU,SAAQ,cAcD;IAC5B,MAAM,CAAC,QAAQ,CAAC,KAAK,6CAA0C;CAChE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Option } from "effect";
|
|
2
|
+
import { Run } from "@usine/core";
|
|
3
|
+
import { RunDatabase } from "./database/database.js";
|
|
4
|
+
import { ProjectionRevision, RunSnapshot, RunSummary, TranscriptEntry, TranscriptQuery, } from "./model.js";
|
|
5
|
+
import { persistence } from "./store/codec.js";
|
|
6
|
+
import { queriesFor } from "./store/queries.js";
|
|
7
|
+
const makeRunReader = Effect.gen(function* () {
|
|
8
|
+
const queries = queriesFor(yield* RunDatabase);
|
|
9
|
+
const inspect = Effect.fn("RunReader.inspect")((runId) => queries.snapshot(runId).pipe(persistence("read run")));
|
|
10
|
+
const list = Effect.fn("RunReader.list")((options) => queries.runSummaries(options.closedLimit).pipe(persistence("list runs")));
|
|
11
|
+
const revision = Effect.fn("RunReader.revision")(() => queries.revision().pipe(persistence("read projection revision")));
|
|
12
|
+
const transcript = Effect.fn("RunReader.transcript")((query) => queries.transcript(query).pipe(persistence("read Attempt transcript")));
|
|
13
|
+
return { inspect, list, revision, transcript };
|
|
14
|
+
});
|
|
15
|
+
/** Read-only durable Run projection; safe to build while execution is idle. */
|
|
16
|
+
export class RunReader extends Context.Service()("@usine/engine/RunReader") {
|
|
17
|
+
static layer = Layer.effect(RunReader, makeRunReader);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=run-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-reader.js","sourceRoot":"","sources":["../src/run-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,eAAe,EACf,eAAe,GAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAgB,EAAE,EAAE,CAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CACtD,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAyC,EAAE,EAAE,CACrF,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CACzE,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,GAAG,EAAE,CACpD,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,CACjE,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAsB,EAAE,EAAE,CAC9E,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CACvE,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAW,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,OAAO,SAAU,SAAQ,OAAO,CAAC,OAAO,EAc3C,CAAC,yBAAyB,CAAC;IAC5B,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;CAChE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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. */
|
|
5
|
+
export interface WorkerLease {
|
|
6
|
+
readonly worker: Worker.Name;
|
|
7
|
+
readonly release: Effect.Effect<void>;
|
|
8
|
+
}
|
|
9
|
+
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>;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Port for one Attempt. #29 supplies the worker-backed adapter; #26 exercises
|
|
16
|
+
* the durable engine against implementations of this interface.
|
|
17
|
+
*/
|
|
18
|
+
export declare class StepExecutor extends StepExecutor_base {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=step-executor.d.ts.map
|
|
@@ -0,0 +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,CAClB,SAAS,EAAE,OAAO,CAAC,SAAS,KACzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,cAAc,CAAC;sBACrC,CAChB,UAAU,EAAE,UAAU,KACnB,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,cAAc,CAAC;sBAC5C,CAChB,SAAS,EAAE,aAAa,EACxB,EAAE,EAAE,cAAc,CAAC,IAAI,KACpB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,cAAc,CAAC;;AAhB5E;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAcD;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
*/
|
|
6
|
+
export class StepExecutor extends Context.Service()("@usine/engine/StepExecutor") {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=step-executor.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import { Agent, Attempt, AttemptChannel, Event, Run, RunState, Step, StepResult } from "@usine/core";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import { RunStoreError, RunSummary, Submission, TranscriptEntry } from "../model.ts";
|
|
4
|
+
export declare const EventRouteRow: Schema.Struct<{
|
|
5
|
+
readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
|
|
6
|
+
readonly dedupKey: Schema.brand<Schema.NonEmptyString, "DedupKey">;
|
|
7
|
+
readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
8
|
+
readonly receivedAt: Schema.DateTimeUtcFromString;
|
|
9
|
+
readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
|
|
10
|
+
readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
11
|
+
readonly step: Schema.brand<Schema.NonEmptyString, "StepName">;
|
|
12
|
+
readonly approval: Schema.Literals<readonly ["none", "required"]>;
|
|
13
|
+
readonly repository: Schema.brand<Schema.String, "RepoName">;
|
|
14
|
+
readonly revision: Schema.brand<Schema.String, "RepositoryRevision">;
|
|
15
|
+
readonly task: Schema.brand<Schema.String, "AttemptTask">;
|
|
16
|
+
readonly agent: typeof Agent.Agent;
|
|
17
|
+
readonly parentModel: Schema.NullOr<Schema.brand<Schema.String, "ModelId">>;
|
|
18
|
+
}>;
|
|
19
|
+
export type EventRouteRow = typeof EventRouteRow.Type;
|
|
20
|
+
export declare const RunRow: Schema.Struct<{
|
|
21
|
+
readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
|
|
22
|
+
readonly repository: Schema.brand<Schema.String, "RepoName">;
|
|
23
|
+
readonly revision: Schema.brand<Schema.String, "RepositoryRevision">;
|
|
24
|
+
readonly task: Schema.brand<Schema.String, "AttemptTask">;
|
|
25
|
+
readonly agent: typeof Agent.Agent;
|
|
26
|
+
readonly parentModel: Schema.NullOr<Schema.brand<Schema.String, "ModelId">>;
|
|
27
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
28
|
+
readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
|
|
29
|
+
readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
|
|
30
|
+
readonly state: Schema.Union<readonly [typeof RunState.Pending, typeof RunState.Waiting, typeof RunState.Running, typeof RunState.Succeeded, typeof RunState.Failed, typeof RunState.Canceled]>;
|
|
31
|
+
readonly openedAt: Schema.DateTimeUtcFromString;
|
|
32
|
+
readonly stepName: Schema.brand<Schema.NonEmptyString, "StepName">;
|
|
33
|
+
readonly result: Schema.NullOr<typeof StepResult.StepResult>;
|
|
34
|
+
}>;
|
|
35
|
+
export type RunRow = typeof RunRow.Type;
|
|
36
|
+
export declare const AttemptRow: Schema.Struct<{
|
|
37
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
38
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
39
|
+
readonly stepName: Schema.brand<Schema.NonEmptyString, "StepName">;
|
|
40
|
+
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
41
|
+
readonly number: Schema.brand<Schema.Int, "AttemptNumber">;
|
|
42
|
+
readonly brain: typeof Agent.BrainSpec;
|
|
43
|
+
readonly parentModel: Schema.NullOr<Schema.brand<Schema.String, "ModelId">>;
|
|
44
|
+
readonly startedAt: Schema.DateTimeUtcFromString;
|
|
45
|
+
readonly outcome: Schema.NullOr<Schema.Union<readonly [typeof Attempt.Succeeded, typeof Attempt.Failed, typeof Attempt.Canceled]>>;
|
|
46
|
+
}>;
|
|
47
|
+
export type AttemptRow = typeof AttemptRow.Type;
|
|
48
|
+
export declare const TranscriptRow: Schema.Struct<{
|
|
49
|
+
readonly sequence: Schema.brand<Schema.Int, "TranscriptSequence">;
|
|
50
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
51
|
+
readonly direction: Schema.Literals<readonly ["inbound", "outbound"]>;
|
|
52
|
+
readonly envelope: Schema.Union<readonly [typeof AttemptChannel.OutboundEnvelope, typeof AttemptChannel.InboundEnvelope]>;
|
|
53
|
+
readonly receivedAt: Schema.DateTimeUtcFromString;
|
|
54
|
+
}>;
|
|
55
|
+
export type TranscriptRow = typeof TranscriptRow.Type;
|
|
56
|
+
export declare const WorkflowCommandRow: Schema.Struct<{
|
|
57
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
58
|
+
readonly command: Schema.Literals<readonly ["Approve", "Continue", "Interrupt", "Resume"]>;
|
|
59
|
+
}>;
|
|
60
|
+
export type WorkflowCommandRow = typeof WorkflowCommandRow.Type;
|
|
61
|
+
export declare const decodeEventRoutes: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
62
|
+
readonly eventId: string & import("effect/Brand").Brand<"EventId">;
|
|
63
|
+
readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
|
|
64
|
+
readonly payload: Schema.Json;
|
|
65
|
+
readonly receivedAt: import("effect/DateTime").Utc;
|
|
66
|
+
readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
|
|
67
|
+
readonly loop: string & import("effect/Brand").Brand<"LoopName">;
|
|
68
|
+
readonly step: string & import("effect/Brand").Brand<"StepName">;
|
|
69
|
+
readonly approval: "none" | "required";
|
|
70
|
+
readonly repository: string & import("effect/Brand").Brand<"RepoName">;
|
|
71
|
+
readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
|
|
72
|
+
readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
|
|
73
|
+
readonly agent: Agent.Agent;
|
|
74
|
+
readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
|
|
75
|
+
}[], Schema.SchemaError, never>;
|
|
76
|
+
export declare const decodeRunRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
77
|
+
readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
|
|
78
|
+
readonly repository: string & import("effect/Brand").Brand<"RepoName">;
|
|
79
|
+
readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
|
|
80
|
+
readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
|
|
81
|
+
readonly agent: Agent.Agent;
|
|
82
|
+
readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
|
|
83
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
84
|
+
readonly eventId: string & import("effect/Brand").Brand<"EventId">;
|
|
85
|
+
readonly loop: string & import("effect/Brand").Brand<"LoopName">;
|
|
86
|
+
readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Running | RunState.Succeeded | RunState.Waiting;
|
|
87
|
+
readonly openedAt: import("effect/DateTime").Utc;
|
|
88
|
+
readonly stepName: string & import("effect/Brand").Brand<"StepName">;
|
|
89
|
+
readonly result: StepResult.StepResult | null;
|
|
90
|
+
}[], Schema.SchemaError, never>;
|
|
91
|
+
export declare const decodeAttemptRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
92
|
+
readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
|
|
93
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
94
|
+
readonly stepName: string & import("effect/Brand").Brand<"StepName">;
|
|
95
|
+
readonly worker: string & import("effect/Brand").Brand<"WorkerName">;
|
|
96
|
+
readonly number: number & import("effect/Brand").Brand<"AttemptNumber">;
|
|
97
|
+
readonly brain: Agent.BrainSpec;
|
|
98
|
+
readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
|
|
99
|
+
readonly startedAt: import("effect/DateTime").Utc;
|
|
100
|
+
readonly outcome: Attempt.Canceled | Attempt.Failed | Attempt.Succeeded | null;
|
|
101
|
+
}[], Schema.SchemaError, never>;
|
|
102
|
+
export declare const decodeRecoverableRuns: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
103
|
+
readonly eventId: string & import("effect/Brand").Brand<"EventId">;
|
|
104
|
+
readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
|
|
105
|
+
readonly payload: Schema.Json;
|
|
106
|
+
readonly receivedAt: import("effect/DateTime").Utc;
|
|
107
|
+
readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
|
|
108
|
+
readonly loop: string & import("effect/Brand").Brand<"LoopName">;
|
|
109
|
+
readonly step: string & import("effect/Brand").Brand<"StepName">;
|
|
110
|
+
readonly approval: "none" | "required";
|
|
111
|
+
readonly repository: string & import("effect/Brand").Brand<"RepoName">;
|
|
112
|
+
readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
|
|
113
|
+
readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
|
|
114
|
+
readonly agent: Agent.Agent;
|
|
115
|
+
readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
|
|
116
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
117
|
+
readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Running | RunState.Succeeded | RunState.Waiting;
|
|
118
|
+
}[], Schema.SchemaError, never>;
|
|
119
|
+
export declare const decodeRunIds: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
120
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
121
|
+
}[], Schema.SchemaError, never>;
|
|
122
|
+
export declare const decodeDiscards: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
123
|
+
readonly reason: "revoked" | "superseded";
|
|
124
|
+
}[], Schema.SchemaError, never>;
|
|
125
|
+
export declare const decodeWorkflowCommands: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
126
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
127
|
+
readonly command: "Approve" | "Continue" | "Interrupt" | "Resume";
|
|
128
|
+
}[], Schema.SchemaError, never>;
|
|
129
|
+
export declare const decodeProjectionRevision: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
130
|
+
readonly revision: number & import("effect/Brand").Brand<"ProjectionRevision">;
|
|
131
|
+
}[], Schema.SchemaError, never>;
|
|
132
|
+
export declare const decodeTranscriptRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
|
|
133
|
+
readonly sequence: number & import("effect/Brand").Brand<"TranscriptSequence">;
|
|
134
|
+
readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
|
|
135
|
+
readonly direction: "inbound" | "outbound";
|
|
136
|
+
readonly envelope: AttemptChannel.InboundEnvelope | AttemptChannel.OutboundEnvelope;
|
|
137
|
+
readonly receivedAt: import("effect/DateTime").Utc;
|
|
138
|
+
}[], Schema.SchemaError, never>;
|
|
139
|
+
export declare const encodePayload: (input: Schema.Json, options?: import("effect/SchemaAST").ParseOptions) => Schema.Json;
|
|
140
|
+
export declare const encodeDateTime: (input: import("effect/DateTime").Utc, options?: import("effect/SchemaAST").ParseOptions) => string;
|
|
141
|
+
export declare const encodeRunState: (input: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Running | RunState.Succeeded | RunState.Waiting, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
142
|
+
readonly _tag: "Pending";
|
|
143
|
+
} | {
|
|
144
|
+
readonly _tag: "Waiting";
|
|
145
|
+
} | {
|
|
146
|
+
readonly _tag: "Running";
|
|
147
|
+
} | {
|
|
148
|
+
readonly _tag: "Succeeded";
|
|
149
|
+
} | {
|
|
150
|
+
readonly _tag: "Failed";
|
|
151
|
+
} | {
|
|
152
|
+
readonly _tag: "Canceled";
|
|
153
|
+
readonly reason: {
|
|
154
|
+
readonly _tag: "OperatorCanceled";
|
|
155
|
+
} | {
|
|
156
|
+
readonly _tag: "Superseded";
|
|
157
|
+
readonly by: string;
|
|
158
|
+
} | {
|
|
159
|
+
readonly _tag: "Revoked";
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export declare const encodeOutcome: (input: Attempt.Canceled | Attempt.Failed | Attempt.Succeeded, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
163
|
+
readonly _tag: "Succeeded";
|
|
164
|
+
} | {
|
|
165
|
+
readonly _tag: "Failed";
|
|
166
|
+
readonly failure: {
|
|
167
|
+
readonly _tag: "InfraFailure";
|
|
168
|
+
readonly message: string;
|
|
169
|
+
readonly cause: Schema.Json;
|
|
170
|
+
} | {
|
|
171
|
+
readonly _tag: "AgentFailure";
|
|
172
|
+
readonly message: string;
|
|
173
|
+
} | {
|
|
174
|
+
readonly _tag: "RunawayFailure";
|
|
175
|
+
readonly ceiling: "tokens" | "wall-clock";
|
|
176
|
+
};
|
|
177
|
+
} | {
|
|
178
|
+
readonly _tag: "Canceled";
|
|
179
|
+
};
|
|
180
|
+
export declare const encodeStepResult: (input: StepResult.StepResult, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
181
|
+
readonly message: string;
|
|
182
|
+
readonly facts: readonly ({
|
|
183
|
+
readonly _tag: "Commit";
|
|
184
|
+
readonly sha: string;
|
|
185
|
+
readonly summary: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly _tag: "PullRequest";
|
|
188
|
+
readonly number: number;
|
|
189
|
+
readonly url: URL;
|
|
190
|
+
} | {
|
|
191
|
+
readonly _tag: "Comment";
|
|
192
|
+
readonly url: URL;
|
|
193
|
+
})[];
|
|
194
|
+
};
|
|
195
|
+
export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | AttemptChannel.OutboundEnvelope, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
196
|
+
readonly _tag: "OutboundEnvelope";
|
|
197
|
+
readonly version: 3;
|
|
198
|
+
readonly attemptId: string;
|
|
199
|
+
readonly sequence: number;
|
|
200
|
+
readonly sentAt: string;
|
|
201
|
+
readonly payload: {
|
|
202
|
+
readonly _tag: "Started";
|
|
203
|
+
readonly parentModel: string;
|
|
204
|
+
} | {
|
|
205
|
+
readonly _tag: "SessionEvent";
|
|
206
|
+
readonly event: {
|
|
207
|
+
readonly _tag: "SessionStarted";
|
|
208
|
+
readonly session: {
|
|
209
|
+
readonly _tag: "ParentSession";
|
|
210
|
+
readonly id: string;
|
|
211
|
+
readonly agent: string;
|
|
212
|
+
readonly brain: {
|
|
213
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
214
|
+
readonly model: string;
|
|
215
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
216
|
+
};
|
|
217
|
+
} | {
|
|
218
|
+
readonly _tag: "ChildSession";
|
|
219
|
+
readonly id: string;
|
|
220
|
+
readonly parentId: string;
|
|
221
|
+
readonly agent: string;
|
|
222
|
+
readonly brain: {
|
|
223
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
224
|
+
readonly model: string;
|
|
225
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
} | {
|
|
229
|
+
readonly _tag: "TextOutput";
|
|
230
|
+
readonly session: {
|
|
231
|
+
readonly _tag: "ParentSession";
|
|
232
|
+
readonly id: string;
|
|
233
|
+
readonly agent: string;
|
|
234
|
+
readonly brain: {
|
|
235
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
236
|
+
readonly model: string;
|
|
237
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
238
|
+
};
|
|
239
|
+
} | {
|
|
240
|
+
readonly _tag: "ChildSession";
|
|
241
|
+
readonly id: string;
|
|
242
|
+
readonly parentId: string;
|
|
243
|
+
readonly agent: string;
|
|
244
|
+
readonly brain: {
|
|
245
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
246
|
+
readonly model: string;
|
|
247
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
readonly text: string;
|
|
251
|
+
} | {
|
|
252
|
+
readonly _tag: "ToolStarted";
|
|
253
|
+
readonly session: {
|
|
254
|
+
readonly _tag: "ParentSession";
|
|
255
|
+
readonly id: string;
|
|
256
|
+
readonly agent: string;
|
|
257
|
+
readonly brain: {
|
|
258
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
259
|
+
readonly model: string;
|
|
260
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
261
|
+
};
|
|
262
|
+
} | {
|
|
263
|
+
readonly _tag: "ChildSession";
|
|
264
|
+
readonly id: string;
|
|
265
|
+
readonly parentId: string;
|
|
266
|
+
readonly agent: string;
|
|
267
|
+
readonly brain: {
|
|
268
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
269
|
+
readonly model: string;
|
|
270
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
readonly callId: string;
|
|
274
|
+
readonly tool: string;
|
|
275
|
+
readonly input: Schema.Json;
|
|
276
|
+
} | {
|
|
277
|
+
readonly _tag: "ToolFinished";
|
|
278
|
+
readonly session: {
|
|
279
|
+
readonly _tag: "ParentSession";
|
|
280
|
+
readonly id: string;
|
|
281
|
+
readonly agent: string;
|
|
282
|
+
readonly brain: {
|
|
283
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
284
|
+
readonly model: string;
|
|
285
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
288
|
+
readonly _tag: "ChildSession";
|
|
289
|
+
readonly id: string;
|
|
290
|
+
readonly parentId: string;
|
|
291
|
+
readonly agent: string;
|
|
292
|
+
readonly brain: {
|
|
293
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
294
|
+
readonly model: string;
|
|
295
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
readonly callId: string;
|
|
299
|
+
readonly tool: string;
|
|
300
|
+
readonly output: Schema.Json;
|
|
301
|
+
readonly isError: boolean;
|
|
302
|
+
} | {
|
|
303
|
+
readonly _tag: "PoolRateLimitsUpdated";
|
|
304
|
+
readonly session: {
|
|
305
|
+
readonly _tag: "ParentSession";
|
|
306
|
+
readonly id: string;
|
|
307
|
+
readonly agent: string;
|
|
308
|
+
readonly brain: {
|
|
309
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
310
|
+
readonly model: string;
|
|
311
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
312
|
+
};
|
|
313
|
+
} | {
|
|
314
|
+
readonly _tag: "ChildSession";
|
|
315
|
+
readonly id: string;
|
|
316
|
+
readonly parentId: string;
|
|
317
|
+
readonly agent: string;
|
|
318
|
+
readonly brain: {
|
|
319
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
320
|
+
readonly model: string;
|
|
321
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
readonly pool: "apiKeys" | "chatgptPlan" | "claudePlan";
|
|
325
|
+
readonly rateLimits: {
|
|
326
|
+
readonly limitId: string | null;
|
|
327
|
+
readonly limitName: string | null;
|
|
328
|
+
readonly primary: {
|
|
329
|
+
readonly usedPercent: number;
|
|
330
|
+
readonly windowDurationMinutes: number | null;
|
|
331
|
+
readonly resetsAt: string | null;
|
|
332
|
+
} | null;
|
|
333
|
+
readonly secondary: {
|
|
334
|
+
readonly usedPercent: number;
|
|
335
|
+
readonly windowDurationMinutes: number | null;
|
|
336
|
+
readonly resetsAt: string | null;
|
|
337
|
+
} | null;
|
|
338
|
+
};
|
|
339
|
+
} | {
|
|
340
|
+
readonly _tag: "SessionFinished";
|
|
341
|
+
readonly session: {
|
|
342
|
+
readonly _tag: "ParentSession";
|
|
343
|
+
readonly id: string;
|
|
344
|
+
readonly agent: string;
|
|
345
|
+
readonly brain: {
|
|
346
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
347
|
+
readonly model: string;
|
|
348
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
349
|
+
};
|
|
350
|
+
} | {
|
|
351
|
+
readonly _tag: "ChildSession";
|
|
352
|
+
readonly id: string;
|
|
353
|
+
readonly parentId: string;
|
|
354
|
+
readonly agent: string;
|
|
355
|
+
readonly brain: {
|
|
356
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
357
|
+
readonly model: string;
|
|
358
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
} | {
|
|
363
|
+
readonly _tag: "Final";
|
|
364
|
+
readonly result: {
|
|
365
|
+
readonly message: string;
|
|
366
|
+
readonly facts: readonly ({
|
|
367
|
+
readonly _tag: "Commit";
|
|
368
|
+
readonly sha: string;
|
|
369
|
+
readonly summary: string;
|
|
370
|
+
} | {
|
|
371
|
+
readonly _tag: "PullRequest";
|
|
372
|
+
readonly number: number;
|
|
373
|
+
readonly url: URL;
|
|
374
|
+
} | {
|
|
375
|
+
readonly _tag: "Comment";
|
|
376
|
+
readonly url: URL;
|
|
377
|
+
})[];
|
|
378
|
+
};
|
|
379
|
+
} | {
|
|
380
|
+
readonly _tag: "Failed";
|
|
381
|
+
readonly failure: {
|
|
382
|
+
readonly _tag: "InfraFailure";
|
|
383
|
+
readonly message: string;
|
|
384
|
+
readonly cause: Schema.Json;
|
|
385
|
+
} | {
|
|
386
|
+
readonly _tag: "AgentFailure";
|
|
387
|
+
readonly message: string;
|
|
388
|
+
} | {
|
|
389
|
+
readonly _tag: "RunawayFailure";
|
|
390
|
+
readonly ceiling: "tokens" | "wall-clock";
|
|
391
|
+
};
|
|
392
|
+
} | {
|
|
393
|
+
readonly _tag: "Interrupted";
|
|
394
|
+
};
|
|
395
|
+
} | {
|
|
396
|
+
readonly _tag: "InboundEnvelope";
|
|
397
|
+
readonly version: 3;
|
|
398
|
+
readonly attemptId: string;
|
|
399
|
+
readonly sequence: number;
|
|
400
|
+
readonly sentAt: string;
|
|
401
|
+
readonly payload: {
|
|
402
|
+
readonly _tag: "Steer";
|
|
403
|
+
readonly message: string;
|
|
404
|
+
} | {
|
|
405
|
+
readonly _tag: "Interrupt";
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
export declare const encodeAgent: (input: Agent.Agent, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
409
|
+
readonly name: string;
|
|
410
|
+
readonly brain: {
|
|
411
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
412
|
+
readonly model: string;
|
|
413
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
414
|
+
};
|
|
415
|
+
readonly parentModel: string | null;
|
|
416
|
+
readonly persona: string;
|
|
417
|
+
};
|
|
418
|
+
export declare const encodeBrainSpec: (input: Agent.BrainSpec, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
419
|
+
readonly harness: "claude" | "codex" | "pi";
|
|
420
|
+
readonly model: string;
|
|
421
|
+
readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
|
|
422
|
+
};
|
|
423
|
+
export declare const persistence: (operation: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, RunStoreError, R>;
|
|
424
|
+
export declare const eventFromRow: (row: EventRouteRow) => Event.Event;
|
|
425
|
+
export declare const submissionFromRow: (row: EventRouteRow) => Submission;
|
|
426
|
+
export declare const runFromRow: (row: RunRow) => Run.Run;
|
|
427
|
+
export declare const stepFromRow: (row: RunRow) => Step.Step;
|
|
428
|
+
export declare const attemptFromRow: (row: AttemptRow) => Attempt.Attempt;
|
|
429
|
+
export declare const runSummaryFromRow: (row: RunRow, storedAttempts: ReadonlyArray<AttemptRow>) => RunSummary;
|
|
430
|
+
export declare const transcriptEntryFromRow: (row: TranscriptRow) => TranscriptEntry;
|
|
431
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/store/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,cAAc,EACd,KAAK,EAIL,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,UAAU,EAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAKL,aAAa,EACb,UAAU,EACV,UAAU,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