@alook/cli 0.0.154 → 0.0.155

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/index.js CHANGED
@@ -225,6 +225,7 @@ function devWsDoPort() {
225
225
  }
226
226
  // ../shared/src/constants/community.ts
227
227
  var MAX_MESSAGE_CONTENT_LENGTH = 4000;
228
+ var MAX_ATTACHMENTS_PER_MESSAGE = 10;
228
229
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
229
230
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
230
231
  var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
@@ -15108,7 +15109,7 @@ var CommunityBotPatchRequestSchema = exports_external.object({
15108
15109
  var CommunityBotAddToServerRequestSchema = exports_external.object({
15109
15110
  botId: exports_external.string().min(1)
15110
15111
  });
15111
- var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) }).catchall(exports_external.unknown());
15112
+ var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().max(MAX_MESSAGE_CONTENT_LENGTH).default("") }).catchall(exports_external.unknown());
15112
15113
  var CommunityAgentSeqSchema = exports_external.number().int().min(0);
15113
15114
  var CommunityAgentPositiveSeqSchema = exports_external.number().int().min(1);
15114
15115
  var CommunityAgentCursorSchema = exports_external.object({
@@ -15118,7 +15119,17 @@ var CommunityAgentCursorSchema = exports_external.object({
15118
15119
  var CommunityAgentSendRequestSchema = exports_external.object({
15119
15120
  channel: exports_external.string().min(1),
15120
15121
  content: CommunityAgentMessageContentSchema,
15122
+ attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
15121
15123
  seenUpToSeq: CommunityAgentSeqSchema.optional()
15124
+ }).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
15125
+ var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
15126
+ id: exports_external.string(),
15127
+ filename: exports_external.string(),
15128
+ contentType: exports_external.string(),
15129
+ size: exports_external.number()
15130
+ });
15131
+ var CommunityAgentAttachmentDownloadRequestSchema = exports_external.object({
15132
+ id: exports_external.string().min(1)
15122
15133
  });
15123
15134
  var CommunityAgentInboxPullRequestSchema = exports_external.object({
15124
15135
  max: exports_external.number().int().min(1).max(200).optional()
@@ -17309,15 +17320,23 @@ var communityReaction = sqliteTable("community_reaction", {
17309
17320
  ]);
17310
17321
  var communityAttachment = sqliteTable("community_attachment", {
17311
17322
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17312
- messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
17323
+ messageId: text("message_id").references(() => communityMessage.id, {
17324
+ onDelete: "cascade"
17325
+ }),
17326
+ uploaderId: text("uploader_id").notNull(),
17327
+ kind: text("kind").notNull(),
17328
+ targetId: text("target_id").notNull(),
17329
+ r2Key: text("r2_key").notNull(),
17313
17330
  filename: text("filename").notNull(),
17314
- url: text("url").notNull(),
17315
17331
  contentType: text("content_type"),
17316
17332
  size: integer2("size"),
17317
17333
  width: integer2("width"),
17318
17334
  height: integer2("height"),
17335
+ position: integer2("position"),
17319
17336
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
17320
- }, (t) => [index("idx_attachment_message").on(t.messageId)]);
17337
+ }, (t) => [
17338
+ index("idx_attachment_message").on(t.messageId, t.position)
17339
+ ]);
17321
17340
  var communityPin = sqliteTable("community_pin", {
17322
17341
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17323
17342
  channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
@@ -18307,6 +18326,32 @@ async function killProcessTree(pid, opts) {
18307
18326
  }
18308
18327
  }
18309
18328
 
18329
+ // daemon/agent/win-quote.ts
18330
+ var NEEDS_QUOTING = /[\s"&|<>^()%]/;
18331
+ function quoteWinArg(arg) {
18332
+ if (arg.length > 0 && !NEEDS_QUOTING.test(arg))
18333
+ return arg;
18334
+ let result = '"';
18335
+ let backslashes = 0;
18336
+ for (const ch of arg) {
18337
+ if (ch === "\\") {
18338
+ backslashes++;
18339
+ continue;
18340
+ }
18341
+ if (ch === '"') {
18342
+ result += "\\".repeat(backslashes * 2 + 1) + '"';
18343
+ } else {
18344
+ result += "\\".repeat(backslashes) + ch;
18345
+ }
18346
+ backslashes = 0;
18347
+ }
18348
+ result += "\\".repeat(backslashes * 2) + '"';
18349
+ return result;
18350
+ }
18351
+ function quoteWinArgs(args) {
18352
+ return args.map(quoteWinArg);
18353
+ }
18354
+
18310
18355
  // daemon/agent/claude.ts
18311
18356
  class ClaudeBackend {
18312
18357
  cliPath;
@@ -18449,11 +18494,14 @@ class ClaudeBackend {
18449
18494
  if (options.resumeSessionId) {
18450
18495
  args.push("--resume", options.resumeSessionId);
18451
18496
  }
18452
- const proc = spawn(this.cliPath, args, {
18497
+ const isWin = process.platform === "win32";
18498
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
18499
+ const spawnArgs = isWin ? quoteWinArgs(args) : args;
18500
+ const proc = spawn(spawnCmd, spawnArgs, {
18453
18501
  cwd: options.cwd,
18454
18502
  stdio: ["pipe", "pipe", "pipe"],
18455
18503
  env: { ...process.env, ...options.env },
18456
- shell: process.platform === "win32",
18504
+ shell: isWin,
18457
18505
  windowsHide: true,
18458
18506
  detached: process.platform !== "win32"
18459
18507
  });
@@ -19010,11 +19058,15 @@ class CodexBackend {
19010
19058
  });
19011
19059
  }
19012
19060
  execute(prompt, options) {
19013
- const proc = spawn2(this.cliPath, ["app-server", "--listen", "stdio://", "--config", "sandbox_mode=danger-full-access"], {
19061
+ const isWin = process.platform === "win32";
19062
+ const rawArgs = ["app-server", "--listen", "stdio://", "--config", "sandbox_mode=danger-full-access"];
19063
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
19064
+ const spawnArgs = isWin ? quoteWinArgs(rawArgs) : rawArgs;
19065
+ const proc = spawn2(spawnCmd, spawnArgs, {
19014
19066
  cwd: options.cwd,
19015
19067
  stdio: ["pipe", "pipe", "pipe"],
19016
19068
  env: { ...process.env, ...options.env },
19017
- shell: process.platform === "win32",
19069
+ shell: isWin,
19018
19070
  windowsHide: true,
19019
19071
  detached: process.platform !== "win32"
19020
19072
  });
@@ -19660,11 +19712,14 @@ class OpenCodeBackend {
19660
19712
  args.push("--session", options.resumeSessionId);
19661
19713
  }
19662
19714
  args.push(prompt);
19663
- const proc = spawn3(this.cliPath, args, {
19715
+ const isWin = process.platform === "win32";
19716
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
19717
+ const spawnArgs = isWin ? quoteWinArgs(args) : args;
19718
+ const proc = spawn3(spawnCmd, spawnArgs, {
19664
19719
  cwd: options.cwd,
19665
19720
  stdio: ["ignore", "pipe", "pipe"],
19666
19721
  env: { ...process.env, ...options.env, OPENCODE_PERMISSION: '{"*":"allow"}' },
19667
- shell: process.platform === "win32",
19722
+ shell: isWin,
19668
19723
  windowsHide: true,
19669
19724
  detached: process.platform !== "win32"
19670
19725
  });
@@ -130,6 +130,7 @@ var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || `http://localhost
130
130
  var DEV_WAKE_WORKER_URL = process.env.DEV_WAKE_WORKER_URL || `http://localhost:${DEV_PORTS.wakeWorker}`;
131
131
  // ../shared/src/constants/community.ts
132
132
  var MAX_MESSAGE_CONTENT_LENGTH = 4000;
133
+ var MAX_ATTACHMENTS_PER_MESSAGE = 10;
133
134
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
134
135
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
135
136
  var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
@@ -15013,7 +15014,7 @@ var CommunityBotPatchRequestSchema = exports_external.object({
15013
15014
  var CommunityBotAddToServerRequestSchema = exports_external.object({
15014
15015
  botId: exports_external.string().min(1)
15015
15016
  });
15016
- var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) }).catchall(exports_external.unknown());
15017
+ var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().max(MAX_MESSAGE_CONTENT_LENGTH).default("") }).catchall(exports_external.unknown());
15017
15018
  var CommunityAgentSeqSchema = exports_external.number().int().min(0);
15018
15019
  var CommunityAgentPositiveSeqSchema = exports_external.number().int().min(1);
15019
15020
  var CommunityAgentCursorSchema = exports_external.object({
@@ -15023,7 +15024,17 @@ var CommunityAgentCursorSchema = exports_external.object({
15023
15024
  var CommunityAgentSendRequestSchema = exports_external.object({
15024
15025
  channel: exports_external.string().min(1),
15025
15026
  content: CommunityAgentMessageContentSchema,
15027
+ attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
15026
15028
  seenUpToSeq: CommunityAgentSeqSchema.optional()
15029
+ }).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
15030
+ var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
15031
+ id: exports_external.string(),
15032
+ filename: exports_external.string(),
15033
+ contentType: exports_external.string(),
15034
+ size: exports_external.number()
15035
+ });
15036
+ var CommunityAgentAttachmentDownloadRequestSchema = exports_external.object({
15037
+ id: exports_external.string().min(1)
15027
15038
  });
15028
15039
  var CommunityAgentInboxPullRequestSchema = exports_external.object({
15029
15040
  max: exports_external.number().int().min(1).max(200).optional()
@@ -17214,15 +17225,23 @@ var communityReaction = sqliteTable("community_reaction", {
17214
17225
  ]);
17215
17226
  var communityAttachment = sqliteTable("community_attachment", {
17216
17227
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17217
- messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
17228
+ messageId: text("message_id").references(() => communityMessage.id, {
17229
+ onDelete: "cascade"
17230
+ }),
17231
+ uploaderId: text("uploader_id").notNull(),
17232
+ kind: text("kind").notNull(),
17233
+ targetId: text("target_id").notNull(),
17234
+ r2Key: text("r2_key").notNull(),
17218
17235
  filename: text("filename").notNull(),
17219
- url: text("url").notNull(),
17220
17236
  contentType: text("content_type"),
17221
17237
  size: integer2("size"),
17222
17238
  width: integer2("width"),
17223
17239
  height: integer2("height"),
17240
+ position: integer2("position"),
17224
17241
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
17225
- }, (t) => [index("idx_attachment_message").on(t.messageId)]);
17242
+ }, (t) => [
17243
+ index("idx_attachment_message").on(t.messageId, t.position)
17244
+ ]);
17226
17245
  var communityPin = sqliteTable("community_pin", {
17227
17246
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17228
17247
  channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
@@ -17924,6 +17943,32 @@ async function killProcessTree(pid, opts) {
17924
17943
  }
17925
17944
  }
17926
17945
 
17946
+ // daemon/agent/win-quote.ts
17947
+ var NEEDS_QUOTING = /[\s"&|<>^()%]/;
17948
+ function quoteWinArg(arg) {
17949
+ if (arg.length > 0 && !NEEDS_QUOTING.test(arg))
17950
+ return arg;
17951
+ let result = '"';
17952
+ let backslashes = 0;
17953
+ for (const ch of arg) {
17954
+ if (ch === "\\") {
17955
+ backslashes++;
17956
+ continue;
17957
+ }
17958
+ if (ch === '"') {
17959
+ result += "\\".repeat(backslashes * 2 + 1) + '"';
17960
+ } else {
17961
+ result += "\\".repeat(backslashes) + ch;
17962
+ }
17963
+ backslashes = 0;
17964
+ }
17965
+ result += "\\".repeat(backslashes * 2) + '"';
17966
+ return result;
17967
+ }
17968
+ function quoteWinArgs(args) {
17969
+ return args.map(quoteWinArg);
17970
+ }
17971
+
17927
17972
  // daemon/agent/claude.ts
17928
17973
  class ClaudeBackend {
17929
17974
  cliPath;
@@ -18066,11 +18111,14 @@ class ClaudeBackend {
18066
18111
  if (options.resumeSessionId) {
18067
18112
  args.push("--resume", options.resumeSessionId);
18068
18113
  }
18069
- const proc = spawn(this.cliPath, args, {
18114
+ const isWin = process.platform === "win32";
18115
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
18116
+ const spawnArgs = isWin ? quoteWinArgs(args) : args;
18117
+ const proc = spawn(spawnCmd, spawnArgs, {
18070
18118
  cwd: options.cwd,
18071
18119
  stdio: ["pipe", "pipe", "pipe"],
18072
18120
  env: { ...process.env, ...options.env },
18073
- shell: process.platform === "win32",
18121
+ shell: isWin,
18074
18122
  windowsHide: true,
18075
18123
  detached: process.platform !== "win32"
18076
18124
  });
@@ -18627,11 +18675,15 @@ class CodexBackend {
18627
18675
  });
18628
18676
  }
18629
18677
  execute(prompt, options) {
18630
- const proc = spawn2(this.cliPath, ["app-server", "--listen", "stdio://", "--config", "sandbox_mode=danger-full-access"], {
18678
+ const isWin = process.platform === "win32";
18679
+ const rawArgs = ["app-server", "--listen", "stdio://", "--config", "sandbox_mode=danger-full-access"];
18680
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
18681
+ const spawnArgs = isWin ? quoteWinArgs(rawArgs) : rawArgs;
18682
+ const proc = spawn2(spawnCmd, spawnArgs, {
18631
18683
  cwd: options.cwd,
18632
18684
  stdio: ["pipe", "pipe", "pipe"],
18633
18685
  env: { ...process.env, ...options.env },
18634
- shell: process.platform === "win32",
18686
+ shell: isWin,
18635
18687
  windowsHide: true,
18636
18688
  detached: process.platform !== "win32"
18637
18689
  });
@@ -19277,11 +19329,14 @@ class OpenCodeBackend {
19277
19329
  args.push("--session", options.resumeSessionId);
19278
19330
  }
19279
19331
  args.push(prompt);
19280
- const proc = spawn3(this.cliPath, args, {
19332
+ const isWin = process.platform === "win32";
19333
+ const spawnCmd = isWin ? quoteWinArg(this.cliPath) : this.cliPath;
19334
+ const spawnArgs = isWin ? quoteWinArgs(args) : args;
19335
+ const proc = spawn3(spawnCmd, spawnArgs, {
19281
19336
  cwd: options.cwd,
19282
19337
  stdio: ["ignore", "pipe", "pipe"],
19283
19338
  env: { ...process.env, ...options.env, OPENCODE_PERMISSION: '{"*":"allow"}' },
19284
- shell: process.platform === "win32",
19339
+ shell: isWin,
19285
19340
  windowsHide: true,
19286
19341
  detached: process.platform !== "win32"
19287
19342
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/cli",
3
- "version": "0.0.154",
3
+ "version": "0.0.155",
4
4
  "description": "Alook CLI — Enable Your Person Colleague",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",