@gricha/perry 0.1.4 → 0.1.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.
@@ -7,6 +7,7 @@ import { HOST_WORKSPACE_NAME } from '../shared/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 { discoverSSHKeys } from '../ssh/discovery';
10
11
  import { parseClaudeSessionContent } from '../sessions/parser';
11
12
  import { discoverAllSessions, getSessionDetails as getAgentSessionDetails, getSessionMessages, findSessionMessages, } from '../sessions/agents';
12
13
  const WorkspaceStatusSchema = z.enum(['running', 'stopped', 'creating', 'error']);
@@ -47,6 +48,23 @@ const CodingAgentsSchema = z.object({
47
48
  })
48
49
  .optional(),
49
50
  });
51
+ const SSHKeyConfigSchema = z.object({
52
+ copy: z.array(z.string()),
53
+ authorize: z.array(z.string()),
54
+ });
55
+ const SSHSettingsSchema = z.object({
56
+ autoAuthorizeHostKeys: z.boolean(),
57
+ global: SSHKeyConfigSchema,
58
+ workspaces: z.record(z.string(), SSHKeyConfigSchema.partial()),
59
+ });
60
+ const SSHKeyInfoSchema = z.object({
61
+ name: z.string(),
62
+ path: z.string(),
63
+ publicKeyPath: z.string(),
64
+ type: z.enum(['ed25519', 'rsa', 'ecdsa', 'dsa', 'unknown']),
65
+ fingerprint: z.string(),
66
+ hasPrivateKey: z.boolean(),
67
+ });
50
68
  function mapErrorToORPC(err, defaultMessage) {
51
69
  const message = err instanceof Error ? err.message : defaultMessage;
52
70
  if (message.includes('not found')) {
@@ -210,6 +228,27 @@ export function createRouter(ctx) {
210
228
  await saveAgentConfig(newConfig, ctx.configDir);
211
229
  return input;
212
230
  });
231
+ const getSSHSettings = os.output(SSHSettingsSchema).handler(async () => {
232
+ const config = ctx.config.get();
233
+ return (config.ssh || {
234
+ autoAuthorizeHostKeys: true,
235
+ global: { copy: [], authorize: [] },
236
+ workspaces: {},
237
+ });
238
+ });
239
+ const updateSSHSettings = os
240
+ .input(SSHSettingsSchema)
241
+ .output(SSHSettingsSchema)
242
+ .handler(async ({ input }) => {
243
+ const currentConfig = ctx.config.get();
244
+ const newConfig = { ...currentConfig, ssh: input };
245
+ ctx.config.set(newConfig);
246
+ await saveAgentConfig(newConfig, ctx.configDir);
247
+ return input;
248
+ });
249
+ const listSSHKeys = os.output(z.array(SSHKeyInfoSchema)).handler(async () => {
250
+ return discoverSSHKeys();
251
+ });
213
252
  async function listHostSessions(input) {
214
253
  const limit = input.limit ?? 50;
215
254
  const offset = input.offset ?? 0;
@@ -647,6 +686,11 @@ export function createRouter(ctx) {
647
686
  get: getAgents,
648
687
  update: updateAgents,
649
688
  },
689
+ ssh: {
690
+ get: getSSHSettings,
691
+ update: updateSSHSettings,
692
+ listKeys: listSSHKeys,
693
+ },
650
694
  },
651
695
  };
652
696
  }