@builder.io/ai-utils 0.33.0 → 0.34.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
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>${opts.content}</content>\n`;
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>${opts.content}</content>\n`;
137
+ xml += `<content>\n${opts.content.trim()}\n</content>\n`;
137
138
  xml += `</worker_message>\n`;
138
- xml += WORKER_REPORT_TRAILER;
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>${opts.content}</content>\n`;
185
+ result += `<content>\n${opts.content.trim()}\n</content>\n`;
166
186
  result += `</incoming_message>\n`;
167
187
  return result;
168
188
  }
package/src/codegen.d.ts CHANGED
@@ -1713,7 +1713,11 @@ export interface FusionConfig {
1713
1713
  proxyDefaultOrigin?: string;
1714
1714
  setupDependencies?: SetupDependency[];
1715
1715
  projectId?: string;
1716
+ /** Human-readable project name (e.g. "My App") */
1717
+ projectName?: string;
1716
1718
  branchName?: string;
1719
+ /** Human-readable branch name, AI-generated or user-set (e.g. "Add dark mode") */
1720
+ branchFriendlyName?: string;
1717
1721
  sessionId?: string;
1718
1722
  browserAutomationInstructions?: string;
1719
1723
  /** Whether this branch is for a code review - affects enabled agents and tools */
package/src/projects.d.ts CHANGED
@@ -363,6 +363,8 @@ export interface PartialBranchData {
363
363
  isFork?: boolean | null;
364
364
  /** Whether this branch is for a code review - affects enabled agents and tools*/
365
365
  type?: BranchType | null;
366
+ /** Auto-assigned category based on the user prompt (feature, fix, research, other) */
367
+ category?: BranchCategory | null;
366
368
  cloneFrom?: {
367
369
  projectId: string;
368
370
  branchName: string;
@@ -420,6 +422,8 @@ export interface OrgAgentConfig {
420
422
  longLived: boolean;
421
423
  }
422
424
  export type BranchType = "code-review" | "setup-project" | "org-agent" | "default";
425
+ /** Category of work a branch represents, auto-assigned during prompt analysis. */
426
+ export type BranchCategory = "feature" | "fix" | "research" | "other";
423
427
  export interface BranchSharedData {
424
428
  appName?: string | null;
425
429
  prNumber?: number | null;
@@ -489,6 +493,8 @@ export interface BranchSharedData {
489
493
  screenshots?: Record<string, string>;
490
494
  /** Whether this branch is for a code review - affects enabled agents and tools */
491
495
  type?: BranchType | null;
496
+ /** Auto-assigned category based on the user prompt (feature, fix, research, other) */
497
+ category?: BranchCategory | null;
492
498
  agentType?: AgentType | null;
493
499
  /** ID of the last PR review — doubles as the vcpCodeGenEvents completion ID for feedback */
494
500
  lastReviewId?: string | null;
@@ -808,6 +814,7 @@ export interface SettingUpContainerMessage extends BaseCreateBranchMessage {
808
814
  branchName: string;
809
815
  branchFriendlyName: string | undefined;
810
816
  branchDescription: string | undefined;
817
+ branchCategory: BranchCategory | undefined;
811
818
  }
812
819
  export interface ContainerReadyMessage extends BaseCreateBranchMessage {
813
820
  type: "container-ready";
@@ -974,4 +981,16 @@ export interface ExitPlanModeData {
974
981
  * Extracts the plan content and sessionMode from the tool's structured result
975
982
  */
976
983
  export declare function parseExitPlanMode(chunk: CreateBranchChunkMessage | SendMessageChunkMessage): ExitPlanModeData | null;
984
+ export interface CronJobConfig {
985
+ id: string;
986
+ cron: string;
987
+ description: string;
988
+ prompt: string;
989
+ enabled: boolean;
990
+ }
991
+ export interface OrgCronConfigOptions {
992
+ jobs: CronJobConfig[];
993
+ projectId: string;
994
+ branchName: string;
995
+ }
977
996
  export {};