@wirecat/cli-core 0.576.0 → 0.578.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/cli/compact.d.ts +2 -0
  3. package/dist/cli/compact.js +1 -1
  4. package/dist/cli/findings-input.js +2 -0
  5. package/dist/cli/messenger/projects-command.js +2 -0
  6. package/dist/cli/messenger/tasks-command.js +2 -0
  7. package/dist/cli/project-status-rows.d.ts +4 -2
  8. package/dist/cli/project-status-rows.js +13 -29
  9. package/dist/cli/project-status.d.ts +59 -16
  10. package/dist/cli/project-status.js +101 -42
  11. package/dist/domain/external-links.d.ts +13 -0
  12. package/dist/domain/external-links.js +30 -0
  13. package/dist/entities/index.d.ts +15 -0
  14. package/dist/entities/mail-findings.d.ts +6 -0
  15. package/dist/entities/mail-findings.js +6 -0
  16. package/dist/entities/task-results.d.ts +20 -0
  17. package/dist/entities/task-results.js +4 -0
  18. package/dist/entities/task.d.ts +4 -0
  19. package/dist/entities/task.js +4 -0
  20. package/dist/errors/reasons.js +5 -0
  21. package/dist/mail/cli/index.js +2 -1
  22. package/dist/mail/cli/marks.d.ts +6 -0
  23. package/dist/mail/cli/marks.js +69 -1
  24. package/dist/mail/findings.d.ts +2 -0
  25. package/dist/mail/findings.js +15 -1
  26. package/dist/mail/index.d.ts +1 -1
  27. package/dist/mail/index.js +1 -1
  28. package/dist/mail/marks.d.ts +29 -0
  29. package/dist/mail/marks.js +86 -0
  30. package/dist/meetings/findings-rules.d.ts +4 -0
  31. package/dist/services/project-status/signals/index.js +0 -2
  32. package/dist/store/sqlite/email-activity.d.ts +2 -0
  33. package/dist/store/sqlite/email-activity.js +4 -0
  34. package/dist/store/sqlite/findings-core.js +2 -0
  35. package/dist/store/sqlite/manifest.js +1 -0
  36. package/dist/store/sqlite/migrations.generated.js +10 -0
  37. package/dist/store/sqlite/orders.d.ts +4 -0
  38. package/dist/store/sqlite/orders.js +6 -3
  39. package/dist/store/sqlite/schema.d.ts +64 -0
  40. package/dist/store/sqlite/schema.js +5 -0
  41. package/dist/store/sqlite/work-tasks.d.ts +7 -0
  42. package/dist/store/sqlite/work-tasks.js +10 -0
  43. package/package.json +1 -1
  44. package/dist/services/project-status/signals/last-message.d.ts +0 -4
  45. package/dist/services/project-status/signals/last-message.js +0 -22
@@ -12747,6 +12747,54 @@ export declare const tasks: import("drizzle-orm/sqlite-core").SQLiteTableWithCol
12747
12747
  identity: undefined;
12748
12748
  generated: undefined;
12749
12749
  }, {}>;
12750
+ provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
12751
+ name: string;
12752
+ tableName: "tasks";
12753
+ dataType: "string";
12754
+ data: string;
12755
+ driverParam: string;
12756
+ notNull: false;
12757
+ hasDefault: false;
12758
+ isPrimaryKey: false;
12759
+ isAutoincrement: false;
12760
+ hasRuntimeDefault: false;
12761
+ enumValues: [string, ...string[]];
12762
+ baseColumn: never;
12763
+ identity: undefined;
12764
+ generated: undefined;
12765
+ }, {}>;
12766
+ externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
12767
+ name: string;
12768
+ tableName: "tasks";
12769
+ dataType: "string";
12770
+ data: string;
12771
+ driverParam: string;
12772
+ notNull: false;
12773
+ hasDefault: false;
12774
+ isPrimaryKey: false;
12775
+ isAutoincrement: false;
12776
+ hasRuntimeDefault: false;
12777
+ enumValues: [string, ...string[]];
12778
+ baseColumn: never;
12779
+ identity: undefined;
12780
+ generated: undefined;
12781
+ }, {}>;
12782
+ sourceUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
12783
+ name: string;
12784
+ tableName: "tasks";
12785
+ dataType: "string";
12786
+ data: string;
12787
+ driverParam: string;
12788
+ notNull: false;
12789
+ hasDefault: false;
12790
+ isPrimaryKey: false;
12791
+ isAutoincrement: false;
12792
+ hasRuntimeDefault: false;
12793
+ enumValues: [string, ...string[]];
12794
+ baseColumn: never;
12795
+ identity: undefined;
12796
+ generated: undefined;
12797
+ }, {}>;
12750
12798
  };
12751
12799
  dialect: 'sqlite';
12752
12800
  isAlias: false;
@@ -15326,6 +15374,22 @@ export declare const orders: import("drizzle-orm/sqlite-core").SQLiteTableWithCo
15326
15374
  identity: undefined;
15327
15375
  generated: undefined;
15328
15376
  }, {}>;
15377
+ sourceUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
15378
+ name: string;
15379
+ tableName: "orders";
15380
+ dataType: "string";
15381
+ data: string;
15382
+ driverParam: string;
15383
+ notNull: false;
15384
+ hasDefault: false;
15385
+ isPrimaryKey: false;
15386
+ isAutoincrement: false;
15387
+ hasRuntimeDefault: false;
15388
+ enumValues: [string, ...string[]];
15389
+ baseColumn: never;
15390
+ identity: undefined;
15391
+ generated: undefined;
15392
+ }, {}>;
15329
15393
  };
15330
15394
  dialect: 'sqlite';
15331
15395
  isAlias: false;
@@ -1271,6 +1271,9 @@ export const tasks = sqliteTable("tasks", {
1271
1271
  priorityScore: real("priority_score"),
1272
1272
  agent: text("agent"),
1273
1273
  revision: integer("revision").notNull().default(1),
1274
+ provider: text("provider"),
1275
+ externalId: text("external_id"),
1276
+ sourceUrl: text("source_url"),
1274
1277
  }, (table) => [
1275
1278
  unique().on(table.projectId, table.number),
1276
1279
  index("tasks_by_title_folded").on(table.titleFolded),
@@ -1283,6 +1286,7 @@ export const tasks = sqliteTable("tasks", {
1283
1286
  index("tasks_by_project_id_status_next_check_at").on(table.projectId, table.status, table.nextCheckAt),
1284
1287
  index("tasks_by_project_id_source_locator").on(table.projectId, table.sourceLocator),
1285
1288
  index("tasks_by_source_group").on(table.sourceGroup),
1289
+ index("tasks_by_provider_external_id").on(table.provider, table.externalId).where(sql `external_id IS NOT NULL`),
1286
1290
  index("tasks_by_parent_id").on(table.parentId),
1287
1291
  index("tasks_by_closed_by_type_closed_by_id").on(table.closedByType, table.closedById),
1288
1292
  index("tasks_by_author_type_author_id").on(table.authorType, table.authorId),
@@ -1521,6 +1525,7 @@ export const orders = sqliteTable("orders", {
1521
1525
  createdAt: integer("created_at").notNull(),
1522
1526
  updatedAt: integer("updated_at").notNull(),
1523
1527
  deletedAt: integer("deleted_at"),
1528
+ sourceUrl: text("source_url"),
1524
1529
  }, (table) => [
1525
1530
  index("orders_by_customer_type_customer_id").on(table.customerType, table.customerId),
1526
1531
  index("orders_by_supplier_type_supplier_id").on(table.supplierType, table.supplierId),
@@ -39,6 +39,10 @@ export interface TaskFields {
39
39
  project?: string;
40
40
  /** A project task's kind, bug, feature or chore. */
41
41
  type?: WorkTaskType;
42
+ /** `<service>:<id>`, the task's id in an outside service, such as `avito:4512345678`; `null` clears it. */
43
+ externalId?: string | null;
44
+ /** The http or https page the task is about, such as an Avito ad; `null` clears it. */
45
+ sourceUrl?: string | null;
42
46
  }
43
47
  export interface NewWorkTask extends Omit<TaskFields, "reason" | "project" | "type"> {
44
48
  /** `project:<id>` or the project's key. */
@@ -75,6 +79,9 @@ export interface TaskDetails {
75
79
  parent: string | null;
76
80
  /** What a task found in a message points at; null for a task made here. */
77
81
  source: string | null;
82
+ /** `<service>:<id>` in an outside service, such as `avito:4512345678`. */
83
+ externalId: string | null;
84
+ sourceUrl: string | null;
78
85
  dueAt: string | null;
79
86
  nextCheckAt: string | null;
80
87
  closedAt: string | null;
@@ -1,5 +1,6 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { timezoneOf } from "@wirecat/cli-base/query";
3
+ import { externalIdOf, externalIdText, sourceUrlOf } from "../../domain/external-links.js";
3
4
  import { TASK_TYPES, WORK_TASK_TYPES } from "../../domain/knowledge.js";
4
5
  import { checkedScore, isClosedState, legacyPriority, PRIORITY_LABELS, priorityBand, priorityLabel, TASK_STATES, } from "../../tasks/index.js";
5
6
  import { folded } from "./folded.js";
@@ -136,6 +137,8 @@ export const workTaskOperationsOver = (context) => {
136
137
  revision: Number(row.revision),
137
138
  parent: row.parent_id == null ? null : reference(Number(row.parent_id)),
138
139
  source: row.source_locator == null ? null : String(row.source_locator),
140
+ externalId: externalIdText(row.provider, row.external_id),
141
+ sourceUrl: row.source_url == null ? null : String(row.source_url),
139
142
  dueAt: iso(row.due_at),
140
143
  nextCheckAt: iso(row.next_check_at),
141
144
  closedAt: iso(row.closed_at),
@@ -282,6 +285,13 @@ export const workTaskOperationsOver = (context) => {
282
285
  change("close_reason", reason);
283
286
  change("close_reason_folded", folded(reason));
284
287
  }
288
+ if (fields.externalId !== undefined) {
289
+ const external = fields.externalId === null ? null : externalIdOf(fields.externalId);
290
+ change("provider", external?.provider ?? null);
291
+ change("external_id", external?.id ?? null);
292
+ }
293
+ if (fields.sourceUrl !== undefined)
294
+ change("source_url", fields.sourceUrl === null ? null : sourceUrlOf(fields.sourceUrl));
285
295
  if (fields.category !== undefined)
286
296
  change("category", fields.category, "category");
287
297
  if (fields.type !== undefined && fields.type !== before.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.576.0",
3
+ "version": "0.578.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",
@@ -1,4 +0,0 @@
1
- import type { StatusSignal } from "../types.js";
2
- export type LastMessageData = Record<string, never>;
3
- /** The newest stored message in the window: when, and who wrote it. A chat held in part says so through `coverage`. */
4
- export declare const lastMessage: StatusSignal<LastMessageData>;
@@ -1,22 +0,0 @@
1
- import { evidenceOf, whoOf } from "../items.js";
2
- /** The newest stored message in the window: when, and who wrote it. A chat held in part says so through `coverage`. */
3
- export const lastMessage = {
4
- id: "last-message",
5
- version: 1,
6
- scope: "chat",
7
- read: async (_context, chat) => {
8
- const last = chat?.messages.at(-1);
9
- if (!chat || !last)
10
- return [];
11
- const item = {
12
- signal: "last-message",
13
- chat: chat.ref,
14
- at: last.timestamp,
15
- who: whoOf(last),
16
- evidence: evidenceOf(chat, last),
17
- basis: "store",
18
- data: {},
19
- };
20
- return [item];
21
- },
22
- };