@topolo/cli 0.9.3 → 0.9.4

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 (2) hide show
  1. package/dist/index.js +36 -1
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1546,7 +1546,9 @@ var TopoloClient = class _TopoloClient {
1546
1546
  };
1547
1547
  }
1548
1548
  planResolvedAction(entry, input2, options) {
1549
- const validation = validateTopoloActionInput(entry.inputSchema, input2);
1549
+ const inputValidation = validateTopoloActionInput(entry.inputSchema, input2);
1550
+ const resourceIssue = validateActionResource(entry, options.resource);
1551
+ const validation = resourceIssue ? { valid: false, errors: [...inputValidation.errors, resourceIssue] } : inputValidation;
1550
1552
  const agentAccess = entry.agentAccess ?? (entry.destructive ? "off" : entry.readOnly && !entry.requiresConfirmation ? "auto" : "confirm");
1551
1553
  const confirmationRequired = agentAccess === "confirm" || entry.requiresConfirmation || entry.destructive;
1552
1554
  let request = null;
@@ -1605,6 +1607,13 @@ var TopoloClient = class _TopoloClient {
1605
1607
  `Topolo action "${entry.actionId}" input is invalid: ${validation.errors.map((issue) => `${issue.path} ${issue.message}`).join("; ")}`
1606
1608
  );
1607
1609
  }
1610
+ const resourceIssue = validateActionResource(entry, options.resource);
1611
+ if (resourceIssue) {
1612
+ throw new TopoloSdkError(
1613
+ "invalid_action_resource",
1614
+ `Topolo action "${entry.actionId}" resource context is invalid: ${resourceIssue.message}`
1615
+ );
1616
+ }
1608
1617
  const mapped = mapActionInput(entry, input2);
1609
1618
  const service = entry.appSlug || entry.appId;
1610
1619
  const result = await this.request({
@@ -1667,6 +1676,32 @@ var TopoloClient = class _TopoloClient {
1667
1676
  };
1668
1677
  }
1669
1678
  };
1679
+ function validateActionResource(entry, resource) {
1680
+ const permissionName = entry.permissionName || entry.requiredPermission.split(".").at(-1) || "";
1681
+ if (!permissionName.startsWith("workspace:")) return null;
1682
+ if (!resource) {
1683
+ return {
1684
+ path: "$.resource",
1685
+ code: "required",
1686
+ message: "Select a workspace with the application resource catalog before planning or calling this action."
1687
+ };
1688
+ }
1689
+ if (resource.resourceType !== "workspace") {
1690
+ return {
1691
+ path: "$.resource.resourceType",
1692
+ code: "const",
1693
+ message: 'This action requires resourceType "workspace".'
1694
+ };
1695
+ }
1696
+ if (!resource.resourceId.trim()) {
1697
+ return {
1698
+ path: "$.resource.resourceId",
1699
+ code: "required",
1700
+ message: "This action requires a workspace resourceId."
1701
+ };
1702
+ }
1703
+ return null;
1704
+ }
1670
1705
  function resolveConfiguredAppId(slug, appIds) {
1671
1706
  for (const serviceKey of serviceKeyCandidates2(slug)) {
1672
1707
  const configured = appIds?.[serviceKey];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
- "version": "0.9.3",
4
- "topoloPublishedVersion": "0.9.3",
3
+ "version": "0.9.4",
4
+ "topoloPublishedVersion": "0.9.4",
5
5
  "description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
6
6
  "license": "UNLICENSED",
7
7
  "author": "Topolo",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@modelcontextprotocol/sdk": "^1.0.0",
28
- "@topolo/mcp": "0.11.10",
29
- "@topolo/sdk": "0.11.10",
28
+ "@topolo/mcp": "0.11.11",
29
+ "@topolo/sdk": "0.11.11",
30
30
  "commander": "^12.1.0"
31
31
  },
32
32
  "devDependencies": {