@orchestrator-claude/cli 1.4.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.
- package/README.md +74 -0
- package/dist/api-client/OrchestratorAPIClient.d.ts +111 -0
- package/dist/api-client/OrchestratorAPIClient.d.ts.map +1 -0
- package/dist/api-client/OrchestratorAPIClient.js +176 -0
- package/dist/api-client/OrchestratorAPIClient.js.map +1 -0
- package/dist/api-client/index.d.ts +11 -0
- package/dist/api-client/index.d.ts.map +1 -0
- package/dist/api-client/index.js +10 -0
- package/dist/api-client/index.js.map +1 -0
- package/dist/api-client/retry.d.ts +29 -0
- package/dist/api-client/retry.d.ts.map +1 -0
- package/dist/api-client/retry.js +85 -0
- package/dist/api-client/retry.js.map +1 -0
- package/dist/api-client/types.d.ts +148 -0
- package/dist/api-client/types.d.ts.map +1 -0
- package/dist/api-client/types.js +10 -0
- package/dist/api-client/types.js.map +1 -0
- package/dist/commands/AgentsCommand.d.ts +74 -0
- package/dist/commands/AgentsCommand.d.ts.map +1 -0
- package/dist/commands/AgentsCommand.js +170 -0
- package/dist/commands/AgentsCommand.js.map +1 -0
- package/dist/commands/InitCommand.d.ts +63 -0
- package/dist/commands/InitCommand.d.ts.map +1 -0
- package/dist/commands/InitCommand.js +150 -0
- package/dist/commands/InitCommand.js.map +1 -0
- package/dist/commands/MigrateCommand.d.ts +93 -0
- package/dist/commands/MigrateCommand.d.ts.map +1 -0
- package/dist/commands/MigrateCommand.js +260 -0
- package/dist/commands/MigrateCommand.js.map +1 -0
- package/dist/commands/StatusCommand.d.ts +61 -0
- package/dist/commands/StatusCommand.d.ts.map +1 -0
- package/dist/commands/StatusCommand.js +142 -0
- package/dist/commands/StatusCommand.js.map +1 -0
- package/dist/commands/TemplatesCommand.d.ts +69 -0
- package/dist/commands/TemplatesCommand.d.ts.map +1 -0
- package/dist/commands/TemplatesCommand.js +147 -0
- package/dist/commands/TemplatesCommand.js.map +1 -0
- package/dist/commands/WorkflowCommand.d.ts +82 -0
- package/dist/commands/WorkflowCommand.d.ts.map +1 -0
- package/dist/commands/WorkflowCommand.js +203 -0
- package/dist/commands/WorkflowCommand.js.map +1 -0
- package/dist/config/CLIConfig.d.ts +66 -0
- package/dist/config/CLIConfig.d.ts.map +1 -0
- package/dist/config/CLIConfig.js +60 -0
- package/dist/config/CLIConfig.js.map +1 -0
- package/dist/formatters/OutputFormatter.d.ts +102 -0
- package/dist/formatters/OutputFormatter.d.ts.map +1 -0
- package/dist/formatters/OutputFormatter.js +182 -0
- package/dist/formatters/OutputFormatter.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +249 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/.gitkeep +0 -0
- package/dist/templates/TemplateEngine.d.ts +90 -0
- package/dist/templates/TemplateEngine.d.ts.map +1 -0
- package/dist/templates/TemplateEngine.js +149 -0
- package/dist/templates/TemplateEngine.js.map +1 -0
- package/dist/templates/base/CLAUDE.md.hbs +362 -0
- package/dist/templates/base/claude/agents/implementer.md +446 -0
- package/dist/templates/base/claude/agents/orchestrator.md +155 -0
- package/dist/templates/base/claude/agents/planner.md +348 -0
- package/dist/templates/base/claude/agents/researcher.md +390 -0
- package/dist/templates/base/claude/agents/reviewer.md +444 -0
- package/dist/templates/base/claude/agents/specifier.md +331 -0
- package/dist/templates/base/claude/agents/task-generator.md +382 -0
- package/dist/templates/base/claude/hooks/post-artifact-generate.sh +39 -0
- package/dist/templates/base/claude/hooks/post-implement-validate.sh +139 -0
- package/dist/templates/base/claude/hooks/post-phase-checkpoint.sh +322 -0
- package/dist/templates/base/claude/hooks/pre-agent-invoke.sh +34 -0
- package/dist/templates/base/claude/hooks/pre-phase-advance.sh +40 -0
- package/dist/templates/base/claude/hooks/track-agent-invocation.sh +230 -0
- package/dist/templates/base/claude/orchestrator-config.json +141 -0
- package/dist/templates/base/claude/settings.json +80 -0
- package/dist/templates/base/claude/skills/artifact-validator/SKILL.md +226 -0
- package/dist/templates/base/claude/skills/docs-guardian/SKILL.md +230 -0
- package/dist/templates/base/claude/skills/kb-lookup/SKILL.md +257 -0
- package/dist/templates/base/claude/skills/phase-gate-evaluator/SKILL.md +274 -0
- package/dist/templates/base/claude/skills/workflow-status/SKILL.md +322 -0
- package/dist/templates/base/docker-compose.yml.hbs +20 -0
- package/dist/templates/base/mcp.json.hbs +37 -0
- package/dist/templates/base/orchestrator/.state/.gitkeep +0 -0
- package/dist/templates/base/orchestrator-index.json.hbs +37 -0
- package/dist/templates/base/package.json.hbs +40 -0
- package/dist/templates/default/.orchestrator/orchestrator-index.json +19 -0
- package/dist/templates/default/README.md +58 -0
- package/dist/templates/default/docker-compose.yml +24 -0
- package/dist/templates/default/template.json +10 -0
- package/dist/templates/projects/api/files/index.ts.hbs +30 -0
- package/dist/templates/projects/api/files/server.ts.hbs +63 -0
- package/dist/templates/projects/api/files/tsconfig.json.hbs +27 -0
- package/dist/templates/projects/api/files/vitest.config.ts.hbs +28 -0
- package/dist/templates/projects/api/template.config.json +238 -0
- package/dist/templates/projects/api/template.config.ts +149 -0
- package/dist/templates/projects/cli/files/cli.ts.hbs +50 -0
- package/dist/templates/projects/cli/files/index.ts.hbs +8 -0
- package/dist/templates/projects/cli/files/tsconfig.json.hbs +27 -0
- package/dist/templates/projects/cli/files/vitest.config.ts.hbs +28 -0
- package/dist/templates/projects/cli/template.config.json +213 -0
- package/dist/templates/projects/cli/template.config.ts +126 -0
- package/dist/templates/projects/frontend/files/App.tsx.hbs +31 -0
- package/dist/templates/projects/frontend/files/index.html.hbs +13 -0
- package/dist/templates/projects/frontend/files/main.tsx.hbs +22 -0
- package/dist/templates/projects/frontend/files/tsconfig.json.hbs +34 -0
- package/dist/templates/projects/frontend/files/tsconfig.node.json.hbs +10 -0
- package/dist/templates/projects/frontend/files/vite.config.ts.hbs +19 -0
- package/dist/templates/projects/frontend/files/vitest.config.ts.hbs +36 -0
- package/dist/templates/projects/frontend/template.config.json +241 -0
- package/dist/templates/projects/frontend/template.config.ts +153 -0
- package/dist/templates/projects/minimal/files/claude-settings.json.hbs +20 -0
- package/dist/templates/projects/minimal/files/env.example.hbs +17 -0
- package/dist/templates/projects/minimal/files/gitignore.hbs +41 -0
- package/dist/templates/projects/minimal/files/index.ts.hbs +13 -0
- package/dist/templates/projects/minimal/files/tsconfig.json.hbs +27 -0
- package/dist/templates/projects/minimal/template.config.json +185 -0
- package/dist/templates/projects/minimal/template.config.ts +88 -0
- package/package.json +37 -0
- package/templates/.gitkeep +0 -0
- package/templates/base/CLAUDE.md.hbs +362 -0
- package/templates/base/claude/agents/implementer.md +446 -0
- package/templates/base/claude/agents/orchestrator.md +155 -0
- package/templates/base/claude/agents/planner.md +348 -0
- package/templates/base/claude/agents/researcher.md +390 -0
- package/templates/base/claude/agents/reviewer.md +444 -0
- package/templates/base/claude/agents/specifier.md +331 -0
- package/templates/base/claude/agents/task-generator.md +382 -0
- package/templates/base/claude/hooks/post-artifact-generate.sh +39 -0
- package/templates/base/claude/hooks/post-implement-validate.sh +139 -0
- package/templates/base/claude/hooks/post-phase-checkpoint.sh +322 -0
- package/templates/base/claude/hooks/pre-agent-invoke.sh +34 -0
- package/templates/base/claude/hooks/pre-phase-advance.sh +40 -0
- package/templates/base/claude/hooks/track-agent-invocation.sh +230 -0
- package/templates/base/claude/orchestrator-config.json +141 -0
- package/templates/base/claude/settings.json +80 -0
- package/templates/base/claude/skills/artifact-validator/SKILL.md +226 -0
- package/templates/base/claude/skills/docs-guardian/SKILL.md +230 -0
- package/templates/base/claude/skills/kb-lookup/SKILL.md +257 -0
- package/templates/base/claude/skills/phase-gate-evaluator/SKILL.md +274 -0
- package/templates/base/claude/skills/workflow-status/SKILL.md +322 -0
- package/templates/base/docker-compose.yml.hbs +20 -0
- package/templates/base/mcp.json.hbs +37 -0
- package/templates/base/orchestrator/.state/.gitkeep +0 -0
- package/templates/base/orchestrator-index.json.hbs +37 -0
- package/templates/base/package.json.hbs +40 -0
- package/templates/default/.orchestrator/orchestrator-index.json +19 -0
- package/templates/default/README.md +58 -0
- package/templates/default/docker-compose.yml +24 -0
- package/templates/default/template.json +10 -0
- package/templates/projects/api/files/index.ts.hbs +30 -0
- package/templates/projects/api/files/server.ts.hbs +63 -0
- package/templates/projects/api/files/tsconfig.json.hbs +27 -0
- package/templates/projects/api/files/vitest.config.ts.hbs +28 -0
- package/templates/projects/api/template.config.json +238 -0
- package/templates/projects/api/template.config.ts +149 -0
- package/templates/projects/cli/files/cli.ts.hbs +50 -0
- package/templates/projects/cli/files/index.ts.hbs +8 -0
- package/templates/projects/cli/files/tsconfig.json.hbs +27 -0
- package/templates/projects/cli/files/vitest.config.ts.hbs +28 -0
- package/templates/projects/cli/template.config.json +213 -0
- package/templates/projects/cli/template.config.ts +126 -0
- package/templates/projects/frontend/files/App.tsx.hbs +31 -0
- package/templates/projects/frontend/files/index.html.hbs +13 -0
- package/templates/projects/frontend/files/main.tsx.hbs +22 -0
- package/templates/projects/frontend/files/tsconfig.json.hbs +34 -0
- package/templates/projects/frontend/files/tsconfig.node.json.hbs +10 -0
- package/templates/projects/frontend/files/vite.config.ts.hbs +19 -0
- package/templates/projects/frontend/files/vitest.config.ts.hbs +36 -0
- package/templates/projects/frontend/template.config.json +241 -0
- package/templates/projects/frontend/template.config.ts +153 -0
- package/templates/projects/minimal/files/claude-settings.json.hbs +20 -0
- package/templates/projects/minimal/files/env.example.hbs +17 -0
- package/templates/projects/minimal/files/gitignore.hbs +41 -0
- package/templates/projects/minimal/files/index.ts.hbs +13 -0
- package/templates/projects/minimal/files/tsconfig.json.hbs +27 -0
- package/templates/projects/minimal/template.config.json +185 -0
- package/templates/projects/minimal/template.config.ts +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @orchestrator-claude/cli
|
|
2
|
+
|
|
3
|
+
**Orchestrator CLI - True Thin Client**
|
|
4
|
+
|
|
5
|
+
This is the thin client CLI for the Orchestrator system. It contains only HTTP client logic and bundled templates, with all business logic running in a Docker container.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Offline Commands**: `init`, `migrate`, `templates` work without Docker
|
|
10
|
+
- **API Commands**: `workflow`, `status`, `agents` require Docker container running
|
|
11
|
+
- **Lightweight**: < 5MB npm package (vs 50MB in v1.3.0)
|
|
12
|
+
- **Docker-First**: All orchestration logic runs in `orchestrator/api` container
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @orchestrator-claude/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Create a new project
|
|
24
|
+
orchestrator init my-project
|
|
25
|
+
|
|
26
|
+
# Start the orchestrator API (requires Docker)
|
|
27
|
+
cd my-project
|
|
28
|
+
docker-compose up -d
|
|
29
|
+
|
|
30
|
+
# Check status
|
|
31
|
+
orchestrator status
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Architecture
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
CLI Thin Client (this package)
|
|
38
|
+
├── HTTP Client (axios)
|
|
39
|
+
├── Commands (Commander.js)
|
|
40
|
+
├── Templates (bundled)
|
|
41
|
+
└── Formatters (chalk, ora)
|
|
42
|
+
|
|
43
|
+
Docker Container (orchestrator/api)
|
|
44
|
+
├── Domain Logic
|
|
45
|
+
├── Application Services
|
|
46
|
+
├── Infrastructure
|
|
47
|
+
└── REST API Server
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Version
|
|
51
|
+
|
|
52
|
+
- **Current**: 1.4.0
|
|
53
|
+
- **Previous**: 1.3.0 (@orchestrator-cli/core - deprecated)
|
|
54
|
+
|
|
55
|
+
## Migration from v1.3.0
|
|
56
|
+
|
|
57
|
+
See [migration guide](../../docs/migration-v1.4.md) for upgrading from `@orchestrator-cli/core` to `@orchestrator-claude/cli`.
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Build
|
|
63
|
+
npm run build
|
|
64
|
+
|
|
65
|
+
# Test
|
|
66
|
+
npm test
|
|
67
|
+
|
|
68
|
+
# Coverage
|
|
69
|
+
npm run test:coverage
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator API Client
|
|
3
|
+
*
|
|
4
|
+
* Thin HTTP client for communicating with Orchestrator API.
|
|
5
|
+
* Zero dependencies on domain/application/infrastructure layers.
|
|
6
|
+
*
|
|
7
|
+
* @module api-client
|
|
8
|
+
*/
|
|
9
|
+
import type { APIClientConfig, HealthResponse, CreateWorkflowRequest, WorkflowResponse, StatusResponse, ActionResponse, Agent, Artifact, DetectResponse, AdvancePhaseResponse } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Orchestrator API Client
|
|
12
|
+
*
|
|
13
|
+
* Provides methods to interact with all Orchestrator API endpoints.
|
|
14
|
+
* Includes automatic retry logic with exponential backoff.
|
|
15
|
+
*/
|
|
16
|
+
export declare class OrchestratorAPIClient {
|
|
17
|
+
private readonly client;
|
|
18
|
+
private readonly config;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new API client instance
|
|
21
|
+
*
|
|
22
|
+
* @param config - Client configuration (optional)
|
|
23
|
+
*/
|
|
24
|
+
constructor(config?: Partial<APIClientConfig>);
|
|
25
|
+
/**
|
|
26
|
+
* Health check endpoint
|
|
27
|
+
*
|
|
28
|
+
* @returns Health status
|
|
29
|
+
*/
|
|
30
|
+
healthCheck(): Promise<HealthResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new workflow
|
|
33
|
+
*
|
|
34
|
+
* @param request - Workflow creation request
|
|
35
|
+
* @returns Created workflow
|
|
36
|
+
*/
|
|
37
|
+
createWorkflow(request: CreateWorkflowRequest): Promise<WorkflowResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Get active workflow status (no ID required)
|
|
40
|
+
*
|
|
41
|
+
* @returns Workflow status
|
|
42
|
+
*/
|
|
43
|
+
getWorkflowStatus(): Promise<StatusResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Get workflow status by ID
|
|
46
|
+
*
|
|
47
|
+
* @param workflowId - Workflow ID
|
|
48
|
+
* @returns Workflow status
|
|
49
|
+
*/
|
|
50
|
+
getWorkflowStatusById(workflowId: string): Promise<StatusResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Get next pending action (Ping-Pong pattern)
|
|
53
|
+
*
|
|
54
|
+
* @param workflowId - Workflow ID
|
|
55
|
+
* @returns Next action to execute
|
|
56
|
+
*/
|
|
57
|
+
getNextAction(workflowId: string): Promise<ActionResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* List all available agents
|
|
60
|
+
*
|
|
61
|
+
* @returns Array of agents
|
|
62
|
+
*/
|
|
63
|
+
listAgents(): Promise<Agent[]>;
|
|
64
|
+
/**
|
|
65
|
+
* List all artifacts
|
|
66
|
+
*
|
|
67
|
+
* @returns Array of artifacts
|
|
68
|
+
*/
|
|
69
|
+
listArtifacts(): Promise<Artifact[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Detect workflow type from user prompt
|
|
72
|
+
*
|
|
73
|
+
* @param prompt - User prompt
|
|
74
|
+
* @returns Detected workflow type
|
|
75
|
+
*/
|
|
76
|
+
detectWorkflow(prompt: string): Promise<DetectResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Advance workflow to next phase
|
|
79
|
+
*
|
|
80
|
+
* @param workflowId - Workflow ID
|
|
81
|
+
* @param targetPhase - Target phase (optional)
|
|
82
|
+
* @returns Advance result
|
|
83
|
+
*/
|
|
84
|
+
advancePhase(workflowId: string, targetPhase?: string): Promise<AdvancePhaseResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Approve pending action (transition awaiting_approval -> awaiting_agent)
|
|
87
|
+
*
|
|
88
|
+
* @param workflowId - Workflow ID
|
|
89
|
+
* @returns Approval result
|
|
90
|
+
*/
|
|
91
|
+
approveAction(workflowId: string): Promise<{
|
|
92
|
+
success: boolean;
|
|
93
|
+
message: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Generic request wrapper with retry logic
|
|
97
|
+
*
|
|
98
|
+
* @param requestFn - Function that performs the axios request
|
|
99
|
+
* @returns Response data
|
|
100
|
+
* @throws Error if request fails after retries
|
|
101
|
+
*/
|
|
102
|
+
private request;
|
|
103
|
+
/**
|
|
104
|
+
* Handle and normalize errors
|
|
105
|
+
*
|
|
106
|
+
* @param error - Error from axios
|
|
107
|
+
* @returns Normalized error
|
|
108
|
+
*/
|
|
109
|
+
private handleError;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=OrchestratorAPIClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrchestratorAPIClient.d.ts","sourceRoot":"","sources":["../../src/api-client/OrchestratorAPIClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,KAAK,EACL,QAAQ,EAER,cAAc,EAEd,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAYpB;;;;;GAKG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAEnD;;;;OAIG;gBACS,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IAY7C;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC;IAI5C;;;;;OAKG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI/E;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAIlD;;;;;OAKG;IACG,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxE;;;;;OAKG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMhE;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAIpC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAI1C;;;;;OAKG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAK7D;;;;;;OAMG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAOhC;;;;;OAKG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAMvF;;;;;;OAMG;YACW,OAAO;IAcrB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;CAwBpB"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator API Client
|
|
3
|
+
*
|
|
4
|
+
* Thin HTTP client for communicating with Orchestrator API.
|
|
5
|
+
* Zero dependencies on domain/application/infrastructure layers.
|
|
6
|
+
*
|
|
7
|
+
* @module api-client
|
|
8
|
+
*/
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import { retryWithBackoff } from './retry.js';
|
|
11
|
+
/**
|
|
12
|
+
* Default API configuration
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_CONFIG = {
|
|
15
|
+
baseURL: 'http://localhost:3000/api/v1',
|
|
16
|
+
timeout: 30000,
|
|
17
|
+
retries: 3,
|
|
18
|
+
retryDelay: 1000,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Orchestrator API Client
|
|
22
|
+
*
|
|
23
|
+
* Provides methods to interact with all Orchestrator API endpoints.
|
|
24
|
+
* Includes automatic retry logic with exponential backoff.
|
|
25
|
+
*/
|
|
26
|
+
export class OrchestratorAPIClient {
|
|
27
|
+
client;
|
|
28
|
+
config;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new API client instance
|
|
31
|
+
*
|
|
32
|
+
* @param config - Client configuration (optional)
|
|
33
|
+
*/
|
|
34
|
+
constructor(config) {
|
|
35
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
36
|
+
this.client = axios.create({
|
|
37
|
+
baseURL: this.config.baseURL,
|
|
38
|
+
timeout: this.config.timeout,
|
|
39
|
+
headers: {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Health check endpoint
|
|
46
|
+
*
|
|
47
|
+
* @returns Health status
|
|
48
|
+
*/
|
|
49
|
+
async healthCheck() {
|
|
50
|
+
return this.request(() => this.client.get('/health'));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a new workflow
|
|
54
|
+
*
|
|
55
|
+
* @param request - Workflow creation request
|
|
56
|
+
* @returns Created workflow
|
|
57
|
+
*/
|
|
58
|
+
async createWorkflow(request) {
|
|
59
|
+
return this.request(() => this.client.post('/workflows', request));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get active workflow status (no ID required)
|
|
63
|
+
*
|
|
64
|
+
* @returns Workflow status
|
|
65
|
+
*/
|
|
66
|
+
async getWorkflowStatus() {
|
|
67
|
+
return this.request(() => this.client.get('/workflows/status'));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get workflow status by ID
|
|
71
|
+
*
|
|
72
|
+
* @param workflowId - Workflow ID
|
|
73
|
+
* @returns Workflow status
|
|
74
|
+
*/
|
|
75
|
+
async getWorkflowStatusById(workflowId) {
|
|
76
|
+
return this.request(() => this.client.get(`/workflows/${workflowId}/status`));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get next pending action (Ping-Pong pattern)
|
|
80
|
+
*
|
|
81
|
+
* @param workflowId - Workflow ID
|
|
82
|
+
* @returns Next action to execute
|
|
83
|
+
*/
|
|
84
|
+
async getNextAction(workflowId) {
|
|
85
|
+
return this.request(() => this.client.get(`/workflows/${workflowId}/pending-action`));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* List all available agents
|
|
89
|
+
*
|
|
90
|
+
* @returns Array of agents
|
|
91
|
+
*/
|
|
92
|
+
async listAgents() {
|
|
93
|
+
return this.request(() => this.client.get('/agents'));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* List all artifacts
|
|
97
|
+
*
|
|
98
|
+
* @returns Array of artifacts
|
|
99
|
+
*/
|
|
100
|
+
async listArtifacts() {
|
|
101
|
+
return this.request(() => this.client.get('/artifacts'));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Detect workflow type from user prompt
|
|
105
|
+
*
|
|
106
|
+
* @param prompt - User prompt
|
|
107
|
+
* @returns Detected workflow type
|
|
108
|
+
*/
|
|
109
|
+
async detectWorkflow(prompt) {
|
|
110
|
+
const request = { prompt };
|
|
111
|
+
return this.request(() => this.client.post('/workflows/detect', request));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Advance workflow to next phase
|
|
115
|
+
*
|
|
116
|
+
* @param workflowId - Workflow ID
|
|
117
|
+
* @param targetPhase - Target phase (optional)
|
|
118
|
+
* @returns Advance result
|
|
119
|
+
*/
|
|
120
|
+
async advancePhase(workflowId, targetPhase) {
|
|
121
|
+
const request = targetPhase ? { targetPhase } : {};
|
|
122
|
+
return this.request(() => this.client.put(`/workflows/${workflowId}/advance`, request));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Approve pending action (transition awaiting_approval -> awaiting_agent)
|
|
126
|
+
*
|
|
127
|
+
* @param workflowId - Workflow ID
|
|
128
|
+
* @returns Approval result
|
|
129
|
+
*/
|
|
130
|
+
async approveAction(workflowId) {
|
|
131
|
+
return this.request(() => this.client.post(`/workflows/${workflowId}/pending-action/approve`));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generic request wrapper with retry logic
|
|
135
|
+
*
|
|
136
|
+
* @param requestFn - Function that performs the axios request
|
|
137
|
+
* @returns Response data
|
|
138
|
+
* @throws Error if request fails after retries
|
|
139
|
+
*/
|
|
140
|
+
async request(requestFn) {
|
|
141
|
+
try {
|
|
142
|
+
const result = await retryWithBackoff(requestFn, this.config.retries, this.config.retryDelay, this.config.timeout);
|
|
143
|
+
return result.data;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
throw this.handleError(error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Handle and normalize errors
|
|
151
|
+
*
|
|
152
|
+
* @param error - Error from axios
|
|
153
|
+
* @returns Normalized error
|
|
154
|
+
*/
|
|
155
|
+
handleError(error) {
|
|
156
|
+
if (axios.isAxiosError(error)) {
|
|
157
|
+
const axiosError = error;
|
|
158
|
+
if (axiosError.response) {
|
|
159
|
+
// Server responded with error status
|
|
160
|
+
const { status, data } = axiosError.response;
|
|
161
|
+
const message = data?.message || axiosError.message;
|
|
162
|
+
return new Error(`API Error (${status}): ${message}`);
|
|
163
|
+
}
|
|
164
|
+
if (axiosError.request) {
|
|
165
|
+
// Request made but no response
|
|
166
|
+
return new Error('API Error: No response from server. Is the API running?');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Unknown error
|
|
170
|
+
if (error instanceof Error) {
|
|
171
|
+
return error;
|
|
172
|
+
}
|
|
173
|
+
return new Error('Unknown API error');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=OrchestratorAPIClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrchestratorAPICl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AC;QAED,gBAAgB;QAChB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Module
|
|
3
|
+
*
|
|
4
|
+
* Exports Orchestrator API client and types.
|
|
5
|
+
*
|
|
6
|
+
* @module api-client
|
|
7
|
+
*/
|
|
8
|
+
export { OrchestratorAPIClient } from './OrchestratorAPIClient.js';
|
|
9
|
+
export { retryWithBackoff } from './retry.js';
|
|
10
|
+
export type { APIClientConfig, HealthResponse, CreateWorkflowRequest, WorkflowResponse, StatusResponse, ActionResponse, PendingAction, Agent, Artifact, ArtifactSummary, DetectWorkflowRequest, DetectResponse, AdvancePhaseRequest, AdvancePhaseResponse, ErrorResponse, } from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-client/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EACV,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,aAAa,EACb,KAAK,EACL,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Module
|
|
3
|
+
*
|
|
4
|
+
* Exports Orchestrator API client and types.
|
|
5
|
+
*
|
|
6
|
+
* @module api-client
|
|
7
|
+
*/
|
|
8
|
+
export { OrchestratorAPIClient } from './OrchestratorAPIClient.js';
|
|
9
|
+
export { retryWithBackoff } from './retry.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api-client/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Logic with Exponential Backoff
|
|
3
|
+
*
|
|
4
|
+
* Provides retry mechanism for HTTP requests with configurable backoff.
|
|
5
|
+
*
|
|
6
|
+
* @module api-client/retry
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Retry a function with exponential backoff
|
|
10
|
+
*
|
|
11
|
+
* @param fn - Function to retry
|
|
12
|
+
* @param maxRetries - Maximum number of retries (default: 3)
|
|
13
|
+
* @param baseDelay - Base delay in milliseconds (default: 1000)
|
|
14
|
+
* @param timeout - Request timeout in milliseconds (default: 30000)
|
|
15
|
+
* @returns Result of the function
|
|
16
|
+
* @throws Error if all retries fail
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const result = await retryWithBackoff(
|
|
21
|
+
* () => axios.get('/api/data'),
|
|
22
|
+
* 3, // max retries
|
|
23
|
+
* 1000, // base delay (1s, 2s, 4s)
|
|
24
|
+
* 30000 // timeout
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, timeout?: number): Promise<T>;
|
|
29
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/api-client/retry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgCH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,UAAU,GAAE,MAAU,EACtB,SAAS,GAAE,MAAa,EACxB,OAAO,GAAE,MAAc,GACtB,OAAO,CAAC,CAAC,CAAC,CAoCZ"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Logic with Exponential Backoff
|
|
3
|
+
*
|
|
4
|
+
* Provides retry mechanism for HTTP requests with configurable backoff.
|
|
5
|
+
*
|
|
6
|
+
* @module api-client/retry
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Sleep for specified milliseconds
|
|
10
|
+
*
|
|
11
|
+
* @param ms - Milliseconds to sleep
|
|
12
|
+
*/
|
|
13
|
+
function sleep(ms) {
|
|
14
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an error is retryable
|
|
18
|
+
*
|
|
19
|
+
* @param error - Error to check
|
|
20
|
+
* @returns True if error is retryable
|
|
21
|
+
*/
|
|
22
|
+
function isRetryableError(error) {
|
|
23
|
+
if (error && typeof error === 'object' && 'response' in error) {
|
|
24
|
+
const status = error.response?.status;
|
|
25
|
+
// Retry on 5xx errors and 429 (rate limit)
|
|
26
|
+
return status !== undefined && (status >= 500 || status === 429);
|
|
27
|
+
}
|
|
28
|
+
// Retry on network errors (no response)
|
|
29
|
+
if (error && typeof error === 'object' && 'request' in error && !('response' in error)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Retry a function with exponential backoff
|
|
36
|
+
*
|
|
37
|
+
* @param fn - Function to retry
|
|
38
|
+
* @param maxRetries - Maximum number of retries (default: 3)
|
|
39
|
+
* @param baseDelay - Base delay in milliseconds (default: 1000)
|
|
40
|
+
* @param timeout - Request timeout in milliseconds (default: 30000)
|
|
41
|
+
* @returns Result of the function
|
|
42
|
+
* @throws Error if all retries fail
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const result = await retryWithBackoff(
|
|
47
|
+
* () => axios.get('/api/data'),
|
|
48
|
+
* 3, // max retries
|
|
49
|
+
* 1000, // base delay (1s, 2s, 4s)
|
|
50
|
+
* 30000 // timeout
|
|
51
|
+
* );
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export async function retryWithBackoff(fn, maxRetries = 3, baseDelay = 1000, timeout = 30000) {
|
|
55
|
+
let lastError;
|
|
56
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
57
|
+
try {
|
|
58
|
+
// Create a timeout promise
|
|
59
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
60
|
+
setTimeout(() => reject(new Error('Request timeout')), timeout);
|
|
61
|
+
});
|
|
62
|
+
// Race between the function and timeout
|
|
63
|
+
const result = await Promise.race([fn(), timeoutPromise]);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
lastError = error;
|
|
68
|
+
// Don't retry on last attempt
|
|
69
|
+
if (attempt === maxRetries) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
// Only retry if error is retryable
|
|
73
|
+
if (!isRetryableError(error)) {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
// Calculate delay with exponential backoff: baseDelay * 2^attempt
|
|
77
|
+
const delay = baseDelay * Math.pow(2, attempt);
|
|
78
|
+
// Wait before retrying
|
|
79
|
+
await sleep(delay);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// All retries failed
|
|
83
|
+
throw lastError;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AC,CAAC,EAAE,OAAO,CAAC,CAAC;YAClE,CAAC,CAAC,CAAC;YAEH,wCAAwC;YACxC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;YAElB,8BAA8B;YAC9B,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3B,MAAM;YACR,CAAC;YAED,mCAAmC;YACnC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,KAAK,CAAC;YACd,CAAC;YAED,kEAAkE;YAClE,MAAM,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAE/C,uBAAuB;YACvB,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,qBAAqB;IACrB,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Types
|
|
3
|
+
*
|
|
4
|
+
* Local type definitions for Orchestrator API Client.
|
|
5
|
+
* IMPORTANT: Zero imports from domain/application/infrastructure layers.
|
|
6
|
+
*
|
|
7
|
+
* @module api-client/types
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Health check response
|
|
11
|
+
*/
|
|
12
|
+
export interface HealthResponse {
|
|
13
|
+
status: 'ok' | 'error';
|
|
14
|
+
timestamp: string;
|
|
15
|
+
uptime: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Workflow creation request
|
|
19
|
+
*/
|
|
20
|
+
export interface CreateWorkflowRequest {
|
|
21
|
+
prompt: string;
|
|
22
|
+
workflowType?: 'feature_development' | 'bug_fix' | 'refactoring' | 'emergency_debug';
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Workflow response
|
|
27
|
+
*/
|
|
28
|
+
export interface WorkflowResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
type: string;
|
|
31
|
+
status: string;
|
|
32
|
+
currentPhase: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt?: string;
|
|
35
|
+
prompt?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Workflow status response
|
|
39
|
+
*/
|
|
40
|
+
export interface StatusResponse {
|
|
41
|
+
workflowId: string;
|
|
42
|
+
status: string;
|
|
43
|
+
currentPhase: string;
|
|
44
|
+
completedPhases: string[];
|
|
45
|
+
artifacts: ArtifactSummary[];
|
|
46
|
+
createdAt: string;
|
|
47
|
+
updatedAt?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Artifact summary
|
|
51
|
+
*/
|
|
52
|
+
export interface ArtifactSummary {
|
|
53
|
+
id: string;
|
|
54
|
+
type: string;
|
|
55
|
+
path: string;
|
|
56
|
+
status: string;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
phase?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Next action response (Ping-Pong pattern)
|
|
62
|
+
*/
|
|
63
|
+
export interface ActionResponse {
|
|
64
|
+
hasAction: boolean;
|
|
65
|
+
workflowId?: string;
|
|
66
|
+
pendingAction?: PendingAction;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Pending action details
|
|
70
|
+
*/
|
|
71
|
+
export interface PendingAction {
|
|
72
|
+
id: string;
|
|
73
|
+
agent: string;
|
|
74
|
+
status: 'awaiting_agent' | 'awaiting_approval' | 'running' | 'completed' | 'failed';
|
|
75
|
+
prompt: string;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Agent summary
|
|
81
|
+
*/
|
|
82
|
+
export interface Agent {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
purpose: string;
|
|
86
|
+
capabilities?: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Artifact (full)
|
|
90
|
+
*/
|
|
91
|
+
export interface Artifact {
|
|
92
|
+
id: string;
|
|
93
|
+
type: string;
|
|
94
|
+
path: string;
|
|
95
|
+
status: string;
|
|
96
|
+
workflowId?: string;
|
|
97
|
+
phase?: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
metadata?: Record<string, unknown>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Workflow detection request
|
|
103
|
+
*/
|
|
104
|
+
export interface DetectWorkflowRequest {
|
|
105
|
+
prompt: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Workflow detection response
|
|
109
|
+
*/
|
|
110
|
+
export interface DetectResponse {
|
|
111
|
+
workflowType: 'feature_development' | 'bug_fix' | 'refactoring' | 'emergency_debug';
|
|
112
|
+
confidence: number;
|
|
113
|
+
reasoning: string;
|
|
114
|
+
suggestedActions?: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Advance phase request
|
|
118
|
+
*/
|
|
119
|
+
export interface AdvancePhaseRequest {
|
|
120
|
+
targetPhase?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Advance phase response
|
|
124
|
+
*/
|
|
125
|
+
export interface AdvancePhaseResponse {
|
|
126
|
+
workflowId: string;
|
|
127
|
+
currentPhase: string;
|
|
128
|
+
message: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Error response
|
|
132
|
+
*/
|
|
133
|
+
export interface ErrorResponse {
|
|
134
|
+
error: string;
|
|
135
|
+
message: string;
|
|
136
|
+
statusCode?: number;
|
|
137
|
+
details?: unknown;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* API Client configuration
|
|
141
|
+
*/
|
|
142
|
+
export interface APIClientConfig {
|
|
143
|
+
baseURL: string;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
retries?: number;
|
|
146
|
+
retryDelay?: number;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api-client/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,qBAAqB,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,CAAC;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IA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