@aicloud360/dsh-cloud-disk-api-provider 0.1.1-rc.2 → 0.1.1-rc.2.cloud.1

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
@@ -11,7 +11,7 @@ Host-side direct 360 CloudDisk OpenAPI provider. It exchanges a Host-held user c
11
11
  | Field | Meaning |
12
12
  |---|---|
13
13
  | `credentialRef` | User API-key reference. |
14
- | `signingSecretRef` | Application signing-secret reference. |
14
+ | `signingSecret` | Required application signing material from Host configuration. |
15
15
  | `endpoint` | Audited OpenAPI endpoint. |
16
16
  | `clientEnv`, `clientSource`, `subChannel` | Deployment identity sent during authentication. |
17
17
  | `credentials`, `http` | Host credential and HTTP providers. |
@@ -23,14 +23,14 @@ The user key, access token, qid, signing secret, request headers, and raw API re
23
23
 
24
24
  `getUser()` exchanges the user credential and reads the current user. `list()` maps `File.getList` pages; listed directory ids are resolved to their path only within the current credential generation. `search()` maps form-encoded `File.searchList` pages. Both cursors are opaque source-page numbers.
25
25
 
26
- The provider rejects a missing user credential or signing secret before a signed request. A credential change clears the in-memory directory-path map. Caller cancellation is not retried; retryable transport failures and retryable HTTP statuses are bounded by `maxRetries`.
26
+ The provider rejects a missing user credential before a request. A missing signing secret rejects Bundle configuration at load. A credential change clears the in-memory directory-path map. Caller cancellation is not retried; retryable transport failures and retryable HTTP statuses are bounded by `maxRetries`.
27
27
 
28
28
  ## Deployment prerequisite
29
29
 
30
- The signing secret needs an approved, rotatable Host-only source. Do not copy signing material from an MCP reference project or commit it to source, fixtures, Bundle YAML, or client configuration. The package includes a production fetch transport, but remains a tested Provider implementation until that secret source and Provider registration are composed into the Bundle.
30
+ The signing secret is a literal Host configuration value. The CloudDisk Bundle intentionally places a replacement marker in its tracked patch file, so replacing it with a real value exposes that value to every reader of the Bundle. The package includes a production fetch transport and the Bundle composes its Provider registration.
31
31
 
32
32
  ## Known Limitations and Deferred Work
33
33
 
34
34
  - The Provider implements only user lookup, directory listing, and search. It has no upload, download, mutation, sharing, or transfer API.
35
35
  - One configured Provider serves one Host process. Multi-account switching and remote change observation are not implemented.
36
- - Signing material remains a user-managed Host credential in this release; a managed distribution or rotation service is not part of this package.
36
+ - Signing material has no managed distribution or rotation service in this package.
package/README.zh.md CHANGED
@@ -11,7 +11,7 @@ Host 侧直连 360 云盘 OpenAPI Provider。它用 Host 保存的用户凭据
11
11
  | 字段 | 含义 |
12
12
  |---|---|
13
13
  | `credentialRef` | 用户 API key 引用。 |
14
- | `signingSecretRef` | 应用签名密钥引用。 |
14
+ | `signingSecret` | 来自 Host 配置的必填应用签名材料。 |
15
15
  | `endpoint` | 已审计的 OpenAPI endpoint。 |
16
16
  | `clientEnv`、`clientSource`、`subChannel` | 鉴权时发送的部署身份。 |
17
17
  | `credentials`、`http` | Host 凭据和 HTTP Provider。 |
@@ -23,14 +23,14 @@ Host 侧直连 360 云盘 OpenAPI Provider。它用 Host 保存的用户凭据
23
23
 
24
24
  `getUser()` 交换用户凭据并读取当前用户。`list()` 映射 `File.getList` 分页;已列出的目录 id 仅在当前凭据代次内解析为路径。`search()` 映射表单编码的 `File.searchList` 分页。两种 cursor 都是不透明的源页码。
25
25
 
26
- 缺少用户凭据或签名密钥时,Provider 会在发出签名请求前拒绝。凭据变化会清除内存目录路径映射。调用方取消不会重试;可重试的传输失败和 HTTP 状态由 `maxRetries` 限制。
26
+ 缺少用户凭据时,Provider 会在发出请求前拒绝。缺少签名密钥会在 Bundle 加载时拒绝配置。凭据变化会清除内存目录路径映射。调用方取消不会重试;可重试的传输失败和 HTTP 状态由 `maxRetries` 限制。
27
27
 
28
28
  ## 部署前提
29
29
 
30
- 签名密钥需要经过批准、可轮换的 Host-only 来源。不得从 MCP 参考项目复制签名材料,也不得将其提交到源码、fixture、Bundle YAML 或客户端配置。本包已包含生产 fetch transport;但在该来源与 Provider 注册被组合到 Bundle 前,它只是经过测试的 Provider 实现,不是已部署集成。
30
+ 签名密钥是 Host 配置中的字面量。CloudDisk Bundle 有意在受版本控制的 patch 文件中放置替换标记,因此替换为真实值后,任何可以读取 Bundle 的人都能读取该值。本包包含生产 fetch transport,Bundle 也会组合其 Provider 注册。
31
31
 
32
32
  ## 已知限制与暂缓事项
33
33
 
34
34
  - Provider 只实现用户查询、目录列表和搜索;不提供上传、下载、变更、分享或传输 API。
35
35
  - 一个已配置的 Provider 服务于一个 Host 进程,尚未实现多账户切换和远端变更观察。
36
- - 本发布中的签名材料仍是用户自管的 Host 凭据;本包不提供托管分发或轮换服务。
36
+ - 本包不提供签名材料的托管分发或轮换服务。
package/lib/index.js CHANGED
@@ -6,8 +6,6 @@ import CloudDiskRuntime, { CloudDiskError } from "@aicloud360/dsh-cloud-disk";
6
6
  /** Private Connection RPC for the CloudDisk browser workspace. */
7
7
  const CHANNEL = "/cloud-disk";
8
8
  const API_KEY_REF = credentialRef("CLOUD_DISK_API_KEY");
9
- const SIGNING_SECRET_REF = credentialRef("CLOUD_DISK_SIGNING_SECRET");
10
- const credentialKindSchema = z.union([z.const("apiKey"), z.const("signingSecret")]);
11
9
  const listSchema = z.object({
12
10
  parentId: z.string(),
13
11
  cursor: z.string(),
@@ -18,26 +16,19 @@ const searchSchema = z.object({
18
16
  cursor: z.string(),
19
17
  limit: z.number().step(1).min(1)
20
18
  });
21
- const credentialSetSchema = z.object({
22
- kind: credentialKindSchema.required(),
23
- value: z.string().min(1).required()
24
- });
25
- const credentialUnsetSchema = z.object({ kind: credentialKindSchema.required() });
19
+ const credentialSetSchema = z.object({ value: z.string().min(1).required() });
20
+ const credentialUnsetSchema = z.object({});
26
21
  const CLOUD_DISK_FAILURE_CODES = new Set([
27
22
  "CLOUD_DISK_PROVIDER_CONFIGURED_MISSING",
28
23
  "CLOUD_DISK_PROVIDER_CONFIGURED_UNAVAILABLE",
29
24
  "CLOUD_DISK_PROVIDER_UNAVAILABLE",
30
25
  "CLOUD_DISK_PROVIDER_AMBIGUOUS",
31
26
  "CLOUD_DISK_CREDENTIAL_MISSING",
32
- "CLOUD_DISK_SIGNING_SECRET_MISSING",
33
27
  "CLOUD_DISK_AUTHENTICATION_FAILED",
34
28
  "CLOUD_DISK_NETWORK_FAILED",
35
29
  "CLOUD_DISK_INVALID_REQUEST",
36
30
  "CLOUD_DISK_PROVIDER_FAILED"
37
31
  ]);
38
- function credentialFor(kind) {
39
- return kind === "apiKey" ? API_KEY_REF : SIGNING_SECRET_REF;
40
- }
41
32
  function parse(schema, payload) {
42
33
  try {
43
34
  return schema(payload);
@@ -94,7 +85,7 @@ function pageView(page) {
94
85
  }
95
86
  /**
96
87
  * Register the CloudDisk browser RPC channel. Credential endpoints only address
97
- * the two CloudDisk references, so this plugin cannot become a general
88
+ * the CloudDisk API-key reference, so this plugin cannot become a general
98
89
  * credential-inspection surface.
99
90
  * @param ctx - Host context with the selected CloudDisk provider and credentials.
100
91
  */
@@ -122,22 +113,17 @@ function installCloudDiskRpc(ctx) {
122
113
  }
123
114
  };
124
115
  }
125
- case "credentials/describe": {
116
+ case "credentials/describe":
126
117
  if (parse(z.object({}), payload) === void 0) return badRequest("invalid cloud disk credential request");
127
- const [apiKey, signingSecret] = await Promise.all([ctx.credentials.describe(API_KEY_REF), ctx.credentials.describe(SIGNING_SECRET_REF)]);
128
118
  return {
129
119
  ok: true,
130
- value: {
131
- apiKey,
132
- signingSecret
133
- }
120
+ value: { apiKey: await ctx.credentials.describe(API_KEY_REF) }
134
121
  };
135
- }
136
122
  case "credentials/set": {
137
123
  const parsed = parse(credentialSetSchema, payload);
138
124
  if (parsed === void 0) return badRequest("invalid cloud disk credential request");
139
125
  try {
140
- await ctx.credentials.set(credentialFor(parsed.kind), parsed.value);
126
+ await ctx.credentials.set(API_KEY_REF, parsed.value);
141
127
  return {
142
128
  ok: true,
143
129
  value: {}
@@ -146,11 +132,10 @@ function installCloudDiskRpc(ctx) {
146
132
  return internalFailure("cloud disk credential could not be saved");
147
133
  }
148
134
  }
149
- case "credentials/unset": {
150
- const parsed = parse(credentialUnsetSchema, payload);
151
- if (parsed === void 0) return badRequest("invalid cloud disk credential request");
135
+ case "credentials/unset":
136
+ if (parse(credentialUnsetSchema, payload) === void 0) return badRequest("invalid cloud disk credential request");
152
137
  try {
153
- await ctx.credentials.unset(credentialFor(parsed.kind));
138
+ await ctx.credentials.unset(API_KEY_REF);
154
139
  return {
155
140
  ok: true,
156
141
  value: {}
@@ -158,7 +143,6 @@ function installCloudDiskRpc(ctx) {
158
143
  } catch {
159
144
  return internalFailure("cloud disk credential could not be removed");
160
145
  }
161
- }
162
146
  case "browse/list": {
163
147
  const parsed = parse(listSchema, payload);
164
148
  if (parsed === void 0) return badRequest("invalid cloud disk list request");
@@ -214,7 +198,7 @@ const inject = [
214
198
  const Config = z.object({
215
199
  endpoint: z.string().required(),
216
200
  apiKeyRef: z.string().required(),
217
- signingSecretRef: z.string().required(),
201
+ signingSecret: z.string().min(1).required(),
218
202
  clientEnv: z.string().required(),
219
203
  clientSource: z.string().required(),
220
204
  subChannel: z.string().required(),
@@ -365,14 +349,12 @@ var DirectCloudDiskProvider = class {
365
349
  };
366
350
  return {
367
351
  ...input,
368
- sign: sign(input, secret.value),
352
+ sign: sign(input, secret),
369
353
  sub_channel: this.options.subChannel
370
354
  };
371
355
  }
372
- async signingSecret() {
373
- const secret = await this.options.credentials.resolve(this.options.signingSecretRef);
374
- if (secret === void 0) throw signingSecretMissing();
375
- return secret;
356
+ signingSecret() {
357
+ return this.options.signingSecret;
376
358
  }
377
359
  getInput(params, accessToken) {
378
360
  return {
@@ -454,7 +436,7 @@ function applyDirectCloudDiskProvider(ctx, options) {
454
436
  return ctx.cloudDisk.registerProvider(new DirectCloudDiskProvider(options));
455
437
  }
456
438
  /**
457
- * Register the production fetch Provider from a profile's explicit credential references.
439
+ * Register the production fetch Provider from a profile's API-key reference and signing material.
458
440
  * @param ctx - Host context that owns the CloudDisk and credential services.
459
441
  * @param config - Complete direct-Provider configuration from the profile Bundle.
460
442
  */
@@ -462,7 +444,7 @@ function apply(ctx, config) {
462
444
  applyDirectCloudDiskProvider(ctx, {
463
445
  endpoint: config.endpoint,
464
446
  credentialRef: credentialRef(config.apiKeyRef),
465
- signingSecretRef: credentialRef(config.signingSecretRef),
447
+ signingSecret: config.signingSecret,
466
448
  clientEnv: config.clientEnv,
467
449
  clientSource: config.clientSource,
468
450
  subChannel: config.subChannel,
@@ -479,9 +461,6 @@ function isRecord(value) {
479
461
  function credentialMissing() {
480
462
  return new CloudDiskError("CloudDisk credential is not configured", "CLOUD_DISK_CREDENTIAL_MISSING");
481
463
  }
482
- function signingSecretMissing() {
483
- return new CloudDiskError("CloudDisk signing secret is not configured", "CLOUD_DISK_SIGNING_SECRET_MISSING");
484
- }
485
464
  function authenticationFailed() {
486
465
  return new CloudDiskError("CloudDisk authentication failed", "CLOUD_DISK_AUTHENTICATION_FAILED");
487
466
  }
@@ -2,7 +2,7 @@
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  /**
4
4
  * Register the CloudDisk browser RPC channel. Credential endpoints only address
5
- * the two CloudDisk references, so this plugin cannot become a general
5
+ * the CloudDisk API-key reference, so this plugin cannot become a general
6
6
  * credential-inspection surface.
7
7
  * @param ctx - Host context with the selected CloudDisk provider and credentials.
8
8
  */
@@ -1,7 +1,7 @@
1
1
  /** Direct Host-side adapter for the audited 360 CloudDisk OpenAPI. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import z from '@deepseek-ai/schemastery';
4
- import { type CredentialProvider, type CredentialRef } from '@deepseek-ai/dsh-credentials';
4
+ import { type CredentialProvider } from '@deepseek-ai/dsh-credentials';
5
5
  import CloudDiskRuntime, { type CloudDiskListRequest, type CloudDiskPage, type CloudDiskProvider, type CloudDiskProviderConfig, type CloudDiskSearchRequest, type CloudDiskUser } from '@aicloud360/dsh-cloud-disk';
6
6
  /** Cordis loader name for the direct CloudDisk Provider plugin. */
7
7
  export declare const name = "cloud-disk-api-provider";
@@ -13,8 +13,8 @@ export interface Config {
13
13
  endpoint: string;
14
14
  /** Credential reference containing the user API key. */
15
15
  apiKeyRef: string;
16
- /** Credential reference containing the server-side request-signing secret. */
17
- signingSecretRef: string;
16
+ /** Host-only application secret used to sign directory and search requests. */
17
+ signingSecret: string;
18
18
  /** 360 client environment identifier. */
19
19
  clientEnv: string;
20
20
  /** 360 client source identifier. */
@@ -51,7 +51,7 @@ export interface CloudDiskHttpClient {
51
51
  export declare function createFetchCloudDiskHttpClient(fetchImpl?: typeof fetch): CloudDiskHttpClient;
52
52
  /** Host-only configuration for the audited direct 360 OpenAPI Provider. */
53
53
  export interface DirectCloudDiskProviderOptions extends CloudDiskProviderConfig {
54
- readonly signingSecretRef: CredentialRef;
54
+ readonly signingSecret: string;
55
55
  readonly clientEnv: string;
56
56
  readonly clientSource: string;
57
57
  readonly subChannel: string;
@@ -102,7 +102,7 @@ export declare class DirectCloudDiskProvider implements CloudDiskProvider {
102
102
  */
103
103
  export declare function applyDirectCloudDiskProvider(ctx: Context, options: DirectCloudDiskProviderOptions): () => void;
104
104
  /**
105
- * Register the production fetch Provider from a profile's explicit credential references.
105
+ * Register the production fetch Provider from a profile's API-key reference and signing material.
106
106
  * @param ctx - Host context that owns the CloudDisk and credential services.
107
107
  * @param config - Complete direct-Provider configuration from the profile Bundle.
108
108
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aicloud360/dsh-cloud-disk-api-provider",
3
3
  "description": "Direct Host-side HTTP provider adapter for the native CloudDisk capability seam",
4
- "version": "0.1.1-rc.2",
4
+ "version": "0.1.1-rc.2.cloud.1",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org"
@@ -39,6 +39,6 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "dependencies": {
42
- "@aicloud360/dsh-cloud-disk": "0.1.1-rc.2"
42
+ "@aicloud360/dsh-cloud-disk": "0.1.1-rc.2.cloud.1"
43
43
  }
44
44
  }