@shepai/cli 1.8.1 → 1.9.0

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 (127) hide show
  1. package/dist/src/application/ports/output/agent-executor-factory.interface.d.ts +45 -0
  2. package/dist/src/application/ports/output/agent-executor-factory.interface.d.ts.map +1 -0
  3. package/dist/src/application/ports/output/agent-executor-factory.interface.js +19 -0
  4. package/dist/src/application/ports/output/agent-executor.interface.d.ts +117 -0
  5. package/dist/src/application/ports/output/agent-executor.interface.d.ts.map +1 -0
  6. package/dist/src/application/ports/output/agent-executor.interface.js +23 -0
  7. package/dist/src/application/ports/output/agent-registry.interface.d.ts +91 -0
  8. package/dist/src/application/ports/output/agent-registry.interface.d.ts.map +1 -0
  9. package/dist/src/application/ports/output/agent-registry.interface.js +33 -0
  10. package/dist/src/application/ports/output/agent-run-repository.interface.d.ts +70 -0
  11. package/dist/src/application/ports/output/agent-run-repository.interface.d.ts.map +1 -0
  12. package/dist/src/application/ports/output/agent-run-repository.interface.js +11 -0
  13. package/dist/src/application/ports/output/agent-runner.interface.d.ts +82 -0
  14. package/dist/src/application/ports/output/agent-runner.interface.d.ts.map +1 -0
  15. package/dist/src/application/ports/output/agent-runner.interface.js +23 -0
  16. package/dist/src/application/ports/output/index.d.ts +5 -0
  17. package/dist/src/application/ports/output/index.d.ts.map +1 -1
  18. package/dist/src/application/use-cases/agents/run-agent.use-case.d.ts +52 -0
  19. package/dist/src/application/use-cases/agents/run-agent.use-case.d.ts.map +1 -0
  20. package/dist/src/application/use-cases/agents/run-agent.use-case.js +77 -0
  21. package/dist/src/domain/generated/output.d.ts +98 -0
  22. package/dist/src/domain/generated/output.d.ts.map +1 -1
  23. package/dist/src/domain/generated/output.js +17 -0
  24. package/dist/src/infrastructure/di/container.d.ts.map +1 -1
  25. package/dist/src/infrastructure/di/container.js +42 -1
  26. package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts +51 -0
  27. package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.d.ts.map +1 -0
  28. package/dist/src/infrastructure/persistence/sqlite/mappers/agent-run.mapper.js +64 -0
  29. package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts +2 -13
  30. package/dist/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
  31. package/dist/src/infrastructure/persistence/sqlite/migrations.js +63 -30
  32. package/dist/src/infrastructure/repositories/agent-run.repository.d.ts +25 -0
  33. package/dist/src/infrastructure/repositories/agent-run.repository.d.ts.map +1 -0
  34. package/dist/src/infrastructure/repositories/agent-run.repository.js +119 -0
  35. package/dist/src/infrastructure/services/agents/agent-executor-factory.service.d.ts +43 -0
  36. package/dist/src/infrastructure/services/agents/agent-executor-factory.service.d.ts.map +1 -0
  37. package/dist/src/infrastructure/services/agents/agent-executor-factory.service.js +58 -0
  38. package/dist/src/infrastructure/services/agents/agent-registry.service.d.ts +18 -0
  39. package/dist/src/infrastructure/services/agents/agent-registry.service.d.ts.map +1 -0
  40. package/dist/src/infrastructure/services/agents/agent-registry.service.js +30 -0
  41. package/dist/src/infrastructure/services/agents/agent-runner.service.d.ts +27 -0
  42. package/dist/src/infrastructure/services/agents/agent-runner.service.d.ts.map +1 -0
  43. package/dist/src/infrastructure/services/agents/agent-runner.service.js +117 -0
  44. package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.d.ts +37 -0
  45. package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.d.ts.map +1 -0
  46. package/dist/src/infrastructure/services/agents/executors/claude-code-executor.service.js +275 -0
  47. package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.d.ts +119 -0
  48. package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.d.ts.map +1 -0
  49. package/dist/src/infrastructure/services/agents/langgraph/analyze-repository-graph.js +56 -0
  50. package/dist/src/infrastructure/services/agents/langgraph/checkpointer.d.ts +9 -0
  51. package/dist/src/infrastructure/services/agents/langgraph/checkpointer.d.ts.map +1 -0
  52. package/dist/src/infrastructure/services/agents/langgraph/checkpointer.js +10 -0
  53. package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts +3 -0
  54. package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.d.ts.map +1 -0
  55. package/dist/src/infrastructure/services/agents/langgraph/prompts/analyze-repository.prompt.js +18 -0
  56. package/dist/src/infrastructure/services/agents/streaming/event-channel.d.ts +39 -0
  57. package/dist/src/infrastructure/services/agents/streaming/event-channel.d.ts.map +1 -0
  58. package/dist/src/infrastructure/services/agents/streaming/event-channel.js +64 -0
  59. package/dist/src/infrastructure/services/agents/streaming/index.d.ts +9 -0
  60. package/dist/src/infrastructure/services/agents/streaming/index.d.ts.map +1 -0
  61. package/dist/src/infrastructure/services/agents/streaming/index.js +8 -0
  62. package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.d.ts +25 -0
  63. package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.d.ts.map +1 -0
  64. package/dist/src/infrastructure/services/agents/streaming/streaming-executor-proxy.js +51 -0
  65. package/dist/src/infrastructure/services/web-server.service.d.ts.map +1 -1
  66. package/dist/src/infrastructure/services/web-server.service.js +2 -3
  67. package/dist/src/presentation/cli/commands/run.command.d.ts +19 -0
  68. package/dist/src/presentation/cli/commands/run.command.d.ts.map +1 -0
  69. package/dist/src/presentation/cli/commands/run.command.js +130 -0
  70. package/dist/src/presentation/cli/index.js +2 -0
  71. package/dist/src/presentation/cli/ui/messages.d.ts +1 -1
  72. package/dist/src/presentation/cli/ui/messages.d.ts.map +1 -1
  73. package/dist/src/presentation/cli/ui/messages.js +9 -3
  74. package/dist/src/presentation/cli/ui/symbols.d.ts +1 -1
  75. package/dist/tsconfig.build.tsbuildinfo +1 -1
  76. package/package.json +7 -3
  77. package/web/.next/BUILD_ID +1 -1
  78. package/web/.next/build-manifest.json +2 -2
  79. package/web/.next/cache/.previewinfo +1 -1
  80. package/web/.next/cache/.rscinfo +1 -1
  81. package/web/.next/cache/config.json +3 -3
  82. package/web/.next/fallback-build-manifest.json +2 -2
  83. package/web/.next/prerender-manifest.json +3 -3
  84. package/web/.next/required-server-files.js +1 -1
  85. package/web/.next/required-server-files.json +1 -1
  86. package/web/.next/server/app/_global-error.html +2 -2
  87. package/web/.next/server/app/_global-error.rsc +1 -1
  88. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  89. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  90. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  91. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  92. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  93. package/web/.next/server/app/_not-found.html +2 -2
  94. package/web/.next/server/app/_not-found.rsc +1 -1
  95. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  96. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  97. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  98. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  99. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  100. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  101. package/web/.next/server/app/index.html +2 -2
  102. package/web/.next/server/app/index.rsc +1 -1
  103. package/web/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  104. package/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
  105. package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  106. package/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  107. package/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  108. package/web/.next/server/app/version.html +2 -2
  109. package/web/.next/server/app/version.rsc +1 -1
  110. package/web/.next/server/app/version.segments/_full.segment.rsc +1 -1
  111. package/web/.next/server/app/version.segments/_head.segment.rsc +1 -1
  112. package/web/.next/server/app/version.segments/_index.segment.rsc +1 -1
  113. package/web/.next/server/app/version.segments/_tree.segment.rsc +1 -1
  114. package/web/.next/server/app/version.segments/version/__PAGE__.segment.rsc +1 -1
  115. package/web/.next/server/app/version.segments/version.segment.rsc +1 -1
  116. package/web/.next/server/chunks/ssr/_ccea5183._.js +1 -1
  117. package/web/.next/server/pages/404.html +2 -2
  118. package/web/.next/server/pages/500.html +2 -2
  119. package/web/.next/server/server-reference-manifest.js +1 -1
  120. package/web/.next/server/server-reference-manifest.json +1 -1
  121. package/web/.next/trace +1 -1
  122. package/web/.next/trace-build +1 -1
  123. package/web/next.config.mjs +1 -0
  124. package/web/next.config.ts +0 -47
  125. /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_buildManifest.js +0 -0
  126. /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_clientMiddlewareManifest.json +0 -0
  127. /package/web/.next/static/{hQhBYhX3g-lgV-ix_LYg2 → -QL3Wkz2EyCtR0S30gd0p}/_ssgManifest.js +0 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Agent Executor Factory Interface
3
+ *
4
+ * Output port for creating agent executor instances based on agent type.
5
+ * Infrastructure layer provides concrete implementations that wire up
6
+ * the appropriate executor for each supported agent.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const factory: IAgentExecutorFactory = container.resolve('IAgentExecutorFactory');
15
+ * const supported = factory.getSupportedAgents();
16
+ * const executor = factory.createExecutor(AgentType.ClaudeCode, settings.agent);
17
+ * ```
18
+ */
19
+ import type { AgentType, AgentConfig } from '../../../domain/generated/output.js';
20
+ import type { IAgentExecutor } from './agent-executor.interface.js';
21
+ /**
22
+ * Port interface for creating agent executor instances.
23
+ *
24
+ * Implementations must:
25
+ * - Create the correct executor for the given agent type
26
+ * - Configure the executor with the provided auth configuration
27
+ * - Report which agent types are supported
28
+ */
29
+ export interface IAgentExecutorFactory {
30
+ /**
31
+ * Create an executor for the specified agent type.
32
+ *
33
+ * @param agentType - The type of agent to create an executor for
34
+ * @param authConfig - Agent authentication and configuration
35
+ * @returns A configured agent executor
36
+ */
37
+ createExecutor(agentType: AgentType, authConfig: AgentConfig): IAgentExecutor;
38
+ /**
39
+ * Get the list of agent types this factory can create executors for.
40
+ *
41
+ * @returns Array of supported agent types
42
+ */
43
+ getSupportedAgents(): AgentType[];
44
+ }
45
+ //# sourceMappingURL=agent-executor-factory.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor-factory.interface.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/agent-executor-factory.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,GAAG,cAAc,CAAC;IAE9E;;;;OAIG;IACH,kBAAkB,IAAI,SAAS,EAAE,CAAC;CACnC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Agent Executor Factory Interface
3
+ *
4
+ * Output port for creating agent executor instances based on agent type.
5
+ * Infrastructure layer provides concrete implementations that wire up
6
+ * the appropriate executor for each supported agent.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const factory: IAgentExecutorFactory = container.resolve('IAgentExecutorFactory');
15
+ * const supported = factory.getSupportedAgents();
16
+ * const executor = factory.createExecutor(AgentType.ClaudeCode, settings.agent);
17
+ * ```
18
+ */
19
+ export {};
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Agent Executor Interface
3
+ *
4
+ * Output port for executing AI agent operations (prompts, streaming).
5
+ * Infrastructure layer provides concrete implementations for each agent type.
6
+ *
7
+ * Following Clean Architecture:
8
+ * - Domain and Application layers depend on this interface
9
+ * - Infrastructure layer provides concrete implementations
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Resolve an executor from the factory and run a prompt
14
+ * const executor = factory.createExecutor(AgentType.ClaudeCode, agentConfig);
15
+ * const result = await executor.execute('Analyze this codebase');
16
+ *
17
+ * // Stream results for real-time output
18
+ * for await (const event of executor.executeStream('Implement feature X')) {
19
+ * console.log(event.content);
20
+ * }
21
+ * ```
22
+ */
23
+ import type { AgentType, AgentFeature } from '../../../domain/generated/output.js';
24
+ /**
25
+ * Result returned after an agent execution completes.
26
+ */
27
+ export interface AgentExecutionResult {
28
+ /** The agent's output text */
29
+ result: string;
30
+ /** Session ID for resuming conversations */
31
+ sessionId?: string;
32
+ /** Token usage statistics */
33
+ usage?: {
34
+ inputTokens: number;
35
+ outputTokens: number;
36
+ };
37
+ /** Additional metadata from the agent */
38
+ metadata?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Event emitted during streamed agent execution.
42
+ */
43
+ export interface AgentExecutionStreamEvent {
44
+ /** Event type: progress updates, final result, or error */
45
+ type: 'progress' | 'result' | 'error';
46
+ /** Event content text */
47
+ content: string;
48
+ /** When the event was emitted */
49
+ timestamp: Date;
50
+ }
51
+ /**
52
+ * Options for controlling agent execution behavior.
53
+ */
54
+ export interface AgentExecutionOptions {
55
+ /** Working directory for the agent */
56
+ cwd?: string;
57
+ /** Tools the agent is allowed to use */
58
+ allowedTools?: string[];
59
+ /** Session ID to resume a previous conversation */
60
+ resumeSession?: string;
61
+ /** Maximum number of agent turns */
62
+ maxTurns?: number;
63
+ /** Model to use for execution */
64
+ model?: string;
65
+ /** System prompt to prepend */
66
+ systemPrompt?: string;
67
+ /** JSON schema for structured output */
68
+ outputSchema?: object;
69
+ /** Execution timeout in milliseconds */
70
+ timeout?: number;
71
+ }
72
+ /**
73
+ * Port interface for executing prompts against an AI agent.
74
+ *
75
+ * Implementations must:
76
+ * - Execute prompts and return structured results
77
+ * - Support streaming execution via async iterables
78
+ * - Report which agent features are supported
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const executor: IAgentExecutor = container.resolve('IAgentExecutor');
83
+ * if (executor.supportsFeature(AgentFeature.Streaming)) {
84
+ * for await (const event of executor.executeStream('Plan this feature')) {
85
+ * process.stdout.write(event.content);
86
+ * }
87
+ * }
88
+ * ```
89
+ */
90
+ export interface IAgentExecutor {
91
+ /** The type of agent this executor handles */
92
+ readonly agentType: AgentType;
93
+ /**
94
+ * Execute a prompt and return the complete result.
95
+ *
96
+ * @param prompt - The prompt to send to the agent
97
+ * @param options - Optional execution configuration
98
+ * @returns The agent's execution result
99
+ */
100
+ execute(prompt: string, options?: AgentExecutionOptions): Promise<AgentExecutionResult>;
101
+ /**
102
+ * Execute a prompt and stream events as they arrive.
103
+ *
104
+ * @param prompt - The prompt to send to the agent
105
+ * @param options - Optional execution configuration
106
+ * @returns An async iterable of stream events
107
+ */
108
+ executeStream(prompt: string, options?: AgentExecutionOptions): AsyncIterable<AgentExecutionStreamEvent>;
109
+ /**
110
+ * Check if this executor supports a specific agent feature.
111
+ *
112
+ * @param feature - The feature to check
113
+ * @returns true if the feature is supported
114
+ */
115
+ supportsFeature(feature: AgentFeature): boolean;
116
+ }
117
+ //# sourceMappingURL=agent-executor.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.interface.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/agent-executor.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,KAAK,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,2DAA2D;IAC3D,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;IACtC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAExF;;;;;;OAMG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,qBAAqB,GAC9B,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;CACjD"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Agent Executor Interface
3
+ *
4
+ * Output port for executing AI agent operations (prompts, streaming).
5
+ * Infrastructure layer provides concrete implementations for each agent type.
6
+ *
7
+ * Following Clean Architecture:
8
+ * - Domain and Application layers depend on this interface
9
+ * - Infrastructure layer provides concrete implementations
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Resolve an executor from the factory and run a prompt
14
+ * const executor = factory.createExecutor(AgentType.ClaudeCode, agentConfig);
15
+ * const result = await executor.execute('Analyze this codebase');
16
+ *
17
+ * // Stream results for real-time output
18
+ * for await (const event of executor.executeStream('Implement feature X')) {
19
+ * console.log(event.content);
20
+ * }
21
+ * ```
22
+ */
23
+ export {};
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Agent Registry Interface
3
+ *
4
+ * Output port for managing agent workflow definitions. The registry holds
5
+ * all registered agent definitions including their LangGraph graph factories,
6
+ * enabling runtime discovery and instantiation of agent workflows.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const registry: IAgentRegistry = container.resolve('IAgentRegistry');
15
+ *
16
+ * // Register an agent definition with its graph factory
17
+ * registry.register({
18
+ * name: 'analyze-repository',
19
+ * description: 'Analyze repository structure and technologies',
20
+ * graphFactory: () => createAnalyzeGraph(),
21
+ * });
22
+ *
23
+ * // Look up a registered agent
24
+ * const agent = registry.get('analyze-repository');
25
+ * if (agent) {
26
+ * const graph = agent.graphFactory();
27
+ * }
28
+ *
29
+ * // List all registered agents
30
+ * const agents = registry.list();
31
+ * ```
32
+ */
33
+ import type { AgentDefinition } from '../../../domain/generated/output.js';
34
+ /**
35
+ * Extended agent definition that includes a graph factory function.
36
+ *
37
+ * Extends the TypeSpec-generated AgentDefinition with a runtime-only
38
+ * `graphFactory` property that creates LangGraph StateGraph instances.
39
+ * This property is TypeScript-only and not represented in TypeSpec
40
+ * since it's a runtime concern.
41
+ */
42
+ export interface AgentDefinitionWithFactory extends AgentDefinition {
43
+ /** Factory function that creates the LangGraph StateGraph for this agent */
44
+ graphFactory: (...args: any[]) => any;
45
+ }
46
+ /**
47
+ * Port interface for managing agent workflow registrations.
48
+ *
49
+ * Implementations must:
50
+ * - Store agent definitions keyed by name
51
+ * - Prevent duplicate registrations (or overwrite silently)
52
+ * - Return undefined for unknown agent names
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const registry: IAgentRegistry = container.resolve('IAgentRegistry');
57
+ *
58
+ * // Register agents at application startup
59
+ * registry.register({
60
+ * name: 'gather-requirements',
61
+ * description: 'Gather and refine user requirements',
62
+ * graphFactory: createRequirementsGraph,
63
+ * });
64
+ *
65
+ * // Query available agents
66
+ * const all = registry.list();
67
+ * console.log(`${all.length} agents registered`);
68
+ * ```
69
+ */
70
+ export interface IAgentRegistry {
71
+ /**
72
+ * Register an agent definition with the registry.
73
+ *
74
+ * @param definition - The agent definition including its graph factory
75
+ */
76
+ register(definition: AgentDefinitionWithFactory): void;
77
+ /**
78
+ * Retrieve a registered agent definition by name.
79
+ *
80
+ * @param name - The unique agent name (e.g., 'analyze-repository')
81
+ * @returns The agent definition, or undefined if not registered
82
+ */
83
+ get(name: string): AgentDefinitionWithFactory | undefined;
84
+ /**
85
+ * List all registered agent definitions.
86
+ *
87
+ * @returns Array of all registered agent definitions
88
+ */
89
+ list(): AgentDefinitionWithFactory[];
90
+ }
91
+ //# sourceMappingURL=agent-registry.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-registry.interface.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/agent-registry.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,4EAA4E;IAE5E,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAEvD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,CAAC;IAE1D;;;;OAIG;IACH,IAAI,IAAI,0BAA0B,EAAE,CAAC;CACtC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Agent Registry Interface
3
+ *
4
+ * Output port for managing agent workflow definitions. The registry holds
5
+ * all registered agent definitions including their LangGraph graph factories,
6
+ * enabling runtime discovery and instantiation of agent workflows.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const registry: IAgentRegistry = container.resolve('IAgentRegistry');
15
+ *
16
+ * // Register an agent definition with its graph factory
17
+ * registry.register({
18
+ * name: 'analyze-repository',
19
+ * description: 'Analyze repository structure and technologies',
20
+ * graphFactory: () => createAnalyzeGraph(),
21
+ * });
22
+ *
23
+ * // Look up a registered agent
24
+ * const agent = registry.get('analyze-repository');
25
+ * if (agent) {
26
+ * const graph = agent.graphFactory();
27
+ * }
28
+ *
29
+ * // List all registered agents
30
+ * const agents = registry.list();
31
+ * ```
32
+ */
33
+ export {};
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Agent Run Repository Interface
3
+ *
4
+ * Output port for AgentRun persistence operations.
5
+ * Implementations handle database-specific logic (SQLite, etc.).
6
+ *
7
+ * Following Clean Architecture:
8
+ * - Domain and Application layers depend on this interface
9
+ * - Infrastructure layer provides concrete implementations
10
+ */
11
+ import type { AgentRun, AgentRunStatus } from '../../../domain/generated/output.js';
12
+ /**
13
+ * Repository interface for AgentRun entity persistence.
14
+ *
15
+ * Implementations must:
16
+ * - Handle database connection management
17
+ * - Provide thread-safe operations
18
+ * - Support query by thread ID and PID for crash recovery
19
+ */
20
+ export interface IAgentRunRepository {
21
+ /**
22
+ * Create a new agent run record.
23
+ *
24
+ * @param agentRun - The agent run to persist
25
+ */
26
+ create(agentRun: AgentRun): Promise<void>;
27
+ /**
28
+ * Find an agent run by its unique ID.
29
+ *
30
+ * @param id - The agent run ID
31
+ * @returns The agent run or null if not found
32
+ */
33
+ findById(id: string): Promise<AgentRun | null>;
34
+ /**
35
+ * Find an agent run by its LangGraph thread ID.
36
+ *
37
+ * @param threadId - The LangGraph thread ID
38
+ * @returns The agent run or null if not found
39
+ */
40
+ findByThreadId(threadId: string): Promise<AgentRun | null>;
41
+ /**
42
+ * Update agent run status with optional additional field updates.
43
+ *
44
+ * @param id - The agent run ID
45
+ * @param status - The new status
46
+ * @param updates - Optional additional fields to update
47
+ */
48
+ updateStatus(id: string, status: AgentRunStatus, updates?: Partial<AgentRun>): Promise<void>;
49
+ /**
50
+ * Find all running agent runs for a given process ID.
51
+ * Used for crash recovery to detect orphaned processes.
52
+ *
53
+ * @param pid - The process ID to search for
54
+ * @returns Array of running agent runs with the given PID
55
+ */
56
+ findRunningByPid(pid: number): Promise<AgentRun[]>;
57
+ /**
58
+ * List all agent runs.
59
+ *
60
+ * @returns Array of all agent runs
61
+ */
62
+ list(): Promise<AgentRun[]>;
63
+ /**
64
+ * Delete an agent run by ID.
65
+ *
66
+ * @param id - The agent run ID to delete
67
+ */
68
+ delete(id: string): Promise<void>;
69
+ }
70
+ //# sourceMappingURL=agent-run-repository.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-run-repository.interface.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/agent-run-repository.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE/C;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAE3D;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7F;;;;;;OAMG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEnD;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Agent Run Repository Interface
3
+ *
4
+ * Output port for AgentRun persistence operations.
5
+ * Implementations handle database-specific logic (SQLite, etc.).
6
+ *
7
+ * Following Clean Architecture:
8
+ * - Domain and Application layers depend on this interface
9
+ * - Infrastructure layer provides concrete implementations
10
+ */
11
+ export {};
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Agent Runner Interface
3
+ *
4
+ * Output port for running named agent workflows (e.g., analyze-repository,
5
+ * gather-requirements). The runner resolves the agent from the registry
6
+ * and orchestrates execution, producing an AgentRun record.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const runner: IAgentRunner = container.resolve('IAgentRunner');
15
+ * const run = await runner.runAgent('analyze-repository', 'Analyze the codebase', {
16
+ * repositoryPath: '/path/to/repo',
17
+ * model: 'claude-sonnet-4-5-20250929',
18
+ * timeout: 60000,
19
+ * });
20
+ * console.log(run.status); // 'running' | 'completed' | 'failed'
21
+ * ```
22
+ */
23
+ import type { AgentRun, AgentRunEvent } from '../../../domain/generated/output.js';
24
+ /**
25
+ * Options for controlling agent run behavior.
26
+ */
27
+ export interface AgentRunOptions {
28
+ /** Working directory / repository path for the agent */
29
+ repositoryPath?: string;
30
+ /** Model to use for this run */
31
+ model?: string;
32
+ /** Session ID to resume a previous agent session */
33
+ resumeSession?: string;
34
+ /** Whether to run the agent in the background */
35
+ background?: boolean;
36
+ /** Execution timeout in milliseconds */
37
+ timeout?: number;
38
+ }
39
+ /**
40
+ * Port interface for running named agent workflows.
41
+ *
42
+ * Implementations must:
43
+ * - Resolve the agent by name from the registry
44
+ * - Execute the agent graph with the provided prompt and options
45
+ * - Return a fully-populated AgentRun record
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const runner: IAgentRunner = container.resolve('IAgentRunner');
50
+ *
51
+ * // Run an agent with default options
52
+ * const run = await runner.runAgent('gather-requirements', 'What are the user needs?');
53
+ *
54
+ * // Run with specific options
55
+ * const run = await runner.runAgent('implement-feature', 'Build the login form', {
56
+ * repositoryPath: '/workspace/my-app',
57
+ * background: true,
58
+ * timeout: 120000,
59
+ * });
60
+ * ```
61
+ */
62
+ export interface IAgentRunner {
63
+ /**
64
+ * Run a named agent workflow with the given prompt.
65
+ *
66
+ * @param agentName - The registered agent name (e.g., 'analyze-repository')
67
+ * @param prompt - The prompt to send to the agent
68
+ * @param options - Optional run configuration
69
+ * @returns The agent run record tracking execution
70
+ */
71
+ runAgent(agentName: string, prompt: string, options?: AgentRunOptions): Promise<AgentRun>;
72
+ /**
73
+ * Run a named agent workflow and stream events as they arrive.
74
+ *
75
+ * @param agentName - The registered agent name (e.g., 'analyze-repository')
76
+ * @param prompt - The prompt to send to the agent
77
+ * @param options - Optional run configuration
78
+ * @returns An async iterable of agent run events
79
+ */
80
+ runAgentStream(agentName: string, prompt: string, options?: AgentRunOptions): AsyncIterable<AgentRunEvent>;
81
+ }
82
+ //# sourceMappingURL=agent-runner.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runner.interface.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/agent-runner.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE1F;;;;;;;OAOG;IACH,cAAc,CACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,eAAe,GACxB,aAAa,CAAC,aAAa,CAAC,CAAC;CACjC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Agent Runner Interface
3
+ *
4
+ * Output port for running named agent workflows (e.g., analyze-repository,
5
+ * gather-requirements). The runner resolves the agent from the registry
6
+ * and orchestrates execution, producing an AgentRun record.
7
+ *
8
+ * Following Clean Architecture:
9
+ * - Domain and Application layers depend on this interface
10
+ * - Infrastructure layer provides concrete implementations
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const runner: IAgentRunner = container.resolve('IAgentRunner');
15
+ * const run = await runner.runAgent('analyze-repository', 'Analyze the codebase', {
16
+ * repositoryPath: '/path/to/repo',
17
+ * model: 'claude-sonnet-4-5-20250929',
18
+ * timeout: 60000,
19
+ * });
20
+ * console.log(run.status); // 'running' | 'completed' | 'failed'
21
+ * ```
22
+ */
23
+ export {};
@@ -8,4 +8,9 @@ export type { ISettingsRepository } from './settings.repository.interface.js';
8
8
  export type { IAgentValidator, AgentValidationResult } from './agent-validator.interface.js';
9
9
  export type { IVersionService } from './version-service.interface.js';
10
10
  export type { IWebServerService } from './web-server-service.interface.js';
11
+ export type { IAgentExecutor, AgentExecutionResult, AgentExecutionStreamEvent, AgentExecutionOptions, } from './agent-executor.interface.js';
12
+ export type { IAgentExecutorFactory } from './agent-executor-factory.interface.js';
13
+ export type { IAgentRunner, AgentRunOptions } from './agent-runner.interface.js';
14
+ export type { IAgentRegistry, AgentDefinitionWithFactory } from './agent-registry.interface.js';
15
+ export type { IAgentRunRepository } from './agent-run-repository.interface.js';
11
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/application/ports/output/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChG,YAAY,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Run Agent Use Case
3
+ *
4
+ * Executes a named agent workflow by resolving it from the registry
5
+ * and delegating to the agent runner.
6
+ *
7
+ * Business Rules:
8
+ * - Agent must be registered in the registry before running
9
+ * - Error messages include available agent names for discoverability
10
+ * - Options are passed through to the runner as-is
11
+ */
12
+ import type { AgentRun, AgentRunEvent } from '../../../domain/generated/output.js';
13
+ import type { IAgentRunner, AgentRunOptions } from '../../ports/output/agent-runner.interface.js';
14
+ import type { IAgentRegistry } from '../../ports/output/agent-registry.interface.js';
15
+ /**
16
+ * Input for running an agent workflow.
17
+ */
18
+ export interface RunAgentInput {
19
+ agentName: string;
20
+ prompt: string;
21
+ options?: AgentRunOptions;
22
+ }
23
+ /**
24
+ * Use case for running a named agent workflow.
25
+ *
26
+ * Algorithm:
27
+ * 1. Validate agent exists in the registry
28
+ * 2. Delegate to agent runner with name, prompt, and options
29
+ * 3. Return the resulting AgentRun record
30
+ */
31
+ export declare class RunAgentUseCase {
32
+ private readonly agentRunner;
33
+ private readonly agentRegistry;
34
+ constructor(agentRunner: IAgentRunner, agentRegistry: IAgentRegistry);
35
+ /**
36
+ * Execute the run agent use case.
37
+ *
38
+ * @param input - Agent run input including name, prompt, and options
39
+ * @returns AgentRun record tracking the execution
40
+ * @throws Error if the agent name is not registered
41
+ */
42
+ execute(input: RunAgentInput): Promise<AgentRun>;
43
+ /**
44
+ * Execute the run agent use case with streaming events.
45
+ *
46
+ * @param input - Agent run input including name, prompt, and options
47
+ * @returns An async iterable of agent run events
48
+ * @throws Error if the agent name is not registered
49
+ */
50
+ executeStream(input: RunAgentInput): AsyncIterable<AgentRunEvent>;
51
+ }
52
+ //# sourceMappingURL=run-agent.use-case.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-agent.use-case.d.ts","sourceRoot":"","sources":["../../../../../src/application/use-cases/agents/run-agent.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAFb,WAAW,EAAE,YAAY,EAEzB,aAAa,EAAE,cAAc;IAGhD;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYtD;;;;;;OAMG;IACI,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC;CAWzE"}