adhdev 0.9.54 → 0.9.55
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/cli/index.js +255 -16
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +255 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.d.mts +2 -0
- package/vendor/session-host-daemon/index.d.ts +2 -0
- package/vendor/session-host-daemon/index.js +59 -1
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +59 -1
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1483,7 +1483,12 @@ function createDefaultGitCommandServices() {
|
|
|
1483
1483
|
turnId
|
|
1484
1484
|
}),
|
|
1485
1485
|
compareSnapshots: ({ beforeSnapshotId, afterSnapshotId }) => defaultSnapshotStore.compare(beforeSnapshotId, afterSnapshotId),
|
|
1486
|
-
getLog: ({ workspace, limit, path: filePath, since, until }) => getGitLog(workspace, { limit, path: filePath, since, until })
|
|
1486
|
+
getLog: ({ workspace, limit, path: filePath, since, until }) => getGitLog(workspace, { limit, path: filePath, since, until }),
|
|
1487
|
+
checkpoint: async ({ workspace, message, includeUntracked = false }) => gitCheckpoint(workspace, message, includeUntracked),
|
|
1488
|
+
stashPush: async ({ workspace, message, includeUntracked = false }) => gitStashPush(workspace, message, includeUntracked),
|
|
1489
|
+
stashPop: async ({ workspace, stashRef }) => gitStashPop(workspace, stashRef),
|
|
1490
|
+
checkoutFiles: async ({ workspace, paths }) => gitCheckoutFiles(workspace, paths),
|
|
1491
|
+
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote)
|
|
1487
1492
|
};
|
|
1488
1493
|
}
|
|
1489
1494
|
function validateWorkspace2(args) {
|
|
@@ -1546,9 +1551,6 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1546
1551
|
if (!isGitCommandName(command)) {
|
|
1547
1552
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1548
1553
|
}
|
|
1549
|
-
if (MUTATING_COMMAND_NAMES.has(command)) {
|
|
1550
|
-
return failure("invalid_args", `${command} is not implemented in daemon-core read-only Git routing`);
|
|
1551
|
-
}
|
|
1552
1554
|
const workspaceResult = validateWorkspace2(args);
|
|
1553
1555
|
if ("success" in workspaceResult) return workspaceResult;
|
|
1554
1556
|
const { workspace } = workspaceResult;
|
|
@@ -1608,10 +1610,153 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1608
1610
|
}));
|
|
1609
1611
|
return "success" in log2 ? log2 : { success: true, log: log2 };
|
|
1610
1612
|
}
|
|
1613
|
+
case "git_checkpoint": {
|
|
1614
|
+
if (!services.checkpoint) return serviceNotImplemented(command);
|
|
1615
|
+
const msg = validateMutatingMessage(args?.message);
|
|
1616
|
+
if (typeof msg !== "string") return msg;
|
|
1617
|
+
const includeUntracked = Boolean(args?.includeUntracked);
|
|
1618
|
+
const checkpoint = await runService(() => services.checkpoint({ workspace, message: msg, includeUntracked }));
|
|
1619
|
+
return "success" in checkpoint ? checkpoint : { success: true, checkpoint };
|
|
1620
|
+
}
|
|
1621
|
+
case "git_stash_push": {
|
|
1622
|
+
if (!services.stashPush) return serviceNotImplemented(command);
|
|
1623
|
+
const msg = validateMutatingMessage(args?.message);
|
|
1624
|
+
if (typeof msg !== "string") return msg;
|
|
1625
|
+
const includeUntracked = Boolean(args?.includeUntracked);
|
|
1626
|
+
const stash = await runService(() => services.stashPush({ workspace, message: msg, includeUntracked }));
|
|
1627
|
+
return "success" in stash ? stash : { success: true, stash };
|
|
1628
|
+
}
|
|
1629
|
+
case "git_stash_pop": {
|
|
1630
|
+
if (!services.stashPop) return serviceNotImplemented(command);
|
|
1631
|
+
const stashRef = optionalString(args?.stashRef);
|
|
1632
|
+
if (stashRef !== void 0 && !/^stash@\{\d+\}$/.test(stashRef)) {
|
|
1633
|
+
return failure("invalid_args", "stashRef must match stash@{N} format");
|
|
1634
|
+
}
|
|
1635
|
+
const popResult = await runService(() => services.stashPop({ workspace, stashRef }));
|
|
1636
|
+
if (popResult !== void 0 && "success" in popResult) return popResult;
|
|
1637
|
+
return { success: true, stashPopped: true };
|
|
1638
|
+
}
|
|
1639
|
+
case "git_checkout_files": {
|
|
1640
|
+
if (!services.checkoutFiles) return serviceNotImplemented(command);
|
|
1641
|
+
const paths = args?.paths;
|
|
1642
|
+
if (!Array.isArray(paths) || paths.length === 0) {
|
|
1643
|
+
return failure("invalid_args", "paths must be a non-empty array");
|
|
1644
|
+
}
|
|
1645
|
+
if (paths.length > 50) {
|
|
1646
|
+
return failure("invalid_args", "paths array exceeds maximum of 50 entries");
|
|
1647
|
+
}
|
|
1648
|
+
const checkoutResult = await runService(() => services.checkoutFiles({ workspace, paths }));
|
|
1649
|
+
return "success" in checkoutResult ? checkoutResult : { success: true, checkedOut: checkoutResult.checkedOut };
|
|
1650
|
+
}
|
|
1651
|
+
case "git_remote_url": {
|
|
1652
|
+
if (!services.getRemoteUrl) return serviceNotImplemented(command);
|
|
1653
|
+
const remote = typeof args?.remote === "string" && args.remote.trim() ? args.remote.trim() : "origin";
|
|
1654
|
+
const remoteResult = await runService(() => services.getRemoteUrl({ workspace, remote }));
|
|
1655
|
+
if ("success" in remoteResult) return remoteResult;
|
|
1656
|
+
return { success: true, remoteUrl: remoteResult.remoteUrl, remote: remoteResult.remote };
|
|
1657
|
+
}
|
|
1611
1658
|
default:
|
|
1612
1659
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1613
1660
|
}
|
|
1614
1661
|
}
|
|
1662
|
+
function validateMutatingMessage(value) {
|
|
1663
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
1664
|
+
return failure("invalid_args", "message must be a non-empty string");
|
|
1665
|
+
}
|
|
1666
|
+
const msg = value.trim();
|
|
1667
|
+
if (msg.length > 200) {
|
|
1668
|
+
return failure("invalid_args", "message must be 200 characters or fewer");
|
|
1669
|
+
}
|
|
1670
|
+
return msg;
|
|
1671
|
+
}
|
|
1672
|
+
async function gitCheckpoint(workspace, message, includeUntracked) {
|
|
1673
|
+
const repo = await resolveGitRepository(workspace);
|
|
1674
|
+
const repoRoot = repo.repoRoot;
|
|
1675
|
+
const statusResult = await getGitRepoStatus(workspace);
|
|
1676
|
+
if (statusResult.hasConflicts) {
|
|
1677
|
+
throw new GitCommandError("conflict", "Repository has conflicts \u2014 resolve before checkpointing");
|
|
1678
|
+
}
|
|
1679
|
+
const addArgs = includeUntracked ? ["-A"] : ["-u"];
|
|
1680
|
+
await runGit(repo, ["add", ...addArgs], { cwd: repoRoot });
|
|
1681
|
+
const fullMsg = `adhdev: checkpoint ${message}`;
|
|
1682
|
+
let commitSha;
|
|
1683
|
+
try {
|
|
1684
|
+
await runGit(repo, ["commit", "-m", fullMsg], { cwd: repoRoot });
|
|
1685
|
+
const revResult = await runGit(repo, ["rev-parse", "HEAD"], { cwd: repoRoot });
|
|
1686
|
+
commitSha = revResult.stdout.trim();
|
|
1687
|
+
} catch (err) {
|
|
1688
|
+
const output = (err?.stdout || "") + (err?.stderr || "");
|
|
1689
|
+
if (/nothing to commit/i.test(output)) {
|
|
1690
|
+
throw new GitCommandError("git_command_failed", "Nothing to commit");
|
|
1691
|
+
}
|
|
1692
|
+
throw err;
|
|
1693
|
+
}
|
|
1694
|
+
return {
|
|
1695
|
+
workspace: repo.workspace,
|
|
1696
|
+
repoRoot,
|
|
1697
|
+
isGitRepo: true,
|
|
1698
|
+
commit: commitSha,
|
|
1699
|
+
message: fullMsg,
|
|
1700
|
+
lastCheckedAt: Date.now()
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
async function gitStashPush(workspace, message, includeUntracked) {
|
|
1704
|
+
const repo = await resolveGitRepository(workspace);
|
|
1705
|
+
const repoRoot = repo.repoRoot;
|
|
1706
|
+
const stashArgs = ["stash", "push", "-m", message];
|
|
1707
|
+
if (includeUntracked) stashArgs.push("--include-untracked");
|
|
1708
|
+
const result = await runGit(repo, stashArgs, { cwd: repoRoot });
|
|
1709
|
+
if (/No local changes to save/i.test(result.stdout + result.stderr)) {
|
|
1710
|
+
throw new GitCommandError("git_command_failed", "Nothing to stash");
|
|
1711
|
+
}
|
|
1712
|
+
return {
|
|
1713
|
+
workspace: repo.workspace,
|
|
1714
|
+
repoRoot,
|
|
1715
|
+
isGitRepo: true,
|
|
1716
|
+
stashRef: "stash@{0}",
|
|
1717
|
+
message,
|
|
1718
|
+
lastCheckedAt: Date.now()
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
async function gitStashPop(workspace, stashRef) {
|
|
1722
|
+
const repo = await resolveGitRepository(workspace);
|
|
1723
|
+
const repoRoot = repo.repoRoot;
|
|
1724
|
+
const popArgs = stashRef ? ["stash", "pop", stashRef] : ["stash", "pop"];
|
|
1725
|
+
await runGit(repo, popArgs, { cwd: repoRoot });
|
|
1726
|
+
}
|
|
1727
|
+
async function gitCheckoutFiles(workspace, paths) {
|
|
1728
|
+
const repo = await resolveGitRepository(workspace);
|
|
1729
|
+
const repoRoot = repo.repoRoot;
|
|
1730
|
+
const normalizedPaths = [];
|
|
1731
|
+
for (const p of paths) {
|
|
1732
|
+
if (typeof p !== "string" || !p.trim() || p.includes("\0")) {
|
|
1733
|
+
throw new GitCommandError("invalid_args", `Invalid path: ${String(p)}`);
|
|
1734
|
+
}
|
|
1735
|
+
if (path3.isAbsolute(p)) {
|
|
1736
|
+
throw new GitCommandError("invalid_args", `Path must be repository-relative, not absolute: ${p}`);
|
|
1737
|
+
}
|
|
1738
|
+
const normalized = path3.normalize(p.trim()).split(path3.sep).join("/");
|
|
1739
|
+
if (normalized.startsWith("../") || normalized === "..") {
|
|
1740
|
+
throw new GitCommandError("path_outside_repo", `Path is outside repository root: ${p}`);
|
|
1741
|
+
}
|
|
1742
|
+
const absolutePath = path3.resolve(repoRoot, normalized);
|
|
1743
|
+
if (!isPathInside(repoRoot, absolutePath)) {
|
|
1744
|
+
throw new GitCommandError("path_outside_repo", `Path is outside repository root: ${p}`);
|
|
1745
|
+
}
|
|
1746
|
+
normalizedPaths.push(normalized);
|
|
1747
|
+
}
|
|
1748
|
+
await runGit(repo, ["checkout", "--", ...normalizedPaths], { cwd: repoRoot });
|
|
1749
|
+
return { checkedOut: normalizedPaths };
|
|
1750
|
+
}
|
|
1751
|
+
async function gitGetRemoteUrl(workspace, remote) {
|
|
1752
|
+
const repo = await resolveGitRepository(workspace);
|
|
1753
|
+
const result = await runGit(repo, ["remote", "get-url", remote], { cwd: repo.repoRoot });
|
|
1754
|
+
const remoteUrl = result.stdout.trim();
|
|
1755
|
+
if (!remoteUrl) {
|
|
1756
|
+
throw new GitCommandError("git_command_failed", `Remote '${remote}' has no URL`);
|
|
1757
|
+
}
|
|
1758
|
+
return { remoteUrl, remote };
|
|
1759
|
+
}
|
|
1615
1760
|
function formatOptionalGitLogRangeArg(flag, value) {
|
|
1616
1761
|
return value ? [`${flag}=${value}`] : [];
|
|
1617
1762
|
}
|
|
@@ -1669,7 +1814,7 @@ function validateGitLogPath(repoRoot, filePath) {
|
|
|
1669
1814
|
}
|
|
1670
1815
|
return normalized;
|
|
1671
1816
|
}
|
|
1672
|
-
var path3, GIT_COMMAND_NAMES,
|
|
1817
|
+
var path3, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices;
|
|
1673
1818
|
var init_git_commands = __esm({
|
|
1674
1819
|
"../../oss/packages/daemon-core/src/git/git-commands.ts"() {
|
|
1675
1820
|
"use strict";
|
|
@@ -1688,13 +1833,8 @@ var init_git_commands = __esm({
|
|
|
1688
1833
|
"git_checkpoint",
|
|
1689
1834
|
"git_stash_push",
|
|
1690
1835
|
"git_stash_pop",
|
|
1691
|
-
"git_checkout_files"
|
|
1692
|
-
|
|
1693
|
-
MUTATING_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
1694
|
-
"git_checkpoint",
|
|
1695
|
-
"git_stash_push",
|
|
1696
|
-
"git_stash_pop",
|
|
1697
|
-
"git_checkout_files"
|
|
1836
|
+
"git_checkout_files",
|
|
1837
|
+
"git_remote_url"
|
|
1698
1838
|
]);
|
|
1699
1839
|
SNAPSHOT_REASONS = /* @__PURE__ */ new Set([
|
|
1700
1840
|
"session_baseline",
|
|
@@ -1721,6 +1861,33 @@ var init_git_commands = __esm({
|
|
|
1721
1861
|
}
|
|
1722
1862
|
});
|
|
1723
1863
|
|
|
1864
|
+
// ../../oss/packages/daemon-core/src/git/turn-snapshot-tracker.ts
|
|
1865
|
+
var BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker;
|
|
1866
|
+
var init_turn_snapshot_tracker = __esm({
|
|
1867
|
+
"../../oss/packages/daemon-core/src/git/turn-snapshot-tracker.ts"() {
|
|
1868
|
+
"use strict";
|
|
1869
|
+
BUSY_STATUSES = /* @__PURE__ */ new Set(["streaming", "waiting_approval"]);
|
|
1870
|
+
TERMINAL_STATUSES = /* @__PURE__ */ new Set(["idle", "error"]);
|
|
1871
|
+
TurnSnapshotTracker = class {
|
|
1872
|
+
lastStatus = /* @__PURE__ */ new Map();
|
|
1873
|
+
onTurnCompleted;
|
|
1874
|
+
constructor(onTurnCompleted) {
|
|
1875
|
+
this.onTurnCompleted = onTurnCompleted;
|
|
1876
|
+
}
|
|
1877
|
+
record(sessionId, status, workspace) {
|
|
1878
|
+
const prev = this.lastStatus.get(sessionId);
|
|
1879
|
+
this.lastStatus.set(sessionId, status);
|
|
1880
|
+
if (workspace && prev && BUSY_STATUSES.has(prev) && TERMINAL_STATUSES.has(status)) {
|
|
1881
|
+
this.onTurnCompleted({ sessionId, workspace });
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
forget(sessionId) {
|
|
1885
|
+
this.lastStatus.delete(sessionId);
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
|
|
1724
1891
|
// ../../oss/packages/daemon-core/src/git/index.ts
|
|
1725
1892
|
var init_git = __esm({
|
|
1726
1893
|
"../../oss/packages/daemon-core/src/git/index.ts"() {
|
|
@@ -1732,6 +1899,7 @@ var init_git = __esm({
|
|
|
1732
1899
|
init_git_snapshot_store();
|
|
1733
1900
|
init_git_monitor();
|
|
1734
1901
|
init_git_commands();
|
|
1902
|
+
init_turn_snapshot_tracker();
|
|
1735
1903
|
}
|
|
1736
1904
|
});
|
|
1737
1905
|
|
|
@@ -11887,6 +12055,16 @@ var init_handler = __esm({
|
|
|
11887
12055
|
return result;
|
|
11888
12056
|
}
|
|
11889
12057
|
}
|
|
12058
|
+
if (cmd === "send_chat" && this._ctx.onBeforeSendChat) {
|
|
12059
|
+
const sessionId = this._currentRoute.session?.sessionId;
|
|
12060
|
+
const workspace = sessionId ? this._ctx.instanceManager?.getInstance(sessionId)?.getState?.()?.workspace : void 0;
|
|
12061
|
+
if (workspace && sessionId) {
|
|
12062
|
+
try {
|
|
12063
|
+
this._ctx.onBeforeSendChat({ workspace, sessionId });
|
|
12064
|
+
} catch {
|
|
12065
|
+
}
|
|
12066
|
+
}
|
|
12067
|
+
}
|
|
11890
12068
|
try {
|
|
11891
12069
|
result = await this.dispatch(cmd, args);
|
|
11892
12070
|
this.logCommandEnd(cmd, result, startedAt);
|
|
@@ -14164,6 +14342,7 @@ function resolveCliAdapterConfig(provider) {
|
|
|
14164
14342
|
sendDelayMs: typeof provider.sendDelayMs === "number" ? Math.max(0, provider.sendDelayMs) : 0,
|
|
14165
14343
|
sendKey: typeof provider.sendKey === "string" && provider.sendKey.length > 0 ? provider.sendKey : "\r",
|
|
14166
14344
|
submitStrategy: provider.submitStrategy === "immediate" ? "immediate" : "wait_for_echo",
|
|
14345
|
+
requirePromptEchoBeforeSubmit: provider.requirePromptEchoBeforeSubmit === true,
|
|
14167
14346
|
providerResolutionMeta: {
|
|
14168
14347
|
type: provider.type,
|
|
14169
14348
|
name: provider.name,
|
|
@@ -14429,6 +14608,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
14429
14608
|
this.sendDelayMs = resolvedConfig.sendDelayMs;
|
|
14430
14609
|
this.sendKey = resolvedConfig.sendKey;
|
|
14431
14610
|
this.submitStrategy = resolvedConfig.submitStrategy;
|
|
14611
|
+
this.requirePromptEchoBeforeSubmit = resolvedConfig.requirePromptEchoBeforeSubmit;
|
|
14432
14612
|
this.providerResolutionMeta = resolvedConfig.providerResolutionMeta;
|
|
14433
14613
|
this.cliScripts = provider.scripts || {};
|
|
14434
14614
|
const scriptNames = listCliScriptNames(this.cliScripts);
|
|
@@ -14725,6 +14905,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
14725
14905
|
sendDelayMs;
|
|
14726
14906
|
sendKey;
|
|
14727
14907
|
submitStrategy;
|
|
14908
|
+
requirePromptEchoBeforeSubmit;
|
|
14728
14909
|
static SCRIPT_STATUS_DEBOUNCE_MS = 3e3;
|
|
14729
14910
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
14730
14911
|
setCliScripts(scripts) {
|
|
@@ -16245,6 +16426,22 @@ var init_provider_cli_adapter = __esm({
|
|
|
16245
16426
|
}
|
|
16246
16427
|
}
|
|
16247
16428
|
if (elapsed >= state.maxEchoWaitMs) {
|
|
16429
|
+
const diagnostic = {
|
|
16430
|
+
elapsed,
|
|
16431
|
+
maxEchoWaitMs: state.maxEchoWaitMs,
|
|
16432
|
+
submitDelayMs: state.submitDelayMs,
|
|
16433
|
+
promptSnippet: state.normalizedPromptSnippet,
|
|
16434
|
+
requirePromptEchoBeforeSubmit: this.requirePromptEchoBeforeSubmit,
|
|
16435
|
+
screenText: summarizeCliTraceText(screenText, 1e3)
|
|
16436
|
+
};
|
|
16437
|
+
this.recordTrace("submit_echo_missing", diagnostic);
|
|
16438
|
+
if (this.requirePromptEchoBeforeSubmit) {
|
|
16439
|
+
const message = `${this.cliName} prompt echo was not observed on the PTY screen before submit`;
|
|
16440
|
+
LOG.warn("CLI", `[${this.cliType}] ${message} elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs} screen=${JSON.stringify(diagnostic.screenText).slice(0, 240)}`);
|
|
16441
|
+
completion.rejectOnce(new Error(message));
|
|
16442
|
+
return;
|
|
16443
|
+
}
|
|
16444
|
+
LOG.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs}`);
|
|
16248
16445
|
this.submitSendKey(state, completion);
|
|
16249
16446
|
return;
|
|
16250
16447
|
}
|
|
@@ -16709,6 +16906,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
16709
16906
|
sendDelayMs: this.sendDelayMs,
|
|
16710
16907
|
sendKey: this.sendKey,
|
|
16711
16908
|
submitStrategy: this.submitStrategy,
|
|
16909
|
+
requirePromptEchoBeforeSubmit: this.requirePromptEchoBeforeSubmit,
|
|
16712
16910
|
submitPendingUntil: this.submitPendingUntil,
|
|
16713
16911
|
responseSettleIgnoreUntil: this.responseSettleIgnoreUntil,
|
|
16714
16912
|
resizeSuppressUntil: this.resizeSuppressUntil,
|
|
@@ -38009,6 +38207,7 @@ var init_provider_schema = __esm({
|
|
|
38009
38207
|
"sendDelayMs",
|
|
38010
38208
|
"sendKey",
|
|
38011
38209
|
"submitStrategy",
|
|
38210
|
+
"requirePromptEchoBeforeSubmit",
|
|
38012
38211
|
"timeouts",
|
|
38013
38212
|
"disableUpstream"
|
|
38014
38213
|
]);
|
|
@@ -49584,6 +49783,7 @@ async function initDaemonComponents(config2) {
|
|
|
49584
49783
|
providerLoader,
|
|
49585
49784
|
instanceManager,
|
|
49586
49785
|
sessionRegistry,
|
|
49786
|
+
gitCommandServices: createDefaultGitCommandServices(),
|
|
49587
49787
|
onProviderSettingChanged: async (providerType) => {
|
|
49588
49788
|
await refreshProviderAvailability(providerType);
|
|
49589
49789
|
config2.onStatusChange?.();
|
|
@@ -49591,7 +49791,8 @@ async function initDaemonComponents(config2) {
|
|
|
49591
49791
|
onProviderSourceConfigChanged: async () => {
|
|
49592
49792
|
await refreshProviderAvailability();
|
|
49593
49793
|
config2.onStatusChange?.();
|
|
49594
|
-
}
|
|
49794
|
+
},
|
|
49795
|
+
onBeforeSendChat: config2.onBeforeSendChat
|
|
49595
49796
|
});
|
|
49596
49797
|
agentStreamManager = new DaemonAgentStreamManager(
|
|
49597
49798
|
LOG.forComponent("AgentStream").asLogFn(),
|
|
@@ -49717,6 +49918,7 @@ var init_daemon_lifecycle = __esm({
|
|
|
49717
49918
|
init_logger();
|
|
49718
49919
|
init_runtime_defaults();
|
|
49719
49920
|
init_config();
|
|
49921
|
+
init_git_commands();
|
|
49720
49922
|
}
|
|
49721
49923
|
});
|
|
49722
49924
|
|
|
@@ -49767,6 +49969,7 @@ __export(src_exports, {
|
|
|
49767
49969
|
ProviderLoader: () => ProviderLoader,
|
|
49768
49970
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
49769
49971
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
49972
|
+
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
49770
49973
|
VersionArchive: () => VersionArchive,
|
|
49771
49974
|
appendRecentActivity: () => appendRecentActivity,
|
|
49772
49975
|
buildAssistantChatMessage: () => buildAssistantChatMessage,
|
|
@@ -89833,7 +90036,7 @@ var init_adhdev_daemon = __esm({
|
|
|
89833
90036
|
init_version();
|
|
89834
90037
|
init_src();
|
|
89835
90038
|
init_runtime_defaults();
|
|
89836
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
90039
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.55" });
|
|
89837
90040
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
89838
90041
|
localHttpServer = null;
|
|
89839
90042
|
localWss = null;
|
|
@@ -89857,6 +90060,19 @@ var init_adhdev_daemon = __esm({
|
|
|
89857
90060
|
sessionHostEndpoint = null;
|
|
89858
90061
|
sessionHostController = null;
|
|
89859
90062
|
gitWorkspaceMonitor = createGitWorkspaceMonitor();
|
|
90063
|
+
turnSnapshotTracker = new TurnSnapshotTracker(({ sessionId, workspace }) => {
|
|
90064
|
+
const gitServices = this.components?.commandHandler?.ctx?.gitCommandServices;
|
|
90065
|
+
if (gitServices?.createSnapshot) {
|
|
90066
|
+
void Promise.resolve(gitServices.createSnapshot({
|
|
90067
|
+
workspace,
|
|
90068
|
+
reason: "after_agent_work",
|
|
90069
|
+
sessionId
|
|
90070
|
+
})).catch(() => {
|
|
90071
|
+
});
|
|
90072
|
+
}
|
|
90073
|
+
void this.gitWorkspaceMonitor.refresh({ workspace, includeDiffSummary: false }).catch(() => {
|
|
90074
|
+
});
|
|
90075
|
+
});
|
|
89860
90076
|
running = false;
|
|
89861
90077
|
localPort;
|
|
89862
90078
|
ideType = "unknown";
|
|
@@ -90028,7 +90244,8 @@ var init_adhdev_daemon = __esm({
|
|
|
90028
90244
|
})),
|
|
90029
90245
|
instanceId: `daemon_${loadConfig().machineId || "daemon"}`,
|
|
90030
90246
|
version: pkgVersion,
|
|
90031
|
-
profile: "live"
|
|
90247
|
+
profile: "live",
|
|
90248
|
+
getGitSummaryForWorkspace: (workspace) => this.gitWorkspaceMonitor.getCompactSummary(workspace)
|
|
90032
90249
|
});
|
|
90033
90250
|
}
|
|
90034
90251
|
invalidateHotChatSnapshotCache() {
|
|
@@ -90214,7 +90431,8 @@ var init_adhdev_daemon = __esm({
|
|
|
90214
90431
|
})),
|
|
90215
90432
|
instanceId: `daemon_${loadConfig().machineId || "daemon"}`,
|
|
90216
90433
|
version: pkgVersion,
|
|
90217
|
-
profile: "metadata"
|
|
90434
|
+
profile: "metadata",
|
|
90435
|
+
getGitSummaryForWorkspace: (workspace) => this.gitWorkspaceMonitor.getCompactSummary(workspace)
|
|
90218
90436
|
});
|
|
90219
90437
|
}
|
|
90220
90438
|
buildDaemonMetadataUpdateForSubscription(subscription) {
|
|
@@ -90358,6 +90576,27 @@ ${err?.stack || ""}`);
|
|
|
90358
90576
|
onStreamsUpdated: (ideType, streams) => {
|
|
90359
90577
|
if (!this.components) return;
|
|
90360
90578
|
forwardAgentStreamsToIdeInstance(this.components.instanceManager, ideType, streams);
|
|
90579
|
+
for (const stream of streams) {
|
|
90580
|
+
if (stream.sessionId) {
|
|
90581
|
+
const workspace = this.components?.instanceManager?.getInstance(stream.sessionId)?.getState()?.workspace;
|
|
90582
|
+
this.turnSnapshotTracker.record(stream.sessionId, stream.status || "idle", workspace);
|
|
90583
|
+
}
|
|
90584
|
+
}
|
|
90585
|
+
},
|
|
90586
|
+
onBeforeSendChat: ({ workspace }) => {
|
|
90587
|
+
void this.gitWorkspaceMonitor.refresh({
|
|
90588
|
+
workspace,
|
|
90589
|
+
includeDiffSummary: false
|
|
90590
|
+
}).catch(() => {
|
|
90591
|
+
});
|
|
90592
|
+
const gitServices = this.components?.commandHandler?.ctx?.gitCommandServices;
|
|
90593
|
+
if (gitServices?.createSnapshot) {
|
|
90594
|
+
void Promise.resolve(gitServices.createSnapshot({
|
|
90595
|
+
workspace,
|
|
90596
|
+
reason: "before_user_input_dispatch"
|
|
90597
|
+
})).catch(() => {
|
|
90598
|
+
});
|
|
90599
|
+
}
|
|
90361
90600
|
}
|
|
90362
90601
|
});
|
|
90363
90602
|
const providerSourceConfig = this.components.providerLoader.getSourceConfig();
|