feat: expose executor job observability

This commit is contained in:
john
2026-07-24 23:31:29 +08:00
parent bbb43f97a3
commit 396bb78200
18 changed files with 733 additions and 68 deletions
+11 -1
View File
@@ -105,7 +105,7 @@ export function createRemoteWorkflowEngine({
id: normalizedId,
label,
kind: 'remote',
capabilities: ['durable-execution', 'interrupt', 'streaming'],
capabilities: ['durable-execution', 'interrupt', 'streaming', 'executor-observability'],
async start(spec) {
return request('/v1/runs', { method: 'POST', body: JSON.stringify(spec) });
},
@@ -129,5 +129,15 @@ export function createRemoteWorkflowEngine({
const result = await request(`/v1/runs/${encodeURIComponent(runId)}/events${query}`);
for (const event of Array.isArray(result?.events) ? result.events : []) yield event;
},
async getExecutorJob(jobId) {
return request(`/v1/executor-jobs/${encodeURIComponent(jobId)}`);
},
async *streamExecutorJobEvents(jobId, cursor = null) {
const query = cursor == null ? '' : `?after=${encodeURIComponent(cursor)}`;
const result = await request(
`/v1/executor-jobs/${encodeURIComponent(jobId)}/events${query}`,
);
for (const event of Array.isArray(result?.events) ? result.events : []) yield event;
},
};
}