interaqt 0.7.4 → 0.8.1
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/agent/.claude/agents/bug-fix-handler.md +242 -0
- package/agent/.claude/agents/code-generation-handler.md +235 -86
- package/agent/.claude/agents/computation-generation-handler.md +236 -47
- package/agent/.claude/agents/error-check-handler.md +1251 -0
- package/agent/.claude/agents/frontend-generation-handler.md +397 -0
- package/agent/.claude/agents/implement-design-handler.md +76 -15
- package/agent/.claude/agents/implement-integration-handler.md +1689 -0
- package/agent/.claude/agents/permission-generation-handler.md +22 -11
- package/agent/.claude/agents/requirements-analysis-handler.md +812 -82
- package/agent/.claude/settings.local.json +36 -1
- package/agent/CLAUDE.md +53 -13
- package/agent/agentspace/knowledge/generator/computation-analysis.md +105 -21
- package/agent/agentspace/knowledge/generator/data-analysis.md +211 -17
- package/agent/agentspace/prompt/integration_sub_agent_refactor.md +19 -0
- package/dist/index.js +345 -399
- package/dist/index.js.map +1 -1
- package/dist/shared/Data.d.ts +30 -57
- package/dist/shared/Data.d.ts.map +1 -1
- package/dist/shared/Interaction.d.ts +6 -6
- package/dist/shared/Interaction.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -45,16 +45,61 @@ Concepts extracted from goals and requirements. Supported data types:
|
|
|
45
45
|
- View: Entity sorting, grouping, pagination results
|
|
46
46
|
- Aggregated Value: Results of aggregate calculations
|
|
47
47
|
|
|
48
|
+
**Entity-Relation Design Principles:**
|
|
49
|
+
- **Entities MUST NOT contain foreign key properties** (e.g., no `userId`, `bookId`, `dormitoryId`)
|
|
50
|
+
- **Relations are the ONLY way to connect entities** - they replace traditional foreign key patterns
|
|
51
|
+
- Entity properties should only contain intrinsic attributes of that entity
|
|
52
|
+
- Example: Use `BookAuthorRelation` connecting Book and Author, NOT `authorId` property on Book
|
|
53
|
+
|
|
48
54
|
## Rules/Constraints
|
|
49
55
|
Constraints expressed on roles, interactions, and data in requirements.
|
|
50
56
|
|
|
57
|
+
## External System Boundary
|
|
58
|
+
|
|
59
|
+
**⚠️ CRITICAL: Distinguish between user requirements and external system events.**
|
|
60
|
+
|
|
61
|
+
**User Requirements (analyze as requirements):**
|
|
62
|
+
- Operations initiated by human users within current system
|
|
63
|
+
- Data that users need to read/create/update/delete
|
|
64
|
+
- Role should be user roles (e.g., "User", "Administrator")
|
|
65
|
+
|
|
66
|
+
**External System Events (NOT requirements):**
|
|
67
|
+
- Webhook callbacks from external services
|
|
68
|
+
- External system state changes that need to be synced
|
|
69
|
+
- System-to-system data synchronization
|
|
70
|
+
- Handle via external event entities in Task 1.4, document in Task 1.3
|
|
71
|
+
|
|
72
|
+
**Interactions vs Integrations:**
|
|
73
|
+
- **Interactions**: User actions within current system (role = user roles like "Reader", "Administrator")
|
|
74
|
+
- **Integrations**: External system communications (documented in Task 1.3 integration.json)
|
|
75
|
+
- ❌ NEVER use "System" as role in interactions
|
|
76
|
+
- ❌ NEVER create interactions for external API calls or webhooks
|
|
77
|
+
|
|
78
|
+
**Examples:**
|
|
79
|
+
- ✅ User reads data → Create read requirement & interaction
|
|
80
|
+
- ✅ User initiates payment → Create write requirement & interaction
|
|
81
|
+
- ❌ Update data from webhook → External event entity (Task 1.4), NOT requirement
|
|
82
|
+
- ❌ Call external API → Integration (Task 1.3), NOT interaction
|
|
83
|
+
|
|
51
84
|
# Task 1: Requirements Analysis
|
|
52
85
|
|
|
53
|
-
**📖 START:
|
|
86
|
+
**📖 START: Determine current module and check progress before proceeding.**
|
|
87
|
+
|
|
88
|
+
**🔴 STEP 0: Determine Current Module**
|
|
89
|
+
1. Read module name from `.currentmodule` file in project root
|
|
90
|
+
2. If file doesn't exist, STOP and ask user which module to work on
|
|
91
|
+
3. Use this module name for all subsequent file operations
|
|
92
|
+
|
|
93
|
+
**🔴 CRITICAL: Module-Based File Naming**
|
|
94
|
+
- All output files MUST be prefixed with current module name from `.currentmodule`
|
|
95
|
+
- Format: `{module}.{filename}` (e.g., if module is "user", output `requirements/user.goals-analysis.json`)
|
|
96
|
+
- All input file references MUST also use module prefix when reading previous outputs
|
|
97
|
+
- Module status file location: `docs/{module}.status.json`
|
|
54
98
|
|
|
55
|
-
**🔄 Update `docs/
|
|
99
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
56
100
|
```json
|
|
57
101
|
{
|
|
102
|
+
"module": "<keep existing value>",
|
|
58
103
|
"currentTask": "Task 1",
|
|
59
104
|
"completed": false
|
|
60
105
|
}
|
|
@@ -62,9 +107,10 @@ Constraints expressed on roles, interactions, and data in requirements.
|
|
|
62
107
|
|
|
63
108
|
## Task 1.1: Goal Analysis and Refinement
|
|
64
109
|
|
|
65
|
-
**🔄 Update `docs/
|
|
110
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
66
111
|
```json
|
|
67
112
|
{
|
|
113
|
+
"module": "<keep existing value>",
|
|
68
114
|
"currentTask": "Task 1.1",
|
|
69
115
|
"completed": false
|
|
70
116
|
}
|
|
@@ -101,9 +147,9 @@ User input may contain:
|
|
|
101
147
|
|
|
102
148
|
3. **Assign Goal IDs**: Each goal must have a unique identifier (G001, G002, etc.)
|
|
103
149
|
|
|
104
|
-
### Output: goals-analysis.json
|
|
150
|
+
### Output: {module}.goals-analysis.json
|
|
105
151
|
|
|
106
|
-
Create `requirements/goals-analysis.json
|
|
152
|
+
Create `requirements/{module}.goals-analysis.json` (replace `{module}` with actual module name from `.currentmodule`):
|
|
107
153
|
|
|
108
154
|
```json
|
|
109
155
|
{
|
|
@@ -146,9 +192,10 @@ Create `requirements/goals-analysis.json`:
|
|
|
146
192
|
}
|
|
147
193
|
```
|
|
148
194
|
|
|
149
|
-
**✅ END Task 1.1: Update `docs/
|
|
195
|
+
**✅ END Task 1.1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
150
196
|
```json
|
|
151
197
|
{
|
|
198
|
+
"module": "<keep existing value>",
|
|
152
199
|
"currentTask": "Task 1.1",
|
|
153
200
|
"completed": true
|
|
154
201
|
}
|
|
@@ -162,9 +209,10 @@ git commit -m "feat: Task 1.1 - Complete goal analysis and refinement"
|
|
|
162
209
|
|
|
163
210
|
## Task 1.2: Functional Requirements Analysis
|
|
164
211
|
|
|
165
|
-
**🔄 Update `docs/
|
|
212
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
166
213
|
```json
|
|
167
214
|
{
|
|
215
|
+
"module": "<keep existing value>",
|
|
168
216
|
"currentTask": "Task 1.2",
|
|
169
217
|
"completed": false
|
|
170
218
|
}
|
|
@@ -174,6 +222,8 @@ git commit -m "feat: Task 1.1 - Complete goal analysis and refinement"
|
|
|
174
222
|
|
|
175
223
|
We focus on data-centric requirements. Human software usage delegates unsuitable tasks (storage, computation) to support better decision-making. Since decisions require information, we start with **READ requirements** as the root.
|
|
176
224
|
|
|
225
|
+
**Note:** See "External System Boundary" in Core Concepts for distinguishing user requirements from external system events.
|
|
226
|
+
|
|
177
227
|
### ⚠️ CRITICAL: Reactive Framework Principles
|
|
178
228
|
|
|
179
229
|
**DO NOT create "automatic system" requirements.** Our framework is reactive - avoid designing autonomous system behaviors.
|
|
@@ -196,10 +246,6 @@ We focus on data-centric requirements. Human software usage delegates unsuitable
|
|
|
196
246
|
- ❌ WRONG: "Replace old data with new data"
|
|
197
247
|
- ✅ CORRECT: "Create new data + Delete old data" (as two separate operations)
|
|
198
248
|
|
|
199
|
-
**For unavoidable side-effect requirements** (e.g., "automatically send notification"):
|
|
200
|
-
- Design the requirement but explicitly mark as **"Currently Not Supported"**
|
|
201
|
-
- Document: "This requirement involves automatic side-effects which are not supported by the current reactive framework"
|
|
202
|
-
|
|
203
249
|
**Examples of Proper Transformation:**
|
|
204
250
|
- "Auto-calculate late fees" → "Late fee amount is computed based on overdue days and daily rate"
|
|
205
251
|
- "Auto-send reminders" → "Reminder needed status is computed based on due date" + "Send reminder interaction"
|
|
@@ -207,6 +253,28 @@ We focus on data-centric requirements. Human software usage delegates unsuitable
|
|
|
207
253
|
- "Auto-update inventory" → "Available count is computed based on total copies minus borrowed copies"
|
|
208
254
|
- "Replace employee profile" → "Create new employee profile" + "Delete old employee profile" (two interactions)
|
|
209
255
|
|
|
256
|
+
**For unavoidable side-effect requirements** (e.g., "automatically send notification"):
|
|
257
|
+
- Design the requirement but explicitly mark as **"Requires External Integration Support"**
|
|
258
|
+
- Document: "This requirement involves automatic side-effects which require external integration support"
|
|
259
|
+
|
|
260
|
+
### External Integration Requirements
|
|
261
|
+
|
|
262
|
+
**Framework Limitations:**
|
|
263
|
+
- Current framework only expresses business logic representable in relational databases
|
|
264
|
+
- External side-effects requiring third-party APIs must be identified separately
|
|
265
|
+
|
|
266
|
+
**External integrations include:**
|
|
267
|
+
- Payment processing (e.g., connecting to payment gateways)
|
|
268
|
+
- AI/ML services (e.g., image generation, text analysis)
|
|
269
|
+
- File storage services (e.g., cloud storage uploads)
|
|
270
|
+
- Email/SMS notifications via external providers
|
|
271
|
+
- Third-party API integrations
|
|
272
|
+
|
|
273
|
+
**Documentation Process:**
|
|
274
|
+
- Identify these requirements during analysis
|
|
275
|
+
- Document in `requirements/{module}.integration.json`
|
|
276
|
+
- Will be implemented by other agents or engineers
|
|
277
|
+
|
|
210
278
|
### Step 1: Create Read Requirements from Goals
|
|
211
279
|
|
|
212
280
|
Read requirements express:
|
|
@@ -216,6 +284,24 @@ Read requirements express:
|
|
|
216
284
|
- **Goal**: Direct service goal (derived requirements may not have goals)
|
|
217
285
|
- **Parent Requirement**: Which requirement this derives from (root read requirements don't have parents)
|
|
218
286
|
|
|
287
|
+
**⚠️ IMPORTANT: AI Generation Requirements as Read Operations**
|
|
288
|
+
|
|
289
|
+
When users need AI-generated content (TTS, image generation, video generation, text generation, etc.), treat these as **READ requirements first**.
|
|
290
|
+
|
|
291
|
+
**Conceptual Model:**
|
|
292
|
+
- AI generation is "reading" content produced by an AI model based on input parameters
|
|
293
|
+
- The generation process itself is an external integration (documented in Task 1.3)
|
|
294
|
+
- The requirement expresses what data the user wants to "read/retrieve"
|
|
295
|
+
|
|
296
|
+
**Examples:**
|
|
297
|
+
- "Read AI-generated image based on text description"
|
|
298
|
+
- "Read TTS audio based on text content"
|
|
299
|
+
|
|
300
|
+
**Pattern:**
|
|
301
|
+
```
|
|
302
|
+
Read [AI-generated content type] based on [input parameters]
|
|
303
|
+
```
|
|
304
|
+
|
|
219
305
|
### Step 2: Derive Create/Update/Delete Requirements
|
|
220
306
|
|
|
221
307
|
From read requirements, derive:
|
|
@@ -223,6 +309,108 @@ From read requirements, derive:
|
|
|
223
309
|
- **Update**: Based on business scenario (some data may be immutable)
|
|
224
310
|
- **Delete**: Based on business scenario (some systems forbid deletion)
|
|
225
311
|
|
|
312
|
+
**⚠️ IMPORTANT: AI-Generated Content as Computed Data**
|
|
313
|
+
|
|
314
|
+
Data generated by external AI services should be treated as **computed results**, similar to aggregated values or derived properties.
|
|
315
|
+
|
|
316
|
+
**Key Principles:**
|
|
317
|
+
- AI-generated content is typically **immutable** - cannot be directly modified
|
|
318
|
+
- Do NOT derive standalone update requirements for AI-generated content
|
|
319
|
+
- Do NOT derive standalone delete requirements for AI-generated content
|
|
320
|
+
- Any updates/deletes should be **cascading operations** tied to source data changes
|
|
321
|
+
|
|
322
|
+
**Examples:**
|
|
323
|
+
|
|
324
|
+
✅ **CORRECT - No standalone update/delete:**
|
|
325
|
+
```
|
|
326
|
+
R001 (read): "Read TTS audio based on article content"
|
|
327
|
+
R101 (create): "Create article with text content"
|
|
328
|
+
// AI-generated audio is computed from article.content
|
|
329
|
+
// ❌ Do NOT create: "Update TTS audio"
|
|
330
|
+
// ✅ If article.content updates → audio regenerates automatically (computed)
|
|
331
|
+
// ✅ If article deletes → audio deletes cascadingly (not standalone operation)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
✅ **CORRECT - Cascading delete only:**
|
|
335
|
+
```
|
|
336
|
+
R001 (read): "Read AI-generated image based on prompt"
|
|
337
|
+
R101 (create): "Create image generation request with prompt"
|
|
338
|
+
R103 (delete): "Delete image generation request"
|
|
339
|
+
// Deleting the request cascades to delete the generated image
|
|
340
|
+
// NOT a separate "Delete AI-generated image" requirement
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
❌ **WRONG - Standalone operations:**
|
|
344
|
+
```
|
|
345
|
+
R001 (read): "Read AI-generated video"
|
|
346
|
+
R102 (update): "Update AI-generated video" // ❌ Cannot edit AI output directly
|
|
347
|
+
R103 (delete): "Delete AI-generated video" // ❌ Should be cascading, not standalone
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**🔴 CRITICAL: Minimal Derivation Principle**
|
|
351
|
+
|
|
352
|
+
**Only derive operations explicitly needed by user's business requirements:**
|
|
353
|
+
- ❌ NEVER derive operations "for completeness" or "just in case"
|
|
354
|
+
- ❌ NEVER automatically add Administrator role for operations
|
|
355
|
+
- ✅ Only derive what user explicitly mentioned or clearly implied
|
|
356
|
+
|
|
357
|
+
**When deriving UPDATE requirements:**
|
|
358
|
+
- ✅ Derive if user explicitly mentioned modification
|
|
359
|
+
- ❌ DO NOT derive if property changes indirectly (e.g., balance = sum of transactions)
|
|
360
|
+
- ❌ DO NOT derive "admin adjustment" unless user mentioned it
|
|
361
|
+
|
|
362
|
+
**When introducing new ROLES:**
|
|
363
|
+
- ✅ Only use roles user explicitly mentioned
|
|
364
|
+
- ❌ NEVER assume operations "should be admin-only"
|
|
365
|
+
- ❌ NEVER add Administrator role without user request
|
|
366
|
+
|
|
367
|
+
**Examples:**
|
|
368
|
+
|
|
369
|
+
❌ **WRONG - Over-derivation:**
|
|
370
|
+
```json
|
|
371
|
+
{
|
|
372
|
+
"id": "R001",
|
|
373
|
+
"type": "read",
|
|
374
|
+
"title": "View gift balance"
|
|
375
|
+
}
|
|
376
|
+
// Deriving:
|
|
377
|
+
{
|
|
378
|
+
"id": "R102",
|
|
379
|
+
"type": "update",
|
|
380
|
+
"title": "Adjust balance (Administrator)", // ❌ User never mentioned!
|
|
381
|
+
"role": "Administrator" // ❌ Role introduced without user input!
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
✅ **CORRECT - User-driven derivation:**
|
|
386
|
+
```json
|
|
387
|
+
{
|
|
388
|
+
"id": "R001",
|
|
389
|
+
"type": "read",
|
|
390
|
+
"title": "View gift balance"
|
|
391
|
+
}
|
|
392
|
+
// Deriving:
|
|
393
|
+
{
|
|
394
|
+
"id": "R101",
|
|
395
|
+
"type": "create",
|
|
396
|
+
"title": "Recharge balance", // ✅ User mentioned "recharge"
|
|
397
|
+
"role": "User" // ✅ User role from context
|
|
398
|
+
}
|
|
399
|
+
// Balance changes through recharge/donation creates, no direct update needed
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Computed/Derived Properties:**
|
|
403
|
+
|
|
404
|
+
Some properties change indirectly through other operations:
|
|
405
|
+
- Balance properties (sum of transactions)
|
|
406
|
+
- Count properties (count of related entities)
|
|
407
|
+
- Status properties (derived from state)
|
|
408
|
+
|
|
409
|
+
For these:
|
|
410
|
+
- ❌ DO NOT create direct update requirements
|
|
411
|
+
- ✅ They change through create/delete of related entities
|
|
412
|
+
- Document as computed in Task 1.4
|
|
413
|
+
|
|
226
414
|
Expression format:
|
|
227
415
|
- **Parent Requirement**: Derivation source
|
|
228
416
|
- **Role**: Actor performing the action
|
|
@@ -237,13 +425,9 @@ Continue deriving read requirements from write requirements:
|
|
|
237
425
|
- Example: Before modifying book inventory, need to read current inventory for verification
|
|
238
426
|
- This creates "Get book inventory count" read requirement
|
|
239
427
|
|
|
240
|
-
###
|
|
241
|
-
|
|
242
|
-
Integrate requirements extracted in Task 1.1 into this analysis.
|
|
428
|
+
### Output: {module}.requirements-analysis.json
|
|
243
429
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
Create `requirements/requirements-analysis.json`:
|
|
430
|
+
Create `requirements/{module}.requirements-analysis.json` (replace `{module}` with actual module name from `.currentmodule`):
|
|
247
431
|
|
|
248
432
|
```json
|
|
249
433
|
{
|
|
@@ -334,9 +518,10 @@ Create `requirements/requirements-analysis.json`:
|
|
|
334
518
|
}
|
|
335
519
|
```
|
|
336
520
|
|
|
337
|
-
**✅ END Task 1.2: Update `docs/
|
|
521
|
+
**✅ END Task 1.2: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
338
522
|
```json
|
|
339
523
|
{
|
|
524
|
+
"module": "<keep existing value>",
|
|
340
525
|
"currentTask": "Task 1.2",
|
|
341
526
|
"completed": true
|
|
342
527
|
}
|
|
@@ -348,35 +533,324 @@ git add .
|
|
|
348
533
|
git commit -m "feat: Task 1.2 - Complete functional requirements analysis"
|
|
349
534
|
```
|
|
350
535
|
|
|
351
|
-
## Task 1.3:
|
|
536
|
+
## Task 1.3: External Integration Analysis
|
|
352
537
|
|
|
353
|
-
**🔄 Update `docs/
|
|
538
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
354
539
|
```json
|
|
355
540
|
{
|
|
541
|
+
"module": "<keep existing value>",
|
|
356
542
|
"currentTask": "Task 1.3",
|
|
357
543
|
"completed": false
|
|
358
544
|
}
|
|
359
545
|
```
|
|
360
546
|
|
|
547
|
+
### Framework Limitations
|
|
548
|
+
|
|
549
|
+
**Current framework capabilities:**
|
|
550
|
+
- Expresses business logic representable in relational databases
|
|
551
|
+
- Supports reactive data computations and constraints
|
|
552
|
+
- Handles CRUD operations with complex business rules
|
|
553
|
+
|
|
554
|
+
**External side-effects requiring third-party APIs must be identified separately.**
|
|
555
|
+
|
|
556
|
+
### What is NOT an Integration
|
|
557
|
+
|
|
558
|
+
**⚠️ CRITICAL: Intra-Project Module Access**
|
|
559
|
+
|
|
560
|
+
**DO NOT treat inter-module data access within the same project as integration:**
|
|
561
|
+
- Data access between modules in the same project is handled through the framework's entity and relation system
|
|
562
|
+
- Modules can directly reference and use entities/relations defined in other modules
|
|
563
|
+
- Example: If the "payment" module needs to access "User" entity defined in the "basic" module, this is NOT an integration - it's normal module dependency
|
|
564
|
+
- Cross-module data access should be documented in the data concepts (Task 1.4) and interaction design (Task 1.5), NOT in integration analysis
|
|
565
|
+
|
|
566
|
+
**ONLY treat as integration when:**
|
|
567
|
+
- The external system is completely independent (different codebase, different deployment)
|
|
568
|
+
- Communication requires network calls (HTTP/HTTPS, WebSocket, gRPC, etc.)
|
|
569
|
+
- The external system has its own API/interface that we must call
|
|
570
|
+
- The external system is managed by third parties or different teams
|
|
571
|
+
|
|
572
|
+
**Examples:**
|
|
573
|
+
- ✅ INTEGRATION: Calling Stripe API for payment processing
|
|
574
|
+
- ✅ INTEGRATION: Using AWS S3 for file storage
|
|
575
|
+
- ✅ INTEGRATION: Connecting to external AI service for content generation
|
|
576
|
+
- ❌ NOT INTEGRATION: "payment" module reading "User" entity from "basic" module
|
|
577
|
+
- ❌ NOT INTEGRATION: "content" module using "UserProfile" relation from "user" module
|
|
578
|
+
- ❌ NOT INTEGRATION: "order" module computing values based on "Product" entity from "catalog" module
|
|
579
|
+
|
|
580
|
+
### Types of External Integrations
|
|
581
|
+
|
|
582
|
+
**⚠️ CRITICAL: Integration Type Classification**
|
|
583
|
+
|
|
584
|
+
Every integration must be classified into one of three types:
|
|
585
|
+
|
|
586
|
+
1. **Type 1: API Call for Return Value** (`api-call-with-return`)
|
|
587
|
+
- Purpose: Call external API to get a specific result that will be used by business logic
|
|
588
|
+
- Examples: TTS (text-to-speech), AI image generation, AI video generation
|
|
589
|
+
- Characteristics:
|
|
590
|
+
- System needs the return value for business data
|
|
591
|
+
- Business entities depend on the API result
|
|
592
|
+
- Return value must be stored and referenced
|
|
593
|
+
|
|
594
|
+
2. **Type 2: Side Effect Execution** (`side-effect`)
|
|
595
|
+
- Purpose: Execute an external action without needing a return value
|
|
596
|
+
- Examples: Send email, send IM message, send push notification
|
|
597
|
+
- Characteristics:
|
|
598
|
+
- System doesn't need the return value
|
|
599
|
+
- Action completion is sufficient
|
|
600
|
+
- May track status but not content
|
|
601
|
+
|
|
602
|
+
3. **Type 3: Stateful System Integration** (`stateful-system`)
|
|
603
|
+
- Purpose: Integrate with external systems that maintain their own state
|
|
604
|
+
- Examples: Payment systems (Stripe, Alipay, PayPal), third-party order systems
|
|
605
|
+
- Characteristics:
|
|
606
|
+
- External system has its own state machine
|
|
607
|
+
- Need to sync state bidirectionally
|
|
608
|
+
- May involve multiple state transitions
|
|
609
|
+
- Often involves webhooks for state updates
|
|
610
|
+
|
|
611
|
+
**Additional integration examples:**
|
|
612
|
+
- **AI/ML services**: Image generation, text analysis, recommendation engines (Type 1)
|
|
613
|
+
- **File storage services**: Cloud storage uploads (S3, OSS, etc.) (Type 1)
|
|
614
|
+
- **Communication services**: Email/SMS notifications via external providers (Type 2)
|
|
615
|
+
- **Third-party APIs**: Classify based on purpose (Type 1, 2, or 3)
|
|
616
|
+
|
|
617
|
+
### Analysis Process
|
|
618
|
+
|
|
619
|
+
1. **Review requirements** from Task 1.2 to identify external integration needs
|
|
620
|
+
2. **For each external integration**:
|
|
621
|
+
- Describe the interaction flow between current system and external system
|
|
622
|
+
- Clearly mark system boundaries (what happens where)
|
|
623
|
+
- Document data flow and transformations
|
|
624
|
+
- Specify error handling strategies
|
|
625
|
+
|
|
626
|
+
### Content Requirements
|
|
627
|
+
|
|
628
|
+
1. **Interaction Flow**: Describe simple, clear interaction flows with external systems
|
|
629
|
+
2. **System Boundaries**: Clearly mark:
|
|
630
|
+
- Which data resides in the current system
|
|
631
|
+
- Which user interactions occur in the current system
|
|
632
|
+
- Which actions/data belong to external systems
|
|
633
|
+
3. **Structured Format**: Use the JSON template below
|
|
634
|
+
|
|
635
|
+
**🔴 CRITICAL: Integration Type Classification**
|
|
636
|
+
|
|
637
|
+
For EVERY integration, you MUST:
|
|
638
|
+
1. **Determine the type** using the classification from the "Types of External Integrations" section above
|
|
639
|
+
2. **Fill the `type` field** with one of: `api-call-with-return`, `side-effect`, or `stateful-system`
|
|
640
|
+
3. **Explain your choice** in the `type_explanation` field
|
|
641
|
+
4. This type field is CRITICAL for the next phase (data design) to create proper API Call entities
|
|
642
|
+
|
|
643
|
+
### Output: {module}.integration.json
|
|
644
|
+
|
|
645
|
+
Create `requirements/{module}.integration.json` (replace `{module}` with actual module name from `.currentmodule`):
|
|
646
|
+
|
|
647
|
+
```json
|
|
648
|
+
{
|
|
649
|
+
"integration_metadata": {
|
|
650
|
+
"timestamp": "YYYY-MM-DD HH:mm:ss",
|
|
651
|
+
"module": "{module}",
|
|
652
|
+
"version": "1.0.0"
|
|
653
|
+
},
|
|
654
|
+
"integrations": [
|
|
655
|
+
{
|
|
656
|
+
"id": "INT001",
|
|
657
|
+
"name": "[Integration name, e.g., PaymentProcessing]",
|
|
658
|
+
"type": "api-call-with-return|side-effect|stateful-system",
|
|
659
|
+
"type_explanation": "[REQUIRED: Explain why this specific type was chosen. Type 1 (api-call-with-return): System needs the return value for business data. Type 2 (side-effect): Execute action without needing return value. Type 3 (stateful-system): External system maintains state that needs bidirectional sync.]",
|
|
660
|
+
"external_system": "[External system name, e.g., Stripe, Alipay]",
|
|
661
|
+
"purpose": "[Brief description of why this integration is needed]",
|
|
662
|
+
"related_requirements": ["R101", "R102"],
|
|
663
|
+
"flow_description": "[Natural language description of the complete interaction flow between current system and external system. Describe what happens step by step, clearly marking which actions occur in current system vs external system.]",
|
|
664
|
+
"user_interactions": {
|
|
665
|
+
"in_current_system": [
|
|
666
|
+
"[User action that happens in current system, e.g., 'User clicks purchase button', 'User fills out payment form']"
|
|
667
|
+
],
|
|
668
|
+
"in_external_system": [
|
|
669
|
+
"[User action that happens in external system, e.g., 'User authenticates in payment gateway', 'User confirms payment in third-party app']"
|
|
670
|
+
]
|
|
671
|
+
},
|
|
672
|
+
"current_system_data": [
|
|
673
|
+
{
|
|
674
|
+
"entity": "EntityName",
|
|
675
|
+
"properties": ["property1", "property2"],
|
|
676
|
+
"usage": "[How this data is used: e.g., 'Read before sending to external system', 'Updated after receiving response']"
|
|
677
|
+
}
|
|
678
|
+
],
|
|
679
|
+
"notes": "[Additional notes about this integration]"
|
|
680
|
+
}
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
### Example: Payment Processing Integration
|
|
686
|
+
|
|
687
|
+
```json
|
|
688
|
+
{
|
|
689
|
+
"integration_metadata": {
|
|
690
|
+
"timestamp": "2024-01-15 10:30:00",
|
|
691
|
+
"module": "payment",
|
|
692
|
+
"version": "1.0.0"
|
|
693
|
+
},
|
|
694
|
+
"integrations": [
|
|
695
|
+
{
|
|
696
|
+
"id": "INT001",
|
|
697
|
+
"name": "PaymentProcessing",
|
|
698
|
+
"type": "stateful-system",
|
|
699
|
+
"external_system": "Stripe",
|
|
700
|
+
"purpose": "Process user payments for premium features",
|
|
701
|
+
"related_requirements": ["R105"],
|
|
702
|
+
"flow_description": "User clicks 'Purchase Premium' button in current system. System reads User.id and Product.price, creates PaymentIntent with status='pending', then sends payment request (amount, currency, payment_method) to Stripe. Stripe processes the payment externally (validates payment method, checks for fraud, processes transaction). After processing, Stripe returns payment result (payment_status, transaction_id) to current system. Current system receives the response and updates PaymentIntent.status, Order.paymentStatus, and User.premiumUntil accordingly. If payment fails, system sets PaymentIntent.status to 'failed' and notifies user to retry.",
|
|
703
|
+
"user_interactions": {
|
|
704
|
+
"in_current_system": [
|
|
705
|
+
"User clicks 'Purchase Premium' button to initiate payment",
|
|
706
|
+
"User selects product and views pricing information",
|
|
707
|
+
"User receives payment result notification (success or failure)"
|
|
708
|
+
],
|
|
709
|
+
"in_external_system": [
|
|
710
|
+
"User enters payment card details in Stripe hosted page",
|
|
711
|
+
"User completes two-factor authentication in their bank app",
|
|
712
|
+
"User confirms the payment in Stripe interface"
|
|
713
|
+
]
|
|
714
|
+
},
|
|
715
|
+
"current_system_data": [
|
|
716
|
+
{
|
|
717
|
+
"entity": "PaymentIntent",
|
|
718
|
+
"properties": ["status", "amount", "transactionId"],
|
|
719
|
+
"usage": "Created with status='pending' before sending request to Stripe. Updated with final status and transactionId after receiving Stripe response."
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"entity": "Order",
|
|
723
|
+
"properties": ["paymentStatus", "totalAmount"],
|
|
724
|
+
"usage": "Updated with payment status after receiving confirmation from Stripe."
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"entity": "User",
|
|
728
|
+
"properties": ["id", "premiumUntil"],
|
|
729
|
+
"usage": "User.id read to identify the purchaser. User.premiumUntil updated after successful payment."
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"entity": "Product",
|
|
733
|
+
"properties": ["price"],
|
|
734
|
+
"usage": "Read to determine payment amount before sending to Stripe."
|
|
735
|
+
}
|
|
736
|
+
],
|
|
737
|
+
"notes": "Stripe webhook integration needed for handling delayed status updates and payment confirmations."
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
}
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
**✅ END Task 1.3: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
744
|
+
```json
|
|
745
|
+
{
|
|
746
|
+
"module": "<keep existing value>",
|
|
747
|
+
"currentTask": "Task 1.3",
|
|
748
|
+
"completed": true
|
|
749
|
+
}
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**📝 Commit changes:**
|
|
753
|
+
```bash
|
|
754
|
+
git add .
|
|
755
|
+
git commit -m "feat: Task 1.3 - Complete external integration analysis"
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
## Task 1.4: Data Concept Extraction
|
|
759
|
+
|
|
760
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
761
|
+
```json
|
|
762
|
+
{
|
|
763
|
+
"module": "<keep existing value>",
|
|
764
|
+
"currentTask": "Task 1.4",
|
|
765
|
+
"completed": false
|
|
766
|
+
}
|
|
767
|
+
```
|
|
768
|
+
|
|
361
769
|
### Extraction Process
|
|
362
770
|
|
|
363
771
|
Extract all necessary data concepts from requirements using supported data types.
|
|
364
772
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
773
|
+
**Note:** See "Entity-Relation Design Principles" in Core Concepts for entity design rules.
|
|
774
|
+
|
|
775
|
+
**🔴 CRITICAL: Module Boundary - User Entity Rule**
|
|
776
|
+
|
|
777
|
+
User entity can ONLY be defined in the "basic" module. All other modules MUST NOT define or extend User entity.
|
|
778
|
+
|
|
779
|
+
**If current module is NOT "basic" and needs user-related data:**
|
|
780
|
+
1. ❌ NEVER define User entity in your `entities` array
|
|
781
|
+
2. ❌ NEVER add properties to User entity
|
|
782
|
+
3. ✅ CREATE a separate 1:1 entity linked to User via relation
|
|
783
|
+
|
|
784
|
+
**Example:** If "donate" module needs `giftBalance`:
|
|
785
|
+
- ❌ WRONG: Add `giftBalance` property to User entity
|
|
786
|
+
- ✅ CORRECT: Create `UserGiftProfile` entity with `giftBalance`, link via `UserGiftProfileRelation` (1:1)
|
|
787
|
+
|
|
788
|
+
### Step 0: External Integration Entities (if applicable)
|
|
789
|
+
|
|
790
|
+
**⚠️ CRITICAL: Always process integration entities FIRST before business entities**
|
|
791
|
+
|
|
792
|
+
If `requirements/{module}.integration.json` exists and contains integrations:
|
|
793
|
+
|
|
794
|
+
**Why this matters:**
|
|
795
|
+
- External API calls are time-consuming and error-prone
|
|
796
|
+
- Explicit modeling enables retry and error handling interactions
|
|
797
|
+
- Users need visibility into integration status and failures
|
|
798
|
+
|
|
799
|
+
**For EACH integration, create these entities:**
|
|
800
|
+
|
|
801
|
+
1. **API Call Entity** - `{integration}{APIname}Call`
|
|
802
|
+
- Purpose: Track each API call execution (parameters, status, result, timing)
|
|
803
|
+
- Required properties:
|
|
804
|
+
- `status`: string ('pending' | 'processing'|'completed' | 'failed') - Computed from integration events
|
|
805
|
+
- `externalId`: string - External task/job ID returned by the external API - Computed from the 'initialized' event
|
|
806
|
+
- `requestParams`: object (sent to external API)
|
|
807
|
+
- `responseData`: object (returned from external API) - Computed from integration events
|
|
808
|
+
- `createdAt`: timestamp
|
|
809
|
+
- `completedAt`: timestamp (nullable) - Computed from integration events
|
|
810
|
+
- `error`: object (nullable) - Computed from integration events
|
|
811
|
+
- **Statemachine Computation**: The properties `status`, `externalId`, `responseData`, `error`, and `completedAt` are computed based on related integration events using statemachine transitions
|
|
812
|
+
- **🔴 CRITICAL: externalId Computation**:
|
|
813
|
+
- The `externalId` property is computed from the integration event with `eventType: 'initialized'`
|
|
814
|
+
- The framework guarantees that the 'initialized' event contains both `entityId` (matching this API Call's id) and `externalId` (from external system)
|
|
815
|
+
- This establishes the link between the API Call entity and the external system's task/job ID
|
|
816
|
+
- Subsequent events use `externalId` to locate and update the correct API Call record
|
|
817
|
+
- Examples: `VolcTTSCall`, `StripePaymentCall`, `VolcImageGenerationCall`
|
|
818
|
+
|
|
819
|
+
2. **Integration Event Entity** - `{integration}{APIname}Event` (for webhook/callback/initialize)
|
|
820
|
+
- Purpose: Record external system state changes or api call process changes
|
|
821
|
+
- Required properties:
|
|
822
|
+
- `eventType`: string ('initialized' | 'processing' | 'completed' | 'failed')
|
|
823
|
+
- `entityId`: string(nullable) - API Call entity id
|
|
824
|
+
- `externalId`: string - External task/job ID to track which API call this event relates to
|
|
825
|
+
- `status`: string
|
|
826
|
+
- `createdAt`: timestamp
|
|
827
|
+
- `data`: object (event payload)
|
|
828
|
+
- Mark as: `entityType: "api-event"`
|
|
829
|
+
- Examples: `VolcTTSEvent`, `StripePaymentEvent`
|
|
830
|
+
- **🔴 CRITICAL: The 'initialized' Event Type**:
|
|
831
|
+
- The `initialized` event is special: it ALWAYS contains both `entityId` and `externalId`
|
|
832
|
+
- This event associates the API Call entity's `id` with the external system's `externalId`
|
|
833
|
+
- This association enables subsequent events to find the correct API Call record using `externalId`
|
|
834
|
+
|
|
835
|
+
3. **API Call Relation**
|
|
836
|
+
- Connect `{integration}{APIname}Call` to business entity needing the result
|
|
837
|
+
- Examples: `GreetingVolcTTSCallRelation`, `OrderStripePaymentCallRelation`
|
|
838
|
+
- **⚠️ CRITICAL: MUST be 1:n relation** (one business entity to many API calls)
|
|
839
|
+
- Reason: API calls are fragile and may fail, requiring retries
|
|
840
|
+
- Reason: Users may be unsatisfied with results and request regeneration
|
|
841
|
+
- Example: `GreetingVolcTTSCallRelation` should be 1:n (one Greeting has many VolcTTSCall attempts)
|
|
842
|
+
- The business entity uses the LATEST successful API call result
|
|
843
|
+
|
|
844
|
+
**Document in output:** Add these to `entities` and `relations` arrays with clear notes about integration purpose.
|
|
845
|
+
|
|
846
|
+
### Step 1: Business Entity Identification and Analysis
|
|
374
847
|
|
|
375
848
|
Extract nouns as potential entities:
|
|
376
849
|
- Identify main business objects
|
|
377
850
|
- Determine data needing persistence and tracking
|
|
378
851
|
- Identify objects with unique identity and lifecycle
|
|
379
|
-
-
|
|
852
|
+
- CHECK: If you identified "User" with new properties, STOP - create separate 1:1 entity instead
|
|
853
|
+
|
|
380
854
|
|
|
381
855
|
### Step 2: Property Analysis
|
|
382
856
|
|
|
@@ -386,6 +860,14 @@ For each entity property:
|
|
|
386
860
|
- **Computation Method**: For aggregated or computed values
|
|
387
861
|
- **Data Dependencies**: For computed values, list dependencies
|
|
388
862
|
|
|
863
|
+
**Computation Methods**:
|
|
864
|
+
- **aggregation**: Property computed from aggregate calculations (sum, count, etc.)
|
|
865
|
+
- **statemachine**: Property computed from state transitions based on integration events (for API Call entities)
|
|
866
|
+
|
|
867
|
+
**API Call Entity Properties**:
|
|
868
|
+
- For API Call entities, the properties `status`, `externalId`, `responseData`, `error`, and `completedAt` are computed using `statemachine` method
|
|
869
|
+
- These properties transition based on related integration events
|
|
870
|
+
|
|
389
871
|
**Hard Deletion Property**:
|
|
390
872
|
- If delete requirements in Task 1.2 specify `"deletion_type": "hard"`
|
|
391
873
|
- Add **HardDeletionProperty** to the entity/relation
|
|
@@ -393,30 +875,12 @@ For each entity property:
|
|
|
393
875
|
|
|
394
876
|
### Step 3: Relation Identification and Analysis
|
|
395
877
|
|
|
396
|
-
**Relations are the ONLY way to connect entities** - they replace traditional foreign key patterns.
|
|
397
|
-
|
|
398
878
|
From verb phrases in requirements, identify relations with these key attributes:
|
|
399
879
|
- **type**: Cardinality (1:1, 1:n, n:1, n:n)
|
|
400
|
-
- **sourceEntity**: The
|
|
401
|
-
- **
|
|
402
|
-
- **
|
|
403
|
-
- **
|
|
404
|
-
|
|
405
|
-
**Example:**
|
|
406
|
-
```json
|
|
407
|
-
{
|
|
408
|
-
"name": "UserPostRelation",
|
|
409
|
-
"type": "1:n",
|
|
410
|
-
"sourceEntity": "User",
|
|
411
|
-
"targetEntity": "Post",
|
|
412
|
-
"sourceProperty": "posts",
|
|
413
|
-
"targetProperty": "author"
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
Additional analysis:
|
|
418
|
-
- Analyze relation lifecycle (when created/deleted)
|
|
419
|
-
- Identify relation-specific properties (e.g., "joinDate" on MembershipRelation)
|
|
880
|
+
- **sourceEntity/targetEntity**: The connected entities
|
|
881
|
+
- **sourceProperty/targetProperty**: Property names for accessing the relation from each side
|
|
882
|
+
- **properties**: Relation-specific attributes (e.g., "joinDate" on MembershipRelation)
|
|
883
|
+
- **lifecycle**: When the relation is created/deleted
|
|
420
884
|
|
|
421
885
|
### Step 4: Dictionary (Global Data) Identification
|
|
422
886
|
|
|
@@ -425,9 +889,9 @@ Identify system-level data:
|
|
|
425
889
|
- System-level statistics or aggregations
|
|
426
890
|
- Global configurations or settings
|
|
427
891
|
|
|
428
|
-
### Output: data-concepts.json
|
|
892
|
+
### Output: {module}.data-concepts.json
|
|
429
893
|
|
|
430
|
-
Create `requirements/data-concepts.json
|
|
894
|
+
Create `requirements/{module}.data-concepts.json` (replace `{module}` with actual module name from `.currentmodule`):
|
|
431
895
|
|
|
432
896
|
```json
|
|
433
897
|
{
|
|
@@ -451,6 +915,175 @@ Create `requirements/data-concepts.json`:
|
|
|
451
915
|
}
|
|
452
916
|
],
|
|
453
917
|
"entities": [
|
|
918
|
+
{
|
|
919
|
+
"name": "VolcTTSCall",
|
|
920
|
+
"entityType": "api-call",
|
|
921
|
+
"description": "Records Volc TTS API call execution for tracking",
|
|
922
|
+
"properties": [
|
|
923
|
+
{
|
|
924
|
+
"name": "status",
|
|
925
|
+
"type": "string",
|
|
926
|
+
"required": true,
|
|
927
|
+
"computed": true,
|
|
928
|
+
"computation": {
|
|
929
|
+
"method": "statemachine",
|
|
930
|
+
"description": "Computed from VolcTTSEvent transitions: pending → processing → completed/failed",
|
|
931
|
+
"dependencies": ["VolcTTSEvent.status"]
|
|
932
|
+
},
|
|
933
|
+
"description": "pending | processing | completed | failed"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"name": "externalId",
|
|
937
|
+
"type": "string",
|
|
938
|
+
"required": true,
|
|
939
|
+
"computed": true,
|
|
940
|
+
"computation": {
|
|
941
|
+
"method": "statemachine",
|
|
942
|
+
"description": "Extracted from first VolcTTSEvent.externalId",
|
|
943
|
+
"dependencies": ["VolcTTSEvent.externalId"]
|
|
944
|
+
},
|
|
945
|
+
"description": "External task/job ID returned by the Volc TTS API service"
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
"name": "requestParams",
|
|
949
|
+
"type": "object",
|
|
950
|
+
"required": true,
|
|
951
|
+
"computed": false,
|
|
952
|
+
"description": "Text content and voice parameters sent to Volc TTS API"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
"name": "responseData",
|
|
956
|
+
"type": "object",
|
|
957
|
+
"required": false,
|
|
958
|
+
"computed": true,
|
|
959
|
+
"computation": {
|
|
960
|
+
"method": "statemachine",
|
|
961
|
+
"description": "Extracted from VolcTTSEvent.data when status becomes completed",
|
|
962
|
+
"dependencies": ["VolcTTSEvent.data", "VolcTTSEvent.status"]
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
"name": "createdAt",
|
|
967
|
+
"type": "timestamp",
|
|
968
|
+
"required": true,
|
|
969
|
+
"computed": false
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"name": "completedAt",
|
|
973
|
+
"type": "timestamp",
|
|
974
|
+
"required": false,
|
|
975
|
+
"computed": true,
|
|
976
|
+
"computation": {
|
|
977
|
+
"method": "statemachine",
|
|
978
|
+
"description": "Set from VolcTTSEvent.createdAt when status becomes completed or failed",
|
|
979
|
+
"dependencies": ["VolcTTSEvent.createdAt", "VolcTTSEvent.status"]
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"name": "error",
|
|
984
|
+
"type": "object",
|
|
985
|
+
"required": false,
|
|
986
|
+
"computed": true,
|
|
987
|
+
"computation": {
|
|
988
|
+
"method": "statemachine",
|
|
989
|
+
"description": "Extracted from VolcTTSEvent.data when status becomes failed",
|
|
990
|
+
"dependencies": ["VolcTTSEvent.data", "VolcTTSEvent.status"]
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
"referenced_in": ["INT001"],
|
|
995
|
+
"integration_source": "INT001",
|
|
996
|
+
"note": "API Call entity - status and result fields are computed via state machine based on integration events"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"name": "VolcTTSEvent",
|
|
1000
|
+
"entityType": "api-event",
|
|
1001
|
+
"description": "Events from Volc TTS service about generation completion",
|
|
1002
|
+
"properties": [
|
|
1003
|
+
{
|
|
1004
|
+
"name": "eventType",
|
|
1005
|
+
"type": "string",
|
|
1006
|
+
"required": true,
|
|
1007
|
+
"computed": false
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
"name": "externalId",
|
|
1011
|
+
"type": "string",
|
|
1012
|
+
"required": true,
|
|
1013
|
+
"computed": false,
|
|
1014
|
+
"description": "External task/job ID to match with the corresponding VolcTTSCall.externalId"
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
"name": "status",
|
|
1018
|
+
"type": "string",
|
|
1019
|
+
"required": true,
|
|
1020
|
+
"computed": false
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"name": "createdAt",
|
|
1024
|
+
"type": "timestamp",
|
|
1025
|
+
"required": true,
|
|
1026
|
+
"computed": false
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
"name": "data",
|
|
1030
|
+
"type": "object",
|
|
1031
|
+
"required": true,
|
|
1032
|
+
"computed": false,
|
|
1033
|
+
"description": "Event payload including audio URL"
|
|
1034
|
+
}
|
|
1035
|
+
],
|
|
1036
|
+
"referenced_in": ["INT001"],
|
|
1037
|
+
"integration_source": "INT001",
|
|
1038
|
+
"note": "Integration event entity - created by external system, NOT by user interactions"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
"name": "Greeting",
|
|
1042
|
+
"description": "User greeting message with AI-generated voice",
|
|
1043
|
+
"properties": [
|
|
1044
|
+
{
|
|
1045
|
+
"name": "textContent",
|
|
1046
|
+
"type": "string",
|
|
1047
|
+
"required": true,
|
|
1048
|
+
"computed": false,
|
|
1049
|
+
"description": "Original text content of greeting"
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
"name": "voiceUrl",
|
|
1053
|
+
"type": "string",
|
|
1054
|
+
"required": false,
|
|
1055
|
+
"computed": true,
|
|
1056
|
+
"computation": {
|
|
1057
|
+
"method": "integration-result",
|
|
1058
|
+
"description": "AI-generated audio URL extracted from the LATEST successful VolcTTSCall.responseData (status='completed')",
|
|
1059
|
+
"dependencies": ["VolcTTSCall.responseData", "VolcTTSCall.status"]
|
|
1060
|
+
},
|
|
1061
|
+
"note": "Computed from external integration - immutable, uses latest successful API call from 1:n relation"
|
|
1062
|
+
}
|
|
1063
|
+
],
|
|
1064
|
+
"referenced_in": ["R001", "R101"],
|
|
1065
|
+
"note": "Business entity with AI-generated property - voiceUrl cannot be directly updated"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
"name": "UserGiftProfile",
|
|
1069
|
+
"entityType": "user-profile",
|
|
1070
|
+
"description": "User gift balance profile - created automatically when User is created",
|
|
1071
|
+
"properties": [
|
|
1072
|
+
{
|
|
1073
|
+
"name": "giftBalance",
|
|
1074
|
+
"type": "number",
|
|
1075
|
+
"required": true,
|
|
1076
|
+
"computed": true,
|
|
1077
|
+
"computation": {
|
|
1078
|
+
"method": "aggregation",
|
|
1079
|
+
"description": "Sum of all recharges minus sum of all donations",
|
|
1080
|
+
"dependencies": ["RechargeRecord", "Donation"]
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
],
|
|
1084
|
+
"referenced_in": ["R001", "R101", "R102"],
|
|
1085
|
+
"note": "1:1 profile entity - created with User, NOT by interactions"
|
|
1086
|
+
},
|
|
454
1087
|
{
|
|
455
1088
|
"name": "Book",
|
|
456
1089
|
"description": "Library book entity",
|
|
@@ -524,6 +1157,31 @@ Create `requirements/data-concepts.json`:
|
|
|
524
1157
|
}
|
|
525
1158
|
],
|
|
526
1159
|
"relations": [
|
|
1160
|
+
{
|
|
1161
|
+
"name": "GreetingVolcTTSCallRelation",
|
|
1162
|
+
"type": "1:n",
|
|
1163
|
+
"sourceEntity": "Greeting",
|
|
1164
|
+
"targetEntity": "VolcTTSCall",
|
|
1165
|
+
"sourceProperty": "volcTTSCalls",
|
|
1166
|
+
"targetProperty": "greeting",
|
|
1167
|
+
"properties": [],
|
|
1168
|
+
"lifecycle": "Created each time Greeting triggers TTS generation (including retries)",
|
|
1169
|
+
"referenced_in": ["INT001"],
|
|
1170
|
+
"integration_source": "INT001",
|
|
1171
|
+
"note": "1:n relation - one Greeting can have multiple VolcTTSCall attempts due to failures or regeneration requests"
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
"name": "UserProfileRelation",
|
|
1175
|
+
"type": "1:1",
|
|
1176
|
+
"sourceEntity": "User",
|
|
1177
|
+
"targetEntity": "UserProfile",
|
|
1178
|
+
"sourceProperty": "profile",
|
|
1179
|
+
"targetProperty": "user",
|
|
1180
|
+
"properties": [],
|
|
1181
|
+
"lifecycle": "Created automatically when User is created",
|
|
1182
|
+
"referenced_in": ["R001"],
|
|
1183
|
+
"note": "1:1 profile entity - NOT created by interactions"
|
|
1184
|
+
},
|
|
527
1185
|
{
|
|
528
1186
|
"name": "BorrowRecord",
|
|
529
1187
|
"type": "n:n",
|
|
@@ -584,10 +1242,11 @@ Create `requirements/data-concepts.json`:
|
|
|
584
1242
|
}
|
|
585
1243
|
```
|
|
586
1244
|
|
|
587
|
-
**✅ END Task 1.
|
|
1245
|
+
**✅ END Task 1.4: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
588
1246
|
```json
|
|
589
1247
|
{
|
|
590
|
-
"
|
|
1248
|
+
"module": "<keep existing value>",
|
|
1249
|
+
"currentTask": "Task 1.4",
|
|
591
1250
|
"completed": true
|
|
592
1251
|
}
|
|
593
1252
|
```
|
|
@@ -595,26 +1254,91 @@ Create `requirements/data-concepts.json`:
|
|
|
595
1254
|
**📝 Commit changes:**
|
|
596
1255
|
```bash
|
|
597
1256
|
git add .
|
|
598
|
-
git commit -m "feat: Task 1.
|
|
1257
|
+
git commit -m "feat: Task 1.4 - Complete data concept extraction"
|
|
599
1258
|
```
|
|
600
1259
|
|
|
601
|
-
## Task 1.
|
|
1260
|
+
## Task 1.5: Interaction Design
|
|
602
1261
|
|
|
603
|
-
**🔄 Update `docs/
|
|
1262
|
+
**🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
604
1263
|
```json
|
|
605
1264
|
{
|
|
606
|
-
"
|
|
1265
|
+
"module": "<keep existing value>",
|
|
1266
|
+
"currentTask": "Task 1.5",
|
|
607
1267
|
"completed": false
|
|
608
1268
|
}
|
|
609
1269
|
```
|
|
610
1270
|
|
|
611
1271
|
### Design Principles
|
|
612
1272
|
|
|
1273
|
+
**Note:** See "External System Boundary" in Core Concepts for distinguishing interactions from integrations.
|
|
1274
|
+
|
|
1275
|
+
**Key Principles:**
|
|
613
1276
|
- One requirement typically maps to one interaction (sometimes multiple)
|
|
614
1277
|
- Interactions fulfill requirements
|
|
615
|
-
- All data in interactions must reference concepts from Task 1.
|
|
616
|
-
-
|
|
617
|
-
-
|
|
1278
|
+
- All data in interactions must reference concepts from Task 1.4
|
|
1279
|
+
- Inherit all data constraints from requirements
|
|
1280
|
+
- Interaction IDs must be semantic names (e.g., "BorrowBook", "ViewAvailableBooks") not codes (e.g., "I001")
|
|
1281
|
+
- ❌ If a requirement has role="System", it was incorrectly created - SKIP it, do NOT create interaction
|
|
1282
|
+
|
|
1283
|
+
**⚠️ IMPORTANT: External Integration Interactions**
|
|
1284
|
+
|
|
1285
|
+
If Task 1.4 includes API Call entities, design error handling interactions:
|
|
1286
|
+
|
|
1287
|
+
**Required interactions for each `{integration}{APIname}Call` entity:**
|
|
1288
|
+
1. **Retry Interaction** - Allow users to retry failed API calls
|
|
1289
|
+
- Role: Same as original requester
|
|
1290
|
+
- Action: "retry" or "regenerate"
|
|
1291
|
+
- **Creates**: NEW `{integration}{APIname}Call` entity with status='pending'
|
|
1292
|
+
- **NOT updates**: Don't modify failed API call - keep it for audit trail
|
|
1293
|
+
- Condition: Related business entity exists (can retry anytime)
|
|
1294
|
+
- Note: Creates new API call due to 1:n relation design
|
|
1295
|
+
|
|
1296
|
+
2. **View Status Interaction** - Allow users to check API call status
|
|
1297
|
+
- Role: Same as original requester
|
|
1298
|
+
- Action: "viewStatus"
|
|
1299
|
+
- Reads: `{integration}{APIname}Call.status`, `{integration}{APIname}Call.error`, business entity computed result
|
|
1300
|
+
|
|
1301
|
+
**Example:**
|
|
1302
|
+
```json
|
|
1303
|
+
{
|
|
1304
|
+
"id": "RetryVolcTTSGeneration",
|
|
1305
|
+
"fulfills_requirements": ["Error handling for Volc TTS generation"],
|
|
1306
|
+
"type": "create",
|
|
1307
|
+
"specification": {
|
|
1308
|
+
"role": "User",
|
|
1309
|
+
"action": "retry",
|
|
1310
|
+
"conditions": ["Greeting exists"],
|
|
1311
|
+
"payload": {
|
|
1312
|
+
"greetingId": {
|
|
1313
|
+
"type": "string",
|
|
1314
|
+
"description": "ID of the greeting to regenerate TTS for",
|
|
1315
|
+
"required": true
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
"data": {
|
|
1319
|
+
"creates": [{
|
|
1320
|
+
"target": "VolcTTSCall",
|
|
1321
|
+
"description": "Create new VolcTTSCall with same requestParams from Greeting.textContent, status='pending'",
|
|
1322
|
+
"dependencies": ["Greeting.textContent"]
|
|
1323
|
+
}, {
|
|
1324
|
+
"target": "GreetingVolcTTSCallRelation",
|
|
1325
|
+
"description": "Link new VolcTTSCall to existing Greeting",
|
|
1326
|
+
"dependencies": ["Greeting", "VolcTTSCall"]
|
|
1327
|
+
}]
|
|
1328
|
+
},
|
|
1329
|
+
"dataConstraints": ["Keep previous failed VolcTTSCall for audit trail"]
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
**🔴 CRITICAL: 1:1 User Profile Entity Creation**
|
|
1335
|
+
|
|
1336
|
+
**DO NOT create 1:1 user profile entities in interactions:**
|
|
1337
|
+
- ❌ NEVER include 1:1 profile entities in interaction `creates` operations
|
|
1338
|
+
- ❌ Example WRONG: `RechargeGiftBalance` creates `UserGiftProfile`
|
|
1339
|
+
- ✅ CORRECT: Profile entities are created when User is created (documented in Task 1.4)
|
|
1340
|
+
- ✅ Interactions can UPDATE profile entity properties, but NOT CREATE the entity itself
|
|
1341
|
+
- These entities always exist for any User, providing default/initial values
|
|
618
1342
|
|
|
619
1343
|
### Interaction Specification Format
|
|
620
1344
|
|
|
@@ -671,20 +1395,22 @@ The `data` field describes all data operations performed by the interaction:
|
|
|
671
1395
|
- This represents the data the user expects to receive, not dependencies for internal operations
|
|
672
1396
|
|
|
673
1397
|
**Important Notes:**
|
|
674
|
-
- Write operations
|
|
675
|
-
- Read operations
|
|
676
|
-
- All referenced entities/relations must exist in
|
|
1398
|
+
- Write operations use `dependencies` within each operation, NOT a `reads` field
|
|
1399
|
+
- Read operations ONLY have a `reads` field - no creates/updates/deletes
|
|
1400
|
+
- All referenced entities/relations must exist in Task 1.4 data concepts
|
|
1401
|
+
- ⚠️ DO NOT include integration event entities (e.g., `VolcTTSEvent`) in `creates` - they're created by external systems
|
|
1402
|
+
- ⚠️ DO NOT include 1:1 user profile entities in `creates` - they're created with User, NOT by interactions
|
|
677
1403
|
|
|
678
|
-
### Output: interactions-design.json
|
|
1404
|
+
### Output: {module}.interactions-design.json
|
|
679
1405
|
|
|
680
|
-
Create `requirements/interactions-design.json
|
|
1406
|
+
Create `requirements/{module}.interactions-design.json` (replace `{module}` with actual module name from `.currentmodule`):
|
|
681
1407
|
|
|
682
1408
|
```json
|
|
683
1409
|
{
|
|
684
1410
|
"design_metadata": {
|
|
685
1411
|
"timestamp": "YYYY-MM-DD HH:mm:ss",
|
|
686
|
-
"source_requirements": "requirements-analysis.json",
|
|
687
|
-
"source_data": "data-concepts.json",
|
|
1412
|
+
"source_requirements": "{module}.requirements-analysis.json",
|
|
1413
|
+
"source_data": "{module}.data-concepts.json",
|
|
688
1414
|
"version": "1.0.0"
|
|
689
1415
|
},
|
|
690
1416
|
"interactions": [
|
|
@@ -854,10 +1580,11 @@ Create `requirements/interactions-design.json`:
|
|
|
854
1580
|
}
|
|
855
1581
|
```
|
|
856
1582
|
|
|
857
|
-
**✅ END Task 1.
|
|
1583
|
+
**✅ END Task 1.5: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
858
1584
|
```json
|
|
859
1585
|
{
|
|
860
|
-
"
|
|
1586
|
+
"module": "<keep existing value>",
|
|
1587
|
+
"currentTask": "Task 1.5",
|
|
861
1588
|
"completed": true
|
|
862
1589
|
}
|
|
863
1590
|
```
|
|
@@ -865,19 +1592,21 @@ Create `requirements/interactions-design.json`:
|
|
|
865
1592
|
**📝 Commit changes:**
|
|
866
1593
|
```bash
|
|
867
1594
|
git add .
|
|
868
|
-
git commit -m "feat: Task 1.
|
|
1595
|
+
git commit -m "feat: Task 1.5 - Complete interaction design"
|
|
869
1596
|
```
|
|
870
1597
|
|
|
871
|
-
**✅ END Task 1: Update `docs/
|
|
1598
|
+
**✅ END Task 1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
|
|
872
1599
|
```json
|
|
873
1600
|
{
|
|
1601
|
+
"module": "<keep existing value>",
|
|
874
1602
|
"currentTask": "Task 1",
|
|
875
1603
|
"completed": true,
|
|
876
1604
|
"completedItems": [
|
|
877
|
-
"goals-analysis.json created",
|
|
878
|
-
"requirements-analysis.json created",
|
|
879
|
-
"
|
|
880
|
-
"
|
|
1605
|
+
"{module}.goals-analysis.json created",
|
|
1606
|
+
"{module}.requirements-analysis.json created",
|
|
1607
|
+
"{module}.integration.json created",
|
|
1608
|
+
"{module}.data-concepts.json created",
|
|
1609
|
+
"{module}.interactions-design.json created"
|
|
881
1610
|
],
|
|
882
1611
|
"methodology": "goal-driven",
|
|
883
1612
|
"analysis_complete": true
|
|
@@ -891,9 +1620,10 @@ git commit -m "feat: Task 1 - Complete requirements analysis with goal-driven me
|
|
|
891
1620
|
```
|
|
892
1621
|
|
|
893
1622
|
**🛑 STOP: Task 1 completed. All requirements have been analyzed using the goal-driven methodology. The output includes:**
|
|
894
|
-
1. **goals-analysis.json** - Refined and clarified goals from user input
|
|
895
|
-
2. **requirements-analysis.json** - Complete requirement tree with read-centric derivation
|
|
896
|
-
3. **
|
|
897
|
-
4. **
|
|
1623
|
+
1. **{module}.goals-analysis.json** - Refined and clarified goals from user input
|
|
1624
|
+
2. **{module}.requirements-analysis.json** - Complete requirement tree with read-centric derivation
|
|
1625
|
+
3. **{module}.integration.json** - External integration analysis and flow documentation
|
|
1626
|
+
4. **{module}.data-concepts.json** - Extracted data models with dependencies
|
|
1627
|
+
5. **{module}.interactions-design.json** - System interactions with complete specifications
|
|
898
1628
|
|
|
899
1629
|
**Wait for user instructions before proceeding to Task 2.**
|