@agimon-ai/po-workflow 0.0.0-alpha.100 → 0.0.0-alpha.102

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.
@@ -1,9 +1,9 @@
1
1
  import { i as substituteShellPlaceholder, n as workflowCommandTemplateVariables, r as escapeShellArg, t as renderWorkflowCommandTemplate } from "./workflowCommandTemplate-r57z3b46.mjs";
2
2
  import { createRequire } from "node:module";
3
- import { BACKGROUND_CONTEXT, createSerialRunner, getOrThrow, nodeHost, pathExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
4
3
  import path, { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
5
- import { createHash, randomUUID } from "node:crypto";
4
+ import { BACKGROUND_CONTEXT, createSerialRunner, getOrThrow, nodeHost, pathExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
6
5
  import { z } from "zod";
6
+ import { createHash, randomUUID } from "node:crypto";
7
7
  import { dump, load } from "js-yaml";
8
8
  import { BACKGROUND_RUNNER_DEADLINE_MS, BACKGROUND_WORK_HOLDING_PROVIDERS, holdsSettledSession, holdsSettledSessionAfterRunnerDeadline } from "@agimon-ai/po-core/backgroundWork";
9
9
  import { WORKFLOW_STEP_SESSION_PROVENANCE } from "@agimon-ai/po-core/hubChannel";
@@ -16,36 +16,6 @@ import { lock } from "proper-lockfile";
16
16
  import { performance } from "node:perf_hooks";
17
17
  import { constants as constants$1 } from "node:os";
18
18
  import { createConnection, createServer } from "node:net";
19
- //#region src/models/InvalidWorkflowRunRecordError.ts
20
- /**
21
- * Structured error raised when a persisted workflow run record is malformed.
22
- */
23
- var InvalidWorkflowRunRecordError = class extends Error {
24
- recordPath;
25
- code = "INVALID_WORKFLOW_RUN_RECORD";
26
- constructor(recordPath, reason, options) {
27
- super(`Invalid workflow run record at "${recordPath}": ${reason}`, options);
28
- this.recordPath = recordPath;
29
- this.name = "InvalidWorkflowRunRecordError";
30
- }
31
- };
32
- //#endregion
33
- //#region src/models/WorkflowRunConflictError.ts
34
- /**
35
- * Structured error raised when a workflow display name is already active in a workspace.
36
- */
37
- var WorkflowRunConflictError = class extends Error {
38
- workspace;
39
- runKey;
40
- code = "WORKFLOW_RUN_CONFLICT";
41
- constructor(workspace, runKey) {
42
- super(`Workflow "${runKey}" is already running in workspace "${workspace}"`);
43
- this.workspace = workspace;
44
- this.runKey = runKey;
45
- this.name = "WorkflowRunConflictError";
46
- }
47
- };
48
- //#endregion
49
19
  //#region src/schemas/workflowEngine.ts
50
20
  /**
51
21
  * Zod Schemas for Workflow YAML Validation
@@ -996,6 +966,36 @@ function summarizeWorkflowProgress(events) {
996
966
  return [...jobs.values()];
997
967
  }
998
968
  //#endregion
969
+ //#region src/models/InvalidWorkflowRunRecordError.ts
970
+ /**
971
+ * Structured error raised when a persisted workflow run record is malformed.
972
+ */
973
+ var InvalidWorkflowRunRecordError = class extends Error {
974
+ recordPath;
975
+ code = "INVALID_WORKFLOW_RUN_RECORD";
976
+ constructor(recordPath, reason, options) {
977
+ super(`Invalid workflow run record at "${recordPath}": ${reason}`, options);
978
+ this.recordPath = recordPath;
979
+ this.name = "InvalidWorkflowRunRecordError";
980
+ }
981
+ };
982
+ //#endregion
983
+ //#region src/models/WorkflowRunConflictError.ts
984
+ /**
985
+ * Structured error raised when a workflow display name is already active in a workspace.
986
+ */
987
+ var WorkflowRunConflictError = class extends Error {
988
+ workspace;
989
+ runKey;
990
+ code = "WORKFLOW_RUN_CONFLICT";
991
+ constructor(workspace, runKey) {
992
+ super(`Workflow "${runKey}" is already running in workspace "${workspace}"`);
993
+ this.workspace = workspace;
994
+ this.runKey = runKey;
995
+ this.name = "WorkflowRunConflictError";
996
+ }
997
+ };
998
+ //#endregion
999
999
  //#region src/services/workflowSettlement/index.ts
1000
1000
  /** What a terminal bound generation is owed and not yet acknowledged, or undefined when nothing is. */
1001
1001
  function owedSettlement(record) {
@@ -6302,11 +6302,11 @@ var StepRunnerService = class StepRunnerService {
6302
6302
  if (settled) return;
6303
6303
  settled = true;
6304
6304
  if (stopWatcher) {
6305
- await stopWatcher.close(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6305
+ await stopWatcher.stop(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6306
6306
  stopWatcher = null;
6307
6307
  }
6308
6308
  if (pauseWatcher) {
6309
- await pauseWatcher.close(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6309
+ await pauseWatcher.stop(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6310
6310
  pauseWatcher = null;
6311
6311
  }
6312
6312
  if (stopPollTimer) {
@@ -6402,7 +6402,7 @@ var StepRunnerService = class StepRunnerService {
6402
6402
  checkStopRequest().catch((error) => this.logger.warn(`Workflow control check failed: ${String(error)}`));
6403
6403
  }, this.runtime.ioContext).then(async (result) => {
6404
6404
  const admitted = getOrThrow(result);
6405
- if (settled) await admitted.close(this.runtime.ioContext);
6405
+ if (settled) await admitted.stop(this.runtime.ioContext);
6406
6406
  else stopWatcher = admitted;
6407
6407
  }).catch((error) => this.logger.warn(`Workflow stop-request watcher unavailable, polling instead: ${String(error)}`));
6408
6408
  } catch (error) {
@@ -6418,7 +6418,7 @@ var StepRunnerService = class StepRunnerService {
6418
6418
  checkPauseRequest().catch((error) => this.logger.warn(`Workflow control check failed: ${String(error)}`));
6419
6419
  }, this.runtime.ioContext).then(async (result) => {
6420
6420
  const admitted = getOrThrow(result);
6421
- if (settled) await admitted.close(this.runtime.ioContext);
6421
+ if (settled) await admitted.stop(this.runtime.ioContext);
6422
6422
  else pauseWatcher = admitted;
6423
6423
  }).catch((error) => this.logger.warn(`Workflow pause-request watcher unavailable, polling instead: ${String(error)}`));
6424
6424
  } catch (error) {
@@ -6455,7 +6455,7 @@ var StepRunnerService = class StepRunnerService {
6455
6455
  if (settled) return;
6456
6456
  settled = true;
6457
6457
  if (watcher) {
6458
- await watcher.close(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6458
+ await watcher.stop(this.runtime.ioContext).catch((error) => this.logger.warn(`Workflow watcher cleanup failed: ${String(error)}`));
6459
6459
  watcher = null;
6460
6460
  }
6461
6461
  if (pollTimer) {
@@ -6491,7 +6491,7 @@ var StepRunnerService = class StepRunnerService {
6491
6491
  checkStopRequest().catch((error) => this.logger.warn(`Workflow control check failed: ${String(error)}`));
6492
6492
  }, this.runtime.ioContext).then(async (result) => {
6493
6493
  const admitted = getOrThrow(result);
6494
- if (settled) await admitted.close(this.runtime.ioContext);
6494
+ if (settled) await admitted.stop(this.runtime.ioContext);
6495
6495
  else watcher = admitted;
6496
6496
  }).catch((error) => this.logger.warn(`Workflow stop-request watcher unavailable, polling instead: ${String(error)}`));
6497
6497
  } catch (error) {
@@ -6936,7 +6936,8 @@ function createWorkflowChildren(options) {
6936
6936
  if (typeof value !== (field.type ?? "string") || field.options && !field.options.includes(value)) throw new Error(`Invalid child input: ${name}`);
6937
6937
  values[name] = value;
6938
6938
  }
6939
- const paths = Object.entries(criteria).filter(([, criterion]) => criterion["verified-by"] === request.job).flatMap(([, criterion]) => artifactPaths(context, criterion));
6939
+ const owned = Object.entries(criteria).filter(([, criterion]) => criterion["verified-by"] === request.job);
6940
+ const paths = owned.flatMap(([, criterion]) => artifactPaths(context, criterion));
6940
6941
  const reviewed = await snapshot(context, paths);
6941
6942
  const invocation = ChildInvocationSchema.parse({
6942
6943
  invocationId: randomUUID(),
@@ -6999,6 +7000,9 @@ function createWorkflowChildren(options) {
6999
7000
  else if (!result.success) {
7000
7001
  invocation.state = "failed";
7001
7002
  invocation.error = (result.error ?? "Child execution failed.").slice(0, MAX_ERROR_LENGTH);
7003
+ } else if (owned.length > 0 && Object.keys(staged).length === 0) {
7004
+ invocation.state = "failed";
7005
+ invocation.error = "Child completed without reporting its criteria. Its session may lack workflow tools.";
7002
7006
  } else {
7003
7007
  invocation.state = "completed";
7004
7008
  if (await unchanged(context, reviewed.manifest)) for (const [name, verdict] of Object.entries(staged)) {
@@ -13206,6 +13210,6 @@ var RecoverWorkflowService = class {
13206
13210
  }
13207
13211
  };
13208
13212
  //#endregion
13209
- export { WORKFLOW_RUNS_TYPE as A, createWorkflowSettlement as B, WORKFLOW_DECISION_STEERING_HOST as C, STEP_PANE_REF_KIND as D, RunDirectoryService as E, summarizeWorkflow as F, WorkflowRepairableFileSchema as G, readWorkflowProgressFrom as H, listWorkflows as I, WorkflowStageSchema as K, PO_RUN_CONFIG_KEYS as L, createWorkflowRuntime as M, workflowShellOutput as N, STEP_SESSION_REF_KIND as O, readWorkflowCatalog as P, poTemplateRunConfigSchema as R, WORKFLOW_DECISION_STEERING_ENV as S, recordStepDecision as T, summarizeWorkflowProgress as U, readWorkflowProgress as V, workflowRunPhase as W, connectNativeTerminal$1 as _, readWorkflowPackageVersion as a, NativeTerminalService$1 as b, diagnoseWorkflows as c, sessionSelection as d, stepPaneLogPath as f, secretRedactor as g, ChildJournalSchema as h, createWorkflowHost as i, WorkflowParserService as j, WORKFLOW_CATALOG_TYPE as k, createNativeStepPaneLauncher as l, requireWorkflowCapability as m, RunWorkflowService as n, resolveWorkflowCliPath as o, runWorkflowScript as p, WorkflowToolsPathSchema as q, createEmbeddedRunWorkflowService as r, diagnoseWorkflow as s, RecoverWorkflowService as t, createStepExecutor as u, serveNativeTerminal$1 as v, gateStepDecision as w, WORKFLOW_DECISION_FILE_ENV as x, terminalSocketPath as y, WorkflowRegistryService as z };
13213
+ export { WORKFLOW_RUNS_TYPE as A, createWorkflowSettlement as B, WORKFLOW_DECISION_STEERING_HOST as C, STEP_PANE_REF_KIND as D, RunDirectoryService as E, summarizeWorkflow as F, workflowRunPhase as G, readWorkflowProgress as H, listWorkflows as I, WorkflowToolsPathSchema as J, WorkflowRepairableFileSchema as K, PO_RUN_CONFIG_KEYS as L, createWorkflowRuntime as M, workflowShellOutput as N, STEP_SESSION_REF_KIND as O, readWorkflowCatalog as P, poTemplateRunConfigSchema as R, WORKFLOW_DECISION_STEERING_ENV as S, recordStepDecision as T, readWorkflowProgressFrom as U, PROGRESS_FILENAME as V, summarizeWorkflowProgress as W, connectNativeTerminal$1 as _, readWorkflowPackageVersion as a, NativeTerminalService$1 as b, diagnoseWorkflows as c, sessionSelection as d, stepPaneLogPath as f, secretRedactor as g, ChildJournalSchema as h, createWorkflowHost as i, WorkflowParserService as j, WORKFLOW_CATALOG_TYPE as k, createNativeStepPaneLauncher as l, requireWorkflowCapability as m, RunWorkflowService as n, resolveWorkflowCliPath as o, runWorkflowScript as p, WorkflowStageSchema as q, createEmbeddedRunWorkflowService as r, diagnoseWorkflow as s, RecoverWorkflowService as t, createStepExecutor as u, serveNativeTerminal$1 as v, gateStepDecision as w, WORKFLOW_DECISION_FILE_ENV as x, terminalSocketPath as y, WorkflowRegistryService as z };
13210
13214
 
13211
- //# sourceMappingURL=RecoverWorkflowService-VSaDiC-G.mjs.map
13215
+ //# sourceMappingURL=RecoverWorkflowService-Cb-AaNIf.mjs.map