@zenaigc/zenmcp 0.1.3 → 0.1.4
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/INSTALL.md +14 -0
- package/dist/src/mcp/guidance.js +85 -0
- package/dist/src/mcp/server.js +191 -44
- package/package.json +1 -1
- package/skills/zenmcp/SKILL.md +22 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-account.json +15 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-account.minimal.json +7 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-budget-confirm.insufficient.json +30 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-budget-confirm.json +30 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-budget-confirm.minimal.json +9 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-budget-confirm.unknown.json +30 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-install-checklist.failed.json +34 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-install-checklist.json +33 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-model-picker.json +25 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.defaults.json +96 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.insufficient.json +119 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.json +119 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.large.json +119 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.readonly.json +57 -0
- package/skills/zenmcp/widgets/fixtures/zenmcp-spend-confirm.unknown.json +119 -0
- package/skills/zenmcp/widgets/zenmcp-account/template.json +55 -0
- package/skills/zenmcp/widgets/zenmcp-account/widget.html +28 -0
- package/skills/zenmcp/widgets/zenmcp-budget-confirm/template.json +72 -0
- package/skills/zenmcp/widgets/zenmcp-budget-confirm/widget.html +32 -0
- package/skills/zenmcp/widgets/zenmcp-install-checklist/template.json +55 -0
- package/skills/zenmcp/widgets/zenmcp-install-checklist/widget.html +25 -0
- package/skills/zenmcp/widgets/zenmcp-model-picker/template.json +31 -0
- package/skills/zenmcp/widgets/zenmcp-model-picker/widget.html +28 -0
- package/skills/zenmcp/widgets/zenmcp-spend-confirm/template.json +181 -0
- package/skills/zenmcp/widgets/zenmcp-spend-confirm/widget.html +85 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"confirmation": {
|
|
3
|
+
"kind": "spend",
|
|
4
|
+
"credits": 24,
|
|
5
|
+
"balance_before": null,
|
|
6
|
+
"balance_after": null,
|
|
7
|
+
"sufficient": null,
|
|
8
|
+
"large": false,
|
|
9
|
+
"params": [
|
|
10
|
+
{
|
|
11
|
+
"key": "ratio",
|
|
12
|
+
"label": "画幅",
|
|
13
|
+
"value": "横屏"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"key": "resolution",
|
|
17
|
+
"label": "分辨率",
|
|
18
|
+
"value": "高清"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"key": "duration",
|
|
22
|
+
"label": "时长",
|
|
23
|
+
"value": 5
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"key": "audio",
|
|
27
|
+
"label": "声音",
|
|
28
|
+
"value": true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"key": "prompt",
|
|
32
|
+
"label": "提示词",
|
|
33
|
+
"value": "日落下的海边"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "watermark",
|
|
37
|
+
"label": "水印",
|
|
38
|
+
"value": false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "style",
|
|
42
|
+
"label": "风格",
|
|
43
|
+
"value": "自然"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"uploads": [
|
|
47
|
+
"海边参考.png",
|
|
48
|
+
"人物参考.png"
|
|
49
|
+
],
|
|
50
|
+
"prompt_preview": "日落下的海边,一位穿白色外套的人走向海浪。"
|
|
51
|
+
},
|
|
52
|
+
"requestDigest": "quote-example-001",
|
|
53
|
+
"directory": "/tmp/海边任务",
|
|
54
|
+
"capability": "video.example",
|
|
55
|
+
"model_label": "示例视频模型",
|
|
56
|
+
"account_url": "https://example.com/account",
|
|
57
|
+
"param_spec": [
|
|
58
|
+
{
|
|
59
|
+
"key": "ratio",
|
|
60
|
+
"type": "segmented",
|
|
61
|
+
"label": "画幅",
|
|
62
|
+
"options": [
|
|
63
|
+
{
|
|
64
|
+
"value": "16:9",
|
|
65
|
+
"label": "横屏"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"value": "9:16",
|
|
69
|
+
"label": "竖屏"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"default": "16:9"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"key": "resolution",
|
|
76
|
+
"type": "select",
|
|
77
|
+
"label": "分辨率",
|
|
78
|
+
"options": [
|
|
79
|
+
{
|
|
80
|
+
"value": "720p",
|
|
81
|
+
"label": "高清"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"value": "1080p",
|
|
85
|
+
"label": "超清"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"key": "duration",
|
|
91
|
+
"type": "slider",
|
|
92
|
+
"label": "时长",
|
|
93
|
+
"min": 3,
|
|
94
|
+
"max": 10,
|
|
95
|
+
"step": 0.5,
|
|
96
|
+
"default": 5
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"key": "audio",
|
|
100
|
+
"type": "toggle",
|
|
101
|
+
"label": "声音",
|
|
102
|
+
"default": true
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"key": "prompt",
|
|
106
|
+
"type": "text",
|
|
107
|
+
"label": "提示词",
|
|
108
|
+
"max_length": 200,
|
|
109
|
+
"placeholder": "画面描述"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"key": "style",
|
|
113
|
+
"type": "text",
|
|
114
|
+
"label": "风格",
|
|
115
|
+
"default": "自然",
|
|
116
|
+
"max_length": 40
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zenmcp-account",
|
|
3
|
+
"title": "账户与开始使用",
|
|
4
|
+
"description": "账户积分、额度与工具提供的入门示例",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"credits_available": {
|
|
9
|
+
"type": "number"
|
|
10
|
+
},
|
|
11
|
+
"daily_credit_limit": {
|
|
12
|
+
"type": [
|
|
13
|
+
"number",
|
|
14
|
+
"null"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"used_today": {
|
|
18
|
+
"type": "number"
|
|
19
|
+
},
|
|
20
|
+
"effective_available_credits": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
"account_url": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"getting_started": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"required": [
|
|
29
|
+
"examples",
|
|
30
|
+
"billing_rule"
|
|
31
|
+
],
|
|
32
|
+
"properties": {
|
|
33
|
+
"examples": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"billing_rule": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"credits_available",
|
|
47
|
+
"daily_credit_limit",
|
|
48
|
+
"used_today",
|
|
49
|
+
"effective_available_credits",
|
|
50
|
+
"account_url"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"layout": "fluid",
|
|
54
|
+
"version": 1
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
*{box-sizing:border-box}main{color:var(--color-text-primary);font:400 15px/1.6 var(--font-sans,system-ui,sans-serif);overflow-wrap:anywhere;width:100%;display:block}section{background:var(--color-background-primary);border:0.5px solid var(--color-border-secondary);border-radius:var(--border-radius-lg);padding:1rem 1.25rem}p,dl{margin:0 0 1rem}.row,.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.actions{margin-top:1rem}.stack{display:grid;gap:12px}.field{display:grid;gap:4px;min-width:0}label{display:block;color:var(--color-text-secondary)}.metric{font-size:28px;font-weight:500;line-height:1.3;font-variant-numeric:tabular-nums}.muted,dt{color:var(--color-text-secondary)}.surface{background:var(--color-background-secondary);color:var(--color-text-primary);border-radius:var(--border-radius-md);padding:12px;margin-bottom:1rem}.warning{background:var(--color-background-warning);color:var(--color-text-warning)}.shortage{background:var(--color-background-danger);color:var(--color-text-danger)}.danger{color:var(--color-text-danger)}.success{color:var(--color-text-success)}.info{color:var(--color-text-primary);font-weight:500}.kv{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:8px}dd{margin:0}.preview{white-space:pre-wrap}.options{display:flex;flex-wrap:wrap;gap:8px}.options label{display:flex;gap:4px;align-items:center;white-space:nowrap;color:var(--color-text-primary)}button,input,select,option{font:inherit;color:var(--color-text-primary)}button{background:transparent;border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:6px 14px;cursor:pointer;max-width:100%;opacity:1}button:hover{background:var(--color-background-secondary)}button.primary{background:var(--color-text-primary);border-color:var(--color-text-primary);color:var(--color-background-primary);font-weight:500}button.plain{border-color:transparent;text-decoration:underline;text-underline-offset:3px;padding:6px 4px}input:not([type=checkbox]):not([type=radio]):not([type=range]),select{width:100%;min-width:0;background:var(--color-background-primary);border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:5px 8px}option{background:var(--color-background-primary)}::placeholder{color:var(--color-text-secondary);opacity:1}input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--color-text-primary);justify-self:start}button:disabled,input:disabled,select:disabled{opacity:1;cursor:not-allowed}button:disabled{background:var(--color-background-secondary);border-style:dashed;border-color:var(--color-text-secondary);color:var(--color-text-secondary);font-weight:400;text-decoration:none}input:disabled,select:disabled{background:var(--color-background-secondary);color:var(--color-text-secondary)}.models{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}.model{text-align:left;width:100%;white-space:normal;padding:10px 12px}.model span{display:block}output[role=status]{display:block;margin-top:8px;color:var(--color-text-secondary)}.step{padding-bottom:12px;border-bottom:0.5px solid var(--color-border-secondary)}.more{margin-top:1rem;padding-top:1rem;border-top:0.5px solid var(--color-border-secondary)}.closed{display:none}.budget-row{display:flex;gap:8px;align-items:center}.budget-row input{flex:1;width:0;min-width:0}.budget-row button{flex:none}
|
|
3
|
+
</style>
|
|
4
|
+
<main>
|
|
5
|
+
<section><div class="surface"><span>当前可支配积分</span><div id="available" class="metric"></div></div><dl id="stats" class="kv"></dl><p id="billing"></p><div id="examples" class="stack"></div><div class="actions"><button id="recharge">充值</button></div></section><output id="sent" role="status" aria-live="polite"></output></main>
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
const data = window.widget.data;
|
|
9
|
+
const $ = id => document.getElementById(id);
|
|
10
|
+
const number = value => Number(Number(value).toFixed(4));
|
|
11
|
+
const display = value => typeof value === 'number' ? String(number(value)) : String(value ?? '');
|
|
12
|
+
const node = (tag, text, cls) => { const e = document.createElement(tag); if (text !== undefined) e.textContent = display(text); if (cls) e.className = cls; return e; };
|
|
13
|
+
const pair = (parent, label, value) => { parent.append(node('dt', label), node('dd', value)); };
|
|
14
|
+
let sent = false;
|
|
15
|
+
const act = fn => { if (sent) return; sent = true; document.querySelectorAll('button,input,select').forEach(e => e.disabled = true); $('sent').textContent = '已发送'; fn(); };
|
|
16
|
+
const prompt = text => act(() => sendPrompt(text));
|
|
17
|
+
const account = url => { if (url) act(() => openLink(url)); };
|
|
18
|
+
|
|
19
|
+
$('available').textContent = display(data.effective_available_credits);
|
|
20
|
+
pair($('stats'),'账户积分',data.credits_available);
|
|
21
|
+
if (data.daily_credit_limit != null) pair($('stats'),'每日额度',data.daily_credit_limit);
|
|
22
|
+
pair($('stats'),'今日已用',data.used_today);
|
|
23
|
+
$('billing').textContent = data.getting_started?.billing_rule ?? '';
|
|
24
|
+
(data.getting_started?.examples ?? []).forEach(example => { const button = node('button',`${example} \u2197`); button.onclick = () => prompt(example); $('examples').append(button); });
|
|
25
|
+
$('recharge').disabled = !data.account_url;
|
|
26
|
+
$('recharge').onclick = () => account(data.account_url);
|
|
27
|
+
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zenmcp-budget-confirm",
|
|
3
|
+
"title": "复刻预算确认",
|
|
4
|
+
"description": "复刻任务总预算、分段及重试预留",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"confirmation": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": [
|
|
11
|
+
"kind",
|
|
12
|
+
"total_credits",
|
|
13
|
+
"retry_reserve_credits"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"kind": {
|
|
17
|
+
"const": "budget"
|
|
18
|
+
},
|
|
19
|
+
"total_credits": {
|
|
20
|
+
"type": "number"
|
|
21
|
+
},
|
|
22
|
+
"retry_reserve_credits": {
|
|
23
|
+
"type": "number"
|
|
24
|
+
},
|
|
25
|
+
"balance_before": {
|
|
26
|
+
"type": [
|
|
27
|
+
"number",
|
|
28
|
+
"null"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"balance_after": {
|
|
32
|
+
"type": [
|
|
33
|
+
"number",
|
|
34
|
+
"null"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"sufficient": {
|
|
38
|
+
"type": [
|
|
39
|
+
"boolean",
|
|
40
|
+
"null"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"large": {
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"segments": {
|
|
47
|
+
"type": "array"
|
|
48
|
+
},
|
|
49
|
+
"assets": {
|
|
50
|
+
"type": "array"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"planDigest": {
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"directory": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"account_url": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": [
|
|
65
|
+
"confirmation",
|
|
66
|
+
"planDigest",
|
|
67
|
+
"directory"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"layout": "fluid",
|
|
71
|
+
"version": 1
|
|
72
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
*{box-sizing:border-box}main{color:var(--color-text-primary);font:400 15px/1.6 var(--font-sans,system-ui,sans-serif);overflow-wrap:anywhere;width:100%;display:block}section{background:var(--color-background-primary);border:0.5px solid var(--color-border-secondary);border-radius:var(--border-radius-lg);padding:1rem 1.25rem}p,dl{margin:0 0 1rem}.row,.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.actions{margin-top:1rem}.stack{display:grid;gap:12px}.field{display:grid;gap:4px;min-width:0}label{display:block;color:var(--color-text-secondary)}.metric{font-size:28px;font-weight:500;line-height:1.3;font-variant-numeric:tabular-nums}.muted,dt{color:var(--color-text-secondary)}.surface{background:var(--color-background-secondary);color:var(--color-text-primary);border-radius:var(--border-radius-md);padding:12px;margin-bottom:1rem}.warning{background:var(--color-background-warning);color:var(--color-text-warning)}.shortage{background:var(--color-background-danger);color:var(--color-text-danger)}.danger{color:var(--color-text-danger)}.success{color:var(--color-text-success)}.info{color:var(--color-text-primary);font-weight:500}.kv{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:8px}dd{margin:0}.preview{white-space:pre-wrap}.options{display:flex;flex-wrap:wrap;gap:8px}.options label{display:flex;gap:4px;align-items:center;white-space:nowrap;color:var(--color-text-primary)}button,input,select,option{font:inherit;color:var(--color-text-primary)}button{background:transparent;border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:6px 14px;cursor:pointer;max-width:100%;opacity:1}button:hover{background:var(--color-background-secondary)}button.primary{background:var(--color-text-primary);border-color:var(--color-text-primary);color:var(--color-background-primary);font-weight:500}button.plain{border-color:transparent;text-decoration:underline;text-underline-offset:3px;padding:6px 4px}input:not([type=checkbox]):not([type=radio]):not([type=range]),select{width:100%;min-width:0;background:var(--color-background-primary);border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:5px 8px}option{background:var(--color-background-primary)}::placeholder{color:var(--color-text-secondary);opacity:1}input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--color-text-primary);justify-self:start}button:disabled,input:disabled,select:disabled{opacity:1;cursor:not-allowed}button:disabled{background:var(--color-background-secondary);border-style:dashed;border-color:var(--color-text-secondary);color:var(--color-text-secondary);font-weight:400;text-decoration:none}input:disabled,select:disabled{background:var(--color-background-secondary);color:var(--color-text-secondary)}.models{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}.model{text-align:left;width:100%;white-space:normal;padding:10px 12px}.model span{display:block}output[role=status]{display:block;margin-top:8px;color:var(--color-text-secondary)}.step{padding-bottom:12px;border-bottom:0.5px solid var(--color-border-secondary)}.more{margin-top:1rem;padding-top:1rem;border-top:0.5px solid var(--color-border-secondary)}.closed{display:none}.budget-row{display:flex;gap:8px;align-items:center}.budget-row input{flex:1;width:0;min-width:0}.budget-row button{flex:none}
|
|
3
|
+
</style>
|
|
4
|
+
<main>
|
|
5
|
+
<section><div id="cost" class="surface"><span>任务总预算</span><div id="total" class="metric"></div><div id="balance"></div></div><dl id="reserve" class="kv"></dl><dl id="segments" class="kv"></dl><div id="assets"></div><p class="muted">请核对上方完整执行计划;服装与身份仍需人工验收。</p><div class="actions"><button id="confirm" class="primary">确认执行 ↗</button><button id="cancel">取消 ↗</button></div></section><output id="sent" role="status" aria-live="polite"></output></main>
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
const data = window.widget.data;
|
|
9
|
+
const $ = id => document.getElementById(id);
|
|
10
|
+
const number = value => Number(Number(value).toFixed(4));
|
|
11
|
+
const display = value => typeof value === 'number' ? String(number(value)) : String(value ?? '');
|
|
12
|
+
const node = (tag, text, cls) => { const e = document.createElement(tag); if (text !== undefined) e.textContent = display(text); if (cls) e.className = cls; return e; };
|
|
13
|
+
const pair = (parent, label, value) => { parent.append(node('dt', label), node('dd', value)); };
|
|
14
|
+
let sent = false;
|
|
15
|
+
const act = fn => { if (sent) return; sent = true; document.querySelectorAll('button,input,select').forEach(e => e.disabled = true); $('sent').textContent = '已发送'; fn(); };
|
|
16
|
+
const prompt = text => act(() => sendPrompt(text));
|
|
17
|
+
const account = url => { if (url) act(() => openLink(url)); };
|
|
18
|
+
|
|
19
|
+
const c = data.confirmation;
|
|
20
|
+
const view = { total: c.total_credits, reserve: c.retry_reserve_credits, before: c.balance_before, after: c.balance_after, sufficient: c.sufficient, large: c.large, segments: c.segments, assets: c.assets, digest: data.planDigest, directory: data.directory, accountUrl: data.account_url };
|
|
21
|
+
$('total').textContent = `${display(view.total)} 积分`;
|
|
22
|
+
$('cost').classList.toggle('warning', view.large === true);
|
|
23
|
+
$('cost').classList.toggle('shortage', view.sufficient === false);
|
|
24
|
+
if (view.before != null && view.after != null) $('balance').textContent = view.sufficient === false ? (view.before < view.total ? `余额 ${display(view.before)},还差 ${display(view.total - view.before)}` : `账户余额 ${display(view.before)},本次可用额度不足,请充值或调整平台 Key 限额。`) : `余额 ${display(view.before)} → ${display(view.after)}`;
|
|
25
|
+
pair($('reserve'),'重试预留',`${display(view.reserve)} 积分(已含在总预算中,仅实际重试时使用,未重试不扣)`);
|
|
26
|
+
(view.segments ?? []).forEach(s => pair($('segments'),s.label,`${display(s.credits)} 积分`));
|
|
27
|
+
if (view.assets?.length) $('assets').append(node('label','素材'),node('p',view.assets.join('、')));
|
|
28
|
+
if (view.sufficient === false) { $('confirm').textContent = '充值'; $('confirm').disabled = !view.accountUrl; $('confirm').onclick = () => account(view.accountUrl); }
|
|
29
|
+
else { $('confirm').textContent = `确认执行 ${display(view.total)} 积分 \u2197`; $('confirm').onclick = () => prompt(`确认执行复刻任务,批准 ${display(view.total)} 积分。planDigest=${view.digest},directory=${view.directory}`); }
|
|
30
|
+
$('cancel').onclick = () => prompt('取消这次付费,不要扣费。');
|
|
31
|
+
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zenmcp-install-checklist",
|
|
3
|
+
"title": "安装检查清单",
|
|
4
|
+
"description": "安装状态与本地配置后的继续验证入口",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"steps": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": [
|
|
13
|
+
"key",
|
|
14
|
+
"label",
|
|
15
|
+
"status"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"key": {
|
|
19
|
+
"enum": [
|
|
20
|
+
"env",
|
|
21
|
+
"install",
|
|
22
|
+
"key",
|
|
23
|
+
"client",
|
|
24
|
+
"verify"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"label": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"status": {
|
|
31
|
+
"enum": [
|
|
32
|
+
"done",
|
|
33
|
+
"active",
|
|
34
|
+
"pending",
|
|
35
|
+
"failed"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"detail": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"account_url": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"required": [
|
|
49
|
+
"steps",
|
|
50
|
+
"account_url"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"layout": "fluid",
|
|
54
|
+
"version": 1
|
|
55
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
*{box-sizing:border-box}main{color:var(--color-text-primary);font:400 15px/1.6 var(--font-sans,system-ui,sans-serif);overflow-wrap:anywhere;width:100%;display:block}section{background:var(--color-background-primary);border:0.5px solid var(--color-border-secondary);border-radius:var(--border-radius-lg);padding:1rem 1.25rem}p,dl{margin:0 0 1rem}.row,.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.actions{margin-top:1rem}.stack{display:grid;gap:12px}.field{display:grid;gap:4px;min-width:0}label{display:block;color:var(--color-text-secondary)}.metric{font-size:28px;font-weight:500;line-height:1.3;font-variant-numeric:tabular-nums}.muted,dt{color:var(--color-text-secondary)}.surface{background:var(--color-background-secondary);color:var(--color-text-primary);border-radius:var(--border-radius-md);padding:12px;margin-bottom:1rem}.warning{background:var(--color-background-warning);color:var(--color-text-warning)}.shortage{background:var(--color-background-danger);color:var(--color-text-danger)}.danger{color:var(--color-text-danger)}.success{color:var(--color-text-success)}.info{color:var(--color-text-primary);font-weight:500}.kv{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:8px}dd{margin:0}.preview{white-space:pre-wrap}.options{display:flex;flex-wrap:wrap;gap:8px}.options label{display:flex;gap:4px;align-items:center;white-space:nowrap;color:var(--color-text-primary)}button,input,select,option{font:inherit;color:var(--color-text-primary)}button{background:transparent;border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:6px 14px;cursor:pointer;max-width:100%;opacity:1}button:hover{background:var(--color-background-secondary)}button.primary{background:var(--color-text-primary);border-color:var(--color-text-primary);color:var(--color-background-primary);font-weight:500}button.plain{border-color:transparent;text-decoration:underline;text-underline-offset:3px;padding:6px 4px}input:not([type=checkbox]):not([type=radio]):not([type=range]),select{width:100%;min-width:0;background:var(--color-background-primary);border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:5px 8px}option{background:var(--color-background-primary)}::placeholder{color:var(--color-text-secondary);opacity:1}input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--color-text-primary);justify-self:start}button:disabled,input:disabled,select:disabled{opacity:1;cursor:not-allowed}button:disabled{background:var(--color-background-secondary);border-style:dashed;border-color:var(--color-text-secondary);color:var(--color-text-secondary);font-weight:400;text-decoration:none}input:disabled,select:disabled{background:var(--color-background-secondary);color:var(--color-text-secondary)}.models{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}.model{text-align:left;width:100%;white-space:normal;padding:10px 12px}.model span{display:block}output[role=status]{display:block;margin-top:8px;color:var(--color-text-secondary)}.step{padding-bottom:12px;border-bottom:0.5px solid var(--color-border-secondary)}.more{margin-top:1rem;padding-top:1rem;border-top:0.5px solid var(--color-border-secondary)}.closed{display:none}.budget-row{display:flex;gap:8px;align-items:center}.budget-row input{flex:1;width:0;min-width:0}.budget-row button{flex:none}
|
|
3
|
+
</style>
|
|
4
|
+
<main>
|
|
5
|
+
<section><div id="steps" class="stack"></div><div class="actions"><button id="account">打开账户页</button><button id="verify" class="primary">我已填好 Key ↗</button></div></section><output id="sent" role="status" aria-live="polite"></output></main>
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
const data = window.widget.data;
|
|
9
|
+
const $ = id => document.getElementById(id);
|
|
10
|
+
const number = value => Number(Number(value).toFixed(4));
|
|
11
|
+
const display = value => typeof value === 'number' ? String(number(value)) : String(value ?? '');
|
|
12
|
+
const node = (tag, text, cls) => { const e = document.createElement(tag); if (text !== undefined) e.textContent = display(text); if (cls) e.className = cls; return e; };
|
|
13
|
+
const pair = (parent, label, value) => { parent.append(node('dt', label), node('dd', value)); };
|
|
14
|
+
let sent = false;
|
|
15
|
+
const act = fn => { if (sent) return; sent = true; document.querySelectorAll('button,input,select').forEach(e => e.disabled = true); $('sent').textContent = '已发送'; fn(); };
|
|
16
|
+
const prompt = text => act(() => sendPrompt(text));
|
|
17
|
+
const account = url => { if (url) act(() => openLink(url)); };
|
|
18
|
+
|
|
19
|
+
const statuses = { done: ['已完成','success'], active: ['进行中','info'], pending: ['待完成','muted'], failed: ['失败','danger'] };
|
|
20
|
+
data.steps.forEach(step => { const row = node('div',undefined,'step'); const [label,cls] = statuses[step.status] ?? statuses.pending; const header = node('div',undefined,'row'); header.append(node('span',step.label),node('span',label,cls)); row.append(header); if (step.detail) row.append(node('div',step.detail,'muted')); $('steps').append(row); });
|
|
21
|
+
$('account').disabled = !data.account_url;
|
|
22
|
+
$('account').onclick = () => account(data.account_url);
|
|
23
|
+
$('verify').onclick = () => prompt('我已在配置里填好平台 Key,请继续验证');
|
|
24
|
+
|
|
25
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zenmcp-model-picker",
|
|
3
|
+
"title": "选择生成模型",
|
|
4
|
+
"description": "按工具提供的模型、价格和特点选择",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"medium": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"models": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [
|
|
16
|
+
"capability",
|
|
17
|
+
"label",
|
|
18
|
+
"medium",
|
|
19
|
+
"price_hint",
|
|
20
|
+
"highlights"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"models"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"layout": "fluid",
|
|
30
|
+
"version": 1
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
*{box-sizing:border-box}main{color:var(--color-text-primary);font:400 15px/1.6 var(--font-sans,system-ui,sans-serif);overflow-wrap:anywhere;width:100%;display:block}section{background:var(--color-background-primary);border:0.5px solid var(--color-border-secondary);border-radius:var(--border-radius-lg);padding:1rem 1.25rem}p,dl{margin:0 0 1rem}.row,.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.actions{margin-top:1rem}.stack{display:grid;gap:12px}.field{display:grid;gap:4px;min-width:0}label{display:block;color:var(--color-text-secondary)}.metric{font-size:28px;font-weight:500;line-height:1.3;font-variant-numeric:tabular-nums}.muted,dt{color:var(--color-text-secondary)}.surface{background:var(--color-background-secondary);color:var(--color-text-primary);border-radius:var(--border-radius-md);padding:12px;margin-bottom:1rem}.warning{background:var(--color-background-warning);color:var(--color-text-warning)}.shortage{background:var(--color-background-danger);color:var(--color-text-danger)}.danger{color:var(--color-text-danger)}.success{color:var(--color-text-success)}.info{color:var(--color-text-primary);font-weight:500}.kv{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:8px}dd{margin:0}.preview{white-space:pre-wrap}.options{display:flex;flex-wrap:wrap;gap:8px}.options label{display:flex;gap:4px;align-items:center;white-space:nowrap;color:var(--color-text-primary)}button,input,select,option{font:inherit;color:var(--color-text-primary)}button{background:transparent;border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:6px 14px;cursor:pointer;max-width:100%;opacity:1}button:hover{background:var(--color-background-secondary)}button.primary{background:var(--color-text-primary);border-color:var(--color-text-primary);color:var(--color-background-primary);font-weight:500}button.plain{border-color:transparent;text-decoration:underline;text-underline-offset:3px;padding:6px 4px}input:not([type=checkbox]):not([type=radio]):not([type=range]),select{width:100%;min-width:0;background:var(--color-background-primary);border:1px solid var(--color-text-secondary);border-radius:var(--border-radius-md);padding:5px 8px}option{background:var(--color-background-primary)}::placeholder{color:var(--color-text-secondary);opacity:1}input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--color-text-primary);justify-self:start}button:disabled,input:disabled,select:disabled{opacity:1;cursor:not-allowed}button:disabled{background:var(--color-background-secondary);border-style:dashed;border-color:var(--color-text-secondary);color:var(--color-text-secondary);font-weight:400;text-decoration:none}input:disabled,select:disabled{background:var(--color-background-secondary);color:var(--color-text-secondary)}.models{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}.model{text-align:left;width:100%;white-space:normal;padding:10px 12px}.model span{display:block}output[role=status]{display:block;margin-top:8px;color:var(--color-text-secondary)}.step{padding-bottom:12px;border-bottom:0.5px solid var(--color-border-secondary)}.more{margin-top:1rem;padding-top:1rem;border-top:0.5px solid var(--color-border-secondary)}.closed{display:none}.budget-row{display:flex;gap:8px;align-items:center}.budget-row input{flex:1;width:0;min-width:0}.budget-row button{flex:none}
|
|
3
|
+
</style>
|
|
4
|
+
<main><div id="models" class="models"></div><output id="sent" role="status" aria-live="polite"></output></main>
|
|
5
|
+
<script>
|
|
6
|
+
|
|
7
|
+
const data = window.widget.data;
|
|
8
|
+
const $ = id => document.getElementById(id);
|
|
9
|
+
const number = value => Number(Number(value).toFixed(4));
|
|
10
|
+
const display = value => typeof value === 'number' ? String(number(value)) : String(value ?? '');
|
|
11
|
+
const node = (tag, text, cls) => { const e = document.createElement(tag); if (text !== undefined) e.textContent = display(text); if (cls) e.className = cls; return e; };
|
|
12
|
+
const pair = (parent, label, value) => { parent.append(node('dt', label), node('dd', value)); };
|
|
13
|
+
let sent = false;
|
|
14
|
+
const act = fn => { if (sent) return; sent = true; document.querySelectorAll('button,input,select').forEach(e => e.disabled = true); $('sent').textContent = '已发送'; fn(); };
|
|
15
|
+
const prompt = text => act(() => sendPrompt(text));
|
|
16
|
+
const account = url => { if (url) act(() => openLink(url)); };
|
|
17
|
+
|
|
18
|
+
const mediumLabels = { image: '图片', video: '视频', audio: '音频' };
|
|
19
|
+
data.models.forEach(model => {
|
|
20
|
+
const button = node('button',undefined,'model');
|
|
21
|
+
button.append(node('span',model.label),node('span',mediumLabels[model.medium] ?? model.medium,'muted'),node('span',model.price_hint));
|
|
22
|
+
model.highlights.forEach(item => button.append(node('span',item,'muted')));
|
|
23
|
+
button.append(node('span','选择此模型 \u2197'));
|
|
24
|
+
button.onclick = () => prompt(`用 ${model.label}(${model.capability})来生成`);
|
|
25
|
+
$('models').append(button);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zenmcp-spend-confirm",
|
|
3
|
+
"title": "付费生成确认",
|
|
4
|
+
"description": "单次生成报价、参数编辑与预算授权",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"confirmation": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": [
|
|
11
|
+
"kind",
|
|
12
|
+
"credits",
|
|
13
|
+
"balance_before",
|
|
14
|
+
"balance_after",
|
|
15
|
+
"sufficient",
|
|
16
|
+
"large",
|
|
17
|
+
"params",
|
|
18
|
+
"uploads",
|
|
19
|
+
"prompt_preview"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"kind": {
|
|
23
|
+
"const": "spend"
|
|
24
|
+
},
|
|
25
|
+
"credits": {
|
|
26
|
+
"type": "number"
|
|
27
|
+
},
|
|
28
|
+
"balance_before": {
|
|
29
|
+
"type": [
|
|
30
|
+
"number",
|
|
31
|
+
"null"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"balance_after": {
|
|
35
|
+
"type": [
|
|
36
|
+
"number",
|
|
37
|
+
"null"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"sufficient": {
|
|
41
|
+
"type": [
|
|
42
|
+
"boolean",
|
|
43
|
+
"null"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"large": {
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
},
|
|
49
|
+
"params": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"required": [
|
|
54
|
+
"key",
|
|
55
|
+
"label",
|
|
56
|
+
"value"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"uploads": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"prompt_preview": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"requestDigest": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"directory": {
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"capability": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"model_label": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
83
|
+
"param_spec": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"required": [
|
|
88
|
+
"key",
|
|
89
|
+
"type",
|
|
90
|
+
"label"
|
|
91
|
+
],
|
|
92
|
+
"properties": {
|
|
93
|
+
"key": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"type": {
|
|
97
|
+
"enum": [
|
|
98
|
+
"segmented",
|
|
99
|
+
"select",
|
|
100
|
+
"slider",
|
|
101
|
+
"text",
|
|
102
|
+
"toggle"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"label": {
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"options": {
|
|
109
|
+
"type": [
|
|
110
|
+
"array",
|
|
111
|
+
"null"
|
|
112
|
+
],
|
|
113
|
+
"items": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": [
|
|
116
|
+
"value",
|
|
117
|
+
"label"
|
|
118
|
+
],
|
|
119
|
+
"properties": {
|
|
120
|
+
"value": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"label": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"min": {
|
|
130
|
+
"type": [
|
|
131
|
+
"number",
|
|
132
|
+
"null"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"max": {
|
|
136
|
+
"type": [
|
|
137
|
+
"number",
|
|
138
|
+
"null"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"step": {
|
|
142
|
+
"type": [
|
|
143
|
+
"number",
|
|
144
|
+
"null"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"default": {},
|
|
148
|
+
"required": {
|
|
149
|
+
"type": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"placeholder": {
|
|
152
|
+
"type": [
|
|
153
|
+
"string",
|
|
154
|
+
"null"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"max_length": {
|
|
158
|
+
"type": [
|
|
159
|
+
"integer",
|
|
160
|
+
"null"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"account_url": {
|
|
167
|
+
"type": "string"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"required": [
|
|
171
|
+
"confirmation",
|
|
172
|
+
"requestDigest",
|
|
173
|
+
"directory",
|
|
174
|
+
"capability",
|
|
175
|
+
"model_label",
|
|
176
|
+
"account_url"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"layout": "fluid",
|
|
180
|
+
"version": 1
|
|
181
|
+
}
|