@usine/engine 0.0.1 → 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/README.md +66 -2
- 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 +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- 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 +21 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/database/schema.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASlB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBzB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBhB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBjB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BpB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B9B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB5B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOnB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB3B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYtC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Agent, Attempt, AttemptChannel, Event, Item, Loop, Repository, Run, Step, Worker, } from "@usine/core";
|
|
2
|
+
import { sql } from "drizzle-orm";
|
|
3
|
+
import { check, foreignKey, index, integer, primaryKey, snakeCase, text, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
4
|
+
import { APPROVAL_REQUIREMENTS, IGNORED_REASONS, WORKFLOW_COMMANDS, } from "../model.js";
|
|
5
|
+
export const events = snakeCase.table("usine_events", {
|
|
6
|
+
eventId: text().$type().primaryKey(),
|
|
7
|
+
dedupKey: text().$type().notNull().unique(),
|
|
8
|
+
payloadJson: text({ mode: "json" }).$type().notNull(),
|
|
9
|
+
receivedAt: text().notNull(),
|
|
10
|
+
}, (table) => [check("usine_events_payload_json_valid", sql `json_valid(${table.payloadJson})`)]);
|
|
11
|
+
export const triggerEvents = snakeCase.table("usine_trigger_events", {
|
|
12
|
+
eventId: text()
|
|
13
|
+
.$type()
|
|
14
|
+
.primaryKey()
|
|
15
|
+
.references(() => events.eventId),
|
|
16
|
+
itemKey: text().$type().notNull(),
|
|
17
|
+
loopName: text().$type().notNull(),
|
|
18
|
+
stepName: text().$type().notNull(),
|
|
19
|
+
approval: text({ enum: APPROVAL_REQUIREMENTS }).$type().notNull(),
|
|
20
|
+
// The submitted execution context, part of the immutable Event fact. A
|
|
21
|
+
// queued Event (blocked behind a running Run) is claimed later from these
|
|
22
|
+
// columns; the Run's own copy below is what execution reads.
|
|
23
|
+
repository: text().$type().notNull(),
|
|
24
|
+
revision: text().$type().notNull(),
|
|
25
|
+
task: text().$type().notNull(),
|
|
26
|
+
agentJson: text({ mode: "json" }).$type().notNull(),
|
|
27
|
+
parentModel: text().$type(),
|
|
28
|
+
}, (table) => [
|
|
29
|
+
check("usine_trigger_events_approval", sql `${table.approval} in ('none', 'required')`),
|
|
30
|
+
check("usine_trigger_events_agent_json_valid", sql `json_valid(${table.agentJson})`),
|
|
31
|
+
index("usine_trigger_events_item").on(table.loopName, table.itemKey),
|
|
32
|
+
]);
|
|
33
|
+
export const runs = snakeCase.table("usine_runs", {
|
|
34
|
+
runId: text().$type().primaryKey(),
|
|
35
|
+
eventId: text()
|
|
36
|
+
.$type()
|
|
37
|
+
.notNull()
|
|
38
|
+
.unique()
|
|
39
|
+
.references(() => triggerEvents.eventId),
|
|
40
|
+
loopName: text().$type().notNull(),
|
|
41
|
+
stateJson: text({ mode: "json" }).$type().notNull(),
|
|
42
|
+
openedAt: text().notNull(),
|
|
43
|
+
// The Run's *effective* context, seeded from the claiming submission.
|
|
44
|
+
// ADR 0018's edit-and-retry amends these; the Event columns never change.
|
|
45
|
+
repository: text().$type().notNull(),
|
|
46
|
+
revision: text().$type().notNull(),
|
|
47
|
+
task: text().$type().notNull(),
|
|
48
|
+
agentJson: text({ mode: "json" }).$type().notNull(),
|
|
49
|
+
parentModel: text().$type(),
|
|
50
|
+
}, (table) => [
|
|
51
|
+
check("usine_runs_state_json_valid", sql `json_valid(${table.stateJson})`),
|
|
52
|
+
check("usine_runs_agent_json_valid", sql `json_valid(${table.agentJson})`),
|
|
53
|
+
]);
|
|
54
|
+
export const steps = snakeCase.table("usine_steps", {
|
|
55
|
+
runId: text()
|
|
56
|
+
.$type()
|
|
57
|
+
.notNull()
|
|
58
|
+
.references(() => runs.runId),
|
|
59
|
+
stepName: text().$type().notNull(),
|
|
60
|
+
result: text({ mode: "json" }).$type(),
|
|
61
|
+
}, (table) => [
|
|
62
|
+
primaryKey({ columns: [table.runId, table.stepName] }),
|
|
63
|
+
check("usine_steps_result_json_valid", sql `${table.result} is null or json_valid(${table.result})`),
|
|
64
|
+
]);
|
|
65
|
+
export const attempts = snakeCase.table("usine_attempts", {
|
|
66
|
+
attemptId: text().$type().primaryKey(),
|
|
67
|
+
runId: text().$type().notNull(),
|
|
68
|
+
stepName: text().$type().notNull(),
|
|
69
|
+
workerName: text().$type().notNull(),
|
|
70
|
+
attemptNumber: integer({ mode: "number" }).$type().notNull(),
|
|
71
|
+
brainJson: text({ mode: "json" }).$type().notNull(),
|
|
72
|
+
parentModel: text().$type(),
|
|
73
|
+
startedAt: text().notNull(),
|
|
74
|
+
outcomeJson: text({ mode: "json" }).$type(),
|
|
75
|
+
}, (table) => [
|
|
76
|
+
check("usine_attempts_number", sql `${table.attemptNumber} >= 1`),
|
|
77
|
+
check("usine_attempts_brain_json_valid", sql `json_valid(${table.brainJson})`),
|
|
78
|
+
check("usine_attempts_outcome_json_valid", sql `${table.outcomeJson} is null or json_valid(${table.outcomeJson})`),
|
|
79
|
+
uniqueIndex("usine_attempt_number").on(table.runId, table.stepName, table.attemptNumber),
|
|
80
|
+
uniqueIndex("usine_one_in_flight_attempt")
|
|
81
|
+
.on(table.runId)
|
|
82
|
+
.where(sql `${table.outcomeJson} is null`),
|
|
83
|
+
foreignKey({
|
|
84
|
+
columns: [table.runId, table.stepName],
|
|
85
|
+
foreignColumns: [steps.runId, steps.stepName],
|
|
86
|
+
}),
|
|
87
|
+
]);
|
|
88
|
+
export const attemptTranscripts = snakeCase.table("usine_attempt_transcripts", {
|
|
89
|
+
sequence: integer({ mode: "number" }).primaryKey({ autoIncrement: true }),
|
|
90
|
+
attemptId: text()
|
|
91
|
+
.$type()
|
|
92
|
+
.notNull()
|
|
93
|
+
.references(() => attempts.attemptId),
|
|
94
|
+
direction: text({ enum: AttemptChannel.DIRECTIONS }).notNull(),
|
|
95
|
+
channelSequence: integer({ mode: "number" }).$type().notNull(),
|
|
96
|
+
envelope: text({ mode: "json" }).$type().notNull(),
|
|
97
|
+
receivedAt: text().notNull(),
|
|
98
|
+
}, (table) => [
|
|
99
|
+
check("usine_attempt_transcripts_direction", sql `${table.direction} in ('inbound', 'outbound')`),
|
|
100
|
+
check("usine_attempt_transcripts_sequence", sql `${table.channelSequence} >= 1`),
|
|
101
|
+
check("usine_attempt_transcripts_envelope_json_valid", sql `json_valid(${table.envelope})`),
|
|
102
|
+
uniqueIndex("usine_attempt_transcript_envelope").on(table.attemptId, table.direction, table.channelSequence),
|
|
103
|
+
index("usine_attempt_transcript_tail").on(table.attemptId, table.sequence),
|
|
104
|
+
]);
|
|
105
|
+
export const approvals = snakeCase.table("usine_approvals", {
|
|
106
|
+
runId: text()
|
|
107
|
+
.$type()
|
|
108
|
+
.primaryKey()
|
|
109
|
+
.references(() => runs.runId),
|
|
110
|
+
eventId: text()
|
|
111
|
+
.$type()
|
|
112
|
+
.notNull()
|
|
113
|
+
.unique()
|
|
114
|
+
.references(() => events.eventId),
|
|
115
|
+
});
|
|
116
|
+
export const ignoredEvents = snakeCase.table("usine_ignored_events", {
|
|
117
|
+
eventId: text()
|
|
118
|
+
.$type()
|
|
119
|
+
.primaryKey()
|
|
120
|
+
.references(() => triggerEvents.eventId),
|
|
121
|
+
reason: text({ enum: IGNORED_REASONS }).$type().notNull(),
|
|
122
|
+
}, (table) => [
|
|
123
|
+
check("usine_ignored_events_reason", sql `${table.reason} in ('superseded', 'revoked')`),
|
|
124
|
+
]);
|
|
125
|
+
export const workflowCommands = snakeCase.table("usine_workflow_commands", {
|
|
126
|
+
runId: text()
|
|
127
|
+
.$type()
|
|
128
|
+
.notNull()
|
|
129
|
+
.references(() => runs.runId),
|
|
130
|
+
command: text({ enum: WORKFLOW_COMMANDS }).$type().notNull(),
|
|
131
|
+
}, (table) => [
|
|
132
|
+
check("usine_workflow_commands_command", sql `${table.command} in ('Approve', 'Continue', 'Interrupt', 'Resume')`),
|
|
133
|
+
primaryKey({ columns: [table.runId, table.command] }),
|
|
134
|
+
]);
|
|
135
|
+
/** Opaque, owner-validated cursors for efficiency-only trigger state. */
|
|
136
|
+
export const cursors = snakeCase.table("usine_cursors", {
|
|
137
|
+
cursorKey: text().primaryKey(),
|
|
138
|
+
valueJson: text({ mode: "json" }).$type().notNull(),
|
|
139
|
+
}, (table) => [check("usine_cursors_value_json_valid", sql `json_valid(${table.valueJson})`)]);
|
|
140
|
+
/** Latest trigger-owned payload for each Item, projected for operator reads. */
|
|
141
|
+
export const itemProjections = snakeCase.table("usine_item_projections", {
|
|
142
|
+
itemKey: text().$type().primaryKey(),
|
|
143
|
+
repository: text().$type().notNull(),
|
|
144
|
+
source: text().notNull(),
|
|
145
|
+
itemNumber: integer({ mode: "number" }).notNull(),
|
|
146
|
+
contentHash: text().notNull(),
|
|
147
|
+
payloadJson: text({ mode: "json" }).$type().notNull(),
|
|
148
|
+
}, (table) => [
|
|
149
|
+
check("usine_item_projections_number", sql `${table.itemNumber} >= 1`),
|
|
150
|
+
check("usine_item_projections_payload_json_valid", sql `json_valid(${table.payloadJson})`),
|
|
151
|
+
uniqueIndex("usine_item_projection_number").on(table.repository, table.itemNumber),
|
|
152
|
+
index("usine_item_projection_repository").on(table.repository, table.itemNumber),
|
|
153
|
+
]);
|
|
154
|
+
/** Latest complete GitHub label catalog for each managed repository. */
|
|
155
|
+
export const repositoryLabelProjections = snakeCase.table("usine_repository_label_projections", {
|
|
156
|
+
repository: text().$type().primaryKey(),
|
|
157
|
+
labelsJson: text({ mode: "json" }).$type().notNull(),
|
|
158
|
+
}, (table) => [
|
|
159
|
+
check("usine_repository_label_projections_labels_json_valid", sql `json_valid(${table.labelsJson})`),
|
|
160
|
+
]);
|
|
161
|
+
/** Operator-owned runtime toggles; deliberately separate from authored Loop files (ADR 0009). */
|
|
162
|
+
export const loopRuntime = snakeCase.table("usine_loop_runtime", {
|
|
163
|
+
loopName: text().$type().primaryKey(),
|
|
164
|
+
paused: integer({ mode: "boolean" }).notNull(),
|
|
165
|
+
});
|
|
166
|
+
/** Singleton invalidation token for cached operator projections. */
|
|
167
|
+
export const projectionRevision = snakeCase.table("usine_projection_revision", {
|
|
168
|
+
singleton: integer({ mode: "number" }).primaryKey().default(1),
|
|
169
|
+
revision: integer({ mode: "number" }).notNull().default(0),
|
|
170
|
+
}, (table) => [check("usine_projection_revision_singleton", sql `${table.singleton} = 1`)]);
|
|
171
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/database/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,cAAc,EACd,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,GAAG,EACH,IAAI,EACJ,MAAM,GAC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/C,2BAA2B,EAC3B;IACE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3D,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAA,GAAG,KAAK,CAAC,SAAS,MAAM,CAAC,CAAC,CACvF,CAAC"}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Event, Item, Loop, Run } from "@usine/core";
|
|
2
|
+
import { Context, Crypto, Effect, Layer } from "effect";
|
|
3
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
4
|
+
import { RunDatabase } from "./database/database.ts";
|
|
5
|
+
import { type RunEngineError, type RunSnapshot, type Submission, type SubmissionResult, type TranscriptEntry, type TranscriptQuery } from "./model.ts";
|
|
6
|
+
import { RunReader } from "./run-reader.ts";
|
|
7
|
+
import { ItemProjectionReader, ItemProjectionWriter } from "./item-projection/service.ts";
|
|
8
|
+
import { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter } from "./repository-label-projection/service.ts";
|
|
9
|
+
import { StepExecutor } from "./step-executor.ts";
|
|
10
|
+
import { CursorStore } from "./cursor/store.ts";
|
|
11
|
+
import { LoopControl } from "./loop-control.ts";
|
|
12
|
+
declare const RunEngine_base: Context.ServiceClass<RunEngine, "@usine/engine/RunEngine", {
|
|
13
|
+
readonly approve: (runId: Run.RunId, approval: Event.Event) => Effect.Effect<void, RunEngineError>;
|
|
14
|
+
readonly cancel: (runId: Run.RunId) => Effect.Effect<void, RunEngineError>;
|
|
15
|
+
readonly inspect: (runId: Run.RunId) => Effect.Effect<RunSnapshot, RunEngineError>;
|
|
16
|
+
readonly reconcile: () => Effect.Effect<void, RunEngineError>;
|
|
17
|
+
readonly retry: (runId: Run.RunId) => Effect.Effect<void, RunEngineError>;
|
|
18
|
+
readonly revoke: (loop: Loop.LoopName, itemKey: Item.ItemKey) => Effect.Effect<ReadonlyArray<Run.RunId>, RunEngineError>;
|
|
19
|
+
readonly submit: (submission: Submission) => Effect.Effect<SubmissionResult, RunEngineError>;
|
|
20
|
+
readonly transcript: (query: TranscriptQuery) => Effect.Effect<ReadonlyArray<TranscriptEntry>, RunEngineError>;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* The public run-engine service. The interface below is the package's declared
|
|
24
|
+
* API — widen it deliberately, never by letting an implementation change leak
|
|
25
|
+
* through inference.
|
|
26
|
+
*/
|
|
27
|
+
export declare class RunEngine extends RunEngine_base {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds the durable runtime on a caller-selected SQLite-compatible database.
|
|
31
|
+
* The adapter must provide both Drizzle's run database and the matching Effect
|
|
32
|
+
* SQL client so run projections and cluster tables stay co-located. This entry
|
|
33
|
+
* is platform-free: the deployment supplies its platform `Crypto` (the cluster
|
|
34
|
+
* hashes over-length deduplication keys with it) next to the `StepExecutor`
|
|
35
|
+
* port — see `database/local-sqlite.ts` for the Node composition.
|
|
36
|
+
*/
|
|
37
|
+
export declare const layerWithDatabase: <DatabaseError, DatabaseRequirements>(database: Layer.Layer<RunDatabase | SqlClient.SqlClient, DatabaseError, DatabaseRequirements>) => Layer.Layer<CursorStore | ItemProjectionReader | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | RunEngine | RunReader, RunEngineError | DatabaseError, Crypto.Crypto | StepExecutor | DatabaseRequirements>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO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cAAc,CAAC;qBACxD,CACf,IAAI,EAAE,IAAI,CAAC,QAAQ,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,KAClB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;qBAC3C,CAAC,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC;yBACvE,CACnB,KAAK,EAAE,eAAe,KACnB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;;AAvBtE;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,cAoBD;CAAG;AAEjC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,EAAE,oBAAoB,YACzD,KAAK,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,KAC5F,KAAK,CAAC,KAAK,CACV,WAAW,GACX,oBAAoB,GACpB,oBAAoB,GACpB,WAAW,GACX,+BAA+B,GAC/B,+BAA+B,GAC/B,SAAS,GACT,SAAS,EACX,cAAc,GAAG,aAAa,EAC9B,MAAM,CAAC,MAAM,GAAG,YAAY,GAAG,oBAAoB,CA2BpD,CAAC"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Event, Item, Loop, Run } from "@usine/core";
|
|
2
|
+
import { Context, Crypto, Effect, Layer, Option, Result } from "effect";
|
|
3
|
+
import { ClusterWorkflowEngine, SingleRunner } from "effect/unstable/cluster";
|
|
4
|
+
import { SqlClient } from "effect/unstable/sql";
|
|
5
|
+
import { DurableDeferred, WorkflowEngine } from "effect/unstable/workflow";
|
|
6
|
+
import { RunDatabase } from "./database/database.js";
|
|
7
|
+
import { AttemptCancellationError, } from "./model.js";
|
|
8
|
+
import { RunStore } from "./store/store.js";
|
|
9
|
+
import { RunReader } from "./run-reader.js";
|
|
10
|
+
import { ItemProjectionReader, ItemProjectionWriter } from "./item-projection/service.js";
|
|
11
|
+
import { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter, } from "./repository-label-projection/service.js";
|
|
12
|
+
import { ApprovalGate, DurableRun, continueWithNewest, durableRunLayer, runIdFor, } from "./workflow.js";
|
|
13
|
+
import { StepExecutor } from "./step-executor.js";
|
|
14
|
+
import { CursorStore } from "./cursor/store.js";
|
|
15
|
+
import { LoopControl } from "./loop-control.js";
|
|
16
|
+
const MAX_SETTLEMENT_POLLS = 500;
|
|
17
|
+
const makeRunEngine = Effect.gen(function* () {
|
|
18
|
+
const store = yield* RunStore;
|
|
19
|
+
const stepExecutor = yield* StepExecutor;
|
|
20
|
+
const workflowEngine = yield* WorkflowEngine.WorkflowEngine;
|
|
21
|
+
const provideWorkflowEngine = (effect) => Effect.provideService(effect, WorkflowEngine.WorkflowEngine, workflowEngine);
|
|
22
|
+
const launch = Effect.fn("RunEngine.launch")(function* (submission) {
|
|
23
|
+
yield* DurableRun.execute({ submission }, { discard: true }).pipe(provideWorkflowEngine);
|
|
24
|
+
});
|
|
25
|
+
const deliverInterrupt = Effect.fn("RunEngine.deliverInterrupt")(function* (runId) {
|
|
26
|
+
yield* DurableRun.interrupt(runId).pipe(provideWorkflowEngine);
|
|
27
|
+
yield* store.completeWorkflowCommand(runId, "Interrupt");
|
|
28
|
+
});
|
|
29
|
+
const deliverApproval = Effect.fn("RunEngine.deliverApproval")(function* (runId) {
|
|
30
|
+
const token = DurableDeferred.tokenFromExecutionId(ApprovalGate, {
|
|
31
|
+
workflow: DurableRun,
|
|
32
|
+
executionId: runId,
|
|
33
|
+
});
|
|
34
|
+
yield* DurableDeferred.succeed(ApprovalGate, { token, value: undefined }).pipe(provideWorkflowEngine);
|
|
35
|
+
yield* store.completeWorkflowCommand(runId, "Approve");
|
|
36
|
+
});
|
|
37
|
+
const deliverContinuation = Effect.fn("RunEngine.deliverContinuation")(function* (runId) {
|
|
38
|
+
yield* continueWithNewest(store, runId).pipe(provideWorkflowEngine);
|
|
39
|
+
});
|
|
40
|
+
const awaitWorkflowSettlement = Effect.fn("RunEngine.awaitWorkflowSettlement")(function* (runId) {
|
|
41
|
+
// A Failed projection is committed before the workflow finishes suspending.
|
|
42
|
+
// Poll across that short handover so an immediate operator retry is not
|
|
43
|
+
// lost. A workflow still absent at the deadline is a corrupted instance
|
|
44
|
+
// database, not a race — die loudly instead of hanging delivery forever.
|
|
45
|
+
for (let poll = 0; poll < MAX_SETTLEMENT_POLLS; poll += 1) {
|
|
46
|
+
const status = yield* DurableRun.poll(runId).pipe(provideWorkflowEngine);
|
|
47
|
+
if (Option.isSome(status))
|
|
48
|
+
return status.value;
|
|
49
|
+
yield* Effect.sleep("10 millis");
|
|
50
|
+
}
|
|
51
|
+
return yield* Effect.die(new Error(`Run ${runId} has no durable workflow execution to settle`));
|
|
52
|
+
});
|
|
53
|
+
const deliverResume = Effect.fn("RunEngine.deliverResume")(function* (runId) {
|
|
54
|
+
const status = yield* awaitWorkflowSettlement(runId);
|
|
55
|
+
if (status._tag === "Complete") {
|
|
56
|
+
yield* store.reconcileCompletion(runId, status);
|
|
57
|
+
yield* store.completeWorkflowCommand(runId, "Resume");
|
|
58
|
+
yield* deliverContinuation(runId);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
yield* DurableRun.resume(runId).pipe(provideWorkflowEngine);
|
|
62
|
+
yield* store.completeWorkflowCommand(runId, "Resume");
|
|
63
|
+
});
|
|
64
|
+
const commandHandlers = {
|
|
65
|
+
Approve: deliverApproval,
|
|
66
|
+
Continue: deliverContinuation,
|
|
67
|
+
Interrupt: deliverInterrupt,
|
|
68
|
+
Resume: deliverResume,
|
|
69
|
+
};
|
|
70
|
+
const submit = Effect.fn("RunEngine.submit")(function* (submission) {
|
|
71
|
+
const requestedRunId = yield* runIdFor(submission);
|
|
72
|
+
const claim = yield* store.recordAndClaim(submission, requestedRunId);
|
|
73
|
+
if (Option.isSome(claim.supersededRun)) {
|
|
74
|
+
yield* deliverInterrupt(claim.supersededRun.value);
|
|
75
|
+
}
|
|
76
|
+
if (claim.result._tag === "Claimed") {
|
|
77
|
+
yield* launch(claim.submission);
|
|
78
|
+
}
|
|
79
|
+
return claim.result;
|
|
80
|
+
});
|
|
81
|
+
const approve = Effect.fn("RunEngine.approve")(function* (runId, approval) {
|
|
82
|
+
yield* store.approve(runId, approval);
|
|
83
|
+
yield* deliverApproval(runId);
|
|
84
|
+
});
|
|
85
|
+
const retry = Effect.fn("RunEngine.retry")(function* (runId) {
|
|
86
|
+
yield* store.retry(runId);
|
|
87
|
+
yield* deliverResume(runId);
|
|
88
|
+
});
|
|
89
|
+
const cancel = Effect.fn("RunEngine.cancel")(function* (runId) {
|
|
90
|
+
// The closing transaction decides both facts at once: whether the run was
|
|
91
|
+
// still open, and which attempt (if any) was in flight when it closed.
|
|
92
|
+
const outcome = yield* store.cancel(runId);
|
|
93
|
+
if (outcome._tag === "AlreadyClosed") {
|
|
94
|
+
yield* Effect.logDebug("Cancel was a no-op; the run was already closed", { runId });
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
yield* Effect.logInfo("Run canceled", {
|
|
98
|
+
runId,
|
|
99
|
+
openAttempt: Option.getOrElse(outcome.openAttempt, () => "none"),
|
|
100
|
+
});
|
|
101
|
+
const handshake = Option.isSome(outcome.openAttempt)
|
|
102
|
+
? yield* stepExecutor.interrupt(outcome.openAttempt.value).pipe(Effect.result)
|
|
103
|
+
: Result.succeed(undefined);
|
|
104
|
+
yield* deliverInterrupt(runId);
|
|
105
|
+
yield* deliverContinuation(runId);
|
|
106
|
+
if (Option.isSome(outcome.openAttempt) && Result.isFailure(handshake)) {
|
|
107
|
+
return yield* new AttemptCancellationError({
|
|
108
|
+
attemptId: outcome.openAttempt.value,
|
|
109
|
+
cause: handshake.failure,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const revoke = Effect.fn("RunEngine.revoke")(function* (loop, itemKey) {
|
|
114
|
+
const revoked = yield* store.revoke(loop, itemKey);
|
|
115
|
+
yield* Effect.forEach(revoked, deliverInterrupt, {
|
|
116
|
+
concurrency: "unbounded",
|
|
117
|
+
discard: true,
|
|
118
|
+
});
|
|
119
|
+
return revoked;
|
|
120
|
+
});
|
|
121
|
+
const inspect = Effect.fn("RunEngine.inspect")(function* (runId) {
|
|
122
|
+
return yield* store.snapshot(runId);
|
|
123
|
+
});
|
|
124
|
+
const transcript = Effect.fn("RunEngine.transcript")(function* (query) {
|
|
125
|
+
return yield* store.transcript(query);
|
|
126
|
+
});
|
|
127
|
+
const reconcile = Effect.fn("RunEngine.reconcile")(function* () {
|
|
128
|
+
yield* Effect.forEach(yield* store.pendingWorkflowCommands, ({ command, runId }) => commandHandlers[command](runId), { discard: true });
|
|
129
|
+
const recoverable = yield* store.recoverable;
|
|
130
|
+
yield* Effect.forEach(recoverable, ({ runId, state, submission }) => Effect.gen(function* () {
|
|
131
|
+
const status = yield* DurableRun.poll(runId).pipe(provideWorkflowEngine);
|
|
132
|
+
if (Option.isSome(status) && status.value._tag === "Complete") {
|
|
133
|
+
yield* store.reconcileCompletion(runId, status.value);
|
|
134
|
+
yield* deliverContinuation(runId);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (Option.isSome(status) && status.value._tag === "Suspended") {
|
|
138
|
+
if (state._tag === "Running") {
|
|
139
|
+
yield* deliverResume(runId);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
yield* launch(submission);
|
|
144
|
+
}), { concurrency: "unbounded", discard: true });
|
|
145
|
+
});
|
|
146
|
+
yield* reconcile();
|
|
147
|
+
return { approve, cancel, inspect, reconcile, retry, revoke, submit, transcript };
|
|
148
|
+
});
|
|
149
|
+
/**
|
|
150
|
+
* The public run-engine service. The interface below is the package's declared
|
|
151
|
+
* API — widen it deliberately, never by letting an implementation change leak
|
|
152
|
+
* through inference.
|
|
153
|
+
*/
|
|
154
|
+
export class RunEngine extends Context.Service()("@usine/engine/RunEngine") {
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Builds the durable runtime on a caller-selected SQLite-compatible database.
|
|
158
|
+
* The adapter must provide both Drizzle's run database and the matching Effect
|
|
159
|
+
* SQL client so run projections and cluster tables stay co-located. This entry
|
|
160
|
+
* is platform-free: the deployment supplies its platform `Crypto` (the cluster
|
|
161
|
+
* hashes over-length deduplication keys with it) next to the `StepExecutor`
|
|
162
|
+
* port — see `database/local-sqlite.ts` for the Node composition.
|
|
163
|
+
*/
|
|
164
|
+
export const layerWithDatabase = (database) => {
|
|
165
|
+
const store = RunStore.layer.pipe(Layer.provide(database));
|
|
166
|
+
const cluster = SingleRunner.layer({
|
|
167
|
+
runnerStorage: "memory",
|
|
168
|
+
shardingConfig: {
|
|
169
|
+
availableShardGroups: ["default", "workflow"],
|
|
170
|
+
assignedShardGroups: ["default", "workflow"],
|
|
171
|
+
entityTerminationTimeout: 0,
|
|
172
|
+
},
|
|
173
|
+
}).pipe(Layer.provide(database), Layer.orDie);
|
|
174
|
+
const workflowEngine = ClusterWorkflowEngine.layer.pipe(Layer.provide(cluster));
|
|
175
|
+
const runtime = durableRunLayer.pipe(Layer.provideMerge(workflowEngine), Layer.provideMerge(store));
|
|
176
|
+
const runEngine = Layer.effect(RunEngine, makeRunEngine).pipe(Layer.provide(runtime));
|
|
177
|
+
return Layer.mergeAll(runEngine, RunReader.layer.pipe(Layer.provide(database)), CursorStore.layer.pipe(Layer.provide(database)), ItemProjectionReader.layer.pipe(Layer.provide(database)), ItemProjectionWriter.layer.pipe(Layer.provide(database)), RepositoryLabelProjectionReader.layer.pipe(Layer.provide(database)), RepositoryLabelProjectionWriter.layer.pipe(Layer.provide(database)), LoopControl.layer.pipe(Layer.provide(database)));
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine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CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACtF,OAAO,KAAK,CAAC,QAAQ,CACnB,SAAS,EACT,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAC7C,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAC/C,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EACxD,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EACxD,+BAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EACnE,+BAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EACnE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @usine/engine —
|
|
2
|
+
* @usine/engine — durable Event → Run → Step → Attempt execution.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* This entry is platform-free: compose it with a database adapter through
|
|
5
|
+
* `layerWithDatabase`, or import the Node local adapter from
|
|
6
|
+
* `@usine/engine/local-sqlite`.
|
|
6
7
|
*/
|
|
7
|
-
export {};
|
|
8
|
+
export { ApprovalRequirement, AttemptCancellationError, Claimed, EnginePersistenceError, Ignored, IgnoreReason, InstanceDirectory, LoopRuntimeState, Queued, ProjectionRevision, RunEngineError, RunNotFoundError, RunOperationRejectedError, RunSnapshot, RunStoreError, RunSummary, StepExecution, Submission, SubmissionResult, TranscriptEntry, TranscriptAllQuery, TranscriptPageQuery, TranscriptQuery, TranscriptSequence, TranscriptTailQuery, } from "./model.ts";
|
|
9
|
+
export { ItemContentHash, ItemNumber, ItemProjection, ItemProjectionSource, } from "./item-projection/model.ts";
|
|
10
|
+
export { type ItemProjectionListOptions, ItemProjectionReader, ItemProjectionWriter, } from "./item-projection/service.ts";
|
|
11
|
+
export { RepositoryLabelProjection } from "./repository-label-projection/model.ts";
|
|
12
|
+
export { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter, } from "./repository-label-projection/service.ts";
|
|
13
|
+
export { RunDatabase, type RunDatabaseClient } from "./database/database.ts";
|
|
14
|
+
export { CursorKey } from "./cursor/model.ts";
|
|
15
|
+
export { CursorStore } from "./cursor/store.ts";
|
|
16
|
+
export { layerWithDatabase, RunEngine } from "./engine.ts";
|
|
17
|
+
export { RunReader } from "./run-reader.ts";
|
|
18
|
+
export { LoopControl } from "./loop-control.ts";
|
|
19
|
+
export { StepExecutor, type WorkerLease } from "./step-executor.ts";
|
|
8
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,OAAO,EACP,sBAAsB,EACtB,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,UAAU,EACV,cAAc,EACd,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,yBAAyB,EAC9B,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @usine/engine —
|
|
2
|
+
* @usine/engine — durable Event → Run → Step → Attempt execution.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* This entry is platform-free: compose it with a database adapter through
|
|
5
|
+
* `layerWithDatabase`, or import the Node local adapter from
|
|
6
|
+
* `@usine/engine/local-sqlite`.
|
|
6
7
|
*/
|
|
7
|
-
export {};
|
|
8
|
+
export { ApprovalRequirement, AttemptCancellationError, Claimed, EnginePersistenceError, Ignored, IgnoreReason, InstanceDirectory, LoopRuntimeState, Queued, ProjectionRevision, RunEngineError, RunNotFoundError, RunOperationRejectedError, RunSnapshot, RunStoreError, RunSummary, StepExecution, Submission, SubmissionResult, TranscriptEntry, TranscriptAllQuery, TranscriptPageQuery, TranscriptQuery, TranscriptSequence, TranscriptTailQuery, } from "./model.js";
|
|
9
|
+
export { ItemContentHash, ItemNumber, ItemProjection, ItemProjectionSource, } from "./item-projection/model.js";
|
|
10
|
+
export { ItemProjectionReader, ItemProjectionWriter, } from "./item-projection/service.js";
|
|
11
|
+
export { RepositoryLabelProjection } from "./repository-label-projection/model.js";
|
|
12
|
+
export { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter, } from "./repository-label-projection/service.js";
|
|
13
|
+
export { RunDatabase } from "./database/database.js";
|
|
14
|
+
export { CursorKey } from "./cursor/model.js";
|
|
15
|
+
export { CursorStore } from "./cursor/store.js";
|
|
16
|
+
export { layerWithDatabase, RunEngine } from "./engine.js";
|
|
17
|
+
export { RunReader } from "./run-reader.js";
|
|
18
|
+
export { LoopControl } from "./loop-control.js";
|
|
19
|
+
export { StepExecutor } from "./step-executor.js";
|
|
8
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,OAAO,EACP,sBAAsB,EACtB,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,UAAU,EACV,cAAc,EACd,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,WAAW,EAA0B,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Item } from "@usine/core";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export declare const ItemProjectionSource: Schema.brand<Schema.NonEmptyString, "ItemProjectionSource">;
|
|
4
|
+
export type ItemProjectionSource = typeof ItemProjectionSource.Type;
|
|
5
|
+
export declare const ItemNumber: Schema.brand<Schema.Int, "ItemNumber">;
|
|
6
|
+
export type ItemNumber = Item.Number;
|
|
7
|
+
export declare const ItemContentHash: Schema.brand<Schema.NonEmptyString, "ItemContentHash">;
|
|
8
|
+
export type ItemContentHash = typeof ItemContentHash.Type;
|
|
9
|
+
declare const ItemProjection_base: Schema.Class<ItemProjection, Schema.Struct<{
|
|
10
|
+
readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
|
|
11
|
+
readonly repository: Schema.brand<Schema.String, "RepoName">;
|
|
12
|
+
readonly source: Schema.brand<Schema.NonEmptyString, "ItemProjectionSource">;
|
|
13
|
+
readonly number: Schema.brand<Schema.Int, "ItemNumber">;
|
|
14
|
+
readonly contentHash: Schema.brand<Schema.NonEmptyString, "ItemContentHash">;
|
|
15
|
+
readonly payload: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
16
|
+
}>, {}>;
|
|
17
|
+
/** Latest trigger-observed payload for one Item, independent of its source adapter. */
|
|
18
|
+
export declare class ItemProjection extends ItemProjection_base {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/item-projection/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,oBAAoB,6DAEhC,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAC;AAEpE,eAAO,MAAM,UAAU,wCAAc,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;AAErC,eAAO,MAAM,eAAe,wDAA8D,CAAC;AAC3F,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;;;;;;;;;AAE1D,uFAAuF;AACvF,qBAAa,cAAe,SAAQ,mBAOlC;CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Item, Repository } from "@usine/core";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export const ItemProjectionSource = Schema.NonEmptyString.pipe(Schema.brand("ItemProjectionSource"));
|
|
4
|
+
export const ItemNumber = Item.Number;
|
|
5
|
+
export const ItemContentHash = Schema.NonEmptyString.pipe(Schema.brand("ItemContentHash"));
|
|
6
|
+
/** Latest trigger-observed payload for one Item, independent of its source adapter. */
|
|
7
|
+
export class ItemProjection extends Schema.Class("@usine/engine/ItemProjection")({
|
|
8
|
+
itemKey: Item.ItemKey,
|
|
9
|
+
repository: Repository.Name,
|
|
10
|
+
source: ItemProjectionSource,
|
|
11
|
+
number: ItemNumber,
|
|
12
|
+
contentHash: ItemContentHash,
|
|
13
|
+
payload: Schema.JsonObject,
|
|
14
|
+
}) {
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/item-projection/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAC5D,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CACrC,CAAC;AAGF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;AAGtC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAG3F,uFAAuF;AACvF,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,KAAK,CAAiB,8BAA8B,CAAC,CAAC;IAC/F,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,UAAU,EAAE,UAAU,CAAC,IAAI;IAC3B,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC,UAAU;CAC3B,CAAC;CAAG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Repository } from "@usine/core";
|
|
2
|
+
import { Context, Effect, Layer } from "effect";
|
|
3
|
+
import { RunDatabase } from "../database/database.ts";
|
|
4
|
+
import { EnginePersistenceError } from "../model.ts";
|
|
5
|
+
import { ItemProjection } from "./model.ts";
|
|
6
|
+
/** Newest Items first; the bound keeps a long-lived repository's Board response finite. */
|
|
7
|
+
export interface ItemProjectionListOptions {
|
|
8
|
+
readonly limit: number;
|
|
9
|
+
}
|
|
10
|
+
declare const ItemProjectionReader_base: Context.ServiceClass<ItemProjectionReader, "@usine/engine/ItemProjectionReader", {
|
|
11
|
+
/** The newest `limit` Item projections of one repository, highest number first. */
|
|
12
|
+
readonly list: (repository: Repository.Name, options: ItemProjectionListOptions) => Effect.Effect<ReadonlyArray<ItemProjection>, EnginePersistenceError>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class ItemProjectionReader extends ItemProjectionReader_base {
|
|
15
|
+
static readonly layer: Layer.Layer<ItemProjectionReader, never, RunDatabase>;
|
|
16
|
+
}
|
|
17
|
+
declare const ItemProjectionWriter_base: Context.ServiceClass<ItemProjectionWriter, "@usine/engine/ItemProjectionWriter", {
|
|
18
|
+
/** `true` means the durable projection changed. */
|
|
19
|
+
readonly upsert: (item: ItemProjection) => Effect.Effect<boolean, EnginePersistenceError>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare class ItemProjectionWriter extends ItemProjectionWriter_base {
|
|
22
|
+
static readonly layer: Layer.Layer<ItemProjectionWriter, never, RunDatabase>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/item-projection/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAA+B,cAAc,EAAwB,MAAM,YAAY,CAAC;AAmB/F,2FAA2F;AAC3F,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;;IAqFG,mFAAmF;mBACpE,CACb,UAAU,EAAE,UAAU,CAAC,IAAI,EAC3B,OAAO,EAAE,yBAAyB,KAC/B,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC;;AAP7E,qBAAa,oBAAqB,SAAQ,yBASD;IACvC,MAAM,CAAC,QAAQ,CAAC,KAAK,wDAAkD;CACxE;;IAKG,mDAAmD;qBAClC,CAAC,IAAI,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,sBAAsB,CAAC;;AAJ7F,qBAAa,oBAAqB,SAAQ,yBAMD;IACvC,MAAM,CAAC,QAAQ,CAAC,KAAK,wDAAkD;CACxE"}
|