@wirecat/cli-core 1.2.0 → 2.0.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 (150) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/dist/attachments/container.d.ts +1 -1
  3. package/dist/attachments/container.js +16 -7
  4. package/dist/attachments/limits.d.ts +10 -0
  5. package/dist/attachments/limits.js +30 -1
  6. package/dist/attachments/transfer.js +2 -2
  7. package/dist/cli/app-doctor-command.d.ts +61 -7
  8. package/dist/cli/app-doctor-command.js +24 -11
  9. package/dist/cli/contract-templates.js +3 -0
  10. package/dist/cli/documents/file-edit.js +6 -6
  11. package/dist/cli/documents/library.js +4 -2
  12. package/dist/cli/help/first-screen.js +2 -2
  13. package/dist/cli/index.d.ts +7 -6
  14. package/dist/cli/index.js +3 -2
  15. package/dist/cli/messenger/account-command.js +0 -10
  16. package/dist/cli/messenger/accounts.d.ts +1 -1
  17. package/dist/cli/messenger/accounts.js +1 -1
  18. package/dist/cli/messenger/context.d.ts +17 -1
  19. package/dist/cli/messenger/doctor-command.js +16 -1
  20. package/dist/cli/messenger/flooded.js +9 -1
  21. package/dist/cli/messenger/serve-relay.d.ts +2 -0
  22. package/dist/cli/messenger/session-commands.d.ts +1 -1
  23. package/dist/cli/messenger/session-commands.js +1 -1
  24. package/dist/cli/oauth-session.d.ts +3 -2
  25. package/dist/cli/oauth-session.js +19 -3
  26. package/dist/cli/profile-store.d.ts +24 -10
  27. package/dist/cli/profile-store.js +43 -28
  28. package/dist/cli/program.js +2 -2
  29. package/dist/cli/settings.d.ts +3 -3
  30. package/dist/cli/shared-command-exports.d.ts +1 -1
  31. package/dist/cli/token-session.d.ts +21 -2
  32. package/dist/cli/token-session.js +27 -11
  33. package/dist/crm/cli/files.js +7 -7
  34. package/dist/documents.d.ts +1 -1
  35. package/dist/documents.js +1 -1
  36. package/dist/domain/person-kinds.d.ts +7 -3
  37. package/dist/domain/person-kinds.js +7 -3
  38. package/dist/domain/ref-summaries.js +1 -0
  39. package/dist/domain/references.d.ts +3 -2
  40. package/dist/domain/references.js +19 -10
  41. package/dist/entities/deal.d.ts +2 -2
  42. package/dist/entities/deal.js +1 -1
  43. package/dist/entities/fact.d.ts +2 -2
  44. package/dist/entities/fact.js +1 -1
  45. package/dist/entities/fields.d.ts +1 -1
  46. package/dist/entities/fields.js +1 -1
  47. package/dist/entities/index.d.ts +15 -15
  48. package/dist/entities/mail-findings.d.ts +2 -2
  49. package/dist/entities/mail-findings.js +1 -1
  50. package/dist/entities/meeting-findings.d.ts +2 -2
  51. package/dist/entities/meeting-findings.js +1 -1
  52. package/dist/entities/memory.d.ts +1 -1
  53. package/dist/entities/store-maintenance.js +1 -1
  54. package/dist/entities/task-results.d.ts +5 -5
  55. package/dist/entities/task-results.js +1 -1
  56. package/dist/entities/task.d.ts +1 -1
  57. package/dist/entities/task.js +1 -1
  58. package/dist/errors/failures.d.ts +6 -0
  59. package/dist/errors/failures.js +18 -4
  60. package/dist/errors/reasons.js +2 -1
  61. package/dist/errors/store-reasons.js +1 -0
  62. package/dist/fetch/page.js +1 -2
  63. package/dist/mail/headers.d.ts +4 -3
  64. package/dist/mail/headers.js +21 -3
  65. package/dist/mail/sort-rules.d.ts +13 -6
  66. package/dist/mail/sort-rules.js +20 -16
  67. package/dist/mail/sync.js +2 -0
  68. package/dist/mcp/tool.js +2 -2
  69. package/dist/mcp/tools/attachments.js +1 -1
  70. package/dist/office/zip.js +1 -1
  71. package/dist/ports/messenger.d.ts +31 -1
  72. package/dist/runs/recording.js +2 -2
  73. package/dist/services/archive.js +61 -11
  74. package/dist/services/attachments.js +4 -4
  75. package/dist/services/documents/file-text.js +2 -2
  76. package/dist/services/metadata.d.ts +1 -1
  77. package/dist/services/proposals/kinds/shared.d.ts +1 -1
  78. package/dist/services/proposals/kinds/shared.js +2 -2
  79. package/dist/services/proposals/kinds/task-close.js +1 -1
  80. package/dist/store/areas.d.ts +2 -0
  81. package/dist/store/areas.js +1 -0
  82. package/dist/store/decisions.d.ts +1 -1
  83. package/dist/store/decisions.js +4 -4
  84. package/dist/store/evidence-findings.d.ts +2 -2
  85. package/dist/store/index.d.ts +3 -1
  86. package/dist/store/index.js +2 -1
  87. package/dist/store/mail-findings.d.ts +2 -2
  88. package/dist/store/meeting-findings.d.ts +2 -2
  89. package/dist/store/people.d.ts +4 -4
  90. package/dist/store/people.js +2 -1
  91. package/dist/store/project-transfer/manifest.js +3 -3
  92. package/dist/store/public.d.ts +1 -1
  93. package/dist/store/public.js +1 -1
  94. package/dist/store/sqlite/actors.d.ts +1 -1
  95. package/dist/store/sqlite/actors.js +6 -6
  96. package/dist/store/sqlite/agent-actions.js +2 -2
  97. package/dist/store/sqlite/agent-links.js +1 -1
  98. package/dist/store/sqlite/bot-sends.d.ts +19 -0
  99. package/dist/store/sqlite/bot-sends.js +36 -0
  100. package/dist/store/sqlite/business-contracts.js +1 -1
  101. package/dist/store/sqlite/deals.js +1 -1
  102. package/dist/store/sqlite/document-transfer/plan.js +1 -1
  103. package/dist/store/sqlite/document-transfer/snapshot.js +1 -1
  104. package/dist/store/sqlite/email-index.d.ts +11 -2
  105. package/dist/store/sqlite/email-index.js +56 -5
  106. package/dist/store/sqlite/email-types.d.ts +15 -3
  107. package/dist/store/sqlite/email-types.js +32 -1
  108. package/dist/store/sqlite/emails.d.ts +2 -1
  109. package/dist/store/sqlite/emails.js +6 -1
  110. package/dist/store/sqlite/entity-types.d.ts +1 -1
  111. package/dist/store/sqlite/entity-types.js +1 -1
  112. package/dist/store/sqlite/evidence-findings.js +1 -1
  113. package/dist/store/sqlite/facts.js +1 -1
  114. package/dist/store/sqlite/finance.js +2 -2
  115. package/dist/store/sqlite/knowledge.js +1 -0
  116. package/dist/store/sqlite/mail-findings.js +1 -1
  117. package/dist/store/sqlite/mail-sorting.d.ts +1 -1
  118. package/dist/store/sqlite/mail-sorting.js +96 -60
  119. package/dist/store/sqlite/mail-subscriptions.d.ts +70 -0
  120. package/dist/store/sqlite/mail-subscriptions.js +132 -0
  121. package/dist/store/sqlite/manifest.js +45 -0
  122. package/dist/store/sqlite/meeting-findings.js +1 -1
  123. package/dist/store/sqlite/memories.js +3 -3
  124. package/dist/store/sqlite/migrations.generated.js +80 -0
  125. package/dist/store/sqlite/money-transactions.js +1 -1
  126. package/dist/store/sqlite/note-index.d.ts +4 -1
  127. package/dist/store/sqlite/note-index.js +40 -17
  128. package/dist/store/sqlite/orders.js +1 -1
  129. package/dist/store/sqlite/payment-facts.js +2 -2
  130. package/dist/store/sqlite/products.js +1 -1
  131. package/dist/store/sqlite/project-transfer/sources.js +2 -2
  132. package/dist/store/sqlite/proposed-actions.js +3 -3
  133. package/dist/store/sqlite/record-projection.js +1 -1
  134. package/dist/store/sqlite/ref-summaries.js +2 -1
  135. package/dist/store/sqlite/relation-proposals.js +1 -1
  136. package/dist/store/sqlite/reviewed.d.ts +2 -2
  137. package/dist/store/sqlite/reviewed.js +1 -1
  138. package/dist/store/sqlite/sender-bots.d.ts +19 -4
  139. package/dist/store/sqlite/sender-bots.js +48 -4
  140. package/dist/store/sqlite/subscriptions.js +2 -2
  141. package/dist/store/sqlite/task-close.js +1 -1
  142. package/dist/store/sqlite/task-comments.js +1 -1
  143. package/dist/store/sqlite/things.js +1 -1
  144. package/dist/store/sqlite/transaction.d.ts +5 -0
  145. package/dist/store/sqlite/transaction.js +6 -1
  146. package/dist/store/sqlite/wallets.js +1 -1
  147. package/dist/store/sqlite/work-tasks.js +2 -2
  148. package/dist/tracker/tasks.js +4 -2
  149. package/package.json +7 -5
  150. package/parity.json +9 -3
@@ -43,16 +43,18 @@ export const manifestVerify = ({ manifest, service, verify, fetch }) => async (c
43
43
  const UNREADABLE = new Set(["keyring.unreachable", "oauth.not-saved", "oauth.invalid", "session.unreadable"]);
44
44
  /**
45
45
  * `session list`'s row for a profile whose sign-in cannot be read: a keyring this run cannot reach or a broken entry
46
- * must not hide the other profiles (WC-ACCT-12), and `session status` names the cause. Warns once per cause.
46
+ * must not hide the other profiles (WC-ACCT-12), and `session status` names the cause. Warns once per reason.
47
47
  */
48
48
  export const unknownSignIn = (warn) => {
49
49
  const warned = new Set();
50
50
  return (profile, error) => {
51
51
  if (!(error instanceof CliError) || !UNREADABLE.has(String(error.details.reason)))
52
52
  throw error;
53
- if (!warned.has(error.message))
53
+ // By reason, not message: cli-base's keyring.unreachable names the profile, and the cause is the same for all.
54
+ const reason = String(error.details.reason);
55
+ if (!warned.has(reason))
54
56
  warn(error.message);
55
- warned.add(error.message);
57
+ warned.add(reason);
56
58
  return { profile, signed_in: null, state: "unknown" };
57
59
  };
58
60
  };
@@ -66,8 +68,12 @@ export const storageOf = (raw) => {
66
68
  * or read from stdin, checked with the service, and only then kept in the keyring or a private file.
67
69
  */
68
70
  const tokenSessionCommandDefinition = (options) => {
69
- const { app, service } = options;
71
+ const { app, service, entry } = options;
72
+ if (entry && options.site)
73
+ throw new CliError("configuration_error", "tokenSessionCommand takes entry or site, not both");
70
74
  const word = options.token ?? (options.login ? "password" : "API token");
75
+ const held = (saved, env) => entry ? entry.read(saved, env) : { token: saved.secret };
76
+ const accountOf = (account) => (entry ? { account: account ?? null } : {});
71
77
  const contextOf = (command) => {
72
78
  const base = baseContext(command, options.resolveSettings);
73
79
  const tokens = new ProfileTokenStore({
@@ -129,9 +135,11 @@ const tokenSessionCommandDefinition = (options) => {
129
135
  if (!secret)
130
136
  throw new CliError("validation_error", `no ${word} was given`);
131
137
  const token = login === undefined ? secret : `${login}:${secret}`;
132
- const { id, account } = await run((events) => options.verify(this, token, events, site));
138
+ const verified = await run((events) => options.verify(this, token, events, site));
139
+ const { id, account } = verified;
133
140
  (options.claim ?? ((at, name, key) => rememberAccount(app, name, key, at)))(env, profile, siteAccount(site, id), tokens, keyring);
134
- const storedIn = tokens.write(profile, token, args.credentialStorage, site === undefined ? {} : { site });
141
+ const kept = entry ? entry.write(token, verified) : token;
142
+ const storedIn = tokens.write(profile, kept, args.credentialStorage, site === undefined ? {} : { site });
135
143
  answer(this, { profile, state: "saved", stored_in: storedIn, verified: true, ...siteOf(site), ...account });
136
144
  });
137
145
  const status = annotate(new Command("status"), {
@@ -143,16 +151,23 @@ const tokenSessionCommandDefinition = (options) => {
143
151
  `--check asks ${service} whose token it is`)
144
152
  .option("--check", `ask ${service} whether the token still works, and whose it is`)
145
153
  .action(async function (args) {
146
- const { profile, tokens, run } = contextOf(this);
154
+ const { env, profile, tokens, run } = contextOf(this);
147
155
  const saved = tokens.read(profile);
156
+ const found = saved ? held(saved, env) : undefined;
148
157
  const site = options.site ? tokens.readWith(profile, SITE)?.secret : undefined;
149
- const state = { profile, state: saved ? "saved" : "missing", token_from: saved?.source ?? null, ...siteOf(site) };
150
- if (!args.check || !saved)
158
+ const state = {
159
+ profile,
160
+ state: saved ? "saved" : "missing",
161
+ token_from: saved?.source ?? null,
162
+ ...siteOf(site),
163
+ ...accountOf(found?.account),
164
+ };
165
+ if (!args.check || !found)
151
166
  return answer(this, { ...state, verified: false });
152
167
  if (options.site && site === undefined)
153
168
  throw noSite(app, profile);
154
169
  refuseOffline(this, service);
155
- const { account } = await run((events) => options.verify(this, saved.secret, events, site));
170
+ const { account } = await run((events) => options.verify(this, found.token, events, site));
156
171
  answer(this, { ...state, verified: true, ...account });
157
172
  });
158
173
  const end = logsInOrOut(annotate(new Command("end"), {
@@ -193,10 +208,11 @@ const tokenSessionCommandDefinition = (options) => {
193
208
  signed_in: saved !== undefined,
194
209
  state: saved ? "saved" : "missing",
195
210
  token_from: saved?.source ?? null,
211
+ ...accountOf(saved ? held(saved, env).account : undefined),
196
212
  };
197
213
  }
198
214
  catch (error) {
199
- return { ...unknown(profile, error), token_from: null };
215
+ return { ...unknown(profile, error), token_from: null, ...accountOf(undefined) };
200
216
  }
201
217
  });
202
218
  renderAnswer(this, outputFor(this), listOf("session list", { items, limit: Math.max(1, items.length), has_more: false }));
@@ -1,12 +1,12 @@
1
1
  import { createHash } from "node:crypto";
2
- import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync, renameSync, rmSync, } from "node:fs";
2
+ import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, renameSync, rmSync } from "node:fs";
3
3
  import { open } from "node:fs/promises";
4
4
  import { join, resolve, sep } from "node:path";
5
5
  import { CliError, isCliError, resolvePaths } from "@wirecat/cli-base";
6
6
  import { annotate } from "@wirecat/cli-base/commands";
7
7
  import * as v from "valibot";
8
8
  import { extractText, importEngine, MAX_TEXT_CHARS } from "../../attachments/extract.js";
9
- import { attachmentMaxBytes } from "../../attachments/limits.js";
9
+ import { attachmentMaxBytes, readWhole } from "../../attachments/limits.js";
10
10
  import { answerEntity } from "../../cli/answer-entity.js";
11
11
  import { environmentOf, outputFor, runBudgetOf } from "../../cli/context.js";
12
12
  import { FETCH, REMOTE_READ } from "../../cli/effects.js";
@@ -277,9 +277,10 @@ export const downloadCrmFile = async (context, file, assignee, { capBytes, capMb
277
277
  await discard();
278
278
  throw diskFull(limits, top, setting);
279
279
  }
280
+ const overBudget = saved.bytes > attachmentMaxBytes(run.env ?? process.env);
280
281
  let bytes;
281
282
  try {
282
- bytes = readFileSync(target);
283
+ bytes = overBudget ? Buffer.alloc(0) : await readWhole(target);
283
284
  }
284
285
  catch {
285
286
  await discard();
@@ -295,10 +296,9 @@ export const downloadCrmFile = async (context, file, assignee, { capBytes, capMb
295
296
  };
296
297
  let extraction;
297
298
  try {
298
- extraction =
299
- saved.bytes > attachmentMaxBytes(run.env ?? process.env)
300
- ? { status: "too-large" }
301
- : await extractText(bytes, { kind: "file", name: file.name, mime: file.mime, path: target }, importEngine, signal, run.env ?? process.env);
299
+ extraction = overBudget
300
+ ? { status: "too-large" }
301
+ : await extractText(bytes, { kind: "file", name: file.name, mime: file.mime, path: target }, importEngine, signal, run.env ?? process.env);
302
302
  }
303
303
  catch (error) {
304
304
  if (signal?.aborted)
@@ -1,7 +1,7 @@
1
1
  export { readSpreadsheet } from "./attachments/documents.js";
2
2
  export type { Engine, Extraction, FileHint, LoadEngine } from "./attachments/extract.js";
3
3
  export { extractText, importEngine, MAX_FILE_BYTES, MAX_TEXT_CHARS } from "./attachments/extract.js";
4
- export { attachmentMaxBytes } from "./attachments/limits.js";
4
+ export { asBytes, attachmentMaxBytes, readWhole, sizeText } from "./attachments/limits.js";
5
5
  export { type OcrPipeline, ocrImage } from "./attachments/ocr.js";
6
6
  export { agentPictureReader, PICTURE_AGENTS, type PictureAgent, type PictureReadingSetting, pictureExtractor, pictureReaderOf, readPictureReading, readPictureWithAgent, } from "./attachments/picture-reading.js";
7
7
  export type { Sheet, SheetCell } from "./attachments/sheets.js";
package/dist/documents.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { readSpreadsheet } from "./attachments/documents.js";
2
2
  export { extractText, importEngine, MAX_FILE_BYTES, MAX_TEXT_CHARS } from "./attachments/extract.js";
3
- export { attachmentMaxBytes } from "./attachments/limits.js";
3
+ export { asBytes, attachmentMaxBytes, readWhole, sizeText } from "./attachments/limits.js";
4
4
  export { ocrImage } from "./attachments/ocr.js";
5
5
  export { agentPictureReader, PICTURE_AGENTS, pictureExtractor, pictureReaderOf, readPictureReading, readPictureWithAgent, } from "./attachments/picture-reading.js";
6
6
  export { columnName, sheetText } from "./attachments/sheets.js";
@@ -9,10 +9,14 @@ export type PersonKind = (typeof PERSON_KINDS)[number];
9
9
  /** What decided a kind, besides the ties that make someone a `person`. @experimental */
10
10
  export type KindSignal = "test-data" | "bot" | "no-reply" | "notification-address" | "auto-submitted" | "null-return-path" | "bulk-mail" | "bulk-never-replied" | "newsletter-only" | "automated-name" | "organization" | "role-address" | "company-name" | "no-tie" | "no-name";
11
11
  /**
12
- * A sender bot's reference, `sender-bot:<id>`: a program that writes to the owner, an entity apart from people.
13
- * `bot:` names the agents of the `bots` table. @experimental
12
+ * A sender bot's reference, `bot:<id>`: a program that writes to the owner, an entity apart from people. The agents of
13
+ * the `bots` table are `agent:<id>` since store version 78. @experimental
14
14
  */
15
- export declare const SENDER_BOT_PREFIX = "sender-bot:";
15
+ export declare const SENDER_BOT_PREFIX = "bot:";
16
+ /** A sender bot's reference before store version 78, still read. @experimental */
17
+ export declare const OLD_SENDER_BOT_PREFIX = "sender-bot:";
18
+ /** `sender-bot:<id>` as `bot:<id>`; any other text as it is. @experimental */
19
+ export declare const senderBotRef: (ref: string) => string;
16
20
  /** A sender that is a program: «Notifications», «Рассылка», «no-reply». */
17
21
  export declare const isAutomatedName: (name: string | null) => boolean;
18
22
  /** A legal form or a word only a business calls itself: «ООО Ромашка», «CZECH AIRLINES», «OpenWeather Team». */
@@ -5,10 +5,14 @@
5
5
  */
6
6
  export const PERSON_KINDS = ["person", "organization", "automated", "stranger", "unsorted", "test"];
7
7
  /**
8
- * A sender bot's reference, `sender-bot:<id>`: a program that writes to the owner, an entity apart from people.
9
- * `bot:` names the agents of the `bots` table. @experimental
8
+ * A sender bot's reference, `bot:<id>`: a program that writes to the owner, an entity apart from people. The agents of
9
+ * the `bots` table are `agent:<id>` since store version 78. @experimental
10
10
  */
11
- export const SENDER_BOT_PREFIX = "sender-bot:";
11
+ export const SENDER_BOT_PREFIX = "bot:";
12
+ /** A sender bot's reference before store version 78, still read. @experimental */
13
+ export const OLD_SENDER_BOT_PREFIX = "sender-bot:";
14
+ /** `sender-bot:<id>` as `bot:<id>`; any other text as it is. @experimental */
15
+ export const senderBotRef = (ref) => ref.startsWith(OLD_SENDER_BOT_PREFIX) ? `${SENDER_BOT_PREFIX}${ref.slice(OLD_SENDER_BOT_PREFIX.length)}` : ref;
12
16
  const AUTOMATED_WORDS = new Set([
13
17
  "noreply",
14
18
  "notification",
@@ -103,6 +103,7 @@ const WORDS = {
103
103
  task: "Task",
104
104
  memory: "Memory",
105
105
  fact: "Fact",
106
+ agent: "Agent",
106
107
  bot: "Bot",
107
108
  invoice: "Invoice",
108
109
  payment: "Payment",
@@ -31,9 +31,10 @@ export type Reference = {
31
31
  } | MeetingReference;
32
32
  /**
33
33
  * Things named by their store id (a task also by its key or the task package's id). `entity` is the name
34
- * before organizations and projects: it still parses, so an old file's reference resolves as not found.
34
+ * before organizations and projects: it still parses, so an old file's reference resolves as not found. `agent` is an
35
+ * agent of the `bots` table, `bot` a sender bot (`bot:` named agents before store version 78).
35
36
  */
36
- export declare const SIMPLE_REFERENCES: readonly ["note", "document", "person", "organization", "project", "task", "memory", "fact", "bot", "event", "invoice", "payment", "order", "deal", "lead", "pipeline", "product", "contract", "subscription", "wallet", "transaction", "entity"];
37
+ export declare const SIMPLE_REFERENCES: readonly ["note", "document", "person", "organization", "project", "task", "memory", "fact", "agent", "bot", "event", "invoice", "payment", "order", "deal", "lead", "pipeline", "product", "contract", "subscription", "wallet", "transaction", "entity"];
37
38
  export type SimpleReference = (typeof SIMPLE_REFERENCES)[number];
38
39
  export type RefKindName = Exclude<Reference["type"], "entity">;
39
40
  /** @experimental */
@@ -3,7 +3,8 @@ import { formatMeetingReference, parseMeetingReference } from "../meetings/index
3
3
  import { formatLocator, parseLocator } from "./locator.js";
4
4
  /**
5
5
  * Things named by their store id (a task also by its key or the task package's id). `entity` is the name
6
- * before organizations and projects: it still parses, so an old file's reference resolves as not found.
6
+ * before organizations and projects: it still parses, so an old file's reference resolves as not found. `agent` is an
7
+ * agent of the `bots` table, `bot` a sender bot (`bot:` named agents before store version 78).
7
8
  */
8
9
  export const SIMPLE_REFERENCES = [
9
10
  "note",
@@ -14,6 +15,7 @@ export const SIMPLE_REFERENCES = [
14
15
  "task",
15
16
  "memory",
16
17
  "fact",
18
+ "agent",
17
19
  "bot",
18
20
  "event",
19
21
  "invoice",
@@ -57,19 +59,23 @@ const folderPath = (path) => {
57
59
  };
58
60
  const MEETING_SHAPE = "meeting:<account>/<meeting>[/<transcript>[/<cue>]] with safe integer ids";
59
61
  const kind = (spec) => spec;
60
- const simple = (prefix) => kind({
62
+ /** `agent:claude` is an author's name, stored long before `agent:` named a row: only an id makes it a reference. */
63
+ const BY_NUMBER_ONLY = new Set(["agent"]);
64
+ const simple = (prefix, type = prefix) => kind({
61
65
  prefix,
62
- type: prefix,
63
- shape: `${prefix}:<id>`,
66
+ type,
67
+ shape: BY_NUMBER_ONLY.has(prefix) ? `${prefix}:<number>` : `${prefix}:<id>`,
64
68
  parse: (rest, text) => {
65
- if (!rest.trim())
69
+ if (!rest.trim() || (BY_NUMBER_ONLY.has(prefix) && !/^[1-9]\d*$/.test(rest)))
66
70
  throw new CliError("validation_error", `"${singleLine(text)}" names no ${prefix}`, {
67
71
  reason: "ref.malformed",
68
72
  });
69
- return { type: prefix, id: rest };
73
+ return { type, id: rest };
70
74
  },
71
75
  format: (reference) => `${reference.type}:${reference.id}`,
72
76
  });
77
+ /** Prefixes still read and never offered: a sender bot's ref before store version 78. */
78
+ const ALIASES = new Set(["sender-bot"]);
73
79
  /** Every kind of reference. A new kind is one row here; nothing else switches on the prefix. @experimental */
74
80
  export const REF_KINDS = [
75
81
  kind({
@@ -134,12 +140,13 @@ export const REF_KINDS = [
134
140
  },
135
141
  format: formatMeetingReference,
136
142
  }),
137
- ...SIMPLE_REFERENCES.map(simple),
143
+ simple("sender-bot", "bot"),
144
+ ...SIMPLE_REFERENCES.map((prefix) => simple(prefix)),
138
145
  ];
139
146
  const byPrefix = new Map(REF_KINDS.map((spec) => [spec.prefix, spec]));
140
147
  const byType = new Map(REF_KINDS.map((spec) => [spec.type, spec]));
141
148
  /** The prefixes people are told about: `entity` only still parses. */
142
- const offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity");
149
+ const offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity" && !ALIASES.has(prefix));
143
150
  const distance = (a, b) => {
144
151
  let row = Array.from({ length: b.length + 1 }, (_, at) => at);
145
152
  for (const [i, x] of [...a].entries()) {
@@ -183,6 +190,8 @@ export const canonicalReference = (text) => formatReference(parseReference(text)
183
190
  * @experimental
184
191
  */
185
192
  export const looksLikeReference = (text) => {
186
- const match = /^([a-z]+):\S+$/.exec(text.trim());
187
- return match !== null && byPrefix.has(match[1]);
193
+ const match = /^([a-z][a-z-]*):(\S+)$/.exec(text.trim());
194
+ if (match === null || !byPrefix.has(match[1]))
195
+ return false;
196
+ return !BY_NUMBER_ONLY.has(match[1]) || /^[1-9]\d*$/.test(match[2]);
188
197
  };
@@ -79,7 +79,7 @@ export declare const deal: v.StrictObjectSchema<{
79
79
  readonly role: v.PicklistSchema<readonly ["owner", "contact", "decision-maker", "influencer"], undefined>;
80
80
  }, undefined>, undefined>;
81
81
  readonly author: v.StrictObjectSchema<{
82
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
82
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
83
83
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
84
84
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
85
85
  readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
@@ -160,7 +160,7 @@ export declare const lead: v.StrictObjectSchema<{
160
160
  readonly role: v.PicklistSchema<readonly ["owner", "contact", "decision-maker", "influencer"], undefined>;
161
161
  }, undefined>, undefined>;
162
162
  readonly author: v.StrictObjectSchema<{
163
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
163
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
164
164
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
165
165
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
166
166
  readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
@@ -72,7 +72,7 @@ export const deal = v.strictObject({
72
72
  })),
73
73
  people: v.array(v.strictObject({ ...party.entries, role: v.picklist(DEAL_ROLES) })),
74
74
  author: v.strictObject({
75
- type: v.picklist(["person", "bot"]),
75
+ type: v.picklist(["person", "agent"]),
76
76
  id,
77
77
  name: nullableText,
78
78
  kind: v.nullable(v.picklist(["agent", "rule"])),
@@ -15,14 +15,14 @@ export declare const fact: v.StrictObjectSchema<{
15
15
  readonly occurred_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
16
16
  readonly supersedes: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
17
17
  readonly author: v.StrictObjectSchema<{
18
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
18
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
19
19
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
20
20
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
21
21
  }, undefined>;
22
22
  readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
23
23
  /** Who accepted it; `null` while it is proposed. */
24
24
  readonly confirmed_by: v.OptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
25
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
25
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
26
26
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
27
27
  }, undefined>, undefined>, undefined>;
28
28
  readonly scope: v.NullableSchema<v.PicklistSchema<readonly ["personal", "work"], undefined>, undefined>;
@@ -19,7 +19,7 @@ export const fact = v.strictObject({
19
19
  author,
20
20
  model: v.nullable(text),
21
21
  /** Who accepted it; `null` while it is proposed. */
22
- confirmed_by: v.optional(v.nullable(v.strictObject({ type: v.picklist(["person", "bot"]), id }))),
22
+ confirmed_by: v.optional(v.nullable(v.strictObject({ type: v.picklist(["person", "agent"]), id }))),
23
23
  scope: v.nullable(v.picklist(MEMORY_SCOPES)),
24
24
  /** Who recorded it: the owner, or an agent whose fact waits as proposed. */
25
25
  origin: v.picklist(["owner", "agent"]),
@@ -27,7 +27,7 @@ export declare const sourceReview: v.NullableSchema<v.StrictObjectSchema<{
27
27
  readonly cause: v.PicklistSchema<readonly ["changed", "outdated", "deleted", "contradicted"], undefined>;
28
28
  }, undefined>, undefined>;
29
29
  export declare const author: v.StrictObjectSchema<{
30
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
30
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
31
31
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
32
32
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
33
33
  }, undefined>;
@@ -25,7 +25,7 @@ export const evidenceSource = v.strictObject({
25
25
  /** The open review of a memory's or fact's sources, when one waits for the owner (`memory_source_review`). */
26
26
  export const sourceReview = v.nullable(v.strictObject({ id, cause: v.picklist(SOURCE_REVIEW_CAUSES) }));
27
27
  export const author = v.strictObject({
28
- type: v.picklist(["person", "bot"]),
28
+ type: v.picklist(["person", "agent"]),
29
29
  id,
30
30
  name: v.nullable(text),
31
31
  });
@@ -319,7 +319,7 @@ export declare const ENTITIES: {
319
319
  readonly role: v.PicklistSchema<readonly ["owner", "contact", "decision-maker", "influencer"], undefined>;
320
320
  }, undefined>, undefined>;
321
321
  readonly author: v.StrictObjectSchema<{
322
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
322
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
323
323
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
324
324
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
325
325
  readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
@@ -383,7 +383,7 @@ export declare const ENTITIES: {
383
383
  readonly role: v.PicklistSchema<readonly ["owner", "contact", "decision-maker", "influencer"], undefined>;
384
384
  }, undefined>, undefined>;
385
385
  readonly author: v.StrictObjectSchema<{
386
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
386
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
387
387
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
388
388
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
389
389
  readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
@@ -4600,7 +4600,7 @@ export declare const ENTITIES: {
4600
4600
  readonly project_key: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
4601
4601
  readonly project_name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
4602
4602
  readonly created_by: v.OptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
4603
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
4603
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
4604
4604
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
4605
4605
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4606
4606
  readonly owner: v.BooleanSchema<undefined>;
@@ -4678,7 +4678,7 @@ export declare const ENTITIES: {
4678
4678
  readonly project_key: v.StringSchema<undefined>;
4679
4679
  readonly project_name: v.StringSchema<undefined>;
4680
4680
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
4681
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
4681
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
4682
4682
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
4683
4683
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4684
4684
  readonly owner: v.BooleanSchema<undefined>;
@@ -4794,7 +4794,7 @@ export declare const ENTITIES: {
4794
4794
  readonly project_key: v.StringSchema<undefined>;
4795
4795
  readonly project_name: v.StringSchema<undefined>;
4796
4796
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
4797
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
4797
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
4798
4798
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
4799
4799
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4800
4800
  readonly owner: v.BooleanSchema<undefined>;
@@ -4911,7 +4911,7 @@ export declare const ENTITIES: {
4911
4911
  readonly project_key: v.StringSchema<undefined>;
4912
4912
  readonly project_name: v.StringSchema<undefined>;
4913
4913
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
4914
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
4914
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
4915
4915
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
4916
4916
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4917
4917
  readonly owner: v.BooleanSchema<undefined>;
@@ -5056,7 +5056,7 @@ export declare const ENTITIES: {
5056
5056
  readonly project_key: v.StringSchema<undefined>;
5057
5057
  readonly project_name: v.StringSchema<undefined>;
5058
5058
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
5059
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
5059
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
5060
5060
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5061
5061
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5062
5062
  readonly owner: v.BooleanSchema<undefined>;
@@ -5166,7 +5166,7 @@ export declare const ENTITIES: {
5166
5166
  readonly project_key: v.StringSchema<undefined>;
5167
5167
  readonly project_name: v.StringSchema<undefined>;
5168
5168
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
5169
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
5169
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
5170
5170
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5171
5171
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5172
5172
  readonly owner: v.BooleanSchema<undefined>;
@@ -5344,13 +5344,13 @@ export declare const ENTITIES: {
5344
5344
  readonly occurred_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
5345
5345
  readonly supersedes: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
5346
5346
  readonly author: v.StrictObjectSchema<{
5347
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
5347
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
5348
5348
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5349
5349
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5350
5350
  }, undefined>;
5351
5351
  readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5352
5352
  readonly confirmed_by: v.OptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
5353
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
5353
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
5354
5354
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5355
5355
  }, undefined>, undefined>, undefined>;
5356
5356
  readonly scope: v.NullableSchema<v.PicklistSchema<readonly ["personal", "work"], undefined>, undefined>;
@@ -5384,7 +5384,7 @@ export declare const ENTITIES: {
5384
5384
  readonly project: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>, undefined>;
5385
5385
  readonly project_name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
5386
5386
  readonly author: v.StrictObjectSchema<{
5387
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
5387
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
5388
5388
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5389
5389
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5390
5390
  }, undefined>;
@@ -6119,12 +6119,12 @@ export declare const ENTITIES: {
6119
6119
  readonly fingerprint: v.StringSchema<undefined>;
6120
6120
  readonly status: v.PicklistSchema<["proposed", "reviewed"], undefined>;
6121
6121
  readonly author: v.StrictObjectSchema<{
6122
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
6122
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
6123
6123
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
6124
6124
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6125
6125
  }, undefined>;
6126
6126
  readonly decided_by: v.NullableSchema<v.StrictObjectSchema<{
6127
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
6127
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
6128
6128
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
6129
6129
  }, undefined>, undefined>;
6130
6130
  readonly decided_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
@@ -6321,12 +6321,12 @@ export declare const ENTITIES: {
6321
6321
  readonly fingerprint: v.StringSchema<undefined>;
6322
6322
  readonly status: v.PicklistSchema<["proposed", "reviewed"], undefined>;
6323
6323
  readonly author: v.StrictObjectSchema<{
6324
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
6324
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
6325
6325
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
6326
6326
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6327
6327
  }, undefined>;
6328
6328
  readonly decided_by: v.NullableSchema<v.StrictObjectSchema<{
6329
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
6329
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
6330
6330
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
6331
6331
  }, undefined>, undefined>;
6332
6332
  readonly decided_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
@@ -179,12 +179,12 @@ export declare const mailFindings: v.StrictObjectSchema<{
179
179
  readonly fingerprint: v.StringSchema<undefined>;
180
180
  readonly status: v.PicklistSchema<["proposed", "reviewed"], undefined>;
181
181
  readonly author: v.StrictObjectSchema<{
182
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
182
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
183
183
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
184
184
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
185
185
  }, undefined>;
186
186
  readonly decided_by: v.NullableSchema<v.StrictObjectSchema<{
187
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
187
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
188
188
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
189
189
  }, undefined>, undefined>;
190
190
  readonly decided_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
@@ -141,7 +141,7 @@ export const mailFindings = v.strictObject({
141
141
  fingerprint: text,
142
142
  status: v.picklist(["proposed", "reviewed"]),
143
143
  author,
144
- decided_by: v.nullable(v.strictObject({ type: v.picklist(["person", "bot"]), id })),
144
+ decided_by: v.nullable(v.strictObject({ type: v.picklist(["person", "agent"]), id })),
145
145
  decided_at: v.nullable(time),
146
146
  previous: v.array(outcome),
147
147
  receipt: v.nullable(v.strictObject({ preview_fingerprint: text, accepted: v.array(id), items: v.array(outcome) })),
@@ -40,12 +40,12 @@ export declare const meetingFindings: v.StrictObjectSchema<{
40
40
  readonly fingerprint: v.StringSchema<undefined>;
41
41
  readonly status: v.PicklistSchema<["proposed", "reviewed"], undefined>;
42
42
  readonly author: v.StrictObjectSchema<{
43
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
43
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
44
44
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
45
45
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
46
46
  }, undefined>;
47
47
  readonly decided_by: v.NullableSchema<v.StrictObjectSchema<{
48
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
48
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
49
49
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
50
50
  }, undefined>, undefined>;
51
51
  readonly decided_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
@@ -32,7 +32,7 @@ export const meetingFindings = v.strictObject({
32
32
  fingerprint: text,
33
33
  status: v.picklist(["proposed", "reviewed"]),
34
34
  author,
35
- decided_by: v.nullable(v.strictObject({ type: v.picklist(["person", "bot"]), id })),
35
+ decided_by: v.nullable(v.strictObject({ type: v.picklist(["person", "agent"]), id })),
36
36
  decided_at: v.nullable(time),
37
37
  previous: v.array(outcome),
38
38
  receipt: v.nullable(v.strictObject({ preview_fingerprint: text, accepted: v.array(id), items: v.array(outcome) })),
@@ -12,7 +12,7 @@ export declare const memory: v.StrictObjectSchema<{
12
12
  readonly project: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>, undefined>;
13
13
  readonly project_name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
14
14
  readonly author: v.StrictObjectSchema<{
15
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
15
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
16
16
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
17
17
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
18
18
  }, undefined>;
@@ -45,7 +45,7 @@ const perAccount = { chats: count, messages: count, emails: count, documents: co
45
45
  const contents = {
46
46
  by_provider: v.optional(v.array(v.strictObject({ provider: text, accounts: count, ...perAccount }))),
47
47
  by_chat_kind: v.optional(v.array(v.strictObject({ provider: text, kind: text, chats: count, messages: count }))),
48
- /** `name` is the one `account list` shows; the messenger's own id for the account is left out. */
48
+ /** `name` is the one `session list` shows; the messenger's own id for the account is left out. */
49
49
  by_account: v.optional(v.array(v.strictObject({ provider: text, account_id: count, name: v.nullable(text), ...perAccount }))),
50
50
  /** Calendar years in UTC. */
51
51
  by_year: v.optional(v.array(v.strictObject({ provider: text, year: count, messages: count }))),
@@ -7,7 +7,7 @@ export declare const taskCard: v.StrictObjectSchema<{
7
7
  readonly project_key: v.StringSchema<undefined>;
8
8
  readonly project_name: v.StringSchema<undefined>;
9
9
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
10
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
10
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
11
11
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
12
12
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
13
13
  readonly owner: v.BooleanSchema<undefined>;
@@ -125,7 +125,7 @@ export declare const taskCreated: v.StrictObjectSchema<{
125
125
  readonly project_key: v.StringSchema<undefined>;
126
126
  readonly project_name: v.StringSchema<undefined>;
127
127
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
128
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
128
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
129
129
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
130
130
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
131
131
  readonly owner: v.BooleanSchema<undefined>;
@@ -244,7 +244,7 @@ export declare const taskLinks: v.UnionSchema<[v.StrictObjectSchema<{
244
244
  readonly project_key: v.StringSchema<undefined>;
245
245
  readonly project_name: v.StringSchema<undefined>;
246
246
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
247
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
247
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
248
248
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
249
249
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
250
250
  readonly owner: v.BooleanSchema<undefined>;
@@ -391,7 +391,7 @@ export declare const taskMerge: v.StrictObjectSchema<{
391
391
  readonly project_key: v.StringSchema<undefined>;
392
392
  readonly project_name: v.StringSchema<undefined>;
393
393
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
394
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
394
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
395
395
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
396
396
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
397
397
  readonly owner: v.BooleanSchema<undefined>;
@@ -503,7 +503,7 @@ export declare const taskUnmerge: v.StrictObjectSchema<{
503
503
  readonly project_key: v.StringSchema<undefined>;
504
504
  readonly project_name: v.StringSchema<undefined>;
505
505
  readonly created_by: v.NullableSchema<v.StrictObjectSchema<{
506
- readonly type: v.PicklistSchema<["person", "bot"], undefined>;
506
+ readonly type: v.PicklistSchema<["person", "agent"], undefined>;
507
507
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
508
508
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
509
509
  readonly owner: v.BooleanSchema<undefined>;