Skip to content

Commit 538d6ad

Browse files
SashaMITcursoragent
andcommitted
test(agent-creator-studio): NR-4 regression test + README status flip to InProgress
Adds the launch-gating test that locks the shared-intent contract between publish_intents (the agent's pre-encryption staging table) and publish_drafts (the Creator app's post-encryption queue), and flips the task README from Proposed → InProgress with the full S1 commit trail. NR-4 (PLAN.md §11) — what this test catches ------------------------------------------- The Monetisation Agent writes user intent into publish_intents. The Creator app reads it via puter.args.resumeIntent, pre-fills its wizard, runs the existing encrypt + IPFS pin pipeline UNCHANGED, then writes a publish_drafts row that gets minted exactly as today. If the column shape drifts between the two tables, the agent-led path and the manual path diverge silently — a row written via resumeFromIntent could drop a field, producing a different opRawData payload at mint time. The test enforces this in four ways: 1. CURRENT_VERSION in migrations.ts is at least 34 (otherwise existing installs never run the migration; the agent flow fails with 500s at /api/intents). 2. Migration 34 block exists AND records itself (otherwise the migration re-runs on every boot, masking failures). 3. schema.sql defines publish_intents (otherwise fresh installs are missing the table — same class of bug as the v1.2.7.0/.1 publish_drafts crash). 4. Every input-side column of publish_drafts has a same-typed column in publish_intents. The whitelist of 16 columns is derived from the Creator wizard's pre-encryption field set (title, description, category, file_name, file_size, mime_type, channel, price, currency_address, currency_symbol, copies, access_method, reseller_cut, royalty_partners, thumbnail_cid, adult). Behavioural assertions (in-memory SQLite, exact migration-34 DDL): - Default status is 'draft' (resumeFromIntent guards on this). - CHECK constraint accepts all 4 legal statuses and rejects everything else (including 'minted', 'DRAFT', empty string — typoed statuses must NOT silently persist). - State machine transitions draft → handed_off → consumed work, and the consumed_draft_id back-pointer is preserved (the NR-4 audit trail requirement: every minted asset whose origin was an agent intent retains a link to the publish_drafts row that finalised it). - consumed → anything is rejected (terminal state). Out of scope ------------ The test does NOT compare encrypted-blob bytes between agent-resumed and manually-filled mints — that requires a browser env + the @elacity-js/access SDK and lives in the on-chain smoke harness (.github/workflows/smoke-test.yml when it grows a creator-mint stage). Field-equivalence + state-machine integrity is the strongest unit- level assertion possible and is sufficient to gate v1.3.0 ship. Test result: 21/21 pass via `npm run test:unit` from pc2-node/. - 7 new NR-4 assertions - 14 pre-existing assertions (db-getsetting + setupPermissions) README updates -------------- - Status: Proposed → InProgress - Mint-handoff Option A logged (decided 2026-05-20) - All three S1 commits referenced (2f170e2 doc, bd21cbd backend, f15b6b8 frontend, plus this test commit) - Pre-tag remaining items: live smoke + multi-LLM verification - Files-modified list with LOC counts and roles Tracked in .cursor/tasks/AGENT-CREATOR-STUDIO-2026-05/PLAN.md. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f15b6b8 commit 538d6ad

2 files changed

Lines changed: 418 additions & 21 deletions

File tree

.cursor/tasks/AGENT-CREATOR-STUDIO-2026-05/README.md

Lines changed: 78 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22

33
**Task ID**: `AGENT-CREATOR-STUDIO-2026-05`
44
**Created**: 2026-05-20
5-
**Status**: **Proposed**awaiting Sasha sign-off on [`PLAN.md`](./PLAN.md) §15
5+
**Status**: **InProgress**S1 implementation landing on `feat/t-1-telemetry-and-support`
66
**Priority**: High (this is the v1.3.0 user-facing thrust per [`docs/core/ROADMAP.md`](../../../docs/core/ROADMAP.md) release-status snapshot)
7-
**Branch**: `feat/t-1-telemetry-and-support` (this PR is doc-only; execution will fork a fresh branch after sign-off and after v1.2.8.0 ships)
7+
**Branch**: `feat/t-1-telemetry-and-support` (continuing the active session per Sasha 2026-05-20; no fresh branch fork)
8+
9+
### Mint-handoff decision (PLAN.md §10)
10+
**Option A — `[Open in Creator]` only.** Decided 2026-05-20 by Sasha. No `[Mint now]` button in the chat for S1.
11+
Rationale: ships in ~1 week vs ~1.5–2 for Option B, halves the R5 (drift) surface, and lets us layer a `[Mint now]` button on top in S2 with one extra ticket once we have real telemetry. The Creator app is the canonical UI for wallet signing in S1.
12+
13+
### S1 execution status (commits on `feat/t-1-telemetry-and-support`)
14+
- [x] `2f170e229` — PLAN.md + README.md doc landing
15+
- [x] `bd21cbdc3` — backend foundation (migration 34, REST `/api/intents`, 6 agent tools, ToolExecutor cases)
16+
- [x] `f15b6b881` — frontend mode picker (`UIAIChat.js`) + Creator hand-off (`elacity-creator/app.js`) + Socket.IO directive (`UIDesktop.js`)
17+
- [x] NR-4 regression test (`pc2-node/tests/unit/publish-intents-schema-and-mirror.test.js`, 7 assertions — passes locally)
18+
- [ ] Live smoke pass on dev (drop file → chat through wizard → land on Creator confirmation page → mint)
819

920
## Description
1021

@@ -30,7 +41,7 @@ See [`PLAN.md`](./PLAN.md) — the full design document. Headline:
3041

3142
## Implementation plan
3243

33-
**This ticket is the planning ticket — it produces `PLAN.md` only.** Execution happens in a separate follow-up ticket after sign-off.
44+
### Planning (commit `2f170e229`)
3445

3546
- [x] Reuse inventory across 4 substrate layers (AI runtime, dDRM packaging, wallet bridge, app-host/WASM) — `PLAN.md` §3
3647
- [x] Architectural model + diagram (shared intent format, two presentations) — `PLAN.md` §6
@@ -43,34 +54,80 @@ See [`PLAN.md`](./PLAN.md) — the full design document. Headline:
4354
- [x] No-regret items NR-1 to NR-4 — `PLAN.md` §12
4455
- [x] Capability arc + S2/S3/S4 parking — `PLAN.md` §5.5 + §13
4556
- [x] Persona / system prompt finalised text — `PLAN.md` §5.4
46-
- [ ] **Sasha sign-off**`PLAN.md` §15
47-
48-
## Acceptance criteria for this (planning) ticket
49-
50-
- `PLAN.md` is complete and self-contained — a contributor unfamiliar with the project should be able to read it and understand the design
51-
- All claims about existing code cite a real file path or function name
52-
- The `publish_intents` vs `publish_drafts` correction is clearly explained (this was the mid-execution discovery)
53-
- The Option A vs Option B mint-handoff decision is presented with enough detail for Sasha to pick without a follow-up Q&A round
54-
- NR-4 (the launch-gating regression test) is described precisely enough that the harness can be specced
57+
- [x] **Option A vs Option B decision** — Option A chosen (see status block above)
58+
59+
### Execution (S1)
60+
61+
Backend (commit `bd21cbdc3`):
62+
- [x] Migration 34: `publish_intents` table — `pc2-node/src/storage/migrations.ts` + `schema.sql`
63+
- [x] DatabaseManager: `insertIntent` / `getIntentsByWallet` / `getIntentById` / `updateIntent` / `markIntentHandedOff` / `markIntentConsumed` / `deleteIntent` + `getChannelsByCreator`
64+
- [x] REST API: `pc2-node/src/api/intents.ts` (POST / GET / GET-by-id / PUT / PATCH-status / DELETE) with field validation
65+
- [x] Tool definitions: `pc2-node/src/services/ai/tools/MonetisationAgentTools.ts` — 6 tools per PLAN.md §7
66+
- [x] Tool executor: 6 case clauses in `pc2-node/src/services/ai/tools/ToolExecutor.ts`
67+
- [x] Tool registration: `AIChatService.ts` includes `monetisationAgentTools` in `allTools`
68+
69+
Frontend (commit `f15b6b881`):
70+
- [x] Chat-mode picker: `src/gui/src/UI/AI/UIAIChat.js` (General / Monetisation Agent)
71+
- [x] System-prompt injection on every send when monetisation mode is active
72+
- [x] Socket.IO directive: `src/gui/src/UI/UIDesktop.js` listens for `monetisation.open_creator` and calls `launch_app`
73+
- [x] Creator app: `puter.args.resumeIntent` handler + `resumeFromIntent(intentId)` + post-mint `markIntentConsumed` linkage in `pc2-node/data/test-apps/elacity-creator/app.js`
74+
75+
Tests:
76+
- [x] NR-4 regression test (7 assertions, all passing) — `pc2-node/tests/unit/publish-intents-schema-and-mirror.test.js`
77+
78+
Remaining (pre-tag for v1.3.0):
79+
- [ ] Live smoke on dev — drop a file in the side chat → talk through wizard fields → click "Open in Creator" → confirm pre-fill is identical to manual flow → mint → verify `publish_intents.status = consumed` with `consumed_draft_id` populated
80+
- [ ] Multi-LLM verification — repeat smoke on at least 2 of {Claude-Sonnet, GPT-4o-mini, Gemini-Pro, local DeepSeek}
81+
- [ ] CI green on `feat/t-1-telemetry-and-support` after these commits (tracking)
82+
83+
## Acceptance criteria (S1)
84+
85+
Planning:
86+
- [x] `PLAN.md` is complete and self-contained — a contributor unfamiliar with the project can read it and understand the design
87+
- [x] All claims about existing code cite a real file path or function name
88+
- [x] The `publish_intents` vs `publish_drafts` correction is clearly explained
89+
- [x] Option A vs Option B decision presented + Option A chosen
90+
91+
Execution (functional):
92+
- [x] Agent-built `publish_intents` row mirrors the input-side columns of `publish_drafts` byte-for-byte (NR-4 enforced by static + behavioural tests)
93+
- [x] State machine `draft → handed_off → consumed` works and the `consumed_draft_id` back-pointer preserves the audit trail
94+
- [x] Mint pipeline UNCHANGED — the Creator app's encrypt + opRawData + sign + mint code path is the same whether the user dropped a file manually or came in via `resumeIntent`
95+
- [x] Mode picker doesn't affect General-mode behaviour (system prompt only injected when monetisation mode is active)
96+
- [ ] **Live smoke** — see implementation plan above (pre-tag gate)
5597

5698
## Files in this task folder
5799

58100
- [`PLAN.md`](./PLAN.md) — the design document
59101
- [`README.md`](./README.md) — this file
60102

61-
## Files to modify (execution ticket, not this one)
103+
## Files modified (S1 execution, all on `feat/t-1-telemetry-and-support`)
104+
105+
Backend:
106+
- `pc2-node/src/storage/migrations.ts` (+59 LOC, version bump 33 → 34, migration 34 block)
107+
- `pc2-node/src/storage/schema.sql` (+45 LOC, `publish_intents` CREATE + indexes)
108+
- `pc2-node/src/storage/database.ts` (+173 LOC, intent CRUD + `getChannelsByCreator`)
109+
- `pc2-node/src/api/intents.ts` (NEW, ~295 LOC)
110+
- `pc2-node/src/api/index.ts` (+2 LOC, route registration)
111+
- `pc2-node/src/services/ai/tools/MonetisationAgentTools.ts` (NEW, ~204 LOC)
112+
- `pc2-node/src/services/ai/tools/ToolExecutor.ts` (+319 LOC, 6 case clauses + `decorateIntentRow` helper)
113+
- `pc2-node/src/services/ai/AIChatService.ts` (+5 LOC, register `monetisationAgentTools` in `allTools`)
114+
115+
Frontend:
116+
- `src/gui/src/UI/AI/UIAIChat.js` (+66 LOC, mode-state + picker UI + change handler + system-prompt injection)
117+
- `src/gui/src/UI/UIDesktop.js` (+24 LOC, `monetisation.open_creator` Socket.IO handler)
118+
- `pc2-node/data/test-apps/elacity-creator/app.js` (+95 LOC, `resumeFromIntent` + bootstrap branch + post-mint intent-consumed PATCH)
62119

63-
To be specified in the execution follow-up ticket once Option A vs Option B is decided. The expected surface area (Option A) is summarised in `PLAN.md` §4 — six things, no more.
120+
Tests:
121+
- `pc2-node/tests/unit/publish-intents-schema-and-mirror.test.js` (NEW, 7 assertions covering NR-4)
64122

65123
## Testing strategy
66124

67-
- Doc-only PR — no runtime tests apply. Lint check (`ReadLints`) on the markdown files only
68-
- Internal links resolve; no references to the parked AGENTIC-PC2-MONETISATION mandate
69-
- All cross-references to other PC2 paths (`pc2-node/...`, `src/gui/...`, `packages/access/...`) point to files that actually exist on the current branch
125+
- **Unit**: `npm run test:unit` — 21/21 passing (includes the 7 new NR-4 assertions). Run from `pc2-node/`.
126+
- **Static analysis**: `tsc --noEmit` clean across the full pc2-node project. ESLint clean on all touched files.
127+
- **Live smoke** (pre-tag, not yet run): drop a file in the side chat in Monetisation mode → talk through fields → `[Open in Creator]` → confirm pre-fill identical to manual flow → mint → verify `publish_intents.status = consumed` with `consumed_draft_id` populated.
70128

71129
## Notes
72130

73-
- This ticket replaces the **AGENTIC-PC2-MONETISATION-2026-05** mandate as the v1.3.0 driving plan, per Sasha 2026-05-19. The AGENTIC mandate document is parked, not deleted, for historical context
74-
- Branch hygiene: this doc-only PR lands on `feat/t-1-telemetry-and-support` because that's where the active session is. Execution branches separately **after** v1.2.8.0 is tagged
75-
- The 4-line uncommitted edit to `docs/core/ROADMAP.md` (a leftover from the prior session's housekeeping pass) is committed alongside this task's PLAN.md + README.md in a single doc-only PR
76-
- Cursor session continuity: this task is the resumption point after the prior session paused mid-execution. The synthesis source-of-truth is `/Users/mtk/.cursor/plans/agent-creator-studio_2cc543fd.plan.md` (read-only); `PLAN.md` here is its expanded, code-cited, sign-off-ready form
131+
- This ticket replaces the **AGENTIC-PC2-MONETISATION-2026-05** mandate as the v1.3.0 driving plan, per Sasha 2026-05-19. The AGENTIC mandate document is parked, not deleted, for historical context.
132+
- Branch hygiene: S1 lands on `feat/t-1-telemetry-and-support` per Sasha 2026-05-20 ("we are not trying to switch or create a new branch"). The v1.2.8.0 release path is unblocked — none of these commits touch the v1.2.8.0 telemetry/Health-app surface.
133+
- Cursor session continuity: this task is the resumption point after the prior session paused mid-planning. `PLAN.md` here is the expanded, code-cited, sign-off-ready form.

0 commit comments

Comments
 (0)