@agimon-ai/po-workflow 0.0.0-alpha.209 → 0.0.0-alpha.210
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/extensions/server.cjs +20 -10
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +20 -10
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/{index-CJkSvOZ-.d.mts → index-CxS__mkJ.d.mts} +9 -3
- package/dist/index-CxS__mkJ.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/dist/workflowHost.d.mts +1 -1
- package/locales/vi.json +492 -0
- package/locales/zh-CN.json +492 -0
- package/package.json +15 -12
- package/dist/index-CJkSvOZ-.d.mts.map +0 -1
|
@@ -1127,8 +1127,8 @@ var WorkflowProgressService = class {
|
|
|
1127
1127
|
/**
|
|
1128
1128
|
* Record one transition.
|
|
1129
1129
|
*
|
|
1130
|
-
*
|
|
1131
|
-
* turn a passing workflow into a failing one.
|
|
1130
|
+
* Reports write failures instead of throwing: a busy or unavailable database
|
|
1131
|
+
* should not turn a passing workflow into a failing one.
|
|
1132
1132
|
*/
|
|
1133
1133
|
async record(event) {
|
|
1134
1134
|
if (!this.sink) return;
|
|
@@ -1141,7 +1141,10 @@ var WorkflowProgressService = class {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
});
|
|
1143
1143
|
this.sink.onRecorded?.();
|
|
1144
|
-
} catch {
|
|
1144
|
+
} catch (error) {
|
|
1145
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1146
|
+
this.sink.reportFailure(`Workflow run ${this.sink.runId} progress record failed: ${message}\n`);
|
|
1147
|
+
}
|
|
1145
1148
|
}
|
|
1146
1149
|
jobStarted(job, index, total) {
|
|
1147
1150
|
return this.record({
|
|
@@ -1212,9 +1215,8 @@ function progressEvents(events) {
|
|
|
1212
1215
|
}
|
|
1213
1216
|
/** The generations whose progress a run shows: its lineage up to and including itself. */
|
|
1214
1217
|
async function progressGenerations(store, runId) {
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
-
return (await store.listLineage(run.lineageId)).filter((candidate) => candidate.generation <= run.generation).map((candidate) => candidate.runId);
|
|
1218
|
+
const lineage = await store.listLineageRunIds(runId);
|
|
1219
|
+
return lineage.length ? lineage : [runId];
|
|
1218
1220
|
}
|
|
1219
1221
|
/**
|
|
1220
1222
|
* Read only what a run has recorded since `cursor`.
|
|
@@ -2197,10 +2199,10 @@ var WorkflowRegistryService = class {
|
|
|
2197
2199
|
const timer = setInterval(() => {
|
|
2198
2200
|
if (polling) return;
|
|
2199
2201
|
polling = true;
|
|
2200
|
-
store.
|
|
2202
|
+
store.readRunRevision(runId).then((current) => {
|
|
2201
2203
|
lastFailure = void 0;
|
|
2202
|
-
if (
|
|
2203
|
-
revision =
|
|
2204
|
+
if (current !== void 0 && revision !== void 0 && current !== revision) listener();
|
|
2205
|
+
revision = current;
|
|
2204
2206
|
}).catch((error) => {
|
|
2205
2207
|
const message = error instanceof Error ? error.message : String(error);
|
|
2206
2208
|
if (message !== lastFailure) this.runtime.workflowHost.writeStderr(`Workflow run ${runId} poll failed: ${message}\n`);
|
|
@@ -3067,7 +3069,8 @@ var WorkflowRegistryService = class {
|
|
|
3067
3069
|
return new WorkflowProgressService(runId ? {
|
|
3068
3070
|
store: this.store,
|
|
3069
3071
|
runId,
|
|
3070
|
-
onRecorded: () => this.notify(runId)
|
|
3072
|
+
onRecorded: () => this.notify(runId),
|
|
3073
|
+
reportFailure: (message) => this.runtime.workflowHost.writeStderr(message)
|
|
3071
3074
|
} : void 0);
|
|
3072
3075
|
}
|
|
3073
3076
|
/** A run's progress, its earlier generations first. A record without a run ID has none. */
|
|
@@ -14188,6 +14191,9 @@ var PoDbWorkflowStoreService = class PoDbWorkflowStoreService {
|
|
|
14188
14191
|
const row = await this.db.database.get("SELECT * FROM workflow_runs WHERE run_id = ?", runId);
|
|
14189
14192
|
return row ? runFrom(row) : void 0;
|
|
14190
14193
|
}
|
|
14194
|
+
async readRunRevision(runId) {
|
|
14195
|
+
return (await this.db.database.get("SELECT revision FROM workflow_runs WHERE run_id = ?", runId))?.revision;
|
|
14196
|
+
}
|
|
14191
14197
|
async listRuns(input) {
|
|
14192
14198
|
return (await this.db.database.all(`SELECT * FROM workflow_runs WHERE authority_id = ? AND (? IS NULL OR workspace_id = ?)
|
|
14193
14199
|
AND (? IS NULL OR lifecycle = ?) AND (? = 1 OR tombstoned_at IS NULL)
|
|
@@ -14201,6 +14207,10 @@ var PoDbWorkflowStoreService = class PoDbWorkflowStoreService {
|
|
|
14201
14207
|
async listLineage(lineageId) {
|
|
14202
14208
|
return (await this.db.database.all("SELECT * FROM workflow_runs WHERE lineage_id = ? ORDER BY generation ASC", lineageId)).map(runFrom);
|
|
14203
14209
|
}
|
|
14210
|
+
async listLineageRunIds(runId) {
|
|
14211
|
+
return (await this.db.database.all(`SELECT l.run_id FROM workflow_runs l JOIN workflow_runs r ON r.lineage_id = l.lineage_id
|
|
14212
|
+
WHERE r.run_id = ? AND l.generation <= r.generation ORDER BY l.generation ASC`, runId)).map((row) => row.run_id);
|
|
14213
|
+
}
|
|
14204
14214
|
async listWorkspaces(authorityId) {
|
|
14205
14215
|
return (await this.db.database.all("SELECT DISTINCT workspace_id FROM workflow_runs WHERE authority_id = ? ORDER BY workspace_id", authorityId)).map((row) => row.workspace_id);
|
|
14206
14216
|
}
|