@promptframe/creation 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "promptframe-creation-local",
3
+ "interface": { "displayName": "PromptFrame Creation (local)" },
4
+ "plugins": [
5
+ {
6
+ "name": "promptframe-creation",
7
+ "source": { "source": "local", "path": "./" },
8
+ "policy": {
9
+ "installation": "AVAILABLE",
10
+ "authentication": "ON_USE"
11
+ },
12
+ "category": "Productivity"
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "promptframe-creation",
3
+ "version": "0.1.1",
4
+ "description": "使用自己的推理,通过 PromptFrame 的共用工具、作品和任务创作视频。",
5
+ "author": { "name": "PromptFrame" },
6
+ "skills": "./skills/",
7
+ "mcpServers": "./.mcp.json",
8
+ "requires_local_executor": true
9
+ }
package/.mcp.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "promptframe": {
4
+ "command": "node",
5
+ "args": ["bin/promptframe-creation.mjs", "bridge"],
6
+ "cwd": ".",
7
+ "env_vars": ["PROMPTFRAME_CREATION_CONFIG", "XDG_CONFIG_HOME"]
8
+ }
9
+ }
10
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PromptFrame 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 CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
1
+ # PromptFrame Creation
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 通过自己的客户端推理,使用 PromptFrame 的共用视频工具、作品、素材和持久任务,并与 Studio 接续同一作品。此仓是薄客户端;业务、预算和账务由平台管理。
4
+
5
+ 需要 Node.js 20+。当前安全凭据存储按 Linux、WSL 和 macOS 的文件权限实现;原生 Windows ACL 尚未验证。
6
+
7
+ ## npm 基础版
8
+
9
+ `@promptframe/creation@0.1.1` 提供 `setup`、`status`、`bridge` 及包内的 `video-creation` Skill。首次发行状态以官方 npm registry 为准。可使用以下命令配置并连接 MCP:
10
+
11
+ ```bash
12
+ npx --yes @promptframe/creation@0.1.1 setup --endpoint <platform-api-base>
13
+ codex mcp add promptframe -- npx --yes @promptframe/creation@0.1.1 bridge
14
+ ```
15
+
16
+ 这是基础 MCP 接法;此命令不自动加载创作 Skill,配套插件安装见下文。当前客户端身份按一份安全配置中的 clientId 区分,使用同一配置的聊天共享该身份;需要分别控制作品时使用独立配置。自动按 Codex 聊天隔离、用户级安装引导、自动升级与 Studio 活跃入口属于后续版本能力。本版的范围见[0.1.1 说明](docs/releases/0.1.1.md)。
17
+
18
+ ```bash
19
+ git clone https://github.com/ty-teams/promptframe-creation.git
20
+ cd promptframe-creation
21
+ npm ci --ignore-scripts
22
+ node bin/promptframe-creation.mjs setup --endpoint <platform-api-base>
23
+ ```
24
+
25
+ API 地址由你的 Studio 提供,例如占位格式 `https://your-platform.example/api`。没有私有端点默认值。setup 会给出准确 Studio 链接并尝试打开浏览器;浏览器不能打开时手动访问该链接,完成平台登录,在作品操作中选择“连接外部 Agent”。生成或复制创作 Token 后,在 setup 终端隐藏输入。自动化可用 `--token-stdin` 从安全输入管道提供,不能放入命令参数或源码。
26
+
27
+ 已存有效凭据时重复 setup 会直接复用,不调用轮换 API。撤销或过期后,先在 Studio 处理,再显式 `setup --replace` 输入新 Token。平台本人审批和账号/项目权限仍生效;这是独立 Bearer 创作授权,不是 `codex mcp login`。
28
+
29
+ 凭据保存在用户配置目录的 `promptframe-creation/credentials.json`,目录0700、文件0600。可用 `PROMPTFRAME_CREATION_CONFIG` 指定独立安全文件;仓库和 Codex 配置只引用桥,不含 Token。setup 不修改个人 Coding Agent 配置或登录。
30
+
31
+ ## 平台地址与环境
32
+
33
+ 首次连接时,由用户提供所用 Studio 的 API 地址,传给 `setup --endpoint`。GitHub 仓库地址不是平台地址;客户端不会根据当前工作目录或 Token 猜测域名,也没有内置生产地址。传入的 `/api` 会规范化为 `/api/mcp`,也可直接提供 `/api/mcp`。
34
+
35
+ 本地同机接入可使用 `http://localhost:3500/api`;正式服务使用该部署提供的 HTTPS API 地址。这里的 localhost 指桥进程所在的运行环境,容器或远程客户端需使用其实际可达地址。地址与该环境生成的 Token 一起保存在同一份安全配置文件中。
36
+
37
+ 本地与生产使用不同的 `PROMPTFRAME_CREATION_CONFIG` 文件。已有文件绑定另一地址时,setup 会要求独立配置,不会覆盖切端。启动 Codex/桥时固定使用对应配置路径;运行中的桥不会因修改环境变量或配置文件而热切换,切换后需重启对应连接。当前没有内置多环境选择命令。
38
+
39
+ ## 用组件丰富视频内容
40
+
41
+ 外部创作 Agent 可以复用平台中的组件,也可以按需开发新组件,例如机制动态图解、对比视图和可参数化图表。先从 MCP 当前工具目录发现组件检索与 schema 读取能力,选择已可用的组件并按 schema 填充 props,使用平台返回的 `componentRef`。CLI 的 `discovery` 用于查看端点能力,`component list` 用于查看项目声明;它们不等于组件市场搜索。
42
+
43
+ 需要新组件时,按需阅读独立的 [组件作者仓库与入门说明](https://github.com/ty-teams/promptframe-component-authoring#readme)、[组件创作 Skill](https://github.com/ty-teams/promptframe-component-authoring/blob/main/skills/component-authoring/SKILL.md) 和 [Authoring Guide](https://github.com/ty-teams/promptframe-component-authoring/blob/main/AUTHORING.md)。公开工具包为:
44
+
45
+ | 工具包 | 用途 |
46
+ | --- | --- |
47
+ | [`@promptframe/cli`](https://www.npmjs.com/package/@promptframe/cli) | `promptframe` 命令:检查、预览、打包、上传和查询平台构建状态;[CLI 使用说明](https://github.com/ty-teams/promptframe-component-authoring/blob/main/packages/cli/README.md) |
48
+ | [`create-promptframe-component`](https://www.npmjs.com/package/create-promptframe-component) | 创建组件项目与本地预览入口 |
49
+ | [`@promptframe/component-kit`](https://www.npmjs.com/package/@promptframe/component-kit) | 组件布局、时序和预览等开发辅助能力 |
50
+ | [`@promptframe/contracts`](https://www.npmjs.com/package/@promptframe/contracts) | 平台公开组件合同与标准 |
51
+
52
+ 组件开发放在独立的作者项目中,仅在需要时安装这些工具;单纯连接 MCP 不要求预装组件工具链。按当前公开文档和平台标准选择兼容版本,完成本地检查、预览、打包与上传后,再读取平台构建/审核及可用状态。上传受理不等于已可用于作品;可用后重新从平台读取组件身份、版本与 schema,再写入 VideoSpec。npm 包名、本地路径或原始脚本 URL 都不能替代 `componentRef`。
53
+
54
+ 组件 CLI 的端点由该部署提供,按 CLI 的登录与项目说明单独配置;不要将创作 MCP 地址直接当作 CLI 地址。组件上传授权与本仓创作 Token 用途不同。可复用组件遵循 `marketplace_authoring`,仅供当前项目的组件遵循 `project_private_generation`,并以平台实际授权为准;本地写代码或上传组件不会代替平台的制作确认。
55
+
56
+ ## 连接 Codex
57
+
58
+ 完成上面的 `npm ci --ignore-scripts` 和 setup 后,选择以下一种接法。同一客户端不要同时启用两份桥,以免显示重复工具。
59
+
60
+ Codex CLI 可显式添加 stdio 桥(把 `<checkout>` 换成此仓的绝对路径):
61
+
62
+ ```bash
63
+ codex mcp add promptframe -- node <checkout>/bin/promptframe-creation.mjs bridge
64
+ codex mcp get promptframe
65
+ node bin/promptframe-creation.mjs status
66
+ ```
67
+
68
+ 使用独立配置文件或自定义 XDG 配置目录时,在该条 `mcp_servers.promptframe` 配置中加 `env_vars = ["PROMPTFRAME_CREATION_CONFIG", "XDG_CONFIG_HOME"]`,让 Codex 只向桥转发这两个路径变量;参见 [Codex 的 stdio 环境配置](https://learn.chatgpt.com/docs/extend/mcp#stdio-servers)。默认安全目录不需要这一步。这里传递的是路径,Token 仍只在安全文件中。
69
+
70
+ 也可通过本仓的本地插件目录安装,配套加载 `video-creation` Skill 和 stdio 桥。在支持以下命令的 Codex CLI 中运行:
71
+
72
+ ```bash
73
+ codex plugin marketplace add <checkout>
74
+ codex plugin add promptframe-creation@promptframe-creation-local
75
+ codex plugin list
76
+ ```
77
+
78
+ 支持本地插件的 ChatGPT 桌面端可按 [OpenAI 的本地目录安装说明](https://developers.openai.com/plugins/build/plugins#install-a-local-plugin-manually),选择 `PromptFrame Creation (local)` 后安装插件。目录入口是本仓 `.agents/plugins/marketplace.json`,相对路径从 checkout 根解析;插件由 `.codex-plugin/plugin.json` 声明。不同客户端版本的安装入口可能不同,以该版本的命令帮助和官方说明为准。
79
+
80
+ 先安装依赖,再安装插件:本地目录会复制插件到客户端缓存,桥需要一起带入 `npm ci` 生成的 `node_modules`。只复制 manifest 或尚未安装依赖的源码目录,会缺少运行依赖。更新 checkout 后再次运行 `npm ci --ignore-scripts`,按客户端的卸载、重装流程刷新缓存,并重启客户端;仅修改源码不代表缓存已更新。
81
+
82
+ 桥使用 `cwd: "."` 从已安装的插件根目录启动,脚本参数是相对路径;该路径解析由 [Codex 的插件配置实现](https://github.com/openai/codex/blob/rust-v0.160.0/codex-rs/codex-mcp/src/plugin_config.rs)提供。凭据继续从用户安全配置目录读取,既不打进插件,也不写入 Codex 配置。插件会转发 `PROMPTFRAME_CREATION_CONFIG` 和 `XDG_CONFIG_HOME` 两个路径变量,需让启动 Codex 的进程继承 setup 时的值。安装后确认桥已连接、能读取平台工具,再使用 `video-creation`;插件安装成功本身不代表平台授权或创作成功。这里不代表已发布到公共插件目录或 npm。
83
+
84
+ 卸载插件可用该客户端的卸载入口,支持时也可运行 `codex plugin remove promptframe-creation@promptframe-creation-local`;显式添加的桥则使用 `codex mcp remove promptframe`。这只移除客户端接线,不撤销平台 Token 或取消已接受任务。需要撤销创作授权时,仍由本人在 Studio 处理。
85
+
86
+ 开始前读取平台当前项目、作品、编辑权及业务工具 schema。已有作品需本人在 Studio 确认接管;首次制作也由平台本人确认。已接受的异步工具返回持久 task,客户端停止等待不取消订单。网络结果未知时查原 task 或用相同幂等键重试。本人可随时接回网页,原费用与期限保持。
87
+
88
+ 外部未上报的聊天、思考和本地文件不在平台历史里。Skill 引导先复用、再用自己的能力制作并上传 ready 素材;外部自费推理与素材不冒作平台使用费。
89
+
90
+ ```bash
91
+ npm test
92
+ ```
93
+
94
+ ## 维护与发行
95
+
96
+ GitHub Actions 检查 Node 20/24、包内容和隔离安装。npm 发布使用独立版本及 GitHub OIDC,配置和操作见[发布手册](docs/releasing.md)。手工运行发布工作流只做检查;正式发行需要匹配的版本标签。首次包初始化与 npm 信任绑定完成后,后续版本由工作流自动发布。
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env node
2
+ import { randomBytes } from "node:crypto";
3
+ import { spawn } from "node:child_process";
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import {
7
+ CallToolRequestSchema,
8
+ ListToolsRequestSchema,
9
+ } from "@modelcontextprotocol/sdk/types.js";
10
+ import {
11
+ CreationClientError,
12
+ credentialsPath,
13
+ normalizeEndpoint,
14
+ readCredentials,
15
+ writeCredentials,
16
+ } from "../lib/credentials.mjs";
17
+ import { connectPlatform } from "../lib/connection.mjs";
18
+
19
+ const args = process.argv.slice(2),
20
+ command = args.shift(),
21
+ value = (key) => {
22
+ const i = args.indexOf(key);
23
+ return i < 0 ? undefined : args[i + 1];
24
+ };
25
+ const log = (value) => process.stdout.write(JSON.stringify(value) + "\n");
26
+ async function probe(credentials) {
27
+ const client = await connectPlatform(credentials);
28
+ try {
29
+ return (await client.listTools()).tools.length;
30
+ } finally {
31
+ await client.close();
32
+ }
33
+ }
34
+ async function tokenInput() {
35
+ if (args.includes("--token-stdin")) {
36
+ let text = "";
37
+ for await (const chunk of process.stdin) {
38
+ text += chunk;
39
+ if (text.length > 4096) throw new CreationClientError("token.too_long");
40
+ }
41
+ return text.trim();
42
+ }
43
+ if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== "function")
44
+ throw new CreationClientError(
45
+ "setup.interactive_tty_or_token_stdin_required",
46
+ );
47
+ process.stderr.write("创作 Token(不回显):");
48
+ const input = process.stdin,
49
+ wasRaw = input.isRaw;
50
+ input.setRawMode(true);
51
+ input.resume();
52
+ try {
53
+ return await new Promise((resolve, reject) => {
54
+ let text = "";
55
+ const read = (chunk) => {
56
+ for (const byte of chunk) {
57
+ if (byte === 3) {
58
+ finish();
59
+ reject(new CreationClientError("setup.cancelled"));
60
+ return;
61
+ }
62
+ if (byte === 10 || byte === 13) {
63
+ finish();
64
+ resolve(text);
65
+ return;
66
+ }
67
+ if (byte === 8 || byte === 127) text = text.slice(0, -1);
68
+ else if (byte >= 32 && byte <= 126) text += String.fromCharCode(byte);
69
+ if (text.length > 4096) {
70
+ finish();
71
+ reject(new CreationClientError("token.too_long"));
72
+ return;
73
+ }
74
+ }
75
+ };
76
+ const finish = () => {
77
+ input.removeListener("data", read);
78
+ input.pause();
79
+ };
80
+ input.on("data", read);
81
+ });
82
+ } finally {
83
+ input.setRawMode(Boolean(wasRaw));
84
+ process.stderr.write("\n");
85
+ }
86
+ }
87
+ async function setup() {
88
+ const file = credentialsPath(),
89
+ existing = await readCredentials(file),
90
+ requested = value("--endpoint");
91
+ const endpoint = normalizeEndpoint(requested ?? existing?.endpoint ?? "");
92
+ if (existing && existing.endpoint !== endpoint)
93
+ throw new CreationClientError(
94
+ "setup.different_endpoint_requires_separate_config",
95
+ );
96
+ if (existing && !args.includes("--replace")) {
97
+ try {
98
+ const tools = await probe(existing);
99
+ log({ connected: true, reused: true, endpoint, tools });
100
+ return;
101
+ } catch {
102
+ throw new CreationClientError(
103
+ "setup.saved_credential_unverified_retry_or_explicit_replace",
104
+ );
105
+ }
106
+ }
107
+ const studio = new URL(endpoint);
108
+ studio.pathname = studio.pathname.replace(/\/api\/mcp$/, "/studio");
109
+ studio.search = "?connectExternal=1";
110
+ process.stderr.write(
111
+ "在 Studio 登录,在“连接外部 Agent”生成或复制创作 Token。重复 setup 不会自动轮换。\n" +
112
+ studio.href +
113
+ "\n",
114
+ );
115
+ if (!args.includes("--no-open")) {
116
+ const executable =
117
+ process.platform === "darwin"
118
+ ? "open"
119
+ : process.platform === "linux"
120
+ ? "xdg-open"
121
+ : null;
122
+ if (executable) {
123
+ const child = spawn(executable, [studio.href], {
124
+ stdio: "ignore",
125
+ detached: true,
126
+ });
127
+ child.on("error", () => {});
128
+ child.unref();
129
+ }
130
+ }
131
+ const token = await tokenInput();
132
+ if (!/^pf_create_[A-Za-z0-9_-]{43}$/.test(token))
133
+ throw new CreationClientError("token.invalid");
134
+ const credentials = {
135
+ version: 1,
136
+ endpoint,
137
+ token,
138
+ clientId: existing?.clientId ?? randomBytes(24).toString("base64url"),
139
+ clientName: value("--name") ?? existing?.clientName ?? "Codex PromptFrame",
140
+ createdAt: existing?.createdAt ?? new Date().toISOString(),
141
+ };
142
+ // Verify before replacing the secure local file. This never calls a token
143
+ // rotate API, starts a model, creates work or approves production.
144
+ const tools = await probe(credentials);
145
+ await writeCredentials(credentials, file);
146
+ log({ connected: true, reused: false, endpoint, tools });
147
+ }
148
+ async function bridge() {
149
+ const credentials = await readCredentials();
150
+ if (!credentials) throw new CreationClientError("setup.required");
151
+ const client = await connectPlatform(credentials),
152
+ server = new Server(
153
+ { name: "promptframe-creation", version: "0.1.0" },
154
+ { capabilities: { tools: {} } },
155
+ );
156
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
157
+ try {
158
+ return await client.listTools();
159
+ } catch {
160
+ throw new Error("creation.connection_unresolved");
161
+ }
162
+ });
163
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
164
+ try {
165
+ return await client.callTool(request.params, undefined, {
166
+ timeout: 60_000,
167
+ });
168
+ } catch {
169
+ return {
170
+ isError: true,
171
+ content: [
172
+ {
173
+ type: "text",
174
+ text: JSON.stringify({
175
+ success: false,
176
+ errorCode: "creation.connection_unresolved",
177
+ action: "read_original_task_or_retry_same_idempotency_key",
178
+ }),
179
+ },
180
+ ],
181
+ };
182
+ }
183
+ });
184
+ let closing = false;
185
+ const close = async () => {
186
+ if (closing) return;
187
+ closing = true;
188
+ await server.close().catch(() => {});
189
+ await client.close().catch(() => {});
190
+ };
191
+ server.onclose = () => {
192
+ void close();
193
+ };
194
+ process.once("SIGINT", () => {
195
+ void close();
196
+ });
197
+ process.once("SIGTERM", () => {
198
+ void close();
199
+ });
200
+ await server.connect(new StdioServerTransport());
201
+ }
202
+ try {
203
+ if (command === "setup") await setup();
204
+ else if (command === "bridge") await bridge();
205
+ else if (command === "status") {
206
+ const saved = await readCredentials();
207
+ if (!saved) throw new CreationClientError("setup.required");
208
+ log({
209
+ connected: true,
210
+ endpoint: saved.endpoint,
211
+ tools: await probe(saved),
212
+ });
213
+ } else if (command === "help" || command === "--help" || !command) {
214
+ process.stdout.write(
215
+ "promptframe-creation setup --endpoint <platform-api-base> [--no-open] [--replace] [--name <client-name>]\npromptframe-creation status\npromptframe-creation bridge\n",
216
+ );
217
+ } else throw new CreationClientError("command.unknown");
218
+ } catch (error) {
219
+ // Never print raw SDK/fetch errors, response bodies or credentials.
220
+ process.stderr.write(
221
+ JSON.stringify({
222
+ error:
223
+ error instanceof CreationClientError
224
+ ? error.message
225
+ : "creation.connection_failed",
226
+ }) + "\n",
227
+ );
228
+ process.exitCode = 1;
229
+ }
@@ -0,0 +1,15 @@
1
+ # 0.1.0 基础版
2
+
3
+ 本版提供使用 PromptFrame 平台的本地 MCP 薄桥,适合开发者及已完成平台授权的用户。
4
+
5
+ - `setup`:规范化平台地址、安全输入创作 Token,保存到当前用户的受保护配置;有效凭据可复用。
6
+ - `status`:验证已保存的连接并读取当前工具目录。
7
+ - `bridge`:以 stdio MCP 接入客户端,转发平台动态工具及持久异步任务结果。
8
+ - 包内包含 `video-creation` Skill、Codex 插件 manifest 和 MCP 配置,并提供组件作者 CLI/Skill 文档链接。
9
+ - npm包依赖由标准npm安装处理;插件与Skill按README所述方式安装。
10
+
11
+ 平台继续执行真实账号/项目权限、作品接管、制作确认、预算和账务。外部客户端停止等待不会自动取消已接受订单;未知结果先观察原任务。
12
+
13
+ 本版仍需提供平台API地址、完成Token输入。多个聊天使用同一配置时共享客户端身份;分别控制作品应使用独立配置。新版自动会话隔离、一句话安装、自动升级和Studio活跃列表尚未在本版交付。原生Windows的凭据ACL尚未验证。
14
+
15
+ 0.1.0 是由账号持有者授权、从已核源码提交 `fe4ea3ab028b4d00150868ad43f31127a1f353e6` 的同一个安装包人工首发的基础版,用于建立真实 npm 包身份;它不是 GitHub OIDC 发布,也不宣称具有该发布方式的 provenance。后续 0.1.1 及日常发行使用 `creation-v<version>` 标签触发 GitHub OIDC。公开可用状态以官方 npm registry 回读为准,GitHub 源码、npm 发行与实际安装分别确认。
@@ -0,0 +1,12 @@
1
+ # 0.1.1 发行引导修正版
2
+
3
+ ## 内容
4
+
5
+ - 保持 0.1.0 基础版的 setup、status、stdio MCP 薄桥和创作 Skill。
6
+ - 修正新包初始化说明:先由账号持有者授权发布基础版建立包,再绑定 Trusted Publisher;不能只凭撤除暂存成功就假设包和信任保留。
7
+ - 安装示例更新为 0.1.1;包、锁文件和插件声明版本同步。
8
+ - 首次通过 `creation-v0.1.1` 标签执行 GitHub Actions OIDC 发行,并核官方 registry 的版本、integrity、provenance 与真实安装结果。
9
+
10
+ ## 范围
11
+
12
+ 自动聊天身份隔离、完整安装编排、设置 Skill、自动升级与 Studio 活跃入口仍属于后续版本,不因本次 npm 自动发行而视为完成。单独运行 npx 或添加 MCP 服务不会自动启用插件及 Skill。
@@ -0,0 +1,55 @@
1
+ # npm 发布与 GitHub Actions
2
+
3
+ 本仓独立发布 `@promptframe/creation`,不与组件作者四包绑定版本。源码和文档在 GitHub;npm 包提供版本化安装入口。基础版范围见[0.1.0 说明](releases/0.1.0.md),首次 OIDC 后继版本见[0.1.1 说明](releases/0.1.1.md)。如果包被设为 `private: true`,CI仍可检查安装包,正式发布会明确拒绝;工作流不会自动删除这个字段。
4
+
5
+ ## 日常检查
6
+
7
+ `.github/workflows/ci.yml` 在 PR、main 更新或手工运行时检查 Node 20/24:锁文件安装、测试、npm 包内容和隔离安装。它不会调用真实平台 setup、模型或媒体服务。以下命令由维护者在源码仓执行:
8
+
9
+ ```bash
10
+ npm ci --ignore-scripts
11
+ npm test
12
+ node scripts/package-release.mjs pack /tmp/creation-package
13
+ node scripts/package-release.mjs smoke /tmp/creation-package
14
+ ```
15
+
16
+ 安装包必须包含运行脚本、Skill、三个隐藏插件入口、README 和 LICENSE;排除测试、工作流、发行脚本及个人配置。隔离安装会从 registry 安装普通依赖并运行 `--help`,只使用临时配置目录。此项不代表特定宿主插件缓存、原生 Windows ACL 或完整创作旅程已经验收。
17
+
18
+ ## 一次性发布配置
19
+
20
+ GitHub 仓库创建 Environment `npm-production`,部署规则只允许 `creation-v*` 标签。无需 npm 长期发布 Token。npm 账号所有者完成新包初始化后,在该包的 Trusted Publisher 页面配置:
21
+
22
+ | 字段 | 值 |
23
+ | --- | --- |
24
+ | Provider | GitHub Actions |
25
+ | Organization or user | `ty-teams` |
26
+ | Repository | `promptframe-creation` |
27
+ | Workflow filename | `publish.yml` |
28
+ | Environment | `npm-production` |
29
+ | Allowed action | 允许直接 `npm publish`,满足既定自动发行流程 |
30
+
31
+ 首次包初始化需要账号持有者完成 npm 要求的身份验证;登录或 2FA 提示由本人处理。不要将密码、OTP、恢复码或 Token 写进仓库/聊天。npm 新建的信任配置需在两天内完成首次成功发布,因此应在可审核版本就绪时配置。
32
+
33
+ 本仓首次初始化采用:账号持有者授权人工发布可用基础版 0.1.0 → 等官方 registry 确认包可读 → 配置并回读 Trusted Publisher → 用 GitHub OIDC 发布后继 0.1.1。人工首发不冒称 OIDC 发布;后续自动发行不再使用该登录凭据。
34
+
35
+ 官方也支持新包 staged publishing,但不能把 stage、trust 或 reject 的单条成功回执当成包身份与信任会持续存在的保证。本仓初始化时在暂存阶段创建信任后,拒绝唯一候选,随后包与信任读取均返回404;因此不采用“拒绝暂存后直接推标签”的初始化步骤。待审版本与正式版本仍共享版本唯一约束,不可竞争发布同一版本;任何候选撤除后都要重新核包和信任,确认可用再进入自动发行。
36
+
37
+ ## 验证工作流与正式发行
38
+
39
+ 在 GitHub Actions 手工运行 **Publish Creation** 是无发布的检查:测试、打包、隔离安装并保存7天artifact。只有 `creation-v<version>` 标签的 push 能进入正式发布,手工运行不会发布 npm。
40
+
41
+ 正式发行前以一个正常提交完成:`private: false`,同步 package.json、package-lock.json及插件manifest版本,并验证当前版本所承诺的功能。当前流程接受稳定 `X.Y.Z` 版本。将该提交合入 main,再创建匹配标签,例如 `creation-v0.1.1`;无需为测试这套工作流提前推正式标签。
42
+
43
+ 正式tag必须属于 main 历史。打包job没有OIDC权限;通过检查的同一个tgz及manifest传给独立publish job,后者才取得 `id-token: write`。publish job使用Node24自带兼容npm,通过OIDC向官方registry发布public包,禁用脚本并生成provenance。源码commit、包/lock/插件版本、tag及SHA-512 integrity必须一致;不在发布时重新打包。
44
+
45
+ 官方registry最多等待15分钟回读目标版本、integrity和provenance。同版本重跑只观察原版本,匹配才成功,冲突即失败;不会重新发布或把latest倒退到旧版本。超过回读时限须核原版本和扫描状态,不能换版本盲发。npm发行不可当作插件市场上架或平台功能验收完成。
46
+
47
+ ## 维护与故障
48
+
49
+ - `package_not_ready_private_must_be_false`:包尚未批准为可发行,先完成真实功能和版本提交。
50
+ - `release_tag_mismatch` / `version_mismatch`:核正常源码版本与标签,不移动已发布标签或覆盖旧版本。
51
+ - npm认证失败:核 npm Trusted Publisher 的四个字段、直接publish权限、GitHub-hosted runner和对应Environment;无需新增长期Token。
52
+ - `artifact_integrity_mismatch` / `registry_integrity_conflict`:停止该次发行,核同一个artifact与原版本,不重传不同字节冒充同版。
53
+ - npm包发布不变更用户已保存的创作Token,也不自动覆盖活动桥进程。客户端安装/升级与平台接入按README和当版功能说明执行。
54
+
55
+ 官方参考:[npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)。
@@ -0,0 +1,30 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
+
4
+ export async function connectPlatform(credentials) {
5
+ const client = new Client(
6
+ { name: "promptframe-creation-bridge", version: "0.1.0" },
7
+ { capabilities: {} },
8
+ );
9
+ const transport = new StreamableHTTPClientTransport(
10
+ new URL(credentials.endpoint),
11
+ {
12
+ requestInit: {
13
+ headers: {
14
+ Authorization: "Bearer " + credentials.token,
15
+ "X-PromptFrame-Client-Id": credentials.clientId,
16
+ "X-PromptFrame-Client-Name": encodeURIComponent(
17
+ credentials.clientName,
18
+ ),
19
+ },
20
+ },
21
+ },
22
+ );
23
+ try {
24
+ await client.connect(transport);
25
+ return client;
26
+ } catch (error) {
27
+ await client.close().catch(() => {});
28
+ throw error;
29
+ }
30
+ }
@@ -0,0 +1,108 @@
1
+ import {
2
+ lstat,
3
+ mkdir,
4
+ readFile,
5
+ writeFile,
6
+ rename,
7
+ unlink,
8
+ } from "node:fs/promises";
9
+ import { homedir } from "node:os";
10
+ import path from "node:path";
11
+ import { randomBytes } from "node:crypto";
12
+
13
+ export class CreationClientError extends Error {
14
+ constructor(code) {
15
+ super(code);
16
+ this.name = "CreationClientError";
17
+ }
18
+ }
19
+ export function credentialsPath(env = process.env) {
20
+ return path.resolve(
21
+ env.PROMPTFRAME_CREATION_CONFIG ??
22
+ path.join(
23
+ env.XDG_CONFIG_HOME ?? path.join(homedir(), ".config"),
24
+ "promptframe-creation",
25
+ "credentials.json",
26
+ ),
27
+ );
28
+ }
29
+ export function normalizeEndpoint(input) {
30
+ let url;
31
+ try {
32
+ url = new URL(input);
33
+ } catch {
34
+ throw new CreationClientError("endpoint.invalid");
35
+ }
36
+ const loopback = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
37
+ if (
38
+ url.username ||
39
+ url.password ||
40
+ url.search ||
41
+ url.hash ||
42
+ (url.protocol !== "https:" && !(loopback && url.protocol === "http:"))
43
+ )
44
+ throw new CreationClientError("endpoint.https_or_loopback_required");
45
+ const base = url.href.replace(/\/+$/, "");
46
+ if (base.endsWith("/api/mcp")) return base;
47
+ if (base.endsWith("/api")) return base + "/mcp";
48
+ throw new CreationClientError("endpoint.api_base_required");
49
+ }
50
+ const secure = async (file, directory = false) => {
51
+ let info;
52
+ try {
53
+ info = await lstat(file);
54
+ } catch (error) {
55
+ if (error.code === "ENOENT") return null;
56
+ throw error;
57
+ }
58
+ if (
59
+ info.isSymbolicLink() ||
60
+ !(directory ? info.isDirectory() : info.isFile()) ||
61
+ info.uid !== process.getuid?.() ||
62
+ (info.mode & 0o077) !== 0
63
+ )
64
+ throw new CreationClientError("credentials.private_owner_required");
65
+ return info;
66
+ };
67
+ export async function readCredentials(file = credentialsPath()) {
68
+ if (!(await secure(file))) return null;
69
+ if (!(await secure(path.dirname(file), true)))
70
+ throw new CreationClientError("credentials.private_owner_required");
71
+ let value;
72
+ try {
73
+ value = JSON.parse(await readFile(file, "utf8"));
74
+ } catch {
75
+ throw new CreationClientError("credentials.invalid");
76
+ }
77
+ if (
78
+ value.version !== 1 ||
79
+ typeof value.token !== "string" ||
80
+ !/^pf_create_[A-Za-z0-9_-]{43}$/.test(value.token) ||
81
+ typeof value.clientId !== "string" ||
82
+ !/^[A-Za-z0-9_-]{16,128}$/.test(value.clientId) ||
83
+ typeof value.clientName !== "string" ||
84
+ !value.clientName.trim() ||
85
+ value.clientName.length > 160 ||
86
+ /[\x00-\x1f\x7f]/.test(value.clientName)
87
+ )
88
+ throw new CreationClientError("credentials.invalid");
89
+ return { ...value, endpoint: normalizeEndpoint(value.endpoint) };
90
+ }
91
+ export async function writeCredentials(value, file = credentialsPath()) {
92
+ const directory = path.dirname(file);
93
+ await mkdir(directory, { recursive: true, mode: 0o700 });
94
+ await secure(directory, true);
95
+ await secure(file);
96
+ const temporary = file + "." + randomBytes(12).toString("hex") + ".tmp";
97
+ try {
98
+ await writeFile(temporary, JSON.stringify(value) + "\n", {
99
+ flag: "wx",
100
+ mode: 0o600,
101
+ });
102
+ await rename(temporary, file);
103
+ } finally {
104
+ await unlink(temporary).catch((error) => {
105
+ if (error.code !== "ENOENT") throw error;
106
+ });
107
+ }
108
+ }
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@promptframe/creation",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "description": "PromptFrame video creation Skill, Codex plugin and MCP client bridge.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ty-teams/promptframe-creation.git"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "lib/",
13
+ "skills/",
14
+ "docs/",
15
+ ".codex-plugin/plugin.json",
16
+ ".agents/plugins/marketplace.json",
17
+ ".mcp.json"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org/"
22
+ },
23
+ "type": "module",
24
+ "license": "MIT",
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
28
+ "bin": {
29
+ "promptframe-creation": "bin/promptframe-creation.mjs"
30
+ },
31
+ "scripts": {
32
+ "test": "node --test --test-concurrency=1 test/*.test.mjs"
33
+ },
34
+ "dependencies": {
35
+ "@modelcontextprotocol/sdk": "1.32.1"
36
+ }
37
+ }
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: video-creation
3
+ description: 在 PromptFrame 中调研、规划、制作和接续视频,复用平台素材与工具,并与 Studio 交接同一作品。用于视频创作,不用于平台内部开发或单独的本地组件工程。
4
+ ---
5
+
6
+ 通过 `promptframe` MCP 使用平台的当前工具目录。外部客户端提供自己的推理;平台不另起网页导演。先确认用户要做的作品、项目和已有事实,避免重复制作与收费。
7
+
8
+ ## 连接与选择作品
9
+
10
+ 未连接时按仓库 README 运行 setup,提供用户选择的平台 API 地址。凭据只交本地 setup 的安全输入,不写聊天、源码、命令行参数或 MCP 业务参数。创作 Token 与组件上传凭据用途不同,也不是 OAuth `mcp login`。
11
+
12
+ 使用平台项目和作品列表选择目标。新作品使用稳定的幂等请求键;已有作品先读取最新历史、Plan、Spec、素材和在途任务,再申请编辑权,由本人在 Studio 确认。不要修改已有作品的运行时来换端。断线和思考不代表释放编辑权。
13
+
14
+ 作品读取默认返回一页历史和当前文档的版本/摘要,不代表完整历史或完整 Spec/Plan。需要正文时,按平台当前 schema 显式选择所需文档;更早消息沿返回的游标继续读取。引用单条消息或原工具调用时使用其稳定身份,不把近期页当全历史,也不为补读重派业务。
15
+
16
+ ## 准备与方案
17
+
18
+ 先复用已有素材和合适的已受检组件。外部客户端可用自己已有的调研、图像或本地创作能力,平台外用量不冒作平台计费;不要为省步骤而重复生成已经完成或结果未知的订单。
19
+
20
+ 组件也是视频表达手段:从平台当前工具目录发现组件检索、详情与 schema 读取能力,按真实 schema 构造 props,并使用平台返回的 `componentRef`。组件 CLI 的 `discovery` 和 `component list` 分别是端点能力与项目声明读面,不作为市场搜索的替代。
21
+
22
+ 确需新组件时,阅读独立的 [组件创作 Skill](https://github.com/ty-teams/promptframe-component-authoring/blob/main/skills/component-authoring/SKILL.md)、[工具链 README](https://github.com/ty-teams/promptframe-component-authoring#readme) 与 [Authoring Guide](https://github.com/ty-teams/promptframe-component-authoring/blob/main/AUTHORING.md),按需使用 `@promptframe/cli`、`create-promptframe-component`、`@promptframe/component-kit` 和 `@promptframe/contracts`。在独立作者项目中开发,按当前标准选择兼容版本;经本地检查/预览、上传及平台构建审核确认可用后,再读取组件身份、版本和 schema 接回作品。上传受理、本地预览或 npm 包名不代表平台组件已就绪。
23
+
24
+ CLI 的端点与组件上传授权按其公开说明配置,创作 Token 不代替组件凭据。可复用组件走 `marketplace_authoring`,项目私有组件走 `project_private_generation`,遵循用户用途及平台权限;组件开发或上传不代替本人制作确认。具体 CLI 命令由其维护中的文档提供,不在本 Skill 复制参数手册。
25
+
26
+ 用平台的 brief 上报能力保存外部需求/交接说明,明确是客户端上报。没有上报的外部聊天、思考或本地代码仍未知,不能伪造为平台历史或用户已确认原话。
27
+
28
+ 读取当前业务目录与 exact schema 后调用工具,不在本 Skill 维护参数副本。CreativePlan 独立创建/读取/修改,保留完整需求、导演方案和可信来源。其它业务调用引用已保存的方案,不夹带另一份 Plan 或反向覆盖它。
29
+
30
+ 上传自有素材后,等平台确认受管状态 ready,并使用返回的稳定 assetRef。文件路径、外部下载地址和“已上传”提示不能替代资产就绪。外部自己生成的图片不会凭上传自动产生平台原生图服务费。
31
+
32
+ ## 开工、费用与异步
33
+
34
+ 正式制作需要已保存 Plan 和平台本人点击开始。把平台返回的确认状态与准确 Studio 入口交给用户;工具参数、已打开网页和 URL 都不能代为批准。批准后由当前外部客户端继续,不启动第二个网页导演。
35
+
36
+ 每次新动作使用当前编辑权 controlVersion 与平台作品 revision。失权后停止新派发和写入,重新读事实;不要把旧整份 Spec 覆盖当前作品。预算沿同一作品的原有段,不把换工具、换端或新 task 当作重置额度。
37
+
38
+ 长工具返回持久 task ID;保存它和原订单身份,用有上限的 wait/状态读取接续。RPC 结束或没再 poll 都不取消原订单。网络结果不明时先查询原 task,重试用同一个幂等键,不自动重派。保留原输入、期限和未知事实。
39
+
40
+ 费用以平台原 receipt/账务读面为准,区分实计、预留、待结算和未知。成功媒体、工具终态和财务终态可以不同;未知不是免费。平台工具调用与外部自费推理/素材费用分开说明。
41
+
42
+ ## 接回与完成
43
+
44
+ 交接前可保存简明外部报告,随后释放自己当前代次的编辑权。没有报告也不阻止本人从 Studio 接回。旧订单可按原事实收尾、晚结果入素材与原账;旧客户端不能覆盖新 Spec。
45
+
46
+ 反馈只描述实际可见文字、工具结果、媒体就绪和导出状态,不补写模型思考或虚构进度。完成时核方案、素材引用和真实输出;需要云端 MP4 就等平台输出 ready,再把可访问结果交给用户。技术完成与本人视听验收分别说明。