@phnx-labs/agents-cli 1.23.12 → 1.23.14

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 (163) hide show
  1. package/CHANGELOG.md +42 -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/setup.js +1 -1
  23. package/dist/commands/ssh.js +2 -2
  24. package/dist/commands/utils.d.ts +1 -5
  25. package/dist/commands/utils.js +1 -7
  26. package/dist/lib/agent-spec/agents.d.ts +0 -2
  27. package/dist/lib/agent-spec/agents.js +0 -12
  28. package/dist/lib/agent-spec/index.d.ts +0 -4
  29. package/dist/lib/agent-spec/index.js +0 -4
  30. package/dist/lib/commands.d.ts +1 -5
  31. package/dist/lib/commands.js +2 -69
  32. package/dist/lib/comms-render.d.ts +0 -7
  33. package/dist/lib/comms-render.js +0 -41
  34. package/dist/lib/config-keys.d.ts +1 -1
  35. package/dist/lib/config-keys.js +8 -0
  36. package/dist/lib/daemon/daemon.js +1 -6
  37. package/dist/lib/daemon-services.d.ts +1 -1
  38. package/dist/lib/daemon-services.js +0 -5
  39. package/dist/lib/device-config.d.ts +2 -0
  40. package/dist/lib/device-config.js +81 -8
  41. package/dist/lib/devices/doctor-findings.d.ts +6 -1
  42. package/dist/lib/devices/doctor-findings.js +34 -1
  43. package/dist/lib/git.d.ts +1 -0
  44. package/dist/lib/git.js +5 -0
  45. package/dist/lib/hooks/install.d.ts +0 -7
  46. package/dist/lib/hooks/install.js +0 -55
  47. package/dist/lib/hosts/passthrough.js +2 -4
  48. package/dist/lib/hosts/progress.js +2 -2
  49. package/dist/lib/hosts/remote-cmd.js +0 -1
  50. package/dist/lib/installations/migrate.d.ts +1 -0
  51. package/dist/lib/installations/migrate.js +18 -1
  52. package/dist/lib/installations/versions.js +2 -2
  53. package/dist/lib/loop.js +1 -1
  54. package/dist/lib/mailbox-target.d.ts +0 -31
  55. package/dist/lib/mailbox-target.js +0 -37
  56. package/dist/lib/mcp-lookup.d.ts +7 -0
  57. package/dist/lib/mcp-lookup.js +71 -0
  58. package/dist/lib/mcp.d.ts +0 -8
  59. package/dist/lib/mcp.js +0 -47
  60. package/dist/lib/menubar/install-menubar.d.ts +0 -15
  61. package/dist/lib/menubar/install-menubar.js +24 -118
  62. package/dist/lib/menubar/resolve-version.d.ts +9 -10
  63. package/dist/lib/menubar/resolve-version.js +70 -30
  64. package/dist/lib/paths.d.ts +0 -1
  65. package/dist/lib/paths.js +0 -18
  66. package/dist/lib/plugins/skills.d.ts +0 -10
  67. package/dist/lib/plugins/skills.js +2 -165
  68. package/dist/lib/project-pull.js +1 -2
  69. package/dist/lib/resources.d.ts +1 -1
  70. package/dist/lib/routines-project.js +1 -1
  71. package/dist/lib/session/local-tmux-attach.js +2 -2
  72. package/dist/lib/startup/command-registry.js +20 -7
  73. package/dist/lib/teams/agents.js +1 -1
  74. package/dist/lib/triggers/webhook.d.ts +2 -59
  75. package/dist/lib/triggers/webhook.js +2 -422
  76. package/package.json +2 -1
  77. package/dist/commands/funnel.d.ts +0 -2
  78. package/dist/commands/funnel.js +0 -77
  79. package/dist/commands/logs.d.ts +0 -2
  80. package/dist/commands/mailboxes.d.ts +0 -2
  81. package/dist/commands/mailboxes.js +0 -400
  82. package/dist/commands/message.d.ts +0 -2
  83. package/dist/commands/message.js +0 -259
  84. package/dist/commands/packages-materialize.d.ts +0 -6
  85. package/dist/commands/packages-materialize.js +0 -90
  86. package/dist/commands/packages.d.ts +0 -5
  87. package/dist/commands/packages.js +0 -763
  88. package/dist/commands/route.d.ts +0 -2
  89. package/dist/commands/route.js +0 -259
  90. package/dist/commands/testdata/feed-hub.d.ts +0 -1
  91. package/dist/commands/testdata/feed-hub.js +0 -11
  92. package/dist/commands/tmux.d.ts +0 -7
  93. package/dist/commands/tmux.js +0 -529
  94. package/dist/commands/traces.d.ts +0 -2
  95. package/dist/commands/traces.js +0 -204
  96. package/dist/commands/webhook.d.ts +0 -5
  97. package/dist/commands/webhook.js +0 -105
  98. package/dist/lib/agent-spec/materialize.d.ts +0 -3
  99. package/dist/lib/agent-spec/materialize.js +0 -277
  100. package/dist/lib/agent-spec/package-resolve.d.ts +0 -4
  101. package/dist/lib/agent-spec/package-resolve.js +0 -231
  102. package/dist/lib/agent-spec/package-schema.d.ts +0 -3
  103. package/dist/lib/agent-spec/package-schema.js +0 -136
  104. package/dist/lib/agent-spec/package-types.d.ts +0 -94
  105. package/dist/lib/agent-spec/package-types.js +0 -10
  106. package/dist/lib/daemon/testdata/process-view-daemon.d.ts +0 -1
  107. package/dist/lib/daemon/testdata/process-view-daemon.js +0 -12
  108. package/dist/lib/daemon/testdata/process-view-start.d.ts +0 -1
  109. package/dist/lib/daemon/testdata/process-view-start.js +0 -41
  110. package/dist/lib/daemon/webhook-receiver-service.d.ts +0 -8
  111. package/dist/lib/daemon/webhook-receiver-service.js +0 -16
  112. package/dist/lib/daemon-webhooks.d.ts +0 -48
  113. package/dist/lib/daemon-webhooks.js +0 -177
  114. package/dist/lib/funnel.d.ts +0 -6
  115. package/dist/lib/funnel.js +0 -31
  116. package/dist/lib/net-close.d.ts +0 -2
  117. package/dist/lib/net-close.js +0 -20
  118. package/dist/lib/packages/output-home.d.ts +0 -9
  119. package/dist/lib/packages/output-home.js +0 -89
  120. package/dist/lib/registry.d.ts +0 -65
  121. package/dist/lib/registry.js +0 -432
  122. package/dist/lib/routers.d.ts +0 -25
  123. package/dist/lib/routers.js +0 -122
  124. package/dist/lib/run-trace-sync.d.ts +0 -7
  125. package/dist/lib/run-trace-sync.js +0 -35
  126. package/dist/lib/session/testdata/pid-registry-namespace.d.ts +0 -1
  127. package/dist/lib/session/testdata/pid-registry-namespace.js +0 -25
  128. package/dist/lib/session/testdata/process-view-namespace.d.ts +0 -1
  129. package/dist/lib/session/testdata/process-view-namespace.js +0 -56
  130. package/dist/lib/session/testdata/process-view-private.d.ts +0 -1
  131. package/dist/lib/session/testdata/process-view-private.js +0 -11
  132. package/dist/lib/testdata/daemon-health-writer.d.ts +0 -1
  133. package/dist/lib/testdata/daemon-health-writer.js +0 -8
  134. package/dist/lib/testdata/owner-notify-api.d.ts +0 -23
  135. package/dist/lib/testdata/owner-notify-api.js +0 -82
  136. package/dist/lib/testdata/refresh-coordinator-worker.d.ts +0 -1
  137. package/dist/lib/testdata/refresh-coordinator-worker.js +0 -23
  138. package/dist/lib/traces/backend.d.ts +0 -8
  139. package/dist/lib/traces/backend.js +0 -33
  140. package/dist/lib/traces/classify.d.ts +0 -40
  141. package/dist/lib/traces/classify.js +0 -70
  142. package/dist/lib/traces/config.d.ts +0 -2
  143. package/dist/lib/traces/config.js +0 -2
  144. package/dist/lib/traces/insights.d.ts +0 -30
  145. package/dist/lib/traces/insights.js +0 -198
  146. package/dist/lib/traces/phenotype.d.ts +0 -18
  147. package/dist/lib/traces/phenotype.js +0 -335
  148. package/dist/lib/traces/provision.d.ts +0 -16
  149. package/dist/lib/traces/provision.js +0 -25
  150. package/dist/lib/traces/schema2-build.d.ts +0 -28
  151. package/dist/lib/traces/schema2-build.js +0 -496
  152. package/dist/lib/traces/schema2-danger.d.ts +0 -7
  153. package/dist/lib/traces/schema2-danger.js +0 -123
  154. package/dist/lib/traces/schema2.d.ts +0 -139
  155. package/dist/lib/traces/schema2.js +0 -20
  156. package/dist/lib/traces/segments.d.ts +0 -73
  157. package/dist/lib/traces/segments.js +0 -236
  158. package/dist/lib/traces/sync.d.ts +0 -197
  159. package/dist/lib/traces/sync.js +0 -654
  160. package/dist/lib/traces/worker-template.d.ts +0 -1
  161. package/dist/lib/traces/worker-template.js +0 -292
  162. package/dist/lib/triggers/handlers.d.ts +0 -66
  163. package/dist/lib/triggers/handlers.js +0 -383
@@ -3,8 +3,8 @@ import * as path from 'path';
3
3
  import * as os from 'os';
4
4
  import * as yaml from 'yaml';
5
5
  import { normalizeAliases } from '../resource-aliases.js';
6
- import { AGENTS, ensureSkillsDir, agentConfigDirName } from '../agents.js';
7
- import { capableAgents, isCapable } from '../capabilities.js';
6
+ import { AGENTS, agentConfigDirName } from '../agents.js';
7
+ import { capableAgents } from '../capabilities.js';
8
8
  import { getUserSkillsDir, getSkillsDir as getSystemSkillsDir, getProjectAgentsDir, getEnabledExtraRepos, getTrashSkillsDir } from '../state.js';
9
9
  import { getEffectiveHome, getVersionHomePath, listInstalledVersions } from '../installations/store.js';
10
10
  import { listCommandSkillsInVersion } from '../command-skills.js';
@@ -179,57 +179,6 @@ export function discoverSkillsFromRepo(repoPath) {
179
179
  }
180
180
  return skills;
181
181
  }
182
- export function installSkill(sourcePath, skillName, agents, method = 'symlink') {
183
- const metadata = parseSkillMetadata(sourcePath);
184
- const validation = validateSkillMetadata(metadata, skillName);
185
- if (!validation.valid) {
186
- return {
187
- success: false,
188
- error: `Invalid skill: ${validation.errors.join(', ')}`,
189
- warnings: validation.warnings,
190
- };
191
- }
192
- ensureCentralSkillsDir();
193
- const centralPath = path.join(getSkillsDir(), skillName);
194
- if (!fs.existsSync(centralPath)) {
195
- try {
196
- fs.cpSync(sourcePath, centralPath, { recursive: true });
197
- }
198
- catch (err) {
199
- return { success: false, error: `Failed to copy skill: ${err.message}` };
200
- }
201
- }
202
- for (const agentId of agents) {
203
- if (!isCapable(agentId, 'skills')) {
204
- continue;
205
- }
206
- ensureSkillsDir(agentId);
207
- const agentSkillPath = path.join(getAgentSkillsDir(agentId), skillName);
208
- if (fs.existsSync(agentSkillPath)) {
209
- try {
210
- fs.rmSync(agentSkillPath, { recursive: true, force: true });
211
- }
212
- catch {
213
- }
214
- }
215
- try {
216
- if (method === 'symlink') {
217
- fs.symlinkSync(centralPath, agentSkillPath, 'dir');
218
- }
219
- else {
220
- fs.cpSync(centralPath, agentSkillPath, { recursive: true });
221
- }
222
- }
223
- catch (err) {
224
- return {
225
- success: false,
226
- error: `Failed to ${method} skill to ${agentId}: ${err.message}`,
227
- };
228
- }
229
- }
230
- emit('skill.install', { skill: skillName, agents });
231
- return { success: true };
232
- }
233
182
  export function skillExists(agentId, skillName) {
234
183
  const agentSkillPath = path.join(getAgentSkillsDir(agentId), skillName);
235
184
  return fs.existsSync(agentSkillPath);
@@ -261,30 +210,6 @@ function directoriesMatch(dir1, dir2) {
261
210
  return false;
262
211
  }
263
212
  }
264
- export function skillContentMatches(agentId, skillName, sourcePath) {
265
- const installedPath = path.join(getAgentSkillsDir(agentId), skillName);
266
- if (!fs.existsSync(installedPath) || !fs.existsSync(sourcePath)) {
267
- return false;
268
- }
269
- try {
270
- const installedSkillMd = path.join(installedPath, 'SKILL.md');
271
- const sourceSkillMd = path.join(sourcePath, 'SKILL.md');
272
- if (!fs.existsSync(installedSkillMd) || !fs.existsSync(sourceSkillMd)) {
273
- return false;
274
- }
275
- const installedContent = fs.readFileSync(installedSkillMd, 'utf-8');
276
- const sourceContent = fs.readFileSync(sourceSkillMd, 'utf-8');
277
- if (normalizeContent(installedContent) !== normalizeContent(sourceContent)) {
278
- return false;
279
- }
280
- const installedRulesDir = path.join(installedPath, 'rules');
281
- const sourceRulesDir = path.join(sourcePath, 'rules');
282
- return directoriesMatch(installedRulesDir, sourceRulesDir);
283
- }
284
- catch {
285
- return false;
286
- }
287
- }
288
213
  export function listCentralSkills() {
289
214
  const seen = new Set();
290
215
  for (const dir of [getUserSkillsDir(), getSystemSkillsDir()]) {
@@ -404,94 +329,6 @@ export function diffVersionSkills(agent, version) {
404
329
  }
405
330
  return { agent, version, toAdd: toAdd.sort(), toUpdate: toUpdate.sort(), matched, orphans: orphans.sort() };
406
331
  }
407
- function walkRelativeFiles(base) {
408
- const out = new Set();
409
- if (!fs.existsSync(base))
410
- return out;
411
- const stack = [''];
412
- while (stack.length > 0) {
413
- const rel = stack.pop();
414
- const abs = path.join(base, rel);
415
- let entries;
416
- try {
417
- entries = fs.readdirSync(abs, { withFileTypes: true });
418
- }
419
- catch {
420
- continue;
421
- }
422
- for (const entry of entries) {
423
- const childRel = rel ? path.join(rel, entry.name) : entry.name;
424
- if (entry.isDirectory()) {
425
- stack.push(childRel);
426
- }
427
- else if (entry.isFile()) {
428
- out.add(childRel);
429
- }
430
- }
431
- }
432
- return out;
433
- }
434
- export function installSkillToVersion(agent, version, skillName, method = 'copy') {
435
- const sourcePath = resolveSkillSourcePath(skillName);
436
- if (!sourcePath) {
437
- return { success: false, error: `Skill '${skillName}' not found in central or any extra repo` };
438
- }
439
- const skillsDir = getVersionSkillsDir(agent, version);
440
- if (!fs.existsSync(skillsDir)) {
441
- fs.mkdirSync(skillsDir, { recursive: true });
442
- }
443
- const target = path.join(skillsDir, skillName);
444
- const preserved = [];
445
- if (method === 'copy' && fs.existsSync(target) && !fs.lstatSync(target).isSymbolicLink()) {
446
- const sourceFiles = walkRelativeFiles(sourcePath);
447
- const installedFiles = walkRelativeFiles(target);
448
- for (const rel of installedFiles) {
449
- if (sourceFiles.has(rel))
450
- continue;
451
- try {
452
- const abs = path.join(target, rel);
453
- preserved.push({
454
- rel,
455
- buf: fs.readFileSync(abs),
456
- mode: fs.statSync(abs).mode,
457
- });
458
- }
459
- catch {
460
- }
461
- }
462
- }
463
- if (fs.existsSync(target) || fs.lstatSync(target, { throwIfNoEntry: false })) {
464
- try {
465
- fs.rmSync(target, { recursive: true, force: true });
466
- }
467
- catch (err) {
468
- return { success: false, error: `Failed to remove existing: ${err.message}` };
469
- }
470
- }
471
- try {
472
- if (method === 'symlink') {
473
- fs.symlinkSync(sourcePath, target, 'dir');
474
- }
475
- else {
476
- fs.cpSync(sourcePath, target, { recursive: true });
477
- }
478
- }
479
- catch (err) {
480
- return { success: false, error: `Failed to ${method}: ${err.message}` };
481
- }
482
- for (const { rel, buf, mode } of preserved) {
483
- try {
484
- const dest = path.join(target, rel);
485
- fs.mkdirSync(path.dirname(dest), { recursive: true });
486
- fs.writeFileSync(dest, buf);
487
- fs.chmodSync(dest, mode);
488
- }
489
- catch {
490
- }
491
- }
492
- emit('skill.install', { skill: skillName, agent, version });
493
- return { success: true };
494
- }
495
332
  export function removeSkillFromVersion(agent, version, skillName) {
496
333
  const target = path.join(getVersionSkillsDir(agent, version), skillName);
497
334
  if (!fs.existsSync(target) && !fs.lstatSync(target, { throwIfNoEntry: false })) {
@@ -3,8 +3,7 @@ import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
  import chalk from 'chalk';
5
5
  import { expandLocalHome } from './project-root.js';
6
- import { getRepoCommit, getRemoteUrl, pullRepo } from './git.js';
7
- import { parseOwnerRepoFromRemote } from './registry.js';
6
+ import { getRepoCommit, getRemoteUrl, parseOwnerRepoFromRemote, pullRepo } from './git.js';
8
7
  import { machineId } from './machine-id.js';
9
8
  export function fingerprintTargets(targets) {
10
9
  const lines = targets
@@ -1,6 +1,6 @@
1
1
  import type { AgentId } from './types.js';
2
2
  import { type SkillParseError } from './plugins/skills.js';
3
- export type ResourceKind = 'commands' | 'skills' | 'hooks' | 'rules' | 'mcp' | 'clis' | 'permissions' | 'subagents' | 'workflows' | 'profiles' | 'routers' | 'secrets';
3
+ export type ResourceKind = 'commands' | 'skills' | 'hooks' | 'rules' | 'mcp' | 'clis' | 'permissions' | 'subagents' | 'workflows' | 'profiles' | 'secrets';
4
4
  export interface ResolvedResource {
5
5
  name: string;
6
6
  path: string;
@@ -5,7 +5,7 @@ import * as yaml from 'yaml';
5
5
  import { execFileSync } from 'child_process';
6
6
  import { getProjectAgentsDir, getProjectRoutinesDir, ensureAgentsDir, } from './state.js';
7
7
  import { readJob, writeJob, deleteJob, listJobs, validateJob, } from './scheduling/routines.js';
8
- import { parseOwnerRepoFromRemote } from './registry.js';
8
+ import { parseOwnerRepoFromRemote } from './git.js';
9
9
  import { listProjectDefs, projectDirsAbs } from './projects.js';
10
10
  import { isSafeSegmentName } from './paths.js';
11
11
  export function expandProjectPath(p) {
@@ -30,7 +30,7 @@ async function attachLiveTmuxAlias(selector) {
30
30
  return false;
31
31
  if (!process.stdout.isTTY) {
32
32
  console.error(chalk.red(`"${selector}" is a live tmux session, but attaching needs a TTY.`));
33
- console.error(chalk.gray(` Run it from a terminal, or: agents tmux attach ${selector}`));
33
+ console.error(chalk.gray(` Run it from a terminal, or: tmux -S ${socket} attach -t =${selector}`));
34
34
  process.exitCode = 1;
35
35
  return true;
36
36
  }
@@ -81,7 +81,7 @@ export async function attachLocalLiveSelector(selector, hosts) {
81
81
  return false;
82
82
  if (found.kind === 'collision') {
83
83
  console.error(chalk.red(`"${selector}" matches ${found.aliases.length} live local panes: ${found.aliases.join(', ')}`));
84
- console.error(chalk.gray(' Pass the full alias to disambiguate — see: agents tmux ls'));
84
+ console.error(chalk.gray(` Pass the full alias to disambiguate — see: tmux -S ${getDefaultSocketPath()} ls`));
85
85
  process.exitCode = 1;
86
86
  return true;
87
87
  }
@@ -1,16 +1,15 @@
1
1
  const LOADED_COMMAND_NAMES = [
2
2
  'accounts', 'auth', 'view', 'inspect', 'commands', 'hooks', 'skills', 'rules', 'memory',
3
3
  'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use',
4
- 'remove', 'rm', 'purge', 'update', 'prune', 'import', 'registry', 'search', 'install', 'packages',
4
+ 'remove', 'rm', 'purge', 'update', 'prune', 'import',
5
5
  'routines', 'projects', 'run', '_callback', 'open', 'fork', 'config',
6
- 'models', 'trash', 'doctor',
7
- 'route', 'routes', 'harness', 'harnesses', 'secrets', 'menubar', 'sync',
6
+ 'models', 'doctor',
7
+ 'harness', 'harnesses', 'secrets', 'menubar', 'sync',
8
8
  'refresh-rules', 'factory', 'insights', 'trace',
9
- 'tmux', 'watchdog', 'browser', 'computer', 'logs', 'events',
9
+ 'watchdog', 'browser', 'computer', 'events',
10
10
  'ssh', 'devices', 'fleet', 'repos', 'repo', 'setup', 'uninstall', 'upgrade', 'sessions',
11
- 'teams', 'cloud', 'message', 'ps', 'send', 'feed',
12
- 'mailboxes', 'mailbox', 'webhooks',
13
- 'daemon', 'traces', 'recordings',
11
+ 'teams', 'cloud', 'ps', 'send', 'feed',
12
+ 'daemon', 'recordings',
14
13
  ];
15
14
  const INLINE_COMMAND_NAMES = [
16
15
  'perms', 'exec', 'jobs', 'cron', 'check', 'resources', 'hq', '_internal',
@@ -56,6 +55,20 @@ export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
56
55
  'modes',
57
56
  'feedback',
58
57
  'restore',
58
+ 'route',
59
+ 'routes',
60
+ 'registry',
61
+ 'packages',
62
+ 'search',
63
+ 'install',
64
+ 'tmux',
65
+ 'message',
66
+ 'mailboxes',
67
+ 'mailbox',
68
+ 'traces',
69
+ 'webhooks',
70
+ 'logs',
71
+ 'trash',
59
72
  ]);
60
73
  export function isKnownTopLevelCommand(name) {
61
74
  return KNOWN_TOP_LEVEL_COMMANDS.has(name);
@@ -1402,7 +1402,7 @@ export class AgentManager {
1402
1402
  }
1403
1403
  if (agent.cloudProvider) {
1404
1404
  throw new Error(`Teammate '${who}' is a ${agent.cloudProvider} cloud task — resume it with ` +
1405
- `\`agents message ${agent.cloudSessionId ?? agent.agentId} "<message>"\` instead.`);
1405
+ `\`agents cloud message ${agent.cloudSessionId ?? agent.agentId} "<message>"\` instead.`);
1406
1406
  }
1407
1407
  if (agent.agentType !== 'claude' && !agent.remoteSessionId) {
1408
1408
  throw new Error(`No resumable session id was captured for ${agent.agentType} teammate '${who}' — ` +
@@ -1,8 +1,5 @@
1
- import * as http from 'http';
2
- import type { IncomingHttpHeaders } from 'http';
3
- import type { JobConfig, RunMeta, WebhookContext } from '../scheduling/routines.js';
4
- import { type FiredHandler } from './handlers.js';
5
- export type WebhookSource = 'github' | 'linear' | 'slack';
1
+ import type { JobConfig, RunMeta } from '../scheduling/routines.js';
2
+ export type WebhookSource = 'github' | 'linear';
6
3
  export interface IncomingWebhook {
7
4
  source: WebhookSource;
8
5
  event: string;
@@ -20,64 +17,10 @@ export declare function matchJobsToWebhook(jobs: JobConfig[], webhook: IncomingW
20
17
  export interface FireWebhookOptions {
21
18
  jobs?: JobConfig[];
22
19
  dispatch?: (config: JobConfig) => Promise<RunMeta>;
23
- skipJobNames?: ReadonlySet<string>;
24
- onJobFired?: (job: JobConfig, fired: FiredJob) => void;
25
- context?: WebhookContext;
26
20
  }
27
21
  interface FiredJob {
28
22
  jobName: string;
29
23
  runId: string;
30
24
  }
31
25
  export declare function fireWebhookJobs(webhook: IncomingWebhook, options?: FireWebhookOptions): Promise<FiredJob[]>;
32
- export declare function verifyGithubSignature(headers: IncomingHttpHeaders, rawBody: Buffer, secret: string): boolean;
33
- export declare function verifyLinearSignature(headers: IncomingHttpHeaders, rawBody: Buffer, secret: string): boolean;
34
- export declare function verifySlackSignature(headers: IncomingHttpHeaders, rawBody: Buffer, secret: string, now?: number, toleranceSec?: number): boolean;
35
- export interface SlackPayload extends Record<string, unknown> {
36
- type: string;
37
- challenge?: string;
38
- event_id?: string;
39
- event_type?: string;
40
- text?: string;
41
- channel?: string;
42
- thread_ts?: string;
43
- user?: string;
44
- command?: string;
45
- response_url?: string;
46
- team?: string;
47
- }
48
- export declare function parseSlackBody(contentType: string | undefined, rawBody: Buffer): SlackPayload;
49
- export declare function slackEventName(payload: SlackPayload): string;
50
- export interface WebhookSecrets {
51
- github?: string;
52
- linear?: string;
53
- slack?: string;
54
- }
55
- interface DeliveryStore {
56
- seen(id: string): boolean;
57
- mark(id: string): void;
58
- completedJobs(id: string): ReadonlySet<string>;
59
- markJob(id: string, jobName: string): void;
60
- }
61
- export declare function createFileDeliveryStore(filePath: string, retentionMs?: number): DeliveryStore;
62
- interface RateLimiter {
63
- take(key: string): boolean;
64
- }
65
- export declare function waitForListening(server: http.Server): Promise<void>;
66
- interface WebhookServerOptions {
67
- port?: number;
68
- host?: string;
69
- secrets: WebhookSecrets;
70
- fire?: FireWebhookOptions;
71
- onMatch?: (webhook: IncomingWebhook, matchedJobNames: string[], matchedHandlerNames: string[]) => void;
72
- onDelivery?: (webhook: IncomingWebhook, fired: FiredJob[], handlers: FiredHandler[]) => void;
73
- onDeliveryError?: (webhook: IncomingWebhook, error: Error) => void;
74
- deliveryStore?: DeliveryStore;
75
- rateLimiter?: RateLimiter;
76
- rateLimitPerMinute?: number;
77
- maxBodyBytes?: number;
78
- ipRateLimiter?: RateLimiter;
79
- ipRateLimitPerMinute?: number;
80
- maxConnections?: number;
81
- }
82
- export declare function startWebhookServer(options: WebhookServerOptions): http.Server;
83
26
  export {};