wave-code 1.1.0 → 1.1.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.
@@ -0,0 +1,91 @@
1
+ import { Key } from "ink";
2
+
3
+ export type PendingEffect = { type: "CANCEL" };
4
+
5
+ export interface SkillsManagerState {
6
+ selectedIndex: number;
7
+ viewMode: "list" | "detail";
8
+ pendingEffect: PendingEffect | null;
9
+ }
10
+
11
+ export type SkillsManagerAction =
12
+ | { type: "MOVE_UP" }
13
+ | { type: "MOVE_DOWN"; itemCount: number }
14
+ | { type: "SET_VIEW_MODE"; viewMode: "list" | "detail" }
15
+ | {
16
+ type: "HANDLE_KEY";
17
+ input: string;
18
+ key: Key;
19
+ itemCount: number;
20
+ }
21
+ | { type: "CLEAR_PENDING_EFFECT" };
22
+
23
+ export function skillsManagerReducer(
24
+ state: SkillsManagerState,
25
+ action: SkillsManagerAction,
26
+ ): SkillsManagerState {
27
+ switch (action.type) {
28
+ case "MOVE_UP":
29
+ return {
30
+ ...state,
31
+ selectedIndex: Math.max(0, state.selectedIndex - 1),
32
+ };
33
+ case "MOVE_DOWN":
34
+ return {
35
+ ...state,
36
+ selectedIndex: Math.min(
37
+ Math.max(0, action.itemCount - 1),
38
+ state.selectedIndex + 1,
39
+ ),
40
+ };
41
+ case "SET_VIEW_MODE":
42
+ return { ...state, viewMode: action.viewMode };
43
+ case "HANDLE_KEY": {
44
+ const { key, itemCount } = action;
45
+
46
+ if (key.return) {
47
+ if (state.viewMode === "list") {
48
+ return { ...state, viewMode: "detail" };
49
+ }
50
+ // Aligned with AgentsManager detail view: Enter returns to the list.
51
+ return { ...state, viewMode: "list" };
52
+ }
53
+
54
+ if (key.escape) {
55
+ if (state.viewMode === "detail") {
56
+ return { ...state, viewMode: "list" };
57
+ }
58
+ return { ...state, pendingEffect: { type: "CANCEL" } };
59
+ }
60
+
61
+ // Detail view does not respond to arrow keys (aligned with
62
+ // AgentsManager, which only Esc/Enter back to the list).
63
+ if (state.viewMode === "detail") {
64
+ return state;
65
+ }
66
+
67
+ if (key.upArrow) {
68
+ return {
69
+ ...state,
70
+ selectedIndex: Math.max(0, state.selectedIndex - 1),
71
+ };
72
+ }
73
+
74
+ if (key.downArrow) {
75
+ return {
76
+ ...state,
77
+ selectedIndex: Math.min(
78
+ Math.max(0, itemCount - 1),
79
+ state.selectedIndex + 1,
80
+ ),
81
+ };
82
+ }
83
+
84
+ return state;
85
+ }
86
+ case "CLEAR_PENDING_EFFECT":
87
+ return { ...state, pendingEffect: null };
88
+ default:
89
+ return state;
90
+ }
91
+ }
@@ -44,6 +44,7 @@ import {
44
44
  type SlashCommand,
45
45
  loadUserConfigEnv,
46
46
  type SubagentConfiguration,
47
+ type SkillMetadata,
47
48
  } from "wave-agent-sdk";
48
49
  import {
49
50
  type JsonRpcError,
@@ -241,6 +242,8 @@ export class AgentBridge {
241
242
  return this.getSlashCommands(sessionId);
242
243
  case "getSubagentConfigurations":
243
244
  return this.getSubagentConfigurations(sessionId);
245
+ case "getSkillMetadata":
246
+ return this.getSkillMetadata(sessionId);
244
247
 
245
248
  // ── File / History (global — no session required) ──
246
249
  case "searchFiles":
@@ -1076,6 +1079,11 @@ export class AgentBridge {
1076
1079
  return { configurations: entry.agent.getSubagentConfigurations() };
1077
1080
  }
1078
1081
 
1082
+ private getSkillMetadata(sessionId?: string): { skills: SkillMetadata[] } {
1083
+ const entry = this.requireSession(sessionId);
1084
+ return { skills: entry.agent.getSkillMetadata() };
1085
+ }
1086
+
1079
1087
  // ── File / History (global) ───────────────────────────────────
1080
1088
 
1081
1089
  private async searchFiles(
@@ -70,6 +70,8 @@ export type RequestMethod =
70
70
  | "connectMcpServer"
71
71
  | "disconnectMcpServer"
72
72
  | "getSlashCommands"
73
+ | "getSubagentConfigurations"
74
+ | "getSkillMetadata"
73
75
  | "searchFiles"
74
76
  | "writeArtifactFile"
75
77
  | "getPromptHistory"