@wirecat/cli-core 0.753.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +239 -0
- package/README.md +9 -6
- package/THIRD_PARTY_NOTICES +4 -0
- package/dist/analysis/settings.d.ts +3 -1
- package/dist/analysis/settings.js +2 -1
- package/dist/attachments/extract.d.ts +1 -1
- package/dist/attachments/extract.js +1 -1
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/background/deliver.d.ts +3 -0
- package/dist/background/deliver.js +3 -0
- package/dist/background/lock.d.ts +1 -1
- package/dist/background/lock.js +1 -1
- package/dist/background/schedules.d.ts +13 -3
- package/dist/background/schedules.js +13 -3
- package/dist/background/when.d.ts +19 -5
- package/dist/background/when.js +17 -5
- package/dist/calendar/cli/answers.d.ts +1 -0
- package/dist/calendar/cli/answers.js +1 -0
- package/dist/calendar/cli/index.js +3 -1
- package/dist/calendar/feeds.d.ts +2 -0
- package/dist/calendar/feeds.js +10 -1
- package/dist/calendar/source.d.ts +5 -0
- package/dist/calendar/sync.d.ts +7 -1
- package/dist/calendar/sync.js +37 -7
- package/dist/calendar/testing/memory.js +7 -2
- package/dist/calendar/testing/sync-contract.js +2 -1
- package/dist/cli/account-rename.d.ts +3 -0
- package/dist/cli/account-rename.js +2 -1
- package/dist/cli/after-dashes.d.ts +1 -0
- package/dist/cli/after-dashes.js +1 -0
- package/dist/cli/agent-evaluation.d.ts +8 -1
- package/dist/cli/agent-evaluation.js +4 -1
- package/dist/cli/app-doctor-command.d.ts +1 -0
- package/dist/cli/app-doctor-command.js +1 -0
- package/dist/cli/ask-before-write.d.ts +1 -0
- package/dist/cli/ask-before-write.js +1 -0
- package/dist/cli/author.d.ts +1 -1
- package/dist/cli/author.js +1 -1
- package/dist/cli/base-stages-command.d.ts +2 -0
- package/dist/cli/base-stages-command.js +1 -0
- package/dist/cli/bot/api-http.d.ts +9 -3
- package/dist/cli/bot/api-http.js +7 -3
- package/dist/cli/bot/api-input.d.ts +8 -2
- package/dist/cli/bot/api-input.js +9 -3
- package/dist/cli/bot/api-rpc.d.ts +3 -1
- package/dist/cli/bot/api-rpc.js +2 -1
- package/dist/cli/bot/api.d.ts +1 -1
- package/dist/cli/bot/api.js +7 -1
- package/dist/cli/bot/context.d.ts +3 -2
- package/dist/cli/bot/context.js +1 -1
- package/dist/cli/bot/copy.d.ts +1 -0
- package/dist/cli/bot/messages.d.ts +5 -2
- package/dist/cli/bot/messages.js +5 -2
- package/dist/cli/bot/port.d.ts +10 -6
- package/dist/cli/bot/port.js +1 -1
- package/dist/cli/bot/registry.d.ts +6 -3
- package/dist/cli/bot/registry.js +6 -3
- package/dist/cli/bot/updates.d.ts +2 -1
- package/dist/cli/bot/updates.js +2 -1
- package/dist/cli/call-stats-command.d.ts +3 -0
- package/dist/cli/call-stats-command.js +1 -0
- package/dist/cli/command-contract.d.ts +3 -0
- package/dist/cli/command-contract.js +2 -0
- package/dist/cli/command-runs.d.ts +3 -1
- package/dist/cli/command-runs.js +2 -1
- package/dist/cli/commander-internals.d.ts +16 -0
- package/dist/cli/commander-internals.js +17 -0
- package/dist/cli/commands-command.d.ts +1 -0
- package/dist/cli/commands-command.js +3 -1
- package/dist/cli/compact.d.ts +13 -8
- package/dist/cli/compact.js +9 -6
- package/dist/cli/config-command.d.ts +3 -3
- package/dist/cli/config-command.js +4 -4
- package/dist/cli/config-issues.d.ts +7 -3
- package/dist/cli/config-issues.js +7 -3
- package/dist/cli/config-keys.d.ts +4 -1
- package/dist/cli/config-keys.js +4 -1
- package/dist/cli/context.d.ts +6 -2
- package/dist/cli/context.js +5 -1
- package/dist/cli/contract-evidence.d.ts +1 -0
- package/dist/cli/contract-evidence.js +1 -0
- package/dist/cli/csv.d.ts +3 -2
- package/dist/cli/csv.js +3 -2
- package/dist/cli/default-config.d.ts +2 -0
- package/dist/cli/default-config.js +2 -0
- package/dist/cli/doctor-reports-command.d.ts +5 -1
- package/dist/cli/doctor-reports-command.js +4 -1
- package/dist/cli/documents/catalog.js +2 -1
- package/dist/cli/documents/file-conflicts.js +2 -1
- package/dist/cli/documents/file-edit.js +5 -4
- package/dist/cli/documents/file-mirrors.js +4 -3
- package/dist/cli/documents/file-update.js +2 -1
- package/dist/cli/documents/folders.js +2 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/early-refusal.d.ts +4 -4
- package/dist/cli/early-refusal.js +4 -4
- package/dist/cli/effects.d.ts +41 -11
- package/dist/cli/effects.js +48 -13
- package/dist/cli/entry.d.ts +4 -1
- package/dist/cli/entry.js +4 -1
- package/dist/cli/envelope.d.ts +14 -4
- package/dist/cli/envelope.js +14 -4
- package/dist/cli/execution.d.ts +1 -0
- package/dist/cli/execution.js +1 -0
- package/dist/cli/findings-input.d.ts +10 -2
- package/dist/cli/findings-input.js +10 -2
- package/dist/cli/first-run.d.ts +9 -2
- package/dist/cli/first-run.js +7 -1
- package/dist/cli/group-lock.d.ts +6 -0
- package/dist/cli/group-lock.js +5 -0
- package/dist/cli/guide.d.ts +5 -2
- package/dist/cli/guide.js +8 -4
- package/dist/cli/help/command-help.d.ts +12 -4
- package/dist/cli/help/command-help.js +13 -6
- package/dist/cli/help/first-screen.d.ts +2 -0
- package/dist/cli/help/first-screen.js +2 -0
- package/dist/cli/help/sections.d.ts +1 -0
- package/dist/cli/help/sections.js +1 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/input-policy.d.ts +3 -0
- package/dist/cli/input-policy.js +3 -0
- package/dist/cli/json-fields.d.ts +1 -0
- package/dist/cli/json-fields.js +1 -0
- package/dist/cli/list-query.d.ts +11 -5
- package/dist/cli/list-query.js +11 -5
- package/dist/cli/listings.d.ts +13 -5
- package/dist/cli/listings.js +12 -5
- package/dist/cli/local-times.d.ts +3 -2
- package/dist/cli/local-times.js +2 -1
- package/dist/cli/mcp-server-command.d.ts +4 -1
- package/dist/cli/mcp-server-command.js +2 -0
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +2 -1
- package/dist/cli/meeting-evidence-answer.d.ts +2 -2
- package/dist/cli/meeting-evidence-answer.js +2 -2
- package/dist/cli/meeting-meaning-command.d.ts +5 -0
- package/dist/cli/meeting-meaning-command.js +2 -0
- package/dist/cli/meeting-passage-text.d.ts +1 -0
- package/dist/cli/meeting-passage-text.js +1 -0
- package/dist/cli/meeting-preparation-answer.d.ts +1 -0
- package/dist/cli/meeting-preparation-answer.js +1 -0
- package/dist/cli/meeting-preparation-read.d.ts +2 -0
- package/dist/cli/meeting-preparation-read.js +2 -0
- package/dist/cli/meeting-project-candidates-read.d.ts +1 -0
- package/dist/cli/meeting-project-candidates-read.js +1 -0
- package/dist/cli/meeting-results.d.ts +4 -1
- package/dist/cli/meeting-results.js +4 -1
- package/dist/cli/meeting-series-inventory-read.d.ts +2 -0
- package/dist/cli/meeting-series-inventory-read.js +1 -0
- package/dist/cli/meeting-tags-command.d.ts +2 -0
- package/dist/cli/meeting-tags-command.js +1 -0
- package/dist/cli/messenger/admin-folders-command.js +2 -1
- package/dist/cli/messenger/admin-moderation-command.d.ts +1 -1
- package/dist/cli/messenger/admin-moderation-command.js +1 -1
- package/dist/cli/messenger/ask.d.ts +1 -1
- package/dist/cli/messenger/ask.js +1 -1
- package/dist/cli/messenger/context.d.ts +2 -1
- package/dist/cli/messenger/context.js +1 -0
- package/dist/cli/messenger/doctor-command.d.ts +2 -1
- package/dist/cli/messenger/doctor-command.js +2 -1
- package/dist/cli/messenger/inbox.d.ts +2 -2
- package/dist/cli/messenger/inbox.js +2 -2
- package/dist/cli/messenger/lacks.d.ts +1 -0
- package/dist/cli/messenger/lacks.js +5 -3
- package/dist/cli/messenger/mcp-command.d.ts +8 -3
- package/dist/cli/messenger/mcp-command.js +6 -2
- package/dist/cli/messenger/message-items.d.ts +3 -1
- package/dist/cli/messenger/message-items.js +1 -0
- package/dist/cli/messenger/messages-delete-command.d.ts +1 -1
- package/dist/cli/messenger/messages-delete-command.js +1 -1
- package/dist/cli/messenger/report.d.ts +4 -1
- package/dist/cli/messenger/report.js +2 -0
- package/dist/cli/messenger/search-answers.d.ts +10 -4
- package/dist/cli/messenger/search-answers.js +6 -2
- package/dist/cli/messenger/searches-command.d.ts +4 -1
- package/dist/cli/messenger/searches-command.js +4 -1
- package/dist/cli/messenger/serve-command.d.ts +1 -1
- package/dist/cli/messenger/serve-command.js +1 -1
- package/dist/cli/messenger/serve-members.d.ts +4 -1
- package/dist/cli/messenger/serve-members.js +3 -1
- package/dist/cli/messenger/serve-outdated.d.ts +8 -3
- package/dist/cli/messenger/serve-outdated.js +8 -3
- package/dist/cli/messenger/serve-relay.d.ts +1 -1
- package/dist/cli/messenger/serve-relay.js +1 -1
- package/dist/cli/messenger/serve-stems.d.ts +4 -0
- package/dist/cli/messenger/serve-stems.js +3 -0
- package/dist/cli/messenger/server-command.d.ts +1 -1
- package/dist/cli/messenger/server-command.js +1 -1
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -0
- package/dist/cli/messenger/store-maintenance-command.js +9 -4
- package/dist/cli/messenger/stored.d.ts +2 -0
- package/dist/cli/messenger/stored.js +1 -0
- package/dist/cli/messenger/tasks-command.d.ts +1 -0
- package/dist/cli/messenger/tasks-command.js +1 -0
- package/dist/cli/model-catalogue-command.d.ts +1 -0
- package/dist/cli/model-catalogue-command.js +1 -0
- package/dist/cli/oauth-session.d.ts +14 -4
- package/dist/cli/oauth-session.js +9 -2
- package/dist/cli/option-hints.js +3 -4
- package/dist/cli/paging.d.ts +1 -0
- package/dist/cli/paging.js +1 -0
- package/dist/cli/path-options.d.ts +37 -0
- package/dist/cli/path-options.js +85 -0
- package/dist/cli/permission-keys.d.ts +10 -4
- package/dist/cli/permission-keys.js +9 -3
- package/dist/cli/profile.d.ts +5 -1
- package/dist/cli/profile.js +5 -1
- package/dist/cli/program.js +3 -0
- package/dist/cli/project-evidence.d.ts +9 -1
- package/dist/cli/project-evidence.js +8 -1
- package/dist/cli/project-status-rows.d.ts +2 -1
- package/dist/cli/project-status-rows.js +2 -1
- package/dist/cli/project-status.d.ts +12 -4
- package/dist/cli/project-status.js +10 -4
- package/dist/cli/provider-refs.d.ts +1 -1
- package/dist/cli/provider-refs.js +1 -1
- package/dist/cli/relay-route.js +5 -14
- package/dist/cli/result-fields.d.ts +2 -0
- package/dist/cli/result-fields.js +2 -0
- package/dist/cli/schedule/harnesses.d.ts +10 -5
- package/dist/cli/schedule/harnesses.js +9 -5
- package/dist/cli/schedule/schedule-command.d.ts +16 -6
- package/dist/cli/schedule/schedule-command.js +11 -4
- package/dist/cli/search-left-out.d.ts +5 -1
- package/dist/cli/search-left-out.js +3 -1
- package/dist/cli/service-api-call.d.ts +1 -1
- package/dist/cli/service-api-manifest.d.ts +9 -2
- package/dist/cli/service-api-manifest.js +5 -1
- package/dist/cli/service-api.d.ts +5 -2
- package/dist/cli/service-api.js +7 -2
- package/dist/cli/settings.d.ts +9 -3
- package/dist/cli/settings.js +7 -2
- package/dist/cli/setup-answers.d.ts +3 -0
- package/dist/cli/setup-answers.js +1 -0
- package/dist/cli/shadowed-options.d.ts +1 -1
- package/dist/cli/shadowed-options.js +1 -1
- package/dist/cli/shared-command-exports.d.ts +22 -0
- package/dist/cli/shared-command-exports.js +22 -0
- package/dist/cli/steps.d.ts +5 -1
- package/dist/cli/steps.js +5 -1
- package/dist/cli/store-info.d.ts +2 -0
- package/dist/cli/store-info.js +1 -0
- package/dist/cli/store-recover.d.ts +9 -3
- package/dist/cli/store-recover.js +7 -3
- package/dist/cli/store-settings.d.ts +7 -2
- package/dist/cli/store-settings.js +7 -2
- package/dist/cli/templates-command.d.ts +1 -0
- package/dist/cli/unknown-profile.d.ts +1 -1
- package/dist/cli/unknown-profile.js +1 -1
- package/dist/content/cli/index.js +3 -1
- package/dist/content/sync.d.ts +2 -0
- package/dist/content/sync.js +8 -3
- package/dist/content/testing/sync-contract.js +6 -2
- package/dist/content/writer.d.ts +1 -1
- package/dist/content/writer.js +1 -1
- package/dist/context/evidence.d.ts +4 -0
- package/dist/crm/cli/files.d.ts +1 -1
- package/dist/crm/cli/files.js +3 -2
- package/dist/crm/cli/index.d.ts +1 -1
- package/dist/crm/cli/index.js +5 -4
- package/dist/crm/cli/records.d.ts +1 -1
- package/dist/crm/cli/records.js +1 -1
- package/dist/crm/digest.d.ts +1 -1
- package/dist/crm/foreign-contacts.d.ts +2 -2
- package/dist/crm/foreign-contacts.js +2 -2
- package/dist/crm/manifest/map.d.ts +5 -2
- package/dist/crm/manifest/map.js +14 -2
- package/dist/crm/manifest/paths.d.ts +1 -1
- package/dist/crm/source.d.ts +2 -2
- package/dist/crm/sync.d.ts +6 -2
- package/dist/crm/sync.js +16 -6
- package/dist/crm/testing/manifest-fake.d.ts +2 -1
- package/dist/crm/testing/manifest-fake.js +1 -1
- package/dist/crm/testing/sync-contract.js +7 -2
- package/dist/crm/viewer.d.ts +2 -2
- package/dist/crm/viewer.js +2 -2
- package/dist/crm/writes.d.ts +2 -2
- package/dist/crm/writes.js +1 -1
- package/dist/domain/addresses.d.ts +7 -3
- package/dist/domain/addresses.js +7 -3
- package/dist/domain/business.d.ts +21 -4
- package/dist/domain/business.js +11 -4
- package/dist/domain/categories.d.ts +1 -1
- package/dist/domain/categories.js +1 -1
- package/dist/domain/config-repair.d.ts +1 -1
- package/dist/domain/config-repair.js +1 -1
- package/dist/domain/counters.d.ts +4 -0
- package/dist/domain/counters.js +2 -0
- package/dist/domain/crm.d.ts +18 -7
- package/dist/domain/crm.js +11 -4
- package/dist/domain/deals.d.ts +6 -3
- package/dist/domain/deals.js +4 -3
- package/dist/domain/display-names.d.ts +3 -1
- package/dist/domain/display-names.js +2 -0
- package/dist/domain/finance.d.ts +8 -2
- package/dist/domain/finance.js +4 -2
- package/dist/domain/formatting.d.ts +1 -0
- package/dist/domain/knowledge.d.ts +6 -1
- package/dist/domain/knowledge.js +6 -1
- package/dist/domain/links.d.ts +14 -2
- package/dist/domain/links.js +11 -2
- package/dist/domain/locator.d.ts +4 -1
- package/dist/domain/locator.js +3 -1
- package/dist/domain/markdown.d.ts +1 -0
- package/dist/domain/markdown.js +1 -0
- package/dist/domain/models.d.ts +38 -15
- package/dist/domain/models.js +6 -3
- package/dist/domain/money.d.ts +14 -4
- package/dist/domain/money.js +10 -3
- package/dist/domain/orders.d.ts +4 -1
- package/dist/domain/orders.js +2 -1
- package/dist/domain/organization-sectors.d.ts +10 -0
- package/dist/domain/organization-sectors.generated.d.ts +11 -0
- package/dist/domain/organization-sectors.generated.js +14 -0
- package/dist/domain/organization-sectors.js +9 -0
- package/dist/domain/person-kinds.d.ts +4 -2
- package/dist/domain/person-kinds.js +1 -0
- package/dist/domain/phones.d.ts +2 -0
- package/dist/domain/phones.js +1 -0
- package/dist/domain/polls.d.ts +1 -0
- package/dist/domain/polls.js +1 -0
- package/dist/domain/providers.d.ts +22 -7
- package/dist/domain/providers.js +22 -7
- package/dist/domain/rankings-graph.d.ts +2 -0
- package/dist/domain/rankings-options.d.ts +5 -0
- package/dist/domain/rankings-options.js +1 -0
- package/dist/domain/record-types.d.ts +5 -1
- package/dist/domain/record-types.js +1 -0
- package/dist/domain/records-table.d.ts +18 -3
- package/dist/domain/records-table.js +11 -2
- package/dist/domain/records.d.ts +18 -2
- package/dist/domain/records.js +8 -1
- package/dist/domain/ref-summaries.d.ts +22 -5
- package/dist/domain/ref-summaries.js +9 -2
- package/dist/domain/references.d.ts +4 -2
- package/dist/domain/references.js +3 -2
- package/dist/domain/relation-role-labels.d.ts +5 -1
- package/dist/domain/relation-role-labels.js +4 -1
- package/dist/domain/relations.d.ts +32 -8
- package/dist/domain/relations.js +28 -8
- package/dist/domain/send-time.d.ts +1 -2
- package/dist/domain/send-time.js +1 -2
- package/dist/domain/tag-consolidation.d.ts +5 -0
- package/dist/domain/tag-redirects.d.ts +4 -1
- package/dist/domain/tag-redirects.js +1 -1
- package/dist/domain/tags.d.ts +2 -0
- package/dist/domain/tags.js +1 -0
- package/dist/domain/vcard.d.ts +4 -1
- package/dist/domain/vcard.js +2 -1
- package/dist/entities/business-context.d.ts +10 -4
- package/dist/entities/business-context.js +10 -4
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/knowledge-lists.d.ts +4 -0
- package/dist/entities/knowledge-lists.js +5 -0
- package/dist/entities/list-results.d.ts +1 -0
- package/dist/entities/list-results.js +1 -0
- package/dist/entities/listings.d.ts +12 -5
- package/dist/entities/listings.js +12 -5
- package/dist/entities/note.d.ts +1 -0
- package/dist/entities/note.js +1 -0
- package/dist/entities/store-records.d.ts +1 -0
- package/dist/entities/store-records.js +1 -0
- package/dist/errors/failures.d.ts +3 -1
- package/dist/errors/failures.js +3 -1
- package/dist/errors/reasons.d.ts +1 -0
- package/dist/errors/reasons.js +17 -41
- package/dist/errors/store-reasons.d.ts +5 -0
- package/dist/errors/store-reasons.js +62 -0
- package/dist/http/link-fetch.d.ts +1 -0
- package/dist/http/link-fetch.js +1 -0
- package/dist/http/public-url.d.ts +6 -2
- package/dist/http/public-url.js +6 -2
- package/dist/kit/contract.d.ts +1 -1
- package/dist/kit/contract.js +1 -1
- package/dist/kit/fake.d.ts +2 -1
- package/dist/kit/fake.js +1 -0
- package/dist/kit/run-scope.js +2 -1
- package/dist/kit/search-recipes.d.ts +2 -0
- package/dist/kit/search-recipes.js +1 -0
- package/dist/kit/seed.d.ts +3 -2
- package/dist/kit/seed.js +3 -2
- package/dist/mail/findings.d.ts +1 -1
- package/dist/mail/findings.js +1 -1
- package/dist/mail/score.d.ts +2 -0
- package/dist/mail/score.js +9 -2
- package/dist/mail/sync.js +18 -9
- package/dist/mcp/agent.d.ts +4 -1
- package/dist/mcp/agent.js +2 -1
- package/dist/mcp/all-profiles.d.ts +12 -4
- package/dist/mcp/all-profiles.js +10 -3
- package/dist/mcp/bot/instructions.d.ts +4 -1
- package/dist/mcp/bot/instructions.js +4 -1
- package/dist/mcp/caller.d.ts +1 -0
- package/dist/mcp/caller.js +1 -0
- package/dist/mcp/http/oauth.d.ts +2 -1
- package/dist/mcp/http/oauth.js +2 -1
- package/dist/mcp/http/serve.d.ts +4 -1
- package/dist/mcp/http/serve.js +3 -1
- package/dist/mcp/http/state.d.ts +1 -1
- package/dist/mcp/http/state.js +1 -1
- package/dist/mcp/meeting-preparation.d.ts +5 -1
- package/dist/mcp/meeting-preparation.js +5 -1
- package/dist/mcp/meeting-project-candidates.d.ts +2 -0
- package/dist/mcp/meeting-project-candidates.js +2 -0
- package/dist/mcp/meeting-series-inventory.d.ts +2 -0
- package/dist/mcp/meeting-series-inventory.js +2 -0
- package/dist/mcp/prompts.d.ts +1 -0
- package/dist/mcp/prompts.js +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/session.d.ts +2 -2
- package/dist/mcp/session.js +2 -2
- package/dist/mcp/surface.d.ts +3 -2
- package/dist/mcp/surface.js +2 -1
- package/dist/meetings/cli/query-options.js +3 -2
- package/dist/meetings/event-store.d.ts +7 -2
- package/dist/meetings/findings-rules.d.ts +2 -0
- package/dist/meetings/findings.d.ts +5 -0
- package/dist/meetings/mcp/agent-text.d.ts +12 -4
- package/dist/meetings/mcp/agent-text.js +12 -4
- package/dist/meetings/mcp/index.d.ts +24 -24
- package/dist/meetings/payment.d.ts +15 -3
- package/dist/meetings/payment.js +14 -3
- package/dist/meetings/read-store.d.ts +8 -0
- package/dist/meetings/reference.d.ts +3 -0
- package/dist/meetings/reference.js +3 -0
- package/dist/meetings/result-items.d.ts +1 -0
- package/dist/meetings/result-items.js +1 -0
- package/dist/meetings/transcript-store.d.ts +0 -1
- package/dist/moderation/check.d.ts +3 -1
- package/dist/moderation/check.js +2 -0
- package/dist/moderation/rules.d.ts +5 -2
- package/dist/moderation/rules.js +5 -3
- package/dist/ports/app.d.ts +1 -0
- package/dist/ports/app.js +1 -0
- package/dist/ports/messenger.d.ts +55 -27
- package/dist/ports/traits.d.ts +4 -1
- package/dist/ports/wirecat-tools.d.ts +1 -1
- package/dist/ports/wirecat-tools.js +1 -1
- package/dist/readers/engine.d.ts +2 -2
- package/dist/readers/engine.js +2 -2
- package/dist/render/messages.d.ts +7 -1
- package/dist/render/messages.js +6 -1
- package/dist/replies/dry-run.d.ts +1 -0
- package/dist/replies/dry-run.js +1 -0
- package/dist/replies/rendering.d.ts +2 -0
- package/dist/replies/rendering.js +1 -0
- package/dist/replies/rules.d.ts +1 -2
- package/dist/replies/rules.js +1 -2
- package/dist/replies/serve.d.ts +8 -2
- package/dist/replies/serve.js +6 -1
- package/dist/replies/state.d.ts +1 -0
- package/dist/replies/state.js +1 -0
- package/dist/resolve.d.ts +5 -1
- package/dist/resolve.js +5 -1
- package/dist/runs/events.d.ts +3 -2
- package/dist/runs/events.js +2 -1
- package/dist/runs/log-events.d.ts +4 -1
- package/dist/runs/log-events.js +4 -1
- package/dist/runs/provider-log.d.ts +9 -1
- package/dist/runs/provider-log.js +8 -1
- package/dist/runs/recording.d.ts +9 -1
- package/dist/runs/recording.js +7 -1
- package/dist/runs/run-context.d.ts +1 -0
- package/dist/runs/run-context.js +1 -0
- package/dist/runs/run.d.ts +1 -0
- package/dist/runs/run.js +1 -0
- package/dist/runs/scope.d.ts +1 -0
- package/dist/runs/scope.js +1 -0
- package/dist/search/languages.d.ts +4 -1
- package/dist/search/languages.js +4 -1
- package/dist/search/question-plan.d.ts +3 -3
- package/dist/search/question-plan.js +3 -3
- package/dist/search/service-query.d.ts +7 -2
- package/dist/search/service-query.js +2 -0
- package/dist/sends/buttons.d.ts +7 -3
- package/dist/sends/buttons.js +6 -3
- package/dist/sends/flood.d.ts +3 -1
- package/dist/sends/flood.js +3 -1
- package/dist/sends/guard.d.ts +1 -0
- package/dist/sends/guard.js +1 -0
- package/dist/sends/guarded.d.ts +4 -1
- package/dist/sends/guarded.js +4 -1
- package/dist/sends/journal.d.ts +2 -2
- package/dist/sends/pace.d.ts +6 -1
- package/dist/sends/pace.js +5 -1
- package/dist/sends/permissions.d.ts +14 -9
- package/dist/sends/permissions.js +13 -8
- package/dist/sends/polls.d.ts +6 -3
- package/dist/sends/polls.js +6 -3
- package/dist/sends/recipients.d.ts +1 -0
- package/dist/sends/recipients.js +1 -0
- package/dist/sends/send-as.d.ts +1 -1
- package/dist/sends/send-as.js +1 -1
- package/dist/sends/upload.d.ts +6 -2
- package/dist/sends/upload.js +6 -2
- package/dist/services/business-context.d.ts +2 -2
- package/dist/services/business-context.js +1 -1
- package/dist/services/deal-context.d.ts +1 -1
- package/dist/services/documents/ports.d.ts +0 -2
- package/dist/services/embeddings.d.ts +3 -3
- package/dist/services/inbox.d.ts +6 -2
- package/dist/services/inbox.js +5 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -1
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/moderation.d.ts +1 -1
- package/dist/services/moment.d.ts +1 -0
- package/dist/services/moment.js +1 -0
- package/dist/services/organization-context.d.ts +1 -1
- package/dist/services/people.d.ts +2 -2
- package/dist/services/people.js +1 -1
- package/dist/services/person-business.d.ts +1 -1
- package/dist/services/questions.d.ts +1 -0
- package/dist/services/questions.js +1 -0
- package/dist/services/search-all-rank.d.ts +44 -0
- package/dist/services/search-all-rank.js +112 -0
- package/dist/services/search-all-tracker.d.ts +58 -0
- package/dist/services/search-all-tracker.js +155 -0
- package/dist/services/search-all.d.ts +2 -9
- package/dist/services/search-all.js +19 -200
- package/dist/services/task-rules.d.ts +1 -0
- package/dist/services/task-rules.js +1 -0
- package/dist/services/tasks.d.ts +2 -0
- package/dist/services/tasks.js +2 -0
- package/dist/services/tracker-meaning.js +1 -1
- package/dist/setup/document.d.ts +20 -4
- package/dist/setup/document.js +20 -4
- package/dist/setup/plain.d.ts +1 -0
- package/dist/setup/plain.js +1 -0
- package/dist/speech/hearing.d.ts +1 -1
- package/dist/speech/hearing.js +1 -1
- package/dist/speech/models.d.ts +1 -1
- package/dist/sqlite-runtime.d.ts +2 -0
- package/dist/sqlite-runtime.js +2 -0
- package/dist/store/account-store.d.ts +3 -2
- package/dist/store/accounts.d.ts +1 -0
- package/dist/store/areas.d.ts +41 -0
- package/dist/store/areas.js +17 -0
- package/dist/store/attachments.d.ts +2 -0
- package/dist/store/conversations.d.ts +1 -0
- package/dist/store/counters.d.ts +2 -0
- package/dist/store/damage.d.ts +4 -1
- package/dist/store/damage.js +2 -1
- package/dist/store/decision-requests.d.ts +10 -3
- package/dist/store/decision-requests.js +9 -3
- package/dist/store/decisions.d.ts +5 -1
- package/dist/store/decisions.js +4 -1
- package/dist/store/document-transfer/index.d.ts +2 -0
- package/dist/store/document-transfer/index.js +2 -0
- package/dist/store/document-transfer/model.d.ts +3 -0
- package/dist/store/driver.d.ts +2 -0
- package/dist/store/driver.js +1 -0
- package/dist/store/evidence-findings.d.ts +10 -2
- package/dist/store/evidence-findings.js +2 -0
- package/dist/store/health.d.ts +4 -1
- package/dist/store/health.js +2 -1
- package/dist/store/identity-links.d.ts +13 -4
- package/dist/store/identity-links.js +4 -1
- package/dist/store/identity-splits.d.ts +2 -1
- package/dist/store/identity-splits.js +1 -0
- package/dist/store/index.d.ts +2 -1
- package/dist/store/knowledge-query.d.ts +3 -0
- package/dist/store/knowledge-query.js +3 -0
- package/dist/store/mail-findings.d.ts +4 -1
- package/dist/store/mail-findings.js +1 -0
- package/dist/store/marks.d.ts +20 -3
- package/dist/store/marks.js +12 -1
- package/dist/store/meeting-findings.d.ts +2 -0
- package/dist/store/mentions.d.ts +2 -0
- package/dist/store/message-store.d.ts +219 -0
- package/dist/store/message-store.js +1 -0
- package/dist/store/messages.d.ts +1 -0
- package/dist/store/migrations.d.ts +8 -0
- package/dist/store/migrations.js +59 -6
- package/dist/store/open.d.ts +1 -1
- package/dist/store/open.js +1 -1
- package/dist/store/people.d.ts +27 -5
- package/dist/store/people.js +15 -1
- package/dist/store/project-transfer/manifest.d.ts +3 -1
- package/dist/store/project-transfer/manifest.js +3 -1
- package/dist/store/project-transfer/plan.d.ts +3 -1
- package/dist/store/project-transfer/plan.js +1 -1
- package/dist/store/project-transfer/preview.d.ts +2 -0
- package/dist/store/project-transfer/preview.js +1 -0
- package/dist/store/project-transfer/schema.d.ts +1 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +4 -0
- package/dist/store/project-transfer/snapshot-model.js +3 -0
- package/dist/store/project-transfer/snapshot-plan.d.ts +2 -1
- package/dist/store/project-transfer/snapshot-plan.js +1 -1
- package/dist/store/project-transfer/snapshot.d.ts +3 -1
- package/dist/store/project-transfer/snapshot.js +1 -1
- package/dist/store/project-transfer/store.d.ts +4 -1
- package/dist/store/providers.d.ts +1 -0
- package/dist/store/providers.js +1 -0
- package/dist/store/public.d.ts +40 -0
- package/dist/store/public.js +30 -0
- package/dist/store/queries.d.ts +1 -1
- package/dist/store/repair.d.ts +2 -2
- package/dist/store/repair.js +2 -2
- package/dist/store/roster.d.ts +1 -0
- package/dist/store/search-index.d.ts +1 -0
- package/dist/store/searches.d.ts +1 -0
- package/dist/store/source-review.d.ts +13 -6
- package/dist/store/source-review.js +2 -1
- package/dist/store/sqlite/calendar.js +7 -2
- package/dist/store/sqlite/completeness.d.ts +1 -1
- package/dist/store/sqlite/completeness.js +1 -1
- package/dist/store/sqlite/conversations.d.ts +1 -1
- package/dist/store/sqlite/conversations.js +1 -1
- package/dist/store/sqlite/copy-viewer.d.ts +1 -1
- package/dist/store/sqlite/crm-activities.d.ts +1 -1
- package/dist/store/sqlite/crm-activity-chunks.d.ts +3 -2
- package/dist/store/sqlite/crm-activity-chunks.js +3 -2
- package/dist/store/sqlite/crm-changes.d.ts +1 -1
- package/dist/store/sqlite/crm-files.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.js +1 -1
- package/dist/store/sqlite/crm.d.ts +2 -2
- package/dist/store/sqlite/domain-organizations.d.ts +33 -0
- package/dist/store/sqlite/domain-organizations.js +230 -0
- package/dist/store/sqlite/drizzle/core.d.ts +1 -1
- package/dist/store/sqlite/drizzle/core.js +36 -0
- package/dist/store/sqlite/drizzle/core.js.map +4 -4
- package/dist/store/sqlite/identity-link-rows.d.ts +1 -1
- package/dist/store/sqlite/identity-link-rows.js +1 -1
- package/dist/store/sqlite/knowledge.d.ts +2 -9
- package/dist/store/sqlite/manifest.js +107 -0
- package/dist/store/sqlite/meeting-documents.js +0 -6
- package/dist/store/sqlite/messages.d.ts +1 -1
- package/dist/store/sqlite/messages.js +1 -1
- package/dist/store/sqlite/migrations.generated.js +673 -0
- package/dist/store/sqlite/name-traces.d.ts +1 -1
- package/dist/store/sqlite/name-traces.js +1 -1
- package/dist/store/sqlite/organization-categories.d.ts +1 -1
- package/dist/store/sqlite/organization-categories.js +1 -1
- package/dist/store/sqlite/organizations.d.ts +12 -1
- package/dist/store/sqlite/organizations.js +9 -1
- package/dist/store/sqlite/people-list.d.ts +6 -1
- package/dist/store/sqlite/people-list.js +66 -14
- package/dist/store/sqlite/person-links.d.ts +2 -2
- package/dist/store/sqlite/person-links.js +3 -3
- package/dist/store/sqlite/person-match-scan.d.ts +5 -5
- package/dist/store/sqlite/person-match-scan.js +28 -18
- package/dist/store/sqlite/pipeline-period.d.ts +1 -1
- package/dist/store/sqlite/pipeline-period.js +1 -1
- package/dist/store/sqlite/rebuild.d.ts +52 -0
- package/dist/store/sqlite/rebuild.js +176 -0
- package/dist/store/sqlite/relation-list.d.ts +1 -1
- package/dist/store/sqlite/rollback-copy.d.ts +7 -3
- package/dist/store/sqlite/rollback-copy.js +43 -6
- package/dist/store/sqlite/schema/canonical-tags.js +1 -1
- package/dist/store/sqlite/schema/decision-requests.js +1 -1
- package/dist/store/sqlite/schema/document-changes.js +1 -1
- package/dist/store/sqlite/schema/link-revisions.js +6 -3
- package/dist/store/sqlite/schema/links.js +3 -2
- package/dist/store/sqlite/schema/sender-bots.d.ts +288 -0
- package/dist/store/sqlite/schema/sender-bots.js +22 -0
- package/dist/store/sqlite/schema/tag-consolidations.js +5 -2
- package/dist/store/sqlite/schema/templates.js +1 -1
- package/dist/store/sqlite/schema.d.ts +1 -0
- package/dist/store/sqlite/schema.js +245 -108
- package/dist/store/sqlite/sender-bots.d.ts +43 -0
- package/dist/store/sqlite/sender-bots.js +189 -0
- package/dist/store/sqlite/sender-signals.d.ts +5 -2
- package/dist/store/sqlite/sender-signals.js +6 -6
- package/dist/store/sqlite/tracker.d.ts +11 -9
- package/dist/store/sqlite/tracker.js +27 -12
- package/dist/store/sqlite/vectors.d.ts +1 -1
- package/dist/store/sqlite/vectors.js +1 -1
- package/dist/store/sqlite/version-73.d.ts +12 -0
- package/dist/store/sqlite/version-73.js +114 -0
- package/dist/store/sqlite/work-tasks.js +2 -0
- package/dist/store/sqlite-warning.d.ts +1 -1
- package/dist/store/sqlite-warning.js +1 -1
- package/dist/store/store.d.ts +2 -176
- package/dist/store/store.js +1 -1
- package/dist/store/sync.d.ts +1 -0
- package/dist/store/types.d.ts +5 -3
- package/dist/store/vectors.d.ts +2 -0
- package/dist/tasks/model.d.ts +7 -1
- package/dist/tasks/model.js +6 -1
- package/dist/tasks/priority.d.ts +11 -2
- package/dist/tasks/priority.js +10 -2
- package/dist/terminal/qr.d.ts +1 -0
- package/dist/terminal/qr.js +1 -0
- package/dist/tracker/cli/index.d.ts +1 -1
- package/dist/tracker/cli/index.js +86 -25
- package/dist/tracker/manifest/manifest.d.ts +1 -1
- package/dist/tracker/manifest/manifest.js +1 -1
- package/dist/tracker/sync.d.ts +2 -0
- package/dist/tracker/sync.js +55 -25
- package/dist/tracker/testing/manifest-fake.d.ts +2 -1
- package/dist/tracker/writes.d.ts +28 -0
- package/dist/tracker/writes.js +141 -19
- package/dist/update/index.d.ts +5 -1
- package/dist/update/index.js +4 -1
- package/package.json +29 -9
- package/parity.json +4 -1
- package/dist/services/search-all-deprecated.d.ts +0 -40
- package/dist/services/search-all-deprecated.js +0 -10
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Period } from "../search/question-period.js";
|
|
2
|
+
import type { SearchAllItem, SearchAllRecordItem } from "./search-all.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a deal or a lead is found by: plain words or phrases, all of them, or any with OR. Anything else is refused,
|
|
5
|
+
* so `search all` skips deals with the reason instead of matching a field they do not have.
|
|
6
|
+
*/
|
|
7
|
+
export declare const titleWords: (text: string, refused?: string) => {
|
|
8
|
+
words: string[];
|
|
9
|
+
anyWord: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** A question finds by any of its words, so «что», «кто» or "the" would match nearly every record. */
|
|
12
|
+
export declare const contentWords: (found: {
|
|
13
|
+
words: string[];
|
|
14
|
+
anyWord: boolean;
|
|
15
|
+
}, discover: boolean) => {
|
|
16
|
+
words: string[];
|
|
17
|
+
anyWord: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What the meaning half embeds: the words and phrases asked for, OR included, as notes take them. `title:` narrows to
|
|
21
|
+
* the title, which a hit by meaning cannot be held to, so such a query is searched by words only.
|
|
22
|
+
*/
|
|
23
|
+
export declare const meaningWordsOf: (text: string) => string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* One list for a lane found both ways, as notes and messages fuse theirs: each hit's rank in either list votes, a
|
|
26
|
+
* question's hit voting once; a hit found both ways keeps its words' text and is found by meaning too.
|
|
27
|
+
*/
|
|
28
|
+
export declare const fusedLane: (byWords: SearchAllRecordItem[], byMeaning: {
|
|
29
|
+
hit: SearchAllRecordItem;
|
|
30
|
+
score: number;
|
|
31
|
+
}[], discover: boolean, cosines: Map<string, number>) => SearchAllRecordItem[];
|
|
32
|
+
/**
|
|
33
|
+
* Every source's hits as one list: each source's best hit first, then every other hit by cosine, then by its rank in
|
|
34
|
+
* its source. Taking turns by rank (MEMO-37) gave each of two sources half of a ten-hit page however weak its hits;
|
|
35
|
+
* one model scores every source, so cosine compares across them. A hit only words found takes the cosine of
|
|
36
|
+
* the hit above it in its source: its source ranked it there, and with none it would follow every hit meaning found.
|
|
37
|
+
*/
|
|
38
|
+
export declare const oneList: (lists: SearchAllItem[][], cosines: Map<string, number>) => SearchAllItem[];
|
|
39
|
+
export declare const PERIOD_DEPTH = 100;
|
|
40
|
+
/**
|
|
41
|
+
* A hit dated inside the question's period gains 0.5 over its place, 1 - rank/100: by rank, because only some hits have
|
|
42
|
+
* a cosine to compare. One scale for every page, so paging past the first 100 never reorders what came before.
|
|
43
|
+
*/
|
|
44
|
+
export declare const insidePeriodFirst: (ordered: SearchAllItem[], period: Period | undefined) => SearchAllItem[];
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { parseLucene } from "@wirecat/cli-base/query";
|
|
3
|
+
import { RRF_K } from "../search/fusion.js";
|
|
4
|
+
import { meaningWords } from "../search/lucene/meaning-parts.js";
|
|
5
|
+
import { SEARCH_QUERY } from "../search/lucene/types.js";
|
|
6
|
+
import { isFunctionWord, words as plainWords } from "../search/question-plan.js";
|
|
7
|
+
/**
|
|
8
|
+
* What a deal or a lead is found by: plain words or phrases, all of them, or any with OR. Anything else is refused,
|
|
9
|
+
* so `search all` skips deals with the reason instead of matching a field they do not have.
|
|
10
|
+
*/
|
|
11
|
+
export const titleWords = (text, refused = "deals and leads are found by the words of their title, company, contacts and activities only") => {
|
|
12
|
+
const { root } = parseLucene(text, SEARCH_QUERY);
|
|
13
|
+
const clauses = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
14
|
+
const words = clauses.map(({ node, occur }) => occur !== "must_not" &&
|
|
15
|
+
node.kind === "predicate" &&
|
|
16
|
+
(node.field === "text" || node.field === "title") &&
|
|
17
|
+
(node.operator === "term" || node.operator === "phrase")
|
|
18
|
+
? // A title holds "invoice", not the question mark of "invoice?".
|
|
19
|
+
node.value.replace(/\?+$/u, "") || node.value
|
|
20
|
+
: (() => {
|
|
21
|
+
throw new CliError("validation_error", refused);
|
|
22
|
+
})());
|
|
23
|
+
return { words, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
|
|
24
|
+
};
|
|
25
|
+
/** A question finds by any of its words, so «что», «кто» or "the" would match nearly every record. */
|
|
26
|
+
export const contentWords = (found, discover) => {
|
|
27
|
+
if (!discover)
|
|
28
|
+
return found;
|
|
29
|
+
const content = found.words.filter((word) => !plainWords(word).every(isFunctionWord));
|
|
30
|
+
return content.length ? { ...found, words: content } : found;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* What the meaning half embeds: the words and phrases asked for, OR included, as notes take them. `title:` narrows to
|
|
34
|
+
* the title, which a hit by meaning cannot be held to, so such a query is searched by words only.
|
|
35
|
+
*/
|
|
36
|
+
export const meaningWordsOf = (text) => {
|
|
37
|
+
try {
|
|
38
|
+
const { root } = parseLucene(text, SEARCH_QUERY);
|
|
39
|
+
const nodes = root.kind === "boolean" ? root.clauses.map(({ node }) => node) : [root];
|
|
40
|
+
if (!nodes.every((node) => node.kind === "predicate" && node.field === "text"))
|
|
41
|
+
return undefined;
|
|
42
|
+
return meaningWords(root) || undefined;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* One list for a lane found both ways, as notes and messages fuse theirs: each hit's rank in either list votes, a
|
|
50
|
+
* question's hit voting once; a hit found both ways keeps its words' text and is found by meaning too.
|
|
51
|
+
*/
|
|
52
|
+
export const fusedLane = (byWords, byMeaning, discover, cosines) => {
|
|
53
|
+
const fused = new Map();
|
|
54
|
+
byWords.forEach((item, rank) => {
|
|
55
|
+
fused.set(item.ref, { item, score: 1 / (RRF_K + rank + 1) });
|
|
56
|
+
});
|
|
57
|
+
byMeaning.forEach(({ hit, score }, rank) => {
|
|
58
|
+
cosines.set(hit.ref, score);
|
|
59
|
+
const held = fused.get(hit.ref);
|
|
60
|
+
if (held && !held.item.foundBy.includes("meaning"))
|
|
61
|
+
held.item.foundBy = [...held.item.foundBy, "meaning"];
|
|
62
|
+
const vote = 1 / (RRF_K + rank + 1);
|
|
63
|
+
if (held && discover)
|
|
64
|
+
held.score = Math.max(held.score, vote);
|
|
65
|
+
else
|
|
66
|
+
fused.set(hit.ref, { item: held?.item ?? hit, score: (held?.score ?? 0) + vote });
|
|
67
|
+
});
|
|
68
|
+
return [...fused.values()].sort((a, b) => b.score - a.score).map(({ item }) => item);
|
|
69
|
+
};
|
|
70
|
+
/** Passages of one meeting share its `ref`, the reference evidence cites; each is still a hit of its own. */
|
|
71
|
+
const hitKey = (item) => item.kind === "meeting" ? `${item.ref}\u0000${item.scope}\u0000${item.id}` : item.ref;
|
|
72
|
+
/**
|
|
73
|
+
* Every source's hits as one list: each source's best hit first, then every other hit by cosine, then by its rank in
|
|
74
|
+
* its source. Taking turns by rank (MEMO-37) gave each of two sources half of a ten-hit page however weak its hits;
|
|
75
|
+
* one model scores every source, so cosine compares across them. A hit only words found takes the cosine of
|
|
76
|
+
* the hit above it in its source: its source ranked it there, and with none it would follow every hit meaning found.
|
|
77
|
+
*/
|
|
78
|
+
export const oneList = (lists, cosines) => {
|
|
79
|
+
const place = new Map();
|
|
80
|
+
for (const list of lists) {
|
|
81
|
+
let above = Number.NEGATIVE_INFINITY;
|
|
82
|
+
list.forEach((item, rank) => {
|
|
83
|
+
const key = hitKey(item);
|
|
84
|
+
above = cosines.get(item.ref) ?? above;
|
|
85
|
+
const held = place.get(key);
|
|
86
|
+
if (!held || rank < held.rank)
|
|
87
|
+
place.set(key, { item, rank, cosine: above });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const head = (rank) => Math.min(rank, 1);
|
|
91
|
+
return [...place.values()]
|
|
92
|
+
.sort((a, b) => head(a.rank) - head(b.rank) || b.cosine - a.cosine || a.rank - b.rank)
|
|
93
|
+
.map(({ item }) => item);
|
|
94
|
+
};
|
|
95
|
+
export const PERIOD_DEPTH = 100;
|
|
96
|
+
const PERIOD_BOOST = 0.5;
|
|
97
|
+
/**
|
|
98
|
+
* A hit dated inside the question's period gains 0.5 over its place, 1 - rank/100: by rank, because only some hits have
|
|
99
|
+
* a cosine to compare. One scale for every page, so paging past the first 100 never reorders what came before.
|
|
100
|
+
*/
|
|
101
|
+
export const insidePeriodFirst = (ordered, period) => {
|
|
102
|
+
if (!period)
|
|
103
|
+
return ordered;
|
|
104
|
+
const inside = ({ timestamp }) => {
|
|
105
|
+
const at = timestamp === null ? Number.NaN : Date.parse(timestamp);
|
|
106
|
+
return at >= period.from && at < period.to;
|
|
107
|
+
};
|
|
108
|
+
return ordered
|
|
109
|
+
.map((item, rank) => ({ item, score: 1 - rank / PERIOD_DEPTH + (inside(item) ? PERIOD_BOOST : 0) }))
|
|
110
|
+
.sort((a, b) => b.score - a.score)
|
|
111
|
+
.map(({ item }) => item);
|
|
112
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type WarmEmbedders } from "../embeddings/embed.js";
|
|
2
|
+
import type { AccountKey, MessageStore, TrackerItem } from "../store/store.js";
|
|
3
|
+
import type { SearchAllRecordItem } from "./search-all.js";
|
|
4
|
+
interface TrackerLaneRequest {
|
|
5
|
+
text: string;
|
|
6
|
+
accounts: AccountKey[];
|
|
7
|
+
depth: number;
|
|
8
|
+
discover: boolean;
|
|
9
|
+
exact?: boolean;
|
|
10
|
+
/** Filled with each hit found by meaning, by its cosine. */
|
|
11
|
+
cosines: Map<string, number>;
|
|
12
|
+
embedders: Pick<WarmEmbedders, "get">;
|
|
13
|
+
command?: string;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Issues, projects and comments by words, and by meaning when the model and some vectors are there, fused as notes
|
|
18
|
+
* fuse theirs; `records` gives each hit's record by its ref. A query naming a field an issue lacks is a `validation_error`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const trackerLane: (store: MessageStore, { text, accounts: read, depth, discover, exact, cosines, embedders, command, env }: TrackerLaneRequest) => Promise<{
|
|
21
|
+
hits: SearchAllRecordItem[];
|
|
22
|
+
records: Map<string, TrackerItem<"comment" | "issue" | "label" | "project" | "sprint" | "state" | "team" | "user">>;
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
tracker: {
|
|
25
|
+
by: "words" | "words and meaning";
|
|
26
|
+
meaningSkipped?: string;
|
|
27
|
+
};
|
|
28
|
+
meaningReason?: string | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
/** One hit of `searchTracker`: the record beside how `search all` shows it. */
|
|
31
|
+
export interface TrackerSearchHit {
|
|
32
|
+
hit: SearchAllRecordItem;
|
|
33
|
+
item: TrackerItem;
|
|
34
|
+
}
|
|
35
|
+
export interface TrackerSearchFound {
|
|
36
|
+
items: TrackerSearchHit[];
|
|
37
|
+
hasMore: boolean;
|
|
38
|
+
by: "words" | "words and meaning";
|
|
39
|
+
/** Why meaning was not searched, when it was not. */
|
|
40
|
+
meaningSkipped?: string;
|
|
41
|
+
/** `model.not-downloaded`, or `tracker.no-vectors` when the model is there but nothing is embedded with it. */
|
|
42
|
+
meaningReason?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A tracker CLI's own search over its accounts' copies, ranked as the tracker lane of `search all` ranks them: words,
|
|
46
|
+
* and meaning once `sync --embed` built the vectors; a question finds what holds some of its words.
|
|
47
|
+
*/
|
|
48
|
+
export declare const searchTracker: (store: MessageStore, request: {
|
|
49
|
+
text: string;
|
|
50
|
+
accounts: AccountKey[];
|
|
51
|
+
limit: number;
|
|
52
|
+
offset?: number;
|
|
53
|
+
now?: number;
|
|
54
|
+
timezone?: string;
|
|
55
|
+
command?: string;
|
|
56
|
+
env?: NodeJS.ProcessEnv;
|
|
57
|
+
}) => Promise<TrackerSearchFound>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { timezoneOf } from "@wirecat/cli-base/query";
|
|
3
|
+
import { hasGlobalItemIds } from "../domain/providers.js";
|
|
4
|
+
import { trackerBodyOf, trackerTitleOf } from "../domain/tracker.js";
|
|
5
|
+
import { runEmbedders } from "../embeddings/embed.js";
|
|
6
|
+
import { plainQuery } from "../search/lucene/plain.js";
|
|
7
|
+
import { questionPeriod } from "../search/question-period.js";
|
|
8
|
+
import { questionLookup, questionText } from "../search/question-plan.js";
|
|
9
|
+
import { excerpt } from "./excerpt.js";
|
|
10
|
+
import { contentWords, fusedLane, insidePeriodFirst, meaningWordsOf, oneList, PERIOD_DEPTH, titleWords, } from "./search-all-rank.js";
|
|
11
|
+
import { nearestTracker } from "./tracker-meaning.js";
|
|
12
|
+
const TRACKER_HIT_KINDS = { issue: "issue", project: "project", comment: "issue_comment" };
|
|
13
|
+
/** An issue is titled as people say it, `ENG-12 Fix login`; anything else by its name or its first line. */
|
|
14
|
+
const trackerTitle = ({ kind, record }) => {
|
|
15
|
+
const title = trackerTitleOf(kind, record);
|
|
16
|
+
const key = kind === "issue" ? record.key : undefined;
|
|
17
|
+
return key ? `${key} ${title}` : title;
|
|
18
|
+
};
|
|
19
|
+
const trackerExcerpt = ({ kind, record }, query) => excerpt([trackerTitleOf(kind, record), trackerBodyOf(kind, record)].filter(Boolean).join("\n"), query);
|
|
20
|
+
/**
|
|
21
|
+
* One hit per tracker item, best first: the copies other sign-ins hold of one item (`items` maps a hit's ref to the
|
|
22
|
+
* item, for a provider whose ids name one item across its accounts) join the best-placed one, which names every account and takes the best cosine and every way any was found.
|
|
23
|
+
*/
|
|
24
|
+
const oneHitPerItem = (ordered, cosines, items) => {
|
|
25
|
+
const kept = new Map();
|
|
26
|
+
for (const hit of ordered) {
|
|
27
|
+
const key = items.get(hit.ref) ?? hit.ref;
|
|
28
|
+
const held = kept.get(key);
|
|
29
|
+
if (!held) {
|
|
30
|
+
kept.set(key, hit);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
held.accounts = [...(held.accounts ?? [held.account]), hit.account];
|
|
34
|
+
held.foundBy = ["words", "meaning"].filter((by) => [held, hit].some(({ foundBy }) => foundBy.includes(by)));
|
|
35
|
+
const cosine = cosines.get(hit.ref);
|
|
36
|
+
if (cosine !== undefined && cosine > (cosines.get(held.ref) ?? Number.NEGATIVE_INFINITY))
|
|
37
|
+
cosines.set(held.ref, cosine);
|
|
38
|
+
}
|
|
39
|
+
return [...kept.values()];
|
|
40
|
+
};
|
|
41
|
+
const TRACKER_DEPTH = 500;
|
|
42
|
+
/**
|
|
43
|
+
* Issues, projects and comments by words, and by meaning when the model and some vectors are there, fused as notes
|
|
44
|
+
* fuse theirs; `records` gives each hit's record by its ref. A query naming a field an issue lacks is a `validation_error`.
|
|
45
|
+
*/
|
|
46
|
+
export const trackerLane = async (store, { text, accounts: read, depth, discover, exact, cosines, embedders, command, env }) => {
|
|
47
|
+
const { words, anyWord } = contentWords(titleWords(text, "issues, projects and comments are found by the words and meaning of their title and text only"), discover);
|
|
48
|
+
// Two sign-ins to one workspace hold each item twice, and the copies fold into one hit: read deep enough that the
|
|
49
|
+
// folded list still fills the page.
|
|
50
|
+
const deep = Math.min(depth * read.length, TRACKER_DEPTH);
|
|
51
|
+
const found = await store.tracker.find({
|
|
52
|
+
words,
|
|
53
|
+
anyWord: anyWord || discover,
|
|
54
|
+
...(exact ? { exact: true } : {}),
|
|
55
|
+
kinds: ["issue", "project", "comment"],
|
|
56
|
+
limit: deep,
|
|
57
|
+
accounts: read,
|
|
58
|
+
});
|
|
59
|
+
const items = new Map();
|
|
60
|
+
const records = new Map();
|
|
61
|
+
const hitOf = (at, item, excerpt, foundBy) => {
|
|
62
|
+
const ref = `tracker:${at.provider}/${at.account}/${item.kind}/${item.record.externalId}`;
|
|
63
|
+
if (hasGlobalItemIds(at.provider))
|
|
64
|
+
items.set(ref, JSON.stringify([at.provider, item.kind, item.record.externalId]));
|
|
65
|
+
records.set(ref, item);
|
|
66
|
+
return {
|
|
67
|
+
kind: TRACKER_HIT_KINDS[item.kind],
|
|
68
|
+
// Two sign-ins see the same issue under the same id, so the account keeps their hits apart.
|
|
69
|
+
ref,
|
|
70
|
+
provider: at.provider,
|
|
71
|
+
account: at.account,
|
|
72
|
+
...(item.record.url ? { url: item.record.url } : {}),
|
|
73
|
+
title: trackerTitle(item),
|
|
74
|
+
timestamp: new Date(item.record.updatedAt ?? item.syncedAt).toISOString(),
|
|
75
|
+
text: excerpt,
|
|
76
|
+
foundBy,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const byWords = found.items.map(({ account: at, item, excerpt: text }) => hitOf(at, item, text, ["words"]));
|
|
80
|
+
const plain = meaningWordsOf(discover ? questionText(text) : text);
|
|
81
|
+
let near;
|
|
82
|
+
let meaningSkipped;
|
|
83
|
+
let meaningReason;
|
|
84
|
+
if (exact)
|
|
85
|
+
meaningSkipped = "--exact searches words as written";
|
|
86
|
+
else if (plain === undefined)
|
|
87
|
+
meaningSkipped = "the query names a title, which meaning cannot follow";
|
|
88
|
+
else
|
|
89
|
+
try {
|
|
90
|
+
near = await nearestTracker(store, plain, {
|
|
91
|
+
limit: deep,
|
|
92
|
+
accounts: read,
|
|
93
|
+
embedders,
|
|
94
|
+
...(command === undefined ? {} : { command }),
|
|
95
|
+
...(env === undefined ? {} : { env }),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (!(error instanceof CliError && error.code === "not_found"))
|
|
100
|
+
throw error;
|
|
101
|
+
meaningSkipped = error.message;
|
|
102
|
+
const { reason } = error.details;
|
|
103
|
+
if (typeof reason === "string")
|
|
104
|
+
meaningReason = reason;
|
|
105
|
+
}
|
|
106
|
+
const tracker = {
|
|
107
|
+
by: near === undefined ? "words" : "words and meaning",
|
|
108
|
+
...(meaningSkipped === undefined ? {} : { meaningSkipped }),
|
|
109
|
+
};
|
|
110
|
+
const hits = near === undefined
|
|
111
|
+
? oneHitPerItem(byWords, cosines, items)
|
|
112
|
+
: oneHitPerItem(fusedLane(byWords, near.map(({ account: at, item, score }) => ({
|
|
113
|
+
hit: hitOf(at, item, trackerExcerpt(item, text), ["meaning"]),
|
|
114
|
+
score,
|
|
115
|
+
})), discover, cosines), cosines, items);
|
|
116
|
+
return { hits, records, hasMore: found.hasMore, tracker, ...(meaningReason ? { meaningReason } : {}) };
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* A tracker CLI's own search over its accounts' copies, ranked as the tracker lane of `search all` ranks them: words,
|
|
120
|
+
* and meaning once `sync --embed` built the vectors; a question finds what holds some of its words.
|
|
121
|
+
*/
|
|
122
|
+
export const searchTracker = async (store, request) => {
|
|
123
|
+
if (!request.text.trim())
|
|
124
|
+
throw new CliError("validation_error", "say what to find");
|
|
125
|
+
const text = plainQuery(request.text);
|
|
126
|
+
const offset = request.offset ?? 0;
|
|
127
|
+
const window = offset + request.limit;
|
|
128
|
+
const period = questionPeriod(text, request.now ?? Date.now(), timezoneOf(request.timezone));
|
|
129
|
+
const cosines = new Map();
|
|
130
|
+
const embedders = runEmbedders();
|
|
131
|
+
try {
|
|
132
|
+
const found = await trackerLane(store, {
|
|
133
|
+
text,
|
|
134
|
+
accounts: request.accounts,
|
|
135
|
+
depth: Math.max(window, period ? PERIOD_DEPTH : 0),
|
|
136
|
+
discover: questionLookup(text) !== undefined,
|
|
137
|
+
cosines,
|
|
138
|
+
embedders,
|
|
139
|
+
...(request.command === undefined ? {} : { command: request.command }),
|
|
140
|
+
...(request.env === undefined ? {} : { env: request.env }),
|
|
141
|
+
});
|
|
142
|
+
const ordered = insidePeriodFirst(oneList([found.hits], cosines), period);
|
|
143
|
+
return {
|
|
144
|
+
items: ordered.slice(offset, window).map((hit) => ({ hit, item: found.records.get(hit.ref) })),
|
|
145
|
+
// The lane reads at most 500 rows, so a page past them would be empty and say there are more.
|
|
146
|
+
hasMore: window < TRACKER_DEPTH && (found.hasMore || ordered.length > window),
|
|
147
|
+
by: found.tracker.by,
|
|
148
|
+
...(found.tracker.meaningSkipped === undefined ? {} : { meaningSkipped: found.tracker.meaningSkipped }),
|
|
149
|
+
...(found.meaningReason === undefined ? {} : { meaningReason: found.meaningReason }),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
await embedders.close();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
@@ -10,6 +10,7 @@ import type { SearchCoverage } from "./messages-search.js";
|
|
|
10
10
|
import { type MeetingAccountCoverage, type MeetingSearchItem } from "./search-all-meetings.js";
|
|
11
11
|
import { type HarderOptions, type HarderResult } from "./search-harder.js";
|
|
12
12
|
import type { Backend, ServerOptions, ServerSearched } from "./server-search.js";
|
|
13
|
+
export { titleWords } from "./search-all-rank.js";
|
|
13
14
|
export declare const RESOURCES_SEARCHED: readonly ["messages", "mail", "notes", "events", "crm", "business", "meetings", "tracker"];
|
|
14
15
|
export type SearchedResource = (typeof RESOURCES_SEARCHED)[number];
|
|
15
16
|
/** One hit of `search all`: a stored record, or a passage of a meeting. */
|
|
@@ -167,7 +168,7 @@ export interface SearchAllRequest {
|
|
|
167
168
|
meetingsAsked?: boolean;
|
|
168
169
|
/** The CRM kinds `crm` reads; absent, deals and leads. */
|
|
169
170
|
crmKinds?: readonly DealKind[];
|
|
170
|
-
/** The CRM accounts' copies a CRM CLI's profile may read only part of, each by its own rule
|
|
171
|
+
/** The CRM accounts' copies a CRM CLI's profile may read only part of, each by its own rule. */
|
|
171
172
|
crmViewers?: CopyViewer[];
|
|
172
173
|
/** `crm` also reads the text of downloaded CRM files under the same viewers; false when the profile denies it. */
|
|
173
174
|
crmFiles?: boolean;
|
|
@@ -189,14 +190,6 @@ export type SearchAllMessenger = Partial<Pick<MessengerTraits, "savedChatId" | "
|
|
|
189
190
|
*/
|
|
190
191
|
hintCommand?: string | null;
|
|
191
192
|
};
|
|
192
|
-
/**
|
|
193
|
-
* What a deal or a lead is found by: plain words or phrases, all of them, or any with OR. Anything else is refused,
|
|
194
|
-
* so `search all` skips deals with the reason instead of matching a field they do not have.
|
|
195
|
-
*/
|
|
196
|
-
export declare const titleWords: (text: string, refused?: string) => {
|
|
197
|
-
words: string[];
|
|
198
|
-
anyWord: boolean;
|
|
199
|
-
};
|
|
200
193
|
/** A tracker hit's kind: a comment is named for the issue it is on, beside a CRM's and a message's kinds. */
|
|
201
194
|
export type TrackerHitKind = "issue" | "project" | "issue_comment";
|
|
202
195
|
/** The accounts of every tracker the store holds copies of. */
|