@agimon-ai/po-workflow 0.0.0-alpha.85 → 0.0.0-alpha.86
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.
|
@@ -4083,7 +4083,6 @@ function createWorkflowServices() {
|
|
|
4083
4083
|
registerPolicy(session, coordinator, callback, options) {
|
|
4084
4084
|
if (disposed || !session || !coordinator) throw new Error("Workflow policy registration is unavailable.");
|
|
4085
4085
|
const key = JSON.stringify([session, coordinator]);
|
|
4086
|
-
if (policies.has(key)) throw new Error("Workflow policy coordinator is already registered for this session.");
|
|
4087
4086
|
const keys = new Set(options.environmentKeys);
|
|
4088
4087
|
for (const name of keys) if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || /^(PO_|WORKFLOW_)/.test(name)) throw new Error("Protected workflow policy environment key.");
|
|
4089
4088
|
const generation = (0, node_crypto.randomUUID)();
|
|
@@ -4130,7 +4129,7 @@ function createWorkflowServices() {
|
|
|
4130
4129
|
return policies.get(key)?.generation === policy.generation ? "delivered" : "unavailable";
|
|
4131
4130
|
},
|
|
4132
4131
|
registerOwner(session, owner) {
|
|
4133
|
-
if (disposed
|
|
4132
|
+
if (disposed) throw new Error("Workflow services are disposed.");
|
|
4134
4133
|
const generation = (0, node_crypto.randomUUID)();
|
|
4135
4134
|
owners.set(session, {
|
|
4136
4135
|
generation,
|
|
@@ -4212,6 +4211,7 @@ function createWorkflowServices() {
|
|
|
4212
4211
|
for (const entry of listeners) if (entry.runId === state.run.runId && read(entry.session, entry.runId) !== void 0) entry.listener(structuredClone(runs.get(state.run.runId).state));
|
|
4213
4212
|
},
|
|
4214
4213
|
withdraw(owner) {
|
|
4214
|
+
if (owners.has(owner)) return;
|
|
4215
4215
|
for (const [id, run] of runs) if (run.owner === owner) runs.delete(id);
|
|
4216
4216
|
for (const entry of listeners) if (entry.session === owner) listeners.delete(entry);
|
|
4217
4217
|
},
|
|
@@ -7480,11 +7480,24 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
7480
7480
|
...(savedLocations ?? []).map((location) => location.homeDir)
|
|
7481
7481
|
])].map((home) => featureFor(home).registry);
|
|
7482
7482
|
};
|
|
7483
|
+
const settlementDeliveries = /* @__PURE__ */ new Map();
|
|
7483
7484
|
settlement = require_RecoverWorkflowService.createWorkflowSettlement({
|
|
7484
7485
|
sessionId: host.context.sessionId,
|
|
7485
7486
|
signal: startupAbort.signal,
|
|
7486
7487
|
registries: admissionRegistries,
|
|
7487
|
-
settle: async (request) =>
|
|
7488
|
+
settle: async (request) => {
|
|
7489
|
+
const delivery = publicServices ? await publicServices.settle(request) : "unavailable";
|
|
7490
|
+
if (settlementDeliveries.get(request.run.runId) !== delivery) {
|
|
7491
|
+
settlementDeliveries.set(request.run.runId, delivery);
|
|
7492
|
+
telemetry.recordEvent("po_workflow.settlement_delivery", {
|
|
7493
|
+
name: request.binding.association.coordinator,
|
|
7494
|
+
outcome: request.outcome,
|
|
7495
|
+
status: delivery,
|
|
7496
|
+
attached: publicServices !== void 0
|
|
7497
|
+
});
|
|
7498
|
+
}
|
|
7499
|
+
return delivery;
|
|
7500
|
+
},
|
|
7488
7501
|
report: reportLifecycleFailure
|
|
7489
7502
|
});
|
|
7490
7503
|
const rehydrateRun = async (id) => {
|
|
@@ -7601,9 +7614,7 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
7601
7614
|
registries: admissionRegistries,
|
|
7602
7615
|
validate: validateAdmission,
|
|
7603
7616
|
registerPolicy(coordinator, callback, options) {
|
|
7604
|
-
|
|
7605
|
-
if (!publicServices) throw new Error("Workflow policy registration is unavailable.");
|
|
7606
|
-
if (policies.has(coordinator)) throw new Error("Workflow policy coordinator is already registered for this session.");
|
|
7617
|
+
if (disposed) throw new Error(RUNTIME_DISPOSED_MESSAGE);
|
|
7607
7618
|
const registration = {
|
|
7608
7619
|
callback,
|
|
7609
7620
|
options: {
|
|
@@ -7611,11 +7622,15 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
7611
7622
|
environmentKeys: [...options.environmentKeys]
|
|
7612
7623
|
}
|
|
7613
7624
|
};
|
|
7614
|
-
registration.binding = {
|
|
7625
|
+
if (publicServices) registration.binding = {
|
|
7615
7626
|
service: publicServices,
|
|
7616
7627
|
handle: publicServices.registerPolicy(host.context.sessionId, coordinator, callback, registration.options)
|
|
7617
7628
|
};
|
|
7618
7629
|
policies.set(coordinator, registration);
|
|
7630
|
+
telemetry.recordEvent("po_workflow.policy_registered", {
|
|
7631
|
+
name: coordinator,
|
|
7632
|
+
state: registration.binding ? "bound" : "waiting"
|
|
7633
|
+
});
|
|
7619
7634
|
queueMicrotask(deliverSettlements);
|
|
7620
7635
|
return { dispose() {
|
|
7621
7636
|
registration.binding?.handle.dispose();
|
|
@@ -7839,6 +7854,7 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
7839
7854
|
service,
|
|
7840
7855
|
handle: service.registerPolicy(host.context.sessionId, coordinator, registration.callback, registration.options)
|
|
7841
7856
|
};
|
|
7857
|
+
telemetry.recordEvent("po_workflow.policies_bound", { size: policies.size });
|
|
7842
7858
|
queueMicrotask(deliverSettlements);
|
|
7843
7859
|
} catch (error) {
|
|
7844
7860
|
detach();
|