trantor 0.18.129 → 0.18.130
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/.claude-plugin/plugin.json +1 -1
- package/README.md +10 -1
- package/bin/cli.mjs +2 -0
- package/bin/crew/herdr.mjs +30 -8
- package/bin/crew-runner.mjs +7 -1
- package/bin/desktop-build-gate.mjs +35 -0
- package/bin/doctor.mjs +15 -0
- package/bin/install-axe.sh +24 -0
- package/bin/sim.mjs +235 -0
- package/lib/seat-worktree.mjs +17 -5
- package/lib/sim/axe-status.mjs +10 -0
- package/lib/tauri-version-parity.mjs +59 -0
- package/package.json +1 -1
- package/skills/sim/SKILL.md +54 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trantor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.130",
|
|
4
4
|
"description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek)",
|
|
5
5
|
"mcpServers": {
|
|
6
6
|
"relay": {
|
package/README.md
CHANGED
|
@@ -417,7 +417,7 @@ rate, not work rate.
|
|
|
417
417
|
```
|
|
418
418
|
trantor setup | doctor | connect | profile | provider | models
|
|
419
419
|
| new <name> | up <agents…> | swap <old> <new> | down | seat-why <agent> | ui | advise | hub | watch
|
|
420
|
-
| adopt <project> | reconcile | duty | orchestrate | patrol | app | backfill | init-hooks | pair
|
|
420
|
+
| adopt <project> | reconcile | duty | orchestrate | patrol | app | backfill | init-hooks | pair | sim
|
|
421
421
|
```
|
|
422
422
|
|
|
423
423
|
- **`trantor pair`** pairs the iPhone and iPad companion app (`ios/`, an operator console for
|
|
@@ -427,6 +427,15 @@ trantor setup | doctor | connect | profile | provider | models
|
|
|
427
427
|
scripts, and `--role owner` widens the scope. The desktop app's Settings shows the same invite
|
|
428
428
|
as a QR code. It signs as the operator's owner identity (`TRANTOR_IDENTITY`, default `owner@laptop`).
|
|
429
429
|
|
|
430
|
+
- **`trantor sim`** drives the iOS Simulator on a Mac for agents, through
|
|
431
|
+
[AXe](https://github.com/cameroncooke/AXe) (pinned v2.1.1, installed with
|
|
432
|
+
`bash bin/install-axe.sh`, which checks its SHA-256): `boot <device>`, `install <app>`,
|
|
433
|
+
`launch <bundle>`, `screen` (screenshot plus the accessibility tree in point coordinates),
|
|
434
|
+
`tap --label | --id | --xy`, `swipe`, `type`, `shutdown`. Every verb prints JSON. It refuses to
|
|
435
|
+
boot over another session's simulator and shuts down only its own. The `sim` skill gives agents
|
|
436
|
+
the drill loop; the XCTest drills in `ios/` stay the regression gate. `trantor doctor` reports
|
|
437
|
+
the AXe pin.
|
|
438
|
+
|
|
430
439
|
- **`trantor new <name>`** — project genesis in one command: makes the dir under your dev root
|
|
431
440
|
(`TRANTOR_DEV_ROOT` or `~/development`), git on main (or `--from <git-url>`, or `--adopt` an
|
|
432
441
|
existing folder), installs the auto-card hook, posts the brief to the hub, and opens the first
|
package/bin/cli.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const runCrew = () => {
|
|
|
20
20
|
switch (cmd) {
|
|
21
21
|
case "setup": run("deploy/setup.sh", "/bin/bash"); break;
|
|
22
22
|
case "doctor": run("bin/doctor.mjs"); break;
|
|
23
|
+
case "sim": run("bin/sim.mjs"); break;
|
|
23
24
|
case "connect": run("bin/connect.mjs"); break;
|
|
24
25
|
case "profile": run("bin/profile.mjs"); break;
|
|
25
26
|
case "provider": case "providers": run("bin/provider.mjs"); break;
|
|
@@ -239,6 +240,7 @@ switch (cmd) {
|
|
|
239
240
|
|
|
240
241
|
trantor setup one-shot install: hub as an always-on service + config + CLI wiring + doctor
|
|
241
242
|
trantor doctor where do I stand? hub/plugin/CLIs/auth/keys/profile, with copy-paste fixes
|
|
243
|
+
trantor sim drive the owned iOS Simulator through AXe: boot|install|launch|screen|tap|swipe|type|shutdown
|
|
242
244
|
trantor connect (re)wire every installed AI CLI to the bus
|
|
243
245
|
trantor profile declare your plans: trantor profile set claude=max codex=plus deepseek=api
|
|
244
246
|
trantor provider bring ANY model (BYOM): list · status [--json] · verify <name> --key … · add <name> --key … · remove <name>
|
package/bin/crew/herdr.mjs
CHANGED
|
@@ -59,14 +59,36 @@ export function workspacePane(ctx, workspace, preferredCwd) {
|
|
|
59
59
|
return "";
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// #13922: the herdr home(s) of the process RUNNING the crew CLI, when it itself sits in a pane —
|
|
63
|
+
// HERDR_WORKSPACE_ID names it, and a pane id embeds it (w2:p4Y lives in w2, #7247 forensics).
|
|
64
|
+
// Closing such a workspace kills this very shell and every sibling pane in it (the 11-20 netcup
|
|
65
|
+
// incident: one workspace.close from inside a seat's test run took the whole crew down).
|
|
66
|
+
function callerHerdrHomes(ctx) {
|
|
67
|
+
const env = ctx.env || {};
|
|
68
|
+
const pane = String(env.HERDR_PANE_ID || "").trim();
|
|
69
|
+
return new Set([String(env.HERDR_WORKSPACE_ID || "").trim(), pane ? pane.split(":")[0] : ""].filter(Boolean));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function refusal(what) {
|
|
73
|
+
console.error(` ✗ refusing to close herdr ${what}: it hosts this very process (own HERDR pane/workspace env). Close it from outside the crew, or set TRANTOR_CLOSE_OWN_WORKSPACE=1 to override.`);
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
export function closeWorkspace(ctx, id) {
|
|
63
|
-
if (ctx.
|
|
64
|
-
|
|
77
|
+
if (callerHerdrHomes(ctx).has(id) && String(ctx.env?.TRANTOR_CLOSE_OWN_WORKSPACE || "") !== "1") {
|
|
78
|
+
refusal(`workspace ${id}`);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (ctx.dry) { console.log(`[dry] herdr workspace close ${id}`); return true; }
|
|
82
|
+
return herdrCall(ctx, ["workspace", "close", id]).ok;
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
export function closePane(ctx, id) {
|
|
68
|
-
if (ctx.
|
|
69
|
-
|
|
86
|
+
if (id && String(ctx.env?.HERDR_PANE_ID || "").trim() === id && String(ctx.env?.TRANTOR_CLOSE_OWN_WORKSPACE || "") !== "1") {
|
|
87
|
+
refusal(`pane ${id}`);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (ctx.dry) { console.log(`[dry] herdr pane close ${id}`); return true; }
|
|
91
|
+
return herdrCall(ctx, ["pane", "close", id]).ok;
|
|
70
92
|
}
|
|
71
93
|
|
|
72
94
|
export function reportAgent(ctx, pane, agent) {
|
|
@@ -128,8 +150,8 @@ function prepareWorkspace(ctx, prune) {
|
|
|
128
150
|
// killed its own orchestrator that way. The row stays: the workspace is still live.
|
|
129
151
|
if (id === tracked.reuse || orchSpaces.has(id)) continue;
|
|
130
152
|
console.log(` → closing stale stacked crew workspace for ${ctx.project} (${id})`);
|
|
131
|
-
|
|
132
|
-
dropState(ctx, ctx.project, "herdrws", "", id);
|
|
153
|
+
// #13922: a refused close (the caller's own home) leaves the workspace live, so its row stays.
|
|
154
|
+
if (closeWorkspace(ctx, id)) dropState(ctx, ctx.project, "herdrws", "", id);
|
|
133
155
|
}
|
|
134
156
|
if (tracked.stale.length) prune();
|
|
135
157
|
if (ctx.dry) return tracked.reuse;
|
|
@@ -169,8 +191,8 @@ function replacementPane(ctx, workspace, spec, hostPane, resolve) {
|
|
|
169
191
|
runSeat(ctx, pane, (seat.persona || seat.agent), runnerCommand(ctx, seat.agent, seat.model, seat.effort, seat.persona));
|
|
170
192
|
}
|
|
171
193
|
if (old) {
|
|
172
|
-
|
|
173
|
-
dropState(ctx, ctx.project, "herdr", (seat.persona || seat.agent));
|
|
194
|
+
// #13922: a refused/failed close leaves the old pane live, so its row stays with it.
|
|
195
|
+
if (closePane(ctx, old)) dropState(ctx, ctx.project, "herdr", (seat.persona || seat.agent));
|
|
174
196
|
}
|
|
175
197
|
return { ...seat, pane };
|
|
176
198
|
}
|
package/bin/crew-runner.mjs
CHANGED
|
@@ -1943,7 +1943,13 @@ async function resolveWakeCard(messages, { session }) {
|
|
|
1943
1943
|
savePending([], pendingBcast);
|
|
1944
1944
|
return;
|
|
1945
1945
|
}
|
|
1946
|
-
if (aligned.parked)
|
|
1946
|
+
if (aligned.parked) {
|
|
1947
|
+
const notice = `saved unharvested seat commits at ${aligned.parked} before aligning #${card} to ${base}`;
|
|
1948
|
+
log(notice);
|
|
1949
|
+
const owed = assigners.map(a => a.from).filter(f => f && f !== SESSION);
|
|
1950
|
+
for (const to of (owed.length ? owed : ["all"]))
|
|
1951
|
+
await api("/send", { from: SESSION, to, text: notice, project: PROJ, kind: "alert" }).catch(() => {});
|
|
1952
|
+
}
|
|
1947
1953
|
}
|
|
1948
1954
|
const baseText = base ? `\n${baseLine(base)}\n` : "";
|
|
1949
1955
|
// #6289: the session SHAPE (fresh vs resume) reads the served contract's raw citation — a wake
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { checkTauriVersionParity } from "../lib/tauri-version-parity.mjs";
|
|
6
|
+
|
|
7
|
+
const ROOT = fileURLToPath(new URL("../", import.meta.url));
|
|
8
|
+
let parity;
|
|
9
|
+
try {
|
|
10
|
+
parity = checkTauriVersionParity(join(ROOT, "desktop"));
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error(`desktop-build-gate: ${error.message}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const mismatches = parity.filter(pair => !pair.matches);
|
|
16
|
+
for (const pair of mismatches) {
|
|
17
|
+
console.error(`desktop-build-gate: ${pair.crateName} ${pair.cargoVersion} != ${pair.npmPackage} ${pair.npmVersion}; major.minor must match`);
|
|
18
|
+
}
|
|
19
|
+
if (mismatches.length) process.exit(1);
|
|
20
|
+
console.log(`Tauri version parity: ${parity.length} pair${parity.length === 1 ? "" : "s"} matched`);
|
|
21
|
+
|
|
22
|
+
const result = spawnSync(process.execPath, [
|
|
23
|
+
join(ROOT, "bin", "cargo-gate.mjs"),
|
|
24
|
+
"check",
|
|
25
|
+
"--release",
|
|
26
|
+
"--locked",
|
|
27
|
+
"--manifest-path",
|
|
28
|
+
"desktop/src-tauri/Cargo.toml",
|
|
29
|
+
], { cwd: ROOT, stdio: "inherit" });
|
|
30
|
+
|
|
31
|
+
if (result.error) {
|
|
32
|
+
console.error(`desktop-build-gate: ${result.error.message}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
process.exit(result.status ?? 1);
|
package/bin/doctor.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import { scan } from "../lib/splitbrain.mjs";
|
|
|
15
15
|
import { resolveSecrets, envFileSecrets, backendFor } from "../lib/secrets.mjs";
|
|
16
16
|
import { resolveStateFlags } from "../lib/state/flags.mjs";
|
|
17
17
|
import { probeClaudeIntegration, HERDR_CLAUDE_INSTALL } from "../lib/herdr-integration.mjs";
|
|
18
|
+
import { axeDoctorStatus } from "../lib/sim/axe-status.mjs";
|
|
18
19
|
|
|
19
20
|
const H = homedir();
|
|
20
21
|
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
@@ -362,6 +363,20 @@ prof?.providers && Object.keys(prof.providers).length
|
|
|
362
363
|
// billing issues while the duty seat had held 48 undelivered messages for 22 hours and finished
|
|
363
364
|
// crew work went unread overnight: credentials EXIST is not the fleet is MOVING. Both signals are
|
|
364
365
|
// already on disk, written by the runner itself.
|
|
366
|
+
section("iOS simulator driver");
|
|
367
|
+
{
|
|
368
|
+
const present = has("axe");
|
|
369
|
+
let version = "";
|
|
370
|
+
if (present) {
|
|
371
|
+
try { version = execSync("axe --version", { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim(); }
|
|
372
|
+
catch { version = ""; }
|
|
373
|
+
}
|
|
374
|
+
const status = axeDoctorStatus(process.platform, present, version);
|
|
375
|
+
if (status.kind === "ok") ok(status.message);
|
|
376
|
+
else if (status.kind === "warn") warn(status.message, `bash ${join(ROOT, "bin", "install-axe.sh")}`);
|
|
377
|
+
else note(status.message);
|
|
378
|
+
}
|
|
379
|
+
|
|
365
380
|
section("the fleet (is it actually running?)");
|
|
366
381
|
{
|
|
367
382
|
const busDir = join(H, ".agent-bus");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
if [[ "$(uname -s)" != Darwin ]]; then
|
|
5
|
+
echo "AXe v2.1.1 requires macOS; install it on the Mac that hosts the iOS Simulator." >&2
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
VERSION="2.1.1"
|
|
10
|
+
SHA256="8788838b1b32059d143cf06541b72fcaead85c16274457cdbff086510a5b17fa"
|
|
11
|
+
ARCHIVE="AXe-macOS-v${VERSION}-universal.tar.gz"
|
|
12
|
+
URL="https://github.com/cameroncooke/AXe/releases/download/v${VERSION}/${ARCHIVE}"
|
|
13
|
+
DEST="${HOME}/.local/share/trantor/axe/v${VERSION}"
|
|
14
|
+
BIN="${HOME}/.local/bin"
|
|
15
|
+
TMP="$(mktemp -d)"
|
|
16
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
17
|
+
|
|
18
|
+
mkdir -p "$DEST" "$BIN"
|
|
19
|
+
curl --fail --location --silent --show-error "$URL" -o "$TMP/$ARCHIVE"
|
|
20
|
+
echo "$SHA256 $TMP/$ARCHIVE" | shasum -a 256 -c -
|
|
21
|
+
tar -xzf "$TMP/$ARCHIVE" -C "$DEST"
|
|
22
|
+
ln -sfn "$DEST/axe" "$BIN/axe"
|
|
23
|
+
echo "Installed AXe v${VERSION} at $DEST/axe"
|
|
24
|
+
echo "Ensure $BIN is on PATH, then verify with: axe --version"
|
package/bin/sim.mjs
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const AXE_INSTALL = `bash ${join(dirname(fileURLToPath(import.meta.url)), "install-axe.sh")}`;
|
|
10
|
+
const [, , verb, ...args] = process.argv;
|
|
11
|
+
const owner = process.env.RELAY_SESSION || process.env.CLAUDE_SESSION_ID || process.cwd();
|
|
12
|
+
const ownerId = createHash("sha256").update(owner).digest("hex").slice(0, 16);
|
|
13
|
+
const registryPath = process.env.TRANTOR_SIM_REGISTRY || join(tmpdir(), "trantor-sim-registry.json");
|
|
14
|
+
const outputRoot = process.env.TRANTOR_SIM_OUTPUT || join(process.cwd(), ".agent-bus-out", "sim");
|
|
15
|
+
|
|
16
|
+
function fail(reason) {
|
|
17
|
+
console.error(String(reason).trim() || "simulator command failed");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function command(file, argv, { optional = false } = {}) {
|
|
22
|
+
const result = spawnSync(file, argv, { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 });
|
|
23
|
+
if (result.error?.code === "ENOENT" && optional) return null;
|
|
24
|
+
if (result.error) fail(`${file} failed: ${result.error.message}`);
|
|
25
|
+
if (result.status !== 0) fail((result.stderr || result.stdout || `${file} exited ${result.status}`).trim());
|
|
26
|
+
return result.stdout || "";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function axe(args) {
|
|
30
|
+
const result = spawnSync("axe", args, { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 });
|
|
31
|
+
if (result.error?.code === "ENOENT") fail(`AXe is missing. Install the pinned release with: ${AXE_INSTALL}`);
|
|
32
|
+
if (result.error) fail(`axe failed: ${result.error.message}`);
|
|
33
|
+
if (result.status !== 0) fail((result.stderr || result.stdout || `axe exited ${result.status}`).trim());
|
|
34
|
+
return result.stdout || "";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function registry() {
|
|
38
|
+
try { return JSON.parse(readFileSync(registryPath, "utf8")); }
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code === "ENOENT") return { owners: {} };
|
|
41
|
+
fail(`cannot read simulator registry: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function saveRegistry(value) {
|
|
46
|
+
mkdirSync(dirname(registryPath), { recursive: true });
|
|
47
|
+
const temp = `${registryPath}.${process.pid}.tmp`;
|
|
48
|
+
writeFileSync(temp, JSON.stringify(value));
|
|
49
|
+
renameSync(temp, registryPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function simulators() {
|
|
53
|
+
let list;
|
|
54
|
+
try { list = JSON.parse(command("xcrun", ["simctl", "list", "devices", "--json"])); }
|
|
55
|
+
catch (error) { fail(`could not read Simulator devices: ${error.message}`); }
|
|
56
|
+
return Object.values(list.devices || {}).flat();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function selected() {
|
|
60
|
+
const id = registry().owners[ownerId]?.udid;
|
|
61
|
+
if (!id) fail("this session has no simulator; run trantor sim boot <device> first");
|
|
62
|
+
const device = simulators().find((item) => item.udid === id);
|
|
63
|
+
if (!device || device.state !== "Booted") fail(`owned simulator ${id} is not booted; run trantor sim boot <device>`);
|
|
64
|
+
return device;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function emit(value) { process.stdout.write(`${JSON.stringify(value)}\n`); }
|
|
68
|
+
|
|
69
|
+
function resolveDevice(name, devices) {
|
|
70
|
+
const matches = devices.filter((device) => device.udid === name || device.name === name);
|
|
71
|
+
if (matches.length === 0) fail(`simulator not found: ${name}`);
|
|
72
|
+
if (matches.length > 1) fail(`simulator name is ambiguous: ${name}; pass its UDID`);
|
|
73
|
+
return matches[0];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function parseTree(raw) {
|
|
77
|
+
let tree;
|
|
78
|
+
try { tree = JSON.parse(raw); }
|
|
79
|
+
catch { fail("AXe returned invalid accessibility JSON"); }
|
|
80
|
+
if (tree?.didError) fail(tree.error?.message || "AXe accessibility read failed");
|
|
81
|
+
const root = tree?.data?.result ?? tree;
|
|
82
|
+
const elements = [];
|
|
83
|
+
let maxX = 0, maxY = 0;
|
|
84
|
+
const visit = (node) => {
|
|
85
|
+
if (Array.isArray(node)) { for (const child of node) visit(child); return; }
|
|
86
|
+
if (!node || Object.getPrototypeOf(node) !== Object.prototype) return;
|
|
87
|
+
const frame = node.frame || node.AXFrame;
|
|
88
|
+
if (frame && Object.getPrototypeOf(frame) === Object.prototype) {
|
|
89
|
+
const x = Number(frame.x ?? 0), y = Number(frame.y ?? 0);
|
|
90
|
+
const width = Number(frame.width ?? 0), height = Number(frame.height ?? 0);
|
|
91
|
+
if ([x, y, width, height].every(Number.isFinite)) {
|
|
92
|
+
maxX = Math.max(maxX, x + width); maxY = Math.max(maxY, y + height);
|
|
93
|
+
const label = node.AXLabel ?? node.label ?? node.title ?? node.AXValue ?? "";
|
|
94
|
+
const role = node.role_description ?? node.role ?? node.type ?? node.AXRole ?? "";
|
|
95
|
+
const id = node.AXUniqueId ?? node.identifier ?? node.id;
|
|
96
|
+
if (label || role || id) {
|
|
97
|
+
const element = { frame: { x, y, width, height }, enabled: node.enabled ?? node.isEnabled ?? true };
|
|
98
|
+
if (label) element.label = String(label);
|
|
99
|
+
if (id) element.id = String(id);
|
|
100
|
+
if (role) element.role = String(role);
|
|
101
|
+
elements.push({ ...element, _hasLabelOrId: Boolean(label || id), _scrollBarSlider:
|
|
102
|
+
/slider/i.test(String(node.role ?? node.type ?? node.AXRole ?? ""))
|
|
103
|
+
&& /scroll.?bar/i.test([node.role_description, node.roleDescription, node.AXLabel, node.label].filter(Boolean).join(" ")) });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const [key, value] of Object.entries(node)) if (key === "children" || key === "AXChildren") visit(value);
|
|
108
|
+
};
|
|
109
|
+
visit(root);
|
|
110
|
+
if (maxX <= 0 || maxY <= 0) fail("AXe accessibility tree has no screen-sized frame");
|
|
111
|
+
const widthPoints = Math.round(maxX), heightPoints = Math.round(maxY);
|
|
112
|
+
const visible = elements.filter((element) => {
|
|
113
|
+
if (element._scrollBarSlider) return false;
|
|
114
|
+
if (element._hasLabelOrId) return true;
|
|
115
|
+
const { x, y, width, height } = element.frame;
|
|
116
|
+
if (width <= 0 || height <= 0) return false;
|
|
117
|
+
if (x <= 0 && y <= 0 && width >= widthPoints && height >= heightPoints) return false;
|
|
118
|
+
return true;
|
|
119
|
+
}).map(({ _hasLabelOrId, _scrollBarSlider, ...element }) => element);
|
|
120
|
+
return { elements: visible, widthPoints, heightPoints };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function point(value, name) {
|
|
124
|
+
const coords = String(value || "").split(",").map(Number);
|
|
125
|
+
if (coords.length !== 2 || coords.some((part) => !Number.isFinite(part) || part < 0)) fail(`${name} must be x,y in simulator points`);
|
|
126
|
+
return coords;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function pointDimensions(device) {
|
|
130
|
+
const shared = registry();
|
|
131
|
+
const owned = shared.owners[ownerId];
|
|
132
|
+
if (owned.dimensionsPoints?.width > 0 && owned.dimensionsPoints?.height > 0) return owned.dimensionsPoints;
|
|
133
|
+
const tree = parseTree(axe(["describe-ui", "--minimal-keys", "--udid", device.udid]));
|
|
134
|
+
owned.dimensionsPoints = { width: tree.widthPoints, height: tree.heightPoints };
|
|
135
|
+
saveRegistry(shared);
|
|
136
|
+
return owned.dimensionsPoints;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function checkOnScreen(coords, name, dimensions) {
|
|
140
|
+
if (coords[0] >= dimensions.width || coords[1] >= dimensions.height) {
|
|
141
|
+
fail(`${name} point ${coords.join(",")} is outside the simulator screen (${dimensions.width}x${dimensions.height} points)`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
if (verb === "boot") {
|
|
147
|
+
if (args.length !== 1 || !args[0]) fail("usage: trantor sim boot <device-name-or-udid>");
|
|
148
|
+
const devices = simulators();
|
|
149
|
+
const target = resolveDevice(args[0], devices);
|
|
150
|
+
const shared = registry();
|
|
151
|
+
const anotherOwner = Object.entries(shared.owners).find(([key, value]) => key !== ownerId && value.udid === target.udid);
|
|
152
|
+
if (anotherOwner) fail(`simulator ${target.name} is owned by another agent session`);
|
|
153
|
+
const bootedElsewhere = devices.find((device) => device.state === "Booted" && device.udid !== target.udid);
|
|
154
|
+
if (bootedElsewhere) fail(`another simulator is already booted (${bootedElsewhere.name}, ${bootedElsewhere.udid}); shut it down before booting ${target.name}`);
|
|
155
|
+
if (target.state !== "Booted") {
|
|
156
|
+
command("xcrun", ["simctl", "boot", target.udid]);
|
|
157
|
+
command("xcrun", ["simctl", "bootstatus", target.udid, "-b"]);
|
|
158
|
+
}
|
|
159
|
+
shared.owners[ownerId] = { udid: target.udid, name: target.name, startedAt: new Date().toISOString() };
|
|
160
|
+
saveRegistry(shared);
|
|
161
|
+
emit({ verb, udid: target.udid, device: target.name, reused: target.state === "Booted", state: "Booted" });
|
|
162
|
+
} else if (verb === "install") {
|
|
163
|
+
if (args.length !== 1) fail("usage: trantor sim install <app-path>");
|
|
164
|
+
const device = selected(), app = resolve(args[0]);
|
|
165
|
+
command("xcrun", ["simctl", "install", device.udid, app]);
|
|
166
|
+
emit({ verb, udid: device.udid, app });
|
|
167
|
+
} else if (verb === "launch") {
|
|
168
|
+
if (args.length !== 1) fail("usage: trantor sim launch <bundle-id>");
|
|
169
|
+
const device = selected();
|
|
170
|
+
const result = command("xcrun", ["simctl", "launch", device.udid, args[0]]).trim();
|
|
171
|
+
emit({ verb, udid: device.udid, bundle: args[0], result });
|
|
172
|
+
} else if (verb === "screen") {
|
|
173
|
+
const device = selected();
|
|
174
|
+
const outAt = args.indexOf("--out");
|
|
175
|
+
if (args.length && (outAt !== 0 || args.length !== 2 || !args[1])) fail("usage: trantor sim screen [--out <png-path>]");
|
|
176
|
+
const path = resolve(outAt === 0 ? args[1] : join(outputRoot, `screen-${Date.now()}.png`));
|
|
177
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
178
|
+
command("xcrun", ["simctl", "io", device.udid, "screenshot", path]);
|
|
179
|
+
const tree = parseTree(axe(["describe-ui", "--minimal-keys", "--udid", device.udid]));
|
|
180
|
+
const shared = registry();
|
|
181
|
+
shared.owners[ownerId].dimensionsPoints = { width: tree.widthPoints, height: tree.heightPoints };
|
|
182
|
+
saveRegistry(shared);
|
|
183
|
+
const dimensions = command("sips", ["-g", "pixelWidth", "-g", "pixelHeight", path]);
|
|
184
|
+
const pixelWidth = Number(dimensions.match(/pixelWidth:\s*(\d+)/)?.[1]);
|
|
185
|
+
const pixelHeight = Number(dimensions.match(/pixelHeight:\s*(\d+)/)?.[1]);
|
|
186
|
+
if (!pixelWidth || !pixelHeight) fail("could not read screenshot dimensions with sips");
|
|
187
|
+
const scaledPath = `${path}.scaled.png`;
|
|
188
|
+
command("sips", ["-z", String(tree.heightPoints), String(tree.widthPoints), path, "--out", scaledPath]);
|
|
189
|
+
rmSync(path, { force: true });
|
|
190
|
+
command("/bin/mv", [scaledPath, path]);
|
|
191
|
+
emit({ verb, udid: device.udid, screenshot: path, dimensionsPoints: { width: tree.widthPoints, height: tree.heightPoints }, elements: tree.elements });
|
|
192
|
+
} else if (verb === "tap") {
|
|
193
|
+
const device = selected();
|
|
194
|
+
const mode = args[0], value = args[1];
|
|
195
|
+
if (args.length !== 2 || !["--label", "--id", "--xy"].includes(mode) || !value) fail("usage: trantor sim tap --label <text> | --id <identifier> | --xy x,y");
|
|
196
|
+
let target;
|
|
197
|
+
if (mode === "--xy") {
|
|
198
|
+
const coords = point(value, "--xy");
|
|
199
|
+
checkOnScreen(coords, "--xy", pointDimensions(device));
|
|
200
|
+
target = ["-x", String(coords[0]), "-y", String(coords[1])];
|
|
201
|
+
} else target = [mode, value];
|
|
202
|
+
axe(["tap", ...target, "--udid", device.udid]);
|
|
203
|
+
emit({ verb, udid: device.udid, selector: mode, target: value });
|
|
204
|
+
} else if (verb === "swipe") {
|
|
205
|
+
const device = selected();
|
|
206
|
+
if (args.length !== 4 || args[0] !== "--from" || args[2] !== "--to") fail("usage: trantor sim swipe --from x,y --to x,y");
|
|
207
|
+
const from = point(args[1], "--from"), to = point(args[3], "--to");
|
|
208
|
+
const dimensions = pointDimensions(device);
|
|
209
|
+
checkOnScreen(from, "--from", dimensions);
|
|
210
|
+
checkOnScreen(to, "--to", dimensions);
|
|
211
|
+
axe(["swipe", "--start-x", String(from[0]), "--start-y", String(from[1]), "--end-x", String(to[0]), "--end-y", String(to[1]), "--udid", device.udid]);
|
|
212
|
+
emit({ verb, udid: device.udid, from, to });
|
|
213
|
+
} else if (verb === "type") {
|
|
214
|
+
const device = selected(), value = args.join(" ");
|
|
215
|
+
if (!value) fail("usage: trantor sim type <text>");
|
|
216
|
+
axe(["type", value, "--udid", device.udid]);
|
|
217
|
+
emit({ verb, udid: device.udid, characters: [...value].length });
|
|
218
|
+
} else if (verb === "shutdown") {
|
|
219
|
+
if (args.length) fail("usage: trantor sim shutdown");
|
|
220
|
+
const shared = registry(), owned = shared.owners[ownerId];
|
|
221
|
+
if (!owned) { emit({ verb, shutdown: false, reason: "this session owns no simulator" }); }
|
|
222
|
+
else {
|
|
223
|
+
const device = simulators().find((item) => item.udid === owned.udid);
|
|
224
|
+
if (device?.state === "Booted") command("xcrun", ["simctl", "shutdown", owned.udid]);
|
|
225
|
+
delete shared.owners[ownerId];
|
|
226
|
+
saveRegistry(shared);
|
|
227
|
+
emit({ verb, udid: owned.udid, shutdown: device?.state === "Booted", alreadyShutdown: device?.state !== "Booted" });
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
fail("usage: trantor sim <boot|install|launch|screen|tap|swipe|type|shutdown>");
|
|
231
|
+
}
|
|
232
|
+
} catch (error) {
|
|
233
|
+
if (error?.message) fail(error.message);
|
|
234
|
+
fail("simulator command failed");
|
|
235
|
+
}
|
package/lib/seat-worktree.mjs
CHANGED
|
@@ -26,7 +26,7 @@ function gitOut(args, cwd) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Start a new contract from its pinned base unless that base is already in the seat's history.
|
|
29
|
-
//
|
|
29
|
+
// Unharvested commits are parked on harvest/<card-or-sha> before moving the seat branch.
|
|
30
30
|
export function alignSeatWorktree({ dir, project, agent, base, receiptsRoot, log = console.log }) {
|
|
31
31
|
const branch = gitOut(["rev-parse", "--abbrev-ref", "HEAD"], dir);
|
|
32
32
|
const expected = `seat/${agent}`;
|
|
@@ -42,13 +42,25 @@ export function alignSeatWorktree({ dir, project, agent, base, receiptsRoot, log
|
|
|
42
42
|
|
|
43
43
|
const receipts = readReceipts(project, receiptsRoot);
|
|
44
44
|
const audit = auditSeat(dir, { branch, targetRef: base, receipts });
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const parked = [];
|
|
46
|
+
for (const commit of audit.unharvested) {
|
|
47
|
+
const refs = gitOut(["for-each-ref", "--format=%(refname)", "refs/heads/harvest"], dir).split("\n").filter(Boolean);
|
|
48
|
+
const saved = refs.some(ref => spawnSync("git", ["merge-base", "--is-ancestor", commit.sha, ref], { cwd: dir, stdio: "ignore", timeout: 8000 }).status === 0);
|
|
49
|
+
if (saved) continue;
|
|
50
|
+
const subjectCard = commit.subject.match(/#(\d+)/)?.[1];
|
|
51
|
+
const key = subjectCard || commit.sha.slice(0, 7);
|
|
52
|
+
let name = `harvest/${key}`;
|
|
53
|
+
const existing = gitOut(["rev-parse", "--verify", "--quiet", `refs/heads/${name}`], dir);
|
|
54
|
+
if (existing && existing !== commit.sha) name = `harvest/${key}-${commit.sha.slice(0, 7)}`;
|
|
55
|
+
const save = spawnSync("git", ["update-ref", `refs/heads/${name}`, commit.sha], { cwd: dir, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 8000 });
|
|
56
|
+
if (save.status !== 0) return { ok: false, reason: `could not park ${commit.sha.slice(0, 7)} at ${name}: ${String(save.stderr || "git update-ref failed").trim()}` };
|
|
57
|
+
parked.push(name);
|
|
48
58
|
}
|
|
49
59
|
const reset = spawnSync("git", ["reset", "--hard", base], { cwd: dir, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 15000 });
|
|
50
60
|
if (reset.status !== 0) return { ok: false, reason: `could not align to ${base}: ${String(reset.stderr || reset.stdout || "git reset failed").trim()}` };
|
|
51
|
-
|
|
61
|
+
const uniqueParked = [...new Set(parked)];
|
|
62
|
+
if (uniqueParked.length) log(`saved unharvested commits at ${uniqueParked.join(", ")}`);
|
|
63
|
+
return { ok: true, to: gitOut(["rev-parse", "HEAD"], dir), parked: uniqueParked.join(", ") };
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
// Returns { dir, created }: dir is the seat worktree, or sourceDir when no worktree applies
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const AXE_VERSION = "2.1.1";
|
|
2
|
+
|
|
3
|
+
export function axeDoctorStatus(platform, present, version = "") {
|
|
4
|
+
if (platform !== "darwin") return { kind: "note", message: "AXe version check applies on macOS hosts with iOS Simulator." };
|
|
5
|
+
if (!present) return { kind: "warn", message: "AXe missing; install pinned v2.1.1 with the Trantor installer." };
|
|
6
|
+
const found = String(version).trim().replace(/^v/, "");
|
|
7
|
+
if (!found) return { kind: "warn", message: `AXe is present, but its version could not be read; Trantor pins v${AXE_VERSION}.` };
|
|
8
|
+
if (found === AXE_VERSION) return { kind: "ok", message: `AXe v${found} installed (Trantor pin).` };
|
|
9
|
+
return { kind: "warn", message: `AXe v${found} installed; Trantor pins v${AXE_VERSION}.` };
|
|
10
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { parse } from "yaml";
|
|
4
|
+
|
|
5
|
+
function majorMinor(version, source) {
|
|
6
|
+
const match = /^(\d+)\.(\d+)(?:\.|$)/.exec(version);
|
|
7
|
+
if (!match) throw new Error(`${source}: cannot read resolved version ${JSON.stringify(version)}`);
|
|
8
|
+
return `${match[1]}.${match[2]}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function cargoLockVersions(lockfile) {
|
|
12
|
+
const versions = new Map();
|
|
13
|
+
for (const block of lockfile.split("[[package]]").slice(1)) {
|
|
14
|
+
const name = /^name = "([^"]+)"$/m.exec(block)?.[1];
|
|
15
|
+
const version = /^version = "([^"]+)"$/m.exec(block)?.[1];
|
|
16
|
+
if (!name || !version) continue;
|
|
17
|
+
if (!versions.has(name)) versions.set(name, new Set());
|
|
18
|
+
versions.get(name).add(version);
|
|
19
|
+
}
|
|
20
|
+
return versions;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function npmLockVersion(lockfile, packageName) {
|
|
24
|
+
const importer = lockfile.importers?.["."];
|
|
25
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
26
|
+
const version = importer?.[section]?.[packageName]?.version;
|
|
27
|
+
if (version) return version.split("(")[0];
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`desktop/pnpm-lock.yaml: no resolved version for ${packageName}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function checkTauriVersionParity(desktopDir) {
|
|
33
|
+
const manifest = readFileSync(join(desktopDir, "src-tauri", "Cargo.toml"), "utf8");
|
|
34
|
+
const packageJson = JSON.parse(readFileSync(join(desktopDir, "package.json"), "utf8"));
|
|
35
|
+
const cargoLock = cargoLockVersions(readFileSync(join(desktopDir, "src-tauri", "Cargo.lock"), "utf8"));
|
|
36
|
+
const pnpmLock = parse(readFileSync(join(desktopDir, "pnpm-lock.yaml"), "utf8"));
|
|
37
|
+
const npmPackages = { ...packageJson.devDependencies, ...packageJson.dependencies };
|
|
38
|
+
const crateNames = [...manifest.matchAll(/^(tauri|tauri-plugin-[a-z0-9-]+)\s*=/gm)].map(match => match[1]);
|
|
39
|
+
const pairs = [];
|
|
40
|
+
|
|
41
|
+
for (const crateName of new Set(crateNames)) {
|
|
42
|
+
const npmPackage = crateName === "tauri" ? "@tauri-apps/api" : `@tauri-apps/${crateName.slice("tauri-".length)}`;
|
|
43
|
+
if (!npmPackages[npmPackage]) continue;
|
|
44
|
+
const resolvedCargo = [...(cargoLock.get(crateName) || [])];
|
|
45
|
+
if (resolvedCargo.length !== 1) {
|
|
46
|
+
throw new Error(`desktop/src-tauri/Cargo.lock: expected one resolved ${crateName}, found ${resolvedCargo.length}`);
|
|
47
|
+
}
|
|
48
|
+
const cargoVersion = resolvedCargo[0];
|
|
49
|
+
const npmVersion = npmLockVersion(pnpmLock, npmPackage);
|
|
50
|
+
pairs.push({
|
|
51
|
+
crateName,
|
|
52
|
+
npmPackage,
|
|
53
|
+
cargoVersion,
|
|
54
|
+
npmVersion,
|
|
55
|
+
matches: majorMinor(cargoVersion, "desktop/src-tauri/Cargo.lock") === majorMinor(npmVersion, "desktop/pnpm-lock.yaml"),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return pairs;
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trantor-sim
|
|
3
|
+
description: Drive the iOS Simulator on a Mac through Trantor's guarded AXe wrapper for companion app drills and screenshot evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Trantor iOS Simulator
|
|
7
|
+
|
|
8
|
+
Use this skill when an iOS task needs a live simulator. The stable interface is `trantor sim`; do not call raw `xcrun simctl` or `axe` for interactive actions. The wrapper tracks the simulator owned by this session, refuses a conflicting booted simulator, and prints JSON results.
|
|
9
|
+
|
|
10
|
+
This requires a Mac with Xcode and an available iOS Simulator runtime. It cannot drive an iOS Simulator from Linux. If AXe is missing, install the pinned release from the Trantor repository root:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bash bin/install-axe.sh
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The installer downloads AXe v2.1.1 from its official GitHub release and checks the published SHA-256 before extracting it. Ensure `$HOME/.local/bin` is on `PATH`; `trantor doctor` reports whether the pinned version is present.
|
|
17
|
+
|
|
18
|
+
## Run a drill
|
|
19
|
+
|
|
20
|
+
1. Build the iOS app using the task's requested drill and retain the built `.app` path.
|
|
21
|
+
2. Boot one simulator by its exact name or UDID. If another simulator is already booted, stop and coordinate; do not shut down a simulator you did not start.
|
|
22
|
+
3. Install and launch the app, then inspect the screen and accessibility elements.
|
|
23
|
+
4. Interact using an element label/identifier when available. Use point coordinates from the `screen` output only when no stable element selector exists. `screen` writes a PNG under `.agent-bus-out/sim/` and returns its path plus screen-scaled accessibility elements.
|
|
24
|
+
5. Open/read the returned PNG as visual evidence. Capture a new screen after each meaningful action and record screenshots and the observed result in the drill report.
|
|
25
|
+
6. Always call `trantor sim shutdown` in a `finally`/cleanup step, including after a failed build or interaction. Verify the JSON result says `shutdown: true` or the session owns no simulator.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
trantor sim boot "iPhone 17 Pro"
|
|
31
|
+
trantor sim install .agent-bus-out/ios/Trantor.app
|
|
32
|
+
trantor sim launch ai.trantor.companion
|
|
33
|
+
trantor sim screen
|
|
34
|
+
trantor sim tap --label "Continue"
|
|
35
|
+
trantor sim screen
|
|
36
|
+
trantor sim shutdown
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Commands:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
trantor sim boot <device-name-or-udid>
|
|
43
|
+
trantor sim install <app-path>
|
|
44
|
+
trantor sim launch <bundle-id>
|
|
45
|
+
trantor sim screen [--out <png-path>]
|
|
46
|
+
trantor sim tap --label <text> | --id <identifier> | --xy x,y
|
|
47
|
+
trantor sim swipe --from x,y --to x,y
|
|
48
|
+
trantor sim type <text>
|
|
49
|
+
trantor sim shutdown
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Coordinates are logical points, matching the screenshot dimensions and AXe frames. `shutdown` is safe and idempotent: it shuts down only the simulator registered to the current session. Do not replace it with `xcrun simctl shutdown all`.
|
|
53
|
+
|
|
54
|
+
The wrapper owns local simulator exploration; existing `ios/` build and XCTest drills remain the required deterministic test gate. Turn confirmed exploratory findings into a focused regression test when practical.
|