@tangle-network/create-agent-app 0.46.55 → 0.46.57
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/package.json +1 -1
- package/template/AGENTS.md +24 -59
- package/template/CLAUDE.md +0 -5
- package/template-chat/AGENTS.md +24 -68
- package/template-chat/CLAUDE.md +0 -5
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -1,67 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Customize an agent-app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
touch anything. It is a checklist, not prose — follow it in order.
|
|
3
|
+
This project supplies domain configuration and application wiring around `@tangle-network/agent-app`.
|
|
4
|
+
Read [CUSTOMIZE.md](CUSTOMIZE.md) for the customization checklist.
|
|
5
|
+
For knowledge ingestion or proposal checks, read [KNOWLEDGE.md](KNOWLEDGE.md).
|
|
7
6
|
|
|
8
|
-
##
|
|
7
|
+
## DATA vs CODE
|
|
9
8
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
9
|
+
- `agent.config.ts` contains identity, taxonomy, sources, integrations, UI, and model configuration as plain values.
|
|
10
|
+
- `knowledge/` contains domain documents, never secrets.
|
|
11
|
+
- `src/agent-app.ts` composes configuration and bindings through the shell's supported interfaces.
|
|
12
|
+
Prefer the maintained preset; override a handler only when the preset cannot express required persistence.
|
|
13
|
+
- `src/worker.ts` owns routing and recovers trusted context from authentication.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Reuse the shell's mechanisms and its engine peers rather than forking them into this product.
|
|
16
|
+
Keep domain values in configuration and behavior in the composer.
|
|
17
|
+
Use `AgentAppConfig` and its exported JSON Schema from `@tangle-network/agent-app/config` as the configuration contract.
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
> `@tangle-network/agent-app`.
|
|
19
|
+
## Required boundaries
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- You own: `agent.config.ts` (DATA) + `src/` (the COMPOSER + routes) + `knowledge/`
|
|
26
|
-
(DATA). That is the whole surface.
|
|
21
|
+
Regulated proposal types require a named human and cannot execute automatically.
|
|
22
|
+
Keep `regulatedTypes` a subset of `proposalTypes`; never downgrade a regulated action to an immediate tool.
|
|
23
|
+
Derive user, workspace, and thread identity from the server session, never model arguments.
|
|
24
|
+
Keep source attribution in the knowledge loop; low-confidence proposals remain proposals rather than applied changes.
|
|
25
|
+
Domain figures require a real record or an explicit "NOT ON FILE" outcome.
|
|
27
26
|
|
|
28
|
-
##
|
|
27
|
+
## Verification
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- [ ] CODE → `src/agent-app.ts`: the COMPOSER. Wires config + bindings into the
|
|
35
|
-
shell's seams. Override ONE handler here only when the preset genuinely can't
|
|
36
|
-
express your persistence — default to the preset.
|
|
37
|
-
- [ ] CODE → `src/worker.ts`: the chat route. Extend the route; recover trusted
|
|
38
|
-
per-turn context from real auth. Do not move domain values here.
|
|
39
|
-
|
|
40
|
-
## 3. Invariants — fail-closed, never relax
|
|
41
|
-
|
|
42
|
-
- [ ] HUMAN-IN-THE-LOOP: every regulated proposal type (`config.taxonomy.regulatedTypes`)
|
|
43
|
-
is routed to a named human and CANNOT auto-execute. Keep regulated types in
|
|
44
|
-
`regulatedTypes`. Never downgrade a regulated action to an immediate tool.
|
|
45
|
-
- [ ] `regulatedTypes` ⊆ `proposalTypes`. The test enforces this; keep it green.
|
|
46
|
-
- [ ] GROUNDING: never fabricate a domain figure (price, coverage, clause, id). A
|
|
47
|
-
real record or an explicit "NOT ON FILE". The persona fragment says this — keep it.
|
|
48
|
-
- [ ] TRUSTED CONTEXT: `userId` / `workspaceId` / `threadId` come from the server
|
|
49
|
-
session, NEVER from model tool args. The model must not forge identity.
|
|
50
|
-
- [ ] SOURCES ALWAYS RECORDED, PROPOSALS GATED: in the knowledge loop, grounding is
|
|
51
|
-
never dropped; a low-confidence knowledge PROPOSAL is. Propose, don't apply.
|
|
52
|
-
|
|
53
|
-
## 4. Verify (every change ends here)
|
|
54
|
-
|
|
55
|
-
- [ ] `pnpm typecheck` — clean. Proves `agent.config.ts` matches the shell contract.
|
|
56
|
-
- [ ] `pnpm test` — green. Proves the composer wiring + invariants.
|
|
57
|
-
- [ ] `pnpm knowledge:ingest` — enumerates your docs + sources (DRY) without error.
|
|
58
|
-
- [ ] For a real deploy: `pnpm dev` (wrangler) after filling `wrangler.toml`.
|
|
59
|
-
|
|
60
|
-
If any of these is red, you are not done. Do not weaken a test to pass.
|
|
61
|
-
|
|
62
|
-
## 5. The schema floor
|
|
63
|
-
|
|
64
|
-
`agent.config.ts` is validated by the TypeScript type `AgentAppConfig` from
|
|
65
|
-
`@tangle-network/agent-app/config`. A non-TS agent can read the same shape from its
|
|
66
|
-
JSON Schema: `agentAppConfigJsonSchema` (exported from that subpath). That schema +
|
|
67
|
-
this file + `CUSTOMIZE.md` are the complete spec for what you may put where.
|
|
29
|
+
Use the package's typecheck and test scripts to verify configuration, composer behavior, and these boundaries.
|
|
30
|
+
Run `pnpm knowledge:ingest` to check source enumeration without applying changes.
|
|
31
|
+
Before deployment, complete the required environment configuration and exercise the actual user flow.
|
|
32
|
+
Fix a failed check without weakening the behavior it protects.
|
package/template/CLAUDE.md
CHANGED
package/template-chat/AGENTS.md
CHANGED
|
@@ -1,76 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Customize a chat agent-app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(the shell): the whole server chat vertical — auth, thread/message persistence,
|
|
6
|
-
streaming turns with buffered replay, multimodal uploads, human-in-the-loop asks,
|
|
7
|
-
and API access — is ASSEMBLED from shell factories, not written here.
|
|
8
|
-
Walk this contract before you touch anything.
|
|
9
|
-
It is a checklist, not prose — follow it in order.
|
|
3
|
+
This project composes the shared chat application shell from `@tangle-network/agent-app`.
|
|
4
|
+
Read [CUSTOMIZE.md](CUSTOMIZE.md) for required configuration and deployment setup.
|
|
10
5
|
|
|
11
|
-
##
|
|
6
|
+
## DATA vs CODE
|
|
12
7
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
- `agent.config.ts` contains identity, prompt, model, backend, and renderable interaction choices as plain values.
|
|
9
|
+
- `prompts/system.md` supplies domain intent and evidence requirements.
|
|
10
|
+
State desired behavior; let the executing agent choose tools instead of embedding command or installation scripts.
|
|
11
|
+
- `src/chat.ts` composes the shell's authentication, persistence, streaming, upload, and interaction factories.
|
|
12
|
+
- `src/sandbox.ts` resolves sandbox access and profiles; domain reasoning belongs in the agent.
|
|
13
|
+
- `src/worker.ts` routes requests to those handlers.
|
|
14
|
+
- `migrations/` must match the persisted schema; the generated application's tests execute the real migration.
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
Extend supported configuration and callbacks before duplicating a shell mechanism or forking the package.
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
> `@tangle-network/agent-app`.
|
|
18
|
+
## Required boundaries
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
Derive user and workspace identity from the authenticated session, never request bodies or model output.
|
|
21
|
+
An inaccessible thread returns 404 without disclosing that it exists.
|
|
22
|
+
Missing sandbox credentials produce an explicit failure, never a canned agent response.
|
|
23
|
+
Agents own reasoning and tools; the application owns durable records, billing, and approval enforcement.
|
|
24
|
+
Agent writes use schema-validated tools rather than records parsed from prose.
|
|
25
|
+
Preserve the persona's fabrication rule: a real record or an explicit "NOT ON FILE" outcome.
|
|
30
26
|
|
|
31
|
-
##
|
|
27
|
+
## Verification
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
never implementations — no shell commands, CLI flags, or install scripts.
|
|
38
|
-
The executing agent chooses tools at execution time.
|
|
39
|
-
- [ ] CODE → `src/chat.ts`: the COMPOSER. Wires config + env into the shell's
|
|
40
|
-
factories. Extend seams here (billing hooks, `transformFinalText`,
|
|
41
|
-
`onTurnComplete`); never re-implement what a factory already does.
|
|
42
|
-
- [ ] CODE → `src/gateway.ts`: API keys and OpenAI-compatible requests enter
|
|
43
|
-
the same owned thread and chat route.
|
|
44
|
-
- [ ] CODE → `src/sandbox.ts`: the sandbox lane (box naming, credentials,
|
|
45
|
-
profile). All agent intelligence lives IN the sandbox; this file only
|
|
46
|
-
reaches it.
|
|
47
|
-
- [ ] CODE → `src/worker.ts`: routing only. New endpoint = new handler in
|
|
48
|
-
`src/chat.ts`, one `if` here.
|
|
49
|
-
|
|
50
|
-
## 3. Invariants — fail-closed, never relax
|
|
51
|
-
|
|
52
|
-
- [ ] TRUSTED CONTEXT: `userId`/`workspaceId` come from the better-auth SESSION,
|
|
53
|
-
never from a request body or model output. The `authorize` seam is the only
|
|
54
|
-
place identity is established — keep it that way.
|
|
55
|
-
- [ ] THREAD ACCESS: an inaccessible thread reads as 404, indistinguishable from
|
|
56
|
-
a missing one. A cross-workspace probe must not learn the thread exists.
|
|
57
|
-
- [ ] NO MOCK AGENT: without sandbox credentials a turn fails loud with a clear
|
|
58
|
-
error. Never add a canned-response fallback — a fake answer is worse than
|
|
59
|
-
an honest failure.
|
|
60
|
-
- [ ] AGENT-NATIVE: intelligence and tooling live in the sandboxed agent;
|
|
61
|
-
durability (rows, turn buffer) and money live here. If you're about to
|
|
62
|
-
parse the agent's prose for data, stop — that's a schema-validated tool's
|
|
63
|
-
job (see the shell's `/tools`).
|
|
64
|
-
- [ ] GROUNDING: the persona's fabrication rule stays. A real record or an
|
|
65
|
-
explicit "NOT ON FILE".
|
|
66
|
-
|
|
67
|
-
## 4. Verify (every change ends here)
|
|
68
|
-
|
|
69
|
-
- [ ] `pnpm typecheck` — clean. Proves the assembly matches the shell contract.
|
|
70
|
-
- [ ] `pnpm test` — green. The e2e gate runs the REAL migration + REAL factories
|
|
71
|
-
with one fake (the sandbox event feed). If it fails, the app drifted from
|
|
72
|
-
the framework — fix the drift, not the test.
|
|
73
|
-
- [ ] For a real deploy: fill `wrangler.toml` + `.dev.vars`, run
|
|
74
|
-
`pnpm db:migrate:local`, then `pnpm dev` and exercise the dev page.
|
|
75
|
-
|
|
76
|
-
If any of these is red, you are not done. Do not weaken a test to pass.
|
|
29
|
+
Run the package's typecheck and test scripts.
|
|
30
|
+
The turn test uses real migrations and shell factories with a fake sandbox event feed; it does not prove live sandbox access.
|
|
31
|
+
For deployment, complete environment configuration, apply the required database migrations, and exercise the actual page and turn flow.
|
|
32
|
+
Fix failures without weakening the protected behavior.
|