@zergai/ztc 0.17.0-beta.1 → 0.18.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bin/zmux-darwin-arm64 +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/zterm-darwin-arm64 +1 -1
- package/dist/App.js +21 -7
- package/dist/agent/backends/router_gate.js +3 -2
- package/dist/agent/backends/router_refusal_record.d.ts +12 -2
- package/dist/agent/backends/router_refusal_record.js +19 -4
- package/dist/agent/tools/pane.d.ts +6 -1
- package/dist/agent/tools/pane.js +6 -4
- package/dist/app/mirror_startup.d.ts +7 -0
- package/dist/app/mirror_startup.js +10 -0
- package/dist/app/restart.d.ts +6 -0
- package/dist/app/restart.js +13 -3
- package/dist/app/workspace_monitor.js +17 -3
- package/dist/app/workspace_presets.js +8 -1
- package/dist/cli_main.js +5 -0
- package/dist/cli_ratatui.d.ts +87 -18
- package/dist/cli_ratatui.js +234 -129
- package/dist/embedded/anempa_runtime.js +3 -0
- package/dist/embedded/gameboy_runtime.js +4 -2
- package/dist/embedded/zergpod_runtime.js +4 -2
- package/dist/environment/store.js +4 -1
- package/dist/mcp/client.js +6 -2
- package/dist/mcp/workspace_server.d.ts +7 -3
- package/dist/mcp/workspace_server.js +15 -8
- package/dist/panes/agent_cli.d.ts +10 -3
- package/dist/panes/agent_cli.js +16 -4
- package/dist/runtime_info.js +10 -1
- package/dist/simulation/engines/swarm/pane_manager.d.ts +16 -3
- package/dist/simulation/engines/swarm/pane_manager.js +39 -17
- package/dist/types.d.ts +5 -2
- package/dist/ui/ratatui/headless_pane_manager.d.ts +13 -1
- package/dist/ui/ratatui/headless_pane_manager.js +37 -8
- package/dist/ui/ratatui/pane_credential_broker.d.ts +107 -0
- package/dist/ui/ratatui/pane_credential_broker.js +239 -0
- package/dist/ui/ratatui/pane_relay.js +4 -2
- package/dist/ui/ratatui/process.d.ts +13 -0
- package/dist/ui/ratatui/process.js +38 -3
- package/dist/utils/subprocess_env.js +1 -0
- package/dist/web/mirror_authenticator.d.ts +27 -11
- package/dist/web/mirror_authenticator.js +36 -12
- package/dist/web/mirror_client.d.ts +2 -1
- package/dist/web/mirror_client.js +7 -5
- package/dist/web/mirror_stream.d.ts +39 -8
- package/dist/web/mirror_stream.js +164 -29
- package/dist/web/pane_credentials.d.ts +131 -0
- package/dist/web/pane_credentials.js +302 -0
- package/dist/zlm-embed.mjs +2 -1
- package/package.json +11 -46
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Carved out of MirrorStreamServer. Single owner of:
|
|
5
5
|
* - the HMAC token scheme (mint + verify, timing-safe, 2-part legacy + 3-part),
|
|
6
|
-
* - the request/upgrade authorization precedence (internal-token ->
|
|
7
|
-
* token -> session cookie -> policy fallback),
|
|
6
|
+
* - the request/upgrade authorization precedence (internal-token -> pane
|
|
7
|
+
* credential -> bearer/query token -> session cookie -> policy fallback),
|
|
8
8
|
* - the in-memory session store,
|
|
9
9
|
* - the auth-enabled policy.
|
|
10
10
|
*
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
* OpenMirrorAuthenticator (dev/local — softens the final deny to allow, while the
|
|
16
16
|
* token path still issues a scoped session so a dev superuser keeps prompt access).
|
|
17
17
|
*
|
|
18
|
-
* Self-contained: depends only on node crypto
|
|
19
|
-
* from the transport, so the
|
|
18
|
+
* Self-contained: depends only on node crypto, the URL/header shapes and the
|
|
19
|
+
* self-contained pane credential store. No imports from the transport, so the
|
|
20
|
+
* dependency stays one-way (mirror_stream -> here).
|
|
20
21
|
*/
|
|
22
|
+
import { PaneCredentialStore, type PanePrincipal } from './pane_credentials.js';
|
|
21
23
|
export interface MirrorSession {
|
|
22
24
|
expiresAtMs: number;
|
|
23
25
|
canInspectPrompts: boolean;
|
|
@@ -51,11 +53,14 @@ export interface MirrorAuthDecision {
|
|
|
51
53
|
/** Set iff a token (not an existing cookie) authenticated — the transport writes the cookie. */
|
|
52
54
|
issueCookie: MirrorSession | null;
|
|
53
55
|
/**
|
|
54
|
-
* Which credential authorized the request. 'internal'
|
|
55
|
-
*
|
|
56
|
-
* dev-mode softened allow;
|
|
56
|
+
* Which credential authorized the request. 'internal' is the process-wide token, ZTC's
|
|
57
|
+
* own; 'pane' is one pane's credential (see pane_credentials.ts), naming that pane in
|
|
58
|
+
* `pane`; 'browser' is a token/cookie session; 'open' is the dev-mode softened allow;
|
|
59
|
+
* null is a deny.
|
|
57
60
|
*/
|
|
58
|
-
source: 'internal' | 'browser' | 'open' | null;
|
|
61
|
+
source: 'internal' | 'pane' | 'browser' | 'open' | null;
|
|
62
|
+
/** The pane a 'pane' credential stands for; absent for every other source. */
|
|
63
|
+
pane?: PanePrincipal;
|
|
59
64
|
}
|
|
60
65
|
export interface MirrorAuthContext {
|
|
61
66
|
headers: NodeJS.Dict<string | string[]>;
|
|
@@ -74,6 +79,12 @@ export interface MirrorAuthenticator {
|
|
|
74
79
|
readonly zergId: string;
|
|
75
80
|
readonly cookieName: string;
|
|
76
81
|
readonly queryTokenName: string;
|
|
82
|
+
/**
|
|
83
|
+
* The credentials of the panes that talk to this mirror. A mirror that listens sets its port's store, which every
|
|
84
|
+
* mirror on that port in this process shares (see adoptPaneCredentialStore); until then it is one no pane transport
|
|
85
|
+
* can reach, so no pane credential authenticates.
|
|
86
|
+
*/
|
|
87
|
+
paneCredentials: PaneCredentialStore;
|
|
77
88
|
issueToken(opts?: MirrorTokenOptions): string;
|
|
78
89
|
listShares(): MirrorShare[];
|
|
79
90
|
revokeShare(id: string): boolean;
|
|
@@ -94,6 +105,7 @@ export declare class HmacMirrorAuthenticator implements MirrorAuthenticator {
|
|
|
94
105
|
readonly queryTokenName: string;
|
|
95
106
|
protected readonly sharedSecret: string;
|
|
96
107
|
protected readonly internalToken: string;
|
|
108
|
+
paneCredentials: PaneCredentialStore;
|
|
97
109
|
protected readonly sessions: Map<string, MirrorSession>;
|
|
98
110
|
private readonly shares;
|
|
99
111
|
private readonly revocationListeners;
|
|
@@ -109,6 +121,7 @@ export declare class HmacMirrorAuthenticator implements MirrorAuthenticator {
|
|
|
109
121
|
getSession(sessionId: string): MirrorSession | null;
|
|
110
122
|
clearSession(sessionId: string): void;
|
|
111
123
|
protected matchesInternalToken(headers: NodeJS.Dict<string | string[]>): boolean;
|
|
124
|
+
protected paneTokenOf(headers: NodeJS.Dict<string | string[]>): string;
|
|
112
125
|
protected extractBearerToken(headers: NodeJS.Dict<string | string[]>): string;
|
|
113
126
|
protected sessionFromCookies(cookies: Record<string, string>): MirrorSession | null;
|
|
114
127
|
}
|
|
@@ -124,8 +137,11 @@ export declare class OpenMirrorAuthenticator extends HmacMirrorAuthenticator {
|
|
|
124
137
|
}
|
|
125
138
|
/**
|
|
126
139
|
* Build the authenticator from environment policy, mirroring the legacy
|
|
127
|
-
* MirrorStreamServer constructor: derive the enabled flag
|
|
128
|
-
* secret
|
|
129
|
-
*
|
|
140
|
+
* MirrorStreamServer constructor: derive the enabled flag and self-mint the shared
|
|
141
|
+
* secret and the internal token, writing them back to process.env so the rest of
|
|
142
|
+
* this process (another mirror it runs, its own helpers) shares them. No pane or
|
|
143
|
+
* renderer inherits either: the renderer is spawned without them, every pane
|
|
144
|
+
* transport clears them, and each pane gets a credential of its own instead (see
|
|
145
|
+
* pane_credentials.ts).
|
|
130
146
|
*/
|
|
131
147
|
export declare function createMirrorAuthenticatorFromEnv(): MirrorAuthenticator;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Carved out of MirrorStreamServer. Single owner of:
|
|
5
5
|
* - the HMAC token scheme (mint + verify, timing-safe, 2-part legacy + 3-part),
|
|
6
|
-
* - the request/upgrade authorization precedence (internal-token ->
|
|
7
|
-
* token -> session cookie -> policy fallback),
|
|
6
|
+
* - the request/upgrade authorization precedence (internal-token -> pane
|
|
7
|
+
* credential -> bearer/query token -> session cookie -> policy fallback),
|
|
8
8
|
* - the in-memory session store,
|
|
9
9
|
* - the auth-enabled policy.
|
|
10
10
|
*
|
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
* OpenMirrorAuthenticator (dev/local — softens the final deny to allow, while the
|
|
16
16
|
* token path still issues a scoped session so a dev superuser keeps prompt access).
|
|
17
17
|
*
|
|
18
|
-
* Self-contained: depends only on node crypto
|
|
19
|
-
* from the transport, so the
|
|
18
|
+
* Self-contained: depends only on node crypto, the URL/header shapes and the
|
|
19
|
+
* self-contained pane credential store. No imports from the transport, so the
|
|
20
|
+
* dependency stays one-way (mirror_stream -> here).
|
|
20
21
|
*/
|
|
21
22
|
import { createHmac, randomUUID, timingSafeEqual } from 'crypto';
|
|
23
|
+
import { PANE_CREDENTIAL_HEADER, PaneCredentialStore } from './pane_credentials.js';
|
|
22
24
|
const DEFAULT_COOKIE_NAME = 'ztc_mirror_session';
|
|
23
25
|
const DEFAULT_QUERY_TOKEN_NAME = 'ztc_mirror_token';
|
|
24
26
|
const DEFAULT_TTL_MS = 12 * 60 * 60 * 1000;
|
|
@@ -31,6 +33,7 @@ export class HmacMirrorAuthenticator {
|
|
|
31
33
|
queryTokenName;
|
|
32
34
|
sharedSecret;
|
|
33
35
|
internalToken;
|
|
36
|
+
paneCredentials = new PaneCredentialStore();
|
|
34
37
|
sessions = new Map();
|
|
35
38
|
shares = new Map();
|
|
36
39
|
revocationListeners = new Set();
|
|
@@ -131,10 +134,20 @@ export class HmacMirrorAuthenticator {
|
|
|
131
134
|
return () => { this.revocationListeners.delete(callback); };
|
|
132
135
|
}
|
|
133
136
|
authenticate(ctx) {
|
|
134
|
-
// 1. Internal-token header (process-internal callers).
|
|
137
|
+
// 1. Internal-token header (ZTC's own, process-internal callers).
|
|
135
138
|
if (this.matchesInternalToken(ctx.headers)) {
|
|
136
139
|
return { ok: true, session: null, issueCookie: null, source: 'internal' };
|
|
137
140
|
}
|
|
141
|
+
// 1b. A pane's own credential authenticates as that pane or as nothing: it never
|
|
142
|
+
// falls through to a session or to open mode, so a closed pane's credential,
|
|
143
|
+
// or one still waiting for its pane, is refused outright.
|
|
144
|
+
const paneToken = this.paneTokenOf(ctx.headers);
|
|
145
|
+
if (paneToken) {
|
|
146
|
+
const pane = this.paneCredentials.resolve(paneToken);
|
|
147
|
+
if (pane && pane !== 'pending')
|
|
148
|
+
return { ok: true, session: null, issueCookie: null, source: 'pane', pane };
|
|
149
|
+
return { ok: false, session: null, issueCookie: null, source: null };
|
|
150
|
+
}
|
|
138
151
|
// 2. Bearer (Authorization header) or query token. A valid one mints a scoped
|
|
139
152
|
// session the transport should persist as a cookie.
|
|
140
153
|
const bearer = this.extractBearerToken(ctx.headers);
|
|
@@ -164,7 +177,8 @@ export class HmacMirrorAuthenticator {
|
|
|
164
177
|
}
|
|
165
178
|
authenticateUpgrade(ctx) {
|
|
166
179
|
const decision = this.authenticate(ctx);
|
|
167
|
-
|
|
180
|
+
// A pane credential is for a pane's own bus and publications, never the voice stream.
|
|
181
|
+
return decision.ok && decision.source !== 'pane' && decision.session?.canControl !== false;
|
|
168
182
|
}
|
|
169
183
|
persistSession(session) {
|
|
170
184
|
const sessionId = randomUUID();
|
|
@@ -194,6 +208,10 @@ export class HmacMirrorAuthenticator {
|
|
|
194
208
|
const provided = Buffer.from(header, 'utf8');
|
|
195
209
|
return expected.length === provided.length && timingSafeEqual(expected, provided);
|
|
196
210
|
}
|
|
211
|
+
paneTokenOf(headers) {
|
|
212
|
+
const value = headers[PANE_CREDENTIAL_HEADER];
|
|
213
|
+
return (Array.isArray(value) ? value[0] ?? '' : value ?? '').trim();
|
|
214
|
+
}
|
|
197
215
|
extractBearerToken(headers) {
|
|
198
216
|
const authHeader = String(headers['authorization'] || '');
|
|
199
217
|
if (!authHeader)
|
|
@@ -220,6 +238,10 @@ export class OpenMirrorAuthenticator extends HmacMirrorAuthenticator {
|
|
|
220
238
|
const decision = super.authenticate(ctx);
|
|
221
239
|
if (decision.ok)
|
|
222
240
|
return decision;
|
|
241
|
+
// A refused pane credential stays refused: softening it would make a closed pane's
|
|
242
|
+
// credential stand for the person.
|
|
243
|
+
if (this.paneTokenOf(ctx.headers))
|
|
244
|
+
return decision;
|
|
223
245
|
const candidate = this.extractBearerToken(ctx.headers) || ctx.url.searchParams.get(this.queryTokenName) || '';
|
|
224
246
|
if (this.enabled || candidate.split('.')[1] === 'observe')
|
|
225
247
|
return decision;
|
|
@@ -228,9 +250,12 @@ export class OpenMirrorAuthenticator extends HmacMirrorAuthenticator {
|
|
|
228
250
|
}
|
|
229
251
|
/**
|
|
230
252
|
* Build the authenticator from environment policy, mirroring the legacy
|
|
231
|
-
* MirrorStreamServer constructor: derive the enabled flag
|
|
232
|
-
* secret
|
|
233
|
-
*
|
|
253
|
+
* MirrorStreamServer constructor: derive the enabled flag and self-mint the shared
|
|
254
|
+
* secret and the internal token, writing them back to process.env so the rest of
|
|
255
|
+
* this process (another mirror it runs, its own helpers) shares them. No pane or
|
|
256
|
+
* renderer inherits either: the renderer is spawned without them, every pane
|
|
257
|
+
* transport clears them, and each pane gets a credential of its own instead (see
|
|
258
|
+
* pane_credentials.ts).
|
|
234
259
|
*/
|
|
235
260
|
export function createMirrorAuthenticatorFromEnv() {
|
|
236
261
|
const runtimeEnv = (process.env.ZTC_MIRROR_RUNTIME_ENV || process.env.NODE_ENV || 'development').trim() || 'development';
|
|
@@ -251,9 +276,8 @@ export function createMirrorAuthenticatorFromEnv() {
|
|
|
251
276
|
sharedSecret = randomUUID();
|
|
252
277
|
process.env.ZTC_MIRROR_SHARED_SECRET = sharedSecret;
|
|
253
278
|
}
|
|
254
|
-
// Always mint an internal token (even in dev/open mode)
|
|
255
|
-
//
|
|
256
|
-
// process.env so spawned panes inherit it.
|
|
279
|
+
// Always mint an internal token (even in dev/open mode): it is ZTC's own credential
|
|
280
|
+
// for the internal-only endpoints, kept in this process. Panes use their own.
|
|
257
281
|
let internalToken = (process.env.ZTC_MIRROR_INTERNAL_TOKEN || '').trim();
|
|
258
282
|
if (!internalToken) {
|
|
259
283
|
internalToken = randomUUID();
|
|
@@ -24,7 +24,8 @@ export declare class MirrorClient implements MirrorPublisher {
|
|
|
24
24
|
private busReconnectTimer;
|
|
25
25
|
private paneName;
|
|
26
26
|
private lastTokenUsage;
|
|
27
|
-
|
|
27
|
+
/** The pane's own mirror credential, presented on every request (see pane_credentials.ts). */
|
|
28
|
+
private credential;
|
|
28
29
|
private groupId;
|
|
29
30
|
private readonly publicationTimeoutMs;
|
|
30
31
|
private publicationId;
|
|
@@ -14,6 +14,7 @@ import { parseToolProgress } from '../tool_progress.js';
|
|
|
14
14
|
import { parseTaskHandoffView } from './view_plugin.js';
|
|
15
15
|
import { randomUUID } from 'node:crypto';
|
|
16
16
|
import { MAX_TOOL_IMAGE_BODY_BYTES, mirrorToolImage } from './tool_image.js';
|
|
17
|
+
import { paneMirrorCredentialHeaders } from './pane_credentials.js';
|
|
17
18
|
const MAX_PENDING_PUBLICATIONS = 256;
|
|
18
19
|
const MAX_PENDING_PUBLICATION_BYTES = 2 * 1024 * 1024;
|
|
19
20
|
const MAX_CHILD_EVENT_BYTES = 512 * 1024 - 512;
|
|
@@ -26,7 +27,8 @@ export class MirrorClient {
|
|
|
26
27
|
busReconnectTimer = null;
|
|
27
28
|
paneName;
|
|
28
29
|
lastTokenUsage = null;
|
|
29
|
-
|
|
30
|
+
/** The pane's own mirror credential, presented on every request (see pane_credentials.ts). */
|
|
31
|
+
credential;
|
|
30
32
|
groupId;
|
|
31
33
|
publicationTimeoutMs;
|
|
32
34
|
publicationId = null;
|
|
@@ -47,7 +49,7 @@ export class MirrorClient {
|
|
|
47
49
|
}
|
|
48
50
|
this.publicationTimeoutMs = timeout;
|
|
49
51
|
this.paneName = paneId > 0 ? `ZTC ${paneId}` : 'ZTC';
|
|
50
|
-
this.
|
|
52
|
+
this.credential = paneMirrorCredentialHeaders(process.env);
|
|
51
53
|
this.groupId = process.env.ZTC_MIRROR_GROUP || '';
|
|
52
54
|
}
|
|
53
55
|
getPaneId() {
|
|
@@ -153,7 +155,7 @@ export class MirrorClient {
|
|
|
153
155
|
path: this.groupId ? `${path}/${this.groupId}` : path,
|
|
154
156
|
method: 'POST', headers: {
|
|
155
157
|
'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload),
|
|
156
|
-
...
|
|
158
|
+
...this.credential,
|
|
157
159
|
...(toolImage ? { 'x-ztc-tool-image': '1' } : {}),
|
|
158
160
|
},
|
|
159
161
|
}, res => {
|
|
@@ -220,7 +222,7 @@ export class MirrorClient {
|
|
|
220
222
|
method: 'GET',
|
|
221
223
|
headers: {
|
|
222
224
|
Accept: 'text/event-stream',
|
|
223
|
-
...
|
|
225
|
+
...this.credential,
|
|
224
226
|
},
|
|
225
227
|
}, (res) => {
|
|
226
228
|
let buffer = '';
|
|
@@ -276,7 +278,7 @@ export class MirrorClient {
|
|
|
276
278
|
headers: {
|
|
277
279
|
'Content-Type': 'application/json',
|
|
278
280
|
'Content-Length': Buffer.byteLength(payload),
|
|
279
|
-
...
|
|
281
|
+
...this.credential,
|
|
280
282
|
},
|
|
281
283
|
}, (res) => {
|
|
282
284
|
// Consume response body to avoid memory leaks
|
|
@@ -15,6 +15,8 @@ import type { UsageSnapshot } from '../usage_snapshot.js';
|
|
|
15
15
|
import { type AccountOpResult } from './accounts_mirror.js';
|
|
16
16
|
/** The bus member a person in the browser mirror speaks as ("User"); panes and the coordinator are 0 and up. */
|
|
17
17
|
export declare const BROWSER_BUS_MEMBER_ID = -1;
|
|
18
|
+
/** The bus member of the ZTC that runs the mirror ("Overseer", or a sim's coordinator): the parent of every pane on it. */
|
|
19
|
+
export declare const OVERSEER_BUS_MEMBER_ID = 0;
|
|
18
20
|
export type MirrorEventType = 'message' | 'stream_start' | 'reasoning_delta' | 'stream_delta' | 'stream_end' | 'tool_call' | 'tool_result' | 'status' | 'token_usage' | 'error' | 'cancel' | 'mode_change' | 'pane_info' | 'pane_output' | 'zde_lite_state' | 'session_end' | 'reload' | 'clear' | 'todo_list' | 'prompt_entry' | 'ask_user' | 'queue_state' | 'command_pane' | 'command_jobs' | 'evidence' | 'goal' | 'task_handoff' | 'accounts' | 'open_accounts' | 'hook_approval_request' | 'widget_prompt' | 'widget_select' | 'widget_questionnaire' | 'widget_dismiss' | 'widget_settings' | 'context_progress_bar_config' | 'zlicky_cursor' | 'zlicky_highlight' | 'zlicky_clear' | 'zlicky_status' | 'zlicky_capture_request' | 'cv_run_start' | 'cv_run_tick' | 'cv_run_end' | 'cv_diagnose_start' | 'cv_diagnose_classification' | 'cv_diagnose_proposal' | 'cv_diagnose_pr_opened' | 'cv_diagnose_end' | (string & {});
|
|
19
21
|
export interface MirrorEvent {
|
|
20
22
|
type: MirrorEventType;
|
|
@@ -369,11 +371,14 @@ export interface ZlickyWebStatus {
|
|
|
369
371
|
emergency_stop?: string;
|
|
370
372
|
}
|
|
371
373
|
/**
|
|
372
|
-
*
|
|
373
|
-
* /input
|
|
374
|
-
*
|
|
374
|
+
* Where what the mirror's input callback delivers came from: the person in the browser mirror (a browser session's
|
|
375
|
+
* /input, /submit and /pane-input for pane 0, in open mode a request with no credential, and in a hosted runtime what
|
|
376
|
+
* the host's proxy forwards for the signed-in owner); 'relayed', the same routes posted by a ZTC process or a pane (the
|
|
377
|
+
* process-wide internal token or a pane's own credential), which is never the person; or /broadcast, which only
|
|
378
|
+
* colony's AgentBridge posts to (the overseer's send_to_worktree tool and the colony dashboard's send) and which keeps
|
|
379
|
+
* the Router attempt it always had, though it is never the person's typing.
|
|
375
380
|
*/
|
|
376
|
-
export type MirrorInputVia = 'browser' | 'broadcast';
|
|
381
|
+
export type MirrorInputVia = 'browser' | 'relayed' | 'broadcast';
|
|
377
382
|
export type InputCallback = (input: MessageInput, via: MirrorInputVia) => void;
|
|
378
383
|
export interface HookApprovalPublishPayload {
|
|
379
384
|
id: string;
|
|
@@ -938,16 +943,42 @@ export declare class MirrorStreamServer implements MirrorPublisher {
|
|
|
938
943
|
*/
|
|
939
944
|
private authenticateRequest;
|
|
940
945
|
private requireInternalAuth;
|
|
941
|
-
|
|
946
|
+
/**
|
|
947
|
+
* May this caller act as pane PANE_ID: join the bus as it, publish as it? The process-wide token is ZTC's own and may
|
|
948
|
+
* act for any pane; a pane's credential only for its own pane; nothing else for any.
|
|
949
|
+
*/
|
|
950
|
+
private requirePaneIdentity;
|
|
951
|
+
/** The process-wide token, or a workspace monitor's own credential (the runtime and decisions it shows). */
|
|
952
|
+
private requireWorkspaceMonitor;
|
|
953
|
+
/**
|
|
954
|
+
* Is this caller the person? A browser session is, and in open mode so is a request with no credential. The
|
|
955
|
+
* process-wide token is ZTC's own, never the person's, except in a hosted runtime: there the host's same-origin proxy
|
|
956
|
+
* (zapps/zergrouter server/lib/ztc-mirror-proxy.ts) forwards the signed-in owner's own browser requests with it, the
|
|
957
|
+
* only mirror credential it lets through, and no pane runs to hold it.
|
|
958
|
+
*/
|
|
959
|
+
private speaksForPerson;
|
|
960
|
+
/**
|
|
961
|
+
* Who a caller is on the bus, from how it authenticated, never from what it writes: the person (speaksForPerson) is
|
|
962
|
+
* the browser member; a pane's credential is that pane; the process-wide token is ZTC's own and may speak as any pane
|
|
963
|
+
* or the overseer, and as the person only in a hosted runtime.
|
|
964
|
+
*/
|
|
965
|
+
private mayClaimBusMember;
|
|
966
|
+
/** Where input this caller posts to /input, /submit or /pane-input came from (see MirrorInputVia). */
|
|
967
|
+
private inputVia;
|
|
968
|
+
/** The bus member that input this caller posts for another pane speaks as: the person only for the person. */
|
|
969
|
+
private inputSender;
|
|
970
|
+
/** May a pane's own credential use this route? (See PANE_CREDENTIAL_PATHS.) */
|
|
971
|
+
private paneCredentialReaches;
|
|
942
972
|
/**
|
|
943
973
|
* May this principal mutate the account pool (POST /mirror/account)? Those ops
|
|
944
974
|
* have real host side effects — `login` spawns an OAuth flow on the ztc host;
|
|
945
975
|
* use/add/remove rewrite the pool — so they are operator-only, on the
|
|
946
976
|
* same bar as /debug/prompts. Open mode = the trusted local operator on their
|
|
947
|
-
* own loopback mirror; internal =
|
|
977
|
+
* own loopback mirror; internal = ZTC's own process-internal caller. A
|
|
948
978
|
* browser session is the operator only when it carries the superuser scope
|
|
949
|
-
* (canInspectPrompts); a shared, non-superuser viewer is refused
|
|
950
|
-
*
|
|
979
|
+
* (canInspectPrompts); a shared, non-superuser viewer is refused, and so is a
|
|
980
|
+
* pane's credential (which never reaches this route). Reached only past the
|
|
981
|
+
* !auth.ok guard, so `null` is unreachable — enumerated for clarity.
|
|
951
982
|
*/
|
|
952
983
|
private canMutateAccounts;
|
|
953
984
|
private authenticateUpgrade;
|