@agentbridge1/cli 0.0.9 → 0.0.10
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/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"builtAt": "2026-06-
|
|
3
|
-
"gitHead": "
|
|
4
|
-
"sourceLatestMtime": "2026-06-
|
|
5
|
-
"sourceLatestFile": "src/commands/
|
|
2
|
+
"builtAt": "2026-06-20T13:18:31.649Z",
|
|
3
|
+
"gitHead": "40b250d",
|
|
4
|
+
"sourceLatestMtime": "2026-06-20T13:01:45.098Z",
|
|
5
|
+
"sourceLatestFile": "src/commands/watch.ts"
|
|
6
6
|
}
|
package/dist/commands/watch.js
CHANGED
|
@@ -8,6 +8,8 @@ exports.finalizeWatchSupervision = finalizeWatchSupervision;
|
|
|
8
8
|
exports.syncAndBuildSupervisionSnapshot = syncAndBuildSupervisionSnapshot;
|
|
9
9
|
exports.renderWatchTaskScopeUsage = renderWatchTaskScopeUsage;
|
|
10
10
|
exports.renderWatchStartupHeader = renderWatchStartupHeader;
|
|
11
|
+
exports.renderLocalWatchWaiting = renderLocalWatchWaiting;
|
|
12
|
+
exports.renderLocalWatchReady = renderLocalWatchReady;
|
|
11
13
|
exports.buildWatchBlockingIssue = buildWatchBlockingIssue;
|
|
12
14
|
exports.renderWatchBlockingIssue = renderWatchBlockingIssue;
|
|
13
15
|
exports.overlayLocalChangedFilesOnSupervision = overlayLocalChangedFilesOnSupervision;
|
|
@@ -30,6 +32,7 @@ const domain_resolution_1 = require("../domain-resolution");
|
|
|
30
32
|
const briefing_1 = require("../briefing");
|
|
31
33
|
const session_1 = require("../session");
|
|
32
34
|
const session_state_1 = require("../session-state");
|
|
35
|
+
const git_status_1 = require("../git-status");
|
|
33
36
|
const watch_core_1 = require("../watch-core");
|
|
34
37
|
const watcher_1 = require("../watcher");
|
|
35
38
|
const server_sync_1 = require("../server-sync");
|
|
@@ -49,8 +52,8 @@ const session_state_2 = require("../session-state");
|
|
|
49
52
|
const file_fingerprints_1 = require("../file-fingerprints");
|
|
50
53
|
const start_1 = require("./start");
|
|
51
54
|
const gates_1 = require("../gates");
|
|
52
|
-
const
|
|
53
|
-
Object.defineProperty(exports, "getDirtyWorkingTreeFiles", { enumerable: true, get: function () { return
|
|
55
|
+
const git_status_2 = require("../git-status");
|
|
56
|
+
Object.defineProperty(exports, "getDirtyWorkingTreeFiles", { enumerable: true, get: function () { return git_status_2.getDirtyWorkingTreeFiles; } });
|
|
54
57
|
const IDLE_CLOSE_MS = 5_000;
|
|
55
58
|
const CONTRACT_POLL_MS = 2_000;
|
|
56
59
|
function isLocalFirstMode(cfg) {
|
|
@@ -576,6 +579,19 @@ function renderWatchStartupHeader(input) {
|
|
|
576
579
|
"",
|
|
577
580
|
].join("\n");
|
|
578
581
|
}
|
|
582
|
+
function renderLocalWatchWaiting() {
|
|
583
|
+
return [
|
|
584
|
+
"AgentBridge watch — live. No contract yet.",
|
|
585
|
+
"Waiting for: agentbridge start \"...\" or agent_hello({ intent: \"...\" })",
|
|
586
|
+
"",
|
|
587
|
+
].join("\n");
|
|
588
|
+
}
|
|
589
|
+
function renderLocalWatchReady(session) {
|
|
590
|
+
if (!session.intent?.trim()) {
|
|
591
|
+
return renderLocalWatchWaiting();
|
|
592
|
+
}
|
|
593
|
+
return (0, contract_intelligence_1.renderLiveContractBanner)(session).replace(/^\n/, "");
|
|
594
|
+
}
|
|
579
595
|
function renderStartupPhase(step, status) {
|
|
580
596
|
const verb = status === "starting" ? "starting" : status === "done" ? "done" : "skipped";
|
|
581
597
|
return `[startup] ${step}: ${verb}\n`;
|
|
@@ -1124,14 +1140,14 @@ function normalizeDirtyWorkingTreeFiles(files) {
|
|
|
1124
1140
|
const normalized = normalizeDirtyFilePath(raw);
|
|
1125
1141
|
if (!normalized || normalized.startsWith(".."))
|
|
1126
1142
|
continue;
|
|
1127
|
-
if (
|
|
1143
|
+
if ((0, git_status_1.isAgentbridgeLocalPath)(normalized))
|
|
1128
1144
|
continue;
|
|
1129
1145
|
const expanded = expandDirectoryToFiles(normalized);
|
|
1130
1146
|
for (const candidate of expanded) {
|
|
1131
1147
|
const flat = normalizeDirtyFilePath(candidate);
|
|
1132
1148
|
if (!flat || flat.startsWith(".."))
|
|
1133
1149
|
continue;
|
|
1134
|
-
if (
|
|
1150
|
+
if ((0, git_status_1.isAgentbridgeLocalPath)(flat))
|
|
1135
1151
|
continue;
|
|
1136
1152
|
if ((0, local_proof_1.isProofNoiseFile)(flat))
|
|
1137
1153
|
continue;
|
|
@@ -1284,7 +1300,7 @@ function buildStartupScopeDriftIssue(input) {
|
|
|
1284
1300
|
async function ensureWatchRepoClean(allowDirty = false, ignoredDirtyFiles = new Set()) {
|
|
1285
1301
|
if (allowDirty)
|
|
1286
1302
|
return;
|
|
1287
|
-
const dirtyFiles = filterIgnoredDirtyFiles((0,
|
|
1303
|
+
const dirtyFiles = normalizeDirtyWorkingTreeFiles(filterIgnoredDirtyFiles((0, git_status_2.getDirtyWorkingTreeFiles)(), ignoredDirtyFiles));
|
|
1288
1304
|
if (dirtyFiles.length === 0)
|
|
1289
1305
|
return;
|
|
1290
1306
|
const rl = (0, promises_1.createInterface)({ input: process.stdin, output: process.stdout });
|
|
@@ -1343,7 +1359,7 @@ async function runWatchOnceFastPath(input) {
|
|
|
1343
1359
|
// No server context (offline / unconfigured) — defer to legacy local flow.
|
|
1344
1360
|
return { handled: false, hadBlockingIssue: false };
|
|
1345
1361
|
}
|
|
1346
|
-
const dirtyFiles = timing.trackSync("git_snapshot", () => normalizeDirtyWorkingTreeFiles(filterIgnoredDirtyFiles((0,
|
|
1362
|
+
const dirtyFiles = timing.trackSync("git_snapshot", () => normalizeDirtyWorkingTreeFiles(filterIgnoredDirtyFiles((0, git_status_2.getDirtyWorkingTreeFiles)(), ignoredDirtyFiles)));
|
|
1347
1363
|
const localState = (0, session_state_1.readSessionState)();
|
|
1348
1364
|
const claimedPaths = [
|
|
1349
1365
|
...new Set([scope, ...(localState?.claimedPaths ?? [])].map((path) => path.trim()).filter(Boolean)),
|
|
@@ -1536,6 +1552,7 @@ async function runWatch(options = {}) {
|
|
|
1536
1552
|
(0, session_state_1.writeSessionState)(localSession);
|
|
1537
1553
|
}
|
|
1538
1554
|
const explicitStrictMode = Boolean(taskScopeInput.task && taskScopeInput.scope);
|
|
1555
|
+
const localInferredMode = localFirstMode && !explicitStrictMode;
|
|
1539
1556
|
if (hasActiveLocalSession && explicitStrictMode) {
|
|
1540
1557
|
const activeLocalSession = localSession;
|
|
1541
1558
|
if (!activeLocalSession)
|
|
@@ -1560,24 +1577,26 @@ async function runWatch(options = {}) {
|
|
|
1560
1577
|
return;
|
|
1561
1578
|
}
|
|
1562
1579
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1580
|
+
if (!localInferredMode) {
|
|
1581
|
+
const startupScope = explicitStrictMode
|
|
1582
|
+
? taskScopeInput.scope ?? localSession?.claimedPaths?.[0] ?? "(scope unavailable)"
|
|
1583
|
+
: taskScopeInput.scope;
|
|
1584
|
+
const startupTask = explicitStrictMode
|
|
1585
|
+
? taskScopeInput.task ?? "Current AgentBridge task"
|
|
1586
|
+
: taskScopeInput.task ?? "Inferred from changed files/current work";
|
|
1587
|
+
process.stdout.write(renderWatchStartupHeader({
|
|
1588
|
+
mode: explicitStrictMode ? "explicit" : "inferred",
|
|
1589
|
+
task: startupTask,
|
|
1590
|
+
scope: startupScope,
|
|
1591
|
+
currentStatus: "Starting watch runtime.",
|
|
1592
|
+
nextGuidance: explicitStrictMode
|
|
1593
|
+
? "AgentBridge will enforce explicit scope and proof checks."
|
|
1594
|
+
: "AgentBridge will classify brainstorming vs coding and infer task/scope from repo activity.",
|
|
1595
|
+
}));
|
|
1596
|
+
await flushStdout();
|
|
1597
|
+
process.stdout.write(renderStartupPhase("resolving project", "starting"));
|
|
1598
|
+
await flushStdout();
|
|
1599
|
+
}
|
|
1581
1600
|
const hasRecoveredDomainMap = Boolean(cfg.domains && cfg.domains.length > 0);
|
|
1582
1601
|
timing.trackSync("identity_resolution", () => {
|
|
1583
1602
|
if (explicitStrictMode && !cfg.activeAgentId) {
|
|
@@ -1621,7 +1640,7 @@ async function runWatch(options = {}) {
|
|
|
1621
1640
|
...(options.executionSurfaceId ? { executionSurfaceId: options.executionSurfaceId } : {}),
|
|
1622
1641
|
});
|
|
1623
1642
|
}
|
|
1624
|
-
if (!options.once) {
|
|
1643
|
+
if (!localInferredMode && !options.once) {
|
|
1625
1644
|
try {
|
|
1626
1645
|
await timing.trackAsync("project_access_check", async () => withTimeout((async () => {
|
|
1627
1646
|
const requestedCr = options.changeRequestId ?? cfg.activeChangeRequestId ?? null;
|
|
@@ -1648,8 +1667,10 @@ async function runWatch(options = {}) {
|
|
|
1648
1667
|
// If network context is unavailable, continue in local-only mode.
|
|
1649
1668
|
}
|
|
1650
1669
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1670
|
+
if (!localInferredMode) {
|
|
1671
|
+
process.stdout.write(renderStartupPhase("resolving project", "done"));
|
|
1672
|
+
await flushStdout();
|
|
1673
|
+
}
|
|
1653
1674
|
// Fast path: collapse the one-shot review into a single bounded server call.
|
|
1654
1675
|
// Falls through to the legacy multi-call flow when the server predates the
|
|
1655
1676
|
// consolidated endpoint or no server context is available. `startingTaskAnnounced`
|
|
@@ -1745,16 +1766,18 @@ async function runWatch(options = {}) {
|
|
|
1745
1766
|
await flushStdout();
|
|
1746
1767
|
}
|
|
1747
1768
|
}
|
|
1748
|
-
else {
|
|
1769
|
+
else if (!localInferredMode) {
|
|
1749
1770
|
process.stdout.write("[startup] session: inferred mode (will start tracking when coding begins)\n");
|
|
1750
1771
|
await flushStdout();
|
|
1751
1772
|
}
|
|
1752
1773
|
// In daemon mode, skip interactive dirty-file prompt (treat as --allow-dirty).
|
|
1753
1774
|
await timing.trackAsync("repo_clean_check", async () => ensureWatchRepoClean(Boolean(options.allowDirty) || Boolean(options.daemon), ignoredDirtyFiles));
|
|
1754
|
-
|
|
1755
|
-
|
|
1775
|
+
if (!localInferredMode) {
|
|
1776
|
+
process.stdout.write(renderStartupPhase("checking workspace", "done"));
|
|
1777
|
+
await flushStdout();
|
|
1778
|
+
}
|
|
1756
1779
|
const domainPacketsLoaded = new Set();
|
|
1757
|
-
if (!options.once) {
|
|
1780
|
+
if (!options.once && !localInferredMode) {
|
|
1758
1781
|
try {
|
|
1759
1782
|
const packetCtx = (0, config_1.contextFromConfig)();
|
|
1760
1783
|
const projectPacket = await timing.trackAsync("project_packet_fetch", async () => withTimeout((0, server_sync_1.fetchProjectPacket)(packetCtx), WATCH_STARTUP_TIMEOUT_MS, () => new errors_1.SafeCliError({
|
|
@@ -1790,11 +1813,11 @@ async function runWatch(options = {}) {
|
|
|
1790
1813
|
let verdictInProgress = false;
|
|
1791
1814
|
const waitForContract = async () => {
|
|
1792
1815
|
let session = (0, session_state_1.readSessionState)();
|
|
1793
|
-
if (!(0, session_state_1.
|
|
1794
|
-
process.stdout.write(
|
|
1816
|
+
if (!(0, session_state_1.hasActiveContract)(session)) {
|
|
1817
|
+
process.stdout.write(renderLocalWatchWaiting());
|
|
1795
1818
|
await flushStdout();
|
|
1796
1819
|
}
|
|
1797
|
-
while (!(0, session_state_1.
|
|
1820
|
+
while (!(0, session_state_1.hasActiveContract)(session)) {
|
|
1798
1821
|
await new Promise((resolve) => setTimeout(resolve, CONTRACT_POLL_MS));
|
|
1799
1822
|
session = (0, session_state_1.readSessionState)();
|
|
1800
1823
|
}
|
|
@@ -1927,7 +1950,7 @@ async function runWatch(options = {}) {
|
|
|
1927
1950
|
await printVerdictAndReset();
|
|
1928
1951
|
return;
|
|
1929
1952
|
}
|
|
1930
|
-
if (!(0, session_state_1.
|
|
1953
|
+
if (!(0, session_state_1.hasActiveContract)(state)) {
|
|
1931
1954
|
return;
|
|
1932
1955
|
}
|
|
1933
1956
|
}
|
|
@@ -2304,7 +2327,10 @@ async function runWatch(options = {}) {
|
|
|
2304
2327
|
await handling;
|
|
2305
2328
|
};
|
|
2306
2329
|
const processStartupDirty = async () => {
|
|
2307
|
-
|
|
2330
|
+
if (localInferredMode) {
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
const startupDirtyFiles = timing.trackSync("git_snapshot", () => normalizeDirtyWorkingTreeFiles(filterIgnoredDirtyFiles((0, git_status_2.getDirtyWorkingTreeFiles)(), ignoredDirtyFiles)));
|
|
2308
2334
|
if (startupDirtyFiles.length === 0) {
|
|
2309
2335
|
if (!explicitStrictMode) {
|
|
2310
2336
|
process.stdout.write(`${renderBrainstormingStatus()}\n`);
|
|
@@ -2551,32 +2577,39 @@ async function runWatch(options = {}) {
|
|
|
2551
2577
|
};
|
|
2552
2578
|
let stop = null;
|
|
2553
2579
|
if (!options.once) {
|
|
2554
|
-
|
|
2555
|
-
|
|
2580
|
+
if (!localInferredMode) {
|
|
2581
|
+
process.stdout.write(renderStartupPhase("starting watcher", "starting"));
|
|
2582
|
+
await flushStdout();
|
|
2583
|
+
}
|
|
2556
2584
|
stop = timing.trackSync("watcher_startup", () => (0, watcher_1.startWatcher)((0, node_process_1.cwd)(), (absolutePath) => {
|
|
2557
2585
|
void onAbsolutePathChange(absolutePath);
|
|
2558
2586
|
}));
|
|
2559
|
-
|
|
2560
|
-
|
|
2587
|
+
if (!localInferredMode) {
|
|
2588
|
+
process.stdout.write(renderStartupPhase("starting watcher", "done"));
|
|
2589
|
+
await flushStdout();
|
|
2590
|
+
}
|
|
2561
2591
|
}
|
|
2562
|
-
else {
|
|
2592
|
+
else if (!localInferredMode) {
|
|
2563
2593
|
process.stdout.write(renderStartupPhase("starting watcher", "skipped"));
|
|
2564
2594
|
await flushStdout();
|
|
2565
2595
|
}
|
|
2566
2596
|
await processStartupDirty();
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
await waitForContract();
|
|
2597
|
+
if (localInferredMode && !options.once) {
|
|
2598
|
+
const readySession = (0, session_state_1.readSessionState)();
|
|
2599
|
+
if ((0, session_state_1.hasActiveContract)(readySession)) {
|
|
2600
|
+
process.stdout.write(`${renderLocalWatchReady(readySession)}\n`);
|
|
2572
2601
|
}
|
|
2573
2602
|
else {
|
|
2574
|
-
|
|
2575
|
-
if (active) {
|
|
2576
|
-
process.stdout.write((0, contract_intelligence_1.renderLiveContractBanner)(active));
|
|
2577
|
-
await flushStdout();
|
|
2578
|
-
}
|
|
2603
|
+
process.stdout.write(renderLocalWatchWaiting());
|
|
2579
2604
|
}
|
|
2605
|
+
await flushStdout();
|
|
2606
|
+
}
|
|
2607
|
+
else {
|
|
2608
|
+
process.stdout.write("[startup] ready: watch runtime is live.\n");
|
|
2609
|
+
await flushStdout();
|
|
2610
|
+
}
|
|
2611
|
+
if (localFirstMode && !options.once && !(0, session_state_1.hasActiveContract)((0, session_state_1.readSessionState)())) {
|
|
2612
|
+
await waitForContract();
|
|
2580
2613
|
}
|
|
2581
2614
|
if (options.once) {
|
|
2582
2615
|
if (idleTimer)
|
package/dist/git-status.js
CHANGED
|
@@ -13,7 +13,10 @@ function normalizePath(path) {
|
|
|
13
13
|
}
|
|
14
14
|
function isAgentbridgeLocalPath(path) {
|
|
15
15
|
const normalized = normalizePath(path);
|
|
16
|
-
|
|
16
|
+
const lower = normalized.toLowerCase();
|
|
17
|
+
if (lower === ".agentbridge" || lower.endsWith("/.agentbridge"))
|
|
18
|
+
return true;
|
|
19
|
+
return lower.includes(".agentbridge/");
|
|
17
20
|
}
|
|
18
21
|
function isRenameOrCopy(xy) {
|
|
19
22
|
return xy.includes("R") || xy.includes("C");
|
package/dist/local-proof.js
CHANGED
|
@@ -13,6 +13,11 @@ function normalizePath(path) {
|
|
|
13
13
|
function isProofNoiseFile(file) {
|
|
14
14
|
const normalized = normalizePath(file);
|
|
15
15
|
const lower = normalized.toLowerCase();
|
|
16
|
+
if (lower === ".agentbridge" ||
|
|
17
|
+
lower.endsWith("/.agentbridge") ||
|
|
18
|
+
lower.includes(".agentbridge/")) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
16
21
|
if (lower === "agentbridge.md" ||
|
|
17
22
|
lower === ".cursor" ||
|
|
18
23
|
lower.startsWith(".cursor/")) {
|
|
@@ -21205,6 +21205,9 @@ function normalizePath2(path) {
|
|
|
21205
21205
|
function isProofNoiseFile(file) {
|
|
21206
21206
|
const normalized = normalizePath2(file);
|
|
21207
21207
|
const lower = normalized.toLowerCase();
|
|
21208
|
+
if (lower === ".agentbridge" || lower.endsWith("/.agentbridge") || lower.includes(".agentbridge/")) {
|
|
21209
|
+
return true;
|
|
21210
|
+
}
|
|
21208
21211
|
if (lower === "agentbridge.md" || lower === ".cursor" || lower.startsWith(".cursor/")) {
|
|
21209
21212
|
return true;
|
|
21210
21213
|
}
|
|
@@ -21691,7 +21694,9 @@ function normalizePath3(path) {
|
|
|
21691
21694
|
}
|
|
21692
21695
|
function isAgentbridgeLocalPath(path) {
|
|
21693
21696
|
const normalized = normalizePath3(path);
|
|
21694
|
-
|
|
21697
|
+
const lower = normalized.toLowerCase();
|
|
21698
|
+
if (lower === ".agentbridge" || lower.endsWith("/.agentbridge")) return true;
|
|
21699
|
+
return lower.includes(".agentbridge/");
|
|
21695
21700
|
}
|
|
21696
21701
|
function isRenameOrCopy(xy) {
|
|
21697
21702
|
return xy.includes("R") || xy.includes("C");
|