@adhdev/daemon-standalone 0.9.82-rc.353 → 0.9.82-rc.354
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/index.js +134 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
|
|
|
30036
30036
|
}
|
|
30037
30037
|
function getDaemonBuildInfo() {
|
|
30038
30038
|
if (cached2) return cached2;
|
|
30039
|
-
const commit = readInjected(true ? "
|
|
30040
|
-
const commitShort = readInjected(true ? "
|
|
30041
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30042
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30039
|
+
const commit = readInjected(true ? "5d100a177f412ae29a58048f0a211c3928b06910" : void 0) ?? "unknown";
|
|
30040
|
+
const commitShort = readInjected(true ? "5d100a17" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30041
|
+
const version2 = readInjected(true ? "0.9.82-rc.354" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30042
|
+
const builtAt = readInjected(true ? "2026-06-22T11:32:34.147Z" : void 0);
|
|
30043
30043
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30044
30044
|
return cached2;
|
|
30045
30045
|
}
|
|
@@ -30793,6 +30793,9 @@ var require_dist3 = __commonJS({
|
|
|
30793
30793
|
getGitDiffSummary: () => getGitDiffSummary,
|
|
30794
30794
|
getGitFileDiff: () => getGitFileDiff
|
|
30795
30795
|
});
|
|
30796
|
+
function withCollectionTimeout(options) {
|
|
30797
|
+
return options.timeoutMs === void 0 ? { ...options, timeoutMs: GIT_STATUS_TIMEOUT_MS } : options;
|
|
30798
|
+
}
|
|
30796
30799
|
function validateBaseRef(ref) {
|
|
30797
30800
|
const trimmed = ref.trim();
|
|
30798
30801
|
if (!trimmed || trimmed.startsWith("-") || trimmed.includes("..") || !/^[A-Za-z0-9][A-Za-z0-9._/@-]*$/.test(trimmed)) {
|
|
@@ -30802,14 +30805,15 @@ var require_dist3 = __commonJS({
|
|
|
30802
30805
|
}
|
|
30803
30806
|
async function getGitDiffSummary(workspace, options = {}) {
|
|
30804
30807
|
const lastCheckedAt = Date.now();
|
|
30808
|
+
const effectiveOptions = withCollectionTimeout(options);
|
|
30805
30809
|
try {
|
|
30806
|
-
const repo = await resolveGitRepository(workspace,
|
|
30810
|
+
const repo = await resolveGitRepository(workspace, effectiveOptions);
|
|
30807
30811
|
const repoRoot = repo.repoRoot;
|
|
30808
30812
|
if (options.baseRef) {
|
|
30809
30813
|
const range = `${validateBaseRef(options.baseRef)}...HEAD`;
|
|
30810
30814
|
const [nameStatus, numstat] = await Promise.all([
|
|
30811
|
-
runGit(repo, ["diff", "--no-ext-diff", "--name-status", range, "--"], { ...
|
|
30812
|
-
runGit(repo, ["diff", "--no-ext-diff", "--numstat", range, "--"], { ...
|
|
30815
|
+
runGit(repo, ["diff", "--no-ext-diff", "--name-status", range, "--"], { ...effectiveOptions, cwd: repoRoot }),
|
|
30816
|
+
runGit(repo, ["diff", "--no-ext-diff", "--numstat", range, "--"], { ...effectiveOptions, cwd: repoRoot })
|
|
30813
30817
|
]);
|
|
30814
30818
|
const outputBytes2 = byteLength(nameStatus.stdout + numstat.stdout);
|
|
30815
30819
|
const changes2 = combineDiffEntries(nameStatus.stdout, numstat.stdout, false);
|
|
@@ -30828,11 +30832,11 @@ var require_dist3 = __commonJS({
|
|
|
30828
30832
|
};
|
|
30829
30833
|
}
|
|
30830
30834
|
const [unstagedNameStatus, unstagedNumstat, stagedNameStatus, stagedNumstat, untracked] = await Promise.all([
|
|
30831
|
-
runGit(repo, ["diff", "--no-ext-diff", "--name-status"], { ...
|
|
30832
|
-
runGit(repo, ["diff", "--no-ext-diff", "--numstat"], { ...
|
|
30833
|
-
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--name-status"], { ...
|
|
30834
|
-
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--numstat"], { ...
|
|
30835
|
-
runGit(repo, ["ls-files", "--others", "--exclude-standard"], { ...
|
|
30835
|
+
runGit(repo, ["diff", "--no-ext-diff", "--name-status"], { ...effectiveOptions, cwd: repoRoot }),
|
|
30836
|
+
runGit(repo, ["diff", "--no-ext-diff", "--numstat"], { ...effectiveOptions, cwd: repoRoot }),
|
|
30837
|
+
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--name-status"], { ...effectiveOptions, cwd: repoRoot }),
|
|
30838
|
+
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--numstat"], { ...effectiveOptions, cwd: repoRoot }),
|
|
30839
|
+
runGit(repo, ["ls-files", "--others", "--exclude-standard"], { ...effectiveOptions, cwd: repoRoot })
|
|
30836
30840
|
]);
|
|
30837
30841
|
const outputBytes = byteLength(
|
|
30838
30842
|
unstagedNameStatus.stdout + unstagedNumstat.stdout + stagedNameStatus.stdout + stagedNumstat.stdout + untracked.stdout
|
|
@@ -30874,13 +30878,14 @@ var require_dist3 = __commonJS({
|
|
|
30874
30878
|
}
|
|
30875
30879
|
async function getGitFileDiff(workspace, filePath, options = {}) {
|
|
30876
30880
|
const lastCheckedAt = Date.now();
|
|
30877
|
-
const
|
|
30881
|
+
const effectiveOptions = withCollectionTimeout(options);
|
|
30882
|
+
const repo = await resolveGitRepository(workspace, effectiveOptions);
|
|
30878
30883
|
const repoRoot = repo.repoRoot;
|
|
30879
30884
|
const selected = await resolveRepoFilePath(repoRoot, filePath);
|
|
30880
30885
|
const maxBytes = normalizePositiveInteger(options.maxBytes, DEFAULT_MAX_BYTES);
|
|
30881
30886
|
if (options.baseRef) {
|
|
30882
30887
|
const range = `${validateBaseRef(options.baseRef)}...HEAD`;
|
|
30883
|
-
const result = await runGit(repo, ["diff", "--no-ext-diff", range, "--", selected.relativePath], { ...
|
|
30888
|
+
const result = await runGit(repo, ["diff", "--no-ext-diff", range, "--", selected.relativePath], { ...effectiveOptions, cwd: repoRoot });
|
|
30884
30889
|
const bounded2 = truncateText(result.stdout, maxBytes);
|
|
30885
30890
|
return {
|
|
30886
30891
|
workspace: repo.workspace,
|
|
@@ -30893,13 +30898,13 @@ var require_dist3 = __commonJS({
|
|
|
30893
30898
|
};
|
|
30894
30899
|
}
|
|
30895
30900
|
const [unstaged, staged] = await Promise.all([
|
|
30896
|
-
runGit(repo, ["diff", "--no-ext-diff", "--", selected.relativePath], { ...
|
|
30897
|
-
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--", selected.relativePath], { ...
|
|
30901
|
+
runGit(repo, ["diff", "--no-ext-diff", "--", selected.relativePath], { ...effectiveOptions, cwd: repoRoot }),
|
|
30902
|
+
runGit(repo, ["diff", "--cached", "--no-ext-diff", "--", selected.relativePath], { ...effectiveOptions, cwd: repoRoot })
|
|
30898
30903
|
]);
|
|
30899
30904
|
let diff = [unstaged.stdout, staged.stdout].filter((part) => part.length > 0).join("\n");
|
|
30900
30905
|
if (!diff) {
|
|
30901
30906
|
const untracked = await runGit(repo, ["ls-files", "--others", "--exclude-standard", "--", selected.relativePath], {
|
|
30902
|
-
...
|
|
30907
|
+
...effectiveOptions,
|
|
30903
30908
|
cwd: repoRoot
|
|
30904
30909
|
});
|
|
30905
30910
|
const untrackedFiles = untracked.stdout.split("\n").filter(Boolean);
|
|
@@ -57154,6 +57159,40 @@ ${effect.notification.body || ""}`.trim();
|
|
|
57154
57159
|
}
|
|
57155
57160
|
return fn() || null;
|
|
57156
57161
|
}
|
|
57162
|
+
var AUTO_APPROVE_MANUAL_ATTENDANCE_SUPPRESS_MS = 6e4;
|
|
57163
|
+
var ManualAttendanceTracker = class {
|
|
57164
|
+
constructor(suppressMs = AUTO_APPROVE_MANUAL_ATTENDANCE_SUPPRESS_MS) {
|
|
57165
|
+
this.suppressMs = suppressMs;
|
|
57166
|
+
}
|
|
57167
|
+
lastInteractionAt = 0;
|
|
57168
|
+
/** Record that a human just drove this session by hand. */
|
|
57169
|
+
note(now = Date.now()) {
|
|
57170
|
+
this.lastInteractionAt = now;
|
|
57171
|
+
}
|
|
57172
|
+
/** True while a manual interaction is recent enough to suppress auto-approve. */
|
|
57173
|
+
isAttended(now = Date.now()) {
|
|
57174
|
+
return this.lastInteractionAt > 0 && now - this.lastInteractionAt < this.suppressMs;
|
|
57175
|
+
}
|
|
57176
|
+
/**
|
|
57177
|
+
* Milliseconds remaining in the current suppression window, or 0 when not
|
|
57178
|
+
* attended. Used to re-arm a re-check timer so auto-approve fires the moment
|
|
57179
|
+
* the window lapses even if the PTY/agent has since gone silent.
|
|
57180
|
+
*/
|
|
57181
|
+
remainingMs(now = Date.now()) {
|
|
57182
|
+
if (this.lastInteractionAt <= 0) return 0;
|
|
57183
|
+
return Math.max(0, this.suppressMs - (now - this.lastInteractionAt));
|
|
57184
|
+
}
|
|
57185
|
+
};
|
|
57186
|
+
var MANUAL_ATTENDANCE_COMMANDS = /* @__PURE__ */ new Set([
|
|
57187
|
+
"select_session",
|
|
57188
|
+
"open_panel",
|
|
57189
|
+
"invoke_provider_script",
|
|
57190
|
+
"set_mode",
|
|
57191
|
+
"change_model",
|
|
57192
|
+
"set_thought_level",
|
|
57193
|
+
"resolve_action",
|
|
57194
|
+
"pty_input"
|
|
57195
|
+
]);
|
|
57157
57196
|
var fs7 = __toESM2(require("fs"));
|
|
57158
57197
|
var os10 = __toESM2(require("os"));
|
|
57159
57198
|
var path16 = __toESM2(require("path"));
|
|
@@ -61468,11 +61507,38 @@ ${effect.notification.body || ""}`.trim();
|
|
|
61468
61507
|
setAgentStreamManager(manager) {
|
|
61469
61508
|
this._agentStream = manager;
|
|
61470
61509
|
}
|
|
61510
|
+
/**
|
|
61511
|
+
* When a command in the manual-attendance set arrives for a session this
|
|
61512
|
+
* daemon hosts, stamp the live instance so auto-approve holds while the user
|
|
61513
|
+
* drives the session by hand. Provider-common: the signal is the command
|
|
61514
|
+
* (foreground select_session / open_panel, controlbar invoke_provider_script
|
|
61515
|
+
* / set_mode / change_model / set_thought_level, manual resolve_action,
|
|
61516
|
+
* pty_input), never any CLI-specific modal text — so it works identically for
|
|
61517
|
+
* every CLI/ACP provider. send_chat is deliberately excluded because a
|
|
61518
|
+
* coordinator delegating a task to a worker also uses send_chat; counting it
|
|
61519
|
+
* would wrongly suppress the worker's delegated auto-approve. For a remote
|
|
61520
|
+
* mesh worker session the controlbar commands are forwarded to the owning
|
|
61521
|
+
* worker daemon, which runs this same hook there, so attendance is recorded
|
|
61522
|
+
* on the daemon that actually hosts the instance.
|
|
61523
|
+
*/
|
|
61524
|
+
noteManualAttendanceIfApplicable(cmd, args) {
|
|
61525
|
+
if (!MANUAL_ATTENDANCE_COMMANDS.has(cmd)) return;
|
|
61526
|
+
const sessionId = this._currentRoute.session?.sessionId || (typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "");
|
|
61527
|
+
if (!sessionId) return;
|
|
61528
|
+
const session = this._ctx.sessionRegistry?.get(sessionId);
|
|
61529
|
+
const instanceKey = session?.adapterKey || session?.instanceKey || sessionId;
|
|
61530
|
+
const instance = this._ctx.instanceManager?.getInstance(instanceKey);
|
|
61531
|
+
try {
|
|
61532
|
+
instance?.noteManualInteraction?.();
|
|
61533
|
+
} catch {
|
|
61534
|
+
}
|
|
61535
|
+
}
|
|
61471
61536
|
// ─── Command Dispatcher ──────────────────────────
|
|
61472
61537
|
async handle(cmd, args) {
|
|
61473
61538
|
this._currentRoute = this.resolveRoute(args);
|
|
61474
61539
|
const startedAt = Date.now();
|
|
61475
61540
|
this.logCommandStart(cmd, args);
|
|
61541
|
+
this.noteManualAttendanceIfApplicable(cmd, args);
|
|
61476
61542
|
let result;
|
|
61477
61543
|
if (isGitCommandName(cmd)) {
|
|
61478
61544
|
result = await handleGitCommand(cmd, args, this._ctx.gitCommandServices);
|
|
@@ -65394,6 +65460,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65394
65460
|
// a settle gate was in progress. Drives AUTO_APPROVE_GATE_HYSTERESIS_MS so a
|
|
65395
65461
|
// brief generating flip does not immediately wipe the settle clock.
|
|
65396
65462
|
autoApproveInactiveSince = 0;
|
|
65463
|
+
// Provider-common manual-attendance signal: while a human is actively driving
|
|
65464
|
+
// this session from the dashboard, auto-approve holds so they can take manual
|
|
65465
|
+
// control. Background mesh workers are never attended → delegated auto-approve
|
|
65466
|
+
// is unaffected.
|
|
65467
|
+
manualAttendance = new ManualAttendanceTracker();
|
|
65397
65468
|
controlValues = {};
|
|
65398
65469
|
summaryMetadata = void 0;
|
|
65399
65470
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
@@ -65669,7 +65740,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65669
65740
|
}
|
|
65670
65741
|
getHotChatSessionState() {
|
|
65671
65742
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
65672
|
-
const autoApproveActive = adapterStatus.status
|
|
65743
|
+
const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status);
|
|
65673
65744
|
const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
|
|
65674
65745
|
const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
|
|
65675
65746
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
@@ -65684,7 +65755,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65684
65755
|
}
|
|
65685
65756
|
getSessionModalState(sessionId) {
|
|
65686
65757
|
const adapterStatus = this.adapter.getStatus({ allowParse: true });
|
|
65687
|
-
const autoApproveActive = adapterStatus.status
|
|
65758
|
+
const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status);
|
|
65688
65759
|
const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
|
|
65689
65760
|
const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
|
|
65690
65761
|
const dirName = workingDirBasename(this.workingDir);
|
|
@@ -65765,7 +65836,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65765
65836
|
} catch {
|
|
65766
65837
|
return null;
|
|
65767
65838
|
}
|
|
65768
|
-
if (adapterStatus.status === "waiting_approval" && !this.
|
|
65839
|
+
if (adapterStatus.status === "waiting_approval" && !this.autoApproveEffectivelyActive(adapterStatus.status)) {
|
|
65769
65840
|
return "waiting_approval";
|
|
65770
65841
|
}
|
|
65771
65842
|
return null;
|
|
@@ -66211,6 +66282,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
66211
66282
|
this.lastApprovalEventFingerprint = "";
|
|
66212
66283
|
}
|
|
66213
66284
|
maybeAutoApproveStatus(adapterStatus, now = Date.now()) {
|
|
66285
|
+
if (adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove() && this.manualAttendance.isAttended(now)) {
|
|
66286
|
+
this.lastAutoApprovalSignature = "";
|
|
66287
|
+
this.pendingAutoApprovalSignature = "";
|
|
66288
|
+
this.pendingAutoApprovalSince = 0;
|
|
66289
|
+
this.autoApproveInactiveSince = 0;
|
|
66290
|
+
if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
|
|
66291
|
+
this.autoApproveSettleTimer = setTimeout(() => {
|
|
66292
|
+
this.autoApproveSettleTimer = null;
|
|
66293
|
+
this.recheckAutoApproveSettled();
|
|
66294
|
+
}, this.manualAttendance.remainingMs(now) + 20);
|
|
66295
|
+
return false;
|
|
66296
|
+
}
|
|
66214
66297
|
const autoApproveActive = adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove();
|
|
66215
66298
|
if (!autoApproveActive) {
|
|
66216
66299
|
this.lastAutoApprovalSignature = "";
|
|
@@ -66676,6 +66759,21 @@ ${effect.notification.body || ""}`.trim();
|
|
|
66676
66759
|
}
|
|
66677
66760
|
return false;
|
|
66678
66761
|
}
|
|
66762
|
+
/** @see ProviderInstance.noteManualInteraction */
|
|
66763
|
+
noteManualInteraction(now = Date.now()) {
|
|
66764
|
+
this.manualAttendance.note(now);
|
|
66765
|
+
}
|
|
66766
|
+
/**
|
|
66767
|
+
* Whether auto-approve should be treated as active *right now* for display
|
|
66768
|
+
* and firing decisions: the configured intent AND the user is not currently
|
|
66769
|
+
* attending this session by hand. When a human is attending, auto-approve is
|
|
66770
|
+
* held so the modal stays visible and they can drive it via the controlbar.
|
|
66771
|
+
* Provider-agnostic — the attendance signal is the command set, never any
|
|
66772
|
+
* CLI-specific modal text.
|
|
66773
|
+
*/
|
|
66774
|
+
autoApproveEffectivelyActive(status, now = Date.now()) {
|
|
66775
|
+
return status === "waiting_approval" && this.shouldAutoApprove() && !this.manualAttendance.isAttended(now);
|
|
66776
|
+
}
|
|
66679
66777
|
recordAutoApproval(modalMessage, buttonLabel, now = Date.now()) {
|
|
66680
66778
|
this.appendRuntimeSystemMessage(
|
|
66681
66779
|
formatAutoApprovalMessage(modalMessage, buttonLabel),
|
|
@@ -67619,7 +67717,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
67619
67717
|
input: tc.rawInput ? typeof tc.rawInput === "string" ? tc.rawInput : JSON.stringify(tc.rawInput) : void 0
|
|
67620
67718
|
});
|
|
67621
67719
|
}
|
|
67622
|
-
if (this.settings.autoApprove !== false) {
|
|
67720
|
+
if (this.settings.autoApprove !== false && !this.manualAttendance.isAttended()) {
|
|
67623
67721
|
const toolTitle = tc.title || tc.toolCallId || "tool call";
|
|
67624
67722
|
this.log.info(`[${this.type}] Auto-approving: ${toolTitle}`);
|
|
67625
67723
|
this.appendSystemMessage(`Auto-approved: ${toolTitle}`);
|
|
@@ -67850,6 +67948,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
67850
67948
|
this.detectStatusTransition();
|
|
67851
67949
|
}
|
|
67852
67950
|
permissionResolvers = [];
|
|
67951
|
+
// Provider-common manual-attendance signal: while a human is actively driving
|
|
67952
|
+
// this session from the dashboard, auto-approve holds so they can decide on
|
|
67953
|
+
// the permission request themselves. Background workers are never attended →
|
|
67954
|
+
// delegated auto-approve is unaffected.
|
|
67955
|
+
manualAttendance = new ManualAttendanceTracker();
|
|
67956
|
+
/** @see ProviderInstance.noteManualInteraction */
|
|
67957
|
+
noteManualInteraction(now = Date.now()) {
|
|
67958
|
+
this.manualAttendance.note(now);
|
|
67959
|
+
}
|
|
67853
67960
|
async resolvePermission(approved) {
|
|
67854
67961
|
const resolver = this.permissionResolvers.shift();
|
|
67855
67962
|
if (resolver) {
|
|
@@ -69001,6 +69108,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69001
69108
|
);
|
|
69002
69109
|
continue;
|
|
69003
69110
|
}
|
|
69111
|
+
const restoredSettings = { ...this.providerLoader.getSettings(normalizedType) };
|
|
69112
|
+
const coordinatorEntry = getCoordinatorForSession(record2.runtimeId);
|
|
69113
|
+
if (coordinatorEntry?.meshId) {
|
|
69114
|
+
restoredSettings.meshCoordinatorFor = coordinatorEntry.meshId;
|
|
69115
|
+
}
|
|
69004
69116
|
try {
|
|
69005
69117
|
await this.registerCliInstance(
|
|
69006
69118
|
record2.runtimeId,
|
|
@@ -69009,7 +69121,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69009
69121
|
record2.workspace,
|
|
69010
69122
|
record2.cliArgs,
|
|
69011
69123
|
resolvedProvider,
|
|
69012
|
-
|
|
69124
|
+
restoredSettings,
|
|
69013
69125
|
true,
|
|
69014
69126
|
{
|
|
69015
69127
|
providerSessionId: sessionBinding.providerSessionId,
|