@promptframe/creation 0.3.6 → 0.3.7
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +5 -3
- package/dist/cli.mjs +44 -6
- package/docs/development.md +2 -0
- package/docs/install-guidance.json +1 -1
- package/docs/installing.md +3 -3
- package/docs/releases/0.3.7.md +7 -0
- package/lib/local-upload.mjs +41 -4
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
- package/skills/creation-setup/SKILL.md +2 -2
- package/skills/video-creation/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<!-- creation-install-command -->
|
|
10
10
|
```bash
|
|
11
|
-
npx --yes @promptframe/creation@0.3.
|
|
11
|
+
npx --yes @promptframe/creation@0.3.7 connect --endpoint <Studio提供的API地址>
|
|
12
12
|
```
|
|
13
13
|
<!-- /creation-install-command -->
|
|
14
14
|
|
|
@@ -26,6 +26,8 @@ API 使用 Studio 实际可达 origin 和 `/api` 或 `/api/mcp`,没有内置
|
|
|
26
26
|
|
|
27
27
|
0.3.6在校验或衍生处理失败时,查询仍可成功返回,并保留有界的业务错误码;无法确认的原因使用通用错误码,不返回供应商原异常。已终结上传的提示不会建议恢复传输或无限查询。查询、恢复或取消不会重新执行已经完成的上传和衍生任务。
|
|
28
28
|
|
|
29
|
+
0.3.7 可在创建回执缺少上传 ID 时,凭原请求键和相同文件身份只读查询原会话。明确准入拒绝且查询无会话时给出终结原因;未知回执继续观察原 key,不重新创建、上传或误报文件读取超时。需要平台支持 `inspect_create`;不支持时保留未知状态,不降低保护。
|
|
30
|
+
|
|
29
31
|
## 源码、包和宿主范围
|
|
30
32
|
|
|
31
33
|
[0.3.2](docs/releases/0.3.2.md)改善本地目录插件升级的版本识别。[0.3.1](docs/releases/0.3.1.md)修复 Claude 会话身份更新;[0.3.0](docs/releases/0.3.0.md)增加 Claude Code 接入、平台动态工具发现、标准内容与版本化指引,以及新会话的兼容版本选择。已有0.2.x插件保持其安装来源;升级和新会话加载见[安装说明](docs/installing.md#claude-code接入)。
|
|
@@ -55,11 +57,11 @@ npm test
|
|
|
55
57
|
|
|
56
58
|
外部创作 Agent 可以复用平台中的组件,也可以按需开发新组件,例如机制动态图解、对比视图和可参数化图表。先从 MCP 当前工具目录发现组件检索与 schema 读取能力,选择已可用的组件并按 schema 填充 props,使用平台返回的 `componentRef`。CLI 的 `discovery` 用于查看端点能力,`component list` 用于查看项目声明;它们不等于组件市场搜索。
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
需要新组件时,从当前项目入门的 `navigation.componentAuthoring` 取得组件创作 Skill、工具链 README、Authoring Guide 和 CLI 说明。四项链接绑定该平台实际采用的公开发行源码,随平台正常采用或回滚一起变化。已安装 CLI 使用自己的随包文档及发行链接;平台支持状态继续以实时目录和 schema 为准。导航元数据暂缺不影响公开基线读取,可使用已有 CLI 的文档。公开工具包为:
|
|
59
61
|
|
|
60
62
|
| 工具包 | 用途 |
|
|
61
63
|
| --- | --- |
|
|
62
|
-
| [`@promptframe/cli`](https://www.npmjs.com/package/@promptframe/cli) | `promptframe`
|
|
64
|
+
| [`@promptframe/cli`](https://www.npmjs.com/package/@promptframe/cli) | `promptframe` 命令:检查、预览、打包、上传和查询平台构建状态;使用已安装发行的随包说明或项目入门给出的版本导航 |
|
|
63
65
|
| [`create-promptframe-component`](https://www.npmjs.com/package/create-promptframe-component) | 创建组件项目与本地预览入口 |
|
|
64
66
|
| [`@promptframe/component-kit`](https://www.npmjs.com/package/@promptframe/component-kit) | 组件布局、时序和预览等开发辅助能力 |
|
|
65
67
|
| [`@promptframe/contracts`](https://www.npmjs.com/package/@promptframe/contracts) | 平台公开组件合同与标准 |
|
package/dist/cli.mjs
CHANGED
|
@@ -7870,6 +7870,7 @@ var fail3 = (code) => {
|
|
|
7870
7870
|
throw new CreationClientError("creation.local_upload." + code);
|
|
7871
7871
|
};
|
|
7872
7872
|
var knownError = (error4) => error4 instanceof CreationClientError && /^creation\.[a-z0-9_.:-]{1,180}$/.test(error4.message) ? error4.message : "creation.local_upload.control_unconfirmed";
|
|
7873
|
+
var createRefusal = (code) => /^creation\.direct_object_upload\.(?:size_limit_exceeded|pending_bytes_quota_exceeded|concurrent_multipart_quota_exceeded|daily_bytes_quota_exceeded|durable_storage_quota_exceeded|capacity_unavailable|admission_facts_unavailable)$/.test(code);
|
|
7873
7874
|
var typeByExtension = {
|
|
7874
7875
|
".png": ["image", "image/png"],
|
|
7875
7876
|
".jpg": ["image", "image/jpeg"],
|
|
@@ -7885,13 +7886,15 @@ var typeByExtension = {
|
|
|
7885
7886
|
".webm": ["video", "video/webm"],
|
|
7886
7887
|
".pdf": ["document", "application/pdf"]
|
|
7887
7888
|
};
|
|
7888
|
-
var terminal = /* @__PURE__ */ new Set(["ready", "aborted", "expired", "rejected"]);
|
|
7889
|
+
var terminal = /* @__PURE__ */ new Set(["ready", "aborted", "expired", "rejected", "create_rejected"]);
|
|
7889
7890
|
var terminalNext = {
|
|
7890
7891
|
ready: "Use this asset in the same Studio project.",
|
|
7891
7892
|
derivation_failed: "This finalized upload has no remaining transfer action. Review the failure in Studio. Do not create a replacement upload automatically.",
|
|
7892
7893
|
aborted: "This upload was canceled. There is no remaining transfer action. Do not create a replacement upload automatically.",
|
|
7893
7894
|
expired: "This upload expired. There is no remaining transfer action. Do not create a replacement upload automatically.",
|
|
7894
|
-
rejected: "This upload was rejected. Review the rejection in Studio. There is no remaining transfer action."
|
|
7895
|
+
rejected: "This upload was rejected. Review the rejection in Studio. There is no remaining transfer action.",
|
|
7896
|
+
create_rejected: "The platform declined this create request. Review its cause; if a new upload is still needed, explicitly use a new key. No automatic replacement or retransmission is allowed.",
|
|
7897
|
+
creation_unconfirmed: "Creation is unconfirmed. Observe this same original key; do not recreate, PUT, or attribute it to a local file timeout."
|
|
7895
7898
|
};
|
|
7896
7899
|
var safeDerivationErrorCode = (value2) => typeof value2 === "string" && value2.length <= 160 && /^[a-z][a-z0-9_]*(?:\.[a-z0-9_]+){1,8}$/u.test(value2) ? value2 : "creation.local_upload.derivation_failed";
|
|
7897
7900
|
var sessionCheck = (session, state) => {
|
|
@@ -7937,6 +7940,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
7937
7940
|
...state.pendingPart ? { unconfirmedPart: state.pendingPart } : {},
|
|
7938
7941
|
...state.errorCode ? { errorCode: state.errorCode } : {},
|
|
7939
7942
|
...state.result ? { result: state.result } : {},
|
|
7943
|
+
...state.createObservation ? { creation: { outcome: state.createDisposition ?? "unconfirmed", ...state.createObservation } } : {},
|
|
7940
7944
|
automaticReplayAllowed: false,
|
|
7941
7945
|
next: job ? "Read status using this same key." : terminalNext[state.phase] ?? (state.phase === "derivatives_pending" ? "Read status for the original asset validation and derivatives." : "Observe status or explicitly resume/cancel this same key. Do not create a replacement upload.")
|
|
7942
7946
|
});
|
|
@@ -7962,7 +7966,28 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
7962
7966
|
return body;
|
|
7963
7967
|
}
|
|
7964
7968
|
async function observe(state, send, persist) {
|
|
7965
|
-
if (!state.uploadId)
|
|
7969
|
+
if (!state.uploadId) {
|
|
7970
|
+
const observed = await rpc(send, { action: "inspect_create", request: state.request });
|
|
7971
|
+
if (observed.idempotencyKey !== state.request.idempotencyKey || typeof observed.found !== "boolean" || !Number.isFinite(Date.parse(observed.observedAt ?? ""))) fail3("session_identity_unconfirmed");
|
|
7972
|
+
if (!observed.found) {
|
|
7973
|
+
if (observed.session !== void 0) fail3("session_identity_unconfirmed");
|
|
7974
|
+
state.createObservation = { found: false, observedAt: observed.observedAt };
|
|
7975
|
+
const refused = state.createDisposition === "rejected" && createRefusal(state.createErrorCode ?? "");
|
|
7976
|
+
state.phase = refused ? "create_rejected" : "creation_unconfirmed";
|
|
7977
|
+
state.errorCode = refused ? state.createErrorCode : "creation.local_upload.create_unconfirmed_observe_original_key";
|
|
7978
|
+
if (persist) await persist();
|
|
7979
|
+
return { state, session: void 0 };
|
|
7980
|
+
}
|
|
7981
|
+
const session2 = observed.session;
|
|
7982
|
+
if (!session2 || typeof session2.uploadId !== "string" || typeof session2.assetId !== "string") fail3("session_identity_unconfirmed");
|
|
7983
|
+
sessionCheck(session2, { ...state, uploadId: session2.uploadId, assetId: session2.assetId });
|
|
7984
|
+
state.uploadId = session2.uploadId;
|
|
7985
|
+
state.assetId = session2.assetId;
|
|
7986
|
+
state.expiresAt = session2.expiresAt;
|
|
7987
|
+
state.createDisposition = "accepted";
|
|
7988
|
+
delete state.createErrorCode;
|
|
7989
|
+
delete state.createObservation;
|
|
7990
|
+
}
|
|
7966
7991
|
const session = sessionCheck((await rpc(send, { action: "inspect", uploadId: state.uploadId })).session, state);
|
|
7967
7992
|
state.expiresAt = session.expiresAt;
|
|
7968
7993
|
state.lastObservedUploadState = session.state;
|
|
@@ -8127,6 +8152,10 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8127
8152
|
let file;
|
|
8128
8153
|
try {
|
|
8129
8154
|
state = await persistence.read(key) ?? state;
|
|
8155
|
+
if (state && !state.uploadId) {
|
|
8156
|
+
await observe(state, send, () => persistence.write(key, state));
|
|
8157
|
+
if (!state.uploadId || terminal.has(state.phase) || state.phase === "derivatives_pending" || state.phase === "derivation_failed") return view(state);
|
|
8158
|
+
}
|
|
8130
8159
|
if (input.action === "cancel") {
|
|
8131
8160
|
if (["ready", "derivatives_pending", "derivation_failed"].includes(state.phase))
|
|
8132
8161
|
return view((await observe(state, send, () => persistence.write(key, state))).state);
|
|
@@ -8162,6 +8191,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8162
8191
|
return view(state);
|
|
8163
8192
|
}
|
|
8164
8193
|
}
|
|
8194
|
+
if (state) assertOriginalDeadline(state);
|
|
8165
8195
|
if (typeof input.filePath !== "string" || input.filePath.length > 4096) fail3("file_selection_required");
|
|
8166
8196
|
const startedAtMs = state?.startedAtMs ?? now(), deadlineAtMs = state?.deadlineAtMs ?? startedAtMs + 6e5;
|
|
8167
8197
|
file = await openLocalUploadFile(input.filePath, { signal, deadlineAtMs, now });
|
|
@@ -8200,7 +8230,15 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8200
8230
|
await binding.assertCurrent();
|
|
8201
8231
|
let authorization;
|
|
8202
8232
|
if (!state.uploadId) {
|
|
8203
|
-
|
|
8233
|
+
let created;
|
|
8234
|
+
try {
|
|
8235
|
+
created = await rpc(send, { action: "create", request: state.request });
|
|
8236
|
+
} catch (error4) {
|
|
8237
|
+
const code = knownError(error4);
|
|
8238
|
+
state.createDisposition = createRefusal(code) ? "rejected" : "unconfirmed";
|
|
8239
|
+
if (createRefusal(code)) state.createErrorCode = code;
|
|
8240
|
+
throw error4;
|
|
8241
|
+
}
|
|
8204
8242
|
authorization = created.authorization;
|
|
8205
8243
|
const session = authorization?.session;
|
|
8206
8244
|
if (!session || typeof session.uploadId !== "string" || typeof session.assetId !== "string") fail3("authorization_invalid");
|
|
@@ -8237,7 +8275,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8237
8275
|
return view(state, job);
|
|
8238
8276
|
} catch (error4) {
|
|
8239
8277
|
if (state) {
|
|
8240
|
-
state.phase = "paused";
|
|
8278
|
+
state.phase = state.createDisposition === "rejected" && !state.uploadId ? "create_rejected" : "paused";
|
|
8241
8279
|
state.errorCode = knownError(error4);
|
|
8242
8280
|
await persistence.write(key, state);
|
|
8243
8281
|
}
|
|
@@ -8276,7 +8314,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
|
|
|
8276
8314
|
}
|
|
8277
8315
|
|
|
8278
8316
|
// lib/version.mjs
|
|
8279
|
-
var CLIENT_VERSION = "0.3.
|
|
8317
|
+
var CLIENT_VERSION = "0.3.7";
|
|
8280
8318
|
var CLIENT_PROTOCOL = "creation-client/v1";
|
|
8281
8319
|
|
|
8282
8320
|
// lib/cli.mjs
|
package/docs/development.md
CHANGED
|
@@ -76,6 +76,8 @@ Claude Code 使用官方 `plugin list --json` 与 `plugin marketplace list --jso
|
|
|
76
76
|
|
|
77
77
|
## 本机文件传输
|
|
78
78
|
|
|
79
|
+
无上传 ID 的已尝试请求先调用平台 `inspect_create`,提交原完整请求以核对同一幂等键、项目、Session 与文件身份。该入口只读,不生成新授权或签名。明确准入拒绝和未知回执分开;只读未找到不能单独证明请求从未执行。恢复、取消或同 key 重试均不得盲目再次 create;已找到的原会话仍按原期限和原分片/完成回执接续。
|
|
80
|
+
|
|
79
81
|
本机上传由平台目录的 `creation-local-file-upload/v1` 元数据选择,桥不按工具名称维护业务名单。模型只提供用户选择的单文件路径和原请求键;控制请求只带文件名、大小、SHA与原上传身份,字节流使用原会话的短期分片授权直达对象存储。
|
|
80
82
|
|
|
81
83
|
文件哈希和分片读取持有同一个文件描述符,并核对路径/描述符身份与变更。每桥最多两项传输,单次读取64KiB;原文件/分片/授权期限共用剩余预算。私有恢复目录为凭据配置同目录下的 `local-upload-state`,目录0700/文件0600,不保存Token、签名地址或完整文件路径。恢复缺失分片时重新选择同一文件,平台已传分片为准;不确定的PUT不自动重复。平台会话仍拥有校验、采用、配额和清理权威。
|
package/docs/installing.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<!-- creation-install-command -->
|
|
8
8
|
```bash
|
|
9
|
-
npx --yes @promptframe/creation@0.3.
|
|
9
|
+
npx --yes @promptframe/creation@0.3.7 connect --endpoint <Studio提供的API地址>
|
|
10
10
|
```
|
|
11
11
|
<!-- /creation-install-command -->
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ npx --yes @promptframe/creation@0.3.6 connect --endpoint <Studio提供的API地
|
|
|
26
26
|
|
|
27
27
|
<!-- creation-install-command -->
|
|
28
28
|
```bash
|
|
29
|
-
npx --yes @promptframe/creation@0.3.
|
|
29
|
+
npx --yes @promptframe/creation@0.3.7 connect --host claude-code --endpoint <Studio提供的API地址>
|
|
30
30
|
```
|
|
31
31
|
<!-- /creation-install-command -->
|
|
32
32
|
|
|
@@ -46,7 +46,7 @@ CLI 优先使用 PATH 中的 Claude;桌面版远程连接 WSL 时,也识别
|
|
|
46
46
|
|
|
47
47
|
<!-- creation-install-command -->
|
|
48
48
|
```bash
|
|
49
|
-
npx --yes @promptframe/creation@0.3.
|
|
49
|
+
npx --yes @promptframe/creation@0.3.7 connect --profile work-account --endpoint <另一环境API地址>
|
|
50
50
|
```
|
|
51
51
|
<!-- /creation-install-command -->
|
|
52
52
|
|
package/lib/local-upload.mjs
CHANGED
|
@@ -11,17 +11,22 @@ const wire='direct-object-upload.v2',digest=value=>createHash('sha256').update(J
|
|
|
11
11
|
const fail=code=>{throw new CreationClientError('creation.local_upload.'+code);};
|
|
12
12
|
const knownError=error=>error instanceof CreationClientError&&/^creation\.[a-z0-9_.:-]{1,180}$/.test(error.message)
|
|
13
13
|
?error.message:'creation.local_upload.control_unconfirmed';
|
|
14
|
+
// These typed admission refusals precede the platform session INSERT. An
|
|
15
|
+
// ambiguous transport or a scope/idempotency failure is never such a receipt.
|
|
16
|
+
const createRefusal=code=>/^creation\.direct_object_upload\.(?:size_limit_exceeded|pending_bytes_quota_exceeded|concurrent_multipart_quota_exceeded|daily_bytes_quota_exceeded|durable_storage_quota_exceeded|capacity_unavailable|admission_facts_unavailable)$/.test(code);
|
|
14
17
|
const typeByExtension={'.png':['image','image/png'],'.jpg':['image','image/jpeg'],'.jpeg':['image','image/jpeg'],
|
|
15
18
|
'.webp':['image','image/webp'],'.gif':['image','image/gif'],'.wav':['audio','audio/wav'],'.mp3':['audio','audio/mpeg'],
|
|
16
19
|
'.m4a':['audio','audio/mp4'],'.flac':['audio','audio/flac'],'.mp4':['video','video/mp4'],'.mov':['video','video/quicktime'],
|
|
17
20
|
'.webm':['video','video/webm'],'.pdf':['document','application/pdf']};
|
|
18
|
-
const terminal=new Set(['ready','aborted','expired','rejected']);
|
|
21
|
+
const terminal=new Set(['ready','aborted','expired','rejected','create_rejected']);
|
|
19
22
|
const terminalNext={
|
|
20
23
|
ready:'Use this asset in the same Studio project.',
|
|
21
24
|
derivation_failed:'This finalized upload has no remaining transfer action. Review the failure in Studio. Do not create a replacement upload automatically.',
|
|
22
25
|
aborted:'This upload was canceled. There is no remaining transfer action. Do not create a replacement upload automatically.',
|
|
23
26
|
expired:'This upload expired. There is no remaining transfer action. Do not create a replacement upload automatically.',
|
|
24
27
|
rejected:'This upload was rejected. Review the rejection in Studio. There is no remaining transfer action.',
|
|
28
|
+
create_rejected:'The platform declined this create request. Review its cause; if a new upload is still needed, explicitly use a new key. No automatic replacement or retransmission is allowed.',
|
|
29
|
+
creation_unconfirmed:'Creation is unconfirmed. Observe this same original key; do not recreate, PUT, or attribute it to a local file timeout.',
|
|
25
30
|
};
|
|
26
31
|
// Only the authenticated, identity-checked platform result supplies a cause.
|
|
27
32
|
// Preserve bounded machine codes, never arbitrary upstream error text.
|
|
@@ -72,6 +77,7 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
72
77
|
progress:{uploadedBytes:state.parts.reduce((sum,p)=>sum+p.sizeBytes,0)+(job?.progress??0),totalBytes:state.file.sizeBytes},
|
|
73
78
|
...(state.jobId?{jobId:state.jobId}:{}),...(state.pendingPart?{unconfirmedPart:state.pendingPart}:{}),...(state.errorCode?{errorCode:state.errorCode}:{}),
|
|
74
79
|
...(state.result?{result:state.result}:{}),
|
|
80
|
+
...(state.createObservation?{creation:{outcome:state.createDisposition??'unconfirmed',...state.createObservation}}:{}),
|
|
75
81
|
automaticReplayAllowed:false,
|
|
76
82
|
next:job?'Read status using this same key.':terminalNext[state.phase]??(
|
|
77
83
|
state.phase==='derivatives_pending'?'Read status for the original asset validation and derivatives.':
|
|
@@ -90,7 +96,24 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
90
96
|
return body;
|
|
91
97
|
}
|
|
92
98
|
async function observe(state,send,persist){
|
|
93
|
-
if(!state.uploadId)
|
|
99
|
+
if(!state.uploadId){
|
|
100
|
+
const observed=await rpc(send,{action:'inspect_create',request:state.request});
|
|
101
|
+
if(observed.idempotencyKey!==state.request.idempotencyKey||typeof observed.found!=='boolean'
|
|
102
|
+
||!Number.isFinite(Date.parse(observed.observedAt??'')))fail('session_identity_unconfirmed');
|
|
103
|
+
if(!observed.found){
|
|
104
|
+
if(observed.session!==undefined)fail('session_identity_unconfirmed');
|
|
105
|
+
state.createObservation={found:false,observedAt:observed.observedAt};
|
|
106
|
+
const refused=state.createDisposition==='rejected'&&createRefusal(state.createErrorCode??'');
|
|
107
|
+
state.phase=refused?'create_rejected':'creation_unconfirmed';
|
|
108
|
+
state.errorCode=refused?state.createErrorCode:'creation.local_upload.create_unconfirmed_observe_original_key';
|
|
109
|
+
if(persist)await persist();return{state,session:undefined};
|
|
110
|
+
}
|
|
111
|
+
const session=observed.session;
|
|
112
|
+
if(!session||typeof session.uploadId!=='string'||typeof session.assetId!=='string')fail('session_identity_unconfirmed');
|
|
113
|
+
sessionCheck(session,{...state,uploadId:session.uploadId,assetId:session.assetId});
|
|
114
|
+
state.uploadId=session.uploadId;state.assetId=session.assetId;state.expiresAt=session.expiresAt;
|
|
115
|
+
state.createDisposition='accepted';delete state.createErrorCode;delete state.createObservation;
|
|
116
|
+
}
|
|
94
117
|
const session=sessionCheck((await rpc(send,{action:'inspect',uploadId:state.uploadId})).session,state);
|
|
95
118
|
state.expiresAt=session.expiresAt;state.lastObservedUploadState=session.state;
|
|
96
119
|
if(session.state==='uploaded_unverified'){state.phase='completion_unconfirmed';state.errorCode='creation.local_upload.completion_requires_resume';}
|
|
@@ -199,6 +222,12 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
199
222
|
let file;
|
|
200
223
|
try{
|
|
201
224
|
state=await persistence.read(key)??state;
|
|
225
|
+
// Never open/hash a file or repeat create for an already attempted key
|
|
226
|
+
// with a missing receipt. A normal lookup may recover its original ID.
|
|
227
|
+
if(state&&!state.uploadId){
|
|
228
|
+
await observe(state,send,()=>persistence.write(key,state));
|
|
229
|
+
if(!state.uploadId||terminal.has(state.phase)||state.phase==='derivatives_pending'||state.phase==='derivation_failed')return view(state);
|
|
230
|
+
}
|
|
202
231
|
if(input.action==='cancel'){
|
|
203
232
|
if(['ready','derivatives_pending','derivation_failed'].includes(state.phase))
|
|
204
233
|
return view((await observe(state,send,()=>persistence.write(key,state))).state);
|
|
@@ -229,6 +258,7 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
229
258
|
return view(state);
|
|
230
259
|
}
|
|
231
260
|
}
|
|
261
|
+
if(state)assertOriginalDeadline(state);
|
|
232
262
|
if(typeof input.filePath!=='string'||input.filePath.length>4096)fail('file_selection_required');
|
|
233
263
|
const startedAtMs=state?.startedAtMs??now(),deadlineAtMs=state?.deadlineAtMs??startedAtMs+600_000;
|
|
234
264
|
file=await openLocalUploadFile(input.filePath,{signal,deadlineAtMs,now});
|
|
@@ -249,7 +279,14 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
249
279
|
}
|
|
250
280
|
await binding.assertCurrent();let authorization;
|
|
251
281
|
if(!state.uploadId){
|
|
252
|
-
|
|
282
|
+
let created;
|
|
283
|
+
try{created=await rpc(send,{action:'create',request:state.request});}
|
|
284
|
+
catch(error){
|
|
285
|
+
const code=knownError(error);state.createDisposition=createRefusal(code)?'rejected':'unconfirmed';
|
|
286
|
+
if(createRefusal(code))state.createErrorCode=code;
|
|
287
|
+
throw error;
|
|
288
|
+
}
|
|
289
|
+
authorization=created.authorization;
|
|
253
290
|
const session=authorization?.session;
|
|
254
291
|
if(!session||typeof session.uploadId!=='string'||typeof session.assetId!=='string')fail('authorization_invalid');
|
|
255
292
|
state.uploadId=session.uploadId;state.assetId=session.assetId;sessionCheck(session,state);
|
|
@@ -267,7 +304,7 @@ export function createLocalUploadManager({stateRoot,fetch=globalThis.fetch,now=D
|
|
|
267
304
|
await job.save();
|
|
268
305
|
}).finally(async()=>{try{await job.file.close();}finally{try{await release();}finally{jobs.delete(key);}}});
|
|
269
306
|
job.done.catch(()=>{});return view(state,job);
|
|
270
|
-
}catch(error){if(state){state.phase='paused';state.errorCode=knownError(error);await persistence.write(key,state);}throw error;}
|
|
307
|
+
}catch(error){if(state){state.phase=state.createDisposition==='rejected'&&!state.uploadId?'create_rejected':'paused';state.errorCode=knownError(error);await persistence.write(key,state);}throw error;}
|
|
271
308
|
finally{if(!jobs.has(key)){await file?.close();await release();}}
|
|
272
309
|
}
|
|
273
310
|
return{call(options){
|
package/lib/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const CLIENT_VERSION = "0.3.
|
|
1
|
+
export const CLIENT_VERSION = "0.3.7";
|
|
2
2
|
export const CLIENT_PROTOCOL = "creation-client/v1";
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@ description: 安装、连接或升级 PromptFrame Creation,复用平台创作
|
|
|
10
10
|
先确认使用 Codex 还是 Claude Code。Claude 接入使用 `connect --host claude-code`,两种宿主可共用同一 profile 凭据,插件登记分别核实。使用 Studio 对当前环境提供的固定版本;旧版入口不会因平台更新自动改变。Claude 桌面版远程连接 WSL 时,在同一 WSL 安装;没有终端命令时可通过 `--claude-bin <实际可执行文件>` 指定桌面版提供的入口,不固定桌面构建文件名。
|
|
11
11
|
|
|
12
12
|
<!-- creation-install-command -->
|
|
13
|
-
在用户本机终端运行 `npx --yes @promptframe/creation@0.3.
|
|
13
|
+
在用户本机终端运行 `npx --yes @promptframe/creation@0.3.7 connect --endpoint <Studio提供的API地址>`。需要隔离另一个环境或账号时显式加 `--profile <用户选择的名称>`;正在运行的桥不会切换。此命令管理用户级版本和 Codex 插件,不向当前项目安装依赖。优先使用 Studio 当前提供的固定推荐版本;每次重新进入此入口比较已安装版本,不后台追踪 latest,也不把旧聊天里的命令当最新版本。已安装更新版不默认降级。
|
|
14
14
|
<!-- /creation-install-command -->
|
|
15
15
|
|
|
16
16
|
<!-- creation-install-command -->
|
|
17
|
-
Claude Code 使用 `npx --yes @promptframe/creation@0.3.
|
|
17
|
+
Claude Code 使用 `npx --yes @promptframe/creation@0.3.7 connect --host claude-code --endpoint <Studio提供的API地址>`。桌面版远程连接 WSL 时,在该 WSL 执行;保留相同 profile 和有效凭据。
|
|
18
18
|
<!-- /creation-install-command -->
|
|
19
19
|
|
|
20
20
|
命令会复用并验证有效凭据。首次授权或明确更换已失效凭据时,由用户在 Studio 登录并在终端的不回显输入框提供 Token;不要要求用户把 Token 粘进聊天,也不要把它写进命令参数、URL或日志。网络失败不等于授权失效,不自动轮换或覆盖凭据。
|
|
@@ -33,4 +33,4 @@ description: 在 PromptFrame 中规划、制作和接续视频,复用平台作
|
|
|
33
33
|
|
|
34
34
|
## 需要自定义组件时
|
|
35
35
|
|
|
36
|
-
先在平台目录检索现成组件并读取 schema,使用受管 `componentRef
|
|
36
|
+
先在平台目录检索现成组件并读取 schema,使用受管 `componentRef`。确需新组件时,使用项目入门返回的 `navigation.componentAuthoring`,按该平台已采用发行的组件 Skill、工具链 README、Authoring Guide 与 CLI 说明在独立作者项目开发。已安装 CLI 使用自己的随包文档及发行链接;选项与支持状态仍核当前平台 schema。导航元数据暂缺时可继续读取公开基线,使用已有 CLI 的文档。平台构建与授权就绪后再接回作品;本地文件、npm 包名和上传受理不是可用组件身份。组件上传凭据与创作 Token 用途不同。
|