nawabari 0.12.2 → 0.14.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 +70 -247
- package/dist/cli-command-registry.d.ts +17 -3
- package/dist/cli-command-registry.js +25 -10
- package/dist/cli-command-registry.js.map +1 -1
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +107 -8
- package/dist/cli.js.map +1 -1
- package/dist/contract.js +33 -1
- package/dist/contract.js.map +1 -1
- package/dist/control-repositories.d.ts +43 -0
- package/dist/control-repositories.js +187 -0
- package/dist/control-repositories.js.map +1 -0
- package/dist/control-server-lease.d.ts +34 -0
- package/dist/control-server-lease.js +303 -0
- package/dist/control-server-lease.js.map +1 -0
- package/dist/control-server-request-pool.d.ts +70 -0
- package/dist/control-server-request-pool.js +473 -0
- package/dist/control-server-request-pool.js.map +1 -0
- package/dist/control-server.d.ts +37 -0
- package/dist/control-server.js +334 -0
- package/dist/control-server.js.map +1 -0
- package/dist/control-web.d.ts +10 -0
- package/dist/control-web.js +236 -0
- package/dist/control-web.js.map +1 -0
- package/dist/domain/doctor.d.ts +10 -1
- package/dist/domain/doctor.js +12 -3
- package/dist/domain/doctor.js.map +1 -1
- package/dist/domain/filesystem-policy-decision.d.ts +42 -2
- package/dist/domain/filesystem-policy-decision.js +61 -22
- package/dist/domain/filesystem-policy-decision.js.map +1 -1
- package/dist/domain/filesystem-policy-evidence.d.ts +12 -1
- package/dist/domain/filesystem-policy-evidence.js +89 -1
- package/dist/domain/filesystem-policy-evidence.js.map +1 -1
- package/dist/domain/filesystem-policy.js +29 -51
- package/dist/domain/filesystem-policy.js.map +1 -1
- package/dist/domain/implementation-execution-scope-resolver.d.ts +31 -0
- package/dist/domain/implementation-execution-scope-resolver.js +135 -0
- package/dist/domain/implementation-execution-scope-resolver.js.map +1 -0
- package/dist/domain/repository-observation-service.d.ts +9 -0
- package/dist/domain/repository-observation-service.js +164 -0
- package/dist/domain/repository-observation-service.js.map +1 -0
- package/dist/domain/repository-runtime-coordination-collector.d.ts +12 -0
- package/dist/domain/repository-runtime-coordination-collector.js +23 -0
- package/dist/domain/repository-runtime-coordination-collector.js.map +1 -0
- package/dist/domain/repository-runtime-filesystem-collector.d.ts +37 -0
- package/dist/domain/repository-runtime-filesystem-collector.js +438 -0
- package/dist/domain/repository-runtime-filesystem-collector.js.map +1 -0
- package/dist/domain/repository-runtime-lifecycle-collector.d.ts +9 -0
- package/dist/domain/repository-runtime-lifecycle-collector.js +180 -0
- package/dist/domain/repository-runtime-lifecycle-collector.js.map +1 -0
- package/dist/domain/repository-runtime-process-collector.d.ts +15 -0
- package/dist/domain/repository-runtime-process-collector.js +198 -0
- package/dist/domain/repository-runtime-process-collector.js.map +1 -0
- package/dist/domain/repository-runtime-profile-collector.d.ts +19 -0
- package/dist/domain/repository-runtime-profile-collector.js +310 -0
- package/dist/domain/repository-runtime-profile-collector.js.map +1 -0
- package/dist/domain/sandbox-launcher.js +7 -1
- package/dist/domain/sandbox-launcher.js.map +1 -1
- package/dist/domain/session-actions.d.ts +85 -0
- package/dist/domain/session-actions.js +762 -0
- package/dist/domain/session-actions.js.map +1 -0
- package/dist/domain/session-backend.d.ts +20 -4
- package/dist/domain/session-backend.js +159 -41
- package/dist/domain/session-backend.js.map +1 -1
- package/dist/domain/session-console.d.ts +1 -0
- package/dist/domain/session-console.js +11 -1
- package/dist/domain/session-console.js.map +1 -1
- package/dist/domain/session.d.ts +14 -3
- package/dist/domain/session.js.map +1 -1
- package/dist/domain/worktree-file-operation.d.ts +7 -2
- package/dist/domain/worktree-file-operation.js +12 -12
- package/dist/domain/worktree-file-operation.js.map +1 -1
- package/dist/git.d.ts +35 -0
- package/dist/git.js +377 -0
- package/dist/git.js.map +1 -1
- package/dist/public-contract.d.ts +4 -2
- package/dist/public-contract.js +11 -2
- package/dist/public-contract.js.map +1 -1
- package/dist/registry/atomic.d.ts +8 -2
- package/dist/registry/atomic.js +8 -23
- package/dist/registry/atomic.js.map +1 -1
- package/dist/registry/errors.d.ts +1 -1
- package/dist/registry/errors.js +0 -8
- package/dist/registry/errors.js.map +1 -1
- package/dist/registry/repository-state-boundary.d.ts +50 -0
- package/dist/registry/repository-state-boundary.js +129 -0
- package/dist/registry/repository-state-boundary.js.map +1 -0
- package/dist/registry/runtime-records.d.ts +23 -10
- package/dist/registry/runtime-records.js +236 -8
- package/dist/registry/runtime-records.js.map +1 -1
- package/dist/registry/types.d.ts +0 -9
- package/dist/registry/types.js +0 -1
- package/dist/registry/types.js.map +1 -1
- package/dist/registry.d.ts +0 -1
- package/dist/registry.js +0 -1
- package/dist/registry.js.map +1 -1
- package/dist/resource-coordination-compatibility.d.ts +7 -0
- package/dist/resource-coordination-compatibility.js +250 -0
- package/dist/resource-coordination-compatibility.js.map +1 -0
- package/dist/resource-handoff.js +11 -4
- package/dist/resource-handoff.js.map +1 -1
- package/dist/session-lifecycle-actions.d.ts +29 -0
- package/dist/session-lifecycle-actions.js +37 -0
- package/dist/session-lifecycle-actions.js.map +1 -1
- package/dist/session-lifecycle-classification.d.ts +3 -3
- package/dist/session-lifecycle-classification.js.map +1 -1
- package/dist/session-parking.d.ts +12 -39
- package/dist/session-parking.js +34 -268
- package/dist/session-parking.js.map +1 -1
- package/dist/session-registry.d.ts +61 -20
- package/dist/session-registry.js +1231 -243
- package/dist/session-registry.js.map +1 -1
- package/dist/state/session/guards.d.ts +8 -0
- package/dist/state/session/guards.js +21 -1
- package/dist/state/session/guards.js.map +1 -1
- package/dist/state/session/machine.d.ts +81 -3
- package/dist/state/session/machine.js +176 -5
- package/dist/state/session/machine.js.map +1 -1
- package/dist/state/session/types.d.ts +48 -3
- package/dist/state/session/types.js +3 -0
- package/dist/state/session/types.js.map +1 -1
- package/dist/ui/repository-terminal.d.ts +1 -1
- package/dist/ui/repository-terminal.js +6 -4
- package/dist/ui/repository-terminal.js.map +1 -1
- package/dist/ui/session-actions.d.ts +2 -77
- package/dist/ui/session-actions.js +2 -710
- package/dist/ui/session-actions.js.map +1 -1
- package/dist/verification-executor.d.ts +46 -0
- package/dist/verification-executor.js +232 -0
- package/dist/verification-executor.js.map +1 -1
- package/dist/working-set.d.ts +11 -1
- package/dist/working-set.js +14 -0
- package/dist/working-set.js.map +1 -1
- package/dist/worktree-profile-cli.d.ts +32 -0
- package/dist/worktree-profile-cli.js +41 -4
- package/dist/worktree-profile-cli.js.map +1 -1
- package/package.json +10 -6
- package/dist/registry/store.d.ts +0 -38
- package/dist/registry/store.js +0 -156
- package/dist/registry/store.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,303 +2,126 @@
|
|
|
2
2
|
<img src="./docs/assets/readme/nawabari-hero.webp" alt="Nawabari — Git Worktree Isolation." width="100%">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
|
-
<a href="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
-
<a href="https://www.npmjs.com/package/nawabari"><img alt="npm" src="https://img.shields.io/npm/v/nawabari"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/nawabari"><img alt="Node" src="https://img.shields.io/node/v/nawabari"></a>
|
|
9
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/nawabari"></a>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
5
|
# Nawabari
|
|
13
6
|
|
|
14
|
-
Nawabari is a local
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
This README describes the current 0.10.x product model. It is an overview and navigation surface, not a copy of generated contracts or implementation history.
|
|
7
|
+
Nawabari is a machine-local runtime for coding-agent sessions. It binds each session to an owned Git worktree and
|
|
8
|
+
mutable branch, checks declared access and coordination boundaries, and supports protected execution on Linux.
|
|
9
|
+
Repository ownership remains independent for each local Git repository; a shared remote does not merge local authority.
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
Nawabari owns local execution and recovery, not task selection, semantic orchestration, or GitHub Issue/PR governance.
|
|
12
|
+
Local ownership operations do not require GitHub, `gh`, or a particular agent runtime. Explicit Git push/fetch operations
|
|
13
|
+
and caller programs may use the network.
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
5. Handle claim conflicts from machine-readable evidence and typed lifecycle actions.
|
|
28
|
-
6. Reconcile stale or inconsistent physical state through the canonical operation.
|
|
29
|
-
7. Close or discard according to the lifecycle authority.
|
|
30
|
-
8. Confirm convergence with `doctor` and garbage-collection observation.
|
|
15
|
+
The [accepted Target Architecture](docs/architecture/index.md) defines the design to which the product must converge.
|
|
16
|
+
The [implementation status](docs/architecture/implementation-status.md) distinguishes that target from the current code.
|
|
17
|
+
This documentation adoption does not implement parking, change claim enforcement, repair Control Server authentication,
|
|
18
|
+
add a singleton lease, or strengthen filesystem durability by itself.
|
|
31
19
|
|
|
32
|
-
|
|
20
|
+
## Install and discover
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Node.js 24 or newer is required.
|
|
22
|
+
Use Node.js 24 or newer.
|
|
37
23
|
|
|
38
24
|
```bash
|
|
39
25
|
npm install -g nawabari
|
|
40
26
|
nawabari --version
|
|
41
|
-
git nawabari --help
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
The package installs both `nawabari` and `git-nawabari`; `git nawabari ...` works as Git's external subcommand.
|
|
45
|
-
|
|
46
|
-
## Canonical routine-use workflow
|
|
47
|
-
|
|
48
|
-
Run from the repository's integration worktree. The following bootstrap uses the
|
|
49
|
-
same public option shape as the packed routine-use certification. Omit the
|
|
50
|
-
auxiliary declaration when the session needs no declared repository-local state;
|
|
51
|
-
do not replace it with an arbitrary host path.
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
27
|
nawabari capabilities --json
|
|
55
|
-
nawabari
|
|
56
|
-
|
|
57
|
-
auxiliary_state='{"source":{"kind":"repository-local","path":".codegraph/ignored"},"target":{"kind":"managed-worktree","path":".codegraph/ignored"},"mode":"copy","durability":"durable"}'
|
|
58
|
-
created=$(git nawabari session create \
|
|
59
|
-
--branch feature/example \
|
|
60
|
-
--resource README.md --mode write \
|
|
61
|
-
--auxiliary-state "$auxiliary_state" \
|
|
62
|
-
--json)
|
|
63
|
-
session_id=$(printf '%s' "$created" | jq -r .session_id)
|
|
64
|
-
worktree=$(printf '%s' "$created" | jq -r .worktree)
|
|
65
|
-
|
|
66
|
-
(cd "$worktree" && git nawabari session show --session "$session_id" --json)
|
|
67
|
-
(cd "$worktree" && git nawabari session claims --session "$session_id" --json)
|
|
68
|
-
(cd "$worktree" && git nawabari session inspect --session "$session_id" --schema-version 2 --json)
|
|
69
|
-
|
|
70
|
-
(cd "$worktree" && git nawabari session claim --session "$session_id" --resource contract-lifecycle.txt --mode exclusive-write --json)
|
|
71
|
-
(cd "$worktree" && git nawabari authorize --session "$session_id" --operation source-write --resource contract-lifecycle.txt --json)
|
|
72
|
-
(cd "$worktree" && "$EDITOR" contract-lifecycle.txt)
|
|
73
|
-
(cd "$worktree" && git nawabari evidence snapshot --session "$session_id" --json)
|
|
74
|
-
(cd "$worktree" && git nawabari checkpoint --session "$session_id" --json)
|
|
75
|
-
(cd "$worktree" && git nawabari commit --session "$session_id" --message "Exercise governed lifecycle" --resource contract-lifecycle.txt --json)
|
|
76
|
-
(cd "$worktree" && git nawabari push --session "$session_id" --remote origin --branch feature/example --resource contract-lifecycle.txt --create-upstream --json)
|
|
28
|
+
git nawabari session create --help --json
|
|
77
29
|
```
|
|
78
30
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
31
|
+
The package installs `nawabari` and `git-nawabari`; Git discovers the latter as `git nawabari`.
|
|
32
|
+
Use installed help and capabilities for exact supported commands, schemas, options, and failure codes.
|
|
33
|
+
Package version, persisted schema version, claim schema version, and public contract identity are distinct.
|
|
82
34
|
|
|
83
|
-
|
|
35
|
+
## Local session workflow
|
|
84
36
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`--all-claimed` is an explicit resource selector. It resolves safely observed Git-changed paths covered by qualifying claims; it does not bypass claim authorization. Use repeated `--resource <path>` when an explicit path list is preferable.
|
|
90
|
-
|
|
91
|
-
After reviewing and integrating the session branch through the caller's normal local Git/provider process:
|
|
37
|
+
From the repository's integration worktree, create a session and retain the returned identity and worktree path.
|
|
38
|
+
The default session does not require resource claims for otherwise-valid session-owned operations.
|
|
39
|
+
Worktree/branch ownership, applicable scope restrictions, and conflicts with another session's claims remain enforced.
|
|
92
40
|
|
|
93
41
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
42
|
+
nawabari session create --branch feature/example --json
|
|
43
|
+
nawabari session show --session "$session_id" --json
|
|
44
|
+
nawabari session inspect --session "$session_id" --schema-version 2 --json
|
|
96
45
|
```
|
|
97
46
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
If the lifecycle result exposes a recoverable blocker, follow its typed `next_action`/`next_actions` entry. `reconcile-physical-state` is the non-mutating observation action (its command is `doctor`). Its explicit apply action is `reconcile-physical-state-apply`, and its exact command is:
|
|
47
|
+
Set `session_id` and the working directory from the create result; do not use another session's worktree.
|
|
48
|
+
For explicit claim enforcement, declare it at creation:
|
|
101
49
|
|
|
102
50
|
```bash
|
|
103
|
-
|
|
51
|
+
nawabari session create --branch feature/claimed --enforce-claims \
|
|
52
|
+
--resource README.md --mode write --json
|
|
104
53
|
```
|
|
105
54
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
After
|
|
109
|
-
the repository integration worktree:
|
|
55
|
+
Commit and push are explicit governed operations with concrete resources. On claim-enforced sessions, their required
|
|
56
|
+
claim strength is discovered from the operation contract. Integration/review decisions remain caller-owned.
|
|
57
|
+
After integration, inspect and close. A blocked close does not authorize discard.
|
|
110
58
|
|
|
111
59
|
```bash
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
## Authority model
|
|
117
|
-
|
|
118
|
-
Each boundary has one job and one local authority. README summarizes the product contract; executable code and machine-readable projections remain authoritative for exact schemas, transitions, and failure vocabularies.
|
|
119
|
-
|
|
120
|
-
| Boundary | What it answers | Typical commands |
|
|
121
|
-
| ---------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
122
|
-
| Session lifecycle | Which session owns a worktree/branch and whether it can safely progress or terminate | `session create`, `session inspect`, `session close` |
|
|
123
|
-
| Resource Claims | Which session may access a canonical repository resource and at what mode | `session claim`, `session claims`, `session update`, `session release` |
|
|
124
|
-
| Mutation authorization | Whether a concrete operation has sufficient claims and no conflicting owner | `guard`, `authorize`, `commit`, `push` |
|
|
125
|
-
| Repository evidence | What Git can observe about revisions, paths, changes, ancestry, and bounded diffs | `checkpoint`, `evidence snapshot`, `diff` |
|
|
126
|
-
| Auxiliary state | Whether explicitly declared durable repository-local state may be copied into the managed worktree | `session create --auxiliary-state`, `capabilities` |
|
|
127
|
-
| Reconciliation/cleanup | Whether observed physical state permits a lifecycle recovery or cleanup action | `session inspect`, `session reconcile`, `doctor`, `gc` |
|
|
128
|
-
| Protected execution | Whether a command runs inside the opt-in Linux process/filesystem boundary | `session run`, `session exec`, `session shell`, `doctor` |
|
|
129
|
-
|
|
130
|
-
Claims are not task labels and do not encode GitHub or agent semantics. `write` permits ordinary path changes; `exclusive-write` is required for finalizing operations such as commit and push. Conflicting or ambiguous claims fail closed.
|
|
131
|
-
|
|
132
|
-
The default governance path does not install hooks and does not prevent direct filesystem writes outside Nawabari. Its guarantee is that Nawabari-routed operations consult authoritative session, Git, and claim state before mutation.
|
|
133
|
-
|
|
134
|
-
Nawabari's authority ends at local session ownership, claims, Git evidence, and the lifecycle of the managed worktree and branch. Task meaning, Issue/PR state, review decisions, and provider/GitHub state remain outside that authority.
|
|
135
|
-
|
|
136
|
-
### Claim conflict and physical recovery
|
|
137
|
-
|
|
138
|
-
`RESOURCE_CLAIM_CONFLICT` does not always mean stale state. A healthy owner is reported with `ownerState: "active"`; the certified contention path exposes `inspect-blocking-session` and `wait-for-conflicting-claim-release` safe actions without a reconciliation `nextAction`. Inspect the owner and wait for the legitimate claim release; do not remove another session's claim.
|
|
139
|
-
|
|
140
|
-
For a stale or inconsistent owner, the machine result instead carries physical and lifecycle evidence such as `ownerPhysicalState: "prunable-missing"`, `ownerLifecycleState: "stale-inconsistent"`, and the typed `nextAction.actionId: "reconcile-physical-state"`. Inspect it first:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
git nawabari session inspect --session "$owner_session_id" --schema-version 2 --json
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Then use the explicit apply operation shown above and retry the original claim after it completes. Age or a missing path alone is not destructive authority. The packed test removes a worktree only as external fault injection; supported recovery does not involve editing the session registry manually or deleting a raw Git worktree.
|
|
147
|
-
|
|
148
|
-
## Session and resource lifecycle
|
|
149
|
-
|
|
150
|
-
The normal path is:
|
|
151
|
-
|
|
152
|
-
```text
|
|
153
|
-
session create (explicit initial claims)
|
|
154
|
-
↓
|
|
155
|
-
inspect session/claims → claim/authorize → checkpoint → commit or push
|
|
156
|
-
↓ ↓
|
|
157
|
-
inspect readiness integrate the branch
|
|
158
|
-
↓ ↓
|
|
159
|
-
session close or discard ←─────────────────────────┘
|
|
160
|
-
↓
|
|
161
|
-
doctor + gc --dry-run convergence check
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
If work is not integrated, `session inspect` reports bounded blockers and safe next actions. Discard is never an implicit fallback for close or garbage collection.
|
|
165
|
-
|
|
166
|
-
The Session lifecycle is backed by the executable XState authority in 0.10.x and exposed through public state, contract, and manifest projections. Consumers use those projections rather than internal machine nodes or actor objects.
|
|
167
|
-
|
|
168
|
-
### Claims
|
|
169
|
-
|
|
170
|
-
Claims are canonical repository-relative resource records attached to a session. Supported modes are `read`, `write`, and `exclusive-write`. The canonical routine path establishes its first claim during `session create`; later additions, transitions, and releases use the existing claim surfaces.
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
git nawabari session claim --session "$session_id" --resource src/example.ts --mode exclusive-write --json
|
|
174
|
-
git nawabari session claims --session "$session_id" --json
|
|
175
|
-
git nawabari session update --session "$session_id" --resource src/example.ts --mode exclusive-write --resource test/example.test.ts --mode write --if-generation 1 --json
|
|
176
|
-
git nawabari session release --session "$session_id" --all --force --json
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Resource aliases are discoverable through help. Use `--help --json` rather than copying option metadata into an integration.
|
|
180
|
-
|
|
181
|
-
Claim modes are cumulative. The canonical operation requirements are derived from the operation authorization policy and are shown by `session claim --help`:
|
|
182
|
-
|
|
183
|
-
- `read`: no governed operation
|
|
184
|
-
- `write`: `source-write`, `stage`
|
|
185
|
-
- `exclusive-write`: `source-write`, `stage`, `commit`, `branch-mutation`, `push`, `cleanup`
|
|
186
|
-
|
|
187
|
-
The policy requires `exclusive-write` for operations that finalize or remove shared state. This mapping is documentation of the executable authority, not a second claim policy; integrations should discover the current values from help or the machine contract.
|
|
188
|
-
|
|
189
|
-
### Inspect, close, discard, and garbage collection
|
|
190
|
-
|
|
191
|
-
`session inspect` is read-only and uses the same close/cleanup evidence as `session close`. Use `--schema-version 2` when consuming the single-authority lifecycle and action projection.
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
git nawabari session inspect --session "$session_id" --json
|
|
195
|
-
git nawabari session discard --session "$session_id" --preview --json
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
`session discard` requires an explicit session ID and may destroy unintegrated commits and uncommitted work in that session's worktree. Preview reports bounded destructive scope without mutation. Actual discard revalidates repository, worktree, branch, `HEAD`, and registry ownership before destructive steps.
|
|
199
|
-
|
|
200
|
-
When the caller intentionally abandons the session, apply that explicit
|
|
201
|
-
decision with `git nawabari session discard --session "$session_id" --json`.
|
|
202
|
-
Discard is not an automatic fallback for a blocked close.
|
|
203
|
-
|
|
204
|
-
`gc --dry-run` reports stale candidates and blockers. `gc --apply` only cleans candidates passing the same safety checks; elapsed age alone is diagnostic suspicion, not destructive authority. `doctor` reports prerequisite and reconciliation state without silently repairing ownership. Use the typed lifecycle action and explicit `session reconcile` operation for supported stale/inconsistent-owner recovery; `doctor` does not silently repair it.
|
|
205
|
-
|
|
206
|
-
## Governed Git work
|
|
207
|
-
|
|
208
|
-
`guard` and `authorize` are separate read-only boundaries:
|
|
209
|
-
|
|
210
|
-
- `guard` without an operation verifies the current physical worktree, branch, and session ownership/context. It does not evaluate resource claims.
|
|
211
|
-
- `authorize` evaluates a named operation against concrete resources, using the canonical operation policy and active claims. It does not grant or persist claims.
|
|
212
|
-
- `guard --operation <name> --resource <path>` remains a compatibility convenience for the combined claim-aware check. Use `authorize` when the operation decision itself is the intended boundary.
|
|
213
|
-
|
|
214
|
-
The operation vocabulary is discoverable from the CLI and includes `source-write`, `stage`, `commit`, `branch-mutation`, `push`, and `cleanup`.
|
|
215
|
-
|
|
216
|
-
`checkpoint` and `evidence snapshot` describe Git-observable facts only. They do not infer task meaning, Issue ownership, or review status. `diff` requires explicit concrete paths and bounds optional patch output.
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
git nawabari commit --session "$session_id" --message "Update example" --resource src/example.ts --json
|
|
220
|
-
git nawabari commit --session "$session_id" --message "Update example" --all-claimed --json
|
|
221
|
-
git nawabari push --session "$session_id" --remote origin --branch feature/example --all-claimed --json
|
|
60
|
+
nawabari session close --session "$session_id" --json
|
|
61
|
+
nawabari gc --dry-run --json
|
|
62
|
+
nawabari doctor --json
|
|
222
63
|
```
|
|
223
64
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
65
|
+
See [current CLI workflows](docs/reference/cli-workflows.md) for bounded working sets, auxiliary state, claims,
|
|
66
|
+
Git mutation, explicit discard, reconciliation, and bootstrap retry. Target park/resume semantics are documented in
|
|
67
|
+
[session lifecycle](docs/architecture/session-lifecycle.md), not advertised here as implemented commands.
|
|
227
68
|
|
|
228
|
-
|
|
229
|
-
git nawabari session run --session "$session_id" --runtime-policy strict -- node worker.js
|
|
230
|
-
git nawabari session exec --session "$session_id" -- npm test
|
|
231
|
-
git nawabari session shell --session "$session_id" --runtime-policy compatibility
|
|
232
|
-
```
|
|
69
|
+
## Execution guarantees
|
|
233
70
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
Protected execution
|
|
71
|
+
An ordinary session is an ownership boundary, not automatic OS isolation. Direct edits by a host process with ambient
|
|
72
|
+
permissions remain outside the mediated-operation guarantee.
|
|
73
|
+
Protected execution requires the selected Linux sandbox and explicit runtime material. Managed execution additionally
|
|
74
|
+
uses durable execution ownership, launch admission, and owned process/cgroup evidence. These are separate capabilities;
|
|
75
|
+
a generic sandbox-ready result does not prove managed-runtime readiness.
|
|
237
76
|
|
|
238
77
|
```bash
|
|
239
|
-
|
|
78
|
+
nawabari session run --session "$session_id" --runtime-policy strict -- node worker.js
|
|
240
79
|
```
|
|
241
80
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
81
|
+
Strict execution does not silently fall back to host PATH, HOME, broad mounts, or compatibility mode.
|
|
82
|
+
Network mode remains `inherited`; filesystem isolation does not imply isolation from host loopback services.
|
|
83
|
+
See [runtime/process](docs/architecture/runtime-process.md), [runtime reference](docs/reference/runtime-projection.md),
|
|
84
|
+
and [security policy](SECURITY.md) before interpreting a capability or isolation claim.
|
|
245
85
|
|
|
246
|
-
|
|
86
|
+
## Optional local Control Server
|
|
247
87
|
|
|
248
88
|
```bash
|
|
249
|
-
nawabari
|
|
250
|
-
nawabari --
|
|
251
|
-
nawabari session create --help --json
|
|
252
|
-
nawabari session inspect --help --json
|
|
253
|
-
nawabari session reconcile --help --json
|
|
254
|
-
nawabari commit --help --json
|
|
89
|
+
nawabari server
|
|
90
|
+
nawabari server --port 47472
|
|
255
91
|
```
|
|
256
92
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
JSON mode emits one bounded document on stdout. Consumers should use machine-readable fields and stable codes rather than parse human-oriented text.
|
|
260
|
-
|
|
261
|
-
The command surface includes Session lifecycle, Resource Claims, authorization/evidence, governed Git commit/push, reconciliation/discovery, and protected execution. Use `--help --json` and `capabilities --json` for the authoritative inventory. Human-readable guidance and agent integrations use these same command and action identifiers; there is no separate human or agent workflow.
|
|
93
|
+
The current foreground server binds only `127.0.0.1`, defaults to port `47471`, and serves known repositories through one
|
|
94
|
+
browser endpoint. CLI and TUI work without it. Stop it with Ctrl-C or SIGTERM.
|
|
262
95
|
|
|
263
|
-
|
|
96
|
+
**Current limitation:** the implementation audited for this adoption bootstraps its control token into the unauthenticated
|
|
97
|
+
root document. With inherited host networking, this is not an isolation boundary against untrusted local/protected
|
|
98
|
+
processes. Do not treat concurrent untrusted workloads and this server as a securely separated operator interface.
|
|
99
|
+
The accepted target requires trusted-host-only credential delivery; that repair remains implementation work.
|
|
100
|
+
Different ports also do not currently enforce the accepted machine/user singleton requirement.
|
|
264
101
|
|
|
265
|
-
|
|
102
|
+
The [control-surfaces contract](docs/architecture/control-surfaces.md) defines authentication, lifecycle, discovery,
|
|
103
|
+
concurrency, and projection boundaries without turning this optional server into a remote control plane.
|
|
266
104
|
|
|
267
|
-
|
|
105
|
+
## Public Node projections
|
|
268
106
|
|
|
269
107
|
```js
|
|
270
|
-
import {
|
|
271
|
-
availableNawabariCommands,
|
|
272
|
-
classifyNawabariState,
|
|
273
|
-
getNawabariSessionStateSnapshot,
|
|
274
|
-
nawabariTransitionDecision,
|
|
275
|
-
} from "nawabari/state";
|
|
276
|
-
|
|
108
|
+
import { getNawabariSessionStateSnapshot } from "nawabari/state";
|
|
277
109
|
import { nawabariMachineContract } from "nawabari/contract";
|
|
278
|
-
|
|
279
|
-
import { generateNawabariProductStateManifest, serializeNawabariProductStateManifest } from "nawabari/manifest";
|
|
110
|
+
import { generateNawabariProductStateManifest } from "nawabari/manifest";
|
|
280
111
|
```
|
|
281
112
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
These exports do not grant mutation authority and do not expose raw XState machines, actor references, internal state-node IDs, private context, or `dist/` deep imports. Mutations still go through authoritative runtime paths. See [XState state architecture](docs/architecture/xstate-state-architecture.md).
|
|
285
|
-
|
|
286
|
-
## Further reading
|
|
113
|
+
These exports expose read/classification/contract projections, not mutation permission or raw XState actors.
|
|
114
|
+
Do not deep-import private `dist` modules as a supported API.
|
|
287
115
|
|
|
288
|
-
|
|
289
|
-
- [Standalone Linux compatibility](docs/standalone-linux-compatibility.md): protected-execution compatibility and conformance details.
|
|
290
|
-
- [Release notes](docs/releases/): version-specific changes and migration context.
|
|
291
|
-
- [Contributing](CONTRIBUTING.md): development workflow and repository conventions.
|
|
292
|
-
- [Security policy](SECURITY.md): vulnerability reporting.
|
|
116
|
+
## Documentation and development
|
|
293
117
|
|
|
294
|
-
|
|
118
|
+
Start with the [documentation map](docs/index.md), [contribution workflow](CONTRIBUTING.md), and
|
|
119
|
+
[release history](docs/releases/). Development uses the exact `packageManager` declaration in `package.json`.
|
|
295
120
|
|
|
296
121
|
```bash
|
|
297
122
|
pnpm install --frozen-lockfile
|
|
298
|
-
pnpm run
|
|
299
|
-
pnpm run lint
|
|
300
|
-
pnpm run typecheck
|
|
301
|
-
pnpm test
|
|
123
|
+
pnpm run verify
|
|
302
124
|
```
|
|
303
125
|
|
|
304
|
-
|
|
126
|
+
Verification includes package and environment-dependent proofs. A missing sandbox, runtime material, or delegated cgroup
|
|
127
|
+
is not a successful security test. See the [proof matrix](docs/architecture/verification-provenance.md).
|
|
@@ -126,7 +126,7 @@ declare const REGISTRY_DATA: readonly [{
|
|
|
126
126
|
name: "--enforce-claims";
|
|
127
127
|
description: string;
|
|
128
128
|
} & CliHelpOptionSpec];
|
|
129
|
-
readonly notes: readonly ["All create options are optional. Use status --json to discover managed_worktree_root.", "--worktree and --worktree-root cannot be combined.", "--profile-parameter requires --profile; ambiguous unqualified profile ids are rejected.", "Initial claims are provisioned atomically with the session; each --resource must be immediately followed by its own --mode, and zero pairs remains backward compatible.", "Resource-claim enforcement is disabled by default; pass --enforce-claims to require claims for commit/push authorization on this session. Worktree and branch ownership, and claim conflicts against other sessions, remain enforced regardless.", "Providing one bounded working-set artifact requires the other; both are validated before worktree ownership is established.", "A claim conflict returns blocking-owner evidence. A durability-uncertain result is retry-safe only after re-reading the reported registry state; an existing owner is never silently adopted.", "Without an override, Nawabari creates the safe managed root <repository-parent>/.nawabari/worktrees on first use. Existing absolute worktree paths directly under the repository parent remain accepted for compatibility."];
|
|
129
|
+
readonly notes: readonly ["All create options are optional. Use status --json to discover managed_worktree_root.", "--worktree and --worktree-root cannot be combined.", "--profile-parameter requires --profile; ambiguous unqualified profile ids are rejected.", "Initial claims are provisioned atomically with the session; each --resource must be immediately followed by its own --mode, and zero pairs remains backward compatible.", "Resource-claim enforcement is disabled by default; pass --enforce-claims to require claims for commit/push authorization on this session. Worktree and branch ownership, and claim conflicts against other sessions, remain enforced regardless.", "Providing one bounded working-set artifact requires the other; both are validated before worktree ownership is established.", "Both JSON artifact formats and field semantics are documented in README Working-set artifacts; session show --json exposes working_set.revision for expansion.", "A claim conflict returns blocking-owner evidence. A durability-uncertain result is retry-safe only after re-reading the reported registry state; an existing owner is never silently adopted.", "Without an override, Nawabari creates the safe managed root <repository-parent>/.nawabari/worktrees on first use. Existing absolute worktree paths directly under the repository parent remain accepted for compatibility."];
|
|
130
130
|
}, {
|
|
131
131
|
readonly name: "session id";
|
|
132
132
|
readonly summary: "Resolve the current session identity";
|
|
@@ -246,7 +246,7 @@ declare const REGISTRY_DATA: readonly [{
|
|
|
246
246
|
name: "--unresolved";
|
|
247
247
|
description: string;
|
|
248
248
|
} & CliHelpOptionSpec];
|
|
249
|
-
readonly notes: readonly ["The current working-set revision is a mandatory CAS token; stale requests are rejected without mutation.", "READONLY is evaluated independently. Mutation classes also require the existing session claim authority.", "The execution-scope artifact must match the session's established provenance; it cannot widen Inari maximum authority."];
|
|
249
|
+
readonly notes: readonly ["The current working-set revision is a mandatory CAS token; stale requests are rejected without mutation.", "READONLY is evaluated independently. Mutation classes also require the existing session claim authority.", "The execution-scope artifact must match the session's established provenance; it cannot widen Inari maximum authority.", "Inspect session show --json working_set.revision and history; use the same bootstrap execution-scope JSON. See README Working-set artifacts."];
|
|
250
250
|
}, {
|
|
251
251
|
readonly name: "session reconcile";
|
|
252
252
|
readonly summary: "Apply bounded lifecycle reconciliation for one selected session";
|
|
@@ -317,7 +317,7 @@ declare const REGISTRY_DATA: readonly [{
|
|
|
317
317
|
} & {
|
|
318
318
|
readonly value: "<action-id>";
|
|
319
319
|
readonly required: true;
|
|
320
|
-
readonly values: readonly
|
|
320
|
+
readonly values: readonly import("./domain/session-actions.js").SessionActionId[];
|
|
321
321
|
}, {
|
|
322
322
|
name: "--token";
|
|
323
323
|
description: string;
|
|
@@ -345,6 +345,20 @@ declare const REGISTRY_DATA: readonly [{
|
|
|
345
345
|
readonly usage: "nawabari ui";
|
|
346
346
|
readonly options: readonly [];
|
|
347
347
|
readonly notes: readonly ["The UI reads one canonical repository runtime snapshot at startup and on refresh; it never mutates registry, Git, or filesystem state.", "Non-interactive callers receive one bounded projection and may combine this command with --json."];
|
|
348
|
+
}, {
|
|
349
|
+
readonly name: "server";
|
|
350
|
+
readonly summary: "Run the machine-local control server and built-in Web UI";
|
|
351
|
+
readonly usage: "nawabari server [--port <port>]";
|
|
352
|
+
readonly options: readonly [{
|
|
353
|
+
name: "--port";
|
|
354
|
+
description: string;
|
|
355
|
+
} & {
|
|
356
|
+
readonly value: "<port>";
|
|
357
|
+
readonly default: "47471";
|
|
358
|
+
readonly minimum: 1;
|
|
359
|
+
readonly maximum: 65535;
|
|
360
|
+
}];
|
|
361
|
+
readonly notes: readonly ["Runs in the foreground and binds 127.0.0.1 only; the bind address is not configurable. An occupied port fails.", "Serves every locally known Nawabari repository through one listener; each repository keeps its own backend authority.", "API requests require the ephemeral startup token header; the token rotates on restart and is never printed."];
|
|
348
362
|
}, {
|
|
349
363
|
readonly name: "session coordination preview";
|
|
350
364
|
readonly summary: "Preview bounded coordination between two sessions";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_SESSION_LIST_LIMIT, MAX_SESSION_LIST_LIMIT } from "./domain/session.js";
|
|
2
|
+
import { SESSION_ACTION_IDS } from "./domain/session-actions.js";
|
|
2
3
|
import { claimModeOperationRequirements, OPERATION_VOCABULARY } from "./operation-authorization.js";
|
|
3
4
|
import { EVIDENCE_MAX_DIFF_BYTES, EVIDENCE_MAX_DIFF_HUNKS } from "./repository-evidence.js";
|
|
4
5
|
const CLI_NAME = "nawabari";
|
|
@@ -64,10 +65,10 @@ const REGISTRY_DATA = [
|
|
|
64
65
|
repeatable: true,
|
|
65
66
|
}),
|
|
66
67
|
option("--auxiliary-state", "JSON repository-local auxiliary-state declaration to materialize in the managed worktree; repeatable", { value: "<json>", repeatable: true }),
|
|
67
|
-
option("--execution-scope-file", "
|
|
68
|
+
option("--execution-scope-file", "Version 1 implementation-execution-scope JSON; see README Working-set artifacts", {
|
|
68
69
|
value: "<path>",
|
|
69
70
|
}),
|
|
70
|
-
option("--candidate-working-set-file", "
|
|
71
|
+
option("--candidate-working-set-file", "Schema version 1 candidate-working-set JSON; see README Working-set artifacts", { value: "<path>" }),
|
|
71
72
|
option("--enforce-claims", "Opt this session into resource-claim enforcement; without it, operation authorization does not require resource claims for session-owned operations"),
|
|
72
73
|
],
|
|
73
74
|
notes: [
|
|
@@ -77,6 +78,7 @@ const REGISTRY_DATA = [
|
|
|
77
78
|
"Initial claims are provisioned atomically with the session; each --resource must be immediately followed by its own --mode, and zero pairs remains backward compatible.",
|
|
78
79
|
"Resource-claim enforcement is disabled by default; pass --enforce-claims to require claims for commit/push authorization on this session. Worktree and branch ownership, and claim conflicts against other sessions, remain enforced regardless.",
|
|
79
80
|
"Providing one bounded working-set artifact requires the other; both are validated before worktree ownership is established.",
|
|
81
|
+
"Both JSON artifact formats and field semantics are documented in README Working-set artifacts; session show --json exposes working_set.revision for expansion.",
|
|
80
82
|
"A claim conflict returns blocking-owner evidence. A durability-uncertain result is retry-safe only after re-reading the reported registry state; an existing owner is never silently adopted.",
|
|
81
83
|
"Without an override, Nawabari creates the safe managed root <repository-parent>/.nawabari/worktrees on first use. Existing absolute worktree paths directly under the repository parent remain accepted for compatibility.",
|
|
82
84
|
],
|
|
@@ -168,6 +170,7 @@ const REGISTRY_DATA = [
|
|
|
168
170
|
"The current working-set revision is a mandatory CAS token; stale requests are rejected without mutation.",
|
|
169
171
|
"READONLY is evaluated independently. Mutation classes also require the existing session claim authority.",
|
|
170
172
|
"The execution-scope artifact must match the session's established provenance; it cannot widen Inari maximum authority.",
|
|
173
|
+
"Inspect session show --json working_set.revision and history; use the same bootstrap execution-scope JSON. See README Working-set artifacts.",
|
|
171
174
|
],
|
|
172
175
|
},
|
|
173
176
|
{
|
|
@@ -230,16 +233,10 @@ const REGISTRY_DATA = [
|
|
|
230
233
|
usage: `${CLI_NAME} session action --session <id> --action <action-id> --token <json> [--confirm --preview <json>] [--operation-id <id>]`,
|
|
231
234
|
options: [
|
|
232
235
|
option("--session", "Explicit session identity; never inferred", { value: "<id>", required: true }),
|
|
233
|
-
option("--action", "Typed action ID from the current
|
|
236
|
+
option("--action", "Typed action ID from the current lifecycle action projection", {
|
|
234
237
|
value: "<action-id>",
|
|
235
238
|
required: true,
|
|
236
|
-
values:
|
|
237
|
-
"retain-session",
|
|
238
|
-
"supply-exact-integrated-revision",
|
|
239
|
-
"retry-close-with-bounded-integration-fetch",
|
|
240
|
-
"discard-session",
|
|
241
|
-
"reconcile-physical-state",
|
|
242
|
-
],
|
|
239
|
+
values: SESSION_ACTION_IDS,
|
|
243
240
|
}),
|
|
244
241
|
option("--token", "JSON action token returned by the current UI snapshot", { value: "<json>", required: true }),
|
|
245
242
|
option("--confirm", "Explicit intent for actions that require confirmation"),
|
|
@@ -262,6 +259,24 @@ const REGISTRY_DATA = [
|
|
|
262
259
|
"Non-interactive callers receive one bounded projection and may combine this command with --json.",
|
|
263
260
|
],
|
|
264
261
|
},
|
|
262
|
+
{
|
|
263
|
+
name: "server",
|
|
264
|
+
summary: "Run the machine-local control server and built-in Web UI",
|
|
265
|
+
usage: `${CLI_NAME} server [--port <port>]`,
|
|
266
|
+
options: [
|
|
267
|
+
option("--port", "Local TCP port on 127.0.0.1", {
|
|
268
|
+
value: "<port>",
|
|
269
|
+
default: "47471",
|
|
270
|
+
minimum: 1,
|
|
271
|
+
maximum: 65535,
|
|
272
|
+
}),
|
|
273
|
+
],
|
|
274
|
+
notes: [
|
|
275
|
+
"Runs in the foreground and binds 127.0.0.1 only; the bind address is not configurable. An occupied port fails.",
|
|
276
|
+
"Serves every locally known Nawabari repository through one listener; each repository keeps its own backend authority.",
|
|
277
|
+
"API requests require the ephemeral startup token header; the token rotates on restart and is never printed.",
|
|
278
|
+
],
|
|
279
|
+
},
|
|
265
280
|
{
|
|
266
281
|
name: "session coordination preview",
|
|
267
282
|
summary: "Preview bounded coordination between two sessions",
|