@spences10/pi-lsp 0.0.50 → 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 +20 -4
- package/dist/env.js +44 -6
- package/dist/env.js.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
<!-- package-readme:header:end -->
|
|
13
13
|
|
|
14
|
+
Prompt guidance uses Pi's named system-prompt sections. It coexists
|
|
15
|
+
with user `SYSTEM.md` and `APPEND_SYSTEM.md` files and other
|
|
16
|
+
extensions without replacing the complete prompt.
|
|
17
|
+
|
|
14
18
|
Give agents precise code intelligence instead of guesswork. `pi-lsp`
|
|
15
19
|
exposes language-server diagnostics, hovers, definitions, references,
|
|
16
20
|
and symbols as Pi tools so models can validate edits and navigate
|
|
@@ -141,10 +145,22 @@ trust prompts follow tool cancellation and time out after 30 seconds,
|
|
|
141
145
|
returning a tool error instead of leaving the session indefinitely in
|
|
142
146
|
`Working`.
|
|
143
147
|
|
|
144
|
-
Language
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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.
|
|
148
164
|
|
|
149
165
|
## Tools
|
|
150
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":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,IAAI;IACJ,WAAW;IACX,aAAa;IACb,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,MAAM;IACN,qBAAqB;IACrB,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;CACN,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG;IAC1B,2BAA2B;IAC3B,yBAAyB;CACzB,CAAC;AAEF,MAAM,UAAU,wBAAwB,CACvC,YAAY,GAA2B,EAAE,EACzC,UAAU,GAAsB,OAAO,CAAC,GAAG;IAE3C,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,KAAK,MAAM,aAAa,IAAI,kBAAkB,EAAE,CAAC;QAChD,KAAK,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAC1D,GAAG,CACH,EAAE,CAAC;YACH,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YACzB,IAAI,GAAG;gBAAE,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;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/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { register_lsp_command } from './commands.js';
|
|
2
|
-
import {
|
|
2
|
+
import { LSP_SYSTEM_PROMPT, should_inject_lsp_prompt, } from './prompt.js';
|
|
3
3
|
import { LspServerManager, } from './server-manager.js';
|
|
4
4
|
import { register_lsp_tools } from './tools.js';
|
|
5
5
|
export { should_inject_lsp_prompt } from './prompt.js';
|
|
@@ -8,11 +8,13 @@ export function create_lsp_extension(options = {}) {
|
|
|
8
8
|
const manager = new LspServerManager(options);
|
|
9
9
|
register_lsp_tools(pi, manager);
|
|
10
10
|
pi.on('before_agent_start', async (event) => {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
if (should_inject_lsp_prompt(event)) {
|
|
12
|
+
event.systemPromptOptions.sections.lsp =
|
|
13
|
+
LSP_SYSTEM_PROMPT.trim();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
delete event.systemPromptOptions.sections.lsp;
|
|
17
|
+
}
|
|
16
18
|
});
|
|
17
19
|
register_lsp_command(pi, manager);
|
|
18
20
|
pi.on('session_shutdown', async () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACN,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,gBAAgB,GAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAKvD,MAAM,UAAU,oBAAoB,CACnC,OAAO,GAA8B,EAAE;IAEvC,OAAO,KAAK,UAAU,GAAG,CAAC,EAAgB;QACzC,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE9C,kBAAkB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEhC,EAAE,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC3C,IAAI,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG;oBACrC,iBAAiB,CAAC,IAAI,EAAE,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACP,OAAO,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/C,CAAC;QACF,CAAC,CAAC,CAAC;QAEH,oBAAoB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAElC,EAAE,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YACpC,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAED,eAAe,oBAAoB,EAAE,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
|
},
|