wave-agent-sdk 1.1.4 → 1.2.0
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/agent.d.ts +72 -24
- package/dist/agent.js +123 -31
- package/dist/builtin/plugins.js +17 -2
- package/dist/builtin/skills/settings.js +6 -8
- package/dist/core/plugin.d.ts +4 -0
- package/dist/core/plugin.js +7 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/managers/aiManager.d.ts +0 -24
- package/dist/managers/aiManager.js +23 -181
- package/dist/managers/bashModeManager.d.ts +33 -0
- package/dist/managers/bashModeManager.js +110 -0
- package/dist/managers/hookManager.d.ts +5 -0
- package/dist/managers/hookManager.js +7 -0
- package/dist/managers/liveConfigManager.js +3 -3
- package/dist/managers/mcpManager.d.ts +23 -0
- package/dist/managers/mcpManager.js +162 -14
- package/dist/managers/messageManager.d.ts +12 -13
- package/dist/managers/messageManager.js +63 -60
- package/dist/managers/permissionManager.d.ts +29 -0
- package/dist/managers/permissionManager.js +158 -70
- package/dist/managers/planManager.d.ts +9 -0
- package/dist/managers/planManager.js +19 -1
- package/dist/managers/skillManager.d.ts +31 -0
- package/dist/managers/skillManager.js +122 -12
- package/dist/managers/slashCommandManager.js +9 -28
- package/dist/managers/subagentManager.d.ts +7 -0
- package/dist/managers/subagentManager.js +61 -9
- package/dist/managers/workflowManager.js +6 -0
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +0 -4
- package/dist/services/MarketplaceService.js +36 -14
- package/dist/services/configurationService.d.ts +34 -2
- package/dist/services/configurationService.js +123 -16
- package/dist/services/initializationService.js +2 -2
- package/dist/services/jsonlHandler.d.ts +14 -0
- package/dist/services/jsonlHandler.js +44 -1
- package/dist/services/memory.d.ts +14 -0
- package/dist/services/memory.js +33 -0
- package/dist/services/officialMarketplaceMirror.d.ts +85 -0
- package/dist/services/officialMarketplaceMirror.js +289 -0
- package/dist/services/remoteSettingsService.js +4 -4
- package/dist/services/session.js +30 -13
- package/dist/services/worktreeHooks.js +6 -1
- package/dist/stdio/index.d.ts +10 -0
- package/dist/stdio/index.js +10 -0
- package/dist/stdio/notificationRouter.d.ts +38 -0
- package/dist/stdio/notificationRouter.js +96 -0
- package/dist/stdio/rpcClient.d.ts +18 -0
- package/dist/stdio/rpcClient.js +10 -0
- package/dist/stdio/stdioAgent.d.ts +222 -0
- package/dist/stdio/stdioAgent.js +341 -0
- package/dist/tools/bashTool.js +2 -0
- package/dist/tools/exitPlanMode.js +10 -2
- package/dist/types/agent.d.ts +8 -0
- package/dist/types/commands.d.ts +7 -0
- package/dist/types/configuration.d.ts +6 -1
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/hooks.js +19 -0
- package/dist/types/mcp.d.ts +3 -0
- package/dist/types/messaging.d.ts +1 -8
- package/dist/types/skills.d.ts +11 -0
- package/dist/utils/bashParser.d.ts +17 -0
- package/dist/utils/bashParser.js +72 -0
- package/dist/utils/bashStructure/bashLexer.d.ts +96 -0
- package/dist/utils/bashStructure/bashLexer.js +676 -0
- package/dist/utils/bashStructure/bashParser.d.ts +144 -0
- package/dist/utils/bashStructure/bashParser.js +606 -0
- package/dist/utils/bashStructure/bashSemantics.d.ts +70 -0
- package/dist/utils/bashStructure/bashSemantics.js +477 -0
- package/dist/utils/bashStructure/index.d.ts +26 -0
- package/dist/utils/bashStructure/index.js +27 -0
- package/dist/utils/bashStructure/types.d.ts +62 -0
- package/dist/utils/bashStructure/types.js +47 -0
- package/dist/utils/container.d.ts +6 -0
- package/dist/utils/container.js +9 -0
- package/dist/utils/containerSetup.d.ts +11 -1
- package/dist/utils/containerSetup.js +26 -11
- package/dist/utils/fileUtils.d.ts +11 -0
- package/dist/utils/fileUtils.js +37 -0
- package/dist/utils/messageOperations.d.ts +0 -18
- package/dist/utils/messageOperations.js +0 -62
- package/dist/utils/subagentParser.js +9 -2
- package/dist/utils/tokenCalculation.js +0 -8
- package/dist/utils/worktreeUtils.d.ts +2 -1
- package/dist/utils/worktreeUtils.js +64 -34
- package/package.json +6 -1
- package/dist/managers/bangManager.d.ts +0 -26
- package/dist/managers/bangManager.js +0 -78
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursive-descent parser for the structure-aware bash parser.
|
|
3
|
+
*
|
|
4
|
+
* Consumes the token stream from `bashLexer.ts` and produces a light AST that
|
|
5
|
+
* preserves shell structure: command lists/and-or chains, pipelines,
|
|
6
|
+
* subshells/brace groups, for/while/until/if/case loops and function
|
|
7
|
+
* definitions. Each structural token (do/done/then/fi/esac…) is consumed by
|
|
8
|
+
* the parser and never reaches the semantic layer as a "command".
|
|
9
|
+
*
|
|
10
|
+
* The grammar handled here is deliberately the subset bash uses in agent
|
|
11
|
+
* tool commands:
|
|
12
|
+
* program := list (sep list)* sep ∈ {newline, ';', eof}
|
|
13
|
+
* list := andor (op andor)* op ∈ {&& || | |& &}
|
|
14
|
+
* andor := command
|
|
15
|
+
* command := simple | subshell | brace-group | for | while | until
|
|
16
|
+
* | if | case | function | select
|
|
17
|
+
*
|
|
18
|
+
* Anything not modelled (heredocs, arithmetic expansion, brace expansion,
|
|
19
|
+
* process substitution, `${x:-y}`-style parameter expansion, unterminated
|
|
20
|
+
* constructs) is a FAILURE: `parseProgram` returns null and the caller treats
|
|
21
|
+
* it as a fail-closed "unsupported" result (ask instead of auto-allowing).
|
|
22
|
+
*/
|
|
23
|
+
import { type Token, type WordToken } from "./bashLexer.js";
|
|
24
|
+
/** A simple command: a word list (may start with VAR=value assignments). */
|
|
25
|
+
export interface CmdNode {
|
|
26
|
+
kind: "cmd";
|
|
27
|
+
words: WordToken[];
|
|
28
|
+
}
|
|
29
|
+
export interface ForNode {
|
|
30
|
+
kind: "for";
|
|
31
|
+
/** Select-style loops (select name [in words]) parsed as `for`. */
|
|
32
|
+
varName: string;
|
|
33
|
+
/** Iteration words — null when no `in` clause (implicit "$@"). */
|
|
34
|
+
iter: WordToken[];
|
|
35
|
+
body: StmtNode[];
|
|
36
|
+
}
|
|
37
|
+
export interface WhileNode {
|
|
38
|
+
kind: "while";
|
|
39
|
+
until: boolean;
|
|
40
|
+
cond: StmtNode[];
|
|
41
|
+
body: StmtNode[];
|
|
42
|
+
}
|
|
43
|
+
export interface IfClause {
|
|
44
|
+
cond: StmtNode[];
|
|
45
|
+
body: StmtNode[];
|
|
46
|
+
}
|
|
47
|
+
export interface IfNode {
|
|
48
|
+
kind: "if";
|
|
49
|
+
clauses: IfClause[];
|
|
50
|
+
elseBody: StmtNode[] | null;
|
|
51
|
+
}
|
|
52
|
+
export interface CaseArm {
|
|
53
|
+
/** Pattern words (may contain `|` alternatives joined already). */
|
|
54
|
+
patterns: WordToken[];
|
|
55
|
+
body: StmtNode[];
|
|
56
|
+
}
|
|
57
|
+
export interface CaseNode {
|
|
58
|
+
kind: "case";
|
|
59
|
+
word: WordToken;
|
|
60
|
+
arms: CaseArm[];
|
|
61
|
+
}
|
|
62
|
+
export interface FuncNode {
|
|
63
|
+
kind: "function";
|
|
64
|
+
name: string;
|
|
65
|
+
body: StmtNode[];
|
|
66
|
+
}
|
|
67
|
+
export interface SubshellNode {
|
|
68
|
+
kind: "subshell";
|
|
69
|
+
body: StmtNode[];
|
|
70
|
+
}
|
|
71
|
+
export interface GroupNode {
|
|
72
|
+
kind: "group";
|
|
73
|
+
body: StmtNode[];
|
|
74
|
+
}
|
|
75
|
+
/** A chain step: body plus whether varScope should fork after it. */
|
|
76
|
+
export interface ChainStep {
|
|
77
|
+
nodes: StmtNode[];
|
|
78
|
+
/** true → following steps run in a forked scope (|| | & |& …). */
|
|
79
|
+
forkAfter: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** An and-or chain inside a statement position. */
|
|
82
|
+
export interface ListNode {
|
|
83
|
+
kind: "list";
|
|
84
|
+
steps: ChainStep[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A compound command with trailing redirections (`while …; done < input`).
|
|
88
|
+
* The redirect words bind to the whole compound, not the last inner command.
|
|
89
|
+
*/
|
|
90
|
+
export interface RedirectsNode {
|
|
91
|
+
kind: "redirects";
|
|
92
|
+
target: StmtNode;
|
|
93
|
+
/** Redirect operator + target word tokens (`<`, `input`, …). */
|
|
94
|
+
redirects: WordToken[];
|
|
95
|
+
}
|
|
96
|
+
export type StmtNode = CmdNode | ForNode | WhileNode | IfNode | CaseNode | FuncNode | SubshellNode | GroupNode | ListNode | RedirectsNode;
|
|
97
|
+
export type Program = StmtNode[];
|
|
98
|
+
export declare class BashParser {
|
|
99
|
+
private tokens;
|
|
100
|
+
private pos;
|
|
101
|
+
private depth;
|
|
102
|
+
constructor(tokens: Token[]);
|
|
103
|
+
/** Parse the full token stream. */
|
|
104
|
+
parseProgram(): Program | null;
|
|
105
|
+
private peek;
|
|
106
|
+
private next;
|
|
107
|
+
private isOp;
|
|
108
|
+
/** True when the current word is a bare (unquoted) keyword. */
|
|
109
|
+
private isBareWord;
|
|
110
|
+
/** Skip newline tokens. */
|
|
111
|
+
private skipNl;
|
|
112
|
+
/**
|
|
113
|
+
* Parse statements until a terminator in `stop` (as bare keyword) or a
|
|
114
|
+
* closing op. Used for compound bodies (do…done, then…fi, case arms).
|
|
115
|
+
*/
|
|
116
|
+
private parseSequence;
|
|
117
|
+
/** Parse an and-or chain: cmd (&&|… cmd)* */
|
|
118
|
+
private parseChain;
|
|
119
|
+
/** Parse a single command (simple or compound). Returns nodes array. */
|
|
120
|
+
private parseCommand;
|
|
121
|
+
/**
|
|
122
|
+
* Absorb redirections that trail a compound command (e.g. the `< input.txt`
|
|
123
|
+
* in `while read x; do …; done < input.txt`). Shell grammar binds them to
|
|
124
|
+
* the whole compound; we wrap it in a RedirectsNode so the semantic layer can
|
|
125
|
+
* attach the redirect text to the compound's last leaf command.
|
|
126
|
+
*/
|
|
127
|
+
private absorbTrailingRedirects;
|
|
128
|
+
private parseIf;
|
|
129
|
+
private parseWhile;
|
|
130
|
+
private parseFor;
|
|
131
|
+
private parseCase;
|
|
132
|
+
private parseFunctionKw;
|
|
133
|
+
/** Detect `name() { …; }` form. Must be called at a simple-command word. */
|
|
134
|
+
private tryParseFunctionDecl;
|
|
135
|
+
/** Parse `{ …; }` compound body for function definitions. */
|
|
136
|
+
private parseBraceBody;
|
|
137
|
+
/** Collect words of a simple command until a chain separator. */
|
|
138
|
+
private parseSimpleCommandWords;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parse a token stream into a program. Returns null on any construct that
|
|
142
|
+
* cannot be statically modelled (fail-closed → caller asks).
|
|
143
|
+
*/
|
|
144
|
+
export declare function parseTokens(tokens: Token[]): Program | null;
|