@builder.io/ai-utils 0.58.1 → 0.60.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 +1 -1
- package/src/claw.d.ts +6 -0
- package/src/claw.js +9 -0
- package/src/claw.spec.js +27 -0
- package/src/codegen.d.ts +2818 -1003
- package/src/codegen.js +1885 -0
- package/src/design-systems.d.ts +38 -0
- package/src/design-systems.js +14 -0
- package/src/events.d.ts +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/mapping.d.ts +13 -12
- package/src/mapping.js +15 -1
- package/src/messages.d.ts +305 -107
- package/src/messages.js +158 -0
- package/src/projects.d.ts +145 -16
- package/src/projects.js +24 -0
package/package.json
CHANGED
package/src/claw.d.ts
CHANGED
|
@@ -78,6 +78,8 @@ export interface WorkerReportOptions {
|
|
|
78
78
|
originChannelId?: string;
|
|
79
79
|
/** Clickable URL for the origin channel, if the integration already has one. */
|
|
80
80
|
channelUrl?: string;
|
|
81
|
+
/** Human-readable name for the origin channel, if the integration has one. */
|
|
82
|
+
channelName?: string;
|
|
81
83
|
/** The report content. */
|
|
82
84
|
content: string;
|
|
83
85
|
/** Agent/tool ID (for sub-agent reports). */
|
|
@@ -88,6 +90,8 @@ export interface WorkerMessageOptions {
|
|
|
88
90
|
originChannelId?: string;
|
|
89
91
|
/** Clickable URL for the origin channel, if the integration already has one. */
|
|
90
92
|
channelUrl?: string;
|
|
93
|
+
/** Human-readable name for the origin channel, if the integration has one. */
|
|
94
|
+
channelName?: string;
|
|
91
95
|
/** The report content. */
|
|
92
96
|
content: string;
|
|
93
97
|
/** Project ID (for branch reports). */
|
|
@@ -128,6 +132,8 @@ export interface IncomingMessageOptions {
|
|
|
128
132
|
channelId: string;
|
|
129
133
|
/** Clickable URL for channelId, if the integration already has one. */
|
|
130
134
|
channelUrl?: string;
|
|
135
|
+
/** Human-readable channel name, if the integration has one. */
|
|
136
|
+
channelName?: string;
|
|
131
137
|
/** DM channel ID, if the message was a direct message. */
|
|
132
138
|
dmId?: string;
|
|
133
139
|
/** Display name of the sender. */
|
package/src/claw.js
CHANGED
|
@@ -101,6 +101,9 @@ export function formatWorkerReport(opts) {
|
|
|
101
101
|
if (url) {
|
|
102
102
|
xml += `<origin_channel_url>${url}</origin_channel_url>\n`;
|
|
103
103
|
}
|
|
104
|
+
if (opts.channelName) {
|
|
105
|
+
xml += `<origin_channel_name>${opts.channelName}</origin_channel_name>\n`;
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
xml += `<agent_id>${opts.agentId}</agent_id>\n`;
|
|
106
109
|
xml += `<content>\n${opts.content.trim()}\n</content>\n`;
|
|
@@ -117,6 +120,9 @@ export function formatWorkerMessage(opts) {
|
|
|
117
120
|
if (url) {
|
|
118
121
|
xml += `<origin_channel_url>${url}</origin_channel_url>\n`;
|
|
119
122
|
}
|
|
123
|
+
if (opts.channelName) {
|
|
124
|
+
xml += `<origin_channel_name>${opts.channelName}</origin_channel_name>\n`;
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
if (opts.senderDisplayName) {
|
|
122
128
|
xml += `<sender>${opts.senderDisplayName}</sender>\n`;
|
|
@@ -166,6 +172,9 @@ export function formatIncomingMessage(opts) {
|
|
|
166
172
|
if (channelUrl) {
|
|
167
173
|
result += `<channel_url>${channelUrl}</channel_url>\n`;
|
|
168
174
|
}
|
|
175
|
+
if (opts.channelName) {
|
|
176
|
+
result += `<channel_name>${opts.channelName}</channel_name>\n`;
|
|
177
|
+
}
|
|
169
178
|
if (opts.dmId) {
|
|
170
179
|
result += `<dm_id>${opts.dmId}</dm_id>\n`;
|
|
171
180
|
}
|
package/src/claw.spec.js
CHANGED
|
@@ -103,6 +103,16 @@ describe("formatIncomingMessage", () => {
|
|
|
103
103
|
});
|
|
104
104
|
expect(result).toContain("<channel_url>https://test.atlassian.net/browse/PROJ-123</channel_url>");
|
|
105
105
|
});
|
|
106
|
+
it("includes channel_name when provided by the integration", () => {
|
|
107
|
+
const result = formatIncomingMessage({
|
|
108
|
+
channelId: "slack/thread/TTEAM/CCHAN/1234567890.000100",
|
|
109
|
+
channelName: "#engineering",
|
|
110
|
+
sender: "Charlie",
|
|
111
|
+
timestamp: "Wednesday, January 3, 2024 at 12:00 PM PST",
|
|
112
|
+
content: "Slack message",
|
|
113
|
+
});
|
|
114
|
+
expect(result).toContain("<channel_name>#engineering</channel_name>");
|
|
115
|
+
});
|
|
106
116
|
it("does not include channel_url for unsupported platforms", () => {
|
|
107
117
|
const result = formatIncomingMessage({
|
|
108
118
|
channelId: "telegram/chat/123456",
|
|
@@ -154,6 +164,14 @@ describe("formatWorkerMessage", () => {
|
|
|
154
164
|
});
|
|
155
165
|
expect(result).toContain("<origin_channel_url>https://test.atlassian.net/browse/PROJ-456</origin_channel_url>");
|
|
156
166
|
});
|
|
167
|
+
it("includes origin_channel_name when provided by the integration", () => {
|
|
168
|
+
const result = formatWorkerMessage({
|
|
169
|
+
originChannelId: "slack/thread/TTEAM/CCHAN/1234567890.000100",
|
|
170
|
+
channelName: "#engineering",
|
|
171
|
+
content: "Worker result",
|
|
172
|
+
});
|
|
173
|
+
expect(result).toContain("<origin_channel_name>#engineering</origin_channel_name>");
|
|
174
|
+
});
|
|
157
175
|
it("does not include origin_channel_url for unsupported platforms", () => {
|
|
158
176
|
const result = formatWorkerMessage({
|
|
159
177
|
originChannelId: "builder/branch/proj-id/my-branch",
|
|
@@ -195,6 +213,15 @@ describe("formatWorkerReport", () => {
|
|
|
195
213
|
});
|
|
196
214
|
expect(result).toContain("<origin_channel_url>https://test.atlassian.net/browse/PROJ-789</origin_channel_url>");
|
|
197
215
|
});
|
|
216
|
+
it("includes origin_channel_name when provided by the integration", () => {
|
|
217
|
+
const result = formatWorkerReport({
|
|
218
|
+
originChannelId: "slack/channel/TTEAM/CCHAN",
|
|
219
|
+
channelName: "#engineering",
|
|
220
|
+
content: "Report content",
|
|
221
|
+
agentId: "agent-xyz",
|
|
222
|
+
});
|
|
223
|
+
expect(result).toContain("<origin_channel_name>#engineering</origin_channel_name>");
|
|
224
|
+
});
|
|
198
225
|
it("does not include origin_channel_url for unsupported platforms", () => {
|
|
199
226
|
const result = formatWorkerReport({
|
|
200
227
|
originChannelId: "telegram/chat/123456",
|