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/index.js
CHANGED
|
@@ -963,7 +963,12 @@ function createDefaultGitCommandServices() {
|
|
|
963
963
|
turnId
|
|
964
964
|
}),
|
|
965
965
|
compareSnapshots: ({ beforeSnapshotId, afterSnapshotId }) => defaultSnapshotStore.compare(beforeSnapshotId, afterSnapshotId),
|
|
966
|
-
getLog: ({ workspace, limit, path: filePath, since, until }) => getGitLog(workspace, { limit, path: filePath, since, until })
|
|
966
|
+
getLog: ({ workspace, limit, path: filePath, since, until }) => getGitLog(workspace, { limit, path: filePath, since, until }),
|
|
967
|
+
checkpoint: async ({ workspace, message, includeUntracked = false }) => gitCheckpoint(workspace, message, includeUntracked),
|
|
968
|
+
stashPush: async ({ workspace, message, includeUntracked = false }) => gitStashPush(workspace, message, includeUntracked),
|
|
969
|
+
stashPop: async ({ workspace, stashRef }) => gitStashPop(workspace, stashRef),
|
|
970
|
+
checkoutFiles: async ({ workspace, paths }) => gitCheckoutFiles(workspace, paths),
|
|
971
|
+
getRemoteUrl: async ({ workspace, remote = "origin" }) => gitGetRemoteUrl(workspace, remote)
|
|
967
972
|
};
|
|
968
973
|
}
|
|
969
974
|
function validateWorkspace2(args) {
|
|
@@ -1026,9 +1031,6 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1026
1031
|
if (!isGitCommandName(command)) {
|
|
1027
1032
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1028
1033
|
}
|
|
1029
|
-
if (MUTATING_COMMAND_NAMES.has(command)) {
|
|
1030
|
-
return failure("invalid_args", `${command} is not implemented in daemon-core read-only Git routing`);
|
|
1031
|
-
}
|
|
1032
1034
|
const workspaceResult = validateWorkspace2(args);
|
|
1033
1035
|
if ("success" in workspaceResult) return workspaceResult;
|
|
1034
1036
|
const { workspace } = workspaceResult;
|
|
@@ -1088,10 +1090,153 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1088
1090
|
}));
|
|
1089
1091
|
return "success" in log2 ? log2 : { success: true, log: log2 };
|
|
1090
1092
|
}
|
|
1093
|
+
case "git_checkpoint": {
|
|
1094
|
+
if (!services.checkpoint) return serviceNotImplemented(command);
|
|
1095
|
+
const msg = validateMutatingMessage(args?.message);
|
|
1096
|
+
if (typeof msg !== "string") return msg;
|
|
1097
|
+
const includeUntracked = Boolean(args?.includeUntracked);
|
|
1098
|
+
const checkpoint = await runService(() => services.checkpoint({ workspace, message: msg, includeUntracked }));
|
|
1099
|
+
return "success" in checkpoint ? checkpoint : { success: true, checkpoint };
|
|
1100
|
+
}
|
|
1101
|
+
case "git_stash_push": {
|
|
1102
|
+
if (!services.stashPush) return serviceNotImplemented(command);
|
|
1103
|
+
const msg = validateMutatingMessage(args?.message);
|
|
1104
|
+
if (typeof msg !== "string") return msg;
|
|
1105
|
+
const includeUntracked = Boolean(args?.includeUntracked);
|
|
1106
|
+
const stash = await runService(() => services.stashPush({ workspace, message: msg, includeUntracked }));
|
|
1107
|
+
return "success" in stash ? stash : { success: true, stash };
|
|
1108
|
+
}
|
|
1109
|
+
case "git_stash_pop": {
|
|
1110
|
+
if (!services.stashPop) return serviceNotImplemented(command);
|
|
1111
|
+
const stashRef = optionalString(args?.stashRef);
|
|
1112
|
+
if (stashRef !== void 0 && !/^stash@\{\d+\}$/.test(stashRef)) {
|
|
1113
|
+
return failure("invalid_args", "stashRef must match stash@{N} format");
|
|
1114
|
+
}
|
|
1115
|
+
const popResult = await runService(() => services.stashPop({ workspace, stashRef }));
|
|
1116
|
+
if (popResult !== void 0 && "success" in popResult) return popResult;
|
|
1117
|
+
return { success: true, stashPopped: true };
|
|
1118
|
+
}
|
|
1119
|
+
case "git_checkout_files": {
|
|
1120
|
+
if (!services.checkoutFiles) return serviceNotImplemented(command);
|
|
1121
|
+
const paths = args?.paths;
|
|
1122
|
+
if (!Array.isArray(paths) || paths.length === 0) {
|
|
1123
|
+
return failure("invalid_args", "paths must be a non-empty array");
|
|
1124
|
+
}
|
|
1125
|
+
if (paths.length > 50) {
|
|
1126
|
+
return failure("invalid_args", "paths array exceeds maximum of 50 entries");
|
|
1127
|
+
}
|
|
1128
|
+
const checkoutResult = await runService(() => services.checkoutFiles({ workspace, paths }));
|
|
1129
|
+
return "success" in checkoutResult ? checkoutResult : { success: true, checkedOut: checkoutResult.checkedOut };
|
|
1130
|
+
}
|
|
1131
|
+
case "git_remote_url": {
|
|
1132
|
+
if (!services.getRemoteUrl) return serviceNotImplemented(command);
|
|
1133
|
+
const remote = typeof args?.remote === "string" && args.remote.trim() ? args.remote.trim() : "origin";
|
|
1134
|
+
const remoteResult = await runService(() => services.getRemoteUrl({ workspace, remote }));
|
|
1135
|
+
if ("success" in remoteResult) return remoteResult;
|
|
1136
|
+
return { success: true, remoteUrl: remoteResult.remoteUrl, remote: remoteResult.remote };
|
|
1137
|
+
}
|
|
1091
1138
|
default:
|
|
1092
1139
|
return failure("invalid_args", `Unknown Git command: ${command}`);
|
|
1093
1140
|
}
|
|
1094
1141
|
}
|
|
1142
|
+
function validateMutatingMessage(value) {
|
|
1143
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
1144
|
+
return failure("invalid_args", "message must be a non-empty string");
|
|
1145
|
+
}
|
|
1146
|
+
const msg = value.trim();
|
|
1147
|
+
if (msg.length > 200) {
|
|
1148
|
+
return failure("invalid_args", "message must be 200 characters or fewer");
|
|
1149
|
+
}
|
|
1150
|
+
return msg;
|
|
1151
|
+
}
|
|
1152
|
+
async function gitCheckpoint(workspace, message, includeUntracked) {
|
|
1153
|
+
const repo = await resolveGitRepository(workspace);
|
|
1154
|
+
const repoRoot = repo.repoRoot;
|
|
1155
|
+
const statusResult = await getGitRepoStatus(workspace);
|
|
1156
|
+
if (statusResult.hasConflicts) {
|
|
1157
|
+
throw new GitCommandError("conflict", "Repository has conflicts \u2014 resolve before checkpointing");
|
|
1158
|
+
}
|
|
1159
|
+
const addArgs = includeUntracked ? ["-A"] : ["-u"];
|
|
1160
|
+
await runGit(repo, ["add", ...addArgs], { cwd: repoRoot });
|
|
1161
|
+
const fullMsg = `adhdev: checkpoint ${message}`;
|
|
1162
|
+
let commitSha;
|
|
1163
|
+
try {
|
|
1164
|
+
await runGit(repo, ["commit", "-m", fullMsg], { cwd: repoRoot });
|
|
1165
|
+
const revResult = await runGit(repo, ["rev-parse", "HEAD"], { cwd: repoRoot });
|
|
1166
|
+
commitSha = revResult.stdout.trim();
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
const output = (err?.stdout || "") + (err?.stderr || "");
|
|
1169
|
+
if (/nothing to commit/i.test(output)) {
|
|
1170
|
+
throw new GitCommandError("git_command_failed", "Nothing to commit");
|
|
1171
|
+
}
|
|
1172
|
+
throw err;
|
|
1173
|
+
}
|
|
1174
|
+
return {
|
|
1175
|
+
workspace: repo.workspace,
|
|
1176
|
+
repoRoot,
|
|
1177
|
+
isGitRepo: true,
|
|
1178
|
+
commit: commitSha,
|
|
1179
|
+
message: fullMsg,
|
|
1180
|
+
lastCheckedAt: Date.now()
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
async function gitStashPush(workspace, message, includeUntracked) {
|
|
1184
|
+
const repo = await resolveGitRepository(workspace);
|
|
1185
|
+
const repoRoot = repo.repoRoot;
|
|
1186
|
+
const stashArgs = ["stash", "push", "-m", message];
|
|
1187
|
+
if (includeUntracked) stashArgs.push("--include-untracked");
|
|
1188
|
+
const result = await runGit(repo, stashArgs, { cwd: repoRoot });
|
|
1189
|
+
if (/No local changes to save/i.test(result.stdout + result.stderr)) {
|
|
1190
|
+
throw new GitCommandError("git_command_failed", "Nothing to stash");
|
|
1191
|
+
}
|
|
1192
|
+
return {
|
|
1193
|
+
workspace: repo.workspace,
|
|
1194
|
+
repoRoot,
|
|
1195
|
+
isGitRepo: true,
|
|
1196
|
+
stashRef: "stash@{0}",
|
|
1197
|
+
message,
|
|
1198
|
+
lastCheckedAt: Date.now()
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
async function gitStashPop(workspace, stashRef) {
|
|
1202
|
+
const repo = await resolveGitRepository(workspace);
|
|
1203
|
+
const repoRoot = repo.repoRoot;
|
|
1204
|
+
const popArgs = stashRef ? ["stash", "pop", stashRef] : ["stash", "pop"];
|
|
1205
|
+
await runGit(repo, popArgs, { cwd: repoRoot });
|
|
1206
|
+
}
|
|
1207
|
+
async function gitCheckoutFiles(workspace, paths) {
|
|
1208
|
+
const repo = await resolveGitRepository(workspace);
|
|
1209
|
+
const repoRoot = repo.repoRoot;
|
|
1210
|
+
const normalizedPaths = [];
|
|
1211
|
+
for (const p of paths) {
|
|
1212
|
+
if (typeof p !== "string" || !p.trim() || p.includes("\0")) {
|
|
1213
|
+
throw new GitCommandError("invalid_args", `Invalid path: ${String(p)}`);
|
|
1214
|
+
}
|
|
1215
|
+
if (path3.isAbsolute(p)) {
|
|
1216
|
+
throw new GitCommandError("invalid_args", `Path must be repository-relative, not absolute: ${p}`);
|
|
1217
|
+
}
|
|
1218
|
+
const normalized = path3.normalize(p.trim()).split(path3.sep).join("/");
|
|
1219
|
+
if (normalized.startsWith("../") || normalized === "..") {
|
|
1220
|
+
throw new GitCommandError("path_outside_repo", `Path is outside repository root: ${p}`);
|
|
1221
|
+
}
|
|
1222
|
+
const absolutePath = path3.resolve(repoRoot, normalized);
|
|
1223
|
+
if (!isPathInside(repoRoot, absolutePath)) {
|
|
1224
|
+
throw new GitCommandError("path_outside_repo", `Path is outside repository root: ${p}`);
|
|
1225
|
+
}
|
|
1226
|
+
normalizedPaths.push(normalized);
|
|
1227
|
+
}
|
|
1228
|
+
await runGit(repo, ["checkout", "--", ...normalizedPaths], { cwd: repoRoot });
|
|
1229
|
+
return { checkedOut: normalizedPaths };
|
|
1230
|
+
}
|
|
1231
|
+
async function gitGetRemoteUrl(workspace, remote) {
|
|
1232
|
+
const repo = await resolveGitRepository(workspace);
|
|
1233
|
+
const result = await runGit(repo, ["remote", "get-url", remote], { cwd: repo.repoRoot });
|
|
1234
|
+
const remoteUrl = result.stdout.trim();
|
|
1235
|
+
if (!remoteUrl) {
|
|
1236
|
+
throw new GitCommandError("git_command_failed", `Remote '${remote}' has no URL`);
|
|
1237
|
+
}
|
|
1238
|
+
return { remoteUrl, remote };
|
|
1239
|
+
}
|
|
1095
1240
|
function formatOptionalGitLogRangeArg(flag, value) {
|
|
1096
1241
|
return value ? [`${flag}=${value}`] : [];
|
|
1097
1242
|
}
|
|
@@ -1149,7 +1294,7 @@ function validateGitLogPath(repoRoot, filePath) {
|
|
|
1149
1294
|
}
|
|
1150
1295
|
return normalized;
|
|
1151
1296
|
}
|
|
1152
|
-
var path3, GIT_COMMAND_NAMES,
|
|
1297
|
+
var path3, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices;
|
|
1153
1298
|
var init_git_commands = __esm({
|
|
1154
1299
|
"../../oss/packages/daemon-core/src/git/git-commands.ts"() {
|
|
1155
1300
|
"use strict";
|
|
@@ -1168,13 +1313,8 @@ var init_git_commands = __esm({
|
|
|
1168
1313
|
"git_checkpoint",
|
|
1169
1314
|
"git_stash_push",
|
|
1170
1315
|
"git_stash_pop",
|
|
1171
|
-
"git_checkout_files"
|
|
1172
|
-
|
|
1173
|
-
MUTATING_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
1174
|
-
"git_checkpoint",
|
|
1175
|
-
"git_stash_push",
|
|
1176
|
-
"git_stash_pop",
|
|
1177
|
-
"git_checkout_files"
|
|
1316
|
+
"git_checkout_files",
|
|
1317
|
+
"git_remote_url"
|
|
1178
1318
|
]);
|
|
1179
1319
|
SNAPSHOT_REASONS = /* @__PURE__ */ new Set([
|
|
1180
1320
|
"session_baseline",
|
|
@@ -1201,6 +1341,33 @@ var init_git_commands = __esm({
|
|
|
1201
1341
|
}
|
|
1202
1342
|
});
|
|
1203
1343
|
|
|
1344
|
+
// ../../oss/packages/daemon-core/src/git/turn-snapshot-tracker.ts
|
|
1345
|
+
var BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker;
|
|
1346
|
+
var init_turn_snapshot_tracker = __esm({
|
|
1347
|
+
"../../oss/packages/daemon-core/src/git/turn-snapshot-tracker.ts"() {
|
|
1348
|
+
"use strict";
|
|
1349
|
+
BUSY_STATUSES = /* @__PURE__ */ new Set(["streaming", "waiting_approval"]);
|
|
1350
|
+
TERMINAL_STATUSES = /* @__PURE__ */ new Set(["idle", "error"]);
|
|
1351
|
+
TurnSnapshotTracker = class {
|
|
1352
|
+
lastStatus = /* @__PURE__ */ new Map();
|
|
1353
|
+
onTurnCompleted;
|
|
1354
|
+
constructor(onTurnCompleted) {
|
|
1355
|
+
this.onTurnCompleted = onTurnCompleted;
|
|
1356
|
+
}
|
|
1357
|
+
record(sessionId, status, workspace) {
|
|
1358
|
+
const prev = this.lastStatus.get(sessionId);
|
|
1359
|
+
this.lastStatus.set(sessionId, status);
|
|
1360
|
+
if (workspace && prev && BUSY_STATUSES.has(prev) && TERMINAL_STATUSES.has(status)) {
|
|
1361
|
+
this.onTurnCompleted({ sessionId, workspace });
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
forget(sessionId) {
|
|
1365
|
+
this.lastStatus.delete(sessionId);
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1204
1371
|
// ../../oss/packages/daemon-core/src/git/index.ts
|
|
1205
1372
|
var init_git = __esm({
|
|
1206
1373
|
"../../oss/packages/daemon-core/src/git/index.ts"() {
|
|
@@ -1212,6 +1379,7 @@ var init_git = __esm({
|
|
|
1212
1379
|
init_git_snapshot_store();
|
|
1213
1380
|
init_git_monitor();
|
|
1214
1381
|
init_git_commands();
|
|
1382
|
+
init_turn_snapshot_tracker();
|
|
1215
1383
|
}
|
|
1216
1384
|
});
|
|
1217
1385
|
|
|
@@ -11367,6 +11535,16 @@ var init_handler = __esm({
|
|
|
11367
11535
|
return result;
|
|
11368
11536
|
}
|
|
11369
11537
|
}
|
|
11538
|
+
if (cmd === "send_chat" && this._ctx.onBeforeSendChat) {
|
|
11539
|
+
const sessionId = this._currentRoute.session?.sessionId;
|
|
11540
|
+
const workspace = sessionId ? this._ctx.instanceManager?.getInstance(sessionId)?.getState?.()?.workspace : void 0;
|
|
11541
|
+
if (workspace && sessionId) {
|
|
11542
|
+
try {
|
|
11543
|
+
this._ctx.onBeforeSendChat({ workspace, sessionId });
|
|
11544
|
+
} catch {
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
}
|
|
11370
11548
|
try {
|
|
11371
11549
|
result = await this.dispatch(cmd, args);
|
|
11372
11550
|
this.logCommandEnd(cmd, result, startedAt);
|
|
@@ -13207,6 +13385,7 @@ function resolveCliAdapterConfig(provider) {
|
|
|
13207
13385
|
sendDelayMs: typeof provider.sendDelayMs === "number" ? Math.max(0, provider.sendDelayMs) : 0,
|
|
13208
13386
|
sendKey: typeof provider.sendKey === "string" && provider.sendKey.length > 0 ? provider.sendKey : "\r",
|
|
13209
13387
|
submitStrategy: provider.submitStrategy === "immediate" ? "immediate" : "wait_for_echo",
|
|
13388
|
+
requirePromptEchoBeforeSubmit: provider.requirePromptEchoBeforeSubmit === true,
|
|
13210
13389
|
providerResolutionMeta: {
|
|
13211
13390
|
type: provider.type,
|
|
13212
13391
|
name: provider.name,
|
|
@@ -13472,6 +13651,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
13472
13651
|
this.sendDelayMs = resolvedConfig.sendDelayMs;
|
|
13473
13652
|
this.sendKey = resolvedConfig.sendKey;
|
|
13474
13653
|
this.submitStrategy = resolvedConfig.submitStrategy;
|
|
13654
|
+
this.requirePromptEchoBeforeSubmit = resolvedConfig.requirePromptEchoBeforeSubmit;
|
|
13475
13655
|
this.providerResolutionMeta = resolvedConfig.providerResolutionMeta;
|
|
13476
13656
|
this.cliScripts = provider.scripts || {};
|
|
13477
13657
|
const scriptNames = listCliScriptNames(this.cliScripts);
|
|
@@ -13768,6 +13948,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
13768
13948
|
sendDelayMs;
|
|
13769
13949
|
sendKey;
|
|
13770
13950
|
submitStrategy;
|
|
13951
|
+
requirePromptEchoBeforeSubmit;
|
|
13771
13952
|
static SCRIPT_STATUS_DEBOUNCE_MS = 3e3;
|
|
13772
13953
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
13773
13954
|
setCliScripts(scripts) {
|
|
@@ -15288,6 +15469,22 @@ var init_provider_cli_adapter = __esm({
|
|
|
15288
15469
|
}
|
|
15289
15470
|
}
|
|
15290
15471
|
if (elapsed >= state.maxEchoWaitMs) {
|
|
15472
|
+
const diagnostic = {
|
|
15473
|
+
elapsed,
|
|
15474
|
+
maxEchoWaitMs: state.maxEchoWaitMs,
|
|
15475
|
+
submitDelayMs: state.submitDelayMs,
|
|
15476
|
+
promptSnippet: state.normalizedPromptSnippet,
|
|
15477
|
+
requirePromptEchoBeforeSubmit: this.requirePromptEchoBeforeSubmit,
|
|
15478
|
+
screenText: summarizeCliTraceText(screenText, 1e3)
|
|
15479
|
+
};
|
|
15480
|
+
this.recordTrace("submit_echo_missing", diagnostic);
|
|
15481
|
+
if (this.requirePromptEchoBeforeSubmit) {
|
|
15482
|
+
const message = `${this.cliName} prompt echo was not observed on the PTY screen before submit`;
|
|
15483
|
+
LOG.warn("CLI", `[${this.cliType}] ${message} elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs} screen=${JSON.stringify(diagnostic.screenText).slice(0, 240)}`);
|
|
15484
|
+
completion.rejectOnce(new Error(message));
|
|
15485
|
+
return;
|
|
15486
|
+
}
|
|
15487
|
+
LOG.warn("CLI", `[${this.cliType}] prompt echo was not observed before submit; sending submit key anyway elapsed=${elapsed}ms maxEchoWaitMs=${state.maxEchoWaitMs}`);
|
|
15291
15488
|
this.submitSendKey(state, completion);
|
|
15292
15489
|
return;
|
|
15293
15490
|
}
|
|
@@ -15752,6 +15949,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
15752
15949
|
sendDelayMs: this.sendDelayMs,
|
|
15753
15950
|
sendKey: this.sendKey,
|
|
15754
15951
|
submitStrategy: this.submitStrategy,
|
|
15952
|
+
requirePromptEchoBeforeSubmit: this.requirePromptEchoBeforeSubmit,
|
|
15755
15953
|
submitPendingUntil: this.submitPendingUntil,
|
|
15756
15954
|
responseSettleIgnoreUntil: this.responseSettleIgnoreUntil,
|
|
15757
15955
|
resizeSuppressUntil: this.resizeSuppressUntil,
|
|
@@ -37052,6 +37250,7 @@ var init_provider_schema = __esm({
|
|
|
37052
37250
|
"sendDelayMs",
|
|
37053
37251
|
"sendKey",
|
|
37054
37252
|
"submitStrategy",
|
|
37253
|
+
"requirePromptEchoBeforeSubmit",
|
|
37055
37254
|
"timeouts",
|
|
37056
37255
|
"disableUpstream"
|
|
37057
37256
|
]);
|
|
@@ -48627,6 +48826,7 @@ async function initDaemonComponents(config2) {
|
|
|
48627
48826
|
providerLoader,
|
|
48628
48827
|
instanceManager,
|
|
48629
48828
|
sessionRegistry,
|
|
48829
|
+
gitCommandServices: createDefaultGitCommandServices(),
|
|
48630
48830
|
onProviderSettingChanged: async (providerType) => {
|
|
48631
48831
|
await refreshProviderAvailability(providerType);
|
|
48632
48832
|
config2.onStatusChange?.();
|
|
@@ -48634,7 +48834,8 @@ async function initDaemonComponents(config2) {
|
|
|
48634
48834
|
onProviderSourceConfigChanged: async () => {
|
|
48635
48835
|
await refreshProviderAvailability();
|
|
48636
48836
|
config2.onStatusChange?.();
|
|
48637
|
-
}
|
|
48837
|
+
},
|
|
48838
|
+
onBeforeSendChat: config2.onBeforeSendChat
|
|
48638
48839
|
});
|
|
48639
48840
|
agentStreamManager = new DaemonAgentStreamManager(
|
|
48640
48841
|
LOG.forComponent("AgentStream").asLogFn(),
|
|
@@ -48760,6 +48961,7 @@ var init_daemon_lifecycle = __esm({
|
|
|
48760
48961
|
init_logger();
|
|
48761
48962
|
init_runtime_defaults();
|
|
48762
48963
|
init_config();
|
|
48964
|
+
init_git_commands();
|
|
48763
48965
|
}
|
|
48764
48966
|
});
|
|
48765
48967
|
|
|
@@ -48810,6 +49012,7 @@ __export(src_exports, {
|
|
|
48810
49012
|
ProviderLoader: () => ProviderLoader,
|
|
48811
49013
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
48812
49014
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
49015
|
+
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
48813
49016
|
VersionArchive: () => VersionArchive,
|
|
48814
49017
|
appendRecentActivity: () => appendRecentActivity,
|
|
48815
49018
|
buildAssistantChatMessage: () => buildAssistantChatMessage,
|
|
@@ -58691,7 +58894,7 @@ var init_adhdev_daemon = __esm({
|
|
|
58691
58894
|
init_version();
|
|
58692
58895
|
init_src();
|
|
58693
58896
|
init_runtime_defaults();
|
|
58694
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
58897
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.55" });
|
|
58695
58898
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
58696
58899
|
localHttpServer = null;
|
|
58697
58900
|
localWss = null;
|
|
@@ -58715,6 +58918,19 @@ var init_adhdev_daemon = __esm({
|
|
|
58715
58918
|
sessionHostEndpoint = null;
|
|
58716
58919
|
sessionHostController = null;
|
|
58717
58920
|
gitWorkspaceMonitor = createGitWorkspaceMonitor();
|
|
58921
|
+
turnSnapshotTracker = new TurnSnapshotTracker(({ sessionId, workspace }) => {
|
|
58922
|
+
const gitServices = this.components?.commandHandler?.ctx?.gitCommandServices;
|
|
58923
|
+
if (gitServices?.createSnapshot) {
|
|
58924
|
+
void Promise.resolve(gitServices.createSnapshot({
|
|
58925
|
+
workspace,
|
|
58926
|
+
reason: "after_agent_work",
|
|
58927
|
+
sessionId
|
|
58928
|
+
})).catch(() => {
|
|
58929
|
+
});
|
|
58930
|
+
}
|
|
58931
|
+
void this.gitWorkspaceMonitor.refresh({ workspace, includeDiffSummary: false }).catch(() => {
|
|
58932
|
+
});
|
|
58933
|
+
});
|
|
58718
58934
|
running = false;
|
|
58719
58935
|
localPort;
|
|
58720
58936
|
ideType = "unknown";
|
|
@@ -58886,7 +59102,8 @@ var init_adhdev_daemon = __esm({
|
|
|
58886
59102
|
})),
|
|
58887
59103
|
instanceId: `daemon_${loadConfig().machineId || "daemon"}`,
|
|
58888
59104
|
version: pkgVersion,
|
|
58889
|
-
profile: "live"
|
|
59105
|
+
profile: "live",
|
|
59106
|
+
getGitSummaryForWorkspace: (workspace) => this.gitWorkspaceMonitor.getCompactSummary(workspace)
|
|
58890
59107
|
});
|
|
58891
59108
|
}
|
|
58892
59109
|
invalidateHotChatSnapshotCache() {
|
|
@@ -59072,7 +59289,8 @@ var init_adhdev_daemon = __esm({
|
|
|
59072
59289
|
})),
|
|
59073
59290
|
instanceId: `daemon_${loadConfig().machineId || "daemon"}`,
|
|
59074
59291
|
version: pkgVersion,
|
|
59075
|
-
profile: "metadata"
|
|
59292
|
+
profile: "metadata",
|
|
59293
|
+
getGitSummaryForWorkspace: (workspace) => this.gitWorkspaceMonitor.getCompactSummary(workspace)
|
|
59076
59294
|
});
|
|
59077
59295
|
}
|
|
59078
59296
|
buildDaemonMetadataUpdateForSubscription(subscription) {
|
|
@@ -59216,6 +59434,27 @@ ${err?.stack || ""}`);
|
|
|
59216
59434
|
onStreamsUpdated: (ideType, streams) => {
|
|
59217
59435
|
if (!this.components) return;
|
|
59218
59436
|
forwardAgentStreamsToIdeInstance(this.components.instanceManager, ideType, streams);
|
|
59437
|
+
for (const stream of streams) {
|
|
59438
|
+
if (stream.sessionId) {
|
|
59439
|
+
const workspace = this.components?.instanceManager?.getInstance(stream.sessionId)?.getState()?.workspace;
|
|
59440
|
+
this.turnSnapshotTracker.record(stream.sessionId, stream.status || "idle", workspace);
|
|
59441
|
+
}
|
|
59442
|
+
}
|
|
59443
|
+
},
|
|
59444
|
+
onBeforeSendChat: ({ workspace }) => {
|
|
59445
|
+
void this.gitWorkspaceMonitor.refresh({
|
|
59446
|
+
workspace,
|
|
59447
|
+
includeDiffSummary: false
|
|
59448
|
+
}).catch(() => {
|
|
59449
|
+
});
|
|
59450
|
+
const gitServices = this.components?.commandHandler?.ctx?.gitCommandServices;
|
|
59451
|
+
if (gitServices?.createSnapshot) {
|
|
59452
|
+
void Promise.resolve(gitServices.createSnapshot({
|
|
59453
|
+
workspace,
|
|
59454
|
+
reason: "before_user_input_dispatch"
|
|
59455
|
+
})).catch(() => {
|
|
59456
|
+
});
|
|
59457
|
+
}
|
|
59219
59458
|
}
|
|
59220
59459
|
});
|
|
59221
59460
|
const providerSourceConfig = this.components.providerLoader.getSourceConfig();
|