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