@wirecat/cli-core 0.608.0 → 0.610.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 +124 -1
- package/dist/background/deliver.d.ts +12 -1
- package/dist/background/deliver.js +38 -5
- package/dist/background/report/render.d.ts +61 -0
- package/dist/background/report/render.js +208 -0
- package/dist/background/report/schema.d.ts +66 -0
- package/dist/background/report/schema.js +191 -0
- package/dist/background/report/templates/morning-digest.email.en.liquid +79 -0
- package/dist/background/report/templates/morning-digest.email.ru.liquid +79 -0
- package/dist/background/report/templates/morning-digest.telegram.en.liquid +77 -0
- package/dist/background/report/templates/morning-digest.telegram.ru.liquid +77 -0
- package/dist/background/report/templates/morning-digest.text.en.liquid +76 -0
- package/dist/background/report/templates/morning-digest.text.ru.liquid +76 -0
- package/dist/background/report/view.d.ts +88 -0
- package/dist/background/report/view.js +152 -0
- package/dist/background/schedules.d.ts +6 -1
- package/dist/background/schedules.js +24 -7
- package/dist/cli/embedding-choice.d.ts +4 -1
- package/dist/cli/embedding-choice.js +6 -3
- package/dist/cli/messenger/models-command.js +46 -18
- package/dist/cli/messenger/search-answers.js +23 -2
- package/dist/cli/model-catalogue-command.d.ts +33 -0
- package/dist/cli/model-catalogue-command.js +110 -21
- package/dist/cli/schedule/schedule-command.js +18 -0
- package/dist/cli/search-left-out.d.ts +1 -0
- package/dist/cli/search-left-out.js +2 -0
- package/dist/cli/store-settings.js +39 -3
- package/dist/crm/cli/csv.d.ts +18 -5
- package/dist/crm/cli/csv.js +30 -19
- package/dist/crm/cli/index.d.ts +1 -0
- package/dist/crm/cli/index.js +1 -0
- package/dist/domain/business.d.ts +3 -0
- package/dist/domain/business.js +2 -0
- package/dist/embeddings/models.d.ts +185 -5
- package/dist/embeddings/models.js +119 -5
- package/dist/entities/hit.d.ts +13 -2
- package/dist/entities/hit.js +10 -2
- package/dist/entities/index.d.ts +31 -1
- package/dist/entities/index.js +2 -1
- package/dist/entities/model.d.ts +42 -1
- package/dist/entities/model.js +20 -1
- package/dist/errors/reasons.js +4 -0
- package/dist/render/liquid.d.ts +14 -0
- package/dist/render/liquid.js +30 -0
- package/dist/replies/template.js +3 -22
- package/dist/search/account-list.d.ts +3 -2
- package/dist/search/account-list.js +5 -4
- package/dist/search/lucene/plain.js +4 -1
- package/dist/search/question-plan.js +2 -1
- package/dist/sends/permissions.js +4 -0
- package/dist/services/embeddings-maintenance.d.ts +1 -1
- package/dist/services/embeddings-maintenance.js +6 -6
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/link-scorers/chat-senders.d.ts +2 -1
- package/dist/services/link-scorers/chat-senders.js +13 -4
- package/dist/services/link-scorers/types.d.ts +1 -1
- package/dist/services/meeting-model.d.ts +1 -1
- package/dist/services/meeting-model.js +4 -4
- package/dist/services/messages-meaning.js +25 -4
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/model-downloads.js +1 -1
- package/dist/services/notes-search.d.ts +1 -1
- package/dist/services/notes-search.js +2 -2
- package/dist/services/proposals/kinds/relationship.js +1 -0
- package/dist/services/proposals/registry.js +3 -1
- package/dist/services/proposals/types.d.ts +2 -0
- package/dist/services/search-all-business.d.ts +18 -0
- package/dist/services/search-all-business.js +38 -0
- package/dist/services/search-all-meetings.d.ts +1 -1
- package/dist/services/search-all-meetings.js +7 -2
- package/dist/services/search-all.d.ts +12 -6
- package/dist/services/search-all.js +48 -12
- package/dist/services/text-model-choice.d.ts +50 -0
- package/dist/services/text-model-choice.js +151 -0
- package/dist/store/exports.d.ts +3 -0
- package/dist/store/exports.js +3 -0
- package/dist/store/index.d.ts +5 -1
- package/dist/store/index.js +3 -0
- package/dist/store/sqlite/business-search.d.ts +44 -0
- package/dist/store/sqlite/business-search.js +141 -0
- package/dist/store/sqlite/finance.d.ts +12 -0
- package/dist/store/sqlite/finance.js +38 -2
- package/dist/store/sqlite/involvement-queue.d.ts +2 -7
- package/dist/store/sqlite/involvement-queue.js +11 -14
- package/dist/store/sqlite/money-lines.d.ts +12 -1
- package/dist/store/sqlite/money-lines.js +50 -4
- package/dist/store/sqlite/orders.js +5 -25
- package/dist/store/sqlite/owner-languages.d.ts +13 -0
- package/dist/store/sqlite/owner-languages.js +49 -0
- package/dist/store/sqlite/proposed-actions.d.ts +2 -0
- package/dist/store/sqlite/proposed-actions.js +4 -3
- package/dist/store/sqlite/records.d.ts +21 -0
- package/dist/store/sqlite/records.js +74 -13
- package/dist/store/sqlite/ref-summaries.d.ts +3 -1
- package/dist/store/sqlite/ref-summaries.js +4 -1
- package/dist/store/sqlite/reported-relations.d.ts +1 -0
- package/dist/store/sqlite/reported-relations.js +5 -1
- package/dist/store/sqlite/vectors.d.ts +2 -0
- package/dist/store/sqlite/vectors.js +5 -0
- package/dist/store/store.d.ts +2 -0
- package/dist/store/store.js +4 -4
- package/dist/store/vectors.d.ts +2 -0
- package/dist/store/vectors.js +1 -0
- package/dist/terminal/prompt.d.ts +4 -0
- package/dist/terminal/prompt.js +21 -2
- package/package.json +2 -2
- package/parity.json +13 -0
|
@@ -11,6 +11,10 @@ import { read, rehearse, write } from "./transaction.js";
|
|
|
11
11
|
export { waitingPointer } from "./record-run.js";
|
|
12
12
|
const LIMIT = 1000;
|
|
13
13
|
const iso = (value) => new Date(Number(value)).toISOString();
|
|
14
|
+
const checkLimit = (limit) => {
|
|
15
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
|
|
16
|
+
throw new CliError("validation_error", "a record list takes 1–500 items");
|
|
17
|
+
};
|
|
14
18
|
const IDENTITY_SQL = IDENTITY_TYPES.map((type) => `'${type}'`).join(", ");
|
|
15
19
|
export const recordStoreOver = (context) => {
|
|
16
20
|
const { database } = context;
|
|
@@ -73,21 +77,78 @@ export const recordStoreOver = (context) => {
|
|
|
73
77
|
const row = rowOf(key);
|
|
74
78
|
return row ? sourceRecordOf(row) : undefined;
|
|
75
79
|
}),
|
|
76
|
-
list: async ({ provider, account, type, waiting, unmatched, flagged, limit = 100 }) => {
|
|
77
|
-
|
|
78
|
-
throw new CliError("validation_error", "a record list takes 1–500 items");
|
|
80
|
+
list: async ({ provider, account, type, waiting, unmatched, flagged, entity, batch, deleted, limit = 100 }) => {
|
|
81
|
+
checkLimit(limit);
|
|
79
82
|
return read(database, () => {
|
|
80
|
-
|
|
83
|
+
const accountId = findAccountPk(context, { provider, account });
|
|
84
|
+
if (accountId === undefined)
|
|
81
85
|
return [];
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
const where = ["r.account_id = ?"];
|
|
87
|
+
const params = [accountId];
|
|
88
|
+
const and = (condition, ...values) => {
|
|
89
|
+
where.push(condition);
|
|
90
|
+
for (const value of values)
|
|
91
|
+
params.push(value);
|
|
92
|
+
};
|
|
93
|
+
if (type !== undefined)
|
|
94
|
+
and("r.type = ?", type);
|
|
95
|
+
if (waiting)
|
|
96
|
+
and("r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type NOT LIKE 'custom:%' " +
|
|
97
|
+
`AND r.type NOT IN (${IDENTITY_SQL})`);
|
|
98
|
+
if (unmatched)
|
|
99
|
+
and(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL})`);
|
|
100
|
+
if (flagged)
|
|
101
|
+
and("r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint)");
|
|
102
|
+
if (entity !== undefined) {
|
|
103
|
+
const thing = requiredThing(database, entity, "the entity");
|
|
104
|
+
and("r.entity_type = ? AND r.entity_id = ?", thing.type, thing.id);
|
|
105
|
+
}
|
|
106
|
+
if (batch !== undefined)
|
|
107
|
+
and("r.batch_id = ?", batch);
|
|
108
|
+
if (deleted !== undefined)
|
|
109
|
+
and(`r.deleted_at IS ${deleted ? "NOT " : ""}NULL`);
|
|
110
|
+
return database
|
|
111
|
+
.prepare(`${SELECT}WHERE ${where.join(" AND ")} ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`)
|
|
112
|
+
.all(...params, limit)
|
|
113
|
+
.map(sourceRecordOf);
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
incoming: async (target, { limit = 100 } = {}) => {
|
|
117
|
+
checkLimit(limit);
|
|
118
|
+
return read(database, () => {
|
|
119
|
+
let pointing;
|
|
120
|
+
if ("externalId" in target) {
|
|
121
|
+
const row = rowOf(target);
|
|
122
|
+
if (!row)
|
|
123
|
+
return [];
|
|
124
|
+
pointing = { sql: "SELECT id FROM record_relations WHERE target_id = ?", params: [Number(row.id)] };
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const thing = requiredThing(database, target.entity, "the entity");
|
|
128
|
+
pointing = {
|
|
129
|
+
sql: "SELECT id FROM record_relations WHERE target_type = ? AND target_external_id = ? UNION " +
|
|
130
|
+
"SELECT rr.id FROM record_relations rr JOIN records t ON t.id = rr.target_id " +
|
|
131
|
+
"WHERE t.entity_type = ? AND t.entity_id = ?",
|
|
132
|
+
params: ["ref", `${thing.type}:${thing.id}`, thing.type, thing.id],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return database
|
|
136
|
+
.prepare("SELECT rr.role, rr.as_role, rr.amount, r.type, r.external_id, a.provider, a.external_id AS account " +
|
|
137
|
+
"FROM record_relations rr JOIN records r ON r.id = rr.record_id JOIN accounts a ON a.id = r.account_id " +
|
|
138
|
+
`WHERE rr.id IN (${pointing.sql}) AND r.deleted_at IS NULL AND rr.role NOT LIKE 'fields.%' ` +
|
|
139
|
+
"ORDER BY rr.id LIMIT ?")
|
|
140
|
+
.all(...pointing.params, limit)
|
|
141
|
+
.map((row) => ({
|
|
142
|
+
record: {
|
|
143
|
+
provider: String(row.provider),
|
|
144
|
+
account: String(row.account),
|
|
145
|
+
type: String(row.type),
|
|
146
|
+
externalId: String(row.external_id),
|
|
147
|
+
},
|
|
148
|
+
role: String(row.role),
|
|
149
|
+
as: row.as_role == null ? null : String(row.as_role),
|
|
150
|
+
amount: row.amount == null ? null : String(row.amount),
|
|
151
|
+
}));
|
|
91
152
|
});
|
|
92
153
|
},
|
|
93
154
|
map: async (key, entity, by) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type RefSummary } from "../../domain/ref-summaries.js";
|
|
1
|
+
import { type RefSummary, type RefsStore } from "../../domain/ref-summaries.js";
|
|
2
2
|
import type { CacheDatabase } from "../driver.js";
|
|
3
|
+
import type { StoreContext } from "./open.js";
|
|
3
4
|
/** A summary plus what an evidence reader shows beside it; `summaries` drops the extra fields. */
|
|
4
5
|
export interface RefRead extends RefSummary {
|
|
5
6
|
sender: string | null;
|
|
@@ -16,3 +17,4 @@ export interface RefReadOptions {
|
|
|
16
17
|
}
|
|
17
18
|
export declare const refReadsOf: (database: CacheDatabase, texts: readonly string[], { excerpt, now }?: RefReadOptions) => Map<string, RefRead>;
|
|
18
19
|
export declare const refSummariesOf: (database: CacheDatabase, texts: readonly string[], options?: RefReadOptions) => Map<string, RefSummary>;
|
|
20
|
+
export declare const refsStoreOver: (context: StoreContext) => RefsStore;
|
|
@@ -3,7 +3,7 @@ import { dealLine } from "../../domain/deals.js";
|
|
|
3
3
|
import { invoiceLine, paymentLine } from "../../domain/finance.js";
|
|
4
4
|
import { orderLine } from "../../domain/orders.js";
|
|
5
5
|
import { filesAccountSql, providerLabel, providerNamed } from "../../domain/providers.js";
|
|
6
|
-
import { oneLine } from "../../domain/ref-summaries.js";
|
|
6
|
+
import { oneLine, } from "../../domain/ref-summaries.js";
|
|
7
7
|
import { formatReference, parseReference } from "../../domain/references.js";
|
|
8
8
|
const EXCERPT_CHARS = 280;
|
|
9
9
|
const TITLE_CHARS = 120;
|
|
@@ -485,3 +485,6 @@ export const refReadsOf = (database, texts, { excerpt = false, now = Date.now()
|
|
|
485
485
|
};
|
|
486
486
|
const summaryOf = ({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary;
|
|
487
487
|
export const refSummariesOf = (database, texts, options = {}) => new Map([...refReadsOf(database, texts, options)].map(([text, read]) => [text, summaryOf(read, options.excerpt === true)]));
|
|
488
|
+
export const refsStoreOver = (context) => ({
|
|
489
|
+
summaries: async (texts, options) => refSummariesOf(context.database, texts, { ...options, now: context.now() }),
|
|
490
|
+
});
|
|
@@ -58,6 +58,7 @@ export interface RelationsStore {
|
|
|
58
58
|
*/
|
|
59
59
|
syncReported(key: AccountKey, relationships: ReportedRelation[], scope: ReportedScope, options?: ReportedOptions): Promise<ReportedSync>;
|
|
60
60
|
}
|
|
61
|
+
export declare const KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
|
|
61
62
|
/** The call, inside a transaction the caller holds: a CRM page saves its rows and their relationships together. */
|
|
62
63
|
export declare const syncReportedIn: (context: StoreContext, key: AccountKey, relationships: ReportedRelation[], scope: ReportedScope, { source, by }?: ReportedOptions) => ReportedSync;
|
|
63
64
|
export declare const relationsStoreOver: (context: StoreContext) => RelationsStore;
|
|
@@ -7,6 +7,9 @@ import { relationProposalsOver } from "./relation-proposals.js";
|
|
|
7
7
|
import { checkStoredRole } from "./relation-roles.js";
|
|
8
8
|
import { referenceOfThing, thingOf } from "./things.js";
|
|
9
9
|
import { write } from "./transaction.js";
|
|
10
|
+
// links_relationship_key's WHERE, word for word: without it SQLite cannot use that partial index, picks
|
|
11
|
+
// (to_type, to_id) and reads every link of a busy end, such as a deal owner's, for each relationship (#2623).
|
|
12
|
+
export const KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
|
|
10
13
|
const metadataOf = (relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null;
|
|
11
14
|
/** The call, inside a transaction the caller holds: a CRM page saves its rows and their relationships together. */
|
|
12
15
|
export const syncReportedIn = (context, key, relationships, scope, { source = "import", by = { bot: key.provider, kind: "rule" } } = {}) => {
|
|
@@ -26,7 +29,8 @@ export const syncReportedIn = (context, key, relationships, scope, { source = "i
|
|
|
26
29
|
};
|
|
27
30
|
const seen = new Set();
|
|
28
31
|
const issue = (relation, reason, message) => result.issues.push({ reason, message, from: relation.from, to: relation.to, kind: relation.kind });
|
|
29
|
-
const sameKey =
|
|
32
|
+
const sameKey = `${KEYED} AND kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? ` +
|
|
33
|
+
"AND anchor IS NULL AND ifnull(role, '') = ?";
|
|
30
34
|
for (const relation of relationships) {
|
|
31
35
|
let from = thingOf(database, relation.from);
|
|
32
36
|
let to = thingOf(database, relation.to);
|
|
@@ -116,3 +116,5 @@ export declare const readiness: ({ orm }: StoreContext, chatKey: number, model:
|
|
|
116
116
|
missing: number;
|
|
117
117
|
};
|
|
118
118
|
} | undefined;
|
|
119
|
+
/** The primary key starts with `model`, so each count reads only that model's rows. */
|
|
120
|
+
export declare const vectorCounts: ({ orm }: StoreContext, models: string[]) => Map<string, number>;
|
|
@@ -332,3 +332,8 @@ export const readiness = ({ orm }, chatKey, model) => {
|
|
|
332
332
|
vectors: { chunks, embedded: Number(vectors?.embedded ?? 0), current, stale, missing: chunks - current - stale },
|
|
333
333
|
};
|
|
334
334
|
};
|
|
335
|
+
/** The primary key starts with `model`, so each count reads only that model's rows. */
|
|
336
|
+
export const vectorCounts = ({ orm }, models) => new Map(models.map((model) => [
|
|
337
|
+
model,
|
|
338
|
+
Number(orm.get(sql `SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0),
|
|
339
|
+
]));
|
package/dist/store/store.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { type SearchesStore } from "./searches.js";
|
|
|
22
22
|
import { type AgentActionsStore } from "./sqlite/agent-actions.js";
|
|
23
23
|
import { type BotUpdateStore } from "./sqlite/bot-updates.js";
|
|
24
24
|
import { type ContractsStore } from "./sqlite/business-contracts.js";
|
|
25
|
+
import { type BusinessSearchStore } from "./sqlite/business-search.js";
|
|
25
26
|
import { type CatalogStore } from "./sqlite/catalog.js";
|
|
26
27
|
import { type CrmCopies } from "./sqlite/crm.js";
|
|
27
28
|
import { type DealsStore } from "./sqlite/deals.js";
|
|
@@ -126,6 +127,7 @@ export interface MessageStore {
|
|
|
126
127
|
readonly wallets: WalletsStore;
|
|
127
128
|
/** What statements say moved on the wallets, split by category; an agent's or an import's wait for the owner. */
|
|
128
129
|
readonly transactions: TransactionsStore;
|
|
130
|
+
readonly business: BusinessSearchStore;
|
|
129
131
|
/** A CRM account's pipelines, deals, leads, contacts and companies, written as the CRM has them. */
|
|
130
132
|
readonly crm: CrmCopies;
|
|
131
133
|
/** Relationships a source account reports, written as a diff that never overrides the owner's. */
|
package/dist/store/store.js
CHANGED
|
@@ -18,6 +18,7 @@ import { agentActionsStoreOver } from "./sqlite/agent-actions.js";
|
|
|
18
18
|
import * as attachmentTexts from "./sqlite/attachment-texts.js";
|
|
19
19
|
import { botUpdateStoreOver } from "./sqlite/bot-updates.js";
|
|
20
20
|
import { contractsStoreOver } from "./sqlite/business-contracts.js";
|
|
21
|
+
import { businessSearchOver } from "./sqlite/business-search.js";
|
|
21
22
|
import { eventStoreOver } from "./sqlite/calendar.js";
|
|
22
23
|
import { catalogStoreOver } from "./sqlite/catalog.js";
|
|
23
24
|
import { contextEvidenceOver, contextIndexOver, contextRecordsOver } from "./sqlite/context-evidence.js";
|
|
@@ -48,7 +49,7 @@ import { productsStoreOver } from "./sqlite/products.js";
|
|
|
48
49
|
import { projectAnnotationStoreOver } from "./sqlite/project-transfer/store.js";
|
|
49
50
|
import { proposedActionsStoreOver } from "./sqlite/proposed-actions.js";
|
|
50
51
|
import { recordStoreOver } from "./sqlite/records.js";
|
|
51
|
-
import {
|
|
52
|
+
import { refsStoreOver } from "./sqlite/ref-summaries.js";
|
|
52
53
|
import { relationsStoreOver } from "./sqlite/reported-relations.js";
|
|
53
54
|
import * as stems from "./sqlite/stems.js";
|
|
54
55
|
import { subscriptionsStoreOver } from "./sqlite/subscriptions.js";
|
|
@@ -120,9 +121,7 @@ const storeOver = (context) => {
|
|
|
120
121
|
const meetingFindings = once(() => meetingFindingsStoreOver(context));
|
|
121
122
|
const evidenceFindings = once(() => evidenceFindingsStoreOver(context));
|
|
122
123
|
const mailFindings = once(() => mailFindingsStoreOver(context));
|
|
123
|
-
const refs =
|
|
124
|
-
summaries: async (texts, options) => refSummariesOf(context.database, texts, { ...options, now: context.now() }),
|
|
125
|
-
};
|
|
124
|
+
const refs = refsStoreOver(context);
|
|
126
125
|
const facts = once(() => factsStoreOver(context));
|
|
127
126
|
const finance = once(() => financeStoreOver(context));
|
|
128
127
|
const orders = once(() => ordersStoreOver(context));
|
|
@@ -230,6 +229,7 @@ const storeOver = (context) => {
|
|
|
230
229
|
return meetingFindings();
|
|
231
230
|
},
|
|
232
231
|
refs,
|
|
232
|
+
business: businessSearchOver(context),
|
|
233
233
|
get evidenceFindings() {
|
|
234
234
|
return evidenceFindings();
|
|
235
235
|
},
|
package/dist/store/vectors.d.ts
CHANGED
|
@@ -154,6 +154,8 @@ export interface VectorsStore extends AccountVectors {
|
|
|
154
154
|
}[]): Promise<void>;
|
|
155
155
|
/** Which of these chunk hashes already have a vector of `model`. */
|
|
156
156
|
embeddedHashes(model: string, hashes: string[]): Promise<Set<string>>;
|
|
157
|
+
/** How many chunk texts have a vector of each of these models. */
|
|
158
|
+
vectorCounts(models: string[]): Promise<Map<string, number>>;
|
|
157
159
|
}
|
|
158
160
|
export declare const accountVectorsOver: (context: StoreContext, mail: () => MailStore) => AccountVectors;
|
|
159
161
|
export declare const vectorsStoreOver: (context: StoreContext, keyed: AccountVectors) => VectorsStore;
|
package/dist/store/vectors.js
CHANGED
|
@@ -275,4 +275,5 @@ export const vectorsStoreOver = (context, keyed) => ({
|
|
|
275
275
|
write(context.database, () => vectors.saveVectors(context, model, dims, rows));
|
|
276
276
|
},
|
|
277
277
|
embeddedHashes: async (model, hashes) => imageChunks.embeddedHashes(context, model, hashes),
|
|
278
|
+
vectorCounts: async (models) => vectors.vectorCounts(context, models),
|
|
278
279
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const pasteHint: (platform?: NodeJS.Platform) => string;
|
|
1
2
|
export interface SecretInput {
|
|
2
3
|
input?: NodeJS.ReadableStream & {
|
|
3
4
|
isTTY?: boolean;
|
|
@@ -15,6 +16,9 @@ export interface SecretInput {
|
|
|
15
16
|
* second copy nobody remembers to delete. Both are avoided by never letting it land anywhere: it
|
|
16
17
|
* is typed or piped, goes straight to the keyring, and is never echoed.
|
|
17
18
|
*
|
|
19
|
+
* An empty hidden answer at a terminal is asked again, up to three times, with a line on how to paste; a piped
|
|
20
|
+
* empty answer still comes back empty at once, so a script never waits.
|
|
21
|
+
*
|
|
18
22
|
* The prompt goes to **stderr**, not stdout, so that `session start --json` still writes one JSON
|
|
19
23
|
* value and nothing else.
|
|
20
24
|
*/
|
package/dist/terminal/prompt.js
CHANGED
|
@@ -2,6 +2,8 @@ import { createInterface } from "node:readline";
|
|
|
2
2
|
import { Writable } from "node:stream";
|
|
3
3
|
import { CliError } from "@wirecat/cli-base";
|
|
4
4
|
import { bufferedInput, inputPolicy, MAX_SECRET_INPUT } from "../cli/input-policy.js";
|
|
5
|
+
const EMPTY_TRIES = 3;
|
|
6
|
+
export const pasteHint = (platform = process.platform) => `Nothing arrived. To paste in a terminal, use ${platform === "darwin" ? "Cmd+V" : "Ctrl+Shift+V (or right-click → Paste)"}.`;
|
|
5
7
|
/**
|
|
6
8
|
* One line of secret, taken without a file and without argv.
|
|
7
9
|
*
|
|
@@ -9,6 +11,9 @@ import { bufferedInput, inputPolicy, MAX_SECRET_INPUT } from "../cli/input-polic
|
|
|
9
11
|
* second copy nobody remembers to delete. Both are avoided by never letting it land anywhere: it
|
|
10
12
|
* is typed or piped, goes straight to the keyring, and is never echoed.
|
|
11
13
|
*
|
|
14
|
+
* An empty hidden answer at a terminal is asked again, up to three times, with a line on how to paste; a piped
|
|
15
|
+
* empty answer still comes back empty at once, so a script never waits.
|
|
16
|
+
*
|
|
12
17
|
* The prompt goes to **stderr**, not stdout, so that `session start --json` still writes one JSON
|
|
13
18
|
* value and nothing else.
|
|
14
19
|
*/
|
|
@@ -66,9 +71,23 @@ export const readSecret = async (prompt, { input = process.stdin, output = proce
|
|
|
66
71
|
reader.once("SIGINT", cancel);
|
|
67
72
|
reader.once("close", cancel);
|
|
68
73
|
signal?.addEventListener("abort", abort, { once: true });
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
// Hidden input shows nothing, so a paste that never landed (Ctrl+V in a Linux terminal) looks like one that did.
|
|
75
|
+
const ask = (tries) => {
|
|
76
|
+
muted = false;
|
|
77
|
+
reader.question(prompt, (line) => {
|
|
78
|
+
if (echo || line.trim() || tries >= EMPTY_TRIES)
|
|
79
|
+
return resolve(line);
|
|
80
|
+
output.write(`\n${pasteHint()}\n`);
|
|
81
|
+
ask(tries + 1);
|
|
82
|
+
});
|
|
83
|
+
muted = !echo;
|
|
84
|
+
};
|
|
85
|
+
ask(1);
|
|
71
86
|
});
|
|
87
|
+
if (!echo && !answer.trim())
|
|
88
|
+
throw new CliError("validation_error", `nothing arrived after ${EMPTY_TRIES} tries. ${pasteHint()}`, {
|
|
89
|
+
reason: "input.empty",
|
|
90
|
+
});
|
|
72
91
|
return answer.trim();
|
|
73
92
|
}
|
|
74
93
|
finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.610.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
"scripts": {
|
|
196
|
-
"build": "tsc --build --force && node scripts/bundle-drizzle.ts && node scripts/copy-snowball.ts && node scripts/copy-chart-fonts.ts",
|
|
196
|
+
"build": "tsc --build --force && node scripts/bundle-drizzle.ts && node scripts/copy-snowball.ts && node scripts/copy-chart-fonts.ts && node scripts/copy-report-templates.ts",
|
|
197
197
|
"check:dist": "node scripts/check-dist.ts",
|
|
198
198
|
"typecheck": "tsc --build --force --emitDeclarationOnly && tsc -p tsconfig.test.json && tsc -p tsconfig.scripts.json",
|
|
199
199
|
"lint": "biome check .",
|
package/parity.json
CHANGED
|
@@ -796,6 +796,10 @@
|
|
|
796
796
|
"default": "5s",
|
|
797
797
|
"note": "max's own copy is worded differently until T6 moves the command onto the shared one (e13)"
|
|
798
798
|
},
|
|
799
|
+
"--payload": {
|
|
800
|
+
"value": "<json>",
|
|
801
|
+
"meaning": "the data of what to do, as JSON"
|
|
802
|
+
},
|
|
799
803
|
"--per-chat": {
|
|
800
804
|
"meaning": "at most this many per chat, such as 1/12h",
|
|
801
805
|
"value": "<limit>"
|
|
@@ -3633,6 +3637,12 @@
|
|
|
3633
3637
|
"models": {
|
|
3634
3638
|
"in": "all"
|
|
3635
3639
|
},
|
|
3640
|
+
"models add": {
|
|
3641
|
+
"in": "all",
|
|
3642
|
+
"options": {
|
|
3643
|
+
"--payload": "all"
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3636
3646
|
"models download": {
|
|
3637
3647
|
"in": "all",
|
|
3638
3648
|
"options": {
|
|
@@ -3651,6 +3661,9 @@
|
|
|
3651
3661
|
"models list": {
|
|
3652
3662
|
"in": "all"
|
|
3653
3663
|
},
|
|
3664
|
+
"models set": {
|
|
3665
|
+
"in": "all"
|
|
3666
|
+
},
|
|
3654
3667
|
"polls": {
|
|
3655
3668
|
"in": "all"
|
|
3656
3669
|
},
|