@ai-agent-forge/plugin-sdk 0.87.0 → 0.88.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.
@@ -110,6 +110,30 @@ export interface SubagentCommunicationWiringV1 {
110
110
  text: string;
111
111
  }[];
112
112
  }
113
+ /**
114
+ * 模型目录条目的宿主结构视图(D-082 批 3b,契约 B):只暴露 provider-failover
115
+ * 装载预检消费的五个字段(structural、JSON-safe),不透出内核 Model 对象。
116
+ * `compat`/`thinkingLevelMap` 随目录条目可选。
117
+ */
118
+ export interface ModelCatalogModelViewV1 {
119
+ provider: string;
120
+ contextWindow: number;
121
+ maxTokens: number;
122
+ compat?: unknown;
123
+ thinkingLevelMap?: unknown;
124
+ }
125
+ /**
126
+ * 模型目录宿主服务(D-082 批 3b,契约 B;workspaceDirectory 同款可选宿主服务
127
+ * 成员先例):装载预检/目录快照读面(provider-failover 家族),零网络、零
128
+ * OAuth——全部是宿主静态目录与凭据条目的即时读投影。宿主缺模型目录能力时
129
+ * 该成员缺席,插件必须按可选拒绝装配,不得假设其存在。
130
+ */
131
+ export interface ModelCatalogV1 {
132
+ /** 未知 provider/model 对返回 undefined("无候选")。 */
133
+ resolveModel(provider: string, modelId: string): ModelCatalogModelViewV1 | undefined;
134
+ hasProvider(providerId: string): boolean;
135
+ hasConfiguredAuth(providerId: string): boolean;
136
+ }
113
137
  export interface HostCapabilities {
114
138
  apiVersion: typeof EXPERIMENTAL_PUBLIC_API_VERSION;
115
139
  mode: HostMode;
@@ -173,6 +197,12 @@ export interface HostCapabilities {
173
197
  * nothing when no agentDir is declared.
174
198
  */
175
199
  memoryStorage?: MemoryStorageComponentsV1;
200
+ /**
201
+ * 模型目录宿主服务(D-082 批 3b,契约 B):装载预检/目录快照读面
202
+ * (provider-failover 家族),零网络、零 OAuth——只读宿主静态模型目录与
203
+ * 凭据条目投影(`api.host.modelCatalog`)。缺席 = 宿主不提供目录读面。
204
+ */
205
+ modelCatalog?: ModelCatalogV1;
176
206
  }
177
207
  export interface DisposableRegistration {
178
208
  id: string;
@@ -1553,7 +1583,6 @@ export interface PolicyInvocationContextV1 {
1553
1583
  export interface RetryPolicyRequest {
1554
1584
  signal?: AbortSignal;
1555
1585
  retryable: boolean;
1556
- enabled: boolean;
1557
1586
  attempt: number;
1558
1587
  maxAttempts: number;
1559
1588
  baseDelayMs: number;
@@ -1577,7 +1606,6 @@ export interface RetryPolicy {
1577
1606
  }
1578
1607
  export interface CompactionPolicyRequest {
1579
1608
  signal?: AbortSignal;
1580
- enabled: boolean;
1581
1609
  reason: "overflow" | "threshold";
1582
1610
  contextOverflow: boolean;
1583
1611
  recoverableLength: boolean;
@@ -1585,14 +1613,6 @@ export interface CompactionPolicyRequest {
1585
1613
  contextUsage?: CompactionContextUsage;
1586
1614
  recoveryAttempted: boolean;
1587
1615
  canContinue: boolean;
1588
- /**
1589
- * Branch path entry snapshot (threshold requests only). Provided so a
1590
- * policy can plan CHEAP RELIEF (see {@link CompactionPolicyDecision.relief})
1591
- * from real history facts instead of ordering a summarization run.
1592
- */
1593
- branchEntries?: readonly unknown[];
1594
- /** Recent-tail protection budget (settings fact) for relief planning. */
1595
- keepRecentTokens?: number;
1596
1616
  context?: PolicyInvocationContextV1;
1597
1617
  execution?: ExecutionFactsV1;
1598
1618
  }
@@ -1612,18 +1632,6 @@ export interface CompactionPolicyDecision {
1612
1632
  compact: boolean;
1613
1633
  retry?: boolean;
1614
1634
  failureMessage?: string;
1615
- /**
1616
- * Cheap RELIEF plan: the host appends this custom entry (generic
1617
- * `appendCustomEntry`) and reprojects the context instead of running a
1618
- * summarization. The semantics of the entry belong entirely to the policy;
1619
- * the projection that interprets it is registered separately via
1620
- * {@link CapabilityAPI.registerEntryProjection}. When relief is present the
1621
- * host skips compaction, so `compact` must be false.
1622
- */
1623
- relief?: {
1624
- readonly customType: string;
1625
- readonly data?: unknown;
1626
- };
1627
1635
  }
1628
1636
  /** Provider-agnostic facts about the model the host will use for a summary call. */
1629
1637
  export interface SummaryModelFactsV1 {
@@ -1786,13 +1794,15 @@ export type StreamFnNext = (model: unknown, context: unknown, options: unknown)
1786
1794
  /**
1787
1795
  * Experimental request-time stream-function middleware (provider-failover
1788
1796
  * family): observe the provider stream's terminal state, substitute the
1789
- * request model, and replay. Wrappers run in registration order — the first
1790
- * registered wrapper is the outermost, its `next` covering every later
1791
- * wrapper plus the host default. Must return (a promise of) the event stream
1792
- * the caller consumes; failures belong inside the stream protocol, matching
1793
- * the host stream-function contract. A session whose caller supplied an
1794
- * explicit stream function bypasses the host default assembly entirely and
1795
- * never sees these wrappers.
1797
+ * request model, and replay. Wrapper order follows the registration
1798
+ * priority (contract A, D-082 批 3b): lower `priority` wraps outermost;
1799
+ * equal priorities keep registration order (first registered = outermost
1800
+ * within the same priority). The outermost wrapper's `next` covers every
1801
+ * later wrapper plus the host default. Must return (a promise of) the event
1802
+ * stream the caller consumes; failures belong inside the stream protocol,
1803
+ * matching the host stream-function contract. A session whose caller
1804
+ * supplied an explicit stream function bypasses the host default assembly
1805
+ * entirely and never sees these wrappers.
1796
1806
  */
1797
1807
  export type StreamFnWrapper = (model: unknown, context: unknown, options: unknown, next: StreamFnNext, host: StreamFnWrapperHostV1) => unknown;
1798
1808
  /**
@@ -1977,7 +1987,18 @@ export interface CapabilityAPI {
1977
1987
  */
1978
1988
  registerEntryProjection(projection: EntryProjection): DisposableRegistration;
1979
1989
  registerProviderHeaderTransform(name: string, transform: ProviderHeaderTransform): DisposableRegistration;
1980
- registerStreamFnWrapper(name: string, wrapper: StreamFnWrapper): DisposableRegistration;
1990
+ /**
1991
+ * Registers a stream-function wrapper (provider-failover family, contract
1992
+ * A D-082 批 3b). `options.priority` orders the wrapper chain: lower
1993
+ * values wrap outermost (default 0), so a rerouting wrapper can register
1994
+ * with a negative priority and stay outermost regardless of plugin load
1995
+ * order — every inner wrapper then observes the substituted model on each
1996
+ * retry attempt. Equal priorities keep registration order (first
1997
+ * registered = outermost), the pre-priority semantics.
1998
+ */
1999
+ registerStreamFnWrapper(name: string, wrapper: StreamFnWrapper, options?: {
2000
+ priority?: number;
2001
+ }): DisposableRegistration;
1981
2002
  registerSkill(definition: SkillDefinition): DisposableRegistration;
1982
2003
  registerRetryPolicy(name: string, policy: RetryPolicy): DisposableRegistration;
1983
2004
  registerCompactionPolicy(name: string, policy: CompactionPolicy): DisposableRegistration;