@vibedeckx/linux-x64 0.3.28 → 0.3.29
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/bin.js +130 -36
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -186844,7 +186844,9 @@ var mapAgentSession = (row) => ({
|
|
|
186844
186844
|
last_completed_at: row.last_completed_at,
|
|
186845
186845
|
favorited_at: row.favorited_at,
|
|
186846
186846
|
native_session_id: row.native_session_id,
|
|
186847
|
-
history_epoch: row.history_epoch
|
|
186847
|
+
history_epoch: row.history_epoch,
|
|
186848
|
+
branched_from_session_id: row.branched_from_session_id,
|
|
186849
|
+
branched_from_entry_index: row.branched_from_entry_index
|
|
186848
186850
|
});
|
|
186849
186851
|
var parseActivityTimestamp = (value) => {
|
|
186850
186852
|
const explicitZone = /(?:Z|[+-]\d\d:\d\d)$/i.test(value);
|
|
@@ -187007,6 +187009,7 @@ var mapRemoteCreationIntent = (row) => ({
|
|
|
187007
187009
|
var mapRemoteReviewerCreationIntent = (row) => ({
|
|
187008
187010
|
...row,
|
|
187009
187011
|
review_span: row.review_span,
|
|
187012
|
+
review_context_mode: row.review_context_mode ?? null,
|
|
187010
187013
|
status: row.status
|
|
187011
187014
|
});
|
|
187012
187015
|
var nowActivityAt = () => sql`cast((julianday('now') - 2440587.5) * 86400000 as integer)`;
|
|
@@ -187231,6 +187234,9 @@ var createAgentSessionRepos = (kdb, h) => ({
|
|
|
187231
187234
|
// Toggle favorite without touching updated_at — favoriting is a passive
|
|
187232
187235
|
// bookmark, not a "this session was active" signal, so it must not
|
|
187233
187236
|
// disturb the dropdown's recency ordering.
|
|
187237
|
+
setBranchedFrom: async (id, sourceSessionId, entryIndex) => {
|
|
187238
|
+
await kdb.updateTable("agent_sessions").set({ branched_from_session_id: sourceSessionId, branched_from_entry_index: entryIndex }).where("id", "=", id).execute();
|
|
187239
|
+
},
|
|
187234
187240
|
setFavorited: async (id, favorited) => {
|
|
187235
187241
|
await kdb.updateTable("agent_sessions").set({ favorited_at: favorited ? Date.now() : null }).where("id", "=", id).execute();
|
|
187236
187242
|
},
|
|
@@ -187549,6 +187555,7 @@ var createAgentSessionRepos = (kdb, h) => ({
|
|
|
187549
187555
|
review_focus: intent.reviewFocus ?? null,
|
|
187550
187556
|
source_turn_end_index: intent.sourceTurnEndIndex ?? null,
|
|
187551
187557
|
review_span: intent.reviewSpan,
|
|
187558
|
+
review_context_mode: intent.reviewContextMode ?? null,
|
|
187552
187559
|
agent_type: intent.agentType,
|
|
187553
187560
|
intent_brief: intent.intentBrief ?? null,
|
|
187554
187561
|
user_id: intent.userId ?? null,
|
|
@@ -187558,7 +187565,7 @@ var createAgentSessionRepos = (kdb, h) => ({
|
|
|
187558
187565
|
updated_at: h.nowMs()
|
|
187559
187566
|
}).onConflict((oc) => oc.column("local_reviewer_session_id").doNothing()).execute();
|
|
187560
187567
|
const row = await trx.selectFrom("remote_reviewer_creation_intents").selectAll().where("local_reviewer_session_id", "=", intent.localReviewerSessionId).executeTakeFirstOrThrow();
|
|
187561
|
-
const sameIdentity = row.remote_reviewer_session_id === intent.remoteReviewerSessionId && row.remote_run_id === intent.remoteRunId && row.project_id === intent.projectId && row.remote_server_id === intent.remoteServerId && (row.branch ?? "") === (intent.branch ?? "") && row.remote_path === intent.remotePath && row.source_remote_session_id === intent.sourceRemoteSessionId && row.review_focus === (intent.reviewFocus ?? null) && row.source_turn_end_index === (intent.sourceTurnEndIndex ?? null) && row.review_span === intent.reviewSpan && row.agent_type === intent.agentType && row.intent_brief === (intent.intentBrief ?? null) && row.user_id === (intent.userId ?? null);
|
|
187568
|
+
const sameIdentity = row.remote_reviewer_session_id === intent.remoteReviewerSessionId && row.remote_run_id === intent.remoteRunId && row.project_id === intent.projectId && row.remote_server_id === intent.remoteServerId && (row.branch ?? "") === (intent.branch ?? "") && row.remote_path === intent.remotePath && row.source_remote_session_id === intent.sourceRemoteSessionId && row.review_focus === (intent.reviewFocus ?? null) && row.source_turn_end_index === (intent.sourceTurnEndIndex ?? null) && row.review_span === intent.reviewSpan && (row.review_context_mode ?? null) === (intent.reviewContextMode ?? null) && row.agent_type === intent.agentType && row.intent_brief === (intent.intentBrief ?? null) && row.user_id === (intent.userId ?? null);
|
|
187562
187569
|
if (!sameIdentity) {
|
|
187563
187570
|
throw new Error(`Remote reviewer creation intent ${intent.localReviewerSessionId} has conflicting identity`);
|
|
187564
187571
|
}
|
|
@@ -203758,6 +203765,8 @@ var tightenWorkspaceCheckoutForeignKeys = (db) => {
|
|
|
203758
203765
|
favorited_at INTEGER DEFAULT NULL,
|
|
203759
203766
|
native_session_id TEXT DEFAULT NULL,
|
|
203760
203767
|
history_epoch INTEGER NOT NULL DEFAULT 0,
|
|
203768
|
+
branched_from_session_id TEXT DEFAULT NULL,
|
|
203769
|
+
branched_from_entry_index INTEGER DEFAULT NULL,
|
|
203761
203770
|
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
|
|
203762
203771
|
FOREIGN KEY (workspace_checkout_id) REFERENCES workspace_checkouts(id)
|
|
203763
203772
|
DEFERRABLE INITIALLY DEFERRED
|
|
@@ -203765,10 +203774,12 @@ var tightenWorkspaceCheckoutForeignKeys = (db) => {
|
|
|
203765
203774
|
INSERT INTO agent_sessions_fk_new
|
|
203766
203775
|
(id, project_id, branch, workspace_checkout_id, status, permission_mode, agent_type,
|
|
203767
203776
|
title, model, created_at, updated_at, activity_at, last_user_message_at,
|
|
203768
|
-
last_completed_at, favorited_at, native_session_id, history_epoch
|
|
203777
|
+
last_completed_at, favorited_at, native_session_id, history_epoch,
|
|
203778
|
+
branched_from_session_id, branched_from_entry_index)
|
|
203769
203779
|
SELECT id, project_id, branch, workspace_checkout_id, status, permission_mode, agent_type,
|
|
203770
203780
|
title, model, created_at, updated_at, activity_at, last_user_message_at,
|
|
203771
|
-
last_completed_at, favorited_at, native_session_id, history_epoch
|
|
203781
|
+
last_completed_at, favorited_at, native_session_id, history_epoch,
|
|
203782
|
+
branched_from_session_id, branched_from_entry_index
|
|
203772
203783
|
FROM agent_sessions;
|
|
203773
203784
|
DROP TABLE agent_sessions;
|
|
203774
203785
|
ALTER TABLE agent_sessions_fk_new RENAME TO agent_sessions;
|
|
@@ -204179,6 +204190,7 @@ var initializeSchema = (db) => {
|
|
|
204179
204190
|
review_focus TEXT,
|
|
204180
204191
|
source_turn_end_index INTEGER,
|
|
204181
204192
|
review_span TEXT NOT NULL CHECK (review_span IN ('this_turn', 'session_start')),
|
|
204193
|
+
review_context_mode TEXT CHECK (review_context_mode IN ('briefed', 'blind')),
|
|
204182
204194
|
agent_type TEXT NOT NULL,
|
|
204183
204195
|
intent_brief TEXT,
|
|
204184
204196
|
user_id TEXT,
|
|
@@ -204595,6 +204607,11 @@ var initializeSchema = (db) => {
|
|
|
204595
204607
|
coalesce(cast((julianday(created_at) - 2440587.5) * 86400000 as integer), 0)
|
|
204596
204608
|
)`);
|
|
204597
204609
|
}
|
|
204610
|
+
const sessionBranchedFromInfo = db.prepare("PRAGMA table_info(agent_sessions)").all();
|
|
204611
|
+
if (!sessionBranchedFromInfo.some((col) => col.name === "branched_from_session_id")) {
|
|
204612
|
+
db.exec("ALTER TABLE agent_sessions ADD COLUMN branched_from_session_id TEXT DEFAULT NULL");
|
|
204613
|
+
db.exec("ALTER TABLE agent_sessions ADD COLUMN branched_from_entry_index INTEGER DEFAULT NULL");
|
|
204614
|
+
}
|
|
204598
204615
|
db.exec(`
|
|
204599
204616
|
CREATE INDEX IF NOT EXISTS idx_agent_sessions_project_branch
|
|
204600
204617
|
ON agent_sessions(project_id, branch);
|
|
@@ -205344,6 +205361,10 @@ var initializeSchema = (db) => {
|
|
|
205344
205361
|
if (!workflowRunsInfo.some((col) => col.name === "review_span")) {
|
|
205345
205362
|
db.exec("ALTER TABLE workflow_runs ADD COLUMN review_span TEXT NOT NULL DEFAULT 'this_turn'");
|
|
205346
205363
|
}
|
|
205364
|
+
const reviewerIntentsInfo = db.prepare("PRAGMA table_info(remote_reviewer_creation_intents)").all();
|
|
205365
|
+
if (!reviewerIntentsInfo.some((col) => col.name === "review_context_mode")) {
|
|
205366
|
+
db.exec("ALTER TABLE remote_reviewer_creation_intents ADD COLUMN review_context_mode TEXT CHECK (review_context_mode IN ('briefed', 'blind'))");
|
|
205367
|
+
}
|
|
205347
205368
|
db.exec(`
|
|
205348
205369
|
CREATE TABLE IF NOT EXISTS user_settings (
|
|
205349
205370
|
user_id TEXT NOT NULL,
|
|
@@ -231165,6 +231186,7 @@ var AgentSessionManager = class {
|
|
|
231165
231186
|
reset: opts.historyEpoch !== void 0 && opts.historyEpoch !== session.historyEpoch
|
|
231166
231187
|
}
|
|
231167
231188
|
}));
|
|
231189
|
+
ws.send(JSON.stringify(this.backgroundTasksMessage(session)));
|
|
231168
231190
|
for (const patch of session.store.patches) {
|
|
231169
231191
|
const entryIndices = patch.flatMap((op) => {
|
|
231170
231192
|
const match2 = op.path.match(/^\/entries\/(\d+)$/);
|
|
@@ -231177,8 +231199,6 @@ var AgentSessionManager = class {
|
|
|
231177
231199
|
ws.send(JSON.stringify({ Ready: true, historyEpoch: session.historyEpoch }));
|
|
231178
231200
|
const statusPatch = ConversationPatch.updateStatus(session.status);
|
|
231179
231201
|
ws.send(JSON.stringify({ JsonPatch: statusPatch }));
|
|
231180
|
-
const tasksMsg = this.backgroundTasksMessage(session);
|
|
231181
|
-
ws.send(JSON.stringify(tasksMsg));
|
|
231182
231202
|
return () => {
|
|
231183
231203
|
session.subscribers.delete(ws);
|
|
231184
231204
|
};
|
|
@@ -231977,6 +231997,8 @@ var AgentSessionManager = class {
|
|
|
231977
231997
|
permissionMode,
|
|
231978
231998
|
agentType: dbSession.agent_type || "claude-code",
|
|
231979
231999
|
model: dbSession.model ?? null,
|
|
232000
|
+
branchedFromSessionId: dbSession.branched_from_session_id ?? null,
|
|
232001
|
+
branchedFromEntryIndex: dbSession.branched_from_entry_index ?? null,
|
|
231980
232002
|
completion: new TurnCompletionLedger(this.parkTimeoutMs),
|
|
231981
232003
|
graceTimer: null,
|
|
231982
232004
|
parkTimer: null,
|
|
@@ -232103,6 +232125,14 @@ var AgentSessionManager = class {
|
|
|
232103
232125
|
if (existingRuntime && opts.crossRemoteMcp) {
|
|
232104
232126
|
existingRuntime.crossRemoteMcp = opts.crossRemoteMcp;
|
|
232105
232127
|
}
|
|
232128
|
+
if (!existingBranch.branched_from_session_id) {
|
|
232129
|
+
const repairedEntryIndex = entryRows[entryRows.length - 1].entry_index;
|
|
232130
|
+
await this.storage.agentSessions.setBranchedFrom(newId, sourceSessionId, repairedEntryIndex);
|
|
232131
|
+
if (existingRuntime) {
|
|
232132
|
+
existingRuntime.branchedFromSessionId = sourceSessionId;
|
|
232133
|
+
existingRuntime.branchedFromEntryIndex = repairedEntryIndex;
|
|
232134
|
+
}
|
|
232135
|
+
}
|
|
232106
232136
|
return { ok: true, sessionId: newId };
|
|
232107
232137
|
}
|
|
232108
232138
|
}
|
|
@@ -232136,6 +232166,8 @@ var AgentSessionManager = class {
|
|
|
232136
232166
|
for (const row of entryRows) {
|
|
232137
232167
|
await this.storage.agentSessions.upsertEntry(newId, row.entry_index, row.data);
|
|
232138
232168
|
}
|
|
232169
|
+
const branchedFromEntryIndex = opts.upToEntryIndex ?? entryRows[entryRows.length - 1].entry_index;
|
|
232170
|
+
await this.storage.agentSessions.setBranchedFrom(newId, sourceSessionId, branchedFromEntryIndex);
|
|
232139
232171
|
let baseTitle = sourceRow?.title ?? null;
|
|
232140
232172
|
if (!baseTitle) {
|
|
232141
232173
|
for (const row of entryRows) {
|
|
@@ -232179,7 +232211,9 @@ var AgentSessionManager = class {
|
|
|
232179
232211
|
lastActiveAt: Date.now(),
|
|
232180
232212
|
turnOpenSince: null,
|
|
232181
232213
|
turnDisposition: null,
|
|
232182
|
-
crossRemoteMcp: opts.crossRemoteMcp
|
|
232214
|
+
crossRemoteMcp: opts.crossRemoteMcp,
|
|
232215
|
+
branchedFromSessionId: sourceSessionId,
|
|
232216
|
+
branchedFromEntryIndex
|
|
232183
232217
|
};
|
|
232184
232218
|
this.sessions.set(newId, branched);
|
|
232185
232219
|
await this.emitDerivedBranchActivity(projectId, branch);
|
|
@@ -233369,6 +233403,7 @@ async function createRemoteWorkflowReviewer(deps, params) {
|
|
|
233369
233403
|
reviewFocus: params.reviewFocus ?? null,
|
|
233370
233404
|
sourceTurnEndIndex: params.sourceTurnEndIndex ?? null,
|
|
233371
233405
|
reviewSpan: params.reviewSpan,
|
|
233406
|
+
reviewContextMode: params.reviewContextMode ?? null,
|
|
233372
233407
|
agentType: params.reviewerAgentType,
|
|
233373
233408
|
intentBrief: params.intentBrief ?? null,
|
|
233374
233409
|
userId: params.userId ?? null
|
|
@@ -233384,6 +233419,7 @@ async function createRemoteWorkflowReviewer(deps, params) {
|
|
|
233384
233419
|
reviewFocus: params.reviewFocus,
|
|
233385
233420
|
sourceTurnEndIndex: params.sourceTurnEndIndex,
|
|
233386
233421
|
reviewSpan: params.reviewSpan,
|
|
233422
|
+
reviewContextMode: params.reviewContextMode,
|
|
233387
233423
|
reviewerAgentType: params.reviewerAgentType,
|
|
233388
233424
|
intentBrief: params.intentBrief,
|
|
233389
233425
|
runId: remoteRunId,
|
|
@@ -233575,6 +233611,7 @@ function recoverPendingRemoteReviewerOnce(deps, intent) {
|
|
|
233575
233611
|
reviewFocus: intent.review_focus ?? void 0,
|
|
233576
233612
|
sourceTurnEndIndex: intent.source_turn_end_index ?? void 0,
|
|
233577
233613
|
reviewSpan: intent.review_span,
|
|
233614
|
+
reviewContextMode: intent.review_context_mode ?? void 0,
|
|
233578
233615
|
reviewerAgentType: intent.agent_type,
|
|
233579
233616
|
intentBrief: intent.intent_brief ?? void 0,
|
|
233580
233617
|
userId: intent.user_id ?? void 0,
|
|
@@ -239666,13 +239703,17 @@ var VERDICT_INSTRUCTIONS = [
|
|
|
239666
239703
|
"3. Non-blocking notes \u2014 style and polish, briefly, clearly separated from the blocking list."
|
|
239667
239704
|
];
|
|
239668
239705
|
function buildReviewerPrompt(opts) {
|
|
239669
|
-
const
|
|
239670
|
-
const
|
|
239671
|
-
const
|
|
239706
|
+
const blind = opts.blind === true;
|
|
239707
|
+
const intent = !blind && opts.originalIntent !== opts.taskContext ? opts.originalIntent : null;
|
|
239708
|
+
const brief = blind ? null : opts.intentBrief || null;
|
|
239709
|
+
const taskContext = blind ? null : opts.taskContext;
|
|
239710
|
+
const selfReport = blind ? null : opts.authorSelfReport;
|
|
239711
|
+
const hasExcerpt = Boolean(intent || taskContext || selfReport);
|
|
239672
239712
|
const scope = opts.scope && opts.scope.changedFiles.length > 0 ? opts.scope : null;
|
|
239673
|
-
const noDiffWithAnalysis = Boolean(
|
|
239713
|
+
const noDiffWithAnalysis = Boolean(selfReport) && selfReport.trim().length >= SELF_REPORT_MIN_CHARS;
|
|
239674
239714
|
return [
|
|
239675
239715
|
"You are a code reviewer agent. Another agent just completed work in this workspace; review it critically and independently.",
|
|
239716
|
+
blind ? '\n## Independent review\nBy design you have been given no context from the conversation that produced this work \u2014 no task statement, no author summary. Infer the intent from the change itself, the repository, and its history, and open your verdict message by stating that inferred intent in one or two sentences. Do not assume any agreement, exemption, or constraint that is not evidenced in the repository; if a behavior looks wrong but could plausibly be intentional, report it marked "possibly intended \u2014 needs author confirmation" rather than staying silent.' : null,
|
|
239676
239717
|
brief ? `
|
|
239677
239718
|
## Intent brief (distilled from the source conversation)
|
|
239678
239719
|
${brief}` : null,
|
|
@@ -239682,10 +239723,10 @@ ${intent}` : null,
|
|
|
239682
239723
|
// Deliberately not titled "Original task": in confirmation-style
|
|
239683
239724
|
// conversations the latest message is often just "ok" — informative as
|
|
239684
239725
|
// the user's last word, misleading as a statement of the task.
|
|
239685
|
-
!brief &&
|
|
239726
|
+
!brief && taskContext ? `
|
|
239686
239727
|
## Latest user message (verbatim)
|
|
239687
|
-
${
|
|
239688
|
-
selfReportSection(
|
|
239728
|
+
${taskContext}` : null,
|
|
239729
|
+
selfReportSection(selfReport),
|
|
239689
239730
|
opts.reviewFocus ? `
|
|
239690
239731
|
## Review focus (from the user)
|
|
239691
239732
|
${opts.reviewFocus}` : null,
|
|
@@ -239702,14 +239743,17 @@ Confine your review to these files and changes. Other uncommitted or pre-existin
|
|
|
239702
239743
|
"- Do NOT modify any files \u2014 you are in read-only review mode.",
|
|
239703
239744
|
"- Inspect the actual workspace state yourself: read the relevant files, run `git diff`, `git status` and `git log`.",
|
|
239704
239745
|
reviewTargetPromptLine(opts.target),
|
|
239705
|
-
noDiffWithAnalysis ? "- Judge correctness and completeness against the task. For this analysis/plan turn the work under review is the reasoning and the proposal, not code quality of a diff. Be specific: reference files and lines." : "- Judge correctness, completeness against the task, and code quality. Be specific: reference files and lines.",
|
|
239746
|
+
blind ? "- Judge correctness and code quality on the change's own evidence \u2014 there is no task statement to judge completeness against. Be specific: reference files and lines." : noDiffWithAnalysis ? "- Judge correctness and completeness against the task. For this analysis/plan turn the work under review is the reasoning and the proposal, not code quality of a diff. Be specific: reference files and lines." : "- Judge correctness, completeness against the task, and code quality. Be specific: reference files and lines.",
|
|
239706
239747
|
// These two only make sense against a distilled brief: tier 2 has no
|
|
239707
239748
|
// [settled]/[tentative] marks and no stated scope, and implying it does
|
|
239708
239749
|
// would suppress findings on the strength of data that doesn't exist.
|
|
239709
239750
|
brief ? "- Where the brief marks a decision, non-goal, or accepted limitation as [settled], do not re-raise the choice itself as a finding; DO report concrete consequences it causes \u2014 failure of the core goal, or a correctness, security, or data loss problem. Items marked [tentative] (or unmarked) get normal review. A violated hard constraint is always blocking." : null,
|
|
239710
239751
|
brief ? "- Do not propose enhancements beyond the brief's stated scope \u2014 scope expansion is a product decision, not a review finding." : null,
|
|
239711
239752
|
...VERDICT_INSTRUCTIONS,
|
|
239712
|
-
|
|
239753
|
+
// "deliberately withheld" vs the tier-3 "was unavailable": both are
|
|
239754
|
+
// workspace-only prompts, but post-hoc attribution must be able to tell a
|
|
239755
|
+
// user choice from a degradation.
|
|
239756
|
+
blind ? "\n(review context: independent review \u2014 session context deliberately withheld; live workspace only)" : brief ? opts.authorSelfReport ? "\n(review context: distilled intent brief + author self-report + live workspace)" : "\n(review context: distilled intent brief + live workspace)" : hasExcerpt ? "\n(review context: deterministic excerpt of the source conversation + live workspace)" : "\n(review context: live workspace only \u2014 the source conversation was unavailable)"
|
|
239713
239757
|
].filter((l) => l !== null).join("\n");
|
|
239714
239758
|
}
|
|
239715
239759
|
function reviewTargetPromptLine(target) {
|
|
@@ -239878,6 +239922,7 @@ var WorkflowEngine = class {
|
|
|
239878
239922
|
sessionId: null,
|
|
239879
239923
|
title: null,
|
|
239880
239924
|
agentType: null,
|
|
239925
|
+
lastActiveAt: null,
|
|
239881
239926
|
reason
|
|
239882
239927
|
});
|
|
239883
239928
|
const source = await this.storage.agentSessions.getById(sourceSessionId);
|
|
@@ -239910,6 +239955,7 @@ var WorkflowEngine = class {
|
|
|
239910
239955
|
sessionId: reviewer.id,
|
|
239911
239956
|
title: reviewer.title ?? null,
|
|
239912
239957
|
agentType: reviewer.agent_type,
|
|
239958
|
+
lastActiveAt: reviewerProjection.lastActiveAt,
|
|
239913
239959
|
reason: null
|
|
239914
239960
|
};
|
|
239915
239961
|
}
|
|
@@ -239920,6 +239966,9 @@ var WorkflowEngine = class {
|
|
|
239920
239966
|
if (opts.reviewerSessionId && opts.newReviewerSessionId) {
|
|
239921
239967
|
throw new WorkflowError("reviewer-unavailable", "\u4E0D\u80FD\u540C\u65F6\u590D\u7528\u548C\u65B0\u5EFA reviewer session");
|
|
239922
239968
|
}
|
|
239969
|
+
if (opts.blind && opts.reviewerSessionId) {
|
|
239970
|
+
throw new WorkflowError("reviewer-unavailable", "blind review \u4E0D\u80FD\u590D\u7528\u5DF2\u6709 reviewer session");
|
|
239971
|
+
}
|
|
239923
239972
|
const runId = opts.runId ?? randomUUID6();
|
|
239924
239973
|
const existingRun = opts.runId ? await this.storage.workflowRuns.getById(runId) : void 0;
|
|
239925
239974
|
if (existingRun) {
|
|
@@ -240081,6 +240130,7 @@ var WorkflowEngine = class {
|
|
|
240081
240130
|
originalIntent: extractFirstUserMessage(entries),
|
|
240082
240131
|
authorSelfReport: extractAuthorSelfReport(entries, turnEndIndex),
|
|
240083
240132
|
intentBrief: opts.intentBrief ?? null,
|
|
240133
|
+
blind: opts.blind,
|
|
240084
240134
|
reviewFocus: opts.reviewFocus ?? null,
|
|
240085
240135
|
target,
|
|
240086
240136
|
scope
|
|
@@ -247598,6 +247648,25 @@ var routes11 = async (fastify2) => {
|
|
|
247598
247648
|
}
|
|
247599
247649
|
return reader(session.id, "runtime");
|
|
247600
247650
|
}
|
|
247651
|
+
function sendBackFields(session) {
|
|
247652
|
+
const parentId = session.branchedFromSessionId;
|
|
247653
|
+
if (!parentId) return {};
|
|
247654
|
+
return {
|
|
247655
|
+
branchedFromSessionId: parentId,
|
|
247656
|
+
branchedFromAvailable: fastify2.agentSessionManager.getSession(parentId) != null,
|
|
247657
|
+
// Entry indices survive the branch copy unchanged, so this tells the UI
|
|
247658
|
+
// which dividers are inherited history (≤) vs the branch's own turns (>)
|
|
247659
|
+
// — send-back only makes sense on the latter.
|
|
247660
|
+
...session.branchedFromEntryIndex != null ? { branchedFromEntryIndex: session.branchedFromEntryIndex } : {}
|
|
247661
|
+
};
|
|
247662
|
+
}
|
|
247663
|
+
async function mapRemoteSendBackFields(remoteServerId, session) {
|
|
247664
|
+
const { branchedFromSessionId: workerParentId, branchedFromAvailable, branchedFromEntryIndex, ...rest } = session;
|
|
247665
|
+
if (typeof workerParentId !== "string") return rest;
|
|
247666
|
+
const mapping = await fastify2.storage.remoteSessionMappings.getByRemote?.(remoteServerId, workerParentId);
|
|
247667
|
+
if (!mapping) return rest;
|
|
247668
|
+
return { ...rest, branchedFromSessionId: mapping.local_session_id, branchedFromAvailable, branchedFromEntryIndex };
|
|
247669
|
+
}
|
|
247601
247670
|
async function performLocalBranch(sourceSessionId, userId, opts) {
|
|
247602
247671
|
const sourceRow = await fastify2.storage.agentSessions.getById(sourceSessionId);
|
|
247603
247672
|
const sourceProjection = sourceRow ? await projectLocalSessionIdentity(sourceRow) : void 0;
|
|
@@ -247633,7 +247702,8 @@ var routes11 = async (fastify2) => {
|
|
|
247633
247702
|
permissionMode: session?.permissionMode || "edit",
|
|
247634
247703
|
agentType: session?.agentType || "claude-code",
|
|
247635
247704
|
model: session?.model ?? null,
|
|
247636
|
-
title: dbRow?.title ?? null
|
|
247705
|
+
title: dbRow?.title ?? null,
|
|
247706
|
+
...session ? sendBackFields(session) : {}
|
|
247637
247707
|
},
|
|
247638
247708
|
messages
|
|
247639
247709
|
}
|
|
@@ -247721,7 +247791,8 @@ var routes11 = async (fastify2) => {
|
|
|
247721
247791
|
workspaceCheckoutId: session?.workspaceCheckoutId ?? null,
|
|
247722
247792
|
worktreePath: projection?.worktreePath ?? session?.checkoutPath ?? null,
|
|
247723
247793
|
checkoutDeletedAt: projection?.checkoutDeletedAt ?? null,
|
|
247724
|
-
processAlive: session ? fastify2.agentSessionManager.getSessionProcessAlive(sessionId) : false
|
|
247794
|
+
processAlive: session ? fastify2.agentSessionManager.getSessionProcessAlive(sessionId) : false,
|
|
247795
|
+
...session ? sendBackFields(session) : {}
|
|
247725
247796
|
},
|
|
247726
247797
|
messages: historyWindow ? historyWindow.entries.map((entry) => entry.message) : messages,
|
|
247727
247798
|
...historyWindow ? { historyWindow } : {}
|
|
@@ -247871,7 +247942,8 @@ var routes11 = async (fastify2) => {
|
|
|
247871
247942
|
model: active.model ?? null,
|
|
247872
247943
|
workspaceCheckoutId: active.workspaceCheckoutId,
|
|
247873
247944
|
worktreePath: active.checkoutPath,
|
|
247874
|
-
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(sessionId)
|
|
247945
|
+
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(sessionId),
|
|
247946
|
+
...sendBackFields(active)
|
|
247875
247947
|
},
|
|
247876
247948
|
messages: fastify2.agentSessionManager.getMessages(sessionId)
|
|
247877
247949
|
});
|
|
@@ -248195,7 +248267,7 @@ var routes11 = async (fastify2) => {
|
|
|
248195
248267
|
}
|
|
248196
248268
|
return reply.code(200).send({
|
|
248197
248269
|
session: {
|
|
248198
|
-
...remoteData.session,
|
|
248270
|
+
...await mapRemoteSendBackFields(agentMode, remoteData.session),
|
|
248199
248271
|
id: localSessionId,
|
|
248200
248272
|
projectId: req.params.projectId
|
|
248201
248273
|
},
|
|
@@ -248237,7 +248309,8 @@ var routes11 = async (fastify2) => {
|
|
|
248237
248309
|
permissionMode: session?.permissionMode || "edit",
|
|
248238
248310
|
agentType: session?.agentType || "claude-code",
|
|
248239
248311
|
model: session?.model ?? null,
|
|
248240
|
-
processAlive: session ? fastify2.agentSessionManager.getSessionProcessAlive(sessionId) : false
|
|
248312
|
+
processAlive: session ? fastify2.agentSessionManager.getSessionProcessAlive(sessionId) : false,
|
|
248313
|
+
...session ? sendBackFields(session) : {}
|
|
248241
248314
|
},
|
|
248242
248315
|
messages: historyWindow ? historyWindow.entries.map((entry) => entry.message) : messages,
|
|
248243
248316
|
...historyWindow ? { historyWindow } : {}
|
|
@@ -248374,7 +248447,7 @@ var routes11 = async (fastify2) => {
|
|
|
248374
248447
|
return reply.code(200).send({
|
|
248375
248448
|
...remoteData,
|
|
248376
248449
|
session: {
|
|
248377
|
-
...remoteData.session,
|
|
248450
|
+
...await mapRemoteSendBackFields(remoteInfo.remoteServerId, remoteData.session),
|
|
248378
248451
|
id: req.params.sessionId,
|
|
248379
248452
|
projectId: registered?.workspace.project_id ?? mapping?.project_id,
|
|
248380
248453
|
branch: registered ? registered.workspace.branch === "" ? null : registered.workspace.branch : mapping?.branch,
|
|
@@ -248419,7 +248492,8 @@ var routes11 = async (fastify2) => {
|
|
|
248419
248492
|
permissionMode: session.permissionMode,
|
|
248420
248493
|
agentType: session.agentType || "claude-code",
|
|
248421
248494
|
model: session.model ?? null,
|
|
248422
|
-
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(session.id)
|
|
248495
|
+
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(session.id),
|
|
248496
|
+
...sendBackFields(session)
|
|
248423
248497
|
},
|
|
248424
248498
|
messages
|
|
248425
248499
|
});
|
|
@@ -248450,7 +248524,7 @@ var routes11 = async (fastify2) => {
|
|
|
248450
248524
|
return reply.code(200).send({
|
|
248451
248525
|
...data,
|
|
248452
248526
|
session: data.session ? {
|
|
248453
|
-
...data.session,
|
|
248527
|
+
...await mapRemoteSendBackFields(remoteInfo.remoteServerId, data.session),
|
|
248454
248528
|
id: req.params.sessionId,
|
|
248455
248529
|
projectId: projectIdFromRemoteSessionId(req.params.sessionId, remoteInfo),
|
|
248456
248530
|
branch: remoteInfo.branch ?? null
|
|
@@ -248488,7 +248562,8 @@ var routes11 = async (fastify2) => {
|
|
|
248488
248562
|
permissionMode: session.permissionMode,
|
|
248489
248563
|
agentType: session.agentType,
|
|
248490
248564
|
model: session.model,
|
|
248491
|
-
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(session.id)
|
|
248565
|
+
processAlive: fastify2.agentSessionManager.getSessionProcessAlive(session.id),
|
|
248566
|
+
...sendBackFields(session)
|
|
248492
248567
|
}
|
|
248493
248568
|
});
|
|
248494
248569
|
});
|
|
@@ -250548,6 +250623,10 @@ function parseReviewSpan(raw) {
|
|
|
250548
250623
|
if (raw === void 0) return "this_turn";
|
|
250549
250624
|
return raw === "this_turn" || raw === "session_start" ? raw : null;
|
|
250550
250625
|
}
|
|
250626
|
+
function parseReviewContextMode(raw) {
|
|
250627
|
+
if (raw === void 0) return "briefed";
|
|
250628
|
+
return raw === "briefed" || raw === "blind" ? raw : null;
|
|
250629
|
+
}
|
|
250551
250630
|
function normalizeIntentBrief(raw) {
|
|
250552
250631
|
if (!raw?.trim()) return void 0;
|
|
250553
250632
|
return raw.length > 8e3 ? raw.slice(0, 8e3) + "\u2026" : raw;
|
|
@@ -250655,12 +250734,18 @@ async function routes20(fastify2) {
|
|
|
250655
250734
|
return reply.code(400).send({ error: "reviewerSessionId and reviewerAgentType are mutually exclusive" });
|
|
250656
250735
|
}
|
|
250657
250736
|
const reviewerSessionId = reviewerSessionIdRaw?.trim();
|
|
250737
|
+
const reviewContextMode = parseReviewContextMode(req.body?.reviewContextMode);
|
|
250738
|
+
if (reviewContextMode === null) return reply.code(400).send({ error: "reviewContextMode must be one of: briefed, blind" });
|
|
250739
|
+
const blind = reviewContextMode === "blind";
|
|
250740
|
+
if (blind && reviewerSessionId) {
|
|
250741
|
+
return reply.code(400).send({ error: "blind review requires a new reviewer session" });
|
|
250742
|
+
}
|
|
250658
250743
|
const intentBriefRaw = req.body?.intentBrief;
|
|
250659
250744
|
if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
|
|
250660
250745
|
return reply.code(400).send({ error: "intentBrief must be a string" });
|
|
250661
250746
|
}
|
|
250662
250747
|
const clientProvidedBrief = intentBriefRaw !== void 0;
|
|
250663
|
-
const clientBrief = normalizeIntentBrief(intentBriefRaw);
|
|
250748
|
+
const clientBrief = blind ? void 0 : normalizeIntentBrief(intentBriefRaw);
|
|
250664
250749
|
if (sourceSessionId.startsWith("remote-")) {
|
|
250665
250750
|
const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
|
|
250666
250751
|
if (!remoteInfo) return reply.code(404).send({ error: "Session not found" });
|
|
@@ -250683,7 +250768,7 @@ async function routes20(fastify2) {
|
|
|
250683
250768
|
bareReviewerSessionId = reviewerInfo.remoteSessionId;
|
|
250684
250769
|
}
|
|
250685
250770
|
let intentBrief2 = clientBrief;
|
|
250686
|
-
if (!clientProvidedBrief && !bareReviewerSessionId) {
|
|
250771
|
+
if (!clientProvidedBrief && !bareReviewerSessionId && !blind) {
|
|
250687
250772
|
intentBrief2 = await distillIntentBrief(userId, sourceSessionId);
|
|
250688
250773
|
}
|
|
250689
250774
|
if (reviewerSessionId && !await fastify2.remoteNotificationSync.prepareForNewTurn(reviewerSessionId)) {
|
|
@@ -250727,6 +250812,10 @@ async function routes20(fastify2) {
|
|
|
250727
250812
|
reviewFocus,
|
|
250728
250813
|
sourceTurnEndIndex,
|
|
250729
250814
|
reviewSpan,
|
|
250815
|
+
// Additive tunnel field: a worker that predates it ignores the flag
|
|
250816
|
+
// and runs a briefed (tier-2) review — the reviewer prompt's
|
|
250817
|
+
// trailing "(review context: …)" line records what actually ran.
|
|
250818
|
+
reviewContextMode,
|
|
250730
250819
|
reviewerAgentType: reviewerAgentType ?? "claude-code",
|
|
250731
250820
|
intentBrief: intentBrief2,
|
|
250732
250821
|
userId
|
|
@@ -250827,7 +250916,7 @@ async function routes20(fastify2) {
|
|
|
250827
250916
|
return reply.code(400).send({ error: "branch does not match source session" });
|
|
250828
250917
|
}
|
|
250829
250918
|
let intentBrief = clientBrief;
|
|
250830
|
-
if (!clientProvidedBrief && !reviewerSessionId) {
|
|
250919
|
+
if (!clientProvidedBrief && !reviewerSessionId && !blind) {
|
|
250831
250920
|
intentBrief = await distillIntentBrief(userId, sourceSessionId);
|
|
250832
250921
|
}
|
|
250833
250922
|
try {
|
|
@@ -250840,7 +250929,8 @@ async function routes20(fastify2) {
|
|
|
250840
250929
|
reviewSpan,
|
|
250841
250930
|
reviewerAgentType,
|
|
250842
250931
|
reviewerSessionId,
|
|
250843
|
-
intentBrief
|
|
250932
|
+
intentBrief,
|
|
250933
|
+
blind
|
|
250844
250934
|
});
|
|
250845
250935
|
return reply.code(201).send({ run: run2 });
|
|
250846
250936
|
} catch (err) {
|
|
@@ -251057,11 +251147,14 @@ async function routes20(fastify2) {
|
|
|
251057
251147
|
if (!sourceSessionId) return reply.code(400).send({ error: "sourceSessionId is required" });
|
|
251058
251148
|
const reviewSpan = parseReviewSpan(req.body?.reviewSpan);
|
|
251059
251149
|
if (reviewSpan === null) return reply.code(400).send({ error: "reviewSpan must be one of: this_turn, session_start" });
|
|
251150
|
+
const reviewContextMode = parseReviewContextMode(req.body?.reviewContextMode);
|
|
251151
|
+
if (reviewContextMode === null) return reply.code(400).send({ error: "reviewContextMode must be one of: briefed, blind" });
|
|
251152
|
+
const blind = reviewContextMode === "blind";
|
|
251060
251153
|
const intentBriefRaw = req.body?.intentBrief;
|
|
251061
251154
|
if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
|
|
251062
251155
|
return reply.code(400).send({ error: "intentBrief must be a string" });
|
|
251063
251156
|
}
|
|
251064
|
-
const intentBrief = normalizeIntentBrief(intentBriefRaw);
|
|
251157
|
+
const intentBrief = blind ? void 0 : normalizeIntentBrief(intentBriefRaw);
|
|
251065
251158
|
const reviewerAgentType = parseReviewerAgentType(req.body?.reviewerAgentType);
|
|
251066
251159
|
if (reviewerAgentType === null) return reply.code(400).send({ error: "reviewerAgentType must be one of: claude-code, codex" });
|
|
251067
251160
|
const reviewerSessionIdRaw = req.body?.reviewerSessionId;
|
|
@@ -251099,6 +251192,7 @@ async function routes20(fastify2) {
|
|
|
251099
251192
|
reviewerAgentType,
|
|
251100
251193
|
reviewerSessionId,
|
|
251101
251194
|
intentBrief,
|
|
251195
|
+
blind,
|
|
251102
251196
|
runId: runId || void 0,
|
|
251103
251197
|
newReviewerSessionId: newReviewerSessionId || void 0
|
|
251104
251198
|
});
|
|
@@ -252185,6 +252279,12 @@ var routes23 = async (fastify2) => {
|
|
|
252185
252279
|
}));
|
|
252186
252280
|
} catch {
|
|
252187
252281
|
}
|
|
252282
|
+
if (cacheEntry.backgroundTasks !== null) {
|
|
252283
|
+
try {
|
|
252284
|
+
socket.send(cacheEntry.backgroundTasks);
|
|
252285
|
+
} catch {
|
|
252286
|
+
}
|
|
252287
|
+
}
|
|
252188
252288
|
for (const raw of cacheEntry.messages) {
|
|
252189
252289
|
if (replayAfter >= 0) {
|
|
252190
252290
|
try {
|
|
@@ -252208,12 +252308,6 @@ var routes23 = async (fastify2) => {
|
|
|
252208
252308
|
socket.send(JSON.stringify({ Ready: true, historyEpoch: cacheEntry.historyEpoch ?? void 0 }));
|
|
252209
252309
|
} catch {
|
|
252210
252310
|
}
|
|
252211
|
-
if (cacheEntry.backgroundTasks !== null) {
|
|
252212
|
-
try {
|
|
252213
|
-
socket.send(cacheEntry.backgroundTasks);
|
|
252214
|
-
} catch {
|
|
252215
|
-
}
|
|
252216
|
-
}
|
|
252217
252311
|
if (cacheEntry.finished) {
|
|
252218
252312
|
try {
|
|
252219
252313
|
socket.send(JSON.stringify({ finished: true }));
|