@ai-agent-forge/plugin-sdk 0.88.14 → 0.88.16

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.
@@ -152,6 +152,53 @@ export interface ModelCatalogV1 {
152
152
  hasProvider(providerId: string): boolean;
153
153
  hasConfiguredAuth(providerId: string): boolean;
154
154
  }
155
+ /** One bounded page of an archived session's entries (SessionArchiveHostV1.readEntries). */
156
+ export interface SessionArchiveReadChunkV1 {
157
+ readonly entries: readonly SessionEntryView[];
158
+ /** Present when more entries remain; pass as `offset` for the next page. */
159
+ readonly nextOffset?: number;
160
+ }
161
+ /**
162
+ * Curation outcome for one archived session, as reported by a curator and
163
+ * recorded in the host-owned manifest (SessionArchiveHostV1.reportCuration).
164
+ * `curated` = the batch committed; `skipped` = the curator ran but had nothing
165
+ * to curate (no curation policy installed, or the host exposes no archive
166
+ * face — the latter is answered locally without a manifest fact). When the
167
+ * memory capability is off the curator never registers, so no curation fact
168
+ * is ever written; the archive can then only be physically deleted with an
169
+ * explicit uncurated-purge confirmation.
170
+ */
171
+ export type SessionCurationStatusV1 = "curated" | "skipped";
172
+ /**
173
+ * 会话归档协调面(记忆归档与整理设计 §4/§8,宿主服务契约;memoryStorage /
174
+ * agentTaskResults 同款可选宿主服务成员先例)。宿主拥有归档目录与 manifest
175
+ * (权威状态源),经本面向插件开放两件事:分页读取归档会话条目(curator 的
176
+ * 唯一公共读取路径——SessionAPI.getBranchEntries() 只见当前会话),以及整理
177
+ * 结果回写(archive 与 curation 是两个独立维度,事实都由宿主清单承载,插件
178
+ * 只上报)。缺席 = 宿主不开放归档:curator 不注册,manifest 里不会出现任何
179
+ * curation 事实,此类会话的物理删除需经宿主侧显式确认(未经整理明示)。
180
+ */
181
+ export interface SessionArchiveHostV1 {
182
+ /** 未知 sessionId 或越界 offset 返回空页(fail-closed,不抛错)。 */
183
+ readEntries(sessionId: string, options?: {
184
+ readonly offset?: number;
185
+ readonly limit?: number;
186
+ }): Promise<SessionArchiveReadChunkV1>;
187
+ /** 未知 sessionId 幂等成功;重复上报以最后一次为准(manifest 按维度取末条)。 */
188
+ reportCuration(sessionId: string, status: SessionCurationStatusV1, info?: {
189
+ readonly batchId?: string;
190
+ }): Promise<void>;
191
+ curationStatus(sessionId: string): Promise<SessionCurationStatusV1 | undefined>;
192
+ /**
193
+ * 归档清单投影:每个当前处于归档态(archive 维度末条为 `archived`)的会话
194
+ * 一条,附其 curation 维度末条(未整理为 `undefined`)。清单是权威状态源,
195
+ * 本读面按清单合并归档目录;整理器启动时靠它找未整理会话。
196
+ */
197
+ listArchived(): Promise<{
198
+ readonly sessionId: string;
199
+ readonly curation: SessionCurationStatusV1 | undefined;
200
+ }[]>;
201
+ }
155
202
  export interface HostCapabilities {
156
203
  apiVersion: typeof EXPERIMENTAL_PUBLIC_API_VERSION;
157
204
  mode: HostMode;
@@ -236,6 +283,21 @@ export interface HostCapabilities {
236
283
  readonly store: DurableServiceV1;
237
284
  readonly writerId: string;
238
285
  };
286
+ /**
287
+ * Session archive coordination (记忆归档与整理设计 §4/§7-§8, host service
288
+ * contract). Present on hosts that own the session archive
289
+ * (`<agentDir>/archive/sessions/`, manifest.jsonl). Two jobs: (1) bounded
290
+ * read access to an archived session's entries — the public path for
291
+ * curators, since `SessionAPI.getBranchEntries()` only sees the current
292
+ * session; (2) the write-back face for curation outcomes, so the
293
+ * host-owned manifest stays the single authoritative state source
294
+ * (archive and curation are two independent dimensions; the host owns
295
+ * both facts, the plugin reports them). Absent = the host exposes no
296
+ * archive: the curator does not register and no curation fact is ever
297
+ * written; physically deleting such archives requires an explicit
298
+ * host-side uncurated-purge confirmation.
299
+ */
300
+ sessionArchive?: SessionArchiveHostV1;
239
301
  }
240
302
  export interface DisposableRegistration {
241
303
  id: string;
@@ -708,6 +770,12 @@ export interface ModelFactsViewV1 {
708
770
  contextWindow: number;
709
771
  maxTokens: number;
710
772
  reasoning: boolean;
773
+ /** Declared provider-native web-search capability. Absent or `unknown` means unsupported. */
774
+ webSearch?: {
775
+ native: boolean | "unknown";
776
+ mode?: "openai-responses" | "anthropic-server-tool" | "google-grounding" | "chat-option";
777
+ confidence?: "declared" | "tested";
778
+ };
711
779
  }
712
780
  /** Scoped model entry: model facts plus the pattern's explicit thinking level, if any. */
713
781
  export interface ScopedModelFactsViewV1 {
@@ -855,6 +923,109 @@ export interface CredentialResolution {
855
923
  export interface CredentialAPI {
856
924
  resolve(request: CredentialResolveRequest): Promise<CredentialResolution | undefined>;
857
925
  }
926
+ /** Session-scoped selected target for one capability. */
927
+ export interface CapabilitySelectionSnapshotV1 {
928
+ readonly version: 1;
929
+ readonly capability: string;
930
+ readonly reference: string;
931
+ readonly provider: string;
932
+ readonly id: string;
933
+ readonly adapter?: string;
934
+ readonly options?: Readonly<Record<string, unknown>>;
935
+ readonly selectedAt: string;
936
+ }
937
+ /** Read-only view of one selected target against the current catalog. */
938
+ export interface CapabilitySelectionViewV1 {
939
+ readonly capability: string;
940
+ readonly reference: string;
941
+ readonly provider: string;
942
+ readonly id: string;
943
+ readonly adapter?: string;
944
+ readonly options?: Readonly<Record<string, unknown>>;
945
+ readonly revision: number;
946
+ readonly available: boolean;
947
+ readonly error?: string;
948
+ readonly configChanged: boolean;
949
+ /** Capability-level `baseUrl` override from `capabilityConfig`, if set. */
950
+ readonly baseUrl?: string;
951
+ /** Effective provider/model base URL from the current catalog. */
952
+ readonly modelBaseUrl?: string;
953
+ }
954
+ export interface CapabilityCandidateViewV1 {
955
+ readonly capability: string;
956
+ readonly reference: string;
957
+ readonly provider: string;
958
+ readonly id: string;
959
+ readonly name?: string;
960
+ readonly adapter?: string;
961
+ readonly available: boolean;
962
+ readonly error?: string;
963
+ }
964
+ /**
965
+ * Host service: current session's selected target for a capability. Present
966
+ * only when the host supports capability selection. Plugins must not infer a
967
+ * target from the main model, provider ordering, or their own config.
968
+ */
969
+ export interface CapabilitySelectionAPI {
970
+ get(capability: string): CapabilitySelectionViewV1 | undefined;
971
+ }
972
+ export interface ModelImageInputV1 {
973
+ readonly type: "image";
974
+ readonly data: string;
975
+ readonly mimeType: string;
976
+ }
977
+ export interface ModelInvocationTargetV1 {
978
+ readonly provider: string;
979
+ readonly id: string;
980
+ }
981
+ /** One isolated completion through the host's model runtime. No tools/session state. */
982
+ export interface ModelInvocationRequestV1 {
983
+ readonly version: 1;
984
+ readonly target: ModelInvocationTargetV1;
985
+ /** Capability whose current `capabilityConfig` connection overrides
986
+ * (`baseUrl`, `headers`) apply to this call. Omit to use the model entry as is. */
987
+ readonly capability?: string;
988
+ readonly prompt: string;
989
+ readonly systemPrompt?: string;
990
+ readonly images?: readonly ModelImageInputV1[];
991
+ readonly maxTokens?: number;
992
+ /**
993
+ * Provider-native web search for this isolated call. `auto` asks the target's
994
+ * protocol adapter to inject its hosted search tool; the host rejects it when
995
+ * the target does not declare native search. `off`/absent leaves the request
996
+ * unchanged. Used by the search plugin's model mode and to keep URL
997
+ * summarization free of a second search path.
998
+ */
999
+ readonly webSearch?: "off" | "auto";
1000
+ }
1001
+ export type ModelInvocationResultV1 = {
1002
+ readonly version: 1;
1003
+ readonly status: "completed";
1004
+ readonly text: string;
1005
+ readonly model: ModelInvocationTargetV1;
1006
+ readonly usage?: unknown;
1007
+ } | {
1008
+ readonly version: 1;
1009
+ readonly status: "cancelled";
1010
+ } | {
1011
+ readonly version: 1;
1012
+ readonly status: "failed";
1013
+ readonly error: {
1014
+ readonly code: string;
1015
+ readonly message: string;
1016
+ };
1017
+ };
1018
+ /**
1019
+ * Host service for an isolated model call against a registered target. The
1020
+ * host resolves auth, model headers and transport; the plugin never sees
1021
+ * credentials or provider SDK internals. Present only when the host declares
1022
+ * `model-invocation-v1`.
1023
+ */
1024
+ export interface ModelInvocationAPI {
1025
+ complete(request: ModelInvocationRequestV1, options?: {
1026
+ readonly signal?: AbortSignal;
1027
+ }): Promise<ModelInvocationResultV1>;
1028
+ }
858
1029
  /**
859
1030
  * Structural skill shape accepted by {@link BuildSystemPromptOptions.skills}
860
1031
  * (D-075 S2). The host's full `Skill` type carries host-owned source facts;
@@ -946,6 +1117,14 @@ export type SessionMessageContent = string | ({
946
1117
  data: string;
947
1118
  mimeType: string;
948
1119
  })[];
1120
+ /**
1121
+ * How the TUI surfaces a message sent via {@link SessionAPI.sendMessage}.
1122
+ * Absent means "transcript" (rendered as a transcript line); "notification"
1123
+ * routes it to the host notice list instead and keeps it out of the
1124
+ * transcript. Registered inline so this contract does not depend on host
1125
+ * packages, same as {@link SessionMessageContent}.
1126
+ */
1127
+ export type SessionMessagePresentation = "transcript" | "notification";
949
1128
  export interface SessionAPI {
950
1129
  getSessionId(): string;
951
1130
  /**
@@ -990,6 +1169,12 @@ export interface SessionAPI {
990
1169
  getScopedModels?(): readonly ScopedModelFactsViewV1[];
991
1170
  /** Experimental (R3 model-domain slice): current thinking level. */
992
1171
  getThinkingLevel?(): ThinkingLevel;
1172
+ /**
1173
+ * Experimental (native web-search slice): effective provider-native search mode for
1174
+ * this session. Returns `auto` only when the child profile requested it and the
1175
+ * current model declares native support; otherwise `off`.
1176
+ */
1177
+ getWebSearch?(): "off" | "auto";
993
1178
  /** Experimental (R3 model-domain slice): set the thinking level. */
994
1179
  setThinkingLevel?(level: ThinkingLevel): void;
995
1180
  /** Experimental (R3 model-domain slice): set the session model by id (resolved against the scoped models). Resolves to false when the id is unknown or auth is not configured. */
@@ -1009,6 +1194,7 @@ export interface SessionAPI {
1009
1194
  customType: string;
1010
1195
  content: SessionMessageContent;
1011
1196
  display: boolean;
1197
+ presentation?: SessionMessagePresentation;
1012
1198
  }, options?: {
1013
1199
  triggerTurn?: boolean;
1014
1200
  }): Promise<void>;
@@ -1268,8 +1454,18 @@ export interface AgentTaskChildProfileV1 {
1268
1454
  readonly thinkingLevel?: string;
1269
1455
  /** 工具面白名单:与宿主继承面求交;空数组表示"一个工具都不给"。 */
1270
1456
  readonly tools?: readonly string[];
1457
+ /**
1458
+ * 相对会话 cwd 的写入路径 glob(`/` 分隔;`**` 跨目录,`*` 不跨目录)。
1459
+ * 缺席 = 不限制;空数组 = 不允许任何写入。只约束 `edit`/`write`,不约束 `bash`。
1460
+ */
1461
+ readonly writeScope?: readonly string[];
1271
1462
  /** 会话模式:`readonly` 只收窄不放宽(父会话已是 readonly 时保持 readonly)。 */
1272
1463
  readonly mode?: "readonly" | "full-control";
1464
+ /**
1465
+ * 本轮是否启用供应商原生(hosted)联网搜索。缺省 off;只有检索编排的原生轮次显式设
1466
+ * auto,且目标模型必须声明 `webSearch.native === true`,否则宿主核验失败。
1467
+ */
1468
+ readonly webSearch?: "off" | "auto";
1273
1469
  /** 追加到子会话 system prompt 末尾的文本(不替换继承来的系统提示词)。 */
1274
1470
  readonly systemPromptAppend?: string;
1275
1471
  /**
@@ -1975,6 +2171,8 @@ export interface CapabilityAPI {
1975
2171
  /** Available when the host declares the `output-artifacts` feature. */
1976
2172
  readonly output?: OutputArtifactAPI;
1977
2173
  readonly credentials?: CredentialAPI;
2174
+ readonly selection?: CapabilitySelectionAPI;
2175
+ readonly modelInvocation?: ModelInvocationAPI;
1978
2176
  readonly agents?: AgentTaskAPI;
1979
2177
  /**
1980
2178
  * 宿主会话取消栅栏(D-044 §4.2):getter 形态,按调用时刻返回当前 epoch 的