Skip to content

Commit 544294d

Browse files
superops-teamTRAE CLI
andcommitted
feat(studio): integrate managed MPA runtime lifecycle
Integrate the managed MPA and Studio runtime lifecycle on top of upstream main. Keep the final tree aligned with the validated fork integration branch and harden the task-cancellation regression test against PID file write races observed in the official Python 3.12 CI matrix. Co-authored-by: TRAE CLI <traecli@bytedance.com>
1 parent 31d2c67 commit 544294d

604 files changed

Lines changed: 83322 additions & 3759 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.

‎.agents/plugins/marketplace.json‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Minified build artifacts can contain semantic whitespace inside template literals.
22
veadk/webui/assets/**/*.js -whitespace
3+
veadk/webui/website-integration.js -whitespace
34
*.sh text eol=lf

‎.github/workflows/secrets-scan.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
- name: Secret Scanning
3333
uses: trufflesecurity/trufflehog@7dc056a193116ba8d82154bf0549381c8fb8545c # v3.88.14
3434
with:
35-
extra_args: --results=verified,unknown
35+
extra_args: --results=verified,unknown --exclude-paths=.trufflehog-exclude-paths.txt

‎.gitignore‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,31 @@ cython_debug/
206206
.trae
207207
.claude
208208
.agents
209+
/.dbg/
210+
/debug-*.md
209211
.adk/
210212
**/.adk/
213+
214+
# Local AI/design and verification artifacts. Keep evidence summaries in
215+
# PRD/spec documents, not raw screenshots, traces, manifests, or run logs.
216+
/.artifacts/
217+
/.superpowers/
218+
/evidence/
219+
211220
# AgentKit deploy config (contains account-specific secrets)
212221
agentkit.yaml
213222
agentkit*.yaml
214223
.agentkit/
215224

225+
# veadk mpa create config (contains PG/model/OpenViking/Feishu secrets).
226+
# Only the committed *.example.yaml template is allowed.
227+
mpa-create.config.yaml
228+
mpa-create.config*.yaml
229+
!mpa-create.config.example.yaml
230+
**/mpa-create.config.yaml
231+
**/mpa-create.config*.yaml
232+
!**/mpa-create.config.example.yaml
233+
216234
# PiAgent release archives are downloaded and verified during image builds.
217235
examples/piagent_with_mcp/vendor/pi-*.tar.gz
236+
.gstack/

‎.gitleaks.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ id = "empty-env-key-pattern"
7272
description = "Empty environment variables with KEY pattern"
7373
regex = '''os\.environ\[".*?KEY"\]\s*=\s*".+"'''
7474

75+
[[rules]]
76+
id = "hardcoded-api-key-token-secret"
77+
description = "Hardcoded API key, token, secret, password, or credential assignment"
78+
regex = '''(?i)\b(api[_-]?key|apikey|access[_-]?key|secret[_-]?key|client[_-]?secret|auth[_-]?token|access[_-]?token|refresh[_-]?token|session[_-]?token|bearer[_-]?token|password|credential)\b["'\s:=]{0,16}["'][A-Za-z0-9_./+=:@%-]{16,}["']'''
79+
7580
[allowlist]
7681
# veadk/webui is the built (minified) web UI bundle — generated output reviewed
7782
# via its source under frontend/, not hand-written. Minified vendor libs

‎.pre-commit-config.yaml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ repos:
1313
- repo: https://github.com/gitleaks/gitleaks
1414
rev: v8.24.2
1515
hooks:
16-
- id: gitleaks
16+
- id: gitleaks
17+
- repo: local
18+
hooks:
19+
- id: yaml-secret-scan
20+
name: Detect concrete secrets in YAML
21+
entry: scripts/scan_yaml_secrets.py
22+
language: python
23+
types_or: [yaml]

‎.trufflehog-exclude-paths.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
^tests/integrations/mpa_managed/test_(admin_database|auto_pg|config|deployment_database_unit|registry_url|service)\.py$

‎AGENTS.md‎

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,63 @@
11
# Agent Instructions
22

3-
- Do not use `codex/` as a branch name prefix in this repository. Use semantic branch prefixes such as `feat/`, `fix/`, `chore/`, or `docs/`; for example, `feat/pr-748-dev`.
4-
- Before modifying frontend code, read `frontend/SPEC.md`.
5-
- When the user describes a requirement, propose an implementation plan before changing code, and wait for the user to be satisfied before making edits.
6-
- After creating or switching to a new branch, run `git pull` before development. Branch names must use semantic prefixes and reflect the requirement content.
7-
- When committing, include only changes related to the current feature or fix.
8-
- Before committing, fetch the latest remote code, rebase the branch onto it, then run pre-commit and unit tests.
9-
- When execution hits a pitfall such as insufficient permissions or missing dependencies, ask the user whether to document that pitfall.
3+
VeADK includes a Python SDK, CLI/runtime integrations, and AgentKit Studio with a TypeScript/React frontend and supporting Python services. Base decisions on the relevant implementation, tests, and existing contracts rather than assumptions from another repository.
4+
5+
## Language and document ownership
6+
7+
- Keep this repository-wide development standard in English. Use English for new code identifiers, comments, and docstrings; user-facing text follows the owning area's localization rules.
8+
- Read [prd-spec/README.md](prd-spec/README.md) before creating or updating a change design. Every PRD/design must have complete English `.md` and Chinese `.zh.md` counterparts, sharing the same directory, date, and basename.
9+
- Read [specs/README.md](specs/README.md) before defining or changing a component contract. Maintain each component under `specs/<component>/README.md` and `README.zh.md`.
10+
- Keep both languages semantically equivalent and update them in the same change. Preserve identifiers, commands, examples, limits, and acceptance criteria across translations. Missing or conflicting counterparts block approval and delivery.
11+
- PRDs own change-specific intent, scope, tasks, and acceptance; component specs own maintained responsibilities, interfaces, state, data, and failure semantics. Link them rather than duplicate contracts.
12+
- Before modifying frontend code, read `frontend/SPEC.md`; also apply it to its supporting backend interfaces as specified there. It remains the Studio development standard and is not replaced or translated by this document.
13+
- Preserve existing user-documentation conventions: the documentation site uses Chinese `.mdx` and English `.en.mdx`; bilingual module/example READMEs use English `README.md` and Chinese `README.zh.md`.
14+
15+
## Required development workflow
16+
17+
1. **Inspect and agree on scope.** Read the affected implementation, tests, and contracts. When the user describes a requirement, propose an implementation plan and wait for the user to be satisfied before making edits. Distinguish verified facts from assumptions.
18+
2. **Design before implementation.** Features, refactors, and bugfixes require a bilingual PRD under `prd-spec/features/`, `prd-spec/refactors/`, or `prd-spec/bugfixes/`. Include background/evidence, goals, non-goals, scenarios, requirements, design, affected files, tasks, tests, risks, and acceptance criteria.
19+
3. **Assess component contracts.** Create or update affected bilingual component specs for changes to ownership, APIs, configuration, state/data, events, permissions, security, compatibility, runtime behavior, or observability. Record a justified no-impact conclusion when no component contract changes. Do not backfill unrelated components.
20+
4. **Clear design review.** Review PRD/spec consistency, feasibility, boundaries, errors, security, compatibility, testability, and bilingual equivalence. Use the available `review-spec` skill; if unavailable, perform and record the same review directly. Resolve blockers and record user approval before modifying production code or tests. A generic skill's Chinese-only default does not override this repository's bilingual rule.
21+
5. **Implement against the approved design.** Map changes to requirements/tasks, write a failing regression or contract test first, then implement and refactor within scope. Contract or scope changes return to design review before implementation proceeds.
22+
6. **Verify and review.** Run affected tests first, then required repository and component gates. Review both implementation correctness and edge cases, resource handling, security, test quality, and contract alignment. Fix blocking findings and rerun affected checks.
23+
7. **Reconcile and deliver.** Synchronize both document languages, component contracts, affected user docs/examples, and required generated artifacts. Record actual verification commands, results, unverified areas, and remaining risks. All agreed tasks and acceptance criteria must be satisfied before declaring completion; deferred scope requires user agreement.
24+
25+
Pure documentation, translation, or formatting changes that preserve runtime behavior and public contracts do not need a recursive PRD. They still require an agreed approach, applicable bilingual updates, and proportionate checks. This exception includes maintaining these development guidelines; it does not exempt code or behavioral changes.
26+
27+
## Implementation boundaries
28+
29+
- Make the smallest complete change that satisfies the approved requirement. Reuse existing modules and dependencies; avoid unrelated cleanup, speculative abstractions, and partially wired features.
30+
- Treat public Python imports/signatures, CLI/configuration behavior, generated projects, Studio API types, and runtime/event contracts as consumer-facing boundaries. Breaking changes require explicit approval and a plan for affected callers and data; do not copy another project's blanket no-compatibility policy.
31+
- Cover asynchronous cancellation, timeouts, late responses/events, terminal states, and resource cleanup where affected. Do not turn errors into silent success or empty results.
32+
- Keep real credentials, signed URLs, personal data, and unredacted production logs out of source, design documents, reports, test fixtures, and generated artifacts.
33+
- Isolate tests from real user state and external services by default. Real cloud/provider operations need explicit authorization and an isolated smoke/E2E procedure; report simulated and live verification separately.
34+
35+
## Verification gates
36+
37+
Use the repository-local Python environment and current `pyproject.toml`, `pytest.ini`, package scripts, and CI workflows as command references. Do not invent `make` targets, copy another repository's coverage thresholds, or treat an unavailable check as passing.
38+
39+
| Change area | Required verification |
40+
| --- | --- |
41+
| Python SDK, CLI, and backend | Targeted tests via `uv run --extra dev pytest <test-paths>`; broader regression tests when shared contracts or dependencies are affected. |
42+
| Default parallel Python regression | `uv run --extra dev pytest -n 2 -m "not codex_smoke and not piagent_smoke"`; adjust worker count to available resources and record the selection. Explicit smoke runs are separate. |
43+
| Codex runtime smoke | When affected and the environment is prepared: `CODEX_RUN_SMOKE=1 uv run --extra dev pytest -m codex_smoke -p no:xdist -rs`. This test starts real processes and binds ports; never run it under parallel pytest. Verify it actually ran rather than skipped. |
44+
| Studio frontend | `npm --prefix frontend test` and `npm --prefix frontend run build`, plus real browser checks of the normal flow and affected loading, empty, error, cancellation, retry, keyboard/IME, and narrow-window cases. Follow `frontend/SPEC.md` for additional checks and release asset requirements. |
45+
| Studio backend or generated Python | Targeted Python tests plus Ruff and Pyright for changed Python files, as required by `frontend/SPEC.md`; verify generated code, dependencies, configuration, and deployment payloads together. |
46+
| Harness/sidecar contracts | The affected checks and existing coverage thresholds in `.github/workflows/harness-sidecar-release-gate.yaml`, including `npm --prefix frontend run test:harness-sidecar-coverage` when frontend sidecar contracts change. |
47+
| PRD/spec and guideline-only changes | Check paired-language completeness, contract/identifier consistency, relative links, referenced paths/commands, and diff whitespace. No runtime test result may be claimed from documentation checks. |
48+
| User documentation site | The affected Markdown/MDX checks and build/type checks defined in `docs/package.json`; do not apply site-specific tooling to unrelated plain Markdown without checking its scope. |
49+
50+
- Before committing, run `uv run --extra dev pre-commit run --all-files` and unit tests after synchronizing the branch as described below. Pre-commit includes Ruff and secret scanning; it does not replace browser, integration, or runtime verification.
51+
- Prefer targeted checks during iteration. Expand to affected integration/E2E and regression gates for shared or high-risk changes and final delivery; explain any omitted required check.
52+
- Record check outcomes as `pass`, `fail`, `blocked`, `not_run`, or `not_applicable`, with reasons for the last three. Include the tested revision/diff scope and execution date. Skipped tests do not prove the relevant behavior.
53+
- Keep change-specific review and verification summaries in the bilingual PRD by default. Separate evidence artifacts are optional when useful; OpenSpec and a multi-report hierarchy are not prerequisites.
54+
55+
## Git and execution safety
56+
57+
- Do not use `codex/` as a branch name prefix. Use semantic prefixes such as `feat/`, `fix/`, `chore/`, or `docs/`, with a name reflecting the requirement.
58+
- After creating or switching to a new branch, run `git pull` before development. If no upstream exists or synchronization fails, resolve the target explicitly rather than guessing or bypassing the requirement.
59+
- Before committing, fetch the latest remote code, rebase the branch onto the intended remote base, then run pre-commit and unit tests. Preserve unrelated user changes and stop if safe synchronization requires a user decision.
60+
- Commit only changes related to the current feature or fix. Commit, push, PR creation, publication, and deployment require user authorization; approval of a design does not authorize them.
61+
- Never commit real security-sensitive information or private data to GitHub. This includes API keys, access keys, secret keys, bearer/session/refresh tokens, cookies, signed URLs, private certificates, production logs with credentials, personal data dumps, and cloud account secrets. Use placeholders, environment variables, secret references, or documented local-only setup instead.
62+
- The repository pre-commit configuration must reject hardcoded API key and token material before a commit is created. If secret scanning reports a finding, stop and remove or redact the value rather than bypassing the hook.
63+
- When execution hits a pitfall such as insufficient permissions or missing dependencies, ask the user whether to document that pitfall. Report blocked checks honestly and do not alter machine-global configuration or bypass gates to hide the issue.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "MPA P0 benchmark report",
4+
"type": "object",
5+
"additionalProperties": false,
6+
"required": [
7+
"schemaVersion", "revision", "endpoint", "warmupCount",
8+
"requestCount", "concurrency", "p50Milliseconds",
9+
"p95Milliseconds", "maxMilliseconds", "errorRate"
10+
],
11+
"properties": {
12+
"schemaVersion": {"const": 1},
13+
"revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
14+
"endpoint": {"type": "string", "minLength": 1},
15+
"warmupCount": {"const": 5},
16+
"requestCount": {"const": 100},
17+
"concurrency": {"const": 10},
18+
"p50Milliseconds": {"type": "number", "minimum": 0},
19+
"p95Milliseconds": {"type": "number", "minimum": 0},
20+
"maxMilliseconds": {"type": "number", "minimum": 0},
21+
"errorRate": {"type": "number", "minimum": 0, "maximum": 1}
22+
}
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"schemaVersion": 1,
3+
"rules": [
4+
{
5+
"id": "p0-codex-rest-v1",
6+
"mpaProfileSchemaVersion": 1,
7+
"agentkitSdkVersion": "0.8.5",
8+
"runtimeExecutionCapability": "urn:veadk:mpa:execution:v1",
9+
"sessionExecutionConfigSchemaVersion": 1,
10+
"workerProtocol": "codex",
11+
"workerRequiredEndpoints": [
12+
"/health",
13+
"/ready",
14+
"/v1/sessions",
15+
"/v1/sessions/{session_id}/turns",
16+
"/v1/sessions/{session_id}/events"
17+
]
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)