agentlane 0.5.0 → 0.5.1
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/CHANGELOG.md +11 -0
- package/dist/agents/claude-plugin.js +17 -2
- package/dist/devices/hygiene.js +20 -4
- package/dist/registry/registry.js +3 -1
- package/dist/registry/store.js +2 -1
- package/dist/services/services.js +4 -2
- package/dist/up/doctor.js +2 -1
- package/dist/up/up.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Newest first.
|
|
4
4
|
|
|
5
|
+
## 0.5.1
|
|
6
|
+
|
|
7
|
+
Three checks no longer fail things that work, and the registry's lock holder names its caller.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **A simulator location nothing reports no longer stops `up`.** locationd reports the simulated location only while an app is receiving one, so on a simulator where no app is, capture hygiene read nothing back after setting the location three times, failed, and `up` stopped before it launched the app. `up` now counts that location as set and says it is unconfirmed: `hygiene: applied location (unconfirmed: nothing read back after setting it 3 times over 46 s; locationd reports a location only while an app is receiving one)`. `doctor` warns instead of failing. A location read back at another coordinate still fails.
|
|
12
|
+
- **`up` keeps a running service whose listener can't be read.** When `lsof` timed out, `up` and `doctor` counted a dev server whose process was alive and whose ready check passed as failed, and `up` stopped and restarted it. Its ready check now stands for it, and `up` says `the listener on <port> could not be read`.
|
|
13
|
+
- **`doctor` sees the Claude Code plugin from a git worktree.** A project-scope install also loads in the git worktrees of the checkout it was installed for, and `doctor` warned there that Claude Code hadn't installed the plugin.
|
|
14
|
+
- **The registry's lock holder names an `exec` and other lane touches.** A busy refusal named a long `exec` as "an unidentified caller"; it now reads, for example, `agentlane exec: sh, on lane ab2ea94d`.
|
|
15
|
+
|
|
5
16
|
## 0.5.0
|
|
6
17
|
|
|
7
18
|
A lane now gives its simulator or emulator back when nobody uses it, and ends on its own once its session is gone, whether or not the session ran `release` or its session-end hook fired. The hooks move into every agent's project settings, plugin or not, and `doctor` proves they run. `prune` and the tool installs leave less on disk. This version runs beside 0.4.1 on the same Mac; "Sharing a Mac with 0.4.1" lists what 0.4.1 still does differently.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { FORMER, TOOL } from "../name.js";
|
|
@@ -76,10 +77,22 @@ function sameDir(a, b) {
|
|
|
76
77
|
return path.resolve(a) === path.resolve(b);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
80
|
+
/** The folder itself and, inside a git worktree, the repository's main checkout. */
|
|
81
|
+
function checkoutsOf(root, env) {
|
|
82
|
+
const result = spawnSync('git', ['-C', root, 'rev-parse', '--path-format=absolute', '--git-common-dir'], {
|
|
83
|
+
encoding: 'utf8',
|
|
84
|
+
env,
|
|
85
|
+
});
|
|
86
|
+
if (result.status !== 0)
|
|
87
|
+
return [root];
|
|
88
|
+
const common = result.stdout.trim();
|
|
89
|
+
return path.basename(common) === '.git' ? [root, path.dirname(common)] : [root];
|
|
90
|
+
}
|
|
79
91
|
/**
|
|
80
92
|
* Where Claude Code loads the enabled plugin from on this Mac. Claude Code records what it installed in
|
|
81
93
|
* `plugins/installed_plugins.json` under its config folder: format 2 maps `<plugin>@<marketplace>` to a list of
|
|
82
|
-
* installs, each with a `scope`, a `projectPath` for project and local scopes, and an `installPath`.
|
|
94
|
+
* installs, each with a `scope`, a `projectPath` for project and local scopes, and an `installPath`. A project-scope
|
|
95
|
+
* install also loads in the git worktrees of the checkout it names (Claude Code 2.1.325).
|
|
83
96
|
*/
|
|
84
97
|
export function claudePluginInstall(root, env) {
|
|
85
98
|
const session = sessionPluginDir(env);
|
|
@@ -94,6 +107,7 @@ export function claudePluginInstall(root, env) {
|
|
|
94
107
|
const plugins = jsonObjectAt(file)?.plugins;
|
|
95
108
|
if (typeof plugins !== 'object' || plugins === null)
|
|
96
109
|
return { kind: 'unknown' };
|
|
110
|
+
let checkouts;
|
|
97
111
|
for (const key of keys) {
|
|
98
112
|
const listed = plugins[key];
|
|
99
113
|
const installs = Array.isArray(listed) ? listed : listed === undefined ? [] : [listed];
|
|
@@ -101,7 +115,8 @@ export function claudePluginInstall(root, env) {
|
|
|
101
115
|
if (typeof install !== 'object' || install === null)
|
|
102
116
|
continue;
|
|
103
117
|
const { scope, projectPath, installPath } = install;
|
|
104
|
-
|
|
118
|
+
checkouts ??= checkoutsOf(root, env);
|
|
119
|
+
const here = scope === undefined || scope === 'user' || checkouts.some(dir => sameDir(projectPath, dir));
|
|
105
120
|
if (here && typeof installPath === 'string')
|
|
106
121
|
return { kind: 'loaded', dir: installPath };
|
|
107
122
|
}
|
package/dist/devices/hygiene.js
CHANGED
|
@@ -31,6 +31,7 @@ export const STATUS_BAR_PIN_FIELDS = {
|
|
|
31
31
|
'Battery Level': '100',
|
|
32
32
|
};
|
|
33
33
|
const LOCATION_FRESH_MS = 3000;
|
|
34
|
+
const LOCATION_UNHEARD = 'locationd reports a location only while an app is receiving one';
|
|
34
35
|
const LOCATION_HEARD_MS = 300_000;
|
|
35
36
|
const COORDINATE_TOLERANCE = 5e-8;
|
|
36
37
|
export class HygieneError extends DeviceStateError {
|
|
@@ -62,6 +63,9 @@ function formatStatusBar(fields) {
|
|
|
62
63
|
const entries = Object.entries(fields ?? {});
|
|
63
64
|
return entries.length === 0 ? 'no overrides' : entries.map(([key, value]) => `${key} ${value}`).join(', ');
|
|
64
65
|
}
|
|
66
|
+
function formatWindow(ms) {
|
|
67
|
+
return ms % 60_000 === 0 ? `${String(ms / 60_000)} min` : `${String(Math.round(ms / 1000))} s`;
|
|
68
|
+
}
|
|
65
69
|
function message(error) {
|
|
66
70
|
return error instanceof Error ? error.message : String(error);
|
|
67
71
|
}
|
|
@@ -103,6 +107,7 @@ function steps(tools, udid, options) {
|
|
|
103
107
|
}
|
|
104
108
|
},
|
|
105
109
|
tries: () => `after setting it ${String(sets)} time${sets === 1 ? '' : 's'} over ${String(Math.round((tools.now().getTime() - locationSetAt.getTime()) / 1000))} s`,
|
|
110
|
+
unheard: LOCATION_UNHEARD,
|
|
106
111
|
};
|
|
107
112
|
const keyboardStep = {
|
|
108
113
|
name: 'keyboard',
|
|
@@ -147,10 +152,18 @@ function steps(tools, udid, options) {
|
|
|
147
152
|
export async function checkHygiene(tools, udid, options = {}) {
|
|
148
153
|
await requireBooted(tools, udid);
|
|
149
154
|
const checks = [];
|
|
150
|
-
|
|
155
|
+
const lookbackMs = options.locationLookbackMs ?? LOCATION_HEARD_MS;
|
|
156
|
+
for (const step of steps(tools, udid, { ...options, locationLookbackMs: lookbackMs })) {
|
|
151
157
|
try {
|
|
152
158
|
const got = await step.read();
|
|
153
|
-
|
|
159
|
+
const unheard = got === undefined ? step.unheard : undefined;
|
|
160
|
+
checks.push({
|
|
161
|
+
step: step.name,
|
|
162
|
+
wanted: step.wanted,
|
|
163
|
+
got: step.format(got),
|
|
164
|
+
ok: step.matches(got) || unheard !== undefined,
|
|
165
|
+
...(unheard ? { unconfirmed: `nothing read back in the last ${formatWindow(lookbackMs)}; ${unheard}` } : {}),
|
|
166
|
+
});
|
|
154
167
|
}
|
|
155
168
|
catch (error) {
|
|
156
169
|
checks.push({ step: step.name, wanted: step.wanted, got: `unreadable (${message(error)})`, ok: false });
|
|
@@ -172,7 +185,9 @@ export async function applyHygiene(tools, udid, options = {}) {
|
|
|
172
185
|
}
|
|
173
186
|
await step.apply();
|
|
174
187
|
const after = await step.readBack();
|
|
175
|
-
const
|
|
188
|
+
const unheard = after === undefined ? step.unheard : undefined;
|
|
189
|
+
const ok = step.matches(after) || unheard !== undefined;
|
|
190
|
+
const tries = step.tries?.();
|
|
176
191
|
reports.push({
|
|
177
192
|
step: step.name,
|
|
178
193
|
wanted: step.wanted,
|
|
@@ -180,7 +195,8 @@ export async function applyHygiene(tools, udid, options = {}) {
|
|
|
180
195
|
after: step.format(after),
|
|
181
196
|
changed: true,
|
|
182
197
|
ok,
|
|
183
|
-
...(!ok &&
|
|
198
|
+
...(!ok && tries ? { tries } : {}),
|
|
199
|
+
...(unheard ? { unconfirmed: `nothing read back${tries ? ` ${tries}` : ''}; ${unheard}` } : {}),
|
|
184
200
|
});
|
|
185
201
|
}
|
|
186
202
|
catch (error) {
|
|
@@ -16,7 +16,7 @@ import { NotClaimed, Refusal, UsageError } from "./refusal.js";
|
|
|
16
16
|
import { endTeardown, failResource, failTeardown, finishResource, holdersBeforeLock, pendingTeardowns, startResource, takeTeardowns, } from "./resources.js";
|
|
17
17
|
import { loadLane, ownerFromRow, processesOf } from "./rows.js";
|
|
18
18
|
import { readStatus } from "./status.js";
|
|
19
|
-
import { int, optInt, optText, Store, text } from "./store.js";
|
|
19
|
+
import { int, optInt, optText, Store, text, UNIDENTIFIED } from "./store.js";
|
|
20
20
|
export const STEPS = [
|
|
21
21
|
'claim:inspected',
|
|
22
22
|
'claim:locked',
|
|
@@ -1621,6 +1621,8 @@ export class Registry {
|
|
|
1621
1621
|
return ended;
|
|
1622
1622
|
}
|
|
1623
1623
|
touch(ref, action) {
|
|
1624
|
+
if (this.store.actor.who === UNIDENTIFIED)
|
|
1625
|
+
this.store.actor = { ...this.store.actor, who: `${TOOL} ${action}, on lane ${ref.id}` };
|
|
1624
1626
|
return this.store.write(() => {
|
|
1625
1627
|
this.step('touch:locked');
|
|
1626
1628
|
this.requireLane(ref);
|
package/dist/registry/store.js
CHANGED
|
@@ -213,11 +213,12 @@ function untilFree(deadline, action, onTimeout) {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
+
export const UNIDENTIFIED = 'an unidentified caller';
|
|
216
217
|
export class Store {
|
|
217
218
|
db;
|
|
218
219
|
dir;
|
|
219
220
|
lockWaitMs;
|
|
220
|
-
actor = { who:
|
|
221
|
+
actor = { who: UNIDENTIFIED, folder: process.cwd() };
|
|
221
222
|
constructor(dir, db, lockWaitMs) {
|
|
222
223
|
this.dir = dir;
|
|
223
224
|
this.db = db;
|
|
@@ -140,7 +140,7 @@ export async function inspectService(system, service, port, proc) {
|
|
|
140
140
|
const leader = check?.state ?? 'not-started';
|
|
141
141
|
const listeners = listenersOn(system, port, leader === 'alive' && proc ? proc.pid : null);
|
|
142
142
|
const probe = await probeReady(service.ready, port);
|
|
143
|
-
const ours = listeners
|
|
143
|
+
const ours = listeners === null || (listeners.length > 0 && listeners.every(l => l.ours));
|
|
144
144
|
return {
|
|
145
145
|
service: service.name,
|
|
146
146
|
port,
|
|
@@ -156,7 +156,9 @@ export async function inspectService(system, service, port, proc) {
|
|
|
156
156
|
export function explainInspection(inspection) {
|
|
157
157
|
const parts = [inspection.leaderDetail];
|
|
158
158
|
if (inspection.listeners === null)
|
|
159
|
-
parts.push(
|
|
159
|
+
parts.push(inspection.healthy
|
|
160
|
+
? `the listener on ${String(inspection.port)} could not be read, so its ready check stands for it`
|
|
161
|
+
: `the listener on ${String(inspection.port)} could not be read`);
|
|
160
162
|
else if (inspection.listeners.length === 0)
|
|
161
163
|
parts.push(`nothing listens on ${String(inspection.port)}`);
|
|
162
164
|
else {
|
package/dist/up/doctor.js
CHANGED
|
@@ -328,9 +328,10 @@ export async function diagnose(deps, input) {
|
|
|
328
328
|
name: 'hygiene',
|
|
329
329
|
ok: hygiene.ok,
|
|
330
330
|
detail: hygiene.ok
|
|
331
|
-
? hygiene.steps.map(s => `${s.step} ${s.got}`).join('; ')
|
|
331
|
+
? hygiene.steps.map(s => (s.unconfirmed ? `${s.step} unconfirmed: ${s.unconfirmed}` : `${s.step} ${s.got}`)).join('; ')
|
|
332
332
|
: off.map(s => `${s.step} reads ${s.got}, not ${s.wanted}`).join('; '),
|
|
333
333
|
fix: UP,
|
|
334
|
+
...(hygiene.ok && hygiene.steps.some(s => s.unconfirmed) ? { warning: true } : {}),
|
|
334
335
|
});
|
|
335
336
|
}
|
|
336
337
|
catch (error) {
|
package/dist/up/up.js
CHANGED
|
@@ -209,8 +209,10 @@ async function ensureService(ctx, service) {
|
|
|
209
209
|
const recorded = recordedProcess(lane, service.name);
|
|
210
210
|
if (recorded) {
|
|
211
211
|
const seen = await inspectService(deps.system, service, port, recorded);
|
|
212
|
-
if (seen.healthy)
|
|
213
|
-
|
|
212
|
+
if (seen.healthy) {
|
|
213
|
+
const unread = seen.listeners === null ? `; the listener on ${String(port)} could not be read` : '';
|
|
214
|
+
return `already running on ${String(port)} (pid ${String(recorded.pid)}); ${seen.readyDetail}${unread}`;
|
|
215
|
+
}
|
|
214
216
|
const stopped = await stopClaimedService(ctx, recorded);
|
|
215
217
|
const started = await startClaimedService(ctx, service, port);
|
|
216
218
|
return `${started}, replacing pid ${String(recorded.pid)}, which failed its check (${explainInspection(seen)}): ${stopped}`;
|
|
@@ -345,7 +347,7 @@ async function deviceSteps(ctx, run, options, booting, approval, setup) {
|
|
|
345
347
|
}, report => report.changed
|
|
346
348
|
? `applied ${report.steps
|
|
347
349
|
.filter(s => s.changed)
|
|
348
|
-
.map(s => s.step)
|
|
350
|
+
.map(s => (s.unconfirmed ? `${s.step} (unconfirmed: ${s.unconfirmed})` : s.step))
|
|
349
351
|
.join(', ')}`
|
|
350
352
|
: 'already in place');
|
|
351
353
|
await run.step('launch', () => launch(ctx), detail => detail);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentlane",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Gives each coding agent its own lane: a running copy of your app with its own ports, dev servers, database, and a simulator, emulator or browser to drive it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|