Skip to content

Commit 6363771

Browse files
initial commit
0 parents  commit 6363771

4,281 files changed

Lines changed: 512443 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ai/MCPS.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# MCPS.md - Model Context Protocol Tools
2+
3+
**Available Integrations and Capabilities**
4+
5+
## What MCPs Are
6+
7+
Model Context Protocol (MCP) tools extend AI capabilities by providing access to external systems, data sources, and services. Each MCP is a specialized integration that the AI can use during execution.
8+
9+
## Available MCPs (GA-1)
10+
11+
### Design & Collaboration
12+
13+
**Figma**
14+
- Extract designs and components
15+
- Analyze design systems
16+
- Generate code from mockups
17+
- **Usage:** Attach Figma URLs during Design phase
18+
19+
**Notion**
20+
- Read documentation
21+
- Extract requirements
22+
- Sync specifications
23+
- **Usage:** Reference Notion docs as context
24+
25+
**Linear**
26+
- Read issues and projects
27+
- Understand requirements
28+
- Track implementation status
29+
- **Usage:** Link Linear issues for context
30+
31+
### Development Tools
32+
33+
**GitHub**
34+
- Repository operations (clone, branch, commit, push)
35+
- PR/issue creation
36+
- File browsing
37+
- Code search
38+
- **Usage:** Automatic integration via VCS connection
39+
40+
**GitLab**
41+
- Repository operations
42+
- Merge request creation
43+
- CI/CD status checking
44+
- **Usage:** Alternative to GitHub
45+
46+
### Data & Search
47+
48+
**Web Search**
49+
- Research best practices
50+
- Find documentation
51+
- Discover patterns
52+
- **Usage:** Automatic during Discovery phase
53+
54+
**Firecrawl**
55+
- Extract content from URLs
56+
- Parse documentation
57+
- Process web pages
58+
- **Usage:** When URLs attached as context
59+
60+
## MCP Configuration
61+
62+
MCPs are initialized during Setup phase of any execution. The system:
63+
1. Reads available MCPs from user's connections
64+
2. Registers tools with execution
65+
3. Makes them available to agents
66+
67+
**File:** `/packages/pipelines/deliverable/src/phases/setup.ts`
68+
- Agent: `deliverable-pipeline-initialize-mcps-tools-agent`
69+
70+
## Adding New MCPs
71+
72+
To add a new MCP integration:
73+
74+
1. Create MCP package in `/packages/mcp/`
75+
2. Implement MCP server following protocol
76+
3. Register in Orbitals > Connects
77+
4. Add initialization in Setup phase
78+
5. Document capabilities here in MCPS.md
79+
80+
## MCP Availability
81+
82+
MCPs are available during:
83+
- **Design Phase:** Read-only (research, documentation)
84+
- **Develop Phase:** Full access (code operations, data)
85+
- **Digest Phase:** Read-only (reference for learning capture)
86+
87+
File gates ensure MCPs can only edit allowed files per meta-phase.
88+
89+
---
90+
91+
**This document tracks available tools and integrations.** As new MCPs are added, they're documented here for AI awareness.

.ai/PRODUCT.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Engi GA-1 Product Guide
2+
3+
This document is the source-of-truth description of the shipping GA-1 experience. Every section maps directly to code in this repository; keep it synchronized whenever source changes.
4+
5+
## Experience Gates
6+
7+
- Guided execution routes tasks through Design → Develop → Digest using `createGuidedPipelineExecution` (`packages/pipelines/deliverable/src/index.ts:115`).
8+
- Phase handlers live alongside the pipeline: `phases/design.ts`, `phases/index.ts` (Develop SDIVS loop), and `phases/digest.ts`.
9+
- The current gate is stored in the execution store (`execution.store('guide', ...)`) and exposed to clients through the SSE stream (`uapi/streaming/stream-parser.ts:35` and `uapi/app/executions/components/ExecutionsPageHeader.tsx`).
10+
11+
### Gate Responsibilities
12+
- **Design**: contextual analysis, attachment digestion, deliverable classification (`packages/pipelines/deliverable/src/phases/design.ts`).
13+
- **Develop**: SDIVS pipeline with PTRR agents, iteration cap 3 (`packages/pipelines/deliverable/src/index.ts:86-106`).
14+
- **Digest**: captures work updates, prepares `.ai` diff proposals, and ensures learnings are persisted (`packages/pipelines/deliverable/src/phases/digest.ts`).
15+
16+
## Deliverables Pipeline (Develop Gate)
17+
18+
The Develop gate is the only gate that mutates customer repositories. It is composed of SDIVS phases that delegate to execution-generics patterns (`packages/pipelines/deliverable/src/phases/index.ts`).
19+
20+
### Setup
21+
- Uses the phase runner declared in `deliverablesPipelineSetupPhaseExecutor` to clone the repository, normalize workspace metadata, and enforce the danger wall before continuing (`setup.ts`).
22+
- Short-circuit signals issued here propagate to credit refunds (`packages/execution-generics/src/signals/ShortCircuitSignal.ts`).
23+
24+
### Discovery
25+
- Sequential executor running five research agents (`packages/pipelines/deliverable/src/phases/index.ts:37-47`):
26+
- `gather-context`, `understand-requirements`, `research-approach`, `plan-implementation`, `assess-complexity`.
27+
- Outputs validation criteria consumed later by implementation/validation agents.
28+
29+
### Implementation
30+
- Determines deliverable type via execution store and selects the correct agent sequence (`packages/pipelines/deliverable/src/phases/index.ts:60-101`).
31+
- **Code Change**: Divide → parallel Conquer per file → Correct (`implementation:deliverable-pipeline-*` agents).
32+
- **Code Change Review / Design Document / Design Review**: single PTRR agent per type.
33+
- File level work emits structured results consumed by validators and shipping agents.
34+
35+
### Validation
36+
- Parallel validators write issues into `validation/*` stores before the `ready-to-instruct` + `waitIfNeeded` + `ready-to-ship` chain (`packages/pipelines/deliverable/src/phases/index.ts:122-167`).
37+
- Self-instruction confidence is stored for Digest and UI timers.
38+
39+
### Shipping
40+
- Always two steps: ship deliverable (VCS interaction) then produce final work summary (`packages/pipelines/deliverable/src/phases/index.ts:172-183`).
41+
- Uses VCS gated tools so only Develop gate can write to repositories.
42+
43+
### Postprocess & Iterations
44+
- `factoryIterationPreprocess` loads on-the-fly instructions and attachments per iteration (`packages/pipelines/deliverable/src/index.ts:28-63`).
45+
- `factoryPostprocess` captures normalized output + artifacts for UI (`packages/pipelines/deliverable/src/index.ts:66-83`).
46+
47+
## Streaming & Work Surfaces
48+
49+
- `enablePipelineStreaming` writes execution state into `execution_events`; SSE polling endpoint streams them to the client (`uapi/app/api/executions/stream/route.ts`).
50+
- `parseStreamChunk` normalizes events (phase, agent, generation, tool-use, work-update) for UI consumption (`uapi/streaming/stream-parser.ts`).
51+
- `WorkUpdatePanel` renders agent and iteration updates between the log and instructions (`uapi/components/base/engi/execution/WorkUpdatePanel.tsx`).
52+
- Completion payloads surface PR/issue metadata, file diffs, duration, and metrics in `ExecutionsCompleteHeaderContent` (`uapi/app/executions/components/ExecutionsCompleteHeaderContent.tsx`).
53+
54+
## User Flow & UI Surfaces
55+
56+
- Unified executables page lives under `/executions`; SSR wrapper keeps `runId` compatibility (`uapi/app/executions/page.tsx`).
57+
- `ExecutionsPageClient` orchestrates repository selection, template persistence, model selection, attachment intake, and iteration timers (`uapi/app/executions/components/ExecutionsPageClient.tsx:55-200`).
58+
- Onboarding gate checks for a VCS connection and positive credit balance before allowing execution (`ExecutionsPageClient.tsx:176-197`).
59+
- SSE state hydrates UI components through `useExecutionState` and `PipelineExecutionLog`.
60+
61+
## API Surface
62+
63+
- `/api/executions` provides unified access; internally delegates to deliverables handlers to avoid regressions (`uapi/app/api/executions/route.ts`, `packages/api/src/routes/deliverables.ts`).
64+
- `/api/executions/stream` streams execution events with ownership checks and cursor resume support (`uapi/app/api/executions/stream/route.ts:1-200`).
65+
- `/api/executions/history` rehydrates past runs including guide metadata (`uapi/app/api/executions/history/route.ts`).
66+
- Stripe webhooks and checkout session endpoints live under `/api/stripe/*` (`uapi/app/api/stripe` routes) and feed the credit ledger.
67+
68+
## Data & Persistence
69+
70+
- Primary tables: `executions`, `execution_events`, `phase_executions` (current GA-1), plus append-only ledgers (`user_credits`, `user_credit_usages`, `generations`). Schema lives in `supabase/migrations/**`.
71+
- ORM exports typed accessors in `packages/orm/src/index.ts`, aligning with SSOT declared in `packages/orm/src/types/database.ts`.
72+
- Pipeline iteration metadata (self-instruction, work updates) stored via execution stores; digest guide consumes them to produce `.ai` diffs.
73+
74+
## Credits & Billing
75+
76+
- Credit reservation + settlement handled by `withCreditReservation` around pipeline execution (`packages/api/src/routes/deliverables.ts:152-360`).
77+
- Escrow tuning constants, ledger writes, and RPC fallback logic reside in `packages/credits/src/index.ts:13-200`.
78+
- Refunds triggered by short-circuit signals and propagated through credit helpers; partial refunds annotated in execution metadata.
79+
80+
## Digest Responsibilities
81+
82+
- Digest agents collect learnings, propose `.ai` document updates, and ensure follow-up tasks are queued (`packages/pipelines/deliverable/src/phases/digest.ts`).
83+
- Work-update iteration summaries expose self-instruction confidence and suggested follow-ups for future executions.
84+
- GA-1 backlog: enforce `.ai` persistence + approval flow before Digest completes (tracked in `internal-docs/GA1.md`).
85+
86+
## Known GA-1 Follow-Ups
87+
88+
- Digest gate approval mechanics and guide history serialization (see `internal-docs/GA1.md`).
89+
- Finalize structured persistence tables (`deliverables_pipeline_*`) once migrations land.
90+
- Complete UI polish for WorkUpdatePanel expand/collapse and accessibility.
91+
92+
Keep this document authoritative: when a capability, endpoint, or flow changes in code, update the relevant section with precise paths.

.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Shared environment variables for Supabase (staging environment - default)
2+
SUPABASE_URL=https://your-project.supabase.co
3+
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
4+
SUPABASE_ANON_KEY=your-supabase-anon-key
5+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
6+
SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key
7+
SUPABASE_JWT_SECRET=your-supabase-jwt-secret
8+
9+
# Supabase publishable and secret keys
10+
SUPABASE_PUBLISHABLE_KEY=sb_publishable_your-key
11+
SUPABASE_SECRET_KEY=sb_secret_your-key
12+
13+
ENGI_MOCK_EXA=true

.env.local

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
###########################################################################
2+
# Local UI-feature overrides used while tracking the post-sign-in slowdown.
3+
# These are placed at the *workspace root* so they win the variable-loading
4+
# order that Next.js follows ( .env*.local → .env.local → .env* → .env )
5+
# across every package (uapi, admin, etc.) started by Turborepo.
6+
###########################################################################
7+
8+
# Marketing toggles ---------------------------------------------------------
9+
NEXT_PUBLIC_COMING_SOON=false
10+
NEXT_PUBLIC_SOFT_LAUNCH=false
11+
NEXT_PUBLIC_CONVERSATION_SECTION=false
12+
NEXT_PUBLIC_INVISIBLE_INTERFACES_GROUP=true
13+
NEXT_PUBLIC_DISABLE_USING=false
14+
NEXT_PUBLIC_LIGHTPAPER_BANNER=false
15+
16+
# High-level UI surfaces ----------------------------------------------------
17+
NEXT_PUBLIC_NOTIFICATIONS_WIDGET=false
18+
NEXT_PUBLIC_CONVERSATIONS_WIDGET=false
19+
20+
# Single flag for left sidebar
21+
NEXT_PUBLIC_SIDEBAR_LEFT=false
22+
23+
# Navigation bar ------------------------------------------------------------
24+
NEXT_PUBLIC_NAV_BAR=false
25+
26+
# LLM defaults for local development
27+
ENGI_LLM_PROVIDER=google
28+
ENGI_LLM_MODEL=gemini-2.5-flash
29+
ENGI_LOG_FULL_PROMPTS=1
30+
ENGI_LOG_FULL_PROMPTS_CORRELATION_IDS=
31+
# Enable per-run log files (deliverables route switches to run-scoped files)
32+
ENGI_LOG_TO_FILE=1
33+
# Registry debug (LLM/tool/agent registry config lookups)
34+
ENGI_DEBUG_REGISTRIES=1
35+
# Google Generative AI (Gemini)
36+
GOOGLE_API_KEY=AIzaYourGoogleKey
37+
GEMINI_API_KEY=AIzaYourGeminiKey
38+
GOOGLE_GENERATIVE_AI_API_KEY=AIzaYourGenerativeKey
39+
40+
# -------------------------------------------------------------------------
41+
# Agentic Execution Debugging (added for trace + prompt I/O visibility)
42+
# -------------------------------------------------------------------------
43+
LOG_LEVEL=debug
44+
ENGI_EXECUTION_DEBUG=true
45+
ENGI_LOG_TRACES=1
46+
ENGI_LOG_FULL_TRACES=1
47+
ENGI_WRITE_PROMPT_IO=1
48+
# Write JSON sidecars for per-step traces
49+
ENGI_WRITE_STEP_TRACES=1
50+
# For focused debugging: stop after Plan (omit Try/Refine/Retry)
51+
ENGI_DEBUG_STOP_AFTER_PLAN=1
52+
# Optional size guard for full traces (characters). Leave unset for full detail.
53+
#ENGI_TRACE_MAX_SIZE=5000

.eslintrc.cjs

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/* Root ESLint config wiring GA-1 prompt hierarchy rules */
2+
module.exports = {
3+
root: true,
4+
parser: '@typescript-eslint/parser',
5+
parserOptions: {
6+
project: './tsconfig.json',
7+
tsconfigRootDir: __dirname,
8+
sourceType: 'module',
9+
ecmaVersion: 2020,
10+
},
11+
env: { node: true, es6: true, jest: true },
12+
plugins: ['@typescript-eslint', 'engi', 'react'],
13+
extends: [
14+
'eslint:recommended'
15+
],
16+
rules: {
17+
'engi/no-write-tools-outside-conquer': 'error',
18+
'engi/require-prompt-hierarchy': 'error',
19+
// Forbid legacy deep-imports into prompts using /src in consumer code.
20+
// Canonical pattern is: @engi/prompts/raw_promptparts/*
21+
'no-restricted-imports': ['error', {
22+
'patterns': [
23+
'@engi/prompts/src/raw_promptparts/*'
24+
]
25+
}],
26+
// Focus on GA-1 custom rules; reduce noise from generic rules
27+
'no-unused-vars': 'off',
28+
'no-undef': 'off',
29+
// Enforce one React component export per file for clarity/maintainability
30+
'react/no-multi-comp': ['error', { ignoreStateless: false }],
31+
},
32+
ignorePatterns: [
33+
'**/dist/**',
34+
'**/build/**',
35+
'**/.turbo/**',
36+
'**/.next/**',
37+
'**/node_modules/**',
38+
'**/*.generated.ts',
39+
],
40+
overrides: [
41+
// Temporarily allow multiple components in complex route headers
42+
{
43+
files: [
44+
'uapi/app/ai_documents/ai_documentsPageHeader.tsx',
45+
'uapi/app/executions/components/ExecutionPageHeader.tsx'
46+
],
47+
rules: {
48+
'react/no-multi-comp': 'off',
49+
}
50+
},
51+
// Allow multiple components in stories/tests
52+
{
53+
files: ['**/*.stories.*', '**/*.test.*'],
54+
rules: {
55+
'react/no-multi-comp': 'off',
56+
}
57+
},
58+
{
59+
files: ['**/*.ts', '**/*.tsx'],
60+
parserOptions: {
61+
project: ['./tsconfig.json'],
62+
},
63+
rules: {
64+
// Disable core rules that are noisy with TS types (handled by TS compiler if needed)
65+
'no-unused-vars': 'off',
66+
'no-undef': 'off',
67+
'no-empty': ['error', { allowEmptyCatch: true }],
68+
'no-redeclare': 'off',
69+
'no-dupe-class-members': 'off',
70+
'no-useless-catch': 'off',
71+
}
72+
},
73+
{
74+
files: ['uapi/app/**/*', 'uapi/components/vcs/**/*'],
75+
rules: {
76+
// Enforce SSOT: forbid importing UI primitives from the vendored folder
77+
'no-restricted-imports': ['error', {
78+
'patterns': [
79+
'@/components/ui/{button,card,input,label,select,tabs,dialog,alert-dialog,dropdown-menu,avatar,switch,textarea,progress,checkbox,popover,collapsible,command,calendar,tooltip,table,badge,alert}'
80+
]
81+
}],
82+
}
83+
},
84+
{
85+
files: ['**/__tests__/**', '**/*.test.ts', '**/*.test.tsx'],
86+
rules: {
87+
// Enforce one React component export per file for clarity/maintainability
88+
'react/no-multi-comp': ['error', { ignoreStateless: false }],
89+
'@typescript-eslint/no-var-requires': 'off',
90+
'@typescript-eslint/no-explicit-any': 'off',
91+
'@typescript-eslint/no-unused-vars': 'off',
92+
},
93+
},
94+
],
95+
settings: {
96+
react: { version: 'detect' }
97+
}
98+
};

0 commit comments

Comments
 (0)