Remove Codex skill mention plumbing
This commit is contained in:
parent
6803802e13
commit
42df76747b
47 changed files with 108 additions and 1963 deletions
|
|
@ -874,8 +874,7 @@ and lives under MCP server config.
|
|||
The plugin feature and mention residue is gone too. `Feature::Plugins`,
|
||||
`Feature::RemotePlugin`, `plugin://` structured mentions, plugin instruction
|
||||
tags, stale plugin popup snapshots, and app/plugin path classification in
|
||||
`codex-core-skills` were deleted. Live structured mentions are MCP/skill-shaped
|
||||
only. Do not resurrect plugin product routing or `app://` compatibility to make
|
||||
`codex-core-skills` were deleted. Do not resurrect plugin product routing or `app://` compatibility to make
|
||||
old tests feel less lonely; the blessed route is `mcp://` at the MCP edge and
|
||||
typed CultCache/CultNet documents inside Epiphany.
|
||||
|
||||
|
|
@ -900,6 +899,13 @@ handlers, TUI slash/startup/list/manage-skill surfaces, docs, or test helpers.
|
|||
The fake live-reload/developer-message and skill-list tests were deleted rather
|
||||
than repaired into new compatibility lies.
|
||||
|
||||
The live skill mention channel is also gone. `UserInput::Skill`, the app-server
|
||||
schema branch, TUI skill popup, `skills_all` cache, composer skill mention API,
|
||||
skill insertion path, `skill://` / `SKILL.md` history decoding, and stale skill
|
||||
popup snapshot were deleted. Live structured user-input mentions are MCP-shaped
|
||||
only; MCP remains JSON-RPC at its protocol edge, not a reason to keep Codex
|
||||
skills alive inside the organ.
|
||||
|
||||
That husk has now been cut from `codex-core`. The root core crate no longer
|
||||
exports `plugins`, no longer depends on `codex-core-plugins` or `codex-plugin`,
|
||||
and the core plugin manager / marketplace add-remove-sync modules and tests
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
24
vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/ClientRequest.json
generated
vendored
|
|
@ -4036,30 +4036,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/ServerNotification.json
generated
vendored
|
|
@ -6895,30 +6895,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -9714,30 +9714,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -5140,30 +5140,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
@ -14792,27 +14768,45 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"InitializeCapabilities": {
|
||||
"description": "Client-declared capabilities negotiated during initialize.",
|
||||
"FuzzyFileSearchParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "FuzzyFileSearchParams",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"query",
|
||||
"roots"
|
||||
],
|
||||
"properties": {
|
||||
"experimentalApi": {
|
||||
"description": "Opt into receiving experimental API methods and fields.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"optOutNotificationMethods": {
|
||||
"description": "Exact notification method names that should be suppressed for this connection (for example `thread/started`).",
|
||||
"cancellationToken": {
|
||||
"type": [
|
||||
"array",
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
]
|
||||
},
|
||||
"query": {
|
||||
"type": "string"
|
||||
},
|
||||
"roots": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"FuzzyFileSearchSessionCompletedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "FuzzyFileSearchSessionCompletedNotification",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sessionId"
|
||||
],
|
||||
"properties": {
|
||||
"sessionId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"InitializeParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "InitializeParams",
|
||||
|
|
@ -14836,15 +14830,30 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"FuzzyFileSearchSessionCompletedNotification": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "FuzzyFileSearchSessionCompletedNotification",
|
||||
"FuzzyFileSearchMatchType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"file",
|
||||
"directory"
|
||||
]
|
||||
},
|
||||
"ClientInfo": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sessionId"
|
||||
"name",
|
||||
"version"
|
||||
],
|
||||
"properties": {
|
||||
"sessionId": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
|
@ -14873,60 +14882,27 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"FuzzyFileSearchMatchType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"file",
|
||||
"directory"
|
||||
]
|
||||
},
|
||||
"FuzzyFileSearchParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "FuzzyFileSearchParams",
|
||||
"InitializeCapabilities": {
|
||||
"description": "Client-declared capabilities negotiated during initialize.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"query",
|
||||
"roots"
|
||||
],
|
||||
"properties": {
|
||||
"cancellationToken": {
|
||||
"experimentalApi": {
|
||||
"description": "Opt into receiving experimental API methods and fields.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"optOutNotificationMethods": {
|
||||
"description": "Exact notification method names that should be suppressed for this connection (for example `thread/started`).",
|
||||
"type": [
|
||||
"string",
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"query": {
|
||||
"type": "string"
|
||||
},
|
||||
"roots": {
|
||||
"type": "array",
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ClientInfo": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"version"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"FuzzyFileSearchResult": {
|
||||
"description": "Superset of [`codex_file_search::FileMatch`]",
|
||||
"type": "object",
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json
generated
vendored
|
|
@ -1235,30 +1235,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json
generated
vendored
|
|
@ -1235,30 +1235,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json
generated
vendored
|
|
@ -1470,30 +1470,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json
generated
vendored
|
|
@ -3905,30 +3905,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json
generated
vendored
|
|
@ -3340,30 +3340,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -3323,30 +3323,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json
generated
vendored
|
|
@ -3323,30 +3323,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json
generated
vendored
|
|
@ -3905,30 +3905,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json
generated
vendored
|
|
@ -3328,30 +3328,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json
generated
vendored
|
|
@ -3905,30 +3905,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json
generated
vendored
|
|
@ -3323,30 +3323,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json
generated
vendored
|
|
@ -1482,30 +1482,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json
generated
vendored
|
|
@ -3323,30 +3323,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json
generated
vendored
|
|
@ -1469,30 +1469,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json
generated
vendored
|
|
@ -861,30 +861,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json
generated
vendored
|
|
@ -1465,30 +1465,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json
generated
vendored
|
|
@ -1469,30 +1469,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json
generated
vendored
24
vendor/codex/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json
generated
vendored
|
|
@ -135,30 +135,6 @@
|
|||
},
|
||||
"title": "LocalImageUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"path",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"skill"
|
||||
],
|
||||
"title": "SkillUserInputType"
|
||||
}
|
||||
},
|
||||
"title": "SkillUserInput"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
2
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/UserInput.ts
generated
vendored
2
vendor/codex/codex-rs/app-server-protocol/schema/typescript/v2/UserInput.ts
generated
vendored
|
|
@ -7,4 +7,4 @@ export type UserInput = { "type": "text", text: string,
|
|||
/**
|
||||
* UI-defined spans within `text` used to render or persist special elements.
|
||||
*/
|
||||
text_elements: Array<TextElement>, } | { "type": "image", url: string, } | { "type": "localImage", path: string, } | { "type": "skill", name: string, path: string, } | { "type": "mention", name: string, path: string, };
|
||||
text_elements: Array<TextElement>, } | { "type": "image", url: string, } | { "type": "localImage", path: string, } | { "type": "mention", name: string, path: string, };
|
||||
|
|
|
|||
|
|
@ -6171,10 +6171,6 @@ pub enum UserInput {
|
|||
LocalImage {
|
||||
path: PathBuf,
|
||||
},
|
||||
Skill {
|
||||
name: String,
|
||||
path: PathBuf,
|
||||
},
|
||||
Mention {
|
||||
name: String,
|
||||
path: String,
|
||||
|
|
@ -6193,7 +6189,6 @@ impl UserInput {
|
|||
},
|
||||
UserInput::Image { url } => CoreUserInput::Image { image_url: url },
|
||||
UserInput::LocalImage { path } => CoreUserInput::LocalImage { path },
|
||||
UserInput::Skill { name, path } => CoreUserInput::Skill { name, path },
|
||||
UserInput::Mention { name, path } => CoreUserInput::Mention { name, path },
|
||||
}
|
||||
}
|
||||
|
|
@ -6211,7 +6206,6 @@ impl From<CoreUserInput> for UserInput {
|
|||
},
|
||||
CoreUserInput::Image { image_url } => UserInput::Image { url: image_url },
|
||||
CoreUserInput::LocalImage { path } => UserInput::LocalImage { path },
|
||||
CoreUserInput::Skill { name, path } => UserInput::Skill { name, path },
|
||||
CoreUserInput::Mention { name, path } => UserInput::Mention { name, path },
|
||||
_ => unreachable!("unsupported user input variant"),
|
||||
}
|
||||
|
|
@ -6222,10 +6216,7 @@ impl UserInput {
|
|||
pub fn text_char_count(&self) -> usize {
|
||||
match self {
|
||||
UserInput::Text { text, .. } => text.chars().count(),
|
||||
UserInput::Image { .. }
|
||||
| UserInput::LocalImage { .. }
|
||||
| UserInput::Skill { .. }
|
||||
| UserInput::Mention { .. } => 0,
|
||||
UserInput::Image { .. } | UserInput::LocalImage { .. } | UserInput::Mention { .. } => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10401,10 +10392,6 @@ mod tests {
|
|||
CoreUserInput::LocalImage {
|
||||
path: PathBuf::from("local/image.png"),
|
||||
},
|
||||
CoreUserInput::Skill {
|
||||
name: "skill-creator".to_string(),
|
||||
path: PathBuf::from("/repo/.codex/skills/skill-creator/SKILL.md"),
|
||||
},
|
||||
CoreUserInput::Mention {
|
||||
name: "Docs MCP".to_string(),
|
||||
path: "mcp://docs".to_string(),
|
||||
|
|
@ -10427,10 +10414,6 @@ mod tests {
|
|||
UserInput::LocalImage {
|
||||
path: PathBuf::from("local/image.png"),
|
||||
},
|
||||
UserInput::Skill {
|
||||
name: "skill-creator".to_string(),
|
||||
path: PathBuf::from("/repo/.codex/skills/skill-creator/SKILL.md"),
|
||||
},
|
||||
UserInput::Mention {
|
||||
name: "Docs MCP".to_string(),
|
||||
path: "mcp://docs".to_string(),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use codex_analytics::SkillInvocation;
|
|||
use codex_analytics::TrackEventsContext;
|
||||
use codex_exec_server::LOCAL_FS;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
|
||||
const TOOL_MENTION_SIGIL: char = '$';
|
||||
|
|
@ -101,19 +100,18 @@ fn emit_skill_injected_metric(
|
|||
);
|
||||
}
|
||||
|
||||
/// Collect explicitly mentioned skills from structured and text mentions.
|
||||
/// Collect explicitly mentioned skills from text mentions.
|
||||
///
|
||||
/// Structured `UserInput::Skill` selections are resolved first by path against
|
||||
/// enabled skills. Text inputs are then scanned to extract `$skill-name` tokens, and we
|
||||
/// iterate `skills` in their existing order to preserve prior ordering semantics.
|
||||
/// Text inputs are scanned to extract `$skill-name` tokens, and we iterate `skills` in
|
||||
/// their existing order to preserve prior ordering semantics.
|
||||
/// Explicit links are resolved by path and plain names are only used when the match
|
||||
/// is unambiguous.
|
||||
///
|
||||
/// Complexity: `O(T + (N_s + N_t) * S)` time, `O(S + M)` space, where:
|
||||
/// `S` = number of skills, `T` = total text length, `N_s` = number of structured skill inputs,
|
||||
/// `N_t` = number of text inputs, `M` = max mentions parsed from a single text input.
|
||||
/// Complexity: `O(T + N * S)` time, `O(S + M)` space, where:
|
||||
/// `S` = number of skills, `T` = total text length, `N` = number of text inputs,
|
||||
/// and `M` = max mentions parsed from a single text input.
|
||||
pub fn collect_explicit_skill_mentions(
|
||||
inputs: &[UserInput],
|
||||
inputs: &[codex_protocol::user_input::UserInput],
|
||||
skills: &[SkillMetadata],
|
||||
disabled_paths: &HashSet<AbsolutePathBuf>,
|
||||
connector_slug_counts: &HashMap<String, usize>,
|
||||
|
|
@ -129,37 +127,12 @@ pub fn collect_explicit_skill_mentions(
|
|||
let mut selected: Vec<SkillMetadata> = Vec::new();
|
||||
let mut seen_names: HashSet<String> = HashSet::new();
|
||||
let mut seen_paths: HashSet<AbsolutePathBuf> = HashSet::new();
|
||||
let mut blocked_plain_names: HashSet<String> = HashSet::new();
|
||||
|
||||
for input in inputs {
|
||||
if let UserInput::Skill { name, path } = input {
|
||||
blocked_plain_names.insert(name.clone());
|
||||
let Ok(path) = AbsolutePathBuf::relative_to_current_dir(path) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if selection_context.disabled_paths.contains(&path) || seen_paths.contains(&path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(skill) = selection_context
|
||||
.skills
|
||||
.iter()
|
||||
.find(|skill| skill.path_to_skills_md == path)
|
||||
{
|
||||
seen_paths.insert(skill.path_to_skills_md.clone());
|
||||
seen_names.insert(skill.name.clone());
|
||||
selected.push(skill.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for input in inputs {
|
||||
if let UserInput::Text { text, .. } = input {
|
||||
if let codex_protocol::user_input::UserInput::Text { text, .. } = input {
|
||||
let mentioned_names = extract_tool_mentions(text);
|
||||
select_skills_from_mentions(
|
||||
&selection_context,
|
||||
&blocked_plain_names,
|
||||
&mentioned_names,
|
||||
&mut seen_names,
|
||||
&mut seen_paths,
|
||||
|
|
@ -300,7 +273,6 @@ pub fn extract_tool_mentions_with_sigil(text: &str, sigil: char) -> ToolMentions
|
|||
/// Select mentioned skills while preserving the order of `skills`.
|
||||
fn select_skills_from_mentions(
|
||||
selection_context: &SkillSelectionContext<'_>,
|
||||
blocked_plain_names: &HashSet<String>,
|
||||
mentions: &ToolMentions<'_>,
|
||||
seen_names: &mut HashSet<String>,
|
||||
seen_paths: &mut HashSet<AbsolutePathBuf>,
|
||||
|
|
@ -342,9 +314,6 @@ fn select_skills_from_mentions(
|
|||
continue;
|
||||
}
|
||||
|
||||
if blocked_plain_names.contains(skill.name.as_str()) {
|
||||
continue;
|
||||
}
|
||||
if !mentions.plain_names.contains(skill.name.as_str()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use super::*;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_absolute_path::test_support::PathBufExt;
|
||||
use codex_utils_absolute_path::test_support::test_path_buf;
|
||||
|
|
@ -146,71 +147,6 @@ fn collect_explicit_skill_mentions_text_respects_skill_order() {
|
|||
assert_eq!(selected, vec![beta, alpha]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_explicit_skill_mentions_prioritizes_structured_inputs() {
|
||||
let alpha = make_skill("alpha-skill", "/tmp/alpha");
|
||||
let beta = make_skill("beta-skill", "/tmp/beta");
|
||||
let skills = vec![alpha.clone(), beta.clone()];
|
||||
let inputs = vec![
|
||||
UserInput::Text {
|
||||
text: "please run $alpha-skill".to_string(),
|
||||
text_elements: Vec::new(),
|
||||
},
|
||||
UserInput::Skill {
|
||||
name: "beta-skill".to_string(),
|
||||
path: test_path_buf("/tmp/beta"),
|
||||
},
|
||||
];
|
||||
let connector_counts = HashMap::new();
|
||||
|
||||
let selected = collect_mentions(&inputs, &skills, &HashSet::new(), &connector_counts);
|
||||
|
||||
assert_eq!(selected, vec![beta, alpha]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_explicit_skill_mentions_skips_invalid_structured_and_blocks_plain_fallback() {
|
||||
let alpha = make_skill("alpha-skill", "/tmp/alpha");
|
||||
let skills = vec![alpha];
|
||||
let inputs = vec![
|
||||
UserInput::Text {
|
||||
text: "please run $alpha-skill".to_string(),
|
||||
text_elements: Vec::new(),
|
||||
},
|
||||
UserInput::Skill {
|
||||
name: "alpha-skill".to_string(),
|
||||
path: test_path_buf("/tmp/missing"),
|
||||
},
|
||||
];
|
||||
let connector_counts = HashMap::new();
|
||||
|
||||
let selected = collect_mentions(&inputs, &skills, &HashSet::new(), &connector_counts);
|
||||
|
||||
assert_eq!(selected, Vec::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_explicit_skill_mentions_skips_disabled_structured_and_blocks_plain_fallback() {
|
||||
let alpha = make_skill("alpha-skill", "/tmp/alpha");
|
||||
let skills = vec![alpha];
|
||||
let inputs = vec![
|
||||
UserInput::Text {
|
||||
text: "please run $alpha-skill".to_string(),
|
||||
text_elements: Vec::new(),
|
||||
},
|
||||
UserInput::Skill {
|
||||
name: "alpha-skill".to_string(),
|
||||
path: test_path_buf("/tmp/alpha"),
|
||||
},
|
||||
];
|
||||
let disabled = HashSet::from([test_path_buf("/tmp/alpha").abs()]);
|
||||
let connector_counts = HashMap::new();
|
||||
|
||||
let selected = collect_mentions(&inputs, &skills, &disabled, &connector_counts);
|
||||
|
||||
assert_eq!(selected, Vec::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_explicit_skill_mentions_dedupes_by_path() {
|
||||
let alpha = make_skill("alpha-skill", "/tmp/alpha");
|
||||
|
|
|
|||
|
|
@ -1202,7 +1202,6 @@ pub(crate) fn render_input_preview(initial_operation: &Op) -> String {
|
|||
UserInput::Text { text, .. } => text.clone(),
|
||||
UserInput::Image { .. } => "[image]".to_string(),
|
||||
UserInput::LocalImage { path } => format!("[local_image:{}]", path.display()),
|
||||
UserInput::Skill { name, path } => format!("[skill:${name}]({})", path.display()),
|
||||
UserInput::Mention { name, path } => format!("[mention:${name}]({path})"),
|
||||
_ => "[input]".to_string(),
|
||||
})
|
||||
|
|
|
|||
2
vendor/codex/codex-rs/protocol/src/models.rs
vendored
2
vendor/codex/codex-rs/protocol/src/models.rs
vendored
|
|
@ -944,7 +944,7 @@ impl From<Vec<UserInput>> for ResponseInputItem {
|
|||
Err(err) => vec![local_image_error_placeholder(&path, err)],
|
||||
}
|
||||
}
|
||||
UserInput::Skill { .. } | UserInput::Mention { .. } => Vec::new(), // Tool bodies are injected later in core
|
||||
UserInput::Mention { .. } => Vec::new(),
|
||||
})
|
||||
.collect::<Vec<ContentItem>>(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,15 +27,10 @@ pub enum UserInput {
|
|||
/// `Image` variant (base64 data URL) during request serialization.
|
||||
LocalImage { path: std::path::PathBuf },
|
||||
|
||||
/// Skill selected by the user (name + path to SKILL.md).
|
||||
Skill {
|
||||
name: String,
|
||||
path: std::path::PathBuf,
|
||||
},
|
||||
/// Explicit structured mention selected by the user.
|
||||
///
|
||||
/// `path` identifies the exact mention target, for example
|
||||
/// `mcp://<server-name>` or a path to `SKILL.md`.
|
||||
/// `mcp://<server-name>`.
|
||||
Mention { name: String, path: String },
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//! It is responsible for:
|
||||
//!
|
||||
//! - Editing the input buffer (a [`TextArea`]), including placeholder "elements" for attachments.
|
||||
//! - Routing keys to the active popup (slash commands, file search, skill mentions).
|
||||
//! - Routing keys to the active popup (slash commands and file search).
|
||||
//! - Promoting typed slash commands into atomic elements when the command name is completed.
|
||||
//! - Handling submit vs newline on Enter.
|
||||
//! - Turning raw key streams into explicit paste operations on platforms where terminals
|
||||
|
|
@ -177,8 +177,6 @@ use super::footer::toggle_shortcut_mode;
|
|||
use super::footer::uses_passive_footer_status_layout;
|
||||
use super::paste_burst::CharDecision;
|
||||
use super::paste_burst::PasteBurst;
|
||||
use super::skill_popup::MentionItem;
|
||||
use super::skill_popup::SkillPopup;
|
||||
use super::slash_commands;
|
||||
use super::slash_commands::BuiltinCommandFlags;
|
||||
use crate::bottom_pane::paste_burst::FlushResult;
|
||||
|
|
@ -205,12 +203,8 @@ use crate::bottom_pane::textarea::TextAreaState;
|
|||
use crate::clipboard_paste::normalize_pasted_path;
|
||||
use crate::clipboard_paste::pasted_image_format;
|
||||
use crate::history_cell;
|
||||
use crate::skills_helpers::skill_display_name;
|
||||
use crate::tui::FrameRequester;
|
||||
use crate::ui_consts::LIVE_PREFIX_COLS;
|
||||
#[cfg(test)]
|
||||
use codex_core_skills::model::SkillInterface;
|
||||
use codex_core_skills::model::SkillMetadata;
|
||||
use codex_file_search::FileMatch;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
|
@ -357,8 +351,6 @@ pub(crate) struct ChatComposer {
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
next_element_id: u64,
|
||||
context_window_used_tokens: Option<i64>,
|
||||
skills: Option<Vec<SkillMetadata>>,
|
||||
dismissed_mention_popup_token: Option<String>,
|
||||
mention_bindings: HashMap<u64, ComposerMentionBinding>,
|
||||
recent_submission_mention_bindings: Vec<MentionBinding>,
|
||||
collaboration_modes_enabled: bool,
|
||||
|
|
@ -407,7 +399,6 @@ enum ActivePopup {
|
|||
None,
|
||||
Command(CommandPopup),
|
||||
File(FileSearchPopup),
|
||||
Skill(SkillPopup),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
|
@ -496,8 +487,6 @@ impl ChatComposer {
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
next_element_id: 0,
|
||||
context_window_used_tokens: None,
|
||||
skills: None,
|
||||
dismissed_mention_popup_token: None,
|
||||
mention_bindings: HashMap::new(),
|
||||
recent_submission_mention_bindings: Vec::new(),
|
||||
collaboration_modes_enabled: false,
|
||||
|
|
@ -535,11 +524,6 @@ impl ChatComposer {
|
|||
self.frame_requester = Some(frame_requester);
|
||||
}
|
||||
|
||||
pub fn set_skill_mentions(&mut self, skills: Option<Vec<SkillMetadata>>) {
|
||||
self.skills = skills;
|
||||
self.sync_popups();
|
||||
}
|
||||
|
||||
/// Toggle composer-side image paste handling.
|
||||
///
|
||||
/// This only affects whether image-like paste content is converted into attachments; the
|
||||
|
|
@ -627,9 +611,6 @@ impl ChatComposer {
|
|||
Constraint::Max(popup.calculate_required_height(area.width))
|
||||
}
|
||||
ActivePopup::File(popup) => Constraint::Max(popup.calculate_required_height()),
|
||||
ActivePopup::Skill(popup) => {
|
||||
Constraint::Max(popup.calculate_required_height(area.width))
|
||||
}
|
||||
ActivePopup::None => Constraint::Max(footer_total_height),
|
||||
};
|
||||
let [composer_rect, popup_rect] =
|
||||
|
|
@ -1395,7 +1376,6 @@ impl ChatComposer {
|
|||
let result = match &mut self.active_popup {
|
||||
ActivePopup::Command(_) => self.handle_key_event_with_slash_popup(key_event),
|
||||
ActivePopup::File(_) => self.handle_key_event_with_file_popup(key_event),
|
||||
ActivePopup::Skill(_) => self.handle_key_event_with_skill_popup(key_event),
|
||||
ActivePopup::None => self.handle_key_event_without_popup(key_event),
|
||||
};
|
||||
// Update (or hide/show) popup after processing the key.
|
||||
|
|
@ -1755,79 +1735,6 @@ impl ChatComposer {
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_key_event_with_skill_popup(&mut self, key_event: KeyEvent) -> (InputResult, bool) {
|
||||
if self.handle_shortcut_overlay_key(&key_event) {
|
||||
return (InputResult::None, true);
|
||||
}
|
||||
self.footer_mode = reset_mode_after_activity(self.footer_mode);
|
||||
|
||||
let ActivePopup::Skill(popup) = &mut self.active_popup else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
let mut selected_mention: Option<(String, Option<String>)> = None;
|
||||
let mut close_popup = false;
|
||||
|
||||
let result = match key_event {
|
||||
KeyEvent {
|
||||
code: KeyCode::Up, ..
|
||||
}
|
||||
| KeyEvent {
|
||||
code: KeyCode::Char('p'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
..
|
||||
} => {
|
||||
popup.move_up();
|
||||
(InputResult::None, true)
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Down,
|
||||
..
|
||||
}
|
||||
| KeyEvent {
|
||||
code: KeyCode::Char('n'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
..
|
||||
} => {
|
||||
popup.move_down();
|
||||
(InputResult::None, true)
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Esc, ..
|
||||
} => {
|
||||
if let Some(tok) = self.current_mention_token() {
|
||||
self.dismissed_mention_popup_token = Some(tok);
|
||||
}
|
||||
self.active_popup = ActivePopup::None;
|
||||
(InputResult::None, true)
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Tab, ..
|
||||
}
|
||||
| KeyEvent {
|
||||
code: KeyCode::Enter,
|
||||
modifiers: KeyModifiers::NONE,
|
||||
..
|
||||
} => {
|
||||
if let Some(mention) = popup.selected_mention() {
|
||||
selected_mention = Some((mention.insert_text.clone(), mention.path.clone()));
|
||||
}
|
||||
close_popup = true;
|
||||
(InputResult::None, true)
|
||||
}
|
||||
input => self.handle_input_basic(input),
|
||||
};
|
||||
|
||||
if close_popup {
|
||||
if let Some((insert_text, path)) = selected_mention {
|
||||
self.insert_selected_mention(&insert_text, path.as_deref());
|
||||
}
|
||||
self.active_popup = ActivePopup::None;
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
fn is_image_path(path: &str) -> bool {
|
||||
let lower = path.to_ascii_lowercase();
|
||||
lower.ends_with(".png")
|
||||
|
|
@ -1942,18 +1849,6 @@ impl ChatComposer {
|
|||
(rebuilt, rebuilt_elements)
|
||||
}
|
||||
|
||||
pub fn skills(&self) -> Option<&Vec<SkillMetadata>> {
|
||||
self.skills.as_ref()
|
||||
}
|
||||
|
||||
fn mentions_enabled(&self) -> bool {
|
||||
let skills_ready = self
|
||||
.skills
|
||||
.as_ref()
|
||||
.is_some_and(|skills| !skills.is_empty());
|
||||
skills_ready
|
||||
}
|
||||
|
||||
/// Extract a token prefixed with `prefix` under the cursor, if any.
|
||||
///
|
||||
/// The returned string **does not** include the prefix.
|
||||
|
|
@ -2079,13 +1974,6 @@ impl ChatComposer {
|
|||
Self::current_prefixed_token(textarea, '@', /*allow_empty*/ false)
|
||||
}
|
||||
|
||||
fn current_mention_token(&self) -> Option<String> {
|
||||
if !self.mentions_enabled() {
|
||||
return None;
|
||||
}
|
||||
Self::current_prefixed_token(&self.textarea, '$', /*allow_empty*/ true)
|
||||
}
|
||||
|
||||
/// Replace the active `@token` (the one under the cursor) with `path`.
|
||||
///
|
||||
/// The algorithm mirrors `current_at_token` so replacement works no matter
|
||||
|
|
@ -2132,51 +2020,6 @@ impl ChatComposer {
|
|||
self.textarea.set_cursor(new_cursor);
|
||||
}
|
||||
|
||||
fn insert_selected_mention(&mut self, insert_text: &str, path: Option<&str>) {
|
||||
let cursor_offset = self.textarea.cursor();
|
||||
let text = self.textarea.text();
|
||||
let safe_cursor = Self::clamp_to_char_boundary(text, cursor_offset);
|
||||
|
||||
let before_cursor = &text[..safe_cursor];
|
||||
let after_cursor = &text[safe_cursor..];
|
||||
|
||||
let start_idx = before_cursor
|
||||
.char_indices()
|
||||
.rfind(|(_, c)| c.is_whitespace())
|
||||
.map(|(idx, c)| idx + c.len_utf8())
|
||||
.unwrap_or(0);
|
||||
|
||||
let end_rel_idx = after_cursor
|
||||
.char_indices()
|
||||
.find(|(_, c)| c.is_whitespace())
|
||||
.map(|(idx, _)| idx)
|
||||
.unwrap_or(after_cursor.len());
|
||||
let end_idx = safe_cursor + end_rel_idx;
|
||||
|
||||
// Remove the active token and insert the selected mention as an atomic element.
|
||||
self.textarea.replace_range(start_idx..end_idx, "");
|
||||
self.textarea.set_cursor(start_idx);
|
||||
let id = self.textarea.insert_element(insert_text);
|
||||
|
||||
if let (Some(path), Some(mention)) =
|
||||
(path, Self::mention_name_from_insert_text(insert_text))
|
||||
{
|
||||
self.mention_bindings.insert(
|
||||
id,
|
||||
ComposerMentionBinding {
|
||||
mention,
|
||||
path: path.to_string(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
self.textarea.insert_str(" ");
|
||||
let new_cursor = start_idx
|
||||
.saturating_add(insert_text.len())
|
||||
.saturating_add(1);
|
||||
self.textarea.set_cursor(new_cursor);
|
||||
}
|
||||
|
||||
fn mention_name_from_insert_text(insert_text: &str) -> Option<String> {
|
||||
let name = insert_text.strip_prefix('$')?;
|
||||
if name.is_empty() {
|
||||
|
|
@ -3199,7 +3042,6 @@ impl ChatComposer {
|
|||
}
|
||||
self.active_popup = ActivePopup::None;
|
||||
self.dismissed_file_popup_token = None;
|
||||
self.dismissed_mention_popup_token = None;
|
||||
return;
|
||||
}
|
||||
if !self.popups_enabled() {
|
||||
|
|
@ -3221,12 +3063,8 @@ impl ChatComposer {
|
|||
self.active_popup = ActivePopup::None;
|
||||
return;
|
||||
}
|
||||
let mention_token = self.current_mention_token();
|
||||
|
||||
let allow_command_popup = self.slash_commands_enabled()
|
||||
&& !self.is_bash_mode
|
||||
&& file_token.is_none()
|
||||
&& mention_token.is_none();
|
||||
let allow_command_popup =
|
||||
self.slash_commands_enabled() && !self.is_bash_mode && file_token.is_none();
|
||||
self.sync_command_popup(allow_command_popup);
|
||||
|
||||
if matches!(self.active_popup, ActivePopup::Command(_)) {
|
||||
|
|
@ -3236,21 +3074,9 @@ impl ChatComposer {
|
|||
self.current_file_query = None;
|
||||
}
|
||||
self.dismissed_file_popup_token = None;
|
||||
self.dismissed_mention_popup_token = None;
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(token) = mention_token {
|
||||
if self.current_file_query.is_some() {
|
||||
self.app_event_tx
|
||||
.send(AppEvent::StartFileSearch(String::new()));
|
||||
self.current_file_query = None;
|
||||
}
|
||||
self.sync_mention_popup(token);
|
||||
return;
|
||||
}
|
||||
self.dismissed_mention_popup_token = None;
|
||||
|
||||
if let Some(token) = file_token {
|
||||
self.sync_file_search_popup(token);
|
||||
return;
|
||||
|
|
@ -3262,10 +3088,7 @@ impl ChatComposer {
|
|||
self.current_file_query = None;
|
||||
}
|
||||
self.dismissed_file_popup_token = None;
|
||||
if matches!(
|
||||
self.active_popup,
|
||||
ActivePopup::File(_) | ActivePopup::Skill(_)
|
||||
) {
|
||||
if matches!(self.active_popup, ActivePopup::File(_)) {
|
||||
self.active_popup = ActivePopup::None;
|
||||
}
|
||||
}
|
||||
|
|
@ -3482,57 +3305,6 @@ impl ChatComposer {
|
|||
self.dismissed_file_popup_token = None;
|
||||
}
|
||||
|
||||
fn sync_mention_popup(&mut self, query: String) {
|
||||
if self.dismissed_mention_popup_token.as_ref() == Some(&query) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mentions = self.mention_items();
|
||||
if mentions.is_empty() {
|
||||
self.active_popup = ActivePopup::None;
|
||||
return;
|
||||
}
|
||||
|
||||
match &mut self.active_popup {
|
||||
ActivePopup::Skill(popup) => {
|
||||
popup.set_query(&query);
|
||||
popup.set_mentions(mentions);
|
||||
}
|
||||
_ => {
|
||||
let mut popup = SkillPopup::new(mentions);
|
||||
popup.set_query(&query);
|
||||
self.active_popup = ActivePopup::Skill(popup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mention_items(&self) -> Vec<MentionItem> {
|
||||
let mut mentions = Vec::new();
|
||||
if let Some(skills) = self.skills.as_ref() {
|
||||
for skill in skills {
|
||||
let display_name = skill_display_name(skill);
|
||||
let description = skill_description(skill);
|
||||
let skill_name = skill.name.clone();
|
||||
let search_terms = if display_name == skill.name {
|
||||
vec![skill_name.clone()]
|
||||
} else {
|
||||
vec![skill_name.clone(), display_name.clone()]
|
||||
};
|
||||
mentions.push(MentionItem {
|
||||
display_name,
|
||||
description,
|
||||
insert_text: format!("${skill_name}"),
|
||||
search_terms,
|
||||
path: Some(skill.path_to_skills_md.to_string_lossy().into_owned()),
|
||||
category_tag: Some("[Skill]".to_string()),
|
||||
sort_rank: 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mentions
|
||||
}
|
||||
|
||||
fn set_has_focus(&mut self, has_focus: bool) {
|
||||
self.has_focus = has_focus;
|
||||
}
|
||||
|
|
@ -3625,17 +3397,6 @@ impl ChatComposer {
|
|||
}
|
||||
}
|
||||
|
||||
fn skill_description(skill: &SkillMetadata) -> Option<String> {
|
||||
let description = skill
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.short_description.as_deref())
|
||||
.or(skill.short_description.as_deref())
|
||||
.unwrap_or(&skill.description);
|
||||
let trimmed = description.trim();
|
||||
(!trimmed.is_empty()).then(|| trimmed.to_string())
|
||||
}
|
||||
|
||||
fn is_mention_name_char(byte: u8) -> bool {
|
||||
matches!(byte, b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'_' | b'-')
|
||||
}
|
||||
|
|
@ -3714,7 +3475,6 @@ impl Renderable for ChatComposer {
|
|||
ActivePopup::None => footer_total_height,
|
||||
ActivePopup::Command(c) => c.calculate_required_height(width),
|
||||
ActivePopup::File(c) => c.calculate_required_height(),
|
||||
ActivePopup::Skill(c) => c.calculate_required_height(width),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3734,9 +3494,6 @@ impl ChatComposer {
|
|||
ActivePopup::File(popup) => {
|
||||
popup.render_ref(popup_rect, buf);
|
||||
}
|
||||
ActivePopup::Skill(popup) => {
|
||||
popup.render_ref(popup_rect, buf);
|
||||
}
|
||||
ActivePopup::None => {
|
||||
let footer_props = self.footer_props();
|
||||
let show_cycle_hint =
|
||||
|
|
@ -5108,41 +4865,6 @@ mod tests {
|
|||
assert_ne!(composer.footer_mode, FooterMode::ShortcutOverlay);
|
||||
}
|
||||
#[test]
|
||||
fn set_skill_mentions_refreshes_open_mention_popup() {
|
||||
let (tx, _rx) = unbounded_channel::<AppEvent>();
|
||||
let sender = AppEventSender::new(tx);
|
||||
let mut composer = ChatComposer::new(
|
||||
/*has_input_focus*/ true,
|
||||
sender,
|
||||
/*enhanced_keys_supported*/ false,
|
||||
"Ask Codex to do anything".to_string(),
|
||||
/*disable_paste_burst*/ false,
|
||||
);
|
||||
composer.set_text_content("$".to_string(), Vec::new(), Vec::new());
|
||||
assert!(matches!(composer.active_popup, ActivePopup::None));
|
||||
|
||||
let skill_path = test_path_buf("/tmp/skill/SKILL.md").abs();
|
||||
composer.set_skill_mentions(Some(vec![SkillMetadata {
|
||||
name: "codex".to_string(),
|
||||
description: "Primary personal Codex repo skill.".to_string(),
|
||||
short_description: None,
|
||||
interface: None,
|
||||
dependencies: None,
|
||||
policy: None,
|
||||
path_to_skills_md: skill_path.clone(),
|
||||
scope: codex_protocol::protocol::SkillScope::User,
|
||||
}]));
|
||||
|
||||
let ActivePopup::Skill(popup) = &composer.active_popup else {
|
||||
panic!("expected mention popup to open after skills update");
|
||||
};
|
||||
let mention = popup
|
||||
.selected_mention()
|
||||
.expect("expected skill mention to be selected");
|
||||
assert_eq!(mention.insert_text, "$codex".to_string());
|
||||
assert_eq!(mention.path, Some(skill_path.display().to_string()));
|
||||
}
|
||||
#[test]
|
||||
fn shortcut_overlay_persists_while_task_running() {
|
||||
use crossterm::event::KeyCode;
|
||||
use crossterm::event::KeyEvent;
|
||||
|
|
@ -7273,7 +6995,7 @@ mod tests {
|
|||
|
||||
let mention_bindings = vec![MentionBinding {
|
||||
mention: "figma".to_string(),
|
||||
path: "/tmp/user/figma/SKILL.md".to_string(),
|
||||
path: "mcp://figma".to_string(),
|
||||
}];
|
||||
composer.set_text_content_with_mention_bindings(
|
||||
"$figma please".to_string(),
|
||||
|
|
|
|||
84
vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs
vendored
84
vendor/codex/codex-rs/tui/src/bottom_pane/mod.rs
vendored
|
|
@ -28,7 +28,6 @@ use crate::render::renderable::RenderableItem;
|
|||
use crate::tui::FrameRequester;
|
||||
use bottom_pane_view::BottomPaneView;
|
||||
use bottom_pane_view::ViewCompletion;
|
||||
use codex_core_skills::model::SkillMetadata;
|
||||
use codex_features::Features;
|
||||
use codex_file_search::FileMatch;
|
||||
use codex_protocol::request_user_input::RequestUserInputEvent;
|
||||
|
|
@ -66,7 +65,7 @@ pub(crate) struct LocalImageAttachment {
|
|||
pub(crate) struct MentionBinding {
|
||||
/// Mention token text without the leading `$`.
|
||||
pub(crate) mention: String,
|
||||
/// Canonical mention target (for example `mcp://...` or absolute SKILL.md path).
|
||||
/// Canonical mention target (for example `mcp://...`).
|
||||
pub(crate) path: String,
|
||||
}
|
||||
mod chat_composer;
|
||||
|
|
@ -79,7 +78,6 @@ mod footer;
|
|||
mod list_selection_view;
|
||||
mod memories_settings_view;
|
||||
pub(crate) mod prompt_args;
|
||||
mod skill_popup;
|
||||
pub(crate) mod slash_commands;
|
||||
pub(crate) use footer::CollaborationModeIndicator;
|
||||
pub(crate) use list_selection_view::SelectionViewParams;
|
||||
|
|
@ -199,7 +197,6 @@ pub(crate) struct BottomPaneParams {
|
|||
pub(crate) placeholder_text: String,
|
||||
pub(crate) disable_paste_burst: bool,
|
||||
pub(crate) animations_enabled: bool,
|
||||
pub(crate) skills: Option<Vec<SkillMetadata>>,
|
||||
}
|
||||
|
||||
impl BottomPane {
|
||||
|
|
@ -212,7 +209,6 @@ impl BottomPane {
|
|||
placeholder_text,
|
||||
disable_paste_burst,
|
||||
animations_enabled,
|
||||
skills,
|
||||
} = params;
|
||||
let mut composer = ChatComposer::new(
|
||||
has_input_focus,
|
||||
|
|
@ -222,7 +218,6 @@ impl BottomPane {
|
|||
disable_paste_burst,
|
||||
);
|
||||
composer.set_frame_requester(frame_requester.clone());
|
||||
composer.set_skill_mentions(skills);
|
||||
Self {
|
||||
composer,
|
||||
view_stack: Vec::new(),
|
||||
|
|
@ -243,11 +238,6 @@ impl BottomPane {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_skills(&mut self, skills: Option<Vec<SkillMetadata>>) {
|
||||
self.composer.set_skill_mentions(skills);
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
/// Update image-paste behavior for the active composer and repaint immediately.
|
||||
///
|
||||
/// Callers use this to keep composer affordances aligned with model capabilities.
|
||||
|
|
@ -340,10 +330,6 @@ impl BottomPane {
|
|||
self.status.as_ref()
|
||||
}
|
||||
|
||||
pub fn skills(&self) -> Option<&Vec<SkillMetadata>> {
|
||||
self.composer.skills()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn context_window_percent(&self) -> Option<i64> {
|
||||
self.context_window_percent
|
||||
|
|
@ -1264,7 +1250,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1364,7 +1349,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: true,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
pane.push_approval_request(exec_request(), &features);
|
||||
assert_eq!(CancellationEvent::Handled, pane.on_ctrl_c());
|
||||
|
|
@ -1384,7 +1368,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: true,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
pane.insert_str("draft");
|
||||
|
||||
|
|
@ -1412,7 +1395,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
// Create an approval modal (active view).
|
||||
|
|
@ -1529,7 +1511,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
// Start a running task so the status indicator is active above the composer.
|
||||
|
|
@ -1596,7 +1577,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
// Begin a task: show initial status.
|
||||
|
|
@ -1623,7 +1603,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
// Activate spinner (status view replaces composer) with no live ring.
|
||||
|
|
@ -1654,7 +1633,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1677,7 +1655,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1706,7 +1683,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1743,7 +1719,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1775,7 +1750,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1806,7 +1780,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_remote_image_urls(vec![
|
||||
|
|
@ -1835,7 +1808,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_remote_image_urls(vec!["https://example.com/one.png".to_string()]);
|
||||
|
|
@ -1846,53 +1818,6 @@ mod tests {
|
|||
assert!(pane.remote_image_urls().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn esc_with_skill_popup_does_not_interrupt_task() {
|
||||
let (tx_raw, mut rx) = unbounded_channel::<AppEvent>();
|
||||
let tx = AppEventSender::new(tx_raw);
|
||||
let mut pane = BottomPane::new(BottomPaneParams {
|
||||
app_event_tx: tx,
|
||||
frame_requester: FrameRequester::test_dummy(),
|
||||
has_input_focus: true,
|
||||
enhanced_keys_supported: false,
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(vec![SkillMetadata {
|
||||
name: "test-skill".to_string(),
|
||||
description: "test skill".to_string(),
|
||||
short_description: None,
|
||||
interface: None,
|
||||
dependencies: None,
|
||||
policy: None,
|
||||
path_to_skills_md: test_path_buf("/tmp/test-skill/SKILL.md").abs(),
|
||||
scope: SkillScope::User,
|
||||
}]),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
||||
// Repro: a running task + skill popup + Esc should dismiss the popup, not interrupt.
|
||||
pane.insert_str("$");
|
||||
assert!(
|
||||
pane.composer.popup_active(),
|
||||
"expected skill popup after typing `$`"
|
||||
);
|
||||
|
||||
pane.handle_key_event(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
|
||||
while let Ok(ev) = rx.try_recv() {
|
||||
assert!(
|
||||
!matches!(ev, AppEvent::CodexOp(Op::Interrupt)),
|
||||
"expected Esc to not send Op::Interrupt when dismissing skill popup"
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
!pane.composer.popup_active(),
|
||||
"expected Esc to dismiss skill popup"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn esc_with_slash_command_popup_does_not_interrupt_task() {
|
||||
let (tx_raw, mut rx) = unbounded_channel::<AppEvent>();
|
||||
|
|
@ -1905,7 +1830,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1940,7 +1864,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -1976,7 +1899,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -2024,7 +1946,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_task_running(/*running*/ true);
|
||||
|
|
@ -2080,7 +2001,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
let on_ctrl_c_calls = Rc::new(Cell::new(0));
|
||||
|
|
@ -2128,7 +2048,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
let handle_calls = Rc::new(Cell::new(0));
|
||||
|
|
@ -2206,7 +2125,6 @@ mod tests {
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
pane.set_composer_input_enabled(/*enabled*/ false, /*placeholder*/ None);
|
||||
|
|
|
|||
|
|
@ -1,390 +0,0 @@
|
|||
use crossterm::event::KeyCode;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Constraint;
|
||||
use ratatui::layout::Layout;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::text::Line;
|
||||
use ratatui::widgets::Widget;
|
||||
use ratatui::widgets::WidgetRef;
|
||||
|
||||
use super::popup_consts::MAX_POPUP_ROWS;
|
||||
use super::scroll_state::ScrollState;
|
||||
use super::selection_popup_common::GenericDisplayRow;
|
||||
use super::selection_popup_common::render_rows_single_line;
|
||||
use crate::key_hint;
|
||||
use crate::render::Insets;
|
||||
use crate::render::RectExt;
|
||||
use crate::text_formatting::truncate_text;
|
||||
use codex_utils_fuzzy_match::fuzzy_match;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct MentionItem {
|
||||
pub(crate) display_name: String,
|
||||
pub(crate) description: Option<String>,
|
||||
pub(crate) insert_text: String,
|
||||
pub(crate) search_terms: Vec<String>,
|
||||
pub(crate) path: Option<String>,
|
||||
pub(crate) category_tag: Option<String>,
|
||||
pub(crate) sort_rank: u8,
|
||||
}
|
||||
|
||||
const MENTION_NAME_TRUNCATE_LEN: usize = 28;
|
||||
|
||||
pub(crate) struct SkillPopup {
|
||||
query: String,
|
||||
mentions: Vec<MentionItem>,
|
||||
state: ScrollState,
|
||||
}
|
||||
|
||||
impl SkillPopup {
|
||||
pub(crate) fn new(mentions: Vec<MentionItem>) -> Self {
|
||||
Self {
|
||||
query: String::new(),
|
||||
mentions,
|
||||
state: ScrollState::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_mentions(&mut self, mentions: Vec<MentionItem>) {
|
||||
self.mentions = mentions;
|
||||
self.clamp_selection();
|
||||
}
|
||||
|
||||
pub(crate) fn set_query(&mut self, query: &str) {
|
||||
self.query = query.to_string();
|
||||
self.clamp_selection();
|
||||
}
|
||||
|
||||
pub(crate) fn calculate_required_height(&self, _width: u16) -> u16 {
|
||||
let rows = self.rows_from_matches(self.filtered());
|
||||
let visible = rows.len().clamp(1, MAX_POPUP_ROWS);
|
||||
(visible as u16).saturating_add(2)
|
||||
}
|
||||
|
||||
pub(crate) fn move_up(&mut self) {
|
||||
let len = self.filtered_items().len();
|
||||
self.state.move_up_wrap(len);
|
||||
self.state.ensure_visible(len, MAX_POPUP_ROWS.min(len));
|
||||
}
|
||||
|
||||
pub(crate) fn move_down(&mut self) {
|
||||
let len = self.filtered_items().len();
|
||||
self.state.move_down_wrap(len);
|
||||
self.state.ensure_visible(len, MAX_POPUP_ROWS.min(len));
|
||||
}
|
||||
|
||||
pub(crate) fn selected_mention(&self) -> Option<&MentionItem> {
|
||||
let matches = self.filtered_items();
|
||||
let idx = self.state.selected_idx?;
|
||||
let mention_idx = matches.get(idx)?;
|
||||
self.mentions.get(*mention_idx)
|
||||
}
|
||||
|
||||
fn clamp_selection(&mut self) {
|
||||
let len = self.filtered_items().len();
|
||||
self.state.clamp_selection(len);
|
||||
self.state.ensure_visible(len, MAX_POPUP_ROWS.min(len));
|
||||
}
|
||||
|
||||
fn filtered_items(&self) -> Vec<usize> {
|
||||
self.filtered().into_iter().map(|(idx, _, _)| idx).collect()
|
||||
}
|
||||
|
||||
fn rows_from_matches(
|
||||
&self,
|
||||
matches: Vec<(usize, Option<Vec<usize>>, i32)>,
|
||||
) -> Vec<GenericDisplayRow> {
|
||||
matches
|
||||
.into_iter()
|
||||
.map(|(idx, indices, _score)| {
|
||||
let mention = &self.mentions[idx];
|
||||
let name = truncate_text(&mention.display_name, MENTION_NAME_TRUNCATE_LEN);
|
||||
let description = match (
|
||||
mention.category_tag.as_deref(),
|
||||
mention.description.as_deref(),
|
||||
) {
|
||||
(Some(tag), Some(description)) if !description.is_empty() => {
|
||||
Some(format!("{tag} {description}"))
|
||||
}
|
||||
(Some(tag), _) => Some(tag.to_string()),
|
||||
(None, Some(description)) if !description.is_empty() => {
|
||||
Some(description.to_string())
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
GenericDisplayRow {
|
||||
name,
|
||||
name_prefix_spans: Vec::new(),
|
||||
match_indices: indices,
|
||||
display_shortcut: None,
|
||||
description,
|
||||
category_tag: None,
|
||||
is_disabled: false,
|
||||
disabled_reason: None,
|
||||
wrap_indent: None,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn filtered(&self) -> Vec<(usize, Option<Vec<usize>>, i32)> {
|
||||
let filter = self.query.trim();
|
||||
let mut out: Vec<(usize, Option<Vec<usize>>, i32)> = Vec::new();
|
||||
|
||||
for (idx, mention) in self.mentions.iter().enumerate() {
|
||||
if filter.is_empty() {
|
||||
out.push((idx, None, 0));
|
||||
continue;
|
||||
}
|
||||
|
||||
let best_match =
|
||||
if let Some((indices, score)) = fuzzy_match(&mention.display_name, filter) {
|
||||
Some((Some(indices), score))
|
||||
} else {
|
||||
mention
|
||||
.search_terms
|
||||
.iter()
|
||||
.filter(|term| *term != &mention.display_name)
|
||||
.filter_map(|term| fuzzy_match(term, filter).map(|(_indices, score)| score))
|
||||
.min()
|
||||
.map(|score| (None, score))
|
||||
};
|
||||
|
||||
if let Some((indices, score)) = best_match {
|
||||
out.push((idx, indices, score));
|
||||
}
|
||||
}
|
||||
|
||||
out.sort_by(|a, b| {
|
||||
if filter.is_empty() {
|
||||
self.mentions[a.0]
|
||||
.sort_rank
|
||||
.cmp(&self.mentions[b.0].sort_rank)
|
||||
} else {
|
||||
a.1.is_none()
|
||||
.cmp(&b.1.is_none())
|
||||
.then_with(|| a.2.cmp(&b.2))
|
||||
.then_with(|| {
|
||||
self.mentions[a.0]
|
||||
.sort_rank
|
||||
.cmp(&self.mentions[b.0].sort_rank)
|
||||
})
|
||||
}
|
||||
.then_with(|| {
|
||||
let an = self.mentions[a.0].display_name.as_str();
|
||||
let bn = self.mentions[b.0].display_name.as_str();
|
||||
an.cmp(bn)
|
||||
})
|
||||
});
|
||||
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetRef for SkillPopup {
|
||||
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
||||
let (list_area, hint_area) = if area.height > 2 {
|
||||
let [list_area, _spacer_area, hint_area] = Layout::vertical([
|
||||
Constraint::Length(area.height - 2),
|
||||
Constraint::Length(1),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.areas(area);
|
||||
(list_area, Some(hint_area))
|
||||
} else {
|
||||
(area, None)
|
||||
};
|
||||
let rows = self.rows_from_matches(self.filtered());
|
||||
render_rows_single_line(
|
||||
list_area.inset(Insets::tlbr(
|
||||
/*top*/ 0, /*left*/ 2, /*bottom*/ 0, /*right*/ 0,
|
||||
)),
|
||||
buf,
|
||||
&rows,
|
||||
&self.state,
|
||||
MAX_POPUP_ROWS,
|
||||
"no matches",
|
||||
);
|
||||
if let Some(hint_area) = hint_area {
|
||||
let hint_area = Rect {
|
||||
x: hint_area.x + 2,
|
||||
y: hint_area.y,
|
||||
width: hint_area.width.saturating_sub(2),
|
||||
height: hint_area.height,
|
||||
};
|
||||
skill_popup_hint_line().render(hint_area, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn skill_popup_hint_line() -> Line<'static> {
|
||||
Line::from(vec![
|
||||
"Press ".into(),
|
||||
key_hint::plain(KeyCode::Enter).into(),
|
||||
" to insert or ".into(),
|
||||
key_hint::plain(KeyCode::Esc).into(),
|
||||
" to close".into(),
|
||||
])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
fn mention_item(index: usize) -> MentionItem {
|
||||
MentionItem {
|
||||
display_name: format!("Mention {index:02}"),
|
||||
description: Some(format!("Description {index:02}")),
|
||||
insert_text: format!("$mention-{index:02}"),
|
||||
search_terms: vec![format!("mention-{index:02}")],
|
||||
path: Some(format!("skill://mention-{index:02}")),
|
||||
category_tag: Some("[Skill]".to_string()),
|
||||
sort_rank: 1,
|
||||
}
|
||||
}
|
||||
|
||||
fn ranked_mention_item(
|
||||
display_name: &str,
|
||||
search_terms: &[&str],
|
||||
category_tag: &str,
|
||||
sort_rank: u8,
|
||||
) -> MentionItem {
|
||||
MentionItem {
|
||||
display_name: display_name.to_string(),
|
||||
description: None,
|
||||
insert_text: format!("${display_name}"),
|
||||
search_terms: search_terms
|
||||
.iter()
|
||||
.map(|term| (*term).to_string())
|
||||
.collect(),
|
||||
path: None,
|
||||
category_tag: Some(category_tag.to_string()),
|
||||
sort_rank,
|
||||
}
|
||||
}
|
||||
|
||||
fn named_mention_item(display_name: &str, search_terms: &[&str]) -> MentionItem {
|
||||
ranked_mention_item(display_name, search_terms, "[Skill]", /*sort_rank*/ 1)
|
||||
}
|
||||
|
||||
fn plugin_mention_item(display_name: &str, search_terms: &[&str]) -> MentionItem {
|
||||
ranked_mention_item(display_name, search_terms, "[Plugin]", /*sort_rank*/ 0)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filtered_mentions_preserve_results_beyond_popup_height() {
|
||||
let popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||
|
||||
let filtered_names: Vec<String> = popup
|
||||
.filtered_items()
|
||||
.into_iter()
|
||||
.map(|idx| popup.mentions[idx].display_name.clone())
|
||||
.collect();
|
||||
|
||||
assert_eq!(
|
||||
filtered_names,
|
||||
(0..(MAX_POPUP_ROWS + 2))
|
||||
.map(|idx| format!("Mention {idx:02}"))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
assert_eq!(
|
||||
popup.calculate_required_height(72),
|
||||
(MAX_POPUP_ROWS as u16) + 2
|
||||
);
|
||||
}
|
||||
|
||||
fn render_popup(popup: &SkillPopup, width: u16) -> String {
|
||||
let area = Rect::new(0, 0, width, popup.calculate_required_height(width));
|
||||
let mut buf = Buffer::empty(area);
|
||||
popup.render_ref(area, &mut buf);
|
||||
format!("{buf:?}")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scrolling_mentions_shifts_rendered_window_snapshot() {
|
||||
let mut popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||
|
||||
for _ in 0..=MAX_POPUP_ROWS {
|
||||
popup.move_down();
|
||||
}
|
||||
|
||||
insta::assert_snapshot!("skill_popup_scrolled", render_popup(&popup, /*width*/ 72));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_name_match_sorting_beats_worse_secondary_search_term_matches() {
|
||||
let mut popup = SkillPopup::new(vec![
|
||||
named_mention_item("pr-review-triage", &["pr-review-triage"]),
|
||||
named_mention_item("prd", &["prd"]),
|
||||
named_mention_item("PR Babysitter", &["babysit-pr", "PR Babysitter"]),
|
||||
named_mention_item("Plugin Creator", &["plugin-creator", "Plugin Creator"]),
|
||||
named_mention_item(
|
||||
"Logging Best Practices",
|
||||
&["logging-best-practices", "Logging Best Practices"],
|
||||
),
|
||||
]);
|
||||
popup.set_query("pr");
|
||||
|
||||
let filtered_names: Vec<String> = popup
|
||||
.filtered_items()
|
||||
.into_iter()
|
||||
.map(|idx| popup.mentions[idx].display_name.clone())
|
||||
.collect();
|
||||
|
||||
assert_eq!(
|
||||
filtered_names,
|
||||
vec![
|
||||
"PR Babysitter".to_string(),
|
||||
"pr-review-triage".to_string(),
|
||||
"prd".to_string(),
|
||||
"Plugin Creator".to_string(),
|
||||
"Logging Best Practices".to_string(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_match_score_sorts_before_plugin_rank_bias() {
|
||||
let mut popup = SkillPopup::new(vec![
|
||||
plugin_mention_item("GitHub", &["github", "pull requests", "pr"]),
|
||||
named_mention_item("pr-review-triage", &["pr-review-triage"]),
|
||||
named_mention_item("prd", &["prd"]),
|
||||
named_mention_item("Plugin Creator", &["plugin-creator", "Plugin Creator"]),
|
||||
named_mention_item(
|
||||
"Logging Best Practices",
|
||||
&["logging-best-practices", "Logging Best Practices"],
|
||||
),
|
||||
named_mention_item("PR Babysitter", &["babysit-pr", "PR Babysitter"]),
|
||||
]);
|
||||
popup.set_query("pr");
|
||||
|
||||
let filtered_items: Vec<(String, Option<String>)> = popup
|
||||
.filtered_items()
|
||||
.into_iter()
|
||||
.map(|idx| {
|
||||
(
|
||||
popup.mentions[idx].display_name.clone(),
|
||||
popup.mentions[idx].category_tag.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
assert_eq!(
|
||||
filtered_items,
|
||||
vec![
|
||||
("PR Babysitter".to_string(), Some("[Skill]".to_string())),
|
||||
("pr-review-triage".to_string(), Some("[Skill]".to_string())),
|
||||
("prd".to_string(), Some("[Skill]".to_string())),
|
||||
("Plugin Creator".to_string(), Some("[Skill]".to_string())),
|
||||
(
|
||||
"Logging Best Practices".to_string(),
|
||||
Some("[Skill]".to_string())
|
||||
),
|
||||
("GitHub".to_string(), Some("[Plugin]".to_string())),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
source: tui/src/bottom_pane/skill_popup.rs
|
||||
assertion_line: 289
|
||||
expression: "render_popup(&popup, /*width*/ 72)"
|
||||
---
|
||||
Buffer {
|
||||
area: Rect { x: 0, y: 0, width: 72, height: 10 },
|
||||
content: [
|
||||
" Mention 01 [Skill] Description 01 ",
|
||||
" Mention 02 [Skill] Description 02 ",
|
||||
" Mention 03 [Skill] Description 03 ",
|
||||
" Mention 04 [Skill] Description 04 ",
|
||||
" Mention 05 [Skill] Description 05 ",
|
||||
" Mention 06 [Skill] Description 06 ",
|
||||
" Mention 07 [Skill] Description 07 ",
|
||||
" Mention 08 [Skill] Description 08 ",
|
||||
" ",
|
||||
" Press enter to insert or esc to close ",
|
||||
],
|
||||
styles: [
|
||||
x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 14, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 36, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 2, y: 7, fg: Cyan, bg: Reset, underline: Reset, modifier: BOLD,
|
||||
x: 36, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 8, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 13, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
x: 27, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||
x: 30, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||
]
|
||||
}
|
||||
57
vendor/codex/codex-rs/tui/src/chatwidget.rs
vendored
57
vendor/codex/codex-rs/tui/src/chatwidget.rs
vendored
|
|
@ -108,7 +108,6 @@ use codex_config::ConfigLayerStackOrdering;
|
|||
use codex_config::types::ApprovalsReviewer;
|
||||
use codex_config::types::Notifications;
|
||||
use codex_config::types::WindowsSandboxModeToml;
|
||||
use codex_core_skills::model::SkillMetadata;
|
||||
use codex_features::FEATURES;
|
||||
use codex_features::Feature;
|
||||
#[cfg(test)]
|
||||
|
|
@ -195,7 +194,6 @@ use codex_protocol::protocol::RateLimitReachedType;
|
|||
use codex_protocol::protocol::RateLimitSnapshot;
|
||||
use codex_protocol::protocol::ReviewRequest;
|
||||
use codex_protocol::protocol::ReviewTarget;
|
||||
use codex_protocol::protocol::SkillMetadata as ProtocolSkillMetadata;
|
||||
#[cfg(test)]
|
||||
use codex_protocol::protocol::StreamErrorEvent;
|
||||
use codex_protocol::protocol::TerminalInteractionEvent;
|
||||
|
|
@ -359,11 +357,8 @@ mod interrupts;
|
|||
use self::interrupts::InterruptManager;
|
||||
mod session_header;
|
||||
use self::session_header::SessionHeader;
|
||||
mod skills;
|
||||
mod slash_dispatch;
|
||||
use self::skills::collect_tool_mentions;
|
||||
use self::skills::find_skill_mentions_with_tool_mentions;
|
||||
mod plan_implementation;
|
||||
mod slash_dispatch;
|
||||
use self::plan_implementation::PLAN_IMPLEMENTATION_TITLE;
|
||||
mod realtime;
|
||||
use self::realtime::RealtimeConversationUiState;
|
||||
|
|
@ -799,7 +794,6 @@ pub(crate) struct ChatWidget {
|
|||
collab_agent_metadata: HashMap<ThreadId, CollabAgentMetadata>,
|
||||
pending_collab_spawn_requests: HashMap<String, multi_agents::SpawnRequestSummary>,
|
||||
suppressed_exec_calls: HashSet<String>,
|
||||
skills_all: Vec<ProtocolSkillMetadata>,
|
||||
last_unified_wait: Option<UnifiedExecWaitState>,
|
||||
unified_exec_wait_streak: Option<UnifiedExecWaitStreak>,
|
||||
turn_sleep_inhibitor: SleepInhibitor,
|
||||
|
|
@ -2069,7 +2063,6 @@ impl ChatWidget {
|
|||
self.saw_copy_source_this_turn = false;
|
||||
self.bottom_pane
|
||||
.set_history_metadata(event.history_log_id, event.history_entry_count);
|
||||
self.set_skills(/*skills*/ None);
|
||||
self.session_network_proxy = event.network_proxy.clone();
|
||||
self.thread_id = Some(event.session_id);
|
||||
self.last_turn_id = None;
|
||||
|
|
@ -2246,10 +2239,6 @@ impl ChatWidget {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_skills(&mut self, skills: Option<Vec<SkillMetadata>>) {
|
||||
self.bottom_pane.set_skills(skills);
|
||||
}
|
||||
|
||||
pub(crate) fn open_feedback_note(
|
||||
&mut self,
|
||||
category: crate::app_event::FeedbackCategory,
|
||||
|
|
@ -4658,7 +4647,6 @@ impl ChatWidget {
|
|||
Some(rc) => (rc.command, rc.parsed_cmd, rc.source),
|
||||
None => (ev.command.clone(), ev.parsed_cmd.clone(), ev.source),
|
||||
};
|
||||
let parsed = self.annotate_skill_reads_in_parsed_cmd(parsed);
|
||||
let is_unified_exec_interaction =
|
||||
matches!(source, ExecCommandSource::UnifiedExecInteraction);
|
||||
let is_user_shell = source == ExecCommandSource::UserShell;
|
||||
|
|
@ -4886,7 +4874,7 @@ impl ChatWidget {
|
|||
pub(crate) fn handle_exec_begin_now(&mut self, ev: ExecCommandBeginEvent) {
|
||||
// Ensure the status indicator is visible while the command runs.
|
||||
self.bottom_pane.ensure_status_indicator();
|
||||
let parsed_cmd = self.annotate_skill_reads_in_parsed_cmd(ev.parsed_cmd.clone());
|
||||
let parsed_cmd = ev.parsed_cmd.clone();
|
||||
self.running_commands.insert(
|
||||
ev.call_id.clone(),
|
||||
RunningCommand {
|
||||
|
|
@ -5066,12 +5054,10 @@ impl ChatWidget {
|
|||
placeholder_text: placeholder.clone(),
|
||||
disable_paste_burst: config.disable_paste_burst,
|
||||
animations_enabled: config.animations,
|
||||
skills: None,
|
||||
}),
|
||||
active_cell,
|
||||
active_cell_revision: 0,
|
||||
config,
|
||||
skills_all: Vec::new(),
|
||||
current_collaboration_mode,
|
||||
active_collaboration_mask,
|
||||
has_chatgpt_account,
|
||||
|
|
@ -5740,45 +5726,6 @@ impl ChatWidget {
|
|||
});
|
||||
}
|
||||
|
||||
let mentions = collect_tool_mentions(&text, &HashMap::new());
|
||||
let bound_names: HashSet<String> = mention_bindings
|
||||
.iter()
|
||||
.map(|binding| binding.mention.clone())
|
||||
.collect();
|
||||
let mut selected_skill_paths: HashSet<AbsolutePathBuf> = HashSet::new();
|
||||
if let Some(skills) = self.bottom_pane.skills() {
|
||||
for binding in &mention_bindings {
|
||||
let path = binding
|
||||
.path
|
||||
.strip_prefix("skill://")
|
||||
.unwrap_or(binding.path.as_str());
|
||||
let path = Path::new(path);
|
||||
if let Some(skill) = skills
|
||||
.iter()
|
||||
.find(|skill| skill.path_to_skills_md.as_path() == path)
|
||||
&& selected_skill_paths.insert(skill.path_to_skills_md.clone())
|
||||
{
|
||||
items.push(UserInput::Skill {
|
||||
name: skill.name.clone(),
|
||||
path: skill.path_to_skills_md.to_path_buf(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let skill_mentions = find_skill_mentions_with_tool_mentions(&mentions, skills);
|
||||
for skill in skill_mentions {
|
||||
if bound_names.contains(skill.name.as_str())
|
||||
|| !selected_skill_paths.insert(skill.path_to_skills_md.clone())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
items.push(UserInput::Skill {
|
||||
name: skill.name.clone(),
|
||||
path: skill.path_to_skills_md.to_path_buf(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let effective_mode = self.effective_collaboration_mode();
|
||||
if effective_mode.model().trim().is_empty() {
|
||||
self.add_error_message(
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ impl ChatWidget {
|
|||
match item {
|
||||
UserInput::Text { text, .. } => message.push_str(text),
|
||||
UserInput::Image { .. } | UserInput::LocalImage { .. } => image_count += 1,
|
||||
UserInput::Skill { .. } | UserInput::Mention { .. } => {}
|
||||
UserInput::Mention { .. } => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ impl ChatWidget {
|
|||
),
|
||||
UserInput::Image { image_url } => remote_image_urls.push(image_url.clone()),
|
||||
UserInput::LocalImage { path } => local_images.push(path.clone()),
|
||||
UserInput::Skill { .. } | UserInput::Mention { .. } => {}
|
||||
UserInput::Mention { .. } => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
252
vendor/codex/codex-rs/tui/src/chatwidget/skills.rs
vendored
252
vendor/codex/codex-rs/tui/src/chatwidget/skills.rs
vendored
|
|
@ -1,252 +0,0 @@
|
|||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use super::ChatWidget;
|
||||
use codex_core_skills::model::SkillMetadata;
|
||||
use codex_protocol::parse_command::ParsedCommand;
|
||||
|
||||
const TOOL_MENTION_SIGIL: char = '$';
|
||||
|
||||
impl ChatWidget {
|
||||
pub(crate) fn annotate_skill_reads_in_parsed_cmd(
|
||||
&self,
|
||||
mut parsed_cmd: Vec<ParsedCommand>,
|
||||
) -> Vec<ParsedCommand> {
|
||||
if self.skills_all.is_empty() {
|
||||
return parsed_cmd;
|
||||
}
|
||||
|
||||
for parsed in &mut parsed_cmd {
|
||||
let ParsedCommand::Read { name, path, .. } = parsed else {
|
||||
continue;
|
||||
};
|
||||
if name != "SKILL.md" {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Best effort only: annotate exact SKILL.md path matches from the loaded skills list.
|
||||
if let Some(skill) = self
|
||||
.skills_all
|
||||
.iter()
|
||||
.find(|skill| skill.path.as_path() == path)
|
||||
{
|
||||
*name = format!("{name} ({} skill)", skill.name);
|
||||
}
|
||||
}
|
||||
|
||||
parsed_cmd
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn collect_tool_mentions(
|
||||
text: &str,
|
||||
mention_paths: &HashMap<String, String>,
|
||||
) -> ToolMentions {
|
||||
let mut mentions = extract_tool_mentions_from_text(text);
|
||||
for (name, path) in mention_paths {
|
||||
if mentions.names.contains(name) {
|
||||
mentions.linked_paths.insert(name.clone(), path.clone());
|
||||
}
|
||||
}
|
||||
mentions
|
||||
}
|
||||
|
||||
pub(crate) fn find_skill_mentions_with_tool_mentions(
|
||||
mentions: &ToolMentions,
|
||||
skills: &[SkillMetadata],
|
||||
) -> Vec<SkillMetadata> {
|
||||
let mention_skill_paths: HashSet<&str> = mentions
|
||||
.linked_paths
|
||||
.values()
|
||||
.filter(|path| is_skill_path(path))
|
||||
.map(|path| normalize_skill_path(path))
|
||||
.collect();
|
||||
|
||||
let mut seen_names = HashSet::new();
|
||||
let mut seen_paths = HashSet::new();
|
||||
let mut matches: Vec<SkillMetadata> = Vec::new();
|
||||
|
||||
for skill in skills {
|
||||
if seen_paths.contains(&skill.path_to_skills_md) {
|
||||
continue;
|
||||
}
|
||||
let path_str = skill.path_to_skills_md.to_string_lossy();
|
||||
if mention_skill_paths.contains(path_str.as_ref()) {
|
||||
seen_paths.insert(skill.path_to_skills_md.clone());
|
||||
seen_names.insert(skill.name.clone());
|
||||
matches.push(skill.clone());
|
||||
}
|
||||
}
|
||||
|
||||
for skill in skills {
|
||||
if seen_paths.contains(&skill.path_to_skills_md) {
|
||||
continue;
|
||||
}
|
||||
if mentions.names.contains(&skill.name) && seen_names.insert(skill.name.clone()) {
|
||||
seen_paths.insert(skill.path_to_skills_md.clone());
|
||||
matches.push(skill.clone());
|
||||
}
|
||||
}
|
||||
|
||||
matches
|
||||
}
|
||||
|
||||
pub(crate) struct ToolMentions {
|
||||
names: HashSet<String>,
|
||||
linked_paths: HashMap<String, String>,
|
||||
}
|
||||
|
||||
fn extract_tool_mentions_from_text(text: &str) -> ToolMentions {
|
||||
extract_tool_mentions_from_text_with_sigil(text, TOOL_MENTION_SIGIL)
|
||||
}
|
||||
|
||||
fn extract_tool_mentions_from_text_with_sigil(text: &str, sigil: char) -> ToolMentions {
|
||||
let text_bytes = text.as_bytes();
|
||||
let mut names: HashSet<String> = HashSet::new();
|
||||
let mut linked_paths: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let mut index = 0;
|
||||
while index < text_bytes.len() {
|
||||
let byte = text_bytes[index];
|
||||
if byte == b'['
|
||||
&& let Some((name, path, end_index)) =
|
||||
parse_linked_tool_mention(text, text_bytes, index, sigil)
|
||||
{
|
||||
if !is_common_env_var(name) {
|
||||
if is_skill_path(path) {
|
||||
names.insert(name.to_string());
|
||||
}
|
||||
linked_paths
|
||||
.entry(name.to_string())
|
||||
.or_insert(path.to_string());
|
||||
}
|
||||
index = end_index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if byte != sigil as u8 {
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
let name_start = index + 1;
|
||||
let Some(first_name_byte) = text_bytes.get(name_start) else {
|
||||
index += 1;
|
||||
continue;
|
||||
};
|
||||
if !is_mention_name_char(*first_name_byte) {
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut name_end = name_start + 1;
|
||||
while let Some(next_byte) = text_bytes.get(name_end)
|
||||
&& is_mention_name_char(*next_byte)
|
||||
{
|
||||
name_end += 1;
|
||||
}
|
||||
|
||||
let name = &text[name_start..name_end];
|
||||
if !is_common_env_var(name) {
|
||||
names.insert(name.to_string());
|
||||
}
|
||||
index = name_end;
|
||||
}
|
||||
|
||||
ToolMentions {
|
||||
names,
|
||||
linked_paths,
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_linked_tool_mention<'a>(
|
||||
text: &'a str,
|
||||
text_bytes: &[u8],
|
||||
start: usize,
|
||||
sigil: char,
|
||||
) -> Option<(&'a str, &'a str, usize)> {
|
||||
let sigil_index = start + 1;
|
||||
if text_bytes.get(sigil_index) != Some(&(sigil as u8)) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let name_start = sigil_index + 1;
|
||||
let first_name_byte = text_bytes.get(name_start)?;
|
||||
if !is_mention_name_char(*first_name_byte) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut name_end = name_start + 1;
|
||||
while let Some(next_byte) = text_bytes.get(name_end)
|
||||
&& is_mention_name_char(*next_byte)
|
||||
{
|
||||
name_end += 1;
|
||||
}
|
||||
|
||||
if text_bytes.get(name_end) != Some(&b']') {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut path_start = name_end + 1;
|
||||
while let Some(next_byte) = text_bytes.get(path_start)
|
||||
&& next_byte.is_ascii_whitespace()
|
||||
{
|
||||
path_start += 1;
|
||||
}
|
||||
if text_bytes.get(path_start) != Some(&b'(') {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut path_end = path_start + 1;
|
||||
while let Some(next_byte) = text_bytes.get(path_end)
|
||||
&& *next_byte != b')'
|
||||
{
|
||||
path_end += 1;
|
||||
}
|
||||
if text_bytes.get(path_end) != Some(&b')') {
|
||||
return None;
|
||||
}
|
||||
|
||||
let path = text[path_start + 1..path_end].trim();
|
||||
if path.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let name = &text[name_start..name_end];
|
||||
Some((name, path, path_end + 1))
|
||||
}
|
||||
|
||||
fn is_common_env_var(name: &str) -> bool {
|
||||
let upper = name.to_ascii_uppercase();
|
||||
matches!(
|
||||
upper.as_str(),
|
||||
"PATH"
|
||||
| "HOME"
|
||||
| "USER"
|
||||
| "SHELL"
|
||||
| "PWD"
|
||||
| "TMPDIR"
|
||||
| "TEMP"
|
||||
| "TMP"
|
||||
| "LANG"
|
||||
| "TERM"
|
||||
| "XDG_CONFIG_HOME"
|
||||
)
|
||||
}
|
||||
|
||||
fn is_mention_name_char(byte: u8) -> bool {
|
||||
matches!(byte, b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'_' | b'-')
|
||||
}
|
||||
|
||||
fn is_skill_path(path: &str) -> bool {
|
||||
path.starts_with("skill://")
|
||||
|| (!path.contains("://")
|
||||
&& path
|
||||
.rsplit(['/', '\\'])
|
||||
.next()
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case("SKILL.md")))
|
||||
}
|
||||
|
||||
fn normalize_skill_path(path: &str) -> &str {
|
||||
path.strip_prefix("skill://").unwrap_or(path)
|
||||
}
|
||||
|
|
@ -91,7 +91,6 @@ pub(super) use codex_config::types::ApprovalsReviewer;
|
|||
pub(super) use codex_config::types::Notifications;
|
||||
#[cfg(target_os = "windows")]
|
||||
pub(super) use codex_config::types::WindowsSandboxModeToml;
|
||||
pub(super) use codex_core_skills::model::SkillMetadata;
|
||||
pub(super) use codex_features::FEATURES;
|
||||
pub(super) use codex_features::Feature;
|
||||
pub(super) use codex_git_utils::CommitLogEntry;
|
||||
|
|
@ -172,7 +171,6 @@ pub(super) use codex_protocol::protocol::ReviewRequest;
|
|||
pub(super) use codex_protocol::protocol::ReviewTarget;
|
||||
pub(super) use codex_protocol::protocol::SessionConfiguredEvent;
|
||||
pub(super) use codex_protocol::protocol::SessionSource;
|
||||
pub(super) use codex_protocol::protocol::SkillScope;
|
||||
pub(super) use codex_protocol::protocol::StreamErrorEvent;
|
||||
pub(super) use codex_protocol::protocol::TerminalInteractionEvent;
|
||||
pub(super) use codex_protocol::protocol::ThreadRolledBackEvent;
|
||||
|
|
|
|||
|
|
@ -368,86 +368,6 @@ async fn enter_with_only_remote_images_does_not_submit_when_input_disabled() {
|
|||
assert_no_submit_op(&mut op_rx);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn submission_prefers_selected_duplicate_skill_path() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
||||
let conversation_id = ThreadId::new();
|
||||
let rollout_file = NamedTempFile::new().unwrap();
|
||||
let configured = codex_protocol::protocol::SessionConfiguredEvent {
|
||||
session_id: conversation_id,
|
||||
forked_from_id: None,
|
||||
thread_name: None,
|
||||
model: "test-model".to_string(),
|
||||
model_provider_id: "test-provider".to_string(),
|
||||
service_tier: None,
|
||||
approval_policy: AskForApproval::Never,
|
||||
approvals_reviewer: ApprovalsReviewer::User,
|
||||
sandbox_policy: SandboxPolicy::new_read_only_policy(),
|
||||
cwd: test_path_buf("/home/user/project").abs(),
|
||||
reasoning_effort: Some(ReasoningEffortConfig::default()),
|
||||
history_log_id: 0,
|
||||
history_entry_count: 0,
|
||||
initial_messages: None,
|
||||
network_proxy: None,
|
||||
rollout_path: Some(rollout_file.path().to_path_buf()),
|
||||
};
|
||||
chat.handle_codex_event(Event {
|
||||
id: "initial".into(),
|
||||
msg: EventMsg::SessionConfigured(configured),
|
||||
});
|
||||
drain_insert_history(&mut rx);
|
||||
|
||||
let repo_skill_path = test_path_buf("/tmp/repo/figma/SKILL.md").abs();
|
||||
let user_skill_path = test_path_buf("/tmp/user/figma/SKILL.md").abs();
|
||||
chat.set_skills(Some(vec![
|
||||
SkillMetadata {
|
||||
name: "figma".to_string(),
|
||||
description: "Repo skill".to_string(),
|
||||
short_description: None,
|
||||
interface: None,
|
||||
dependencies: None,
|
||||
policy: None,
|
||||
path_to_skills_md: repo_skill_path,
|
||||
scope: SkillScope::Repo,
|
||||
},
|
||||
SkillMetadata {
|
||||
name: "figma".to_string(),
|
||||
description: "User skill".to_string(),
|
||||
short_description: None,
|
||||
interface: None,
|
||||
dependencies: None,
|
||||
policy: None,
|
||||
path_to_skills_md: user_skill_path.clone(),
|
||||
scope: SkillScope::User,
|
||||
},
|
||||
]));
|
||||
|
||||
chat.bottom_pane.set_composer_text_with_mention_bindings(
|
||||
"please use $figma now".to_string(),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
vec![MentionBinding {
|
||||
mention: "figma".to_string(),
|
||||
path: user_skill_path.to_string_lossy().into_owned(),
|
||||
}],
|
||||
);
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
|
||||
let items = match next_submit_op(&mut op_rx) {
|
||||
Op::UserTurn { items, .. } => items,
|
||||
other => panic!("expected Op::UserTurn, got {other:?}"),
|
||||
};
|
||||
let selected_skill_paths = items
|
||||
.iter()
|
||||
.filter_map(|item| match item {
|
||||
UserInput::Skill { path, .. } => Some(path.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(selected_skill_paths, vec![user_skill_path.to_path_buf()]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn blocked_image_restore_preserves_mention_bindings() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
|
|
@ -464,7 +384,7 @@ async fn blocked_image_restore_preserves_mention_bindings() {
|
|||
}];
|
||||
let mention_bindings = vec![MentionBinding {
|
||||
mention: "file".to_string(),
|
||||
path: "/tmp/skills/file/SKILL.md".to_string(),
|
||||
path: "mcp://file".to_string(),
|
||||
}];
|
||||
|
||||
chat.restore_blocked_image_submission(
|
||||
|
|
@ -998,10 +918,6 @@ fn rendered_user_message_event_from_inputs_matches_flattened_user_message_shape(
|
|||
UserInput::LocalImage {
|
||||
path: local_image.clone(),
|
||||
},
|
||||
UserInput::Skill {
|
||||
name: "demo".to_string(),
|
||||
path: PathBuf::from("/tmp/skill/SKILL.md"),
|
||||
},
|
||||
UserInput::Mention {
|
||||
name: "repo".to_string(),
|
||||
path: "mcp://repo".to_string(),
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ pub(super) async fn make_chatwidget_manual(
|
|||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: cfg.animations,
|
||||
skills: None,
|
||||
});
|
||||
bottom.set_collaboration_modes_enabled(/*enabled*/ true);
|
||||
let model_catalog = test_model_catalog(&cfg);
|
||||
|
|
@ -221,7 +220,6 @@ pub(super) async fn make_chatwidget_manual(
|
|||
collab_agent_metadata: HashMap::new(),
|
||||
pending_collab_spawn_requests: HashMap::new(),
|
||||
suppressed_exec_calls: HashSet::new(),
|
||||
skills_all: Vec::new(),
|
||||
last_unified_wait: None,
|
||||
unified_exec_wait_streak: None,
|
||||
turn_sleep_inhibitor: SleepInhibitor::new(prevent_idle_sleep),
|
||||
|
|
|
|||
|
|
@ -1080,7 +1080,7 @@ async fn submit_user_message_ignores_plugin_mentions_from_bindings() {
|
|||
text_elements: Vec::new(),
|
||||
mention_bindings: vec![MentionBinding {
|
||||
mention: "sample".to_string(),
|
||||
path: "skill://sample".to_string(),
|
||||
path: "mcp://sample".to_string(),
|
||||
}],
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -911,7 +911,7 @@ async fn manual_interrupt_restores_pending_steer_mention_bindings_to_composer()
|
|||
|
||||
let mention_bindings = vec![MentionBinding {
|
||||
mention: "figma".to_string(),
|
||||
path: "/tmp/skills/figma/SKILL.md".to_string(),
|
||||
path: "mcp://figma".to_string(),
|
||||
}];
|
||||
chat.bottom_pane.set_composer_text_with_mention_bindings(
|
||||
"please use $figma".to_string(),
|
||||
|
|
|
|||
1
vendor/codex/codex-rs/tui/src/lib.rs
vendored
1
vendor/codex/codex-rs/tui/src/lib.rs
vendored
|
|
@ -148,7 +148,6 @@ mod resume_picker;
|
|||
mod selection_list;
|
||||
mod session_log;
|
||||
mod shimmer;
|
||||
mod skills_helpers;
|
||||
mod slash_command;
|
||||
mod status;
|
||||
mod status_indicator_widget;
|
||||
|
|
|
|||
23
vendor/codex/codex-rs/tui/src/mention_codec.rs
vendored
23
vendor/codex/codex-rs/tui/src/mention_codec.rs
vendored
|
|
@ -200,11 +200,6 @@ fn is_common_env_var(name: &str) -> bool {
|
|||
|
||||
fn is_tool_path(path: &str) -> bool {
|
||||
path.starts_with("mcp://")
|
||||
|| path.starts_with("skill://")
|
||||
|| path
|
||||
.rsplit(['/', '\\'])
|
||||
.next()
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case("SKILL.md"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
@ -214,10 +209,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn decode_history_mentions_restores_visible_tokens() {
|
||||
let decoded = decode_history_mentions(
|
||||
"Use [$repo](mcp://repo), [$sample](skill://sample), and [$figma](/tmp/figma/SKILL.md).",
|
||||
);
|
||||
assert_eq!(decoded.text, "Use $repo, $sample, and $figma.");
|
||||
let decoded = decode_history_mentions("Use [$repo](mcp://repo) and [$figma](mcp://figma).");
|
||||
assert_eq!(decoded.text, "Use $repo and $figma.");
|
||||
assert_eq!(
|
||||
decoded.mentions,
|
||||
vec![
|
||||
|
|
@ -225,13 +218,9 @@ mod tests {
|
|||
mention: "repo".to_string(),
|
||||
path: "mcp://repo".to_string(),
|
||||
},
|
||||
LinkedMention {
|
||||
mention: "sample".to_string(),
|
||||
path: "skill://sample".to_string(),
|
||||
},
|
||||
LinkedMention {
|
||||
mention: "figma".to_string(),
|
||||
path: "/tmp/figma/SKILL.md".to_string(),
|
||||
path: "mcp://figma".to_string(),
|
||||
},
|
||||
]
|
||||
);
|
||||
|
|
@ -257,17 +246,17 @@ mod tests {
|
|||
},
|
||||
LinkedMention {
|
||||
mention: "sample".to_string(),
|
||||
path: "skill://sample".to_string(),
|
||||
path: "mcp://sample".to_string(),
|
||||
},
|
||||
LinkedMention {
|
||||
mention: "figma".to_string(),
|
||||
path: "/tmp/figma/SKILL.md".to_string(),
|
||||
path: "mcp://figma-alt".to_string(),
|
||||
},
|
||||
],
|
||||
);
|
||||
assert_eq!(
|
||||
encoded,
|
||||
"[$figma](mcp://figma) then [$sample](skill://sample) then [$figma](/tmp/figma/SKILL.md) then $other"
|
||||
"[$figma](mcp://figma) then [$sample](mcp://sample) then [$figma](mcp://figma-alt) then $other"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
vendor/codex/codex-rs/tui/src/skills_helpers.rs
vendored
20
vendor/codex/codex-rs/tui/src/skills_helpers.rs
vendored
|
|
@ -1,20 +0,0 @@
|
|||
use codex_core_skills::model::SkillMetadata;
|
||||
|
||||
pub(crate) fn skill_display_name(skill: &SkillMetadata) -> String {
|
||||
if let Some(display_name) = skill
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.display_name.as_deref())
|
||||
{
|
||||
return display_name.to_string();
|
||||
}
|
||||
|
||||
if let Some((plugin_name, skill_name)) = skill.name.split_once(':')
|
||||
&& !plugin_name.is_empty()
|
||||
&& !skill_name.is_empty()
|
||||
{
|
||||
return format!("{skill_name} ({plugin_name})");
|
||||
}
|
||||
|
||||
skill.name.clone()
|
||||
}
|
||||
Reference in a new issue