@promptev/context-engine 0.0.0 → 0.0.2
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/README.md +116 -5
- package/dist/cli.js +1896 -552
- package/dist/cli.js.map +1 -1
- package/dist/{config-Bl9U789m.d.cts → config-BODDdXJ7.d.ts} +75 -16
- package/dist/{config-Bt9bUQqU.d.ts → config-C5RZ00W6.d.cts} +75 -16
- package/dist/express.cjs +925 -151
- package/dist/express.cjs.map +1 -1
- package/dist/express.d.cts +11 -4
- package/dist/express.d.ts +11 -4
- package/dist/express.js +926 -152
- package/dist/express.js.map +1 -1
- package/dist/fastify.cjs +923 -151
- package/dist/fastify.cjs.map +1 -1
- package/dist/fastify.d.cts +8 -4
- package/dist/fastify.d.ts +8 -4
- package/dist/fastify.js +924 -152
- package/dist/fastify.js.map +1 -1
- package/dist/{governance-XIScatRO.d.ts → governance-BLPK7NMe.d.ts} +8 -2
- package/dist/{governance-BDkcv4qZ.d.cts → governance-P9pRb4Ol.d.cts} +8 -2
- package/dist/graph/index.cjs +171 -59
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +5 -3
- package/dist/graph/index.d.ts +5 -3
- package/dist/graph/index.js +171 -59
- package/dist/graph/index.js.map +1 -1
- package/dist/hono.cjs +923 -151
- package/dist/hono.cjs.map +1 -1
- package/dist/hono.d.cts +8 -4
- package/dist/hono.d.ts +8 -4
- package/dist/hono.js +924 -152
- package/dist/hono.js.map +1 -1
- package/dist/index.cjs +2413 -1052
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -107
- package/dist/index.d.ts +125 -107
- package/dist/index.js +2412 -1050
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +100 -14
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +5 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.js +100 -14
- package/dist/mcp.js.map +1 -1
- package/dist/migrations/sql/0003_tools.sql +2 -0
- package/dist/migrations/sql/0004_acl_indexes.sql +23 -2
- package/dist/{redaction-BmDSWJ7h.d.cts → redaction-BqD_DEUQ.d.cts} +22 -1
- package/dist/{redaction-BmDSWJ7h.d.ts → redaction-BqD_DEUQ.d.ts} +22 -1
- package/dist/redaction-presidio.d.cts +1 -1
- package/dist/redaction-presidio.d.ts +1 -1
- package/dist/{router-CrxZ2y_Z.d.ts → router-CiFwC-EN.d.cts} +17 -2
- package/dist/{router-OPgSoYAB.d.cts → router-D8gBzwLd.d.ts} +17 -2
- package/dist/skills/context-engine/SKILL.md +5 -1
- package/dist/storage-CJrKgJeJ.d.ts +167 -0
- package/dist/storage-Dvpq2xAC.d.cts +167 -0
- package/package.json +61 -23
- package/src/migrations/sql/0003_tools.sql +2 -0
- package/src/migrations/sql/0004_acl_indexes.sql +23 -2
- package/src/skills/context-engine/SKILL.md +5 -1
- package/dist/embeddings-B-jZ42mk.d.cts +0 -67
- package/dist/embeddings-DaSdAZN3.d.ts +0 -67
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,29 @@
|
|
|
1
1
|
import { Pool } from 'pg';
|
|
2
|
-
import { C as ContextEngineConfig, L as LLMConfig, R as RerankerConfig } from './config-
|
|
3
|
-
export { a as ContextEngineConfigInit,
|
|
4
|
-
import { H as Hooks, R as RedactionPolicy, U as UsageEvent, I as IngestReport } from './redaction-
|
|
5
|
-
export { D as DocumentReport, a as RedactionRule, b as RedactionRuleInit, c as applyRedaction, e as emitError, d as
|
|
6
|
-
import { E as Embedder, F as FetchImpl } from './
|
|
7
|
-
export { a as EmbedKind, b as buildEmbedder } from './
|
|
8
|
-
import { T as ToolEngine, C as CanonicalTool, b as ToolHttpClient, a as ToolConfig } from './governance-
|
|
9
|
-
export { c as ToolKind, d as configSchema } from './governance-
|
|
2
|
+
import { C as ContextEngineConfig, L as LLMConfig, E as ExtractionConfig, R as RerankerConfig } from './config-BODDdXJ7.js';
|
|
3
|
+
export { a as ContextEngineConfigInit, b as EmbeddingConfig, F as FusionConfig, G as GraphConfig, S as StorageConfig } from './config-BODDdXJ7.js';
|
|
4
|
+
import { H as Hooks, R as RedactionPolicy, U as UsageEvent, P as ProgressEvent, I as IngestReport } from './redaction-BqD_DEUQ.js';
|
|
5
|
+
export { D as DocumentReport, a as RedactionRule, b as RedactionRuleInit, c as applyRedaction, e as emitError, d as emitProgress, f as emitToolCall, g as emitUsage, h as graphUnits, u as unitsForFile } from './redaction-BqD_DEUQ.js';
|
|
6
|
+
import { E as Embedder, S as StorageBackend, F as FetchImpl } from './storage-CJrKgJeJ.js';
|
|
7
|
+
export { C as ChunkRow, a as EmbedKind, P as PostgresBackend, b as SearchScope, c as buildEmbedder } from './storage-CJrKgJeJ.js';
|
|
8
|
+
import { T as ToolEngine, C as CanonicalTool, b as ToolHttpClient, a as ToolConfig } from './governance-BLPK7NMe.js';
|
|
9
|
+
export { c as ToolKind, d as configSchema } from './governance-BLPK7NMe.js';
|
|
10
10
|
export { createMcpApp } from './mcp.js';
|
|
11
11
|
import 'zod';
|
|
12
12
|
import 'node:http';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
supportsFts: boolean;
|
|
28
|
-
supportsTrgm: boolean;
|
|
29
|
-
supportsAnn: boolean;
|
|
30
|
-
upsertChunks(documentId: string, sourceId: string | null, acl: string[] | null, chunks: readonly ChunkRow[]): Promise<number>;
|
|
31
|
-
deleteChunks(documentId: string): Promise<void>;
|
|
32
|
-
updateChunkEmbeddings(documentId: string, vectors: readonly number[][]): Promise<number>;
|
|
33
|
-
updateChunkAcl(documentId: string, acl: string[] | null): Promise<number>;
|
|
34
|
-
filterIds(chunkIds: readonly string[], scope: SearchScope): Promise<string[]>;
|
|
35
|
-
ftsSearch(query: string, scope: SearchScope): Promise<string[]>;
|
|
36
|
-
trgmSearch(query: string, scope: SearchScope): Promise<string[]>;
|
|
37
|
-
annSearch(vector: readonly number[], scope: SearchScope): Promise<string[]>;
|
|
38
|
-
}
|
|
39
|
-
declare class PostgresBackend implements StorageBackend {
|
|
40
|
-
supportsFts: boolean;
|
|
41
|
-
supportsTrgm: boolean;
|
|
42
|
-
supportsAnn: boolean;
|
|
43
|
-
private readonly pool;
|
|
44
|
-
private readonly exactThresholdOverride;
|
|
45
|
-
/** Tri-state: null = not yet checked. */
|
|
46
|
-
private iterativeScan;
|
|
47
|
-
constructor(pool: Pool, exactThreshold?: number | null);
|
|
48
|
-
private get exactThreshold();
|
|
49
|
-
/**
|
|
50
|
-
* Bind values for SCOPE + the row limit.
|
|
51
|
-
* `principals` is passed through UNCHANGED: null (trusted) and [] (anonymous)
|
|
52
|
-
* mean different things.
|
|
53
|
-
*/
|
|
54
|
-
private scopeParams;
|
|
55
|
-
upsertChunks(documentId: string, sourceId: string | null, acl: string[] | null, chunks: readonly ChunkRow[]): Promise<number>;
|
|
56
|
-
deleteChunks(documentId: string): Promise<void>;
|
|
57
|
-
updateChunkEmbeddings(documentId: string, vectors: readonly number[][]): Promise<number>;
|
|
58
|
-
updateChunkAcl(documentId: string, acl: string[] | null): Promise<number>;
|
|
59
|
-
filterIds(chunkIds: readonly string[], scope: SearchScope): Promise<string[]>;
|
|
60
|
-
ftsSearch(query: string, scope: SearchScope): Promise<string[]>;
|
|
61
|
-
trgmSearch(query: string, scope: SearchScope): Promise<string[]>;
|
|
62
|
-
/**
|
|
63
|
-
* Set pg_trgm's similarity threshold for this query via the `set_limit()` /
|
|
64
|
-
* `show_limit()` FUNCTIONS — never the GUC `pg_trgm.similarity_threshold`.
|
|
65
|
-
*
|
|
66
|
-
* The GUC is registered lazily, only once pg_trgm's shared library is loaded
|
|
67
|
-
* into the backend process. On a fresh pooled connection that has not yet
|
|
68
|
-
* run any pg_trgm operation, `SHOW pg_trgm.similarity_threshold` raises
|
|
69
|
-
* "unrecognized configuration parameter" — and because that error aborts the
|
|
70
|
-
* surrounding transaction, a fallback issued on the same connection then
|
|
71
|
-
* fails with "current transaction is aborted". Every connection a pool hands
|
|
72
|
-
* out is fresh, so this is the common case, not an edge case. Calling
|
|
73
|
-
* `set_limit()` loads the library and does not depend on the GUC. This
|
|
74
|
-
* mirrors the Python backend, which was hardened against exactly this.
|
|
75
|
-
*
|
|
76
|
-
* `set_limit()` is connection-scoped and survives COMMIT and the return to
|
|
77
|
-
* the pool, so the previous value is captured here and restored by the
|
|
78
|
-
* caller.
|
|
79
|
-
*/
|
|
80
|
-
private applyTrgmThreshold;
|
|
81
|
-
private restoreTrgmLimit;
|
|
82
|
-
annSearch(vector: readonly number[], scope: SearchScope): Promise<string[]>;
|
|
83
|
-
private eligibleIsSmall;
|
|
84
|
-
private tuneAnnScan;
|
|
85
|
-
private scanBudget;
|
|
86
|
-
private enableIterativeScan;
|
|
87
|
-
private supportsIterativeScan;
|
|
88
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* Sentinels distinguishing omitted arguments from real values, including null.
|
|
16
|
+
*
|
|
17
|
+
* UNSET: "argument omitted" vs null (e.g. updateDocument acl=null means unrestricted).
|
|
18
|
+
* TRUSTED: trusted caller, ACL filtering disabled. Truthy on purpose so
|
|
19
|
+
* `if (principals)` does not treat a trusted caller as anonymous.
|
|
20
|
+
*/
|
|
21
|
+
declare const UNSET: unique symbol;
|
|
22
|
+
type Unset = typeof UNSET;
|
|
23
|
+
declare const TRUSTED: unique symbol;
|
|
24
|
+
type Trusted = typeof TRUSTED;
|
|
25
|
+
type Principals = string[] | null | typeof TRUSTED | undefined;
|
|
26
|
+
declare function resolvePrincipals(value: Principals, method: string): string[] | null;
|
|
89
27
|
|
|
90
28
|
type Mode$1 = "hybrid" | "graph";
|
|
91
29
|
interface IngestRequest {
|
|
@@ -191,6 +129,13 @@ declare function queryStructured(question: string, opts: {
|
|
|
191
129
|
* call, no sandbox run — when the flag is `false`. That flag, not the
|
|
192
130
|
* isolate, is the actual security boundary.
|
|
193
131
|
*
|
|
132
|
+
* Only the document half lives here: fetch the in-scope tabular documents
|
|
133
|
+
* and parse their stored text into `{sheet: rows[]}`. Everything after that
|
|
134
|
+
* — the guards, both redaction surfaces below, the prompt → code → sandbox
|
|
135
|
+
* path and the swept result — is `computeOverFrames`, the seam a host calls
|
|
136
|
+
* when it already holds the frames and has no document to point at; this
|
|
137
|
+
* function builds its frames from documents and delegates.
|
|
138
|
+
*
|
|
194
139
|
* `config.redaction` is applied TWICE:
|
|
195
140
|
* 1. Each document's raw `.text` is masked BEFORE it is parsed into a
|
|
196
141
|
* table, so the data the LLM-authored code runs against is built from
|
|
@@ -204,9 +149,57 @@ declare function compute(instruction: string, opts: {
|
|
|
204
149
|
hooks: Hooks;
|
|
205
150
|
sourceIds?: string[] | null;
|
|
206
151
|
principals?: string[] | null;
|
|
207
|
-
|
|
152
|
+
documentIds?: string[] | null;
|
|
153
|
+
modelCfg?: LLMConfig | null;
|
|
154
|
+
timeout?: number;
|
|
155
|
+
}): Promise<Record<string, unknown>>;
|
|
156
|
+
/** What `compute()` builds and `computeOverFrames` consumes: sheet name → rows. */
|
|
157
|
+
type ComputeFrames = Record<string, Record<string, unknown>[]>;
|
|
158
|
+
/** A source document behind a frame, as `compute()` reports it in `documentsUsed`. */
|
|
159
|
+
interface ComputeDocument {
|
|
160
|
+
id: string;
|
|
161
|
+
name?: string | null;
|
|
162
|
+
sourceId?: string | null;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Compute an answer to `instruction` over caller-supplied tables.
|
|
166
|
+
*
|
|
167
|
+
* The frame-level seam under `compute()`: everything `compute()` does AFTER
|
|
168
|
+
* it has turned its documents into `{sheet: rows[]}` lives here, so a host
|
|
169
|
+
* that already holds the frames — an uploaded workbook, a connector's
|
|
170
|
+
* sheet, a query result — can run the same prompt → code → sandbox path
|
|
171
|
+
* without first ingesting a document to point at.
|
|
172
|
+
*
|
|
173
|
+
* `frames` keys are the sheet names the caller chose; the LLM sees them and
|
|
174
|
+
* each row's columns exactly as it sees a parsed document's.
|
|
175
|
+
*
|
|
176
|
+
* The guards are `compute()`'s, in the same order and all BEFORE any LLM
|
|
177
|
+
* call: `config.enableCodeExecution` off → `EngineActionError`; no LLM
|
|
178
|
+
* (`modelCfg` or `config.llm`) → `Error`; blank instruction or empty
|
|
179
|
+
* `frames` → `EngineActionError`; `timeout` clamped to 1..300 seconds.
|
|
180
|
+
*
|
|
181
|
+
* `config.redaction` is applied at the same two surfaces as `compute()`:
|
|
182
|
+
*
|
|
183
|
+
* 1. Every string cell and every column name is masked BEFORE the prompt is
|
|
184
|
+
* built (`maskFrames`), so neither the schema summary the LLM reads nor
|
|
185
|
+
* the rows its code runs against carry a raw value. Same intended
|
|
186
|
+
* trade-off as `compute()`'s point 1 — a masked cell can change a
|
|
187
|
+
* computed result, and that is correct.
|
|
188
|
+
* 2. The returned object is swept whole through `redactValueRecursive`,
|
|
189
|
+
* `code` included — `compute()`'s point 2, deliberately blunt.
|
|
190
|
+
*
|
|
191
|
+
* `hooks`, `principals` and `documents` are how `compute()` threads its own
|
|
192
|
+
* context through; a host calling the seam directly normally leaves them at
|
|
193
|
+
* their defaults (no error hook, trusted-internal `unless` evaluation, no
|
|
194
|
+
* source documents — `documentsUsed` comes back empty).
|
|
195
|
+
*/
|
|
196
|
+
declare function computeOverFrames(frames: ComputeFrames, instruction: string, opts: {
|
|
197
|
+
config: ContextEngineConfig;
|
|
208
198
|
modelCfg?: LLMConfig | null;
|
|
209
199
|
timeout?: number;
|
|
200
|
+
hooks?: Hooks | null;
|
|
201
|
+
principals?: string[] | null;
|
|
202
|
+
documents?: ComputeDocument[] | null;
|
|
210
203
|
}): Promise<Record<string, unknown>>;
|
|
211
204
|
|
|
212
205
|
/**
|
|
@@ -317,6 +310,7 @@ interface RunSearchOpts {
|
|
|
317
310
|
embedder: Embedder;
|
|
318
311
|
pool: Pool;
|
|
319
312
|
sourceIds?: string[] | null;
|
|
313
|
+
documentIds?: string[] | null;
|
|
320
314
|
principals?: string[] | null;
|
|
321
315
|
topK?: number;
|
|
322
316
|
mode?: Mode;
|
|
@@ -392,25 +386,6 @@ declare function redactHits(hits: Hit[], policy: RedactionPolicy, opts: {
|
|
|
392
386
|
*/
|
|
393
387
|
declare function runSearch(query: string, opts: RunSearchOpts): Promise<SearchResult>;
|
|
394
388
|
|
|
395
|
-
/**
|
|
396
|
-
* Sentinels distinguishing omitted arguments from real values, including null.
|
|
397
|
-
*
|
|
398
|
-
* UNSET: "argument omitted" vs null (e.g. updateDocument acl=null means unrestricted).
|
|
399
|
-
* TRUSTED: trusted caller, ACL filtering disabled. Truthy on purpose so
|
|
400
|
-
* `if (principals)` does not treat a trusted caller as anonymous.
|
|
401
|
-
*/
|
|
402
|
-
declare const UNSET: unique symbol;
|
|
403
|
-
type Unset = typeof UNSET;
|
|
404
|
-
declare class TrustedSentinel {
|
|
405
|
-
readonly [Symbol.toStringTag] = "TRUSTED";
|
|
406
|
-
toString(): string;
|
|
407
|
-
valueOf(): boolean;
|
|
408
|
-
}
|
|
409
|
-
declare const TRUSTED: TrustedSentinel;
|
|
410
|
-
type Trusted = typeof TRUSTED;
|
|
411
|
-
type Principals = string[] | null | typeof TRUSTED | undefined;
|
|
412
|
-
declare function resolvePrincipals(value: Principals, method: string): string[] | null;
|
|
413
|
-
|
|
414
389
|
/**
|
|
415
390
|
* `ContextEngine` — the package's public object.
|
|
416
391
|
*
|
|
@@ -439,6 +414,7 @@ declare class ContextEngine implements ToolEngine {
|
|
|
439
414
|
constructor(config: ContextEngineConfig, opts?: {
|
|
440
415
|
onUsage?: ((e: UsageEvent) => void) | null;
|
|
441
416
|
onError?: ((e: unknown, ctx: Record<string, unknown>) => void) | null;
|
|
417
|
+
onProgress?: ((e: ProgressEvent) => void) | null;
|
|
442
418
|
});
|
|
443
419
|
private ensurePool;
|
|
444
420
|
/** The embedding client, built on first use. */
|
|
@@ -486,6 +462,8 @@ declare class ContextEngine implements ToolEngine {
|
|
|
486
462
|
*/
|
|
487
463
|
search(query: string, opts?: {
|
|
488
464
|
sourceIds?: string[] | null;
|
|
465
|
+
/** Narrows WITHIN a source; INTERSECTS with `sourceIds`. */
|
|
466
|
+
documentIds?: string[] | null;
|
|
489
467
|
principals?: Principals;
|
|
490
468
|
topK?: number;
|
|
491
469
|
mode?: "hybrid" | "graph";
|
|
@@ -539,7 +517,7 @@ declare class ContextEngine implements ToolEngine {
|
|
|
539
517
|
compute(instruction: string, opts?: {
|
|
540
518
|
sourceIds?: string[] | null;
|
|
541
519
|
principals?: Principals;
|
|
542
|
-
|
|
520
|
+
documentIds?: string[] | null;
|
|
543
521
|
modelCfg?: LLMConfig | null;
|
|
544
522
|
timeout?: number;
|
|
545
523
|
}): Promise<Record<string, unknown>>;
|
|
@@ -566,6 +544,9 @@ declare class ContextEngine implements ToolEngine {
|
|
|
566
544
|
principals?: Principals;
|
|
567
545
|
actor?: Record<string, unknown> | null;
|
|
568
546
|
source?: string;
|
|
547
|
+
/** Opaque claim scope for approvals (e.g. a run id) — separate from
|
|
548
|
+
* `sourceId`. See `governance.executeTool`. */
|
|
549
|
+
approvalScope?: string | null;
|
|
569
550
|
}): Promise<Record<string, unknown>>;
|
|
570
551
|
}
|
|
571
552
|
|
|
@@ -576,6 +557,23 @@ declare class ContextEngine implements ToolEngine {
|
|
|
576
557
|
* reported via `hooks.onError` and degrade to whatever partial text was recovered.
|
|
577
558
|
*/
|
|
578
559
|
|
|
560
|
+
/**
|
|
561
|
+
* WHY a document came back with less text than it has, when the answer is
|
|
562
|
+
* actionable. Mirrors the Python client's `Extracted.unreadable_reason` —
|
|
563
|
+
* that docstring is the canonical rationale; only the value semantics are
|
|
564
|
+
* restated here:
|
|
565
|
+
*
|
|
566
|
+
* - `needs_vision` — pages had no usable text layer and no vision model was
|
|
567
|
+
* configured. FIXABLE by configuring one (the OCR fallback may have tried
|
|
568
|
+
* and read nothing; a vision model is still the actionable upgrade).
|
|
569
|
+
* - `vision_failed` — a vision model was configured and produced nothing for
|
|
570
|
+
* those pages. An ops problem, not a configuration one.
|
|
571
|
+
*
|
|
572
|
+
* `null` means nothing was lost — a page a reader READ and found empty is
|
|
573
|
+
* blank, not unreadable. A closed set on purpose (callers branch on it), and
|
|
574
|
+
* NOT an error channel; `mediaOnly` stays set alongside it for whole files.
|
|
575
|
+
*/
|
|
576
|
+
type UnreadableReason = "needs_vision" | "vision_failed";
|
|
579
577
|
declare class Extracted {
|
|
580
578
|
text: string;
|
|
581
579
|
pages: number | null;
|
|
@@ -584,6 +582,10 @@ declare class Extracted {
|
|
|
584
582
|
providerTokens: Record<string, number>;
|
|
585
583
|
llmPictures: number;
|
|
586
584
|
isMarkdown: boolean;
|
|
585
|
+
/** See `UnreadableReason`. `mediaOnly` is the same idea for whole files and
|
|
586
|
+
* stays set alongside this, so existing callers keep working. */
|
|
587
|
+
unreadableReason: UnreadableReason | null;
|
|
588
|
+
unreadablePages: number;
|
|
587
589
|
constructor(init: {
|
|
588
590
|
text: string;
|
|
589
591
|
pages?: number | null;
|
|
@@ -592,6 +594,8 @@ declare class Extracted {
|
|
|
592
594
|
providerTokens?: Record<string, number>;
|
|
593
595
|
llmPictures?: number;
|
|
594
596
|
isMarkdown?: boolean;
|
|
597
|
+
unreadableReason?: UnreadableReason | null;
|
|
598
|
+
unreadablePages?: number;
|
|
595
599
|
});
|
|
596
600
|
}
|
|
597
601
|
/**
|
|
@@ -601,6 +605,7 @@ declare class Extracted {
|
|
|
601
605
|
declare function extract(content: Buffer, filename: string, mime: string | null, opts: {
|
|
602
606
|
visionLlm?: LLMConfig | null;
|
|
603
607
|
hooks: Hooks;
|
|
608
|
+
extraction?: ExtractionConfig | null;
|
|
604
609
|
}): Promise<Extracted>;
|
|
605
610
|
|
|
606
611
|
declare const DEFAULT_LEG_WEIGHT = 1;
|
|
@@ -620,7 +625,8 @@ declare function rrfFuse(rankedLists: Record<string, string[]>, opts: {
|
|
|
620
625
|
* `callLlm(cfg, { system, user, jsonMode, images, client })` is the single entry
|
|
621
626
|
* point. Returns `[text, { input, output }]`.
|
|
622
627
|
*
|
|
623
|
-
* Images are always PNG.
|
|
628
|
+
* Images are always PNG. 240s call timeout (every provider), no retries.
|
|
629
|
+
* Injectable `client` / `fetch`.
|
|
624
630
|
* `callLlm` owns and closes the client it builds unless one is passed in.
|
|
625
631
|
*/
|
|
626
632
|
|
|
@@ -660,6 +666,17 @@ type LlmCallOpts = {
|
|
|
660
666
|
user: string;
|
|
661
667
|
jsonMode?: boolean;
|
|
662
668
|
images?: ImageBytes[] | null;
|
|
669
|
+
maxTokens?: number | null;
|
|
670
|
+
/** Reasoning tokens are drawn from `maxTokens`, so a caller that wants
|
|
671
|
+
* transcription rather than deliberation must be able to spend the whole
|
|
672
|
+
* budget on output. Omitted = the provider's default. Applied per provider
|
|
673
|
+
* capability: gemini and anthropic take it directly (anthropic thinking is
|
|
674
|
+
* opt-in, so 0 sends nothing and a positive budget drops `temperature` —
|
|
675
|
+
* the API rejects the combination); bedrock forwards a positive budget as
|
|
676
|
+
* the anthropic-style passthrough; the openai family has no portable
|
|
677
|
+
* thinking control. */
|
|
678
|
+
thinkingBudget?: number | null;
|
|
679
|
+
temperature?: number | null;
|
|
663
680
|
};
|
|
664
681
|
type LLMClientOpts = {
|
|
665
682
|
client?: ChatClient | null;
|
|
@@ -817,6 +834,7 @@ interface ApprovalRecord {
|
|
|
817
834
|
toolName: string;
|
|
818
835
|
toolArgsFrozen: Record<string, unknown>;
|
|
819
836
|
sourceId: string | null;
|
|
837
|
+
approvalScope: string | null;
|
|
820
838
|
principals: unknown;
|
|
821
839
|
status: string;
|
|
822
840
|
approver: string | null;
|
|
@@ -835,7 +853,7 @@ type EngineLike = {
|
|
|
835
853
|
};
|
|
836
854
|
declare function shouldRequireApproval(ct: Pick<CanonicalTool, "requiresApproval" | "approvalPolicy">, args: Record<string, unknown>): boolean;
|
|
837
855
|
declare function resolveApproval(engine: EngineLike, approvalId: string, decision: "approved" | "rejected", approver: string, meta?: Record<string, unknown> | null, opts?: {
|
|
838
|
-
principals?: string[] | null;
|
|
856
|
+
principals?: string[] | null | Trusted;
|
|
839
857
|
}): Promise<ApprovalRecord>;
|
|
840
858
|
|
|
841
859
|
/**
|
|
@@ -848,4 +866,4 @@ declare function functionTool(fn: (...args: never[]) => unknown): CanonicalTool;
|
|
|
848
866
|
/** Bumped by CI on every main merge; 0.0.0 = pre-first-release. */
|
|
849
867
|
declare const __version__ = "0.0.0";
|
|
850
868
|
|
|
851
|
-
export { ApprovalExpired, ApprovalNotPending, type ApprovalRecord, CeleryRunner,
|
|
869
|
+
export { ApprovalExpired, ApprovalNotPending, type ApprovalRecord, CeleryRunner, CodeExecutionError, CodeExecutionTimeout, type ComputeDocument, type ComputeFrames, ContextEngine, ContextEngineConfig, DEFAULT_LEG_WEIGHT, DocumentNotFoundError, EXTRACTION_VERSION, Embedder, EngineActionError, ExtraMissingError, Extracted, ExtractionConfig, type ExtractionResult, GraphLegUnavailable, type Hit, Hooks, InProcessRunner, IngestReport, LLMClient, LLMConfig, type Principals, ProgressEvent, RedactionPolicy, RerankerConfig, type SearchResult, StorageBackend, TRUSTED, type TaskRunner, type TaskStatus, ToolConfig, type Trusted, UNSET, type Unset, UsageEvent, __version__, buildLlmClient, callLlm, compute, computeOverFrames, decryptDict, encryptDict, extract, extractStructuredData, functionTool, getDocumentText, getSecretKey, listDocuments, queryStructured, redactHits, rerank, resolveApproval, resolveFields, resolvePrincipals, rrfFuse, runMigrate, runSearch, shouldRequireApproval, upsertRegistry };
|