proteum 2.1.0-2 → 2.1.0-4
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/AGENTS.md +51 -93
- package/README.md +46 -1
- package/agents/framework/AGENTS.md +167 -788
- package/agents/project/AGENTS.md +87 -110
- package/agents/project/client/AGENTS.md +22 -93
- package/agents/project/client/pages/AGENTS.md +24 -26
- package/agents/project/server/routes/AGENTS.md +10 -8
- package/agents/project/server/services/AGENTS.md +22 -159
- package/agents/project/tests/AGENTS.md +11 -8
- package/cli/bin.js +8 -0
- package/cli/commands/dev.ts +1 -0
- package/cli/commands/trace.ts +210 -0
- package/cli/compiler/client/index.ts +30 -8
- package/cli/compiler/server/index.ts +28 -6
- package/cli/paths.ts +16 -1
- package/cli/presentation/commands.ts +23 -1
- package/cli/presentation/devSession.ts +5 -0
- package/cli/runtime/commands.ts +31 -0
- package/common/dev/requestTrace.ts +81 -0
- package/docs/request-tracing.md +121 -0
- package/package.json +1 -1
- package/server/app/container/config.ts +15 -0
- package/server/app/container/index.ts +3 -0
- package/server/app/container/trace/index.ts +284 -0
- package/server/services/prisma/index.ts +61 -5
- package/server/services/router/http/index.ts +40 -0
- package/server/services/router/index.ts +159 -6
- package/server/services/router/response/index.ts +80 -7
- package/server/services/router/response/page/document.tsx +16 -0
- package/server/services/router/response/page/index.tsx +27 -1
- package/Rte.zip +0 -0
- package/agents/project/agents.md.zip +0 -0
- package/doc/TODO.md +0 -71
- package/doc/front/router.md +0 -27
- package/doc/workspace/workspace.png +0 -0
- package/doc/workspace/workspace2.png +0 -0
- package/doc/workspace/workspace_26.01.22.png +0 -0
- package/server/services/router/http/session.ts.old +0 -40
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
# Proteum
|
|
1
|
+
# Proteum Core
|
|
2
|
+
|
|
3
|
+
This file governs work in the Proteum framework repository itself.
|
|
4
|
+
|
|
5
|
+
For the canonical Proteum app contract used by downstream projects, use `agents/framework/AGENTS.md`.
|
|
2
6
|
|
|
3
7
|
## Vision
|
|
4
8
|
|
|
5
9
|
Proteum aims to become the first SSR / SEO / TypeScript framework built primarily for non-human developers and AI agents.
|
|
6
10
|
|
|
7
|
-
The framework should maximize LLM efficiency, correctness, determinism, and performance when building Proteum-based projects.
|
|
8
|
-
|
|
9
11
|
When tradeoffs exist, prioritize framework decisions in this order:
|
|
10
12
|
|
|
11
13
|
1. Reduce shipped client bundle size and unnecessary runtime code.
|
|
@@ -13,101 +15,57 @@ When tradeoffs exist, prioritize framework decisions in this order:
|
|
|
13
15
|
3. Improve SEO output and LLM-friendly, crawlable, semantic HTML.
|
|
14
16
|
4. Preserve explicit, typed, machine-readable contracts for agents.
|
|
15
17
|
|
|
16
|
-
When working on Proteum itself
|
|
17
|
-
|
|
18
|
-
- Prefer explicit, typed, machine-readable contracts over implicit runtime magic, hidden conventions, ambient globals, or tribal knowledge.
|
|
19
|
-
- Enforce strong, consistent TypeScript typings across the whole project. Do not introduce `any` or `unknown`.
|
|
20
|
-
- Make routes, data loading, server actions / controllers, services, SEO metadata, sitemap generation, static generation, and environment contracts easy to discover, inspect, and explain.
|
|
21
|
-
- Treat SSR and SEO as first-class framework primitives, not app-level patchwork.
|
|
22
|
-
- Prefer server-first designs that avoid shipping client JavaScript unless it is required for user-facing behavior.
|
|
23
|
-
- Favor small, single-purpose files and modules that reduce context load and make edits easier for agents to scope safely.
|
|
24
|
-
- Generated code should improve traceability and type safety, not obscure behavior. It should be deterministic, auditable, and easy for agents to map back to source files.
|
|
25
|
-
- Prefer inference from the explicit application class in `server/index.ts` whenever possible. Treat `server/index.ts` as the canonical type root for application services, router services, router context, and models instead of duplicating manual type declarations.
|
|
26
|
-
- Prefer exact end-to-end contracts for inputs, outputs, errors, side effects, and caching behavior.
|
|
27
|
-
- Prefer framework features that make impact analysis, verification, and debugging easier for agents.
|
|
28
|
-
- Prefer output that is fast to render, easy to crawl, semantically rich, and easy for LLMs to parse reliably.
|
|
29
|
-
- Avoid introducing abstractions that require broad codebase memory to use correctly.
|
|
18
|
+
When working on Proteum itself:
|
|
30
19
|
|
|
31
|
-
|
|
20
|
+
- prefer explicit, typed, machine-readable contracts over runtime magic or hidden conventions
|
|
21
|
+
- keep `server/index.ts` as the canonical type root for app services, router services, request context, and models
|
|
22
|
+
- keep generated code deterministic, auditable, and easy to map back to source files
|
|
23
|
+
- prefer typed request traces and manifest-backed diagnostics over ad hoc runtime logging
|
|
24
|
+
- prefer deleting obsolete compatibility layers, helper indirection, and unused packages over preserving dead paths
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
## Workflow
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
- Every time I input error messages without any instructions, do not implement fixes. Instead, investigate the potential causes and, for each one:
|
|
29
|
+
1. evaluate or quantify the probability
|
|
30
|
+
2. explain why
|
|
31
|
+
3. suggest how to fix it
|
|
32
|
+
- When you have finished your work, summarize in one top-level short sentence all the changes you made since the beginning of the conversation. Output as `Commit message`. Max 90 characters.
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
Instead, ivestigate the potential causes of the errors, and for each:
|
|
39
|
-
1. Evaluate / quantify the probabiliies
|
|
40
|
-
2. Give why and
|
|
41
|
-
3. Suggest how to fix it
|
|
42
|
-
- When you have finished your work, summarize in one top-level short sentence ALL the changes you made since the beginning of the WHOLE conversation. Output as "Commit message". Max 90 characters.
|
|
34
|
+
## Framework Change Rules
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
When changing Proteum itself:
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- Treat these two projects as the reference surface for current Proteum usage and needs:
|
|
38
|
+
- validate the change against these two reference apps:
|
|
49
39
|
- `/Users/gaetan/Desktop/Projets/crosspath/platform`
|
|
50
40
|
- `/Users/gaetan/Desktop/Projets/unique.domains/website`
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- Show the target API with concrete client and server usage examples that match current Proteum conventions.
|
|
83
|
-
- Distinguish:
|
|
84
|
-
- the ideal end-state API
|
|
85
|
-
- any transitional migration rule or guardrail
|
|
86
|
-
- Call out what becomes impossible or safer after the change.
|
|
87
|
-
- If the change affects generated code, explain what source files drive generation and what artifacts are produced.
|
|
88
|
-
- If the change removes older behavior, explicitly name what is being deleted and why it is obsolete.
|
|
89
|
-
|
|
90
|
-
## Implementation Rules
|
|
91
|
-
|
|
92
|
-
- Keep framework changes aligned with the explicit controller/page architecture already adopted in the reference apps.
|
|
93
|
-
- Prefer deleting client-side code, dependencies, and emitted assets when the same capability can stay on the server or be generated statically.
|
|
94
|
-
- Prefer deleting obsolete branches, compatibility layers, plugins, and dependencies over keeping dead paths around.
|
|
95
|
-
- Prefer compiler logic that is deterministic, auditable, and easy for another agent to trace from source to generated output.
|
|
96
|
-
- Prefer local destructuring that exposes typed app services, router services, router context values, and models in the current block scope before use, instead of chaining through `this.request`, `this.app`, or `this.app.Models.client` at each call site.
|
|
97
|
-
- Reject changes that increase bundle size, runtime cost, or crawlability risk unless the benefit is concrete and validated in both reference apps.
|
|
98
|
-
- When removing old behavior, also remove the related packages, config flags, typings, docs, and dead helper files in the same pass when safe.
|
|
99
|
-
- If a core change breaks one of the reference apps, keep iterating until the framework and the affected app usage are both corrected.
|
|
100
|
-
|
|
101
|
-
## Real-World Validation
|
|
102
|
-
|
|
103
|
-
Do not stop at static analysis or isolated core compilation when the change affects runtime behavior.
|
|
104
|
-
|
|
105
|
-
- Validate framework changes against the two reference apps whenever the change touches routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets.
|
|
106
|
-
- Preferred runtime validation:
|
|
107
|
-
- run `npx proteum dev --no-cache -port 3xxx` in both apps on explicit ports
|
|
108
|
-
- open the real pages with Playwright
|
|
109
|
-
- inspect browser console errors and warnings
|
|
110
|
-
- inspect server startup and runtime errors
|
|
111
|
-
- Build-only checks are not sufficient for runtime/compiler changes. Use them as supplements, not as the final proof.
|
|
112
|
-
- Keep fixing regressions exposed by the dev-server and browser pass until both apps boot and the browser console shows no new real errors.
|
|
113
|
-
- Treat external/local-environment warnings separately from framework regressions, and say clearly when something is unrelated to the current change.
|
|
41
|
+
- inspect how both apps currently use the feature, runtime, API, compiler behavior, or generated files before proposing or implementing a core change
|
|
42
|
+
- prefer removing framework magic when the same result can be expressed with explicit runtime contracts, generated code, or typed context
|
|
43
|
+
- if a webpack plugin, Babel plugin, alias, helper, runtime service, or npm package is not meaningfully used by both apps, challenge its existence
|
|
44
|
+
- keep core changes aligned with the explicit controller/page architecture described in `agents/framework/AGENTS.md`
|
|
45
|
+
- remove related dead docs, config flags, helper files, and compatibility branches in the same pass when safe
|
|
46
|
+
|
|
47
|
+
## Proposal Rules
|
|
48
|
+
|
|
49
|
+
When proposing a core change:
|
|
50
|
+
|
|
51
|
+
- start from the concrete mismatch or risk seen in the reference apps
|
|
52
|
+
- show the target API with real client and server usage examples that match current Proteum conventions
|
|
53
|
+
- distinguish the ideal end-state API from any transitional migration rule
|
|
54
|
+
- explain which source files drive generated artifacts when generation changes
|
|
55
|
+
- explicitly name removed behavior and why it is obsolete
|
|
56
|
+
|
|
57
|
+
## Validation
|
|
58
|
+
|
|
59
|
+
Do not stop at static analysis when the change affects runtime behavior.
|
|
60
|
+
|
|
61
|
+
If a change touches routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets:
|
|
62
|
+
|
|
63
|
+
- run `npx proteum dev --no-cache --port 3xxx` in both reference apps on explicit ports
|
|
64
|
+
- use `proteum trace arm --capture deep`, reproduce the request once, then inspect `proteum trace latest` or `proteum trace show <requestId>` when the issue is request-time behavior
|
|
65
|
+
- open the real pages with Playwright
|
|
66
|
+
- inspect browser console errors and warnings
|
|
67
|
+
- inspect server startup and runtime errors
|
|
68
|
+
|
|
69
|
+
Build-only checks are supplements, not final proof.
|
|
70
|
+
|
|
71
|
+
Keep iterating until both apps boot and the browser console shows no new framework regressions. Treat unrelated environment warnings separately and call them out clearly.
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Proteum combines:
|
|
|
28
28
|
- **Explicit request entrypoints.** Controllers are classes. Request access is explicit through `this.request`.
|
|
29
29
|
- **Local validation.** Validate handler input inside the handler with `this.input(schema)`.
|
|
30
30
|
- **Deterministic generation.** Proteum owns `.proteum/` and regenerates it from source.
|
|
31
|
-
- **Explainability matters.** `proteum explain` and `proteum
|
|
31
|
+
- **Explainability matters.** `proteum explain`, `proteum doctor`, and `proteum trace` expose the framework view of your app and its live requests.
|
|
32
32
|
- **SEO is not an afterthought.** Identity, routes, layouts, and SSR data are part of the app contract.
|
|
33
33
|
|
|
34
34
|
## What a Proteum App Looks Like
|
|
@@ -236,6 +236,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
236
236
|
| `proteum build --prod` | Produce the production server and client bundles into `bin/` |
|
|
237
237
|
| `proteum doctor` | Inspect manifest diagnostics |
|
|
238
238
|
| `proteum explain` | Explain routes, controllers, services, layouts, conventions, and env |
|
|
239
|
+
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
239
240
|
| `proteum init` | Experimental project scaffolding when scaffold assets are installed |
|
|
240
241
|
|
|
241
242
|
Recommended daily workflow:
|
|
@@ -255,8 +256,50 @@ proteum doctor --json
|
|
|
255
256
|
proteum explain
|
|
256
257
|
proteum explain --routes --controllers
|
|
257
258
|
proteum explain --all --json
|
|
259
|
+
proteum trace requests
|
|
260
|
+
proteum trace arm --capture deep
|
|
261
|
+
proteum trace latest
|
|
258
262
|
```
|
|
259
263
|
|
|
264
|
+
## Request Tracing
|
|
265
|
+
|
|
266
|
+
Proteum includes a dev-only in-memory request trace buffer for routing, controller, context, SSR, and render debugging.
|
|
267
|
+
|
|
268
|
+
When diagnosing or testing against an app, first read the default port from `env.yaml` and check whether a server is already running there. If it is, inspect the existing traces before reproducing the issue so you can collect past errors and their context.
|
|
269
|
+
|
|
270
|
+
- `proteum trace requests`: list the most recent request summaries
|
|
271
|
+
- `proteum trace latest`: show the latest captured request
|
|
272
|
+
- `proteum trace show <requestId>`: inspect one trace in detail
|
|
273
|
+
- `proteum trace arm --capture deep`: force the next request into deep capture mode
|
|
274
|
+
- `proteum trace export <requestId>`: write one trace to disk
|
|
275
|
+
- `proteum trace latest --url http://127.0.0.1:3010`: target a non-standard dev base URL directly
|
|
276
|
+
|
|
277
|
+
Default behavior:
|
|
278
|
+
|
|
279
|
+
- tracing is enabled only in `profile: dev`
|
|
280
|
+
- traces live in memory and are bounded by `trace.requestsLimit` and `trace.eventsLimit`
|
|
281
|
+
- payloads are summarized, long strings are truncated, and sensitive fields such as cookies, passwords, and tokens are redacted
|
|
282
|
+
- `persistOnError` can export crashing requests under `var/traces/`
|
|
283
|
+
|
|
284
|
+
`env.yaml` example:
|
|
285
|
+
|
|
286
|
+
```yaml
|
|
287
|
+
trace:
|
|
288
|
+
enable: true
|
|
289
|
+
requestsLimit: 200
|
|
290
|
+
eventsLimit: 800
|
|
291
|
+
capture: resolve
|
|
292
|
+
persistOnError: true
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Capture modes:
|
|
296
|
+
|
|
297
|
+
- `summary`: request lifecycle plus high-signal events
|
|
298
|
+
- `resolve`: adds route resolution and controller/context steps
|
|
299
|
+
- `deep`: adds route skip reasons and deeper payload summaries for one request investigation
|
|
300
|
+
|
|
301
|
+
The trace CLI talks to the running dev server over the dev-only `__proteum/trace` HTTP endpoints. Use `--port` for a different local port or `--url` when the host itself is non-standard. For the full guide, see [docs/request-tracing.md](docs/request-tracing.md).
|
|
302
|
+
|
|
260
303
|
## LLM-Friendly By Design
|
|
261
304
|
|
|
262
305
|
Proteum is built so an agent can answer these questions quickly and reliably:
|
|
@@ -287,6 +330,8 @@ If you are an LLM or automation agent, start here:
|
|
|
287
330
|
6. Inspect `server/services/**` for business logic.
|
|
288
331
|
7. Inspect `client/pages/**` for SSR routes and page setup contracts.
|
|
289
332
|
|
|
333
|
+
For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum explain`, `proteum doctor`, and `proteum trace` as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
334
|
+
|
|
290
335
|
## What Proteum Avoids
|
|
291
336
|
|
|
292
337
|
Proteum intentionally avoids several patterns that make frameworks harder to inspect and harder to trust:
|