- TypeScript 97%
- Shell 2.3%
- Python 0.5%
- Dockerfile 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| docs | ||
| prisma | ||
| release | ||
| scripts | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .npmrc | ||
| .secretlintignore | ||
| .secretlintrc.json | ||
| AGENTS.md | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| LICENSE | ||
| NOTICE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| prisma.config.ts | ||
| README.md | ||
| SECURITY.md | ||
| SUPPORT.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
xtrape-platform-ce
改名说明(server-ce#145):本仓库即 Xtrape Platform CE(formerly
xtrape-server-ce;物理仓库改名按 #145 分阶段进行)。环境变量 canonical 前缀为PLATFORM_CE_*;SERVER_CE_*作为 deprecated 兼容别名继续可用(启动时一次性告警)。
状态(0.7.1 baseline):
- 已交付:Registry / Heartbeat / Message route、Prisma SQLite 持久化、DB 管理凭据 (registration token → per-instance access token、control client、operator principal)、 操作员会话与 RBAC(viewer / operator / owner)、governed Checkpoint invocation 执行 (前 Checkpoint 时代的两阶段 prepare → execute 门已随 docs#282 删除)、 异步命令(202 ack + 结果回调)、命令历史持久化与保留、审批网关(approvalId 重入)、 审计事件与 actorId / traceId 归因、Telegram 一次性链接绑定。
- 开发专用:
PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANE仅限开发环境 (生产启动即拒)。控制面认证唯一路径为 DB 管理凭据(无 env 密钥)。- 后续(0.7.2–0.7.6 公开发布列车,xtrape-docs#64):运维完备(分页 / metrics / 保留任务)、 持久命令内核与敏感结果语义、connector 发起的 long-poll 传输、OSS RC 与正式发布。
xtrape-platform-ce 是 Xtrape Platform 的 CE 实现:无头(UI 无关)的注册、身份、
授权、调用、路由、持久化与审计权威。它不是 Panel 的后端实现,也不实现一个可被
替换的「Panel 功能角色」。
Platform 承担服务注册与发现、Worker(注册的运行时实体)、Connector 心跳、消息路由、 运行状态、审批 / 审计、Checkpoint 治理与生命周期管理。Panel、Telegram 和 Xtrape Exposure 是并列的 Interaction Layer 产品:它们通过 Platform 的 Interaction API 使用这些能力, 而不共享或复制 Platform 权威。
运行时叙事的起点是 Widget(本仓不拥有 Widget,但概念上:Widget --start/deploy--> Service --has/uses--> Worker,见 xtrape-docs docs/concepts/09-platform-object-model.md):可部署的是
Widget,不是 Service——Service 是首个 Worker 注册(或 World B provision)时 Platform 创建的逻辑
Service,Worker 是其运行时实体。Runner 已退役,不再引入。
World B 权威描述符
World B 首次 provision 不再只探测一个可变的 /actions 列表。生产路径会使用
service-issued callback token 读取单次、原子的 /descriptor 快照,并严格校验:
- 完整
ServiceManifest的 Service 身份; - content-addressed input/output schema records;
- immutable Checkpoint definitions;
- 每个 Action 与一个 Checkpoint version 的一对一绑定。
兼容旧 Connector 时,只有 /descriptor 明确返回 404(没有 governed descriptor)才会
继续用同一凭据验证 legacy /actions;任何已存在但非法、未授权或不可达的 descriptor 都会
fail closed,不允许降级绕过治理。Platform 将 currentAuthorityMode = GOVERNED | LEGACY 作为
与 catalog pointer 同时激活的持久事实,不从 Action 内容反推;因此空 Action/Checkpoint 的
governed snapshot 仍然是 governed。已有 governed catalog 的 Service 之后即使返回 404,也不能
通过 re-provision 静默清除 authority pointer;withdrawal 必须使用未来的显式治理操作。
同一保护也位于普通 catalog activation 的最终持久化边界:较早开始的 legacy /actions dial
不能在并发的 governed activation 完成后,用过期结果覆盖 GOVERNED mode 或 pointer。
所有 activation(包括 GOVERNED → GOVERNED)都以 stage 时读取的 mode + pointer 为期望前值
执行 CAS;并发发布中失去竞态的一方收到 AUTHORITY_ACTIVATION_CONFLICT,不会把较新的 snapshot
回拨。World B governed snapshot 的升级通过重新 provision 完成,并遵循相同 CAS。
升级 migration 会把旧版本已经写入 currentCatalogDigest 的历史 live /actions catalog 明确
backfill 为 LEGACY,避免把合法旧 Service 错判为 governed。
Platform 在任何 descriptor member 写入前完成全批 preflight,包括 CE tenant、schema digest/
dialect、所有 immutable Checkpoint conflict,以及 catalog sensitivity admission。通过后只暂存
content-addressed schema、immutable Checkpoint 和 catalog revision,最后在同一个数据库事务中
同时切换 World B runtime route/credential/incarnation/manifest 与 catalog revision pointer。
相应的 catalog activation 与 INSTANCE_PROVISIONED audit 也属于同一个事务;audit 失败会回滚
runtime 和 authority,而不是返回失败后留下已生效的新部署。World A catalog pointer 与其 activation
audit 同样原子提交。
激活前的暂存项不会进入 discovery;re-provision 失败时旧 runtime 与旧 snapshot 会作为完整的一对
继续有效。Discovery authority rule:对于非 self Service,PUBLISHED 只表示 immutable
Checkpoint definition 已登记;
只有当前 GOVERNED snapshot 中存在 exact Action→Checkpoint binding 时才进入 discovery。legacy
或 orphan Checkpoint 会 fail closed,并在 CHECKPOINT_DISCOVERY_QUERIED audit metadata 的
withheldUnboundPublished 中留下数量信号,而不是静默成为可见 authority。
Checkpoint-bound Action 在只读 GET /v1/actions catalog 中保留精确的 checkpoint 绑定。
这只是 Service 的操作目录,不授予调用权限。前 Checkpoint 时代的
执行入口(POST /v1/actions/:svc/:name/prepare|execute 与 POST /v1/commands/:id/execute)
已随 docs#282 删除:governed 执行只经 Checkpoint invocation wire 进入。
已准入的两阶段 Action 在 LONG_POLL 和 World B 上都经受治理的 review → execute 调用,
不再套用 legacy 同步 prepare 的 PREPARE_UNSUPPORTED_ON_TRANSPORT 标记(#338)。
requiresPrepare 保留为 true,调用方仍需完成 review 并携带 reviewRef;两个阶段的
Resource / authorization / controls 均由 invocation 路径重新检查。未绑定 Checkpoint 的
legacy catalog 仍保留原传输限制;Worker 自报但未准入的绑定不能解除限制。
窄范围旧单元测试仍可注入不含 authority services 的 Registry,但应用实际依赖注入始终启用完整路径。
Resource extractor artifact 基础(#206)
Platform 现在可以准入并持久化 immutable、content-addressed Resource extractor artifact,
但尚未据此开放外部 Service 的 governed invocation。首个 execution profile 是纯声明式
JSON Pointer 映射,并且是以 Checkpoint 的精确 parameter-normalization digest 为变量的
content-addressed record family,不是可漂移的单一符号 profile。
它只把参数中的字符串或 artifact 中的 literal 组装为 canonical ResourceReference;禁止网络、
文件系统、时钟、locale、环境变量、import 和任意代码执行。artifact 必须是精确 RFC 8785
canonical JSON bytes,media type 必须是
application/vnd.xtrape.static-resource-extractor.v1+json。Platform 消费
@xtrape/contracts 0.8.12 的 grammar、pointer parser、limits 和 23 条共享 conformance vectors;
执行只读取已经完成 stage-1 normalization 的参数,不再次改写。确定性失败收敛为
pointer-unresolved、type-mismatch、invalid-id、limit-exceeded、artifact-invalid,且不产生
部分 Resource。Platform 在 Checkpoint normalization mapping 首次绑定前验证 artifact、profile、
grammar/output schema digest 与 normalization digest 的精确一致性。
- Worker publication:
POST /v1/instances/:instanceId/resource-extractor-artifacts,只接受该 instance 自己的 access token; - control-plane seed/recovery:
POST /v1/admin/resource-extractor-artifacts; - control-plane read:
GET /v1/admin/resource-extractor-artifacts/:digest; - profile-family admission:
POST /v1/admin/resource-extractor-execution-profiles(由 control plane 指定已注册的 parameter-normalization profile digest); - profile introspection:
GET /v1/admin/resource-extractor-execution-profiles/:digest。
这是后续「先提取 normalized Resource,再授权/审批,最后 dispatch」的独立基础切片。 在完整链路合并前,Forgejo Ops 仍保持 57 dormant / 0 exposed domain Actions。
Interaction Layer 产品可替换
Platform 核心与交互前端解耦。交互端是并列、可替换的 Interaction Layer 产品:
| 交互端 | 状态 |
|---|---|
Telegram(xtrape-telegram) |
Telegram Interaction Layer 产品 |
xtrape-panel-ce |
Web operator Interaction Layer 产品 |
xtrape-exposure |
AI-facing Interaction Layer 产品(包含 MCP 投影) |
| console / mobile / CLI | 未来的 Interaction Layer 产品 |
融合决策见
xtrape-docs/docs/reference/04-runtime-direction-reconciliation.md(D3 / D4)。 当前原则:Platform 是权威,Panel 是产品。Panel 可被其他 Interaction Layer 产品 补充或替换,但任何 Interaction Layer 产品都不因此成为第二个控制面。
与相关仓库的关系
| 仓库 | 角色 |
|---|---|
xtrape-platform-ce(本仓库) |
CE Platform 权威:身份、注册、授权、调用、路由、审计与持久化 |
xtrape-panel-ce |
Web operator Interaction Layer 前端 |
xtrape-telegram |
Telegram Interaction Layer adapter |
xtrape-exposure |
AI-facing Interaction Layer 与 MCP 协议投影 |
xtrape-connector-nodejs(formerly xtrape-agent-nodejs) |
service 接入 SDK(注册 / 心跳 / 消息) |
xtrape-interaction-nodejs |
Interaction Layer ↔ Platform 合同;Panel、Telegram、Exposure 的目标依赖 |
xtrape-contracts-nodejs |
Widget / Connector ↔ Platform 合同;不是 Interaction Layer 合同 |
(xtrape-forge-ce 已归档,不属于当前产品族。)
技术栈(Phase 0 选择)
- TypeScript + Node.js LTS
- HTTP/API shell: NestJS
- Core domain: framework-independent services behind repository ports
- Local/test fallback:
InMemoryRepositorywhenDATABASE_URLis not set - CE durable persistence: Prisma + SQLite through
PrismaRepository; MySQL can be introduced later as a separate deployment profile.
Quick start
pnpm install
pnpm typecheck
pnpm test
pnpm build
Run the executable smoke paths:
pnpm smoke:phase0
pnpm smoke:persistence
Prepare local configuration and start the platform for manual probing. Credentials are DB-managed (no env tokens); two supported paths:
Local dev — open control plane (no credentials):
cp .env.example .env
# Review DATABASE_URL and PLATFORM_CE_ALLOWED_INSTANCE_HOSTS.
# (Deprecated alias: the older SERVER_CE_* names still work with a one-time warning.)
DATABASE_URL=file:./dev.db \
PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANE=true \
PLATFORM_CE_ALLOWED_INSTANCE_HOSTS=127.0.0.1,localhost \
pnpm dev
PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANE=true opens the whole control plane for
local use only — production refuses to start with it set.
DB-managed (production-shaped):
touch dev.db
pnpm db:migrate:deploy # create tables
DATABASE_URL=file:./dev.db pnpm build
DATABASE_URL=file:./dev.db pnpm bootstrap:control-client --name panel # prints a one-time control token
DATABASE_URL=file:./dev.db pnpm start
# then create service registration tokens via Panel / POST /v1/admin/registration-tokens
Then verify the health endpoint:
curl http://localhost:3000/health
Single-tenant boundary (0.7.x, server-ce#85)
CE 0.7.x carries a tenant column for forward compatibility but provides no
real tenant isolation in identity, uniqueness or authorization. The only
supported tenant is default:
- registration (manifest/instance
tenant), registration-token creation (POST /v1/admin/registration-tokens) and routed messages reject any other value with a stable422 UNSUPPORTED_TENANT— never silently coerced; - request-body
tenantcannot override the authenticated scope (persist-only and audit rows take the tenant from the verified instance/service); - on startup the platform refuses to boot if the database already holds rows under a non-default tenant (data from an earlier build) — migrate or remove them first; nothing is silently discarded.
True multi-tenancy (composite identity, routing, administration) is deferred to server-ce#60. This is a known 0.7.6 limitation.
Exposure boundary (0.7.1)
Auth/RBAC and durable persistence are delivered; the remaining boundary rules for anything beyond trusted-internal deployment are:
- terminate TLS in front of the platform and serve Panel from the same origin so
session cookies can be
Secure; - run
pnpm db:migrate:deploybefore start (empty-database and incremental 0.7.x upgrade paths are both verified); - bootstrap the first owner/admin principal explicitly (first-run bootstrap, server-ce#82) — never ship default credentials;
PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANEmust never be set in production (startup refuses it whenNODE_ENV=production).PLATFORM_CE_CHECKPOINT_AUTHORIZATIONstaysenforce(the default);shadowonly records decisions without applying them and is a rollout aid, never a production posture. Governed invocation is deny-by-default (arch/16 §17.4.4): seed Account entitlements, Checkpoint normalization-profile bindings and scoped Account Tokens through the admin plane before expecting anallow.
For any environment beyond local-only testing, set:
PORT=3000
# xtrape-server-ce.db is a FROZEN on-disk filename (pre-rename): changing it
# would strand the data in existing deployments' mounted volumes.
DATABASE_URL=file:/app/data/xtrape-server-ce.db
PLATFORM_CE_ALLOWED_INSTANCE_HOSTS=demo-worker.internal,connector-host.internal
HEARTBEAT_TIMEOUT_MS=30000
PLATFORM_CE_ALLOWED_INSTANCE_HOSTS limits registered instance.address hosts
before message forwarding can target them. An empty host allowlist preserves
local development compatibility only.
Retention (one merged sweeper on the command cadence): command history is
pruned by COMMAND_RETENTION_DAYS/COMMAND_RETENTION_MAX (defaults 90 d /
10 000 rows, sweep hourly via COMMAND_RETENTION_SWEEP_MS; server-ce#51), and
audit events by AUDIT_RETENTION_DAYS/AUDIT_RETENTION_MAX (defaults 180 d /
50 000 rows; server-ce#59). Each audit sweep that deletes anything records its
own AUDIT_RETENTION_SWEPT audit event in the same transaction as the
deletion (removal and its trace commit or fail together), and the cap counts
that event too, so the table never exceeds AUDIT_RETENTION_MAX and an at-cap
table is a stable no-op. Both sweeps feed xtrape_retention_pruned_total on
/metrics.
There are no control/registration tokens in env — all credentials are DB-managed (see below).
DB-managed credentials (0.6.x, server-ce#19/#22)
Credentials are per identity, stored only as hashes, and managed in the database — nothing secret in env.
Migration note (0.7.2, server-ce#83): transitional HTTP Basic Auth was removed.
XTRAPE_ADMIN_USERNAME/XTRAPE_ADMIN_PASSWORDare no longer read — anAuthorization: Basic …header on a guarded route now gets401(public routes such asGET /healthandPOST /v1/auth/loginare unaffected). A deployment that relied only on Basic Auth has no DB-managed admin credential yet, so recover with the no-credential local bootstrap CLI (not the admin-guardedPOST /v1/admin/control-clients):# xtrape-server-ce.db: frozen on-disk filename (see the deployment env block above). DATABASE_URL=file:/app/data/xtrape-server-ce.db pnpm bootstrap:control-client --name bootstrap # prints a one-time admin control token; or add --panel-operator/--panel-role # to seed a first-run owner (server-ce#82) and use operator login instead.Once you hold an admin token,
POST /v1/admin/control-clientsissues further clients at runtime. The control-client / operator-token / channel-token model is unchanged. The public routes areGET /health(liveness) andGET /ready(readiness),GET /v1/system/version(read before login for the Panel version/contract handshake),POST /v1/instances(registration, gated by a DB-managed registration token in thex-xtrape-registration-tokenheader),POST /v1/auth/login(password in the body), and the Telegram link/session redemption endpoints.GET /metricsis guarded by default and only becomes public whenPLATFORM_CE_PUBLIC_METRICS=true(intended for the internal plane behind a reverse proxy — it exposes service/instance ids and health). Everything else requires a resolved identity.
Control-plane clients (Panel, Telegram, future consoles) — each holds its own revocable token, added/removed at runtime with no env edit or restart:
POST /v1/admin/control-clients{ name, role? }→ one-time plaintext + hash-free record.roleisoperator(default) oradmin(server-ce#31).GET /v1/admin/control-clients— list (no hashes)POST /v1/admin/control-clients/:id/revoke- A guarded request authenticates its token (
x-xtrape-control-tokenorAuthorization: Bearer) against theControlClienttable and records the acting client for audit.
Control-plane scope (server-ce#31). Provisioning routes that mint or revoke
credentials/identities — POST/DELETE on /v1/admin/registration-tokens,
/v1/admin/control-clients, /v1/admin/principals — require an admin-scoped
client. operator-scoped clients may use every other guarded route (including the
GET lists). This keeps a browser-held operator token from escalating by minting
new credentials. Create operator-scoped clients for Panel/Telegram; keep admin
for bootstrap/automation.
Registration → access tokens (services):
POST /v1/admin/registration-tokens{ name, serviceId?, expiresAt?, permissions? }→ one-time plaintext + record; plusGET(list) andPOST /:id/revoke.permissionsis an optional capability grant (deny-by-default; allow-list["conversation.create"], server-ce#94) propagated to any instance registered with the token.POST /v1/instancesrequires a registration token (x-xtrape-registration-token) and exchanges it for a per-instance access token returned asaccessToken; re-registration rotates (revokes the previous one). The instance then authenticatesheartbeat/deregisterwith its access token (bound to its id).
Operator login → session tokens (humans, server-ce#31):
- A panel-operator has a
Principalwith a salted scrypt password. Set/reset it withPOST /v1/admin/principals/set-password{ externalId, password }(admin), or provision at create time viaPOST /v1/admin/principals{ ..., password }. POST /v1/auth/login{ username, password }(public) exchanges the password for a short-lived operator session token (xtrape_op_…, TTLOPERATOR_TOKEN_TTL_SECONDS, default 12h); re-login rotates the prior token. The browser holds this token instead of a control-client credential.GET /v1/auth/whoamireturns the verified caller identity + scope;POST /v1/auth/logoutrevokes the presented session token.- Operator sessions are operator-scoped (never reach provisioning routes), and
/v1/authz/checkauthorizes the authenticated operator — the request body cannot assert a different identity.
Session cookie + brute-force protection (server-ce#57):
-
POST /v1/auth/loginalso sets an httpOnlyxtrape_sessioncookie (SameSite=Lax,Path=/,maxAge= token TTL) carrying the operator token, so the browser session is not readable from JavaScript. The token stays in the response body for non-browser API clients. The guard accepts the token from the cookie orAuthorization: Bearer;POST /v1/auth/logoutclears the cookie and revokes the token. Disabling a principal or changing its password revokes all active sessions immediately (server-ce#58). -
The cookie is marked
SecurewhenNODE_ENV=production, so terminate TLS at the same-origin reverse proxy in front of this platform (canonical public path/platform-ce;/server-ceis the frozen deprecated leg) — over plain HTTP a Secure cookie is dropped. Keep the Panel and platform-ce same-origin soSameSiteapplies. -
Failed logins are throttled per
IP + usernamewith exponential backoff (429 +Retry-After). Tune withLOGIN_MAX_FAILURES(default 5),LOGIN_FAILURE_WINDOW_MS,LOGIN_LOCKOUT_BASE_MS,LOGIN_LOCKOUT_MAX_MS. This is process-local; for defense-in-depth also add a coarse connection/route limit at the reverse proxy, e.g. nginx:limit_req_zone $binary_remote_addr zone=login:10m rate=10r/m; # Canonical public path. Repeat the same block for the deprecated # /server-ce/v1/auth/login leg while any deployment still serves it. location /platform-ce/v1/auth/login { limit_req zone=login burst=5 nodelay; proxy_set_header X-Real-IP $remote_addr; # trusted client IP for the app-side throttle proxy_pass http://platform_ce; # example-local upstream name }The app throttle keys on
X-Real-IP(set here to the real$remote_addr); it falls back toX-Forwarded-Foronly whenX-Real-IPis absent. Do not pass a client-suppliedX-Real-IPthrough — thisproxy_set_headeroverwrites it.
Bootstrap (no chicken-and-egg, no env secret): seed the first control client with the local CLI against the live DB, then provision everything else from Panel:
node dist/bootstrap.js --name bootstrap # seeds an ADMIN control client by default
# or a least-privilege client: node dist/bootstrap.js --name panel --role operator
# (compose) docker compose exec server node dist/bootstrap.js --name bootstrap
# `server` is the frozen compose service name in the public xtrape-stack
# quickstart; the private xtrape-deployment compose calls it xtrape-server-ce.
Local dev: set PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANE=true to open the whole
control plane (no auth) instead of provisioning DB credentials. Refused in
production — startup fails if it is set with NODE_ENV=production.
Operator role matrix (server-ce#49, enforced by the guard on operator sessions; control clients keep their own admin/operator scope):
| Capability | viewer | operator | owner |
|---|---|---|---|
Reads/lists (GET, incl. provisioning lists) |
✅ | ✅ | ✅ |
Self-service auth (logout, change-password, authz/check) |
✅ | ✅ | ✅ |
| Writes (send messages, revoke devices, cancel commands; execution itself enters via the Checkpoint invocation wire — the legacy execute/prepare doors are deleted, docs#282) | ❌ 403 | ✅ | ✅ |
| Provisioning writes (mint/revoke credentials, principals) | ❌ | ❌ | ❌* |
* Operator sessions never reach provisioning writes regardless of role (#31);
whether owner gets an exception is tracked in #48 (pending operator decision).
In PLATFORM_CE_ALLOW_INSECURE_CONTROL_PLANE=true dev mode the matrix is not
enforced — dev stays open by design.
Durable persistence
When DATABASE_URL is set, NestJS binds PLATFORM_REPOSITORY to
PrismaRepository. SQLite migrations live under prisma/migrations; deployable
runtime startup must apply them before serving traffic:
# xtrape-server-ce.db: frozen on-disk filename, not a stale rename.
touch /app/data/xtrape-server-ce.db
pnpm db:migrate:deploy
node dist/main.js
The included Dockerfile uses DATABASE_URL=file:/app/data/xtrape-server-ce.db
(frozen filename) and runs the same migration step before starting the platform.
API surface (0.7.1)
GET /healthexposes a lightweight service health probe.POST /v1/instancesregisters a Worker (the runtime entity). The/v1/instancesroute and theinstanceIdpayload key are frozen 0.7.x wire bytes; the entity they register is conceptually a Worker (Service Instanceis not a separate object — xtrape-docs#199 D13).POST /v1/instances/:id/heartbeatrecords heartbeat freshness.DELETE /v1/instances/:idderegisters an instance.GET /v1/serviceslists known services.GET /v1/services/:id/instanceslists instances for one service.POST /v1/messagesroutes a control-plane message to a target instance.GET /v1/conversationslists conversations, newest first (server-ce#55). Filter + pagination:targetType,targetId,senderId,since/until(ISO oncreatedAt),offset,limit(default 50, max 200). Returns{ items, total, offset, limit }.GET /v1/conversations/:conversationId/messagesreads one conversation's messages in causal (seq) order, oldest first (server-ce#63/#55). Pagination:offset,limit. Returns{ conversation, messages: { items, total, offset, limit } };404 UNKNOWN_CONVERSATIONfor an unknown id.POST /v1/instances/:instanceId/messagespersists a service-originated message without forwarding (server-ce#63/#55). Authenticated by the instance's access token bound to:instanceId;senderTypemust beSERVICEandsenderIdmust equal the instance'sserviceId. A service may append to a conversation it participates in (one it originated, or one targeted at its service); posting into another service's conversation returns403, andtenant/counterparty come from the stored conversation, not the body. Starting a new conversation (an absentconversationId) is a privileged grant, deny-by-default: only an instance whose registration token was grantedconversation.create(server-ce#94) may do it — e.g. an ops/approval service initiating a thread to the user; an ungranted identity gets404 UNKNOWN_CONVERSATIONwith no write.GET /v1/actionslists operator-triggerable actions advertised by healthy instances. (The pre-Checkpoint execution doors —POST /v1/actions/:serviceId/:actionName/prepare|executeandPOST /v1/commands/:commandId/execute— are deleted, docs#282; execution enters through the Checkpoint invocation wire.)GET /v1/commandslists persisted action commands with status and provenance. Server-side filter + pagination (server-ce#54):serviceId,actionName,status,since/until(ISO oncreatedAt),offset,limit(default 50, max 200). Returns{ items, total, offset, limit }.POST /v1/instances/:instanceId/commands/:commandId/result— async action outcome reported by the worker instance (per-instance access token; server-ce#41 Stage B).GET /v1/audit-eventslists audit events (registration, health transitions, deregistration, message routing, command lifecycle, approvals, operator actions with actorId/traceId provenance). Server-side filter + pagination (server-ce#54):type,actorId,since/until,offset,limit(default 50, max 200). Returns{ items, total, offset, limit }.GET /v1/system/versionreturns{ version, edition: "ce", commit?, buildTime?, contractVersion }for the Panel version/contract handshake (server-ce#56; public — read before login).version/commit/buildTimecome fromPLATFORM_CE_VERSION/PLATFORM_CE_COMMIT/PLATFORM_CE_BUILD_TIMEwhen set, else package.json.GET /metricsexposes Prometheus text-format metrics (server-ce#56), gathered from the repository at scrape time:xtrape_server_info,xtrape_commands{status}(current-count gauge, not a monotonic_total),xtrape_command_duration_ms_sum/_count(over finished commands, retention-affected),xtrape_instances{health},xtrape_instance_heartbeat_age_seconds{service,instance}, andxtrape_retention_pruned_total{kind="command"|"audit"}(rows removed by the retention sweeps since process start — a true counter fed by the sweepers, resets on restart; server-ce#59). Guarded by default (it exposes service/instance ids and health) — use a control credential, or setPLATFORM_CE_PUBLIC_METRICS=trueto allow anonymous scraping on the internal plane only.GET /health(liveness) andGET /ready(readiness — 200 only when the repository/DB is reachable; the container HEALTHCHECK uses this). Both public.
The implementation is intentionally headless: no Web UI code lives in this repository.
Migration from legacy backend
The legacy Panel backend xtrape-panel-ce/apps/opstage-backend has been removed
from Panel CE (xtrape-panel-ce now ships only apps/panel-ui). The migration
classification — what had to migrate, what was redesigned, what stays
compatibility-only, and what moved elsewhere — is kept as a historical record in
docs/migration-from-opstage-backend.md.
Product smoke and compatibility-name retirement plans are tracked in:
Compatibility with xtrape-panel-ce
xtrape-panel-ce is the Web operator UI frontend. It is a pure frontend against
this repository's open API — no BFF, no business backend, no Panel-owned
database. The browser always reaches this platform same-origin: in a
deployment through the Panel Nginx, at the canonical /platform-ce path or the
deprecated /server-ce leg; in local development through Panel's Vite dev proxy
on /server-ce. This platform enables no CORS, so a cross-origin base URL
(XTRAPE_SERVER_URL, frozen env name) only works for non-browser clients. This
platform must not assume Panel Web UI specifics.
实现入口
按方向文档 §26.4 拆分推进,先落地 Phase 0 最小闭环:
Service -> Worker -> Connector register -> Heartbeat -> Message route -> Service reply
对应文档:01-phase-0-runtime-mvp.md、02-service-manifest-schema.md、
03-message-protocol-schema.md、04-agent-registration-heartbeat.md。
命名 / 概念以现行
xtrape-docs架构为准。