@zergai/ztc 0.26.5-dev.202611240151 → 0.26.6-dev.202611240947

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.
@@ -6,7 +6,9 @@ import { parseCodexModelRow } from '../../utils/codex_models.js';
6
6
  import { ModelNotServedError } from './model_not_served.js';
7
7
  import { getVersion } from '../../utils/version.js';
8
8
  import { NativeObservationLimitError } from '../runtime/provider_native_evidence.js';
9
- import { buildUserSubprocessEnv } from '../../utils/subprocess_env.js';
9
+ import { hostLaunchEnvironment } from '../../config/host_credentials.js';
10
+ import { codexEnvAllowlisted } from '../../config/hosted_runtime.js';
11
+ import { buildCredentialSafeSubprocessEnv, buildUserSubprocessEnv, PLATFORM_ROUTER_BEARER_ENV, withoutPlatformRouterBearers, } from '../../utils/subprocess_env.js';
10
12
  export const MAX_CODEX_APP_SERVER_FRAME_BYTES = 1_048_576;
11
13
  export const MAX_CODEX_APP_SERVER_QUEUED_FRAMES = 1_024;
12
14
  /** Keep managed profiles on their own auth.json and ChatGPT subscription. */
@@ -27,27 +29,104 @@ const MAX_CODEX_APP_SERVER_OBSERVATIONS_PER_TURN = 128;
27
29
  const MAX_CODEX_APP_SERVER_MODEL_PAGES = 20;
28
30
  const MAX_CODEX_APP_SERVER_MODELS = 2_000;
29
31
  /**
30
- * Environment for the spawned `codex app-server`, pinned to the account's own
31
- * credentials. Injects the per-account CODEX_HOME (when given) and SCRUBS a
32
- * stray auth overrides from the parent env — otherwise the
33
- * codex CLI would bill that API key instead of the account's ChatGPT
34
- * subscription (auth.json under CODEX_HOME). It applies even with no
35
- * per-account home so an ambient key never hijacks the default ChatGPT login.
36
- * The app-server runs the commands Codex's model asks for with this
37
- * environment, so it starts from a user subprocess's (buildUserSubprocessEnv):
38
- * the person's own, and none of ZTC's credentials or its host's effort policy.
32
+ * The stray auth overrides a codex app-server is never given: with one of them the codex CLI would bill an API key, or
33
+ * sign in some other way, instead of the account's ChatGPT subscription (auth.json under CODEX_HOME).
34
+ */
35
+ const CODEX_AUTH_OVERRIDE_ENV = [
36
+ 'OPENAI_API_KEY', 'OPENAI_BASE_URL', 'CODEX_ACCESS_TOKEN', 'CODEX_API_KEY',
37
+ 'OPENAI_IDENTITY_TOKEN_FILE', 'OPENAI_FEDERATION_RULE_ID', 'CODEX_SQLITE_HOME',
38
+ ];
39
+ /**
40
+ * What a Codex whose environment is allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, or
41
+ * asks for that alone) is given of its environment besides the names the bubblewrap sandbox gives a command
42
+ * (utils/subprocess_env.ts buildCredentialSafeSubprocessEnv: CI, COLORTERM, FORCE_COLOR, HOME, LANG, LOGNAME, NO_COLOR,
43
+ * PATH, SHELL, TEMP, TERM, TMP, TMPDIR, TZ, USER and LC_*): where its sign-in is (CODEX_HOME); the certificates a host's
44
+ * private CA or TLS-inspecting proxy is trusted with (CODEX_CA_CERTIFICATE and SSL_CERT_FILE, which the codex binary
45
+ * reads, SSL_CERT_DIR, NODE_EXTRA_CA_CERTS, which the npm package's node launcher and the node tools its commands run
46
+ * read, and GIT_SSL_CAINFO, CURL_CA_BUNDLE and REQUESTS_CA_BUNDLE, which git, curl and Python's requests read for the
47
+ * commands it runs); and the proxy it reaches OpenAI through (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY, and their
48
+ * lowercase forms, which the codex binary reads, as curl, and so git, does). Nothing else: no key (CODEX_AUTH_JSON is
49
+ * none of these), no bearer, and none of the rest of the host's environment.
50
+ */
51
+ export const CODEX_APP_SERVER_HOSTED_ENV = Object.freeze([
52
+ 'CODEX_HOME', 'CODEX_CA_CERTIFICATE', 'SSL_CERT_FILE', 'SSL_CERT_DIR', 'NODE_EXTRA_CA_CERTS',
53
+ 'GIT_SSL_CAINFO', 'CURL_CA_BUNDLE', 'REQUESTS_CA_BUNDLE',
54
+ 'HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'NO_PROXY', 'http_proxy', 'https_proxy', 'all_proxy', 'no_proxy',
55
+ ]);
56
+ /**
57
+ * Environment for the spawned `codex app-server`, pinned to the account's own credentials: the per-account CODEX_HOME
58
+ * (when given), and none of the stray auth overrides (CODEX_AUTH_OVERRIDE_ENV), even with no per-account home, so an
59
+ * ambient key never hijacks the default ChatGPT login.
60
+ *
61
+ * The app-server runs the commands Codex's model asks for with this environment, and every program its own git runs
62
+ * with it too: a work tree's filter driver (a clean filter a tracked .gitattributes selects and .git/config names), which
63
+ * codex leaves on for its git as it turns fsmonitor and hooks off, ran with it when the model's only command was `pwd`
64
+ * (E1 round 13). So, for every user, it starts from a user subprocess's (buildUserSubprocessEnv: none of ZTC's own
65
+ * credentials or its host's effort policy, under any name) without any ZergAI platform or Zerg Router bearer, whatever
66
+ * it holds, or another name for one (PLATFORM_ROUTER_BEARER_ENV): Codex never needs one. On the person's own computer the
67
+ * rest is theirs, their SSH agent and toolchains among it, which their builds and git need. Where Codex's environment is
68
+ * allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, as ZTC_HOSTED=1, a host's thread or
69
+ * ZTC_PERMISSION_PROFILE_PINNED says, or asks for that alone, with ZTC_CODEX_ENV_ALLOWLIST=1, as a ZergCloud zerg's
70
+ * entrypoint does) it is only the allowlisted names (buildCredentialSafeSubprocessEnv's, and
71
+ * CODEX_APP_SERVER_HOSTED_ENV): the rest of the host's environment reaches neither Codex nor anything it runs.
39
72
  */
40
73
  export function buildCodexAppServerEnv(codexHome, base = process.env) {
41
- const env = buildUserSubprocessEnv(base);
74
+ const stripped = withoutPlatformRouterBearers(buildUserSubprocessEnv(base), base);
75
+ for (const name of CODEX_AUTH_OVERRIDE_ENV)
76
+ delete stripped[name];
77
+ const env = codexEnvAllowlisted(base) ? hostedCodexEnv(stripped) : stripped;
42
78
  if (codexHome)
43
79
  env.CODEX_HOME = codexHome;
44
- for (const name of [
45
- 'OPENAI_API_KEY', 'OPENAI_BASE_URL', 'CODEX_ACCESS_TOKEN', 'CODEX_API_KEY',
46
- 'OPENAI_IDENTITY_TOKEN_FILE', 'OPENAI_FEDERATION_RULE_ID', 'CODEX_SQLITE_HOME',
47
- ])
48
- delete env[name];
49
80
  return env;
50
81
  }
82
+ /** Of ENV, only what a Codex whose environment is allowlisted is given: the bubblewrap sandbox's names and CODEX_APP_SERVER_HOSTED_ENV. */
83
+ function hostedCodexEnv(env) {
84
+ const kept = buildCredentialSafeSubprocessEnv(env);
85
+ for (const name of CODEX_APP_SERVER_HOSTED_ENV) {
86
+ if (env[name] !== undefined)
87
+ kept[name] = env[name];
88
+ }
89
+ return kept;
90
+ }
91
+ /**
92
+ * How ZTC starts a Codex pane (panes/agent_panes.ts openAgentPane: /codex, the chooser, the + menus, a resume, the
93
+ * workspace server's open_pane), over the environment its renderer gives each pane, SOURCE's, read as ZTC was started
94
+ * with it: it is given what the codex app-server is (buildCodexAppServerEnv), since Codex's own git runs a work tree's
95
+ * filter driver there too (E1 round 13). WITHHELD are the names the pane's environment blanks and its shell unsets
96
+ * before Codex starts:
97
+ *
98
+ * - for every user, every ZergAI platform and Zerg Router bearer (PLATFORM_ROUTER_BEARER_ENV), set or not, since a login
99
+ * file may export one, and every other variable of SOURCE holding one's value; the rest is the person's own, the
100
+ * sign-in methods their own Codex offers among it, since a pane runs on none of ZTC's accounts, where the app-server
101
+ * runs on the sign-in under its account's CODEX_HOME;
102
+ * - where Codex's environment is ALLOWLISTED (config/hosted_runtime.ts codexEnvAllowlisted), every name of SOURCE that
103
+ * the codex app-server isn't given there. Such a pane starts from no login shell, whose files are its host's, and with
104
+ * no workspace tools, whose pane relay would open a pane with the rest.
105
+ */
106
+ export function codexPaneEnv(source = process.env) {
107
+ const launch = hostLaunchEnvironment(source);
108
+ const withoutBearers = withoutPlatformRouterBearers(launch, source);
109
+ const withheld = new Set([...PLATFORM_ROUTER_BEARER_ENV, ...Object.keys(launch).filter(name => withoutBearers[name] === undefined)]);
110
+ const allowlisted = codexEnvAllowlisted(source);
111
+ if (allowlisted) {
112
+ const given = buildCodexAppServerEnv(undefined, source);
113
+ for (const name of Object.keys(launch))
114
+ if (given[name] === undefined)
115
+ withheld.add(name);
116
+ }
117
+ return { allowlisted, withheld: [...withheld].sort() };
118
+ }
119
+ /**
120
+ * What a Codex request says where Codex's environment is allowlisted (codexEnvAllowlisted) and the app-server finds no
121
+ * sign-in under its CODEX_HOME. Every Codex with none is refused before a thread starts, so nothing was sent; there,
122
+ * nothing from the environment stands in for the sign-in, since the app-server is given no key (buildCodexAppServerEnv),
123
+ * and ZTC looks for none, so this says what its host does about it.
124
+ */
125
+ export const CODEX_HOSTED_NO_SIGN_IN = 'codex_app_server has no sign-in in its CODEX_HOME, so nothing was sent. Where its host '
126
+ + 'runs ZTC (ZTC_HOSTED, a host\'s thread, ZTC_PERMISSION_PROFILE_PINNED) or keeps Codex to the allowlisted environment '
127
+ + '(ZTC_CODEX_ENV_ALLOWLIST), Codex runs only on the sign-in its CODEX_HOME holds and is given no key from the environment '
128
+ + 'in its place (OPENAI_API_KEY, CODEX_API_KEY, CODEX_AUTH_JSON). The host signs Codex in there (CODEX_HOME=<folder> codex '
129
+ + 'login), or runs this thread through Zerg Router.';
51
130
  /** What ZTC answers a Codex server request it has no screen for. */
52
131
  function unsupportedServerRequestMessage(method) {
53
132
  const instead = method === 'item/tool/requestUserInput' ? ' Ask the person with the ask_user tool instead.' : '';
@@ -309,9 +388,10 @@ export class ChildProcessTransport {
309
388
  }
310
389
  constructor(command, args, env) {
311
390
  // ENV is the child's whole environment, a per-account CODEX_HOME included (buildCodexAppServerEnv, which every
312
- // backend passes). A caller that gives none gets a user subprocess's (buildUserSubprocessEnv), never all of
313
- // process.env: the app-server runs the commands Codex's model asks for with it, so none of ZTC's credentials.
314
- this.child = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], env: env ?? buildUserSubprocessEnv() });
391
+ // backend passes). A caller that gives none gets the same, with no CODEX_HOME of its own, never all of process.env:
392
+ // the app-server runs the commands Codex's model asks for with it, so none of ZTC's credentials, no platform or
393
+ // Router bearer, and only the allowlisted names where Codex's environment is allowlisted.
394
+ this.child = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], env: env ?? buildCodexAppServerEnv() });
315
395
  process.once('exit', this.reapOnExit);
316
396
  this.child.stdout.on('data', (chunk) => {
317
397
  if (this.stopping)
@@ -884,7 +964,9 @@ export class CodexAppServerClient {
884
964
  async requireAccount(onActivity) {
885
965
  const result = await this.readAccount(false, onActivity);
886
966
  if (!result.account) {
887
- throw new Error("codex_app_server is not logged in. Run 'codex login status' or 'codex login' before using ZTC's official Codex provider.");
967
+ // Where Codex's environment is allowlisted no key from the environment stands in for the sign-in: say what the host does.
968
+ throw new Error(codexEnvAllowlisted() ? CODEX_HOSTED_NO_SIGN_IN
969
+ : "codex_app_server is not logged in. Run 'codex login status' or 'codex login' before using ZTC's official Codex provider.");
888
970
  }
889
971
  if (this.requireChatGptSubscription
890
972
  && (result.account.type !== 'chatgpt' || result.requiresOpenaiAuth !== true)) {
@@ -1,5 +1,5 @@
1
1
  import type { Tool, ToolContext } from '../tools/types.js';
2
- import type { Policy } from './policy.js';
2
+ import { type Policy } from './policy.js';
3
3
  import { ToolCapability } from './capabilities.js';
4
4
  import { HookDispatcher } from '../../hooks/dispatcher.js';
5
5
  import type { HookApprovalRequester } from '../../hooks/types.js';
@@ -2,6 +2,7 @@ import { basename, dirname, join, relative, resolve } from 'path';
2
2
  import { realpathSync } from 'node:fs';
3
3
  import { appendFile } from 'node:fs/promises';
4
4
  import { getRuntimeCapabilities } from '../tools/helper_requirements.js';
5
+ import { startsProgramsOutsideSandbox } from './policy.js';
5
6
  import { ToolCapability } from './capabilities.js';
6
7
  import { capToolResult } from './result_cap.js';
7
8
  import { configStore } from '../../config.js';
@@ -208,6 +209,9 @@ export async function executeToolWithRuntime(name, args, options) {
208
209
  // Whether the call starts nothing of the agent's outside run_command's OS sandbox (Tool.confinedCommands). ztc_command
209
210
  // runs no program itself: a command that does declares it (ztcCommandConfined), and that call is judged by it.
210
211
  const confinedCall = (input) => (sourceTool === ztcCommandTool ? ztcCommandConfined(input) : tool?.confinedCommands === true);
212
+ /** What an approval request for the call says of where it starts programs (HookApprovalRequest.startsProgramsOutsideSandbox). */
213
+ const outsideSandbox = (input) => (startsProgramsOutsideSandbox(callCapabilities(input), { sandboxedCommands: tool?.sandboxedCommands, confinedCommands: confinedCall(input) })
214
+ ? { startsProgramsOutsideSandbox: true } : {});
211
215
  let capabilities = requiredCapabilities(args);
212
216
  let effectiveArgs = args;
213
217
  let approvalGranted = false;
@@ -296,6 +300,7 @@ export async function executeToolWithRuntime(name, args, options) {
296
300
  args: effectiveArgs,
297
301
  capabilities: capabilities,
298
302
  reason: preHook.decisionReason,
303
+ ...outsideSandbox(effectiveArgs),
299
304
  });
300
305
  if (!approval.approved) {
301
306
  return {
@@ -464,6 +469,7 @@ export async function executeToolWithRuntime(name, args, options) {
464
469
  args: effectiveArgs,
465
470
  capabilities: capabilities,
466
471
  reason,
472
+ ...outsideSandbox(effectiveArgs),
467
473
  });
468
474
  if (!approval.approved) {
469
475
  return {
@@ -566,6 +572,7 @@ export async function executeToolWithRuntime(name, args, options) {
566
572
  args: effectiveArgs,
567
573
  capabilities: capabilities,
568
574
  reason: `Host approval is required for ${capabilities.join(', ')}`,
575
+ ...outsideSandbox(effectiveArgs),
569
576
  });
570
577
  if (!approval.approved) {
571
578
  return {
package/dist/cli_main.js CHANGED
@@ -38,7 +38,8 @@ import { parseHeadlessInteractionMode } from './app/headless_interaction.js';
38
38
  import { installEmergencyHandlers } from './app/emergency_exit.js';
39
39
  import { buildCliCommonStarts } from './onboarding/first_run.js';
40
40
  import { validateProfileName } from './config/profiles.js';
41
- import { PermissionPinChangedError, PermissionPinUnlimitedError, takePermissionPinSource } from './config/permission_pin.js';
41
+ import { PermissionPinChangedError, PermissionPinOwnStateInRootsError, PermissionPinUnlimitedError, PermissionPinUnrootedError, takePermissionPinSource } from './config/permission_pin.js';
42
+ import { hostedRequested, hostedStartRefusalMessage } from './config/hosted_runtime.js';
42
43
  import { loadDesktopRuntime } from './desktop/runtime.js';
43
44
  import { resolveOwnedCliLaunch } from './desktop/cli_launch.js';
44
45
  import { consumePaneCredentialHandoff } from './web/pane_credentials.js';
@@ -46,20 +47,39 @@ import { consumeDesktopCredentialHandoff } from './desktop/daily/control_credent
46
47
  /**
47
48
  * Pin the permission settings where the host asked (ZTC_PERMISSION_PROFILE_PINNED; ConfigStore.pinStartupPermissions),
48
49
  * with HANDED_OVER, what main() took of a restart's hand-off as it started. A ZTC started again in place whose permission
49
- * settings changed after the ZTC it replaces checked them pins nothing of them, and a ZTC whose permission profile limits
50
- * nothing pins none: either says why and exits 2.
50
+ * settings changed after the ZTC it replaces checked them pins nothing of them, a ZTC whose permission profile limits
51
+ * nothing pins none, and nor does one whose own state or TMPDIR lies inside that profile's writable roots, or whose
52
+ * profile writes but names no allowedPaths: each says why and exits 2.
51
53
  */
52
54
  function pinStartupPermissionsOrExit(store, handedOver) {
53
55
  try {
54
56
  store.pinStartupPermissions(handedOver);
55
57
  }
56
58
  catch (error) {
57
- if (!(error instanceof PermissionPinChangedError) && !(error instanceof PermissionPinUnlimitedError))
59
+ if (!(error instanceof PermissionPinChangedError) && !(error instanceof PermissionPinUnlimitedError)
60
+ && !(error instanceof PermissionPinOwnStateInRootsError) && !(error instanceof PermissionPinUnrootedError))
58
61
  throw error;
59
62
  console.error(`[ztc] ${error.message}`);
60
63
  process.exit(2);
61
64
  }
62
65
  }
66
+ /**
67
+ * Where its host runs ZTC (ZTC_HOSTED=1), a headless start whose permission profile, as its startup leaves it (the
68
+ * launch's --permission-profile, a hosted thread's or the one config.json saves), runs the agent's commands without
69
+ * requiring an OS sandbox, or writes and runs them but names no allowedPaths, as a host's pin refuses either
70
+ * (ConfigStore.hostedStartRefusal), says why and exits 2: they would run outside one with whatever ZTC itself can reach,
71
+ * or write in whatever folder the agent runs them in, as root where its host runs ZTC so (a zerg service's one-shot run,
72
+ * once that service sets the variable). Its callers ask it of each start whose settings are its launch's: a run with a
73
+ * prompt or a Voyager task on its command line, one on a --session-file thread, the mux workbench's among them, a
74
+ * headless mirror without mux, and a pane child that names a prompt or a thread.
75
+ */
76
+ function refuseUnconfinedHostedStartOrExit(store) {
77
+ const why = hostedRequested() ? store.hostedStartRefusal() : undefined;
78
+ if (why === undefined)
79
+ return;
80
+ console.error(`[ztc] ${hostedStartRefusalMessage(store.getActivePermissionProfileId(), why)}`);
81
+ process.exit(2);
82
+ }
63
83
  // A ZTC pane is handed its mirror credential in a one-time file its command line names: take it, and the flag, before
64
84
  // anything reads the arguments, and keep it out of the environment every program this ZTC starts inherits (see
65
85
  // pane_credentials.ts).
@@ -1559,6 +1579,11 @@ async function main() {
1559
1579
  prefetchStartupGitSnapshot(process.cwd());
1560
1580
  // Startup is done: a host that pins the permission settings (ZTC_PERMISSION_PROFILE_PINNED) pins them now.
1561
1581
  pinStartupPermissionsOrExit(configStore, permissionPinHandOff);
1582
+ // A one-shot run (a prompt or a Voyager task on its command line), or one on a --session-file thread, that its host
1583
+ // runs (ZTC_HOSTED=1) keeps the agent's commands in an OS sandbox, or runs none, whether or not its host pins the
1584
+ // profile.
1585
+ if (headlessPrompt !== null || voyagerTask !== null || explicitSessionFile)
1586
+ refuseUnconfinedHostedStartOrExit(configStore);
1562
1587
  const { runHeadless } = await import('./headless.js');
1563
1588
  await runHeadless({
1564
1589
  approvalUrl: headlessApprovalUrl,
@@ -1601,6 +1626,11 @@ async function main() {
1601
1626
  debugLog(`[main] Running as headless child pane (ZTC_PANE_ID=${process.env.ZTC_PANE_ID})`);
1602
1627
  // The pane's startup is done: it pins its permission settings where its host (or the ZTC that opened it) asks.
1603
1628
  pinStartupPermissionsOrExit(configStore, permissionPinHandOff);
1629
+ // No pane a headless mux opens names a prompt or a --session-file thread (its parent writes its prompts to it), but a
1630
+ // headless mux gives ZTC_HEADLESS_MUX to every pane, a shell pane's commands among them: a start here that names
1631
+ // either is checked as any one-shot or thread start its host runs (ZTC_HOSTED=1) is.
1632
+ if (headlessPrompt !== null || voyagerTask !== null || explicitSessionFile)
1633
+ refuseUnconfinedHostedStartOrExit(configStore);
1604
1634
  const { runHeadless } = await import('./headless.js');
1605
1635
  await runHeadless({
1606
1636
  approvalUrl: headlessApprovalUrl,
@@ -1777,6 +1807,15 @@ async function main() {
1777
1807
  // sandbox are taken. A host that pins them (ZTC_PERMISSION_PROFILE_PINNED, config/permission_pin.ts) pins them now,
1778
1808
  // once; from here on every change of them is refused, naming the variable.
1779
1809
  pinStartupPermissionsOrExit(configStore, permissionPinHandOff);
1810
+ // So a headless mirror its host runs (ZTC_HOSTED=1) keeps the agent's commands in an OS sandbox, or runs none, where
1811
+ // its settings are its launch's: one without mux, whose prompts come through the mirror; and the mux workbench on a
1812
+ // --session-file thread or with a prompt on its command line. A thread its host wrote before it started ZTC, as
1813
+ // ZergRouter's hosted runtime writes one, gave its settings above, and those require the sandbox; one not written yet
1814
+ // gives none. The workbench started with neither, whose threads get their settings from its host once it runs, isn't
1815
+ // checked here, nor is a pane.
1816
+ if (headlessMode && !paneMode && (!muxMode || headlessPrompt !== null || explicitSessionFile)) {
1817
+ refuseUnconfinedHostedStartOrExit(configStore);
1818
+ }
1780
1819
  // --name <name>: resume by name if it exists, otherwise create-and-name a
1781
1820
  // fresh session right now so /sessions list and `ztc resume <name>` work
1782
1821
  // without a prior turn. Also reached via the --resume / --session-id
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Whether ZTC runs as its host's, or its host asks for Codex's allowlist alone, where a program of someone else's that
3
+ * runs a model's commands (the codex app-server, and Codex in a pane) is given an allowlisted environment rather than the
4
+ * rest of the host's (agent/backends/codex_app_server.ts buildCodexAppServerEnv and codexPaneEnv); what a headless start
5
+ * its host runs (ZTC_HOSTED=1) says as it refuses a permission profile that runs the agent's commands without requiring an
6
+ * OS sandbox, or that lets them write wherever the agent runs them (cli_main.ts, headless_cli.ts); and what such a run
7
+ * says as it refuses, with no one to ask, a call that starts a program outside the sandbox (headless.ts).
8
+ *
9
+ * Self-contained (no config store), as config/permission_pin.ts and config/model_pin.ts are: config.ts gives its
10
+ * ConfigStore's view of the session (followHostedSession), and the backends read it without importing the store.
11
+ */
12
+ /**
13
+ * The variable a host sets to 1 where it runs ZTC for someone: ZergRouter's hosted runtime (its mux workbench, as its
14
+ * image and its launch set it), a resident on a host's thread, and a zerg service's one-shot headless run once that
15
+ * service sets it: zerg's run_headless_ztc doesn't yet, as the child environment it builds keeps an allowlist without it.
16
+ */
17
+ export declare const HOSTED_ENV = "ZTC_HOSTED";
18
+ /** Whether SOURCE says a host runs this ZTC: ZTC_HOSTED is 1, as ZTC reads it everywhere; any other value says nothing. */
19
+ export declare function hostedRequested(source?: NodeJS.ProcessEnv): boolean;
20
+ /**
21
+ * Why a headless start its host runs (ZTC_HOSTED=1) doesn't start on its permission profile, as a host's pin refuses the
22
+ * same (ConfigStore.hostedStartRefusal): 'unsandboxed', the agent runs commands without requiring an OS sandbox for them
23
+ * (config/profile_limits.ts agentRunsCommandsUnsandboxed); 'unrooted', it writes and runs them but names no allowedPaths,
24
+ * so each command's root is the folder the agent runs it in (utils/sandbox.ts commandWriteRootsFollowCwd).
25
+ */
26
+ export type HostedStartRefusal = 'unsandboxed' | 'unrooted';
27
+ /**
28
+ * What ZTC says as it refuses a headless start its host runs (ZTC_HOSTED=1) whose settings are its launch's (cli_main.ts,
29
+ * headless_cli.ts) where the permission profile it would run on, PROFILE_ID, runs the agent's commands without requiring
30
+ * an OS sandbox (WHY 'unsandboxed'), so they would run with whatever ZTC's own process can reach, or requires one but names
31
+ * no allowedPaths ('unrooted'), so each command writes in whatever folder the agent runs it in, as a host's pin refuses
32
+ * either (config/permission_pin.ts pinnedUnlimitedMessage and pinnedUnrootedMessage). It names the variable, and what to
33
+ * pass instead: a profile that requires the sandbox and names its roots, or runs no command. LAUNCH_FLAG: the entry point
34
+ * takes --permission-profile (zerg-ztc-headless takes the one config.json saves).
35
+ */
36
+ export declare function hostedStartRefusalMessage(profileId: string, why: HostedStartRefusal, launchFlag?: boolean): string;
37
+ /**
38
+ * What a headless run its host runs (ZTC_HOSTED=1) and doesn't pin says as it refuses, with no approval service to ask, a
39
+ * call to TOOL that starts a program outside the OS sandbox (a language server, run_and_capture's command, a Claude Code
40
+ * or Codex pane): it approves none by itself, as a pinned one doesn't (config/permission_pin.ts
41
+ * pinnedOutsideSandboxApprovalRefusal), since a profile that asks before each command passes the hosted start's check.
42
+ */
43
+ export declare function hostedOutsideSandboxApprovalRefusal(tool: string): string;
44
+ /** Read whether this process's session is a host's thread, or pinned by its host, from READ (config.ts gives its ConfigStore's). */
45
+ export declare function followHostedSession(read: () => boolean): void;
46
+ /**
47
+ * Whether ZTC runs here as its host's:
48
+ *
49
+ * - a hosted resident: ZTC_HOSTED=1, as ZergRouter's hosted runtime starts one, or a resident on a host's thread, the
50
+ * --session-file thread a headless mirror resident takes (ConfigStore.applyHostedThreadSettings), as ZTC's own
51
+ * hosted-runtime check reads them (cli_ratatui.ts isHostedRuntime, which also sets the mirror's hosted mode);
52
+ * - or a session whose host pinned its permission profile and sandbox: ZTC_PERMISSION_PROFILE_PINNED, as SOURCE asks for
53
+ * it (config/permission_pin.ts permissionPinRequested), or as the store holds it once startup pinned it.
54
+ *
55
+ * SOURCE is read for the variables, the store (followHostedSession) for the rest. A headless mirror alone is none:
56
+ * `ztc --headless-mirror-open` is the person's own browser session, whose commands need their SSH agent and toolchains.
57
+ */
58
+ export declare function hostedOrPinnedRuntime(source?: NodeJS.ProcessEnv): boolean;
59
+ /**
60
+ * The variable a host sets to 1 (or true) so that every Codex ZTC starts is given only the allowlisted names, as where
61
+ * ZTC runs as its host's, and nothing else changes: no hosted workbench's limits (ZTC_HOSTED refuses ZTC panes and
62
+ * profile switches) and no permission pin (which needs a profile that limits the agent, and an OS sandbox under it). A
63
+ * ZergCloud zerg's entrypoint (zerg/docker-entrypoint.sh) sets it: its ZTC is its person's, in an image with no bubblewrap.
64
+ */
65
+ export declare const CODEX_ENV_ALLOWLIST_ENV = "ZTC_CODEX_ENV_ALLOWLIST";
66
+ /**
67
+ * Whether every Codex ZTC starts here (the codex app-server, a Codex pane) is given only the allowlisted names: where
68
+ * ZTC runs as its host's (hostedOrPinnedRuntime), or where its host asks for that alone (CODEX_ENV_ALLOWLIST_ENV is 1 or
69
+ * true in SOURCE, as ZTC_PERMISSION_PROFILE_PINNED is read).
70
+ */
71
+ export declare function codexEnvAllowlisted(source?: NodeJS.ProcessEnv): boolean;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Whether ZTC runs as its host's, or its host asks for Codex's allowlist alone, where a program of someone else's that
3
+ * runs a model's commands (the codex app-server, and Codex in a pane) is given an allowlisted environment rather than the
4
+ * rest of the host's (agent/backends/codex_app_server.ts buildCodexAppServerEnv and codexPaneEnv); what a headless start
5
+ * its host runs (ZTC_HOSTED=1) says as it refuses a permission profile that runs the agent's commands without requiring an
6
+ * OS sandbox, or that lets them write wherever the agent runs them (cli_main.ts, headless_cli.ts); and what such a run
7
+ * says as it refuses, with no one to ask, a call that starts a program outside the sandbox (headless.ts).
8
+ *
9
+ * Self-contained (no config store), as config/permission_pin.ts and config/model_pin.ts are: config.ts gives its
10
+ * ConfigStore's view of the session (followHostedSession), and the backends read it without importing the store.
11
+ */
12
+ import { PERMISSION_PIN_ENV, permissionPinRequested } from './permission_pin.js';
13
+ /**
14
+ * The variable a host sets to 1 where it runs ZTC for someone: ZergRouter's hosted runtime (its mux workbench, as its
15
+ * image and its launch set it), a resident on a host's thread, and a zerg service's one-shot headless run once that
16
+ * service sets it: zerg's run_headless_ztc doesn't yet, as the child environment it builds keeps an allowlist without it.
17
+ */
18
+ export const HOSTED_ENV = 'ZTC_HOSTED';
19
+ /** Whether SOURCE says a host runs this ZTC: ZTC_HOSTED is 1, as ZTC reads it everywhere; any other value says nothing. */
20
+ export function hostedRequested(source = process.env) {
21
+ return source[HOSTED_ENV] === '1';
22
+ }
23
+ /**
24
+ * What ZTC says as it refuses a headless start its host runs (ZTC_HOSTED=1) whose settings are its launch's (cli_main.ts,
25
+ * headless_cli.ts) where the permission profile it would run on, PROFILE_ID, runs the agent's commands without requiring
26
+ * an OS sandbox (WHY 'unsandboxed'), so they would run with whatever ZTC's own process can reach, or requires one but names
27
+ * no allowedPaths ('unrooted'), so each command writes in whatever folder the agent runs it in, as a host's pin refuses
28
+ * either (config/permission_pin.ts pinnedUnlimitedMessage and pinnedUnrootedMessage). It names the variable, and what to
29
+ * pass instead: a profile that requires the sandbox and names its roots, or runs no command. LAUNCH_FLAG: the entry point
30
+ * takes --permission-profile (zerg-ztc-headless takes the one config.json saves).
31
+ */
32
+ export function hostedStartRefusalMessage(profileId, why, launchFlag = true) {
33
+ const limiting = 'a profile that requires the OS sandbox (sandbox.requireOsEnforcement) and names the folders it may write in '
34
+ + 'allowedPaths, as workspace_autonomous does, or one that runs no command (shell_exec off)';
35
+ const instead = launchFlag ? `Start ZTC with --permission-profile and ${limiting}` : `Save as permissionProfile in config.json ${limiting}`;
36
+ const what = why === 'unrooted'
37
+ ? 'lets the agent write and run commands but names no allowedPaths, so each command it runs may write in whatever folder the '
38
+ + 'agent runs it in, ZTC\'s own state included'
39
+ : 'doesn\'t require an OS sandbox (sandbox.requireOsEnforcement), so the agent\'s commands, and the programs some of its tools '
40
+ + 'start, can run outside one, where they reach whatever ZTC itself can, its own state included';
41
+ return `ZTC did not start: its host runs it (${HOSTED_ENV}=1), and the permission profile it would run on, ${profileId}, ${what}. `
42
+ + `${instead}, or set ${PERMISSION_PIN_ENV}=1 with such a profile.`;
43
+ }
44
+ /**
45
+ * What a headless run its host runs (ZTC_HOSTED=1) and doesn't pin says as it refuses, with no approval service to ask, a
46
+ * call to TOOL that starts a program outside the OS sandbox (a language server, run_and_capture's command, a Claude Code
47
+ * or Codex pane): it approves none by itself, as a pinned one doesn't (config/permission_pin.ts
48
+ * pinnedOutsideSandboxApprovalRefusal), since a profile that asks before each command passes the hosted start's check.
49
+ */
50
+ export function hostedOutsideSandboxApprovalRefusal(tool) {
51
+ return `Permission denied: ${tool} starts a program outside the OS sandbox, and ZTC approves no such call by itself where its `
52
+ + `host runs it (${HOSTED_ENV}=1). Give the run an approval service (--approval-url or ZTC_APPROVAL_URL) to decide it, or use `
53
+ + 'run_command, which runs inside the sandbox.';
54
+ }
55
+ /**
56
+ * What says this process's session is its host's beyond what its environment says: config.ts gives its ConfigStore's,
57
+ * a host's thread it took (--session-file) or a pin it holds. Nothing for ZTC used as a library that never loads a
58
+ * profile, whose environment alone says.
59
+ */
60
+ let sessionIsHosts = () => false;
61
+ /** Read whether this process's session is a host's thread, or pinned by its host, from READ (config.ts gives its ConfigStore's). */
62
+ export function followHostedSession(read) {
63
+ sessionIsHosts = read;
64
+ }
65
+ /**
66
+ * Whether ZTC runs here as its host's:
67
+ *
68
+ * - a hosted resident: ZTC_HOSTED=1, as ZergRouter's hosted runtime starts one, or a resident on a host's thread, the
69
+ * --session-file thread a headless mirror resident takes (ConfigStore.applyHostedThreadSettings), as ZTC's own
70
+ * hosted-runtime check reads them (cli_ratatui.ts isHostedRuntime, which also sets the mirror's hosted mode);
71
+ * - or a session whose host pinned its permission profile and sandbox: ZTC_PERMISSION_PROFILE_PINNED, as SOURCE asks for
72
+ * it (config/permission_pin.ts permissionPinRequested), or as the store holds it once startup pinned it.
73
+ *
74
+ * SOURCE is read for the variables, the store (followHostedSession) for the rest. A headless mirror alone is none:
75
+ * `ztc --headless-mirror-open` is the person's own browser session, whose commands need their SSH agent and toolchains.
76
+ */
77
+ export function hostedOrPinnedRuntime(source = process.env) {
78
+ return hostedRequested(source) || permissionPinRequested(source) || sessionIsHosts();
79
+ }
80
+ /**
81
+ * The variable a host sets to 1 (or true) so that every Codex ZTC starts is given only the allowlisted names, as where
82
+ * ZTC runs as its host's, and nothing else changes: no hosted workbench's limits (ZTC_HOSTED refuses ZTC panes and
83
+ * profile switches) and no permission pin (which needs a profile that limits the agent, and an OS sandbox under it). A
84
+ * ZergCloud zerg's entrypoint (zerg/docker-entrypoint.sh) sets it: its ZTC is its person's, in an image with no bubblewrap.
85
+ */
86
+ export const CODEX_ENV_ALLOWLIST_ENV = 'ZTC_CODEX_ENV_ALLOWLIST';
87
+ /**
88
+ * Whether every Codex ZTC starts here (the codex app-server, a Codex pane) is given only the allowlisted names: where
89
+ * ZTC runs as its host's (hostedOrPinnedRuntime), or where its host asks for that alone (CODEX_ENV_ALLOWLIST_ENV is 1 or
90
+ * true in SOURCE, as ZTC_PERMISSION_PROFILE_PINNED is read).
91
+ */
92
+ export function codexEnvAllowlisted(source = process.env) {
93
+ return /^(?:1|true)$/i.test(source[CODEX_ENV_ALLOWLIST_ENV]?.trim() ?? '') || hostedOrPinnedRuntime(source);
94
+ }
@@ -27,7 +27,10 @@
27
27
  * nothing (trusted, the default; local_full), whatever gave it (no launch flag, config.json, a host's thread with no
28
28
  * settings yet), or runs the agent's commands without requiring an OS sandbox (one that only turns a capability off, or
29
29
  * only asks for the sandbox), where they, and the programs some of its tools start, can reach ZTC's own state and the
30
- * config.json the pin is taken from, it doesn't start, and says so (PermissionPinUnlimitedError).
30
+ * config.json the pin is taken from, it doesn't start, and says so (PermissionPinUnlimitedError). Nor does it where ZTC's
31
+ * own state (ZTC_CONFIG_DIR, ~/.ztc, ZTC_SESSIONS_DIR, ZTC_WORKSPACE_LAYOUT_DIR) or TMPDIR, where its runtime keeps its
32
+ * credential hand-offs, lies inside a folder that profile lets the agent write (PermissionPinOwnStateInRootsError), nor
33
+ * where that profile writes but names no allowedPaths, so its commands write wherever they run (PermissionPinUnrootedError).
31
34
  *
32
35
  * Read once, as the session starts (ConfigStore.pinStartupPermissions): nothing later in the process unsets it (a
33
36
  * command, a config.json edit, a change of the process's environment), and a ZTC pane started from a pinned process is
@@ -68,6 +71,11 @@ export declare function pinnedFactoryResetMessage(): string;
68
71
  * Its host updates it, where it starts it; the person can still update an install from a shell (`ztc update`).
69
72
  */
70
73
  export declare function pinnedSelfUpdateMessage(): string;
74
+ /**
75
+ * Why a headless run under the pin approved no call of TOOL by itself: the call starts a program outside the OS sandbox
76
+ * (a language server, run_and_capture's command), and only a real approver decides one there (headless.ts).
77
+ */
78
+ export declare function pinnedOutsideSandboxApprovalRefusal(tool: string): string;
71
79
  /** What a refused config-profile switch says: NAME would hold other permission settings; the session stays on CURRENT. */
72
80
  export declare function pinnedPermissionsSwitchMessage(name: string, current: string): string;
73
81
  /**
@@ -152,6 +160,46 @@ export declare class PermissionPinUnlimitedError extends Error {
152
160
  readonly name = "PermissionPinUnlimitedError";
153
161
  constructor(profileId: string, unsandboxed?: boolean);
154
162
  }
163
+ /** A part of ZTC's own state, or a temp folder of its runtime, inside a folder a command may write (utils/ztc_own_state.ts). */
164
+ export interface PinnedOwnStateInRoot {
165
+ name: string;
166
+ path: string;
167
+ root: string;
168
+ /** Whether it is that root itself. */
169
+ itself?: boolean;
170
+ }
171
+ /**
172
+ * What ZTC says as it refuses to start where its host asked for the pin and ZTC's own state, or a temp folder its
173
+ * runtime keeps its hand-offs in, lies inside a folder the permission profile it would pin, PROFILE_ID, lets the agent
174
+ * write (INSIDE: what names each, where it is, and the root that holds it): a command there could rename a folder above
175
+ * it and carry it off under another name, forging the config.json the pin is taken from (which a cold start pins) or
176
+ * reading a credential ZTC hands over (the reviewer's follow-up review, N2 and N3). Own state may be a root of its own, or
177
+ * a folder directly in one that is no link, which both sandboxes hold; TMPDIR may be neither (ztcOwnStateInRoots). It
178
+ * says what to do instead.
179
+ */
180
+ export declare function pinnedOwnStateInRootsMessage(profileId: string, inside: readonly PinnedOwnStateInRoot[]): string;
181
+ /**
182
+ * What ZTC says as it refuses to start where its host asked for the pin and the permission profile it would pin,
183
+ * PROFILE_ID, lets the agent write and run commands but names no allowedPaths: each command it runs then writes wherever
184
+ * it runs (its folder is its root), which the agent chooses, so nothing keeps ZTC's own state or TMPDIR, where its
185
+ * runtime keeps its credential hand-offs, out of its reach (the review of fix/sandbox-ancestor-pins,
186
+ * PIN-ROOT-OVERLAP-CWD-ROOTS: a command run in TMPDIR read a pane credential ZTC handed over while it ran). It says what
187
+ * to do instead.
188
+ */
189
+ export declare function pinnedUnrootedMessage(profileId: string): string;
190
+ /** A session its host asked to pin whose profile writes and runs commands but names no allowedPaths: it doesn't start. */
191
+ export declare class PermissionPinUnrootedError extends Error {
192
+ readonly profileId: string;
193
+ readonly name = "PermissionPinUnrootedError";
194
+ constructor(profileId: string);
195
+ }
196
+ /** A session its host asked to pin whose own state lies inside a folder its profile lets the agent write: it doesn't start. */
197
+ export declare class PermissionPinOwnStateInRootsError extends Error {
198
+ readonly profileId: string;
199
+ readonly inside: readonly PinnedOwnStateInRoot[];
200
+ readonly name = "PermissionPinOwnStateInRootsError";
201
+ constructor(profileId: string, inside: readonly PinnedOwnStateInRoot[]);
202
+ }
155
203
  /** A change of a pinned session's permission settings: its message names the variable and nothing of the profile. */
156
204
  export declare class PermissionsPinnedError extends Error {
157
205
  readonly name = "PermissionsPinnedError";
@@ -27,7 +27,10 @@
27
27
  * nothing (trusted, the default; local_full), whatever gave it (no launch flag, config.json, a host's thread with no
28
28
  * settings yet), or runs the agent's commands without requiring an OS sandbox (one that only turns a capability off, or
29
29
  * only asks for the sandbox), where they, and the programs some of its tools start, can reach ZTC's own state and the
30
- * config.json the pin is taken from, it doesn't start, and says so (PermissionPinUnlimitedError).
30
+ * config.json the pin is taken from, it doesn't start, and says so (PermissionPinUnlimitedError). Nor does it where ZTC's
31
+ * own state (ZTC_CONFIG_DIR, ~/.ztc, ZTC_SESSIONS_DIR, ZTC_WORKSPACE_LAYOUT_DIR) or TMPDIR, where its runtime keeps its
32
+ * credential hand-offs, lies inside a folder that profile lets the agent write (PermissionPinOwnStateInRootsError), nor
33
+ * where that profile writes but names no allowedPaths, so its commands write wherever they run (PermissionPinUnrootedError).
31
34
  *
32
35
  * Read once, as the session starts (ConfigStore.pinStartupPermissions): nothing later in the process unsets it (a
33
36
  * command, a config.json edit, a change of the process's environment), and a ZTC pane started from a pinned process is
@@ -88,6 +91,15 @@ export function pinnedSelfUpdateMessage() {
88
91
  + 'session\'s permission profile and sandbox, and a ZTC its host didn\'t choose might not hold them. Nothing was installed. '
89
92
  + 'Update ZTC where its host starts it, or with `ztc update` from a shell.';
90
93
  }
94
+ /**
95
+ * Why a headless run under the pin approved no call of TOOL by itself: the call starts a program outside the OS sandbox
96
+ * (a language server, run_and_capture's command), and only a real approver decides one there (headless.ts).
97
+ */
98
+ export function pinnedOutsideSandboxApprovalRefusal(tool) {
99
+ return `Permission denied: ${tool} starts a program outside the OS sandbox, and ZTC approves no such call by itself while `
100
+ + `its host pins this session's permission profile and sandbox (${PERMISSION_PIN_ENV}). Give the run an approval service `
101
+ + '(--approval-url or ZTC_APPROVAL_URL) to decide it, or use run_command, which runs inside the sandbox.';
102
+ }
91
103
  /** What a refused config-profile switch says: NAME would hold other permission settings; the session stays on CURRENT. */
92
104
  export function pinnedPermissionsSwitchMessage(name, current) {
93
105
  return `Config profile "${name}" holds another permission profile, sandbox or tool permissions than this session. `
@@ -210,6 +222,59 @@ export class PermissionPinUnlimitedError extends Error {
210
222
  this.unsandboxed = unsandboxed;
211
223
  }
212
224
  }
225
+ /**
226
+ * What ZTC says as it refuses to start where its host asked for the pin and ZTC's own state, or a temp folder its
227
+ * runtime keeps its hand-offs in, lies inside a folder the permission profile it would pin, PROFILE_ID, lets the agent
228
+ * write (INSIDE: what names each, where it is, and the root that holds it): a command there could rename a folder above
229
+ * it and carry it off under another name, forging the config.json the pin is taken from (which a cold start pins) or
230
+ * reading a credential ZTC hands over (the reviewer's follow-up review, N2 and N3). Own state may be a root of its own, or
231
+ * a folder directly in one that is no link, which both sandboxes hold; TMPDIR may be neither (ztcOwnStateInRoots). It
232
+ * says what to do instead.
233
+ */
234
+ export function pinnedOwnStateInRootsMessage(profileId, inside) {
235
+ const listed = inside.map(({ name, path, root, itself }) => (itself ? `${name} (${path}), a root itself` : `${name} (${path}) inside ${root}`))
236
+ .join('; ');
237
+ return `ZTC did not start: its host pins this session's permission profile and sandbox (${PERMISSION_PIN_ENV}), and ZTC's own `
238
+ + `state lies inside a folder the permission profile it would pin, ${profileId}, lets the agent write: ${listed}. A command `
239
+ + 'there could rename a folder above it and carry it off under another name, forging the config.json the pin is taken from '
240
+ + 'or reading a credential ZTC hands over. Keep ZTC_CONFIG_DIR, ~/.ztc, ZTC_SESSIONS_DIR and ZTC_WORKSPACE_LAYOUT_DIR outside '
241
+ + 'the profile\'s allowedPaths, or each as a root of its own or a folder directly in one that is no link; keep TMPDIR outside '
242
+ + `them all; or unset ${PERMISSION_PIN_ENV}.`;
243
+ }
244
+ /**
245
+ * What ZTC says as it refuses to start where its host asked for the pin and the permission profile it would pin,
246
+ * PROFILE_ID, lets the agent write and run commands but names no allowedPaths: each command it runs then writes wherever
247
+ * it runs (its folder is its root), which the agent chooses, so nothing keeps ZTC's own state or TMPDIR, where its
248
+ * runtime keeps its credential hand-offs, out of its reach (the review of fix/sandbox-ancestor-pins,
249
+ * PIN-ROOT-OVERLAP-CWD-ROOTS: a command run in TMPDIR read a pane credential ZTC handed over while it ran). It says what
250
+ * to do instead.
251
+ */
252
+ export function pinnedUnrootedMessage(profileId) {
253
+ return `ZTC did not start: its host pins this session's permission profile and sandbox (${PERMISSION_PIN_ENV}), and the `
254
+ + `permission profile it would pin, ${profileId}, lets the agent write and run commands but names no allowedPaths, so each `
255
+ + 'command it runs writes wherever it runs, ZTC\'s own state and TMPDIR among them. Name the folders it may write in its '
256
+ + `allowedPaths (\`.\` for the folder ZTC starts in), or unset ${PERMISSION_PIN_ENV}.`;
257
+ }
258
+ /** A session its host asked to pin whose profile writes and runs commands but names no allowedPaths: it doesn't start. */
259
+ export class PermissionPinUnrootedError extends Error {
260
+ profileId;
261
+ name = 'PermissionPinUnrootedError';
262
+ constructor(profileId) {
263
+ super(pinnedUnrootedMessage(profileId));
264
+ this.profileId = profileId;
265
+ }
266
+ }
267
+ /** A session its host asked to pin whose own state lies inside a folder its profile lets the agent write: it doesn't start. */
268
+ export class PermissionPinOwnStateInRootsError extends Error {
269
+ profileId;
270
+ inside;
271
+ name = 'PermissionPinOwnStateInRootsError';
272
+ constructor(profileId, inside) {
273
+ super(pinnedOwnStateInRootsMessage(profileId, inside));
274
+ this.profileId = profileId;
275
+ this.inside = inside;
276
+ }
277
+ }
213
278
  /** A change of a pinned session's permission settings: its message names the variable and nothing of the profile. */
214
279
  export class PermissionsPinnedError extends Error {
215
280
  name = 'PermissionsPinnedError';