@wirecat/cli-core 0.642.0 → 0.644.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 (258) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/dist/attachments/ocr.js +27 -18
  3. package/dist/attachments/picture-reading.d.ts +51 -0
  4. package/dist/attachments/picture-reading.js +207 -0
  5. package/dist/background/backfill.d.ts +4 -2
  6. package/dist/background/backfill.js +3 -3
  7. package/dist/background/schedules.d.ts +23 -1
  8. package/dist/background/schedules.js +45 -17
  9. package/dist/background/units.d.ts +2 -0
  10. package/dist/background/units.js +8 -9
  11. package/dist/calendar/cli/index.js +10 -2
  12. package/dist/calendar/feeds.js +2 -2
  13. package/dist/calendar/server-search.js +2 -2
  14. package/dist/calendar/source.d.ts +4 -3
  15. package/dist/calendar/sync.js +12 -10
  16. package/dist/calendar/testing/source-contract.js +5 -4
  17. package/dist/calendar/testing/source.js +3 -2
  18. package/dist/cli/complete-command.d.ts +23 -0
  19. package/dist/cli/complete-command.js +80 -0
  20. package/dist/cli/context.js +7 -1
  21. package/dist/cli/effects.d.ts +2 -0
  22. package/dist/cli/effects.js +2 -0
  23. package/dist/cli/envelope.js +6 -1
  24. package/dist/cli/help/first-screen.js +5 -0
  25. package/dist/cli/index.d.ts +4 -2
  26. package/dist/cli/index.js +2 -1
  27. package/dist/cli/list-query.d.ts +3 -1
  28. package/dist/cli/list-query.js +5 -3
  29. package/dist/cli/local-only-command.js +9 -0
  30. package/dist/cli/messenger/backfill-command.js +1 -1
  31. package/dist/cli/messenger/chat-queries.js +2 -1
  32. package/dist/cli/messenger/complete-command.d.ts +4 -7
  33. package/dist/cli/messenger/complete-command.js +31 -98
  34. package/dist/cli/messenger/contacts-command.js +4 -0
  35. package/dist/cli/messenger/guard-commands.js +1 -1
  36. package/dist/cli/messenger/images-command.js +32 -0
  37. package/dist/cli/messenger/list-result-queries.d.ts +1 -0
  38. package/dist/cli/messenger/list-result-queries.js +2 -1
  39. package/dist/cli/messenger/mentions-command.js +3 -3
  40. package/dist/cli/messenger/message-items.js +1 -0
  41. package/dist/cli/messenger/messages-command.js +7 -6
  42. package/dist/cli/messenger/people-queries.d.ts +2 -2
  43. package/dist/cli/messenger/people-queries.js +4 -4
  44. package/dist/cli/messenger/search-answers.js +2 -2
  45. package/dist/cli/messenger/search-command.js +3 -3
  46. package/dist/cli/messenger/searches-command.js +1 -1
  47. package/dist/cli/messenger/store-maintenance-command.js +4 -0
  48. package/dist/cli/messenger/tasks-analysis-command.js +1 -1
  49. package/dist/cli/messenger/tasks-command.js +2 -2
  50. package/dist/cli/model-catalogue-command.js +2 -0
  51. package/dist/cli/picture-reading-command.d.ts +12 -0
  52. package/dist/cli/picture-reading-command.js +82 -0
  53. package/dist/cli/program.d.ts +6 -0
  54. package/dist/cli/program.js +28 -2
  55. package/dist/cli/schedule/agent-start.d.ts +23 -0
  56. package/dist/cli/schedule/agent-start.js +115 -0
  57. package/dist/cli/schedule/harnesses.d.ts +203 -0
  58. package/dist/cli/schedule/harnesses.js +278 -0
  59. package/dist/cli/schedule/schedule-command.d.ts +9 -5
  60. package/dist/cli/schedule/schedule-command.js +89 -79
  61. package/dist/cli/shared-command-exports.d.ts +186 -0
  62. package/dist/cli/shared-command-exports.js +2 -0
  63. package/dist/cli/untrusted-marks.d.ts +25 -0
  64. package/dist/cli/untrusted-marks.js +102 -0
  65. package/dist/crm/cli/index.d.ts +1 -0
  66. package/dist/crm/cli/index.js +6 -5
  67. package/dist/crm/cli/store.d.ts +30 -0
  68. package/dist/crm/cli/store.js +63 -0
  69. package/dist/crm/source.d.ts +6 -4
  70. package/dist/crm/sync.js +10 -6
  71. package/dist/crm/testing/source-contract.js +9 -7
  72. package/dist/crm/testing/source.js +6 -2
  73. package/dist/crm/testing/sync-contract.js +4 -4
  74. package/dist/crm/writes.d.ts +5 -2
  75. package/dist/crm/writes.js +1 -1
  76. package/dist/documents.d.ts +1 -0
  77. package/dist/documents.js +1 -0
  78. package/dist/domain/addresses.d.ts +2 -0
  79. package/dist/domain/addresses.js +7 -0
  80. package/dist/domain/attachments.d.ts +2 -0
  81. package/dist/domain/attachments.js +2 -1
  82. package/dist/domain/models.d.ts +2 -0
  83. package/dist/entities/attachment-results.d.ts +3 -0
  84. package/dist/entities/attachment-results.js +3 -0
  85. package/dist/entities/attachment.d.ts +2 -0
  86. package/dist/entities/attachment.js +8 -1
  87. package/dist/entities/hit.d.ts +1 -0
  88. package/dist/entities/index.d.ts +21 -4
  89. package/dist/entities/index.js +3 -2
  90. package/dist/entities/list-results.d.ts +33 -5
  91. package/dist/entities/list-results.js +33 -5
  92. package/dist/errors/reasons.js +31 -2
  93. package/dist/mail/cli/index.js +7 -6
  94. package/dist/mcp/agent.d.ts +2 -1
  95. package/dist/mcp/agent.js +5 -0
  96. package/dist/mcp/app-server.js +10 -0
  97. package/dist/mcp/surface.d.ts +7 -2
  98. package/dist/mcp/surface.js +49 -10
  99. package/dist/meetings/cli/index.js +6 -1
  100. package/dist/meetings/mcp/index.d.ts +15 -15
  101. package/dist/meetings/mcp/index.js +6 -3
  102. package/dist/meetings/participant-search.d.ts +2 -2
  103. package/dist/meetings/project-discovery.d.ts +1 -1
  104. package/dist/meetings/project-evidence-answer.js +2 -2
  105. package/dist/meetings/reads.d.ts +2 -2
  106. package/dist/meetings/reads.js +6 -6
  107. package/dist/meetings/store.d.ts +2 -1
  108. package/dist/meetings/testing/contract.js +6 -6
  109. package/dist/meetings/testing/memory.js +7 -2
  110. package/dist/models/ai.d.ts +1 -1
  111. package/dist/models/ai.js +3 -1
  112. package/dist/models/anthropic.js +15 -9
  113. package/dist/models/index.js +5 -3
  114. package/dist/models/openai.js +24 -11
  115. package/dist/models/types.d.ts +8 -0
  116. package/dist/models/types.js +11 -1
  117. package/dist/ports/app.d.ts +17 -1
  118. package/dist/ports/app.js +63 -3
  119. package/dist/search/lucene/plain.js +45 -3
  120. package/dist/search/lucene/registry.d.ts +15 -4
  121. package/dist/search/lucene/registry.js +70 -12
  122. package/dist/search/lucene/types.d.ts +2 -0
  123. package/dist/search/lucene/types.js +12 -0
  124. package/dist/sends/upload.d.ts +8 -1
  125. package/dist/sends/upload.js +35 -14
  126. package/dist/services/account-groups.d.ts +11 -0
  127. package/dist/services/account-groups.js +29 -0
  128. package/dist/services/agenda.js +1 -0
  129. package/dist/services/attachments.d.ts +18 -4
  130. package/dist/services/attachments.js +66 -15
  131. package/dist/services/conversations.d.ts +2 -4
  132. package/dist/services/conversations.js +1 -1
  133. package/dist/services/deal-context.js +5 -5
  134. package/dist/services/documents/ingestion.js +3 -3
  135. package/dist/services/documents/knowledge.d.ts +6 -6
  136. package/dist/services/documents/knowledge.js +1 -2
  137. package/dist/services/events-search.d.ts +3 -3
  138. package/dist/services/events-search.js +7 -7
  139. package/dist/services/index.d.ts +1 -1
  140. package/dist/services/index.js +1 -1
  141. package/dist/services/meeting-project-discovery.js +1 -1
  142. package/dist/services/message-resolution.js +10 -3
  143. package/dist/services/messages-search.js +6 -4
  144. package/dist/services/metadata.d.ts +1 -1
  145. package/dist/services/notes-search.d.ts +3 -3
  146. package/dist/services/notes-search.js +3 -3
  147. package/dist/services/organization-context.js +12 -9
  148. package/dist/services/people.d.ts +2 -0
  149. package/dist/services/people.js +4 -2
  150. package/dist/services/pictures.d.ts +9 -0
  151. package/dist/services/pictures.js +34 -28
  152. package/dist/services/project-status/index.js +1 -1
  153. package/dist/services/project-status/signals/payments.js +4 -2
  154. package/dist/services/project-status/signals/promises.js +5 -2
  155. package/dist/services/proposals/kinds/action.js +1 -1
  156. package/dist/services/proposals/kinds/fact.js +1 -1
  157. package/dist/services/proposals/kinds/findings.d.ts +2 -1
  158. package/dist/services/proposals/kinds/findings.js +12 -5
  159. package/dist/services/proposals/kinds/identity-link.js +1 -1
  160. package/dist/services/proposals/kinds/identity-split.js +1 -1
  161. package/dist/services/proposals/kinds/key-document.js +1 -1
  162. package/dist/services/proposals/kinds/mail-findings.d.ts +1 -1
  163. package/dist/services/proposals/kinds/mail-findings.js +11 -5
  164. package/dist/services/proposals/kinds/meeting-findings.js +10 -4
  165. package/dist/services/proposals/kinds/memory.js +1 -1
  166. package/dist/services/proposals/kinds/organization.js +1 -1
  167. package/dist/services/proposals/kinds/relationship-update.js +1 -1
  168. package/dist/services/proposals/kinds/relationship.js +1 -1
  169. package/dist/services/proposals/kinds/shared.d.ts +3 -2
  170. package/dist/services/proposals/kinds/shared.js +4 -4
  171. package/dist/services/proposals/kinds/source-review.js +1 -1
  172. package/dist/services/proposals/kinds/task-close.js +2 -2
  173. package/dist/services/proposals/registry.js +1 -1
  174. package/dist/services/proposals/types.d.ts +2 -1
  175. package/dist/services/search-all-business.js +3 -4
  176. package/dist/services/search-all.js +13 -14
  177. package/dist/services/searches.d.ts +2 -4
  178. package/dist/services/searches.js +1 -4
  179. package/dist/services/stored-project-gathering.js +6 -1
  180. package/dist/services/tags.d.ts +2 -4
  181. package/dist/services/tags.js +1 -1
  182. package/dist/services/tasks.d.ts +1 -1
  183. package/dist/services/tasks.js +4 -3
  184. package/dist/store/account-store.d.ts +2 -1
  185. package/dist/store/account-store.js +3 -1
  186. package/dist/store/accounts.d.ts +2 -0
  187. package/dist/store/accounts.js +8 -0
  188. package/dist/store/chats.d.ts +5 -0
  189. package/dist/store/chats.js +4 -0
  190. package/dist/store/evidence-findings.d.ts +9 -0
  191. package/dist/store/exports.d.ts +1 -1
  192. package/dist/store/exports.js +1 -1
  193. package/dist/store/identity-links.d.ts +3 -1
  194. package/dist/store/mail-findings.d.ts +9 -0
  195. package/dist/store/meeting-findings.d.ts +9 -0
  196. package/dist/store/searches.d.ts +3 -2
  197. package/dist/store/sqlite/accounts.js +37 -0
  198. package/dist/store/sqlite/agent-actions.d.ts +2 -1
  199. package/dist/store/sqlite/agent-actions.js +10 -4
  200. package/dist/store/sqlite/business-contracts.d.ts +3 -1
  201. package/dist/store/sqlite/business-contracts.js +7 -3
  202. package/dist/store/sqlite/business-search.d.ts +2 -1
  203. package/dist/store/sqlite/business-search.js +6 -4
  204. package/dist/store/sqlite/deals.d.ts +6 -4
  205. package/dist/store/sqlite/deals.js +12 -7
  206. package/dist/store/sqlite/evidence-findings.js +78 -9
  207. package/dist/store/sqlite/facts.d.ts +2 -1
  208. package/dist/store/sqlite/facts.js +6 -2
  209. package/dist/store/sqlite/finance.d.ts +4 -2
  210. package/dist/store/sqlite/finance.js +13 -6
  211. package/dist/store/sqlite/findings-core.d.ts +56 -2
  212. package/dist/store/sqlite/findings-core.js +109 -22
  213. package/dist/store/sqlite/identities.d.ts +4 -0
  214. package/dist/store/sqlite/identities.js +12 -3
  215. package/dist/store/sqlite/identity-proposals.js +34 -4
  216. package/dist/store/sqlite/lucene-fields.d.ts +2 -0
  217. package/dist/store/sqlite/lucene-fields.js +28 -2
  218. package/dist/store/sqlite/lucene.js +21 -10
  219. package/dist/store/sqlite/mail-findings.js +60 -22
  220. package/dist/store/sqlite/meeting-findings.js +53 -7
  221. package/dist/store/sqlite/meeting-participant-search.js +4 -5
  222. package/dist/store/sqlite/meetings.js +7 -3
  223. package/dist/store/sqlite/memories.d.ts +4 -2
  224. package/dist/store/sqlite/memories.js +13 -6
  225. package/dist/store/sqlite/money-transactions.d.ts +3 -1
  226. package/dist/store/sqlite/money-transactions.js +7 -3
  227. package/dist/store/sqlite/name-traces.d.ts +3 -3
  228. package/dist/store/sqlite/name-traces.js +29 -2
  229. package/dist/store/sqlite/orders.d.ts +3 -1
  230. package/dist/store/sqlite/orders.js +5 -2
  231. package/dist/store/sqlite/people-list.js +67 -22
  232. package/dist/store/sqlite/person-match-scan.d.ts +3 -1
  233. package/dist/store/sqlite/person-match-scan.js +97 -7
  234. package/dist/store/sqlite/products.d.ts +3 -1
  235. package/dist/store/sqlite/products.js +5 -2
  236. package/dist/store/sqlite/proposed-actions.d.ts +2 -1
  237. package/dist/store/sqlite/proposed-actions.js +7 -3
  238. package/dist/store/sqlite/query-filter.d.ts +4 -0
  239. package/dist/store/sqlite/query-filter.js +14 -0
  240. package/dist/store/sqlite/reads.d.ts +1 -0
  241. package/dist/store/sqlite/reads.js +14 -0
  242. package/dist/store/sqlite/records.d.ts +3 -1
  243. package/dist/store/sqlite/records.js +7 -5
  244. package/dist/store/sqlite/rows-page.d.ts +3 -0
  245. package/dist/store/sqlite/rows-page.js +4 -0
  246. package/dist/store/sqlite/searches.d.ts +2 -1
  247. package/dist/store/sqlite/searches.js +3 -1
  248. package/dist/store/sqlite/subscriptions.d.ts +5 -2
  249. package/dist/store/sqlite/subscriptions.js +13 -6
  250. package/dist/store/sqlite/task-board.js +27 -0
  251. package/dist/store/sqlite/task-find.d.ts +15 -0
  252. package/dist/store/sqlite/task-find.js +1 -0
  253. package/dist/store/sqlite/wallets.d.ts +3 -1
  254. package/dist/store/sqlite/wallets.js +7 -3
  255. package/dist/store/sqlite/work-tasks.d.ts +3 -11
  256. package/dist/store/sqlite/work-tasks.js +8 -4
  257. package/package.json +2 -2
  258. package/parity.json +24 -0
@@ -15,13 +15,15 @@ const listAll = async (source, kind, cursor) => {
15
15
  const listed = answer;
16
16
  assert.ok(Array.isArray(listed.items), `${kind}: a page has items`);
17
17
  items.push(...listed.items);
18
- if (listed.nextPage === undefined) {
18
+ assert.equal(listed.hasMore, listed.nextCursor !== undefined, `${kind}: a next cursor exactly when there is more`);
19
+ if (!listed.hasMore) {
19
20
  assert.ok(listed.cursor === null || typeof listed.cursor === "string", `${kind}: the last page gives a cursor`);
20
21
  return { items, cursor: listed.cursor ?? null };
21
22
  }
22
- assert.ok(!pages.has(listed.nextPage), `${kind}: the same page twice`);
23
- pages.add(listed.nextPage);
24
- page = listed.nextPage;
23
+ const next = listed.nextCursor;
24
+ assert.ok(!pages.has(next), `${kind}: the same page twice`);
25
+ pages.add(next);
26
+ page = next;
25
27
  }
26
28
  throw new assert.AssertionError({ message: `${kind}: more than ${MAX_PAGES} pages` });
27
29
  };
@@ -150,11 +152,11 @@ export const crmSourceContract = (make) => {
150
152
  let page;
151
153
  for (let read = 0; read < MAX_PAGES; read += 1) {
152
154
  const answer = await ids.call(source, kind, page);
153
- for (const id of answer.ids)
155
+ for (const id of answer.items)
154
156
  listed.add(id);
155
- if (answer.nextPage === undefined)
157
+ if (!answer.hasMore)
156
158
  break;
157
- page = answer.nextPage;
159
+ page = answer.nextCursor;
158
160
  }
159
161
  for (const item of items)
160
162
  assert.ok(listed.has(item.externalId), `${kind} ${item.externalId} is missing from ids()`);
@@ -249,14 +249,18 @@ export const fakeCrmSource = (options = {}) => {
249
249
  return {
250
250
  items: slice.filter(([, held]) => !held.deleted).map(([, held]) => held.record),
251
251
  ...(traits.removedInChanges ? { removed: slice.filter(([, held]) => held.deleted).map(([id]) => id) } : {}),
252
- ...(nextPage === undefined ? { cursor: String(version) } : { nextPage }),
252
+ ...(nextPage === undefined
253
+ ? { hasMore: false, cursor: String(version) }
254
+ : { hasMore: true, nextCursor: nextPage }),
253
255
  };
254
256
  },
255
257
  async ids(kind, page) {
256
258
  calls.ids += 1;
257
259
  const listed = hidden ? [] : [...of(kind).entries()].filter(([, held]) => !held.deleted).map(([id]) => id);
258
260
  const { slice, nextPage } = window(listed, page);
259
- return { ids: slice, ...(nextPage === undefined ? {} : { nextPage }) };
261
+ return nextPage === undefined
262
+ ? { items: slice, hasMore: false }
263
+ : { items: slice, hasMore: true, nextCursor: nextPage };
260
264
  },
261
265
  };
262
266
  return fake;
@@ -19,7 +19,7 @@ export const crmSyncContract = (make) => CRM_TRAIT_COMBINATIONS.flatMap((traits)
19
19
  const fixture = await make();
20
20
  const source = fakeCrmSource({ traits });
21
21
  const sync = (options = {}) => syncCrm(source, fixture.store, fixture.account, { now, ...options });
22
- const deals = async () => (await fixture.store.deals.list({ account: fixture.account, kind: "deal" }))
22
+ const deals = async () => (await fixture.store.deals.list({ account: fixture.account, kind: "deal" })).items
23
23
  .map(({ externalId }) => externalId)
24
24
  .sort();
25
25
  await check({ ...fixture, source, sync, deals });
@@ -38,7 +38,7 @@ export const crmSyncContract = (make) => CRM_TRAIT_COMBINATIONS.flatMap((traits)
38
38
  const first = await sync();
39
39
  assert.equal(first.state, "complete");
40
40
  assert.deepEqual(await deals(), ["d1", "d2", "d3"]);
41
- assert.equal((await store.deals.list({ account, kind: "lead" })).length, 1);
41
+ assert.equal((await store.deals.list({ account, kind: "lead" })).items.length, 1);
42
42
  assert.ok(first.synced.every(({ round }) => round === "full"));
43
43
  source.put("deal", exampleDeal("d2", { stage: "won", title: "Example deal won" }));
44
44
  const second = await sync();
@@ -48,7 +48,7 @@ export const crmSyncContract = (make) => CRM_TRAIT_COMBINATIONS.flatMap((traits)
48
48
  ["deal", "changes", 1],
49
49
  ["lead", "changes", 0],
50
50
  ]);
51
- const [won] = await store.deals.list({ account, status: "won" });
51
+ const { items: [won], } = await store.deals.list({ account, status: "won" });
52
52
  assert.equal(won?.title, "Example deal won");
53
53
  }),
54
54
  test("marks deleted what the CRM deleted, after a complete list at the latest", async ({ source, sync, deals, }) => {
@@ -163,7 +163,7 @@ export const crmSyncContract = (make) => CRM_TRAIT_COMBINATIONS.flatMap((traits)
163
163
  source.put("person", examplePerson("p1", { email: "person@example.com" }));
164
164
  source.put("deal", exampleDeal("d1", { organization: "c1", people: [{ externalId: "p1", role: "contact" }] }));
165
165
  await sync();
166
- const [deal] = await store.deals.list({ account });
166
+ const { items: [deal], } = await store.deals.list({ account });
167
167
  assert.notEqual(deal?.organization?.ref, own.ref);
168
168
  assert.equal(deal?.organization?.name, "Example company c1");
169
169
  const person = await store.people.personOf({ provider: "email", id: "person@example.com" });
@@ -14,8 +14,11 @@ import { type CrmVerb, type CrmWriter } from "./writer.js";
14
14
  export interface CrmWrites {
15
15
  writer: CrmWriter;
16
16
  app: AppIdentity;
17
- /** The profile's levels, read on every write so a config change applies at once. */
18
- settings: () => GuardSettings;
17
+ /**
18
+ * The profile's levels, read on every write so a config change applies at once. A CRM limits its own rate, so
19
+ * `sendsPerHour` is not read: the guard is there for the levels and the journal.
20
+ */
21
+ settings: () => Omit<GuardSettings, "sendsPerHour"> & Partial<Pick<GuardSettings, "sendsPerHour">>;
19
22
  /** The CRM user the sign-in acts as. An owner other than it checks `crm.assign-others`; left out, every owner does. */
20
23
  self?: string;
21
24
  env?: NodeJS.ProcessEnv;
@@ -226,7 +226,7 @@ const keysOf = (context, kind, verb, { stage, owner }) => {
226
226
  const guardOf = (context, extra) => {
227
227
  const settings = context.writes.settings();
228
228
  const defaults = { ...DEFAULT_PERMISSIONS, ...CRM_WRITE_DEFAULTS, ...settings.permissionDefaults };
229
- return keyedGuard((ask) => guardFor(context.writes.app, { ...settings, permissionDefaults: defaults }, context.writes.warn ?? (() => { }), context.writes.env, ask), context.ask, (key) => levelFor(settings.permissions, key, defaults).level, extra);
229
+ return keyedGuard((ask) => guardFor(context.writes.app, { ...settings, sendsPerHour: Number.MAX_SAFE_INTEGER, permissionDefaults: defaults }, context.writes.warn ?? (() => { }), context.writes.env, ask), context.ask, (key) => levelFor(settings.permissions, key, defaults).level, extra);
230
230
  };
231
231
  /** Sends the write once, never again: a lost answer is `outcome_unknown`, with what the owner may do about it. */
232
232
  const written = async (context, { key, extra }, operationId, act) => {
@@ -3,6 +3,7 @@ export type { Engine, Extraction, FileHint, LoadEngine } from "./attachments/ext
3
3
  export { extractText, importEngine, MAX_FILE_BYTES, MAX_TEXT_CHARS } from "./attachments/extract.js";
4
4
  export { attachmentMaxBytes } from "./attachments/limits.js";
5
5
  export { type OcrPipeline, ocrImage } from "./attachments/ocr.js";
6
+ export { agentPictureReader, PICTURE_AGENTS, type PictureAgent, type PictureReadingSetting, pictureExtractor, pictureReaderOf, readPictureReading, readPictureWithAgent, } from "./attachments/picture-reading.js";
6
7
  export type { Sheet, SheetCell } from "./attachments/sheets.js";
7
8
  export { columnName, sheetText } from "./attachments/sheets.js";
8
9
  export * from "./documents/index.js";
package/dist/documents.js CHANGED
@@ -2,6 +2,7 @@ export { readSpreadsheet } from "./attachments/documents.js";
2
2
  export { extractText, importEngine, MAX_FILE_BYTES, MAX_TEXT_CHARS } from "./attachments/extract.js";
3
3
  export { attachmentMaxBytes } from "./attachments/limits.js";
4
4
  export { ocrImage } from "./attachments/ocr.js";
5
+ export { agentPictureReader, PICTURE_AGENTS, pictureExtractor, pictureReaderOf, readPictureReading, readPictureWithAgent, } from "./attachments/picture-reading.js";
5
6
  export { columnName, sheetText } from "./attachments/sheets.js";
6
7
  export * from "./documents/index.js";
7
8
  export { isPublicAddress } from "./fetch/addresses.js";
@@ -9,5 +9,7 @@ export declare const ROLE_ADDRESS_WORDS: {
9
9
  };
10
10
  /** Whether the whole local part, `+tag` and `.`/`-`/`_` aside, is a role word: `info@`, `Hello+news@`, `no_reply@`. */
11
11
  export declare const isRoleAddress: (address: string) => boolean;
12
+ /** Whether the address is a role address that one person often reads alone, such as `hr@`. */
13
+ export declare const isPersonLikeRoleAddress: (address: string) => boolean;
12
14
  /** Whether the address is a no-reply one, which belongs to no person. */
13
15
  export declare const isNoReplyAddress: (address: string) => boolean;
@@ -59,5 +59,12 @@ const localWord = (address) => {
59
59
  };
60
60
  /** Whether the whole local part, `+tag` and `.`/`-`/`_` aside, is a role word: `info@`, `Hello+news@`, `no_reply@`. */
61
61
  export const isRoleAddress = (address) => ROLE.has(localWord(address));
62
+ /**
63
+ * Role words that one person often reads alone: a small company's `hr@` is its HR manager. Still a role address, so it
64
+ * joins no one, but weaker evidence of a company's mailbox than `info@`, and it never makes a contact a company.
65
+ */
66
+ const PERSON_LIKE = new Set(["hr"]);
67
+ /** Whether the address is a role address that one person often reads alone, such as `hr@`. */
68
+ export const isPersonLikeRoleAddress = (address) => PERSON_LIKE.has(localWord(address));
62
69
  /** Whether the address is a no-reply one, which belongs to no person. */
63
70
  export const isNoReplyAddress = (address) => NO_REPLY.has(localWord(address));
@@ -7,6 +7,8 @@ export interface HitFile {
7
7
  kind: string;
8
8
  name?: string;
9
9
  size?: number;
10
+ /** The saved copy on this computer, once `messages download` fetched it. */
11
+ local_path?: string;
10
12
  }
11
13
  export declare const hitFiles: (attachments: readonly Attachment[] | undefined) => HitFile[];
12
14
  /** The stored kinds `has:<kind>` matches: MAX stores a file as `file`, Telegram as `document`. */
@@ -11,7 +11,7 @@ export const NOT_FILES = new Set([
11
11
  ]);
12
12
  // The position is taken before the filter: the store numbers every attachment, and `--attachment` takes that number.
13
13
  // A server search hit built by an adapter may come without attachments at all.
14
- export const hitFiles = (attachments) => (attachments ?? []).flatMap(({ kind, name, size }, index) => NOT_FILES.has(kind)
14
+ export const hitFiles = (attachments) => (attachments ?? []).flatMap(({ kind, name, size, localPath }, index) => NOT_FILES.has(kind)
15
15
  ? []
16
16
  : [
17
17
  {
@@ -19,6 +19,7 @@ export const hitFiles = (attachments) => (attachments ?? []).flatMap(({ kind, na
19
19
  kind,
20
20
  ...(name === undefined ? {} : { name }),
21
21
  ...(size === undefined ? {} : { size }),
22
+ ...(localPath === undefined ? {} : { local_path: localPath }),
22
23
  },
23
24
  ]);
24
25
  /** The stored kinds `has:<kind>` matches: MAX stores a file as `file`, Telegram as `document`. */
@@ -191,6 +191,8 @@ export interface Attachment {
191
191
  duration?: number;
192
192
  /** What the adapter needs to fetch the bytes later. Opaque above the adapter. */
193
193
  providerRef?: ProviderMetadata;
194
+ /** Where `messages download` saved the file on this computer; only the store knows it. */
195
+ localPath?: string;
194
196
  /** A bot's keyboard under the message, row by row. */
195
197
  buttons?: Button[][];
196
198
  /** The poll the message carries, as it stood when read; drawn for a person, not part of the JSON answer. */
@@ -93,4 +93,7 @@ export declare const attachmentTextChange: v.StrictObjectSchema<{
93
93
  readonly origin: v.LiteralSchema<"agent", undefined>;
94
94
  readonly chars: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
95
95
  readonly replaced: v.NullableSchema<v.PicklistSchema<["extracted", "agent"], undefined>, undefined>;
96
+ /** `images read` only: who read the picture, `agent:claude` or `agent:codex/<model>`, and what it read. */
97
+ readonly extractor: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
98
+ readonly text: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
96
99
  }, undefined>;
@@ -28,4 +28,7 @@ export const attachmentTextChange = v.strictObject({
28
28
  origin: v.literal("agent"),
29
29
  chars: count,
30
30
  replaced: v.nullable(v.picklist(["extracted", "agent"])),
31
+ /** `images read` only: who read the picture, `agent:claude` or `agent:codex/<model>`, and what it read. */
32
+ extractor: v.optional(text),
33
+ text: v.optional(text),
31
34
  });
@@ -45,4 +45,6 @@ export declare const hitFile: v.StrictObjectSchema<{
45
45
  readonly kind: v.StringSchema<undefined>;
46
46
  readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
47
47
  readonly size: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
48
+ /** The saved copy on this computer, once `messages download` fetched it; absent until then. */
49
+ readonly local_path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
48
50
  }, undefined>;
@@ -36,4 +36,11 @@ export const attachment = v.strictObject({
36
36
  })))),
37
37
  });
38
38
  /** A file named on a search hit: `position` is the one `attachments show` and `messages download` take. */
39
- export const hitFile = v.strictObject({ position: count, kind: text, name: v.optional(text), size: v.optional(count) });
39
+ export const hitFile = v.strictObject({
40
+ position: count,
41
+ kind: text,
42
+ name: v.optional(text),
43
+ size: v.optional(count),
44
+ /** The saved copy on this computer, once `messages download` fetched it; absent until then. */
45
+ local_path: v.optional(text),
46
+ });
@@ -55,6 +55,7 @@ export declare const hit: v.StrictObjectSchema<{
55
55
  readonly kind: v.StringSchema<undefined>;
56
56
  readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
57
  readonly size: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
58
+ readonly local_path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
58
59
  }, undefined>, undefined>, undefined>;
59
60
  /** Absent on a note hit: the owner wrote it. */
60
61
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
@@ -40,7 +40,7 @@ import { inviteLink } from "./invite-link.js";
40
40
  import { job } from "./job.js";
41
41
  import { joinRequest } from "./join-request.js";
42
42
  import { organization, project, reminder } from "./knowledge-lists.js";
43
- import { botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, callRecord, scheduledJob, stickerInventory, topicIcon } from "./list-results.js";
43
+ import { botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, callRecord, scheduledJob, scheduleHarness, stickerInventory, topicIcon } from "./list-results.js";
44
44
  import { messageEvent, serveSummary, watchedMessage, watchItem } from "./listener.js";
45
45
  import { mailCounts } from "./mail-counts.js";
46
46
  import { mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer } from "./media-archive.js";
@@ -91,7 +91,7 @@ import { topic } from "./topic.js";
91
91
  * subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
92
92
  * is the target, not a description of today's output.
93
93
  */
94
- export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
94
+ export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, scheduleHarness, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
95
95
  export declare const ENTITIES: {
96
96
  readonly meeting_ingestion: v.StrictObjectSchema<{
97
97
  readonly meetings: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1459,6 +1459,7 @@ export declare const ENTITIES: {
1459
1459
  readonly kind: v.StringSchema<undefined>;
1460
1460
  readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1461
1461
  readonly size: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
1462
+ readonly local_path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1462
1463
  }, undefined>, undefined>, undefined>;
1463
1464
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
1464
1465
  }, undefined>;
@@ -4248,9 +4249,22 @@ export declare const ENTITIES: {
4248
4249
  readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4249
4250
  }, undefined>, undefined>, undefined>;
4250
4251
  }, undefined>, undefined>;
4251
- readonly spent_today_usd: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
4252
+ readonly harness: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
4253
+ readonly reports_cost: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
4254
+ readonly spent_today_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
4252
4255
  readonly max_cost_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
4253
- readonly max_cost_per_day_usd: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
4256
+ readonly max_cost_per_day_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
4257
+ }, undefined>;
4258
+ readonly schedule_harness: v.StrictObjectSchema<{
4259
+ readonly id: v.StringSchema<undefined>;
4260
+ readonly name: v.StringSchema<undefined>;
4261
+ readonly programs: v.ArraySchema<v.StringSchema<undefined>, undefined>;
4262
+ readonly reports_cost: v.BooleanSchema<undefined>;
4263
+ readonly restricted: v.BooleanSchema<undefined>;
4264
+ readonly restricted_reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4265
+ readonly allowed_with_ack: v.BooleanSchema<undefined>;
4266
+ readonly installed: v.BooleanSchema<undefined>;
4267
+ readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
4254
4268
  }, undefined>;
4255
4269
  readonly call_record: v.StrictObjectSchema<{
4256
4270
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
@@ -4363,6 +4377,7 @@ export declare const ENTITIES: {
4363
4377
  readonly kind: v.StringSchema<undefined>;
4364
4378
  readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4365
4379
  readonly size: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
4380
+ readonly local_path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4366
4381
  }, undefined>, undefined>, undefined>;
4367
4382
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
4368
4383
  }, undefined>;
@@ -4521,6 +4536,8 @@ export declare const ENTITIES: {
4521
4536
  readonly origin: v.LiteralSchema<"agent", undefined>;
4522
4537
  readonly chars: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
4523
4538
  readonly replaced: v.NullableSchema<v.PicklistSchema<["extracted", "agent"], undefined>, undefined>;
4539
+ readonly extractor: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4540
+ readonly text: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4524
4541
  }, undefined>;
4525
4542
  readonly media_archive: v.StrictObjectSchema<{
4526
4543
  readonly directory: v.StringSchema<undefined>;
@@ -44,7 +44,7 @@ import { inviteLink } from "./invite-link.js";
44
44
  import { job } from "./job.js";
45
45
  import { joinRequest } from "./join-request.js";
46
46
  import { organization, project, reminder } from "./knowledge-lists.js";
47
- import { botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, callRecord, scheduledJob, stickerInventory, topicIcon, } from "./list-results.js";
47
+ import { botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, callRecord, scheduledJob, scheduleHarness, stickerInventory, topicIcon, } from "./list-results.js";
48
48
  import { messageEvent, serveSummary, watchedMessage, watchItem } from "./listener.js";
49
49
  import { mailCounts } from "./mail-counts.js";
50
50
  import { mailFindings } from "./mail-findings.js";
@@ -100,7 +100,7 @@ import { topic } from "./topic.js";
100
100
  * subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
101
101
  * is the target, not a description of today's output.
102
102
  */
103
- export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
103
+ export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, scheduleHarness, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
104
104
  export const ENTITIES = {
105
105
  sync_progress: syncProgress,
106
106
  deal,
@@ -207,6 +207,7 @@ export const ENTITIES = {
207
207
  topic_icon: topicIcon,
208
208
  bot_webhook: botWebhook,
209
209
  scheduled_job: scheduledJob,
210
+ schedule_harness: scheduleHarness,
210
211
  call_record: callRecord,
211
212
  sticker_inventory: stickerInventory,
212
213
  note,
@@ -81,12 +81,40 @@ export declare const scheduledJob: v.StrictObjectSchema<{
81
81
  readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
82
82
  }, undefined>, undefined>, undefined>;
83
83
  }, undefined>, undefined>;
84
- /** Agent schedules: what today's runs cost, in US dollars. */
85
- readonly spent_today_usd: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
86
- /** Agent schedules: the cap on one run (`--max-cost`), null when none. */
84
+ /** Agent schedules: the agent it starts, as `schedule agents list` names it; null for a program no agent here runs. */
85
+ readonly harness: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
86
+ /** Agent schedules: whether the agent reports what a run cost; when it does not, the cost fields are null. */
87
+ readonly reports_cost: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
88
+ /** Agent schedules: what today's runs cost, in US dollars; null when the agent reports no cost (unknown, not 0). */
89
+ readonly spent_today_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
90
+ /** Agent schedules: the cap on one run (`--max-cost`), null when none or when the agent reports no cost. */
87
91
  readonly max_cost_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
88
- /** Agent schedules: the daily cap in force, the schedule's `--max-cost-per-day` or the config's; 0 for none. */
89
- readonly max_cost_per_day_usd: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
92
+ /**
93
+ * Agent schedules: the daily cap in force, the schedule's `--max-cost-per-day` or the config's; 0 for none; null when
94
+ * the agent reports no cost, so no cap can stop it.
95
+ */
96
+ readonly max_cost_per_day_usd: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
97
+ }, undefined>;
98
+ /** One agent `schedule agents list` answers: an id `schedule agent` takes, and whether its program is on PATH. */
99
+ export declare const scheduleHarness: v.StrictObjectSchema<{
100
+ readonly id: v.StringSchema<undefined>;
101
+ readonly name: v.StringSchema<undefined>;
102
+ /** The program names it is found by on PATH, the first found wins. */
103
+ readonly programs: v.ArraySchema<v.StringSchema<undefined>, undefined>;
104
+ /** It reports what a run costs, so `--max-cost` and `--max-cost-per-day` hold. */
105
+ readonly reports_cost: v.BooleanSchema<undefined>;
106
+ /** The agent's own limits hold a one-shot run to the CLIs' commands (claude, gemini, opencode). */
107
+ readonly restricted: v.BooleanSchema<undefined>;
108
+ /** Why an agent that is not restricted is not, and what it may still do: a client shows it before the owner picks. */
109
+ readonly restricted_reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
110
+ /**
111
+ * Not restricted, yet a schedule starts it once the owner accepts that with `--allow-dangerous` (codex, whose sandbox
112
+ * blocks the network and most writes); refused without it (`agent.unrestricted`). False for the rest.
113
+ */
114
+ readonly allowed_with_ack: v.BooleanSchema<undefined>;
115
+ readonly installed: v.BooleanSchema<undefined>;
116
+ /** Where its program is, or null when it is not on PATH. */
117
+ readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
90
118
  }, undefined>;
91
119
  export declare const botTemplate: v.StrictObjectSchema<{
92
120
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -65,12 +65,40 @@ export const scheduledJob = v.strictObject({
65
65
  error: v.optional(text),
66
66
  }))),
67
67
  })),
68
- /** Agent schedules: what today's runs cost, in US dollars. */
69
- spent_today_usd: v.optional(v.number()),
70
- /** Agent schedules: the cap on one run (`--max-cost`), null when none. */
68
+ /** Agent schedules: the agent it starts, as `schedule agents list` names it; null for a program no agent here runs. */
69
+ harness: v.optional(v.nullable(text)),
70
+ /** Agent schedules: whether the agent reports what a run cost; when it does not, the cost fields are null. */
71
+ reports_cost: v.optional(v.boolean()),
72
+ /** Agent schedules: what today's runs cost, in US dollars; null when the agent reports no cost (unknown, not 0). */
73
+ spent_today_usd: v.optional(v.nullable(v.number())),
74
+ /** Agent schedules: the cap on one run (`--max-cost`), null when none or when the agent reports no cost. */
71
75
  max_cost_usd: v.optional(v.nullable(v.number())),
72
- /** Agent schedules: the daily cap in force, the schedule's `--max-cost-per-day` or the config's; 0 for none. */
73
- max_cost_per_day_usd: v.optional(v.number()),
76
+ /**
77
+ * Agent schedules: the daily cap in force, the schedule's `--max-cost-per-day` or the config's; 0 for none; null when
78
+ * the agent reports no cost, so no cap can stop it.
79
+ */
80
+ max_cost_per_day_usd: v.optional(v.nullable(v.number())),
81
+ });
82
+ /** One agent `schedule agents list` answers: an id `schedule agent` takes, and whether its program is on PATH. */
83
+ export const scheduleHarness = v.strictObject({
84
+ id: text,
85
+ name: text,
86
+ /** The program names it is found by on PATH, the first found wins. */
87
+ programs: v.array(text),
88
+ /** It reports what a run costs, so `--max-cost` and `--max-cost-per-day` hold. */
89
+ reports_cost: v.boolean(),
90
+ /** The agent's own limits hold a one-shot run to the CLIs' commands (claude, gemini, opencode). */
91
+ restricted: v.boolean(),
92
+ /** Why an agent that is not restricted is not, and what it may still do: a client shows it before the owner picks. */
93
+ restricted_reason: v.nullable(text),
94
+ /**
95
+ * Not restricted, yet a schedule starts it once the owner accepts that with `--allow-dangerous` (codex, whose sandbox
96
+ * blocks the network and most writes); refused without it (`agent.unrestricted`). False for the rest.
97
+ */
98
+ allowed_with_ack: v.boolean(),
99
+ installed: v.boolean(),
100
+ /** Where its program is, or null when it is not on PATH. */
101
+ path: v.nullable(text),
74
102
  });
75
103
  export const botTemplate = v.strictObject({
76
104
  name: v.nullable(text),
@@ -14,7 +14,11 @@ const QUERY = [
14
14
  ["query.invalid-tag", "a tag in the query is not valid"],
15
15
  ["query.invalid-topic", "a topic in the query is not valid"],
16
16
  ["query.topic-scope", "a topic needs its chat in the query"],
17
- ].map(([reason, message]) => validation(reason, message));
17
+ ["query.short-text", "a search by part of a name or a title needs three characters or more"],
18
+ ["query.legacy-date-field", "after: and before: are written date>= and date<"],
19
+ ]
20
+ .map(([reason, message]) => validation(reason, message))
21
+ .concat([["query.no-match", "not_found", "no person or chat in the store fits a name in the query"]]);
18
22
  const SIGN_IN = [
19
23
  ["oauth.declined", "authentication_error", "the provider's consent was declined"],
20
24
  ["oauth.timeout", "timeout", "the sign-in was not finished in time"],
@@ -63,6 +67,11 @@ const OTHERS = [
63
67
  ["model.offline", "permission_error", "downloading a model needs the network; --offline was requested"],
64
68
  ["model.key-rejected", "invalid_response", "the model provider refused the API key (401 or 403)"],
65
69
  ["model.unreachable", "invalid_response", "the model provider could not be reached over the network"],
70
+ [
71
+ "model.empty-answer",
72
+ "invalid_response",
73
+ "the model answered nothing; given a picture, it may not read pictures — choose a vision model",
74
+ ],
66
75
  validation("model.address-refused", "the model address must be https, or http only on this computer"),
67
76
  [
68
77
  "local-only.refused",
@@ -71,13 +80,21 @@ const OTHERS = [
71
80
  ],
72
81
  ["local-only.owner-only", "permission_error", "only the owner turns local only off, not an agent"],
73
82
  ["ai.images-not-allowed", "permission_error", "the AI model may not read pictures; models ai set --allow-remote"],
83
+ ["picture-reading.off", "permission_error", "picture reading is never; models picture-reading set request"],
84
+ ["picture-reading.owner-only", "permission_error", "only the owner turns picture reading on, not an agent"],
85
+ validation("picture-reading.agent-missing", "choose the agent that reads: --agent claude or --agent codex"),
86
+ validation("picture-reading.not-a-picture", "the file is not a PNG, JPEG or WebP picture"),
87
+ ["picture-reading.unavailable-file", "not_found", "the picture could not be fetched, or is over the size limit"],
88
+ ["picture-reading.unavailable", "configuration_error", "the chosen coding agent is not installed"],
89
+ ["picture-reading.failed", "invalid_response", "the coding agent failed or answered nothing"],
90
+ ["picture-reading.timeout", "timeout", "the coding agent gave no answer in time"],
74
91
  [
75
92
  "ai.owner-only",
76
93
  "permission_error",
77
94
  "only the owner chooses, unsets, checks or removes the AI model and its key, or revokes its consent",
78
95
  ],
79
96
  ["ai.setting-invalid", "configuration_error", "the ai section or the model given is not one WireCat can use"],
80
- validation("ai.address-refused", "the model address must be https, or http only on this computer"),
97
+ validation("ai.address-refused", "the AI model setting names an address WireCat refuses: plain http to another computer, or Ollama off this computer"),
81
98
  ["ai.not-set", "configuration_error", "no AI model is chosen; models ai set chooses one"],
82
99
  ["ai.key-missing", "configuration_error", "no API key is stored for the AI model's address"],
83
100
  ["ai.ok", "invalid_response", "models ai check: the model answered (a result, never raised)"],
@@ -105,6 +122,18 @@ const OTHERS = [
105
122
  validation("finding.unknown-field", "a finding has a field its kind does not take"),
106
123
  validation("finding.quote-not-found", "a finding's quote is not in the text it cites, word for word"),
107
124
  validation("finding.missing-field", "a finding leaves out a field its kind needs"),
125
+ [
126
+ "agent.unrestricted",
127
+ "permission_error",
128
+ "nothing holds this agent to the CLI's commands, so no schedule starts it",
129
+ ],
130
+ ["read-only.output-outside", "permission_error", "a read-only process writes files only inside its working folder"],
131
+ [
132
+ "agent.refused",
133
+ "permission_error",
134
+ "the schedule changed since it was saved, or starts no agent a schedule may run",
135
+ ],
136
+ validation("agent.cost-unknown", "the agent reports no cost, so a cost cap cannot stop it"),
108
137
  validation("document.changed", "the document changed while it was read; nothing was saved"),
109
138
  ["document.not-imported", "not_found", "the document is not imported in this source account"],
110
139
  ["extraction.invalid-proposals", "invalid_response", "the model's memory proposals could not be used"],
@@ -12,6 +12,7 @@ import { answerLocally } from "../../cli/local-times.js";
12
12
  import { messagesAnswer, offsetOf, shownOf } from "../../cli/messenger/search-answers.js";
13
13
  import { backendRequest, noteServer, serverSearchOptions } from "../../cli/messenger/search-backend-options.js";
14
14
  import { positiveCount } from "../../cli/paging.js";
15
+ import { marksUntrusted } from "../../cli/untrusted-marks.js";
15
16
  import { formatReference, parseReference } from "../../domain/references.js";
16
17
  import { count, reference, text, time, untrusted } from "../../entities/fields.js";
17
18
  import { POLICY_SKIPS } from "../../mail/attachments.js";
@@ -213,13 +214,13 @@ Search guide: https://github.com/WireCatLabs/cli-core/blob/main/docs/search/quer
213
214
  const shownText = (emails, local) => `${emails.map((email) => [hitText(email, "full", local), attachmentsText(email)].filter(Boolean).join("\n")).join("\n\n")}\n`;
214
215
  const messagesCommand = (mail) => {
215
216
  const messages = new Command("messages").summary("read stored emails").description("read the emails sync stored");
216
- annotate(messages.command("show"), {
217
+ marksUntrusted(annotate(messages.command("show"), {
217
218
  effects: mail.whole ? FETCH : LOCAL_READ,
218
219
  examples: [
219
220
  `${mail.app.command} personal messages show 'msg:email/me%40example.com/thread-1/%3Cid%40example.com%3E'`,
220
221
  `${mail.app.command} personal messages show 'msg:email/me%40example.com/thread-1/%3Cid%40example.com%3E' --before-n 2`,
221
222
  ],
222
- })
223
+ }))
223
224
  .summary("one stored email whole, with the text of its attachments")
224
225
  .description("one stored email: its people, folders, whole text and the first 4000 characters of each attachment's text; " +
225
226
  "--full gives all of it and the HTML body. The store keeps text, not the original message source")
@@ -279,13 +280,13 @@ const conversationsCommand = (mail) => {
279
280
  const conversations = new Command("conversations")
280
281
  .summary("email threads")
281
282
  .description("the threads of the stored mail: an email and its replies");
282
- const list = withQuery(annotate(conversations.command("list"), {
283
+ const list = withQuery(marksUntrusted(annotate(conversations.command("list"), {
283
284
  effects: LOCAL_READ,
284
285
  examples: [
285
286
  `${mail.app.command} personal conversations list`,
286
287
  `${mail.app.command} personal conversations list subject:invoice emails_count>1`,
287
288
  ],
288
- })
289
+ }))
289
290
  .summary("stored email threads, newest first")
290
291
  .description("this profile's email threads, the newest activity first: subject, how many emails, when"), THREAD_QUERY)
291
292
  .option("--limit <n>", `how many, at most ${MAX_LIMIT}`, limitOf)
@@ -327,13 +328,13 @@ const conversationsCommand = (mail) => {
327
328
  .join(""));
328
329
  });
329
330
  answerEntity(list, "mail_thread", mailThread);
330
- annotate(conversations.command("show"), {
331
+ marksUntrusted(annotate(conversations.command("show"), {
331
332
  effects: LOCAL_READ,
332
333
  examples: [
333
334
  `${mail.app.command} personal conversations show 'chat:email/me%40example.com/thread-1'`,
334
335
  `${mail.app.command} personal conversations show 'msg:email/me%40example.com/thread-1/%3Cid%40example.com%3E'`,
335
336
  ],
336
- })
337
+ }))
337
338
  .summary("one email thread, every email oldest first")
338
339
  .description("every stored email of one thread, oldest first, each with the text of its attachments")
339
340
  .argument("<conversation>", "a chat:email/… thread from conversations list, or a msg:email/… email in it")
@@ -48,6 +48,8 @@ export interface AgentTool {
48
48
  path: readonly string[];
49
49
  title: string;
50
50
  description: string;
51
+ /** The words of its help's examples, flags left out: tools search reads them for the words a task is typed in. */
52
+ keywords?: readonly string[];
51
53
  writes: boolean;
52
54
  input: v.ObjectSchema<v.ObjectEntries, undefined>;
53
55
  /** The entity it answers with, when the command declares one. */
@@ -79,7 +81,6 @@ export interface CatalogueOptions {
79
81
  /** What a command reads on stdin, as the field an agent gives it in. */
80
82
  stdin?: (path: readonly string[]) => StdinField | undefined;
81
83
  }
82
- /** Build the discoverable command catalogue; profile permissions annotate availability. */
83
84
  export declare const toolsFromCommands: (commands: readonly CommandInfo[], options?: CatalogueOptions) => AgentTool[];
84
85
  /**
85
86
  * Runs one command for an agent through the CLI itself, in this process: the same parsing, guard, answer and