@alook/cli 0.0.44 → 0.0.46

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
@@ -14861,9 +14861,18 @@ var UpdateIssueRequestSchema = exports_external.object({
14861
14861
  description: exports_external.string().max(20000).optional(),
14862
14862
  status: IssueStatusSchema.optional()
14863
14863
  }).refine((v) => v.title !== undefined || v.description !== undefined || v.status !== undefined, { message: "at least one field is required" });
14864
- var CreateIssueCommentRequestSchema = exports_external.object({
14864
+ var CreateIssueCommentBodySchema = exports_external.object({
14865
14865
  content: exports_external.string().min(1, "content is required").max(20000)
14866
14866
  });
14867
+ var IssueCommentApiSchema = exports_external.object({
14868
+ id: exports_external.string(),
14869
+ issue_id: exports_external.string(),
14870
+ workspace_id: exports_external.string(),
14871
+ author_type: exports_external.enum(["user", "agent"]),
14872
+ author_id: exports_external.string(),
14873
+ content: exports_external.string(),
14874
+ created_at: exports_external.string()
14875
+ });
14867
14876
  var IssueApiSchema = exports_external.object({
14868
14877
  id: exports_external.string(),
14869
14878
  workspace_id: exports_external.string(),
@@ -16685,6 +16694,18 @@ var issue2 = sqliteTable("issue", {
16685
16694
  foreignColumns: [agent.id, agent.workspaceId]
16686
16695
  }).onDelete("cascade")
16687
16696
  ]);
16697
+ var issueComment = sqliteTable("issue_comment", {
16698
+ id: text("id").primaryKey().$defaultFn(() => "ic_" + nanoid3()),
16699
+ issueId: text("issue_id").notNull().references(() => issue2.id, { onDelete: "cascade" }),
16700
+ workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
16701
+ authorType: text("author_type").notNull().default("user"),
16702
+ authorId: text("author_id").notNull(),
16703
+ content: text("content").notNull(),
16704
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
16705
+ }, (t) => [
16706
+ index("idx_issue_comment_issue").on(t.issueId, t.createdAt),
16707
+ index("idx_issue_comment_workspace").on(t.workspaceId, t.issueId)
16708
+ ]);
16688
16709
  var taskMessage = sqliteTable("task_message", {
16689
16710
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
16690
16711
  taskId: text("task_id").notNull().references(() => agentTaskQueue.id, { onDelete: "cascade" }),
@@ -16857,6 +16878,16 @@ var agentLink = sqliteTable("agent_link", {
16857
16878
  foreignColumns: [agent.id, agent.workspaceId]
16858
16879
  }).onDelete("cascade")
16859
16880
  ]);
16881
+ var conversationReadState = sqliteTable("conversation_read_state", {
16882
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
16883
+ conversationId: text("conversation_id").notNull().references(() => conversation.id, { onDelete: "cascade" }),
16884
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
16885
+ lastReadAt: text("last_read_at").notNull().default("1970-01-01T00:00:00.000Z"),
16886
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
16887
+ }, (t) => [
16888
+ unique("conversation_read_state_conv_user").on(t.conversationId, t.userId),
16889
+ index("idx_conversation_read_state_user").on(t.userId)
16890
+ ]);
16860
16891
  var workspaceFileRequest = sqliteTable("workspace_file_request", {
16861
16892
  id: text("id").primaryKey().$defaultFn(() => "wfr_" + nanoid3()),
16862
16893
  workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
@@ -19230,7 +19261,7 @@ function readBody(opts) {
19230
19261
  function printIssue(issue3) {
19231
19262
  console.log(`${issue3.id} ${issue3.status.padEnd(11)} ${issue3.title}`);
19232
19263
  }
19233
- function printIssueDetail(issue3, messages) {
19264
+ function printIssueDetail(issue3, messages, comments) {
19234
19265
  console.log(`id: ${issue3.id}`);
19235
19266
  console.log(`agent_id: ${issue3.agent_id}`);
19236
19267
  console.log(`status: ${issue3.status}`);
@@ -19240,11 +19271,19 @@ function printIssueDetail(issue3, messages) {
19240
19271
  console.log(`title: ${issue3.title}`);
19241
19272
  console.log("description:");
19242
19273
  console.log(issue3.description || "(no description)");
19243
- if (messages && messages.length > 0) {
19274
+ const events = messages?.filter((m) => m.role === "event") ?? [];
19275
+ if (events.length > 0) {
19276
+ console.log(`
19277
+ events:`);
19278
+ for (const m of events) {
19279
+ console.log(` [${m.created_at}] ${m.content}`);
19280
+ }
19281
+ }
19282
+ if (comments && comments.length > 0) {
19244
19283
  console.log(`
19245
- conversation:`);
19246
- for (const m of messages) {
19247
- console.log(`[${m.role}] ${m.content}`);
19284
+ comments:`);
19285
+ for (const c of comments) {
19286
+ console.log(` [${c.created_at}] (${c.author_type}) ${c.content}`);
19248
19287
  }
19249
19288
  }
19250
19289
  }
@@ -19295,24 +19334,6 @@ function issueCommand() {
19295
19334
  process.exit(1);
19296
19335
  }
19297
19336
  });
19298
- cmd.command("pull").description("Show the next active issue for an agent").requiredOption("--agent_id <id>", "Agent ID").option("--json", "Output as JSON").action(async (opts, command) => {
19299
- const { serverUrl, token, workspaceId } = resolveClientOpts3(command, opts.agent_id);
19300
- const client = new APIClient(serverUrl, token, workspaceId);
19301
- try {
19302
- const issues = await client.getJSON(`/api/issues?agentId=${encodeURIComponent(opts.agent_id)}&terminal=false`);
19303
- const issue3 = issues[0] ?? null;
19304
- if (opts.json)
19305
- return printJSON(issue3);
19306
- if (!issue3) {
19307
- console.log("No active issues.");
19308
- return;
19309
- }
19310
- printIssueDetail(issue3);
19311
- } catch (err) {
19312
- console.error(`Error: ${err instanceof Error ? err.message : err}`);
19313
- process.exit(1);
19314
- }
19315
- });
19316
19337
  cmd.command("show").description("Show issue details and conversation").requiredOption("--agent_id <id>", "Agent ID").requiredOption("--issue_id <id>", "Issue ID").option("--json", "Output as JSON").action(async (opts, command) => {
19317
19338
  const { serverUrl, token, workspaceId } = resolveClientOpts3(command, opts.agent_id);
19318
19339
  const client = new APIClient(serverUrl, token, workspaceId);
@@ -19324,7 +19345,7 @@ function issueCommand() {
19324
19345
  }
19325
19346
  if (opts.json)
19326
19347
  return printJSON(res);
19327
- printIssueDetail(res.issue, res.messages);
19348
+ printIssueDetail(res.issue, res.messages, res.comments);
19328
19349
  } catch (err) {
19329
19350
  console.error(`Error: ${err instanceof Error ? err.message : err}`);
19330
19351
  process.exit(1);
@@ -19368,7 +19389,7 @@ function issueCommand() {
19368
19389
  const { serverUrl, token, workspaceId } = resolveClientOpts3(command, opts.agent_id);
19369
19390
  const client = new APIClient(serverUrl, token, workspaceId);
19370
19391
  try {
19371
- const res = await client.postJSON(`/api/issues/${opts.issue_id}?agentId=${encodeURIComponent(opts.agent_id)}`, { content });
19392
+ const res = await client.postJSON(`/api/issues/${opts.issue_id}/comments?agentId=${encodeURIComponent(opts.agent_id)}`, { content });
19372
19393
  if (opts.json)
19373
19394
  return printJSON(res);
19374
19395
  console.log(`Commented on ${opts.issue_id}`);
@@ -14578,9 +14578,18 @@ var UpdateIssueRequestSchema = exports_external.object({
14578
14578
  description: exports_external.string().max(20000).optional(),
14579
14579
  status: IssueStatusSchema.optional()
14580
14580
  }).refine((v) => v.title !== undefined || v.description !== undefined || v.status !== undefined, { message: "at least one field is required" });
14581
- var CreateIssueCommentRequestSchema = exports_external.object({
14581
+ var CreateIssueCommentBodySchema = exports_external.object({
14582
14582
  content: exports_external.string().min(1, "content is required").max(20000)
14583
14583
  });
14584
+ var IssueCommentApiSchema = exports_external.object({
14585
+ id: exports_external.string(),
14586
+ issue_id: exports_external.string(),
14587
+ workspace_id: exports_external.string(),
14588
+ author_type: exports_external.enum(["user", "agent"]),
14589
+ author_id: exports_external.string(),
14590
+ content: exports_external.string(),
14591
+ created_at: exports_external.string()
14592
+ });
14584
14593
  var IssueApiSchema = exports_external.object({
14585
14594
  id: exports_external.string(),
14586
14595
  workspace_id: exports_external.string(),
@@ -16402,6 +16411,18 @@ var issue2 = sqliteTable("issue", {
16402
16411
  foreignColumns: [agent.id, agent.workspaceId]
16403
16412
  }).onDelete("cascade")
16404
16413
  ]);
16414
+ var issueComment = sqliteTable("issue_comment", {
16415
+ id: text("id").primaryKey().$defaultFn(() => "ic_" + nanoid3()),
16416
+ issueId: text("issue_id").notNull().references(() => issue2.id, { onDelete: "cascade" }),
16417
+ workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
16418
+ authorType: text("author_type").notNull().default("user"),
16419
+ authorId: text("author_id").notNull(),
16420
+ content: text("content").notNull(),
16421
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
16422
+ }, (t) => [
16423
+ index("idx_issue_comment_issue").on(t.issueId, t.createdAt),
16424
+ index("idx_issue_comment_workspace").on(t.workspaceId, t.issueId)
16425
+ ]);
16405
16426
  var taskMessage = sqliteTable("task_message", {
16406
16427
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
16407
16428
  taskId: text("task_id").notNull().references(() => agentTaskQueue.id, { onDelete: "cascade" }),
@@ -16574,6 +16595,16 @@ var agentLink = sqliteTable("agent_link", {
16574
16595
  foreignColumns: [agent.id, agent.workspaceId]
16575
16596
  }).onDelete("cascade")
16576
16597
  ]);
16598
+ var conversationReadState = sqliteTable("conversation_read_state", {
16599
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
16600
+ conversationId: text("conversation_id").notNull().references(() => conversation.id, { onDelete: "cascade" }),
16601
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
16602
+ lastReadAt: text("last_read_at").notNull().default("1970-01-01T00:00:00.000Z"),
16603
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
16604
+ }, (t) => [
16605
+ unique("conversation_read_state_conv_user").on(t.conversationId, t.userId),
16606
+ index("idx_conversation_read_state_user").on(t.userId)
16607
+ ]);
16577
16608
  var workspaceFileRequest = sqliteTable("workspace_file_request", {
16578
16609
  id: text("id").primaryKey().$defaultFn(() => "wfr_" + nanoid3()),
16579
16610
  workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
@@ -18322,7 +18353,7 @@ function clearKillIntent(baseDir, taskId) {
18322
18353
  // daemon/prompt.ts
18323
18354
  var DM_RESPONSE_NOTICE = "IMPORTANT: Only your final text response is visible to the user." + " Tool calls, intermediate reasoning, and mid-process outputs are NOT displayed." + " Put all key information, answers, and conclusions in your final response — that is the only thing the user will read.";
18324
18355
  var EMAIL_NOTICE = "This task was triggered automatically by an incoming email. There is no human in this session." + " If you need to communicate with a human, you MUST send an email using the email sending tool." + " If you need more information or confirmation from the human, send them an email asking for it and then exit." + " Do not wait — when the human replies, a new task will be triggered automatically and you will be woken up with their response.";
18325
- var ISSUE_NOTICE = "This task was triggered by an assigned issue. Use `alook issue show`, `alook issue update`, and `alook issue comment` to inspect and update the issue as you work." + " Move the issue to in_progress when you begin, then to review, done, closed, canceled, or failed when appropriate.";
18356
+ var ISSUE_NOTICE = "This task was triggered by an assigned issue. The issue_id is provided in this message." + " Use `alook issue show --agent_id <your_agent_id> --issue_id <issue_id>` to read full context." + " Use `alook issue update --agent_id <your_agent_id> --issue_id <issue_id> --status <status>` to change status." + " Use `alook issue comment --agent_id <your_agent_id> --issue_id <issue_id> --body <text>` to leave a comment." + " You are responsible for setting the issue status: move to in_progress when working, review when awaiting user feedback, done/closed when finished." + " Always leave a comment summarizing what you did before changing status.";
18326
18357
  function buildDmNotice(name, email3) {
18327
18358
  return `This task was triggered by an incoming email on a conversation with ${name} (${email3}).` + ` ${name} is present in this session — reply to them directly.` + ` If you need to communicate with anyone else, use the email sending tool.`;
18328
18359
  }
@@ -18342,6 +18373,10 @@ function buildPrompt(task, attachments) {
18342
18373
  }
18343
18374
  if (task.type === "issue_event") {
18344
18375
  obj.notice = ISSUE_NOTICE;
18376
+ const ctx = task.context;
18377
+ if (ctx?.issue_id) {
18378
+ obj.issue_id = ctx.issue_id;
18379
+ }
18345
18380
  }
18346
18381
  if (task.sender) {
18347
18382
  obj.sender = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/cli",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "Alook CLI — Enable Your Person Colleague",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",