@hearsay-tools/squawk 0.19.0-dev.9088 → 0.19.0-dev.9100
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/built-in-cli-commands.js +0 -4
- package/dist/built-in-cli-commands.js.map +1 -1
- package/dist/built-in-launch-parts.d.ts +0 -4
- package/dist/built-in-launch-parts.js +1 -17
- package/dist/built-in-launch-parts.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +7 -7
- package/dist/core/server-hook-registry.d.ts +17 -2
- package/dist/core/server-hook-registry.js +1 -0
- package/dist/core/server-hook-registry.js.map +1 -1
- package/dist/features/webhooks/capability.d.ts +3 -0
- package/dist/features/webhooks/capability.js +6 -0
- package/dist/features/webhooks/capability.js.map +1 -0
- package/dist/features/webhooks/cli-command.d.ts +3 -0
- package/dist/features/webhooks/cli-command.js +10 -0
- package/dist/features/webhooks/cli-command.js.map +1 -0
- package/dist/{webhooks → features/webhooks}/cli.d.ts +2 -2
- package/dist/{webhooks → features/webhooks}/cli.js +7 -7
- package/dist/features/webhooks/cli.js.map +1 -0
- package/dist/features/webhooks/index.d.ts +13 -0
- package/dist/features/webhooks/index.js +14 -0
- package/dist/features/webhooks/index.js.map +1 -0
- package/dist/features/webhooks/launch-part.d.ts +7 -0
- package/dist/features/webhooks/launch-part.js +19 -0
- package/dist/features/webhooks/launch-part.js.map +1 -0
- package/dist/{webhooks → features/webhooks}/prompt.d.ts +1 -1
- package/dist/{webhooks → features/webhooks}/prompt.js +1 -1
- package/dist/features/webhooks/prompt.js.map +1 -0
- package/dist/features/webhooks/routes.d.ts +463 -0
- package/dist/features/webhooks/routes.js +177 -0
- package/dist/features/webhooks/routes.js.map +1 -0
- package/dist/features/webhooks/server-plugin.d.ts +16 -0
- package/dist/features/webhooks/server-plugin.js +98 -0
- package/dist/features/webhooks/server-plugin.js.map +1 -0
- package/dist/{runs → features/webhooks}/webhook.d.ts +5 -5
- package/dist/{runs → features/webhooks}/webhook.js +16 -10
- package/dist/features/webhooks/webhook.js.map +1 -0
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/serve-command.d.ts +2 -2
- package/dist/serve-command.js +13 -9
- package/dist/serve-command.js.map +1 -1
- package/dist/server/plugin-server-hooks.d.ts +12 -1
- package/dist/server/plugin-server-hooks.js +33 -0
- package/dist/server/plugin-server-hooks.js.map +1 -1
- package/dist/server/project-settings-routes.d.ts +0 -90
- package/dist/server/project-settings-routes.js +0 -30
- package/dist/server/project-settings-routes.js.map +1 -1
- package/dist/server/projects-routes.d.ts +1 -376
- package/dist/server/projects-routes.js +2 -137
- package/dist/server/projects-routes.js.map +1 -1
- package/dist/server/providers-routes.d.ts +58 -58
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +279 -297
- package/dist/server/runs-routes.js +6 -11
- package/dist/server/runs-routes.js.map +1 -1
- package/dist/server/server-deps.d.ts +1 -4
- package/dist/server/server-deps.js +3 -7
- package/dist/server/server-deps.js.map +1 -1
- package/dist/server/server.d.ts +296 -876
- package/dist/server/server.js +10 -16
- package/dist/server/server.js.map +1 -1
- package/dist/server/start-run-options.d.ts +5 -3
- package/dist/server/start-run-options.js +8 -3
- package/dist/server/start-run-options.js.map +1 -1
- package/dist/server/start-server.js +8 -11
- package/dist/server/start-server.js.map +1 -1
- package/dist/server/workspace-identity-routes.d.ts +5 -5
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/workspace-projects.d.ts +2 -5
- package/dist/server/workspace-projects.js +10 -11
- package/dist/server/workspace-projects.js.map +1 -1
- package/dist/server/workspace-routes.d.ts +85 -85
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-DrA0kndh.js → accounts-section-DL3fIJ3Y.js} +1 -1
- package/web/dist/assets/{activity-motion-C23PnhhH.js → activity-motion-nt1FXMrF.js} +1 -1
- package/web/dist/assets/{activity-route-CWGPbwtG.js → activity-route-xVy2K_Fi.js} +1 -1
- package/web/dist/assets/{agent-config-section-DWZQ2DSW.js → agent-config-section-nFavGeR2.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-Da4tKbp7.js → agent-defaults-section-CN0pC4xG.js} +1 -1
- package/web/dist/assets/{appearance-Bm4ePfiH.js → appearance-zGuTSgIy.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DuRmMR6k.js → archive-on-merge-field-BaKNf-j4.js} +1 -1
- package/web/dist/assets/{ask-card-vM_Z-WAg.js → ask-card-huOW3GMV.js} +3 -3
- package/web/dist/assets/{automations-route-B8zD3wux.js → automations-route-GBaRU2IS.js} +2 -2
- package/web/dist/assets/{commit-list-lwVhwbS8.js → commit-list-x-75vYko.js} +1 -1
- package/web/dist/assets/{diff-CC5UqjNZ.js → diff-Bhh_CAtI.js} +2 -2
- package/web/dist/assets/{diff-controls-C8KWZ5S-.js → diff-controls-BOnMrLuP.js} +1 -1
- package/web/dist/assets/{diff-view-DiuQQoKq.js → diff-view-DiPeQi9D.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-CX7M4k9n.js → discard-changes-dialog-BMofaFwH.js} +1 -1
- package/web/dist/assets/{file-preview-C_0CRYAr.js → file-preview-ChwOU1Uc.js} +1 -1
- package/web/dist/assets/{git-toolbar-PM540i_A.js → git-toolbar-BdhjSQLm.js} +1 -1
- package/web/dist/assets/{github-CeBvZzjo.js → github-DqXXUCBy.js} +1 -1
- package/web/dist/assets/{global-activity-route-CiTt7W6o.js → global-activity-route-CZJRu2G1.js} +1 -1
- package/web/dist/assets/index-CbSPKU4g.js +21 -0
- package/web/dist/assets/{markdown-CqzDs1kO.js → markdown-DMFXz4xY.js} +1 -1
- package/web/dist/assets/{option-select-CDOKbUov.js → option-select-Cq_bhgu6.js} +1 -1
- package/web/dist/assets/{preferences-section-cdbIMfEU.js → preferences-section-CHhUi72X.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BcU9ryyW.js → preview-pane-connected-DH9rjYI7.js} +2 -2
- package/web/dist/assets/{project-location-BpBbcl3v.js → project-location-CSXt_Yk6.js} +1 -1
- package/web/dist/assets/{projects-section-CX1WJq4d.js → projects-section-CSBdiEM-.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DrQthAY7.js → prompt-templates-section-DaJbpROr.js} +2 -2
- package/web/dist/assets/{remote-settings-notice-_MtFnktv.js → remote-settings-notice-Chx8LxP6.js} +1 -1
- package/web/dist/assets/repo-git-D8Sn_897.js +1 -0
- package/web/dist/assets/{report-reader-iboN3k6l.js → report-reader-Ccymt9jp.js} +1 -1
- package/web/dist/assets/reports-GvAw7DYA.js +1 -0
- package/web/dist/assets/{resources-section-BmDbIpaO.js → resources-section-BWqoBxtC.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-DXxIudVB.js → review-notes-drafts-BKzyNpXo.js} +1 -1
- package/web/dist/assets/{review-panel-BjWbFGev.js → review-panel-DxAlY6hQ.js} +1 -1
- package/web/dist/assets/{review-strip-QIghY88F.js → review-strip-QDKNuOm9.js} +1 -1
- package/web/dist/assets/run-header-BS7SXYup.js +2 -0
- package/web/dist/assets/{select-BxuV2GlN.js → select-DVQEFrtF.js} +1 -1
- package/web/dist/assets/{session-context-section-OLW5UTvx.js → session-context-section-YxCcDlRl.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-Dasyc6Qo.js → settings-agent-picker-CDyluV99.js} +1 -1
- package/web/dist/assets/{settings-save-bar-Mrc6Vm7P.js → settings-save-bar-CMJaZn_P.js} +1 -1
- package/web/dist/assets/settings-shell-DHVB7FYt.js +1 -0
- package/web/dist/assets/{sidebar-section-CVNvjM29.js → sidebar-section-hphp-63V.js} +1 -1
- package/web/dist/assets/{skills-7MwCp2i_.js → skills-BlHcP8uc.js} +1 -1
- package/web/dist/assets/{task-changes-DSZjztX7.js → task-changes-DWMFWq5g.js} +1 -1
- package/web/dist/assets/{task-commits-P_ElCQ4M.js → task-commits-q5Cn_tdG.js} +1 -1
- package/web/dist/assets/{task-file-scope-B63NmSov.js → task-file-scope-BKjO7lKK.js} +1 -1
- package/web/dist/assets/{task-files-CSFB6sG7.js → task-files-DbRJAKAg.js} +1 -1
- package/web/dist/assets/{task-github-item-BJ1rGyc6.js → task-github-item-DV6uUcx2.js} +1 -1
- package/web/dist/assets/{task-thread-C0DbAGi_.js → task-thread-05LMMzIs.js} +1 -1
- package/web/dist/assets/{thread-state-B7pyjJYO.js → thread-state-uf_28v2G.js} +1 -1
- package/web/dist/assets/{use-finish-run-B1Gy5JPt.js → use-finish-run-BsTPLn1d.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CMyKCFeb.js → use-hand-to-agent-state-DyjrAs-3.js} +1 -1
- package/web/dist/assets/use-path-bases-hbJkikc4.js +1 -0
- package/web/dist/assets/{workflows-seQiL2pi.js → workflows-B5xr64g0.js} +3 -3
- package/web/dist/assets/{workspace-tools-BDf7nsE5.js → workspace-tools-DGlrX2Uj.js} +1 -1
- package/web/dist/assets/{worktrees-section-x7r5wRhx.js → worktrees-section-D2bbdi3Y.js} +1 -1
- package/web/dist/index.html +1 -1
- package/dist/runs/webhook.js.map +0 -1
- package/dist/webhooks/cli.js.map +0 -1
- package/dist/webhooks/prompt.js.map +0 -1
- package/web/dist/assets/index-UFO7Bk2I.js +0 -21
- package/web/dist/assets/repo-git-5JS3oL12.js +0 -1
- package/web/dist/assets/reports-Cn3kWlK7.js +0 -1
- package/web/dist/assets/run-header-BWLcG57S.js +0 -2
- package/web/dist/assets/settings-shell-DWRk12-i.js +0 -1
- package/web/dist/assets/use-path-bases-wGc__G57.js +0 -1
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import type { Home } from '../../home/home.ts';
|
|
2
|
+
import type { ServerPluginContext } from '../../plugin/index.ts';
|
|
3
|
+
import type { ProjectApiEnv } from '../../server/server-types.ts';
|
|
4
|
+
export interface AgentWebhooksRouteDeps {
|
|
5
|
+
home: Home;
|
|
6
|
+
resolveOrigin: () => Promise<string | undefined>;
|
|
7
|
+
fetch?: typeof fetch | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** Project-scoped Hono routes for `/agent-webhooks` and `/agent-webhooks/:webhook`. */
|
|
10
|
+
export declare function createAgentWebhooksRoutes(deps: AgentWebhooksRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
|
|
11
|
+
"/agent-webhooks": {
|
|
12
|
+
$get: {
|
|
13
|
+
output: {
|
|
14
|
+
webhooks: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
outputFormat: "json";
|
|
21
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
22
|
+
input: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
} & {
|
|
26
|
+
"/agent-webhooks/:webhook": {
|
|
27
|
+
$post: {
|
|
28
|
+
output: {
|
|
29
|
+
error: string;
|
|
30
|
+
code?: "invalid_input" | undefined;
|
|
31
|
+
};
|
|
32
|
+
outputFormat: "json";
|
|
33
|
+
status: 400;
|
|
34
|
+
input: {
|
|
35
|
+
param: {
|
|
36
|
+
webhook: string;
|
|
37
|
+
};
|
|
38
|
+
} & {
|
|
39
|
+
json: {
|
|
40
|
+
runId?: string | undefined;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
message: string;
|
|
43
|
+
data?: Record<string, unknown> | undefined;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
output: {
|
|
48
|
+
error: string;
|
|
49
|
+
};
|
|
50
|
+
outputFormat: "json";
|
|
51
|
+
status: 404;
|
|
52
|
+
input: {
|
|
53
|
+
param: {
|
|
54
|
+
webhook: string;
|
|
55
|
+
};
|
|
56
|
+
} & {
|
|
57
|
+
json: {
|
|
58
|
+
runId?: string | undefined;
|
|
59
|
+
title?: string | undefined;
|
|
60
|
+
message: string;
|
|
61
|
+
data?: Record<string, unknown> | undefined;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
output: {
|
|
66
|
+
ok: boolean;
|
|
67
|
+
webhook: {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
};
|
|
71
|
+
deliveryId: string;
|
|
72
|
+
attempts: number;
|
|
73
|
+
status?: number | undefined;
|
|
74
|
+
error?: string | undefined;
|
|
75
|
+
dryRun?: boolean | undefined;
|
|
76
|
+
};
|
|
77
|
+
outputFormat: "json";
|
|
78
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
79
|
+
input: {
|
|
80
|
+
param: {
|
|
81
|
+
webhook: string;
|
|
82
|
+
};
|
|
83
|
+
} & {
|
|
84
|
+
json: {
|
|
85
|
+
runId?: string | undefined;
|
|
86
|
+
title?: string | undefined;
|
|
87
|
+
message: string;
|
|
88
|
+
data?: Record<string, unknown> | undefined;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}, "/", "/agent-webhooks/:webhook">;
|
|
94
|
+
export interface ProjectWebhooksRouteDeps {
|
|
95
|
+
home: Home;
|
|
96
|
+
projects: Pick<ServerPluginContext['projects'], 'resolveId' | 'registryEntry'>;
|
|
97
|
+
fetch?: typeof fetch | undefined;
|
|
98
|
+
}
|
|
99
|
+
/** Workspace-scoped Hono routes for project webhook CRUD and test deliveries. */
|
|
100
|
+
export declare function createProjectWebhooksRoutes(deps: ProjectWebhooksRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
|
|
101
|
+
"/projects/:projectId/webhook/test": {
|
|
102
|
+
$post: {
|
|
103
|
+
output: {
|
|
104
|
+
error: string;
|
|
105
|
+
code?: "no-boot-project" | undefined;
|
|
106
|
+
};
|
|
107
|
+
outputFormat: "json";
|
|
108
|
+
status: 404 | 409;
|
|
109
|
+
input: {
|
|
110
|
+
param: {
|
|
111
|
+
projectId: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
output: {
|
|
116
|
+
error: string;
|
|
117
|
+
};
|
|
118
|
+
outputFormat: "json";
|
|
119
|
+
status: 400;
|
|
120
|
+
input: {
|
|
121
|
+
param: {
|
|
122
|
+
projectId: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
output: {
|
|
127
|
+
ok: boolean;
|
|
128
|
+
status?: number | undefined;
|
|
129
|
+
error?: string | undefined;
|
|
130
|
+
dryRun?: boolean | undefined;
|
|
131
|
+
};
|
|
132
|
+
outputFormat: "json";
|
|
133
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
134
|
+
input: {
|
|
135
|
+
param: {
|
|
136
|
+
projectId: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
} & {
|
|
142
|
+
"/projects/:projectId/webhooks": {
|
|
143
|
+
$post: {
|
|
144
|
+
output: {
|
|
145
|
+
error: string;
|
|
146
|
+
code?: "no-boot-project" | undefined;
|
|
147
|
+
};
|
|
148
|
+
outputFormat: "json";
|
|
149
|
+
status: 400 | 404 | 409 | 500;
|
|
150
|
+
input: {
|
|
151
|
+
json: {
|
|
152
|
+
name: string;
|
|
153
|
+
description?: string | undefined;
|
|
154
|
+
url: string;
|
|
155
|
+
token?: string | undefined;
|
|
156
|
+
tasks?: boolean | undefined;
|
|
157
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
158
|
+
agent?: boolean | undefined;
|
|
159
|
+
};
|
|
160
|
+
} & {
|
|
161
|
+
param: {
|
|
162
|
+
projectId: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
} | {
|
|
166
|
+
output: {
|
|
167
|
+
project: {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
root: string;
|
|
171
|
+
addedAt: string;
|
|
172
|
+
lastOpenedAt: string;
|
|
173
|
+
source: "checkout" | "local";
|
|
174
|
+
status: "missing" | "not-git" | "ok";
|
|
175
|
+
branch?: string | undefined;
|
|
176
|
+
forge?: string | undefined;
|
|
177
|
+
repoUrl?: string | undefined;
|
|
178
|
+
maxParallel?: number | undefined;
|
|
179
|
+
tags?: string[] | undefined;
|
|
180
|
+
webhook?: {
|
|
181
|
+
url: string;
|
|
182
|
+
tokenSet: boolean;
|
|
183
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
webhooks?: {
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
description?: string | undefined;
|
|
189
|
+
url: string;
|
|
190
|
+
tokenSet: boolean;
|
|
191
|
+
tasks: boolean;
|
|
192
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
193
|
+
agent: boolean;
|
|
194
|
+
}[] | undefined;
|
|
195
|
+
};
|
|
196
|
+
webhook: {
|
|
197
|
+
id: string;
|
|
198
|
+
name: string;
|
|
199
|
+
description?: string | undefined;
|
|
200
|
+
url: string;
|
|
201
|
+
tokenSet: boolean;
|
|
202
|
+
tasks: boolean;
|
|
203
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
204
|
+
agent: boolean;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
outputFormat: "json";
|
|
208
|
+
status: 201;
|
|
209
|
+
input: {
|
|
210
|
+
json: {
|
|
211
|
+
name: string;
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
url: string;
|
|
214
|
+
token?: string | undefined;
|
|
215
|
+
tasks?: boolean | undefined;
|
|
216
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
217
|
+
agent?: boolean | undefined;
|
|
218
|
+
};
|
|
219
|
+
} & {
|
|
220
|
+
param: {
|
|
221
|
+
projectId: string;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
} & {
|
|
227
|
+
"/projects/:projectId/webhooks/:webhookId": {
|
|
228
|
+
$patch: {
|
|
229
|
+
output: {
|
|
230
|
+
error: string;
|
|
231
|
+
code?: "invalid_input" | undefined;
|
|
232
|
+
};
|
|
233
|
+
outputFormat: "json";
|
|
234
|
+
status: 400;
|
|
235
|
+
input: {
|
|
236
|
+
param: {
|
|
237
|
+
projectId: string;
|
|
238
|
+
webhookId: string;
|
|
239
|
+
};
|
|
240
|
+
} & {
|
|
241
|
+
json: {
|
|
242
|
+
name?: string | undefined;
|
|
243
|
+
description?: string | undefined;
|
|
244
|
+
url?: string | undefined;
|
|
245
|
+
token?: string | undefined;
|
|
246
|
+
tasks?: boolean | undefined;
|
|
247
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
248
|
+
agent?: boolean | undefined;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
} | {
|
|
252
|
+
output: {
|
|
253
|
+
project: {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
root: string;
|
|
257
|
+
addedAt: string;
|
|
258
|
+
lastOpenedAt: string;
|
|
259
|
+
source: "checkout" | "local";
|
|
260
|
+
status: "missing" | "not-git" | "ok";
|
|
261
|
+
branch?: string | undefined;
|
|
262
|
+
forge?: string | undefined;
|
|
263
|
+
repoUrl?: string | undefined;
|
|
264
|
+
maxParallel?: number | undefined;
|
|
265
|
+
tags?: string[] | undefined;
|
|
266
|
+
webhook?: {
|
|
267
|
+
url: string;
|
|
268
|
+
tokenSet: boolean;
|
|
269
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
270
|
+
} | undefined;
|
|
271
|
+
webhooks?: {
|
|
272
|
+
id: string;
|
|
273
|
+
name: string;
|
|
274
|
+
description?: string | undefined;
|
|
275
|
+
url: string;
|
|
276
|
+
tokenSet: boolean;
|
|
277
|
+
tasks: boolean;
|
|
278
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
279
|
+
agent: boolean;
|
|
280
|
+
}[] | undefined;
|
|
281
|
+
};
|
|
282
|
+
webhook: {
|
|
283
|
+
id: string;
|
|
284
|
+
name: string;
|
|
285
|
+
description?: string | undefined;
|
|
286
|
+
url: string;
|
|
287
|
+
tokenSet: boolean;
|
|
288
|
+
tasks: boolean;
|
|
289
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
290
|
+
agent: boolean;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
outputFormat: "json";
|
|
294
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
295
|
+
input: {
|
|
296
|
+
param: {
|
|
297
|
+
projectId: string;
|
|
298
|
+
webhookId: string;
|
|
299
|
+
};
|
|
300
|
+
} & {
|
|
301
|
+
json: {
|
|
302
|
+
name?: string | undefined;
|
|
303
|
+
description?: string | undefined;
|
|
304
|
+
url?: string | undefined;
|
|
305
|
+
token?: string | undefined;
|
|
306
|
+
tasks?: boolean | undefined;
|
|
307
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
308
|
+
agent?: boolean | undefined;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
} | {
|
|
312
|
+
output: {
|
|
313
|
+
error: string;
|
|
314
|
+
code?: "no-boot-project" | undefined;
|
|
315
|
+
};
|
|
316
|
+
outputFormat: "json";
|
|
317
|
+
status: 400 | 404 | 409 | 500;
|
|
318
|
+
input: {
|
|
319
|
+
param: {
|
|
320
|
+
projectId: string;
|
|
321
|
+
webhookId: string;
|
|
322
|
+
};
|
|
323
|
+
} & {
|
|
324
|
+
json: {
|
|
325
|
+
name?: string | undefined;
|
|
326
|
+
description?: string | undefined;
|
|
327
|
+
url?: string | undefined;
|
|
328
|
+
token?: string | undefined;
|
|
329
|
+
tasks?: boolean | undefined;
|
|
330
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
331
|
+
agent?: boolean | undefined;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
} & {
|
|
337
|
+
"/projects/:projectId/webhooks/:webhookId": {
|
|
338
|
+
$delete: {
|
|
339
|
+
output: {
|
|
340
|
+
error: string;
|
|
341
|
+
code?: "invalid_input" | undefined;
|
|
342
|
+
};
|
|
343
|
+
outputFormat: "json";
|
|
344
|
+
status: 400;
|
|
345
|
+
input: {
|
|
346
|
+
param: {
|
|
347
|
+
projectId: string;
|
|
348
|
+
webhookId: string;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
} | {
|
|
352
|
+
output: {
|
|
353
|
+
error: string;
|
|
354
|
+
code?: "no-boot-project" | undefined;
|
|
355
|
+
};
|
|
356
|
+
outputFormat: "json";
|
|
357
|
+
status: 400 | 404 | 409 | 500;
|
|
358
|
+
input: {
|
|
359
|
+
param: {
|
|
360
|
+
projectId: string;
|
|
361
|
+
webhookId: string;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
} | {
|
|
365
|
+
output: {
|
|
366
|
+
project: {
|
|
367
|
+
id: string;
|
|
368
|
+
name: string;
|
|
369
|
+
root: string;
|
|
370
|
+
addedAt: string;
|
|
371
|
+
lastOpenedAt: string;
|
|
372
|
+
source: "checkout" | "local";
|
|
373
|
+
status: "missing" | "not-git" | "ok";
|
|
374
|
+
branch?: string | undefined;
|
|
375
|
+
forge?: string | undefined;
|
|
376
|
+
repoUrl?: string | undefined;
|
|
377
|
+
maxParallel?: number | undefined;
|
|
378
|
+
tags?: string[] | undefined;
|
|
379
|
+
webhook?: {
|
|
380
|
+
url: string;
|
|
381
|
+
tokenSet: boolean;
|
|
382
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
383
|
+
} | undefined;
|
|
384
|
+
webhooks?: {
|
|
385
|
+
id: string;
|
|
386
|
+
name: string;
|
|
387
|
+
description?: string | undefined;
|
|
388
|
+
url: string;
|
|
389
|
+
tokenSet: boolean;
|
|
390
|
+
tasks: boolean;
|
|
391
|
+
triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
|
|
392
|
+
agent: boolean;
|
|
393
|
+
}[] | undefined;
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
outputFormat: "json";
|
|
397
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
398
|
+
input: {
|
|
399
|
+
param: {
|
|
400
|
+
projectId: string;
|
|
401
|
+
webhookId: string;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
} & {
|
|
407
|
+
"/projects/:projectId/webhooks/:webhookId/test": {
|
|
408
|
+
$post: {
|
|
409
|
+
output: {
|
|
410
|
+
error: string;
|
|
411
|
+
code?: "invalid_input" | undefined;
|
|
412
|
+
};
|
|
413
|
+
outputFormat: "json";
|
|
414
|
+
status: 400;
|
|
415
|
+
input: {
|
|
416
|
+
param: {
|
|
417
|
+
projectId: string;
|
|
418
|
+
webhookId: string;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
} | {
|
|
422
|
+
output: {
|
|
423
|
+
ok: boolean;
|
|
424
|
+
status?: number | undefined;
|
|
425
|
+
error?: string | undefined;
|
|
426
|
+
dryRun?: boolean | undefined;
|
|
427
|
+
};
|
|
428
|
+
outputFormat: "json";
|
|
429
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
430
|
+
input: {
|
|
431
|
+
param: {
|
|
432
|
+
projectId: string;
|
|
433
|
+
webhookId: string;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
} | {
|
|
437
|
+
output: {
|
|
438
|
+
error: string;
|
|
439
|
+
code?: "no-boot-project" | undefined;
|
|
440
|
+
};
|
|
441
|
+
outputFormat: "json";
|
|
442
|
+
status: 404 | 409;
|
|
443
|
+
input: {
|
|
444
|
+
param: {
|
|
445
|
+
projectId: string;
|
|
446
|
+
webhookId: string;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
} | {
|
|
450
|
+
output: {
|
|
451
|
+
error: string;
|
|
452
|
+
};
|
|
453
|
+
outputFormat: "json";
|
|
454
|
+
status: 404;
|
|
455
|
+
input: {
|
|
456
|
+
param: {
|
|
457
|
+
projectId: string;
|
|
458
|
+
webhookId: string;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
}, "/", "/projects/:projectId/webhooks/:webhookId/test">;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import { PROJECT_WEBHOOKS_MAX } from '../../contract/index.js';
|
|
4
|
+
import { agentWebhookParamsSchema, createProjectWebhookInputSchema, projectWebhookParamsSchema, sendAgentReportInputSchema, updateProjectWebhookInputSchema, } from '../../contract/index.js';
|
|
5
|
+
import { defined } from '../../core/defined.js';
|
|
6
|
+
import { productEnv } from '../../core/product-env.js';
|
|
7
|
+
import { productIdentity } from '../../home/identity.js';
|
|
8
|
+
import { NO_WEBHOOK_ERROR } from '../../server/start-run-options.js';
|
|
9
|
+
import { jsonZodValidator, paramZodValidator } from '../../server/validators.js';
|
|
10
|
+
import { loadWorkspaceConfig, mergeWriteWorkspaceConfig, } from '../../workspace/config.js';
|
|
11
|
+
import { probeProjectStatus, toProjectListEntry } from '../../workspace/projects.js';
|
|
12
|
+
import { agentWebhook, agentWebhooks, createdWebhook, editedWebhook, nameTaken, projectWebhooks, redactWebhook, setProjectWebhooks, taskWebhooks as taskWebhookList, } from '../../workspace/webhooks.js';
|
|
13
|
+
import { deliverOnce, registryEntry, sendAgentReport } from './webhook.js';
|
|
14
|
+
const webhookNameTakenError = (name) => `this project already has a webhook named "${name.trim()}" — pick another name`;
|
|
15
|
+
/** Project-scoped Hono routes for `/agent-webhooks` and `/agent-webhooks/:webhook`. */
|
|
16
|
+
export function createAgentWebhooksRoutes(deps) {
|
|
17
|
+
const { home, resolveOrigin, fetch } = deps;
|
|
18
|
+
return new Hono()
|
|
19
|
+
.get('/agent-webhooks', async (c) => {
|
|
20
|
+
const project = c.get('project');
|
|
21
|
+
const body = { webhooks: agentWebhooks(await registryEntry(project.id, project.root, home).catch(() => undefined)) };
|
|
22
|
+
return c.json(body);
|
|
23
|
+
})
|
|
24
|
+
.post('/agent-webhooks/:webhook', paramZodValidator(agentWebhookParamsSchema.pick({ webhook: true })), jsonZodValidator(sendAgentReportInputSchema), async (c) => {
|
|
25
|
+
const project = c.get('project');
|
|
26
|
+
const { webhook: ref } = c.req.valid('param');
|
|
27
|
+
const entry = await registryEntry(project.id, project.root, home).catch(() => undefined);
|
|
28
|
+
const webhook = agentWebhook(entry, ref);
|
|
29
|
+
if (!entry || !webhook)
|
|
30
|
+
return c.json({ error: `no webhook named "${ref}" is open to agents in this project — run \`${productIdentity().command} webhook list\`` }, 404);
|
|
31
|
+
const outcome = await sendAgentReport({
|
|
32
|
+
projectId: entry.id,
|
|
33
|
+
webhook,
|
|
34
|
+
input: c.req.valid('json'),
|
|
35
|
+
store: project.store,
|
|
36
|
+
origin: await resolveOrigin(),
|
|
37
|
+
fetch,
|
|
38
|
+
});
|
|
39
|
+
const body = { ...outcome, webhook: { id: webhook.id, name: webhook.name } };
|
|
40
|
+
return c.json(body);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Workspace-scoped Hono routes for project webhook CRUD and test deliveries. */
|
|
44
|
+
export function createProjectWebhooksRoutes(deps) {
|
|
45
|
+
const { home, projects, fetch } = deps;
|
|
46
|
+
const sendTestDelivery = async (projectId, webhook) => {
|
|
47
|
+
if (productEnv('DRY_RUN') === '1')
|
|
48
|
+
return { ok: true, dryRun: true };
|
|
49
|
+
const payload = {
|
|
50
|
+
event: 'task.test',
|
|
51
|
+
deliveryId: randomUUID(),
|
|
52
|
+
projectId,
|
|
53
|
+
webhook: { id: webhook.id, name: webhook.name },
|
|
54
|
+
occurredAt: new Date().toISOString(),
|
|
55
|
+
};
|
|
56
|
+
const result = await deliverOnce(webhook, payload, { fetch });
|
|
57
|
+
return {
|
|
58
|
+
ok: result.ok,
|
|
59
|
+
...(result.status === undefined ? {} : { status: result.status }),
|
|
60
|
+
...(result.error === undefined ? {} : { error: result.error }),
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const resolveProjectEntry = async (raw) => {
|
|
64
|
+
const resolved = await projects.resolveId(raw);
|
|
65
|
+
if ('error' in resolved)
|
|
66
|
+
return { ...resolved, status: resolved.code ? 409 : 404 };
|
|
67
|
+
const entry = await projects.registryEntry(resolved.id);
|
|
68
|
+
if (!entry)
|
|
69
|
+
return { error: `unknown project: ${raw}`, status: 404 };
|
|
70
|
+
return { entry };
|
|
71
|
+
};
|
|
72
|
+
const editProjectWebhooks = async (raw, edit) => {
|
|
73
|
+
const resolved = await projects.resolveId(raw);
|
|
74
|
+
if ('error' in resolved)
|
|
75
|
+
return { ...resolved, status: resolved.code ? 409 : 404 };
|
|
76
|
+
const { id } = resolved;
|
|
77
|
+
const known = await loadWorkspaceConfig(home.workspaceConfig).then((config) => config.projects.some((p) => p.id === id), () => false);
|
|
78
|
+
if (!known)
|
|
79
|
+
return { error: `unknown project: ${id}`, status: 404 };
|
|
80
|
+
let updated;
|
|
81
|
+
let outcome;
|
|
82
|
+
try {
|
|
83
|
+
await mergeWriteWorkspaceConfig((config) => {
|
|
84
|
+
const entry = config.projects.find((p) => p.id === id);
|
|
85
|
+
if (!entry)
|
|
86
|
+
return;
|
|
87
|
+
outcome = edit([...projectWebhooks(entry)]);
|
|
88
|
+
if ('error' in outcome)
|
|
89
|
+
return;
|
|
90
|
+
setProjectWebhooks(entry, outcome.webhooks);
|
|
91
|
+
updated = entry;
|
|
92
|
+
}, home);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return { error: err instanceof Error ? err.message : String(err), status: 500 };
|
|
96
|
+
}
|
|
97
|
+
if (outcome && 'error' in outcome)
|
|
98
|
+
return outcome;
|
|
99
|
+
if (!updated || !outcome)
|
|
100
|
+
return { error: `unknown project: ${id}`, status: 404 };
|
|
101
|
+
return {
|
|
102
|
+
body: {
|
|
103
|
+
project: toProjectListEntry(updated, await probeProjectStatus(updated.root)),
|
|
104
|
+
webhook: redactWebhook(outcome.webhook),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
return new Hono()
|
|
109
|
+
.post('/projects/:projectId/webhook/test', async (c) => {
|
|
110
|
+
const resolved = await resolveProjectEntry(c.req.param('projectId'));
|
|
111
|
+
if ('error' in resolved)
|
|
112
|
+
return c.json({ error: resolved.error, ...(resolved.code ? { code: resolved.code } : {}) }, resolved.status);
|
|
113
|
+
const webhook = taskWebhookList(resolved.entry)[0];
|
|
114
|
+
if (!webhook)
|
|
115
|
+
return c.json({ error: NO_WEBHOOK_ERROR }, 400);
|
|
116
|
+
const body = await sendTestDelivery(resolved.entry.id, webhook);
|
|
117
|
+
return c.json(body);
|
|
118
|
+
})
|
|
119
|
+
.post('/projects/:projectId/webhooks', jsonZodValidator(createProjectWebhookInputSchema), async (c) => {
|
|
120
|
+
const input = c.req.valid('json');
|
|
121
|
+
const answer = await editProjectWebhooks(c.req.param('projectId'), (webhooks) => {
|
|
122
|
+
if (webhooks.length >= PROJECT_WEBHOOKS_MAX)
|
|
123
|
+
return { error: `a project holds at most ${PROJECT_WEBHOOKS_MAX} webhooks`, status: 409 };
|
|
124
|
+
if (nameTaken(webhooks, input.name))
|
|
125
|
+
return { error: webhookNameTakenError(input.name), status: 409 };
|
|
126
|
+
const webhook = createdWebhook(webhooks, input);
|
|
127
|
+
return { webhooks: [...webhooks, webhook], webhook };
|
|
128
|
+
});
|
|
129
|
+
if ('error' in answer)
|
|
130
|
+
return c.json({ error: answer.error, ...(answer.code ? { code: answer.code } : {}) }, answer.status);
|
|
131
|
+
const body = answer.body;
|
|
132
|
+
return c.json(body, 201);
|
|
133
|
+
})
|
|
134
|
+
.patch('/projects/:projectId/webhooks/:webhookId', paramZodValidator(projectWebhookParamsSchema), jsonZodValidator(updateProjectWebhookInputSchema), async (c) => {
|
|
135
|
+
const { projectId, webhookId } = c.req.valid('param');
|
|
136
|
+
const input = c.req.valid('json');
|
|
137
|
+
const answer = await editProjectWebhooks(projectId, (webhooks) => {
|
|
138
|
+
const index = webhooks.findIndex((webhook) => webhook.id === webhookId);
|
|
139
|
+
if (index < 0)
|
|
140
|
+
return { error: `unknown webhook: ${webhookId}`, status: 404 };
|
|
141
|
+
if (input.name !== undefined && nameTaken(webhooks, input.name, webhookId))
|
|
142
|
+
return { error: webhookNameTakenError(input.name), status: 409 };
|
|
143
|
+
const webhook = editedWebhook(webhooks[index], input);
|
|
144
|
+
return { webhooks: webhooks.map((entry, at) => (at === index ? webhook : entry)), webhook };
|
|
145
|
+
});
|
|
146
|
+
if ('error' in answer)
|
|
147
|
+
return c.json({ error: answer.error, ...(answer.code ? { code: answer.code } : {}) }, answer.status);
|
|
148
|
+
const body = answer.body;
|
|
149
|
+
return c.json(body);
|
|
150
|
+
})
|
|
151
|
+
.delete('/projects/:projectId/webhooks/:webhookId', paramZodValidator(projectWebhookParamsSchema), async (c) => {
|
|
152
|
+
const { projectId, webhookId } = c.req.valid('param');
|
|
153
|
+
const answer = await editProjectWebhooks(projectId, (webhooks) => {
|
|
154
|
+
const webhook = webhooks.find((entry) => entry.id === webhookId);
|
|
155
|
+
if (!webhook)
|
|
156
|
+
return { error: `unknown webhook: ${webhookId}`, status: 404 };
|
|
157
|
+
return { webhooks: webhooks.filter((entry) => entry !== webhook), webhook };
|
|
158
|
+
});
|
|
159
|
+
if ('error' in answer)
|
|
160
|
+
return c.json({ error: answer.error, ...(answer.code ? { code: answer.code } : {}) }, answer.status);
|
|
161
|
+
const project = answer.body.project;
|
|
162
|
+
const body = { project: defined({ ...project, webhook: project.webhook && defined(project.webhook) }) };
|
|
163
|
+
return c.json(body);
|
|
164
|
+
})
|
|
165
|
+
.post('/projects/:projectId/webhooks/:webhookId/test', paramZodValidator(projectWebhookParamsSchema), async (c) => {
|
|
166
|
+
const { projectId, webhookId } = c.req.valid('param');
|
|
167
|
+
const resolved = await resolveProjectEntry(projectId);
|
|
168
|
+
if ('error' in resolved)
|
|
169
|
+
return c.json({ error: resolved.error, ...(resolved.code ? { code: resolved.code } : {}) }, resolved.status);
|
|
170
|
+
const webhook = projectWebhooks(resolved.entry).find((candidate) => candidate.id === webhookId);
|
|
171
|
+
if (!webhook)
|
|
172
|
+
return c.json({ error: `unknown webhook: ${webhookId}` }, 404);
|
|
173
|
+
const body = await sendTestDelivery(resolved.entry.id, webhook);
|
|
174
|
+
return c.json(body);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/features/webhooks/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,OAAO,E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AA+C,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAChH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,OAAO,IAAI,QAAQ;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtI,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,SAAS,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAC7E,MAAM,IAAI,GAA+B,MAAM,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC5F,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpBundleRouteDefinition, ServerHookDefinition } from '../../plugin/index.ts';
|
|
2
|
+
import type { RunStore } from '../../runs/store.ts';
|
|
3
|
+
import { TaskWebhook } from './webhook.ts';
|
|
4
|
+
/** Test seam owned by the webhooks feature: overrides `fetch` for webhook deliveries. */
|
|
5
|
+
export declare function setWebhookFetchOverride(fetchImpl: typeof fetch | undefined): void;
|
|
6
|
+
/** Return the `TaskWebhook` attached to `store`, if any (used by feature testkits to await `idle()`). */
|
|
7
|
+
export declare function webhookForStore(store: RunStore): TaskWebhook | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Attaches one `TaskWebhook` per served store in `onProjectStoreOpened` (before recovery) and
|
|
10
|
+
* releases queued deliveries once `context.cockpitOrigin` resolves.
|
|
11
|
+
*/
|
|
12
|
+
export declare const webhooksServerHook: ServerHookDefinition;
|
|
13
|
+
/** Project-scoped `/agent-webhooks` and `/agent-webhooks/:webhook` HTTP route bundle. */
|
|
14
|
+
export declare const agentWebhooksHttpRoute: HttpBundleRouteDefinition;
|
|
15
|
+
/** Workspace-scoped `/projects/:projectId/webhook(s)/*` HTTP route bundle. */
|
|
16
|
+
export declare const projectWebhooksHttpRoute: HttpBundleRouteDefinition;
|