@gricha/perry 0.3.5 → 0.3.6
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/agent/router.js +16 -0
- package/dist/agent/run.js +2 -0
- package/dist/agent/web/assets/{index-CZjSxNrg.js → index-C-xi0Vax.js} +34 -34
- package/dist/agent/web/index.html +1 -1
- package/dist/index.js +4 -1
- package/dist/perry-worker +0 -0
- package/dist/session-manager/adapters/claude.js +11 -0
- package/dist/session-manager/adapters/opencode.js +15 -2
- package/dist/session-manager/manager.js +19 -0
- package/dist/sessions/registry.js +129 -0
- package/dist/update-checker.js +3 -3
- package/package.json +1 -1
package/dist/agent/router.js
CHANGED
|
@@ -7,6 +7,7 @@ import { HOST_WORKSPACE_NAME } from '../shared/client-types';
|
|
|
7
7
|
import { getDockerVersion, execInContainer } from '../docker';
|
|
8
8
|
import { saveAgentConfig } from '../config/loader';
|
|
9
9
|
import { setSessionName, getSessionNamesForWorkspace, deleteSessionName, } from '../sessions/metadata';
|
|
10
|
+
import * as sessionRegistry from '../sessions/registry';
|
|
10
11
|
import { discoverSSHKeys } from '../ssh/discovery';
|
|
11
12
|
import { parseClaudeSessionContent } from '../sessions/parser';
|
|
12
13
|
import { discoverAllSessions, getSessionDetails as getAgentSessionDetails, getSessionMessages, findSessionMessages, deleteSession as deleteSessionFromProvider, searchSessions as searchSessionsInContainer, } from '../sessions/agents';
|
|
@@ -596,6 +597,21 @@ export function createRouter(ctx) {
|
|
|
596
597
|
const containerName = `workspace-${input.workspaceName}`;
|
|
597
598
|
const rawSessions = await discoverAllSessions(containerName, execInContainer);
|
|
598
599
|
const customNames = await getSessionNamesForWorkspace(ctx.stateDir, input.workspaceName);
|
|
600
|
+
const registrySessions = await sessionRegistry.getSessionsForWorkspace(ctx.stateDir, input.workspaceName);
|
|
601
|
+
const trackedAgentIds = new Set(registrySessions.filter((s) => s.agentSessionId).map((s) => s.agentSessionId));
|
|
602
|
+
for (const raw of rawSessions) {
|
|
603
|
+
if (!trackedAgentIds.has(raw.id)) {
|
|
604
|
+
const agentType = raw.agentType === 'claude-code' ? 'claude' : raw.agentType;
|
|
605
|
+
await sessionRegistry.importExternalSession(ctx.stateDir, {
|
|
606
|
+
perrySessionId: `imported-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
607
|
+
workspaceName: input.workspaceName,
|
|
608
|
+
agentType: agentType,
|
|
609
|
+
agentSessionId: raw.id,
|
|
610
|
+
createdAt: new Date(raw.mtime).toISOString(),
|
|
611
|
+
lastActivity: new Date(raw.mtime).toISOString(),
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
599
615
|
const filteredSessions = rawSessions
|
|
600
616
|
.filter((s) => !input.agentType || s.agentType === input.agentType)
|
|
601
617
|
.sort((a, b) => b.mtime - a.mtime);
|
package/dist/agent/run.js
CHANGED
|
@@ -7,6 +7,7 @@ import { containerRunning, getContainerName } from '../docker';
|
|
|
7
7
|
import { startEagerImagePull, stopEagerImagePull } from '../docker/eager-pull';
|
|
8
8
|
import { TerminalHandler } from '../terminal/bun-handler';
|
|
9
9
|
import { LiveChatHandler } from '../session-manager/bun-handler';
|
|
10
|
+
import { sessionManager } from '../session-manager';
|
|
10
11
|
import { createRouter } from './router';
|
|
11
12
|
import { serveStaticBun } from './static';
|
|
12
13
|
import { SessionsCacheManager } from '../sessions/cache';
|
|
@@ -16,6 +17,7 @@ import { getTailscaleStatus, getTailscaleIdentity, startTailscaleServe, stopTail
|
|
|
16
17
|
import pkg from '../../package.json';
|
|
17
18
|
const startTime = Date.now();
|
|
18
19
|
function createAgentServer(configDir, config, port, tailscale) {
|
|
20
|
+
sessionManager.init(configDir);
|
|
19
21
|
let currentConfig = config;
|
|
20
22
|
const workspaces = new WorkspaceManager(configDir, currentConfig);
|
|
21
23
|
const sessionsCache = new SessionsCacheManager(configDir);
|