@zergai/ztc 0.26.2-dev.202611210149 → 0.26.4-dev.202611231953
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 +590 -28
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/zmux-linux-x64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/ztc-tui-linux-x64 +0 -0
- package/bin/zterm-darwin-arm64 +2 -2
- package/dist/App.js +18 -1
- package/dist/agent/agent.d.ts +25 -1
- package/dist/agent/agent.js +26 -1
- package/dist/agent/attached_images.d.ts +58 -0
- package/dist/agent/attached_images.js +145 -0
- package/dist/agent/backends/anthropic.d.ts +14 -0
- package/dist/agent/backends/anthropic.js +49 -2
- package/dist/agent/backends/codex_app_server.d.ts +3 -1
- package/dist/agent/backends/codex_app_server.js +9 -6
- package/dist/agent/backends/codex_auth.js +3 -0
- package/dist/agent/backends/gemini.js +3 -0
- package/dist/agent/backends/host_effort_policy.js +14 -2
- package/dist/agent/backends/http_error.d.ts +17 -0
- package/dist/agent/backends/http_error.js +50 -1
- package/dist/agent/backends/index.js +2 -1
- package/dist/agent/backends/model_redirect.d.ts +47 -0
- package/dist/agent/backends/model_redirect.js +97 -0
- package/dist/agent/backends/openai_compatible.js +5 -0
- package/dist/agent/backends/openai_responses.d.ts +9 -1
- package/dist/agent/backends/openai_responses.js +21 -12
- package/dist/agent/backends/prompt_cache.d.ts +8 -0
- package/dist/agent/backends/prompt_cache.js +10 -0
- package/dist/agent/backends/provider_ids.d.ts +1 -1
- package/dist/agent/backends/provider_ids.js +1 -1
- package/dist/agent/backends/types.d.ts +8 -0
- package/dist/agent/backends/zerg-api.js +5 -1
- package/dist/agent/backends/zrouter_stream.d.ts +75 -9
- package/dist/agent/backends/zrouter_stream.js +250 -49
- package/dist/agent/commands/config.js +51 -4
- package/dist/agent/commands/connect.js +20 -0
- package/dist/agent/commands/credential_status.js +5 -3
- package/dist/agent/commands/debug.js +3 -0
- package/dist/agent/commands/diff.js +9 -5
- package/dist/agent/commands/emulation.js +7 -1
- package/dist/agent/commands/inbox.js +4 -3
- package/dist/agent/commands/mcp.js +3 -0
- package/dist/agent/commands/models.js +20 -3
- package/dist/agent/commands/permissions.js +16 -2
- package/dist/agent/commands/provider_selection.js +13 -6
- package/dist/agent/commands/settings.js +15 -4
- package/dist/agent/commands/status.js +23 -1
- package/dist/agent/commands/types.d.ts +34 -3
- package/dist/agent/commands/update.d.ts +2 -1
- package/dist/agent/commands/update.js +8 -3
- package/dist/agent/commands/zerg.d.ts +6 -0
- package/dist/agent/commands/zerg.js +152 -28
- package/dist/agent/commands/ztc_pane.js +8 -5
- package/dist/agent/factory.js +22 -4
- package/dist/agent/request_encoder.js +11 -2
- package/dist/agent/runtime/command_jobs.js +16 -1
- package/dist/agent/runtime/command_panes.js +4 -1
- package/dist/agent/runtime/execution_context.d.ts +8 -1
- package/dist/agent/runtime/execution_context.js +8 -2
- package/dist/agent/runtime/policy.d.ts +66 -5
- package/dist/agent/runtime/policy.js +161 -33
- package/dist/agent/runtime/remote_broker_transport.d.ts +7 -0
- package/dist/agent/runtime/remote_broker_transport.js +33 -3
- package/dist/agent/runtime/remote_resource_errors.d.ts +7 -0
- package/dist/agent/runtime/remote_resource_errors.js +10 -0
- package/dist/agent/runtime/remote_resources.d.ts +1 -1
- package/dist/agent/runtime/remote_resources.js +7 -3
- package/dist/agent/runtime/source_verification.js +15 -12
- package/dist/agent/runtime/tool_runtime.js +165 -58
- package/dist/agent/runtime/verifier_capture.d.ts +1 -1
- package/dist/agent/runtime/verifier_capture.js +6 -0
- package/dist/agent/runtime/work_base.js +46 -14
- package/dist/agent/tools/adaptation.js +29 -12
- package/dist/agent/tools/apply_patch.js +62 -5
- package/dist/agent/tools/background.js +2 -0
- package/dist/agent/tools/benchmark_cpu.js +2 -0
- package/dist/agent/tools/bus_message.d.ts +4 -2
- package/dist/agent/tools/bus_message.js +21 -3
- package/dist/agent/tools/delegate.js +2 -0
- package/dist/agent/tools/file.d.ts +12 -1
- package/dist/agent/tools/file.js +92 -11
- package/dist/agent/tools/lsp.d.ts +12 -0
- package/dist/agent/tools/lsp.js +61 -5
- package/dist/agent/tools/pane.js +20 -45
- package/dist/agent/tools/project_context.js +5 -2
- package/dist/agent/tools/routine.js +20 -4
- package/dist/agent/tools/screenshot.d.ts +8 -0
- package/dist/agent/tools/screenshot.js +39 -25
- package/dist/agent/tools/search.js +31 -3
- package/dist/agent/tools/shell.js +7 -1
- package/dist/agent/tools/supervision.js +6 -0
- package/dist/agent/tools/types.d.ts +18 -0
- package/dist/agent/tools/zerg.js +15 -19
- package/dist/agent/tools/ztc_command.d.ts +15 -4
- package/dist/agent/tools/ztc_command.js +48 -34
- package/dist/app/agent_runner.js +8 -6
- package/dist/app/conversation_compaction.d.ts +6 -3
- package/dist/app/conversation_compaction.js +6 -3
- package/dist/app/tool_callbacks.js +1 -0
- package/dist/audio/sfx.js +6 -0
- package/dist/batch/worktree.js +22 -10
- package/dist/board/client.js +2 -1
- package/dist/cli_main.d.ts +1 -0
- package/dist/cli_main.js +141 -45
- package/dist/cli_ratatui.d.ts +49 -4
- package/dist/cli_ratatui.js +355 -79
- package/dist/conductor_branch.js +4 -1
- package/dist/config/host_credentials.d.ts +157 -0
- package/dist/config/host_credentials.js +589 -0
- package/dist/config/model_pin.d.ts +111 -0
- package/dist/config/model_pin.js +182 -0
- package/dist/config/own_state_files.d.ts +35 -0
- package/dist/config/own_state_files.js +161 -0
- package/dist/config/permission_pin.d.ts +148 -0
- package/dist/config/permission_pin.js +203 -0
- package/dist/config/permissions.d.ts +9 -2
- package/dist/config/permissions.js +14 -3
- package/dist/config/platform_login.d.ts +72 -0
- package/dist/config/platform_login.js +111 -0
- package/dist/config/profile_limits.d.ts +34 -0
- package/dist/config/profile_limits.js +66 -0
- package/dist/config/provider_api_key_env.js +3 -2
- package/dist/config/provider_models.d.ts +6 -1
- package/dist/config/provider_models.js +38 -11
- package/dist/config/repo_config.d.ts +22 -0
- package/dist/config/repo_config.js +77 -3
- package/dist/config/router_runtime_grant.d.ts +53 -0
- package/dist/config/router_runtime_grant.js +131 -0
- package/dist/config/settings_merge.d.ts +22 -0
- package/dist/config/settings_merge.js +75 -0
- package/dist/config/types.d.ts +8 -0
- package/dist/config.d.ts +334 -4
- package/dist/config.js +1024 -41
- package/dist/context/project_intelligence.d.ts +11 -2
- package/dist/context/project_intelligence.js +38 -15
- package/dist/desktop/daily/desktop_wiring.js +8 -6
- package/dist/desktop/daily/native_pane_launcher.js +2 -1
- package/dist/desktop/daily/native_tool.d.ts +1 -1
- package/dist/desktop/daily/native_tool.js +4 -3
- package/dist/desktop/daily/process_identity.js +10 -2
- package/dist/desktop/daily/source_baseline.js +4 -3
- package/dist/diagnostics/native_terminal_benchmark.js +3 -2
- package/dist/diagnostics/session_export.js +27 -14
- package/dist/embedded/anempa_runtime.js +3 -3
- package/dist/embedded/gameboy_runtime.js +5 -4
- package/dist/embedded/zergpod_runtime.js +5 -4
- package/dist/emulation/catalog.js +6 -1
- package/dist/emulation/tool_adapters.js +13 -3
- package/dist/environment/store.js +5 -4
- package/dist/extension_discovery.d.ts +12 -2
- package/dist/extension_discovery.js +52 -7
- package/dist/headless.d.ts +8 -0
- package/dist/headless.js +52 -13
- package/dist/headless_cli.js +16 -1
- package/dist/headless_workflow_trigger.js +1 -1
- package/dist/hooks/dispatcher.d.ts +8 -0
- package/dist/hooks/dispatcher.js +22 -2
- package/dist/hooks/lifecycle.d.ts +6 -0
- package/dist/hooks/lifecycle.js +1 -0
- package/dist/hooks/program_files.d.ts +10 -0
- package/dist/hooks/program_files.js +175 -0
- package/dist/hooks/runner.d.ts +11 -1
- package/dist/hooks/runner.js +112 -11
- package/dist/hooks/types.d.ts +2 -0
- package/dist/host_credentials_startup.d.ts +6 -0
- package/dist/host_credentials_startup.js +17 -0
- package/dist/instance_registry.d.ts +6 -2
- package/dist/instance_registry.js +9 -15
- package/dist/intake/format.d.ts +6 -0
- package/dist/intake/format.js +9 -0
- package/dist/intake/notifications.js +2 -1
- package/dist/lsp/manager.d.ts +1 -1
- package/dist/lsp/manager.js +4 -5
- package/dist/mcp/client.d.ts +2 -0
- package/dist/mcp/client.js +116 -18
- package/dist/mcp/registry.d.ts +12 -0
- package/dist/mcp/registry.js +15 -1
- package/dist/modes/handlers.js +14 -5
- package/dist/panes/agent_cli.d.ts +23 -1
- package/dist/panes/agent_cli.js +96 -1
- package/dist/panes/agent_panes.d.ts +27 -4
- package/dist/panes/agent_panes.js +73 -11
- package/dist/panes/editor_program.d.ts +8 -0
- package/dist/panes/editor_program.js +25 -0
- package/dist/panes/motsi.d.ts +11 -1
- package/dist/panes/motsi.js +14 -1
- package/dist/panes/pane_registry.d.ts +28 -1
- package/dist/panes/pane_registry.js +25 -0
- package/dist/panes/worker_route.js +5 -3
- package/dist/panes/ztc_launch.d.ts +8 -0
- package/dist/panes/ztc_launch.js +26 -1
- package/dist/profile_baseline.js +2 -0
- package/dist/router_auth.d.ts +8 -3
- package/dist/router_auth.js +34 -2
- package/dist/runtime_info.js +56 -38
- package/dist/session.js +12 -2
- package/dist/shannon/runtime.js +13 -1
- package/dist/simulation/domains/loader.d.ts +2 -1
- package/dist/simulation/domains/loader.js +19 -2
- package/dist/simulation/living/context.d.ts +8 -8
- package/dist/simulation/living/types.d.ts +2 -2
- package/dist/simulation/memory/embedding.d.ts +2 -1
- package/dist/simulation/memory/embedding.js +25 -6
- package/dist/terminal_attach.js +2 -1
- package/dist/types.d.ts +21 -0
- package/dist/ui/ratatui/headless_pane_manager.d.ts +12 -6
- package/dist/ui/ratatui/headless_pane_manager.js +65 -21
- package/dist/ui/ratatui/ipc_path.d.ts +41 -2
- package/dist/ui/ratatui/ipc_path.js +164 -5
- package/dist/ui/ratatui/pane_credential_broker.d.ts +17 -4
- package/dist/ui/ratatui/pane_credential_broker.js +23 -5
- package/dist/ui/ratatui/pane_relay.d.ts +74 -0
- package/dist/ui/ratatui/pane_relay.js +188 -13
- package/dist/ui/ratatui/process.d.ts +15 -1
- package/dist/ui/ratatui/process.js +129 -163
- package/dist/ui/ratatui/protocol.d.ts +11 -1
- package/dist/ui/ratatui/protocol.js +6 -0
- package/dist/ui/ratatui/ztc_launch_trust.d.ts +87 -0
- package/dist/ui/ratatui/ztc_launch_trust.js +249 -0
- package/dist/utils/admitted_open.d.ts +40 -0
- package/dist/utils/admitted_open.js +111 -0
- package/dist/utils/clipboard.js +2 -1
- package/dist/utils/computer_native.js +12 -56
- package/dist/utils/dictation.js +15 -12
- package/dist/utils/dictation_native.js +17 -60
- package/dist/utils/git_probe_options.d.ts +28 -0
- package/dist/utils/git_probe_options.js +30 -0
- package/dist/utils/git_program_files.d.ts +145 -0
- package/dist/utils/git_program_files.js +1282 -0
- package/dist/utils/git_repository_programs.d.ts +13 -0
- package/dist/utils/git_repository_programs.js +38 -0
- package/dist/utils/host_shell.js +2 -1
- package/dist/utils/idle_compaction.js +8 -1
- package/dist/utils/image_fit.d.ts +4 -1
- package/dist/utils/image_fit.js +6 -2
- package/dist/utils/image_preview.js +3 -2
- package/dist/utils/mirror_media.d.ts +22 -4
- package/dist/utils/mirror_media.js +87 -86
- package/dist/utils/ml_native.js +11 -56
- package/dist/utils/native_install.d.ts +55 -0
- package/dist/utils/native_install.js +107 -0
- package/dist/utils/open_url.js +2 -0
- package/dist/utils/process_end.d.ts +16 -0
- package/dist/utils/process_end.js +73 -0
- package/dist/utils/router_catalog.js +9 -2
- package/dist/utils/sandbox.d.ts +64 -1
- package/dist/utils/sandbox.js +397 -89
- package/dist/utils/shell.js +31 -12
- package/dist/utils/subprocess_env.d.ts +218 -2
- package/dist/utils/subprocess_env.js +429 -11
- package/dist/utils/system_ps.d.ts +5 -0
- package/dist/utils/system_ps.js +30 -0
- package/dist/utils/tts.js +5 -0
- package/dist/utils/tts_native.js +13 -60
- package/dist/utils/zlicky_overlay.js +17 -50
- package/dist/utils/ztc_own_state.d.ts +58 -0
- package/dist/utils/ztc_own_state.js +236 -0
- package/dist/web/mirror_authenticator.d.ts +67 -6
- package/dist/web/mirror_authenticator.js +131 -22
- package/dist/web/mirror_stream.d.ts +54 -10
- package/dist/web/mirror_stream.js +379 -92
- package/dist/web/observer_query_redaction.js +53 -13
- package/dist/web/observer_secret_redaction.d.ts +59 -0
- package/dist/web/observer_secret_redaction.js +714 -0
- package/dist/web/pane_credentials.d.ts +20 -2
- package/dist/web/pane_credentials.js +58 -5
- package/dist/worker/executor.js +3 -1
- package/dist/workspace_collision.js +19 -15
- package/dist/zerg/local_zerg_launches.d.ts +27 -0
- package/dist/zerg/local_zerg_launches.js +198 -0
- package/dist/zlm-embed.mjs +6257 -2791
- package/npm-shrinkwrap.json +1 -1
- package/package.json +42 -15
package/dist/conductor_branch.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
2
2
|
import { existsSync, readFileSync, readdirSync, statSync, } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
|
+
import { hostLaunchEnvironment } from './config/host_credentials.js';
|
|
5
6
|
export function parseConductorBranchArgs(args) {
|
|
6
7
|
const remaining = [];
|
|
7
8
|
let branch = null;
|
|
@@ -56,7 +57,9 @@ export function resolveConductorWorkspace(branch, env = process.env) {
|
|
|
56
57
|
return resolve(expandHome(root), branch);
|
|
57
58
|
}
|
|
58
59
|
export function buildConductorBranchLaunch(branch, ztcArgs, options = {}) {
|
|
59
|
-
|
|
60
|
+
// The branch's ZTC takes this one's place: it is started with this process's environment as ZTC was started with it,
|
|
61
|
+
// the credentials the host-credential store holds among it.
|
|
62
|
+
const env = options.env || hostLaunchEnvironment();
|
|
60
63
|
if (env.ZTC_DESKTOP_RUNTIME_MANIFEST) {
|
|
61
64
|
throw new Error('The bundled ZTC runtime does not support --branch; use a source or npm CLI to run branch-local code.');
|
|
62
65
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host-credential store: ZTC's own credentials, held outside process.env.
|
|
3
|
+
*
|
|
4
|
+
* A program ZTC starts with no environment of its own inherits all of process.env: read_file's image scalers, the `ps`
|
|
5
|
+
* run_command's cleanup runs, a helper's `git`, and any spawn written later. So ZTC keeps none of its credentials there.
|
|
6
|
+
* At startup, before any other module of the CLI runs (host_credentials_startup.ts, cli_main's first import), the store
|
|
7
|
+
* takes each of ZTC_CREDENTIAL_ENV out of process.env, and with it every other variable holding one of their values (a
|
|
8
|
+
* host can hand the same credential twice: ZergCloud passes its Router grant as ZERG_API_TOKEN too) and the setting a
|
|
9
|
+
* credential is read with (CREDENTIAL_SETTINGS: the host's effort policy URL, which goes with its token), keeping each
|
|
10
|
+
* under its name. A credential ZTC mints at runtime (the mirror's shared secret and process-wide token) goes into the
|
|
11
|
+
* store, never into process.env.
|
|
12
|
+
*
|
|
13
|
+
* ZTC reads them through the store (hostCredential, hostEnvironmentValue), and a child that needs one gets it explicitly
|
|
14
|
+
* from it: a ZTC pane and a colony cell the grant (utils/subprocess_env.ts hostRouterGrantForZtcChild), a colony cell
|
|
15
|
+
* its host's transport, ZTC's own relaunch everything it was started with (hostCredentialRelaunchEnv). The store holds
|
|
16
|
+
* values in this process's memory only; it never writes one anywhere, and never shows one.
|
|
17
|
+
*
|
|
18
|
+
* A process the store was never initialized in (a unit test, ZTC used as a library) keeps its credentials in process.env:
|
|
19
|
+
* reads fall back to process.env there, as they always did, and a credential minted there still goes into the store.
|
|
20
|
+
*
|
|
21
|
+
* A host can hand the grant and the mirror's shared secret over in a file instead (HOST_CREDENTIAL_FILE_ENV:
|
|
22
|
+
* ZTC_ROUTER_RUNTIME_GRANT_FILE, ZTC_MIRROR_SHARED_SECRET_FILE): startup reads the file once into the store and removes
|
|
23
|
+
* it, so the value is never in the environment this process was started with. It refuses a file that is a symbolic
|
|
24
|
+
* link, is not a regular file, has another name (a hard link, which removing this one would leave holding the
|
|
25
|
+
* credential), is empty, or that its group or others can read or change, a variable set together with its file, and one
|
|
26
|
+
* file that two of these variables name, or one and the handoff below, by one path or two spellings of it, since it would
|
|
27
|
+
* make one credential the other's too (HostCredentialFileError).
|
|
28
|
+
*
|
|
29
|
+
* A ZTC can hand another ZTC it starts the variables that ZTC is to be started with but that the program starting it
|
|
30
|
+
* doesn't hold, in a one-time handoff that ZTC's command line names (HOST_HANDOFF_FLAG, writeHostHandoff): its own
|
|
31
|
+
* relaunch in a new terminal window, which the terminal starts with a user subprocess's environment, and a ZTC pane a
|
|
32
|
+
* renderer starts again in place, which a replace_pane gives no environment. Startup takes it first, as if this
|
|
33
|
+
* process had been started with them.
|
|
34
|
+
*
|
|
35
|
+
* Startup takes all of these together or none of them: it reads and checks the handoff and every file before it removes
|
|
36
|
+
* any, so a refusal of one (the second file empty, or swapped for a link between ZTC's look at it and its open) leaves
|
|
37
|
+
* every one where it was, and a start the host retries once it has fixed that one takes them all. Before, the first
|
|
38
|
+
* file was gone by then and no retry could start (found by the ZergCloud hub's review, ze-0d, whose supervisor takes
|
|
39
|
+
* them in the same order).
|
|
40
|
+
*
|
|
41
|
+
* What it cannot do: the environment this process was started with stays readable by any program running as its user
|
|
42
|
+
* (`ps -E`, /proc/<pid>/environ) whatever the store removes from process.env, so a credential handed over there is
|
|
43
|
+
* still in reach of such a program; one handed over in a file is not. And a program running as this user or as root
|
|
44
|
+
* can still read this process's memory, where the store holds them.
|
|
45
|
+
*
|
|
46
|
+
* Self-contained (node builtins only): it runs before every other module body of the CLI.
|
|
47
|
+
*/
|
|
48
|
+
/** The host-only variable that holds the host's Router runtime grant (config/router_runtime_grant.ts). */
|
|
49
|
+
export declare const ROUTER_RUNTIME_GRANT_ENV = "ZTC_ROUTER_RUNTIME_GRANT";
|
|
50
|
+
/**
|
|
51
|
+
* The variables whose values are ZTC's own credentials: what speaks for this ZTC (its mirror's shared secret and
|
|
52
|
+
* process-wide token, its own pane credential, the platform login or Router grant it infers with, the host's Router
|
|
53
|
+
* runtime grant, its host's approval, broker and effort-policy tokens) and the zerg service's session secret. No child
|
|
54
|
+
* inherits one (utils/subprocess_env.ts), and the store holds them outside process.env.
|
|
55
|
+
*/
|
|
56
|
+
export declare const ZTC_CREDENTIAL_ENV: readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* The shortest value taken for a credential when another variable holds it as well. A shorter one (a port, a flag, a
|
|
59
|
+
* word) could be anyone's.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CREDENTIAL_COPY_MIN_LENGTH = 12;
|
|
62
|
+
/**
|
|
63
|
+
* The credentials a host may hand over in a file instead of in this process's environment, each with the variable that
|
|
64
|
+
* names its file.
|
|
65
|
+
*/
|
|
66
|
+
export declare const HOST_CREDENTIAL_FILE_ENV: Readonly<Record<string, string>>;
|
|
67
|
+
/** Why startup refused a credential a host handed over (HOST_CREDENTIAL_FILE_ENV). It never repeats a value. */
|
|
68
|
+
export declare class HostCredentialFileError extends Error {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The flag on a ZTC's command line that names a one-time handoff of variables that ZTC is to be started with but that
|
|
73
|
+
* the program starting it doesn't hold in its environment: ZTC's own relaunch in a new terminal window (--new-window),
|
|
74
|
+
* which the terminal starts with a user subprocess's environment, and a ZTC pane a renderer starts again in place
|
|
75
|
+
* (replace_pane), which carries no environment. The handoff (writeHostHandoff) is a JSON object of variable names and
|
|
76
|
+
* values in an owner-only file, in an owner-only folder of its own in the temp folder: never in an environment, which
|
|
77
|
+
* any program running as this user can read, nor on a command line, which any local user can. The ZTC it is for takes
|
|
78
|
+
* it as it starts, as if it had been started with those variables, and removes it (initHostCredentials).
|
|
79
|
+
*/
|
|
80
|
+
export declare const HOST_HANDOFF_FLAG = "--host-credential-file";
|
|
81
|
+
/**
|
|
82
|
+
* ARGS, launch flags of a ZTC that ZTC starts but did not write all of (the extra_args an agent gives create_ztc_pane,
|
|
83
|
+
* the arguments a pane relay client asks a launch nonce for, the flags this process was started with), without a
|
|
84
|
+
* handoff they name (HOST_HANDOFF_FLAG with the path after it, or written as one word with '='), before an end of
|
|
85
|
+
* options ('--'), after which a ZTC pane's task is literal text. A ZTC is handed variables only in a handoff ZTC wrote
|
|
86
|
+
* for that launch itself (writeHostHandoff): one another program put in the temp folder, shaped as ZTC's own, could set
|
|
87
|
+
* the ZERG_ROUTER_BASE_URL the grant goes to, or switch extension discovery off, in a ZTC that holds the grant.
|
|
88
|
+
*/
|
|
89
|
+
export declare function withoutHostHandoff(args: readonly string[]): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Take ZTC's credentials out of this process's environment into the store. First what was handed over to it: a
|
|
92
|
+
* handoff on ARGV (HOST_HANDOFF_FLAG), as if this process had been started with it (its credentials into the store, its
|
|
93
|
+
* other variables into ENV over what ENV holds), and each credential a host handed over in a file
|
|
94
|
+
* (HOST_CREDENTIAL_FILE_ENV), its variable taken out too. All of them are read and checked before any is taken or
|
|
95
|
+
* removed: a handoff that isn't one, a variable set together with its file (or with a credential the handoff holds), a
|
|
96
|
+
* file that is unfit, changed as ZTC opened it, or empty, one file named twice (refuseOneFileTwice), is refused
|
|
97
|
+
* (HostCredentialFileError), and then nothing is
|
|
98
|
+
* consumed: every file, and a handoff that passed, is left where it was for a start that takes them all. Only once
|
|
99
|
+
* every one has passed are their files removed, with the folders ZTC's relaunch put them in, and they are taken. Then
|
|
100
|
+
* each of ZTC_CREDENTIAL_ENV, the settings read with one of them (CREDENTIAL_SETTINGS), and every other variable whose
|
|
101
|
+
* value (blanks around it aside) is one of the credentials', of CREDENTIAL_COPY_MIN_LENGTH characters or more. Each is
|
|
102
|
+
* kept under its name, so a read of a setting or a copy ZTC itself makes still finds it (hostEnvironmentValue). Runs
|
|
103
|
+
* once; later calls change nothing.
|
|
104
|
+
*/
|
|
105
|
+
export declare function initHostCredentials(env?: NodeJS.ProcessEnv, warn?: (message: string) => void, argv?: string[]): void;
|
|
106
|
+
/** Whether this process took its credentials out of its environment (initHostCredentials). */
|
|
107
|
+
export declare function hostCredentialsInitialized(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The credential NAME (one of ZTC_CREDENTIAL_ENV): the store's, once startup took them out of process.env; before
|
|
110
|
+
* that, or where it never did, process.env's, else one ZTC minted.
|
|
111
|
+
*/
|
|
112
|
+
export declare function hostCredential(name: string): string | undefined;
|
|
113
|
+
/** Keep VALUE, a credential ZTC minted for NAME (the mirror's shared secret, its process-wide token), in the store. */
|
|
114
|
+
export declare function holdMintedCredential(name: string, value: string): void;
|
|
115
|
+
/**
|
|
116
|
+
* The value NAME has in ENV. For this process's own environment, as ZTC was started with it: a credential from the
|
|
117
|
+
* store (hostCredential), and a setting or a copy startup took out with the credentials from the store too. Any other
|
|
118
|
+
* environment (a child's, one a test builds) is read as it is.
|
|
119
|
+
*/
|
|
120
|
+
export declare function hostEnvironmentValue(name: string, env?: NodeJS.ProcessEnv): string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* SOURCE as ZTC was started with it, for working out what a child of ZTC gets: this process's environment with the
|
|
123
|
+
* credentials the store holds, and the settings and copies it took out with them, put back; any other environment as
|
|
124
|
+
* it is. It is a picture that the child-environment rules strip (utils/subprocess_env.ts); never start a child with it
|
|
125
|
+
* whole.
|
|
126
|
+
*/
|
|
127
|
+
export declare function hostLaunchEnvironment(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
128
|
+
/**
|
|
129
|
+
* Every credential value the store holds, and every copy's, of CREDENTIAL_COPY_MIN_LENGTH characters or more (blanks
|
|
130
|
+
* around each aside), longest first: what no child may hold under any name.
|
|
131
|
+
*/
|
|
132
|
+
export declare function heldCredentialValues(): string[];
|
|
133
|
+
/**
|
|
134
|
+
* The credential values to withhold wherever they appear, for a redactor (the mirror's observer projection, a
|
|
135
|
+
* diagnostics export): what each of NAMES holds in ENV (this process's own environment read as ZTC was started with
|
|
136
|
+
* it, hostEnvironmentValue), and, for this process's environment, every credential the store holds and every copy it
|
|
137
|
+
* took out (heldCredentialValues), named or not; each of CREDENTIAL_COPY_MIN_LENGTH characters or more (blanks around it
|
|
138
|
+
* aside), longest first. Scrubbing process.env takes nothing off it.
|
|
139
|
+
*/
|
|
140
|
+
export declare function liveCredentialValues(names?: readonly string[], env?: NodeJS.ProcessEnv): string[];
|
|
141
|
+
/**
|
|
142
|
+
* A fresh one-time handoff of VARIABLES for a ZTC to be started with (HOST_HANDOFF_FLAG): the path its command line
|
|
143
|
+
* names after the flag. Null when VARIABLES is empty, or when the handoff can't be written or would be larger than a
|
|
144
|
+
* handoff ZTC takes.
|
|
145
|
+
*/
|
|
146
|
+
export declare function writeHostHandoff(variables: Readonly<Record<string, string>>): string | null;
|
|
147
|
+
/** Remove a handoff (writeHostHandoff) its ZTC never took: the program never started, or ended before it took it. */
|
|
148
|
+
export declare function removeHostHandoff(path: string): void;
|
|
149
|
+
/**
|
|
150
|
+
* What ZTC's own relaunch (a hot restart in place, which is this ZTC again) is started with besides process.env:
|
|
151
|
+
* everything the store took out of it and everything ZTC minted, so the ZTC that takes this one's place keeps the
|
|
152
|
+
* host's grant, its platform login, its effort policy and the mirror's secret and token, and takes them out of its own
|
|
153
|
+
* environment again. A credential the host handed over in a file, or another ZTC handed this one in a handoff, goes
|
|
154
|
+
* over in a fresh one-time file when it has a file variable (HOST_CREDENTIAL_FILE_ENV), never in that ZTC's environment;
|
|
155
|
+
* in its environment only when no such file can be written.
|
|
156
|
+
*/
|
|
157
|
+
export declare function hostCredentialRelaunchEnv(): Record<string, string>;
|