@push.rocks/smartagent 1.8.0 → 3.0.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_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/index.d.ts +8 -14
- package/dist_ts/index.js +8 -24
- package/dist_ts/plugins.d.ts +8 -9
- package/dist_ts/plugins.js +10 -12
- package/dist_ts/smartagent.classes.agent.d.ts +2 -0
- package/dist_ts/smartagent.classes.agent.js +173 -0
- package/dist_ts/smartagent.classes.toolregistry.d.ts +7 -70
- package/dist_ts/smartagent.classes.toolregistry.js +11 -155
- package/dist_ts/smartagent.interfaces.d.ts +47 -283
- package/dist_ts/smartagent.interfaces.js +6 -7
- package/dist_ts/smartagent.utils.truncation.d.ts +10 -0
- package/dist_ts/smartagent.utils.truncation.js +26 -0
- package/dist_ts_compaction/index.d.ts +1 -0
- package/dist_ts_compaction/index.js +2 -0
- package/dist_ts_compaction/plugins.d.ts +4 -0
- package/dist_ts_compaction/plugins.js +3 -0
- package/dist_ts_compaction/smartagent.compaction.d.ts +10 -0
- package/dist_ts_compaction/smartagent.compaction.js +46 -0
- package/dist_ts_tools/index.d.ts +8 -0
- package/dist_ts_tools/index.js +6 -0
- package/dist_ts_tools/plugins.d.ts +15 -0
- package/dist_ts_tools/plugins.js +19 -0
- package/dist_ts_tools/tool.filesystem.d.ts +6 -0
- package/dist_ts_tools/tool.filesystem.js +102 -0
- package/dist_ts_tools/tool.http.d.ts +2 -0
- package/dist_ts_tools/tool.http.js +65 -0
- package/dist_ts_tools/tool.json.d.ts +2 -0
- package/dist_ts_tools/tool.json.js +47 -0
- package/dist_ts_tools/tool.shell.d.ts +8 -0
- package/dist_ts_tools/tool.shell.js +40 -0
- package/npmextra.json +1 -1
- package/package.json +30 -18
- package/readme.hints.md +38 -84
- package/readme.md +254 -682
- package/ts/00_commitinfo_data.ts +2 -2
- package/ts/index.ts +10 -37
- package/ts/plugins.ts +22 -21
- package/ts/smartagent.classes.agent.ts +198 -0
- package/ts/smartagent.classes.toolregistry.ts +11 -179
- package/ts/smartagent.interfaces.ts +51 -363
- package/ts/smartagent.utils.truncation.ts +39 -0
- package/ts_compaction/index.ts +1 -0
- package/ts_compaction/plugins.ts +6 -0
- package/ts_compaction/smartagent.compaction.ts +51 -0
- package/ts_tools/index.ts +8 -0
- package/ts_tools/plugins.ts +30 -0
- package/ts_tools/tool.filesystem.ts +131 -0
- package/ts_tools/tool.http.ts +78 -0
- package/ts_tools/tool.json.ts +53 -0
- package/ts_tools/tool.shell.ts +62 -0
- package/dist_ts/smartagent.classes.driveragent.d.ts +0 -134
- package/dist_ts/smartagent.classes.driveragent.js +0 -671
- package/dist_ts/smartagent.classes.dualagent.d.ts +0 -93
- package/dist_ts/smartagent.classes.dualagent.js +0 -614
- package/dist_ts/smartagent.classes.guardianagent.d.ts +0 -46
- package/dist_ts/smartagent.classes.guardianagent.js +0 -201
- package/dist_ts/smartagent.tools.base.d.ts +0 -52
- package/dist_ts/smartagent.tools.base.js +0 -42
- package/dist_ts/smartagent.tools.browser.d.ts +0 -17
- package/dist_ts/smartagent.tools.browser.js +0 -229
- package/dist_ts/smartagent.tools.deno.d.ts +0 -21
- package/dist_ts/smartagent.tools.deno.js +0 -191
- package/dist_ts/smartagent.tools.expert.d.ts +0 -27
- package/dist_ts/smartagent.tools.expert.js +0 -126
- package/dist_ts/smartagent.tools.filesystem.d.ts +0 -40
- package/dist_ts/smartagent.tools.filesystem.js +0 -801
- package/dist_ts/smartagent.tools.http.d.ts +0 -16
- package/dist_ts/smartagent.tools.http.js +0 -264
- package/dist_ts/smartagent.tools.json.d.ts +0 -24
- package/dist_ts/smartagent.tools.json.js +0 -202
- package/dist_ts/smartagent.tools.search.d.ts +0 -29
- package/dist_ts/smartagent.tools.search.js +0 -215
- package/dist_ts/smartagent.tools.shell.d.ts +0 -17
- package/dist_ts/smartagent.tools.shell.js +0 -202
- package/ts/smartagent.classes.driveragent.ts +0 -775
- package/ts/smartagent.classes.dualagent.ts +0 -692
- package/ts/smartagent.classes.guardianagent.ts +0 -241
- package/ts/smartagent.tools.base.ts +0 -83
- package/ts/smartagent.tools.browser.ts +0 -253
- package/ts/smartagent.tools.deno.ts +0 -230
- package/ts/smartagent.tools.expert.ts +0 -144
- package/ts/smartagent.tools.filesystem.ts +0 -885
- package/ts/smartagent.tools.http.ts +0 -283
- package/ts/smartagent.tools.json.ts +0 -224
- package/ts/smartagent.tools.search.ts +0 -237
- package/ts/smartagent.tools.shell.ts +0 -230
|
@@ -1,288 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export interface IToolMetadata {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
actions: IToolAction[];
|
|
15
|
-
visibility: TToolVisibility;
|
|
16
|
-
isActivated: boolean;
|
|
17
|
-
isInitialized: boolean;
|
|
18
|
-
tags?: string[];
|
|
19
|
-
category?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Options when registering a tool
|
|
23
|
-
*/
|
|
24
|
-
export interface IToolRegistrationOptions {
|
|
25
|
-
visibility?: TToolVisibility;
|
|
26
|
-
tags?: string[];
|
|
27
|
-
category?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Configuration for creating an Expert (SubAgent)
|
|
31
|
-
*/
|
|
32
|
-
export interface IExpertConfig {
|
|
33
|
-
/** Unique name for the expert */
|
|
34
|
-
name: string;
|
|
35
|
-
/** Description of the expert's capabilities */
|
|
36
|
-
description: string;
|
|
37
|
-
/** System message defining expert behavior */
|
|
38
|
-
systemMessage: string;
|
|
39
|
-
/** Guardian policy for the expert's inner agent */
|
|
40
|
-
guardianPolicy: string;
|
|
41
|
-
/** AI provider (defaults to parent's provider) */
|
|
42
|
-
provider?: plugins.smartai.TProvider;
|
|
43
|
-
/** Tools available to this expert */
|
|
44
|
-
tools?: IAgentToolWrapper[];
|
|
45
|
-
/** Max iterations for expert tasks (default: 10) */
|
|
46
|
-
maxIterations?: number;
|
|
47
|
-
/** Visibility mode (default: 'initial') */
|
|
48
|
-
visibility?: TToolVisibility;
|
|
49
|
-
/** Searchable tags */
|
|
50
|
-
tags?: string[];
|
|
51
|
-
/** Category for grouping */
|
|
52
|
-
category?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Options for running a task with the DualAgentOrchestrator
|
|
56
|
-
*/
|
|
57
|
-
export interface ITaskRunOptions {
|
|
58
|
-
/** Base64-encoded images to include with the task (for vision-capable models) */
|
|
59
|
-
images?: string[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Configuration options for the DualAgentOrchestrator
|
|
63
|
-
*/
|
|
64
|
-
export interface IDualAgentOptions extends plugins.smartai.ISmartAiOptions {
|
|
65
|
-
/** Existing SmartAi instance to reuse (avoids creating duplicate providers) */
|
|
66
|
-
smartAiInstance?: plugins.smartai.SmartAi;
|
|
67
|
-
/** Name of the agent system */
|
|
68
|
-
name?: string;
|
|
69
|
-
/** Default AI provider for both Driver and Guardian */
|
|
70
|
-
defaultProvider?: plugins.smartai.TProvider;
|
|
71
|
-
/** Optional separate provider for Guardian (for cost optimization) */
|
|
72
|
-
guardianProvider?: plugins.smartai.TProvider;
|
|
73
|
-
/** System message for the Driver agent */
|
|
74
|
-
driverSystemMessage?: string;
|
|
75
|
-
/** Policy prompt for the Guardian agent - REQUIRED */
|
|
76
|
-
guardianPolicyPrompt: string;
|
|
77
|
-
/** Maximum iterations for task completion (default: 20) */
|
|
78
|
-
maxIterations?: number;
|
|
79
|
-
/** Maximum consecutive rejections before aborting (default: 3) */
|
|
80
|
-
maxConsecutiveRejections?: number;
|
|
81
|
-
/** Enable verbose logging */
|
|
82
|
-
verbose?: boolean;
|
|
83
|
-
/** Maximum characters for tool result output before truncation (default: 15000). Set to 0 to disable. */
|
|
84
|
-
maxResultChars?: number;
|
|
85
|
-
/** Maximum history messages to pass to API (default: 20). Set to 0 for unlimited. */
|
|
86
|
-
maxHistoryMessages?: number;
|
|
87
|
-
/** Optional callback for live progress updates during execution */
|
|
88
|
-
onProgress?: (event: IProgressEvent) => void;
|
|
89
|
-
/** Prefix for log messages (e.g., "[README]", "[Commit]"). Default: empty */
|
|
90
|
-
logPrefix?: string;
|
|
91
|
-
/** Callback fired for each token during LLM generation (streaming mode) */
|
|
92
|
-
onToken?: (token: string, source: 'driver' | 'guardian') => void;
|
|
1
|
+
import type { ToolSet, ModelMessage, LanguageModelV3 } from './plugins.js';
|
|
2
|
+
export interface IAgentRunOptions {
|
|
3
|
+
/** The LanguageModelV3 to use — from smartai.getModel() */
|
|
4
|
+
model: LanguageModelV3;
|
|
5
|
+
/** Initial user message or task description */
|
|
6
|
+
prompt: string;
|
|
7
|
+
/** System prompt override */
|
|
8
|
+
system?: string;
|
|
9
|
+
/** Tools available to the agent */
|
|
10
|
+
tools?: ToolSet;
|
|
93
11
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
12
|
+
* Maximum number of LLM↔tool round trips.
|
|
13
|
+
* Each step may execute multiple tools in parallel.
|
|
14
|
+
* Default: 20
|
|
97
15
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
arguments: Record<string, unknown>;
|
|
131
|
-
index?: number;
|
|
16
|
+
maxSteps?: number;
|
|
17
|
+
/** Prior conversation messages to include */
|
|
18
|
+
messages?: ModelMessage[];
|
|
19
|
+
/** Called for each streamed text delta */
|
|
20
|
+
onToken?: (delta: string) => void;
|
|
21
|
+
/** Called when a tool call starts */
|
|
22
|
+
onToolCall?: (toolName: string, input: unknown) => void;
|
|
23
|
+
/** Called when a tool call completes */
|
|
24
|
+
onToolResult?: (toolName: string, result: unknown) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Called when total token usage approaches the model's context limit.
|
|
27
|
+
* Receives the full message history and must return a compacted replacement.
|
|
28
|
+
* If not provided, runAgent throws a ContextOverflowError instead.
|
|
29
|
+
*/
|
|
30
|
+
onContextOverflow?: (messages: ModelMessage[]) => Promise<ModelMessage[]>;
|
|
31
|
+
/** AbortSignal to cancel the run mid-flight */
|
|
32
|
+
abort?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export interface IAgentRunResult {
|
|
35
|
+
/** Final text output from the model */
|
|
36
|
+
text: string;
|
|
37
|
+
/** All messages in the completed conversation */
|
|
38
|
+
messages: ModelMessage[];
|
|
39
|
+
/** Total steps taken */
|
|
40
|
+
steps: number;
|
|
41
|
+
/** Finish reason from the final step */
|
|
42
|
+
finishReason: string;
|
|
43
|
+
/** Accumulated token usage across all steps */
|
|
44
|
+
usage: {
|
|
45
|
+
inputTokens: number;
|
|
46
|
+
outputTokens: number;
|
|
47
|
+
totalTokens: number;
|
|
132
48
|
};
|
|
133
49
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*/
|
|
137
|
-
export interface IToolCallProposal {
|
|
138
|
-
/** Unique ID for this proposal */
|
|
139
|
-
proposalId: string;
|
|
140
|
-
/** Name of the tool */
|
|
141
|
-
toolName: string;
|
|
142
|
-
/** Specific action to perform */
|
|
143
|
-
action: string;
|
|
144
|
-
/** Parameters for the action */
|
|
145
|
-
params: Record<string, unknown>;
|
|
146
|
-
/** Driver's reasoning for this call */
|
|
147
|
-
reasoning?: string;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Result of tool execution
|
|
151
|
-
*/
|
|
152
|
-
export interface IToolExecutionResult {
|
|
153
|
-
success: boolean;
|
|
154
|
-
result?: unknown;
|
|
155
|
-
error?: string;
|
|
156
|
-
/** Optional human-readable summary for history (if provided, used instead of full result) */
|
|
157
|
-
summary?: string;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Base interface for wrapped tools
|
|
161
|
-
*/
|
|
162
|
-
export interface IAgentToolWrapper {
|
|
163
|
-
/** Tool name */
|
|
164
|
-
name: string;
|
|
165
|
-
/** Tool description */
|
|
166
|
-
description: string;
|
|
167
|
-
/** Available actions */
|
|
168
|
-
actions: IToolAction[];
|
|
169
|
-
/** Initialize the tool */
|
|
170
|
-
initialize(): Promise<void>;
|
|
171
|
-
/** Cleanup resources */
|
|
172
|
-
cleanup(): Promise<void>;
|
|
173
|
-
/** Execute an action */
|
|
174
|
-
execute(action: string, params: Record<string, unknown>): Promise<IToolExecutionResult>;
|
|
175
|
-
/** Get a summary for Guardian review */
|
|
176
|
-
getCallSummary(action: string, params: Record<string, unknown>): string;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Request for Guardian evaluation
|
|
180
|
-
*/
|
|
181
|
-
export interface IGuardianEvaluationRequest {
|
|
182
|
-
/** The proposed tool call */
|
|
183
|
-
proposal: IToolCallProposal;
|
|
184
|
-
/** Current task context */
|
|
185
|
-
taskContext: string;
|
|
186
|
-
/** Recent conversation history (last N messages) */
|
|
187
|
-
recentHistory: IAgentMessage[];
|
|
188
|
-
/** Summary of what the tool call will do */
|
|
189
|
-
callSummary: string;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Guardian's decision
|
|
193
|
-
*/
|
|
194
|
-
export interface IGuardianDecision {
|
|
195
|
-
/** Approve or reject */
|
|
196
|
-
decision: 'approve' | 'reject';
|
|
197
|
-
/** Explanation of the decision */
|
|
198
|
-
reason: string;
|
|
199
|
-
/** Specific concerns if rejected */
|
|
200
|
-
concerns?: string[];
|
|
201
|
-
/** Suggestions for the Driver if rejected */
|
|
202
|
-
suggestions?: string;
|
|
203
|
-
/** Confidence level (0-1) */
|
|
204
|
-
confidence?: number;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Log entry for tool executions
|
|
208
|
-
*/
|
|
209
|
-
export interface IToolExecutionLog {
|
|
210
|
-
timestamp: Date;
|
|
211
|
-
toolName: string;
|
|
212
|
-
action: string;
|
|
213
|
-
params: Record<string, unknown>;
|
|
214
|
-
guardianDecision: 'approved' | 'rejected';
|
|
215
|
-
guardianReason: string;
|
|
216
|
-
executionResult?: unknown;
|
|
217
|
-
executionError?: string;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Status of a dual-agent run
|
|
221
|
-
*/
|
|
222
|
-
export type TDualAgentRunStatus = 'completed' | 'in_progress' | 'max_iterations_reached' | 'max_rejections_reached' | 'clarification_needed' | 'error';
|
|
223
|
-
/**
|
|
224
|
-
* Result of a dual-agent run
|
|
225
|
-
*/
|
|
226
|
-
export interface IDualAgentRunResult {
|
|
227
|
-
/** Whether the task was successful */
|
|
228
|
-
success: boolean;
|
|
229
|
-
/** Whether the task is completed */
|
|
230
|
-
completed: boolean;
|
|
231
|
-
/** Final result or response */
|
|
232
|
-
result: string;
|
|
233
|
-
/** Total iterations taken */
|
|
234
|
-
iterations: number;
|
|
235
|
-
/** Full conversation history */
|
|
236
|
-
history: IAgentMessage[];
|
|
237
|
-
/** Current status */
|
|
238
|
-
status: TDualAgentRunStatus;
|
|
239
|
-
/** Number of tool calls made */
|
|
240
|
-
toolCallCount?: number;
|
|
241
|
-
/** Number of Guardian rejections */
|
|
242
|
-
rejectionCount?: number;
|
|
243
|
-
/** Tool execution log */
|
|
244
|
-
toolLog?: IToolExecutionLog[];
|
|
245
|
-
/** Error message if status is 'error' */
|
|
246
|
-
error?: string;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Progress event types for live feedback during agent execution
|
|
250
|
-
*/
|
|
251
|
-
export type TProgressEventType = 'task_started' | 'iteration_started' | 'tool_proposed' | 'guardian_evaluating' | 'tool_approved' | 'tool_rejected' | 'tool_executing' | 'tool_completed' | 'task_completed' | 'clarification_needed' | 'max_iterations' | 'max_rejections';
|
|
252
|
-
/**
|
|
253
|
-
* Log level for progress events
|
|
254
|
-
*/
|
|
255
|
-
export type TLogLevel = 'info' | 'warn' | 'error' | 'success';
|
|
256
|
-
/**
|
|
257
|
-
* Progress event for live feedback during agent execution
|
|
258
|
-
*/
|
|
259
|
-
export interface IProgressEvent {
|
|
260
|
-
/** Type of progress event */
|
|
261
|
-
type: TProgressEventType;
|
|
262
|
-
/** Current iteration number */
|
|
263
|
-
iteration?: number;
|
|
264
|
-
/** Maximum iterations configured */
|
|
265
|
-
maxIterations?: number;
|
|
266
|
-
/** Name of the tool being used */
|
|
267
|
-
toolName?: string;
|
|
268
|
-
/** Action being performed */
|
|
269
|
-
action?: string;
|
|
270
|
-
/** Reason for rejection or other explanation */
|
|
271
|
-
reason?: string;
|
|
272
|
-
/** Human-readable message about the event */
|
|
273
|
-
message?: string;
|
|
274
|
-
/** Timestamp of the event */
|
|
275
|
-
timestamp: Date;
|
|
276
|
-
/** Log level for this event (info, warn, error, success) */
|
|
277
|
-
logLevel: TLogLevel;
|
|
278
|
-
/** Pre-formatted log message ready for output */
|
|
279
|
-
logMessage: string;
|
|
50
|
+
export declare class ContextOverflowError extends Error {
|
|
51
|
+
constructor(message?: string);
|
|
280
52
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Available tool names
|
|
283
|
-
*/
|
|
284
|
-
export type TToolName = 'filesystem' | 'http' | 'browser' | 'shell';
|
|
285
|
-
/**
|
|
286
|
-
* Generate a unique proposal ID
|
|
287
|
-
*/
|
|
288
|
-
export declare function generateProposalId(): string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return `proposal_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
1
|
+
export class ContextOverflowError extends Error {
|
|
2
|
+
constructor(message = 'Agent context limit reached and no onContextOverflow handler provided') {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'ContextOverflowError';
|
|
5
|
+
}
|
|
7
6
|
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhZ2VudC5pbnRlcmZhY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRhZ2VudC5pbnRlcmZhY2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWdEQSxNQUFNLE9BQU8sb0JBQXFCLFNBQVEsS0FBSztJQUM3QyxZQUFZLE9BQU8sR0FBRyx1RUFBdUU7UUFDM0YsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ2YsSUFBSSxDQUFDLElBQUksR0FBRyxzQkFBc0IsQ0FBQztJQUNyQyxDQUFDO0NBQ0YifQ==
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ITruncateResult {
|
|
2
|
+
content: string;
|
|
3
|
+
truncated: boolean;
|
|
4
|
+
/** Set when truncated: describes what was dropped */
|
|
5
|
+
notice?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function truncateOutput(text: string, options?: {
|
|
8
|
+
maxLines?: number;
|
|
9
|
+
maxBytes?: number;
|
|
10
|
+
}): ITruncateResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Truncation logic derived from opencode (MIT) — https://github.com/sst/opencode
|
|
2
|
+
const MAX_LINES = 2000;
|
|
3
|
+
const MAX_BYTES = 50 * 1024; // 50 KB
|
|
4
|
+
export function truncateOutput(text, options) {
|
|
5
|
+
const maxLines = options?.maxLines ?? MAX_LINES;
|
|
6
|
+
const maxBytes = options?.maxBytes ?? MAX_BYTES;
|
|
7
|
+
const lines = text.split('\n');
|
|
8
|
+
const totalBytes = Buffer.byteLength(text, 'utf-8');
|
|
9
|
+
if (lines.length <= maxLines && totalBytes <= maxBytes) {
|
|
10
|
+
return { content: text, truncated: false };
|
|
11
|
+
}
|
|
12
|
+
const out = [];
|
|
13
|
+
let bytes = 0;
|
|
14
|
+
for (let i = 0; i < lines.length && i < maxLines; i++) {
|
|
15
|
+
const size = Buffer.byteLength(lines[i], 'utf-8') + (i > 0 ? 1 : 0);
|
|
16
|
+
if (bytes + size > maxBytes)
|
|
17
|
+
break;
|
|
18
|
+
out.push(lines[i]);
|
|
19
|
+
bytes += size;
|
|
20
|
+
}
|
|
21
|
+
const kept = out.length;
|
|
22
|
+
const dropped = lines.length - kept;
|
|
23
|
+
const notice = `\n[Output truncated: showing ${kept}/${lines.length} lines. ${dropped} lines omitted.]`;
|
|
24
|
+
return { content: out.join('\n') + notice, truncated: true, notice };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhZ2VudC51dGlscy50cnVuY2F0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRhZ2VudC51dGlscy50cnVuY2F0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGlGQUFpRjtBQUVqRixNQUFNLFNBQVMsR0FBRyxJQUFJLENBQUM7QUFDdkIsTUFBTSxTQUFTLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQyxDQUFDLFFBQVE7QUFTckMsTUFBTSxVQUFVLGNBQWMsQ0FDNUIsSUFBWSxFQUNaLE9BQWtEO0lBRWxELE1BQU0sUUFBUSxHQUFHLE9BQU8sRUFBRSxRQUFRLElBQUksU0FBUyxDQUFDO0lBQ2hELE1BQU0sUUFBUSxHQUFHLE9BQ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BQ3hCLE1BQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxNQUFNLEdBQUcsSUFBSSxDQUFDO0lBQ3BDLE1BQU0sTUFBTSxHQUFHLGdDQUFnQyxJQUFJLElBQUksS0FBSyxDQUFDLE1BQU0sV0FBVyxPQUFPLGtCQUFrQixDQUFDO0lBQ3hHLE9BQU8sRUFBRSxPQUFPLEVBQUUsR0FBRyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxNQUFNLEVBQUUsU0FBUyxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsQ0FBQztBQUN2RSxDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { compactMessages } from './smartagent.compaction.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { compactMessages } from './smartagent.compaction.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c19jb21wYWN0aW9uL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQyJ9
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { generateText } from 'ai';
|
|
2
|
+
export { generateText };
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX2NvbXBhY3Rpb24vcGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sSUFBSSxDQUFDO0FBRWxDLE9BQU8sRUFBRSxZQUFZLEVBQUUsQ0FBQyJ9
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compacts a message history into a summary.
|
|
4
|
+
* Pass this as the onContextOverflow handler in IAgentRunOptions.
|
|
5
|
+
*
|
|
6
|
+
* @param model The same model used by runAgent, or a cheaper small model
|
|
7
|
+
* @param messages The full message history that overflowed
|
|
8
|
+
* @returns A minimal ModelMessage[] containing the summary as context
|
|
9
|
+
*/
|
|
10
|
+
export declare function compactMessages(model: plugins.LanguageModelV3, messages: plugins.ModelMessage[]): Promise<plugins.ModelMessage[]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
const COMPACTION_PROMPT = `Provide a detailed prompt for continuing our conversation above.
|
|
3
|
+
Focus on information that would be helpful for continuing the conversation, including what we did, what we're doing, which files we're working on, and what we're going to do next.
|
|
4
|
+
The summary that you construct will be used so that another agent can read it and continue the work.
|
|
5
|
+
|
|
6
|
+
When constructing the summary, try to stick to this template:
|
|
7
|
+
---
|
|
8
|
+
## Goal
|
|
9
|
+
[What goal(s) is the user trying to accomplish?]
|
|
10
|
+
|
|
11
|
+
## Instructions
|
|
12
|
+
- [What important instructions did the user give you that are relevant]
|
|
13
|
+
|
|
14
|
+
## Discoveries
|
|
15
|
+
[What notable things were learned during this conversation that would be useful for the next agent to know]
|
|
16
|
+
|
|
17
|
+
## Accomplished
|
|
18
|
+
[What work has been completed, what work is still in progress, and what work is left?]
|
|
19
|
+
|
|
20
|
+
## Relevant files / directories
|
|
21
|
+
[A structured list of relevant files that have been read, edited, or created]
|
|
22
|
+
---`;
|
|
23
|
+
/**
|
|
24
|
+
* Compacts a message history into a summary.
|
|
25
|
+
* Pass this as the onContextOverflow handler in IAgentRunOptions.
|
|
26
|
+
*
|
|
27
|
+
* @param model The same model used by runAgent, or a cheaper small model
|
|
28
|
+
* @param messages The full message history that overflowed
|
|
29
|
+
* @returns A minimal ModelMessage[] containing the summary as context
|
|
30
|
+
*/
|
|
31
|
+
export async function compactMessages(model, messages) {
|
|
32
|
+
const result = await plugins.generateText({
|
|
33
|
+
model,
|
|
34
|
+
messages: [
|
|
35
|
+
...messages,
|
|
36
|
+
{ role: 'user', content: COMPACTION_PROMPT },
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
role: 'user',
|
|
42
|
+
content: `[Previous conversation summary]\n\n${result.text}\n\n[End of summary. Continue from here.]`,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhZ2VudC5jb21wYWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfY29tcGFjdGlvbi9zbWFydGFnZW50LmNvbXBhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSxjQUFjLENBQUM7QUFFeEMsTUFBTSxpQkFBaUIsR0FBRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFvQnRCLENBQUM7QUFFTDs7Ozs7OztHQU9HO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxlQUFlLENBQ25DLEtBQThCLEVBQzlCLFFBQWdDO0lBRWhDLE1BQU0sTUFBTSxHQUFHLE1BQU0sT0FBTyxDQUFDLFlBQVksQ0FBQztRQUN4QyxLQUFLO1FBQ0wsUUFBUSxFQUFFO1lBQ1IsR0FBRyxRQUFRO1lBQ1gsRUFBRSxJQUFJLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRTtTQUM3QztLQUNGLENBQUMsQ0FBQztJQUVILE9BQU87UUFDTDtZQUNFLElBQUksRUFBRSxNQUFNO1lBQ1osT0FBTyxFQUFFLHNDQUFzQyxNQUFNLENBQUMsSUFBSSwyQ0FBMkM7U0FDdEc7S0FDRixDQUFDO0FBQ0osQ0FBQyJ9
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { filesystemTool } from './tool.filesystem.js';
|
|
2
|
+
export type { IFilesystemToolOptions } from './tool.filesystem.js';
|
|
3
|
+
export { shellTool } from './tool.shell.js';
|
|
4
|
+
export type { IShellToolOptions } from './tool.shell.js';
|
|
5
|
+
export { httpTool } from './tool.http.js';
|
|
6
|
+
export { jsonTool } from './tool.json.js';
|
|
7
|
+
export { truncateOutput } from './plugins.js';
|
|
8
|
+
export type { ITruncateResult } from './plugins.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { filesystemTool } from './tool.filesystem.js';
|
|
2
|
+
export { shellTool } from './tool.shell.js';
|
|
3
|
+
export { httpTool } from './tool.http.js';
|
|
4
|
+
export { jsonTool } from './tool.json.js';
|
|
5
|
+
export { truncateOutput } from './plugins.js';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c190b29scy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFdEQsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTVDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxQyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDMUMsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGNBQWMsQ0FBQyJ9
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
export { path, fs };
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export { z };
|
|
6
|
+
import { tool } from '@push.rocks/smartai';
|
|
7
|
+
export { tool };
|
|
8
|
+
export type { ToolSet } from 'ai';
|
|
9
|
+
import * as smartfs from '@push.rocks/smartfs';
|
|
10
|
+
import * as smartshell from '@push.rocks/smartshell';
|
|
11
|
+
import * as smartrequest from '@push.rocks/smartrequest';
|
|
12
|
+
export { smartfs, smartshell, smartrequest };
|
|
13
|
+
import { truncateOutput } from '../dist_ts/smartagent.utils.truncation.js';
|
|
14
|
+
export { truncateOutput };
|
|
15
|
+
export type { ITruncateResult } from '../dist_ts/smartagent.utils.truncation.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// node native
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
export { path, fs };
|
|
5
|
+
// zod
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export { z };
|
|
8
|
+
// ai-sdk
|
|
9
|
+
import { tool } from '@push.rocks/smartai';
|
|
10
|
+
export { tool };
|
|
11
|
+
// @push.rocks scope
|
|
12
|
+
import * as smartfs from '@push.rocks/smartfs';
|
|
13
|
+
import * as smartshell from '@push.rocks/smartshell';
|
|
14
|
+
import * as smartrequest from '@push.rocks/smartrequest';
|
|
15
|
+
export { smartfs, smartshell, smartrequest };
|
|
16
|
+
// cross-folder import
|
|
17
|
+
import { truncateOutput } from '../dist_ts/smartagent.utils.truncation.js';
|
|
18
|
+
export { truncateOutput };
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzX3Rvb2xzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYztBQUNkLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBQzdCLE9BQU8sS0FBSyxFQUFFLE1BQU0sSUFBSSxDQUFDO0FBRXpCLE9BQU8sRUFBRSxJQUFJLEVBQUUsRUFBRSxFQUFFLENBQUM7QUFFcEIsTUFBTTtBQUNOLE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFeEIsT0FBTyxFQUFFLENBQUMsRUFBRSxDQUFDO0FBRWIsU0FBUztBQUNULE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUUzQyxPQUFPLEVBQUUsSUFBSSxFQUFFLENBQUM7QUFJaEIsb0JBQW9CO0FBQ3BCLE9BQU8sS0FBSyxPQUFPLE1BQU0scUJBQXFCLENBQUM7QUFDL0MsT0FBTyxLQUFLLFVBQVUsTUFBTSx3QkFBd0IsQ0FBQztBQUNyRCxPQUFPLEtBQUssWUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBRXpELE9BQU8sRUFBRSxPQUFPLEVBQUUsVUFBVSxFQUFFLFlBQVksRUFBRSxDQUFDO0FBRTdDLHNCQUFzQjtBQUN0QixPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFFdEUsT0FBTyxFQUFFLGNBQWMsRUFBRSxDQUFDIn0=
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
export interface IFilesystemToolOptions {
|
|
3
|
+
/** Restrict file access to this directory. Default: process.cwd() */
|
|
4
|
+
rootDir?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function filesystemTool(options?: IFilesystemToolOptions): plugins.ToolSet;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
function validatePath(filePath, rootDir) {
|
|
3
|
+
const resolved = plugins.path.resolve(filePath);
|
|
4
|
+
if (rootDir) {
|
|
5
|
+
const resolvedRoot = plugins.path.resolve(rootDir);
|
|
6
|
+
if (!resolved.startsWith(resolvedRoot + plugins.path.sep) && resolved !== resolvedRoot) {
|
|
7
|
+
throw new Error(`Access denied: "${filePath}" is outside allowed root "${rootDir}"`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return resolved;
|
|
11
|
+
}
|
|
12
|
+
export function filesystemTool(options) {
|
|
13
|
+
const rootDir = options?.rootDir;
|
|
14
|
+
return {
|
|
15
|
+
read_file: plugins.tool({
|
|
16
|
+
description: 'Read file contents. Returns the full text or a specified line range.',
|
|
17
|
+
inputSchema: plugins.z.object({
|
|
18
|
+
path: plugins.z.string().describe('Absolute path to the file'),
|
|
19
|
+
startLine: plugins.z
|
|
20
|
+
.number()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('First line (1-indexed, inclusive)'),
|
|
23
|
+
endLine: plugins.z
|
|
24
|
+
.number()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Last line (1-indexed, inclusive)'),
|
|
27
|
+
}),
|
|
28
|
+
execute: async ({ path: filePath, startLine, endLine, }) => {
|
|
29
|
+
const resolved = validatePath(filePath, rootDir);
|
|
30
|
+
const content = plugins.fs.readFileSync(resolved, 'utf-8');
|
|
31
|
+
if (startLine !== undefined || endLine !== undefined) {
|
|
32
|
+
const lines = content.split('\n');
|
|
33
|
+
const start = (startLine ?? 1) - 1;
|
|
34
|
+
const end = endLine ?? lines.length;
|
|
35
|
+
const sliced = lines.slice(start, end).join('\n');
|
|
36
|
+
return plugins.truncateOutput(sliced).content;
|
|
37
|
+
}
|
|
38
|
+
return plugins.truncateOutput(content).content;
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
write_file: plugins.tool({
|
|
42
|
+
description: 'Write content to a file (creates parent dirs if needed, overwrites existing).',
|
|
43
|
+
inputSchema: plugins.z.object({
|
|
44
|
+
path: plugins.z.string().describe('Absolute path to the file'),
|
|
45
|
+
content: plugins.z.string().describe('Content to write'),
|
|
46
|
+
}),
|
|
47
|
+
execute: async ({ path: filePath, content }) => {
|
|
48
|
+
const resolved = validatePath(filePath, rootDir);
|
|
49
|
+
const dir = plugins.path.dirname(resolved);
|
|
50
|
+
plugins.fs.mkdirSync(dir, { recursive: true });
|
|
51
|
+
plugins.fs.writeFileSync(resolved, content, 'utf-8');
|
|
52
|
+
return `Written ${content.length} characters to ${filePath}`;
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
list_directory: plugins.tool({
|
|
56
|
+
description: 'List files and directories at the given path.',
|
|
57
|
+
inputSchema: plugins.z.object({
|
|
58
|
+
path: plugins.z.string().describe('Directory path to list'),
|
|
59
|
+
recursive: plugins.z
|
|
60
|
+
.boolean()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('List recursively (default: false)'),
|
|
63
|
+
}),
|
|
64
|
+
execute: async ({ path: dirPath, recursive, }) => {
|
|
65
|
+
const resolved = validatePath(dirPath, rootDir);
|
|
66
|
+
function listDir(dir, prefix = '') {
|
|
67
|
+
const entries = plugins.fs.readdirSync(dir, { withFileTypes: true });
|
|
68
|
+
const result = [];
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
71
|
+
const indicator = entry.isDirectory() ? '/' : '';
|
|
72
|
+
result.push(`${rel}${indicator}`);
|
|
73
|
+
if (recursive && entry.isDirectory()) {
|
|
74
|
+
result.push(...listDir(plugins.path.join(dir, entry.name), rel));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
const entries = listDir(resolved);
|
|
80
|
+
return plugins.truncateOutput(entries.join('\n')).content;
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
delete_file: plugins.tool({
|
|
84
|
+
description: 'Delete a file or empty directory.',
|
|
85
|
+
inputSchema: plugins.z.object({
|
|
86
|
+
path: plugins.z.string().describe('Path to delete'),
|
|
87
|
+
}),
|
|
88
|
+
execute: async ({ path: filePath }) => {
|
|
89
|
+
const resolved = validatePath(filePath, rootDir);
|
|
90
|
+
const stat = plugins.fs.statSync(resolved);
|
|
91
|
+
if (stat.isDirectory()) {
|
|
92
|
+
plugins.fs.rmdirSync(resolved);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
plugins.fs.unlinkSync(resolved);
|
|
96
|
+
}
|
|
97
|
+
return `Deleted ${filePath}`;
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbC5maWxlc3lzdGVtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHNfdG9vbHMvdG9vbC5maWxlc3lzdGVtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBT3hDLFNBQVMsWUFBWSxDQUFDLFFBQWdCLEVBQUUsT0FBZ0I7SUFDdEQsTUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDaEQsSUFBSSxPQUFPLEVBQUUsQ0FBQztRQUNaLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ25ELElBQUksQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFDLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLFFBQVEsS0FBSyxZQUFZLEVBQUUsQ0FBQztZQUN2RixNQUFNLElBQUksS0FBSyxDQUFDLG1CQUFtQixRQUFRLDhCQUE4QixPQUFPLEdBQUcsQ0FBQyxDQUFDO1FBQ3ZGLENBQUM7SUFDSCxDQUFDO0lBQ0QsT0FBTyxRQUFRLENBQUM7QUFDbEIsQ0FBQztBQUVELE1BQU0sVUFBVSxjQUFjLENBQUMsT0FBZ0M7SUFDN0QsTUFBTSxPQUFPLEdBQUcsT0FB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