@wrenai/genbi 0.0.5 → 0.0.6

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.
Files changed (27) hide show
  1. package/README.md +1 -1
  2. package/dist-server/harness/route/codex-ask.d.ts +1 -1
  3. package/dist-server/harness/route/codex-ask.js +5 -46
  4. package/dist-server/harness/route/dispatched.d.ts +20 -0
  5. package/dist-server/harness/route/dispatched.js +122 -24
  6. package/dist-server/harness/route/host-query.d.ts +93 -0
  7. package/dist-server/harness/route/{codex-host-query.js → host-query.js} +120 -54
  8. package/dist-server/harness/route/route.js +3 -0
  9. package/dist-server/harness/route/types.d.ts +18 -1
  10. package/dist-server/harness/route/{codex-wren-proxy.js → wren-host-proxy.js} +6 -5
  11. package/dist-server/harness/setup/runner.d.ts +15 -3
  12. package/dist-server/harness/setup/runner.js +234 -72
  13. package/dist-server/harness/tools/setup-native.d.ts +7 -0
  14. package/dist-server/harness/tools/setup-native.js +7 -4
  15. package/dist-server/server/app.js +13 -4
  16. package/dist-server/server/bin.js +8 -0
  17. package/dist-server/server/fold.d.ts +9 -8
  18. package/dist-server/server/fold.js +17 -12
  19. package/dist-server/server/host-evidence-grounding.d.ts +21 -0
  20. package/dist-server/server/{codex-local-grounding.js → host-evidence-grounding.js} +15 -14
  21. package/dist-server/server/native-artifacts.d.ts +93 -4
  22. package/dist-server/server/native-artifacts.js +153 -4
  23. package/dist-server/server/turn.js +4 -1
  24. package/package.json +2 -2
  25. package/dist-server/harness/route/codex-host-query.d.ts +0 -52
  26. package/dist-server/server/codex-local-grounding.d.ts +0 -18
  27. /package/dist-server/harness/route/{codex-wren-proxy.d.ts → wren-host-proxy.d.ts} +0 -0
@@ -1,52 +0,0 @@
1
- import type { ComponentAccess } from "../components/broker.js";
2
- import { type GovernedErrorClass } from "../components/wren-access.js";
3
- /**
4
- * One query the host executed for a codex:local turn, in the component runner's observation
5
- * shape (`input.sql`, `output` carrying a host `query_id`), so the shared grounding predicate
6
- * reads it unchanged.
7
- */
8
- export interface HostQueryObservation {
9
- readonly tool: "run_sql";
10
- readonly input: {
11
- readonly sql: string;
12
- readonly limit: number;
13
- };
14
- readonly output: unknown;
15
- }
16
- /**
17
- * Per-turn bounds. Count, request and per-result bytes reuse the component runner's limits;
18
- * the total caps what the host keeps in memory for one turn until its answer is grounded.
19
- * Rows default to 1000 like `run_sql`. Like `run_sql`, the host probes one row past the limit to
20
- * report truncation; the cap is 9999 so the probe stays within governed-stdio's 10000-row bound.
21
- */
22
- export declare const CODEX_HOST_QUERY_LIMITS: Readonly<{
23
- queries: 32;
24
- requestBytes: 65536;
25
- resultBytes: 1048576;
26
- totalResultBytes: number;
27
- defaultRows: 1000;
28
- maxRows: 9999;
29
- timeoutMs: 120000;
30
- }>;
31
- /** Error classes the socket may return; the proxy owns the sentence the model sees for each. */
32
- export type HostQueryErrorClass = GovernedErrorClass | "unauthorized" | "budget_exhausted";
33
- export interface CodexHostQueryService {
34
- /** A 0600 file holding this turn's socket path and token. Its own path carries no secret. */
35
- readonly credentialFile: string;
36
- /** This turn's recorded observations, in execution order. Empty after `close()`. */
37
- observations(): readonly HostQueryObservation[];
38
- /** Stops accepting queries, discards observations, closes governed access, removes the credential. */
39
- close(): Promise<void>;
40
- }
41
- export interface CodexHostQueryServiceOptions {
42
- /** Opens governed access for this turn; called at most once, on the first query. */
43
- readonly openAccess: (signal: AbortSignal) => Promise<ComponentAccess>;
44
- readonly signal?: AbortSignal;
45
- }
46
- /**
47
- * The host side of codex:local's `run_sql`: a per-turn unix socket in a fresh 0700 directory
48
- * that answers only requests carrying this turn's random token. Every query runs through
49
- * governed access (`wren governed-stdio`), gets a turn-unique host `query_id`, and is recorded
50
- * as an observation of this turn only.
51
- */
52
- export declare function openCodexHostQueryService(options: CodexHostQueryServiceOptions): Promise<CodexHostQueryService>;
@@ -1,18 +0,0 @@
1
- import type { HostQueryObservation } from "../harness/route/codex-host-query.js";
2
- import { type RenderEnvelope } from "../harness/render/envelope.js";
3
- /**
4
- * Grounds a codex:local answer against the queries this turn's host query service executed,
5
- * with the component path's predicate (`citedGroundedQuery`: a tool-proven definition that
6
- * reads at least one table, cited by `query_id`, else by whitespace-insensitive SQL).
7
- *
8
- * Verified only when the answer cites at least one query and every citation grounds. The
9
- * envelope is then rebuilt from the observations alone: one `table` and one `definition` block
10
- * (carrying the observed `query_id`) per cited query, plus the model's `summary` text as written.
11
- * A cited result the host saw truncated still grounds the rows it shows; the host then appends
12
- * a note to `summary`, the only place the render contract carries such text. Anything else stays the model's answer with
13
- * `verified: false`: no citation, a citation to a query this turn never ran (including one from
14
- * an earlier turn), a query that read no table, or chart / KPI blocks the host cannot rebuild.
15
- */
16
- export declare function groundCodexLocalEnvelope(envelope: RenderEnvelope, finalText: string, observations: readonly HostQueryObservation[]): RenderEnvelope;
17
- /** Host-written, never model-written: a cited table that is only the first rows of its result. */
18
- export declare function truncationNote(shown: number): string;