@chrysb/alphaclaw 0.5.2 → 0.5.4-beta.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/lib/public/js/components/agent-send-modal.js +11 -25
- package/lib/public/js/components/doctor/index.js +6 -5
- package/lib/public/js/components/file-tree.js +26 -1
- package/lib/public/js/components/file-viewer/constants.js +2 -0
- package/lib/public/js/components/file-viewer/index.js +1 -0
- package/lib/public/js/components/file-viewer/markdown-split-view.js +2 -1
- package/lib/public/js/components/file-viewer/use-file-viewer.js +24 -6
- package/lib/public/js/components/file-viewer/utils.js +19 -0
- package/lib/public/js/components/google/gmail-setup-wizard.js +117 -50
- package/lib/public/js/components/google/index.js +45 -44
- package/lib/public/js/components/google/use-gmail-watch.js +2 -2
- package/lib/public/js/components/icons.js +13 -0
- package/lib/public/js/components/models-tab/index.js +5 -3
- package/lib/public/js/components/models-tab/provider-auth-card.js +1 -1
- package/lib/public/js/components/onboarding/welcome-form-step.js +9 -1
- package/lib/public/js/components/session-select-field.js +72 -0
- package/lib/public/js/components/webhooks.js +114 -44
- package/lib/public/js/components/welcome/use-welcome.js +41 -20
- package/lib/public/js/hooks/use-destination-session-selection.js +85 -0
- package/lib/public/js/hooks/useAgentSessions.js +14 -0
- package/lib/public/js/lib/api.js +10 -4
- package/lib/public/js/lib/clipboard.js +40 -0
- package/lib/public/js/lib/model-config.js +2 -2
- package/lib/server/auth-profiles.js +3 -0
- package/lib/server/constants.js +2 -2
- package/lib/server/db/usage/pricing.js +1 -1
- package/lib/server/doctor/prompt.js +32 -10
- package/lib/server/gmail-watch.js +49 -22
- package/lib/server/onboarding/github.js +1 -1
- package/lib/server/routes/gmail.js +5 -1
- package/lib/server/routes/models.js +84 -1
- package/lib/server/routes/system.js +28 -26
- package/lib/server/routes/webhooks.js +2 -2
- package/lib/server/webhooks.js +32 -4
- package/package.json +2 -2
package/lib/server/webhooks.js
CHANGED
|
@@ -95,6 +95,17 @@ const validateWebhookName = (name) => {
|
|
|
95
95
|
return normalized;
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
const normalizeDestination = (destination = null) => {
|
|
99
|
+
if (!destination || typeof destination !== "object") return null;
|
|
100
|
+
const channel = String(destination?.channel || "").trim();
|
|
101
|
+
const to = String(destination?.to || "").trim();
|
|
102
|
+
if (!channel && !to) return null;
|
|
103
|
+
if (!channel || !to) {
|
|
104
|
+
throw new Error("destination.channel and destination.to are required");
|
|
105
|
+
}
|
|
106
|
+
return { channel, to };
|
|
107
|
+
};
|
|
108
|
+
|
|
98
109
|
const resolveTransformPathFromMapping = (name, mapping) => {
|
|
99
110
|
const modulePath = normalizeTransformModulePath({
|
|
100
111
|
modulePath: mapping?.transform?.module,
|
|
@@ -126,20 +137,34 @@ const normalizeMappingTransformModules = (mappings) => {
|
|
|
126
137
|
return changed;
|
|
127
138
|
};
|
|
128
139
|
|
|
129
|
-
const buildDefaultTransformSource = (name) =>
|
|
130
|
-
|
|
140
|
+
const buildDefaultTransformSource = (name, destination = null) => {
|
|
141
|
+
const normalizedDestination = normalizeDestination(destination);
|
|
142
|
+
return [
|
|
131
143
|
"export default async function transform(payload, context) {",
|
|
132
144
|
" const data = payload.payload || payload;",
|
|
133
145
|
" return {",
|
|
134
146
|
" message: data.message,",
|
|
135
147
|
` name: data.name || "${name}",`,
|
|
136
148
|
' wakeMode: data.wakeMode || "now",',
|
|
149
|
+
...(normalizedDestination
|
|
150
|
+
? [
|
|
151
|
+
` channel: ${JSON.stringify(normalizedDestination.channel)},`,
|
|
152
|
+
` to: ${JSON.stringify(normalizedDestination.to)},`,
|
|
153
|
+
]
|
|
154
|
+
: []),
|
|
137
155
|
" };",
|
|
138
156
|
"}",
|
|
139
157
|
"",
|
|
140
158
|
].join("\n");
|
|
159
|
+
};
|
|
141
160
|
|
|
142
|
-
const ensureWebhookTransform = ({
|
|
161
|
+
const ensureWebhookTransform = ({
|
|
162
|
+
fs,
|
|
163
|
+
constants,
|
|
164
|
+
name,
|
|
165
|
+
source = "",
|
|
166
|
+
destination = null,
|
|
167
|
+
}) => {
|
|
143
168
|
const webhookName = validateWebhookName(name);
|
|
144
169
|
const transformAbsolutePath = getTransformAbsolutePath(
|
|
145
170
|
constants,
|
|
@@ -153,7 +178,7 @@ const ensureWebhookTransform = ({ fs, constants, name, source = "" }) => {
|
|
|
153
178
|
transformAbsolutePath,
|
|
154
179
|
String(source || "").trim()
|
|
155
180
|
? `${String(source).replace(/\s+$/, "")}\n`
|
|
156
|
-
: buildDefaultTransformSource(webhookName),
|
|
181
|
+
: buildDefaultTransformSource(webhookName, destination),
|
|
157
182
|
);
|
|
158
183
|
return { changed: true, path: transformAbsolutePath };
|
|
159
184
|
};
|
|
@@ -306,8 +331,10 @@ const createWebhook = ({
|
|
|
306
331
|
allowManagedName = false,
|
|
307
332
|
mapping = {},
|
|
308
333
|
transformSource = "",
|
|
334
|
+
destination = null,
|
|
309
335
|
}) => {
|
|
310
336
|
const webhookName = validateWebhookName(name);
|
|
337
|
+
const normalizedDestination = normalizeDestination(destination);
|
|
311
338
|
const { cfg, configPath } = readConfig({ fs, constants });
|
|
312
339
|
if (!allowManagedName && isManagedWebhook({ cfg, name: webhookName })) {
|
|
313
340
|
throw new Error(
|
|
@@ -329,6 +356,7 @@ const createWebhook = ({
|
|
|
329
356
|
constants,
|
|
330
357
|
name: webhookName,
|
|
331
358
|
source: transformSource,
|
|
359
|
+
destination: normalizedDestination,
|
|
332
360
|
});
|
|
333
361
|
if (ensuredMapping.changed || ensuredTransform.changed || !exists) {
|
|
334
362
|
writeConfig({ fs, configPath, cfg });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrysb/alphaclaw",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4-beta.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"express": "^4.21.0",
|
|
33
33
|
"http-proxy": "^1.18.1",
|
|
34
|
-
"openclaw": "2026.3.
|
|
34
|
+
"openclaw": "2026.3.7"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@vitest/coverage-v8": "^4.0.18",
|