@pi-unipi/subagents 0.1.6 → 0.1.7

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/package.json +1 -1
  2. package/src/index.ts +54 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/subagents",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Subagents for UniPi — parallel execution, file locking, workflow integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -99,13 +99,66 @@ export default function (pi: ExtensionAPI) {
99
99
  { id: "maxConcurrent", label: "Max Concurrent", show: true },
100
100
  { id: "activeCount", label: "Active Agents", show: true },
101
101
  { id: "enabled", label: "Enabled", show: true },
102
+ { id: "types", label: "Available Types", show: true },
102
103
  ],
103
104
  },
104
105
  dataProvider: async () => {
106
+ // Get available agent types
107
+ const types = config.types || {};
108
+ const builtinTypes = ["explore", "work"];
109
+
110
+ // Check for custom agent types in filesystem
111
+ const customTypes: string[] = [];
112
+ try {
113
+ const fs = require("fs");
114
+ const path = require("path");
115
+
116
+ // Check global agents directory
117
+ if (fs.existsSync(globalAgents)) {
118
+ const files = fs.readdirSync(globalAgents);
119
+ for (const file of files) {
120
+ if (file.endsWith(".md")) {
121
+ customTypes.push(file.replace(".md", ""));
122
+ }
123
+ }
124
+ }
125
+
126
+ // Check workspace agents directory
127
+ if (fs.existsSync(workspaceAgents)) {
128
+ const files = fs.readdirSync(workspaceAgents);
129
+ for (const file of files) {
130
+ if (file.endsWith(".md")) {
131
+ const name = file.replace(".md", "");
132
+ if (!customTypes.includes(name)) {
133
+ customTypes.push(name);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ } catch {
139
+ // Ignore errors
140
+ }
141
+
142
+ // Build available types list
143
+ const allTypes = [...new Set([...builtinTypes, ...Object.keys(types), ...customTypes])];
144
+ const typeList = allTypes.map(t => {
145
+ const isEnabled = types[t]?.enabled !== false;
146
+ const isBuiltin = builtinTypes.includes(t);
147
+ const scope = customTypes.includes(t) ? "project" : "global";
148
+ return `${t}(${scope})${isEnabled ? "" : " [disabled]"}`;
149
+ }).join(", ");
150
+
151
+ // Get active agents count
152
+ const activeAgents = manager.listAgents().filter(a => a.status === "running").length;
153
+
105
154
  return {
106
155
  maxConcurrent: { value: String(manager.getMaxConcurrent()) },
107
- activeCount: { value: "N/A" },
156
+ activeCount: { value: String(activeAgents) },
108
157
  enabled: { value: config.enabled ? "yes" : "no" },
158
+ types: {
159
+ value: allTypes.length > 0 ? allTypes[0] : "none",
160
+ detail: allTypes.length > 1 ? typeList : undefined,
161
+ },
109
162
  };
110
163
  },
111
164
  });