@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/create-agent-app",
3
- "version": "0.46.55",
3
+ "version": "0.46.57",
4
4
  "description": "Create a tested Tangle agent application with either a tool loop or a complete chat interface.",
5
5
  "keywords": [
6
6
  "tangle",
@@ -1,67 +1,32 @@
1
- # AGENTS.md — you are customizing an agent-app
1
+ # Customize an agent-app
2
2
 
3
- You are a coding agent working in a project generated by `create-agent-app`. This
4
- project is a thin customization layer on top of `@tangle-network/agent-app` (the
5
- shell) and the Tangle agent substrate (the engine). Walk this contract before you
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
- ## 0. Orient
7
+ ## DATA vs CODE
9
8
 
10
- - [ ] Read this file end to end.
11
- - [ ] Read `CUSTOMIZE.md` the ordered fill-checklist. It is your task list.
12
- - [ ] Read `KNOWLEDGE.md` how the build-loop vs the act-gate work.
13
- - [ ] Run `pnpm install && pnpm typecheck && pnpm test`. Confirm green BEFORE editing.
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
- ## 1. The one rule (layering)
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
- > You change behavior by editing DATA and the COMPOSER — never by editing
18
- > `@tangle-network/agent-app`.
19
+ ## Required boundaries
19
20
 
20
- - The shell (`@tangle-network/agent-app/*`) owns mechanism: the tool loop, the
21
- agent→app tool side channel, the approval/proposal contract, the knowledge gate,
22
- billing, crypto.
23
- - The engine (`@tangle-network/agent-eval`, `agent-runtime`, `agent-integrations`)
24
- is a peer dependency. Do not bundle it, do not fork it.
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
- ## 2. DATA vs CODE — know which file you're in
27
+ ## Verification
29
28
 
30
- - [ ] DATA `agent.config.ts`: identity, taxonomy, knowledge requirements/sources,
31
- integrations, ui, model. Plain values. No control flow. No imports of engine
32
- internals. If you're writing an `if`, you're in the wrong file.
33
- - [ ] DATA `knowledge/`: domain documents. Content, not code. No secrets.
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.
@@ -1,6 +1 @@
1
- # CLAUDE.md
2
-
3
- The behavior contract for this project lives in `AGENTS.md`. Read it first, then
4
- walk `CUSTOMIZE.md` (the fill-checklist) and `KNOWLEDGE.md` (build-loop vs act-gate).
5
-
6
1
  @AGENTS.md
@@ -1,76 +1,32 @@
1
- # AGENTS.md — you are customizing a chat agent-app
1
+ # Customize a chat agent-app
2
2
 
3
- You are a coding agent working in a project generated by `create-agent-app --chat`.
4
- This project is a thin customization layer on top of `@tangle-network/agent-app`
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
- ## 0. Orient
6
+ ## DATA vs CODE
12
7
 
13
- - [ ] Read this file end to end.
14
- - [ ] Read `CUSTOMIZE.md` the ordered fill-checklist. It is your task list.
15
- - [ ] Run `pnpm install && pnpm typecheck && pnpm test`. Confirm green BEFORE editing.
16
- The test suite includes the end-to-end turn gate (fake sandbox producer
17
- streamed turn persisted transcript) it proves the assembly, not stubs.
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
- ## 1. The one rule (layering)
16
+ Extend supported configuration and callbacks before duplicating a shell mechanism or forking the package.
20
17
 
21
- > You change behavior by editing DATA and the COMPOSER — never by editing
22
- > `@tangle-network/agent-app`.
18
+ ## Required boundaries
23
19
 
24
- - The shell owns mechanism: turn protocol + hook order (`createChatTurnRoutes`
25
- over agent-runtime's `handleChatTurn`), persistence columns (`createChatTables`),
26
- the upload inline-vs-sandbox split, the interaction answer contract, auth guards.
27
- - You own: `agent.config.ts` + `prompts/system.md` (DATA), `src/` (the COMPOSER +
28
- routes), `migrations/` (must mirror the schema the e2e test executes it),
29
- `public/` (the dev page). That is the whole surface.
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
- ## 2. DATA vs CODE — know which file you're in
27
+ ## Verification
32
28
 
33
- - [ ] DATA `agent.config.ts`: name, system prompt, model default + effort,
34
- provider input limit, harness, gateway pricing, and renderable ask kinds.
35
- Plain values. If you're writing an `if`, you're in the wrong file.
36
- - [ ] DATA `prompts/system.md`: the persona. State intents and hard rules,
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.
@@ -1,6 +1 @@
1
- # CLAUDE.md
2
-
3
- The behavior contract for this project lives in `AGENTS.md`. Read it first, then
4
- walk `CUSTOMIZE.md` (the fill-checklist).
5
-
6
1
  @AGENTS.md