@coralai/sps-plugin-api 0.13.0 → 0.14.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/dist/index.d.ts CHANGED
@@ -418,6 +418,27 @@ export interface SpsNotifier {
418
418
  send(message: string, level?: 'info' | 'success' | 'warning' | 'error'): Promise<void>;
419
419
  };
420
420
  }
421
+ export interface SpsStorageObject {
422
+ key: string;
423
+ /** **内容判据**(单段上传时等于 md5)。不看时间。 */
424
+ etag: string;
425
+ size: number;
426
+ }
427
+ /**
428
+ * 对象存储(读 / 列 / 写)。**由插件提供** —— 没装桶插件时这个服务不存在,
429
+ * inject 它的插件会 PENDING。
430
+ *
431
+ * ⚠️ 桶没配时三个方法都抛 ⇒ **先用 `configured()` 问一句**,别拿异常当分支。
432
+ * 🔴 读不了的前缀会**抛**,不会回空 —— "库是空的"和"我没权限"混成一个,
433
+ * 人会去补素材而不是去补策略。
434
+ */
435
+ export interface SpsStorage {
436
+ configured(): boolean;
437
+ /** 不存在 ⇒ `null`;连不上/没权限 ⇒ **抛**。 */
438
+ get(key: string): Promise<Buffer | null>;
439
+ list(prefix: string): Promise<SpsStorageObject[]>;
440
+ put(key: string, bytes: Buffer, contentType?: string): Promise<void>;
441
+ }
421
442
  /** 与 `SpsAsyncPoll` 同形 —— async 能力的 `poll` 可以**直接透传**。 */
422
443
  export type SpsJobStatus = SpsAsyncPoll;
423
444
  /**
@@ -632,6 +653,16 @@ export interface SpsAttachments {
632
653
  }>;
633
654
  }
634
655
  /** 插件 `inject` 里写的名字。 */
656
+ /**
657
+ * **由插件提供**的服务 —— 宿主装配后它们**不一定在**。
658
+ *
659
+ * 🔴 inject 它们的插件要接受"没装那个插件就 PENDING"这件事。
660
+ * ⚠️ 这张表是给门禁用的单一真源:宿主的 conformance 判据据此
661
+ * 豁免这些名字("契约里列的服务装配后都在"对它们不成立)。
662
+ * 2026-08-28 加,起因是把 `sps.storage` 从宿主挪进插件后,
663
+ * 那条判据把"实现搬家了"报成了"契约说谎"。
664
+ */
665
+ export declare const PLUGIN_PROVIDED_SERVICES: readonly ["sps.storage", "sps.memory"];
635
666
  export declare const SPS_SERVICES: {
636
667
  readonly tools: "sps.tools";
637
668
  readonly credentials: "sps.credentials";
@@ -651,6 +682,7 @@ export declare const SPS_SERVICES: {
651
682
  readonly agents: "sps.agents";
652
683
  readonly repo: "sps.repo";
653
684
  readonly memory: "sps.memory";
685
+ readonly storage: "sps.storage";
654
686
  readonly workspace: "sps.workspace";
655
687
  readonly notifier: "sps.notifier";
656
688
  };
@@ -672,6 +704,7 @@ export interface SpsPluginContext {
672
704
  'sps.agents': SpsRegistryByFactory;
673
705
  'sps.repo': SpsRegistryByFactory;
674
706
  'sps.memory': SpsMemory;
707
+ 'sps.storage': SpsStorage;
675
708
  'sps.workspace': SpsWorkspace;
676
709
  'sps.notifier': SpsNotifier;
677
710
  'sps.subprocess': SpsSubprocess;
package/dist/index.js CHANGED
@@ -117,6 +117,16 @@ export function buildMemoryDigest(entries, opts = {}) {
117
117
  }
118
118
  // ── 服务名 ───────────────────────────────────────────────────────────────
119
119
  /** 插件 `inject` 里写的名字。 */
120
+ /**
121
+ * **由插件提供**的服务 —— 宿主装配后它们**不一定在**。
122
+ *
123
+ * 🔴 inject 它们的插件要接受"没装那个插件就 PENDING"这件事。
124
+ * ⚠️ 这张表是给门禁用的单一真源:宿主的 conformance 判据据此
125
+ * 豁免这些名字("契约里列的服务装配后都在"对它们不成立)。
126
+ * 2026-08-28 加,起因是把 `sps.storage` 从宿主挪进插件后,
127
+ * 那条判据把"实现搬家了"报成了"契约说谎"。
128
+ */
129
+ export const PLUGIN_PROVIDED_SERVICES = ['sps.storage', 'sps.memory'];
120
130
  export const SPS_SERVICES = {
121
131
  tools: 'sps.tools',
122
132
  credentials: 'sps.credentials',
@@ -136,6 +146,7 @@ export const SPS_SERVICES = {
136
146
  agents: 'sps.agents',
137
147
  repo: 'sps.repo',
138
148
  memory: 'sps.memory',
149
+ storage: 'sps.storage',
139
150
  workspace: 'sps.workspace',
140
151
  notifier: 'sps.notifier',
141
152
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralai/sps-plugin-api",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "sps 宿主半区的插件契约:ctx 上那些服务的方法签名。插件装它拿类型。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",