@caupulican/pi-adaptative 0.80.21 → 0.80.23
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 +29 -0
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +28 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +10 -76
- 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 +16 -7
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/exec.d.ts +20 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +52 -19
- package/dist/core/exec.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +6 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +33 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/message-retention.d.ts +26 -0
- package/dist/core/message-retention.d.ts.map +1 -0
- package/dist/core/message-retention.js +95 -0
- package/dist/core/message-retention.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +50 -29
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +4 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +45 -9
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +8 -0
- 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 +12 -0
- package/dist/core/skills.js.map +1 -1
- package/dist/core/tools/git-filter.d.ts +9 -1
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js +94 -8
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/read.d.ts +31 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +164 -33
- package/dist/core/tools/read.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +37 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +54 -18
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts +0 -7
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +17 -0
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/utils/safe-write-stream.d.ts +10 -0
- package/dist/utils/safe-write-stream.d.ts.map +1 -0
- package/dist/utils/safe-write-stream.js +16 -0
- package/dist/utils/safe-write-stream.js.map +1 -0
- package/dist/utils/sleep.d.ts +3 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js +10 -4
- package/dist/utils/sleep.js.map +1 -1
- package/docs/extensions.md +9 -3
- package/docs/skills.md +14 -2
- 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/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/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -28,6 +28,7 @@ import { CONFIG_DIR_NAME } from "../config.js";
|
|
|
28
28
|
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
|
+
import { createRollingOutputBuffer } from "./exec.js";
|
|
31
32
|
import { isStdoutTakenOver } from "./output-guard.js";
|
|
32
33
|
const NETWORK_TIMEOUT_MS = 10000;
|
|
33
34
|
const UPDATE_CHECK_CONCURRENCY = 4;
|
|
@@ -459,11 +460,10 @@ function matchesAnyPattern(filePath, patterns, baseDir) {
|
|
|
459
460
|
const rel = toPosixPath(relative(baseDir, filePath));
|
|
460
461
|
const name = basename(filePath);
|
|
461
462
|
const filePathPosix = toPosixPath(filePath);
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
const
|
|
465
|
-
const
|
|
466
|
-
const parentDirPosix = isSkillFile ? toPosixPath(parentDir) : undefined;
|
|
463
|
+
const parentDir = dirname(filePath);
|
|
464
|
+
const parentRel = toPosixPath(relative(baseDir, parentDir));
|
|
465
|
+
const parentName = basename(parentDir);
|
|
466
|
+
const parentDirPosix = toPosixPath(parentDir);
|
|
467
467
|
return patterns.some((pattern) => {
|
|
468
468
|
const normalizedPattern = toPosixPath(pattern);
|
|
469
469
|
if (minimatch(rel, normalizedPattern) ||
|
|
@@ -471,8 +471,6 @@ function matchesAnyPattern(filePath, patterns, baseDir) {
|
|
|
471
471
|
minimatch(filePathPosix, normalizedPattern)) {
|
|
472
472
|
return true;
|
|
473
473
|
}
|
|
474
|
-
if (!isSkillFile)
|
|
475
|
-
return false;
|
|
476
474
|
return (minimatch(parentRel, normalizedPattern) ||
|
|
477
475
|
minimatch(parentName, normalizedPattern) ||
|
|
478
476
|
minimatch(parentDirPosix, normalizedPattern));
|
|
@@ -488,23 +486,39 @@ function matchesAnyExactPattern(filePath, patterns, baseDir) {
|
|
|
488
486
|
const rel = toPosixPath(relative(baseDir, filePath));
|
|
489
487
|
const name = basename(filePath);
|
|
490
488
|
const filePathPosix = toPosixPath(filePath);
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
const
|
|
494
|
-
const parentDirPosix =
|
|
489
|
+
const parentDir = dirname(filePath);
|
|
490
|
+
const parentRel = toPosixPath(relative(baseDir, parentDir));
|
|
491
|
+
const parentName = basename(parentDir);
|
|
492
|
+
const parentDirPosix = toPosixPath(parentDir);
|
|
495
493
|
return patterns.some((pattern) => {
|
|
496
494
|
const normalized = normalizeExactPattern(pattern);
|
|
497
|
-
if (normalized === rel || normalized === filePathPosix) {
|
|
495
|
+
if (normalized === rel || normalized === name || normalized === filePathPosix) {
|
|
498
496
|
return true;
|
|
499
497
|
}
|
|
500
|
-
|
|
501
|
-
return false;
|
|
502
|
-
return normalized === parentRel || normalized === parentDirPosix;
|
|
498
|
+
return normalized === parentRel || normalized === parentName || normalized === parentDirPosix;
|
|
503
499
|
});
|
|
504
500
|
}
|
|
505
501
|
function getOverridePatterns(entries) {
|
|
506
502
|
return entries.filter((pattern) => pattern.startsWith("!") || pattern.startsWith("+") || pattern.startsWith("-"));
|
|
507
503
|
}
|
|
504
|
+
function toDisabledOverride(pattern) {
|
|
505
|
+
const trimmed = pattern.trim();
|
|
506
|
+
if (!trimmed)
|
|
507
|
+
return null;
|
|
508
|
+
if (trimmed.startsWith("!") || trimmed.startsWith("-"))
|
|
509
|
+
return trimmed;
|
|
510
|
+
if (trimmed.startsWith("+"))
|
|
511
|
+
return `-${trimmed.slice(1)}`;
|
|
512
|
+
return `!${trimmed}`;
|
|
513
|
+
}
|
|
514
|
+
function mergeResourceOverrides(settings, resourceType) {
|
|
515
|
+
const base = Array.isArray(settings[resourceType]) ? settings[resourceType] : [];
|
|
516
|
+
const disabledResources = settings.disabledResources;
|
|
517
|
+
const disabled = Array.isArray(disabledResources?.[resourceType])
|
|
518
|
+
? disabledResources[resourceType].map(toDisabledOverride).filter((value) => Boolean(value))
|
|
519
|
+
: [];
|
|
520
|
+
return [...base, ...disabled];
|
|
521
|
+
}
|
|
508
522
|
function isEnabledByOverrides(filePath, patterns, baseDir) {
|
|
509
523
|
const overrides = getOverridePatterns(patterns);
|
|
510
524
|
const excludes = overrides.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1));
|
|
@@ -1847,16 +1861,16 @@ export class DefaultPackageManager {
|
|
|
1847
1861
|
baseDir: projectBaseDir,
|
|
1848
1862
|
};
|
|
1849
1863
|
const userOverrides = {
|
|
1850
|
-
extensions: (globalSettings
|
|
1851
|
-
skills: (globalSettings
|
|
1852
|
-
prompts: (globalSettings
|
|
1853
|
-
themes: (globalSettings
|
|
1864
|
+
extensions: mergeResourceOverrides(globalSettings, "extensions"),
|
|
1865
|
+
skills: mergeResourceOverrides(globalSettings, "skills"),
|
|
1866
|
+
prompts: mergeResourceOverrides(globalSettings, "prompts"),
|
|
1867
|
+
themes: mergeResourceOverrides(globalSettings, "themes"),
|
|
1854
1868
|
};
|
|
1855
1869
|
const projectOverrides = {
|
|
1856
|
-
extensions: (projectSettings
|
|
1857
|
-
skills: (projectSettings
|
|
1858
|
-
prompts: (projectSettings
|
|
1859
|
-
themes: (projectSettings
|
|
1870
|
+
extensions: mergeResourceOverrides(projectSettings, "extensions"),
|
|
1871
|
+
skills: mergeResourceOverrides(projectSettings, "skills"),
|
|
1872
|
+
prompts: mergeResourceOverrides(projectSettings, "prompts"),
|
|
1873
|
+
themes: mergeResourceOverrides(projectSettings, "themes"),
|
|
1860
1874
|
};
|
|
1861
1875
|
const userDirs = {
|
|
1862
1876
|
extensions: join(globalBaseDir, "extensions"),
|
|
@@ -2008,8 +2022,11 @@ export class DefaultPackageManager {
|
|
|
2008
2022
|
runCommandCapture(command, args, options) {
|
|
2009
2023
|
return new Promise((resolvePromise, reject) => {
|
|
2010
2024
|
const child = this.spawnCaptureCommand(command, args, options);
|
|
2011
|
-
|
|
2012
|
-
|
|
2025
|
+
// Callers parse stdout, so a silently truncated tail would corrupt results.
|
|
2026
|
+
// Bound retention and fail loudly in the (pathological) overflow case.
|
|
2027
|
+
const maxCapturedOutput = 16 * 1024 * 1024;
|
|
2028
|
+
const stdout = createRollingOutputBuffer(maxCapturedOutput);
|
|
2029
|
+
const stderr = createRollingOutputBuffer(maxCapturedOutput);
|
|
2013
2030
|
let timedOut = false;
|
|
2014
2031
|
const timeout = typeof options?.timeoutMs === "number"
|
|
2015
2032
|
? setTimeout(() => {
|
|
@@ -2018,10 +2035,10 @@ export class DefaultPackageManager {
|
|
|
2018
2035
|
}, options.timeoutMs)
|
|
2019
2036
|
: undefined;
|
|
2020
2037
|
child.stdout?.on("data", (data) => {
|
|
2021
|
-
stdout
|
|
2038
|
+
stdout.push(data.toString());
|
|
2022
2039
|
});
|
|
2023
2040
|
child.stderr?.on("data", (data) => {
|
|
2024
|
-
stderr
|
|
2041
|
+
stderr.push(data.toString());
|
|
2025
2042
|
});
|
|
2026
2043
|
child.once("error", (error) => {
|
|
2027
2044
|
if (timeout)
|
|
@@ -2036,11 +2053,15 @@ export class DefaultPackageManager {
|
|
|
2036
2053
|
return;
|
|
2037
2054
|
}
|
|
2038
2055
|
if (code === 0) {
|
|
2039
|
-
|
|
2056
|
+
if (stdout.truncated()) {
|
|
2057
|
+
reject(new Error(`${command} ${args.join(" ")} produced more than ${maxCapturedOutput} bytes of output`));
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
resolvePromise(stdout.text().trim());
|
|
2040
2061
|
return;
|
|
2041
2062
|
}
|
|
2042
2063
|
const exitStatus = code === null ? `signal ${signal ?? "unknown"}` : `code ${code}`;
|
|
2043
|
-
reject(new Error(`${command} ${args.join(" ")} failed with ${exitStatus}: ${stderr || stdout}`));
|
|
2064
|
+
reject(new Error(`${command} ${args.join(" ")} failed with ${exitStatus}: ${stderr.text() || stdout.text()}`));
|
|
2044
2065
|
});
|
|
2045
2066
|
});
|
|
2046
2067
|
}
|