@vincemakes/kiso-tools-node 0.1.3 → 0.1.5
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/index.d.ts +8 -0
- package/dist/index.js +31 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ export declare function canonicalTargetPath(input: string): string;
|
|
|
43
43
|
export interface WorkspaceToolsOptions {
|
|
44
44
|
/** The workspace the tools may touch; everything else is refused. */
|
|
45
45
|
readonly workspaceRoot: string;
|
|
46
|
+
/**
|
|
47
|
+
* 自举 #3 (发现#7): "inherit" keeps kiso's own provider credentials in
|
|
48
|
+
* the shell child's environment. DEFAULT (absent): the credentials are
|
|
49
|
+
* STRIPPED — a shell command must not inherit the agent's API keys (a
|
|
50
|
+
* nested kiso would hit the REAL provider and blow up faux e2e runs;
|
|
51
|
+
* the keys are an exposure surface for any command).
|
|
52
|
+
*/
|
|
53
|
+
readonly shellEnv?: "inherit";
|
|
46
54
|
}
|
|
47
55
|
export declare function readFileTool(opts: WorkspaceToolsOptions): Tool<{
|
|
48
56
|
path: string;
|
package/dist/index.js
CHANGED
|
@@ -400,6 +400,33 @@ export function editFileTool(opts) {
|
|
|
400
400
|
},
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* 自举 #3 (发现#7): the explicit credential list stripped from shell
|
|
405
|
+
* children — the agent's own provider surface (both families' keys, base
|
|
406
|
+
* URLs, and model choices) plus the generic API-key / auth-token patterns
|
|
407
|
+
* that cover other providers. Everything else in the environment passes
|
|
408
|
+
* through untouched.
|
|
409
|
+
*/
|
|
410
|
+
const SHELL_STRIP_EXACT = new Set([
|
|
411
|
+
"ANTHROPIC_API_KEY",
|
|
412
|
+
"OPENAI_API_KEY",
|
|
413
|
+
"ANTHROPIC_BASE_URL",
|
|
414
|
+
"OPENAI_BASE_URL",
|
|
415
|
+
"ANTHROPIC_MODEL",
|
|
416
|
+
"OPENAI_MODEL",
|
|
417
|
+
]);
|
|
418
|
+
function strippedShellEnv(env) {
|
|
419
|
+
const out = {};
|
|
420
|
+
for (const [key, value] of Object.entries(env)) {
|
|
421
|
+
if (SHELL_STRIP_EXACT.has(key))
|
|
422
|
+
continue;
|
|
423
|
+
if (key.endsWith("_API_KEY") || key.endsWith("_AUTH_TOKEN"))
|
|
424
|
+
continue;
|
|
425
|
+
if (value !== undefined)
|
|
426
|
+
out[key] = value;
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}
|
|
403
430
|
export function shellTool(opts) {
|
|
404
431
|
return defineTool({
|
|
405
432
|
name: "shell",
|
|
@@ -422,11 +449,15 @@ export function shellTool(opts) {
|
|
|
422
449
|
// detached: the command gets its OWN process group, so a
|
|
423
450
|
// timeout/abort can kill the WHOLE TREE (children included),
|
|
424
451
|
// not just the outer shell (Area 4). cwd is the workspace.
|
|
452
|
+
// 自举 #3 (发现#7): the shell child NEVER inherits kiso's own
|
|
453
|
+
// provider credentials by default — only the explicit
|
|
454
|
+
// shellEnv: "inherit" opt-in keeps them.
|
|
425
455
|
const child = spawn(command, {
|
|
426
456
|
shell: true,
|
|
427
457
|
detached: true,
|
|
428
458
|
cwd: opts.workspaceRoot,
|
|
429
459
|
stdio: ["ignore", "pipe", "pipe"],
|
|
460
|
+
env: opts.shellEnv === "inherit" ? process.env : strippedShellEnv(process.env),
|
|
430
461
|
});
|
|
431
462
|
let stdout = "";
|
|
432
463
|
let stderr = "";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-tools-node",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "kiso coding tools for Node hosts
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "kiso coding tools for Node hosts — read file, list directory, search text, write/edit file, shell command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vincemakes/kiso-core": "0.1.
|
|
24
|
+
"@vincemakes/kiso-core": "0.1.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^26.1.2",
|