@mingchuno/agent-workflows 0.3.0 → 0.5.0

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.
Files changed (39) hide show
  1. package/README.md +25 -14
  2. package/dist/src/adapters/agents.js +9 -0
  3. package/dist/src/cli-config.d.ts +2 -0
  4. package/dist/src/cli-config.js +35 -0
  5. package/dist/src/cli.js +22 -24
  6. package/dist/src/config.d.ts +10 -0
  7. package/dist/src/config.js +9 -11
  8. package/dist/src/domain.d.ts +6 -0
  9. package/dist/src/invocation.d.ts +2 -4
  10. package/dist/src/invocation.js +204 -107
  11. package/dist/src/operations.d.ts +1 -2
  12. package/dist/src/operations.js +18 -33
  13. package/dist/src/recovery.d.ts +20 -2
  14. package/dist/src/recovery.js +49 -1
  15. package/dist/src/runner.d.ts +6 -2
  16. package/dist/src/runner.js +81 -83
  17. package/dist/src/runtime/process.d.ts +1 -0
  18. package/dist/src/runtime/process.js +6 -2
  19. package/dist/src/store.d.ts +4 -2
  20. package/dist/src/store.js +69 -51
  21. package/dist/src/tui/data.d.ts +1 -1
  22. package/dist/src/tui/dialogs.js +1 -0
  23. package/dist/src/tui/monitor-navigation.d.ts +76 -0
  24. package/dist/src/tui/monitor-navigation.js +187 -0
  25. package/dist/src/tui/monitor.js +70 -183
  26. package/dist/src/tui/projection.d.ts +22 -0
  27. package/dist/src/tui/projection.js +49 -0
  28. package/dist/src/validation-selection.d.ts +6 -0
  29. package/dist/src/validation-selection.js +29 -0
  30. package/dist/src/workspace.js +3 -2
  31. package/docs/api.md +11 -7
  32. package/docs/configuration.md +61 -18
  33. package/docs/database.md +2 -18
  34. package/docs/operations.md +21 -28
  35. package/docs/providers.md +2 -2
  36. package/package.json +1 -1
  37. package/dist/src/tui/actions.d.ts +0 -16
  38. package/dist/src/tui/actions.js +0 -23
  39. package/docs/architecture.md +0 -41
package/docs/api.md CHANGED
@@ -12,7 +12,7 @@ Omitting it preserves current-working-directory behavior for SDK callers.
12
12
  `promptBaseDirectory` retains its narrower role and, when both are supplied,
13
13
  overrides only relative prompt files.
14
14
 
15
- `start()` validates registration, acquires ownership, launches DBOS, registers concurrency-one project queues, and starts polling. `poll(projectId?)` performs an immediate scan. `pause(projectId)` stops new starts while active work continues. `resume(projectId)` refuses blocked checkouts. `stop(runId)` waits for the active invocation/process to end, or cancels queued work. `retry(runId)` requires a terminal failed/blocked/cancelled run and a clean checkout, then returns a new linked run ID. `recover(runId)` returns a new execution ID for publication recovery of the same run. `shutdown()` stops intake, cancels and awaits active work, closes DBOS and releases ownership.
15
+ `start()` validates registration, acquires ownership, launches DBOS, registers concurrency-one project queues, and starts polling. `poll(projectId?)` performs an immediate scan. `pause(projectId)` stops new starts while active work continues. `resume(projectId)` refuses blocked checkouts. `stop(runId)` waits for the active invocation/process to end, or cancels queued work. `retry(runId)` requires a terminal failed/blocked/cancelled run and a clean checkout, then returns a new linked run ID using its saved issue. `retry(runId, commandId, { refreshIssue: true })` fetches and validates the current hosted issue once during admission, saving it on the new run. `recover(runId)` returns a new execution ID for publication recovery of the same run. `shutdown()` stops intake, cancels and awaits active work, closes DBOS and releases ownership.
16
16
 
17
17
  Use `try/finally` to call `shutdown()`, including failed startup. A custom `workflowVersion` must change when its durable step order changes; finish existing work before replacing an incompatible version.
18
18
 
@@ -23,7 +23,9 @@ the next attempt; another request for the same task fails while that retry is
23
23
  queued or running. Replaying the same command ID returns its existing retry,
24
24
  without rechecking the checkout or emitting events. A command ID cannot identify
25
25
  retries of different runs. Retry creation, project unblocking and their events
26
- commit together; failure preserves the blocked state.
26
+ commit together; failure preserves the blocked state. The rationale for separate
27
+ run and execution identities is in
28
+ [ADR 0003](adr/0003-run-and-execution-identity.md).
27
29
 
28
30
  ## Durable operations
29
31
 
@@ -156,7 +158,8 @@ Caveats:
156
158
  `Store.admitRetry` owns persisted retry admission. Runner supplies its checkout
157
159
  and process safety check, which runs under the project lock for new admissions
158
160
  only. This callback must not mutate Store records. Operator tools should use
159
- `retry` commands or `Runner.retry`, preserving those safety checks.
161
+ `retry` commands or `Runner.retry`, preserving those safety checks. The locking
162
+ boundary is recorded in [ADR 0005](adr/0005-postgresql-persistence-boundary.md).
160
163
 
161
164
  Invocation records include project/run IDs, stable DBOS step ID and name, invocation ID, attempt, timestamps, requested/effective profile, provider, effective task prompt/source/hash, output-contract and evidence identities, artifact path and session state (`pending`, `available`, `unavailable`). Repeated custom steps retain separate invocations. A retry has a separate run record linked to its predecessor.
162
165
 
@@ -182,7 +185,8 @@ markers. `Store.recoveryPlan(runId)` reports persisted eligibility and its reaso
182
185
  live safety checks happen at admission and execution. Runs without execution
183
186
  metadata remain readable and retryable, but cannot be recovered.
184
187
 
185
- Recovery uses DBOS forks, retaining the original workflow input and checkpoint
186
- prefix. The accepted command ID is the fork ID: dispatch adopts an existing fork
187
- after an uncertain response or crash. Copied start gates do not replace live
188
- checks in the first non-replayed operation. Successful prefixes cannot rerun.
188
+ Recovery preserves the original workflow input and completed checkpoint prefix.
189
+ The accepted command ID identifies the new execution so uncertain dispatch can
190
+ be reconciled after a crash. Live checks still run in the first non-replayed
191
+ operation. See [ADR 0003](adr/0003-run-and-execution-identity.md) for the complete
192
+ identity and recovery decision.
@@ -15,6 +15,9 @@ and is canonicalized before startup.
15
15
  | `stateDirectory` | `.agent-workflows`; relative to the configuration base and outside every managed checkout |
16
16
  | `projects` | Nonempty array; duplicate IDs or canonical checkout roots are rejected |
17
17
 
18
+ The JSON file also accepts optional CLI-only `envFile`; it is intentionally not
19
+ part of the public SDK `Configuration` type.
20
+
18
21
  | Project field | Default / meaning |
19
22
  | ---------------------- | --------------------------------------------------------------------------------------------------- |
20
23
  | `id`, `checkout` | Required stable identity and existing Git repository root; relative to the configuration base |
@@ -25,11 +28,44 @@ and is canonicalized before startup.
25
28
  | `pollIntervalMs` | 30000; minimum 100 |
26
29
  | `includeAgentCoAuthors` | `true`; append co-author trailers for providers whose writable invocations produced retained changes |
27
30
  | `validation` | Array of `{command,args,timeoutMs}`; no shell expansion; timeout defaults to 300000 ms |
31
+ | `validationProfiles` | Named, nonempty arrays of validation commands selectable by a ticket; defaults to `{}` |
28
32
  | `agent` | Required default profile |
29
33
  | `stages` | `implementation`, `publication`, `review`; each has optional `profile`, `prompt`, `promptFile`, `timeoutMs` |
30
34
 
31
35
  Issues are selected in ascending issue-number order within each intake scan. Deduplication persists across restarts. An explicit retry is a new numbered attempt linked through `retryOf`.
32
36
 
37
+ ## Ticket-selected validation
38
+
39
+ Define optional checks under a project in `validationProfiles` using the same
40
+ command format as `validation`:
41
+
42
+ ```json
43
+ {
44
+ "validation": [{ "command": "pnpm", "args": ["lint"] }],
45
+ "validationProfiles": {
46
+ "migration": [{ "command": "pnpm", "args": ["test:migrations"] }]
47
+ }
48
+ }
49
+ ```
50
+
51
+ An issue description selects one profile with a standalone fenced block:
52
+
53
+ ````markdown
54
+ ```agent-workflows-validation
55
+ migration
56
+ ```
57
+ ````
58
+
59
+ The runner executes the project's `validation` commands first, then the selected
60
+ profile's commands. Without the block, only the baseline runs. The block must
61
+ contain exactly one configured profile name (`A-Z`, `a-z`, digits, `_`, or `-`);
62
+ duplicate, malformed, and unknown selections fail the run before checkout
63
+ preparation or agent invocation. The issue body is saved with the run, so edits
64
+ to the hosted issue do not change an existing run. A plain retry creates a new
65
+ run from its recorded issue. Use `retry RUN --refresh-issue` (or `R` in the
66
+ monitor) to snapshot the current hosted issue and its validation selection for
67
+ the new run. Later issue edits do not change that run.
68
+
33
69
  Absolute configuration paths remain absolute. Effective state and checkout
34
70
  paths are normalized once during startup before safety and ownership checks, so
35
71
  a later working-directory change cannot redirect a running process. Validation
@@ -43,14 +79,17 @@ is the relative sibling `<checkout-name>.agent-workflows`.
43
79
 
44
80
  ## CLI environment files
45
81
 
46
- Select one file explicitly for any CLI command:
82
+ Set the optional top-level `envFile` property to load one file for every CLI
83
+ command that reads the configuration:
47
84
 
48
- ```sh
49
- agent-workflows --env-file ./runner.env run
50
- agent-workflows --env-file ./runner.env status --json
51
- agent-workflows --env-file /absolute/path/runner.env monitor
85
+ ```json
86
+ "envFile": "./runner.env"
52
87
  ```
53
88
 
89
+ Add this alongside the other top-level properties in `agent-workflows.json`.
90
+ `envFile` is a CLI-file setting, not part of the public SDK `Configuration`.
91
+ SDK callers continue to prepare their own process environment.
92
+
54
93
  Example `runner.env` (replace placeholders locally):
55
94
 
56
95
  ```dotenv
@@ -65,16 +104,19 @@ APP_REFERENCE='${APP_MODE}'
65
104
  or hosting values still fail existing validation. Missing keys are filled from
66
105
  the file; arbitrary application variable names are supported. `databaseUrlEnv`
67
106
  and `hosting.tokenEnv` still select which names the runner uses.
68
- - Relative paths resolve from the CLI launch directory, independently of
69
- `--config` and project checkouts. Absolute paths work too. No `.env` discovery
70
- or multiple-file layering is performed.
107
+ - Relative paths resolve from the effective configuration base: the directory
108
+ containing the resolved configuration file, or `--config-base-directory`
109
+ when supplied. Absolute paths work too. Omitting `envFile` performs no `.env`
110
+ discovery. Multiple-file layering is not supported.
71
111
  - Parsing uses Node's literal dotenv syntax: quotes and comments are supported;
72
112
  `$NAME`, `${NAME}`, backticks and `$(command)` in values are not expanded or
73
113
  executed. This is not shell sourcing.
74
- - The file is read once before the command action, database access, hosting
75
- adapters or runner creation. Missing or unreadable files stop the command with
76
- a nonzero exit and a path/error code, without printing file contents. Restart
77
- the runner to pick up edits. Help only displays usage and does not load files.
114
+ - The configuration is validated before its environment file can be discovered.
115
+ The file is then read once before database access, hosting adapters or runner
116
+ creation. Missing, unreadable or invalid files stop the command with a nonzero
117
+ exit without printing file contents. Restart the runner to pick up edits.
118
+ `init` creates a configuration without `envFile`; help and `init` do not load
119
+ an environment file.
78
120
  - The merged environment is shared across all projects in the runner. Validation,
79
121
  Git and agent worker subprocesses inherit it. Provider runtimes may apply their
80
122
  own environment policies to tools they launch; see [providers](providers.md).
@@ -88,12 +130,13 @@ redaction remains in effect; arbitrary variable support does not classify every
88
130
  application value as a secret. A GitHub API token does not configure Git push
89
131
  credentials.
90
132
 
91
- The flag belongs to `agent-workflows`, not the separate `pnpm db:migrate` command.
92
- SDK callers load their own process environment before creating a runner and
93
- continue passing `databaseUrl` explicitly. Node startup-only settings, such as
94
- `NODE_EXTRA_CA_CERTS`, must be set before launching Node to affect the CLI process.
95
- When invoking the script directly through Node, separate Node arguments from
96
- application arguments: `node -- dist/src/cli.js --env-file ./runner.env status`.
133
+ The setting belongs to the CLI configuration file, not the separate
134
+ `pnpm db:migrate` command. SDK callers load their own process environment before
135
+ creating a runner and continue passing `databaseUrl` explicitly. The setting's
136
+ path and contents are not part of publication-recovery fingerprints, so
137
+ credential rotation does not invalidate recovery. Node startup-only settings,
138
+ such as `NODE_EXTRA_CA_CERTS`, must be set before launching Node to affect the
139
+ CLI process.
97
140
 
98
141
  ## Profiles
99
142
 
package/docs/database.md CHANGED
@@ -15,21 +15,5 @@ Do not edit applied migration files or use schema push against existing data. Ad
15
15
 
16
16
  The initial migration adopts the original application's identical tables using `IF NOT EXISTS`, preserving records and constraints. This supports the original schema, not arbitrary manually altered schemas; inspect and reconcile any local schema changes first.
17
17
 
18
- ## Query boundary
19
-
20
- `Store` uses typed Drizzle inserts, updates and selects. Concurrent JSON record patches use a transaction and row lock to preserve unrelated fields. Full-scope run and invocation queries sort their JSON fields in memory; introduce typed indexed columns if history size requires database pagination.
21
-
22
- Retry admission locks the project row before checking task history, then commits
23
- the new run, project unblocking and admission events in one transaction. The
24
- project lock serializes requests even when they target different historical
25
- attempts. Runner's checkout/process safety check runs while that lock is held;
26
- command replay skips it and does not write new events.
27
-
28
- `src/db/locks.ts` contains the only application driver SQL: fixed, parameterized PostgreSQL session-lock calls, which have no Drizzle query-builder equivalent. Generated migration SQL and the frozen legacy-schema test fixture are intentional SQL artifacts. No interpolated SQL template strings are used for record access.
29
-
30
- Execution history is stored in the existing run JSON record. Publication recovery
31
- adds optional fields without changing SQL tables; no migration or backfill is
32
- required. Legacy records remain readable, but lack the evidence needed for
33
- recovery. Recovery admission atomically appends an execution, queues the same
34
- run and writes an event under the project/task locks used by retry admission.
35
- The persisted execution ID lets dispatch reconcile a DBOS fork across crashes.
18
+ The persistence and locking rationale is recorded in
19
+ [ADR 0005](adr/0005-postgresql-persistence-boundary.md).
@@ -10,11 +10,12 @@ All commands accept `--config PATH` before the subcommand.
10
10
  | `run [--project ID ...]` | Start selected projects in the foreground |
11
11
  | `status [--json]` | Projects, runs and command outcomes |
12
12
  | `inspect RUN` | Full run and invocation/session records as JSON |
13
- | `logs RUN [--invocation ID]` | Local agent and validation artifacts |
13
+ | `logs RUN [--invocation ID]` | Local stage, agent and validation artifacts |
14
14
  | `pause PROJECT` / `resume PROJECT` | Queue an intake control command |
15
15
  | `stop RUN` | Queue cancellation; success means active local work has stopped |
16
16
  | `recover RUN` | Continue a failed publication step using completed checkpoints |
17
17
  | `retry RUN` | Queue an explicit new attempt after checkout validation |
18
+ | `retry RUN --refresh-issue` | Queue a new attempt using the current hosted issue |
18
19
  | `monitor [--notify]` | Attach an interactive terminal view; optionally alert on outcomes |
19
20
 
20
21
  Control commands return a command ID and `pending`; inspect `status --json` or the monitor for success/failure. With no runner, commands stay pending. Run and monitor are separate processes. Closing the monitor never cancels work. Ctrl-C on the runner stops intake, cancels active work, waits for process termination and releases ownership. Queued issues remain durable for the next start.
@@ -57,7 +58,7 @@ fallback. An overflowing document shows its visible line range in the heading.
57
58
  | Context | Keys |
58
59
  | --- | --- |
59
60
  | Dashboard | Left/Right project; Tab/Shift+Tab pane; Up/Down selection or scroll |
60
- | Details | Enter opens; Up/Down or PgUp/PgDn scroll; Esc returns; `l` opens the latest current-execution session, preferring a running session |
61
+ | Details | Enter opens; Up/Down or PgUp/PgDn scroll; Esc returns; `l` opens the latest current-execution session, or the stage diagnostic before a session exists |
61
62
  | Progress | `[`/`]` inspect step history; End follows latest event |
62
63
  | Sessions | `a` focuses session list; Up/Down selects invocation; `l` opens log |
63
64
  | Validation | `v` opens validation logs |
@@ -93,7 +94,7 @@ or `unavailable`. Noninteractive tools use `status --json` and `inspect`. Run
93
94
  details keeps complete errors under Diagnostics and exact identifiers, paths,
94
95
  profiles and ISO timestamps under Technical details.
95
96
 
96
- ## Observability Landscape
97
+ ## Observability landscape
97
98
 
98
99
  This section includes only options that run locally without a license key.
99
100
  Cloud services and tools requiring a license key are excluded. These boundaries
@@ -121,38 +122,30 @@ Conductor service or cloud login. See the [DBOS CLI reference](https://docs.dbos
121
122
  The initial DBOS workflow ID equals the run ID. Publication recovery keeps the
122
123
  run ID and adds a new DBOS execution ID; `inspect RUN` includes execution history
123
124
  and a persisted recovery eligibility assessment. Admission performs live checks.
124
- Inspect both layers: the
125
- runner catches execution errors and persists application outcomes, so a DBOS
126
- `SUCCESS` can accompany an application `failed` or `blocked` outcome. DBOS step
127
- history does not replace the local agent/validation artifacts.
128
-
129
- A browser dashboard is an extension path, not a bundled feature. A local server
130
- could combine the [Store query/event API](api.md#query-and-event-interface) with
131
- `DBOSClient.create({ systemDatabaseUrl: databaseUrl })`, joining records by run ID.
132
- Neither inspector needs to launch another DBOS runtime. Keep database access on
133
- the server and bind a local-only dashboard to loopback. See the
134
- [inspection example](../examples/observe.ts) for Store lifecycle handling.
135
-
136
- Route dashboard controls through `Store.request` or the runner's public controls.
137
- Direct DBOS cancellation, resumption or forking bypasses application coordination
138
- for process termination, checkout safety and retry admission.
125
+ Inspect both layers: the runner catches execution errors and persists application
126
+ outcomes, so DBOS `SUCCESS` can accompany an application `failed` or `blocked`
127
+ outcome. DBOS step history does not replace local agent or validation artifacts.
128
+ See [ADR 0003](adr/0003-run-and-execution-identity.md) for the identity model.
139
129
 
140
130
  ## Ownership and recovery
141
131
 
142
- Only the runner may edit or switch managed checkouts while it is active. PostgreSQL advisory locks protect runner/configuration and checkout identities. A local Git-directory lease also prevents runners using different databases from owning the same checkout. Worker/validation process-group journals prevent reuse while old work may still run.
132
+ Only the runner may edit or switch managed checkouts while it is active.
133
+ PostgreSQL advisory locks, a local Git-directory lease, and worker/validation
134
+ process journals prevent concurrent ownership and reuse while old work may still
135
+ run. See [ADR 0002](adr/0002-existing-checkouts-and-exclusive-ownership.md) for
136
+ the checkout and concurrency tradeoff.
143
137
 
144
138
  Git process journals live in `<git-directory>/agent-workflows-processes/`, independently of the configured state directory. A surviving Git process blocks ownership acquisition after a crash. Stop requests propagate to active fetch, staging, commit and push commands; interrupted effects still require reconciliation.
145
139
 
146
140
  Startup and phase boundaries check ownership assumptions, branch/head and actual changes. Unfinished files are never reset, cleaned, stashed or discarded automatically. Dirty files, unresolved Git operations, branch collisions, unexpected mutations and ambiguous agent recovery become inspectable blocked states. Other eligible projects continue.
147
141
 
148
- Publication effects have independent DBOS checkpoints. A task commit preserves
149
- publication trailers, carries exactly one `Agent-Workflows-Run`, and by default
150
- adds co-author trailers for providers with retained writable contributions.
151
- Commit reconciliation checks the expected parent, change set, finalized message,
152
- and clean checkout. Push recovery checks the remote ref, request creation checks
153
- the source branch, and review publication checks stable markers. Transient
154
- publication failures use bounded retries and reconciliation. Interrupted agent
155
- stages block rather than starting another writer.
142
+ Publication effects have independent DBOS checkpoints. A task commit carries
143
+ exactly one `Agent-Workflows-Run` marker and, by default, co-author trailers for
144
+ providers with retained writable contributions. Commit, push, request creation,
145
+ and review publication reconcile their durable identities before retrying an
146
+ ambiguous effect. Interrupted agent stages block rather than starting another
147
+ writer. See [ADR 0003](adr/0003-run-and-execution-identity.md) for the recovery
148
+ boundary.
156
149
 
157
150
  ## Publication recovery
158
151
 
@@ -184,7 +177,7 @@ After a blocked/failed task that cannot be recovered:
184
177
  1. Read `inspect RUN`, logs, session IDs and the local Git diff.
185
178
  2. Establish that no worker/process group is still running. If startup reports an old PID or process journal, inspect that exact process and stop it before recovery. Never remove a live owner's lease.
186
179
  3. Preserve unfinished work on a developer-owned commit/branch or move it to a safe location. Resolve merge/rebase state yourself. Do not rely on DBOS to restore files.
187
- 4. Once the checkout is clean, request `retry RUN`. This creates a new attempt and branch from the configured base, keeping the old run and files/commits inspectable.
180
+ 4. Once the checkout is clean, request `retry RUN`. This creates a new attempt and branch from the configured base, keeping the old run and files/commits inspectable. Use `retry RUN --refresh-issue` to capture the current hosted issue description and validation selection in the new run. The hosted issue must retain its identity, be open, and have the required labels; its selected validation profile must be configured.
188
181
 
189
182
  A failed review after publication remains a failed automation attempt, even if its draft request exists. Explicit retry starts the full workflow as a new attempt; it does not silently modify the old request. Human review/merging remains separate. A stale review never claims coverage of a changed remote head.
190
183
 
package/docs/providers.md CHANGED
@@ -21,7 +21,7 @@ The runner deliberately does not automatically resume interrupted agent work. Ru
21
21
 
22
22
  ## Environment inheritance
23
23
 
24
- CLI `--env-file` values reach validation commands, Git subprocesses and agent
24
+ CLI `envFile` values reach validation commands, Git subprocesses and agent
25
25
  workers through the runner's process environment. SDK callers get the same
26
26
  inheritance from their own process environment. The installed Codex SDK forwards
27
27
  that environment to its executable; Copilot uses it for its local runtime, with
@@ -58,7 +58,7 @@ In GitHub **Settings → Developer settings → Personal access tokens → Fine-
58
58
 
59
59
  Git push uses the checkout's configured remote and Git credentials independently of this API token. The API adapter does not require **Contents** permission. If you also use this PAT for HTTPS Git pushes, grant **Contents: Read and write**; pushing changes to `.github/workflows/` additionally requires **Workflows: Read and write**. Do not embed credentials in remote URLs.
60
60
 
61
- If access is denied, check the selected owner/repository, PR write permission, token expiration, organization approval, and the token owner's repository access. If you replace the token value, restart the runner with the updated environment; existing environment variables override `--env-file` values. An already failed run requires explicit [recovery](operations.md#ownership-and-recovery); updating permissions does not restart it.
61
+ If access is denied, check the selected owner/repository, PR write permission, token expiration, organization approval, and the token owner's repository access. If you replace the token value, restart the runner with the updated environment; existing environment variables override configured `envFile` values. An already failed run requires explicit [recovery](operations.md#ownership-and-recovery); updating permissions does not restart it.
62
62
 
63
63
  References: GitHub's [PAT creation guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), [issue permissions](https://docs.github.com/en/rest/issues/issues#list-repository-issues), [PR creation permissions](https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request), and [review permissions](https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request).
64
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingchuno/agent-workflows",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Local durable coding workflows on DBOS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,16 +0,0 @@
1
- import type { RunRecord } from "../domain.js";
2
- import type { ProjectState } from "../store.js";
3
- /** Display eligibility only; the runner still validates command admission. */
4
- export declare function actionAvailability({ run, project, projectRuns, pending, }: {
5
- run?: RunRecord;
6
- project?: ProjectState;
7
- projectRuns: RunRecord[];
8
- pending: boolean;
9
- }): {
10
- recoveryReason: string | undefined;
11
- available: {
12
- stop: boolean;
13
- retry: boolean;
14
- recover: boolean;
15
- };
16
- };
@@ -1,23 +0,0 @@
1
- import { recoveryUnavailable } from "../recovery.js";
2
- /** Display eligibility only; the runner still validates command admission. */
3
- export function actionAvailability({ run, project, projectRuns, pending, }) {
4
- const recoveryReason = run
5
- ? (recoveryUnavailable(run) ??
6
- project?.blocked ??
7
- (projectRuns.some((item) => item.taskKey === run.taskKey && item.attempt > run.attempt)
8
- ? "A newer attempt has superseded this run"
9
- : undefined))
10
- : undefined;
11
- return {
12
- recoveryReason,
13
- available: {
14
- stop: Boolean(run && !pending && ["queued", "running"].includes(run.outcome)),
15
- retry: Boolean(run &&
16
- !pending &&
17
- ["failed", "blocked", "cancelled"].includes(run.outcome) &&
18
- !projectRuns.some((item) => item.taskKey === run.taskKey &&
19
- ["queued", "running"].includes(item.outcome))),
20
- recover: Boolean(run && !pending && !recoveryReason),
21
- },
22
- };
23
- }
@@ -1,41 +0,0 @@
1
- # Architecture
2
-
3
- DBOS owns workflow execution, durable steps and concurrency-one project queues. The runner only discovers candidates, dispatches durable identities and handles local operator commands. It does not introduce a workflow language or an interchangeable scheduler.
4
-
5
- - `config.ts` / `domain.ts`: validated configuration, vocabulary and adapter contracts.
6
- - `runner.ts`: local ownership, intake/deduplication, DBOS lifecycle and operator controls.
7
- - `operations.ts`: reusable durable coding operations and the default workflow.
8
- - `prompts.ts` / `invocation.ts`: resolved task text, output contracts and bounded format correction.
9
- - `evidence.ts`: indexed, hashed change artifacts and capture limits.
10
- - `recovery.ts`: publication recovery eligibility, input fingerprints and live safety checks.
11
- - `workspace.ts`: existing-checkout Git operations and change verification.
12
- - `store.ts`: typed Drizzle queries for run, invocation, project, command and event records; `db/schema.ts` and `drizzle/` own the application schema and migrations.
13
- - `adapters/`: provider clients and isolated SDK workers.
14
- - `runtime/`: process groups, ownership journals and redacted logging.
15
- - `cli.ts` / `tui/`: shared command/query interfaces.
16
-
17
- Application records live in `agent_workflows`; DBOS maintains its own execution schema in the same PostgreSQL database. Large streamed agent/validation logs live under the configured state directory, referenced by records. Interrupted or failed agent calls are never automatically retried. A returned response that fails its output contract may receive one fresh inspection-only format-correction attempt within the same stage deadline. Publication retries and explicit recovery reconcile external state first. Clean terminal state and terminal workflow outcome are deliberately separate.
18
-
19
- Node/PostgreSQL/Git are the only runtime infrastructure; providers require their normal local authentication. Zod, Commander, Ink/React, Drizzle/node-postgres, Pino, Octokit and Gitbeaker handle standard infrastructure. Drizzle ORM and Codex SDK are Apache-2.0; the other listed runtime libraries and Copilot SDK are MIT-licensed. Exact dependency versions are pinned by the lockfile. No custom HTTP client, CLI parser or terminal renderer is introduced.
20
-
21
- The test boundary is the public runner/workflow API using real PostgreSQL, real temporary Git repositories and controlled adapters. Separate adapter contracts exercise SDK argument/event mapping and HTTP behavior. Process-level recovery tests terminate a runner after external effects and restart it against the same state. Runtime/provider smoke calls are intentionally separate from deterministic acceptance tests.
22
-
23
- The runner supports existing checkouts only. Higher per-project concurrency requires isolated workspaces and lifecycle design; changing the DBOS queue limit alone is unsafe.
24
-
25
- ## Package boundary
26
-
27
- Keep one package while the SDK, CLI and TUI share a runtime, schema and release cycle. `src/adapters`, `src/runtime`, `src/db` and `src/tui` provide internal boundaries without workspace packages. Split into a monorepo when a separately deployed app or independently versioned package needs its own dependencies and build. `pnpm-workspace.yaml` currently configures installation policy only.
28
-
29
- ## Run and execution identity
30
-
31
- A run owns the branch, commit and publication markers. Its initial DBOS execution
32
- uses the run ID; publication recovery forks the failed execution at its failed
33
- step under a new execution ID, preserving completed checkpoints and the original
34
- run input. Execution history stays in the run record. Fresh retry creates a new
35
- run and branch.
36
-
37
- Recovery admission and retry share a project lock. Admission persists the fork ID
38
- before dispatch so a restarted runner can adopt an existing fork. Recovery gates
39
- run inside the first operation that actually executes, avoiding copied pause and
40
- safety decisions. Recovery is limited to the default workflow's publication
41
- steps; interrupted agents still require manual inspection.