@ycodium-ai/plugin-api 0.2.5763 → 0.2.5877

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.
Files changed (50) hide show
  1. package/README.md +9 -1
  2. package/dist/_private/ycodium-composer-tokens/sessionContextSummaryFormat.d.ts +16 -0
  3. package/dist/_private/ycodium-composer-tokens/sessionContextSummaryFormat.js +60 -0
  4. package/dist/_private/ycodium-ui-hooks/hostControls.d.ts +1 -1
  5. package/dist/composer.d.ts +1 -0
  6. package/dist/composer.d.ts.map +1 -1
  7. package/dist/composer.js +1 -0
  8. package/dist/composer.js.map +1 -1
  9. package/dist/conversation.d.ts +6 -9
  10. package/dist/conversation.d.ts.map +1 -1
  11. package/dist/conversation.js +1 -1
  12. package/dist/conversation.js.map +1 -1
  13. package/dist/conversationHostModels.d.ts +21 -0
  14. package/dist/conversationHostModels.d.ts.map +1 -1
  15. package/dist/conversationViewProps.d.ts +2 -0
  16. package/dist/conversationViewProps.d.ts.map +1 -1
  17. package/dist/dataPorts.gen.d.ts +2 -0
  18. package/dist/dataPorts.gen.d.ts.map +1 -1
  19. package/dist/executor.d.ts +1 -1
  20. package/dist/executor.d.ts.map +1 -1
  21. package/dist/executor.js.map +1 -1
  22. package/dist/executorCapabilities.d.ts +7 -0
  23. package/dist/executorCapabilities.d.ts.map +1 -1
  24. package/dist/executorSession.d.ts +1 -1
  25. package/dist/modelChoice.js +1 -1
  26. package/dist/modelChoiceOptions.d.ts.map +1 -1
  27. package/dist/modelChoiceOptions.js +37 -12
  28. package/dist/modelChoiceOptions.js.map +1 -1
  29. package/dist/slots.d.ts +0 -20
  30. package/dist/slots.d.ts.map +1 -1
  31. package/dist/slots.js +0 -27
  32. package/dist/slots.js.map +1 -1
  33. package/dist/source/_private/ycodium-composer-tokens/sessionContextSummaryFormat.ts +116 -0
  34. package/dist/source/_private/ycodium-ui-hooks/hostControls.ts +14 -4
  35. package/dist/source/composer.ts +7 -0
  36. package/dist/source/conversation.ts +5 -7
  37. package/dist/source/conversationHostModels.ts +23 -0
  38. package/dist/source/conversationViewProps.ts +2 -0
  39. package/dist/source/dataPorts.gen.ts +2 -2
  40. package/dist/source/executor.ts +1 -0
  41. package/dist/source/executorCapabilities.ts +8 -0
  42. package/dist/source/executorSession.ts +1 -1
  43. package/dist/source/modelChoice.ts +1 -1
  44. package/dist/source/modelChoiceOptions.ts +41 -9
  45. package/dist/source/slots.ts +0 -37
  46. package/dist/source/version.ts +3 -19
  47. package/dist/version.d.ts +3 -3
  48. package/dist/version.d.ts.map +1 -1
  49. package/dist/version.js +2 -2
  50. package/package.json +7 -7
@@ -420,6 +420,8 @@ export interface ConversationComposerProps {
420
420
  model: string,
421
421
  ) => string | null;
422
422
  onContinueInModel: (instanceId: ConversationProviderInstanceId, model: string) => void;
423
+ /** 无可用 provider 时从输入卡底栏直达 Provider 设置。 */
424
+ onOpenProviderSettings?: (() => void) | undefined;
423
425
  handleRuntimeModeChange: (mode: ConversationRuntimeMode) => void;
424
426
  handleNativeModeChange: (nativeModeId: string) => void;
425
427
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  export type SchemaUtc = { readonly _tag: "Utc"; readonly epochMilliseconds: number };
5
5
  type Objects_ = { };
6
- type Union_ = { readonly "status": "idle", readonly "preparationId"?: string, readonly "updatedAt"?: string } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "running", readonly "stage": "checking" | "waiting-for-lock" | "downloading" | "verifying" | "extracting" | "starting" | "qualifying", readonly "receivedBytes"?: number, readonly "totalBytes"?: number } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "ready", readonly "version": string } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "failed", readonly "stage": "checking" | "waiting-for-lock" | "downloading" | "verifying" | "extracting" | "starting" | "qualifying", readonly "reason": string, readonly "detail": string, readonly "retryable": boolean } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "cancelled" };
6
+ type Union_ = { readonly "status": "idle", readonly "preparationId"?: string, readonly "updatedAt"?: string } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "running", readonly "stage": "checking" | "waiting-for-lock" | "downloading" | "verifying" | "extracting" | "starting" | "qualifying", readonly "receivedBytes"?: number, readonly "totalBytes"?: number } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "ready", readonly "version": string, readonly "sandboxed"?: boolean } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "failed", readonly "stage": "checking" | "waiting-for-lock" | "downloading" | "verifying" | "extracting" | "starting" | "qualifying", readonly "reason": string, readonly "detail": string, readonly "retryable": boolean } | { readonly "preparationId": string, readonly "updatedAt": string, readonly "status": "cancelled" };
7
7
  type Objects_1 = { readonly "profiles": ReadonlyArray<{ readonly "id": string, readonly "name": string, readonly "kind": "persistent" | "incognito" }>, readonly "agentAccess": { readonly [x: string]: boolean }, readonly "defaultProfileId": string };
8
8
  type Objects_2 = { readonly "_tag": "fill" };
9
9
  type Objects_3 = { readonly "_tag": "freeform", readonly "width": number, readonly "height": number };
@@ -710,7 +710,7 @@ export type ProvidersSessionsListOutput = { readonly "sessions": ReadonlyArray<{
710
710
  export type ProvidersSessionsSetResumeCursorInput = { readonly "instanceId": string, readonly "threadId": string, readonly "cursor": unknown };
711
711
  export type ProvidersSessionsSetResumeCursorOutput = { };
712
712
  export type ProvidersExecutorsListInput = { };
713
- export type ProvidersExecutorsListOutput = { readonly "entries": ReadonlyArray<{ readonly "pluginId": string, readonly "entryId": string, readonly "loadedAt": string, readonly "card": { readonly "driverKind": string, readonly "displayName": string, readonly "iconUrl": string, readonly "commandName": string, readonly "launchArgs": string, readonly "homeEnvVar": string, readonly "homeLayout"?: { readonly "accountConfigKey": string, readonly "transcriptSubdir": string, readonly "accountEnvVar"?: string | undefined } | undefined, readonly "accountDirectory"?: { readonly "configKeys": readonly [string, ...Array<string>], readonly "defaultDirectory": string, readonly "brandAliases"?: ReadonlyArray<string>, readonly "holdsThreads"?: boolean } | undefined, readonly "resumeCommand"?: { readonly "cursorKeys": readonly [string, ...Array<string>], readonly "command": string } | undefined, readonly "repositoryInstructionsFile"?: string | undefined, readonly "signInNotNeededWhen"?: { readonly "configKey": string, readonly "equals": string } | undefined, readonly "mcpToolNameStyle"?: "server_tool" | undefined, readonly "environment": ReadonlyArray<{ readonly "name": string, readonly "sensitive": boolean }>, readonly "install": { readonly "kind": "vendorScript", readonly "posixCommand": string, readonly "windowsCommand": string, readonly "installedPathSegment": string } | { readonly "kind": "npm" } | { readonly "kind": "downloadPage", readonly "url": string } | null, readonly "signIn": ReadonlyArray<{ readonly "kind": "device-code" } | { readonly "kind": "command", readonly "command": string } | { readonly "kind": "environment", readonly "variable": string } | { readonly "kind": "api-key", readonly "variable": string }>, readonly "deviceCodeSignInArgs": ReadonlyArray<string>, readonly "npmPackage": string, readonly "homebrewFormula": string, readonly "selfUpdateArgs": ReadonlyArray<string>, readonly "docsUrl": string, readonly "setupNote": string, readonly "defaultModel": string, readonly "customModelIdExample": string, readonly "modelSlugAliases": { readonly [x: string]: string } | null, readonly "modelCatalogAuthoritative"?: boolean | undefined, readonly "mcpToolCallCeilingSeconds"?: number | undefined, readonly "mcpTransports": ReadonlyArray<"stdio" | "http" | "sse"> | null, readonly "pluginManaged": boolean, readonly "verifiedSkills": boolean, readonly "everydayHarness": boolean, readonly "capabilities": { readonly "sessionModelSwitch": "in-session" | "unsupported", readonly "sessionOptionSwitch"?: "in-session" | "unsupported" | undefined, readonly "runtimeModeSwitch": "in-session" | "next-turn", readonly "contextCompaction"?: "native" | "unsupported" | undefined, readonly "nativeModeSwitch"?: boolean | undefined, readonly "turnSteering"?: boolean | undefined, readonly "reportsSpawnedAgents"?: boolean | undefined, readonly "handlesSkillInvocations"?: boolean | undefined, readonly "discoversRepoSkills"?: boolean | undefined, readonly "confirmsToolTermination"?: boolean | undefined, readonly "acceptsAdditionalDirectories"?: boolean | undefined, readonly "blocksHostMcpWritesInAuto"?: boolean | undefined, readonly "recoversMcpByRelaunch"?: boolean | undefined, readonly "inlineImages"?: { readonly "maxBytes": number, readonly "maxEdgePixels"?: number | undefined, readonly "maxTotalBytes"?: number | undefined, readonly "mimeTypes"?: ReadonlyArray<string> | undefined } | undefined }, readonly "credentialSources": ReadonlyArray<{ readonly "kind": "json-file", readonly "pathFromHome": string, readonly "jsonPointer": string } | { readonly "kind": "json-file-os-home", readonly "pathFromOsHome": string, readonly "jsonPointer": string } | { readonly "kind": "macos-keychain", readonly "service": string, readonly "accountFromEnv"?: string | undefined, readonly "defaultHomeOnly": boolean }>, readonly "diagnostics": ReadonlyArray<{ readonly "id": string, readonly "labelKey": string }>, readonly "effectiveCommand"?: string | undefined, readonly "configSchema": { readonly [x: string]: unknown }, readonly "modelConnectivity": { readonly "dialects": ReadonlyArray<"anthropic-messages" | "openai-responses" | "openai-chat-completions" | "google-cloud-code">, readonly "acceptsExternalEndpoints": boolean, readonly "nativePathSuffix"?: "/v1/messages" | "/responses" | "/chat/completions" | undefined, readonly "credentialEnvKey"?: string | undefined, readonly "baseUrlEnvKey"?: string | undefined, readonly "alternateCredentialEnvKeys"?: ReadonlyArray<string> | undefined, readonly "backendSwitchEnvKeys"?: ReadonlyArray<string> | undefined, readonly "extraEnv"?: ReadonlyArray<{ readonly "name": string, readonly "value": string }> | undefined, readonly "extraLaunchArgs"?: ReadonlyArray<{ readonly "key": string, readonly "value": string | boolean }> | undefined, readonly "supportsNativeSubscription"?: boolean | undefined }, readonly "maxConcurrentProcesses"?: number | undefined, readonly "keepsBackgroundServices"?: boolean | undefined }, readonly "origin": "bundled" | "installed" }> };
713
+ export type ProvidersExecutorsListOutput = { readonly "entries": ReadonlyArray<{ readonly "pluginId": string, readonly "entryId": string, readonly "loadedAt": string, readonly "card": { readonly "driverKind": string, readonly "displayName": string, readonly "iconUrl": string, readonly "commandName": string, readonly "launchArgs": string, readonly "homeEnvVar": string, readonly "homeLayout"?: { readonly "accountConfigKey": string, readonly "transcriptSubdir": string, readonly "accountEnvVar"?: string | undefined } | undefined, readonly "accountDirectory"?: { readonly "configKeys": readonly [string, ...Array<string>], readonly "defaultDirectory": string, readonly "brandAliases"?: ReadonlyArray<string>, readonly "holdsThreads"?: boolean } | undefined, readonly "resumeCommand"?: { readonly "cursorKeys": readonly [string, ...Array<string>], readonly "command": string } | undefined, readonly "repositoryInstructionsFile"?: string | undefined, readonly "signInNotNeededWhen"?: { readonly "configKey": string, readonly "equals": string } | undefined, readonly "mcpToolNameStyle"?: "server_tool" | undefined, readonly "environment": ReadonlyArray<{ readonly "name": string, readonly "sensitive": boolean }>, readonly "install": { readonly "kind": "vendorScript", readonly "posixCommand": string, readonly "windowsCommand": string, readonly "installedPathSegment": string } | { readonly "kind": "npm" } | { readonly "kind": "downloadPage", readonly "url": string } | null, readonly "signIn": ReadonlyArray<{ readonly "kind": "device-code" } | { readonly "kind": "command", readonly "command": string } | { readonly "kind": "environment", readonly "variable": string } | { readonly "kind": "api-key", readonly "variable": string }>, readonly "deviceCodeSignInArgs": ReadonlyArray<string>, readonly "npmPackage": string, readonly "homebrewFormula": string, readonly "selfUpdateArgs": ReadonlyArray<string>, readonly "docsUrl": string, readonly "setupNote": string, readonly "defaultModel": string, readonly "customModelIdExample": string, readonly "modelSlugAliases": { readonly [x: string]: string } | null, readonly "modelCatalogAuthoritative"?: boolean | undefined, readonly "mcpToolCallCeilingSeconds"?: number | undefined, readonly "mcpTransports": ReadonlyArray<"stdio" | "http" | "sse"> | null, readonly "pluginManaged": boolean, readonly "verifiedSkills": boolean, readonly "everydayHarness": boolean, readonly "capabilities": { readonly "sessionModelSwitch": "in-session" | "unsupported", readonly "sessionOptionSwitch"?: "in-session" | "unsupported" | undefined, readonly "runtimeModeSwitch": "in-session" | "next-turn", readonly "contextCompaction"?: "native" | "unsupported" | undefined, readonly "nativeModeSwitch"?: boolean | undefined, readonly "turnSteering"?: boolean | undefined, readonly "reportsSpawnedAgents"?: boolean | undefined, readonly "handlesSkillInvocations"?: boolean | undefined, readonly "discoversRepoSkills"?: boolean | undefined, readonly "confirmsToolTermination"?: boolean | undefined, readonly "acceptsAdditionalDirectories"?: boolean | undefined, readonly "blocksHostMcpWritesInAuto"?: boolean | undefined, readonly "recoversMcpByRelaunch"?: boolean | undefined, readonly "hostMcpToolListing"?: "compact" | "full" | undefined, readonly "inlineImages"?: { readonly "maxBytes": number, readonly "maxEdgePixels"?: number | undefined, readonly "maxTotalBytes"?: number | undefined, readonly "mimeTypes"?: ReadonlyArray<string> | undefined } | undefined }, readonly "credentialSources": ReadonlyArray<{ readonly "kind": "json-file", readonly "pathFromHome": string, readonly "jsonPointer": string } | { readonly "kind": "json-file-os-home", readonly "pathFromOsHome": string, readonly "jsonPointer": string } | { readonly "kind": "macos-keychain", readonly "service": string, readonly "accountFromEnv"?: string | undefined, readonly "defaultHomeOnly": boolean }>, readonly "diagnostics": ReadonlyArray<{ readonly "id": string, readonly "labelKey": string }>, readonly "effectiveCommand"?: string | undefined, readonly "configSchema": { readonly [x: string]: unknown }, readonly "modelConnectivity": { readonly "dialects": ReadonlyArray<"anthropic-messages" | "openai-responses" | "openai-chat-completions" | "google-cloud-code">, readonly "acceptsExternalEndpoints": boolean, readonly "nativePathSuffix"?: "/v1/messages" | "/responses" | "/chat/completions" | undefined, readonly "credentialEnvKey"?: string | undefined, readonly "baseUrlEnvKey"?: string | undefined, readonly "alternateCredentialEnvKeys"?: ReadonlyArray<string> | undefined, readonly "backendSwitchEnvKeys"?: ReadonlyArray<string> | undefined, readonly "extraEnv"?: ReadonlyArray<{ readonly "name": string, readonly "value": string }> | undefined, readonly "extraLaunchArgs"?: ReadonlyArray<{ readonly "key": string, readonly "value": string | boolean }> | undefined, readonly "supportsNativeSubscription"?: boolean | undefined }, readonly "maxConcurrentProcesses"?: number | undefined, readonly "keepsBackgroundServices"?: boolean | undefined }, readonly "origin": "bundled" | "installed" }> };
714
714
  export type ProvidersWorkspaceInventoryGetInput = { readonly "instanceId": string, readonly "cwd": string, readonly "threadId"?: string, readonly "refresh"?: boolean };
715
715
  export type ProvidersWorkspaceInventoryGetOutput = { readonly "instanceId": string, readonly "cwd": string, readonly "slashCommands": ReadonlyArray<Objects_94>, readonly "skills": ReadonlyArray<Objects_95>, readonly "source": "workspace" | "machine", readonly "sessionReported"?: boolean, readonly "checkedAt": string };
716
716
  export type ProvidersListInput = { };
@@ -48,6 +48,7 @@ export { EXECUTOR_RUNTIME_MODES, isLooserRuntimeMode } from "./executorCapabilit
48
48
  export type {
49
49
  ExecutorCapabilities,
50
50
  ExecutorContextCompaction,
51
+ ExecutorHostMcpToolListing,
51
52
  ExecutorInlineImageLimits,
52
53
  ExecutorModelDialect,
53
54
  ExecutorRuntimeMode,
@@ -75,10 +75,18 @@ export type ExecutorCapabilities = {
75
75
  * MCP 一直没握上、席位后来放行时,下一轮起轮前换一代补回工具。缺席 = 不换(自己会重连的、没验证过续接的都不声明)。
76
76
  */
77
77
  readonly recoversMcpByRelaunch?: boolean;
78
+ /**
79
+ * 宿主默认给这只手的 MCP 会话直列哪些内置与插件工具。
80
+ * 缺席 = `"compact"`(通用服务端抽屉:只直列核心入口工具,其余通过 `ycodium_tools` 与 `ycodium_call` 按需发现与调用);
81
+ * 内置或自带工具搜索的执行器可显式标为 `"full"`。
82
+ */
83
+ readonly hostMcpToolListing?: ExecutorHostMcpToolListing;
78
84
  /** 缺席 = 这只手不收内联图片,或不知道上限:所有图片都只给路径。 */
79
85
  readonly inlineImages?: ExecutorInlineImageLimits;
80
86
  };
81
87
 
88
+ export type ExecutorHostMcpToolListing = "compact" | "full";
89
+
82
90
  export type ExecutorSessionSkills = {
83
91
  /** 插件形状:根上有 `.claude-plugin/plugin.json`,技能在 `skills/` 下。 */
84
92
  readonly pluginDir: string;
@@ -144,7 +144,7 @@ export type ExecutorSession = {
144
144
  readonly model?: string;
145
145
  /**
146
146
  * `model` 的来源:`reported` 是从 CLI / 协议读回的实际型号,`echo` 是把宿主交来的值原样放回。
147
- * 缺席按 `echo`,界面会标「未经确认」;只有真读回的执行器才声明 `reported`。
147
+ * 缺席按 `echo`(宿主不记录未经读回的回声);只有真读回的执行器才声明 `reported`。
148
148
  */
149
149
  readonly modelSource?: "reported" | "echo";
150
150
  readonly threadId: string;
@@ -12,7 +12,7 @@
12
12
  * - 派发永远按意图,实际型号不改写发出去的型号:目录里的别名由 CLI 解析,读回的是解析后的完整 id,
13
13
  * 两者不是同一套写法。选别名就是跟着别名走,想固定版本选完整 id。
14
14
  * - 实际型号只用于显示:选择对不上目录(或没有选择)时,显示读回的型号;对得上就显示选择,
15
- * 档位按该目录条目算。`echo` 没有独立证据,不采用,只标未经确认。
15
+ * 档位按该目录条目算。`echo` 没有独立证据,不采用,仅在 `selected.unconfirmed` 保留诊断事实。
16
16
  * 输入用本文件自己的结构类型,字段名与契约对齐,插件 API 不依赖宿主包。
17
17
  */
18
18
  import { matchCatalogModel } from "./executor.ts";
@@ -8,6 +8,7 @@
8
8
  * - 哪个 id 是思考档只经 `modelOptionLabelKind`,不在这里再列一张名单。
9
9
  */
10
10
  import {
11
+ isReasoningEffortOptionId,
11
12
  knownEffortLevel,
12
13
  modelOptionLabelKind,
13
14
  reasoningEffortLevel,
@@ -124,15 +125,38 @@ function selectableChoices(
124
125
  .filter((id) => !(retired && id === "ultrathink"));
125
126
  }
126
127
 
128
+ /** 模型没报默认思考档时(无 currentValue 也无 isDefault),解析器兜底选中的档位。 */
129
+ const FALLBACK_EFFORT_LEVEL: ReasoningEffortLevel = "medium";
130
+
131
+ interface DescriptorDefault {
132
+ readonly value: ModelChoiceOptionValue | undefined;
133
+ /** 描述符没报默认档、由解析器兜底补出的:派发时一并带上,保证界面显示与实际运行一致。 */
134
+ readonly synthesized: boolean;
135
+ }
136
+
127
137
  function descriptorDefault(
128
138
  descriptor: ModelChoiceOptionDescriptor,
129
139
  choices: ReadonlyArray<string>,
130
- ): ModelChoiceOptionValue | undefined {
131
- if (descriptor.type === "boolean") return descriptor.currentValue;
140
+ ): DescriptorDefault {
141
+ if (descriptor.type === "boolean") {
142
+ return { value: descriptor.currentValue, synthesized: false };
143
+ }
132
144
  const current = descriptor.currentValue;
133
- if (current !== undefined && acceptsValue(descriptor, choices, current)) return current;
145
+ if (current !== undefined && acceptsValue(descriptor, choices, current)) {
146
+ return { value: current, synthesized: false };
147
+ }
134
148
  const flagged = descriptor.options.find((option) => option.isDefault === true)?.id;
135
- return flagged !== undefined && choices.includes(flagged) ? flagged : undefined;
149
+ if (flagged !== undefined && choices.includes(flagged)) {
150
+ return { value: flagged, synthesized: false };
151
+ }
152
+ if (isReasoningEffortOptionId(descriptor.id)) {
153
+ const valid = choices.filter((choice) => acceptsValue(descriptor, choices, choice));
154
+ const fallback = nearestEffortLevel(FALLBACK_EFFORT_LEVEL, valid);
155
+ if (fallback !== undefined) {
156
+ return { value: fallback, synthesized: true };
157
+ }
158
+ }
159
+ return { value: undefined, synthesized: false };
136
160
  }
137
161
 
138
162
  /** 存储值能不能当该描述符的取值;空选项列表是 provider 自己的自定义档,原样放行(退役档除外)。 */
@@ -203,6 +227,7 @@ export function resolveModelOptions(input: {
203
227
  }
204
228
 
205
229
  const seen = new Set<string>();
230
+ const synthesizedIds = new Set<string>();
206
231
  for (const descriptor of input.descriptors) {
207
232
  if (seen.has(descriptor.id)) continue;
208
233
  seen.add(descriptor.id);
@@ -212,10 +237,11 @@ export function resolveModelOptions(input: {
212
237
  const base = { id: descriptor.id, kind, ...(choices === undefined ? {} : { choices }) };
213
238
  const value = storedMap.get(descriptor.id);
214
239
  if (value === undefined) {
240
+ if (fallback.synthesized) synthesizedIds.add(descriptor.id);
215
241
  options.push({
216
242
  ...base,
217
243
  stored: undefined,
218
- effective: fallback,
244
+ effective: fallback.value,
219
245
  source: "default",
220
246
  supported: true,
221
247
  });
@@ -258,10 +284,11 @@ export function resolveModelOptions(input: {
258
284
  });
259
285
  continue;
260
286
  }
287
+ if (fallback.synthesized) synthesizedIds.add(descriptor.id);
261
288
  options.push({
262
289
  ...base,
263
290
  stored: value,
264
- effective: fallback,
291
+ effective: fallback.value,
265
292
  source: "default",
266
293
  supported: false,
267
294
  });
@@ -270,7 +297,7 @@ export function resolveModelOptions(input: {
270
297
  model: input.model,
271
298
  optionId: descriptor.id,
272
299
  stored: value,
273
- effective: fallback,
300
+ effective: fallback.value,
274
301
  });
275
302
  }
276
303
 
@@ -293,16 +320,21 @@ export function resolveModelOptions(input: {
293
320
  effective: undefined,
294
321
  });
295
322
  }
296
- return { options, dispatch: dispatchOf(options), hints };
323
+ return { options, dispatch: dispatchOf(options, synthesizedIds), hints };
297
324
  }
298
325
 
299
326
  function dispatchOf(
300
327
  options: ReadonlyArray<ModelChoiceOptionState>,
328
+ synthesizedIds: ReadonlySet<string> = new Set(),
301
329
  ): ReadonlyArray<ModelChoiceOptionSelection> {
302
330
  const out: ModelChoiceOptionSelection[] = [];
303
331
  for (const option of options) {
304
- if (!option.supported || option.source === "default" || option.effective === undefined)
332
+ if (option.effective === undefined) continue;
333
+ if (synthesizedIds.has(option.id)) {
334
+ out.push({ id: option.id, value: option.effective });
305
335
  continue;
336
+ }
337
+ if (!option.supported || option.source === "default") continue;
306
338
  out.push({ id: option.id, value: option.effective });
307
339
  }
308
340
  return out;
@@ -204,40 +204,3 @@ export function resolveConversationSlot<Component, Owner>(
204
204
  }
205
205
  return [];
206
206
  }
207
-
208
- /** 点开小圈的三段。启发式构成,不是账单。 */
209
- export interface ConversationContextBreakdown {
210
- readonly systemTokens: number;
211
- readonly toolsTokens: number;
212
- readonly messageTokens: number;
213
- }
214
-
215
- /** 与 dsh token-meter 相同的固定密度:每 token 四字符。 */
216
- export const CONTEXT_CHARS_PER_TOKEN = 4;
217
-
218
- export function estimateHeuristicTokens(text: string): number {
219
- if (text.length === 0) return 0;
220
- return Math.ceil(text.length / CONTEXT_CHARS_PER_TOKEN);
221
- }
222
-
223
- /**
224
- * 从已有聊天记录估三段。`system` 角色进系统;user/assistant 进对话;
225
- * 工具 schema 没有单独存时 `toolsText` 为空,tools 即为 0。
226
- */
227
- export function contextBreakdownFromTranscript(input: {
228
- readonly messages: ReadonlyArray<{ readonly role: string; readonly text: string }>;
229
- readonly toolsText?: string | null;
230
- }): ConversationContextBreakdown {
231
- let systemTokens = 0;
232
- let messageTokens = 0;
233
- for (const message of input.messages) {
234
- const tokens = estimateHeuristicTokens(message.text);
235
- if (message.role === "system") systemTokens += tokens;
236
- else messageTokens += tokens;
237
- }
238
- return {
239
- systemTokens,
240
- toolsTokens: estimateHeuristicTokens(input.toolsText ?? ""),
241
- messageTokens,
242
- };
243
- }
@@ -9,23 +9,7 @@
9
9
  *
10
10
  * @module @ycodium-ai/plugin-api/version
11
11
  */
12
- export const PLUGIN_API_VERSION = 181;
13
- export const PLUGIN_API_MIN_VERSION = 166;
12
+ export const PLUGIN_API_VERSION = 184;
13
+ export const PLUGIN_API_MIN_VERSION = 183;
14
14
  /** 插件可以声明的版本:窗口内的每一个。 */
15
- export type PluginApiVersion =
16
- | 166
17
- | 167
18
- | 168
19
- | 169
20
- | 170
21
- | 171
22
- | 172
23
- | 173
24
- | 174
25
- | 175
26
- | 176
27
- | 177
28
- | 178
29
- | 179
30
- | 180
31
- | 181;
15
+ export type PluginApiVersion = 183 | 184;
package/dist/version.d.ts CHANGED
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * @module @ycodium-ai/plugin-api/version
9
9
  */
10
- export declare const PLUGIN_API_VERSION = 181;
11
- export declare const PLUGIN_API_MIN_VERSION = 166;
10
+ export declare const PLUGIN_API_VERSION = 184;
11
+ export declare const PLUGIN_API_MIN_VERSION = 183;
12
12
  /** 插件可以声明的版本:窗口内的每一个。 */
13
- export type PluginApiVersion = 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181;
13
+ export type PluginApiVersion = 183 | 184;
14
14
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["source/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,yBAAyB;AACzB,MAAM,MAAM,gBAAgB,GACxB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["source/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,yBAAyB;AACzB,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,CAAC"}
package/dist/version.js CHANGED
@@ -9,6 +9,6 @@
9
9
  *
10
10
  * @module @ycodium-ai/plugin-api/version
11
11
  */
12
- export const PLUGIN_API_VERSION = 181;
13
- export const PLUGIN_API_MIN_VERSION = 166;
12
+ export const PLUGIN_API_VERSION = 184;
13
+ export const PLUGIN_API_MIN_VERSION = 183;
14
14
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-api",
3
- "version": "0.2.5763",
3
+ "version": "0.2.5877",
4
4
  "description": "Contracts and shared libraries for authoring Ycodium plugins.",
5
5
  "keywords": [
6
6
  "ycodium"
@@ -167,20 +167,20 @@
167
167
  "tailwindcss": "^4.0.0",
168
168
  "typescript": "~6.0.3",
169
169
  "vite-plus": "0.2.2",
170
+ "ycodium-attachment-kinds": "0.0.0",
170
171
  "ycodium-composer-tokens": "0.0.0",
171
172
  "ycodium-credential-account": "0.0.0",
172
- "ycodium-attachment-kinds": "0.0.0",
173
- "ycodium-day-format": "0.0.0",
174
- "ycodium-diff-format": "0.0.0",
175
- "ycodium-duration-format": "0.0.0",
176
173
  "ycodium-decision-order": "0.0.0",
174
+ "ycodium-duration-format": "0.0.0",
175
+ "ycodium-diff-format": "0.0.0",
177
176
  "ycodium-executor-common": "0.0.0",
177
+ "ycodium-day-format": "0.0.0",
178
178
  "ycodium-fetch-ports": "0.0.0",
179
+ "ycodium-full-access-mode": "0.0.0",
179
180
  "ycodium-instance-config": "0.0.0",
180
181
  "ycodium-jsonl-stream": "0.0.0",
181
- "ycodium-full-access-mode": "0.0.0",
182
- "ycodium-markdown-fence": "0.0.0",
183
182
  "ycodium-source-control": "0.0.0",
183
+ "ycodium-markdown-fence": "0.0.0",
184
184
  "ycodium-sse-stream": "0.0.0",
185
185
  "ycodium-system-text": "0.0.0",
186
186
  "ycodium-text-generation": "0.0.0",