@nodeint/migent 0.1.3 → 0.1.5
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/README.md +57 -41
- package/dist/commands/agent.js +111 -59
- package/dist/commands/config.js +20 -8
- package/dist/commands/execute.d.ts +6 -0
- package/dist/commands/execute.js +30 -14
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +91 -87
- package/dist/commands/prepare.d.ts +1 -0
- package/dist/commands/prepare.js +14 -0
- package/dist/commands/repair.d.ts +1 -0
- package/dist/commands/repair.js +22 -0
- package/dist/commands/service.js +5 -4
- package/dist/commands/sessions.d.ts +24 -1
- package/dist/commands/sessions.js +165 -13
- package/dist/commands/skill.js +51 -32
- package/dist/commands/watch.d.ts +2 -1
- package/dist/commands/watch.js +130 -67
- package/dist/commands/workspace-registry.js +10 -1
- package/dist/display.js +21 -9
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +6 -0
- package/dist/exits.d.ts +10 -0
- package/dist/exits.js +26 -0
- package/dist/follow-log.d.ts +29 -0
- package/dist/follow-log.js +172 -0
- package/dist/fs-utils.d.ts +3 -0
- package/dist/fs-utils.js +26 -0
- package/dist/index.js +5 -1
- package/dist/migrate.js +2 -17
- package/dist/program.js +388 -168
- package/dist/session-row.d.ts +20 -0
- package/dist/session-row.js +21 -0
- package/dist/signals.d.ts +3 -0
- package/dist/signals.js +56 -0
- package/dist/templates/migent/SKILL.md +159 -50
- package/dist/templates/migent/references/schema-config.yaml +35 -0
- package/dist/templates/migent/references/schema-workflow.yaml +61 -0
- package/dist/text.d.ts +4 -0
- package/dist/text.js +13 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/workspace.js +5 -12
- package/package.json +4 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const SESSION_COLUMN: {
|
|
2
|
+
readonly updatedAt: 0;
|
|
3
|
+
readonly session: 1;
|
|
4
|
+
readonly workflow: 2;
|
|
5
|
+
readonly status: 3;
|
|
6
|
+
readonly execution: 4;
|
|
7
|
+
readonly decision: 5;
|
|
8
|
+
readonly outputs: 6;
|
|
9
|
+
readonly task: 7;
|
|
10
|
+
};
|
|
11
|
+
export interface SessionFields {
|
|
12
|
+
session: string;
|
|
13
|
+
workflow: string;
|
|
14
|
+
status: string;
|
|
15
|
+
execution: string;
|
|
16
|
+
decision: string;
|
|
17
|
+
outputs: string;
|
|
18
|
+
task: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function sessionFields(row: readonly string[]): SessionFields;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const SESSION_COLUMN = {
|
|
2
|
+
updatedAt: 0,
|
|
3
|
+
session: 1,
|
|
4
|
+
workflow: 2,
|
|
5
|
+
status: 3,
|
|
6
|
+
execution: 4,
|
|
7
|
+
decision: 5,
|
|
8
|
+
outputs: 6,
|
|
9
|
+
task: 7,
|
|
10
|
+
};
|
|
11
|
+
export function sessionFields(row) {
|
|
12
|
+
return {
|
|
13
|
+
session: row[SESSION_COLUMN.session] ?? "",
|
|
14
|
+
workflow: row[SESSION_COLUMN.workflow] ?? "",
|
|
15
|
+
status: row[SESSION_COLUMN.status] ?? "",
|
|
16
|
+
execution: row[SESSION_COLUMN.execution] ?? "",
|
|
17
|
+
decision: row[SESSION_COLUMN.decision] ?? "",
|
|
18
|
+
outputs: row[SESSION_COLUMN.outputs] ?? "",
|
|
19
|
+
task: row[SESSION_COLUMN.task] ?? "",
|
|
20
|
+
};
|
|
21
|
+
}
|
package/dist/signals.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CancellationRequested, raiseCancellation, resetCancellation } from "@nodeint/migent-kernel";
|
|
2
|
+
let pending = null;
|
|
3
|
+
const waiters = new Set();
|
|
4
|
+
function note(signalNumber) {
|
|
5
|
+
pending = new CancellationRequested(signalNumber);
|
|
6
|
+
for (const waiter of waiters)
|
|
7
|
+
waiter();
|
|
8
|
+
try {
|
|
9
|
+
raiseCancellation(signalNumber);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// The pending flag is what the follow loop and provider runner observe.
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function bindCancellationSignals() {
|
|
16
|
+
const onSigint = () => note(2);
|
|
17
|
+
const onSigterm = () => note(15);
|
|
18
|
+
process.on("SIGINT", onSigint);
|
|
19
|
+
process.on("SIGTERM", onSigterm);
|
|
20
|
+
return () => {
|
|
21
|
+
process.off("SIGINT", onSigint);
|
|
22
|
+
process.off("SIGTERM", onSigterm);
|
|
23
|
+
pending = null;
|
|
24
|
+
resetCancellation();
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function throwIfCliCancelled() {
|
|
28
|
+
const error = pending;
|
|
29
|
+
if (error === null)
|
|
30
|
+
return;
|
|
31
|
+
pending = null;
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
export function delay(ms) {
|
|
35
|
+
throwIfCliCancelled();
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
let settled = false;
|
|
38
|
+
const finish = () => {
|
|
39
|
+
if (settled)
|
|
40
|
+
return;
|
|
41
|
+
settled = true;
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
waiters.delete(wake);
|
|
44
|
+
try {
|
|
45
|
+
throwIfCliCancelled();
|
|
46
|
+
resolve();
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
reject(error);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const timer = setTimeout(finish, ms);
|
|
53
|
+
const wake = () => finish();
|
|
54
|
+
waiters.add(wake);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -1,62 +1,171 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: migent
|
|
3
|
-
description: Set up Migent in a project, or configure, run, inspect, and resume its workflows. Use when the user asks about Migent configuration, workflows, sessions, stages, or published outputs.
|
|
3
|
+
description: Set up Migent in a project, or configure, run, inspect, and resume its workflows with the migent CLI. Use when the user asks about Migent, .migent/ configuration, workflows, roles, models, sessions, stages, doctor, or published outputs.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Migent
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Migent runs a project's multi-stage agent workflows from the `migent` CLI.
|
|
9
|
+
A workflow is a set of stages; each stage runs a role; a role uses a model
|
|
10
|
+
name defined in `.migent/config.yaml`. Each run is a session.
|
|
9
11
|
|
|
10
12
|
## Working rules
|
|
11
13
|
|
|
12
14
|
- For an existing project, work from the root containing
|
|
13
|
-
`.migent/config.yaml`.
|
|
14
|
-
its root and follow the CLI's provider and model prompts or flags.
|
|
15
|
+
`.migent/config.yaml`.
|
|
15
16
|
- Read `.migent/config.yaml` and the relevant file under
|
|
16
17
|
`.migent/workflows/` before changing or running a workflow.
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
files
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
18
|
+
- Before writing `.migent/config.yaml` or a file under `.migent/workflows/`,
|
|
19
|
+
read `.agents/skills/migent/references/schema-config.yaml` and
|
|
20
|
+
`.agents/skills/migent/references/schema-workflow.yaml`. They list every
|
|
21
|
+
accepted key. A key absent from those files is ignored.
|
|
22
|
+
- Run `migent doctor --json` after editing configuration or workflows. If it
|
|
23
|
+
reports an outdated schema, run `migent migrate --yes`. Pass `--json` on
|
|
24
|
+
`config model` and `config role` writes too. The object includes the doctor
|
|
25
|
+
result.
|
|
26
|
+
- You have no terminal for prompts. Pass `--no-input` (or set
|
|
27
|
+
`MIGENT_NO_INPUT=1`) to `init`, `config model`, and `config role`, and give
|
|
28
|
+
every value as a flag.
|
|
29
|
+
- Treat `.migent/sessions/` as generated, resumable state. Do not edit
|
|
30
|
+
`manifest.yaml`, `status.json`, `events.jsonl`, or files under
|
|
31
|
+
`executions/`. In a prepared session, write `task.md` and files next to
|
|
32
|
+
it before the first stage. Do not change `task.md` after that stage starts.
|
|
33
|
+
- Preserve the user's task wording. Pass a one-line task in `--task`. Write
|
|
34
|
+
a longer task into `task.md` unchanged.
|
|
35
|
+
- A workflow `session run` or `session continue` prints `session_id`,
|
|
36
|
+
`session_status`, `stop_reason`, `latest_decision`, and `outputs` on stdout.
|
|
37
|
+
Stderr carries stage boundaries and errors. A role run prints a table unless
|
|
38
|
+
`--json`. That JSON is the role result, not this object.
|
|
39
|
+
- This skill is already in the prompt. Do not open its file again.
|
|
40
|
+
- Do not read `task.md` or the documents it names. The stage agent reads
|
|
41
|
+
them. Still read `.migent/config.yaml` and the workflow file before starting.
|
|
42
|
+
|
|
43
|
+
## Set up
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
migent init --no-input --provider <provider> --model <model-id> [--preset implement|plan] [--option KEY=VALUE] [--skill]
|
|
47
|
+
migent doctor --json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`--provider` and `--model` go together. `--preset` picks the workflow to
|
|
51
|
+
create (default `implement`). `--skill` installs this skill at
|
|
52
|
+
`.agents/skills/migent`; `migent skill update` refreshes a managed copy.
|
|
53
|
+
|
|
54
|
+
## Run
|
|
55
|
+
|
|
56
|
+
`migent session run` runs a workflow when `--workflow` is set, and one role
|
|
57
|
+
when `--workflow` is omitted.
|
|
58
|
+
|
|
59
|
+
- Start a one-line task: `migent session run --workflow <workflow> --task "<task>"`.
|
|
60
|
+
`<workflow>` is a workflow id, or a path to a workflow file (the `id`
|
|
61
|
+
field defaults to the file name). The sentence is stored in `task.md`.
|
|
62
|
+
`--task` must be one line. Runs until the session stops.
|
|
63
|
+
- Start a longer task: `migent session prepare <some-id> --workflow <workflow>`.
|
|
64
|
+
`<some-id>` is a lowercase slug such as `wave-3` (letters, digits, and
|
|
65
|
+
single hyphens). Write `.migent/sessions/<some-id>/task.md`, then
|
|
66
|
+
`migent session run --session <some-id> --workflow <workflow>`.
|
|
67
|
+
`session continue` does not start a prepared session.
|
|
68
|
+
- Start and dispatch one stage only: add `--once`. `--once` requires `--workflow`.
|
|
69
|
+
- If the workflow's `requires` block names a prerequisite workflow and
|
|
70
|
+
decision, find it with
|
|
71
|
+
`migent session list --workflow <workflow-id> --status completed --json`
|
|
72
|
+
and pass `--prior <session-id>`. `session continue` accepts `--prior` too.
|
|
73
|
+
- Resume an active workflow session: `migent session continue <session-id>`.
|
|
74
|
+
This resets revision counts. `migent session continue <session-id> --once`
|
|
75
|
+
advances one stage and does not reset them. A blocked session runs that stage
|
|
76
|
+
again. `migent session continue <session-id> --reply "<reply>"` sends the
|
|
77
|
+
reply as the new execution's prompt body. Use `--reply-file <path>` for a
|
|
78
|
+
longer reply. When more than one stage is blocked, pass `--stage`. Without
|
|
79
|
+
`--reply`, the prompt includes the blocker and the previous response.
|
|
80
|
+
A cancelled session is resumed the same way, on the same execution: a cut-off
|
|
81
|
+
provider turn is sent again, and a cut-off verify runs again. Ask the user
|
|
82
|
+
before resuming a cancellation.
|
|
83
|
+
- Run one role: `migent session run --role <role> --prompt "<prompt>"`.
|
|
84
|
+
`roles.<role>.instructions` in config, when set, is prepended to that prompt.
|
|
85
|
+
Use `--file <path>` or `--stdin` for a long prompt. `--task` labels a new
|
|
86
|
+
role session and cannot be combined with `--session <session-id>`, which
|
|
87
|
+
continues an earlier role session. `--provider`/`--model` (together) and
|
|
88
|
+
`--option KEY=VALUE` override the role for this turn. Add `--json` for one
|
|
89
|
+
result object. Exit 0 means the outcome is complete, 1 not complete.
|
|
90
|
+
- Read the JSON result on stdout for a workflow run. Do not pass `--verbose`
|
|
91
|
+
or `--progress`. `--verbose` inlines every stage response. `--progress`
|
|
92
|
+
prints each tool call.
|
|
93
|
+
- Exit 1, 3, and 6 also include `latest_execution_id` and `response_path`,
|
|
94
|
+
relative to `.migent/sessions/<session-id>/`. Read that file when you must
|
|
95
|
+
fix the execution.
|
|
96
|
+
- Stderr is not the outcome. Do not read the command log while a run is healthy.
|
|
97
|
+
- When `session run` or `session continue` is in the background, wait for that
|
|
98
|
+
command's completion notice. Do not add a watcher that only waits for the same exit.
|
|
99
|
+
- To check a run without waiting on the command, use
|
|
100
|
+
`migent session show <session-id> --json` once.
|
|
101
|
+
- Do not run `session follow` or `--cursor`.
|
|
102
|
+
|
|
103
|
+
Limits, accepted by workflow `session run` and by `session continue`:
|
|
104
|
+
|
|
105
|
+
- `--attempts <n>`: failed executions allowed for one stage (default 3). On
|
|
106
|
+
`session continue` it sets a new total, not extra retries.
|
|
107
|
+
- `--max-dispatches <n>`: stage dispatches allowed in this command (default
|
|
108
|
+
20). `--unlimited-dispatches` removes the ceiling; use it only if the user
|
|
109
|
+
agrees.
|
|
110
|
+
|
|
111
|
+
### Exit codes and stop reasons
|
|
112
|
+
|
|
113
|
+
A workflow result on stdout includes `stop_reason`. Read the exit code first.
|
|
114
|
+
|
|
115
|
+
| Exit | Meaning | `stop_reason` | Session | What to do |
|
|
116
|
+
| --- | --- | --- | --- | --- |
|
|
117
|
+
| 0 | Completed (with `--once`: stage complete) | | completed or advancing | Report outputs. |
|
|
118
|
+
| 1 | Blocked (with `--once`: stage not complete) | `blocked`, or `stage` with `--once` | blocked, or active with `--once` | When `stop_reason` is `blocked`, read `response_path`. Pass the user's words with `session continue --reply`, or `session continue` without `--reply` after the blocker is fixed in the workspace. When `stop_reason` is `stage`, `session continue` keeps going. |
|
|
119
|
+
| 2 | Configuration error | | unchanged | Run `migent doctor --json`, fix config. |
|
|
120
|
+
| 3 | `--attempts` spent | `retry_exhausted` | active | Read `response_path`, fix the cause, then `session continue` (add `--attempts` for a higher total). |
|
|
121
|
+
| 4 | A route would exceed `max_revisions` | `revisions_exhausted` | active | Review why the stage keeps being revised; `session continue` (without `--once`) resets counts for another batch. |
|
|
122
|
+
| 5 | `--max-dispatches` spent | `dispatch_limit` | active | `session continue` the same session if more stages are appropriate. |
|
|
123
|
+
| 130 | Cancelled | | see snapshot | Ask the user before resuming. `session continue` resumes that same execution. |
|
|
124
|
+
|
|
125
|
+
A stopped active session is resumable; do not describe it as completed. A
|
|
126
|
+
blocked session is resumed the same way: `session continue` runs that stage
|
|
127
|
+
again. Do not start a replacement session to reset limits or to get past
|
|
128
|
+
`blocked`. If you change a workflow or
|
|
129
|
+
config while a session is active, that session keeps the workflow, models, and
|
|
130
|
+
role instructions it started with. Run `migent doctor --json` and tell the user.
|
|
131
|
+
`migent session continue <session-id> --refresh-workflow` adopts the current
|
|
132
|
+
workflow, models, and role instructions. `session run --session <id> --workflow <workflow> --refresh-workflow`
|
|
133
|
+
does the same when starting a prepared session.
|
|
134
|
+
|
|
135
|
+
## Inspect sessions
|
|
136
|
+
|
|
137
|
+
- Newest match: `migent session list --latest --json`. Add `--workflow <id>` and
|
|
138
|
+
`--status active|prepared|completed|blocked|cancelled` to narrow it. `--limit <n>`
|
|
139
|
+
returns the newest n rows. Do not combine `--latest` with `--limit`.
|
|
140
|
+
- `--latest --json` is one object, or `null` when nothing matches. A list is
|
|
141
|
+
a JSON array. Snapshot: `migent session show <session-id> --json` has the
|
|
142
|
+
status, latest execution, decision, and outputs. JSON omits the task text.
|
|
143
|
+
- Compare runs with `migent session metrics --json`. One session is one
|
|
144
|
+
object. Several sessions are one object per line, newest first.
|
|
145
|
+
`--workflow`, `--status`, and `--limit` match `session list`. Read
|
|
146
|
+
`usage_missing` and `uncaptured_turns` before comparing totals.
|
|
147
|
+
`stage_attempt` is not a retry count.
|
|
148
|
+
- `session follow` streams the event trace for a person at a terminal.
|
|
149
|
+
Do not use it or `--cursor` to coordinate a run.
|
|
150
|
+
|
|
151
|
+
Report the session ID, status, stop reason, decisions, and published outputs
|
|
152
|
+
that matter to the user. Published output paths are relative to
|
|
153
|
+
`.migent/sessions/<session-id>/`; use the paths Migent reports instead of
|
|
154
|
+
guessing.
|
|
155
|
+
|
|
156
|
+
## Configure models and roles
|
|
157
|
+
|
|
158
|
+
- Show: `migent config` or `migent config show`.
|
|
159
|
+
- List models or roles: `migent config model --json`,
|
|
160
|
+
`migent config role --json`.
|
|
161
|
+
- Change a model name:
|
|
162
|
+
`migent config model <name> --provider <provider> --model <model-id> --no-input --json`.
|
|
163
|
+
This updates every role and stage that uses the name. Use
|
|
164
|
+
`--option KEY=VALUE` and `--clear-option KEY` for provider options.
|
|
165
|
+
- Point roles at an existing model name:
|
|
166
|
+
`migent config role <role>... --model-name <name> --no-input --json`. The value is
|
|
167
|
+
a name from `models`, not a provider model id.
|
|
168
|
+
- Override one role without touching the shared name:
|
|
169
|
+
`migent config role <role> --provider <provider> --model <model-id> --no-input --json`.
|
|
170
|
+
- `roles.<name>.instructions` is an optional list of strings. A stage prompt
|
|
171
|
+
includes it before that stage's instructions. A role run prepends it to the prompt.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# A missing schema_version is 0. Commands refuse the file while it is older than this Migent.
|
|
2
|
+
schema_version: 2
|
|
3
|
+
|
|
4
|
+
# models.<name>.model is the provider model id.
|
|
5
|
+
# roles.<name>.default_model and a stage model are this name.
|
|
6
|
+
# Options merge in order: model, then role, then stage.
|
|
7
|
+
# Only keys the adapter marks overridable are stored on the provider session.
|
|
8
|
+
models:
|
|
9
|
+
planner:
|
|
10
|
+
provider: grok
|
|
11
|
+
model: grok-4.7
|
|
12
|
+
# grok accepts reasoning-effort (overridable), max_turns, tools, disallowed_tools,
|
|
13
|
+
# permission_mode (default, acceptEdits, auto, dontAsk, bypassPermissions, plan),
|
|
14
|
+
# rules, allow, deny, and sandbox.
|
|
15
|
+
# agy accepts effort (low, medium, high, xhigh, max; overridable), mode (accept-edits, auto, plan),
|
|
16
|
+
# agent, sandbox (true or false), and skip_permissions (true or false).
|
|
17
|
+
# claude accepts effort (low, medium, high, xhigh, max; overridable), permission_mode
|
|
18
|
+
# (acceptEdits, auto, bypassPermissions, manual, dontAsk, plan), tools, allowed_tools,
|
|
19
|
+
# disallowed_tools, max_budget_usd, fallback_model, and append_system_prompt.
|
|
20
|
+
# codex accepts model_reasoning_effort (overridable). Any other key of letters, digits,
|
|
21
|
+
# dots, underscores, and hyphens is passed through as codex exec -c.
|
|
22
|
+
options:
|
|
23
|
+
reasoning-effort: high
|
|
24
|
+
|
|
25
|
+
roles:
|
|
26
|
+
planner:
|
|
27
|
+
default_model: planner
|
|
28
|
+
# Included in every prompt for this role, before stage instructions.
|
|
29
|
+
# A role run prepends the same list to the prompt.
|
|
30
|
+
instructions:
|
|
31
|
+
- Break the task into a reviewable plan.
|
|
32
|
+
options:
|
|
33
|
+
reasoning-effort: medium
|
|
34
|
+
reviewer:
|
|
35
|
+
default_model: planner
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# A missing schema_version is 0. Commands refuse the file while it is older than this Migent.
|
|
2
|
+
schema_version: 2
|
|
3
|
+
concurrency: 1
|
|
4
|
+
|
|
5
|
+
# When id is omitted, the id is the file name without .yaml.
|
|
6
|
+
id: reference
|
|
7
|
+
|
|
8
|
+
constraints:
|
|
9
|
+
- Stay within the task.
|
|
10
|
+
|
|
11
|
+
# requires.workflow names another file in .migent/workflows.
|
|
12
|
+
requires:
|
|
13
|
+
workflow: plan
|
|
14
|
+
|
|
15
|
+
stages:
|
|
16
|
+
- id: draft
|
|
17
|
+
role: planner
|
|
18
|
+
# model is a name under models in config.yaml, not a provider model id.
|
|
19
|
+
model: planner
|
|
20
|
+
# Options merge in order: model, then role, then stage.
|
|
21
|
+
# Only keys the adapter marks overridable are stored on the provider session.
|
|
22
|
+
options:
|
|
23
|
+
reasoning-effort: high
|
|
24
|
+
depends_on: []
|
|
25
|
+
# max_revisions is allowed only when a route returns to this stage.
|
|
26
|
+
max_revisions: 2
|
|
27
|
+
instructions:
|
|
28
|
+
- Write the draft.
|
|
29
|
+
produces:
|
|
30
|
+
artifact: draft.md
|
|
31
|
+
|
|
32
|
+
- id: review
|
|
33
|
+
role: reviewer
|
|
34
|
+
depends_on:
|
|
35
|
+
- draft
|
|
36
|
+
# resume_from must be one entry in depends_on. It continues that stage's provider session.
|
|
37
|
+
session:
|
|
38
|
+
resume_from: draft
|
|
39
|
+
instructions:
|
|
40
|
+
- Review the draft.
|
|
41
|
+
# verify runs after status complete and must sit on every path to complete.
|
|
42
|
+
# A stage artifact cannot be named verify.md.
|
|
43
|
+
verify:
|
|
44
|
+
- pnpm test
|
|
45
|
+
# max_verify defaults to 3. verify_timeout is seconds for the whole list. Both require verify.
|
|
46
|
+
max_verify: 3
|
|
47
|
+
verify_timeout: 900
|
|
48
|
+
# Route keys must match decision.values. A destination is a stage id, complete, or a non-empty list of stage ids.
|
|
49
|
+
decision:
|
|
50
|
+
values:
|
|
51
|
+
- approved
|
|
52
|
+
- revise
|
|
53
|
+
routes:
|
|
54
|
+
approved: complete
|
|
55
|
+
revise: draft
|
|
56
|
+
|
|
57
|
+
# An output artifact must match produces.artifact on from_stage.
|
|
58
|
+
outputs:
|
|
59
|
+
- name: draft
|
|
60
|
+
from_stage: draft
|
|
61
|
+
artifact: draft.md
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function text(value: string | null | undefined): string | null;
|
|
2
|
+
export declare function optionalText(value: unknown): string | null;
|
|
3
|
+
/** Keep leading and trailing breaks so a one-line task check sees them. */
|
|
4
|
+
export declare function rawText(value: unknown): string | null;
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function text(value) {
|
|
2
|
+
if (typeof value !== "string")
|
|
3
|
+
return null;
|
|
4
|
+
const stripped = value.trim();
|
|
5
|
+
return stripped === "" ? null : stripped;
|
|
6
|
+
}
|
|
7
|
+
export function optionalText(value) {
|
|
8
|
+
return text(typeof value === "string" ? value : null);
|
|
9
|
+
}
|
|
10
|
+
/** Keep leading and trailing breaks so a one-line task check sees them. */
|
|
11
|
+
export function rawText(value) {
|
|
12
|
+
return typeof value === "string" ? value : null;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PACKAGE_VERSION: string;
|
package/dist/version.js
ADDED
package/dist/workspace.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { readFileSync
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ConfigurationError } from "@nodeint/migent-kernel";
|
|
4
|
+
import { isFile } from "./fs-utils.js";
|
|
4
5
|
let invocationCwd = null;
|
|
5
6
|
export function setInvocationCwd(cwd) {
|
|
6
7
|
invocationCwd = cwd === undefined ? null : path.resolve(cwd);
|
|
@@ -24,12 +25,12 @@ export function resolvePrompt(args) {
|
|
|
24
25
|
if (args.promptStdin) {
|
|
25
26
|
const text = readFileSync(0, "utf8");
|
|
26
27
|
if (text === "")
|
|
27
|
-
throw new
|
|
28
|
+
throw new ConfigurationError("Prompt from stdin is empty.");
|
|
28
29
|
return text;
|
|
29
30
|
}
|
|
30
31
|
if (args.promptFile == null) {
|
|
31
32
|
if (args.prompt == null)
|
|
32
|
-
throw new
|
|
33
|
+
throw new ConfigurationError("Pass one of --prompt, --file, or --stdin.");
|
|
33
34
|
return args.prompt;
|
|
34
35
|
}
|
|
35
36
|
try {
|
|
@@ -37,14 +38,6 @@ export function resolvePrompt(args) {
|
|
|
37
38
|
}
|
|
38
39
|
catch (error) {
|
|
39
40
|
const reason = error instanceof Error ? error.message : String(error);
|
|
40
|
-
throw new
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function isFile(filePath) {
|
|
44
|
-
try {
|
|
45
|
-
return statSync(filePath).isFile();
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return false;
|
|
41
|
+
throw new ConfigurationError(`Unable to read prompt file: ${args.promptFile} (${reason})`);
|
|
49
42
|
}
|
|
50
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeint/migent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Compose AI coding agents into repeatable engineering workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@clack/prompts": "^1.8.1",
|
|
46
|
-
"@nodeint/migent-adapters": "0.1.
|
|
47
|
-
"@nodeint/migent-kernel": "0.1.
|
|
48
|
-
"@nodeint/migent-registry": "0.1.
|
|
46
|
+
"@nodeint/migent-adapters": "0.1.5",
|
|
47
|
+
"@nodeint/migent-kernel": "0.1.5",
|
|
48
|
+
"@nodeint/migent-registry": "0.1.5",
|
|
49
49
|
"commander": "^14.0.2",
|
|
50
50
|
"picocolors": "^1.1.1"
|
|
51
51
|
},
|