@koinzhang/paseo-plugin-customize 0.2.1 → 0.4.0
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/CHANGELOG.md +36 -0
- package/README.md +9 -5
- package/client/design-tokens.ts +6 -0
- package/client/dropdown.tsx +42 -35
- package/client/entry-card.tsx +86 -0
- package/client/entry-row.tsx +17 -5
- package/client/grid.test.ts +19 -0
- package/client/grid.ts +18 -0
- package/client/mechanism-card.tsx +1 -1
- package/client/preview-pane.tsx +11 -4
- package/client/provider-options.test.ts +16 -5
- package/client/provider-options.ts +14 -3
- package/client/screen-id.ts +2 -0
- package/client/selection-settings.test.ts +5 -2
- package/client/sidebar-item.tsx +14 -0
- package/client/slash-command.test.ts +24 -7
- package/client/slash-command.ts +3 -2
- package/client/surface.tsx +142 -90
- package/client/ui.tsx +26 -2
- package/index.client.tsx +15 -12
- package/package.json +2 -2
- package/paseo-plugin.json +1 -1
- package/server/compatibility.test.ts +13 -0
- package/server/handlers.ts +9 -4
- package/server/provider-version.test.ts +74 -0
- package/server/provider-version.ts +60 -0
- package/server/providers/opencode.ts +25 -8
- package/server/providers.test.ts +48 -3
- package/server/scan-kit.ts +2 -1
- package/server/scan-snapshot.test.ts +9 -9
- package/server/scan-snapshot.ts +1 -1
- package/server/tokens.test.ts +146 -0
- package/server/tokens.ts +178 -0
- package/shared/contracts.ts +14 -0
- package/shared/i18n.ts +29 -0
- package/shared/mechanisms.ts +15 -5
- package/shared/selection-settings.ts +1 -0
package/shared/i18n.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface Messages {
|
|
|
26
26
|
title: string;
|
|
27
27
|
openBoard: string;
|
|
28
28
|
provider: string;
|
|
29
|
+
providerVersion: (version: string) => string;
|
|
29
30
|
compatibility: (state: "on" | "off" | "unknown" | "supported") => string;
|
|
30
31
|
builtinProvider: string;
|
|
31
32
|
noEnabledProvider: string;
|
|
@@ -37,6 +38,8 @@ export interface Messages {
|
|
|
37
38
|
refresh: string;
|
|
38
39
|
lastScanned: (date: string) => string;
|
|
39
40
|
search: string;
|
|
41
|
+
showCards: string;
|
|
42
|
+
showList: string;
|
|
40
43
|
skillInvocation: string;
|
|
41
44
|
skillFilters: Record<"all" | "auto" | "manual", string>;
|
|
42
45
|
categories: Record<Category, string>;
|
|
@@ -44,6 +47,10 @@ export interface Messages {
|
|
|
44
47
|
statuses: Record<Status, string>;
|
|
45
48
|
tags: Record<Tag, string>;
|
|
46
49
|
agentPluginLabel: (version: string, validation: "valid" | "unsupported") => string;
|
|
50
|
+
tokens: (value: string) => string;
|
|
51
|
+
tokensOnInvoke: (value: string) => string;
|
|
52
|
+
tokensHint: (value: string) => string;
|
|
53
|
+
tokensOnInvokeHint: (value: string) => string;
|
|
47
54
|
reason: (code: ReasonCode, value: string | undefined) => string;
|
|
48
55
|
howItWorks: string;
|
|
49
56
|
showDetails: string;
|
|
@@ -74,6 +81,7 @@ const en: Messages = {
|
|
|
74
81
|
title: "Customize",
|
|
75
82
|
openBoard: "Open Customize",
|
|
76
83
|
provider: "Provider",
|
|
84
|
+
providerVersion: (version) => `Provider version: ${version}`,
|
|
77
85
|
compatibility: (state) => state === "on" ? "Third-party skill directories enabled" : state === "off" ? "Third-party skill directories disabled" : state === "supported" ? "Supports shared skill directories" : "Third-party skill directory state unavailable",
|
|
78
86
|
builtinProvider: "Built-in",
|
|
79
87
|
noEnabledProvider: "No supported providers are enabled in Paseo.",
|
|
@@ -85,6 +93,8 @@ const en: Messages = {
|
|
|
85
93
|
refresh: "Rescan",
|
|
86
94
|
lastScanned: (date) => `Last scanned: ${date}`,
|
|
87
95
|
search: "Filter by name or path",
|
|
96
|
+
showCards: "Switch to card view",
|
|
97
|
+
showList: "Switch to list view",
|
|
88
98
|
skillInvocation: "Skill invocation",
|
|
89
99
|
skillFilters: { all: "All", auto: "Auto", manual: "Manual" },
|
|
90
100
|
categories: { instructions: "Instructions", rules: "Rules", skills: "Skills", mcp: "MCP", commands: "Commands", subagents: "Subagents", plugins: "Plugins" },
|
|
@@ -120,6 +130,10 @@ const en: Messages = {
|
|
|
120
130
|
synced: "claude.ai sync",
|
|
121
131
|
},
|
|
122
132
|
agentPluginLabel: (version, validation) => `Agent Plugins ${version}${validation === "unsupported" ? " (unverified)" : ""}`,
|
|
133
|
+
tokens: (value) => `≈${value} tok`,
|
|
134
|
+
tokensOnInvoke: (value) => `+${value} on invoke`,
|
|
135
|
+
tokensHint: (value) => `Estimated tokens loaded without an action: ${value}. Skills, commands, and agents load their body only when used; MCP is not counted.`,
|
|
136
|
+
tokensOnInvokeHint: (value) => `Estimated tokens added when this entry is invoked: ${value}.`,
|
|
123
137
|
reason: (code, value) => {
|
|
124
138
|
switch (code) {
|
|
125
139
|
case "frontmatter":
|
|
@@ -183,6 +197,7 @@ const zh: Messages = {
|
|
|
183
197
|
title: "Customize",
|
|
184
198
|
openBoard: "打开 Customize",
|
|
185
199
|
provider: "Provider",
|
|
200
|
+
providerVersion: (version) => `Provider 版本:${version}`,
|
|
186
201
|
compatibility: (state) => state === "on" ? "已开启第三方技能目录兼容" : state === "off" ? "已关闭第三方技能目录兼容" : state === "supported" ? "支持共享技能目录" : "第三方技能目录兼容状态未知",
|
|
187
202
|
builtinProvider: "内置",
|
|
188
203
|
noEnabledProvider: "Paseo 中没有已启用且受 Customize 支持的 Provider。",
|
|
@@ -194,6 +209,8 @@ const zh: Messages = {
|
|
|
194
209
|
refresh: "重新扫描",
|
|
195
210
|
lastScanned: (date) => `上次扫描:${date}`,
|
|
196
211
|
search: "按名称或路径筛选",
|
|
212
|
+
showCards: "切换为卡片视图",
|
|
213
|
+
showList: "切换为列表视图",
|
|
197
214
|
skillInvocation: "技能调用方式",
|
|
198
215
|
skillFilters: { all: "全部", auto: "自动", manual: "仅手动" },
|
|
199
216
|
categories: { instructions: "指令", rules: "规则", skills: "Skills", mcp: "MCP", commands: "命令", subagents: "子代理", plugins: "插件" },
|
|
@@ -229,6 +246,10 @@ const zh: Messages = {
|
|
|
229
246
|
synced: "claude.ai 同步",
|
|
230
247
|
},
|
|
231
248
|
agentPluginLabel: (version, validation) => `Agent Plugins ${version}${validation === "unsupported" ? "(未校验)" : ""}`,
|
|
249
|
+
tokens: (value) => `≈${value} tok`,
|
|
250
|
+
tokensOnInvoke: (value) => `+${value} 调用时`,
|
|
251
|
+
tokensHint: (value) => `无需操作即加载的 token 估算:${value}。Skills、命令与子代理只在被调用时加载正文;MCP 不计入。`,
|
|
252
|
+
tokensOnInvokeHint: (value) => `被调用时额外加载的 token 估算:${value}。`,
|
|
232
253
|
reason: (code, value) => {
|
|
233
254
|
switch (code) {
|
|
234
255
|
case "frontmatter":
|
|
@@ -297,3 +318,11 @@ export function formatBytes(bytes: number): string {
|
|
|
297
318
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
298
319
|
return `${(bytes / 1024 / 1024).toFixed(1)} MiB`;
|
|
299
320
|
}
|
|
321
|
+
|
|
322
|
+
/** Compact token count: exact below 1k, one decimal below 10k, integer k, one decimal M. */
|
|
323
|
+
export function formatTokenCount(tokens: number): string {
|
|
324
|
+
if (tokens < 1_000) return String(tokens);
|
|
325
|
+
if (tokens < 10_000) return `${(tokens / 1_000).toFixed(1)}k`;
|
|
326
|
+
if (tokens < 1_000_000) return `${Math.round(tokens / 1_000)}k`;
|
|
327
|
+
return `${(tokens / 1_000_000).toFixed(1)}M`;
|
|
328
|
+
}
|
package/shared/mechanisms.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ACP_CONFIGS, type AcpConfig, type AcpProviderId } from "./acp-configs.ts";
|
|
2
|
-
import { CATEGORIES, type Category, type Compatibility, type Scope } from "./contracts.ts";
|
|
2
|
+
import { CATEGORIES, type Category, type Compatibility, type ProviderVersion, type Scope } from "./contracts.ts";
|
|
3
3
|
import { PROVIDER_IDS, type ProviderId } from "./providers.ts";
|
|
4
4
|
|
|
5
5
|
/** Bilingual static copy; the client picks by app language. */
|
|
@@ -257,8 +257,8 @@ const BASE_MECHANISMS: Partial<Record<ProviderId, Partial<Record<Category, Mecha
|
|
|
257
257
|
{ scope: "user", path: "~/.claude/skills · ~/.agents/skills" },
|
|
258
258
|
],
|
|
259
259
|
notes: [
|
|
260
|
-
L("
|
|
261
|
-
L("`permission.skill`
|
|
260
|
+
L("OpenCode v2: `metadata.opencode/autoinvoke: false` hides a skill from the model's available list; it can still be loaded explicitly by ID. Other agents' `disable-model-invocation` is ignored.", "OpenCode v2:`metadata.opencode/autoinvoke: false` 隐藏模型可用列表中的技能,仍可按 ID 显式加载;忽略其他 agent 的 `disable-model-invocation`。"),
|
|
261
|
+
L("Skill permissions: v1 uses `permission.skill`, v2 uses `permissions[]`. deny hides and blocks loading; ask prompts first. The body loads on demand through the skill tool.", "Skill 权限:v1 使用 `permission.skill`,v2 使用 `permissions[]`。deny 隐藏并禁止加载,ask 先确认;正文仍由 skill 工具按需加载。"),
|
|
262
262
|
],
|
|
263
263
|
},
|
|
264
264
|
mcp: {
|
|
@@ -359,8 +359,18 @@ export const MECHANISMS = Object.fromEntries(PROVIDER_IDS.map((id) => [
|
|
|
359
359
|
])) as Record<ProviderId, Record<Category, Mechanism>>;
|
|
360
360
|
|
|
361
361
|
/** Reflect local compatibility switches in the discovery explanation. */
|
|
362
|
-
export function mechanismFor(provider: ProviderId, category: Category, compatibility: Compatibility | null | undefined): Mechanism {
|
|
363
|
-
|
|
362
|
+
export function mechanismFor(provider: ProviderId, category: Category, compatibility: Compatibility | null | undefined, providerVersion?: ProviderVersion): Mechanism {
|
|
363
|
+
let base = MECHANISMS[provider][category];
|
|
364
|
+
if (provider === "opencode" && category === "skills") {
|
|
365
|
+
const version = providerVersion?.version;
|
|
366
|
+
const invocation = version && Number(version.split(".")[0]) < 2
|
|
367
|
+
? L("OpenCode v1 advertises every discovered, permitted skill automatically; v2's `metadata.opencode/autoinvoke` and other agents' `disable-model-invocation` are ignored.",
|
|
368
|
+
"OpenCode v1 会自动列出所有已发现且获准使用的技能;忽略 v2 的 `metadata.opencode/autoinvoke` 和其他 agent 的 `disable-model-invocation`。")
|
|
369
|
+
: base.notes[0]!;
|
|
370
|
+
const unknown = L("Skills with `metadata.opencode/autoinvoke: false` await version confirmation; this switch requires v2.",
|
|
371
|
+
"带 `metadata.opencode/autoinvoke: false` 的技能待版本确认,此开关需要 v2。");
|
|
372
|
+
base = { ...base, notes: [...(!version ? [unknown] : []), invocation, ...base.notes.slice(1)] };
|
|
373
|
+
}
|
|
364
374
|
if (!compatibility || !(provider === "cursor" && (category === "skills" || category === "subagents")
|
|
365
375
|
|| provider === "opencode" && category === "skills")) return base;
|
|
366
376
|
const isCursor = provider === "cursor";
|