@promptframe/creation 0.3.7 → 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 +3 -1
- package/dist/cli.mjs +241 -198
- package/docs/install-guidance.json +1 -1
- package/docs/installing.md +3 -3
- 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/version.mjs +1 -1
- package/package.json +1 -1
- package/skills/creation-setup/SKILL.md +2 -2
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.7 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/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或日志。网络失败不等于授权失效,不自动轮换或覆盖凭据。
|