@vibedeckx/linux-x64 0.2.8 → 0.2.10

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 +98 -62
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -224279,7 +224279,7 @@ var AgentSessionManager = class {
224279
224279
  * 2. skipDb fallback (remote path-based pseudo-projects): scan `this.sessions`.
224280
224280
  * 3. No match anywhere → null.
224281
224281
  */
224282
- async findExistingSession(projectId, branch, projectPath, skipDb = false, permissionMode = "edit") {
224282
+ async findExistingSession(projectId, branch, projectPath, skipDb = false) {
224283
224283
  console.log(`[findExisting] ENTER projectId=${projectId} branch=${branch ?? "<null>"} skipDb=${skipDb} sessionsMapSize=${this.sessions.size}`);
224284
224284
  if (!skipDb) {
224285
224285
  const latestDbRow = await this.storage.agentSessions.getLatestByBranch(
@@ -224290,7 +224290,7 @@ var AgentSessionManager = class {
224290
224290
  if (latestDbRow) {
224291
224291
  const inMemory = this.sessions.get(latestDbRow.id);
224292
224292
  if (inMemory) {
224293
- return this.reuseExistingSession(inMemory, projectPath, permissionMode);
224293
+ return this.reuseExistingSession(inMemory, projectPath);
224294
224294
  }
224295
224295
  }
224296
224296
  return null;
@@ -224298,7 +224298,7 @@ var AgentSessionManager = class {
224298
224298
  for (const session of this.sessions.values()) {
224299
224299
  if (session.projectId === projectId && session.branch === branch) {
224300
224300
  console.log(`[findExisting] skipDb in-memory match: ${session.id} (entries=${session.store.entries.filter(Boolean).length})`);
224301
- return this.reuseExistingSession(session, projectPath, permissionMode);
224301
+ return this.reuseExistingSession(session, projectPath);
224302
224302
  }
224303
224303
  }
224304
224304
  return null;
@@ -224365,33 +224365,28 @@ var AgentSessionManager = class {
224365
224365
  }
224366
224366
  /**
224367
224367
  * Handle reuse of an existing in-memory session found by findExistingSession:
224368
- * - dormant: update permission mode if differs (no respawn wakes lazily)
224368
+ * - dormant: return as-is (wakes lazily on next message)
224369
224369
  * - running OR process alive (stream-json between-turns: status="stopped"
224370
- * but the CLI is still waiting on stdin): switchMode if mode differs,
224371
- * leave entries intact
224370
+ * but the CLI is still waiting on stdin): return as-is, entries intact
224372
224371
  * - process actually dead: restart the process so callers always get a
224373
224372
  * running session
224374
224373
  * Returns the session id.
224374
+ *
224375
+ * Deliberately does NOT touch the session's permission mode: this sits on
224376
+ * the load path (workspace auto-start), so coercing mode here would let a
224377
+ * read silently kill/respawn the process and flip a workflow reviewer out
224378
+ * of read-only plan mode. Mode changes only happen through the explicit
224379
+ * switch-mode route, which carries actual user intent.
224375
224380
  */
224376
- async reuseExistingSession(session, projectPath, permissionMode) {
224381
+ async reuseExistingSession(session, projectPath) {
224377
224382
  const entriesCount = session.store.entries.filter(Boolean).length;
224378
224383
  this.touchSession(session);
224379
224384
  if (session.dormant) {
224380
- if (session.permissionMode !== permissionMode) {
224381
- session.permissionMode = permissionMode;
224382
- if (!session.skipDb) {
224383
- await this.storage.agentSessions.updatePermissionMode(session.id, permissionMode);
224384
- }
224385
- }
224386
224385
  console.log(`[AgentSession] Returning dormant session ${session.id} (entries=${entriesCount})`);
224387
224386
  return session.id;
224388
224387
  }
224389
224388
  const processAlive = session.process != null && session.process.exitCode === null;
224390
224389
  if (session.status === "running" || processAlive) {
224391
- if (session.permissionMode !== permissionMode) {
224392
- console.log(`[AgentSession] Session ${session.id} exists with mode ${session.permissionMode}, switching to ${permissionMode}`);
224393
- await this.switchMode(session.id, projectPath, permissionMode);
224394
- }
224395
224390
  console.log(`[AgentSession] Returning existing session ${session.id} (status=${session.status}, processAlive=${processAlive}, entries=${entriesCount})`);
224396
224391
  return session.id;
224397
224392
  }
@@ -224995,7 +224990,7 @@ ${details}`;
224995
224990
  /**
224996
224991
  * Send a user message to the agent
224997
224992
  */
224998
- async sendUserMessage(sessionId, content, projectPath, userId = "local") {
224993
+ async sendUserMessage(sessionId, content, projectPath, userId = "local", opts) {
224999
224994
  const session = this.sessions.get(sessionId);
225000
224995
  if (!session) return false;
225001
224996
  if (session.dormant) {
@@ -225003,7 +224998,7 @@ ${details}`;
225003
224998
  console.error(`[AgentSession] Cannot wake dormant session ${sessionId} without projectPath`);
225004
224999
  return false;
225005
225000
  }
225006
- await this.wakeDormantSession(session, projectPath, content, userId);
225001
+ await this.wakeDormantSession(session, projectPath, content, userId, opts?.origin);
225007
225002
  return true;
225008
225003
  }
225009
225004
  if (!session.process?.stdin) {
@@ -225022,7 +225017,8 @@ ${details}`;
225022
225017
  await this.pushEntry(sessionId, {
225023
225018
  type: "user",
225024
225019
  content,
225025
- timestamp: Date.now()
225020
+ timestamp: Date.now(),
225021
+ ...opts?.origin ? { origin: opts.origin } : {}
225026
225022
  }, true, userId);
225027
225023
  try {
225028
225024
  const provider = getProvider(session.agentType);
@@ -225368,6 +225364,9 @@ ${details}`;
225368
225364
  if (!session.skipDb) {
225369
225365
  await this.storage.agentSessions.updatePermissionMode(session.id, newMode);
225370
225366
  }
225367
+ const provider = getProvider(session.agentType);
225368
+ provider.onSessionDestroyed?.(session.id);
225369
+ provider.onSessionCreated?.(session.id, newMode);
225371
225370
  session.status = "running";
225372
225371
  if (!session.skipDb) await this.storage.agentSessions.updateStatus(sessionId, "running");
225373
225372
  this.broadcastPatch(sessionId, ConversationPatch.updateStatus("running"));
@@ -225388,8 +225387,8 @@ ${details}`;
225388
225387
  const context2 = this.buildFullConversationContext(session.store.entries);
225389
225388
  if (context2) {
225390
225389
  setTimeout(() => {
225391
- const provider = getProvider(session.agentType);
225392
- const formatted = provider.formatUserInput(context2, session.id);
225390
+ const provider2 = getProvider(session.agentType);
225391
+ const formatted = provider2.formatUserInput(context2, session.id);
225393
225392
  try {
225394
225393
  session.process?.stdin?.write(formatted);
225395
225394
  } catch (error48) {
@@ -225462,7 +225461,7 @@ ${details}`;
225462
225461
  /**
225463
225462
  * Wake a dormant session: spawn process, send full context + user message
225464
225463
  */
225465
- async wakeDormantSession(session, projectPath, userMessage, userId = "local") {
225464
+ async wakeDormantSession(session, projectPath, userMessage, userId = "local", origin) {
225466
225465
  console.log(`[AgentSession] Waking dormant session ${session.id}`);
225467
225466
  await this.ensureResidentCapacity(
225468
225467
  { projectId: session.projectId, branch: session.branch },
@@ -225482,7 +225481,8 @@ ${details}`;
225482
225481
  await this.pushEntry(session.id, {
225483
225482
  type: "user",
225484
225483
  content: userMessage,
225485
- timestamp: Date.now()
225484
+ timestamp: Date.now(),
225485
+ ...origin ? { origin } : {}
225486
225486
  }, true, userId);
225487
225487
  session.turnOpenSince = Date.now();
225488
225488
  setTimeout(() => {
@@ -228797,10 +228797,13 @@ ${brief}` : null,
228797
228797
  !brief && intent ? `
228798
228798
  ## Original request (the user's first message in this session, verbatim)
228799
228799
  ${intent}` : null,
228800
- opts.taskContext ? `
228801
- ## Original task
228800
+ // Deliberately not titled "Original task": in confirmation-style
228801
+ // conversations the latest message is often just "ok" — informative as
228802
+ // the user's last word, misleading as a statement of the task.
228803
+ !brief && opts.taskContext ? `
228804
+ ## Latest user message (verbatim)
228802
228805
  ${opts.taskContext}` : null,
228803
- brief ? null : selfReportSection(opts.authorSelfReport),
228806
+ selfReportSection(opts.authorSelfReport),
228804
228807
  opts.reviewFocus ? `
228805
228808
  ## Review focus (from the user)
228806
228809
  ${opts.reviewFocus}` : null,
@@ -228810,7 +228813,7 @@ ${opts.reviewFocus}` : null,
228810
228813
  reviewTargetPromptLine(opts.target),
228811
228814
  "- Judge correctness, completeness against the task, and code quality. Be specific: reference files and lines.",
228812
228815
  "\nEnd your final message with a clear, actionable list of feedback items \u2014 or state explicitly that the work looks good.",
228813
- brief ? "\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)"
228816
+ 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)"
228814
228817
  ].filter((l) => l !== null).join("\n");
228815
228818
  }
228816
228819
  function reviewTargetPromptLine(target) {
@@ -229027,7 +229030,7 @@ var WorkflowEngine = class {
229027
229030
  reviewFocus: opts.reviewFocus ?? null,
229028
229031
  target
229029
229032
  });
229030
- const sent = await this.agentOps.sendUserMessage(opts.reviewerSessionId, prompt, opts.project.path).catch(() => false);
229033
+ const sent = await this.agentOps.sendUserMessage(opts.reviewerSessionId, prompt, opts.project.path, void 0, { origin: "workflow" }).catch(() => false);
229031
229034
  if (!sent) {
229032
229035
  await this.failRun(run2, "\u5411\u4E0A\u6B21 reviewer \u6295\u9012\u590D\u5BA1\u4EFB\u52A1\u5931\u8D25");
229033
229036
  throw new WorkflowError("send-failed", "\u5411\u4E0A\u6B21 reviewer \u6295\u9012\u590D\u5BA1\u4EFB\u52A1\u5931\u8D25");
@@ -229058,7 +229061,7 @@ var WorkflowEngine = class {
229058
229061
  reviewFocus: opts.reviewFocus ?? null,
229059
229062
  target
229060
229063
  });
229061
- const sent = await this.agentOps.sendUserMessage(reviewerId, prompt, opts.project.path);
229064
+ const sent = await this.agentOps.sendUserMessage(reviewerId, prompt, opts.project.path, void 0, { origin: "workflow" });
229062
229065
  if (!sent) {
229063
229066
  const failed = await this.storage.workflowRuns.update(run2.id, {
229064
229067
  status: "failed",
@@ -229123,7 +229126,7 @@ var WorkflowEngine = class {
229123
229126
  if (!claimed) throw new WorkflowError("bad-state", "run \u72B6\u6001\u5DF2\u53D8\u5316\uFF08\u53EF\u80FD\u5DF2\u88AB\u5904\u7406\uFF09");
229124
229127
  const feedback = editedPayload ?? run2.feedback_snapshot ?? "";
229125
229128
  const project = await this.storage.projects.getById(run2.project_id);
229126
- const ok = await this.agentOps.sendUserMessage(run2.source_session_id, buildFeedbackMessage(feedback), project?.path ?? void 0).catch(() => false);
229129
+ const ok = await this.agentOps.sendUserMessage(run2.source_session_id, buildFeedbackMessage(feedback), project?.path ?? void 0, void 0, { origin: "workflow" }).catch(() => false);
229127
229130
  if (!ok) {
229128
229131
  await this.storage.workflowRuns.transition(runId, "sending_feedback", "waiting_feedback", {
229129
229132
  error: "\u53D1\u9001\u5931\u8D25\uFF1A\u76EE\u6807 session \u53EF\u80FD\u672A\u8FD0\u884C\u3002\u8BF7\u5728\u5176\u7A97\u53E3\u4E2D\u5524\u9192\u540E\u91CD\u8BD5\uFF0C\u6216\u7ED3\u675F\u672C\u6B21 review\u3002"
@@ -234307,8 +234310,7 @@ var routes11 = async (fastify2) => {
234307
234310
  pseudoProjectId,
234308
234311
  branch ?? null,
234309
234312
  projectPath,
234310
- false,
234311
- permissionMode || "edit"
234313
+ false
234312
234314
  );
234313
234315
  if (!sessionId) {
234314
234316
  console.log(`[API] /api/path/agent-sessions: no existing session (path=${projectPath}, branch=${branch ?? "<null>"})`);
@@ -234606,8 +234608,7 @@ var routes11 = async (fastify2) => {
234606
234608
  req.params.projectId,
234607
234609
  branch ?? null,
234608
234610
  project.path,
234609
- false,
234610
- permissionMode || "edit"
234611
+ false
234611
234612
  );
234612
234613
  if (!sessionId) {
234613
234614
  return reply.code(200).send({ session: null, messages: [] });
@@ -236197,6 +236198,10 @@ function parseReviewerAgentType(raw) {
236197
236198
  if (raw === void 0) return void 0;
236198
236199
  return typeof raw === "string" && REVIEWER_AGENT_TYPES.has(raw) ? raw : null;
236199
236200
  }
236201
+ function normalizeIntentBrief(raw) {
236202
+ if (!raw?.trim()) return void 0;
236203
+ return raw.length > 8e3 ? raw.slice(0, 8e3) + "\u2026" : raw;
236204
+ }
236200
236205
  function errStatus(err) {
236201
236206
  if (!(err instanceof WorkflowError)) return null;
236202
236207
  switch (err.code) {
@@ -236238,6 +236243,28 @@ async function routes18(fastify2) {
236238
236243
  if (!project) return null;
236239
236244
  return info;
236240
236245
  };
236246
+ const distillIntentBrief = async (userId, sourceSessionId) => {
236247
+ try {
236248
+ let messages;
236249
+ if (sourceSessionId.startsWith("remote-")) {
236250
+ const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236251
+ if (!remoteInfo) return void 0;
236252
+ const historyResult = await proxyAuto(
236253
+ remoteInfo,
236254
+ "GET",
236255
+ `/api/agent-sessions/${remoteInfo.remoteSessionId}`
236256
+ );
236257
+ if (!historyResult.ok) return void 0;
236258
+ messages = historyResult.data.messages ?? [];
236259
+ } else {
236260
+ messages = fastify2.agentSessionManager.getMessages(sourceSessionId);
236261
+ }
236262
+ return await generateIntentBrief(fastify2.storage, resolveUserId(userId), messages) ?? void 0;
236263
+ } catch (err) {
236264
+ console.warn("[WorkflowRuns] intent brief generation failed:", err);
236265
+ return void 0;
236266
+ }
236267
+ };
236241
236268
  fastify2.post("/api/workflow-runs", async (req, reply) => {
236242
236269
  const userId = requireAuth(req, reply);
236243
236270
  if (userId === null) return;
@@ -236253,6 +236280,12 @@ async function routes18(fastify2) {
236253
236280
  return reply.code(400).send({ error: "reviewerSessionId and reviewerAgentType are mutually exclusive" });
236254
236281
  }
236255
236282
  const reviewerSessionId = reviewerSessionIdRaw?.trim();
236283
+ const intentBriefRaw = req.body?.intentBrief;
236284
+ if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
236285
+ return reply.code(400).send({ error: "intentBrief must be a string" });
236286
+ }
236287
+ const clientProvidedBrief = intentBriefRaw !== void 0;
236288
+ const clientBrief = normalizeIntentBrief(intentBriefRaw);
236256
236289
  if (sourceSessionId.startsWith("remote-")) {
236257
236290
  const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236258
236291
  if (!remoteInfo) return reply.code(404).send({ error: "Session not found" });
@@ -236268,21 +236301,9 @@ async function routes18(fastify2) {
236268
236301
  }
236269
236302
  bareReviewerSessionId = reviewerInfo.remoteSessionId;
236270
236303
  }
236271
- let intentBrief2;
236272
- if (!bareReviewerSessionId) {
236273
- try {
236274
- const historyResult = await proxyAuto(
236275
- remoteInfo,
236276
- "GET",
236277
- `/api/agent-sessions/${remoteInfo.remoteSessionId}`
236278
- );
236279
- if (historyResult.ok) {
236280
- const messages = historyResult.data.messages ?? [];
236281
- intentBrief2 = await generateIntentBrief(fastify2.storage, resolveUserId(userId), messages) ?? void 0;
236282
- }
236283
- } catch (err) {
236284
- console.warn("[WorkflowRuns] intent brief generation failed (remote source):", err);
236285
- }
236304
+ let intentBrief2 = clientBrief;
236305
+ if (!clientProvidedBrief && !bareReviewerSessionId) {
236306
+ intentBrief2 = await distillIntentBrief(userId, sourceSessionId);
236286
236307
  }
236287
236308
  const result = await proxyAuto(remoteInfo, "POST", "/api/path/workflow-runs", {
236288
236309
  sourceSessionId: remoteInfo.remoteSessionId,
@@ -236356,17 +236377,9 @@ async function routes18(fastify2) {
236356
236377
  if (branch !== void 0 && (branch || null) !== runBranch) {
236357
236378
  return reply.code(400).send({ error: "branch does not match source session" });
236358
236379
  }
236359
- let intentBrief;
236360
- if (!reviewerSessionId) {
236361
- try {
236362
- intentBrief = await generateIntentBrief(
236363
- fastify2.storage,
236364
- resolveUserId(userId),
236365
- fastify2.agentSessionManager.getMessages(sourceSessionId)
236366
- ) ?? void 0;
236367
- } catch (err) {
236368
- console.warn("[WorkflowRuns] intent brief generation failed (local source):", err);
236369
- }
236380
+ let intentBrief = clientBrief;
236381
+ if (!clientProvidedBrief && !reviewerSessionId) {
236382
+ intentBrief = await distillIntentBrief(userId, sourceSessionId);
236370
236383
  }
236371
236384
  try {
236372
236385
  const run2 = await fastify2.workflowEngine.startAdhocReview({
@@ -236386,6 +236399,29 @@ async function routes18(fastify2) {
236386
236399
  throw err;
236387
236400
  }
236388
236401
  });
236402
+ fastify2.post("/api/workflow-runs/intent-brief", async (req, reply) => {
236403
+ const userId = requireAuth(req, reply);
236404
+ if (userId === null) return;
236405
+ const { projectId, sourceSessionId } = req.body ?? {};
236406
+ if (!projectId || !sourceSessionId) {
236407
+ return reply.code(400).send({ error: "projectId and sourceSessionId are required" });
236408
+ }
236409
+ const project = await fastify2.storage.projects.getById(projectId, userId);
236410
+ if (!project) return reply.code(404).send({ error: "Project not found" });
236411
+ if (sourceSessionId.startsWith("remote-")) {
236412
+ const remoteInfo = fastify2.remoteSessionMap.get(sourceSessionId);
236413
+ if (!remoteInfo || projectIdFromRemoteSessionId(sourceSessionId, remoteInfo) !== projectId) {
236414
+ return reply.code(404).send({ error: "Session not found" });
236415
+ }
236416
+ } else {
236417
+ const session = await fastify2.storage.agentSessions.getById(sourceSessionId);
236418
+ if (!session || session.project_id !== projectId) {
236419
+ return reply.code(404).send({ error: "Session not found" });
236420
+ }
236421
+ }
236422
+ const brief = await distillIntentBrief(userId, sourceSessionId);
236423
+ return reply.send({ brief: brief ?? null });
236424
+ });
236389
236425
  fastify2.get("/api/workflow-runs/reviewer-candidate", async (req, reply) => {
236390
236426
  const userId = requireAuth(req, reply);
236391
236427
  if (userId === null) return;
@@ -236559,7 +236595,7 @@ async function routes18(fastify2) {
236559
236595
  if (intentBriefRaw !== void 0 && typeof intentBriefRaw !== "string") {
236560
236596
  return reply.code(400).send({ error: "intentBrief must be a string" });
236561
236597
  }
236562
- const intentBrief = intentBriefRaw?.trim() ? intentBriefRaw.length > 8e3 ? intentBriefRaw.slice(0, 8e3) + "\u2026" : intentBriefRaw : void 0;
236598
+ const intentBrief = normalizeIntentBrief(intentBriefRaw);
236563
236599
  const reviewerAgentType = parseReviewerAgentType(req.body?.reviewerAgentType);
236564
236600
  if (reviewerAgentType === null) return reply.code(400).send({ error: "reviewerAgentType must be one of: claude-code, codex" });
236565
236601
  const reviewerSessionIdRaw = req.body?.reviewerSessionId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedeckx/linux-x64",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Vibedeckx platform binaries for Linux x64",
5
5
  "os": [
6
6
  "linux"