@wrenai/genbi 0.0.1
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/LICENSE +201 -0
- package/README.md +141 -0
- package/bin/genbi.mjs +31 -0
- package/dist/assets/echarts-LTFC-ysd.js +40 -0
- package/dist/assets/index-Bo--QMUN.js +441 -0
- package/dist/assets/index-Xs4q7pNo.css +1 -0
- package/dist/index.html +14 -0
- package/dist/wrenai_logo.png +0 -0
- package/dist/wrenai_logo_white.png +0 -0
- package/dist-server/harness/auth/detect.d.ts +18 -0
- package/dist-server/harness/auth/detect.js +37 -0
- package/dist-server/harness/auth/index.d.ts +4 -0
- package/dist-server/harness/auth/index.js +2 -0
- package/dist-server/harness/auth/probe.d.ts +18 -0
- package/dist-server/harness/auth/probe.js +52 -0
- package/dist-server/harness/auth/types.d.ts +42 -0
- package/dist-server/harness/auth/types.js +9 -0
- package/dist-server/harness/bundle/loader.d.ts +32 -0
- package/dist-server/harness/bundle/loader.js +43 -0
- package/dist-server/harness/bundle/schema.d.ts +199 -0
- package/dist-server/harness/bundle/schema.js +127 -0
- package/dist-server/harness/bundle/version.d.ts +10 -0
- package/dist-server/harness/bundle/version.js +43 -0
- package/dist-server/harness/capability/gate.d.ts +6 -0
- package/dist-server/harness/capability/gate.js +29 -0
- package/dist-server/harness/capability/registry.d.ts +6 -0
- package/dist-server/harness/capability/registry.js +17 -0
- package/dist-server/harness/cli-args.d.ts +123 -0
- package/dist-server/harness/cli-args.js +247 -0
- package/dist-server/harness/cli.d.ts +2 -0
- package/dist-server/harness/cli.js +151 -0
- package/dist-server/harness/compile/cache.d.ts +23 -0
- package/dist-server/harness/compile/cache.js +109 -0
- package/dist-server/harness/compile/compose-profile.d.ts +34 -0
- package/dist-server/harness/compile/compose-profile.js +95 -0
- package/dist-server/harness/compile/errors.d.ts +22 -0
- package/dist-server/harness/compile/errors.js +41 -0
- package/dist-server/harness/compile/fingerprint.d.ts +22 -0
- package/dist-server/harness/compile/fingerprint.js +84 -0
- package/dist-server/harness/compile/index.d.ts +8 -0
- package/dist-server/harness/compile/index.js +7 -0
- package/dist-server/harness/compile/pipeline.d.ts +66 -0
- package/dist-server/harness/compile/pipeline.js +176 -0
- package/dist-server/harness/compile/resolve-binary.d.ts +55 -0
- package/dist-server/harness/compile/resolve-binary.js +133 -0
- package/dist-server/harness/compile/types.d.ts +107 -0
- package/dist-server/harness/compile/types.js +1 -0
- package/dist-server/harness/compile/warble-identity.d.ts +12 -0
- package/dist-server/harness/compile/warble-identity.js +33 -0
- package/dist-server/harness/compliance/gate.d.ts +35 -0
- package/dist-server/harness/compliance/gate.js +48 -0
- package/dist-server/harness/compliance/index.d.ts +2 -0
- package/dist-server/harness/compliance/index.js +1 -0
- package/dist-server/harness/compliance/types.d.ts +16 -0
- package/dist-server/harness/compliance/types.js +1 -0
- package/dist-server/harness/events/emitter.d.ts +34 -0
- package/dist-server/harness/events/emitter.js +25 -0
- package/dist-server/harness/events/index.d.ts +4 -0
- package/dist-server/harness/events/index.js +2 -0
- package/dist-server/harness/events/sse.d.ts +20 -0
- package/dist-server/harness/events/sse.js +48 -0
- package/dist-server/harness/events/types.d.ts +131 -0
- package/dist-server/harness/events/types.js +1 -0
- package/dist-server/harness/exec/errors.d.ts +16 -0
- package/dist-server/harness/exec/errors.js +29 -0
- package/dist-server/harness/exec/index.d.ts +5 -0
- package/dist-server/harness/exec/index.js +2 -0
- package/dist-server/harness/exec/local.d.ts +32 -0
- package/dist-server/harness/exec/local.js +134 -0
- package/dist-server/harness/exec/policy.d.ts +12 -0
- package/dist-server/harness/exec/policy.js +1 -0
- package/dist-server/harness/exec/types.d.ts +63 -0
- package/dist-server/harness/exec/types.js +1 -0
- package/dist-server/harness/guardrails/index.d.ts +2 -0
- package/dist-server/harness/guardrails/index.js +1 -0
- package/dist-server/harness/guardrails/policy.d.ts +45 -0
- package/dist-server/harness/guardrails/policy.js +57 -0
- package/dist-server/harness/index.d.ts +37 -0
- package/dist-server/harness/index.js +19 -0
- package/dist-server/harness/loop/errors.d.ts +53 -0
- package/dist-server/harness/loop/errors.js +72 -0
- package/dist-server/harness/loop/executor.d.ts +123 -0
- package/dist-server/harness/loop/executor.js +380 -0
- package/dist-server/harness/loop/guard.d.ts +16 -0
- package/dist-server/harness/loop/guard.js +1 -0
- package/dist-server/harness/loop/index.d.ts +5 -0
- package/dist-server/harness/loop/index.js +3 -0
- package/dist-server/harness/native-producer/index.d.ts +109 -0
- package/dist-server/harness/native-producer/index.js +302 -0
- package/dist-server/harness/npm-package-resolve.d.ts +28 -0
- package/dist-server/harness/npm-package-resolve.js +47 -0
- package/dist-server/harness/providers/adapters/anthropic.d.ts +7 -0
- package/dist-server/harness/providers/adapters/anthropic.js +6 -0
- package/dist-server/harness/providers/adapters/mock.d.ts +4 -0
- package/dist-server/harness/providers/adapters/mock.js +5 -0
- package/dist-server/harness/providers/adapters/openai-compatible.d.ts +10 -0
- package/dist-server/harness/providers/adapters/openai-compatible.js +10 -0
- package/dist-server/harness/providers/binding.d.ts +23 -0
- package/dist-server/harness/providers/binding.js +13 -0
- package/dist-server/harness/providers/errors.d.ts +6 -0
- package/dist-server/harness/providers/errors.js +12 -0
- package/dist-server/harness/providers/index.d.ts +18 -0
- package/dist-server/harness/providers/index.js +22 -0
- package/dist-server/harness/providers/registry.d.ts +16 -0
- package/dist-server/harness/providers/registry.js +24 -0
- package/dist-server/harness/render/envelope.d.ts +145 -0
- package/dist-server/harness/render/envelope.js +428 -0
- package/dist-server/harness/render/errors.d.ts +33 -0
- package/dist-server/harness/render/errors.js +46 -0
- package/dist-server/harness/render/index.d.ts +5 -0
- package/dist-server/harness/render/index.js +3 -0
- package/dist-server/harness/render/validate.d.ts +13 -0
- package/dist-server/harness/render/validate.js +88 -0
- package/dist-server/harness/route/adapter-spec.d.ts +40 -0
- package/dist-server/harness/route/adapter-spec.js +61 -0
- package/dist-server/harness/route/agent-sdk-cli.d.ts +30 -0
- package/dist-server/harness/route/agent-sdk-cli.js +86 -0
- package/dist-server/harness/route/agent-sdk-manifest.d.ts +31 -0
- package/dist-server/harness/route/agent-sdk-manifest.js +56 -0
- package/dist-server/harness/route/artifact-content.d.ts +53 -0
- package/dist-server/harness/route/artifact-content.js +83 -0
- package/dist-server/harness/route/chat-event-mapper.d.ts +95 -0
- package/dist-server/harness/route/chat-event-mapper.js +164 -0
- package/dist-server/harness/route/codex-ask-events.d.ts +25 -0
- package/dist-server/harness/route/codex-ask-events.js +395 -0
- package/dist-server/harness/route/codex-ask.d.ts +15 -0
- package/dist-server/harness/route/codex-ask.js +242 -0
- package/dist-server/harness/route/codex-local-cli.d.ts +20 -0
- package/dist-server/harness/route/codex-local-cli.js +78 -0
- package/dist-server/harness/route/codex-local-manifest.d.ts +22 -0
- package/dist-server/harness/route/codex-local-manifest.js +180 -0
- package/dist-server/harness/route/describe.d.ts +54 -0
- package/dist-server/harness/route/describe.js +84 -0
- package/dist-server/harness/route/dispatched.d.ts +138 -0
- package/dist-server/harness/route/dispatched.js +339 -0
- package/dist-server/harness/route/in-process.d.ts +43 -0
- package/dist-server/harness/route/in-process.js +106 -0
- package/dist-server/harness/route/index.d.ts +19 -0
- package/dist-server/harness/route/index.js +12 -0
- package/dist-server/harness/route/profile-source.d.ts +37 -0
- package/dist-server/harness/route/profile-source.js +76 -0
- package/dist-server/harness/route/route.d.ts +33 -0
- package/dist-server/harness/route/route.js +114 -0
- package/dist-server/harness/route/tier-binding.d.ts +36 -0
- package/dist-server/harness/route/tier-binding.js +63 -0
- package/dist-server/harness/route/types.d.ts +286 -0
- package/dist-server/harness/route/types.js +1 -0
- package/dist-server/harness/session/errors.d.ts +4 -0
- package/dist-server/harness/session/errors.js +7 -0
- package/dist-server/harness/session/gate.d.ts +11 -0
- package/dist-server/harness/session/gate.js +13 -0
- package/dist-server/harness/session/index.d.ts +5 -0
- package/dist-server/harness/session/index.js +3 -0
- package/dist-server/harness/session/run.d.ts +60 -0
- package/dist-server/harness/session/run.js +333 -0
- package/dist-server/harness/session/types.d.ts +29 -0
- package/dist-server/harness/session/types.js +1 -0
- package/dist-server/harness/setup/codex-events.d.ts +12 -0
- package/dist-server/harness/setup/codex-events.js +108 -0
- package/dist-server/harness/setup/runner.d.ts +497 -0
- package/dist-server/harness/setup/runner.js +1314 -0
- package/dist-server/harness/tools/errors.d.ts +107 -0
- package/dist-server/harness/tools/errors.js +141 -0
- package/dist-server/harness/tools/index.d.ts +13 -0
- package/dist-server/harness/tools/index.js +8 -0
- package/dist-server/harness/tools/mcp.d.ts +26 -0
- package/dist-server/harness/tools/mcp.js +15 -0
- package/dist-server/harness/tools/native.d.ts +179 -0
- package/dist-server/harness/tools/native.js +322 -0
- package/dist-server/harness/tools/parse.d.ts +14 -0
- package/dist-server/harness/tools/parse.js +18 -0
- package/dist-server/harness/tools/resolve-wren-binary.d.ts +12 -0
- package/dist-server/harness/tools/resolve-wren-binary.js +21 -0
- package/dist-server/harness/tools/resolve.d.ts +51 -0
- package/dist-server/harness/tools/resolve.js +79 -0
- package/dist-server/harness/tools/setup-native.d.ts +84 -0
- package/dist-server/harness/tools/setup-native.js +353 -0
- package/dist-server/harness/tools/wiring.d.ts +10 -0
- package/dist-server/harness/tools/wiring.js +16 -0
- package/dist-server/providers/setup.provider.yaml +31 -0
- package/dist-server/providers/wren.provider.yaml +33 -0
- package/dist-server/server/adopt.d.ts +87 -0
- package/dist-server/server/adopt.js +263 -0
- package/dist-server/server/app.d.ts +6 -0
- package/dist-server/server/app.js +2521 -0
- package/dist-server/server/auth-choice.d.ts +16 -0
- package/dist-server/server/auth-choice.js +36 -0
- package/dist-server/server/bin.d.ts +2 -0
- package/dist-server/server/bin.js +601 -0
- package/dist-server/server/bootstrap-project-binding.d.ts +31 -0
- package/dist-server/server/bootstrap-project-binding.js +71 -0
- package/dist-server/server/clarify.d.ts +10 -0
- package/dist-server/server/clarify.js +17 -0
- package/dist-server/server/codex-setup-mcp.d.ts +2 -0
- package/dist-server/server/codex-setup-mcp.js +147 -0
- package/dist-server/server/compose.d.ts +89 -0
- package/dist-server/server/compose.js +271 -0
- package/dist-server/server/conn-config.d.ts +30 -0
- package/dist-server/server/conn-config.js +253 -0
- package/dist-server/server/context-files.d.ts +12 -0
- package/dist-server/server/context-files.js +117 -0
- package/dist-server/server/context-map.d.ts +30 -0
- package/dist-server/server/context-map.js +95 -0
- package/dist-server/server/context-source.d.ts +68 -0
- package/dist-server/server/context-source.js +85 -0
- package/dist-server/server/db.d.ts +862 -0
- package/dist-server/server/db.js +1839 -0
- package/dist-server/server/enrichment-runner.d.ts +184 -0
- package/dist-server/server/enrichment-runner.js +213 -0
- package/dist-server/server/enrichment-verify.d.ts +73 -0
- package/dist-server/server/enrichment-verify.js +290 -0
- package/dist-server/server/enrichment.d.ts +232 -0
- package/dist-server/server/enrichment.js +199 -0
- package/dist-server/server/env-detect.d.ts +8 -0
- package/dist-server/server/env-detect.js +17 -0
- package/dist-server/server/env-field-hints.d.ts +46 -0
- package/dist-server/server/env-field-hints.js +48 -0
- package/dist-server/server/fold.d.ts +133 -0
- package/dist-server/server/fold.js +407 -0
- package/dist-server/server/harness-profile-sources.d.ts +3 -0
- package/dist-server/server/harness-profile-sources.js +24 -0
- package/dist-server/server/harness.d.ts +19 -0
- package/dist-server/server/harness.js +439 -0
- package/dist-server/server/impact.d.ts +18 -0
- package/dist-server/server/impact.js +85 -0
- package/dist-server/server/interactive-terminal.d.ts +175 -0
- package/dist-server/server/interactive-terminal.js +336 -0
- package/dist-server/server/native-artifacts.d.ts +1004 -0
- package/dist-server/server/native-artifacts.js +564 -0
- package/dist-server/server/native-dispatch-registry.d.ts +42 -0
- package/dist-server/server/native-dispatch-registry.js +45 -0
- package/dist-server/server/native-producer-fence.d.ts +14 -0
- package/dist-server/server/native-producer-fence.js +48 -0
- package/dist-server/server/native-session-resume.d.ts +6 -0
- package/dist-server/server/native-session-resume.js +103 -0
- package/dist-server/server/native-session-workspace.d.ts +40 -0
- package/dist-server/server/native-session-workspace.js +175 -0
- package/dist-server/server/native-sessions.d.ts +374 -0
- package/dist-server/server/native-sessions.js +1517 -0
- package/dist-server/server/native-wren-runtime.d.ts +20 -0
- package/dist-server/server/native-wren-runtime.js +259 -0
- package/dist-server/server/node-pty-host.d.ts +31 -0
- package/dist-server/server/node-pty-host.js +100 -0
- package/dist-server/server/route-intent.d.ts +40 -0
- package/dist-server/server/route-intent.js +23 -0
- package/dist-server/server/runtime-binding.d.ts +52 -0
- package/dist-server/server/runtime-binding.js +258 -0
- package/dist-server/server/source-catalog.d.ts +84 -0
- package/dist-server/server/source-catalog.js +221 -0
- package/dist-server/server/source-driver.d.ts +35 -0
- package/dist-server/server/source-driver.js +124 -0
- package/dist-server/server/spa.d.ts +2 -0
- package/dist-server/server/spa.js +51 -0
- package/dist-server/server/subscription-model-catalog.d.ts +27 -0
- package/dist-server/server/subscription-model-catalog.js +203 -0
- package/dist-server/server/turn.d.ts +249 -0
- package/dist-server/server/turn.js +1074 -0
- package/dist-server/server/wire-types.d.ts +799 -0
- package/dist-server/server/wire-types.js +1 -0
- package/dist-server/server/wren-home.d.ts +19 -0
- package/dist-server/server/wren-home.js +33 -0
- package/dist-server/server/wren-profiles.d.ts +43 -0
- package/dist-server/server/wren-profiles.js +123 -0
- package/package.json +93 -0
- package/profiles/genbi-default/context/binding.yml +9 -0
- package/profiles/genbi-default/ir.golden.json +506 -0
- package/profiles/genbi-default/profile.yml +16 -0
- package/profiles/genbi-enrich-context/components/apply_enrichment/component.yml +42 -0
- package/profiles/genbi-enrich-context/components/draft_enrichment/component.yml +30 -0
- package/profiles/genbi-enrich-context/components/draft_enrichment/steps/draft.md +34 -0
- package/profiles/genbi-enrich-context/components/inspect_context/component.yml +32 -0
- package/profiles/genbi-enrich-context/components/inspect_context/steps/inspect.md +13 -0
- package/profiles/genbi-enrich-context/context/binding.yml +4 -0
- package/profiles/genbi-enrich-context/ir.golden.json +302 -0
- package/profiles/genbi-enrich-context/profile.yml +15 -0
- package/profiles/genbi-monitor/context/binding.yml +7 -0
- package/profiles/genbi-monitor/ir.golden.json +188 -0
- package/profiles/genbi-monitor/profile.yml +27 -0
- package/profiles/genbi-setup/components/build_context/component.yml +44 -0
- package/profiles/genbi-setup/components/build_context/steps/build.md +14 -0
- package/profiles/genbi-setup/components/connect_source/component.yml +51 -0
- package/profiles/genbi-setup/components/connect_source/steps/connect.md +23 -0
- package/profiles/genbi-setup/context/binding.yml +8 -0
- package/profiles/genbi-setup/ir.golden.json +140 -0
- package/profiles/genbi-setup/profile.yml +18 -0
- package/profiles/genbi-setup/raw/schema.json +5 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import type { EnrichmentBinding } from "./enrichment.js";
|
|
2
|
+
import { InteractiveTerminalManager } from "./interactive-terminal.js";
|
|
3
|
+
import type { InteractiveLaunchSpec, InteractiveTarget, InteractiveTerminalSession } from "./interactive-terminal.js";
|
|
4
|
+
import { type NativeSessionRow, type NativeSetupRecoveryCode, type NativeSetupRecoveryRow, type NativeSetupRecoveryState, type Store } from "./db.js";
|
|
5
|
+
import { type NativeArtifactService, type NativeMcpDescriptor, type NativeMcpHealth } from "./native-artifacts.js";
|
|
6
|
+
import { NATIVE_PURPOSES } from "./native-dispatch-registry.js";
|
|
7
|
+
import type { NativePurpose, NativeRuntimeBinding, NativeVendor } from "./native-dispatch-registry.js";
|
|
8
|
+
import type { NativeSessionStateBase } from "./native-session-workspace.js";
|
|
9
|
+
import type { NativeWrenRuntime } from "./native-wren-runtime.js";
|
|
10
|
+
export declare const NATIVE_VENDORS: readonly ["claude", "codex"];
|
|
11
|
+
export { NATIVE_PURPOSES };
|
|
12
|
+
export type { NativePurpose, NativeVendor };
|
|
13
|
+
export declare const NATIVE_SETUP_RECOVERY_MCP_TOOL_NAME = "report_setup_recovery";
|
|
14
|
+
/** Set only from the sealed, BFF-revalidated Setup bootstrap root at PTY launch. */
|
|
15
|
+
export declare const NATIVE_SETUP_BOOTSTRAP_ROOT_ENV_VAR = "WARBLE_SETUP_BOOTSTRAP_ROOT";
|
|
16
|
+
/** A browser must attach a newly-created PTY promptly or it is an orphan. */
|
|
17
|
+
export declare const NATIVE_SESSION_INITIAL_ATTACHMENT_GRACE_MS = 15000;
|
|
18
|
+
/**
|
|
19
|
+
* Ordinary navigation and idle browser detaches keep an already-authorized
|
|
20
|
+
* PTY reconnectable for this product TTL. This is intentionally much longer
|
|
21
|
+
* than the never-attached orphan cleanup below: a Session is a live tool, not
|
|
22
|
+
* a 60-second page view. It remains process-local; a BFF restart cannot
|
|
23
|
+
* recover this PTY without a separately sealed provider resume contract.
|
|
24
|
+
*/
|
|
25
|
+
export declare const NATIVE_SESSION_IDLE_TTL_MS: number;
|
|
26
|
+
/** @deprecated Use `NATIVE_SESSION_IDLE_TTL_MS`. Retained for test/API compatibility. */
|
|
27
|
+
export declare const NATIVE_SESSION_POST_CLAIM_DETACH_GRACE_MS: number;
|
|
28
|
+
/**
|
|
29
|
+
* The producer deliberately sees only a sealed binding identity, never a caller-supplied path.
|
|
30
|
+
* After materialization, the BFF adds the canonical bound root to Codex's read-only permission
|
|
31
|
+
* profile so WREN_PROJECT_HOME can resolve through the exact server-owned binding.
|
|
32
|
+
*/
|
|
33
|
+
export declare function grantCodexBoundProjectRead(cwd: string, projectPath: string, dataRoots?: readonly string[]): void;
|
|
34
|
+
interface CodexWrenHome {
|
|
35
|
+
readonly home: string;
|
|
36
|
+
readonly dataRoots: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export interface NativeSetupRecoveryReport {
|
|
39
|
+
readonly version: "1";
|
|
40
|
+
readonly sequence: number;
|
|
41
|
+
readonly phase: "connect" | "context";
|
|
42
|
+
readonly state: NativeSetupRecoveryState;
|
|
43
|
+
readonly code: NativeSetupRecoveryCode;
|
|
44
|
+
readonly decision?: {
|
|
45
|
+
readonly kind: "continue_or_stop";
|
|
46
|
+
readonly choices: readonly ["continue", "stop"];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface NativeSessionLaunch {
|
|
50
|
+
readonly row: NativeSessionRow;
|
|
51
|
+
/** Absent when a Setup launch failed before a terminal became attachable. */
|
|
52
|
+
readonly capability?: string;
|
|
53
|
+
/** Browser-only secret for a future restart-safe Setup recovery action. */
|
|
54
|
+
readonly recoveryCapability?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Browser-safe lifecycle projection. No provider handle, credential, or terminal bytes are exposed. */
|
|
57
|
+
export interface NativeSessionLifecycle {
|
|
58
|
+
readonly liveAction: "reattach" | "resume" | "restart";
|
|
59
|
+
/** True only for a still-available sealed provider conversation. */
|
|
60
|
+
readonly resumeAvailable: boolean;
|
|
61
|
+
readonly reason?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Every independent reason `resumeAvailable` can fail closed for. Each one
|
|
65
|
+
* gets its own user-facing sentence in `nativeSessionLifecycle` below — the
|
|
66
|
+
* lifecycle reason must never assert a specific cause the caller has not
|
|
67
|
+
* actually distinguished.
|
|
68
|
+
*/
|
|
69
|
+
export type NativeSessionResumeUnavailableCause = "not_terminal" | "runtime_settings_correction" | "scope_stale" | "workspace_unavailable" | "no_resume_handle";
|
|
70
|
+
/** Discriminated projection of why a row can or cannot resume. No identifiers travel in either branch. */
|
|
71
|
+
export type NativeSessionResumeAvailability = {
|
|
72
|
+
readonly available: true;
|
|
73
|
+
} | {
|
|
74
|
+
readonly available: false;
|
|
75
|
+
readonly cause: NativeSessionResumeUnavailableCause;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The accepted native-launch schema deliberately has no `resume` field for
|
|
79
|
+
* either current target. `readNativeLaunchSpec` rejects unknown fields, so
|
|
80
|
+
* this matrix is a deterministic statement about the sealed contract rather
|
|
81
|
+
* than a claim based on a browser-supplied handle.
|
|
82
|
+
*/
|
|
83
|
+
export declare function nativeSessionLifecycle(row: Pick<NativeSessionRow, "status" | "vendor">, resumeAvailability?: NativeSessionResumeAvailability): NativeSessionLifecycle;
|
|
84
|
+
/** Browser intent is explicit: reconnecting is never mistaken for a new TUI. */
|
|
85
|
+
export type NativeSessionLaunchIntent = "open_existing" | "start_separate" | "resume";
|
|
86
|
+
export declare class NativeSetupRecoveryError extends Error {
|
|
87
|
+
readonly status: number;
|
|
88
|
+
constructor(message: string, status?: number);
|
|
89
|
+
}
|
|
90
|
+
export interface NativeVendorReadiness {
|
|
91
|
+
readonly available: boolean;
|
|
92
|
+
readonly reason?: string;
|
|
93
|
+
}
|
|
94
|
+
/** Browser-safe producer compatibility state. It intentionally contains no path or process detail. */
|
|
95
|
+
export interface NativeProducerReadiness {
|
|
96
|
+
readonly available: boolean;
|
|
97
|
+
readonly category?: "native_session_producer_incompatible";
|
|
98
|
+
}
|
|
99
|
+
export interface NativePurposeReadiness {
|
|
100
|
+
readonly scopeKind: "bootstrap" | "bound_project";
|
|
101
|
+
readonly profile: string;
|
|
102
|
+
readonly target?: InteractiveTarget;
|
|
103
|
+
readonly targetLabel?: string;
|
|
104
|
+
readonly available: boolean;
|
|
105
|
+
readonly reason?: string;
|
|
106
|
+
readonly producer?: NativeProducerReadiness;
|
|
107
|
+
/** Compatibility shape retained empty; native target authority is `target`. */
|
|
108
|
+
readonly vendors: Record<NativeVendor, NativeVendorReadiness>;
|
|
109
|
+
}
|
|
110
|
+
export type NativeSessionReadiness = {
|
|
111
|
+
readonly runtime: NativeRuntimeBinding;
|
|
112
|
+
readonly purposes: Record<NativePurpose, NativePurposeReadiness>;
|
|
113
|
+
/** Health of the host-owned GenBI MCP endpoint; never includes a credential. */
|
|
114
|
+
readonly mcp: NativeMcpHealth;
|
|
115
|
+
} & Record<NativePurpose, NativePurposeReadiness>;
|
|
116
|
+
export interface NativeSessionServiceOptions {
|
|
117
|
+
readonly store: Store;
|
|
118
|
+
readonly terminalManager: () => Promise<InteractiveTerminalManager>;
|
|
119
|
+
readonly getBinding: () => EnrichmentBinding | undefined;
|
|
120
|
+
readonly workspaceRoot: string | undefined;
|
|
121
|
+
/** BFF-owned external state root, initialized once from the configured DB path. */
|
|
122
|
+
readonly materializationState?: NativeSessionStateBase;
|
|
123
|
+
readonly irPaths: Readonly<Record<NativePurpose, string | undefined>>;
|
|
124
|
+
/**
|
|
125
|
+
* The IR a session actually dispatches from, compiled for the binding it is
|
|
126
|
+
* about to run against.
|
|
127
|
+
*
|
|
128
|
+
* `irPaths` are the profiles' eval goldens: a golden is this profile compiled
|
|
129
|
+
* against warble's own example project, with that project's schema baked into
|
|
130
|
+
* `context_binding.resolved`. Dispatching one told a session on a real project
|
|
131
|
+
* that its models were jaffle-shop's, while the CLI in its cwd resolved the
|
|
132
|
+
* user's — the agent that noticed refused to draft anything, correctly.
|
|
133
|
+
*
|
|
134
|
+
* Goldens remain right for the producer contract probe, which asks whether
|
|
135
|
+
* this Warble can dispatch these profile shapes at all and has no user
|
|
136
|
+
* project in view. They are wrong the moment a session has a binding.
|
|
137
|
+
*/
|
|
138
|
+
readonly resolveDispatchIr?: (purpose: NativePurpose, binding: EnrichmentBinding | undefined) => Promise<string>;
|
|
139
|
+
readonly warbleBin: string;
|
|
140
|
+
/** Absolute server-configured Wren shim for native Codex sessions; never a request input. */
|
|
141
|
+
readonly wrenShim?: string;
|
|
142
|
+
/** Read-only probe used by readiness; creation remains the final authority. */
|
|
143
|
+
readonly terminalHostAvailable?: () => Promise<boolean>;
|
|
144
|
+
/** Test seam for the local executable probe. */
|
|
145
|
+
readonly executableAvailable?: (vendor: NativeVendor) => boolean;
|
|
146
|
+
/** Test seam for the configured local Warble producer probe. */
|
|
147
|
+
readonly producerAvailable?: () => boolean;
|
|
148
|
+
/** Test seam for the server-filtered, session-local Wren profile store. */
|
|
149
|
+
readonly prepareCodexWrenHome?: (input: {
|
|
150
|
+
readonly runtime: NativeWrenRuntime;
|
|
151
|
+
readonly projectPath: string;
|
|
152
|
+
readonly cwd: string;
|
|
153
|
+
}) => CodexWrenHome;
|
|
154
|
+
/** When configured, bound native sessions use the accepted v4 MCP+welcome descriptor; v2 remains compatible for callers without it. */
|
|
155
|
+
readonly artifactService?: NativeArtifactService;
|
|
156
|
+
/** Server-owned product idle TTL after a successful browser attachment disconnects. */
|
|
157
|
+
readonly idleTtlMs?: number;
|
|
158
|
+
/** @deprecated Compatibility alias for `idleTtlMs`. */
|
|
159
|
+
readonly postClaimDetachGraceMs?: number;
|
|
160
|
+
/** Bounded post-settlement duplicate-delivery window; test seam only. */
|
|
161
|
+
readonly startSeparateReplayTtlMs?: number;
|
|
162
|
+
/** Maximum retained settled start-separate action results; test seam only. */
|
|
163
|
+
readonly startSeparateReplayLimit?: number;
|
|
164
|
+
/** Test seam for the fixed, server-owned Warble dispatch only. */
|
|
165
|
+
readonly dispatch?: (input: NativeDispatchInput) => Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
export interface NativeDispatchInput {
|
|
168
|
+
readonly warbleBin: string;
|
|
169
|
+
/** Server-owned resolved producer identity captured by the compatibility preflight. */
|
|
170
|
+
readonly producer?: NativeProducerIdentity;
|
|
171
|
+
readonly irPath: string;
|
|
172
|
+
readonly target: InteractiveTarget;
|
|
173
|
+
readonly cwd: string;
|
|
174
|
+
readonly purpose: NativePurpose;
|
|
175
|
+
/** Exact v2 scope descriptor. It must never contain connection material. */
|
|
176
|
+
readonly scope: Record<string, unknown>;
|
|
177
|
+
/** Exact v4 MCP descriptor, transported separately through --native-mcp. */
|
|
178
|
+
readonly mcp?: NativeMcpDescriptor;
|
|
179
|
+
}
|
|
180
|
+
type NativeProviderLaunch = {
|
|
181
|
+
readonly kind: "initial";
|
|
182
|
+
readonly sessionId: string;
|
|
183
|
+
} | {
|
|
184
|
+
readonly kind: "resume";
|
|
185
|
+
readonly handle: string;
|
|
186
|
+
} | undefined;
|
|
187
|
+
/** A deliberately small public classification; never expose process or filesystem detail. */
|
|
188
|
+
export declare function nativeSessionLaunchFailure(error: unknown): string;
|
|
189
|
+
declare const NATIVE_PRODUCER_CATEGORY: "native_session_producer_incompatible";
|
|
190
|
+
/** Stable browser-safe code for an action UUID fenced by changed Runtime/binding scope. */
|
|
191
|
+
export declare const NATIVE_SESSION_LAUNCH_ACTION_STALE_CODE = "native_session_launch_action_stale";
|
|
192
|
+
/** Deliberately expose only this deterministic replay fence, never process detail. */
|
|
193
|
+
export declare function nativeSessionLaunchErrorCode(error: unknown): typeof NATIVE_SESSION_LAUNCH_ACTION_STALE_CODE | undefined;
|
|
194
|
+
/** Never serialize this server-owned executable path to the browser. */
|
|
195
|
+
export interface NativeProducerIdentity {
|
|
196
|
+
readonly executable: string;
|
|
197
|
+
readonly identity: string;
|
|
198
|
+
}
|
|
199
|
+
export interface NativeProducerPreflightResult {
|
|
200
|
+
readonly available: boolean;
|
|
201
|
+
readonly category?: typeof NATIVE_PRODUCER_CATEGORY;
|
|
202
|
+
/** Server-only resolved executable and content identity for the eventual launch. */
|
|
203
|
+
readonly producer?: NativeProducerIdentity;
|
|
204
|
+
/** Server-only: fixed fields plus a content digest; never a command path or process output. */
|
|
205
|
+
readonly diagnostic: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Exercises the exact, file-only native dispatch boundary against the
|
|
209
|
+
* configured executable. No model, vendor CLI, project workspace, or real
|
|
210
|
+
* credential is involved. The emitted launch spec is parsed by the same
|
|
211
|
+
* validator used just before a PTY starts.
|
|
212
|
+
*/
|
|
213
|
+
export declare function probeNativeSessionProducer(input: {
|
|
214
|
+
readonly warbleBin: string;
|
|
215
|
+
readonly irPaths: Readonly<Record<NativePurpose, string | undefined>>;
|
|
216
|
+
readonly wrenShim?: string;
|
|
217
|
+
}): Promise<NativeProducerPreflightResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Strict parser for the public v2/v4 producer contracts. V4 deliberately
|
|
220
|
+
* omits the host-issued scope; Setup exposes only its separately authorized
|
|
221
|
+
* bootstrap root, which is revalidated against the durable host configuration.
|
|
222
|
+
*/
|
|
223
|
+
export declare function readNativeLaunchSpec(cwd: string, purpose: NativePurpose, vendor: NativeVendor, scopeId: string, binding?: EnrichmentBinding, mcp?: NativeMcpDescriptor, materializationState?: NativeSessionStateBase, authorizedWorkspace?: string, providerLaunch?: NativeProviderLaunch): InteractiveLaunchSpec;
|
|
224
|
+
/**
|
|
225
|
+
* Materializes only host-owned, short-lived producer inputs. The scope and
|
|
226
|
+
* MCP descriptor deliberately stay in separate exclusive files because the
|
|
227
|
+
* public Warble v4 contract parses them through distinct flags and keeps the
|
|
228
|
+
* credential out of the scope schema and every argv value.
|
|
229
|
+
*/
|
|
230
|
+
export declare function dispatchNativeArtifacts(input: NativeDispatchInput): Promise<void>;
|
|
231
|
+
export declare class NativeSessionService {
|
|
232
|
+
private readonly options;
|
|
233
|
+
private readonly sessions;
|
|
234
|
+
private readonly leaseTimers;
|
|
235
|
+
/** Open/reconnect coalescing only lasts while a matching launch is in flight. */
|
|
236
|
+
private readonly launches;
|
|
237
|
+
/** Bounded post-settlement delivery replay, fenced to the captured server scope. */
|
|
238
|
+
private readonly startSeparateReplays;
|
|
239
|
+
/** In-process duplicate delivery fence for one durable provider-resume action. */
|
|
240
|
+
private readonly resumeLaunches;
|
|
241
|
+
private readonly artifactCredentials;
|
|
242
|
+
/** Kept only while the owning BFF and PTY remain live; never reconstructed from SQLite. */
|
|
243
|
+
private readonly recoveryCapabilities;
|
|
244
|
+
private readonly idleTtlMs;
|
|
245
|
+
private readonly startSeparateReplayTtlMs;
|
|
246
|
+
private readonly startSeparateReplayLimit;
|
|
247
|
+
private fixtureMaterializationState;
|
|
248
|
+
constructor(options: NativeSessionServiceOptions);
|
|
249
|
+
/** Existing injected producer seams are test-only and preserve old unit fixtures. */
|
|
250
|
+
private legacyFixtureMode;
|
|
251
|
+
/**
|
|
252
|
+
* Production must inject the DB-derived base at BFF startup. Existing unit
|
|
253
|
+
* seams have no BFF database path, so give only those injected producers an
|
|
254
|
+
* external throwaway state root; browser/API routes can never take this path.
|
|
255
|
+
*/
|
|
256
|
+
private materializationState;
|
|
257
|
+
/**
|
|
258
|
+
* Test-injected producers retain their historical seam. Production always
|
|
259
|
+
* invokes the actual configured executable and logs only the redacted,
|
|
260
|
+
* content-addressed diagnostic; the browser never receives it.
|
|
261
|
+
*/
|
|
262
|
+
private productionProducerPreflight;
|
|
263
|
+
/**
|
|
264
|
+
* SQLite is the durable source of truth, but a native PTY and its attach
|
|
265
|
+
* capability are deliberately process-local. A BFF restart (or a lease
|
|
266
|
+
* expiry racing a browser reconnect) can therefore leave an old durable
|
|
267
|
+
* `detached` row behind after its process-local terminal is gone. Reconcile
|
|
268
|
+
* that impossible "live" projection at every browser-visible read instead
|
|
269
|
+
* of letting the client repeatedly open a WebSocket to a missing PTY.
|
|
270
|
+
*/
|
|
271
|
+
list(): NativeSessionRow[];
|
|
272
|
+
get(id: string): NativeSessionRow | undefined;
|
|
273
|
+
runtime(id: string): InteractiveTerminalSession | undefined;
|
|
274
|
+
recovery(id: string): NativeSetupRecoveryRow | undefined;
|
|
275
|
+
private reconcileMissingTerminal;
|
|
276
|
+
/** A legacy persisted Runtime must be repaired before it can authorize a PTY. */
|
|
277
|
+
private assertRuntimeDispatchable;
|
|
278
|
+
/**
|
|
279
|
+
* Reopen only a still-live session in the exact server-owned scope. In
|
|
280
|
+
* particular, a setup session never inherits the active project binding,
|
|
281
|
+
* while a bound-purpose session cannot cross a generation or revision.
|
|
282
|
+
*/
|
|
283
|
+
openOrCreate(input: {
|
|
284
|
+
purpose: NativePurpose;
|
|
285
|
+
vendor?: NativeVendor;
|
|
286
|
+
}): Promise<NativeSessionLaunch>;
|
|
287
|
+
/** Opens the exact row selected by the browser after revalidating its scope. */
|
|
288
|
+
openExisting(input: {
|
|
289
|
+
purpose: NativePurpose;
|
|
290
|
+
id: string;
|
|
291
|
+
vendor?: NativeVendor;
|
|
292
|
+
}): Promise<NativeSessionLaunch>;
|
|
293
|
+
/**
|
|
294
|
+
* Starts a separate TUI even when a matching session is live. The caller's
|
|
295
|
+
* action id is intentionally part of the single-flight key: retries of one
|
|
296
|
+
* click coalesce, while a later intentional launch receives new durable and
|
|
297
|
+
* browser-scoped authority.
|
|
298
|
+
*/
|
|
299
|
+
startSeparate(input: {
|
|
300
|
+
purpose: NativePurpose;
|
|
301
|
+
idempotencyKey: string;
|
|
302
|
+
vendor?: NativeVendor;
|
|
303
|
+
}): Promise<NativeSessionLaunch>;
|
|
304
|
+
/**
|
|
305
|
+
* Continues only a sealed Claude conversation. This creates a new durable
|
|
306
|
+
* process row and materialization root; it never reattaches or relabels a
|
|
307
|
+
* fresh conversation as a resume.
|
|
308
|
+
*/
|
|
309
|
+
resume(input: {
|
|
310
|
+
id: string;
|
|
311
|
+
idempotencyKey: string;
|
|
312
|
+
}): Promise<NativeSessionLaunch>;
|
|
313
|
+
/** Browser-visible resume state uses the same current-scope fence as launch, plus *why* when it fails. */
|
|
314
|
+
resumeAvailability(row: NativeSessionRow): NativeSessionResumeAvailability;
|
|
315
|
+
/** Thin boolean projection kept for callers that only need a yes/no. */
|
|
316
|
+
resumeAvailable(row: NativeSessionRow): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Codex exposes the current thread UUID to hooks. Warble's isolated hook writes
|
|
319
|
+
* only that UUID under this session's BFF-owned materialization. The BFF reads
|
|
320
|
+
* no global Codex state and persists only a provider-bound encrypted envelope.
|
|
321
|
+
*/
|
|
322
|
+
private captureCodexResumeHandle;
|
|
323
|
+
private resumeScope;
|
|
324
|
+
private resumeWorkspaceAvailable;
|
|
325
|
+
private resumeReserved;
|
|
326
|
+
private recoverReservedResume;
|
|
327
|
+
private failReservedResume;
|
|
328
|
+
private matchesOpenScope;
|
|
329
|
+
/**
|
|
330
|
+
* A start-separate action is browser-scoped by its unguessable UUID. This
|
|
331
|
+
* BFF has no user principal beyond its local browser capability boundary, so
|
|
332
|
+
* its captured Runtime/binding scope is also the authorization fence.
|
|
333
|
+
*/
|
|
334
|
+
private replayStartSeparate;
|
|
335
|
+
private replayIsUsable;
|
|
336
|
+
private trimStartSeparateReplays;
|
|
337
|
+
private clearStartSeparateReplaysForSession;
|
|
338
|
+
private singleFlight;
|
|
339
|
+
readiness(): Promise<NativeSessionReadiness>;
|
|
340
|
+
create(input: {
|
|
341
|
+
purpose: NativePurpose;
|
|
342
|
+
vendor?: NativeVendor;
|
|
343
|
+
}, binding?: EnrichmentBinding | undefined, capturedRuntime?: NativeRuntimeBinding, resumed?: {
|
|
344
|
+
readonly row: NativeSessionRow;
|
|
345
|
+
readonly handle: string;
|
|
346
|
+
}): Promise<NativeSessionLaunch>;
|
|
347
|
+
attach(id: string, capability: string): InteractiveTerminalSession | undefined;
|
|
348
|
+
detach(id: string): void;
|
|
349
|
+
stop(id: string, capability: string): boolean;
|
|
350
|
+
private revokeCapabilities;
|
|
351
|
+
/** Called after the store's atomic runtime switch fence has committed. */
|
|
352
|
+
revokeRuntimeCapabilities(ids: readonly string[]): void;
|
|
353
|
+
/** Called after the store advances the bound-project generation. */
|
|
354
|
+
revokeBindingCapabilities(ids: readonly string[]): void;
|
|
355
|
+
/**
|
|
356
|
+
* Records only the producer's closed redacted report. Completion remains a
|
|
357
|
+
* host decision supplied by the canonical-artifact validator at the route.
|
|
358
|
+
*/
|
|
359
|
+
reportSetupRecovery(sessionId: string, value: unknown, completionValidated: boolean): NativeSetupRecoveryRow;
|
|
360
|
+
/**
|
|
361
|
+
* Recovery never resumes a process-owned PTY. Once a terminal session has
|
|
362
|
+
* ended/interrupted, a fenced action creates a fresh Setup session and its
|
|
363
|
+
* new terminal/MCP/recovery capabilities. Live terminals must be handled in
|
|
364
|
+
* their owning browser tab and are rejected here.
|
|
365
|
+
*/
|
|
366
|
+
actOnSetupRecovery(input: {
|
|
367
|
+
id: string;
|
|
368
|
+
capability: string;
|
|
369
|
+
expectedVersion: number;
|
|
370
|
+
action: "retry" | "continue" | "stop";
|
|
371
|
+
}): Promise<NativeSessionLaunch | undefined>;
|
|
372
|
+
private clearLease;
|
|
373
|
+
private armLease;
|
|
374
|
+
}
|