@mindfoldhq/runtime-manager 0.1.5 → 0.1.7
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/README.md +1 -1
- package/dist/vine-runtime-manager.js +49 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ VINE_REMOTE_SANDBOX_PROVIDER='e2b' \
|
|
|
16
16
|
VINE_RUNNER_LINK_HOST='0.0.0.0' \
|
|
17
17
|
VINE_RUNNER_LINK_PORT='8788' \
|
|
18
18
|
VINE_RUNNER_LINK_PUBLIC_URL='<public-runner-link-wss-url>' \
|
|
19
|
-
npx @mindfoldhq/runtime-manager serve
|
|
19
|
+
npx -y @mindfoldhq/runtime-manager serve
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
`VINE_MANAGER_TOKEN` is created in Vine Web Settings -> Runtime managers. The
|
|
@@ -3026,6 +3026,16 @@ var AgentSessionStatePayload = z20.object({
|
|
|
3026
3026
|
last_error: z20.string().nullable(),
|
|
3027
3027
|
metadata: z20.record(z20.string(), z20.unknown()).optional()
|
|
3028
3028
|
});
|
|
3029
|
+
var ManagerTurnStartedPayload = z20.object({
|
|
3030
|
+
agent_turn_id: z20.string().min(1),
|
|
3031
|
+
organization_id: z20.string().min(1),
|
|
3032
|
+
session_id: z20.string().min(1),
|
|
3033
|
+
runner_id: z20.string().min(1),
|
|
3034
|
+
agent_session_id: z20.string().min(1),
|
|
3035
|
+
agent_profile_id: z20.string().min(1),
|
|
3036
|
+
project_agent_profile_id: z20.string().nullable(),
|
|
3037
|
+
backend_kind: ManagerBackendKind
|
|
3038
|
+
});
|
|
3029
3039
|
var ManagerTurnEventPayload = z20.object({
|
|
3030
3040
|
agent_turn_id: z20.string().min(1),
|
|
3031
3041
|
kind: ManagerTurnEventKind,
|
|
@@ -3395,6 +3405,10 @@ var ManagerToServerMessage = z20.discriminatedUnion("type", [
|
|
|
3395
3405
|
type: z20.literal("agent_session.state"),
|
|
3396
3406
|
payload: AgentSessionStatePayload
|
|
3397
3407
|
}),
|
|
3408
|
+
z20.object({
|
|
3409
|
+
type: z20.literal("turn.started"),
|
|
3410
|
+
payload: ManagerTurnStartedPayload
|
|
3411
|
+
}),
|
|
3398
3412
|
z20.object({ type: z20.literal("turn.event"), payload: ManagerTurnEventPayload }),
|
|
3399
3413
|
z20.object({
|
|
3400
3414
|
type: z20.literal("turn.finished"),
|
|
@@ -8929,6 +8943,7 @@ class E2BProvider {
|
|
|
8929
8943
|
await this.killTrackedRunnerCommand(tracked, "respawn");
|
|
8930
8944
|
let command;
|
|
8931
8945
|
try {
|
|
8946
|
+
await this.cleanupPersistedRunnerState(tracked.sandbox, workspaceRoot, tracked, "respawn");
|
|
8932
8947
|
tracked.reposFilePath = reposFilePath;
|
|
8933
8948
|
if (reposFilePath) {
|
|
8934
8949
|
await tracked.sandbox.files.write(reposFilePath, serializeRuntimeReposManifest(remoteRepos));
|
|
@@ -9043,7 +9058,10 @@ class E2BProvider {
|
|
|
9043
9058
|
return result;
|
|
9044
9059
|
}
|
|
9045
9060
|
async prepareRestoredSandbox(sandbox, workspaceRoot, tracked) {
|
|
9046
|
-
|
|
9061
|
+
await this.cleanupPersistedRunnerState(sandbox, workspaceRoot, tracked, "restore");
|
|
9062
|
+
}
|
|
9063
|
+
async cleanupPersistedRunnerState(sandbox, workspaceRoot, tracked, reason) {
|
|
9064
|
+
const result = await sandbox.commands.run(this.persistedRunnerCleanupCommand(workspaceRoot), {
|
|
9047
9065
|
cwd: "/",
|
|
9048
9066
|
timeoutMs: DEFAULT_CLEANUP_TIMEOUT_MS,
|
|
9049
9067
|
onStdout: (data) => {
|
|
@@ -9054,13 +9072,14 @@ class E2BProvider {
|
|
|
9054
9072
|
}
|
|
9055
9073
|
});
|
|
9056
9074
|
if (isCommandHandle(result)) {
|
|
9057
|
-
throw new Error(
|
|
9075
|
+
throw new Error(`E2B ${reason} cleanup unexpectedly ran in background`);
|
|
9058
9076
|
}
|
|
9059
9077
|
if (result.exitCode !== 0) {
|
|
9060
|
-
throw new Error(`E2B
|
|
9078
|
+
throw new Error(`E2B ${reason} cleanup exited ${result.exitCode}: ${redactDiagnosticString(result.stderr)}`);
|
|
9061
9079
|
}
|
|
9080
|
+
log8.info({ sandbox_id: sandbox.sandboxId, reason }, "E2B persisted runner cleanup completed");
|
|
9062
9081
|
}
|
|
9063
|
-
|
|
9082
|
+
persistedRunnerCleanupCommand(workspaceRoot) {
|
|
9064
9083
|
const socketPath = shellQuote2(`${workspaceRoot}/.vine/vine.sock`);
|
|
9065
9084
|
return [
|
|
9066
9085
|
"set -eu;",
|
|
@@ -11573,10 +11592,23 @@ class TaskProjectionBridge {
|
|
|
11573
11592
|
const agentKey = session.turnToAgentKey.get(turnStart.turn_id);
|
|
11574
11593
|
const agentSession = agentKey ? session.agentSessions.get(agentKey) : undefined;
|
|
11575
11594
|
if (agentSession) {
|
|
11595
|
+
this.emitTurnStarted(session, turnStart, agentSession);
|
|
11576
11596
|
this.m.emitAgentSessionState(session, agentSession, "active");
|
|
11577
11597
|
}
|
|
11578
11598
|
}
|
|
11579
11599
|
}
|
|
11600
|
+
emitTurnStarted(session, turnStart, agentSession) {
|
|
11601
|
+
this.m.serverClient.emitTurnStarted({
|
|
11602
|
+
agent_turn_id: turnStart.turn_id,
|
|
11603
|
+
organization_id: session.organizationId,
|
|
11604
|
+
session_id: session.sessionId,
|
|
11605
|
+
runner_id: session.runnerId,
|
|
11606
|
+
agent_session_id: agentSession.agentSessionId,
|
|
11607
|
+
agent_profile_id: agentSession.agentProfileId,
|
|
11608
|
+
project_agent_profile_id: agentSession.projectAgentProfileId,
|
|
11609
|
+
backend_kind: agentSession.backendKind
|
|
11610
|
+
});
|
|
11611
|
+
}
|
|
11580
11612
|
}
|
|
11581
11613
|
|
|
11582
11614
|
// src/runtime-manager-terminal-relay.ts
|
|
@@ -12256,6 +12288,16 @@ class TurnRouter {
|
|
|
12256
12288
|
this.m.maybeRespawnDisconnectedSession(session, "turn_dispatch");
|
|
12257
12289
|
return;
|
|
12258
12290
|
}
|
|
12291
|
+
this.m.serverClient.emitTurnStarted({
|
|
12292
|
+
agent_turn_id: dispatch.agent_turn_id,
|
|
12293
|
+
organization_id: session.organizationId,
|
|
12294
|
+
session_id: session.sessionId,
|
|
12295
|
+
runner_id: session.runnerId,
|
|
12296
|
+
agent_session_id: agentSession.agentSessionId,
|
|
12297
|
+
agent_profile_id: agentSession.agentProfileId,
|
|
12298
|
+
project_agent_profile_id: agentSession.projectAgentProfileId,
|
|
12299
|
+
backend_kind: agentSession.backendKind
|
|
12300
|
+
});
|
|
12259
12301
|
this.m.emitAgentSessionState(session, agentSession, "active");
|
|
12260
12302
|
log15.info({
|
|
12261
12303
|
agent_turn_id: dispatch.agent_turn_id,
|
|
@@ -13025,6 +13067,9 @@ class ServerClient {
|
|
|
13025
13067
|
emitAgentSessionState(payload) {
|
|
13026
13068
|
return this.send({ type: "agent_session.state", payload });
|
|
13027
13069
|
}
|
|
13070
|
+
emitTurnStarted(payload) {
|
|
13071
|
+
return this.send({ type: "turn.started", payload });
|
|
13072
|
+
}
|
|
13028
13073
|
}
|
|
13029
13074
|
function unrefTimer(timer) {
|
|
13030
13075
|
const maybeTimer = timer;
|