@relayfx/sdk 0.2.13 → 0.2.14
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/dist/ai.js +2 -2
- package/dist/index-15f2ewt8.js +69 -0
- package/dist/{index-3e4cs8s6.js → index-9q3yh32k.js} +613 -526
- package/dist/{index-rmaq3qc8.js → index-gb7d1wfm.js} +744 -395
- package/dist/{index-kghdnamr.js → index-qg0hy7s1.js} +1 -1
- package/dist/index.js +10 -4
- package/dist/mysql.js +122 -0
- package/dist/postgres.js +77 -0
- package/dist/sqlite.js +84 -3
- package/dist/types/relay/client.d.ts +6 -4
- package/dist/types/relay/index.d.ts +3 -1
- package/dist/types/relay/migration-errors.d.ts +4 -0
- package/dist/types/relay/mysql-migrations.d.ts +1 -0
- package/dist/types/relay/mysql.d.ts +13 -0
- package/dist/types/relay/postgres.d.ts +13 -0
- package/dist/types/relay/runtime-capability-policy.d.ts +19 -0
- package/dist/types/relay/runtime-database-adapter.d.ts +12 -0
- package/dist/types/relay/runtime-database.d.ts +21 -0
- package/dist/types/relay/runtime.d.ts +198 -0
- package/dist/types/relay/sqlite-runtime.d.ts +9 -0
- package/dist/types/relay/sqlite.d.ts +2 -0
- package/dist/types/runtime/child/child-fan-out-runtime.d.ts +2 -0
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +30 -30
- package/dist/types/runtime/workflow/definition-runtime.d.ts +2 -0
- package/dist/types/store-sql/workflow/workflow-definition-repository.d.ts +6 -2
- package/package.json +11 -2
|
@@ -2962,10 +2962,17 @@ var layer7 = Layer7.effect(Service7, Effect8.gen(function* () {
|
|
|
2962
2962
|
return yield* new ChildFanOutConflict({ fan_out_id: definition.fan_out_id });
|
|
2963
2963
|
return existing;
|
|
2964
2964
|
}
|
|
2965
|
-
|
|
2965
|
+
const inserted = sql.withTransaction(Effect8.gen(function* () {
|
|
2966
2966
|
yield* sql`INSERT INTO relay_child_fan_outs (tenant_id, id, parent_execution_id, definition_json, state, created_at) VALUES (${tenantId}, ${definition.fan_out_id}, ${definition.parent_execution_id}, ${encodeJson(definition)}, 'joining', ${timestampParam(sql, definition.created_at)})`;
|
|
2967
2967
|
yield* Effect8.forEach(definition.children, (child, ordinal) => sql`INSERT INTO relay_child_fan_out_members (tenant_id, fan_out_id, child_execution_id, ordinal, state) VALUES (${tenantId}, ${definition.fan_out_id}, ${child.child_execution_id}, ${ordinal}, 'queued')`, { discard: true });
|
|
2968
|
-
}))
|
|
2968
|
+
}));
|
|
2969
|
+
yield* inserted.pipe(Effect8.mapError(repositoryError), Effect8.catch((error) => Effect8.gen(function* () {
|
|
2970
|
+
const current2 = yield* load(tenantId, definition.fan_out_id).pipe(Effect8.mapError(repositoryError));
|
|
2971
|
+
if (current2 === undefined)
|
|
2972
|
+
return yield* error;
|
|
2973
|
+
if (!sameDefinition(cloneDefinition3(current2), definition))
|
|
2974
|
+
return yield* new ChildFanOutConflict({ fan_out_id: definition.fan_out_id });
|
|
2975
|
+
})));
|
|
2969
2976
|
const created = yield* load(tenantId, definition.fan_out_id).pipe(Effect8.mapError(repositoryError));
|
|
2970
2977
|
if (created === undefined)
|
|
2971
2978
|
return yield* new ChildFanOutRepositoryError({ message: "Fan-out insert returned no row" });
|
|
@@ -9706,12 +9713,20 @@ var memoryLayer27 = Layer28.sync(Service28, () => {
|
|
|
9706
9713
|
inspect,
|
|
9707
9714
|
listNonterminal: Effect29.fn("WorkflowDefinitionRepository.memory.listNonterminal")(() => Effect29.sync(() => [...runs.values()].filter((record2) => record2.status === "running").map(clone3))),
|
|
9708
9715
|
cancel: Effect29.fn("WorkflowDefinitionRepository.memory.cancel")(function* (id2) {
|
|
9716
|
+
const now = yield* Clock3.currentTimeMillis;
|
|
9709
9717
|
const record2 = runs.get(id2);
|
|
9710
9718
|
if (record2 === undefined)
|
|
9711
|
-
return;
|
|
9712
|
-
|
|
9719
|
+
return { transitioned: false, record: undefined };
|
|
9720
|
+
if (record2.status !== "running")
|
|
9721
|
+
return { transitioned: false, record: clone3(record2) };
|
|
9722
|
+
const updated = { ...record2, status: "cancelled", updated_at: now };
|
|
9713
9723
|
runs.set(id2, updated);
|
|
9714
|
-
|
|
9724
|
+
const events = lifecycle.get(id2) ?? [];
|
|
9725
|
+
lifecycle.set(id2, [
|
|
9726
|
+
...events,
|
|
9727
|
+
{ execution_id: id2, sequence: events.length + 1, type: "workflow.cancelled", created_at: now }
|
|
9728
|
+
]);
|
|
9729
|
+
return { transitioned: true, record: clone3(updated) };
|
|
9715
9730
|
}),
|
|
9716
9731
|
getOperation: Effect29.fn("WorkflowDefinitionRepository.memory.getOperation")((executionId, operationId2) => Effect29.sync(() => clone3(operations.get(`${executionId}:${operationId2}`)))),
|
|
9717
9732
|
putOperation: Effect29.fn("WorkflowDefinitionRepository.memory.putOperation")((state) => Effect29.sync(() => {
|
|
@@ -9726,18 +9741,34 @@ var memoryLayer27 = Layer28.sync(Service28, () => {
|
|
|
9726
9741
|
return clone3(stored);
|
|
9727
9742
|
})),
|
|
9728
9743
|
listLifecycle: Effect29.fn("WorkflowDefinitionRepository.memory.listLifecycle")((executionId) => Effect29.sync(() => clone3(lifecycle.get(executionId) ?? []))),
|
|
9729
|
-
finish: Effect29.fn("WorkflowDefinitionRepository.memory.finish")(function* (id2, status) {
|
|
9744
|
+
finish: Effect29.fn("WorkflowDefinitionRepository.memory.finish")(function* (id2, status, data) {
|
|
9745
|
+
const now = yield* Clock3.currentTimeMillis;
|
|
9730
9746
|
const record2 = runs.get(id2);
|
|
9731
|
-
if (record2 === undefined)
|
|
9732
|
-
return;
|
|
9733
|
-
const updated = { ...record2, status, updated_at:
|
|
9747
|
+
if (record2 === undefined || record2.status !== "running")
|
|
9748
|
+
return { transitioned: false, record: record2 === undefined ? undefined : clone3(record2) };
|
|
9749
|
+
const updated = { ...record2, status, updated_at: now };
|
|
9734
9750
|
runs.set(id2, updated);
|
|
9735
|
-
|
|
9751
|
+
const events = lifecycle.get(id2) ?? [];
|
|
9752
|
+
lifecycle.set(id2, [
|
|
9753
|
+
...events,
|
|
9754
|
+
{
|
|
9755
|
+
execution_id: id2,
|
|
9756
|
+
sequence: events.length + 1,
|
|
9757
|
+
type: status === "completed" ? "workflow.completed" : "workflow.failed",
|
|
9758
|
+
...data === undefined ? {} : { data: clone3(data) },
|
|
9759
|
+
created_at: now
|
|
9760
|
+
}
|
|
9761
|
+
]);
|
|
9762
|
+
return { transitioned: true, record: clone3(updated) };
|
|
9736
9763
|
})
|
|
9737
9764
|
});
|
|
9738
9765
|
});
|
|
9739
9766
|
var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
9740
9767
|
const sql = yield* SqlClient28;
|
|
9768
|
+
const operationUpsert = sql.onDialectOrElse({
|
|
9769
|
+
mysql: () => sql.literal("ON DUPLICATE KEY UPDATE status=VALUES(status), fan_out_id=VALUES(fan_out_id), decision=VALUES(decision), output_json=VALUES(output_json), attempt=VALUES(attempt), backoff_until=VALUES(backoff_until), compensation_operation_id=VALUES(compensation_operation_id), started_at=VALUES(started_at), completed_at=VALUES(completed_at), updated_at=VALUES(updated_at)"),
|
|
9770
|
+
orElse: () => sql.literal("ON CONFLICT (tenant_id, execution_id, operation_id) DO UPDATE SET status=excluded.status, fan_out_id=excluded.fan_out_id, decision=excluded.decision, output_json=excluded.output_json, attempt=excluded.attempt, backoff_until=excluded.backoff_until, compensation_operation_id=excluded.compensation_operation_id, started_at=excluded.started_at, completed_at=excluded.completed_at, updated_at=excluded.updated_at")
|
|
9771
|
+
});
|
|
9741
9772
|
const register = Effect29.fn("WorkflowDefinitionRepository.register")(function* (input) {
|
|
9742
9773
|
const tenant = yield* current();
|
|
9743
9774
|
const digest = yield* Effect29.promise(() => exports_workflow_schema.digestDefinition(input.definition));
|
|
@@ -9768,7 +9799,7 @@ var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
|
9768
9799
|
start: Effect29.fn("WorkflowDefinitionRepository.start")(function* (input) {
|
|
9769
9800
|
const tenant = yield* current();
|
|
9770
9801
|
const now = yield* Clock3.currentTimeMillis;
|
|
9771
|
-
|
|
9802
|
+
const insert = sql.withTransaction(Effect29.gen(function* () {
|
|
9772
9803
|
const old = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${input.execution_id}`;
|
|
9773
9804
|
if (old[0] !== undefined)
|
|
9774
9805
|
return decodeRun(old[0]);
|
|
@@ -9788,6 +9819,7 @@ var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
|
9788
9819
|
updated_at: now
|
|
9789
9820
|
};
|
|
9790
9821
|
}));
|
|
9822
|
+
return yield* insert.pipe(Effect29.catch((error5) => sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${input.execution_id}`.pipe(Effect29.flatMap((rows) => rows[0] === undefined ? Effect29.fail(error5) : Effect29.succeed(decodeRun(rows[0]))))));
|
|
9791
9823
|
}),
|
|
9792
9824
|
inspect: Effect29.fn("WorkflowDefinitionRepository.inspect")(function* (id2) {
|
|
9793
9825
|
const tenant = yield* current();
|
|
@@ -9802,9 +9834,7 @@ var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
|
9802
9834
|
cancel: Effect29.fn("WorkflowDefinitionRepository.cancel")(function* (id2) {
|
|
9803
9835
|
const tenant = yield* current();
|
|
9804
9836
|
const now = yield* Clock3.currentTimeMillis;
|
|
9805
|
-
yield* sql
|
|
9806
|
-
const rows = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${id2}`;
|
|
9807
|
-
return rows[0] === undefined ? undefined : decodeRun(rows[0]);
|
|
9837
|
+
return yield* transition2(sql, tenant, id2, "cancelled", now);
|
|
9808
9838
|
}),
|
|
9809
9839
|
getOperation: Effect29.fn("WorkflowDefinitionRepository.getOperation")(function* (executionId, operationId2) {
|
|
9810
9840
|
const tenant = yield* current();
|
|
@@ -9813,8 +9843,7 @@ var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
|
9813
9843
|
}),
|
|
9814
9844
|
putOperation: Effect29.fn("WorkflowDefinitionRepository.putOperation")(function* (state) {
|
|
9815
9845
|
const tenant = yield* current();
|
|
9816
|
-
yield* sql`
|
|
9817
|
-
yield* sql`INSERT INTO relay_workflow_operation_states (tenant_id, execution_id, operation_id, status, fan_out_id, decision, output_json, attempt, backoff_until, compensation_operation_id, started_at, completed_at, updated_at) VALUES (${tenant}, ${state.execution_id}, ${state.operation_id}, ${state.status}, ${state.fan_out_id ?? null}, ${state.decision === undefined ? null : state.decision}, ${state.output === undefined ? null : encodeJson(state.output)}, ${state.attempt ?? null}, ${state.backoff_until === undefined ? null : timestampParam(sql, state.backoff_until)}, ${state.compensation_operation_id ?? null}, ${state.started_at === undefined ? null : timestampParam(sql, state.started_at)}, ${state.completed_at === undefined ? null : timestampParam(sql, state.completed_at)}, ${timestampParam(sql, state.updated_at)})`;
|
|
9846
|
+
yield* sql`INSERT INTO relay_workflow_operation_states (tenant_id, execution_id, operation_id, status, fan_out_id, decision, output_json, attempt, backoff_until, compensation_operation_id, started_at, completed_at, updated_at) VALUES (${tenant}, ${state.execution_id}, ${state.operation_id}, ${state.status}, ${state.fan_out_id ?? null}, ${state.decision === undefined ? null : state.decision}, ${state.output === undefined ? null : encodeJson(state.output)}, ${state.attempt ?? null}, ${state.backoff_until === undefined ? null : timestampParam(sql, state.backoff_until)}, ${state.compensation_operation_id ?? null}, ${state.started_at === undefined ? null : timestampParam(sql, state.started_at)}, ${state.completed_at === undefined ? null : timestampParam(sql, state.completed_at)}, ${timestampParam(sql, state.updated_at)}) ${operationUpsert}`;
|
|
9818
9847
|
return state;
|
|
9819
9848
|
}),
|
|
9820
9849
|
listOperations: Effect29.fn("WorkflowDefinitionRepository.listOperations")(function* (executionId) {
|
|
@@ -9836,15 +9865,41 @@ var layer27 = Layer28.effect(Service28, Effect29.gen(function* () {
|
|
|
9836
9865
|
const rows = yield* sql`SELECT * FROM relay_workflow_lifecycle_events WHERE tenant_id=${tenant} AND execution_id=${executionId} ORDER BY sequence`;
|
|
9837
9866
|
return rows.map(decodeLifecycle);
|
|
9838
9867
|
}),
|
|
9839
|
-
finish: Effect29.fn("WorkflowDefinitionRepository.finish")(function* (id2, status) {
|
|
9868
|
+
finish: Effect29.fn("WorkflowDefinitionRepository.finish")(function* (id2, status, data) {
|
|
9840
9869
|
const tenant = yield* current();
|
|
9841
9870
|
const now = yield* Clock3.currentTimeMillis;
|
|
9842
|
-
yield* sql
|
|
9843
|
-
const rows = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${id2}`;
|
|
9844
|
-
return rows[0] === undefined ? undefined : decodeRun(rows[0]);
|
|
9871
|
+
return yield* transition2(sql, tenant, id2, status, now, data);
|
|
9845
9872
|
})
|
|
9846
9873
|
});
|
|
9847
9874
|
}));
|
|
9875
|
+
var transition2 = (sql, tenant, id2, status, now, data) => sql.withTransaction(Effect29.gen(function* () {
|
|
9876
|
+
const result = yield* sql.onDialectOrElse({
|
|
9877
|
+
mysql: () => Effect29.gen(function* () {
|
|
9878
|
+
const before = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${id2} FOR UPDATE`;
|
|
9879
|
+
if (before[0] === undefined)
|
|
9880
|
+
return { transitioned: false, record: undefined };
|
|
9881
|
+
if (before[0].status !== "running")
|
|
9882
|
+
return { transitioned: false, record: decodeRun(before[0]) };
|
|
9883
|
+
yield* sql`UPDATE relay_workflow_runs SET status=${status}, updated_at=${timestampParam(sql, now)} WHERE tenant_id=${tenant} AND execution_id=${id2} AND status='running'`;
|
|
9884
|
+
const rows2 = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${id2}`;
|
|
9885
|
+
return { transitioned: true, record: decodeRun(rows2[0]) };
|
|
9886
|
+
}),
|
|
9887
|
+
orElse: () => Effect29.gen(function* () {
|
|
9888
|
+
const changed = yield* sql`UPDATE relay_workflow_runs SET status=${status}, updated_at=${timestampParam(sql, now)} WHERE tenant_id=${tenant} AND execution_id=${id2} AND status='running' RETURNING execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at`;
|
|
9889
|
+
if (changed[0] !== undefined)
|
|
9890
|
+
return { transitioned: true, record: decodeRun(changed[0]) };
|
|
9891
|
+
const rows2 = yield* sql`SELECT execution_id, workflow_definition_id, workflow_definition_revision, workflow_definition_digest, status, created_at, updated_at FROM relay_workflow_runs WHERE tenant_id=${tenant} AND execution_id=${id2}`;
|
|
9892
|
+
return { transitioned: false, record: rows2[0] === undefined ? undefined : decodeRun(rows2[0]) };
|
|
9893
|
+
})
|
|
9894
|
+
});
|
|
9895
|
+
if (!result.transitioned)
|
|
9896
|
+
return result;
|
|
9897
|
+
const rows = yield* sql`SELECT COALESCE(MAX(sequence), 0) AS sequence FROM relay_workflow_lifecycle_events WHERE tenant_id=${tenant} AND execution_id=${id2}`;
|
|
9898
|
+
const sequence = Number(rows[0]?.sequence ?? 0) + 1;
|
|
9899
|
+
const eventType = status === "cancelled" ? "workflow.cancelled" : status === "completed" ? "workflow.completed" : "workflow.failed";
|
|
9900
|
+
yield* sql`INSERT INTO relay_workflow_lifecycle_events (tenant_id, execution_id, sequence, event_type, operation_id, data_json, created_at) VALUES (${tenant}, ${id2}, ${sequence}, ${eventType}, ${null}, ${data === undefined ? null : encodeJson(data)}, ${timestampParam(sql, now)})`;
|
|
9901
|
+
return result;
|
|
9902
|
+
}));
|
|
9848
9903
|
var decodeDefinition = (row) => ({
|
|
9849
9904
|
id: exports_ids_schema.WorkflowDefinitionId.make(row.workflow_definition_id),
|
|
9850
9905
|
revision: Number(row.revision),
|
|
@@ -10306,7 +10361,10 @@ var layerFromRepository2 = Layer30.effect(Service30, Effect32.gen(function* () {
|
|
|
10306
10361
|
yield* recordEventReplayed("repository", replay.history.length);
|
|
10307
10362
|
return replay.history;
|
|
10308
10363
|
}),
|
|
10309
|
-
stream: (input) => Stream5.unwrap(loadReplay(input).pipe(Effect32.map(({ history, sequence }) =>
|
|
10364
|
+
stream: (input) => Stream5.unwrap(loadReplay(input).pipe(Effect32.map(({ history, sequence }) => {
|
|
10365
|
+
const replay = Stream5.fromIterable(history);
|
|
10366
|
+
return history.some(isTerminal) ? replay : replay.pipe(Stream5.concat(liveTail(repository, hubs, input, history.at(-1)?.sequence ?? sequence).pipe(Stream5.takeUntil(isTerminal))));
|
|
10367
|
+
}))),
|
|
10310
10368
|
findBySequenceOrCursor: Effect32.fn("EventLog.repository.findBySequenceOrCursor")((input) => repository.findBySequenceOrCursor(input).pipe(Effect32.mapError(mapRepositoryFindError))),
|
|
10311
10369
|
findByCursor: Effect32.fn("EventLog.repository.findByCursor")((input) => repository.findByCursor(input).pipe(Effect32.mapError(mapRepositoryFindError))),
|
|
10312
10370
|
findBySequence: Effect32.fn("EventLog.repository.findBySequence")((input) => repository.findBySequence(input).pipe(Effect32.mapError(mapRepositoryFindError))),
|
|
@@ -10358,7 +10416,10 @@ var memoryLayer29 = Layer30.effect(Service30, Effect32.gen(function* () {
|
|
|
10358
10416
|
yield* recordEventReplayed("memory", replay.history.length);
|
|
10359
10417
|
return replay.history;
|
|
10360
10418
|
}),
|
|
10361
|
-
stream: (input) => Stream5.unwrap(loadReplay(input).pipe(Effect32.map(({ history, sequence }) =>
|
|
10419
|
+
stream: (input) => Stream5.unwrap(loadReplay(input).pipe(Effect32.map(({ history, sequence }) => {
|
|
10420
|
+
const replay = Stream5.fromIterable(history);
|
|
10421
|
+
return history.some(isTerminal) ? replay : replay.pipe(Stream5.concat(liveEvents(pubsub, input, history, sequence)));
|
|
10422
|
+
}))),
|
|
10362
10423
|
findBySequenceOrCursor: Effect32.fn("EventLog.memory.findBySequenceOrCursor")(function* (input) {
|
|
10363
10424
|
const executionEvents = yield* allEvents(input.executionId);
|
|
10364
10425
|
const event = executionEvents.find((item) => item.sequence === input.sequence || item.cursor === input.cursor);
|
|
@@ -13984,22 +14045,179 @@ var spawnDynamic = Effect58.fn("ChildRunService.spawnDynamic.call")(function* (i
|
|
|
13984
14045
|
return yield* service.spawnDynamic(input);
|
|
13985
14046
|
});
|
|
13986
14047
|
|
|
13987
|
-
// ../runtime/src/model/
|
|
13988
|
-
var
|
|
13989
|
-
__export(
|
|
14048
|
+
// ../runtime/src/model/embedding-model-service.ts
|
|
14049
|
+
var exports_embedding_model_service = {};
|
|
14050
|
+
__export(exports_embedding_model_service, {
|
|
13990
14051
|
testLayer: () => testLayer46,
|
|
13991
14052
|
registrations: () => registrations2,
|
|
13992
14053
|
registrationFromLayer: () => registrationFromLayer2,
|
|
13993
14054
|
register: () => register5,
|
|
13994
14055
|
provideForAgent: () => provideForAgent,
|
|
14056
|
+
provideDefault: () => provideDefault,
|
|
13995
14057
|
provide: () => provide2,
|
|
13996
14058
|
memoryLayer: () => memoryLayer35,
|
|
13997
14059
|
layerFromRegistrationEffects: () => layerFromRegistrationEffects2,
|
|
13998
14060
|
layer: () => layer40,
|
|
14061
|
+
deterministicTestLayer: () => deterministicTestLayer,
|
|
14062
|
+
deterministicRegistration: () => deterministicRegistration,
|
|
14063
|
+
deterministicLayer: () => deterministicLayer,
|
|
13999
14064
|
Service: () => Service38,
|
|
14065
|
+
EmbeddingModelNotRegistered: () => EmbeddingModelNotRegistered
|
|
14066
|
+
});
|
|
14067
|
+
import { Context as Context51, Effect as Effect59, Layer as Layer52, Ref as Ref16, Schema as Schema67 } from "effect";
|
|
14068
|
+
import { EmbeddingModel as EmbeddingModel2, Model as Model3 } from "effect/unstable/ai";
|
|
14069
|
+
|
|
14070
|
+
class EmbeddingModelNotRegistered extends Schema67.TaggedErrorClass()("EmbeddingModelNotRegistered", {
|
|
14071
|
+
provider: Schema67.String,
|
|
14072
|
+
model: Schema67.String,
|
|
14073
|
+
registration_key: Schema67.optionalKey(Schema67.String)
|
|
14074
|
+
}) {
|
|
14075
|
+
}
|
|
14076
|
+
|
|
14077
|
+
class Service38 extends Context51.Service()("@relayfx/runtime/EmbeddingModelService") {
|
|
14078
|
+
}
|
|
14079
|
+
var toRegistration = (input) => ({
|
|
14080
|
+
provider: input.provider,
|
|
14081
|
+
model: input.model,
|
|
14082
|
+
...input.registrationKey === undefined ? {} : { registrationKey: input.registrationKey },
|
|
14083
|
+
layer: input.layer,
|
|
14084
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
14085
|
+
});
|
|
14086
|
+
var selectionError = (selection) => new EmbeddingModelNotRegistered({
|
|
14087
|
+
provider: selection.provider,
|
|
14088
|
+
model: selection.model,
|
|
14089
|
+
...selection.registrationKey === undefined ? {} : { registration_key: selection.registrationKey }
|
|
14090
|
+
});
|
|
14091
|
+
var defaultSelectionError = () => new EmbeddingModelNotRegistered({ provider: "default", model: "default" });
|
|
14092
|
+
var matchesSelection2 = (selection, registration) => registration.provider === selection.provider && registration.model === selection.model && (selection.registrationKey === undefined || registration.registrationKey === selection.registrationKey);
|
|
14093
|
+
var resolve3 = (registrations2, selection) => {
|
|
14094
|
+
const matches2 = registrations2.filter((registration) => matchesSelection2(selection, registration));
|
|
14095
|
+
if (selection.registrationKey !== undefined)
|
|
14096
|
+
return matches2[0];
|
|
14097
|
+
if (matches2.length === 1)
|
|
14098
|
+
return matches2[0];
|
|
14099
|
+
return matches2.find((registration) => registration.registrationKey === undefined);
|
|
14100
|
+
};
|
|
14101
|
+
var resolveDefault = (registrations2, options) => {
|
|
14102
|
+
if (options?.defaultSelection !== undefined) {
|
|
14103
|
+
return resolve3(registrations2, options.defaultSelection);
|
|
14104
|
+
}
|
|
14105
|
+
return registrations2.length === 1 ? registrations2[0] : undefined;
|
|
14106
|
+
};
|
|
14107
|
+
var registrationFromLayer2 = (input) => Model3.make(input.provider, input.model, input.layer).captureRequirements.pipe(Effect59.map((layer40) => toRegistration({
|
|
14108
|
+
provider: input.provider,
|
|
14109
|
+
model: input.model,
|
|
14110
|
+
...input.registrationKey === undefined ? {} : { registrationKey: input.registrationKey },
|
|
14111
|
+
layer: layer40,
|
|
14112
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
14113
|
+
})));
|
|
14114
|
+
var layer40 = (initialRegistrations = [], options) => Layer52.effect(Service38, Effect59.gen(function* () {
|
|
14115
|
+
const registry = yield* Ref16.make([...initialRegistrations]);
|
|
14116
|
+
const register5 = Effect59.fn("EmbeddingModelService.register")(function* (input) {
|
|
14117
|
+
const registration = toRegistration(input);
|
|
14118
|
+
yield* Ref16.update(registry, (current2) => [
|
|
14119
|
+
...current2.filter((item) => !(item.provider === registration.provider && item.model === registration.model && item.registrationKey === registration.registrationKey)),
|
|
14120
|
+
registration
|
|
14121
|
+
]);
|
|
14122
|
+
});
|
|
14123
|
+
const registrations2 = Ref16.get(registry);
|
|
14124
|
+
const provide2 = (selection, effect) => Effect59.gen(function* () {
|
|
14125
|
+
const current2 = yield* Ref16.get(registry);
|
|
14126
|
+
const registration = resolve3(current2, selection);
|
|
14127
|
+
if (registration === undefined)
|
|
14128
|
+
return yield* Effect59.fail(selectionError(selection));
|
|
14129
|
+
return yield* effect.pipe(Effect59.provide(registration.layer));
|
|
14130
|
+
});
|
|
14131
|
+
const provideDefault = (effect) => Effect59.gen(function* () {
|
|
14132
|
+
const current2 = yield* Ref16.get(registry);
|
|
14133
|
+
const registration = resolveDefault(current2, options);
|
|
14134
|
+
if (registration === undefined)
|
|
14135
|
+
return yield* Effect59.fail(defaultSelectionError());
|
|
14136
|
+
return yield* effect.pipe(Effect59.provide(registration.layer));
|
|
14137
|
+
});
|
|
14138
|
+
const provideForAgent = (agent, effect) => {
|
|
14139
|
+
return provideDefault(effect);
|
|
14140
|
+
};
|
|
14141
|
+
return Service38.of({ register: register5, registrations: registrations2, provide: provide2, provideDefault, provideForAgent });
|
|
14142
|
+
}));
|
|
14143
|
+
var layerFromRegistrationEffects2 = (registrations2, options) => Layer52.unwrap(Effect59.all(registrations2).pipe(Effect59.map((items) => layer40(items, options))));
|
|
14144
|
+
var memoryLayer35 = layer40;
|
|
14145
|
+
var testLayer46 = (implementation) => Layer52.succeed(Service38, Service38.of(implementation));
|
|
14146
|
+
var words = (input) => input.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
14147
|
+
var hashWord = (word) => {
|
|
14148
|
+
let hash = 2166136261;
|
|
14149
|
+
for (let index = 0;index < word.length; index += 1) {
|
|
14150
|
+
hash ^= word.charCodeAt(index);
|
|
14151
|
+
hash = Math.imul(hash, 16777619);
|
|
14152
|
+
}
|
|
14153
|
+
return hash >>> 0;
|
|
14154
|
+
};
|
|
14155
|
+
var deterministicVector = (input, dimensions) => {
|
|
14156
|
+
const vector = Array.from({ length: dimensions }, () => 0);
|
|
14157
|
+
for (const word of words(input)) {
|
|
14158
|
+
const hash = hashWord(word);
|
|
14159
|
+
const index = hash % dimensions;
|
|
14160
|
+
vector[index] = (vector[index] ?? 0) + 1;
|
|
14161
|
+
}
|
|
14162
|
+
return vector;
|
|
14163
|
+
};
|
|
14164
|
+
var deterministicLayer = (options = {}) => {
|
|
14165
|
+
const dimensions = options.dimensions ?? 64;
|
|
14166
|
+
return Layer52.mergeAll(Layer52.effect(EmbeddingModel2.EmbeddingModel, EmbeddingModel2.make({
|
|
14167
|
+
embedMany: ({ inputs }) => Effect59.succeed({
|
|
14168
|
+
results: inputs.map((input) => deterministicVector(input, dimensions)),
|
|
14169
|
+
usage: { inputTokens: inputs.reduce((total, input) => total + words(input).length, 0) }
|
|
14170
|
+
})
|
|
14171
|
+
})), Layer52.succeed(EmbeddingModel2.Dimensions, dimensions));
|
|
14172
|
+
};
|
|
14173
|
+
var deterministicRegistration = (options = {}) => registrationFromLayer2({
|
|
14174
|
+
provider: options.provider ?? "test",
|
|
14175
|
+
model: options.model ?? "deterministic-embedding",
|
|
14176
|
+
layer: deterministicLayer(options)
|
|
14177
|
+
});
|
|
14178
|
+
var deterministicTestLayer = (options = {}) => layerFromRegistrationEffects2([deterministicRegistration(options)], {
|
|
14179
|
+
defaultSelection: {
|
|
14180
|
+
provider: options.provider ?? "test",
|
|
14181
|
+
model: options.model ?? "deterministic-embedding"
|
|
14182
|
+
}
|
|
14183
|
+
});
|
|
14184
|
+
var register5 = Effect59.fn("EmbeddingModelService.register.call")(function* (input) {
|
|
14185
|
+
const service = yield* Service38;
|
|
14186
|
+
return yield* service.register(input);
|
|
14187
|
+
});
|
|
14188
|
+
var registrations2 = Effect59.fn("EmbeddingModelService.registrations.call")(function* () {
|
|
14189
|
+
const service = yield* Service38;
|
|
14190
|
+
return yield* service.registrations;
|
|
14191
|
+
});
|
|
14192
|
+
var provide2 = (selection, effect) => Effect59.gen(function* () {
|
|
14193
|
+
const service = yield* Service38;
|
|
14194
|
+
return yield* service.provide(selection, effect);
|
|
14195
|
+
});
|
|
14196
|
+
var provideDefault = (effect) => Effect59.gen(function* () {
|
|
14197
|
+
const service = yield* Service38;
|
|
14198
|
+
return yield* service.provideDefault(effect);
|
|
14199
|
+
});
|
|
14200
|
+
var provideForAgent = (agent, effect) => Effect59.gen(function* () {
|
|
14201
|
+
const service = yield* Service38;
|
|
14202
|
+
return yield* service.provideForAgent(agent, effect);
|
|
14203
|
+
});
|
|
14204
|
+
|
|
14205
|
+
// ../runtime/src/model/language-model-service.ts
|
|
14206
|
+
var exports_language_model_service = {};
|
|
14207
|
+
__export(exports_language_model_service, {
|
|
14208
|
+
testLayer: () => testLayer47,
|
|
14209
|
+
registrations: () => registrations3,
|
|
14210
|
+
registrationFromLayer: () => registrationFromLayer3,
|
|
14211
|
+
register: () => register6,
|
|
14212
|
+
provideForAgent: () => provideForAgent2,
|
|
14213
|
+
provide: () => provide3,
|
|
14214
|
+
memoryLayer: () => memoryLayer36,
|
|
14215
|
+
layerFromRegistrationEffects: () => layerFromRegistrationEffects3,
|
|
14216
|
+
layer: () => layer41,
|
|
14217
|
+
Service: () => Service39,
|
|
14000
14218
|
LanguageModelNotRegistered: () => LanguageModelNotRegistered2
|
|
14001
14219
|
});
|
|
14002
|
-
import { Context as
|
|
14220
|
+
import { Context as Context52, Effect as Effect60, Layer as Layer53 } from "effect";
|
|
14003
14221
|
var LanguageModelNotRegistered2 = exports_model_registry.LanguageModelNotRegistered;
|
|
14004
14222
|
var toSelection = (selection) => ({
|
|
14005
14223
|
provider: selection.provider,
|
|
@@ -14007,53 +14225,53 @@ var toSelection = (selection) => ({
|
|
|
14007
14225
|
...selection.registration_key === undefined ? {} : { registrationKey: selection.registration_key }
|
|
14008
14226
|
});
|
|
14009
14227
|
|
|
14010
|
-
class
|
|
14228
|
+
class Service39 extends Context52.Service()("@relayfx/runtime/LanguageModelService") {
|
|
14011
14229
|
}
|
|
14012
|
-
var
|
|
14013
|
-
var
|
|
14230
|
+
var registrationFromLayer3 = exports_model_registry.registrationFromLayer;
|
|
14231
|
+
var layer41 = (initialRegistrations = [], options) => Layer53.effect(Service39, Effect60.gen(function* () {
|
|
14014
14232
|
const registry = yield* exports_model_registry.Service;
|
|
14015
|
-
return
|
|
14233
|
+
return Service39.of({
|
|
14016
14234
|
register: (input) => registry.register(input),
|
|
14017
14235
|
registrations: registry.registrations,
|
|
14018
14236
|
provide: (selection, effect) => registry.provide(toSelection(selection), effect),
|
|
14019
14237
|
provideForAgent: (agent, effect) => registry.provide(toSelection(agent.model), effect)
|
|
14020
14238
|
});
|
|
14021
|
-
})).pipe(
|
|
14022
|
-
var
|
|
14023
|
-
var
|
|
14024
|
-
var
|
|
14025
|
-
var
|
|
14026
|
-
const service = yield*
|
|
14239
|
+
})).pipe(Layer53.provide(exports_model_registry.layer(initialRegistrations, options)));
|
|
14240
|
+
var layerFromRegistrationEffects3 = (registrations3, options) => Layer53.unwrap(Effect60.all(registrations3).pipe(Effect60.map((items) => layer41(items, options))));
|
|
14241
|
+
var memoryLayer36 = layer41;
|
|
14242
|
+
var testLayer47 = (implementation) => Layer53.succeed(Service39, Service39.of(implementation));
|
|
14243
|
+
var register6 = Effect60.fn("LanguageModelService.register.call")(function* (input) {
|
|
14244
|
+
const service = yield* Service39;
|
|
14027
14245
|
return yield* service.register(input);
|
|
14028
14246
|
});
|
|
14029
|
-
var
|
|
14030
|
-
const service = yield*
|
|
14247
|
+
var registrations3 = Effect60.fn("LanguageModelService.registrations.call")(function* () {
|
|
14248
|
+
const service = yield* Service39;
|
|
14031
14249
|
return yield* service.registrations;
|
|
14032
14250
|
});
|
|
14033
|
-
var
|
|
14034
|
-
const service = yield*
|
|
14251
|
+
var provide3 = (selection, effect) => Effect60.gen(function* () {
|
|
14252
|
+
const service = yield* Service39;
|
|
14035
14253
|
return yield* service.provide(selection, effect);
|
|
14036
14254
|
});
|
|
14037
|
-
var
|
|
14038
|
-
const service = yield*
|
|
14255
|
+
var provideForAgent2 = (agent, effect) => Effect60.gen(function* () {
|
|
14256
|
+
const service = yield* Service39;
|
|
14039
14257
|
return yield* service.provideForAgent(agent, effect);
|
|
14040
14258
|
});
|
|
14041
14259
|
|
|
14042
14260
|
// ../runtime/src/model/model-call-policy.ts
|
|
14043
14261
|
var exports_model_call_policy = {};
|
|
14044
14262
|
__export(exports_model_call_policy, {
|
|
14045
|
-
testLayer: () =>
|
|
14263
|
+
testLayer: () => testLayer48,
|
|
14046
14264
|
noRetryLayer: () => noRetryLayer,
|
|
14047
14265
|
make: () => make6,
|
|
14048
|
-
layer: () =>
|
|
14266
|
+
layer: () => layer42,
|
|
14049
14267
|
defaultSchedule: () => defaultSchedule,
|
|
14050
14268
|
defaultClassify: () => defaultClassify2,
|
|
14051
|
-
Service: () =>
|
|
14269
|
+
Service: () => Service40
|
|
14052
14270
|
});
|
|
14053
|
-
import { Context as
|
|
14271
|
+
import { Context as Context53, Duration as Duration3, Layer as Layer54, Schedule as Schedule5 } from "effect";
|
|
14054
14272
|
import { AiError as AiError4 } from "effect/unstable/ai";
|
|
14055
14273
|
|
|
14056
|
-
class
|
|
14274
|
+
class Service40 extends Context53.Service()("@relayfx/runtime/ModelCallPolicy") {
|
|
14057
14275
|
}
|
|
14058
14276
|
var isOutputValidationError = (error5) => AiError4.isAiError(error5) ? error5.reason._tag === "InvalidOutputError" : AiError4.isAiErrorReason(error5) && error5._tag === "InvalidOutputError";
|
|
14059
14277
|
var defaultClassify2 = (error5) => isOutputValidationError(error5) ? "terminal" : exports_model_resilience.defaultClassify(error5);
|
|
@@ -14062,58 +14280,58 @@ var make6 = (input) => ({
|
|
|
14062
14280
|
classify: input?.classify ?? defaultClassify2,
|
|
14063
14281
|
retrySchedule: input?.retrySchedule ?? defaultSchedule
|
|
14064
14282
|
});
|
|
14065
|
-
var
|
|
14066
|
-
var noRetryLayer =
|
|
14067
|
-
var
|
|
14283
|
+
var layer42 = (input) => Layer54.succeed(Service40, Service40.of(make6(input)));
|
|
14284
|
+
var noRetryLayer = layer42({ retrySchedule: Schedule5.recurs(0) });
|
|
14285
|
+
var testLayer48 = (implementation) => Layer54.succeed(Service40, Service40.of(implementation));
|
|
14068
14286
|
|
|
14069
14287
|
// ../runtime/src/presence/presence-service.ts
|
|
14070
14288
|
var exports_presence_service = {};
|
|
14071
14289
|
__export(exports_presence_service, {
|
|
14072
14290
|
watch: () => watch,
|
|
14073
|
-
testLayer: () =>
|
|
14074
|
-
register: () =>
|
|
14075
|
-
memoryLayer: () =>
|
|
14291
|
+
testLayer: () => testLayer49,
|
|
14292
|
+
register: () => register7,
|
|
14293
|
+
memoryLayer: () => memoryLayer37,
|
|
14076
14294
|
list: () => list14,
|
|
14077
14295
|
layerFromRepository: () => layerFromRepository3,
|
|
14078
|
-
Service: () =>
|
|
14296
|
+
Service: () => Service41,
|
|
14079
14297
|
PresenceIdentity: () => PresenceIdentity,
|
|
14080
14298
|
PresenceError: () => PresenceError
|
|
14081
14299
|
});
|
|
14082
|
-
import { Clock as Clock5, Config as Config2, Context as
|
|
14300
|
+
import { Clock as Clock5, Config as Config2, Context as Context54, Effect as Effect61, Layer as Layer55, Random, Schedule as Schedule6, Schema as Schema68, Stream as Stream10 } from "effect";
|
|
14083
14301
|
|
|
14084
|
-
class PresenceError extends
|
|
14085
|
-
message:
|
|
14302
|
+
class PresenceError extends Schema68.TaggedErrorClass()("PresenceError", {
|
|
14303
|
+
message: Schema68.String
|
|
14086
14304
|
}) {
|
|
14087
14305
|
}
|
|
14088
14306
|
|
|
14089
|
-
class
|
|
14307
|
+
class Service41 extends Context54.Service()("@relayfx/runtime/Presence") {
|
|
14090
14308
|
}
|
|
14091
|
-
var PresenceIdentity =
|
|
14309
|
+
var PresenceIdentity = Context54.Reference("@relayfx/runtime/PresenceIdentity", { defaultValue: () => ({}) });
|
|
14092
14310
|
var readError = (cause) => cause instanceof PresenceError ? cause : new PresenceError({ message: String(cause) });
|
|
14093
|
-
var warn = (operation) => (cause) =>
|
|
14094
|
-
var layerFromRepository3 =
|
|
14311
|
+
var warn = (operation) => (cause) => Effect61.logWarning(`Presence ${operation} failed`).pipe(Effect61.annotateLogs({ cause: String(cause) }));
|
|
14312
|
+
var layerFromRepository3 = Layer55.effect(Service41, Effect61.gen(function* () {
|
|
14095
14313
|
const repository = yield* exports_presence_repository.Service;
|
|
14096
14314
|
const heartbeatMillis = yield* Config2.number("RELAY_PRESENCE_HEARTBEAT_MILLIS").pipe(Config2.withDefault(15000));
|
|
14097
|
-
const write =
|
|
14315
|
+
const write = Effect61.fn("Presence.write")(function* (input, connectedAt, notify) {
|
|
14098
14316
|
const now = yield* Clock5.currentTimeMillis;
|
|
14099
14317
|
yield* repository.upsertHeartbeat({
|
|
14100
14318
|
...input,
|
|
14101
14319
|
connectedAt,
|
|
14102
14320
|
expiresAt: now + heartbeatMillis * 3
|
|
14103
|
-
}).pipe(
|
|
14321
|
+
}).pipe(Effect61.catch(warn("heartbeat")));
|
|
14104
14322
|
if (notify)
|
|
14105
|
-
yield* repository.notifyChanged(input.scope).pipe(
|
|
14323
|
+
yield* repository.notifyChanged(input.scope).pipe(Effect61.catch(warn("notification")));
|
|
14106
14324
|
});
|
|
14107
|
-
const
|
|
14108
|
-
const identity = yield*
|
|
14325
|
+
const register7 = Effect61.fn("Presence.register")(function* (input) {
|
|
14326
|
+
const identity = yield* Effect61.serviceOption(PresenceIdentity).pipe(Effect61.map((value) => value._tag === "Some" ? value.value : {}));
|
|
14109
14327
|
const registration = { ...input, metadata: { ...identity, ...input.metadata } };
|
|
14110
14328
|
const connectedAt = yield* Clock5.currentTimeMillis;
|
|
14111
|
-
yield*
|
|
14329
|
+
yield* Effect61.addFinalizer(() => repository.remove(registration).pipe(Effect61.catch(warn("release")), Effect61.andThen(repository.notifyChanged(input.scope).pipe(Effect61.catch(warn("notification"))))));
|
|
14112
14330
|
yield* write(registration, connectedAt, true);
|
|
14113
|
-
yield* write(registration, connectedAt, false).pipe(
|
|
14331
|
+
yield* write(registration, connectedAt, false).pipe(Effect61.delay(heartbeatMillis), Effect61.repeat(Schedule6.forever), Effect61.forkScoped);
|
|
14114
14332
|
});
|
|
14115
|
-
const list14 =
|
|
14116
|
-
const entries = yield* repository.listByScope(scope).pipe(
|
|
14333
|
+
const list14 = Effect61.fn("Presence.list")(function* (scope) {
|
|
14334
|
+
const entries = yield* repository.listByScope(scope).pipe(Effect61.mapError(readError));
|
|
14117
14335
|
const observed_at = yield* Clock5.currentTimeMillis;
|
|
14118
14336
|
return {
|
|
14119
14337
|
scope,
|
|
@@ -14126,23 +14344,23 @@ var layerFromRepository3 = Layer54.effect(Service40, Effect60.gen(function* () {
|
|
|
14126
14344
|
};
|
|
14127
14345
|
});
|
|
14128
14346
|
const watch = (scope) => Stream10.merge(repository.changedSignals(scope).pipe(Stream10.mapError(readError)), Stream10.tick(heartbeatMillis)).pipe(Stream10.mapEffect(() => list14(scope)), Stream10.changesWith((left, right) => JSON.stringify(left.entries) === JSON.stringify(right.entries)));
|
|
14129
|
-
const tracked = (scope, metadata10) => (stream3) => Stream10.scoped(Stream10.concat(Stream10.fromEffect(
|
|
14347
|
+
const tracked = (scope, metadata10) => (stream3) => Stream10.scoped(Stream10.concat(Stream10.fromEffect(Effect61.gen(function* () {
|
|
14130
14348
|
const id2 = `presence:${yield* Random.nextInt}`;
|
|
14131
|
-
yield*
|
|
14349
|
+
yield* register7({ id: id2, scope, ...metadata10 === undefined ? {} : { metadata: metadata10 } }).pipe(Effect61.forkScoped);
|
|
14132
14350
|
})).pipe(Stream10.drain), stream3));
|
|
14133
|
-
return
|
|
14351
|
+
return Service41.of({ register: register7, tracked, list: list14, watch });
|
|
14134
14352
|
}));
|
|
14135
|
-
var
|
|
14136
|
-
var
|
|
14137
|
-
var
|
|
14138
|
-
const service = yield*
|
|
14353
|
+
var memoryLayer37 = layerFromRepository3.pipe(Layer55.provide(exports_presence_repository.memoryLayer));
|
|
14354
|
+
var testLayer49 = (implementation) => Layer55.succeed(Service41, Service41.of(implementation));
|
|
14355
|
+
var register7 = Effect61.fn("Presence.register.call")(function* (input) {
|
|
14356
|
+
const service = yield* Service41;
|
|
14139
14357
|
return yield* service.register(input);
|
|
14140
14358
|
});
|
|
14141
|
-
var list14 =
|
|
14142
|
-
const service = yield*
|
|
14359
|
+
var list14 = Effect61.fn("Presence.list.call")(function* (scope) {
|
|
14360
|
+
const service = yield* Service41;
|
|
14143
14361
|
return yield* service.list(scope);
|
|
14144
14362
|
});
|
|
14145
|
-
var watch = (scope) => Stream10.unwrap(
|
|
14363
|
+
var watch = (scope) => Stream10.unwrap(Effect61.map(Service41, (service) => service.watch(scope)));
|
|
14146
14364
|
|
|
14147
14365
|
// ../runtime/src/presence/presence-tool.ts
|
|
14148
14366
|
var exports_presence_tool = {};
|
|
@@ -14153,11 +14371,11 @@ __export(exports_presence_tool, {
|
|
|
14153
14371
|
Output: () => Output,
|
|
14154
14372
|
Input: () => Input
|
|
14155
14373
|
});
|
|
14156
|
-
import { Effect as
|
|
14374
|
+
import { Effect as Effect62, Schema as Schema69 } from "effect";
|
|
14157
14375
|
var toolName = "relay_presence";
|
|
14158
14376
|
var permissionName = "relay.presence.read";
|
|
14159
|
-
var Input =
|
|
14160
|
-
var Output =
|
|
14377
|
+
var Input = Schema69.Struct({ scope: Schema69.optionalKey(exports_presence_schema.Scope) });
|
|
14378
|
+
var Output = Schema69.Struct({ watcher_count: Schema69.Number, entries: Schema69.Array(exports_presence_schema.Entry) });
|
|
14161
14379
|
var registeredTool = (presence) => tool(toolName, {
|
|
14162
14380
|
description: "List observers currently watching an execution or session.",
|
|
14163
14381
|
input: Input,
|
|
@@ -14165,7 +14383,7 @@ var registeredTool = (presence) => tool(toolName, {
|
|
|
14165
14383
|
permissions: [{ name: permissionName, value: true }],
|
|
14166
14384
|
requiredPermissions: [permissionName],
|
|
14167
14385
|
metadata: { relay_core_tool: true },
|
|
14168
|
-
run:
|
|
14386
|
+
run: Effect62.fn("PresenceTool.run")(function* (input, context) {
|
|
14169
14387
|
const scope = input.scope ?? { kind: "execution", id: exports_ids_schema.ExecutionId.make(context.executionId) };
|
|
14170
14388
|
const view = yield* presence.list(scope);
|
|
14171
14389
|
return { watcher_count: view.entries.length, entries: view.entries };
|
|
@@ -14175,21 +14393,21 @@ var registeredTool = (presence) => tool(toolName, {
|
|
|
14175
14393
|
// ../runtime/src/schema-registry/schema-registry-service.ts
|
|
14176
14394
|
var exports_schema_registry_service = {};
|
|
14177
14395
|
__export(exports_schema_registry_service, {
|
|
14178
|
-
testLayer: () =>
|
|
14179
|
-
resolve: () =>
|
|
14180
|
-
registrations: () =>
|
|
14181
|
-
register: () =>
|
|
14182
|
-
memoryLayer: () =>
|
|
14183
|
-
layer: () =>
|
|
14184
|
-
Service: () =>
|
|
14396
|
+
testLayer: () => testLayer50,
|
|
14397
|
+
resolve: () => resolve4,
|
|
14398
|
+
registrations: () => registrations4,
|
|
14399
|
+
register: () => register8,
|
|
14400
|
+
memoryLayer: () => memoryLayer38,
|
|
14401
|
+
layer: () => layer43,
|
|
14402
|
+
Service: () => Service42,
|
|
14185
14403
|
SchemaRefNotRegistered: () => SchemaRefNotRegistered
|
|
14186
14404
|
});
|
|
14187
|
-
import { Context as
|
|
14405
|
+
import { Context as Context55, Effect as Effect63, Layer as Layer56, Ref as Ref17, Schema as Schema70 } from "effect";
|
|
14188
14406
|
|
|
14189
|
-
class SchemaRefNotRegistered extends
|
|
14407
|
+
class SchemaRefNotRegistered extends Schema70.TaggedErrorClass()("SchemaRefNotRegistered", { schema_ref: exports_shared_schema.NonEmptyString }) {
|
|
14190
14408
|
}
|
|
14191
14409
|
|
|
14192
|
-
class
|
|
14410
|
+
class Service42 extends Context55.Service()("@relayfx/runtime/SchemaRegistry") {
|
|
14193
14411
|
}
|
|
14194
14412
|
var upsertRegistration2 = (registry, registration) => {
|
|
14195
14413
|
const exists = registry.some((item) => item.ref === registration.ref);
|
|
@@ -14197,63 +14415,63 @@ var upsertRegistration2 = (registry, registration) => {
|
|
|
14197
14415
|
return [...registry, registration];
|
|
14198
14416
|
return registry.map((item) => item.ref === registration.ref ? registration : item);
|
|
14199
14417
|
};
|
|
14200
|
-
var
|
|
14201
|
-
const registry = yield*
|
|
14202
|
-
const
|
|
14203
|
-
yield*
|
|
14204
|
-
});
|
|
14205
|
-
const
|
|
14206
|
-
const
|
|
14207
|
-
const items = yield*
|
|
14418
|
+
var layer43 = (initialRegistrations = []) => Layer56.effect(Service42, Effect63.gen(function* () {
|
|
14419
|
+
const registry = yield* Ref17.make(initialRegistrations.reduce(upsertRegistration2, []));
|
|
14420
|
+
const register8 = Effect63.fn("SchemaRegistry.register")(function* (registration) {
|
|
14421
|
+
yield* Ref17.update(registry, (items) => upsertRegistration2(items, registration));
|
|
14422
|
+
});
|
|
14423
|
+
const registrations4 = Ref17.get(registry);
|
|
14424
|
+
const resolve4 = Effect63.fn("SchemaRegistry.resolve")(function* (ref) {
|
|
14425
|
+
const items = yield* Ref17.get(registry);
|
|
14208
14426
|
const found = items.find((item) => item.ref === ref);
|
|
14209
14427
|
if (found === undefined) {
|
|
14210
|
-
return yield*
|
|
14428
|
+
return yield* Effect63.fail(new SchemaRefNotRegistered({ schema_ref: ref }));
|
|
14211
14429
|
}
|
|
14212
14430
|
return found;
|
|
14213
14431
|
});
|
|
14214
|
-
return
|
|
14432
|
+
return Service42.of({ register: register8, registrations: registrations4, resolve: resolve4 });
|
|
14215
14433
|
}));
|
|
14216
|
-
var
|
|
14217
|
-
var
|
|
14218
|
-
var
|
|
14219
|
-
const service = yield*
|
|
14434
|
+
var memoryLayer38 = layer43;
|
|
14435
|
+
var testLayer50 = (implementation) => Layer56.succeed(Service42, Service42.of(implementation));
|
|
14436
|
+
var register8 = Effect63.fn("SchemaRegistry.register.call")(function* (registration) {
|
|
14437
|
+
const service = yield* Service42;
|
|
14220
14438
|
return yield* service.register(registration);
|
|
14221
14439
|
});
|
|
14222
|
-
var
|
|
14223
|
-
const service = yield*
|
|
14440
|
+
var registrations4 = Effect63.fn("SchemaRegistry.registrations.call")(function* () {
|
|
14441
|
+
const service = yield* Service42;
|
|
14224
14442
|
return yield* service.registrations;
|
|
14225
14443
|
});
|
|
14226
|
-
var
|
|
14227
|
-
const service = yield*
|
|
14444
|
+
var resolve4 = Effect63.fn("SchemaRegistry.resolve.call")(function* (ref) {
|
|
14445
|
+
const service = yield* Service42;
|
|
14228
14446
|
return yield* service.resolve(ref);
|
|
14229
14447
|
});
|
|
14230
14448
|
|
|
14231
14449
|
// ../runtime/src/content/blob-store-service.ts
|
|
14232
14450
|
var exports_blob_store_service = {};
|
|
14233
14451
|
__export(exports_blob_store_service, {
|
|
14234
|
-
testLayer: () =>
|
|
14235
|
-
resolve: () =>
|
|
14452
|
+
testLayer: () => testLayer51,
|
|
14453
|
+
resolve: () => resolve5,
|
|
14236
14454
|
put: () => put3,
|
|
14237
14455
|
passthroughLayer: () => passthroughLayer,
|
|
14238
|
-
memoryLayer: () =>
|
|
14239
|
-
Service: () =>
|
|
14456
|
+
memoryLayer: () => memoryLayer39,
|
|
14457
|
+
Service: () => Service43,
|
|
14240
14458
|
BlobStoreError: () => BlobStoreError,
|
|
14241
14459
|
BlobNotResolvable: () => BlobNotResolvable
|
|
14242
14460
|
});
|
|
14243
|
-
import { Context as
|
|
14461
|
+
import { Context as Context56, Effect as Effect64, Layer as Layer57, Ref as Ref18, Schema as Schema71 } from "effect";
|
|
14244
14462
|
|
|
14245
|
-
class BlobNotResolvable extends
|
|
14246
|
-
uri:
|
|
14247
|
-
reason:
|
|
14463
|
+
class BlobNotResolvable extends Schema71.TaggedErrorClass()("BlobNotResolvable", {
|
|
14464
|
+
uri: Schema71.String,
|
|
14465
|
+
reason: Schema71.String
|
|
14248
14466
|
}) {
|
|
14249
14467
|
}
|
|
14250
14468
|
|
|
14251
|
-
class BlobStoreError extends
|
|
14252
|
-
message:
|
|
14469
|
+
class BlobStoreError extends Schema71.TaggedErrorClass()("BlobStoreError", {
|
|
14470
|
+
message: Schema71.String
|
|
14253
14471
|
}) {
|
|
14254
14472
|
}
|
|
14255
14473
|
|
|
14256
|
-
class
|
|
14474
|
+
class Service43 extends Context56.Service()("@relayfx/runtime/BlobStore") {
|
|
14257
14475
|
}
|
|
14258
14476
|
var urlResolution = (part) => ({
|
|
14259
14477
|
_tag: "Url",
|
|
@@ -14262,18 +14480,18 @@ var urlResolution = (part) => ({
|
|
|
14262
14480
|
...part.filename === undefined ? {} : { fileName: part.filename }
|
|
14263
14481
|
});
|
|
14264
14482
|
var passthroughInterface = {
|
|
14265
|
-
resolve: (part) =>
|
|
14266
|
-
put: () =>
|
|
14483
|
+
resolve: (part) => Effect64.succeed(urlResolution(part)),
|
|
14484
|
+
put: () => Effect64.fail(new BlobStoreError({ message: "BlobStore.put is not supported by the passthrough store" }))
|
|
14267
14485
|
};
|
|
14268
|
-
var passthroughLayer =
|
|
14269
|
-
var
|
|
14270
|
-
const counter = yield*
|
|
14486
|
+
var passthroughLayer = Layer57.succeed(Service43, Service43.of(passthroughInterface));
|
|
14487
|
+
var memoryLayer39 = Layer57.effect(Service43, Effect64.gen(function* () {
|
|
14488
|
+
const counter = yield* Ref18.make(0);
|
|
14271
14489
|
const blobs = new Map;
|
|
14272
|
-
return
|
|
14273
|
-
resolve:
|
|
14490
|
+
return Service43.of({
|
|
14491
|
+
resolve: Effect64.fn("BlobStore.memory.resolve")(function* (part) {
|
|
14274
14492
|
const blob = blobs.get(part.uri);
|
|
14275
14493
|
if (blob === undefined) {
|
|
14276
|
-
return yield*
|
|
14494
|
+
return yield* Effect64.fail(new BlobNotResolvable({ uri: part.uri, reason: "unknown blob uri" }));
|
|
14277
14495
|
}
|
|
14278
14496
|
return {
|
|
14279
14497
|
_tag: "Bytes",
|
|
@@ -14282,10 +14500,10 @@ var memoryLayer38 = Layer56.effect(Service42, Effect63.gen(function* () {
|
|
|
14282
14500
|
...blob.fileName === undefined ? {} : { fileName: blob.fileName }
|
|
14283
14501
|
};
|
|
14284
14502
|
}),
|
|
14285
|
-
put:
|
|
14286
|
-
const next = yield*
|
|
14503
|
+
put: Effect64.fn("BlobStore.memory.put")(function* (input) {
|
|
14504
|
+
const next = yield* Ref18.updateAndGet(counter, (value) => value + 1);
|
|
14287
14505
|
const uri = `memory://blob/${next}`;
|
|
14288
|
-
yield*
|
|
14506
|
+
yield* Effect64.sync(() => blobs.set(uri, {
|
|
14289
14507
|
bytes: input.bytes,
|
|
14290
14508
|
mediaType: input.mediaType,
|
|
14291
14509
|
...input.fileName === undefined ? {} : { fileName: input.fileName }
|
|
@@ -14300,48 +14518,48 @@ var memoryLayer38 = Layer56.effect(Service42, Effect63.gen(function* () {
|
|
|
14300
14518
|
})
|
|
14301
14519
|
});
|
|
14302
14520
|
}));
|
|
14303
|
-
var
|
|
14304
|
-
var
|
|
14305
|
-
const service = yield*
|
|
14521
|
+
var testLayer51 = (implementation) => Layer57.succeed(Service43, Service43.of(implementation));
|
|
14522
|
+
var resolve5 = Effect64.fn("BlobStore.resolve.call")(function* (part) {
|
|
14523
|
+
const service = yield* Service43;
|
|
14306
14524
|
return yield* service.resolve(part);
|
|
14307
14525
|
});
|
|
14308
|
-
var put3 =
|
|
14309
|
-
const service = yield*
|
|
14526
|
+
var put3 = Effect64.fn("BlobStore.put.call")(function* (input) {
|
|
14527
|
+
const service = yield* Service43;
|
|
14310
14528
|
return yield* service.put(input);
|
|
14311
14529
|
});
|
|
14312
14530
|
|
|
14313
14531
|
// ../runtime/src/skill/skill-registry-service.ts
|
|
14314
14532
|
var exports_skill_registry_service = {};
|
|
14315
14533
|
__export(exports_skill_registry_service, {
|
|
14316
|
-
testLayer: () =>
|
|
14534
|
+
testLayer: () => testLayer52,
|
|
14317
14535
|
sourceLayerForExecution: () => sourceLayerForExecution,
|
|
14318
14536
|
sourceForExecution: () => sourceForExecution,
|
|
14319
|
-
register: () =>
|
|
14537
|
+
register: () => register9,
|
|
14320
14538
|
pinExecution: () => pinExecution2,
|
|
14321
14539
|
listRevisions: () => listRevisions4,
|
|
14322
14540
|
listPins: () => listPins2,
|
|
14323
14541
|
list: () => list15,
|
|
14324
|
-
layer: () =>
|
|
14542
|
+
layer: () => layer44,
|
|
14325
14543
|
getRevision: () => getRevision4,
|
|
14326
14544
|
getPinned: () => getPinned2,
|
|
14327
14545
|
get: () => get14,
|
|
14328
14546
|
SkillRegistryError: () => SkillRegistryError,
|
|
14329
14547
|
SkillDefinitionInvalid: () => SkillDefinitionInvalid,
|
|
14330
|
-
Service: () =>
|
|
14548
|
+
Service: () => Service44
|
|
14331
14549
|
});
|
|
14332
|
-
import { Clock as Clock6, Context as
|
|
14550
|
+
import { Clock as Clock6, Context as Context57, Effect as Effect65, Layer as Layer58, Schema as Schema72 } from "effect";
|
|
14333
14551
|
|
|
14334
|
-
class SkillDefinitionInvalid extends
|
|
14335
|
-
message:
|
|
14552
|
+
class SkillDefinitionInvalid extends Schema72.TaggedErrorClass()("SkillDefinitionInvalid", {
|
|
14553
|
+
message: Schema72.String
|
|
14336
14554
|
}) {
|
|
14337
14555
|
}
|
|
14338
14556
|
|
|
14339
|
-
class SkillRegistryError extends
|
|
14340
|
-
message:
|
|
14557
|
+
class SkillRegistryError extends Schema72.TaggedErrorClass()("SkillRegistryError", {
|
|
14558
|
+
message: Schema72.String
|
|
14341
14559
|
}) {
|
|
14342
14560
|
}
|
|
14343
14561
|
|
|
14344
|
-
class
|
|
14562
|
+
class Service44 extends Context57.Service()("@relayfx/runtime/SkillRegistry") {
|
|
14345
14563
|
}
|
|
14346
14564
|
var toPublicRecord2 = (record2) => ({
|
|
14347
14565
|
id: record2.id,
|
|
@@ -14364,9 +14582,9 @@ var toPublicPinRecord = (record2) => ({
|
|
|
14364
14582
|
created_at: record2.createdAt
|
|
14365
14583
|
});
|
|
14366
14584
|
var mapRepositoryError7 = (error5) => new SkillRegistryError({ message: error5.message });
|
|
14367
|
-
var requireText2 = (value, field) => value.trim().length === 0 ?
|
|
14368
|
-
var requireOptionalText2 = (value, field) => value === undefined || value.trim().length > 0 ?
|
|
14369
|
-
var validateDefinition2 =
|
|
14585
|
+
var requireText2 = (value, field) => value.trim().length === 0 ? Effect65.fail(new SkillDefinitionInvalid({ message: `${field} must not be blank` })) : Effect65.void;
|
|
14586
|
+
var requireOptionalText2 = (value, field) => value === undefined || value.trim().length > 0 ? Effect65.void : Effect65.fail(new SkillDefinitionInvalid({ message: `${field} must not be blank` }));
|
|
14587
|
+
var validateDefinition2 = Effect65.fn("SkillRegistry.validateDefinition")(function* (definition) {
|
|
14370
14588
|
yield* requireText2(definition.frontmatter.name, "definition.frontmatter.name");
|
|
14371
14589
|
yield* requireText2(definition.frontmatter.description, "definition.frontmatter.description");
|
|
14372
14590
|
yield* requireOptionalText2(definition.frontmatter.when_to_use, "definition.frontmatter.when_to_use");
|
|
@@ -14397,124 +14615,124 @@ var toBatonSkill = (pin) => {
|
|
|
14397
14615
|
return {
|
|
14398
14616
|
frontmatter,
|
|
14399
14617
|
listing: exports_skill_source.makeListing(frontmatter),
|
|
14400
|
-
body:
|
|
14618
|
+
body: Effect65.succeed(pin.skill_definition_snapshot.body),
|
|
14401
14619
|
tools: []
|
|
14402
14620
|
};
|
|
14403
14621
|
};
|
|
14404
14622
|
var sourceError = (error5) => new exports_skill_source.SkillSourceError({ source: "relay.skill_registry", message: error5.message });
|
|
14405
|
-
var
|
|
14623
|
+
var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
14406
14624
|
const repository = yield* exports_skill_definition_repository.Service;
|
|
14407
|
-
return
|
|
14408
|
-
register:
|
|
14625
|
+
return Service44.of({
|
|
14626
|
+
register: Effect65.fn("SkillRegistry.register")(function* (input) {
|
|
14409
14627
|
yield* validateDefinition2(input.definition);
|
|
14410
14628
|
const now = yield* Clock6.currentTimeMillis;
|
|
14411
|
-
const record2 = yield* repository.put({ id: input.id, definition: input.definition, now }).pipe(
|
|
14629
|
+
const record2 = yield* repository.put({ id: input.id, definition: input.definition, now }).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14412
14630
|
return { record: toPublicRecord2(record2) };
|
|
14413
14631
|
}),
|
|
14414
|
-
get:
|
|
14415
|
-
const record2 = yield* repository.get(id2).pipe(
|
|
14632
|
+
get: Effect65.fn("SkillRegistry.get")(function* (id2) {
|
|
14633
|
+
const record2 = yield* repository.get(id2).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14416
14634
|
return record2 === undefined ? undefined : toPublicRecord2(record2);
|
|
14417
14635
|
}),
|
|
14418
|
-
getRevision:
|
|
14419
|
-
const record2 = yield* repository.getRevision(input).pipe(
|
|
14636
|
+
getRevision: Effect65.fn("SkillRegistry.getRevision")(function* (input) {
|
|
14637
|
+
const record2 = yield* repository.getRevision(input).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14420
14638
|
return record2 === undefined ? undefined : toPublicRevisionRecord2(record2);
|
|
14421
14639
|
}),
|
|
14422
|
-
list:
|
|
14423
|
-
const records = yield* repository.list().pipe(
|
|
14640
|
+
list: Effect65.fn("SkillRegistry.list")(function* () {
|
|
14641
|
+
const records = yield* repository.list().pipe(Effect65.mapError(mapRepositoryError7));
|
|
14424
14642
|
return { records: records.map(toPublicRecord2) };
|
|
14425
14643
|
}),
|
|
14426
|
-
listRevisions:
|
|
14427
|
-
const records = yield* repository.listRevisions(id2).pipe(
|
|
14644
|
+
listRevisions: Effect65.fn("SkillRegistry.listRevisions")(function* (id2) {
|
|
14645
|
+
const records = yield* repository.listRevisions(id2).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14428
14646
|
return { records: records.map(toPublicRevisionRecord2) };
|
|
14429
14647
|
}),
|
|
14430
|
-
pinExecution:
|
|
14648
|
+
pinExecution: Effect65.fn("SkillRegistry.pinExecution")(function* (input) {
|
|
14431
14649
|
const now = yield* Clock6.currentTimeMillis;
|
|
14432
14650
|
const records = yield* repository.pinExecution({
|
|
14433
14651
|
executionId: input.execution_id,
|
|
14434
14652
|
skillDefinitionIds: input.skill_definition_ids,
|
|
14435
14653
|
now
|
|
14436
|
-
}).pipe(
|
|
14654
|
+
}).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14437
14655
|
return { records: records.map(toPublicPinRecord) };
|
|
14438
14656
|
}),
|
|
14439
|
-
listPins:
|
|
14440
|
-
const records = yield* repository.listPins(executionId).pipe(
|
|
14657
|
+
listPins: Effect65.fn("SkillRegistry.listPins")(function* (executionId) {
|
|
14658
|
+
const records = yield* repository.listPins(executionId).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14441
14659
|
return { records: records.map(toPublicPinRecord) };
|
|
14442
14660
|
}),
|
|
14443
|
-
getPinned:
|
|
14444
|
-
const record2 = yield* repository.getPinned(input).pipe(
|
|
14661
|
+
getPinned: Effect65.fn("SkillRegistry.getPinned")(function* (input) {
|
|
14662
|
+
const record2 = yield* repository.getPinned(input).pipe(Effect65.mapError(mapRepositoryError7));
|
|
14445
14663
|
return record2 === undefined ? undefined : toPublicPinRecord(record2);
|
|
14446
14664
|
})
|
|
14447
14665
|
});
|
|
14448
14666
|
}));
|
|
14449
|
-
var
|
|
14450
|
-
var
|
|
14451
|
-
const service = yield*
|
|
14667
|
+
var testLayer52 = (implementation) => Layer58.succeed(Service44, Service44.of(implementation));
|
|
14668
|
+
var register9 = Effect65.fn("SkillRegistry.register.call")(function* (input) {
|
|
14669
|
+
const service = yield* Service44;
|
|
14452
14670
|
return yield* service.register(input);
|
|
14453
14671
|
});
|
|
14454
|
-
var get14 =
|
|
14455
|
-
const service = yield*
|
|
14672
|
+
var get14 = Effect65.fn("SkillRegistry.get.call")(function* (id2) {
|
|
14673
|
+
const service = yield* Service44;
|
|
14456
14674
|
return yield* service.get(id2);
|
|
14457
14675
|
});
|
|
14458
|
-
var getRevision4 =
|
|
14459
|
-
const service = yield*
|
|
14676
|
+
var getRevision4 = Effect65.fn("SkillRegistry.getRevision.call")(function* (input) {
|
|
14677
|
+
const service = yield* Service44;
|
|
14460
14678
|
return yield* service.getRevision(input);
|
|
14461
14679
|
});
|
|
14462
|
-
var list15 =
|
|
14463
|
-
const service = yield*
|
|
14680
|
+
var list15 = Effect65.fn("SkillRegistry.list.call")(function* () {
|
|
14681
|
+
const service = yield* Service44;
|
|
14464
14682
|
return yield* service.list();
|
|
14465
14683
|
});
|
|
14466
|
-
var listRevisions4 =
|
|
14467
|
-
const service = yield*
|
|
14684
|
+
var listRevisions4 = Effect65.fn("SkillRegistry.listRevisions.call")(function* (id2) {
|
|
14685
|
+
const service = yield* Service44;
|
|
14468
14686
|
return yield* service.listRevisions(id2);
|
|
14469
14687
|
});
|
|
14470
|
-
var pinExecution2 =
|
|
14471
|
-
const service = yield*
|
|
14688
|
+
var pinExecution2 = Effect65.fn("SkillRegistry.pinExecution.call")(function* (input) {
|
|
14689
|
+
const service = yield* Service44;
|
|
14472
14690
|
return yield* service.pinExecution(input);
|
|
14473
14691
|
});
|
|
14474
|
-
var listPins2 =
|
|
14475
|
-
const service = yield*
|
|
14692
|
+
var listPins2 = Effect65.fn("SkillRegistry.listPins.call")(function* (executionId) {
|
|
14693
|
+
const service = yield* Service44;
|
|
14476
14694
|
return yield* service.listPins(executionId);
|
|
14477
14695
|
});
|
|
14478
|
-
var getPinned2 =
|
|
14479
|
-
const service = yield*
|
|
14696
|
+
var getPinned2 = Effect65.fn("SkillRegistry.getPinned.call")(function* (input) {
|
|
14697
|
+
const service = yield* Service44;
|
|
14480
14698
|
return yield* service.getPinned(input);
|
|
14481
14699
|
});
|
|
14482
|
-
var sourceForExecution =
|
|
14483
|
-
const service = yield*
|
|
14484
|
-
const pins = yield* service.listPins(executionId).pipe(
|
|
14700
|
+
var sourceForExecution = Effect65.fn("SkillRegistry.sourceForExecution.call")(function* (executionId) {
|
|
14701
|
+
const service = yield* Service44;
|
|
14702
|
+
const pins = yield* service.listPins(executionId).pipe(Effect65.mapError(sourceError));
|
|
14485
14703
|
const skills = pins.records.map(toBatonSkill);
|
|
14486
14704
|
const byName = new Map(skills.map((skill) => [skill.frontmatter.name, skill]));
|
|
14487
14705
|
return exports_skill_source.SkillSource.of({
|
|
14488
|
-
all:
|
|
14489
|
-
get: (name) =>
|
|
14706
|
+
all: Effect65.succeed(skills),
|
|
14707
|
+
get: (name) => Effect65.succeed(byName.get(name))
|
|
14490
14708
|
});
|
|
14491
14709
|
});
|
|
14492
|
-
var sourceLayerForExecution = (executionId) =>
|
|
14710
|
+
var sourceLayerForExecution = (executionId) => Layer58.effect(exports_skill_source.SkillSource, sourceForExecution(executionId));
|
|
14493
14711
|
|
|
14494
14712
|
// ../runtime/src/execution/execution-service.ts
|
|
14495
14713
|
var exports_execution_service = {};
|
|
14496
14714
|
__export(exports_execution_service, {
|
|
14497
|
-
testLayer: () =>
|
|
14715
|
+
testLayer: () => testLayer53,
|
|
14498
14716
|
stream: () => stream3,
|
|
14499
14717
|
spawnChildRun: () => spawnChildRun,
|
|
14500
14718
|
send: () => send,
|
|
14501
14719
|
run: () => run2,
|
|
14502
|
-
memoryLayer: () =>
|
|
14503
|
-
layer: () =>
|
|
14720
|
+
memoryLayer: () => memoryLayer40,
|
|
14721
|
+
layer: () => layer45,
|
|
14504
14722
|
cancel: () => cancel4,
|
|
14505
14723
|
accept: () => accept,
|
|
14506
|
-
Service: () =>
|
|
14724
|
+
Service: () => Service45,
|
|
14507
14725
|
ExecutionServiceError: () => ExecutionServiceError
|
|
14508
14726
|
});
|
|
14509
|
-
import { Clock as Clock7, Context as
|
|
14727
|
+
import { Clock as Clock7, Context as Context58, Effect as Effect66, Layer as Layer59, Option as Option21, Schema as Schema73, Stream as Stream11 } from "effect";
|
|
14510
14728
|
import { ShardingConfig } from "effect/unstable/cluster";
|
|
14511
|
-
class ExecutionServiceError extends
|
|
14512
|
-
message:
|
|
14513
|
-
next_event_sequence:
|
|
14729
|
+
class ExecutionServiceError extends Schema73.TaggedErrorClass()("ExecutionServiceError", {
|
|
14730
|
+
message: Schema73.String,
|
|
14731
|
+
next_event_sequence: Schema73.optionalKey(exports_execution_schema.ExecutionEventSequence)
|
|
14514
14732
|
}) {
|
|
14515
14733
|
}
|
|
14516
14734
|
|
|
14517
|
-
class
|
|
14735
|
+
class Service45 extends Context58.Service()("@relayfx/runtime/ExecutionService") {
|
|
14518
14736
|
}
|
|
14519
14737
|
var toExecution = (record2) => ({
|
|
14520
14738
|
id: record2.id,
|
|
@@ -14538,11 +14756,11 @@ var hasCompleteAgentDefinitionPin2 = (input) => {
|
|
|
14538
14756
|
const count = present.filter(Boolean).length;
|
|
14539
14757
|
return count === 0 || count === present.length;
|
|
14540
14758
|
};
|
|
14541
|
-
var validateAcceptInput = (input) => !hasCompleteAgentDefinitionPin2(input) ?
|
|
14759
|
+
var validateAcceptInput = (input) => !hasCompleteAgentDefinitionPin2(input) ? Effect66.fail(new ExecutionServiceError({
|
|
14542
14760
|
message: "agent pin must include id, revision, and snapshot together"
|
|
14543
|
-
})) : input.agentToolInputSchemaDigests !== undefined && input.agentId === undefined ?
|
|
14761
|
+
})) : input.agentToolInputSchemaDigests !== undefined && input.agentId === undefined ? Effect66.fail(new ExecutionServiceError({
|
|
14544
14762
|
message: "agent tool input schema digests require a complete agent pin"
|
|
14545
|
-
})) :
|
|
14763
|
+
})) : Effect66.void;
|
|
14546
14764
|
var childContext = (input) => ({
|
|
14547
14765
|
toolNames: input.tool_names,
|
|
14548
14766
|
permissions: input.permissions,
|
|
@@ -14578,13 +14796,13 @@ var dynamicOverride = (input) => {
|
|
|
14578
14796
|
});
|
|
14579
14797
|
};
|
|
14580
14798
|
var presetMap = (presets) => new Map(Object.entries(presets ?? {}).map(([name, preset]) => [name, childOverride(preset)]));
|
|
14581
|
-
var nextEventSequence =
|
|
14799
|
+
var nextEventSequence = Effect66.fn("ExecutionService.nextEventSequence")(function* (eventLog, input) {
|
|
14582
14800
|
if (input.event_sequence !== undefined)
|
|
14583
14801
|
return input.event_sequence;
|
|
14584
|
-
const max = yield* eventLog.maxSequence(input.execution_id).pipe(
|
|
14802
|
+
const max = yield* eventLog.maxSequence(input.execution_id).pipe(Effect66.mapError(mapEventLogError4));
|
|
14585
14803
|
return max === undefined ? 0 : max + 1;
|
|
14586
14804
|
});
|
|
14587
|
-
var childRunBaseInput =
|
|
14805
|
+
var childRunBaseInput = Effect66.fn("ExecutionService.childRunBaseInput")(function* (eventLog, input) {
|
|
14588
14806
|
const eventSequence = yield* nextEventSequence(eventLog, input);
|
|
14589
14807
|
const createdAt = input.created_at ?? (yield* Clock7.currentTimeMillis);
|
|
14590
14808
|
return {
|
|
@@ -14645,8 +14863,8 @@ var failedEvent = (input, error5) => ({
|
|
|
14645
14863
|
created_at: input.completedAt
|
|
14646
14864
|
});
|
|
14647
14865
|
var terminalEvent = (events) => events.find((event) => event.type === "execution.completed" || event.type === "execution.failed");
|
|
14648
|
-
var existingTerminalExecution =
|
|
14649
|
-
const events = yield* eventLog.replay({ executionId: input.executionId }).pipe(
|
|
14866
|
+
var existingTerminalExecution = Effect66.fn("ExecutionService.existingTerminalExecution")(function* (repository, eventLog, input) {
|
|
14867
|
+
const events = yield* eventLog.replay({ executionId: input.executionId }).pipe(Effect66.mapError(mapEventLogError4));
|
|
14650
14868
|
const event = terminalEvent(events);
|
|
14651
14869
|
if (event === undefined)
|
|
14652
14870
|
return;
|
|
@@ -14673,26 +14891,26 @@ var cancelledEvent = (input) => ({
|
|
|
14673
14891
|
data: input.reason === undefined ? {} : { reason: input.reason },
|
|
14674
14892
|
created_at: input.cancelledAt
|
|
14675
14893
|
});
|
|
14676
|
-
var updateStatus2 =
|
|
14894
|
+
var updateStatus2 = Effect66.fn("ExecutionService.updateStatus")(function* (repository, id2, status, updatedAt, metadata10) {
|
|
14677
14895
|
const record2 = yield* repository.transition({
|
|
14678
14896
|
id: id2,
|
|
14679
14897
|
status,
|
|
14680
14898
|
updatedAt,
|
|
14681
14899
|
...metadata10 === undefined ? {} : { metadata: metadata10 }
|
|
14682
|
-
}).pipe(
|
|
14900
|
+
}).pipe(Effect66.mapError(mapRepositoryError8));
|
|
14683
14901
|
return toExecution(record2);
|
|
14684
14902
|
});
|
|
14685
|
-
var
|
|
14903
|
+
var layer45 = Layer59.effect(Service45, Effect66.gen(function* () {
|
|
14686
14904
|
const repository = yield* exports_execution_repository.Service;
|
|
14687
14905
|
const eventLog = yield* Service30;
|
|
14688
14906
|
const childRuns = yield* Service37;
|
|
14689
14907
|
const shardingConfig = yield* ShardingConfig.ShardingConfig;
|
|
14690
|
-
const sessions = yield*
|
|
14908
|
+
const sessions = yield* Effect66.serviceOption(exports_session_repository.Service);
|
|
14691
14909
|
const runnerAddress = runnerAddressOf(shardingConfig);
|
|
14692
|
-
return
|
|
14693
|
-
accept:
|
|
14910
|
+
return Service45.of({
|
|
14911
|
+
accept: Effect66.fn("ExecutionService.accept")(function* (input) {
|
|
14694
14912
|
yield* validateAcceptInput(input);
|
|
14695
|
-
yield*
|
|
14913
|
+
yield* Effect66.annotateCurrentSpan({
|
|
14696
14914
|
"relay.execution.id": input.executionId,
|
|
14697
14915
|
"relay.address.root": input.rootAddressId
|
|
14698
14916
|
});
|
|
@@ -14701,7 +14919,7 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14701
14919
|
id: input.sessionId,
|
|
14702
14920
|
rootAddressId: input.rootAddressId,
|
|
14703
14921
|
now: input.createdAt
|
|
14704
|
-
}).pipe(
|
|
14922
|
+
}).pipe(Effect66.mapError((error5) => new ExecutionServiceError({ message: error5.message })));
|
|
14705
14923
|
}
|
|
14706
14924
|
const record2 = yield* repository.create({
|
|
14707
14925
|
id: input.executionId,
|
|
@@ -14714,33 +14932,33 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14714
14932
|
...input.agentSnapshot === undefined ? {} : { agentSnapshot: input.agentSnapshot },
|
|
14715
14933
|
...input.agentToolInputSchemaDigests === undefined ? {} : { agentToolInputSchemaDigests: input.agentToolInputSchemaDigests },
|
|
14716
14934
|
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
14717
|
-
}).pipe(
|
|
14718
|
-
yield* eventLog.append(acceptedEvent(input)).pipe(
|
|
14935
|
+
}).pipe(Effect66.mapError(mapRepositoryError8));
|
|
14936
|
+
yield* eventLog.append(acceptedEvent(input)).pipe(Effect66.mapError(mapEventLogError4));
|
|
14719
14937
|
yield* recordExecutionAccepted;
|
|
14720
14938
|
return toExecution(record2);
|
|
14721
14939
|
}),
|
|
14722
|
-
run:
|
|
14723
|
-
yield*
|
|
14940
|
+
run: Effect66.fn("ExecutionService.run")(function* (input) {
|
|
14941
|
+
yield* Effect66.annotateCurrentSpan("relay.execution.id", input.executionId);
|
|
14724
14942
|
const existing = yield* existingTerminalExecution(repository, eventLog, input);
|
|
14725
14943
|
if (existing?.execution !== undefined)
|
|
14726
14944
|
return existing.execution;
|
|
14727
14945
|
if (existing?.failure !== undefined)
|
|
14728
|
-
return yield*
|
|
14946
|
+
return yield* Effect66.fail(existing.failure);
|
|
14729
14947
|
yield* updateStatus2(repository, input.executionId, "running", input.startedAt, undefined);
|
|
14730
|
-
yield* appendIdempotentTo(eventLog, startedEvent(input, runnerAddress)).pipe(
|
|
14731
|
-
return yield* input.program.pipe(
|
|
14732
|
-
onFailure: (error5) =>
|
|
14948
|
+
yield* appendIdempotentTo(eventLog, startedEvent(input, runnerAddress)).pipe(Effect66.mapError(mapEventLogError4));
|
|
14949
|
+
return yield* input.program.pipe(Effect66.matchEffect({
|
|
14950
|
+
onFailure: (error5) => Effect66.gen(function* () {
|
|
14733
14951
|
const failedExecution = yield* updateStatus2(repository, input.executionId, "failed", input.completedAt, {
|
|
14734
14952
|
message: error5.message
|
|
14735
14953
|
});
|
|
14736
14954
|
if (failedExecution.status !== "failed")
|
|
14737
14955
|
return failedExecution;
|
|
14738
|
-
yield* appendIdempotentTo(eventLog, failedEvent(input, error5)).pipe(
|
|
14956
|
+
yield* appendIdempotentTo(eventLog, failedEvent(input, error5)).pipe(Effect66.mapError(mapEventLogError4));
|
|
14739
14957
|
yield* recordExecutionFinished("failed");
|
|
14740
14958
|
yield* recordExecutionDuration("failed", failedExecution.updated_at - failedExecution.created_at);
|
|
14741
|
-
return yield*
|
|
14959
|
+
return yield* Effect66.fail(error5);
|
|
14742
14960
|
}),
|
|
14743
|
-
onSuccess: (result) =>
|
|
14961
|
+
onSuccess: (result) => Effect66.gen(function* () {
|
|
14744
14962
|
const resultMetadata = result.metadata ?? {};
|
|
14745
14963
|
if (result._tag === "waiting") {
|
|
14746
14964
|
const execution2 = yield* updateStatus2(repository, input.executionId, "waiting", input.completedAt, resultMetadata);
|
|
@@ -14750,31 +14968,31 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14750
14968
|
const execution = yield* updateStatus2(repository, input.executionId, "completed", input.completedAt, resultMetadata);
|
|
14751
14969
|
if (execution.status !== "completed")
|
|
14752
14970
|
return execution;
|
|
14753
|
-
yield* appendIdempotentTo(eventLog, completedEvent(input, resultMetadata, completedSequence)).pipe(
|
|
14971
|
+
yield* appendIdempotentTo(eventLog, completedEvent(input, resultMetadata, completedSequence)).pipe(Effect66.mapError(mapEventLogError4));
|
|
14754
14972
|
yield* recordExecutionFinished("completed");
|
|
14755
14973
|
yield* recordExecutionDuration("completed", execution.updated_at - execution.created_at);
|
|
14756
14974
|
return execution;
|
|
14757
14975
|
})
|
|
14758
14976
|
}));
|
|
14759
14977
|
}),
|
|
14760
|
-
cancel:
|
|
14761
|
-
yield*
|
|
14762
|
-
const current2 = yield* repository.get(input.executionId).pipe(
|
|
14978
|
+
cancel: Effect66.fn("ExecutionService.cancel")(function* (input) {
|
|
14979
|
+
yield* Effect66.annotateCurrentSpan("relay.execution.id", input.executionId);
|
|
14980
|
+
const current2 = yield* repository.get(input.executionId).pipe(Effect66.mapError(mapRepositoryError8));
|
|
14763
14981
|
if (current2?.status === "cancelled")
|
|
14764
14982
|
return toExecution(current2);
|
|
14765
14983
|
const metadata10 = input.metadata ?? (input.reason === undefined ? {} : { reason: input.reason });
|
|
14766
14984
|
const execution = yield* updateStatus2(repository, input.executionId, "cancelled", input.cancelledAt, metadata10);
|
|
14767
14985
|
if (execution.status !== "cancelled")
|
|
14768
14986
|
return execution;
|
|
14769
|
-
yield* appendIdempotentTo(eventLog, cancelledEvent(input)).pipe(
|
|
14987
|
+
yield* appendIdempotentTo(eventLog, cancelledEvent(input)).pipe(Effect66.mapError(mapEventLogError4));
|
|
14770
14988
|
yield* recordExecutionFinished("cancelled");
|
|
14771
14989
|
yield* recordExecutionDuration("cancelled", execution.updated_at - execution.created_at);
|
|
14772
14990
|
return execution;
|
|
14773
14991
|
}),
|
|
14774
|
-
send:
|
|
14992
|
+
send: Effect66.fn("ExecutionService.send")(function* (input) {
|
|
14775
14993
|
const executionId = exports_ids_schema.ExecutionId.make(input.correlation_key ?? `${input.from}:${input.to}`);
|
|
14776
14994
|
const envelopeId = exports_ids_schema.EnvelopeId.make(`${executionId}:envelope`);
|
|
14777
|
-
yield*
|
|
14995
|
+
yield* Effect66.annotateCurrentSpan({
|
|
14778
14996
|
"relay.execution.id": executionId,
|
|
14779
14997
|
"relay.envelope.id": envelopeId,
|
|
14780
14998
|
"relay.address.from": input.from,
|
|
@@ -14788,11 +15006,11 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14788
15006
|
cursor: `${executionId}:envelope:${envelopeId}:accepted`,
|
|
14789
15007
|
content: input.content,
|
|
14790
15008
|
created_at: 0
|
|
14791
|
-
}).pipe(
|
|
15009
|
+
}).pipe(Effect66.mapError(mapEventLogError4));
|
|
14792
15010
|
return { envelope_id: envelopeId, execution_id: executionId };
|
|
14793
15011
|
}),
|
|
14794
|
-
spawnChildRun:
|
|
14795
|
-
yield*
|
|
15012
|
+
spawnChildRun: Effect66.fn("ExecutionService.spawnChildRun")(function* (input) {
|
|
15013
|
+
yield* Effect66.annotateCurrentSpan({
|
|
14796
15014
|
"relay.execution.id": input.execution_id,
|
|
14797
15015
|
"relay.address.id": input.address_id
|
|
14798
15016
|
});
|
|
@@ -14802,13 +15020,13 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14802
15020
|
...baseInput,
|
|
14803
15021
|
presets: presetMap(input.presets),
|
|
14804
15022
|
presetName: input.preset_name
|
|
14805
|
-
}).pipe(
|
|
15023
|
+
}).pipe(Effect66.mapError(mapChildRunError));
|
|
14806
15024
|
}
|
|
14807
15025
|
const override = dynamicOverride(input);
|
|
14808
15026
|
return yield* childRuns.spawnDynamic({
|
|
14809
15027
|
...baseInput,
|
|
14810
15028
|
...override === undefined ? {} : { override }
|
|
14811
|
-
}).pipe(
|
|
15029
|
+
}).pipe(Effect66.mapError(mapChildRunError));
|
|
14812
15030
|
}),
|
|
14813
15031
|
stream: (input) => {
|
|
14814
15032
|
const stream3 = eventLog.stream(input).pipe(Stream11.mapError((error5) => mapEventLogError4(error5)));
|
|
@@ -14816,29 +15034,29 @@ var layer44 = Layer58.effect(Service44, Effect65.gen(function* () {
|
|
|
14816
15034
|
}
|
|
14817
15035
|
});
|
|
14818
15036
|
}));
|
|
14819
|
-
var
|
|
14820
|
-
var
|
|
14821
|
-
var accept =
|
|
14822
|
-
const service = yield*
|
|
15037
|
+
var memoryLayer40 = layer45.pipe(Layer59.provide(layer39), Layer59.provide(exports_execution_repository.memoryLayer), Layer59.provide(exports_session_repository.memoryLayer), Layer59.provide(exports_child_execution_repository.memoryLayer), Layer59.provide(memoryLayer29), Layer59.provide(ShardingConfig.layer({ runnerAddress: Option21.none() })));
|
|
15038
|
+
var testLayer53 = (implementation) => Layer59.succeed(Service45, Service45.of(implementation));
|
|
15039
|
+
var accept = Effect66.fn("ExecutionService.accept.call")(function* (input) {
|
|
15040
|
+
const service = yield* Service45;
|
|
14823
15041
|
return yield* service.accept(input);
|
|
14824
15042
|
});
|
|
14825
|
-
var run2 =
|
|
14826
|
-
const service = yield*
|
|
15043
|
+
var run2 = Effect66.fn("ExecutionService.run.call")(function* (input) {
|
|
15044
|
+
const service = yield* Service45;
|
|
14827
15045
|
return yield* service.run(input);
|
|
14828
15046
|
});
|
|
14829
|
-
var cancel4 =
|
|
14830
|
-
const service = yield*
|
|
15047
|
+
var cancel4 = Effect66.fn("ExecutionService.cancel.call")(function* (input) {
|
|
15048
|
+
const service = yield* Service45;
|
|
14831
15049
|
return yield* service.cancel(input);
|
|
14832
15050
|
});
|
|
14833
|
-
var send =
|
|
14834
|
-
const service = yield*
|
|
15051
|
+
var send = Effect66.fn("ExecutionService.send.call")(function* (input) {
|
|
15052
|
+
const service = yield* Service45;
|
|
14835
15053
|
return yield* service.send(input);
|
|
14836
15054
|
});
|
|
14837
|
-
var spawnChildRun =
|
|
14838
|
-
const service = yield*
|
|
15055
|
+
var spawnChildRun = Effect66.fn("ExecutionService.spawnChildRun.call")(function* (input) {
|
|
15056
|
+
const service = yield* Service45;
|
|
14839
15057
|
return yield* service.spawnChildRun(input);
|
|
14840
15058
|
});
|
|
14841
|
-
var stream3 = (input) => Stream11.unwrap(
|
|
15059
|
+
var stream3 = (input) => Stream11.unwrap(Service45.pipe(Effect66.map((service) => service.stream(input))));
|
|
14842
15060
|
|
|
14843
15061
|
// ../runtime/src/workflow/execution-workflow.ts
|
|
14844
15062
|
var exports_execution_workflow = {};
|
|
@@ -14876,7 +15094,7 @@ import { Effect as Effect93, Exit as Exit2, Option as Option28, Schema as Schema
|
|
|
14876
15094
|
var exports_agent_loop_service = {};
|
|
14877
15095
|
__export(exports_agent_loop_service, {
|
|
14878
15096
|
toolFromDefinition: () => toolFromDefinition,
|
|
14879
|
-
testLayer: () =>
|
|
15097
|
+
testLayer: () => testLayer59,
|
|
14880
15098
|
run: () => run4,
|
|
14881
15099
|
mapBoundaryError: () => mapBoundaryError,
|
|
14882
15100
|
layer: () => layer57,
|
|
@@ -14890,44 +15108,44 @@ import { Cause as Cause5, Config as Config4, Context as Context67, Crypto as Cry
|
|
|
14890
15108
|
import { AiError as AiError5, Chat as Chat3, LanguageModel as LanguageModel7, Prompt as Prompt16, Tokenizer as Tokenizer4, Toolkit as Toolkit8 } from "effect/unstable/ai";
|
|
14891
15109
|
|
|
14892
15110
|
// ../runtime/src/child/spawn-child-run-tool.ts
|
|
14893
|
-
import { Effect as
|
|
15111
|
+
import { Effect as Effect67, Schema as Schema74 } from "effect";
|
|
14894
15112
|
var toolName2 = "spawn_child_run";
|
|
14895
15113
|
var permissionName2 = "relay.child_run.spawn";
|
|
14896
|
-
var Input2 =
|
|
14897
|
-
preset_name:
|
|
14898
|
-
instructions:
|
|
14899
|
-
model:
|
|
14900
|
-
compaction_policy:
|
|
14901
|
-
tool_names:
|
|
14902
|
-
permissions:
|
|
14903
|
-
output_schema_ref:
|
|
14904
|
-
metadata:
|
|
14905
|
-
input:
|
|
15114
|
+
var Input2 = Schema74.Struct({
|
|
15115
|
+
preset_name: Schema74.optionalKey(exports_shared_schema.NonEmptyString),
|
|
15116
|
+
instructions: Schema74.optionalKey(Schema74.String),
|
|
15117
|
+
model: Schema74.optionalKey(exports_agent_schema.ModelSelection),
|
|
15118
|
+
compaction_policy: Schema74.optionalKey(exports_agent_schema.CompactionPolicy),
|
|
15119
|
+
tool_names: Schema74.optionalKey(Schema74.Array(Schema74.String)),
|
|
15120
|
+
permissions: Schema74.optionalKey(Schema74.Array(Schema74.String)),
|
|
15121
|
+
output_schema_ref: Schema74.optionalKey(Schema74.String),
|
|
15122
|
+
metadata: Schema74.optionalKey(exports_shared_schema.Metadata),
|
|
15123
|
+
input: Schema74.optionalKey(Schema74.Array(exports_content_schema.Part))
|
|
14906
15124
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.Input" });
|
|
14907
|
-
var Output2 =
|
|
15125
|
+
var Output2 = Schema74.Struct({
|
|
14908
15126
|
child_execution_id: exports_ids_schema.ChildExecutionId,
|
|
14909
|
-
status:
|
|
14910
|
-
output:
|
|
15127
|
+
status: Schema74.Literals(["completed", "failed", "cancelled"]),
|
|
15128
|
+
output: Schema74.Array(exports_content_schema.Part)
|
|
14911
15129
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.Output" });
|
|
14912
|
-
var TransferInput =
|
|
14913
|
-
input:
|
|
15130
|
+
var TransferInput = Schema74.Struct({
|
|
15131
|
+
input: Schema74.optionalKey(Schema74.Array(exports_content_schema.Part))
|
|
14914
15132
|
}).annotate({ identifier: "Relay.SpawnChildRunTool.TransferInput" });
|
|
14915
|
-
var ModelInput =
|
|
14916
|
-
preset_name:
|
|
14917
|
-
instructions:
|
|
14918
|
-
model:
|
|
14919
|
-
provider:
|
|
14920
|
-
model:
|
|
14921
|
-
registration_key:
|
|
15133
|
+
var ModelInput = Schema74.Struct({
|
|
15134
|
+
preset_name: Schema74.optionalKey(Schema74.NullOr(Schema74.String)),
|
|
15135
|
+
instructions: Schema74.optionalKey(Schema74.String),
|
|
15136
|
+
model: Schema74.optionalKey(Schema74.NullOr(Schema74.Struct({
|
|
15137
|
+
provider: Schema74.String,
|
|
15138
|
+
model: Schema74.String,
|
|
15139
|
+
registration_key: Schema74.optionalKey(Schema74.String)
|
|
14922
15140
|
}))),
|
|
14923
|
-
compaction_policy:
|
|
14924
|
-
tool_names:
|
|
14925
|
-
permissions:
|
|
14926
|
-
output_schema_ref:
|
|
14927
|
-
input:
|
|
15141
|
+
compaction_policy: Schema74.optionalKey(exports_agent_schema.CompactionPolicy),
|
|
15142
|
+
tool_names: Schema74.optionalKey(Schema74.Array(Schema74.String)),
|
|
15143
|
+
permissions: Schema74.optionalKey(Schema74.Array(Schema74.String)),
|
|
15144
|
+
output_schema_ref: Schema74.optionalKey(Schema74.NullOr(Schema74.String)),
|
|
15145
|
+
input: Schema74.optionalKey(Schema74.Array(Schema74.Struct({ type: Schema74.Literal("text"), text: Schema74.String })))
|
|
14928
15146
|
});
|
|
14929
|
-
var ModelTransferInput =
|
|
14930
|
-
input:
|
|
15147
|
+
var ModelTransferInput = Schema74.Struct({
|
|
15148
|
+
input: Schema74.optionalKey(Schema74.Array(Schema74.Struct({ type: Schema74.Literal("text"), text: Schema74.String })))
|
|
14931
15149
|
});
|
|
14932
15150
|
var normalizeModelInput = (input) => {
|
|
14933
15151
|
const { preset_name: presetName, model, output_schema_ref: outputSchemaRef, ...rest } = input;
|
|
@@ -14961,7 +15179,7 @@ var hasDynamicOverride = (input) => input.instructions !== undefined || input.mo
|
|
|
14961
15179
|
var childExecutionId2 = (context) => exports_ids_schema.ChildExecutionId.make(`${context.executionId}:child:${context.call.id}`);
|
|
14962
15180
|
var childAddressId = (id2) => exports_ids_schema.AddressId.make(`address:child:${id2}`);
|
|
14963
15181
|
var childWaitId = (id2) => exports_ids_schema.WaitId.make(`wait:child:${id2}`);
|
|
14964
|
-
var nextEventSequence2 = (eventLog, executionId) => eventLog.maxSequence(executionId).pipe(
|
|
15182
|
+
var nextEventSequence2 = (eventLog, executionId) => eventLog.maxSequence(executionId).pipe(Effect67.map((max) => max === undefined ? 0 : max + 1), Effect67.mapError((error5) => new ToolRuntimeError({ message: error5.message })));
|
|
14965
15183
|
var mapChildRunError2 = (activeToolName, error5) => new ToolExecutionFailed({ tool_name: activeToolName, message: error5._tag });
|
|
14966
15184
|
var mapWaitError = (error5) => new ToolRuntimeError({ message: error5._tag === "WaitNotFound" ? error5.wait_id : error5.message });
|
|
14967
15185
|
var spawnInput = (config, input, context, id2) => ({
|
|
@@ -14983,10 +15201,10 @@ var spawnInput = (config, input, context, id2) => ({
|
|
|
14983
15201
|
event_sequence: context.eventSequence + 1,
|
|
14984
15202
|
created_at: context.createdAt + 1
|
|
14985
15203
|
});
|
|
14986
|
-
var ensureStaticOrDynamic = (input) => input.preset_name !== undefined && hasDynamicOverride(input) ?
|
|
15204
|
+
var ensureStaticOrDynamic = (input) => input.preset_name !== undefined && hasDynamicOverride(input) ? Effect67.fail(new ToolExecutionFailed({
|
|
14987
15205
|
tool_name: toolName2,
|
|
14988
15206
|
message: "preset_name cannot be combined with dynamic child-run overrides"
|
|
14989
|
-
})) :
|
|
15207
|
+
})) : Effect67.void;
|
|
14990
15208
|
var childOverride2 = (input) => {
|
|
14991
15209
|
if (!hasDynamicOverride(input))
|
|
14992
15210
|
return;
|
|
@@ -15013,7 +15231,7 @@ var presetMap2 = (agent) => new Map(Object.entries(agent.child_run_presets ?? {}
|
|
|
15013
15231
|
...preset.metadata === undefined ? {} : { metadata: preset.metadata }
|
|
15014
15232
|
}
|
|
15015
15233
|
]));
|
|
15016
|
-
var createJoinWait =
|
|
15234
|
+
var createJoinWait = Effect67.fn("SpawnChildRunTool.createJoinWait")(function* (config, input, id2, waitId, createdAt) {
|
|
15017
15235
|
const eventSequence = yield* nextEventSequence2(config.eventLog, input.execution_id);
|
|
15018
15236
|
yield* config.waits.createDetached({
|
|
15019
15237
|
waitId,
|
|
@@ -15026,9 +15244,9 @@ var createJoinWait = Effect66.fn("SpawnChildRunTool.createJoinWait")(function* (
|
|
|
15026
15244
|
},
|
|
15027
15245
|
eventSequence,
|
|
15028
15246
|
createdAt
|
|
15029
|
-
}).pipe(
|
|
15247
|
+
}).pipe(Effect67.mapError(mapWaitError));
|
|
15030
15248
|
});
|
|
15031
|
-
var dispatchChild =
|
|
15249
|
+
var dispatchChild = Effect67.fn("SpawnChildRunTool.dispatchChild")(function* (config, input, id2, definition, waitId) {
|
|
15032
15250
|
yield* config.dispatch({
|
|
15033
15251
|
executionId: exports_ids_schema.ExecutionId.make(id2),
|
|
15034
15252
|
rootAddressId: input.address_id,
|
|
@@ -15046,38 +15264,38 @@ var dispatchChild = Effect66.fn("SpawnChildRunTool.dispatchChild")(function* (co
|
|
|
15046
15264
|
child_execution_id: id2,
|
|
15047
15265
|
parent_wait_id: waitId
|
|
15048
15266
|
}
|
|
15049
|
-
}).pipe(
|
|
15267
|
+
}).pipe(Effect67.mapError((error5) => new ToolRuntimeError({ message: String(error5) })));
|
|
15050
15268
|
});
|
|
15051
15269
|
var childStatus = (wait) => {
|
|
15052
15270
|
const status = wait.metadata.child_status;
|
|
15053
15271
|
if (status === "completed" || status === "failed" || status === "cancelled")
|
|
15054
|
-
return
|
|
15055
|
-
return
|
|
15272
|
+
return Effect67.succeed(status);
|
|
15273
|
+
return Effect67.fail(new ToolRuntimeError({ message: "Child join wait resolved without child_status" }));
|
|
15056
15274
|
};
|
|
15057
|
-
var terminalEvent2 =
|
|
15058
|
-
const events = yield* eventLog.replay({ executionId, limit: 1e4 }).pipe(
|
|
15275
|
+
var terminalEvent2 = Effect67.fn("SpawnChildRunTool.terminalEvent")(function* (eventLog, executionId, id2) {
|
|
15276
|
+
const events = yield* eventLog.replay({ executionId, limit: 1e4 }).pipe(Effect67.mapError((error5) => new ToolRuntimeError({ message: error5._tag })));
|
|
15059
15277
|
return events.find((event) => event.type === "child_run.event" && event.child_execution_id === id2);
|
|
15060
15278
|
});
|
|
15061
|
-
var resultFromTerminal =
|
|
15279
|
+
var resultFromTerminal = Effect67.fn("SpawnChildRunTool.resultFromTerminal")(function* (config, id2, wait) {
|
|
15062
15280
|
const status = yield* childStatus(wait);
|
|
15063
15281
|
const event = yield* terminalEvent2(config.eventLog, wait.executionId, id2);
|
|
15064
15282
|
const output = event?.content ?? [];
|
|
15065
15283
|
return { child_execution_id: id2, status, output };
|
|
15066
15284
|
});
|
|
15067
|
-
var run3 =
|
|
15285
|
+
var run3 = Effect67.fn("SpawnChildRunTool.run")(function* (config, activeToolName, input, context, enforceStaticOrDynamic) {
|
|
15068
15286
|
if (enforceStaticOrDynamic)
|
|
15069
15287
|
yield* ensureStaticOrDynamic(input);
|
|
15070
15288
|
const id2 = childExecutionId2(context);
|
|
15071
15289
|
const waitId = childWaitId(id2);
|
|
15072
|
-
const existingWait = yield* config.waits.get(waitId).pipe(
|
|
15290
|
+
const existingWait = yield* config.waits.get(waitId).pipe(Effect67.mapError(mapWaitError));
|
|
15073
15291
|
if (existingWait?.state === "open") {
|
|
15074
|
-
return yield*
|
|
15292
|
+
return yield* Effect67.fail(new ToolExecutionWaitRequested({ tool_name: activeToolName, wait_id: waitId }));
|
|
15075
15293
|
}
|
|
15076
15294
|
if (existingWait !== undefined)
|
|
15077
15295
|
return yield* resultFromTerminal(config, id2, existingWait);
|
|
15078
15296
|
const spawn = spawnInput(config, input, context, id2);
|
|
15079
|
-
const resolved = yield* resolveForDispatch(spawn).pipe(
|
|
15080
|
-
const definition = yield* childDefinition(config.agent, resolved).pipe(
|
|
15297
|
+
const resolved = yield* resolveForDispatch(spawn).pipe(Effect67.mapError((error5) => mapChildRunError2(activeToolName, error5)));
|
|
15298
|
+
const definition = yield* childDefinition(config.agent, resolved).pipe(Effect67.mapError((error5) => mapChildRunError2(activeToolName, error5)));
|
|
15081
15299
|
if (input.preset_name !== undefined) {
|
|
15082
15300
|
yield* config.childRuns.spawnStatic({
|
|
15083
15301
|
childExecutionId: id2,
|
|
@@ -15088,7 +15306,7 @@ var run3 = Effect66.fn("SpawnChildRunTool.run")(function* (config, activeToolNam
|
|
|
15088
15306
|
presetName: input.preset_name,
|
|
15089
15307
|
eventSequence: context.eventSequence + 1,
|
|
15090
15308
|
createdAt: context.createdAt + 1
|
|
15091
|
-
}).pipe(
|
|
15309
|
+
}).pipe(Effect67.mapError((error5) => mapChildRunError2(activeToolName, error5)));
|
|
15092
15310
|
} else {
|
|
15093
15311
|
const override = childOverride2(input);
|
|
15094
15312
|
yield* config.childRuns.spawnDynamic({
|
|
@@ -15099,11 +15317,11 @@ var run3 = Effect66.fn("SpawnChildRunTool.run")(function* (config, activeToolNam
|
|
|
15099
15317
|
...override === undefined ? {} : { override },
|
|
15100
15318
|
eventSequence: context.eventSequence + 1,
|
|
15101
15319
|
createdAt: context.createdAt + 1
|
|
15102
|
-
}).pipe(
|
|
15320
|
+
}).pipe(Effect67.mapError((error5) => mapChildRunError2(activeToolName, error5)));
|
|
15103
15321
|
}
|
|
15104
15322
|
yield* createJoinWait(config, spawn, id2, waitId, context.createdAt + 2);
|
|
15105
15323
|
yield* dispatchChild(config, spawn, id2, definition, waitId);
|
|
15106
|
-
return yield*
|
|
15324
|
+
return yield* Effect67.fail(new ToolExecutionWaitRequested({ tool_name: activeToolName, wait_id: waitId }));
|
|
15107
15325
|
});
|
|
15108
15326
|
var registeredTool2 = (config) => tool(toolName2, {
|
|
15109
15327
|
description: "Spawn a durable child run and wait for its terminal output.",
|
|
@@ -15112,7 +15330,7 @@ var registeredTool2 = (config) => tool(toolName2, {
|
|
|
15112
15330
|
permissions: [{ name: permissionName2, value: true }],
|
|
15113
15331
|
requiredPermissions: [permissionName2],
|
|
15114
15332
|
metadata: { relay_core_tool: true },
|
|
15115
|
-
run: (input, context) =>
|
|
15333
|
+
run: (input, context) => Schema74.decodeUnknownEffect(Input2)(normalizeModelInput(input)).pipe(Effect67.flatMap((decoded) => run3(config, toolName2, decoded, context, true)))
|
|
15116
15334
|
});
|
|
15117
15335
|
var transferToolName2 = (name) => `transfer_to_${name.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "")}`;
|
|
15118
15336
|
var transferTools = (config) => (config.agent.handoff_targets ?? []).map((target) => {
|
|
@@ -15124,141 +15342,13 @@ var transferTools = (config) => (config.agent.handoff_targets ?? []).map((target
|
|
|
15124
15342
|
permissions: [{ name: permissionName2, value: true }],
|
|
15125
15343
|
requiredPermissions: [permissionName2],
|
|
15126
15344
|
metadata: { relay_core_tool: true, handoff_target: target.name, preset_name: target.preset_name },
|
|
15127
|
-
run: (input, context) =>
|
|
15345
|
+
run: (input, context) => Schema74.decodeUnknownEffect(TransferInput)(input).pipe(Effect67.flatMap((decoded) => run3(config, name, { preset_name: target.preset_name, input: decoded.input ?? [] }, context, false)))
|
|
15128
15346
|
});
|
|
15129
15347
|
});
|
|
15130
15348
|
|
|
15131
15349
|
// ../runtime/src/memory/memory-service.ts
|
|
15132
15350
|
import { Clock as Clock8, Context as Context59, Effect as Effect68, Layer as Layer60, Schema as Schema75 } from "effect";
|
|
15133
15351
|
import { EmbeddingModel as EmbeddingModel3, Prompt as Prompt13 } from "effect/unstable/ai";
|
|
15134
|
-
|
|
15135
|
-
// ../runtime/src/model/embedding-model-service.ts
|
|
15136
|
-
import { Context as Context58, Effect as Effect67, Layer as Layer59, Ref as Ref18, Schema as Schema74 } from "effect";
|
|
15137
|
-
import { EmbeddingModel as EmbeddingModel2, Model as Model3 } from "effect/unstable/ai";
|
|
15138
|
-
|
|
15139
|
-
class EmbeddingModelNotRegistered extends Schema74.TaggedErrorClass()("EmbeddingModelNotRegistered", {
|
|
15140
|
-
provider: Schema74.String,
|
|
15141
|
-
model: Schema74.String,
|
|
15142
|
-
registration_key: Schema74.optionalKey(Schema74.String)
|
|
15143
|
-
}) {
|
|
15144
|
-
}
|
|
15145
|
-
|
|
15146
|
-
class Service45 extends Context58.Service()("@relayfx/runtime/EmbeddingModelService") {
|
|
15147
|
-
}
|
|
15148
|
-
var toRegistration = (input) => ({
|
|
15149
|
-
provider: input.provider,
|
|
15150
|
-
model: input.model,
|
|
15151
|
-
...input.registrationKey === undefined ? {} : { registrationKey: input.registrationKey },
|
|
15152
|
-
layer: input.layer,
|
|
15153
|
-
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
15154
|
-
});
|
|
15155
|
-
var selectionError = (selection) => new EmbeddingModelNotRegistered({
|
|
15156
|
-
provider: selection.provider,
|
|
15157
|
-
model: selection.model,
|
|
15158
|
-
...selection.registrationKey === undefined ? {} : { registration_key: selection.registrationKey }
|
|
15159
|
-
});
|
|
15160
|
-
var defaultSelectionError = () => new EmbeddingModelNotRegistered({ provider: "default", model: "default" });
|
|
15161
|
-
var matchesSelection2 = (selection, registration) => registration.provider === selection.provider && registration.model === selection.model && (selection.registrationKey === undefined || registration.registrationKey === selection.registrationKey);
|
|
15162
|
-
var resolve5 = (registrations4, selection) => {
|
|
15163
|
-
const matches2 = registrations4.filter((registration) => matchesSelection2(selection, registration));
|
|
15164
|
-
if (selection.registrationKey !== undefined)
|
|
15165
|
-
return matches2[0];
|
|
15166
|
-
if (matches2.length === 1)
|
|
15167
|
-
return matches2[0];
|
|
15168
|
-
return matches2.find((registration) => registration.registrationKey === undefined);
|
|
15169
|
-
};
|
|
15170
|
-
var resolveDefault = (registrations4, options) => {
|
|
15171
|
-
if (options?.defaultSelection !== undefined) {
|
|
15172
|
-
return resolve5(registrations4, options.defaultSelection);
|
|
15173
|
-
}
|
|
15174
|
-
return registrations4.length === 1 ? registrations4[0] : undefined;
|
|
15175
|
-
};
|
|
15176
|
-
var registrationFromLayer3 = (input) => Model3.make(input.provider, input.model, input.layer).captureRequirements.pipe(Effect67.map((layer45) => toRegistration({
|
|
15177
|
-
provider: input.provider,
|
|
15178
|
-
model: input.model,
|
|
15179
|
-
...input.registrationKey === undefined ? {} : { registrationKey: input.registrationKey },
|
|
15180
|
-
layer: layer45,
|
|
15181
|
-
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
15182
|
-
})));
|
|
15183
|
-
var layer45 = (initialRegistrations = [], options) => Layer59.effect(Service45, Effect67.gen(function* () {
|
|
15184
|
-
const registry = yield* Ref18.make([...initialRegistrations]);
|
|
15185
|
-
const register9 = Effect67.fn("EmbeddingModelService.register")(function* (input) {
|
|
15186
|
-
const registration = toRegistration(input);
|
|
15187
|
-
yield* Ref18.update(registry, (current2) => [
|
|
15188
|
-
...current2.filter((item) => !(item.provider === registration.provider && item.model === registration.model && item.registrationKey === registration.registrationKey)),
|
|
15189
|
-
registration
|
|
15190
|
-
]);
|
|
15191
|
-
});
|
|
15192
|
-
const registrations4 = Ref18.get(registry);
|
|
15193
|
-
const provide3 = (selection, effect) => Effect67.gen(function* () {
|
|
15194
|
-
const current2 = yield* Ref18.get(registry);
|
|
15195
|
-
const registration = resolve5(current2, selection);
|
|
15196
|
-
if (registration === undefined)
|
|
15197
|
-
return yield* Effect67.fail(selectionError(selection));
|
|
15198
|
-
return yield* effect.pipe(Effect67.provide(registration.layer));
|
|
15199
|
-
});
|
|
15200
|
-
const provideDefault = (effect) => Effect67.gen(function* () {
|
|
15201
|
-
const current2 = yield* Ref18.get(registry);
|
|
15202
|
-
const registration = resolveDefault(current2, options);
|
|
15203
|
-
if (registration === undefined)
|
|
15204
|
-
return yield* Effect67.fail(defaultSelectionError());
|
|
15205
|
-
return yield* effect.pipe(Effect67.provide(registration.layer));
|
|
15206
|
-
});
|
|
15207
|
-
const provideForAgent2 = (agent, effect) => {
|
|
15208
|
-
return provideDefault(effect);
|
|
15209
|
-
};
|
|
15210
|
-
return Service45.of({ register: register9, registrations: registrations4, provide: provide3, provideDefault, provideForAgent: provideForAgent2 });
|
|
15211
|
-
}));
|
|
15212
|
-
var layerFromRegistrationEffects3 = (registrations4, options) => Layer59.unwrap(Effect67.all(registrations4).pipe(Effect67.map((items) => layer45(items, options))));
|
|
15213
|
-
var memoryLayer40 = layer45;
|
|
15214
|
-
var words = (input) => input.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
15215
|
-
var hashWord = (word) => {
|
|
15216
|
-
let hash = 2166136261;
|
|
15217
|
-
for (let index = 0;index < word.length; index += 1) {
|
|
15218
|
-
hash ^= word.charCodeAt(index);
|
|
15219
|
-
hash = Math.imul(hash, 16777619);
|
|
15220
|
-
}
|
|
15221
|
-
return hash >>> 0;
|
|
15222
|
-
};
|
|
15223
|
-
var deterministicVector = (input, dimensions) => {
|
|
15224
|
-
const vector = Array.from({ length: dimensions }, () => 0);
|
|
15225
|
-
for (const word of words(input)) {
|
|
15226
|
-
const hash = hashWord(word);
|
|
15227
|
-
const index = hash % dimensions;
|
|
15228
|
-
vector[index] = (vector[index] ?? 0) + 1;
|
|
15229
|
-
}
|
|
15230
|
-
return vector;
|
|
15231
|
-
};
|
|
15232
|
-
var deterministicLayer = (options = {}) => {
|
|
15233
|
-
const dimensions = options.dimensions ?? 64;
|
|
15234
|
-
return Layer59.mergeAll(Layer59.effect(EmbeddingModel2.EmbeddingModel, EmbeddingModel2.make({
|
|
15235
|
-
embedMany: ({ inputs }) => Effect67.succeed({
|
|
15236
|
-
results: inputs.map((input) => deterministicVector(input, dimensions)),
|
|
15237
|
-
usage: { inputTokens: inputs.reduce((total, input) => total + words(input).length, 0) }
|
|
15238
|
-
})
|
|
15239
|
-
})), Layer59.succeed(EmbeddingModel2.Dimensions, dimensions));
|
|
15240
|
-
};
|
|
15241
|
-
var deterministicRegistration = (options = {}) => registrationFromLayer3({
|
|
15242
|
-
provider: options.provider ?? "test",
|
|
15243
|
-
model: options.model ?? "deterministic-embedding",
|
|
15244
|
-
layer: deterministicLayer(options)
|
|
15245
|
-
});
|
|
15246
|
-
var deterministicTestLayer = (options = {}) => layerFromRegistrationEffects3([deterministicRegistration(options)], {
|
|
15247
|
-
defaultSelection: {
|
|
15248
|
-
provider: options.provider ?? "test",
|
|
15249
|
-
model: options.model ?? "deterministic-embedding"
|
|
15250
|
-
}
|
|
15251
|
-
});
|
|
15252
|
-
var register9 = Effect67.fn("EmbeddingModelService.register.call")(function* (input) {
|
|
15253
|
-
const service = yield* Service45;
|
|
15254
|
-
return yield* service.register(input);
|
|
15255
|
-
});
|
|
15256
|
-
var registrations4 = Effect67.fn("EmbeddingModelService.registrations.call")(function* () {
|
|
15257
|
-
const service = yield* Service45;
|
|
15258
|
-
return yield* service.registrations;
|
|
15259
|
-
});
|
|
15260
|
-
|
|
15261
|
-
// ../runtime/src/memory/memory-service.ts
|
|
15262
15352
|
class Service46 extends Context59.Service()("@relayfx/runtime/MemoryService") {
|
|
15263
15353
|
}
|
|
15264
15354
|
var defaultTopK = 5;
|
|
@@ -15334,7 +15424,7 @@ var embed = (models, text2, options) => {
|
|
|
15334
15424
|
};
|
|
15335
15425
|
var make7 = (options = {}) => Effect68.gen(function* () {
|
|
15336
15426
|
const repository = yield* exports_memory_repository.Service;
|
|
15337
|
-
const models = yield*
|
|
15427
|
+
const models = yield* Service38;
|
|
15338
15428
|
const recall = Effect68.fn("MemoryService.recall")(function* (input) {
|
|
15339
15429
|
const text2 = latestUserText(input.prompt);
|
|
15340
15430
|
if (text2 === undefined)
|
|
@@ -15408,7 +15498,7 @@ var forget2 = Effect68.fn("MemoryService.forget.call")(function* (input) {
|
|
|
15408
15498
|
// ../runtime/src/state/execution-state-service.ts
|
|
15409
15499
|
var exports_execution_state_service = {};
|
|
15410
15500
|
__export(exports_execution_state_service, {
|
|
15411
|
-
testLayer: () =>
|
|
15501
|
+
testLayer: () => testLayer54,
|
|
15412
15502
|
memoryLayer: () => memoryLayer41,
|
|
15413
15503
|
layer: () => layer47,
|
|
15414
15504
|
key: () => key3,
|
|
@@ -15441,7 +15531,7 @@ var stateError = (cause) => new ExecutionStateError({ message: String(cause) });
|
|
|
15441
15531
|
var invalid = (stateKey, cause) => new StateValueInvalid({ key: stateKey, message: String(cause) });
|
|
15442
15532
|
var layer47 = Layer61.effect(Service47, Effect69.gen(function* () {
|
|
15443
15533
|
const repository = yield* exports_execution_state_repository.Service;
|
|
15444
|
-
const blobs = yield*
|
|
15534
|
+
const blobs = yield* Service43;
|
|
15445
15535
|
const eventInlineMaxBytes = yield* Config3.number("RELAY_STATE_EVENT_INLINE_MAX_BYTES").pipe(Config3.withDefault(65536), Effect69.orDie);
|
|
15446
15536
|
const get15 = Effect69.fn("ExecutionStateService.get")(function* (executionId, stateKey) {
|
|
15447
15537
|
const row = yield* repository.get(executionId, stateKey.name).pipe(Effect69.mapError(stateError));
|
|
@@ -15479,7 +15569,7 @@ var layer47 = Layer61.effect(Service47, Effect69.gen(function* () {
|
|
|
15479
15569
|
}));
|
|
15480
15570
|
var memoryRepositoryDependencies = Layer61.mergeAll(exports_execution_repository.memoryLayer, exports_execution_event_repository.memoryLayer);
|
|
15481
15571
|
var memoryLayer41 = layer47.pipe(Layer61.provide(exports_execution_state_repository.memoryLayer.pipe(Layer61.provide(memoryRepositoryDependencies))));
|
|
15482
|
-
var
|
|
15572
|
+
var testLayer54 = (implementation) => Layer61.succeed(Service47, Service47.of(implementation));
|
|
15483
15573
|
|
|
15484
15574
|
// ../runtime/src/state/state-tools.ts
|
|
15485
15575
|
import { Effect as Effect70, Schema as Schema77 } from "effect";
|
|
@@ -15820,15 +15910,15 @@ var makeLayer = (signalDependencies) => Layer63.effect(Service49, Effect73.gen(f
|
|
|
15820
15910
|
if (wait?.state === "open") {
|
|
15821
15911
|
const waitId = wait.id;
|
|
15822
15912
|
const sequence = yield* nextSequence(eventLog, input.executionId).pipe(Effect73.mapError((error5) => new InboxDeliveryError({ execution_id: input.executionId, message: error5._tag })));
|
|
15823
|
-
const
|
|
15913
|
+
const transition3 = yield* waits.wake({ waitId, resolvedAt: input.createdAt, eventSequence: sequence }).pipe(Effect73.mapError((error5) => new InboxDeliveryError({
|
|
15824
15914
|
execution_id: input.executionId,
|
|
15825
15915
|
message: error5._tag === "WaitNotFound" ? error5.wait_id : error5.message
|
|
15826
15916
|
})));
|
|
15827
|
-
if (
|
|
15917
|
+
if (transition3.transitioned && signalDependencies !== undefined) {
|
|
15828
15918
|
yield* signalWorkflowWait({
|
|
15829
15919
|
makeExecutionClient: signalDependencies.makeExecutionClient,
|
|
15830
|
-
executionId:
|
|
15831
|
-
waitId:
|
|
15920
|
+
executionId: transition3.wait.executionId,
|
|
15921
|
+
waitId: transition3.wait.id,
|
|
15832
15922
|
state: "resolved",
|
|
15833
15923
|
signaledAt: input.createdAt
|
|
15834
15924
|
}).pipe(Effect73.provideService(exports_execution_repository.Service, signalDependencies.executionRepository), Effect73.mapError((error5) => new InboxDeliveryError({ execution_id: input.executionId, message: String(error5) })));
|
|
@@ -15866,14 +15956,14 @@ var makeLayer = (signalDependencies) => Layer63.effect(Service49, Effect73.gen(f
|
|
|
15866
15956
|
}
|
|
15867
15957
|
}).pipe(Effect73.mapError((error5) => new InboxDeliveryError({ execution_id: wait.executionId, message: error5.message })));
|
|
15868
15958
|
const sequence = yield* nextSequence(eventLog, wait.executionId).pipe(Effect73.mapError((error5) => new InboxDeliveryError({ execution_id: wait.executionId, message: error5._tag })));
|
|
15869
|
-
const
|
|
15870
|
-
if (!
|
|
15959
|
+
const transition3 = yield* waits.wake({ waitId, resolvedAt: input.createdAt, eventSequence: sequence }).pipe(Effect73.mapError(() => new InboxReplyTokenInvalid({ reply_token: input.replyToken })));
|
|
15960
|
+
if (!transition3.transitioned)
|
|
15871
15961
|
return yield* new InboxReplyTokenInvalid({ reply_token: input.replyToken });
|
|
15872
15962
|
if (signalDependencies !== undefined) {
|
|
15873
15963
|
yield* signalWorkflowWait({
|
|
15874
15964
|
makeExecutionClient: signalDependencies.makeExecutionClient,
|
|
15875
|
-
executionId:
|
|
15876
|
-
waitId:
|
|
15965
|
+
executionId: transition3.wait.executionId,
|
|
15966
|
+
waitId: transition3.wait.id,
|
|
15877
15967
|
state: "resolved",
|
|
15878
15968
|
signaledAt: input.createdAt
|
|
15879
15969
|
}).pipe(Effect73.provideService(exports_execution_repository.Service, signalDependencies.executionRepository), Effect73.mapError((error5) => new InboxDeliveryError({ execution_id: wait.executionId, message: String(error5) })));
|
|
@@ -15890,7 +15980,7 @@ var memoryLayer42 = layer48.pipe(Layer63.provide(exports_inbox_repository.memory
|
|
|
15890
15980
|
var exports_topic_service = {};
|
|
15891
15981
|
__export(exports_topic_service, {
|
|
15892
15982
|
unsubscribe: () => unsubscribe,
|
|
15893
|
-
testLayer: () =>
|
|
15983
|
+
testLayer: () => testLayer55,
|
|
15894
15984
|
subscribe: () => subscribe,
|
|
15895
15985
|
publish: () => publish,
|
|
15896
15986
|
memoryLayer: () => memoryLayer43,
|
|
@@ -15974,7 +16064,7 @@ var layer49 = Layer64.effect(Service50, Effect74.gen(function* () {
|
|
|
15974
16064
|
return Service50.of({ subscribe, unsubscribe, publish, list: list16 });
|
|
15975
16065
|
}));
|
|
15976
16066
|
var memoryLayer43 = layer49.pipe(Layer64.provide(exports_topic_repository.memoryLayer));
|
|
15977
|
-
var
|
|
16067
|
+
var testLayer55 = (implementation) => Layer64.succeed(Service50, Service50.of(implementation));
|
|
15978
16068
|
var subscribe = (input) => Effect74.flatMap(Service50, (service) => service.subscribe(input));
|
|
15979
16069
|
var unsubscribe = (input) => Effect74.flatMap(Service50, (service) => service.unsubscribe(input));
|
|
15980
16070
|
var publish = (input) => Effect74.flatMap(Service50, (service) => service.publish(input));
|
|
@@ -16075,8 +16165,8 @@ var registeredTool4 = (config) => tool(toolName4, {
|
|
|
16075
16165
|
}).pipe(Effect76.mapError((error5) => new ToolRuntimeError({ message: error5.message })));
|
|
16076
16166
|
if ((yield* config.inbox.undrainedCount(context.executionId).pipe(Effect76.mapError((error5) => new ToolRuntimeError({ message: error5.message })))) > 0) {
|
|
16077
16167
|
const sequence = yield* config.eventLog.maxSequence(context.executionId).pipe(Effect76.map((value) => (value ?? -1) + 1), Effect76.mapError((error5) => new ToolRuntimeError({ message: error5._tag })));
|
|
16078
|
-
const
|
|
16079
|
-
if (
|
|
16168
|
+
const transition3 = yield* config.waits.wake({ waitId, resolvedAt: context.createdAt, eventSequence: sequence }).pipe(Effect76.mapError((error5) => new ToolRuntimeError({ message: error5._tag })));
|
|
16169
|
+
if (transition3.transitioned) {
|
|
16080
16170
|
const drained = yield* drain3();
|
|
16081
16171
|
return { status: "messages", messages: drained.map(project2) };
|
|
16082
16172
|
}
|
|
@@ -16132,7 +16222,7 @@ var registeredTool5 = (config) => tool(toolName5, {
|
|
|
16132
16222
|
// ../runtime/src/envelope/envelope-service.ts
|
|
16133
16223
|
var exports_envelope_service = {};
|
|
16134
16224
|
__export(exports_envelope_service, {
|
|
16135
|
-
testLayer: () =>
|
|
16225
|
+
testLayer: () => testLayer56,
|
|
16136
16226
|
send: () => send2,
|
|
16137
16227
|
memoryLayer: () => memoryLayer44,
|
|
16138
16228
|
layer: () => layer50,
|
|
@@ -16337,7 +16427,7 @@ var layer50 = Layer65.effect(Service51, Effect78.gen(function* () {
|
|
|
16337
16427
|
});
|
|
16338
16428
|
}));
|
|
16339
16429
|
var memoryLayer44 = (routes = []) => layer50.pipe(Layer65.provide(memoryLayer28(routes)), Layer65.provide(exports_envelope_repository.memoryLayer), Layer65.provide(memoryLayer29));
|
|
16340
|
-
var
|
|
16430
|
+
var testLayer56 = (implementation) => Layer65.succeed(Service51, Service51.of(implementation));
|
|
16341
16431
|
var send2 = Effect78.fn("EnvelopeService.send.call")(function* (input) {
|
|
16342
16432
|
const service = yield* Service51;
|
|
16343
16433
|
return yield* service.send(input);
|
|
@@ -16346,7 +16436,7 @@ var send2 = Effect78.fn("EnvelopeService.send.call")(function* (input) {
|
|
|
16346
16436
|
// ../runtime/src/agent/prompt-assembler-service.ts
|
|
16347
16437
|
var exports_prompt_assembler_service = {};
|
|
16348
16438
|
__export(exports_prompt_assembler_service, {
|
|
16349
|
-
testLayer: () =>
|
|
16439
|
+
testLayer: () => testLayer58,
|
|
16350
16440
|
layer: () => layer51,
|
|
16351
16441
|
defaultLayerWithStores: () => defaultLayerWithStores,
|
|
16352
16442
|
defaultLayer: () => defaultLayer,
|
|
@@ -16361,7 +16451,7 @@ import { Prompt as Prompt14 } from "effect/unstable/ai";
|
|
|
16361
16451
|
// ../runtime/src/content/artifact-store-service.ts
|
|
16362
16452
|
var exports_artifact_store_service = {};
|
|
16363
16453
|
__export(exports_artifact_store_service, {
|
|
16364
|
-
testLayer: () =>
|
|
16454
|
+
testLayer: () => testLayer57,
|
|
16365
16455
|
resolve: () => resolve6,
|
|
16366
16456
|
register: () => register10,
|
|
16367
16457
|
passthroughLayer: () => passthroughLayer2,
|
|
@@ -16405,7 +16495,7 @@ var memoryServiceLayer = Layer66.effect(Service52, Effect79.gen(function* () {
|
|
|
16405
16495
|
return Service52.of({ resolve: memory.resolve });
|
|
16406
16496
|
}));
|
|
16407
16497
|
var memoryLayer45 = memoryServiceLayer.pipe(Layer66.provideMerge(Layer66.effect(Memory2, makeMemory2)));
|
|
16408
|
-
var
|
|
16498
|
+
var testLayer57 = (implementation) => Layer66.succeed(Service52, Service52.of(implementation));
|
|
16409
16499
|
var resolve6 = Effect79.fn("ArtifactStore.resolve.call")(function* (part) {
|
|
16410
16500
|
const service = yield* Service52;
|
|
16411
16501
|
return yield* service.resolve(part);
|
|
@@ -16502,13 +16592,13 @@ var makeDefaultInterface = (blobs, artifacts) => ({
|
|
|
16502
16592
|
assemble: (input) => defaultPrompt(blobs, artifacts, input.input).pipe(Effect80.map((prompt) => ({ system: defaultSystem(input.agent, input.tools), prompt })))
|
|
16503
16593
|
});
|
|
16504
16594
|
var defaultLayerWithStores = Layer67.effect(Service53, Effect80.gen(function* () {
|
|
16505
|
-
const blobs = yield*
|
|
16595
|
+
const blobs = yield* Service43;
|
|
16506
16596
|
const artifacts = yield* Service52;
|
|
16507
16597
|
return Service53.of(makeDefaultInterface(blobs, artifacts));
|
|
16508
16598
|
}));
|
|
16509
16599
|
var defaultLayer = defaultLayerWithStores.pipe(Layer67.provide(Layer67.mergeAll(passthroughLayer, passthroughLayer2)));
|
|
16510
16600
|
var layer51 = (implementation) => Layer67.succeed(Service53, Service53.of(implementation));
|
|
16511
|
-
var
|
|
16601
|
+
var testLayer58 = (implementation) => Layer67.succeed(Service53, Service53.of(implementation));
|
|
16512
16602
|
var assemble = Effect80.fn("PromptAssembler.assemble.call")(function* (input) {
|
|
16513
16603
|
const service = yield* Service53;
|
|
16514
16604
|
return yield* service.assemble(input);
|
|
@@ -16926,7 +17016,7 @@ var store = (blobStore, toolCallId, content) => {
|
|
|
16926
17016
|
var make11 = (blobStore) => ({
|
|
16927
17017
|
put: (toolCallId, content) => store(blobStore, toolCallId, content)
|
|
16928
17018
|
});
|
|
16929
|
-
var layer56 = Layer72.effect(exports_tool_output.ToolOutputStore,
|
|
17019
|
+
var layer56 = Layer72.effect(exports_tool_output.ToolOutputStore, Service43.pipe(Effect85.map((blobStore) => exports_tool_output.ToolOutputStore.of(make11(blobStore)))));
|
|
16930
17020
|
|
|
16931
17021
|
// ../runtime/src/agent/sequence-allocator.ts
|
|
16932
17022
|
import { Effect as Effect86, Ref as Ref20 } from "effect";
|
|
@@ -17327,22 +17417,22 @@ var compactionOptions = (agent) => agent.compaction_policy === undefined ? undef
|
|
|
17327
17417
|
};
|
|
17328
17418
|
var layer57 = Layer73.effect(Service54, Effect87.gen(function* () {
|
|
17329
17419
|
const eventLog = yield* Service30;
|
|
17330
|
-
const languageModels = yield*
|
|
17420
|
+
const languageModels = yield* Service39;
|
|
17331
17421
|
const tools = yield* Service32;
|
|
17332
17422
|
const childRuns = yield* Effect87.serviceOption(Service37);
|
|
17333
17423
|
const chats = yield* exports_agent_chat_repository.Service;
|
|
17334
|
-
const policy = yield*
|
|
17424
|
+
const policy = yield* Service40;
|
|
17335
17425
|
const assembler = yield* Service53;
|
|
17336
|
-
const schemas = yield*
|
|
17426
|
+
const schemas = yield* Service42;
|
|
17337
17427
|
const durableMemory = yield* Effect87.serviceOption(Service46);
|
|
17338
|
-
const blobStore = yield* Effect87.serviceOption(
|
|
17428
|
+
const blobStore = yield* Effect87.serviceOption(Service43);
|
|
17339
17429
|
const compactionRepository = yield* Effect87.serviceOption(exports_compaction_repository.Service);
|
|
17340
17430
|
const contextEpochs = yield* Effect87.serviceOption(exports_context_epoch_repository.Service);
|
|
17341
17431
|
const sessionRepository = yield* Effect87.serviceOption(exports_session_repository.Service);
|
|
17342
17432
|
const permissionRules = yield* Effect87.serviceOption(exports_permission_rule_repository.Service);
|
|
17343
17433
|
const steeringRepository = yield* Effect87.serviceOption(exports_steering_repository.Service);
|
|
17344
17434
|
const waits = yield* Effect87.serviceOption(Service31);
|
|
17345
|
-
const presence = yield* Effect87.serviceOption(
|
|
17435
|
+
const presence = yield* Effect87.serviceOption(Service41);
|
|
17346
17436
|
const inbox = yield* Effect87.serviceOption(Service49);
|
|
17347
17437
|
const topics = yield* Effect87.serviceOption(Service50);
|
|
17348
17438
|
const envelopes = yield* Effect87.serviceOption(Service51);
|
|
@@ -17622,7 +17712,7 @@ var layer57 = Layer73.effect(Service54, Effect87.gen(function* () {
|
|
|
17622
17712
|
})
|
|
17623
17713
|
});
|
|
17624
17714
|
}));
|
|
17625
|
-
var
|
|
17715
|
+
var testLayer59 = (implementation) => Layer73.succeed(Service54, Service54.of(implementation));
|
|
17626
17716
|
var run4 = Effect87.fn("AgentLoop.run.call")(function* (input) {
|
|
17627
17717
|
const service = yield* Service54;
|
|
17628
17718
|
return yield* service.run(input);
|
|
@@ -18848,12 +18938,14 @@ var signalWait = Effect93.fn("ExecutionWorkflow.signalWait")(function* (input) {
|
|
|
18848
18938
|
var exports_child_fan_out_runtime = {};
|
|
18849
18939
|
__export(exports_child_fan_out_runtime, {
|
|
18850
18940
|
testHandlersLayer: () => testHandlersLayer,
|
|
18941
|
+
layerFromRuntime: () => layerFromRuntime,
|
|
18851
18942
|
layer: () => layer62,
|
|
18943
|
+
handlersLayer: () => handlersLayer,
|
|
18852
18944
|
Service: () => Service61,
|
|
18853
18945
|
HandlerService: () => HandlerService,
|
|
18854
18946
|
ChildFanOutRuntimeError: () => ChildFanOutRuntimeError
|
|
18855
18947
|
});
|
|
18856
|
-
import { Clock as Clock15, Context as Context74, Effect as Effect95, Layer as Layer81, Schema as Schema95 } from "effect";
|
|
18948
|
+
import { Clock as Clock15, Context as Context74, Effect as Effect95, FiberMap, Layer as Layer81, Schema as Schema95 } from "effect";
|
|
18857
18949
|
|
|
18858
18950
|
// ../runtime/src/child/child-fan-out-transition-service.ts
|
|
18859
18951
|
var exports_child_fan_out_transition_service = {};
|
|
@@ -18937,11 +19029,11 @@ class ChildFanOutRuntimeError extends Schema95.TaggedErrorClass()("ChildFanOutRu
|
|
|
18937
19029
|
class Service61 extends Context74.Service()("@relayfx/runtime/ChildFanOutRuntime") {
|
|
18938
19030
|
}
|
|
18939
19031
|
var runtimeError = (error5) => new ChildFanOutRuntimeError({ message: String(error5) });
|
|
18940
|
-
var
|
|
19032
|
+
var layerFromRuntime = Layer81.effect(Service61, Effect95.gen(function* () {
|
|
18941
19033
|
const repository = yield* exports_child_fan_out_repository.Service;
|
|
18942
19034
|
const transitions = yield* Service60;
|
|
18943
19035
|
const handlers = yield* HandlerService;
|
|
18944
|
-
const
|
|
19036
|
+
const hosts = yield* FiberMap.make();
|
|
18945
19037
|
const run5 = Effect95.fn("ChildFanOutRuntime.run")(function* (fanOutId) {
|
|
18946
19038
|
while (true) {
|
|
18947
19039
|
const fanOut2 = yield* repository.get(fanOutId);
|
|
@@ -18971,7 +19063,7 @@ var layer62 = Layer81.effect(Service61, Effect95.gen(function* () {
|
|
|
18971
19063
|
})), { concurrency: fanOut2.max_concurrency, discard: true });
|
|
18972
19064
|
}
|
|
18973
19065
|
});
|
|
18974
|
-
const launch = (fanOutId) => run5(fanOutId).pipe(Effect95.ignore,
|
|
19066
|
+
const launch = (fanOutId) => FiberMap.run(hosts, fanOutId, run5(fanOutId).pipe(Effect95.ignore), { onlyIfMissing: true }).pipe(Effect95.asVoid);
|
|
18975
19067
|
const recover = Effect95.fn("ChildFanOutRuntime.recover")(function* () {
|
|
18976
19068
|
const fanOuts = yield* repository.listNonTerminal();
|
|
18977
19069
|
yield* Effect95.forEach(fanOuts, (fanOut2) => launch(fanOut2.fan_out_id), { discard: true });
|
|
@@ -18996,7 +19088,9 @@ var layer62 = Layer81.effect(Service61, Effect95.gen(function* () {
|
|
|
18996
19088
|
yield* recover().pipe(Effect95.mapError(runtimeError));
|
|
18997
19089
|
return service;
|
|
18998
19090
|
}).pipe(Effect95.mapError(runtimeError)));
|
|
18999
|
-
var
|
|
19091
|
+
var layer62 = layerFromRuntime;
|
|
19092
|
+
var handlersLayer = (handlers) => Layer81.succeed(HandlerService, handlers);
|
|
19093
|
+
var testHandlersLayer = handlersLayer;
|
|
19000
19094
|
|
|
19001
19095
|
// ../runtime/src/cluster/execution-entity.ts
|
|
19002
19096
|
var exports_execution_entity = {};
|
|
@@ -19050,7 +19144,7 @@ var client2 = entity.client;
|
|
|
19050
19144
|
var exports_scheduler_service = {};
|
|
19051
19145
|
__export(exports_scheduler_service, {
|
|
19052
19146
|
workerIdConfig: () => workerIdConfig,
|
|
19053
|
-
testLayer: () =>
|
|
19147
|
+
testLayer: () => testLayer60,
|
|
19054
19148
|
startIdempotencyKey: () => startIdempotencyKey,
|
|
19055
19149
|
runOnce: () => runOnce2,
|
|
19056
19150
|
pollIntervalMillisConfig: () => pollIntervalMillisConfig,
|
|
@@ -19216,7 +19310,7 @@ var layer64 = Layer82.effect(Service62, Effect96.gen(function* () {
|
|
|
19216
19310
|
return service;
|
|
19217
19311
|
}));
|
|
19218
19312
|
var memoryLayer47 = Layer82.effect(Service62, make15);
|
|
19219
|
-
var
|
|
19313
|
+
var testLayer60 = (implementation) => Layer82.succeed(Service62, Service62.of(implementation));
|
|
19220
19314
|
var runOnce2 = Effect96.fn("SchedulerService.runOnce.call")(function* () {
|
|
19221
19315
|
const service = yield* Service62;
|
|
19222
19316
|
return yield* service.runOnce;
|
|
@@ -19228,7 +19322,7 @@ __export(exports_runner_runtime_service, {
|
|
|
19228
19322
|
testLayerWithServices: () => testLayerWithServices,
|
|
19229
19323
|
testLayerWithLanguageModelService: () => testLayerWithLanguageModelService,
|
|
19230
19324
|
testLayerWithDatabaseCheck: () => testLayerWithDatabaseCheck,
|
|
19231
|
-
testLayer: () =>
|
|
19325
|
+
testLayer: () => testLayer65,
|
|
19232
19326
|
testClientLayerWithDatabaseCheck: () => testClientLayerWithDatabaseCheck,
|
|
19233
19327
|
testClientLayer: () => testClientLayer,
|
|
19234
19328
|
shardingConfigFromEnv: () => shardingConfigFromEnv,
|
|
@@ -19274,7 +19368,7 @@ import { LanguageModel as LanguageModel8 } from "effect/unstable/ai";
|
|
|
19274
19368
|
// ../runtime/src/execution/execution-watch-service.ts
|
|
19275
19369
|
var exports_execution_watch_service = {};
|
|
19276
19370
|
__export(exports_execution_watch_service, {
|
|
19277
|
-
testLayer: () =>
|
|
19371
|
+
testLayer: () => testLayer61,
|
|
19278
19372
|
memoryLayer: () => memoryLayer48,
|
|
19279
19373
|
layerFromServices: () => layerFromServices,
|
|
19280
19374
|
Service: () => Service63,
|
|
@@ -19330,12 +19424,12 @@ var layerFromServices = Layer83.effect(Service63, Effect97.gen(function* () {
|
|
|
19330
19424
|
});
|
|
19331
19425
|
}));
|
|
19332
19426
|
var memoryLayer48 = layerFromServices;
|
|
19333
|
-
var
|
|
19427
|
+
var testLayer61 = (implementation) => Layer83.succeed(Service63, Service63.of(implementation));
|
|
19334
19428
|
|
|
19335
19429
|
// ../runtime/src/entity/entity-registry-service.ts
|
|
19336
19430
|
var exports_entity_registry_service = {};
|
|
19337
19431
|
__export(exports_entity_registry_service, {
|
|
19338
|
-
testLayer: () =>
|
|
19432
|
+
testLayer: () => testLayer62,
|
|
19339
19433
|
layer: () => layer65,
|
|
19340
19434
|
Service: () => Service64,
|
|
19341
19435
|
EntityRegistryError: () => EntityRegistryError,
|
|
@@ -19385,12 +19479,12 @@ var layer65 = Layer84.effect(Service64, Effect98.gen(function* () {
|
|
|
19385
19479
|
listKinds: () => repository.listKinds().pipe(Effect98.mapError(repositoryError4))
|
|
19386
19480
|
});
|
|
19387
19481
|
}));
|
|
19388
|
-
var
|
|
19482
|
+
var testLayer62 = (implementation) => Layer84.succeed(Service64, Service64.of(implementation));
|
|
19389
19483
|
|
|
19390
19484
|
// ../runtime/src/entity/entity-instance-service.ts
|
|
19391
19485
|
var exports_entity_instance_service = {};
|
|
19392
19486
|
__export(exports_entity_instance_service, {
|
|
19393
|
-
testLayer: () =>
|
|
19487
|
+
testLayer: () => testLayer63,
|
|
19394
19488
|
layer: () => layer66,
|
|
19395
19489
|
entitySessionId: () => entitySessionId,
|
|
19396
19490
|
entityExecutionId: () => entityExecutionId,
|
|
@@ -19515,12 +19609,12 @@ var layer66 = Layer85.effect(Service65, Effect99.gen(function* () {
|
|
|
19515
19609
|
list: (input) => repository.list(input).pipe(Effect99.mapError(serviceError2))
|
|
19516
19610
|
});
|
|
19517
19611
|
}));
|
|
19518
|
-
var
|
|
19612
|
+
var testLayer63 = (implementation) => Layer85.succeed(Service65, Service65.of(implementation));
|
|
19519
19613
|
|
|
19520
19614
|
// ../runtime/src/execution/session-stream-service.ts
|
|
19521
19615
|
var exports_session_stream_service = {};
|
|
19522
19616
|
__export(exports_session_stream_service, {
|
|
19523
|
-
testLayer: () =>
|
|
19617
|
+
testLayer: () => testLayer64,
|
|
19524
19618
|
memoryLayer: () => memoryLayer49,
|
|
19525
19619
|
layerFromServices: () => layerFromServices2,
|
|
19526
19620
|
SessionStreamError: () => SessionStreamError,
|
|
@@ -19560,7 +19654,7 @@ var layerFromServices2 = Layer86.effect(Service66, Effect100.gen(function* () {
|
|
|
19560
19654
|
});
|
|
19561
19655
|
}));
|
|
19562
19656
|
var memoryLayer49 = layerFromServices2;
|
|
19563
|
-
var
|
|
19657
|
+
var testLayer64 = (implementation) => Layer86.succeed(Service66, Service66.of(implementation));
|
|
19564
19658
|
|
|
19565
19659
|
// ../runtime/src/runner/runner-runtime-service.ts
|
|
19566
19660
|
var DatabaseMode = Schema102.Literals(["sql", "pg", "mysql", "sqlite", "memory"]).annotate({
|
|
@@ -19687,7 +19781,8 @@ var assertClusterConfig = Effect101.fn("RunnerRuntime.assertClusterConfig")(func
|
|
|
19687
19781
|
return yield* new ClusterConfigMismatch({ field: "availableShardGroups", expected: want, actual });
|
|
19688
19782
|
}
|
|
19689
19783
|
});
|
|
19690
|
-
var
|
|
19784
|
+
var sqlNotificationLayer = exports_notification_bus.layerFromDialect;
|
|
19785
|
+
var sqlRepositoryBaseLayer = Layer87.mergeAll(exports_address_book_repository.layer, exports_agent_chat_repository.layer, exports_agent_definition_repository.layer, exports_workflow_definition_repository.layer, exports_child_execution_repository.layer, exports_child_fan_out_repository.layer, exports_cluster_registry_repository.layer, exports_compaction_repository.layer, exports_context_epoch_repository.layer, exports_execution_repository.layerWithoutBus, exports_envelope_repository.layer, exports_entity_repository.layer, exports_execution_event_repository.layer, exports_inbox_repository.layer, exports_memory_repository.layer, exports_topic_repository.layer, exports_permission_rule_repository.layer, exports_presence_repository.layer, exports_schedule_repository.layer, exports_session_repository.layer, exports_skill_definition_repository.layer, exports_steering_repository.layer, exports_tool_call_repository.layer, exports_workspace_lease_repository.layer).pipe(Layer87.provideMerge(sqlNotificationLayer));
|
|
19691
19786
|
var sqlRepositoryLayer = Layer87.mergeAll(sqlRepositoryBaseLayer, exports_execution_state_repository.layer.pipe(Layer87.provide(sqlRepositoryBaseLayer)));
|
|
19692
19787
|
var memoryRepositoryBaseLayer = Layer87.mergeAll(exports_address_book_repository.memoryLayer, exports_agent_chat_repository.memoryLayer, exports_agent_definition_repository.memoryLayer, exports_workflow_definition_repository.memoryLayer, exports_child_execution_repository.memoryLayer, exports_child_fan_out_repository.memoryLayer, exports_cluster_registry_repository.memoryLayer, exports_compaction_repository.memoryLayer, exports_context_epoch_repository.memoryLayer, exports_execution_repository.memoryLayer, exports_envelope_repository.memoryLayer, exports_entity_repository.memoryLayer, exports_execution_event_repository.memoryLayer, exports_inbox_repository.memoryLayer, exports_memory_repository.memoryLayer, exports_topic_repository.memoryLayer, exports_permission_rule_repository.memoryLayer, exports_presence_repository.memoryLayer, exports_schedule_repository.memoryLayer, exports_session_repository.memoryLayer, exports_skill_definition_repository.memoryLayer, exports_steering_repository.memoryLayer, exports_tool_call_repository.memoryLayer, exports_workspace_lease_repository.memoryLayer);
|
|
19693
19788
|
var memoryRepositoryLayer = Layer87.mergeAll(memoryRepositoryBaseLayer, exports_execution_state_repository.memoryLayer.pipe(Layer87.provide(memoryRepositoryBaseLayer)));
|
|
@@ -19695,7 +19790,7 @@ var testCryptoLayer = Layer87.succeed(Crypto4.Crypto, Crypto4.make({
|
|
|
19695
19790
|
randomBytes: (size) => new Uint8Array(size),
|
|
19696
19791
|
digest: (algorithm, data) => Effect101.promise(() => globalThis.crypto.subtle.digest(algorithm, data).then((buffer) => new Uint8Array(buffer)))
|
|
19697
19792
|
}));
|
|
19698
|
-
var executionServiceLayer =
|
|
19793
|
+
var executionServiceLayer = layer45.pipe(Layer87.provideMerge(layer39));
|
|
19699
19794
|
var addressResolutionLayerWith = (toolRuntimeLayer) => layer31.pipe(Layer87.provideMerge(layerFromRepository), Layer87.provideMerge(layer30.pipe(Layer87.provideMerge(toolRuntimeLayer))));
|
|
19700
19795
|
var parentNotifierLayer = Layer87.effect(Service55, Effect101.gen(function* () {
|
|
19701
19796
|
const makeExecutionClient = yield* client2;
|
|
@@ -19710,7 +19805,7 @@ var parentNotifierLayer = Layer87.effect(Service55, Effect101.gen(function* () {
|
|
|
19710
19805
|
}).pipe(Effect101.provideService(exports_execution_repository.Service, executionRepository))
|
|
19711
19806
|
});
|
|
19712
19807
|
}));
|
|
19713
|
-
var agentLoopLayerWith = (toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer) => layer57.pipe(Layer87.provideMerge(toolRuntimeLayer), Layer87.provideMerge(layer39), Layer87.provideMerge(
|
|
19808
|
+
var agentLoopLayerWith = (toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer) => layer57.pipe(Layer87.provideMerge(toolRuntimeLayer), Layer87.provideMerge(layer39), Layer87.provideMerge(layer42()), Layer87.provideMerge(promptAssemblerLayer), Layer87.provideMerge(schemaRegistryLayer));
|
|
19714
19809
|
var runtimeServicesLayerWith = (toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer, toolTransitionCoordinatorLayer) => {
|
|
19715
19810
|
const inboxLayer = Layer87.unwrap(Effect101.gen(function* () {
|
|
19716
19811
|
const makeExecutionClient = yield* client2;
|
|
@@ -19722,7 +19817,7 @@ var runtimeServicesLayerWith = (toolRuntimeLayer, promptAssemblerLayer, schemaRe
|
|
|
19722
19817
|
const agentLayer = agentLoopLayerWith(toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer).pipe(Layer87.provideMerge(inboxLayer), Layer87.provideMerge(envelopeLayer), Layer87.provideMerge(topicLayer));
|
|
19723
19818
|
const entityRegistryLayer = layer65.pipe(Layer87.provideMerge(layer30));
|
|
19724
19819
|
const entityInstanceLayer = layer66.pipe(Layer87.provideMerge(entityRegistryLayer), Layer87.provideMerge(layerFromRepository), Layer87.provideMerge(layerFromRepository2));
|
|
19725
|
-
return Layer87.mergeAll(addressResolutionLayerWith(toolRuntimeLayer),
|
|
19820
|
+
return Layer87.mergeAll(addressResolutionLayerWith(toolRuntimeLayer), layer44, executionServiceLayer, layerFromServices, layerFromServices2, layerFromRepository3, agentLayer, layer59, parentNotifierLayer, inboxLayer, envelopeLayer, topicLayer, entityRegistryLayer, entityInstanceLayer, toolTransitionCoordinatorLayer, layer58).pipe(Layer87.provideMerge(layer47), Layer87.provideMerge(layer28), Layer87.provideMerge(layerFromRepository2));
|
|
19726
19821
|
};
|
|
19727
19822
|
var workflowLayerWith = (toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer, toolTransitionCoordinatorLayer) => layer60.pipe(Layer87.provideMerge(runtimeServicesLayerWith(toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer, toolTransitionCoordinatorLayer)));
|
|
19728
19823
|
var workflowAndEntityLayerWith = (toolRuntimeLayer, schedulerLayer, promptAssemblerLayer, schemaRegistryLayer, toolTransitionCoordinatorLayer) => Layer87.mergeAll(layer63, schedulerLayer).pipe(Layer87.provideMerge(workflowLayerWith(toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer, toolTransitionCoordinatorLayer)));
|
|
@@ -19805,8 +19900,8 @@ var deterministicTestModelLayer = Layer87.effect(LanguageModel8.LanguageModel, L
|
|
|
19805
19900
|
generateText: () => Effect101.succeed([{ type: "text", text: "deterministic test response" }]),
|
|
19806
19901
|
streamText: () => Stream15.make({ type: "text-delta", id: "text", delta: "deterministic test response" })
|
|
19807
19902
|
}));
|
|
19808
|
-
var testLanguageModelLayer =
|
|
19809
|
-
|
|
19903
|
+
var testLanguageModelLayer = layerFromRegistrationEffects3([
|
|
19904
|
+
registrationFromLayer3({
|
|
19810
19905
|
provider: "test",
|
|
19811
19906
|
model: "deterministic",
|
|
19812
19907
|
layer: deterministicTestModelLayer
|
|
@@ -19818,8 +19913,8 @@ var layerWith = (options) => {
|
|
|
19818
19913
|
const blobStoreLayer = options.blobStoreLayer ?? passthroughLayer;
|
|
19819
19914
|
const artifactStoreLayer = options.artifactStoreLayer ?? passthroughLayer2;
|
|
19820
19915
|
const promptAssemblerLayer = options.promptAssemblerLayer ?? defaultPromptAssemblerLayer(blobStoreLayer, artifactStoreLayer);
|
|
19821
|
-
const schemaRegistryLayer = options.schemaRegistryLayer ??
|
|
19822
|
-
const embeddingModelLayer = options.embeddingModelLayer ??
|
|
19916
|
+
const schemaRegistryLayer = options.schemaRegistryLayer ?? layer43();
|
|
19917
|
+
const embeddingModelLayer = options.embeddingModelLayer ?? memoryLayer35();
|
|
19823
19918
|
const memoryLayer50 = layer46().pipe(Layer87.provideMerge(embeddingModelLayer));
|
|
19824
19919
|
const clusterContextLayer = Layer87.mergeAll(options.languageModelLayer, memoryLayer50, blobStoreLayer, artifactStoreLayer, promptAssemblerLayer, schemaRegistryLayer);
|
|
19825
19920
|
const clusterLayer = options.clusterLayer.pipe(Layer87.provide(clusterContextLayer));
|
|
@@ -19829,8 +19924,8 @@ var layerWithClient = (options) => {
|
|
|
19829
19924
|
const blobStoreLayer = options.blobStoreLayer ?? passthroughLayer;
|
|
19830
19925
|
const artifactStoreLayer = options.artifactStoreLayer ?? passthroughLayer2;
|
|
19831
19926
|
const promptAssemblerLayer = options.promptAssemblerLayer ?? defaultPromptAssemblerLayer(blobStoreLayer, artifactStoreLayer);
|
|
19832
|
-
const schemaRegistryLayer = options.schemaRegistryLayer ??
|
|
19833
|
-
const embeddingModelLayer = options.embeddingModelLayer ??
|
|
19927
|
+
const schemaRegistryLayer = options.schemaRegistryLayer ?? layer43();
|
|
19928
|
+
const embeddingModelLayer = options.embeddingModelLayer ?? memoryLayer35();
|
|
19834
19929
|
const memoryLayer50 = layer46().pipe(Layer87.provideMerge(embeddingModelLayer));
|
|
19835
19930
|
return Layer87.mergeAll(options.checkLayer, runtimeServicesLayerWith(options.toolRuntimeLayer, promptAssemblerLayer, schemaRegistryLayer, options.toolTransitionCoordinatorLayer)).pipe(Layer87.provideMerge(options.languageModelLayer), Layer87.provide(memoryLayer50), Layer87.provideMerge(options.clusterLayer), Layer87.provideMerge(options.repositoryLayer), Layer87.provideMerge(blobStoreLayer), Layer87.provideMerge(artifactStoreLayer));
|
|
19836
19931
|
};
|
|
@@ -19890,8 +19985,8 @@ var layer67 = layerWith({
|
|
|
19890
19985
|
checkLayer: sqlCheckLayer,
|
|
19891
19986
|
clusterLayer: sqlClusterLayer,
|
|
19892
19987
|
repositoryLayer: sqlRepositoryLayer,
|
|
19893
|
-
languageModelLayer:
|
|
19894
|
-
embeddingModelLayer:
|
|
19988
|
+
languageModelLayer: memoryLayer36(),
|
|
19989
|
+
embeddingModelLayer: memoryLayer35(),
|
|
19895
19990
|
toolRuntimeLayer: layer29(),
|
|
19896
19991
|
schedulerLayer: layer64
|
|
19897
19992
|
});
|
|
@@ -19906,7 +20001,7 @@ var testLayerWithServices = (options) => layerWith({
|
|
|
19906
20001
|
schedulerLayer: memoryLayer47
|
|
19907
20002
|
}).pipe(Layer87.provideMerge(testCryptoLayer));
|
|
19908
20003
|
var testLayerWithLanguageModelService = (languageModelLayer) => testLayerWithServices({ languageModelLayer, toolRuntimeLayer: layer29() });
|
|
19909
|
-
var
|
|
20004
|
+
var testLayer65 = testLayerWithServices({
|
|
19910
20005
|
languageModelLayer: testLanguageModelLayer,
|
|
19911
20006
|
toolRuntimeLayer: layer29()
|
|
19912
20007
|
});
|
|
@@ -19949,7 +20044,9 @@ __export(exports_definition_runtime, {
|
|
|
19949
20044
|
validate: () => validate,
|
|
19950
20045
|
testHandlersLayer: () => testHandlersLayer2,
|
|
19951
20046
|
run: () => run5,
|
|
20047
|
+
layerFromRuntime: () => layerFromRuntime2,
|
|
19952
20048
|
layer: () => layer68,
|
|
20049
|
+
handlersLayer: () => handlersLayer2,
|
|
19953
20050
|
fanOutIdFor: () => fanOutIdFor,
|
|
19954
20051
|
WorkflowJoining: () => WorkflowJoining,
|
|
19955
20052
|
WorkflowCancelled: () => WorkflowCancelled,
|
|
@@ -19960,7 +20057,7 @@ __export(exports_definition_runtime, {
|
|
|
19960
20057
|
PinnedDefinitionMismatch: () => PinnedDefinitionMismatch,
|
|
19961
20058
|
HandlerService: () => HandlerService2
|
|
19962
20059
|
});
|
|
19963
|
-
import { Cause as Cause6, Clock as Clock17, Context as Context81, Effect as Effect102, Exit as Exit3, Layer as Layer88, Option as Option31, Schema as Schema103 } from "effect";
|
|
20060
|
+
import { Cause as Cause6, Clock as Clock17, Context as Context81, Effect as Effect102, Exit as Exit3, FiberMap as FiberMap2, Layer as Layer88, Option as Option31, Schema as Schema103 } from "effect";
|
|
19964
20061
|
|
|
19965
20062
|
class UnsupportedOperation extends Schema103.TaggedErrorClass()("UnsupportedWorkflowOperation", { operation_id: exports_ids_schema.WorkflowOperationId, kind: Schema103.String }) {
|
|
19966
20063
|
}
|
|
@@ -20258,7 +20355,7 @@ var run5 = Effect102.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
20258
20355
|
});
|
|
20259
20356
|
break;
|
|
20260
20357
|
}
|
|
20261
|
-
const
|
|
20358
|
+
const completedAt = yield* Clock17.currentTimeMillis;
|
|
20262
20359
|
const current2 = yield* repository.getOperation(executionId, id2);
|
|
20263
20360
|
yield* repository.putOperation({
|
|
20264
20361
|
execution_id: executionId,
|
|
@@ -20268,15 +20365,15 @@ var run5 = Effect102.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
20268
20365
|
...current2?.decision === undefined ? {} : { decision: current2.decision },
|
|
20269
20366
|
...current2?.fan_out_id === undefined ? {} : { fan_out_id: current2.fan_out_id },
|
|
20270
20367
|
started_at: startedAt,
|
|
20271
|
-
completed_at:
|
|
20272
|
-
updated_at:
|
|
20368
|
+
completed_at: completedAt,
|
|
20369
|
+
updated_at: completedAt
|
|
20273
20370
|
});
|
|
20274
20371
|
yield* repository.appendLifecycle({
|
|
20275
20372
|
execution_id: executionId,
|
|
20276
20373
|
operation_id: id2,
|
|
20277
20374
|
type: "operation.completed",
|
|
20278
20375
|
...output2 === undefined ? {} : { data: output2 },
|
|
20279
|
-
created_at:
|
|
20376
|
+
created_at: completedAt
|
|
20280
20377
|
});
|
|
20281
20378
|
return output2;
|
|
20282
20379
|
});
|
|
@@ -20286,11 +20383,7 @@ var run5 = Effect102.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
20286
20383
|
if (Option31.isSome(failure3) && failure3.value instanceof WorkflowJoining)
|
|
20287
20384
|
return yield* result;
|
|
20288
20385
|
const currentRun = yield* repository.inspect(executionId);
|
|
20289
|
-
const now = yield* Clock17.currentTimeMillis;
|
|
20290
20386
|
if (currentRun?.status === "cancelled") {
|
|
20291
|
-
const events = yield* repository.listLifecycle(executionId);
|
|
20292
|
-
if (!events.some((event) => event.type === "workflow.cancelled"))
|
|
20293
|
-
yield* repository.appendLifecycle({ execution_id: executionId, type: "workflow.cancelled", created_at: now });
|
|
20294
20387
|
return yield* result;
|
|
20295
20388
|
}
|
|
20296
20389
|
const states = yield* repository.listOperations(executionId);
|
|
@@ -20306,45 +20399,35 @@ var run5 = Effect102.fn("WorkflowDefinitionRuntime.run")(function* (executionId)
|
|
|
20306
20399
|
created_at: yield* Clock17.currentTimeMillis
|
|
20307
20400
|
});
|
|
20308
20401
|
yield* execute(state.compensation_operation_id);
|
|
20309
|
-
const
|
|
20402
|
+
const completedAt = yield* Clock17.currentTimeMillis;
|
|
20310
20403
|
yield* repository.putOperation({
|
|
20311
20404
|
...state,
|
|
20312
20405
|
status: "compensated",
|
|
20313
|
-
completed_at:
|
|
20314
|
-
updated_at:
|
|
20406
|
+
completed_at: completedAt,
|
|
20407
|
+
updated_at: completedAt
|
|
20315
20408
|
});
|
|
20316
20409
|
yield* repository.appendLifecycle({
|
|
20317
20410
|
execution_id: executionId,
|
|
20318
20411
|
operation_id: state.operation_id,
|
|
20319
20412
|
type: "compensation.completed",
|
|
20320
|
-
created_at:
|
|
20413
|
+
created_at: completedAt
|
|
20321
20414
|
});
|
|
20322
20415
|
}
|
|
20323
20416
|
yield* repository.finish(executionId, "failed");
|
|
20324
|
-
yield* repository.appendLifecycle({
|
|
20325
|
-
execution_id: executionId,
|
|
20326
|
-
type: "workflow.failed",
|
|
20327
|
-
created_at: yield* Clock17.currentTimeMillis
|
|
20328
|
-
});
|
|
20329
20417
|
return yield* result;
|
|
20330
20418
|
}
|
|
20331
20419
|
const output = result.value;
|
|
20332
|
-
|
|
20333
|
-
yield* repository.finish(executionId, "completed");
|
|
20334
|
-
yield* repository.appendLifecycle({
|
|
20335
|
-
execution_id: executionId,
|
|
20336
|
-
type: "workflow.completed",
|
|
20337
|
-
...output === undefined ? {} : { data: output },
|
|
20338
|
-
created_at: completedAt
|
|
20339
|
-
});
|
|
20420
|
+
yield* repository.finish(executionId, "completed", output);
|
|
20340
20421
|
return output;
|
|
20341
20422
|
});
|
|
20342
|
-
var
|
|
20343
|
-
var
|
|
20423
|
+
var handlersLayer2 = (handlers) => Layer88.succeed(HandlerService2, handlers);
|
|
20424
|
+
var testHandlersLayer2 = handlersLayer2;
|
|
20425
|
+
var layerFromRuntime2 = Layer88.effect(Service68, Effect102.gen(function* () {
|
|
20344
20426
|
const repository = yield* exports_workflow_definition_repository.Service;
|
|
20345
20427
|
const handlers = yield* HandlerService2;
|
|
20428
|
+
const hosts = yield* FiberMap2.make();
|
|
20346
20429
|
const execute = (executionId) => run5(executionId).pipe(Effect102.provideService(HandlerService2, handlers), Effect102.provideService(exports_workflow_definition_repository.Service, repository));
|
|
20347
|
-
const launch = Effect102.fn("WorkflowDefinitionRuntime.launch")((executionId) => execute(executionId).pipe(Effect102.ignore,
|
|
20430
|
+
const launch = Effect102.fn("WorkflowDefinitionRuntime.launch")((executionId) => FiberMap2.run(hosts, executionId, execute(executionId).pipe(Effect102.ignore), { onlyIfMissing: true }).pipe(Effect102.asVoid));
|
|
20348
20431
|
const recover = Effect102.fn("WorkflowDefinitionRuntime.recover")(function* () {
|
|
20349
20432
|
const records = yield* repository.listNonterminal();
|
|
20350
20433
|
yield* Effect102.forEach(records, (record2) => launch(record2.execution_id), { discard: true });
|
|
@@ -20360,11 +20443,15 @@ var layer68 = Layer88.effect(Service68, Effect102.gen(function* () {
|
|
|
20360
20443
|
recover,
|
|
20361
20444
|
inspect: repository.inspect,
|
|
20362
20445
|
replay: repository.listLifecycle,
|
|
20363
|
-
cancel:
|
|
20446
|
+
cancel: Effect102.fn("WorkflowDefinitionRuntime.cancel")(function* (executionId) {
|
|
20447
|
+
const cancelled = yield* repository.cancel(executionId);
|
|
20448
|
+
return cancelled.record;
|
|
20449
|
+
})
|
|
20364
20450
|
});
|
|
20365
20451
|
yield* recover();
|
|
20366
20452
|
return service;
|
|
20367
20453
|
}));
|
|
20454
|
+
var layer68 = layerFromRuntime2;
|
|
20368
20455
|
|
|
20369
20456
|
// ../runtime/src/workflow/activity-version-registry.ts
|
|
20370
20457
|
var exports_activity_version_registry = {};
|
|
@@ -20680,4 +20767,4 @@ var recoverAll = Effect104.fn("ChildFanOutAdmissionService.recoverAll.call")(fun
|
|
|
20680
20767
|
const service = yield* Service69;
|
|
20681
20768
|
return yield* service.recoverAll(inputFor);
|
|
20682
20769
|
});
|
|
20683
|
-
export { __export, exports_ids_schema, exports_shared_schema, exports_address_schema, exports_tool_schema, exports_agent_schema, exports_content_schema, exports_execution_schema, exports_child_orchestration_schema, exports_envelope_schema, exports_inbox_schema, exports_entity_schema, exports_presence_schema, exports_schedule_schema, exports_skill_schema, exports_state_schema, exports_wait_schema, exports_workflow_schema, Dialect, dialect, fromDbTimestamp, fromNullableDbTimestamp, timestampParam, encodeJson, decodeJson, decodeBool, exports_child_execution_repository, exports_child_fan_out_repository, exports_cluster_registry_repository, exports_envelope_repository, exports_notification_bus, exports_execution_event_repository, exports_execution_repository, exports_inbox_repository, exports_schedule_repository, exports_session_repository, exports_skill_definition_repository, exports_steering_repository, exports_tool_call_repository, exports_workflow_definition_repository, exports_address_book_service, exports_event_log_service, exports_wait_service, exports_tool_runtime_service, exports_agent_registry_service, exports_address_resolution_service, exports_agent_event, exports_tool_context, exports_tool_executor, exports_approvals, exports_session, exports_tool_output, exports_compaction, exports_instructions, exports_memory, exports_model_middleware, exports_model_registry, exports_model_resilience, exports_permissions, exports_skill_source, exports_steering, exports_turn_policy, exports_agent, exports_agent_tool, exports_guardrail, exports_handoff, AiError3 as AiError, Chat2 as Chat, EmbeddingModel, IdGenerator, LanguageModel6 as LanguageModel, Model2 as Model, Prompt12 as Prompt, Response8 as Response, ResponseIdTracker, Telemetry2 as Telemetry, Tokenizer3 as Tokenizer, Tool8 as Tool, Toolkit7 as Toolkit, exports_child_run_service, exports_language_model_service, exports_model_call_policy, exports_presence_service, exports_presence_tool, exports_schema_registry_service, exports_blob_store_service, exports_execution_state_service, exports_skill_registry_service, exports_execution_service, exports_tool_transition_coordinator, exports_execution_workflow, exports_wait_signal, exports_topic_service, exports_envelope_service, exports_artifact_store_service, exports_prompt_assembler_service, exports_agent_loop_service, exports_child_fan_out_transition_service, exports_child_fan_out_runtime, exports_execution_entity, exports_entity_registry_service, exports_entity_instance_service, exports_execution_watch_service, exports_session_stream_service, exports_scheduler_service, exports_runner_runtime_service, exports_definition_runtime, exports_activity_version_registry };
|
|
20770
|
+
export { __export, exports_ids_schema, exports_shared_schema, exports_address_schema, exports_tool_schema, exports_agent_schema, exports_content_schema, exports_execution_schema, exports_child_orchestration_schema, exports_envelope_schema, exports_inbox_schema, exports_entity_schema, exports_presence_schema, exports_schedule_schema, exports_skill_schema, exports_state_schema, exports_wait_schema, exports_workflow_schema, Dialect, dialect, fromDbTimestamp, fromNullableDbTimestamp, timestampParam, encodeJson, decodeJson, decodeBool, exports_child_execution_repository, exports_child_fan_out_repository, exports_cluster_registry_repository, exports_envelope_repository, exports_notification_bus, exports_execution_event_repository, exports_execution_repository, exports_inbox_repository, exports_schedule_repository, exports_session_repository, exports_skill_definition_repository, exports_steering_repository, exports_tool_call_repository, exports_workflow_definition_repository, exports_address_book_service, exports_event_log_service, exports_wait_service, exports_tool_runtime_service, exports_agent_registry_service, exports_address_resolution_service, exports_agent_event, exports_tool_context, exports_tool_executor, exports_approvals, exports_session, exports_tool_output, exports_compaction, exports_instructions, exports_memory, exports_model_middleware, exports_model_registry, exports_model_resilience, exports_permissions, exports_skill_source, exports_steering, exports_turn_policy, exports_agent, exports_agent_tool, exports_guardrail, exports_handoff, AiError3 as AiError, Chat2 as Chat, EmbeddingModel, IdGenerator, LanguageModel6 as LanguageModel, Model2 as Model, Prompt12 as Prompt, Response8 as Response, ResponseIdTracker, Telemetry2 as Telemetry, Tokenizer3 as Tokenizer, Tool8 as Tool, Toolkit7 as Toolkit, exports_child_run_service, exports_embedding_model_service, exports_language_model_service, exports_model_call_policy, exports_presence_service, exports_presence_tool, exports_schema_registry_service, exports_blob_store_service, exports_execution_state_service, exports_skill_registry_service, exports_execution_service, exports_tool_transition_coordinator, exports_execution_workflow, exports_wait_signal, exports_topic_service, exports_envelope_service, exports_artifact_store_service, exports_prompt_assembler_service, exports_agent_loop_service, exports_child_fan_out_transition_service, exports_child_fan_out_runtime, exports_execution_entity, exports_entity_registry_service, exports_entity_instance_service, exports_execution_watch_service, exports_session_stream_service, exports_scheduler_service, exports_runner_runtime_service, exports_definition_runtime, exports_activity_version_registry };
|