@code-yeongyu/senpi 2026.5.15 → 2026.5.18-2
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/CHANGELOG.md +1172 -1161
- package/README.md +1 -2
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -3
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +160 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +5 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +22 -14
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/dynamic-prompt/verification.d.ts +31 -0
- package/dist/core/dynamic-prompt/verification.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/verification.js +41 -0
- package/dist/core/dynamic-prompt/verification.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/context-reduction.d.ts +97 -0
- package/dist/core/extensions/builtin/compaction/context-reduction.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/context-reduction.js +420 -0
- package/dist/core/extensions/builtin/compaction/context-reduction.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +168 -31
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +197 -0
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote.js +690 -0
- package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/prompts.d.ts +3 -3
- package/dist/core/extensions/builtin/compaction/prompts.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/prompts.js +0 -22
- package/dist/core/extensions/builtin/compaction/prompts.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/repair-tool-pairs.d.ts +4 -0
- package/dist/core/extensions/builtin/compaction/repair-tool-pairs.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/repair-tool-pairs.js +48 -0
- package/dist/core/extensions/builtin/compaction/repair-tool-pairs.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +3 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +80 -33
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +8 -0
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.js +12 -6
- package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/diff.d.ts.map +1 -1
- package/dist/core/extensions/builtin/diff.js +1 -1
- package/dist/core/extensions/builtin/diff.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.js +5 -128
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +0 -2
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/openai-web-search/index.d.ts +6 -2
- package/dist/core/extensions/builtin/openai-web-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/openai-web-search/index.js +82 -10
- package/dist/core/extensions/builtin/openai-web-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/permission-system/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/permission-system/prompt.js +0 -5
- package/dist/core/extensions/builtin/permission-system/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/system-messages.d.ts +1 -1
- package/dist/core/extensions/builtin/system-messages.d.ts.map +1 -1
- package/dist/core/extensions/builtin/system-messages.js.map +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.js +8 -4
- package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.d.ts +3 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.js +89 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-chat-completions-payload.js.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.d.ts +3 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.js +122 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-openai-responses-payload.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +18 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +22 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/messages.d.ts +3 -3
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +5 -10
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +66 -9
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/package-manager.d.ts +5 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +72 -31
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +6 -4
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -22
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +39 -9
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +0 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +2 -5
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/thinking-levels.d.ts +6 -0
- package/dist/core/thinking-levels.d.ts.map +1 -0
- package/dist/core/thinking-levels.js +36 -0
- package/dist/core/thinking-levels.js.map +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +15 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/diff-render.d.ts +13 -0
- package/dist/core/tools/diff-render.d.ts.map +1 -0
- package/dist/core/tools/diff-render.js +130 -0
- package/dist/core/tools/diff-render.js.map +1 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +8 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +28 -7
- package/dist/core/tools/write.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +20 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +2 -2
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +7 -4
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +42 -44
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +3 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +177 -82
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-info-format.d.ts +3 -0
- package/dist/modes/interactive/session-info-format.d.ts.map +1 -0
- package/dist/modes/interactive/session-info-format.js +44 -0
- package/dist/modes/interactive/session-info-format.js.map +1 -0
- package/dist/modes/interactive/working-status.d.ts +21 -0
- package/dist/modes/interactive/working-status.d.ts.map +1 -0
- package/dist/modes/interactive/working-status.js +71 -0
- package/dist/modes/interactive/working-status.js.map +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +3 -4
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/senpi +5 -1
- package/dist/utils/child-process.d.ts +7 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +60 -7
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/custom-provider.md +55 -0
- package/docs/extensions.md +1 -2
- package/docs/index.md +0 -1
- package/docs/models.md +9 -0
- package/docs/sdk.md +0 -1
- package/docs/settings.md +2 -32
- package/docs/skills.md +3 -4
- package/docs/termux.md +2 -2
- package/docs/usage.md +1 -1
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/overlay-qa-tests.ts +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +6 -6
- package/dist/core/extensions/builtin/background-task/cancel-tool.d.ts +0 -10
- package/dist/core/extensions/builtin/background-task/cancel-tool.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/cancel-tool.js +0 -109
- package/dist/core/extensions/builtin/background-task/cancel-tool.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/index.d.ts +0 -3
- package/dist/core/extensions/builtin/background-task/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/index.js +0 -207
- package/dist/core/extensions/builtin/background-task/index.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/manager.d.ts +0 -17
- package/dist/core/extensions/builtin/background-task/manager.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/manager.js +0 -114
- package/dist/core/extensions/builtin/background-task/manager.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/notification.d.ts +0 -22
- package/dist/core/extensions/builtin/background-task/notification.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/notification.js +0 -105
- package/dist/core/extensions/builtin/background-task/notification.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/output-tool.d.ts +0 -11
- package/dist/core/extensions/builtin/background-task/output-tool.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/output-tool.js +0 -127
- package/dist/core/extensions/builtin/background-task/output-tool.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/spawner.d.ts +0 -8
- package/dist/core/extensions/builtin/background-task/spawner.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/spawner.js +0 -207
- package/dist/core/extensions/builtin/background-task/spawner.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/task-tool.d.ts +0 -20
- package/dist/core/extensions/builtin/background-task/task-tool.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/task-tool.js +0 -302
- package/dist/core/extensions/builtin/background-task/task-tool.js.map +0 -1
- package/dist/core/extensions/builtin/background-task/types.d.ts +0 -72
- package/dist/core/extensions/builtin/background-task/types.d.ts.map +0 -1
- package/dist/core/extensions/builtin/background-task/types.js +0 -32
- package/dist/core/extensions/builtin/background-task/types.js.map +0 -1
- package/docs/agents.md +0 -348
- package/examples/extensions/subagent/README.md +0 -172
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -987
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
|
@@ -26,7 +26,7 @@ import { globSync } from "glob";
|
|
|
26
26
|
import ignore from "ignore";
|
|
27
27
|
import { minimatch } from "minimatch";
|
|
28
28
|
import { CONFIG_DIR_NAME } from "../config.js";
|
|
29
|
-
import {
|
|
29
|
+
import { resolveSpawnCommand } from "../utils/child-process.js";
|
|
30
30
|
import { parseGitUrl } from "../utils/git.js";
|
|
31
31
|
import { canonicalizePath, isLocalPath } from "../utils/paths.js";
|
|
32
32
|
import { isStdoutTakenOver } from "./output-guard.js";
|
|
@@ -845,7 +845,7 @@ export class DefaultPackageManager {
|
|
|
845
845
|
await Promise.all(tasks);
|
|
846
846
|
}
|
|
847
847
|
async shouldUpdateNpmSource(source, scope) {
|
|
848
|
-
const installedPath = this.
|
|
848
|
+
const installedPath = this.getManagedNpmInstallPath(source, scope);
|
|
849
849
|
const installedVersion = existsSync(installedPath) ? this.getInstalledNpmVersion(installedPath) : undefined;
|
|
850
850
|
if (!installedVersion) {
|
|
851
851
|
return true;
|
|
@@ -871,13 +871,9 @@ export class DefaultPackageManager {
|
|
|
871
871
|
});
|
|
872
872
|
}
|
|
873
873
|
async installNpmBatch(specs, scope) {
|
|
874
|
-
if (scope === "user") {
|
|
875
|
-
await this.runNpmCommand(["install", "-g", ...specs]);
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
874
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
879
875
|
this.ensureNpmProject(installRoot);
|
|
880
|
-
await this.runNpmCommand(
|
|
876
|
+
await this.runNpmCommand(this.getNpmInstallArgs(specs, installRoot));
|
|
881
877
|
}
|
|
882
878
|
async checkForAvailableUpdates() {
|
|
883
879
|
if (isOfflineModeEnabled()) {
|
|
@@ -963,13 +959,14 @@ export class DefaultPackageManager {
|
|
|
963
959
|
return true;
|
|
964
960
|
};
|
|
965
961
|
if (parsed.type === "npm") {
|
|
966
|
-
|
|
962
|
+
let installedPath = this.getNpmInstallPath(parsed, scope);
|
|
967
963
|
const needsInstall = !existsSync(installedPath) ||
|
|
968
964
|
(parsed.pinned && !(await this.installedNpmMatchesPinnedVersion(parsed, installedPath)));
|
|
969
965
|
if (needsInstall) {
|
|
970
966
|
const installed = await installMissing();
|
|
971
967
|
if (!installed)
|
|
972
968
|
continue;
|
|
969
|
+
installedPath = this.getNpmInstallPath(parsed, scope);
|
|
973
970
|
}
|
|
974
971
|
metadata.baseDir = installedPath;
|
|
975
972
|
this.collectPackageResources(installedPath, accumulator, filter, metadata);
|
|
@@ -1363,6 +1360,13 @@ export class DefaultPackageManager {
|
|
|
1363
1360
|
}
|
|
1364
1361
|
return { command, args };
|
|
1365
1362
|
}
|
|
1363
|
+
getPackageManagerName() {
|
|
1364
|
+
const npmCommand = this.getNpmCommand();
|
|
1365
|
+
const commandParts = [npmCommand.command, ...npmCommand.args];
|
|
1366
|
+
const separatorIndex = commandParts.lastIndexOf("--");
|
|
1367
|
+
const packageManagerCommand = separatorIndex >= 0 ? commandParts[separatorIndex + 1] : npmCommand.command;
|
|
1368
|
+
return packageManagerCommand ? basename(packageManagerCommand).replace(/\.(cmd|exe)$/i, "") : "";
|
|
1369
|
+
}
|
|
1366
1370
|
async runNpmCommand(args, options) {
|
|
1367
1371
|
const npmCommand = this.getNpmCommand();
|
|
1368
1372
|
await this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);
|
|
@@ -1378,24 +1382,30 @@ export class DefaultPackageManager {
|
|
|
1378
1382
|
const npmCommand = this.getNpmCommand();
|
|
1379
1383
|
return this.runCommandSync(npmCommand.command, [...npmCommand.args, ...args]);
|
|
1380
1384
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
return;
|
|
1385
|
+
getNpmInstallArgs(specs, installRoot) {
|
|
1386
|
+
const packageManagerName = this.getPackageManagerName();
|
|
1387
|
+
if (packageManagerName === "bun") {
|
|
1388
|
+
return ["install", ...specs, "--cwd", installRoot];
|
|
1389
|
+
}
|
|
1390
|
+
if (packageManagerName === "pnpm") {
|
|
1391
|
+
return ["install", ...specs, "--prefix", installRoot, "--config.strict-dep-builds=false"];
|
|
1385
1392
|
}
|
|
1393
|
+
return ["install", ...specs, "--prefix", installRoot];
|
|
1394
|
+
}
|
|
1395
|
+
async installNpm(source, scope, temporary) {
|
|
1386
1396
|
const installRoot = this.getNpmInstallRoot(scope, temporary);
|
|
1387
1397
|
this.ensureNpmProject(installRoot);
|
|
1388
|
-
await this.runNpmCommand([
|
|
1398
|
+
await this.runNpmCommand(this.getNpmInstallArgs([source.spec], installRoot));
|
|
1389
1399
|
}
|
|
1390
1400
|
async uninstallNpm(source, scope) {
|
|
1391
|
-
if (scope === "user") {
|
|
1392
|
-
await this.runNpmCommand(["uninstall", "-g", source.name]);
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
1401
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
1396
1402
|
if (!existsSync(installRoot)) {
|
|
1397
1403
|
return;
|
|
1398
1404
|
}
|
|
1405
|
+
if (this.getPackageManagerName() === "bun") {
|
|
1406
|
+
await this.runNpmCommand(["uninstall", source.name, "--cwd", installRoot]);
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1399
1409
|
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
|
|
1400
1410
|
}
|
|
1401
1411
|
async installGit(source, scope) {
|
|
@@ -1518,7 +1528,7 @@ export class DefaultPackageManager {
|
|
|
1518
1528
|
if (scope === "project") {
|
|
1519
1529
|
return join(this.cwd, CONFIG_DIR_NAME, "npm");
|
|
1520
1530
|
}
|
|
1521
|
-
return join(this.
|
|
1531
|
+
return join(this.agentDir, "npm");
|
|
1522
1532
|
}
|
|
1523
1533
|
getGlobalNpmRoot() {
|
|
1524
1534
|
const npmCommand = this.getNpmCommand();
|
|
@@ -1526,8 +1536,7 @@ export class DefaultPackageManager {
|
|
|
1526
1536
|
if (this.globalNpmRoot && this.globalNpmRootCommandKey === commandKey) {
|
|
1527
1537
|
return this.globalNpmRoot;
|
|
1528
1538
|
}
|
|
1529
|
-
|
|
1530
|
-
if (isBunPackageManager) {
|
|
1539
|
+
if (this.getPackageManagerName() === "bun") {
|
|
1531
1540
|
const binDir = this.runNpmCommandSync(["pm", "bin", "-g"]).trim();
|
|
1532
1541
|
this.globalNpmRoot = join(dirname(binDir), "install", "global", "node_modules");
|
|
1533
1542
|
}
|
|
@@ -1537,14 +1546,43 @@ export class DefaultPackageManager {
|
|
|
1537
1546
|
this.globalNpmRootCommandKey = commandKey;
|
|
1538
1547
|
return this.globalNpmRoot;
|
|
1539
1548
|
}
|
|
1540
|
-
|
|
1549
|
+
getPnpmGlobalPackagePath(packageName) {
|
|
1550
|
+
if (this.getPackageManagerName() !== "pnpm") {
|
|
1551
|
+
return undefined;
|
|
1552
|
+
}
|
|
1553
|
+
const output = this.runNpmCommandSync(["list", "-g", "--depth", "0", "--json"]);
|
|
1554
|
+
const entries = JSON.parse(output);
|
|
1555
|
+
for (const entry of entries) {
|
|
1556
|
+
const path = entry.dependencies?.[packageName]?.path;
|
|
1557
|
+
if (path)
|
|
1558
|
+
return path;
|
|
1559
|
+
}
|
|
1560
|
+
return undefined;
|
|
1561
|
+
}
|
|
1562
|
+
getManagedNpmInstallPath(source, scope) {
|
|
1541
1563
|
if (scope === "temporary") {
|
|
1542
1564
|
return join(this.getTemporaryDir("npm"), "node_modules", source.name);
|
|
1543
1565
|
}
|
|
1544
1566
|
if (scope === "project") {
|
|
1545
1567
|
return join(this.cwd, CONFIG_DIR_NAME, "npm", "node_modules", source.name);
|
|
1546
1568
|
}
|
|
1547
|
-
return join(this.
|
|
1569
|
+
return join(this.agentDir, "npm", "node_modules", source.name);
|
|
1570
|
+
}
|
|
1571
|
+
getLegacyGlobalNpmInstallPath(source) {
|
|
1572
|
+
try {
|
|
1573
|
+
return this.getPnpmGlobalPackagePath(source.name) ?? join(this.getGlobalNpmRoot(), source.name);
|
|
1574
|
+
}
|
|
1575
|
+
catch {
|
|
1576
|
+
return undefined;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
getNpmInstallPath(source, scope) {
|
|
1580
|
+
const managedPath = this.getManagedNpmInstallPath(source, scope);
|
|
1581
|
+
if (scope !== "user" || existsSync(managedPath)) {
|
|
1582
|
+
return managedPath;
|
|
1583
|
+
}
|
|
1584
|
+
const legacyPath = this.getLegacyGlobalNpmInstallPath(source);
|
|
1585
|
+
return legacyPath && existsSync(legacyPath) ? legacyPath : managedPath;
|
|
1548
1586
|
}
|
|
1549
1587
|
getGitInstallPath(source, scope) {
|
|
1550
1588
|
if (scope === "temporary") {
|
|
@@ -1910,20 +1948,22 @@ export class DefaultPackageManager {
|
|
|
1910
1948
|
};
|
|
1911
1949
|
}
|
|
1912
1950
|
spawnCommand(command, args, options) {
|
|
1913
|
-
|
|
1951
|
+
const env = getEnv();
|
|
1952
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
1953
|
+
return spawn(resolved.command, resolved.args, {
|
|
1914
1954
|
cwd: options?.cwd,
|
|
1915
1955
|
stdio: isStdoutTakenOver() ? ["ignore", 2, 2] : "inherit",
|
|
1916
|
-
|
|
1917
|
-
env: getEnv(),
|
|
1956
|
+
env,
|
|
1918
1957
|
});
|
|
1919
1958
|
}
|
|
1920
1959
|
spawnCaptureCommand(command, args, options) {
|
|
1921
1960
|
const baseEnv = getEnv();
|
|
1922
|
-
|
|
1961
|
+
const env = options?.env ? { ...baseEnv, ...options.env } : baseEnv;
|
|
1962
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
1963
|
+
return spawn(resolved.command, resolved.args, {
|
|
1923
1964
|
cwd: options?.cwd,
|
|
1924
1965
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1925
|
-
|
|
1926
|
-
env: options?.env ? { ...baseEnv, ...options.env } : baseEnv,
|
|
1966
|
+
env,
|
|
1927
1967
|
});
|
|
1928
1968
|
}
|
|
1929
1969
|
runCommandCapture(command, args, options) {
|
|
@@ -1980,11 +2020,12 @@ export class DefaultPackageManager {
|
|
|
1980
2020
|
});
|
|
1981
2021
|
}
|
|
1982
2022
|
runCommandSync(command, args) {
|
|
1983
|
-
const
|
|
2023
|
+
const env = getEnv();
|
|
2024
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
2025
|
+
const result = spawnSync(resolved.command, resolved.args, {
|
|
1984
2026
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1985
2027
|
encoding: "utf-8",
|
|
1986
|
-
|
|
1987
|
-
env: getEnv(),
|
|
2028
|
+
env,
|
|
1988
2029
|
});
|
|
1989
2030
|
if (result.error || result.status !== 0) {
|
|
1990
2031
|
throw new Error(`Failed to run ${command} ${args.join(" ")}: ${result.error?.message || result.stderr || result.stdout}`);
|