@promptframe/creation 0.3.6 → 0.3.8
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 +7 -3
- package/dist/cli.mjs +284 -203
- 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/docs/releases/0.3.8.md +5 -0
- package/lib/development-pairing.mjs +29 -0
- package/lib/host-context.mjs +13 -2
- 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/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.8 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.8 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.8 connect --profile work-account --endpoint <另一环境API地址>
|
|
50
50
|
```
|
|
51
51
|
<!-- /creation-install-command -->
|
|
52
52
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {open,stat} from 'node:fs/promises';
|
|
2
|
+
import {constants} from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {CreationClientError} from './credentials.mjs';
|
|
5
|
+
|
|
6
|
+
/** Only the explicitly selected private file is read. Its contents are sent as
|
|
7
|
+
* transient transport data, never returned to the model or written to history. */
|
|
8
|
+
export async function readDevelopmentPairingFile(filePath,{signal}={}){
|
|
9
|
+
const fail=()=>{throw new CreationClientError('creation.development_pairing.private_file_unavailable');};
|
|
10
|
+
if(typeof filePath!=='string'||filePath.length>4096||!path.isAbsolute(filePath))fail();
|
|
11
|
+
let file;
|
|
12
|
+
try{
|
|
13
|
+
signal?.throwIfAborted();
|
|
14
|
+
file=await open(filePath,constants.O_RDONLY|constants.O_NOFOLLOW|constants.O_NONBLOCK);
|
|
15
|
+
const before=await file.stat();
|
|
16
|
+
if(!before.isFile()||before.size<2||before.size>8192||process.platform!=='win32'
|
|
17
|
+
&&((before.mode&0o077)!==0||before.uid!==process.getuid()))fail();
|
|
18
|
+
const bytes=Buffer.alloc(before.size);let offset=0;
|
|
19
|
+
while(offset<bytes.length){signal?.throwIfAborted();const read=await file.read(bytes,offset,bytes.length-offset,offset);if(!read.bytesRead)fail();offset+=read.bytesRead;}
|
|
20
|
+
const after=await file.stat(),named=await stat(filePath);signal?.throwIfAborted();
|
|
21
|
+
if([after,named].some(value=>value.dev!==before.dev||value.ino!==before.ino||value.size!==before.size||value.mtimeMs!==before.mtimeMs||value.ctimeMs!==before.ctimeMs))fail();
|
|
22
|
+
const value=JSON.parse(bytes.toString('utf8'));
|
|
23
|
+
if(!value||typeof value!=='object'||Array.isArray(value))fail();
|
|
24
|
+
// Existing CLI dev output also carries public command/playerLoaded fields.
|
|
25
|
+
// They describe the terminal, not the private pairing transport.
|
|
26
|
+
return Object.fromEntries(['url','connectionId','credential','studioOrigin','expiresAt','contractVersion','lifecycle']
|
|
27
|
+
.filter(key=>Object.hasOwn(value,key)).map(key=>[key,value[key]]));
|
|
28
|
+
}catch{fail();}finally{await file?.close();}
|
|
29
|
+
}
|
package/lib/host-context.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import {CreationClientError} from './credentials.mjs';
|
|
|
4
4
|
import {hostParameters,resolveHostIdentity} from './host-identity.mjs';
|
|
5
5
|
import {assertMcpResponseBudget} from './content-budget.mjs';
|
|
6
6
|
import {CLAUDE_HOST_PROOF} from './claude-host-session.mjs';
|
|
7
|
+
import {readDevelopmentPairingFile} from './development-pairing.mjs';
|
|
7
8
|
export {hostParameters} from './host-identity.mjs';
|
|
8
9
|
|
|
9
10
|
const digestPattern=/^sha256:[a-f0-9]{64}$/;
|
|
@@ -87,7 +88,7 @@ export function createHostCallBridge(client,{credentials,host=resolveHostIdentit
|
|
|
87
88
|
const schema=local?.contractVersion===LOCAL_UPLOAD_PROTOCOL?local.inputSchema:tool.inputSchema;
|
|
88
89
|
if(!schema||schema.type!=='object')throw new CreationClientError('creation.upgrade_required');
|
|
89
90
|
const p=schema.properties;
|
|
90
|
-
const {controlVersion:_managed,...properties}=p??{};
|
|
91
|
+
const {controlVersion:_managed,developmentPairing:_privatePairing,...properties}=p??{};
|
|
91
92
|
return {...tool,inputSchema:{...schema,properties:{...properties,...(host.kind==='claude-code'?{
|
|
92
93
|
[CLAUDE_HOST_PROOF]:{type:'string',pattern:'^[a-f0-9]{64}$',description:'由当前宿主hook填入的单次身份凭证;请保留,不自行填写。'}
|
|
93
94
|
}:{})},...(schema.required
|
|
@@ -134,7 +135,7 @@ export function createHostCallBridge(client,{credentials,host=resolveHostIdentit
|
|
|
134
135
|
readResource:params=>knowledgeRead('resources','readResource',params),
|
|
135
136
|
listPrompts:params=>knowledgeRead('prompts','listPrompts',params),
|
|
136
137
|
getPrompt:params=>knowledgeRead('prompts','getPrompt',params),close:()=>localUploads?.close(),async call(raw,{signal}={}){
|
|
137
|
-
for(const field of ['threadId','controller','clientDigest','token','controlVersion'])if(Object.hasOwn(raw.arguments??{},field))
|
|
138
|
+
for(const field of ['threadId','controller','clientDigest','token','controlVersion','developmentPairing'])if(Object.hasOwn(raw.arguments??{},field))
|
|
138
139
|
throw new CreationClientError('creation.transport_authority_managed_by_bridge');
|
|
139
140
|
let binding={host,arguments:raw.arguments,assertCurrent:async()=>{}};
|
|
140
141
|
if(host.kind==='claude-code'){
|
|
@@ -196,6 +197,16 @@ export function createHostCallBridge(client,{credentials,host=resolveHostIdentit
|
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
const dispatched=key&&versions.get(key);
|
|
200
|
+
if(params.arguments?.tool==='studio_preview'&¶ms.arguments.arguments?.connectionFile!==undefined){
|
|
201
|
+
if(definition._meta['promptframe.localDevelopmentPairing']!=='creation-development-pairing/v1'
|
|
202
|
+
||effectiveAccess!=='controlled'||params.arguments.arguments.action!=='connect_development')
|
|
203
|
+
throw new CreationClientError('creation.development_pairing.unsupported');
|
|
204
|
+
// Controller admission above precedes local IO; a read-only work cannot
|
|
205
|
+
// use this helper to disclose a private file to the platform.
|
|
206
|
+
const pairing=await readDevelopmentPairingFile(params.arguments.arguments.connectionFile,{signal});
|
|
207
|
+
await binding.assertCurrent();
|
|
208
|
+
outgoing={...outgoing,arguments:{...outgoing.arguments,developmentPairing:pairing}};
|
|
209
|
+
}
|
|
199
210
|
const invalidate=()=>{
|
|
200
211
|
if(host.kind==='claude-code'&&binding.epoch!==hostEpoch)return;
|
|
201
212
|
const current=key&&versions.get(key);
|
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.8";
|
|
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.8 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.8 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 用途不同。
|