@task-shepherd/agent 1.0.7 → 1.0.11

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 (80) hide show
  1. package/dist/cli/index.js +1054 -86
  2. package/dist/index.js +1 -1
  3. package/dist/meta.json +358 -67
  4. package/package.json +2 -2
  5. package/shared/dist/index.d.ts +0 -15
  6. package/shared/dist/index.js +0 -12
  7. package/shared/dist/mcp-client/client.d.ts +0 -18
  8. package/shared/dist/mcp-client/client.js +0 -49
  9. package/shared/dist/mcp-client/index.d.ts +0 -7
  10. package/shared/dist/mcp-client/index.js +0 -7
  11. package/shared/dist/mcp-client/types.d.ts +0 -822
  12. package/shared/dist/mcp-client/types.js +0 -193
  13. package/shared/dist/schema/index.d.ts +0 -189
  14. package/shared/dist/schema/index.js +0 -142
  15. package/shared/dist/schema/mcp-mappings.d.ts +0 -50
  16. package/shared/dist/schema/mcp-mappings.js +0 -563
  17. package/shared/dist/schema/validation.d.ts +0 -91
  18. package/shared/dist/schema/validation.js +0 -282
  19. package/shared/dist/work-queue/index.d.ts +0 -7
  20. package/shared/dist/work-queue/index.js +0 -7
  21. package/shared/dist/work-queue/types.d.ts +0 -147
  22. package/shared/dist/work-queue/types.js +0 -4
  23. package/shared/dist/work-queue/validation.d.ts +0 -24
  24. package/shared/dist/work-queue/validation.js +0 -160
  25. package/shared/dist/workspace/constants.d.ts +0 -148
  26. package/shared/dist/workspace/constants.js +0 -432
  27. package/shared/dist/workspace/index.d.ts +0 -10
  28. package/shared/dist/workspace/index.js +0 -10
  29. package/shared/dist/workspace/types.d.ts +0 -477
  30. package/shared/dist/workspace/types.js +0 -9
  31. package/shared/dist/workspace/utils.d.ts +0 -79
  32. package/shared/dist/workspace/utils.js +0 -334
  33. package/shared/dist/workspace/validation.d.ts +0 -1312
  34. package/shared/dist/workspace/validation.js +0 -467
  35. package/shared/graphql/generated-internal.ts +0 -3629
  36. package/shared/graphql/generated-public.ts +0 -773
  37. package/shared/graphql/generated.d.ts +0 -7456
  38. package/shared/graphql/generated.js +0 -11799
  39. package/shared/graphql/generated.ts +0 -27569
  40. package/shared/graphql/generated.ts.backup +0 -16531
  41. package/shared/graphql/generated.ts.working +0 -4828
  42. package/shared/graphql/introspection-internal.json +0 -15845
  43. package/shared/graphql/introspection-public.json +0 -9658
  44. package/shared/graphql/introspection.json +0 -44263
  45. package/shared/graphql/operations/ai-service.graphql +0 -131
  46. package/shared/graphql/operations/ai-work-queue.graphql +0 -31
  47. package/shared/graphql/operations/analytics.graphql +0 -283
  48. package/shared/graphql/operations/analytics.ts +0 -3
  49. package/shared/graphql/operations/api-keys.graphql +0 -126
  50. package/shared/graphql/operations/attachments.graphql +0 -53
  51. package/shared/graphql/operations/attachments.ts +0 -39
  52. package/shared/graphql/operations/audit.graphql +0 -46
  53. package/shared/graphql/operations/auth.graphql +0 -83
  54. package/shared/graphql/operations/claude-usage.graphql +0 -178
  55. package/shared/graphql/operations/comments.graphql +0 -4
  56. package/shared/graphql/operations/dashboard.graphql +0 -29
  57. package/shared/graphql/operations/development-plans.graphql +0 -408
  58. package/shared/graphql/operations/early-access.graphql.disabled +0 -21
  59. package/shared/graphql/operations/errors.graphql.disabled +0 -83
  60. package/shared/graphql/operations/internal-api.graphql +0 -931
  61. package/shared/graphql/operations/notifications.graphql +0 -4
  62. package/shared/graphql/operations/organization-invites.graphql.disabled +0 -32
  63. package/shared/graphql/operations/performance.graphql +0 -4
  64. package/shared/graphql/operations/project-reviews.graphql +0 -610
  65. package/shared/graphql/operations/projects.graphql +0 -98
  66. package/shared/graphql/operations/settings.graphql +0 -4
  67. package/shared/graphql/operations/stories.graphql +0 -113
  68. package/shared/graphql/operations/subscriptions.graphql +0 -235
  69. package/shared/graphql/operations/subscriptions.graphql.disabled +0 -96
  70. package/shared/graphql/operations/tasks.graphql +0 -257
  71. package/shared/graphql/operations/team.graphql +0 -111
  72. package/shared/graphql/operations/team.ts +0 -226
  73. package/shared/graphql/operations/time-tracking.graphql.disabled +0 -96
  74. package/shared/graphql/operations/work-queue.graphql +0 -210
  75. package/shared/graphql/operations/work-queue.graphql.disabled +0 -474
  76. package/shared/graphql/operations/workspace.graphql +0 -146
  77. package/shared/graphql/schema-internal.graphql +0 -1085
  78. package/shared/graphql/schema-public.graphql +0 -709
  79. package/shared/graphql/schema.graphql +0 -3473
  80. package/shared/package.json +0 -23
@@ -1,334 +0,0 @@
1
- /**
2
- * Workspace Configuration Utilities
3
- *
4
- * Helper functions for working with workspace configurations.
5
- */
6
- import { WORKSPACE_TEMPLATES, COMMON_SERVICE_PORTS } from './constants.js';
7
- /**
8
- * Create a workspace configuration from a template
9
- */
10
- export function createWorkspaceFromTemplate(templateId, options) {
11
- const template = WORKSPACE_TEMPLATES[templateId];
12
- if (!template) {
13
- throw new Error(`Template '${templateId}' not found`);
14
- }
15
- const config = {
16
- ...template.config,
17
- workspace: {
18
- ...template.config.workspace,
19
- id: generateWorkspaceId(),
20
- name: options.name,
21
- description: options.description,
22
- pattern: options.pattern || template.config.workspace?.pattern || 'monorepo',
23
- version: template.config.workspace?.version || '1.0.0',
24
- createdAt: new Date().toISOString(),
25
- updatedAt: new Date().toISOString()
26
- }
27
- };
28
- // Merge custom configuration
29
- if (options.customConfig) {
30
- return mergeWorkspaceConfigs(config, options.customConfig);
31
- }
32
- return config;
33
- }
34
- /**
35
- * Merge workspace configurations
36
- */
37
- export function mergeWorkspaceConfigs(base, override) {
38
- return {
39
- ...base,
40
- ...override,
41
- workspace: {
42
- ...base.workspace,
43
- ...override.workspace
44
- },
45
- services: {
46
- ...base.services,
47
- ...override.services
48
- },
49
- ai: base.ai && override.ai ? {
50
- ...base.ai,
51
- ...override.ai,
52
- models: {
53
- ...base.ai?.models,
54
- ...override.ai?.models
55
- },
56
- capabilities: {
57
- ...base.ai?.capabilities,
58
- ...override.ai?.capabilities
59
- }
60
- } : (override.ai || base.ai),
61
- paths: {
62
- ...base.paths,
63
- ...override.paths
64
- },
65
- development: {
66
- ...base.development,
67
- ...override.development
68
- },
69
- security: base.security && override.security ? {
70
- ...base.security,
71
- ...override.security,
72
- filePermissions: {
73
- ...base.security?.filePermissions,
74
- ...override.security?.filePermissions
75
- },
76
- networkPermissions: {
77
- ...base.security?.networkPermissions,
78
- ...override.security?.networkPermissions
79
- }
80
- } : (override.security || base.security),
81
- integrations: {
82
- ...base.integrations,
83
- ...override.integrations
84
- }
85
- };
86
- }
87
- /**
88
- * Generate a unique workspace ID
89
- */
90
- export function generateWorkspaceId() {
91
- return `ws_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
92
- }
93
- /**
94
- * Find available port for a service
95
- */
96
- export function findAvailablePort(services, preferredPort, serviceType = 'backend') {
97
- const usedPorts = new Set(Object.values(services).map(service => service.port));
98
- // Try preferred port first
99
- if (preferredPort && !usedPorts.has(preferredPort)) {
100
- return preferredPort;
101
- }
102
- // Try common ports for the service type
103
- const commonPorts = COMMON_SERVICE_PORTS.development[serviceType] || [];
104
- for (const port of commonPorts) {
105
- if (!usedPorts.has(port)) {
106
- return port;
107
- }
108
- }
109
- // Fall back to finding any available port in common ranges
110
- const portRanges = [
111
- { start: 3000, end: 3100 },
112
- { start: 4000, end: 4100 },
113
- { start: 5000, end: 5100 },
114
- { start: 8000, end: 8100 }
115
- ];
116
- for (const range of portRanges) {
117
- for (let port = range.start; port <= range.end; port++) {
118
- if (!usedPorts.has(port)) {
119
- return port;
120
- }
121
- }
122
- }
123
- throw new Error('No available ports found');
124
- }
125
- /**
126
- * Resolve service dependencies in topological order
127
- */
128
- export function resolveServiceDependencies(services) {
129
- const resolved = [];
130
- const visited = new Set();
131
- const visiting = new Set();
132
- const visit = (serviceId) => {
133
- if (visiting.has(serviceId)) {
134
- throw new Error(`Circular dependency detected involving service: ${serviceId}`);
135
- }
136
- if (visited.has(serviceId)) {
137
- return;
138
- }
139
- visiting.add(serviceId);
140
- const service = services[serviceId];
141
- if (service?.dependencies) {
142
- for (const dep of service.dependencies) {
143
- if (dep.type === 'required' && services[dep.service]) {
144
- visit(dep.service);
145
- }
146
- }
147
- }
148
- visiting.delete(serviceId);
149
- visited.add(serviceId);
150
- resolved.push(serviceId);
151
- };
152
- for (const serviceId of Object.keys(services)) {
153
- if (!visited.has(serviceId)) {
154
- visit(serviceId);
155
- }
156
- }
157
- return resolved;
158
- }
159
- /**
160
- * Get service startup order based on dependencies
161
- */
162
- export function getServiceStartupOrder(services) {
163
- const levels = new Map();
164
- const visited = new Set();
165
- const calculateLevel = (serviceId) => {
166
- if (levels.has(serviceId)) {
167
- return levels.get(serviceId);
168
- }
169
- if (visited.has(serviceId)) {
170
- throw new Error(`Circular dependency detected involving service: ${serviceId}`);
171
- }
172
- visited.add(serviceId);
173
- const service = services[serviceId];
174
- let maxDepLevel = 0;
175
- if (service?.dependencies) {
176
- for (const dep of service.dependencies) {
177
- if (dep.type === 'required' && services[dep.service]) {
178
- const depLevel = calculateLevel(dep.service);
179
- maxDepLevel = Math.max(maxDepLevel, depLevel + 1);
180
- }
181
- }
182
- }
183
- levels.set(serviceId, maxDepLevel);
184
- visited.delete(serviceId);
185
- return maxDepLevel;
186
- };
187
- for (const serviceId of Object.keys(services)) {
188
- calculateLevel(serviceId);
189
- }
190
- return Array.from(levels.entries())
191
- .map(([service, level]) => ({ service, level }))
192
- .sort((a, b) => a.level - b.level);
193
- }
194
- /**
195
- * Validate service dependencies
196
- */
197
- export function validateServiceDependencies(services) {
198
- const issues = [];
199
- for (const [serviceId, service] of Object.entries(services)) {
200
- if (service.dependencies) {
201
- for (const dep of service.dependencies) {
202
- // Check if dependency exists
203
- if (!services[dep.service]) {
204
- issues.push({
205
- service: serviceId,
206
- dependency: dep.service,
207
- issue: 'Dependency service not found'
208
- });
209
- continue;
210
- }
211
- // Check for self-dependency
212
- if (dep.service === serviceId) {
213
- issues.push({
214
- service: serviceId,
215
- dependency: dep.service,
216
- issue: 'Service cannot depend on itself'
217
- });
218
- }
219
- // Version compatibility check (if versions are specified)
220
- if (dep.version && services[dep.service].version) {
221
- if (!isVersionCompatible(services[dep.service].version, dep.version)) {
222
- issues.push({
223
- service: serviceId,
224
- dependency: dep.service,
225
- issue: `Version incompatibility: requires ${dep.version}, found ${services[dep.service].version}`
226
- });
227
- }
228
- }
229
- }
230
- }
231
- }
232
- return issues;
233
- }
234
- /**
235
- * Check if two versions are compatible (simplified semver check)
236
- */
237
- export function isVersionCompatible(available, required) {
238
- // Simple version comparison - in practice, use a proper semver library
239
- const parseVersion = (v) => v.split('.').map(Number);
240
- try {
241
- const availableVer = parseVersion(available);
242
- const requiredVer = parseVersion(required);
243
- // Major version must match
244
- if (availableVer[0] !== requiredVer[0]) {
245
- return false;
246
- }
247
- // Minor version must be >= required
248
- if (availableVer[1] < requiredVer[1]) {
249
- return false;
250
- }
251
- // Patch version must be >= required if minor versions match
252
- if (availableVer[1] === requiredVer[1] && availableVer[2] < requiredVer[2]) {
253
- return false;
254
- }
255
- return true;
256
- }
257
- catch {
258
- // If version parsing fails, assume compatible
259
- return true;
260
- }
261
- }
262
- /**
263
- * Generate service health check URLs
264
- */
265
- export function generateHealthCheckUrls(services) {
266
- const healthChecks = {};
267
- for (const [serviceId, service] of Object.entries(services)) {
268
- if (service.healthCheck) {
269
- healthChecks[serviceId] = service.healthCheck;
270
- }
271
- else {
272
- // Generate default health check URL
273
- const baseUrl = service.url.replace(/\/$/, '');
274
- healthChecks[serviceId] = `${baseUrl}/health`;
275
- }
276
- }
277
- return healthChecks;
278
- }
279
- /**
280
- * Filter services by technology
281
- */
282
- export function filterServicesByTechnology(services, technology) {
283
- return Object.fromEntries(Object.entries(services).filter(([_, service]) => service.technology === technology));
284
- }
285
- /**
286
- * Filter services by environment
287
- */
288
- export function filterServicesByEnvironment(services, environment) {
289
- return Object.fromEntries(Object.entries(services).filter(([_, service]) => service.environment === environment));
290
- }
291
- /**
292
- * Get workspace summary
293
- */
294
- export function getWorkspaceSummary(config) {
295
- const services = Object.values(config.services);
296
- const servicesByTechnology = services.reduce((acc, service) => {
297
- acc[service.technology] = (acc[service.technology] || 0) + 1;
298
- return acc;
299
- }, {});
300
- const servicesByEnvironment = services.reduce((acc, service) => {
301
- acc[service.environment] = (acc[service.environment] || 0) + 1;
302
- return acc;
303
- }, {});
304
- const totalDependencies = services.reduce((acc, service) => acc + (service.dependencies?.length || 0), 0);
305
- return {
306
- totalServices: services.length,
307
- servicesByTechnology,
308
- servicesByEnvironment,
309
- dependencies: totalDependencies,
310
- aiModels: Object.keys(config.ai.models).length,
311
- pattern: config.workspace.pattern
312
- };
313
- }
314
- /**
315
- * Convert workspace config to environment variables
316
- */
317
- export function workspaceConfigToEnvVars(config, prefix = 'TASK_SHEPHERD_') {
318
- const envVars = {};
319
- // Workspace metadata
320
- envVars[`${prefix}WORKSPACE_ID`] = config.workspace.id;
321
- envVars[`${prefix}WORKSPACE_NAME`] = config.workspace.name;
322
- envVars[`${prefix}WORKSPACE_PATTERN`] = config.workspace.pattern;
323
- // Service URLs and ports
324
- for (const [serviceId, service] of Object.entries(config.services)) {
325
- const servicePrefix = `${prefix}SERVICE_${serviceId.toUpperCase()}_`;
326
- envVars[`${servicePrefix}URL`] = service.url;
327
- envVars[`${servicePrefix}PORT`] = service.port.toString();
328
- envVars[`${servicePrefix}PROTOCOL`] = service.protocol;
329
- }
330
- // AI configuration
331
- envVars[`${prefix}AI_DEFAULT_MODEL`] = config.ai.defaultModel;
332
- envVars[`${prefix}AI_MAX_CONCURRENT`] = config.ai.capabilities.maxConcurrentOperations.toString();
333
- return envVars;
334
- }