kaizenai 0.2.1 → 0.2.2
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/client/assets/index-Cojjg8ln.js +598 -0
- package/dist/client/assets/index-lSe049cB.css +32 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/src/server/agent.ts +6 -5
- package/src/server/cli-runtime.ts +210 -168
- package/src/server/cli-supervisor.ts +58 -42
- package/src/server/restart.ts +44 -18
- package/src/server/ws-router.ts +1 -9
- package/dist/client/assets/index-BI5hJ6Xa.js +0 -598
- package/dist/client/assets/index-BJ10I6WX.css +0 -32
package/src/server/restart.ts
CHANGED
|
@@ -1,30 +1,56 @@
|
|
|
1
|
-
export const CLI_CHILD_MODE_ENV_VAR =
|
|
2
|
-
export const CLI_CHILD_MODE =
|
|
3
|
-
export const CLI_STARTUP_UPDATE_RESTART_EXIT_CODE = 75
|
|
4
|
-
export const CLI_UI_UPDATE_RESTART_EXIT_CODE = 76
|
|
5
|
-
export const CLI_CHILD_COMMAND_ENV_VAR =
|
|
6
|
-
export const CLI_CHILD_ARGS_ENV_VAR =
|
|
7
|
-
export const CLI_SUPPRESS_OPEN_ONCE_ENV_VAR =
|
|
1
|
+
export const CLI_CHILD_MODE_ENV_VAR = 'KAIZEN_CLI_MODE';
|
|
2
|
+
export const CLI_CHILD_MODE = 'child';
|
|
3
|
+
export const CLI_STARTUP_UPDATE_RESTART_EXIT_CODE = 75;
|
|
4
|
+
export const CLI_UI_UPDATE_RESTART_EXIT_CODE = 76;
|
|
5
|
+
export const CLI_CHILD_COMMAND_ENV_VAR = 'KAIZEN_CLI_CHILD_COMMAND';
|
|
6
|
+
export const CLI_CHILD_ARGS_ENV_VAR = 'KAIZEN_CLI_CHILD_ARGS';
|
|
7
|
+
export const CLI_SUPPRESS_OPEN_ONCE_ENV_VAR = 'KAIZEN_SUPPRESS_OPEN_ONCE';
|
|
8
|
+
export const CLI_SKIP_STARTUP_UPDATE_ONCE_ENV_VAR =
|
|
9
|
+
'KAIZEN_SKIP_STARTUP_UPDATE_ONCE';
|
|
8
10
|
|
|
9
|
-
export function shouldRestartCliProcess(
|
|
10
|
-
|
|
11
|
+
export function shouldRestartCliProcess(
|
|
12
|
+
code: number | null,
|
|
13
|
+
signal: NodeJS.Signals | null
|
|
14
|
+
) {
|
|
15
|
+
return (
|
|
16
|
+
signal === null &&
|
|
17
|
+
(code === CLI_STARTUP_UPDATE_RESTART_EXIT_CODE ||
|
|
18
|
+
code === CLI_UI_UPDATE_RESTART_EXIT_CODE)
|
|
19
|
+
);
|
|
11
20
|
}
|
|
12
21
|
|
|
13
|
-
export function
|
|
14
|
-
|
|
22
|
+
export function isStartupUpdateRestart(
|
|
23
|
+
code: number | null,
|
|
24
|
+
signal: NodeJS.Signals | null
|
|
25
|
+
) {
|
|
26
|
+
return signal === null && code === CLI_STARTUP_UPDATE_RESTART_EXIT_CODE;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function isUiUpdateRestart(
|
|
30
|
+
code: number | null,
|
|
31
|
+
signal: NodeJS.Signals | null
|
|
32
|
+
) {
|
|
33
|
+
return signal === null && code === CLI_UI_UPDATE_RESTART_EXIT_CODE;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function shouldSkipStartupUpdateOnce(value: string | undefined) {
|
|
37
|
+
return value === '1';
|
|
15
38
|
}
|
|
16
39
|
|
|
17
40
|
export function parseChildArgsEnv(value: string | undefined) {
|
|
18
|
-
if (!value) return []
|
|
41
|
+
if (!value) return [];
|
|
19
42
|
|
|
20
43
|
try {
|
|
21
|
-
const parsed = JSON.parse(value) as unknown
|
|
22
|
-
if (
|
|
23
|
-
|
|
44
|
+
const parsed = JSON.parse(value) as unknown;
|
|
45
|
+
if (
|
|
46
|
+
!Array.isArray(parsed) ||
|
|
47
|
+
!parsed.every((entry) => typeof entry === 'string')
|
|
48
|
+
) {
|
|
49
|
+
throw new Error('child args must be an array of strings');
|
|
24
50
|
}
|
|
25
|
-
return parsed
|
|
51
|
+
return parsed;
|
|
26
52
|
} catch (error) {
|
|
27
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
28
|
-
throw new Error(`Invalid ${CLI_CHILD_ARGS_ENV_VAR}: ${message}`)
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
54
|
+
throw new Error(`Invalid ${CLI_CHILD_ARGS_ENV_VAR}: ${message}`);
|
|
29
55
|
}
|
|
30
56
|
}
|
package/src/server/ws-router.ts
CHANGED
|
@@ -553,15 +553,7 @@ export function createWsRouter({
|
|
|
553
553
|
break
|
|
554
554
|
}
|
|
555
555
|
case "chat.create": {
|
|
556
|
-
|
|
557
|
-
const existingChats = store.listChatsByProject(command.projectId)
|
|
558
|
-
const emptyChat = existingChats.find((chat) => {
|
|
559
|
-
if (chat.lastMessageAt != null) return false
|
|
560
|
-
const chatFeatureId = chat.featureId ?? undefined
|
|
561
|
-
return chatFeatureId === (command.featureId ?? undefined)
|
|
562
|
-
})
|
|
563
|
-
|
|
564
|
-
const chat = emptyChat ?? await store.createChat(command.projectId, command.featureId)
|
|
556
|
+
const chat = await store.createChat(command.projectId, command.featureId)
|
|
565
557
|
send(ws, { v: PROTOCOL_VERSION, type: "ack", id, result: { chatId: chat.id } })
|
|
566
558
|
break
|
|
567
559
|
}
|