@vibedeckx/linux-x64 0.2.7 → 0.2.9

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.
Files changed (2) hide show
  1. package/dist/bin.js +231 -20
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -223742,17 +223742,13 @@ async function generateSessionTitleWithModel(model, userMessage, options = {}) {
223742
223742
  }
223743
223743
  } : void 0;
223744
223744
  try {
223745
- const result = await Promise.race([
223746
- generateText({
223747
- model,
223748
- system: SYSTEM_PROMPT,
223749
- prompt: buildPrompt(userMessage),
223750
- experimental_telemetry: telemetry
223751
- }),
223752
- new Promise(
223753
- (_3, reject) => setTimeout(() => reject(new Error("title generation timed out")), AI_TIMEOUT_MS)
223754
- )
223755
- ]);
223745
+ const result = await generateText({
223746
+ model,
223747
+ system: SYSTEM_PROMPT,
223748
+ prompt: buildPrompt(userMessage),
223749
+ timeout: AI_TIMEOUT_MS,
223750
+ experimental_telemetry: telemetry
223751
+ });
223756
223752
  const text2 = result.text ?? "";
223757
223753
  const sanitized = sanitizeTitle(text2);
223758
223754
  return sanitized.length > 0 ? sanitized : null;
@@ -228722,6 +228718,18 @@ var WorkflowError = class extends Error {
228722
228718
  }
228723
228719
  code;
228724
228720
  };
228721
+ var MAX_CONTEXT_CHARS = 2e3;
228722
+ var MAX_SELF_REPORT_CHARS = 4e3;
228723
+ var SELF_REPORT_MIN_CHARS = 80;
228724
+ function cap(text2, max) {
228725
+ return text2.length > max ? text2.slice(0, max) + "\u2026" : text2;
228726
+ }
228727
+ function userTextOf(e) {
228728
+ if (e.type !== "user") return null;
228729
+ if (typeof e.content === "string") return e.content;
228730
+ const text2 = e.content.filter((p2) => p2.type === "text").map((p2) => p2.text).join("\n");
228731
+ return text2 || null;
228732
+ }
228725
228733
  function extractLatestTurnEndIndex(entries) {
228726
228734
  for (let i = entries.length - 1; i >= 0; i--) {
228727
228735
  if (entries[i]?.type === "turn_end") return i;
@@ -228745,21 +228753,64 @@ function extractTaskContextBefore(entries, turnEndIndex) {
228745
228753
  }
228746
228754
  return null;
228747
228755
  }
228756
+ function extractFirstUserMessage(entries) {
228757
+ for (let i = 0; i < entries.length; i++) {
228758
+ const e = entries[i];
228759
+ if (e?.type !== "user" || e.event) continue;
228760
+ const text2 = userTextOf(e)?.trim();
228761
+ if (text2) return cap(text2, MAX_CONTEXT_CHARS);
228762
+ }
228763
+ return null;
228764
+ }
228765
+ function extractAuthorSelfReport(entries, beforeIndex, opts) {
228766
+ let fallback = null;
228767
+ for (let i = beforeIndex - 1; i >= 0; i--) {
228768
+ const e = entries[i];
228769
+ if (e?.type === "user" && opts?.withinTurn) break;
228770
+ if (e?.type !== "assistant" || typeof e.content !== "string") continue;
228771
+ const text2 = e.content.trim();
228772
+ if (!text2) continue;
228773
+ if (text2.length >= SELF_REPORT_MIN_CHARS) return cap(text2, MAX_SELF_REPORT_CHARS);
228774
+ if (fallback === null) fallback = text2;
228775
+ }
228776
+ return fallback;
228777
+ }
228778
+ function selfReportSection(report) {
228779
+ if (!report) return null;
228780
+ return [
228781
+ "\n## Author's self-report (unverified)",
228782
+ "The implementing agent described its own work as follows. Treat every claim as unverified \u2014 check each one against the actual code, and look for problems the self-report does not mention.",
228783
+ "<author-self-report>",
228784
+ report,
228785
+ "</author-self-report>"
228786
+ ].join("\n");
228787
+ }
228748
228788
  function buildReviewerPrompt(opts) {
228789
+ const intent = opts.originalIntent !== opts.taskContext ? opts.originalIntent : null;
228790
+ const brief = opts.intentBrief || null;
228791
+ const hasExcerpt = Boolean(intent || opts.taskContext || opts.authorSelfReport);
228749
228792
  return [
228750
228793
  "You are a code reviewer agent. Another agent just completed work in this workspace; review it critically and independently.",
228794
+ brief ? `
228795
+ ## Intent brief (distilled from the source conversation)
228796
+ ${brief}` : null,
228797
+ !brief && intent ? `
228798
+ ## Original request (the user's first message in this session, verbatim)
228799
+ ${intent}` : null,
228751
228800
  opts.taskContext ? `
228752
228801
  ## Original task
228753
228802
  ${opts.taskContext}` : null,
228803
+ selfReportSection(opts.authorSelfReport),
228754
228804
  opts.reviewFocus ? `
228755
228805
  ## Review focus (from the user)
228756
228806
  ${opts.reviewFocus}` : null,
228757
228807
  "\n## How to review",
228758
228808
  "- Do NOT modify any files \u2014 you are in read-only review mode.",
228759
228809
  "- Inspect the actual workspace state yourself: read the relevant files, run `git diff`, `git status` and `git log`.",
228760
- opts.target.baseHead ? `- The work was captured at commit ${opts.target.baseHead}${opts.target.diffStat ? ` with uncommitted changes (${opts.target.diffStat})` : " with no uncommitted changes"}.` : null,
228810
+ reviewTargetPromptLine(opts.target),
228761
228811
  "- Judge correctness, completeness against the task, and code quality. Be specific: reference files and lines.",
228762
- "\nEnd your final message with a clear, actionable list of feedback items \u2014 or state explicitly that the work looks good."
228812
+ "\nEnd your final message with a clear, actionable list of feedback items \u2014 or state explicitly that the work looks good.",
228813
+ 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)"
228763
228814
  ].filter((l) => l !== null).join("\n");
228764
228815
  }
228765
228816
  function reviewTargetPromptLine(target) {
@@ -228772,11 +228823,13 @@ function buildRereviewerPrompt(opts) {
228772
228823
  opts.taskContext ? `
228773
228824
  ## Latest source turn
228774
228825
  ${opts.taskContext}` : null,
228826
+ selfReportSection(opts.authorSelfReport),
228775
228827
  opts.reviewFocus ? `
228776
228828
  ## Review focus
228777
228829
  ${opts.reviewFocus}` : null,
228778
228830
  "\n## How to review",
228779
228831
  "- Verify whether your previous feedback was addressed correctly.",
228832
+ "- Treat the changed areas as new code: look for bugs the fix itself may have introduced, not only whether your old items were closed.",
228780
228833
  "- Check for regressions and remaining correctness or test gaps.",
228781
228834
  "- Do NOT modify files \u2014 remain in read-only review mode.",
228782
228835
  reviewTargetPromptLine(opts.target),
@@ -228968,6 +229021,9 @@ var WorkflowEngine = class {
228968
229021
  }
228969
229022
  const prompt = buildRereviewerPrompt({
228970
229023
  taskContext: extractTaskContextBefore(entries, turnEndIndex),
229024
+ // Scoped to the fix turn: an older turn's summary would describe the
229025
+ // pre-review state and mislead the acceptance pass.
229026
+ authorSelfReport: extractAuthorSelfReport(entries, turnEndIndex, { withinTurn: true }),
228971
229027
  reviewFocus: opts.reviewFocus ?? null,
228972
229028
  target
228973
229029
  });
@@ -228996,6 +229052,9 @@ var WorkflowEngine = class {
228996
229052
  ).catch((err) => console.warn(`[WorkflowEngine] failed to set reviewer title for ${reviewerId}:`, err));
228997
229053
  const prompt = buildReviewerPrompt({
228998
229054
  taskContext,
229055
+ originalIntent: extractFirstUserMessage(entries),
229056
+ authorSelfReport: extractAuthorSelfReport(entries, turnEndIndex),
229057
+ intentBrief: opts.intentBrief ?? null,
228999
229058
  reviewFocus: opts.reviewFocus ?? null,
229000
229059
  target
229001
229060
  });
@@ -236053,10 +236112,95 @@ var command_routes_default = (0, import_fastify_plugin18.default)(routes17, { na
236053
236112
 
236054
236113
  // src/routes/workflow-run-routes.ts
236055
236114
  var import_fastify_plugin19 = __toESM(require_plugin2(), 1);
236115
+
236116
+ // src/utils/review-brief.ts
236117
+ var AI_TIMEOUT_MS2 = 15e3;
236118
+ var PER_MESSAGE_MAX_CHARS = 1500;
236119
+ var TOTAL_INPUT_MAX_CHARS = 24e3;
236120
+ var HEAD_CHARS = 8e3;
236121
+ var TAIL_CHARS = 15e3;
236122
+ var BRIEF_MAX_CHARS = 4e3;
236123
+ var SYSTEM_PROMPT2 = [
236124
+ "You distill a coding-agent conversation into an intent brief for an independent code reviewer.",
236125
+ "The reviewer will NOT see the conversation \u2014 only your brief plus the actual code, so capture what the code alone cannot show:",
236126
+ "1. The original request and its goal.",
236127
+ "2. Constraints and explicit user decisions, including approaches the user rejected.",
236128
+ "3. The intended scope of the changes.",
236129
+ "4. Trade-offs or limitations that were acknowledged and accepted.",
236130
+ "Do NOT include the agent's reasoning, self-assessment, or claims that the work is correct or complete \u2014 the reviewer must judge that independently.",
236131
+ "Write concise markdown bullets under those numbered headings, under 400 words total, in the same language as the conversation. Reply with the brief only."
236132
+ ].join("\n");
236133
+ function capText(text2, max) {
236134
+ return text2.length > max ? text2.slice(0, max) + "\u2026" : text2;
236135
+ }
236136
+ function serializeConversationForBrief(messages) {
236137
+ const lines = [];
236138
+ for (const msg of messages) {
236139
+ if (!msg) continue;
236140
+ if (msg.type === "user" && !msg.event) {
236141
+ const text2 = extractUserText(msg.content).trim();
236142
+ if (text2) lines.push(`User: ${capText(text2, PER_MESSAGE_MAX_CHARS)}`);
236143
+ } else if (msg.type === "assistant" && typeof msg.content === "string") {
236144
+ const text2 = msg.content.trim();
236145
+ if (text2) lines.push(`Agent: ${capText(text2, PER_MESSAGE_MAX_CHARS)}`);
236146
+ }
236147
+ }
236148
+ const full = lines.join("\n\n");
236149
+ if (full.length <= TOTAL_INPUT_MAX_CHARS) return full;
236150
+ return `${full.slice(0, HEAD_CHARS)}
236151
+
236152
+ [\u2026 middle of the conversation omitted \u2026]
236153
+
236154
+ ${full.slice(-TAIL_CHARS)}`;
236155
+ }
236156
+ async function generateIntentBriefWithModel(model, conversation, options = {}) {
236157
+ if (conversation.trim().length === 0) return null;
236158
+ const telemetry = options.userId ? {
236159
+ isEnabled: true,
236160
+ functionId: "review-intent-brief",
236161
+ metadata: {
236162
+ userId: options.userId,
236163
+ tags: ["vibedeckx", "review-intent-brief"]
236164
+ }
236165
+ } : void 0;
236166
+ try {
236167
+ const result = await generateText({
236168
+ model,
236169
+ system: SYSTEM_PROMPT2,
236170
+ prompt: `Distill this conversation into an intent brief:
236171
+
236172
+ ${conversation}`,
236173
+ timeout: AI_TIMEOUT_MS2,
236174
+ experimental_telemetry: telemetry
236175
+ });
236176
+ const text2 = (result.text ?? "").trim();
236177
+ return text2.length > 0 ? capText(text2, BRIEF_MAX_CHARS) : null;
236178
+ } catch (error48) {
236179
+ console.warn("[ReviewBrief] AI generation failed:", error48.message);
236180
+ return null;
236181
+ }
236182
+ }
236183
+ async function generateIntentBrief(storage, userId, messages) {
236184
+ try {
236185
+ if (!await isChatModelConfigured(storage, userId)) return null;
236186
+ const conversation = serializeConversationForBrief(messages);
236187
+ if (!conversation) return null;
236188
+ return await generateIntentBriefWithModel(await resolveFastChatModel(storage, userId), conversation, { userId });
236189
+ } catch (error48) {
236190
+ console.warn("[ReviewBrief] generation failed:", error48.message);
236191
+ return null;
236192
+ }
236193
+ }
236194
+
236195
+ // src/routes/workflow-run-routes.ts
236056
236196
  function parseReviewerAgentType(raw) {
236057
236197
  if (raw === void 0) return void 0;
236058
236198
  return typeof raw === "string" && REVIEWER_AGENT_TYPES.has(raw) ? raw : null;
236059
236199
  }
236200
+ function normalizeIntentBrief(raw) {
236201
+ if (!raw?.trim()) return void 0;
236202
+ return raw.length > 8e3 ? raw.slice(0, 8e3) + "\u2026" : raw;
236203
+ }
236060
236204
  function errStatus(err) {
236061
236205
  if (!(err instanceof WorkflowError)) return null;
236062
236206
  switch (err.code) {
@@ -236098,6 +236242,28 @@ async function routes18(fastify2) {
236098
236242
  if (!project) return null;
236099
236243
  return info;
236100
236244
  };
236245
+ const distillIntentBrief = async (userId, sourceSessionId) => {
236246
+ try {
236247
+ let messages;
236248
+ if (sourceSessionId.startsWith("remote-")) {
236249
+ const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236250
+ if (!remoteInfo) return void 0;
236251
+ const historyResult = await proxyAuto(
236252
+ remoteInfo,
236253
+ "GET",
236254
+ `/api/agent-sessions/${remoteInfo.remoteSessionId}`
236255
+ );
236256
+ if (!historyResult.ok) return void 0;
236257
+ messages = historyResult.data.messages ?? [];
236258
+ } else {
236259
+ messages = fastify2.agentSessionManager.getMessages(sourceSessionId);
236260
+ }
236261
+ return await generateIntentBrief(fastify2.storage, resolveUserId(userId), messages) ?? void 0;
236262
+ } catch (err) {
236263
+ console.warn("[WorkflowRuns] intent brief generation failed:", err);
236264
+ return void 0;
236265
+ }
236266
+ };
236101
236267
  fastify2.post("/api/workflow-runs", async (req, reply) => {
236102
236268
  const userId = requireAuth(req, reply);
236103
236269
  if (userId === null) return;
@@ -236113,6 +236279,12 @@ async function routes18(fastify2) {
236113
236279
  return reply.code(400).send({ error: "reviewerSessionId and reviewerAgentType are mutually exclusive" });
236114
236280
  }
236115
236281
  const reviewerSessionId = reviewerSessionIdRaw?.trim();
236282
+ const intentBriefRaw = req.body?.intentBrief;
236283
+ if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
236284
+ return reply.code(400).send({ error: "intentBrief must be a string" });
236285
+ }
236286
+ const clientProvidedBrief = intentBriefRaw !== void 0;
236287
+ const clientBrief = normalizeIntentBrief(intentBriefRaw);
236116
236288
  if (sourceSessionId.startsWith("remote-")) {
236117
236289
  const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236118
236290
  if (!remoteInfo) return reply.code(404).send({ error: "Session not found" });
@@ -236128,12 +236300,17 @@ async function routes18(fastify2) {
236128
236300
  }
236129
236301
  bareReviewerSessionId = reviewerInfo.remoteSessionId;
236130
236302
  }
236303
+ let intentBrief2 = clientBrief;
236304
+ if (!clientProvidedBrief && !bareReviewerSessionId) {
236305
+ intentBrief2 = await distillIntentBrief(userId, sourceSessionId);
236306
+ }
236131
236307
  const result = await proxyAuto(remoteInfo, "POST", "/api/path/workflow-runs", {
236132
236308
  sourceSessionId: remoteInfo.remoteSessionId,
236133
236309
  reviewFocus,
236134
236310
  sourceTurnEndIndex,
236135
236311
  reviewerAgentType,
236136
- reviewerSessionId: bareReviewerSessionId
236312
+ reviewerSessionId: bareReviewerSessionId,
236313
+ intentBrief: intentBrief2
236137
236314
  });
236138
236315
  if (!result.ok) return sendProxyFailure(reply, result);
236139
236316
  const bareRun = result.data.run;
@@ -236199,6 +236376,10 @@ async function routes18(fastify2) {
236199
236376
  if (branch !== void 0 && (branch || null) !== runBranch) {
236200
236377
  return reply.code(400).send({ error: "branch does not match source session" });
236201
236378
  }
236379
+ let intentBrief = clientBrief;
236380
+ if (!clientProvidedBrief && !reviewerSessionId) {
236381
+ intentBrief = await distillIntentBrief(userId, sourceSessionId);
236382
+ }
236202
236383
  try {
236203
236384
  const run2 = await fastify2.workflowEngine.startAdhocReview({
236204
236385
  project: { id: project.id, path: project.path },
@@ -236207,7 +236388,8 @@ async function routes18(fastify2) {
236207
236388
  reviewFocus,
236208
236389
  sourceTurnEndIndex,
236209
236390
  reviewerAgentType,
236210
- reviewerSessionId
236391
+ reviewerSessionId,
236392
+ intentBrief
236211
236393
  });
236212
236394
  return reply.code(201).send({ run: run2 });
236213
236395
  } catch (err) {
@@ -236216,6 +236398,29 @@ async function routes18(fastify2) {
236216
236398
  throw err;
236217
236399
  }
236218
236400
  });
236401
+ fastify2.post("/api/workflow-runs/intent-brief", async (req, reply) => {
236402
+ const userId = requireAuth(req, reply);
236403
+ if (userId === null) return;
236404
+ const { projectId, sourceSessionId } = req.body ?? {};
236405
+ if (!projectId || !sourceSessionId) {
236406
+ return reply.code(400).send({ error: "projectId and sourceSessionId are required" });
236407
+ }
236408
+ const project = await fastify2.storage.projects.getById(projectId, userId);
236409
+ if (!project) return reply.code(404).send({ error: "Project not found" });
236410
+ if (sourceSessionId.startsWith("remote-")) {
236411
+ const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236412
+ if (!remoteInfo || projectIdFromRemoteSessionId(sourceSessionId, remoteInfo) !== projectId) {
236413
+ return reply.code(404).send({ error: "Session not found" });
236414
+ }
236415
+ } else {
236416
+ const session = await fastify2.storage.agentSessions.getById(sourceSessionId);
236417
+ if (!session || session.project_id !== projectId) {
236418
+ return reply.code(404).send({ error: "Session not found" });
236419
+ }
236420
+ }
236421
+ const brief = await distillIntentBrief(userId, sourceSessionId);
236422
+ return reply.send({ brief: brief ?? null });
236423
+ });
236219
236424
  fastify2.get("/api/workflow-runs/reviewer-candidate", async (req, reply) => {
236220
236425
  const userId = requireAuth(req, reply);
236221
236426
  if (userId === null) return;
@@ -236253,7 +236458,7 @@ async function routes18(fastify2) {
236253
236458
  projectId,
236254
236459
  remoteInfo.remoteServerId,
236255
236460
  bareCandidate.sessionId,
236256
- remoteInfo.branch
236461
+ remoteInfo.branch ?? null
236257
236462
  );
236258
236463
  }
236259
236464
  return reply.send({ candidate: candidate2 });
@@ -236385,6 +236590,11 @@ async function routes18(fastify2) {
236385
236590
  if (userId === null) return;
236386
236591
  const { sourceSessionId, reviewFocus, sourceTurnEndIndex } = req.body ?? {};
236387
236592
  if (!sourceSessionId) return reply.code(400).send({ error: "sourceSessionId is required" });
236593
+ const intentBriefRaw = req.body?.intentBrief;
236594
+ if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
236595
+ return reply.code(400).send({ error: "intentBrief must be a string" });
236596
+ }
236597
+ const intentBrief = normalizeIntentBrief(intentBriefRaw);
236388
236598
  const reviewerAgentType = parseReviewerAgentType(req.body?.reviewerAgentType);
236389
236599
  if (reviewerAgentType === null) return reply.code(400).send({ error: "reviewerAgentType must be one of: claude-code, codex" });
236390
236600
  const reviewerSessionIdRaw = req.body?.reviewerSessionId;
@@ -236408,7 +236618,8 @@ async function routes18(fastify2) {
236408
236618
  reviewFocus,
236409
236619
  sourceTurnEndIndex,
236410
236620
  reviewerAgentType,
236411
- reviewerSessionId
236621
+ reviewerSessionId,
236622
+ intentBrief
236412
236623
  });
236413
236624
  return reply.code(201).send({ run: run2 });
236414
236625
  } catch (err) {
@@ -238737,10 +238948,10 @@ var routes27 = async (fastify2) => {
238737
238948
  if (offset >= stat2.size) {
238738
238949
  return reply.send({ content: "", truncated: false, size: stat2.size });
238739
238950
  }
238740
- const cap = Math.min(limit, MAX_OUTPUT_BYTES);
238951
+ const cap2 = Math.min(limit, MAX_OUTPUT_BYTES);
238741
238952
  handle = await fs3.open(filePath, "r");
238742
- const buffer = Buffer.alloc(cap);
238743
- const { bytesRead } = await handle.read(buffer, 0, cap, offset);
238953
+ const buffer = Buffer.alloc(cap2);
238954
+ const { bytesRead } = await handle.read(buffer, 0, cap2, offset);
238744
238955
  return reply.send({
238745
238956
  content: buffer.subarray(0, bytesRead).toString("utf8"),
238746
238957
  truncated: offset + bytesRead < stat2.size,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedeckx/linux-x64",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Vibedeckx platform binaries for Linux x64",
5
5
  "os": [
6
6
  "linux"