@elizaos/plugin-waifu-imagegen-app 2.0.3-beta.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @elizaos/plugin-waifu-imagegen-app
2
+
3
+ Native **image-generation AppView** for waifu agents. Renders inside an agent's
4
+ ElizaOS web UI canvas (the apps overlay / desktop tab) and invokes the
5
+ waifu.fun image-gen mini-app endpoint directly, settled in Eliza Cloud credits.
6
+
7
+ Phase 1 of giving each waifu agent its own ElizaOS web UI: this replaces the
8
+ broken waifu patron panel with a first-class app-plugin view.
9
+
10
+ ## What it ships
11
+
12
+ - **`ImageGenAppView.tsx`** — prompt input, aspect + model selectors, a
13
+ credits/markup/model price strip, a generate button with loading state, typed
14
+ error notices (401 sign-in / 402 insufficient-credits / 404 unavailable), and
15
+ the resulting image with the settled charge. Built on `@elizaos/app-core`
16
+ primitives (`PagePanel`, `Button`, `Spinner`) and `@elizaos/ui/agent-surface`
17
+ (`useAgentElement`), matching the visual + agent-addressability language of
18
+ `plugin-hyperliquid-app`.
19
+ - **`imagegen-client.ts`** — auth-aware `POST` to
20
+ `/v2/agents/:token/apps/image-gen/invoke` on the waifu API. Sends the
21
+ agent-app invoke key (`x-waifu-app-invoke-key`) when present, else a Steward
22
+ JWT bearer. Maps HTTP status onto typed `ImageGenError`s.
23
+ - **`imagegen-config.ts`** — resolves the waifu API base, agent token, and auth
24
+ credential from a host-injected `window.__WAIFU_IMAGEGEN__` global,
25
+ `import.meta.env` (`VITE_WAIFU_*`), or a production default.
26
+ - **`imagegen-contracts.ts`** — standalone typed contract (aspects, models,
27
+ prompt bounds, result + charge shapes, error classifier). No waifu-monorepo
28
+ imports.
29
+ - **`plugin.ts`** — the `views` declaration (`waifu-imagegen`) that
30
+ `plugin-app-manager` reads to discover + launch the view. Points at the
31
+ third-partyized bundle (`dist/views/bundle.js`) and the `ImageGenAppView` export.
32
+
33
+ ## Lazy + third-partyized
34
+
35
+ The overlay registration (`imagegen-app.ts`) loads the view via a dynamic
36
+ `import()`, and the view bundle third-partyizes `react`, `lucide-react`,
37
+ `@elizaos/ui`, and `@elizaos/app-core` (see `vite.config.views.ts`). The view's
38
+ component tree never lands in the main or mobile entry chunk.
39
+
40
+ ## Configuration
41
+
42
+ Inject per-agent config when the shell mounts the view:
43
+
44
+ ```ts
45
+ window.__WAIFU_IMAGEGEN__ = {
46
+ apiBase: "https://waifu.fun",
47
+ agentTokenAddress: "0x...",
48
+ stewardJwt: "<jwt>", // or appInvokeKey for trusted same-process hosts
49
+ metadata: { inferenceMarkupPercentage: 100, model: "gpt-image-2" },
50
+ };
51
+ ```
52
+
53
+ Or pass `agentTokenAddress` / `metadata` as props to `<ImageGenAppView>`.
54
+
55
+ ## Build
56
+
57
+ ```sh
58
+ bun run build # js + view bundle + types
59
+ bun run build:views # just the third-partyized view bundle
60
+ ```
Binary file
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@elizaos/plugin-waifu-imagegen-app",
3
+ "version": "2.0.3-beta.5",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "eliza-source": {
10
+ "types": "./src/index.ts",
11
+ "import": "./src/index.ts",
12
+ "default": "./src/index.ts"
13
+ },
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./plugin": {
18
+ "types": "./dist/plugin.d.ts",
19
+ "import": "./dist/plugin.js",
20
+ "default": "./dist/plugin.js"
21
+ },
22
+ "./*.css": "./dist/*.css",
23
+ "./*": {
24
+ "types": "./dist/*.d.ts",
25
+ "eliza-source": {
26
+ "types": "./src/*.ts",
27
+ "import": "./src/*.ts",
28
+ "default": "./src/*.ts"
29
+ },
30
+ "import": "./dist/*.js",
31
+ "default": "./dist/*.js"
32
+ }
33
+ },
34
+ "dependencies": {
35
+ "@elizaos/app-core": "2.0.3-beta.5",
36
+ "@elizaos/core": "2.0.3-beta.5",
37
+ "@elizaos/shared": "2.0.3-beta.5",
38
+ "@elizaos/ui": "2.0.3-beta.5",
39
+ "lucide-react": "^1.0.0",
40
+ "react": "^19.0.0"
41
+ },
42
+ "elizaos": {
43
+ "app": {
44
+ "displayName": "Image Generation",
45
+ "category": "creative",
46
+ "heroImage": "assets/hero.png"
47
+ },
48
+ "appRegister": "register"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "types": "./dist/index.d.ts",
54
+ "scripts": {
55
+ "build": "bun run build:js && bun run build:views && bun run build:types",
56
+ "clean": "node ../../packages/scripts/rm-path-recursive.mjs dist",
57
+ "test": "vitest run --config vitest.config.ts",
58
+ "build:js": "tsup --config ../tsup.plugin-packages.shared.ts",
59
+ "build:views": "bunx --bun vite build --config vite.config.views.ts",
60
+ "build:types": "tsc --noCheck -p tsconfig.build.json",
61
+ "typecheck": "tsgo --noEmit -p tsconfig.build.json"
62
+ },
63
+ "files": [
64
+ "assets",
65
+ "dist"
66
+ ],
67
+ "devDependencies": {
68
+ "@testing-library/react": "^16.3.2",
69
+ "@types/react": "^19.0.0",
70
+ "@types/react-dom": "^19.0.0",
71
+ "jsdom": "^29.0.0",
72
+ "react": "^19.0.0",
73
+ "react-dom": "^19.0.0",
74
+ "tsup": "^8.5.1",
75
+ "typescript": "^6.0.3",
76
+ "vite": "^8.0.0",
77
+ "vitest": "^4.1.5"
78
+ },
79
+ "gitHead": "ff6157011c9459670021cc28a6797592a78b8817"
80
+ }