@iinm/plain-agent 1.8.2 → 1.8.4
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/README.md +6 -2
- package/bin/plain +1 -1
- package/config/config.predefined.json +1 -1
- package/config/prompts.predefined/shortcuts/configure.md +1 -1
- package/dist/main.mjs +473 -0
- package/dist/main.mjs.map +7 -0
- package/package.json +5 -7
- package/src/agent.d.ts +0 -52
- package/src/agent.mjs +0 -204
- package/src/agentLoop.mjs +0 -419
- package/src/agentState.mjs +0 -41
- package/src/claudeCodePlugin.mjs +0 -164
- package/src/cliArgs.mjs +0 -175
- package/src/cliBatch.mjs +0 -144
- package/src/cliCommands.mjs +0 -283
- package/src/cliCompleter.mjs +0 -227
- package/src/cliCost.mjs +0 -309
- package/src/cliFormatter.mjs +0 -413
- package/src/cliInteractive.mjs +0 -526
- package/src/cliInterruptTransform.mjs +0 -51
- package/src/cliMuteTransform.mjs +0 -26
- package/src/cliPasteTransform.mjs +0 -183
- package/src/config.d.ts +0 -36
- package/src/config.mjs +0 -197
- package/src/context/loadAgentRoles.mjs +0 -283
- package/src/context/loadPrompts.mjs +0 -324
- package/src/context/loadUserMessageContext.mjs +0 -147
- package/src/costTracker.mjs +0 -210
- package/src/env.mjs +0 -44
- package/src/main.mjs +0 -278
- package/src/mcpClient.mjs +0 -351
- package/src/mcpIntegration.mjs +0 -160
- package/src/model.d.ts +0 -109
- package/src/modelCaller.mjs +0 -32
- package/src/modelDefinition.d.ts +0 -92
- package/src/prompt.mjs +0 -138
- package/src/providers/anthropic.d.ts +0 -248
- package/src/providers/anthropic.mjs +0 -587
- package/src/providers/bedrock.d.ts +0 -249
- package/src/providers/bedrock.mjs +0 -700
- package/src/providers/gemini.d.ts +0 -208
- package/src/providers/gemini.mjs +0 -754
- package/src/providers/openai.d.ts +0 -281
- package/src/providers/openai.mjs +0 -544
- package/src/providers/openaiCompatible.d.ts +0 -147
- package/src/providers/openaiCompatible.mjs +0 -652
- package/src/providers/platform/awsSigV4.mjs +0 -184
- package/src/providers/platform/azure.mjs +0 -42
- package/src/providers/platform/bedrock.mjs +0 -78
- package/src/providers/platform/googleCloud.mjs +0 -34
- package/src/subagent.mjs +0 -265
- package/src/tmpfile.mjs +0 -27
- package/src/tool.d.ts +0 -74
- package/src/toolExecutor.mjs +0 -236
- package/src/toolInputValidator.mjs +0 -183
- package/src/toolUseApprover.mjs +0 -99
- package/src/tools/askURL.mjs +0 -209
- package/src/tools/askWeb.mjs +0 -208
- package/src/tools/compactContext.d.ts +0 -4
- package/src/tools/compactContext.mjs +0 -87
- package/src/tools/delegateToSubagent.d.ts +0 -4
- package/src/tools/delegateToSubagent.mjs +0 -48
- package/src/tools/execCommand.d.ts +0 -22
- package/src/tools/execCommand.mjs +0 -200
- package/src/tools/patchFile.d.ts +0 -4
- package/src/tools/patchFile.mjs +0 -133
- package/src/tools/reportAsSubagent.d.ts +0 -3
- package/src/tools/reportAsSubagent.mjs +0 -44
- package/src/tools/tmuxCommand.d.ts +0 -14
- package/src/tools/tmuxCommand.mjs +0 -194
- package/src/tools/writeFile.d.ts +0 -4
- package/src/tools/writeFile.mjs +0 -56
- package/src/usageStore.mjs +0 -167
- package/src/utils/evalJSONConfig.mjs +0 -72
- package/src/utils/matchValue.d.ts +0 -6
- package/src/utils/matchValue.mjs +0 -40
- package/src/utils/noThrow.mjs +0 -31
- package/src/utils/notify.mjs +0 -29
- package/src/utils/parseFileRange.mjs +0 -18
- package/src/utils/readFileRange.mjs +0 -33
- package/src/utils/retryOnError.mjs +0 -41
- package/src/voiceInput.mjs +0 -61
- package/src/voiceInputGemini.mjs +0 -105
- package/src/voiceInputOpenAI.mjs +0 -104
- package/src/voiceInputSession.mjs +0 -543
- package/src/voiceToggleKey.mjs +0 -62
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/* Model Configuration */
|
|
2
|
-
export type BedrockConverseModelConfig = {
|
|
3
|
-
model: string;
|
|
4
|
-
inferenceConfig?: {
|
|
5
|
-
maxTokens?: number;
|
|
6
|
-
temperature?: number;
|
|
7
|
-
topP?: number;
|
|
8
|
-
};
|
|
9
|
-
additionalModelRequestFields?: Record<string, unknown>;
|
|
10
|
-
enablePromptCaching?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/* Request */
|
|
14
|
-
export type BedrockConverseRequest = {
|
|
15
|
-
modelId?: string;
|
|
16
|
-
messages: BedrockMessage[];
|
|
17
|
-
system?: BedrockSystemContentBlock[];
|
|
18
|
-
toolConfig?: BedrockToolConfig;
|
|
19
|
-
additionalModelRequestFields?: Record<string, unknown>;
|
|
20
|
-
inferenceConfig?: {
|
|
21
|
-
maxTokens?: number;
|
|
22
|
-
temperature?: number;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/* Message */
|
|
27
|
-
export type BedrockMessage = BedrockUserMessage | BedrockAssistantMessage;
|
|
28
|
-
|
|
29
|
-
export type BedrockUserMessage = {
|
|
30
|
-
role: "user";
|
|
31
|
-
content: BedrockContentBlock[];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type BedrockAssistantMessage = {
|
|
35
|
-
role: "assistant";
|
|
36
|
-
content: BedrockAssistantContentBlock[];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type BedrockSystemContentBlock =
|
|
40
|
-
| {
|
|
41
|
-
text: string;
|
|
42
|
-
}
|
|
43
|
-
| BedrockCachePointBlock;
|
|
44
|
-
|
|
45
|
-
/* Content Block */
|
|
46
|
-
export type BedrockContentBlock =
|
|
47
|
-
| BedrockTextBlock
|
|
48
|
-
| BedrockImageBlock
|
|
49
|
-
| BedrockToolUseBlock
|
|
50
|
-
| BedrockToolResultBlock
|
|
51
|
-
| BedrockCachePointBlock;
|
|
52
|
-
|
|
53
|
-
export type BedrockAssistantContentBlock =
|
|
54
|
-
| BedrockTextBlock
|
|
55
|
-
| BedrockToolUseBlock
|
|
56
|
-
| BedrockReasoningContentBlock
|
|
57
|
-
| BedrockCachePointBlock;
|
|
58
|
-
|
|
59
|
-
export type BedrockTextBlock = {
|
|
60
|
-
text: string;
|
|
61
|
-
cachePoint?: {
|
|
62
|
-
type: "default";
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export type BedrockImageBlock = {
|
|
67
|
-
image: {
|
|
68
|
-
format: "png" | "jpeg" | "gif" | "webp";
|
|
69
|
-
source: {
|
|
70
|
-
bytes?: string; // base64 encoded
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type BedrockToolUseBlock = {
|
|
76
|
-
toolUse: {
|
|
77
|
-
toolUseId: string;
|
|
78
|
-
name: string;
|
|
79
|
-
input: Record<string, unknown>;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type BedrockToolResultBlock = {
|
|
84
|
-
toolResult: {
|
|
85
|
-
toolUseId: string;
|
|
86
|
-
content: BedrockToolResultContent[];
|
|
87
|
-
status?: "success" | "error";
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export type BedrockToolResultContent =
|
|
92
|
-
| { text: string }
|
|
93
|
-
| { image: BedrockImageBlock["image"] };
|
|
94
|
-
|
|
95
|
-
// Message history type - used when sending back to API
|
|
96
|
-
// Claude Haiku 4.5 and Nova use this format
|
|
97
|
-
// Note: reasoningText and redactedContent are mutually exclusive (union type)
|
|
98
|
-
export type BedrockReasoningContentBlock = {
|
|
99
|
-
reasoningContent:
|
|
100
|
-
| {
|
|
101
|
-
reasoningText: {
|
|
102
|
-
text: string;
|
|
103
|
-
signature?: string;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
| {
|
|
107
|
-
redactedContent: string; // Base64-encoded binary
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Internal type for accumulating reasoning content during streaming
|
|
112
|
-
// Note: Streaming API uses flat structure (reasoningContent.text, reasoningContent.redactedContent)
|
|
113
|
-
// but message history uses nested structure (reasoningContent.reasoningText.text, reasoningContent.redactedContent)
|
|
114
|
-
export type BedrockReasoningContentAccumulator = {
|
|
115
|
-
reasoningContent: {
|
|
116
|
-
text?: string;
|
|
117
|
-
signature?: string;
|
|
118
|
-
redactedContent?: string; // Base64-encoded binary
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// Internal type for accumulating partial content during streaming
|
|
123
|
-
// Note: reasoningContent uses flat structure during streaming, but nested structure in message history
|
|
124
|
-
export type BedrockAssistantContentBlockWithPartial = {
|
|
125
|
-
text?: string;
|
|
126
|
-
toolUse?: {
|
|
127
|
-
toolUseId?: string;
|
|
128
|
-
name?: string;
|
|
129
|
-
input?: unknown;
|
|
130
|
-
};
|
|
131
|
-
reasoningContent?: {
|
|
132
|
-
text?: string;
|
|
133
|
-
signature?: string;
|
|
134
|
-
redactedContent?: string; // Base64-encoded binary
|
|
135
|
-
};
|
|
136
|
-
cachePoint?: {
|
|
137
|
-
type: "default";
|
|
138
|
-
};
|
|
139
|
-
_partialInput?: string;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export type BedrockCachePointBlock = {
|
|
143
|
-
cachePoint: {
|
|
144
|
-
type: "default";
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
/* Tool Configuration */
|
|
149
|
-
export type BedrockToolConfig = {
|
|
150
|
-
tools: BedrockTool[];
|
|
151
|
-
toolChoice?: BedrockToolChoice;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export type BedrockTool = {
|
|
155
|
-
toolSpec: {
|
|
156
|
-
name: string;
|
|
157
|
-
description?: string;
|
|
158
|
-
inputSchema: {
|
|
159
|
-
json: Record<string, unknown>;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export type BedrockToolChoice =
|
|
165
|
-
| { auto: Record<string, never> }
|
|
166
|
-
| { any: Record<string, never> }
|
|
167
|
-
| { tool: { name: string } };
|
|
168
|
-
|
|
169
|
-
/* Response */
|
|
170
|
-
export type BedrockConverseResponse = {
|
|
171
|
-
metrics: {
|
|
172
|
-
latencyMs: number;
|
|
173
|
-
};
|
|
174
|
-
output: {
|
|
175
|
-
message: BedrockAssistantMessage;
|
|
176
|
-
};
|
|
177
|
-
stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
|
|
178
|
-
usage: BedrockUsage;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/* Usage */
|
|
182
|
-
export type BedrockUsage = {
|
|
183
|
-
inputTokens: number;
|
|
184
|
-
outputTokens: number;
|
|
185
|
-
totalTokens: number;
|
|
186
|
-
cacheReadInputTokens?: number;
|
|
187
|
-
cacheWriteInputTokens?: number;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/* Stream Event */
|
|
191
|
-
export type BedrockStreamEvent =
|
|
192
|
-
| BedrockStreamMessageStartEvent
|
|
193
|
-
| BedrockStreamContentBlockStartEvent
|
|
194
|
-
| BedrockStreamContentBlockDeltaEvent
|
|
195
|
-
| BedrockStreamContentBlockStopEvent
|
|
196
|
-
| BedrockStreamMessageStopEvent
|
|
197
|
-
| BedrockStreamMetadataEvent;
|
|
198
|
-
|
|
199
|
-
export type BedrockStreamMessageStartEvent = {
|
|
200
|
-
messageStart: {
|
|
201
|
-
requestId: string;
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export type BedrockStreamContentBlockStartEvent = {
|
|
206
|
-
contentBlockIndex: number;
|
|
207
|
-
start: {
|
|
208
|
-
text?: string;
|
|
209
|
-
toolUse?: {
|
|
210
|
-
toolUseId: string;
|
|
211
|
-
name: string;
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export type BedrockStreamContentBlockDeltaEvent = {
|
|
217
|
-
contentBlockIndex: number;
|
|
218
|
-
delta: {
|
|
219
|
-
text?: string;
|
|
220
|
-
toolUse?: {
|
|
221
|
-
toolUseId?: string;
|
|
222
|
-
name?: string;
|
|
223
|
-
input?: string; // partial JSON
|
|
224
|
-
};
|
|
225
|
-
reasoningContent?: {
|
|
226
|
-
text?: string;
|
|
227
|
-
signature?: string;
|
|
228
|
-
redactedContent?: string; // Base64-encoded binary
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export type BedrockStreamContentBlockStopEvent = {
|
|
234
|
-
contentBlockStop: {
|
|
235
|
-
contentBlockIndex: number;
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export type BedrockStreamMessageStopEvent = {
|
|
240
|
-
stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
|
|
241
|
-
additionalModelResponseFields?: Record<string, unknown>;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export type BedrockStreamMetadataEvent = {
|
|
245
|
-
usage: BedrockUsage;
|
|
246
|
-
metrics: {
|
|
247
|
-
latencyMs: number;
|
|
248
|
-
};
|
|
249
|
-
};
|