@wirecat/cli-core 0.605.0 → 0.607.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 +284 -1
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +1 -0
- package/dist/calendar/reads.js +5 -0
- package/dist/cli/app-mcp-command.d.ts +6 -2
- package/dist/cli/app-mcp-command.js +11 -2
- package/dist/cli/csv.d.ts +10 -0
- package/dist/cli/csv.js +22 -0
- package/dist/cli/early-refusal.d.ts +10 -0
- package/dist/cli/early-refusal.js +19 -0
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/profile-token.d.ts +29 -0
- package/dist/cli/profile-token.js +65 -0
- package/dist/cli/program.js +4 -2
- package/dist/cli/store-settings.js +38 -4
- package/dist/crm/cli/csv.d.ts +23 -0
- package/dist/crm/cli/csv.js +135 -0
- package/dist/crm/cli/index.d.ts +1 -1
- package/dist/crm/cli/index.js +36 -22
- package/dist/crm/cli/pipeline-view.d.ts +3 -0
- package/dist/crm/cli/pipeline-view.js +36 -0
- package/dist/crm/index.d.ts +2 -2
- package/dist/crm/index.js +1 -1
- package/dist/crm/source.d.ts +35 -5
- package/dist/crm/sync.d.ts +15 -7
- package/dist/crm/sync.js +169 -11
- package/dist/crm/writes.d.ts +6 -4
- package/dist/crm/writes.js +17 -13
- package/dist/documents.d.ts +2 -0
- package/dist/documents.js +2 -0
- package/dist/domain/business.d.ts +79 -0
- package/dist/domain/business.js +42 -0
- package/dist/domain/crm.d.ts +41 -2
- package/dist/domain/deals.d.ts +5 -2
- package/dist/domain/deals.js +5 -2
- package/dist/domain/finance.d.ts +2 -0
- package/dist/domain/finance.js +2 -2
- package/dist/domain/google-documents.d.ts +2 -0
- package/dist/domain/google-documents.js +3 -1
- package/dist/domain/money.d.ts +2 -0
- package/dist/domain/money.js +11 -3
- package/dist/domain/providers.d.ts +36 -1
- package/dist/domain/providers.js +69 -7
- package/dist/domain/record-fields.d.ts +42 -0
- package/dist/domain/record-fields.js +122 -0
- package/dist/domain/record-types.d.ts +489 -16
- package/dist/domain/record-types.js +374 -7
- package/dist/domain/records.d.ts +96 -5
- package/dist/domain/records.js +178 -32
- package/dist/domain/ref-summaries.js +5 -0
- package/dist/domain/references.d.ts +1 -1
- package/dist/domain/references.js +5 -0
- package/dist/domain/relations.d.ts +125 -0
- package/dist/domain/relations.js +107 -0
- package/dist/domain/vcard.d.ts +25 -0
- package/dist/domain/vcard.js +267 -0
- package/dist/entities/deal.d.ts +16 -2
- package/dist/entities/deal.js +5 -1
- package/dist/entities/index.d.ts +29 -13
- package/dist/entities/relationship.d.ts +8 -2
- package/dist/entities/relationship.js +8 -2
- package/dist/entities/task-results.d.ts +10 -10
- package/dist/errors/reasons.js +73 -2
- package/dist/fetch/addresses.d.ts +5 -0
- package/dist/fetch/addresses.js +76 -0
- package/dist/fetch/page.d.ts +64 -0
- package/dist/fetch/page.js +256 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +6 -3
- package/dist/mail/cli/review.js +20 -6
- package/dist/mail/index.d.ts +1 -1
- package/dist/mail/marks.d.ts +10 -5
- package/dist/mail/marks.js +16 -8
- package/dist/mail/review.d.ts +5 -0
- package/dist/meetings/calendar-text.d.ts +1 -1
- package/dist/meetings/calendar-text.js +4 -0
- package/dist/meetings/event-store.d.ts +2 -2
- package/dist/search/account-list.d.ts +4 -0
- package/dist/search/account-list.js +19 -8
- package/dist/search/query.js +2 -2
- package/dist/services/events-search.js +2 -2
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/ingest.d.ts +56 -8
- package/dist/services/ingest.js +95 -61
- package/dist/services/link-scorers/scan.js +2 -1
- package/dist/services/link-scorers/shared.js +2 -1
- package/dist/services/messages-search.js +3 -2
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/notes-search.js +1 -0
- package/dist/services/project-status/index.js +2 -1
- package/dist/services/proposals/kinds/contracts.d.ts +4 -0
- package/dist/services/proposals/kinds/contracts.js +9 -0
- package/dist/services/proposals/kinds/finance.d.ts +4 -0
- package/dist/services/proposals/kinds/finance.js +14 -35
- package/dist/services/proposals/kinds/orders.js +7 -30
- package/dist/services/proposals/kinds/shared.d.ts +27 -1
- package/dist/services/proposals/kinds/shared.js +34 -0
- package/dist/services/proposals/kinds/source-review.d.ts +4 -0
- package/dist/services/proposals/kinds/source-review.js +45 -0
- package/dist/services/proposals/kinds/subscriptions.d.ts +9 -0
- package/dist/services/proposals/kinds/subscriptions.js +24 -0
- package/dist/services/proposals/kinds/transactions.d.ts +4 -0
- package/dist/services/proposals/kinds/transactions.js +10 -0
- package/dist/services/proposals/registry.js +9 -0
- package/dist/services/search-all-meetings.js +2 -2
- package/dist/services/search-all.js +4 -3
- package/dist/services/search-kind.js +3 -3
- package/dist/services/stored-project-gathering.js +4 -3
- package/dist/store/decisions.js +5 -1
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/index.d.ts +20 -4
- package/dist/store/index.js +4 -0
- package/dist/store/people.js +1 -1
- package/dist/store/project-transfer/request.d.ts +4 -1
- package/dist/store/project-transfer/schema.d.ts +9 -2
- package/dist/store/project-transfer/schema.js +4 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +8 -2
- package/dist/store/source-review.d.ts +64 -0
- package/dist/store/source-review.js +7 -0
- package/dist/store/sqlite/accounts.d.ts +1 -1
- package/dist/store/sqlite/accounts.js +24 -1
- package/dist/store/sqlite/added-sources.d.ts +82 -0
- package/dist/store/sqlite/added-sources.js +237 -0
- package/dist/store/sqlite/business-contracts.d.ts +90 -0
- package/dist/store/sqlite/business-contracts.js +182 -0
- package/dist/store/sqlite/calendar-events.js +7 -3
- package/dist/store/sqlite/calendar-forget.js +3 -0
- package/dist/store/sqlite/calendar.d.ts +21 -1
- package/dist/store/sqlite/calendar.js +27 -7
- package/dist/store/sqlite/chat-rekey.js +7 -0
- package/dist/store/sqlite/chats.d.ts +3 -1
- package/dist/store/sqlite/chats.js +15 -1
- package/dist/store/sqlite/crm-rows.d.ts +44 -0
- package/dist/store/sqlite/crm-rows.js +195 -0
- package/dist/store/sqlite/crm-settings.d.ts +28 -0
- package/dist/store/sqlite/crm-settings.js +80 -0
- package/dist/store/sqlite/crm.d.ts +42 -11
- package/dist/store/sqlite/crm.js +402 -196
- package/dist/store/sqlite/deals.d.ts +4 -8
- package/dist/store/sqlite/deals.js +8 -5
- package/dist/store/sqlite/document-transfer/snapshot.js +2 -2
- package/dist/store/sqlite/emails.js +2 -0
- package/dist/store/sqlite/entity-types.d.ts +14 -9
- package/dist/store/sqlite/entity-types.js +4 -10
- package/dist/store/sqlite/evidence-signature.d.ts +114 -0
- package/dist/store/sqlite/evidence-signature.js +349 -0
- package/dist/store/sqlite/evidence-sources.d.ts +2 -1
- package/dist/store/sqlite/evidence-sources.js +7 -3
- package/dist/store/sqlite/facts.d.ts +7 -2
- package/dist/store/sqlite/facts.js +21 -5
- package/dist/store/sqlite/finance.d.ts +18 -105
- package/dist/store/sqlite/finance.js +100 -219
- package/dist/store/sqlite/involvement-queue.js +4 -3
- package/dist/store/sqlite/knowledge.d.ts +14 -4
- package/dist/store/sqlite/knowledge.js +108 -102
- package/dist/store/sqlite/labelled.d.ts +3 -0
- package/dist/store/sqlite/labelled.js +11 -0
- package/dist/store/sqlite/link-kinds.d.ts +4 -3
- package/dist/store/sqlite/link-kinds.js +6 -2
- package/dist/store/sqlite/manifest.js +7 -0
- package/dist/store/sqlite/memories.d.ts +24 -10
- package/dist/store/sqlite/memories.js +73 -19
- package/dist/store/sqlite/messages.js +2 -0
- package/dist/store/sqlite/migrations.generated.js +134 -0
- package/dist/store/sqlite/money-lines.d.ts +48 -0
- package/dist/store/sqlite/money-lines.js +76 -0
- package/dist/store/sqlite/money-transactions.d.ts +132 -0
- package/dist/store/sqlite/money-transactions.js +295 -0
- package/dist/store/sqlite/notes.d.ts +14 -4
- package/dist/store/sqlite/notes.js +43 -31
- package/dist/store/sqlite/orders.d.ts +36 -6
- package/dist/store/sqlite/orders.js +126 -46
- package/dist/store/sqlite/organizations.d.ts +8 -0
- package/dist/store/sqlite/organizations.js +14 -0
- package/dist/store/sqlite/payment-facts.js +1 -1
- package/dist/store/sqlite/person-preparation.d.ts +1 -1
- package/dist/store/sqlite/person-preparation.js +3 -2
- package/dist/store/sqlite/private-people.js +2 -0
- package/dist/store/sqlite/products.d.ts +78 -0
- package/dist/store/sqlite/products.js +131 -0
- package/dist/store/sqlite/project-transfer/records.js +39 -3
- package/dist/store/sqlite/project-transfer/snapshot.d.ts +4 -1
- package/dist/store/sqlite/project-transfer/snapshot.js +11 -3
- package/dist/store/sqlite/proposed-actions.d.ts +1 -1
- package/dist/store/sqlite/proposed-actions.js +24 -7
- package/dist/store/sqlite/providers.d.ts +0 -4
- package/dist/store/sqlite/providers.js +20 -2
- package/dist/store/sqlite/record-matching.d.ts +80 -0
- package/dist/store/sqlite/record-matching.js +264 -0
- package/dist/store/sqlite/record-projection.d.ts +89 -0
- package/dist/store/sqlite/record-projection.js +50 -0
- package/dist/store/sqlite/record-projectors-direct.d.ts +17 -0
- package/dist/store/sqlite/record-projectors-direct.js +125 -0
- package/dist/store/sqlite/record-projectors-money.d.ts +26 -0
- package/dist/store/sqlite/record-projectors-money.js +214 -0
- package/dist/store/sqlite/record-projectors-phone.d.ts +28 -0
- package/dist/store/sqlite/record-projectors-phone.js +212 -0
- package/dist/store/sqlite/record-projectors.d.ts +3 -44
- package/dist/store/sqlite/record-projectors.js +7 -67
- package/dist/store/sqlite/record-relations.d.ts +24 -0
- package/dist/store/sqlite/record-relations.js +92 -0
- package/dist/store/sqlite/record-remap.d.ts +12 -0
- package/dist/store/sqlite/record-remap.js +92 -0
- package/dist/store/sqlite/record-run.d.ts +71 -0
- package/dist/store/sqlite/record-run.js +179 -0
- package/dist/store/sqlite/record-settling.d.ts +9 -0
- package/dist/store/sqlite/record-settling.js +74 -0
- package/dist/store/sqlite/record-stamps.d.ts +13 -0
- package/dist/store/sqlite/record-stamps.js +30 -0
- package/dist/store/sqlite/record-writes.d.ts +43 -0
- package/dist/store/sqlite/record-writes.js +307 -0
- package/dist/store/sqlite/records.d.ts +52 -42
- package/dist/store/sqlite/records.js +123 -353
- package/dist/store/sqlite/ref-summaries.d.ts +6 -5
- package/dist/store/sqlite/ref-summaries.js +60 -8
- package/dist/store/sqlite/refunds.d.ts +31 -0
- package/dist/store/sqlite/refunds.js +112 -0
- package/dist/store/sqlite/relation-list.d.ts +43 -0
- package/dist/store/sqlite/relation-list.js +133 -0
- package/dist/store/sqlite/relation-proposals.d.ts +28 -6
- package/dist/store/sqlite/relation-proposals.js +134 -10
- package/dist/store/sqlite/relation-reads.d.ts +8 -0
- package/dist/store/sqlite/relation-reads.js +7 -0
- package/dist/store/sqlite/relation-roles.d.ts +26 -0
- package/dist/store/sqlite/relation-roles.js +91 -0
- package/dist/store/sqlite/reported-relations.d.ts +63 -0
- package/dist/store/sqlite/reported-relations.js +132 -0
- package/dist/store/sqlite/reviewed.d.ts +109 -0
- package/dist/store/sqlite/reviewed.js +173 -0
- package/dist/store/sqlite/schema/link-revisions.d.ts +136 -0
- package/dist/store/sqlite/schema/link-revisions.js +11 -0
- package/dist/store/sqlite/schema/links.d.ts +360 -0
- package/dist/store/sqlite/schema/links.js +32 -0
- package/dist/store/sqlite/schema.d.ts +2769 -306
- package/dist/store/sqlite/schema.js +258 -25
- package/dist/store/sqlite/source-review-marks.d.ts +54 -0
- package/dist/store/sqlite/source-review-marks.js +143 -0
- package/dist/store/sqlite/source-review.d.ts +54 -0
- package/dist/store/sqlite/source-review.js +221 -0
- package/dist/store/sqlite/stage-amounts.d.ts +14 -0
- package/dist/store/sqlite/stage-amounts.js +23 -0
- package/dist/store/sqlite/subscriptions.d.ts +135 -0
- package/dist/store/sqlite/subscriptions.js +294 -0
- package/dist/store/sqlite/text-input.d.ts +3 -0
- package/dist/store/sqlite/text-input.js +13 -0
- package/dist/store/sqlite/things.js +2 -9
- package/dist/store/sqlite/transaction.d.ts +15 -0
- package/dist/store/sqlite/transaction.js +57 -0
- package/dist/store/sqlite/wallets.d.ts +88 -0
- package/dist/store/sqlite/wallets.js +143 -0
- package/dist/store/store-errors.d.ts +1 -0
- package/dist/store/store-errors.js +45 -0
- package/dist/store/store.d.ts +19 -1
- package/dist/store/store.js +35 -6
- package/package.json +6 -3
- package/schemas/examples/records-business.jsonl +11 -0
- package/schemas/records-envelope.v1.schema.json +1160 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { proposerOfAction } from "../../../store/index.js";
|
|
2
|
+
import { SOURCE_REVIEW_KIND } from "../../../store/source-review.js";
|
|
3
|
+
import { actionStatus, kept, pushed, storedStatus } from "./shared.js";
|
|
4
|
+
const rowOf = (action) => {
|
|
5
|
+
const payload = action.payload;
|
|
6
|
+
const sources = payload.sources.flatMap((source) => source.ref ?? []);
|
|
7
|
+
const contradicting = payload.challenges.flatMap((challenge) => challenge.evidence);
|
|
8
|
+
const replacement = payload.sources.find((source) => source.replacement !== undefined)?.replacement ?? null;
|
|
9
|
+
return {
|
|
10
|
+
id: action.id,
|
|
11
|
+
kind: SOURCE_REVIEW_KIND,
|
|
12
|
+
status: actionStatus(action.status),
|
|
13
|
+
project: null,
|
|
14
|
+
subject: action.target ?? payload.target,
|
|
15
|
+
object: replacement,
|
|
16
|
+
summary: `${payload.cause}: ${payload.sources.length} source(s), ${payload.challenges.length} challenge(s)`,
|
|
17
|
+
proposedBy: proposerOfAction(action),
|
|
18
|
+
reason: payload.challenges.at(-1)?.reason ?? action.reason,
|
|
19
|
+
evidence: [...new Set([...sources, ...contradicting])].slice(0, 5),
|
|
20
|
+
score: null,
|
|
21
|
+
signals: null,
|
|
22
|
+
parts: null,
|
|
23
|
+
createdAt: payload.raisedAt,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** A memory or fact whose sources changed, went or were contradicted; only the owner says whether it still holds. */
|
|
27
|
+
export const sourceReviewKind = (store) => ({
|
|
28
|
+
kind: SOURCE_REVIEW_KIND,
|
|
29
|
+
stored: [SOURCE_REVIEW_KIND],
|
|
30
|
+
ownerOnly: true,
|
|
31
|
+
list: async (filter) => {
|
|
32
|
+
const status = storedStatus(filter);
|
|
33
|
+
const stored = await store.proposedActions.list({
|
|
34
|
+
kinds: [SOURCE_REVIEW_KIND],
|
|
35
|
+
...(status === undefined ? {} : { status }),
|
|
36
|
+
...pushed(filter),
|
|
37
|
+
});
|
|
38
|
+
return kept(stored.map(rowOf), filter);
|
|
39
|
+
},
|
|
40
|
+
get: async (id) => rowOf(await store.proposedActions.get(id)),
|
|
41
|
+
decide: async (id, { confirm, by, reason }) => {
|
|
42
|
+
await store.knowledge.decideSourceReview(id, { confirm, by, ...(reason === undefined ? {} : { reason }) });
|
|
43
|
+
return { id, kind: SOURCE_REVIEW_KIND, status: confirm ? "confirmed" : "rejected", made: [] };
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MessageStore } from "../../../store/index.js";
|
|
2
|
+
import type { ProposalKind } from "../types.js";
|
|
3
|
+
/** An agent's or an import's subscription, by its own ref (`subscription:12`); only the owner decides it. */
|
|
4
|
+
export declare const subscriptionKind: (store: Pick<MessageStore, "subscriptions">) => ProposalKind;
|
|
5
|
+
/**
|
|
6
|
+
* A new price of a subscription (`subscription_price:7`): a proposal of its own, so a confirmed subscription stays
|
|
7
|
+
* confirmed while its next price waits.
|
|
8
|
+
*/
|
|
9
|
+
export declare const subscriptionPriceKind: (store: Pick<MessageStore, "subscriptions">) => ProposalKind;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { reviewedKind, reviewedRow } from "./shared.js";
|
|
2
|
+
/** An agent's or an import's subscription, by its own ref (`subscription:12`); only the owner decides it. */
|
|
3
|
+
export const subscriptionKind = (store) => reviewedKind({
|
|
4
|
+
type: "subscription",
|
|
5
|
+
list: (options) => store.subscriptions.list(options),
|
|
6
|
+
get: (id) => store.subscriptions.get(id),
|
|
7
|
+
row: (subscription) => reviewedRow("subscription", subscription, (subscription.direction === "receivable" ? subscription.customer : subscription.supplier).ref),
|
|
8
|
+
decide: async (id, confirm, { by, reason }) => (confirm ? await store.subscriptions.confirm(id, by, reason) : await store.subscriptions.reject(id, by, reason))
|
|
9
|
+
.ref,
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* A new price of a subscription (`subscription_price:7`): a proposal of its own, so a confirmed subscription stays
|
|
13
|
+
* confirmed while its next price waits.
|
|
14
|
+
*/
|
|
15
|
+
export const subscriptionPriceKind = (store) => reviewedKind({
|
|
16
|
+
type: "subscription_price",
|
|
17
|
+
list: ({ review, proposedBy, limit }) => store.subscriptions.prices({ review, proposedBy, limit }),
|
|
18
|
+
get: (id) => store.subscriptions.price(id),
|
|
19
|
+
row: (price) => reviewedRow("subscription_price", price, price.subscription),
|
|
20
|
+
decide: async (id, confirm, { by, reason }) => {
|
|
21
|
+
await (confirm ? store.subscriptions.confirm(id, by, reason) : store.subscriptions.reject(id, by, reason));
|
|
22
|
+
return id;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MessageStore } from "../../../store/index.js";
|
|
2
|
+
import type { ProposalKind } from "../types.js";
|
|
3
|
+
/** An agent's or an import's bank transaction, by its own ref (`transaction:12`); only the owner decides it. */
|
|
4
|
+
export declare const transactionKind: (store: Pick<MessageStore, "transactions">) => ProposalKind;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { reviewedKind, reviewedRow } from "./shared.js";
|
|
2
|
+
/** An agent's or an import's bank transaction, by its own ref (`transaction:12`); only the owner decides it. */
|
|
3
|
+
export const transactionKind = (store) => reviewedKind({
|
|
4
|
+
type: "transaction",
|
|
5
|
+
list: (options) => store.transactions.list(options),
|
|
6
|
+
get: (id) => store.transactions.get(id),
|
|
7
|
+
row: (transaction) => reviewedRow("transaction", transaction, transaction.counterparty?.ref ?? transaction.wallet),
|
|
8
|
+
decide: async (id, confirm, { by, reason }) => (confirm ? await store.transactions.confirm(id, by, reason) : await store.transactions.reject(id, by, reason))
|
|
9
|
+
.ref,
|
|
10
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { mayDecide } from "../../store/decisions.js";
|
|
3
3
|
import { actionKind } from "./kinds/action.js";
|
|
4
|
+
import { contractKind } from "./kinds/contracts.js";
|
|
4
5
|
import { factKind } from "./kinds/fact.js";
|
|
5
6
|
import { invoiceKind, paymentKind } from "./kinds/finance.js";
|
|
6
7
|
import { findingsKind } from "./kinds/findings.js";
|
|
@@ -12,7 +13,10 @@ import { orderKind } from "./kinds/orders.js";
|
|
|
12
13
|
import { organizationKind } from "./kinds/organization.js";
|
|
13
14
|
import { relationshipKind } from "./kinds/relationship.js";
|
|
14
15
|
import { relationshipUpdateKind } from "./kinds/relationship-update.js";
|
|
16
|
+
import { sourceReviewKind } from "./kinds/source-review.js";
|
|
17
|
+
import { subscriptionKind, subscriptionPriceKind } from "./kinds/subscriptions.js";
|
|
15
18
|
import { taskCloseKind } from "./kinds/task-close.js";
|
|
19
|
+
import { transactionKind } from "./kinds/transactions.js";
|
|
16
20
|
const PREFIX = /^([a-z][a-z_]*):/;
|
|
17
21
|
const marked = (kind, row) => kind.ownerOnly ? { ...row, ownerOnly: true } : row;
|
|
18
22
|
const refusalOf = (id, error) => {
|
|
@@ -135,12 +139,17 @@ export const proposalRegistry = (store) => {
|
|
|
135
139
|
invoiceKind(store),
|
|
136
140
|
paymentKind(store),
|
|
137
141
|
orderKind(store),
|
|
142
|
+
contractKind(store),
|
|
143
|
+
subscriptionKind(store),
|
|
144
|
+
subscriptionPriceKind(store),
|
|
145
|
+
transactionKind(store),
|
|
138
146
|
organizationKind(store),
|
|
139
147
|
memoryKind(store),
|
|
140
148
|
findingsKind(store),
|
|
141
149
|
mailFindingsKind(store),
|
|
142
150
|
meetingFindingsKind(store),
|
|
143
151
|
taskCloseKind(store),
|
|
152
|
+
sourceReviewKind(store),
|
|
144
153
|
])
|
|
145
154
|
registry.register(kind);
|
|
146
155
|
registry.register(actionKind(store, registry.claimed));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { parseLucene } from "@wirecat/cli-base/query";
|
|
3
3
|
import { formatMeetingReference } from "../meetings/index.js";
|
|
4
|
-
import { entriesOfList, fitting } from "../search/account-list.js";
|
|
4
|
+
import { entriesOfList, fitting, listedHolds } from "../search/account-list.js";
|
|
5
5
|
import { SEARCH_QUERY } from "../search/lucene/types.js";
|
|
6
6
|
import { codeOf } from "../sends/guarded.js";
|
|
7
7
|
import { MAX_SEARCH_OFFSET } from "./messages-archive-search.js";
|
|
@@ -250,7 +250,7 @@ const searchAllOfSource = async (store, account, source, request, messenger, sea
|
|
|
250
250
|
const named = (resource) => [
|
|
251
251
|
...new Map(entries
|
|
252
252
|
.flatMap(({ accounts }) => accounts)
|
|
253
|
-
.filter((
|
|
253
|
+
.filter((one) => listedHolds(one, resource))
|
|
254
254
|
.map(({ provider, account }) => [`${provider}\u0000${account}`, { provider, account }])).values(),
|
|
255
255
|
];
|
|
256
256
|
const meetings = await holdingMeetings(store, named("meetings"));
|
|
@@ -3,7 +3,7 @@ import { parseLucene } from "@wirecat/cli-base/query";
|
|
|
3
3
|
import { hitFiles } from "../domain/attachments.js";
|
|
4
4
|
import { parseLocator } from "../domain/locator.js";
|
|
5
5
|
import { senderIsMe } from "../domain/models.js";
|
|
6
|
-
import {
|
|
6
|
+
import { holdsKind, INTERNAL_NOTES } from "../domain/providers.js";
|
|
7
7
|
import { runEmbedders } from "../embeddings/embed.js";
|
|
8
8
|
import { DEFAULT_TEXT_MODEL } from "../embeddings/models.js";
|
|
9
9
|
import { plainQuery } from "../search/lucene/plain.js";
|
|
@@ -58,7 +58,7 @@ export const titleWords = (text) => {
|
|
|
58
58
|
return { words, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
|
|
59
59
|
};
|
|
60
60
|
/** The accounts of every CRM the store holds copies of. */
|
|
61
|
-
export const crmAccounts = async (store) => (await store.accounts.accounts()).filter(({ provider }) =>
|
|
61
|
+
export const crmAccounts = async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "crm"));
|
|
62
62
|
/**
|
|
63
63
|
* `search all`: messages, mail, notes, calendar events and CRM deals and leads from the local store — messages also from the messenger's
|
|
64
64
|
* server, as `search messages` asks it — each list best first, merged by reciprocal rank so no
|
|
@@ -120,7 +120,7 @@ export const searchAll = async (store, account, asked, messenger = {}, searchMes
|
|
|
120
120
|
hasMore ||= found.hasMore;
|
|
121
121
|
const read = found.coverage?.accounts ??
|
|
122
122
|
given ??
|
|
123
|
-
(await store.accounts.accounts()).filter(({ provider }) =>
|
|
123
|
+
(await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, kind));
|
|
124
124
|
for (const one of found.skipped ?? [])
|
|
125
125
|
if (!skipped.some(({ source }) => source === one.source))
|
|
126
126
|
skipped.push(one);
|
|
@@ -222,6 +222,7 @@ export const searchAll = async (store, account, asked, messenger = {}, searchMes
|
|
|
222
222
|
INTERNAL_NOTES,
|
|
223
223
|
...(await store.notes.folders()).map(({ id }) => id),
|
|
224
224
|
...(await store.notes.documentsAccounts()).map(({ id }) => id),
|
|
225
|
+
...[await store.notes.addedAccount()].flatMap((added) => (added ? [added.id] : [])),
|
|
225
226
|
];
|
|
226
227
|
accounts.push(...read.map((account) => ({ resource, provider: "notes", account })));
|
|
227
228
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
-
import {
|
|
2
|
+
import { holdsKindOf, isKind, providerNamed } from "../domain/providers.js";
|
|
3
3
|
import { entriesOfList, fitting, isAccountList } from "../search/account-list.js";
|
|
4
4
|
export const NO_MAIL = "no_mail";
|
|
5
5
|
export const MAIL = "email";
|
|
@@ -44,11 +44,11 @@ export const accountsOfKind = (kind, chosen, held, explicit, command = undefined
|
|
|
44
44
|
if (kind === "messages") {
|
|
45
45
|
if (explicit === MAIL)
|
|
46
46
|
throw new CliError("validation_error", "mail is searched with `memo search mail`, not search messages");
|
|
47
|
-
return chosen.filter(({ provider }) =>
|
|
47
|
+
return chosen.filter(({ provider }) => holdsKindOf(provider, "messages"));
|
|
48
48
|
}
|
|
49
49
|
if (explicit !== undefined && explicit !== MAIL && explicit !== "all")
|
|
50
50
|
throw new CliError("validation_error", `search mail reads mail only — \`${command === undefined ? "" : `${command} `}search messages\` searches ${explicit}`);
|
|
51
|
-
const mail = (listed ? chosen : held).filter(({ provider }) =>
|
|
51
|
+
const mail = (listed ? chosen : held).filter(({ provider }) => holdsKindOf(provider, "mail"));
|
|
52
52
|
if (mail.length === 0)
|
|
53
53
|
throw new CliError("not_found", "no mail in the store yet — `memo sync --only mail --since-time <time>` imports it", {
|
|
54
54
|
reason: NO_MAIL,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { formatReference, parseReference } from "../domain/references.js";
|
|
3
|
+
import { isUsable } from "../domain/relations.js";
|
|
3
4
|
import { chatCoverage } from "./chat-coverage.js";
|
|
4
5
|
import { gatherProjectEvidence } from "./project-gathering.js";
|
|
5
6
|
import { storedNeighbours } from "./project-gathering-around.js";
|
|
@@ -121,7 +122,7 @@ const proposedLinksOf = async (store, project) => {
|
|
|
121
122
|
})
|
|
122
123
|
.sort((a, b) => Number(a.id) - Number(b.id));
|
|
123
124
|
const legacy = (await store.knowledge.relations(null, project))
|
|
124
|
-
.filter((one) =>
|
|
125
|
+
.filter((one) => one.standing === "proposed" && one.kind === "member-of" && one.to === project)
|
|
125
126
|
.map((one) => ({ from: one.from, id: `link:${one.id}`, role: one.role, purpose: one.purpose }));
|
|
126
127
|
return [...proposals, ...legacy];
|
|
127
128
|
};
|
|
@@ -131,7 +132,7 @@ const memberRefsOf = async (store, project, includeProposed) => {
|
|
|
131
132
|
return [];
|
|
132
133
|
const confirmed = new Set();
|
|
133
134
|
for (const relation of await store.knowledge.relations(null, project))
|
|
134
|
-
if (relation.
|
|
135
|
+
if (isUsable(relation.standing) &&
|
|
135
136
|
relation.kind === "member-of" &&
|
|
136
137
|
relation.to === project &&
|
|
137
138
|
/^person:.+/.test(relation.from))
|
|
@@ -180,7 +181,7 @@ export const linkedChatsOf = async (store, project, options = {}) => {
|
|
|
180
181
|
return [];
|
|
181
182
|
const chats = [];
|
|
182
183
|
for (const relation of await store.knowledge.relations(null, project)) {
|
|
183
|
-
if (!relation.
|
|
184
|
+
if (!isUsable(relation.standing) || relation.kind !== "member-of" || relation.to !== project)
|
|
184
185
|
continue;
|
|
185
186
|
const reference = chatOf(relation.from);
|
|
186
187
|
if (reference)
|
package/dist/store/decisions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { MEETING_FINDINGS_KIND } from "../meetings/index.js";
|
|
3
3
|
import { MAIL_FINDINGS_KIND } from "./mail-findings.js";
|
|
4
|
+
import { SOURCE_REVIEW_KIND } from "./source-review.js";
|
|
4
5
|
/** An agent's suggested close of a task: kept on the task, not in `proposed_actions`. */
|
|
5
6
|
export const TASK_CLOSE_KIND = "task_close";
|
|
6
7
|
export const DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
|
|
@@ -8,7 +9,10 @@ export const DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwn
|
|
|
8
9
|
* Proposal kinds only the owner decides, whatever `agent_decisions` says. Read from the row's kind, so a path that
|
|
9
10
|
* sees the row as something else — a generic action, a host's own kind — still refuses an agent.
|
|
10
11
|
*/
|
|
11
|
-
export const isOwnerOnlyKind = (kind) => kind === MAIL_FINDINGS_KIND ||
|
|
12
|
+
export const isOwnerOnlyKind = (kind) => kind === MAIL_FINDINGS_KIND ||
|
|
13
|
+
kind === MEETING_FINDINGS_KIND ||
|
|
14
|
+
kind === TASK_CLOSE_KIND ||
|
|
15
|
+
kind === SOURCE_REVIEW_KIND;
|
|
12
16
|
/**
|
|
13
17
|
* The one check every decide path runs before it confirms or rejects a proposal. `null` means allowed. Every Claude
|
|
14
18
|
* Code session is the bot `claude-code`, so comparing bot names keeps one session from deciding another's proposal.
|
package/dist/store/exports.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export { storeClients } from "./sqlite/clients.js";
|
|
|
23
23
|
export { CHAT_LIST_KEY, type ChatCompleteness, type ChatCoverage, fetchedKey, historyStartKey, } from "./sqlite/completeness.js";
|
|
24
24
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
25
25
|
export type { CounterTarget } from "./sqlite/counters.js";
|
|
26
|
+
export { crmSettingsOf, parseCrmSetting, parseCrmSettingValue, saveCrmSetting } from "./sqlite/crm-settings.js";
|
|
26
27
|
export { type EmailMarks, MAIL_AGENDA_COLUMNS, type MarkedEmail, type NewestEmail, type ThreadActivity, } from "./sqlite/email-activity.js";
|
|
27
28
|
export { messageOfEmail, threadConversation } from "./sqlite/emails.js";
|
|
28
29
|
export { orphanPointers } from "./sqlite/entity-types.js";
|
package/dist/store/exports.js
CHANGED
|
@@ -6,6 +6,7 @@ export { CHAT_COLUMNS, TRACKED_CHAT_COLUMNS, titlePart } from "./sqlite/chats.js
|
|
|
6
6
|
export { storeClients } from "./sqlite/clients.js";
|
|
7
7
|
export { CHAT_LIST_KEY, fetchedKey, historyStartKey, } from "./sqlite/completeness.js";
|
|
8
8
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
9
|
+
export { crmSettingsOf, parseCrmSetting, parseCrmSettingValue, saveCrmSetting } from "./sqlite/crm-settings.js";
|
|
9
10
|
export { MAIL_AGENDA_COLUMNS, } from "./sqlite/email-activity.js";
|
|
10
11
|
export { messageOfEmail, threadConversation } from "./sqlite/emails.js";
|
|
11
12
|
export { orphanPointers } from "./sqlite/entity-types.js";
|
package/dist/store/index.d.ts
CHANGED
|
@@ -31,22 +31,27 @@ export { type ProjectAnnotationPreview, type ProjectAnnotationPreviewOptions, pr
|
|
|
31
31
|
export { decodeProjectAnnotationSnapshot, type ProjectAnnotationSnapshot, type ProjectAnnotationSnapshotOptions, type ProjectAnnotationSnapshotResult, projectAnnotationSnapshotFingerprint, projectAnnotationSnapshotSchema, snapshotProjectAnnotations, } from "./project-transfer/snapshot.js";
|
|
32
32
|
export { planProjectAnnotationSnapshot } from "./project-transfer/snapshot-plan.js";
|
|
33
33
|
export type { ProjectAnnotationRestoreReceipt, ProjectAnnotationRestoreRequest, ProjectAnnotationStore, ProjectAnnotationTargetRequest, } from "./project-transfer/store.js";
|
|
34
|
+
export { SOURCE_REVIEW_CAUSES, SOURCE_REVIEW_KIND, type SourceCheck, type SourceReviewCause, type SourceReviewChallenge, type SourceReviewMarker, type SourceReviewPayload, type SourceReviewSource, } from "./source-review.js";
|
|
35
|
+
export { ADDED_KINDS, type AddedSource, type AddedSourceContent, type AddedSourceInput, addedSourceKeyOf, } from "./sqlite/added-sources.js";
|
|
34
36
|
export type { AgentAction, AgentActionInput, AgentActionsStore } from "./sqlite/agent-actions.js";
|
|
35
37
|
export { resetAttachmentWords } from "./sqlite/attachment-texts.js";
|
|
36
38
|
export { backfillNormalized, pendingNormalization } from "./sqlite/backfill.js";
|
|
37
39
|
export type { BotUpdate, BotUpdateStore } from "./sqlite/bot-updates.js";
|
|
40
|
+
export type { Contract, ContractFields, ContractFilter, ContractInput, ContractsStore, ContractUpdate, } from "./sqlite/business-contracts.js";
|
|
38
41
|
export type { CatalogActor, CatalogEntry, CatalogInput, CatalogQuery, CatalogStore } from "./sqlite/catalog.js";
|
|
39
42
|
export { CATALOG_QUERY } from "./sqlite/catalog.js";
|
|
40
43
|
export type { ChatMetadata } from "./sqlite/chats.js";
|
|
41
|
-
export { type CrmCopies, type CrmSaved, type CrmSkipped, crmIdentityId } from "./sqlite/crm.js";
|
|
44
|
+
export { type CrmCopies, type CrmRelationIssue, type CrmSaved, type CrmSkipped, crmIdentityId } from "./sqlite/crm.js";
|
|
45
|
+
export { COMPANY_TYPE_MEANINGS, type CompanyTypeMeaning, CRM_LINK_MODES, type CrmLinkMode, crmSettingKey, } from "./sqlite/crm-settings.js";
|
|
42
46
|
export type { Deal, DealFilter, DealInput, DealPerson, DealScope, DealsStore, FunnelStage, Pipeline, PipelineInput, PipelineReport, PipelineStage, } from "./sqlite/deals.js";
|
|
43
47
|
export type { DecisionMessage, DecisionPress, DecisionRefusal, DecisionRequest, DecisionRequestInput, DecisionRequestStore, TakeResult, } from "./sqlite/decision-requests.js";
|
|
44
48
|
export type { Email, EmailAddress, EmailAttachment, EmailFacts, EmailFilter, EmailInput, EmailInThread, EmailLocationInput, EmailRecipient, EmailRef, EmailThread, EmailVectorHit, FolderEmail, Mailbox, MailboxInput, MailFilter, MailStore, PartialEmail, SenderScore, ThreadDetails, ThreadSave, } from "./sqlite/emails.js";
|
|
45
49
|
export { EVENT_FIELDS, type EventChunkToEmbed, type EventHit, type EventQuery, type EventSearch, type NearestEvent, } from "./sqlite/event-search.js";
|
|
50
|
+
export type { EvidenceInput, EvidenceMetadata } from "./sqlite/evidence-signature.js";
|
|
46
51
|
export type { EvidenceSource } from "./sqlite/evidence-sources.js";
|
|
47
52
|
export type { Fact, FactInput, FactsStore } from "./sqlite/facts.js";
|
|
48
53
|
export type { FileListQuery, FilesStore, StoredFile } from "./sqlite/files.js";
|
|
49
|
-
export type { Allocation, FinanceStore, Invoice, InvoiceDetail, InvoiceInput, InvoiceLine, InvoiceLineInput, OpenTotal,
|
|
54
|
+
export type { Allocation, FinanceStore, Invoice, InvoiceDetail, InvoiceInput, InvoiceLine, InvoiceLineInput, OpenTotal, Payment as FinancePayment, PaymentDetail as FinancePaymentDetail, PaymentInput as FinancePaymentInput, } from "./sqlite/finance.js";
|
|
50
55
|
export { IMPORTED_DOCUMENT_QUERY, type ImportedDocuments } from "./sqlite/imported-documents.js";
|
|
51
56
|
export type { Involvement, InvolvementStore } from "./sqlite/involvements.js";
|
|
52
57
|
export type { Annotation, KnowledgeRelation, KnowledgeStore, KnowledgeTarget, LabelledType, Organization, Project, Reminder, } from "./sqlite/knowledge.js";
|
|
@@ -57,15 +62,25 @@ export type { MeetingContextReadCapabilities, MeetingReadCapabilities, MeetingRe
|
|
|
57
62
|
export type { MeetingVectorHit, MeetingVectors } from "./sqlite/meeting-vectors.js";
|
|
58
63
|
export type { AttachmentInput } from "./sqlite/meetings.js";
|
|
59
64
|
export type { Author, MemoriesStore, Memory, MemoryInput } from "./sqlite/memories.js";
|
|
65
|
+
export type { MoneyLine, MoneyLineInput } from "./sqlite/money-lines.js";
|
|
66
|
+
export type { CategoryTotal, MoneyTransaction, SplitInput, TransactionFilter, TransactionInput, TransactionSplit, TransactionsStore, TransactionUpdate, } from "./sqlite/money-transactions.js";
|
|
60
67
|
export type { NoteIndexState } from "./sqlite/note-index.js";
|
|
61
68
|
export { type NearestNote, NOTE_FIELDS, type NoteChunkToEmbed, type NoteHit, type NoteQuery, type NoteSearch, } from "./sqlite/note-search.js";
|
|
62
69
|
export type { FileNoteInput, Link, LinkInput, LinkListFilter, Note, NoteFolder, NotesStore, NoteTag, } from "./sqlite/notes.js";
|
|
63
|
-
export type { Order, OrderFilter, OrderInput, OrdersStore } from "./sqlite/orders.js";
|
|
70
|
+
export type { Order, OrderDetail, OrderFilter, OrderInput, OrdersStore } from "./sqlite/orders.js";
|
|
64
71
|
export type { PrivateContact, PrivateContactNote } from "./sqlite/private-people.js";
|
|
72
|
+
export type { Product, ProductFilter, ProductInput, ProductsStore, ProductUpdate } from "./sqlite/products.js";
|
|
65
73
|
export { assertGenericAction, PROPOSAL_STATUSES, type ProposalInput, type ProposedAction, type ProposedActionsStore, proposerOfAction, } from "./sqlite/proposed-actions.js";
|
|
66
|
-
export type
|
|
74
|
+
export { type FlaggedRecord, type MappedRecord, type MatchRun, type RecordKey, type RecordStore, type RecordsRun, type RunItem, type RunOptions, type SourceRecord, type SourceRecordRelation, type Unmatched, waitingPointer, } from "./sqlite/records.js";
|
|
75
|
+
export type { RelationFilter, RelationList, RelationListItem } from "./sqlite/relation-list.js";
|
|
67
76
|
export type { LinkDecision, RelationUpdate } from "./sqlite/relation-proposals.js";
|
|
77
|
+
export type { RelationReads } from "./sqlite/relation-reads.js";
|
|
78
|
+
export type { RelationRole, RelationRoles } from "./sqlite/relation-roles.js";
|
|
79
|
+
export type { RelationsStore, ReportedIssue, ReportedRelation, ReportedScope, ReportedSync, } from "./sqlite/reported-relations.js";
|
|
80
|
+
export type { AuthorInfo, Party, Reviewed, Written } from "./sqlite/reviewed.js";
|
|
68
81
|
export { fillSearchIndex, resetSearchIndex, type SearchIndexFill, type SearchIndexState, searchIndexState, } from "./sqlite/search-index.js";
|
|
82
|
+
export type { ChallengeInput, SourceReviewDecision } from "./sqlite/source-review.js";
|
|
83
|
+
export type { PriceFilter, PriceInput, Subscription, SubscriptionDetail, SubscriptionFields, SubscriptionFilter, SubscriptionInput, SubscriptionPrice, SubscriptionsStore, SubscriptionUpdate, } from "./sqlite/subscriptions.js";
|
|
69
84
|
export type { SyncStateSave } from "./sqlite/sync.js";
|
|
70
85
|
export type { TagCreationOptions, TagCreationReview } from "./sqlite/tag-creation.js";
|
|
71
86
|
export type { TagKind, TagRow } from "./sqlite/tags.js";
|
|
@@ -81,6 +96,7 @@ export { TASK_RELATION_KINDS } from "./sqlite/task-relations.js";
|
|
|
81
96
|
export type { TaskStatRow, TaskStatScope } from "./sqlite/task-stats.js";
|
|
82
97
|
export type { StoreTaskStore } from "./sqlite/tasks.js";
|
|
83
98
|
export type { TagPreflight, VocabularyAlias, VocabularyAliasReceipt, VocabularyAudit, VocabularyAuditOptions, VocabularyCatalog, VocabularyEntry, VocabularyKind, VocabularyOptions, VocabularyResolution, VocabularyStore, VocabularyTarget, } from "./sqlite/vocabulary.js";
|
|
99
|
+
export type { Wallet, WalletFilter, WalletInput, WalletsStore, WalletUpdate } from "./sqlite/wallets.js";
|
|
84
100
|
export type { BoardCounts, BoardOptions, EditedTask, MovedSubtask, NewWorkTask, RevisionCheck, TaskAssignment, TaskDetails, TaskEvent, TaskFields, TaskMove, TaskMoved, TaskRole, TaskType, WorkTaskType, } from "./sqlite/work-tasks.js";
|
|
85
101
|
export { TASK_EVENT_KINDS, TASK_ROLES } from "./sqlite/work-tasks.js";
|
|
86
102
|
export { type AccountAccounts, type AccountAttachments, type AccountCounters, type AccountKey, type AccountMentions, type AccountMessageFilter, type AccountMessages, type AccountPeople, type AccountsStore, type AccountVectors, type AttachmentsStore, type AttachmentTextEntry, type AttachmentView, type ChatStats, type ChatsStore, type ConversationsStore, type CountersStore, type DeletionScope, type Delta, type FileAttachment, type IdentityRef, type IngestedVia, type LinkedIdentity, type LinkOptions, MENTION_QUERY, MENTION_STATUSES, type MentionsStore, type MessageFilter, type MessageStore, type MessagesStore, OTHER_SOURCES, openStore, type PeopleStore, type PersonFacts, type PersonRecord, type QueriesStore, type Range, type RankedEvidence, type RankedStoreFound, type RankedStoreRow, type RankingEvidenceItem, type RankingEvidenceRequest, type RankingRequest, type RosterStore, type SearchCommand, type SearchesStore, type SearchIndexStore, type SearchRecord, type StoredAccount, type StoredChatFilter, type StoredHit, type StoredSearch, type StoredTag, type StoreOptions, type SyncStore, type TagFilter, type TagsStore, type TagTarget, type TaskAnalysisMark, type TaskAnalysisMarkWrite, type TaskTagTarget, type TextOrigin, type VectorsStore, } from "./store.js";
|
package/dist/store/index.js
CHANGED
|
@@ -21,15 +21,19 @@ export { planProjectAnnotations, } from "./project-transfer/plan.js";
|
|
|
21
21
|
export { previewProjectAnnotationSnapshot, } from "./project-transfer/preview.js";
|
|
22
22
|
export { decodeProjectAnnotationSnapshot, projectAnnotationSnapshotFingerprint, projectAnnotationSnapshotSchema, snapshotProjectAnnotations, } from "./project-transfer/snapshot.js";
|
|
23
23
|
export { planProjectAnnotationSnapshot } from "./project-transfer/snapshot-plan.js";
|
|
24
|
+
export { SOURCE_REVIEW_CAUSES, SOURCE_REVIEW_KIND, } from "./source-review.js";
|
|
25
|
+
export { ADDED_KINDS, addedSourceKeyOf, } from "./sqlite/added-sources.js";
|
|
24
26
|
export { resetAttachmentWords } from "./sqlite/attachment-texts.js";
|
|
25
27
|
export { backfillNormalized, pendingNormalization } from "./sqlite/backfill.js";
|
|
26
28
|
export { CATALOG_QUERY } from "./sqlite/catalog.js";
|
|
27
29
|
export { crmIdentityId } from "./sqlite/crm.js";
|
|
30
|
+
export { COMPANY_TYPE_MEANINGS, CRM_LINK_MODES, crmSettingKey, } from "./sqlite/crm-settings.js";
|
|
28
31
|
export { EVENT_FIELDS, } from "./sqlite/event-search.js";
|
|
29
32
|
export { IMPORTED_DOCUMENT_QUERY } from "./sqlite/imported-documents.js";
|
|
30
33
|
export { ORGANIZATION_KINDS, PROJECT_TYPES, SCOPES } from "./sqlite/knowledge.js";
|
|
31
34
|
export { NOTE_FIELDS, } from "./sqlite/note-search.js";
|
|
32
35
|
export { assertGenericAction, PROPOSAL_STATUSES, proposerOfAction, } from "./sqlite/proposed-actions.js";
|
|
36
|
+
export { waitingPointer, } from "./sqlite/records.js";
|
|
33
37
|
export { fillSearchIndex, resetSearchIndex, searchIndexState, } from "./sqlite/search-index.js";
|
|
34
38
|
export { PROJECT_TASK_FIELDS, TASK_SORTS, withoutField } from "./sqlite/task-board.js";
|
|
35
39
|
export { certaintyOf } from "./sqlite/task-close.js";
|
package/dist/store/people.js
CHANGED
|
@@ -51,7 +51,7 @@ export const accountPeopleOver = (context) => {
|
|
|
51
51
|
editContactNote: async (key, person, id, text, revision) => {
|
|
52
52
|
return write(database, () => privatePeople.editNote(context, key, person, id, text, revision));
|
|
53
53
|
},
|
|
54
|
-
removeContactNote: async (key, person, id) => privatePeople.removeNote(context, key, person, id),
|
|
54
|
+
removeContactNote: async (key, person, id) => write(database, () => privatePeople.removeNote(context, key, person, id)),
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
export const peopleStoreOver = (context, keyed) => {
|
|
@@ -22,7 +22,7 @@ export declare const projectAnnotationRequest: (request: ProjectAnnotationTarget
|
|
|
22
22
|
ref: string;
|
|
23
23
|
from: string;
|
|
24
24
|
to: string | null;
|
|
25
|
-
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "related-to";
|
|
25
|
+
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "customer-of" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "partner-of" | "related-to" | "reports-to";
|
|
26
26
|
origin: "file" | "message" | "owner" | "suggested";
|
|
27
27
|
anchor: string | null;
|
|
28
28
|
target_text: string | null;
|
|
@@ -33,6 +33,9 @@ export declare const projectAnnotationRequest: (request: ProjectAnnotationTarget
|
|
|
33
33
|
created_at: number;
|
|
34
34
|
updated_at: number;
|
|
35
35
|
author: string | null;
|
|
36
|
+
starts_at?: number | undefined;
|
|
37
|
+
ends_at?: number | undefined;
|
|
38
|
+
deleted_at?: number | undefined;
|
|
36
39
|
}[];
|
|
37
40
|
external: {
|
|
38
41
|
ref: string;
|
|
@@ -56,7 +56,7 @@ export declare const projectAnnotationsSchema: v.StrictObjectSchema<{
|
|
|
56
56
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
57
57
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
58
58
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
59
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
59
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
60
60
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message"], undefined>;
|
|
61
61
|
readonly anchor: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
62
62
|
readonly target_text: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
@@ -67,11 +67,15 @@ export declare const projectAnnotationsSchema: v.StrictObjectSchema<{
|
|
|
67
67
|
readonly created_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
68
68
|
readonly updated_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
69
69
|
readonly author: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
70
|
+
/** When a relationship held, if known; left out otherwise, so an older reader still reads the snapshot. */
|
|
71
|
+
readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
72
|
+
readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
73
|
+
readonly deleted_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
70
74
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
71
75
|
ref: string;
|
|
72
76
|
from: string;
|
|
73
77
|
to: string | null;
|
|
74
|
-
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "related-to";
|
|
78
|
+
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "customer-of" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "partner-of" | "related-to" | "reports-to";
|
|
75
79
|
origin: "file" | "message" | "owner" | "suggested";
|
|
76
80
|
anchor: string | null;
|
|
77
81
|
target_text: string | null;
|
|
@@ -82,6 +86,9 @@ export declare const projectAnnotationsSchema: v.StrictObjectSchema<{
|
|
|
82
86
|
created_at: number;
|
|
83
87
|
updated_at: number;
|
|
84
88
|
author: string | null;
|
|
89
|
+
starts_at?: number | undefined;
|
|
90
|
+
ends_at?: number | undefined;
|
|
91
|
+
deleted_at?: number | undefined;
|
|
85
92
|
}[], 1000, undefined>]>;
|
|
86
93
|
readonly external: v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
87
94
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
@@ -60,6 +60,10 @@ export const projectAnnotationsSchema = v.strictObject({
|
|
|
60
60
|
created_at: timestamp,
|
|
61
61
|
updated_at: timestamp,
|
|
62
62
|
author: v.nullable(text(200)),
|
|
63
|
+
/** When a relationship held, if known; left out otherwise, so an older reader still reads the snapshot. */
|
|
64
|
+
starts_at: v.optional(timestamp),
|
|
65
|
+
ends_at: v.optional(timestamp),
|
|
66
|
+
deleted_at: v.optional(timestamp),
|
|
63
67
|
})),
|
|
64
68
|
external: bounded(v.strictObject({
|
|
65
69
|
ref,
|
|
@@ -37,7 +37,7 @@ export declare const projectAnnotationSnapshotSchema: v.StrictObjectSchema<{
|
|
|
37
37
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
38
38
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
39
39
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
40
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
40
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
41
41
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message"], undefined>;
|
|
42
42
|
readonly anchor: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
43
43
|
readonly target_text: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
@@ -48,11 +48,14 @@ export declare const projectAnnotationSnapshotSchema: v.StrictObjectSchema<{
|
|
|
48
48
|
readonly created_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
49
49
|
readonly updated_at: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
50
50
|
readonly author: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
51
|
+
readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
52
|
+
readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
53
|
+
readonly deleted_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
51
54
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
52
55
|
ref: string;
|
|
53
56
|
from: string;
|
|
54
57
|
to: string | null;
|
|
55
|
-
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "related-to";
|
|
58
|
+
kind: "about" | "answered-by" | "assigned-to" | "attached" | "blocked-by" | "created-from" | "customer-of" | "duplicate-of" | "evidence" | "follow-up-of" | "labelled" | "links-to" | "member-of" | "partner-of" | "related-to" | "reports-to";
|
|
56
59
|
origin: "file" | "message" | "owner" | "suggested";
|
|
57
60
|
anchor: string | null;
|
|
58
61
|
target_text: string | null;
|
|
@@ -63,6 +66,9 @@ export declare const projectAnnotationSnapshotSchema: v.StrictObjectSchema<{
|
|
|
63
66
|
created_at: number;
|
|
64
67
|
updated_at: number;
|
|
65
68
|
author: string | null;
|
|
69
|
+
starts_at?: number | undefined;
|
|
70
|
+
ends_at?: number | undefined;
|
|
71
|
+
deleted_at?: number | undefined;
|
|
66
72
|
}[], 1000, undefined>]>;
|
|
67
73
|
readonly external: v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
68
74
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const SOURCE_REVIEW_KIND = "memory_source_review";
|
|
2
|
+
/** Least severe first: a review moves forward in the queue only when its cause moves right. */
|
|
3
|
+
export declare const SOURCE_REVIEW_CAUSES: readonly ["changed", "outdated", "deleted", "contradicted"];
|
|
4
|
+
export type SourceReviewCause = (typeof SOURCE_REVIEW_CAUSES)[number];
|
|
5
|
+
/** The open review of a memory or fact, as its reads show it. */
|
|
6
|
+
export interface SourceReviewMarker {
|
|
7
|
+
id: string;
|
|
8
|
+
cause: SourceReviewCause;
|
|
9
|
+
}
|
|
10
|
+
/** One cited source that needs a look; it names the cited version and never copies its text. */
|
|
11
|
+
export interface SourceReviewSource {
|
|
12
|
+
/** The `evidence` link's id. */
|
|
13
|
+
link: number;
|
|
14
|
+
/** `null` when the store can no longer name the source, or it was erased. */
|
|
15
|
+
ref: string | null;
|
|
16
|
+
/** The kind of source an erased `ref` named. */
|
|
17
|
+
kind?: string;
|
|
18
|
+
cause: Exclude<SourceReviewCause, "contradicted">;
|
|
19
|
+
/** The version cited (`links.metadata.cited_rev`), to read its text back through `sourceTextAt`. */
|
|
20
|
+
citedRev: number | null;
|
|
21
|
+
/** For `outdated`: what replaced the cited fact or memory, following `supersedes`. */
|
|
22
|
+
replacement?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SourceReviewChallenge {
|
|
25
|
+
evidence: string[];
|
|
26
|
+
reason: string;
|
|
27
|
+
/** `owner`, or the bot's handle. */
|
|
28
|
+
by: string;
|
|
29
|
+
at: string;
|
|
30
|
+
}
|
|
31
|
+
/** What an author offers with a review, such as a corrected claim; it is the author's text, never the source's. */
|
|
32
|
+
export interface SourceReviewSuggestion {
|
|
33
|
+
/** `owner`, or the bot's handle. */
|
|
34
|
+
author: string;
|
|
35
|
+
body: string;
|
|
36
|
+
/** The references of the challenge it came with. */
|
|
37
|
+
evidence: string[];
|
|
38
|
+
at: string;
|
|
39
|
+
}
|
|
40
|
+
/** A `memory_source_review` proposal's payload. */
|
|
41
|
+
export interface SourceReviewPayload {
|
|
42
|
+
target: string;
|
|
43
|
+
cause: SourceReviewCause;
|
|
44
|
+
raisedAt: string;
|
|
45
|
+
sources: SourceReviewSource[];
|
|
46
|
+
challenges: SourceReviewChallenge[];
|
|
47
|
+
suggestions?: SourceReviewSuggestion[];
|
|
48
|
+
}
|
|
49
|
+
export interface SourceCheck {
|
|
50
|
+
/** Evidence links read. */
|
|
51
|
+
checked: number;
|
|
52
|
+
/** Links written before signatures, signed now with nothing to say. */
|
|
53
|
+
baselined: number;
|
|
54
|
+
/** Reviews opened, or open ones whose cause or sources grew. */
|
|
55
|
+
raised: number;
|
|
56
|
+
/** Sources that changed while still saying the quoted words, signed again in silence. */
|
|
57
|
+
refreshed: number;
|
|
58
|
+
/** Open reviews of a memory or fact met in this run that no longer holds, closed. */
|
|
59
|
+
closed: number;
|
|
60
|
+
}
|
|
61
|
+
/** What stands in a review for words about a source that was erased since. */
|
|
62
|
+
export declare const ERASED_TEXT = "[source erased]";
|
|
63
|
+
export declare const severity: (cause: SourceReviewCause) => number;
|
|
64
|
+
export declare const graver: (a: SourceReviewCause, b: SourceReviewCause) => SourceReviewCause;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const SOURCE_REVIEW_KIND = "memory_source_review";
|
|
2
|
+
/** Least severe first: a review moves forward in the queue only when its cause moves right. */
|
|
3
|
+
export const SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
|
|
4
|
+
/** What stands in a review for words about a source that was erased since. */
|
|
5
|
+
export const ERASED_TEXT = "[source erased]";
|
|
6
|
+
export const severity = (cause) => SOURCE_REVIEW_CAUSES.indexOf(cause);
|
|
7
|
+
export const graver = (a, b) => severity(b) > severity(a) ? b : a;
|
|
@@ -10,7 +10,7 @@ export declare const storedAccounts: ({ orm }: StoreContext) => StoredAccount[];
|
|
|
10
10
|
/** One account by provider and external id, never created; a missing one is `not_found`. */
|
|
11
11
|
export declare const storedAccount: ({ orm }: StoreContext, { provider, account }: AccountKey) => StoredAccount;
|
|
12
12
|
/** Everything the account holds, children before parents: the foreign keys are enforced. */
|
|
13
|
-
export declare const purgeAccount: ({ orm, database }: StoreContext, accountKey: number) => void;
|
|
13
|
+
export declare const purgeAccount: ({ orm, database, now }: StoreContext, accountKey: number) => void;
|
|
14
14
|
export declare const unreferenced: (database: CacheDatabase, table: "identities") => Set<number>;
|
|
15
15
|
/**
|
|
16
16
|
* People only the purged account had seen go with it. An identity stays while anything else points at it
|