@coda-console/plugin-check 0.5.27 → 0.5.28
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/README.md
CHANGED
|
@@ -16,6 +16,7 @@ plugins/grok-bot/ Grok Bot:把 xAI 云端 Bot 接成长期会话,原
|
|
|
16
16
|
plugins/opencode/ OpenCode:在运行机的 opencode acp 与 Coda 之间转发,送入会话指令与所选模型服务,模型按来源分组
|
|
17
17
|
plugins/codex-accounts/ Codex 多账号:管理登录、自动续期与账号选择,接管 Codex 额度面板
|
|
18
18
|
plugins/cursor/ Cursor:在运行机的 cursor-agent acp 与 Coda 之间转发,送入会话指令
|
|
19
|
+
plugins/git/ Git 源与快照:本机仓库 provider、运行关联的工作树/提交快照、临时 ref 回收与只读 smart HTTP v2
|
|
19
20
|
plugins/host/ 宿主资源:Xcode 构建、Apple 模拟器与项目要求排队的命令共用这台机器的一组名额(组 host、持锁执行 run-held、host-sim),面板「构建与模拟器名额」
|
|
20
21
|
plugins/magpie/ Magpie:把本机的 Magpie 网关作为模型服务提供给 Pi 等插件,安装时装好 Magpie 并让网关常驻
|
|
21
22
|
plugins/network-log/ 网络记录:默认关闭,按需开启建连等待与定时探测采集;关闭后仍可查看历史
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { admissionFeatures } from '../domain/resource-admission.mjs';
|
|
2
|
+
|
|
3
|
+
// The module's local ledger API, exported unchanged to plugin-check.
|
|
4
|
+
export function admissionAPI(call) {
|
|
5
|
+
return {
|
|
6
|
+
features: admissionFeatures,
|
|
7
|
+
acquire: request => call('acquire', [request]),
|
|
8
|
+
release: lease => call('release', [lease]),
|
|
9
|
+
list: () => call('list', []),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// The plugin host's local API. Controllers consume accepted objects serially per ID; they choose their own actions.
|
|
2
|
-
export function providerAPI({ call, watch, report = console.error }) {
|
|
2
|
+
export function providerAPI({ call, watch, connection, report = console.error }) {
|
|
3
3
|
const observe = (kind, fn, scope = 'available') => watch(`provider:${kind}`, fn, { scope });
|
|
4
4
|
return {
|
|
5
|
+
async resolve(ref, service) {
|
|
6
|
+
const { resource, path } = await call('resolve', [ref, service]);
|
|
7
|
+
const api = connection();
|
|
8
|
+
return { resource, url: `${api.url}${path}`, headers: { authorization: `Bearer ${api.token}` } };
|
|
9
|
+
},
|
|
5
10
|
define: definition => call('define', [definition]),
|
|
6
11
|
put: object => call('put', [object]),
|
|
7
12
|
update: (kind, id, spec, revision) => call('update', [kind, id, spec, revision]),
|
package/check/coda/contract.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "76b1759d9058652bc11eb1f2b62e574fc5c61f21",
|
|
3
3
|
"packages": {
|
|
4
4
|
"@0dep/piso": "5.2.0",
|
|
5
5
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"files": {
|
|
11
11
|
"check/coda/components/protocols/provider-definition.mjs": "98327f1900f84109fd5493d2de8f683eb020754245f3049869ca3b30468821f9",
|
|
12
12
|
"check/coda/components/protocols/types.mjs": "c214787505f3b493eae8c89da79a3e7ea89e54945424ce227bea1fbcf35e826e",
|
|
13
|
-
"check/coda/adapters/provider-api.mjs": "
|
|
13
|
+
"check/coda/adapters/provider-api.mjs": "33f69042b3437b436fc5c1ceddacf99fff2fa849834bcb065e5d9ae35a2fa7ec",
|
|
14
|
+
"check/coda/adapters/admission-api.mjs": "47524434710b250e5aa4c5b41fefe40684186a88f33ccf5a4fa44f8b0dd3a45a",
|
|
14
15
|
"check/coda/components/plugins/agent-plugins.mjs": "d117702f83c988aa89c2e5ae26aafd6ae3e8ba0829adaeedf9e8640f5f8282be",
|
|
15
16
|
"check/coda/components/plugins/plugin-extensions.mjs": "4d7963185195ba6d21a4e49a66987613d5892210b1eb1dc02cffb7b816407776",
|
|
16
17
|
"check/coda/components/plugins/plugin-rules.mjs": "bf2eecafaf3a3c3a8b4719c3252db30a582fce5f11946926cd6a2bc03920c702",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"check/coda/domain/agent-protocol.mjs": "769cc10dc21b3cef7718f94272aaef2d17d4882d42617b408cb47357abfc3bcb",
|
|
23
24
|
"check/coda/domain/duration.mjs": "15dd64ef9b02342ad521c66e5968a569432a89dc7568d11afd3e6f3fe37e104b",
|
|
24
25
|
"check/coda/domain/errors.mjs": "ddc00aef9bb6f9a56845a9926c82200628a906230d31212d88fcde48e36dfd36",
|
|
26
|
+
"check/coda/domain/resource-admission.mjs": "775b1d7067f9d8487a3504d737f3f4bea31adf77af3357ed42e313805e5188e7",
|
|
25
27
|
"check/coda/domain/plugin-services.mjs": "940a72a14da980188a32c790c7f341d3ec0062a6e87ef1ebc9ef051798ea0a75",
|
|
26
28
|
"check/coda/domain/values.mjs": "01cc72b8d9c09e3fe16c93ec332ca01148bba859b1c672586d9d07444d7816c4",
|
|
27
29
|
"check/coda/kernel/agent-failures.mjs": "cbc215e2403d86f0acc765c2077197e0b529fc01e213db465c388361238ea8ce",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { requireCondition as check } from './errors.mjs';
|
|
2
|
+
|
|
3
|
+
export const admissionFeatures = Object.freeze({ multiResource: false, multiUnit: false, exclusive: true });
|
|
4
|
+
|
|
5
|
+
export function admissionRequest(request) {
|
|
6
|
+
check(request && typeof request === 'object' && !Array.isArray(request) &&
|
|
7
|
+
Object.keys(request).every(key => ['requestId', 'group', 'resources', 'exclusive'].includes(key)), 'invalid_input', '无效的资源申请');
|
|
8
|
+
const { requestId, group, resources, exclusive = false } = request;
|
|
9
|
+
check(typeof requestId === 'string' && requestId.length > 0 && requestId.length <= 500, 'invalid_input', 'requestId 须为 1–500 字的稳定申请标识');
|
|
10
|
+
check(typeof group === 'string' && group.length > 0 && group.length <= 100, 'invalid_input', 'group 须为本机组名');
|
|
11
|
+
check(resources && Object.keys(resources).length === 1 && resources.slots === 1 && !Array.isArray(resources),
|
|
12
|
+
'invalid_input', '只支持 resources: { slots: 1 },不支持多资源或多单位');
|
|
13
|
+
check(typeof exclusive === 'boolean', 'invalid_input', 'exclusive 须为 boolean');
|
|
14
|
+
return { requestId, group, exclusive };
|
|
15
|
+
}
|