kimaki 0.4.98 → 0.4.100

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.
@@ -11,30 +11,20 @@ const MAX_SESSION_MINUTES = 30;
11
11
  const MAX_SESSION_MS = MAX_SESSION_MINUTES * 60 * 1000;
12
12
  const TUNNEL_BASE_DOMAIN = 'kimaki.dev';
13
13
  const TUNNEL_ID_BYTES = 16;
14
- const CONNECTION_TOKEN_BYTES = 16;
15
14
  const READY_TIMEOUT_MS = 60_000;
16
15
  const LOCAL_HOST = '127.0.0.1';
17
16
  const activeSessions = new Map();
18
17
  export function createVscodeTunnelId() {
19
18
  return crypto.randomBytes(TUNNEL_ID_BYTES).toString('hex');
20
19
  }
21
- export function createVscodeConnectionToken() {
22
- return crypto.randomBytes(CONNECTION_TOKEN_BYTES).toString('hex');
23
- }
24
- export function buildVscodeUrl({ tunnelUrl, connectionToken, }) {
25
- const url = new URL(tunnelUrl);
26
- url.searchParams.set('tkn', connectionToken);
27
- return url.toString();
28
- }
29
- export function buildCoderaftArgs({ port, connectionToken, workingDirectory, }) {
20
+ export function buildCoderaftArgs({ port, workingDirectory, }) {
30
21
  return [
31
22
  'coderaft',
32
23
  '--port',
33
24
  String(port),
34
25
  '--host',
35
26
  LOCAL_HOST,
36
- '--connection-token',
37
- connectionToken,
27
+ '--without-connection-token',
38
28
  '--disable-workspace-trust',
39
29
  '--default-folder',
40
30
  workingDirectory,
@@ -122,11 +112,9 @@ export async function startVscode({ sessionKey, startedBy, workingDirectory, })
122
112
  return existing;
123
113
  }
124
114
  const port = await getAvailablePort();
125
- const connectionToken = createVscodeConnectionToken();
126
115
  const tunnelId = createVscodeTunnelId();
127
116
  const args = buildCoderaftArgs({
128
117
  port,
129
- connectionToken,
130
118
  workingDirectory,
131
119
  });
132
120
  const coderaftProcess = spawn('bunx', args, {
@@ -179,10 +167,7 @@ export async function startVscode({ sessionKey, startedBy, workingDirectory, })
179
167
  }
180
168
  throw error;
181
169
  }
182
- const url = buildVscodeUrl({
183
- tunnelUrl: tunnelClient.url,
184
- connectionToken,
185
- });
170
+ const url = tunnelClient.url;
186
171
  const timeoutTimer = setTimeout(() => {
187
172
  logger.log(`VS Code auto-stopped after ${MAX_SESSION_MINUTES} minutes (key: ${sessionKey})`);
188
173
  stopVscode({ sessionKey });
@@ -247,7 +232,7 @@ export async function handleVscodeCommand({ command, }) {
247
232
  if (existing) {
248
233
  await command.editReply({
249
234
  content: `VS Code is already running for this thread. ` +
250
- `It auto-stops after ${MAX_SESSION_MINUTES} minutes from startup.\n` +
235
+ `This unique tunnel auto-stops after ${MAX_SESSION_MINUTES} minutes from startup.\n` +
251
236
  `${existing.url}`,
252
237
  });
253
238
  return;
@@ -260,7 +245,7 @@ export async function handleVscodeCommand({ command, }) {
260
245
  });
261
246
  await command.editReply({
262
247
  content: `VS Code started for \`${session.workingDirectory}\`. ` +
263
- `This private link auto-stops after ${MAX_SESSION_MINUTES} minutes, so open it before it expires.\n` +
248
+ `This unique tunnel auto-stops after ${MAX_SESSION_MINUTES} minutes, so open it before it expires.\n` +
264
249
  `${session.url}`,
265
250
  });
266
251
  }
package/dist/db.js CHANGED
@@ -201,6 +201,7 @@ async function migrateSchema(prisma) {
201
201
  // Also fix NULL worktree status rows that predate the required enum.
202
202
  const defensiveMigrations = [
203
203
  "UPDATE bot_tokens SET bot_mode = 'self_hosted' WHERE bot_mode = 'self-hosted'",
204
+ "UPDATE bot_tokens SET proxy_url = REPLACE(proxy_url, 'discord-gateway.kimaki.xyz', 'discord-gateway.kimaki.dev') WHERE bot_mode = 'gateway' AND proxy_url LIKE '%discord-gateway.kimaki.xyz%'",
204
205
  "UPDATE thread_worktrees SET status = 'pending' WHERE status IS NULL",
205
206
  ];
206
207
  for (const stmt of defensiveMigrations) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "kimaki",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.4.98",
5
+ "version": "0.4.100",
6
6
  "repository": "https://github.com/remorses/kimaki",
7
7
  "bin": "bin.js",
8
8
  "files": [
@@ -25,10 +25,10 @@
25
25
  "prisma": "7.4.2",
26
26
  "tsx": "^4.20.5",
27
27
  "undici": "^8.0.2",
28
- "db": "^0.0.0",
29
- "discord-digital-twin": "^0.1.0",
28
+ "opencode-deterministic-provider": "^0.0.1",
30
29
  "opencode-cached-provider": "^0.0.1",
31
- "opencode-deterministic-provider": "^0.0.1"
30
+ "discord-digital-twin": "^0.1.0",
31
+ "db": "^0.0.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@ai-sdk/google": "^3.0.53",
@@ -65,9 +65,9 @@
65
65
  "zod": "^4.3.6",
66
66
  "zustand": "^5.0.11",
67
67
  "errore": "^0.14.1",
68
- "opencode-injection-guard": "^0.2.1",
69
68
  "libsqlproxy": "^0.1.0",
70
- "traforo": "^0.2.5"
69
+ "traforo": "^0.2.5",
70
+ "opencode-injection-guard": "^0.2.1"
71
71
  },
72
72
  "optionalDependencies": {
73
73
  "@snazzah/davey": "^0.1.10",
@@ -21,7 +21,6 @@ const MAX_SESSION_MINUTES = 30
21
21
  const MAX_SESSION_MS = MAX_SESSION_MINUTES * 60 * 1000
22
22
  const TUNNEL_BASE_DOMAIN = 'kimaki.dev'
23
23
  const TUNNEL_ID_BYTES = 16
24
- const CONNECTION_TOKEN_BYTES = 16
25
24
  const READY_TIMEOUT_MS = 60_000
26
25
  const LOCAL_HOST = '127.0.0.1'
27
26
 
@@ -41,29 +40,11 @@ export function createVscodeTunnelId(): string {
41
40
  return crypto.randomBytes(TUNNEL_ID_BYTES).toString('hex')
42
41
  }
43
42
 
44
- export function createVscodeConnectionToken(): string {
45
- return crypto.randomBytes(CONNECTION_TOKEN_BYTES).toString('hex')
46
- }
47
-
48
- export function buildVscodeUrl({
49
- tunnelUrl,
50
- connectionToken,
51
- }: {
52
- tunnelUrl: string
53
- connectionToken: string
54
- }): string {
55
- const url = new URL(tunnelUrl)
56
- url.searchParams.set('tkn', connectionToken)
57
- return url.toString()
58
- }
59
-
60
43
  export function buildCoderaftArgs({
61
44
  port,
62
- connectionToken,
63
45
  workingDirectory,
64
46
  }: {
65
47
  port: number
66
- connectionToken: string
67
48
  workingDirectory: string
68
49
  }): string[] {
69
50
  return [
@@ -72,8 +53,7 @@ export function buildCoderaftArgs({
72
53
  String(port),
73
54
  '--host',
74
55
  LOCAL_HOST,
75
- '--connection-token',
76
- connectionToken,
56
+ '--without-connection-token',
77
57
  '--disable-workspace-trust',
78
58
  '--default-folder',
79
59
  workingDirectory,
@@ -186,11 +166,9 @@ export async function startVscode({
186
166
  }
187
167
 
188
168
  const port = await getAvailablePort()
189
- const connectionToken = createVscodeConnectionToken()
190
169
  const tunnelId = createVscodeTunnelId()
191
170
  const args = buildCoderaftArgs({
192
171
  port,
193
- connectionToken,
194
172
  workingDirectory,
195
173
  })
196
174
  const coderaftProcess = spawn('bunx', args, {
@@ -246,10 +224,7 @@ export async function startVscode({
246
224
  throw error
247
225
  }
248
226
 
249
- const url = buildVscodeUrl({
250
- tunnelUrl: tunnelClient.url,
251
- connectionToken,
252
- })
227
+ const url = tunnelClient.url
253
228
 
254
229
  const timeoutTimer = setTimeout(() => {
255
230
  logger.log(`VS Code auto-stopped after ${MAX_SESSION_MINUTES} minutes (key: ${sessionKey})`)
@@ -326,7 +301,7 @@ export async function handleVscodeCommand({
326
301
  await command.editReply({
327
302
  content:
328
303
  `VS Code is already running for this thread. ` +
329
- `It auto-stops after ${MAX_SESSION_MINUTES} minutes from startup.\n` +
304
+ `This unique tunnel auto-stops after ${MAX_SESSION_MINUTES} minutes from startup.\n` +
330
305
  `${existing.url}`,
331
306
  })
332
307
  return
@@ -341,7 +316,7 @@ export async function handleVscodeCommand({
341
316
  await command.editReply({
342
317
  content:
343
318
  `VS Code started for \`${session.workingDirectory}\`. ` +
344
- `This private link auto-stops after ${MAX_SESSION_MINUTES} minutes, so open it before it expires.\n` +
319
+ `This unique tunnel auto-stops after ${MAX_SESSION_MINUTES} minutes, so open it before it expires.\n` +
345
320
  `${session.url}`,
346
321
  })
347
322
  } catch (error) {
package/src/db.ts CHANGED
@@ -235,6 +235,7 @@ async function migrateSchema(prisma: PrismaClient): Promise<void> {
235
235
  // Also fix NULL worktree status rows that predate the required enum.
236
236
  const defensiveMigrations = [
237
237
  "UPDATE bot_tokens SET bot_mode = 'self_hosted' WHERE bot_mode = 'self-hosted'",
238
+ "UPDATE bot_tokens SET proxy_url = REPLACE(proxy_url, 'discord-gateway.kimaki.xyz', 'discord-gateway.kimaki.dev') WHERE bot_mode = 'gateway' AND proxy_url LIKE '%discord-gateway.kimaki.xyz%'",
238
239
  "UPDATE thread_worktrees SET status = 'pending' WHERE status IS NULL",
239
240
  ]
240
241
  for (const stmt of defensiveMigrations) {