@ycodium-ai/plugin-api 0.2.6153 → 0.2.6212
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 +15 -1
- package/dist/_private/ycodium-composer-tokens/composerLogic.d.ts +1 -1
- package/dist/_private/ycodium-composer-tokens/composerTrigger.d.ts +3 -4
- package/dist/_private/ycodium-composer-tokens/composerTrigger.js +2 -4
- package/dist/_private/ycodium-composer-tokens/providerSkills.d.ts +25 -3
- package/dist/_private/ycodium-composer-tokens/providerSkills.js +45 -3
- package/dist/_private/ycodium-composer-tokens/sessionContextSummaryFormat.d.ts +8 -1
- package/dist/_private/ycodium-composer-tokens/sessionContextSummaryFormat.js +13 -1
- package/dist/_private/ycodium-composer-tokens/slashMenu.d.ts +20 -11
- package/dist/_private/ycodium-composer-tokens/slashMenu.js +24 -21
- package/dist/_private/ycodium-executor-common/eventTypes.d.ts +1 -1
- package/dist/composer.d.ts +1 -1
- package/dist/composer.d.ts.map +1 -1
- package/dist/composer.js +1 -1
- package/dist/composer.js.map +1 -1
- package/dist/conversation-view.d.ts +2 -0
- package/dist/conversation-view.d.ts.map +1 -1
- package/dist/conversation-view.js.map +1 -1
- package/dist/conversationComposerEnvironment.d.ts +2 -0
- package/dist/conversationComposerEnvironment.d.ts.map +1 -1
- package/dist/conversationHostModels.d.ts +6 -0
- package/dist/conversationHostModels.d.ts.map +1 -1
- package/dist/conversationSkills.d.ts +5 -0
- package/dist/conversationSkills.d.ts.map +1 -1
- package/dist/conversationTrajectory.d.ts +3 -0
- package/dist/conversationTrajectory.d.ts.map +1 -1
- package/dist/dataPorts.gen.d.ts +809 -12
- package/dist/dataPorts.gen.d.ts.map +1 -1
- package/dist/dataPorts.gen.js.map +1 -1
- package/dist/source/_private/ycodium-composer-tokens/composerLogic.ts +1 -1
- package/dist/source/_private/ycodium-composer-tokens/composerTrigger.ts +3 -5
- package/dist/source/_private/ycodium-composer-tokens/providerSkills.ts +83 -7
- package/dist/source/_private/ycodium-composer-tokens/sessionContextSummaryFormat.ts +25 -2
- package/dist/source/_private/ycodium-composer-tokens/slashMenu.ts +52 -26
- package/dist/source/_private/ycodium-executor-common/eventTypes.ts +1 -0
- package/dist/source/composer.ts +4 -0
- package/dist/source/conversation-view.ts +2 -0
- package/dist/source/conversationComposerEnvironment.ts +2 -0
- package/dist/source/conversationHostModels.ts +3 -0
- package/dist/source/conversationSkills.ts +6 -0
- package/dist/source/conversationTrajectory.ts +4 -0
- package/dist/source/dataPorts.gen.ts +114 -59
- package/dist/source/version.ts +3 -3
- package/dist/version.d.ts +3 -3
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataPorts.gen.js","sourceRoot":"","sources":["source/dataPorts.gen.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,+CAA+C;
|
|
1
|
+
{"version":3,"file":"dataPorts.gen.js","sourceRoot":"","sources":["source/dataPorts.gen.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,+CAA+C;AAkwB/C,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AACnD,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC"}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./composerTrigger.ts";
|
|
12
12
|
import { isComposerWhitespace } from "./skillTokens.ts";
|
|
13
13
|
|
|
14
|
-
export type ComposerSlashCommand = "model" | "plan" | "default";
|
|
14
|
+
export type ComposerSlashCommand = "model" | "effort" | "mode" | "compact" | "plan" | "default";
|
|
15
15
|
export type ComposerSubmissionIntent = "foreground" | "background" | "steer";
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -3,10 +3,9 @@ import { isComposerWhitespace, SKILL_TOKEN_NAME_PATTERN } from "./skillTokens.ts
|
|
|
3
3
|
/**
|
|
4
4
|
* - `slash-command`:行首的 `/query`,菜单列内置命令、provider 命令与技能。
|
|
5
5
|
* - `slash-skill`:句中(前面是空白)的 `/query`,菜单只列技能,选中插入 `$name`;内置命令只认行首。
|
|
6
|
-
* - `skill`:任意位置的 `$query`。
|
|
7
6
|
* - `path`:任意位置的 `@query`。
|
|
8
7
|
*/
|
|
9
|
-
export type ComposerTriggerKind = "path" | "slash-command" | "slash-skill"
|
|
8
|
+
export type ComposerTriggerKind = "path" | "slash-command" | "slash-skill";
|
|
10
9
|
|
|
11
10
|
export interface ComposerTrigger {
|
|
12
11
|
kind: ComposerTriggerKind;
|
|
@@ -24,8 +23,8 @@ function clampCursor(text: string, cursor: number): number {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
* 光标处正在输入的触发器(`/command`、`/skill
|
|
28
|
-
*
|
|
26
|
+
* 光标处正在输入的触发器(`/command`、`/skill`、`@path`)。`$` 留给普通文本(环境变量、金额等),不触发补全菜单。
|
|
27
|
+
* `isWhitespaceChar` 给有内联占位字符的输入区(web 的终端上下文芯片)把它们也当 token 边界。
|
|
29
28
|
*/
|
|
30
29
|
export function detectComposerTrigger(
|
|
31
30
|
text: string,
|
|
@@ -50,7 +49,6 @@ export function detectComposerTrigger(
|
|
|
50
49
|
}
|
|
51
50
|
const token = text.slice(tokenStart, cursor);
|
|
52
51
|
const range = { query: token.slice(1), rangeStart: tokenStart, rangeEnd: cursor };
|
|
53
|
-
if (token.startsWith("$")) return { kind: "skill", ...range };
|
|
54
52
|
if (token.startsWith("@")) return { kind: "path", ...range };
|
|
55
53
|
if (!token.startsWith("/")) return null;
|
|
56
54
|
|
|
@@ -9,13 +9,40 @@ export interface ProviderSkillFields {
|
|
|
9
9
|
readonly displayName?: string | undefined;
|
|
10
10
|
readonly shortDescription?: string | undefined;
|
|
11
11
|
readonly description?: string | undefined;
|
|
12
|
+
readonly summary?: Readonly<Record<string, string>> | undefined;
|
|
12
13
|
readonly path: string;
|
|
13
14
|
readonly scope?: string | undefined;
|
|
15
|
+
readonly originScope?: "repo" | "project" | "global" | "builtin" | undefined;
|
|
16
|
+
readonly originLabel?: string | undefined;
|
|
17
|
+
readonly overridesGlobal?: boolean | undefined;
|
|
14
18
|
readonly enabled: boolean;
|
|
15
19
|
readonly userInvocable?: boolean | undefined;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export type ProviderSkillSourceKind =
|
|
22
|
+
export type ProviderSkillSourceKind =
|
|
23
|
+
| "builtin"
|
|
24
|
+
| "app"
|
|
25
|
+
| "repo"
|
|
26
|
+
| "project"
|
|
27
|
+
| "personal"
|
|
28
|
+
| "system"
|
|
29
|
+
| "other";
|
|
30
|
+
|
|
31
|
+
export type ProviderSkillScopeBadgeKind =
|
|
32
|
+
| "repo"
|
|
33
|
+
| "project"
|
|
34
|
+
| "global"
|
|
35
|
+
| "builtin"
|
|
36
|
+
| "personal"
|
|
37
|
+
| "app"
|
|
38
|
+
| "system"
|
|
39
|
+
| "other";
|
|
40
|
+
|
|
41
|
+
export interface ProviderSkillScopeBadge {
|
|
42
|
+
readonly kind: ProviderSkillScopeBadgeKind;
|
|
43
|
+
readonly customLabel: string | null;
|
|
44
|
+
readonly overridesGlobal: boolean;
|
|
45
|
+
}
|
|
19
46
|
|
|
20
47
|
function titleCaseWords(value: string): string {
|
|
21
48
|
const words: string[] = [];
|
|
@@ -37,12 +64,31 @@ export function formatProviderSkillDisplayName(
|
|
|
37
64
|
if (displayName) {
|
|
38
65
|
return displayName;
|
|
39
66
|
}
|
|
40
|
-
|
|
67
|
+
const trimmedName = skill.name.trim();
|
|
68
|
+
const stripped = /^ycodium[-:_](.+)$/i.exec(trimmedName)?.[1] ?? trimmedName;
|
|
69
|
+
return titleCaseWords(stripped);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function resolveProviderSkillSummary(
|
|
73
|
+
skill: Pick<ProviderSkillFields, "summary" | "shortDescription" | "description">,
|
|
74
|
+
language?: string | undefined,
|
|
75
|
+
): string {
|
|
76
|
+
if (skill.summary) {
|
|
77
|
+
if (language) {
|
|
78
|
+
const exact = skill.summary[language];
|
|
79
|
+
if (exact) return exact;
|
|
80
|
+
const base = language.split("-")[0];
|
|
81
|
+
if (base && skill.summary[base]) return skill.summary[base]!;
|
|
82
|
+
if (base === "zh" && skill.summary["zh-CN"]) return skill.summary["zh-CN"]!;
|
|
83
|
+
}
|
|
84
|
+
if (skill.summary["en"]) return skill.summary["en"]!;
|
|
85
|
+
}
|
|
86
|
+
return skill.shortDescription?.trim() || skill.description?.trim() || "";
|
|
41
87
|
}
|
|
42
88
|
|
|
43
89
|
export function getProviderSkillsForSlashMenu<S extends ProviderSkillFields>(
|
|
44
90
|
skills: ReadonlyArray<S>,
|
|
45
|
-
showSkillsInSlashMenu: boolean,
|
|
91
|
+
showSkillsInSlashMenu: boolean = true,
|
|
46
92
|
): S[] {
|
|
47
93
|
return showSkillsInSlashMenu ? skills.filter(isProviderSkillUserInvocable) : [];
|
|
48
94
|
}
|
|
@@ -55,16 +101,29 @@ export function getProviderSlashCommandsForSlashMenu<C extends { readonly name:
|
|
|
55
101
|
return slashCommands.filter((command) => !skillNames.has(command.name.trim().toLowerCase()));
|
|
56
102
|
}
|
|
57
103
|
|
|
58
|
-
export function resolveProviderSkillSourceKind(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
104
|
+
export function resolveProviderSkillSourceKind(skill: {
|
|
105
|
+
readonly path?: string | undefined;
|
|
106
|
+
readonly scope?: string | undefined;
|
|
107
|
+
readonly originScope?: "repo" | "project" | "global" | "builtin" | undefined;
|
|
108
|
+
}): ProviderSkillSourceKind {
|
|
109
|
+
if (skill.originScope === "repo") return "repo";
|
|
110
|
+
if (skill.originScope === "project") return "project";
|
|
111
|
+
if (skill.originScope === "builtin") return "builtin";
|
|
112
|
+
if (skill.originScope === "global") return "personal";
|
|
113
|
+
|
|
114
|
+
const normalizedPath = normalizePathSeparators(skill.path ?? "");
|
|
115
|
+
if (normalizedPath.includes("/session-skills/")) {
|
|
116
|
+
return "builtin";
|
|
117
|
+
}
|
|
62
118
|
if (normalizedPath.includes("/.codex/plugins/") || normalizedPath.includes("/.agents/plugins/")) {
|
|
63
119
|
return "app";
|
|
64
120
|
}
|
|
65
121
|
|
|
66
122
|
const normalizedScope = skill.scope?.trim().toLowerCase();
|
|
67
123
|
switch (normalizedScope) {
|
|
124
|
+
case "ycodium":
|
|
125
|
+
case "builtin":
|
|
126
|
+
return "builtin";
|
|
68
127
|
case "repo":
|
|
69
128
|
case "repository":
|
|
70
129
|
return "repo";
|
|
@@ -74,6 +133,7 @@ export function resolveProviderSkillSourceKind(
|
|
|
74
133
|
return "project";
|
|
75
134
|
case "user":
|
|
76
135
|
case "personal":
|
|
136
|
+
case "global":
|
|
77
137
|
return "personal";
|
|
78
138
|
case "system":
|
|
79
139
|
return "system";
|
|
@@ -84,3 +144,19 @@ export function resolveProviderSkillSourceKind(
|
|
|
84
144
|
return "other";
|
|
85
145
|
}
|
|
86
146
|
}
|
|
147
|
+
|
|
148
|
+
export function resolveProviderSkillScopeBadge(skill: {
|
|
149
|
+
readonly path?: string | undefined;
|
|
150
|
+
readonly scope?: string | undefined;
|
|
151
|
+
readonly originScope?: "repo" | "project" | "global" | "builtin" | undefined;
|
|
152
|
+
readonly originLabel?: string | undefined;
|
|
153
|
+
readonly overridesGlobal?: boolean | undefined;
|
|
154
|
+
}): ProviderSkillScopeBadge {
|
|
155
|
+
const kind: ProviderSkillScopeBadgeKind =
|
|
156
|
+
skill.originScope ?? resolveProviderSkillSourceKind(skill);
|
|
157
|
+
return {
|
|
158
|
+
kind,
|
|
159
|
+
customLabel: skill.originLabel?.trim() || null,
|
|
160
|
+
overridesGlobal: skill.overridesGlobal === true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export type SessionContextSummaryToolkit = "board" | "memory" | "messages";
|
|
2
2
|
|
|
3
|
+
export type SessionOverviewStatus =
|
|
4
|
+
| { readonly mode: "full" | "guide"; readonly revision: number }
|
|
5
|
+
| { readonly mode: "unknown" | "empty" | "disabled" };
|
|
6
|
+
|
|
3
7
|
export interface SessionContextSummaryInput {
|
|
4
8
|
readonly enabledToolkits: ReadonlyArray<SessionContextSummaryToolkit>;
|
|
5
9
|
readonly onDemandHiddenCount?: number | null | undefined;
|
|
6
10
|
readonly activeSkillCount: number;
|
|
11
|
+
readonly overview?: SessionOverviewStatus;
|
|
7
12
|
readonly handbookRelease?: string | null | undefined;
|
|
8
13
|
readonly inContextExperienceCount: number;
|
|
9
14
|
}
|
|
@@ -22,7 +27,13 @@ export type SessionContextSummaryTranslateFn = (
|
|
|
22
27
|
| "contextWindow.memory"
|
|
23
28
|
| "contextWindow.memorySummary"
|
|
24
29
|
| "contextWindow.experiencesCount"
|
|
25
|
-
| "contextWindow.memoryEmpty"
|
|
30
|
+
| "contextWindow.memoryEmpty"
|
|
31
|
+
| "contextWindow.overview"
|
|
32
|
+
| "contextWindow.overviewFull"
|
|
33
|
+
| "contextWindow.overviewGuide"
|
|
34
|
+
| "contextWindow.overviewUnknown"
|
|
35
|
+
| "contextWindow.overviewEmpty"
|
|
36
|
+
| "contextWindow.overviewDisabled",
|
|
26
37
|
options?: Record<string, unknown>,
|
|
27
38
|
) => string;
|
|
28
39
|
|
|
@@ -72,6 +83,18 @@ function formatSessionMemoryValue(
|
|
|
72
83
|
t: SessionContextSummaryTranslateFn,
|
|
73
84
|
summary: SessionContextSummaryInput,
|
|
74
85
|
): string {
|
|
86
|
+
switch (summary.overview?.mode) {
|
|
87
|
+
case "full":
|
|
88
|
+
return t("contextWindow.overviewFull", { revision: summary.overview.revision });
|
|
89
|
+
case "guide":
|
|
90
|
+
return t("contextWindow.overviewGuide");
|
|
91
|
+
case "empty":
|
|
92
|
+
return t("contextWindow.overviewEmpty");
|
|
93
|
+
case "disabled":
|
|
94
|
+
return t("contextWindow.overviewDisabled");
|
|
95
|
+
case "unknown":
|
|
96
|
+
return t("contextWindow.overviewUnknown");
|
|
97
|
+
}
|
|
75
98
|
const { handbookRelease, inContextExperienceCount } = summary;
|
|
76
99
|
const hasRelease = typeof handbookRelease === "string" && handbookRelease.length > 0;
|
|
77
100
|
const hasExperiences = inContextExperienceCount > 0;
|
|
@@ -109,7 +132,7 @@ export function formatSessionContextSummaryRows(
|
|
|
109
132
|
},
|
|
110
133
|
{
|
|
111
134
|
key: "memory",
|
|
112
|
-
label: t("contextWindow.memory"),
|
|
135
|
+
label: t(summary.overview === undefined ? "contextWindow.memory" : "contextWindow.overview"),
|
|
113
136
|
value: formatSessionMemoryValue(t, summary),
|
|
114
137
|
},
|
|
115
138
|
];
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatProviderSkillDisplayName,
|
|
3
|
+
resolveProviderSkillSummary,
|
|
4
|
+
type ProviderSkillScopeBadgeKind,
|
|
5
|
+
} from "./providerSkills.ts";
|
|
1
6
|
import { isProviderSkillUserInvocable } from "./skillTokens.ts";
|
|
2
7
|
import { scoreQueryMatch } from "./searchRanking.ts";
|
|
3
8
|
|
|
@@ -9,7 +14,11 @@ export interface MenuSkill {
|
|
|
9
14
|
readonly displayName?: string | undefined;
|
|
10
15
|
readonly shortDescription?: string | undefined;
|
|
11
16
|
readonly description?: string | undefined;
|
|
17
|
+
readonly summary?: Readonly<Record<string, string>> | undefined;
|
|
12
18
|
readonly scope?: string | undefined;
|
|
19
|
+
readonly originScope?: "repo" | "project" | "global" | "builtin" | undefined;
|
|
20
|
+
readonly originLabel?: string | undefined;
|
|
21
|
+
readonly overridesGlobal?: boolean | undefined;
|
|
13
22
|
readonly pluginId?: string | undefined;
|
|
14
23
|
}
|
|
15
24
|
|
|
@@ -25,6 +34,7 @@ export interface PluginSlashMenuCommand {
|
|
|
25
34
|
readonly kind: "prompt" | "action";
|
|
26
35
|
readonly description?: string | undefined;
|
|
27
36
|
readonly argumentHint?: string | undefined;
|
|
37
|
+
readonly originScope?: ProviderSkillScopeBadgeKind | undefined;
|
|
28
38
|
}
|
|
29
39
|
export type PluginSlashBinding = Pick<PluginSlashMenuCommand, "pluginId" | "name">;
|
|
30
40
|
export type SlashMenuSection = "recent" | "builtIn" | "provider" | "skills" | "plugins";
|
|
@@ -34,7 +44,12 @@ type MenuRow = {
|
|
|
34
44
|
readonly description: string;
|
|
35
45
|
readonly section?: SlashMenuSection | undefined;
|
|
36
46
|
};
|
|
37
|
-
export type SlashMenuItem<
|
|
47
|
+
export type SlashMenuItem<
|
|
48
|
+
B extends string = string,
|
|
49
|
+
P extends string = string,
|
|
50
|
+
S extends MenuSkill = MenuSkill,
|
|
51
|
+
C extends MenuProviderCommand = MenuProviderCommand,
|
|
52
|
+
> = MenuRow &
|
|
38
53
|
(
|
|
39
54
|
| {
|
|
40
55
|
readonly type: "plugin-slash-command";
|
|
@@ -44,10 +59,10 @@ export type SlashMenuItem<B extends string = string> = MenuRow &
|
|
|
44
59
|
| { readonly type: "slash-command"; readonly command: B }
|
|
45
60
|
| {
|
|
46
61
|
readonly type: "provider-slash-command";
|
|
47
|
-
readonly command:
|
|
48
|
-
readonly provider:
|
|
62
|
+
readonly command: C;
|
|
63
|
+
readonly provider: P;
|
|
49
64
|
}
|
|
50
|
-
| { readonly type: "skill"; readonly skill:
|
|
65
|
+
| { readonly type: "skill"; readonly skill: S; readonly provider: P }
|
|
51
66
|
);
|
|
52
67
|
|
|
53
68
|
const score = (value: string, query: string, base = 0) =>
|
|
@@ -77,15 +92,11 @@ export function searchSlashCommandItems<T extends SlashMenuItem>(
|
|
|
77
92
|
: item.type === "skill"
|
|
78
93
|
? item.skill.name
|
|
79
94
|
: item.command.name;
|
|
80
|
-
const
|
|
81
|
-
const scores = [score(name, skillQuery), score(item.description, skillQuery, 20)];
|
|
95
|
+
const scores = [score(name, q), score(item.description, q, 20)];
|
|
82
96
|
if (item.type === "skill") {
|
|
83
|
-
scores.push(
|
|
84
|
-
|
|
85
|
-
);
|
|
86
|
-
scores.push(score(item.skill.description ?? "", skillQuery, 30));
|
|
87
|
-
scores.push(score(item.skill.scope ?? "", skillQuery, 40));
|
|
88
|
-
if ("skill".startsWith(q)) scores.push(q === "skill" ? 0 : Number.MAX_SAFE_INTEGER);
|
|
97
|
+
scores.push(score(item.skill.displayName ?? item.skill.name.replace(/[-_]/g, " "), q, 1));
|
|
98
|
+
scores.push(score(item.skill.description ?? "", q, 30));
|
|
99
|
+
scores.push(score(item.skill.scope ?? "", q, 40));
|
|
89
100
|
}
|
|
90
101
|
const matches = scores.filter((n): n is number => n !== null);
|
|
91
102
|
if (!matches.length) return [];
|
|
@@ -139,20 +150,31 @@ export function groupSlashMenuItemsForEmptyQuery<T extends Pick<SlashMenuItem, "
|
|
|
139
150
|
}
|
|
140
151
|
|
|
141
152
|
/** 两端传入可执行的内置命令与本地设置;来源去重、过滤、打分和分组只在这里做。 */
|
|
142
|
-
export function buildSlashMenu<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
export function buildSlashMenu<
|
|
154
|
+
B extends string,
|
|
155
|
+
P extends string = string,
|
|
156
|
+
S extends MenuSkill = MenuSkill,
|
|
157
|
+
C extends MenuProviderCommand = MenuProviderCommand,
|
|
158
|
+
>(input: {
|
|
159
|
+
readonly builtIns: readonly {
|
|
160
|
+
readonly command: B;
|
|
161
|
+
readonly description: string;
|
|
162
|
+
readonly hasChildren?: boolean | undefined;
|
|
163
|
+
}[];
|
|
164
|
+
readonly provider: P;
|
|
165
|
+
readonly commands: readonly C[];
|
|
166
|
+
readonly skills: readonly S[];
|
|
167
|
+
readonly showSkills?: boolean | undefined;
|
|
148
168
|
readonly query: string;
|
|
169
|
+
readonly language?: string | undefined;
|
|
149
170
|
readonly recentIds?: readonly string[];
|
|
150
171
|
readonly providerDescription: string;
|
|
151
172
|
readonly plugins?: readonly PluginSlashMenuCommand[] | undefined;
|
|
152
173
|
}) {
|
|
174
|
+
const showSkills = input.showSkills !== false;
|
|
153
175
|
const skillNames = new Set(input.skills.map((skill) => skill.name.trim().toLowerCase()));
|
|
154
176
|
const builtInNames = new Set<string>(input.builtIns.map((item) => item.command));
|
|
155
|
-
const items: SlashMenuItem<B>[] = [
|
|
177
|
+
const items: SlashMenuItem<B, P, S, C>[] = [
|
|
156
178
|
...input.builtIns.map((item) => ({
|
|
157
179
|
...item,
|
|
158
180
|
id: `slash:${item.command}`,
|
|
@@ -171,13 +193,13 @@ export function buildSlashMenu<B extends string>(input: {
|
|
|
171
193
|
label: `/${command.name}`,
|
|
172
194
|
description: command.description ?? command.input?.hint ?? input.providerDescription,
|
|
173
195
|
})),
|
|
174
|
-
...(
|
|
196
|
+
...(showSkills ? input.skills.filter(isProviderSkillUserInvocable) : []).map((skill) => ({
|
|
175
197
|
id: `skill:${input.provider}:${skill.name}`,
|
|
176
198
|
type: "skill" as const,
|
|
177
199
|
provider: input.provider,
|
|
178
200
|
skill,
|
|
179
|
-
label:
|
|
180
|
-
description: skill
|
|
201
|
+
label: formatProviderSkillDisplayName(skill),
|
|
202
|
+
description: resolveProviderSkillSummary(skill, input.language),
|
|
181
203
|
})),
|
|
182
204
|
...(input.plugins ?? []).map((command) => ({
|
|
183
205
|
id: `plugin-slash:${command.pluginId}:${command.name}`,
|
|
@@ -242,6 +264,7 @@ export const retainSlashBinding = (text: string, binding: PluginSlashBinding | u
|
|
|
242
264
|
export function pluginSlashMenuCommands(
|
|
243
265
|
plugins: readonly {
|
|
244
266
|
readonly pluginId: string;
|
|
267
|
+
readonly origin?: string | undefined;
|
|
245
268
|
readonly state: string;
|
|
246
269
|
readonly threadId?: string | null | undefined;
|
|
247
270
|
readonly slashCommands?:
|
|
@@ -275,11 +298,14 @@ export function pluginSlashMenuCommands(
|
|
|
275
298
|
if (!previous || (previous.threadId != null && plugin.threadId == null))
|
|
276
299
|
byPlugin.set(plugin.pluginId, plugin);
|
|
277
300
|
}
|
|
278
|
-
return [...byPlugin.values()].flatMap((plugin) =>
|
|
279
|
-
|
|
301
|
+
return [...byPlugin.values()].flatMap((plugin) => {
|
|
302
|
+
const originScope: ProviderSkillScopeBadgeKind =
|
|
303
|
+
plugin.origin === "builtin" ? "builtin" : plugin.origin === "project" ? "repo" : "global";
|
|
304
|
+
return (plugin.slashCommands ?? []).map((command) => ({
|
|
280
305
|
pluginId: plugin.pluginId,
|
|
281
306
|
name: command.name,
|
|
282
307
|
kind: command.kind,
|
|
308
|
+
originScope,
|
|
283
309
|
description:
|
|
284
310
|
command.translations?.[language]?.description ??
|
|
285
311
|
command.translations?.en?.description ??
|
|
@@ -288,6 +314,6 @@ export function pluginSlashMenuCommands(
|
|
|
288
314
|
command.translations?.[language]?.argumentHint ??
|
|
289
315
|
command.translations?.en?.argumentHint ??
|
|
290
316
|
command.argumentHint,
|
|
291
|
-
}))
|
|
292
|
-
);
|
|
317
|
+
}));
|
|
318
|
+
});
|
|
293
319
|
}
|
package/dist/source/composer.ts
CHANGED
|
@@ -65,8 +65,12 @@ export {
|
|
|
65
65
|
export {
|
|
66
66
|
formatProviderSkillDisplayName,
|
|
67
67
|
getProviderSkillsForSlashMenu,
|
|
68
|
+
type ProviderSkillScopeBadge,
|
|
69
|
+
type ProviderSkillScopeBadgeKind,
|
|
68
70
|
type ProviderSkillSourceKind,
|
|
71
|
+
resolveProviderSkillScopeBadge,
|
|
69
72
|
resolveProviderSkillSourceKind,
|
|
73
|
+
resolveProviderSkillSummary,
|
|
70
74
|
} from "./_private/ycodium-composer-tokens/providerSkills.ts";
|
|
71
75
|
export { searchProviderSkills } from "./_private/ycodium-composer-tokens/providerSkillSearch.ts";
|
|
72
76
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConversationComposerApi, ConversationComposerPending } from "./conversation.ts";
|
|
2
|
+
import type { ConversationQuestions } from "./conversationHostModels.ts";
|
|
2
3
|
|
|
3
4
|
// 会话插件对宿主暴露的嵌入视图:视图 id、plugin id 与宿主注入的保留字段。
|
|
4
5
|
// 经 `@ycodium-ai/plugin-api/conversation` 导出,不单独成子路径。
|
|
@@ -45,5 +46,6 @@ export interface ConversationPendingRequestsViewProps {
|
|
|
45
46
|
readonly threadId: string;
|
|
46
47
|
/** 这条会话的待处理项与回答它们的命令。 */
|
|
47
48
|
readonly pending: ConversationComposerPending;
|
|
49
|
+
readonly asyncQuestions?: ConversationQuestions;
|
|
48
50
|
readonly api: ConversationComposerApi;
|
|
49
51
|
}
|
|
@@ -492,6 +492,9 @@ export interface ConversationSessionContextSummary {
|
|
|
492
492
|
readonly enabledToolkits: readonly ConversationSessionToolkit[];
|
|
493
493
|
readonly onDemandHiddenCount?: number | null | undefined;
|
|
494
494
|
readonly activeSkillCount: number;
|
|
495
|
+
readonly overview?:
|
|
496
|
+
| { readonly mode: "full" | "guide"; readonly revision: number }
|
|
497
|
+
| { readonly mode: "unknown" | "empty" | "disabled" };
|
|
495
498
|
readonly handbookRelease: string | null;
|
|
496
499
|
readonly inContextExperienceCount: number;
|
|
497
500
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/** 宿主报给会话插件的技能与斜杠命令(`ServerProviderSkill` / `ServerProviderSlashCommand` 的结构子集)。 */
|
|
2
2
|
|
|
3
|
+
export type ConversationSkillOriginScope = "repo" | "project" | "global" | "builtin";
|
|
4
|
+
|
|
3
5
|
export interface ConversationServerProviderSkill {
|
|
4
6
|
pluginId?: string | undefined;
|
|
5
7
|
name: string;
|
|
6
8
|
displayName?: string | undefined;
|
|
7
9
|
shortDescription?: string | undefined;
|
|
8
10
|
description?: string | undefined;
|
|
11
|
+
summary?: Readonly<Record<string, string>> | undefined;
|
|
9
12
|
path: string;
|
|
10
13
|
scope?: string | undefined;
|
|
14
|
+
originScope?: ConversationSkillOriginScope | undefined;
|
|
15
|
+
originLabel?: string | undefined;
|
|
16
|
+
overridesGlobal?: boolean | undefined;
|
|
11
17
|
enabled: boolean;
|
|
12
18
|
userInvocationOnly?: boolean | undefined;
|
|
13
19
|
userInvocable?: boolean | undefined;
|
|
@@ -75,10 +75,14 @@ export interface ConversationToolCallCounts {
|
|
|
75
75
|
readonly matchedFailedCalls: number;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
export type ConversationExtensionScopeKind = "repo" | "project" | "global" | "builtin";
|
|
79
|
+
|
|
78
80
|
export interface ConversationTrajectorySourceQuery {
|
|
79
81
|
readonly sources: readonly ConversationToolCallFilter[];
|
|
80
82
|
/** 缺席表示尚无该轮的完整计数,不能拿当前窗口行数替代。 */
|
|
81
83
|
readonly turnCounts: ReadonlyMap<string | null, ConversationToolCallCounts>;
|
|
84
|
+
readonly scopeByPluginId?: Readonly<Record<string, ConversationExtensionScopeKind>> | undefined;
|
|
85
|
+
readonly scopeByMcpServer?: Readonly<Record<string, ConversationExtensionScopeKind>> | undefined;
|
|
82
86
|
readonly loading: boolean;
|
|
83
87
|
readonly error: string | null;
|
|
84
88
|
retry(): void;
|