@autobe/agent 0.26.0 → 0.27.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/lib/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +27 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +2 -4
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +10 -10
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +78 -27
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +1891 -1214
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +15 -8
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +136 -48
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +3 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +137 -49
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +136 -48
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +5 -3
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +241 -69
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +23 -23
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +6 -5
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +2 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +40 -6
- package/src/AutoBeMockAgent.ts +2 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +10 -10
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/createAutoBeContext.ts +96 -36
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +17 -6
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +3 -2
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +3 -4
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +10 -15
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrisma.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealize.ts +3 -2
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +3 -2
- package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +6 -5
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +3 -1
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestScenario.ts +2 -1
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -1
- package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/facade/{transformFacadeStateMessage.js → structures/transformFacadeStateMessage.js} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -16,8 +16,8 @@ const transformRealizeWriteAuthorizationsHistories = (operation, payload) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.transformRealizeWriteAuthorizationsHistories = transformRealizeWriteAuthorizationsHistories;
|
|
18
18
|
const PROMPTS = {
|
|
19
|
-
login: "<!--\nfilename: REALIZE_MEMBERSHIP_LOGIN.md\n-->\n# Authorization Type: Login\n\nThis is a **login** operation that authenticates users.\n\n## Implementation Guidelines for Login\n\n### Login Operation Requirements\n- This is a login endpoint that authenticates users\n- Must validate credentials (username/email and password)\n- Must verify password using PasswordUtil\n- Must create a new session record for this login\n- Must generate JWT tokens with correct payload structure\n- Should return authentication tokens (access and refresh tokens)\n- May include additional business logic as required by the API specification (e.g., updating last login timestamp, creating audit logs, checking account status)\n- Must NOT require authentication decorator (this endpoint creates authentication)\n\n**IMPORTANT**: While the core requirements (credential validation, session creation, JWT generation) are mandatory, you should implement any additional business logic specified in the API requirements. The examples below show the mandatory flow, but your implementation may include additional steps before, between, or after these core operations.\n\n## Session Management Architecture\n\n### Conceptual Foundation: Actor and Session Separation\n\nIn production authentication systems, we separate **Actor** (the persistent user identity) from **Session** (the temporary authentication state). This architectural pattern provides several critical benefits:\n\n1. **Security**: Sessions can be independently revoked without deleting the user account\n2. **Multi-device support**: One actor can maintain multiple concurrent sessions across different devices\n3. **Audit trail**: Session records track when and where authentication occurred\n4. **Token rotation**: Sessions enable secure refresh token rotation strategies\n\n### Implementation Requirements for Login Operation\n\nWhen implementing a login operation, you MUST include these core phases. Additional business logic may be inserted at any point as needed:\n\n#### Phase 1: Validate Actor Credentials\nFirst, verify the actor's credentials and retrieve the actor record. This is **mandatory**:\n\n```typescript\n// Example: Validating seller credentials\nconst seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n});\nif (!seller) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n\n// Verify password using PasswordUtil\nconst isValid = await PasswordUtil.verify(\n props.body.password, // plain password from request\n seller.password_hash // hashed password from database\n);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n```\n\n#### Phase 2: Create Session Record\nAfter successful authentication, create a NEW session record for this login. This is **mandatory**:\n\n```typescript\n// Example: Creating a new session for the authenticated seller\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id, // Foreign key to actor\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n```\n\n**CRITICAL**: Each login creates a NEW session. Both the actor ID and session ID will be embedded in the JWT token payload (see JWT Token Generation section below).\n\n#### Additional Business Logic (Optional)\nBetween or after the mandatory phases above, you may implement additional business logic as specified in the API requirements. Examples include:\n- Updating last login timestamp on the actor record\n- Creating audit logs or login history records\n- Checking account status (e.g., banned, suspended, email verified)\n- Enforcing rate limiting or login attempt tracking\n- Invalidating old sessions if needed (e.g., single device policy)\n- Sending login notification emails or SMS\n- Tracking login analytics or metrics\n- Any other domain-specific operations required by the business\n\n**The key principle**: The mandatory phases (credential validation, session creation, JWT generation) must always be present, but you have complete flexibility to add necessary business logic around them.\n\n### Database Schema Pattern\n\nLogin operations interact with two related tables:\n\n1. **Actor Table** (e.g., `shopping_sellers`): Stores persistent user identity\n - Primary key: `id` (UUID)\n - Contains: email, password_hash, profile information\n - Represents: \"Who the user is\"\n\n2. **Session Table** (e.g., `shopping_seller_sessions`): Stores authentication sessions\n - Primary key: `id` (UUID)\n - Foreign key: `shopping_seller_id` (references actor)\n - Represents: \"An active authentication instance for this user\"\n\nRefer to **REALIZE_AUTHORIZATION.md** for detailed session architecture and relationship patterns.\n\n## MANDATORY: Use PasswordUtil for Password Verification\n\n**CRITICAL**: You MUST use PasswordUtil utilities for password verification to ensure consistency with the join operation:\n\n```typescript\n// Example: Password verification in login\nconst isValid = await PasswordUtil.verify(\n props.body.password, // plain password from request\n user.password_hash // hashed password from database\n);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n```\n\n## JWT Token Generation\n\n### Conceptual Foundation: Token Payload Structure\n\nThe JWT token payload serves as a **cryptographically signed credential** that identifies both the actor and their specific authentication session. This dual identification enables:\n\n1. **Actor identification**: `id` field identifies which user is authenticated\n2. **Session identification**: `session_id` field identifies which authentication instance is active\n3. **Role-based access**: `type` field enables discriminated union patterns for authorization\n\n### Token Payload Structure\n\n**CRITICAL**: Use the predefined payload structures for consistency:\n\n```json\n${PAYLOAD}\n```\n\n**NOTE**: The jsonwebtoken library is automatically imported as jwt. Use it to generate tokens with the EXACT payload structure:\n\n```typescript\ninterface IJwtSignIn {\n type: string; // Actor type name (e.g., \"seller\", \"user\", \"admin\")\n id: string & tags.Format<\"uuid\">; // Actor's primary ID\n session_id: string & tags.Format<\"uuid\">; // Session's primary ID\n created_at: string & tags.Format<\"date-time\">; // Token creation timestamp\n}\n```\n\n### Implementation Example\n\n```typescript\n// JWT is already imported: import jwt from \"jsonwebtoken\";\n\n// After validating credentials and creating a NEW session:\n// Phase 1: Validate actor\nconst seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n});\nconst isValid = await PasswordUtil.verify(props.body.password, seller.password_hash);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n\n// Phase 2: Create NEW session\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n\n// Phase 3: Generate JWT token with EXACT payload structure\n// DO NOT use type annotations like: const payload: IJwtSignIn = {...}\n// Just create the payload object directly in jwt.sign()\nconst token = {\n access: jwt.sign(\n {\n type: \"seller\", // Actor type discriminator\n id: seller.id, // Actor's ID (NOT session.id!)\n session_id: session.id, // Session's ID\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n }\n ),\n refresh: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n },\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n```\n\n### Critical Rules for Token Generation\n\n1. **Payload Structure**: Use the exact structure shown above - `type`, `id`, `session_id`, `created_at`\n2. **Actor ID**: The `id` field MUST contain the actor's primary key (e.g., `seller.id`), NOT the session's ID\n3. **Session ID**: The `session_id` field MUST contain the session's primary key (e.g., `session.id`)\n4. **Type Discriminator**: The `type` field MUST match the actor type (e.g., \"seller\", \"user\", \"admin\")\n5. **No Type Annotations**: Do NOT use TypeScript type annotations in the payload object passed to `jwt.sign()`\n6. **Issuer**: MUST use 'autobe' as the issuer for all tokens\n\n**DO NOT**:\n- Implement your own password hashing logic\n- Use bcrypt, argon2, or any other hashing library directly\n- Try to hash and compare manually\n\n## Token Decoding and Verification\n\n```typescript\n// Decode tokens if needed (e.g., for verification)\nconst decoded = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY, {\n issuer: 'autobe' // Verify issuer is 'autobe'\n});\n```\n\n## Complete Login Flow Examples\n\n### Example 1: Basic Login (Minimal)\n\n```typescript\n// Minimal example showing only mandatory phases\nexport async function postAuthSellerLogin(props: {\n body: IShoppingSeller.ILogin\n}): Promise<IShoppingSeller.ILoginOutput> {\n // 1. Find actor by credentials (MANDATORY)\n const seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n });\n if (!seller) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 2. Verify password (MANDATORY)\n const isValid = await PasswordUtil.verify(\n props.body.password,\n seller.password_hash\n );\n if (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 3. Create NEW session record (MANDATORY)\n const accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n },\n });\n\n // 4. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 5. Return with authorization token\n return {\n id: seller.id,\n email: seller.email,\n // ... other fields\n token,\n } satisfies IShoppingSeller.IAuthorized;\n}\n```\n\n### Example 2: Login with Additional Business Logic\n\n```typescript\n// Example showing additional business logic integrated with mandatory phases\nexport async function postAuthUserLogin(props: {\n body: IUser.ILogin\n}): Promise<IUser.ILoginOutput> {\n // 1. Find actor by credentials (MANDATORY)\n const user = await MyGlobal.prisma.users.findFirst({\n where: { email: props.body.email }\n });\n if (!user) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 2. ADDITIONAL BUSINESS LOGIC: Check account status\n if (user.status === 'banned') {\n throw new HttpException(\"Account has been banned\", 403);\n }\n if (user.status === 'suspended') {\n throw new HttpException(\"Account is temporarily suspended\", 403);\n }\n if (!user.email_verified) {\n throw new HttpException(\"Please verify your email first\", 403);\n }\n\n // 3. Verify password (MANDATORY)\n const isValid = await PasswordUtil.verify(\n props.body.password,\n user.password_hash\n );\n if (!isValid) {\n // ADDITIONAL BUSINESS LOGIC: Track failed login attempt\n await MyGlobal.prisma.login_attempts.create({\n data: {\n id: v4(),\n user_id: user.id,\n success: false,\n ip_address: props.body.ip,\n created_at: new Date().toISOString(),\n }\n });\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 4. ADDITIONAL BUSINESS LOGIC: Update last login timestamp\n await MyGlobal.prisma.users.update({\n where: { id: user.id },\n data: {\n last_login_at: new Date().toISOString(),\n last_login_ip: props.body.ip,\n }\n });\n\n // 5. ADDITIONAL BUSINESS LOGIC: Invalidate old sessions (single device policy)\n if (props.body.single_device_only) {\n await MyGlobal.prisma.user_sessions.updateMany({\n where: {\n user_id: user.id,\n expired_at: { gt: new Date().toISOString() }\n },\n data: {\n expired_at: new Date().toISOString() // Expire immediately\n }\n });\n }\n\n // 6. Create NEW session record (MANDATORY)\n const accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.user_sessions.create({\n data: {\n id: v4(),\n user_id: user.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n user_agent: props.body.user_agent,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n },\n });\n\n // 7. ADDITIONAL BUSINESS LOGIC: Create audit log\n await MyGlobal.prisma.audit_logs.create({\n data: {\n id: v4(),\n user_id: user.id,\n action: 'USER_LOGIN',\n ip_address: props.body.ip,\n session_id: session.id,\n created_at: new Date().toISOString(),\n }\n });\n\n // 8. ADDITIONAL BUSINESS LOGIC: Track successful login attempt\n await MyGlobal.prisma.login_attempts.create({\n data: {\n id: v4(),\n user_id: user.id,\n success: true,\n ip_address: props.body.ip,\n session_id: session.id,\n created_at: new Date().toISOString(),\n }\n });\n\n // 9. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 10. ADDITIONAL BUSINESS LOGIC: Send login notification (async, don't await)\n // NotificationService.sendLoginAlert(user.email, props.body.ip).catch(console.error);\n\n // 11. Return with authorization token\n return {\n id: user.id,\n email: user.email,\n last_login_at: user.last_login_at,\n // ... other fields\n token,\n } satisfies IUser.IAuthorized;\n}\n```\n\n**IMPORTANT**:\n- The mandatory phases (credential validation, password verification, session creation, JWT generation) must always be present\n- Additional business logic can be inserted at any appropriate point in the flow\n- Consider security implications of additional logic (e.g., rate limiting, account status checks)\n- Consider transaction boundaries if multiple database operations must succeed or fail together\n- Since this is a login operation, it must be publicly accessible without authentication" /* AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_LOGIN */,
|
|
20
|
-
join: "<!--\nfilename: REALIZE_MEMBERSHIP_JOIN.md\n-->\n# Authorization Type: Join (Registration)\n\nThis is a **join** operation for user registration.\n\n## Implementation Guidelines for Join\n\n### Join (Registration) Operation Requirements\n- This is a user registration endpoint\n- Must validate all required user information\n- Should check for duplicate accounts (email, username, etc.)\n- Must hash passwords before storing (NEVER store plain passwords)\n- Must create the actor record (user/member) in the database\n- Must create a session record for the newly registered actor\n- Must generate JWT tokens with correct payload structure\n- May include additional business logic as required by the API specification (e.g., creating related records, sending welcome emails, initializing user preferences)\n- Must NOT require authentication decorator (public endpoint)\n\n**IMPORTANT**: While the core requirements (actor creation, session creation, JWT generation) are mandatory, you should implement any additional business logic specified in the API requirements. The examples below show the mandatory flow, but your implementation may include additional steps before, between, or after these core operations.\n\n## Session Management Architecture\n\n### Conceptual Foundation: Actor and Session Separation\n\nIn production authentication systems, we separate **Actor** (the persistent user identity) from **Session** (the temporary authentication state). This architectural pattern provides several critical benefits:\n\n1. **Security**: Sessions can be independently revoked without deleting the user account\n2. **Multi-device support**: One actor can maintain multiple concurrent sessions across different devices\n3. **Audit trail**: Session records track when and where authentication occurred\n4. **Token rotation**: Sessions enable secure refresh token rotation strategies\n\n### Implementation Requirements for Join Operation\n\nWhen implementing a join (registration) operation, you MUST include these core phases. Additional business logic may be inserted at any point as needed:\n\n#### Phase 1: Create Actor Record\nFirst, create the primary actor record (e.g., `shopping_sellers`, `users`, `admins`). This is **mandatory**:\n\n```typescript\n// Example: Creating a seller actor\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\nconst seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword, // Never store plain passwords\n created_at: toISOStringSafe(new Date()),\n // ... other actor-specific fields\n }\n});\n```\n\n#### Phase 2: Create Session Record\nAfter creating the actor, create an associated session record (e.g., `shopping_seller_sessions`). This is **mandatory**:\n\n```typescript\n// Example: Creating a session for the newly registered seller\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id, // Foreign key to actor\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n```\n\n**CRITICAL**: Both the actor ID and session ID will be embedded in the JWT token payload (see JWT Token Generation section below).\n\n#### Additional Business Logic (Optional)\nBetween or after the mandatory phases above, you may implement additional business logic as specified in the API requirements. Examples include:\n- Creating related records in other tables (e.g., user profiles, preferences, initial data)\n- Sending notification emails or SMS\n- Initializing default settings or configurations\n- Creating audit logs or tracking records\n- Integrating with external services\n- Any other domain-specific operations required by the business\n\n**The key principle**: The mandatory phases (actor creation, session creation, JWT generation) must always be present, but you have complete flexibility to add necessary business logic around them.\n\n### Database Schema Pattern\n\nRegistration operations typically involve two related tables:\n\n1. **Actor Table** (e.g., `shopping_sellers`): Stores persistent user identity\n - Primary key: `id` (UUID)\n - Contains: email, password_hash, profile information\n - Represents: \"Who the user is\"\n\n2. **Session Table** (e.g., `shopping_seller_sessions`): Stores authentication sessions\n - Primary key: `id` (UUID)\n - Foreign key: `shopping_seller_id` (references actor)\n - Represents: \"An active authentication instance for this user\"\n\nRefer to **REALIZE_AUTHORIZATION.md** for detailed session architecture and relationship patterns.\n\n## MANDATORY: Use PasswordUtil for Password Hashing\n\n**CRITICAL**: You MUST use PasswordUtil utilities for password hashing to ensure consistency across all authentication operations:\n\n```typescript\n// Example: Password hashing in join/registration\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\n\n// Store the hashed password in database\nawait MyGlobal.prisma.users.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword, // Store the hash, never plain password\n created_at: toISOStringSafe(new Date()),\n // ... other fields\n }\n});\n```\n\n**DO NOT**:\n- Store plain passwords in the database\n- Use bcrypt, argon2, or any other hashing library directly\n- Implement your own hashing logic\n\n## JWT Token Generation After Registration\n\n### Conceptual Foundation: Token Payload Structure\n\nThe JWT token payload serves as a **cryptographically signed credential** that identifies both the actor and their specific authentication session. This dual identification enables:\n\n1. **Actor identification**: `id` field identifies which user is authenticated\n2. **Session identification**: `session_id` field identifies which authentication instance is active\n3. **Role-based access**: `type` field enables discriminated union patterns for authorization\n\n### Token Payload Structure\n\n**CRITICAL**: Use the predefined payload structures for consistency:\n\n```json\n${PAYLOAD}\n```\n\n**NOTE**: The jsonwebtoken library is automatically imported as jwt. After successful registration, generate tokens with the EXACT payload structure:\n\n```typescript\ninterface IJwtSignIn {\n type: string; // Actor type name (e.g., \"seller\", \"user\", \"admin\")\n id: string & tags.Format<\"uuid\">; // Actor's primary ID\n session_id: string & tags.Format<\"uuid\">; // Session's primary ID\n created_at: string & tags.Format<\"date-time\">; // Token creation timestamp\n}\n```\n\n### Implementation Example\n\n```typescript\n// JWT is already imported: import jwt from \"jsonwebtoken\";\n\n// After creating BOTH the actor and session records:\n// Phase 1: Create actor\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\nconst seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n});\n\n// Phase 2: Create session\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n\n// Phase 3: Generate JWT token with EXACT payload structure\n// DO NOT use type annotations like: const payload: IJwtSignIn = {...}\n// Just create the payload object directly in jwt.sign()\nconst token = {\n access: jwt.sign(\n {\n type: \"seller\", // Actor type discriminator\n id: seller.id, // Actor's ID (NOT session.id!)\n session_id: session.id, // Session's ID\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n }\n ),\n refresh: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n },\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n```\n\n### Critical Rules for Token Generation\n\n1. **Payload Structure**: Use the exact structure shown above - `type`, `id`, `session_id`, `created_at`\n2. **Actor ID**: The `id` field MUST contain the actor's primary key (e.g., `seller.id`), NOT the session's ID\n3. **Session ID**: The `session_id` field MUST contain the session's primary key (e.g., `session.id`)\n4. **Type Discriminator**: The `type` field MUST match the actor type (e.g., \"seller\", \"user\", \"admin\")\n5. **No Type Annotations**: Do NOT use TypeScript type annotations in the payload object passed to `jwt.sign()`\n6. **Issuer**: MUST use 'autobe' as the issuer for all tokens\n\n## Complete Registration Flow Examples\n\n### Example 1: Basic Registration (Minimal)\n\n```typescript\n// Minimal example showing only mandatory phases\nexport async function postAuthSellerJoin(props: {\n body: IShoppingSeller.IJoin\n}): Promise<IShoppingSeller.IJoinOutput> {\n // 1. Check for duplicate account\n const existing = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n });\n if (existing) {\n throw new HttpException(\"Email already registered\", 409);\n }\n\n // 2. Hash password (MANDATORY)\n const hashedPassword = await PasswordUtil.hash(props.body.password);\n\n // 3. Create actor record (MANDATORY)\n const seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n });\n\n // 4. Create session record (MANDATORY)\n const accessExpires = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n });\n\n // 5. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 6. Return with authorization token\n return {\n id: seller.id,\n email: seller.email,\n // ... other fields\n token,\n } satisfies IShoppingSeller.IAuthorized;\n}\n```\n\n### Example 2: Registration with Additional Business Logic\n\n```typescript\n// Example showing additional business logic integrated with mandatory phases\nexport async function postAuthUserJoin(props: {\n body: IUser.IJoin\n}): Promise<IUser.IJoinOutput> {\n // 1. Validation and duplicate check\n const existing = await MyGlobal.prisma.users.findFirst({\n where: { email: props.body.email }\n });\n if (existing) {\n throw new HttpException(\"Email already registered\", 409);\n }\n\n // 2. Hash password (MANDATORY)\n const hashedPassword = await PasswordUtil.hash(props.body.password);\n\n // 3. Create actor record (MANDATORY)\n const user = await MyGlobal.prisma.users.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n });\n\n // 4. ADDITIONAL BUSINESS LOGIC: Create user profile\n const profile = await MyGlobal.prisma.user_profiles.create({\n data: {\n id: v4(),\n user_id: user.id,\n nickname: props.body.nickname,\n avatar_url: props.body.avatar_url,\n created_at: new Date().toISOString(),\n }\n });\n\n // 5. ADDITIONAL BUSINESS LOGIC: Initialize user preferences\n await MyGlobal.prisma.user_preferences.create({\n data: {\n id: v4(),\n user_id: user.id,\n language: props.body.preferred_language ?? 'en',\n theme: 'light',\n notifications_enabled: true,\n }\n });\n\n // 6. ADDITIONAL BUSINESS LOGIC: Create audit log\n await MyGlobal.prisma.audit_logs.create({\n data: {\n id: v4(),\n user_id: user.id,\n action: 'USER_REGISTERED',\n ip_address: props.body.ip,\n created_at: new Date().toISOString(),\n }\n });\n\n // 7. Create session record (MANDATORY)\n const accessExpires = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.user_sessions.create({\n data: {\n id: v4(),\n user_id: user.id,\n ip: props.body.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n });\n\n // 8. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 9. ADDITIONAL BUSINESS LOGIC: Send welcome email (async, don't await)\n // EmailService.sendWelcomeEmail(user.email, user.nickname).catch(console.error);\n\n // 10. Return with authorization token and additional data\n return {\n id: user.id,\n email: user.email,\n profile: {\n nickname: profile.nickname,\n avatar_url: profile.avatar_url,\n },\n token,\n } satisfies IUser.IAuthorized;\n}\n```\n\n**IMPORTANT**:\n- The mandatory phases (password hashing, actor creation, session creation, JWT generation) must always be present\n- Additional business logic can be inserted at any appropriate point in the flow\n- Consider transaction boundaries if multiple database operations must succeed or fail together\n- Since this is a registration operation, it must be publicly accessible\n- Always hash passwords before storing" /* AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_JOIN */,
|
|
19
|
+
login: "<!--\nfilename: REALIZE_MEMBERSHIP_LOGIN.md\n-->\n# Authorization Type: Login\n\nThis is a **login** operation that authenticates users.\n\n## Implementation Guidelines for Login\n\n### Login Operation Requirements\n- This is a login endpoint that authenticates users\n- Must validate credentials (username/email and password)\n- Must verify password using PasswordUtil\n- Must create a new session record for this login\n- Must generate JWT tokens with correct payload structure\n- Should return authentication tokens (access and refresh tokens)\n- May include additional business logic as required by the API specification (e.g., updating last login timestamp, creating audit logs, checking account status)\n- Must NOT require authentication decorator (this endpoint creates authentication)\n\n**IMPORTANT**: While the core requirements (credential validation, session creation, JWT generation) are mandatory, you should implement any additional business logic specified in the API requirements. The examples below show the mandatory flow, but your implementation may include additional steps before, between, or after these core operations.\n\n## Session Management Architecture\n\n### Conceptual Foundation: Actor and Session Separation\n\nIn production authentication systems, we separate **Actor** (the persistent user identity) from **Session** (the temporary authentication state). This architectural pattern provides several critical benefits:\n\n1. **Security**: Sessions can be independently revoked without deleting the user account\n2. **Multi-device support**: One actor can maintain multiple concurrent sessions across different devices\n3. **Audit trail**: Session records track when and where authentication occurred\n4. **Token rotation**: Sessions enable secure refresh token rotation strategies\n\n### Implementation Requirements for Login Operation\n\nWhen implementing a login operation, you MUST include these core phases. Additional business logic may be inserted at any point as needed:\n\n#### Phase 1: Validate Actor Credentials\nFirst, verify the actor's credentials and retrieve the actor record. This is **mandatory**:\n\n```typescript\n// Example: Validating seller credentials\nconst seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n});\nif (!seller) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n\n// Verify password using PasswordUtil\nconst isValid = await PasswordUtil.verify(\n props.body.password, // plain password from request\n seller.password_hash // hashed password from database\n);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n```\n\n#### Phase 2: Create Session Record\nAfter successful authentication, create a NEW session record for this login. This is **mandatory**:\n\n```typescript\n// Example: Creating a new session for the authenticated seller\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id, // Foreign key to actor\n ip: props.body.ip ?? props.ip, // IP is optional - use client-provided (SSR case) or server-extracted\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n```\n\n**CRITICAL**: Each login creates a NEW session. Both the actor ID and session ID will be embedded in the JWT token payload (see JWT Token Generation section below).\n\n#### Additional Business Logic (Optional)\nBetween or after the mandatory phases above, you may implement additional business logic as specified in the API requirements. Examples include:\n- Updating last login timestamp on the actor record\n- Creating audit logs or login history records\n- Checking account status (e.g., banned, suspended, email verified)\n- Enforcing rate limiting or login attempt tracking\n- Invalidating old sessions if needed (e.g., single device policy)\n- Sending login notification emails or SMS\n- Tracking login analytics or metrics\n- Any other domain-specific operations required by the business\n\n**The key principle**: The mandatory phases (credential validation, session creation, JWT generation) must always be present, but you have complete flexibility to add necessary business logic around them.\n\n### Database Schema Pattern\n\nLogin operations interact with two related tables:\n\n1. **Actor Table** (e.g., `shopping_sellers`): Stores persistent user identity\n - Primary key: `id` (UUID)\n - Contains: email, password_hash, profile information\n - Represents: \"Who the user is\"\n\n2. **Session Table** (e.g., `shopping_seller_sessions`): Stores authentication sessions\n - Primary key: `id` (UUID)\n - Foreign key: `shopping_seller_id` (references actor)\n - Represents: \"An active authentication instance for this user\"\n\nRefer to **REALIZE_AUTHORIZATION.md** for detailed session architecture and relationship patterns.\n\n## MANDATORY: Use PasswordUtil for Password Verification\n\n**CRITICAL**: You MUST use PasswordUtil utilities for password verification to ensure consistency with the join operation:\n\n```typescript\n// Example: Password verification in login\nconst isValid = await PasswordUtil.verify(\n props.body.password, // plain password from request\n user.password_hash // hashed password from database\n);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n```\n\n## JWT Token Generation\n\n### Conceptual Foundation: Token Payload Structure\n\nThe JWT token payload serves as a **cryptographically signed credential** that identifies both the actor and their specific authentication session. This dual identification enables:\n\n1. **Actor identification**: `id` field identifies which user is authenticated\n2. **Session identification**: `session_id` field identifies which authentication instance is active\n3. **Role-based access**: `type` field enables discriminated union patterns for authorization\n\n### Token Payload Structure\n\n**CRITICAL**: Use the predefined payload structures for consistency:\n\n```json\n${PAYLOAD}\n```\n\n**NOTE**: The jsonwebtoken library is automatically imported as jwt. Use it to generate tokens with the EXACT payload structure:\n\n```typescript\ninterface IJwtSignIn {\n type: string; // Actor type name (e.g., \"seller\", \"user\", \"admin\")\n id: string & tags.Format<\"uuid\">; // Actor's primary ID\n session_id: string & tags.Format<\"uuid\">; // Session's primary ID\n created_at: string & tags.Format<\"date-time\">; // Token creation timestamp\n}\n```\n\n### Implementation Example\n\n```typescript\n// JWT is already imported: import jwt from \"jsonwebtoken\";\n\n// After validating credentials and creating a NEW session:\n// Phase 1: Validate actor\nconst seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n});\nconst isValid = await PasswordUtil.verify(props.body.password, seller.password_hash);\nif (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n}\n\n// Phase 2: Create NEW session\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n\n// Phase 3: Generate JWT token with EXACT payload structure\n// DO NOT use type annotations like: const payload: IJwtSignIn = {...}\n// Just create the payload object directly in jwt.sign()\nconst token = {\n access: jwt.sign(\n {\n type: \"seller\", // Actor type discriminator\n id: seller.id, // Actor's ID (NOT session.id!)\n session_id: session.id, // Session's ID\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n }\n ),\n refresh: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n },\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n```\n\n### Critical Rules for Token Generation\n\n1. **Payload Structure**: Use the exact structure shown above - `type`, `id`, `session_id`, `created_at`\n2. **Actor ID**: The `id` field MUST contain the actor's primary key (e.g., `seller.id`), NOT the session's ID\n3. **Session ID**: The `session_id` field MUST contain the session's primary key (e.g., `session.id`)\n4. **Type Discriminator**: The `type` field MUST match the actor type (e.g., \"seller\", \"user\", \"admin\")\n5. **No Type Annotations**: Do NOT use TypeScript type annotations in the payload object passed to `jwt.sign()`\n6. **Issuer**: MUST use 'autobe' as the issuer for all tokens\n\n**DO NOT**:\n- Implement your own password hashing logic\n- Use bcrypt, argon2, or any other hashing library directly\n- Try to hash and compare manually\n\n## Token Decoding and Verification\n\n```typescript\n// Decode tokens if needed (e.g., for verification)\nconst decoded = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY, {\n issuer: 'autobe' // Verify issuer is 'autobe'\n});\n```\n\n## Complete Login Flow Examples\n\n### Example 1: Basic Login (Minimal)\n\n```typescript\n// Minimal example showing only mandatory phases\nexport async function postAuthSellerLogin(props: {\n body: IShoppingSeller.ILogin\n}): Promise<IShoppingSeller.ILoginOutput> {\n // 1. Find actor by credentials (MANDATORY)\n const seller = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n });\n if (!seller) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 2. Verify password (MANDATORY)\n const isValid = await PasswordUtil.verify(\n props.body.password,\n seller.password_hash\n );\n if (!isValid) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 3. Create NEW session record (MANDATORY)\n const accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n },\n });\n\n // 4. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 5. Return with authorization token\n return {\n id: seller.id,\n email: seller.email,\n // ... other fields\n token,\n } satisfies IShoppingSeller.IAuthorized;\n}\n```\n\n### Example 2: Login with Additional Business Logic\n\n```typescript\n// Example showing additional business logic integrated with mandatory phases\nexport async function postAuthUserLogin(props: {\n ip: string;\n body: IUser.ILogin\n}): Promise<IUser.ILoginOutput> {\n // 1. Find actor by credentials (MANDATORY)\n const user = await MyGlobal.prisma.users.findFirst({\n where: { email: props.body.email }\n });\n if (!user) {\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 2. ADDITIONAL BUSINESS LOGIC: Check account status\n if (user.status === 'banned') {\n throw new HttpException(\"Account has been banned\", 403);\n }\n if (user.status === 'suspended') {\n throw new HttpException(\"Account is temporarily suspended\", 403);\n }\n if (!user.email_verified) {\n throw new HttpException(\"Please verify your email first\", 403);\n }\n\n // 3. Verify password (MANDATORY)\n const isValid = await PasswordUtil.verify(\n props.body.password,\n user.password_hash\n );\n if (!isValid) {\n // ADDITIONAL BUSINESS LOGIC: Track failed login attempt\n await MyGlobal.prisma.login_attempts.create({\n data: {\n id: v4(),\n user_id: user.id,\n success: false,\n ip: props.body.ip ?? props.ip,\n created_at: new Date().toISOString(),\n }\n });\n throw new HttpException(\"Invalid credentials\", 401);\n }\n\n // 4. ADDITIONAL BUSINESS LOGIC: Update last login timestamp\n await MyGlobal.prisma.users.update({\n where: { id: user.id },\n data: {\n last_login_at: new Date().toISOString(),\n last_login_ip: props.body.ip,\n }\n });\n\n // 5. ADDITIONAL BUSINESS LOGIC: Invalidate old sessions (single device policy)\n if (props.body.single_device_only) {\n await MyGlobal.prisma.user_sessions.updateMany({\n where: {\n user_id: user.id,\n expired_at: { gt: new Date().toISOString() }\n },\n data: {\n expired_at: new Date().toISOString() // Expire immediately\n }\n });\n }\n\n // 6. Create NEW session record (MANDATORY)\n const accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.user_sessions.create({\n data: {\n id: v4(),\n user_id: user.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n user_agent: props.body.user_agent,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n },\n });\n\n // 7. ADDITIONAL BUSINESS LOGIC: Create audit log\n await MyGlobal.prisma.audit_logs.create({\n data: {\n id: v4(),\n user_id: user.id,\n session_id: session.id,\n action: 'USER_LOGIN',\n ip: props.body.ip ?? props.ip,\n created_at: new Date().toISOString(),\n }\n });\n\n // 8. ADDITIONAL BUSINESS LOGIC: Track successful login attempt\n await MyGlobal.prisma.login_attempts.create({\n data: {\n id: v4(),\n user_id: user.id,\n success: true,\n ip: props.body.ip ?? props.ip,\n session_id: session.id,\n created_at: new Date().toISOString(),\n }\n });\n\n // 9. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 10. ADDITIONAL BUSINESS LOGIC: Send login notification (async, don't await)\n // NotificationService.sendLoginAlert(user.email, props.body.ip).catch(console.error);\n\n // 11. Return with authorization token\n return {\n id: user.id,\n email: user.email,\n last_login_at: user.last_login_at,\n // ... other fields\n token,\n } satisfies IUser.IAuthorized;\n}\n```\n\n**IMPORTANT**:\n- The mandatory phases (credential validation, password verification, session creation, JWT generation) must always be present\n- Additional business logic can be inserted at any appropriate point in the flow\n- Consider security implications of additional logic (e.g., rate limiting, account status checks)\n- Consider transaction boundaries if multiple database operations must succeed or fail together\n- Since this is a login operation, it must be publicly accessible without authentication" /* AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_LOGIN */,
|
|
20
|
+
join: "<!--\nfilename: REALIZE_MEMBERSHIP_JOIN.md\n-->\n# Authorization Type: Join (Registration)\n\nThis is a **join** operation for user registration.\n\n## Implementation Guidelines for Join\n\n### Join (Registration) Operation Requirements\n- This is a user registration endpoint\n- Must validate all required user information\n- Should check for duplicate accounts (email, username, etc.)\n- Must hash passwords before storing (NEVER store plain passwords)\n- Must create the actor record (user/member) in the database\n- Must create a session record for the newly registered actor\n- Must generate JWT tokens with correct payload structure\n- May include additional business logic as required by the API specification (e.g., creating related records, sending welcome emails, initializing user preferences)\n- Must NOT require authentication decorator (public endpoint)\n\n**IMPORTANT**: While the core requirements (actor creation, session creation, JWT generation) are mandatory, you should implement any additional business logic specified in the API requirements. The examples below show the mandatory flow, but your implementation may include additional steps before, between, or after these core operations.\n\n## Session Management Architecture\n\n### Conceptual Foundation: Actor and Session Separation\n\nIn production authentication systems, we separate **Actor** (the persistent user identity) from **Session** (the temporary authentication state). This architectural pattern provides several critical benefits:\n\n1. **Security**: Sessions can be independently revoked without deleting the user account\n2. **Multi-device support**: One actor can maintain multiple concurrent sessions across different devices\n3. **Audit trail**: Session records track when and where authentication occurred\n4. **Token rotation**: Sessions enable secure refresh token rotation strategies\n\n### Implementation Requirements for Join Operation\n\nWhen implementing a join (registration) operation, you MUST include these core phases. Additional business logic may be inserted at any point as needed:\n\n#### Phase 1: Create Actor Record\nFirst, create the primary actor record (e.g., `shopping_sellers`, `users`, `admins`). This is **mandatory**:\n\n```typescript\n// Example: Creating a seller actor\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\nconst seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword, // Never store plain passwords\n created_at: toISOStringSafe(new Date()),\n // ... other actor-specific fields\n }\n});\n```\n\n#### Phase 2: Create Session Record\nAfter creating the actor, create an associated session record (e.g., `shopping_seller_sessions`). This is **mandatory**:\n\n```typescript\n// Example: Creating a session for the newly registered seller\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id, // Foreign key to actor\n ip: props.body.ip ?? props.ip, // IP is optional - use client-provided (SSR case) or server-extracted\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n```\n\n**CRITICAL**: Both the actor ID and session ID will be embedded in the JWT token payload (see JWT Token Generation section below).\n\n#### Additional Business Logic (Optional)\nBetween or after the mandatory phases above, you may implement additional business logic as specified in the API requirements. Examples include:\n- Creating related records in other tables (e.g., user profiles, preferences, initial data)\n- Sending notification emails or SMS\n- Initializing default settings or configurations\n- Creating audit logs or tracking records\n- Integrating with external services\n- Any other domain-specific operations required by the business\n\n**The key principle**: The mandatory phases (actor creation, session creation, JWT generation) must always be present, but you have complete flexibility to add necessary business logic around them.\n\n### Database Schema Pattern\n\nRegistration operations typically involve two related tables:\n\n1. **Actor Table** (e.g., `shopping_sellers`): Stores persistent user identity\n - Primary key: `id` (UUID)\n - Contains: email, password_hash, profile information\n - Represents: \"Who the user is\"\n\n2. **Session Table** (e.g., `shopping_seller_sessions`): Stores authentication sessions\n - Primary key: `id` (UUID)\n - Foreign key: `shopping_seller_id` (references actor)\n - Represents: \"An active authentication instance for this user\"\n\nRefer to **REALIZE_AUTHORIZATION.md** for detailed session architecture and relationship patterns.\n\n## MANDATORY: Use PasswordUtil for Password Hashing\n\n**CRITICAL**: You MUST use PasswordUtil utilities for password hashing to ensure consistency across all authentication operations:\n\n```typescript\n// Example: Password hashing in join/registration\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\n\n// Store the hashed password in database\nawait MyGlobal.prisma.users.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword, // Store the hash, never plain password\n created_at: toISOStringSafe(new Date()),\n // ... other fields\n }\n});\n```\n\n**DO NOT**:\n- Store plain passwords in the database\n- Use bcrypt, argon2, or any other hashing library directly\n- Implement your own hashing logic\n\n## JWT Token Generation After Registration\n\n### Conceptual Foundation: Token Payload Structure\n\nThe JWT token payload serves as a **cryptographically signed credential** that identifies both the actor and their specific authentication session. This dual identification enables:\n\n1. **Actor identification**: `id` field identifies which user is authenticated\n2. **Session identification**: `session_id` field identifies which authentication instance is active\n3. **Role-based access**: `type` field enables discriminated union patterns for authorization\n\n### Token Payload Structure\n\n**CRITICAL**: Use the predefined payload structures for consistency:\n\n```json\n${PAYLOAD}\n```\n\n**NOTE**: The jsonwebtoken library is automatically imported as jwt. After successful registration, generate tokens with the EXACT payload structure:\n\n```typescript\ninterface IJwtSignIn {\n type: string; // Actor type name (e.g., \"seller\", \"user\", \"admin\")\n id: string & tags.Format<\"uuid\">; // Actor's primary ID\n session_id: string & tags.Format<\"uuid\">; // Session's primary ID\n created_at: string & tags.Format<\"date-time\">; // Token creation timestamp\n}\n```\n\n### Implementation Example\n\n```typescript\n// JWT is already imported: import jwt from \"jsonwebtoken\";\n\n// After creating BOTH the actor and session records:\n// Phase 1: Create actor\nconst hashedPassword: string = await PasswordUtil.hash(props.body.password);\nconst seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n});\n\n// Phase 2: Create session\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: new Date().toISOString(),\n expired_at: toISOStringSafe(accessExpires),\n }\n});\n\n// Phase 3: Generate JWT token with EXACT payload structure\n// DO NOT use type annotations like: const payload: IJwtSignIn = {...}\n// Just create the payload object directly in jwt.sign()\nconst token = {\n access: jwt.sign(\n {\n type: \"seller\", // Actor type discriminator\n id: seller.id, // Actor's ID (NOT session.id!)\n session_id: session.id, // Session's ID\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n }\n ),\n refresh: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\", // MUST use 'autobe' as issuer\n },\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n```\n\n### Critical Rules for Token Generation\n\n1. **Payload Structure**: Use the exact structure shown above - `type`, `id`, `session_id`, `created_at`\n2. **Actor ID**: The `id` field MUST contain the actor's primary key (e.g., `seller.id`), NOT the session's ID\n3. **Session ID**: The `session_id` field MUST contain the session's primary key (e.g., `session.id`)\n4. **Type Discriminator**: The `type` field MUST match the actor type (e.g., \"seller\", \"user\", \"admin\")\n5. **No Type Annotations**: Do NOT use TypeScript type annotations in the payload object passed to `jwt.sign()`\n6. **Issuer**: MUST use 'autobe' as the issuer for all tokens\n\n## Complete Registration Flow Examples\n\n### Example 1: Basic Registration (Minimal)\n\n```typescript\n// Minimal example showing only mandatory phases\nexport async function postAuthSellerJoin(props: {\n ip: string;\n body: IShoppingSeller.IJoin;\n}): Promise<IShoppingSeller.IJoinOutput> {\n // 1. Check for duplicate account\n const existing = await MyGlobal.prisma.shopping_sellers.findFirst({\n where: { email: props.body.email }\n });\n if (existing) {\n throw new HttpException(\"Email already registered\", 409);\n }\n\n // 2. Hash password (MANDATORY)\n const hashedPassword = await PasswordUtil.hash(props.body.password);\n\n // 3. Create actor record (MANDATORY)\n const seller = await MyGlobal.prisma.shopping_sellers.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n });\n\n // 4. Create session record (MANDATORY)\n const accessExpires = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.shopping_seller_sessions.create({\n data: {\n id: v4(),\n shopping_seller_id: seller.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n });\n\n // 5. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"seller\",\n id: seller.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 6. Return with authorization token\n return {\n id: seller.id,\n email: seller.email,\n // ... other fields\n token,\n } satisfies IShoppingSeller.IAuthorized;\n}\n```\n\n### Example 2: Registration with Additional Business Logic\n\n```typescript\n// Example showing additional business logic integrated with mandatory phases\nexport async function postAuthUserJoin(props: {\n ip: string;\n body: IUser.IJoin\n}): Promise<IUser.IJoinOutput> {\n // 1. Validation and duplicate check\n const existing = await MyGlobal.prisma.users.findFirst({\n where: { email: props.body.email }\n });\n if (existing) {\n throw new HttpException(\"Email already registered\", 409);\n }\n\n // 2. Hash password (MANDATORY)\n const hashedPassword = await PasswordUtil.hash(props.body.password);\n\n // 3. Create actor record (MANDATORY)\n const user = await MyGlobal.prisma.users.create({\n data: {\n id: v4(),\n email: props.body.email,\n password_hash: hashedPassword,\n created_at: new Date().toISOString(),\n // ... other fields\n }\n });\n\n // 4. ADDITIONAL BUSINESS LOGIC: Create user profile\n const profile = await MyGlobal.prisma.user_profiles.create({\n data: {\n id: v4(),\n user_id: user.id,\n nickname: props.body.nickname,\n avatar_url: props.body.avatar_url,\n created_at: new Date().toISOString(),\n }\n });\n\n // 5. ADDITIONAL BUSINESS LOGIC: Initialize user preferences\n await MyGlobal.prisma.user_preferences.create({\n data: {\n id: v4(),\n user_id: user.id,\n language: props.body.preferred_language ?? 'en',\n theme: 'light',\n notifications_enabled: true,\n }\n });\n\n // 6. ADDITIONAL BUSINESS LOGIC: Create audit log\n await MyGlobal.prisma.audit_logs.create({\n data: {\n id: v4(),\n user_id: user.id,\n action: 'USER_REGISTERED',\n ip_address: props.body.ip ?? props.ip,\n created_at: new Date().toISOString(),\n }\n });\n\n // 7. Create session record (MANDATORY)\n const accessExpires = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const session = await MyGlobal.prisma.user_sessions.create({\n data: {\n id: v4(),\n user_id: user.id,\n ip: props.body.ip ?? props.ip,\n href: props.body.href,\n referrer: props.body.referrer,\n created_at: toISOStringSafe(new Date()),\n expired_at: toISOStringSafe(accessExpires),\n }\n });\n\n // 8. Generate JWT tokens (MANDATORY)\n const token = {\n accessToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"1h\",\n issuer: \"autobe\",\n }\n ),\n refreshToken: jwt.sign(\n {\n type: \"user\",\n id: user.id,\n session_id: session.id,\n tokenType: \"refresh\",\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: \"7d\",\n issuer: \"autobe\",\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 9. ADDITIONAL BUSINESS LOGIC: Send welcome email (async, don't await)\n // EmailService.sendWelcomeEmail(user.email, user.nickname).catch(console.error);\n\n // 10. Return with authorization token and additional data\n return {\n id: user.id,\n email: user.email,\n profile: {\n nickname: profile.nickname,\n avatar_url: profile.avatar_url,\n },\n token,\n } satisfies IUser.IAuthorized;\n}\n```\n\n**IMPORTANT**:\n- The mandatory phases (password hashing, actor creation, session creation, JWT generation) must always be present\n- Additional business logic can be inserted at any appropriate point in the flow\n- Consider transaction boundaries if multiple database operations must succeed or fail together\n- Since this is a registration operation, it must be publicly accessible\n- Always hash passwords before storing" /* AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_JOIN */,
|
|
21
21
|
refresh: "<!--\nfilename: REALIZE_MEMBERSHIP_REFRESH.md\n-->\n# Authorization Type: Refresh Token\n\nThis is a **refresh** token operation for renewing expired access tokens.\n\n## Implementation Guidelines for Refresh\n\n### Refresh Token Operation Requirements\n- This endpoint refreshes expired access tokens\n- Must validate the refresh token first\n- Should check if refresh token is not expired or revoked\n- Must generate a new access token with THE SAME payload structure\n- May also rotate the refresh token for security\n- Should handle invalid/expired refresh tokens gracefully\n- Typically requires the refresh token in request body or headers\n- Must NOT require standard authentication (uses refresh token instead)\n\n## Session Management Architecture\n\n### Conceptual Foundation: Session Continuity and Security\n\nThe refresh token operation maintains **session continuity** while enhancing security through token rotation. This architectural pattern provides:\n\n1. **Uninterrupted access**: Users remain authenticated without re-entering credentials\n2. **Token rotation**: Minimizes risk by regularly replacing tokens\n3. **Session validation**: Verifies the session is still valid and not revoked\n4. **Attack detection**: Identifies potential token theft through session tracking\n\n### Implementation Requirements for Refresh Operation\n\nWhen implementing a refresh token operation, you MUST follow this validation and regeneration process:\n\n#### Phase 1: Verify Refresh Token and Session\nFirst, decode and verify the refresh token, then validate the associated session:\n\n```typescript\n// Example: Verify refresh token\nconst decoded = jwt.verify(\n props.body.refreshToken,\n MyGlobal.env.JWT_SECRET_KEY,\n { issuer: 'autobe' }\n) as {\n id: string;\n session_id: string;\n type: \"seller\";\n};\n\n// Validate the session still exists and is active\nconst session = await MyGlobal.prisma.shopping_seller_sessions.findFirst({\n where: {\n id: decoded.session_id,\n shopping_seller_id: decoded.id,\n // Check session validity (e.g., not revoked, not expired)\n },\n include: {\n seller: true, // Include actor for validation\n // Add other relations if needed\n }\n});\nif (!session) {\n throw new HttpException(\"Session expired or revoked\", 401);\n} else if (session.seller.deleted_at !== null) {\n throw new HttpException(\"Account has been deleted\", 403);\n}\n```\n\n#### Phase 2: Generate New Tokens (Same Session)\nAfter validation, generate NEW tokens using the **SAME session ID**:\n\n```typescript\n// Example: Generate new tokens maintaining the same session\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst token = {\n access: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // SAME session ID\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '1h',\n issuer: 'autobe'\n }\n ),\n refresh: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // SAME session ID\n tokenType: 'refresh',\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '7d',\n issuer: 'autobe'\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n```\n\n#### Phase 3: Update Session Expiration\nAfter generating new tokens, update the session's `expired_at` timestamp:\n\n```typescript\n// Update session expiration time\nawait MyGlobal.prisma.shopping_seller_sessions.update({\n where: {\n id: decoded.session_id,\n },\n data: {\n expired_at: refreshExpires, // Update to new refresh token expiration\n },\n});\n```\n\n**CRITICAL**: The refresh operation does NOT create a new session. It reuses the existing `session_id` from the decoded token. However, the session's `expired_at` field MUST be updated to reflect the new refresh token expiration time.\n\n### Database Schema Pattern\n\nRefresh operations interact with session and actor tables:\n\n1. **Session Table** (e.g., `shopping_seller_sessions`): Validates session is active\n - Primary key: `id` (UUID) - This ID is maintained across token refreshes\n - Foreign key: `shopping_seller_id` (references actor)\n - Represents: \"The ongoing authentication session\"\n\n2. **Actor Table** (e.g., `shopping_sellers`): Validates actor is still active\n - Primary key: `id` (UUID)\n - Contains: email, password_hash, profile information\n - Represents: \"Who the user is\"\n\nRefer to **REALIZE_AUTHORIZATION.md** for detailed session architecture and relationship patterns.\n\n## CRITICAL: Refresh Token Implementation\n\n### Conceptual Foundation: Token Payload Structure\n\nThe JWT token payload serves as a **cryptographically signed credential** that identifies both the actor and their specific authentication session. During refresh operations:\n\n1. **Session continuity**: The `session_id` remains unchanged across refreshes\n2. **Actor identification**: The `id` field continues to identify the same user\n3. **Token rotation**: New cryptographic signatures are generated\n4. **Timestamp update**: The `created_at` field reflects the refresh time\n\n### Token Payload Structure\n\n**IMPORTANT**: When refreshing tokens, you MUST:\n1. Decode and verify the refresh token\n2. Extract the user information from the decoded token\n3. Generate a new access token with THE SAME payload structure as the original\n\n**CRITICAL**: Use the predefined payload structures for consistency:\n\n```json\n${PAYLOAD}\n```\n\n```typescript\ninterface IJwtSignIn {\n type: string; // Actor type name (e.g., \"seller\", \"user\", \"admin\")\n id: string & tags.Format<\"uuid\">; // Actor's primary ID\n session_id: string & tags.Format<\"uuid\">; // Session's primary ID (UNCHANGED)\n created_at: string & tags.Format<\"date-time\">; // Token creation timestamp (UPDATED)\n}\n```\n\n### Implementation Example\n\n```typescript\n// JWT is already imported: import jwt from \"jsonwebtoken\";\n\n// Step 1: Verify and decode the refresh token\nconst decoded = jwt.verify(\n props.body.refreshToken,\n MyGlobal.env.JWT_SECRET_KEY,\n { issuer: 'autobe' }\n) as {\n id: string;\n session_id: string;\n type: \"seller\";\n};\n\n// Step 2: Validate session and get actor data\nconst session = await MyGlobal.prisma.shopping_seller_sessions.findFirst({\n where: {\n id: decoded.session_id,\n shopping_seller_id: decoded.id,\n },\n include: {\n shopping_seller: true,\n // Add other relations if needed\n }\n});\nif (!session) {\n throw new HttpException(\"Session expired or revoked\", 401);\n} else if (session.shopping_seller.deleted_at !== null) {\n throw new HttpException(\"Account has been deleted\", 403);\n}\n\n// Step 3: Generate new access token with SAME session_id\n// DO NOT use type annotations like: const payload: IJwtSignIn = {...}\n// Just create the payload object directly in jwt.sign()\nconst accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\nconst refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\nconst access = {\n access: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // CRITICAL: Reuse same session_id\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '1h',\n issuer: 'autobe'\n }\n ),\n refresh: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // CRITICAL: Reuse same session_id\n tokenType: 'refresh',\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '7d',\n issuer: 'autobe'\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n};\n\n// Step 4: Update session expiration time\nawait MyGlobal.prisma.shopping_seller_sessions.update({\n where: {\n id: decoded.session_id,\n },\n data: {\n expired_at: refreshExpires,\n },\n});\n```\n\n### Critical Rules for Token Refresh\n\n1. **Session Preservation**: The `session_id` MUST remain the same as in the original token\n2. **Payload Structure**: Use the exact structure - `type`, `id`, `session_id`, `created_at`\n3. **Actor ID**: The `id` field MUST match the original token's actor ID\n4. **Type Consistency**: The `type` field MUST match the original token's type\n5. **No Type Annotations**: Do NOT use TypeScript type annotations in the payload object\n6. **Issuer**: MUST use 'autobe' as the issuer for all tokens\n\n**DO NOT**:\n- Generate new access tokens with different payload structures\n- Use random IDs like v4() in the payload\n- Create tokens without verifying the refresh token first\n- Use type annotations like: const payload: UserPayload = {...}\n- Create a NEW session (this is NOT a login operation)\n- Change the `session_id` value (this breaks session continuity)\n\n## Complete Refresh Flow Example\n\n```typescript\n// Complete example for shopping_sellers token refresh\nexport async function postAuthSellerRefresh(props: {\n body: IShoppingSeller.IRefresh\n}): Promise<IShoppingSeller.IRefreshOutput> {\n // 1. Verify and decode refresh token\n let decoded: {\n id: string;\n session_id: string;\n type: \"seller\";\n };\n try {\n decoded = jwt.verify(\n props.body.refreshToken,\n MyGlobal.env.JWT_SECRET_KEY,\n { issuer: 'autobe' }\n ) as {\n id: string;\n session_id: string;\n type: \"seller\";\n };\n } catch (error) {\n throw new UnauthorizedException(\"Invalid or expired refresh token\");\n }\n\n // 2. Validate type matches expected actor type\n if (decoded.type !== \"seller\") {\n throw new ForbiddenException(\"Invalid token type\");\n }\n\n // 3. Validate session exists and is active\n const session = await MyGlobal.prisma.shopping_seller_sessions.findFirst({\n where: {\n id: decoded.session_id,\n shopping_seller_id: decoded.id,\n },\n include: {\n seller: true,\n // Add other relations if needed\n }\n });\n if (!session) {\n throw new HttpException(\"Session expired or revoked\", 401);\n } else if (session.shopping_seller.deleted_at !== null) {\n throw new HttpException(\"Account has been deleted\", 403);\n }\n\n // 5. Generate new access token (SAME session_id)\n const accessExpires: Date = new Date(Date.now() + 60 * 60 * 1000);\n const refreshExpires: Date = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);\n const token = {\n access: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // Reuse existing session\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '1h',\n issuer: 'autobe'\n }\n ),\n refresh: jwt.sign(\n {\n type: decoded.type,\n id: decoded.id,\n session_id: decoded.session_id, // Reuse existing session\n tokenType: 'refresh',\n created_at: new Date().toISOString(),\n },\n MyGlobal.env.JWT_SECRET_KEY,\n {\n expiresIn: '7d',\n issuer: 'autobe'\n }\n ),\n expired_at: toISOStringSafe(accessExpires),\n refreshable_until: toISOStringSafe(refreshExpires),\n };\n\n // 6. Update session expiration time\n await MyGlobal.prisma.shopping_seller_sessions.update({\n where: {\n id: decoded.session_id,\n },\n data: {\n expired_at: refreshExpires,\n },\n });\n\n // 7. Return new tokens\n return {\n accessToken: token.access,\n refreshToken: token.refresh,\n };\n}\n```\n\n**IMPORTANT**: The new access token MUST have the same payload structure as the original token from login/join operations, with the SAME `session_id` value to maintain session continuity." /* AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_REFRESH */,
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=transformRealizeWriteAuthorizationsHistories.js.map
|
package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformRealizeWriteAuthorizationsHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAInB,MAAM,4CAA4C,GAAG,CAC1D,SAAmC,EACnC,OAA+B,EACa,EAAE;IAC9C,IAAI,SAAS,CAAC,iBAAiB,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,IAAI,GAAW,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAC/D,YAAY,EACZ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,CAAC;IACF,MAAM,OAAO,GAAwC;QACnD,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,eAAwB;QAC9B,IAAI;KACL,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAhBW,QAAA,4CAA4C,gDAgBvD;AAEF,MAAM,OAAO,GAAG;IACd,KAAK,
|
|
1
|
+
{"version":3,"file":"transformRealizeWriteAuthorizationsHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAInB,MAAM,4CAA4C,GAAG,CAC1D,SAAmC,EACnC,OAA+B,EACa,EAAE;IAC9C,IAAI,SAAS,CAAC,iBAAiB,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,IAAI,GAAW,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAC/D,YAAY,EACZ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,CAAC;IACF,MAAM,OAAO,GAAwC;QACnD,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,eAAwB;QAC9B,IAAI;KACL,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAhBW,QAAA,4CAA4C,gDAgBvD;AAEF,MAAM,OAAO,GAAG;IACd,KAAK,u0hBAAqD;IAC1D,IAAI,q3fAAoD;IACxD,OAAO,05XAAuD;CAC/D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutoBeAssistantMessageHistory, AutoBeRealizeHistory } from "@autobe/interface";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
import { IAutoBeFacadeApplicationProps } from "
|
|
4
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
5
5
|
export declare const orchestrateRealize: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) => (props: IAutoBeFacadeApplicationProps) => Promise<AutoBeAssistantMessageHistory | AutoBeRealizeHistory>;
|
|
@@ -132,13 +132,14 @@ const orchestrateRealize = (ctx) => (props) => __awaiter(void 0, void 0, void 0,
|
|
|
132
132
|
return ctx.dispatch({
|
|
133
133
|
type: "realizeComplete",
|
|
134
134
|
id: (0, uuid_1.v7)(),
|
|
135
|
-
created_at: new Date().toISOString(),
|
|
136
135
|
functions: bucket.corrected,
|
|
137
136
|
authorizations,
|
|
138
137
|
controllers,
|
|
139
138
|
compiled: bucket.validate.result,
|
|
139
|
+
aggregates: ctx.getCurrentAggregates("realize"),
|
|
140
140
|
step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
|
|
141
141
|
elapsed: new Date().getTime() - start.getTime(),
|
|
142
|
+
created_at: new Date().toISOString(),
|
|
142
143
|
});
|
|
143
144
|
});
|
|
144
145
|
exports.orchestrateRealize = orchestrateRealize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealize.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,+BAA0B;
|
|
1
|
+
{"version":3,"file":"orchestrateRealize.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,+BAA0B;AAG1B,uEAAoE;AACpE,6EAA0E;AAE1E,wEAAqE;AACrE,uFAAoF;AACpF,2EAAwE;AACxE,yFAAsF;AACtF,uEAAoE;AAEpE,6EAA0E;AAEnE,MAAM,kBAAkB,GAC7B,CAAiC,GAAyB,EAAE,EAAE,CAC9D,CACE,KAAoC,EAC2B,EAAE;;IACjE,cAAc;IACd,MAAM,QAAQ,GACZ,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,QAAQ,CAAC;IAClC,IAAI,QAAQ,KAAK,SAAS;QACxB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAE5E,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAkB,IAAA,6CAAqB,EACpD,GAAG,CAAC,KAAK,EAAE,EACX,SAAS,CACV,CAAC;IACF,IAAI,SAAS,KAAK,IAAI;QACpB,OAAO,GAAG,CAAC,gBAAgB,CAAC;YAC1B,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACvC,CAAC,CAAC;IACL,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,KAAK,CAAC,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I,EAAE,CAAC,WAAW,EAAE;KACrC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA9KS,QAAA,kBAAkB,sBA8K3B"}
|
|
@@ -96,7 +96,7 @@ function process(ctx, actor, templateFiles, progress, promptCacheKey) {
|
|
|
96
96
|
const pointer = {
|
|
97
97
|
value: null,
|
|
98
98
|
};
|
|
99
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
99
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
100
100
|
source: "realizeAuthorizationWrite",
|
|
101
101
|
histories: (0, transformRealizeAuthorization_1.transformRealizeAuthorizationHistories)(ctx, actor),
|
|
102
102
|
controller: createController({
|
|
@@ -137,6 +137,7 @@ function process(ctx, actor, templateFiles, progress, promptCacheKey) {
|
|
|
137
137
|
id: (0, uuid_1.v7)(),
|
|
138
138
|
created_at: new Date().toISOString(),
|
|
139
139
|
authorization: authorization,
|
|
140
|
+
metric,
|
|
140
141
|
tokenUsage,
|
|
141
142
|
completed: ++progress.completed,
|
|
142
143
|
total: progress.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeAuthorization.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeAuthorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,0EAyCC;;AA3DD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,6FAAmG;AACnG,qGAAkG;AAElG,6EAA0E;AAC1E,mEAAgE;AAEhE;;;;;GAKG;AACH,SAAsB,+BAA+B,CAEnD,GAAyB;;;QACzB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,2BAA2B;YACjC,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,0CAAE,IAAI,mCAAI,CAAC;YACjC,UAAU,EAAE,I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,aAAqC,EACrC,QAAiC,EACjC,cAAsB;;;QAEtB,MAAM,OAAO,GACX;YACE,KAAK,EAAE,IAAI;SACZ,CAAC;QACJ,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeAuthorization.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeAuthorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,0EAyCC;;AA3DD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,6FAAmG;AACnG,qGAAkG;AAElG,6EAA0E;AAC1E,mEAAgE;AAEhE;;;;;GAKG;AACH,SAAsB,+BAA+B,CAEnD,GAAyB;;;QACzB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,2BAA2B;YACjC,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,0CAAE,IAAI,mCAAI,CAAC;YACjC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAyB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,EAAE,CAAC;QACvE,MAAM,QAAQ,GAA4B;YACxC,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,SAAS,EAAE,CAAC;SACb,CAAC;QACF,MAAM,aAAa,GAAG,MAAM,CAC1B,MAAM,GAAG,CAAC,QAAQ,EAAE,CACrB,CAAC,OAAO,CAAC,WAAW,CAAC;YACpB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,MAAM,cAAc,GAAiC,MAAM,IAAA,uCAAkB,EAC3E,MAAM,CAAC,GAAG,CACR,CAAC,CAAC,EAAE,EAAE,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -81,7 +81,7 @@ function orchestrateRealizeAuthorizationCorrect(ctx_1, authorization_1, prismaCl
|
|
|
81
81
|
const pointer = {
|
|
82
82
|
value: null,
|
|
83
83
|
};
|
|
84
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
84
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
85
85
|
source: "realizeAuthorizationCorrect",
|
|
86
86
|
histories: (0, transformRealizeAuthorizationCorrectHistories_1.transformRealizeAuthorizationCorrectHistories)(ctx, authorization, templateFiles, compiled.diagnostics),
|
|
87
87
|
controller: createController({
|
|
@@ -100,7 +100,8 @@ function orchestrateRealizeAuthorizationCorrect(ctx_1, authorization_1, prismaCl
|
|
|
100
100
|
location: AuthorizationFileSystem_1.AuthorizationFileSystem.payloadPath(pointer.value.payload.name),
|
|
101
101
|
content: yield compiler.typescript.beautify(pointer.value.payload.content),
|
|
102
102
|
}, actor: authorization.actor });
|
|
103
|
-
ctx.dispatch(Object.assign(Object.assign({}, pointer.value), { type: "realizeAuthorizationCorrect", id: (0, uuid_1.v7)(), created_at: new Date().toISOString(), authorization: result, result: compiled,
|
|
103
|
+
ctx.dispatch(Object.assign(Object.assign({}, pointer.value), { type: "realizeAuthorizationCorrect", id: (0, uuid_1.v7)(), created_at: new Date().toISOString(), authorization: result, result: compiled, metric,
|
|
104
|
+
tokenUsage, step: (_d = (_c = ctx.state().test) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0 }));
|
|
104
105
|
return yield orchestrateRealizeAuthorizationCorrect(ctx, result, prismaClients, templateFiles, life - 1);
|
|
105
106
|
});
|
|
106
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeAuthorizationCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeAuthorizationCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,wFAyHC;;AAnID,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,6HAA0H;AAE1H,6EAA0E;AAC1E,6GAA0G;AAE1G,SAAsB,sCAAsC;yDAG1D,GAAyB,EACzB,aAAyC,EACzC,aAAqC,EACrC,aAAqC,EACrC,OAAe,GAAG,CAAC,KAAK;;QAExB,MAAM,QAAQ,GAAoB,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvD,MAAM,eAAe,GAAW,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAChE,iFAAuC,CAAC,qBAAqB,CAC3D,aAAa,CAAC,KAAK,CAAC,IAAI,EACxB,aAAa,CAAC,QAAQ,CAAC,OAAO,CAC/B,CACF,CAAC;QACF,MAAM,gBAAgB,GAAW,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CACjE,iFAAuC,CAAC,sBAAsB,CAC5D,aAAa,CAAC,KAAK,CAAC,IAAI,EACxB,aAAa,CAAC,SAAS,CAAC,OAAO,CAChC,CACF,CAAC;QAEF,gBAAgB;QAChB,MAAM,KAAK,iDACN,aAAa,GACb,aAAa,KAChB,CAAC,iDAAuB,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EACnE,gBAAgB,EAClB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Dto_1.getRealizeWriteDto)(ctx, props.scenario.operation);
|
|
178
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
178
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
179
179
|
source: "realizeCorrect",
|
|
180
180
|
controller: createController({
|
|
181
181
|
model: ctx.model,
|
|
@@ -200,7 +200,7 @@ function step(ctx, props) {
|
|
|
200
200
|
When modifying, modify the entire code, but not the import statement.
|
|
201
201
|
|
|
202
202
|
Below is template code you wrote:
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
${(0, getRealizeWriteCodeTemplate_1.getRealizeWriteCodeTemplate)({
|
|
205
205
|
scenario: props.scenario,
|
|
206
206
|
schemas: ctx.state().interface.document.components.schemas,
|
|
@@ -236,6 +236,7 @@ function step(ctx, props) {
|
|
|
236
236
|
id: (0, uuid_1.v7)(),
|
|
237
237
|
location: props.scenario.location,
|
|
238
238
|
content: (_d = pointer.value.revise.final) !== null && _d !== void 0 ? _d : pointer.value.draft,
|
|
239
|
+
metric,
|
|
239
240
|
tokenUsage,
|
|
240
241
|
completed: ++props.progress.completed,
|
|
241
242
|
total: props.progress.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,8DAsFC;;;AA/GD,yCAA2C;AAQ3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,qEAAkE;AAClE,mGAAgG;AAChG,wEAAqE;AAIrE,iEAA8D;AAC9D,qFAAkF;AAClF,mEAAgE;AAChE,6EAA0E;AAE1E,SAAsB,yBAAyB;yDAC7C,GAAyB,EACzB,SAAyC,EACzC,cAA4C,EAC5C,SAAkC,EAClC,gBAAmD,EACnD,QAAiC,EACjC,OAAe,GAAG,CAAC,KAAK;QAExB,M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,EAAE,IAAI;SACZ,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,uCAAkB,EAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,8DAsFC;;;AA/GD,yCAA2C;AAQ3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,qEAAkE;AAClE,mGAAgG;AAChG,wEAAqE;AAIrE,iEAA8D;AAC9D,qFAAkF;AAClF,mEAAgE;AAChE,6EAA0E;AAE1E,SAAsB,yBAAyB;yDAC7C,GAAyB,EACzB,SAAyC,EACzC,cAA4C,EAC5C,SAAkC,EAClC,gBAAmD,EACnD,QAAiC,EACjC,OAAe,GAAG,CAAC,KAAK;QAExB,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,GAAG,EAAE;YAC3C,cAAc;YACd,SAAS;SACV,CAAC,CAAC;QACH,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;aACjD,IAAI,IAAI,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QAEpC,kCAAkC;QAClC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;QAE7C,IACE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAC5B,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,UAAU,CAAC,eAAe,CAAC,CAAA,CAAA,EAAA,CAC5C,KAAK,IAAI,EACV,CAAC;YACD,gE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;;;;;;;;;;;;;uHACoC;YAChE,QAAQ,EAAE;gBACR,OAAO,EAAE,QAAQ;aAClB;SACF;;QAAC;CACL,CAAC"}
|
|
@@ -101,7 +101,7 @@ const correct = (ctx, props, life) => __awaiter(void 0, void 0, void 0, function
|
|
|
101
101
|
const pointer = {
|
|
102
102
|
value: null,
|
|
103
103
|
};
|
|
104
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
104
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
105
105
|
source: "realizeCorrect",
|
|
106
106
|
histories: (0, transformRealizeCorrectCastingHistories_1.transformRealizeCorrectCastingHistories)({
|
|
107
107
|
failures: [
|
|
@@ -128,13 +128,13 @@ const correct = (ctx, props, life) => __awaiter(void 0, void 0, void 0, function
|
|
|
128
128
|
message: utils_1.StringUtil.trim `
|
|
129
129
|
Fix the TypeScript casting problems to resolve the compilation error.
|
|
130
130
|
|
|
131
|
-
Most casting errors are caused by type mismatches between Date types and
|
|
131
|
+
Most casting errors are caused by type mismatches between Date types and
|
|
132
132
|
string & tags.Format<'date-time'>. To fix these:
|
|
133
133
|
- Use ONLY the pre-provided toISOStringSafe() function to convert Date to string
|
|
134
134
|
- Do NOT use .toISOString() method directly (use toISOStringSafe instead)
|
|
135
135
|
- Never use Date type directly in declarations or return values
|
|
136
136
|
|
|
137
|
-
You don't need to explain me anything, but just fix or give it up
|
|
137
|
+
You don't need to explain me anything, but just fix or give it up
|
|
138
138
|
immediately without any hesitation, explanation, and questions.
|
|
139
139
|
|
|
140
140
|
The instruction to write at first was as follows, and the code you received is the code you wrote according to this instruction.
|
|
@@ -158,10 +158,10 @@ const correct = (ctx, props, life) => __awaiter(void 0, void 0, void 0, function
|
|
|
158
158
|
Also, never use typia.assert and typia.assertGuard like functions
|
|
159
159
|
to the Prisma types. Your mission is to fix the casting problem of
|
|
160
160
|
primitive types like string or number. Prisma type is not your scope.
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
If you take a mistake that casting the Prisma type with the typia.assert
|
|
163
163
|
function, it would be fallen into the infinite compilation due to extremely
|
|
164
|
-
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
164
|
+
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
165
165
|
only in the individual property level string or literal type.
|
|
166
166
|
|
|
167
167
|
I repeat that, never assert the Prisma type. It's not your mission.
|
|
@@ -193,6 +193,7 @@ const correct = (ctx, props, life) => __awaiter(void 0, void 0, void 0, function
|
|
|
193
193
|
created_at: new Date().toISOString(),
|
|
194
194
|
location: func.location,
|
|
195
195
|
step: (_c = (_b = ctx.state().analyze) === null || _b === void 0 ? void 0 : _b.step) !== null && _c !== void 0 ? _c : 0,
|
|
196
|
+
metric,
|
|
196
197
|
tokenUsage,
|
|
197
198
|
completed: props.progress.completed,
|
|
198
199
|
total: props.progress.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeCorrectCasting.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,yCAA2C;AAQ3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,qEAAkE;AAElE,iHAA8G;AAC9G,wEAAqE;AAGrE,qFAAkF;AAClF,6EAA0E;AAQnE,MAAM,gCAAgC,GAAG,2EASZ,EAAE,kHANpC,GAAyB,EACzB,SAAyC,EACzC,cAA4C,EAC5C,SAAkC,EAClC,QAAiC,EACjC,OAAe,GAAG,CAAC,KAAK;IAExB,MAAM,aAAa,GAA+B,MAAM,IAAA,yCAAmB,EACzE,GAAG,EACH;QACE,cAAc;QACd,SAAS;KACV,CACF,CAAC;IACF,OAAO,SAAS,CACd,GAAG,EACH;QACE,SAAS;QACT,cAAc;QACd,SAAS;QACT,gBAAgB,EAAE,EAAE;QACpB,QAAQ;QACR,KAAK,EAAE,aAAa;KACrB,EACD,IAAI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C,QAAQ,EAAE,EAAE,CAAC,GAAoC,EAAE;;QAChE,MAAM,IAAI,GAA0B,KAAK,CAAC,SAAS,CAAC,IAAI,CACtD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAC9B,CAAC;QACH,MAAM,QAAQ,GAAiC,KAAK,CAAC,SAAS,CAAC,IAAI,CACjE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CACnC,CAAC;QACH,MAAM,SAAS,GAA6B,QAAQ,CAAC,SAAS,CAAC;QAC/D,MAAM,aAAa,GACjB,KAAK,CAAC,cAAc,CAAC,IAAI,CACvB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,kBAAkB,CACrD,CAAC;QAEJ,MAAM,OAAO,GAET;YACF,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeCorrectCasting.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,yCAA2C;AAQ3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,qEAAkE;AAElE,iHAA8G;AAC9G,wEAAqE;AAGrE,qFAAkF;AAClF,6EAA0E;AAQnE,MAAM,gCAAgC,GAAG,2EASZ,EAAE,kHANpC,GAAyB,EACzB,SAAyC,EACzC,cAA4C,EAC5C,SAAkC,EAClC,QAAiC,EACjC,OAAe,GAAG,CAAC,KAAK;IAExB,MAAM,aAAa,GAA+B,MAAM,IAAA,yCAAmB,EACzE,GAAG,EACH;QACE,cAAc;QACd,SAAS;KACV,CACF,CAAC;IAC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,MAAM,EAAE,CAAC;YACjB,CAAC;SAC+C;KACnD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC,QAAmB,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHAC0C;YACvE,QAAQ,EAAE;gBACR,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;oBACb,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,SAAS;iBAChB,CAAC;aACH;SACF;;QAAC;IACJ,MAAM,EAAE,CAAC,QAAmB,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHAC0C;YACtE,QAAQ,EAAE;gBACR,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;oBACb,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,SAAS;iBAChB,CAAC;aACH;SACF;;QAAC;CACL,CAAC"}
|
|
@@ -63,7 +63,7 @@ function orchestrateRealizeWrite(ctx, props) {
|
|
|
63
63
|
value: null,
|
|
64
64
|
};
|
|
65
65
|
const dto = yield (0, getRealizeWriteDto_1.getRealizeWriteDto)(ctx, props.scenario.operation);
|
|
66
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
66
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
67
67
|
source: "realizeWrite",
|
|
68
68
|
histories: (0, transformRealizeWriteHistories_1.transformRealizeWriteHistories)({
|
|
69
69
|
state: ctx.state(),
|
|
@@ -119,6 +119,7 @@ function orchestrateRealizeWrite(ctx, props) {
|
|
|
119
119
|
id: (0, uuid_1.v7)(),
|
|
120
120
|
location: props.scenario.location,
|
|
121
121
|
content: (_c = pointer.value.revise.final) !== null && _c !== void 0 ? _c : pointer.value.draft,
|
|
122
|
+
metric,
|
|
122
123
|
tokenUsage,
|
|
123
124
|
completed: ++props.progress.completed,
|
|
124
125
|
total: props.progress.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeWrite.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeWrite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeWrite.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeWrite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,0DAkFC;;;AAtGD,yCAA2C;AAQ3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,qEAAkE;AAClE,+FAA4F;AAG5F,mEAAgE;AAChE,6EAA0E;AAE1E,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,KAOC;;;QAED,MAAM,OAAO,GAA2D;YACtE,KAAK,EAAE,IAAI;SACZ,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,uCAAkB,EAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAClD,MAAM,EAAE,cAAc;YACtB,SAAS,EAAE,IAAA,+DAA8B,EAAC;gBACxC,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;gBAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,aAAa,EAAE,KAAK,C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