@rubytech/create-maxy 1.0.734 → 1.0.736

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.
@@ -1,35 +1,65 @@
1
1
  import {
2
- GREETING_DIRECTIVE,
3
- HAIKU_MODEL,
4
2
  Hono,
5
3
  LOG_DIR,
6
4
  MAXY_DIR,
7
5
  TELEGRAM_ADMIN_WEBHOOK_SECRET_FILE,
8
6
  TELEGRAM_WEBHOOK_SECRET_FILE,
9
7
  USERS_FILE,
10
- __commonJS,
11
- __toESM,
12
- agentLogStream,
13
- backfillNullUserIdConversations,
14
- bindVisitorToGroup,
15
8
  buildX11Env,
16
9
  callOauthLlm,
17
10
  canAccessAdmin,
18
- checkGroupMembership,
19
11
  checkRateLimit,
20
12
  clearRateLimit,
21
- clearSessionHistory,
22
13
  clientIpMiddleware,
23
14
  compactSession,
24
- completeGrantSetup,
25
15
  computeConstraints,
26
16
  createRemoteSession,
27
- deleteConversation,
28
- embed,
29
17
  ensureAuth,
30
18
  ensureCdp,
31
19
  ensureLogDir,
32
20
  ensureVnc,
21
+ hashPassword,
22
+ invokeAgent,
23
+ isActionActive,
24
+ isPasswordValid,
25
+ isRemoteAuthConfigured,
26
+ keyFilePath,
27
+ launchAction,
28
+ load,
29
+ logPath,
30
+ recordFailedAttempt,
31
+ render,
32
+ renderLoginPage,
33
+ requireAdminSession,
34
+ resolveBrowserTransport,
35
+ resolveClientIp,
36
+ safeJson,
37
+ sanitizeClientCorrId,
38
+ serve,
39
+ setRemotePassword,
40
+ sleep,
41
+ streamLogPathFor,
42
+ validateKey,
43
+ validatePasswordStrength,
44
+ verifyPassword,
45
+ verifyRemotePassword,
46
+ vncLog,
47
+ waitForExit,
48
+ writeChromiumWrapper
49
+ } from "./chunk-ULVR2RRY.js";
50
+ import {
51
+ GREETING_DIRECTIVE,
52
+ HAIKU_MODEL,
53
+ __commonJS,
54
+ __toESM,
55
+ agentLogStream,
56
+ backfillNullUserIdConversations,
57
+ bindVisitorToGroup,
58
+ checkGroupMembership,
59
+ clearSessionHistory,
60
+ completeGrantSetup,
61
+ deleteConversation,
62
+ embed,
33
63
  fetchBranding,
34
64
  findGroupBySlug,
35
65
  findRecentConversation,
@@ -49,58 +79,30 @@ import {
49
79
  getUserNameForSession,
50
80
  getUserTimezone,
51
81
  getVisitorIdForSession,
52
- hashPassword,
53
82
  interruptClient,
54
- invokeAgent,
55
- isActionActive,
56
- isPasswordValid,
57
- isRemoteAuthConfigured,
58
- keyFilePath,
59
- launchAction,
60
83
  listAdminSessions,
61
84
  listAdminSessionsInProgress,
62
- load,
63
85
  loadOnboardingStep,
64
- logPath,
65
86
  preConversationLogStream,
66
87
  preflushStreamLogKey,
67
- recordFailedAttempt,
68
88
  registerGrantSession,
69
89
  registerResumedSession,
70
90
  registerSession,
71
91
  renameConversation,
72
- render,
73
- renderLoginPage,
74
- requireAdminSession,
75
92
  resolveAccount,
76
93
  resolveAgentConfig,
77
- resolveBrowserTransport,
78
- resolveClientIp,
79
94
  resolveDefaultAgentSlug,
80
95
  resolveUserAccounts,
81
- safeJson,
82
- sanitizeClientCorrId,
83
96
  seedSessionHistory,
84
- serve,
85
97
  setConversationIdForSession,
86
98
  setGroupContextForSession,
87
- setRemotePassword,
88
99
  sigtermFlushStreamLogs,
89
- sleep,
90
- streamLogPathFor,
91
100
  unregisterSession,
92
101
  validateAgentSlug,
93
- validateKey,
94
- validatePasswordStrength,
95
102
  validateSession,
96
103
  verifyAndGetConversationUpdatedAt,
97
- verifyConversationOwnership,
98
- verifyPassword,
99
- verifyRemotePassword,
100
- vncLog,
101
- waitForExit,
102
- writeChromiumWrapper
103
- } from "./chunk-HU5FSQYA.js";
104
+ verifyConversationOwnership
105
+ } from "./chunk-3KDVGWPQ.js";
104
106
 
105
107
  // ../lib/graph-trash/dist/index.js
106
108
  var require_dist = __commonJS({
@@ -8109,6 +8111,16 @@ function chatReject(status, error, sk) {
8109
8111
  });
8110
8112
  }
8111
8113
  var app11 = new Hono();
8114
+ app11.post("/cancel", requireAdminSession, async (c) => {
8115
+ const session_key = c.var.sessionKey;
8116
+ try {
8117
+ const { interruptClient: interruptClient2 } = await import("./client-pool-I5TCP7WI.js");
8118
+ await interruptClient2(session_key);
8119
+ return c.json({ ok: true });
8120
+ } catch (err) {
8121
+ return c.json({ ok: false, error: err instanceof Error ? err.message : String(err) }, 500);
8122
+ }
8123
+ });
8112
8124
  app11.post("/", requireAdminSession, async (c) => {
8113
8125
  const session_key = c.var.sessionKey;
8114
8126
  const contentType = c.req.header("content-type") ?? "";
@@ -8262,10 +8274,37 @@ app11.post("/", requireAdminSession, async (c) => {
8262
8274
  const teeStreamLogKey = sseConvId ?? preflushStreamLogKey(session_key);
8263
8275
  const teeStreamLogPath = resolve12(account.accountDir, "logs", `claude-agent-stream-${teeStreamLogKey}.log`);
8264
8276
  try {
8265
- appendFileSync4(teeStreamLogPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [chat-route-version=task606-tee] sessionKey=${session_key.slice(0, 12)}\u2026
8277
+ appendFileSync4(teeStreamLogPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [chat-route-version=task606-incoming-close] sessionKey=${session_key.slice(0, 12)}\u2026
8266
8278
  `);
8267
8279
  } catch {
8268
8280
  }
8281
+ const incoming = c.env?.incoming;
8282
+ if (incoming && typeof incoming.on === "function") {
8283
+ incoming.on("close", () => {
8284
+ const tsClose = (/* @__PURE__ */ new Date()).toISOString();
8285
+ try {
8286
+ appendFileSync4(teeStreamLogPath, `[${tsClose}] [incoming-close] sessionKey=${session_key.slice(0, 12)}\u2026 complete=${incoming.complete}
8287
+ `);
8288
+ } catch {
8289
+ }
8290
+ if (incoming.complete === false) {
8291
+ console.error(`[${tsClose}] [incoming-close] DISCONNECT sessionKey=${session_key.slice(0, 12)}\u2026`);
8292
+ interruptClient(session_key).catch((err) => {
8293
+ try {
8294
+ appendFileSync4(teeStreamLogPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [incoming-close] interrupt-failed: ${err instanceof Error ? err.message : String(err)}
8295
+ `);
8296
+ } catch {
8297
+ }
8298
+ });
8299
+ }
8300
+ });
8301
+ } else {
8302
+ try {
8303
+ appendFileSync4(teeStreamLogPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [incoming-close] UNAVAILABLE \u2014 c.env.incoming is not an EventEmitter
8304
+ `);
8305
+ } catch {
8306
+ }
8307
+ }
8269
8308
  const sseLog = {
8270
8309
  write(line) {
8271
8310
  try {