@matamt-dbg/dsh-studio 0.2.1 → 0.2.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.
Files changed (3) hide show
  1. package/index.js +6 -4
  2. package/package.json +1 -1
  3. package/policy.js +6 -4
package/index.js CHANGED
@@ -651,10 +651,12 @@ function patchParameter(parameters, path, description) {
651
651
  function installPolicy(ctx, scopeKey, config) {
652
652
  validatePolicy(config);
653
653
  if (scopeOf(ctx) !== scopeKey) throw new Error("Studio policy requires its owning scoped context");
654
- const selected = new Set(config.tools);
655
- const definitions = config.tools.map((name) => {
654
+ const missing = config.tools.filter((name) => ctx.tools.get(name, scopeKey) === void 0);
655
+ if (missing.length) console.warn(`Studio policy: ${missing.length} selected tool(s) unavailable on this host, skipped: ${missing.join(", ")}`);
656
+ const available = config.tools.filter((name) => !missing.includes(name));
657
+ const selected = new Set(available);
658
+ const definitions = available.map((name) => {
656
659
  const definition = ctx.tools.get(name, scopeKey);
657
- if (!definition) throw new Error(`Unavailable selected tool: ${name}`);
658
660
  const override = config.toolOverrides[name];
659
661
  const defaults = config.execution?.defaults[name];
660
662
  const batch = config.execution?.batch?.tool === name ? config.execution.batch : void 0;
@@ -687,7 +689,7 @@ function installPolicy(ctx, scopeKey, config) {
687
689
  for (const release of disposers.splice(0).reverse()) release();
688
690
  };
689
691
  try {
690
- disposers.push(ctx.tools.restrict({ allow: config.tools }));
692
+ disposers.push(ctx.tools.restrict({ allow: available }));
691
693
  const excess = ctx.tools.schemas(scopeKey).filter((tool) => !selected.has(tool.name));
692
694
  if (excess.length) throw new Error(`Unselected scoped tools must be removed from preset plugins: ${excess.map((tool) => tool.name).join(", ")}`);
693
695
  disposers.push(ctx.tools.guard((execution) => selected.has(execution.name) ? void 0 : "Tool excluded by Studio preset policy"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matamt-dbg/dsh-studio",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "DSH Studio: build, edit and apply DeepSeek Harness agent presets — tools, prompts, Configs and role-based subagents — from the web GUI.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
package/policy.js CHANGED
@@ -82,10 +82,12 @@ function patchParameter(parameters, path, description) {
82
82
  function installPolicy(ctx, scopeKey, config) {
83
83
  validatePolicy(config);
84
84
  if (scopeOf(ctx) !== scopeKey) throw new Error("Studio policy requires its owning scoped context");
85
- const selected = new Set(config.tools);
86
- const definitions = config.tools.map((name2) => {
85
+ const missing = config.tools.filter((name2) => ctx.tools.get(name2, scopeKey) === void 0);
86
+ if (missing.length) console.warn(`Studio policy: ${missing.length} selected tool(s) unavailable on this host, skipped: ${missing.join(", ")}`);
87
+ const available = config.tools.filter((name2) => !missing.includes(name2));
88
+ const selected = new Set(available);
89
+ const definitions = available.map((name2) => {
87
90
  const definition = ctx.tools.get(name2, scopeKey);
88
- if (!definition) throw new Error(`Unavailable selected tool: ${name2}`);
89
91
  const override = config.toolOverrides[name2];
90
92
  const defaults = config.execution?.defaults[name2];
91
93
  const batch = config.execution?.batch?.tool === name2 ? config.execution.batch : void 0;
@@ -118,7 +120,7 @@ function installPolicy(ctx, scopeKey, config) {
118
120
  for (const release of disposers.splice(0).reverse()) release();
119
121
  };
120
122
  try {
121
- disposers.push(ctx.tools.restrict({ allow: config.tools }));
123
+ disposers.push(ctx.tools.restrict({ allow: available }));
122
124
  const excess = ctx.tools.schemas(scopeKey).filter((tool) => !selected.has(tool.name));
123
125
  if (excess.length) throw new Error(`Unselected scoped tools must be removed from preset plugins: ${excess.map((tool) => tool.name).join(", ")}`);
124
126
  disposers.push(ctx.tools.guard((execution) => selected.has(execution.name) ? void 0 : "Tool excluded by Studio preset policy"));