open-multi-agent-kit 0.95.0 → 0.95.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 +33 -0
- package/README.md +1 -1
- package/dist/approvals/approval-receipt-store.d.ts +18 -0
- package/dist/approvals/approval-receipt-store.d.ts.map +1 -0
- package/dist/approvals/approval-receipt-store.js +169 -0
- package/dist/approvals/approval-receipt-store.js.map +1 -0
- package/dist/approvals/approval-receipt.d.ts +43 -0
- package/dist/approvals/approval-receipt.d.ts.map +1 -0
- package/dist/approvals/approval-receipt.js +208 -0
- package/dist/approvals/approval-receipt.js.map +1 -0
- package/dist/approvals/approval-verifier.d.ts +17 -0
- package/dist/approvals/approval-verifier.d.ts.map +1 -0
- package/dist/approvals/approval-verifier.js +23 -0
- package/dist/approvals/approval-verifier.js.map +1 -0
- package/dist/approvals/plannotator-approval-bridge.d.ts +58 -0
- package/dist/approvals/plannotator-approval-bridge.d.ts.map +1 -0
- package/dist/approvals/plannotator-approval-bridge.js +169 -0
- package/dist/approvals/plannotator-approval-bridge.js.map +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/commands/package-doctor-cli.d.ts +13 -0
- package/dist/commands/package-doctor-cli.d.ts.map +1 -0
- package/dist/commands/package-doctor-cli.js +80 -0
- package/dist/commands/package-doctor-cli.js.map +1 -0
- package/dist/commands/router-feedback-cli.d.ts +11 -0
- package/dist/commands/router-feedback-cli.d.ts.map +1 -0
- package/dist/commands/router-feedback-cli.js +99 -0
- package/dist/commands/router-feedback-cli.js.map +1 -0
- package/dist/commands/stats-cli.d.ts +20 -0
- package/dist/commands/stats-cli.d.ts.map +1 -0
- package/dist/commands/stats-cli.js +99 -0
- package/dist/commands/stats-cli.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +4 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +97 -29
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +583 -199
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +8 -2
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/transaction.d.ts +9 -0
- package/dist/core/compaction/transaction.d.ts.map +1 -1
- package/dist/core/compaction/transaction.js +17 -2
- package/dist/core/compaction/transaction.js.map +1 -1
- package/dist/core/context-budget-governor-v2.d.ts +1 -1
- package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
- package/dist/core/context-budget-governor-v2.js +1 -1
- package/dist/core/context-budget-governor-v2.js.map +1 -1
- package/dist/core/context-budget-system-prompt.d.ts.map +1 -1
- package/dist/core/context-budget-system-prompt.js +18 -2
- package/dist/core/context-budget-system-prompt.js.map +1 -1
- package/dist/core/context-budget-v2-cache-disk.d.ts +109 -0
- package/dist/core/context-budget-v2-cache-disk.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-disk.js +343 -0
- package/dist/core/context-budget-v2-cache-disk.js.map +1 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts +22 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-keys.js +4 -4
- package/dist/core/context-budget-v2-cache-keys.js.map +1 -1
- package/dist/core/context-budget-v2-cache.d.ts +1 -0
- package/dist/core/context-budget-v2-cache.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache.js +1 -0
- package/dist/core/context-budget-v2-cache.js.map +1 -1
- package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -1
- package/dist/core/context-budget-v2-plan-cache-keys.js +39 -5
- package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -1
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +17 -14
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +1 -0
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +45 -22
- package/dist/core/extensions/loader.js.bak-sharedjiti-20260812-111246 +553 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +4 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/headroom.d.ts.map +1 -1
- package/dist/core/headroom.js +7 -2
- package/dist/core/headroom.js.map +1 -1
- package/dist/core/mcp/client.d.ts +105 -0
- package/dist/core/mcp/client.d.ts.map +1 -0
- package/dist/core/mcp/client.js +198 -0
- package/dist/core/mcp/client.js.map +1 -0
- package/dist/core/mcp/config.d.ts +23 -0
- package/dist/core/mcp/config.d.ts.map +1 -0
- package/dist/core/mcp/config.js +89 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +15 -0
- package/dist/core/mcp/index.d.ts.map +1 -0
- package/dist/core/mcp/index.js +15 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +84 -0
- package/dist/core/mcp/manager.d.ts.map +1 -0
- package/dist/core/mcp/manager.js +173 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/mcp/protocol.d.ts +59 -0
- package/dist/core/mcp/protocol.d.ts.map +1 -0
- package/dist/core/mcp/protocol.js +103 -0
- package/dist/core/mcp/protocol.js.map +1 -0
- package/dist/core/mcp/stdio-transport.d.ts +63 -0
- package/dist/core/mcp/stdio-transport.d.ts.map +1 -0
- package/dist/core/mcp/stdio-transport.js +132 -0
- package/dist/core/mcp/stdio-transport.js.map +1 -0
- package/dist/core/mcp/tools.d.ts +47 -0
- package/dist/core/mcp/tools.d.ts.map +1 -0
- package/dist/core/mcp/tools.js +102 -0
- package/dist/core/mcp/tools.js.map +1 -0
- package/dist/core/package-archive.d.ts +3 -0
- package/dist/core/package-archive.d.ts.map +1 -0
- package/dist/core/package-archive.js +161 -0
- package/dist/core/package-archive.js.map +1 -0
- package/dist/core/package-doctor-source-scan.d.ts +13 -0
- package/dist/core/package-doctor-source-scan.d.ts.map +1 -0
- package/dist/core/package-doctor-source-scan.js +124 -0
- package/dist/core/package-doctor-source-scan.js.map +1 -0
- package/dist/core/package-doctor.d.ts +41 -0
- package/dist/core/package-doctor.d.ts.map +1 -0
- package/dist/core/package-doctor.js +145 -0
- package/dist/core/package-doctor.js.map +1 -0
- package/dist/core/package-manager.d.ts +10 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +175 -42
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-manifest.d.ts +26 -0
- package/dist/core/package-manifest.d.ts.map +1 -0
- package/dist/core/package-manifest.js +85 -0
- package/dist/core/package-manifest.js.map +1 -0
- package/dist/core/pi-compat.d.ts +5 -0
- package/dist/core/pi-compat.d.ts.map +1 -0
- package/dist/core/pi-compat.js +18 -0
- package/dist/core/pi-compat.js.map +1 -0
- package/dist/core/reasoning-router-bias.d.ts +10 -14
- package/dist/core/reasoning-router-bias.d.ts.map +1 -1
- package/dist/core/reasoning-router-bias.js +22 -15
- package/dist/core/reasoning-router-bias.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +9 -1
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +20 -5
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/redaction.d.ts +2 -5
- package/dist/core/redaction.d.ts.map +1 -1
- package/dist/core/redaction.js +14 -1
- package/dist/core/redaction.js.map +1 -1
- package/dist/core/repository-learning-scope.d.ts +10 -0
- package/dist/core/repository-learning-scope.d.ts.map +1 -0
- package/dist/core/repository-learning-scope.js +42 -0
- package/dist/core/repository-learning-scope.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +16 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/router-feedback-collector.d.ts +2 -1
- package/dist/core/router-feedback-collector.d.ts.map +1 -1
- package/dist/core/router-feedback-collector.js +2 -2
- package/dist/core/router-feedback-collector.js.map +1 -1
- package/dist/core/runtime-provenance.d.ts +54 -0
- package/dist/core/runtime-provenance.d.ts.map +1 -0
- package/dist/core/runtime-provenance.js +115 -0
- package/dist/core/runtime-provenance.js.map +1 -0
- package/dist/core/sandbox/backend.d.ts.map +1 -1
- package/dist/core/sandbox/backend.js +39 -21
- package/dist/core/sandbox/backend.js.map +1 -1
- package/dist/core/sandbox/default-policy.d.ts +4 -5
- package/dist/core/sandbox/default-policy.d.ts.map +1 -1
- package/dist/core/sandbox/default-policy.js +9 -11
- package/dist/core/sandbox/default-policy.js.map +1 -1
- package/dist/core/session-bash-runtime.d.ts +4 -4
- package/dist/core/session-bash-runtime.d.ts.map +1 -1
- package/dist/core/session-bash-runtime.js +6 -5
- package/dist/core/session-bash-runtime.js.map +1 -1
- package/dist/core/session-compaction-service.d.ts.map +1 -1
- package/dist/core/session-compaction-service.js +7 -7
- package/dist/core/session-compaction-service.js.map +1 -1
- package/dist/core/session-manager.d.ts +4 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +47 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -3
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts +9 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +15 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/turn-metrics.d.ts +135 -0
- package/dist/core/turn-metrics.d.ts.map +1 -0
- package/dist/core/turn-metrics.js +261 -0
- package/dist/core/turn-metrics.js.map +1 -0
- package/dist/core/verified-bash-runtime.d.ts.map +1 -1
- package/dist/core/verified-bash-runtime.js +10 -4
- package/dist/core/verified-bash-runtime.js.map +1 -1
- package/dist/guardrails/replay-ledger-lock-owner.d.ts +7 -0
- package/dist/guardrails/replay-ledger-lock-owner.d.ts.map +1 -1
- package/dist/guardrails/replay-ledger-lock-owner.js +39 -0
- package/dist/guardrails/replay-ledger-lock-owner.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +18 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.js +2 -2
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +3 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +40 -12
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-sidebar.d.ts +14 -2
- package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-sidebar.js +106 -19
- package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +10 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +104 -17
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/compaction.md +25 -3
- package/docs/containerization.md +14 -2
- package/docs/docs.json +8 -0
- package/docs/environment-variables.md +1 -1
- package/docs/extensions.md +75 -16
- package/docs/mcp.md +97 -0
- package/docs/metrics.md +87 -0
- package/docs/packages.md +25 -4
- package/docs/providers.md +1 -1
- package/docs/sdk.md +25 -4
- package/docs/settings.md +8 -7
- package/docs/usage.md +13 -3
- 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/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/plannotator-approval-bridge.ts +83 -0
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/README.md +21 -11
- package/examples/extensions/subagent/adaptive-agent-runtime.ts +9 -3
- package/examples/extensions/subagent/agents/planner.md +1 -3
- package/examples/extensions/subagent/agents/reviewer.md +1 -3
- package/examples/extensions/subagent/agents/scout.md +1 -3
- package/examples/extensions/subagent/agents/worker.md +0 -1
- package/examples/extensions/subagent/agents.test.ts +9 -0
- package/examples/extensions/subagent/agents.ts +11 -4
- package/examples/extensions/subagent/deadline-budget.test.ts +32 -0
- package/examples/extensions/subagent/deadline-budget.ts +25 -1
- package/examples/extensions/subagent/fixtures/fake-omk-json.mjs +10 -0
- package/examples/extensions/subagent/index.ts +234 -55
- package/examples/extensions/subagent/subagent-execution-policy.test.ts +27 -0
- package/examples/extensions/subagent/subagent-extension-smoke.test.ts +167 -2
- package/examples/extensions/subagent/workflow-graph.test.ts +80 -0
- package/examples/extensions/subagent/workflow-graph.ts +89 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +253 -439
- package/package.json +8 -8
|
@@ -29,6 +29,8 @@ import { spawnProcess, spawnProcessSync } from "../utils/child-process.js";
|
|
|
29
29
|
import { parseGitUrl } from "../utils/git.js";
|
|
30
30
|
import { canonicalizePath, isLocalPath, markPathIgnoredByCloudSync, resolvePath } from "../utils/paths.js";
|
|
31
31
|
import { isStdoutTakenOver } from "./output-guard.js";
|
|
32
|
+
import { extractNpmPackageTarball } from "./package-archive.js";
|
|
33
|
+
import { readPackageManifest as readPackageManifestFile, } from "./package-manifest.js";
|
|
32
34
|
const NETWORK_TIMEOUT_MS = 10000;
|
|
33
35
|
const UPDATE_CHECK_CONCURRENCY = 4;
|
|
34
36
|
const GIT_UPDATE_CONCURRENCY = 4;
|
|
@@ -370,20 +372,10 @@ function collectAutoThemeEntries(dir) {
|
|
|
370
372
|
}
|
|
371
373
|
return entries;
|
|
372
374
|
}
|
|
373
|
-
function readOmkManifestFile(packageJsonPath) {
|
|
374
|
-
try {
|
|
375
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
376
|
-
const pkg = JSON.parse(content);
|
|
377
|
-
return pkg.omk ?? null;
|
|
378
|
-
}
|
|
379
|
-
catch {
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
375
|
function resolveExtensionEntries(dir) {
|
|
384
376
|
const packageJsonPath = join(dir, "package.json");
|
|
385
377
|
if (existsSync(packageJsonPath)) {
|
|
386
|
-
const manifest =
|
|
378
|
+
const manifest = readPackageManifestFile(packageJsonPath)?.manifest;
|
|
387
379
|
if (manifest?.extensions?.length) {
|
|
388
380
|
const entries = [];
|
|
389
381
|
for (const extPath of manifest.extensions) {
|
|
@@ -729,6 +721,42 @@ export class DefaultPackageManager {
|
|
|
729
721
|
await this.resolvePackageSources(packageSources, accumulator);
|
|
730
722
|
return this.toResolvedPaths(accumulator);
|
|
731
723
|
}
|
|
724
|
+
async preparePackageInspection(source) {
|
|
725
|
+
const parsed = this.parseSource(source);
|
|
726
|
+
const accumulator = this.createAccumulator();
|
|
727
|
+
const metadata = { source, scope: "temporary", origin: "package" };
|
|
728
|
+
let packageRoot;
|
|
729
|
+
let cleanupRoot;
|
|
730
|
+
if (parsed.type === "local") {
|
|
731
|
+
const resolved = this.resolvePathFromBase(parsed.path, this.cwd);
|
|
732
|
+
if (!existsSync(resolved))
|
|
733
|
+
throw new Error(`Path does not exist: ${resolved}`);
|
|
734
|
+
packageRoot = statSync(resolved).isDirectory() ? resolved : dirname(resolved);
|
|
735
|
+
this.resolveLocalExtensionSource(parsed, accumulator, undefined, metadata, this.cwd);
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
if (isOfflineModeEnabled())
|
|
739
|
+
throw new Error(`Package is unavailable in offline mode: ${source}`);
|
|
740
|
+
packageRoot =
|
|
741
|
+
parsed.type === "npm"
|
|
742
|
+
? await this.downloadNpmForInspection(parsed)
|
|
743
|
+
: await this.cloneGitForInspection(parsed);
|
|
744
|
+
cleanupRoot = dirname(packageRoot);
|
|
745
|
+
metadata.baseDir = packageRoot;
|
|
746
|
+
try {
|
|
747
|
+
this.collectPackageResources(packageRoot, accumulator, undefined, metadata);
|
|
748
|
+
}
|
|
749
|
+
catch (error) {
|
|
750
|
+
rmSync(cleanupRoot, { recursive: true, force: true });
|
|
751
|
+
throw error;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
packageRoot,
|
|
756
|
+
resources: this.toResolvedPaths(accumulator),
|
|
757
|
+
...(cleanupRoot ? { cleanup: () => rmSync(cleanupRoot, { recursive: true, force: true }) } : {}),
|
|
758
|
+
};
|
|
759
|
+
}
|
|
732
760
|
listConfiguredPackages() {
|
|
733
761
|
const globalSettings = this.settingsManager.getGlobalSettings();
|
|
734
762
|
const projectSettings = this.settingsManager.getProjectSettings();
|
|
@@ -1218,7 +1246,15 @@ export class DefaultPackageManager {
|
|
|
1218
1246
|
const raw = stdout.trim();
|
|
1219
1247
|
if (!raw)
|
|
1220
1248
|
throw new Error("Empty response from npm view");
|
|
1221
|
-
|
|
1249
|
+
try {
|
|
1250
|
+
const parsed = JSON.parse(raw);
|
|
1251
|
+
if (typeof parsed === "string" && parsed.length > 0)
|
|
1252
|
+
return parsed;
|
|
1253
|
+
}
|
|
1254
|
+
catch {
|
|
1255
|
+
// Fall through to the stable validation error below.
|
|
1256
|
+
}
|
|
1257
|
+
throw new Error("Invalid version response from npm view");
|
|
1222
1258
|
}
|
|
1223
1259
|
async gitHasAvailableUpdate(installedPath) {
|
|
1224
1260
|
if (isOfflineModeEnabled()) {
|
|
@@ -1444,14 +1480,15 @@ export class DefaultPackageManager {
|
|
|
1444
1480
|
const npmCommand = this.getNpmCommand();
|
|
1445
1481
|
return this.runCommandSync(npmCommand.command, [...npmCommand.args, ...args]);
|
|
1446
1482
|
}
|
|
1447
|
-
getNpmInstallArgs(specs, installRoot) {
|
|
1483
|
+
getNpmInstallArgs(specs, installRoot, ignoreScripts = false) {
|
|
1448
1484
|
const packageManagerName = this.getPackageManagerName();
|
|
1485
|
+
const scriptArgs = ignoreScripts ? ["--ignore-scripts"] : [];
|
|
1449
1486
|
// Extension packages run inside OMK and resolve OMK APIs through loader aliases/virtual modules.
|
|
1450
1487
|
// Disable peer dependency resolution for managed installs (npm's --legacy-peer-deps, and
|
|
1451
1488
|
// equivalent bun/pnpm settings) so package managers do not install or solve host-provided
|
|
1452
1489
|
// omk-agent-core, omk-ai, and omk-tui peers. Stale auto-installed host peers can otherwise block updates.
|
|
1453
1490
|
if (packageManagerName === "bun") {
|
|
1454
|
-
return ["install", ...specs, "--cwd", installRoot, "--omit=peer"];
|
|
1491
|
+
return ["install", ...specs, "--cwd", installRoot, "--omit=peer", ...scriptArgs];
|
|
1455
1492
|
}
|
|
1456
1493
|
if (packageManagerName === "pnpm") {
|
|
1457
1494
|
return [
|
|
@@ -1462,14 +1499,74 @@ export class DefaultPackageManager {
|
|
|
1462
1499
|
"--config.auto-install-peers=false",
|
|
1463
1500
|
"--config.strict-peer-dependencies=false",
|
|
1464
1501
|
"--config.strict-dep-builds=false",
|
|
1502
|
+
...scriptArgs,
|
|
1465
1503
|
];
|
|
1466
1504
|
}
|
|
1467
|
-
return ["install", ...specs, "--prefix", installRoot, "--legacy-peer-deps"];
|
|
1505
|
+
return ["install", ...specs, "--prefix", installRoot, "--legacy-peer-deps", ...scriptArgs];
|
|
1506
|
+
}
|
|
1507
|
+
async cloneGitForInspection(source) {
|
|
1508
|
+
if (source.repo.startsWith("-") || /[\u0000-\u001f\u007f]/u.test(source.repo)) {
|
|
1509
|
+
throw new Error("Git inspection URL contains unsupported option or control characters");
|
|
1510
|
+
}
|
|
1511
|
+
if (source.ref && (source.ref.startsWith("-") || /[\u0000-\u001f\u007f]/u.test(source.ref))) {
|
|
1512
|
+
throw new Error("Git inspection ref contains unsupported option or control characters");
|
|
1513
|
+
}
|
|
1514
|
+
const sourceHash = createHash("sha256")
|
|
1515
|
+
.update(source.repo)
|
|
1516
|
+
.update("\0")
|
|
1517
|
+
.update(source.ref ?? "")
|
|
1518
|
+
.digest("hex")
|
|
1519
|
+
.slice(0, 12);
|
|
1520
|
+
const inspectionRoot = this.getTemporaryDir("doctor-git", `${process.pid}-${sourceHash}`);
|
|
1521
|
+
const packageRoot = join(inspectionRoot, "package");
|
|
1522
|
+
rmSync(inspectionRoot, { recursive: true, force: true });
|
|
1523
|
+
mkdirSync(inspectionRoot, { recursive: true });
|
|
1524
|
+
try {
|
|
1525
|
+
await this.runCommand("git", ["clone", "--", source.repo, packageRoot]);
|
|
1526
|
+
if (source.ref)
|
|
1527
|
+
await this.runCommand("git", ["checkout", source.ref], { cwd: packageRoot });
|
|
1528
|
+
return packageRoot;
|
|
1529
|
+
}
|
|
1530
|
+
catch (error) {
|
|
1531
|
+
rmSync(inspectionRoot, { recursive: true, force: true });
|
|
1532
|
+
throw error;
|
|
1533
|
+
}
|
|
1468
1534
|
}
|
|
1469
|
-
async
|
|
1535
|
+
async downloadNpmForInspection(source) {
|
|
1536
|
+
const sourceHash = createHash("sha256").update(source.spec).digest("hex").slice(0, 12);
|
|
1537
|
+
const inspectionRoot = this.getTemporaryDir("doctor-npm", `${process.pid}-${sourceHash}`);
|
|
1538
|
+
const archiveRoot = join(inspectionRoot, "archive");
|
|
1539
|
+
const packageRoot = join(inspectionRoot, "package");
|
|
1540
|
+
rmSync(inspectionRoot, { recursive: true, force: true });
|
|
1541
|
+
mkdirSync(archiveRoot, { recursive: true });
|
|
1542
|
+
try {
|
|
1543
|
+
const npmCommand = this.getNpmCommand();
|
|
1544
|
+
await this.runCommandCapture(npmCommand.command, [
|
|
1545
|
+
...npmCommand.args,
|
|
1546
|
+
"pack",
|
|
1547
|
+
"--ignore-scripts",
|
|
1548
|
+
"--json",
|
|
1549
|
+
"--pack-destination",
|
|
1550
|
+
archiveRoot,
|
|
1551
|
+
"--",
|
|
1552
|
+
source.spec,
|
|
1553
|
+
], { cwd: inspectionRoot, timeoutMs: NETWORK_TIMEOUT_MS });
|
|
1554
|
+
const archives = readdirSync(archiveRoot).filter((entry) => entry.endsWith(".tgz"));
|
|
1555
|
+
if (archives.length !== 1)
|
|
1556
|
+
throw new Error("npm pack did not produce exactly one package archive");
|
|
1557
|
+
extractNpmPackageTarball(join(archiveRoot, archives[0]), packageRoot);
|
|
1558
|
+
rmSync(archiveRoot, { recursive: true, force: true });
|
|
1559
|
+
return packageRoot;
|
|
1560
|
+
}
|
|
1561
|
+
catch (error) {
|
|
1562
|
+
rmSync(inspectionRoot, { recursive: true, force: true });
|
|
1563
|
+
throw error;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
async installNpm(source, scope, temporary, ignoreScripts = false) {
|
|
1470
1567
|
const installRoot = this.getNpmInstallRoot(scope, temporary);
|
|
1471
1568
|
this.ensureNpmProject(installRoot);
|
|
1472
|
-
await this.runNpmCommand(this.getNpmInstallArgs([source.spec], installRoot));
|
|
1569
|
+
await this.runNpmCommand(this.getNpmInstallArgs([source.spec], installRoot, ignoreScripts));
|
|
1473
1570
|
}
|
|
1474
1571
|
async uninstallNpm(source, scope) {
|
|
1475
1572
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
@@ -1482,7 +1579,7 @@ export class DefaultPackageManager {
|
|
|
1482
1579
|
}
|
|
1483
1580
|
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
|
|
1484
1581
|
}
|
|
1485
|
-
async installGit(source, scope) {
|
|
1582
|
+
async installGit(source, scope, installDependencies = true) {
|
|
1486
1583
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
1487
1584
|
if (existsSync(targetDir)) {
|
|
1488
1585
|
if (source.ref) {
|
|
@@ -1503,7 +1600,7 @@ export class DefaultPackageManager {
|
|
|
1503
1600
|
await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir });
|
|
1504
1601
|
}
|
|
1505
1602
|
const packageJsonPath = join(targetDir, "package.json");
|
|
1506
|
-
if (existsSync(packageJsonPath)) {
|
|
1603
|
+
if (installDependencies && existsSync(packageJsonPath)) {
|
|
1507
1604
|
await this.runNpmCommand(this.getGitDependencyInstallArgs(), { cwd: targetDir });
|
|
1508
1605
|
}
|
|
1509
1606
|
}
|
|
@@ -1637,11 +1734,26 @@ export class DefaultPackageManager {
|
|
|
1637
1734
|
return undefined;
|
|
1638
1735
|
}
|
|
1639
1736
|
const output = this.runNpmCommandSync(["list", "-g", "--depth", "0", "--json"]);
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1737
|
+
try {
|
|
1738
|
+
const parsed = JSON.parse(output);
|
|
1739
|
+
if (!Array.isArray(parsed))
|
|
1740
|
+
return undefined;
|
|
1741
|
+
for (const entry of parsed) {
|
|
1742
|
+
if (typeof entry !== "object" || entry === null)
|
|
1743
|
+
continue;
|
|
1744
|
+
const dependencies = entry.dependencies;
|
|
1745
|
+
if (typeof dependencies !== "object" || dependencies === null)
|
|
1746
|
+
continue;
|
|
1747
|
+
const dependency = dependencies[packageName];
|
|
1748
|
+
if (typeof dependency !== "object" || dependency === null)
|
|
1749
|
+
continue;
|
|
1750
|
+
const path = dependency.path;
|
|
1751
|
+
if (typeof path === "string" && path.length > 0)
|
|
1752
|
+
return path;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
catch {
|
|
1756
|
+
return undefined;
|
|
1645
1757
|
}
|
|
1646
1758
|
return undefined;
|
|
1647
1759
|
}
|
|
@@ -1734,8 +1846,9 @@ export class DefaultPackageManager {
|
|
|
1734
1846
|
}
|
|
1735
1847
|
return true;
|
|
1736
1848
|
}
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1849
|
+
const manifestResolution = this.readPackageManifest(packageRoot);
|
|
1850
|
+
if (manifestResolution?.key !== null && manifestResolution?.key !== undefined) {
|
|
1851
|
+
const manifest = manifestResolution.manifest ?? {};
|
|
1739
1852
|
for (const resourceType of RESOURCE_TYPES) {
|
|
1740
1853
|
const entries = manifest[resourceType];
|
|
1741
1854
|
this.addManifestEntries(entries, packageRoot, resourceType, this.getTargetMap(accumulator, resourceType), metadata);
|
|
@@ -1757,10 +1870,11 @@ export class DefaultPackageManager {
|
|
|
1757
1870
|
return hasAnyDir;
|
|
1758
1871
|
}
|
|
1759
1872
|
collectDefaultResources(packageRoot, resourceType, target, metadata) {
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1873
|
+
const manifestResolution = this.readPackageManifest(packageRoot);
|
|
1874
|
+
if (manifestResolution?.key !== null && manifestResolution?.key !== undefined) {
|
|
1875
|
+
const entries = manifestResolution.manifest?.[resourceType];
|
|
1876
|
+
if (entries)
|
|
1877
|
+
this.addManifestEntries(entries, packageRoot, resourceType, target, metadata);
|
|
1764
1878
|
return;
|
|
1765
1879
|
}
|
|
1766
1880
|
const dir = join(packageRoot, resourceType);
|
|
@@ -1794,14 +1908,17 @@ export class DefaultPackageManager {
|
|
|
1794
1908
|
* that pass the manifest's own patterns.
|
|
1795
1909
|
*/
|
|
1796
1910
|
collectManifestFiles(packageRoot, resourceType) {
|
|
1797
|
-
const
|
|
1798
|
-
const entries = manifest?.[resourceType];
|
|
1911
|
+
const manifestResolution = this.readPackageManifest(packageRoot);
|
|
1912
|
+
const entries = manifestResolution?.manifest?.[resourceType];
|
|
1799
1913
|
if (entries && entries.length > 0) {
|
|
1800
1914
|
const allFiles = this.collectFilesFromManifestEntries(entries, packageRoot, resourceType);
|
|
1801
1915
|
const manifestPatterns = entries.filter(isOverridePattern);
|
|
1802
1916
|
const enabledByManifest = manifestPatterns.length > 0 ? applyPatterns(allFiles, manifestPatterns, packageRoot) : new Set(allFiles);
|
|
1803
1917
|
return { allFiles: Array.from(enabledByManifest), enabledByManifest };
|
|
1804
1918
|
}
|
|
1919
|
+
if (manifestResolution?.key !== null && manifestResolution?.key !== undefined) {
|
|
1920
|
+
return { allFiles: [], enabledByManifest: new Set() };
|
|
1921
|
+
}
|
|
1805
1922
|
const conventionDir = join(packageRoot, resourceType);
|
|
1806
1923
|
if (!existsSync(conventionDir)) {
|
|
1807
1924
|
return { allFiles: [], enabledByManifest: new Set() };
|
|
@@ -1809,19 +1926,35 @@ export class DefaultPackageManager {
|
|
|
1809
1926
|
const allFiles = collectResourceFiles(conventionDir, resourceType);
|
|
1810
1927
|
return { allFiles, enabledByManifest: new Set(allFiles) };
|
|
1811
1928
|
}
|
|
1812
|
-
|
|
1929
|
+
readPackageManifest(packageRoot) {
|
|
1813
1930
|
const packageJsonPath = join(packageRoot, "package.json");
|
|
1814
|
-
if (!existsSync(packageJsonPath))
|
|
1931
|
+
if (!existsSync(packageJsonPath))
|
|
1815
1932
|
return null;
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
1819
|
-
const pkg = JSON.parse(content);
|
|
1820
|
-
return pkg.omk ?? null;
|
|
1821
|
-
}
|
|
1822
|
-
catch {
|
|
1933
|
+
const resolvedManifest = readPackageManifestFile(packageJsonPath);
|
|
1934
|
+
if (!resolvedManifest)
|
|
1823
1935
|
return null;
|
|
1824
|
-
|
|
1936
|
+
if (resolvedManifest.diagnostics.length > 0) {
|
|
1937
|
+
throw new Error(`Invalid package manifest: ${resolvedManifest.diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join("; ")}`);
|
|
1938
|
+
}
|
|
1939
|
+
if (!resolvedManifest.manifest || resolvedManifest.key !== "pi")
|
|
1940
|
+
return resolvedManifest;
|
|
1941
|
+
const extensions = resolvedManifest.manifest.extensions?.map((entry) => {
|
|
1942
|
+
if (hasGlobPattern(entry) || isOverridePattern(entry))
|
|
1943
|
+
return entry;
|
|
1944
|
+
const candidate = resolve(packageRoot, entry);
|
|
1945
|
+
if (!existsSync(candidate) || !statSync(candidate).isDirectory())
|
|
1946
|
+
return entry;
|
|
1947
|
+
for (const indexName of ["index.ts", "index.js", "index.mjs", "index.cjs"]) {
|
|
1948
|
+
const indexPath = join(candidate, indexName);
|
|
1949
|
+
if (existsSync(indexPath))
|
|
1950
|
+
return indexPath;
|
|
1951
|
+
}
|
|
1952
|
+
return entry;
|
|
1953
|
+
});
|
|
1954
|
+
return {
|
|
1955
|
+
...resolvedManifest,
|
|
1956
|
+
manifest: { ...resolvedManifest.manifest, ...(extensions ? { extensions } : {}) },
|
|
1957
|
+
};
|
|
1825
1958
|
}
|
|
1826
1959
|
addManifestEntries(entries, root, resourceType, target, metadata) {
|
|
1827
1960
|
if (!entries)
|