@wrenai/genbi 0.0.4 → 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.
- package/README.md +65 -3
- package/dist/assets/{echarts-LTFC-ysd.js → echarts-DYM4hjvk.js} +2 -2
- package/dist/assets/index-A_Wrq7Ey.css +1 -0
- package/dist/assets/{index-Bo--QMUN.js → index-DsH129tV.js} +18 -17
- package/dist/index.html +2 -2
- package/dist-server/harness/bundle/schema.d.ts +38 -0
- package/dist-server/harness/bundle/schema.js +18 -10
- package/dist-server/harness/bundle/version.js +1 -1
- package/dist-server/harness/cli-args.d.ts +10 -2
- package/dist-server/harness/cli-args.js +24 -8
- package/dist-server/harness/cli.js +75 -9
- package/dist-server/harness/compile/cache.js +4 -4
- package/dist-server/harness/compile/compose-profile.d.ts +51 -14
- package/dist-server/harness/compile/compose-profile.js +85 -19
- package/dist-server/harness/compile/context-loader.d.ts +56 -0
- package/dist-server/harness/compile/context-loader.js +237 -0
- package/dist-server/harness/compile/errors.d.ts +19 -0
- package/dist-server/harness/compile/errors.js +35 -0
- package/dist-server/harness/compile/index.d.ts +4 -3
- package/dist-server/harness/compile/index.js +4 -3
- package/dist-server/harness/compile/pipeline.d.ts +15 -7
- package/dist-server/harness/compile/pipeline.js +62 -14
- package/dist-server/harness/compile/resolve-binary.d.ts +2 -2
- package/dist-server/harness/compile/resolve-binary.js +3 -3
- package/dist-server/harness/compile/types.d.ts +29 -0
- package/dist-server/harness/compile/warble-identity.d.ts +11 -0
- package/dist-server/harness/compile/warble-identity.js +13 -0
- package/dist-server/harness/components/ai-step.d.ts +4 -0
- package/dist-server/harness/components/ai-step.js +40 -0
- package/dist-server/harness/components/broker.d.ts +60 -0
- package/dist-server/harness/components/broker.js +117 -0
- package/dist-server/harness/components/capability-card.d.ts +98 -0
- package/dist-server/harness/components/capability-card.js +169 -0
- package/dist-server/harness/components/context.d.ts +2 -0
- package/dist-server/harness/components/context.js +30 -0
- package/dist-server/harness/components/display.d.ts +6 -0
- package/dist-server/harness/components/display.js +29 -0
- package/dist-server/harness/components/egress-judge.d.ts +12 -0
- package/dist-server/harness/components/egress-judge.js +27 -0
- package/dist-server/harness/components/egress.d.ts +142 -0
- package/dist-server/harness/components/egress.js +469 -0
- package/dist-server/harness/components/in-process.d.ts +7 -0
- package/dist-server/harness/components/in-process.js +245 -0
- package/dist-server/harness/components/normalize.d.ts +35 -0
- package/dist-server/harness/components/normalize.js +245 -0
- package/dist-server/harness/components/plan.d.ts +31 -0
- package/dist-server/harness/components/plan.js +184 -0
- package/dist-server/harness/components/report.d.ts +207 -0
- package/dist-server/harness/components/report.js +309 -0
- package/dist-server/harness/components/runner.d.ts +193 -0
- package/dist-server/harness/components/runner.js +492 -0
- package/dist-server/harness/components/semantic-guards.d.ts +20 -0
- package/dist-server/harness/components/semantic-guards.js +42 -0
- package/dist-server/harness/components/terminal-json.d.ts +18 -0
- package/dist-server/harness/components/terminal-json.js +82 -0
- package/dist-server/harness/components/usage.d.ts +14 -0
- package/dist-server/harness/components/usage.js +19 -0
- package/dist-server/harness/components/wren-access.d.ts +29 -0
- package/dist-server/harness/components/wren-access.js +233 -0
- package/dist-server/harness/components/zone-dry-run.d.ts +43 -0
- package/dist-server/harness/components/zone-dry-run.js +107 -0
- package/dist-server/harness/components/zone-gate.d.ts +76 -0
- package/dist-server/harness/components/zone-gate.js +144 -0
- package/dist-server/harness/events/index.d.ts +1 -1
- package/dist-server/harness/events/types.d.ts +52 -0
- package/dist-server/harness/index.d.ts +9 -2
- package/dist-server/harness/index.js +5 -1
- package/dist-server/harness/loop/executor.d.ts +1 -0
- package/dist-server/harness/loop/executor.js +37 -15
- package/dist-server/harness/npm-package-resolve.d.ts +2 -0
- package/dist-server/harness/npm-package-resolve.js +16 -4
- package/dist-server/harness/providers/adapters/openai-compatible.d.ts +13 -0
- package/dist-server/harness/providers/adapters/openai-compatible.js +17 -0
- package/dist-server/harness/providers/adapters/openai.d.ts +7 -0
- package/dist-server/harness/providers/adapters/openai.js +6 -0
- package/dist-server/harness/providers/adapters/pi-ai.d.ts +48 -0
- package/dist-server/harness/providers/adapters/pi-ai.js +518 -0
- package/dist-server/harness/providers/binding.d.ts +45 -4
- package/dist-server/harness/providers/binding.js +44 -8
- package/dist-server/harness/providers/index.d.ts +9 -3
- package/dist-server/harness/providers/index.js +10 -3
- package/dist-server/harness/providers/zone.d.ts +96 -0
- package/dist-server/harness/providers/zone.js +112 -0
- package/dist-server/harness/render/answering-query.d.ts +29 -0
- package/dist-server/harness/render/answering-query.js +62 -0
- package/dist-server/harness/render/envelope.d.ts +6 -0
- package/dist-server/harness/render/envelope.js +10 -3
- package/dist-server/harness/route/adapter-spec.d.ts +8 -9
- package/dist-server/harness/route/adapter-spec.js +13 -14
- package/dist-server/harness/route/codex-ask-events.js +2 -1
- package/dist-server/harness/route/codex-ask.d.ts +4 -0
- package/dist-server/harness/route/codex-ask.js +43 -45
- package/dist-server/harness/route/codex-local-manifest.d.ts +9 -1
- package/dist-server/harness/route/codex-local-manifest.js +96 -15
- package/dist-server/harness/route/describe.js +45 -6
- package/dist-server/harness/route/dispatched.d.ts +20 -0
- package/dist-server/harness/route/dispatched.js +122 -24
- package/dist-server/harness/route/host-query.d.ts +93 -0
- package/dist-server/harness/route/host-query.js +257 -0
- package/dist-server/harness/route/in-process.d.ts +22 -1
- package/dist-server/harness/route/in-process.js +54 -4
- package/dist-server/harness/route/route.js +8 -2
- package/dist-server/harness/route/types.d.ts +47 -1
- package/dist-server/harness/route/wren-host-proxy.d.ts +33 -0
- package/dist-server/harness/route/wren-host-proxy.js +228 -0
- package/dist-server/harness/session/run.js +30 -10
- package/dist-server/harness/setup/runner.d.ts +17 -3
- package/dist-server/harness/setup/runner.js +272 -89
- package/dist-server/harness/setup/yaml-scalar.d.ts +23 -0
- package/dist-server/harness/setup/yaml-scalar.js +62 -0
- package/dist-server/harness/tools/setup-native.d.ts +7 -0
- package/dist-server/harness/tools/setup-native.js +7 -4
- package/dist-server/server/adopt.js +1 -17
- package/dist-server/server/app.d.ts +1 -0
- package/dist-server/server/app.js +175 -17
- package/dist-server/server/auth-choice.d.ts +13 -1
- package/dist-server/server/auth-choice.js +66 -1
- package/dist-server/server/bin.js +185 -25
- package/dist-server/server/codex-native-session.d.ts +25 -0
- package/dist-server/server/codex-native-session.js +1 -0
- package/dist-server/server/codex-runtime-composition.d.ts +34 -0
- package/dist-server/server/codex-runtime-composition.js +250 -0
- package/dist-server/server/codex-structured-ask.d.ts +23 -0
- package/dist-server/server/codex-structured-ask.js +102 -0
- package/dist-server/server/conn-config.js +4 -16
- package/dist-server/server/conversation-socket.d.ts +16 -0
- package/dist-server/server/conversation-socket.js +65 -0
- package/dist-server/server/db.d.ts +46 -0
- package/dist-server/server/db.js +88 -9
- package/dist-server/server/env-detect.d.ts +6 -0
- package/dist-server/server/env-detect.js +7 -0
- package/dist-server/server/fold.d.ts +23 -4
- package/dist-server/server/fold.js +42 -5
- package/dist-server/server/harness.d.ts +2 -2
- package/dist-server/server/harness.js +33 -7
- package/dist-server/server/host-evidence-grounding.d.ts +21 -0
- package/dist-server/server/host-evidence-grounding.js +93 -0
- package/dist-server/server/interactive-terminal.d.ts +10 -6
- package/dist-server/server/interactive-terminal.js +33 -8
- package/dist-server/server/managed-wren-runtime.d.ts +116 -0
- package/dist-server/server/managed-wren-runtime.js +670 -0
- package/dist-server/server/native-artifacts.d.ts +112 -7
- package/dist-server/server/native-artifacts.js +194 -14
- package/dist-server/server/native-component-context.d.ts +19 -0
- package/dist-server/server/native-component-context.js +76 -0
- package/dist-server/server/native-component-preparation.d.ts +20 -0
- package/dist-server/server/native-component-preparation.js +129 -0
- package/dist-server/server/native-component-runtime.d.ts +36 -0
- package/dist-server/server/native-component-runtime.js +92 -0
- package/dist-server/server/native-components.d.ts +84 -0
- package/dist-server/server/native-components.js +160 -0
- package/dist-server/server/native-dispatch-process.d.ts +8 -0
- package/dist-server/server/native-dispatch-process.js +65 -0
- package/dist-server/server/native-runtime-spec.d.ts +89 -0
- package/dist-server/server/native-runtime-spec.js +169 -0
- package/dist-server/server/native-sessions.d.ts +172 -19
- package/dist-server/server/native-sessions.js +839 -244
- package/dist-server/server/native-shutdown.d.ts +6 -0
- package/dist-server/server/native-shutdown.js +28 -0
- package/dist-server/server/native-wren-home.d.ts +18 -0
- package/dist-server/server/native-wren-home.js +262 -0
- package/dist-server/server/node-pty-host.d.ts +2 -1
- package/dist-server/server/node-pty-host.js +3 -2
- package/dist-server/server/profile-registry.d.ts +139 -0
- package/dist-server/server/profile-registry.js +620 -0
- package/dist-server/server/runtime-binding.d.ts +4 -1
- package/dist-server/server/runtime-binding.js +50 -2
- package/dist-server/server/runtime-host/claude-component-step.d.ts +25 -0
- package/dist-server/server/runtime-host/claude-component-step.js +186 -0
- package/dist-server/server/runtime-host/codex-app-server.d.ts +75 -0
- package/dist-server/server/runtime-host/codex-app-server.js +239 -0
- package/dist-server/server/runtime-host/codex-compatibility.d.ts +110 -0
- package/dist-server/server/runtime-host/codex-compatibility.js +162 -0
- package/dist-server/server/runtime-host/codex-component-step.d.ts +19 -0
- package/dist-server/server/runtime-host/codex-component-step.js +308 -0
- package/dist-server/server/runtime-host/codex-conversation.d.ts +109 -0
- package/dist-server/server/runtime-host/codex-conversation.js +295 -0
- package/dist-server/server/runtime-host/codex-direct-tools.d.ts +23 -0
- package/dist-server/server/runtime-host/codex-direct-tools.js +59 -0
- package/dist-server/server/runtime-host/codex-events.d.ts +647 -0
- package/dist-server/server/runtime-host/codex-events.js +66 -0
- package/dist-server/server/runtime-host/codex-policy.d.ts +16 -0
- package/dist-server/server/runtime-host/codex-policy.js +151 -0
- package/dist-server/server/runtime-host/codex-process.d.ts +8 -0
- package/dist-server/server/runtime-host/codex-process.js +96 -0
- package/dist-server/server/runtime-host/codex-rpc.d.ts +47 -0
- package/dist-server/server/runtime-host/codex-rpc.js +182 -0
- package/dist-server/server/runtime-host/codex-session.d.ts +74 -0
- package/dist-server/server/runtime-host/codex-session.js +492 -0
- package/dist-server/server/runtime-host/codex-terminal-protocol.d.ts +35 -0
- package/dist-server/server/runtime-host/codex-terminal-protocol.js +243 -0
- package/dist-server/server/runtime-host/codex-terminal.d.ts +16 -0
- package/dist-server/server/runtime-host/codex-terminal.js +120 -0
- package/dist-server/server/runtime-host/index.d.ts +5 -0
- package/dist-server/server/runtime-host/index.js +3 -0
- package/dist-server/server/runtime-host/local.d.ts +29 -0
- package/dist-server/server/runtime-host/local.js +90 -0
- package/dist-server/server/runtime-host/policy.d.ts +8 -0
- package/dist-server/server/runtime-host/policy.js +78 -0
- package/dist-server/server/runtime-host/types.d.ts +52 -0
- package/dist-server/server/runtime-host/types.js +62 -0
- package/dist-server/server/structured-query-evidence.d.ts +7 -0
- package/dist-server/server/structured-query-evidence.js +47 -0
- package/dist-server/server/structured-runtime.d.ts +52 -0
- package/dist-server/server/structured-runtime.js +130 -0
- package/dist-server/server/structured-scope.d.ts +4 -0
- package/dist-server/server/structured-scope.js +12 -0
- package/dist-server/server/turn.d.ts +6 -1
- package/dist-server/server/turn.js +86 -26
- package/dist-server/server/wire-types.d.ts +67 -3
- package/dist-server/server/wren-profiles.js +1 -1
- package/managed-wren/README.md +60 -0
- package/managed-wren/dependency-wheels.json +282 -0
- package/managed-wren/manifest.json +373 -0
- package/managed-wren/release-inputs.json +45 -0
- package/managed-wren/runtime-tree.cjs +115 -0
- package/managed-wren/source-inputs.json +40 -0
- package/package.json +15 -6
- package/profiles/genbi-default/context/binding.yml +17 -7
- package/profiles/genbi-default/context/context.json +146 -0
- package/profiles/genbi-default/ir.golden.json +39 -43
- package/profiles/genbi-default/profile.yml +31 -0
- package/profiles/genbi-enrich-context/context/binding.yml +14 -3
- package/profiles/genbi-enrich-context/context/context.json +146 -0
- package/profiles/genbi-enrich-context/ir.golden.json +4 -5
- package/profiles/genbi-monitor/context/binding.yml +13 -5
- package/profiles/genbi-monitor/context/context.json +146 -0
- package/profiles/genbi-monitor/ir.golden.json +13 -7
- package/profiles/genbi-report/context/binding.yml +19 -0
- package/profiles/genbi-report/context/context.json +223 -0
- package/profiles/genbi-report/ir.golden.json +328 -0
- package/profiles/genbi-report/profile.yml +38 -0
- package/profiles/genbi-setup/ir.golden.json +3 -1
- package/dist/assets/index-Xs4q7pNo.css +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { EnrichmentBinding } from "./enrichment.js";
|
|
2
2
|
export { InteractiveLaunchError, legacyInteractiveWorkspace } from "./native-session-workspace.js";
|
|
3
3
|
import type { NativeSessionStateBase } from "./native-session-workspace.js";
|
|
4
|
+
import type { NativeChildEnvironment, NativeExecutableIdentity } from "./native-runtime-spec.js";
|
|
4
5
|
export declare const INTERACTIVE_TARGETS: readonly ["claude-code:interactive", "codex:interactive"];
|
|
5
6
|
export type InteractiveTarget = (typeof INTERACTIVE_TARGETS)[number];
|
|
6
7
|
export interface InteractiveLaunchSpec {
|
|
7
|
-
readonly version: "1" | "2" | "3" | "4";
|
|
8
|
+
readonly version: "1" | "2" | "3" | "4" | "5";
|
|
8
9
|
readonly target: InteractiveTarget;
|
|
9
10
|
readonly executable: "claude" | "codex";
|
|
10
11
|
readonly argv: readonly string[];
|
|
@@ -35,7 +36,7 @@ export interface PtyFactory {
|
|
|
35
36
|
cwd: string;
|
|
36
37
|
cols: number;
|
|
37
38
|
rows: number;
|
|
38
|
-
env?:
|
|
39
|
+
env?: NativeChildEnvironment;
|
|
39
40
|
}): PtyProcess;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
@@ -48,12 +49,12 @@ export interface PtyFactory {
|
|
|
48
49
|
* advertised xterm ANSI palette silently optional and allow a caller to
|
|
49
50
|
* weaken the native-terminal contract.
|
|
50
51
|
*/
|
|
51
|
-
export declare function nativeTerminalEnvironment(base?: NodeJS.ProcessEnv):
|
|
52
|
+
export declare function nativeTerminalEnvironment(base?: NodeJS.ProcessEnv | NativeChildEnvironment): NativeChildEnvironment;
|
|
52
53
|
/**
|
|
53
54
|
* Mirrors the PATH lookup a shell-free PTY launch relies on. A shell alias or
|
|
54
55
|
* function is deliberately not accepted: node-pty cannot execute either.
|
|
55
56
|
*/
|
|
56
|
-
export declare function interactiveExecutableAvailable(executable: "claude" | "codex", pathValue?: string
|
|
57
|
+
export declare function interactiveExecutableAvailable(executable: "claude" | "codex", pathValue?: string): boolean;
|
|
57
58
|
export interface InteractiveTerminalSession {
|
|
58
59
|
readonly id: string;
|
|
59
60
|
readonly capability: string;
|
|
@@ -115,10 +116,11 @@ export declare function launchFallbackCommand(spec: Pick<InteractiveLaunchSpec,
|
|
|
115
116
|
/** Parse exactly the public v1 producer contract; unknown fields fail closed. */
|
|
116
117
|
export declare function readInteractiveLaunchSpec(boundProject: string, requestedTarget: InteractiveTarget, materializationRoot?: string, materializationState?: NativeSessionStateBase): InteractiveLaunchSpec;
|
|
117
118
|
export declare function dispatchInteractiveArtifacts(input: {
|
|
118
|
-
readonly
|
|
119
|
+
readonly producer: NativeExecutableIdentity;
|
|
119
120
|
readonly irPath: string;
|
|
120
121
|
readonly target: InteractiveTarget;
|
|
121
122
|
readonly cwd: string;
|
|
123
|
+
readonly env: NativeChildEnvironment;
|
|
122
124
|
readonly boundProject?: string;
|
|
123
125
|
readonly materializationState?: NativeSessionStateBase;
|
|
124
126
|
}): Promise<void>;
|
|
@@ -134,6 +136,7 @@ export interface InteractivePreparationInput {
|
|
|
134
136
|
export interface InteractivePreparationDeps {
|
|
135
137
|
readonly getCurrentBinding: () => EnrichmentBinding | undefined;
|
|
136
138
|
readonly executableAvailable?: (executable: "claude" | "codex") => boolean;
|
|
139
|
+
readonly resolveExecutable?: (executable: "claude" | "codex") => NativeExecutableIdentity | undefined;
|
|
137
140
|
}
|
|
138
141
|
/**
|
|
139
142
|
* Materializes and validates the clipboard/launch contract without loading a
|
|
@@ -158,6 +161,7 @@ export declare function getInteractiveTerminalReadiness(input: {
|
|
|
158
161
|
readonly getCurrentBinding: () => EnrichmentBinding | undefined;
|
|
159
162
|
readonly terminalHostAvailable: () => Promise<boolean>;
|
|
160
163
|
readonly executableAvailable?: (executable: "claude" | "codex") => boolean;
|
|
164
|
+
readonly resolveExecutable?: (executable: "claude" | "codex") => NativeExecutableIdentity | undefined;
|
|
161
165
|
/** BFF-owned base; validation is non-mutating and never reads the project root. */
|
|
162
166
|
readonly materializationState?: NativeSessionStateBase;
|
|
163
167
|
}): Promise<Record<InteractiveTarget, InteractiveTargetReadiness>>;
|
|
@@ -168,7 +172,7 @@ export declare class InteractiveTerminalManager {
|
|
|
168
172
|
start(spec: InteractiveLaunchSpec, identity?: {
|
|
169
173
|
readonly id: string;
|
|
170
174
|
readonly capability: string;
|
|
171
|
-
}, env?: NodeJS.ProcessEnv, leasePolicy?: InteractiveTerminalLeasePolicy): InteractiveTerminalSession;
|
|
175
|
+
}, env?: NodeJS.ProcessEnv | NativeChildEnvironment, leasePolicy?: InteractiveTerminalLeasePolicy): InteractiveTerminalSession;
|
|
172
176
|
get(id: string): InteractiveTerminalSession | undefined;
|
|
173
177
|
/** Runtime changes revoke every non-durable compatibility terminal immediately. */
|
|
174
178
|
closeAll(): void;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { existsSync, realpathSync, readFileSync, statSync } from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
|
+
import os from "node:os";
|
|
10
11
|
import { spawn as spawnProcess } from "node:child_process";
|
|
11
12
|
export { InteractiveLaunchError, legacyInteractiveWorkspace } from "./native-session-workspace.js";
|
|
12
13
|
import { InteractiveLaunchError, nativeSessionStateBaseAvailable, validateLegacyInteractiveWorkspace } from "./native-session-workspace.js";
|
|
14
|
+
import { assertNativeExecutableIdentity, buildNativeChildEnvironment, nativeProcessEnvironment } from "./native-runtime-spec.js";
|
|
13
15
|
export const INTERACTIVE_TARGETS = ["claude-code:interactive", "codex:interactive"];
|
|
14
16
|
const EXECUTABLE = {
|
|
15
17
|
"claude-code:interactive": "claude",
|
|
@@ -25,15 +27,33 @@ const EXECUTABLE = {
|
|
|
25
27
|
* advertised xterm ANSI palette silently optional and allow a caller to
|
|
26
28
|
* weaken the native-terminal contract.
|
|
27
29
|
*/
|
|
28
|
-
export function nativeTerminalEnvironment(base
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
export function nativeTerminalEnvironment(base) {
|
|
31
|
+
const environment = base ?? buildNativeChildEnvironment({
|
|
32
|
+
toolDirectories: [path.dirname(process.execPath)],
|
|
33
|
+
home: os.homedir(),
|
|
34
|
+
});
|
|
35
|
+
const pathValue = environment.PATH ?? path.dirname(process.execPath);
|
|
36
|
+
const home = environment.HOME ?? os.homedir();
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
PATH: pathValue,
|
|
39
|
+
HOME: home,
|
|
40
|
+
...(process.platform === "darwin" ? { USER: os.userInfo().username, LOGNAME: os.userInfo().username } : {}),
|
|
41
|
+
TERM: "xterm-256color",
|
|
42
|
+
COLORTERM: "truecolor",
|
|
43
|
+
...(environment.WREN_PROJECT_HOME ? { WREN_PROJECT_HOME: environment.WREN_PROJECT_HOME } : {}),
|
|
44
|
+
...(environment.WREN_HOME ? { WREN_HOME: environment.WREN_HOME } : {}),
|
|
45
|
+
...(environment.CODEX_HOME ? { CODEX_HOME: environment.CODEX_HOME } : {}),
|
|
46
|
+
...(environment.WARBLE_MCP_CONNECTION_CREDENTIAL ? { WARBLE_MCP_CONNECTION_CREDENTIAL: environment.WARBLE_MCP_CONNECTION_CREDENTIAL } : {}),
|
|
47
|
+
...(environment.WARBLE_SETUP_BOOTSTRAP_ROOT ? { WARBLE_SETUP_BOOTSTRAP_ROOT: environment.WARBLE_SETUP_BOOTSTRAP_ROOT } : {}),
|
|
48
|
+
...(environment.PYTHONNOUSERSITE ? { PYTHONNOUSERSITE: "1" } : {}),
|
|
49
|
+
...(environment.PYTHONUTF8 ? { PYTHONUTF8: "1" } : {}),
|
|
50
|
+
});
|
|
31
51
|
}
|
|
32
52
|
/**
|
|
33
53
|
* Mirrors the PATH lookup a shell-free PTY launch relies on. A shell alias or
|
|
34
54
|
* function is deliberately not accepted: node-pty cannot execute either.
|
|
35
55
|
*/
|
|
36
|
-
export function interactiveExecutableAvailable(executable, pathValue
|
|
56
|
+
export function interactiveExecutableAvailable(executable, pathValue) {
|
|
37
57
|
if (!pathValue)
|
|
38
58
|
return false;
|
|
39
59
|
return pathValue.split(path.delimiter).some((directory) => {
|
|
@@ -131,8 +151,9 @@ export async function dispatchInteractiveArtifacts(input) {
|
|
|
131
151
|
throw new InteractiveLaunchError("interactive enrichment materialization failed");
|
|
132
152
|
if (input.boundProject && input.materializationState)
|
|
133
153
|
validateLegacyInteractiveWorkspace(input.materializationState, input.boundProject, input.cwd);
|
|
154
|
+
assertNativeExecutableIdentity(input.producer);
|
|
134
155
|
await new Promise((resolve, reject) => {
|
|
135
|
-
const child = spawnProcess(input.
|
|
156
|
+
const child = spawnProcess(input.producer.executable, ["dispatch", input.irPath, "--target", input.target, "--out", input.cwd], { cwd: input.cwd, env: nativeProcessEnvironment(input.env), shell: false, stdio: "ignore" });
|
|
136
157
|
child.once("error", () => reject(new InteractiveLaunchError("interactive enrichment materialization failed")));
|
|
137
158
|
child.once("exit", (code) => code === 0 ? resolve() : reject(new InteractiveLaunchError("interactive enrichment materialization failed")));
|
|
138
159
|
});
|
|
@@ -144,15 +165,19 @@ export async function dispatchInteractiveArtifacts(input) {
|
|
|
144
165
|
*/
|
|
145
166
|
export async function prepareInteractiveHandoff(input, deps) {
|
|
146
167
|
const executableAvailable = deps.executableAvailable ?? interactiveExecutableAvailable;
|
|
147
|
-
|
|
168
|
+
const executable = deps.resolveExecutable?.(EXECUTABLE[input.target]);
|
|
169
|
+
if (!(executable ?? executableAvailable(EXECUTABLE[input.target]))) {
|
|
148
170
|
throw new InteractiveLaunchError(`the ${EXECUTABLE[input.target]} interactive CLI is not available on this machine`);
|
|
149
171
|
}
|
|
172
|
+
if (executable)
|
|
173
|
+
assertNativeExecutableIdentity(executable);
|
|
150
174
|
await input.materialize();
|
|
151
175
|
const current = deps.getCurrentBinding();
|
|
152
176
|
if (!current || current.path !== input.binding.path || current.identity !== input.binding.identity || current.generation !== input.binding.generation || current.revision !== input.binding.revision) {
|
|
153
177
|
throw new InteractiveLaunchError("interactive enrichment is stale because the bound project changed");
|
|
154
178
|
}
|
|
155
|
-
const
|
|
179
|
+
const parsed = readInteractiveLaunchSpec(input.binding.path, input.target, input.artifactRoot, input.materializationState);
|
|
180
|
+
const spec = executable ? { ...parsed, hostExecutable: executable.executable } : parsed;
|
|
156
181
|
return { spec, handoff: { target: spec.target, fallbackCommand: launchFallbackCommand(spec) } };
|
|
157
182
|
}
|
|
158
183
|
/**
|
|
@@ -175,7 +200,7 @@ export async function getInteractiveTerminalReadiness(input) {
|
|
|
175
200
|
const executableAvailable = input.executableAvailable ?? interactiveExecutableAvailable;
|
|
176
201
|
const result = {};
|
|
177
202
|
for (const target of INTERACTIVE_TARGETS) {
|
|
178
|
-
if (!executableAvailable(EXECUTABLE[target])) {
|
|
203
|
+
if (!(input.resolveExecutable?.(EXECUTABLE[target]) ?? executableAvailable(EXECUTABLE[target]))) {
|
|
179
204
|
const reason = `the ${EXECUTABLE[target]} interactive CLI is not available on this machine`;
|
|
180
205
|
result[target] = { copyAvailable: false, embeddedTerminalAvailable: false, copyReason: reason, embeddedTerminalReason: reason };
|
|
181
206
|
continue;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { NativeWrenRuntime } from "./native-wren-runtime.js";
|
|
3
|
+
declare const managedWrenManifestSchema: z.ZodObject<{
|
|
4
|
+
schema: z.ZodLiteral<1>;
|
|
5
|
+
activation: z.ZodEnum<{
|
|
6
|
+
approved: "approved";
|
|
7
|
+
staged: "staged";
|
|
8
|
+
}>;
|
|
9
|
+
platform: z.ZodLiteral<"darwin-arm64">;
|
|
10
|
+
compatibility: z.ZodObject<{
|
|
11
|
+
genbi: z.ZodString;
|
|
12
|
+
profile: z.ZodLiteral<"genbi-native-v4">;
|
|
13
|
+
wren: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
python: z.ZodObject<{
|
|
16
|
+
implementation: z.ZodLiteral<"cpython">;
|
|
17
|
+
version: z.ZodString;
|
|
18
|
+
upstream: z.ZodObject<{
|
|
19
|
+
release: z.ZodString;
|
|
20
|
+
url: z.ZodString;
|
|
21
|
+
sha256: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
mirror: z.ZodObject<{
|
|
24
|
+
url: z.ZodString;
|
|
25
|
+
sha256: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
interpreterPath: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
wheels: z.ZodArray<z.ZodObject<{
|
|
30
|
+
distribution: z.ZodString;
|
|
31
|
+
version: z.ZodString;
|
|
32
|
+
filename: z.ZodString;
|
|
33
|
+
url: z.ZodString;
|
|
34
|
+
sourceUrl: z.ZodString;
|
|
35
|
+
sha256: z.ZodString;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
runtime: z.ZodObject<{
|
|
38
|
+
pythonArchivePath: z.ZodString;
|
|
39
|
+
venvInterpreterPath: z.ZodString;
|
|
40
|
+
launcherPath: z.ZodString;
|
|
41
|
+
module: z.ZodLiteral<"wren.cli:app">;
|
|
42
|
+
packagePath: z.ZodString;
|
|
43
|
+
sitePackagesPath: z.ZodString;
|
|
44
|
+
pythonTreeSha256: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"staged">]>;
|
|
45
|
+
packageTreeSha256: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"staged">]>;
|
|
46
|
+
sitePackagesTreeSha256: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"staged">]>;
|
|
47
|
+
closureSha256: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"staged">]>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
licenseApproval: z.ZodObject<{
|
|
50
|
+
state: z.ZodEnum<{
|
|
51
|
+
approved: "approved";
|
|
52
|
+
pending: "pending";
|
|
53
|
+
}>;
|
|
54
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
approvedManifest: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
url: z.ZodString;
|
|
58
|
+
sha256: z.ZodString;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type ManagedWrenManifest = Readonly<z.infer<typeof managedWrenManifestSchema>>;
|
|
62
|
+
export declare class ManagedWrenRuntimeError extends Error {
|
|
63
|
+
readonly code: ManagedWrenFailureCode;
|
|
64
|
+
constructor(code: ManagedWrenFailureCode, message?: ManagedWrenFailureCode);
|
|
65
|
+
}
|
|
66
|
+
export type ManagedWrenFailureCode = "codex_wren_manifest_missing" | "codex_wren_manifest_invalid" | "codex_wren_platform_unsupported" | "codex_wren_runtime_unprovisioned" | "codex_wren_provision_failed" | "codex_wren_interpreter_mismatch" | "codex_wren_launcher_mismatch" | "codex_wren_package_mismatch" | "codex_wren_closure_mismatch";
|
|
67
|
+
export interface ManagedWrenRuntimeRecord extends NativeWrenRuntime {
|
|
68
|
+
readonly manifest_digest: string;
|
|
69
|
+
readonly generation_root: string;
|
|
70
|
+
readonly closure_digest: string;
|
|
71
|
+
readonly package_digest: string;
|
|
72
|
+
}
|
|
73
|
+
export declare function defaultManagedWrenRoot(): string;
|
|
74
|
+
export declare function managedWrenManifestPath(root?: string): string;
|
|
75
|
+
export declare function readManagedWrenManifest(root?: string): ManagedWrenManifest;
|
|
76
|
+
export declare function manifestDigest(manifest: ManagedWrenManifest): string;
|
|
77
|
+
export declare const managedWrenTreeDigest: (root: string) => string;
|
|
78
|
+
/**
|
|
79
|
+
* Remove only records that were previously returned by this module and that
|
|
80
|
+
* the caller has established are neither active nor required for rollback.
|
|
81
|
+
*
|
|
82
|
+
* Generation selection belongs to the host/session lifecycle, not to a
|
|
83
|
+
* directory sweep: accepting arbitrary paths here would make cleanup an
|
|
84
|
+
* unsafe deletion primitive. A concurrent provisioner conservatively blocks
|
|
85
|
+
* cleanup altogether; it can retry after the writer releases its lock.
|
|
86
|
+
*/
|
|
87
|
+
export declare function cleanupManagedWrenGenerations(options: {
|
|
88
|
+
readonly runtimeRoot?: string;
|
|
89
|
+
readonly candidates: readonly ManagedWrenRuntimeRecord[];
|
|
90
|
+
readonly retainManifestDigests: readonly string[];
|
|
91
|
+
}): readonly string[];
|
|
92
|
+
/** Revalidate a record before every native Codex launch. */
|
|
93
|
+
export declare function resolveManagedWrenRuntime(options?: {
|
|
94
|
+
readonly packageRoot?: string;
|
|
95
|
+
readonly runtimeRoot?: string;
|
|
96
|
+
}): ManagedWrenRuntimeRecord;
|
|
97
|
+
/**
|
|
98
|
+
* Readiness is deliberately resolve-only: checking any RuntimeHost backend
|
|
99
|
+
* must neither create the GenBI runtime root nor fetch/install managed bytes.
|
|
100
|
+
* An explicit future first-use path may call the exported provisioner below.
|
|
101
|
+
*/
|
|
102
|
+
export declare function managedWrenReadinessFailure(options?: {
|
|
103
|
+
readonly packageRoot?: string;
|
|
104
|
+
readonly runtimeRoot?: string;
|
|
105
|
+
}): ManagedWrenFailureCode | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Provision is intentionally unavailable for a staged manifest. A release can
|
|
108
|
+
* only turn this on after the protected licence approval job writes an approved
|
|
109
|
+
* manifest with release-attested digests.
|
|
110
|
+
*/
|
|
111
|
+
export declare function provisionManagedWrenRuntime(options?: {
|
|
112
|
+
readonly packageRoot?: string;
|
|
113
|
+
readonly runtimeRoot?: string;
|
|
114
|
+
}): Promise<ManagedWrenRuntimeRecord>;
|
|
115
|
+
export declare function managedWrenClosureDigest(manifest: ManagedWrenManifest): string;
|
|
116
|
+
export {};
|