-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenai.yaml
More file actions
1408 lines (1343 loc) · 49 KB
/
Copy pathopenai.yaml
File metadata and controls
1408 lines (1343 loc) · 49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: LazyDeve Agent API
version: "1.5.0"
description: >
LazyDeve – autonomous development agent (Git-integrated).
Endpoints for ChatGPT Apps integration and automated AI workflows.
x-initialization:
description: "Auto-initialization protocol for LazyDeve Agent"
trigger: "on_first_message"
sequence:
- /ping-agent
- /status
- /commits
- /logs
- /projects/list
- /projects/active
note: |
The agent automatically validates its health and readiness on first request.
All subsequent requests benefit from pre-validated system state and project context.
⚠️ All endpoints operate within the active project folder automatically.
Use relative paths (e.g., "README.md") - the system auto-injects "projects/{active_project}/".
For full route documentation, see: GET /openapi.yaml
📌 ENDPOINT SELECTION GUIDE:
- /update-file: Use when you have EXACT file content ready (create/edit files directly)
- /execute: Use for AI-powered tasks (refactoring, code generation, deletions)
- Simple rule: If you know the exact content → /update-file, If you need AI → /execute
- Format preference: Use minimal format {"task": "..."} unless you need to override defaults
servers:
- url: https://agent.lazydeve.uk
description: Production server
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Success:
type: object
description: Generic success payload
properties:
status:
type: string
example: success
message:
type: string
example: Operation completed successfully
data:
type: object
additionalProperties: true
Error:
type: object
properties:
status:
type: string
example: error
message:
type: string
example: Something went wrong
paths:
/ping-agent:
get:
summary: Check if agent is online
operationId: pingAgent
responses:
"200":
description: Agent online confirmation
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/status:
get:
summary: Get Git repository status and agent freshness
operationId: getStatus
responses:
"200":
description: Status info
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/commits:
get:
summary: Retrieve recent Git commit history
operationId: getCommits
parameters:
- name: limit
in: query
schema:
type: integer
default: 5
responses:
"200":
description: Commit history
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/list-files:
get:
summary: List files in project directory
operationId: listFiles
parameters:
- name: directory
in: query
schema:
type: string
default: "."
responses:
"200":
description: File listing
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/execute:
post:
summary: Execute AI-assisted development tasks via Aider CLI
description: >
AI-powered operations: refactoring, code generation, deletions, and complex multi-file edits.
📌 **DECISION RULE:**
- If you already know the exact file content → use /update-file
- If you need AI to generate, refactor, or modify code → use /execute
⚠️ **FILE PROTECTION:**
- Explicit commands like "create file X" are automatically redirected to /update-file
- Aider may still create files as part of AI-generated tasks (this is allowed)
- Explicit natural-language edit commands targeting exact file content (e.g., "update file X with Y") redirect to /update-file
📌 **USE /execute FOR:**
- Refactoring or improving existing code
- Generating new modules or features
- Deleting one or more files
- Coordinated multi-file changes
📌 **USE /update-file FOR:**
- Creating a file when you already have its full content
- Replacing file text directly (no AI reasoning)
⚠️ **REQUIREMENTS:**
- Active project must be set (returns 400 if not)
- "task" field is REQUIRED (or use "prompt"/"instruction" as aliases)
- All changes are automatically committed after execution
📦 **FORMAT:** {"task": "description"}
Optional fields: *files*, *project*, *model*.
🧪 **EXAMPLES:**
- {"task": "Refactor authentication to use JWT"}
- {"task": "Add logging to all API endpoints"}
- {"task": "Delete old_config.py"}
- {"task": "Generate a new API endpoint", "files": ["routes/users.py"]}
operationId: executeTask
requestBody:
required: true
content:
application/json:
schema:
type: object
required: ["task"]
properties:
task:
type: string
description: Natural language task description (REQUIRED)
example: "Add logging to the authentication module"
prompt:
type: string
description: Alias for 'task' parameter (optional - use 'task' instead)
instruction:
type: string
description: Alias for 'task' parameter (optional - use 'task' instead)
model:
type: string
description: LLM model to use (OPTIONAL - auto-selected if not provided)
default: "gpt-4o-mini"
enum: ["gpt-4o", "gpt-4o-mini", "claude-3-5-sonnet", "gemini-pro"]
files:
type: array
description: Specific files to include in Aider context (OPTIONAL)
items:
type: string
example: ["src/auth.py", "tests/test_auth.py"]
project:
type: string
description: Target project name (OPTIONAL - uses active project if not provided)
example: "LazyDeve"
commit:
type: boolean
description: Auto-commit flag (OPTIONAL - currently not implemented, changes always committed)
default: true
responses:
"200":
description: Task executed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
"400":
description: Invalid task, wrong endpoint for action, or file operation detected (redirects to /update-file)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/analyze-code:
post:
summary: Analyze project source code
description: AI-assisted or static code analysis for issues, complexity metrics, and code style feedback.
operationId: analyzeCode
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
target:
type: string
example: "projects/LazyDeve/core/"
mode:
type: string
enum: [ai, static]
default: ai
text/plain:
schema:
type: string
example: "projects/LazyDeve/core/"
responses:
"200":
description: Code analysis result
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/run-tests:
post:
summary: Run automated tests
description: Executes unit or integration tests from specified directory and returns summarized results.
operationId: runTests
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
scope:
type: string
example: "tests/"
filter:
type: string
example: "test_ping_agent"
text/plain:
schema:
type: string
example: "tests/"
responses:
"200":
description: Test run summary
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/read-file:
post:
summary: Read file content
operationId: readFile
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
path:
type: string
example: "core/config.py"
text/plain:
schema:
type: string
example: "./agent.py"
responses:
"200":
description: File content
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/update-file:
post:
summary: Create or update a file with exact content
description: >
Direct file write — creates or updates a file with **exact** content, without AI reasoning.
Ideal for cases when you already have full file content ready.
📌 **DECISION RULE:**
- Use /update-file when you want to create or replace a file with known content
- Use /execute when you need AI to reason, refactor, or generate code automatically
⚠️ **REQUIREMENTS:**
- Active project must be set (returns 400 if not)
- Both *path* and *content* fields are **REQUIRED**
- Relative paths are automatically prefixed with the active project directory
- Empty content ("") clears the file (use /execute for file deletion)
⚠️ **REDIRECT BEHAVIOR:**
- Explicit natural-language edit commands targeting exact file content (e.g., "update file X with Y") are redirected here from /execute
- Commands like "create file X with ..." or "replace file Y content with ..." are also handled here directly
- This ensures safe, deterministic file updates without AI misinterpretation
📦 **FORMAT:** {"path": "file.py", "content": "your code"}
Optional plain-text body mode exists but is rarely needed. JSON format is recommended.
File paths must be within the active project root for safety.
🧪 **EXAMPLES:**
- {"path": "utils/logger.py", "content": "def log(): pass"}
- {"path": "config.json", "content": "{\"debug\": true}"}
- {"path": "data/cache.tmp", "content": ""} # Clears file content
🧭 **NOTES:**
- Returns HTTP 200 on success, 400 on invalid path/missing parameters, 403 on protected directories
- Does not perform refactoring or AI-driven edits (use /execute for that)
- Fully integrated with CPL redirection layer for safe file handling
operationId: updateFile
requestBody:
required: true
content:
application/json:
schema:
type: object
required: ["path", "content"]
properties:
path:
type: string
description: File path (relative paths auto-prefixed with active project)
example: "test.py"
content:
type: string
description: Exact file content to write (empty string '' clears file)
example: "def hello(): print('world')"
text/plain:
schema:
type: string
example: "projects/LazyDeve/README.md"
responses:
"200":
description: File updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
"400":
description: Invalid request (missing path/content or inactive project)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"403":
description: Protected directory access denied (core/, api/, utils/)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/commit:
post:
summary: Commit current project changes
operationId: commitChanges
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "chore: update agent logic"
text/plain:
schema:
type: string
example: "chore: update agent logic"
responses:
"200":
description: Commit successful
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/set-llm:
post:
summary: Change active LLM provider
operationId: setLLM
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
provider:
type: string
enum: [openai, anthropic, gemini, mistral]
responses:
"200":
description: Provider switched
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/llm-info:
get:
summary: Get current LLM info
operationId: getLLMInfo
responses:
"200":
description: Current LLM provider
content:
application/json:
schema:
$ref: '#/components/schemas/Success'
/projects/list:
get:
summary: List all available projects
description: Returns list of all projects. Each has own directory, memory, and context.
operationId: listProjects
responses:
"200":
description: List of project names
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
projects:
type: array
items:
type: string
example: ["LazyDeve", "WebBuilder", "TestProject"]
/projects/active:
get:
summary: Get currently active project and full unified context
description: >
Returns active project name and full unified context structure (context_full.json format).
All /execute commands target this project.
✅ TASK 8.9.3: Automatically includes project context (README + memory)
✅ TASK 8.10.1.2: Returns full unified context structure (not summary format)
**Full unified context includes:**
- Core metadata: project_name, description, tech_stack, recent_focus, keywords, confidence
- README: preview (configurable via config.json["readme_chars"], default: 1400 chars), last_updated, checksum
- Commits: last_commit (with commit_id, summary, files_changed, file_contexts), recent commits history
- Activity: total_actions, recent_focus, common_operations, error_patterns, recent_actions
- Snapshot: last_run, status, pending_changes
- Config: project configuration including user_memory, commit_history settings
- Stats: project statistics
- User memory: notes (max 300 chars), last_updated
This is the complete unified context structure that ChatGPT receives for full project awareness.
Best practice: call periodically in long conversations to maintain context awareness.
operationId: getActiveProject
responses:
"200":
description: Active project name and full unified context
content:
application/json:
schema:
type: object
properties:
active_project:
type: string
nullable: true
example: "LazyDeve"
description: Active project name (null if no project set)
context:
type: object
nullable: true
description: Full unified context structure (context_full.json format, optional, only if project is active)
additionalProperties: true
properties:
version:
type: string
description: Context structure version
generated_at:
type: string
format: date-time
description: When context was generated
project_name:
type: string
description:
type: string
nullable: true
tech_stack:
type: array
items:
type: string
recent_focus:
type: string
nullable: true
keywords:
type: array
items:
type: string
confidence:
type: number
readme:
type: object
description: README information
properties:
preview:
type: string
nullable: true
description: "README preview (configurable via config.json, default: 1400 chars)"
last_updated:
type: string
format: date-time
nullable: true
checksum:
type: string
nullable: true
commits:
type: object
description: Commit history
properties:
last_commit:
type: object
nullable: true
recent:
type: array
items:
type: object
activity:
type: object
description: Project activity summary
properties:
total_actions:
type: integer
recent_focus:
type: string
nullable: true
common_operations:
type: array
items:
type: string
error_patterns:
type: array
items:
type: string
recent_actions:
type: array
items:
type: object
snapshot:
type: object
description: Project state snapshot
properties:
last_run:
type: string
format: date-time
nullable: true
status:
type: string
pending_changes:
type: boolean
config:
type: object
description: Project configuration
additionalProperties: true
stats:
type: object
description: Project statistics
additionalProperties: true
user_memory:
type: object
nullable: true
description: User memory notes
properties:
notes:
type: string
nullable: true
last_updated:
type: string
format: date-time
nullable: true
/projects/create/{name}:
post:
summary: Create a new project with proper structure
description: >
Creates project directory with README.md, src/, tests/, docs/, .lazydeve/.
Auto-syncs to GitHub. Sets as active project. ALWAYS use this for project creation, NOT /execute.
operationId: createProject
parameters:
- name: name
in: path
required: true
description: Project name (alphanumeric, underscores, hyphens only)
schema:
type: string
pattern: '^[a-zA-Z0-9_-]+$'
example: "MyNewProject"
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
description:
type: string
description: Project description
example: "REST API for user management"
language:
type: string
description: Primary programming language
example: "python"
enum: ["python", "javascript", "typescript", "java", "go", "rust", "generic"]
responses:
"200":
description: Project created successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: created
message:
type: string
project_name:
type: string
sync_status:
type: string
enum: ["synced", "disabled", "error"]
/projects/set-active/{name}:
post:
summary: Switch to a different project and get full unified context
description: >
Changes active project context. All subsequent /execute commands target this project.
Use when user says "switch to" or "work on" a different project.
✅ TASK 8.9.3: Automatically returns project context after activation
✅ TASK 8.10.1.2: Returns full unified context structure (context_full.json format)
**Full unified context includes:**
- Core metadata: project_name, description, tech_stack, recent_focus, keywords, confidence
- README: preview (configurable via config.json["readme_chars"], default: 1400 chars), last_updated, checksum
- Commits: last_commit (with commit_id, summary, files_changed, file_contexts), recent commits history
- Activity: total_actions, recent_focus, common_operations, error_patterns, recent_actions
- Snapshot: last_run, status, pending_changes
- Config: project configuration including user_memory, commit_history settings
- Stats: project statistics
- User memory: notes (max 300 chars), last_updated
operationId: setActiveProject
parameters:
- name: name
in: path
required: true
description: Project name to activate
schema:
type: string
example: "WebBuilder"
responses:
"200":
description: Project activated with context
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
active_project:
type: string
example: "WebBuilder"
context:
type: object
nullable: true
description: Full unified context structure (context_full.json format, optional, only if activation successful)
additionalProperties: true
properties:
version:
type: string
generated_at:
type: string
format: date-time
project_name:
type: string
description:
type: string
nullable: true
tech_stack:
type: array
items:
type: string
recent_focus:
type: string
nullable: true
keywords:
type: array
items:
type: string
confidence:
type: number
readme:
type: object
properties:
preview:
type: string
nullable: true
last_updated:
type: string
format: date-time
nullable: true
checksum:
type: string
nullable: true
commits:
type: object
properties:
last_commit:
type: object
nullable: true
recent:
type: array
items:
type: object
activity:
type: object
properties:
total_actions:
type: integer
recent_focus:
type: string
nullable: true
common_operations:
type: array
items:
type: string
error_patterns:
type: array
items:
type: string
recent_actions:
type: array
items:
type: object
snapshot:
type: object
properties:
last_run:
type: string
format: date-time
nullable: true
status:
type: string
pending_changes:
type: boolean
config:
type: object
additionalProperties: true
stats:
type: object
additionalProperties: true
user_memory:
type: object
nullable: true
properties:
notes:
type: string
nullable: true
last_updated:
type: string
format: date-time
nullable: true
/projects/info/{name}:
get:
summary: Get detailed project information
description: Returns project metadata including file count, active status, and directory path.
operationId: getProjectInfo
parameters:
- name: name
in: path
required: true
description: Project name
schema:
type: string
example: "LazyDeve"
responses:
"200":
description: Project information
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: ok
info:
type: object
properties:
name:
type: string
path:
type: string
is_active:
type: boolean
files:
type: integer
/api/v1/context/summary/{project_name}:
get:
summary: Get project context summary (with README preview)
description: |
Retrieves AI-ready context summary for a project, including:
- Project description and tech stack
- Recent focus areas
- README preview (first 500 characters)
- Confidence score
✅ TASK 8.9.1: Exposes Task 8.9 context functionality
operationId: getSummaryContext
parameters:
- name: project_name
in: path
required: true
schema:
type: string
description: Name of the project
example: "Project_test_2"
responses:
"200":
description: Context summary with README preview
content:
application/json:
schema:
type: object
properties:
project_name:
type: string
description:
type: string
tech_stack:
type: array
items:
type: string
recent_focus:
type: string
readme_preview:
type: string
description: First 500 characters of README
confidence:
type: number
cached:
type: boolean
/api/v1/context/detailed/{project_name}:
get:
summary: Get detailed project context (with full README content)
description: |
Retrieves detailed AI context for a project, including:
- Full project description
- Tech stack and keywords
- Activity summary (total actions, common operations, error patterns)
- README content (up to 2000 characters)
- AI-generated suggestions
✅ TASK 8.9.1: Exposes Task 8.9 context functionality
operationId: getDetailedContext
parameters:
- name: project_name
in: path
required: true
schema:
type: string
description: Name of the project
example: "Project_test_2"
responses:
"200":
description: Detailed context with README content
content:
application/json:
schema:
type: object
properties:
project_name:
type: string
description:
type: string
tech_stack:
type: array
items:
type: string
keywords:
type: array
items:
type: string
activity:
type: object
properties:
total_actions:
type: integer
recent_focus:
type: string
common_operations:
type: array
items:
type: string
error_patterns:
type: array
items:
type: string
readme_content:
type: string
description: Up to 2000 characters of README
confidence:
type: number
suggestions:
type: array
items:
type: string
cached:
type: boolean
/api/v1/context/llm/{project_name}:
get:
summary: Get LLM-optimized context (README prepended to context_string)
description: |
Retrieves LLM-optimized context for a project, designed for LLM selector and Aider prompts.
Key feature: README is prepended at the top of context_string for maximum visibility.
Returns:
- context_string (README + project description + tech stack + recent focus + error patterns)
- Separate readme_content field (up to 2000 characters)
- Tech stack, description, recent focus, error patterns
- AI-generated suggestions
✅ TASK 8.9.1: Exposes Task 8.9 context functionality
operationId: getLLMContext
parameters:
- name: project_name
in: path
required: true
schema:
type: string
description: Name of the project
example: "Project_test_2"
responses:
"200":
description: LLM-optimized context with README in context_string
content:
application/json:
schema:
type: object
properties:
project_name:
type: string
context_string:
type: string
description: README prepended + project data (for LLM consumption)
tech_stack:
type: array
items:
type: string
description:
type: string
recent_focus:
type: string
error_patterns:
type: array