@vibedeckx/linux-x64 0.2.9 → 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.
- package/dist/bin.js +34 -33
- 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
|
|
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
|
|
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
|
|
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:
|
|
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):
|
|
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
|
|
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
|
|
225392
|
-
const formatted =
|
|
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,8 +228797,11 @@ ${brief}` : null,
|
|
|
228797
228797
|
!brief && intent ? `
|
|
228798
228798
|
## Original request (the user's first message in this session, verbatim)
|
|
228799
228799
|
${intent}` : null,
|
|
228800
|
-
|
|
228801
|
-
|
|
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
228806
|
selfReportSection(opts.authorSelfReport),
|
|
228804
228807
|
opts.reviewFocus ? `
|
|
@@ -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: [] });
|