@wirecat/cli-core 0.642.0 → 0.644.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +197 -0
- package/dist/attachments/ocr.js +27 -18
- package/dist/attachments/picture-reading.d.ts +51 -0
- package/dist/attachments/picture-reading.js +207 -0
- package/dist/background/backfill.d.ts +4 -2
- package/dist/background/backfill.js +3 -3
- package/dist/background/schedules.d.ts +23 -1
- package/dist/background/schedules.js +45 -17
- package/dist/background/units.d.ts +2 -0
- package/dist/background/units.js +8 -9
- package/dist/calendar/cli/index.js +10 -2
- package/dist/calendar/feeds.js +2 -2
- package/dist/calendar/server-search.js +2 -2
- package/dist/calendar/source.d.ts +4 -3
- package/dist/calendar/sync.js +12 -10
- package/dist/calendar/testing/source-contract.js +5 -4
- package/dist/calendar/testing/source.js +3 -2
- package/dist/cli/complete-command.d.ts +23 -0
- package/dist/cli/complete-command.js +80 -0
- package/dist/cli/context.js +7 -1
- package/dist/cli/effects.d.ts +2 -0
- package/dist/cli/effects.js +2 -0
- package/dist/cli/envelope.js +6 -1
- package/dist/cli/help/first-screen.js +5 -0
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.js +2 -1
- package/dist/cli/list-query.d.ts +3 -1
- package/dist/cli/list-query.js +5 -3
- package/dist/cli/local-only-command.js +9 -0
- package/dist/cli/messenger/backfill-command.js +1 -1
- package/dist/cli/messenger/chat-queries.js +2 -1
- package/dist/cli/messenger/complete-command.d.ts +4 -7
- package/dist/cli/messenger/complete-command.js +31 -98
- package/dist/cli/messenger/contacts-command.js +4 -0
- package/dist/cli/messenger/guard-commands.js +1 -1
- package/dist/cli/messenger/images-command.js +32 -0
- package/dist/cli/messenger/list-result-queries.d.ts +1 -0
- package/dist/cli/messenger/list-result-queries.js +2 -1
- package/dist/cli/messenger/mentions-command.js +3 -3
- package/dist/cli/messenger/message-items.js +1 -0
- package/dist/cli/messenger/messages-command.js +7 -6
- package/dist/cli/messenger/people-queries.d.ts +2 -2
- package/dist/cli/messenger/people-queries.js +4 -4
- package/dist/cli/messenger/search-answers.js +2 -2
- package/dist/cli/messenger/search-command.js +3 -3
- package/dist/cli/messenger/searches-command.js +1 -1
- package/dist/cli/messenger/store-maintenance-command.js +4 -0
- package/dist/cli/messenger/tasks-analysis-command.js +1 -1
- package/dist/cli/messenger/tasks-command.js +2 -2
- package/dist/cli/model-catalogue-command.js +2 -0
- package/dist/cli/picture-reading-command.d.ts +12 -0
- package/dist/cli/picture-reading-command.js +82 -0
- package/dist/cli/program.d.ts +6 -0
- package/dist/cli/program.js +28 -2
- package/dist/cli/schedule/agent-start.d.ts +23 -0
- package/dist/cli/schedule/agent-start.js +115 -0
- package/dist/cli/schedule/harnesses.d.ts +203 -0
- package/dist/cli/schedule/harnesses.js +278 -0
- package/dist/cli/schedule/schedule-command.d.ts +9 -5
- package/dist/cli/schedule/schedule-command.js +89 -79
- package/dist/cli/shared-command-exports.d.ts +186 -0
- package/dist/cli/shared-command-exports.js +2 -0
- package/dist/cli/untrusted-marks.d.ts +25 -0
- package/dist/cli/untrusted-marks.js +102 -0
- package/dist/crm/cli/index.d.ts +1 -0
- package/dist/crm/cli/index.js +6 -5
- package/dist/crm/cli/store.d.ts +30 -0
- package/dist/crm/cli/store.js +63 -0
- package/dist/crm/source.d.ts +6 -4
- package/dist/crm/sync.js +10 -6
- package/dist/crm/testing/source-contract.js +9 -7
- package/dist/crm/testing/source.js +6 -2
- package/dist/crm/testing/sync-contract.js +4 -4
- package/dist/crm/writes.d.ts +5 -2
- package/dist/crm/writes.js +1 -1
- package/dist/documents.d.ts +1 -0
- package/dist/documents.js +1 -0
- package/dist/domain/addresses.d.ts +2 -0
- package/dist/domain/addresses.js +7 -0
- package/dist/domain/attachments.d.ts +2 -0
- package/dist/domain/attachments.js +2 -1
- package/dist/domain/models.d.ts +2 -0
- package/dist/entities/attachment-results.d.ts +3 -0
- package/dist/entities/attachment-results.js +3 -0
- package/dist/entities/attachment.d.ts +2 -0
- package/dist/entities/attachment.js +8 -1
- package/dist/entities/hit.d.ts +1 -0
- package/dist/entities/index.d.ts +21 -4
- package/dist/entities/index.js +3 -2
- package/dist/entities/list-results.d.ts +33 -5
- package/dist/entities/list-results.js +33 -5
- package/dist/errors/reasons.js +31 -2
- package/dist/mail/cli/index.js +7 -6
- package/dist/mcp/agent.d.ts +2 -1
- package/dist/mcp/agent.js +5 -0
- package/dist/mcp/app-server.js +10 -0
- package/dist/mcp/surface.d.ts +7 -2
- package/dist/mcp/surface.js +49 -10
- package/dist/meetings/cli/index.js +6 -1
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/meetings/mcp/index.js +6 -3
- package/dist/meetings/participant-search.d.ts +2 -2
- package/dist/meetings/project-discovery.d.ts +1 -1
- package/dist/meetings/project-evidence-answer.js +2 -2
- package/dist/meetings/reads.d.ts +2 -2
- package/dist/meetings/reads.js +6 -6
- package/dist/meetings/store.d.ts +2 -1
- package/dist/meetings/testing/contract.js +6 -6
- package/dist/meetings/testing/memory.js +7 -2
- package/dist/models/ai.d.ts +1 -1
- package/dist/models/ai.js +3 -1
- package/dist/models/anthropic.js +15 -9
- package/dist/models/index.js +5 -3
- package/dist/models/openai.js +24 -11
- package/dist/models/types.d.ts +8 -0
- package/dist/models/types.js +11 -1
- package/dist/ports/app.d.ts +17 -1
- package/dist/ports/app.js +63 -3
- package/dist/search/lucene/plain.js +45 -3
- package/dist/search/lucene/registry.d.ts +15 -4
- package/dist/search/lucene/registry.js +70 -12
- package/dist/search/lucene/types.d.ts +2 -0
- package/dist/search/lucene/types.js +12 -0
- package/dist/sends/upload.d.ts +8 -1
- package/dist/sends/upload.js +35 -14
- package/dist/services/account-groups.d.ts +11 -0
- package/dist/services/account-groups.js +29 -0
- package/dist/services/agenda.js +1 -0
- package/dist/services/attachments.d.ts +18 -4
- package/dist/services/attachments.js +66 -15
- package/dist/services/conversations.d.ts +2 -4
- package/dist/services/conversations.js +1 -1
- package/dist/services/deal-context.js +5 -5
- package/dist/services/documents/ingestion.js +3 -3
- package/dist/services/documents/knowledge.d.ts +6 -6
- package/dist/services/documents/knowledge.js +1 -2
- package/dist/services/events-search.d.ts +3 -3
- package/dist/services/events-search.js +7 -7
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/meeting-project-discovery.js +1 -1
- package/dist/services/message-resolution.js +10 -3
- package/dist/services/messages-search.js +6 -4
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/notes-search.d.ts +3 -3
- package/dist/services/notes-search.js +3 -3
- package/dist/services/organization-context.js +12 -9
- package/dist/services/people.d.ts +2 -0
- package/dist/services/people.js +4 -2
- package/dist/services/pictures.d.ts +9 -0
- package/dist/services/pictures.js +34 -28
- package/dist/services/project-status/index.js +1 -1
- package/dist/services/project-status/signals/payments.js +4 -2
- package/dist/services/project-status/signals/promises.js +5 -2
- package/dist/services/proposals/kinds/action.js +1 -1
- package/dist/services/proposals/kinds/fact.js +1 -1
- package/dist/services/proposals/kinds/findings.d.ts +2 -1
- package/dist/services/proposals/kinds/findings.js +12 -5
- package/dist/services/proposals/kinds/identity-link.js +1 -1
- package/dist/services/proposals/kinds/identity-split.js +1 -1
- package/dist/services/proposals/kinds/key-document.js +1 -1
- package/dist/services/proposals/kinds/mail-findings.d.ts +1 -1
- package/dist/services/proposals/kinds/mail-findings.js +11 -5
- package/dist/services/proposals/kinds/meeting-findings.js +10 -4
- package/dist/services/proposals/kinds/memory.js +1 -1
- package/dist/services/proposals/kinds/organization.js +1 -1
- package/dist/services/proposals/kinds/relationship-update.js +1 -1
- package/dist/services/proposals/kinds/relationship.js +1 -1
- package/dist/services/proposals/kinds/shared.d.ts +3 -2
- package/dist/services/proposals/kinds/shared.js +4 -4
- package/dist/services/proposals/kinds/source-review.js +1 -1
- package/dist/services/proposals/kinds/task-close.js +2 -2
- package/dist/services/proposals/registry.js +1 -1
- package/dist/services/proposals/types.d.ts +2 -1
- package/dist/services/search-all-business.js +3 -4
- package/dist/services/search-all.js +13 -14
- package/dist/services/searches.d.ts +2 -4
- package/dist/services/searches.js +1 -4
- package/dist/services/stored-project-gathering.js +6 -1
- package/dist/services/tags.d.ts +2 -4
- package/dist/services/tags.js +1 -1
- package/dist/services/tasks.d.ts +1 -1
- package/dist/services/tasks.js +4 -3
- package/dist/store/account-store.d.ts +2 -1
- package/dist/store/account-store.js +3 -1
- package/dist/store/accounts.d.ts +2 -0
- package/dist/store/accounts.js +8 -0
- package/dist/store/chats.d.ts +5 -0
- package/dist/store/chats.js +4 -0
- package/dist/store/evidence-findings.d.ts +9 -0
- package/dist/store/exports.d.ts +1 -1
- package/dist/store/exports.js +1 -1
- package/dist/store/identity-links.d.ts +3 -1
- package/dist/store/mail-findings.d.ts +9 -0
- package/dist/store/meeting-findings.d.ts +9 -0
- package/dist/store/searches.d.ts +3 -2
- package/dist/store/sqlite/accounts.js +37 -0
- package/dist/store/sqlite/agent-actions.d.ts +2 -1
- package/dist/store/sqlite/agent-actions.js +10 -4
- package/dist/store/sqlite/business-contracts.d.ts +3 -1
- package/dist/store/sqlite/business-contracts.js +7 -3
- package/dist/store/sqlite/business-search.d.ts +2 -1
- package/dist/store/sqlite/business-search.js +6 -4
- package/dist/store/sqlite/deals.d.ts +6 -4
- package/dist/store/sqlite/deals.js +12 -7
- package/dist/store/sqlite/evidence-findings.js +78 -9
- package/dist/store/sqlite/facts.d.ts +2 -1
- package/dist/store/sqlite/facts.js +6 -2
- package/dist/store/sqlite/finance.d.ts +4 -2
- package/dist/store/sqlite/finance.js +13 -6
- package/dist/store/sqlite/findings-core.d.ts +56 -2
- package/dist/store/sqlite/findings-core.js +109 -22
- package/dist/store/sqlite/identities.d.ts +4 -0
- package/dist/store/sqlite/identities.js +12 -3
- package/dist/store/sqlite/identity-proposals.js +34 -4
- package/dist/store/sqlite/lucene-fields.d.ts +2 -0
- package/dist/store/sqlite/lucene-fields.js +28 -2
- package/dist/store/sqlite/lucene.js +21 -10
- package/dist/store/sqlite/mail-findings.js +60 -22
- package/dist/store/sqlite/meeting-findings.js +53 -7
- package/dist/store/sqlite/meeting-participant-search.js +4 -5
- package/dist/store/sqlite/meetings.js +7 -3
- package/dist/store/sqlite/memories.d.ts +4 -2
- package/dist/store/sqlite/memories.js +13 -6
- package/dist/store/sqlite/money-transactions.d.ts +3 -1
- package/dist/store/sqlite/money-transactions.js +7 -3
- package/dist/store/sqlite/name-traces.d.ts +3 -3
- package/dist/store/sqlite/name-traces.js +29 -2
- package/dist/store/sqlite/orders.d.ts +3 -1
- package/dist/store/sqlite/orders.js +5 -2
- package/dist/store/sqlite/people-list.js +67 -22
- package/dist/store/sqlite/person-match-scan.d.ts +3 -1
- package/dist/store/sqlite/person-match-scan.js +97 -7
- package/dist/store/sqlite/products.d.ts +3 -1
- package/dist/store/sqlite/products.js +5 -2
- package/dist/store/sqlite/proposed-actions.d.ts +2 -1
- package/dist/store/sqlite/proposed-actions.js +7 -3
- package/dist/store/sqlite/query-filter.d.ts +4 -0
- package/dist/store/sqlite/query-filter.js +14 -0
- package/dist/store/sqlite/reads.d.ts +1 -0
- package/dist/store/sqlite/reads.js +14 -0
- package/dist/store/sqlite/records.d.ts +3 -1
- package/dist/store/sqlite/records.js +7 -5
- package/dist/store/sqlite/rows-page.d.ts +3 -0
- package/dist/store/sqlite/rows-page.js +4 -0
- package/dist/store/sqlite/searches.d.ts +2 -1
- package/dist/store/sqlite/searches.js +3 -1
- package/dist/store/sqlite/subscriptions.d.ts +5 -2
- package/dist/store/sqlite/subscriptions.js +13 -6
- package/dist/store/sqlite/task-board.js +27 -0
- package/dist/store/sqlite/task-find.d.ts +15 -0
- package/dist/store/sqlite/task-find.js +1 -0
- package/dist/store/sqlite/wallets.d.ts +3 -1
- package/dist/store/sqlite/wallets.js +7 -3
- package/dist/store/sqlite/work-tasks.d.ts +3 -11
- package/dist/store/sqlite/work-tasks.js +8 -4
- package/package.json +2 -2
- package/parity.json +24 -0
|
@@ -184,6 +184,192 @@ export declare const appDoctorCommand: (app: import("./entry.js").AppIdentity, c
|
|
|
184
184
|
}, (issue: import("valibot").StrictObjectIssue) => string>;
|
|
185
185
|
permissions?: import("./permission-keys.js").CommandPermissions | undefined;
|
|
186
186
|
}, options?: import("./app-doctor-command.js").AppDoctorOptions | undefined) => import("commander").Command;
|
|
187
|
+
export declare const appCompleteCommand: (app: Pick<import("./entry.js").AppIdentity, "command" | "envPrefix">, config: Pick<{
|
|
188
|
+
resolveSettings: (flags?: import("./settings.js").GlobalFlags, options?: import("./settings.js").ResolveOptions) => import("./settings.js").Settings & object;
|
|
189
|
+
configuredProfiles: (options?: import("./settings.js").ResolveOptions) => string[];
|
|
190
|
+
changeSetting: (path: string, { profile, setting, value, kind, root, }: {
|
|
191
|
+
profile: string | undefined;
|
|
192
|
+
setting: string;
|
|
193
|
+
value: string | undefined;
|
|
194
|
+
kind?: import("./settings.js").ProfileKind | undefined;
|
|
195
|
+
root?: boolean;
|
|
196
|
+
}) => unknown;
|
|
197
|
+
migrate: (path: string) => string[];
|
|
198
|
+
declaredSettings: import("./setting-defaults.js").DeclaredSetting[];
|
|
199
|
+
allSettings: string[];
|
|
200
|
+
defaultsOnlyKeys: string[];
|
|
201
|
+
schema: import("valibot").StrictObjectSchema<{
|
|
202
|
+
defaults: import("valibot").OptionalSchema<import("valibot").StrictObjectSchema<{
|
|
203
|
+
embedding_provider: ({
|
|
204
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
205
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
206
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
207
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
208
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
209
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
210
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
211
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
212
|
+
}, undefined>, undefined>, undefined>;
|
|
213
|
+
})["embeddingProvider"];
|
|
214
|
+
embedding_model: ({
|
|
215
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
216
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
217
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
218
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
219
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
220
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
221
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
222
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
223
|
+
}, undefined>, undefined>, undefined>;
|
|
224
|
+
})["embeddingModel"];
|
|
225
|
+
embedding_base_url: ({
|
|
226
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
227
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
228
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
229
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
230
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
231
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
232
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
233
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
234
|
+
}, undefined>, undefined>, undefined>;
|
|
235
|
+
})["embeddingBaseUrl"];
|
|
236
|
+
embedding_dims: ({
|
|
237
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
238
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
239
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
240
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
241
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
242
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
243
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
244
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
245
|
+
}, undefined>, undefined>, undefined>;
|
|
246
|
+
})["embeddingDims"];
|
|
247
|
+
models: ({
|
|
248
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
249
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
250
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
251
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
252
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
253
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
254
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
255
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
256
|
+
}, undefined>, undefined>, undefined>;
|
|
257
|
+
})["models"];
|
|
258
|
+
limit: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
259
|
+
timeout_ms: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
260
|
+
color: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
261
|
+
sender_colors: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
262
|
+
record: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
263
|
+
record_input: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").BooleanSchema<undefined>, import("valibot").LiteralSchema<"failed", undefined>], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
264
|
+
keep_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
265
|
+
keep_successful_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
266
|
+
keep_store_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
267
|
+
runs_size_limit_mb: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
268
|
+
permissions: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").GenericSchema<string>, import("valibot").PicklistSchema<readonly ["deny", "readonly", "ask", "allow"], (issue: import("valibot").PicklistIssue) => string>, (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
269
|
+
sends_per_hour: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
270
|
+
requests_per_minute: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 0, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
271
|
+
transcribe_with: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["auto", "messenger", "local"], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
272
|
+
speech_model: import("valibot").OptionalSchema<import("valibot").StringSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
273
|
+
search_catch_up: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
274
|
+
history_dialog_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MaxValueAction<number, 1095, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
275
|
+
history_group_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MaxValueAction<number, 1095, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
276
|
+
history_group_members_max: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
277
|
+
history_muted: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
278
|
+
picture_search: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
279
|
+
search_reranker: import("valibot").OptionalSchema<import("valibot").PicklistSchema<[...string[], "off"], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
280
|
+
update_check: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
281
|
+
skill_hint: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
282
|
+
}, (issue: import("valibot").StrictObjectIssue) => string>, undefined>;
|
|
283
|
+
profiles: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").StrictObjectSchema<{
|
|
284
|
+
embedding_provider: ({
|
|
285
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
286
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
287
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
288
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
289
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
290
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
291
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
292
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
293
|
+
}, undefined>, undefined>, undefined>;
|
|
294
|
+
})["embeddingProvider"];
|
|
295
|
+
embedding_model: ({
|
|
296
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
297
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
298
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
299
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
300
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
301
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
302
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
303
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
304
|
+
}, undefined>, undefined>, undefined>;
|
|
305
|
+
})["embeddingModel"];
|
|
306
|
+
embedding_base_url: ({
|
|
307
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
308
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
309
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
310
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
311
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
312
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
313
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
314
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
315
|
+
}, undefined>, undefined>, undefined>;
|
|
316
|
+
})["embeddingBaseUrl"];
|
|
317
|
+
embedding_dims: ({
|
|
318
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
319
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
320
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
321
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
322
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
323
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
324
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
325
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
326
|
+
}, undefined>, undefined>, undefined>;
|
|
327
|
+
})["embeddingDims"];
|
|
328
|
+
models: ({
|
|
329
|
+
embeddingProvider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["local", "openai"], undefined>, undefined>;
|
|
330
|
+
embeddingModel: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
331
|
+
embeddingBaseUrl: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
332
|
+
embeddingDims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 65536, undefined>]>, undefined>;
|
|
333
|
+
models: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, undefined>]>, import("valibot").StrictObjectSchema<{
|
|
334
|
+
readonly provider: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
|
|
335
|
+
readonly model: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TrimAction, import("valibot").MinLengthAction<string, 1, undefined>, import("valibot").MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
336
|
+
readonly base_url: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
|
|
337
|
+
}, undefined>, undefined>, undefined>;
|
|
338
|
+
})["models"];
|
|
339
|
+
limit: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
340
|
+
timeout_ms: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
341
|
+
color: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
342
|
+
sender_colors: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
343
|
+
record: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
344
|
+
record_input: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").BooleanSchema<undefined>, import("valibot").LiteralSchema<"failed", undefined>], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
345
|
+
keep_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
346
|
+
keep_successful_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
347
|
+
keep_store_runs_for_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
348
|
+
runs_size_limit_mb: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
349
|
+
permissions: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").GenericSchema<string>, import("valibot").PicklistSchema<readonly ["deny", "readonly", "ask", "allow"], (issue: import("valibot").PicklistIssue) => string>, (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
350
|
+
sends_per_hour: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
351
|
+
requests_per_minute: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 0, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
352
|
+
transcribe_with: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["auto", "messenger", "local"], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
353
|
+
speech_model: import("valibot").OptionalSchema<import("valibot").StringSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
354
|
+
search_catch_up: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
355
|
+
history_dialog_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MaxValueAction<number, 1095, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
356
|
+
history_group_days: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MaxValueAction<number, 1095, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
357
|
+
history_group_members_max: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").IntegerAction<number, (issue: import("valibot").BaseIssue<unknown>) => string>, import("valibot").MinValueAction<number, 1, (issue: import("valibot").BaseIssue<unknown>) => string>]>, undefined>;
|
|
358
|
+
history_muted: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
359
|
+
picture_search: import("valibot").OptionalSchema<import("valibot").BooleanSchema<(issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
360
|
+
search_reranker: import("valibot").OptionalSchema<import("valibot").PicklistSchema<[...string[], "off"], (issue: import("valibot").BaseIssue<unknown>) => string>, undefined>;
|
|
361
|
+
}, (issue: import("valibot").StrictObjectIssue) => string>, "has to be an object of profiles, by name">, {}>;
|
|
362
|
+
personal: import("valibot").OptionalSchema<import("valibot").StrictObjectSchema<{
|
|
363
|
+
readonly defaults: import("valibot").OptionalSchema<import("valibot").StrictObjectSchema<import("valibot").ObjectEntries, (issue: import("valibot").StrictObjectIssue) => string>, undefined>;
|
|
364
|
+
readonly profiles: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").StrictObjectSchema<import("valibot").ObjectEntries, (issue: import("valibot").StrictObjectIssue) => string>, "has to be an object of profiles, by name">, undefined>;
|
|
365
|
+
}, (issue: import("valibot").StrictObjectIssue) => string>, undefined>;
|
|
366
|
+
bot: import("valibot").OptionalSchema<import("valibot").StrictObjectSchema<{
|
|
367
|
+
readonly defaults: import("valibot").OptionalSchema<import("valibot").StrictObjectSchema<import("valibot").ObjectEntries, (issue: import("valibot").StrictObjectIssue) => string>, undefined>;
|
|
368
|
+
readonly profiles: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").StrictObjectSchema<import("valibot").ObjectEntries, (issue: import("valibot").StrictObjectIssue) => string>, "has to be an object of profiles, by name">, undefined>;
|
|
369
|
+
}, (issue: import("valibot").StrictObjectIssue) => string>, undefined>;
|
|
370
|
+
}, (issue: import("valibot").StrictObjectIssue) => string>;
|
|
371
|
+
permissions?: import("./permission-keys.js").CommandPermissions | undefined;
|
|
372
|
+
}, "configuredProfiles">, options?: import("./complete-command.js").AppCompletionOptions | undefined) => import("commander").Command;
|
|
187
373
|
export declare const appMcpCommand: (app: import("./entry.js").AppIdentity, configuration: {
|
|
188
374
|
resolveSettings: (flags?: import("./settings.js").GlobalFlags, options?: import("./settings.js").ResolveOptions) => import("./settings.js").Settings & object;
|
|
189
375
|
configuredProfiles: (options?: import("./settings.js").ResolveOptions) => string[];
|
|
@@ -6,6 +6,7 @@ import { botCommand as botCommandDefinition } from "./bot/command.js";
|
|
|
6
6
|
import { botMcpCommand as botMcpCommandDefinition } from "./bot/mcp.js";
|
|
7
7
|
import { botMessagesCommand as botMessagesCommandDefinition } from "./bot/messages.js";
|
|
8
8
|
import { commandsCommand as commandsCommandDefinition } from "./commands-command.js";
|
|
9
|
+
import { appCompleteCommand as appCompleteCommandDefinition } from "./complete-command.js";
|
|
9
10
|
import { configCommand as configCommandDefinition } from "./config-command.js";
|
|
10
11
|
import { honoursDryRun } from "./dry-run-guard.js";
|
|
11
12
|
import { guideCommand as guideCommandDefinition } from "./guide.js";
|
|
@@ -58,6 +59,7 @@ import { skillCommand as skillCommandDefinition } from "./skill-command.js";
|
|
|
58
59
|
import { upgradeCommand as upgradeCommandDefinition } from "./upgrade-command.js";
|
|
59
60
|
const sharedCommand = (factory) => honoursDryRun(protectedCommand(factory));
|
|
60
61
|
export const appDoctorCommand = sharedCommand(appDoctorCommandDefinition);
|
|
62
|
+
export const appCompleteCommand = sharedCommand(appCompleteCommandDefinition);
|
|
61
63
|
export const appMcpCommand = sharedCommand(appMcpCommandDefinition);
|
|
62
64
|
export const botAdminsCommand = sharedCommand(botAdminsCommandDefinition);
|
|
63
65
|
export const botMembersCommand = sharedCommand(botMembersCommandDefinition);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type AppIdentity } from "../ports/app.js";
|
|
3
|
+
/**
|
|
4
|
+
* The mark a scheduled agent's run put on the CLIs it may run, or nothing outside such a run. It is read from the
|
|
5
|
+
* agent's own start, so a command the agent runs cannot name another, and only a locked run has one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const untrustedMarkOf: (app: AppIdentity, env: NodeJS.ProcessEnv) => string | undefined;
|
|
8
|
+
/** Other people's text between the run's markers, with every bracket and the mark taken out, so it can close none. */
|
|
9
|
+
export declare const marked: (text: string, mark: string, source: string, id?: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* The answer with each field an object names in its `untrusted` list between the run's markers, at any depth. Other
|
|
12
|
+
* fields, and the shape, stay as they are.
|
|
13
|
+
*/
|
|
14
|
+
export declare const withUntrustedMarked: <T>(value: T, mark: string, id?: string) => T;
|
|
15
|
+
/**
|
|
16
|
+
* Other people's text in a message or an email at any depth of an answer: its text and transcript, who sent it and to
|
|
17
|
+
* whom, the chat's title, the subject, and the attachments' names and text. The fields a read lists here are not in
|
|
18
|
+
* its answer's own `untrusted` list, which would change what every caller reads.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MESSAGE_UNTRUSTED: readonly ["text", "transcript", "excerpt", "sender_name", "sender_username", "chat_title", "subject", "snippet", "attachments.name", "attachments.title", "attachments.text", "from.name", "to.name", "cc.name", "bcc.name", "reply_addresses.name"];
|
|
21
|
+
/** Declares the fields of a read's answer that hold other people's text, at any depth, for a scheduled agent's run. */
|
|
22
|
+
export declare const marksUntrusted: <T extends Command>(command: T, fields?: readonly string[]) => T;
|
|
23
|
+
export declare const untrustedFieldsOf: (command: Command) => readonly string[] | undefined;
|
|
24
|
+
/** The answer with each of `fields` marked wherever an object in it has that path. */
|
|
25
|
+
export declare const withFieldsMarked: <T>(value: T, fields: readonly string[], mark: string, id?: string) => T;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ancestorValue, envName, readOnlyLockOf } from "../ports/app.js";
|
|
2
|
+
const OPEN = "⟦";
|
|
3
|
+
const CLOSE = "⟧";
|
|
4
|
+
/**
|
|
5
|
+
* The mark a scheduled agent's run put on the CLIs it may run, or nothing outside such a run. It is read from the
|
|
6
|
+
* agent's own start, so a command the agent runs cannot name another, and only a locked run has one.
|
|
7
|
+
*/
|
|
8
|
+
export const untrustedMarkOf = (app, env) => {
|
|
9
|
+
if (readOnlyLockOf(app, env) === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
const mark = ancestorValue(envName(app, "UNTRUSTED_MARK"), env);
|
|
12
|
+
return mark && /^[0-9a-f]{16}$/.test(mark) ? mark : undefined;
|
|
13
|
+
};
|
|
14
|
+
/** Other people's text between the run's markers, with every bracket and the mark taken out, so it can close none. */
|
|
15
|
+
export const marked = (text, mark, source, id) => {
|
|
16
|
+
const inside = text.replaceAll(OPEN, "").replaceAll(CLOSE, "").replaceAll(mark, "");
|
|
17
|
+
const named = id === undefined ? "" : ` id=${id.replaceAll(OPEN, "").replaceAll(CLOSE, "").replace(/\s/g, "")}`;
|
|
18
|
+
return `${OPEN}untrusted:${mark} source=${source}${named}${CLOSE}${inside}${OPEN}/untrusted:${mark}${CLOSE}`;
|
|
19
|
+
};
|
|
20
|
+
const idOf = (value) => {
|
|
21
|
+
const id = value.ref ?? value.id;
|
|
22
|
+
return typeof id === "string" || typeof id === "number" ? String(id) : undefined;
|
|
23
|
+
};
|
|
24
|
+
const markAt = (value, path, mark, source, id) => {
|
|
25
|
+
if (Array.isArray(value))
|
|
26
|
+
return value.map((one) => markAt(one, path, mark, source, id));
|
|
27
|
+
// A text a nested answer already marked holds no bracket of its own, so its opening one is the mark's.
|
|
28
|
+
if (path.length === 0)
|
|
29
|
+
return typeof value === "string" && !value.startsWith(`${OPEN}untrusted:${mark} `)
|
|
30
|
+
? marked(value, mark, source, id)
|
|
31
|
+
: value;
|
|
32
|
+
if (value === null || typeof value !== "object")
|
|
33
|
+
return value;
|
|
34
|
+
const [key = "", ...rest] = path;
|
|
35
|
+
const record = value;
|
|
36
|
+
if (!(key in record))
|
|
37
|
+
return value;
|
|
38
|
+
return { ...record, [key]: markAt(record[key], rest, mark, source, idOf(record) ?? id) };
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The answer with each field an object names in its `untrusted` list between the run's markers, at any depth. Other
|
|
42
|
+
* fields, and the shape, stay as they are.
|
|
43
|
+
*/
|
|
44
|
+
export const withUntrustedMarked = (value, mark, id) => {
|
|
45
|
+
if (Array.isArray(value))
|
|
46
|
+
return value.map((one) => withUntrustedMarked(one, mark, id));
|
|
47
|
+
if (value === null || typeof value !== "object")
|
|
48
|
+
return value;
|
|
49
|
+
const record = value;
|
|
50
|
+
const own = idOf(record) ?? id;
|
|
51
|
+
let result = Object.fromEntries(Object.entries(record).map(([key, child]) => [
|
|
52
|
+
key,
|
|
53
|
+
key === "untrusted" ? child : withUntrustedMarked(child, mark, own),
|
|
54
|
+
]));
|
|
55
|
+
const fields = Array.isArray(record.untrusted) ? record.untrusted.filter((one) => typeof one === "string") : [];
|
|
56
|
+
for (const field of fields)
|
|
57
|
+
result = markAt(result, field.split("."), mark, field, own);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Other people's text in a message or an email at any depth of an answer: its text and transcript, who sent it and to
|
|
62
|
+
* whom, the chat's title, the subject, and the attachments' names and text. The fields a read lists here are not in
|
|
63
|
+
* its answer's own `untrusted` list, which would change what every caller reads.
|
|
64
|
+
*/
|
|
65
|
+
export const MESSAGE_UNTRUSTED = [
|
|
66
|
+
"text",
|
|
67
|
+
"transcript",
|
|
68
|
+
"excerpt",
|
|
69
|
+
"sender_name",
|
|
70
|
+
"sender_username",
|
|
71
|
+
"chat_title",
|
|
72
|
+
"subject",
|
|
73
|
+
"snippet",
|
|
74
|
+
"attachments.name",
|
|
75
|
+
"attachments.title",
|
|
76
|
+
"attachments.text",
|
|
77
|
+
"from.name",
|
|
78
|
+
"to.name",
|
|
79
|
+
"cc.name",
|
|
80
|
+
"bcc.name",
|
|
81
|
+
"reply_addresses.name",
|
|
82
|
+
];
|
|
83
|
+
const DECLARED = new WeakMap();
|
|
84
|
+
/** Declares the fields of a read's answer that hold other people's text, at any depth, for a scheduled agent's run. */
|
|
85
|
+
export const marksUntrusted = (command, fields = MESSAGE_UNTRUSTED) => {
|
|
86
|
+
DECLARED.set(command, fields);
|
|
87
|
+
return command;
|
|
88
|
+
};
|
|
89
|
+
export const untrustedFieldsOf = (command) => DECLARED.get(command);
|
|
90
|
+
/** The answer with each of `fields` marked wherever an object in it has that path. */
|
|
91
|
+
export const withFieldsMarked = (value, fields, mark, id) => {
|
|
92
|
+
if (Array.isArray(value))
|
|
93
|
+
return value.map((one) => withFieldsMarked(one, fields, mark, id));
|
|
94
|
+
if (value === null || typeof value !== "object")
|
|
95
|
+
return value;
|
|
96
|
+
const record = value;
|
|
97
|
+
const own = idOf(record) ?? id;
|
|
98
|
+
let result = Object.fromEntries(Object.entries(record).map(([key, child]) => [key, withFieldsMarked(child, fields, mark, own)]));
|
|
99
|
+
for (const field of fields)
|
|
100
|
+
result = markAt(result, field.split("."), mark, field, own);
|
|
101
|
+
return result;
|
|
102
|
+
};
|
package/dist/crm/cli/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { CrmSource } from "../source.js";
|
|
|
7
7
|
import type { CrmWriteCapabilities } from "../writer.js";
|
|
8
8
|
import { type CrmWrites } from "../writes.js";
|
|
9
9
|
export { type CsvField, type CsvPage, csvColumnPaths, csvFormatOption, DEAL_CSV_COLUMNS, printCsv, refuseCsvConflict, } from "./csv.js";
|
|
10
|
+
export { type CrmStoreOptions, openCrmStore } from "./store.js";
|
|
10
11
|
/**
|
|
11
12
|
* The selected profile's CRM account, opened by the app for one command and closed once its answer is built, before
|
|
12
13
|
* anything is printed (WC-LIFE-4).
|
package/dist/crm/cli/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { csvFormatOption, renderCsv } from "./csv.js";
|
|
|
22
22
|
import { pipelineView } from "./pipeline-view.js";
|
|
23
23
|
import { addCrmSearchAll } from "./search-all.js";
|
|
24
24
|
export { csvColumnPaths, csvFormatOption, DEAL_CSV_COLUMNS, printCsv, refuseCsvConflict, } from "./csv.js";
|
|
25
|
+
export { openCrmStore } from "./store.js";
|
|
25
26
|
const MOST = 500;
|
|
26
27
|
/** A stage by the store's reference, as memo's `stages list` and a deal's `base_stage` name it. */
|
|
27
28
|
const STAGE_REF = /^stage:\d+$/;
|
|
@@ -295,26 +296,26 @@ const addCrmCommandsDefinition = (program, options) => {
|
|
|
295
296
|
...(terms.has("stage") ? { stage: terms.get("stage") } : {}),
|
|
296
297
|
...(terms.has("pipeline") ? { pipeline: terms.get("pipeline") } : {}),
|
|
297
298
|
...(terms.has("organization") ? { organization: terms.get("organization") } : {}),
|
|
298
|
-
limit: Math.min(opts.limit
|
|
299
|
+
limit: Math.min(opts.limit, MOST),
|
|
299
300
|
offset: (opts.page - 1) * opts.limit,
|
|
300
301
|
});
|
|
301
302
|
if (opts.format === "csv")
|
|
302
303
|
return renderCsv(command, options.open, async (run) => {
|
|
303
304
|
const found = await read(run);
|
|
304
305
|
return {
|
|
305
|
-
items: marked(found.
|
|
306
|
+
items: marked(found.items, DEAL_UNTRUSTED),
|
|
306
307
|
fields: await run.store.crm.fields(run.account, kind),
|
|
307
308
|
page: opts.page,
|
|
308
|
-
hasMore: found.
|
|
309
|
+
hasMore: found.hasMore,
|
|
309
310
|
};
|
|
310
311
|
});
|
|
311
312
|
await within(command, async (run) => {
|
|
312
313
|
const found = await read(run);
|
|
313
314
|
return listOf(pathOf(command).join(" "), {
|
|
314
|
-
items: marked(found.
|
|
315
|
+
items: marked(found.items, DEAL_UNTRUSTED),
|
|
315
316
|
limit: opts.limit,
|
|
316
317
|
page: opts.page,
|
|
317
|
-
has_more: found.
|
|
318
|
+
has_more: found.hasMore,
|
|
318
319
|
...(words.length ? { args: { query: words } } : {}),
|
|
319
320
|
});
|
|
320
321
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AppIdentity } from "../../ports/app.js";
|
|
2
|
+
import type { MessageStore } from "../../store/store.js";
|
|
3
|
+
import type { AccountKey } from "../../store/types.js";
|
|
4
|
+
export interface CrmStoreOptions {
|
|
5
|
+
app: AppIdentity;
|
|
6
|
+
env: NodeJS.ProcessEnv;
|
|
7
|
+
profile: string;
|
|
8
|
+
/** The command only reads the store: `CrmCommandOptions.open`'s `readOnly`. */
|
|
9
|
+
readOnly: boolean;
|
|
10
|
+
/** The CRM's provider, as the store names it: the empty store's account under the read-only lock. */
|
|
11
|
+
provider: string;
|
|
12
|
+
/** Opens the shared store as the CLI does; a writable open also registers its provider. */
|
|
13
|
+
open: (env: NodeJS.ProcessEnv, options?: {
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
}) => Promise<MessageStore>;
|
|
16
|
+
/** The profile's account from its sign-in; asked only when no earlier run saved it. */
|
|
17
|
+
account: () => AccountKey;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The store a CRM command reads, and the profile's account in it. A read takes the account an earlier run saved, so it
|
|
21
|
+
* never reads the sign-in; the first read of a profile, a store that is missing or needs a migration, and every sync
|
|
22
|
+
* and write open it for writing and save the account (scope work: a CRM is the owner's work) and the profile.
|
|
23
|
+
*
|
|
24
|
+
* Under `<PREFIX>_READ_ONLY` a read with no store or no saved profile reads an empty store in a temporary folder, so
|
|
25
|
+
* the lock creates no `wirecat.db`; the folder goes when the store closes. A sync still writes, as a fetch may.
|
|
26
|
+
*/
|
|
27
|
+
export declare const openCrmStore: (options: CrmStoreOptions) => Promise<{
|
|
28
|
+
store: MessageStore;
|
|
29
|
+
account: AccountKey;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { isCliError } from "@wirecat/cli-base";
|
|
5
|
+
import { readOnlyLockOf } from "../../ports/app.js";
|
|
6
|
+
/**
|
|
7
|
+
* The store a CRM command reads, and the profile's account in it. A read takes the account an earlier run saved, so it
|
|
8
|
+
* never reads the sign-in; the first read of a profile, a store that is missing or needs a migration, and every sync
|
|
9
|
+
* and write open it for writing and save the account (scope work: a CRM is the owner's work) and the profile.
|
|
10
|
+
*
|
|
11
|
+
* Under `<PREFIX>_READ_ONLY` a read with no store or no saved profile reads an empty store in a temporary folder, so
|
|
12
|
+
* the lock creates no `wirecat.db`; the folder goes when the store closes. A sync still writes, as a fetch may.
|
|
13
|
+
*/
|
|
14
|
+
export const openCrmStore = async (options) => {
|
|
15
|
+
const { app, env, profile, readOnly, open } = options;
|
|
16
|
+
const locked = readOnly && readOnlyLockOf(app, env) !== undefined;
|
|
17
|
+
if (readOnly) {
|
|
18
|
+
const store = await open(env, { readOnly: true }).catch((error) => {
|
|
19
|
+
if (locked && !(isCliError(error) && error.code === "not_found"))
|
|
20
|
+
throw error;
|
|
21
|
+
return undefined;
|
|
22
|
+
});
|
|
23
|
+
if (store) {
|
|
24
|
+
const saved = await store.accounts
|
|
25
|
+
.profiles()
|
|
26
|
+
.then((all) => all[app.command]?.[profile])
|
|
27
|
+
.catch(() => undefined);
|
|
28
|
+
if (saved)
|
|
29
|
+
return { store, account: { provider: saved.provider, account: saved.account } };
|
|
30
|
+
await store.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (!locked)
|
|
34
|
+
return withProfile(options, env, options.account());
|
|
35
|
+
const folder = mkdtempSync(join(tmpdir(), `${app.command}-empty-`));
|
|
36
|
+
const removing = () => rmSync(folder, { recursive: true, force: true });
|
|
37
|
+
try {
|
|
38
|
+
const empty = await withProfile(options, { ...env, MESSAGING_STORE: join(folder, "wirecat.db") }, {
|
|
39
|
+
provider: options.provider,
|
|
40
|
+
account: profile,
|
|
41
|
+
});
|
|
42
|
+
const close = empty.store.close.bind(empty.store);
|
|
43
|
+
empty.store.close = () => close().finally(removing);
|
|
44
|
+
return empty;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
removing();
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const withProfile = async ({ app, profile, open }, env, account) => {
|
|
52
|
+
const store = await open(env);
|
|
53
|
+
try {
|
|
54
|
+
// An account already stored keeps the scope the owner gave it.
|
|
55
|
+
await store.accounts.saveAccount(account, { name: null, scope: "work" });
|
|
56
|
+
await store.accounts.saveProfile(app.command, profile, account);
|
|
57
|
+
return { store, account };
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
await store.close();
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
};
|
package/dist/crm/source.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ export interface CrmPage<T> {
|
|
|
13
13
|
items: T[];
|
|
14
14
|
/** Ids the CRM says it deleted since the cursor; never one that only left a filter. */
|
|
15
15
|
removed?: string[];
|
|
16
|
-
/** More pages in this round
|
|
17
|
-
|
|
16
|
+
/** More pages in this round, read from `nextCursor`. */
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
nextCursor?: string;
|
|
18
19
|
/** On the last page: the cursor the next run reads changes after; `null` when the CRM keeps none. */
|
|
19
20
|
cursor?: string | null;
|
|
20
21
|
}
|
|
@@ -23,8 +24,9 @@ export type CrmChanges<T> = CrmPage<T> | {
|
|
|
23
24
|
reset: true;
|
|
24
25
|
};
|
|
25
26
|
export interface CrmIdPage {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
items: string[];
|
|
28
|
+
hasMore: boolean;
|
|
29
|
+
nextCursor?: string;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* What a CRM account did not report in the last sync, so an answer can name it: a kind it has not, users or departments
|
package/dist/crm/sync.js
CHANGED
|
@@ -315,15 +315,17 @@ const syncKind = async (run, kind, options, result) => {
|
|
|
315
315
|
result.outOfScope += await store.crm.remove(account, kind, left);
|
|
316
316
|
}
|
|
317
317
|
run.moved();
|
|
318
|
-
if (page.
|
|
318
|
+
if (!page.hasMore) {
|
|
319
319
|
listed = true;
|
|
320
320
|
await save({ token: page.cursor ?? null });
|
|
321
321
|
break;
|
|
322
322
|
}
|
|
323
|
-
if (
|
|
323
|
+
if (page.nextCursor === undefined)
|
|
324
|
+
throw new CliError("invalid_response", `${source.provider} said there are more pages but gave no cursor`);
|
|
325
|
+
if (pages.has(page.nextCursor))
|
|
324
326
|
throw new CliError("invalid_response", `${source.provider} returned the same page twice`);
|
|
325
|
-
pages.add(page.
|
|
326
|
-
round = { ...round, page: page.
|
|
327
|
+
pages.add(page.nextCursor);
|
|
328
|
+
round = { ...round, page: page.nextCursor };
|
|
327
329
|
await save();
|
|
328
330
|
if (stop)
|
|
329
331
|
return stop;
|
|
@@ -343,9 +345,11 @@ const syncKind = async (run, kind, options, result) => {
|
|
|
343
345
|
const page = await ids.call(source, kind, pass.page ?? undefined, run.context);
|
|
344
346
|
if (signal?.aborted)
|
|
345
347
|
return "cancelled";
|
|
346
|
-
|
|
348
|
+
if (page.hasMore && page.nextCursor === undefined)
|
|
349
|
+
throw new CliError("invalid_response", `${source.provider} said there are more ids but gave no cursor`);
|
|
350
|
+
pass = { ...pass, seen: [...pass.seen, ...page.items], page: page.hasMore ? (page.nextCursor ?? null) : null };
|
|
347
351
|
run.moved();
|
|
348
|
-
if (page.
|
|
352
|
+
if (!page.hasMore)
|
|
349
353
|
break;
|
|
350
354
|
await save({ pass });
|
|
351
355
|
}
|