@wirecat/cli-core 0.648.0 → 0.650.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 (85) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/dist/analysis/anthropic.js +2 -1
  3. package/dist/background/daily-archive-timer.d.ts +1 -1
  4. package/dist/cli/account-remove.d.ts +2 -0
  5. package/dist/cli/account-remove.js +46 -10
  6. package/dist/cli/messenger/messages-search-command.js +6 -1
  7. package/dist/cli/messenger/search-answers.d.ts +3 -1
  8. package/dist/cli/messenger/search-answers.js +3 -1
  9. package/dist/cli/steps.js +9 -0
  10. package/dist/cli/unknown-profile.js +1 -0
  11. package/dist/constants/index.d.ts +6 -0
  12. package/dist/constants/index.js +14 -0
  13. package/dist/crm/cli/index.js +30 -5
  14. package/dist/crm/source.d.ts +8 -1
  15. package/dist/crm/stage-tasks.d.ts +3 -1
  16. package/dist/crm/stage-tasks.js +8 -4
  17. package/dist/crm/sync.d.ts +1 -1
  18. package/dist/crm/sync.js +54 -0
  19. package/dist/domain/crm.d.ts +15 -0
  20. package/dist/domain/phones.d.ts +2 -0
  21. package/dist/domain/phones.js +3 -0
  22. package/dist/domain/providers.d.ts +4 -1
  23. package/dist/domain/providers.js +9 -2
  24. package/dist/domain/record-types.d.ts +24 -3
  25. package/dist/domain/record-types.js +23 -2
  26. package/dist/domain/records-table.js +4 -3
  27. package/dist/domain/records.d.ts +1 -1
  28. package/dist/domain/records.js +3 -2
  29. package/dist/entities/contact-context.d.ts +6 -0
  30. package/dist/entities/contact-context.js +3 -0
  31. package/dist/entities/deal.d.ts +4 -0
  32. package/dist/entities/deal.js +3 -0
  33. package/dist/entities/index.d.ts +12 -0
  34. package/dist/entities/recorded-meeting.d.ts +17 -0
  35. package/dist/entities/recorded-meeting.js +15 -0
  36. package/dist/errors/reasons.js +3 -4
  37. package/dist/index.d.ts +1 -1
  38. package/dist/meetings/answers.d.ts +5 -0
  39. package/dist/meetings/answers.js +3 -0
  40. package/dist/meetings/index.d.ts +1 -1
  41. package/dist/meetings/participant-search.d.ts +5 -0
  42. package/dist/meetings/pull.js +2 -1
  43. package/dist/meetings/read-answers.d.ts +4 -0
  44. package/dist/meetings/read-answers.js +1 -0
  45. package/dist/meetings/source.d.ts +5 -0
  46. package/dist/meetings/store.d.ts +10 -1
  47. package/dist/models/ai.js +2 -2
  48. package/dist/models/endpoint.d.ts +7 -0
  49. package/dist/models/endpoint.js +10 -0
  50. package/dist/models/index.js +2 -2
  51. package/dist/oauth/keeper.js +1 -1
  52. package/dist/sends/guard.js +8 -6
  53. package/dist/services/communications.d.ts +2 -2
  54. package/dist/services/communications.js +24 -2
  55. package/dist/services/document-source.js +9 -1
  56. package/dist/services/meeting-model.js +2 -1
  57. package/dist/services/notes-search.d.ts +10 -5
  58. package/dist/services/notes-search.js +19 -7
  59. package/dist/services/person-context.d.ts +3 -0
  60. package/dist/services/person-context.js +9 -1
  61. package/dist/services/person-meetings.d.ts +36 -0
  62. package/dist/services/person-meetings.js +57 -0
  63. package/dist/services/search-all.js +18 -10
  64. package/dist/speech/openai.js +5 -2
  65. package/dist/store/sqlite/added-sources.d.ts +38 -0
  66. package/dist/store/sqlite/added-sources.js +80 -50
  67. package/dist/store/sqlite/crm-settings.d.ts +5 -1
  68. package/dist/store/sqlite/crm-settings.js +8 -0
  69. package/dist/store/sqlite/crm-stage-entries.d.ts +15 -0
  70. package/dist/store/sqlite/crm-stage-entries.js +74 -0
  71. package/dist/store/sqlite/crm.d.ts +8 -1
  72. package/dist/store/sqlite/crm.js +7 -1
  73. package/dist/store/sqlite/identities.js +3 -1
  74. package/dist/store/sqlite/involvements.d.ts +2 -0
  75. package/dist/store/sqlite/involvements.js +4 -1
  76. package/dist/store/sqlite/meeting-participant-search.js +9 -3
  77. package/dist/store/sqlite/meetings.js +7 -2
  78. package/dist/store/sqlite/person-match-scan.js +39 -15
  79. package/dist/store/sqlite/record-projectors-document.d.ts +12 -0
  80. package/dist/store/sqlite/record-projectors-document.js +81 -0
  81. package/dist/store/sqlite/record-projectors.js +2 -0
  82. package/dist/update/index.d.ts +1 -1
  83. package/dist/update/index.js +4 -2
  84. package/package.json +1 -1
  85. package/schemas/records-envelope.v1.schema.json +57 -2
@@ -21,6 +21,8 @@ export const PROVIDERS = [
21
21
  { name: "zoom", kind: "meetings", aliases: [] },
22
22
  // A phone export's records: its SMS and its calls in the one account the import names.
23
23
  { name: "phone", kind: "messages", kinds: ["messages", "events"], aliases: [], imported: true },
24
+ // Any other import: a folder of notes, a CRM's export, a script's records, under `import:<what it is>`.
25
+ { name: "import", kind: "documents", kinds: ["documents", "messages", "events"], aliases: [], imported: true },
24
26
  ];
25
27
  const LABELS = {
26
28
  telegram: "Telegram",
@@ -188,12 +190,17 @@ export const providerNamed = (word) => {
188
190
  };
189
191
  /** The kind of a provider the registry knows; `undefined` for one no entry names, which a search skips. */
190
192
  export const kindIn = (provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind;
191
- /** Every kind a provider's accounts hold, its `kind` first; empty for one no entry names. */
193
+ /**
194
+ * Every kind a provider's accounts hold, its `kind` first; empty for one no entry names. An import-only provider's
195
+ * accounts hold documents too: a records import writes them beside its calls and SMS.
196
+ */
192
197
  export const kindsIn = (provider) => {
193
198
  if (isFolderProvider(provider))
194
199
  return ["notes"];
195
200
  const entry = registry.find(({ name }) => name === provider);
196
- return entry ? kindsOfEntry(entry) : [];
201
+ if (!entry)
202
+ return [];
203
+ return entry.imported ? unitedKinds(kindsOfEntry(entry), ["documents"]) : kindsOfEntry(entry);
197
204
  };
198
205
  /**
199
206
  * Whether an entry may carry `imported`, beside one stored before (`held`): never for a built-in a sync writes, only
@@ -56,6 +56,10 @@ export interface RecordTypeSpec {
56
56
  * never land in a messenger's chat or a calendar's account.
57
57
  */
58
58
  importOnly?: boolean;
59
+ /** A phone's own export carries it, never a hand-made sheet: no template and no CSV. */
60
+ sheet?: false;
61
+ /** How many bytes its `fields` may take as JSON, when more than every type's 64 KiB: a document's text. */
62
+ fieldsBytes?: number;
59
63
  /** The type's `fields`: known keys typed, any other key kept as sent. */
60
64
  fields: FieldSchema;
61
65
  /** The roles the entity is made from; any other role word is kept as the source's own. */
@@ -440,6 +444,7 @@ export declare const RECORD_TYPES: {
440
444
  readonly update: "in-place";
441
445
  readonly tombstone: true;
442
446
  readonly importOnly: true;
447
+ readonly sheet: false;
443
448
  readonly fields: FieldSchema;
444
449
  readonly roles: {
445
450
  readonly counterpart: {
@@ -454,6 +459,7 @@ export declare const RECORD_TYPES: {
454
459
  readonly update: "in-place";
455
460
  readonly tombstone: true;
456
461
  readonly importOnly: true;
462
+ readonly sheet: false;
457
463
  readonly fields: FieldSchema;
458
464
  readonly roles: {
459
465
  readonly counterpart: {
@@ -462,6 +468,21 @@ export declare const RECORD_TYPES: {
462
468
  };
463
469
  };
464
470
  };
471
+ readonly document: {
472
+ readonly table: "documents";
473
+ readonly review: "direct";
474
+ readonly update: "in-place";
475
+ readonly tombstone: true;
476
+ readonly importOnly: true;
477
+ readonly fieldsBytes: 1048576;
478
+ readonly fields: FieldSchema;
479
+ readonly roles: {
480
+ readonly about: {
481
+ readonly targets: readonly ["person", "organization", "deal", "event"];
482
+ readonly many: true;
483
+ };
484
+ };
485
+ };
465
486
  readonly pipeline: {
466
487
  readonly table: "pipelines";
467
488
  readonly review: "direct";
@@ -487,8 +508,8 @@ type Identity<T> = {
487
508
  } ? K : never;
488
509
  }[keyof T];
489
510
  export type IdentityType = Identity<typeof RECORD_TYPES>;
490
- export type BusinessType = Exclude<RecordType, IdentityType>;
491
- /** A business record (an invoice, a deal, a wallet): not a person, organization or project. */
511
+ export type BusinessType = Exclude<RecordType, IdentityType | "document">;
512
+ /** A business record (an invoice, a deal, a wallet): not a person, organization, project or document. */
492
513
  export declare const isBusinessType: (type: string) => type is BusinessType;
493
514
  export declare const isIdentityType: (type: unknown) => type is IdentityType;
494
515
  export declare const RECORD_ENTITY_TYPES: RecordType[];
@@ -528,7 +549,7 @@ export declare const AMOUNT_ROLES: string[];
528
549
  export declare const FIELD_REFERENCE_ROLES: string[];
529
550
  /** The types whose records v1 projected: their v1 roles keep v1's reading. */
530
551
  export declare const hasV1Roles: (type: RecordType) => boolean;
531
- export declare const IDENTITY_TYPES: ("contract" | "deal" | "event" | "invoice" | "lead" | "message" | "order" | "organization" | "payment" | "person" | "pipeline" | "product" | "project" | "subscription" | "transaction" | "wallet")[];
552
+ export declare const IDENTITY_TYPES: ("contract" | "deal" | "document" | "event" | "invoice" | "lead" | "message" | "order" | "organization" | "payment" | "person" | "pipeline" | "product" | "project" | "subscription" | "transaction" | "wallet")[];
532
553
  /** `a` or `an` before a type word: `an event`, `an invoice`, `a message`. */
533
554
  export declare const article: (word: string) => "a" | "an";
534
555
  export {};
@@ -307,6 +307,7 @@ export const RECORD_TYPES = {
307
307
  update: "in-place",
308
308
  tombstone: true,
309
309
  importOnly: true,
310
+ sheet: false,
310
311
  fields: objectOf({
311
312
  kind: enumOf(["sms"], "sms: a text message of the phone"),
312
313
  direction: enumOf(SMS_DIRECTIONS, "in: the other side wrote it; out: the owner did"),
@@ -324,6 +325,7 @@ export const RECORD_TYPES = {
324
325
  update: "in-place",
325
326
  tombstone: true,
326
327
  importOnly: true,
328
+ sheet: false,
327
329
  fields: objectOf({
328
330
  kind: enumOf(["call"], "call: a phone call"),
329
331
  direction: enumOf(CALL_DIRECTIONS, "in, out, or missed: a call the owner did not take"),
@@ -333,6 +335,25 @@ export const RECORD_TYPES = {
333
335
  }, { required: ["kind", "direction", "phone", "started_at"] }),
334
336
  roles: COUNTERPART,
335
337
  },
338
+ document: {
339
+ table: "documents",
340
+ review: "direct",
341
+ update: "in-place",
342
+ tombstone: true,
343
+ importOnly: true,
344
+ fieldsBytes: 1_048_576,
345
+ fields: objectOf({
346
+ title: text("What the document is called; its external id when left out", 500),
347
+ text: { type: "string", maxLength: 1_000_000, description: "The text search reads" },
348
+ created_at: instant("When the source made it"),
349
+ updated_at: instant("When the source last changed it: what date: reads"),
350
+ url: text("Where the original is", 4096),
351
+ metadata: { type: "object", description: "Anything else the source knows about it, kept as sent" },
352
+ }, { required: ["text"] }),
353
+ roles: {
354
+ about: { targets: ["person", "organization", "deal", "event"], many: true },
355
+ },
356
+ },
336
357
  pipeline: {
337
358
  table: "pipelines",
338
359
  review: "direct",
@@ -353,8 +374,8 @@ export const RECORD_TYPES = {
353
374
  },
354
375
  };
355
376
  export const isRecordType = (type) => Object.hasOwn(RECORD_TYPES, type);
356
- /** A business record (an invoice, a deal, a wallet): not a person, organization or project. */
357
- export const isBusinessType = (type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity";
377
+ /** A business record (an invoice, a deal, a wallet): not a person, organization, project or document. */
378
+ export const isBusinessType = (type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity" && type !== "document";
358
379
  export const isIdentityType = (type) => typeof type === "string" && isRecordType(type) && RECORD_TYPES[type].review === "identity";
359
380
  export const RECORD_ENTITY_TYPES = Object.keys(RECORD_TYPES);
360
381
  /** Each registered type's table, for the store's polymorphic pointers. */
@@ -1,7 +1,7 @@
1
1
  import { RECORD_TYPES } from "./record-types.js";
2
2
  import { pointerOf, RECORDS_SCHEMA_VERSION, } from "./records.js";
3
3
  /** The types a table can carry: an SMS and a call come from a phone's own export, never from a hand-made sheet. */
4
- export const TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => !RECORD_TYPES[type].importOnly);
4
+ export const TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => RECORD_TYPES[type].sheet !== false);
5
5
  export class TableError extends Error {
6
6
  errors;
7
7
  constructor(errors) {
@@ -63,7 +63,7 @@ const roleColumn = (name, role) => ({
63
63
  /** A type's columns: the external id, its flat fields, one per role, then one per key of each list of items. */
64
64
  export const recordColumns = (type) => {
65
65
  const spec = specOf(type);
66
- if (!spec || spec.importOnly)
66
+ if (!spec || spec.sheet === false)
67
67
  return [];
68
68
  const fields = spec.fields.properties ?? {};
69
69
  const required = spec.fields.required ?? [];
@@ -134,7 +134,8 @@ export const recordTemplate = (type, format, { source, separator = "," } = {}) =
134
134
  const envelope = {
135
135
  schema_version: RECORDS_SCHEMA_VERSION,
136
136
  source: {
137
- provider: source?.provider ?? "sheet",
137
+ // An import-only type is refused under a sheet's provider: `import` is the one any folder or export may use.
138
+ provider: source?.provider ?? (specOf(type)?.importOnly ? "import" : "sheet"),
138
139
  account: source?.account ?? "main",
139
140
  batch_id: source?.batch_id ?? "first-import",
140
141
  },
@@ -167,7 +167,7 @@ export declare const RECORDS_ENVELOPE_SCHEMA: {
167
167
  if: {
168
168
  properties: {
169
169
  type: {
170
- const: "contract" | "deal" | "event" | "invoice" | "lead" | "message" | "order" | "organization" | "payment" | "person" | "pipeline" | "product" | "project" | "subscription" | "transaction" | "wallet";
170
+ const: "contract" | "deal" | "document" | "event" | "invoice" | "lead" | "message" | "order" | "organization" | "payment" | "person" | "pipeline" | "product" | "project" | "subscription" | "transaction" | "wallet";
171
171
  };
172
172
  };
173
173
  required: string[];
@@ -234,8 +234,9 @@ export const recordErrors = (record, index) => {
234
234
  return withKey([invalid([...at, "fields"], "an upsert carries its fields as an object")]);
235
235
  if (record.fields !== undefined && !isObject(record.fields))
236
236
  return withKey([invalid([...at, "fields"], "fields is an object")]);
237
- if (record.fields !== undefined && Buffer.byteLength(JSON.stringify(record.fields)) > MAX_FIELDS_BYTES)
238
- return withKey([invalid([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
237
+ const most = (isRecordType(record.type) && RECORD_TYPES[record.type].fieldsBytes) || MAX_FIELDS_BYTES;
238
+ if (record.fields !== undefined && Buffer.byteLength(JSON.stringify(record.fields)) > most)
239
+ return withKey([invalid([...at, "fields"], `fields take at most ${most} bytes`, "record.too-large")]);
239
240
  const secret = record.fields === undefined ? undefined : secretIn(record.fields, [...at, "fields"]);
240
241
  if (secret)
241
242
  return withKey([
@@ -166,6 +166,8 @@ declare const context: v.StrictObjectSchema<{
166
166
  readonly status: v.NullableSchema<v.StringSchema<undefined>, undefined>;
167
167
  }, undefined>, undefined>;
168
168
  }, undefined>, undefined>;
169
+ /** Recorded meetings and calls they took part in, newest first. */
170
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
169
171
  readonly limits: v.StrictObjectSchema<{
170
172
  readonly messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
171
173
  readonly bytes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -961,6 +963,8 @@ export declare const contactContext: v.UnionSchema<[v.StrictObjectSchema<{
961
963
  readonly status: v.NullableSchema<v.StringSchema<undefined>, undefined>;
962
964
  }, undefined>, undefined>;
963
965
  }, undefined>, undefined>;
966
+ /** Recorded meetings and calls they took part in, newest first. */
967
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
964
968
  readonly limits: v.StrictObjectSchema<{
965
969
  readonly messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
966
970
  readonly bytes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -1767,6 +1771,8 @@ export declare const contactPreparation: v.StrictObjectSchema<{
1767
1771
  readonly status: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1768
1772
  }, undefined>, undefined>;
1769
1773
  }, undefined>, undefined>;
1774
+ /** Recorded meetings and calls they took part in, newest first. */
1775
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
1770
1776
  readonly limits: v.StrictObjectSchema<{
1771
1777
  readonly messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1772
1778
  readonly bytes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -3,6 +3,7 @@ import { chat } from "./chat.js";
3
3
  import { linkedPerson } from "./contact-activity.js";
4
4
  import { count, id, reference, text, time } from "./fields.js";
5
5
  import { message } from "./message.js";
6
+ import { recordedMeeting } from "./recorded-meeting.js";
6
7
  const contextPerson = v.strictObject({ ...linkedPerson.entries, provider: text, id });
7
8
  export const contextMessage = v.strictObject({
8
9
  locator: reference,
@@ -48,6 +49,8 @@ const context = v.strictObject({
48
49
  mentions: v.array(contextMessage),
49
50
  /** Calendar events they are invited to, one occurrence per series. */
50
51
  events: v.optional(v.strictObject({ upcoming: v.array(contextEvent), recent: v.array(contextEvent) })),
52
+ /** Recorded meetings and calls they took part in, newest first. */
53
+ meetings: v.optional(v.array(recordedMeeting)),
51
54
  limits: v.strictObject({ messages: count, bytes: count }),
52
55
  complete: v.boolean(),
53
56
  not_read: v.array(v.strictObject({
@@ -84,6 +84,8 @@ export declare const deal: v.StrictObjectSchema<{
84
84
  readonly updated_at: 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`">]>;
85
85
  /** `show` of a CRM copy whose `activities` setting is on: its activities and tasks, open ones first. */
86
86
  readonly activities: v.OptionalSchema<v.ArraySchema<v.GenericSchema<DealActivity>, undefined>, undefined>;
87
+ /** `show` of a CRM copy: the newest recorded meetings and calls of its people, in its account's scope. */
88
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
87
89
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
88
90
  }, undefined>;
89
91
  /** A lead (`lead:<id>`): a deal's shape, in a lead pipeline. */
@@ -155,6 +157,8 @@ export declare const lead: v.StrictObjectSchema<{
155
157
  readonly updated_at: 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`">]>;
156
158
  /** `show` of a CRM copy whose `activities` setting is on: its activities and tasks, open ones first. */
157
159
  readonly activities: v.OptionalSchema<v.ArraySchema<v.GenericSchema<DealActivity>, undefined>, undefined>;
160
+ /** `show` of a CRM copy: the newest recorded meetings and calls of its people, in its account's scope. */
161
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
158
162
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
159
163
  }, undefined>;
160
164
  /** A pipeline (`pipeline:<id>`) with its stages in order; `pipelines show` adds the funnel. */
@@ -2,6 +2,7 @@ import * as v from "valibot";
2
2
  import { CRM_ACTIVITY_KINDS } from "../domain/crm.js";
3
3
  import { DEAL_ROLES } from "../domain/deals.js";
4
4
  import { count, id, reference, text, time, untrusted } from "./fields.js";
5
+ import { recordedMeeting } from "./recorded-meeting.js";
5
6
  const nullableText = v.nullable(text);
6
7
  const party = v.strictObject({ ref: reference, name: nullableText, owner: v.boolean() });
7
8
  const outcome = v.picklist(["open", "won", "lost"]);
@@ -77,6 +78,8 @@ export const deal = v.strictObject({
77
78
  updated_at: time,
78
79
  /** `show` of a CRM copy whose `activities` setting is on: its activities and tasks, open ones first. */
79
80
  activities: v.optional(v.array(activity)),
81
+ /** `show` of a CRM copy: the newest recorded meetings and calls of its people, in its account's scope. */
82
+ meetings: v.optional(v.array(recordedMeeting)),
80
83
  untrusted,
81
84
  });
82
85
  /** A lead (`lead:<id>`): a deal's shape, in a lead pipeline. */
@@ -297,6 +297,7 @@ export declare const ENTITIES: {
297
297
  readonly created_at: 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`">]>;
298
298
  readonly updated_at: 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`">]>;
299
299
  readonly activities: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./deal.js").DealActivity>, undefined>, undefined>;
300
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
300
301
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
301
302
  }, undefined>;
302
303
  readonly lead: v.StrictObjectSchema<{
@@ -359,6 +360,7 @@ export declare const ENTITIES: {
359
360
  readonly created_at: 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`">]>;
360
361
  readonly updated_at: 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`">]>;
361
362
  readonly activities: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./deal.js").DealActivity>, undefined>, undefined>;
363
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
362
364
  readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
363
365
  }, undefined>;
364
366
  readonly pipeline: v.StrictObjectSchema<{
@@ -2856,6 +2858,7 @@ export declare const ENTITIES: {
2856
2858
  readonly status: v.NullableSchema<v.StringSchema<undefined>, undefined>;
2857
2859
  }, undefined>, undefined>;
2858
2860
  }, undefined>, undefined>;
2861
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
2859
2862
  readonly limits: v.StrictObjectSchema<{
2860
2863
  readonly messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
2861
2864
  readonly bytes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -3647,6 +3650,7 @@ export declare const ENTITIES: {
3647
3650
  readonly status: v.NullableSchema<v.StringSchema<undefined>, undefined>;
3648
3651
  }, undefined>, undefined>;
3649
3652
  }, undefined>, undefined>;
3653
+ readonly meetings: v.OptionalSchema<v.ArraySchema<v.GenericSchema<import("./recorded-meeting.js").RecordedMeeting>, undefined>, undefined>;
3650
3654
  readonly limits: v.StrictObjectSchema<{
3651
3655
  readonly messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
3652
3656
  readonly bytes: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -5450,6 +5454,10 @@ export declare const ENTITIES: {
5450
5454
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5451
5455
  readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5452
5456
  readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5457
+ readonly person: v.NullableSchema<v.StrictObjectSchema<{
5458
+ readonly ref: v.StringSchema<undefined>;
5459
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
5460
+ }, undefined>, undefined>;
5453
5461
  readonly joined_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>;
5454
5462
  readonly left_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>;
5455
5463
  readonly duration_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
@@ -6646,6 +6654,10 @@ export declare const ENTITIES: {
6646
6654
  readonly identity_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
6647
6655
  readonly display_name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6648
6656
  readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6657
+ readonly person: v.NullableSchema<v.StrictObjectSchema<{
6658
+ readonly ref: v.StringSchema<undefined>;
6659
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6660
+ }, undefined>, undefined>;
6649
6661
  }, undefined>, undefined>;
6650
6662
  readonly ambiguity: v.StrictObjectSchema<{
6651
6663
  readonly scope: v.LiteralSchema<"page", undefined>;
@@ -0,0 +1,17 @@
1
+ import * as v from "valibot";
2
+ export interface RecordedMeeting {
3
+ ref: string;
4
+ meeting_id: number;
5
+ account: {
6
+ provider: string;
7
+ account: string;
8
+ };
9
+ title: string | null;
10
+ started_at: string | null;
11
+ duration_ms: number | null;
12
+ has_transcript: boolean;
13
+ event: string | null;
14
+ people: string[];
15
+ }
16
+ /** A recorded meeting or call some of the people took part in: `meetings show <meeting_id>` of `account` opens it. */
17
+ export declare const recordedMeeting: v.GenericSchema<RecordedMeeting>;
@@ -0,0 +1,15 @@
1
+ import * as v from "valibot";
2
+ import { count, reference, text, time } from "./fields.js";
3
+ // Typed by name, as a deal's activity is: inferred, the entity maps that hold it grow too long for the compiler.
4
+ /** A recorded meeting or call some of the people took part in: `meetings show <meeting_id>` of `account` opens it. */
5
+ export const recordedMeeting = v.strictObject({
6
+ ref: reference,
7
+ meeting_id: count,
8
+ account: v.strictObject({ provider: text, account: text }),
9
+ title: v.nullable(text),
10
+ started_at: v.nullable(time),
11
+ duration_ms: v.nullable(count),
12
+ has_transcript: v.boolean(),
13
+ event: v.nullable(reference),
14
+ people: v.array(reference),
15
+ });
@@ -23,8 +23,7 @@ const SIGN_IN = [
23
23
  ["oauth.declined", "authentication_error", "the provider's consent was declined"],
24
24
  ["oauth.timeout", "timeout", "the sign-in was not finished in time"],
25
25
  ["oauth.mismatch", "authentication_error", "the pasted sign-in result belongs to another sign-in"],
26
- ["oauth.missing", "authentication_error", "this profile is not signed in to the provider"],
27
- ["session.missing", "authentication_error", "this profile has no API token saved"],
26
+ ["session.missing", "authentication_error", "this profile is not signed in: no saved sign-in or API token"],
28
27
  ["oauth.locked", "provider_unavailable", "another process holds this sign-in's lock"],
29
28
  ["oauth.no-response", "outcome_unknown", "the token request did not finish"],
30
29
  ["oauth.unavailable", "provider_unavailable", "the provider's token endpoint is unavailable"],
@@ -87,7 +86,7 @@ const OTHERS = [
87
86
  "invalid_response",
88
87
  "the model answered nothing; given a picture, it may not read pictures — choose a vision model",
89
88
  ],
90
- validation("model.address-refused", "the model address must be https, or http only on this computer"),
89
+ validation("model.address-refused", "the model address is refused: https, or plain http and Ollama only on this computer"),
91
90
  [
92
91
  "local-only.refused",
93
92
  "permission_error",
@@ -109,7 +108,6 @@ const OTHERS = [
109
108
  "only the owner chooses, unsets, checks or removes the AI model and its key, or revokes its consent",
110
109
  ],
111
110
  ["ai.setting-invalid", "configuration_error", "the ai section or the model given is not one WireCat can use"],
112
- validation("ai.address-refused", "the AI model setting names an address WireCat refuses: plain http to another computer, or Ollama off this computer"),
113
111
  ["ai.not-set", "configuration_error", "no AI model is chosen; models ai set chooses one"],
114
112
  ["ai.key-missing", "configuration_error", "no API key is stored for the AI model's address"],
115
113
  ["ai.ok", "invalid_response", "models ai check: the model answered (a result, never raised)"],
@@ -392,6 +390,7 @@ const OTHERS = [
392
390
  validation("crm.reference-unknown", "a CRM row names a contact, company or user the store does not hold; that link was not made"),
393
391
  validation("crm.pending-dropped", "relationships waited too long for an end that never came; they were dropped"),
394
392
  validation("crm.activities-failed", "the activities and tasks could not be read; the deals and leads were synced"),
393
+ validation("crm.stage-history-failed", "the CRM's stage history could not be read; stage tasks wait for the next sync"),
395
394
  validation("crm.email-ambiguous", "a CRM contact's email belongs to more than one person; the owner decides"),
396
395
  validation("crm.own-unknown", "no own company of the CRM account is stored, so its users are no one's employees yet"),
397
396
  validation("relationship.reference-unknown", "a reported relationship names something the store does not hold"),
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { CATALOG_KINDS, type CatalogKind, CONTRACT_KINDS, CONTRACT_STATUSES, typ
3
3
  export { bareCheck, type CheckWords, checkWords } from "./domain/checks.js";
4
4
  export type { CounterField, CounterObservation, CounterObservations, CounterState } from "./domain/counters.js";
5
5
  export { COUNTER_FIELDS, counterValue, observedCounters } from "./domain/counters.js";
6
- export { CRM_ACTIVITY_KINDS, CRM_KINDS, type CrmActivity, type CrmActivityKind, type CrmDepartment, type CrmField, type CrmItem, type CrmKind, type CrmOrganization, type CrmPerson, type CrmPipeline, type CrmRecords, type CrmScope, type CrmScopeSetting, type CrmStage, type CrmUser, type CrmValue, isCrmUserId, isItemKind, normalCrmUserId, } from "./domain/crm.js";
6
+ export { CRM_ACTIVITY_KINDS, CRM_KINDS, type CrmActivity, type CrmActivityKind, type CrmDepartment, type CrmField, type CrmItem, type CrmKind, type CrmOrganization, type CrmPerson, type CrmPipeline, type CrmRecords, type CrmScope, type CrmScopeSetting, type CrmStage, type CrmStageEntry, type CrmUser, type CrmValue, isCrmUserId, isItemKind, normalCrmUserId, } from "./domain/crm.js";
7
7
  export { DEAL_KINDS, DEAL_ROLES, DEAL_STATUSES, type DealKind, type DealRole, type DealStatus, STAGE_OUTCOMES, type StageOutcome, } from "./domain/deals.js";
8
8
  export { displayName, type NameFallbacks, nameKey } from "./domain/display-names.js";
9
9
  export { FINANCE_REVIEWS, type FinanceReview, INVOICE_DIRECTIONS, INVOICE_STATUSES, type InvoiceDirection, type InvoiceStatus, MONEY_DIRECTIONS, type MoneyDirection, } from "./domain/finance.js";
@@ -95,6 +95,11 @@ export declare const meetingDetails: v.StrictObjectSchema<{
95
95
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
96
96
  readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
97
97
  readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
98
+ /** Who they are across the owner's sources: `person:<uid>`, and that person's name once linked. */
99
+ readonly person: v.NullableSchema<v.StrictObjectSchema<{
100
+ readonly ref: v.StringSchema<undefined>;
101
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
102
+ }, undefined>, undefined>;
98
103
  readonly joined_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>;
99
104
  readonly left_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>;
100
105
  readonly duration_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
@@ -76,6 +76,8 @@ export const meetingDetails = v.strictObject({
76
76
  name: v.nullable(text),
77
77
  email: v.nullable(text),
78
78
  role: v.nullable(text),
79
+ /** Who they are across the owner's sources: `person:<uid>`, and that person's name once linked. */
80
+ person: v.nullable(v.strictObject({ ref: text, name: v.nullable(text) })),
79
81
  joined_at: v.nullable(isoTime),
80
82
  left_at: v.nullable(isoTime),
81
83
  duration_ms: v.nullable(count),
@@ -137,6 +139,7 @@ export const meetingDetailsItem = (details, owner) => {
137
139
  name: one.displayName,
138
140
  email: one.email,
139
141
  role: one.role,
142
+ person: one.person ? { ref: `person:${one.person.uid}`, name: one.person.name } : null,
140
143
  joined_at: iso(one.joinedAt),
141
144
  left_at: iso(one.leftAt),
142
145
  duration_ms: one.durationMs,
@@ -52,7 +52,7 @@ export type { MeetingSeriesCandidate, MeetingSeriesInventoryPage, MeetingSeriesI
52
52
  export { validateMeetingSeriesInventoryCursor } from "./series-inventory-validation.js";
53
53
  export type { MeetingSource, SourceParticipant } from "./source.js";
54
54
  export { aggregateMeetingCounts, aggregateMeetingStats, MEETING_COUNTS_GROUPINGS, type MeetingCounts, type MeetingCountsGrouping, type MeetingCountsInput, type MeetingCountsMeeting, type MeetingCountsRow, type MeetingSpeakerStats, type MeetingStats, type MeetingStatsInput, type MeetingStatsRow, type MeetingStatsSelection, type MeetingStatsStore, type MeetingWeekStats, NO_SERIES, } from "./stats.js";
55
- export type { ChatInput, ContractCase, EventCandidateFilter, IdentityInput, MeetingDetails, MeetingFilter, MeetingHitSource, MeetingInput, MeetingSave, MeetingStore, NewRecord, ParticipantInput, SearchHit, TranscriptInput, TranscriptLanguageFill, TranscriptRowInput, } from "./store.js";
55
+ export type { ChatInput, ContractCase, EventCandidateFilter, IdentityInput, MeetingDetails, MeetingFilter, MeetingHitSource, MeetingInput, MeetingParticipant, MeetingSave, MeetingStore, NewRecord, ParticipantInput, SearchHit, TranscriptInput, TranscriptLanguageFill, TranscriptRowInput, } from "./store.js";
56
56
  export { READ_BUDGET_EXCEEDED } from "./store.js";
57
57
  export { meetingTimestamp } from "./timestamp.js";
58
58
  export type { MeetingTranscriptReceiptStore, MeetingTranscriptStore, TranscriptAppend, TranscriptAppendReceipt, UnlinkedTranscriptInput, } from "./transcript-store.js";
@@ -11,6 +11,11 @@ export interface MeetingParticipantCandidate {
11
11
  identity_id: number;
12
12
  display_name: string | null;
13
13
  email: string | null;
14
+ /** The person their identity is linked to; a linked person's name is searched too. */
15
+ person: {
16
+ ref: string;
17
+ name: string | null;
18
+ } | null;
14
19
  }
15
20
  export interface MeetingParticipantPage {
16
21
  schema_version: 1;
@@ -1,7 +1,7 @@
1
1
  import { linkEvent } from "./events.js";
2
2
  import { speakerPosition, timestamp, transcriptInput } from "./ingest.js";
3
3
  const participantInput = (p, provider, occurrenceId, position, accountId) => {
4
- const { identityExternalId, ...fields } = p;
4
+ const { identityExternalId, phone, ...fields } = p;
5
5
  const externalId = identityExternalId ??
6
6
  (p.email ? `email:${p.email.toLowerCase()}` : p.externalId) ??
7
7
  `name:${p.displayName ?? "unknown"}@${accountId}/${occurrenceId}:${position}`;
@@ -11,6 +11,7 @@ const participantInput = (p, provider, occurrenceId, position, accountId) => {
11
11
  provider,
12
12
  externalId,
13
13
  name: p.displayName,
14
+ ...(phone?.trim() ? { phone } : {}),
14
15
  metadata: p.metadata,
15
16
  associatePerson: Boolean(identityExternalId?.trim() || p.email?.trim() || p.externalId?.trim()),
16
17
  },
@@ -124,6 +124,10 @@ export declare const meetingParticipants: v.StrictObjectSchema<{
124
124
  readonly identity_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
125
125
  readonly display_name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
126
126
  readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
127
+ readonly person: v.NullableSchema<v.StrictObjectSchema<{
128
+ readonly ref: v.StringSchema<undefined>;
129
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
130
+ }, undefined>, undefined>;
127
131
  }, undefined>, undefined>;
128
132
  /** Several identities on one page are observations, never speaker attribution or person links. */
129
133
  readonly ambiguity: v.StrictObjectSchema<{
@@ -164,6 +164,7 @@ export const meetingParticipants = v.strictObject({
164
164
  identity_id: id,
165
165
  display_name: v.nullable(text),
166
166
  email: v.nullable(text),
167
+ person: v.nullable(v.strictObject({ ref: text, name: v.nullable(text) })),
167
168
  })),
168
169
  /** Several identities on one page are observations, never speaker attribution or person links. */
169
170
  ambiguity: v.strictObject({ scope: v.literal("page"), multiple_identities: v.boolean(), identity_ids: v.array(id) }),
@@ -3,6 +3,11 @@ import type { MeetingSave } from "./store.js";
3
3
  export interface SourceParticipant {
4
4
  identityExternalId: string | null;
5
5
  email: string | null;
6
+ /**
7
+ * The number the participant called from or was called on, as the phone network gave it: what links a call's
8
+ * client to the CRM contact with that number. E.164, or written with `+`; anything else is left out.
9
+ */
10
+ phone?: string | null;
6
11
  displayName: string | null;
7
12
  externalId: string | null;
8
13
  role: string | null;
@@ -9,6 +9,8 @@ export interface IdentityInput {
9
9
  provider: string;
10
10
  externalId: string;
11
11
  name: string | null;
12
+ /** As the source gave it; the store keeps it only when it reads as E.164. */
13
+ phone?: string | null;
12
14
  metadata: Metadata;
13
15
  }
14
16
  export interface ParticipantInput extends Omit<NewRecord<Participant>, "meetingId" | "identityId"> {
@@ -44,10 +46,17 @@ export interface MeetingSave {
44
46
  */
45
47
  fromFile?: boolean;
46
48
  }
49
+ /** A participant with the person their identity is linked to, when the store knows people. */
50
+ export interface MeetingParticipant extends Participant {
51
+ person?: {
52
+ uid: string;
53
+ name: string | null;
54
+ };
55
+ }
47
56
  export interface MeetingDetails {
48
57
  meeting: Meeting;
49
58
  series: MeetingSeries | null;
50
- participants: Participant[];
59
+ participants: MeetingParticipant[];
51
60
  transcripts: {
52
61
  transcript: Transcript;
53
62
  rows: TranscriptRow[];
package/dist/models/ai.js CHANGED
@@ -54,10 +54,10 @@ export const aiSettingOf = (given) => {
54
54
  ? `the provider is one of ${AI_PROVIDERS.join(", ")}`
55
55
  : field === "base_url"
56
56
  ? "this address is not allowed: use https, or http only on this computer"
57
- : "name the model, 1 to 200 characters", { reason: field === "base_url" ? "ai.address-refused" : "ai.setting-invalid" });
57
+ : "name the model, 1 to 200 characters", { reason: field === "base_url" ? "model.address-refused" : "ai.setting-invalid" });
58
58
  }
59
59
  if (checked.output.provider === "ollama" && !onThisComputer(aiBaseUrl(checked.output)))
60
- throw new CliError("validation_error", "Ollama is read only on this computer", { reason: "ai.address-refused" });
60
+ throw new CliError("validation_error", "Ollama is read only on this computer", { reason: "model.address-refused" });
61
61
  return given.allowImages
62
62
  ? {
63
63
  ...checked.output,
@@ -1,6 +1,13 @@
1
+ import { type FetchLike } from "@wirecat/cli-base/http";
1
2
  export declare const endpoint: (value: string) => boolean;
2
3
  /** An address on this computer: localhost, 127.x.x.x or [::1]. */
3
4
  export declare const onThisComputer: (value: string) => boolean;
4
5
  /** https anywhere; plain http only to this computer, so neither the text nor the key crosses a network unencrypted. */
5
6
  export declare const modelAddressAllowed: (value: string) => boolean;
6
7
  export declare const PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
8
+ /**
9
+ * `fetch` that reaches only the host of this model address, through `hostFetch`. The address was checked when it was
10
+ * saved; its host is the one the person configured. `[::1]` is not a name `hostFetch` takes, and the loopback cannot
11
+ * leave this computer, so it goes through the plain `fetch`.
12
+ */
13
+ export declare const endpointFetch: (address: string, timeoutMs: number) => FetchLike;
@@ -1,3 +1,4 @@
1
+ import { hostFetch } from "@wirecat/cli-base/http";
1
2
  export const endpoint = (value) => {
2
3
  try {
3
4
  const url = new URL(value);
@@ -20,3 +21,12 @@ export const onThisComputer = (value) => {
20
21
  /** https anywhere; plain http only to this computer, so neither the text nor the key crosses a network unencrypted. */
21
22
  export const modelAddressAllowed = (value) => endpoint(value) && (new URL(value).protocol === "https:" || onThisComputer(value));
22
23
  export const PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
24
+ /**
25
+ * `fetch` that reaches only the host of this model address, through `hostFetch`. The address was checked when it was
26
+ * saved; its host is the one the person configured. `[::1]` is not a name `hostFetch` takes, and the loopback cannot
27
+ * leave this computer, so it goes through the plain `fetch`.
28
+ */
29
+ export const endpointFetch = (address, timeoutMs) => {
30
+ const { hostname } = new URL(address);
31
+ return hostname === "[::1]" ? fetch : hostFetch({ hosts: [hostname], timeoutMs });
32
+ };