@builder.io/ai-utils 0.33.0 → 0.33.1
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/package.json +1 -1
- package/src/claw.d.ts +19 -0
- package/src/claw.js +26 -6
- package/src/projects.d.ts +12 -0
package/package.json
CHANGED
package/src/claw.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export interface WorkerMessageOptions {
|
|
|
85
85
|
projectId?: string;
|
|
86
86
|
/** Branch name (for branch reports). */
|
|
87
87
|
branchName?: string;
|
|
88
|
+
/** Sender display name (e.g. "Branch Agent (proj-123/feat-my-feature)"). */
|
|
89
|
+
senderDisplayName?: string;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Formats a `<worker_report>` message for the org-agent.
|
|
@@ -95,6 +97,23 @@ export interface WorkerMessageOptions {
|
|
|
95
97
|
*/
|
|
96
98
|
export declare function formatWorkerReport(opts: WorkerReportOptions): string;
|
|
97
99
|
export declare function formatWorkerMessage(opts: WorkerMessageOptions): string;
|
|
100
|
+
export interface SystemMessageOptions {
|
|
101
|
+
/** Identifier of the system sender (e.g. "cron:daily_check"). */
|
|
102
|
+
senderId?: string;
|
|
103
|
+
/** Human-readable display name (e.g. "Cron Job Trigger: daily_check"). */
|
|
104
|
+
senderDisplayName?: string;
|
|
105
|
+
/** Pre-formatted timestamp string. */
|
|
106
|
+
timestamp: string;
|
|
107
|
+
/** The message body. */
|
|
108
|
+
content: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Formats a `<system_message>` for the org-agent.
|
|
112
|
+
*
|
|
113
|
+
* Used for autonomous system events (cron triggers, scheduled tasks, etc.)
|
|
114
|
+
* that are not user messages or worker reports.
|
|
115
|
+
*/
|
|
116
|
+
export declare function formatSystemMessage(opts: SystemMessageOptions): string;
|
|
98
117
|
export interface IncomingMessageOptions {
|
|
99
118
|
/** The source channel (e.g. slack/thread/TEAM/CHANNEL/TS). */
|
|
100
119
|
channelId: string;
|
package/src/claw.js
CHANGED
|
@@ -114,7 +114,7 @@ export function formatWorkerReport(opts) {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
xml += `<agent_id>${opts.agentId}</agent_id>\n`;
|
|
117
|
-
xml += `<content
|
|
117
|
+
xml += `<content>\n${opts.content.trim()}\n</content>\n`;
|
|
118
118
|
xml += `</worker_report>\n`;
|
|
119
119
|
xml += WORKER_REPORT_TRAILER;
|
|
120
120
|
return xml;
|
|
@@ -128,14 +128,34 @@ export function formatWorkerMessage(opts) {
|
|
|
128
128
|
xml += `<origin_channel_url>${url}</origin_channel_url>\n`;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
if (opts.senderDisplayName) {
|
|
132
|
+
xml += `<sender>${opts.senderDisplayName}</sender>\n`;
|
|
133
|
+
}
|
|
131
134
|
if (opts.projectId && opts.branchName) {
|
|
132
|
-
xml += `<project_id>${opts.projectId}</project_id>\n`;
|
|
133
|
-
xml += `<branch_name>${opts.branchName}</branch_name>\n`;
|
|
134
135
|
xml += `<channel_id>builder/branch/${opts.projectId}/${opts.branchName}</channel_id>\n`;
|
|
135
136
|
}
|
|
136
|
-
xml += `<content
|
|
137
|
+
xml += `<content>\n${opts.content.trim()}\n</content>\n`;
|
|
137
138
|
xml += `</worker_message>\n`;
|
|
138
|
-
xml
|
|
139
|
+
return xml;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Formats a `<system_message>` for the org-agent.
|
|
143
|
+
*
|
|
144
|
+
* Used for autonomous system events (cron triggers, scheduled tasks, etc.)
|
|
145
|
+
* that are not user messages or worker reports.
|
|
146
|
+
*/
|
|
147
|
+
export function formatSystemMessage(opts) {
|
|
148
|
+
let xml = `<system_message>\n`;
|
|
149
|
+
if (opts.senderId) {
|
|
150
|
+
xml += `<sender_id>${opts.senderId}</sender_id>\n`;
|
|
151
|
+
}
|
|
152
|
+
if (opts.senderDisplayName) {
|
|
153
|
+
xml += `<sender>${opts.senderDisplayName}</sender>\n`;
|
|
154
|
+
}
|
|
155
|
+
xml += `<timestamp>${opts.timestamp}</timestamp>\n`;
|
|
156
|
+
xml += `<content>\n${opts.content.trim()}\n</content>\n`;
|
|
157
|
+
xml += `</system_message>\n`;
|
|
158
|
+
xml += `This is an automated system message, NOT a user message. Execute the task described above.`;
|
|
139
159
|
return xml;
|
|
140
160
|
}
|
|
141
161
|
/**
|
|
@@ -162,7 +182,7 @@ export function formatIncomingMessage(opts) {
|
|
|
162
182
|
result += `<sender>${opts.sender}</sender>\n`;
|
|
163
183
|
}
|
|
164
184
|
result += `<timestamp>${opts.timestamp}</timestamp>\n`;
|
|
165
|
-
result += `<content
|
|
185
|
+
result += `<content>\n${opts.content.trim()}\n</content>\n`;
|
|
166
186
|
result += `</incoming_message>\n`;
|
|
167
187
|
return result;
|
|
168
188
|
}
|
package/src/projects.d.ts
CHANGED
|
@@ -974,4 +974,16 @@ export interface ExitPlanModeData {
|
|
|
974
974
|
* Extracts the plan content and sessionMode from the tool's structured result
|
|
975
975
|
*/
|
|
976
976
|
export declare function parseExitPlanMode(chunk: CreateBranchChunkMessage | SendMessageChunkMessage): ExitPlanModeData | null;
|
|
977
|
+
export interface CronJobConfig {
|
|
978
|
+
id: string;
|
|
979
|
+
cron: string;
|
|
980
|
+
description: string;
|
|
981
|
+
prompt: string;
|
|
982
|
+
enabled: boolean;
|
|
983
|
+
}
|
|
984
|
+
export interface OrgCronConfigOptions {
|
|
985
|
+
jobs: CronJobConfig[];
|
|
986
|
+
projectId: string;
|
|
987
|
+
branchName: string;
|
|
988
|
+
}
|
|
977
989
|
export {};
|