@caupulican/pi-adaptative 0.80.23 → 0.80.25

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +16 -2
  3. package/dist/cli/args.d.ts +2 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +14 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/core/agent-session-services.d.ts +4 -0
  8. package/dist/core/agent-session-services.d.ts.map +1 -1
  9. package/dist/core/agent-session-services.js +22 -0
  10. package/dist/core/agent-session-services.js.map +1 -1
  11. package/dist/core/agent-session.d.ts +4 -1
  12. package/dist/core/agent-session.d.ts.map +1 -1
  13. package/dist/core/agent-session.js +22 -2
  14. package/dist/core/agent-session.js.map +1 -1
  15. package/dist/core/package-manager.d.ts +3 -0
  16. package/dist/core/package-manager.d.ts.map +1 -1
  17. package/dist/core/package-manager.js +58 -0
  18. package/dist/core/package-manager.js.map +1 -1
  19. package/dist/core/prompt-templates.d.ts.map +1 -1
  20. package/dist/core/prompt-templates.js +3 -1
  21. package/dist/core/prompt-templates.js.map +1 -1
  22. package/dist/core/resource-loader.d.ts.map +1 -1
  23. package/dist/core/resource-loader.js +35 -10
  24. package/dist/core/resource-loader.js.map +1 -1
  25. package/dist/core/resource-profile-blocks.d.ts +16 -0
  26. package/dist/core/resource-profile-blocks.d.ts.map +1 -0
  27. package/dist/core/resource-profile-blocks.js +120 -0
  28. package/dist/core/resource-profile-blocks.js.map +1 -0
  29. package/dist/core/sdk.d.ts +9 -0
  30. package/dist/core/sdk.d.ts.map +1 -1
  31. package/dist/core/sdk.js +17 -0
  32. package/dist/core/sdk.js.map +1 -1
  33. package/dist/core/settings-manager.d.ts +45 -1
  34. package/dist/core/settings-manager.d.ts.map +1 -1
  35. package/dist/core/settings-manager.js +218 -10
  36. package/dist/core/settings-manager.js.map +1 -1
  37. package/dist/core/skills.d.ts.map +1 -1
  38. package/dist/core/skills.js +3 -0
  39. package/dist/core/skills.js.map +1 -1
  40. package/dist/index.d.ts +2 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +2 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/main.d.ts.map +1 -1
  45. package/dist/main.js +17 -0
  46. package/dist/main.js.map +1 -1
  47. package/docs/extensions.md +18 -1
  48. package/docs/prompt-templates.md +1 -0
  49. package/docs/settings.md +43 -1
  50. package/docs/skills.md +12 -0
  51. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  52. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  53. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  54. package/examples/extensions/sandbox/package-lock.json +2 -2
  55. package/examples/extensions/sandbox/package.json +1 -1
  56. package/examples/extensions/with-deps/package-lock.json +2 -2
  57. package/examples/extensions/with-deps/package.json +1 -1
  58. package/npm-shrinkwrap.json +12 -12
  59. package/package.json +4 -4
@@ -29,7 +29,9 @@ import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
29
29
  import { emitSessionShutdownEvent } from "./extensions/runner.js";
30
30
  import { compactToolResultDetailsForRetention } from "./message-retention.js";
31
31
  import { expandPromptTemplate } from "./prompt-templates.js";
32
+ import { stripResourceProfileBlocks } from "./resource-profile-blocks.js";
32
33
  import { CURRENT_SESSION_VERSION, getLatestCompactionEntry } from "./session-manager.js";
34
+ import { matchesResourceProfilePattern, } from "./settings-manager.js";
33
35
  import { createSyntheticSourceInfo } from "./source-info.js";
34
36
  import { buildSystemPrompt } from "./system-prompt.js";
35
37
  import { createLocalBashOperations } from "./tools/bash.js";
@@ -99,6 +101,7 @@ export class AgentSession {
99
101
  _initialActiveToolNames;
100
102
  _allowedToolNames;
101
103
  _excludedToolNames;
104
+ _toolProfileFilter;
102
105
  _baseToolsOverride;
103
106
  _sessionStartEvent;
104
107
  _extensionUIContext;
@@ -131,6 +134,9 @@ export class AgentSession {
131
134
  this._initialActiveToolNames = config.initialActiveToolNames;
132
135
  this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;
133
136
  this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;
137
+ this._toolProfileFilter = config.toolProfileFilter
138
+ ? { allow: config.toolProfileFilter.allow ?? [], block: config.toolProfileFilter.block ?? [] }
139
+ : undefined;
134
140
  this._baseToolsOverride = config.baseToolsOverride;
135
141
  this._sessionStartEvent = config.sessionStartEvent ?? { type: "session_start", reason: "startup" };
136
142
  // Always subscribe to agent events for internal handling
@@ -1030,7 +1036,7 @@ export class AgentSession {
1030
1036
  return text; // Unknown skill, pass through
1031
1037
  try {
1032
1038
  const content = readFileSync(skill.filePath, "utf-8");
1033
- const body = stripFrontmatter(content).trim();
1039
+ const body = stripResourceProfileBlocks(stripFrontmatter(content)).trim();
1034
1040
  const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
1035
1041
  return args ? `${skillBlock}\n\n${args}` : skillBlock;
1036
1042
  }
@@ -2021,7 +2027,21 @@ export class AgentSession {
2021
2027
  const previousActiveToolNames = this.getActiveToolNames();
2022
2028
  const allowedToolNames = this._allowedToolNames;
2023
2029
  const excludedToolNames = this._excludedToolNames;
2024
- const isAllowedTool = (name) => (!allowedToolNames || allowedToolNames.has(name)) && !excludedToolNames?.has(name);
2030
+ const toolProfileFilter = this._toolProfileFilter;
2031
+ const isAllowedTool = (name) => {
2032
+ if (allowedToolNames && !allowedToolNames.has(name))
2033
+ return false;
2034
+ if (excludedToolNames?.has(name))
2035
+ return false;
2036
+ if (!toolProfileFilter)
2037
+ return true;
2038
+ if (toolProfileFilter.allow.length > 0 && !matchesResourceProfilePattern(name, toolProfileFilter.allow)) {
2039
+ return false;
2040
+ }
2041
+ if (matchesResourceProfilePattern(name, toolProfileFilter.block))
2042
+ return false;
2043
+ return true;
2044
+ };
2025
2045
  const registeredTools = this._extensionRunner.getAllRegisteredTools();
2026
2046
  const allCustomTools = [
2027
2047
  ...registeredTools,