@spences10/pi-lsp 0.0.51 → 0.0.52
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 +16 -4
- package/dist/env.js +44 -6
- package/dist/env.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -145,10 +145,22 @@ trust prompts follow tool cancellation and time out after 30 seconds,
|
|
|
145
145
|
returning a tool error instead of leaving the session indefinitely in
|
|
146
146
|
`Working`.
|
|
147
147
|
|
|
148
|
-
Language
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
### Language-server environment
|
|
149
|
+
|
|
150
|
+
LSP filters its language-server environment directly, passing only
|
|
151
|
+
`PATH`, `PI_CODING_AGENT_DIR`, home/user, locale (`LANG` and `LC_*`),
|
|
152
|
+
terminal/color, shell, temporary-directory, and CI variables by
|
|
153
|
+
default. Provider credentials, Pi session metadata, `NODE_OPTIONS`,
|
|
154
|
+
and other ambient variables are not inherited unless explicitly
|
|
155
|
+
allowlisted.
|
|
156
|
+
|
|
157
|
+
Use `MY_PI_LSP_ENV_ALLOWLIST=NAME,OTHER_NAME` to pass toolchain
|
|
158
|
+
configuration such as `RUSTUP_HOME`, `CARGO_HOME`, or `JAVA_HOME` when
|
|
159
|
+
needed. `MY_PI_CHILD_ENV_ALLOWLIST` remains supported; entries from
|
|
160
|
+
both lists are combined.
|
|
161
|
+
|
|
162
|
+
This reduces ambient credential exposure, but is not a sandbox:
|
|
163
|
+
language servers retain the current user's filesystem permissions.
|
|
152
164
|
|
|
153
165
|
## Tools
|
|
154
166
|
|
package/dist/env.js
CHANGED
|
@@ -1,9 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
const BASE_CHILD_ENV_KEYS = new Set([
|
|
2
|
+
'CI',
|
|
3
|
+
'COLORTERM',
|
|
4
|
+
'FORCE_COLOR',
|
|
5
|
+
'HOME',
|
|
6
|
+
'LANG',
|
|
7
|
+
'LOGNAME',
|
|
8
|
+
'NO_COLOR',
|
|
9
|
+
'PATH',
|
|
10
|
+
'PI_CODING_AGENT_DIR',
|
|
11
|
+
'SHELL',
|
|
12
|
+
'TEMP',
|
|
13
|
+
'TERM',
|
|
14
|
+
'TMP',
|
|
15
|
+
'TMPDIR',
|
|
16
|
+
'USER',
|
|
17
|
+
]);
|
|
18
|
+
const ENV_ALLOWLIST_KEYS = [
|
|
19
|
+
'MY_PI_CHILD_ENV_ALLOWLIST',
|
|
20
|
+
'MY_PI_LSP_ENV_ALLOWLIST',
|
|
21
|
+
];
|
|
2
22
|
export function create_child_process_env(explicit_env = {}, source_env = process.env) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
const env = {};
|
|
24
|
+
const allowed_keys = new Set(BASE_CHILD_ENV_KEYS);
|
|
25
|
+
for (const key of Object.keys(source_env)) {
|
|
26
|
+
if (key.startsWith('LC_'))
|
|
27
|
+
allowed_keys.add(key);
|
|
28
|
+
}
|
|
29
|
+
for (const allowlist_key of ENV_ALLOWLIST_KEYS) {
|
|
30
|
+
for (const entry of (source_env[allowlist_key] ?? '').split(',')) {
|
|
31
|
+
const key = entry.trim();
|
|
32
|
+
if (key)
|
|
33
|
+
allowed_keys.add(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
for (const key of allowed_keys) {
|
|
37
|
+
const value = source_env[key];
|
|
38
|
+
if (typeof value === 'string')
|
|
39
|
+
env[key] = value;
|
|
40
|
+
}
|
|
41
|
+
for (const [key, value] of Object.entries(explicit_env)) {
|
|
42
|
+
if (typeof value === 'string')
|
|
43
|
+
env[key] = value;
|
|
44
|
+
}
|
|
45
|
+
return env;
|
|
8
46
|
}
|
|
9
47
|
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version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IACjD,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACzD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spences10/pi-lsp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"description": "Language Server Protocol tools for Pi agents to inspect diagnostics, hovers, definitions, references, and symbols",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"language-server",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@spences10/pi-child-env": "0.2.0",
|
|
37
36
|
"@spences10/pi-project-trust": "0.1.0",
|
|
38
37
|
"@spences10/pi-tui-modal": "0.0.24"
|
|
39
38
|
},
|