@plasius/ai 1.0.3

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/CODE_OF_CONDUCT.md +79 -0
  3. package/CONTRIBUTORS.md +27 -0
  4. package/LICENSE +21 -0
  5. package/README.md +132 -0
  6. package/SECURITY.md +17 -0
  7. package/dist/components/pixelverse/balance.d.ts +4 -0
  8. package/dist/components/pixelverse/balance.d.ts.map +1 -0
  9. package/dist/components/pixelverse/balance.js +40 -0
  10. package/dist/components/pixelverse/index.d.ts +3 -0
  11. package/dist/components/pixelverse/index.d.ts.map +1 -0
  12. package/dist/components/pixelverse/index.js +2 -0
  13. package/dist/components/pixelverse/pixelverseeditor.d.ts +16 -0
  14. package/dist/components/pixelverse/pixelverseeditor.d.ts.map +1 -0
  15. package/dist/components/pixelverse/pixelverseeditor.js +21 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/lib/chatWithAI.d.ts +2 -0
  20. package/dist/lib/chatWithAI.d.ts.map +1 -0
  21. package/dist/lib/chatWithAI.js +1 -0
  22. package/dist/lib/generateImage.d.ts +2 -0
  23. package/dist/lib/generateImage.d.ts.map +1 -0
  24. package/dist/lib/generateImage.js +1 -0
  25. package/dist/lib/synthesizeSpeech.d.ts +2 -0
  26. package/dist/lib/synthesizeSpeech.d.ts.map +1 -0
  27. package/dist/lib/synthesizeSpeech.js +1 -0
  28. package/dist/lib/transcribeSpeech.d.ts +2 -0
  29. package/dist/lib/transcribeSpeech.d.ts.map +1 -0
  30. package/dist/lib/transcribeSpeech.js +1 -0
  31. package/dist/platform/index.d.ts +76 -0
  32. package/dist/platform/index.d.ts.map +1 -0
  33. package/dist/platform/index.js +125 -0
  34. package/dist/platform/openai.d.ts +8 -0
  35. package/dist/platform/openai.d.ts.map +1 -0
  36. package/dist/platform/openai.js +61 -0
  37. package/dist/platform/pixelverse.d.ts +6 -0
  38. package/dist/platform/pixelverse.d.ts.map +1 -0
  39. package/dist/platform/pixelverse.js +196 -0
  40. package/dist-cjs/components/pixelverse/balance.d.ts +4 -0
  41. package/dist-cjs/components/pixelverse/balance.d.ts.map +1 -0
  42. package/dist-cjs/components/pixelverse/balance.js +46 -0
  43. package/dist-cjs/components/pixelverse/index.d.ts +3 -0
  44. package/dist-cjs/components/pixelverse/index.d.ts.map +1 -0
  45. package/dist-cjs/components/pixelverse/index.js +18 -0
  46. package/dist-cjs/components/pixelverse/pixelverseeditor.d.ts +16 -0
  47. package/dist-cjs/components/pixelverse/pixelverseeditor.d.ts.map +1 -0
  48. package/dist-cjs/components/pixelverse/pixelverseeditor.js +27 -0
  49. package/dist-cjs/index.d.ts +2 -0
  50. package/dist-cjs/index.d.ts.map +1 -0
  51. package/dist-cjs/index.js +17 -0
  52. package/dist-cjs/lib/chatWithAI.d.ts +1 -0
  53. package/dist-cjs/lib/chatWithAI.d.ts.map +1 -0
  54. package/dist-cjs/lib/chatWithAI.js +1 -0
  55. package/dist-cjs/lib/generateImage.d.ts +1 -0
  56. package/dist-cjs/lib/generateImage.d.ts.map +1 -0
  57. package/dist-cjs/lib/generateImage.js +1 -0
  58. package/dist-cjs/lib/synthesizeSpeech.d.ts +1 -0
  59. package/dist-cjs/lib/synthesizeSpeech.d.ts.map +1 -0
  60. package/dist-cjs/lib/synthesizeSpeech.js +1 -0
  61. package/dist-cjs/lib/transcribeSpeech.d.ts +1 -0
  62. package/dist-cjs/lib/transcribeSpeech.d.ts.map +1 -0
  63. package/dist-cjs/lib/transcribeSpeech.js +1 -0
  64. package/dist-cjs/platform/index.d.ts +76 -0
  65. package/dist-cjs/platform/index.d.ts.map +1 -0
  66. package/dist-cjs/platform/index.js +128 -0
  67. package/dist-cjs/platform/openai.d.ts +8 -0
  68. package/dist-cjs/platform/openai.d.ts.map +1 -0
  69. package/dist-cjs/platform/openai.js +67 -0
  70. package/dist-cjs/platform/pixelverse.d.ts +6 -0
  71. package/dist-cjs/platform/pixelverse.d.ts.map +1 -0
  72. package/dist-cjs/platform/pixelverse.js +199 -0
  73. package/docs/adrs/adr-0001-ai-package-scope.md +21 -0
  74. package/docs/adrs/adr-0002-public-repo-governance.md +24 -0
  75. package/docs/adrs/adr-0003-contracts-first-documentation.md +25 -0
  76. package/docs/adrs/adr-template.md +35 -0
  77. package/docs/api-reference.md +64 -0
  78. package/docs/architecture.md +21 -0
  79. package/docs/providers.md +26 -0
  80. package/legal/CLA-REGISTRY.csv +1 -0
  81. package/legal/CLA.md +22 -0
  82. package/legal/CORPORATE_CLA.md +57 -0
  83. package/legal/INDIVIDUAL_CLA.md +91 -0
  84. package/package.json +117 -0
  85. package/src/components/pixelverse/balance.module.css +6 -0
  86. package/src/components/pixelverse/balance.tsx +65 -0
  87. package/src/components/pixelverse/index.ts +2 -0
  88. package/src/components/pixelverse/pixelverseeditor.mocule.css +0 -0
  89. package/src/components/pixelverse/pixelverseeditor.tsx +74 -0
  90. package/src/global.d.ts +9 -0
  91. package/src/index.ts +1 -0
  92. package/src/lib/chatWithAI.ts +0 -0
  93. package/src/lib/generateImage.ts +0 -0
  94. package/src/lib/synthesizeSpeech.ts +0 -0
  95. package/src/lib/transcribeSpeech.ts +0 -0
  96. package/src/platform/index.ts +237 -0
  97. package/src/platform/openai.ts +123 -0
  98. package/src/platform/pixelverse.ts +309 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,72 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/)**, and this project adheres to **[Semantic Versioning](https://semver.org/spec/v2.0.0.html)**.
6
+
7
+ ---
8
+
9
+ ## [Unreleased]
10
+
11
+ - **Added**
12
+ - (placeholder)
13
+
14
+ - **Changed**
15
+ - (placeholder)
16
+
17
+ - **Fixed**
18
+ - (placeholder)
19
+
20
+ - **Security**
21
+ - (placeholder)
22
+
23
+ ## [1.0.3] - 2026-02-12
24
+
25
+ - **Added**
26
+ - Standalone public package scaffold at repository root with independent CI/CD, ADRs, and legal governance assets.
27
+ - Contracts-first documentation set:
28
+ - architecture overview
29
+ - API reference
30
+ - provider integration guidance
31
+ - ADR-0003 for contracts-first documentation baseline.
32
+
33
+ - **Changed**
34
+ - Add dual ESM + CJS build outputs with `exports` entries and CJS artifacts in `dist-cjs/`.
35
+ - Expanded README with stable API scope, known limitations, and host-integration expectations.
36
+
37
+ - **Fixed**
38
+ - Removed monorepo-relative TypeScript configuration coupling for standalone builds.
39
+
40
+ - **Security**
41
+ - Added baseline public package governance and CLA documentation.
42
+
43
+ ---
44
+
45
+ ## Release process (maintainers)
46
+
47
+ 1. Update `CHANGELOG.md` under **Unreleased** with user-visible changes.
48
+ 2. Bump version in `package.json` following SemVer (major/minor/patch).
49
+ 3. Move entries from **Unreleased** to a new version section with the current date.
50
+ 4. Tag the release in Git (`vX.Y.Z`) and push tags.
51
+ 5. Publish to npm (via CI/CD or `npm publish`).
52
+
53
+ > Tip: Use Conventional Commits in PR titles/bodies to make changelog updates easier.
54
+
55
+ ---
56
+
57
+ [Unreleased]: https://github.com/Plasius-LTD/ai/compare/v1.0.3...HEAD
58
+
59
+ ## [1.0.0] - 2026-02-11
60
+
61
+ - **Added**
62
+ - Initial release.
63
+
64
+ - **Changed**
65
+ - (placeholder)
66
+
67
+ - **Fixed**
68
+ - (placeholder)
69
+
70
+ - **Security**
71
+ - (placeholder)
72
+ [1.0.3]: https://github.com/Plasius-LTD/ai/releases/tag/v1.0.3
@@ -0,0 +1,79 @@
1
+ # Contributor Covenant Code of Conduct v2.1
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others’ private information, such as a physical or email address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [conduct@plasius.co.uk](mailto:conduct@plasius.co.uk). All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Enforcement Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact:** A violation through a single incident or series of actions.
56
+
57
+ **Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence:** A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)
74
+
75
+ For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq)
76
+
77
+ [homepage]: [https://www.contributor-covenant.org](https://www.contributor-covenant.org)
78
+
79
+ If you have any questions or concerns regarding this Code of Conduct, please contact us at [conduct@plasius.co.uk](mailto:conduct@plasius.co.uk).
@@ -0,0 +1,27 @@
1
+ # Contributing Guidelines
2
+
3
+ Thank you for considering contributing to this project! We welcome contributions that improve the code, documentation, and overall project quality.
4
+
5
+ ## Getting Started
6
+
7
+ - Fork the repository.
8
+ - Create a feature branch from `main`.
9
+ - Commit your changes with clear messages (we follow **Conventional Commits**).
10
+ - Push your branch and open a Pull Request (PR).
11
+
12
+ ## Requirements
13
+
14
+ - Write tests alongside code where possible.
15
+ - Ensure all tests pass before submitting a PR.
16
+ - Follow the repository’s coding style and linting rules.
17
+ - Update documentation (README, ADRs, etc.) when making significant changes.
18
+ - When making architectural changes, create a new ADR (Architecture Decision Record) that **succeeds** the previous one rather than modifying old ADRs. This preserves history and ensures decisions are traceable.
19
+ - Use the [ADR template](./docs/adrs/adr-template.md) when writing new ADRs to ensure consistency.
20
+ - Before your first contribution, sign the appropriate Contributor License Agreement (CLA). See [legal/CLA.md](legal/CLA.md) for details, then email the signed document to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
21
+
22
+ ## Communication
23
+
24
+ - Use GitHub Issues for bugs and feature requests.
25
+ - Pull Requests should describe the problem, solution, and trade-offs.
26
+
27
+ We appreciate your support in making this project better!
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Plasius LTD
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,132 @@
1
+ # @plasius/ai
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@plasius/ai.svg)](https://www.npmjs.com/package/@plasius/ai)
4
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/Plasius-LTD/ai/ci.yml?branch=main&label=build&style=flat)](https://github.com/Plasius-LTD/ai/actions/workflows/ci.yml)
5
+ [![coverage](https://img.shields.io/codecov/c/github/Plasius-LTD/ai)](https://codecov.io/gh/Plasius-LTD/ai)
6
+ [![License](https://img.shields.io/github/license/Plasius-LTD/ai)](./LICENSE)
7
+ [![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-yes-blue.svg)](./CODE_OF_CONDUCT.md)
8
+ [![Security Policy](https://img.shields.io/badge/security%20policy-yes-orange.svg)](./SECURITY.md)
9
+ [![Changelog](https://img.shields.io/badge/changelog-md-blue.svg)](./CHANGELOG.md)
10
+
11
+ AI capability contracts and completion schemas for Plasius applications.
12
+
13
+ ## Scope
14
+
15
+ This package currently provides:
16
+
17
+ - capability contracts (`AICapability`, `AIPlatform`)
18
+ - completion model interfaces (`ChatCompletion`, `ImageCompletion`, etc.)
19
+ - schema definitions for completion entities
20
+
21
+ Provider wiring and runtime adapters are documented in [`docs/providers.md`](./docs/providers.md).
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install @plasius/ai
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```ts
32
+ import {
33
+ AICapability,
34
+ type AIPlatform,
35
+ completionSchema,
36
+ chatCompletionSchema,
37
+ } from "@plasius/ai";
38
+
39
+ const capabilities = [AICapability.Chat, AICapability.Image];
40
+ void capabilities;
41
+ void completionSchema;
42
+ void chatCompletionSchema;
43
+
44
+ // Host apps provide the concrete runtime implementation.
45
+ const platform: AIPlatform = {
46
+ chatWithAI: async () => ({
47
+ id: crypto.randomUUID(),
48
+ partitionKey: "user-1",
49
+ type: "chat",
50
+ model: "gpt-4.1-mini",
51
+ durationMs: 42,
52
+ createdAt: new Date().toISOString(),
53
+ message: "Hello world",
54
+ outputUser: "assistant",
55
+ }),
56
+ synthesizeSpeech: async () => {
57
+ throw new Error("Not implemented");
58
+ },
59
+ transcribeSpeech: async () => {
60
+ throw new Error("Not implemented");
61
+ },
62
+ generateImage: async () => {
63
+ throw new Error("Not implemented");
64
+ },
65
+ produceVideo: async () => {
66
+ throw new Error("Not implemented");
67
+ },
68
+ checkBalance: async () => ({
69
+ id: crypto.randomUUID(),
70
+ partitionKey: "user-1",
71
+ type: "balance",
72
+ model: "",
73
+ durationMs: 0,
74
+ createdAt: new Date().toISOString(),
75
+ balance: 0,
76
+ }),
77
+ currentBalance: 0,
78
+ };
79
+
80
+ void platform;
81
+ ```
82
+
83
+ ## API Surface
84
+
85
+ - `AICapability`: enum describing logical capability routing.
86
+ - `AIPlatform`: interface your runtime adapter must implement.
87
+ - `Completion` + typed completion variants:
88
+ - `ChatCompletion`
89
+ - `TextCompletion`
90
+ - `ImageCompletion`
91
+ - `SpeechCompletion`
92
+ - `VideoCompletion`
93
+ - `BalanceCompletion`
94
+ - Schemas:
95
+ - `completionSchema`
96
+ - `chatCompletionSchema`
97
+ - `textCompletionSchema`
98
+ - `imageCompletionSchema`
99
+ - `speechCompletionSchema`
100
+ - `videoCompletionSchema`
101
+ - `balanceCompletionSchema`
102
+
103
+ ## Documentation
104
+
105
+ - Architecture: [`docs/architecture.md`](./docs/architecture.md)
106
+ - API reference: [`docs/api-reference.md`](./docs/api-reference.md)
107
+ - Provider guidance: [`docs/providers.md`](./docs/providers.md)
108
+
109
+ ## Known Limitations
110
+
111
+ - `src/lib/*` currently contains placeholder files and is not part of the public API.
112
+ - Runtime provider adapters are still under stabilization and should be wrapped by host applications.
113
+ - The package focuses on contracts/schemas first; runtime behavior is expected to be composed by consumers.
114
+
115
+ ## Development
116
+
117
+ ```bash
118
+ npm install
119
+ npm run build
120
+ npm test
121
+ npm run test:coverage
122
+ ```
123
+
124
+ ## Build Outputs
125
+
126
+ - ESM: `dist/`
127
+ - CJS: `dist-cjs/`
128
+ - Types: `dist/*.d.ts`
129
+
130
+ ## License
131
+
132
+ MIT
package/SECURITY.md ADDED
@@ -0,0 +1,17 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We currently support the latest major version of this project. Older versions may not receive security updates.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ If you discover a security vulnerability, please report it privately by emailing us at [security@plasius.co.uk](mailto:security@plasius.co.uk). Please do not create a public issue for security-related matters.
10
+
11
+ ## Response Timeline
12
+
13
+ We aim to acknowledge your report within 2 business days and to provide a more detailed response (including next steps and, if applicable, a timeline for a fix) within 7 business days.
14
+
15
+ ## Disclosure Policy
16
+
17
+ We request that you give us the opportunity to address the vulnerability before publicly disclosing it. We will coordinate with you on public disclosure once a fix is available and deployed.
@@ -0,0 +1,4 @@
1
+ export default function Balance({ apiKey }: {
2
+ apiKey: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/components/pixelverse/balance.tsx"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAkD7D"}
@@ -0,0 +1,40 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ import styles from "./balance.module.css";
5
+ export default function Balance({ apiKey }) {
6
+ const [balance, setBalance] = useState(null);
7
+ const fetchBalance = async () => {
8
+ try {
9
+ const response = await fetch("/pixelapi/openapi/v2/account/balance", {
10
+ method: "GET",
11
+ headers: {
12
+ "API-KEY": apiKey,
13
+ "AI-trace-ID": uuidv4(),
14
+ Accept: "application/json",
15
+ "Content-Type": "application/json",
16
+ },
17
+ referrerPolicy: "no-referrer",
18
+ });
19
+ if (!response.ok) {
20
+ console.error("Failed to fetch balance:", response.status, response.statusText);
21
+ return;
22
+ }
23
+ const data = (await response.json());
24
+ if (data?.Resp) {
25
+ setBalance(data.Resp);
26
+ }
27
+ }
28
+ catch (err) {
29
+ console.error("fetchBalance() error", err);
30
+ }
31
+ };
32
+ useEffect(() => {
33
+ void fetchBalance(); // initial load
34
+ const intervalId = setInterval(() => {
35
+ void fetchBalance();
36
+ }, 600000);
37
+ return () => clearInterval(intervalId);
38
+ }, [apiKey]);
39
+ return (_jsx("div", { className: styles.balance_container, children: balance ? (_jsxs("div", { children: [_jsxs("p", { children: ["Monthly Credit: ", balance.credit_monthly] }), _jsxs("p", { children: ["Package Credit: ", balance.credit_package] })] })) : (_jsx("p", { children: "Loading balance..." })) }));
40
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./balance.js";
2
+ export * from "./pixelverseeditor.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/pixelverse/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./balance.js";
2
+ export * from "./pixelverseeditor.js";
@@ -0,0 +1,16 @@
1
+ interface PixelverseEditorProps {
2
+ apiKey: string;
3
+ onVideoGenerated?: (videoUrl: string) => void;
4
+ onImageUpload?: (imageUrl: string) => void;
5
+ prompt?: string;
6
+ onPromptChange?: (prompt: string) => void;
7
+ negative_prompt?: string;
8
+ onNegativePromptChange?: (negative_prompt: string) => void;
9
+ template_id?: string;
10
+ onTemplateIdChange?: (template_id: string) => void;
11
+ seed?: number;
12
+ onSeedChange?: (seed: number) => void;
13
+ }
14
+ export declare function PixelverseEditor({ apiKey, onVideoGenerated, prompt, negative_prompt, template_id, seed, }: PixelverseEditorProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=pixelverseeditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixelverseeditor.d.ts","sourceRoot":"","sources":["../../../src/components/pixelverse/pixelverseeditor.tsx"],"names":[],"mappings":"AAKA,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,eAAe,EACf,WAAW,EACX,IAAI,GACL,EAAE,qBAAqB,2CA+CvB"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import Balance from "./balance.js";
4
+ export function PixelverseEditor({ apiKey, onVideoGenerated, prompt, negative_prompt, template_id, seed, }) {
5
+ const [videoUrl, setVideoUrl] = useState("");
6
+ const [videoId, setVideoId] = useState(null);
7
+ const [selectedFile, setSelectedFile] = useState(null);
8
+ const [loading, setLoading] = useState(false);
9
+ const [videoStatus, setVideoStatus] = useState(0);
10
+ const handleFileChange = (e) => {
11
+ if (e.target.files?.[0]) {
12
+ setSelectedFile(e.target.files[0]);
13
+ handleUploadProcess();
14
+ }
15
+ };
16
+ const handleRegenerate = () => {
17
+ };
18
+ const handleUploadProcess = async () => {
19
+ };
20
+ return (_jsxs("div", { children: [_jsx(Balance, { apiKey: apiKey }), videoStatus === 0 && !selectedFile && (_jsxs("div", { children: [_jsx("p", { children: "Drag/Drop or Click HERE to upload" }), _jsx("input", { title: "Upload Image", type: "file", accept: ".jpg,.jpeg,.png,.webp", onChange: handleFileChange })] })), loading && _jsx("div", { children: "Loading..." }), videoStatus === 0 && selectedFile && (_jsx("button", { onClick: handleUploadProcess, children: "Start Upload" })), videoStatus === 1 && (_jsxs("div", { children: [_jsx("video", { src: videoUrl, controls: true }), _jsx("button", { onClick: handleRegenerate, children: "Regenerate" })] }))] }));
21
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./platform/index.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./platform/index.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chatWithAI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatWithAI.d.ts","sourceRoot":"","sources":["../../src/lib/chatWithAI.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateImage.d.ts","sourceRoot":"","sources":["../../src/lib/generateImage.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=synthesizeSpeech.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synthesizeSpeech.d.ts","sourceRoot":"","sources":["../../src/lib/synthesizeSpeech.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transcribeSpeech.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcribeSpeech.d.ts","sourceRoot":"","sources":["../../src/lib/transcribeSpeech.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ import type { FieldBuilder } from "@plasius/schema";
2
+ export declare const completionSchema: import("@plasius/schema").Schema<{
3
+ id: FieldBuilder<string, string>;
4
+ type: FieldBuilder<string, string>;
5
+ model: FieldBuilder<string, string>;
6
+ durationMs: FieldBuilder<number, number>;
7
+ createdAt: FieldBuilder<string, string>;
8
+ partitionKey: FieldBuilder<string, string>;
9
+ usage: FieldBuilder<Record<string, number>, Record<string, FieldBuilder<number, number>>>;
10
+ }>;
11
+ export interface Completion {
12
+ id: string;
13
+ partitionKey: string;
14
+ type: string;
15
+ model: string;
16
+ durationMs: number;
17
+ createdAt: string;
18
+ usage?: Record<string, number>;
19
+ }
20
+ export declare const chatCompletionSchema: import("@plasius/schema").Schema<{
21
+ message: FieldBuilder<string, string>;
22
+ outputUser: FieldBuilder<string, string>;
23
+ }>;
24
+ export interface ChatCompletion extends Completion {
25
+ message: string;
26
+ outputUser: string;
27
+ }
28
+ export declare const textCompletionSchema: import("@plasius/schema").Schema<{
29
+ message: FieldBuilder<string, string>;
30
+ }>;
31
+ export interface TextCompletion extends Completion {
32
+ message: string;
33
+ }
34
+ export declare const imageCompletionSchema: import("@plasius/schema").Schema<{
35
+ url: FieldBuilder<URL, string>;
36
+ }>;
37
+ export interface ImageCompletion extends Completion {
38
+ url: URL;
39
+ }
40
+ export declare const speechCompletionSchema: import("@plasius/schema").Schema<{
41
+ url: FieldBuilder<URL, string>;
42
+ }>;
43
+ export interface SpeechCompletion extends Completion {
44
+ url: URL;
45
+ }
46
+ export declare const videoCompletionSchema: import("@plasius/schema").Schema<{
47
+ url: FieldBuilder<URL, string>;
48
+ }>;
49
+ export interface VideoCompletion extends Completion {
50
+ url: URL;
51
+ }
52
+ export declare const balanceCompletionSchema: import("@plasius/schema").Schema<{
53
+ balance: FieldBuilder<number, number>;
54
+ }>;
55
+ export interface BalanceCompletion extends Completion {
56
+ balance: number;
57
+ }
58
+ export declare enum AICapability {
59
+ Chat = 0,
60
+ Text = 1,
61
+ Speech = 2,
62
+ Image = 3,
63
+ Video = 4,
64
+ Balance = 5
65
+ }
66
+ export interface AIPlatform {
67
+ canHandle?: (userId: string, capabilities: AICapability[]) => Promise<boolean>;
68
+ chatWithAI: (userId: string, input: string, context: string, model: string) => Promise<ChatCompletion>;
69
+ synthesizeSpeech: (userId: string, input: string, voice: string, context: string, model: string) => Promise<SpeechCompletion>;
70
+ transcribeSpeech: (userId: string, input: Buffer, context: string, model: string) => Promise<TextCompletion>;
71
+ generateImage: (userId: string, input: string, context: string, model: string) => Promise<ImageCompletion>;
72
+ produceVideo: (userId: string, imput: string, image: URL, context: string, model: string) => Promise<VideoCompletion>;
73
+ checkBalance: (userId: string) => Promise<BalanceCompletion>;
74
+ currentBalance: number;
75
+ }
76
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAEjE,eAAO,MAAM,gBAAgB;;;;;;;;EA0C5B,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,oBAAoB;;;EAmBhC,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,oBAAoB;;EAehC,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB;;EAgBjC,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,GAAG,EAAE,GAAG,CAAC;CACV;AAED,eAAO,MAAM,sBAAsB;;EAgBlC,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,GAAG,EAAE,GAAG,CAAC;CACV;AAED,eAAO,MAAM,qBAAqB;;EAgBjC,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,GAAG,EAAE,GAAG,CAAC;CACV;AAED,eAAO,MAAM,uBAAuB;;EAYnC,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,YAAY;IACtB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;IACL,OAAO,IAAA;CACR;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAAE,KACzB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,UAAU,EAAE,CACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/B,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,aAAa,EAAE,CACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9B,YAAY,EAAE,CACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7D,cAAc,EAAE,MAAM,CAAC;CACxB"}