@codetreker/daynight 0.22.1 → 0.24.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.
- package/README.md +307 -334
- package/config.example.yml +8 -4
- package/dist/api/client.d.ts +2 -2
- package/dist/api/client.js +10 -7
- package/dist/api/client.js.map +1 -1
- package/dist/api/types.d.ts +1 -8
- package/dist/cli/prompts.d.ts +1 -0
- package/dist/commands/auth/credentials.js +1 -1
- package/dist/commands/auth/credentials.js.map +1 -1
- package/dist/commands/review/config.js +0 -9
- package/dist/commands/review/config.js.map +1 -1
- package/dist/commands/review/configuration-guide.js +3 -2
- package/dist/commands/review/configuration-guide.js.map +1 -1
- package/dist/commands/review/repositories.js +11 -4
- package/dist/commands/review/repositories.js.map +1 -1
- package/dist/commands/skill/skills/using-daynight/references/execute-task-in-managed.md +6 -5
- package/dist/commands/skill/skills/using-daynight/references/handbook.md +1 -1
- package/dist/commands/skill/skills/using-daynight/references/handoff.md +1 -1
- package/dist/commands/worker/cleanup.d.ts +8 -2
- package/dist/commands/worker/cleanup.js +44 -160
- package/dist/commands/worker/cleanup.js.map +1 -1
- package/dist/commands/worker/config.d.ts +3 -3
- package/dist/commands/worker/config.js +0 -6
- package/dist/commands/worker/config.js.map +1 -1
- package/dist/commands/worker/control.d.ts +11 -18
- package/dist/commands/worker/control.js +75 -132
- package/dist/commands/worker/control.js.map +1 -1
- package/dist/commands/worker/coordinator.d.ts +10 -8
- package/dist/commands/worker/coordinator.js +311 -473
- package/dist/commands/worker/coordinator.js.map +1 -1
- package/dist/commands/worker/definition.js +9 -17
- package/dist/commands/worker/definition.js.map +1 -1
- package/dist/commands/worker/diagnostics.js +2 -3
- package/dist/commands/worker/diagnostics.js.map +1 -1
- package/dist/commands/worker/execution.d.ts +35 -10
- package/dist/commands/worker/execution.js +92 -283
- package/dist/commands/worker/execution.js.map +1 -1
- package/dist/commands/worker/herdr/agents.d.ts +12 -91
- package/dist/commands/worker/herdr/agents.js +111 -358
- package/dist/commands/worker/herdr/agents.js.map +1 -1
- package/dist/commands/worker/herdr/preflight.d.ts +21 -9
- package/dist/commands/worker/herdr/preflight.js +118 -124
- package/dist/commands/worker/herdr/preflight.js.map +1 -1
- package/dist/commands/worker/herdr.d.ts +7 -63
- package/dist/commands/worker/herdr.js.map +1 -1
- package/dist/commands/worker/identity.js +2 -2
- package/dist/commands/worker/identity.js.map +1 -1
- package/dist/commands/worker/index.d.ts +1 -0
- package/dist/commands/worker/index.js +6 -13
- package/dist/commands/worker/index.js.map +1 -1
- package/dist/commands/worker/prompts.d.ts +10 -3
- package/dist/commands/worker/prompts.js +21 -32
- package/dist/commands/worker/prompts.js.map +1 -1
- package/dist/commands/worker/remote.d.ts +2 -3
- package/dist/commands/worker/remote.js +1 -6
- package/dist/commands/worker/remote.js.map +1 -1
- package/dist/commands/worker/repositories.d.ts +20 -3
- package/dist/commands/worker/repositories.js +100 -21
- package/dist/commands/worker/repositories.js.map +1 -1
- package/dist/commands/worker/runtime.js +112 -217
- package/dist/commands/worker/runtime.js.map +1 -1
- package/dist/commands/worker/setup-environment.d.ts +31 -0
- package/dist/commands/worker/setup-environment.js +146 -0
- package/dist/commands/worker/setup-environment.js.map +1 -0
- package/dist/commands/worker/setup.d.ts +11 -0
- package/dist/commands/worker/setup.js +113 -0
- package/dist/commands/worker/setup.js.map +1 -0
- package/dist/commands/worker/store.d.ts +12 -114
- package/dist/commands/worker/store.js +92 -817
- package/dist/commands/worker/store.js.map +1 -1
- package/dist/commands/worker/types.d.ts +10 -114
- package/dist/commands/worker/worktrees.d.ts +9 -9
- package/dist/commands/worker/worktrees.js +77 -37
- package/dist/commands/worker/worktrees.js.map +1 -1
- package/dist/config/document.d.ts +0 -1
- package/dist/config/document.js +1 -14
- package/dist/config/document.js.map +1 -1
- package/dist/config/files.d.ts +7 -1
- package/dist/config/files.js +4 -1
- package/dist/config/files.js.map +1 -1
- package/dist/config/ownership.d.ts +12 -0
- package/dist/config/ownership.js +39 -0
- package/dist/config/ownership.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ daynight update
|
|
|
98
98
|
daynight login [--no-browser] # Authorize CLI access through the browser
|
|
99
99
|
daynight logout # Revoke and remove the current CLI credential
|
|
100
100
|
daynight worker # Show worker help
|
|
101
|
+
daynight worker setup # Check prerequisites and choose an agent and Projects
|
|
101
102
|
daynight worker run # Run until interrupted
|
|
102
103
|
daynight worker attach # Open the worker Herdr session
|
|
103
104
|
daynight worker repo list [--json]
|
|
@@ -106,7 +107,6 @@ daynight worker repo remove [--project <project-id>]
|
|
|
106
107
|
daynight worker retry <task-id> --claim-id <claim-id> [--project <project-id>]
|
|
107
108
|
daynight worker release <task-id> --claim-id <claim-id> --if-version <version> [--project <project-id>]
|
|
108
109
|
daynight worker resume <task-id> --claim-id <previous-claim-id> --if-version <version> [--project <project-id>]
|
|
109
|
-
daynight worker transfer <task-id> --claim-id <claim-id> --if-version <version> [target options] [--project <project-id>]
|
|
110
110
|
daynight review # Show review help
|
|
111
111
|
daynight review run
|
|
112
112
|
daynight review list # Also review ls
|
|
@@ -332,6 +332,14 @@ not loaded automatically. Repository paths resolve from the configuration
|
|
|
332
332
|
directory, with the rules in the [worker](#worker-configuration-and-startup) and
|
|
333
333
|
[review](#review-configuration-and-startup) guides.
|
|
334
334
|
|
|
335
|
+
Unknown fields at the root, in `review` or `worker`, and in their repository
|
|
336
|
+
entries are ignored at runtime and preserved by CLI configuration edits. Known
|
|
337
|
+
fields retain their type and value checks. Invalid YAML, duplicate keys and
|
|
338
|
+
invalid mapping structures remain errors. Every CLI configuration write, including
|
|
339
|
+
first-time `workerId` creation, preserves decoded values outside the fields it owns. If shared YAML aliases would change an unrelated value, the write fails
|
|
340
|
+
and retains the original file; separate those aliases before retrying. Unaffected
|
|
341
|
+
aliases remain valid.
|
|
342
|
+
|
|
335
343
|
Project and task commands use `https://daynight.cc` when the configuration file or
|
|
336
344
|
`serverUrl` is absent. A production connection needs no server configuration.
|
|
337
345
|
Run `daynight login` to display an authorization code and open the verification
|
|
@@ -782,23 +790,54 @@ records binary transport and output ownership.
|
|
|
782
790
|
|
|
783
791
|
## Worker configuration and startup
|
|
784
792
|
|
|
785
|
-
`daynight worker run` is a foreground
|
|
786
|
-
across configured repositories
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
793
|
+
`daynight worker run` is a foreground reconciler. It claims eligible ready tasks
|
|
794
|
+
across configured repositories, runs Copilot or Codex in private Herdr workspaces,
|
|
795
|
+
and cleans resources when the original claim leaves its complete inventory. The
|
|
796
|
+
agent owns delivery, acceptance, evidence and final claim-bound completion.
|
|
797
|
+
|
|
798
|
+
Start with interactive setup:
|
|
799
|
+
|
|
800
|
+
```bash
|
|
801
|
+
daynight login
|
|
802
|
+
daynight worker setup
|
|
803
|
+
daynight worker run
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
`setup` requires terminal input and stderr. It reports environment checks and
|
|
807
|
+
repair instructions, asks which native agent should execute tasks, then lists
|
|
808
|
+
existing accessible Projects with names, UUIDs and repository URLs. Select at
|
|
809
|
+
least one Project. Current Projects are preselected on repeat setup. The final
|
|
810
|
+
selection replaces the acquisition list, and the chosen agent applies to every
|
|
811
|
+
selected Project.
|
|
812
|
+
|
|
813
|
+
Matching registrations keep exact transport URLs and local paths. Compatible
|
|
814
|
+
models and arguments survive; switching agent clears incompatible global and
|
|
815
|
+
per-Project values. Setup previews Projects, paths, removed registrations and
|
|
816
|
+
native-setting resets before confirmation, then atomically saves agent settings
|
|
817
|
+
and the complete selection. Cancellation, invalid choices, inaccessible Project
|
|
818
|
+
inventory, related concurrent changes and write failures leave configuration
|
|
819
|
+
unchanged.
|
|
820
|
+
|
|
821
|
+
Local diagnostics inspect tools and integration settings without starting Herdr
|
|
822
|
+
or native agents. Missing prerequisites are reported together; selected-agent
|
|
823
|
+
checks use effective retained native arguments in the setup launch directory.
|
|
824
|
+
Missing native dependencies allow saving with a repair-needed result. Versions
|
|
825
|
+
and hook configuration do not prove provider authentication, future task-directory
|
|
826
|
+
trust, hook execution, live Herdr protocol, Git access or completed delivery.
|
|
827
|
+
Setup does not install tools, edit provider configuration, sign in, clone, open
|
|
828
|
+
worker state or acquire tasks. Unconfirmed probe-process cleanup is a failure,
|
|
829
|
+
including during cancellation.
|
|
790
830
|
|
|
791
831
|
Install Git, Herdr 0.9.5 or newer with protocol 22 capabilities, and the selected
|
|
792
|
-
native agent on PATH.
|
|
793
|
-
Herdr SessionStart integration
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
PR delivery, must
|
|
832
|
+
native agent on PATH. Configure native/provider credentials and the current
|
|
833
|
+
official Herdr SessionStart integration explicitly. Codex needs hooks and
|
|
834
|
+
`--no-daemon`; Unix hooks need bash and python3, while Windows hooks need
|
|
835
|
+
PowerShell. Inspect official integration with `herdr integration status`. Missing
|
|
836
|
+
capabilities and native launch failures remain visible;
|
|
837
|
+
the worker does not install or change global native configuration. Git transport
|
|
838
|
+
and task tools, such as authenticated GitHub CLI for PR delivery, must be ready.
|
|
799
839
|
|
|
800
|
-
|
|
801
|
-
existing accessible Projects:
|
|
840
|
+
Manage individual Project registrations with:
|
|
802
841
|
|
|
803
842
|
```bash
|
|
804
843
|
daynight worker repo add
|
|
@@ -806,14 +845,12 @@ daynight worker repo list
|
|
|
806
845
|
daynight worker repo remove
|
|
807
846
|
```
|
|
808
847
|
|
|
809
|
-
Add and remove
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
remain. A running worker reads its next selection at startup, without hot reload.
|
|
816
|
-
For scripts, identify one accessible existing Project explicitly:
|
|
848
|
+
Add and remove offer multiselection with each Project's name, complete UUID and
|
|
849
|
+
repoUrl. New entries save projectId, the original repository URL and an absolute
|
|
850
|
+
local path. Matching existing entries retain their transport URL, path and
|
|
851
|
+
agent settings; remote-only entries gain only projectId. Remove changes future
|
|
852
|
+
acquisition scope and preserves clones, claims, worktrees and native history.
|
|
853
|
+
For scripts, select one Project explicitly:
|
|
817
854
|
|
|
818
855
|
```bash
|
|
819
856
|
daynight worker repo add --project PROJECT_UUID
|
|
@@ -821,41 +858,36 @@ daynight worker repo remove --project PROJECT_UUID
|
|
|
821
858
|
daynight worker repo list --json
|
|
822
859
|
```
|
|
823
860
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
`worker
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
distinct, including the Daynight state directory. These commands do not clone
|
|
855
|
-
repositories, acquire tasks or start Herdr.
|
|
856
|
-
|
|
857
|
-
For explicit repository paths and runtime overrides, retain the shared
|
|
858
|
-
connection and review settings and configure `worker` directly:
|
|
861
|
+
List reads local registrations. Add and remove use existing remote Projects;
|
|
862
|
+
they do not create Projects, clone repositories, acquire tasks or start Herdr.
|
|
863
|
+
Cancellation, empty selection, failed remote reads and save errors leave the
|
|
864
|
+
selection unchanged.
|
|
865
|
+
|
|
866
|
+
With an empty repository list, interactive run guides the same selection before
|
|
867
|
+
starting tasks. Noninteractive startup requires a configured repository and
|
|
868
|
+
prints `worker repo add --project PROJECT_UUID` guidance. Service credentials
|
|
869
|
+
and selected worker settings come from one captured configuration source;
|
|
870
|
+
changed credentials require restarting the command. Startup resolves configured
|
|
871
|
+
Projects into the local projects table before reading claim inventory, including
|
|
872
|
+
when the state database is empty.
|
|
873
|
+
|
|
874
|
+
`worker.repositoryRoot` defaults to `~/daynights`, independently of review's
|
|
875
|
+
root. New registration expands the actual home shortcut or resolves a path
|
|
876
|
+
relative to config.yml; existing paths are retained when the root changes.
|
|
877
|
+
Ordinary repositories use `<root>/<host>/<owner>/<repo>`; generic transport,
|
|
878
|
+
user, port and nested-path identities use distinct encoded coordinates.
|
|
879
|
+
|
|
880
|
+
Network and prompts hold no configuration lock. The atomic writer rereads YAML,
|
|
881
|
+
preserves comments and unrelated edits, and refuses changed worker root,
|
|
882
|
+
repository selection or service credentials. Setup also protects observed global
|
|
883
|
+
agent/model/args values and saves those fields with the selected Projects. Repo
|
|
884
|
+
commands only own repositories; neither operation changes repositoryRoot. Shared aliases that would alter
|
|
885
|
+
unrelated effective settings are rejected; unaffected aliases remain valid.
|
|
886
|
+
Repository identities, Project IDs and physical paths must remain distinct,
|
|
887
|
+
including the Daynight state directory.
|
|
888
|
+
|
|
889
|
+
For explicit paths and runtime overrides, retain the shared service and review
|
|
890
|
+
settings and configure worker directly:
|
|
859
891
|
|
|
860
892
|
```yaml
|
|
861
893
|
worker:
|
|
@@ -876,304 +908,245 @@ worker:
|
|
|
876
908
|
args: []
|
|
877
909
|
```
|
|
878
910
|
|
|
879
|
-
These are the defaults for
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
service
|
|
890
|
-
when
|
|
891
|
-
existing roots and origins are verified without resetting
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
agent type
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
normal task update workflow after reading the current task/version. The worker
|
|
913
|
-
selects only ready, permitted tasks compatible with its actual platform; WSL
|
|
914
|
-
counts as Linux. It never enables that permission itself. Released tasks wait
|
|
915
|
-
for explicit management and do not immediately re-enter ordinary automatic
|
|
916
|
-
acquisition. Run the worker with:
|
|
911
|
+
These are the defaults for optional runtime fields. A missing file, omitted
|
|
912
|
+
worker mapping and `worker: {}` use the same defaults; omitted repositories is
|
|
913
|
+
an empty list. Worker never infers repositories from review. Reads do not create
|
|
914
|
+
or rewrite configuration. Unknown root, worker and repository-entry fields are
|
|
915
|
+
ignored at runtime and preserved during configuration edits. Known non-nullable
|
|
916
|
+
fields still reject explicit null, invalid types or values; malformed YAML,
|
|
917
|
+
filesystem failures and cancellation remain errors. model:null clears the model
|
|
918
|
+
setting.
|
|
919
|
+
|
|
920
|
+
Each repository requires remote/path and may specify projectId or agent/model/args.
|
|
921
|
+
The service Project must already exist and match the repository; use projectId
|
|
922
|
+
when remote discovery is ambiguous. Missing local repositories are cloned;
|
|
923
|
+
existing roots and origins are verified without resetting files or branches.
|
|
924
|
+
Credentials belong in native authentication configuration, outside repository
|
|
925
|
+
URLs and argument lists.
|
|
926
|
+
|
|
927
|
+
Entry paths are absolute or relative to the configuration directory, never the
|
|
928
|
+
launch directory. They do not expand tilde or accept Windows drive-relative
|
|
929
|
+
paths. Duplicate repositories/Projects and overlapping repository/state paths
|
|
930
|
+
are errors. maxConcurrent is positive, recoveryLimit is nonnegative, and
|
|
931
|
+
pollIntervalMs is a positive safe integer within the timer range.
|
|
932
|
+
|
|
933
|
+
Repository agent settings override fields independently for the same type.
|
|
934
|
+
Explicit null model or [] args clears that field; switching type clears omitted
|
|
935
|
+
model/args, and args replaces the list. Worker owns cwd/session/model/mode
|
|
936
|
+
arguments. Configuration loads at startup without hot reload. Each claim retains
|
|
937
|
+
its recorded agent type and native session ID; a restarted agent uses the current
|
|
938
|
+
settings appropriate to that type. Settings for another type are not applied to it.
|
|
939
|
+
|
|
940
|
+
New tasks have automatic execution disabled. Enable it explicitly through the
|
|
941
|
+
normal task update workflow after reading the current task and version. Worker
|
|
942
|
+
only acquires ready, permitted tasks compatible with its actual platform; WSL is
|
|
943
|
+
Linux. It never enables permission itself. Released tasks wait for explicit resume.
|
|
917
944
|
|
|
918
945
|
```bash
|
|
919
946
|
daynight worker run
|
|
920
947
|
```
|
|
921
948
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
The
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
949
|
+
First use generates and atomically saves stable root workerId. One instance owns
|
|
950
|
+
fixed `~/.daynight/worker/` state, its SQLite, lock, logs, temporary resources and
|
|
951
|
+
private Herdr. Each task uses branch `daynight/<task-id>` and directory
|
|
952
|
+
`<repository>/.worktrees/daynight/<task-id>`. Valid claims retain their dirty
|
|
953
|
+
worktree; task branches and commits remain after terminal cleanup.
|
|
954
|
+
|
|
955
|
+
The local database has exactly these business fields:
|
|
956
|
+
|
|
957
|
+
```text
|
|
958
|
+
projects(project_id, repo_url, local_path)
|
|
959
|
+
tasks(project_id, task_id, claim_id, status, agent, session_id)
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
Status is pending, active or done. Pending is an actual acquired claim waiting
|
|
963
|
+
for startup; active owns startup, running, recovery or cleanup responsibility;
|
|
964
|
+
done means the ended claim's resources have been cleaned. Completed rows remain,
|
|
965
|
+
and at most one claim for the same Project/task can be active. A removed config
|
|
966
|
+
entry stops new acquisition but its saved Project mapping continues reconciliation.
|
|
967
|
+
Mappings with unfinished tasks or actual managed resources cannot be rebound.
|
|
968
|
+
|
|
969
|
+
The state directory belongs to the configured single service, Daynight account
|
|
970
|
+
and workerId. Finish old executions before changing those identities and
|
|
971
|
+
rebuilding local state. The running process pins its startup authenticated user;
|
|
972
|
+
the six-column database does not retain prior-service or prior-account recovery
|
|
973
|
+
scopes. Existing detailed worker databases are not migrated: stop the old worker,
|
|
974
|
+
remove its old SQLite database yourself, and let the next run create the new
|
|
975
|
+
schema. The CLI never deletes it automatically. Keep workerId and native history.
|
|
976
|
+
|
|
977
|
+
Each reconciliation obtains the complete own-claim inventory for configured and
|
|
978
|
+
saved Projects. Still-owned local active tasks are queued for fresh target
|
|
979
|
+
observation and recovery before global Git discovery, so a sibling checkout's
|
|
980
|
+
filesystem error does not block an already-reserved task. New pending startup
|
|
981
|
+
and new claims still require complete global resource discovery. Failed or
|
|
982
|
+
partial reads are errors, not an empty inventory. Resources from unqueried or
|
|
983
|
+
unmapped Projects are preserved with a diagnostic.
|
|
984
|
+
|
|
985
|
+
Capacity is the claim-deduplicated union of active rows, actual owned resources,
|
|
986
|
+
already selected cleanup responsibilities and adapter stop confirmations still
|
|
987
|
+
pending. An orphan keeps its slot and same-task barrier until all cleanup has
|
|
988
|
+
finished, even without a local row or after its pane has closed. Git
|
|
989
|
+
markers identify a claim rather than a worker. A Git-only resource must be tied
|
|
990
|
+
to a local row, the private Herdr instance or a current own claim before this
|
|
991
|
+
worker can clean it; otherwise it is reported and preserved.
|
|
992
|
+
|
|
993
|
+
An unknown claim response emits Warning and creates no resources. The worker
|
|
994
|
+
finds the actual grant in a later complete inventory instead of replaying the
|
|
995
|
+
request. A late grant can remain pending while local active slots are full.
|
|
996
|
+
|
|
997
|
+
Pending startup and new acquisition both rotate Projects after each successful
|
|
998
|
+
slot allocation. Pending rows have priority, with stable task-ID order inside
|
|
999
|
+
each Project; new candidates retain server ready order. A busy Project does not
|
|
1000
|
+
fill every free slot before another Project gets its turn.
|
|
1001
|
+
|
|
1002
|
+
Native recovery uses current resources and the recorded session ID:
|
|
1003
|
+
|
|
1004
|
+
| State | Action |
|
|
1005
|
+
|---|---|
|
|
1006
|
+
| Matching agent is alive | Reconnect and observe without resending the startup prompt. |
|
|
1007
|
+
| Agent needs starting, session_id is present | Resume that native session using the recorded agent type. |
|
|
1008
|
+
| Agent needs starting, session_id is NULL | Emit Warning, start a fresh native conversation, and save its ID in the same row. |
|
|
1009
|
+
|
|
1010
|
+
When a native process must restart, the worker stops/closes an existing
|
|
1011
|
+
inactive workspace and creates a new one with the current native environment
|
|
1012
|
+
and an empty pane-level session reference. Herdr restore can retain the old
|
|
1013
|
+
native reference while restoring the shell without its extra launch environment.
|
|
1014
|
+
The saved SQLite session_id still selects resume or fresh startup; an inactive
|
|
1015
|
+
pane's retained reference is not saved as a newly observed session ID. A live
|
|
1016
|
+
agent keeps its current connection.
|
|
1017
|
+
|
|
1018
|
+
A non-NULL saved session ID remains the recovery identity. A different native
|
|
1019
|
+
ID reported during startup, live reconnection or before deferred input is an
|
|
1020
|
+
error: the saved ID is retained and that input is not sent. A genuine live
|
|
1021
|
+
agent's ID may fill a NULL record; inactive pane references remain excluded.
|
|
1022
|
+
|
|
1023
|
+
The NULL rule also covers interruption before a newly started native ID was saved.
|
|
1024
|
+
It retains the task, claim and worktree and requires no history scan or approval
|
|
1025
|
+
gate. A failed resume of a known ID remains an error. Launch/input receipts,
|
|
1026
|
+
process observations, retries and cleanup progress exist only in the current
|
|
1027
|
+
call or process. Recovery counts reset on restart; reaching recoveryLimit keeps
|
|
1028
|
+
the task active with a visible error until explicit retry or another run.
|
|
1029
|
+
|
|
1030
|
+
For human input, use another interactive terminal:
|
|
956
1031
|
|
|
957
1032
|
```bash
|
|
958
1033
|
daynight worker attach
|
|
959
1034
|
```
|
|
960
1035
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
and
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
with known original account scope advance; unknown-scope terminal/control
|
|
1007
|
-
intents remain preserved. Each job waits at most one second or its nearer
|
|
1008
|
-
original deadline, independently of pollIntervalMs. One task's held RPC does not
|
|
1009
|
-
postpone another task's next cleanup advance; per-task serialization still
|
|
1010
|
-
prevents overlapping operations on the same execution. There is no persisted job
|
|
1011
|
-
queue.
|
|
1012
|
-
|
|
1013
|
-
Ctrl+C stops acquisition and ordinary input, cancels and joins the ordinary
|
|
1014
|
-
cleanup discovery loop and all per-claim jobs, then runs original-task shutdown
|
|
1015
|
-
with a separate bounded cancellation scope and a shared exit deadline.
|
|
1016
|
-
Unfinished claims, worktrees and native history remain; the private instance
|
|
1017
|
-
stops only after original agents are confirmed stopped. Stop uncertainty is
|
|
1018
|
-
reported and retains the instance/resources for inspection. Restart the command
|
|
1019
|
-
to reconcile with the same worker identity and original state. After consuming
|
|
1020
|
-
interrupted shutdown, the worker refreshes Herdr resources before ordinary
|
|
1021
|
-
execution. If a native launch may have occurred but its exact original session
|
|
1022
|
-
ID is missing, shutdown preserves its old binding, launch and PID evidence and
|
|
1023
|
-
pauses; it does not turn that execution into a first launch. Proven
|
|
1024
|
-
never-started work and executions with a known original native ID retain their
|
|
1025
|
-
normal recovery path.
|
|
1026
|
-
|
|
1027
|
-
A causal worker cancellation propagates into shutdown without adding a fault
|
|
1028
|
-
pause. Existing real pauses, recovery budget and unknown-action records keep
|
|
1029
|
-
their meaning; an unrelated error is not normal cancellation merely because the
|
|
1030
|
-
signal is already aborted. Read-only interruption followed by successful
|
|
1031
|
-
shutdown can resume the original session through the normal recovery path.
|
|
1032
|
-
|
|
1033
|
-
Pending successors whose resources, workspace and native launch are proven
|
|
1034
|
-
never started stay pending on normal exit. A successful complete inventory from
|
|
1035
|
-
the same original account can complete an absent unstarted claim directly,
|
|
1036
|
-
without activating it or touching an older claim's fixed Git path. Other tasks'
|
|
1037
|
-
shutdown initialization is isolated so one bad record does not prevent known
|
|
1038
|
-
agents stopping. Untracked resources or unknown scope keep the private instance
|
|
1039
|
-
when its stop cannot be confirmed.
|
|
1040
|
-
|
|
1041
|
-
Linux, Windows and macOS complete Goal acceptance is separate from the installed
|
|
1042
|
-
runtime and its component checks. The
|
|
1036
|
+
Attach opens only the existing private Herdr session. It needs no Daynight
|
|
1037
|
+
credential or service request, does not open SQLite or take the worker lock,
|
|
1038
|
+
and does not start a replacement daemon. Detaching leaves worker and tasks
|
|
1039
|
+
running. Original task panes retain their native XDG and private HISTFILE;
|
|
1040
|
+
client routing comes from the existing attachment descriptor.
|
|
1041
|
+
|
|
1042
|
+
Folder trust or authorization must be handled explicitly in the native tool or
|
|
1043
|
+
attached task pane. Worker retains input-readiness and supported Codex composer
|
|
1044
|
+
checks and does not auto-accept trust or alter global settings. Unknown layouts
|
|
1045
|
+
or launch errors remain visible. Reconnecting an already alive agent does not
|
|
1046
|
+
promise to resend an input lost across a process interruption.
|
|
1047
|
+
|
|
1048
|
+
When the original claim is absent from a successful complete inventory, the
|
|
1049
|
+
worker asks its agent to release attributable temporary files, services and
|
|
1050
|
+
processes outside the worktree. It waits at most ten minutes for this cleanup
|
|
1051
|
+
attempt, stops the agent, closes its workspace, removes the matching worktree
|
|
1052
|
+
and marks the local row done. Done, release and force withdrawal have the same terminal
|
|
1053
|
+
resource rule. Failed stop or deletion retains responsibility and the error.
|
|
1054
|
+
|
|
1055
|
+
Known-target cleanup and shutdown observe that Herdr execution directly;
|
|
1056
|
+
worktree deletion validates only its target Git registration and directory.
|
|
1057
|
+
Unrelated repository or sibling-worktree registration errors are reported
|
|
1058
|
+
separately and do not prevent a healthy agent from stopping.
|
|
1059
|
+
|
|
1060
|
+
Early cleanup completion uses only the successful cleanup-prompt receipt's
|
|
1061
|
+
idle, interactive-ready observation with both sequence counters present; later
|
|
1062
|
+
observations must advance both counters. A prior polling snapshot cannot supply
|
|
1063
|
+
that baseline. Busy, unknown, rejected or unattributable notification results
|
|
1064
|
+
retain the current bounded wait instead of counting an old task turn as cleanup.
|
|
1065
|
+
|
|
1066
|
+
Cleanup timing and progress are in memory. Polls do not extend the current
|
|
1067
|
+
attempt's deadline; after a crash, the next successful reconciliation observes
|
|
1068
|
+
remaining resources and starts a new cleanup attempt and timer. Cleanup prompts
|
|
1069
|
+
may repeat. Separate tasks have independent bounded jobs, so one held RPC does
|
|
1070
|
+
not postpone another task's cleanup. A cleanup already selected in the current
|
|
1071
|
+
process can continue during later service-read failures.
|
|
1072
|
+
|
|
1073
|
+
Ctrl+C stops acquisition and ordinary scheduling, then gives agents bounded
|
|
1074
|
+
outside-worktree cleanup, stops them and closes their workspaces. Valid claims,
|
|
1075
|
+
worktrees, session IDs and active/pending rows remain for the next run. The
|
|
1076
|
+
private instance stops last; exit failures remain visible.
|
|
1077
|
+
|
|
1078
|
+
stderr and JSONL logs identify worker, platform, Project/task/claim, agent and
|
|
1079
|
+
known session ID. Startup prints the log location and attach guidance. Logs are
|
|
1080
|
+
diagnostic only; they do not supply a second recovery ledger. The
|
|
1043
1081
|
[worker requirements](../../docs/spec/daynight-worker.md) and
|
|
1044
|
-
[
|
|
1045
|
-
mechanisms, including native capability limits.
|
|
1082
|
+
[design](../../docs/design/daynight-worker.md) own full behavior and validation.
|
|
1046
1083
|
|
|
1047
1084
|
## Worker manual management
|
|
1048
1085
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
for that execution. There is no separate control service. Current configuration
|
|
1054
|
-
and Daynight authentication are required, and the original service origin must
|
|
1055
|
-
match. Release, transfer and retry require the unfinished original local record;
|
|
1056
|
-
resume can use an explicit project with its configured repository.
|
|
1086
|
+
Stop `daynight worker run` before retry, release or resume. Each command
|
|
1087
|
+
acquires the same instance lock and synchronously handles one specified claim;
|
|
1088
|
+
an occupied lock returns an instruction to stop the runner. Management does not
|
|
1089
|
+
write a durable intent or coordinate through a background request queue.
|
|
1057
1090
|
|
|
1058
|
-
|
|
1091
|
+
Retry performs one attempt for an active claim still owned by this worker:
|
|
1059
1092
|
|
|
1060
1093
|
```bash
|
|
1061
|
-
daynight
|
|
1062
|
-
daynight worker release <task-id> --claim-id <source-claim-id> --if-version <version>
|
|
1094
|
+
daynight worker retry <task-id> --claim-id <claim-id> --project <project-id>
|
|
1063
1095
|
```
|
|
1064
1096
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
remote write at the exact supplied version. Other tasks keep their shared Herdr
|
|
1071
|
-
instance. Failed stopping or deletion retains the source responsibility and a
|
|
1072
|
-
visible error. Cleanup keeps its original deadline after restart; each HTTP
|
|
1073
|
-
request has an independent bounded scope, without a five-minute total command
|
|
1074
|
-
limit.
|
|
1075
|
-
|
|
1076
|
-
Release returns the task to `todo` and clears its execution interval. The daemon
|
|
1077
|
-
skips released tasks until explicitly resumed. Resume starts a fresh execution
|
|
1078
|
-
on this worker:
|
|
1097
|
+
It connects the live agent or resumes its recorded native session. NULL emits
|
|
1098
|
+
Warning and starts a fresh conversation in the same task worktree. The claim
|
|
1099
|
+
and agent type remain; pending rows are started through normal run scheduling.
|
|
1100
|
+
After the attempt, run connects to the actual surviving resource. Retry does not
|
|
1101
|
+
persist a permit or a cumulative cross-restart budget.
|
|
1079
1102
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
--project <project-id>
|
|
1083
|
-
```
|
|
1084
|
-
|
|
1085
|
-
The previous claim must still be released and the task ready. The original owner
|
|
1086
|
-
or a current project admin may resume it, retaining the explicit manual exception
|
|
1087
|
-
to automatic permission and platform filters. The new claim and worktree IDs are
|
|
1088
|
-
generated and persisted before submission. Its actual grant commits local
|
|
1089
|
-
`pending` with this repository's current effective agent/model/args; `worker run`
|
|
1090
|
-
then performs ordinary capacity checks and prepares a fresh native conversation.
|
|
1091
|
-
The deleted source worktree and native history are not required. Run
|
|
1092
|
-
`daynight worker run` if the foreground worker is stopped.
|
|
1093
|
-
|
|
1094
|
-
Transfer explicitly identifies the target's current user, stable worker and
|
|
1095
|
-
machine descriptor, actual platform and selected agent:
|
|
1103
|
+
Release validates current Project access, source owner/admin, original claim
|
|
1104
|
+
and exact supplied version. Its ordering is:
|
|
1096
1105
|
|
|
1097
|
-
```
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
--target-machine-id <machine-id> --target-machine-name "target-machine" \
|
|
1101
|
-
--target-platform linux --target-agent codex
|
|
1106
|
+
```text
|
|
1107
|
+
notify and stop agent → close workspace → submit remote change
|
|
1108
|
+
→ confirm source ownership ended → delete worktree → local done
|
|
1102
1109
|
```
|
|
1103
1110
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
matching type uses the current effective model/args. Existing pending snapshots
|
|
1109
|
-
are retained. The source operator's owner/admin permission is checked separately
|
|
1110
|
-
from the target's
|
|
1111
|
-
current membership. Transfer still requires automatic execution permission,
|
|
1112
|
-
platform compatibility and completed dependencies. It preserves `in_progress`
|
|
1113
|
-
and the task's execution interval, installing a fresh target claim/worktree ID
|
|
1114
|
-
with empty runtime associations. The receiver discovers its actual grant through
|
|
1115
|
-
normal claim inventory and starts a new execution; an old task path still in use
|
|
1116
|
-
blocks preparation. No source files, SQLite snapshots or native history are
|
|
1117
|
-
transported. Target and source agents may differ. Public commands provide no
|
|
1118
|
-
claim/worktree-ID override or continuity confirmation option; the service and
|
|
1119
|
-
typed client reject deprecated `continuityConfirmed` input.
|
|
1120
|
-
|
|
1121
|
-
For a paused execution that still belongs to the original owner, authorize one
|
|
1122
|
-
extra recovery attempt:
|
|
1111
|
+
The worktree is retained until remote confirmation. A refusal leaves it available
|
|
1112
|
+
for original execution recovery; success followed by local deletion failure is
|
|
1113
|
+
finished by the next run's ordinary absent-claim cleanup. Stopping failure cannot
|
|
1114
|
+
supply stoppedConfirmed. Explicit --if-version is never replaced during cleanup.
|
|
1123
1115
|
|
|
1124
1116
|
```bash
|
|
1125
|
-
daynight worker
|
|
1117
|
+
daynight worker release <task-id> --claim-id <claim-id> --if-version <version> \
|
|
1118
|
+
--project <project-id>
|
|
1126
1119
|
```
|
|
1127
1120
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
Concurrent or repeated requests do not accumulate extra authorization or launch
|
|
1131
|
-
a second agent. The controller consumes the single permit for that original
|
|
1132
|
-
execution; a further failure remains visible. Retry cannot replace terminal
|
|
1133
|
-
cleanup or recreate an execution that has ended.
|
|
1134
|
-
|
|
1135
|
-
A native launch acknowledged before a blocking startup screen has a specific
|
|
1136
|
-
continuation path when its first prompt is durably known unsent. Keep the
|
|
1137
|
-
original worker/native session running and use another terminal to attach to
|
|
1138
|
-
that original pane. Inspect the reported folder-trust/authorization requirement
|
|
1139
|
-
and make the native decision yourself. Once the business composer is available,
|
|
1140
|
-
run:
|
|
1121
|
+
Release returns the task to todo and clears its execution interval. Ordinary
|
|
1122
|
+
automatic acquisition skips released tasks until explicitly resumed:
|
|
1141
1123
|
|
|
1142
1124
|
```bash
|
|
1143
|
-
daynight worker
|
|
1125
|
+
daynight worker resume <task-id> --claim-id <released-claim-id> --if-version <version> \
|
|
1126
|
+
--project <project-id>
|
|
1144
1127
|
```
|
|
1145
1128
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
the
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
worker, without taking over resource control or resubmitting. An already-cleaned
|
|
1168
|
-
source is not restarted. Only a definitely rejected submission can be replaced by a new explicit
|
|
1169
|
-
decision, with the supplied `--if-version` matching a fresh task observation. The
|
|
1170
|
-
numeric version may remain the same when the refusal did not change the task,
|
|
1171
|
-
including a definite pre-dispatch failure or permission refusal. An unknown
|
|
1172
|
-
submission cannot be reset or replayed; `--if-version` is never silently replaced.
|
|
1173
|
-
Unknown resume requests likewise retain their original claim/worktree/config
|
|
1174
|
-
until the actual grant can be confirmed. These targeted reads reconcile manual
|
|
1175
|
-
writes; automatic cleanup still relies only on a complete successful inventory
|
|
1176
|
-
for the original authenticated user and worker.
|
|
1129
|
+
Resume requires the previous released claim, ready task and original owner/admin.
|
|
1130
|
+
It preserves the explicit manual permission/platform exception, obtains fresh
|
|
1131
|
+
claim/worktree identities with current settings, and registers pending with a
|
|
1132
|
+
NULL native session ID. Start run to execute it.
|
|
1133
|
+
|
|
1134
|
+
Web task details show the current claiming user, machine, agent and phase. The
|
|
1135
|
+
original owner or a project admin can confirm **Force withdraw** for active or
|
|
1136
|
+
released ownership. This submits the reviewed claim ID and exact version,
|
|
1137
|
+
atomically clears worker ownership, returns the task to `todo`, clears both
|
|
1138
|
+
execution timestamps and sets `allowAgents=false`. Other task materials remain.
|
|
1139
|
+
It requires no stopped confirmation and does not guarantee that the remote agent
|
|
1140
|
+
stops immediately. On its next successful complete own-claim inventory, the
|
|
1141
|
+
original worker discovers its claim is absent and starts terminal cleanup.
|
|
1142
|
+
Automatic selection stays disabled until explicitly enabled again. There is no
|
|
1143
|
+
CLI withdrawal command or target-execution handoff.
|
|
1144
|
+
|
|
1145
|
+
Fresh IDs are generated and printed before remote submission. An unknown response
|
|
1146
|
+
is reconciled by GET without replaying the write. If the result remains unknown
|
|
1147
|
+
or the command is interrupted, inspect the remote task and claim before starting
|
|
1148
|
+
run again; management has no cross-process intent continuation. A definite refusal
|
|
1149
|
+
allows a new explicit decision with a freshly observed exact version.
|
|
1177
1150
|
|
|
1178
1151
|
## Review configuration and startup
|
|
1179
1152
|
|
|
@@ -1197,14 +1170,14 @@ All review settings belong under the `review` mapping. The same YAML also
|
|
|
1197
1170
|
accepts the server client's `serverUrl` and optional `serverToken` fields, the
|
|
1198
1171
|
`worker` mapping and generated `workerId`. Review validates its own fields
|
|
1199
1172
|
independently of server business values. The server projection requires a valid HTTP(S) origin and
|
|
1200
|
-
validates any configured token and its transport. The shared parser
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1173
|
+
validates any configured token and its transport. The shared parser rejects invalid YAML, duplicate keys and a non-mapping root.
|
|
1174
|
+
Unknown fields at the root, inside `review` or `worker`, and in their repository
|
|
1175
|
+
entries are ignored by runtime projections and preserved by configuration edits.
|
|
1176
|
+
Known fields retain their type and value validation. Registration can add the
|
|
1177
|
+
first review repository to a server-only file while preserving its settings and
|
|
1178
|
+
comments. Flat review settings are ignored; move `repositoryRoot`, `repositories`,
|
|
1179
|
+
numeric options and Copilot options under `review` to use them. The CLI does not
|
|
1180
|
+
migrate these fields.
|
|
1208
1181
|
|
|
1209
1182
|
A configuration with an explicit addition root is:
|
|
1210
1183
|
|
|
@@ -1256,7 +1229,7 @@ configuration containing `serverToken` uses POSIX mode `0600`; without a token,
|
|
|
1256
1229
|
existing file-mode behavior is preserved.
|
|
1257
1230
|
|
|
1258
1231
|
Numeric options use the documented [configuration defaults](../../docs/design/daynight-review.md#使用方式与配置)
|
|
1259
|
-
when omitted. Explicit invalid values
|
|
1232
|
+
when omitted. Explicit invalid values for known fields, duplicate YAML keys and
|
|
1260
1233
|
malformed documents produce nonzero exits with useful errors. Missing configuration
|
|
1261
1234
|
triggers the [configuration setup](#configuration-setup) rules before review
|
|
1262
1235
|
startup. Duplicate repository identities,
|