@phnx-labs/agents-cli 1.23.13 → 1.23.15

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.
Files changed (164) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +30 -59
  3. package/dist/cli/command-registry.js +0 -24
  4. package/dist/commands/accounts.js +3 -3
  5. package/dist/commands/daemon.js +5 -147
  6. package/dist/commands/doctor.js +7 -0
  7. package/dist/commands/events-logs.d.ts +2 -0
  8. package/dist/commands/{logs.js → events-logs.js} +28 -127
  9. package/dist/commands/events.js +3 -1
  10. package/dist/commands/exec.d.ts +0 -1
  11. package/dist/commands/exec.js +3 -11
  12. package/dist/commands/feed.d.ts +1 -1
  13. package/dist/commands/feed.js +4 -7
  14. package/dist/commands/mcp.js +1 -1
  15. package/dist/commands/menubar.js +12 -226
  16. package/dist/commands/projects.js +1 -2
  17. package/dist/commands/{trash.d.ts → prune-trash.d.ts} +1 -1
  18. package/dist/commands/{trash.js → prune-trash.js} +8 -8
  19. package/dist/commands/prune.js +3 -1
  20. package/dist/commands/send.js +2 -5
  21. package/dist/commands/sessions.js +1 -1
  22. package/dist/commands/ssh.js +2 -2
  23. package/dist/commands/utils.d.ts +1 -5
  24. package/dist/commands/utils.js +1 -7
  25. package/dist/lib/agent-spec/agents.d.ts +0 -2
  26. package/dist/lib/agent-spec/agents.js +0 -12
  27. package/dist/lib/agent-spec/index.d.ts +0 -4
  28. package/dist/lib/agent-spec/index.js +0 -4
  29. package/dist/lib/commands.d.ts +1 -5
  30. package/dist/lib/commands.js +2 -69
  31. package/dist/lib/comms-render.d.ts +0 -7
  32. package/dist/lib/comms-render.js +0 -41
  33. package/dist/lib/config-keys.d.ts +1 -1
  34. package/dist/lib/config-keys.js +8 -0
  35. package/dist/lib/daemon/daemon.js +1 -6
  36. package/dist/lib/daemon-services.d.ts +1 -1
  37. package/dist/lib/daemon-services.js +0 -5
  38. package/dist/lib/device-config.d.ts +2 -0
  39. package/dist/lib/device-config.js +81 -8
  40. package/dist/lib/devices/doctor-findings.d.ts +6 -1
  41. package/dist/lib/devices/doctor-findings.js +34 -1
  42. package/dist/lib/git.d.ts +1 -0
  43. package/dist/lib/git.js +5 -0
  44. package/dist/lib/hooks/install.d.ts +0 -7
  45. package/dist/lib/hooks/install.js +0 -55
  46. package/dist/lib/hosts/passthrough.js +2 -4
  47. package/dist/lib/hosts/progress.js +2 -2
  48. package/dist/lib/hosts/remote-cmd.js +0 -1
  49. package/dist/lib/installations/migrate.d.ts +1 -0
  50. package/dist/lib/installations/migrate.js +18 -1
  51. package/dist/lib/installations/versions.js +2 -2
  52. package/dist/lib/loop.js +1 -1
  53. package/dist/lib/mailbox-target.d.ts +0 -31
  54. package/dist/lib/mailbox-target.js +0 -37
  55. package/dist/lib/mcp-lookup.d.ts +7 -0
  56. package/dist/lib/mcp-lookup.js +71 -0
  57. package/dist/lib/mcp.d.ts +0 -8
  58. package/dist/lib/mcp.js +0 -47
  59. package/dist/lib/menubar/install-menubar.d.ts +0 -15
  60. package/dist/lib/menubar/install-menubar.js +24 -118
  61. package/dist/lib/menubar/resolve-version.d.ts +9 -10
  62. package/dist/lib/menubar/resolve-version.js +70 -30
  63. package/dist/lib/paths.d.ts +0 -1
  64. package/dist/lib/paths.js +0 -18
  65. package/dist/lib/plugins/skills.d.ts +0 -10
  66. package/dist/lib/plugins/skills.js +2 -165
  67. package/dist/lib/project-pull.js +1 -2
  68. package/dist/lib/resources.d.ts +1 -1
  69. package/dist/lib/routines-project.js +1 -1
  70. package/dist/lib/session/local-tmux-attach.js +2 -2
  71. package/dist/lib/startup/command-registry.js +20 -7
  72. package/dist/lib/teams/agents.js +1 -1
  73. package/dist/lib/teams/placement-probe.d.ts +9 -0
  74. package/dist/lib/teams/placement-probe.js +20 -15
  75. package/dist/lib/triggers/webhook.d.ts +2 -59
  76. package/dist/lib/triggers/webhook.js +2 -422
  77. package/package.json +2 -1
  78. package/dist/commands/funnel.d.ts +0 -2
  79. package/dist/commands/funnel.js +0 -77
  80. package/dist/commands/logs.d.ts +0 -2
  81. package/dist/commands/mailboxes.d.ts +0 -2
  82. package/dist/commands/mailboxes.js +0 -400
  83. package/dist/commands/message.d.ts +0 -2
  84. package/dist/commands/message.js +0 -259
  85. package/dist/commands/packages-materialize.d.ts +0 -6
  86. package/dist/commands/packages-materialize.js +0 -90
  87. package/dist/commands/packages.d.ts +0 -5
  88. package/dist/commands/packages.js +0 -763
  89. package/dist/commands/route.d.ts +0 -2
  90. package/dist/commands/route.js +0 -259
  91. package/dist/commands/testdata/feed-hub.d.ts +0 -1
  92. package/dist/commands/testdata/feed-hub.js +0 -11
  93. package/dist/commands/tmux.d.ts +0 -7
  94. package/dist/commands/tmux.js +0 -529
  95. package/dist/commands/traces.d.ts +0 -2
  96. package/dist/commands/traces.js +0 -204
  97. package/dist/commands/webhook.d.ts +0 -5
  98. package/dist/commands/webhook.js +0 -105
  99. package/dist/lib/agent-spec/materialize.d.ts +0 -3
  100. package/dist/lib/agent-spec/materialize.js +0 -277
  101. package/dist/lib/agent-spec/package-resolve.d.ts +0 -4
  102. package/dist/lib/agent-spec/package-resolve.js +0 -231
  103. package/dist/lib/agent-spec/package-schema.d.ts +0 -3
  104. package/dist/lib/agent-spec/package-schema.js +0 -136
  105. package/dist/lib/agent-spec/package-types.d.ts +0 -94
  106. package/dist/lib/agent-spec/package-types.js +0 -10
  107. package/dist/lib/daemon/testdata/process-view-daemon.d.ts +0 -1
  108. package/dist/lib/daemon/testdata/process-view-daemon.js +0 -12
  109. package/dist/lib/daemon/testdata/process-view-start.d.ts +0 -1
  110. package/dist/lib/daemon/testdata/process-view-start.js +0 -41
  111. package/dist/lib/daemon/webhook-receiver-service.d.ts +0 -8
  112. package/dist/lib/daemon/webhook-receiver-service.js +0 -16
  113. package/dist/lib/daemon-webhooks.d.ts +0 -48
  114. package/dist/lib/daemon-webhooks.js +0 -177
  115. package/dist/lib/funnel.d.ts +0 -6
  116. package/dist/lib/funnel.js +0 -31
  117. package/dist/lib/net-close.d.ts +0 -2
  118. package/dist/lib/net-close.js +0 -20
  119. package/dist/lib/packages/output-home.d.ts +0 -9
  120. package/dist/lib/packages/output-home.js +0 -89
  121. package/dist/lib/registry.d.ts +0 -65
  122. package/dist/lib/registry.js +0 -432
  123. package/dist/lib/routers.d.ts +0 -25
  124. package/dist/lib/routers.js +0 -122
  125. package/dist/lib/run-trace-sync.d.ts +0 -7
  126. package/dist/lib/run-trace-sync.js +0 -35
  127. package/dist/lib/session/testdata/pid-registry-namespace.d.ts +0 -1
  128. package/dist/lib/session/testdata/pid-registry-namespace.js +0 -25
  129. package/dist/lib/session/testdata/process-view-namespace.d.ts +0 -1
  130. package/dist/lib/session/testdata/process-view-namespace.js +0 -56
  131. package/dist/lib/session/testdata/process-view-private.d.ts +0 -1
  132. package/dist/lib/session/testdata/process-view-private.js +0 -11
  133. package/dist/lib/testdata/daemon-health-writer.d.ts +0 -1
  134. package/dist/lib/testdata/daemon-health-writer.js +0 -8
  135. package/dist/lib/testdata/owner-notify-api.d.ts +0 -23
  136. package/dist/lib/testdata/owner-notify-api.js +0 -82
  137. package/dist/lib/testdata/refresh-coordinator-worker.d.ts +0 -1
  138. package/dist/lib/testdata/refresh-coordinator-worker.js +0 -23
  139. package/dist/lib/traces/backend.d.ts +0 -8
  140. package/dist/lib/traces/backend.js +0 -33
  141. package/dist/lib/traces/classify.d.ts +0 -40
  142. package/dist/lib/traces/classify.js +0 -70
  143. package/dist/lib/traces/config.d.ts +0 -2
  144. package/dist/lib/traces/config.js +0 -2
  145. package/dist/lib/traces/insights.d.ts +0 -30
  146. package/dist/lib/traces/insights.js +0 -198
  147. package/dist/lib/traces/phenotype.d.ts +0 -18
  148. package/dist/lib/traces/phenotype.js +0 -335
  149. package/dist/lib/traces/provision.d.ts +0 -16
  150. package/dist/lib/traces/provision.js +0 -25
  151. package/dist/lib/traces/schema2-build.d.ts +0 -28
  152. package/dist/lib/traces/schema2-build.js +0 -496
  153. package/dist/lib/traces/schema2-danger.d.ts +0 -7
  154. package/dist/lib/traces/schema2-danger.js +0 -123
  155. package/dist/lib/traces/schema2.d.ts +0 -139
  156. package/dist/lib/traces/schema2.js +0 -20
  157. package/dist/lib/traces/segments.d.ts +0 -73
  158. package/dist/lib/traces/segments.js +0 -236
  159. package/dist/lib/traces/sync.d.ts +0 -197
  160. package/dist/lib/traces/sync.js +0 -654
  161. package/dist/lib/traces/worker-template.d.ts +0 -1
  162. package/dist/lib/traces/worker-template.js +0 -292
  163. package/dist/lib/triggers/handlers.d.ts +0 -66
  164. package/dist/lib/triggers/handlers.js +0 -383
@@ -1,292 +0,0 @@
1
- export function renderTracesWorkerScript() {
2
- return `// GENERATED by agents-cli agents traces — do not edit; edit
3
- // src/lib/traces/worker-template.ts and re-provision.
4
- export const hooks = {
5
- verifyPhoenixToken: defaultVerifyPhoenixToken,
6
- };
7
-
8
- export default {
9
- async fetch(request, env) {
10
- const url = new URL(request.url);
11
- const path = decodeURIComponent(url.pathname.replace(/^\\/+/, ''));
12
-
13
- if (!path) {
14
- return new Response(
15
- 'agents traces — PUT /<userId>/<device>/index.json or sessions/<id>.json to upload; GET the same path to read. All routes require a Phoenix bearer.',
16
- { status: 200, headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'private, no-store' } },
17
- );
18
- }
19
-
20
- if (request.method === 'PUT') {
21
- return handlePut(request, env, path);
22
- }
23
-
24
- if (request.method === 'GET' || request.method === 'HEAD') {
25
- return handleGet(request, env, path);
26
- }
27
-
28
- return json({ error: 'method not allowed' }, 405);
29
- },
30
- };
31
-
32
- async function handlePut(request, env, path) {
33
- const auth = await authorizeWrite(request, env);
34
- if (auth.error) return auth.error;
35
-
36
- const segments = path.split('/').filter(Boolean);
37
- const expected = auth.owner;
38
- if (!expected || segments[0] !== expected) {
39
- return json({ error: 'namespace mismatch', owner: expected }, 403);
40
- }
41
-
42
- const contentType = request.headers.get('content-type') || 'application/json; charset=utf-8';
43
- await env.BUCKET.put(path, request.body, {
44
- httpMetadata: { contentType },
45
- customMetadata: {
46
- owner: auth.owner,
47
- uploadedAt: new Date().toISOString(),
48
- },
49
- });
50
-
51
- const headers = new Headers();
52
- headers.set('cache-control', 'private, no-store');
53
- return new Response(JSON.stringify({ ok: true, key: path }), {
54
- status: 200,
55
- headers,
56
- });
57
- }
58
-
59
- async function handleGet(request, env, path) {
60
- const auth = await authorizeRead(request, env, path);
61
- if (auth.error) return auth.error;
62
-
63
- const segments = path.split('/').filter(Boolean);
64
- // The "all agents" view is synthesized, not stored: merge this owner's device
65
- // shards on read. segments[0] === owner is already enforced by authorizeRead.
66
- if (segments[1] === 'all') {
67
- return handleAggregate(request, env, segments[0], segments.slice(2).join('/'));
68
- }
69
-
70
- const object = await env.BUCKET.get(path);
71
- if (!object) return json({ error: 'not found' }, 404);
72
-
73
- const headers = new Headers(object.httpMetadata ?? {});
74
- headers.set('cache-control', 'private, no-store');
75
- return new Response(object.body, { headers });
76
- }
77
-
78
- // Enumerate this owner's real device names (never 'all') using a delimited list
79
- // so we read one page of prefixes, not every session object.
80
- async function listDevices(env, owner) {
81
- const listed = await env.BUCKET.list({ prefix: owner + '/', delimiter: '/' });
82
- const prefixes = (listed && listed.delimitedPrefixes) || [];
83
- const base = owner + '/';
84
- return prefixes
85
- .map((p) => (p.startsWith(base) ? p.slice(base.length) : p).replace(/\\/+$/, ''))
86
- .filter((d) => d && d !== 'all');
87
- }
88
-
89
- async function handleAggregate(request, env, owner, rest) {
90
- const devices = await listDevices(env, owner);
91
- if (devices.length === 0) return json({ error: 'not found' }, 404);
92
-
93
- // A single session drill-down: the shard lives under whichever device owns it.
94
- if (rest.startsWith('sessions/')) {
95
- for (const device of devices) {
96
- const object = await env.BUCKET.get(owner + '/' + device + '/' + rest);
97
- if (object) {
98
- const headers = new Headers(object.httpMetadata ?? {});
99
- headers.set('cache-control', 'private, no-store');
100
- return new Response(object.body, { headers });
101
- }
102
- }
103
- return json({ error: 'not found' }, 404);
104
- }
105
-
106
- if (rest === 'index.json') {
107
- const shards = [];
108
- for (const device of devices) {
109
- const object = await env.BUCKET.get(owner + '/' + device + '/index.json');
110
- if (!object) continue;
111
- try {
112
- shards.push(JSON.parse(await object.text()));
113
- } catch {
114
- // A corrupt per-device shard must not sink the whole aggregate.
115
- }
116
- }
117
- if (shards.length === 0) return json({ error: 'not found' }, 404);
118
- return json(mergeIndexShards(shards, owner), 200);
119
- }
120
-
121
- return json({ error: 'not found' }, 404);
122
- }
123
-
124
- // Merge per-device index shards into one "all agents" shard. One device is an
125
- // exact passthrough (relabelled). For many, counts sum and lists concat+resort;
126
- // median/latency percentiles cannot be recomputed without the raw per-session
127
- // sample, so they are session-count-weighted approximations — good enough for an
128
- // at-a-glance fleet view, and exact the moment you filter to a single device.
129
- function mergeIndexShards(shards, owner) {
130
- if (shards.length === 1) {
131
- return Object.assign({}, shards[0], { device: 'all', owner });
132
- }
133
- const sorted = shards.slice().sort((a, b) => (b.syncedAt || 0) - (a.syncedAt || 0));
134
- const totalSessions = sorted.reduce((n, s) => n + ((s.stats && s.stats.sessionsImported) || 0), 0) || 1;
135
- const wsum = (pick) => sorted.reduce((n, s) => n + (pick(s) || 0) * ((s.stats && s.stats.sessionsImported) || 0), 0) / totalSessions;
136
-
137
- const topicCounts = new Map();
138
- for (const s of sorted) for (const t of s.topics || []) {
139
- const cur = topicCounts.get(t.key) || Object.assign({}, t, { count: 0 });
140
- cur.count += t.count || 0;
141
- topicCounts.set(t.key, cur);
142
- }
143
- const byToolError = new Map();
144
- // Accumulate byCause over WHATEVER cause keys each shard carries (real / guard /
145
- // hook / behavioral / any future TraceFailureCause) rather than a hand-enumerated
146
- // set — a hardcoded {real,guard,hook} silently dropped a new member from the /all
147
- // view and made the cause sum NaN (RUSH-2988).
148
- const byCause = {};
149
- for (const s of sorted) {
150
- const f = s.failures || {};
151
- for (const e of f.byToolError || []) {
152
- const key = e.tool + '\\u0000' + e.desc + '\\u0000' + e.cause;
153
- const cur = byToolError.get(key) || Object.assign({}, e, { count: 0 });
154
- cur.count += e.count || 0;
155
- byToolError.set(key, cur);
156
- }
157
- for (const [cause, n] of Object.entries((f.byCause) || {})) {
158
- byCause[cause] = (byCause[cause] || 0) + (n || 0);
159
- }
160
- }
161
- // Fold failure patterns by their stable id, the same way topics/byToolError fold
162
- // by key above — a signature that fired on two devices (a rate limit on the laptop
163
- // AND on CI) is ONE ranked issue with combined counts, not two half-counted rows.
164
- const patternById = new Map();
165
- for (const s of sorted) for (const p of s.failurePatterns || []) {
166
- const cur = patternById.get(p.id);
167
- if (!cur) {
168
- patternById.set(p.id, Object.assign({}, p, { exampleSessionIds: (p.exampleSessionIds || []).slice(0, 5) }));
169
- } else {
170
- cur.sessions += p.sessions || 0;
171
- cur.occurrences += p.occurrences || 0;
172
- cur.wastedMs += p.wastedMs || 0;
173
- for (const id of p.exampleSessionIds || []) {
174
- if (cur.exampleSessionIds.length < 5 && !cur.exampleSessionIds.includes(id)) cur.exampleSessionIds.push(id);
175
- }
176
- }
177
- }
178
- const latencies = sorted.map((s) => s.latency).filter(Boolean);
179
-
180
- return {
181
- schema: 1,
182
- device: 'all',
183
- owner,
184
- syncedAt: sorted[0].syncedAt || 0,
185
- stats: {
186
- sessionsImported: sorted.reduce((n, s) => n + ((s.stats && s.stats.sessionsImported) || 0), 0),
187
- medianMs: Math.round(wsum((s) => s.stats && s.stats.medianMs)),
188
- p90Ms: Math.max.apply(null, sorted.map((s) => (s.stats && s.stats.p90Ms) || 0)),
189
- needAttention: sorted.reduce((n, s) => n + ((s.stats && s.stats.needAttention) || 0), 0),
190
- toolErrorRate: wsum((s) => s.stats && s.stats.toolErrorRate),
191
- },
192
- needsAttention: sorted.flatMap((s) => s.needsAttention || [])
193
- .sort((a, b) => (b.severity || 0) - (a.severity || 0) || String(a.id).localeCompare(String(b.id)))
194
- .slice(0, 100),
195
- topics: Array.from(topicCounts.values()).sort((a, b) => b.count - a.count),
196
- failures: {
197
- byToolError: Array.from(byToolError.values()).sort((a, b) => b.count - a.count).slice(0, 50),
198
- byCause,
199
- },
200
- failurePatterns: Array.from(patternById.values())
201
- .sort((a, b) => (b.wastedMs || 0) - (a.wastedMs || 0)).slice(0, 25),
202
- wastedMsTotal: sorted.reduce((n, s) => n + (s.wastedMsTotal || 0), 0),
203
- // Per-session roster (PHNX-3483): concat every device's rows so the "all"
204
- // view can filter + re-aggregate client-side exactly like a single device.
205
- // Devices still on a pre-roster CLI contribute none (|| []) and degrade to
206
- // the pre-rolled stats, so coverage grows as devices update — never crashes.
207
- sessions: sorted.flatMap((s) => s.sessions || []),
208
- latency: latencies.length ? {
209
- firstToolMs: {
210
- p50: Math.round(wsum((s) => s.latency && s.latency.firstToolMs && s.latency.firstToolMs.p50)),
211
- p90: Math.max.apply(null, latencies.map((l) => (l.firstToolMs && l.firstToolMs.p90) || 0)),
212
- p99: Math.max.apply(null, latencies.map((l) => (l.firstToolMs && l.firstToolMs.p99) || 0)),
213
- max: Math.max.apply(null, latencies.map((l) => (l.firstToolMs && l.firstToolMs.max) || 0)),
214
- },
215
- } : undefined,
216
- // Rolling history / drift are per-device time series; the freshest device's
217
- // are the most representative for the merged view without double-counting.
218
- bucketHistory: sorted[0].bucketHistory || [],
219
- driftSignals: sorted[0].driftSignals || [],
220
- };
221
- }
222
-
223
- // Require a Phoenix bearer that owns the path prefix.
224
- async function authorizeRead(request, env, path) {
225
- const claims = await hooks.verifyPhoenixToken(request, env);
226
- if (!claims) return { error: json({ error: 'unauthorized' }, 401) };
227
- const ownerId = path.split('/').filter(Boolean)[0] || '';
228
- if (!ownerId || ownerId !== claims.userId) {
229
- return { error: json({ error: 'forbidden' }, 403) };
230
- }
231
- return { claims };
232
- }
233
-
234
- // Two legitimate principals for writes: static WRITE_TOKEN first (BYO),
235
- // otherwise Phoenix bearer. 401 when neither authenticates.
236
- async function authorizeWrite(request, env) {
237
- const presented = (request.headers.get('authorization') || '').replace(/^Bearer\\s+/i, '');
238
- if (!presented) return { error: json({ error: 'unauthorized' }, 401) };
239
- if (env.WRITE_TOKEN && safeEqual(presented, env.WRITE_TOKEN)) {
240
- return { kind: 'byo', owner: env.TRACES_NAMESPACE || 'byo' };
241
- }
242
- const claims = await hooks.verifyPhoenixToken(request, env);
243
- if (claims && typeof claims.userId === 'string' && claims.userId) {
244
- return { kind: 'phoenix', owner: claims.userId };
245
- }
246
- return { error: json({ error: 'unauthorized' }, 401) };
247
- }
248
-
249
- async function defaultVerifyPhoenixToken(request, env) {
250
- const presented = (request.headers.get('authorization') || '').replace(/^Bearer\\s+/i, '');
251
- if (!presented) return null;
252
- const base = typeof env.PHOENIX_ID_BASE === 'string' ? env.PHOENIX_ID_BASE.replace(/\\/+$/, '') : '';
253
- if (!base) return null;
254
- let res;
255
- try {
256
- res = await fetch(base + '/api/v1/auth/me', {
257
- method: 'GET',
258
- headers: { Authorization: 'Bearer ' + presented },
259
- });
260
- } catch {
261
- return null;
262
- }
263
- if (!res.ok) return null;
264
- let body;
265
- try {
266
- body = await res.json();
267
- } catch {
268
- return null;
269
- }
270
- if (!body || typeof body.userId !== 'string' || !body.userId) return null;
271
- return { userId: body.userId, email: typeof body.email === 'string' ? body.email : '' };
272
- }
273
-
274
- function json(body, status = 200) {
275
- return new Response(JSON.stringify(body), {
276
- status,
277
- headers: {
278
- 'content-type': 'application/json; charset=utf-8',
279
- 'cache-control': 'private, no-store',
280
- },
281
- });
282
- }
283
-
284
- // Constant-time comparison so timing attacks can't probe a static WRITE_TOKEN.
285
- function safeEqual(a, b) {
286
- if (a.length !== b.length) return false;
287
- let diff = 0;
288
- for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
289
- return diff === 0;
290
- }
291
- `;
292
- }
@@ -1,66 +0,0 @@
1
- import type { JobConfig, RunMeta, WebhookContext } from '../scheduling/routines.js';
2
- import type { AgentId } from '../types.js';
3
- import type { IncomingWebhook, WebhookSource } from './webhook.js';
4
- export interface WebhookHandler {
5
- name: string;
6
- enabled?: boolean;
7
- devices?: string[];
8
- source: WebhookSource;
9
- event?: string;
10
- action?: string;
11
- stateTo?: string;
12
- stateFrom?: string;
13
- teamKey?: string;
14
- label?: string;
15
- repo?: string;
16
- branch?: string;
17
- command?: string;
18
- channel?: string;
19
- host?: string;
20
- project?: string;
21
- cwd?: string;
22
- mode?: JobConfig['mode'];
23
- run?: {
24
- agent?: AgentId;
25
- workflow?: string;
26
- command?: string;
27
- prompt?: string;
28
- env?: Record<string, string>;
29
- };
30
- routine?: string;
31
- }
32
- export interface FiredHandler {
33
- handlerName: string;
34
- runId?: string;
35
- exitCode?: number;
36
- output?: string;
37
- }
38
- interface HandlerHostResolution {
39
- host?: string;
40
- hostStrategy?: 'host' | 'fleet';
41
- }
42
- export declare function resolveHandlerHost(host: string | undefined): HandlerHostResolution;
43
- export declare function listHandlers(cwd?: string): WebhookHandler[];
44
- export declare function handlerMatchesWebhook(handler: WebhookHandler, webhook: IncomingWebhook): boolean;
45
- export interface SlackMessageContext {
46
- text: string;
47
- project: string;
48
- prompt: string;
49
- channel: string;
50
- thread_ts: string;
51
- user: string;
52
- command: string;
53
- response_url: string;
54
- }
55
- export declare function buildWebhookContext(webhook: IncomingWebhook): WebhookContext;
56
- interface ExecuteHandlerOptions {
57
- dispatchAgent?: (config: JobConfig) => Promise<RunMeta>;
58
- dispatchWorkflow?: (config: JobConfig) => Promise<RunMeta>;
59
- execCommand?: (command: string) => Promise<{
60
- exitCode: number;
61
- output: string;
62
- }>;
63
- dispatchRoutine?: (config: JobConfig) => Promise<RunMeta>;
64
- }
65
- export declare function executeHandler(handler: WebhookHandler, webhook: IncomingWebhook, opts?: ExecuteHandlerOptions): Promise<FiredHandler>;
66
- export {};