loopengine 0.1.36 → 0.1.37
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.
|
@@ -1138,10 +1138,21 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
1138
1138
|
var sharedNote = v.abilityNames.length > 1
|
|
1139
1139
|
? ' <span class="hint" title="Also declared by: ' + escapeHtml(v.abilityNames.join(', ')) + '. There is only one value for it project-wide, so check whether they actually need the same one.">(shared)</span>'
|
|
1140
1140
|
: '';
|
|
1141
|
+
// A secret's value is never sent to the browser at all (see
|
|
1142
|
+
// env-admin.ts) — "set" is the most this tab can ever say about one.
|
|
1143
|
+
// A non-secret var's actual value comes through, so show it instead
|
|
1144
|
+
// of a bare "set", since the whole point of looking here is usually
|
|
1145
|
+
// to check *what* something is currently configured to, not just
|
|
1146
|
+
// whether it has a value.
|
|
1147
|
+
var statusHtml = !v.set
|
|
1148
|
+
? '<span class="error">not set</span>'
|
|
1149
|
+
: v.secret
|
|
1150
|
+
? '<span class="hint">set</span>'
|
|
1151
|
+
: '<code>' + escapeHtml(v.value || '') + '</code>';
|
|
1141
1152
|
return '<tr>' +
|
|
1142
1153
|
'<td><code>' + escapeHtml(v.name) + '</code>' + sharedNote + '</td>' +
|
|
1143
1154
|
'<td style="max-width:320px">' + escapeHtml(v.description || '') + '</td>' +
|
|
1144
|
-
'<td>' +
|
|
1155
|
+
'<td>' + statusHtml + '</td>' +
|
|
1145
1156
|
'<td><form class="add-source env-var-form" data-name="' + escapeHtml(v.name) + '">' +
|
|
1146
1157
|
'<input type="' + (v.secret ? 'password' : 'text') + '" name="value" placeholder="' + (v.set ? 'unchanged unless you type a new value' : 'value') + '" required>' +
|
|
1147
1158
|
'<button type="submit">Save</button>' +
|
|
@@ -1163,7 +1174,7 @@ export const agentsConfigPageHtml = `<!doctype html>
|
|
|
1163
1174
|
var rows = vars.map(renderEnvRow).join('');
|
|
1164
1175
|
return '<div class="source">' +
|
|
1165
1176
|
'<div class="source-head"><h4>' + escapeHtml(abilityName) + '</h4>' + statusHtml + '</div>' +
|
|
1166
|
-
'<table><thead><tr><th>Name</th><th style="max-width:320px">Description</th><th>
|
|
1177
|
+
'<table><thead><tr><th>Name</th><th style="max-width:320px">Description</th><th>Current value</th><th>Set value</th></tr></thead><tbody>' + rows + '</tbody></table>' +
|
|
1167
1178
|
'</div>';
|
|
1168
1179
|
}
|
|
1169
1180
|
|
package/dist/web/env-admin.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface DeclaredEnvVar {
|
|
|
9
9
|
* an array, not a single name. */
|
|
10
10
|
abilityNames: string[];
|
|
11
11
|
set: boolean;
|
|
12
|
+
/** The live value, but only when `secret` is false — a secret is never
|
|
13
|
+
* echoed back once set, same rule this file's own top comment and
|
|
14
|
+
* web/http-tool-admin.ts's `{{ENV_VAR}}` header handling already
|
|
15
|
+
* follow. Undefined whenever `secret` is true or `set` is false. */
|
|
16
|
+
value?: string;
|
|
12
17
|
}
|
|
13
18
|
/** Every env var any ability installed for `agentName` declared it
|
|
14
19
|
* needs, merged by name. There's one .env per *project*, not per agent
|
package/dist/web/env-admin.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Backs the Admin UI's "Environment" section — every env var an ability
|
|
2
2
|
// (see ABILITIES.md, bin/ability-manager.ts) declared as required,
|
|
3
3
|
// across every ability installed for an agent, with set/not-set status
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// and, for a non-secret var, its live value (so an operator can actually
|
|
5
|
+
// tell what's configured, not just that something is). A value marked
|
|
6
|
+
// `secret` is never echoed back once set — same never-echo-a-secret rule
|
|
7
|
+
// web/http-tool-admin.ts's own `{{ENV_VAR}}` header handling already
|
|
8
|
+
// establishes for a tool's own secrets.
|
|
7
9
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
8
10
|
import { join } from 'node:path';
|
|
9
11
|
import { agentDir } from '../core/gateway-tools.js';
|
|
@@ -51,14 +53,18 @@ export function listDeclaredEnvVars(agentName) {
|
|
|
51
53
|
if (existing) {
|
|
52
54
|
existing.abilityNames.push(abilityName);
|
|
53
55
|
existing.secret = existing.secret || decl.secret === true;
|
|
56
|
+
if (existing.secret)
|
|
57
|
+
existing.value = undefined;
|
|
54
58
|
continue;
|
|
55
59
|
}
|
|
60
|
+
const rawValue = process.env[decl.name];
|
|
56
61
|
byName.set(decl.name, {
|
|
57
62
|
name: decl.name,
|
|
58
63
|
description: decl.description,
|
|
59
64
|
secret: decl.secret === true,
|
|
60
65
|
abilityNames: [abilityName],
|
|
61
|
-
set:
|
|
66
|
+
set: rawValue !== undefined,
|
|
67
|
+
value: decl.secret === true ? undefined : rawValue,
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
70
|
}
|