@hagicode/cli 0.1.0-dev.47.1.f8624d4 → 0.1.0-dev.49.1.aa038f5
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 +12 -4
- package/dist/chunks/{main-CAH7GrRu.js → main-D5eiMFz8.js} +124 -117
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/resources/saga/.gitignore +1 -1
- package/resources/saga/manifest.json +2 -2
- package/resources/saga/prompts/run.md +5 -3
- package/skills/hagi/SKILL.md +4 -4
- package/skills/hagi/references/cli-usage.md +9 -4
- package/skills/hagi/references/saga.md +42 -4
- package/skills/hagi/references/session-data.md +3 -1
- package/skills/hagi/references/validation.md +15 -0
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./chunks/main-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./chunks/main-D5eiMFz8.js");s.runCli().then(e=>{e!==0&&(process.exitCode=e)}).catch(e=>{const n=e instanceof Error?e.stack??e.message:String(e);process.stderr.write(`${n}
|
|
3
3
|
`),process.exitCode=s.EXIT_CODES.UNKNOWN});
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/main-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/main-D5eiMFz8.js");exports.createCliApp=e.createCliApp;exports.runCli=e.runCli;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/cli",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.49.1.aa038f5",
|
|
4
4
|
"description": "HagiCode CLI for project, proposal, vault, chat, and AutoTask management.",
|
|
5
5
|
"homepage": "https://github.com/HagiCode-org/cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
**/runtime/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"files": {
|
|
4
|
-
".gitignore": "
|
|
4
|
+
".gitignore": "b43c8b58f191b9e0a0b54b6938c0aa4685d70b8f4ae2294c83a9ad6e728b7c0a",
|
|
5
5
|
"prompts/acceptance.md": "11ca06794d0ec19e87d1a4e883a67014563e9750b9fa62a8bedd43a69d52ca65",
|
|
6
6
|
"prompts/amend.md": "be621d1221a85656851548aee1e9e9d78480288bd856baf1bdbf50cb3317f49b",
|
|
7
7
|
"prompts/goal.md": "a545b01c9f6010df661f02cf62ef9bcae527ccf329f304ea82ffdda239b118df",
|
|
8
8
|
"prompts/plan.md": "bcc4c0509f2971083775db2b3678f41c55f16e69deba2d994d3ed636f314d917",
|
|
9
9
|
"prompts/research.md": "2504283ea845440c7909ff1da20bfb70f846d55ca16565740168848cfb8060b1",
|
|
10
|
-
"prompts/run.md": "
|
|
10
|
+
"prompts/run.md": "aaf8a667c163afea0796a8c80d5760ee689923a76b0c7f1855e55405d9b0b5d0"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -8,11 +8,13 @@ You are the orchestrator. You dispatch work and keep the record. You do not plan
|
|
|
8
8
|
1. **Freeze.** `hagi saga freeze <saga> --path <root> --token <token>`. If it refuses (open questions, open amendments, a changed contract), run `hagi saga set-status <saga> --state paused --note "<reason>" --path <root> --token <token>`, stop and report the reasons. Do not edit contract files and do not decide open questions. A first freeze writes revision 1. After an amendment was merged it writes the next revision, chained to the previous one, and reopens the items whose acceptance command changed.
|
|
9
9
|
2. **Check before every item and at every heartbeat.** `hagi saga assert-owner <saga> --path <root> --token <token>` before each dispatch, then `hagi saga check <saga> --phase run --path <root>`. If a check fails, pause the same way and report. An open amendment also means: pause.
|
|
10
10
|
3. **Work one item at a time** (`hagi saga items <saga> --path <root>` lists them with their commands), unless the goal allows parallel items. For each item:
|
|
11
|
+
- Create each Worker with `hagi saga session create --saga <saga> --path <root> --title "<ITEM> <role>" --role <role> --master <your session id> --item <ITEM>`, where `<role>` is `implementation` or `verification`. This command takes the token from `SAGA_EXECUTION_TOKEN`, set to the token that `claim` printed, and refuses `--token`. It creates the chat session with its Saga metadata and records it in `sessions.md`. Then give the Worker its instructions below.
|
|
11
12
|
- An implementation worker writes code and tests only. Give it the goal, the item, the scope and the safety rules, the project root and its report path.
|
|
12
13
|
- A separate verification worker runs the item's command from `acceptance.md` in the project root, writes the output to `<root>/.hagicode/sagas/<saga>/runtime/evidence/<ITEM>.log`, and writes `<root>/.hagicode/sagas/<saga>/runtime/reports/<ITEM>.md` with the line `Status: PASS` (or `状态: PASS`) only if the exit code is 0. It changes no files.
|
|
13
14
|
- Only `hagi saga tick <saga> <ITEM> --path <root> --token <token>` ticks an item. It refuses without a PASS report and an evidence file.
|
|
14
15
|
4. **On a failed verification, classify it.** An environment fault (missing module, port in use, quota) does not count. A real failure counts: give a tuning worker the failure log path, then verify again. After 3 real failures run `hagi saga block <saga> <ITEM> "<reason>" --path <root> --token <token>` and move on.
|
|
15
16
|
5. **After a revision reopened items,** also re-verify any item whose command is the full regression: its own command did not change, so it was not reopened.
|
|
16
|
-
6. **Keep the record.** Append a line to `<root>/.hagicode/sagas/<saga>/runtime/orchestrator-log.md` after every dispatch, verification and tick.
|
|
17
|
-
7. **
|
|
18
|
-
8. **
|
|
17
|
+
6. **Keep the record.** Append a line to `<root>/.hagicode/sagas/<saga>/runtime/orchestrator-log.md` after every dispatch, verification and tick. `hagi saga session create` records each Worker session it creates in `<root>/.hagicode/sagas/<saga>/runtime/sessions.md`, so do not append those sessions to that file by hand. Run `hagi saga set-status <saga> --state running --note "<heartbeat>" --path <root> --token <token>` at every heartbeat, and `hagi saga status <saga> --path <root> --json` to read the projection at the end.
|
|
18
|
+
7. **Archive each settled item's sessions.** Once an item is ticked or blocked and its workers have stopped, archive the worker sessions you created for it: `hagi chat archive --session-id <session id> --json`. Take the IDs from `<root>/.hagicode/sagas/<saga>/runtime/sessions.md`. Archive only sessions you created in this run: never your own orchestrator session, a session that is still running, a session you did not create, or the Saga itself (`hagi saga archive` is not part of a run). Archiving leaves the reports, evidence and `sessions.md` record in `runtime/` untouched. Log each archived ID in `orchestrator-log.md`. If an archive call fails, log the error and go on: do not retry in a loop and do not pause for it.
|
|
19
|
+
8. **Never leave a command hanging.** Every shell command must end on its own: never read from standard input, and give waits a limit. If something does not answer, report it instead of waiting forever.
|
|
20
|
+
9. **Stop** when every item is ticked or blocked, when a pause condition appears, or when the human's run options say so. Write the terminal snapshot first (`set-status --state done` only when every active item is verified, otherwise `paused` with the reason). Once every worker has stopped, archive any remaining worker sessions as in step 7, then run `hagi saga release <saga> --path <root> --token <token> --workers-settled`. Never archive the Saga itself and do not commit. Report the revision, every item with its state and evidence path, the blocked items with reasons, the sessions you created and which of them you archived, and the next step for a human.
|
package/skills/hagi/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ Use this skill when the user asks to:
|
|
|
12
12
|
- enable or disable a built-in skill
|
|
13
13
|
- run or verify the `hagi` CLI
|
|
14
14
|
- run, explain, or verify local `saga init`, `saga new`, `saga list`, `saga status`, or `saga items` operations
|
|
15
|
-
- run, explain, or verify local Saga ownership, checks, and writes: `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, `archive`
|
|
15
|
+
- run, explain, or verify local Saga ownership, checks, and writes: `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, `archive`, and `session create` (Saga Worker chat sessions)
|
|
16
16
|
- explain or execute `project`, `proposal`, `chat`, `hagitask`, `vault`, `plan`, `skills`, or `saga` commands
|
|
17
17
|
- explain the OpenSpec workflow behind `proposal` commands, which stage each command starts, or how to follow a run until it settles
|
|
18
18
|
- take turns on a shared resource (a game server, a test environment) with other agents through `hagi agent lock`
|
|
@@ -40,7 +40,7 @@ Use this skill when the user asks to:
|
|
|
40
40
|
5. Source-tree development in `repos/cli` -> read [`references/local-development.md`](references/local-development.md)
|
|
41
41
|
6. Post-change validation -> read [`references/validation.md`](references/validation.md)
|
|
42
42
|
7. The user's own data, inside a HagiCode session -> read [`references/session-data.md`](references/session-data.md)
|
|
43
|
-
8. Local Saga initialization, creation, list, status, item queries, ownership, checks, freeze, ticks, status writes, amendments, or
|
|
43
|
+
8. Local Saga initialization, creation, list, status, item queries, ownership, checks, freeze, ticks, status writes, amendments, archive, or creating and recording Saga Worker sessions (`session create`) -> read [`references/saga.md`](references/saga.md)
|
|
44
44
|
9. A shared resource that other agents also use, or any `hagi agent lock` command -> read [`references/resource-lock.md`](references/resource-lock.md)
|
|
45
45
|
|
|
46
46
|
When `hagi` is loaded as a built-in skill inside a HagiCode session, read item 7 first for any question about the user's own data or skills, before the other references.
|
|
@@ -89,7 +89,7 @@ The current top-level command families are:
|
|
|
89
89
|
- `agent`
|
|
90
90
|
- `saga`
|
|
91
91
|
|
|
92
|
-
`hagi saga` provides `init`, `new`, `list`, `status`, and `items`, plus the write and check commands `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, and `archive
|
|
92
|
+
`hagi saga` provides `init`, `new`, `list`, `status`, and `items`, plus the write and check commands `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, and `archive`, and `session create`, which creates a Saga Worker chat session and records it. Mutating commands take `--token` or `SAGA_EXECUTION_TOKEN`; `session create` takes only `SAGA_EXECUTION_TOKEN`. With `--path`, these operate on host-local files without reading backend configuration or calling the API, except `session create`, which calls the backend to find the registered project; `--project-id` resolves a project through the backend. Creating a Worker changes state, so run `session create` only when the user or a Saga run explicitly asks for it. See [`references/saga.md`](references/saga.md) for initialization, creation, offline behavior, and read-only query guarantees.
|
|
93
93
|
|
|
94
94
|
`project repositories --id <project-id>` is read-only. It lists one project's repositories with each path relative to the project root (for example `repos/cli`). Those paths are the values a proposal's `Repository scope` names; see [`references/proposal-flow.md`](references/proposal-flow.md#repository-scope).
|
|
95
95
|
|
|
@@ -122,6 +122,6 @@ Each family also reads one session by id. `proposal get` and `hagitask get` read
|
|
|
122
122
|
- [`references/openspec-workflow.md`](references/openspec-workflow.md) - the OpenSpec stage each proposal command starts, stage boundaries, who drives each step, and the monitoring rule
|
|
123
123
|
- [`references/super-commit.md`](references/super-commit.md) - Super Commit: starting it by prompt id, its options, result reading and the explicit-request rule
|
|
124
124
|
- [`references/resource-lock.md`](references/resource-lock.md) - the shared resource lock: numbers, owner, exit codes, the watcher protocol, the seven agent rules and requisition
|
|
125
|
-
- [`references/saga.md`](references/saga.md) - local initialization, creation, ownership, checks, Saga writes, and read-only queries
|
|
125
|
+
- [`references/saga.md`](references/saga.md) - local initialization, creation, ownership, checks, Saga writes, Saga Worker sessions (`session create`), and read-only queries
|
|
126
126
|
- [`references/local-development.md`](references/local-development.md) - maintainer-only development, build, and repository internals
|
|
127
127
|
- [`references/validation.md`](references/validation.md) - targeted verification after documentation or code changes
|
|
@@ -56,7 +56,7 @@ Example:
|
|
|
56
56
|
hagi --base-url https://api.example.com --token "$HAGI_TOKEN" project list --json
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Saga commands using `--path` accept these flags but do not read backend configuration or contact the backend.
|
|
59
|
+
Saga commands using `--path` accept these flags but do not read backend configuration or contact the backend, except `saga session create`, which calls the backend to find the registered project.
|
|
60
60
|
|
|
61
61
|
## Environment variables
|
|
62
62
|
|
|
@@ -83,7 +83,7 @@ The file is `$XDG_CONFIG_HOME/hagi/config.json`, or `~/.config/hagi/config.json`
|
|
|
83
83
|
Base URL precedence, highest first: `--base-url`, then `HAGI_API_BASE_URL`, then `baseUrl` in the config file.
|
|
84
84
|
There is no default. When none of the three is set, a backend operation exits with code `2` and names all three sources.
|
|
85
85
|
The local Saga selector `--path` is the exception: it does not read this file, so malformed, unreachable, or absent backend
|
|
86
|
-
settings do not affect that local operation.
|
|
86
|
+
settings do not affect that local operation. The one exception is `saga session create`, which calls the backend even with `--path`.
|
|
87
87
|
|
|
88
88
|
## Command overview
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ hagi
|
|
|
92
92
|
|-- project list | repositories | create | update | delete
|
|
93
93
|
| `-- monospecs show | init | set | validate | reload | clone | remove-checkout
|
|
94
94
|
|-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send | get | messages
|
|
95
|
-
|-- saga init | new | list | status | items | claim | assert-owner | release | freeze | check | tick | block | set-status | amend | archive
|
|
95
|
+
|-- saga init | new | list | status | items | claim | assert-owner | release | freeze | check | tick | block | set-status | amend | archive | session create
|
|
96
96
|
|-- vault list | create | update | delete
|
|
97
97
|
| `-- files list | preview
|
|
98
98
|
|-- chat list | create | archive | delete | send
|
|
@@ -109,7 +109,8 @@ hagi
|
|
|
109
109
|
Each command requires exactly one nonempty project selector:
|
|
110
110
|
|
|
111
111
|
- `--path <directory>` resolves a local directory on the CLI host. Relative paths use the current working directory. This
|
|
112
|
-
selector does not read backend configuration or make API calls,
|
|
112
|
+
selector does not read backend configuration or make API calls, except in `saga session create`, which looks up the
|
|
113
|
+
registered project through the backend. Shared backend flags do not change its behavior otherwise.
|
|
113
114
|
- `--project-id <id>` reads the project list through the configured backend. Its project path must be a directory available
|
|
114
115
|
on the machine running the CLI; the CLI does not execute filesystem operations remotely.
|
|
115
116
|
|
|
@@ -125,8 +126,12 @@ hagi saga items demo --path "./My Project" --json
|
|
|
125
126
|
hagi saga claim demo --path "./My Project" --session orchestrator-1 --json
|
|
126
127
|
hagi saga check demo --path "./My Project" --phase run --json
|
|
127
128
|
hagi saga tick demo T1 --path "./My Project" --token "$SAGA_EXECUTION_TOKEN" --json
|
|
129
|
+
hagi saga session create --saga demo --path "./My Project" --title "T1 implementation" --role implementation --master orchestrator-1 --item T1 --json
|
|
128
130
|
```
|
|
129
131
|
|
|
132
|
+
`saga session create` takes its execution token from `SAGA_EXECUTION_TOKEN` only; `--token` is refused. It creates a Worker
|
|
133
|
+
chat session and records it in `runtime/sessions.md`. See [`saga.md`](saga.md#worker-sessions) for its metadata, record and exit codes.
|
|
134
|
+
|
|
130
135
|
For offline use, invoke an installed package or a package already present in the `npx` cache. An uncached
|
|
131
136
|
`npx @hagicode/cli` command may need network access to download the package; the local `--path` operation itself does not
|
|
132
137
|
need backend access.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Saga files are project-local. Select exactly one project with `--path <directory>` or `--project-id <id>` for every
|
|
4
4
|
Saga command. A local `--path` is resolved on the CLI host and does not read backend configuration or make API calls.
|
|
5
|
+
The one exception is `session create` (see [Worker sessions](#worker-sessions)), which calls the backend even with `--path`
|
|
6
|
+
to find the registered project.
|
|
5
7
|
|
|
6
8
|
## Initialize managed resources
|
|
7
9
|
|
|
@@ -20,7 +22,7 @@ installed. The command prints each file's `created`, `unchanged`, `merged`, `rep
|
|
|
20
22
|
with code `4` if any conflicts remain. Use `--force` to replace differing managed resources with the bundled versions;
|
|
21
23
|
identical resources remain untouched. Forced initialization never discards custom `.gitignore` entries.
|
|
22
24
|
|
|
23
|
-
The `.gitignore` rule
|
|
25
|
+
The `.gitignore` rule `**/runtime/` is merged as a separate exact line. Existing bytes, line endings, and entries are
|
|
24
26
|
preserved; LF and CRLF files are supported, and repeated initialization does not append duplicate rules.
|
|
25
27
|
|
|
26
28
|
Before writing, initialization checks that managed directories and files are not redirected, that resource targets are
|
|
@@ -83,7 +85,7 @@ unreadable existing data is reported instead of being repaired. ## Execution own
|
|
|
83
85
|
|
|
84
86
|
`claim`, `assert-owner`, and `release` manage `runtime/execute.lock`. Every mutating command (`freeze`, `tick`, `block`,
|
|
85
87
|
`set-status`, `amend`, `archive`, `release`, `assert-owner`) reads the execution token from `--token <token>` or, when
|
|
86
|
-
that flag is absent, from `SAGA_EXECUTION_TOKEN`.
|
|
88
|
+
that flag is absent, from `SAGA_EXECUTION_TOKEN`. The exception is `session create`, which reads only `SAGA_EXECUTION_TOKEN`.
|
|
87
89
|
|
|
88
90
|
```bash
|
|
89
91
|
hagi saga claim demo --path "./My Project" --session orchestrator-1
|
|
@@ -124,6 +126,42 @@ amendment is merged into `rN+1` and no frozen item disappeared without a superse
|
|
|
124
126
|
`runtime/history/rN/`. Every refusal (open question, unmerged amendment, plan mismatch, tampered contract, removed item)
|
|
125
127
|
lists each reason, exits `1`, and writes nothing.
|
|
126
128
|
|
|
129
|
+
## Worker sessions
|
|
130
|
+
|
|
131
|
+
Set `SAGA_EXECUTION_TOKEN` to the token that `claim` printed, then create a Worker and record it:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
hagi saga session create --saga demo --path "./My Project" --title "T1 implementation" --role implementation --master orchestrator-1 --item T1 --json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- The command creates one ordinary chat session in the project and appends one line to `runtime/sessions.md`. It sends
|
|
138
|
+
no message and does not archive the session; `hagi chat archive --session-id <id>` stays a separate step.
|
|
139
|
+
- Required and nonblank: `--saga <id>`, `--title <title>`, `--role implementation|verification`, and `--master <session-id>`
|
|
140
|
+
(the orchestrator's own session ID). `--item <id>` is optional. `--saga` and `--item` are identifiers: a path separator
|
|
141
|
+
or a traversal segment is a usage error (code `2`). Exactly one of `--path <directory>` or `--project-id <id>` is
|
|
142
|
+
required.
|
|
143
|
+
- The execution token comes only from `SAGA_EXECUTION_TOKEN`, which must be set and nonempty. `--token` is refused with
|
|
144
|
+
either selector as a usage error (code `2`), because the root `--token` is the backend bearer token and must never carry
|
|
145
|
+
the execution token. A missing token is also code `2`, and no request is sent.
|
|
146
|
+
- `--path` calls the backend: the command lists the registered projects and takes the one whose real path equals the
|
|
147
|
+
root. Projects whose path is missing on this host are skipped. Zero matches, or several, is a refusal (code `1`) that
|
|
148
|
+
names the path or the matching IDs, and creates nothing. `--project-id` looks the project up directly.
|
|
149
|
+
- After the project and the Saga are resolved, the owner check of `assert-owner` runs with the token. A Saga without a lock
|
|
150
|
+
still passes once a token is set. A wrong token is a refusal (code `1`), and an unknown Saga is code `24`.
|
|
151
|
+
- The new session's `userMetadata` holds `saga.id` (the Saga), `saga.role` (always `worker`), `saga.worker` (the `--role`
|
|
152
|
+
value), `saga.master` (the `--master` value), and `saga.item` only when `--item` is given. The backend checks the key
|
|
153
|
+
format (`^[a-z][a-z0-9._-]{0,63}$`), at most 16 entries, and value length (1 to 512 characters). The metadata is
|
|
154
|
+
write-once and readable by everyone who can read the session, so it groups Workers and is not a security boundary. The
|
|
155
|
+
token never appears in it. Workers created before this command carry no `saga.*` metadata and are not backfilled.
|
|
156
|
+
- The record is one line, `- <session-id> | <UTC time> | <role> | <item or -> | <title>`, appended after earlier content
|
|
157
|
+
in `<root>/.hagicode/sagas/<saga>/runtime/sessions.md`. The file and `runtime/` are created when missing. Whitespace in
|
|
158
|
+
the title, line breaks included, collapses to single spaces. A symbolic link or a redirected `runtime/` is refused
|
|
159
|
+
before the session is created.
|
|
160
|
+
- If the append fails after the session was created, the command exits `1` and names the created session ID, in the
|
|
161
|
+
human output and as `session.sessionId` in `--json` with `ok` false.
|
|
162
|
+
- `--json` success is one object: `{ "sagaId": "demo", "command": "session create", "ok": true, "session": { "sessionId": "...", "userMetadata": { ... } }, "record": "<path to sessions.md>" }`.
|
|
163
|
+
- Exit codes: `0` created and recorded; `1` refused, or the record failed after creation; `2` usage error; `24` Saga not found.
|
|
164
|
+
|
|
127
165
|
## Items, amendments, and archive
|
|
128
166
|
|
|
129
167
|
```bash
|
|
@@ -163,7 +201,7 @@ is replaced atomically, so a concurrent reader always sees a complete document.
|
|
|
163
201
|
|------|---------|
|
|
164
202
|
| `0` | Success. |
|
|
165
203
|
| `1` | Refusal or failed check. Every reason is printed; nothing was changed. |
|
|
166
|
-
| `2` | Usage error: bad selector, missing or invalid argument, or `--token` with `--project-id
|
|
204
|
+
| `2` | Usage error: bad selector, missing or invalid argument, or `--token` with `--project-id` (with either selector for `session create`). |
|
|
167
205
|
| `4` | Init resource conflict (see above). |
|
|
168
206
|
| `24` | Saga or project not found. |
|
|
169
207
|
| `30` | Operation failed, including a `new` collision. |
|
|
@@ -181,7 +219,7 @@ Human output prints a one-line outcome and one line per refusal reason.
|
|
|
181
219
|
|
|
182
220
|
Before any command writes a file under a Saga's `runtime/` directory (`claim`, `set-status`, `tick`, `block`, and a
|
|
183
221
|
`freeze` that moves history), it makes sure `.hagicode/sagas/.gitignore` ignores runtime directories. An existing
|
|
184
|
-
|
|
222
|
+
`**/runtime/` line is kept byte for byte; otherwise `**/runtime/` is appended with the file's line endings.
|
|
185
223
|
If the ignore file cannot be written, the command stops before `runtime/` is created.
|
|
186
224
|
|
|
187
225
|
## Read-only projection and ownership
|
|
@@ -141,11 +141,13 @@ A question such as "what is in my plan" is not a request to run, enable, disable
|
|
|
141
141
|
| `chat` | `create`, `archive`, `delete`, `send` |
|
|
142
142
|
| `hagitask` | `create`, `send` |
|
|
143
143
|
| `plan` | `create`, `update`, `enable`, `disable`, `delete`, `run` |
|
|
144
|
-
| `saga` | `init`, `new` |
|
|
144
|
+
| `saga` | `init`, `new`, `session create` |
|
|
145
145
|
| `skills` | `local enable`, `local disable`, `local uninstall`, `gallery install`, `trusted upsert`, `trusted delete`, `trusted reset` |
|
|
146
146
|
|
|
147
147
|
A `send` or `run` starts agent work, and `execute` and `generate` start it too. Treat those as changes of the same kind.
|
|
148
148
|
|
|
149
|
+
`saga session create` creates a chat session for a Saga Worker and records it in the Saga's `runtime/sessions.md`. Creating a Worker changes state, so run it only when the user or a Saga run explicitly asks for it. It takes the execution token from `SAGA_EXECUTION_TOKEN` only, and with `--path` it calls the backend to find the project. See [`saga.md`](saga.md#worker-sessions).
|
|
150
|
+
|
|
149
151
|
A `send` with Steer (`--steer`, or `HAGI_SEND_STEER` set in the calling shell) inserts its text into a running turn. The result says which happened: `steered` means a running task took it, and `queued` means no running task did, so it went out as the next message. `HAGI_SEND_STEER` belongs to the calling shell; the backend does not set it inside agent sessions.
|
|
150
152
|
|
|
151
153
|
`hagitask create` with a Super Commit prompt (`--prompt-id auto-compose-commit.<locale>`) creates commits in a code repository, and with `--need-push` publishes them. Start it only when the user asked for it in this conversation, and add `--need-push` only when the user asked for a push. See [`super-commit.md`](super-commit.md).
|
|
@@ -133,6 +133,21 @@ node ./dist/cli.js proposal --help
|
|
|
133
133
|
|
|
134
134
|
If only a specific command changed, also verify that command's help directly.
|
|
135
135
|
|
|
136
|
+
## Saga Worker session command
|
|
137
|
+
|
|
138
|
+
Run this when `src/commands/saga/session.ts`, the Saga runtime helpers (`project.ts`, `safeWrite.ts`, `sessionRecord.ts`),
|
|
139
|
+
the run prompt or these references changed:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cd repos/cli
|
|
143
|
+
pnpm exec vitest run tests/commands/saga-session-create.test.ts tests/runtime/saga/appendContained.test.ts tests/runtime/saga/project.test.ts tests/runtime/saga/sessionRecord.test.ts
|
|
144
|
+
pnpm exec vitest run tests/runtime/saga/assets.test.ts tests/docs
|
|
145
|
+
node ./dist/cli.js saga session create --help
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The command test covers argument validation, token rejection, selector matching, the `saga.*` metadata, the `sessions.md`
|
|
149
|
+
append and the failed-record report. The help check prints the parameters, the metadata keys and the metadata limits.
|
|
150
|
+
|
|
136
151
|
## Package publish-surface check
|
|
137
152
|
|
|
138
153
|
Run this when `package.json`, publish contents, or release metadata changed. The Saga asset check and the package check
|