agent-afk 5.315.2 → 5.316.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.
@@ -22,6 +22,10 @@ export type ExecFn = (file: string, args: string[]) => Promise<{
22
22
  stderr: string;
23
23
  }>;
24
24
  export declare function _resetCacheForTest(): void;
25
+ export declare function defaultExecFn(file: string, args: string[]): Promise<{
26
+ stdout: string;
27
+ stderr: string;
28
+ }>;
25
29
  export declare function checkGhReady(opts?: {
26
30
  execFn?: ExecFn;
27
31
  ttlMs?: number;
@@ -33,6 +37,10 @@ export type ExecWithInputFn = (file: string, args: string[], input: string) => P
33
37
  stdout: string;
34
38
  stderr: string;
35
39
  }>;
40
+ export declare function defaultExecWithInput(file: string, args: string[], input: string): Promise<{
41
+ stdout: string;
42
+ stderr: string;
43
+ }>;
36
44
  export interface PostPrCommentOpts {
37
45
  pr: string;
38
46
  body: string;
@@ -0,0 +1,12 @@
1
+ import { type ExecFn, type ExecWithInputFn } from './gh.js';
2
+ export type ViewerPermission = 'ADMIN' | 'MAINTAIN' | 'WRITE' | 'TRIAGE' | 'READ' | 'NONE';
3
+ export declare function canApplyLabels(permission: ViewerPermission): boolean;
4
+ export declare function getGhLogin(execFn?: ExecFn): Promise<string | null>;
5
+ export declare function getViewerPermission(repo: string, execFn?: ExecFn): Promise<ViewerPermission>;
6
+ export interface CreateIssueOpts {
7
+ repo: string;
8
+ title: string;
9
+ body: string;
10
+ labels?: readonly string[];
11
+ }
12
+ export declare function createIssue(opts: CreateIssueOpts, execFn?: ExecWithInputFn): Promise<string>;
@@ -0,0 +1,22 @@
1
+ export declare const BUG_REPORT_REPO = "griffinwork40/agent-afk";
2
+ export declare const MAX_BUG_URL_LENGTH = 7500;
3
+ export interface BugEnvironment {
4
+ version: string;
5
+ nodeVersion: string;
6
+ os: string;
7
+ model?: string;
8
+ sessionId?: string;
9
+ }
10
+ export interface BugReport {
11
+ title: string;
12
+ body: string;
13
+ }
14
+ export interface BugReportLink {
15
+ url: string;
16
+ truncated: boolean;
17
+ }
18
+ export declare function buildBugTitle(description: string): string;
19
+ export declare function buildBugBody(description: string, env: BugEnvironment): string;
20
+ export declare function buildBugReport(description: string, env: BugEnvironment): BugReport;
21
+ export declare function bugReportUrl(report: BugReport, repo?: string): string;
22
+ export declare function buildBugReportLink(description: string, env: BugEnvironment, maxLength?: number): BugReportLink;
@@ -0,0 +1,11 @@
1
+ import { type BugEnvironment } from './bug.body.js';
2
+ import { type BugFileDeps } from './bug.file.js';
3
+ import type { SlashCommand, SlashContext, SlashResult } from '../types.js';
4
+ export declare function collectBugEnvironment(ctx: SlashContext): BugEnvironment;
5
+ export declare function parseBugArgs(args: string): {
6
+ file: boolean;
7
+ description: string;
8
+ };
9
+ export declare function printBugLink(ctx: SlashContext, description: string, env: BugEnvironment): SlashResult;
10
+ export declare function runBug(ctx: SlashContext, args: string, deps?: BugFileDeps): Promise<SlashResult>;
11
+ export declare const bugCmd: SlashCommand;
@@ -0,0 +1,15 @@
1
+ import { type GhReadiness } from '../../../agent/gh.js';
2
+ import { type CreateIssueOpts, type ViewerPermission } from '../../../agent/gh.issue.js';
3
+ import { type BugEnvironment, type BugReport } from './bug.body.js';
4
+ import type { SlashContext, SlashResult } from '../types.js';
5
+ import type { TerminalCompositor } from '../../terminal-compositor.js';
6
+ export interface BugFileDeps {
7
+ checkGhReady: () => Promise<GhReadiness>;
8
+ getGhLogin: () => Promise<string | null>;
9
+ getViewerPermission: (repo: string) => Promise<ViewerPermission>;
10
+ createIssue: (opts: CreateIssueOpts) => Promise<string>;
11
+ }
12
+ export declare const defaultBugFileDeps: BugFileDeps;
13
+ export declare function buildFilePreviewRows(report: BugReport, login: string, labels: readonly string[], repo?: string): string[];
14
+ export declare function confirmFiling(compositor: TerminalCompositor, rows: readonly string[]): Promise<boolean>;
15
+ export declare function fileBugViaGh(ctx: SlashContext, description: string, env: BugEnvironment, fallback: () => SlashResult, deps?: BugFileDeps): Promise<SlashResult>;