agent-lock 3.0.0 → 3.1.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.
- checksums.yaml +4 -4
- data/.openlanes.yml +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +32 -19
- data/lib/agent/lock/cli/commands/resume.rb +21 -5
- data/lib/agent/lock/manager.rb +66 -21
- data/lib/agent/lock/record.rb +48 -5
- data/lib/agent/lock/store/redis_store.rb +6 -3
- data/lib/agent/lock/tree.rb +75 -0
- data/lib/agent/lock/version.rb +1 -1
- metadata +165 -162
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45e7c0e68bb173ac3a8ff2f05626a18c0f84c932f61bebe55162206362f25214
|
|
4
|
+
data.tar.gz: 9a5abc2c815b315a46b9dd72002b3f790c588d486bf1f8f5be9294bf17d6e404
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d560c2b7ec0b568744fae8918486e0fb8fa621f6123d7ad6880319f5eb6822f5ab651a5ffc2fdc6722e43e16a110259cfb11b55d86a9733af318c2da9493b7f
|
|
7
|
+
data.tar.gz: 0d3b0c50a64864e64f467a58d373e59b552f0e1b08704c1dd2723adcc532f3bf6f50fc85e401b13b2c1614b4f569c314b7b93b2aff49428943a564a8513b6994
|
data/.openlanes.yml
ADDED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.0.6
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
### Changed
|
|
6
6
|
|
|
7
|
+
- **Breaking for Redis users:** locks are keyed by the repository and branch, not the checkout's absolute path. The Redis namespace and mutex are now `agent-lock:<repository digest>`, where the repository is the normalized `origin` URL, else the root commit, else the path outside git. Two machines on one Redis, or two clones on one machine, now block each other on overlapping scopes of the same branch, and checkouts on different branches (worktrees, typically) still do not. Locks taken by an earlier version under the old path-keyed namespace are not seen; release them before upgrading.
|
|
8
|
+
- `release`, `note`, `break` and `resume` find a lock this checkout took on another branch, so switching branches after claiming no longer strands it. That checkout still blocks itself on those files, since they are the same files on disk. `release` and `note` take the lock this session owns when another checkout holds the same scope on the new branch.
|
|
9
|
+
- A detached HEAD is keyed by its path on its own host, so two machines with a checkout at the same path do not collide.
|
|
10
|
+
- `resume` refuses (exit 1, `HELD`) when somebody claimed an overlapping scope while the work sat interrupted, and the resumed claim covers the branch the checkout is on now rather than the one the orphan was taken on.
|
|
11
|
+
- Reaping a lock from another checkout or another machine no longer clears this checkout's freeze flags on files of the same relative name.
|
|
12
|
+
|
|
7
13
|
- Development moves to Ruby 4.1.0-preview1 (`.ruby-version`). CI runs the suite on both 4.0.6 and 4.1.0-preview1, and rubocop on whatever `.ruby-version` names. `required_ruby_version` is unchanged.
|
|
8
14
|
- `alock skill install` and `alock skill path` are now `alock skills install` and `alock skills path`. The old `skill` spelling is gone.
|
|
9
15
|
- `alock skills install --help` names every skill it installs, and renders at all: an empty example string used to crash dry-cli-help, and the launcher exited 0 with no output.
|
data/README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/kigster/agent-lock/actions/workflows/main.yml)
|
|
4
4
|
|
|
5
|
-
A CLI utility `alock` that supports advisory locks on files and folders with pluggable backends (redis and file
|
|
5
|
+
A CLI utility `alock` that supports advisory locks on files and folders with pluggable backends (redis and file system provided out of the box, with redis being the default if it's available locally). This locking tool is meant for coding agents that share a project.
|
|
6
6
|
|
|
7
7
|
> [!NOTE]
|
|
8
8
|
>
|
|
9
|
-
> Please note that `agent-lock` is part of a three-part system: [`
|
|
9
|
+
> Please note that `agent-lock` is part of a three-part system: [`OpenLanes`](https://github.com/kigster/openlanes) is an AI harness workflow that works by creating specs, plans, and executing the plan until one or more PRs passing CI are created, and [`agentilda-ai-setup`](https://kigster/agentilda-ai-setup) — the GitHub repo that's a mixture of BASH and Ruby installers. It comes with the [`configuration.yml`](https://github.com/kigster/agentilda-ai-setup/blob/main/configuration.example.yml) file, which determines what skills, commands, plugins, and AI coding agents are locally installed.
|
|
10
10
|
>
|
|
11
|
-
> That said, you can absolutely use `agent-lock` gem in your own environment.
|
|
11
|
+
> That said, you can absolutely use the `agent-lock` gem in your own environment.
|
|
12
12
|
|
|
13
13
|
## What it is
|
|
14
14
|
|
|
15
|
-
`agent-lock` is a gem with one executable, `alock` (also installed as `agent-lock`). An agent runs `alock acquire <scope>` before it writes, and learns in one reply whether anybody else is working there: who, since when, and doing what. It works for separate sessions in one checkout
|
|
15
|
+
`agent-lock` is a gem with one executable, `alock` (also installed as `agent-lock`). An agent runs `alock acquire <scope>` before it writes, and learns in one reply whether anybody else is working there: who, since when, and doing what. It works for separate sessions in one checkout and for the sub-agents of a single session, the harder case.
|
|
16
16
|
|
|
17
17
|
Git does not help here. Two agents on one branch and one working tree never produce a conflict: the second writer simply wins, and the first one's work is gone without an error anywhere. A lock stops that, but only if every writer can be named reliably, even though an agent harness runs each command in a brand new shell. Making that name stable, and keeping claims correct when several agents ask at the same moment, is most of what this gem does.
|
|
18
18
|
|
|
@@ -115,7 +115,7 @@ alock skills path # where the bundled copy is
|
|
|
115
115
|
|
|
116
116
|
`install` refuses to overwrite a copy that differs (`--force` replaces it) and never touches a symlink, since a symlink is some other installer's.
|
|
117
117
|
|
|
118
|
-
If skills on your machine
|
|
118
|
+
If you installed skills on your machine from repositories via a manifest, name this one as a source instead so the skill is recorded along with where it came from. For example:
|
|
119
119
|
|
|
120
120
|
```yaml
|
|
121
121
|
- name: agent-lock
|
|
@@ -155,11 +155,11 @@ In order of preference:
|
|
|
155
155
|
The fingerprint walks up from the current process until it finds an ancestor that is not a shell. That is the `claude` or `codex` process driving the session, or the terminal a person is typing in. Its pid, start time, uid and hostname are hashed into a name like `claude-1f4c8a02`, which stays the same for as long as the session lives and differs from anybody else's.
|
|
156
156
|
|
|
157
157
|
> [!NOTE]
|
|
158
|
-
> The start time is in the hash on purpose.
|
|
158
|
+
> The start time is in the hash on purpose. PIDs get recycled, and a new session that lands on a dead one's number should not inherit its locks.
|
|
159
159
|
|
|
160
160
|
`alock whoami` prints the name this session would sign a lock with, its parent, and where each came from. Run it before the first claim if in doubt.
|
|
161
161
|
|
|
162
|
-
### Locks live inside `.git
|
|
162
|
+
### Locks live inside `.git.`
|
|
163
163
|
|
|
164
164
|
The store is `$(git rev-parse --git-common-dir)/agent-locks`.
|
|
165
165
|
|
|
@@ -182,13 +182,13 @@ status: active
|
|
|
182
182
|
pid: 69232
|
|
183
183
|
created_at: 2026-09-09T21:04:11Z
|
|
184
184
|
---
|
|
185
|
-
|
|
185
|
+
Rewriting the installer
|
|
186
186
|
|
|
187
187
|
## Progress
|
|
188
188
|
- 2026-09-09T21:14:02Z installer rewritten, specs still red
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
An agent that runs into this learns who
|
|
191
|
+
An agent that runs into this learns who owns the scope and what they are doing, so it can decide whether to wait or work elsewhere. A human can read the same file in an editor.
|
|
192
192
|
|
|
193
193
|
### Scopes are globs
|
|
194
194
|
|
|
@@ -199,10 +199,10 @@ An agent that runs into this learns who holds the scope and what they are doing,
|
|
|
199
199
|
| `workflow` | The same thing. A directory means everything in it |
|
|
200
200
|
| `lib/cli.rb` | One file |
|
|
201
201
|
|
|
202
|
-
Two scopes conflict when
|
|
202
|
+
Two scopes conflict when one fixed part contains the other. So `workflow/**` conflicts with `workflow/lib/cli.rb`, and `docs/**` does not conflict with `workflow/**`.
|
|
203
203
|
|
|
204
204
|
> [!TIP]
|
|
205
|
-
> The rule deliberately refuses more often than it strictly must.
|
|
205
|
+
> The rule deliberately refuses more often than it strictly must. Whether two globs can ever match the same path is unpredictable, and guessing wrong costs somebody lost work.
|
|
206
206
|
|
|
207
207
|
A scope is read from where you stand, globs included, and an absolute path inside the tree is made relative. So `$PWD/lib/**` and `lib/**` are the same claim, and `*.rb` typed in `lib/` is `lib/*.rb`. Only `.`, `*` and `**` mean the whole tree from anywhere. Two things are refused with exit 2 rather than guessed at:
|
|
208
208
|
|
|
@@ -222,7 +222,7 @@ Ownership and blocking are separate questions, and conflating them is what lets
|
|
|
222
222
|
| A sub-agent you spawned | No, you handed that scope out | Yes, so cleanup takes them with it |
|
|
223
223
|
| A sibling sub-agent | No | No |
|
|
224
224
|
|
|
225
|
-
A sub-agent claiming inside its parent's lock gets
|
|
225
|
+
A sub-agent claiming inside its parent's lock gets its own lock, and that lock keeps its siblings out. Asking for exactly the parent's scope is refused, since that would leave nothing for a sibling to be kept out of; claim something narrower. A sub-agent's `release-all` gives back its own locks and its children's, never its parent's.
|
|
226
226
|
|
|
227
227
|
#### Sub-agents that share their parent's process
|
|
228
228
|
|
|
@@ -243,7 +243,7 @@ When `AGENT_ID` is set and `AGENT_PARENT_ID` is not, the parent is taken to be t
|
|
|
243
243
|
|
|
244
244
|
### A crash does not strand the tree
|
|
245
245
|
|
|
246
|
-
A lock is cleared
|
|
246
|
+
A lock is cleared when its holder is provably gone: the process that signed it has exited on this machine. A holder on another machine cannot be checked, so its lock is trusted until nobody has touched it for `AGENT_LOCK_STALE_MINUTES` (120 by default). Every `note` counts as a touch. What happens next depends on whether anything was written down:
|
|
247
247
|
|
|
248
248
|
| The lock has | What happens to it |
|
|
249
249
|
| :----------- | :----------------------------------------------- |
|
|
@@ -260,7 +260,7 @@ INTERRUPTED WORK on workflow/**, left by luke-backend
|
|
|
260
260
|
> [!WARNING]
|
|
261
261
|
> An orphan blocks nobody, but `acquire` will not silently overwrite one, because the notes inside it may be the only record of half-finished work. Choose `resume` or `break`.
|
|
262
262
|
|
|
263
|
-
A live holder's lock is never cleared,
|
|
263
|
+
A live holder's lock is never cleared, no matter how old it is. An agent may legitimately work on one scope for hours, and deleting its lock underneath it would hand its files to the next agent while it is still writing them. Past the stale window `list`, `check` and `mine` tag it `STALE` instead, and taking it is a `break` that somebody announces first.
|
|
264
264
|
|
|
265
265
|
```
|
|
266
266
|
$ alock list
|
|
@@ -303,7 +303,7 @@ Flags:
|
|
|
303
303
|
| `--enforce` | `acquire` | Also make the matched files unwritable |
|
|
304
304
|
| `--force` | `acquire` | Permit `--enforce` on a very wide scope |
|
|
305
305
|
|
|
306
|
-
Any command exits 2 when it cannot run at all:
|
|
306
|
+
Any command exits 2 when it cannot run at all: an empty or out-of-tree scope, a backend mismatch, or a store it cannot reach.
|
|
307
307
|
|
|
308
308
|
## Shell completion
|
|
309
309
|
|
|
@@ -312,7 +312,7 @@ alock completion bash > "$(brew --prefix)/etc/bash_completion.d/alo"
|
|
|
312
312
|
alock completion zsh > "${fpath[1]}/_alo"
|
|
313
313
|
```
|
|
314
314
|
|
|
315
|
-
Names every command and flag `alock` currently knows, since the script is generated from the same registry the CLI runs, rather than hand-maintained separately
|
|
315
|
+
Names every command and flag `alock` currently knows, since the script is generated from the same registry the CLI runs on, rather than hand-maintained separately.
|
|
316
316
|
|
|
317
317
|
## Configuration
|
|
318
318
|
|
|
@@ -338,10 +338,23 @@ AGENT_LOCK_BACKEND=redis alock acquire workflow/** # force it, rather than aut
|
|
|
338
338
|
AGENT_LOCK_BACKEND=file alock acquire workflow/** # or force the file store instead
|
|
339
339
|
```
|
|
340
340
|
|
|
341
|
-
|
|
341
|
+
### One repository, many machines
|
|
342
|
+
|
|
343
|
+
A lock is about a repository and the files in it, not about where a checkout sits on disk. Point every machine at one Redis with `REDIS_URL`, and each checkout of the repository reads the same locks, wherever it is cloned:
|
|
344
|
+
|
|
345
|
+
| Two checkouts of one repository | Do their locks collide? |
|
|
346
|
+
| ------------------------------------------------- | ---------------------------------------------------------- |
|
|
347
|
+
| Same branch, any machine, any path | Yes, on overlapping scopes; different files are fine |
|
|
348
|
+
| Different branches, such as two worktrees | No: separate branches are what a worktree is for |
|
|
349
|
+
| One checkout that switched branch after claiming | Yes: the files on disk did not change hands |
|
|
350
|
+
| A detached HEAD | Only within that checkout, since it has no branch to share |
|
|
351
|
+
|
|
352
|
+
The repository is named by its `origin` URL, normalized so that `git@github.com:a/b.git` and `https://github.com/a/b` agree. A repository with no `origin` is named by its root commit, and a directory outside git by its path.
|
|
353
|
+
|
|
354
|
+
Either way, every claim checks for conflicts and writes its lock while holding one mutex for the whole store. Refusing an atomic write of an identical scope is not enough on its own: `lib/**` and `lib/cli.rb` are different keys, and two agents claiming them at the same moment would both find the store empty and both win. The file store takes an exclusive `flock` on `.mutex` beside the locks. Redis takes `agent-lock-mutex:<repository digest>` with `SET NX PX` and a random token, and gives it back with a compare-and-delete script, so a process whose lease ran out cannot release somebody else's.
|
|
342
355
|
|
|
343
356
|
> [!CAUTION]
|
|
344
|
-
> Picking a default from whether Redis happens to answer is still never a runtime auto-*switch*. If one agent found a running Redis and switched to it while the agent beside it did not, the two would take locks in different stores, see nothing of each other, and both report success — worse than no lock at all. The first store created in a tree records
|
|
357
|
+
> Picking a default from whether Redis happens to answer is still never a runtime auto-*switch*. If one agent found a running Redis and switched to it while the agent beside it did not, the two would take locks in different stores, see nothing of each other, and both report success — worse than no lock at all. The first store created in a tree records its backend in a marker file, and every later process in that tree is bound to it regardless of what Redis does next; a mismatch stops the run rather than silently picking the other one.
|
|
345
358
|
>
|
|
346
359
|
> That default is decided at the one moment two processes could otherwise race: both find a virgin tree, both probe Redis, and a flaky answer could hand them different defaults before either writes the marker. The marker is claimed atomically — the first `O_CREAT|O_EXCL` wins — and every process builds from whatever ends up on disk, never from its own guess, so a race can land on either backend but never on a split.
|
|
347
360
|
|
|
@@ -356,7 +369,7 @@ alock acquire "config/credentials/**" "keys must not move during the migration"
|
|
|
356
369
|
```
|
|
357
370
|
|
|
358
371
|
> [!WARNING]
|
|
359
|
-
> This is opt-in for three reasons. It
|
|
372
|
+
> This is opt-in for three reasons. It's macOS-only, since the Linux equivalent (`chattr +i`) requires root. It denies the holder too, so it suits a freeze rather than a file you are editing. And a session that dies leaves the files frozen, at which point `git checkout` and `rm -rf` start failing with "Operation not permitted".
|
|
360
373
|
>
|
|
361
374
|
> Every frozen path is written into the lock, so `release` and `break` thaw them without needing the process that froze them to still exist.
|
|
362
375
|
|
|
@@ -17,17 +17,33 @@ module Agent
|
|
|
17
17
|
argument :scope, required: true, desc: "The path or glob to pick up"
|
|
18
18
|
|
|
19
19
|
def call(scope:, **options)
|
|
20
|
-
|
|
20
|
+
manager = manager(options[:dir])
|
|
21
|
+
result = manager.resume(scope)
|
|
22
|
+
report(result, scope, manager.stale_minutes)
|
|
23
|
+
finish(result)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
# @param result [Manager::Result]
|
|
29
|
+
# @param scope [String] as typed
|
|
30
|
+
# @param stale_minutes [Integer]
|
|
31
|
+
def report(result, scope, stale_minutes)
|
|
32
|
+
case result.status
|
|
33
|
+
when :not_found then say("NOTHING TO RESUME #{scope}")
|
|
34
|
+
when :held
|
|
35
|
+
# Somebody claimed an overlapping scope while the work sat
|
|
36
|
+
# orphaned; their claim is live and this one is not.
|
|
37
|
+
warn_("REFUSED, somebody claimed it while it was interrupted; the notes are still there")
|
|
38
|
+
report_held(result.records, stale_minutes: stale_minutes)
|
|
39
|
+
when :interrupted
|
|
40
|
+
warn_("REFUSED, #{result.record&.agent_id || "another session"} left interrupted work " \
|
|
41
|
+
"on #{scope} on this branch; resume or break that first")
|
|
24
42
|
else
|
|
25
43
|
say("RESUMED #{result.record.scope} (holder: #{result.record.agent_id})")
|
|
26
44
|
say("")
|
|
27
45
|
say(result.record.intent)
|
|
28
46
|
end
|
|
29
|
-
|
|
30
|
-
finish(result)
|
|
31
47
|
end
|
|
32
48
|
end
|
|
33
49
|
end
|
data/lib/agent/lock/manager.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Agent
|
|
|
69
69
|
# @return [Result]
|
|
70
70
|
def release(path)
|
|
71
71
|
scope = Scope.parse(path, tree: tree)
|
|
72
|
-
record =
|
|
72
|
+
record = locate(scope, prefer: ->(found) { found.held_by?(identity) })
|
|
73
73
|
return result(:not_found, []) if record.nil?
|
|
74
74
|
return result(:refused, [record]) unless record.held_by?(identity)
|
|
75
75
|
|
|
@@ -117,7 +117,7 @@ module Agent
|
|
|
117
117
|
# @return [Result]
|
|
118
118
|
def break_lock(path)
|
|
119
119
|
scope = Scope.parse(path, tree: tree)
|
|
120
|
-
record =
|
|
120
|
+
record = locate(scope)
|
|
121
121
|
return result(:not_found, []) if record.nil?
|
|
122
122
|
|
|
123
123
|
drop(record)
|
|
@@ -152,7 +152,7 @@ module Agent
|
|
|
152
152
|
# @return [Result]
|
|
153
153
|
def note(path, text)
|
|
154
154
|
scope = Scope.parse(path, tree: tree)
|
|
155
|
-
record =
|
|
155
|
+
record = locate(scope, prefer: ->(found) { found.held_by?(identity) })
|
|
156
156
|
return result(:not_found, []) if record.nil?
|
|
157
157
|
return result(:refused, [record]) unless record.held_by?(identity)
|
|
158
158
|
|
|
@@ -167,17 +167,25 @@ module Agent
|
|
|
167
167
|
# steps: two sessions resuming one orphan would otherwise both find it
|
|
168
168
|
# interrupted, both write themselves in, and both report :resumed.
|
|
169
169
|
#
|
|
170
|
+
# An orphan blocks nobody, so while it sat there somebody may have
|
|
171
|
+
# claimed an overlapping scope; that claim is checked for exactly as
|
|
172
|
+
# `acquire` would check it. And the resumed claim covers the branch this
|
|
173
|
+
# checkout is on now, not the one the orphan was taken on: it is rebound
|
|
174
|
+
# to the current tree, so that other checkouts of this branch see it.
|
|
175
|
+
#
|
|
170
176
|
# @param path [String]
|
|
171
|
-
# @return [Result]
|
|
177
|
+
# @return [Result] :resumed, :not_found, or :held with what overlaps
|
|
172
178
|
def resume(path)
|
|
173
179
|
scope = Scope.parse(path, tree: tree)
|
|
174
180
|
store.synchronize do
|
|
175
|
-
|
|
181
|
+
reap
|
|
182
|
+
record = locate(scope, prefer: :orphaned?.to_proc)
|
|
176
183
|
next result(:not_found, []) if record.nil? || record.active?
|
|
177
184
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
185
|
+
blocking = conflicts(scope).select { |other| other.blocks?(identity) }
|
|
186
|
+
next result(:held, blocking) if blocking.any?
|
|
187
|
+
|
|
188
|
+
rebind(record, scope)
|
|
181
189
|
end
|
|
182
190
|
end
|
|
183
191
|
|
|
@@ -247,15 +255,6 @@ module Agent
|
|
|
247
255
|
result(:interrupted, [record]) if record&.orphaned?
|
|
248
256
|
end
|
|
249
257
|
|
|
250
|
-
# Who this session is, as a lock records it.
|
|
251
|
-
#
|
|
252
|
-
# @return [Hash]
|
|
253
|
-
def claim
|
|
254
|
-
evidence = identity.evidence
|
|
255
|
-
{ agent_id: identity.id, parent_agent_id: identity.parent_id,
|
|
256
|
-
pid: evidence[:pid], started: evidence[:started], host: evidence[:host] }
|
|
257
|
-
end
|
|
258
|
-
|
|
259
258
|
# Freezing happens after the claim is won, never before. Flagging files
|
|
260
259
|
# first and then losing the race would leave a tree full of unwritable
|
|
261
260
|
# files that no lock admits to having frozen, which is the one failure
|
|
@@ -292,21 +291,67 @@ module Agent
|
|
|
292
291
|
# @return [Array<Record>]
|
|
293
292
|
def conflicts(scope)
|
|
294
293
|
store.all.select do |record|
|
|
295
|
-
record.active? && record.tree
|
|
294
|
+
record.active? && record.about?(tree) && record.scope_object.conflicts_with?(scope)
|
|
296
295
|
end
|
|
297
296
|
end
|
|
298
297
|
|
|
298
|
+
# The frozen paths of a lock taken in another checkout, or on another
|
|
299
|
+
# machine, name files that are not here. Clearing them would unfreeze
|
|
300
|
+
# this checkout's files of the same name, which may be frozen under a
|
|
301
|
+
# lock of its own, so they are left alone. An orphan keeps the list, so
|
|
302
|
+
# the checkout that froze them can still see what to thaw.
|
|
303
|
+
#
|
|
299
304
|
# @param record [Record]
|
|
300
305
|
def orphan(record)
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
local = record.local_to?(tree)
|
|
307
|
+
Freeze.clear(record.frozen_paths, tree: tree) if local
|
|
308
|
+
store.update(record.with(status: Record::ORPHANED, frozen_paths: local ? [] : record.frozen_paths,
|
|
309
|
+
updated_at: Time.now.utc.iso8601))
|
|
303
310
|
end
|
|
304
311
|
|
|
312
|
+
# @param record [Record]
|
|
305
313
|
def drop(record)
|
|
306
|
-
Freeze.clear(record.frozen_paths, tree: tree)
|
|
314
|
+
Freeze.clear(record.frozen_paths, tree: tree) if record.local_to?(tree)
|
|
307
315
|
store.delete(record)
|
|
308
316
|
end
|
|
309
317
|
|
|
318
|
+
# The lock this tree holds on a scope. Looked up by id first, which is
|
|
319
|
+
# the whole point of the id, and then by scope among this checkout's own,
|
|
320
|
+
# because the id carries the branch: a session that switched branches
|
|
321
|
+
# after claiming would otherwise be told its own lock was not there, and
|
|
322
|
+
# could neither release nor resume it.
|
|
323
|
+
#
|
|
324
|
+
# Both can exist at once: this checkout's lock from `main`, and another
|
|
325
|
+
# checkout's lock on the same scope on the branch this one has since
|
|
326
|
+
# switched to. `prefer` picks which one a command is after, so `release`
|
|
327
|
+
# finds the lock it owns rather than refusing on somebody else's.
|
|
328
|
+
#
|
|
329
|
+
# @param scope [Scope]
|
|
330
|
+
# @param prefer [Proc, nil] the record wanted when there is a choice
|
|
331
|
+
# @return [Record, nil]
|
|
332
|
+
def locate(scope, prefer: nil)
|
|
333
|
+
found = [store.find(scope), *store.all.select { |record| record.scope == scope.to_s && record.local_to?(tree) }]
|
|
334
|
+
.compact.uniq(&:id)
|
|
335
|
+
(prefer && found.find(&prefer)) || found.first
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# An orphan made a live claim again, by this session, on this tree's
|
|
339
|
+
# current branch. When the branch moved, the id moves with it: the new
|
|
340
|
+
# record is created first, so a lost race leaves the orphan where it
|
|
341
|
+
# was, and the old one is deleted only once the new one stands.
|
|
342
|
+
#
|
|
343
|
+
# @param record [Record] the orphan
|
|
344
|
+
# @param scope [Scope]
|
|
345
|
+
# @return [Result]
|
|
346
|
+
def rebind(record, scope)
|
|
347
|
+
adopted = record.resumed(tree: tree, scope: scope, identity: identity)
|
|
348
|
+
moved = adopted.id != record.id
|
|
349
|
+
return result(:interrupted, [store.find(scope)].compact) if moved && !store.create(adopted)
|
|
350
|
+
|
|
351
|
+
moved ? store.delete(record) : store.update(adopted)
|
|
352
|
+
result(:resumed, [adopted])
|
|
353
|
+
end
|
|
354
|
+
|
|
310
355
|
def result(status, records, message = nil) = Result.new(status:, records:, message:)
|
|
311
356
|
end
|
|
312
357
|
end
|
data/lib/agent/lock/record.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "process_info"
|
|
4
4
|
require_relative "scope"
|
|
5
|
+
require_relative "tree"
|
|
5
6
|
|
|
6
7
|
require "yaml"
|
|
7
8
|
require "time"
|
|
@@ -25,7 +26,7 @@ module Agent
|
|
|
25
26
|
# ---
|
|
26
27
|
# Rewriting the installer's filter pair.
|
|
27
28
|
class Record
|
|
28
|
-
FIELDS = %i[id agent_id parent_agent_id scope tree worktree pid started host
|
|
29
|
+
FIELDS = %i[id agent_id parent_agent_id scope tree repo branch worktree pid started host
|
|
29
30
|
created_at updated_at status frozen_paths].freeze
|
|
30
31
|
|
|
31
32
|
ACTIVE = "active"
|
|
@@ -45,18 +46,20 @@ module Agent
|
|
|
45
46
|
evidence = identity.evidence
|
|
46
47
|
new(
|
|
47
48
|
id: id_for(tree, scope), agent_id: identity.id, parent_agent_id: identity.parent_id,
|
|
48
|
-
scope: scope.to_s, tree: tree.root, worktree: tree.worktree?,
|
|
49
|
+
scope: scope.to_s, tree: tree.root, repo: tree.repo, branch: tree.branch, worktree: tree.worktree?,
|
|
49
50
|
pid: evidence[:pid], started: evidence[:started], host: evidence[:host],
|
|
50
51
|
created_at: Time.now.utc.iso8601, status: ACTIVE, frozen_paths: [], intent: intent
|
|
51
52
|
)
|
|
52
53
|
end
|
|
53
54
|
|
|
54
|
-
# Derived from the tree and the scope so that a second run
|
|
55
|
-
# the same lock finds it without reading every file in the
|
|
55
|
+
# Derived from the tree's lock key and the scope so that a second run
|
|
56
|
+
# looking for the same lock finds it without reading every file in the
|
|
57
|
+
# store, and so that two checkouts of one branch, on any machine, are
|
|
58
|
+
# after the same id and cannot both win it.
|
|
56
59
|
#
|
|
57
60
|
# @return [String]
|
|
58
61
|
def id_for(tree, scope)
|
|
59
|
-
digest = Digest::SHA256.hexdigest("#{tree.
|
|
62
|
+
digest = Digest::SHA256.hexdigest("#{tree.lock_key}\0#{scope}")[0, 8]
|
|
60
63
|
"#{scope.slug}-#{digest}"
|
|
61
64
|
end
|
|
62
65
|
|
|
@@ -101,6 +104,24 @@ module Agent
|
|
|
101
104
|
"#{YAML.dump(front)}#{SEPARATOR}\n\n#{intent.strip}\n"
|
|
102
105
|
end
|
|
103
106
|
|
|
107
|
+
# This orphan as a live claim again, held by `identity` on the branch
|
|
108
|
+
# `tree` is on now, which need not be the one it was taken on. Its id
|
|
109
|
+
# follows the branch, so the caller has to write it under the new id.
|
|
110
|
+
#
|
|
111
|
+
# @param tree [Tree]
|
|
112
|
+
# @param scope [Scope]
|
|
113
|
+
# @param identity [Identity]
|
|
114
|
+
# @return [Record]
|
|
115
|
+
def resumed(tree:, scope:, identity:)
|
|
116
|
+
evidence = identity.evidence
|
|
117
|
+
with(
|
|
118
|
+
id: self.class.id_for(tree, scope), tree: tree.root, repo: tree.repo, branch: tree.branch,
|
|
119
|
+
worktree: tree.worktree?, status: ACTIVE, updated_at: Time.now.utc.iso8601,
|
|
120
|
+
agent_id: identity.id, parent_agent_id: identity.parent_id,
|
|
121
|
+
pid: evidence[:pid], started: evidence[:started], host: evidence[:host]
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
|
|
104
125
|
# @return [Boolean] the holder is gone, but the work it recorded is not
|
|
105
126
|
def orphaned? = status == ORPHANED
|
|
106
127
|
|
|
@@ -127,6 +148,28 @@ module Agent
|
|
|
127
148
|
# @return [Scope]
|
|
128
149
|
def scope_object = @scope_object ||= Scope.new(scope)
|
|
129
150
|
|
|
151
|
+
# @return [String] see Tree#lock_key. A record written before `repo` and
|
|
152
|
+
# `branch` were kept has neither, and so falls back to its path on the
|
|
153
|
+
# host that wrote it, which no other host's key can equal.
|
|
154
|
+
def lock_key = Tree.lock_key(repo: repo, branch: branch, root: tree, host: host)
|
|
155
|
+
|
|
156
|
+
# Whether this lock is about the files a tree holds: the same repository
|
|
157
|
+
# on the same branch, from anywhere, or this very checkout on this host,
|
|
158
|
+
# whatever branch it was taken on, since switching branches does not
|
|
159
|
+
# make the files on disk somebody else's.
|
|
160
|
+
#
|
|
161
|
+
# @param checkout [Tree]
|
|
162
|
+
# @return [Boolean]
|
|
163
|
+
def about?(checkout) = lock_key == checkout.lock_key || local_to?(checkout)
|
|
164
|
+
|
|
165
|
+
# Whether this lock was taken in this very checkout, on this host. Only
|
|
166
|
+
# then do its frozen paths name files here: the same relative path in
|
|
167
|
+
# another checkout, or on another machine, is a different file.
|
|
168
|
+
#
|
|
169
|
+
# @param checkout [Tree]
|
|
170
|
+
# @return [Boolean]
|
|
171
|
+
def local_to?(checkout) = tree == checkout.root && same_host?
|
|
172
|
+
|
|
130
173
|
# Two different questions, deliberately not one.
|
|
131
174
|
#
|
|
132
175
|
# Ownership answers "may I release this, write notes in it, and does
|
|
@@ -145,14 +145,17 @@ module Agent
|
|
|
145
145
|
|
|
146
146
|
private
|
|
147
147
|
|
|
148
|
-
# Keyed by the
|
|
149
|
-
# machine
|
|
148
|
+
# Keyed by the repository, not the checkout, so that every checkout of
|
|
149
|
+
# it, on every machine sharing this Redis, reads the same locks. It
|
|
150
|
+
# used to be the absolute path, which kept two machines apart even when
|
|
151
|
+
# they were editing the same file. Which of those locks actually
|
|
152
|
+
# collide is decided by Record#about?, not here.
|
|
150
153
|
def namespace = "#{NAMESPACE}:#{digest}"
|
|
151
154
|
|
|
152
155
|
# @return [String]
|
|
153
156
|
def url = self.class.url
|
|
154
157
|
|
|
155
|
-
def digest = ::Digest::SHA256.hexdigest(tree.
|
|
158
|
+
def digest = ::Digest::SHA256.hexdigest(tree.repo)[0, 12]
|
|
156
159
|
|
|
157
160
|
# SET NX PX until it takes, backing off with jitter so that processes
|
|
158
161
|
# which all lost the same round do not all come back for the next one
|
data/lib/agent/lock/tree.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "digest"
|
|
4
|
+
require "socket"
|
|
4
5
|
require_relative "scope"
|
|
5
6
|
|
|
6
7
|
module Agent
|
|
@@ -37,6 +38,73 @@ module Agent
|
|
|
37
38
|
# @return [Boolean] a linked worktree rather than the original checkout
|
|
38
39
|
def worktree? = !git_dir.nil? && git_dir != common_dir
|
|
39
40
|
|
|
41
|
+
# The repository this tree is a checkout of, named the same way on every
|
|
42
|
+
# machine that has one.
|
|
43
|
+
#
|
|
44
|
+
# The absolute path used to be the name, so `/Users/a/repo` and
|
|
45
|
+
# `/Users/b/repo` were two repositories even on one shared Redis, and two
|
|
46
|
+
# machines never saw each other's locks. A lock is about the repository
|
|
47
|
+
# and the files in it; where the checkout sits on somebody's disk is not
|
|
48
|
+
# part of that. The origin URL is preferred, normalized so that ssh and
|
|
49
|
+
# https spellings agree; then the root commit, which every clone shares
|
|
50
|
+
# even without a remote; and only outside git, the path.
|
|
51
|
+
#
|
|
52
|
+
# @return [String]
|
|
53
|
+
def repo
|
|
54
|
+
@repo ||= self.class.normalize_remote(git("config", "--get", "remote.origin.url")) ||
|
|
55
|
+
root_commit || root
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @return [String, nil] the branch checked out, nil on a detached HEAD
|
|
59
|
+
# or outside git
|
|
60
|
+
def branch = defined?(@branch) ? @branch : (@branch = git("symbolic-ref", "--short", "-q", "HEAD"))
|
|
61
|
+
|
|
62
|
+
# What two trees must share for their locks to collide: the repository
|
|
63
|
+
# and the branch. Two machines on `main` are writing the same files, and
|
|
64
|
+
# must see each other. Two worktrees on their own branches are not, and
|
|
65
|
+
# are left alone, which is the point of making a worktree. A detached
|
|
66
|
+
# HEAD has no branch to share, so it keeps to its own checkout on its
|
|
67
|
+
# own host: the path alone is not enough, since two machines can clone
|
|
68
|
+
# to the same path and now read one namespace.
|
|
69
|
+
#
|
|
70
|
+
# @return [String]
|
|
71
|
+
def lock_key = self.class.lock_key(repo: repo, branch: branch, root: root, host: Socket.gethostname)
|
|
72
|
+
|
|
73
|
+
class << self
|
|
74
|
+
# One definition, shared with Record, so that a lock read back from
|
|
75
|
+
# the store is compared on exactly the terms it was written on.
|
|
76
|
+
#
|
|
77
|
+
# @param repo [String, nil]
|
|
78
|
+
# @param branch [String, nil]
|
|
79
|
+
# @param root [String]
|
|
80
|
+
# @param host [String, nil] nil only for a record written before hosts
|
|
81
|
+
# were kept, which then matches by its path on this host alone
|
|
82
|
+
# @return [String]
|
|
83
|
+
def lock_key(repo:, branch:, root:, host:)
|
|
84
|
+
return "#{repo}@#{branch}" if repo && branch
|
|
85
|
+
|
|
86
|
+
host ? "#{host}:#{root}" : root
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# `git@github.com:a/b.git`, `ssh://git@github.com:22/a/b`, and
|
|
90
|
+
# `https://user@github.com/a/b.git` all come out as `github.com/a/b`.
|
|
91
|
+
#
|
|
92
|
+
# @param url [String, nil]
|
|
93
|
+
# @return [String, nil]
|
|
94
|
+
def normalize_remote(url)
|
|
95
|
+
text = url.to_s.strip
|
|
96
|
+
return nil if text.empty?
|
|
97
|
+
|
|
98
|
+
text = text.sub(%r{\A[a-z][a-z0-9+.-]*://}i, "") # scheme
|
|
99
|
+
text = text.sub(%r{\A[^@/]*@}, "") # user
|
|
100
|
+
text = text.sub(%r{\A([^/:]+):\d*/}, '\1/') # port
|
|
101
|
+
text = text.sub(%r{\A([^/:]+):(?!/)}, '\1/') # scp-style host:path
|
|
102
|
+
text = text.delete_suffix("/").delete_suffix(".git").delete_suffix("/")
|
|
103
|
+
host, path = text.split("/", 2)
|
|
104
|
+
path ? "#{host.downcase}/#{path}" : text
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
40
108
|
# @description Resolves the directory where locks are stored by either
|
|
41
109
|
# $AGENT_LOCK_DIR environment variable if defined, or 'agent-locks'
|
|
42
110
|
# inside .git if available, or the ~/.agent-locks/<tree-digest> in user's
|
|
@@ -103,6 +171,13 @@ module Agent
|
|
|
103
171
|
absolute
|
|
104
172
|
end
|
|
105
173
|
|
|
174
|
+
# A merged-in history can bring more than one root commit. Any fixed
|
|
175
|
+
# pick will do, since every clone sees the same set, so the lexically
|
|
176
|
+
# first. Nil in a repository with no commits yet.
|
|
177
|
+
#
|
|
178
|
+
# @return [String, nil]
|
|
179
|
+
def root_commit = git("rev-list", "--max-parents=0", "HEAD")&.split("\n")&.min
|
|
180
|
+
|
|
106
181
|
def git_dir = @git_dir ||= absolute(git("rev-parse", "--git-dir"))
|
|
107
182
|
|
|
108
183
|
def common_dir = @common_dir ||= absolute(git("rev-parse", "--git-common-dir"))
|
data/lib/agent/lock/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,187 +1,190 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: agent-lock
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
|
|
7
|
+
- Konstantin Gredeskoul
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: dry-cli
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.4'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.4'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: dry-cli-autocomplete
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.6'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.6'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: dry-cli-help
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0.6'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0.6'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: dry-cli-ui
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0.7'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0.7'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: pastel
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0.8'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.8'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: redis
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '5.0'
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '5.0'
|
|
96
|
+
description: 'This compact ruby gem is purely CLI utility: it''s meant to be used
|
|
97
|
+
by a team of AI agentsexecuting along one or more the plans in a given repo. Using
|
|
98
|
+
worktrees and parallelism it''s easy to 10x the speed of develpoment of software
|
|
99
|
+
development compared to even a single agent working on it. Plus each agent can specialize.
|
|
100
|
+
Such agents require globsl shared locking mechanism to ensure they are not working
|
|
101
|
+
on the same directory, or the same files in same worktree. That is exactly what
|
|
102
|
+
this gem does. The CLI binary you invoke is called ''alock''which comes with sub-command
|
|
103
|
+
''completion'' which you can load for BASH or ZSH. However, you are not very likely
|
|
104
|
+
going toinvoke this gem directly. It''s used by an Agentic Workflow gem ''agentilda''
|
|
105
|
+
to protect shared resources. To try the entire system, it''s recommended to download
|
|
106
|
+
the repo https://github.com/kigster/agentilda-ai-setup which both installs the two
|
|
107
|
+
gems, and offers a configuration file that installs a set of coding agents, skills,
|
|
108
|
+
plugins, commands, from various guthub folders, or via running commands, and so
|
|
109
|
+
on. In other words the repo''s purpose is to ensure your agentic setup is identical
|
|
110
|
+
from machine to machine, and by modifying the config file you can pick and choose
|
|
111
|
+
your skills, your AGENT.md/CLAUDE.md file and so on.'
|
|
109
112
|
email:
|
|
110
|
-
|
|
113
|
+
- kigster@gmail.com
|
|
111
114
|
executables:
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
- agent-lock
|
|
116
|
+
- alock
|
|
114
117
|
extensions: []
|
|
115
118
|
extra_rdoc_files: []
|
|
116
119
|
files:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
120
|
+
- ".claude/CLAUDE.md"
|
|
121
|
+
- ".openlanes.yml"
|
|
122
|
+
- ".ruby-version"
|
|
123
|
+
- AGENTS.md
|
|
124
|
+
- CHANGELOG.md
|
|
125
|
+
- LICENSE.txt
|
|
126
|
+
- README.md
|
|
127
|
+
- Rakefile
|
|
128
|
+
- exe/agent-lock
|
|
129
|
+
- exe/alock
|
|
130
|
+
- justfile
|
|
131
|
+
- lib/agent/lock.rb
|
|
132
|
+
- lib/agent/lock/cli.rb
|
|
133
|
+
- lib/agent/lock/cli/commands/acquire.rb
|
|
134
|
+
- lib/agent/lock/cli/commands/base.rb
|
|
135
|
+
- lib/agent/lock/cli/commands/break.rb
|
|
136
|
+
- lib/agent/lock/cli/commands/check.rb
|
|
137
|
+
- lib/agent/lock/cli/commands/completion.rb
|
|
138
|
+
- lib/agent/lock/cli/commands/list.rb
|
|
139
|
+
- lib/agent/lock/cli/commands/mine.rb
|
|
140
|
+
- lib/agent/lock/cli/commands/note.rb
|
|
141
|
+
- lib/agent/lock/cli/commands/release.rb
|
|
142
|
+
- lib/agent/lock/cli/commands/release_all.rb
|
|
143
|
+
- lib/agent/lock/cli/commands/resume.rb
|
|
144
|
+
- lib/agent/lock/cli/commands/skills.rb
|
|
145
|
+
- lib/agent/lock/cli/commands/version.rb
|
|
146
|
+
- lib/agent/lock/cli/commands/whoami.rb
|
|
147
|
+
- lib/agent/lock/error.rb
|
|
148
|
+
- lib/agent/lock/freeze.rb
|
|
149
|
+
- lib/agent/lock/identity.rb
|
|
150
|
+
- lib/agent/lock/launcher.rb
|
|
151
|
+
- lib/agent/lock/manager.rb
|
|
152
|
+
- lib/agent/lock/process_info.rb
|
|
153
|
+
- lib/agent/lock/record.rb
|
|
154
|
+
- lib/agent/lock/scope.rb
|
|
155
|
+
- lib/agent/lock/skill.rb
|
|
156
|
+
- lib/agent/lock/store.rb
|
|
157
|
+
- lib/agent/lock/store/file_system_store.rb
|
|
158
|
+
- lib/agent/lock/store/redis_store.rb
|
|
159
|
+
- lib/agent/lock/tree.rb
|
|
160
|
+
- lib/agent/lock/version.rb
|
|
161
|
+
- sig/agent/lock.rbs
|
|
162
|
+
- skills/agent-lock/SKILL.md
|
|
163
|
+
homepage: https://github.com/kigster/agent-lock
|
|
160
164
|
licenses:
|
|
161
|
-
|
|
165
|
+
- MIT
|
|
162
166
|
metadata:
|
|
163
|
-
allowed_push_host:
|
|
164
|
-
homepage_uri:
|
|
165
|
-
source_code_uri:
|
|
166
|
-
changelog_uri:
|
|
167
|
-
rubygems_mfa_required:
|
|
167
|
+
allowed_push_host: https://rubygems.org
|
|
168
|
+
homepage_uri: https://github.com/kigster/agent-lock
|
|
169
|
+
source_code_uri: https://github.com/kigster/agent-lock
|
|
170
|
+
changelog_uri: https://github.com/kigster/agent-lock/blob/main/CHANGELOG.md
|
|
171
|
+
rubygems_mfa_required: 'true'
|
|
168
172
|
rdoc_options: []
|
|
169
173
|
require_paths:
|
|
170
|
-
|
|
174
|
+
- lib
|
|
171
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
176
|
requirements:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
version: 3.2.0
|
|
177
|
+
- - ">="
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: 3.2.0
|
|
177
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
181
|
requirements:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
version: "0"
|
|
182
|
+
- - ">="
|
|
183
|
+
- !ruby/object:Gem::Version
|
|
184
|
+
version: '0'
|
|
183
185
|
requirements: []
|
|
184
|
-
rubygems_version: 4.
|
|
186
|
+
rubygems_version: 4.0.23
|
|
185
187
|
specification_version: 4
|
|
186
|
-
summary: Advisory locks to prevent race conditions and general mayhem when multiple
|
|
188
|
+
summary: Advisory locks to prevent race conditions and general mayhem when multiple
|
|
189
|
+
AI agents unknowinly modify the same souce three.
|
|
187
190
|
test_files: []
|