@canonmsg/codex-plugin 0.18.8 → 0.18.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server-adapter.js +3 -1
- package/dist/host.d.ts +1 -1
- package/dist/host.js +20 -34
- package/package.json +1 -1
|
@@ -534,7 +534,9 @@ function readNullableString(record, key) {
|
|
|
534
534
|
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
535
535
|
}
|
|
536
536
|
function parseSkillSlashPrompt(prompt) {
|
|
537
|
-
const
|
|
537
|
+
const trimmed = prompt.trim();
|
|
538
|
+
const match = trimmed.match(/^\$([A-Za-z0-9:_-]+)(?:\s+([\s\S]*))?$/)
|
|
539
|
+
?? trimmed.match(/^\/skill\s+([A-Za-z0-9:_-]+)(?:\s+([\s\S]*))?$/);
|
|
538
540
|
if (!match?.[1])
|
|
539
541
|
return null;
|
|
540
542
|
return {
|
package/dist/host.d.ts
CHANGED
|
@@ -34,6 +34,6 @@ export declare const CODEX_EFFORT_OPTIONS: readonly [{
|
|
|
34
34
|
readonly value: "xhigh";
|
|
35
35
|
readonly label: "Extra high";
|
|
36
36
|
}];
|
|
37
|
-
export declare function
|
|
37
|
+
export declare function buildCodexSkillCommands(skills: ReadonlyArray<CodexSkillMetadata>): CanonRuntimeCommandDescriptor[];
|
|
38
38
|
export declare function main(): Promise<void>;
|
|
39
39
|
export {};
|
package/dist/host.js
CHANGED
|
@@ -86,8 +86,8 @@ export const CODEX_EFFORT_OPTIONS = [
|
|
|
86
86
|
];
|
|
87
87
|
const CODEX_EFFORT_VALUES = new Set(CODEX_EFFORT_OPTIONS.map((option) => option.value));
|
|
88
88
|
const MAX_CODEX_SKILL_COMMAND_CHOICES = 50;
|
|
89
|
-
export function
|
|
90
|
-
|
|
89
|
+
export function buildCodexSkillCommands(skills) {
|
|
90
|
+
return skills
|
|
91
91
|
.filter((skill) => /^[A-Za-z0-9:_-]+$/.test(skill.name))
|
|
92
92
|
.slice(0, MAX_CODEX_SKILL_COMMAND_CHOICES)
|
|
93
93
|
.map((skill) => {
|
|
@@ -95,39 +95,25 @@ export function buildCodexSkillCommand(skills) {
|
|
|
95
95
|
?? skill.description
|
|
96
96
|
?? (skill.scope ? `${skill.scope} skill` : undefined);
|
|
97
97
|
return {
|
|
98
|
-
|
|
98
|
+
id: `codex-skill-${skill.name}`,
|
|
99
99
|
label: skill.displayName ?? skill.name,
|
|
100
|
+
aliases: [skill.name],
|
|
101
|
+
category: 'skill',
|
|
102
|
+
placements: ['composer_slash', 'command_palette'],
|
|
103
|
+
availability: ['always'],
|
|
104
|
+
trailingTextBehavior: 'send_as_prompt',
|
|
105
|
+
args: [
|
|
106
|
+
{
|
|
107
|
+
id: 'prompt',
|
|
108
|
+
label: 'Prompt',
|
|
109
|
+
kind: 'string',
|
|
110
|
+
captureRemaining: true,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
100
113
|
...(description ? { description } : {}),
|
|
114
|
+
dispatch: { kind: 'text_passthrough', template: `$${skill.name} {argument}` },
|
|
101
115
|
};
|
|
102
116
|
});
|
|
103
|
-
if (choices.length === 0)
|
|
104
|
-
return null;
|
|
105
|
-
return {
|
|
106
|
-
id: 'codex-skill',
|
|
107
|
-
label: 'Use skill',
|
|
108
|
-
description: 'Invoke one of the Codex skills available to this runtime.',
|
|
109
|
-
aliases: ['skill'],
|
|
110
|
-
category: 'skill',
|
|
111
|
-
placements: ['composer_slash', 'command_palette'],
|
|
112
|
-
availability: ['always'],
|
|
113
|
-
trailingTextBehavior: 'send_as_prompt',
|
|
114
|
-
args: [
|
|
115
|
-
{
|
|
116
|
-
id: 'skill',
|
|
117
|
-
label: 'Skill',
|
|
118
|
-
kind: 'enum',
|
|
119
|
-
required: true,
|
|
120
|
-
choices,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 'prompt',
|
|
124
|
-
label: 'Prompt',
|
|
125
|
-
kind: 'string',
|
|
126
|
-
captureRemaining: true,
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
dispatch: { kind: 'text_passthrough', template: '/skill {args.skill} {args.prompt}' },
|
|
130
|
-
};
|
|
131
117
|
}
|
|
132
118
|
function buildCodexRuntimeDescriptor(input) {
|
|
133
119
|
const commands = [
|
|
@@ -149,9 +135,9 @@ function buildCodexRuntimeDescriptor(input) {
|
|
|
149
135
|
RUNTIME_STOP_ACTION,
|
|
150
136
|
RUNTIME_STOP_AND_DROP_ACTION,
|
|
151
137
|
];
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
commands.push(
|
|
138
|
+
const skillCommands = input.skills?.length ? buildCodexSkillCommands(input.skills) : [];
|
|
139
|
+
if (skillCommands.length) {
|
|
140
|
+
commands.push(...skillCommands);
|
|
155
141
|
}
|
|
156
142
|
const descriptor = buildFirstPartyCodingRuntimeDescriptor({
|
|
157
143
|
clientType: 'codex',
|