@caupulican/pi-adaptative 0.80.90 → 0.80.91

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 (31) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +1 -0
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/context/context-composition.d.ts +2 -0
  6. package/dist/core/context/context-composition.d.ts.map +1 -1
  7. package/dist/core/context/context-composition.js +1 -1
  8. package/dist/core/context/context-composition.js.map +1 -1
  9. package/dist/core/profile-resource-selection.d.ts.map +1 -1
  10. package/dist/core/profile-resource-selection.js +19 -6
  11. package/dist/core/profile-resource-selection.js.map +1 -1
  12. package/dist/core/resource-loader.d.ts +22 -0
  13. package/dist/core/resource-loader.d.ts.map +1 -1
  14. package/dist/core/resource-loader.js +54 -0
  15. package/dist/core/resource-loader.js.map +1 -1
  16. package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
  17. package/dist/modes/interactive/components/profile-resource-editor.js +11 -4
  18. package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
  19. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  20. package/dist/modes/interactive/interactive-mode.js +65 -14
  21. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  22. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  23. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  24. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  25. package/examples/extensions/sandbox/package-lock.json +2 -2
  26. package/examples/extensions/sandbox/package.json +1 -1
  27. package/examples/extensions/with-deps/package-lock.json +2 -2
  28. package/examples/extensions/with-deps/package.json +1 -1
  29. package/examples/sdk/12-full-control.ts +4 -0
  30. package/npm-shrinkwrap.json +12 -12
  31. package/package.json +4 -4
@@ -5844,10 +5844,67 @@ export class InteractiveMode {
5844
5844
  const loader = this.session.resourceLoader;
5845
5845
  const base = (p) => p.split(/[\\/]/).pop() ?? p;
5846
5846
  const allDiscoverableExtensions = await loader.getDiscoverableExtensionPaths();
5847
- const skills = loader.getSkills().skills;
5848
- const prompts = loader.getPrompts().prompts;
5847
+ // The editor's universe must be profile-INDEPENDENT (discovery, not loading): the loaded
5848
+ // getters are narrowed by the active profile, so building the lists from them makes
5849
+ // currently-blocked skills/prompts/context files ungrantable — including expanding the
5850
+ // very profile you are running under. Union the loaded (rich metadata) sets with the
5851
+ // full pre-filter discovery paths.
5852
+ const loadedSkills = loader.getSkills().skills;
5853
+ const loadedSkillPaths = new Set(loadedSkills.map((skill) => skill.filePath));
5854
+ const skillIdFromPath = (skillPath) => {
5855
+ const parts = skillPath.split(/[\\/]/);
5856
+ const last = parts.pop() ?? skillPath;
5857
+ if (/^skill\.md$/i.test(last))
5858
+ return parts.pop() ?? last;
5859
+ return last.replace(/\.md$/i, "");
5860
+ };
5861
+ const skills = [
5862
+ ...loadedSkills.map((skill) => ({ id: skill.name, path: skill.filePath, description: skill.description })),
5863
+ ...loader
5864
+ .getDiscoverableSkillPaths()
5865
+ .filter((skillPath) => !loadedSkillPaths.has(skillPath))
5866
+ .map((skillPath) => ({
5867
+ id: skillIdFromPath(skillPath),
5868
+ path: skillPath,
5869
+ description: getFrontmatterDescription(skillPath),
5870
+ })),
5871
+ ];
5872
+ const loadedPrompts = loader.getPrompts().prompts;
5873
+ const loadedPromptPaths = new Set(loadedPrompts.map((prompt) => prompt.filePath));
5874
+ const prompts = [
5875
+ ...loadedPrompts.map((prompt) => ({
5876
+ id: prompt.name,
5877
+ path: prompt.filePath,
5878
+ description: prompt.description,
5879
+ })),
5880
+ ...loader
5881
+ .getDiscoverablePromptPaths()
5882
+ .filter((promptPath) => !loadedPromptPaths.has(promptPath))
5883
+ .map((promptPath) => ({
5884
+ id: (promptPath.split(/[\\/]/).pop() ?? promptPath).replace(/\.md$/i, ""),
5885
+ path: promptPath,
5886
+ description: getFrontmatterDescription(promptPath),
5887
+ })),
5888
+ ];
5849
5889
  const themes = getAvailableThemesWithPaths();
5850
- const agents = loader.getAgentsFiles().agentsFiles;
5890
+ const loadedAgentPaths = new Set(loader.getAgentsFiles().agentsFiles.map((file) => file.path));
5891
+ const agents = [
5892
+ ...loader.getAgentsFiles().agentsFiles.map((file) => ({ path: file.path })),
5893
+ ...loader
5894
+ .getDiscoverableAgentsFilePaths()
5895
+ .filter((agentPath) => !loadedAgentPaths.has(agentPath))
5896
+ .map((agentPath) => ({ path: agentPath })),
5897
+ ];
5898
+ const getFrontmatterDescription = (filePath) => {
5899
+ try {
5900
+ const content = fs.readFileSync(filePath, "utf-8");
5901
+ const { frontmatter } = parseFrontmatter(content);
5902
+ if (typeof frontmatter.description === "string")
5903
+ return frontmatter.description;
5904
+ }
5905
+ catch { }
5906
+ return undefined;
5907
+ };
5851
5908
  const getAgentDescription = (filePath) => {
5852
5909
  try {
5853
5910
  const content = fs.readFileSync(filePath, "utf-8");
@@ -5880,16 +5937,14 @@ export class InteractiveMode {
5880
5937
  {
5881
5938
  kind: "tools",
5882
5939
  label: "Tools",
5883
- items: Array.from(allToolNames).map((name) => ({ id: name })),
5940
+ // Built-ins plus every currently registered tool (extension tools included), so
5941
+ // an extension tool can be granted by name without hand-editing settings JSON.
5942
+ items: [...new Set([...allToolNames, ...this.session.getAllTools().map((tool) => tool.name)])].map((name) => ({ id: name })),
5884
5943
  },
5885
5944
  {
5886
5945
  kind: "skills",
5887
5946
  label: "Skills",
5888
- items: skills.map((s) => ({
5889
- id: s.name,
5890
- path: s.filePath,
5891
- description: s.description,
5892
- })),
5947
+ items: skills,
5893
5948
  },
5894
5949
  {
5895
5950
  kind: "extensions",
@@ -5912,11 +5967,7 @@ export class InteractiveMode {
5912
5967
  {
5913
5968
  kind: "prompts",
5914
5969
  label: "Prompts",
5915
- items: prompts.map((p) => ({
5916
- id: p.name,
5917
- path: p.filePath,
5918
- description: p.description,
5919
- })),
5970
+ items: prompts,
5920
5971
  },
5921
5972
  {
5922
5973
  kind: "themes",