Skip to content

Commit 85668b7

Browse files
committed
fix: consume safe provider model mappings
1 parent c7f2df4 commit 85668b7

7 files changed

Lines changed: 22 additions & 21 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ filesystem path, raw transport, or Fleet handle.
1818

1919
The candidate pins Protocol `f9b57a6dc665ff471c9bda06d4923be6e2e03b6a`.
2020
It remains private and unmerged until the matching Host service loader and
21-
broker authority are formally merged. One contract gap is still open: the v1
22-
factory projection omits the safe per-provider model mapping stored in the
23-
CLIProxy runtime configuration. The migration must resolve that public
24-
projection before claiming feature parity or deleting the Host-built consumer.
21+
broker authority are formally merged. The branch consumes the formal Protocol v2 safe factory projection so each
22+
Host-validated provider model mapping reaches the plugin without exposing raw
23+
service configuration. Protocol v2 is pinned at `cbfd15ef4d2f51bcffa659f393cd65730bbe5f0d`; the matching Host v2 implementation must still be formalized before this plugin can merge.
2524

2625
## Development
2726

‎README.zh-Hans.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ Host 继续负责 endpoint 与凭据解析、进程启动、不透明 workspace
1414

1515
候选精确固定 Protocol `f9b57a6dc665ff471c9bda06d4923be6e2e03b6a`。
1616
在匹配的 Host 服务装载器和 broker authority 正式合入前,包保持 private 且 PR 不合入。
17-
目前还存在一个公开合同缺口:v1 factory projection 没有携带 CLIProxy runtime 配置中的安全模型映射。
18-
在宣称功能等价或删除 Host 内置消费者前,必须先解决这个投影缺口。
17+
当前分支消费正式的 Protocol v2 安全 factory projection,让 Host 校验后的模型映射进入插件,同时不暴露原始服务配置。Protocol v2 已精确固定为 `cbfd15ef4d2f51bcffa659f393cd65730bbe5f0d`;匹配的 Host v2 实现正式合入后,本插件才可合入。
1918

2019
## 开发
2120

‎package-lock.json‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
"lint": "eslint .",
3434
"stylelint": "stylelint \"src/**/*.css\" --allow-empty-input",
3535
"test": "node --test test/*.mjs",
36-
"typecheck": "tsc -p tsconfig.json --noEmit"
36+
"typecheck": "tsc -p tsconfig.json --noEmit",
37+
"prepare": "npm run build"
3738
},
3839
"devDependencies": {
3940
"@cordisx/eslint-config": "github:cordisx/cordisxmono#c63c2e8c2ba7e11502934a52ad2ce3734e804cdc",
40-
"@cordisx/protocol": "github:cordisx/cordisx-protocol#f9b57a6dc665ff471c9bda06d4923be6e2e03b6a",
41+
"@cordisx/protocol": "github:cordisx/cordisx-protocol#cbfd15ef4d2f51bcffa659f393cd65730bbe5f0d",
4142
"@deepseek-ai/cordis": "4.0.1",
4243
"@deepseek-ai/schemastery": "3.18.1",
4344
"@projectwallace/stylelint-plugin": "0.7.0",

‎src/service/adapter.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type {
22
PlatformProviderAdapterV1,
3-
PlatformProviderFactoryConfigurationV1,
3+
PlatformProviderFactoryConfigurationV2,
44
PlatformProviderModelRefV1,
55
PlatformProviderResultV1,
66
PlatformProviderSessionRefV1,
77
PlatformProviderSessionV1,
8-
} from '@cordisx/protocol/platform-provider/v1'
8+
} from '@cordisx/protocol/platform-provider/v2'
99
import { BrokerClient } from './broker-client.js'
1010
import { LifecycleProjection } from './lifecycle.js'
1111
import { model, object, session, sessionDetail, text } from './values.js'
@@ -30,7 +30,7 @@ export class CliProxyPlatformProviderAdapter implements PlatformProviderAdapterV
3030
constructor(
3131
readonly providerId: string,
3232
readonly providerGeneration: string,
33-
readonly configuration: PlatformProviderFactoryConfigurationV1,
33+
readonly configuration: PlatformProviderFactoryConfigurationV2,
3434
broker: ConstructorParameters<typeof BrokerClient>[0],
3535
private readonly signal: AbortSignal,
3636
) {

‎src/service/index.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type {
2-
PlatformProviderDefinitionV1,
3-
PlatformProviderServiceApplyV1,
4-
} from '@cordisx/protocol/platform-provider/v1'
2+
PlatformProviderDefinitionV2,
3+
PlatformProviderServiceApplyV2,
4+
} from '@cordisx/protocol/platform-provider/v2'
55
import { CliProxyPlatformProviderAdapter } from './adapter.js'
66
import { BROKER_BINDINGS } from './bindings.js'
77

@@ -17,10 +17,10 @@ const OPERATIONS = [
1717
'approvals.decide',
1818
] as const
1919

20-
export const apply: PlatformProviderServiceApplyV1 = async (ctx, input) => {
20+
export const apply: PlatformProviderServiceApplyV2 = async (ctx, input) => {
2121
for (const configuration of input.configurations) {
2222
if (!configuration.enabled) continue
23-
const definition: PlatformProviderDefinitionV1 = {
23+
const definition: PlatformProviderDefinitionV2 = {
2424
descriptor: {
2525
$schema:
2626
'https://raw.githubusercontent.com/cordisx/cordisx-protocol/main/schemas/platform-provider-descriptor.v1.schema.json',
@@ -31,9 +31,9 @@ export const apply: PlatformProviderServiceApplyV1 = async (ctx, input) => {
3131
implementationStatus: 'experimental',
3232
operations: OPERATIONS,
3333
},
34-
mapping: { models: [] },
34+
mapping: configuration.mapping,
3535
brokerRequest: {
36-
bindings: BROKER_BINDINGS as PlatformProviderDefinitionV1['brokerRequest']['bindings'],
36+
bindings: BROKER_BINDINGS as PlatformProviderDefinitionV2['brokerRequest']['bindings'],
3737
},
3838
createAdapter: async factory => {
3939
if (factory.owner.ownerHandle !== input.owner.ownerHandle) {

‎test/service.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const configuration = {
2020
displayName: 'Gateway A',
2121
enabled: true,
2222
requestTimeoutMs: 30000,
23+
mapping: { models: [{ sourceModelId: 'source-gpt', modelId: 'gpt-test', enabled: true, isDefault: true }] },
2324
}
2425

2526
function broker() {
@@ -101,6 +102,7 @@ test('registers every enabled provider through the public Host-owned service con
101102
})
102103
assert.equal(definition.descriptor.providerId, 'gateway-a')
103104
assert.equal(definition.brokerRequest.bindings.length, 22)
105+
assert.deepEqual(definition.mapping, configuration.mapping)
104106
assert.deepEqual(definition.descriptor.operations, [
105107
'models.list',
106108
'sessions.list',

0 commit comments

Comments
 (0)