@hasna/workflows 0.2.0 → 0.2.2

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.
@@ -3,7 +3,7 @@
3
3
  "name": "workflows",
4
4
  "class": "service",
5
5
  "contractVersion": "v1",
6
- "kitVersion": "1.3.3",
6
+ "kitVersion": "1.3.5",
7
7
  "description": "Hosted workflow CLI, MCP and HTTP SDK, with a PostgreSQL execution server and a preserved session journal.",
8
8
  "bins": [
9
9
  "workflows",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/workflows",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Universal graph workflow app — graph language (start/step/decision/while/end), three-table store, session WAL, daemon with claims/leases, four lane adapters (claude/codex/cursor/grok), and a full CLI on four surfaces",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -76,9 +76,9 @@
76
76
  "dependencies": {
77
77
  "@anthropic-ai/claude-agent-sdk": "0.3.234",
78
78
  "@cursor/sdk": "^1.0.28",
79
- "@openai/codex-sdk": "0.147.0",
79
+ "@hasna/contracts": "1.3.5",
80
+ "@openai/codex-sdk": "0.160.0",
80
81
  "commander": "^13.1.0",
81
- "@hasna/contracts": "1.3.3",
82
82
  "pg": "^8.16.3"
83
83
  },
84
84
  "devDependencies": {
package/types/graph.d.ts CHANGED
@@ -2,6 +2,8 @@ export declare const GRAPH_NODE_TYPES: readonly ["start", "step", "decision", "w
2
2
  export type GraphNodeType = (typeof GRAPH_NODE_TYPES)[number];
3
3
  export declare const LANE_KINDS: readonly ["claude", "codex", "cursor", "grok"];
4
4
  export type LaneKind = (typeof LANE_KINDS)[number];
5
+ export declare const CODEX_EXECUTION_MODES: readonly ["repository", "read-only"];
6
+ export type CodexExecutionMode = (typeof CODEX_EXECUTION_MODES)[number];
5
7
  export interface StartNode {
6
8
  id: string;
7
9
  type: "start";
@@ -16,6 +18,10 @@ export interface StepNode {
16
18
  prompt?: string;
17
19
  /** Shell command alternative to a lane prompt. */
18
20
  command?: string;
21
+ /** Working directory on the executor, shared by shell and model lanes. */
22
+ cwd?: string;
23
+ /** Codex prompts only. Read-only permits nonrepository work without writes or approvals. */
24
+ codexMode?: CodexExecutionMode;
19
25
  next?: string;
20
26
  /** Retries on lane failure. Default 0. */
21
27
  maxRetries?: number;
@@ -0,0 +1,4 @@
1
+ /** An optional deployment identity prevents an empty fallback directory from
2
+ * being mistaken for the restored journal. Provision the marker separately,
3
+ * after preservation and restore verification; the runtime never creates it. */
4
+ export declare function assertJournalDirectory(dataDir: string, identity: string): void;
@@ -1,9 +1,3 @@
1
- /**
2
- * codex lane adapter — @openai/codex-sdk.
3
- *
4
- * `new Codex({ config, env })` -> `thread.run(prompt)` -> `Turn` whose
5
- * `finalResponse` is the completed agent output. CLI fallback: `codex exec`.
6
- */
7
1
  import { type LaneAdapter } from "./types.js";
8
2
  export interface CodexAdapterDeps {
9
3
  sdkLoader?: () => Promise<unknown>;
@@ -1,3 +1,4 @@
1
+ import type { CodexExecutionMode } from "../graph.js";
1
2
  export declare const LANE_KINDS: readonly ["claude", "codex", "cursor", "grok"];
2
3
  export type LaneKind = (typeof LANE_KINDS)[number];
3
4
  export interface LaneJob {
@@ -7,6 +8,8 @@ export interface LaneJob {
7
8
  /** Shell command alternative (handled by the daemon's built-in executor). */
8
9
  command?: string;
9
10
  cwd?: string;
11
+ /** Repository checks remain native defaults unless read-only is explicitly selected. */
12
+ codexMode?: CodexExecutionMode;
10
13
  /** Environment for the lane process — never credentials from the vault. */
11
14
  env?: Record<string, string>;
12
15
  /** Per-invocation budget in ms. Default 120000. */
@@ -70,4 +73,5 @@ export declare function spawnCli(cmd: string[], opts: {
70
73
  timeoutMs?: number;
71
74
  binaryName: string;
72
75
  packageHint: string;
76
+ stdoutOnly?: boolean;
73
77
  }): Promise<LaneResult>;
@@ -36,6 +36,8 @@ export interface StepNode {
36
36
  "lane"?: "claude" | "codex" | "cursor" | "grok";
37
37
  "prompt"?: string;
38
38
  "command"?: string;
39
+ "cwd"?: string;
40
+ "codexMode"?: "repository" | "read-only";
39
41
  "maxRetries"?: number;
40
42
  "memo"?: boolean;
41
43
  "timeoutMs"?: number;
@@ -0,0 +1,7 @@
1
+ /** A process-lifetime filesystem mutex, separate from the short journal mutex.
2
+ * There are no tables or application records in this file. Closing the process
3
+ * releases its OS lock; the file is never deleted to steal another process's
4
+ * lease. All server processes must bind the same verified local filesystem. */
5
+ export declare function acquireJournalServerLease(dataDir: string, identity: string): {
6
+ close(): void;
7
+ };
@@ -1,20 +1,28 @@
1
1
  import { type RunToCompletionOptions } from "./daemon.js";
2
2
  import { openStore } from "./store.js";
3
- import type { WorkflowGraph } from "./graph.js";
3
+ import { type LaneKind, type WorkflowGraph } from "./graph.js";
4
+ import { type LaneProbe } from "./lanes/index.js";
4
5
  import type { HealthReport, ReadinessReport, WorkflowsConfig } from "./types.js";
5
6
  export { packageVersion } from "./version.js";
7
+ type ResolvedWorkflowsConfig = WorkflowsConfig & {
8
+ enabledLanes: readonly LaneKind[];
9
+ };
6
10
  /** Resolve the service configuration from env + explicit overrides. */
7
- export declare function resolveWorkflowsConfig(overrides?: Partial<WorkflowsConfig>): WorkflowsConfig;
11
+ export declare function resolveWorkflowsConfig(overrides?: Partial<WorkflowsConfig>): ResolvedWorkflowsConfig;
8
12
  export declare class WorkflowsService {
9
13
  private readonly execution;
10
14
  readonly name = "workflows";
11
15
  readonly version: string;
12
- readonly config: WorkflowsConfig;
16
+ readonly config: ResolvedWorkflowsConfig;
13
17
  private readonly startedAt;
14
18
  private readonly databaseEnv;
15
19
  constructor(config?: Partial<WorkflowsConfig>, execution?: RunToCompletionOptions);
16
20
  health(): HealthReport;
17
21
  ready(): Promise<ReadinessReport>;
22
+ private verifyJournalDirectory;
23
+ private assertEnabledGraphLanes;
24
+ probeLane(kind: LaneKind): Promise<LaneProbe>;
25
+ laneInventory(): Promise<LaneProbe[]>;
18
26
  private openEngineStore;
19
27
  private withStore;
20
28
  /** Explicit operator bootstrap; ordinary reads and server startup never create tables. */
@@ -26,7 +34,7 @@ export declare class WorkflowsService {
26
34
  cancelRun(id: string): Promise<import("./store.js").RunRow | undefined>;
27
35
  resumeRun(id: string): Promise<{
28
36
  runId: string;
29
- status: "cancelled" | "pending" | "running" | "completed" | "failed" | "interrupted";
37
+ status: "pending" | "running" | "completed" | "failed" | "cancelled" | "interrupted";
30
38
  error: string | null;
31
39
  result: any;
32
40
  reused: boolean;
package/types/types.d.ts CHANGED
@@ -20,12 +20,16 @@ export interface WorkflowsConfig {
20
20
  apiUrl?: string;
21
21
  /** Optional client API key (WORKFLOWS_API_KEY) — resolved, never printed. */
22
22
  apiKey?: string;
23
+ /** Optional restored-data marker checked before any server storage access. */
24
+ dataIdentity?: string;
23
25
  /** Gateway origin identity. When configured, every /v1 route requires it. */
24
26
  originAuth?: string;
25
27
  /** Hosted server authority. SQLite requires an explicit embedded selection. */
26
28
  storageBackend: "postgresql" | "sqlite";
27
29
  databaseUrl?: string;
28
30
  databaseSchema?: string;
31
+ /** Model lanes admitted by this server. An empty list permits command steps only. */
32
+ enabledLanes?: readonly import("./graph.js").LaneKind[];
29
33
  }
30
34
  export interface HealthReport {
31
35
  ok: boolean;