@promptframe/creation 0.3.11 → 0.3.12
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 -1
- package/dist/cli.mjs +220 -160
- package/docs/install-guidance.json +1 -1
- package/docs/installing.md +3 -3
- package/lib/account-bridge.mjs +1 -1
- package/lib/cli.mjs +2 -2
- package/lib/connection.mjs +14 -3
- package/lib/local-accounts.mjs +29 -1
- 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.12 connect --endpoint <Studio提供的API地址>
|
|
10
10
|
```
|
|
11
11
|
<!-- /creation-install-command -->
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ npx --yes @promptframe/creation@0.3.11 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.12 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.12 connect --profile work-account --endpoint <另一环境API地址>
|
|
50
50
|
```
|
|
51
51
|
<!-- /creation-install-command -->
|
|
52
52
|
|
package/lib/account-bridge.mjs
CHANGED
|
@@ -59,7 +59,7 @@ export function createAccountAwareBridge(defaultClient,{credentials,configFile,h
|
|
|
59
59
|
const saved=await readCredentials(ref.configFile);
|
|
60
60
|
if(!saved||localCredentialDigest(saved.token)!==ref.credentialDigest
|
|
61
61
|
||normalizeEndpoint(saved.endpoint)!==normalizeEndpoint(ref.endpoint))throw error('reference_changed');
|
|
62
|
-
const client=await connect(saved,{...connectionOptions,host,expectedIdentity:identity});
|
|
62
|
+
const client=await connect(saved,{...connectionOptions,host,expectedIdentity:identity,clientConfigFile:ref.configFile});
|
|
63
63
|
try{
|
|
64
64
|
connectionAccountIdentity(client,identity);
|
|
65
65
|
return{client,bridge:makeBridge(client,saved,createLocalUploads?.({identity,agent,configFile:ref.configFile})),identity,owned:true};
|
package/lib/cli.mjs
CHANGED
|
@@ -47,7 +47,7 @@ const log = (value) => process.stdout.write(JSON.stringify(value) + "\n");
|
|
|
47
47
|
const configFile=()=>value('--config')?path.resolve(value('--config')):
|
|
48
48
|
profileCredentialsPath(value('--profile')??'default');
|
|
49
49
|
async function probe(credentials) {
|
|
50
|
-
const client = await connectPlatform(credentials,{host:resolveHostIdentity({host:value('--host')})});
|
|
50
|
+
const client = await connectPlatform(credentials,{host:resolveHostIdentity({host:value('--host')}),clientConfigFile:configFile()});
|
|
51
51
|
try {
|
|
52
52
|
return {tools:(await client.listTools()).tools.length,accountIdentity:connectionAccountIdentity(client)};
|
|
53
53
|
} finally {
|
|
@@ -194,7 +194,7 @@ async function bridge() {
|
|
|
194
194
|
process.once('SIGINT',abort);process.once('SIGTERM',abort);
|
|
195
195
|
try{
|
|
196
196
|
client=await connectPlatform(credentials,{host:identity,contentTypes:()=>contentTypes,contentSource:()=>contentSource,
|
|
197
|
-
enforceMinimum:false,signal:startup.signal});
|
|
197
|
+
enforceMinimum:false,signal:startup.signal,clientConfigFile:configFile()});
|
|
198
198
|
upstream=client.getServerCapabilities()??{};policy=readPlatformBridgePolicy(upstream);
|
|
199
199
|
selection=await selectBridgeRuntime({policy,currentVersion:CLIENT_VERSION,lockedVersion:value('--bridge-version'),
|
|
200
200
|
resolvedVersion:value('--resolved-runtime-version'),signal:startup.signal,hostKind:identity.kind,
|
package/lib/connection.mjs
CHANGED
|
@@ -3,8 +3,9 @@ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/
|
|
|
3
3
|
import {CLIENT_VERSION,CLIENT_PROTOCOL} from './version.mjs';
|
|
4
4
|
import {resolveHostIdentity,hostClientName} from './host-identity.mjs';
|
|
5
5
|
import {assertBridgeCompatible,declaredHostContentTypes,readPlatformBridgePolicy} from './bridge-negotiation.mjs';
|
|
6
|
-
import {parseAccountIdentity} from './local-accounts.mjs';
|
|
6
|
+
import {parseAccountIdentity,localClientObservationInstance} from './local-accounts.mjs';
|
|
7
7
|
import {CreationClientError} from './credentials.mjs';
|
|
8
|
+
import path from 'node:path';
|
|
8
9
|
|
|
9
10
|
/** Only initialize metadata from this authenticated connection is accepted.
|
|
10
11
|
* Business output and local directory captions cannot establish identity. */
|
|
@@ -23,7 +24,8 @@ export function connectionAccountIdentity(client, expected) {
|
|
|
23
24
|
return actual;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export async function connectPlatform(credentials,{host=resolveHostIdentity(),contentTypes=()=>['text'],contentSource=()=> 'text-fallback',enforceMinimum=true,signal,expectedIdentity}={}) {
|
|
27
|
+
export async function connectPlatform(credentials,{host=resolveHostIdentity(),contentTypes=()=>['text'],contentSource=()=> 'text-fallback',enforceMinimum=true,signal,expectedIdentity,clientConfigFile,observationRoot}={}) {
|
|
28
|
+
let observation;
|
|
27
29
|
const client = new Client(
|
|
28
30
|
{ name: "promptframe-creation-bridge", version: CLIENT_VERSION },
|
|
29
31
|
{ capabilities: {} },
|
|
@@ -36,6 +38,7 @@ export async function connectPlatform(credentials,{host=resolveHostIdentity(),co
|
|
|
36
38
|
const types=declaredHostContentTypes({experimental:{'promptframe.contentTypes':contentTypes()}});
|
|
37
39
|
headers.set('X-PromptFrame-Content-Types',JSON.stringify(types));
|
|
38
40
|
headers.set('X-PromptFrame-Content-Source',contentSource());
|
|
41
|
+
if(observation)headers.set('X-PromptFrame-Client-Observation',encodeURIComponent(JSON.stringify(observation)));
|
|
39
42
|
return fetch(url,{...init,headers,...(signal?{signal:init?.signal?AbortSignal.any([init.signal,signal]):signal}:{})});
|
|
40
43
|
},
|
|
41
44
|
requestInit: {
|
|
@@ -54,7 +57,15 @@ export async function connectPlatform(credentials,{host=resolveHostIdentity(),co
|
|
|
54
57
|
);
|
|
55
58
|
try {
|
|
56
59
|
await client.connect(transport,signal?{signal}:undefined);
|
|
57
|
-
connectionAccountIdentity(client,expectedIdentity);
|
|
60
|
+
const identity=connectionAccountIdentity(client,expectedIdentity);
|
|
61
|
+
if(identity&&clientConfigFile)try{
|
|
62
|
+
const instanceId=await localClientObservationInstance({identity,configFile:clientConfigFile,
|
|
63
|
+
root:observationRoot??path.join(path.dirname(clientConfigFile),'client-observations')});
|
|
64
|
+
const systemFamily=process.platform==='win32'?'Windows':process.platform==='darwin'?'macOS':
|
|
65
|
+
process.platform==='linux'?(process.env.WSL_INTEROP||process.env.WSL_DISTRO_NAME?'WSL':'Linux'):'unknown';
|
|
66
|
+
observation={contractVersion:'promptframe-client-observation/v1',instanceId,systemFamily,
|
|
67
|
+
application:host.kind==='claude-code'?'Claude Code':host.kind==='codex'?'Codex':'Creation',applicationVersion:CLIENT_VERSION};
|
|
68
|
+
}catch{/* Missing private display metadata must not alter a valid grant. */}
|
|
58
69
|
if(enforceMinimum)assertBridgeCompatible(client.getServerCapabilities(),CLIENT_VERSION);
|
|
59
70
|
else readPlatformBridgePolicy(client.getServerCapabilities());
|
|
60
71
|
return client;
|
package/lib/local-accounts.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { constants } from 'node:fs';
|
|
2
|
-
import { open, lstat, mkdir, rename, unlink, opendir } from 'node:fs/promises';
|
|
2
|
+
import { open, lstat, mkdir, rename, unlink, opendir,link } from 'node:fs/promises';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { createHash, randomUUID } from 'node:crypto';
|
|
@@ -261,3 +261,31 @@ export const readLocalAuthorizations = accountIO(readAuthorizations);
|
|
|
261
261
|
export const listLocalAccounts = accountIO(listAccounts);
|
|
262
262
|
export const selectLocalAccount = accountIO(selectAccount);
|
|
263
263
|
export const readSelectedLocalAccount = accountIO(readSelectedAccount);
|
|
264
|
+
|
|
265
|
+
/** Optional, resettable display identity. It is scoped to the authenticated
|
|
266
|
+
* account and this configuration, never a machine fingerprint or credential. */
|
|
267
|
+
async function clientObservationInstance({root=localAccountsRoot(),identity,configFile}){
|
|
268
|
+
identity=parseAccountIdentity(identity);
|
|
269
|
+
if(typeof configFile!=='string'||!path.isAbsolute(configFile))throw failure('reference_invalid');
|
|
270
|
+
const parent=await ownedPath(root,['client-observations','v1',identity.platformDigest.slice(7),identity.accountDigest.slice(7)],true);
|
|
271
|
+
const file=path.join(parent,localReferenceId('creation',path.resolve(configFile)).slice(7)+'.json');
|
|
272
|
+
const parse=value=>{
|
|
273
|
+
if(!plain(value)||Object.keys(value).sort().join(',')!=='contractVersion,instanceId'
|
|
274
|
+
||value.contractVersion!=='promptframe-client-instance/v1'||typeof value.instanceId!=='string'
|
|
275
|
+
||!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(value.instanceId))throw failure('record_invalid');
|
|
276
|
+
return value.instanceId;
|
|
277
|
+
};
|
|
278
|
+
const existing=await readJson(file);if(existing)return parse(existing);
|
|
279
|
+
const value={contractVersion:'promptframe-client-instance/v1',instanceId:randomUUID()};
|
|
280
|
+
const temporary=path.join(parent,'.'+randomUUID()+'.tmp');let fd;
|
|
281
|
+
try{fd=await open(temporary,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL|constants.O_NOFOLLOW,0o600);
|
|
282
|
+
await fd.writeFile(JSON.stringify(value)+'\n');await fd.sync();await fd.close();fd=undefined;
|
|
283
|
+
// Publish complete bytes without replacing another process's instance.
|
|
284
|
+
await link(temporary,file);
|
|
285
|
+
const directoryHandle=await open(parent,constants.O_RDONLY|constants.O_DIRECTORY|constants.O_NOFOLLOW);
|
|
286
|
+
try{privateOwner(await directoryHandle.stat(),true);await directoryHandle.sync();}finally{await directoryHandle.close();}
|
|
287
|
+
return value.instanceId;
|
|
288
|
+
}catch(error){if(error.code==='EEXIST')return parse(await readJson(file));throw error;}
|
|
289
|
+
finally{await fd?.close();await unlink(temporary).catch(error=>{if(error.code!=='ENOENT')throw error;});}
|
|
290
|
+
}
|
|
291
|
+
export const localClientObservationInstance=accountIO(clientObservationInstance);
|
package/lib/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const CLIENT_VERSION = "0.3.
|
|
1
|
+
export const CLIENT_VERSION = "0.3.12";
|
|
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.12 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.12 connect --host claude-code --endpoint <Studio提供的API地址>`。桌面版远程连接 WSL 时,在该 WSL 执行;保留相同 profile 和有效凭据。
|
|
18
18
|
<!-- /creation-install-command -->
|
|
19
19
|
|
|
20
20
|
命令会复用并验证有效凭据。首次授权或明确更换已失效凭据时,由用户在 Studio 登录并在终端的不回显输入框提供 Token;不要要求用户把 Token 粘进聊天,也不要把它写进命令参数、URL或日志。网络失败不等于授权失效,不自动轮换或覆盖凭据。
|