@camstack/addon-terminal 0.1.30 → 0.1.31
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/dist/addon.js +143 -20
- package/dist/addon.mjs +143 -20
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -20003,6 +20003,9 @@ method(_void(), ProviderInfoSchema), method(object({ config: record(string(), un
|
|
|
20003
20003
|
location: StorageLocationSchema,
|
|
20004
20004
|
relativePath: string()
|
|
20005
20005
|
}), _void(), { kind: "mutation" }), method(object({ location: StorageLocationSchema }), number().nullable()), method(BeginUploadInputSchema, BeginUploadResultSchema, { kind: "mutation" }), method(WriteChunkInputSchema, _void(), { kind: "mutation" }), method(FinalizeUploadInputSchema, _void(), { kind: "mutation" }), method(AbortUploadInputSchema, _void(), { kind: "mutation" }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, { kind: "mutation" }), method(ReadChunkInputSchema, _instanceof(Uint8Array)), method(EndDownloadInputSchema, _void(), { kind: "mutation" });
|
|
20006
|
+
/** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
|
|
20007
|
+
var ProfileSettingsSchemaBridge = unknown().nullable();
|
|
20008
|
+
var ProfileSettingsBagSchema = record(string(), unknown());
|
|
20006
20009
|
/**
|
|
20007
20010
|
* A live terminal session hosted by the provider addon. Output and input do
|
|
20008
20011
|
* NOT flow through the capability — they use the addon data plane
|
|
@@ -20037,7 +20040,9 @@ var TerminalProfileInfoSchema = object({
|
|
|
20037
20040
|
executable: string().optional(),
|
|
20038
20041
|
args: array(string()).readonly().optional(),
|
|
20039
20042
|
cwd: string().optional(),
|
|
20040
|
-
environment: array(string()).readonly().optional()
|
|
20043
|
+
environment: array(string()).readonly().optional(),
|
|
20044
|
+
/** ConfigUISchema for instance knobs, or null when the profile has none. */
|
|
20045
|
+
settingsSchema: ProfileSettingsSchemaBridge.optional()
|
|
20041
20046
|
});
|
|
20042
20047
|
/**
|
|
20043
20048
|
* A durable operator-created Terminal instance. Profiles are templates; only
|
|
@@ -20054,7 +20059,8 @@ var TerminalInstanceInfoSchema = object({
|
|
|
20054
20059
|
executable: string(),
|
|
20055
20060
|
args: array(string()).readonly(),
|
|
20056
20061
|
cwd: string(),
|
|
20057
|
-
environment: array(string()).readonly()
|
|
20062
|
+
environment: array(string()).readonly(),
|
|
20063
|
+
profileSettings: ProfileSettingsBagSchema
|
|
20058
20064
|
});
|
|
20059
20065
|
var TerminalLegacyCameraSchema = object({
|
|
20060
20066
|
stableId: string(),
|
|
@@ -20104,7 +20110,8 @@ var terminalSessionCapability = {
|
|
|
20104
20110
|
executable: string().max(1024).optional(),
|
|
20105
20111
|
args: array(string().max(2048)).max(64).optional(),
|
|
20106
20112
|
cwd: string().max(1024).optional(),
|
|
20107
|
-
environment: array(string().max(4096)).max(64).optional()
|
|
20113
|
+
environment: array(string().max(4096)).max(64).optional(),
|
|
20114
|
+
profileSettings: ProfileSettingsBagSchema.optional()
|
|
20108
20115
|
}), TerminalInstanceInfoSchema, {
|
|
20109
20116
|
kind: "mutation",
|
|
20110
20117
|
auth: "admin"
|
|
@@ -20115,7 +20122,8 @@ var terminalSessionCapability = {
|
|
|
20115
20122
|
executable: string().max(1024).optional(),
|
|
20116
20123
|
args: array(string().max(2048)).max(64).optional(),
|
|
20117
20124
|
cwd: string().max(1024).optional(),
|
|
20118
|
-
environment: array(string().max(4096)).max(64).optional()
|
|
20125
|
+
environment: array(string().max(4096)).max(64).optional(),
|
|
20126
|
+
profileSettings: ProfileSettingsBagSchema.optional()
|
|
20119
20127
|
}), TerminalInstanceInfoSchema, {
|
|
20120
20128
|
kind: "mutation",
|
|
20121
20129
|
auth: "admin"
|
|
@@ -24043,10 +24051,10 @@ var lawnMowerControlCapability = {
|
|
|
24043
24051
|
*
|
|
24044
24052
|
* • The SDK (mobile / web client) consumes `getConnectionEndpoints()`
|
|
24045
24053
|
* to receive an ordered list of candidate base URLs it should race
|
|
24046
|
-
* on connect — LAN IPv4 first (lowest latency
|
|
24047
|
-
* then public hostname (if a tunnel is
|
|
24048
|
-
* race them with short timeouts and stick with the
|
|
24049
|
-
* session.
|
|
24054
|
+
* on connect — LAN IPv4 and stable LAN IPv6 first (lowest latency
|
|
24055
|
+
* when on the same network), then public hostname (if a tunnel is
|
|
24056
|
+
* up). The SDK can race them with short timeouts and stick with the
|
|
24057
|
+
* winner for the session.
|
|
24050
24058
|
*
|
|
24051
24059
|
* Why hub-only: agents are not directly addressable by the operator's
|
|
24052
24060
|
* clients — they reverse-connect to the hub. Exposing their interfaces
|
|
@@ -43292,7 +43300,7 @@ var require_xterm_headless = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
43292
43300
|
var import_addon_serialize = require_addon_serialize();
|
|
43293
43301
|
var import_xterm_headless = require_xterm_headless();
|
|
43294
43302
|
var SCROLLBACK_LINES = 2e3;
|
|
43295
|
-
function createXtermScreen(cols, rows) {
|
|
43303
|
+
function createXtermScreen$1(cols, rows) {
|
|
43296
43304
|
const term = new import_xterm_headless.Terminal({
|
|
43297
43305
|
cols,
|
|
43298
43306
|
rows,
|
|
@@ -43436,7 +43444,7 @@ var TerminalCameraRelay = class {
|
|
|
43436
43444
|
instanceId,
|
|
43437
43445
|
nodeId,
|
|
43438
43446
|
profileId,
|
|
43439
|
-
screen: createXtermScreen(120, 40),
|
|
43447
|
+
screen: createXtermScreen$1(120, 40),
|
|
43440
43448
|
sessionId: null,
|
|
43441
43449
|
cursor: 0,
|
|
43442
43450
|
clients: 0,
|
|
@@ -43493,7 +43501,7 @@ var TerminalCameraRelay = class {
|
|
|
43493
43501
|
applyBatch(state, batch) {
|
|
43494
43502
|
if (batch.reset) {
|
|
43495
43503
|
state.screen.dispose();
|
|
43496
|
-
state.screen = createXtermScreen(120, 40);
|
|
43504
|
+
state.screen = createXtermScreen$1(120, 40);
|
|
43497
43505
|
if (batch.snapshot) state.screen.write(batch.snapshot);
|
|
43498
43506
|
}
|
|
43499
43507
|
let exited = false;
|
|
@@ -43859,7 +43867,8 @@ var TerminalInstanceSchema = object({
|
|
|
43859
43867
|
executable: string().max(1024).default(""),
|
|
43860
43868
|
args: array(string().max(2048)).max(64).default([]),
|
|
43861
43869
|
cwd: string().max(1024).default(""),
|
|
43862
|
-
environment: array(string().max(4096)).max(64).default([])
|
|
43870
|
+
environment: array(string().max(4096)).max(64).default([]),
|
|
43871
|
+
profileSettings: record(string(), unknown()).default({})
|
|
43863
43872
|
});
|
|
43864
43873
|
function environmentEntriesToRecord(entries) {
|
|
43865
43874
|
const out = {};
|
|
@@ -44073,6 +44082,108 @@ function findProfile(profiles, profileId) {
|
|
|
44073
44082
|
return profiles.find((p) => p.profileId === profileId);
|
|
44074
44083
|
}
|
|
44075
44084
|
//#endregion
|
|
44085
|
+
//#region src/profile-settings.ts
|
|
44086
|
+
var GLANCES_PLUGINS = [
|
|
44087
|
+
{
|
|
44088
|
+
key: "showCpu",
|
|
44089
|
+
plugin: "cpu",
|
|
44090
|
+
label: "CPU"
|
|
44091
|
+
},
|
|
44092
|
+
{
|
|
44093
|
+
key: "showMem",
|
|
44094
|
+
plugin: "mem",
|
|
44095
|
+
label: "Memory"
|
|
44096
|
+
},
|
|
44097
|
+
{
|
|
44098
|
+
key: "showLoad",
|
|
44099
|
+
plugin: "load",
|
|
44100
|
+
label: "Load"
|
|
44101
|
+
},
|
|
44102
|
+
{
|
|
44103
|
+
key: "showNetwork",
|
|
44104
|
+
plugin: "network",
|
|
44105
|
+
label: "Network"
|
|
44106
|
+
},
|
|
44107
|
+
{
|
|
44108
|
+
key: "showDiskIo",
|
|
44109
|
+
plugin: "diskio",
|
|
44110
|
+
label: "Disk I/O"
|
|
44111
|
+
},
|
|
44112
|
+
{
|
|
44113
|
+
key: "showFs",
|
|
44114
|
+
plugin: "fs",
|
|
44115
|
+
label: "Filesystems"
|
|
44116
|
+
},
|
|
44117
|
+
{
|
|
44118
|
+
key: "showProcessList",
|
|
44119
|
+
plugin: "processlist",
|
|
44120
|
+
label: "Process list"
|
|
44121
|
+
},
|
|
44122
|
+
{
|
|
44123
|
+
key: "showContainers",
|
|
44124
|
+
plugin: "containers",
|
|
44125
|
+
label: "Containers"
|
|
44126
|
+
},
|
|
44127
|
+
{
|
|
44128
|
+
key: "showSensors",
|
|
44129
|
+
plugin: "sensors",
|
|
44130
|
+
label: "Sensors"
|
|
44131
|
+
}
|
|
44132
|
+
];
|
|
44133
|
+
function glancesBooleanField(key, label) {
|
|
44134
|
+
return {
|
|
44135
|
+
type: "boolean",
|
|
44136
|
+
key,
|
|
44137
|
+
label,
|
|
44138
|
+
default: true,
|
|
44139
|
+
style: "switch"
|
|
44140
|
+
};
|
|
44141
|
+
}
|
|
44142
|
+
function glancesSettingsSchema() {
|
|
44143
|
+
return { sections: [{
|
|
44144
|
+
id: "glances-panels",
|
|
44145
|
+
title: "Glances panels",
|
|
44146
|
+
description: "Turn off a panel to pass --disable-plugin to this Terminal only. All on is the measured default (~1% of one core at the camera grid).",
|
|
44147
|
+
columns: 2,
|
|
44148
|
+
fields: GLANCES_PLUGINS.map((plugin) => glancesBooleanField(plugin.key, plugin.label))
|
|
44149
|
+
}] };
|
|
44150
|
+
}
|
|
44151
|
+
function settingsSchemaForProfile(profileId) {
|
|
44152
|
+
if (profileId === "glances") return glancesSettingsSchema();
|
|
44153
|
+
return null;
|
|
44154
|
+
}
|
|
44155
|
+
function glancesSettingsToArgs(settings) {
|
|
44156
|
+
const disabled = GLANCES_PLUGINS.filter((plugin) => settings[plugin.key] === false).map((plugin) => plugin.plugin);
|
|
44157
|
+
if (disabled.length === 0) return [];
|
|
44158
|
+
return ["--disable-plugin", disabled.join(",")];
|
|
44159
|
+
}
|
|
44160
|
+
function sanitizeProfileSettings(profileId, raw) {
|
|
44161
|
+
if (profileId !== "glances") return {};
|
|
44162
|
+
const bag = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
44163
|
+
const out = {
|
|
44164
|
+
showCpu: true,
|
|
44165
|
+
showMem: true,
|
|
44166
|
+
showLoad: true,
|
|
44167
|
+
showNetwork: true,
|
|
44168
|
+
showDiskIo: true,
|
|
44169
|
+
showFs: true,
|
|
44170
|
+
showProcessList: true,
|
|
44171
|
+
showContainers: true,
|
|
44172
|
+
showSensors: true
|
|
44173
|
+
};
|
|
44174
|
+
for (const plugin of GLANCES_PLUGINS) if (typeof bag[plugin.key] === "boolean") out[plugin.key] = bag[plugin.key];
|
|
44175
|
+
return out;
|
|
44176
|
+
}
|
|
44177
|
+
function profileSettingsToArgs(profileId, settings) {
|
|
44178
|
+
if (profileId !== "glances") return [];
|
|
44179
|
+
return glancesSettingsToArgs(sanitizeProfileSettings(profileId, settings));
|
|
44180
|
+
}
|
|
44181
|
+
function spawnArgsForInstance(input) {
|
|
44182
|
+
const extra = profileSettingsToArgs(input.profileId, input.profileSettings);
|
|
44183
|
+
if (input.instanceArgs.length > 0) return [...input.instanceArgs, ...extra];
|
|
44184
|
+
if (extra.length > 0) return [...input.profileArgs, ...extra];
|
|
44185
|
+
}
|
|
44186
|
+
//#endregion
|
|
44076
44187
|
//#region src/terminal-session-manager.ts
|
|
44077
44188
|
var MIN_GRID = 1;
|
|
44078
44189
|
var MAX_COLS = 1e3;
|
|
@@ -44141,7 +44252,8 @@ var TerminalSessionManager = class {
|
|
|
44141
44252
|
executable: p.file,
|
|
44142
44253
|
args: [...p.args],
|
|
44143
44254
|
cwd: p.cwd ?? "",
|
|
44144
|
-
environment: environmentRecordToEntries(p.env)
|
|
44255
|
+
environment: environmentRecordToEntries(p.env),
|
|
44256
|
+
settingsSchema: settingsSchemaForProfile(p.profileId)
|
|
44145
44257
|
}));
|
|
44146
44258
|
}
|
|
44147
44259
|
setInstanceControl(control) {
|
|
@@ -44542,15 +44654,22 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44542
44654
|
const localNodeId = declarationOwnerNodeId(this.ctx.kernel.localNodeId);
|
|
44543
44655
|
const cameraRelay = new TerminalCameraRelay({
|
|
44544
44656
|
listProfiles: (nodeId) => nodeId === localNodeId ? manager.listProfiles() : this.ctx.api.terminalSession.listProfiles.query(void 0, nodePin(nodeId)),
|
|
44545
|
-
openSession: (nodeId, input) => {
|
|
44657
|
+
openSession: async (nodeId, input) => {
|
|
44546
44658
|
const instance = input.instanceId ? this.terminalInstances().find((row) => row.id === input.instanceId) : void 0;
|
|
44659
|
+
const profile = (nodeId === localNodeId ? await manager.listProfiles() : await this.ctx.api.terminalSession.listProfiles.query(void 0, nodePin(nodeId))).find((candidate) => candidate.profileId === (instance?.profileId ?? input.profileId));
|
|
44660
|
+
const args = instance ? spawnArgsForInstance({
|
|
44661
|
+
profileId: instance.profileId,
|
|
44662
|
+
instanceArgs: instance.args,
|
|
44663
|
+
profileArgs: profile?.args ?? [],
|
|
44664
|
+
profileSettings: instance.profileSettings
|
|
44665
|
+
}) : void 0;
|
|
44547
44666
|
const payload = {
|
|
44548
44667
|
profileId: input.profileId,
|
|
44549
44668
|
cols: input.cols,
|
|
44550
44669
|
rows: input.rows,
|
|
44551
44670
|
...instance ? {
|
|
44552
44671
|
...instance.executable ? { executable: instance.executable } : {},
|
|
44553
|
-
...
|
|
44672
|
+
...args !== void 0 ? { args: [...args] } : {},
|
|
44554
44673
|
...instance.cwd ? { cwd: instance.cwd } : {},
|
|
44555
44674
|
...instance.environment.length > 0 ? { environment: [...instance.environment] } : {}
|
|
44556
44675
|
} : {}
|
|
@@ -44785,7 +44904,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44785
44904
|
executable: instance.executable,
|
|
44786
44905
|
args: instance.args,
|
|
44787
44906
|
cwd: instance.cwd,
|
|
44788
|
-
environment: instance.environment
|
|
44907
|
+
environment: instance.environment,
|
|
44908
|
+
profileSettings: instance.profileSettings
|
|
44789
44909
|
};
|
|
44790
44910
|
}
|
|
44791
44911
|
replaceTerminalCameraTombstones(stableIds) {
|
|
@@ -44817,7 +44937,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44817
44937
|
executable: input.executable?.trim() || profile.executable || "",
|
|
44818
44938
|
args: input.args ? [...input.args] : [...profile.args ?? []],
|
|
44819
44939
|
cwd: input.cwd?.trim() || profile.cwd || "",
|
|
44820
|
-
environment: input.environment ? [...input.environment] : [...profile.environment ?? []]
|
|
44940
|
+
environment: input.environment ? [...input.environment] : [...profile.environment ?? []],
|
|
44941
|
+
profileSettings: sanitizeProfileSettings(profile.profileId, input.profileSettings)
|
|
44821
44942
|
};
|
|
44822
44943
|
await this.updateGlobalSettings({ terminalInstances: [...this.config.terminalInstances, instance] });
|
|
44823
44944
|
return this.instanceInfo(instance);
|
|
@@ -44837,7 +44958,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44837
44958
|
...input.executable !== void 0 ? { executable: input.executable.trim() } : {},
|
|
44838
44959
|
...input.args !== void 0 ? { args: [...input.args] } : {},
|
|
44839
44960
|
...input.cwd !== void 0 ? { cwd: input.cwd.trim() } : {},
|
|
44840
|
-
...input.environment !== void 0 ? { environment: [...input.environment] } : {}
|
|
44961
|
+
...input.environment !== void 0 ? { environment: [...input.environment] } : {},
|
|
44962
|
+
...input.profileSettings !== void 0 ? { profileSettings: sanitizeProfileSettings(instance.profileId, input.profileSettings) } : {}
|
|
44841
44963
|
};
|
|
44842
44964
|
await this.updateGlobalSettings({ terminalInstances: this.config.terminalInstances.map((candidate) => candidate.id === input.instanceId ? updated : candidate) });
|
|
44843
44965
|
return this.instanceInfo(updated);
|
|
@@ -44905,7 +45027,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44905
45027
|
executable: "",
|
|
44906
45028
|
args: [],
|
|
44907
45029
|
cwd: "",
|
|
44908
|
-
environment: []
|
|
45030
|
+
environment: [],
|
|
45031
|
+
profileSettings: {}
|
|
44909
45032
|
};
|
|
44910
45033
|
await this.updateGlobalSettings({ terminalInstances: [...this.config.terminalInstances, instance] });
|
|
44911
45034
|
return this.instanceInfo(instance);
|
|
@@ -45144,7 +45267,7 @@ exports.buildCellRuns = buildCellRuns;
|
|
|
45144
45267
|
exports.buildProfiles = buildProfiles;
|
|
45145
45268
|
exports.createNodePtySpawner = createNodePtySpawner;
|
|
45146
45269
|
exports.createTerminalDataPlaneHandler = createTerminalDataPlaneHandler;
|
|
45147
|
-
exports.createXtermScreen = createXtermScreen;
|
|
45270
|
+
exports.createXtermScreen = createXtermScreen$1;
|
|
45148
45271
|
exports.findProfile = findProfile;
|
|
45149
45272
|
exports.resolveCellStyle = resolveCellStyle;
|
|
45150
45273
|
exports.terminalPaletteColor = terminalPaletteColor;
|
package/dist/addon.mjs
CHANGED
|
@@ -19980,6 +19980,9 @@ method(_void(), ProviderInfoSchema), method(object({ config: record(string(), un
|
|
|
19980
19980
|
location: StorageLocationSchema,
|
|
19981
19981
|
relativePath: string()
|
|
19982
19982
|
}), _void(), { kind: "mutation" }), method(object({ location: StorageLocationSchema }), number().nullable()), method(BeginUploadInputSchema, BeginUploadResultSchema, { kind: "mutation" }), method(WriteChunkInputSchema, _void(), { kind: "mutation" }), method(FinalizeUploadInputSchema, _void(), { kind: "mutation" }), method(AbortUploadInputSchema, _void(), { kind: "mutation" }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, { kind: "mutation" }), method(ReadChunkInputSchema, _instanceof(Uint8Array)), method(EndDownloadInputSchema, _void(), { kind: "mutation" });
|
|
19983
|
+
/** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
|
|
19984
|
+
var ProfileSettingsSchemaBridge = unknown().nullable();
|
|
19985
|
+
var ProfileSettingsBagSchema = record(string(), unknown());
|
|
19983
19986
|
/**
|
|
19984
19987
|
* A live terminal session hosted by the provider addon. Output and input do
|
|
19985
19988
|
* NOT flow through the capability — they use the addon data plane
|
|
@@ -20014,7 +20017,9 @@ var TerminalProfileInfoSchema = object({
|
|
|
20014
20017
|
executable: string().optional(),
|
|
20015
20018
|
args: array(string()).readonly().optional(),
|
|
20016
20019
|
cwd: string().optional(),
|
|
20017
|
-
environment: array(string()).readonly().optional()
|
|
20020
|
+
environment: array(string()).readonly().optional(),
|
|
20021
|
+
/** ConfigUISchema for instance knobs, or null when the profile has none. */
|
|
20022
|
+
settingsSchema: ProfileSettingsSchemaBridge.optional()
|
|
20018
20023
|
});
|
|
20019
20024
|
/**
|
|
20020
20025
|
* A durable operator-created Terminal instance. Profiles are templates; only
|
|
@@ -20031,7 +20036,8 @@ var TerminalInstanceInfoSchema = object({
|
|
|
20031
20036
|
executable: string(),
|
|
20032
20037
|
args: array(string()).readonly(),
|
|
20033
20038
|
cwd: string(),
|
|
20034
|
-
environment: array(string()).readonly()
|
|
20039
|
+
environment: array(string()).readonly(),
|
|
20040
|
+
profileSettings: ProfileSettingsBagSchema
|
|
20035
20041
|
});
|
|
20036
20042
|
var TerminalLegacyCameraSchema = object({
|
|
20037
20043
|
stableId: string(),
|
|
@@ -20081,7 +20087,8 @@ var terminalSessionCapability = {
|
|
|
20081
20087
|
executable: string().max(1024).optional(),
|
|
20082
20088
|
args: array(string().max(2048)).max(64).optional(),
|
|
20083
20089
|
cwd: string().max(1024).optional(),
|
|
20084
|
-
environment: array(string().max(4096)).max(64).optional()
|
|
20090
|
+
environment: array(string().max(4096)).max(64).optional(),
|
|
20091
|
+
profileSettings: ProfileSettingsBagSchema.optional()
|
|
20085
20092
|
}), TerminalInstanceInfoSchema, {
|
|
20086
20093
|
kind: "mutation",
|
|
20087
20094
|
auth: "admin"
|
|
@@ -20092,7 +20099,8 @@ var terminalSessionCapability = {
|
|
|
20092
20099
|
executable: string().max(1024).optional(),
|
|
20093
20100
|
args: array(string().max(2048)).max(64).optional(),
|
|
20094
20101
|
cwd: string().max(1024).optional(),
|
|
20095
|
-
environment: array(string().max(4096)).max(64).optional()
|
|
20102
|
+
environment: array(string().max(4096)).max(64).optional(),
|
|
20103
|
+
profileSettings: ProfileSettingsBagSchema.optional()
|
|
20096
20104
|
}), TerminalInstanceInfoSchema, {
|
|
20097
20105
|
kind: "mutation",
|
|
20098
20106
|
auth: "admin"
|
|
@@ -24020,10 +24028,10 @@ var lawnMowerControlCapability = {
|
|
|
24020
24028
|
*
|
|
24021
24029
|
* • The SDK (mobile / web client) consumes `getConnectionEndpoints()`
|
|
24022
24030
|
* to receive an ordered list of candidate base URLs it should race
|
|
24023
|
-
* on connect — LAN IPv4 first (lowest latency
|
|
24024
|
-
* then public hostname (if a tunnel is
|
|
24025
|
-
* race them with short timeouts and stick with the
|
|
24026
|
-
* session.
|
|
24031
|
+
* on connect — LAN IPv4 and stable LAN IPv6 first (lowest latency
|
|
24032
|
+
* when on the same network), then public hostname (if a tunnel is
|
|
24033
|
+
* up). The SDK can race them with short timeouts and stick with the
|
|
24034
|
+
* winner for the session.
|
|
24027
24035
|
*
|
|
24028
24036
|
* Why hub-only: agents are not directly addressable by the operator's
|
|
24029
24037
|
* clients — they reverse-connect to the hub. Exposing their interfaces
|
|
@@ -43269,7 +43277,7 @@ var require_xterm_headless = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
43269
43277
|
var import_addon_serialize = require_addon_serialize();
|
|
43270
43278
|
var import_xterm_headless = require_xterm_headless();
|
|
43271
43279
|
var SCROLLBACK_LINES = 2e3;
|
|
43272
|
-
function createXtermScreen(cols, rows) {
|
|
43280
|
+
function createXtermScreen$1(cols, rows) {
|
|
43273
43281
|
const term = new import_xterm_headless.Terminal({
|
|
43274
43282
|
cols,
|
|
43275
43283
|
rows,
|
|
@@ -43413,7 +43421,7 @@ var TerminalCameraRelay = class {
|
|
|
43413
43421
|
instanceId,
|
|
43414
43422
|
nodeId,
|
|
43415
43423
|
profileId,
|
|
43416
|
-
screen: createXtermScreen(120, 40),
|
|
43424
|
+
screen: createXtermScreen$1(120, 40),
|
|
43417
43425
|
sessionId: null,
|
|
43418
43426
|
cursor: 0,
|
|
43419
43427
|
clients: 0,
|
|
@@ -43470,7 +43478,7 @@ var TerminalCameraRelay = class {
|
|
|
43470
43478
|
applyBatch(state, batch) {
|
|
43471
43479
|
if (batch.reset) {
|
|
43472
43480
|
state.screen.dispose();
|
|
43473
|
-
state.screen = createXtermScreen(120, 40);
|
|
43481
|
+
state.screen = createXtermScreen$1(120, 40);
|
|
43474
43482
|
if (batch.snapshot) state.screen.write(batch.snapshot);
|
|
43475
43483
|
}
|
|
43476
43484
|
let exited = false;
|
|
@@ -43836,7 +43844,8 @@ var TerminalInstanceSchema = object({
|
|
|
43836
43844
|
executable: string().max(1024).default(""),
|
|
43837
43845
|
args: array(string().max(2048)).max(64).default([]),
|
|
43838
43846
|
cwd: string().max(1024).default(""),
|
|
43839
|
-
environment: array(string().max(4096)).max(64).default([])
|
|
43847
|
+
environment: array(string().max(4096)).max(64).default([]),
|
|
43848
|
+
profileSettings: record(string(), unknown()).default({})
|
|
43840
43849
|
});
|
|
43841
43850
|
function environmentEntriesToRecord(entries) {
|
|
43842
43851
|
const out = {};
|
|
@@ -44050,6 +44059,108 @@ function findProfile(profiles, profileId) {
|
|
|
44050
44059
|
return profiles.find((p) => p.profileId === profileId);
|
|
44051
44060
|
}
|
|
44052
44061
|
//#endregion
|
|
44062
|
+
//#region src/profile-settings.ts
|
|
44063
|
+
var GLANCES_PLUGINS = [
|
|
44064
|
+
{
|
|
44065
|
+
key: "showCpu",
|
|
44066
|
+
plugin: "cpu",
|
|
44067
|
+
label: "CPU"
|
|
44068
|
+
},
|
|
44069
|
+
{
|
|
44070
|
+
key: "showMem",
|
|
44071
|
+
plugin: "mem",
|
|
44072
|
+
label: "Memory"
|
|
44073
|
+
},
|
|
44074
|
+
{
|
|
44075
|
+
key: "showLoad",
|
|
44076
|
+
plugin: "load",
|
|
44077
|
+
label: "Load"
|
|
44078
|
+
},
|
|
44079
|
+
{
|
|
44080
|
+
key: "showNetwork",
|
|
44081
|
+
plugin: "network",
|
|
44082
|
+
label: "Network"
|
|
44083
|
+
},
|
|
44084
|
+
{
|
|
44085
|
+
key: "showDiskIo",
|
|
44086
|
+
plugin: "diskio",
|
|
44087
|
+
label: "Disk I/O"
|
|
44088
|
+
},
|
|
44089
|
+
{
|
|
44090
|
+
key: "showFs",
|
|
44091
|
+
plugin: "fs",
|
|
44092
|
+
label: "Filesystems"
|
|
44093
|
+
},
|
|
44094
|
+
{
|
|
44095
|
+
key: "showProcessList",
|
|
44096
|
+
plugin: "processlist",
|
|
44097
|
+
label: "Process list"
|
|
44098
|
+
},
|
|
44099
|
+
{
|
|
44100
|
+
key: "showContainers",
|
|
44101
|
+
plugin: "containers",
|
|
44102
|
+
label: "Containers"
|
|
44103
|
+
},
|
|
44104
|
+
{
|
|
44105
|
+
key: "showSensors",
|
|
44106
|
+
plugin: "sensors",
|
|
44107
|
+
label: "Sensors"
|
|
44108
|
+
}
|
|
44109
|
+
];
|
|
44110
|
+
function glancesBooleanField(key, label) {
|
|
44111
|
+
return {
|
|
44112
|
+
type: "boolean",
|
|
44113
|
+
key,
|
|
44114
|
+
label,
|
|
44115
|
+
default: true,
|
|
44116
|
+
style: "switch"
|
|
44117
|
+
};
|
|
44118
|
+
}
|
|
44119
|
+
function glancesSettingsSchema() {
|
|
44120
|
+
return { sections: [{
|
|
44121
|
+
id: "glances-panels",
|
|
44122
|
+
title: "Glances panels",
|
|
44123
|
+
description: "Turn off a panel to pass --disable-plugin to this Terminal only. All on is the measured default (~1% of one core at the camera grid).",
|
|
44124
|
+
columns: 2,
|
|
44125
|
+
fields: GLANCES_PLUGINS.map((plugin) => glancesBooleanField(plugin.key, plugin.label))
|
|
44126
|
+
}] };
|
|
44127
|
+
}
|
|
44128
|
+
function settingsSchemaForProfile(profileId) {
|
|
44129
|
+
if (profileId === "glances") return glancesSettingsSchema();
|
|
44130
|
+
return null;
|
|
44131
|
+
}
|
|
44132
|
+
function glancesSettingsToArgs(settings) {
|
|
44133
|
+
const disabled = GLANCES_PLUGINS.filter((plugin) => settings[plugin.key] === false).map((plugin) => plugin.plugin);
|
|
44134
|
+
if (disabled.length === 0) return [];
|
|
44135
|
+
return ["--disable-plugin", disabled.join(",")];
|
|
44136
|
+
}
|
|
44137
|
+
function sanitizeProfileSettings(profileId, raw) {
|
|
44138
|
+
if (profileId !== "glances") return {};
|
|
44139
|
+
const bag = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
44140
|
+
const out = {
|
|
44141
|
+
showCpu: true,
|
|
44142
|
+
showMem: true,
|
|
44143
|
+
showLoad: true,
|
|
44144
|
+
showNetwork: true,
|
|
44145
|
+
showDiskIo: true,
|
|
44146
|
+
showFs: true,
|
|
44147
|
+
showProcessList: true,
|
|
44148
|
+
showContainers: true,
|
|
44149
|
+
showSensors: true
|
|
44150
|
+
};
|
|
44151
|
+
for (const plugin of GLANCES_PLUGINS) if (typeof bag[plugin.key] === "boolean") out[plugin.key] = bag[plugin.key];
|
|
44152
|
+
return out;
|
|
44153
|
+
}
|
|
44154
|
+
function profileSettingsToArgs(profileId, settings) {
|
|
44155
|
+
if (profileId !== "glances") return [];
|
|
44156
|
+
return glancesSettingsToArgs(sanitizeProfileSettings(profileId, settings));
|
|
44157
|
+
}
|
|
44158
|
+
function spawnArgsForInstance(input) {
|
|
44159
|
+
const extra = profileSettingsToArgs(input.profileId, input.profileSettings);
|
|
44160
|
+
if (input.instanceArgs.length > 0) return [...input.instanceArgs, ...extra];
|
|
44161
|
+
if (extra.length > 0) return [...input.profileArgs, ...extra];
|
|
44162
|
+
}
|
|
44163
|
+
//#endregion
|
|
44053
44164
|
//#region src/terminal-session-manager.ts
|
|
44054
44165
|
var MIN_GRID = 1;
|
|
44055
44166
|
var MAX_COLS = 1e3;
|
|
@@ -44118,7 +44229,8 @@ var TerminalSessionManager = class {
|
|
|
44118
44229
|
executable: p.file,
|
|
44119
44230
|
args: [...p.args],
|
|
44120
44231
|
cwd: p.cwd ?? "",
|
|
44121
|
-
environment: environmentRecordToEntries(p.env)
|
|
44232
|
+
environment: environmentRecordToEntries(p.env),
|
|
44233
|
+
settingsSchema: settingsSchemaForProfile(p.profileId)
|
|
44122
44234
|
}));
|
|
44123
44235
|
}
|
|
44124
44236
|
setInstanceControl(control) {
|
|
@@ -44519,15 +44631,22 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44519
44631
|
const localNodeId = declarationOwnerNodeId(this.ctx.kernel.localNodeId);
|
|
44520
44632
|
const cameraRelay = new TerminalCameraRelay({
|
|
44521
44633
|
listProfiles: (nodeId) => nodeId === localNodeId ? manager.listProfiles() : this.ctx.api.terminalSession.listProfiles.query(void 0, nodePin(nodeId)),
|
|
44522
|
-
openSession: (nodeId, input) => {
|
|
44634
|
+
openSession: async (nodeId, input) => {
|
|
44523
44635
|
const instance = input.instanceId ? this.terminalInstances().find((row) => row.id === input.instanceId) : void 0;
|
|
44636
|
+
const profile = (nodeId === localNodeId ? await manager.listProfiles() : await this.ctx.api.terminalSession.listProfiles.query(void 0, nodePin(nodeId))).find((candidate) => candidate.profileId === (instance?.profileId ?? input.profileId));
|
|
44637
|
+
const args = instance ? spawnArgsForInstance({
|
|
44638
|
+
profileId: instance.profileId,
|
|
44639
|
+
instanceArgs: instance.args,
|
|
44640
|
+
profileArgs: profile?.args ?? [],
|
|
44641
|
+
profileSettings: instance.profileSettings
|
|
44642
|
+
}) : void 0;
|
|
44524
44643
|
const payload = {
|
|
44525
44644
|
profileId: input.profileId,
|
|
44526
44645
|
cols: input.cols,
|
|
44527
44646
|
rows: input.rows,
|
|
44528
44647
|
...instance ? {
|
|
44529
44648
|
...instance.executable ? { executable: instance.executable } : {},
|
|
44530
|
-
...
|
|
44649
|
+
...args !== void 0 ? { args: [...args] } : {},
|
|
44531
44650
|
...instance.cwd ? { cwd: instance.cwd } : {},
|
|
44532
44651
|
...instance.environment.length > 0 ? { environment: [...instance.environment] } : {}
|
|
44533
44652
|
} : {}
|
|
@@ -44762,7 +44881,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44762
44881
|
executable: instance.executable,
|
|
44763
44882
|
args: instance.args,
|
|
44764
44883
|
cwd: instance.cwd,
|
|
44765
|
-
environment: instance.environment
|
|
44884
|
+
environment: instance.environment,
|
|
44885
|
+
profileSettings: instance.profileSettings
|
|
44766
44886
|
};
|
|
44767
44887
|
}
|
|
44768
44888
|
replaceTerminalCameraTombstones(stableIds) {
|
|
@@ -44794,7 +44914,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44794
44914
|
executable: input.executable?.trim() || profile.executable || "",
|
|
44795
44915
|
args: input.args ? [...input.args] : [...profile.args ?? []],
|
|
44796
44916
|
cwd: input.cwd?.trim() || profile.cwd || "",
|
|
44797
|
-
environment: input.environment ? [...input.environment] : [...profile.environment ?? []]
|
|
44917
|
+
environment: input.environment ? [...input.environment] : [...profile.environment ?? []],
|
|
44918
|
+
profileSettings: sanitizeProfileSettings(profile.profileId, input.profileSettings)
|
|
44798
44919
|
};
|
|
44799
44920
|
await this.updateGlobalSettings({ terminalInstances: [...this.config.terminalInstances, instance] });
|
|
44800
44921
|
return this.instanceInfo(instance);
|
|
@@ -44814,7 +44935,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44814
44935
|
...input.executable !== void 0 ? { executable: input.executable.trim() } : {},
|
|
44815
44936
|
...input.args !== void 0 ? { args: [...input.args] } : {},
|
|
44816
44937
|
...input.cwd !== void 0 ? { cwd: input.cwd.trim() } : {},
|
|
44817
|
-
...input.environment !== void 0 ? { environment: [...input.environment] } : {}
|
|
44938
|
+
...input.environment !== void 0 ? { environment: [...input.environment] } : {},
|
|
44939
|
+
...input.profileSettings !== void 0 ? { profileSettings: sanitizeProfileSettings(instance.profileId, input.profileSettings) } : {}
|
|
44818
44940
|
};
|
|
44819
44941
|
await this.updateGlobalSettings({ terminalInstances: this.config.terminalInstances.map((candidate) => candidate.id === input.instanceId ? updated : candidate) });
|
|
44820
44942
|
return this.instanceInfo(updated);
|
|
@@ -44882,7 +45004,8 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
44882
45004
|
executable: "",
|
|
44883
45005
|
args: [],
|
|
44884
45006
|
cwd: "",
|
|
44885
|
-
environment: []
|
|
45007
|
+
environment: [],
|
|
45008
|
+
profileSettings: {}
|
|
44886
45009
|
};
|
|
44887
45010
|
await this.updateGlobalSettings({ terminalInstances: [...this.config.terminalInstances, instance] });
|
|
44888
45011
|
return this.instanceInfo(instance);
|
|
@@ -45113,4 +45236,4 @@ var TerminalAddon = class extends BaseAddon {
|
|
|
45113
45236
|
}
|
|
45114
45237
|
};
|
|
45115
45238
|
//#endregion
|
|
45116
|
-
export { TerminalAddon, createXtermScreen as a, buildCellRuns as c, terminalRgbColor as d, createNodePtySpawner as f, createTerminalDataPlaneHandler as i, resolveCellStyle as l, buildProfiles as n, TERMINAL_DEFAULT_BG as o, warmNodePty as p, findProfile as r, TERMINAL_DEFAULT_FG as s, TerminalSessionManager as t, terminalPaletteColor as u };
|
|
45239
|
+
export { TerminalAddon, createXtermScreen$1 as a, buildCellRuns as c, terminalRgbColor as d, createNodePtySpawner as f, createTerminalDataPlaneHandler as i, resolveCellStyle as l, buildProfiles as n, TERMINAL_DEFAULT_BG as o, warmNodePty as p, findProfile as r, TERMINAL_DEFAULT_FG as s, TerminalSessionManager as t, terminalPaletteColor as u };
|