pi-sdk-web 0.3.0 → 0.3.2
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/static/app.js +21 -7
- package/package.json +1 -1
package/dist/static/app.js
CHANGED
|
@@ -1186,10 +1186,18 @@ class PiWebClient {
|
|
|
1186
1186
|
this.send({ type: 'bash', command: command });
|
|
1187
1187
|
}
|
|
1188
1188
|
} else if (text.startsWith('/')) {
|
|
1189
|
-
//
|
|
1189
|
+
// Skill commands (/skill:name args) go through prompt expansion in Pi -
|
|
1190
|
+
// sent as-is (with the skill: prefix) so session.prompt expands them.
|
|
1191
|
+
if (text.startsWith('/skill:')) {
|
|
1192
|
+
this.send({ type: 'prompt', message: text });
|
|
1193
|
+
this.inputEl.value = '';
|
|
1194
|
+
this.hideCommandMenu();
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
// Other slash commands: builtins are handled locally, everything else is
|
|
1190
1198
|
// executed as an extension command by the server.
|
|
1191
1199
|
const m = text.slice(1).match(/^(\S+)\s*(.*)$/);
|
|
1192
|
-
const name =
|
|
1200
|
+
const name = m ? m[1] : text.slice(1);
|
|
1193
1201
|
const args = m ? m[2] : '';
|
|
1194
1202
|
const builtin = BUILTIN_COMMANDS.find((c) => c.name === name);
|
|
1195
1203
|
if (builtin && builtin.action && !builtin.unsupported) {
|
|
@@ -1197,7 +1205,14 @@ class PiWebClient {
|
|
|
1197
1205
|
} else if (builtin && builtin.unsupported) {
|
|
1198
1206
|
this.appendError(`/${name} is not supported in web mode`);
|
|
1199
1207
|
} else {
|
|
1200
|
-
|
|
1208
|
+
// Prompt templates (/cl etc.) are expanded by Pi's prompt layer -
|
|
1209
|
+
// send as prompt text, same as /skill: commands.
|
|
1210
|
+
const knownTemplate = (this.lastState?.commands || []).find((c) => c.name === name && c.source === 'prompt');
|
|
1211
|
+
if (knownTemplate) {
|
|
1212
|
+
this.send({ type: 'prompt', message: text });
|
|
1213
|
+
} else {
|
|
1214
|
+
this.send({ type: 'command', name: name, args: args });
|
|
1215
|
+
}
|
|
1201
1216
|
}
|
|
1202
1217
|
} else {
|
|
1203
1218
|
this.send({ type: 'prompt', message: text });
|
|
@@ -1707,7 +1722,7 @@ class PiWebClient {
|
|
|
1707
1722
|
.map(
|
|
1708
1723
|
(c, i) =>
|
|
1709
1724
|
`<div class="command-item" data-index="${i}">` +
|
|
1710
|
-
`<span class="command-name">/${this.escapeHtml(c.name
|
|
1725
|
+
`<span class="command-name">/${this.escapeHtml(c.name)}</span>` +
|
|
1711
1726
|
`<span class="command-desc">${this.escapeHtml(c.description || c.source || '')}</span>` +
|
|
1712
1727
|
(c.unsupported ? `<span class="command-unsupported">not supported</span>` : '') +
|
|
1713
1728
|
`</div>`,
|
|
@@ -1758,9 +1773,8 @@ class PiWebClient {
|
|
|
1758
1773
|
return;
|
|
1759
1774
|
}
|
|
1760
1775
|
|
|
1761
|
-
// Regular commands: insert into input
|
|
1762
|
-
|
|
1763
|
-
this.inputEl.value = '/' + name + ' ';
|
|
1776
|
+
// Regular commands: insert into input (keep skill: prefix - Pi expands it)
|
|
1777
|
+
this.inputEl.value = '/' + cmd.name + ' ';
|
|
1764
1778
|
this.inputEl.focus();
|
|
1765
1779
|
this.hideCommandMenu();
|
|
1766
1780
|
}
|